aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/adl/adl.cpp5
-rw-r--r--engines/adl/adl.h15
-rw-r--r--engines/adl/hires2.cpp7
-rw-r--r--engines/adl/hires2.h13
4 files changed, 19 insertions, 21 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index d95cfd519b..90606f761d 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -274,6 +274,11 @@ void AdlEngine::readCommands(Common::ReadStream &stream, Commands &commands) {
}
void AdlEngine::checkInput(byte verb, byte noun) {
+ // Try room-local command list first
+ if (doOneCommand(_roomData.commands, verb, noun))
+ return;
+
+ // If no match was found, try the global list
if (!doOneCommand(_roomCommands, verb, noun))
printMessage(_messageIds.dontUnderstand);
}
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index 731b7e3078..d21bd7b7a3 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -164,6 +164,17 @@ struct State {
typedef Common::List<Command> Commands;
typedef Common::HashMap<Common::String, uint> WordMap;
+struct Picture2 {
+ byte nr;
+ DataBlockPtr data;
+};
+
+struct RoomData {
+ Common::String description;
+ Common::Array<Picture2> pictures;
+ Commands commands;
+};
+
class AdlEngine : public Engine {
public:
virtual ~AdlEngine();
@@ -189,7 +200,7 @@ protected:
void loadWords(Common::ReadStream &stream, WordMap &map) const;
void readCommands(Common::ReadStream &stream, Commands &commands);
- virtual void checkInput(byte verb, byte noun);
+ void checkInput(byte verb, byte noun);
virtual void setupOpcodeTables();
virtual bool matchesCurrentPic(byte pic) const;
@@ -266,6 +277,8 @@ protected:
// <room, verb, noun, script> lists
Commands _roomCommands;
Commands _globalCommands;
+ // Data related to the current room
+ RoomData _roomData;
WordMap _verbs;
WordMap _nouns;
diff --git a/engines/adl/hires2.cpp b/engines/adl/hires2.cpp
index 5e3da007a9..3543c92ba4 100644
--- a/engines/adl/hires2.cpp
+++ b/engines/adl/hires2.cpp
@@ -243,13 +243,6 @@ void HiRes2Engine::printMessage(uint idx, bool wait) {
printString(_messages[idx - 1]);
}
-void HiRes2Engine::checkInput(byte verb, byte noun) {
- if (doOneCommand(_roomData.commands, verb, noun))
- return;
-
- AdlEngine::checkInput(verb, noun);
-}
-
Engine *HiRes2Engine_create(OSystem *syst, const AdlGameDescription *gd) {
return new HiRes2Engine(syst, gd);
}
diff --git a/engines/adl/hires2.h b/engines/adl/hires2.h
index a9a4caa97d..0281a7993d 100644
--- a/engines/adl/hires2.h
+++ b/engines/adl/hires2.h
@@ -50,17 +50,6 @@ namespace Adl {
#define IDI_HR2_MSG_ITEM_NOT_HERE 4
#define IDI_HR2_MSG_THANKS_FOR_PLAYING 239
-struct Picture2 {
- byte nr;
- DataBlockPtr data;
-};
-
-struct RoomData {
- Common::String description;
- Common::Array<Picture2> pictures;
- Commands commands;
-};
-
class HiRes2Engine : public AdlEngine_v2 {
public:
HiRes2Engine(OSystem *syst, const AdlGameDescription *gd) : AdlEngine_v2(syst, gd) { }
@@ -75,14 +64,12 @@ private:
void drawItem(const Item &item, const Common::Point &pos) const;
void showRoom();
void printMessage(uint idx, bool wait);
- void checkInput(byte verb, byte noun);
void loadRoom(byte roomNr);
DataBlockPtr readDataBlockPtr(Common::ReadStream &f) const;
void readPictureMeta(Common::ReadStream &f, Picture2 &pic) const;
DiskImage_DSK _disk;
- RoomData _roomData;
Common::Array<Picture2> _itemPics;
};