ScummVM API documentation
touche.h
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 modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (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, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef TOUCHE_TOUCHE_H
23 #define TOUCHE_TOUCHE_H
24 
25 #include "common/array.h"
26 #include "common/endian.h"
27 #include "common/file.h"
28 #include "common/random.h"
29 #include "common/rect.h"
30 #include "common/util.h"
31 
32 #include "audio/mixer.h"
33 
34 #include "engines/engine.h"
35 
36 #include "touche/console.h"
37 
46 namespace Touche {
47 
48 enum TOUCHEAction {
49  kToucheActionNone,
50  kToucheActionYes,
51  kToucheActionSkipOrQuit,
52  kToucheActionOpenOptions,
53  kToucheActionEnableFastWalk,
54  kToucheActionDisableFastWalk,
55  kToucheActionToggleFastMode,
56  kToucheActionToggleTalkTextMode,
57  kToucheActionSkipDialogue
58 };
59 
60 struct Area {
61  Common::Rect r;
62  int16 srcX, srcY;
63 
64  Area() {
65  srcX = srcY = 0;
66  }
67 
68  Area(int16 x, int16 y, int16 w, int16 h) {
69  r = Common::Rect(x, y, x + w, y + h);
70  srcX = srcY = 0;
71  }
72 
73  bool clip(const Common::Rect &rect) {
74  const int dx = r.left - rect.left;
75  if (dx < 0) {
76  srcX -= dx;
77  }
78  const int dy = r.top - rect.top;
79  if (dy < 0) {
80  srcY -= dy;
81  }
82  if (rect.left > r.left) {
83  r.left = rect.left;
84  }
85  if (rect.top > r.top) {
86  r.top = rect.top;
87  }
88  if (rect.right < r.right) {
89  r.right = rect.right;
90  }
91  if (rect.bottom < r.bottom) {
92  r.bottom = rect.bottom;
93  }
94  return (r.right > r.left && r.bottom > r.top);
95  }
96 };
97 
98 struct KeyChar {
99  uint16 num;
100  uint16 flags;
101  int16 currentAnimCounter;
102  int16 strNum;
103  int16 walkDataNum;
104  int16 spriteNum;
105  Common::Rect prevBoundingRect;
106  Common::Rect boundingRect;
107  int16 xPos;
108  int16 yPos;
109  int16 zPos;
110  int16 xPosPrev;
111  int16 yPosPrev;
112  int16 zPosPrev;
113  int16 prevWalkDataNum;
114  uint16 textColor;
115  int16 inventoryItems[4];
116  int16 money;
117  int16 pointsDataNum;
118  int16 currentWalkBox;
119  uint16 prevPointsDataNum;
120  int16 currentAnim;
121  int16 facingDirection;
122  int16 currentAnimSpeed;
123  int16 framesList[16];
124  int16 framesListCount;
125  int16 currentFrame;
126  int16 anim1Start;
127  int16 anim1Count;
128  int16 anim2Start;
129  int16 anim2Count;
130  int16 anim3Start;
131  int16 anim3Count;
132  int16 followingKeyCharNum;
133  int16 followingKeyCharPos;
134  uint16 sequenceDataIndex;
135  uint16 sequenceDataOffset;
136  int16 walkPointsListIndex;
137  int16 walkPointsList[40];
138  uint16 scriptDataStartOffset;
139  uint16 scriptDataOffset;
140  int16 *scriptStackPtr;
141  int16 delay;
142  int16 waitingKeyChar;
143  int16 waitingKeyCharPosTable[3];
144  int16 scriptStackTable[40];
145 };
146 
147 struct Script {
148  uint8 opcodeNum;
149  uint32 dataOffset;
150  int16 keyCharNum;
151  uint8 *dataPtr;
152  int16 *stackDataPtr;
153  int16 *stackDataBasePtr;
154  int16 quitFlag;
155  int16 stackDataTable[500];
156 
157  void init(uint8 *data) {
158  dataPtr = data;
159  stackDataPtr = stackDataBasePtr = &stackDataTable[499];
160  dataOffset = 0;
161  quitFlag = 0;
162  }
163 
164  uint8 readByte(uint32 offs) const {
165  return *(dataPtr + offs);
166  }
167 
168  int16 readWord(uint32 offs) const {
169  return READ_LE_UINT16(dataPtr + offs);
170  }
171 
172  uint8 readNextByte() {
173  uint8 val = readByte(dataOffset);
174  ++dataOffset;
175  return val;
176  }
177 
178  int16 readNextWord() {
179  int16 val = readWord(dataOffset);
180  dataOffset += 2;
181  return val;
182  }
183 };
184 
185 struct TalkEntry {
186  int16 otherKeyChar;
187  int16 talkingKeyChar;
188  int16 num;
189 };
190 
192  int16 num;
193  int16 msg;
194 };
195 
197  int16 num;
198  int16 x;
199  int16 y;
200  int16 dx;
201  int16 dy;
202  int16 posNum;
203  int16 delayCounter;
204  int16 displayCounter;
205  Common::Rect displayRect;
206 
207  void clear() {
208  num = 0;
209  x = 0;
210  y = 0;
211  dx = 0;
212  dy = 0;
213  posNum = 0;
214  delayCounter = 0;
215  displayRect.top = 0;
216  displayRect.left = 0;
217  displayRect.bottom = 0;
218  displayRect.right = 0;
219  }
220 };
221 
223  int16 sprNum;
224  int16 seqNum;
225 };
226 
227 struct SpriteData {
228  uint32 size;
229  uint8 *ptr;
230  uint16 bitmapWidth;
231  uint16 bitmapHeight;
232  uint16 w;
233  uint16 h;
234 };
235 
237  int16 displayOffset;
238  int16 lastItem;
239  int16 itemsPerLine;
240  int16 *itemsList;
241 };
242 
244  int16 x, y, z;
245  int16 order;
246 };
247 
249  int16 point1;
250  int16 point2;
251  int16 clippingRect;
252  int16 area1;
253  int16 area2;
254 };
255 
257  Area area;
258  int16 id;
259  int16 state;
260  int16 animCount;
261  int16 animNext;
262 };
263 
265  Area area;
266  int16 type;
267  int16 offset;
268  int16 scaleMul;
269  int16 scaleDiv;
270 };
271 
273  int16 item;
274  int16 talk;
275  uint16 state;
276  int16 str;
277  int16 defaultStr;
278  int16 actions[8];
279  Common::Rect hitBoxes[2];
280 };
281 
283  int16 object1;
284  int16 action;
285  int16 object2;
286  uint16 offset;
287 };
288 
290  int16 keyChar;
291  uint16 offset;
292 };
293 
295  int16 num;
296  uint16 offset;
297  int16 msg;
298 };
299 
300 enum {
301  kDebugEngine = 1,
302  kDebugGraphics,
303  kDebugResource,
304  kDebugOpcodes,
305  kDebugMenu,
306  kDebugCharset,
307 };
308 
309 enum ResourceType {
310  kResourceTypeRoomImage = 0,
311  kResourceTypeSequence,
312  kResourceTypeSpriteImage,
313  kResourceTypeIconImage,
314  kResourceTypeRoomInfo,
315  kResourceTypeProgram,
316  kResourceTypeMusic,
317  kResourceTypeSound
318 };
319 
320 enum TalkMode {
321  kTalkModeTextOnly = 0,
322  kTalkModeVoiceOnly,
323  kTalkModeVoiceAndText,
324  kTalkModeCount
325 };
326 
327 enum ScriptFlag {
328  kScriptStopped = 1 << 0,
329  kScriptPaused = 1 << 1
330 };
331 
332 enum SaveLoadMode {
333  kSaveGameState = 0,
334  kLoadGameState
335 };
336 
337 enum InventoryArea {
338  kInventoryCharacter = 0,
339  kInventoryMoneyDisplay,
340  kInventoryGoldCoins,
341  kInventorySilverCoins,
342  kInventoryMoney,
343  kInventoryScroller1,
344  kInventoryObject1,
345  kInventoryObject2,
346  kInventoryObject3,
347  kInventoryObject4,
348  kInventoryObject5,
349  kInventoryObject6,
350  kInventoryScroller2
351 };
352 
353 enum {
354  kScreenWidth = 640,
355  kScreenHeight = 400,
356  kRoomHeight = 352,
357  kStartupEpisode = 90,
358  // TODO: If the following truncation is intentional (it probably is) it should be clearly marked as such
359  kCycleDelay = 1000 / (1193180 / 32768),
360  kIconWidth = 58,
361  kIconHeight = 42,
362  kCursorWidth = 58,
363  kCursorHeight = 42,
364  kTextHeight = 16,
365  kMaxProgramDataSize = 61440,
366  kMaxSaveStates = 100
367 };
368 
369 enum StringType {
370  kStringTypeDefault,
371  kStringTypeConversation
372 };
373 
374 enum GameState {
375  kGameStateGameLoop,
376  kGameStateOptionsDialog,
377  kGameStateQuitDialog,
378  kGameStateNone
379 };
380 
381 enum ActionId {
382  kActionNone,
383 
384  // settings menu
385  kActionLoadMenu,
386  kActionSaveMenu,
387  kActionRestartGame,
388  kActionPlayGame,
389  kActionQuitGame,
390  kActionTextOnly,
391  kActionVoiceOnly,
392  kActionTextAndVoice,
393  kActionLowerVolume,
394  kActionUpperVolume,
395 
396  // saveLoad menu
397  kActionGameState1,
398  kActionGameState2,
399  kActionGameState3,
400  kActionGameState4,
401  kActionGameState5,
402  kActionGameState6,
403  kActionGameState7,
404  kActionGameState8,
405  kActionGameState9,
406  kActionGameState10,
407  kActionScrollUpSaves,
408  kActionScrollDownSaves,
409  kActionPerformSaveLoad,
410  kActionCancelSaveLoad
411 };
412 
413 enum MenuMode {
414  kMenuSettingsMode = 0,
415  kMenuLoadStateMode,
416  kMenuSaveStateMode
417 };
418 
419 enum ButtonFlags {
420  kButtonBorder = 1 << 0,
421  kButtonText = 1 << 1,
422  kButtonArrow = 1 << 2
423 };
424 
425 struct Button {
426  int x, y;
427  int w, h;
428  ActionId action;
429  int data;
430  uint8 flags;
431 };
432 
433 struct MenuData {
434  MenuMode mode;
435  Button *buttonsTable;
436  uint buttonsCount;
437  bool quit;
438  bool exit;
439  char saveLoadDescriptionsTable[kMaxSaveStates][33];
440 
441  void removeLastCharFromDescription(int slot) {
442  char *description = saveLoadDescriptionsTable[slot];
443  int descriptionLen = strlen(description);
444  if (descriptionLen > 0) {
445  --descriptionLen;
446  description[descriptionLen] = 0;
447  }
448  }
449 
450  void addCharToDescription(int slot, char chr) {
451  char *description = saveLoadDescriptionsTable[slot];
452  int descriptionLen = strlen(description);
453  if (descriptionLen < 32 && Common::isPrint(chr)) {
454  description[descriptionLen] = chr;
455  description[descriptionLen + 1] = 0;
456  }
457  }
458 
459  const Button *findButtonUnderCursor(int cursorX, int cursorY) const {
460  for (uint i = 0; i < buttonsCount; ++i) {
461  const Button *button = &buttonsTable[i];
462  if (cursorX >= button->x && cursorX < button->x + button->w &&
463  cursorY >= button->y && cursorY < button->y + button->h) {
464  return button;
465  }
466  }
467  return 0;
468  }
469 };
470 
471 
472 void readGameStateDescription(Common::ReadStream *f, char *description, int len);
473 Common::String generateGameStateFileName(const char *target, int slot, bool prefixOnly = false);
474 int getGameStateFileSlot(const char *filename);
475 
476 class MidiPlayer;
477 
478 class ToucheEngine: public Engine {
479 public:
480 
481  enum {
482  NUM_FLAGS = 2000,
483  NUM_KEYCHARS = 32,
484  NUM_SPRITES = 7,
485  NUM_SEQUENCES = 7,
486  NUM_CONVERSATION_CHOICES = 40,
487  NUM_TALK_ENTRIES = 16,
488  NUM_ANIMATION_ENTRIES = 4,
489  NUM_INVENTORY_ITEMS = 100,
490  NUM_DIRTY_RECTS = 30,
491  NUM_DIRECTIONS = 135
492  };
493 
494  typedef void (ToucheEngine::*OpcodeProc)();
495 
496  ToucheEngine(OSystem *system, Common::Language language);
497  ~ToucheEngine() override;
498 
499  // Engine APIs
500  Common::Error run() override;
501  bool hasFeature(EngineFeature f) const override;
502  void syncSoundSettings() override;
503 
504 protected:
505 
506  void restart();
507  void readConfigurationSettings();
508  void writeConfigurationSettings();
509  void mainLoop();
510  void processEvents(bool handleKeyEvents = true);
511  void runCycle();
512  int16 getRandomNumber(int max);
513  void changePaletteRange();
514  void playSoundInRange();
515  void resetSortedKeyCharsTable();
516  void setupEpisode(int num);
517  void setupNewEpisode();
518  void drawKeyChar(KeyChar *key);
519  void sortKeyChars();
520  void runKeyCharScript(KeyChar *key);
521  void runCurrentKeyCharScript(int mode);
522  void executeScriptOpcode(int16 param);
523  void initKeyChars(int keyChar);
524  void setKeyCharTextColor(int keyChar, uint16 color);
525  void waitForKeyCharPosition(int keyChar);
526  void setKeyCharBox(int keyChar, int value);
527  void setKeyCharFrame(int keyChar, int16 type, int16 value1, int16 value2);
528  void setKeyCharFacingDirection(int keyChar, int16 dir);
529  void initKeyCharScript(int keyChar, int16 spriteNum, int16 seqDataIndex, int16 seqDataOffs);
530  uint16 findProgramKeyCharScriptOffset(int keyChar) const;
531  bool scrollRoom(int keyChar);
532  void drawIcon(int x, int y, int num);
533  void centerScreenToKeyChar(int keyChar);
534  void waitForKeyCharsSet();
535  void redrawRoom();
536  void fadePalette(int firstColor, int colorCount, int scale, int scaleInc, int fadingStepsCount);
537  void fadePaletteFromFlags();
538  void moveKeyChar(uint8 *dst, int dstPitch, KeyChar *key);
539  void changeKeyCharFrame(KeyChar *key, int keyChar);
540  void setKeyCharRandomFrame(KeyChar *key);
541  void setKeyCharMoney();
542  const char *getString(int num) const;
543  int getStringWidth(int num) const;
544  void drawString(uint16 color, int x, int y, int16 num, StringType strType = kStringTypeDefault);
545  void drawGameString(uint16 color, int x1, int y, const char *str);
546  int restartKeyCharScriptOnAction(int action, int obj1, int obj2);
547  void buildSpriteScalingTable(int z1, int z2);
548  void drawSpriteOnBackdrop(int num, int x, int y);
549  void updateTalkFrames(int keyChar);
550  void setKeyCharTalkingFrame(int keyChar);
551  void lockUnlockHitBox(int num, int lock);
552  void drawHitBoxes();
553  void showCursor(bool show);
554  void setCursor(int num);
555  void setDefaultCursor(int num);
556  void handleLeftMouseButtonClickOnInventory();
557  void handleRightMouseButtonClickOnInventory();
558  void handleMouseInput(int flag);
559  void handleMouseClickOnRoom(int flag);
560  void handleMouseClickOnInventory(int flag);
561  void scrollScreenToPos(int num);
562  void clearRoomArea();
563  void startNewMusic();
564  void startNewSound();
565  void updateSpeech();
566  int handleActionMenuUnderCursor(const int16 *actions, int offs, int y, int str);
567 
568  void redrawBackground();
569  void addRoomArea(int num, int flag);
570  void updateRoomAreas(int num, int flags);
571  void setRoomAreaState(int num, uint16 state);
572  void findAndRedrawRoomRegion(int num);
573  void updateRoomRegions();
574  void redrawRoomRegion(int num, bool markForRedraw);
575 
576  void initInventoryObjectsTable();
577  void initInventoryLists();
578  void setupInventoryAreas();
579  void drawInventory(int index, int flag);
580  void drawAmountOfMoneyInInventory();
581  void packInventoryItems(int index);
582  void appendItemToInventoryList(int index);
583  void addItemToInventory(int inventory, int16 item);
584  void removeItemFromInventory(int inventory, int16 item);
585 
586  void resetTalkingVars();
587  int updateKeyCharTalk(int pauseFlag);
588  const char *formatTalkText(int *y, int *h, const char *text);
589  void addToTalkTable(int talkingKeyChar, int num, int otherKeyChar);
590  void removeFromTalkTable(int keyChar);
591  void addConversationChoice(int16 num);
592  void removeConversationChoice(int16 num);
593  void runConversationScript(uint16 offset);
594  void findConversationByNum(int16 num);
595  void clearConversationChoices();
596  void scrollDownConversationChoice();
597  void scrollUpConversationChoice();
598  void drawCharacterConversation();
599  void drawConversationString(int num, uint16 color);
600  void clearConversationArea();
601  void setupConversationScript(int num);
602  void handleConversation();
603 
604  void buildWalkPointsList(int keyChar);
605  int findWalkDataNum(int pointNum1, int pointNum2);
606  void changeWalkPath(int num1, int num2, int16 val);
607  void adjustKeyCharPosToWalkBox(KeyChar *key, int moveType);
608  void lockWalkPath(int num1, int num2);
609  void unlockWalkPath(int num1, int num2);
610  void resetPointsData(int num);
611  bool sortPointsData(int num1, int num2);
612  void updateKeyCharWalkPath(KeyChar *key, int16 dx, int16 dy, int16 dz);
613  void markWalkPoints(int keyChar);
614  void buildWalkPath(int dstPosX, int dstPosY, int keyChar);
615 
616  void addToAnimationTable(int num, int posNum, int keyChar, int delayCounter);
617  void copyAnimationImage(int dstX, int dstY, int w, int h, const uint8 *src, int srcX, int srcY, int fillColor);
618  void drawAnimationImage(AnimationEntry *anim);
619  void processAnimationTable();
620  void clearAnimationTable();
621 
622  void addToDirtyRect(const Common::Rect &r);
623  void clearDirtyRects();
624  void setPalette(int firstColor, int colorCount, int redScale, int greenScale, int blueScale);
625  void updateScreenArea(int x, int y, int w, int h);
626  void updateEntireScreen();
627  void updateDirtyScreenAreas();
628  void updatePalette();
629 
630  void saveGameStateData(Common::WriteStream *stream);
631  void loadGameStateData(Common::ReadStream *stream);
632  Common::Error saveGameState(int num, const Common::String &description, bool isAutosave = false) override;
633  Common::Error loadGameState(int num) override;
634  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
635  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
636  Common::String getSaveStateName(int slot) const override {
637  return Common::String::format("%s.%d", _targetName.c_str(), slot);
638  }
639 
640  void getHotspotPositions(Common::Array< ::Graphics::HotspotInfo> &hotspots) override;
641  bool hotspotDirty() const override;
642  void rebuildHotspotSnapshot() const;
643 
644  void setupOpcodes();
645  void op_nop();
646  void op_jnz();
647  void op_jz();
648  void op_jmp();
649  void op_true();
650  void op_false();
651  void op_push();
652  void op_not();
653  void op_add();
654  void op_sub();
655  void op_mul();
656  void op_div();
657  void op_mod();
658  void op_and();
659  void op_or();
660  void op_neg();
661  void op_testGreater();
662  void op_testEquals();
663  void op_testLower();
664  void op_fetchScriptWord();
665  void op_testGreaterOrEquals();
666  void op_testLowerOrEquals();
667  void op_testNotEquals();
668  void op_endConversation();
669  void op_stopScript();
670  void op_getFlag();
671  void op_setFlag();
672  void op_fetchScriptByte();
673  void op_getKeyCharWalkBox();
674  void op_startSound();
675  void op_moveKeyCharToPos();
676  void op_loadRoom();
677  void op_updateRoom();
678  void op_startTalk();
679  void op_loadSprite();
680  void op_loadSequence();
681  void op_setKeyCharBox();
682  void op_initKeyCharScript();
683  void op_setKeyCharFrame();
684  void op_setKeyCharDirection();
685  void op_clearConversationChoices();
686  void op_addConversationChoice();
687  void op_removeConversationChoice();
688  void op_getInventoryItem();
689  void op_setInventoryItem();
690  void op_startEpisode();
691  void op_setConversationNum();
692  void op_enableInput();
693  void op_disableInput();
694  void op_faceKeyChar();
695  void op_getKeyCharCurrentAnim();
696  void op_getCurrentKeyChar();
697  void op_isKeyCharActive();
698  void op_setPalette();
699  void op_changeWalkPath();
700  void op_lockWalkPath();
701  void op_initializeKeyChar();
702  void op_setupWaitingKeyChars();
703  void op_updateRoomAreas();
704  void op_unlockWalkPath();
705  void op_addItemToInventoryAndRedraw();
706  void op_giveItemTo();
707  void op_setHitBoxText();
708  void op_fadePalette();
709  void op_getInventoryItemFlags();
710  void op_drawInventory();
711  void op_stopKeyCharScript();
712  void op_restartKeyCharScript();
713  void op_getKeyCharCurrentWalkBox();
714  void op_getKeyCharPointsDataNum();
715  void op_setupFollowingKeyChar();
716  void op_startAnimation();
717  void op_setKeyCharTextColor();
718  void op_startMusic();
719  void op_sleep();
720  void op_setKeyCharDelay();
721  void op_lockHitBox();
722  void op_removeItemFromInventory();
723  void op_unlockHitBox();
724  void op_addRoomArea();
725  void op_setKeyCharFlags();
726  void op_unsetKeyCharFlags();
727  void op_loadSpeechSegment();
728  void op_drawSpriteOnBackdrop();
729  void op_startPaletteFadeIn();
730  void op_startPaletteFadeOut();
731  void op_setRoomAreaState();
732 
733  void res_openDataFile();
734  void res_closeDataFile();
735  void res_allocateTables();
736  void res_deallocateTables();
737  uint32 res_getDataOffset(ResourceType type, int num, uint32 *size = NULL);
738  void res_loadSpriteImage(int num, uint8 *dst);
739  void res_loadProgram(int num);
740  void res_decodeProgramData();
741  void res_loadRoom(int num);
742  void res_loadSprite(int num, int index);
743  void res_loadSequence(int num, int index);
744  void res_decodeScanLineImageRLE(uint8 *dst, int lineWidth);
745  void res_loadBackdrop();
746  void res_loadImage(int num, uint8 *dst);
747  void res_loadImageHelper(uint8 *imgData, int imgWidth, int imgHeight);
748  void res_loadSound(int flag, int num);
749  void res_stopSound();
750  void res_loadMusic(int num);
751  void res_loadSpeech(int num);
752  void res_loadSpeechSegment(int num);
753  void res_stopSpeech();
754 
755  void drawButton(Button *button);
756  void redrawMenu(MenuData *menu);
757  void handleMenuAction(MenuData *menu, int actionId);
758  void handleOptions(int forceDisplay);
759  void drawActionsPanel(int dstX, int dstY, int deltaX, int deltaY);
760  void drawConversationPanelBorder(int dstY, int srcX, int srcY);
761  void drawConversationPanel();
762  void printStatusString(const char *str);
763  void clearStatusString();
764  int displayQuitDialog();
765  void displayTextMode(int str);
766 
767  Common::Point getMousePos() const;
768 
769  MidiPlayer *_midiPlayer;
770 
771  int _musicVolume;
772  Audio::SoundHandle _musicHandle;
773 
774  void initMusic();
775 public: // To allow access from console
776  void startMusic(int num);
777  void stopMusic();
778 protected:
779  int getMusicVolume();
780  void setMusicVolume(int volume);
781  void adjustMusicVolume(int diff);
782 
783  Common::Language _language;
785 
786  bool _inp_leftMouseButtonPressed;
787  bool _inp_rightMouseButtonPressed;
788  int _disabledInputCounter;
789  bool _hideInventoryTexts;
790  GameState _gameState;
791  bool _displayQuitDialog;
792  int _saveLoadCurrentPage;
793  int _saveLoadCurrentSlot;
794 
795  int _newMusicNum;
796  int _currentMusicNum;
797  int _newSoundNum;
798  int _newSoundDelay;
799  int _newSoundPriority;
800  int _playSoundCounter;
801  bool _speechPlaying;
802  Audio::SoundHandle _sfxHandle;
803  Audio::SoundHandle _speechHandle;
804 
805  int16 _inventoryList1[101];
806  int16 _inventoryList2[101];
807  int16 _inventoryList3[7];
808  InventoryState _inventoryStateTable[3];
809  int16 _inventoryItemsInfoTable[NUM_INVENTORY_ITEMS];
810  int16 *_inventoryVar1;
811  int16 *_inventoryVar2;
812  int _currentCursorObject;
813  Common::Rect _inventoryAreasTable[13];
814 
815  int _talkTextMode;
816  int _talkListEnd;
817  int _talkListCurrent;
818  bool _talkTextRectDefined;
819  bool _talkTextDisplayed;
820  bool _talkTextInitialized;
821  bool _skipTalkText;
822  int _talkTextSpeed;
823  int _keyCharTalkCounter;
824  int _talkTableLastTalkingKeyChar;
825  int _talkTableLastOtherKeyChar;
826  int _talkTableLastStringNum;
827  int _objectDescriptionNum;
828  TalkEntry _talkTable[NUM_TALK_ENTRIES];
829 
830  bool _conversationChoicesUpdated;
831  int _conversationReplyNum;
832  bool _conversationEnded;
833  int _conversationNum;
834  int _scrollConversationChoiceOffset;
835  int _currentConversation;
836  bool _disableConversationScript;
837  bool _conversationAreaCleared;
838  ConversationChoice _conversationChoicesTable[NUM_CONVERSATION_CHOICES];
839 
840  int16 _flagsTable[NUM_FLAGS];
841  KeyChar _keyCharsTable[NUM_KEYCHARS];
842  KeyChar *_sortedKeyCharsTable[NUM_KEYCHARS];
843  int _currentKeyCharNum;
844 
845  int _newEpisodeNum;
846  int _currentEpisodeNum;
847 
848  int _currentAmountOfMoney;
849  int _giveItemToKeyCharNum;
850  int _giveItemToObjectNum;
851  int _giveItemToCounter;
852  int _currentRoomNum;
853  int _waitingSetKeyCharNum1;
854  int _waitingSetKeyCharNum2;
855  int _waitingSetKeyCharNum3;
856  uint8 _updatedRoomAreasTable[200];
857  Common::Rect _moveKeyCharRect;
858  Common::Point _screenOffset;
859  int _currentObjectNum;
860  int _processRandomPaletteCounter;
861  int16 _spriteScalingIndex[1000];
862  int16 _spriteScalingTable[1000];
863 
864  bool _fastWalkMode;
865  bool _fastMode;
866 
867  AnimationEntry _animationTable[NUM_ANIMATION_ENTRIES];
868 
869  Script _script;
870  const OpcodeProc *_opcodesTable;
871  int _numOpcodes;
872 
873  Common::File _fData;
874  Common::File _fSpeech[2];
875  int _compressedSpeechData;
876 
877  uint8 *_textData;
878  uint8 *_backdropBuffer;
879  uint8 *_menuKitData;
880  uint8 *_convKitData;
881  uint8 *_sequenceDataTable[NUM_SEQUENCES];
882  uint8 *_programData;
883  uint32 _programDataSize;
884  uint8 *_mouseData;
885  uint8 *_iconData;
886 
887  SpriteData _spritesTable[NUM_SPRITES];
888  SequenceEntry _sequenceEntryTable[NUM_SEQUENCES];
889  int _currentBitmapWidth;
890  int _currentBitmapHeight;
891  int _currentImageWidth;
892  int _currentImageHeight;
893  int _roomWidth;
894 
895  uint8 *_programTextDataPtr;
896  Common::Array<Common::Rect> _programRectsTable;
897  Common::Array<ProgramPointData> _programPointsTable;
898  Common::Array<ProgramWalkData> _programWalkTable;
899  Common::Array<ProgramAreaData> _programAreaTable;
900  Common::Array<ProgramBackgroundData> _programBackgroundTable;
901  Common::Array<ProgramHitBoxData> _programHitBoxTable;
902  Common::Array<ProgramActionScriptOffsetData> _programActionScriptOffsetTable;
903  Common::Array<ProgramKeyCharScriptOffsetData> _programKeyCharScriptOffsetTable;
904  Common::Array<ProgramConversationData> _programConversationTable;
905  Common::Rect _cursorObjectRect;
906  Common::Rect _talkTextRect, _talkTextRect2;
907  Common::Rect _screenRect;
908  Common::Rect _roomAreaRect;
909 
910  bool _roomNeedRedraw;
911  int _fullRedrawCounter;
912  int _menuRedrawCounter;
913  uint8 *_offscreenBuffer;
914  uint8 _paletteBuffer[256 * 3];
915  Common::Rect _dirtyRectsTable[NUM_DIRTY_RECTS];
916  int _dirtyRectsTableCount;
917 
919  struct HitBoxEntry {
920  int16 item;
921  int16 lockedTop;
922  int16 str;
923  int16 defaultStr;
924  Common::Rect hitBox0;
925  };
926  struct CharEntry {
927  uint16 num;
928  uint16 flags;
929  Common::Rect prevBoundingRect;
930  };
931  int16 flag618;
932  int16 scrollX;
933  int16 scrollY;
934  int currentEpisodeNum;
936  CharEntry chars[NUM_KEYCHARS];
937  };
938  mutable HotspotSnapshot _hotspotSnapshot;
939 
940  static const uint8 _directionsTable[NUM_DIRECTIONS];
941 };
942 
943 /*
944  FLAGS LIST
945 
946  115 : don't set backdrop palette on room loading
947  118 : current amount of money
948  119 : current cursor object
949  176 : keychar max direction
950  266 : keychar direction override
951  267 : don't decode picture/sprite images (in load_image_helper)
952  268 : don't decode picture/sprite images
953  269 : disable room background animations
954  270 : play random sound
955  290 : process random palette
956  295 : game cycle counter (incremented)
957  296 : game cycle counter (incremented)
958  297 : game cycle counter (incremented)
959  298 : game cycle counter (decremented)
960  299 : game cycle counter (decremented)
961  600 : last ascii key press
962  603 : fade palette "scale" increment (in vbl handler)
963  605 : fade palette "scale"
964  606 : inventory redraw disabled
965  607 : first palette color to fade
966  608 : last palette color to fade
967  609 : max fade palette "scale"
968  610 : min fade palette "scale"
969  611 : quit game
970  612 : random number modulo
971  613 : last generated random number
972  614 : room scroll x offset
973  615 : room scroll y offset
974  616 : disable room scrolling
975  617 : current speech file number
976  618 : hide mouse cursor
977  621 : enable french version "features"
978  902 : debug/draw walk boxes
979  911 : load scripts/programs from external files
980 */
981 
982 } // namespace Touche
983 
984 #endif
Definition: touche.h:425
Definition: str.h:59
Definition: touche.h:926
EngineFeature
Definition: engine.h:282
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: stream.h:77
Definition: touche.h:227
Definition: error.h:81
T left
Definition: rect.h:170
Definition: touche.h:185
Definition: array.h:52
Definition: random.h:44
Definition: touche.h:236
Definition: rect.h:536
bool isPrint(int c)
Definition: touche.h:196
Definition: mixer.h:49
T right
Definition: rect.h:171
Definition: touche.h:478
Definition: ustr.h:57
Definition: file.h:47
Definition: touche.h:98
Definition: console.h:27
Definition: touche.h:222
Definition: rect.h:144
Definition: touche.h:919
Definition: touche.h:248
Definition: touche.h:147
Common::String getSaveStateName(int slot) const override
Definition: touche.h:636
Definition: touche.h:272
Definition: touche.h:294
Definition: touche.h:243
Definition: stream.h:385
Definition: touche.h:60
Definition: touche.h:433
Definition: touche.h:191
Definition: system.h:166
Definition: engine.h:149
Definition: touche.h:264
Definition: midi.h:38
Definition: touche.h:256
Language
Definition: language.h:45