diff options
Diffstat (limited to 'sword1')
-rw-r--r-- | sword1/animation.cpp | 17 | ||||
-rw-r--r-- | sword1/animation.h | 3 |
2 files changed, 15 insertions, 5 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 diff --git a/sword1/animation.h b/sword1/animation.h index 58b1be61ee..1c55bc4f07 100644 --- a/sword1/animation.h +++ b/sword1/animation.h @@ -129,6 +129,7 @@ private: #ifdef BACKEND_8BIT void buildLookup(int p, int lines); bool checkPaletteSwitch(); + void setPalette(byte *pal); #else void buildLookup(void); void plotYUV(OverlayColor *lut, int width, int height, byte *const *dat); @@ -142,7 +143,7 @@ private: OSystem *_sys; public: - MoviePlayer(Screen *scr, SoundMixer *snd, OSystem *sys) : _scr(scr), _snd(snd), _sys(sys) {} + MoviePlayer(Screen *scr, SoundMixer *snd, OSystem *sys); void play(const char *filename); }; |