From bfb312a3196c6a46c5048599ea3000608f5d01ce Mon Sep 17 00:00:00 2001 From: Matthew Stewart Date: Sat, 30 Jun 2018 22:38:15 -0400 Subject: STARTREK: Done with atmosphere loss event --- engines/startrek/awaymission.cpp | 2 +- engines/startrek/room.h | 4 -- engines/startrek/rooms/function_map.h | 27 ++++++++---- engines/startrek/rooms/mudd0.cpp | 11 +++-- engines/startrek/rooms/mudd5.cpp | 2 +- engines/startrek/rooms/mudda.cpp | 81 +++++++++++++++++++---------------- engines/startrek/startrek.cpp | 2 +- 7 files changed, 74 insertions(+), 55 deletions(-) (limited to 'engines') diff --git a/engines/startrek/awaymission.cpp b/engines/startrek/awaymission.cpp index 3c007e67d6..daf28958fe 100644 --- a/engines/startrek/awaymission.cpp +++ b/engines/startrek/awaymission.cpp @@ -41,7 +41,7 @@ void StarTrekEngine::initAwayMission() { _roomIndexToLoad = -1; // Load crew positions for beaming in - initAwayCrewPositions(0); + initAwayCrewPositions(4); } void StarTrekEngine::runAwayMission() { diff --git a/engines/startrek/room.h b/engines/startrek/room.h index 22483dfb70..d51442eda0 100644 --- a/engines/startrek/room.h +++ b/engines/startrek/room.h @@ -1379,10 +1379,6 @@ public: void muddaFiredAlienDevice(); void muddaUseDegrimer(); void muddaTick(); - void muddaKirkReachedDeathPosition(); - void muddaSpockReachedDeathPosition(); - void muddaMccoyReachedDeathPosition(); - void muddaRedshirtReachedDeathPosition(); 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 8c1a88727b..e529f8b2cb 100644 --- a/engines/startrek/rooms/function_map.h +++ b/engines/startrek/rooms/function_map.h @@ -1393,6 +1393,9 @@ RoomAction love5ActionList[] = { { Action(ACTION_USE, OBJECT_IN2O, -1, 0), &Room::loveaUseHumanLaughingGas }, { Action(ACTION_USE, OBJECT_INH3, -1, 0), &Room::loveaUseAmmonia }, { Action(ACTION_USE, OBJECT_ICOMM, -1, 0), &Room::loveaUseCommunicator }, + + // Common code (countdown for losing atmosphere when life support malfunctioning) + { Action(ACTION_TICK, -1, -1, -1), &Room::muddaTick }, }; RoomAction mudd0ActionList[] = { @@ -1440,7 +1443,9 @@ RoomAction mudd0ActionList[] = { { Action(ACTION_TALK, OBJECT_MCCOY, 0, 0), &Room::mudd0TalkToMccoy }, { Action(ACTION_TALK, OBJECT_REDSHIRT, 0, 0), &Room::mudd0TalkToRedshirt }, { Action(ACTION_TALK, 8, 0, 0), &Room::mudd0TalkToMudd }, - // TODO: remainder? something about losing atmosphere? + + // Common code (countdown for losing atmosphere when life support malfunctioning) + { Action(ACTION_TICK, -1, -1, -1), &Room::muddaTick }, }; RoomAction mudd1ActionList[] = { @@ -1500,7 +1505,9 @@ RoomAction mudd1ActionList[] = { { Action(ACTION_TOUCHED_HOTSPOT, 1, 0, 0), &Room::mudd1TouchedHotspot1 }, { Action(ACTION_WALK, 0x26, 0, 0), &Room::mudd1WalkToWestDoor }, { Action(ACTION_TOUCHED_HOTSPOT, 0, 0, 0), &Room::mudd1TouchedHotspot0 }, - // TODO: remainder? something about losing atmosphere? + + // Common code (countdown for losing atmosphere when life support malfunctioning) + { Action(ACTION_TICK, -1, -1, -1), &Room::muddaTick }, }; RoomAction mudd2ActionList[] = { @@ -1564,7 +1571,9 @@ RoomAction mudd2ActionList[] = { { Action(ACTION_TALK, OBJECT_MCCOY, 0, 0), &Room::mudd2TalkToMccoy }, { Action(ACTION_TALK, OBJECT_REDSHIRT, 0, 0), &Room::mudd2TalkToRedshirt }, { Action(ACTION_TALK, 8, 0, 0), &Room::mudd2TalkToMudd }, - // TODO: remainder? something about losing atmosphere? + + // Common code (countdown for losing atmosphere when life support malfunctioning) + { Action(ACTION_TICK, -1, -1, -1), &Room::muddaTick }, }; RoomAction mudd3ActionList[] = { @@ -1610,7 +1619,9 @@ RoomAction mudd3ActionList[] = { { Action(ACTION_TALK, OBJECT_REDSHIRT, 0, 0), &Room::mudd3TalkToRedshirt }, { Action(ACTION_TALK, 8, 0, 0), &Room::mudd3TalkToMudd }, { Action(ACTION_USE, OBJECT_IMEDKIT, -1, 0), &Room::mudd3UseMedkit }, - // TODO: remainder? something about losing atmosphere? + + // Common code (countdown for losing atmosphere when life support malfunctioning) + { Action(ACTION_TICK, -1, -1, -1), &Room::muddaTick }, }; RoomAction mudd4ActionList[] = { @@ -1687,7 +1698,9 @@ RoomAction mudd4ActionList[] = { { Action(ACTION_WALK, 0x24, 0, 0), &Room::mudd4WalkToEastDoor }, { Action(ACTION_WALK, 0x25, 0, 0), &Room::mudd4WalkToWestDoor }, { Action(ACTION_TOUCHED_HOTSPOT, 0, 0, 0), &Room::mudd4TouchedHotspot0 }, - // TODO: remainder? something about losing atmosphere? + + // Common code (countdown for losing atmosphere when life support malfunctioning) + { Action(ACTION_TICK, -1, -1, -1), &Room::muddaTick }, }; RoomAction mudd5ActionList[] = { @@ -1734,10 +1747,6 @@ RoomAction mudd5ActionList[] = { // Common code (countdown for losing atmosphere when life support malfunctioning) { Action(ACTION_TICK, -1, -1, -1), &Room::muddaTick }, - { Action(ACTION_FINISHED_WALKING, 9, 0, 0), &Room::muddaKirkReachedDeathPosition }, - { Action(ACTION_FINISHED_WALKING, 10, 0, 0), &Room::muddaSpockReachedDeathPosition }, - { Action(ACTION_FINISHED_WALKING, 11, 0, 0), &Room::muddaMccoyReachedDeathPosition }, - { Action(ACTION_FINISHED_WALKING, 12, 0, 0), &Room::muddaRedshirtReachedDeathPosition }, }; } diff --git a/engines/startrek/rooms/mudd0.cpp b/engines/startrek/rooms/mudd0.cpp index 3506ed8bcb..bb26440fac 100644 --- a/engines/startrek/rooms/mudd0.cpp +++ b/engines/startrek/rooms/mudd0.cpp @@ -41,7 +41,11 @@ namespace StarTrek { void Room::mudd0Tick1() { playVoc("MUD0LOOP"); - _vm->_awayMission.disableInput = 2; + // ENHANCEMENT: Only disable input when Mudd showing Mudd cutscene (avoids a long, + // pointless delay when entering the room otherwise) + if (!_vm->_awayMission.mudd.enteredRoom0ForFirstTime) + _vm->_awayMission.disableInput = 2; + loadActorAnim(OBJECT_MUDD, "s4cbhr", 0xa2, 0xa9, 0); // Floppy version's code. @@ -63,9 +67,10 @@ void Room::mudd0Tick50() { } void Room::mudd0Tick60() { - _vm->_awayMission.disableInput = false; - if (_vm->_awayMission.mudd.field29 == 0) { + // ENHANCEMENT: Move this into if statement (related to above enhancement) + _vm->_awayMission.disableInput = false; + _vm->_awayMission.mudd.field29++; showText(TX_SPEAKER_MUDD, TX_MUD0_037); diff --git a/engines/startrek/rooms/mudd5.cpp b/engines/startrek/rooms/mudd5.cpp index 4a1d3d1f07..c8e7500126 100644 --- a/engines/startrek/rooms/mudd5.cpp +++ b/engines/startrek/rooms/mudd5.cpp @@ -48,7 +48,7 @@ void Room::mudd5Tick1() { loadActorAnim(OBJECT_LIFE_SUPPORT_GENERATOR, "s4eplo", GENERATOR_X, GENERATOR_Y); _vm->_awayMission.mudd.numTimesEnteredRoom5++; // BUG: this event can become permanently unavailable? (test) - if (true || _vm->_awayMission.mudd.numTimesEnteredRoom5 == 2 && !_vm->_awayMission.mudd.muddCurrentlyInsane && !_vm->_awayMission.mudd.repairedLifeSupportGenerator) { // FIXME + if (_vm->_awayMission.mudd.numTimesEnteredRoom5 == 2 && !_vm->_awayMission.mudd.muddCurrentlyInsane && !_vm->_awayMission.mudd.repairedLifeSupportGenerator) { _vm->_awayMission.mudd.muddCurrentlyInsane = true; _vm->_awayMission.mudd.numTimesEnteredRoom5 = 1; _vm->_awayMission.disableInput = 2; diff --git a/engines/startrek/rooms/mudda.cpp b/engines/startrek/rooms/mudda.cpp index 2f1834a787..03f71f9974 100644 --- a/engines/startrek/rooms/mudda.cpp +++ b/engines/startrek/rooms/mudda.cpp @@ -45,8 +45,6 @@ void Room::muddaUseLenseOnDegrimer() { _vm->_awayMission.mudd.missionScore++; showText(text[_roomIndex]); - // TODO: Identical (?) audio files: TX_MUD0N011, TX_MUD1N013, TX_MUD2N010, TX_MUD3N016, - // TX_MUD4009, TX_MUD5N009 } @@ -108,26 +106,40 @@ void Room::muddaUseDegrimer() { } void Room::muddaTick() { + // This function deals with the atmosphere running out when the life support generator + // is malfunctioning. + // NOTE: This has been changed a bit; in the original, they would just walk to + // a position and stay standing, though the code indicates they were supposed to + // collapse after walking. + // To simplify things, and since it makes more sense, now they'll just collapse on the + // spot instead. + assert(_roomIndex >= 0 && _roomIndex <= 5); + /* + // Unused: The positions to they originally walked to before collapsing. const Common::Point deathPositions[][4] = { { Common::Point(0xbb, 0x8d), Common::Point(0xd0, 0x89), Common::Point(0xaa, 0x85), Common::Point(0xbf, 0x83) }, - { Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1) }, - { Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1) }, - { Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1) }, - { Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1) }, + { Common::Point(0xaa, 0xa5), Common::Point(0x83, 0xac), Common::Point(-1, -1), Common::Point(-1, -1) }, + { Common::Point(0x108, 0xbb), Common::Point(0x118, 0xc4), Common::Point(0xfe, 0xb2), Common::Point(0x117, 0xae) }, + { Common::Point(0xf1, 0x95), Common::Point(0xcd, 0x87), Common::Point(0xec, 0x84), Common::Point(0x110, 0xa6) }, + { Common::Point(0x8b, 0xb6), Common::Point(0x69, 0xb7), Common::Point(-1, -1), Common::Point(-1, -1) }, { Common::Point(0x8b, 0xac), Common::Point(0x6f, 0x99), Common::Point(-1, -1), Common::Point(-1, -1) }, }; + */ - const TextRef deathText[] = { - TX_MUD0N006, 0, 0, 0, TX_MUD5N105 + const TextRef deathText[] = { // All of these audio files are identical, but there's one for each room. + TX_MUD0N006, TX_MUD1N007, TX_MUD2N005, TX_MUD3N008, TX_MUD4N005, TX_MUD5N105 }; - // This is implemented somewhat differently in each room. - // MUDD0: + // UNUSED: something similar to "deathText" which would also fit in this situation. + /* + const TextRef deathText2[] = { // All of these audio files are identical, but there's one for each room. + TX_MUD0N009, TX_MUD1N010, TX_MUD2N009, TX_MUD3N013, TX_MUD4N007, TX_MUD5N007 + }; + */ - //const int TIMER_LENGTH = 27000; - const int TIMER_LENGTH = 60; // FIXME + const int TIMER_LENGTH = 27000; if (_vm->_awayMission.mudd.lifeSupportMalfunctioning) { if (!_vm->_awayMission.mudd.startedLifeSupportTimer) { @@ -136,17 +148,32 @@ void Room::muddaTick() { } _vm->_awayMission.mudd.lifeSupportTimer--; - if (_vm->_awayMission.mudd.lifeSupportTimer == (int)(TIMER_LENGTH * 0.25)) { + // BUGFIX: the warnings at 75%, 50%, and 25% were only voiced in MUDD0. + if (_vm->_awayMission.mudd.lifeSupportTimer == (int)(TIMER_LENGTH * 0.25)) showText(TX_SPEAKER_SPOCK, TX_MUD0_018); - } else if (_vm->_awayMission.mudd.lifeSupportTimer == (int)(TIMER_LENGTH * 0.5)) { + else if (_vm->_awayMission.mudd.lifeSupportTimer == (int)(TIMER_LENGTH * 0.5)) showText(TX_SPEAKER_SPOCK, TX_MUD0_019); - } else if (_vm->_awayMission.mudd.lifeSupportTimer == (int)(TIMER_LENGTH * 0.75)) { + else if (_vm->_awayMission.mudd.lifeSupportTimer == (int)(TIMER_LENGTH * 0.75)) showText(TX_SPEAKER_SPOCK, TX_MUD0_020); - } else if (_vm->_awayMission.mudd.lifeSupportTimer == 1) { + else if (_vm->_awayMission.mudd.lifeSupportTimer == 1) { _vm->_awayMission.disableInput = true; + + // In each room, the crewmen collapse in a different directions. + // NOTE: "kgetdn" (kirk, north) doesn't work properly; files in the animation + // are missing. It's replaced with 'e' (east) in MUDD1, MUDD3, MUDD5. Only + // applies to Kirk, others seem fine... + // TODO: check if this is the case across all versions... + const char *directions[] = { + "weseee", // KIRK + "sewene", // SPOCK + "nsesss", // MCCOY + "ewesww", // REDSHIRT + }; + for (int i = OBJECT_KIRK; i <= OBJECT_REDSHIRT; i++) { - if (deathPositions[_roomIndex][i].x != -1) - walkCrewman(i, deathPositions[_roomIndex][i].x, deathPositions[_roomIndex][i].y, 9 + i); + Common::String anim = _vm->getCrewmanAnimFilename(i, "getd"); + anim += directions[i][_roomIndex]; + loadActorAnim2(i, anim); } showText(deathText[_roomIndex]); showGameOverMenu(); @@ -154,22 +181,4 @@ void Room::muddaTick() { } } -void Room::muddaKirkReachedDeathPosition() { - loadActorAnim2(OBJECT_KIRK, "kgetdw"); -} - -void Room::muddaSpockReachedDeathPosition() { - loadActorAnim2(OBJECT_SPOCK, "sgetds"); -} - -void Room::muddaMccoyReachedDeathPosition() { - loadActorAnim2(OBJECT_MCCOY, "sgetdn"); -} - -void Room::muddaRedshirtReachedDeathPosition() { - loadActorAnim2(OBJECT_REDSHIRT, "rgetde"); - // NOTE: there's code to check if he's the last one down... not really implemented - // properly -} - } diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp index 44c7aea742..cec83ab5ee 100644 --- a/engines/startrek/startrek.cpp +++ b/engines/startrek/startrek.cpp @@ -84,7 +84,7 @@ StarTrekEngine::StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gam _textboxHasMultipleChoices = false; _missionToLoad = "MUDD"; - _roomIndexToLoad = 5; + _roomIndexToLoad = 0; for (int i = 0; i < NUM_OBJECTS; i++) _itemList[i] = g_itemList[i]; -- cgit v1.2.3