1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #include "startrek/room.h"
24 
25 #define OBJECT_CABLE 8
26 #define OBJECT_DEAD_GUY 9
27 #define OBJECT_DOOR 10
28 
29 #define HOTSPOT_DOOR 0x20
30 #define HOTSPOT_COLLAPSED_SECTION 0x21
31 
32 namespace StarTrek {
33 
34 extern const RoomAction veng7ActionList[] = {
35 	{ {ACTION_TICK, 1, 0, 0}, &Room::veng7Tick1 },
36 
37 	{ {ACTION_WALK, OBJECT_DOOR,  0, 0}, &Room::veng7WalkToDoor },
38 	{ {ACTION_WALK, HOTSPOT_DOOR, 0, 0}, &Room::veng7WalkToDoor },
39 	{ {ACTION_DONE_WALK, 2,       0, 0}, &Room::veng7ReachedDoor },
40 	{ {ACTION_DONE_ANIM, 1,       0, 0}, &Room::veng7DoorOpened },
41 	{ {ACTION_TOUCHED_WARP, 1,    0, 0}, &Room::veng7TouchedTurboliftDoor },
42 
43 	{ {ACTION_LOOK, HOTSPOT_COLLAPSED_SECTION, 0, 0}, &Room::veng7LookAtCollapsedSection },
44 	{ {ACTION_LOOK, OBJECT_DEAD_GUY,           0, 0}, &Room::veng7LookAtDeadGuy },
45 	{ {ACTION_LOOK, OBJECT_DOOR,               0, 0}, &Room::veng7LookAtDoor },
46 	{ {ACTION_LOOK, HOTSPOT_DOOR,              0, 0}, &Room::veng7LookAtDoor },
47 	{ {ACTION_LOOK, OBJECT_CABLE,              0, 0}, &Room::veng7LookAtCable },
48 	{ {ACTION_LOOK, OBJECT_KIRK,               0, 0}, &Room::veng7LookAtKirk },
49 	{ {ACTION_LOOK, OBJECT_SPOCK,              0, 0}, &Room::veng7LookAtSpock },
50 	{ {ACTION_LOOK, OBJECT_MCCOY,              0, 0}, &Room::veng7LookAtMccoy },
51 	{ {ACTION_LOOK, OBJECT_REDSHIRT,           0, 0}, &Room::veng7LookAtRedshirt },
52 	{ {ACTION_LOOK, 0xff,                      0, 0}, &Room::veng7LookAnywhere },
53 	{ {ACTION_TALK, OBJECT_KIRK,               0, 0}, &Room::veng7TalkToKirk },
54 	{ {ACTION_TALK, OBJECT_SPOCK,              0, 0}, &Room::veng7TalkToSpock },
55 	{ {ACTION_TALK, OBJECT_MCCOY,              0, 0}, &Room::veng7TalkToMccoy },
56 	{ {ACTION_TALK, OBJECT_REDSHIRT,           0, 0}, &Room::veng7TalkToRedshirt },
57 
58 	{ {ACTION_USE, OBJECT_ISTRICOR, HOTSPOT_COLLAPSED_SECTION, 0}, &Room::veng7UseSTricorderOnCollapsedSection },
59 
60 	{ {ACTION_TOUCHED_HOTSPOT, 0, 0, 0}, &Room::veng7TouchedHotspot0 },
61 	{ {ACTION_GET, OBJECT_CABLE,  0, 0}, &Room::veng7GetCable },
62 	{ {ACTION_DONE_WALK, 3,       0, 0}, &Room::veng7ReachedCable },
63 	{ {ACTION_DONE_ANIM, 4,       0, 0}, &Room::veng7PickedUpCable },
64 
65 	// Common code
66 	{ {ACTION_TICK, 0xff, 0xff, 0xff}, &Room::vengaTick },
67 	{ {ACTION_USE, OBJECT_IPHASERS, 0xff,     0}, &Room::vengaUsePhaserAnywhere },
68 	{ {ACTION_USE, OBJECT_IPHASERK, 0xff,     0}, &Room::vengaUsePhaserAnywhere },
69 	{ {ACTION_LOOK, OBJECT_IHYPO,          0, 0}, &Room::vengaLookAtHypo },
70 	{ {ACTION_USE, OBJECT_ICOMM, OBJECT_KIRK, 0}, &Room::vengaUseCommunicator },
71 	{ {ACTION_USE, OBJECT_IMEDKIT,  OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
72 	{ {ACTION_USE, OBJECT_IMTRICOR, OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
73 	{ {ACTION_USE, OBJECT_MCCOY,    OBJECT_DEAD_GUY, 0}, &Room::vengaUseMccoyOnDeadGuy },
74 	{ {ACTION_LIST_END, 0, 0, 0}, nullptr }
75 };
76 
77 enum veng7TextIds {
78 	TX_SPEAKER_KIRK, TX_SPEAKER_MCCOY, TX_SPEAKER_SPOCK, TX_SPEAKER_KIJE,
79 	TX_BRIDU146, TX_DEM3_019, TX_MUD4_018, TX_VEN0N016, TX_VEN0_016,
80 	TX_VEN1_004, TX_VEN2U093, TX_VEN2_028, TX_VEN2_066,
81 	TX_VEN2_098, TX_VEN4N010, TX_VEN4_016, TX_VEN6N007, TX_VEN7N001,
82 	TX_VEN7N002, TX_VEN7N003, TX_VEN7N004, TX_VEN7N005, TX_VEN7N006,
83 	TX_VEN7N007, TX_VEN7N008, TX_VEN7N009, TX_VEN7_001, TX_VEN7_003,
84 	TX_VEN7_005, TX_VEN7_006, TX_VEN7_007, TX_VENA_F32, TX_VENA_F34,
85 	TX_VENA_F40
86 };
87 
88 // TODO: Finish floppy offsets
89 extern const RoomTextOffsets veng7TextOffsets[] = {
90 	{ TX_SPEAKER_KIRK, 4142, 0 },
91 	{ TX_SPEAKER_MCCOY, 4153, 0 },
92 	{ TX_SPEAKER_SPOCK, 4163, 0 },
93 	{ TX_SPEAKER_KIJE, 4173, 0 },
94 	{ TX_BRIDU146, 3179, 0 },
95 	{ TX_DEM3_019, 3663, 0 },
96 	{ TX_MUD4_018, 3110, 0 },
97 	{ TX_MUD4_018, 3243, 0 },
98 	{ TX_VEN0N016, 708, 0 },
99 	{ TX_VEN0_016, 3959, 0 },
100 	//{ TX_VEN0_016, 3900, 0 },	// Skip duplicate text
101 	{ TX_VEN1_004, 1460, 0 },
102 	{ TX_VEN2U093, 3311, 0 },
103 	{ TX_VEN2_028, 3418, 0 },
104 	{ TX_VEN2_066, 3496, 0 },
105 	{ TX_VEN2_098, 2306, 0 },
106 	{ TX_VEN4N010, 2960, 0 },
107 	{ TX_VEN4_016, 3714, 0 },
108 	{ TX_VEN6N007, 3025, 0 },
109 	{ TX_VEN7N001, 525, 0 },
110 	{ TX_VEN7N002, 1071, 0 },
111 	{ TX_VEN7N003, 928, 0 },
112 	{ TX_VEN7N004, 1023, 0 },
113 	{ TX_VEN7N005, 976, 0 },
114 	{ TX_VEN7N006, 1117, 0 },
115 	{ TX_VEN7N007, 767, 0 },
116 	{ TX_VEN7N008, 841, 0 },
117 	{ TX_VEN7N009, 2161, 0 },
118 	{ TX_VEN7_001, 1195, 0 },
119 	{ TX_VEN7_003, 1902, 0 },
120 	{ TX_VEN7_005, 1320, 0 },
121 	{ TX_VEN7_006, 1706, 0 },
122 	{ TX_VEN7_007, 1576, 0 },
123 	{ TX_VENA_F32, 2536, 0 },
124 	{ TX_VENA_F34, 2806, 0 },
125 	{ TX_VENA_F40, 2401, 0 },
126 	{          -1, 0,    0 }
127 };
128 
129 extern const RoomText veng7Texts[] = {
130 	  { -1, Common::UNK_LANG, "" }
131 };
132 
veng7Tick1()133 void Room::veng7Tick1() {
134 	playVoc("VEN7LOOP");
135 
136 	loadActorAnim(OBJECT_DOOR, "s7r7d1c", 0x59, 0x72);
137 
138 	if (!_awayMission->veng.tookCableFromTransporterRoomHallway)
139 		loadActorAnim(OBJECT_CABLE, "s7r7ca", 0xac, 0x8a);
140 
141 	loadActorAnim(OBJECT_DEAD_GUY, "s7r7c1", 0xa6, 0x49);
142 }
143 
veng7WalkToDoor()144 void Room::veng7WalkToDoor() {
145 	walkCrewmanC(OBJECT_KIRK, 0x66, 0x76, &Room::veng7ReachedDoor);
146 }
147 
veng7ReachedDoor()148 void Room::veng7ReachedDoor() {
149 	_awayMission->disableInput = true;
150 	playSoundEffectIndex(kSfxDoor);
151 	loadActorAnimC(OBJECT_DOOR, "s7r7d1", 0x59, 0x72, &Room::veng7DoorOpened);
152 }
153 
veng7DoorOpened()154 void Room::veng7DoorOpened() {
155 	walkCrewman(OBJECT_KIRK, 0x5b, 0x76);
156 }
157 
veng7TouchedTurboliftDoor()158 void Room::veng7TouchedTurboliftDoor() {
159 	playSoundEffectIndex(kSfxDoor);
160 	showRepublicMap(7, 1);
161 }
162 
veng7LookAtCollapsedSection()163 void Room::veng7LookAtCollapsedSection() {
164 	showDescription(TX_VEN7N001);
165 }
166 
veng7LookAtDeadGuy()167 void Room::veng7LookAtDeadGuy() {
168 	// ENHANCEMENT: Original played TX_VEN0N016. This is reused and boring, and there is
169 	// a more interesting unused audio file, so use that instead.
170 	//showDescription(TX_VEN7N000);
171 	showDescription(TX_VEN0N016);
172 }
173 
veng7LookAtDoor()174 void Room::veng7LookAtDoor() {
175 	showDescription(TX_VEN7N007);
176 }
177 
veng7LookAtCable()178 void Room::veng7LookAtCable() {
179 	showDescription(TX_VEN7N008);
180 }
181 
veng7LookAtKirk()182 void Room::veng7LookAtKirk() {
183 	showDescription(TX_VEN7N003);
184 }
185 
veng7LookAtSpock()186 void Room::veng7LookAtSpock() {
187 	showDescription(TX_VEN7N005);
188 }
189 
veng7LookAtMccoy()190 void Room::veng7LookAtMccoy() {
191 	showDescription(TX_VEN7N004);
192 }
193 
veng7LookAtRedshirt()194 void Room::veng7LookAtRedshirt() {
195 	showDescription(TX_VEN7N002);
196 }
197 
veng7LookAnywhere()198 void Room::veng7LookAnywhere() {
199 	showDescription(TX_VEN7N006);
200 }
201 
veng7TalkToKirk()202 void Room::veng7TalkToKirk() {
203 	showText(TX_SPEAKER_KIRK, TX_VEN7_001);
204 }
205 
veng7TalkToSpock()206 void Room::veng7TalkToSpock() {
207 	showText(TX_SPEAKER_SPOCK, TX_VEN7_005);
208 }
209 
veng7TalkToMccoy()210 void Room::veng7TalkToMccoy() {
211 	// NOTE: TX_VEN7_007 could also fit here. It might be more fitting since it's not
212 	// reused. However, it mentions that McCoy gave up medical practice in Georgia. Maybe
213 	// they removed this for continuity reasons or something. I don't want to be
214 	// responsible for creating any possible confusion over his backstory.
215 	showText(TX_SPEAKER_MCCOY, TX_VEN1_004);
216 }
217 
veng7TalkToRedshirt()218 void Room::veng7TalkToRedshirt() {
219 	showText(TX_SPEAKER_KIJE, TX_VEN7_007);
220 }
221 
veng7UseSTricorderOnCollapsedSection()222 void Room::veng7UseSTricorderOnCollapsedSection() {
223 	spockScan(DIR_S, TX_SPEAKER_SPOCK, TX_VEN7_006);
224 }
225 
veng7TouchedHotspot0()226 void Room::veng7TouchedHotspot0() { // Got too close to the collapsed section
227 	showText(TX_SPEAKER_SPOCK, TX_VEN7_003);
228 }
229 
veng7GetCable()230 void Room::veng7GetCable() {
231 	_awayMission->disableInput = true;
232 	walkCrewmanC(OBJECT_KIRK, 0xac, 0x8b, &Room::veng7ReachedCable);
233 }
234 
veng7ReachedCable()235 void Room::veng7ReachedCable() {
236 	loadActorAnimC(OBJECT_KIRK, "kusehn", -1, -1, &Room::veng7PickedUpCable);
237 	playVoc("MUR4E6");
238 }
239 
veng7PickedUpCable()240 void Room::veng7PickedUpCable() {
241 	loadActorStandAnim(OBJECT_CABLE);
242 	showDescription(TX_VEN7N009);
243 	giveItem(OBJECT_ICABLE1);
244 	_awayMission->veng.tookCableFromTransporterRoomHallway = true;
245 	_awayMission->disableInput = false;
246 }
247 
248 }
249