22 #ifndef KYRA_KYRA_MR_H 23 #define KYRA_KYRA_MR_H 25 #include "kyra/engine/kyra_v2.h" 26 #include "kyra/graphics/screen_mr.h" 27 #include "kyra/script/script.h" 28 #include "kyra/gui/gui_mr.h" 30 #include "common/hashmap.h" 31 #include "common/list.h" 35 class SoundDigital_MR;
39 class TextDisplayer_MR;
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; }
59 bool heliumMode()
const {
return _configHelium; }
63 void playVQA(
const char *name);
72 int _configVQAQuality;
74 void registerDefaultSettings()
override;
75 void writeSettings()
override;
76 void readSettings()
override;
78 void initStaticResource();
88 void runStartupScript(
int script,
int unk1);
90 void setupOpcodeTable()
override;
93 bool skipFlag()
const override;
94 void resetSkipFlag(
bool removeEvent =
true)
override;
97 bool _menuDirectlyToLoad;
100 void handleInput(
int x,
int y);
101 int inputSceneChange(
int x,
int y,
int unk1,
int unk2)
override;
103 void update()
override;
104 void updateWithText()
override;
109 void playMenuAudioFile();
111 int _musicSoundChannel;
112 int _fadeOutMusicChannel;
113 const char *_menuAudioFile;
115 const char *
const *_soundList;
118 void snd_playWanderScoreViaMap(
int track,
int force)
override;
119 void stopMusicTrack();
121 void fadeOutMusic(
int ticks);
123 void snd_playSoundEffect(
int item,
int volume)
override;
125 const uint8 *_sfxFileMap;
127 const char *
const *_sfxFileList;
128 int _sfxFileListSize;
130 int _voiceSoundChannel;
132 void playVoice(
int high,
int low);
133 void snd_playVoiceFile(
int file)
override;
134 bool snd_voiceIsPlaying()
override;
135 void snd_stopVoice()
override;
138 void playStudioSFX(
const char *str);
145 bool _mainButtonListInitialized;
146 void initMainButtonList(
bool disable);
148 bool _enableInventory;
149 int buttonInventory(
Button *button);
150 int buttonMoodChange(
Button *button);
151 int buttonShowScore(
Button *button);
152 int buttonJesterStaff(
Button *button);
154 void loadButtonShapes();
155 int callbackButton1(
Button *button);
156 int callbackButton2(
Button *button);
157 int callbackButton3(
Button *button);
161 void uninitMainMenu();
167 void setupTimers()
override;
169 void setWalkspeed(uint8)
override;
170 void setCommandLineRestoreTimer(
int secs);
172 void timerRestoreCommandLine(
int arg);
173 void timerRunSceneScript7(
int arg);
174 void timerFleaDeath(
int arg);
176 uint32 _nextIdleAnim;
177 void setNextIdleAnimTimer();
180 bool lineIsPassable(
int x,
int y)
override;
184 const char *
const *_mainMenuStrings;
185 int _mainMenuStringsSize;
188 uint8 *_gamePlayBuffer;
189 void restorePage3()
override;
191 void clearAnimObjects()
override;
193 void animSetupPaletteEntry(
AnimObj *anim)
override;
195 void drawAnimObjects()
override;
196 void drawSceneAnimObject(
AnimObj *obj,
int x,
int y,
int drawLayer)
override;
197 void drawCharacterAnimObject(
AnimObj *obj,
int x,
int y,
int drawLayer)
override;
199 void refreshAnimObjects(
int force)
override;
202 void updateItemAnimations();
203 void updateCharacterAnim(
int charId)
override;
205 void updateSceneAnim(
int anim,
int newFrame)
override;
206 void setupSceneAnimObject(
int anim, uint16 flags,
int x,
int y,
int x2,
int y2,
int w,
int h,
int unk10,
int specialSize,
int unk14,
int shape,
const char *filename);
207 void removeSceneAnimObject(
int anim,
int refresh);
209 int _charBackUpWidth2, _charBackUpHeight2;
210 int _charBackUpWidth, _charBackUpHeight;
212 void setCharacterAnimDim(
int w,
int h)
override;
213 void resetCharacterAnimDim()
override;
224 uint32 _interfaceSize;
226 uint8 *_interfaceCommandLine;
227 uint32 _interfaceCommandLineSize;
228 uint16 _interfaceCommandLineY1;
229 uint16 _interfaceCommandLineY2;
230 uint16 _interfaceCommandLineH;
232 void loadInterfaceShapes();
233 void loadInterface();
235 void showMessage(
const char *
string, uint8 c0, uint8 c1);
236 void showMessageFromCCode(
int string, uint8 c0,
int);
237 void updateItemCommand(Item item,
int str, uint8 c0);
239 void updateCommandLine();
240 void restoreCommandLine();
241 void updateCLState();
244 const char *_shownMessage;
245 bool _restoreCommandLine;
246 bool _inventoryState;
247 int _inventoryScrollSpeed;
249 void showInventory();
250 void hideInventory();
252 void drawMalcolmsMoodText();
253 void drawMalcolmsMoodPointer(
int frame,
int page);
254 void drawJestersStaff(
int type,
int page);
256 void drawScore(
int page,
int x,
int y);
257 void drawScoreCounting(
int oldScore,
int newScore,
int drawOld,
const int x);
258 int getScoreX(
const char *str);
260 static const uint8 _inventoryX[];
261 static const uint8 _inventoryY[];
262 void redrawInventory(
int page);
263 void clearInventorySlot(
int slot,
int page);
264 void drawInventorySlot(
int page, Item item,
int slot);
276 uint32 _actorFileSize;
277 uint8 *_sceneStrings;
279 uint8 *getTableEntry(uint8 *buffer,
int id);
286 static const Item _trashItemList[];
287 void removeTrashItems();
291 int checkItemCollision(
int x,
int y);
293 bool dropItem(
int unk1, Item item,
int x,
int y,
int unk2);
294 bool processItemDrop(uint16 sceneId, Item item,
int x,
int y,
int unk1,
int unk2);
295 void itemDropDown(
int startX,
int startY,
int dstX,
int dstY,
int itemSlot, Item item,
int remove);
296 void exchangeMouseItem(
int itemPos,
int runScript);
297 bool pickUpItem(
int x,
int y,
int runScript);
299 bool isDropable(
int x,
int y);
301 const uint8 *_itemMagicTable;
302 bool itemListMagic(Item handItem,
int itemSlot);
303 bool itemInventoryMagic(Item handItem,
int invSlot);
305 const uint8 *_itemStringMap;
306 int _itemStringMapSize;
307 static const uint8 _itemStringPickUp[];
308 static const uint8 _itemStringDrop[];
309 static const uint8 _itemStringInv[];
311 int getItemCommandStringPickUp(uint16 item);
312 int getItemCommandStringDrop(uint16 item);
313 int getItemCommandStringInv(uint16 item);
316 void setItemMouseCursor();
317 void setMouseCursor(Item item)
override;
320 void initMouseShapes();
322 void loadCharacterShapes(
int newShapes)
override;
323 void updateMalcolmShapes();
325 int _malcolmShapeXOffset, _malcolmShapeYOffset;
329 int8 xOffset, yOffset;
331 static const ShapeDesc _shapeDescs[];
332 static const int _shapeDescsSize;
335 uint8 *_sceneShapes[20];
337 void freeSceneShapes();
340 int _currentTalkFile;
341 void openTalkFile(
int file);
345 void enterNewScene(uint16 scene,
int facing,
int unk1,
int unk2,
int unk3)
override;
346 void enterNewSceneUnk1(
int facing,
int unk1,
int unk2);
347 void enterNewSceneUnk2(
int unk1);
348 int _enterNewSceneLock;
354 void initSceneScript(
int unk1);
355 void initSceneAnims(
int unk1);
356 void initSceneScreen(
int unk1);
358 int runSceneScript1(
int x,
int y);
359 int runSceneScript2();
361 void runSceneScript4(
int unk1);
362 void runSceneScript8();
364 int _sceneMinX, _sceneMaxX;
365 int _maskPageMinY, _maskPageMaxY;
367 int trySceneChange(
int *moveTable,
int unk1,
int unk2)
override;
368 int checkSceneChange();
370 int8 _sceneDatPalette[45];
371 int8 _sceneDatLayerTable[15];
372 struct SceneShapeDesc {
379 SceneShapeDesc _sceneShapeDescs[20];
381 int getDrawLayer(
int x,
int y);
383 int getScale(
int x,
int y)
override;
387 int getCharacterWalkspeed()
const override;
388 void updateCharAnimFrame(
int *table)
override;
389 int8 _characterAnimTable[2];
390 static const uint8 _characterFrameTable[];
392 void updateCharPal(
int unk1);
393 int _lastCharPalLayer;
396 bool checkCharCollision(
int x,
int y);
400 void makeCharFacingMouse();
402 int findFreeInventorySlot();
414 TalkObject *_talkObjectList;
416 bool talkObjectsInCurScene();
419 int chatGetType(
const char *text);
420 int chatCalcDuration(
const char *text);
422 void objectChat(
const char *text,
int object,
int vocHigh,
int vocLow);
423 void objectChatInit(
const char *text,
int object,
int vocHigh,
int vocLow);
425 void objectChatProcess(
const char *script);
426 void objectChatWaitToFinish();
428 void badConscienceChat(
const char *str,
int vocHigh,
int vocLow);
429 void badConscienceChatWaitToFinish();
431 void goodConscienceChat(
const char *str,
int vocHigh,
int vocLow);
432 void goodConscienceChatWaitToFinish();
434 bool _albumChatActive;
435 void albumChat(
const char *str,
int vocHigh,
int vocLow);
436 void albumChatInit(
const char *str,
int object,
int vocHigh,
int vocLow);
437 void albumChatWaitToFinish();
439 void malcolmSceneStartupChat();
441 byte _newSceneDlgState[40];
442 int8 _conversationState[30][30];
444 void setDlgIndex(
int index)
override;
445 void updateDlgIndex();
449 int _curDlgChapter, _curDlgIndex, _curDlgLang;
450 void updateDlgBuffer();
451 void loadDlgHeader(
int &vocHighBase,
int &vocHighIndex,
int &index1,
int &index2);
453 static const uint8 _vocHighTable[];
454 bool _isStartupDialog;
455 void processDialog(
int vocHighIndex,
int vocHighBase,
int funcNum);
459 int _dialogSceneAnim;
460 int _dialogSceneScript;
461 int _dialogScriptFuncStart, _dialogScriptFuncProc, _dialogScriptFuncEnd;
463 void dialogStartScript(
int object,
int funcNum);
464 void dialogEndScript(
int object);
466 void npcChatSequence(
const char *str,
int object,
int vocHigh,
int vocLow);
470 int o3d_updateAnim(
EMCState *script);
473 void randomSceneChat()
override;
474 void doDialog(
int dlgIndex,
int funcNum);
477 bool _badConscienceShown;
478 int _badConscienceAnim;
479 bool _badConsciencePosition;
481 static const uint8 _badConscienceFrameTable[];
483 void showBadConscience();
484 void hideBadConscience();
486 bool _goodConscienceShown;
487 int _goodConscienceAnim;
488 bool _goodConsciencePosition;
490 static const uint8 _goodConscienceFrameTable[];
492 void showGoodConscience();
493 void hideGoodConscience();
498 int o3a_setCharacterFrame(
EMCState *script);
499 int o3a_playSoundEffect(
EMCState *script);
502 int initAnimationShapes(uint8 *filedata)
override;
503 void uninitAnimationShapes(
int count, uint8 *filedata)
override;
506 uint8 *_costPalBuffer;
507 uint8 *_paletteOverlay;
508 bool _useActorBuffer;
511 void changeChapter(
int newChapter,
int sceneId,
int malcolmShapes,
int facing);
513 static const uint8 _chapterLowestScene[];
516 void loadShadowShape();
517 void loadExtrasShapes();
519 uint8 *_gfxBackUpRect;
520 void backUpGfxRect32x32(
int x,
int y);
521 void restoreGfxRect32x32(
int x,
int y);
528 const uint8 *_scoreTable;
531 int8 _scoreFlagTable[26];
532 bool updateScore(
int scoreId,
int strId);
533 void scoreIncrease(
int count,
const char *str);
553 int curPage, nextPage;
558 static const int8 _albumWSAX[];
559 static const int8 _albumWSAY[];
563 void loadAlbumPage();
564 void loadAlbumPageWSA();
566 void printAlbumPageText();
567 void printAlbumText(
int page,
const char *str,
int x,
int y, uint8 c0);
572 void albumUpdateAnims();
576 void albumBackUpRect();
577 void albumRestoreRect();
578 void albumUpdateRect();
580 void albumSwitchPages(
int oldPage,
int newPage,
int srcPage);
582 int albumNextPage(
Button *caller);
583 int albumPrevPage(
Button *caller);
584 int albumClose(
Button *caller);
591 int o3_getMalcolmShapes(
EMCState *script);
592 int o3_setCharacterPos(
EMCState *script);
593 int o3_defineObject(
EMCState *script);
594 int o3_refreshCharacter(
EMCState *script);
595 int o3_getMalcolmsMood(
EMCState *script);
596 int o3_getCharacterFrameFromFacing(
EMCState *script);
597 int o3_setCharacterFacing(
EMCState *script);
598 int o3_showSceneFileMessage(
EMCState *script);
599 int o3_setCharacterAnimFrameFromFacing(
EMCState *script);
600 int o3_showBadConscience(
EMCState *script);
601 int o3_hideBadConscience(
EMCState *script);
603 int o3_setInventorySlot(
EMCState *script);
604 int o3_getInventorySlot(
EMCState *script);
605 int o3_addItemToInventory(
EMCState *script);
606 int o3_addItemToCurScene(
EMCState *script);
607 int o3_objectChat(
EMCState *script);
608 int o3_resetInventory(
EMCState *script);
609 int o3_removeInventoryItemInstances(
EMCState *script);
610 int o3_countInventoryItemInstances(
EMCState *script);
611 int o3_npcChatSequence(
EMCState *script);
612 int o3_badConscienceChat(
EMCState *script);
613 int o3_wipeDownMouseItem(
EMCState *script);
614 int o3_setMalcolmsMood(
EMCState *script);
615 int o3_updateScore(
EMCState *script);
616 int o3_makeSecondChanceSave(
EMCState *script);
617 int o3_setSceneFilename(
EMCState *script);
618 int o3_removeItemsFromScene(
EMCState *script);
619 int o3_disguiseMalcolm(
EMCState *script);
620 int o3_drawSceneShape(
EMCState *script);
621 int o3_drawSceneShapeOnPage(
EMCState *script);
622 int o3_checkInRect(
EMCState *script);
623 int o3_updateConversations(
EMCState *script);
624 int o3_removeItemSlot(
EMCState *script);
625 int o3_setSceneDim(
EMCState *script);
626 int o3_setSceneAnimPosAndFrame(
EMCState *script);
627 int o3_removeItemInstances(
EMCState *script);
628 int o3_disableInventory(
EMCState *script);
629 int o3_enableInventory(
EMCState *script);
630 int o3_enterNewScene(
EMCState *script);
631 int o3_switchScene(
EMCState *script);
632 int o3_setMalcolmPos(
EMCState *script);
634 int o3_playSoundEffect(
EMCState *script);
636 int o3_daggerWarning(
EMCState *script);
637 int o3_blockOutWalkableRegion(
EMCState *script);
638 int o3_showSceneStringsMessage(
EMCState *script);
639 int o3_showGoodConscience(
EMCState *script);
640 int o3_goodConscienceChat(
EMCState *script);
641 int o3_hideGoodConscience(
EMCState *script);
642 int o3_defineSceneAnim(
EMCState *script);
643 int o3_updateSceneAnim(
EMCState *script);
644 int o3_runActorScript(
EMCState *script);
646 int o3_setConversationState(
EMCState *script);
647 int o3_getConversationState(
EMCState *script);
648 int o3_changeChapter(
EMCState *script);
649 int o3_countItemInstances(
EMCState *script);
650 int o3_dialogStartScript(
EMCState *script);
651 int o3_dialogEndScript(
EMCState *script);
652 int o3_customChat(
EMCState *script);
653 int o3_customChatFinish(
EMCState *script);
654 int o3_setupSceneAnimObject(
EMCState *script);
655 int o3_removeSceneAnimObject(
EMCState *script);
664 static const char *
const _languageExtension[];
665 static const int _languageExtensionSize;
667 int loadLanguageFile(
const char *file, uint8 *&buffer);
Definition: sound_digital_mr.h:46
Definition: screen_mr.h:31
Definition: kyra_mr.h:544
Definition: detection.h:38
Definition: kyra_v2.h:102
Definition: detection.h:27
Definition: screen_v2.h:30
Definition: wsamovie.h:112