aboutsummaryrefslogtreecommitdiff
path: root/engines/adl
diff options
context:
space:
mode:
authorWalter van Niftrik2016-03-06 22:50:17 +0100
committerWalter van Niftrik2016-03-09 10:03:13 +0100
commitac79cb081c2e7a137f2196b14e1fb2b7b4099c7f (patch)
tree0069155ead507acf8d818012f561112846a1b6f1 /engines/adl
parent07d0997befe416c56e38b831031b81a30e63925a (diff)
downloadscummvm-rg350-ac79cb081c2e7a137f2196b14e1fb2b7b4099c7f.tar.gz
scummvm-rg350-ac79cb081c2e7a137f2196b14e1fb2b7b4099c7f.tar.bz2
scummvm-rg350-ac79cb081c2e7a137f2196b14e1fb2b7b4099c7f.zip
ADL: Move #defines into header file
Diffstat (limited to 'engines/adl')
-rw-r--r--engines/adl/adl.cpp12
-rw-r--r--engines/adl/adl.h12
-rw-r--r--engines/adl/hires1.cpp69
-rw-r--r--engines/adl/hires1.h68
4 files changed, 79 insertions, 82 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 8884015d93..af379c085c 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -156,18 +156,6 @@ Common::String AdlEngine::readString(Common::ReadStream &stream, byte until) con
return str;
}
-void AdlEngine::printStrings(Common::SeekableReadStream &stream, int count) const {
- while (1) {
- Common::String str = readString(stream);
- _display->printString(str);
-
- if (--count == 0)
- break;
-
- stream.seek(3, SEEK_CUR);
- };
-}
-
Common::String AdlEngine::getEngineString(int str) const {
return _strings[str];
}
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index 6f9b24d83f..591b918e43 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -162,14 +162,16 @@ protected:
AdlEngine(OSystem *syst, const AdlGameDescription *gd);
Common::String readString(Common::ReadStream &stream, byte until = 0) const;
- void printStrings(Common::SeekableReadStream &stream, int count = 1) const;
- void printMessage(uint idx, bool wait = true) const;
+
+ virtual void printMessage(uint idx, bool wait = true) const;
void printASCIIString(const Common::String &str) const;
- void readCommands(Common::ReadStream &stream, Commands &commands);
- Common::String inputString(byte prompt = 0) const;
void delay(uint32 ms) const;
+
+ Common::String inputString(byte prompt = 0) const;
byte inputKey() const;
+
void loadWords(Common::ReadStream &stream, WordMap &map) const;
+ void readCommands(Common::ReadStream &stream, Commands &commands);
Display *_display;
Parser *_parser;
@@ -196,7 +198,7 @@ protected:
State _state;
private:
- virtual void runIntro() { }
+ virtual void runIntro() const { }
virtual void loadData() = 0;
virtual void initState() = 0;
virtual void restartGame() = 0;
diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp
index ad023087d1..754ee3043c 100644
--- a/engines/adl/hires1.cpp
+++ b/engines/adl/hires1.cpp
@@ -31,37 +31,6 @@
namespace Adl {
-#define IDS_HR1_EXE_0 "AUTO LOAD OBJ"
-#define IDS_HR1_EXE_1 "ADVENTURE"
-#define IDS_HR1_LOADER "MYSTERY.HELLO"
-#define IDS_HR1_MESSAGES "MESSAGES"
-
-#define IDI_HR1_NUM_ROOMS 41
-#define IDI_HR1_NUM_PICS 98
-#define IDI_HR1_NUM_VARS 20
-#define IDI_HR1_NUM_ITEM_OFFSETS 21
-#define IDI_HR1_NUM_MESSAGES 167
-
-// Messages used outside of scripts
-#define IDI_HR1_MSG_CANT_GO_THERE 137
-#define IDI_HR1_MSG_DONT_UNDERSTAND 37
-#define IDI_HR1_MSG_ITEM_DOESNT_MOVE 151
-#define IDI_HR1_MSG_ITEM_NOT_HERE 152
-#define IDI_HR1_MSG_THANKS_FOR_PLAYING 140
-#define IDI_HR1_MSG_DONT_HAVE_IT 127
-#define IDI_HR1_MSG_GETTING_DARK 7
-
-// Strings embedded in the executable
-enum {
- IDI_HR1_STR_CANT_GO_THERE = IDI_STR_TOTAL,
- IDI_HR1_STR_DONT_HAVE_IT,
- IDI_HR1_STR_DONT_UNDERSTAND,
- IDI_HR1_STR_GETTING_DARK,
- IDI_HR1_STR_PRESS_RETURN,
-
- IDI_HR1_STR_TOTAL
-};
-
// Offsets for strings inside executable
static const StringOffset stringOffsets[] = {
{ IDI_STR_ENTER_COMMAND, 0x5bbc },
@@ -75,30 +44,7 @@ static const StringOffset stringOffsets[] = {
{ IDI_HR1_STR_PRESS_RETURN, 0x5f68 }
};
-#define IDI_HR1_OFS_PD_TEXT_0 0x005d
-#define IDI_HR1_OFS_PD_TEXT_1 0x012b
-#define IDI_HR1_OFS_PD_TEXT_2 0x016d
-#define IDI_HR1_OFS_PD_TEXT_3 0x0259
-
-#define IDI_HR1_OFS_INTRO_TEXT 0x0066
-#define IDI_HR1_OFS_GAME_OR_HELP 0x000f
-
-#define IDI_HR1_OFS_LOGO_0 0x1003
-#define IDI_HR1_OFS_LOGO_1 0x1800
-
-#define IDI_HR1_OFS_ITEMS 0x0100
-#define IDI_HR1_OFS_ROOMS 0x050a
-#define IDI_HR1_OFS_PICS 0x4b00
-#define IDI_HR1_OFS_CMDS_0 0x3c00
-#define IDI_HR1_OFS_CMDS_1 0x3d00
-
-#define IDI_HR1_OFS_ITEM_OFFSETS 0x68ff
-#define IDI_HR1_OFS_LINE_ART 0x4f00
-
-#define IDI_HR1_OFS_VERBS 0x3800
-#define IDI_HR1_OFS_NOUNS 0x0f00
-
-void HiRes1Engine::runIntro() {
+void HiRes1Engine::runIntro() const {
Common::File file;
if (!file.open(IDS_HR1_EXE_0))
@@ -175,13 +121,20 @@ void HiRes1Engine::runIntro() {
uint page = 0;
while (pages[page] != 0) {
_display->home();
- printStrings(file, pages[page++]);
+
+ uint count = pages[page++];
+ for (uint i = 0; i < count; ++i) {
+ str = readString(file);
+ _display->printString(str);
+ file.seek(3, SEEK_CUR);
+ }
+
inputString();
if (g_engine->shouldQuit())
return;
- file.seek(9, SEEK_CUR);
+ file.seek(6, SEEK_CUR);
}
}
@@ -381,7 +334,7 @@ void HiRes1Engine::loadData() {
loadWords(f, _nouns);
}
-void HiRes1Engine::printMessage(uint idx, bool wait) {
+void HiRes1Engine::printMessage(uint idx, bool wait) const {
// Hardcoded overrides that don't wait after printing
// Note: strings may differ slightly from the ones in MESSAGES
switch (idx) {
diff --git a/engines/adl/hires1.h b/engines/adl/hires1.h
index 540e613eb9..a19e9c07d2 100644
--- a/engines/adl/hires1.h
+++ b/engines/adl/hires1.h
@@ -32,22 +32,76 @@ class Point;
namespace Adl {
+#define IDS_HR1_EXE_0 "AUTO LOAD OBJ"
+#define IDS_HR1_EXE_1 "ADVENTURE"
+#define IDS_HR1_LOADER "MYSTERY.HELLO"
+#define IDS_HR1_MESSAGES "MESSAGES"
+
+#define IDI_HR1_NUM_ROOMS 41
+#define IDI_HR1_NUM_PICS 98
+#define IDI_HR1_NUM_VARS 20
+#define IDI_HR1_NUM_ITEM_OFFSETS 21
+#define IDI_HR1_NUM_MESSAGES 167
+
+// Messages used outside of scripts
+#define IDI_HR1_MSG_CANT_GO_THERE 137
+#define IDI_HR1_MSG_DONT_UNDERSTAND 37
+#define IDI_HR1_MSG_ITEM_DOESNT_MOVE 151
+#define IDI_HR1_MSG_ITEM_NOT_HERE 152
+#define IDI_HR1_MSG_THANKS_FOR_PLAYING 140
+#define IDI_HR1_MSG_DONT_HAVE_IT 127
+#define IDI_HR1_MSG_GETTING_DARK 7
+
+// Strings embedded in the executable
+enum {
+ IDI_HR1_STR_CANT_GO_THERE = IDI_STR_TOTAL,
+ IDI_HR1_STR_DONT_HAVE_IT,
+ IDI_HR1_STR_DONT_UNDERSTAND,
+ IDI_HR1_STR_GETTING_DARK,
+ IDI_HR1_STR_PRESS_RETURN,
+
+ IDI_HR1_STR_TOTAL
+};
+
+#define IDI_HR1_OFS_PD_TEXT_0 0x005d
+#define IDI_HR1_OFS_PD_TEXT_1 0x012b
+#define IDI_HR1_OFS_PD_TEXT_2 0x016d
+#define IDI_HR1_OFS_PD_TEXT_3 0x0259
+
+#define IDI_HR1_OFS_INTRO_TEXT 0x0066
+#define IDI_HR1_OFS_GAME_OR_HELP 0x000f
+
+#define IDI_HR1_OFS_LOGO_0 0x1003
+#define IDI_HR1_OFS_LOGO_1 0x1800
+
+#define IDI_HR1_OFS_ITEMS 0x0100
+#define IDI_HR1_OFS_ROOMS 0x050a
+#define IDI_HR1_OFS_PICS 0x4b00
+#define IDI_HR1_OFS_CMDS_0 0x3c00
+#define IDI_HR1_OFS_CMDS_1 0x3d00
+
+#define IDI_HR1_OFS_ITEM_OFFSETS 0x68ff
+#define IDI_HR1_OFS_LINE_ART 0x4f00
+
+#define IDI_HR1_OFS_VERBS 0x3800
+#define IDI_HR1_OFS_NOUNS 0x0f00
+
class HiRes1Engine : public AdlEngine {
public:
HiRes1Engine(OSystem *syst, const AdlGameDescription *gd) : AdlEngine(syst, gd) { }
private:
+ // AdlEngine
+ void runIntro() const;
+ void loadData();
+ void initState();
void restartGame();
- void printMessage(uint idx, bool wait = true);
uint getEngineMessage(EngineMessage msg) const;
+ void drawPic(byte pic, Common::Point pos) const;
+ void printMessage(uint idx, bool wait = true) const;
- void initState();
- void runIntro();
- void loadData();
- void drawPic(Common::ReadStream &stream, const Common::Point &pos) const;
- void drawItems();
void drawLine(const Common::Point &p1, const Common::Point &p2, byte color) const;
- void drawPic(byte pic, Common::Point pos) const;
+ void drawPic(Common::ReadStream &stream, const Common::Point &pos) const;
};
} // End of namespace Adl