diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/access/access.cpp | 1 | ||||
-rw-r--r-- | engines/access/access.h | 1 | ||||
-rw-r--r-- | engines/access/martian/martian_resources.cpp | 11 | ||||
-rw-r--r-- | engines/access/martian/martian_resources.h | 1 | ||||
-rw-r--r-- | engines/access/room.cpp | 85 | ||||
-rw-r--r-- | engines/access/room.h | 2 | ||||
-rw-r--r-- | engines/access/scripts.cpp | 8 | ||||
-rw-r--r-- | engines/access/scripts.h | 1 |
8 files changed, 107 insertions, 3 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 8e9d52f3c4..7c21b420f1 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -106,6 +106,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) BOXSELECTYOLD = -1; NUMBLINES = 0; TEMPLIST = nullptr; + _pictureTaken = 0; _vidEnd = false; } diff --git a/engines/access/access.h b/engines/access/access.h index 2a2d48e49b..e649088cab 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -223,6 +223,7 @@ public: byte _byte26CB5; int BCNT; byte *TEMPLIST; + int _pictureTaken; // bool _vidEnd; diff --git a/engines/access/martian/martian_resources.cpp b/engines/access/martian/martian_resources.cpp index 9196395756..7ffb256e44 100644 --- a/engines/access/martian/martian_resources.cpp +++ b/engines/access/martian/martian_resources.cpp @@ -819,5 +819,16 @@ const byte _byte1EEB5[] = { 1 }; +const int PICTURERANGE[][2] = { +// { min X, max X}, {min Y, max Y} + { 20, 30 }, { 82, 87 }, + { 20, 30 }, { 105, 110 }, + { 0, 8 }, { 92, 100 }, + { 42, 46 }, { 92, 100 }, + { 9, 41 }, { 88, 104 }, + { 9, 41 }, { 117, 133 }, + { -1, -1 } +}; + } // 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 f416cff16c..7503ae4e0f 100644 --- a/engines/access/martian/martian_resources.h +++ b/engines/access/martian/martian_resources.h @@ -67,6 +67,7 @@ extern const byte DEATH_SCREENS[]; extern const char *const DEATHMESSAGE[]; extern const byte _byte1EEB5[]; +extern const int PICTURERANGE[][2]; } // End of namespace Martian } // End of namespace Access diff --git a/engines/access/room.cpp b/engines/access/room.cpp index 5ad576ec90..0767bf111e 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -72,8 +72,91 @@ void Room::freeTileData() { _tile = nullptr; } +void Room::clearCamera() { + _vm->_player->_scrollFlag = true; + _vm->_events->hideCursor(); + + _vm->_screen->_orgX1 = 48; + _vm->_screen->_orgY1 = 24; + _vm->_screen->_orgX2 = 274; + _vm->_screen->_orgY2 = 152; + _vm->_screen->_lColor = 0; + _vm->_screen->drawRect(); + + _vm->_events->showCursor(); + + _vm->_events->_vbCount = 4; + while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0) + _vm->_events->pollEventsAndWait(); +} + void Room::takePicture() { - warning("TODO: takePicture"); + _vm->_events->pollEvents(); + if (!_vm->_events->_leftButton) + return; + + Common::Array<Common::Rect> pictureCoords; + for (int i = 0; Martian::PICTURERANGE[i][0] != -1; i += 2) { + pictureCoords.push_back(Common::Rect(Martian::PICTURERANGE[i][0], Martian::PICTURERANGE[i + 1][0], + Martian::PICTURERANGE[i][1], Martian::PICTURERANGE[i + 1][1])); + } + + int result = _vm->_events->checkMouseBox1(pictureCoords); + + if (result == 4) { + warning("TODO case 4"); + _vm->_events->debounceLeft(); + if (_vm->_inventory->_inv[44]._value != ITEM_IN_INVENTORY) { + Common::String msg = "YOU HAVE NO MORE FILM."; + _vm->_scripts->doCmdPrint_v1(msg); + return; + } + + // TODO: simplify the second part of the test when tested + if ((_vm->_scrollCol < 35) || ((_vm->_scrollRow >= 10) && (_vm->_scrollRow >= 20))){ + Common::String msg = "THAT ISN'T INTERESTING ENOUGH TO WASTE FILM ON."; + _vm->_scripts->doCmdPrint_v1(msg); + return; + } + + if (_vm->_inventory->_inv[26]._value != ITEM_USED) { + Common::String msg = "ALTHOUGH IT WOULD MAKE A NICE PICTURE, YOU MAY FIND SOMETHING MORE INTERESTING TO USE YOUR FILM ON."; + _vm->_scripts->doCmdPrint_v1(msg); + return; + } + + Common::String msg = "THAT PHOTO MAY COME IN HANDY SOME DAY."; + _vm->_scripts->doCmdPrint_v1(msg); + _vm->_inventory->_inv[8]._value = ITEM_IN_INVENTORY; + _vm->_pictureTaken++; + if (_vm->_pictureTaken == 16) + _vm->_inventory->_inv[44]._value = ITEM_USED; + + _vm->_events->debounceLeft(); + _vm->_sound->playSound(0); + clearCamera(); + return; + } else if (result == 5) { + if (_vm->_flags[26] != 2) { + _vm->_video->closeVideo(); + _vm->_video->_videoEnd = true; + } + _vm->_player->_roomNumber = 7; + _vm->_room->_function = FN_CLEAR1; + return; + } else if (result >= 0) + _vm->_player->_move = (Direction)(result + 1); + + _vm->_player->_scrollFlag = false; + if (_vm->_player->_move == UP) + warning("TODO: loc_163E9 2"); + else if (_vm->_player->_move == DOWN) + warning("TODO: loc_1644A 2"); + else if (_vm->_player->_move == LEFT) + warning("TODO: loc_1631E 2"); + else if (_vm->_player->_move == RIGHT) + warning("TODO: loc_1637F 2"); + else return; } void Room::doRoom() { diff --git a/engines/access/room.h b/engines/access/room.h index 2ecc1e8538..022d940fa0 100644 --- a/engines/access/room.h +++ b/engines/access/room.h @@ -105,6 +105,8 @@ protected: */ void executeCommand(int commandId); + void clearCamera(); + virtual void reloadRoom() = 0; virtual void reloadRoom1() = 0; diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index 1e055e45b9..c1f21680e0 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -306,10 +306,9 @@ void Scripts::cmdPrint_v2() { printString(msg); } -void Scripts::cmdPrint_v1() { +void Scripts::doCmdPrint_v1(Common::String msg) { _vm->_screen->_printOrg = Common::Point(20, 42); _vm->_screen->_printStart = Common::Point(20, 32); - Common::String msg = readString(); _vm->_bubbleBox->placeBubble(msg); _vm->_events->waitKeyMouse(); _vm->_events->hideCursor(); @@ -318,6 +317,11 @@ void Scripts::cmdPrint_v1() { findNull(); } +void Scripts::cmdPrint_v1() { + Common::String msg = readString(); + doCmdPrint_v1(msg); +} + void Scripts::printString(const Common::String &msg) { if (_vm->getGameID() != GType_MartianMemorandum) { _vm->_screen->_printOrg = Common::Point(20, 42); diff --git a/engines/access/scripts.h b/engines/access/scripts.h index a035087d48..f157e73c3c 100644 --- a/engines/access/scripts.h +++ b/engines/access/scripts.h @@ -165,6 +165,7 @@ public: int executeScript(); void findNull(); + void doCmdPrint_v1(Common::String msg); /** * Print a given message to the screen in a bubble box |