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;
162 int32 _editorResolutionWidth;
163 int32 _editorResolutionHeight;
166 char *_loadImageName;
167 char *_saveImageName;
173 bool _hasDrawnSaveLoadImage;
175 bool displayIndicator();
176 #ifdef ENABLE_FOXTAIL 177 bool displayIndicatorFoxTail();
179 uint32 _thumbnailWidth;
180 uint32 _thumbnailHeight;
182 bool _reportTextureFormat;
184 void setEngineLogCallback(ENGINE_LOG_CALLBACK callback =
nullptr,
void *data =
nullptr);
185 ENGINE_LOG_CALLBACK _engineLogCallback;
186 void *_engineLogCallbackData;
189 void getOffset(
int *offsetX,
int *offsetY)
const;
190 void setOffset(int32 offsetX, int32 offsetY);
194 float _offsetPercentX;
195 float _offsetPercentY;
199 uint32 _currentTime{};
203 bool initConfManSettings();
212 void LOG(
bool res,
const char *fmt, ...);
219 #if EXTENDED_DEBUGGER_ENABLED 231 void debugEnable(
const char *filename =
nullptr);
235 virtual bool loadFile(
const char *filename);
236 virtual bool loadBuffer(
char *buffer,
bool complete =
true);
242 bool _mouseRightDown;
243 bool _mouseMidlleDown;
246 int _settingsResWidth;
247 int _settingsResHeight;
248 bool _settingsRequireAcceleration;
249 bool _settingsAllowWindowed;
250 bool _settingsAllowAdvanced;
251 bool _settingsAllowAccessTab;
252 bool _settingsAllowAboutTab;
253 bool _settingsRequireSound;
254 bool _settingsAllowDesktopRes;
255 int32 _settingsTLMode;
256 char *_settingsGameFile;
258 bool _suppressScriptErrors;
260 bool invalidateDeviceObjects()
override;
261 bool restoreDeviceObjects()
override;
266 ScValue *scGetProperty(
const char *name)
override;
267 bool scSetProperty(
const char *name,
ScValue *value)
override;
269 const char *scToString()
override;
272 bool _compatKillMethodThreads;
278 uint32 _framesRendered;
281 uint32 _surfaceGCCycleTime;
283 bool _videoSubtitles;
285 uint32 _musicStartTime[NUM_MUSIC_CHANNELS];
286 bool _compressedSavegames;
287 int32 _scheduledLoadSlot;
289 bool _personalizedSave;
290 static bool emptySaveSlot(
int slot);
291 static bool isSaveSlotUsed(
int slot);
292 static bool getSaveSlotDescription(
int slot,
Common::String &desc);
293 static void getSaveSlotTimestamp(
int slot,
TimeDate *time);
295 void setWindowTitle();
296 bool handleMouseWheel(int32 delta)
override;
298 virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor);
299 bool handleKeypress(
Common::Event *event,
bool printable =
false)
override;
302 virtual bool handleCustomActionStart(BaseGameCustomAction action);
303 virtual bool handleCustomActionEnd(BaseGameCustomAction action);
306 bool freeze(
bool includingMusic =
true);
310 bool _loadInProgress;
312 bool _editorForceScripts;
313 static void afterLoadRegion(
void *region,
void *data);
314 static void afterLoadSubFrame(
void *subframe,
void *data);
315 static void afterLoadSound(
void *sound,
void *data);
316 static void afterLoadFont(
void *font,
void *data);
318 static void afterLoadXModel(
void *model,
void *data);
320 static void afterLoadScript(
void *script,
void *data);
321 static void afterLoadScene(
void *scene,
void *data);
322 static void invalidateValues(
void *value,
void *data);
323 bool loadSettings(
const char *filename);
324 bool resumeMusic(
int channel);
325 bool setMusicStartTime(
int channel, uint32 time);
326 bool pauseMusic(
int channel);
327 bool stopMusic(
int channel);
328 bool playMusic(
int channel,
const char *filename,
bool looping =
true, uint32 loopStart = 0, uint32 privVolume = 100);
330 bool _musicCrossfadeRunning;
331 bool _musicCrossfadeSwap;
332 uint32 _musicCrossfadeStartTime;
333 uint32 _musicCrossfadeLength;
334 int32 _musicCrossfadeChannel1;
335 int32 _musicCrossfadeChannel2;
336 int32 _musicCrossfadeVolume1;
337 int32 _musicCrossfadeVolume2;
338 bool displayWindows(
bool inGame =
false);
341 virtual bool cleanup();
342 bool loadGame(uint32 slot);
343 bool loadGame(
const char *filename);
344 bool saveGame(int32 slot,
const char *desc,
bool quickSave =
false);
345 bool showCursor()
override;
351 TGameState _origState;
352 bool _origInteractive;
358 uint32 _liveTimerDelta;
359 uint32 _liveTimerLast;
366 void quickMessage(
const char *text);
367 void quickMessageForm(
char *fmt, ...);
368 bool displayQuickMsg();
370 bool updateMusicCrossfade();
372 bool isVideoPlaying();
378 bool _accessTTSEnabled;
380 bool _accessTTSCaptions;
381 bool _accessTTSKeypress;
382 bool _accessKeyboardEnabled;
383 bool _accessKeyboardCursorSkip;
384 bool _accessKeyboardPause;
386 bool _accessGlobalPaused;
390 bool accessUnpause();
393 virtual bool displayContent(
bool update =
true,
bool displayAll =
false);
394 virtual bool displayContentSimple();
395 bool _forceNonStreamedSounds;
396 void resetMousePos();
397 int32 _subtitlesSpeed;
398 void setInteractive(
bool state);
399 virtual bool windowLoadHook(
UIWindow *win,
char **buf,
char **params);
401 bool getCurrentViewportOffset(
int *offsetX =
nullptr,
int *offsetY =
nullptr);
402 bool getCurrentViewportRect(
Common::Rect32 *rect,
bool *custom =
nullptr);
410 virtual bool initAfterLoad();
415 bool getSaveDir(
char *
Buffer);
420 BaseGameMusic *_musicSystem;
423 void setIndicatorVal(
int value);
424 bool getBilinearFiltering() {
return _bilinearFiltering; }
425 void addMem(int32 bytes);
427 bool _touchInterface;
428 bool _bilinearFiltering{};
430 bool _force2dRenderer{};
447 bool isDoubleClick(int32 buttonIndex);
452 bool _autoSaveOnExit;
453 uint32 _autoSaveSlot;
457 void autoSaveOnExit();
458 PluginEvent &pluginEvents() {
return _pluginEvents; }
462 #ifdef ENABLE_HEROCRAFT 467 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:435
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