[Scummvm-git-logs] scummvm master -> 8b93142467254526533279c9074d0a2bb7757a94
waltervn
walter at vanniftrik-it.nl
Sun Feb 19 12:36:16 CET 2017
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
2e3e425d5b ADL: Implement hires6 action opcode 0x12
8b93142467 ADL: Implement hires6 direction opcodes
Commit: 2e3e425d5b34ca1e618d13433e6490cac7fd3ecf
https://github.com/scummvm/scummvm/commit/2e3e425d5b34ca1e618d13433e6490cac7fd3ecf
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2017-02-19T12:33:43+01:00
Commit Message:
ADL: Implement hires6 action opcode 0x12
Changed paths:
engines/adl/adl_v4.cpp
engines/adl/adl_v4.h
engines/adl/adl_v5.cpp
engines/adl/adl_v5.h
diff --git a/engines/adl/adl_v4.cpp b/engines/adl/adl_v4.cpp
index a5d2de2..494ff52 100644
--- a/engines/adl/adl_v4.cpp
+++ b/engines/adl/adl_v4.cpp
@@ -238,6 +238,11 @@ void AdlEngine_v4::loadRegionInitDataOffsets(Common::ReadStream &stream, uint re
}
}
+void AdlEngine_v4::initRoomState(RoomState &roomState) const {
+ roomState.picture = 1;
+ roomState.isFirstTime = 1;
+}
+
void AdlEngine_v4::initRegions(const byte *roomsPerRegion, uint regions) {
_state.regions.resize(regions);
@@ -247,12 +252,8 @@ void AdlEngine_v4::initRegions(const byte *roomsPerRegion, uint regions) {
regn.vars.resize(24);
regn.rooms.resize(roomsPerRegion[r]);
- for (uint rm = 0; rm < roomsPerRegion[r]; ++rm) {
- // TODO: hires6 uses 0xff and has slightly different
- // code working on these values
- regn.rooms[rm].picture = 1;
- regn.rooms[rm].isFirstTime = 1;
- }
+ for (uint rm = 0; rm < roomsPerRegion[r]; ++rm)
+ initRoomState(regn.rooms[rm]);
}
}
diff --git a/engines/adl/adl_v4.h b/engines/adl/adl_v4.h
index 08cea21..cca1c6f 100644
--- a/engines/adl/adl_v4.h
+++ b/engines/adl/adl_v4.h
@@ -81,7 +81,8 @@ protected:
void loadRegion(byte region);
void loadItemPicIndex(Common::ReadStream &stream, uint items);
void backupRoomState(byte room);
- void restoreRoomState(byte room);
+ virtual void initRoomState(RoomState &roomState) const;
+ virtual void restoreRoomState(byte room);
void backupVars();
void restoreVars();
diff --git a/engines/adl/adl_v5.cpp b/engines/adl/adl_v5.cpp
index 011ef88..31d0033 100644
--- a/engines/adl/adl_v5.cpp
+++ b/engines/adl/adl_v5.cpp
@@ -33,6 +33,22 @@ AdlEngine_v5::AdlEngine_v5(OSystem *syst, const AdlGameDescription *gd) :
AdlEngine_v4(syst, gd) {
}
+void AdlEngine_v5::initRoomState(RoomState &roomState) const {
+ roomState.picture = 0xff;
+ roomState.isFirstTime = 0xff;
+}
+
+void 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)
+ getRoom(room).isFirstTime = false;
+ }
+}
+
AdlEngine_v5::RegionChunkType AdlEngine_v5::getRegionChunkType(const uint16 addr) const {
switch (addr) {
case 0x7b00:
@@ -181,8 +197,12 @@ int AdlEngine_v5::o5_setTextMode(ScriptEnv &e) {
int AdlEngine_v5::o5_setRegionRoom(ScriptEnv &e) {
OP_DEBUG_2("\tSET_REGION_ROOM(%d, %d)", e.arg(1), e.arg(2));
- // TODO
- return 2;
+ getCurRoom().curPicture = getCurRoom().picture;
+ getCurRoom().isFirstTime = false;
+ switchRegion(e.arg(1));
+ _state.room = e.arg(2);
+ restoreRoomState(_state.room);
+ return -1;
}
int AdlEngine_v5::o_winGame(ScriptEnv &e) {
diff --git a/engines/adl/adl_v5.h b/engines/adl/adl_v5.h
index 7836ec6..0c5837f 100644
--- a/engines/adl/adl_v5.h
+++ b/engines/adl/adl_v5.h
@@ -39,6 +39,8 @@ protected:
// AdlEngine_v4
virtual RegionChunkType getRegionChunkType(const uint16 addr) const;
+ virtual void initRoomState(RoomState &roomState) const;
+ virtual void restoreRoomState(byte room);
int o5_isNounNotInRoom(ScriptEnv &e);
int o5_abortScript(ScriptEnv &e);
Commit: 8b93142467254526533279c9074d0a2bb7757a94
https://github.com/scummvm/scummvm/commit/8b93142467254526533279c9074d0a2bb7757a94
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2017-02-19T12:33:43+01:00
Commit Message:
ADL: Implement hires6 direction opcodes
Changed paths:
engines/adl/adl_v5.cpp
engines/adl/adl_v5.h
engines/adl/hires6.cpp
diff --git a/engines/adl/adl_v5.cpp b/engines/adl/adl_v5.cpp
index 31d0033..09abefd 100644
--- a/engines/adl/adl_v5.cpp
+++ b/engines/adl/adl_v5.cpp
@@ -60,75 +60,6 @@ AdlEngine_v5::RegionChunkType AdlEngine_v5::getRegionChunkType(const uint16 addr
}
}
-typedef Common::Functor1Mem<ScriptEnv &, int, AdlEngine_v5> OpcodeV5;
-#define SetOpcodeTable(x) table = &x;
-#define Opcode(x) table->push_back(new OpcodeV5(this, &AdlEngine_v5::x))
-#define OpcodeUnImpl() table->push_back(new OpcodeV5(this, 0))
-
-void AdlEngine_v5::setupOpcodeTables() {
- Common::Array<const Opcode *> *table = 0;
-
- SetOpcodeTable(_condOpcodes);
- // 0x00
- OpcodeUnImpl();
- Opcode(o2_isFirstTime);
- Opcode(o2_isRandomGT);
- Opcode(o4_isItemInRoom);
- // 0x04
- Opcode(o5_isNounNotInRoom);
- Opcode(o1_isMovesGT);
- Opcode(o1_isVarEQ);
- Opcode(o2_isCarryingSomething);
- // 0x08
- Opcode(o4_isVarGT);
- Opcode(o1_isCurPicEQ);
- Opcode(o5_abortScript);
-
- SetOpcodeTable(_actOpcodes);
- // 0x00
- OpcodeUnImpl();
- Opcode(o1_varAdd);
- Opcode(o1_varSub);
- Opcode(o1_varSet);
- // 0x04
- Opcode(o1_listInv);
- Opcode(o4_moveItem);
- Opcode(o1_setRoom);
- Opcode(o2_setCurPic);
- // 0x08
- Opcode(o2_setPic);
- Opcode(o1_printMsg);
- Opcode(o5_dummy);
- Opcode(o5_setTextMode);
- // 0x0c
- Opcode(o4_moveAllItems);
- Opcode(o1_quit);
- Opcode(o5_dummy);
- Opcode(o4_save);
- // 0x10
- Opcode(o4_restore);
- Opcode(o1_restart);
- Opcode(o5_setRegionRoom);
- Opcode(o5_dummy);
- // 0x14
- Opcode(o1_resetPic);
- Opcode(o1_goDirection<IDI_DIR_NORTH>);
- Opcode(o1_goDirection<IDI_DIR_SOUTH>);
- Opcode(o1_goDirection<IDI_DIR_EAST>);
- // 0x18
- Opcode(o1_goDirection<IDI_DIR_WEST>);
- Opcode(o1_goDirection<IDI_DIR_UP>);
- Opcode(o1_goDirection<IDI_DIR_DOWN>);
- Opcode(o1_takeItem);
- // 0x1c
- Opcode(o1_dropItem);
- Opcode(o1_setRoomPic);
- Opcode(o_winGame);
- OpcodeUnImpl();
- // 0x20
- Opcode(o2_initDisk);
-}
-
int AdlEngine_v5::o5_isNounNotInRoom(ScriptEnv &e) {
OP_DEBUG_1("\t&& NO_SUCH_ITEMS_IN_ROOM(%s)", itemRoomStr(e.arg(1)).c_str());
diff --git a/engines/adl/adl_v5.h b/engines/adl/adl_v5.h
index 0c5837f..0d3823d 100644
--- a/engines/adl/adl_v5.h
+++ b/engines/adl/adl_v5.h
@@ -34,9 +34,6 @@ public:
protected:
AdlEngine_v5(OSystem *syst, const AdlGameDescription *gd);
- // AdlEngine
- virtual void setupOpcodeTables();
-
// AdlEngine_v4
virtual RegionChunkType getRegionChunkType(const uint16 addr) const;
virtual void initRoomState(RoomState &roomState) const;
diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp
index 01de061..7955d1a 100644
--- a/engines/adl/hires6.cpp
+++ b/engines/adl/hires6.cpp
@@ -44,6 +44,7 @@ public:
private:
// AdlEngine
+ void setupOpcodeTables();
void runIntro();
void init();
void initGameState();
@@ -56,12 +57,108 @@ private:
// AdlEngine_v2
void printString(const Common::String &str);
+ template <Direction D>
+ int o_goDirection(ScriptEnv &e);
+
static const uint kRegions = 3;
static const uint kItems = 15;
byte _currVerb, _currNoun;
};
+typedef Common::Functor1Mem<ScriptEnv &, int, HiRes6Engine> OpcodeH6;
+#define SetOpcodeTable(x) table = &x;
+#define Opcode(x) table->push_back(new OpcodeH6(this, &HiRes6Engine::x))
+#define OpcodeUnImpl() table->push_back(new OpcodeH6(this, 0))
+
+void HiRes6Engine::setupOpcodeTables() {
+ Common::Array<const Opcode *> *table = 0;
+
+ SetOpcodeTable(_condOpcodes);
+ // 0x00
+ OpcodeUnImpl();
+ Opcode(o2_isFirstTime);
+ Opcode(o2_isRandomGT);
+ Opcode(o4_isItemInRoom);
+ // 0x04
+ Opcode(o5_isNounNotInRoom);
+ Opcode(o1_isMovesGT);
+ Opcode(o1_isVarEQ);
+ Opcode(o2_isCarryingSomething);
+ // 0x08
+ Opcode(o4_isVarGT);
+ Opcode(o1_isCurPicEQ);
+ Opcode(o5_abortScript);
+
+ SetOpcodeTable(_actOpcodes);
+ // 0x00
+ OpcodeUnImpl();
+ Opcode(o1_varAdd);
+ Opcode(o1_varSub);
+ Opcode(o1_varSet);
+ // 0x04
+ Opcode(o1_listInv);
+ Opcode(o4_moveItem);
+ Opcode(o1_setRoom);
+ Opcode(o2_setCurPic);
+ // 0x08
+ Opcode(o2_setPic);
+ Opcode(o1_printMsg);
+ Opcode(o5_dummy);
+ Opcode(o5_setTextMode);
+ // 0x0c
+ Opcode(o4_moveAllItems);
+ Opcode(o1_quit);
+ Opcode(o5_dummy);
+ Opcode(o4_save);
+ // 0x10
+ Opcode(o4_restore);
+ Opcode(o1_restart);
+ Opcode(o5_setRegionRoom);
+ Opcode(o5_dummy);
+ // 0x14
+ Opcode(o1_resetPic);
+ Opcode(o_goDirection<IDI_DIR_NORTH>);
+ Opcode(o_goDirection<IDI_DIR_SOUTH>);
+ Opcode(o_goDirection<IDI_DIR_EAST>);
+ // 0x18
+ Opcode(o_goDirection<IDI_DIR_WEST>);
+ Opcode(o_goDirection<IDI_DIR_UP>);
+ Opcode(o_goDirection<IDI_DIR_DOWN>);
+ Opcode(o1_takeItem);
+ // 0x1c
+ Opcode(o1_dropItem);
+ Opcode(o1_setRoomPic);
+ Opcode(o_winGame);
+ OpcodeUnImpl();
+ // 0x20
+ Opcode(o2_initDisk);
+}
+
+template <Direction D>
+int HiRes6Engine::o_goDirection(ScriptEnv &e) {
+ OP_DEBUG_0((Common::String("\tGO_") + dirStr(D) + "()").c_str());
+
+ byte room = getCurRoom().connections[D];
+
+ if (room == 0) {
+ if (getVar(33) == 2)
+ setVar(34, getVar(34) + 1);
+
+ printMessage(_messageIds.cantGoThere);
+ return -1;
+ }
+
+ switchRoom(room);
+
+ if (getVar(33) == 2) {
+ printMessage(102);
+ setVar(33, 0);
+ }
+
+ return -1;
+}
+
#define SECTORS_PER_TRACK 16
#define BYTES_PER_SECTOR 256
More information about the Scummvm-git-logs
mailing list