aboutsummaryrefslogtreecommitdiff
path: root/engines/access/amazon
diff options
context:
space:
mode:
authorPaul Gilbert2014-11-27 21:35:20 -0500
committerPaul Gilbert2014-12-12 22:49:16 -0500
commit3be3cb1ac21dcaf8f79907e9ce463c4828cba65c (patch)
tree5e0da1bc83193e31c166d52cf756f69ba2169ac9 /engines/access/amazon
parent64b45e68aa10954edafe34139386b4cd7042ad74 (diff)
downloadscummvm-rg350-3be3cb1ac21dcaf8f79907e9ce463c4828cba65c.tar.gz
scummvm-rg350-3be3cb1ac21dcaf8f79907e9ce463c4828cba65c.tar.bz2
scummvm-rg350-3be3cb1ac21dcaf8f79907e9ce463c4828cba65c.zip
ACCESS: Cleanup of room _function and river canoe movement
Diffstat (limited to 'engines/access/amazon')
-rw-r--r--engines/access/amazon/amazon_game.cpp10
-rw-r--r--engines/access/amazon/amazon_resources.cpp4
-rw-r--r--engines/access/amazon/amazon_resources.h4
-rw-r--r--engines/access/amazon/amazon_scripts.cpp140
-rw-r--r--engines/access/amazon/amazon_scripts.h3
5 files changed, 68 insertions, 93 deletions
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index 912c4ddfd2..cdc7727244 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -909,7 +909,7 @@ void AmazonEngine::startChapter(int chapter) {
}
} else if (chapter != 1) {
_player->_roomNumber = CHAPTER_JUMP[_chapter - 1];
- _room->_function = 1;
+ _room->_function = FN_CLEAR1;
_converseMode = 0;
_scripts->cmdRetPos();
@@ -936,8 +936,12 @@ void AmazonEngine::synchronize(Common::Serializer &s) {
for (int i = 0; i < 100; ++i)
s.syncAsSint16LE(_esTabTable[i]);
- warning("TODO: s.syncAsSint16LE(_topList);");
- warning("TODO: s.syncAsSint16LE(_botList);");
+ if (_player->_roomNumber == 45) {
+
+
+ warning("TODO: s.syncAsSint16LE(_topList);");
+ warning("TODO: s.syncAsSint16LE(_botList);");
+ }
}
/*------------------------------------------------------------------------*/
diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp
index 68e078ef08..6148eeb8f1 100644
--- a/engines/access/amazon/amazon_resources.cpp
+++ b/engines/access/amazon/amazon_resources.cpp
@@ -1223,8 +1223,8 @@ const char *const NO_HELP_MESSAGE =
HAS DECREASED SO FAR THAT WE CAN NO LONGER PUT THE HINTS IN TERMS \
YOU CAN UNDERSTAND.";
const char *const NO_HINTS_MESSAGE = "THE HELP SYSTEM HAS BEEN TURNED OFF FOR THIS GAME.";
-const char *const HIT1 = "YOU HIT THE ROCKS AND THE CANOE BEGINS TO LEAK.";
-const char *const HIT2 = "YOU HIT THE ROCKS AND THE CANOE DEVELOPS SERIOUS LEAKS.";
+const char *const RIVER_HIT1 = "YOU HIT THE ROCKS AND THE CANOE BEGINS TO LEAK.";
+const char *const RIVER_HIT2 = "YOU HIT THE ROCKS AND THE CANOE DEVELOPS SERIOUS LEAKS.";
const char *const BAR_MESSAGE = "YOU ARE TOO BUSY TRYING TO KEEP FROM SINKING TO DO THAT";
const char *const HELPLVLTXT[3] = {
" LEVEL 1 ",
diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h
index 37b12d26cf..cd1fc95f82 100644
--- a/engines/access/amazon/amazon_resources.h
+++ b/engines/access/amazon/amazon_resources.h
@@ -75,8 +75,8 @@ extern const byte FONT6x6_DATA[];
extern const char *const NO_HELP_MESSAGE;
extern const char *const NO_HINTS_MESSAGE;
-extern const char *const HIT1;
-extern const char *const HIT2;
+extern const char *const RIVER_HIT1;
+extern const char *const RIVER_HIT2;
extern const char *const BAR_MESSAGE;
extern const char *const HELPLVLTXT[3];
extern const char *const IQLABELS[9];
diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp
index 7b4729b3e0..537dd3094d 100644
--- a/engines/access/amazon/amazon_scripts.cpp
+++ b/engines/access/amazon/amazon_scripts.cpp
@@ -40,6 +40,7 @@ AmazonScripts::AmazonScripts(AccessEngine *vm) : Scripts(vm) {
_xCam = 0;
_yCam = 0;
_zCam = 0;
+ _CHICKENOUTFLG = false;
_pNumObj = 0;
for (int i = 0; i < 32; i++) {
@@ -1557,97 +1558,66 @@ void AmazonScripts::riverSound() {
}
void AmazonScripts::moveCanoe() {
- if (_game->_canoeDir != 0) {
- _game->_canoeYPos += _game->_canoeDir;
- ++_game->_canoeMoveCount;
- if (_game->_canoeMoveCount == 5) {
- _game->_canoeLane += _game->_canoeDir;
- _game->_canoeDir = 0;
- }
- return;
- }
+ Screen &screen = *_vm->_screen;
+ EventsManager &events = *_vm->_events;
+ Common::Point pt = events.calcRawMouse();
_vm->_events->pollEvents();
- if (_vm->_events->_leftButton) {
- Common::Point pt = _vm->_events->calcRawMouse();
- if (pt.y < 180) {
- if (_vm->_events->_mousePos.x < RMOUSE[8][0]) {
+
+ if (_game->_canoeDir) {
+ // Canoe movement in progress
+ moveCanoe2();
+ } else {
+ if (events._leftButton && pt.y < 180) {
+ if (RMOUSE[8][0] < pt.x) {
printString(BAR_MESSAGE);
- return;
- }
- _game->_saveRiver = 1;
- _vm->_rScrollRow = _vm->_screen->_scrollRow;
- _vm->_rScrollCol = _vm->_screen->_scrollCol;
- _vm->_rScrollX = _vm->_screen->_scrollX;
- _vm->_rScrollY = _vm->_screen->_scrollY;
- _vm->_rOldRectCount = _vm->_oldRects.size();
- _vm->_rNewRectCount = _vm->_newRects.size();
- // _vm->_rKeyFlag = KEYFLG;
- _vm->_mapOffset = _game->_mapPtr - MAPTBL[_game->_riverFlag];
- _vm->doLoadSave();
- if (_vm->_room->_function == 1) {
- _endFlag = true;
- _returnCode = 0;
} else {
- _game->_saveRiver = 0;
- _vm->_room->buildScreen();
- _vm->copyBF2Vid();
+ _game->_saveRiver = 1;
+ _game->_rScrollRow = screen._scrollRow;
+ _game->_rScrollCol = screen._scrollCol;
+ _game->_rScrollX = screen._scrollX;
+ _game->_rScrollY = screen._scrollY;
+ _game->_mapOffset = _game->_mapPtr - MAPTBL[_game->_riverFlag];
+
+ // Show the ScummVM menu
+ _vm->_room->handleCommand(9);
+
+ if (_vm->_room->_function == FN_CLEAR1) {
+ _endFlag = true;
+ _returnCode = 0;
+ } else {
+ _game->_saveRiver = 0;
+ _vm->_room->buildScreen();
+ _vm->copyBF2Vid();
+ }
}
- return;
- }
-
- if (pt.y <= _game->_canoeYPos) {
- if (_game->_canoeLane == 0)
- return;
-
- _game->_canoeDir = -1;
- _game->_canoeMoveCount = 0;
- _game->_canoeYPos += _game->_canoeDir;
- ++_game->_canoeMoveCount;
- if (_game->_canoeMoveCount == 5) {
- _game->_canoeLane += _game->_canoeDir;
- _game->_canoeDir = 0;
+ } else if ((events._leftButton && pt.y <= _game->_canoeYPos) ||
+ (!events._leftButton && _vm->_player->_move == UP)) {
+ // Move canoe up
+ if (_game->_canoeLane > 0) {
+ _game->_canoeDir = -1;
+ _game->_canoeMoveCount = 0;
+
+ moveCanoe2();
}
- } else {
- if (_game->_canoeLane == 7)
- return;
+ } else if (events._leftButton || _vm->_player->_move == DOWN) {
+ // Move canoe down
+ if (_game->_canoeLane < 7) {
+ _game->_canoeDir = 1;
+ _game->_canoeMoveCount = 0;
- _game->_canoeDir = 1;
- _game->_canoeMoveCount = 0;
- _game->_canoeYPos += _game->_canoeDir;
- ++_game->_canoeMoveCount;
- if (_game->_canoeMoveCount == 5) {
- _game->_canoeLane += _game->_canoeDir;
- _game->_canoeDir = 0;
+ moveCanoe2();
}
}
- return;
- }
-
- if (_vm->_player->_move == UP) {
- if (_game->_canoeLane == 0)
- return;
+ }
+}
- _game->_canoeDir = -1;
- _game->_canoeMoveCount = 0;
- _game->_canoeYPos += _game->_canoeDir;
- ++_game->_canoeMoveCount;
- if (_game->_canoeMoveCount == 5) {
- _game->_canoeLane += _game->_canoeDir;
- _game->_canoeDir = 0;
- }
- } else if (_vm->_player->_move == DOWN) {
- if (_game->_canoeLane == 7)
- return;
+void AmazonScripts::moveCanoe2() {
+ _game->_canoeYPos += _game->_canoeDir;
- _game->_canoeDir = 1;
- _game->_canoeMoveCount = 0;
+ if (++_game->_canoeMoveCount == 5) {
_game->_canoeYPos += _game->_canoeDir;
- ++_game->_canoeMoveCount;
- if (_game->_canoeMoveCount == 5) {
- _game->_canoeLane += _game->_canoeDir;
- _game->_canoeDir = 0;
- }
+ _game->_canoeDir = 0;
}
}
@@ -1768,22 +1738,22 @@ void AmazonScripts::RIVER() {
static const int RIVERDEATH[5] = {22, 23, 24, 25, 26};
initRiver();
- while (true) {
+ while (!_vm->shouldQuit()) {
_vm->_events->_vbCount = 4;
// int bx = _vm->_player->_scrollAmount - _screenVertX;
if (_vm->_screen->_scrollX == 0) {
_vm->_sound->midiRepeat();
if (riverJumpTest()) {
- CHICKENOUTFLG = false;
+ _CHICKENOUTFLG = false;
return;
}
} else {
_vm->_screen->_scrollX -= _vm->_player->_scrollAmount;
}
- if (CHICKENOUTFLG) {
- CHICKENOUTFLG = false;
+ if (_CHICKENOUTFLG) {
+ _CHICKENOUTFLG = false;
return;
}
@@ -1794,8 +1764,8 @@ void AmazonScripts::RIVER() {
pan();
moveCanoe();
- if (_vm->_room->_function == 1) {
- CHICKENOUTFLG = false;
+ if (_vm->_room->_function == FN_CLEAR1) {
+ _CHICKENOUTFLG = false;
return;
}
diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h
index 20dfb6345d..5fd1bb848a 100644
--- a/engines/access/amazon/amazon_scripts.h
+++ b/engines/access/amazon/amazon_scripts.h
@@ -43,7 +43,7 @@ private:
int _zCam;
int _pNumObj;
int _screenVertX;
- bool CHICKENOUTFLG;
+ bool _CHICKENOUTFLG;
int _pImgNum[32];
SpriteResource *_pObject[32];
@@ -94,6 +94,7 @@ protected:
bool riverJumpTest();
void riverSound();
void moveCanoe();
+ void moveCanoe2();
void updateObstacles();
void riverSetPhysX();
bool checkRiverCollide();