aboutsummaryrefslogtreecommitdiff
path: root/graphics/animation.h
diff options
context:
space:
mode:
authorMax Horn2004-03-22 01:28:45 +0000
committerMax Horn2004-03-22 01:28:45 +0000
commit4466a855986d08d20c6fc6296baec191e1f5e027 (patch)
treeee5437fcc265c1e8800565d9e1493818004a3f23 /graphics/animation.h
parenta9789acfc61a057c82c6cc42386afc9b23813c24 (diff)
downloadscummvm-rg350-4466a855986d08d20c6fc6296baec191e1f5e027.tar.gz
scummvm-rg350-4466a855986d08d20c6fc6296baec191e1f5e027.tar.bz2
scummvm-rg350-4466a855986d08d20c6fc6296baec191e1f5e027.zip
move commong code into separate source file (more could be done, but it's a start)
svn-id: r13358
Diffstat (limited to 'graphics/animation.h')
-rw-r--r--graphics/animation.h85
1 files changed, 84 insertions, 1 deletions
diff --git a/graphics/animation.h b/graphics/animation.h
index ce3ff6620f..cfd96b3d78 100644
--- a/graphics/animation.h
+++ b/graphics/animation.h
@@ -22,6 +22,11 @@
#ifndef GRAPHICS_ANIMATION_H
#define GRAPHICS_ANIMATION_H
+#include "common/scummsys.h"
+#include "sound/mixer.h"
+
+class AudioStream;
+
// Uncomment this if you are using libmpeg2 0.3.1.
// #define USE_MPEG2_0_3_1
@@ -50,7 +55,85 @@ typedef sequence_t mpeg2_sequence_t;
#endif
+#ifdef BACKEND_8BIT
+#define SQR(x) ((x) * (x))
+#define SHIFT 3
+#else
+#define SHIFT 1
+#endif
+
+#define BITDEPTH (1 << (8 - SHIFT))
+#define ROUNDADD (1 << (SHIFT - 1))
+
+#define BUFFER_SIZE 4096
+
+
+namespace Graphics {
+
+class BaseAnimationState {
+protected:
+ const int MOVIE_WIDTH;
+ const int MOVIE_HEIGHT;
+
+ SoundMixer *_snd;
+ OSystem *_sys;
+
+ uint framenum;
+ uint frameskipped;
+ uint32 ticks;
+
+#ifdef USE_MPEG2
+ mpeg2dec_t *decoder;
+ const mpeg2_info_t *info;
+#endif
+
+ File *mpgfile;
+ File *sndfile;
+ byte buffer[BUFFER_SIZE];
+ PlayingSoundHandle bgSound;
+ AudioStream *bgSoundStream;
-#endif \ No newline at end of file
+#ifdef BACKEND_8BIT
+ int palnum;
+ int maxPalnum;
+
+ byte lookup[2][(BITDEPTH+1) * (BITDEPTH+1) * (BITDEPTH+1)];
+ byte *lut;
+ byte *lut2;
+ int lutcalcnum;
+
+ int curpal;
+ int cr;
+ int pos;
+
+ struct {
+ uint cnt;
+ uint end;
+ byte pal[4 * 256];
+ } palettes[50];
+#else
+ static OverlayColor *lookup;
+ OverlayColor *overlay;
+#endif
+
+public:
+ BaseAnimationState(SoundMixer *snd, OSystem *sys, int width, int height);
+ virtual ~BaseAnimationState();
+
+protected:
+#ifdef BACKEND_8BIT
+ void buildLookup(int p, int lines);
+ bool checkPaletteSwitch();
+ virtual void setPalette(byte *pal) = 0;
+#else
+ void buildLookup(void);
+ void plotYUV(OverlayColor *lut, int width, int height, byte *const *dat);
+#endif
+};
+
+
+} // End of namespace Graphics
+
+#endif