diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/adl/adl.cpp | 8 | ||||
-rw-r--r-- | engines/adl/adl.h | 1 | ||||
-rw-r--r-- | engines/adl/adl_v4.cpp | 19 | ||||
-rw-r--r-- | engines/adl/adl_v4.h | 2 | ||||
-rw-r--r-- | engines/adl/console.cpp | 2 | ||||
-rw-r--r-- | engines/adl/hires5.cpp | 2 |
6 files changed, 18 insertions, 16 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp index bc5bc74f3a..81950450ab 100644 --- a/engines/adl/adl.cpp +++ b/engines/adl/adl.cpp @@ -427,6 +427,11 @@ void AdlEngine::initState() { initGameState(); } +void AdlEngine::switchRoom(byte roomNr) { + getCurRoom().curPicture = getCurRoom().picture; + _state.room = roomNr; +} + byte AdlEngine::roomArg(byte room) const { return room; } @@ -1073,8 +1078,7 @@ int AdlEngine::o1_moveItem(ScriptEnv &e) { int AdlEngine::o1_setRoom(ScriptEnv &e) { OP_DEBUG_1("\tROOM = %d", e.arg(1)); - getCurRoom().curPicture = getCurRoom().picture; - _state.room = e.arg(1); + switchRoom(e.arg(1)); return 1; } diff --git a/engines/adl/adl.h b/engines/adl/adl.h index 67d9a73cdf..dcc8f44a20 100644 --- a/engines/adl/adl.h +++ b/engines/adl/adl.h @@ -262,6 +262,7 @@ protected: virtual void setupOpcodeTables(); virtual void initState(); + virtual void switchRoom(byte roomNr); virtual byte roomArg(byte room) const; virtual void advanceClock() { } void loadDroppedItemOffsets(Common::ReadStream &stream, byte count); diff --git a/engines/adl/adl_v4.cpp b/engines/adl/adl_v4.cpp index 456ee10dca..613ffd8832 100644 --- a/engines/adl/adl_v4.cpp +++ b/engines/adl/adl_v4.cpp @@ -268,6 +268,14 @@ void AdlEngine_v4::switchRegion(byte region) { _picOnScreen = _roomOnScreen = 0; } +void AdlEngine_v4::switchRoom(byte roomNr) { + getCurRoom().curPicture = getCurRoom().picture; + getCurRoom().isFirstTime = false; + backupRoomState(_state.room); + _state.room = roomNr; + restoreRoomState(_state.room); +} + int AdlEngine_v4::o4_isItemInRoom(ScriptEnv &e) { OP_DEBUG_2("\t&& GET_ITEM_ROOM(%s) == %s", itemStr(e.arg(1)).c_str(), itemRoomStr(e.arg(2)).c_str()); @@ -297,17 +305,6 @@ int AdlEngine_v4::o4_moveItem(ScriptEnv &e) { return 2; } -int AdlEngine_v4::o4_setRoom(ScriptEnv &e) { - OP_DEBUG_1("\tROOM = %d", e.arg(1)); - - getCurRoom().curPicture = getCurRoom().picture; - getCurRoom().isFirstTime = false; - backupRoomState(_state.room); - _state.room = e.arg(1); - restoreRoomState(_state.room); - return 1; -} - int AdlEngine_v4::o4_setRegionToPrev(ScriptEnv &e) { OP_DEBUG_0("\tREGION = PREV_REGION"); diff --git a/engines/adl/adl_v4.h b/engines/adl/adl_v4.h index 0ddd1b9b7e..1fd0a72b1d 100644 --- a/engines/adl/adl_v4.h +++ b/engines/adl/adl_v4.h @@ -52,6 +52,7 @@ protected: virtual Common::String loadMessage(uint idx) const; virtual Common::String getItemDescription(const Item &item) const; virtual void switchRegion(byte region); + virtual void switchRoom(byte roomNr); // AdlEngine_v2 virtual void adjustDataBlockPtr(byte &track, byte §or, byte &offset, byte &size) const; @@ -72,7 +73,6 @@ protected: int o4_isItemInRoom(ScriptEnv &e); int o4_isVarGT(ScriptEnv &e); int o4_moveItem(ScriptEnv &e); - int o4_setRoom(ScriptEnv &e); int o4_setRegionToPrev(ScriptEnv &e); int o4_moveAllItems(ScriptEnv &e); int o4_setRegion(ScriptEnv &e); diff --git a/engines/adl/console.cpp b/engines/adl/console.cpp index e7611419e0..7305ec8125 100644 --- a/engines/adl/console.cpp +++ b/engines/adl/console.cpp @@ -227,7 +227,7 @@ bool Console::Cmd_Room(int argc, const char **argv) { return true; } - _engine->_state.room = room; + _engine->switchRoom(room); prepareGame(); } diff --git a/engines/adl/hires5.cpp b/engines/adl/hires5.cpp index a3ed6d890e..299d1ec5dd 100644 --- a/engines/adl/hires5.cpp +++ b/engines/adl/hires5.cpp @@ -100,7 +100,7 @@ void HiRes5Engine::setupOpcodeTables() { // 0x04 Opcode(o1_listInv); Opcode(o4_moveItem); - Opcode(o4_setRoom); + Opcode(o1_setRoom); Opcode(o2_setCurPic); // 0x08 Opcode(o2_setPic); |