From 7e9a8c00728592290c2c4f2ba0aa5bf3bf7efff9 Mon Sep 17 00:00:00 2001 From: Walter van Niftrik Date: Mon, 11 Apr 2016 17:34:53 +0200 Subject: ADL: Partially implement hires6 var handling --- engines/adl/adl.cpp | 4 ++++ engines/adl/adl.h | 1 + engines/adl/adl_v2.cpp | 2 +- engines/adl/hires1.cpp | 2 +- engines/adl/hires6.cpp | 39 +++++++++++++++++++++++++-------------- engines/adl/hires6.h | 5 ++++- 6 files changed, 36 insertions(+), 17 deletions(-) (limited to 'engines') diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index b77f8da52b..98895ce8dd 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -385,6 +385,10 @@ void AdlEngine::initState() { initGameState(); } +void AdlEngine::printRoomDescription() { + printString(_roomData.description); +} + byte AdlEngine::roomArg(byte room) const { return room; } diff --git a/engines/adl/adl.h b/engines/adl/adl.h index f7a6ed91e5..e5fbf35d3b 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -241,6 +241,7 @@ protected: virtual void setupOpcodeTables(); virtual void initState(); + virtual void printRoomDescription(); virtual byte roomArg(byte room) const; virtual void advanceClock() { } diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp index 55060be61b..05cfaaca9e 100644 --- a/engines/adl/adl_v2.cpp +++ b/engines/adl/adl_v2.cpp @@ -278,7 +278,7 @@ void AdlEngine_v2::showRoom() { drawItems(); _display->updateHiResScreen(); - printString(_roomData.description); + printRoomDescription(); // FIXME: move to main loop? _linesPrinted = 0; diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp index c8b9989a02..7a85d894e7 100644 --- a/engines/adl/hires1.cpp +++ b/engines/adl/hires1.cpp @@ -348,7 +348,7 @@ void HiRes1Engine::showRoom() { _display->updateHiResScreen(); _messageDelay = false; - printString(_roomData.description); + printRoomDescription(); _messageDelay = true; } diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp index 37c7154c81..5bc7711d13 100644 --- a/engines/adl/hires6.cpp +++ b/engines/adl/hires6.cpp @@ -236,6 +236,13 @@ void HiRes6Engine::initGameState() { _state.items.push_back(item); } + + _currVerb = _currNoun = 0; +} + +void HiRes6Engine::printRoomDescription() { + setVar(2, 0xff); + AdlEngine_v3::printRoomDescription(); } void HiRes6Engine::applyDataBlockOffset(byte &track, byte §or) const { @@ -256,24 +263,28 @@ void HiRes6Engine::printString(const Common::String &str) { ++found; if (found == 3) found = 0; - continue; - } - - switch (found) { - case 0: - s += str[i]; - break; - case 1: - if (getVar(27) == 0) - s += str[i]; - break; - case 2: - if (getVar(27) == 1) + } else { + if (found == 0 || found - 1 == getVar(27)) s += str[i]; } } - AdlEngine_v2::printString(s); + if (getVar(2) != 0xff) { + AdlEngine_v2::printString(s); + } else { + if (getVar(26) == 0) { + if (str.size() != 1 || APPLECHAR(str[0]) != APPLECHAR(' ')) + return AdlEngine_v2::printString(s); + setVar(2, APPLECHAR(' ')); + } else if (getVar(26) == 0xff) { + setVar(2, 'P'); + } else { + setVar(26, _state.room); + setVar(2, 1); + } + + doAllCommands(_globalCommands, _currVerb, _currNoun); + } } Engine *HiRes6Engine_create(OSystem *syst, const AdlGameDescription *gd) { diff --git a/engines/adl/hires6.h b/engines/adl/hires6.h index a2f6e427d4..42211d15a0 100644 --- a/engines/adl/hires6.h +++ b/engines/adl/hires6.h @@ -50,17 +50,20 @@ namespace Adl { class HiRes6Engine : public AdlEngine_v3 { public: - HiRes6Engine(OSystem *syst, const AdlGameDescription *gd) : AdlEngine_v3(syst, gd) { } + HiRes6Engine(OSystem *syst, const AdlGameDescription *gd) : AdlEngine_v3(syst, gd), _currVerb(0), _currNoun(0) { } private: // AdlEngine void runIntro() const; void init(); void initGameState(); + void printRoomDescription(); // AdlEngine_v2 void printString(const Common::String &str); void applyDataBlockOffset(byte &track, byte §or) const; + + byte _currVerb, _currNoun; }; } // End of namespace Adl -- cgit v1.2.3