aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/adl/adl.cpp16
-rw-r--r--engines/adl/adl.h26
-rw-r--r--engines/adl/hires1.cpp4
3 files changed, 25 insertions, 21 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index e0c0b3afae..442edb7b71 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -777,18 +777,18 @@ byte &AdlEngine::var(uint i) {
return _state.vars[i];
}
-void AdlEngine::loadWords(Common::ReadStream &stream, WordMap &map) {
+void AdlEngine::loadWords(Common::ReadStream &stream, WordMap &map) const {
uint index = 0;
while (1) {
++index;
- byte buf[kWordSize];
+ byte buf[IDI_WORD_SIZE];
- if (stream.read(buf, kWordSize) < kWordSize)
+ if (stream.read(buf, IDI_WORD_SIZE) < IDI_WORD_SIZE)
error("Error reading word list");
- Common::String word((char *)buf, kWordSize);
+ Common::String word((char *)buf, IDI_WORD_SIZE);
if (!map.contains(word))
map[word] = index;
@@ -802,10 +802,10 @@ void AdlEngine::loadWords(Common::ReadStream &stream, WordMap &map) {
break;
for (uint i = 0; i < synonyms; ++i) {
- if (stream.read((char *)buf, kWordSize) < kWordSize)
+ if (stream.read((char *)buf, IDI_WORD_SIZE) < IDI_WORD_SIZE)
error("Error reading word list");
- word = Common::String((char *)buf, kWordSize);
+ word = Common::String((char *)buf, IDI_WORD_SIZE);
if (!map.contains(word))
map[word] = index;
@@ -1038,7 +1038,7 @@ void AdlEngine::drawNextPixel(Common::Point &p, byte color, byte bits, byte quad
p.y += (bits & 2 ? 1 : -1);
}
-void AdlEngine::drawLineArt(const Common::Array<byte> &lineArt, Common::Point p, byte rotation, byte scaling, byte color) const {
+void AdlEngine::drawLineArt(const Common::Array<byte> &lineArt, const Common::Point &pos, byte rotation, byte scaling, byte color) const {
const byte stepping[] = {
0xff, 0xfe, 0xfa, 0xf4, 0xec, 0xe1, 0xd4, 0xc5,
0xb4, 0xa1, 0x8d, 0x78, 0x61, 0x49, 0x31, 0x18,
@@ -1050,6 +1050,8 @@ void AdlEngine::drawLineArt(const Common::Array<byte> &lineArt, Common::Point p,
byte xStep = stepping[rotation];
byte yStep = stepping[(rotation ^ 0xf) + 1] + 1;
+ Common::Point p(pos);
+
for (uint i = 0; i < lineArt.size(); ++i) {
byte b = lineArt[i];
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index 5afcb0f64d..6d5ab429ef 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -28,8 +28,6 @@
#include "engines/engine.h"
-#include "gui/debugger.h"
-
namespace Common {
class ReadStream;
class SeekableReadStream;
@@ -110,6 +108,8 @@ enum EngineString {
#define IDO_ACT_DROP_ITEM 0x1c
#define IDO_ACT_SET_ROOM_PIC 0x1d
+#define IDI_WORD_SIZE 8
+
struct Room {
byte description;
byte connections[6];
@@ -176,24 +176,33 @@ protected:
void printStrings(Common::SeekableReadStream &stream, int count = 1) const;
void printMessage(uint idx, bool wait = true) const;
void printASCIIString(const Common::String &str) const;
- void loadVerbs(Common::ReadStream &stream) { loadWords(stream, _verbs); }
- void loadNouns(Common::ReadStream &stream) { loadWords(stream, _nouns); }
void readCommands(Common::ReadStream &stream, Commands &commands);
Common::String inputString(byte prompt = 0) const;
void delay(uint32 ms) const;
byte inputKey() const;
+ void loadWords(Common::ReadStream &stream, WordMap &map) const;
Display *_display;
Parser *_parser;
+ // Strings inside executable
Common::Array<Common::String> _strings;
+ // Message strings in data file
Common::Array<Common::String> _messages;
+ // Picture data
Common::Array<Picture> _pictures;
+ // Dropped item screen offsets
Common::Array<Common::Point> _itemOffsets;
+ // Drawings consisting of horizontal and vertical lines only, but
+ // supporting scaling and rotation
Common::Array<Common::Array<byte> > _lineArt;
+ // <room, verb, noun, script> lists
Commands _roomCommands;
Commands _globalCommands;
+ WordMap _verbs;
+ WordMap _nouns;
+
// Game state
State _state;
@@ -219,7 +228,6 @@ private:
void wordWrap(Common::String &str) const;
// Text input
- void loadWords(Common::ReadStream &stream, WordMap &map);
byte convertKey(uint16 ascii) const;
Common::String getLine() const;
Common::String getWord(const Common::String &line, uint &index) const;
@@ -230,7 +238,7 @@ private:
void clearScreen() const;
void drawItems() const;
void drawNextPixel(Common::Point &p, byte color, byte bits, byte quadrant) const;
- void drawLineArt(const Common::Array<byte> &lineArt, Common::Point p, byte rotation = 0, byte scaling = 1, byte color = 0x7f) const;
+ void drawLineArt(const Common::Array<byte> &lineArt, const Common::Point &pos, byte rotation = 0, byte scaling = 1, byte color = 0x7f) const;
// Game state functions
const Room &room(uint i) const;
@@ -248,16 +256,10 @@ private:
void doAllCommands(const Commands &commands, byte verb, byte noun);
void doActions(const Command &command, byte noun, byte offset);
- enum {
- kWordSize = 8
- };
-
const AdlGameDescription *_gameDescription;
bool _isRestarting, _isRestoring;
byte _saveVerb, _saveNoun, _restoreVerb, _restoreNoun;
bool _canSaveNow, _canRestoreNow;
- WordMap _verbs;
- WordMap _nouns;
};
AdlEngine *HiRes1Engine__create(OSystem *syst, const AdlGameDescription *gd);
diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp
index c7b62c144f..314434d850 100644
--- a/engines/adl/hires1.cpp
+++ b/engines/adl/hires1.cpp
@@ -379,10 +379,10 @@ void HiRes1Engine::loadData() {
error("Failed to read game data from '" IDS_HR1_EXE_1 "'");
f.seek(IDI_HR1_OFS_VERBS);
- loadVerbs(f);
+ loadWords(f, _verbs);
f.seek(IDI_HR1_OFS_NOUNS);
- loadNouns(f);
+ loadWords(f, _nouns);
}
void HiRes1Engine::printMessage(uint idx, bool wait) {