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/timer.h" 34 #include "engines/wintermute/persistent.h" 35 #include "engines/wintermute/coll_templ.h" 36 #include "engines/wintermute/math/rect32.h" 37 #include "engines/wintermute/debugger.h" 38 #include "common/events.h" 39 #include "common/random.h" 40 #if EXTENDED_DEBUGGER_ENABLED 41 #include "engines/wintermute/base/scriptables/debuggable/debuggable_script_engine.h" 46 typedef void (*ENGINE_LOG_CALLBACK)(
char *text,
bool result,
void *data);
51 class BaseFileManager;
52 class BaseTransitionMgr;
53 class BaseFontStorage;
59 class BaseSurfaceStorage;
60 class BaseKeyboardState;
61 class BaseGameSettings;
67 class VideoTheoraPlayer;
68 class SaveThumbHelper;
79 virtual bool getLayerSize(
int *LayerWidth,
int *LayerHeight,
Rect32 *viewport,
bool *customViewport);
81 virtual uint32 getAmbientLightColor();
82 virtual bool getFogParams(
bool *fogEnabled, uint32 *fogColor,
float *start,
float *end);
85 virtual bool onScriptShutdown(
ScScript *script);
87 virtual bool onActivate(
bool activate,
bool refreshMouse);
88 virtual bool onMouseLeftDown();
89 virtual bool onMouseLeftUp();
90 virtual bool onMouseLeftDblClick();
91 virtual bool onMouseRightDblClick();
92 virtual bool onMouseRightDown();
93 virtual bool onMouseRightUp();
94 virtual bool onMouseMiddleDown();
95 virtual bool onMouseMiddleUp();
96 virtual bool onPaint();
97 virtual bool onWindowClose();
99 bool isLeftDoubleClick();
100 bool isRightDoubleClick();
102 bool _autorunDisabled;
104 uint32 _lastMiniUpdate;
105 bool _miniUpdateEnabled;
107 virtual void miniUpdate();
109 void getMousePos(
Point32 *Pos);
114 virtual bool displayDebugInfo();
116 void setShowFPS(
bool enabled) { _debugShowFPS = enabled; }
117 bool getBilinearFiltering() {
return _bilinearFiltering; }
118 bool getSuspendedRendering()
const {
return _suspendedRendering; }
119 virtual bool renderShadowGeometry();
121 TTextEncoding _textEncoding;
124 virtual bool resetContent();
126 void DEBUG_DumpClassRegistry();
127 bool setWaitCursor(
const char *filename);
130 bool _supportsRealTimeShadows;
131 TShadowType _maxShadowType;
133 bool setMaxShadowType(TShadowType maxShadowType);
134 virtual TShadowType getMaxShadowType(
BaseObject *
object =
nullptr);
136 int32 _editorResolutionWidth;
137 int32 _editorResolutionHeight;
140 uint32 getSaveThumbWidth()
const {
return _thumbnailWidth; }
141 uint32 getSaveThumbHeight()
const {
return _thumbnailHeight; }
144 void getOffset(
int *offsetX,
int *offsetY)
const;
145 void setOffset(int32 offsetX, int32 offsetY);
150 float _offsetPercentX;
151 float _offsetPercentY;
153 inline BaseObject *getMainObject() {
return _mainObject; }
154 inline BaseFont *getSystemFont() {
return _systemFont; }
155 inline BaseFont *getVideoFont() {
return _videoFont; }
163 bool initConfManSettings();
165 bool loadGameSettingsFile();
172 void expandStringByStringTable(
char **str)
const;
174 char *getKeyFromStringTable(
const char *str)
const;
176 void LOG(
bool res,
const char *fmt, ...);
185 #if EXTENDED_DEBUGGER_ENABLED 197 bool _debugDebugMode;
200 virtual bool loadFile(
const char *filename);
201 virtual bool loadBuffer(
char *buffer,
bool complete =
true);
205 bool _suppressScriptErrors;
211 bool scSetProperty(
const char *name,
ScValue *value)
override;
213 const char *scToString()
override;
215 bool _compatKillMethodThreads;
217 const char* getGameTargetName()
const {
return _targetName.c_str(); }
218 void setGameTargetName(
const Common::String& targetName) { _targetName = targetName; }
219 uint32 _surfaceGCCycleTime;
223 int32 _scheduledLoadSlot;
225 bool getIsLoading()
const {
return _loading; }
227 bool handleMouseWheel(int32 delta)
override;
229 virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor)
const;
231 bool handleKeypress(
Common::Event *event,
bool printable =
false)
override;
233 virtual bool handleCustomActionStart(BaseGameCustomAction action);
234 virtual bool handleCustomActionEnd(BaseGameCustomAction action);
237 bool freeze(
bool includingMusic =
true);
239 bool _loadInProgress;
241 bool _editorForceScripts;
243 static void invalidateValues(
void *value,
void *data);
245 bool loadSettings(
const char *filename);
247 bool displayWindows(
bool inGame =
false);
249 virtual bool cleanup();
250 bool loadGame(uint32 slot);
251 bool loadGame(
const char *filename);
252 bool saveGame(int32 slot,
const char *desc,
bool quickSave =
false);
253 bool showCursor()
override;
259 TGameState _origState;
260 bool _origInteractive;
262 const Timer *getTimer()
const {
return &_timerNormal; }
263 const Timer *getLiveTimer()
const {
return &_timerLive; }
273 void quickMessage(
const char *text);
274 void quickMessageForm(
char *fmt, ...);
275 bool displayQuickMsg();
277 virtual bool displayContent(
bool update =
true,
bool displayAll =
false);
278 virtual bool displayContentSimple();
279 bool _forceNonStreamedSounds;
280 void resetMousePos();
281 int32 _subtitlesSpeed;
282 void setInteractive(
bool state);
283 virtual bool windowLoadHook(
UIWindow *win,
char **buf,
char **params);
285 bool getCurrentViewportOffset(
int *offsetX =
nullptr,
int *offsetY =
nullptr)
const;
286 bool getCurrentViewportRect(
Rect32 *rect,
bool *custom =
nullptr)
const;
292 bool storeSaveThumbnail();
293 void deleteSaveThumbnail();
296 void addMem(int32 bytes);
297 bool _touchInterface;
298 bool _constrainedMemory;
308 int32 _loadingIconPersistent;
317 bool _bilinearFiltering;
319 bool _force2dRenderer;
322 void DEBUG_DebugDisable();
323 void DEBUG_DebugEnable(
const char *filename =
nullptr);
327 bool _mouseRightDown;
328 bool _mouseMidlleDown;
332 int32 _soundBufferSizeSec;
334 bool invalidateDeviceObjects()
override;
335 bool restoreDeviceObjects()
override;
338 bool _saveDirChecked;
343 bool _reportTextureFormat;
348 uint32 _framesRendered;
351 void setEngineLogCallback(ENGINE_LOG_CALLBACK callback =
nullptr,
void *data =
nullptr);
352 ENGINE_LOG_CALLBACK _engineLogCallback;
353 void *_engineLogCallbackData;
355 bool _videoSubtitles;
357 bool _personalizedSave;
359 uint32 _thumbnailWidth;
360 uint32 _thumbnailHeight;
362 void setWindowTitle();
364 bool _suspendedRendering;
372 bool isVideoPlaying();
381 struct LastClickInfo {
392 LastClickInfo _lastClick[2];
393 bool isDoubleClick(int32 buttonIndex);
402 bool _autoSaveOnExit;
403 uint32 _autoSaveSlot;
407 void autoSaveOnExit();
409 #ifdef ENABLE_HEROCRAFT 415 uint8 getFilePartChecksumHc(
const char *filename, uint32 begin, uint32 end);
Definition: save_thumb_helper.h:35
Definition: base_game.h:75
Definition: script_value.h:42
Definition: base_font_storage.h:40
Definition: base_keyboard_state.h:44
Definition: video_theora_player.h:41
Definition: base_scriptable.h:41
Definition: base_transition_manager.h:35
Definition: script_stack.h:41
Definition: video_player.h:41
Definition: base_renderer3d.h:54
Definition: base_fader.h:36
Definition: debuggable_script_engine.h:93
Definition: coll_templ.h:63
Definition: base_font.h:37
Definition: base_game_music.h:42
Definition: base_renderer.h:53
Definition: base_viewport.h:38
Definition: ui_window.h:39
Definition: base_surface_storage.h:36
Definition: base_sprite.h:40
Definition: base_sound_manager.h:38
Definition: script_engine.h:42
Definition: base_game_settings.h:37
Definition: base_object.h:57
Definition: achievements_tables.h:27