diff options
author | Matthew Stewart | 2018-06-29 17:08:27 -0400 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-09 08:37:30 +0200 |
commit | f85c296dc37ca257c4c605b27e3c886542bf57ab (patch) | |
tree | 4ed115f6831ef1845fa58b21ef2a028978172b5d /engines/startrek/rooms | |
parent | b3c317410232a6b5896237018874f8c5ecc3b5eb (diff) | |
download | scummvm-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/rooms')
-rw-r--r-- | engines/startrek/rooms/function_map.h | 48 | ||||
-rw-r--r-- | engines/startrek/rooms/mudd0.cpp | 49 | ||||
-rw-r--r-- | engines/startrek/rooms/mudd5.cpp | 2 | ||||
-rw-r--r-- | engines/startrek/rooms/mudda.cpp | 110 |
4 files changed, 135 insertions, 74 deletions
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]); +} + +} |