aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/animation.cpp235
-rw-r--r--graphics/animation.h51
-rw-r--r--sword1/animation.cpp8
-rw-r--r--sword1/screen.cpp4
-rw-r--r--sword1/screen.h2
-rw-r--r--sword2/build_display.h2
-rw-r--r--sword2/driver/animation.cpp26
-rw-r--r--sword2/driver/render.cpp3
8 files changed, 163 insertions, 168 deletions
diff --git a/graphics/animation.cpp b/graphics/animation.cpp
index 59d56e92c5..18f294fa08 100644
--- a/graphics/animation.cpp
+++ b/graphics/animation.cpp
@@ -31,27 +31,27 @@
namespace Graphics {
BaseAnimationState::BaseAnimationState(SoundMixer *snd, OSystem *sys, int width, int height)
- : MOVIE_WIDTH(width), MOVIE_HEIGHT(height), _snd(snd), _sys(sys) {
+ : _movieWidth(width), _movieHeight(height), _snd(snd), _sys(sys) {
#ifndef BACKEND_8BIT
- colortab = NULL;
- rgb_2_pix = NULL;
- bitFormat = 0;
+ _colorTab = NULL;
+ _rgbToPix = NULL;
+ _bitFormat = 0;
#endif
}
BaseAnimationState::~BaseAnimationState() {
#ifdef USE_MPEG2
- _snd->stopHandle(bgSound);
- if (decoder)
- mpeg2_close(decoder);
- delete mpgfile;
+ _snd->stopHandle(_bgSound);
+ if (_mpegDecoder)
+ mpeg2_close(_mpegDecoder);
+ delete _mpegFile;
#ifndef BACKEND_8BIT
_sys->hideOverlay();
- free(overlay);
- free(colortab);
- free(rgb_2_pix);
+ free(_overlay);
+ free(_colorTab);
+ free(_rgbToPix);
#endif
- delete bgSoundStream;
+ delete _bgSoundStream;
#endif
}
@@ -60,9 +60,9 @@ bool BaseAnimationState::init(const char *name, void *audioArg) {
#ifdef USE_MPEG2
char tempFile[512];
- decoder = NULL;
- mpgfile = NULL;
- bgSoundStream = NULL;
+ _mpegDecoder = NULL;
+ _mpegFile = NULL;
+ _bgSoundStream = NULL;
#ifdef BACKEND_8BIT
@@ -80,23 +80,23 @@ bool BaseAnimationState::init(const char *name, void *audioArg) {
p = 0;
while (1) {
- palettes[p].end = f.readUint16LE();
- palettes[p].cnt = f.readUint16LE();
+ _palettes[p].end = f.readUint16LE();
+ _palettes[p].cnt = f.readUint16LE();
if (f.ioFailed())
break;
- for (i = 0; i < palettes[p].cnt; i++) {
- palettes[p].pal[4 * i] = f.readByte();
- palettes[p].pal[4 * i + 1] = f.readByte();
- palettes[p].pal[4 * i + 2] = f.readByte();
- palettes[p].pal[4 * i + 3] = 0;
+ for (i = 0; i < _palettes[p].cnt; i++) {
+ _palettes[p].pal[4 * i] = f.readByte();
+ _palettes[p].pal[4 * i + 1] = f.readByte();
+ _palettes[p].pal[4 * i + 2] = f.readByte();
+ _palettes[p].pal[4 * i + 3] = 0;
}
for (; i < 256; i++) {
- palettes[p].pal[4 * i] = 0;
- palettes[p].pal[4 * i + 1] = 0;
- palettes[p].pal[4 * i + 2] = 0;
- palettes[p].pal[4 * i + 3] = 0;
+ _palettes[p].pal[4 * i] = 0;
+ _palettes[p].pal[4 * i + 1] = 0;
+ _palettes[p].pal[4 * i + 2] = 0;
+ _palettes[p].pal[4 * i + 3] = 0;
}
p++;
@@ -104,46 +104,46 @@ bool BaseAnimationState::init(const char *name, void *audioArg) {
f.close();
- palnum = 0;
- maxPalnum = p;
- setPalette(palettes[palnum].pal);
- lut = lut2 = lookup[0];
- curpal = -1;
- cr = 0;
- buildLookup(palnum, 256);
- lut2 = lookup[1];
- lutcalcnum = (BITDEPTH + palettes[palnum].end + 2) / (palettes[palnum].end + 2);
+ _palNum = 0;
+ _maxPalNum = p;
+ setPalette(_palettes[_palNum].pal);
+ _lut = _lut2 = _yuvLookup[0];
+ _curPal = -1;
+ _cr = 0;
+ buildLookup(_palNum, 256);
+ _lut2 = _yuvLookup[1];
+ _lutCalcNum = (BITDEPTH + _palettes[_palNum].end + 2) / (_palettes[_palNum].end + 2);
#else
buildLookup();
- overlay = (OverlayColor*)calloc(MOVIE_WIDTH * MOVIE_HEIGHT, sizeof(OverlayColor));
+ _overlay = (OverlayColor*)calloc(_movieWidth * _movieHeight, sizeof(OverlayColor));
_sys->showOverlay();
#endif
// Open MPEG2 stream
- mpgfile = new File();
+ _mpegFile = new File();
sprintf(tempFile, "%s.mp2", name);
- if (!mpgfile->open(tempFile)) {
+ if (!_mpegFile->open(tempFile)) {
warning("Cutscene: Could not open %s", tempFile);
return false;
}
// Load and configure decoder
- decoder = mpeg2_init();
- if (decoder == NULL) {
+ _mpegDecoder = mpeg2_init();
+ if (_mpegDecoder == NULL) {
warning("Cutscene: Could not allocate an MPEG2 decoder");
return false;
}
- info = mpeg2_info(decoder);
- framenum = 0;
- frameskipped = 0;
- ticks = _sys->getMillis();
+ _mpegInfo = mpeg2_info(_mpegDecoder);
+ _frameNum = 0;
+ _frameSkipped = 0;
+ _ticks = _sys->getMillis();
// Play audio
- bgSoundStream = createAudioStream(name, audioArg);
+ _bgSoundStream = createAudioStream(name, audioArg);
- if (bgSoundStream != NULL) {
- _snd->playInputStream(SoundMixer::kSFXSoundType, &bgSound, bgSoundStream, -1, 255, 0, false);
+ if (_bgSoundStream != NULL) {
+ _snd->playInputStream(SoundMixer::kSFXSoundType, &_bgSound, _bgSoundStream, -1, 255, 0, false);
} else {
warning("Cutscene: Could not open Audio Track for %s", name);
}
@@ -163,20 +163,21 @@ bool BaseAnimationState::decodeFrame() {
mpeg2_state_t state;
const mpeg2_sequence_t *sequence_i;
size_t size = (size_t) -1;
+ static byte buf[BUFFER_SIZE];
do {
- state = mpeg2_parse(decoder);
- sequence_i = info->sequence;
+ state = mpeg2_parse(_mpegDecoder);
+ sequence_i = _mpegInfo->sequence;
switch (state) {
case STATE_BUFFER:
- size = mpgfile->read(buffer, BUFFER_SIZE);
- mpeg2_buffer(decoder, buffer, buffer + size);
+ size = _mpegFile->read(buf, BUFFER_SIZE);
+ mpeg2_buffer(_mpegDecoder, buf, buf + size);
break;
case STATE_SLICE:
case STATE_END:
- if (info->display_fbuf) {
+ if (_mpegInfo->display_fbuf) {
/* simple audio video sync code:
* we calculate the actual frame by taking the elapsed audio time and try
* to stay inside +- 1 frame of this calculated frame number by dropping
@@ -184,45 +185,37 @@ bool BaseAnimationState::decodeFrame() {
*/
/* Avoid deadlock is sound was too far ahead */
- if (bgSoundStream && !bgSound.isActive())
+ if (_bgSoundStream && !_bgSound.isActive())
return false;
- if (checkPaletteSwitch() || (bgSoundStream == NULL) ||
- ((_snd->getSoundElapsedTime(bgSound) * 12) / 1000 < framenum + 1) ||
- frameskipped > 10) {
- if (frameskipped > 10) {
- warning("force frame %i redraw", framenum);
- frameskipped = 0;
+ if (checkPaletteSwitch() || (_bgSoundStream == NULL) ||
+ ((_snd->getSoundElapsedTime(_bgSound) * 12) / 1000 < _frameNum + 1) ||
+ _frameSkipped > 10) {
+ if (_frameSkipped > 10) {
+ warning("force frame %i redraw", _frameNum);
+ _frameSkipped = 0;
}
- drawYUV(sequence_i->width, sequence_i->height, info->display_fbuf->buf);
+ drawYUV(sequence_i->width, sequence_i->height, _mpegInfo->display_fbuf->buf);
- if (bgSoundStream) {
- while ((_snd->getSoundElapsedTime(bgSound) * 12) / 1000 < framenum)
+ if (_bgSoundStream) {
+ while ((_snd->getSoundElapsedTime(_bgSound) * 12) / 1000 < _frameNum)
_sys->delayMillis(10);
} else {
- ticks += 83;
- while (_sys->getMillis() < ticks)
+ _ticks += 83;
+ while (_sys->getMillis() < _ticks)
_sys->delayMillis(10);
- // FIXME: This used to be used for the Sword2 version of this
- // method. I do not see any compelling reason why it should be
- // used, but maybe I am wrong; so if you know more, either
- // remove this comment, or change the implementation of the
- // method to use "sleepUntil" for BS2.
- //_vm->sleepUntil(ticks);
}
-
} else {
- warning("dropped frame %i", framenum);
- frameskipped++;
+ warning("dropped frame %i", _frameNum);
+ _frameSkipped++;
}
#ifdef BACKEND_8BIT
- buildLookup(palnum + 1, lutcalcnum);
+ buildLookup(_palNum + 1, _lutCalcNum);
#endif
- framenum++;
+ _frameNum++;
return true;
-
}
break;
@@ -237,13 +230,13 @@ bool BaseAnimationState::decodeFrame() {
bool BaseAnimationState::checkPaletteSwitch() {
#ifdef BACKEND_8BIT
// if we have reached the last image with this palette, switch to new one
- if (framenum == palettes[palnum].end) {
- unsigned char *l = lut2;
- palnum++;
- setPalette(palettes[palnum].pal);
- lutcalcnum = (BITDEPTH + palettes[palnum].end - (framenum + 1) + 2) / (palettes[palnum].end - (framenum + 1) + 2);
- lut2 = lut;
- lut = l;
+ if (_frameNum == _palettes[_palNum].end) {
+ unsigned char *l = _lut2;
+ _palNum++;
+ setPalette(_palettes[_palNum].pal);
+ _lutCalcNum = (BITDEPTH + _palettes[_palNum].end - (_frameNum + 1) + 2) / (_palettes[_palNum].end - (_frameNum + 1) + 2);
+ _lut2 = _lut;
+ _lut = l;
return true;
}
#endif
@@ -260,45 +253,45 @@ void BaseAnimationState::buildLookup(int p, int lines) {
int y, cb;
int r, g, b, ii;
- if (p >= maxPalnum)
+ if (p >= _maxPalNum)
return;
- if (p != curpal) {
- curpal = p;
- cr = 0;
- pos = 0;
+ if (p != _curPal) {
+ _curPal = p;
+ _cr = 0;
+ _pos = 0;
}
- if (cr > BITDEPTH)
+ if (_cr > BITDEPTH)
return;
for (ii = 0; ii < lines; ii++) {
- r = (-16 * 256 + (int) (256 * 1.596) * ((cr << SHIFT) - 128)) / 256;
+ r = (-16 * 256 + (int) (256 * 1.596) * ((_cr << SHIFT) - 128)) / 256;
for (cb = 0; cb <= BITDEPTH; cb++) {
- g = (-16 * 256 - (int) (0.813 * 256) * ((cr << SHIFT) - 128) - (int) (0.391 * 256) * ((cb << SHIFT) - 128)) / 256;
+ g = (-16 * 256 - (int) (0.813 * 256) * ((_cr << SHIFT) - 128) - (int) (0.391 * 256) * ((cb << SHIFT) - 128)) / 256;
b = (-16 * 256 + (int) (2.018 * 256) * ((cb << SHIFT) - 128)) / 256;
for (y = 0; y <= BITDEPTH; y++) {
int idx, bst = 0;
- int dis = 2 * SQR(r - palettes[p].pal[0]) + 4 * SQR(g - palettes[p].pal[1]) + SQR(b - palettes[p].pal[2]);
+ int dis = 2 * SQR(r - _palettes[p].pal[0]) + 4 * SQR(g - _palettes[p].pal[1]) + SQR(b - _palettes[p].pal[2]);
for (idx = 1; idx < 256; idx++) {
- long d2 = 2 * SQR(r - palettes[p].pal[4 * idx]) + 4 * SQR(g - palettes[p].pal[4 * idx + 1]) + SQR(b - palettes[p].pal[4 * idx + 2]);
+ long d2 = 2 * SQR(r - _palettes[p].pal[4 * idx]) + 4 * SQR(g - _palettes[p].pal[4 * idx + 1]) + SQR(b - _palettes[p].pal[4 * idx + 2]);
if (d2 < dis) {
bst = idx;
dis = d2;
}
}
- lut2[pos++] = bst;
+ _lut2[_pos++] = bst;
r += (1 << SHIFT);
g += (1 << SHIFT);
b += (1 << SHIFT);
}
- r -= (BITDEPTH+1)*(1 << SHIFT);
+ r -= (BITDEPTH + 1) * (1 << SHIFT);
}
- cr++;
- if (cr > BITDEPTH)
+ _cr++;
+ if (_cr > BITDEPTH)
return;
}
}
@@ -370,24 +363,24 @@ void BaseAnimationState::buildLookup(int p, int lines) {
void BaseAnimationState::buildLookup() {
// Do we already have lookup tables for this bit format?
- if (gBitFormat == bitFormat && colortab && rgb_2_pix)
+ if (gBitFormat == _bitFormat && _colorTab && _rgbToPix)
return;
- free(colortab);
- free(rgb_2_pix);
+ free(_colorTab);
+ free(_rgbToPix);
- colortab = (int16 *)malloc(4 * 256 * sizeof(int16));
+ _colorTab = (int16 *)malloc(4 * 256 * sizeof(int16));
- int16 *Cr_r_tab = &colortab[0 * 256];
- int16 *Cr_g_tab = &colortab[1 * 256];
- int16 *Cb_g_tab = &colortab[2 * 256];
- int16 *Cb_b_tab = &colortab[3 * 256];
+ int16 *Cr_r_tab = &_colorTab[0 * 256];
+ int16 *Cr_g_tab = &_colorTab[1 * 256];
+ int16 *Cb_g_tab = &_colorTab[2 * 256];
+ int16 *Cb_b_tab = &_colorTab[3 * 256];
- rgb_2_pix = (uint16 *)malloc(3 * 768 * sizeof(uint16));
+ _rgbToPix = (uint16 *)malloc(3 * 768 * sizeof(uint16));
- uint16 *r_2_pix_alloc = &rgb_2_pix[0 * 768];
- uint16 *g_2_pix_alloc = &rgb_2_pix[1 * 768];
- uint16 *b_2_pix_alloc = &rgb_2_pix[2 * 768];
+ uint16 *r_2_pix_alloc = &_rgbToPix[0 * 768];
+ uint16 *g_2_pix_alloc = &_rgbToPix[1 * 768];
+ uint16 *b_2_pix_alloc = &_rgbToPix[2 * 768];
int16 CR, CB;
int i;
@@ -441,11 +434,11 @@ void BaseAnimationState::buildLookup() {
b_2_pix_alloc[i + 512] = b_2_pix_alloc[511];
}
- bitFormat = gBitFormat;
+ _bitFormat = gBitFormat;
}
void BaseAnimationState::plotYUV(int width, int height, byte *const *dat) {
- OverlayColor *ptr = overlay + (MOVIE_HEIGHT - height) / 2 * MOVIE_WIDTH + (MOVIE_WIDTH - width) / 2;
+ OverlayColor *ptr = _overlay + (_movieHeight - height) / 2 * _movieWidth + (_movieWidth - width) / 2;
byte *lum = dat[0];
byte *cr = dat[2];
@@ -458,7 +451,7 @@ void BaseAnimationState::plotYUV(int width, int height, byte *const *dat) {
int16 cb_b;
OverlayColor *row1 = ptr;
- OverlayColor *row2 = ptr + MOVIE_WIDTH;
+ OverlayColor *row2 = ptr + _movieWidth;
int x, y;
@@ -466,23 +459,23 @@ void BaseAnimationState::plotYUV(int width, int height, byte *const *dat) {
for (x = 0; x < width; x += 2) {
register byte L;
- cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
- crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] + colortab[*cb + 2 * 256];
- cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
+ cr_r = 0 * 768 + 256 + _colorTab[*cr + 0 * 256];
+ crb_g = 1 * 768 + 256 + _colorTab[*cr + 1 * 256] + _colorTab[*cb + 2 * 256];
+ cb_b = 2 * 768 + 256 + _colorTab[*cb + 3 * 256];
++cr;
++cb;
L = *lum++;
- *row1++ = (rgb_2_pix[L + cr_r] | rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
+ *row1++ = (_rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L + cb_b]);
L = *lum++;
- *row1++ = (rgb_2_pix[L + cr_r] | rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
+ *row1++ = (_rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L + cb_b]);
// Now, do second row.
L = *lum2++;
- *row2++ = (rgb_2_pix[L + cr_r] | rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
+ *row2++ = (_rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L + cb_b]);
L = *lum2++;
- *row2++ = (rgb_2_pix[L + cr_r] | rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
+ *row2++ = (_rgbToPix[L + cr_r] | _rgbToPix[L + crb_g] | _rgbToPix[L + cb_b]);
}
// These values are at the start of the next line, (due
@@ -491,8 +484,8 @@ void BaseAnimationState::plotYUV(int width, int height, byte *const *dat) {
lum += width;
lum2 += width;
- row1 += (2 * MOVIE_WIDTH - width);
- row2 += (2 * MOVIE_WIDTH - width);
+ row1 += (2 * _movieWidth - width);
+ row2 += (2 * _movieWidth - width);
}
}
diff --git a/graphics/animation.h b/graphics/animation.h
index f59fbae57d..71546746c6 100644
--- a/graphics/animation.h
+++ b/graphics/animation.h
@@ -63,56 +63,53 @@ typedef sequence_t mpeg2_sequence_t;
#define BUFFER_SIZE 4096
-
namespace Graphics {
class BaseAnimationState {
protected:
- const int MOVIE_WIDTH;
- const int MOVIE_HEIGHT;
+ const int _movieWidth;
+ const int _movieHeight;
SoundMixer *_snd;
OSystem *_sys;
- uint framenum;
- uint frameskipped;
- uint32 ticks;
+ uint _frameNum;
+ uint _frameSkipped;
+ uint32 _ticks;
#ifdef USE_MPEG2
- mpeg2dec_t *decoder;
- const mpeg2_info_t *info;
+ mpeg2dec_t *_mpegDecoder;
+ const mpeg2_info_t *_mpegInfo;
#endif
- File *mpgfile;
-
- byte buffer[BUFFER_SIZE];
+ File *_mpegFile;
- PlayingSoundHandle bgSound;
- AudioStream *bgSoundStream;
+ PlayingSoundHandle _bgSound;
+ AudioStream *_bgSoundStream;
#ifdef BACKEND_8BIT
- int palnum;
- int maxPalnum;
+ int _palNum;
+ int _maxPalNum;
- byte lookup[2][(BITDEPTH+1) * (BITDEPTH+1) * (BITDEPTH+1)];
- byte *lut;
- byte *lut2;
- int lutcalcnum;
+ byte _yuvLookup[2][(BITDEPTH+1) * (BITDEPTH+1) * (BITDEPTH+1)];
+ byte *_lut;
+ byte *_lut2;
+ int _lutCalcNum;
- int curpal;
- int cr;
- int pos;
+ int _curPal;
+ int _cr;
+ int _pos;
struct {
uint cnt;
uint end;
byte pal[4 * 256];
- } palettes[50];
+ } _palettes[50];
#else
- OverlayColor *overlay;
- int bitFormat;
- int16 *colortab;
- uint16 *rgb_2_pix;
+ OverlayColor *_overlay;
+ int _bitFormat;
+ int16 *_colorTab;
+ uint16 *_rgbToPix;
#endif
public:
diff --git a/sword1/animation.cpp b/sword1/animation.cpp
index b363ea761f..927bdc7543 100644
--- a/sword1/animation.cpp
+++ b/sword1/animation.cpp
@@ -48,7 +48,7 @@ void AnimationState::setPalette(byte *pal) {
void AnimationState::drawYUV(int width, int height, byte *const *dat) {
#ifdef BACKEND_8BIT
- _scr->plotYUV(lut, width, height, dat);
+ _scr->plotYUV(_lut, width, height, dat);
#else
plotYUV(width, height, dat);
#endif
@@ -56,7 +56,7 @@ void AnimationState::drawYUV(int width, int height, byte *const *dat) {
void AnimationState::updateScreen(void) {
#ifndef BACKEND_8BIT
- _sys->copyRectToOverlay(overlay, MOVIE_WIDTH, 0, 40, MOVIE_WIDTH, MOVIE_HEIGHT);
+ _sys->copyRectToOverlay(_overlay, _movieWidth, 0, 40, _movieWidth, _movieHeight);
#endif
_sys->updateScreen();
}
@@ -65,12 +65,12 @@ OverlayColor *AnimationState::giveRgbBuffer(void) {
#ifdef BACKEND_8BIT
return NULL;
#else
- return overlay;
+ return _overlay;
#endif
}
bool AnimationState::soundFinished(void) {
- return !bgSound.isActive();
+ return !_bgSound.isActive();
}
AudioStream *AnimationState::createAudioStream(const char *name, void *arg) {
diff --git a/sword1/screen.cpp b/sword1/screen.cpp
index 23b4f154bf..994419261b 100644
--- a/sword1/screen.cpp
+++ b/sword1/screen.cpp
@@ -32,6 +32,10 @@
#include "sword1/menu.h"
#include "sword1/sword1.h"
+#ifdef BACKEND_8BIT
+#include "sword1/animation.h"
+#endif
+
#if defined(__PALM_OS__)
#include "arm/native.h"
#include "arm/macros.h"
diff --git a/sword1/screen.h b/sword1/screen.h
index 72f382ed3b..2392039680 100644
--- a/sword1/screen.h
+++ b/sword1/screen.h
@@ -95,8 +95,6 @@ public:
void plotYUV(byte *lut, int width, int height, byte *const *dat);
#endif
-
-
private:
// for router debugging
void drawLine(uint16 x1, uint16 y1, uint16 x2, uint16 y2);
diff --git a/sword2/build_display.h b/sword2/build_display.h
index 4259b4360e..bccd88ad87 100644
--- a/sword2/build_display.h
+++ b/sword2/build_display.h
@@ -417,10 +417,10 @@ public:
void plotPoint(int16 x, int16 y, uint8 colour);
void drawLine(int16 x1, int16 y1, int16 x2, int16 y2, uint8 colour);
+
#ifdef BACKEND_8BIT
void plotYUV(byte *lut, int width, int height, byte *const *dat);
#endif
-
};
} // End of namespace Sword2
diff --git a/sword2/driver/animation.cpp b/sword2/driver/animation.cpp
index 2f428b144f..90da608e69 100644
--- a/sword2/driver/animation.cpp
+++ b/sword2/driver/animation.cpp
@@ -51,7 +51,7 @@ void AnimationState::setPalette(byte *pal) {
#else
void AnimationState::drawTextObject(SpriteInfo *s, byte *src) {
- OverlayColor *dst = overlay + RENDERWIDE * (s->y) + s->x;
+ OverlayColor *dst = _overlay + RENDERWIDE * s->y + s->x;
// FIXME: These aren't the "right" colours, but look good to me.
@@ -78,31 +78,31 @@ void AnimationState::drawTextObject(SpriteInfo *s, byte *src) {
#endif
-void AnimationState::clearScreen(void) {
+void AnimationState::clearScreen() {
#ifdef BACKEND_8BIT
- memset(_vm->_screen->getScreen(), 0, MOVIE_WIDTH * MOVIE_HEIGHT);
+ memset(_vm->_screen->getScreen(), 0, _movieWidth * _movieHeight);
#else
OverlayColor black = _sys->RGBToColor(0, 0, 0);
- for (int i = 0; i < MOVIE_WIDTH * MOVIE_HEIGHT; i++)
- overlay[i] = black;
+ for (int i = 0; i < _movieWidth * _movieHeight; i++)
+ _overlay[i] = black;
#endif
}
-void AnimationState::updateScreen(void) {
+void AnimationState::updateScreen() {
#ifdef BACKEND_8BIT
- byte *buf = _vm->_screen->getScreen() + ((480 - MOVIE_HEIGHT) / 2) * RENDERWIDE + (640 - MOVIE_WIDTH) / 2;
+ byte *buf = _vm->_screen->getScreen() + ((480 - _movieHeight) / 2) * RENDERWIDE + (640 - _movieWidth) / 2;
- _vm->_system->copyRectToScreen(buf, MOVIE_WIDTH, (640 - MOVIE_WIDTH) / 2, (480 - MOVIE_HEIGHT) / 2, MOVIE_WIDTH, MOVIE_HEIGHT);
+ _vm->_system->copyRectToScreen(buf, _movieWidth, (640 - _movieWidth) / 2, (480 - _movieHeight) / 2, _movieWidth, _movieHeight);
#else
- _sys->copyRectToOverlay(overlay, MOVIE_WIDTH, 0, 0, MOVIE_WIDTH, MOVIE_HEIGHT);
+ _sys->copyRectToOverlay(_overlay, _movieWidth, 0, 0, _movieWidth, _movieHeight);
#endif
_vm->_system->updateScreen();
}
void AnimationState::drawYUV(int width, int height, byte *const *dat) {
#ifdef BACKEND_8BIT
- _vm->_screen->plotYUV(lut, width, height, dat);
+ _vm->_screen->plotYUV(_lut, width, height, dat);
#else
plotYUV(width, height, dat);
#endif
@@ -241,12 +241,12 @@ void MoviePlayer::playMPEG(const char *filename, MovieTextObject *text[], byte *
return;
}
-#ifndef BACKEND_8BIT
// Clear the screen, because whatever is on it will be visible when the
- // overlay is removed.
+ // overlay is removed. And if there isn't an overlay, we don't want it
+ // to be visible during the cutscene. (Not all cutscenes cover the
+ // entire screen.)
_vm->_screen->clearScene();
_vm->_screen->updateDisplay();
-#endif
#ifndef SCUMM_BIG_ENDIAN
flags |= SoundMixer::FLAG_LITTLE_ENDIAN;
diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp
index eb50fcb1c8..8587be3b36 100644
--- a/sword2/driver/render.cpp
+++ b/sword2/driver/render.cpp
@@ -24,7 +24,10 @@
#include "sword2/sword2.h"
#include "sword2/defs.h"
#include "sword2/build_display.h"
+
+#ifdef BACKEND_8BIT
#include "sword2/driver/animation.h"
+#endif
namespace Sword2 {