diff options
| author | lukaslw | 2014-06-28 17:10:12 +0200 |
|---|---|---|
| committer | lukaslw | 2014-06-28 17:10:12 +0200 |
| commit | 6878b9bc526ebb5cac4edbaaa635f3305a321493 (patch) | |
| tree | 38868dec1d83b50e0fca34231e439a79be9a4d07 | |
| parent | 49de202a21cd5371119267c65b49727d236871ec (diff) | |
| download | scummvm-rg350-6878b9bc526ebb5cac4edbaaa635f3305a321493.tar.gz scummvm-rg350-6878b9bc526ebb5cac4edbaaa635f3305a321493.tar.bz2 scummvm-rg350-6878b9bc526ebb5cac4edbaaa635f3305a321493.zip | |
PRINCE: increaseString(), loading mob exam text update
| -rw-r--r-- | engines/prince/mob.cpp | 4 | ||||
| -rw-r--r-- | engines/prince/prince.cpp | 1 | ||||
| -rw-r--r-- | engines/prince/script.cpp | 17 | ||||
| -rw-r--r-- | engines/prince/script.h | 3 |
4 files changed, 18 insertions, 7 deletions
diff --git a/engines/prince/mob.cpp b/engines/prince/mob.cpp index 7ddb13dc64..27d7127ccd 100644 --- a/engines/prince/mob.cpp +++ b/engines/prince/mob.cpp @@ -62,8 +62,10 @@ bool Mob::loadFromStream(Common::SeekableReadStream &stream) { stream.seek(examTextOffset); _examText.clear(); - while ((c = stream.readByte())) + do { + c = stream.readByte(); _examText += c; + } while (c != 255); stream.seek(pos + 32); return true; diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 6e8847e780..4afe1e8c15 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -2292,6 +2292,7 @@ void PrinceEngine::talkHero(int slot, const char *s) { text._str = s; text._x = x; text._y = y; + _interpreter->increaseString(); } // Test diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index 7806218df8..910c861706 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -522,6 +522,13 @@ void Interpreter::setCurrentString(uint32 value) { _currentString = value; } +void Interpreter::increaseString() { + while (*_string) { + _string++; + } + _string++; +} + template <typename T> T Interpreter::readScript() { T data = _script->read<T>(_currentInstruction); @@ -831,8 +838,8 @@ void Interpreter::O_SETSTRING() { debugInterpreter("GetVaria %s", _string); } else if (offset < 2000) { - uint32 of = READ_LE_UINT32(_vm->_talkTxt+offset*4); - const char * txt = (const char *)&_vm->_talkTxt[of]; + uint32 of = READ_LE_UINT32(_vm->_talkTxt + offset * 4); + const char *txt = (const char *)&_vm->_talkTxt[of]; _string = &_vm->_talkTxt[of]; debugInterpreter("TalkTxt %d %s", of, txt); } @@ -1234,10 +1241,7 @@ void Interpreter::O_PRINTAT() { _vm->printAt(slot, color, (const char *)_string, fr1, fr2); - while (*_string) { - ++_string; - } - ++_string; + increaseString(); } void Interpreter::O_ZOOMIN() { @@ -1534,6 +1538,7 @@ void Interpreter::O_CLEARINVENTORY() { } void Interpreter::O_SKIPTEXT() { + increaseString(); debugInterpreter("O_SKIPTEXT"); } diff --git a/engines/prince/script.h b/engines/prince/script.h index cd2186b744..36fff1ceb9 100644 --- a/engines/prince/script.h +++ b/engines/prince/script.h @@ -181,9 +181,12 @@ public: void step(); void storeNewPC(int opcodePC); + uint32 getCurrentString(); void setCurrentString(uint32 value); + void increaseString(); + private: PrinceEngine *_vm; Script *_script; |
