aboutsummaryrefslogtreecommitdiff
path: root/engines/access
diff options
context:
space:
mode:
Diffstat (limited to 'engines/access')
-rw-r--r--engines/access/amazon/amazon_game.cpp11
-rw-r--r--engines/access/amazon/amazon_game.h12
-rw-r--r--engines/access/amazon/amazon_resources.cpp67
-rw-r--r--engines/access/amazon/amazon_resources.h13
-rw-r--r--engines/access/amazon/amazon_scripts.cpp253
-rw-r--r--engines/access/amazon/amazon_scripts.h2
6 files changed, 356 insertions, 2 deletions
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index 87aa9358cd..b1a8bbe294 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -57,6 +57,17 @@ AmazonEngine::AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_tilePos = Common::Point(0, 0);
_hintLevel = 0;
+ _antDirection = NONE;
+ _pitDirection = NONE;
+ _antCel = 0;
+ _torchCel = 0;
+ _pitCel = 0;
+ _stabCel = 0;
+ _antPos = Common::Point(0, 0);
+ _antDieFl = _antEatFl = false;
+ _stabFl = false;
+ _pitPos = Common::Point(0, 0);
+
Common::fill(&_esTabTable[0], &_esTabTable[100], 0);
memset(_tileData, 0, sizeof(_tileData));
diff --git a/engines/access/amazon/amazon_game.h b/engines/access/amazon/amazon_game.h
index 653deefb96..0c6fb1cb41 100644
--- a/engines/access/amazon/amazon_game.h
+++ b/engines/access/amazon/amazon_game.h
@@ -149,6 +149,18 @@ public:
int _canoeVXPos;
int _canoeMoveCount;
int _canoeFrame;
+
+ Direction _antDirection;
+ Direction _pitDirection;
+ int _antCel;
+ int _torchCel;
+ int _pitCel;
+ int _stabCel;
+ Common::Point _antPos;
+ bool _antDieFl;
+ bool _antEatFl;
+ bool _stabFl;
+ Common::Point _pitPos;
public:
AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc);
diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp
index a1db01d7b3..5768be3c33 100644
--- a/engines/access/amazon/amazon_resources.cpp
+++ b/engines/access/amazon/amazon_resources.cpp
@@ -1458,6 +1458,71 @@ const int COMBO_TABLE[85][4] = {
{ -1, -1, -1, -1 }
};
-} // End of namespace Amazon
+const int ANTWALK[24] = {
+ 0, 3, 0,
+ 1, 5, 0,
+ 2, 4, 0,
+ 3, 2, 0,
+ 4, 4, 0,
+ 5, 3, 0,
+ 6, 4, 0,
+ -1, -1, -1
+};
+
+const int ANTEAT[33] = {
+ 7, 0, -1,
+ 8, 0, -5,
+ 9, 0, -11,
+ 10, 0, 7,
+ 11, 0, -3,
+ 12, 0, 3,
+ 13, 0, -1,
+ 9, 0, -6,
+ 8, 0, 11,
+ 7, 0, 6,
+ -1, -1, -1
+};
+
+const int ANTDIE[21] = {
+ 14, 4, 8,
+ 15, 7, 6,
+ 16, 6, 7,
+ 17, 8, 2,
+ 18, 0, 0,
+ 19, 0, 0,
+ -1, -1, -1
+};
+
+const int PITWALK[27] = {
+ 18, 0, -1,
+ 19, -2, 1,
+ 20, -2, 1,
+ 21, -2, 1,
+ 22, -2, 0,
+ 23, -3, 0,
+ 24, -3, -1,
+ 25, -2, -1,
+ -1, -1, -1
+};
+
+const int PITSTAB[21] = {
+ 14, -2, 0,
+ 15, -4, 0,
+ 16, 3, -13,
+ 16, 0, 0,
+ 15, -3, 13,
+ 14, 4, 0,
+ -1, -1, -1
+};
+
+const int TORCH[12] = {
+ 26, -11, -7,
+ 27, -12, -2,
+ 28, -15, -4,
+ -1, -1, -1
+};
+
+const int SPEAR[3] = {30, -13, 1};
+} // End of namespace Amazon
} // End of namespace Access
diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h
index 7aee90003e..0d65a569c7 100644
--- a/engines/access/amazon/amazon_resources.h
+++ b/engines/access/amazon/amazon_resources.h
@@ -68,6 +68,19 @@ extern const int CHAPTER_JUMP[14];
extern const int COMBO_TABLE[85][4];
+extern const int ANTWALK[24];
+
+extern const int ANTEAT[33];
+
+extern const int ANTDIE[21];
+
+extern const int PITWALK[27];
+
+extern const int PITSTAB[21];
+
+extern const int TORCH[12];
+
+extern const int SPEAR[3];
} // End of namespace Amazon
} // End of namespace Access
diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp
index a22f04b0de..0074a5d2f5 100644
--- a/engines/access/amazon/amazon_scripts.cpp
+++ b/engines/access/amazon/amazon_scripts.cpp
@@ -768,6 +768,257 @@ void AmazonScripts::setInactive() {
mWhile(_game->_rawInactiveY);
}
+void AmazonScripts::PLOTPIT() {
+ warning("TODO: PLOTPIT");
+}
+
+void AmazonScripts::ANT() {
+ _game->_antDirection = NONE;
+ if (_game->_aniFlag != 1) {
+ _game->_aniFlag = 1;
+ _game->_antCel = 0;
+ _game->_torchCel = 0;
+ _game->_pitCel = 0;
+
+ _game->_timers[15]._timer = 16;
+ _game->_timers[15]._initTm = 16;
+ _game->_timers[15]._flag = 1;
+
+ _game->_timers[13]._timer = 5;
+ _game->_timers[13]._initTm = 5;
+ _game->_timers[13]._flag = 1;
+
+ _game->_timers[14]._timer = 10;
+ _game->_timers[14]._initTm = 10;
+ _game->_timers[14]._flag = 1;
+
+ _game->_antPos = Common::Point(-40, 123);
+ _game->_antDieFl = _game->_antEatFl = false;
+ _game->_stabFl = false;
+ _game->_pitPos = Common::Point(_vm->_player->_rawPlayer.x, 127);
+ }
+
+ const int *buf = nullptr;
+ if (_game->_antDieFl) {
+ buf = Amazon::ANTDIE;
+ } else if (_game->_antEatFl) {
+ buf = Amazon::ANTEAT;
+ } else if (_game->_antPos.x > 120 && _vm->_flags[198] == 1) {
+ _game->_antEatFl = true;
+ _vm->_flags[235] = 1;
+ _game->_antCel = 0;
+ buf = Amazon::ANTEAT;
+ } else {
+ buf = Amazon::ANTWALK;
+ if (_vm->_inventory->_inv[76]._value == 1)
+ _game->_antDirection = UP;
+ }
+
+ int idx = _game->_antCel;
+ if (_game->_timers[15]._flag == 0) {
+ _game->_timers[15]._flag = 1;
+ if (_game->_antDirection == UP) {
+ if (_game->_antPos.x > 10) {
+ if (idx == 0)
+ idx = 36;
+ else
+ idx -= 6;
+
+ _game->_antPos = Common::Point(buf[(idx / 2) + 1], buf[(idx / 2) + 2]);
+ _game->_antCel = idx;
+ }
+ } else {
+ idx += 6;
+ if (buf[(idx / 2)] != -1) {
+ _game->_antPos = Common::Point(buf[(idx / 2) + 1], buf[(idx / 2) + 2]);
+ _game->_antCel = idx;
+ } else if (!_game->_antDieFl) {
+ idx = 0;
+ _game->_antPos = Common::Point(buf[(idx / 2) + 1], buf[(idx / 2) + 2]);
+ _game->_antCel = idx;
+ } else {
+ idx -= 6;
+ if (_game->_flags[200] == 0)
+ _game->_flags[200] = 1;
+ }
+ }
+ }
+
+ ImageEntry ie;
+ ie._flags = 8;
+ ie._spritesPtr = _pObject[61];
+ ie._frameNumber = buf[(idx / 2)];
+ ie._position = Common::Point(_game->_antPos.x, _game->_antPos.y);
+ ie._offsetY = _game->_antPos.y - 70;
+ _vm->_images.addToList(ie);
+ _game->_antCel = idx;
+
+ if (_game->_flags[196] != 1) {
+ idx = _game->_pitCel;
+ if (_game->_stabFl == 1) {
+ if (_vm->_inventory->_inv[78]._value == 1) {
+ PLOTPIT();
+ } else {
+ buf = Amazon::PITSTAB;
+ idx = _game->_stabCel;
+ if (_game->_timers[13]._flag == 0) {
+ PLOTPIT();
+ } else {
+ _game->_timers[13]._flag = 1;
+ idx += 6;
+ if (Amazon::PITSTAB[idx] == -1) {
+ _game->_stabFl = false;
+ _game->_pitCel = 0;
+ _game->_pitPos.y = 127;
+ idx = 0;
+ buf = Amazon::PITWALK;
+ PLOTPIT();
+ } else {
+ _game->_pitPos.x += buf[(idx / 2) + 1];
+ _game->_pitPos.y += buf[(idx / 2) + 2];
+ _game->_pitCel = idx;
+ PLOTPIT();
+ }
+ }
+ }
+ } else {
+ buf = Amazon::PITWALK;
+ if (_game->_timers[13]._flag != 0) {
+ PLOTPIT();
+ } else {
+ _game->_timers[13]._flag = 1;
+ _vm->_events->pollEvents();
+ if (_vm->_events->_leftButton) {
+ Common::Point pt = _vm->_events->calcRawMouse();
+ if (pt.x < _game->_pitPos.x) {
+ if (_game->_pitDirection == UP) {
+ _game->_pitDirection = NONE;
+ _game->_pitPos.y = 127;
+ }
+ idx = _game->_pitCel;
+ buf = Amazon::PITWALK;
+ idx += 6;
+ if (buf[idx / 2] == -1) {
+ idx = 0;
+ _game->_pitPos.y = 127;
+ }
+ _game->_pitPos.x += buf[(idx / 2) + 1];
+ _game->_pitPos.y += buf[(idx / 2) + 2];
+ _game->_pitCel = idx;
+ PLOTPIT();
+ } else if (pt.x > _game->_pitPos.x) {
+ if (_game->_pitDirection == NONE) {
+ _game->_pitDirection = UP;
+ _game->_pitPos.y = 127;
+ idx = _game->_pitCel;
+ buf = Amazon::PITWALK;
+ if (_game->_pitPos.x >= 230)
+ PLOTPIT();
+ else {
+ if (idx == 0) {
+ idx = 48;
+ _game->_pitPos.y = 127;
+ }
+ idx -= 6;
+ _game->_pitPos.x -= buf[(idx / 2) + 1];
+ _game->_pitPos.y -= buf[(idx / 2) + 2];
+ _game->_pitCel = idx;
+ PLOTPIT();
+ }
+ }
+ } else {
+ PLOTPIT();
+ }
+ } else {
+ buf = Amazon::PITWALK;
+ if (_vm->_player->_playerDirection == UP) {
+ if (_vm->_inventory->_inv[78]._value == 1) {
+ PLOTPIT();
+ } else {
+ if (_game->_stabFl) {
+ buf = Amazon::PITSTAB;
+ idx = _game->_stabCel;
+ if (_game->_timers[13]._flag == 0) {
+ PLOTPIT();
+ } else {
+ _game->_timers[13]._flag = 1;
+ idx += 6;
+ if (Amazon::PITSTAB[idx] == -1) {
+ _game->_stabFl = false;
+ _game->_pitCel = 0;
+ _game->_pitPos.y = 127;
+ idx = 0;
+ buf = Amazon::PITWALK;
+ PLOTPIT();
+ } else {
+ _game->_pitPos.x += buf[(idx / 2) + 1];
+ _game->_pitPos.y += buf[(idx / 2) + 2];
+ _game->_pitCel = idx;
+ PLOTPIT();
+ }
+ }
+ } else {
+ _game->_stabFl = true;
+ _game->_pitCel = 0;
+ idx = 0;
+ _game->_stabCel = 0;
+ int dist = _game->_pitPos.x - _game->_antPos.x;
+ if (!_game->_antEatFl || _game->_antDieFl || (dist > 80))
+ PLOTPIT();
+ else {
+ _game->_antDieFl = true;
+ _game->_antCel = 0;
+ _game->_antPos.y = 123;
+ _vm->_sound->playSound(1);
+ PLOTPIT();
+ }
+ }
+ }
+ } else if (_vm->_player->_playerDirection == LEFT) {
+ if (_game->_pitDirection == UP) {
+ _game->_pitDirection = NONE;
+ _game->_pitPos.y = 127;
+ }
+ idx = _game->_pitCel;
+ buf = Amazon::PITWALK;
+ idx += 6;
+ if (buf[idx / 2] == -1) {
+ idx = 0;
+ _game->_pitPos.y = 127;
+ }
+ _game->_pitPos.x += buf[(idx / 2) + 1];
+ _game->_pitPos.y += buf[(idx / 2) + 2];
+ _game->_pitCel = idx;
+ PLOTPIT();
+ } else if (_vm->_player->_playerDirection == RIGHT) {
+ if (_game->_pitDirection == NONE) {
+ _game->_pitDirection = UP;
+ _game->_pitPos.y = 127;
+ idx = _game->_pitCel;
+ buf = Amazon::PITWALK;
+ if (_game->_pitPos.x >= 230)
+ PLOTPIT();
+ else {
+ if (idx == 0) {
+ idx = 48;
+ _game->_pitPos.y = 127;
+ }
+ idx -= 6;
+ _game->_pitPos.x -= buf[(idx / 2) + 1];
+ _game->_pitPos.y -= buf[(idx / 2) + 2];
+ _game->_pitCel = idx;
+ PLOTPIT();
+ }
+ }
+ } else {
+ PLOTPIT();
+ }
+ }
+ }
+ }
+ }
+}
+
void AmazonScripts::boatWalls(int param1, int param2) {
if (param1 == 1)
_vm->_room->_plotter._walls[42] = Common::Rect(96, 27, 87, 42);
@@ -845,7 +1096,7 @@ void AmazonScripts::executeSpecial(int commandIndex, int param1, int param2) {
warning("TODO RIVER");
break;
case 14:
- warning("TODO ANT");
+ ANT();
break;
case 15:
boatWalls(param1, param2);
diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h
index 06ed6e5d01..9733c1c391 100644
--- a/engines/access/amazon/amazon_scripts.h
+++ b/engines/access/amazon/amazon_scripts.h
@@ -75,6 +75,8 @@ protected:
void guardSee();
void setGuardFrame();
void guard();
+ void PLOTPIT();
+ void ANT();
void loadBackground(int param1, int param2);
void plotInactive();
void setInactive();