Permalink
Browse files

STARTREK: SINS4

  • Loading branch information...
Drenn1 authored and sev- committed Jul 28, 2018
1 parent b1fde33 commit 012b9ec47c3538530ef0127e90d11b1da16b2c40
@@ -525,14 +525,18 @@ struct AwayMission {
bool field33; // 0x33
bool doorLaserFiredOnce; // 0x34
bool gotPointsForAccessingTerminal; // 0x35
bool scannedKeycardLock; // 0x36
byte field39; // 0x39
bool openedOuterDoor; // 0x3d
bool openedInnerDoor; // 0x3e
bool unlockedIDCardDoor; // 0x3f
bool enteredRoom0FirstTime; // 0x42
bool scottyInformedKirkAboutVirus; // 0x43
bool enteredRoom2FirstTime; // 0x44
bool field46; // 0x46
bool field45; // 0x45
bool enteredRoom4FirstTime; // 0x46
bool gotPointsForScanningStatue; // 0x48
bool gotPointsForScanningRoom4; // 0x49
bool enteredRoom1FirstTime; // 0x50
int16 missionScore; // 0x52
} sins;
@@ -2272,6 +2272,46 @@ class Room {

// SINS4
void sins4Tick1();
void sins4UseSTricorderOnPanel();
void sins4UseSpockOnPanel();
void sins4UsePhaserOnNorthDoor();
void sins4UsePhaserOnPanel();
void sins4UseIDCardOnPanel();
void sins4KirkReachedPanel();
void sins4KirkPutCardInPanel();
void sins4UseRockOnPanel();
void sins4KirkReachedPanelWithRock();
void sins4KirkUsedRockOnPanel();
void sins4LookAtWestDoor();
void sins4LookAtEastDoor();
void sins4LookAnywhere();
void sins4LookAtPanel();
void sins4Tick40();
void sins4LookAtKirk();
void sins4LookAtSpock();
void sins4LookAtMccoy();
void sins4LookAtRedshirt();
void sins4LookAtLight();
void sins4LookAtBeam();
void sins4LookAtOpenNorthDoor();
void sins4LookAtClosedNorthDoor();
void sins4TalkToKirk();
void sins4TalkToSpock();
void sins4TalkToMccoy();
void sins4TalkToRedshirt();
void sins4UseSTricorderOnNorthDoor();
void sins4UseSTricorderAnywhere();
void sins4UseCommunicator();
void sins4UseMccoyOnNorthDoor();
void sins4UseRedshirtOnNorthDoor();
void sins4UseSpockOnNorthDoor();
void sins4UseMccoyOnPanel();
void sins4UseRedshirtOnPanel();
void sins4WalkToNorthDoor();
void sins4WalkToWestDoor();
void sins4WalkToEastDoor();
void sins4UseMedkitOnCrewman();
void sins4UseMTricorderOnCrewman();

// SINS5
void sins5Tick1();
@@ -301,7 +301,7 @@ void Room::sins2UseSpockOnDoor() {
}

void Room::sins2UseCommunicator() {
if (!_awayMission->sins.field46) {
if (!_awayMission->sins.enteredRoom4FirstTime) {
showText(TX_SPEAKER_KIRK, TX_SIN2_006);
showText(TX_SPEAKER_SCOTT, TX_SIN2_S16);
showText(TX_SPEAKER_MCCOY, TX_SIN2_017);
@@ -22,20 +22,310 @@

#include "startrek/room.h"

#define OBJECT_8 8
#define OBJECT_NORTH_DOOR 8

#define HOTSPOT_20 0x20
#define HOTSPOT_NORTH_DOOR 0x20
#define HOTSPOT_PANEL 0x21
#define HOTSPOT_BEAM 0x22
#define HOTSPOT_LIGHT 0x23
#define HOTSPOT_WEST_DOOR 0x24
#define HOTSPOT_EAST_DOOR 0x25

namespace StarTrek {

extern const RoomAction sins4ActionList[] = {
{ {ACTION_TICK, 1, 0, 0}, &Room::sins4Tick1 },
{ {ACTION_TICK, 1, 0, 0}, &Room::sins4Tick1 },

{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_PANEL, 0}, &Room::sins4UseSTricorderOnPanel },
{ {ACTION_USE, OBJECT_SPOCK, HOTSPOT_PANEL, 0}, &Room::sins4UseSpockOnPanel },
{ {ACTION_USE, OBJECT_IPHASERK, HOTSPOT_NORTH_DOOR, 0}, &Room::sins4UsePhaserOnNorthDoor },
{ {ACTION_USE, OBJECT_IPHASERS, HOTSPOT_NORTH_DOOR, 0}, &Room::sins4UsePhaserOnNorthDoor },
{ {ACTION_USE, OBJECT_IPHASERK, HOTSPOT_PANEL, 0}, &Room::sins4UsePhaserOnPanel },
{ {ACTION_USE, OBJECT_IPHASERS, HOTSPOT_PANEL, 0}, &Room::sins4UsePhaserOnPanel },

{ {ACTION_USE, OBJECT_IIDCARD, HOTSPOT_PANEL, 0}, &Room::sins4UseIDCardOnPanel },
{ {ACTION_DONE_WALK, 2, 0, 0}, &Room::sins4KirkReachedPanel },
{ {ACTION_DONE_ANIM, 5, 0, 0}, &Room::sins4KirkPutCardInPanel },
{ {ACTION_USE, OBJECT_IS8ROCKS, HOTSPOT_PANEL, 0}, &Room::sins4UseRockOnPanel },
{ {ACTION_DONE_WALK, 3, 0, 0}, &Room::sins4KirkReachedPanelWithRock },
{ {ACTION_DONE_ANIM, 4, 0, 0}, &Room::sins4KirkUsedRockOnPanel },

{ {ACTION_LOOK, HOTSPOT_WEST_DOOR, 0, 0}, &Room::sins4LookAtWestDoor },
{ {ACTION_LOOK, HOTSPOT_EAST_DOOR, 0, 0}, &Room::sins4LookAtEastDoor },
{ {ACTION_LOOK, 0xff, 0, 0}, &Room::sins4LookAnywhere },
{ {ACTION_LOOK, HOTSPOT_PANEL, 0, 0}, &Room::sins4LookAtPanel },
{ {ACTION_TICK, 40, 0, 0}, &Room::sins4Tick40 },
{ {ACTION_LOOK, OBJECT_KIRK, 0, 0}, &Room::sins4LookAtKirk },
{ {ACTION_LOOK, OBJECT_SPOCK, 0, 0}, &Room::sins4LookAtSpock },
{ {ACTION_LOOK, OBJECT_MCCOY, 0, 0}, &Room::sins4LookAtMccoy },
{ {ACTION_LOOK, OBJECT_REDSHIRT, 0, 0}, &Room::sins4LookAtRedshirt },
{ {ACTION_LOOK, HOTSPOT_LIGHT, 0, 0}, &Room::sins4LookAtLight },
{ {ACTION_LOOK, HOTSPOT_BEAM, 0, 0}, &Room::sins4LookAtBeam },
{ {ACTION_LOOK, OBJECT_NORTH_DOOR, 0, 0}, &Room::sins4LookAtOpenNorthDoor },
{ {ACTION_LOOK, HOTSPOT_NORTH_DOOR, 0, 0}, &Room::sins4LookAtClosedNorthDoor },
{ {ACTION_TALK, OBJECT_KIRK, 0, 0}, &Room::sins4TalkToKirk },
{ {ACTION_TALK, OBJECT_SPOCK, 0, 0}, &Room::sins4TalkToSpock },
{ {ACTION_TALK, OBJECT_MCCOY, 0, 0}, &Room::sins4TalkToMccoy },
{ {ACTION_TALK, OBJECT_REDSHIRT, 0, 0}, &Room::sins4TalkToRedshirt },

{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_NORTH_DOOR, 0}, &Room::sins4UseSTricorderOnNorthDoor },
{ {ACTION_USE, OBJECT_ISTRICOR, 0xff, 0}, &Room::sins4UseSTricorderAnywhere },
{ {ACTION_USE, OBJECT_ICOMM, 0xff, 0}, &Room::sins4UseCommunicator },
{ {ACTION_USE, OBJECT_MCCOY, HOTSPOT_NORTH_DOOR, 0}, &Room::sins4UseMccoyOnNorthDoor },
{ {ACTION_USE, OBJECT_REDSHIRT, HOTSPOT_NORTH_DOOR, 0}, &Room::sins4UseRedshirtOnNorthDoor },
{ {ACTION_USE, OBJECT_SPOCK, HOTSPOT_NORTH_DOOR, 0}, &Room::sins4UseSpockOnNorthDoor },
{ {ACTION_USE, OBJECT_MCCOY, HOTSPOT_PANEL, 0}, &Room::sins4UseMccoyOnPanel },
{ {ACTION_USE, OBJECT_REDSHIRT, HOTSPOT_PANEL, 0}, &Room::sins4UseRedshirtOnPanel },

{ {ACTION_WALK, HOTSPOT_NORTH_DOOR, 0, 0}, &Room::sins4WalkToNorthDoor },
{ {ACTION_WALK, OBJECT_NORTH_DOOR, 0, 0}, &Room::sins4WalkToNorthDoor },
{ {ACTION_WALK, HOTSPOT_WEST_DOOR, 0, 0}, &Room::sins4WalkToWestDoor },
{ {ACTION_WALK, HOTSPOT_EAST_DOOR, 0, 0}, &Room::sins4WalkToEastDoor },

{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_KIRK, 0}, &Room::sins4UseMedkitOnCrewman },
{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_SPOCK, 0}, &Room::sins4UseMedkitOnCrewman },
{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_MCCOY, 0}, &Room::sins4UseMedkitOnCrewman },
{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_REDSHIRT, 0}, &Room::sins4UseMedkitOnCrewman },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_KIRK, 0}, &Room::sins4UseMTricorderOnCrewman },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_SPOCK, 0}, &Room::sins4UseMTricorderOnCrewman },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_MCCOY, 0}, &Room::sins4UseMTricorderOnCrewman },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_REDSHIRT, 0}, &Room::sins4UseMTricorderOnCrewman },
};

extern const int sins4NumActions = sizeof(sins4ActionList) / sizeof(RoomAction);


void Room::sins4Tick1() {
playVoc("SIN4LOOP");

if (!_awayMission->sins.enteredRoom4FirstTime)
_awayMission->disableInput = 2;

if (_awayMission->sins.unlockedIDCardDoor)
loadActorAnim2(OBJECT_NORTH_DOOR, "s4dro", 0, 0);

playMidiMusicTracks(MIDITRACK_27, -3);
}

void Room::sins4UseSTricorderOnPanel() {
spockScan(DIR_N, TX_SIN4_020);
_awayMission->sins.scannedKeycardLock = true;
_awayMission->sins.field39 |= 4;

if (_awayMission->sins.field39 == 7) {
showText(TX_SPEAKER_SPOCK, TX_SIN4_010);
_awayMission->sins.field39 |= 8;
}
}

void Room::sins4UseSpockOnPanel() {
// NOTE: two implementations of this function, one unused
if (true)
showText(TX_SPEAKER_SPOCK, TX_SIN4_018);
else {
showText(TX_SPEAKER_SPOCK, TX_SIN4_021);

if (_awayMission->sins.field39 == 7) {
showText(TX_SPEAKER_SPOCK, TX_SIN4_010);
_awayMission->sins.field39 |= 8;
}
}
}

void Room::sins4UsePhaserOnNorthDoor() {
showText(TX_SPEAKER_SPOCK, TX_SIN4_009);
}

void Room::sins4UsePhaserOnPanel() {
showText(TX_SPEAKER_SPOCK, TX_SIN4_008);
}

void Room::sins4UseIDCardOnPanel() {
if (_awayMission->sins.unlockedIDCardDoor)
showText(TX_SIN4N006);
else
walkCrewmanC(OBJECT_KIRK, 0xb8, 0x86, &Room::sins4KirkReachedPanel);
}

void Room::sins4KirkReachedPanel() {
_awayMission->sins.unlockedIDCardDoor = true;
loseItem(OBJECT_IIDCARD);
loadActorAnimC(OBJECT_KIRK, "kusemn", -1, -1, &Room::sins4KirkPutCardInPanel);

_awayMission->disableInput = true; // ENHANCEMENT: disable input
}

void Room::sins4KirkPutCardInPanel() {
loadActorAnim2(OBJECT_NORTH_DOOR, "s4door", 0, 0, 1); // Callback "1" doesn't exist
playVoc("MUR4E1");
_awayMission->disableInput = false;
}

void Room::sins4UseRockOnPanel() {
walkCrewmanC(OBJECT_KIRK, 0xb8, 0x86, &Room::sins4KirkReachedPanelWithRock);
}

void Room::sins4KirkReachedPanelWithRock() {
loadActorAnimC(OBJECT_KIRK, "kusemn", -1, -1, &Room::sins4KirkUsedRockOnPanel);
}

void Room::sins4KirkUsedRockOnPanel() {
showText(TX_SIN4N012);
showText(TX_SPEAKER_SPOCK, TX_SIN4_022);

if (_awayMission->sins.field39 == 7) {
showText(TX_SPEAKER_SPOCK, TX_SIN4_010);
_awayMission->sins.field39 |= 8;
}
}

void Room::sins4LookAtWestDoor() {
showText(TX_SIN4N009);
}

void Room::sins4LookAtEastDoor() {
showText(TX_SIN4N010);
}

void Room::sins4LookAnywhere() {
showText(TX_SIN4N013);
}

void Room::sins4LookAtPanel() {
showText(TX_SIN4N011);
}

void Room::sins4Tick40() {
if (!_awayMission->sins.enteredRoom4FirstTime) {
_awayMission->disableInput = false;
showText(TX_SPEAKER_UHURA, TX_SIN4U088);
showText(TX_SPEAKER_KIRK, TX_SIN4_007);
showText(TX_SPEAKER_UHURA, TX_SIN4U103);
showText(TX_SPEAKER_SPOCK, TX_SIN4_025);
showText(TX_SPEAKER_KIRK, TX_SIN4_003);
showText(TX_SPEAKER_UHURA, TX_SIN4U107);
showText(TX_SPEAKER_UHURA, TX_SIN4U105);
showText(TX_SPEAKER_KIRK, TX_SIN4_005);
_awayMission->sins.enteredRoom4FirstTime = true;
}
}

void Room::sins4LookAtKirk() {
showText(TX_SIN4N002);
}

void Room::sins4LookAtSpock() {
showText(TX_SIN4N004);
}

void Room::sins4LookAtMccoy() {
showText(TX_SIN4N003);
}

void Room::sins4LookAtRedshirt() {
showText(TX_SIN4N001);
}

void Room::sins4LookAtLight() {
showText(TX_SIN4N000);
}

void Room::sins4LookAtBeam() {
showText(TX_SIN4N005);
}

void Room::sins4LookAtOpenNorthDoor() {
showText(TX_SIN4N008);
}

void Room::sins4LookAtClosedNorthDoor() {
showText(TX_SIN4N007);
}

void Room::sins4TalkToKirk() {
showText(TX_SPEAKER_KIRK, TX_SIN4_001);
showText(TX_SPEAKER_SPOCK, TX_SIN4_028);
showText(TX_SPEAKER_KIRK, TX_SIN4_004);
}

void Room::sins4TalkToSpock() {
showText(TX_SPEAKER_SPOCK, TX_SIN4_019);
}

void Room::sins4TalkToMccoy() {
showText(TX_SPEAKER_MCCOY, TX_SIN4_015);
showText(TX_SPEAKER_SPOCK, TX_SIN4_024);
showText(TX_SPEAKER_MCCOY, TX_SIN4_017);
}

void Room::sins4TalkToRedshirt() {
showText(TX_SPEAKER_MOSHER, TX_SIN4_031);
}

void Room::sins4UseSTricorderOnNorthDoor() {
spockScan(DIR_N, TX_SIN4_027);
showText(TX_SPEAKER_MOSHER, TX_SIN4_032);
showText(TX_SPEAKER_SPOCK, TX_SIN4_026);
}

void Room::sins4UseSTricorderAnywhere() {
spockScan(DIR_S, TX_SIN4_011);

if (!_awayMission->sins.gotPointsForScanningRoom4) {
_awayMission->sins.missionScore += 1;
_awayMission->sins.gotPointsForScanningRoom4 = true;
}
}

void Room::sins4UseCommunicator() {
if (!_awayMission->sins.field45) {
showText(TX_SPEAKER_UHURA, TX_SIN4U100);
showText(TX_SPEAKER_KIRK, TX_SIN4_006);
showText(TX_SPEAKER_UHURA, TX_SIN4U83B);
showText(TX_SPEAKER_KIRK, TX_SIN4_002);
} else
showText(TX_SPEAKER_UHURA, TX_SIN4U073);
}

void Room::sins4UseMccoyOnNorthDoor() {
showText(TX_SPEAKER_MCCOY, TX_SIN4_016);
}

void Room::sins4UseRedshirtOnNorthDoor() {
showText(TX_SPEAKER_MOSHER, TX_SIN4_029);
}

void Room::sins4UseSpockOnNorthDoor() {
showText(TX_SPEAKER_SPOCK, TX_SIN4_023);
}

void Room::sins4UseMccoyOnPanel() {
showText(TX_SPEAKER_MCCOY, TX_SIN4_013);
}

void Room::sins4UseRedshirtOnPanel() {
showText(TX_SPEAKER_MOSHER, TX_SIN4_030);
}

void Room::sins4WalkToNorthDoor() {
if (_awayMission->sins.unlockedIDCardDoor)
walkCrewman(OBJECT_KIRK, 0x96, 0x7d);
}

void Room::sins4WalkToWestDoor() {
walkCrewman(OBJECT_KIRK, 0x1b, 0x95);
}

void Room::sins4WalkToEastDoor() {
walkCrewman(OBJECT_KIRK, 0x13c, 0x9b);
}

void Room::sins4UseMedkitOnCrewman() {
showText(TX_SPEAKER_MCCOY, TX_SIN4_014);
}

void Room::sins4UseMTricorderOnCrewman() {
mccoyScan(DIR_S, TX_SIN4_012);
}

}
Oops, something went wrong.

0 comments on commit 012b9ec

Please sign in to comment.