diff options
author | Marisa-Chan | 2013-10-30 16:17:29 +0700 |
---|---|---|
committer | Marisa-Chan | 2013-10-30 16:17:29 +0700 |
commit | e38ca6e7a952b79e1432e322905687c9e11ebb47 (patch) | |
tree | 0c075aea271927a1a506eeb85d37e6f5cf6175fd | |
parent | a8feff10b883d686b37a709c483129602187c155 (diff) | |
download | scummvm-rg350-e38ca6e7a952b79e1432e322905687c9e11ebb47.tar.gz scummvm-rg350-e38ca6e7a952b79e1432e322905687c9e11ebb47.tar.bz2 scummvm-rg350-e38ca6e7a952b79e1432e322905687c9e11ebb47.zip |
ZVISION: New class for handle values and values from [slots].
-rw-r--r-- | engines/zvision/script_manager.cpp | 23 | ||||
-rw-r--r-- | engines/zvision/script_manager.h | 10 |
2 files changed, 33 insertions, 0 deletions
diff --git a/engines/zvision/script_manager.cpp b/engines/zvision/script_manager.cpp index fe8ec897b9..e88c1ebca7 100644 --- a/engines/zvision/script_manager.cpp +++ b/engines/zvision/script_manager.cpp @@ -515,4 +515,27 @@ Location ScriptManager::getCurrentLocation() const { return location; } +ValueSlot::ValueSlot(ScriptManager *sc_man, const char *slot_val): + _sc_man(sc_man) { + value = 0; + slot = false; + const char *is_slot = strstr(slot_val, "["); + if (is_slot) { + slot = true; + value = atoi(is_slot + 1); + } else { + slot = false; + value = atoi(slot_val); + } +} +int16 ValueSlot::getValue() { + if (slot) { + if (value >= 0) + return _sc_man->getStateValue(value); + else + return 0; + } else + return value; +} + } // End of namespace ZVision diff --git a/engines/zvision/script_manager.h b/engines/zvision/script_manager.h index 3399484970..dd995f4661 100644 --- a/engines/zvision/script_manager.h +++ b/engines/zvision/script_manager.h @@ -304,6 +304,16 @@ private: Control *parseControl(Common::String &line, Common::SeekableReadStream &stream); }; +class ValueSlot { +public: + ValueSlot(ScriptManager *sc_man, const char *slot_val); + int16 getValue(); +private: + int16 value; + bool slot; + ScriptManager *_sc_man; +}; + } // End of namespace ZVision |