From 08ead492d8ff338a469ca92881919d8ff22e12b3 Mon Sep 17 00:00:00 2001 From: Matthew Stewart Date: Thu, 21 Jun 2018 23:33:02 -0400 Subject: STARTREK: LOVE3 finished. Added "callback" variants of the "walkCrewman" and "loadActorAnim" functions to simplify chains of calls in room-specific code. --- engines/startrek/rooms/function_map.h | 36 +++++ engines/startrek/rooms/love1.cpp | 4 +- engines/startrek/rooms/love3.cpp | 266 +++++++++++++++++++++++++++++++++- 3 files changed, 299 insertions(+), 7 deletions(-) (limited to 'engines/startrek/rooms') diff --git a/engines/startrek/rooms/function_map.h b/engines/startrek/rooms/function_map.h index dab82aaac5..8c8df3794f 100644 --- a/engines/startrek/rooms/function_map.h +++ b/engines/startrek/rooms/function_map.h @@ -1090,17 +1090,53 @@ RoomAction love3ActionList[] = { { Action(ACTION_USE, OBJECT_KIRK, 8, 0), &Room::love3UseKirkOnServicePanel }, { Action(ACTION_USE, OBJECT_SPOCK, 8, 0), &Room::love3UseSpockOnServicePanel }, { Action(ACTION_USE, OBJECT_MCCOY, 8, 0), &Room::love3UseMccoyOnServicePanel }, + { Action(ACTION_USE, OBJECT_REDSHIRT, 8, 0), &Room::love3UseRedshirtOnServicePanel }, { Action(ACTION_FINISHED_WALKING, 1, 0, 0), &Room::love3CrewmanReachedServicePanel }, { Action(ACTION_FINISHED_ANIMATION, 1, 0, 0), &Room::love3OpenedOrClosedServicePanel }, + { Action(ACTION_USE, OBJECT_IWRENCH, 12, 0), &Room::love3UseWrenchOnGasTank }, { Action(ACTION_FINISHED_WALKING, 2, 0, 0), &Room::love3ReachedGasTankToUnscrew }, { Action(ACTION_FINISHED_ANIMATION, 2, 0, 0), &Room::love3ScrewedOrUnscrewedGasTank }, + { Action(ACTION_USE, OBJECT_IWRENCH, OBJECT_IO2GAS, 0), &Room::love3UseWrenchOnO2OrH2Gas }, { Action(ACTION_USE, OBJECT_IWRENCH, OBJECT_IH2GAS, 0), &Room::love3UseWrenchOnO2OrH2Gas }, + { Action(ACTION_USE, OBJECT_IWRENCH, OBJECT_IN2GAS, 0), &Room::love3UseWrenchOnN2Gas }, { Action(ACTION_FINISHED_WALKING, 15, 0, 0), &Room::love3ReachedGasTankToPutDown }, { Action(ACTION_FINISHED_ANIMATION, 3, 0, 0), &Room::love3PutN2TankBack }, + + { Action(ACTION_USE, OBJECT_IWRENCH, 0x20, 0), &Room::love3UseWrenchOnEngineeringPanel }, + { Action(ACTION_FINISHED_WALKING, 3, 0, 0), &Room::love3ReachedEngineeringPanel }, + { Action(ACTION_FINISHED_ANIMATION, 4, 0, 0), &Room::love3OpenedEngineeringPanel }, + + { Action(ACTION_USE, OBJECT_IWRENCH, 0x21, 0), &Room::love3UseWrenchOnMonitor }, + + { Action(ACTION_USE, OBJECT_IH2O, 0x21, 0), &Room::love3UseWaterOnMonitor }, + + { Action(ACTION_USE, OBJECT_KIRK, 0x20, 0), &Room::love3UseCrewmanOnEngineeringPanelOrGrate }, + { Action(ACTION_USE, OBJECT_SPOCK, 0x20, 0), &Room::love3UseCrewmanOnEngineeringPanelOrGrate }, + { Action(ACTION_USE, OBJECT_MCCOY, 0x20, 0), &Room::love3UseCrewmanOnEngineeringPanelOrGrate }, + { Action(ACTION_USE, OBJECT_REDSHIRT, 0x20, 0), &Room::love3UseCrewmanOnEngineeringPanelOrGrate }, + { Action(ACTION_USE, OBJECT_KIRK, 11, 0), &Room::love3UseCrewmanOnEngineeringPanelOrGrate }, + { Action(ACTION_USE, OBJECT_SPOCK, 11, 0), &Room::love3UseCrewmanOnEngineeringPanelOrGrate }, + { Action(ACTION_USE, OBJECT_MCCOY, 11, 0), &Room::love3UseCrewmanOnEngineeringPanelOrGrate }, + { Action(ACTION_USE, OBJECT_REDSHIRT, 11, 0), &Room::love3UseCrewmanOnEngineeringPanelOrGrate }, + + { Action(ACTION_USE, OBJECT_IWRENCH, 11, 0), &Room::love3UseWrenchOnGrate }, + { Action(ACTION_USE, OBJECT_KIRK, 0x22, 0), &Room::love3UseCrewmanOnShaft }, + { Action(ACTION_USE, OBJECT_SPOCK, 0x22, 0), &Room::love3UseCrewmanOnShaft }, + { Action(ACTION_USE, OBJECT_MCCOY, 0x22, 0), &Room::love3UseCrewmanOnShaft }, + { Action(ACTION_USE, OBJECT_REDSHIRT, 0x22, 0), &Room::love3UseCrewmanOnShaft }, + { Action(ACTION_USE, OBJECT_IH2O, 0x22, 0), &Room::love3UseWaterOnShaft }, + { Action(ACTION_USE, OBJECT_IN2O, 0x22, 0), &Room::love3UseNitrousOxideOnShaft }, + { Action(ACTION_USE, OBJECT_INH3, 0x22, 0), &Room::love3UseAmmoniaOnShaft }, + { Action(ACTION_USE, OBJECT_IRLG, 0x22, 0), &Room::love3UseRomulanLaughingGasOnShaft }, + { Action(ACTION_GET, 10, 0, 0), &Room::love3GetWrench }, + { Action(ACTION_GET, 12, 0, 0), &Room::love3GetGasTank }, + { Action(ACTION_USE, OBJECT_IANTIGRA, 12, 0), &Room::love3UseAntigravOnGasTank }, + { Action(ACTION_GET, 9, 0, 0), &Room::love3GetInsulation }, + // TODO: common code }; RoomAction love4ActionList[] = { diff --git a/engines/startrek/rooms/love1.cpp b/engines/startrek/rooms/love1.cpp index d2ffe2143c..9f4617b8c1 100644 --- a/engines/startrek/rooms/love1.cpp +++ b/engines/startrek/rooms/love1.cpp @@ -624,7 +624,7 @@ void Room::love1CrewmanReachedLadder() { TX_SPEAKER_FERRIS }; - if (_vm->_awayMission.love.putLaughingGasInVent || _vm->_awayMission.love.field41) // Romulans unconscious + if (_vm->_awayMission.love.romulansUnconsciousFromLaughingGas || _vm->_awayMission.love.romulansUnconsciousFromVirus) // Romulans unconscious loadRoomIndex(4, 3); else { // Romulans still conscious, they shoot you loadActorAnim(OBJECT_PHASERSHOT, "s3r2s2", 0xf3, 0x89, 0); @@ -650,7 +650,7 @@ void Room::love1CrewmanDiedFromPhaser() { // Romulans fire a "warning shot" when you go to the right part of the room. void Room::love1TouchedHotspot0() { - if (_vm->_awayMission.love.putLaughingGasInVent || _vm->_awayMission.love.field41) + if (_vm->_awayMission.love.romulansUnconsciousFromLaughingGas || _vm->_awayMission.love.romulansUnconsciousFromVirus) return; loadActorAnim(OBJECT_PHASERSHOT, "s3r2s1", 0xf3, 0x89, 0); playSoundEffectIndex(SND_PHASSHOT); diff --git a/engines/startrek/rooms/love3.cpp b/engines/startrek/rooms/love3.cpp index 149c53c824..4e73ed8245 100644 --- a/engines/startrek/rooms/love3.cpp +++ b/engines/startrek/rooms/love3.cpp @@ -28,7 +28,7 @@ #define OBJECT_GRATE 11 #define OBJECT_GAS_TANK 12 -#define HOTSPOT_INSULATION 0x20 +#define HOTSPOT_ENGINEERING_PANEL 0x20 #define HOTSPOT_MONITOR 0x21 #define HOTSPOT_SHAFT 0x22 #define HOTSPOT_TURBINES 0x23 @@ -46,7 +46,7 @@ void Room::love3Tick1() { else loadActorAnim(OBJECT_GRATE, "s3r4g1", 0x116, 0x8f, 0); - if (_vm->_awayMission.love.field3e) + if (_vm->_awayMission.love.insulationOnGround) loadActorAnim(OBJECT_INSULATION, "s3r4p2", 0, 0, 0); if (!_vm->_awayMission.love.tookN2TankFromServicePanel) @@ -122,7 +122,7 @@ void Room::love3LookAtShaft() { } void Room::love3LookAtPanel() { - if (_vm->_awayMission.love.field3e) + if (_vm->_awayMission.love.insulationOnGround) showText(TX_LOV3N017); else showText(TX_LOV3NA22); @@ -147,7 +147,7 @@ void Room::love3TalkToKirk() { void Room::love3TalkToSpock() { if (_vm->_awayMission.love.field3f) showText(TX_SPEAKER_SPOCK, TX_LOV3_003); - if (_vm->_awayMission.love.putLaughingGasInVent) + if (_vm->_awayMission.love.romulansUnconsciousFromLaughingGas) showText(TX_SPEAKER_SPOCK, TX_LOV3_017); else if (haveItem(OBJECT_IRLG)) showText(TX_SPEAKER_SPOCK, TX_LOV3_004); @@ -175,7 +175,7 @@ void Room::love3UseSTricorderOnTurbines() { } void Room::love3UseSTricorderOnInsulation() { - if (_vm->_awayMission.love.field3e) + if (_vm->_awayMission.love.insulationOnGround) spockScan(DIR_W, TX_LOV3_002, false); } @@ -273,4 +273,260 @@ void Room::love3PutN2TankBack() { loadActorAnim(OBJECT_GAS_TANK, "r4n2", 0, 0, 0); } + +// Use wrench on engineering panel, insulation comes out +void Room::love3UseWrenchOnEngineeringPanel() { + walkCrewman(OBJECT_KIRK, 0x37, 0xb4, 3); +} + +void Room::love3ReachedEngineeringPanel() { + loadActorAnim2(OBJECT_KIRK, "kuselw", -1, -1, 4); + playVoc("MUR3E1S"); +} + +void Room::love3OpenedEngineeringPanel() { + if (!_vm->_awayMission.love.insulationOnGround) { + playVoc("MADR4E4A"); + loadActorAnim(OBJECT_INSULATION, "s3r4p1", 0, 0, 0); + _vm->_awayMission.love.insulationOnGround = true; + } + showText(TX_LOV3N021); +} + + +void Room::love3UseWrenchOnMonitor() { + showText(TX_SPEAKER_SPOCK, TX_LOV3_018); +} + + +void Room::love3UseWaterOnMonitor() { + walkCrewmanC(OBJECT_KIRK, 0xc8, 0xb2, &Room::love3ReachedMonitorToUseWater); +} + +void Room::love3ReachedMonitorToUseWater() { + loadActorAnimC(OBJECT_KIRK, "kusemn", -1, -1, &Room::love3PouredWaterOnMonitor); +} + +void Room::love3PouredWaterOnMonitor() { + // BUGFIX: the speaker should be Lt. Ferris. In the original, the speaker wasn't + // specified. + // However, there is no substitute text for when Lt. Ferris is dead. + showText(TX_SPEAKER_FERRIS, TX_LOV3_021); + + loseItem(OBJECT_IH2O); +} + + +void Room::love3UseCrewmanOnEngineeringPanelOrGrate() { + showText(TX_LOV3N030); +} + + +void Room::love3UseWrenchOnGrate() { + walkCrewmanC(OBJECT_KIRK, 0xf6, 0xaa, &Room::love3ReachedGateWithWrench); + _vm->_awayMission.disableInput = true; +} + +void Room::love3ReachedGateWithWrench() { + if (_vm->_awayMission.love.grateRemoved) + loadActorAnimC(OBJECT_KIRK, "s3r4g2a", -1, -1, &Room::love3OpenedOrClosedGrate); + else + loadActorAnimC(OBJECT_KIRK, "s3r4g2", -1, -1, &Room::love3OpenedOrClosedGrate); + loadActorStandAnim(OBJECT_GRATE); + playVoc("MUR3E1S"); +} + +void Room::love3OpenedOrClosedGrate() { + _vm->_awayMission.disableInput = false; + loadActorStandAnim(OBJECT_KIRK); + + if (!_vm->_awayMission.love.grateRemoved) { + _vm->_awayMission.love.grateRemoved = true; + loadActorAnim(OBJECT_GRATE, "s3r4g3", 0, 0, 0); + showText(TX_LOV3N016); + if (!_vm->_awayMission.love.gotPointsForOpeningGrate) { + _vm->_awayMission.love.gotPointsForOpeningGrate = true; + _vm->_awayMission.love.missionScore++; + } + } + else { + loadActorAnim(OBJECT_GRATE, "s3r4g1", 0x116, 0x8f, 0); + _vm->_awayMission.love.grateRemoved = false; + showText(TX_LOV3N032); + } +} + + +void Room::love3UseCrewmanOnShaft() { + showText(TX_LOV3N011); +} + + +void Room::love3UseWaterOnShaft() { + walkCrewmanC(OBJECT_KIRK, 0x100, 0xa6, &Room::love3ReachedShaftUsingWater); +} + +void Room::love3ReachedShaftUsingWater() { + if (!_vm->_awayMission.love.grateRemoved) + showText(TX_LOV3N025); + else + loadActorAnimC(OBJECT_KIRK, "kuseme", -1, -1, &Room::love3PouredWaterDownShaft); +} + +void Room::love3PouredWaterDownShaft() { + showText(TX_LOV3N009); + loseItem(OBJECT_IH2O); +} + + +void Room::love3UseNitrousOxideOnShaft() { + walkCrewmanC(OBJECT_KIRK, 0x100, 0xa6, &Room::love3ReachedShaftUsingNitrousOxide); +} + +void Room::love3ReachedShaftUsingNitrousOxide() { + if (!_vm->_awayMission.love.grateRemoved) + showText(TX_LOV3N025); + else + loadActorAnimC(OBJECT_KIRK, "kuseme", -1, -1, &Room::love3PouredNitrousOxideDownShaft); +} + +void Room::love3PouredNitrousOxideDownShaft() { + showText(TX_LOV3N018); + showText(TX_SPEAKER_SPOCK, TX_LOV3_012); + loseItem(OBJECT_IN2O); +} + + +void Room::love3UseAmmoniaOnShaft() { + walkCrewmanC(OBJECT_KIRK, 0x100, 0xa6, &Room::love3ReachedShaftUsingAmmonia); +} + +void Room::love3ReachedShaftUsingAmmonia() { + if (!_vm->_awayMission.love.grateRemoved) + showText(TX_LOV3N025); + else + loadActorAnimC(OBJECT_KIRK, "kuseme", -1, -1, &Room::love3PouredAmmoniaDownShaft); +} + +void Room::love3PouredAmmoniaDownShaft() { + if (!_vm->_awayMission.love.romulansUnconsciousFromVirus) { + showText(TX_LOV3N001); + if (!_vm->_awayMission.redshirtDead) + showText(TX_SPEAKER_FERRIS, TX_LOV3_023); + } + + loseItem(OBJECT_INH3); +} + + +void Room::love3UseRomulanLaughingGasOnShaft() { + if (_vm->_awayMission.love.gotPointsForGassingRomulans) { + // BUG-ish: you could get the points for this by starting the action, then + // canceling it before Kirk reaches the shaft. + _vm->_awayMission.love.gotPointsForGassingRomulans = true; + _vm->_awayMission.love.missionScore += 6; + } + if (_vm->_awayMission.love.romulansUnconsciousFromLaughingGas) + showText(TX_SPEAKER_SPOCK, TX_LOV3_011); + else { + walkCrewmanC(OBJECT_KIRK, 0xf6, 0xa4, &Room::love3ReachedShaftUsingRomulanLaughingGas); + } +} + +void Room::love3ReachedShaftUsingRomulanLaughingGas() { + if (!_vm->_awayMission.love.grateRemoved) + showText(TX_LOV3N025); + else { + loadActorAnimC(OBJECT_KIRK, "kuseme", -1, -1, &Room::love3PouredRomulanLaughingGasDownShaft); + playVoc("EFX24"); + } +} + +void Room::love3PouredRomulanLaughingGasDownShaft() { + loseItem(OBJECT_IRLG); + _vm->_awayMission.love.romulansUnconsciousFromLaughingGas = true; + + if (_vm->_awayMission.love.romulansUnconsciousFromVirus) { + showText(TX_LOV3NA08); + _vm->_awayMission.love.romulansUnconsciousFromLaughingGas = false; + } + else { + showText(TX_LOV3NA09); + playVoc("ROMULANL"); + } +} + + +// Get the wrench on the ground +void Room::love3GetWrench() { + walkCrewmanC(OBJECT_KIRK, 0x104, 0xb6, &Room::love3ReachedWrenchToGet); +} + +void Room::love3ReachedWrenchToGet() { + loadActorAnimC(OBJECT_KIRK, "s5r1kg", -1, -1, &Room::love3PickedUpWrench); +} + +void Room::love3PickedUpWrench() { + loadActorStandAnim(OBJECT_KIRK); + giveItem(OBJECT_IWRENCH); + loadActorStandAnim(OBJECT_WRENCH); + _vm->_awayMission.love.wrenchTaken = true; + showText(TX_LOV3N031); +} + + +// Get the N2 gas tank in the service panel (fails due to weight) +void Room::love3GetGasTank() { + walkCrewmanC(OBJECT_KIRK, 0x121, 0xb7, &Room::love3ReachedGasTankToGet); +} + +void Room::love3ReachedGasTankToGet() { + if (_vm->_awayMission.love.gasTankUnscrewed) + showText(TX_LOV3N007); + else + showText(TX_LOV3N014); +} + + +// Use antigrav unit N2 gas tank in the service panel (succeeds) +void Room::love3UseAntigravOnGasTank() { + walkCrewmanC(OBJECT_KIRK, 0x10e, 0xae, &Room::love3ReachedGasTankUsingAntigrav); +} + +void Room::love3ReachedGasTankUsingAntigrav() { + if (_vm->_awayMission.love.gasTankUnscrewed) { + loadActorAnimC(OBJECT_KIRK, "kusehe", -1, -1, &Room::love3PickedUpGasTank); + playVoc("SE3PLBAT"); + } + else { + showText(TX_LOV3N010); + showText(TX_SPEAKER_SPOCK, TX_LOV3_015); + } +} + +void Room::love3PickedUpGasTank() { + giveItem(OBJECT_IN2GAS); + loadActorStandAnim(OBJECT_GAS_TANK); + _vm->_awayMission.love.tookN2TankFromServicePanel = true; + + showText(TX_LOV3NJ32); + if (!_vm->_awayMission.redshirtDead) + showText(TX_SPEAKER_FERRIS, TX_LOV3_025); +} + +void Room::love3GetInsulation() { + walkCrewmanC(OBJECT_KIRK, 0x32, 0xbe, &Room::love3ReachedInsulationToGet); +} + +void Room::love3ReachedInsulationToGet() { + if (!_vm->_awayMission.love.field3c) + loadActorAnimC(OBJECT_KIRK, "s5r1kg", -1, -1, &Room::love3PickedUpInsulation); +} + +void Room::love3PickedUpInsulation() { + loadActorStandAnim(OBJECT_KIRK); + giveItem(OBJECT_IINSULAT); + showText(TX_LOV3N029); +} + } -- cgit v1.2.3