|  | 
| 20 | 20 |  */ | 
| 21 | 21 | 
 | 
| 22 | 22 | #include "m4/riddle/rooms/section8/room806.h" | 
|  | 23 | + | 
|  | 24 | +#include "m4/adv_r/adv_file.h" | 
| 23 | 25 | #include "m4/graphics/gr_series.h" | 
|  | 26 | +#include "m4/riddle/riddle.h" | 
| 24 | 27 | #include "m4/riddle/vars.h" | 
| 25 | 28 | 
 | 
| 26 | 29 | namespace M4 { | 
| 27 | 30 | namespace Riddle { | 
| 28 | 31 | namespace Rooms { | 
| 29 | 32 | 
 | 
|  | 33 | +void Room806::preload() { | 
|  | 34 | +	_G(player).walker_type = WALKER_ALT; | 
|  | 35 | +	_G(player).shadow_type = SHADOW_ALT; | 
|  | 36 | +} | 
|  | 37 | + | 
| 30 | 38 | void Room806::init() { | 
|  | 39 | +	_unkVar1 = 1; | 
|  | 40 | +	_unkVar2 = 0; | 
|  | 41 | + | 
|  | 42 | +	_806rp03Series = series_load("806RP03", -1, nullptr); | 
|  | 43 | +	_ripKneelAndExamineWallSeries = series_load("RIP KNEEL AND EXAMINE WALL", -1, nullptr); | 
|  | 44 | +	_ripTrekLookDownPos3Series = series_load("RIP TREK LOOK DOWN POS3", -1, nullptr); | 
|  | 45 | +	_ripLookUpPos3Series = series_load("RIP LOOKS UP POS3", -1, nullptr); | 
|  | 46 | +	_ripMedHighReacherPos2Series = series_load("RIP MED HIGH REACHER POS2", -1, nullptr); | 
|  | 47 | +	_ripHighReacherPos2Series = series_load("RIP HIGH REACHER POS2", -1, nullptr); | 
|  | 48 | +	_ripTrekTalkerPos3Series = series_load("RIP TREK TALKER POS3", -1, nullptr); | 
|  | 49 | +	_ripTrekHandTalkPos3Series = series_load("RIP TREK HAND TALK POS3", -1, nullptr); | 
|  | 50 | +	_ripTrekHeadTurnPos3Series = series_load("RIP TREK HEAD TURN POS3", -1, nullptr); | 
|  | 51 | +	_meiTalkPos3Series = series_load("MEI TALKS POS3", -1, nullptr); | 
|  | 52 | +	_meiTrekHeadTurnPos3Series = series_load("MEI TREK HEAD TURN POS3", -1, nullptr); | 
|  | 53 | +	_ripPos3LookAroundSeries = series_load("RIP POS 3 LOOK AROUND", -1, nullptr); | 
|  | 54 | +	_meiTrekHandsOnHipsPos3Series = series_load("MEI TREK HANDS ON HIPS POS3", -1, nullptr); | 
|  | 55 | + | 
|  | 56 | +	series_play("LIT URN 1 ", 32767, 0, -1, 7, -1, 100, 0, 0, 0, -1); | 
|  | 57 | +	series_play("LIT URN 2", 32767, 0, -1, 7, -1, 100, 0, 0, 0, -1); | 
|  | 58 | + | 
|  | 59 | +	if (!_G(flags[V265])) | 
|  | 60 | +		series_play("806 flash light flicker", 32767, 0, -1, 7, 2, 100, 0, 0, 0, -1); | 
|  | 61 | + | 
|  | 62 | +	if (inv_object_is_here("CRANK")) { | 
|  | 63 | +		_806CrankMach = series_show("806CRANK", 32767, 16, -1, -1, 0, 100, 0, 0); | 
|  | 64 | +		hotspot_set_active(_G(currentSceneDef).hotspots, "SLOT", false); | 
|  | 65 | +	} else { | 
|  | 66 | +		hotspot_set_active(_G(currentSceneDef).hotspots, "CRANK", false); | 
|  | 67 | +	} | 
|  | 68 | + | 
|  | 69 | +	if (_G(flags[V270]) == 806) { | 
|  | 70 | +		hotspot_set_active(_G(currentSceneDef).hotspots, "CHARIOT", false); | 
|  | 71 | +	} else { | 
|  | 72 | +		digi_stop(2); | 
|  | 73 | +		digi_unload("950_s33"); | 
|  | 74 | +		_806ChartMach = series_show("806chart", 3840, 16, -1, -1, 0, 100, 0, 0); | 
|  | 75 | +		kernel_load_variant("806lock1"); | 
|  | 76 | +		digi_preload("806r20", -1); | 
|  | 77 | +	} | 
|  | 78 | + | 
|  | 79 | +	if (_G(flags[V266])) { | 
|  | 80 | +		series_show("806BOLTS", 32767, 16, -1, -1, 0, 100, 0, 0); | 
|  | 81 | +	} else { | 
|  | 82 | +		_806rp02Series = series_load("806RP02", -1, nullptr); | 
|  | 83 | +		_806mc02Series = series_load("806MC02", -1, nullptr); | 
|  | 84 | + | 
|  | 85 | +		hotspot_set_active(_G(currentSceneDef).hotspots, "CROSSBOW BOLT  ", false); | 
|  | 86 | +		digi_preload("806m08", -1); | 
|  | 87 | +		digi_preload("806_s01", -1); | 
|  | 88 | +		digi_preload("950_s52", -1); | 
|  | 89 | +		digi_preload("950_s53", -1); | 
|  | 90 | +	} | 
|  | 91 | + | 
|  | 92 | +	if (_G(flags[V276]) == 0) { | 
|  | 93 | +		ws_walk_load_walker_series(S8_SHADOW_DIRS1, S8_SHADOW_NAMES1); | 
|  | 94 | +		ws_walk_load_walker_series(S8_SHADOW_DIRS2, S8_SHADOW_NAMES2); | 
|  | 95 | +	} | 
|  | 96 | + | 
|  | 97 | +	switch (_G(game).previous_room) { | 
|  | 98 | +	case KERNEL_RESTORING_GAME: | 
|  | 99 | +		digi_preload("950_s29", -1); | 
|  | 100 | +		if (_G(flags[V276])) { | 
|  | 101 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", false); | 
|  | 102 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", false); | 
|  | 103 | +		} else { | 
|  | 104 | +			if (_unkVar3) { | 
|  | 105 | +				_mcTrekMach = triggerMachineByHash_3000(8, 4, *S8_SHADOW_DIRS2, *S8_SHADOW_DIRS1, 624, 306, 9, triggerMachineByHashCallback3000, "mc_trek"); | 
|  | 106 | +				hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", false); | 
|  | 107 | +				hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", true); | 
|  | 108 | +			} else { | 
|  | 109 | +				_mcTrekMach = triggerMachineByHash_3000(8, 4, *S8_SHADOW_DIRS2, *S8_SHADOW_DIRS1, 225, 306, 3, triggerMachineByHashCallback3000, "mc_trek"); | 
|  | 110 | +				hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", false); | 
|  | 111 | +				hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", true); | 
|  | 112 | +			} | 
|  | 113 | + | 
|  | 114 | +			if (!player_been_here(809)) | 
|  | 115 | +				kernel_timing_trigger(imath_ranged_rand(1200, 1800), 201, nullptr); | 
|  | 116 | + | 
|  | 117 | +			kernel_timing_trigger(imath_ranged_rand(1200, 1800), 701, nullptr); | 
|  | 118 | +		} | 
|  | 119 | + | 
|  | 120 | +		_unkVar1 = 0; | 
|  | 121 | + | 
|  | 122 | +		break; | 
|  | 123 | + | 
|  | 124 | +	case 805: | 
|  | 125 | +		if (!_G(flags[V265])) { | 
|  | 126 | +			_806rp01Series = series_load("806RP01", -1, nullptr); | 
|  | 127 | +			_806mc01Series = series_load("806MC01", -1, nullptr); | 
|  | 128 | +			digi_preload("806m01"); | 
|  | 129 | +			digi_preload("806r01"); | 
|  | 130 | +			digi_preload("806m02"); | 
|  | 131 | +			digi_preload("806r02"); | 
|  | 132 | +			digi_preload("806m03"); | 
|  | 133 | +			digi_preload("806r03"); | 
|  | 134 | +		} | 
|  | 135 | + | 
|  | 136 | +		player_set_commands_allowed(false); | 
|  | 137 | +		ws_demand_facing(_G(my_walker), 3); | 
|  | 138 | +		ws_demand_location(_G(my_walker), -30, 316); | 
|  | 139 | + | 
|  | 140 | +		if (_G(flags[V276])) { | 
|  | 141 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", false); | 
|  | 142 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", false); | 
|  | 143 | +		} else { | 
|  | 144 | +			_mcTrekMach = triggerMachineByHash_3000(8, 4, *S8_SHADOW_DIRS2, *S8_SHADOW_DIRS1, -60, 306, 3, triggerMachineByHashCallback3000, "mc_trek"); | 
|  | 145 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", false); | 
|  | 146 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", true); | 
|  | 147 | +			_unkVar3 = 0; | 
|  | 148 | +		} | 
|  | 149 | + | 
|  | 150 | +		if (_G(flags[V270]) == 806) { | 
|  | 151 | +			terminateMachine(_806ChartMach); | 
|  | 152 | +			_806ChartMach = series_show("806chart", 1536, 16, -1, -1, 0, 100, 0, 0); | 
|  | 153 | +			if (!_G(flags[V265])) { | 
|  | 154 | +				ws_walk(_G(my_walker), 221, 316, nullptr, 12001, 3, true); | 
|  | 155 | +			} else { | 
|  | 156 | +				if (!player_been_here(809)) | 
|  | 157 | +					kernel_timing_trigger(imath_ranged_rand(1200, 1800), 201, nullptr); | 
|  | 158 | + | 
|  | 159 | +				kernel_timing_trigger(imath_ranged_rand(1200, 1800), 701, nullptr); | 
|  | 160 | +			} | 
|  | 161 | + | 
|  | 162 | +			if (!_G(flags[V276])) | 
|  | 163 | +				sendWSMessage_10000(_mcTrekMach, 30, 296, 0, 501, 1); | 
|  | 164 | + | 
|  | 165 | +		} else if (!_G(flags[V265])) { | 
|  | 166 | +			sendWSMessage_10000(_mcTrekMach, 225, 306, 3, 101, 1); | 
|  | 167 | +			ws_walk(221, 316, nullptr, 12001, 3, true); | 
|  | 168 | +		} else { | 
|  | 169 | +			if (!_G(flags[V276])) | 
|  | 170 | +				sendWSMessage_10000(_mcTrekMach, 225, 306, 3, -1, 1); | 
|  | 171 | + | 
|  | 172 | +			ws_walk(221, 316, nullptr, 999, 3, true); | 
|  | 173 | + | 
|  | 174 | +			if (!_G(flags[V276])) { | 
|  | 175 | +				if (!player_been_here(809)) | 
|  | 176 | +					kernel_timing_trigger(imath_ranged_rand(1200, 1800), 201, nullptr); | 
|  | 177 | + | 
|  | 178 | +				kernel_timing_trigger(imath_ranged_rand(1200, 1800), 701, nullptr); | 
|  | 179 | +			} | 
|  | 180 | +		} | 
|  | 181 | +		break; | 
|  | 182 | + | 
|  | 183 | +	case 807: | 
|  | 184 | +		player_set_commands_allowed(false); | 
|  | 185 | +		ws_demand_facing(_G(my_walker), 9); | 
|  | 186 | +		ws_demand_location(_G(my_walker), 670, 315); | 
|  | 187 | +		ws_walk(_G(my_walker), 594, 315, nullptr, 999, 9, true); | 
|  | 188 | +		if (_G(flags[V276])) { | 
|  | 189 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", false); | 
|  | 190 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", false); | 
|  | 191 | +		} else { | 
|  | 192 | +			_mcTrekMach = triggerMachineByHash_3000(8, 4, *S8_SHADOW_DIRS2, *S8_SHADOW_DIRS1, 710, 306, 9, triggerMachineByHashCallback3000, "mc_trek"); | 
|  | 193 | +			sendWSMessage_10000(_mcTrekMach, 624, 306, 9, -1, 1); | 
|  | 194 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", true); | 
|  | 195 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", false); | 
|  | 196 | + | 
|  | 197 | +			if (!player_been_here(809)) | 
|  | 198 | +				kernel_timing_trigger(imath_ranged_rand(1200, 1800), 201, nullptr); | 
|  | 199 | + | 
|  | 200 | +			kernel_timing_trigger(imath_ranged_rand(1200, 1800), 701, nullptr); | 
|  | 201 | +		} | 
|  | 202 | + | 
|  | 203 | +		break; | 
|  | 204 | + | 
|  | 205 | +	default: | 
|  | 206 | +		digi_preload("950_s29", -1); | 
|  | 207 | +		ws_demand_facing(_G(my_walker), 3); | 
|  | 208 | +		ws_demand_location(_G(my_walker), 221, 316); | 
|  | 209 | +		if (_G(flags[V276])) { | 
|  | 210 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", true); | 
|  | 211 | +			hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", false); | 
|  | 212 | +			_unkVar1 = 0; | 
|  | 213 | +		} else { | 
|  | 214 | +			if (_unkVar3) { | 
|  | 215 | +				_mcTrekMach = triggerMachineByHash_3000(8, 4, *S8_SHADOW_DIRS2, *S8_SHADOW_DIRS1, 624, 306, 9, triggerMachineByHashCallback3000, "mc_trek"); | 
|  | 216 | +				hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", false); | 
|  | 217 | +				hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", true); | 
|  | 218 | +			} else { | 
|  | 219 | +				_mcTrekMach = triggerMachineByHash_3000(8, 4, *S8_SHADOW_DIRS2, *S8_SHADOW_DIRS1, 225, 306, 3, triggerMachineByHashCallback3000, "mc_trek"); | 
|  | 220 | +				hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", false); | 
|  | 221 | +				hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", true); | 
|  | 222 | +			} | 
|  | 223 | + | 
|  | 224 | +			if (!player_been_here(806)) | 
|  | 225 | +				kernel_timing_trigger(imath_ranged_rand(1200, 1800), 201, nullptr); | 
|  | 226 | + | 
|  | 227 | +			kernel_timing_trigger(imath_ranged_rand(1200, 1800), 701, nullptr); | 
|  | 228 | +		} | 
|  | 229 | + | 
|  | 230 | +		_unkVar1 = 0; | 
|  | 231 | + | 
|  | 232 | +		break; | 
|  | 233 | +	} | 
|  | 234 | + | 
|  | 235 | +	digi_play_loop("950_s29", 3, 75, -1, -1); | 
|  | 236 | +} | 
|  | 237 | + | 
|  | 238 | +void Room806::pre_parser() { | 
|  | 239 | +	bool lookFl = player_said_any("look", "look at"); | 
|  | 240 | +	bool walkFl = player_said("walk to"); | 
|  | 241 | +	bool takeFl = player_said("take"); | 
|  | 242 | +	bool gearFl = player_said_any("push", "pull", "gear", "open", "close"); | 
|  | 243 | + | 
|  | 244 | +	if (player_said_any(" ", "WALL", "URN")) { | 
|  | 245 | +		_G(player).need_to_walk = false; | 
|  | 246 | +		_G(player).ready_to_walk = true; | 
|  | 247 | +		_G(player).waiting_for_walk = false; | 
|  | 248 | +	} | 
|  | 249 | + | 
|  | 250 | +	if (lookFl && player_said_any("  ", "    ")) { | 
|  | 251 | +		_G(player).need_to_walk = false; | 
|  | 252 | +		_G(player).ready_to_walk = true; | 
|  | 253 | +		_G(player).waiting_for_walk = false; | 
|  | 254 | +	} | 
|  | 255 | + | 
|  | 256 | +	if (walkFl && player_said_any("  ", "   ")) { | 
|  | 257 | +		_G(player).need_to_walk = false; | 
|  | 258 | +		_G(player).ready_to_walk = true; | 
|  | 259 | +		_G(player).waiting_for_walk = false; | 
|  | 260 | +	} | 
|  | 261 | + | 
|  | 262 | +	if (player_said("west") && player_said("     ")) { | 
|  | 263 | +		_G(player).need_to_walk = false; | 
|  | 264 | +		_G(player).ready_to_walk = true; | 
|  | 265 | +		_G(player).waiting_for_walk = false; | 
|  | 266 | +	} | 
|  | 267 | + | 
|  | 268 | +	if (player_said_any("    ", "      ") && _G(flags[266]) == 0) { | 
|  | 269 | +		_G(player).need_to_walk = false; | 
|  | 270 | +		_G(player).ready_to_walk = true; | 
|  | 271 | +		_G(player).waiting_for_walk = false; | 
|  | 272 | +	} | 
|  | 273 | + | 
|  | 274 | +	if (player_said_any("    ", "      ") && _G(flags[266]) != 0 && !walkFl && !player_said("east")) { | 
|  | 275 | +		_G(player).need_to_walk = false; | 
|  | 276 | +		_G(player).ready_to_walk = true; | 
|  | 277 | +		_G(player).waiting_for_walk = false; | 
|  | 278 | +	} | 
|  | 279 | + | 
|  | 280 | +	if (takeFl && player_said("CROSSBOW BOLT ")) { | 
|  | 281 | +		_G(player).need_to_walk = false; | 
|  | 282 | +		_G(player).ready_to_walk = true; | 
|  | 283 | +		_G(player).waiting_for_walk = false; | 
|  | 284 | +	} | 
|  | 285 | + | 
|  | 286 | +	if ((takeFl && player_said("CRANK")) || (player_said("CRANK") && player_said("SLOT")) || (gearFl && player_said("CRANK"))) { | 
|  | 287 | +		_G(player).need_to_walk = false; | 
|  | 288 | +		_G(player).ready_to_walk = true; | 
|  | 289 | +		_G(player).waiting_for_walk = false; | 
|  | 290 | +	} | 
|  | 291 | + | 
|  | 292 | +	if (player_said_any("MEI CHEN", "MEI CHEN ")) { | 
|  | 293 | +		_G(player).need_to_walk = false; | 
|  | 294 | +		_G(player).ready_to_walk = true; | 
|  | 295 | +		_G(player).waiting_for_walk = false; | 
|  | 296 | +	} | 
|  | 297 | + | 
|  | 298 | +	if (gearFl && player_said("CHARIOT")) { | 
|  | 299 | +		_G(player).need_to_walk = false; | 
|  | 300 | +		_G(player).ready_to_walk = true; | 
|  | 301 | +		_G(player).waiting_for_walk = false; | 
|  | 302 | +	} | 
|  | 303 | + | 
|  | 304 | +	if (player_said("west") && _G(flags[276]) == 0) { | 
|  | 305 | +		sendWSMessage_10000(_mcTrekMach, 225, 306, 9, -1, 1); | 
|  | 306 | +		_unkVar3 = 1; | 
|  | 307 | +		hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", true); | 
|  | 308 | +		hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", false); | 
|  | 309 | +	} | 
|  | 310 | + | 
|  | 311 | +	if (player_said("east") && _G(flags[266]) && _G(flags[276]) == 0) { | 
|  | 312 | +		sendWSMessage_10000(_mcTrekMach, 624, 306, 3, -1, 1); | 
|  | 313 | +		_unkVar3 = 0; | 
|  | 314 | +		hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN", false); | 
|  | 315 | +		hotspot_set_active(_G(currentSceneDef).hotspots, "MEI CHEN ", true); | 
|  | 316 | +	} | 
|  | 317 | + | 
|  | 318 | +} | 
|  | 319 | + | 
|  | 320 | +void Room806::parser() { | 
| 31 | 321 | } | 
| 32 | 322 | 
 | 
| 33 | 323 | void Room806::daemon() { | 
|  | 
0 commit comments