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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
|
/* 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.
*
*/
#include "startrek/room.h"
#define OBJECT_TLAOXAC 8
#define OBJECT_KNIFE 9
#define OBJECT_ROCK 10
#define HOTSPOT_LEFT_EXIT 0x20
#define HOTSPOT_LIGHT_1 0x21
#define HOTSPOT_LIGHT_2 0x22
#define KNIFE_X 0x64
#define KNIFE_Y 0xb4
namespace StarTrek {
extern const RoomAction feather3ActionList[] = {
{ {ACTION_TICK, 1, 0, 0}, &Room::feather3Tick1 },
{ {ACTION_TICK, 40, 0, 0}, &Room::feather3Tick40 },
{ {ACTION_TOUCHED_HOTSPOT, 0, 0, 0}, &Room::feather3TouchedHotspot0 },
{ {ACTION_USE, OBJECT_SPOCK, OBJECT_TLAOXAC, 0}, &Room::feather3UseSpockOnTlaoxac },
{ {ACTION_USE, OBJECT_MCCOY, OBJECT_TLAOXAC, 0}, &Room::feather3UseMccoyOnTlaoxac },
{ {ACTION_USE, OBJECT_REDSHIRT, OBJECT_TLAOXAC, 0}, &Room::feather3UseRedshirtOnTlaoxac },
{ {ACTION_USE, OBJECT_SPOCK, HOTSPOT_LEFT_EXIT, 0}, &Room::feather3UseCrewmanOnLeftExit },
{ {ACTION_USE, OBJECT_MCCOY, HOTSPOT_LEFT_EXIT, 0}, &Room::feather3UseCrewmanOnLeftExit },
{ {ACTION_USE, OBJECT_REDSHIRT, HOTSPOT_LEFT_EXIT, 0}, &Room::feather3UseCrewmanOnLeftExit },
{ {ACTION_USE, OBJECT_ICOMM, 0, 0}, &Room::feather3UseCommunicator },
{ {ACTION_USE, OBJECT_ISNAKE, OBJECT_KIRK, 0}, &Room::feather3UseSnakeOnKirk },
{ {ACTION_USE, OBJECT_ISNAKE, OBJECT_SPOCK, 0}, &Room::feather3UseSnakeOnSpock },
{ {ACTION_USE, OBJECT_ISNAKE, OBJECT_REDSHIRT, 0}, &Room::feather3UseSnakeOnRedshirt },
{ {ACTION_FINISHED_WALKING, 2, 0, 0}, &Room::feather3KirkReachedRedshirtWithSnake },
{ {ACTION_USE, OBJECT_ISNAKE, OBJECT_MCCOY, 0}, &Room::feather3UseSnakeOnMccoy },
{ {ACTION_USE, OBJECT_ISNAKE, OBJECT_TLAOXAC, 0}, &Room::feather3UseSnakeOnTlaoxac },
{ {ACTION_USE, OBJECT_IKNIFE, OBJECT_SPOCK, 0}, &Room::feather3UseKnifeOnSpock },
{ {ACTION_USE, OBJECT_IKNIFE, OBJECT_MCCOY, 0}, &Room::feather3UseKnifeOnMccoy },
{ {ACTION_USE, OBJECT_IKNIFE, OBJECT_REDSHIRT, 0}, &Room::feather3UseKnifeOnRedshirt },
{ {ACTION_USE, OBJECT_IROCK, OBJECT_TLAOXAC, 0}, &Room::feather3UseRockOnTlaoxac },
{ {ACTION_FINISHED_WALKING, 3, 0, 0}, &Room::feather3KirkReachedPositionToThrowRock },
{ {ACTION_TIMER_EXPIRED, 4, 0, 0}, &Room::feather3Timer4Expired },
{ {ACTION_TIMER_EXPIRED, 2, 0, 0}, &Room::feather3Timer2Expired },
{ {ACTION_TIMER_EXPIRED, 3, 0, 0}, &Room::feather3Timer3Expired },
{ {ACTION_FINISHED_ANIMATION, 4, 0, 0}, &Room::feather3TlaoxacKnockedOutFromRockThrow },
{ {ACTION_USE, OBJECT_IPHASERS, 0xff, 0}, &Room::feather3UsePhaser },
{ {ACTION_USE, OBJECT_IPHASERK, 0xff, 0}, &Room::feather3UsePhaser },
{ {ACTION_TALK, OBJECT_MCCOY, 0, 0}, &Room::feather3TalkToMccoy },
{ {ACTION_TALK, OBJECT_SPOCK, 0, 0}, &Room::feather3TalkToSpock },
{ {ACTION_TALK, OBJECT_REDSHIRT, 0, 0}, &Room::feather3TalkToRedshirt },
{ {ACTION_TALK, OBJECT_TLAOXAC, 0, 0}, &Room::feather3TalkToTlaoxac },
{ {ACTION_FINISHED_ANIMATION, 2, 0, 0}, &Room::feather3TlaoxacKilledRedshirt },
{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_TLAOXAC, 0}, &Room::feather3UseMTricorderOnTlaoxac },
{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_TLAOXAC, 0}, &Room::feather3UseMedkitOnTlaoxac },
{ {ACTION_USE, OBJECT_IMEDKIT, OBJECT_REDSHIRT, 0}, &Room::feather3UseMedkitOnRedshirt },
{ {ACTION_USE, OBJECT_IMEDKIT, 0xff, 0}, &Room::feather3UseMedkitAnywhere },
{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_1, 0}, &Room::feather3UseMTricorderOnLight },
{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_LIGHT_2, 0}, &Room::feather3UseMTricorderOnLight },
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_LIGHT_1, 0}, &Room::feather3UseSTricorderOnLight },
{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_LIGHT_2, 0}, &Room::feather3UseSTricorderOnLight },
{ {ACTION_USE, OBJECT_ISTRICOR, 0xff, 0}, &Room::feather3UseSTricorderAnywhere },
{ {ACTION_GET, OBJECT_KNIFE, 0, 0}, &Room::feather3GetKnife },
{ {ACTION_FINISHED_WALKING, 1, 0, 0}, &Room::feather3ReachedKnife },
{ {ACTION_TIMER_EXPIRED, 1, 0, 0}, &Room::feather3Timer1Expired },
{ {ACTION_FINISHED_ANIMATION, 1, 0, 0}, &Room::feather3PickedUpKnife },
{ {ACTION_LOOK, OBJECT_SPOCK, 0, 0}, &Room::feather3LookAtSpock },
{ {ACTION_LOOK, OBJECT_REDSHIRT, 0, 0}, &Room::feather3LookAtRedshirt },
{ {ACTION_LOOK, OBJECT_TLAOXAC, 0, 0}, &Room::feather3LookAtTlaoxac },
{ {ACTION_LOOK, HOTSPOT_LIGHT_1, 0, 0}, &Room::feather3LookAtLight },
{ {ACTION_LOOK, HOTSPOT_LIGHT_2, 0, 0}, &Room::feather3LookAtLight },
{ {ACTION_LOOK, OBJECT_MCCOY, 0, 0}, &Room::feather3LookAtMccoy },
{ {ACTION_LOOK, OBJECT_KNIFE, 0, 0}, &Room::feather3LookAtKnife },
};
extern const int feather3NumActions = ARRAYSIZE(feather3ActionList);
void Room::feather3Tick1() {
playVoc("FEA3LOOP");
playMidiMusicTracks(27);
if (!_awayMission->feather.tlaoxacTestPassed) {
loadActorAnim(OBJECT_TLAOXAC, "s5r3as", 0x2e, 0xab);
loadMapFile("feath3b");
} else if (!_awayMission->feather.tookKnife)
loadActorAnim(OBJECT_KNIFE, "s5r3nf", 0x64, 0xb4);
}
void Room::feather3Tick40() {
if (!_awayMission->feather.tlaoxacTestPassed)
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_036);
}
void Room::feather3TouchedHotspot0() { // Tlaoxac prevents you from passing this point
if (!_awayMission->feather.tlaoxacTestPassed)
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_035);
}
void Room::feather3UseSpockOnTlaoxac() {
showText(TX_SPEAKER_SPOCK, TX_FEA3_026);
showText(TX_SPEAKER_MCCOY, TX_FEA3_018);
showText(TX_SPEAKER_SPOCK, TX_FEA3_028);
showText(TX_SPEAKER_MCCOY, TX_FEA3_015);
}
void Room::feather3UseMccoyOnTlaoxac() {
showText(TX_SPEAKER_MCCOY, TX_FEA3_016);
showText(TX_SPEAKER_SPOCK, TX_FEA3_027);
showText(TX_SPEAKER_MCCOY, TX_FEA3_017);
}
void Room::feather3UseRedshirtOnTlaoxac() {
if (!_awayMission->redshirtDead)
showText(TX_SPEAKER_STRAGEY, TX_FEA3_029);
}
void Room::feather3UseCrewmanOnLeftExit() {
if (!_awayMission->feather.tlaoxacTestPassed)
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_041);
}
void Room::feather3UseCommunicator() {
showText(TX_SPEAKER_SPOCK, TX_FEA3_024);
}
void Room::feather3UseSnakeOnKirk() {
if (!_awayMission->feather.tlaoxacTestPassed && !_awayMission->redshirtDead) {
if (_roomVar.feather.showedSnakeToTlaoxac && _awayMission->feather.numRocksThrownAtTlaoxac == 0) {
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_043);
_awayMission->feather.tlaoxacTestPassed = true;
_awayMission->feather.missionScore += 2;
loadMapFile("feather3");
loadActorAnim(OBJECT_KNIFE, "s5r3nf", KNIFE_X, KNIFE_Y);
_awayMission->feather.field2e = true;
} else
showDescription(TX_FEA3N004);
}
}
void Room::feather3UseSnakeOnSpock() {
if (_roomVar.feather.showedSnakeToTlaoxac)
showText(TX_SPEAKER_SPOCK, TX_FEA3_004);
else
showText(TX_SPEAKER_SPOCK, TX_FEA3_020);
}
void Room::feather3UseSnakeOnRedshirt() {
if (!_awayMission->feather.tlaoxacTestPassed && !_awayMission->redshirtDead) {
if (_roomVar.feather.showedSnakeToTlaoxac && _awayMission->feather.numRocksThrownAtTlaoxac == 0) {
walkCrewmanC(OBJECT_KIRK, 0x7c, 0xbc, &Room::feather3KirkReachedRedshirtWithSnake);
_awayMission->disableInput = true;
} else
showText(TX_SPEAKER_STRAGEY, TX_FEA3_031);
}
}
void Room::feather3KirkReachedRedshirtWithSnake() {
_awayMission->disableInput = false;
showText(TX_SPEAKER_STRAGEY, TX_FEA3_034);
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_044);
_awayMission->feather.tlaoxacTestPassed = true;
_awayMission->feather.missionScore += 1;
loadMapFile("feather3");
loadActorAnim(OBJECT_KNIFE, "s5r3nf", KNIFE_X, KNIFE_Y);
_awayMission->feather.field2e = true;
}
void Room::feather3UseSnakeOnMccoy() {
showText(TX_SPEAKER_MCCOY, TX_FEA3_007);
}
void Room::feather3UseSnakeOnTlaoxac() {
if (!_awayMission->feather.tlaoxacTestPassed && _awayMission->feather.numRocksThrownAtTlaoxac == 0) {
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_039);
_roomVar.feather.showedSnakeToTlaoxac = true;
if (!_awayMission->feather.showedSnakeToTlaoxac) {
_awayMission->feather.showedSnakeToTlaoxac = true;
_awayMission->feather.missionScore += 1;
}
}
}
void Room::feather3UseKnifeOnSpock() {
showText(TX_SPEAKER_SPOCK, TX_FEA3_025);
}
void Room::feather3UseKnifeOnMccoy() {
showText(TX_SPEAKER_MCCOY, TX_FEA3_011); // BUGFIX: Speaker is Mccoy, not Spock.
}
void Room::feather3UseKnifeOnRedshirt() {
if (!_awayMission->redshirtDead)
showText(TX_SPEAKER_STRAGEY, TX_FEA3_033); // BUGFIX: Speaker is Stragey, not Spock.
}
void Room::feather3UseRockOnTlaoxac() {
if (_roomVar.feather.tlaoxacUnconscious)
showText(TX_SPEAKER_MCCOY, TX_FEA3_009);
else {
_awayMission->feather.numRocksThrownAtTlaoxac++;
_awayMission->disableInput = true;
walkCrewmanC(OBJECT_KIRK, 0xac, 0xb4, &Room::feather3KirkReachedPositionToThrowRock);
}
}
void Room::feather3KirkReachedPositionToThrowRock() {
_awayMission->crewDirectionsAfterWalk[OBJECT_KIRK] = DIR_W;
loadActorAnim2(OBJECT_KIRK, "s5r3kt");
loadActorAnim(OBJECT_ROCK, "s5r3rt", 0x80, 0x7e);
_awayMission->timers[4] = 21;
if (_awayMission->feather.numRocksThrownAtTlaoxac == 2) {
_awayMission->feather.knockedOutTlaoxac = true;
_awayMission->feather.missionScore -= 2;
loadActorAnimC(OBJECT_TLAOXAC, "s5r3ad", -1, -1, &Room::feather3TlaoxacKnockedOutFromRockThrow);
playVoc("ROCKFACE");
_awayMission->timers[2] = 24;
} else {
loadActorAnim2(OBJECT_TLAOXAC, "s5r3ah");
playVoc("ROCKFACE");
_awayMission->timers[3] = 97;
}
}
void Room::feather3Timer4Expired() {
playSoundEffectIndex(SND_BLANK_0b);
}
void Room::feather3Timer2Expired() {
if (!_awayMission->feather.tookKnife)
loadActorAnim(OBJECT_KNIFE, "s5r3nf", KNIFE_X, KNIFE_Y);
}
void Room::feather3Timer3Expired() {
_awayMission->disableInput = false;
loadActorStandAnim(OBJECT_KIRK);
}
void Room::feather3TlaoxacKnockedOutFromRockThrow() {
_awayMission->disableInput = false;
loadActorStandAnim(OBJECT_KIRK);
showDescription(TX_FEA3N006);
if (!_awayMission->feather.tookKnife && !_awayMission->feather.field2e)
showText(TX_SPEAKER_MCCOY, TX_FEA3_008);
_awayMission->feather.tlaoxacTestPassed = true;
_roomVar.feather.tlaoxacUnconscious = true;
loadMapFile("feather3");
}
void Room::feather3UsePhaser() {
showText(TX_SPEAKER_SPOCK, TX_FEA3_023);
}
void Room::feather3TalkToMccoy() {
showText(TX_SPEAKER_MCCOY, TX_FEA3_005);
}
void Room::feather3TalkToSpock() {
showText(TX_SPEAKER_SPOCK, TX_FEA3_022);
}
void Room::feather3TalkToRedshirt() {
if (!_awayMission->redshirtDead)
showText(TX_SPEAKER_STRAGEY, TX_FEA3_032);
}
void Room::feather3TalkToTlaoxac() {
if (!_awayMission->feather.tlaoxacTestPassed && !_awayMission->redshirtDead && !_roomVar.feather.tlaoxacUnconscious) {
if (!_roomVar.feather.showedSnakeToTlaoxac)
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_038);
else if (_awayMission->feather.numRocksThrownAtTlaoxac != 0)
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_038);
else {
const TextRef choices[] = {
TX_SPEAKER_KIRK,
TX_FEA3_001, TX_FEA3_002, TX_FEA3_003,
TX_BLANK
};
int choice = showMultipleTexts(choices);
if (choice == 0)
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_037);
else if (choice == 1)
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_042);
else if (choice == 2) { // Accidentally insulted Quetzecoatl
showText(TX_SPEAKER_TLAOXAC, TX_FEA3_040);
_awayMission->disableInput = true;
loadActorAnimC(OBJECT_TLAOXAC, "s5r3aj", -1, -1, &Room::feather3TlaoxacKilledRedshirt);
playMidiMusicTracks(2);
loadActorAnim(OBJECT_REDSHIRT, "s5r3rd");
_awayMission->redshirtDead = true;
} else
showDescription(TX_DIALOG_ERROR);
}
}
}
void Room::feather3TlaoxacKilledRedshirt() {
_awayMission->disableInput = false;
}
void Room::feather3UseMTricorderOnTlaoxac() {
if (_roomVar.feather.tlaoxacUnconscious)
mccoyScan(DIR_W, TX_FEA3_010);
else
mccoyScan(DIR_W, TX_FEA3_014);
}
void Room::feather3UseMedkitOnTlaoxac() {
if (_awayMission->feather.knockedOutTlaoxac)
showText(TX_SPEAKER_MCCOY, TX_FEA3_012);
}
void Room::feather3UseMedkitOnRedshirt() {
if (_awayMission->redshirtDead)
mccoyScan(DIR_N, 30, true);
}
void Room::feather3UseMedkitAnywhere() {
showText(TX_SPEAKER_MCCOY, TX_FEA3_006);
}
void Room::feather3UseMTricorderOnLight() {
mccoyScan(DIR_W, TX_FEA3_013);
}
void Room::feather3UseSTricorderOnLight() {
spockScan(DIR_W, TX_FEA3_019);
}
void Room::feather3UseSTricorderAnywhere() {
spockScan(DIR_S, TX_FEA3_021);
}
void Room::feather3GetKnife() {
_awayMission->feather.missionScore += 1;
walkCrewmanC(OBJECT_KIRK, 0x57, 0xb4, &Room::feather3ReachedKnife);
_awayMission->disableInput = true;
}
void Room::feather3ReachedKnife() {
loadActorAnimC(OBJECT_KIRK, "s5r1kg", -1, -1, &Room::feather3PickedUpKnife);
_awayMission->timers[1] = 20;
}
void Room::feather3Timer1Expired() {
giveItem(OBJECT_IKNIFE);
loadActorStandAnim(OBJECT_KNIFE);
}
void Room::feather3PickedUpKnife() {
_awayMission->disableInput = false;
loadActorStandAnim(OBJECT_KIRK);
showDescription(TX_FEA3N010);
}
void Room::feather3LookAtSpock() {
if (!_awayMission->feather.knockedOutTlaoxac && !_awayMission->feather.tlaoxacTestPassed)
showDescription(TX_FEA3N002);
else // ENHANCEMENT: Originally did nothing here. Fall back to default behaviour in the engine.
_awayMission->rdfStillDoDefaultAction = true;
}
void Room::feather3LookAtRedshirt() {
if (_awayMission->redshirtDead)
showDescription(TX_FEA3N005);
else
showDescription(TX_FEA3N012);
}
void Room::feather3LookAtTlaoxac() {
if (_awayMission->feather.knockedOutTlaoxac)
showDescription(TX_FEA3N003);
else
showDescription(TX_FEA3N007);
}
void Room::feather3LookAtLight() {
showDescription(TX_FEA3N001);
}
void Room::feather3LookAtMccoy() {
showDescription(TX_FEA3N000);
}
void Room::feather3LookAtKnife() {
showDescription(TX_FEA3N011);
}
}
|