aboutsummaryrefslogtreecommitdiff
path: root/engines/startrek
diff options
context:
space:
mode:
authorMatthew Stewart2018-06-29 17:08:27 -0400
committerEugene Sandulenko2018-08-09 08:37:30 +0200
commitf85c296dc37ca257c4c605b27e3c886542bf57ab (patch)
tree4ed115f6831ef1845fa58b21ef2a028978172b5d /engines/startrek
parentb3c317410232a6b5896237018874f8c5ecc3b5eb (diff)
downloadscummvm-rg350-f85c296dc37ca257c4c605b27e3c886542bf57ab.tar.gz
scummvm-rg350-f85c296dc37ca257c4c605b27e3c886542bf57ab.tar.bz2
scummvm-rg350-f85c296dc37ca257c4c605b27e3c886542bf57ab.zip
STARTREK: Move common MUDD functions to mudda.cpp
Diffstat (limited to 'engines/startrek')
-rw-r--r--engines/startrek/module.mk1
-rw-r--r--engines/startrek/room.h8
-rw-r--r--engines/startrek/rooms/function_map.h48
-rw-r--r--engines/startrek/rooms/mudd0.cpp49
-rw-r--r--engines/startrek/rooms/mudd5.cpp2
-rw-r--r--engines/startrek/rooms/mudda.cpp110
6 files changed, 140 insertions, 78 deletions
diff --git a/engines/startrek/module.mk b/engines/startrek/module.mk
index 4271aef4a1..460e110ca2 100644
--- a/engines/startrek/module.mk
+++ b/engines/startrek/module.mk
@@ -43,6 +43,7 @@ MODULE_OBJS = \
rooms/mudd3.o \
rooms/mudd4.o \
rooms/mudd5.o \
+ rooms/mudda.o \
diff --git a/engines/startrek/room.h b/engines/startrek/room.h
index 849fb503ab..f791728c60 100644
--- a/engines/startrek/room.h
+++ b/engines/startrek/room.h
@@ -1138,10 +1138,6 @@ public:
void mudd0UseSTricorderOnMemoryDiskBox();
void mudd0UseSTricorderOnDegrimerBox();
void mudd0UseMTricorderOnLense();
- void mudd0UseLenseOnDegrimer();
- void mudd0UseAlienDevice();
- void mudd0FiredAlienDevice();
- void mudd0UseDegrimer();
void mudd0GetLense();
void mudd0GetMemoryDisk();
void mudd0GetDegrimer();
@@ -1378,6 +1374,10 @@ public:
void mudd5UseMedkit();
// MUDDA
+ void muddaUseLenseOnDegrimer();
+ void muddaUseAlienDevice();
+ void muddaFiredAlienDevice();
+ void muddaUseDegrimer();
private:
// Room-specific variables. This is memset'ed to 0 when the room is initialized.
diff --git a/engines/startrek/rooms/function_map.h b/engines/startrek/rooms/function_map.h
index a6930ea69d..456767f0a4 100644
--- a/engines/startrek/rooms/function_map.h
+++ b/engines/startrek/rooms/function_map.h
@@ -1415,10 +1415,10 @@ RoomAction mudd0ActionList[] = {
{ Action(ACTION_USE, OBJECT_IMTRICOR, 0x21, 0), &Room::mudd0UseMTricorderOnLense },
// Common code (next 4 lines)
- { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::mudd0UseLenseOnDegrimer },
- { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::mudd0UseAlienDevice },
- { Action(ACTION_FINISHED_ANIMATION, 9, 0, 0), &Room::mudd0FiredAlienDevice },
- { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::mudd0UseDegrimer },
+ { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::muddaUseLenseOnDegrimer },
+ { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::muddaUseAlienDevice },
+ { Action(ACTION_FINISHED_ANIMATION, 9, 0, 0), &Room::muddaFiredAlienDevice },
+ { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::muddaUseDegrimer },
{ Action(ACTION_GET, 0x21, 0, 0), &Room::mudd0GetLense },
{ Action(ACTION_GET, 0x20, 0, 0), &Room::mudd0GetMemoryDisk },
@@ -1460,10 +1460,10 @@ RoomAction mudd1ActionList[] = {
{ Action(ACTION_FINISHED_ANIMATION, 4, 0, 0), &Room::mudd1SpockPressedRedButton },
// Common code (next 4 lines)
- { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::mudd0UseDegrimer },
- { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::mudd0UseLenseOnDegrimer },
- { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::mudd0UseAlienDevice },
- { Action(ACTION_FINISHED_ANIMATION, 9, 0, 0), &Room::mudd0FiredAlienDevice },
+ { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::muddaUseDegrimer },
+ { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::muddaUseLenseOnDegrimer },
+ { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::muddaUseAlienDevice },
+ { Action(ACTION_FINISHED_ANIMATION, 9, 0, 0), &Room::muddaFiredAlienDevice },
{ Action(ACTION_GET, 9, 0, 0), &Room::mudd1GetTorpedo },
{ Action(ACTION_GET, 0x21, 0, 0), &Room::mudd1GetTorpedo },
@@ -1518,10 +1518,10 @@ RoomAction mudd2ActionList[] = {
{ Action(ACTION_USE, OBJECT_ICOMM, -1, 0), &Room::mudd2UseCommunicator },
// Common code (next 4 lines)
- { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::mudd0UseDegrimer },
- { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::mudd0UseLenseOnDegrimer },
- { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::mudd0UseAlienDevice },
- { Action(ACTION_FINISHED_ANIMATION, 18, 0, 0), &Room::mudd0FiredAlienDevice },
+ { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::muddaUseDegrimer },
+ { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::muddaUseLenseOnDegrimer },
+ { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::muddaUseAlienDevice },
+ { Action(ACTION_FINISHED_ANIMATION, 18, 0, 0), &Room::muddaFiredAlienDevice },
{ Action(ACTION_LOOK, 0x20, 0, 0), &Room::mudd2LookAtCapsules },
{ Action(ACTION_USE, OBJECT_IMTRICOR, 0x20, 0), &Room::mudd2UseMTricorderOnCapsules },
@@ -1586,10 +1586,10 @@ RoomAction mudd3ActionList[] = {
{ Action(ACTION_USE, OBJECT_IDISKS, 0x21, 0), &Room::mudd3UseMemoryDiskOnSphere },
// Common code (next 4 lines)
- { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::mudd0UseDegrimer },
- { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::mudd0UseLenseOnDegrimer },
- { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::mudd0UseAlienDevice },
- { Action(ACTION_FINISHED_ANIMATION, 9, 0, 0), &Room::mudd0FiredAlienDevice },
+ { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::muddaUseDegrimer },
+ { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::muddaUseLenseOnDegrimer },
+ { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::muddaUseAlienDevice },
+ { Action(ACTION_FINISHED_ANIMATION, 9, 0, 0), &Room::muddaFiredAlienDevice },
{ Action(ACTION_GET, 13, 0, 0), &Room::mudd3GetRepairTool },
{ Action(ACTION_FINISHED_WALKING, 3, 0, 0), &Room::mudd3ReachedRepairTool },
@@ -1656,10 +1656,10 @@ RoomAction mudd4ActionList[] = {
{ Action(ACTION_USE, OBJECT_ISTRICOR, 8, 0), &Room::mudd4UseSTricorderOnViewscreen },
// Common code (next 4 lines)
- { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::mudd0UseLenseOnDegrimer },
- { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::mudd0UseAlienDevice },
- { Action(ACTION_FINISHED_ANIMATION, 9, 0, 0), &Room::mudd0FiredAlienDevice },
- { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::mudd0UseDegrimer },
+ { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::muddaUseLenseOnDegrimer },
+ { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::muddaUseAlienDevice },
+ { Action(ACTION_FINISHED_ANIMATION, 9, 0, 0), &Room::muddaFiredAlienDevice },
+ { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::muddaUseDegrimer },
{ Action(ACTION_USE, OBJECT_IMEDKIT, -1, 0), &Room::mudd4UseMedkit },
{ Action(ACTION_GET, 10, 0, 0), &Room::mudd4GetRepairTool },
@@ -1710,10 +1710,10 @@ RoomAction mudd5ActionList[] = {
{ Action(ACTION_TIMER_EXPIRED, 3, 0, 0), &Room::mudd5KirkTimer3Expired },
// Common code (next 4 lines)
- { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::mudd0UseLenseOnDegrimer },
- { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::mudd0UseAlienDevice },
- { Action(ACTION_FINISHED_ANIMATION, 9, 0, 0), &Room::mudd0FiredAlienDevice },
- { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::mudd0UseDegrimer },
+ { Action(ACTION_USE, OBJECT_ILENSES, OBJECT_IDEGRIME, 0), &Room::muddaUseLenseOnDegrimer },
+ { Action(ACTION_USE, OBJECT_IALIENDV, -1, 0), &Room::muddaUseAlienDevice },
+ { Action(ACTION_FINISHED_ANIMATION, 9, 0, 0), &Room::muddaFiredAlienDevice },
+ { Action(ACTION_USE, OBJECT_IDEGRIME, -1, 0), &Room::muddaUseDegrimer },
{ Action(ACTION_LOOK, 0x20, 0, 0), &Room::mudd5LookAtHatch },
{ Action(ACTION_LOOK, 9, 0, 0), &Room::mudd5LookAtLifeSupportGenerator },
diff --git a/engines/startrek/rooms/mudd0.cpp b/engines/startrek/rooms/mudd0.cpp
index c4960312f2..3506ed8bcb 100644
--- a/engines/startrek/rooms/mudd0.cpp
+++ b/engines/startrek/rooms/mudd0.cpp
@@ -158,55 +158,6 @@ void Room::mudd0UseMTricorderOnLense() {
mccoyScan(DIR_E, TX_MUD0_013, true);
}
-void Room::mudd0UseLenseOnDegrimer() {
- giveItem(OBJECT_IALIENDV);
- loseItem(OBJECT_IDEGRIME);
- loseItem(OBJECT_ILENSES);
-
- _vm->_awayMission.mudd.missionScore++;
- showText(TX_MUD0N011);
- // TODO: Identical (?) audio files: TX_MUD0N011, TX_MUD1N013, TX_MUD2N010, TX_MUD3N016,
- // TX_MUD4009, TX_MUD5N009
-}
-
-
-void Room::mudd0UseAlienDevice() {
- const int deviceObjectIndices[] = {
- 9, // MUDD0
- 13, // MUDD1
- 11, // MUDD2
- 11, // MUDD3
- 9, // MUDD4
- 11 // MUDD5
- };
-
- _vm->_awayMission.disableInput = true;
-
- _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_S;
- loadActorStandAnim(OBJECT_KIRK);
- Common::Point pos = getActorPos(OBJECT_KIRK);
- loadActorAnimC(deviceObjectIndices[_roomIndex], "s4cbxp", pos.x, 10, &Room::mudd0FiredAlienDevice);
- playVoc("EXPLO3");
-}
-
-void Room::mudd0FiredAlienDevice() {
- _vm->_awayMission.disableInput = false;
- if (!_vm->_awayMission.mudd.discoveredLenseAndDegrimerFunction) {
- _vm->_awayMission.mudd.discoveredLenseAndDegrimerFunction = true;
- _vm->_awayMission.mudd.missionScore += 5; // BUGFIX: didn't happen if done in MUDD5
- showText(TX_SPEAKER_KIRK, TX_MUD0_002);
- // TODO: Identical (?) audio files: TX_MUD0_002, TX_MUD1_002, TX_MUD2_002
- }
-}
-
-
-void Room::mudd0UseDegrimer() {
- // TODO: Identical (?) audio files: TX_MUD0N002, TX_MUD1N004, TX_MUD2N001,
- // TX_MUD3N001, TX_MUD4N002, TX_MUD5_001
- showText(TX_MUD0N002);
-}
-
-
void Room::mudd0GetLense() {
if (_vm->_awayMission.mudd.gotLense)
showText(TX_MUD0N016);
diff --git a/engines/startrek/rooms/mudd5.cpp b/engines/startrek/rooms/mudd5.cpp
index f5b6bf90b2..c8e7500126 100644
--- a/engines/startrek/rooms/mudd5.cpp
+++ b/engines/startrek/rooms/mudd5.cpp
@@ -61,7 +61,7 @@ void Room::mudd5Tick1() {
}
void Room::mudd5Timer1Expired() { // Mudd enters room through hatch
- const int choices[] = {
+ const TextRef choices[] = {
TX_SPEAKER_KIRK,
TX_MUD5_006,
TX_MUD5_010,
diff --git a/engines/startrek/rooms/mudda.cpp b/engines/startrek/rooms/mudda.cpp
new file mode 100644
index 0000000000..ed2a4886ab
--- /dev/null
+++ b/engines/startrek/rooms/mudda.cpp
@@ -0,0 +1,110 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "startrek/room.h"
+
+namespace StarTrek {
+
+// The functions here used to be independently implemented in each room of the MUDD
+// mission, despite being mostly the same.
+
+void Room::muddaUseLenseOnDegrimer() {
+ assert(_roomIndex >= 0 && _roomIndex <= 5);
+
+ const TextRef text[] = {
+ TX_MUD0N011, // All of these audio files are identical, but there's one for each room.
+ TX_MUD1N013,
+ TX_MUD2N010,
+ TX_MUD3N016,
+ TX_MUD4N009,
+ TX_MUD5N009,
+ };
+
+ giveItem(OBJECT_IALIENDV);
+ loseItem(OBJECT_IDEGRIME);
+ loseItem(OBJECT_ILENSES);
+
+ _vm->_awayMission.mudd.missionScore++;
+ showText(text[_roomIndex]);
+ // TODO: Identical (?) audio files: TX_MUD0N011, TX_MUD1N013, TX_MUD2N010, TX_MUD3N016,
+ // TX_MUD4009, TX_MUD5N009
+}
+
+
+void Room::muddaUseAlienDevice() {
+ assert(_roomIndex >= 0 && _roomIndex <= 5);
+
+ const int deviceObjectIndices[] = { // Each room's object index for the explosion is different
+ 9, // MUDD0
+ 13, // MUDD1
+ 11, // MUDD2
+ 11, // MUDD3
+ 9, // MUDD4
+ 11 // MUDD5
+ };
+
+ _vm->_awayMission.disableInput = true;
+
+ _vm->_awayMission.crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_S;
+ loadActorStandAnim(OBJECT_KIRK);
+ Common::Point pos = getActorPos(OBJECT_KIRK);
+ loadActorAnimC(deviceObjectIndices[_roomIndex], "s4cbxp", pos.x, 10, &Room::muddaFiredAlienDevice);
+ playVoc("EXPLO3");
+}
+
+void Room::muddaFiredAlienDevice() {
+ assert(_roomIndex >= 0 && _roomIndex <= 5);
+
+ const TextRef text[] = {
+ TX_MUD0_002, // These audio files aren't identical, but the text is mostly the same.
+ TX_MUD1_002,
+ TX_MUD2_002,
+ TX_MUD2_002, // Rooms 3-5 reuse MUD2
+ TX_MUD2_002,
+ TX_MUD2_002,
+ };
+
+ _vm->_awayMission.disableInput = false;
+ if (!_vm->_awayMission.mudd.discoveredLenseAndDegrimerFunction) {
+ _vm->_awayMission.mudd.discoveredLenseAndDegrimerFunction = true;
+ _vm->_awayMission.mudd.missionScore += 5; // BUGFIX: didn't happen if done in MUDD5
+ showText(TX_SPEAKER_KIRK, text[_roomIndex]);
+ }
+}
+
+
+void Room::muddaUseDegrimer() {
+ assert(_roomIndex >= 0 && _roomIndex <= 5);
+
+ const TextRef text[] = {
+ TX_MUD0N002, // All of these audio files are identical, but there's one for each room.
+ TX_MUD1N004,
+ TX_MUD2N001,
+ TX_MUD3N001,
+ TX_MUD4N002,
+ TX_MUD5N001,
+ };
+
+ showText(text[_roomIndex]);
+}
+
+}