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