22 #ifndef KYRA_KYRA_HOF_H 23 #define KYRA_KYRA_HOF_H 25 #include "kyra/engine/kyra_v2.h" 26 #include "kyra/script/script.h" 27 #include "kyra/script/script_tim.h" 28 #include "kyra/graphics/screen_hof.h" 29 #include "kyra/text/text_hof.h" 30 #include "kyra/gui/gui_hof.h" 32 #include "common/list.h" 33 #include "common/func.h" 39 class TextDisplayer_HoF;
54 Screen *screen()
override {
return _screen; }
55 Screen_v2 *screen_v2()
const override {
return _screen; }
56 GUI *gui()
const override {
return _gui; }
58 int language()
const {
return _lang; }
64 void seq_showStarcraftLogo();
70 void seq_pausePlayer(
bool toggle);
79 static const int8 _dosTrackMap[];
80 static const int _dosTrackMapSize;
81 static const int8 _mt32SfxMap[];
82 static const int _mt32SfxMapSize;
83 static const int8 _gmSfxMap[];
84 static const int _gmSfxMapSize;
85 static const int8 _pcSpkSfxMap[];
86 static const int _pcSpkSfxMapSize;
94 void registerDefaultSettings()
override;
95 void writeSettings()
override;
96 void readSettings()
override;
97 uint8 _configTextspeed;
101 void initStaticResource();
103 void setupTimers()
override;
104 void setupOpcodeTable()
override;
106 void loadMouseShapes();
107 void loadItemShapes();
110 void update()
override;
111 void updateWithText()
override;
119 void handleInput(
int x,
int y);
120 bool handleInputUnkSub(
int x,
int y);
122 int inputSceneChange(
int x,
int y,
int unk1,
int unk2)
override;
125 void processKeyboardSfx(
int inputFlag);
127 static const int16 _keyboardSounds[190];
130 bool _inventorySaved;
134 uint8 *_gfxBackUpRect;
136 void backUpGfxRect24x24(
int x,
int y);
137 void restoreGfxRect24x24(
int x,
int y);
138 void backUpGfxRect32x32(
int x,
int y);
139 void restoreGfxRect32x32(
int x,
int y);
141 uint8 *_sceneShapeTable[50];
145 void freeSceneShapePtrs();
148 uint8 unk0, unk1, unk2, unk3, unk4;
149 uint16 width, height;
155 void loadCharacterShapes(
int shapes)
override;
156 void loadInventoryShapes();
158 void resetScaleTable();
159 void setScaleTableItem(
int item,
int data);
160 int getScale(
int x,
int y)
override;
161 uint16 _scaleTable[15];
163 void setDrawLayerTableEntry(
int entry,
int data);
164 int getDrawLayer(
int x,
int y);
165 int _drawLayerTable[15];
167 int _layerFlagTable[16];
169 int initAnimationShapes(uint8 *filedata)
override;
170 void uninitAnimationShapes(
int count, uint8 *filedata)
override;
173 uint8 *_gamePlayBuffer;
174 void restorePage3()
override;
176 void clearAnimObjects()
override;
178 void refreshAnimObjects(
int force)
override;
180 void drawAnimObjects()
override;
181 void drawSceneAnimObject(
AnimObj *obj,
int x,
int y,
int drawLayer)
override;
182 void drawCharacterAnimObject(
AnimObj *obj,
int x,
int y,
int drawLayer)
override;
184 void updateItemAnimations();
186 void updateCharFacing();
187 void updateCharacterAnim(
int)
override;
188 void updateSceneAnim(
int anim,
int newFrame)
override;
190 int _animObj0Width, _animObj0Height;
191 void setCharacterAnimDim(
int w,
int h)
override;
192 void resetCharacterAnimDim()
override;
195 const char *_sceneCommentString;
196 uint8 _scenePal[688];
198 void enterNewScene(uint16 newScene,
int facing,
int unk1,
int unk2,
int unk3)
override;
199 void enterNewSceneUnk1(
int facing,
int unk1,
int unk2);
200 void enterNewSceneUnk2(
int unk1);
206 void fadeScenePal(
int srcIndex,
int delay);
208 void startSceneScript(
int unk1);
209 void runSceneScript2();
210 void runSceneScript4(
int unk1);
211 void runSceneScript7();
213 void initSceneAnims(
int unk1);
214 void initSceneScreen(
int unk1);
216 int trySceneChange(
int *moveTable,
int unk1,
int updateChar)
override;
217 int checkSceneChange();
220 bool lineIsPassable(
int x,
int y)
override;
223 void setMouseCursor(Item item)
override;
225 uint8 _itemHtDat[176];
227 int checkItemCollision(
int x,
int y);
228 void updateWaterFlasks();
230 bool dropItem(
int unk1, Item item,
int x,
int y,
int unk2);
231 bool processItemDrop(uint16 sceneId, Item item,
int x,
int y,
int unk1,
int unk2);
232 void itemDropDown(
int startX,
int startY,
int dstX,
int dstY,
int itemSlot, Item item);
233 void exchangeMouseItem(
int itemPos);
234 bool pickUpItem(
int x,
int y);
236 bool isDropable(
int x,
int y);
238 static const byte _itemStringMap[];
239 static const int _itemStringMapSize;
241 static const Item _flaskTable[];
242 bool itemIsFlask(Item item);
245 static const int _inventoryX[];
246 static const int _inventoryY[];
247 static const uint16 _itemMagicTable[];
249 int getInventoryItemSlot(Item item);
250 void removeSlotFromInventory(
int slot);
251 bool checkInventoryItemExchange(Item item,
int slot);
252 void drawInventoryShape(
int page, Item item,
int slot);
253 void clearInventorySlot(
int slot,
int page);
254 void redrawInventory(
int page);
255 void scrollInventoryWheel();
256 int findFreeVisibleInventorySlot();
262 bool _menuDirectlyToLoad;
265 void loadButtonShapes();
266 void setupLangButtonShapes();
267 uint8 *_buttonShapes[19];
269 void initInventoryButtonList();
270 Button *_inventoryButtons;
273 int scrollInventory(
Button *button);
274 int buttonInventory(
Button *button);
275 int bookButton(
Button *button);
276 int cauldronButton(
Button *button);
277 int cauldronClearButton(
Button *button);
280 static const int _bookPageYOffset[];
281 static const byte _bookTextColorMap[];
293 void bookDecodeText(uint8 *text);
294 void bookPrintText(
int dstPage,
const uint8 *text,
int x,
int y, uint8 color);
296 int bookPrevPage(
Button *button);
297 int bookNextPage(
Button *button);
298 int bookClose(
Button *button);
301 uint8 _cauldronState;
302 int16 _cauldronUseCount;
303 int16 _cauldronTable[25];
304 int16 _cauldronStateTables[23][7];
306 static const int16 _cauldronProtectedItems[];
307 static const int16 _cauldronBowlTable[];
308 static const int16 _cauldronMagicTable[];
309 static const int16 _cauldronMagicTableScene77[];
310 static const uint8 _cauldronStateTable[];
312 void resetCauldronStateTable(
int idx);
313 bool addToCauldronStateTable(
int data,
int idx);
315 void setCauldronState(uint8 state,
bool paletteFade);
316 void clearCauldronTable();
317 void addFrontCauldronTable(
int item);
318 void cauldronItemAnim(
int item);
319 void cauldronRndPaletteFade();
320 bool updateCauldron();
321 void listItemsInCauldron();
324 void loadCCodeBuffer(
const char *file);
325 void loadOptionsBuffer(
const char *file);
326 void loadChapterBuffer(
int chapter);
327 uint8 *_optionsBuffer;
330 uint8 *_chapterBuffer;
334 uint8 *getTableEntry(uint8 *buffer,
int id);
335 Common::String getTableString(
int id, uint8 *buffer,
bool decode);
341 int getItemCommandStringDrop(Item item);
342 int getItemCommandStringPickUp(Item item);
343 int getItemCommandStringInv(Item item);
346 char _internStringBuf[200];
347 static const char *
const _languageExtension[];
348 static const char *
const _scriptLangExt[];
352 bool _setCharPalFinal;
354 uint8 _charPalTable[16];
355 void updateCharPal(
int unk1);
356 void setCharPalEntry(
int entry,
int value);
358 int _characterFacingCountTable[2];
360 int getCharacterWalkspeed()
const override;
361 void updateCharAnimFrame(
int *table)
override;
363 bool checkCharCollision(
int x,
int y);
365 static const uint8 _characterFrameTable[];
368 void showMessageFromCCode(
int id, int16 palIndex,
int);
371 void showChapterMessage(
int id, int16 palIndex);
373 void updateCommandLineEx(
int str1,
int str2, int16 palIndex);
378 bool _fadeMessagePalette;
379 void fadeMessagePalette();
381 Screen::FontId _defaultFont;
382 Screen::FontId _bookFont;
388 int chatGetType(
const char *text);
391 void objectChat(
const Common::String &text,
int object,
int vocHigh = -1,
int vocLow = -1);
392 void objectChatInit(
const Common::String &text,
int object,
int vocHigh = -1,
int vocLow = -1);
394 void objectChatProcess(
const char *script);
395 void objectChatWaitToFinish();
397 void startDialogue(
int dlgIndex);
399 void zanthSceneStartupChat();
400 void randomSceneChat()
override;
401 void updateDlgBuffer();
402 void loadDlgHeader(
int &csEntry,
int &vocH,
int &scIndex1,
int &scIndex2);
403 void processDialogue(
int dlgOffset,
int vocH = 0,
int csEntry = 0);
404 void npcChatSequence(
const Common::String &str,
int objectId,
int vocHigh = -1,
int vocLow = -1);
405 void setDlgIndex(
int dlgIndex)
override;
407 int _npcTalkChpIndex;
408 int _npcTalkDlgIndex;
409 uint8 _newSceneDlgState[32];
410 int8 **_conversationState;
414 void initTalkObject(
int index);
415 void deinitTalkObject(
int index);
435 void playTim(
const char *filename);
437 int t2_initChat(
const TIM *tim,
const uint16 *param);
438 int t2_updateSceneAnim(
const TIM *tim,
const uint16 *param);
439 int t2_resetChat(
const TIM *tim,
const uint16 *param);
440 int t2_playSoundEffect(
const TIM *tim,
const uint16 *param);
446 int _currentTalkFile;
447 void openTalkFile(
int newFile);
450 void snd_playVoiceFile(
int id)
override;
451 void snd_loadSoundFile(
int id);
453 void playVoice(
int high,
int low);
454 void snd_playSoundEffect(
int track,
int volume=0xFF)
override;
457 void timerFadeOutMessage(
int);
458 void timerCauldronAnimation(
int);
459 void timerFunc4(
int);
460 void timerFunc5(
int);
461 void timerBurnZanthia(
int);
463 void setTimer1DelaySecs(
int secs);
465 uint32 _nextIdleAnim;
467 bool _useSceneIdleAnim;
469 void setNextIdleAnimTimer();
471 void runIdleScript(
int script);
473 void setWalkspeed(uint8 speed)
override;
476 void seq_makeBookOrCauldronAppear(
int type);
477 void seq_makeBookAppear();
480 int x, y, x2, y2, w, h;
482 int curFrame, lastFrame, specialFrame;
491 void loadInvWsa(
const char *filename,
int run,
int delay,
int page,
int sfx,
int sFrame,
int flags);
495 void displayInvWsaLastFrame();
498 int o2_setCharacterFacingRefresh(
EMCState *script);
499 int o2_setCharacterPos(
EMCState *script);
500 int o2_defineObject(
EMCState *script);
501 int o2_refreshCharacter(
EMCState *script);
502 int o2_setSceneComment(
EMCState *script);
503 int o2_setCharacterAnimFrame(
EMCState *script);
504 int o2_setCharacterFacing(
EMCState *script);
505 int o2_customCharacterChat(
EMCState *script);
506 int o2_soundFadeOut(
EMCState *script);
507 int o2_showChapterMessage(
EMCState *script);
508 int o2_restoreTalkTextMessageBkgd(
EMCState *script);
510 int o2_meanWhileScene(
EMCState *script);
511 int o2_backUpScreen(
EMCState *script);
512 int o2_restoreScreen(
EMCState *script);
513 int o2_displayWsaFrame(
EMCState *script);
514 int o2_displayWsaSequentialFramesLooping(
EMCState *script);
516 int o2_displayWsaSequentialFrames(
EMCState *script);
517 int o2_displayWsaSequence(
EMCState *script);
518 int o2_addItemToInventory(
EMCState *script);
520 int o2_addItemToCurScene(
EMCState *script);
521 int o2_loadSoundFile(
EMCState *script);
522 int o2_removeSlotFromInventory(
EMCState *script);
523 int o2_removeItemFromInventory(
EMCState *script);
524 int o2_countItemInInventory(
EMCState *script);
525 int o2_countItemsInScene(
EMCState *script);
526 int o2_wipeDownMouseItem(
EMCState *script);
527 int o2_getElapsedSecs(
EMCState *script);
528 int o2_getTimerDelay(
EMCState *script);
529 int o2_playCompleteSoundEffect(
EMCState *script);
531 int o2_setTimerDelay(
EMCState *script);
532 int o2_setScaleTableItem(
EMCState *script);
533 int o2_setDrawLayerTableItem(
EMCState *script);
534 int o2_setCharPalEntry(
EMCState *script);
535 int o2_loadZShapes(
EMCState *script);
536 int o2_drawSceneShape(
EMCState *script);
537 int o2_drawSceneShapeOnPage(
EMCState *script);
538 int o2_disableAnimObject(
EMCState *script);
539 int o2_enableAnimObject(
EMCState *script);
540 int o2_loadPalette384(
EMCState *script);
541 int o2_setPalette384(
EMCState *script);
542 int o2_restoreBackBuffer(
EMCState *script);
543 int o2_backUpInventoryGfx(
EMCState *script);
544 int o2_disableSceneAnim(
EMCState *script);
545 int o2_enableSceneAnim(
EMCState *script);
546 int o2_restoreInventoryGfx(
EMCState *script);
547 int o2_setSceneAnimPos2(
EMCState *script);
548 int o2_fadeScenePal(
EMCState *script);
549 int o2_enterNewScene(
EMCState *script);
550 int o2_switchScene(
EMCState *script);
551 int o2_setPathfinderFlag(
EMCState *script);
552 int o2_getSceneExitToFacing(
EMCState *script);
553 int o2_setLayerFlag(
EMCState *script);
554 int o2_setZanthiaPos(
EMCState *script);
555 int o2_loadMusicTrack(
EMCState *script);
556 int o2_setSceneAnimPos(
EMCState *script);
557 int o2_setCauldronState(
EMCState *script);
558 int o2_showItemString(
EMCState *script);
559 int o2_isAnySoundPlaying(
EMCState *script);
560 int o2_setDrawNoShapeFlag(
EMCState *script);
561 int o2_setRunFlag(
EMCState *script);
562 int o2_showLetter(
EMCState *script);
563 int o2_playFireflyScore(
EMCState *script);
564 int o2_encodeShape(
EMCState *script);
565 int o2_defineSceneAnim(
EMCState *script);
566 int o2_updateSceneAnim(
EMCState *script);
567 int o2_addToSceneAnimPosAndUpdate(
EMCState *script);
568 int o2_useItemOnMainChar(
EMCState *script);
569 int o2_startDialogue(
EMCState *script);
570 int o2_addCauldronStateTableEntry(
EMCState *script);
571 int o2_setCountDown(
EMCState *script);
572 int o2_getCountDown(
EMCState *script);
573 int o2_pressColorKey(
EMCState *script);
574 int o2_objectChat(
EMCState *script);
575 int o2_changeChapter(
EMCState *script);
576 int o2_getColorCodeFlag1(
EMCState *script);
577 int o2_setColorCodeFlag1(
EMCState *script);
578 int o2_getColorCodeFlag2(
EMCState *script);
579 int o2_setColorCodeFlag2(
EMCState *script);
580 int o2_getColorCodeValue(
EMCState *script);
581 int o2_setColorCodeValue(
EMCState *script);
582 int o2_countItemInstances(
EMCState *script);
583 int o2_removeItemFromScene(
EMCState *script);
584 int o2_initObject(
EMCState *script);
586 int o2_deinitObject(
EMCState *script);
587 int o2_playTimSequence(
EMCState *script);
588 int o2_makeBookOrCauldronAppear(
EMCState *script);
589 int o2_resetInputColorCode(
EMCState *script);
590 int o2_mushroomEffect(
EMCState *script);
591 int o2_customChat(
EMCState *script);
592 int o2_customChatFinish(
EMCState *script);
593 int o2_setupSceneAnimation(
EMCState *script);
594 int o2_stopSceneAnimation(
EMCState *script);
595 int o2_processPaletteIndex(
EMCState *script);
596 int o2_updateTwoSceneAnims(
EMCState *script);
597 int o2_getRainbowRoomData(
EMCState *script);
598 int o2_drawSceneShapeEx(
EMCState *script);
599 int o2_midiSoundFadeout(
EMCState *script);
600 int o2_getSfxDriver(
EMCState *script);
601 int o2_getVocSupport(
EMCState *script);
602 int o2_getMusicDriver(
EMCState *script);
603 int o2_zanthiaChat(
EMCState *script);
604 int o2_isVoiceEnabled(
EMCState *script);
605 int o2_isVoicePlaying(
EMCState *script);
606 int o2_stopVoicePlaying(
EMCState *script);
607 int o2_getGameLanguage(
EMCState *script);
608 int o2_demoFinale(
EMCState *script);
612 int o2a_setCharacterFrame(
EMCState *script);
615 void runStartScript(
int script,
int unk1);
616 void loadNPCScript();
630 const char *
const *_ingamePakList;
631 int _ingamePakListSize;
633 const char *
const *_musicFileListIntro;
634 int _musicFileListIntroSize;
635 const char *
const *_musicFileListFinale;
636 int _musicFileListFinaleSize;
637 const char *
const *_musicFileListIngame;
638 int _musicFileListIngameSize;
639 const uint8 *_cdaTrackTableIntro;
640 int _cdaTrackTableIntroSize;
641 const uint8 *_cdaTrackTableIngame;
642 int _cdaTrackTableIngameSize;
643 const uint8 *_cdaTrackTableFinale;
644 int _cdaTrackTableFinaleSize;
645 const char *
const *_ingameSoundList;
646 int _ingameSoundListSize;
647 const int16 *_ingameSoundIndex;
648 int _ingameSoundIndexSize;
649 const uint16 *_ingameTalkObjIndex;
650 int _ingameTalkObjIndexSize;
651 const char *
const *_ingameTimJpStr;
652 int _ingameTimJpStrSize;
655 int _itemAnimDefinitionSize;
687 static const uint8 _rainbowRoomData[];
692 uint8 _presetColorCode[7];
693 uint8 _inputColorCode[7];
694 uint32 _scriptCountDown;
Definition: kyra_hof.h:425
Definition: kyra_hof.h:147
Definition: screen_hof.h:31
Definition: kyra_hof.h:479
Definition: kyra_hof.h:44
Definition: script_tim.h:156
Common::Error run() override
Definition: kyra_v1.h:199
Definition: detection.h:38
Definition: kyra_v2.h:102
Definition: detection.h:27
Common::Error loadGameState(int slot) override
Definition: script_tim.h:108
Definition: kyra_hof.h:417
Definition: screen_v2.h:30
Definition: wsamovie.h:112
Definition: text_hof.h:32
Definition: debugger.h:85
void pauseEngineIntern(bool pause) override