aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWalter van Niftrik2016-02-28 14:24:04 +0100
committerWalter van Niftrik2016-03-09 10:03:13 +0100
commitf9c9f2ac9de984aed7fb2438899aff33104ab3b8 (patch)
tree396e0c103d6504df6bc1628346cd2e6770bd820d /engines
parentce97d0a26e51ff1253ae3268f09673f0aa31f4a7 (diff)
downloadscummvm-rg350-f9c9f2ac9de984aed7fb2438899aff33104ab3b8.tar.gz
scummvm-rg350-f9c9f2ac9de984aed7fb2438899aff33104ab3b8.tar.bz2
scummvm-rg350-f9c9f2ac9de984aed7fb2438899aff33104ab3b8.zip
ADL: Rename Item struct fields
Diffstat (limited to 'engines')
-rw-r--r--engines/adl/adl.cpp45
-rw-r--r--engines/adl/adl.h25
-rw-r--r--engines/adl/hires1.cpp36
3 files changed, 56 insertions, 50 deletions
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 2c11290919..3ce6d709f8 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -165,25 +165,24 @@ void AdlEngine::takeItem(byte noun) {
Common::Array<Item>::iterator it;
for (it = _inventory.begin(); it != _inventory.end(); ++it) {
- if (it->field1 != noun || it->field2 != _room)
+ if (it->noun != noun || it->room != _room)
continue;
- if (it->field7 == 2) {
+ if (it->state == IDI_ITEM_DOESNT_MOVE) {
printEngineMessage(IDI_MSG_ITEM_DOESNT_MOVE);
return;
}
- if (it->field7 == 1) {
- it->field2 = 0xfe;
- it->field7 = 1;
+ if (it->state == IDI_ITEM_MOVED) {
+ it->room = IDI_NONE;
return;
}
Common::Array<byte>::const_iterator it2;
- for (it2 = it->field10.begin(); it->field10.end(); ++it2) {
+ for (it2 = it->roomPictures.begin(); it->roomPictures.end(); ++it2) {
if (*it2 == _rooms[_room].picture) {
- it->field2 = 0xfe;
- it->field7 = 1;
+ it->room = IDI_NONE;
+ it->state = IDI_ITEM_MOVED;
return;
}
}
@@ -196,11 +195,11 @@ void AdlEngine::dropItem(byte noun) {
Common::Array<Item>::iterator it;
for (it = _inventory.begin(); it != _inventory.end(); ++it) {
- if (it->field1 != noun || it->field2 != 0xfe)
+ if (it->noun != noun || it->room != IDI_NONE)
continue;
- it->field2 = _room;
- it->field7 = 1;
+ it->room = _room;
+ it->state = IDI_ITEM_MOVED;
return;
}
@@ -227,14 +226,14 @@ void AdlEngine::doActions(const Command &command, byte noun, byte offset) {
Common::Array<Item>::const_iterator it;
for (it = _inventory.begin(); it != _inventory.end(); ++it)
- if (it->field2 == 0xfe)
- printMessage(it->field8);
+ if (it->room == IDI_NONE)
+ printMessage(it->description);
++offset;
break;
}
case 5:
- _inventory[command.script[offset + 1] - 1].field2 = command.script[offset + 2];
+ _inventory[command.script[offset + 1] - 1].room = command.script[offset + 2];
offset += 3;
break;
case 6:
@@ -285,15 +284,15 @@ void AdlEngine::doActions(const Command &command, byte noun, byte offset) {
return;
case 0x12: {
byte item = command.script[offset + 1] - 1;
- _inventory[item].field2 = command.script[offset + 2];
- _inventory[item].field5 = command.script[offset + 3];
- _inventory[item].field6 = command.script[offset + 4];
+ _inventory[item].room = command.script[offset + 2];
+ _inventory[item].position.x = command.script[offset + 3];
+ _inventory[item].position.y = command.script[offset + 4];
offset += 5;
break;
}
case 0x13: {
byte item = command.script[offset + 2] - 1;
- _inventory[item].field3 = command.script[offset + 1];
+ _inventory[item].picture = command.script[offset + 1];
offset += 3;
break;
}
@@ -337,20 +336,20 @@ void AdlEngine::doActions(const Command &command, byte noun, byte offset) {
}
bool AdlEngine::checkCommand(const Command &command, byte verb, byte noun) {
- if (command.room != 0xfe && command.room != _room)
+ if (command.room != IDI_NONE && command.room != _room)
return false;
- if (command.verb != 0xfe && command.verb != verb)
+ if (command.verb != IDI_NONE && command.verb != verb)
return false;
- if (command.noun != 0xfe && command.noun != noun)
+ if (command.noun != IDI_NONE && command.noun != noun)
return false;
uint offset = 0;
for (uint i = 0; i < command.numCond; ++i) {
switch (command.script[offset]) {
case 3:
- if (_inventory[command.script[offset + 1] - 1].field2 != command.script[offset + 2])
+ if (_inventory[command.script[offset + 1] - 1].room != command.script[offset + 2])
return false;
offset += 3;
break;
@@ -370,7 +369,7 @@ bool AdlEngine::checkCommand(const Command &command, byte verb, byte noun) {
offset += 2;
break;
case 10:
- if (_inventory[command.script[offset + 1] - 1].field3 != command.script[offset + 2])
+ if (_inventory[command.script[offset + 1] - 1].picture != command.script[offset + 2])
return false;
offset += 3;
break;
diff --git a/engines/adl/adl.h b/engines/adl/adl.h
index beb915ca9f..987a962b4f 100644
--- a/engines/adl/adl.h
+++ b/engines/adl/adl.h
@@ -90,16 +90,23 @@ struct Command {
Common::Array<byte> script;
};
+enum {
+ IDI_ITEM_NOT_MOVED,
+ IDI_ITEM_MOVED,
+ IDI_ITEM_DOESNT_MOVE
+};
+
+#define IDI_NONE 0xfe
+
struct Item {
- byte field1;
- byte field2;
- byte field3;
- byte field4;
- byte field5;
- byte field6;
- byte field7;
- byte field8;
- Common::Array<byte> field10;
+ byte noun;
+ byte room;
+ byte picture;
+ bool isDrawing;
+ Common::Point position;
+ int state;
+ byte description;
+ Common::Array<byte> roomPictures;
};
typedef Common::List<Command> Commands;
diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp
index 65aa66532e..a078340f2f 100644
--- a/engines/adl/hires1.cpp
+++ b/engines/adl/hires1.cpp
@@ -212,16 +212,16 @@ void HiRes1Engine::drawItems() {
uint dropped = 0;
for (it = _inventory.begin(); it != _inventory.end(); ++it) {
- if (it->field2 != _room)
+ if (it->room != _room)
continue;
- if (it->field7 == 1) {
+ if (it->state == IDI_ITEM_MOVED) {
if (_rooms[_room].field8 == _rooms[_room].picture) {
const Common::Point &p = _itemOffsets[dropped];
- if (it->field4)
- _display->drawRightAngles(_drawings[it->field3 - 1], Common::Point(p.x, p.y), 0, 1, 0x7f);
+ if (it->isDrawing)
+ _display->drawRightAngles(_drawings[it->picture - 1], Common::Point(p.x, p.y), 0, 1, 0x7f);
else
- drawPic(it->field3, p.x, p.y);
+ drawPic(it->picture, p.x, p.y);
++dropped;
}
continue;
@@ -229,12 +229,12 @@ void HiRes1Engine::drawItems() {
Common::Array<byte>::const_iterator it2;
- for (it2 = it->field10.begin(); it2 != it->field10.end(); ++it2) {
+ for (it2 = it->roomPictures.begin(); it2 != it->roomPictures.end(); ++it2) {
if (*it2 == _rooms[_room].picture) {
- if (it->field4)
- _display->drawRightAngles(_drawings[it->field3 - 1], Common::Point(it->field5, it->field6), 0, 1, 0x7f);
+ if (it->isDrawing)
+ _display->drawRightAngles(_drawings[it->picture - 1], it->position, 0, 1, 0x7f);
else
- drawPic(it->field3, it->field5, it->field6);
+ drawPic(it->picture, it->position.x, it->position.y);
continue;
}
}
@@ -292,21 +292,21 @@ void HiRes1Engine::runGame() {
f.seek(0x100);
while (f.readByte() != 0xff) {
struct Item item;
- item.field1 = f.readByte();
- item.field2 = f.readByte();
- item.field3 = f.readByte();
- item.field4 = f.readByte();
- item.field5 = f.readByte();
- item.field6 = f.readByte();
- item.field7 = f.readByte();
- item.field8 = f.readByte();
+ item.noun = f.readByte();
+ item.room = f.readByte();
+ item.picture = f.readByte();
+ item.isDrawing = f.readByte();
+ item.position.x = f.readByte();
+ item.position.y = f.readByte();
+ item.state = f.readByte();
+ item.description = f.readByte();
f.readByte();
byte size = f.readByte();
for (uint i = 0; i < size; ++i)
- item.field10.push_back(f.readByte());
+ item.roomPictures.push_back(f.readByte());
_inventory.push_back(item);
}