From 56754c2a9d98ba41f97e0596fd0015f3edb07366 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 2 Jan 2015 22:34:45 +0100 Subject: ACCESS: MM - Make RMOUSE game-specific --- engines/access/amazon/amazon_logic.cpp | 2 +- engines/access/amazon/amazon_resources.cpp | 7 ++++++- engines/access/amazon/amazon_resources.h | 4 ++-- engines/access/martian/martian_resources.cpp | 6 +++++- engines/access/martian/martian_resources.h | 5 ++++- engines/access/resources.cpp | 5 ----- engines/access/resources.h | 2 -- engines/access/room.cpp | 23 ++++++++++++++++++++--- engines/access/room.h | 1 + 9 files changed, 39 insertions(+), 16 deletions(-) (limited to 'engines') diff --git a/engines/access/amazon/amazon_logic.cpp b/engines/access/amazon/amazon_logic.cpp index 436a875688..d24629a467 100644 --- a/engines/access/amazon/amazon_logic.cpp +++ b/engines/access/amazon/amazon_logic.cpp @@ -1591,7 +1591,7 @@ void River::moveCanoe() { moveCanoe2(); } else { if (events._leftButton && pt.y >= 140) { - if (pt.x < RMOUSE[8][0]) { + if (pt.x < _vm->_room->_rMouse[8][0]) { // Disk icon wasn't clicked _vm->_scripts->printString(BAR_MESSAGE); } else { diff --git a/engines/access/amazon/amazon_resources.cpp b/engines/access/amazon/amazon_resources.cpp index 2010c7d842..2b36ca943a 100644 --- a/engines/access/amazon/amazon_resources.cpp +++ b/engines/access/amazon/amazon_resources.cpp @@ -2406,6 +2406,11 @@ const int CAST_END_OBJ1[4][4] = { { 3, 103, 1300, 10 } }; -} // End of namespace Amazon +const int RMOUSE[10][2] = { + { 0, 35 }, { 0, 0 }, { 36, 70 }, { 71, 106 }, { 107, 141 }, + { 142, 177 }, { 178, 212 }, { 213, 248 }, { 249, 283 }, { 284, 318 } +}; + +} // End of namespace Amazon } // End of namespace Access diff --git a/engines/access/amazon/amazon_resources.h b/engines/access/amazon/amazon_resources.h index a952860bc2..190424b841 100644 --- a/engines/access/amazon/amazon_resources.h +++ b/engines/access/amazon/amazon_resources.h @@ -138,11 +138,11 @@ extern const int HELP1COORDS[2][4]; extern const int RIVER1OBJ[23][4]; extern const int CAST_END_OBJ[26][4]; - extern const int CAST_END_OBJ1[4][4]; -} // End of namespace Amazon +extern const int RMOUSE[10][2]; +} // End of namespace Amazon } // End of namespace Access #endif /* ACCESS_AMAZON_RESOURCES_H */ diff --git a/engines/access/martian/martian_resources.cpp b/engines/access/martian/martian_resources.cpp index f46232977a..f460800a97 100644 --- a/engines/access/martian/martian_resources.cpp +++ b/engines/access/martian/martian_resources.cpp @@ -753,6 +753,10 @@ const byte ICON_DATA[] = { 0x00, 0x2D, 0x3A }; -} // End of namespace Martian +const int RMOUSE[10][2] = { + { 7, 36 }, { 38, 68 }, { 70, 99 }, { 102, 125 }, { 128, 152 }, + { 155, 185 }, { 188, 216 }, { 219, 260 }, { 263, 293 }, { 295, 214 } +}; +} // End of namespace Martian } // End of namespace Access diff --git a/engines/access/martian/martian_resources.h b/engines/access/martian/martian_resources.h index 4a3f227455..593681a48d 100644 --- a/engines/access/martian/martian_resources.h +++ b/engines/access/martian/martian_resources.h @@ -52,8 +52,11 @@ extern const int SIDEOFFD[]; extern const byte CREDIT_DATA[]; extern const byte ICON_DATA[]; -} // End of namespace Martian + +extern const int RMOUSE[10][2]; + +} // End of namespace Martian } // End of namespace Access #endif /* ACCESS_MARTIAN_RESOURCES_H */ diff --git a/engines/access/resources.cpp b/engines/access/resources.cpp index 4157cdfc0d..118e887721 100644 --- a/engines/access/resources.cpp +++ b/engines/access/resources.cpp @@ -59,11 +59,6 @@ const int DIAGOFFULY[] = { 3, 3, 1, 2, 2, 1, 1, 1, 0 }; const int DIAGOFFDLX[] = { 4, 5, 3, 3, 5, 4, 6, 1, 0 }; const int DIAGOFFDLY[] = { 2, 2, 1, 2, 3, 1, 2, 1, 0 }; -const int RMOUSE[10][2] = { - { 0, 35 }, { 0, 0 }, { 36, 70 }, { 71, 106 }, { 107, 141 }, - { 142, 177 }, { 178, 212 }, { 213, 248 }, { 249, 283 }, { 284, 318 } -}; - const char *const LOOK_MESSAGE = "LOOKING THERE REVEALS NOTHING OF INTEREST."; const char *const GET_MESSAGE = "YOU CAN'T TAKE THAT."; const char *const OPEN_MESSAGE = "THAT DOESN'T OPEN."; diff --git a/engines/access/resources.h b/engines/access/resources.h index 8d59b1b1f1..2ef931b11a 100644 --- a/engines/access/resources.h +++ b/engines/access/resources.h @@ -42,8 +42,6 @@ extern const int DIAGOFFULY[]; extern const int DIAGOFFDLX[]; extern const int DIAGOFFDLY[]; -extern const int RMOUSE[10][2]; - extern const char *const GENERAL_MESSAGES[]; extern const int INVCOORDS[][4]; diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 79e5200963..f10ba86a40 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -38,6 +38,23 @@ Room::Room(AccessEngine *vm) : Manager(vm) { _selectCommand = 0; _conFlag = false; _selectCommand = -1; + + switch (vm->getGameID()) { + case GType_Amazon: + for (int i = 0; i < 10; i++) { + _rMouse[i][0] = Amazon::RMOUSE[i][0]; + _rMouse[i][1] = Amazon::RMOUSE[i][1]; + } + break; + case GType_MartianMemorandum: + for (int i = 0; i < 10; i++) { + _rMouse[i][0] = Martian::RMOUSE[i][0]; + _rMouse[i][1] = Martian::RMOUSE[i][1]; + } + break; + default: + error("Game not supported"); + } } Room::~Room() { @@ -464,8 +481,8 @@ void Room::doCommands() { if (_vm->_events->_mouseRow >= 22) { // Mouse in user interface area for (commandId = 0; commandId < 10; ++commandId) { - if (_vm->_events->_mousePos.x >= RMOUSE[commandId][0] && - _vm->_events->_mousePos.x < RMOUSE[commandId][1]) + if (_vm->_events->_mousePos.x >= _rMouse[commandId][0] && + _vm->_events->_mousePos.x < _rMouse[commandId][1]) break; } if (commandId < 10) @@ -564,7 +581,7 @@ void Room::executeCommand(int commandId) { // Draw the button as selected _vm->_screen->plotImage(spr, _selectCommand + 2, - Common::Point(RMOUSE[_selectCommand][0], 176)); + Common::Point(_rMouse[_selectCommand][0], (_vm->getGameID() == GType_MartianMemorandum) ? 184 : 176)); _vm->_screen->restoreScreen(); _vm->_boxSelect = true; diff --git a/engines/access/room.h b/engines/access/room.h index dd8a359665..2ecc1e8538 100644 --- a/engines/access/room.h +++ b/engines/access/room.h @@ -129,6 +129,7 @@ public: int _tileSize; int _selectCommand; bool _conFlag; + int _rMouse[10][2]; public: Room(AccessEngine *vm); -- cgit v1.2.3