ACCESS: Cleanup of room _function and river canoe movement
This commit is contained in:
parent
64b45e68aa
commit
3be3cb1ac2
9 changed files with 81 additions and 106 deletions
|
@ -489,7 +489,7 @@ Common::Error AccessEngine::loadGameState(int slot) {
|
|||
delete saveFile;
|
||||
|
||||
// Set extra post-load state
|
||||
_room->_function = 1;
|
||||
_room->_function = FN_CLEAR1;
|
||||
_timers._timersSavedFlag = false;
|
||||
_events->clearEvents();
|
||||
|
||||
|
|
|
@ -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]);
|
||||
|
||||
if (_player->_roomNumber == 45) {
|
||||
|
||||
|
||||
warning("TODO: s.syncAsSint16LE(_topList);");
|
||||
warning("TODO: s.syncAsSint16LE(_botList);");
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
|
|
@ -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 ",
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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,35 +1558,31 @@ 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;
|
||||
}
|
||||
} else {
|
||||
_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) {
|
||||
_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 {
|
||||
|
@ -1593,64 +1590,37 @@ void AmazonScripts::moveCanoe() {
|
|||
_vm->_room->buildScreen();
|
||||
_vm->copyBF2Vid();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (pt.y <= _game->_canoeYPos) {
|
||||
if (_game->_canoeLane == 0)
|
||||
return;
|
||||
|
||||
} 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;
|
||||
_game->_canoeYPos += _game->_canoeDir;
|
||||
++_game->_canoeMoveCount;
|
||||
if (_game->_canoeMoveCount == 5) {
|
||||
_game->_canoeLane += _game->_canoeDir;
|
||||
_game->_canoeDir = 0;
|
||||
}
|
||||
} else {
|
||||
if (_game->_canoeLane == 7)
|
||||
return;
|
||||
|
||||
moveCanoe2();
|
||||
}
|
||||
} else if (events._leftButton || _vm->_player->_move == DOWN) {
|
||||
// Move canoe down
|
||||
if (_game->_canoeLane < 7) {
|
||||
_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;
|
||||
moveCanoe2();
|
||||
}
|
||||
} 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::moveCanoe2() {
|
||||
_game->_canoeYPos += _game->_canoeDir;
|
||||
|
||||
if (++_game->_canoeMoveCount == 5) {
|
||||
_game->_canoeYPos += _game->_canoeDir;
|
||||
_game->_canoeDir = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void AmazonScripts::updateObstacles() {
|
||||
RiverStruct *cur = _game->_topList;
|
||||
while (true) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
namespace Access {
|
||||
|
||||
Room::Room(AccessEngine *vm) : Manager(vm) {
|
||||
_function = 0;
|
||||
_function = FN_NONE;
|
||||
_roomFlag = 0;
|
||||
_playField = nullptr;
|
||||
_playFieldWidth = _playFieldHeight = 0;
|
||||
|
@ -70,7 +70,7 @@ void Room::doRoom() {
|
|||
|
||||
reloadFlag = false;
|
||||
_vm->_startup = 8;
|
||||
_function = 0;
|
||||
_function = FN_NONE;
|
||||
|
||||
while (!_vm->shouldQuit()) {
|
||||
_vm->_images.clear();
|
||||
|
@ -111,7 +111,7 @@ void Room::doRoom() {
|
|||
if (_vm->_player->_scrollFlag) {
|
||||
_vm->copyBF1BF2();
|
||||
_vm->_newRects.clear();
|
||||
_function = 0;
|
||||
_function = FN_NONE;
|
||||
roomLoop();
|
||||
|
||||
if (_function == FN_CLEAR1) {
|
||||
|
@ -125,7 +125,7 @@ void Room::doRoom() {
|
|||
} else {
|
||||
_vm->copyBF1BF2();
|
||||
_vm->_newRects.clear();
|
||||
_function = 0;
|
||||
_function = FN_NONE;
|
||||
|
||||
roomLoop();
|
||||
if (_vm->shouldQuit())
|
||||
|
|
|
@ -91,11 +91,6 @@ protected:
|
|||
*/
|
||||
void freeTileData();
|
||||
|
||||
/**
|
||||
* Switch to a given command mode
|
||||
*/
|
||||
void handleCommand(int commandId);
|
||||
|
||||
int checkBoxes();
|
||||
int checkBoxes1(const Common::Point &pt);
|
||||
int checkBoxes2(const Common::Point &pt, int start, int count);
|
||||
|
@ -120,7 +115,7 @@ protected:
|
|||
public:
|
||||
Plotter _plotter;
|
||||
Common::Array<JetFrame> _jetFrame;
|
||||
int _function;
|
||||
Function _function;
|
||||
int _roomFlag;
|
||||
byte *_playField;
|
||||
int _matrixSize;
|
||||
|
@ -166,6 +161,11 @@ public:
|
|||
void setWallCodes();
|
||||
|
||||
bool codeWalls();
|
||||
|
||||
/**
|
||||
* Switch to a given command mode
|
||||
*/
|
||||
void handleCommand(int commandId);
|
||||
};
|
||||
|
||||
class RoomInfo {
|
||||
|
|
|
@ -531,7 +531,7 @@ void Scripts::cmdSpecial() {
|
|||
|
||||
if (_specialFunction == 1) {
|
||||
_vm->_screen->restorePalette();
|
||||
_vm->_room->_function = 3;
|
||||
_vm->_room->_function = FN_RELOAD;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue