diff options
-rw-r--r-- | engines/wintermute/ad/ad_entity.cpp | 79 | ||||
-rw-r--r-- | engines/wintermute/ad/ad_entity.h | 10 |
2 files changed, 89 insertions, 0 deletions
diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp index 7a4df6c114..ea7c46c5ac 100644 --- a/engines/wintermute/ad/ad_entity.cpp +++ b/engines/wintermute/ad/ad_entity.cpp @@ -34,6 +34,7 @@ #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_engine.h" #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/base/base_game.h" #include "engines/wintermute/base/base_parser.h" @@ -67,6 +68,10 @@ AdEntity::AdEntity(BaseGame *inGame) : AdTalkHolder(inGame) { _walkToX = _walkToY = 0; _walkToDir = DI_NONE; +#ifdef ENABLE_FOXTAIL + _hintX = _hintY = -1; +#endif + _theora = nullptr; } @@ -98,6 +103,16 @@ const char *AdEntity::getItemName() const { return _item; } +#ifdef ENABLE_FOXTAIL +int32 AdEntity::getHintX() const { + return _hintX; +} + +int32 AdEntity::getHintY() const { + return _hintY; +} +#endif + ////////////////////////////////////////////////////////////////////////// bool AdEntity::loadFile(const char *filename) { char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename); @@ -164,6 +179,10 @@ TOKEN_DEF(WALK_TO_X) TOKEN_DEF(WALK_TO_Y) TOKEN_DEF(WALK_TO_DIR) TOKEN_DEF(SAVE_STATE) +#ifdef ENABLE_FOXTAIL +TOKEN_DEF(HINT_X) +TOKEN_DEF(HINT_Y) +#endif TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// bool AdEntity::loadBuffer(char *buffer, bool complete) { @@ -210,6 +229,10 @@ bool AdEntity::loadBuffer(char *buffer, bool complete) { TOKEN_TABLE(WALK_TO_Y) TOKEN_TABLE(WALK_TO_DIR) TOKEN_TABLE(SAVE_STATE) +#ifdef ENABLE_FOXTAIL + TOKEN_TABLE(HINT_X) + TOKEN_TABLE(HINT_Y) +#endif TOKEN_TABLE_END char *params; @@ -487,6 +510,14 @@ bool AdEntity::loadBuffer(char *buffer, bool complete) { i = DI_NONE; } _walkToDir = (TDirection)i; +#ifdef ENABLE_FOXTAIL + case TOKEN_HINT_X: + parser.scanStr(params, "%d", &_hintX); + break; + case TOKEN_HINT_Y: + parser.scanStr(params, "%d", &_hintY); + break; +#endif } break; @@ -900,6 +931,24 @@ ScValue *AdEntity::scGetProperty(const Common::String &name) { return _scValue; } +#ifdef ENABLE_FOXTAIL + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] HintX + ////////////////////////////////////////////////////////////////////////// + else if (name == "HintX") { + _scValue->setInt(_hintX); + return _scValue; + } + + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] HintY + ////////////////////////////////////////////////////////////////////////// + else if (name == "HintY") { + _scValue->setInt(_hintY); + return _scValue; + } +#endif + ////////////////////////////////////////////////////////////////////////// // WalkToDirection ////////////////////////////////////////////////////////////////////////// @@ -951,6 +1000,24 @@ bool AdEntity::scSetProperty(const char *name, ScValue *value) { return STATUS_OK; } +#ifdef ENABLE_FOXTAIL + ////////////////////////////////////////////////////////////////////////// + // [FoxTail] HintX + ////////////////////////////////////////////////////////////////////////// + else if (strcmp(name, "HintX") == 0) { + _hintX = value->getInt(); + return STATUS_OK; + } + + ////////////////////////////////////////////////////////////////////////// + // HintY + ////////////////////////////////////////////////////////////////////////// + else if (strcmp(name, "HintY") == 0) { + _hintY = value->getInt(); + return STATUS_OK; + } +#endif + ////////////////////////////////////////////////////////////////////////// // WalkToDirection ////////////////////////////////////////////////////////////////////////// @@ -1012,6 +1079,11 @@ bool AdEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "WALK_TO_DIR=%d\n", (int)_walkToDir); } +#ifdef ENABLE_FOXTAIL + buffer->putTextIndent(indent + 2, "HINT_X=%d\n", _hintX); + buffer->putTextIndent(indent + 2, "HINT_Y=%d\n", _hintY); +#endif + for (uint32 i = 0; i < _scripts.size(); i++) { buffer->putTextIndent(indent + 2, "SCRIPT=\"%s\"\n", _scripts[i]->_filename); } @@ -1108,6 +1180,13 @@ bool AdEntity::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_theora)); +#ifdef ENABLE_FOXTAIL + if (BaseEngine::instance().isFoxTail(FOXTAIL_1_2_527, FOXTAIL_LATEST_VERSION)) { + persistMgr->transferSint32(TMEMBER(_hintX)); + persistMgr->transferSint32(TMEMBER(_hintY)); + } +#endif + return STATUS_OK; } diff --git a/engines/wintermute/ad/ad_entity.h b/engines/wintermute/ad/ad_entity.h index 678608af36..5407093915 100644 --- a/engines/wintermute/ad/ad_entity.h +++ b/engines/wintermute/ad/ad_entity.h @@ -55,6 +55,11 @@ public: TDirection getWalkToDir() const; const char* getItemName() const; +#ifdef ENABLE_FOXTAIL + int32 getHintX() const; + int32 getHintY() const; +#endif + // scripting interface virtual ScValue *scGetProperty(const Common::String &name) override; virtual bool scSetProperty(const char *name, ScValue *value) override; @@ -67,6 +72,11 @@ private: TDirection _walkToDir; char *_item; TEntityType _subtype; + +#ifdef ENABLE_FOXTAIL + int32 _hintX; + int32 _hintY; +#endif }; } // End of namespace Wintermute |