aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/adl/adl.cpp5
-rw-r--r--engines/adl/display.cpp3
-rw-r--r--engines/adl/hires1.cpp47
-rw-r--r--engines/adl/hires1.h5
4 files changed, 38 insertions, 22 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index c58f28ad31..c395fbb81b 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -94,7 +94,10 @@ Common::String AdlEngine::readString(Common::ReadStream &stream, byte until) {
while (1) {
byte b = stream.readByte();
- if (stream.eos() || stream.err() || b == until)
+ if (stream.eos() || stream.err())
+ error("Error reading string");
+
+ if (b == until)
break;
str += b;
diff --git a/engines/adl/display.cpp b/engines/adl/display.cpp
index cc51e4ae7e..7af6f660fd 100644
--- a/engines/adl/display.cpp
+++ b/engines/adl/display.cpp
@@ -213,6 +213,9 @@ void Display::loadFrameBuffer(Common::ReadStream &stream) {
}
dst -= DISPLAY_PITCH * 63;
}
+
+ if (stream.eos() || stream.err())
+ error("Failed to read frame buffer");
}
void Display::putPixel(const Common::Point &p, byte color) {
diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp
index 1345489315..91407808eb 100644
--- a/engines/adl/hires1.cpp
+++ b/engines/adl/hires1.cpp
@@ -31,10 +31,16 @@
namespace Adl {
-#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 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
@@ -99,8 +105,8 @@ HiRes1Engine::HiRes1Engine(OSystem *syst, const AdlGameDescription *gd) :
void HiRes1Engine::runIntro() {
Common::File file;
- if (!file.open("AUTO LOAD OBJ"))
- error("Failed to open file");
+ if (!file.open(IDS_HR1_EXE_0))
+ error("Failed to open file '" IDS_HR1_EXE_0 "'");
file.seek(IDI_HR1_OFS_LOGO_0);
_display->setMode(DISPLAY_MODE_HIRES);
@@ -114,8 +120,8 @@ void HiRes1Engine::runIntro() {
_display->setMode(DISPLAY_MODE_TEXT);
Common::File basic;
- if (!basic.open("MYSTERY.HELLO"))
- error("Failed to open file");
+ if (!basic.open(IDS_HR1_LOADER))
+ error("Failed to open file '" IDS_HR1_LOADER "'");
Common::String str;
@@ -189,8 +195,8 @@ void HiRes1Engine::runIntro() {
_display->setMode(DISPLAY_MODE_MIXED);
- if (!file.open("ADVENTURE"))
- error("Failed to open file");
+ if (!file.open(IDS_HR1_EXE_1))
+ error("Failed to open file '" IDS_HR1_EXE_1 "'");
// Title screen shown during loading
file.seek(IDI_HR1_OFS_LOGO_1);
@@ -241,7 +247,7 @@ void HiRes1Engine::drawPic(byte pic, Common::Point pos) {
Common::String name = Common::String::format("BLOCK%i", _pictures[pic].block);
if (!f.open(name))
- error("Failed to open file");
+ error("Failed to open file '%s'", name.c_str());
f.seek(_pictures[pic].offset);
drawPic(f, pos);
@@ -257,8 +263,8 @@ void HiRes1Engine::initState() {
_state.vars.clear();
_state.vars.resize(IDI_HR1_NUM_VARS);
- if (!f.open("ADVENTURE"))
- error("Failed to open file");
+ if (!f.open(IDS_HR1_EXE_1))
+ error("Failed to open file '" IDS_HR1_EXE_1 "'");
// Load room data from executable
_state.rooms.clear();
@@ -311,16 +317,16 @@ void HiRes1Engine::runGame() {
Common::File f;
- if (!f.open("MESSAGES"))
- error("Failed to open file");
+ if (!f.open(IDS_HR1_MESSAGES))
+ error("Failed to open file '" IDS_HR1_MESSAGES "'");
- while (!f.eos() && !f.err())
+ for (uint i = 0; i < IDI_HR1_NUM_MESSAGES; ++i)
_messages.push_back(readString(f, APPLECHAR('\r')) + APPLECHAR('\r'));
f.close();
- if (!f.open("ADVENTURE"))
- error("Failed to open file");
+ if (!f.open(IDS_HR1_EXE_1))
+ error("Failed to open file '" IDS_HR1_EXE_1 "'");
// Load strings from executable
_strings.resize(IDI_HR1_STR_TOTAL);
@@ -371,6 +377,9 @@ void HiRes1Engine::runGame() {
_lineArt.push_back(lineArt);
}
+ if (f.eos() || f.err())
+ error("Failed to read game data from '" IDS_HR1_EXE_1 "'");
+
f.seek(IDI_HR1_OFS_VERBS);
loadVerbs(f);
@@ -465,6 +474,8 @@ uint HiRes1Engine::getEngineMessage(EngineMessage msg) {
}
void HiRes1Engine::drawLine(const Common::Point &p1, const Common::Point &p2, byte color) {
+ // This draws a four-connected line
+
int16 deltaX = p2.x - p1.x;
int8 xStep = 1;
diff --git a/engines/adl/hires1.h b/engines/adl/hires1.h
index 12c3c9461f..64cf8f35f7 100644
--- a/engines/adl/hires1.h
+++ b/engines/adl/hires1.h
@@ -27,6 +27,7 @@
namespace Common {
class ReadStream;
+class Point;
}
namespace Adl {
@@ -35,9 +36,6 @@ class HiRes1Engine : public AdlEngine {
public:
HiRes1Engine(OSystem *syst, const AdlGameDescription *gd);
-protected:
- void runGame();
-
private:
void restartGame();
void printMessage(uint idx, bool wait = true);
@@ -45,6 +43,7 @@ private:
void initState();
void runIntro();
+ void runGame();
void drawPic(Common::ReadStream &stream, const Common::Point &pos);
void drawItems();
void drawLine(const Common::Point &p1, const Common::Point &p2, byte color);