diff options
author | Walter van Niftrik | 2017-02-19 16:52:38 +0100 |
---|---|---|
committer | Walter van Niftrik | 2017-02-19 17:41:34 +0100 |
commit | cc1f975a9cf1a04f8bd339336db100e63ae21385 (patch) | |
tree | 8ff08aa9eb37c246c73bc392c8152e1a07656613 | |
parent | c010e05edd8343d90d2a87ff490002b3c6ec8b5e (diff) | |
download | scummvm-rg350-cc1f975a9cf1a04f8bd339336db100e63ae21385.tar.gz scummvm-rg350-cc1f975a9cf1a04f8bd339336db100e63ae21385.tar.bz2 scummvm-rg350-cc1f975a9cf1a04f8bd339336db100e63ae21385.zip |
ADL: Implement hires6 action opcode 0x1d
-rw-r--r-- | engines/adl/adl_v4.cpp | 5 | ||||
-rw-r--r-- | engines/adl/adl_v4.h | 2 | ||||
-rw-r--r-- | engines/adl/adl_v5.cpp | 23 | ||||
-rw-r--r-- | engines/adl/adl_v5.h | 3 | ||||
-rw-r--r-- | engines/adl/hires6.cpp | 2 |
5 files changed, 29 insertions, 6 deletions
diff --git a/engines/adl/adl_v4.cpp b/engines/adl/adl_v4.cpp index 494ff52ce4..e8ee798199 100644 --- a/engines/adl/adl_v4.cpp +++ b/engines/adl/adl_v4.cpp @@ -396,13 +396,16 @@ void AdlEngine_v4::backupRoomState(byte room) { backup.picture = getRoom(room).picture; } -void AdlEngine_v4::restoreRoomState(byte room) { +byte AdlEngine_v4::restoreRoomState(byte room) { const RoomState &backup = getCurRegion().rooms[room - 1]; if (backup.isFirstTime != 1) { getRoom(room).curPicture = getRoom(room).picture = backup.picture; getRoom(room).isFirstTime = false; + return 0; } + + return 1; } void AdlEngine_v4::backupVars() { diff --git a/engines/adl/adl_v4.h b/engines/adl/adl_v4.h index cca1c6fa98..ca9aeff492 100644 --- a/engines/adl/adl_v4.h +++ b/engines/adl/adl_v4.h @@ -82,7 +82,7 @@ protected: void loadItemPicIndex(Common::ReadStream &stream, uint items); void backupRoomState(byte room); virtual void initRoomState(RoomState &roomState) const; - virtual void restoreRoomState(byte room); + virtual byte restoreRoomState(byte room); void backupVars(); void restoreVars(); diff --git a/engines/adl/adl_v5.cpp b/engines/adl/adl_v5.cpp index 09abefd1ca..503be9a337 100644 --- a/engines/adl/adl_v5.cpp +++ b/engines/adl/adl_v5.cpp @@ -38,15 +38,20 @@ void AdlEngine_v5::initRoomState(RoomState &roomState) const { roomState.isFirstTime = 0xff; } -void AdlEngine_v5::restoreRoomState(byte room) { +byte AdlEngine_v5::restoreRoomState(byte room) { const RoomState &backup = getCurRegion().rooms[room - 1]; if (backup.isFirstTime != 0xff) { getRoom(room).curPicture = getRoom(room).picture = backup.picture; - if (backup.isFirstTime != 1) + // CHECKME: Why doesn't this just copy the flag unconditionally? + if (backup.isFirstTime != 1) { getRoom(room).isFirstTime = false; + return 0; + } } + + return backup.isFirstTime; } AdlEngine_v5::RegionChunkType AdlEngine_v5::getRegionChunkType(const uint16 addr) const { @@ -136,6 +141,20 @@ int AdlEngine_v5::o5_setRegionRoom(ScriptEnv &e) { return -1; } +int AdlEngine_v5::o5_setRoomPic(ScriptEnv &e) { + const byte isFirstTime = restoreRoomState(e.arg(1)); + + // CHECKME: More peculiar isFirstTime handling (see also restoreRoomState). + // Is this here to prevent changing the backed up flag from 1 to 0? Since + // that could only happen if the room isFirstTime is 0 while the backed up flag + // is 1, is this scenario even possible? + if (isFirstTime != 0xff) + getRoom(e.arg(1)).isFirstTime = isFirstTime; + + o4_setRoomPic(e); + return 2; +} + int AdlEngine_v5::o_winGame(ScriptEnv &e) { OP_DEBUG_0("\tWIN_GAME()"); diff --git a/engines/adl/adl_v5.h b/engines/adl/adl_v5.h index 0d3823d141..a163381493 100644 --- a/engines/adl/adl_v5.h +++ b/engines/adl/adl_v5.h @@ -37,13 +37,14 @@ protected: // AdlEngine_v4 virtual RegionChunkType getRegionChunkType(const uint16 addr) const; virtual void initRoomState(RoomState &roomState) const; - virtual void restoreRoomState(byte room); + virtual byte restoreRoomState(byte room); int o5_isNounNotInRoom(ScriptEnv &e); int o5_abortScript(ScriptEnv &e); int o5_dummy(ScriptEnv &e); int o5_setTextMode(ScriptEnv &e); int o5_setRegionRoom(ScriptEnv &e); + int o5_setRoomPic(ScriptEnv &e); int o_winGame(ScriptEnv &e); }; diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp index 7955d1aba5..3de7e594a1 100644 --- a/engines/adl/hires6.cpp +++ b/engines/adl/hires6.cpp @@ -128,7 +128,7 @@ void HiRes6Engine::setupOpcodeTables() { Opcode(o1_takeItem); // 0x1c Opcode(o1_dropItem); - Opcode(o1_setRoomPic); + Opcode(o5_setRoomPic); Opcode(o_winGame); OpcodeUnImpl(); // 0x20 |