28 #ifndef WINTERMUTE_BASE_GAME_H 29 #define WINTERMUTE_BASE_GAME_H 31 #include "engines/wintermute/base/base_object.h" 32 #include "engines/wintermute/base/base_game_custom_actions.h" 33 #include "engines/wintermute/base/base_string_table.h" 34 #include "engines/wintermute/ext/plugin_event.h" 35 #include "engines/wintermute/persistent.h" 36 #include "engines/wintermute/coll_templ.h" 37 #include "engines/wintermute/debugger.h" 38 #if EXTENDED_DEBUGGER_ENABLED 39 #include "engines/wintermute/base/scriptables/debuggable/debuggable_script_engine.h" 42 #include "common/events.h" 43 #include "common/random.h" 47 typedef void (*ENGINE_LOG_CALLBACK)(
char *text,
bool result,
void *data);
52 class BaseFileManager;
53 class BaseTransitionMgr;
54 class BaseFontStorage;
60 class BaseSurfaceStorage;
61 class BaseKeyboardState;
62 class BaseGameSettings;
69 class VideoTheoraPlayer;
70 class SaveThumbHelper;
77 #define NUM_MUSIC_CHANNELS 5 85 virtual bool onScriptShutdown(
ScScript *script);
87 virtual bool getLayerSize(
int *LayerWidth,
int *LayerHeight,
Common::Rect32 *viewport,
bool *customViewport);
89 virtual uint32 getAmbientLightColor();
90 virtual bool getFogParams(
bool *fogEnabled, uint32 *fogColor,
float *start,
float *end);
95 virtual bool onActivate(
bool activate,
bool refreshMouse);
96 virtual bool onMouseLeftDown();
97 virtual bool onMouseLeftUp();
98 virtual bool onMouseLeftDblClick();
99 virtual bool onMouseRightDblClick();
100 virtual bool onMouseRightDown();
101 virtual bool onMouseRightUp();
102 virtual bool onMouseMiddleDown();
103 virtual bool onMouseMiddleUp();
104 virtual bool onPaint();
105 virtual bool onWindowClose();
107 bool isLeftDoubleClick();
108 bool isRightDoubleClick();
110 bool _autorunDisabled;
111 uint32 _lastMiniUpdate;
112 bool _miniUpdateEnabled;
113 virtual bool miniUpdate();
120 virtual bool displayDebugInfo();
123 bool _suspendedRendering;
124 int32 _soundBufferSizeSec;
125 virtual bool renderShadowGeometry();
127 TTextEncoding _textEncoding;
133 int32 _loadingIconPersistent;
135 virtual bool resetContent();
137 void DEBUG_DumpClassRegistry();
138 bool setWaitCursor(
const char *filename);
141 bool _saveDirChecked;
144 bool _supportsRealTimeShadows;
145 TShadowType _maxShadowType;
146 bool setMaxShadowType(TShadowType maxShadowType);
147 virtual TShadowType getMaxShadowType(
BaseObject *
object =
nullptr);
150 bool _indicatorDisplay;
151 uint32 _indicatorColor;
152 int32 _indicatorProgress;
155 int32 _indicatorWidth;
156 int32 _indicatorHeight;
158 bool _richSavedGames;
161 int32 _editorResolutionWidth;
162 int32 _editorResolutionHeight;
164 char *_loadImageName;
165 char *_saveImageName;
171 bool _hasDrawnSaveLoadImage;
173 bool displayIndicator();
174 #ifdef ENABLE_FOXTAIL 175 bool displayIndicatorFoxTail();
177 uint32 _thumbnailWidth;
178 uint32 _thumbnailHeight;
180 bool _reportTextureFormat;
182 void setEngineLogCallback(ENGINE_LOG_CALLBACK callback =
nullptr,
void *data =
nullptr);
183 ENGINE_LOG_CALLBACK _engineLogCallback;
184 void *_engineLogCallbackData;
187 void getOffset(
int *offsetX,
int *offsetY)
const;
188 void setOffset(int32 offsetX, int32 offsetY);
192 float _offsetPercentX;
193 float _offsetPercentY;
197 uint32 _currentTime{};
201 bool initConfManSettings();
210 void LOG(
bool res,
const char *fmt, ...);
217 #if EXTENDED_DEBUGGER_ENABLED 229 void debugEnable(
const char *filename =
nullptr);
233 virtual bool loadFile(
const char *filename);
234 virtual bool loadBuffer(
char *buffer,
bool complete =
true);
240 bool _mouseRightDown;
241 bool _mouseMidlleDown;
244 int _settingsResWidth;
245 int _settingsResHeight;
246 bool _settingsRequireAcceleration;
247 bool _settingsAllowWindowed;
248 bool _settingsAllowAdvanced;
249 bool _settingsAllowAccessTab;
250 bool _settingsAllowAboutTab;
251 bool _settingsRequireSound;
252 bool _settingsAllowDesktopRes;
253 int32 _settingsTLMode;
254 char *_settingsGameFile;
256 bool _suppressScriptErrors;
258 bool invalidateDeviceObjects()
override;
259 bool restoreDeviceObjects()
override;
264 ScValue *scGetProperty(
const char *name)
override;
265 bool scSetProperty(
const char *name,
ScValue *value)
override;
267 const char *scToString()
override;
270 bool _compatKillMethodThreads;
276 uint32 _framesRendered;
279 uint32 _surfaceGCCycleTime;
281 bool _videoSubtitles;
283 uint32 _musicStartTime[NUM_MUSIC_CHANNELS];
284 bool _compressedSavegames;
285 int32 _scheduledLoadSlot;
287 bool _personalizedSave;
288 static bool emptySaveSlot(
int slot);
289 static bool isSaveSlotUsed(
int slot);
290 static bool getSaveSlotDescription(
int slot,
Common::String &desc);
291 static void getSaveSlotTimestamp(
int slot,
TimeDate *time);
293 void setWindowTitle();
294 bool handleMouseWheel(int32 delta)
override;
296 virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor);
297 bool handleKeypress(
Common::Event *event,
bool printable =
false)
override;
300 virtual bool handleCustomActionStart(BaseGameCustomAction action);
301 virtual bool handleCustomActionEnd(BaseGameCustomAction action);
304 bool freeze(
bool includingMusic =
true);
308 bool _loadInProgress;
310 bool _editorForceScripts;
311 static void afterLoadRegion(
void *region,
void *data);
312 static void afterLoadSubFrame(
void *subframe,
void *data);
313 static void afterLoadSound(
void *sound,
void *data);
314 static void afterLoadFont(
void *font,
void *data);
316 static void afterLoadXModel(
void *model,
void *data);
318 static void afterLoadScript(
void *script,
void *data);
319 static void afterLoadScene(
void *scene,
void *data);
320 static void invalidateValues(
void *value,
void *data);
321 bool loadSettings(
const char *filename);
322 bool resumeMusic(
int channel);
323 bool setMusicStartTime(
int channel, uint32 time);
324 bool pauseMusic(
int channel);
325 bool stopMusic(
int channel);
326 bool playMusic(
int channel,
const char *filename,
bool looping =
true, uint32 loopStart = 0, uint32 privVolume = 100);
328 bool _musicCrossfadeRunning;
329 bool _musicCrossfadeSwap;
330 uint32 _musicCrossfadeStartTime;
331 uint32 _musicCrossfadeLength;
332 int32 _musicCrossfadeChannel1;
333 int32 _musicCrossfadeChannel2;
334 int32 _musicCrossfadeVolume1;
335 int32 _musicCrossfadeVolume2;
336 bool displayWindows(
bool inGame =
false);
339 virtual bool cleanup();
340 bool loadGame(uint32 slot);
341 bool loadGame(
const char *filename);
342 bool saveGame(int32 slot,
const char *desc,
bool quickSave =
false);
343 bool showCursor()
override;
349 TGameState _origState;
350 bool _origInteractive;
356 uint32 _liveTimerDelta;
357 uint32 _liveTimerLast;
364 void quickMessage(
const char *text);
365 void quickMessageForm(
char *fmt, ...);
366 bool displayQuickMsg();
368 bool updateMusicCrossfade();
370 bool isVideoPlaying();
376 bool _accessTTSEnabled;
378 bool _accessTTSCaptions;
379 bool _accessTTSKeypress;
380 bool _accessKeyboardEnabled;
381 bool _accessKeyboardCursorSkip;
382 bool _accessKeyboardPause;
384 bool _accessGlobalPaused;
388 bool accessUnpause();
391 virtual bool displayContent(
bool update =
true,
bool displayAll =
false);
392 virtual bool displayContentSimple();
393 bool _forceNonStreamedSounds;
394 void resetMousePos();
395 int32 _subtitlesSpeed;
396 void setInteractive(
bool state);
397 virtual bool windowLoadHook(
UIWindow *win,
char **buf,
char **params);
399 bool getCurrentViewportOffset(
int *offsetX =
nullptr,
int *offsetY =
nullptr);
400 bool getCurrentViewportRect(
Common::Rect32 *rect,
bool *custom =
nullptr);
408 virtual bool initAfterLoad();
413 bool getSaveDir(
char *
Buffer);
418 BaseGameMusic *_musicSystem;
421 void setIndicatorVal(
int value);
422 bool getBilinearFiltering() {
return _bilinearFiltering; }
423 void addMem(int32 bytes);
425 bool _touchInterface;
426 bool _bilinearFiltering{};
428 bool _force2dRenderer{};
445 bool isDoubleClick(int32 buttonIndex);
450 bool _autoSaveOnExit;
451 uint32 _autoSaveSlot;
455 void autoSaveOnExit();
456 PluginEvent &pluginEvents() {
return _pluginEvents; }
460 #ifdef ENABLE_HEROCRAFT 465 uint8 getFilePartChecksumHc(
const char *filename, uint32 begin, uint32 end);
Definition: save_thumb_helper.h:35
Definition: base_game.h:79
Definition: script_value.h:42
Definition: base_font_storage.h:40
Definition: base_keyboard_state.h:44
Definition: base_game.h:433
Definition: base_file_manager.h:39
Definition: video_theora_player.h:41
Definition: base_scriptable.h:41
Definition: base_transition_manager.h:35
Definition: script_stack.h:41
Definition: base_surface.h:37
Definition: base_access_mgr.h:41
Definition: video_player.h:45
Definition: plugin_event.h:48
Definition: base_renderer3d.h:60
Definition: base_fader.h:36
Definition: debuggable_script_engine.h:93
Definition: coll_templ.h:347
Definition: base_font.h:37
Definition: base_sound.h:39
Definition: display_client.h:113
Definition: base_renderer.h:53
Definition: base_viewport.h:37
Definition: ui_window.h:39
Definition: base_surface_storage.h:36
Definition: base_sprite.h:40
Definition: base_string_table.h:39
Definition: base_sound_manager.h:38
Definition: script_engine.h:43
Definition: base_object.h:49
Definition: achievements_tables.h:27