Skip to content

Commit

Permalink
STARTREK: MUDD5
Browse files Browse the repository at this point in the history
  • Loading branch information
Stewmath authored and sev- committed Aug 9, 2018
1 parent 296bad0 commit b3c3174
Show file tree
Hide file tree
Showing 8 changed files with 422 additions and 14 deletions.
2 changes: 1 addition & 1 deletion engines/startrek/awaymission.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void StarTrekEngine::initAwayMission() {
_roomIndexToLoad = -1;

// Load crew positions for beaming in
initAwayCrewPositions(2);
initAwayCrewPositions(0);
}

void StarTrekEngine::runAwayMission() {
Expand Down
7 changes: 5 additions & 2 deletions engines/startrek/awaymission.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,17 @@ struct AwayMission {
// True if you've combined the lense + degrimer and fired it off, discovering
// it's a weapon
bool discoveredLenseAndDegrimerFunction; // 0x3c

int16 torpedoStatus; // 0x3d
bool muddCurrentlyInsane; // 0x3f
bool muddCurrentlyInsane; // 0x3f (TODO: rename)
bool muddVisitedDatabaseRoom; // 0x40
bool accessedAlienDatabase; // 0x41
bool tookRepairTool; // 0x42
bool gotPointsForDownloadingData; // 0x43
bool contactedEnterpriseFirstTime; // 0x44
bool viewScreenEnabled; // 0x45
bool lifeSupportMalfunctioning; // 0x46
byte numTimesEnteredRoom5; // 0x47
bool gotMemoryDisk; // 0x48
bool gotLense; // 0x49
bool gotDegrimer; // 0x4a
Expand All @@ -224,7 +227,7 @@ struct AwayMission {
bool gotPointsForPressingRedButton; // 0x56
bool gotPointsForEnablingViewscreen; // 0x57
bool enteredRoom1ForFirstTime; // 0x58
bool field58; // 0x58
bool repairedLifeSupportGenerator; // 0x59
int16 missionScore; // 0x5a
} mudd;
};
Expand Down
32 changes: 32 additions & 0 deletions engines/startrek/room.h
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,38 @@ class Room {

// MUDD5
void mudd5Tick1();
void mudd5Timer1Expired();
void mudd5Timer2Expired();
void mudd5UseCommunicator();
void mudd5UseSTricorderAnywhere();
void mudd5UseSTricorderOnEngine();
void mudd5UseSTricorderOnCrane();
void mudd5UseSTricorderOnHatch();
void mudd5UseSTricorderOnLifeSupportGenerator();
void mudd5UseStunPhaserOnHatch();
void mudd5UseKillPhaserOnHatch();
void mudd5UseAnythingOnLifeSupportGenerator();
void mudd5UseDooverOnLifeSupportGenerator();
void mudd5KirkReachedLifeSupportGenerator();
void mudd5KirkTimer4Expired();
void mudd5KirkRepairedLifeSupportGenerator();
void mudd5KirkTimer3Expired();
void mudd5LookAtHatch();
void mudd5LookAtLifeSupportGenerator();
void mudd5TouchedHotspot0();
void mudd5WalkToDoor();
void mudd5LookAtKirk();
void mudd5LookAtSpock();
void mudd5LookAtMccoy();
void mudd5LookAtRedshirt();
void mudd5LookAtDoor();
void mudd5LookAtCrane();
void mudd5LookAtEngine();
void mudd5TalkToKirk();
void mudd5TalkToSpock();
void mudd5TalkToMccoy();
void mudd5TalkToRedshirt();
void mudd5UseMedkit();

// MUDDA

Expand Down
49 changes: 44 additions & 5 deletions engines/startrek/rooms/function_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ RoomAction mudd0ActionList[] = {
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x22, 0), &Room::mudd0UseSTricorderOnDegrimerBox },
{ Action(ACTION_USE, OBJECT_IMTRICOR, 0x21, 0), &Room::mudd0UseMTricorderOnLense },

// TODO: move these to common code
// 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 },
Expand Down Expand Up @@ -1459,7 +1459,7 @@ RoomAction mudd1ActionList[] = {
{ Action(ACTION_FINISHED_WALKING, 3, 0, 0), &Room::mudd1SpockReachedRedButton },
{ Action(ACTION_FINISHED_ANIMATION, 4, 0, 0), &Room::mudd1SpockPressedRedButton },

// Common code
// 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 },
Expand Down Expand Up @@ -1517,7 +1517,7 @@ RoomAction mudd2ActionList[] = {
{ Action(ACTION_FINISHED_ANIMATION, 13, 0, 0), &Room::mudd2MccoyPickedUpCapsules },
{ Action(ACTION_USE, OBJECT_ICOMM, -1, 0), &Room::mudd2UseCommunicator },

// Common code
// 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 },
Expand Down Expand Up @@ -1585,7 +1585,7 @@ RoomAction mudd3ActionList[] = {
{ Action(ACTION_TIMER_EXPIRED, 4, 0, 0), &Room::mudd3Timer4Expired },
{ Action(ACTION_USE, OBJECT_IDISKS, 0x21, 0), &Room::mudd3UseMemoryDiskOnSphere },

// Common code
// 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 },
Expand Down Expand Up @@ -1655,7 +1655,7 @@ RoomAction mudd4ActionList[] = {
// ENHANCEMENT: Allow scanning the viewscreen when it's on, not just when off
{ Action(ACTION_USE, OBJECT_ISTRICOR, 8, 0), &Room::mudd4UseSTricorderOnViewscreen },

// Common code
// 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 },
Expand Down Expand Up @@ -1692,6 +1692,45 @@ RoomAction mudd4ActionList[] = {

RoomAction mudd5ActionList[] = {
{ Action(ACTION_TICK, 1, 0, 0), &Room::mudd5Tick1 },
{ Action(ACTION_TIMER_EXPIRED, 1, 0, 0), &Room::mudd5Timer1Expired },
{ Action(ACTION_TIMER_EXPIRED, 2, 0, 0), &Room::mudd5Timer2Expired },
{ Action(ACTION_USE, OBJECT_ICOMM, -1, 0), &Room::mudd5UseCommunicator },
{ Action(ACTION_USE, OBJECT_ISTRICOR, -1, 0), &Room::mudd5UseSTricorderAnywhere },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x21, 0), &Room::mudd5UseSTricorderOnEngine },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x22, 0), &Room::mudd5UseSTricorderOnCrane },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x20, 0), &Room::mudd5UseSTricorderOnHatch },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 9, 0), &Room::mudd5UseSTricorderOnLifeSupportGenerator },
{ Action(ACTION_USE, OBJECT_IPHASERS, 0x20, 0), &Room::mudd5UseStunPhaserOnHatch },
{ Action(ACTION_USE, OBJECT_IPHASERK, 0x20, 0), &Room::mudd5UseKillPhaserOnHatch },
{ Action(ACTION_USE, -1, 9, 0), &Room::mudd5UseAnythingOnLifeSupportGenerator },
{ Action(ACTION_USE, OBJECT_IDOOVER, 9, 0), &Room::mudd5UseDooverOnLifeSupportGenerator },
{ Action(ACTION_FINISHED_WALKING, 2, 0, 0), &Room::mudd5KirkReachedLifeSupportGenerator },
{ Action(ACTION_TIMER_EXPIRED, 4, 0, 0), &Room::mudd5KirkTimer4Expired },
{ Action(ACTION_FINISHED_ANIMATION, 2, 0, 0), &Room::mudd5KirkRepairedLifeSupportGenerator },
{ 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_LOOK, 0x20, 0, 0), &Room::mudd5LookAtHatch },
{ Action(ACTION_LOOK, 9, 0, 0), &Room::mudd5LookAtLifeSupportGenerator },
{ Action(ACTION_TOUCHED_HOTSPOT, 0, 0, 0), &Room::mudd5TouchedHotspot0 },
{ Action(ACTION_WALK, 0x22, 0, 0), &Room::mudd5WalkToDoor },
{ Action(ACTION_LOOK, OBJECT_KIRK, 0, 0), &Room::mudd5LookAtKirk },
{ Action(ACTION_LOOK, OBJECT_SPOCK, 0, 0), &Room::mudd5LookAtSpock },
{ Action(ACTION_LOOK, OBJECT_MCCOY, 0, 0), &Room::mudd5LookAtMccoy },
{ Action(ACTION_LOOK, OBJECT_REDSHIRT, 0, 0), &Room::mudd5LookAtRedshirt },
{ Action(ACTION_LOOK, 0x22, 0, 0), &Room::mudd5LookAtDoor },
{ Action(ACTION_LOOK, 0x23, 0, 0), &Room::mudd5LookAtCrane },
{ Action(ACTION_LOOK, 0x21, 0, 0), &Room::mudd5LookAtEngine },
{ Action(ACTION_TALK, OBJECT_KIRK, 0, 0), &Room::mudd5TalkToKirk },
{ Action(ACTION_TALK, OBJECT_SPOCK, 0, 0), &Room::mudd5TalkToSpock },
{ Action(ACTION_TALK, OBJECT_MCCOY, 0, 0), &Room::mudd5TalkToMccoy },
{ Action(ACTION_TALK, OBJECT_REDSHIRT, 0, 0), &Room::mudd5TalkToRedshirt },
{ Action(ACTION_USE, OBJECT_IMEDKIT, -1, 0), &Room::mudd5UseMedkit },
};

}
Expand Down
7 changes: 4 additions & 3 deletions engines/startrek/rooms/mudd0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void Room::mudd0UseLenseOnDegrimer() {
_vm->_awayMission.mudd.missionScore++;
showText(TX_MUD0N011);
// TODO: Identical (?) audio files: TX_MUD0N011, TX_MUD1N013, TX_MUD2N010, TX_MUD3N016,
// TX_MUD4009
// TX_MUD4009, TX_MUD5N009
}


Expand All @@ -177,6 +177,7 @@ void Room::mudd0UseAlienDevice() {
11, // MUDD2
11, // MUDD3
9, // MUDD4
11 // MUDD5
};

_vm->_awayMission.disableInput = true;
Expand All @@ -192,7 +193,7 @@ void Room::mudd0FiredAlienDevice() {
_vm->_awayMission.disableInput = false;
if (!_vm->_awayMission.mudd.discoveredLenseAndDegrimerFunction) {
_vm->_awayMission.mudd.discoveredLenseAndDegrimerFunction = true;
_vm->_awayMission.mudd.missionScore += 5;
_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
}
Expand All @@ -201,7 +202,7 @@ void Room::mudd0FiredAlienDevice() {

void Room::mudd0UseDegrimer() {
// TODO: Identical (?) audio files: TX_MUD0N002, TX_MUD1N004, TX_MUD2N001,
// TX_MUD3N001, TX_MUD4N002
// TX_MUD3N001, TX_MUD4N002, TX_MUD5_001
showText(TX_MUD0N002);
}

Expand Down
Loading

0 comments on commit b3c3174

Please sign in to comment.