32 #include "engines/engine.h" 33 #include "graphics/surface.h" 34 #include "common/random.h" 35 #include "common/error.h" 36 #include "toon/resource.h" 37 #include "toon/script.h" 38 #include "toon/script_func.h" 39 #include "toon/state.h" 40 #include "toon/picture.h" 41 #include "toon/anim.h" 42 #include "toon/movie.h" 43 #include "toon/font.h" 44 #include "toon/text.h" 45 #include "toon/audio.h" 46 #include "toon/console.h" 49 class MemoryWriteStreamDynamic;
54 #define TOON_DAT_VER_MAJ 0 // 1 byte 55 #define TOON_DAT_VER_MIN 4 // 1 byte 56 #define TOON_SAVEGAME_VERSION 6 57 #define DATAALIGNMENT 4 58 #define MAX_SAVE_SLOT 99 60 #define TOON_SCREEN_WIDTH 640 61 #define TOON_SCREEN_HEIGHT 400 62 #define TOON_BACKBUFFER_WIDTH 1280 63 #define TOON_BACKBUFFER_HEIGHT 400 79 enum ToonDebugChannels {
81 kDebugCharacter = 1 << 1,
83 kDebugHotspot = 1 << 3,
87 kDebugPicture = 1 << 7,
88 kDebugResource = 1 << 8,
90 kDebugTools = 1 << 10,
114 char **_locationDirNotVisited;
115 char **_locationDirVisited;
116 char **_specialInfoLine;
119 bool showMainMenu(
bool &loadedGame);
121 bool showQuitConfirmationDialogue();
125 void unloadTextsVariants(
char **texts);
126 void unloadToonDat();
127 void setPaletteEntries(uint8 *palette, int32 offset, int32 num);
128 void fixPaletteEntries(uint8 *palette,
int num);
129 void flushPalette(
bool deferFlushToNextRender =
true);
133 void setFont(
bool alternative);
134 void loadScene(int32 SceneId,
bool forGameLoad =
false);
137 void setCursor(int32 type,
bool inventory =
false, int32 offsetX = 0,
int offsetY = 0);
138 void loadAdditionalPalette(
const Common::Path &fileName, int32 mode);
139 void setupGeneralPalette();
141 void update(int32 timeIncrement);
143 void updateAnimationSceneScripts(int32 timeElapsed);
144 void updateCharacters(int32 timeElapsed);
145 void setSceneAnimationScriptUpdate(
bool enable);
146 bool isUpdatingSceneAnimation();
147 int32 getCurrentUpdatingSceneAnimation();
148 int32 randRange(int32 minStart, int32 maxStart);
149 void selectHotspot();
151 int32 runEventScript(int32 x, int32 y, int32 mode, int32
id, int32 scriptId);
154 void drawConversationLine();
155 const char *getLocationString(int32 locationId,
bool alreadyVisited);
156 int32 getScaleAtPoint(int32 x, int32 y);
157 int32 getZAtPoint(int32 x, int32 y);
158 int32 getLayerAtPoint(int32 x, int32 y);
159 int32 characterTalk(int32 dialogid,
bool blocking =
true);
160 int32 simpleCharacterTalk(int32 dialogid);
161 void sayLines(
int numLines,
int dialogId);
162 void haveAConversation(int32 convId);
163 void processConversationClick(
Conversation *conv, int32 status);
164 int32 runConversationCommand(int16 **command);
165 void prepareConversations();
166 void drawConversationIcons();
167 void simpleUpdate(
bool waitCharacterToTalk =
false);
168 int32 waitTicks(int32 numTicks,
bool breakOnMouseClick);
169 void copyToVirtualScreen(
bool updateScreen =
true);
170 void getMouseEvent();
171 int32 showInventory();
173 void addItemToInventory(int32 item);
174 void deleteItemFromInventory(int32 item);
175 void replaceItemFromInventory(int32 item, int32 destItem);
176 void rearrangeInventory();
177 void createMouseItem(int32 item);
178 void deleteMouseItem();
183 void playSoundWrong();
184 void playSFX(int32
id, int32 volume);
185 void storeRifFlags(int32 location);
186 void restoreRifFlags(int32 location);
187 void getTextPosition(int32 characterId, int32 *retX, int32 *retY);
188 int32 getConversationFlag(int32 locationId, int32 param);
189 int32 getSpecialInventoryItem(int32 item);
190 Character *getCharacterById(int32 charId);
192 bool loadGame(int32 slot);
194 void fadeIn(int32 numFrames);
195 void fadeOut(int32 numFrames);
196 void initCharacter(int32 characterId, int32 animScriptId, int32 animToPlayId, int32 sceneAnimationId);
197 int32 handleInventoryOnFlux(int32 itemId);
198 int32 handleInventoryOnInventory(int32 itemDest, int32 itemSrc);
199 int32 handleInventoryOnDrew(int32 itemId);
200 int32 pauseSceneAnimationScript(int32 animScriptId, int32 tickToWait);
201 void updateTimer(int32 timeIncrement);
203 void createShadowLUT();
204 void playTalkAnimOnCharacter(int32 animID, int32 characterId,
bool talker);
205 void updateScrolling(
bool force, int32 timeIncrement);
206 void enableTimer(int32 timerId);
207 void setTimer(int32 timerId, int32 timerWait);
208 void disableTimer(int32 timerId);
210 void makeLineNonWalkable(int32 x, int32 y, int32 x2, int32 y2);
211 void makeLineWalkable(int32 x, int32 y, int32 x2, int32 y2);
212 void renderInventory();
213 void viewInventoryItem(
const Common::Path &str, int32 lineId, int32 itemDest);
215 void restorePalette();
216 const char *getSpecialConversationMusic(int32 locationId);
217 void playRoomMusic();
218 void waitForScriptStep();
219 void doMagnifierEffect();
220 void drawCustomText(int16 x, int16 y,
const char *line,
Graphics::Surface *frame, byte color);
221 bool showConversationText()
const;
224 void pauseEngineIntern(
bool pause)
override;
225 void syncSoundSettings()
override;
236 return *_mainSurface;
244 return _currentPicture;
248 return _animationManager;
251 Movie *getMoviePlayer() {
256 return &_sceneAnimations[id];
260 return &_sceneAnimationScripts[id];
272 return _characters[charId];
275 uint8 *getShadowLUT() {
279 int32 getCurrentLineToSay() {
280 return _currentTextLineId;
283 int32 getCurrentCharacterTalking() {
284 return _currentTextLineCharacterId;
295 int32 getTickLength() {
299 int32 getOldMilli() {
304 return _audioManager;
307 int32 getScriptRegionNested() {
308 return _currentScriptRegion;
323 bool isEnglishDemo() {
324 return _isEnglishDemo;
329 bool shouldQuitGame()
const {
343 (f == kSupportsSubtitleOptions) ||
344 (f == kSupportsReturnToLauncher) ||
345 (f == kSupportsLoadingDuringRuntime) ||
346 (f == kSupportsSavingDuringRuntime);
349 void dirtyAllScreen();
350 void addDirtyRect(int32 left, int32 top, int32 right, int32 bottom);
351 void clearDirtyRects();
359 uint8 *_finalPalette;
360 uint8 *_backupPalette;
361 uint8 *_additionalPalette1;
362 uint8 *_additionalPalette2;
363 bool _additionalPalette2Present;
364 uint8 *_cutawayPalette;
365 uint8 *_universalPalette;
367 uint8 *_roomScaleData;
379 int32 _currentScriptRegion;
385 int32 _lastProcessedSceneScript;
386 bool _animationSceneScriptRunFlag;
387 bool _updatingSceneScriptRunFlag;
401 int32 _cursorOffsetX;
402 int32 _cursorOffsetY;
404 char *_currentTextLine;
405 int32 _currentTextLineId;
406 int32 _currentTextLineX;
407 int32 _currentTextLineY;
408 int32 _currentTextLineCharacterId;
410 int32 _oldScrollValue;
419 int32 _currentHotspotItem;
427 int32 _lastMouseButton;
431 int32 _lastRenderTime;
447 int16 *_conversationData;
452 bool _showConversationText;
454 bool _useAlternativeFont;
455 bool _needPaletteFlush;
Failed to read a file (permission denied?).
Definition: error.h:62
EngineFeature
Definition: engine.h:250
Definition: conversation.h:37
Definition: advancedDetector.h:120
No error occurred.
Definition: error.h:48
Definition: memstream.h:194
Definition: script_func.h:41
Common::Error loadGameState(int slot) override
Definition: toon.h:337
bool hasFeature(EngineFeature f) const override
Definition: toon.h:341
Definition: resource.h:80
Definition: algorithm.h:29
Definition: character.h:58
Failure to write data - disk full?
Definition: error.h:63
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
Definition: toon.h:333
Language
Definition: language.h:45