From 51ccd0c1fbbb2065441e6c7fbbe7f6ec6c3c3e3e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 24 Nov 2014 21:10:29 +0100 Subject: [PATCH] ACCESS: Implement moveCanoe --- engines/access/amazon/amazon_resources.cpp | 7 +- engines/access/amazon/amazon_resources.h | 3 + engines/access/amazon/amazon_scripts.cpp | 98 +++++++++++++++++++++- engines/access/amazon/amazon_scripts.h | 2 +- 4 files changed, 103 insertions(+), 7 deletions(-) diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp index 23929ef4ba97..08b57957eca9 100644 --- a/engines/access/amazon/amazon_resources.cpp +++ b/engines/access/amazon/amazon_resources.cpp @@ -1209,9 +1209,10 @@ const char *const NO_HELP_MESSAGE = "WE ARE UNABLE TO PROVIDE YOU WITH ANY MORE HINTS. YOUR IQ \ 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 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 BAR_MESSAGE = "YOU ARE TOO BUSY TRYING TO KEEP FROM SINKING TO DO THAT"; const byte DEATH_SCREENS[58] = { 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h index 99ce40e96599..65a38dc660db 100644 --- a/engines/access/amazon/amazon_resources.h +++ b/engines/access/amazon/amazon_resources.h @@ -62,6 +62,9 @@ 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 BAR_MESSAGE; extern const byte DEATH_SCREENS[58]; diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index 3f0e53e6df07..5e53e0b94623 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -22,6 +22,7 @@ #include "common/scummsys.h" #include "access/access.h" +#include "access/resources.h" #include "access/amazon/amazon_game.h" #include "access/amazon/amazon_resources.h" #include "access/amazon/amazon_scripts.h" @@ -1801,8 +1802,99 @@ void AmazonScripts::riverSound() { _vm->_sound->playSound(1); } -void AmazonScripts::MOVECANOE() { - warning("TODO: MOVECANOE();"); +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; + } + + _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]) { + 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(); + } + 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 (_game->_canoeLane == 7) + return; + + _game->_canoeDir = 1; + _game->_canoeMoveCount = 0; + _game->_canoeYPos += _game->_canoeDir; + ++_game->_canoeMoveCount; + if (_game->_canoeMoveCount == 5) { + _game->_canoeLane += _game->_canoeDir; + _game->_canoeDir = 0; + } + } + 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; + + _game->_canoeDir = 1; + _game->_canoeMoveCount = 0; + _game->_canoeYPos += _game->_canoeDir; + ++_game->_canoeMoveCount; + if (_game->_canoeMoveCount == 5) { + _game->_canoeLane += _game->_canoeDir; + _game->_canoeDir = 0; + } + } } void AmazonScripts::UPDATEOBSTACLES() { @@ -1864,7 +1956,7 @@ void AmazonScripts::RIVER() { riverSound(); pan(); - MOVECANOE(); + moveCanoe(); if (_vm->_room->_function == 1) { CHICKENOUTFLG = false; diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h index 1e3290e8e735..20fca8ea7028 100644 --- a/engines/access/amazon/amazon_scripts.h +++ b/engines/access/amazon/amazon_scripts.h @@ -100,7 +100,7 @@ class AmazonScripts: public Scripts { void checkRiverPan(); bool riverJumpTest(); void riverSound(); - void MOVECANOE(); + void moveCanoe(); void UPDATEOBSTACLES(); void riverSetPhysX(); void RIVERCOLLIDE();