aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/adl/adl.cpp48
-rw-r--r--engines/adl/adl.h36
-rw-r--r--engines/adl/adl_v1.cpp22
-rw-r--r--engines/adl/display.cpp2
-rw-r--r--engines/adl/display.h4
-rw-r--r--engines/adl/parser.cpp12
6 files changed, 51 insertions, 73 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index b96ecc8b97..9925e04286 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -20,77 +20,35 @@
*
*/
- #include "common/scummsys.h"
-
+#include "common/scummsys.h"
#include "common/config-manager.h"
#include "common/debug.h"
-#include "common/debug-channels.h"
#include "common/error.h"
#include "common/file.h"
-#include "common/fs.h"
#include "common/system.h"
#include "common/events.h"
#include "common/stream.h"
-#include "graphics/palette.h"
#include "engines/util.h"
+#include "graphics/palette.h"
+
#include "adl/adl.h"
#include "adl/display.h"
#include "adl/parser.h"
namespace Adl {
-Common::String asciiToApple(Common::String str) {
- Common::String ret(str);
- Common::String::iterator it;
-
- for (it = ret.begin(); it != ret.end(); ++it)
- *it = *it | 0x80;
-
- return ret;
-}
-
-Common::String appleToAscii(Common::String str) {
- Common::String ret(str);
- Common::String::iterator it;
-
- for (it = ret.begin(); it != ret.end(); ++it)
- *it = *it & 0x7f;
-
- return ret;
-}
-
AdlEngine::AdlEngine(OSystem *syst, const AdlGameDescription *gd) :
Engine(syst),
_gameDescription(gd),
_console(nullptr),
_display(nullptr) {
- // Put your engine in a sane state, but do nothing big yet;
- // in particular, do not load data from files; rather, if you
- // need to do such things, do them from run().
-
- // Do not initialize graphics here
- // Do not initialize audio devices here
-
- // However this is the place to specify all default directories
- const Common::FSNode gameDataDir(ConfMan.get("path"));
- SearchMan.addSubDirectoryMatching(gameDataDir, "sound");
-
- // Don't forget to register your random source
- _rnd = new Common::RandomSource("adl");
-
- debug("AdlEngine::AdlEngine");
}
AdlEngine::~AdlEngine() {
- debug("AdlEngine::~AdlEngine");
-
- delete _rnd;
delete _console;
delete _display;
-
- DebugMan.clearAllDebugChannels();
}
Common::Error AdlEngine::run() {
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index e945a45ec8..954c61335d 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -44,9 +44,6 @@ enum GameType {
kGameTypeHires1
};
-Common::String asciiToApple(Common::String str);
-Common::String appleToAscii(Common::String str);
-
enum {
STR_COMMON_ENTERCMD,
STR_COMMON_VERBERR,
@@ -54,7 +51,38 @@ enum {
STR_CUSTOM_START
};
-#define A2CHAR(C) ((C) | 0x80)
+struct Room {
+ byte description;
+ byte connections[6];
+ byte field8;
+ byte picture;
+};
+
+struct Picture {
+ byte block;
+ uint16 offset;
+};
+
+struct Command {
+ byte room;
+ byte verb, noun;
+ byte numCond, numAct;
+ Common::Array<byte> script;
+};
+
+struct Item {
+ byte field1;
+ byte field2;
+ byte field3;
+ byte field4;
+ byte field5;
+ byte field6;
+ byte field7;
+ byte field8;
+ Common::Array<byte> field10;
+};
+
+typedef Common::List<Command> Commands;
class AdlEngine : public Engine {
public:
diff --git a/engines/adl/adl_v1.cpp b/engines/adl/adl_v1.cpp
index 61671e5d7f..42182390dd 100644
--- a/engines/adl/adl_v1.cpp
+++ b/engines/adl/adl_v1.cpp
@@ -240,10 +240,10 @@ void AdlEngine_v1::wordWrap(Common::String &str) {
if (str.size() <= end)
return;
- while (str[end] != (char)A2CHAR(' '))
+ while (str[end] != APPLECHAR(' '))
--end;
- str.setChar((char)A2CHAR('\r'), end);
+ str.setChar(APPLECHAR('\r'), end);
end += 40;
}
}
@@ -414,7 +414,7 @@ void AdlEngine_v1::doActions(const Command &command, byte noun, byte offset) {
case 0x11: {
_display->printString(_exeStrings[STR_MH_PLAYAGAIN]);
Common::String input = _display->inputString();
- if (input.size() == 0 || input[0] != (char)A2CHAR('N')) {
+ if (input.size() == 0 || input[0] != APPLECHAR('N')) {
warning("Restart game not implemented");
return;
}
@@ -528,12 +528,9 @@ bool AdlEngine_v1::checkCommand(const Command &command, byte verb, byte noun) {
bool AdlEngine_v1::doOneCommand(const Commands &commands, byte verb, byte noun) {
Commands::const_iterator it;
- for (it = commands.begin(); it != commands.end(); ++it) {
- if (checkCommand(*it, verb, noun)) {
- debug("Found match: %i %i %i", it->room, it->verb, it->noun);
+ for (it = commands.begin(); it != commands.end(); ++it)
+ if (checkCommand(*it, verb, noun))
return true;
- }
- }
return false;
}
@@ -541,11 +538,8 @@ bool AdlEngine_v1::doOneCommand(const Commands &commands, byte verb, byte noun)
void AdlEngine_v1::doAllCommands(const Commands &commands, byte verb, byte noun) {
Commands::const_iterator it;
- for (it = commands.begin(); it != commands.end(); ++it) {
- if (checkCommand(*it, verb, noun)) {
- debug("Found match: %i %i %i", it->room, it->verb, it->noun);
- }
- }
+ for (it = commands.begin(); it != commands.end(); ++it)
+ checkCommand(*it, verb, noun);
}
void AdlEngine_v1::clearScreen() {
@@ -563,7 +557,7 @@ void AdlEngine_v1::runGame() {
error("Failed to open file");
while (!f.eos() && !f.err())
- _msgStrings.push_back(readString(f, A2CHAR('\r')) + (char)A2CHAR('\r'));
+ _msgStrings.push_back(readString(f, APPLECHAR('\r')) + APPLECHAR('\r'));
f.close();
diff --git a/engines/adl/display.cpp b/engines/adl/display.cpp
index 02b8d51b7f..47b1533582 100644
--- a/engines/adl/display.cpp
+++ b/engines/adl/display.cpp
@@ -429,7 +429,7 @@ void Display::printASCIIString(const Common::String &str) {
Common::String::const_iterator it;
for (it = str.begin(); it != str.end(); ++it)
- aStr += *it | 0x80;
+ aStr += APPLECHAR(*it);
printString(aStr);
}
diff --git a/engines/adl/display.h b/engines/adl/display.h
index eabf340573..62294d3e55 100644
--- a/engines/adl/display.h
+++ b/engines/adl/display.h
@@ -37,7 +37,9 @@ class Surface;
}
namespace Adl {
-
+
+#define APPLECHAR(C) ((char)((C) | 0x80))
+
class Display {
public:
enum Mode {
diff --git a/engines/adl/parser.cpp b/engines/adl/parser.cpp
index cdbaf3ba6c..1611fc7f54 100644
--- a/engines/adl/parser.cpp
+++ b/engines/adl/parser.cpp
@@ -81,7 +81,7 @@ Common::String Parser::getLine() {
bool textMode = false;
while (1) {
- Common::String line = _display.inputString(A2CHAR('?'));
+ Common::String line = _display.inputString(APPLECHAR('?'));
if (g_engine->shouldQuit())
return "";
@@ -102,7 +102,7 @@ Common::String Parser::getWord(const Common::String &line, uint &index) {
Common::String str;
for (uint i = 0; i < 8; ++i)
- str += (char)(A2CHAR(' '));
+ str += APPLECHAR(' ');
int copied = 0;
@@ -110,7 +110,7 @@ Common::String Parser::getWord(const Common::String &line, uint &index) {
while (1) {
if (index == line.size())
return str;
- if (line[index] != (char)(A2CHAR(' ')))
+ if (line[index] != APPLECHAR(' '))
break;
++index;
}
@@ -122,7 +122,7 @@ Common::String Parser::getWord(const Common::String &line, uint &index) {
index++;
- if (index == line.size() || line[index] == (char)(A2CHAR(' ')))
+ if (index == line.size() || line[index] == APPLECHAR(' '))
return str;
}
}
@@ -137,7 +137,6 @@ void Parser::getInput(uint &verb, uint &noun) {
uint index = 0;
Common::String verbStr = getWord(line, index);
- debug("Verb: \"%s\"", appleToAscii(verbStr).c_str());
if (!_verbs.contains(verbStr)) {
Common::String err = _engine.getExeString(STR_COMMON_VERBERR);
@@ -148,10 +147,8 @@ void Parser::getInput(uint &verb, uint &noun) {
}
verb = _verbs[verbStr];
- debug("Verb ID: %i", verb);
Common::String nounStr = getWord(line, index);
- debug("Noun: \"%s\"", appleToAscii(nounStr).c_str());
if (!_nouns.contains(nounStr)) {
Common::String err = _engine.getExeString(STR_COMMON_NOUNERR);
@@ -164,7 +161,6 @@ void Parser::getInput(uint &verb, uint &noun) {
}
noun = _nouns[nounStr];
- debug("Noun ID: %i", noun);
return;
}
}