Skip to content

Commit

Permalink
ACCESS: Add enum for inventory items referred in hardcoded logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Dec 14, 2014
1 parent 450deab commit 37aefd0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 5 additions & 4 deletions engines/access/amazon/amazon_logic.cpp
Expand Up @@ -26,6 +26,7 @@
#include "access/screen.h"
#include "access/amazon/amazon_game.h"
#include "access/amazon/amazon_logic.h"
#include "access/amazon/amazon_resources.h"

namespace Access {

Expand Down Expand Up @@ -1975,7 +1976,7 @@ void Ant::plotPit(int indx, const int *&buf) {
_vm->_images.addToList(ie);

_vm->_player->_rawPlayer = _pitPos;
if (_vm->_inventory->_inv[76]._value == ITEM_IN_INVENTORY) {
if (_vm->_inventory->_inv[INV_TORCH]._value == ITEM_IN_INVENTORY) {
// Player has torch
idx = _torchCel;
buf = Amazon::TORCH;
Expand All @@ -1986,7 +1987,7 @@ void Ant::plotPit(int indx, const int *&buf) {
_torchCel = idx;
plotTorchSpear(idx, buf);
}
else if (!_stabFl && (_vm->_inventory->_inv[78]._value == ITEM_IN_INVENTORY)) {
else if (!_stabFl && (_vm->_inventory->_inv[INV_KNIFE_SPEAR]._value == ITEM_IN_INVENTORY)) {
// Player has spear
idx = 0;
buf = Amazon::SPEAR;
Expand Down Expand Up @@ -2037,7 +2038,7 @@ int Ant::antHandleLeft(int indx, const int *&buf) {

int Ant::antHandleStab(int indx, const int *&buf) {
int retval = indx;
if (_vm->_inventory->_inv[78]._value == ITEM_IN_INVENTORY) {
if (_vm->_inventory->_inv[INV_KNIFE_SPEAR]._value == ITEM_IN_INVENTORY) {
if (_stabFl) {
buf = Amazon::PITSTAB;
retval = _stabCel;
Expand Down Expand Up @@ -2114,7 +2115,7 @@ void Ant::doAnt() {
buf = Amazon::ANTEAT;
} else {
buf = Amazon::ANTWALK;
if (_vm->_inventory->_inv[76]._value == ITEM_IN_INVENTORY)
if (_vm->_inventory->_inv[INV_TORCH]._value == ITEM_IN_INVENTORY)
// Player has burning torch, which scares the Ant
_antDirection = ANT_LEFT;
}
Expand Down
4 changes: 4 additions & 0 deletions engines/access/amazon/amazon_resources.h
Expand Up @@ -29,6 +29,10 @@ namespace Access {

namespace Amazon {

enum InventoryEnum {
INV_BAITED_POLE = 67, INV_TORCH = 76, INV_KNIFE_SPEAR = 78
};

struct RiverStruct {
int _id;
int _width;
Expand Down

0 comments on commit 37aefd0

Please sign in to comment.