diff options
author | Paul Gilbert | 2014-08-16 17:24:22 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-16 17:24:22 -0400 |
commit | a42e52fb5baa2d9ed9e2d726cfdf0365acd15472 (patch) | |
tree | 80c691746ce5962163df1bb3d925ceae4115e8ea /engines | |
parent | 0b7078397417a3f54d33cebcd602034c8d0d1a1e (diff) | |
download | scummvm-rg350-a42e52fb5baa2d9ed9e2d726cfdf0365acd15472.tar.gz scummvm-rg350-a42e52fb5baa2d9ed9e2d726cfdf0365acd15472.tar.bz2 scummvm-rg350-a42e52fb5baa2d9ed9e2d726cfdf0365acd15472.zip |
ACCESS: Implemented code for clicking in room area
Diffstat (limited to 'engines')
-rw-r--r-- | engines/access/amazon/amazon_game.h | 30 | ||||
-rw-r--r-- | engines/access/amazon/amazon_room.cpp | 25 | ||||
-rw-r--r-- | engines/access/amazon/amazon_room.h | 3 | ||||
-rw-r--r-- | engines/access/room.cpp | 46 | ||||
-rw-r--r-- | engines/access/room.h | 7 |
5 files changed, 95 insertions, 16 deletions
diff --git a/engines/access/amazon/amazon_game.h b/engines/access/amazon/amazon_game.h index c927ad90d7..848af85f30 100644 --- a/engines/access/amazon/amazon_game.h +++ b/engines/access/amazon/amazon_game.h @@ -48,21 +48,6 @@ private: int _inactiveYOff; int _esTabTable[100]; - // Fields that are mapped to flags - int &_guardLocation; - int &_guardFind; - int &_helpLevel; - int &_jasMayaFlag; - int &_moreHelp; - int &_flashbackFlag; - int &_riverFlag; - int &_aniOutFlag; - int &_badEnd; - int &_noHints; - int &_aniFlag; - int &_allenFlag; - int &_noSound; - /** * Do the game introduction */ @@ -94,6 +79,21 @@ protected: */ virtual void playGame(); public: + // Fields that are mapped to flags + int &_guardLocation; + int &_guardFind; + int &_helpLevel; + int &_jasMayaFlag; + int &_moreHelp; + int &_flashbackFlag; + int &_riverFlag; + int &_aniOutFlag; + int &_badEnd; + int &_noHints; + int &_aniFlag; + int &_allenFlag; + int &_noSound; +public: AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc); virtual ~AmazonEngine(); diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp index 405889fe1a..bf3c2501bb 100644 --- a/engines/access/amazon/amazon_room.cpp +++ b/engines/access/amazon/amazon_room.cpp @@ -23,6 +23,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_room.h" @@ -31,6 +32,7 @@ namespace Access { namespace Amazon { AmazonRoom::AmazonRoom(AccessEngine *vm): Room(vm) { + _game = (AmazonEngine *)vm; _antOutFlag = false; _icon = nullptr; } @@ -140,7 +142,28 @@ void AmazonRoom::roomMenu() { } void AmazonRoom::mainAreaClick() { - + if (_selectCommand == -1) { + if (_vm->_player->_roomNumber == 42 || _vm->_player->_roomNumber == 44 || + _vm->_player->_roomNumber == 31 || _vm->_player->_roomNumber == 29) { + switch (checkBoxes1(_vm->_events->_mousePos)) { + case 0: + _game->_jasMayaFlag = 0; + break; + case 1: + _game->_jasMayaFlag = 1; + break; + default: + break; + } + } + } else if (_vm->_events->_mousePos.x >= _vm->_screen->_windowXAdd && + _vm->_events->_mousePos.x <= _vm->_screen->_vWindowBytesWide && + _vm->_events->_mousePos.y >= _vm->_screen->_windowYAdd && + _vm->_events->_mousePos.y <= _vm->_screen->_vWindowLinesTall) { + if (checkBoxes1(_vm->_events->_mousePos) >= 0) { + checkBoxes3(); + } + } } } // End of namespace Amazon diff --git a/engines/access/amazon/amazon_room.h b/engines/access/amazon/amazon_room.h index 838b108fb5..c7d8e0c0ae 100644 --- a/engines/access/amazon/amazon_room.h +++ b/engines/access/amazon/amazon_room.h @@ -32,8 +32,11 @@ class AccessEngine; namespace Amazon { +class AmazonEngine; + class AmazonRoom : public Room { private: + AmazonEngine *_game; bool _antOutFlag; const byte *_icon; diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 796a441a25..4da207b290 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -538,6 +538,52 @@ void Room::commandOff() { roomMenu(); } +int Room::checkBoxes() { + return checkBoxes1(_vm->_player->_rawPlayer); +} + +int Room::checkBoxes1(const Common::Point &pt) { + return checkBoxes2(pt, 0, _plotter._blocks.size()); +} + +int Room::checkBoxes2(const Common::Point &pt, int start, int count) { + for (; count > 0; --count, ++start) { + if (_plotter._blocks[start].contains(pt)) { + _plotter._blockIn = start; + return start; + } + } + + return -1; +} + +void Room::checkBoxes3() { + for (int start = 0; start < _plotter._blocks.size(); ++start) { + if (_plotter._blocks[start].contains(_vm->_events->_mousePos)) { + _plotter._blockIn = start; + if (!(validateBox(start) & 0x80)) { + _vm->_events->debounceLeft(); + _vm->_boxSelect = start; + + _conFlag = true; + while (_conFlag && !_vm->shouldQuit()) { + _conFlag = false; + _vm->_scripts->executeScript(); + } + + _vm->_boxSelect = -1; + return; + } + } + } +} + +int Room::validateBox(int boxId) { + _vm->_scripts->_sequence = boxId; + _vm->_scripts->searchForSequence(); + return _vm->_scripts->executeScript(); +} + /*------------------------------------------------------------------------*/ RoomInfo::RoomInfo(const byte *data) { diff --git a/engines/access/room.h b/engines/access/room.h index 00de53f0a7..19c3cc423b 100644 --- a/engines/access/room.h +++ b/engines/access/room.h @@ -86,6 +86,13 @@ protected: */ void handleCommand(int commandId); + int checkBoxes(); + int checkBoxes1(const Common::Point &pt); + int checkBoxes2(const Common::Point &pt, int start, int count); + void checkBoxes3(); + + int validateBox(int boxId); + /** * Inner handler for switching to a given command mode */ |