Permalink
Browse files

STARTREK: MUDD1

  • Loading branch information...
Drenn1 authored and sev- committed Jun 28, 2018
1 parent 4c0eb3a commit 7cff7248642f3639f9f880178232686f60b7e315
@@ -41,7 +41,7 @@ void StarTrekEngine::initAwayMission() {
_roomIndexToLoad = -1;

// Load crew positions for beaming in
initAwayCrewPositions(4);
initAwayCrewPositions(1);
}

void StarTrekEngine::runAwayMission() {
@@ -190,15 +190,22 @@ struct AwayMission {

struct {
byte field29; // 0x29
bool torpedoLoaded; // 0x33
bool knowAboutTorpedo; // 0x34

// True if you've combined the lense + degrimer and fired it off, discovering
// it's a weapon
bool discoveredLenseAndDegrimerFunction; // 0x3c
byte torpedoStatus; // 0x3d
bool gotMemoryDisk; // 0x48
bool gotLense; // 0x49
bool gotDegrimer; // 0x4a

bool enteredRoom0ForFirstTime; // 0x54
bool gotPointsForLoadingTorpedo; // 0x55
bool gotPointsForPressingRedButton; // 0x56
bool enteredRoom1ForFirstTime; // 0x58
bool field58; // 0x58
int16 missionScore; // 0x5a
} mudd;
};
@@ -36,6 +36,8 @@ Room::Room(StarTrekEngine *vm, const Common::String &name) : _vm(vm) {
_rdfData = new byte[size];
rdfFile->read(_rdfData, size);

_roomIndex = name.lastChar() - '0';

// Find room-specific code table
if (name == "DEMON0") {
_roomActionList = demon0ActionList;
@@ -95,18 +95,20 @@ class Room {
RoomAction *_roomActionList;
int _numRoomActions;

int _roomIndex; // ie. for DEMON2, this is 2


int findFunctionPointer(int action, void (Room::*funcPtr)());

// Interface for room-specific code
void loadActorAnim(int actorIndex, Common::String anim, int16 x, int16 y, uint16 field66 = 0); // Cmd 0x00
void loadActorAnim(int actorIndex, Common::String anim, int16 x = -1, int16 y = -1, uint16 field66 = 0); // Cmd 0x00
void loadActorAnimC(int actorIndex, Common::String anim, int16 x, int16 y, void (Room::*funcPtr)());// Cmd 0x00
void loadActorStandAnim(int actorIndex); // Cmd 0x01
void loadActorAnim2(int actorIndex, Common::String anim, int16 x, int16 y, uint16 field66 = 0);// Cmd 0x02
void loadActorAnim2(int actorIndex, Common::String anim, int16 x = -1, int16 y = -1, uint16 field66 = 0);// Cmd 0x02
int showRoomSpecificText(const char **textAddr); // (Deprecated, use function below) // Cmd 0x03
int showText(const TextRef *text); // Cmd 0x03
int showText(TextRef speaker, TextRef text); // Cmd 0x03
int showText(TextRef text); // Cmd 0x03
int showText(const TextRef *text); // Cmd 0x03
int showText(TextRef speaker, TextRef text); // Cmd 0x03
int showText(TextRef text); // Cmd 0x03
void giveItem(int item); // Cmd 0x04
// Command 0x05: "demon4ShowSunPuzzle"
void loadRoomIndex(int roomIndex, int spawnIndex); // Cmd 0x06
@@ -1163,6 +1165,46 @@ class Room {

// MUDD1
void mudd1Tick1();
void mudd1Timer1Expired();
void mudd1UseCommunicator();
void mudd1UseSpockOnBlueButton();
void mudd1SpockReachedBlueButton();
void mudd1SpockPressedBlueButton();
void mudd1CraneFinishedMoving();
void mudd1UseSpockOnYellowButton();
void mudd1SpockReachedYellowButton();
void mudd1SpockPressedYellowButton();
void mudd1UseSpockOnRedButton();
void mudd1SpockReachedRedButton();
void mudd1SpockPressedRedButton();
void mudd1GetTorpedo();
void mudd1UseSTricorderOnTorpedo();
void mudd1UseSTricorderOnTorpedoLauncher();
void mudd1UseSTricorderOnButton();
void mudd1UseSTricorderOnCrane();
void mudd1UseMedkitAnywhere();
void mudd1LookAnywhere();
void mudd1LookAtTorpedo();
void mudd1LookAtFallenTorpedo();
void mudd1LookAtTorpedoLauncher();
void mudd1LookAtKirk();
void mudd1LookAtSpock();
void mudd1LookAtMccoy();
void mudd1LookAtRedshirt();
void mudd1LookAtCrane();
void mudd1LookAtRedButton();
void mudd1LookAtBlueButton();
void mudd1LookAtYellowButton();
void mudd1TalkToKirk();
void mudd1TalkToSpock();
void mudd1TalkToMccoy();
void mudd1TalkToRedshirt();
void mudd1WalkToSouthDoor();
void mudd1TouchedHotspot2();
void mudd1WalkToNorthDoor();
void mudd1TouchedHotspot1();
void mudd1WalkToWestDoor();
void mudd1TouchedHotspot0();

// MUDD2
void mudd2Tick1();
@@ -1176,6 +1218,8 @@ class Room {
// MUDD5
void mudd5Tick1();

// MUDDA

private:
// Room-specific variables. This is memset'ed to 0 when the room is initialized.
union {
@@ -1283,8 +1327,8 @@ class Room {
} love;

struct {
// mudd0
bool walkingToDoor; // 0x22a9
// common
byte walkingToDoor;
} mudd;


@@ -1413,10 +1413,13 @@ RoomAction mudd0ActionList[] = {
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x20, 0), &Room::mudd0UseSTricorderOnMemoryDiskBox },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x22, 0), &Room::mudd0UseSTricorderOnDegrimerBox },
{ Action(ACTION_USE, OBJECT_IMTRICOR, 0x21, 0), &Room::mudd0UseMTricorderOnLense },

// TODO: move these to common code
{ 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_GET, 0x21, 0, 0), &Room::mudd0GetLense },
{ Action(ACTION_GET, 0x20, 0, 0), &Room::mudd0GetMemoryDisk },
{ Action(ACTION_GET, 0x22, 0, 0), &Room::mudd0GetDegrimer },
@@ -1442,7 +1445,64 @@ RoomAction mudd0ActionList[] = {

RoomAction mudd1ActionList[] = {
{ Action(ACTION_TICK, 1, 0, 0), &Room::mudd1Tick1 },
{ Action(ACTION_TIMER_EXPIRED, 1, 0, 0), &Room::mudd1Timer1Expired },

{ Action(ACTION_USE, OBJECT_ICOMM, -1, 0), &Room::mudd1UseCommunicator },
{ Action(ACTION_USE, OBJECT_SPOCK, 0x23, 0), &Room::mudd1UseSpockOnBlueButton },
{ Action(ACTION_FINISHED_WALKING, 1, 0, 0), &Room::mudd1SpockReachedBlueButton },
{ Action(ACTION_FINISHED_ANIMATION, 1, 0, 0), &Room::mudd1SpockPressedBlueButton },
{ Action(ACTION_FINISHED_ANIMATION, 2, 0, 0), &Room::mudd1CraneFinishedMoving },
{ Action(ACTION_USE, OBJECT_SPOCK, 0x24, 0), &Room::mudd1UseSpockOnYellowButton },
{ Action(ACTION_FINISHED_WALKING, 2, 0, 0), &Room::mudd1SpockReachedYellowButton },
{ Action(ACTION_FINISHED_ANIMATION, 3, 0, 0), &Room::mudd1SpockPressedYellowButton },
{ Action(ACTION_USE, OBJECT_SPOCK, 0x25, 0), &Room::mudd1UseSpockOnRedButton },
{ Action(ACTION_FINISHED_WALKING, 3, 0, 0), &Room::mudd1SpockReachedRedButton },
{ Action(ACTION_FINISHED_ANIMATION, 4, 0, 0), &Room::mudd1SpockPressedRedButton },

// Common code
{ 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_GET, 9, 0, 0), &Room::mudd1GetTorpedo },
{ Action(ACTION_GET, 0x21, 0, 0), &Room::mudd1GetTorpedo },
{ Action(ACTION_GET, 0x20, 0, 0), &Room::mudd1GetTorpedo },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x21, 0), &Room::mudd1UseSTricorderOnTorpedo },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 9, 0), &Room::mudd1UseSTricorderOnTorpedo },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x20, 0), &Room::mudd1UseSTricorderOnTorpedo },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x22, 0), &Room::mudd1UseSTricorderOnTorpedoLauncher },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x25, 0), &Room::mudd1UseSTricorderOnButton },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x23, 0), &Room::mudd1UseSTricorderOnButton },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 0x24, 0), &Room::mudd1UseSTricorderOnButton },
{ Action(ACTION_USE, OBJECT_ISTRICOR, 8, 0), &Room::mudd1UseSTricorderOnCrane },
{ Action(ACTION_USE, OBJECT_IMEDKIT, -1, 0), &Room::mudd1UseMedkitAnywhere },
{ Action(ACTION_LOOK, -1, 0, 0), &Room::mudd1LookAnywhere },
{ Action(ACTION_LOOK, 0x20, 0, 0), &Room::mudd1LookAtTorpedo },
{ Action(ACTION_LOOK, 9, 0, 0), &Room::mudd1LookAtTorpedo },
{ Action(ACTION_LOOK, 0x21, 0, 0), &Room::mudd1LookAtFallenTorpedo },
{ Action(ACTION_LOOK, 0x22, 0, 0), &Room::mudd1LookAtTorpedoLauncher },
{ Action(ACTION_LOOK, OBJECT_KIRK, 0, 0), &Room::mudd1LookAtKirk },
{ Action(ACTION_LOOK, OBJECT_SPOCK, 0, 0), &Room::mudd1LookAtSpock },
{ Action(ACTION_LOOK, OBJECT_MCCOY, 0, 0), &Room::mudd1LookAtMccoy },
{ Action(ACTION_LOOK, OBJECT_REDSHIRT, 0, 0), &Room::mudd1LookAtRedshirt },
{ Action(ACTION_LOOK, 8, 0, 0), &Room::mudd1LookAtCrane },
{ Action(ACTION_LOOK, 0x25, 0, 0), &Room::mudd1LookAtRedButton },
{ Action(ACTION_LOOK, 0x23, 0, 0), &Room::mudd1LookAtBlueButton },
{ Action(ACTION_LOOK, 0x24, 0, 0), &Room::mudd1LookAtYellowButton },
{ Action(ACTION_TALK, OBJECT_KIRK, 0, 0), &Room::mudd1TalkToKirk },
{ Action(ACTION_TALK, OBJECT_SPOCK, 0, 0), &Room::mudd1TalkToSpock },
{ Action(ACTION_TALK, OBJECT_MCCOY, 0, 0), &Room::mudd1TalkToMccoy },
{ Action(ACTION_TALK, OBJECT_REDSHIRT, 0, 0), &Room::mudd1TalkToRedshirt },
{ Action(ACTION_WALK, 0x28, 0, 0), &Room::mudd1WalkToSouthDoor },
{ Action(ACTION_TOUCHED_HOTSPOT, 2, 0, 0), &Room::mudd1TouchedHotspot2 },
{ Action(ACTION_WALK, 0x27, 0, 0), &Room::mudd1WalkToNorthDoor },
{ 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?
};

RoomAction mudd2ActionList[] = {
{ Action(ACTION_TICK, 1, 0, 0), &Room::mudd2Tick1 },
};
Oops, something went wrong.

0 comments on commit 7cff724

Please sign in to comment.