Ticket #7492: bs1-dxa-v2.diff
File bs1-dxa-v2.diff, 21.8 KB (added by , 18 years ago) |
---|
-
engines/sword1/screen.h
69 69 public: 70 70 Screen(OSystem *system, ResMan *pResMan, ObjectMan *pObjMan); 71 71 ~Screen(void); 72 void clearScreen(void); 72 73 void useTextManager(Text *pTextMan); 73 74 void draw(void); 74 75 -
engines/sword1/animation.h
24 24 #define ANIMATION_H 25 25 26 26 #include "graphics/animation.h" 27 #include "graphics/dxa_player.h" 27 28 28 29 #include "sword1/screen.h" 29 30 #include "sword1/sound.h" … … 57 58 #define INTRO_LOGO_OVLS 12 58 59 #define INTRO_TEXT_OVLS 8 59 60 61 class MoviePlayer { 62 public: 63 MoviePlayer(Screen *scr, Audio::Mixer *snd, OSystem *sys); 64 virtual ~MoviePlayer(void); 65 virtual bool load(uint32 id); 66 void play(void); 67 void updatePalette(byte *pal, bool packed = true); 68 private: 69 bool checkSkipFrame(void); 70 protected: 71 Screen *_scr; 72 Audio::Mixer *_snd; 73 OSystem *_sys; 74 75 uint32 _id; 76 77 byte *_frameBuffer; 78 uint _currentFrame; 79 int _framesSkipped; 80 bool _forceFrame; 81 82 int _frameWidth, _frameHeight; 83 int _frameX, _frameY; 84 85 Audio::SoundHandle _bgSoundHandle; 86 Audio::AudioStream *_bgSoundStream; 87 uint32 _ticks; 88 89 virtual void handleScreenChanged(void); 90 virtual bool initOverlays(uint32 id); 91 virtual bool decodeFrame(void) = 0; 92 virtual void processFrame(void) = 0; 93 virtual void syncFrame(void); 94 virtual void updateScreen(void) = 0; 95 }; 96 97 #ifdef USE_ZLIB 98 99 class MoviePlayerDXA : public MoviePlayer, ::Graphics::DXAPlayer { 100 protected: 101 virtual void setPalette(byte *pal); 102 public: 103 MoviePlayerDXA(Screen *scr, Audio::Mixer *snd, OSystem *sys); 104 virtual ~MoviePlayerDXA(void); 105 bool load(uint32 id); 106 protected: 107 bool initOverlays(uint32 id); 108 bool decodeFrame(void); 109 void processFrame(void); 110 void updateScreen(void); 111 }; 112 113 #endif 114 115 #ifdef USE_MPEG2 116 60 117 class AnimationState : public Graphics::BaseAnimationState { 61 118 private: 119 MoviePlayer *_player; 62 120 Screen *_scr; 63 121 64 122 public: 65 AnimationState( Screen *scr, Audio::Mixer *snd, OSystem *sys);66 ~AnimationState( );123 AnimationState(MoviePlayer *player, Screen *scr, Audio::Mixer *snd, OSystem *sys); 124 ~AnimationState(void); 67 125 OverlayColor *giveRgbBuffer(void); 68 bool soundFinished();69 126 70 127 private: 71 128 void drawYUV(int width, int height, byte *const *dat); … … 78 135 virtual Audio::AudioStream *createAudioStream(const char *name, void *arg); 79 136 }; 80 137 81 class MoviePlayer {138 class MoviePlayerMPEG : public MoviePlayer { 82 139 public: 83 MoviePlayer (Screen *scr, Audio::Mixer *snd, OSystem *sys);84 ~MoviePlayer(void);85 void play(uint32 id);86 pr ivate:140 MoviePlayerMPEG(Screen *scr, Audio::Mixer *snd, OSystem *sys); 141 virtual ~MoviePlayerMPEG(void); 142 bool load(uint32 id); 143 protected: 87 144 void insertOverlay(OverlayColor *buf, uint8 *ovl, OverlayColor *pal); 88 void processFrame(uint32 animId, AnimationState *anim, uint32 frameNo); 145 AnimationState *_anim; 146 OverlayColor *_introPal; 147 uint8 *_logoOvls[INTRO_LOGO_OVLS]; 148 89 149 bool initOverlays(uint32 id); 90 Screen *_scr; 91 Audio::Mixer *_snd; 92 OSystem *_sys; 93 94 static const char *_sequenceList[20]; 95 uint8 *_logoOvls[INTRO_LOGO_OVLS]; 96 OverlayColor *_introPal; 150 bool decodeFrame(void); 151 void processFrame(void); 152 void syncFrame(void); 153 void updateScreen(void); 154 void handleScreenChanged(void); 97 155 }; 98 156 157 #endif 158 99 159 struct FileQueue { 100 160 Audio::AudioStream *stream; 101 161 FileQueue *next; … … 114 174 FileQueue *_queue; 115 175 }; 116 176 177 MoviePlayer *makeMoviePlayer(uint32 id, Screen *scr, Audio::Mixer *snd, OSystem *sys); 178 117 179 } // End of namespace Sword1 118 180 119 181 #endif -
engines/sword1/animation.cpp
28 28 #include "sound/vorbis.h" 29 29 30 30 #include "common/config-manager.h" 31 #include "common/endian.h" 31 32 #include "common/str.h" 32 33 #include "common/system.h" 33 34 34 35 namespace Sword1 { 35 36 36 AnimationState::AnimationState(Screen *scr, Audio::Mixer *snd, OSystem *sys) 37 : BaseAnimationState(snd, sys, 640, 400), _scr(scr) { 38 } 37 static const char *sequenceList[20] = { 38 "ferrari", // 0 CD2 ferrari running down fitz in sc19 39 "ladder", // 1 CD2 george walking down ladder to dig sc24->sc$ 40 "steps", // 2 CD2 george walking down steps sc23->sc24 41 "sewer", // 3 CD1 george entering sewer sc2->sc6 42 "intro", // 4 CD1 intro sequence ->sc1 43 "river", // 5 CD1 george being thrown into river by flap & g$ 44 "truck", // 6 CD2 truck arriving at bull's head sc45->sc53/4 45 "grave", // 7 BOTH george's grave in scotland, from sc73 + from sc38 $ 46 "montfcon", // 8 CD2 monfaucon clue in ireland dig, sc25 47 "tapestry", // 9 CD2 tapestry room beyond spain well, sc61 48 "ireland", // 10 CD2 ireland establishing shot europe_map->sc19 49 "finale", // 11 CD2 grand finale at very end, from sc73 50 "history", // 12 CD1 George's history lesson from Nico, in sc10 51 "spanish", // 13 CD2 establishing shot for 1st visit to Spain, europe_m$ 52 "well", // 14 CD2 first time being lowered down well in Spai$ 53 "candle", // 15 CD2 Candle burning down in Spain mausoleum sc59 54 "geodrop", // 16 CD2 from sc54, George jumping down onto truck 55 "vulture", // 17 CD2 from sc54, vultures circling George's dead body 56 "enddemo", // 18 --- for end of single CD demo 57 "credits", // 19 CD2 credits, to follow "finale" sequence 58 }; 39 59 40 AnimationState::~AnimationState() { 41 } 60 /////////////////////////////////////////////////////////////////////////////// 61 // Basic movie player 62 /////////////////////////////////////////////////////////////////////////////// 42 63 43 44 #ifdef BACKEND_8BIT 45 void AnimationState::setPalette(byte *pal) { 46 _sys->setPalette(pal, 0, 256); 64 MoviePlayer::MoviePlayer(Screen *scr, Audio::Mixer *snd, OSystem *sys) 65 : _scr(scr), _snd(snd), _sys(sys) { 66 _bgSoundStream = NULL; 67 _ticks = 0; 68 _frameBuffer = NULL; 69 _currentFrame = 0; 70 _forceFrame = false; 71 _framesSkipped = 0; 47 72 } 48 #endif49 73 50 void AnimationState::drawYUV(int width, int height, byte *const *dat) { 51 _frameWidth = width; 52 _frameHeight = height; 53 54 #ifdef BACKEND_8BIT 55 _scr->plotYUV(_lut, width, height, dat); 56 #else 57 plotYUV(width, height, dat); 58 #endif 74 MoviePlayer::~MoviePlayer(void) { 59 75 } 60 76 61 OverlayColor *AnimationState::giveRgbBuffer(void) { 62 #ifdef BACKEND_8BIT 63 return NULL; 64 #else 65 return _overlay; 66 #endif 77 void MoviePlayer::updatePalette(byte *pal, bool packed) { 78 byte palette[4 * 256]; 79 byte *p = palette; 80 for (int i = 0; i < 256; i++) { 81 *p++ = *pal++; 82 *p++ = *pal++; 83 *p++ = *pal++; 84 if (!packed) 85 *p++ = *pal++; 86 else 87 *p++ = 0; 88 } 89 _sys->setPalette(palette, 0, 256); 90 _forceFrame = true; 67 91 } 68 92 69 bool AnimationState::soundFinished(void) { 70 return !_snd->isSoundHandleActive(_bgSound); 93 void MoviePlayer::handleScreenChanged(void) { 71 94 } 72 95 73 Audio::AudioStream *AnimationState::createAudioStream(const char *name, void *arg) { 74 if (arg) 75 return (Audio::AudioStream*)arg; 76 else 77 return Audio::AudioStream::openStreamFile(name); 96 bool MoviePlayer::initOverlays(uint32 id) { 97 return true; 78 98 } 79 99 80 MoviePlayer::MoviePlayer(Screen *scr, Audio::Mixer *snd, OSystem *sys) 81 : _scr(scr), _snd(snd), _sys(sys) { 82 for (uint8 cnt = 0; cnt < INTRO_LOGO_OVLS; cnt++) 83 _logoOvls[cnt] = NULL; 84 _introPal = NULL; 100 bool MoviePlayer::checkSkipFrame(void) { 101 if (_forceFrame) { 102 _forceFrame = false; 103 return false; 104 } 105 if (_framesSkipped > 10) { 106 warning("Forced frame %d to be displayed", _currentFrame); 107 _framesSkipped = 0; 108 return false; 109 } 110 if (_bgSoundStream) { 111 if ((_snd->getSoundElapsedTime(_bgSoundHandle) * 12) / 1000 < _currentFrame + 1) 112 return false; 113 } else { 114 if (_sys->getMillis() <= _ticks) 115 return false; 116 } 117 _framesSkipped++; 118 return true; 85 119 } 86 120 87 MoviePlayer::~MoviePlayer(void) { 88 if (_introPal) 89 free(_introPal); 90 for (uint8 cnt = 0; cnt < INTRO_LOGO_OVLS; cnt++) 91 if (_logoOvls[cnt]) 92 free(_logoOvls[cnt]); 121 void MoviePlayer::syncFrame(void) { 122 _ticks += 83; 123 if (checkSkipFrame()) { 124 warning("Skipped frame %d", _currentFrame); 125 return; 126 } 127 if (_bgSoundStream) { 128 while (_snd->isSoundHandleActive(_bgSoundHandle) && (_snd->getSoundElapsedTime(_bgSoundHandle) * 12) / 1000 < _currentFrame) { 129 _sys->delayMillis(10); 130 } 131 132 // In case the background sound ends prematurely, update _ticks 133 // so that we can still fall back on the no-sound sync case for 134 // the subsequent frames. 135 136 _ticks = _sys->getMillis(); 137 } else { 138 while (_sys->getMillis() < _ticks) { 139 _sys->delayMillis(10); 140 } 141 } 93 142 } 94 143 95 144 /** 96 145 * Plays an animated cutscene. 97 146 * @param id the id of the file 98 147 */ 99 void MoviePlayer::play(uint32 id) { 100 #if defined(USE_MPEG2) && defined(USE_VORBIS) 101 AnimationState *anim = new AnimationState(_scr, _snd, _sys); 102 Audio::AudioStream *stream = NULL; 148 bool MoviePlayer::load(uint32 id) { 149 _id = id; 150 _bgSoundStream = NULL; 103 151 if (SwordEngine::_systemVars.cutscenePackVersion == 1) { 104 152 if ((id == SEQ_INTRO) || (id == SEQ_FINALE) || (id == SEQ_HISTORY) || (id == SEQ_FERRARI)) { 105 153 // these sequences are language specific 106 154 char sndName[20]; 107 sprintf(sndName, "%s.snd", _sequenceList[id]);155 sprintf(sndName, "%s.snd", sequenceList[id]); 108 156 Common::File *oggSource = new Common::File(); 109 157 if (oggSource->open(sndName)) { 110 158 SplittedAudioStream *sStream = new SplittedAudioStream(); … … 122 170 sStream->appendStream(apStream); 123 171 } 124 172 free(header); 125 stream = sStream;173 _bgSoundStream = sStream; 126 174 } else 127 175 warning("Sound file \"%s\" not found", sndName); 128 176 initOverlays(id); 129 177 oggSource->decRef(); 130 178 } 131 179 } 132 bool initOK = anim->init(_sequenceList[id], stream); 180 return true; 181 } 133 182 134 uint32 frameCount = 0; 135 if (initOK) {136 while (anim->decodeFrame()) {137 processFrame(id, anim, frameCount);138 anim->updateScreen();139 frameCount++;140 OSystem::Event event;141 while (_sys->pollEvent(event)) {142 switch (event.type) {143 case OSystem::EVENT_SCREEN_CHANGED:144 anim->handleScreenChanged();145 break;146 case OSystem::EVENT_KEYDOWN:147 if (event.kbd.keycode == 27) {148 delete anim;149 return;150 }151 break;152 case OSystem::EVENT_QUIT:153 _sys->quit();154 break;155 default:156 break;183 void MoviePlayer::play(void) { 184 _scr->clearScreen(); 185 _framesSkipped = 0; 186 _ticks = _sys->getMillis(); 187 if (_bgSoundStream) { 188 _snd->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSoundHandle, _bgSoundStream); 189 } 190 _currentFrame = 0; 191 while (decodeFrame()) { 192 processFrame(); 193 syncFrame(); 194 updateScreen(); 195 _currentFrame++; 196 OSystem::Event event; 197 while (_sys->pollEvent(event)) { 198 switch (event.type) { 199 case OSystem::EVENT_SCREEN_CHANGED: 200 handleScreenChanged(); 201 break; 202 case OSystem::EVENT_KEYDOWN: 203 if (event.kbd.keycode == 27) { 204 _snd->stopHandle(_bgSoundHandle); 205 return; 157 206 } 207 break; 208 case OSystem::EVENT_QUIT: 209 _sys->quit(); 210 break; 211 default: 212 break; 158 213 } 159 214 } 160 215 } 161 while ( !anim->soundFinished())216 while (_snd->isSoundHandleActive(_bgSoundHandle)) 162 217 _sys->delayMillis(100); 163 delete anim;164 #endif // USE_MPEG2 && USE_VORBIS165 }166 218 167 void MoviePlayer::insertOverlay(OverlayColor *buf, uint8 *ovl, OverlayColor *pal) { 168 if (ovl != NULL) 169 for (uint32 cnt = 0; cnt < 640 * 400; cnt++) 170 if (ovl[cnt]) 171 buf[cnt] = pal[ovl[cnt]]; 172 } 219 // It's tempting to call _screen->fullRefresh() here to restore the old 220 // palette. However, that causes glitches with DXA movies, here the 221 // previous location would be momentarily drawn, before switching to 222 // the new one. Work around this by setting the palette to black. 173 223 174 void MoviePlayer::processFrame(uint32 animId, AnimationState *anim, uint32 frameNo) { 175 #if defined(USE_MPEG2) && !defined(BACKEND_8BIT) 176 if ((animId != 4) || (SwordEngine::_systemVars.cutscenePackVersion == 0)) 177 return; 178 OverlayColor *buf = anim->giveRgbBuffer(); 179 if ((frameNo > 397) && (frameNo < 444)) { // Broken Sword Logo 180 if (frameNo <= 403) 181 insertOverlay(buf, _logoOvls[frameNo - 398], _introPal); // fade up 182 else if (frameNo <= 437) 183 insertOverlay(buf, _logoOvls[(frameNo - 404) % 6 + 6], _introPal); // animation 184 else { 185 insertOverlay(buf, _logoOvls[5 - (frameNo - 438)], _introPal); // fade down 186 } 187 } 188 #endif 224 byte pal[3 * 256]; 225 memset(pal, 0, sizeof(pal)); 226 updatePalette(pal, true); 189 227 } 190 228 191 bool MoviePlayer::initOverlays(uint32 id) {192 #if defined(USE_MPEG2) && !defined(BACKEND_8BIT)193 if (id == SEQ_INTRO) {194 ArcFile ovlFile;195 if (!ovlFile.open("intro.dat")) {196 warning("\"intro.dat\" not found");197 return false;198 }199 ovlFile.enterPath(SwordEngine::_systemVars.language);200 for (uint8 fcnt = 0; fcnt < 12; fcnt++) {201 _logoOvls[fcnt] = ovlFile.decompressFile(fcnt);202 if (fcnt > 0)203 for (uint32 cnt = 0; cnt < 640 * 400; cnt++)204 if (_logoOvls[fcnt - 1][cnt] && !_logoOvls[fcnt][cnt])205 _logoOvls[fcnt][cnt] = _logoOvls[fcnt - 1][cnt];206 }207 uint8 *pal = ovlFile.fetchFile(12);208 _introPal = (OverlayColor*)malloc(256 * sizeof(OverlayColor));209 for (uint16 cnt = 0; cnt < 256; cnt++)210 _introPal[cnt] = _sys->RGBToColor(pal[cnt * 3 + 0], pal[cnt * 3 + 1], pal[cnt * 3 + 2]);211 }212 #endif213 214 return true;215 }216 217 229 SplittedAudioStream::SplittedAudioStream(void) { 218 230 _queue = NULL; 219 231 } … … 275 287 return retVal; 276 288 } 277 289 278 const char * MoviePlayer::_sequenceList[20] = { 279 "ferrari", // 0 CD2 ferrari running down fitz in sc19 280 "ladder", // 1 CD2 george walking down ladder to dig sc24->sc$ 281 "steps", // 2 CD2 george walking down steps sc23->sc24 282 "sewer", // 3 CD1 george entering sewer sc2->sc6 283 "intro", // 4 CD1 intro sequence ->sc1 284 "river", // 5 CD1 george being thrown into river by flap & g$ 285 "truck", // 6 CD2 truck arriving at bull's head sc45->sc53/4 286 "grave", // 7 BOTH george's grave in scotland, from sc73 + from sc38 $ 287 "montfcon", // 8 CD2 monfaucon clue in ireland dig, sc25 288 "tapestry", // 9 CD2 tapestry room beyond spain well, sc61 289 "ireland", // 10 CD2 ireland establishing shot europe_map->sc19 290 "finale", // 11 CD2 grand finale at very end, from sc73 291 "history", // 12 CD1 George's history lesson from Nico, in sc10 292 "spanish", // 13 CD2 establishing shot for 1st visit to Spain, europe_m$ 293 "well", // 14 CD2 first time being lowered down well in Spai$ 294 "candle", // 15 CD2 Candle burning down in Spain mausoleum sc59 295 "geodrop", // 16 CD2 from sc54, George jumping down onto truck 296 "vulture", // 17 CD2 from sc54, vultures circling George's dead body 297 "enddemo", // 18 --- for end of single CD demo 298 "credits", // 19 CD2 credits, to follow "finale" sequence 299 }; 290 #ifdef USE_ZLIB 300 291 292 /////////////////////////////////////////////////////////////////////////////// 293 // Movie player for the new DXA movies 294 /////////////////////////////////////////////////////////////////////////////// 295 296 MoviePlayerDXA::MoviePlayerDXA(Screen *src, Audio::Mixer *snd, OSystem *sys) 297 : MoviePlayer(src, snd, sys) { 298 } 299 300 MoviePlayerDXA::~MoviePlayerDXA(void) { 301 // free(_frameBuffer); 302 } 303 304 bool MoviePlayerDXA::load(uint32 id) { 305 if (!MoviePlayer::load(id)) 306 return false; 307 308 char filename[20]; 309 snprintf(filename, sizeof(filename), "%s.dxa", sequenceList[id]); 310 if (loadFile(filename)) { 311 // The Broken Sword games always use external audio tracks. 312 if (_fd.readUint32BE() != MKID_BE('NULL')) 313 return false; 314 _frameWidth = getWidth(); 315 _frameHeight = getHeight(); 316 _frameX = (640 - _frameWidth) / 2; 317 _frameY = (480 - _frameHeight) / 2; 318 if (!_bgSoundStream) { 319 _bgSoundStream = Audio::AudioStream::openStreamFile(sequenceList[id]); 320 } 321 return true; 322 } 323 return false; 324 } 325 326 bool MoviePlayerDXA::initOverlays(uint32 id) { 327 // TODO 328 return true; 329 } 330 331 void MoviePlayerDXA::setPalette(byte *pal) { 332 updatePalette(pal, true); 333 } 334 335 bool MoviePlayerDXA::decodeFrame(void) { 336 if (_currentFrame < _framesCount) { 337 decodeNextFrame(); 338 return true; 339 } 340 return false; 341 } 342 343 void MoviePlayerDXA::processFrame(void) { 344 // TODO 345 } 346 347 void MoviePlayerDXA::updateScreen(void) { 348 // Using _frameBuffer1 directly should work, as long as we don't do any 349 // post-processing of the frame. 350 _sys->copyRectToScreen(_frameBuffer1, _frameWidth, _frameX, _frameY, _frameWidth, _frameHeight); 351 _sys->updateScreen(); 352 } 353 354 #endif 355 356 #ifdef USE_MPEG2 357 358 /////////////////////////////////////////////////////////////////////////////// 359 // Movie player for the old MPEG movies 360 /////////////////////////////////////////////////////////////////////////////// 361 362 MoviePlayerMPEG::MoviePlayerMPEG(Screen *src, Audio::Mixer *snd, OSystem *sys) 363 : MoviePlayer(src, snd, sys) { 364 for (uint8 cnt = 0; cnt < INTRO_LOGO_OVLS; cnt++) 365 _logoOvls[cnt] = NULL; 366 _introPal = NULL; 367 _anim = NULL; 368 } 369 370 MoviePlayerMPEG::~MoviePlayerMPEG(void) { 371 free(_introPal); 372 for (uint8 cnt = 0; cnt < INTRO_LOGO_OVLS; cnt++) 373 free(_logoOvls[cnt]); 374 delete _anim; 375 } 376 377 void MoviePlayerMPEG::handleScreenChanged(void) { 378 _anim->handleScreenChanged(); 379 } 380 381 void MoviePlayerMPEG::insertOverlay(OverlayColor *buf, uint8 *ovl, OverlayColor *pal) { 382 if (ovl != NULL) 383 for (uint32 cnt = 0; cnt < 640 * 400; cnt++) 384 if (ovl[cnt]) 385 buf[cnt] = pal[ovl[cnt]]; 386 } 387 388 bool MoviePlayerMPEG::load(uint32 id) { 389 if (MoviePlayer::load(id)) { 390 _anim = new AnimationState(this, _scr, _snd, _sys); 391 return _anim->init(sequenceList[id], _bgSoundStream); 392 } 393 return false; 394 } 395 396 bool MoviePlayerMPEG::initOverlays(uint32 id) { 397 if (id == SEQ_INTRO) { 398 ArcFile ovlFile; 399 if (!ovlFile.open("intro.dat")) { 400 warning("\"intro.dat\" not found"); 401 return false; 402 } 403 ovlFile.enterPath(SwordEngine::_systemVars.language); 404 for (uint8 fcnt = 0; fcnt < 12; fcnt++) { 405 _logoOvls[fcnt] = ovlFile.decompressFile(fcnt); 406 if (fcnt > 0) 407 for (uint32 cnt = 0; cnt < 640 * 400; cnt++) 408 if (_logoOvls[fcnt - 1][cnt] && !_logoOvls[fcnt][cnt]) 409 _logoOvls[fcnt][cnt] = _logoOvls[fcnt - 1][cnt]; 410 } 411 uint8 *pal = ovlFile.fetchFile(12); 412 _introPal = (OverlayColor*)malloc(256 * sizeof(OverlayColor)); 413 for (uint16 cnt = 0; cnt < 256; cnt++) 414 _introPal[cnt] = _sys->RGBToColor(pal[cnt * 3 + 0], pal[cnt * 3 + 1], pal[cnt * 3 + 2]); 415 } 416 417 return true; 418 } 419 420 bool MoviePlayerMPEG::decodeFrame(void) { 421 return _anim->decodeFrame(); 422 } 423 424 void MoviePlayerMPEG::updateScreen(void) { 425 _anim->updateScreen(); 426 } 427 428 void MoviePlayerMPEG::processFrame(void) { 429 #ifndef BACKEND_8BIT 430 if ((_id != 4) || (SwordEngine::_systemVars.cutscenePackVersion == 0)) 431 return; 432 OverlayColor *buf = _anim->giveRgbBuffer(); 433 if ((_currentFrame > 397) && (_currentFrame < 444)) { // Broken Sword Logo 434 if (_currentFrame <= 403) 435 insertOverlay(buf, _logoOvls[_currentFrame - 398], _introPal); // fade up 436 else if (_currentFrame <= 437) 437 insertOverlay(buf, _logoOvls[(_currentFrame - 404) % 6 + 6], _introPal); // animation 438 else { 439 insertOverlay(buf, _logoOvls[5 - (_currentFrame - 438)], _introPal); // fade down 440 } 441 } 442 #endif 443 } 444 445 void MoviePlayerMPEG::syncFrame(void) { 446 } 447 448 AnimationState::AnimationState(MoviePlayer *player, Screen *scr, Audio::Mixer *snd, OSystem *sys) 449 : BaseAnimationState(snd, sys, 640, 400), _player(player), _scr(scr) { 450 } 451 452 AnimationState::~AnimationState(void) { 453 } 454 455 #ifdef BACKEND_8BIT 456 void AnimationState::setPalette(byte *pal) { 457 _player->updatePalette(pal, false); 458 } 459 #endif 460 461 void AnimationState::drawYUV(int width, int height, byte *const *dat) { 462 _frameWidth = width; 463 _frameHeight = height; 464 465 #ifdef BACKEND_8BIT 466 _scr->plotYUV(_lut, width, height, dat); 467 #else 468 plotYUV(width, height, dat); 469 #endif 470 } 471 472 OverlayColor *AnimationState::giveRgbBuffer(void) { 473 #ifdef BACKEND_8BIT 474 return NULL; 475 #else 476 return _overlay; 477 #endif 478 } 479 480 Audio::AudioStream *AnimationState::createAudioStream(const char *name, void *arg) { 481 if (arg) 482 return (Audio::AudioStream*)arg; 483 else 484 return Audio::AudioStream::openStreamFile(name); 485 } 486 487 #endif 488 489 /////////////////////////////////////////////////////////////////////////////// 490 // Factory function for creating the appropriate cutscene player 491 /////////////////////////////////////////////////////////////////////////////// 492 493 MoviePlayer *makeMoviePlayer(uint32 id, Screen *scr, Audio::Mixer *snd, OSystem *sys) { 494 #if defined(USE_ZLIB) || defined(USE_MPEG2) 495 char filename[20]; 496 #endif 497 498 #ifdef USE_ZLIB 499 snprintf(filename, sizeof(filename), "%s.dxa", sequenceList[id]); 500 501 if (Common::File::exists(filename)) { 502 return new MoviePlayerDXA(scr, snd, sys); 503 } 504 #endif 505 506 #ifdef USE_MPEG2 507 snprintf(filename, sizeof(filename), "%s.mp2", sequenceList[id]); 508 509 if (Common::File::exists(filename)) { 510 return new MoviePlayerMPEG(scr, snd, sys); 511 } 512 #endif 513 514 return NULL; 515 } 516 301 517 } // End of namespace Sword1 -
engines/sword1/screen.cpp
64 64 quitScreen(); 65 65 } 66 66 67 void Screen::clearScreen(void) { 68 _fullRefresh = true; 69 memset(_screenBuf, 0, _scrnSizeX * _scrnSizeY); 70 _system->copyRectToScreen(_screenBuf, 640, 0, 0, 640, 480); 71 } 72 67 73 void Screen::useTextManager(Text *pTextMan) { 68 74 _textMan = pTextMan; 69 75 } -
engines/sword1/logic.cpp
951 951 CreditsPlayer player(_system, _mixer); 952 952 player.play(); 953 953 } else { 954 MoviePlayer player(_screen, _mixer, _system); 955 player.play(sequenceId); 954 MoviePlayer *player = makeMoviePlayer(sequenceId, _screen, _mixer, _system); 955 if (player) { 956 if (player->load(sequenceId)) 957 player->play(); 958 delete player; 959 } 956 960 } 957 961 return SCRIPT_CONT; 958 962 }