diff options
Diffstat (limited to 'engines/wintermute/base')
57 files changed, 324 insertions, 295 deletions
diff --git a/engines/wintermute/base/base_active_rect.cpp b/engines/wintermute/base/base_active_rect.cpp index d754cf0114..4addf15be8 100644 --- a/engines/wintermute/base/base_active_rect.cpp +++ b/engines/wintermute/base/base_active_rect.cpp @@ -29,6 +29,7 @@ #include "engines/wintermute/base/base_active_rect.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_region.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/platform_osystem.h" namespace Wintermute { diff --git a/engines/wintermute/base/base_dynamic_buffer.h b/engines/wintermute/base/base_dynamic_buffer.h index b6f3e12b9c..2d1a7fbe48 100644 --- a/engines/wintermute/base/base_dynamic_buffer.h +++ b/engines/wintermute/base/base_dynamic_buffer.h @@ -29,14 +29,12 @@ #ifndef WINTERMUTE_BASE_DYNAMIC_BUFFER_H #define WINTERMUTE_BASE_DYNAMIC_BUFFER_H - #include "engines/wintermute/base/base.h" namespace Wintermute { class BaseDynamicBuffer { public: - bool _initialized; void putText(const char *fmt, ...); void putTextIndent(int indent, const char *fmt, ...); uint32 getDWORD(); @@ -48,12 +46,13 @@ public: uint32 getSize(); bool init(uint32 initSize = 0); void cleanup(); - uint32 _size; - byte *_buffer; BaseDynamicBuffer(BaseGame *inGame, uint32 initSize = 1000, uint32 growBy = 1000); virtual ~BaseDynamicBuffer(); private: + uint32 _size; + byte *_buffer; + bool _initialized; uint32 _realSize; uint32 _growBy; uint32 _initSize; diff --git a/engines/wintermute/base/base_engine.cpp b/engines/wintermute/base/base_engine.cpp index 2368f8b106..8146d14beb 100644 --- a/engines/wintermute/base/base_engine.cpp +++ b/engines/wintermute/base/base_engine.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -25,7 +25,7 @@ * http://dead-code.org/redir.php?target=wmelite * Copyright (c) 2011 Jan Nedoma */ - + #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_engine.h" @@ -71,10 +71,10 @@ void BaseEngine::LOG(bool res, const char *fmt, ...) { secs = secs % 3600; uint32 mins = secs / 60; secs = secs % 60; - + char buff[512]; va_list va; - + va_start(va, fmt); vsprintf(buff, fmt, va); va_end(va); @@ -82,7 +82,7 @@ void BaseEngine::LOG(bool res, const char *fmt, ...) { if (instance()._gameRef) { instance()._gameRef->LOG("%s", buff); } else { - debugCN(kWintermuteDebugLog, "%02d:%02d:%02d: %s\n", hours, mins, secs, buff); + debugCN(kWintermuteDebugLog, "%02d:%02d:%02d: %s\n", hours, mins, secs, buff); } } diff --git a/engines/wintermute/base/base_engine.h b/engines/wintermute/base/base_engine.h index 1cef7b33ba..1ed0e3ab01 100644 --- a/engines/wintermute/base/base_engine.h +++ b/engines/wintermute/base/base_engine.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -25,7 +25,7 @@ * http://dead-code.org/redir.php?target=wmelite * Copyright (c) 2011 Jan Nedoma */ - + #ifndef WINTERMUTE_BASE_ENGINE_H #define WINTERMUTE_BASE_ENGINE_H diff --git a/engines/wintermute/base/base_fader.cpp b/engines/wintermute/base/base_fader.cpp index 08e6f689ba..985718fcab 100644 --- a/engines/wintermute/base/base_fader.cpp +++ b/engines/wintermute/base/base_fader.cpp @@ -28,6 +28,7 @@ #include "engines/wintermute/base/base_fader.h" #include "engines/wintermute/base/base_game.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "common/util.h" namespace Wintermute { diff --git a/engines/wintermute/base/base_fader.h b/engines/wintermute/base/base_fader.h index d3ced4aacc..116c8c963d 100644 --- a/engines/wintermute/base/base_fader.h +++ b/engines/wintermute/base/base_fader.h @@ -36,7 +36,6 @@ namespace Wintermute { class BaseFader : public BaseObject { public: - bool _system; uint32 getCurrentColor(); bool fadeOut(uint32 targetColor, uint32 duration, bool system = false); bool fadeIn(uint32 sourceColor, uint32 duration, bool system = false); @@ -47,6 +46,7 @@ public: BaseFader(BaseGame *inGame); virtual ~BaseFader(); private: + bool _system; bool _active; byte _red; byte _green; diff --git a/engines/wintermute/base/base_frame.cpp b/engines/wintermute/base/base_frame.cpp index e1b29a3a5c..7c64144480 100644 --- a/engines/wintermute/base/base_frame.cpp +++ b/engines/wintermute/base/base_frame.cpp @@ -87,6 +87,12 @@ bool BaseFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float return STATUS_OK; } +void BaseFrame::stopSound() { + if (_sound) { + _sound->stop(); + } +} + ////////////////////////////////////////////////////////////////////////// bool BaseFrame::oneTimeDisplay(BaseObject *owner, bool muted) { @@ -618,7 +624,7 @@ bool BaseFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStac ////////////////////////////////////////////////////////////////////////// -ScValue *BaseFrame::scGetProperty(const char *name) { +ScValue *BaseFrame::scGetProperty(const Common::String &name) { if (!_scValue) { _scValue = new ScValue(_gameRef); } @@ -627,7 +633,7 @@ ScValue *BaseFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Type (RO) ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("frame"); return _scValue; } @@ -635,7 +641,7 @@ ScValue *BaseFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Delay ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Delay") == 0) { + else if (name == "Delay") { _scValue->setInt(_delay); return _scValue; } @@ -643,7 +649,7 @@ ScValue *BaseFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Keyframe ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Keyframe") == 0) { + else if (name == "Keyframe") { _scValue->setBool(_keyframe); return _scValue; } @@ -651,7 +657,7 @@ ScValue *BaseFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // KillSounds ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "KillSounds") == 0) { + else if (name == "KillSounds") { _scValue->setBool(_killSound); return _scValue; } @@ -659,7 +665,7 @@ ScValue *BaseFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MoveX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MoveX") == 0) { + else if (name == "MoveX") { _scValue->setInt(_moveX); return _scValue; } @@ -667,7 +673,7 @@ ScValue *BaseFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MoveY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MoveY") == 0) { + else if (name == "MoveY") { _scValue->setInt(_moveY); return _scValue; } @@ -675,7 +681,7 @@ ScValue *BaseFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumSubframes (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumSubframes") == 0) { + else if (name == "NumSubframes") { _scValue->setInt(_subframes.size()); return _scValue; } @@ -683,7 +689,7 @@ ScValue *BaseFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumEvents (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumEvents") == 0) { + else if (name == "NumEvents") { _scValue->setInt(_applyEvent.size()); return _scValue; } diff --git a/engines/wintermute/base/base_frame.h b/engines/wintermute/base/base_frame.h index ea5467b6fe..7c5d893e70 100644 --- a/engines/wintermute/base/base_frame.h +++ b/engines/wintermute/base/base_frame.h @@ -41,11 +41,10 @@ class ScStack; class BaseFrame: public BaseScriptable { public: bool _killSound; - bool _keyframe; + void stopSound(); bool oneTimeDisplay(BaseObject *owner, bool muted = false); DECLARE_PERSISTENT(BaseFrame, BaseScriptable) - BaseSound *_sound; - bool _editorExpanded; + bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); bool saveAsText(BaseDynamicBuffer *buffer, int indent); int _moveY; @@ -61,11 +60,14 @@ public: BaseArray<const char *> _applyEvent; // scripting interface - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &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: + bool _keyframe; + bool _editorExpanded; + BaseSound *_sound; }; } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index 622e85cc11..b6886b7a33 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -64,6 +64,7 @@ #include "engines/wintermute/ui/ui_window.h" #include "engines/wintermute/wintermute.h" #include "engines/wintermute/platform_osystem.h" +#include "base/version.h" #include "common/config-manager.h" #include "common/savefile.h" #include "common/textconsole.h" @@ -489,7 +490,7 @@ void BaseGame::DEBUG_DebugEnable(const char *filename) { LOG(0, "********** DEBUG LOG OPENED %02d-%02d-%02d (Release Build) *****************", hours, mins, secs); #endif - LOG(0, "%s ver %d.%d.%d%s, Compiled on " __DATE__ ", " __TIME__, DCGF_NAME, DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD, DCGF_VER_SUFFIX); + LOG(0, "%s - %s ver %d.%d.%d%s ", gScummVMFullVersion, DCGF_NAME, DCGF_VER_MAJOR, DCGF_VER_MINOR, DCGF_VER_BUILD, DCGF_VER_SUFFIX); AnsiString platform = BasePlatform::getPlatformName(); LOG(0, "Platform: %s", platform.c_str()); @@ -740,7 +741,7 @@ bool BaseGame::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE(LOCAL_SAVE_DIR) TOKEN_TABLE(COMPAT_KILL_METHOD_THREADS) TOKEN_TABLE_END - + // Declare a few variables necessary for moving data from these settings over to the renderer: // The values are the same as the defaults set in BaseRenderer. int loadImageX = 0; @@ -2241,27 +2242,27 @@ bool BaseGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack ////////////////////////////////////////////////////////////////////////// -ScValue *BaseGame::scGetProperty(const char *name) { +ScValue *BaseGame::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("game"); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Name") == 0) { + else if (name == "Name") { _scValue->setString(getName()); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Hwnd (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Hwnd") == 0) { + else if (name == "Hwnd") { _scValue->setInt((int)_renderer->_window); return _scValue; } @@ -2269,7 +2270,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // CurrentTime (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "CurrentTime") == 0) { + else if (name == "CurrentTime") { _scValue->setInt((int)_timer); return _scValue; } @@ -2277,7 +2278,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // WindowsTime (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "WindowsTime") == 0) { + else if (name == "WindowsTime") { _scValue->setInt((int)g_system->getMillis()); return _scValue; } @@ -2285,7 +2286,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // WindowedMode (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "WindowedMode") == 0) { + else if (name == "WindowedMode") { _scValue->setBool(_renderer->_windowed); return _scValue; } @@ -2293,7 +2294,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MouseX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MouseX") == 0) { + else if (name == "MouseX") { _scValue->setInt(_mousePos.x); return _scValue; } @@ -2301,7 +2302,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MouseY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MouseY") == 0) { + else if (name == "MouseY") { _scValue->setInt(_mousePos.y); return _scValue; } @@ -2309,7 +2310,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MainObject ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MainObject") == 0) { + else if (name == "MainObject") { _scValue->setNative(_mainObject, true); return _scValue; } @@ -2317,7 +2318,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ActiveObject (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ActiveObject") == 0) { + else if (name == "ActiveObject") { _scValue->setNative(_activeObject, true); return _scValue; } @@ -2325,7 +2326,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ScreenWidth (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ScreenWidth") == 0) { + else if (name == "ScreenWidth") { _scValue->setInt(_renderer->_width); return _scValue; } @@ -2333,7 +2334,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ScreenHeight (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ScreenHeight") == 0) { + else if (name == "ScreenHeight") { _scValue->setInt(_renderer->_height); return _scValue; } @@ -2341,7 +2342,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Interactive ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Interactive") == 0) { + else if (name == "Interactive") { _scValue->setBool(_interactive); return _scValue; } @@ -2349,7 +2350,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // DebugMode (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "DebugMode") == 0) { + else if (name == "DebugMode") { _scValue->setBool(_debugDebugMode); return _scValue; } @@ -2357,7 +2358,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SoundAvailable (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SoundAvailable") == 0) { + else if (name == "SoundAvailable") { _scValue->setBool(_soundMgr->_soundAvailable); return _scValue; } @@ -2365,7 +2366,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SFXVolume ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SFXVolume") == 0) { + else if (name == "SFXVolume") { _gameRef->LOG(0, "**Warning** The SFXVolume attribute is obsolete"); _scValue->setInt(_soundMgr->getVolumePercent(Audio::Mixer::kSFXSoundType)); return _scValue; @@ -2374,7 +2375,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SpeechVolume ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SpeechVolume") == 0) { + else if (name == "SpeechVolume") { _gameRef->LOG(0, "**Warning** The SpeechVolume attribute is obsolete"); _scValue->setInt(_soundMgr->getVolumePercent(Audio::Mixer::kSpeechSoundType)); return _scValue; @@ -2383,7 +2384,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MusicVolume ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MusicVolume") == 0) { + else if (name == "MusicVolume") { _gameRef->LOG(0, "**Warning** The MusicVolume attribute is obsolete"); _scValue->setInt(_soundMgr->getVolumePercent(Audio::Mixer::kMusicSoundType)); return _scValue; @@ -2392,7 +2393,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MasterVolume ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MasterVolume") == 0) { + else if (name == "MasterVolume") { _gameRef->LOG(0, "**Warning** The MasterVolume attribute is obsolete"); _scValue->setInt(_soundMgr->getMasterVolumePercent()); return _scValue; @@ -2401,7 +2402,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Keyboard (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Keyboard") == 0) { + else if (name == "Keyboard") { if (_keyboardState) { _scValue->setNative(_keyboardState, true); } else { @@ -2414,7 +2415,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Subtitles ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Subtitles") == 0) { + else if (name == "Subtitles") { _scValue->setBool(_subtitles); return _scValue; } @@ -2422,14 +2423,14 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SubtitlesSpeed ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SubtitlesSpeed") == 0) { + else if (name == "SubtitlesSpeed") { _scValue->setInt(_subtitlesSpeed); return _scValue; } ////////////////////////////////////////////////////////////////////////// // VideoSubtitles ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "VideoSubtitles") == 0) { + else if (name == "VideoSubtitles") { _scValue->setBool(_videoSubtitles); return _scValue; } @@ -2437,7 +2438,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // FPS (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "FPS") == 0) { + else if (name == "FPS") { _scValue->setInt(_fps); return _scValue; } @@ -2445,7 +2446,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AcceleratedMode / Accelerated (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AcceleratedMode") == 0 || strcmp(name, "Accelerated") == 0) { + else if (name == "AcceleratedMode" || name == "Accelerated") { _scValue->setBool(_useD3D); return _scValue; } @@ -2453,7 +2454,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // TextEncoding ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TextEncoding") == 0) { + else if (name == "TextEncoding") { _scValue->setInt(_textEncoding); return _scValue; } @@ -2461,7 +2462,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // TextRTL ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TextRTL") == 0) { + else if (name == "TextRTL") { _scValue->setBool(_textRTL); return _scValue; } @@ -2469,7 +2470,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SoundBufferSize ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SoundBufferSize") == 0) { + else if (name == "SoundBufferSize") { _scValue->setInt(_soundBufferSizeSec); return _scValue; } @@ -2477,7 +2478,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SuspendedRendering ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SuspendedRendering") == 0) { + else if (name == "SuspendedRendering") { _scValue->setBool(_suspendedRendering); return _scValue; } @@ -2485,7 +2486,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SuppressScriptErrors ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SuppressScriptErrors") == 0) { + else if (name == "SuppressScriptErrors") { _scValue->setBool(_suppressScriptErrors); return _scValue; } @@ -2494,7 +2495,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Frozen ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Frozen") == 0) { + else if (name == "Frozen") { _scValue->setBool(_state == GAME_FROZEN); return _scValue; } @@ -2502,7 +2503,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AccTTSEnabled ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AccTTSEnabled") == 0) { + else if (name == "AccTTSEnabled") { _scValue->setBool(false); return _scValue; } @@ -2510,7 +2511,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AccTTSTalk ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AccTTSTalk") == 0) { + else if (name == "AccTTSTalk") { _scValue->setBool(false); return _scValue; } @@ -2518,7 +2519,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AccTTSCaptions ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AccTTSCaptions") == 0) { + else if (name == "AccTTSCaptions") { _scValue->setBool(false); return _scValue; } @@ -2526,7 +2527,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AccTTSKeypress ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AccTTSKeypress") == 0) { + else if (name == "AccTTSKeypress") { _scValue->setBool(false); return _scValue; } @@ -2534,7 +2535,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AccKeyboardEnabled ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AccKeyboardEnabled") == 0) { + else if (name == "AccKeyboardEnabled") { _scValue->setBool(false); return _scValue; } @@ -2542,7 +2543,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AccKeyboardCursorSkip ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AccKeyboardCursorSkip") == 0) { + else if (name == "AccKeyboardCursorSkip") { _scValue->setBool(false); return _scValue; } @@ -2550,7 +2551,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AccKeyboardPause ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AccKeyboardPause") == 0) { + else if (name == "AccKeyboardPause") { _scValue->setBool(false); return _scValue; } @@ -2558,7 +2559,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AutorunDisabled ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AutorunDisabled") == 0) { + else if (name == "AutorunDisabled") { _scValue->setBool(_autorunDisabled); return _scValue; } @@ -2566,7 +2567,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SaveDirectory (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SaveDirectory") == 0) { + else if (name == "SaveDirectory") { AnsiString dataDir = "saves/"; // TODO: This is just to avoid telling the engine actual paths. _scValue->setString(dataDir.c_str()); return _scValue; @@ -2575,7 +2576,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AutoSaveOnExit ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AutoSaveOnExit") == 0) { + else if (name == "AutoSaveOnExit") { _scValue->setBool(_autoSaveOnExit); return _scValue; } @@ -2583,7 +2584,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AutoSaveSlot ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AutoSaveSlot") == 0) { + else if (name == "AutoSaveSlot") { _scValue->setInt(_autoSaveSlot); return _scValue; } @@ -2591,7 +2592,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // CursorHidden ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "CursorHidden") == 0) { + else if (name == "CursorHidden") { _scValue->setBool(_cursorHidden); return _scValue; } @@ -2599,7 +2600,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Platform (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Platform") == 0) { + else if (name == "Platform") { _scValue->setString(BasePlatform::getPlatformName().c_str()); return _scValue; } @@ -2607,7 +2608,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // DeviceType (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "DeviceType") == 0) { + else if (name == "DeviceType") { _scValue->setString(getDeviceType().c_str()); return _scValue; } @@ -2615,7 +2616,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MostRecentSaveSlot (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MostRecentSaveSlot") == 0) { + else if (name == "MostRecentSaveSlot") { if (!ConfMan.hasKey("most_recent_saveslot")) { _scValue->setInt(-1); } else { @@ -2627,7 +2628,7 @@ ScValue *BaseGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Store (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Store") == 0) { + else if (name == "Store") { _scValue->setNULL(); error("Request for a SXStore-object, which is not supported by ScummVM"); @@ -3624,7 +3625,7 @@ bool BaseGame::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_musicCrossfadeChannel1)); persistMgr->transfer(TMEMBER(_musicCrossfadeChannel2)); persistMgr->transfer(TMEMBER(_musicCrossfadeSwap)); - + _renderer->persistSaveLoadImages(persistMgr); persistMgr->transfer(TMEMBER_INT(_textEncoding)); diff --git a/engines/wintermute/base/base_game.h b/engines/wintermute/base/base_game.h index 93cbc4536b..0f764b3d03 100644 --- a/engines/wintermute/base/base_game.h +++ b/engines/wintermute/base/base_game.h @@ -29,7 +29,6 @@ #ifndef WINTERMUTE_BASE_GAME_H #define WINTERMUTE_BASE_GAME_H -#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/base_object.h" #include "engines/wintermute/persistent.h" #include "engines/wintermute/coll_templ.h" @@ -165,7 +164,7 @@ public: virtual bool externalCall(ScScript *script, ScStack *stack, ScStack *thisStack, char *name); // scripting interface - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &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(); diff --git a/engines/wintermute/base/base_keyboard_state.cpp b/engines/wintermute/base/base_keyboard_state.cpp index fd5f2b0e1d..da7baafd2d 100644 --- a/engines/wintermute/base/base_keyboard_state.cpp +++ b/engines/wintermute/base/base_keyboard_state.cpp @@ -103,13 +103,13 @@ bool BaseKeyboardState::scCallMethod(ScScript *script, ScStack *stack, ScStack * ////////////////////////////////////////////////////////////////////////// -ScValue *BaseKeyboardState::scGetProperty(const char *name) { +ScValue *BaseKeyboardState::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("keyboard"); return _scValue; } @@ -117,7 +117,7 @@ ScValue *BaseKeyboardState::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Key ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Key") == 0) { + else if (name == "Key") { if (_currentPrintable) { char key[2]; key[0] = (char)_currentCharCode; @@ -133,7 +133,7 @@ ScValue *BaseKeyboardState::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Printable ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Printable") == 0) { + else if (name == "Printable") { _scValue->setBool(_currentPrintable); return _scValue; } @@ -141,7 +141,7 @@ ScValue *BaseKeyboardState::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // KeyCode ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "KeyCode") == 0) { + else if (name == "KeyCode") { _scValue->setInt(_currentCharCode); return _scValue; } @@ -149,7 +149,7 @@ ScValue *BaseKeyboardState::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // IsShift ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "IsShift") == 0) { + else if (name == "IsShift") { _scValue->setBool(_currentShift); return _scValue; } @@ -157,7 +157,7 @@ ScValue *BaseKeyboardState::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // IsAlt ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "IsAlt") == 0) { + else if (name == "IsAlt") { _scValue->setBool(_currentAlt); return _scValue; } @@ -165,7 +165,7 @@ ScValue *BaseKeyboardState::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // IsControl ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "IsControl") == 0) { + else if (name == "IsControl") { _scValue->setBool(_currentControl); return _scValue; } else { diff --git a/engines/wintermute/base/base_keyboard_state.h b/engines/wintermute/base/base_keyboard_state.h index ebc0c83ee1..dfd0efdec0 100644 --- a/engines/wintermute/base/base_keyboard_state.h +++ b/engines/wintermute/base/base_keyboard_state.h @@ -59,7 +59,7 @@ public: static bool isAltDown(); // scripting interface - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &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(); diff --git a/engines/wintermute/base/base_object.cpp b/engines/wintermute/base/base_object.cpp index b6a6887624..eba8416485 100644 --- a/engines/wintermute/base/base_object.cpp +++ b/engines/wintermute/base/base_object.cpp @@ -531,13 +531,13 @@ bool BaseObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta ////////////////////////////////////////////////////////////////////////// -ScValue *BaseObject::scGetProperty(const char *name) { +ScValue *BaseObject::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("object"); return _scValue; } @@ -545,7 +545,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Caption ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Caption") == 0) { + else if (name == "Caption") { _scValue->setString(getCaption(1)); return _scValue; } @@ -553,7 +553,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // X ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "X") == 0) { + else if (name == "X") { _scValue->setInt(_posX); return _scValue; } @@ -561,7 +561,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Y ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Y") == 0) { + else if (name == "Y") { _scValue->setInt(_posY); return _scValue; } @@ -569,7 +569,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Height (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Height") == 0) { + else if (name == "Height") { _scValue->setInt(getHeight()); return _scValue; } @@ -577,7 +577,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Ready (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Ready") == 0) { + else if (name == "Ready") { _scValue->setBool(_ready); return _scValue; } @@ -585,7 +585,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Movable ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Movable") == 0) { + else if (name == "Movable") { _scValue->setBool(_movable); return _scValue; } @@ -593,7 +593,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Registrable/Interactive ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Registrable") == 0 || strcmp(name, "Interactive") == 0) { + else if (name == "Registrable" || name == "Interactive") { _scValue->setBool(_registrable); return _scValue; } @@ -601,21 +601,21 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Zoomable/Scalable ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Zoomable") == 0 || strcmp(name, "Scalable") == 0) { + else if (name == "Zoomable" || name == "Scalable") { _scValue->setBool(_zoomable); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Rotatable ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Rotatable") == 0) { + else if (name == "Rotatable") { _scValue->setBool(_rotatable); return _scValue; } ////////////////////////////////////////////////////////////////////////// // AlphaColor ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AlphaColor") == 0) { + else if (name == "AlphaColor") { _scValue->setInt((int)_alphaColor); return _scValue; } @@ -623,7 +623,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // BlendMode ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "BlendMode") == 0) { + else if (name == "BlendMode") { _scValue->setInt((int)_blendMode); return _scValue; } @@ -631,7 +631,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Scale ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Scale") == 0) { + else if (name == "Scale") { if (_scale < 0) { _scValue->setNULL(); } else { @@ -643,7 +643,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ScaleX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ScaleX") == 0) { + else if (name == "ScaleX") { if (_scaleX < 0) { _scValue->setNULL(); } else { @@ -655,7 +655,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ScaleY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ScaleY") == 0) { + else if (name == "ScaleY") { if (_scaleY < 0) { _scValue->setNULL(); } else { @@ -667,7 +667,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // RelativeScale ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "RelativeScale") == 0) { + else if (name == "RelativeScale") { _scValue->setFloat((double)_relativeScale); return _scValue; } @@ -675,7 +675,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Rotate ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Rotate") == 0) { + else if (name == "Rotate") { if (!_rotateValid) { _scValue->setNULL(); } else { @@ -687,7 +687,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // RelativeRotate ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "RelativeRotate") == 0) { + else if (name == "RelativeRotate") { _scValue->setFloat((double)_relativeRotate); return _scValue; } @@ -695,14 +695,14 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Colorable ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Colorable") == 0) { + else if (name == "Colorable") { _scValue->setBool(_shadowable); return _scValue; } ////////////////////////////////////////////////////////////////////////// // SoundPanning ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SoundPanning") == 0) { + else if (name == "SoundPanning") { _scValue->setBool(_autoSoundPanning); return _scValue; } @@ -710,7 +710,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SaveState ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SaveState") == 0) { + else if (name == "SaveState") { _scValue->setBool(_saveState); return _scValue; } @@ -718,7 +718,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NonIntMouseEvents ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NonIntMouseEvents") == 0) { + else if (name == "NonIntMouseEvents") { _scValue->setBool(_nonIntMouseEvents); return _scValue; } @@ -726,7 +726,7 @@ ScValue *BaseObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AccCaption ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AccCaption") == 0) { + else if (name == "AccCaption") { _scValue->setNULL(); return _scValue; } else { diff --git a/engines/wintermute/base/base_object.h b/engines/wintermute/base/base_object.h index 34adbdb585..d7d91a25f6 100644 --- a/engines/wintermute/base/base_object.h +++ b/engines/wintermute/base/base_object.h @@ -136,7 +136,7 @@ public: public: // scripting interface - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &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(); diff --git a/engines/wintermute/base/base_quick_msg.h b/engines/wintermute/base/base_quick_msg.h index 4fed5ffc2e..67f9613461 100644 --- a/engines/wintermute/base/base_quick_msg.h +++ b/engines/wintermute/base/base_quick_msg.h @@ -37,10 +37,10 @@ class BaseQuickMsg : public BaseClass { public: char *getText(); uint32 _startTime; - char *_text; - BaseQuickMsg(BaseGame *inGame, const char *Text); + BaseQuickMsg(BaseGame *inGame, const char *text); virtual ~BaseQuickMsg(); - +private: + char *_text; }; } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_region.cpp b/engines/wintermute/base/base_region.cpp index e332ffe9ff..0bc5975e51 100644 --- a/engines/wintermute/base/base_region.cpp +++ b/engines/wintermute/base/base_region.cpp @@ -327,13 +327,13 @@ bool BaseRegion::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta ////////////////////////////////////////////////////////////////////////// -ScValue *BaseRegion::scGetProperty(const char *name) { +ScValue *BaseRegion::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("region"); return _scValue; } @@ -341,7 +341,7 @@ ScValue *BaseRegion::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Name") == 0) { + else if (name == "Name") { _scValue->setString(getName()); return _scValue; } @@ -349,7 +349,7 @@ ScValue *BaseRegion::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Active ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Active") == 0) { + else if (name == "Active") { _scValue->setBool(_active); return _scValue; } @@ -357,7 +357,7 @@ ScValue *BaseRegion::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumPoints ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumPoints") == 0) { + else if (name == "NumPoints") { _scValue->setInt(_points.size()); return _scValue; } else { diff --git a/engines/wintermute/base/base_region.h b/engines/wintermute/base/base_region.h index 8dd02fe928..464f25be2f 100644 --- a/engines/wintermute/base/base_region.h +++ b/engines/wintermute/base/base_region.h @@ -36,9 +36,6 @@ namespace Wintermute { class BaseRegion : public BaseObject { public: - float _lastMimicScale; - int _lastMimicX; - int _lastMimicY; void cleanup(); bool mimic(BaseRegion *region, float scale = 100.0f, int x = 0, int y = 0); bool getBoundingRect(Rect32 *rect); @@ -58,10 +55,14 @@ public: virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent, const char *nameOverride); // scripting interface - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &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: + float _lastMimicScale; + int _lastMimicX; + int _lastMimicY; }; } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_save_thumb_helper.cpp b/engines/wintermute/base/base_save_thumb_helper.cpp index 186e1234a8..b4205c21c4 100644 --- a/engines/wintermute/base/base_save_thumb_helper.cpp +++ b/engines/wintermute/base/base_save_thumb_helper.cpp @@ -28,6 +28,7 @@ #include "engines/wintermute/base/base_save_thumb_helper.h" #include "engines/wintermute/base/gfx/base_image.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/base_game.h" namespace Wintermute { diff --git a/engines/wintermute/base/base_script_holder.cpp b/engines/wintermute/base/base_script_holder.cpp index d3e6078d43..c5d5e82f76 100644 --- a/engines/wintermute/base/base_script_holder.cpp +++ b/engines/wintermute/base/base_script_holder.cpp @@ -219,13 +219,13 @@ bool BaseScriptHolder::scCallMethod(ScScript *script, ScStack *stack, ScStack *t ////////////////////////////////////////////////////////////////////////// -ScValue *BaseScriptHolder::scGetProperty(const char *name) { +ScValue *BaseScriptHolder::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("script_holder"); return _scValue; } @@ -233,7 +233,7 @@ ScValue *BaseScriptHolder::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Name") == 0) { + else if (name == "Name") { _scValue->setString(getName()); return _scValue; } @@ -241,7 +241,7 @@ ScValue *BaseScriptHolder::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Filename (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Filename") == 0) { + else if (name == "Filename") { _scValue->setString(_filename); return _scValue; } else { diff --git a/engines/wintermute/base/base_script_holder.h b/engines/wintermute/base/base_script_holder.h index 0c3d7a1a70..5fd0dbec9c 100644 --- a/engines/wintermute/base/base_script_holder.h +++ b/engines/wintermute/base/base_script_holder.h @@ -59,7 +59,7 @@ public: BaseArray<ScScript *> _scripts; // scripting interface - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &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(); diff --git a/engines/wintermute/base/base_scriptable.cpp b/engines/wintermute/base/base_scriptable.cpp index 143934402b..a2dd8b00e7 100644 --- a/engines/wintermute/base/base_scriptable.cpp +++ b/engines/wintermute/base/base_scriptable.cpp @@ -76,12 +76,12 @@ bool BaseScriptable::scCallMethod(ScScript *script, ScStack *stack, ScStack *thi ////////////////////////////////////////////////////////////////////////// -ScValue *BaseScriptable::scGetProperty(const char *name) { +ScValue *BaseScriptable::scGetProperty(const Common::String &name) { if (!_scProp) { _scProp = new ScValue(_gameRef); } if (_scProp) { - return _scProp->getProp(name); + return _scProp->getProp(name.c_str()); // TODO: Change to Common::String } else { return NULL; } diff --git a/engines/wintermute/base/base_scriptable.h b/engines/wintermute/base/base_scriptable.h index b006e6e07c..fbe14fc299 100644 --- a/engines/wintermute/base/base_scriptable.h +++ b/engines/wintermute/base/base_scriptable.h @@ -50,7 +50,7 @@ public: // high level scripting interface virtual bool canHandleMethod(const char *eventMethod); virtual bool scSetProperty(const char *name, ScValue *value); - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &name); virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); virtual void *scToMemBuffer(); diff --git a/engines/wintermute/base/base_sprite.cpp b/engines/wintermute/base/base_sprite.cpp index e2dd8bbd39..468af1bd75 100644 --- a/engines/wintermute/base/base_sprite.cpp +++ b/engines/wintermute/base/base_sprite.cpp @@ -121,6 +121,13 @@ bool BaseSprite::draw(int x, int y, BaseObject *registerOwner, float zoomX, floa return display(x, y, registerOwner, zoomX, zoomY, alpha); } +bool BaseSprite::isChanged() { + return _changed; +} + +bool BaseSprite::isFinished() { + return _finished; +} ////////////////////////////////////////////////////////////////////// bool BaseSprite::loadFile(const Common::String &filename, int lifeTime, TSpriteCacheType cacheType) { @@ -686,13 +693,13 @@ bool BaseSprite::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSta ////////////////////////////////////////////////////////////////////////// -ScValue *BaseSprite::scGetProperty(const char *name) { +ScValue *BaseSprite::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("sprite"); return _scValue; } @@ -700,7 +707,7 @@ ScValue *BaseSprite::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumFrames (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumFrames") == 0) { + else if (name == "NumFrames") { _scValue->setInt(_frames.size()); return _scValue; } @@ -708,7 +715,7 @@ ScValue *BaseSprite::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // CurrentFrame ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "CurrentFrame") == 0) { + else if (name == "CurrentFrame") { _scValue->setInt(_currentFrame); return _scValue; } @@ -716,7 +723,7 @@ ScValue *BaseSprite::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // PixelPerfect ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "PixelPerfect") == 0) { + else if (name == "PixelPerfect") { _scValue->setBool(_precise); return _scValue; } @@ -724,7 +731,7 @@ ScValue *BaseSprite::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Looping ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Looping") == 0) { + else if (name == "Looping") { _scValue->setBool(_looping); return _scValue; } @@ -732,7 +739,7 @@ ScValue *BaseSprite::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Owner (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Owner") == 0) { + else if (name == "Owner") { if (_owner == NULL) { _scValue->setNULL(); } else { @@ -744,7 +751,7 @@ ScValue *BaseSprite::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Finished (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Finished") == 0) { + else if (name == "Finished") { _scValue->setBool(_finished); return _scValue; } @@ -752,7 +759,7 @@ ScValue *BaseSprite::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Paused (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Paused") == 0) { + else if (name == "Paused") { _scValue->setBool(_paused); return _scValue; } else { @@ -804,9 +811,7 @@ const char *BaseSprite::scToString() { ////////////////////////////////////////////////////////////////////////// bool BaseSprite::killAllSounds() { for (uint32 i = 0; i < _frames.size(); i++) { - if (_frames[i]->_sound) { - _frames[i]->_sound->stop(); - } + _frames[i]->stopSound(); } return STATUS_OK; } diff --git a/engines/wintermute/base/base_sprite.h b/engines/wintermute/base/base_sprite.h index c861ca9930..1d244c3a52 100644 --- a/engines/wintermute/base/base_sprite.h +++ b/engines/wintermute/base/base_sprite.h @@ -39,36 +39,21 @@ class BaseSurface; class BaseObject; class BaseSprite: public BaseScriptHolder { public: - bool killAllSounds(); BaseSurface *getSurface(); - char *_editorBgFile; - int _editorBgOffsetX; - int _editorBgOffsetY; - int _editorBgAlpha; - bool _streamed; - bool _streamedKeepLoaded; void cleanup(); void setDefaults(); - bool _precise; DECLARE_PERSISTENT(BaseSprite, BaseScriptHolder) - bool _editorAllFrames; bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); int _moveY; int _moveX; bool display(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); bool getCurrentFrame(float zoomX = 100, float zoomY = 100); - bool _canBreak; - bool _editorMuted; - bool _continuous; void reset(); - BaseObject *_owner; - bool _changed; - bool _paused; - bool _finished; + bool isChanged(); + bool isFinished(); bool loadBuffer(byte *buffer, bool compete = true, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); bool loadFile(const Common::String &filename, int lifeTime = -1, TSpriteCacheType cacheType = CACHE_ALL); - uint32 _lastFrameTime; bool draw(int x, int y, BaseObject *Register = NULL, float zoomX = 100, float zoomY = 100, uint32 alpha = 0xFFFFFFFF); bool _looping; int _currentFrame; @@ -79,10 +64,28 @@ public: bool saveAsText(BaseDynamicBuffer *buffer, int indent); // scripting interface - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &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: + BaseObject *_owner; + bool _canBreak; + bool _changed; + bool _editorAllFrames; + char *_editorBgFile; + int _editorBgOffsetX; + int _editorBgOffsetY; + int _editorBgAlpha; + bool _editorMuted; + bool _finished; + bool _continuous; + uint32 _lastFrameTime; + bool _precise; + bool _paused; + bool _streamed; + bool _streamedKeepLoaded; + bool killAllSounds(); }; } // end of namespace Wintermute diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index 6a9246efd4..77cc522ae7 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -34,6 +34,7 @@ #include "engines/wintermute/base/base_surface_storage.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/platform_osystem.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/base/scriptables/script_stack.h" @@ -225,6 +226,9 @@ void BaseSubFrame::setRect(Rect32 rect) { _rect = rect; } +const char* BaseSubFrame::getSurfaceFilename() { + return _surfaceFilename; +} ////////////////////////////////////////////////////////////////////// bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, float zoomY, bool precise, uint32 alpha, float rotate, TSpriteBlendMode blendMode) { @@ -442,7 +446,7 @@ bool BaseSubFrame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisS ////////////////////////////////////////////////////////////////////////// -ScValue *BaseSubFrame::scGetProperty(const char *name) { +ScValue *BaseSubFrame::scGetProperty(const Common::String &name) { if (!_scValue) { _scValue = new ScValue(_gameRef); } @@ -451,7 +455,7 @@ ScValue *BaseSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Type (RO) ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("subframe"); return _scValue; } @@ -459,7 +463,7 @@ ScValue *BaseSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AlphaColor ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AlphaColor") == 0) { + else if (name == "AlphaColor") { _scValue->setInt((int)_alpha); return _scValue; @@ -468,7 +472,7 @@ ScValue *BaseSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // TransparentColor (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TransparentColor") == 0) { + else if (name == "TransparentColor") { _scValue->setInt((int)_transparent); return _scValue; } @@ -476,7 +480,7 @@ ScValue *BaseSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Is2DOnly ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Is2DOnly") == 0) { + else if (name == "Is2DOnly") { _scValue->setBool(_2DOnly); return _scValue; } @@ -484,7 +488,7 @@ ScValue *BaseSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Is3DOnly ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Is3DOnly") == 0) { + else if (name == "Is3DOnly") { _scValue->setBool(_3DOnly); return _scValue; } @@ -492,7 +496,7 @@ ScValue *BaseSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MirrorX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MirrorX") == 0) { + else if (name == "MirrorX") { _scValue->setBool(_mirrorX); return _scValue; } @@ -500,7 +504,7 @@ ScValue *BaseSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MirrorY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MirrorY") == 0) { + else if (name == "MirrorY") { _scValue->setBool(_mirrorY); return _scValue; } @@ -508,7 +512,7 @@ ScValue *BaseSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Decoration ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Decoration") == 0) { + else if (name == "Decoration") { _scValue->setBool(_decoration); return _scValue; } @@ -516,7 +520,7 @@ ScValue *BaseSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // HotspotX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "HotspotX") == 0) { + else if (name == "HotspotX") { _scValue->setInt(_hotspotX); return _scValue; } @@ -524,7 +528,7 @@ ScValue *BaseSubFrame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // HotspotY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "HotspotY") == 0) { + else if (name == "HotspotY") { _scValue->setInt(_hotspotY); return _scValue; } else { diff --git a/engines/wintermute/base/base_sub_frame.h b/engines/wintermute/base/base_sub_frame.h index b174c6e5f0..c173ae69d1 100644 --- a/engines/wintermute/base/base_sub_frame.h +++ b/engines/wintermute/base/base_sub_frame.h @@ -54,6 +54,7 @@ public: bool loadBuffer(byte *buffer, int lifeTime, bool keepLoaded); bool draw(int x, int y, BaseObject *registerOwner = NULL, float zoomX = 100, float zoomY = 100, bool precise = true, uint32 alpha = 0xFFFFFFFF, float rotate = 0.0f, TSpriteBlendMode blendMode = BLEND_NORMAL); bool getBoundingRect(Rect32 *rect, int x, int y, float scaleX = 100, float scaleY = 100); + const char* getSurfaceFilename(); int _hotspotX; int _hotspotY; @@ -65,6 +66,7 @@ public: private: bool _wantsDefaultRect; Rect32 _rect; + char *_surfaceFilename; public: bool _cKDefault; byte _cKRed; @@ -72,7 +74,6 @@ public: byte _cKBlue; int _lifeTime; bool _keepLoaded; - char *_surfaceFilename; bool _2DOnly; bool _3DOnly; @@ -80,7 +81,7 @@ public: BaseSurface *_surface; // scripting interface - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &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(); diff --git a/engines/wintermute/base/base_surface_storage.cpp b/engines/wintermute/base/base_surface_storage.cpp index 1dcebb0595..4e795ca813 100644 --- a/engines/wintermute/base/base_surface_storage.cpp +++ b/engines/wintermute/base/base_surface_storage.cpp @@ -28,6 +28,7 @@ #include "engines/wintermute/base/base_surface_storage.h" #include "engines/wintermute/base/gfx/base_surface.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/platform_osystem.h" diff --git a/engines/wintermute/base/base_transition_manager.cpp b/engines/wintermute/base/base_transition_manager.cpp index 5c28f36d30..7785f3d5af 100644 --- a/engines/wintermute/base/base_transition_manager.cpp +++ b/engines/wintermute/base/base_transition_manager.cpp @@ -28,6 +28,7 @@ #include "engines/wintermute/base/base_transition_manager.h" #include "engines/wintermute/base/base_game.h" +#include "engines/wintermute/base/gfx/base_renderer.h" namespace Wintermute { diff --git a/engines/wintermute/base/base_viewport.cpp b/engines/wintermute/base/base_viewport.cpp index 3b003e1c49..7ec995449f 100644 --- a/engines/wintermute/base/base_viewport.cpp +++ b/engines/wintermute/base/base_viewport.cpp @@ -29,6 +29,7 @@ #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/base/base_viewport.h" +#include "engines/wintermute/base/gfx/base_renderer.h" namespace Wintermute { diff --git a/engines/wintermute/base/file/base_disk_file.cpp b/engines/wintermute/base/file/base_disk_file.cpp index 2d3951b026..25be3dad2d 100644 --- a/engines/wintermute/base/file/base_disk_file.cpp +++ b/engines/wintermute/base/file/base_disk_file.cpp @@ -178,10 +178,8 @@ Common::SeekableReadStream *openDiskFile(const Common::String &filename) { } delete[] compBuffer; - - return new Common::MemoryReadStream(data, uncompSize, DisposeAfterUse::YES); delete file; - file = NULL; + return new Common::MemoryReadStream(data, uncompSize, DisposeAfterUse::YES); } else { file->seek(0, SEEK_SET); return file; diff --git a/engines/wintermute/base/file/base_package.cpp b/engines/wintermute/base/file/base_package.cpp index 9780992652..51a1558a7c 100644 --- a/engines/wintermute/base/file/base_package.cpp +++ b/engines/wintermute/base/file/base_package.cpp @@ -86,16 +86,16 @@ void TPackageHeader::readFromStream(Common::ReadStream *stream) { _magic1 = stream->readUint32LE(); _magic2 = stream->readUint32LE(); _packageVersion = stream->readUint32LE(); - + _gameVersion = stream->readUint32LE(); - + _priority = stream->readByte(); _cd = stream->readByte(); _masterIndex = stream->readByte(); stream->readByte(); // To align the next byte... - + _creationTime = stream->readUint32LE(); - + stream->read(_desc, 100); _numDirs = stream->readUint32LE(); } diff --git a/engines/wintermute/base/file/base_save_thumb_file.cpp b/engines/wintermute/base/file/base_save_thumb_file.cpp index 5bdab0853e..94d3e5a94e 100644 --- a/engines/wintermute/base/file/base_save_thumb_file.cpp +++ b/engines/wintermute/base/file/base_save_thumb_file.cpp @@ -28,7 +28,6 @@ #include "engines/wintermute/base/base_persistence_manager.h" #include "engines/wintermute/base/file/base_save_thumb_file.h" -#include "engines/wintermute/platform_osystem.h" namespace Wintermute { diff --git a/engines/wintermute/base/font/base_font_bitmap.cpp b/engines/wintermute/base/font/base_font_bitmap.cpp index fced08c7e2..55f46c476b 100644 --- a/engines/wintermute/base/font/base_font_bitmap.cpp +++ b/engines/wintermute/base/font/base_font_bitmap.cpp @@ -31,6 +31,7 @@ #include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_frame.h" #include "engines/wintermute/base/gfx/base_surface.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_sub_frame.h" #include "engines/wintermute/base/base_frame.h" diff --git a/engines/wintermute/base/font/base_font_storage.cpp b/engines/wintermute/base/font/base_font_storage.cpp index d26fa1d593..8128ffe897 100644 --- a/engines/wintermute/base/font/base_font_storage.cpp +++ b/engines/wintermute/base/font/base_font_storage.cpp @@ -29,7 +29,6 @@ #include "engines/wintermute/base/font/base_font_storage.h" #include "engines/wintermute/base/font/base_font.h" #include "engines/wintermute/base/base_game.h" -#include "engines/wintermute/platform_osystem.h" #include "common/str.h" namespace Wintermute { diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index 599010bbd5..f236329fcd 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -26,11 +26,8 @@ * Copyright (c) 2011 Jan Nedoma */ -#include "engines/wintermute/base/file/base_file.h" #include "engines/wintermute/base/font/base_font_truetype.h" -#include "engines/wintermute/utils/path_util.h" #include "engines/wintermute/utils/string_util.h" -#include "engines/wintermute/math/math_util.h" #include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/gfx/base_surface.h" #include "engines/wintermute/base/base_parser.h" @@ -162,6 +159,11 @@ void BaseFontTT::drawText(const byte *text, int x, int y, int width, TTextAlign // TODO: Why do we still insist on Widestrings everywhere? /* if (_gameRef->_textEncoding == TEXT_UTF8) text = StringUtil::Utf8ToWide((char *)Text); else text = StringUtil::AnsiToWide((char *)Text);*/ + // HACK: J.U.L.I.A. uses CP1252, we need to fix that, + // And we still don't have any UTF8-support. + if (_gameRef->_textEncoding != TEXT_UTF8) { + textStr = StringUtil::ansiToWide((char *)text); + } if (maxLength >= 0 && textStr.size() > (uint32)maxLength) { textStr = Common::String(textStr.c_str(), (uint32)maxLength); diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index 9205438a5b..e7ffc14c25 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -129,13 +129,13 @@ void BaseRenderer::initSaveLoad(bool isSaving, bool quickSave) { _indicatorDisplay = true; _indicatorProgress = 0; _hasDrawnSaveLoadImage = false; - + if (isSaving && !quickSave) { delete _saveLoadImage; _saveLoadImage = NULL; if (_saveImageName.size()) { _saveLoadImage = createSurface(); - + if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_saveImageName, true, 0, 0, 0))) { delete _saveLoadImage; _saveLoadImage = NULL; @@ -146,7 +146,7 @@ void BaseRenderer::initSaveLoad(bool isSaving, bool quickSave) { _saveLoadImage = NULL; if (_loadImageName.size()) { _saveLoadImage = createSurface(); - + if (!_saveLoadImage || DID_FAIL(_saveLoadImage->create(_loadImageName, true, 0, 0, 0))) { delete _saveLoadImage; _saveLoadImage = NULL; @@ -360,7 +360,7 @@ bool BaseRenderer::displayIndicator() { flip(); _hasDrawnSaveLoadImage = true; } - + if ((!_indicatorDisplay && _indicatorWidth <= 0) || _indicatorHeight <= 0) { return STATUS_OK; } @@ -369,7 +369,7 @@ bool BaseRenderer::displayIndicator() { for (int i = 0; i < _indicatorHeight; i++) { drawLine(_indicatorX, _indicatorY + i, _indicatorX + curWidth, _indicatorY + i, _indicatorColor); } - + setup2D(); _indicatorWidthDrawn = curWidth; if (_indicatorWidthDrawn) { diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 6d67253038..7970a25300 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -261,7 +261,7 @@ void BaseRenderOSystem::fade(uint16 alpha) { void BaseRenderOSystem::fadeToColor(byte r, byte g, byte b, byte a, Common::Rect *rect) { // This particular warning is rather messy, as this function is called a ton, // thus we avoid printing it more than once. - + // TODO: Add fading with dirty rects. if (!_disableDirtyRects) { warning("BaseRenderOSystem::FadeToColor - Breaks when using dirty rects"); @@ -573,6 +573,11 @@ Rect32 BaseRenderOSystem::getViewPort() { ////////////////////////////////////////////////////////////////////////// void BaseRenderOSystem::modTargetRect(Common::Rect *rect) { + // FIXME: This is wrong in quite a few ways right now, and ends up + // breaking the notebook in Dirty Split, so we disable the correction + // for now, this will need fixing when a game with odd aspect-ratios + // show up. + return; rect->left = (int16)MathUtil::round(rect->left * _ratioX + _borderLeft - _renderRect.left); rect->top = (int16)MathUtil::round(rect->top * _ratioY + _borderTop - _renderRect.top); rect->setWidth((int16)MathUtil::roundUp(rect->width() * _ratioX)); diff --git a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp index d5464782a3..bee876bb65 100644 --- a/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_surface_osystem.cpp @@ -26,7 +26,6 @@ * Copyright (c) 2011 Jan Nedoma */ -#include "engines/wintermute/base/file/base_file.h" #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/gfx/osystem/base_surface_osystem.h" diff --git a/engines/wintermute/base/particles/part_emitter.cpp b/engines/wintermute/base/particles/part_emitter.cpp index 3655b89131..bab4d4609e 100644 --- a/engines/wintermute/base/particles/part_emitter.cpp +++ b/engines/wintermute/base/particles/part_emitter.cpp @@ -35,6 +35,7 @@ #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_region.h" #include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/utils/utils.h" #include "engines/wintermute/platform_osystem.h" #include "common/str.h" @@ -603,41 +604,41 @@ bool PartEmitter::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSt } ////////////////////////////////////////////////////////////////////////// -ScValue *PartEmitter::scGetProperty(const char *name) { +ScValue *PartEmitter::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("particle-emitter"); return _scValue; } ////////////////////////////////////////////////////////////////////////// // X ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "X") == 0) { + else if (name == "X") { _scValue->setInt(_posX); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Y ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Y") == 0) { + else if (name == "Y") { _scValue->setInt(_posY); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Width ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Width") == 0) { + else if (name == "Width") { _scValue->setInt(_width); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Height ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Height") == 0) { + else if (name == "Height") { _scValue->setInt(_height); return _scValue; } @@ -645,21 +646,21 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Scale1 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Scale1") == 0) { + else if (name == "Scale1") { _scValue->setFloat(_scale1); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Scale2 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Scale2") == 0) { + else if (name == "Scale2") { _scValue->setFloat(_scale2); return _scValue; } ////////////////////////////////////////////////////////////////////////// // ScaleZBased ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ScaleZBased") == 0) { + else if (name == "ScaleZBased") { _scValue->setBool(_scaleZBased); return _scValue; } @@ -667,21 +668,21 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Velocity1 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Velocity1") == 0) { + else if (name == "Velocity1") { _scValue->setFloat(_velocity1); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Velocity2 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Velocity2") == 0) { + else if (name == "Velocity2") { _scValue->setFloat(_velocity2); return _scValue; } ////////////////////////////////////////////////////////////////////////// // VelocityZBased ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "VelocityZBased") == 0) { + else if (name == "VelocityZBased") { _scValue->setBool(_velocityZBased); return _scValue; } @@ -689,21 +690,21 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // LifeTime1 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "LifeTime1") == 0) { + else if (name == "LifeTime1") { _scValue->setInt(_lifeTime1); return _scValue; } ////////////////////////////////////////////////////////////////////////// // LifeTime2 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "LifeTime2") == 0) { + else if (name == "LifeTime2") { _scValue->setInt(_lifeTime2); return _scValue; } ////////////////////////////////////////////////////////////////////////// // LifeTimeZBased ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "LifeTimeZBased") == 0) { + else if (name == "LifeTimeZBased") { _scValue->setBool(_lifeTimeZBased); return _scValue; } @@ -711,14 +712,14 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Angle1 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Angle1") == 0) { + else if (name == "Angle1") { _scValue->setInt(_angle1); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Angle2 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Angle2") == 0) { + else if (name == "Angle2") { _scValue->setInt(_angle2); return _scValue; } @@ -726,14 +727,14 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AngVelocity1 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AngVelocity1") == 0) { + else if (name == "AngVelocity1") { _scValue->setFloat(_angVelocity1); return _scValue; } ////////////////////////////////////////////////////////////////////////// // AngVelocity2 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AngVelocity2") == 0) { + else if (name == "AngVelocity2") { _scValue->setFloat(_angVelocity2); return _scValue; } @@ -741,14 +742,14 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Rotation1 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Rotation1") == 0) { + else if (name == "Rotation1") { _scValue->setFloat(_rotation1); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Rotation2 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Rotation2") == 0) { + else if (name == "Rotation2") { _scValue->setFloat(_rotation2); return _scValue; } @@ -756,21 +757,21 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Alpha1 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Alpha1") == 0) { + else if (name == "Alpha1") { _scValue->setInt(_alpha1); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Alpha2 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Alpha2") == 0) { + else if (name == "Alpha2") { _scValue->setInt(_alpha2); return _scValue; } ////////////////////////////////////////////////////////////////////////// // AlphaTimeBased ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AlphaTimeBased") == 0) { + else if (name == "AlphaTimeBased") { _scValue->setBool(_alphaTimeBased); return _scValue; } @@ -778,14 +779,14 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MaxParticles ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MaxParticles") == 0) { + else if (name == "MaxParticles") { _scValue->setInt(_maxParticles); return _scValue; } ////////////////////////////////////////////////////////////////////////// // NumLiveParticles (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumLiveParticles") == 0) { + else if (name == "NumLiveParticles") { int numAlive = 0; for (uint32 i = 0; i < _particles.size(); i++) { if (_particles[i] && !_particles[i]->_isDead) { @@ -799,21 +800,21 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // GenerationInterval ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "GenerationInterval") == 0) { + else if (name == "GenerationInterval") { _scValue->setInt(_genInterval); return _scValue; } ////////////////////////////////////////////////////////////////////////// // GenerationAmount ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "GenerationAmount") == 0) { + else if (name == "GenerationAmount") { _scValue->setInt(_genAmount); return _scValue; } ////////////////////////////////////////////////////////////////////////// // MaxBatches ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MaxBatches") == 0) { + else if (name == "MaxBatches") { _scValue->setInt(_maxBatches); return _scValue; } @@ -821,14 +822,14 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // FadeInTime ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "FadeInTime") == 0) { + else if (name == "FadeInTime") { _scValue->setInt(_fadeInTime); return _scValue; } ////////////////////////////////////////////////////////////////////////// // FadeOutTime ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "FadeOutTime") == 0) { + else if (name == "FadeOutTime") { _scValue->setInt(_fadeOutTime); return _scValue; } @@ -836,21 +837,21 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // GrowthRate1 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "GrowthRate1") == 0) { + else if (name == "GrowthRate1") { _scValue->setFloat(_growthRate1); return _scValue; } ////////////////////////////////////////////////////////////////////////// // GrowthRate2 ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "GrowthRate2") == 0) { + else if (name == "GrowthRate2") { _scValue->setFloat(_growthRate2); return _scValue; } ////////////////////////////////////////////////////////////////////////// // ExponentialGrowth ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ExponentialGrowth") == 0) { + else if (name == "ExponentialGrowth") { _scValue->setBool(_exponentialGrowth); return _scValue; } @@ -858,7 +859,7 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // UseRegion ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "UseRegion") == 0) { + else if (name == "UseRegion") { _scValue->setBool(_useRegion); return _scValue; } @@ -866,7 +867,7 @@ ScValue *PartEmitter::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // EmitEvent ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "EmitEvent") == 0) { + else if (name == "EmitEvent") { if (!_emitEvent) { _scValue->setNULL(); } else { diff --git a/engines/wintermute/base/particles/part_emitter.h b/engines/wintermute/base/particles/part_emitter.h index 9a35cd9bbc..f2c8f139f1 100644 --- a/engines/wintermute/base/particles/part_emitter.h +++ b/engines/wintermute/base/particles/part_emitter.h @@ -63,7 +63,7 @@ public: BaseArray<PartForce *> _forces; // scripting interface - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &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(); diff --git a/engines/wintermute/base/saveload.cpp b/engines/wintermute/base/saveload.cpp index 06e9fd2565..12204e1b35 100644 --- a/engines/wintermute/base/saveload.cpp +++ b/engines/wintermute/base/saveload.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -35,6 +35,7 @@ #include "engines/wintermute/base/base_region.h" #include "engines/wintermute/base/base_sub_frame.h" #include "engines/wintermute/base/font/base_font.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/sound/base_sound.h" #include "engines/wintermute/base/scriptables/script.h" #include "common/savefile.h" @@ -44,11 +45,11 @@ namespace Wintermute { bool SaveLoad::loadGame(const Common::String &filename, BaseGame *gameRef) { gameRef->LOG(0, "Loading game '%s'...", filename.c_str()); - + bool ret; - + gameRef->_renderer->initSaveLoad(false); - + gameRef->_loadInProgress = true; BasePersistenceManager *pm = new BasePersistenceManager(); if (DID_SUCCEED(ret = pm->initLoad(filename))) { @@ -60,20 +61,20 @@ bool SaveLoad::loadGame(const Common::String &filename, BaseGame *gameRef) { // data initialization after load SaveLoad::initAfterLoad(); - + gameRef->applyEvent("AfterLoad", true); - + gameRef->displayContent(true, false); //_renderer->flip(); } } } - + delete pm; gameRef->_loadInProgress = false; - + gameRef->_renderer->endSaveLoad(); - + //_gameRef->LOG(0, "Load end %d", BaseUtils::GetUsedMemMB()); // AdGame: if (DID_SUCCEED(ret)) { @@ -84,13 +85,13 @@ bool SaveLoad::loadGame(const Common::String &filename, BaseGame *gameRef) { bool SaveLoad::saveGame(int slot, const char *desc, bool quickSave, BaseGame *gameRef) { Common::String filename = SaveLoad::getSaveSlotFilename(slot); - + gameRef->LOG(0, "Saving game '%s'...", filename.c_str()); - + gameRef->applyEvent("BeforeSave", true); - + bool ret; - + BasePersistenceManager *pm = new BasePersistenceManager(); if (DID_SUCCEED(ret = pm->initSave(desc))) { gameRef->_renderer->initSaveLoad(true, quickSave); // TODO: The original code inited the indicator before the conditionals @@ -103,11 +104,11 @@ bool SaveLoad::saveGame(int slot, const char *desc, bool quickSave, BaseGame *ga } } } - + delete pm; - + gameRef->_renderer->endSaveLoad(); - + return ret; } @@ -165,21 +166,21 @@ Common::String SaveLoad::getSaveSlotFilename(int slot) { bool SaveLoad::getSaveSlotDescription(int slot, char *buffer) { buffer[0] = '\0'; - + Common::String filename = getSaveSlotFilename(slot); BasePersistenceManager *pm = new BasePersistenceManager(); if (!pm) { return false; } - + if (!(pm->initLoad(filename))) { delete pm; return false; } - + strcpy(buffer, pm->_savedDescription); delete pm; - + return true; } @@ -198,6 +199,6 @@ bool SaveLoad::emptySaveSlot(int slot) { delete pm; return true; } - - + + } // end of namespace Wintermute diff --git a/engines/wintermute/base/saveload.h b/engines/wintermute/base/saveload.h index e448cc8814..722f7a89b6 100644 --- a/engines/wintermute/base/saveload.h +++ b/engines/wintermute/base/saveload.h @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -25,7 +25,7 @@ * http://dead-code.org/redir.php?target=wmelite * Copyright (c) 2011 Jan Nedoma */ - + #ifndef WINTERMUTE_SAVEGAME_H #define WINTERMUTE_SAVEGAME_H @@ -39,7 +39,7 @@ public: static bool isSaveSlotUsed(int slot); static bool getSaveSlotDescription(int slot, char *buffer); static Common::String getSaveSlotFilename(int slot); - + static bool loadGame(const Common::String &filename, BaseGame *gameRef); static bool saveGame(int slot, const char *desc, bool quickSave, BaseGame *gameRef); static bool initAfterLoad(); diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp index 20e2ccadd1..3d1863946e 100644 --- a/engines/wintermute/base/scriptables/script_engine.cpp +++ b/engines/wintermute/base/scriptables/script_engine.cpp @@ -33,7 +33,6 @@ #include "engines/wintermute/base/scriptables/script_ext_math.h" #include "engines/wintermute/base/base_engine.h" #include "engines/wintermute/base/base_game.h" -#include "engines/wintermute/base/sound/base_sound.h" #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/utils/utils.h" diff --git a/engines/wintermute/base/scriptables/script_ext_array.cpp b/engines/wintermute/base/scriptables/script_ext_array.cpp index 5ed07f0da6..613cbd0758 100644 --- a/engines/wintermute/base/scriptables/script_ext_array.cpp +++ b/engines/wintermute/base/scriptables/script_ext_array.cpp @@ -140,13 +140,13 @@ bool SXArray::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *SXArray::scGetProperty(const char *name) { +ScValue *SXArray::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("array"); return _scValue; } @@ -154,7 +154,7 @@ ScValue *SXArray::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Length ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Length") == 0) { + else if (name == "Length") { _scValue->setInt(_length); return _scValue; } @@ -164,7 +164,7 @@ ScValue *SXArray::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// else { char paramName[20]; - if (validNumber(name, paramName)) { + if (validNumber(name.c_str(), paramName)) { // TODO: Change to Common::String return _values->getProp(paramName); } else { return _scValue; diff --git a/engines/wintermute/base/scriptables/script_ext_array.h b/engines/wintermute/base/scriptables/script_ext_array.h index d9805ef94f..284c547a27 100644 --- a/engines/wintermute/base/scriptables/script_ext_array.h +++ b/engines/wintermute/base/scriptables/script_ext_array.h @@ -41,7 +41,7 @@ public: SXArray(BaseGame *inGame, ScStack *stack); SXArray(BaseGame *inGame); virtual ~SXArray(); - ScValue *scGetProperty(const char *name); + ScValue *scGetProperty(const Common::String &name); bool scSetProperty(const char *name, ScValue *value); bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); const char *scToString(); diff --git a/engines/wintermute/base/scriptables/script_ext_date.cpp b/engines/wintermute/base/scriptables/script_ext_date.cpp index 11eead3b9c..5aa069d0b2 100644 --- a/engines/wintermute/base/scriptables/script_ext_date.cpp +++ b/engines/wintermute/base/scriptables/script_ext_date.cpp @@ -203,13 +203,13 @@ bool SXDate::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *SXDate::scGetProperty(const char *name) { +ScValue *SXDate::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("date"); return _scValue; } else { @@ -224,7 +224,7 @@ bool SXDate::scSetProperty(const char *name, ScValue *value) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Name")==0){ + if (name == "Name")==0){ setName(value->getString()); return STATUS_OK; } diff --git a/engines/wintermute/base/scriptables/script_ext_date.h b/engines/wintermute/base/scriptables/script_ext_date.h index f6f04dd7e6..062b7c55c7 100644 --- a/engines/wintermute/base/scriptables/script_ext_date.h +++ b/engines/wintermute/base/scriptables/script_ext_date.h @@ -40,7 +40,7 @@ public: DECLARE_PERSISTENT(SXDate, BaseScriptable) SXDate(BaseGame *inGame, ScStack *Stack); virtual ~SXDate(); - ScValue *scGetProperty(const char *name); + ScValue *scGetProperty(const Common::String &name); bool scSetProperty(const char *name, ScValue *value); bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); const char *scToString(); diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp index ab574d464b..a1d39c5d0a 100644 --- a/engines/wintermute/base/scriptables/script_ext_file.cpp +++ b/engines/wintermute/base/scriptables/script_ext_file.cpp @@ -33,7 +33,6 @@ #include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/utils/utils.h" #include "engines/wintermute/base/base_game.h" -#include "engines/wintermute/base/file/base_file.h" #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/base/scriptables/script_ext_file.h" @@ -641,13 +640,13 @@ bool SXFile::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *SXFile::scGetProperty(const char *name) { +ScValue *SXFile::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type (RO) ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("file"); return _scValue; } @@ -655,7 +654,7 @@ ScValue *SXFile::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Filename (RO) ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Filename") == 0) { + if (name == "Filename") { _scValue->setString(_filename); return _scValue; } @@ -663,7 +662,7 @@ ScValue *SXFile::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Position (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Position") == 0) { + else if (name == "Position") { _scValue->setInt(getPos()); return _scValue; } @@ -671,7 +670,7 @@ ScValue *SXFile::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Length (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Length") == 0) { + else if (name == "Length") { _scValue->setInt(getLength()); return _scValue; } @@ -679,7 +678,7 @@ ScValue *SXFile::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // TextMode (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TextMode") == 0) { + else if (name == "TextMode") { _scValue->setBool(_textMode); return _scValue; } @@ -687,7 +686,7 @@ ScValue *SXFile::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AccessMode (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AccessMode") == 0) { + else if (name == "AccessMode") { _scValue->setInt(_mode); return _scValue; } else { diff --git a/engines/wintermute/base/scriptables/script_ext_file.h b/engines/wintermute/base/scriptables/script_ext_file.h index b91a53e695..f7c72fcfb3 100644 --- a/engines/wintermute/base/scriptables/script_ext_file.h +++ b/engines/wintermute/base/scriptables/script_ext_file.h @@ -40,7 +40,7 @@ class BaseFile; class SXFile : public BaseScriptable { public: DECLARE_PERSISTENT(SXFile, BaseScriptable) - ScValue *scGetProperty(const char *name); + ScValue *scGetProperty(const Common::String &name); bool scSetProperty(const char *name, ScValue *value); bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); const char *scToString(); diff --git a/engines/wintermute/base/scriptables/script_ext_math.cpp b/engines/wintermute/base/scriptables/script_ext_math.cpp index 598b80cff3..d816fbec65 100644 --- a/engines/wintermute/base/scriptables/script_ext_math.cpp +++ b/engines/wintermute/base/scriptables/script_ext_math.cpp @@ -250,13 +250,13 @@ bool SXMath::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *SXMath::scGetProperty(const char *name) { +ScValue *SXMath::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("math"); return _scValue; } @@ -264,7 +264,7 @@ ScValue *SXMath::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // PI ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "PI") == 0) { + else if (name == "PI") { _scValue->setFloat(M_PI); return _scValue; } else { diff --git a/engines/wintermute/base/scriptables/script_ext_math.h b/engines/wintermute/base/scriptables/script_ext_math.h index f86d59fe7b..48c43ea7e8 100644 --- a/engines/wintermute/base/scriptables/script_ext_math.h +++ b/engines/wintermute/base/scriptables/script_ext_math.h @@ -39,7 +39,7 @@ public: DECLARE_PERSISTENT(SXMath, BaseScriptable) SXMath(BaseGame *inGame); virtual ~SXMath(); - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &name); virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); private: diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp index 5ed9bd5313..8f05b7bff6 100644 --- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp +++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp @@ -447,13 +447,13 @@ bool SXMemBuffer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisSt ////////////////////////////////////////////////////////////////////////// -ScValue *SXMemBuffer::scGetProperty(const char *name) { +ScValue *SXMemBuffer::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type (RO) ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("membuffer"); return _scValue; } @@ -461,7 +461,7 @@ ScValue *SXMemBuffer::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Size (RO) ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Size") == 0) { + if (name == "Size") { _scValue->setInt(_size); return _scValue; } else { diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h index d2662b3036..1527a323dc 100644 --- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h +++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h @@ -38,7 +38,7 @@ class SXMemBuffer : public BaseScriptable { public: virtual int scCompare(BaseScriptable *Val); DECLARE_PERSISTENT(SXMemBuffer, BaseScriptable) - ScValue *scGetProperty(const char *name); + ScValue *scGetProperty(const Common::String &name); bool scSetProperty(const char *name, ScValue *value); bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); const char *scToString(); diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp index 8d87a92dc1..5f7da1c2dd 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.cpp +++ b/engines/wintermute/base/scriptables/script_ext_string.cpp @@ -343,20 +343,20 @@ bool SXString::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack ////////////////////////////////////////////////////////////////////////// -ScValue *SXString::scGetProperty(const char *name) { +ScValue *SXString::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type (RO) ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("string"); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Length (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Length") == 0) { + else if (name == "Length") { if (_gameRef->_textEncoding == TEXT_UTF8) { WideString wstr = StringUtil::utf8ToWide(_string); _scValue->setInt(wstr.size()); @@ -369,7 +369,7 @@ ScValue *SXString::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Capacity ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Capacity") == 0) { + else if (name == "Capacity") { _scValue->setInt(_capacity); return _scValue; } else { diff --git a/engines/wintermute/base/scriptables/script_ext_string.h b/engines/wintermute/base/scriptables/script_ext_string.h index 255b9c57eb..00bffab3a9 100644 --- a/engines/wintermute/base/scriptables/script_ext_string.h +++ b/engines/wintermute/base/scriptables/script_ext_string.h @@ -38,7 +38,7 @@ class SXString : public BaseScriptable { public: virtual int scCompare(BaseScriptable *Val); DECLARE_PERSISTENT(SXString, BaseScriptable) - ScValue *scGetProperty(const char *name); + ScValue *scGetProperty(const Common::String &name); bool scSetProperty(const char *name, ScValue *value); bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); void scSetString(const char *val); diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp index 3fd6c4d5f2..250570f2b8 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.cpp +++ b/engines/wintermute/base/sound/base_sound_buffer.cpp @@ -26,12 +26,10 @@ * Copyright (c) 2011 Jan Nedoma */ -#include "engines/wintermute/base/file/base_file.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/sound/base_sound_manager.h" #include "engines/wintermute/base/sound/base_sound_buffer.h" #include "engines/wintermute/base/base_file_manager.h" -#include "engines/wintermute/utils/utils.h" #include "engines/wintermute/wintermute.h" #include "audio/audiostream.h" #include "audio/mixer.h" diff --git a/engines/wintermute/base/sound/base_sound_manager.cpp b/engines/wintermute/base/sound/base_sound_manager.cpp index f7788cd255..441793144d 100644 --- a/engines/wintermute/base/sound/base_sound_manager.cpp +++ b/engines/wintermute/base/sound/base_sound_manager.cpp @@ -32,6 +32,7 @@ #include "engines/wintermute/utils/string_util.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/sound/base_sound_buffer.h" #include "engines/wintermute/wintermute.h" #include "common/config-manager.h" |