ScummVM API documentation
efh.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 EFH_H
23 #define EFH_H
24 
25 #include "audio/softsynth/pcspk.h"
26 #include "audio/mixer.h"
27 #include "common/file.h"
28 #include "common/rect.h"
29 #include "common/events.h"
30 #include "common/serializer.h"
31 #include "common/text-to-speech.h"
32 
33 #include "engines/advancedDetector.h"
34 #include "engines/engine.h"
35 #include "graphics/surface.h"
36 
37 #include "efh/constants.h"
38 
39 namespace Common {
40 class RandomSource;
41 }
42 
57 namespace Efh {
58 
59 static const uint8 kSavegameVersion = 1;
60 #define EFH_SAVE_HEADER MKTAG('E', 'F', 'H', 'S')
61 
62 enum EfhDebugChannels {
63  kDebugEngine = 1,
64  kDebugUtils,
65  kDebugGraphics,
66  kDebugScript,
67  kDebugFight,
68 };
69 
71 public:
73  EfhGraphicsStruct(int8 **lineBuf, int16 x, int16 y, int16 width, int16 height);
74 
75  int8 **_vgaLineBuffer;
76  uint16 _shiftValue;
77  uint16 _width;
78  uint16 _height;
79  Common::Rect _area;
80 
81  void copy(EfhGraphicsStruct *src);
82 };
83 
84 struct InvObject {
85  int16 _ref;
86  uint8 _stat1; // abbb bbbb - a: equipped b: uses left
87  uint8 _curHitPoints;
88 
89  void init();
90  bool isEquipped();
91  int8 getUsesLeft();
92 };
93 
95  uint8 _placeId;
96  uint8 _posX;
97  uint8 _posY;
98  uint8 _triggerType; // 0xFD = Check inventory 0xFE = Check Character in team 0xFF Display description <= 0x77 = check score (all values in this case in data are <= 0xF)
99  uint8 _triggerValue;
100  uint16 _field5_textId;
101  uint16 _field7_textId;
102 
103  void init();
104 };
105 
106 struct FrameList {
107  int8 _subFileId[4];
108 
109  void init();
110 };
111 struct AnimInfo {
112  uint16 _posX[10];
113  uint8 _posY[10];
114  FrameList _frameList[15];
115 
116  void init();
117 };
118 
119 struct ItemStruct {
120  char _name[15];
121  uint8 _damage;
122  uint8 _defense;
123  uint8 _attacks;
124  uint8 _uses;
125  int8 _agilityModifier; // data contains values from -8 to +8
126  uint8 _range;
127  uint8 _attackType;
128  uint8 _specialEffect;
129  uint8 _defenseType;
130  uint8 _exclusiveType;
131  uint8 _field19_mapPosX_or_maxDeltaPoints;
132  uint8 _mapPosY;
133 
134  void init();
135 };
136 
137 struct NPCStruct {
138  char _name[11];
139  uint8 fieldB_textId;
140  uint8 field_C;
141  uint8 field_D;
142  uint8 fieldE_textId;
143  uint8 field_F;
144  uint8 field_10;
145  uint8 field11_NpcId;
146  uint16 field12_textId;
147  uint16 field14_textId;
148  uint32 _xp;
149  uint8 _activeScore[15];
150  uint8 _passiveScore[11];
151  uint8 _infoScore[11];
152  uint8 field_3F;
153  uint8 field_40;
154  InvObject _inventory[10];
155  uint8 _possessivePronounSHL6;
156  uint8 _speed;
157  uint8 field_6B;
158  uint8 field_6C;
159  uint8 field_6D;
160  uint8 _defaultDefenseItemId;
161  uint8 field_6F;
162  uint8 field_70;
163  uint8 field_71;
164  uint8 field_72;
165  uint8 field_73;
166  int16 _hitPoints;
167  int16 _maxHP;
168  uint8 field_78;
169  uint16 field_79;
170  uint16 field_7B;
171  uint8 field_7D;
172  uint8 field_7E;
173  uint8 field_7F;
174  uint8 field_80;
175  uint8 field_81;
176  uint8 field_82;
177  uint8 field_83;
178  uint8 field_84;
179  uint8 field_85;
180 
181  void init();
182  uint8 getPronoun();
183  void synchronize(Common::Serializer &s);
184 };
185 
186 struct FontDescr {
187  const uint8 *_widthArray;
188  const uint8 *_extraLines;
189  const Font *_fontData;
190  uint8 _charHeight;
191  uint8 _extraVerticalSpace;
192  uint8 _extraHorizontalSpace;
193 };
194 
195 struct BufferBM {
196  uint8 *_dataPtr;
197  uint16 _width;
198  uint16 _startX;
199  uint16 _startY;
200  uint16 _height;
201  uint16 _lineDataSize;
202  uint8 _paletteTransformation;
203  uint16 _fieldD;
204 };
205 
206 struct CharStatus {
207  int16 _type;
208  int16 _duration;
209 };
210 
211 struct MapMonster {
212  uint8 _possessivePronounSHL6; // aabb bbbb aa:Possessive Pronoun, bb bbbb: unknown
213  uint8 _npcId;
214  uint8 _fullPlaceId; // unsigned? Magic values are 0xFF and 0xFE
215  uint8 _posX;
216  uint8 _posY;
217  uint8 _weaponItemId;
218  uint8 _maxDamageAbsorption;
219  uint8 _monsterRef;
220  uint8 _additionalInfo; // abbb cddd a: special move flag, bbb: Pct modifier for random move, c aggressiveness, ddd move type
221  uint8 _talkTextId;
222  uint8 _groupSize;
223  int16 _hitPoints[9];
224 
225  uint8 getPronoun();
226 };
227 
229  int16 _id;
230  int16 _initiative;
231 
232  void init();
233 };
234 
236  uint8 _status;
237  uint8 _tileId;
238 
239  void init();
240 };
241 
242 struct TeamChar {
243  int16 _id;
244  CharStatus _status;
245  int16 _pctVisible;
246  int16 _pctDodgeMiss;
247  int16 _nextAttack;
248  int16 _lastInventoryUsed;
249  int16 _lastAction;
250 
251  void init();
252 };
253 
254 struct TeamMonster {
255  int16 _id;
256  CharStatus _mobsterStatus[9];
257 
258  void init();
259 };
260 
261 enum TTSMenuRestriction {
262  kNoRestriction,
263  kLowStatusMenu,
264  kMenu
265 };
266 
267 /* typed enum to match unsignedness of Common::CustomEventType */
268 enum EFHAction : Common::CustomEventType {
269  kActionNone,
270  kActionQuit,
271  kActionSkipVideo,
272  kActionSkipSong,
273  kActionSkipSongAndIntro,
274  kActionSave,
275  kActionLoad,
276  kActionMoveUp,
277  kActionMoveDown,
278  kActionMoveLeft,
279  kActionMoveRight,
280  kActionMoveUpLeft,
281  kActionMoveUpRight,
282  kActionMoveDownLeft,
283  kActionMoveDownRight,
284  kActionCharacter1Status,
285  kActionCharacter2Status,
286  kActionCharacter3Status,
287  kActionYes,
288  kActionNo,
289  kActionCharacter1,
290  kActionCharacter2,
291  kActionCharacter3,
292  kActionCancelCharacterSelection,
293  kActionStartFight,
294  kActionLeave,
295  kActionStatus,
296  kActionTalk,
297  kActionAttack,
298  kActionDefend,
299  kActionHide,
300  kActionRun,
301  kActionTeamStatus,
302  kActionTerrain,
303  kActionEnemy1,
304  kActionEnemy2,
305  kActionEnemy3,
306  kActionEnemy4,
307  kActionEnemy5,
308  kActionCancelEnemySelection,
309  kActionreset,
310  kActionExitStatusMenu,
311  kActionActive,
312  kActionDrop,
313  kActionEquip,
314  kActionGive,
315  kActionInfo,
316  kActionPassive,
317  kActionTrade,
318  kActionUse,
319  kActionSelect,
320  kActionScrollDown,
321  kActionScrollUp,
322  kActionExitSubMenu,
323  kActionOption1,
324  kActionOption2,
325  kActionOption3,
326  kActionOption4,
327  kActionOption5,
328  kActionOption6,
329  kActionOption7,
330  kActionOption8,
331  kActionOption9,
332  kActionOption10,
333  kActionOption11,
334  kActionOption12,
335  kActionOption13,
336  kActionOption14,
337  kActionSound13,
338  kActionSound14,
339  kActionSound15,
340  kActionSound5,
341  kActionSound10,
342  kActionSound9,
343  kActionSound16,
344 };
345 
347  EFHAction _action;
348  int8 _id;
349 };
350 
351 static const EfhSelectionAction _efhEnemySelectionCodes[] = {
352  { kActionEnemy1, 0 },
353  { kActionEnemy2, 1 },
354  { kActionEnemy3, 2 },
355  { kActionEnemy4, 3 },
356  { kActionEnemy5, 4 },
357 };
358 
359 static const EfhSelectionAction _efhTeamSelectionCodes[] = {
360  { kActionCharacter1, 0 },
361  { kActionCharacter2, 1 },
362  { kActionCharacter3, 2 },
363 };
364 
365 static const EfhSelectionAction _efhStatusMenuSubMenuCodes[] = {
366  { kActionOption1, 0 },
367  { kActionOption2, 1 },
368  { kActionOption3, 2 },
369  { kActionOption4, 3 },
370  { kActionOption5, 4 },
371  { kActionOption6, 5 },
372  { kActionOption7, 6 },
373  { kActionOption8, 7 },
374  { kActionOption9, 8 },
375  { kActionOption10, 9 },
376  { kActionOption11, 10 },
377  { kActionOption12, 11 },
378  { kActionOption13, 12 },
379  { kActionOption14, 13 },
380 };
381 
382 enum EfhKeymapCode {
383  kKeymapDefault,
384  kKeymapMenu,
385  kKeymapSkipVideo,
386  kKeymapSkipSong,
387  kKeymapStatusMenu,
388  kKeymapStatusMenuNavigation,
389  kKeymapStatusMenuSubMenu,
390  kKeymapInteraction,
391  kKeymapFight,
392  kKeymapCharacterSelection,
393  kKeymapEnemySelection,
394  kKeymapDeathMenu,
395 };
396 
397 struct EfhKeymap {
398  EfhKeymapCode _keymap;
399  const char *_id;
400 };
401 
402 static const EfhKeymap _efhKeymaps[] = {
403  { kKeymapDefault, "efh-default" },
404  { kKeymapMenu, "menu" },
405  { kKeymapSkipVideo, "skip-video" },
406  { kKeymapSkipSong, "skip-song" },
407  { kKeymapStatusMenu, "status-menu" },
408  { kKeymapStatusMenuNavigation, "status-menu-navigation" },
409  { kKeymapStatusMenuSubMenu, "status-menu-submenu" },
410  { kKeymapInteraction, "interaction" },
411  { kKeymapFight, "fight" },
412  { kKeymapCharacterSelection, "character-selection" },
413  { kKeymapEnemySelection, "enemy-selection" },
414  { kKeymapDeathMenu, "death-menu" },
415 };
416 
417 class EfhEngine : public Engine {
418 public:
419  EfhEngine(OSystem *syst, const ADGameDescription *gd);
420  ~EfhEngine() override;
421 
422  Graphics::Surface *_mainSurface;
423  Common::RandomSource *_rnd;
424 
425  const ADGameDescription *_gameDescription;
426 
427  // metaengine.cpp
428  void initGame(const ADGameDescription *gd);
429  uint32 getFeatures() const;
430  const char *getGameId() const;
431  Common::Platform getPlatform() const;
432  bool hasFeature(EngineFeature f) const override;
433  const char *getCopyrightString() const;
434 
435  // savegames.cpp
436  Common::String getSavegameFilename(int slot);
437  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
438  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
439  Common::Error loadGameState(int slot) override;
440  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
441 
442 protected:
443  int _lastTime;
444  // Engine APIs
445  Common::Error run() override;
446 
447 private:
448  Common::Platform _platform;
449  int _loadSaveSlot;
450  bool _saveAuthorized;
451 
452  void initialize();
453  void playIntro();
454  void initEngine();
455  void initMapMonsters();
456  void saveAnimImageSetId();
457  int16 getEquipmentDefense(int16 charId);
458  uint16 getEquippedExclusiveType(int16 charId, int16 exclusiveType, bool flag);
459  void displayLowStatusScreen(bool flag);
460  void loadImageSetToTileBank(int16 bankId, int16 setId);
461  void restoreAnimImageSetId();
462  void checkProtection();
463  void loadEfhGame();
464  void copyCurrentPlaceToBuffer(int16 id);
465  uint8 getMapTileInfo(int16 mapPosX, int16 mapPosY);
466  uint16 getStringWidth(const Common::String &str) const;
467  void setTextPos(int16 textPosX, int16 textPosY);
468  void drawGameScreenAndTempText(bool flag);
469  void drawMap(bool largeMapFl, int16 mapPosX, int16 mapPosY, int16 mapSize, bool drawHeroFl, bool drawMonstersFl);
470  void displaySmallMap(int16 posX, int16 posY);
471  void displayLargeMap(int16 posX, int16 posY);
472  void drawScreen();
473  void removeObject(int16 charId, int16 objectId);
474  void totalPartyKill();
475  void removeCharacterFromTeam(int16 teamMemberId);
476  void refreshTeamSize();
477  bool isNpcATeamMember(int16 id);
478  void handleWinSequence();
479  bool giveItemTo(int16 charId, int16 objectId, int16 fromCharId);
480  int16 chooseCharacterToReplace();
481  int16 handleCharacterJoining();
482  void drawText(uint8 *srcPtr, int16 posX, int16 posY, int16 maxX, int16 maxY, bool flag);
483  void displayMiddleLeftTempText(uint8 *impArray, bool flag);
484  void transitionMap(int16 centerX, int16 centerY);
485  void setSpecialTechZone(int16 unkId, int16 centerX, int16 centerY);
486  int16 findMapSpecialTileIndex(int16 posX, int16 posY);
487  bool isPosOutOfMap(int16 mapPosX, int16 mapPosY);
488  void goSouth();
489  void goNorth();
490  void goEast();
491  void goWest();
492  void goNorthEast();
493  void goSouthEast();
494  void goNorthWest();
495  void goSouthWest();
496  void showCharacterStatus(uint8 character);
497  void handleNewRoundEffects();
498  void resetGame();
499  void computeMapAnimation();
500  void handleAnimations();
501  void handleEvents();
502  int8 checkMonsterMoveCollisionAndTileTexture(int16 monsterId);
503  bool moveMonsterAwayFromTeam(int16 monsterId);
504  bool moveMonsterTowardsTeam(int16 monsterId);
505  bool moveMonsterGroupOther(int16 monsterId, int16 direction);
506  bool moveMonsterGroupRandom(int16 monsterId);
507  int16 computeMonsterGroupDistance(int16 monsterId);
508  bool checkWeaponRange(int16 monsterId, int16 weaponId);
509  bool checkMonsterMovementType(int16 id, bool teamFlag);
510  bool checkTeamWeaponRange(int16 monsterId);
511  bool checkIfMonsterOnSameLargeMapPlace(int16 monsterId);
512  bool checkMonsterWeaponRange(int16 monsterId);
513  void handleMapMonsterMoves();
514  bool checkMapMonsterAvailability(int16 monsterId);
515  void displayMonsterAnim(int16 monsterId);
516  int16 countAliveMonsters(int16 id);
517  bool checkMonsterGroupDistance1OrLess(int16 monsterId);
518  bool handleTalk(int16 monsterId, int16 arg2, int16 itemId);
519  void startTalkMenu(int16 monsterId);
520  void displayImp1Text(int16 textId);
521  bool handleInteractionText(int16 mapPosX, int16 mapPosY, int16 charId, int16 itemId, int16 arg8, int16 imageSetId);
522  int8 checkTileStatus(int16 mapPosX, int16 mapPosY, bool teamFl);
523  void computeInitiatives();
524  void redrawScreenForced();
525  int16 countMonsterGroupMembers(int16 monsterGroup);
526  uint16 getXPLevel(uint32 xp);
527  bool isItemCursed(int16 itemId);
528  bool hasObjectEquipped(int16 charId, int16 objectId);
529  void setMapMonsterAggressivenessAndMovementType(int16 id, uint8 mask);
530  bool isMonsterActive(int16 groupId, int16 id);
531  int16 getTileFactId(int16 mapPosX, int16 mapPosY);
532  void setCharacterObjectToBroken(int16 charId, int16 objectId);
533  int16 selectOtherCharFromTeam();
534  bool checkMonsterCollision();
535 
536  // Fight
537  bool handleFight(int16 monsterId);
538  void handleFight_checkEndEffect(int16 charId);
539  void handleFight_lastAction_A(int16 teamCharId);
540  void handleFight_lastAction_D(int16 teamCharId);
541  void handleFight_lastAction_H(int16 teamCharId);
542  bool handleFight_lastAction_U(int16 teamCharId);
543  void handleFight_MobstersAttack(int groupId);
544  bool isTPK();
545  bool isMonsterAlreadyFighting(int16 monsterId, int16 teamMonsterId);
546  void createOpponentList(int16 monsterTeamId);
547  void resetTeamMonsterEffects();
548  void initFight(int16 monsterId);
549  void resetTeamMonsterIdArray();
550  bool isTeamMemberStatusNormal(int16 id);
551  void getDeathTypeDescription(int16 victimId, int16 attackerId);
552  int16 determineTeamTarget(int16 charId, int16 unkFied18Val, bool checkDistanceFl);
553  bool getTeamAttackRoundPlans();
554  void drawCombatScreen(int16 charId, bool whiteFl, bool drawFl);
555  void getXPAndSearchCorpse(int16 charId, Common::String namePt1, Common::String namePt2, int16 monsterId);
556  bool characterSearchesMonsterCorpse(int16 charId, int16 monsterId);
557  void addReactionText(int16 id);
558  void displayEncounterInfo(bool WhiteFl);
559  int16 getWeakestMobster(int16 groupNumber);
560  int16 getCharacterScore(int16 charId, int16 itemId);
561  bool checkSpecialItemsOnCurrentPlace(int16 itemId);
562  bool hasAdequateDefense(int16 monsterId, uint8 attackType);
563  bool hasAdequateDefenseNPC(int16 charId, uint8 attackType);
564  void addNewOpponents(int16 monsterId);
565  int16 getTeamMonsterAnimId();
566  int16 selectMonsterGroup();
567  void redrawCombatScreenWithTempText(int16 charId);
568  void handleDamageOnArmor(int16 charId, int16 damage);
569 
570  // Files
571  int32 readFileToBuffer(const Common::Path &filename, uint8 *destBuffer);
572  void readAnimInfo();
573  void findMapFile(int16 mapId);
574  void rImageFile(const Common::Path &filename, uint8 *targetBuffer, uint8 **subFilesArray, uint8 *packedBuffer);
575  void readItems();
576  void readImpFile(int16 id, bool techMapFl);
577  void loadNewPortrait();
578  void loadAnimImageSet();
579  void loadHistory();
580  void loadTechMapImp(int16 fileId);
581  void loadPlacesFile(uint16 fullPlaceId, bool forceReloadFl);
582  void readTileFact();
583  void loadNPCS();
584  void preLoadMaps();
585 
586  // Graphics
587  void initPalette();
588  void drawLeftCenterBox();
589  void displayNextAnimFrame();
590  void displayAnimFrame();
591  void displayAnimFrames(int16 animId, bool displayMenuBoxFl);
592  void displayFctFullScreen();
593  void copyDirtyRect(int16 minX, int16 minY, int16 maxX, int16 maxY);
594  void copyGraphicBufferFromTo(EfhGraphicsStruct *efh_graphics_struct, EfhGraphicsStruct *efh_graphics_struct1, const Common::Rect &rect, int16 min_x, int16 min_y);
595  void displayBufferBmAtPos(BufferBM *bufferBM, int16 posX, int16 posY);
596  void drawRect(int16 minX, int16 minY, int16 maxX, int16 maxY);
597  void drawColoredRect(int16 minX, int16 minY, int16 maxX, int16 maxY, int16 color);
598  void clearScreen(int16 color);
599  void displayRawDataAtPos(uint8 *imagePtr, int16 posX, int16 posY);
600  void drawString(const Common::String &str, int16 startX, int16 startY, uint16 textColor);
601  void displayCenteredString(const Common::String &str, int16 minX, int16 maxX, int16 posY);
602  void displayMenuAnswerString(const Common::String &str, int16 minX, int16 maxX, int16 posY);
603  void drawMapWindow();
604  void displayGameScreen();
605  void drawUpperLeftBorders();
606  void drawUpperRightBorders();
607  void drawBottomBorders();
608  void drawChar(uint8 curChar, int16 posX, int16 posY);
609  void setTextColorWhite();
610  void setTextColorRed();
611  void setTextColorGrey();
612  void displayStringAtTextPos(const Common::String &message);
613  void clearBottomTextZone(int16 color);
614  void clearBottomTextZone_2(int16 color);
615  void setNextCharacterPos();
616  void displayCharAtTextPos(char character);
617  void displayWindow(uint8 *buffer, int16 posX, int16 posY, uint8 *dest);
618  void displayColoredMenuBox(int16 minX, int16 minY, int16 maxX, int16 maxY, int16 color);
619 
620  // Menu
621  int16 displayBoxWithText(const Common::String &str, int16 menuType, int16 displayOption, bool displayTeamWindowFl, bool voiceText = true);
622  bool handleDeathMenu();
623  void displayCombatMenu(int16 charId);
624  void displayMenuItemString(int16 menuBoxId, int16 thisBoxId, int16 minX, int16 maxX, int16 minY, const char *str);
625  void displayStatusMenu(int16 windowId);
626  void prepareStatusRightWindowIndexes(int16 menuId, int16 charId);
627  void displayCharacterSummary(int16 curMenuLine, int16 npcId);
628  void displayCharacterInformationOrSkills(int16 curMenuLine, int16 npcId);
629  void displayStatusMenuActions(int16 menuId, int16 curMenuLine, int16 npcId);
630  void prepareStatusMenu(int16 windowId, int16 menuId, int16 curMenuLine, int16 charId, bool refreshFl);
631  void displayWindowAndStatusMenu(int16 charId, int16 windowId, int16 menuId, int16 curMenuLine);
632  int16 displayStringInSmallWindowWithBorder(const Common::String &str, bool delayFl, int16 charId, int16 windowId, int16 menuId, int16 curMenuLine);
633  int16 handleStatusMenu(int16 gameMode, int16 charId);
634  void unequipItem(int16 charId, int16 objectId, int16 windowId, int16 menuId, int16 curMenuLine);
635  void tryToggleEquipped(int16 charId, int16 objectId, int16 windowId, int16 menuId, int16 curMenuLine);
636  int16 useObject(int16 charId, int16 objectId, int16 teamMonsterId, int16 menuId, int16 curMenuLine, int16 gameMode);
637 
638  // Savegames
639  void synchronize(Common::Serializer &s);
640 
641  // Script
642  const uint8 *script_readNumberArray(const uint8 *buffer, int16 destArraySize, int16 *destArray);
643  const uint8 *script_getNumber(const uint8 *srcBuffer, int16 *retBuf);
644  int16 script_parse(Common::String str, int16 posX, int16 posY, int16 maxX, int16 maxY, bool scriptExecuteFlag);
645 
646  // Sound
647  void songDelay(int delay);
648  void playNote(int frequencyIndex, int totalDelay);
649  Common::CustomEventType playSong(uint8 *buffer);
650  void generateSound1(int lowFreq, int highFreq, int duration);
651  void generateSound2(int startFreq, int endFreq, int speed);
652  void generateSound3();
653  void generateSound4(int repeat);
654  void generateSound5(int repeat);
655  void generateSound(int16 soundType);
656  void genericGenerateSound(int16 soundType, int16 repeatCount);
657  void sayText(const Common::String &text, TTSMenuRestriction menuRestriction, Common::TextToSpeechManager::Action action = Common::TextToSpeechManager::QUEUE) const;
658  void stopTextToSpeech() const;
659 
660  // Utils
661  void decryptImpFile(bool techMapFl);
662  void loadImageSet(int16 imageSetId, uint8 *buffer, uint8 **subFilesArray, uint8 *destBuffer);
663  uint32 uncompressBuffer(uint8 *compressedBuf, uint8 *destBuf);
664  int16 getRandom(int16 maxVal);
665  Common::CustomEventType getLastCharAfterAnimCount(int16 delay, bool waitForTTS = true);
666  Common::CustomEventType getInput(int16 delay);
667  Common::CustomEventType waitForKey();
668  Common::CustomEventType handleAndMapInput(bool animFl);
669  bool getValidationFromUser();
670  uint32 ROR(uint32 val, uint8 shiftVal);
671  Common::String getArticle(int pronoun);
672  void setKeymap(EfhKeymapCode keymapCode);
673 
674  // Actions
675  void handleActionSave();
676  void handleActionLoad();
677 
678  uint8 _videoMode;
679  uint8 _bufferCharBM[128];
680  int8 *_vgaLineBuffer[200];
681  EfhGraphicsStruct *_vgaGraphicsStruct1;
682  EfhGraphicsStruct *_vgaGraphicsStruct2;
683  EfhGraphicsStruct *_graphicsStruct;
684  uint8 _tileBank[3][12000];
685  uint8 _circleImageBuf[40100];
686  uint8 _portraitBuf[25000];
687  uint8 _decompBuf[40100];
688  uint8 _menuBuf[12500];
689  uint8 _windowWithBorderBuf[1500];
690  uint8 _mapArr[19][7000];
691  uint8 _places[12000];
692  uint8 _curPlace[24][24];
693  NPCStruct _npcBuf[100];
694  uint8 _imp1[13000];
695  uint8 _imp2[10000];
696  uint8 _titleSong[1024];
697  ItemStruct _items[300];
698  TileFactStruct _tileFact[432];
699  AnimInfo _animInfo[100];
700  uint8 _history[256];
701  uint8 _techDataArr[19][4100];
702  Common::String _enemyNamePt1;
703  Common::String _enemyNamePt2;
704  Common::String _characterNamePt1;
705  Common::String _characterNamePt2;
706  Common::String _nameBuffer;
707  Common::String _attackBuffer;
708  Common::String _messageToBePrinted;
709 
710  struct BitmapRef {
711  int8 _setId1;
712  int8 _setId2;
713  };
714 
715  BitmapRef _mapBitmapRefArr[19];
716 
717  MapSpecialTileStruct _mapSpecialTiles[19][100];
718  MapMonster _mapMonsters[19][64];
719  uint8 _mapGameMaps[19][64][64];
720 
721  uint8 _defaultBoxColor;
722  FontDescr _fontDescr;
723 
724  bool _introDoneFl;
725  uint16 _textColor;
726 
727  int16 _oldAnimImageSetId;
728  int16 _animImageSetId;
729  uint8 _paletteTransformationConstant;
730  uint8 *_circleImageSubFileArray[12];
731  uint8 *_tileBankSubFilesArray[216];
732  BufferBM _imageDataPtr;
733  int16 _currentTileBankImageSetId[3];
734  int16 _unkRelatedToAnimImageSetId;
735  int16 _techId;
736  int16 _currentAnimImageSetId;
737  uint8 *_portraitSubFilesArray[20];
738  int16 _unkAnimRelatedIndex;
739  uint8 *_imp1PtrArray[100];
740  uint8 *_imp2PtrArray[432];
741  uint16 _fullPlaceId;
742  int16 _guessAnimationAmount;
743  uint16 _largeMapFlag; // CHECKME: bool?
744  int16 _textPosX;
745  int16 _textPosY;
746 
747  Common::Rect _initRect;
748  bool _engineInitPending;
749  bool _protectionPassed;
750 
751  int16 _alertDelay;
752  int16 _teamSize;
753  int16 _word2C872;
754  bool _checkTileDisabledByScriptFl;
755  bool _redrawNeededFl;
756  bool _drawHeroOnMapFl;
757  bool _drawMonstersOnMapFl;
758  bool _textBoxDisabledByScriptFl;
759 
760  int16 _imageSetSubFilesIdx;
761  int16 _oldImageSetSubFilesIdx;
762 
763  int16 _mapPosX, _mapPosY;
764  int16 _oldMapPosX, _oldMapPosY;
765  int16 _techDataId_MapPosX, _techDataId_MapPosY;
766  uint16 _lastMainPlaceId;
767 
768  uint16 _tempTextDelay;
769  uint8 *_tempTextPtr;
770 
771  bool _ongoingFightFl;
772  bool _statusMenuActive;
773  int16 _menuStatItemArr[15];
774  int16 _menuDepth;
775  int16 _menuItemCounter;
776  int16 _selectedMenuBox;
777  bool _sayMenu;
778  bool _sayLowStatusScreen;
779  bool _initiatedTalkByMenu;
780 
781  TeamChar _teamChar[3];
782  TeamMonster _teamMonster[5];
783 
784  InitiativeStruct _initiatives[8];
785 
786  int16 _regenCounter;
787 
788  Audio::PCSpeaker *_speaker;
789 };
790 
791 } // End of namespace Efh
792 
793 #endif
Definition: str.h:59
Definition: efh.h:417
Definition: surface.h:67
EngineFeature
Definition: engine.h:258
Definition: error.h:81
Definition: efh.h:346
Definition: efh.h:242
Definition: advancedDetector.h:164
Definition: random.h:44
Definition: constants.h:27
Definition: efh.h:186
Definition: rect.h:524
Definition: path.h:52
Definition: efh.h:106
uint32 CustomEventType
Definition: events.h:204
Definition: efh.h:137
Definition: serializer.h:79
Definition: efh.h:70
Definition: efh.h:254
Out copy(In first, In last, Out dst)
Definition: algorithm.h:52
Definition: efh.h:397
Definition: ustr.h:57
Definition: efh.h:119
Definition: efh.h:206
Definition: efh.h:235
Definition: efh.h:84
Definition: constants.h:57
Definition: algorithm.h:29
Definition: efh.h:111
Definition: efh.h:228
Definition: system.h:163
Definition: efh.h:94
Definition: efh.h:211
Definition: engine.h:144
Definition: pcspk.h:34
Definition: efh.h:195
Platform
Definition: platform.h:93