Permalink
Browse files

STARTREK: LOVE0 (start of 3rd mission)

  • Loading branch information...
Drenn1 authored and sev- committed Jun 15, 2018
1 parent 6e322eb commit efda57c114ecbf62b4d5b76c12e648837d814cdb
@@ -35,7 +35,7 @@ enum Acton {
ACTION_TALK = 5,

ACTION_TOUCHED_WARP = 6,
ACTION_TOUCHED_HOTSPOT = 7, // Doors? (Or just hotspots activated by Kirk moving there?)
ACTION_TOUCHED_HOTSPOT = 7, // Second kind of "hotspot" only relevant when an object touches them
ACTION_TIMER_EXPIRED = 8,
ACTION_FINISHED_ANIMATION = 10,
ACTION_FINISHED_WALKING = 12,
@@ -137,6 +137,19 @@ struct AwayMission {

bool talkedToBrigCrewman; // 0x5f
} tug;

// Love's Labor Jeopardized
struct {
bool alreadyStartedMission; // 0x29
bool knowAboutVirus; // 0x2a
bool field2c; // 0x2c
bool field2d; // 0x2d
byte field36; // 0x36
byte field37; // 0x37
bool spockAccessedConsole; // 0x49
bool mccoyAccessedConsole; // 0x4a
int16 missionScore; // 0x52
} love;
};
};
// Size: 0x129 bytes
@@ -30,6 +30,7 @@ MODULE_OBJS = \
rooms/tug1.o \
rooms/tug2.o \
rooms/tug3.o \
rooms/love0.o \



@@ -81,6 +81,10 @@ Room::Room(StarTrekEngine *vm, const Common::String &name) : _vm(vm) {
_roomActionList = tug3ActionList;
_numRoomActions = sizeof(tug3ActionList) / sizeof(RoomAction);
}
else if (name == "LOVE0") {
_roomActionList = love0ActionList;
_numRoomActions = sizeof(love0ActionList) / sizeof(RoomAction);
}
else {
warning("Room \"%s\" unimplemented", name.c_str());
_numRoomActions = 0;
@@ -327,6 +331,13 @@ Common::Point Room::getActorPos(int actorIndex) {
return _vm->_actorList[actorIndex].pos;
}

/**
* Returns a word in range [start, end] (that's inclusive).
*/
int16 Room::getRandomWordInRange(int start, int end) {
return _vm->getRandomWord() % (end - start + 1) + start;
}

void Room::playSoundEffectIndex(int soundEffect) {
_vm->playSoundEffectIndex(soundEffect);
}
@@ -368,23 +379,27 @@ void Room::playVoc(Common::String filename) {
_vm->_sound->playVoc(filename);
}

void Room::spockScan(int direction, int text) {
void Room::spockScan(int direction, int text, bool changeDirection) {
const char *dirs = "nsew";
Common::String anim = "sscan_";
anim.setChar(dirs[direction], 5);

_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = direction;
if (changeDirection) // Check whether he should turn back to original direction after scanning
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_SPOCK] = direction;

loadActorAnim2(OBJECT_SPOCK, anim, -1, -1, 0);
playSoundEffectIndex(SND_TRICORDER);
showText(TX_SPEAKER_SPOCK, text);
}

void Room::mccoyScan(int direction, int text) {
void Room::mccoyScan(int direction, int text, bool changeDirection) {
const char *dirs = "nsew";
Common::String anim = "mscan_";
anim.setChar(dirs[direction], 5);

_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_MCCOY] = direction;
if (changeDirection)
_vm->_awayMission.crewDirectionsAfterWalk[OBJECT_MCCOY] = direction;

loadActorAnim2(OBJECT_MCCOY, anim, -1, -1, 0);
playSoundEffectIndex(SND_TRICORDER);
showText(TX_SPEAKER_MCCOY, text);
@@ -113,15 +113,16 @@ class Room {
void showBitmapFor5Ticks(const Common::String &bmpName, int priority); // Cmd 0x0a
// Command 0x0c: "demon6ShowCase"
Common::Point getActorPos(int actorIndex); // Cmd 0x0d
int16 getRandomWordInRange(int start, int end); // Cmd 0x0e
void playSoundEffectIndex(int soundEffect); // Cmd 0x0f
void playMidiMusicTracks(int startTrack, int loopTrack); // Cmd 0x10
void endMission(int16 score, int16 arg2, int16 arg3); // Cmd 0x11
void showGameOverMenu(); // Cmd 0x12
void playVoc(Common::String filename); // Cmd 0x15

// Helper functions for repetitive stuff
void spockScan(int direction, int text);
void mccoyScan(int direction, int text);
void spockScan(int direction, int text, bool changeDirection = true);
void mccoyScan(int direction, int text, bool changeDirection = true);

// Room-specific code
public:
@@ -710,6 +711,41 @@ class Room {
void tug3EndMission();
void tug3SecurityTeamBeamedIn();

// LOVE0
void love0Tick1();
void love0Tick10();
void love0WalkToDoor2();
void love0OpenDoor2();
void love0ReachedDoor2();
void love0WalkToDoor1();
void love0OpenDoor1();
void love0ReachedDoor1();
void love0LookAtConsole();
void love0LookAtViewscreen();
void love0LookAnywhere();
void love0LookAtDoor1();
void love0LookAtDoor2();
void love0LookAtKirk();
void love0LookAtMccoy();
void love0LookAtSpock();
void love0LookAtRedshirt();
void love0TalkToKirk();
void love0TalkToMccoy();
void love0TalkToSpock();
void love0TalkToRedshirt();
void love0UseMTricorderAnywhere();
void love0UseSTricorderOnConsole();
void love0UseSTricorderAnywhere();
void love0UseKirkOnConsole();
void love0UseRedshirtOnConsole();
void love0UseSpockOnConsole();
void love0SpockReachedConsole();
void love0SpockAccessedConsole();
void love0UseMccoyOnConsole();
void love0MccoyReachedConsole();
void love0MccoyAccessedConsole();
void love0InteractWithConsole();

private:
// Room-specific variables. This is memset'ed to 0 when the room is initialized.
union {
@@ -773,6 +809,21 @@ class Room {
byte shootKirkOverride; // 0x1ec4
} tug2;

struct {
bool heardSummaryOfVirus; // 0xda
byte door2OpenCounter; // 0xdc
byte door1OpenCounter; // 0xdd
byte _de; // 0xde

int16 consoleCrewman; // 0xe3
char consoleAnimation[10]; // 0xe5
int32 consoleSpeaker; // 0xe7
int32 consoleText; // 0xe9

byte _8ab; // 0x8ab
byte _8ac; // 0x8ac
} love0;

} _roomVar;
};

@@ -744,7 +744,6 @@ RoomAction tug2ActionList[] = {
{ Action(ACTION_USE, OBJECT_IPHASERK, -1, 0), &Room::tug2UsePhaserAnywhere },
};


RoomAction tug3ActionList[] = {
{ Action(ACTION_TICK, 1, 0, 0), &Room::tug3Tick1 },
{ Action(ACTION_TICK, 40, 0, 0), &Room::tug3Tick40 },
@@ -782,6 +781,48 @@ RoomAction tug3ActionList[] = {
{ Action(ACTION_FINISHED_ANIMATION, 7, 0, 0), &Room::tug3SecurityTeamBeamedIn },
};


RoomAction love0ActionList[] = {
{ Action(ACTION_TICK, 1, 0, 0), &Room::love0Tick1 },
{ Action(ACTION_TICK, 10, 0, 0), &Room::love0Tick10 },
{ Action(ACTION_WALK, 0x21, 0, 0), &Room::love0WalkToDoor2 },
{ Action(ACTION_WALK, 9, 0, 0), &Room::love0WalkToDoor2 },
{ Action(ACTION_TOUCHED_HOTSPOT, 0, 0, 0), &Room::love0OpenDoor2 },
{ Action(ACTION_FINISHED_WALKING, 4, 0, 0), &Room::love0ReachedDoor2 },
{ Action(ACTION_FINISHED_ANIMATION, 3, 0, 0), &Room::love0ReachedDoor2 },
{ Action(ACTION_WALK, 0x22, 0, 0), &Room::love0WalkToDoor1 },
{ Action(ACTION_WALK, 8, 0, 0), &Room::love0WalkToDoor1 },
{ Action(ACTION_TOUCHED_HOTSPOT, 1, 0, 0), &Room::love0OpenDoor1 },
{ Action(ACTION_FINISHED_WALKING, 5, 0, 0), &Room::love0ReachedDoor1 },
{ Action(ACTION_FINISHED_ANIMATION, 4, 0, 0), &Room::love0ReachedDoor1 },
{ Action(ACTION_LOOK, 0x20, 0, 0), &Room::love0LookAtConsole },
{ Action(ACTION_LOOK, 0x23, 0, 0), &Room::love0LookAtViewscreen },
{ Action(ACTION_LOOK, -1, 0, 0), &Room::love0LookAnywhere },
{ Action(ACTION_LOOK, 8, 0, 0), &Room::love0LookAtDoor1 },
{ Action(ACTION_LOOK, 9, 0, 0), &Room::love0LookAtDoor2 },
{ Action(ACTION_LOOK, OBJECT_KIRK, 0, 0), &Room::love0LookAtKirk },
{ Action(ACTION_LOOK, OBJECT_MCCOY, 0, 0), &Room::love0LookAtMccoy },
{ Action(ACTION_LOOK, OBJECT_SPOCK, 0, 0), &Room::love0LookAtSpock },
{ Action(ACTION_LOOK, OBJECT_REDSHIRT, 0, 0), &Room::love0LookAtRedshirt },
{ Action(ACTION_TALK, OBJECT_KIRK, 0, 0), &Room::love0TalkToKirk },
{ Action(ACTION_TALK, OBJECT_MCCOY, 0, 0), &Room::love0TalkToMccoy },
{ Action(ACTION_TALK, OBJECT_SPOCK, 0, 0), &Room::love0TalkToSpock },
{ Action(ACTION_TALK, OBJECT_REDSHIRT, 0, 0), &Room::love0TalkToRedshirt },
{ Action(ACTION_USE, OBJECT_IMTRICOR, -1, 0), &Room::love0UseMTricorderAnywhere },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x20, 0), &Room::love0UseSTricorderOnConsole },
{ Action(ACTION_USE, OBJECT_ISTRICOR, -1, 0), &Room::love0UseSTricorderAnywhere },
{ Action(ACTION_USE, OBJECT_KIRK, 0x20, 0), &Room::love0UseKirkOnConsole },
{ Action(ACTION_USE, OBJECT_REDSHIRT, 0x20, 0), &Room::love0UseRedshirtOnConsole },
{ Action(ACTION_USE, OBJECT_SPOCK, 0x20, 0), &Room::love0UseSpockOnConsole },
{ Action(ACTION_FINISHED_WALKING, 2, 0, 0), &Room::love0SpockReachedConsole },
{ Action(ACTION_FINISHED_ANIMATION, 5, 0, 0), &Room::love0SpockAccessedConsole },
{ Action(ACTION_USE, OBJECT_MCCOY, 0x20, 0), &Room::love0UseMccoyOnConsole },
{ Action(ACTION_FINISHED_WALKING, 3, 0, 0), &Room::love0MccoyReachedConsole },
{ Action(ACTION_FINISHED_ANIMATION, 6, 0, 0), &Room::love0MccoyAccessedConsole },
// TODO: there's a lot of "extra" stuff at the end of the file. I don't think it's
// unused, but I'm not sure how it's run.
};

}

#endif
Oops, something went wrong.

0 comments on commit efda57c

Please sign in to comment.