aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/startrek/awaymission.cpp4
-rw-r--r--engines/startrek/awaymission.h3
-rw-r--r--engines/startrek/room.cpp4
-rw-r--r--engines/startrek/room.h5
-rw-r--r--engines/startrek/rooms/function_map.h7
-rw-r--r--engines/startrek/rooms/mudd5.cpp2
-rw-r--r--engines/startrek/rooms/mudda.cpp65
7 files changed, 86 insertions, 4 deletions
diff --git a/engines/startrek/awaymission.cpp b/engines/startrek/awaymission.cpp
index e11cae9d98..3c007e67d6 100644
--- a/engines/startrek/awaymission.cpp
+++ b/engines/startrek/awaymission.cpp
@@ -635,6 +635,10 @@ void StarTrekEngine::handleAwayMissionAction() {
initAwayCrewPositions(warpIndex ^ 1);
}
break;
+
+ default:
+ _room->handleActionWithBitmask(action);
+ break;
}
}
diff --git a/engines/startrek/awaymission.h b/engines/startrek/awaymission.h
index 25a5c1fe0f..788727dccf 100644
--- a/engines/startrek/awaymission.h
+++ b/engines/startrek/awaymission.h
@@ -221,7 +221,8 @@ struct AwayMission {
bool muddUnconscious; // 0x4d
byte muddState; // 0x4e
bool muddInhaledGas; // 0x4f
-
+ int16 lifeSupportTimer; // 0x50
+ bool startedLifeSupportTimer; // 0x52
bool enteredRoom0ForFirstTime; // 0x54
bool gotPointsForLoadingTorpedo; // 0x55
bool gotPointsForPressingRedButton; // 0x56
diff --git a/engines/startrek/room.cpp b/engines/startrek/room.cpp
index b727c2daa2..6237cdda90 100644
--- a/engines/startrek/room.cpp
+++ b/engines/startrek/room.cpp
@@ -475,9 +475,9 @@ void Room::endMission(int16 score, int16 arg1, int16 arg2) {
// TODO: game mode switch
}
-void Room::showGameOverMenu() {
+void Room::showGameOverMenu() { // TODO: takes an optional parameter?
_vm->showGameOverMenu();
- // TODO: shouldn't do this within a room
+ // TODO: finish. Shouldn't do this within a room due to deletion of current room?
}
void Room::playVoc(Common::String filename) {
diff --git a/engines/startrek/room.h b/engines/startrek/room.h
index f791728c60..22483dfb70 100644
--- a/engines/startrek/room.h
+++ b/engines/startrek/room.h
@@ -1378,6 +1378,11 @@ public:
void muddaUseAlienDevice();
void muddaFiredAlienDevice();
void muddaUseDegrimer();
+ void muddaTick();
+ void muddaKirkReachedDeathPosition();
+ void muddaSpockReachedDeathPosition();
+ void muddaMccoyReachedDeathPosition();
+ void muddaRedshirtReachedDeathPosition();
private:
// Room-specific variables. This is memset'ed to 0 when the room is initialized.
diff --git a/engines/startrek/rooms/function_map.h b/engines/startrek/rooms/function_map.h
index 456767f0a4..8c1a88727b 100644
--- a/engines/startrek/rooms/function_map.h
+++ b/engines/startrek/rooms/function_map.h
@@ -1731,6 +1731,13 @@ RoomAction mudd5ActionList[] = {
{ 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 },
+
+ // Common code (countdown for losing atmosphere when life support malfunctioning)
+ { Action(ACTION_TICK, -1, -1, -1), &Room::muddaTick },
+ { Action(ACTION_FINISHED_WALKING, 9, 0, 0), &Room::muddaKirkReachedDeathPosition },
+ { Action(ACTION_FINISHED_WALKING, 10, 0, 0), &Room::muddaSpockReachedDeathPosition },
+ { Action(ACTION_FINISHED_WALKING, 11, 0, 0), &Room::muddaMccoyReachedDeathPosition },
+ { Action(ACTION_FINISHED_WALKING, 12, 0, 0), &Room::muddaRedshirtReachedDeathPosition },
};
}
diff --git a/engines/startrek/rooms/mudd5.cpp b/engines/startrek/rooms/mudd5.cpp
index c8e7500126..4a1d3d1f07 100644
--- a/engines/startrek/rooms/mudd5.cpp
+++ b/engines/startrek/rooms/mudd5.cpp
@@ -48,7 +48,7 @@ void Room::mudd5Tick1() {
loadActorAnim(OBJECT_LIFE_SUPPORT_GENERATOR, "s4eplo", GENERATOR_X, GENERATOR_Y);
_vm->_awayMission.mudd.numTimesEnteredRoom5++;
// BUG: this event can become permanently unavailable? (test)
- if (_vm->_awayMission.mudd.numTimesEnteredRoom5 == 2 && !_vm->_awayMission.mudd.muddCurrentlyInsane && !_vm->_awayMission.mudd.repairedLifeSupportGenerator) {
+ if (true || _vm->_awayMission.mudd.numTimesEnteredRoom5 == 2 && !_vm->_awayMission.mudd.muddCurrentlyInsane && !_vm->_awayMission.mudd.repairedLifeSupportGenerator) { // FIXME
_vm->_awayMission.mudd.muddCurrentlyInsane = true;
_vm->_awayMission.mudd.numTimesEnteredRoom5 = 1;
_vm->_awayMission.disableInput = 2;
diff --git a/engines/startrek/rooms/mudda.cpp b/engines/startrek/rooms/mudda.cpp
index ed2a4886ab..2f1834a787 100644
--- a/engines/startrek/rooms/mudda.cpp
+++ b/engines/startrek/rooms/mudda.cpp
@@ -107,4 +107,69 @@ void Room::muddaUseDegrimer() {
showText(text[_roomIndex]);
}
+void Room::muddaTick() {
+ assert(_roomIndex >= 0 && _roomIndex <= 5);
+
+ const Common::Point deathPositions[][4] = {
+ { Common::Point(0xbb, 0x8d), Common::Point(0xd0, 0x89), Common::Point(0xaa, 0x85), Common::Point(0xbf, 0x83) },
+ { Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1) },
+ { Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1) },
+ { Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1) },
+ { Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1), Common::Point(-1, -1) },
+ { Common::Point(0x8b, 0xac), Common::Point(0x6f, 0x99), Common::Point(-1, -1), Common::Point(-1, -1) },
+ };
+
+ const TextRef deathText[] = {
+ TX_MUD0N006, 0, 0, 0, TX_MUD5N105
+ };
+
+ // This is implemented somewhat differently in each room.
+ // MUDD0:
+
+ //const int TIMER_LENGTH = 27000;
+ const int TIMER_LENGTH = 60; // FIXME
+
+ if (_vm->_awayMission.mudd.lifeSupportMalfunctioning) {
+ if (!_vm->_awayMission.mudd.startedLifeSupportTimer) {
+ _vm->_awayMission.mudd.startedLifeSupportTimer = true;
+ _vm->_awayMission.mudd.lifeSupportTimer = TIMER_LENGTH;
+ }
+ _vm->_awayMission.mudd.lifeSupportTimer--;
+
+ if (_vm->_awayMission.mudd.lifeSupportTimer == (int)(TIMER_LENGTH * 0.25)) {
+ showText(TX_SPEAKER_SPOCK, TX_MUD0_018);
+ } else if (_vm->_awayMission.mudd.lifeSupportTimer == (int)(TIMER_LENGTH * 0.5)) {
+ showText(TX_SPEAKER_SPOCK, TX_MUD0_019);
+ } else if (_vm->_awayMission.mudd.lifeSupportTimer == (int)(TIMER_LENGTH * 0.75)) {
+ showText(TX_SPEAKER_SPOCK, TX_MUD0_020);
+ } else if (_vm->_awayMission.mudd.lifeSupportTimer == 1) {
+ _vm->_awayMission.disableInput = true;
+ for (int i = OBJECT_KIRK; i <= OBJECT_REDSHIRT; i++) {
+ if (deathPositions[_roomIndex][i].x != -1)
+ walkCrewman(i, deathPositions[_roomIndex][i].x, deathPositions[_roomIndex][i].y, 9 + i);
+ }
+ showText(deathText[_roomIndex]);
+ showGameOverMenu();
+ }
+ }
+}
+
+void Room::muddaKirkReachedDeathPosition() {
+ loadActorAnim2(OBJECT_KIRK, "kgetdw");
+}
+
+void Room::muddaSpockReachedDeathPosition() {
+ loadActorAnim2(OBJECT_SPOCK, "sgetds");
+}
+
+void Room::muddaMccoyReachedDeathPosition() {
+ loadActorAnim2(OBJECT_MCCOY, "sgetdn");
+}
+
+void Room::muddaRedshirtReachedDeathPosition() {
+ loadActorAnim2(OBJECT_REDSHIRT, "rgetde");
+ // NOTE: there's code to check if he's the last one down... not really implemented
+ // properly
+}
+
}