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 << 0,
302  kDebugGraphics = 1 << 1,
303  kDebugResource = 1 << 2,
304  kDebugOpcodes = 1 << 3,
305  kDebugMenu = 1 << 4,
306  kDebugCharset = 1 << 5
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 setupOpcodes();
641  void op_nop();
642  void op_jnz();
643  void op_jz();
644  void op_jmp();
645  void op_true();
646  void op_false();
647  void op_push();
648  void op_not();
649  void op_add();
650  void op_sub();
651  void op_mul();
652  void op_div();
653  void op_mod();
654  void op_and();
655  void op_or();
656  void op_neg();
657  void op_testGreater();
658  void op_testEquals();
659  void op_testLower();
660  void op_fetchScriptWord();
661  void op_testGreaterOrEquals();
662  void op_testLowerOrEquals();
663  void op_testNotEquals();
664  void op_endConversation();
665  void op_stopScript();
666  void op_getFlag();
667  void op_setFlag();
668  void op_fetchScriptByte();
669  void op_getKeyCharWalkBox();
670  void op_startSound();
671  void op_moveKeyCharToPos();
672  void op_loadRoom();
673  void op_updateRoom();
674  void op_startTalk();
675  void op_loadSprite();
676  void op_loadSequence();
677  void op_setKeyCharBox();
678  void op_initKeyCharScript();
679  void op_setKeyCharFrame();
680  void op_setKeyCharDirection();
681  void op_clearConversationChoices();
682  void op_addConversationChoice();
683  void op_removeConversationChoice();
684  void op_getInventoryItem();
685  void op_setInventoryItem();
686  void op_startEpisode();
687  void op_setConversationNum();
688  void op_enableInput();
689  void op_disableInput();
690  void op_faceKeyChar();
691  void op_getKeyCharCurrentAnim();
692  void op_getCurrentKeyChar();
693  void op_isKeyCharActive();
694  void op_setPalette();
695  void op_changeWalkPath();
696  void op_lockWalkPath();
697  void op_initializeKeyChar();
698  void op_setupWaitingKeyChars();
699  void op_updateRoomAreas();
700  void op_unlockWalkPath();
701  void op_addItemToInventoryAndRedraw();
702  void op_giveItemTo();
703  void op_setHitBoxText();
704  void op_fadePalette();
705  void op_getInventoryItemFlags();
706  void op_drawInventory();
707  void op_stopKeyCharScript();
708  void op_restartKeyCharScript();
709  void op_getKeyCharCurrentWalkBox();
710  void op_getKeyCharPointsDataNum();
711  void op_setupFollowingKeyChar();
712  void op_startAnimation();
713  void op_setKeyCharTextColor();
714  void op_startMusic();
715  void op_sleep();
716  void op_setKeyCharDelay();
717  void op_lockHitBox();
718  void op_removeItemFromInventory();
719  void op_unlockHitBox();
720  void op_addRoomArea();
721  void op_setKeyCharFlags();
722  void op_unsetKeyCharFlags();
723  void op_loadSpeechSegment();
724  void op_drawSpriteOnBackdrop();
725  void op_startPaletteFadeIn();
726  void op_startPaletteFadeOut();
727  void op_setRoomAreaState();
728 
729  void res_openDataFile();
730  void res_closeDataFile();
731  void res_allocateTables();
732  void res_deallocateTables();
733  uint32 res_getDataOffset(ResourceType type, int num, uint32 *size = NULL);
734  void res_loadSpriteImage(int num, uint8 *dst);
735  void res_loadProgram(int num);
736  void res_decodeProgramData();
737  void res_loadRoom(int num);
738  void res_loadSprite(int num, int index);
739  void res_loadSequence(int num, int index);
740  void res_decodeScanLineImageRLE(uint8 *dst, int lineWidth);
741  void res_loadBackdrop();
742  void res_loadImage(int num, uint8 *dst);
743  void res_loadImageHelper(uint8 *imgData, int imgWidth, int imgHeight);
744  void res_loadSound(int flag, int num);
745  void res_stopSound();
746  void res_loadMusic(int num);
747  void res_loadSpeech(int num);
748  void res_loadSpeechSegment(int num);
749  void res_stopSpeech();
750 
751  void drawButton(Button *button);
752  void redrawMenu(MenuData *menu);
753  void handleMenuAction(MenuData *menu, int actionId);
754  void handleOptions(int forceDisplay);
755  void drawActionsPanel(int dstX, int dstY, int deltaX, int deltaY);
756  void drawConversationPanelBorder(int dstY, int srcX, int srcY);
757  void drawConversationPanel();
758  void printStatusString(const char *str);
759  void clearStatusString();
760  int displayQuitDialog();
761  void displayTextMode(int str);
762 
763  Common::Point getMousePos() const;
764 
765  MidiPlayer *_midiPlayer;
766 
767  int _musicVolume;
768  Audio::SoundHandle _musicHandle;
769 
770  void initMusic();
771 public: // To allow access from console
772  void startMusic(int num);
773  void stopMusic();
774 protected:
775  int getMusicVolume();
776  void setMusicVolume(int volume);
777  void adjustMusicVolume(int diff);
778 
779  Common::Language _language;
781 
782  bool _inp_leftMouseButtonPressed;
783  bool _inp_rightMouseButtonPressed;
784  int _disabledInputCounter;
785  bool _hideInventoryTexts;
786  GameState _gameState;
787  bool _displayQuitDialog;
788  int _saveLoadCurrentPage;
789  int _saveLoadCurrentSlot;
790 
791  int _newMusicNum;
792  int _currentMusicNum;
793  int _newSoundNum;
794  int _newSoundDelay;
795  int _newSoundPriority;
796  int _playSoundCounter;
797  bool _speechPlaying;
798  Audio::SoundHandle _sfxHandle;
799  Audio::SoundHandle _speechHandle;
800 
801  int16 _inventoryList1[101];
802  int16 _inventoryList2[101];
803  int16 _inventoryList3[7];
804  InventoryState _inventoryStateTable[3];
805  int16 _inventoryItemsInfoTable[NUM_INVENTORY_ITEMS];
806  int16 *_inventoryVar1;
807  int16 *_inventoryVar2;
808  int _currentCursorObject;
809  Common::Rect _inventoryAreasTable[13];
810 
811  int _talkTextMode;
812  int _talkListEnd;
813  int _talkListCurrent;
814  bool _talkTextRectDefined;
815  bool _talkTextDisplayed;
816  bool _talkTextInitialized;
817  bool _skipTalkText;
818  int _talkTextSpeed;
819  int _keyCharTalkCounter;
820  int _talkTableLastTalkingKeyChar;
821  int _talkTableLastOtherKeyChar;
822  int _talkTableLastStringNum;
823  int _objectDescriptionNum;
824  TalkEntry _talkTable[NUM_TALK_ENTRIES];
825 
826  bool _conversationChoicesUpdated;
827  int _conversationReplyNum;
828  bool _conversationEnded;
829  int _conversationNum;
830  int _scrollConversationChoiceOffset;
831  int _currentConversation;
832  bool _disableConversationScript;
833  bool _conversationAreaCleared;
834  ConversationChoice _conversationChoicesTable[NUM_CONVERSATION_CHOICES];
835 
836  int16 _flagsTable[NUM_FLAGS];
837  KeyChar _keyCharsTable[NUM_KEYCHARS];
838  KeyChar *_sortedKeyCharsTable[NUM_KEYCHARS];
839  int _currentKeyCharNum;
840 
841  int _newEpisodeNum;
842  int _currentEpisodeNum;
843 
844  int _currentAmountOfMoney;
845  int _giveItemToKeyCharNum;
846  int _giveItemToObjectNum;
847  int _giveItemToCounter;
848  int _currentRoomNum;
849  int _waitingSetKeyCharNum1;
850  int _waitingSetKeyCharNum2;
851  int _waitingSetKeyCharNum3;
852  uint8 _updatedRoomAreasTable[200];
853  Common::Rect _moveKeyCharRect;
854  Common::Point _screenOffset;
855  int _currentObjectNum;
856  int _processRandomPaletteCounter;
857  int16 _spriteScalingIndex[1000];
858  int16 _spriteScalingTable[1000];
859 
860  bool _fastWalkMode;
861  bool _fastMode;
862 
863  AnimationEntry _animationTable[NUM_ANIMATION_ENTRIES];
864 
865  Script _script;
866  const OpcodeProc *_opcodesTable;
867  int _numOpcodes;
868 
869  Common::File _fData;
870  Common::File _fSpeech[2];
871  int _compressedSpeechData;
872 
873  uint8 *_textData;
874  uint8 *_backdropBuffer;
875  uint8 *_menuKitData;
876  uint8 *_convKitData;
877  uint8 *_sequenceDataTable[NUM_SEQUENCES];
878  uint8 *_programData;
879  uint32 _programDataSize;
880  uint8 *_mouseData;
881  uint8 *_iconData;
882 
883  SpriteData _spritesTable[NUM_SPRITES];
884  SequenceEntry _sequenceEntryTable[NUM_SEQUENCES];
885  int _currentBitmapWidth;
886  int _currentBitmapHeight;
887  int _currentImageWidth;
888  int _currentImageHeight;
889  int _roomWidth;
890 
891  uint8 *_programTextDataPtr;
892  Common::Array<Common::Rect> _programRectsTable;
893  Common::Array<ProgramPointData> _programPointsTable;
894  Common::Array<ProgramWalkData> _programWalkTable;
895  Common::Array<ProgramAreaData> _programAreaTable;
896  Common::Array<ProgramBackgroundData> _programBackgroundTable;
897  Common::Array<ProgramHitBoxData> _programHitBoxTable;
898  Common::Array<ProgramActionScriptOffsetData> _programActionScriptOffsetTable;
899  Common::Array<ProgramKeyCharScriptOffsetData> _programKeyCharScriptOffsetTable;
900  Common::Array<ProgramConversationData> _programConversationTable;
901  Common::Rect _cursorObjectRect;
902  Common::Rect _talkTextRect, _talkTextRect2;
903  Common::Rect _screenRect;
904  Common::Rect _roomAreaRect;
905 
906  bool _roomNeedRedraw;
907  int _fullRedrawCounter;
908  int _menuRedrawCounter;
909  uint8 *_offscreenBuffer;
910  uint8 _paletteBuffer[256 * 3];
911  Common::Rect _dirtyRectsTable[NUM_DIRTY_RECTS];
912  int _dirtyRectsTableCount;
913 
914  static const uint8 _directionsTable[NUM_DIRECTIONS];
915 };
916 
917 /*
918  FLAGS LIST
919 
920  115 : don't set backdrop palette on room loading
921  118 : current amount of money
922  119 : current cursor object
923  176 : keychar max direction
924  266 : keychar direction override
925  267 : don't decode picture/sprite images (in load_image_helper)
926  268 : don't decode picture/sprite images
927  269 : disable room background animations
928  270 : play random sound
929  290 : process random palette
930  295 : game cycle counter (incremented)
931  296 : game cycle counter (incremented)
932  297 : game cycle counter (incremented)
933  298 : game cycle counter (decremented)
934  299 : game cycle counter (decremented)
935  600 : last ascii key press
936  603 : fade palette "scale" increment (in vbl handler)
937  605 : fade palette "scale"
938  606 : inventory redraw disabled
939  607 : first palette color to fade
940  608 : last palette color to fade
941  609 : max fade palette "scale"
942  610 : min fade palette "scale"
943  611 : quit game
944  612 : random number modulo
945  613 : last generated random number
946  614 : room scroll x offset
947  615 : room scroll y offset
948  616 : disable room scrolling
949  617 : current speech file number
950  618 : hide mouse cursor
951  621 : enable french version "features"
952  902 : debug/draw walk boxes
953  911 : load scripts/programs from external files
954 */
955 
956 } // namespace Touche
957 
958 #endif
Definition: touche.h:425
Definition: str.h:59
EngineFeature
Definition: engine.h:253
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
Definition: stream.h:77
Definition: touche.h:227
Definition: error.h:84
Definition: touche.h:185
Definition: random.h:44
int16 right
Definition: rect.h:146
Definition: touche.h:236
Definition: rect.h:144
bool isPrint(int c)
Definition: touche.h:196
Definition: mixer.h:49
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
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:45
int16 left
Definition: rect.h:145
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:161
Definition: engine.h:144
Definition: touche.h:264
Definition: midi.h:38
Definition: touche.h:256
Language
Definition: language.h:45