aboutsummaryrefslogtreecommitdiff
path: root/sword1/animation.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sword1/animation.cpp')
-rw-r--r--sword1/animation.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/sword1/animation.cpp b/sword1/animation.cpp
index 74f9494d7f..f8e5d16fd6 100644
--- a/sword1/animation.cpp
+++ b/sword1/animation.cpp
@@ -104,7 +104,7 @@ bool AnimationState::init(const char *name) {
palnum = 0;
maxPalnum = p;
- _sys->setPalette(palettes[palnum].pal, 0, 256);
+ setPalette(palettes[palnum].pal);
lut = lut2 = lookup[0];
curpal = -1;
cr = 0;
@@ -140,6 +140,7 @@ bool AnimationState::init(const char *name) {
/* Play audio - TODO: Sync with video?*/
sndfile = new File();
bgSoundStream = AudioStream::openStreamFile(name, sndfile);
+
if (bgSoundStream != NULL) {
_snd->playInputStream(&bgSound, bgSoundStream, false, 255, 0, -1, false);
} else {
@@ -209,7 +210,7 @@ bool AnimationState::checkPaletteSwitch() {
if (framenum == palettes[palnum].end) {
unsigned char *l = lut2;
palnum++;
- _sys->setPalette(palettes[palnum].pal, 0, 256);
+ setPalette(palettes[palnum].pal);
lutcalcnum = (BITDEPTH + palettes[palnum].end - (framenum + 1) + 2) / (palettes[palnum].end - (framenum + 1) + 2);
lut2 = lut;
lut = l;
@@ -219,6 +220,10 @@ bool AnimationState::checkPaletteSwitch() {
return false;
}
+void AnimationState::setPalette(byte *pal) {
+ _sys->setPalette(pal, 0, 256);
+}
+
#else
OverlayColor *AnimationState::lookup = 0;
@@ -268,9 +273,9 @@ void AnimationState::plotYUV(OverlayColor *lut, int width, int height, byte *con
int i = ((((dat[2][cpos] + ROUNDADD) >> SHIFT) * (BITDEPTH+1)) + ((dat[1][cpos] + ROUNDADD)>>SHIFT)) * 256;
cpos++;
- ptr[linepos ] = lut[i + dat[0][ ypos ]];
+ ptr[linepos ] = lut[i + dat[0][ ypos ]];
ptr[MOVIE_WIDTH + linepos++] = lut[i + dat[0][width + ypos++]];
- ptr[linepos ] = lut[i + dat[0][ ypos ]];
+ ptr[linepos ] = lut[i + dat[0][ ypos ]];
ptr[MOVIE_WIDTH + linepos++] = lut[i + dat[0][width + ypos++]];
}
@@ -376,6 +381,10 @@ bool AnimationState::decodeFrame() {
return false;
}
+MoviePlayer::MoviePlayer(Screen *scr, SoundMixer *snd, OSystem *sys)
+ : _scr(scr), _snd(snd), _sys(sys) {
+}
+
/**
* Plays an animated cutscene.
* @param filename the file name of the cutscene file