diff options
author | Walter van Niftrik | 2016-04-10 15:20:17 +0200 |
---|---|---|
committer | Walter van Niftrik | 2016-06-06 20:35:49 +0200 |
commit | 5fe95d51ea3d35e9de725a08b3681fbc3f8844bc (patch) | |
tree | 2bc748592dc0a194997a2dd0e7f8ca2ce26e1a33 /engines | |
parent | 8cc5100afd022f089bcba1cfc9b90d64601b2754 (diff) | |
download | scummvm-rg350-5fe95d51ea3d35e9de725a08b3681fbc3f8844bc.tar.gz scummvm-rg350-5fe95d51ea3d35e9de725a08b3681fbc3f8844bc.tar.bz2 scummvm-rg350-5fe95d51ea3d35e9de725a08b3681fbc3f8844bc.zip |
ADL: Separate game-specific state init
Diffstat (limited to 'engines')
-rw-r--r-- | engines/adl/adl.cpp | 6 | ||||
-rw-r--r-- | engines/adl/adl.h | 3 | ||||
-rw-r--r-- | engines/adl/adl_v2.cpp | 10 | ||||
-rw-r--r-- | engines/adl/adl_v2.h | 1 | ||||
-rw-r--r-- | engines/adl/hires1.cpp | 3 | ||||
-rw-r--r-- | engines/adl/hires1.h | 2 | ||||
-rw-r--r-- | engines/adl/hires2.cpp | 5 | ||||
-rw-r--r-- | engines/adl/hires2.h | 2 | ||||
-rw-r--r-- | engines/adl/hires6.cpp | 5 | ||||
-rw-r--r-- | engines/adl/hires6.h | 2 |
10 files changed, 25 insertions, 14 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index 37f1d04fad..328638ade1 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -379,6 +379,12 @@ void AdlEngine::setupOpcodeTables() { Opcode(o1_setRoomPic); } +void AdlEngine::initState() { + _state = State(); + + initGameState(); +} + byte AdlEngine::roomArg(byte room) const { return room; } diff --git a/engines/adl/adl.h b/engines/adl/adl.h index 14e38eb0f4..f7a6ed91e5 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -240,6 +240,7 @@ protected: virtual bool isInputValid(const Commands &commands, byte verb, byte noun, bool &is_any); virtual void setupOpcodeTables(); + virtual void initState(); virtual byte roomArg(byte room) const; virtual void advanceClock() { } @@ -358,7 +359,7 @@ protected: private: virtual void runIntro() const { } virtual void init() = 0; - virtual void initState() = 0; + virtual void initGameState() = 0; virtual void drawItems() = 0; virtual void drawItem(Item &item, const Common::Point &pos) = 0; virtual void loadRoom(byte roomNr) = 0; diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp index dba6b61346..55060be61b 100644 --- a/engines/adl/adl_v2.cpp +++ b/engines/adl/adl_v2.cpp @@ -114,6 +114,16 @@ void AdlEngine_v2::setupOpcodeTables() { Opcode(o2_initDisk); } +void AdlEngine_v2::initState() { + AdlEngine::initState(); + + _linesPrinted = 0; + _picOnScreen = 0; + _roomOnScreen = 0; + _itemRemoved = false; + _itemsOnScreen = 0; +} + byte AdlEngine_v2::roomArg(byte room) const { if (room == IDI_CUR_ROOM) return _state.room; diff --git a/engines/adl/adl_v2.h b/engines/adl/adl_v2.h index 60af4de484..fa12a48551 100644 --- a/engines/adl/adl_v2.h +++ b/engines/adl/adl_v2.h @@ -43,6 +43,7 @@ protected: // AdlEngine virtual void setupOpcodeTables(); + virtual void initState(); byte roomArg(byte room) const; void advanceClock(); virtual void printString(const Common::String &str); diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp index 4b3a83d443..c8b9989a02 100644 --- a/engines/adl/hires1.cpp +++ b/engines/adl/hires1.cpp @@ -206,8 +206,7 @@ void HiRes1Engine::init() { loadWords(*stream, _nouns, _priNouns); } -void HiRes1Engine::initState() { - _state = State(); +void HiRes1Engine::initGameState() { _state.vars.resize(IDI_HR1_NUM_VARS); StreamPtr stream(_files->createReadStream(IDS_HR1_EXE_1)); diff --git a/engines/adl/hires1.h b/engines/adl/hires1.h index 273b7812d8..c060bc892e 100644 --- a/engines/adl/hires1.h +++ b/engines/adl/hires1.h @@ -103,7 +103,7 @@ private: // AdlEngine void runIntro() const; void init(); - void initState(); + void initGameState(); void restartGame(); void printString(const Common::String &str); Common::String loadMessage(uint idx) const; diff --git a/engines/adl/hires2.cpp b/engines/adl/hires2.cpp index 06fdc5ff9a..d1dd065b4c 100644 --- a/engines/adl/hires2.cpp +++ b/engines/adl/hires2.cpp @@ -130,10 +130,7 @@ void HiRes2Engine::init() { loadWords(*stream, _nouns, _priNouns); } -void HiRes2Engine::initState() { - _linesPrinted = 0; - - _state = State(); +void HiRes2Engine::initGameState() { _state.vars.resize(IDI_HR2_NUM_VARS); StreamPtr stream(_disk->createReadStream(0x21, 0x5, 0x0e, 7)); diff --git a/engines/adl/hires2.h b/engines/adl/hires2.h index 6647e004b7..7a0769a807 100644 --- a/engines/adl/hires2.h +++ b/engines/adl/hires2.h @@ -58,7 +58,7 @@ private: // AdlEngine void runIntro() const; void init(); - void initState(); + void initGameState(); }; } // End of namespace Adl diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp index 7ac953c19a..37c7154c81 100644 --- a/engines/adl/hires6.cpp +++ b/engines/adl/hires6.cpp @@ -192,10 +192,7 @@ void HiRes6Engine::init() { delete boot; } -void HiRes6Engine::initState() { - _linesPrinted = 0; - - _state = State(); +void HiRes6Engine::initGameState() { _state.vars.resize(IDI_HR6_NUM_VARS); StreamPtr stream(_disk->createReadStream(0x20, 0xd, 0x94, 2)); diff --git a/engines/adl/hires6.h b/engines/adl/hires6.h index a8450705c4..a2f6e427d4 100644 --- a/engines/adl/hires6.h +++ b/engines/adl/hires6.h @@ -56,7 +56,7 @@ private: // AdlEngine void runIntro() const; void init(); - void initState(); + void initGameState(); // AdlEngine_v2 void printString(const Common::String &str); |