diff options
Diffstat (limited to 'engines/wintermute')
107 files changed, 603 insertions, 688 deletions
diff --git a/engines/wintermute/ad/ad_actor.cpp b/engines/wintermute/ad/ad_actor.cpp index 9087d66844..d175855d1e 100644 --- a/engines/wintermute/ad/ad_actor.cpp +++ b/engines/wintermute/ad/ad_actor.cpp @@ -602,13 +602,13 @@ bool AdActor::update() { } // finished playing animation? - if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->_finished) { + if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) { _state = _nextState; _nextState = STATE_READY; _currentSprite = _animSprite; } - if (_state == STATE_PLAYING_ANIM_SET && _animSprite2 != NULL && _animSprite2->_finished) { + if (_state == STATE_PLAYING_ANIM_SET && _animSprite2 != NULL && _animSprite2->isFinished()) { _state = _nextState; _nextState = STATE_READY; _currentSprite = _animSprite2; @@ -649,7 +649,7 @@ bool AdActor::update() { ////////////////////////////////////////////////////////////////////////// case STATE_TURNING_LEFT: - if (_tempSprite2 == NULL || _tempSprite2->_finished) { + if (_tempSprite2 == NULL || _tempSprite2->isFinished()) { if (_dir > 0) { _dir = (TDirection)(_dir - 1); } else { @@ -686,7 +686,7 @@ bool AdActor::update() { ////////////////////////////////////////////////////////////////////////// case STATE_TURNING_RIGHT: - if (_tempSprite2 == NULL || _tempSprite2->_finished) { + if (_tempSprite2 == NULL || _tempSprite2->isFinished()) { _dir = (TDirection)(_dir + 1); if ((int)_dir >= (int)NUM_DIRECTIONS) { @@ -753,7 +753,7 @@ bool AdActor::update() { } bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime); - if (_tempSprite2 == NULL || _tempSprite2->_finished || (/*_tempSprite2->_looping &&*/ timeIsUp)) { + if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) { if (timeIsUp) { _sentence->finish(); _tempSprite2 = NULL; @@ -798,7 +798,7 @@ bool AdActor::update() { if (_currentSprite && !already_moved) { _currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100); - if (_currentSprite->_changed) { + if (_currentSprite->isChanged()) { _posX += _currentSprite->_moveX; _posY += _currentSprite->_moveY; afterMove(); @@ -830,7 +830,7 @@ void AdActor::followPath() { // are there points to follow? if (_path->getCurrent() != NULL) { - _state = STATE_FOLLOWING_PATH;; + _state = STATE_FOLLOWING_PATH; initLine(BasePoint(_posX, _posY), *_path->getCurrent()); } else { if (_afterWalkDir != DI_NONE) { @@ -858,7 +858,7 @@ void AdActor::getNextStep() { } _currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100, _zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100); - if (!_currentSprite->_changed) { + if (!_currentSprite->isChanged()) { return; } @@ -1075,27 +1075,27 @@ bool AdActor::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *AdActor::scGetProperty(const char *name) { +ScValue *AdActor::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Direction ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Direction") == 0) { + if (name == "Direction") { _scValue->setInt(_dir); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Type") == 0) { + else if (name == "Type") { _scValue->setString("actor"); return _scValue; } ////////////////////////////////////////////////////////////////////////// // TalkAnimName ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TalkAnimName") == 0) { + else if (name == "TalkAnimName") { _scValue->setString(_talkAnimName); return _scValue; } @@ -1103,7 +1103,7 @@ ScValue *AdActor::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // WalkAnimName ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "WalkAnimName") == 0) { + else if (name == "WalkAnimName") { _scValue->setString(_walkAnimName); return _scValue; } @@ -1111,7 +1111,7 @@ ScValue *AdActor::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // IdleAnimName ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "IdleAnimName") == 0) { + else if (name == "IdleAnimName") { _scValue->setString(_idleAnimName); return _scValue; } @@ -1119,7 +1119,7 @@ ScValue *AdActor::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // TurnLeftAnimName ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TurnLeftAnimName") == 0) { + else if (name == "TurnLeftAnimName") { _scValue->setString(_turnLeftAnimName); return _scValue; } @@ -1127,7 +1127,7 @@ ScValue *AdActor::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // TurnRightAnimName ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TurnRightAnimName") == 0) { + else if (name == "TurnRightAnimName") { _scValue->setString(_turnRightAnimName); return _scValue; } else { @@ -1351,7 +1351,7 @@ bool AdActor::persist(BasePersistenceManager *persistMgr) { ////////////////////////////////////////////////////////////////////////// TDirection AdActor::angleToDirection(int angle) { - TDirection ret = DI_DOWN;; + TDirection ret = DI_DOWN; if (angle > -112 && angle <= -67) { ret = DI_UP; diff --git a/engines/wintermute/ad/ad_actor.h b/engines/wintermute/ad/ad_actor.h index 271e57cb85..543c9d063a 100644 --- a/engines/wintermute/ad/ad_actor.h +++ b/engines/wintermute/ad/ad_actor.h @@ -83,7 +83,7 @@ private: AdSpriteSet *getAnimByName(const Common::String &animName); // 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/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp index 234af1fffa..9af7e034ca 100644 --- a/engines/wintermute/ad/ad_entity.cpp +++ b/engines/wintermute/ad/ad_entity.cpp @@ -28,28 +28,29 @@ #include "engines/wintermute/ad/ad_entity.h" -#include "engines/wintermute/base/base_parser.h" -#include "engines/wintermute/base/base_dynamic_buffer.h" -#include "engines/wintermute/base/base_active_rect.h" -#include "engines/wintermute/base/base_surface_storage.h" -#include "engines/wintermute/base/base_game.h" #include "engines/wintermute/ad/ad_game.h" #include "engines/wintermute/ad/ad_scene.h" -#include "engines/wintermute/base/sound/base_sound.h" #include "engines/wintermute/ad/ad_waypoint_group.h" -#include "engines/wintermute/base/font/base_font_storage.h" -#include "engines/wintermute/base/font/base_font.h" #include "engines/wintermute/ad/ad_sentence.h" +#include "engines/wintermute/base/base_active_rect.h" +#include "engines/wintermute/base/base_dynamic_buffer.h" +#include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/base/base_game.h" +#include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_region.h" #include "engines/wintermute/base/base_sprite.h" -#include "engines/wintermute/base/base_file_manager.h" -#include "engines/wintermute/platform_osystem.h" -#include "engines/wintermute/utils/utils.h" +#include "engines/wintermute/base/base_surface_storage.h" +#include "engines/wintermute/base/font/base_font_storage.h" +#include "engines/wintermute/base/font/base_font.h" +#include "engines/wintermute/base/gfx/base_renderer.h" +#include "engines/wintermute/base/particles/part_emitter.h" #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/base/scriptables/script_stack.h" +#include "engines/wintermute/base/sound/base_sound.h" #include "engines/wintermute/video/video_theora_player.h" -#include "engines/wintermute/base/particles/part_emitter.h" +#include "engines/wintermute/utils/utils.h" +#include "engines/wintermute/platform_osystem.h" #include "common/str.h" namespace Wintermute { @@ -577,7 +578,7 @@ bool AdEntity::update() { } // finished playing animation? - if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->_finished) { + if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) { _state = STATE_READY; _currentSprite = _animSprite; } @@ -612,7 +613,7 @@ bool AdEntity::update() { } bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime); - if (_tempSprite2 == NULL || _tempSprite2->_finished || (/*_tempSprite2->_looping &&*/ timeIsUp)) { + if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) { if (timeIsUp) { _sentence->finish(); _tempSprite2 = NULL; @@ -638,7 +639,7 @@ bool AdEntity::update() { if (_currentSprite) { _currentSprite->getCurrentFrame(_zoomable ? ((AdGame *)_gameRef)->_scene->getZoomAt(_posX, _posY) : 100); - if (_currentSprite->_changed) { + if (_currentSprite->isChanged()) { _posX += _currentSprite->_moveX; _posY += _currentSprite->_moveY; } @@ -828,13 +829,13 @@ bool AdEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack ////////////////////////////////////////////////////////////////////////// -ScValue *AdEntity::scGetProperty(const char *name) { +ScValue *AdEntity::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type (RO) ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("entity"); return _scValue; } @@ -842,7 +843,7 @@ ScValue *AdEntity::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Item ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Item") == 0) { + else if (name == "Item") { if (_item) { _scValue->setString(_item); } else { @@ -855,7 +856,7 @@ ScValue *AdEntity::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Subtype (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Subtype") == 0) { + else if (name == "Subtype") { if (_subtype == ENTITY_SOUND) { _scValue->setString("sound"); } else { @@ -868,7 +869,7 @@ ScValue *AdEntity::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // WalkToX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "WalkToX") == 0) { + else if (name == "WalkToX") { _scValue->setInt(_walkToX); return _scValue; } @@ -876,7 +877,7 @@ ScValue *AdEntity::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // WalkToY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "WalkToY") == 0) { + else if (name == "WalkToY") { _scValue->setInt(_walkToY); return _scValue; } @@ -884,7 +885,7 @@ ScValue *AdEntity::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // WalkToDirection ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "WalkToDirection") == 0) { + else if (name == "WalkToDirection") { _scValue->setInt((int)_walkToDir); return _scValue; } @@ -892,7 +893,7 @@ ScValue *AdEntity::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Region (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Region") == 0) { + else if (name == "Region") { if (_region) { _scValue->setNative(_region, true); } else { diff --git a/engines/wintermute/ad/ad_entity.h b/engines/wintermute/ad/ad_entity.h index 39dc133eef..415987e50a 100644 --- a/engines/wintermute/ad/ad_entity.h +++ b/engines/wintermute/ad/ad_entity.h @@ -56,7 +56,7 @@ public: TEntityType _subtype; // 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/ad/ad_game.cpp b/engines/wintermute/ad/ad_game.cpp index fe8a5991e2..4481b774c1 100644 --- a/engines/wintermute/ad/ad_game.cpp +++ b/engines/wintermute/ad/ad_game.cpp @@ -50,6 +50,7 @@ #include "engines/wintermute/base/base_viewport.h" #include "engines/wintermute/base/particles/part_emitter.h" #include "engines/wintermute/base/saveload.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/scriptables/script_engine.h" #include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/base/scriptables/script_stack.h" @@ -875,20 +876,20 @@ bool AdGame::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *AdGame::scGetProperty(const char *name) { +ScValue *AdGame::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("game"); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Scene ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Scene") == 0) { + else if (name == "Scene") { if (_scene) { _scValue->setNative(_scene, true); } else { @@ -900,7 +901,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SelectedItem ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SelectedItem") == 0) { + else if (name == "SelectedItem") { //if (_selectedItem) _scValue->setString(_selectedItem->_name); if (_selectedItem) { _scValue->setNative(_selectedItem, true); @@ -913,14 +914,14 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumItems ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumItems") == 0) { + else if (name == "NumItems") { return _invObject->scGetProperty(name); } ////////////////////////////////////////////////////////////////////////// // SmartItemCursor ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SmartItemCursor") == 0) { + else if (name == "SmartItemCursor") { _scValue->setBool(_smartItemCursor); return _scValue; } @@ -928,7 +929,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // InventoryVisible ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "InventoryVisible") == 0) { + else if (name == "InventoryVisible") { _scValue->setBool(_inventoryBox && _inventoryBox->_visible); return _scValue; } @@ -936,7 +937,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // InventoryScrollOffset ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "InventoryScrollOffset") == 0) { + else if (name == "InventoryScrollOffset") { if (_inventoryBox) { _scValue->setInt(_inventoryBox->_scrollOffset); } else { @@ -949,7 +950,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ResponsesVisible (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ResponsesVisible") == 0) { + else if (name == "ResponsesVisible") { _scValue->setBool(_stateEx == GAME_WAITING_RESPONSE); return _scValue; } @@ -957,7 +958,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // PrevScene / PreviousScene (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "PrevScene") == 0 || strcmp(name, "PreviousScene") == 0) { + else if (name == "PrevScene" || name == "PreviousScene") { if (!_prevSceneName) { _scValue->setString(""); } else { @@ -969,7 +970,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // PrevSceneFilename / PreviousSceneFilename (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "PrevSceneFilename") == 0 || strcmp(name, "PreviousSceneFilename") == 0) { + else if (name == "PrevSceneFilename" || name == "PreviousSceneFilename") { if (!_prevSceneFilename) { _scValue->setString(""); } else { @@ -981,7 +982,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // LastResponse (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "LastResponse") == 0) { + else if (name == "LastResponse") { if (!_responseBox || !_responseBox->_lastResponseText) { _scValue->setString(""); } else { @@ -993,7 +994,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // LastResponseOrig (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "LastResponseOrig") == 0) { + else if (name == "LastResponseOrig") { if (!_responseBox || !_responseBox->_lastResponseTextOrig) { _scValue->setString(""); } else { @@ -1005,7 +1006,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // InventoryObject ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "InventoryObject") == 0) { + else if (name == "InventoryObject") { if (_inventoryOwner == _invObject) { _scValue->setNative(this, true); } else { @@ -1018,7 +1019,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // TotalNumItems ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TotalNumItems") == 0) { + else if (name == "TotalNumItems") { _scValue->setInt(_items.size()); return _scValue; } @@ -1026,7 +1027,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // TalkSkipButton ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TalkSkipButton") == 0) { + else if (name == "TalkSkipButton") { _scValue->setInt(_talkSkipButton); return _scValue; } @@ -1034,7 +1035,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ChangingScene ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ChangingScene") == 0) { + else if (name == "ChangingScene") { _scValue->setBool(_scheduledScene != NULL); return _scValue; } @@ -1042,7 +1043,7 @@ ScValue *AdGame::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // StartupScene ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "StartupScene") == 0) { + else if (name == "StartupScene") { if (!_startupScene) { _scValue->setNULL(); } else { diff --git a/engines/wintermute/ad/ad_game.h b/engines/wintermute/ad/ad_game.h index 46427331bf..81c79a3da8 100644 --- a/engines/wintermute/ad/ad_game.h +++ b/engines/wintermute/ad/ad_game.h @@ -126,7 +126,7 @@ public: bool loadItemsBuffer(byte *buffer, bool merge = false); // 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); bool validMouse(); diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp index 16b8e01ff3..7ae8ff8d69 100644 --- a/engines/wintermute/ad/ad_inventory_box.cpp +++ b/engines/wintermute/ad/ad_inventory_box.cpp @@ -35,6 +35,7 @@ #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/base/base_viewport.h" #include "engines/wintermute/base/base_dynamic_buffer.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/ui/ui_button.h" #include "engines/wintermute/ui/ui_window.h" #include "engines/wintermute/platform_osystem.h" diff --git a/engines/wintermute/ad/ad_item.cpp b/engines/wintermute/ad/ad_item.cpp index afd813933b..427b1c7db4 100644 --- a/engines/wintermute/ad/ad_item.cpp +++ b/engines/wintermute/ad/ad_item.cpp @@ -36,11 +36,11 @@ #include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/sound/base_sound.h" #include "engines/wintermute/base/base_sprite.h" -#include "engines/wintermute/utils/utils.h" -#include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/base/scriptables/script_stack.h" #include "engines/wintermute/base/scriptables/script_value.h" +#include "engines/wintermute/utils/utils.h" +#include "engines/wintermute/platform_osystem.h" #include "common/str.h" namespace Wintermute { @@ -340,7 +340,7 @@ bool AdItem::update() { } // finished playing animation? - if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->_finished) { + if (_state == STATE_PLAYING_ANIM && _animSprite != NULL && _animSprite->isFinished()) { _state = STATE_READY; _currentSprite = _animSprite; } @@ -379,7 +379,7 @@ bool AdItem::update() { } bool timeIsUp = (_sentence->_sound && _sentence->_soundStarted && (!_sentence->_sound->isPlaying() && !_sentence->_sound->isPaused())) || (!_sentence->_sound && _sentence->_duration <= _gameRef->_timer - _sentence->_startTime); - if (_tempSprite2 == NULL || _tempSprite2->_finished || (/*_tempSprite2->_looping &&*/ timeIsUp)) { + if (_tempSprite2 == NULL || _tempSprite2->isFinished() || (/*_tempSprite2->_looping &&*/ timeIsUp)) { if (timeIsUp) { _sentence->finish(); _tempSprite2 = NULL; @@ -614,13 +614,13 @@ bool AdItem::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *AdItem::scGetProperty(const char *name) { +ScValue *AdItem::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("item"); return _scValue; } @@ -628,7 +628,7 @@ ScValue *AdItem::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Name") == 0) { + else if (name == "Name") { _scValue->setString(getName()); return _scValue; } @@ -636,7 +636,7 @@ ScValue *AdItem::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // DisplayAmount ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "DisplayAmount") == 0) { + else if (name == "DisplayAmount") { _scValue->setBool(_displayAmount); return _scValue; } @@ -644,7 +644,7 @@ ScValue *AdItem::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Amount ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Amount") == 0) { + else if (name == "Amount") { _scValue->setInt(_amount); return _scValue; } @@ -652,7 +652,7 @@ ScValue *AdItem::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AmountOffsetX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AmountOffsetX") == 0) { + else if (name == "AmountOffsetX") { _scValue->setInt(_amountOffsetX); return _scValue; } @@ -660,7 +660,7 @@ ScValue *AdItem::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AmountOffsetY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AmountOffsetY") == 0) { + else if (name == "AmountOffsetY") { _scValue->setInt(_amountOffsetY); return _scValue; } @@ -668,7 +668,7 @@ ScValue *AdItem::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AmountAlign ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AmountAlign") == 0) { + else if (name == "AmountAlign") { _scValue->setInt(_amountAlign); return _scValue; } @@ -676,7 +676,7 @@ ScValue *AdItem::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AmountString ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AmountString") == 0) { + else if (name == "AmountString") { if (!_amountString) { _scValue->setNULL(); } else { @@ -688,7 +688,7 @@ ScValue *AdItem::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // CursorCombined ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "CursorCombined") == 0) { + else if (name == "CursorCombined") { _scValue->setBool(_cursorCombined); return _scValue; } else { diff --git a/engines/wintermute/ad/ad_item.h b/engines/wintermute/ad/ad_item.h index 6047c542c1..79978f9f72 100644 --- a/engines/wintermute/ad/ad_item.h +++ b/engines/wintermute/ad/ad_item.h @@ -51,7 +51,7 @@ public: bool loadBuffer(byte *buffer, bool complete = true); // 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/ad/ad_layer.cpp b/engines/wintermute/ad/ad_layer.cpp index 46b75b8b21..209c12b7a2 100644 --- a/engines/wintermute/ad/ad_layer.cpp +++ b/engines/wintermute/ad/ad_layer.cpp @@ -29,12 +29,12 @@ #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/ad/ad_layer.h" #include "engines/wintermute/ad/ad_scene_node.h" -#include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_dynamic_buffer.h" +#include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/base/scriptables/script_stack.h" -#include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/platform_osystem.h" #include "common/str.h" @@ -376,13 +376,13 @@ bool AdLayer::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *AdLayer::scGetProperty(const char *name) { +ScValue *AdLayer::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("layer"); return _scValue; } @@ -390,7 +390,7 @@ ScValue *AdLayer::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumNodes (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumNodes") == 0) { + else if (name == "NumNodes") { _scValue->setInt(_nodes.size()); return _scValue; } @@ -398,7 +398,7 @@ ScValue *AdLayer::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Width ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Width") == 0) { + else if (name == "Width") { _scValue->setInt(_width); return _scValue; } @@ -406,7 +406,7 @@ ScValue *AdLayer::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Height ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Height") == 0) { + else if (name == "Height") { _scValue->setInt(_height); return _scValue; } @@ -414,7 +414,7 @@ ScValue *AdLayer::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Main (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Main") == 0) { + else if (name == "Main") { _scValue->setBool(_main); return _scValue; } @@ -422,7 +422,7 @@ ScValue *AdLayer::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // CloseUp ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "CloseUp") == 0) { + else if (name == "CloseUp") { _scValue->setBool(_closeUp); return _scValue; } @@ -430,7 +430,7 @@ ScValue *AdLayer::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Active ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Active") == 0) { + else if (name == "Active") { _scValue->setBool(_active); return _scValue; } else { diff --git a/engines/wintermute/ad/ad_layer.h b/engines/wintermute/ad/ad_layer.h index bb5f73b13a..de65e2822f 100644 --- a/engines/wintermute/ad/ad_layer.h +++ b/engines/wintermute/ad/ad_layer.h @@ -47,7 +47,7 @@ public: virtual 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(); diff --git a/engines/wintermute/ad/ad_object.cpp b/engines/wintermute/ad/ad_object.cpp index 6c77917979..7b91daab2e 100644 --- a/engines/wintermute/ad/ad_object.cpp +++ b/engines/wintermute/ad/ad_object.cpp @@ -37,18 +37,19 @@ #include "engines/wintermute/ad/ad_waypoint_group.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_frame.h" -#include "engines/wintermute/base/sound/base_sound.h" -#include "engines/wintermute/base/base_surface_storage.h" +#include "engines/wintermute/base/base_sprite.h" +#include "engines/wintermute/base/base_string_table.h" #include "engines/wintermute/base/base_sub_frame.h" +#include "engines/wintermute/base/base_surface_storage.h" #include "engines/wintermute/base/font/base_font.h" #include "engines/wintermute/base/font/base_font_storage.h" -#include "engines/wintermute/base/base_sprite.h" -#include "engines/wintermute/base/base_string_table.h" +#include "engines/wintermute/base/gfx/base_renderer.h" +#include "engines/wintermute/base/particles/part_emitter.h" #include "engines/wintermute/base/scriptables/script_engine.h" #include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/base/scriptables/script_stack.h" #include "engines/wintermute/base/scriptables/script_value.h" -#include "engines/wintermute/base/particles/part_emitter.h" +#include "engines/wintermute/base/sound/base_sound.h" #include "common/str.h" #include "common/util.h" @@ -658,13 +659,13 @@ bool AdObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack ////////////////////////////////////////////////////////////////////////// -ScValue *AdObject::scGetProperty(const char *name) { +ScValue *AdObject::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("object"); return _scValue; } @@ -672,7 +673,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Active ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Active") == 0) { + else if (name == "Active") { _scValue->setBool(_active); return _scValue; } @@ -680,7 +681,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // IgnoreItems ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "IgnoreItems") == 0) { + else if (name == "IgnoreItems") { _scValue->setBool(_ignoreItems); return _scValue; } @@ -688,7 +689,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SceneIndependent ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SceneIndependent") == 0) { + else if (name == "SceneIndependent") { _scValue->setBool(_sceneIndependent); return _scValue; } @@ -696,7 +697,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SubtitlesWidth ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SubtitlesWidth") == 0) { + else if (name == "SubtitlesWidth") { _scValue->setInt(_subtitlesWidth); return _scValue; } @@ -704,7 +705,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SubtitlesPosRelative ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SubtitlesPosRelative") == 0) { + else if (name == "SubtitlesPosRelative") { _scValue->setBool(_subtitlesModRelative); return _scValue; } @@ -712,7 +713,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SubtitlesPosX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SubtitlesPosX") == 0) { + else if (name == "SubtitlesPosX") { _scValue->setInt(_subtitlesModX); return _scValue; } @@ -720,7 +721,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SubtitlesPosY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SubtitlesPosY") == 0) { + else if (name == "SubtitlesPosY") { _scValue->setInt(_subtitlesModY); return _scValue; } @@ -728,7 +729,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SubtitlesPosXCenter ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SubtitlesPosXCenter") == 0) { + else if (name == "SubtitlesPosXCenter") { _scValue->setBool(_subtitlesModXCenter); return _scValue; } @@ -736,7 +737,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumItems (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumItems") == 0) { + else if (name == "NumItems") { _scValue->setInt(getInventory()->_takenItems.size()); return _scValue; } @@ -744,7 +745,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ParticleEmitter (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ParticleEmitter") == 0) { + else if (name == "ParticleEmitter") { if (_partEmitter) { _scValue->setNative(_partEmitter, true); } else { @@ -757,7 +758,7 @@ ScValue *AdObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumAttachments (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumAttachments") == 0) { + else if (name == "NumAttachments") { _scValue->setInt(_attachmentsPre.size() + _attachmentsPost.size()); return _scValue; } else { diff --git a/engines/wintermute/ad/ad_object.h b/engines/wintermute/ad/ad_object.h index 8395f58cff..d1a20908e1 100644 --- a/engines/wintermute/ad/ad_object.h +++ b/engines/wintermute/ad/ad_object.h @@ -100,7 +100,7 @@ public: AdRegion *_currentRegions[MAX_NUM_REGIONS]; // 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/ad/ad_region.cpp b/engines/wintermute/ad/ad_region.cpp index 88bd8201a2..c9f1553c9a 100644 --- a/engines/wintermute/ad/ad_region.cpp +++ b/engines/wintermute/ad/ad_region.cpp @@ -27,12 +27,12 @@ */ #include "engines/wintermute/ad/ad_region.h" -#include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_dynamic_buffer.h" -#include "engines/wintermute/base/scriptables/script_value.h" -#include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/base/base_parser.h" +#include "engines/wintermute/base/scriptables/script_value.h" +#include "engines/wintermute/base/scriptables/script.h" namespace Wintermute { @@ -242,13 +242,13 @@ bool AdRegion::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack ////////////////////////////////////////////////////////////////////////// -ScValue *AdRegion::scGetProperty(const char *name) { +ScValue *AdRegion::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("ad region"); return _scValue; } @@ -256,7 +256,7 @@ ScValue *AdRegion::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Name") == 0) { + else if (name == "Name") { _scValue->setString(getName()); return _scValue; } @@ -264,7 +264,7 @@ ScValue *AdRegion::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Blocked ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Blocked") == 0) { + else if (name == "Blocked") { _scValue->setBool(_blocked); return _scValue; } @@ -272,7 +272,7 @@ ScValue *AdRegion::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Decoration ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Decoration") == 0) { + else if (name == "Decoration") { _scValue->setBool(_decoration); return _scValue; } @@ -280,7 +280,7 @@ ScValue *AdRegion::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Scale ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Scale") == 0) { + else if (name == "Scale") { _scValue->setFloat(_zoom); return _scValue; } @@ -288,7 +288,7 @@ ScValue *AdRegion::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AlphaColor ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AlphaColor") == 0) { + else if (name == "AlphaColor") { _scValue->setInt((int)_alpha); return _scValue; } else { diff --git a/engines/wintermute/ad/ad_region.h b/engines/wintermute/ad/ad_region.h index a60cb9a3f2..6112900361 100644 --- a/engines/wintermute/ad/ad_region.h +++ b/engines/wintermute/ad/ad_region.h @@ -47,7 +47,7 @@ public: virtual 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(); diff --git a/engines/wintermute/ad/ad_response.cpp b/engines/wintermute/ad/ad_response.cpp index 37f46118bf..a2225f2632 100644 --- a/engines/wintermute/ad/ad_response.cpp +++ b/engines/wintermute/ad/ad_response.cpp @@ -28,8 +28,8 @@ #include "engines/wintermute/ad/ad_response.h" #include "engines/wintermute/base/base_game.h" -#include "engines/wintermute/base/font/base_font_storage.h" #include "engines/wintermute/base/base_sprite.h" +#include "engines/wintermute/base/font/base_font_storage.h" #include "engines/wintermute/utils/utils.h" namespace Wintermute { diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp index a27f1ca54b..fb31aa0bb8 100644 --- a/engines/wintermute/ad/ad_response_box.cpp +++ b/engines/wintermute/ad/ad_response_box.cpp @@ -27,19 +27,20 @@ */ #include "engines/wintermute/ad/ad_game.h" +#include "engines/wintermute/ad/ad_response.h" #include "engines/wintermute/ad/ad_response_box.h" +#include "engines/wintermute/base/base_dynamic_buffer.h" +#include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/base/base_parser.h" +#include "engines/wintermute/base/base_sprite.h" #include "engines/wintermute/base/base_surface_storage.h" -#include "engines/wintermute/ui/ui_button.h" -#include "engines/wintermute/ui/ui_window.h" -#include "engines/wintermute/base/base_dynamic_buffer.h" #include "engines/wintermute/base/font/base_font_storage.h" #include "engines/wintermute/base/font/base_font.h" -#include "engines/wintermute/ad/ad_response.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/base/scriptables/script_stack.h" -#include "engines/wintermute/base/base_sprite.h" -#include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/ui/ui_button.h" +#include "engines/wintermute/ui/ui_window.h" #include "engines/wintermute/utils/utils.h" #include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/wintermute.h" diff --git a/engines/wintermute/ad/ad_rot_level.cpp b/engines/wintermute/ad/ad_rot_level.cpp index ca7ed693ad..fb9a4a47b9 100644 --- a/engines/wintermute/ad/ad_rot_level.cpp +++ b/engines/wintermute/ad/ad_rot_level.cpp @@ -27,11 +27,11 @@ */ #include "engines/wintermute/ad/ad_rot_level.h" -#include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_dynamic_buffer.h" +#include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/base/base_game.h" +#include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_sprite.h" -#include "engines/wintermute/base/base_file_manager.h" namespace Wintermute { diff --git a/engines/wintermute/ad/ad_scale_level.cpp b/engines/wintermute/ad/ad_scale_level.cpp index 8b68cc5d32..4e9293d875 100644 --- a/engines/wintermute/ad/ad_scale_level.cpp +++ b/engines/wintermute/ad/ad_scale_level.cpp @@ -28,9 +28,9 @@ #include "engines/wintermute/ad/ad_scale_level.h" #include "engines/wintermute/base/base_parser.h" -#include "engines/wintermute/base/base_dynamic_buffer.h" -#include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/base/base_game.h" +#include "engines/wintermute/base/base_dynamic_buffer.h" namespace Wintermute { diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp index e47acc63c9..8e9beca0c0 100644 --- a/engines/wintermute/ad/ad_scene.cpp +++ b/engines/wintermute/ad/ad_scene.cpp @@ -52,6 +52,7 @@ #include "engines/wintermute/base/base_scriptable.h" #include "engines/wintermute/base/base_sprite.h" #include "engines/wintermute/base/base_viewport.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/scriptables/script_stack.h" #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/base/scriptables/script.h" @@ -1808,13 +1809,13 @@ bool AdScene::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *AdScene::scGetProperty(const char *name) { +ScValue *AdScene::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("scene"); return _scValue; } @@ -1822,7 +1823,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumLayers (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumLayers") == 0) { + else if (name == "NumLayers") { _scValue->setInt(_layers.size()); return _scValue; } @@ -1830,7 +1831,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumWaypointGroups (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumWaypointGroups") == 0) { + else if (name == "NumWaypointGroups") { _scValue->setInt(_waypointGroups.size()); return _scValue; } @@ -1838,7 +1839,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MainLayer (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MainLayer") == 0) { + else if (name == "MainLayer") { if (_mainLayer) { _scValue->setNative(_mainLayer, true); } else { @@ -1851,7 +1852,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumFreeNodes (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumFreeNodes") == 0) { + else if (name == "NumFreeNodes") { _scValue->setInt(_objects.size()); return _scValue; } @@ -1859,7 +1860,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MouseX (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MouseX") == 0) { + else if (name == "MouseX") { int viewportX; getViewportOffset(&viewportX); @@ -1870,7 +1871,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MouseY (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MouseY") == 0) { + else if (name == "MouseY") { int viewportY; getViewportOffset(NULL, &viewportY); @@ -1881,7 +1882,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // AutoScroll ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "AutoScroll") == 0) { + else if (name == "AutoScroll") { _scValue->setBool(_autoScroll); return _scValue; } @@ -1889,7 +1890,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // PersistentState ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "PersistentState") == 0) { + else if (name == "PersistentState") { _scValue->setBool(_persistentState); return _scValue; } @@ -1897,7 +1898,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // PersistentStateSprites ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "PersistentStateSprites") == 0) { + else if (name == "PersistentStateSprites") { _scValue->setBool(_persistentStateSprites); return _scValue; } @@ -1905,7 +1906,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ScrollPixelsX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ScrollPixelsX") == 0) { + else if (name == "ScrollPixelsX") { _scValue->setInt(_scrollPixelsH); return _scValue; } @@ -1913,7 +1914,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ScrollPixelsY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ScrollPixelsY") == 0) { + else if (name == "ScrollPixelsY") { _scValue->setInt(_scrollPixelsV); return _scValue; } @@ -1922,7 +1923,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ScrollSpeedX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ScrollSpeedX") == 0) { + else if (name == "ScrollSpeedX") { _scValue->setInt(_scrollTimeH); return _scValue; } @@ -1930,7 +1931,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ScrollSpeedY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ScrollSpeedY") == 0) { + else if (name == "ScrollSpeedY") { _scValue->setInt(_scrollTimeV); return _scValue; } @@ -1938,7 +1939,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // OffsetX ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "OffsetX") == 0) { + else if (name == "OffsetX") { _scValue->setInt(_offsetLeft); return _scValue; } @@ -1946,7 +1947,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // OffsetY ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "OffsetY") == 0) { + else if (name == "OffsetY") { _scValue->setInt(_offsetTop); return _scValue; } @@ -1954,7 +1955,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Width (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Width") == 0) { + else if (name == "Width") { if (_mainLayer) { _scValue->setInt(_mainLayer->_width); } else { @@ -1966,7 +1967,7 @@ ScValue *AdScene::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Height (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Height") == 0) { + else if (name == "Height") { if (_mainLayer) { _scValue->setInt(_mainLayer->_height); } else { diff --git a/engines/wintermute/ad/ad_scene.h b/engines/wintermute/ad/ad_scene.h index c9c0e413bf..3b482403b5 100644 --- a/engines/wintermute/ad/ad_scene.h +++ b/engines/wintermute/ad/ad_scene.h @@ -156,7 +156,7 @@ public: int getPointsDist(BasePoint p1, BasePoint p2, BaseObject *requester = NULL); // 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/ad/ad_scene_state.cpp b/engines/wintermute/ad/ad_scene_state.cpp index c09e6a259c..6b34f1af53 100644 --- a/engines/wintermute/ad/ad_scene_state.cpp +++ b/engines/wintermute/ad/ad_scene_state.cpp @@ -26,9 +26,9 @@ * Copyright (c) 2011 Jan Nedoma */ -#include "engines/wintermute/persistent.h" #include "engines/wintermute/ad/ad_scene_state.h" #include "engines/wintermute/ad/ad_node_state.h" +#include "engines/wintermute/persistent.h" #include "engines/wintermute/platform_osystem.h" #include "common/str.h" diff --git a/engines/wintermute/ad/ad_sentence.cpp b/engines/wintermute/ad/ad_sentence.cpp index 1f09d3ae0f..cfe4191b07 100644 --- a/engines/wintermute/ad/ad_sentence.cpp +++ b/engines/wintermute/ad/ad_sentence.cpp @@ -26,17 +26,18 @@ * Copyright (c) 2011 Jan Nedoma */ +#include "engines/wintermute/ad/ad_game.h" +#include "engines/wintermute/ad/ad_scene.h" #include "engines/wintermute/ad/ad_sentence.h" #include "engines/wintermute/ad/ad_talk_def.h" #include "engines/wintermute/ad/ad_talk_node.h" -#include "engines/wintermute/ad/ad_game.h" #include "engines/wintermute/utils/path_util.h" #include "engines/wintermute/base/base_game.h" -#include "engines/wintermute/base/sound/base_sound.h" -#include "engines/wintermute/ad/ad_scene.h" -#include "engines/wintermute/base/font/base_font.h" #include "engines/wintermute/base/base_sprite.h" #include "engines/wintermute/base/base_file_manager.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" namespace Wintermute { diff --git a/engines/wintermute/ad/ad_sprite_set.cpp b/engines/wintermute/ad/ad_sprite_set.cpp index c8cdec03c3..345b483a8f 100644 --- a/engines/wintermute/ad/ad_sprite_set.cpp +++ b/engines/wintermute/ad/ad_sprite_set.cpp @@ -27,10 +27,10 @@ */ #include "engines/wintermute/ad/ad_sprite_set.h" -#include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_dynamic_buffer.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_sprite.h" namespace Wintermute { diff --git a/engines/wintermute/ad/ad_talk_def.cpp b/engines/wintermute/ad/ad_talk_def.cpp index 8cb489509b..a85cd7f986 100644 --- a/engines/wintermute/ad/ad_talk_def.cpp +++ b/engines/wintermute/ad/ad_talk_def.cpp @@ -26,13 +26,13 @@ * Copyright (c) 2011 Jan Nedoma */ +#include "engines/wintermute/ad/ad_sprite_set.h" #include "engines/wintermute/ad/ad_talk_def.h" #include "engines/wintermute/ad/ad_talk_node.h" #include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_dynamic_buffer.h" #include "engines/wintermute/base/base_sprite.h" -#include "engines/wintermute/ad/ad_sprite_set.h" #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/utils/utils.h" diff --git a/engines/wintermute/ad/ad_talk_holder.cpp b/engines/wintermute/ad/ad_talk_holder.cpp index 1e4ec26459..cca4fdc2cb 100644 --- a/engines/wintermute/ad/ad_talk_holder.cpp +++ b/engines/wintermute/ad/ad_talk_holder.cpp @@ -28,13 +28,13 @@ #include "engines/wintermute/ad/ad_talk_holder.h" #include "engines/wintermute/base/base_dynamic_buffer.h" +#include "engines/wintermute/base/base_engine.h" +#include "engines/wintermute/base/base_game.h" +#include "engines/wintermute/base/base_sprite.h" #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/base/scriptables/script_stack.h" -#include "engines/wintermute/base/base_game.h" -#include "engines/wintermute/base/base_sprite.h" #include "engines/wintermute/platform_osystem.h" -#include "engines/wintermute/base/base_engine.h" #include "common/str.h" namespace Wintermute { @@ -334,13 +334,13 @@ bool AdTalkHolder::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisS ////////////////////////////////////////////////////////////////////////// -ScValue *AdTalkHolder::scGetProperty(const char *name) { +ScValue *AdTalkHolder::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type (RO) ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("talk-holder"); return _scValue; } else { diff --git a/engines/wintermute/ad/ad_talk_holder.h b/engines/wintermute/ad/ad_talk_holder.h index ce10364b3d..d52ebf63c0 100644 --- a/engines/wintermute/ad/ad_talk_holder.h +++ b/engines/wintermute/ad/ad_talk_holder.h @@ -45,7 +45,7 @@ public: virtual ~AdTalkHolder(); // 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/ad/ad_talk_node.cpp b/engines/wintermute/ad/ad_talk_node.cpp index b43a2b288e..c909ee27ff 100644 --- a/engines/wintermute/ad/ad_talk_node.cpp +++ b/engines/wintermute/ad/ad_talk_node.cpp @@ -26,12 +26,12 @@ * Copyright (c) 2011 Jan Nedoma */ +#include "engines/wintermute/ad/ad_sprite_set.h" #include "engines/wintermute/ad/ad_talk_node.h" #include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_dynamic_buffer.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_sprite.h" -#include "engines/wintermute/ad/ad_sprite_set.h" #include "engines/wintermute/utils/utils.h" namespace Wintermute { @@ -264,9 +264,9 @@ bool AdTalkNode::loadSprite() { bool AdTalkNode::isInTimeInterval(uint32 time, TDirection dir) { if (time >= _startTime) { if (_playToEnd) { - if ((_spriteFilename && _sprite == NULL) || (_sprite && _sprite->_finished == false)) { + if ((_spriteFilename && _sprite == NULL) || (_sprite && _sprite->isFinished() == false)) { return true; - } else if ((_spriteSetFilename && _spriteSet == NULL) || (_spriteSet && _spriteSet->getSprite(dir) && _spriteSet->getSprite(dir)->_finished == false)) { + } else if ((_spriteSetFilename && _spriteSet == NULL) || (_spriteSet && _spriteSet->getSprite(dir) && _spriteSet->getSprite(dir)->isFinished() == false)) { return true; } else { return false; diff --git a/engines/wintermute/ad/ad_waypoint_group.cpp b/engines/wintermute/ad/ad_waypoint_group.cpp index 984ed75aeb..81493ce769 100644 --- a/engines/wintermute/ad/ad_waypoint_group.cpp +++ b/engines/wintermute/ad/ad_waypoint_group.cpp @@ -27,12 +27,12 @@ */ #include "engines/wintermute/ad/ad_waypoint_group.h" -#include "engines/wintermute/base/base_parser.h" #include "engines/wintermute/base/base_dynamic_buffer.h" -#include "engines/wintermute/base/scriptables/script_value.h" #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/base_parser.h" +#include "engines/wintermute/base/base_region.h" +#include "engines/wintermute/base/scriptables/script_value.h" #include <limits.h> namespace Wintermute { @@ -206,13 +206,13 @@ bool AdWaypointGroup::persist(BasePersistenceManager *persistMgr) { ////////////////////////////////////////////////////////////////////////// -ScValue *AdWaypointGroup::scGetProperty(const char *name) { +ScValue *AdWaypointGroup::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("waypoint-group"); return _scValue; } @@ -220,7 +220,7 @@ ScValue *AdWaypointGroup::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Active ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Active") == 0) { + else if (name == "Active") { _scValue->setBool(_active); return _scValue; } else { diff --git a/engines/wintermute/ad/ad_waypoint_group.h b/engines/wintermute/ad/ad_waypoint_group.h index 5cf6da1d1a..13d6bbadd7 100644 --- a/engines/wintermute/ad/ad_waypoint_group.h +++ b/engines/wintermute/ad/ad_waypoint_group.h @@ -49,7 +49,7 @@ public: virtual ~AdWaypointGroup(); BaseArray<BasePoint *> _points; int _editorSelectedPoint; - virtual ScValue *scGetProperty(const char *name); + virtual ScValue *scGetProperty(const Common::String &name); virtual bool scSetProperty(const char *name, ScValue *value); }; 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" diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index da01259b1b..9319899495 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -52,13 +52,13 @@ TransparentSurface::TransparentSurface(const Surface &surf, bool copyData) : Sur void doBlitOpaque(byte *ino, byte* outo, uint32 width, uint32 height, uint32 pitch, int32 inStep, int32 inoStep) { byte *in, *out; - + #ifdef SCUMM_LITTLE_ENDIAN const int aIndex = 3; #else const int aIndex = 0; #endif - + for (uint32 i = 0; i < height; i++) { out = outo; in = ino; @@ -121,7 +121,7 @@ void TransparentSurface::doBlitAlpha(byte *ino, byte* outo, uint32 width, uint32 int a = (pix >> aShift) & 0xff; int outb, outg, outr, outa; in += inStep; - + switch (a) { case 0: // Full transparency out += 4; diff --git a/engines/wintermute/persistent.h b/engines/wintermute/persistent.h index 5bcf30787d..c862df5d6b 100644 --- a/engines/wintermute/persistent.h +++ b/engines/wintermute/persistent.h @@ -52,7 +52,7 @@ namespace Wintermute { virtual bool persist(BasePersistenceManager* PersistMgr);\ void* operator new (size_t size);\ void operator delete(void* p);\ - + #define IMPLEMENT_PERSISTENT(class_name, persistent_class)\ const char class_name::_className[] = #class_name;\ @@ -80,7 +80,7 @@ namespace Wintermute { SystemClassRegistry::getInstance()->unregisterInstance(#class_name, p);\ ::operator delete(p);\ }\ - + #define TMEMBER(member_name) #member_name, &member_name #define TMEMBER_INT(member_name) #member_name, (int*)&member_name diff --git a/engines/wintermute/readme.txt b/engines/wintermute/readme.txt deleted file mode 100644 index 57592dac2a..0000000000 --- a/engines/wintermute/readme.txt +++ /dev/null @@ -1,155 +0,0 @@ -Wintermute Engine - Copyright (c) 2011 Jan Nedoma -ScummVM port by Einar Johan Trøan Sømåen (somaen) - -*************************** -*** General information *** -*************************** -The Wintermute Engine is a game engine mainly aimed at creating adventure -games, it supports both 3D, 2.5D, 2D and First-Person games, and has numerous -games both free, open-source and commercial created with it. This port was -created by somaen as part of Google Summer of Code 2012. - -**************** -*** Features *** -**************** -This port of the Wintermute Engine (WME) is based on WME Lite, which lacks the following functionality -originally found in WME: (from http://res.dead-code.org/doku.php/wmelite:start) - -The following features of WME 1.x are NOT supported by WME Lite: -* 3D characters. WME Lite only supports 2D games. -* Sprite frame mirroring. -* Sprite rotations. -* Sprite blending modes. -* Video playback. -* Plugins. -* Calling external functions from DLL libraries from scripts. -* Game Explorer support. -* 'Directory' script object. - -This port does reimplement a few of these features, currently: -* Sprite frame mirroring - WORKS. -* Video playback - Theora PARTIALLY WORKING. (Slow, and doesn't support seeking) - -In addition, this port removes a few additional features that were never/rarely used: -* 'File' script object - ScummVM doesn't have any easy way to write/read arbitrary files. -* Debugger/Compiler - weren't properly accessible in WME Lite anyhow. -* CD-numbering support in .dcp-files - was never used. -* 'SaveDirectory'-property of 'Game' will not return anything usefull to the game-scripts (saving is handled through SaveFileMan) - -******************************* -*** Additional limitations: *** -******************************* -* Only .OGG and RAW-.WAV sounds are supported at this point -* TTF-fonts might behave a bit differently, owing to both the change to FreeType in WME Lite - and the change in dpi in this port of WME. -* The window-caption-setting in-game will be ignored, for the sake of concistency with ScummVM. -* Most VKey-combinations might still be missing (as they already were in WME Lite) -* Since we don't use FreeImage, some games might use odd files that weren't expected when the - image-decoders in ScummVM were written. One example here is interlaced-PNGs. -* UTF8-support is not ported, which means only games with western charsets will work for now. -* Games that select language by moving .dcp-files around still need a bit more handling on detection/load - adding support for those languages on a language-by-language basis. -* Most games assume the availability of the Windows-fonts (particularly arial.ttf) - at this point no fallback has been put in place for using FreeFonts as replacements, - simply for lack of having them easily accessible to the engines at this point. So, at least - arial.ttf should be put in either the game-folder or made available through the extras-folder - for now, otherwise kGUIBigFont will be used as a replacement. - - -********************************* -*** Advanced engine-features: *** -********************************* -At this point the engine implements the following "advanced engine features": -* RTL ("Return to Launcher") support -* Global options dialog support -* Listing savestates via command line or Launcher -* Loading savestates via command line or Launcher -* Deleting savestates via the Launcher and GMM -* Savestate metadata support -* Loading/Saving during run time - -and NOT the following: -* Enhanced debug/error messages - -***************** -*** Detection *** -***************** -Since Wintermute has authoring tools available, there will at any point in -time be atleast a few games that are works-in-progress, and as the authors -of these games might want to test their games in ScummVM, the engine has -to be able to detect arbitrary Wintermute-games, to this end the detector -code in this engine will check any folder containing "data.dcp", and try to -read "startup.settings" and "default.game" (or optionally any other .game-file -defined in startup.settings), the Name/Caption fields in the .game-file will -be used as gameid/title (prefixing the gameid with "wmefan-" to avoid confusion -with any other WME game that might happen to have taken that id. - -All COMPLETED games should have their md5s and gameid's properly added, IFF -they don't require 3D. - -3D games may also be added, for the purpose of giving the user feedback -as to why their game won't run, but at this point, any such MD5 should -be added as a comment only, to avoid confusion, as no mechanism for giving -the user feedback about 3D-games not being supported is currently added. - -************************************* -*** Games targeted by the engine: *** -************************************* -This engine potentially targets a very large amount of games: -http://res.dead-code.org/doku.php/games:start - -Since the feature-set of WME Lite differs from that of the full Wintermute Engine, -games will need to be targeted on a case-by-case, feature-by-feature basis, this is -a list of the games that are currently known to work (although perhaps with minor -issues) through to completion: - -* Dirty Split (dirtysplit) -* the white chamber (twc) -* Chivalry is NOT dead (chivalry) -* Rosemary (rosemary) -* The Box (thebox) -* J.U.L.I.A. (Demo) (julia) -* Pigeons in the park (pigeons) - -Untested, but starts: -* East Side Story (Demo) (eastside) -* Actual Destination (actualdest) -* Ghost in the sheet (ghostsheet) - -******************************** -*** Games with known issues: *** -******************************** -Certain games will work mostly fine with this engine, but can still -be impossible to complete for various reasons, this is a list of games -that technically qualify (as in they do not require the 3D-parts of the engine) -but have issues that make them problematic or not completable: - -Won't start: -* Five Lethal Demons (5ld) - Requires support for interlaced PNGs -* Five Magical Amulets (5ma) - Requires support for interlaced PNGs -* Kulivoeko - Requires support for interlaced PNGs -* Reversion (reversion) - Requires support for Non-V1.1 JPEGs and interlaced PNGs -* Mirage (mirage) - Tries to seek in a vorbis-stream inside a ZipStream -* Hamlet or the last game without MMORPS features, shaders and product placement (hamlet) - - Requires support for interlaced PNGs - -Gameplay broken: -* J.U.L.I.A. (Full game) (julia) - Requires sprite-rotation for a puzzle. - -Non-critical: -* Ghost in the sheet (ghostsheet) - uses Non-V1.1-JPEGs -* East Side Story (eastside) - wants "framd.ttf" - -***************************** -*** General known issues: *** -***************************** - -Mostly a TODO-section, to not forget fixing outstanding general issues: -* Save/Load-screens are not shown during save/load - this is probably a result of reducing the amount of redrawing done - during save/load, and I'm not sure it should be put back, if that means - making saves slower again. -* Font-sizes are wrong enough to allow Dirty Split to draw text that is hidden in - the original game (most visible on the coin-interface) -* Alpha-masks for Theora-videos are broken on big-endian platforms - diff --git a/engines/wintermute/system/sys_class_registry.cpp b/engines/wintermute/system/sys_class_registry.cpp index 5e3b968c5c..7c1911c2bf 100644 --- a/engines/wintermute/system/sys_class_registry.cpp +++ b/engines/wintermute/system/sys_class_registry.cpp @@ -29,6 +29,7 @@ #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/platform_osystem.h" #include "engines/wintermute/base/base_engine.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/system/sys_instance.h" #include "engines/wintermute/system/sys_class_registry.h" #include "engines/wintermute/system/sys_class.h" diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index f2ac5b2fdd..7967d566f9 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.cpp @@ -37,6 +37,7 @@ #include "engines/wintermute/base/base_string_table.h" #include "engines/wintermute/base/base_sprite.h" #include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/scriptables/script_value.h" #include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/base/scriptables/script_stack.h" @@ -1081,13 +1082,13 @@ bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack ////////////////////////////////////////////////////////////////////////// -ScValue *UIButton::scGetProperty(const char *name) { +ScValue *UIButton::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("button"); return _scValue; } @@ -1095,7 +1096,7 @@ ScValue *UIButton::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // TextAlign ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TextAlign") == 0) { + else if (name == "TextAlign") { _scValue->setInt(_align); return _scValue; } @@ -1103,21 +1104,21 @@ ScValue *UIButton::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Focusable ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Focusable") == 0) { + else if (name == "Focusable") { _scValue->setBool(_canFocus); return _scValue; } ////////////////////////////////////////////////////////////////////////// // Pressed ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Pressed") == 0) { + else if (name == "Pressed") { _scValue->setBool(_stayPressed); return _scValue; } ////////////////////////////////////////////////////////////////////////// // PixelPerfect ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "PixelPerfect") == 0) { + else if (name == "PixelPerfect") { _scValue->setBool(_pixelPerfect); return _scValue; } else { diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h index 9342f766cc..93333a2534 100644 --- a/engines/wintermute/ui/ui_button.h +++ b/engines/wintermute/ui/ui_button.h @@ -69,7 +69,7 @@ public: virtual 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(); diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index 94d11255ce..a3283d5a01 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -40,6 +40,7 @@ #include "engines/wintermute/base/base_sprite.h" #include "engines/wintermute/base/base_string_table.h" #include "engines/wintermute/base/base_game.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" #include "engines/wintermute/base/scriptables/script.h" @@ -397,13 +398,13 @@ bool UIEdit::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *UIEdit::scGetProperty(const char *name) { +ScValue *UIEdit::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("editor"); return _scValue; } @@ -411,7 +412,7 @@ ScValue *UIEdit::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SelStart ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SelStart") == 0) { + else if (name == "SelStart") { _scValue->setInt(_selStart); return _scValue; } @@ -419,7 +420,7 @@ ScValue *UIEdit::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SelEnd ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SelEnd") == 0) { + else if (name == "SelEnd") { _scValue->setInt(_selEnd); return _scValue; } @@ -427,7 +428,7 @@ ScValue *UIEdit::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // CursorBlinkRate ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "CursorBlinkRate") == 0) { + else if (name == "CursorBlinkRate") { _scValue->setInt(_cursorBlinkRate); return _scValue; } @@ -435,7 +436,7 @@ ScValue *UIEdit::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // CursorChar ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "CursorChar") == 0) { + else if (name == "CursorChar") { _scValue->setString(_cursorChar); return _scValue; } @@ -443,7 +444,7 @@ ScValue *UIEdit::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // FrameWidth ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "FrameWidth") == 0) { + else if (name == "FrameWidth") { _scValue->setInt(_frameWidth); return _scValue; } @@ -451,7 +452,7 @@ ScValue *UIEdit::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // MaxLength ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "MaxLength") == 0) { + else if (name == "MaxLength") { _scValue->setInt(_maxLength); return _scValue; } @@ -459,7 +460,7 @@ ScValue *UIEdit::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Text ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Text") == 0) { + else if (name == "Text") { if (_gameRef->_textEncoding == TEXT_UTF8) { WideString wstr = StringUtil::ansiToWide(_text); _scValue->setString(StringUtil::wideToUtf8(wstr).c_str()); diff --git a/engines/wintermute/ui/ui_edit.h b/engines/wintermute/ui/ui_edit.h index 610629afb3..5bb31422b6 100644 --- a/engines/wintermute/ui/ui_edit.h +++ b/engines/wintermute/ui/ui_edit.h @@ -61,7 +61,7 @@ public: virtual 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(); diff --git a/engines/wintermute/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp index c49cb5a240..1cb4e0926b 100644 --- a/engines/wintermute/ui/ui_entity.cpp +++ b/engines/wintermute/ui/ui_entity.cpp @@ -305,13 +305,13 @@ bool UIEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack ////////////////////////////////////////////////////////////////////////// -ScValue *UIEntity::scGetProperty(const char *name) { +ScValue *UIEntity::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("entity container"); return _scValue; } @@ -319,7 +319,7 @@ ScValue *UIEntity::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Freezable ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Freezable") == 0) { + else if (name == "Freezable") { if (_entity) { _scValue->setBool(_entity->_freezable); } else { diff --git a/engines/wintermute/ui/ui_entity.h b/engines/wintermute/ui/ui_entity.h index 3bf8068fd5..b5f4450071 100644 --- a/engines/wintermute/ui/ui_entity.h +++ b/engines/wintermute/ui/ui_entity.h @@ -48,7 +48,7 @@ public: bool setEntity(const char *filename); // 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/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp index 85e381c55b..8e5bae993c 100644 --- a/engines/wintermute/ui/ui_object.cpp +++ b/engines/wintermute/ui/ui_object.cpp @@ -32,6 +32,7 @@ #include "engines/wintermute/ui/ui_tiled_image.h" #include "engines/wintermute/ui/ui_window.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" #include "engines/wintermute/base/font/base_font_storage.h" @@ -359,13 +360,13 @@ bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack ////////////////////////////////////////////////////////////////////////// -ScValue *UIObject::scGetProperty(const char *name) { +ScValue *UIObject::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("ui_object"); return _scValue; } @@ -373,7 +374,7 @@ ScValue *UIObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Name ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Name") == 0) { + else if (name == "Name") { _scValue->setString(getName()); return _scValue; } @@ -381,7 +382,7 @@ ScValue *UIObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Parent (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Parent") == 0) { + else if (name == "Parent") { _scValue->setNative(_parent, true); return _scValue; } @@ -389,7 +390,7 @@ ScValue *UIObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ParentNotify ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ParentNotify") == 0) { + else if (name == "ParentNotify") { _scValue->setBool(_parentNotify); return _scValue; } @@ -397,7 +398,7 @@ ScValue *UIObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Width ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Width") == 0) { + else if (name == "Width") { _scValue->setInt(_width); return _scValue; } @@ -405,7 +406,7 @@ ScValue *UIObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Height ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Height") == 0) { + else if (name == "Height") { _scValue->setInt(_height); return _scValue; } @@ -413,7 +414,7 @@ ScValue *UIObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Visible ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Visible") == 0) { + else if (name == "Visible") { _scValue->setBool(_visible); return _scValue; } @@ -421,7 +422,7 @@ ScValue *UIObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Disabled ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Disabled") == 0) { + else if (name == "Disabled") { _scValue->setBool(_disable); return _scValue; } @@ -429,7 +430,7 @@ ScValue *UIObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Text ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Text") == 0) { + else if (name == "Text") { _scValue->setString(_text); return _scValue; } @@ -437,13 +438,13 @@ ScValue *UIObject::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NextSibling (RO) / PrevSibling (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NextSibling") == 0 || strcmp(name, "PrevSibling") == 0) { + else if (name == "NextSibling" || name == "PrevSibling") { _scValue->setNULL(); if (_parent && _parent->_type == UI_WINDOW) { UIWindow *win = (UIWindow *)_parent; for (uint32 i = 0; i < win->_widgets.size(); i++) { if (win->_widgets[i] == this) { - if (strcmp(name, "NextSibling") == 0) { + if (name == "NextSibling") { if (i < win->_widgets.size() - 1) { _scValue->setNative(win->_widgets[i + 1], true); } diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h index 81c025d33b..ec2ea33de1 100644 --- a/engines/wintermute/ui/ui_object.h +++ b/engines/wintermute/ui/ui_object.h @@ -74,7 +74,7 @@ public: virtual 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(); diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp index 1844b640d0..2c10f176c7 100644 --- a/engines/wintermute/ui/ui_text.cpp +++ b/engines/wintermute/ui/ui_text.cpp @@ -431,13 +431,13 @@ bool UIText::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, ////////////////////////////////////////////////////////////////////////// -ScValue *UIText::scGetProperty(const char *name) { +ScValue *UIText::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("static"); return _scValue; } @@ -445,7 +445,7 @@ ScValue *UIText::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // TextAlign ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "TextAlign") == 0) { + else if (name == "TextAlign") { _scValue->setInt(_textAlign); return _scValue; } @@ -453,7 +453,7 @@ ScValue *UIText::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // VerticalAlign ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "VerticalAlign") == 0) { + else if (name == "VerticalAlign") { _scValue->setInt(_verticalAlign); return _scValue; } else { diff --git a/engines/wintermute/ui/ui_text.h b/engines/wintermute/ui/ui_text.h index d2f116b44b..da4d113500 100644 --- a/engines/wintermute/ui/ui_text.h +++ b/engines/wintermute/ui/ui_text.h @@ -49,7 +49,7 @@ public: virtual 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(); diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp index cec23cf67e..2b337330c7 100644 --- a/engines/wintermute/ui/ui_tiled_image.cpp +++ b/engines/wintermute/ui/ui_tiled_image.cpp @@ -33,6 +33,7 @@ #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_sub_frame.h" #include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/platform_osystem.h" namespace Wintermute { @@ -333,8 +334,8 @@ bool UITiledImage::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent, "TILED_IMAGE\n"); buffer->putTextIndent(indent, "{\n"); - if (_image && _image->_surfaceFilename) { - buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->_surfaceFilename); + if (_image && _image->getSurfaceFilename()) { + buffer->putTextIndent(indent + 2, "IMAGE=\"%s\"\n", _image->getSurfaceFilename()); } int h1, h2, h3; diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index 65af62141d..9606486efb 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.cpp @@ -41,6 +41,7 @@ #include "engines/wintermute/base/font/base_font_storage.h" #include "engines/wintermute/base/font/base_font.h" #include "engines/wintermute/base/base_string_table.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/scriptables/script.h" #include "engines/wintermute/base/scriptables/script_stack.h" #include "engines/wintermute/base/base_sprite.h" @@ -1013,13 +1014,13 @@ bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack ////////////////////////////////////////////////////////////////////////// -ScValue *UIWindow::scGetProperty(const char *name) { +ScValue *UIWindow::scGetProperty(const Common::String &name) { _scValue->setNULL(); ////////////////////////////////////////////////////////////////////////// // Type ////////////////////////////////////////////////////////////////////////// - if (strcmp(name, "Type") == 0) { + if (name == "Type") { _scValue->setString("window"); return _scValue; } @@ -1027,7 +1028,7 @@ ScValue *UIWindow::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // NumWidgets / NumControls (RO) ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "NumWidgets") == 0 || strcmp(name, "NumControls") == 0) { + else if (name == "NumWidgets" || name == "NumControls") { _scValue->setInt(_widgets.size()); return _scValue; } @@ -1035,7 +1036,7 @@ ScValue *UIWindow::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Exclusive ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Exclusive") == 0) { + else if (name == "Exclusive") { _scValue->setBool(_mode == WINDOW_EXCLUSIVE); return _scValue; } @@ -1043,7 +1044,7 @@ ScValue *UIWindow::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // SystemExclusive ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "SystemExclusive") == 0) { + else if (name == "SystemExclusive") { _scValue->setBool(_mode == WINDOW_SYSTEM_EXCLUSIVE); return _scValue; } @@ -1051,7 +1052,7 @@ ScValue *UIWindow::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Menu ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Menu") == 0) { + else if (name == "Menu") { _scValue->setBool(_isMenu); return _scValue; } @@ -1059,7 +1060,7 @@ ScValue *UIWindow::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // InGame ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "InGame") == 0) { + else if (name == "InGame") { _scValue->setBool(_inGame); return _scValue; } @@ -1067,7 +1068,7 @@ ScValue *UIWindow::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // PauseMusic ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "PauseMusic") == 0) { + else if (name == "PauseMusic") { _scValue->setBool(_pauseMusic); return _scValue; } @@ -1075,7 +1076,7 @@ ScValue *UIWindow::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // ClipContents ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "ClipContents") == 0) { + else if (name == "ClipContents") { _scValue->setBool(_clipContents); return _scValue; } @@ -1083,7 +1084,7 @@ ScValue *UIWindow::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // Transparent ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "Transparent") == 0) { + else if (name == "Transparent") { _scValue->setBool(_transparent); return _scValue; } @@ -1091,7 +1092,7 @@ ScValue *UIWindow::scGetProperty(const char *name) { ////////////////////////////////////////////////////////////////////////// // FadeColor ////////////////////////////////////////////////////////////////////////// - else if (strcmp(name, "FadeColor") == 0) { + else if (name == "FadeColor") { _scValue->setInt((int)_fadeColor); return _scValue; } else { diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h index cbd417a7d9..ae035c65c7 100644 --- a/engines/wintermute/ui/ui_window.h +++ b/engines/wintermute/ui/ui_window.h @@ -83,7 +83,7 @@ public: virtual 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(); diff --git a/engines/wintermute/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp index 2c3be8c2f5..7b3b0e1297 100644 --- a/engines/wintermute/utils/string_util.cpp +++ b/engines/wintermute/utils/string_util.cpp @@ -148,11 +148,11 @@ Utf8String StringUtil::wideToUtf8(const WideString &WideStr) { // Currently this only does Ansi->ISO 8859, and only for carets. char simpleAnsiToWide(const AnsiString &str, uint32 &offset) { - char c = str[offset]; + byte c = str[offset]; - if (c == 92) { + if (c == 146) { offset++; - return '\''; + return 39; // Replace right-quote with apostrophe } else { offset++; return c; @@ -162,11 +162,11 @@ char simpleAnsiToWide(const AnsiString &str, uint32 &offset) { ////////////////////////////////////////////////////////////////////////// WideString StringUtil::ansiToWide(const AnsiString &str) { // TODO: This function gets called a lot, so warnings like these drown out the usefull information - /*Common::String converted = ""; + Common::String converted = ""; uint32 index = 0; while (index != str.size()) { converted += simpleAnsiToWide(str, index); - }*/ + } // using default os locale! /* setlocale(LC_CTYPE, ""); @@ -176,7 +176,7 @@ WideString StringUtil::ansiToWide(const AnsiString &str) { WideString ResultString(wstr); delete[] wstr; return ResultString;*/ - return WideString(str); + return WideString(converted); } ////////////////////////////////////////////////////////////////////////// diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp index 0d23a04af4..d14c807e11 100644 --- a/engines/wintermute/video/video_theora_player.cpp +++ b/engines/wintermute/video/video_theora_player.cpp @@ -32,8 +32,8 @@ #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/base/gfx/osystem/base_surface_osystem.h" #include "engines/wintermute/base/gfx/base_image.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/sound/base_sound_manager.h" -#include "engines/wintermute/utils/utils.h" #include "engines/wintermute/platform_osystem.h" #include "video/theora_decoder.h" #include "engines/wintermute/wintermute.h" @@ -151,7 +151,32 @@ bool VideoTheoraPlayer::initialize(const Common::String &filename, const Common: ////////////////////////////////////////////////////////////////////////// bool VideoTheoraPlayer::resetStream() { - warning("VidTheoraPlayer::resetStream - stubbed"); + warning("VidTheoraPlayer::resetStream - hacked"); + // HACK: Just reopen the same file again. + if (_theoraDecoder) { + _theoraDecoder->close(); + } + delete _theoraDecoder; + _theoraDecoder = NULL; + + _file = BaseFileManager::getEngineInstance()->openFile(_filename, true, false); + if (!_file) { + return STATUS_FAILED; + } + +#if defined (USE_THEORADEC) + _theoraDecoder = new Video::TheoraDecoder(); +#else + return STATUS_FAILED; +#endif + _theoraDecoder->loadStream(_file); + + if (!_theoraDecoder->isVideoLoaded()) { + return STATUS_FAILED; + } + + return play(_playbackType, _posX, _posY, false, false, _looping, 0, _playZoom); + // End of hack. #if 0 // Stubbed for now, as theora isn't seekable if (_sound) { _sound->Stop(); @@ -265,8 +290,10 @@ bool VideoTheoraPlayer::update() { if (_theoraDecoder) { if (_theoraDecoder->endOfVideo() && _looping) { - warning("Should loop movie %s", _filename.c_str()); + warning("Should loop movie %s, hacked for now", _filename.c_str()); _theoraDecoder->rewind(); + //HACK: Just reinitialize the same video again: + return resetStream(); } else if (_theoraDecoder->endOfVideo() && !_looping) { debugC(kWintermuteDebugLog, "Finished movie %s", _filename.c_str()); _state = THEORA_STATE_FINISHED; diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 9ada07293f..c9726e150a 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -39,6 +39,7 @@ #include "engines/wintermute/base/sound/base_sound_manager.h" #include "engines/wintermute/base/base_file_manager.h" +#include "engines/wintermute/base/gfx/base_renderer.h" #include "engines/wintermute/base/scriptables/script_engine.h" namespace Wintermute { |