1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
// Common code for all rooms in LOVE mission.
// TODO: from a cursory glance, this seems to be different in the floppy version?
#include "startrek/room.h"
namespace StarTrek {
// Mccoy or Ferris say something under effects of laughing gas
void Room::loveaTimer0Expired() {
const TextRef ferrisText[] = {
TX_LOV0_039,
TX_LOV0_048,
TX_LOV0_045,
TX_LOV0_040,
TX_LOV0_042,
TX_LOV0_050,
TX_LOV0_043,
TX_LOV0_041,
TX_LOV0_047,
TX_LOV0_046,
TX_LOV0_039
};
const TextRef mccoyText[] = {
TX_LOV0_011,
TX_LOV0_020,
TX_LOV0_016,
TX_LOV0_012,
TX_LOV0_014,
TX_LOV0_022,
TX_LOV0_015,
TX_LOV0_021,
TX_LOV0_013,
TX_LOV0_019,
TX_LOV0_017
};
// BUGFIX: should range from 0-1, not 0-2. Original had "get name errors" when it
// rolled a 2.
byte randomVal = getRandomWordInRange(0, 1);
TextRef speaker;
const TextRef *textTable;
if (randomVal == 0 || _awayMission->redshirtDead) {
speaker = TX_SPEAKER_MCCOY;
textTable = mccoyText;
} else {
speaker = TX_SPEAKER_FERRIS;
textTable = ferrisText;
}
randomVal = getRandomWordInRange(0, 10);
showText(speaker, textTable[randomVal]);
if (!_awayMission->love.releasedRomulanLaughingGas) {
const int spockText[] = {
TX_LOV0_029,
TX_LOV0_033,
TX_LOV0_026,
TX_LOV0_124
};
showText(TX_SPEAKER_SPOCK, spockText[getRandomWordInRange(0, 3)]);
// BUG(?): This is in an if statement, meaning the human crewmen stop talking from
// laughing gas if Spock is under laughing gas effects. Might be intentional, to
// reduce "spamming" of text?
_awayMission->timers[0] = getRandomWordInRange(200, 400);
}
}
// Spock says something under effects of laughing gas
void Room::loveaTimer1Expired() {
const int spockText[] = {
TX_LOV0_025,
TX_LOV0_101,
TX_LOV0_102,
TX_LOV0_103,
TX_LOV0_104,
TX_LOV0_105,
TX_LOV0_106,
TX_LOV0_107
};
showText(TX_SPEAKER_SPOCK, spockText[getRandomWordInRange(0, 7)]);
_awayMission->timers[1] = getRandomWordInRange(200, 400);
}
void Room::loveaUseMedkitOnSpock() {
if (_awayMission->love.spockCured)
showText(TX_SPEAKER_MCCOY, TX_LOV5_015);
else
showText(TX_SPEAKER_MCCOY, TX_LOV5_019);
}
void Room::loveaUseCureSampleOnSpock() {
if (_awayMission->love.spockCured) {
walkCrewman(OBJECT_SPOCK, _roomVar.love.cmnXPosToCureSpock, _roomVar.love.cmnYPosToCureSpock, 99);
walkCrewman(OBJECT_MCCOY, _roomVar.love.cmnXPosToCureSpock, _roomVar.love.cmnYPosToCureSpock + 10, 99);
} else
showText(TX_SPEAKER_MCCOY, TX_LOVA_F55);
}
void Room::loveaUseCureOnSpock() {
if (_awayMission->love.spockCured)
showText(TX_SPEAKER_MCCOY, TX_LOV5_015);
else {
walkCrewman(OBJECT_SPOCK, _roomVar.love.cmnXPosToCureSpock, _roomVar.love.cmnYPosToCureSpock, 99);
walkCrewman(OBJECT_MCCOY, _roomVar.love.cmnXPosToCureSpock, _roomVar.love.cmnYPosToCureSpock + 10, 99);
}
}
void Room::loveaSpockOrMccoyInPositionToUseCure() {
_roomVar.love.spockAndMccoyReadyToUseCure++;
if (_roomVar.love.spockAndMccoyReadyToUseCure == 2)
loadActorAnim2(OBJECT_MCCOY, "musemn", -1, -1, 99);
}
void Room::loveaFinishedCuringSpock() {
showText(TX_SPEAKER_MCCOY, TX_LOV5_030);
showText(TX_SPEAKER_SPOCK, TX_LOV5_038);
showText(TX_SPEAKER_MCCOY, TX_LOV5_027);
showText(TX_SPEAKER_SPOCK, TX_LOV5C001);
_awayMission->love.spockCured = true;
}
// Timer 2 counts down the time until Spock and the Romulans succumb to the virus.
// BUG(-ish): once Spock is cured, the romulans will never succumb to the virus.
void Room::loveaTimer2Expired() {
if (!_awayMission->love.spockCured) {
_awayMission->love.spockInfectionCounter++;
if (_awayMission->love.spockInfectionCounter >= 100) { // Spock succumbs, game over
loadActorAnim(OBJECT_SPOCK, "sgetdn", -1, -1, 0);
playMidiMusicTracks(2, -1); // FIXME: assembly had no second parameter...?
showText(TX_GENER004);
showGameOverMenu();
} else if (_awayMission->love.spockInfectionCounter == 15) {
showText(TX_SPEAKER_SPOCK, TX_SPOKCOFF);
_awayMission->love.spockInfectionCounter++;
} else if (_awayMission->love.spockInfectionCounter == 30) {
showText(TX_SPEAKER_MCCOY, TX_LOVA_F08);
_awayMission->love.spockInfectionCounter++;
} else if (_awayMission->love.spockInfectionCounter == 45) {
showText(TX_SPEAKER_SPOCK, TX_SPOKCOFF);
_awayMission->love.spockInfectionCounter++;
} else if (_awayMission->love.spockInfectionCounter == 60) {
showText(TX_SPEAKER_SPOCK, TX_LOVA_F54);
_awayMission->love.romulansUnconsciousFromVirus = true;
_awayMission->love.spockInfectionCounter++;
}
}
_awayMission->timers[2] = 200;
}
void Room::loveaUseMTricorderOnSpock() {
// Mccoy doesn't do his animation, I guess because he doesn't know which way to face?
// (possible future enhancement?)
playSoundEffectIndex(SND_TRICORDER);
if (_awayMission->love.spockCured)
showText(TX_SPEAKER_MCCOY, TX_LOVA_F01);
else if (!_awayMission->love.knowAboutVirus)
showText(TX_SPEAKER_MCCOY, TX_LOVA_F02);
else if (_awayMission->love.spockInfectionCounter < 10)
showText(TX_SPEAKER_MCCOY, TX_LOVA_F04);
else if (_awayMission->love.spockInfectionCounter < 30)
showText(TX_SPEAKER_MCCOY, TX_LOVA_F03);
else if (_awayMission->love.spockInfectionCounter < 50)
showText(TX_SPEAKER_MCCOY, TX_LOVA_F08);
else if (_awayMission->love.spockInfectionCounter < 70) // BUGFIX: < 70 instead of == 70
showText(TX_SPEAKER_MCCOY, TX_TUG2_010);
else if (_awayMission->love.spockInfectionCounter < 100)
showText(TX_SPEAKER_MCCOY, TX_LOVA_F10);
else
showText(TX_SPEAKER_MCCOY, TX_LOVA_100);
}
void Room::loveaUseMTricorderOnHuman() {
playSoundEffectIndex(SND_TRICORDER);
showText(TX_SPEAKER_MCCOY, TX_LOVA_F07);
}
void Room::loveaUseRomulanLaughingGas() {
showText(TX_LOV2N005);
_awayMission->love.releasedRomulanLaughingGas = true;
loseItem(OBJECT_IRLG);
// BUGFIX: start the effects immediately
_awayMission->timers[1] = getRandomWordInRange(200, 400);
}
void Room::loveaUseHumanLaughingGas() {
showText(TX_LOV2N005);
showText(TX_SPEAKER_SPOCK, TX_MUD2_040);
_awayMission->love.releasedHumanLaughingGas = true;
loseItem(OBJECT_IN2O);
playMidiMusicTracks(3, -1); // FIXME: assembly had no second parameter...?
// BUGFIX: start the effects immediately
_awayMission->timers[0] = getRandomWordInRange(200, 400);
}
void Room::loveaUseAmmonia() {
showText(TX_LOV2N005);
// TODO: redshirt says something in floppy edition only
loseItem(OBJECT_INH3);
}
void Room::loveaUseCommunicator() {
// There were originally number of branches here, based on whether we've got the cure
// and whether we've contacted the enterprise already; but all of them branch to the
// exact same code.
// TODO: perhaps the floppy edition had different text for each case.
showText(TX_SPEAKER_KIRK, TX_MUD4_018);
showText(TX_SPEAKER_UHURA, TX_BRIDU146);
showText(TX_SPEAKER_KIRK, TX_VENA_F41);
_awayMission->love.contactedEnterpriseBeforeCure = true;
}
}
|