1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifdef ENABLE_EOB 24 25 #ifndef KYRA_SEQPLAYER_SEGACD_H 26 #define KYRA_SEQPLAYER_SEGACD_H 27 28 namespace Common { 29 class SeekableReadStream; 30 class SeekableReadStreamEndian; 31 } 32 33 namespace Kyra { 34 class EoBEngine; 35 class Screen_EoB; 36 class SegaRenderer; 37 class SegaCDResource; 38 class SegaSequencePlayer { 39 public: 40 SegaSequencePlayer(EoBEngine *vm, Screen_EoB *screen, SegaCDResource *res); 41 ~SegaSequencePlayer(); 42 43 bool play(int id); 44 void pause(bool pause); 45 46 private: 47 void run(const uint8 *data); 48 49 void animateWaterdeepScene(); 50 void updateSpeechAnimations(); 51 void updateSpeechAnimGraphics(int animDrawOp); 52 53 struct TileSet { 54 const uint16 *data; 55 uint16 width; 56 uint16 height; 57 }; 58 59 TileSet *_tileSets; 60 61 struct DrawObject { 62 uint16 agg; 63 const uint16 *tileData; 64 uint16 width; 65 uint16 height; 66 uint16 nTblVal; 67 uint16 x; 68 uint16 y; 69 uint16 addr; 70 }; 71 72 uint16 _waterdeepScene; 73 uint16 _playSpeechAnimation; 74 uint16 _speechAnimType; 75 uint16 _speechAnimDrawOps[14]; 76 uint32 _frameTimer; 77 uint32 _pauseStart; 78 bool _fastForward; 79 80 int _waterdeepSceneTimer, _speechAnimTimer; 81 uint16 _speechAnimNo, _speechAnimFrame; 82 int _playingID; 83 int _newTrack; 84 85 uint8 *_scaleSrcBuffer; 86 uint8 *_scaleOutBuffer; 87 uint16 *_scaleStampMap; 88 uint16 *_scaleTraceVectors; 89 90 uint32 _debugResyncCnt; 91 92 DrawObject *_drawObjects; 93 94 EoBEngine *_vm; 95 Screen_EoB *_screen; 96 SegaRenderer *_renderer; 97 SegaAnimator *_animator; 98 SegaCDResource *_res; 99 ScrollManager *_scrollManager; 100 101 private: 102 class SQOpcode : public Common::Functor1Mem<const uint8*, void, SegaSequencePlayer> { 103 public: 104 typedef Common::Functor1Mem<const uint8*, void, SegaSequencePlayer> SQFunc; SQOpcode(SegaSequencePlayer * sq,const SQFunc::FuncType & func,const char * dbgName)105 SQOpcode(SegaSequencePlayer *sq, const SQFunc::FuncType &func, const char *dbgName) : SQFunc(sq, func), _msg(Common::String::format(" %s()", dbgName)) {} ~SQOpcode()106 ~SQOpcode() override {} run(const uint8 * arg)107 void run(const uint8 *arg) { 108 assert(arg); 109 debugC(7, kDebugLevelSequence, "%s", _msg.c_str()); 110 if (SQFunc::isValid()) 111 SQFunc::operator()(arg); 112 } 113 private: 114 Common::String _msg; 115 }; 116 117 Common::Array<SQOpcode*> _opcodes; 118 119 void s_initDrawObject(const uint8 *pos); 120 void s_drawTileSet(const uint8 *pos); 121 void s_loadTileDataSingle(const uint8 *pos); 122 void s_drawTileSetCustom(const uint8 *pos); 123 void s_drawTileSetCustomTopToBottom(const uint8 *pos); 124 void s_fillRect(const uint8 *pos); s_void(const uint8 *)125 void s_void(const uint8*) {} 126 void s_initSprite(const uint8 *pos); 127 void s_removeSprite(const uint8 *pos); 128 void s_displayTextJp(const uint8 *pos); 129 void s_fadeToNeutral(const uint8 *pos); 130 void s_fadeToBlack(const uint8 *pos); 131 void s_fadeToNeutral2(const uint8 *pos); 132 void s_fadeToWhite(const uint8 *pos); 133 void s_setPalette(const uint8 *pos); 134 void s_vScroll(const uint8 *pos); 135 void s_hScroll(const uint8 *pos); 136 void s_paletteOps(const uint8 *pos); 137 void s_initSpriteCustomCoords(const uint8 *pos); 138 void s_fillRectWithPattern(const uint8 *pos); 139 void s_loadTileDataSeries(const uint8 *pos); 140 void s_drawTileSetSeries(const uint8 *pos); 141 void s_initSpriteSeries(const uint8 *pos); 142 void s_initSpriteCustom(const uint8 *pos); 143 void s_drawTileSetCustomCoords(const uint8 *pos); 144 void s_waitForPaletteFade(const uint8*); 145 void s_clearSprites(const uint8*); 146 void s_moveSprites2(const uint8 *pos); 147 void s_moveSprites(const uint8 *pos); 148 void s_moveMorphSprite(const uint8 *pos); 149 void s_unpauseCD(const uint8 *pos); 150 void s_toggleWaterDeepAnimations(const uint8 *pos); 151 void s_assignSpeechAnimGraphics(const uint8 *pos); 152 void s_toggleSpeechAnimation(const uint8 *pos); 153 void s_orbZoomEffect(const uint8*); 154 void s_stopCD(const uint8*); 155 void s_playCD(const uint8 *pos); 156 void s_displayTextEn(const uint8 *pos); 157 void s_loadCustomPalettes(const uint8 *pos); 158 void s_playSoundEffect(const uint8 *pos); 159 160 private: 161 const uint8 *_cdaTracks; 162 const uint8 *_wdAnimSprites; 163 const uint8 *_speechAnimData; 164 const uint16 *_wdDsX; 165 const uint8 *_wdDsY; 166 const uint16 *_patternTables[6]; 167 }; 168 169 } // End of namespace Kyra 170 171 #endif 172 #endif // ENABLE_EOB 173