From 45c5eb5cab069ea9ca4302a637f4621d460c790d Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Wed, 25 Jul 2012 05:08:13 +0200 Subject: WINTERMUTE: Privatize/Protect variables that don't need to be public. --- engines/wintermute/ad/ad_game.h | 60 +++--- engines/wintermute/ad/ad_node_state.cpp | 2 +- engines/wintermute/base/base.h | 4 +- engines/wintermute/base/base_fader.h | 1 + engines/wintermute/base/base_game.cpp | 9 +- engines/wintermute/base/base_game.h | 227 +++++++++++---------- engines/wintermute/base/base_object.h | 67 +++--- .../wintermute/base/base_persistence_manager.cpp | 2 +- engines/wintermute/base/base_persistence_manager.h | 2 +- engines/wintermute/base/base_save_thumb_helper.h | 1 + engines/wintermute/base/base_string_table.cpp | 12 +- engines/wintermute/base/base_string_table.h | 4 +- .../wintermute/base/file/base_save_thumb_file.cpp | 6 +- engines/wintermute/base/font/base_font_bitmap.h | 3 +- engines/wintermute/base/gfx/base_renderer.h | 18 +- engines/wintermute/base/gfx/base_surface.h | 12 +- engines/wintermute/base/particles/part_emitter.h | 85 ++++---- engines/wintermute/base/scriptables/script.h | 18 +- .../wintermute/base/scriptables/script_ext_array.h | 1 + .../wintermute/base/scriptables/script_ext_date.h | 2 +- .../base/scriptables/script_ext_mem_buffer.h | 3 +- .../base/scriptables/script_ext_object.h | 1 - engines/wintermute/base/scriptables/script_value.h | 2 +- engines/wintermute/base/sound/base_sound_buffer.h | 7 +- engines/wintermute/wintermute.cpp | 2 +- 25 files changed, 279 insertions(+), 272 deletions(-) diff --git a/engines/wintermute/ad/ad_game.h b/engines/wintermute/ad/ad_game.h index b52fd2832f..5136ed09d3 100644 --- a/engines/wintermute/ad/ad_game.h +++ b/engines/wintermute/ad/ad_game.h @@ -54,13 +54,9 @@ public: virtual bool displayDebugInfo(); - virtual bool initAfterLoad(); static void afterLoadScene(void *scene, void *data); - bool _smartItemCursor; - - BaseArray _speechDirs; bool addSpeechDir(const char *dir); bool removeSpeechDir(const char *dir); char *findSpeechFile(char *StringID); @@ -71,18 +67,13 @@ public: virtual bool resetContent(); bool addItem(AdItem *item); AdItem *getItemByName(const char *name); - BaseArray _items; + AdObject *_inventoryOwner; bool isItemTaken(char *itemName); bool registerInventory(AdInventory *inv); bool unregisterInventory(AdInventory *inv); - - AdObject *_invObject; - BaseArray _inventories; virtual bool displayContent(bool update = true, bool displayAll = false); - char *_debugStartupScene; - char *_startupScene; - bool _initialScene; + bool gameResponseUsed(int ID); bool addGameResponse(int ID); bool resetResponse(int ID); @@ -97,6 +88,7 @@ public: AdSceneState *getSceneState(const char *filename, bool saving); BaseViewport *_sceneViewport; + int _texItemLifeTime; int _texWalkLifeTime; int _texStandLifeTime; @@ -106,12 +98,9 @@ public: virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor); bool scheduleChangeScene(const char *filename, bool fadeIn); - char *_scheduledScene; - bool _scheduledFadeIn; void setPrevSceneName(const char *name); void setPrevSceneFilename(const char *name); - char *_prevSceneName; - char *_prevSceneFilename; + virtual bool loadGame(const char *filename); AdItem *_selectedItem; bool cleanup(); @@ -119,9 +108,9 @@ public: void finishSentences(); bool showCursor(); + TGameStateEx _stateEx; - AdResponseBox *_responseBox; - AdInventoryBox *_inventoryBox; + bool displaySentences(bool frozen); void addSentence(AdSentence *sentence); bool changeScene(const char *filename, bool fadeIn); @@ -131,14 +120,8 @@ public: bool initLoop(); AdGame(); virtual ~AdGame(); - BaseArray _objects; - BaseArray _sentences; - BaseArray _sceneStates; - BaseArray _dlgPendingBranches; - - BaseArray _responsesBranch; - BaseArray _responsesGame; + BaseArray _objects; virtual bool loadFile(const char *filename); virtual bool loadBuffer(byte *buffer, bool complete = true); @@ -146,14 +129,37 @@ public: bool loadItemsFile(const char *filename, bool merge = false); bool loadItemsBuffer(byte *buffer, bool merge = false); - - virtual bool ExternalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name); - // scripting interface virtual ScValue *scGetProperty(const char *name); virtual bool scSetProperty(const char *name, ScValue *value); virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); bool validMouse(); +private: + virtual bool ExternalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name); + + AdObject *_invObject; + BaseArray _inventories; + char *_scheduledScene; + bool _scheduledFadeIn; + char *_prevSceneName; + char *_prevSceneFilename; + char *_debugStartupScene; + char *_startupScene; + bool _initialScene; + bool _smartItemCursor; + BaseArray _speechDirs; + BaseArray _items; + + BaseArray _sentences; + + BaseArray _sceneStates; + BaseArray _dlgPendingBranches; + + BaseArray _responsesBranch; + BaseArray _responsesGame; + + AdResponseBox *_responseBox; + AdInventoryBox *_inventoryBox; }; } // end of namespace WinterMute diff --git a/engines/wintermute/ad/ad_node_state.cpp b/engines/wintermute/ad/ad_node_state.cpp index f8196e96b7..6212274d03 100644 --- a/engines/wintermute/ad/ad_node_state.cpp +++ b/engines/wintermute/ad/ad_node_state.cpp @@ -131,7 +131,7 @@ char *AdNodeState::getCaption(int caseVal) { bool AdNodeState::transferEntity(AdEntity *entity, bool includingSprites, bool saving) { if (!entity) return STATUS_FAILED; - // hack! + // HACK! if (this->_gameRef != entity->_gameRef) this->_gameRef = entity->_gameRef; if (saving) { diff --git a/engines/wintermute/base/base.h b/engines/wintermute/base/base.h index 0265ce97d5..8c6aad12e6 100644 --- a/engines/wintermute/base/base.h +++ b/engines/wintermute/base/base.h @@ -49,10 +49,10 @@ public: bool parseEditorProperty(byte *buffer, bool complete = true); virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent = 0); BaseClass(); - BaseGame *_gameRef; BaseClass(BaseGame *GameOwner); virtual ~BaseClass(); - + BaseGame *_gameRef; +protected: Common::HashMap _editorProps; Common::HashMap::iterator _editorPropsIter; /* std::map _editorProps; diff --git a/engines/wintermute/base/base_fader.h b/engines/wintermute/base/base_fader.h index 36dd8a1d53..4401bd0ebd 100644 --- a/engines/wintermute/base/base_fader.h +++ b/engines/wintermute/base/base_fader.h @@ -46,6 +46,7 @@ public: DECLARE_PERSISTENT(BaseFader, BaseObject) BaseFader(BaseGame *inGame); virtual ~BaseFader(); +private: bool _active; byte _red; byte _green; diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 301f79691d..fcf45f18f2 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -104,7 +104,6 @@ BaseGame::BaseGame(): BaseObject(this) { _debugLogFile = NULL; _debugDebugMode = false; - _debugAbsolutePathWarning = true; _debugShowFPS = false; _systemFont = NULL; @@ -180,7 +179,7 @@ BaseGame::BaseGame(): BaseObject(this) { _compressedSavegames = true; _editorMode = false; - _doNotExpandStrings = false; + //_doNotExpandStrings = false; _engineLogCallback = NULL; _engineLogCallbackData = NULL; @@ -3241,7 +3240,6 @@ bool BaseGame::loadGame(const char *filename) { _indicatorDisplay = true; _indicatorProgress = 0; BasePersistenceManager *pm = new BasePersistenceManager(_gameRef); - _debugAbsolutePathWarning = false; if (DID_FAIL(ret = pm->initLoad(filename))) goto load_finish; //if(DID_FAIL(ret = cleanup())) goto load_finish; @@ -3259,7 +3257,6 @@ bool BaseGame::loadGame(const char *filename) { getDebugMgr()->onGameInit(); load_finish: - _debugAbsolutePathWarning = true; _indicatorDisplay = false; delete pm; @@ -3555,7 +3552,6 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_activeObject)); persistMgr->transfer(TMEMBER(_capturedObject)); persistMgr->transfer(TMEMBER(_cursorNoninteractive)); - persistMgr->transfer(TMEMBER(_doNotExpandStrings)); persistMgr->transfer(TMEMBER(_editorMode)); persistMgr->transfer(TMEMBER(_fader)); persistMgr->transfer(TMEMBER(_freezeLevel)); @@ -3838,14 +3834,11 @@ bool BaseGame::getSaveSlotDescription(int slot, char *buffer) { BasePersistenceManager *pm = new BasePersistenceManager(_gameRef); if (!pm) return STATUS_FAILED; - _debugAbsolutePathWarning = false; if (DID_FAIL(pm->initLoad(filename))) { - _debugAbsolutePathWarning = true; delete pm; return STATUS_FAILED; } - _debugAbsolutePathWarning = true; strcpy(buffer, pm->_savedDescription); delete pm; diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index 4a5adb4e39..34dec89d20 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -105,54 +105,21 @@ public: TTextEncoding _textEncoding; bool _textRTL; - BaseSprite *_loadingIcon; - int _loadingIconX; - int _loadingIconY; - int _loadingIconPersistent; - virtual bool resetContent(); void DEBUG_DumpClassRegistry(); bool setWaitCursor(const char *filename); - char *_localSaveDir; - bool _saveDirChecked; - int _indicatorProgress; -protected: - bool _indicatorDisplay; - uint32 _indicatorColor; - int _indicatorX; - int _indicatorY; - int _indicatorWidth; - int _indicatorHeight; - - bool _richSavedGames; - char *_savedGameExt; - - char *_loadImageName; - char *_saveImageName; - int _saveImageX; - int _saveImageY; - int _loadImageX; - int _loadImageY; - - BaseSurface *_saveLoadImage; - bool displayIndicator(); + int _indicatorProgress; // TODO: Hide - bool _reportTextureFormat; -public: int _thumbnailWidth; int _thumbnailHeight; - void setEngineLogCallback(ENGINE_LOG_CALLBACK callback = NULL, void *data = NULL); - ENGINE_LOG_CALLBACK _engineLogCallback; - void *_engineLogCallbackData; bool _editorMode; - - bool _doNotExpandStrings; void getOffset(int *offsetX, int *offsetY); void setOffset(int offsetX, int offsetY); int getSequence(); + int _offsetY; int _offsetX; float _offsetPercentX; @@ -181,20 +148,16 @@ public: BaseSurfaceStorage *_surfaceStorage; BaseFontStorage *_fontStorage; BaseGame(); - virtual ~BaseGame(); + void DEBUG_DebugDisable(); void DEBUG_DebugEnable(const char *filename = NULL); bool _debugDebugMode; - bool _debugAbsolutePathWarning; void *_debugLogFile; int _sequence; virtual bool loadFile(const char *filename); virtual bool loadBuffer(byte *buffer, bool complete = true); - BaseArray _quickMessages; - BaseArray _windows; - BaseArray _viewportStack; int _viewportSP; @@ -203,22 +166,8 @@ public: int _settingsResHeight; char *_settingsGameFile; bool _suppressScriptErrors; - bool _mouseLeftDown; -protected: - bool _mouseRightDown; - bool _mouseMidlleDown; - bool _settingsRequireAcceleration; - bool _settingsAllowWindowed; - bool _settingsAllowAdvanced; - bool _settingsAllowAccessTab; - bool _settingsAllowAboutTab; - bool _settingsRequireSound; - bool _settingsAllowDesktopRes; - int _settingsTLMode; - BaseFader *_fader; - virtual bool invalidateDeviceObjects(); - virtual bool restoreDeviceObjects(); -public: + bool _mouseLeftDown; // TODO: Hide + virtual bool ExternalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name); // scripting interface virtual ScValue *scGetProperty(const char *name); @@ -228,68 +177,33 @@ public: // compatibility bits bool _compatKillMethodThreads; -private: - // FPS stuff - uint32 _lastTime; - uint32 _fpsTime; - uint32 _framesRendered; - Common::String _gameId; -public: const char* getGameId() { return _gameId.c_str(); } void setGameId(const Common::String& gameId) { _gameId = gameId; } uint32 _surfaceGCCycleTime; - bool _smartCache; - bool _videoSubtitles; - bool _subtitles; - uint32 _musicStartTime[NUM_MUSIC_CHANNELS]; - bool _compressedSavegames; + bool _smartCache; // RO + bool _subtitles; // RO + int _scheduledLoadSlot; bool _loading; - bool _personalizedSave; - bool emptySaveSlot(int slot); - bool isSaveSlotUsed(int slot); - bool getSaveSlotDescription(int slot, char *buffer); - bool getSaveSlotFilename(int slot, char *buffer); - void setWindowTitle(); + virtual bool handleMouseWheel(int delta); bool _quitting; virtual bool getVersion(byte *verMajor, byte *verMinor, byte *extMajor, byte *extMinor); virtual bool handleKeypress(Common::Event *event, bool printable = false); virtual void handleKeyRelease(Common::Event *event); -protected: - int _freezeLevel; -public: + bool unfreeze(); bool freeze(bool includingMusic = true); bool focusWindow(UIWindow *window); - VideoPlayer *_videoPlayer; - VideoTheoraPlayer *_theoraPlayer; bool _loadInProgress; UIWindow *_focusedWindow; bool _editorForceScripts; -protected: - static void afterLoadRegion(void *region, void *data); - static void afterLoadSubFrame(void *subframe, void *data); - static void afterLoadSound(void *sound, void *data); - static void afterLoadFont(void *font, void *data); - static void afterLoadScript(void *script, void *data); -public: + static void invalidateValues(void *value, void *data); bool loadSettings(const char *filename); - bool resumeMusic(int channel); - bool setMusicStartTime(int channel, uint32 time); - bool pauseMusic(int channel); - bool stopMusic(int channel); - bool playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0); - BaseSound *_music[NUM_MUSIC_CHANNELS]; - bool _musicCrossfadeRunning; - bool _musicCrossfadeSwap; - uint32 _musicCrossfadeStartTime; - uint32 _musicCrossfadeLength; - int _musicCrossfadeChannel1; - int _musicCrossfadeChannel2; + bool displayWindows(bool inGame = false); BaseRegistry *_registry; bool _useD3D; @@ -298,10 +212,9 @@ public: virtual bool loadGame(const char *filename); virtual bool saveGame(int slot, const char *desc, bool quickSave = false); virtual bool showCursor(); - - BaseSprite *_cursorNoninteractive; + BaseObject *_activeObject; - BaseKeyboardState *_keyboardState; + bool _interactive; TGameState _state; TGameState _origState; @@ -322,14 +235,7 @@ public: void quickMessage(const char *text); void quickMessageForm(char *fmt, ...); bool displayQuickMsg(); - uint32 _fps; - bool updateMusicCrossfade(); - - bool isVideoPlaying(); - bool stopVideo(); - BaseArray _regObjects; -public: virtual bool displayContent(bool update = true, bool displayAll = false); virtual bool displayContentSimple(); bool _forceNonStreamedSounds; @@ -350,13 +256,114 @@ public: BaseSaveThumbHelper *_cachedThumbnail; AnsiString getDataDir(); void addMem(int bytes); - bool _touchInterface; bool _constrainedMemory; - AnsiString getDeviceType() const; +protected: + BaseSprite *_loadingIcon; + int _loadingIconX; + int _loadingIconY; + int _loadingIconPersistent; + BaseFader *_fader; + + bool _indicatorDisplay; + bool displayIndicator(); + + int _freezeLevel; + VideoPlayer *_videoPlayer; + VideoTheoraPlayer *_theoraPlayer; + static void afterLoadRegion(void *region, void *data); private: + static void afterLoadSubFrame(void *subframe, void *data); + static void afterLoadSound(void *sound, void *data); + static void afterLoadFont(void *font, void *data); + static void afterLoadScript(void *script, void *data); + bool _mouseRightDown; + bool _mouseMidlleDown; + bool _settingsRequireAcceleration; + bool _settingsAllowWindowed; + bool _settingsAllowAdvanced; + bool _settingsAllowAccessTab; + bool _settingsAllowAboutTab; + bool _settingsRequireSound; + bool _settingsAllowDesktopRes; + int _settingsTLMode; + virtual bool invalidateDeviceObjects(); + virtual bool restoreDeviceObjects(); + + uint32 _indicatorColor; + int _indicatorX; + int _indicatorY; + int _indicatorWidth; + int _indicatorHeight; + + char *_localSaveDir; + bool _saveDirChecked; + bool _richSavedGames; + char *_savedGameExt; + + char *_loadImageName; + char *_saveImageName; + int _saveImageX; + int _saveImageY; + int _loadImageX; + int _loadImageY; + + BaseSurface *_saveLoadImage; + + bool _reportTextureFormat; + + // FPS stuff + uint32 _lastTime; + uint32 _fpsTime; + uint32 _framesRendered; + Common::String _gameId; + + void setEngineLogCallback(ENGINE_LOG_CALLBACK callback = NULL, void *data = NULL); + ENGINE_LOG_CALLBACK _engineLogCallback; + void *_engineLogCallbackData; + + bool _videoSubtitles; + uint32 _musicStartTime[NUM_MUSIC_CHANNELS]; + bool _compressedSavegames; + + bool _personalizedSave; + + bool emptySaveSlot(int slot); + bool isSaveSlotUsed(int slot); + bool getSaveSlotDescription(int slot, char *buffer); + bool getSaveSlotFilename(int slot, char *buffer); + void setWindowTitle(); + + bool resumeMusic(int channel); + bool setMusicStartTime(int channel, uint32 time); + bool pauseMusic(int channel); + bool stopMusic(int channel); + bool playMusic(int channel, const char *filename, bool looping = true, uint32 loopStart = 0); + BaseSound *_music[NUM_MUSIC_CHANNELS]; + bool _musicCrossfadeRunning; + bool _musicCrossfadeSwap; + uint32 _musicCrossfadeStartTime; + uint32 _musicCrossfadeLength; + int _musicCrossfadeChannel1; + int _musicCrossfadeChannel2; + + BaseSprite *_cursorNoninteractive; + BaseKeyboardState *_keyboardState; + + uint32 _fps; + bool updateMusicCrossfade(); + + bool isVideoPlaying(); + bool stopVideo(); + BaseDebugger *_debugMgr; + BaseArray _quickMessages; + BaseArray _windows; + BaseArray _viewportStack; + BaseArray _regObjects; + + AnsiString getDeviceType() const; struct LastClickInfo { LastClickInfo() { diff --git a/engines/wintermute/base/base_object.h b/engines/wintermute/base/base_object.h index c05501b145..c1e3172a77 100644 --- a/engines/wintermute/base/base_object.h +++ b/engines/wintermute/base/base_object.h @@ -44,27 +44,9 @@ class ScValue; class ScStack; class ScScript; class BaseObject : public BaseScriptHolder { -public: - TSpriteBlendMode _blendMode; - virtual bool afterMove(); - float _relativeRotate; - bool _rotateValid; - float _rotate; - void setSoundEvent(const char *eventName); - bool _rotatable; - uint32 _alphaColor; - float _scale; - float _scaleX; - float _scaleY; - float _relativeScale; - virtual bool isReady(); - virtual bool getExtendedFlag(const char *flagName); - virtual bool resetSoundPan(); - virtual bool updateSounds(); - bool updateOneSound(BaseSound *sound); +protected: bool _autoSoundPanning; uint32 _sFXStart; - int _sFXVolume; bool setSFXTime(uint32 time); bool setSFXVolume(int volume); bool resumeSFX(); @@ -72,12 +54,37 @@ public: bool stopSFX(bool deleteSound = true); bool playSFX(const char *filename, bool looping = false, bool playNow = true, const char *eventName = NULL, uint32 loopStart = 0); BaseSound *_sFX; - TSFXType _sFXType; float _sFXParam1; float _sFXParam2; float _sFXParam3; float _sFXParam4; + float _relativeRotate; + bool _rotateValid; + float _rotate; + void setSoundEvent(const char *eventName); + bool _rotatable; + float _scaleX; + float _scaleY; + float _relativeScale; + bool _editorSelected; + bool _editorAlwaysRegister; + bool _ready; + Rect32 _rect; + bool _rectSet; + int _iD; + char *_soundEvent; +public: + TSpriteBlendMode _blendMode; + virtual bool afterMove(); + float _scale; + uint32 _alphaColor; + virtual bool isReady(); + virtual bool getExtendedFlag(const char *flagName); + virtual bool resetSoundPan(); + virtual bool updateSounds(); + bool updateOneSound(BaseSound *sound); + int _sFXVolume; virtual bool handleMouseWheel(int delta); virtual bool handleMouse(TMouseEvent event, TMouseButton button); @@ -88,10 +95,10 @@ public: bool cleanup(); const char *getCaption(int caseVal = 1); void setCaption(const char *caption, int caseVal = 1); - bool _editorSelected; - bool _editorAlwaysRegister; + bool _editorOnly; bool _is3D; + DECLARE_PERSISTENT(BaseObject, BaseScriptHolder) virtual bool showCursor(); BaseSprite *_cursor; @@ -99,22 +106,18 @@ public: BaseSprite *_activeCursor; virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent); virtual bool listen(BaseScriptHolder *param1, uint32 param2); - bool _ready; - bool _registrable; + + bool _movable; bool _zoomable; bool _shadowable; - Rect32 _rect; - bool _rectSet; - int _iD; - bool _movable; - BaseObject(BaseGame *inGame); - virtual ~BaseObject(); - char *_caption[7]; - char *_soundEvent; int _posY; int _posX; + bool _registrable; + char *_caption[7]; bool _saveState; + BaseObject(BaseGame *inGame); + virtual ~BaseObject(); // base virtual bool update() { return STATUS_FAILED; diff --git a/engines/wintermute/base/base_persistence_manager.cpp b/engines/wintermute/base/base_persistence_manager.cpp index 5f8a2114c1..44d2fc00ba 100644 --- a/engines/wintermute/base/base_persistence_manager.cpp +++ b/engines/wintermute/base/base_persistence_manager.cpp @@ -309,7 +309,7 @@ bool BasePersistenceManager::readHeader(const Common::String &filename) { } ////////////////////////////////////////////////////////////////////////// -bool BasePersistenceManager::initLoad(const char *filename) { +bool BasePersistenceManager::initLoad(const Common::String &filename) { if (DID_FAIL(readHeader(filename))) { cleanup(); return STATUS_FAILED; diff --git a/engines/wintermute/base/base_persistence_manager.h b/engines/wintermute/base/base_persistence_manager.h index 78d3230c47..cdb29fde6b 100644 --- a/engines/wintermute/base/base_persistence_manager.h +++ b/engines/wintermute/base/base_persistence_manager.h @@ -62,7 +62,7 @@ public: void deleteSaveSlot(int slot); uint32 getMaxUsedSlot(); bool getSaveExists(int slot); - bool initLoad(const char *filename); + bool initLoad(const Common::String &filename); bool initSave(const char *desc); bool getBytes(byte *buffer, uint32 size); bool putBytes(byte *buffer, uint32 size); diff --git a/engines/wintermute/base/base_save_thumb_helper.h b/engines/wintermute/base/base_save_thumb_helper.h index ef2615a668..d0d0757fbf 100644 --- a/engines/wintermute/base/base_save_thumb_helper.h +++ b/engines/wintermute/base/base_save_thumb_helper.h @@ -42,6 +42,7 @@ public: bool storeThumbnail(bool doFlip = false); BaseImage *_thumbnail; +private: BaseImage *_richThumbnail; }; diff --git a/engines/wintermute/base/base_string_table.cpp b/engines/wintermute/base/base_string_table.cpp index 7ac79d4745..e528244438 100644 --- a/engines/wintermute/base/base_string_table.cpp +++ b/engines/wintermute/base/base_string_table.cpp @@ -102,9 +102,7 @@ char *BaseStringTable::getKey(const char *str) { } ////////////////////////////////////////////////////////////////////////// -void BaseStringTable::expand(char **str, bool forceExpand) { - if (_gameRef->_doNotExpandStrings && !forceExpand) return; - +void BaseStringTable::expand(char **str) { if (str == NULL || *str == NULL || *str[0] != '/') return; char *value = strchr(*str + 1, '/'); @@ -132,14 +130,12 @@ void BaseStringTable::expand(char **str, bool forceExpand) { delete [] *str; *str = new_str; - if (strlen(*str) > 0 && *str[0] == '/') expand(str, forceExpand); + if (strlen(*str) > 0 && *str[0] == '/') expand(str); } ////////////////////////////////////////////////////////////////////////// -const char *BaseStringTable::expandStatic(const char *string, bool forceExpand) { - if (_gameRef->_doNotExpandStrings && !forceExpand) return string; - +const char *BaseStringTable::expandStatic(const char *string) { if (string == NULL || string[0] == '\0' || string[0] != '/') return string; const char *value = strchr(string + 1, '/'); @@ -163,7 +159,7 @@ const char *BaseStringTable::expandStatic(const char *string, bool forceExpand) delete [] key; - if (strlen(new_str) > 0 && new_str[0] == '/') return expandStatic(new_str, forceExpand); + if (strlen(new_str) > 0 && new_str[0] == '/') return expandStatic(new_str); else return new_str; } diff --git a/engines/wintermute/base/base_string_table.h b/engines/wintermute/base/base_string_table.h index ac46aaee43..e8dee0c42d 100644 --- a/engines/wintermute/base/base_string_table.h +++ b/engines/wintermute/base/base_string_table.h @@ -37,9 +37,9 @@ namespace WinterMute { class BaseStringTable : public BaseClass { public: - const char *expandStatic(const char *string, bool forceExpand = false); + const char *expandStatic(const char *string); bool loadFile(const char *filename, bool deleteAll = true); - void expand(char **str, bool forceExpand = false); + void expand(char **str); bool addString(const char *key, const char *val, bool reportDuplicities = true); BaseStringTable(BaseGame *inGame); virtual ~BaseStringTable(); diff --git a/engines/wintermute/base/file/base_save_thumb_file.cpp b/engines/wintermute/base/file/base_save_thumb_file.cpp index a6d56f281e..899265a2fb 100644 --- a/engines/wintermute/base/file/base_save_thumb_file.cpp +++ b/engines/wintermute/base/file/base_save_thumb_file.cpp @@ -68,18 +68,14 @@ bool BaseSaveThumbFile::open(const Common::String &filename) { int slot = atoi(tempFilename); delete [] tempFilename; - char slotFilename[MAX_PATH_LENGTH + 1]; - _gameRef->getSaveSlotFilename(slot, slotFilename); BasePersistenceManager *pm = new BasePersistenceManager(_gameRef); + Common::String slotFilename = pm->getFilenameForSlot(slot); if (!pm) return STATUS_FAILED; - _gameRef->_debugAbsolutePathWarning = false; if (DID_FAIL(pm->initLoad(slotFilename))) { - _gameRef->_debugAbsolutePathWarning = true; delete pm; return STATUS_FAILED; } - _gameRef->_debugAbsolutePathWarning = true; bool res; diff --git a/engines/wintermute/base/font/base_font_bitmap.h b/engines/wintermute/base/font/base_font_bitmap.h index 8a4f5af570..79806be95f 100644 --- a/engines/wintermute/base/font/base_font_bitmap.h +++ b/engines/wintermute/base/font/base_font_bitmap.h @@ -47,7 +47,7 @@ public: BaseFontBitmap(BaseGame *inGame); virtual ~BaseFontBitmap(); - +private: bool getWidths(); BaseSprite *_sprite; int _widthsFrame; @@ -59,7 +59,6 @@ public: BaseSubFrame *_subframe; bool _wholeCell; -private: int getCharWidth(byte index); void drawChar(byte c, int x, int y); diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h index 32dced0878..84da8bd7f8 100644 --- a/engines/wintermute/base/gfx/base_renderer.h +++ b/engines/wintermute/base/gfx/base_renderer.h @@ -104,21 +104,23 @@ public: return STATUS_OK; }; bool pointInViewport(Point32 *P); - uint32 _forceAlphaColor; - uint32 _window; - uint32 _clipperWindow; bool _active; bool _ready; bool _windowed; - Rect32 _windowRect; - Rect32 _viewportRect; - Rect32 _screenRect; - Rect32 _monitorRect; int _bPP; int _height; int _width; - + uint32 _window; + uint32 _forceAlphaColor; + void addRectToList(BaseActiveRect *rect); +protected: + uint32 _clipperWindow; + + Rect32 _windowRect; + Rect32 _viewportRect; + Rect32 _screenRect; + Rect32 _monitorRect; private: Common::Array _rectList; }; diff --git a/engines/wintermute/base/gfx/base_surface.h b/engines/wintermute/base/gfx/base_surface.h index 9a72cbb236..cb98bde722 100644 --- a/engines/wintermute/base/gfx/base_surface.h +++ b/engines/wintermute/base/gfx/base_surface.h @@ -39,15 +39,9 @@ class BaseSurface: public BaseClass { public: virtual bool invalidate(); virtual bool prepareToDraw(); - bool _ckDefault; - byte _ckRed; - byte _ckGreen; - byte _ckBlue; - uint32 _lastUsedTime; bool _valid; int _lifeTime; - bool _keepLoaded; bool _pixelOpReady; BaseSurface(BaseGame *inGame); @@ -88,6 +82,12 @@ public: //void SetWidth(int Width){ _width = Width; } //void SetHeight(int Height){ _height = Height; } protected: + bool _ckDefault; + byte _ckRed; + byte _ckGreen; + byte _ckBlue; + + bool _keepLoaded; Common::String _filename; int _height; int _width; diff --git a/engines/wintermute/base/particles/part_emitter.h b/engines/wintermute/base/particles/part_emitter.h index 6575544db0..198e415cc4 100644 --- a/engines/wintermute/base/particles/part_emitter.h +++ b/engines/wintermute/base/particles/part_emitter.h @@ -43,88 +43,89 @@ public: PartEmitter(BaseGame *inGame, BaseScriptHolder *Owner); virtual ~PartEmitter(void); + int _fadeOutTime; + + bool start(); + + bool update(); + bool display() { return display(NULL); } // To avoid shadowing the inherited display-function. + bool display(BaseRegion *region); + + bool sortParticlesByZ(); + bool addSprite(const char *filename); + bool removeSprite(const char *filename); + bool setBorder(int x, int y, int width, int height); + bool setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom); + + bool addForce(const char *name, PartForce::TForceType type, int posX, int posY, float angle, float strength); + bool removeForce(const char *name); + + BaseArray _forces; + + // scripting interface + virtual ScValue *scGetProperty(const char *name); + virtual bool scSetProperty(const char *name, ScValue *value); + virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); + virtual const char *scToString(); + + +private: int _width; int _height; - + int _angle1; int _angle2; - + float _rotation1; float _rotation2; - + float _angVelocity1; float _angVelocity2; - + float _growthRate1; float _growthRate2; bool _exponentialGrowth; - + float _velocity1; float _velocity2; bool _velocityZBased; - + float _scale1; float _scale2; bool _scaleZBased; - + int _maxParticles; - + int _lifeTime1; int _lifeTime2; bool _lifeTimeZBased; - + int _genInterval; int _genAmount; - + bool _running; int _overheadTime; - + int _maxBatches; int _batchesGenerated; - + Rect32 _border; int _borderThicknessLeft; int _borderThicknessRight; int _borderThicknessTop; int _borderThicknessBottom; - + int _fadeInTime; - int _fadeOutTime; - + int _alpha1; int _alpha2; bool _alphaTimeBased; - + bool _useRegion; - + char *_emitEvent; BaseScriptHolder *_owner; - bool start(); - - bool update(); - bool display() { return display(NULL); } // To avoid shadowing the inherited display-function. - bool display(BaseRegion *region); - - bool sortParticlesByZ(); - bool addSprite(const char *filename); - bool removeSprite(const char *filename); - bool setBorder(int x, int y, int width, int height); - bool setBorderThickness(int thicknessLeft, int thicknessRight, int thicknessTop, int thicknessBottom); - - bool addForce(const char *name, PartForce::TForceType type, int posX, int posY, float angle, float strength); - bool removeForce(const char *name); - - BaseArray _forces; - - // scripting interface - virtual ScValue *scGetProperty(const char *name); - virtual bool scSetProperty(const char *name, ScValue *value); - virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); - virtual const char *scToString(); - - -private: PartForce *addForceByName(const char *name); int static compareZ(const void *obj1, const void *obj2); bool initParticle(PartParticle *particle, uint32 currentTime, uint32 timerDelta); diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h index 3bb4bc48a7..ba73e1015f 100644 --- a/engines/wintermute/base/scriptables/script.h +++ b/engines/wintermute/base/scriptables/script.h @@ -55,9 +55,10 @@ public: bool copyParameters(ScStack *stack); void afterLoad(); - +private: ScValue *_operand; ScValue *_reg1; +public: bool _freezable; bool resume(); bool pause(); @@ -145,6 +146,13 @@ public: ScScript(BaseGame *inGame, ScEngine *Engine); virtual ~ScScript(); char *_filename; + bool _thread; + bool _methodThread; + char *_threadEvent; + BaseScriptHolder *_owner; + ScScript::TExternalFunction *getExternal(char *name); + bool externalCall(ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function); +private: char **_symbols; uint32 _numSymbols; TFunctionPos *_functions; @@ -155,13 +163,7 @@ public: uint32 _numFunctions; uint32 _numMethods; uint32 _numEvents; - bool _thread; - bool _methodThread; - char *_threadEvent; - BaseScriptHolder *_owner; - ScScript::TExternalFunction *getExternal(char *name); - bool externalCall(ScStack *stack, ScStack *thisStack, ScScript::TExternalFunction *function); -private: + bool initScript(); bool initTables(); diff --git a/engines/wintermute/base/scriptables/script_ext_array.h b/engines/wintermute/base/scriptables/script_ext_array.h index 3f8d703f85..8eb86c4e69 100644 --- a/engines/wintermute/base/scriptables/script_ext_array.h +++ b/engines/wintermute/base/scriptables/script_ext_array.h @@ -45,6 +45,7 @@ public: bool scSetProperty(const char *name, ScValue *value); bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); const char *scToString(); +private: int _length; ScValue *_values; }; diff --git a/engines/wintermute/base/scriptables/script_ext_date.h b/engines/wintermute/base/scriptables/script_ext_date.h index b2df4abe94..69fe1f1ae5 100644 --- a/engines/wintermute/base/scriptables/script_ext_date.h +++ b/engines/wintermute/base/scriptables/script_ext_date.h @@ -44,9 +44,9 @@ public: bool scSetProperty(const char *name, ScValue *value); bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); const char *scToString(); +private: char *_string; TimeDate _tm; -private: Common::String _strRep; }; diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h index c325181e3f..b5428b4bd9 100644 --- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h +++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h @@ -46,8 +46,9 @@ public: SXMemBuffer(BaseGame *inGame, void *buffer); virtual ~SXMemBuffer(); virtual void *scToMemBuffer(); - int _size; private: + int _size; + bool resize(int newSize); void *_buffer; void cleanup(); diff --git a/engines/wintermute/base/scriptables/script_ext_object.h b/engines/wintermute/base/scriptables/script_ext_object.h index d744c58042..f7d3a7bc0f 100644 --- a/engines/wintermute/base/scriptables/script_ext_object.h +++ b/engines/wintermute/base/scriptables/script_ext_object.h @@ -39,7 +39,6 @@ public: DECLARE_PERSISTENT(SXObject, BaseObject) SXObject(BaseGame *inGame, ScStack *Stack); virtual ~SXObject(); - }; } // end of namespace WinterMute diff --git a/engines/wintermute/base/scriptables/script_value.h b/engines/wintermute/base/scriptables/script_value.h index 7a684d2334..069c36bd47 100644 --- a/engines/wintermute/base/scriptables/script_value.h +++ b/engines/wintermute/base/scriptables/script_value.h @@ -88,7 +88,7 @@ public: ScValue *getProp(const char *name); BaseScriptable *_valNative; ScValue *_valRef; -protected: +private: bool _valBool; int _valInt; double _valFloat; diff --git a/engines/wintermute/base/sound/base_sound_buffer.h b/engines/wintermute/base/sound/base_sound_buffer.h index 9c85a02b39..c32f83eb1e 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.h +++ b/engines/wintermute/base/sound/base_sound_buffer.h @@ -48,7 +48,6 @@ public: BaseSoundBuffer(BaseGame *inGame); virtual ~BaseSoundBuffer(); - bool pause(); bool play(bool looping = false, uint32 startSample = 0); bool resume(); @@ -86,12 +85,12 @@ public: uint32 _loopStart; Audio::Mixer::SoundType _type; bool _looping; - Common::SeekableReadStream *_file; - char *_filename; - bool _streamed; int _privateVolume; private: + char *_filename; + bool _streamed; + Common::SeekableReadStream *_file; int _volume; }; diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 7089b57216..31c4ee2fb8 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -255,7 +255,7 @@ int WinterMuteEngine::init() { _game = NULL; return false; } - _game->setWindowTitle(); + //_game->setWindowTitle(); _game->_renderer->_ready = true; _game->_miniUpdateEnabled = true; -- cgit v1.2.3