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;
|
delete saveFile;
|
||||||
|
|
||||||
// Set extra post-load state
|
// Set extra post-load state
|
||||||
_room->_function = 1;
|
_room->_function = FN_CLEAR1;
|
||||||
_timers._timersSavedFlag = false;
|
_timers._timersSavedFlag = false;
|
||||||
_events->clearEvents();
|
_events->clearEvents();
|
||||||
|
|
||||||
|
|
|
@ -909,7 +909,7 @@ void AmazonEngine::startChapter(int chapter) {
|
||||||
}
|
}
|
||||||
} else if (chapter != 1) {
|
} else if (chapter != 1) {
|
||||||
_player->_roomNumber = CHAPTER_JUMP[_chapter - 1];
|
_player->_roomNumber = CHAPTER_JUMP[_chapter - 1];
|
||||||
_room->_function = 1;
|
_room->_function = FN_CLEAR1;
|
||||||
_converseMode = 0;
|
_converseMode = 0;
|
||||||
|
|
||||||
_scripts->cmdRetPos();
|
_scripts->cmdRetPos();
|
||||||
|
@ -936,8 +936,12 @@ void AmazonEngine::synchronize(Common::Serializer &s) {
|
||||||
for (int i = 0; i < 100; ++i)
|
for (int i = 0; i < 100; ++i)
|
||||||
s.syncAsSint16LE(_esTabTable[i]);
|
s.syncAsSint16LE(_esTabTable[i]);
|
||||||
|
|
||||||
warning("TODO: s.syncAsSint16LE(_topList);");
|
if (_player->_roomNumber == 45) {
|
||||||
warning("TODO: s.syncAsSint16LE(_botList);");
|
|
||||||
|
|
||||||
|
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 \
|
HAS DECREASED SO FAR THAT WE CAN NO LONGER PUT THE HINTS IN TERMS \
|
||||||
YOU CAN UNDERSTAND.";
|
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 RIVER_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_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 BAR_MESSAGE = "YOU ARE TOO BUSY TRYING TO KEEP FROM SINKING TO DO THAT";
|
||||||
const char *const HELPLVLTXT[3] = {
|
const char *const HELPLVLTXT[3] = {
|
||||||
" LEVEL 1 ",
|
" LEVEL 1 ",
|
||||||
|
|
|
@ -75,8 +75,8 @@ extern const byte FONT6x6_DATA[];
|
||||||
|
|
||||||
extern const char *const NO_HELP_MESSAGE;
|
extern const char *const NO_HELP_MESSAGE;
|
||||||
extern const char *const NO_HINTS_MESSAGE;
|
extern const char *const NO_HINTS_MESSAGE;
|
||||||
extern const char *const HIT1;
|
extern const char *const RIVER_HIT1;
|
||||||
extern const char *const HIT2;
|
extern const char *const RIVER_HIT2;
|
||||||
extern const char *const BAR_MESSAGE;
|
extern const char *const BAR_MESSAGE;
|
||||||
extern const char *const HELPLVLTXT[3];
|
extern const char *const HELPLVLTXT[3];
|
||||||
extern const char *const IQLABELS[9];
|
extern const char *const IQLABELS[9];
|
||||||
|
|
|
@ -40,6 +40,7 @@ AmazonScripts::AmazonScripts(AccessEngine *vm) : Scripts(vm) {
|
||||||
_xCam = 0;
|
_xCam = 0;
|
||||||
_yCam = 0;
|
_yCam = 0;
|
||||||
_zCam = 0;
|
_zCam = 0;
|
||||||
|
_CHICKENOUTFLG = false;
|
||||||
|
|
||||||
_pNumObj = 0;
|
_pNumObj = 0;
|
||||||
for (int i = 0; i < 32; i++) {
|
for (int i = 0; i < 32; i++) {
|
||||||
|
@ -1557,97 +1558,66 @@ void AmazonScripts::riverSound() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AmazonScripts::moveCanoe() {
|
void AmazonScripts::moveCanoe() {
|
||||||
if (_game->_canoeDir != 0) {
|
Screen &screen = *_vm->_screen;
|
||||||
_game->_canoeYPos += _game->_canoeDir;
|
EventsManager &events = *_vm->_events;
|
||||||
++_game->_canoeMoveCount;
|
Common::Point pt = events.calcRawMouse();
|
||||||
if (_game->_canoeMoveCount == 5) {
|
|
||||||
_game->_canoeLane += _game->_canoeDir;
|
|
||||||
_game->_canoeDir = 0;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_vm->_events->pollEvents();
|
_vm->_events->pollEvents();
|
||||||
if (_vm->_events->_leftButton) {
|
|
||||||
Common::Point pt = _vm->_events->calcRawMouse();
|
if (_game->_canoeDir) {
|
||||||
if (pt.y < 180) {
|
// Canoe movement in progress
|
||||||
if (_vm->_events->_mousePos.x < RMOUSE[8][0]) {
|
moveCanoe2();
|
||||||
|
} else {
|
||||||
|
if (events._leftButton && pt.y < 180) {
|
||||||
|
if (RMOUSE[8][0] < pt.x) {
|
||||||
printString(BAR_MESSAGE);
|
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 {
|
} else {
|
||||||
_game->_saveRiver = 0;
|
_game->_saveRiver = 1;
|
||||||
_vm->_room->buildScreen();
|
_game->_rScrollRow = screen._scrollRow;
|
||||||
_vm->copyBF2Vid();
|
_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;
|
} 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;
|
||||||
|
|
||||||
if (pt.y <= _game->_canoeYPos) {
|
moveCanoe2();
|
||||||
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 {
|
} else if (events._leftButton || _vm->_player->_move == DOWN) {
|
||||||
if (_game->_canoeLane == 7)
|
// Move canoe down
|
||||||
return;
|
if (_game->_canoeLane < 7) {
|
||||||
|
_game->_canoeDir = 1;
|
||||||
|
_game->_canoeMoveCount = 0;
|
||||||
|
|
||||||
_game->_canoeDir = 1;
|
moveCanoe2();
|
||||||
_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) {
|
void AmazonScripts::moveCanoe2() {
|
||||||
if (_game->_canoeLane == 0)
|
_game->_canoeYPos += _game->_canoeDir;
|
||||||
return;
|
|
||||||
|
|
||||||
_game->_canoeDir = -1;
|
if (++_game->_canoeMoveCount == 5) {
|
||||||
_game->_canoeMoveCount = 0;
|
|
||||||
_game->_canoeYPos += _game->_canoeDir;
|
_game->_canoeYPos += _game->_canoeDir;
|
||||||
++_game->_canoeMoveCount;
|
_game->_canoeDir = 0;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1768,22 +1738,22 @@ void AmazonScripts::RIVER() {
|
||||||
static const int RIVERDEATH[5] = {22, 23, 24, 25, 26};
|
static const int RIVERDEATH[5] = {22, 23, 24, 25, 26};
|
||||||
|
|
||||||
initRiver();
|
initRiver();
|
||||||
while (true) {
|
while (!_vm->shouldQuit()) {
|
||||||
_vm->_events->_vbCount = 4;
|
_vm->_events->_vbCount = 4;
|
||||||
|
|
||||||
// int bx = _vm->_player->_scrollAmount - _screenVertX;
|
// int bx = _vm->_player->_scrollAmount - _screenVertX;
|
||||||
if (_vm->_screen->_scrollX == 0) {
|
if (_vm->_screen->_scrollX == 0) {
|
||||||
_vm->_sound->midiRepeat();
|
_vm->_sound->midiRepeat();
|
||||||
if (riverJumpTest()) {
|
if (riverJumpTest()) {
|
||||||
CHICKENOUTFLG = false;
|
_CHICKENOUTFLG = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
_vm->_screen->_scrollX -= _vm->_player->_scrollAmount;
|
_vm->_screen->_scrollX -= _vm->_player->_scrollAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CHICKENOUTFLG) {
|
if (_CHICKENOUTFLG) {
|
||||||
CHICKENOUTFLG = false;
|
_CHICKENOUTFLG = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1794,8 +1764,8 @@ void AmazonScripts::RIVER() {
|
||||||
pan();
|
pan();
|
||||||
moveCanoe();
|
moveCanoe();
|
||||||
|
|
||||||
if (_vm->_room->_function == 1) {
|
if (_vm->_room->_function == FN_CLEAR1) {
|
||||||
CHICKENOUTFLG = false;
|
_CHICKENOUTFLG = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ private:
|
||||||
int _zCam;
|
int _zCam;
|
||||||
int _pNumObj;
|
int _pNumObj;
|
||||||
int _screenVertX;
|
int _screenVertX;
|
||||||
bool CHICKENOUTFLG;
|
bool _CHICKENOUTFLG;
|
||||||
int _pImgNum[32];
|
int _pImgNum[32];
|
||||||
|
|
||||||
SpriteResource *_pObject[32];
|
SpriteResource *_pObject[32];
|
||||||
|
@ -94,6 +94,7 @@ protected:
|
||||||
bool riverJumpTest();
|
bool riverJumpTest();
|
||||||
void riverSound();
|
void riverSound();
|
||||||
void moveCanoe();
|
void moveCanoe();
|
||||||
|
void moveCanoe2();
|
||||||
void updateObstacles();
|
void updateObstacles();
|
||||||
void riverSetPhysX();
|
void riverSetPhysX();
|
||||||
bool checkRiverCollide();
|
bool checkRiverCollide();
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
namespace Access {
|
namespace Access {
|
||||||
|
|
||||||
Room::Room(AccessEngine *vm) : Manager(vm) {
|
Room::Room(AccessEngine *vm) : Manager(vm) {
|
||||||
_function = 0;
|
_function = FN_NONE;
|
||||||
_roomFlag = 0;
|
_roomFlag = 0;
|
||||||
_playField = nullptr;
|
_playField = nullptr;
|
||||||
_playFieldWidth = _playFieldHeight = 0;
|
_playFieldWidth = _playFieldHeight = 0;
|
||||||
|
@ -70,7 +70,7 @@ void Room::doRoom() {
|
||||||
|
|
||||||
reloadFlag = false;
|
reloadFlag = false;
|
||||||
_vm->_startup = 8;
|
_vm->_startup = 8;
|
||||||
_function = 0;
|
_function = FN_NONE;
|
||||||
|
|
||||||
while (!_vm->shouldQuit()) {
|
while (!_vm->shouldQuit()) {
|
||||||
_vm->_images.clear();
|
_vm->_images.clear();
|
||||||
|
@ -111,7 +111,7 @@ void Room::doRoom() {
|
||||||
if (_vm->_player->_scrollFlag) {
|
if (_vm->_player->_scrollFlag) {
|
||||||
_vm->copyBF1BF2();
|
_vm->copyBF1BF2();
|
||||||
_vm->_newRects.clear();
|
_vm->_newRects.clear();
|
||||||
_function = 0;
|
_function = FN_NONE;
|
||||||
roomLoop();
|
roomLoop();
|
||||||
|
|
||||||
if (_function == FN_CLEAR1) {
|
if (_function == FN_CLEAR1) {
|
||||||
|
@ -125,7 +125,7 @@ void Room::doRoom() {
|
||||||
} else {
|
} else {
|
||||||
_vm->copyBF1BF2();
|
_vm->copyBF1BF2();
|
||||||
_vm->_newRects.clear();
|
_vm->_newRects.clear();
|
||||||
_function = 0;
|
_function = FN_NONE;
|
||||||
|
|
||||||
roomLoop();
|
roomLoop();
|
||||||
if (_vm->shouldQuit())
|
if (_vm->shouldQuit())
|
||||||
|
|
|
@ -91,11 +91,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
void freeTileData();
|
void freeTileData();
|
||||||
|
|
||||||
/**
|
|
||||||
* Switch to a given command mode
|
|
||||||
*/
|
|
||||||
void handleCommand(int commandId);
|
|
||||||
|
|
||||||
int checkBoxes();
|
int checkBoxes();
|
||||||
int checkBoxes1(const Common::Point &pt);
|
int checkBoxes1(const Common::Point &pt);
|
||||||
int checkBoxes2(const Common::Point &pt, int start, int count);
|
int checkBoxes2(const Common::Point &pt, int start, int count);
|
||||||
|
@ -120,7 +115,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
Plotter _plotter;
|
Plotter _plotter;
|
||||||
Common::Array<JetFrame> _jetFrame;
|
Common::Array<JetFrame> _jetFrame;
|
||||||
int _function;
|
Function _function;
|
||||||
int _roomFlag;
|
int _roomFlag;
|
||||||
byte *_playField;
|
byte *_playField;
|
||||||
int _matrixSize;
|
int _matrixSize;
|
||||||
|
@ -166,6 +161,11 @@ public:
|
||||||
void setWallCodes();
|
void setWallCodes();
|
||||||
|
|
||||||
bool codeWalls();
|
bool codeWalls();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Switch to a given command mode
|
||||||
|
*/
|
||||||
|
void handleCommand(int commandId);
|
||||||
};
|
};
|
||||||
|
|
||||||
class RoomInfo {
|
class RoomInfo {
|
||||||
|
|
|
@ -531,7 +531,7 @@ void Scripts::cmdSpecial() {
|
||||||
|
|
||||||
if (_specialFunction == 1) {
|
if (_specialFunction == 1) {
|
||||||
_vm->_screen->restorePalette();
|
_vm->_screen->restorePalette();
|
||||||
_vm->_room->_function = 3;
|
_vm->_room->_function = FN_RELOAD;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue