aboutsummaryrefslogtreecommitdiff
path: root/engines/startrek/rooms/veng4.cpp
blob: 2c3f8f2319108d81d0458f50aa1328a26a5b2cc5 (plain)
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
/* 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_BRITTANY 8
#define OBJECT_DOOR 9
#define OBJECT_HYPO 10
#define OBJECT_DRILL 11
#define OBJECT_LEFT_READINGS 12

#define HOTSPOT_DOOR 0x20
#define HOTSPOT_LEFT_BED 0x21
#define HOTSPOT_RIGHT_BED 0x22
#define HOTSPOT_LEFT_READINGS 0x23
#define HOTSPOT_RIGHT_READINGS 0x24

namespace StarTrek {

extern const RoomAction veng4ActionList[] = {
	{ {ACTION_TICK, 1, 0, 0}, &Room::veng4Tick1 },

	{ {ACTION_TALK, OBJECT_KIRK,     0, 0}, &Room::veng4TalkToKirk },
	{ {ACTION_TALK, OBJECT_MCCOY,    0, 0}, &Room::veng4TalkToMccoy },
	{ {ACTION_TALK, OBJECT_SPOCK,    0, 0}, &Room::veng4TalkToSpock },
	{ {ACTION_TALK, OBJECT_REDSHIRT, 0, 0}, &Room::veng4TalkToRedshirt },

	{ {ACTION_USE, OBJECT_IMEDKIT,  HOTSPOT_RIGHT_BED, 0}, &Room::veng4UseMccoyOnDeadGuy },
	{ {ACTION_USE, OBJECT_IMTRICOR, HOTSPOT_RIGHT_BED, 0}, &Room::veng4UseMccoyOnDeadGuy },
	{ {ACTION_USE, OBJECT_MCCOY,    HOTSPOT_RIGHT_BED, 0}, &Room::veng4UseMccoyOnDeadGuy },

	{ {ACTION_USE, OBJECT_IHYPO,    OBJECT_BRITTANY,   0}, &Room::veng4UseHypoOnBrittany },
	{ {ACTION_USE, OBJECT_IMEDKIT,  OBJECT_BRITTANY,   0}, &Room::veng4UseMedkitOnBrittany },
	{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_BRITTANY,   0}, &Room::veng4UseMTricorderOnBrittany },
	{ {ACTION_USE, OBJECT_MCCOY,    OBJECT_BRITTANY,   0}, &Room::veng4UseMTricorderOnBrittany },
	{ {ACTION_DONE_WALK, 5,                         0, 0}, &Room::veng4MccoyReachedBrittany },
	{ {ACTION_DONE_ANIM, 6,                         0, 0}, &Room::veng4UsedMedkitOnBrittany },
	{ {ACTION_DONE_ANIM, 7,                         0, 0}, &Room::veng4MccoyScannedBrittany },

	{ {ACTION_TALK, OBJECT_BRITTANY,                0, 0}, &Room::veng4TalkToBrittany },
	{ {ACTION_LOOK, HOTSPOT_RIGHT_BED,              0, 0}, &Room::veng4LookAtDeadGuy },
	{ {ACTION_LOOK, HOTSPOT_RIGHT_READINGS,         0, 0}, &Room::veng4LookAtRightBedReadings },
	{ {ACTION_LOOK, HOTSPOT_DOOR,                   0, 0}, &Room::veng4LookAtDoorHotspot },
	{ {ACTION_LOOK, OBJECT_KIRK,                    0, 0}, &Room::veng4LookAtKirk },
	{ {ACTION_LOOK, OBJECT_SPOCK,                   0, 0}, &Room::veng4LookAtSpock },
	{ {ACTION_LOOK, OBJECT_MCCOY,                   0, 0}, &Room::veng4LookAtMccoy },
	{ {ACTION_LOOK, OBJECT_REDSHIRT,                0, 0}, &Room::veng4LookAtRedshirt },
	{ {ACTION_LOOK, HOTSPOT_LEFT_BED,               0, 0}, &Room::veng4LookAtLeftBed },
	{ {ACTION_LOOK, HOTSPOT_LEFT_READINGS,          0, 0}, &Room::veng4LookAtLeftBedReadings },
	{ {ACTION_LOOK, OBJECT_BRITTANY,                0, 0}, &Room::veng4LookAtBrittany },

	{ {ACTION_USE,  OBJECT_ISTRICOR, OBJECT_DRILL, 0}, &Room::veng4LookAtDrill },
	{ {ACTION_LOOK, OBJECT_DRILL,               0, 0}, &Room::veng4LookAtDrill },
	{ {ACTION_USE,  OBJECT_ISTRICOR, OBJECT_HYPO,  0}, &Room::veng4LookAtHypo },
	{ {ACTION_LOOK, OBJECT_HYPO,                0, 0}, &Room::veng4LookAtHypo },
	{ {ACTION_LOOK, OBJECT_DOOR,                0, 0}, &Room::veng4LookAtDoorObject },
	{ {ACTION_LOOK, 0xff,                       0, 0}, &Room::veng4LookAnywhere },

	{ {ACTION_GET, OBJECT_HYPO,                 0, 0}, &Room::veng4GetHypo },
	{ {ACTION_DONE_WALK, 1,                     0, 0}, &Room::veng4ReachedHypo },
	{ {ACTION_DONE_ANIM, 2,                     0, 0}, &Room::veng4PickedUpHypo },

	{ {ACTION_GET, OBJECT_DRILL,                0, 0}, &Room::veng4GetDrill },
	{ {ACTION_DONE_WALK, 3,                     0, 0}, &Room::veng4ReachedDrill },
	{ {ACTION_DONE_ANIM, 4,                     0, 0}, &Room::veng4PickedUpDrill },

	{ {ACTION_TOUCHED_HOTSPOT, 0, 0, 0}, &Room::veng4TouchedHotspot0 },
	{ {ACTION_WALK, OBJECT_DOOR,  0, 0}, &Room::veng4WalkToDoor },
	{ {ACTION_WALK, HOTSPOT_DOOR, 0, 0}, &Room::veng4WalkToDoor },

	// ENHANCEMENT (let object count for the "look" action, not just the hotspot)
	{ {ACTION_LOOK, OBJECT_LEFT_READINGS, 0, 0}, &Room::veng4LookAtLeftBedReadings },
};

extern const int veng4NumActions = ARRAYSIZE(veng4ActionList);


#define DOOR_X 0x13f
#define DOOR_Y 0xab

#define BRITTANY_X 0x5a
#define BRITTANY_Y 0xa5

#define LEFT_READINGS_X 0x5c
#define LEFT_READINGS_Y 0x75

void Room::veng4Tick1() {
	playMidiMusicTracks(MIDITRACK_31);

	loadActorAnim2(OBJECT_DOOR,  "s9r1dc", DOOR_X, DOOR_Y);
	loadActorAnim2(OBJECT_LEFT_READINGS, "s7r4m2", LEFT_READINGS_X, LEFT_READINGS_Y);

	if (!_awayMission->veng.usedMedkitOnBrittany) {
		loadActorAnim2(OBJECT_BRITTANY, "s9r1bm", BRITTANY_X, BRITTANY_Y);
		playVoc("VEN4LOOP");
	} else {
		playVoc("VE42LOOP");
		loadActorAnim2(OBJECT_BRITTANY, "s9r1bh", BRITTANY_X, BRITTANY_Y);
	}

	if (!_awayMission->veng.tookHypoFromSickbay)
		loadActorAnim2(OBJECT_HYPO, "s7r4h1", 0xea, 0x8b);
	if (!_awayMission->veng.tookDrillFromSickbay)
		loadActorAnim2(OBJECT_DRILL, "s7r4dl", 0xea, 0x87);

	if (_awayMission->veng.brittanyDead) {
		loadActorAnim2(OBJECT_BRITTANY, "s7r4bd", BRITTANY_X, BRITTANY_Y);
		loadActorAnim2(OBJECT_LEFT_READINGS, "s7r4m1d",  LEFT_READINGS_X, LEFT_READINGS_Y);
	}
}

void Room::veng4TalkToKirk() {
	showText(TX_SPEAKER_KIRK, TX_VEN4_002);
}

void Room::veng4TalkToMccoy() {
	showText(TX_SPEAKER_MCCOY, TX_VEN4_015);
}

void Room::veng4TalkToSpock() {
	showText(TX_SPEAKER_SPOCK, TX_VEN4_017);
}

void Room::veng4TalkToRedshirt() {
	showText(TX_SPEAKER_KIJE, TX_VEN4_022);
}

void Room::veng4UseMccoyOnDeadGuy() {
	showText(TX_SPEAKER_MCCOY, TX_VEN4_007);
}

void Room::veng4UseHypoOnBrittany() {
	showText(TX_SPEAKER_MCCOY, TX_VEN4_008);
}

void Room::veng4UseMedkitOnBrittany() {
	_roomVar.veng.usingMedkitOnBrittany = true;
	veng4UseMccoyOnBrittany();
}

void Room::veng4UseMTricorderOnBrittany() {
	_roomVar.veng.usingMedkitOnBrittany = false;
	veng4UseMccoyOnBrittany();
}

void Room::veng4UseMccoyOnBrittany() {
	if (_awayMission->veng.brittanyDead)
		showText(TX_SPEAKER_MCCOY, TX_VEN4_013);
	else if (_awayMission->veng.usedMedkitOnBrittany)
		showText(TX_SPEAKER_MCCOY, TX_VEN4_009);
	else {
		if (!_awayMission->veng.lookedAtBrittany) {
			_awayMission->veng.lookedAtBrittany = true;
			showText(TX_SPEAKER_KIRK, TX_VEN4_005);
		}
		_awayMission->crewDirectionsAfterWalk[OBJECT_MCCOY] = DIR_E;
		walkCrewmanC(OBJECT_MCCOY, 0x3c, 0xa0, &Room::veng4MccoyReachedBrittany);
	}
}

void Room::veng4MccoyReachedBrittany() {
	if (!_roomVar.veng.usingMedkitOnBrittany) {
		loadActorAnimC(OBJECT_MCCOY, "mscane", -1, -1, &Room::veng4MccoyScannedBrittany);
		playSoundEffectIndex(SND_TRICORDER);
	} else {
		loadActorAnimC(OBJECT_MCCOY, "museme", -1, -1, &Room::veng4UsedMedkitOnBrittany);
	}
}

void Room::veng4UsedMedkitOnBrittany() {
	loadActorAnim2(OBJECT_BRITTANY, "s9r1bh");
	_awayMission->veng.getPointsForHealingBrittany = true;
	_awayMission->veng.usedMedkitOnBrittany = true;
	_awayMission->veng.kirkShouldSuggestReestablishingPower = true;
	showText(TX_SPEAKER_MCCOY, TX_VEN4_009);
}

void Room::veng4MccoyScannedBrittany() {
	showText(TX_SPEAKER_MCCOY, TX_VEN4_011);
	showText(TX_SPEAKER_KIRK,  TX_VEN4_001);

	_roomVar.veng.usingMedkitOnBrittany = true;
	veng4UseMccoyOnBrittany();
}

void Room::veng4TalkToBrittany() {
	if (_awayMission->veng.talkedToBrittany)
		showText(TX_SPEAKER_MCCOY, TX_VEN4_012);
	else if (!_awayMission->veng.usedMedkitOnBrittany)
		showText(TX_SPEAKER_MCCOY, TX_VEN4_010);
	else {
		_awayMission->veng.talkedToBrittany = true;
		showText(TX_SPEAKER_BRITTANY_MARATA, TX_VEN4_019);
		showText(TX_SPEAKER_KIRK,            TX_VEN4_004);
		showText(TX_SPEAKER_BRITTANY_MARATA, TX_VEN4_020);
		showText(TX_SPEAKER_KIRK,            TX_VEN4_006);
		showText(TX_SPEAKER_BRITTANY_MARATA, TX_VEN4_021);
		showText(TX_SPEAKER_KIRK,            TX_VEN4_003);

		loadActorAnim2(OBJECT_BRITTANY, "s9r1bm", BRITTANY_X, BRITTANY_Y);
		showText(TX_SPEAKER_MCCOY, TX_VEN4_016);
		loadActorAnim2(OBJECT_LEFT_READINGS, "s7r4m1", LEFT_READINGS_X, LEFT_READINGS_Y);
		loadActorAnim2(OBJECT_BRITTANY, "s7r4bd", BRITTANY_X, BRITTANY_Y);
		_awayMission->veng.brittanyDead = true;
		stopAllVocSounds();
		playVoc("VE42LOOP");
	}
}

void Room::veng4LookAtDeadGuy() {
	showText(TX_VEN4N014);
}

void Room::veng4LookAtRightBedReadings() {
	showText(TX_VEN4N013);
}

void Room::veng4LookAtDoorHotspot() {
	showText(TX_VEN4N008);
}

void Room::veng4LookAtKirk() {
	showText(TX_VEN4N002);
}

void Room::veng4LookAtSpock() {
	showText(TX_SPEAKER_SPOCK, TX_VEN4N003);
}

void Room::veng4LookAtMccoy() {
	showText(TX_SPEAKER_MCCOY, TX_VEN4N000);
}

void Room::veng4LookAtRedshirt() {
	showText(TX_SPEAKER_KIJE, TX_VEN4N001);
}

void Room::veng4LookAtLeftBed() {
	if (_awayMission->veng.brittanyDead) {
		// ENHANCEMENT: Original game showed a string with no corresponding audio ("This
		// bed contains the body of a recently deceaced crewman." Yes that's a typo.)
		// Instead, show some appropriate voiced text.
		showText(TX_VEN4N017);
	} else
		showText(TX_VEN4N007);
}

void Room::veng4LookAtLeftBedReadings() {
	if (!_awayMission->veng.brittanyDead)
		showText(TX_VEN4N006);
	else
		showText(TX_VEN4N005);
}

void Room::veng4LookAtBrittany() {
	if (_awayMission->veng.brittanyDead)
		showText(TX_VEN4N017);
	else if (!_awayMission->veng.lookedAtBrittany) {
		_awayMission->veng.lookedAtBrittany = true;
		showText(TX_SPEAKER_KIRK,  TX_VEN4_005);
		showText(TX_SPEAKER_MCCOY, TX_VEN4_014);
	} else if (_awayMission->veng.talkedToBrittany)
		showText(TX_VEN4N017);
	else
		showText(TX_VEN4N004);
}

void Room::veng4LookAtDrill() {
	showText(TX_VEN4N012);
}

void Room::veng4LookAtHypo() {
	showText(TX_VEN4N010);
}

void Room::veng4LookAtDoorObject() {
	showText(TX_VEN4N009);
}

void Room::veng4LookAnywhere() {
	showText(TX_VEN4N011);
}

void Room::veng4GetHypo() {
	_awayMission->disableInput = true;
	walkCrewmanC(OBJECT_KIRK, 0xea, 0xae, &Room::veng4ReachedHypo);
}

void Room::veng4ReachedHypo() {
	loadActorAnimC(OBJECT_KIRK, "kusemn", -1, -1, &Room::veng4PickedUpHypo);
}

void Room::veng4PickedUpHypo() {
	giveItem(OBJECT_IHYPO);
	_awayMission->veng.tookHypoFromSickbay = true;
	loadActorStandAnim(OBJECT_HYPO);
	showText(TX_VEN4N015);
	walkCrewman(OBJECT_KIRK, 0xcd, 0xc2);
	_awayMission->disableInput = false;
}

void Room::veng4GetDrill() {
	_awayMission->disableInput = true;
	walkCrewmanC(OBJECT_KIRK, 0xea, 0xae, &Room::veng4ReachedDrill);
}

void Room::veng4ReachedDrill() {
	loadActorAnimC(OBJECT_KIRK, "kusemn", -1, -1, &Room::veng4PickedUpDrill);
}

void Room::veng4PickedUpDrill() {
	giveItem(OBJECT_IDRILL);
	_awayMission->veng.tookDrillFromSickbay = true;
	loadActorStandAnim(OBJECT_DRILL);
	showText(TX_VEN4N016);
	walkCrewman(OBJECT_KIRK, 0xcd, 0xc2);
	_awayMission->disableInput = false;
}

void Room::veng4TouchedHotspot0() { // Trigger door opening
	if (_roomVar.veng.walkingToDoor) {
		playSoundEffectIndex(SND_DOOR1);
		loadActorAnim(OBJECT_DOOR, "s9r1do", DOOR_X, DOOR_Y);
	}
}

void Room::veng4WalkToDoor() {
	_roomVar.veng.walkingToDoor = true;
	_awayMission->disableInput = true;
	walkCrewman(OBJECT_KIRK, 0x12e, 0xab);
}

}