ScummVM API documentation
session.h
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  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation, either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program. If not, see <http://www.gnu.org/licenses/>.
24  *
25  */
26 
27 #ifndef ICB_SESSION_H
28 #define ICB_SESSION_H
29 
30 #include "engines/icb/p4_generic.h"
31 #include "engines/icb/object_structs.h"
32 #include "engines/icb/common/px_linkeddatafile.h"
33 #include "engines/icb/common/px_game_object.h"
34 #include "engines/icb/common/px_walkarea_integer.h"
35 #include "engines/icb/barriers.h"
36 #include "engines/icb/player.h"
37 #include "engines/icb/map_marker.h"
38 #include "engines/icb/prim_route_builder.h"
39 #include "engines/icb/speech.h"
40 #include "engines/icb/text_sprites.h"
41 #include "engines/icb/string_vest.h"
42 #include "engines/icb/set.h"
43 
44 namespace ICB {
45 
46 enum __chi_think_mode { __FOLLOWING = 1, __LOST = 2, __NOTHING = 3 };
47 
48 enum __chi_do_mode {
49  __ROUTING,
50  __INTERACT_FOLLOW,
51  __PAUSING,
52  __ANIMATE_TO_THINK,
53  __ANIMATE_TO_FIGHT_HELP,
54  __TURN_RND,
55  __GET_WEAPON_OUT,
56  __THINKING,
57  __BUMBLING,
58  __CHASING,
59  __GO_CORD_GO,
60  __FIGHT_HELP,
61  __DISARM_TO_THINK,
62  __TURN_TO_FACE_OBJECT
63 };
64 
65 enum __barrier_result {
66  __BLOCKED, // ran into a wall
67  __OK, // moved forward
68  __NUDGED,
69  __DODGED, // player hit mega
70  __CORRECTED // ran into wall but was at a shallow enough angle to be corrected
71 };
72 
73 enum __alert { __ASTOOD, __ARUNNING, __AWALKING, __APUNCHING };
74 
75 enum __rtype {
76  __FULL, // normal route - start and end boxes
77  __ENDB, // just end box
78  __STARTB, // just our box
79  __LASER // straight there - no barriers
80 };
81 
82 #define DEFAULT_interact_distance (500*500*REAL_ONE)
83 
84 #define MAX_extra_floors 12
85 
87 public:
88  uint32 num_extra_floors;
89  uint32 extra_floors[MAX_extra_floors];
90 };
91 
92 #define MAX_player_history 10
93 
94 typedef struct {
95  uint32 id; // of floor or object
96  PXreal first_x; // coords recorded as player walks onto floor - chi will route here first
97  PXreal first_z;
98  bool8 interaction; // is this item an interaction id or a floor number
99  uint8 padding1;
100  uint8 padding2;
101  uint8 padding3;
102 } _history;
103 
104 #define HISTORY_RUBBER (30 * REAL_ONE)
105 #define MAX_local_history 3
106 #define TIME_to_next_local_history (1 * 12)
107 typedef struct {
108  PXreal x; // coords recorded as player walks around the floor
109  PXreal z;
111 
112 #define NO_CAMERA_CHOSEN 0xfffffffe
113 
114 #define MAX_session_objects MAX_props // number of game objects allowed per session (and their structs)
115 // THIS MUST BE A MULTIPLE OF 4
116 // SEE BARRIERS.H FOR MASTER DEFINITION
117 
118 // test lower figure
119 #define MAX_voxel_list 24
120 
121 // how many individual walkareas
122 #define MAX_was 32
123 
124 #define MAX_missing_objects 16
125 #define MAX_missing_object_name_length 32
126 
127 #define MAX_auto_interact 20
128 
129 // fn-new-apply-bullet
130 #define ALWAYS_HIT_DIST (300 * REAL_ONE)
131 
132 #define MAX_conveyors 10
133 
134 #define MAX_footstepFloors 32
135 
136 typedef struct {
137  bool8 moving;
138  PXreal x, y, z;
139  PXreal x1, z1;
140  PXreal xm, zm;
141  uint8 pad1;
142  uint8 pad2;
143 
144 } _conveyor;
145 
146 #define MAX_lift_platforms 10
147 typedef struct {
148  uint32 id;
149  PXreal x, y, z;
150  PXreal x1, z1;
151 
153 
154 #define MAX_stairs 32
155 
156 typedef struct {
157  RouteBarrier bar;
158  PXfloat pan, pan_ref, x, z;
159 
160  uint8 units;
161  bool8 up;
162  uint8 stair_id;
163  bool8 is_stair;
164 
165  bool8 live;
166  uint8 opposite_number; // as in stair id not object id
167  uint8 pad2;
168  uint8 pad3;
169 
170 } _stair;
171 
172 class _floor_world;
174 public:
175  _game_session(){};
176 
177  void ___init(const char *mission, const char *new_session_name);
178  void ___destruct();
179 
180  void Pre_initialise_objects();
181  void Init_objects();
182 
183  void One_logic_cycle();
184  void Script_cycle();
185  void Pre_logic_event_check();
186  const char *Fetch_session_name();
187  const char *Fetch_h_session_name(); // file name of #mission//#session
188  const char *Fetch_session_h_name(); // file name of hash name of this session
189  const char *Fetch_session_cluster();
190  uint32 Fetch_session_cluster_hash();
191  void Initialise_set(const char *name, const char *cluster_name);
192 
193  // Compute if mega's are on or off current camera and send events to them to say "ON_CAMERA" / "OFF_CAMERA"
194  void UpdateOnOffCamera();
195 
196  inline PXcamera &GetCamera();
197  inline int32 SetOK();
198  inline void SetReset();
199 
200  void Stage_draw();
201  void Stage_draw_poly();
202  void Display_mega_times();
203 
204  void UpdateMegaFX();
205 
206  void Rebuild_working_buffers();
207  void Render_3d_nicos();
208  void Show_lit_unlit_diagnostics();
209 
210  int32 GetSelectedPropId();
211  void GetSelectedPropRGB(uint8 &r, uint8 &g, uint8 &b);
212  bool8 IsPropSelected(const char *propName);
213 
214  int32 GetSelectedMegaId();
215  void GetSelectedMegaRGB(uint8 &r, uint8 &g, uint8 &b);
216 
217  uint32 Fetch_number_of_props();
218  uint32 Fetch_number_of_objects();
219  _logic *Fetch_object_struct(uint32 id);
220  uint32 Fetch_cur_id();
221  uint32 Fetch_script_var();
222  _object_status Fetch_object_status(uint32 id);
223  void Set_object_status(uint32 id, _object_status val);
224  const char *Fetch_object_name(uint32 id);
225  void Force_context_check(uint32 id);
226  uint32 Fetch_named_objects_id(const char *name) const;
227  inline uint32 Fetch_object_integer_variable(const char *pcName, const char *pcVar) const;
228 
229  uint32 Validate_prop_anim(const char *anim_name);
230 
231  uint32 Fetch_prop_state(char *prop_name);
232  void Set_prop_state(char *name, uint32 value);
233 
234  void Script_version_check();
235 
236  bool8 Rig_test_mode();
237 
238  void Custom_simple_animator();
239  void Custom_button_operated_door();
240  void Custom_auto_door();
241 
242  void Reset_all_objects();
243 
244  void Process_player_floor_status();
245 
246  void Restart_player();
247 
248  bool8 Engine_start_interaction(const char *script, uint32 id);
249 
250  void Setup_prop_sleep_states();
251  void Awaken_doors();
252 
253  // speech on psx
254 
255  bool8 can_save, prev_save_state;
256  void Set_can_save(bool8 stat) {
257  can_save = stat;
258  }
259  bool8 Can_save() {
260  return can_save;
261  }
262 
263  mcodeFunctionReturnCodes fn_test(int32 &, int32 *);
264  mcodeFunctionReturnCodes fn_create_mega(int32 &, int32 *);
265  mcodeFunctionReturnCodes fn_prop_animate(int32 &, int32 *);
266  mcodeFunctionReturnCodes fn_set_voxel_image_path(int32 &, int32 *);
267  mcodeFunctionReturnCodes fn_set_xyz(int32 &, int32 *);
268  mcodeFunctionReturnCodes fn_set_pan(int32 &, int32 *);
269  mcodeFunctionReturnCodes fn_set_to_floor(int32 &, int32 *);
270  mcodeFunctionReturnCodes fn_init_from_nico_file(int32 &, int32 *);
271  mcodeFunctionReturnCodes fn_init_from_marker_file(int32 &, int32 *);
272  mcodeFunctionReturnCodes fn_shut_down_object(int32 &, int32 *);
273  mcodeFunctionReturnCodes fn_context_chosen_logic(int32 &, int32 *);
274  mcodeFunctionReturnCodes fn_pause(int32 &, int32 *);
275  mcodeFunctionReturnCodes fn_face_coord(int32 &, int32 *);
276  mcodeFunctionReturnCodes fn_face_object(int32 &, int32 *);
277  mcodeFunctionReturnCodes fn_play_generic_anim(int32 &, int32 *);
278  mcodeFunctionReturnCodes fn_play_custom_anim(int32 &, int32 *);
279  mcodeFunctionReturnCodes fn_start_player_interaction(int32 &, int32 *);
280  mcodeFunctionReturnCodes fn_custom_prop_interact(int32 &, int32 *);
281  mcodeFunctionReturnCodes fn_generic_prop_interact(int32 &, int32 *);
282  mcodeFunctionReturnCodes fn_set_player_can_interact(int32 &, int32 *);
283  mcodeFunctionReturnCodes fn_set_player_cannot_interact(int32 &, int32 *);
284  mcodeFunctionReturnCodes fn_register_for_event(int32 &, int32 *);
285  mcodeFunctionReturnCodes fn_unregister_for_event(int32 &, int32 *);
286  mcodeFunctionReturnCodes fn_post_event(int32 &, int32 *);
287  mcodeFunctionReturnCodes fn_call_socket(int32 &, int32 *);
288  mcodeFunctionReturnCodes fn_register_object_for_event(int32 &, int32 *);
289  mcodeFunctionReturnCodes fn_unregister_object_for_event(int32 &, int32 *);
290  mcodeFunctionReturnCodes fn_register_for_line_of_sight(int32 &, int32 *);
291  mcodeFunctionReturnCodes fn_unregister_for_line_of_sight(int32 &, int32 *);
292  mcodeFunctionReturnCodes fn_register_object_for_line_of_sight(int32 &, int32 *);
293  mcodeFunctionReturnCodes fn_unregister_object_for_line_of_sight(int32 &, int32 *);
294  mcodeFunctionReturnCodes fn_post_future_event(int32 &, int32 *);
295  mcodeFunctionReturnCodes fn_post_repeating_event(int32 &, int32 *);
296  mcodeFunctionReturnCodes fn_prop_set_to_first_frame(int32 &, int32 *);
297  mcodeFunctionReturnCodes fn_prop_set_to_last_frame(int32 &, int32 *);
298  mcodeFunctionReturnCodes fn_can_see(int32 &, int32 *);
299  mcodeFunctionReturnCodes fn_can_object_see(int32 &, int32 *);
300  mcodeFunctionReturnCodes fn_prop_near_a_mega(int32 &, int32 *);
301  mcodeFunctionReturnCodes socket_force_new_logic(int32 &, int32 *);
302  mcodeFunctionReturnCodes fn_set_weapon(int32 &, int32 *);
303  mcodeFunctionReturnCodes fn_request_speech(int32 &, int32 *);
304  mcodeFunctionReturnCodes fn_add_talker(int32 &, int32 *);
305  mcodeFunctionReturnCodes fn_issue_speech_request(int32 &, int32 *);
306  mcodeFunctionReturnCodes fn_confirm_requests(int32 &, int32 *);
307  mcodeFunctionReturnCodes fn_converse(int32 &, int32 *);
308  mcodeFunctionReturnCodes fn_anon_speech_invite(int32 &, int32 *);
309  mcodeFunctionReturnCodes fn_set_mega_field_of_view(int32 &, int32 *);
310  mcodeFunctionReturnCodes fn_apply_bullet(int32 &, int32 *);
311  mcodeFunctionReturnCodes fn_add_inventory_item(int32 &, int32 *);
312  mcodeFunctionReturnCodes fn_remove_inventory_item(int32 &, int32 *);
313  mcodeFunctionReturnCodes fn_initialise_inventory(int32 &, int32 *);
314  mcodeFunctionReturnCodes fn_is_carrying(int32 &, int32 *);
315  mcodeFunctionReturnCodes fn_reset_player(int32 &, int32 *);
316  mcodeFunctionReturnCodes fn_speak(int32 &, int32 *);
317  mcodeFunctionReturnCodes speak_object_face_object(int32 &, int32 *);
318  mcodeFunctionReturnCodes speak_play_generic_anim(int32 &, int32 *);
319  mcodeFunctionReturnCodes speak_wait_for_everyone(int32 &, int32 *);
320  mcodeFunctionReturnCodes fn_get_weapon(int32 &, int32 *);
321  mcodeFunctionReturnCodes fn_rig_test(int32 &, int32 *);
322  mcodeFunctionReturnCodes fn_item_held(int32 &, int32 *);
323  mcodeFunctionReturnCodes fn_is_holding(int32 &, int32 *);
324  mcodeFunctionReturnCodes fn_drop(int32 &, int32 *);
325  mcodeFunctionReturnCodes fn_set_to_last_frame_generic_anim(int32 &, int32 *);
326  mcodeFunctionReturnCodes fn_play_common_xa_music(int32 &, int32 *);
327  mcodeFunctionReturnCodes fn_pass_flag_to_engine(int32 &, int32 *);
328  mcodeFunctionReturnCodes fn_init_mega_from_nico(int32 &, int32 *);
329  mcodeFunctionReturnCodes fn_remora_is_active(int32 &, int32 *);
330  mcodeFunctionReturnCodes fn_easy_play_generic_anim(int32 &, int32 *);
331  mcodeFunctionReturnCodes fn_teleport(int32 &, int32 *);
332  mcodeFunctionReturnCodes fn_get_pan_from_nico(int32 &, int32 *);
333  mcodeFunctionReturnCodes fn_teleport_to_nico(int32 &, int32 *);
334  mcodeFunctionReturnCodes fn_are_we_on_this_floor(int32 &, int32 *);
335  mcodeFunctionReturnCodes fn_is_object_on_our_floor(int32 &, int32 *);
336  mcodeFunctionReturnCodes fn_is_object_on_screen(int32 &, int32 *);
337  mcodeFunctionReturnCodes fn_is_object_dead(int32 &, int32 *);
338  mcodeFunctionReturnCodes fn_set_custom(int32 &, int32 *);
339  mcodeFunctionReturnCodes fn_message(int32 &, int32 *);
340  mcodeFunctionReturnCodes fn_message_var(int32 &, int32 *);
341  mcodeFunctionReturnCodes fn_get_state_flag(int32 &, int32 *);
342  mcodeFunctionReturnCodes fn_clear_all_events(int32 &, int32 *);
343  mcodeFunctionReturnCodes fn_check_event_waiting(int32 &, int32 *);
344  mcodeFunctionReturnCodes fn_get_last_event_sender_id(int32 &, int32 *);
345  mcodeFunctionReturnCodes fn_near(int32 &, int32 *);
346  mcodeFunctionReturnCodes fn_easy_play_custom_anim(int32 &, int32 *);
347  mcodeFunctionReturnCodes fn_snap_face_object(int32 &, int32 *);
348  mcodeFunctionReturnCodes fn_teleport_z(int32 &, int32 *);
349  mcodeFunctionReturnCodes fn_on_screen(int32 &, int32 *);
350  mcodeFunctionReturnCodes fn_hold_if_off_screen(int32 &, int32 *);
351  mcodeFunctionReturnCodes fn_mega_interacts(int32 &, int32 *);
352  mcodeFunctionReturnCodes fn_restart_object(int32 &, int32 *);
353  mcodeFunctionReturnCodes fn_object_near_nico(int32 &, int32 *);
354  mcodeFunctionReturnCodes fn_remora_get_mode(int32 &, int32 *);
355  mcodeFunctionReturnCodes fn_remora_set_mode(int32 &, int32 *);
356  mcodeFunctionReturnCodes fn_teleport_y_to_id(int32 &, int32 *);
357  mcodeFunctionReturnCodes fn_call_socket_id(int32 &, int32 *);
358  mcodeFunctionReturnCodes fn_lift_process_list(int32 &, int32 *);
359  mcodeFunctionReturnCodes fn_add_object_name_to_list(int32 &, int32 *);
360  mcodeFunctionReturnCodes fn_add_object_id_to_list(int32 &, int32 *);
361  mcodeFunctionReturnCodes fn_post_named_event_to_object(int32 &, int32 *);
362  mcodeFunctionReturnCodes fn_route_to_nico(int32 &, int32 *);
363  mcodeFunctionReturnCodes fn_hold_while_list_near_nico(int32 &, int32 *);
364  mcodeFunctionReturnCodes fn_set_watch(int32 &, int32 *);
365  mcodeFunctionReturnCodes fn_get_persons_weapon(int32 &, int32 *);
366  mcodeFunctionReturnCodes fn_kill_me(int32 &, int32 *);
367  mcodeFunctionReturnCodes fn_kill_object(int32 &, int32 *);
368  mcodeFunctionReturnCodes fn_set_to_first_frame_custom_anim(int32 &, int32 *);
369  mcodeFunctionReturnCodes fn_set_to_last_frame_custom_anim(int32 &, int32 *);
370  mcodeFunctionReturnCodes fn_shut_down_event_processing(int32 &, int32 *);
371  mcodeFunctionReturnCodes fn_player(int32 &, int32 *);
372  mcodeFunctionReturnCodes fn_three_sixty_interact(int32 &, int32 *);
373  mcodeFunctionReturnCodes fn_route_to_marker(int32 &, int32 *);
374  mcodeFunctionReturnCodes fn_play_mission_xa_music(int32 &, int32 *);
375  mcodeFunctionReturnCodes fn_play_common_vag_music(int32 &, int32 *);
376  mcodeFunctionReturnCodes fn_play_mission_vag_music(int32 &, int32 *);
377  mcodeFunctionReturnCodes fn_near_list(int32 &, int32 *);
378  mcodeFunctionReturnCodes fn_get_list_result(int32 &, int32 *);
379  mcodeFunctionReturnCodes fn_event_check_last_sender(int32 &, int32 *);
380  mcodeFunctionReturnCodes fn_add_icon_to_icon_list(int32 &, int32 *);
381  mcodeFunctionReturnCodes fn_remove_icon_from_icon_list(int32 &, int32 *);
382  mcodeFunctionReturnCodes fn_remora_is_email_waiting(int32 &, int32 *);
383  mcodeFunctionReturnCodes fn_destroy_icon_list(int32 &, int32 *);
384  mcodeFunctionReturnCodes fn_remora_send_email(int32 &, int32 *);
385  mcodeFunctionReturnCodes fn_remora_menu_return(int32 &, int32 *);
386  mcodeFunctionReturnCodes fn_remora_picture(int32 &, int32 *);
387  mcodeFunctionReturnCodes fn_remora_clear_screen(int32 &, int32 *);
388  mcodeFunctionReturnCodes fn_new_apply_bullet(int32 &, int32 *);
389  mcodeFunctionReturnCodes fn_new_script(int32 &, int32 *);
390  mcodeFunctionReturnCodes fn_random(int32 &, int32 *);
391  mcodeFunctionReturnCodes fn_change_session(int32 &, int32 *);
392  mcodeFunctionReturnCodes fn_changed_sessions(int32 &, int32 *);
393  mcodeFunctionReturnCodes fn_remora_set_current_zoom(int32 &, int32 *);
394  mcodeFunctionReturnCodes speak_add_chooser_icon(int32 &, int32 *);
395  mcodeFunctionReturnCodes speak_user_chooser(int32 &, int32 *);
396  mcodeFunctionReturnCodes fn_is_there_interact_object(int32 &, int32 *);
397  mcodeFunctionReturnCodes fn_get_interact_object_id(int32 &, int32 *);
398  mcodeFunctionReturnCodes fn_is_object_interact_object(int32 &, int32 *);
399  mcodeFunctionReturnCodes speak_chosen(int32 &, int32 *);
400  mcodeFunctionReturnCodes fn_remora_add_icon(int32 &, int32 *);
401  mcodeFunctionReturnCodes fn_remora_remove_icon(int32 &, int32 *);
402  mcodeFunctionReturnCodes fn_remora_reset_icon_list(int32 &, int32 *);
403  mcodeFunctionReturnCodes fn_remora_choose(int32 &, int32 *);
404  mcodeFunctionReturnCodes fn_simple_chi(int32 &, int32 *);
405  mcodeFunctionReturnCodes fn_chi(int32 &, int32 *);
406  mcodeFunctionReturnCodes speak_menu_still_active(int32 &, int32 *);
407  mcodeFunctionReturnCodes speak_menu_choices_remain(int32 &, int32 *);
408  mcodeFunctionReturnCodes speak_close_menu(int32 &, int32 *);
409  mcodeFunctionReturnCodes speak_new_menu(int32 &, int32 *);
410  mcodeFunctionReturnCodes speak_end_conversation(int32 &, int32 *);
411  mcodeFunctionReturnCodes speak_end_menu(int32 &, int32 *);
412  mcodeFunctionReturnCodes speak_add_special_chooser_icon(int32 &, int32 *);
413  mcodeFunctionReturnCodes fn_floor_and_floor_camera_linked(int32 &, int32 *);
414  mcodeFunctionReturnCodes fn_is_object_adjacent(int32 &, int32 *);
415  mcodeFunctionReturnCodes fn_is_object_on_this_floor(int32 &, int32 *);
416  mcodeFunctionReturnCodes fn_get_objects_lvar_value(int32 &, int32 *);
417  mcodeFunctionReturnCodes fn_mega_generic_interact(int32 &, int32 *);
418  mcodeFunctionReturnCodes fn_set_objects_lvar_value(int32 &, int32 *);
419  mcodeFunctionReturnCodes fn_is_registered_for_event(int32 &, int32 *);
420  mcodeFunctionReturnCodes fn_is_object_registered_for_event(int32 &, int32 *);
421  mcodeFunctionReturnCodes fn_set_object_sight_range(int32 &, int32 *);
422  mcodeFunctionReturnCodes fn_set_object_sight_height(int32 &, int32 *);
423  mcodeFunctionReturnCodes fn_switch_on_the_really_neat_and_special_script_debugging_facility(int32 &, int32 *);
424  mcodeFunctionReturnCodes fn_switch_off_the_really_neat_and_special_script_debugging_facility(int32 &, int32 *);
425  mcodeFunctionReturnCodes fn_sound_heard_this(int32 &, int32 *);
426  mcodeFunctionReturnCodes fn_can_see_in_dark(int32 &, int32 *);
427  mcodeFunctionReturnCodes fn_mega_never_in_shadow(int32 &, int32 *);
428  mcodeFunctionReturnCodes fn_remora_new_menu_on_icon(int32 &, int32 *);
429  mcodeFunctionReturnCodes fn_remora_new_menu(int32 &, int32 *);
430  mcodeFunctionReturnCodes fn_no_logic(int32 &, int32 *);
431  mcodeFunctionReturnCodes fn_gosub(int32 &, int32 *);
432  mcodeFunctionReturnCodes fn_set_custom_simple_animator(int32 &, int32 *);
433  mcodeFunctionReturnCodes fn_tiny_route(int32 &, int32 *);
434  mcodeFunctionReturnCodes fn_sharp_route(int32 &, int32 *);
435  mcodeFunctionReturnCodes fn_set_custom_button_operated_door(int32 &, int32 *);
436  mcodeFunctionReturnCodes fn_test_prop_anim(int32 &, int32 *);
437  mcodeFunctionReturnCodes fn_lift2_process(int32 &, int32 *);
438  mcodeFunctionReturnCodes fn_post_named_event_to_object_id(int32 &, int32 *);
439  mcodeFunctionReturnCodes fn_set_custom_auto_door(int32 &, int32 *);
440  mcodeFunctionReturnCodes fn_switch_to_manual_camera(int32 &, int32 *);
441  mcodeFunctionReturnCodes fn_cancel_manual_camera(int32 &, int32 *);
442  mcodeFunctionReturnCodes fn_carrying_how_many(int32 &, int32 *);
443  mcodeFunctionReturnCodes fn_preload_custom_mega_anim(int32 &, int32 *);
444  mcodeFunctionReturnCodes fn_remora_wait_on_icon(int32 &, int32 *);
445  mcodeFunctionReturnCodes fn_reverse_generic_anim(int32 &, int32 *);
446  mcodeFunctionReturnCodes fn_register_for_auto_interaction(int32 &, int32 *);
447  mcodeFunctionReturnCodes fn_sound_set_hearing_sensitivity(int32 &, int32 *);
448  mcodeFunctionReturnCodes fn_suspend_events(int32 &, int32 *);
449  mcodeFunctionReturnCodes fn_unsuspend_events(int32 &, int32 *);
450  mcodeFunctionReturnCodes fn_sound_heard_something(int32 &, int32 *);
451  mcodeFunctionReturnCodes fn_prime_player_history(int32 &, int32 *);
452  mcodeFunctionReturnCodes fn_start_chi_following(int32 &, int32 *);
453  mcodeFunctionReturnCodes fn_inherit_prop_anim_height(int32 &, int32 *);
454  mcodeFunctionReturnCodes fn_record_player_interaction(int32 &, int32 *);
455  mcodeFunctionReturnCodes fn_mega_use_lift(int32 &, int32 *);
456  mcodeFunctionReturnCodes fn_snap_to_nico_y(int32 &, int32 *);
457  mcodeFunctionReturnCodes fn_inherit_prop_anim_height_id(int32 &, int32 *);
458  mcodeFunctionReturnCodes fn_route_to_custom_prop_interact(int32 &, int32 *);
459  mcodeFunctionReturnCodes fn_route_to_generic_prop_interact(int32 &, int32 *);
460  mcodeFunctionReturnCodes fn_fetch_chi_mode(int32 &, int32 *);
461  mcodeFunctionReturnCodes fn_lib_lift_chord_and_chi(int32 &, int32 *);
462  mcodeFunctionReturnCodes fn_set_interacting(int32 &, int32 *);
463  mcodeFunctionReturnCodes fn_clear_interacting(int32 &, int32 *);
464  mcodeFunctionReturnCodes fn_remora_emp_flash(int32 &, int32 *);
465  mcodeFunctionReturnCodes fn_remora_mark_email_read(int32 &, int32 *);
466  mcodeFunctionReturnCodes fn_do_not_disturb(int32 &, int32 *);
467  mcodeFunctionReturnCodes fn_remora_check_email_id(int32 &, int32 *);
468  mcodeFunctionReturnCodes fn_remora_set_map_knowledge_level(int32 &, int32 *);
469  mcodeFunctionReturnCodes fn_remora_fix_motion_scan_xz(int32 &, int32 *);
470  mcodeFunctionReturnCodes fn_remora_update_player(int32 &, int32 *);
471  mcodeFunctionReturnCodes fn_remora_script_activate(int32 &, int32 *);
472  mcodeFunctionReturnCodes fn_remora_script_deactivate(int32 &, int32 *);
473  mcodeFunctionReturnCodes fn_line_of_sight_suspend(int32 &, int32 *);
474  mcodeFunctionReturnCodes fn_line_of_sight_unsuspend(int32 &, int32 *);
475  mcodeFunctionReturnCodes fn_check_for_nico(int32 &, int32 *);
476  mcodeFunctionReturnCodes fn_sony_door_interact(int32 &, int32 *);
477  mcodeFunctionReturnCodes fn_apply_anim_y(int32 &, int32 *);
478  mcodeFunctionReturnCodes fn_remora_default_logic(int32 &, int32 *);
479  mcodeFunctionReturnCodes fn_line_of_sight_now(int32 &, int32 *);
480  mcodeFunctionReturnCodes fn_play_sfx(int32 &, int32 *);
481  mcodeFunctionReturnCodes fn_stop_sfx(int32 &, int32 *);
482  mcodeFunctionReturnCodes fn_set_to_first_frame_generic_anim(int32 &, int32 *);
483  mcodeFunctionReturnCodes fn_easy_play_generic_anim_with_pan(int32 &, int32 *);
484  mcodeFunctionReturnCodes speak_play_custom_anim(int32 &, int32 *);
485  mcodeFunctionReturnCodes speak_set_custom(int32 &, int32 *);
486  mcodeFunctionReturnCodes fn_check_for_chi(int32 &, int32 *);
487  mcodeFunctionReturnCodes fn_wait_for_chi(int32 &, int32 *);
488  mcodeFunctionReturnCodes fn_send_chi_to_this_object(int32 &, int32 *);
489  mcodeFunctionReturnCodes fn_set_ids_lvar_value(int32 &, int32 *);
490  mcodeFunctionReturnCodes fn_teleport_to_nico_y(int32 &, int32 *);
491  mcodeFunctionReturnCodes fn_is_id_the_player(int32 &, int32 *);
492  mcodeFunctionReturnCodes fn_set_to_exlusive_coords(int32 &, int32 *);
493  mcodeFunctionReturnCodes fn_chi_wait_for_player_to_move(int32 &, int32 *);
494  mcodeFunctionReturnCodes fn_set_evil(int32 &, int32 *);
495  mcodeFunctionReturnCodes fn_remora_menu_return_on_icon(int32 &, int32 *);
496  mcodeFunctionReturnCodes fn_remora_mega_says(int32 &, int32 *);
497  mcodeFunctionReturnCodes fn_changed_via_this_shaft(int32 &, int32 *);
498  mcodeFunctionReturnCodes fn_get_objects_x(int32 &, int32 *);
499  mcodeFunctionReturnCodes fn_get_objects_y(int32 &, int32 *);
500  mcodeFunctionReturnCodes fn_get_objects_z(int32 &, int32 *);
501  mcodeFunctionReturnCodes fn_set_cad_lock_status(int32 &, int32 *);
502  mcodeFunctionReturnCodes fn_are_we_on_screen(int32 &, int32 *);
503  mcodeFunctionReturnCodes fn_reset_icon_list(int32 &, int32 *);
504  mcodeFunctionReturnCodes fn_get_speech_status(int32 &, int32 *);
505  mcodeFunctionReturnCodes fn_interact_choose(int32 &, int32 *);
506  mcodeFunctionReturnCodes fn_is_mega_within_area(int32 &, int32 *);
507  mcodeFunctionReturnCodes fn_get_cad_state_flag(int32 &, int32 *);
508  mcodeFunctionReturnCodes fn_end_mission(int32 &, int32 *);
509  mcodeFunctionReturnCodes fn_remora_set_max_zoom(int32 &, int32 *);
510  mcodeFunctionReturnCodes fn_remora_set_min_zoom(int32 &, int32 *);
511  mcodeFunctionReturnCodes fn_route_to_near_mega(int32 &, int32 *);
512  mcodeFunctionReturnCodes fn_stop_chi_following(int32 &, int32 *);
513  mcodeFunctionReturnCodes fn_set_pose(int32 &, int32 *);
514  mcodeFunctionReturnCodes fn_is_crouching(int32 &, int32 *);
515  mcodeFunctionReturnCodes fn_is_armed(int32 &, int32 *);
516  mcodeFunctionReturnCodes fn_push_player_status(int32 &, int32 *);
517  mcodeFunctionReturnCodes fn_pop_player_status(int32 &, int32 *);
518  mcodeFunctionReturnCodes fn_post_third_party_speech(int32 &, int32 *);
519  mcodeFunctionReturnCodes fn_fast_face_object(int32 &, int32 *);
520  mcodeFunctionReturnCodes fn_remora_paragraph_text(int32 &, int32 *);
521  mcodeFunctionReturnCodes fn_remora_main_heading(int32 &, int32 *);
522  mcodeFunctionReturnCodes fn_remora_sub_heading(int32 &, int32 *);
523  mcodeFunctionReturnCodes fn_remora_option_text(int32 &, int32 *);
524  mcodeFunctionReturnCodes fn_remora_warning_text(int32 &, int32 *);
525  mcodeFunctionReturnCodes fn_object_rerun_logic_context(int32 &, int32 *);
526  mcodeFunctionReturnCodes fn_interact_near_mega(int32 &, int32 *);
527  mcodeFunctionReturnCodes fn_am_i_player(int32 &, int32 *);
528  mcodeFunctionReturnCodes fn_set_shoot_overide(int32 &, int32 *);
529  mcodeFunctionReturnCodes fn_set_strike_overide(int32 &, int32 *);
530  mcodeFunctionReturnCodes fn_start_conveyor(int32 &, int32 *);
531  mcodeFunctionReturnCodes fn_stop_conveyor(int32 &, int32 *);
532  mcodeFunctionReturnCodes fn_interact_with_id(int32 &, int32 *);
533  mcodeFunctionReturnCodes fn_face_nicos_pan(int32 &, int32 *);
534  mcodeFunctionReturnCodes fn_unregister_for_auto_interaction(int32 &, int32 *);
535  mcodeFunctionReturnCodes fn_register_chi(int32 &, int32 *);
536  mcodeFunctionReturnCodes fn_add_y(int32 &, int32 *);
537  mcodeFunctionReturnCodes fn_register_stairway(int32 &, int32 *);
538  mcodeFunctionReturnCodes fn_play_sfx_xyz(int32 &, int32 *);
539  mcodeFunctionReturnCodes fn_reverse_custom_anim(int32 &, int32 *);
540  mcodeFunctionReturnCodes fn_trace(int32 &, int32 *);
541  mcodeFunctionReturnCodes fn_PLEASE_REUSE_THIS_SLOT_2(int32 &, int32 *);
542  mcodeFunctionReturnCodes fn_PLEASE_REUSE_THIS_SLOT_3(int32 &, int32 *);
543  mcodeFunctionReturnCodes fn_set_player_has_weapon(int32 &, int32 *);
544  mcodeFunctionReturnCodes fn_align_with_floor(int32 &, int32 *);
545  mcodeFunctionReturnCodes fn_sound_new_entry(int32 &, int32 *);
546  mcodeFunctionReturnCodes fn_sound_remove_entry(int32 &, int32 *);
547  mcodeFunctionReturnCodes fn_sound_simulate(int32 &, int32 *);
548  mcodeFunctionReturnCodes fn_set_object_type(int32 &, int32 *);
549  mcodeFunctionReturnCodes fn_register_ladder(int32 &, int32 *);
550  mcodeFunctionReturnCodes fn_play_movie(int32 &, int32 *);
551  mcodeFunctionReturnCodes fn_is_an_object_crouching(int32 &, int32 *);
552  mcodeFunctionReturnCodes fn_play_sfx_offset(int32 &, int32 *);
553  mcodeFunctionReturnCodes fn_play_sfx_time(int32 &, int32 *);
554  mcodeFunctionReturnCodes fn_add_medipacks(int32 &, int32 *);
555  mcodeFunctionReturnCodes fn_use_medipacks(int32 &, int32 *);
556  mcodeFunctionReturnCodes fn_add_ammo_clips(int32 &, int32 *);
557  mcodeFunctionReturnCodes fn_use_ammo_clips(int32 &, int32 *);
558  mcodeFunctionReturnCodes fn_load_players_gun(int32 &, int32 *);
559  mcodeFunctionReturnCodes fn_flash_health(int32 &, int32 *);
560  mcodeFunctionReturnCodes fn_sound_get_x(int32 &, int32 *);
561  mcodeFunctionReturnCodes fn_sound_get_z(int32 &, int32 *);
562  mcodeFunctionReturnCodes fn_set_player_pose(int32 &, int32 *);
563  mcodeFunctionReturnCodes fn_kill_conversations(int32 &, int32 *);
564  mcodeFunctionReturnCodes fn_is_player_running(int32 &, int32 *);
565  mcodeFunctionReturnCodes fn_is_player_walking(int32 &, int32 *);
566  mcodeFunctionReturnCodes fn_set_anim_speed(int32 &, int32 *);
567  mcodeFunctionReturnCodes fn_push_coords(int32 &, int32 *);
568  mcodeFunctionReturnCodes fn_pop_coords(int32 &, int32 *);
569  mcodeFunctionReturnCodes fn_fast_face_coord(int32 &, int32 *);
570  mcodeFunctionReturnCodes fn_sound_fast_face(int32 &, int32 *);
571  mcodeFunctionReturnCodes fn_remora_add_floor_range(int32 &, int32 *);
572  mcodeFunctionReturnCodes fn_remora_reset_floor_ranges(int32 &, int32 *);
573  mcodeFunctionReturnCodes fn_send_chi_to_named_object(int32 &, int32 *);
574  mcodeFunctionReturnCodes fx_narrow_screen(int32 &, int32 *);
575  mcodeFunctionReturnCodes fn_sound_route_to_near(int32 &, int32 *);
576  mcodeFunctionReturnCodes fn_sound_suspend(int32 &, int32 *);
577  mcodeFunctionReturnCodes fn_sound_unsuspend(int32 &, int32 *);
578  mcodeFunctionReturnCodes fn_wandering_custom_prop_interact(int32 &, int32 *);
579  mcodeFunctionReturnCodes fn_wandering_generic_prop_interact(int32 &, int32 *);
580  mcodeFunctionReturnCodes fn_set_texture(int32 &, int32 *);
581  mcodeFunctionReturnCodes fn_set_palette(int32 &, int32 *);
582  mcodeFunctionReturnCodes fn_restart_gamescript(int32 &, int32 *);
583  mcodeFunctionReturnCodes fn_quick_restart(int32 &, int32 *);
584  mcodeFunctionReturnCodes fx_generic_fade(int32 &, int32 *);
585  mcodeFunctionReturnCodes fn_speech_colour(int32 &, int32 *);
586  mcodeFunctionReturnCodes fn_is_current_camera(int32 &, int32 *);
587  mcodeFunctionReturnCodes fn_is_mega_near_mega(int32 &, int32 *);
588  mcodeFunctionReturnCodes fn_easy_play_custom_anim_with_pan(int32 &, int32 *);
589  mcodeFunctionReturnCodes fn_make_remora_beep(int32 &, int32 *);
590  mcodeFunctionReturnCodes fn_shadows_on(int32 &, int32 *);
591  mcodeFunctionReturnCodes fn_shadows_off(int32 &, int32 *);
592  mcodeFunctionReturnCodes fn_set_neck_bone(int32 &, int32 *);
593  mcodeFunctionReturnCodes fn_set_neck_vector(int32 &, int32 *);
594  mcodeFunctionReturnCodes speak_set_neck_vector(int32 &, int32 *);
595  mcodeFunctionReturnCodes fn_simple_look(int32 &, int32 *);
596  mcodeFunctionReturnCodes speak_simple_look(int32 &, int32 *);
597  mcodeFunctionReturnCodes fn_panless_teleport_to_nico(int32 &, int32 *);
598  mcodeFunctionReturnCodes fn_can_mega_see_dead_megas(int32 &, int32 *);
599  mcodeFunctionReturnCodes fn_breath(int32 &, int32 *);
600  mcodeFunctionReturnCodes fn_set_dynamic_light(int32 &, int32 *);
601  mcodeFunctionReturnCodes speak_set_dynamic_light(int32 &, int32 *);
602  mcodeFunctionReturnCodes fn_sharp_route_to_near_mega(int32 &, int32 *);
603  mcodeFunctionReturnCodes fn_spectre_route_to_mega(int32 &, int32 *);
604  mcodeFunctionReturnCodes fn_set_shade_percentage(int32 &, int32 *);
605  mcodeFunctionReturnCodes fn_can_hear_players_feet(int32 &, int32 *);
606  mcodeFunctionReturnCodes fn_is_player_striking(int32 &, int32 *);
607  mcodeFunctionReturnCodes fn_has_mega_our_height(int32 &, int32 *);
608  mcodeFunctionReturnCodes fn_chi_heard_gunshot(int32 &, int32 *);
609  mcodeFunctionReturnCodes fn_prime_custom_anim(int32 &, int32 *);
610  mcodeFunctionReturnCodes fn_preload_basics(int32 &, int32 *);
611  mcodeFunctionReturnCodes fn_play_sfx_special(int32 &, int32 *);
612  mcodeFunctionReturnCodes fn_set_default_footstep_sfx(int32 &, int32 *);
613  mcodeFunctionReturnCodes fn_set_floor_footstep_sfx(int32 &, int32 *);
614  mcodeFunctionReturnCodes fn_set_footstep_weight(int32 &, int32 *);
615  mcodeFunctionReturnCodes fn_set_special_footstep(int32 &, int32 *);
616  mcodeFunctionReturnCodes speak_reverse_custom_anim(int32 &, int32 *);
617  mcodeFunctionReturnCodes speak_preload_custom_anim(int32 &, int32 *);
618  mcodeFunctionReturnCodes fn_register_platform_coords(int32 &, int32 *);
619  mcodeFunctionReturnCodes fn_remora_progress_bar(int32 &, int32 *);
620  mcodeFunctionReturnCodes fn_play_sfx_offset_time(int32 &, int32 *);
621  mcodeFunctionReturnCodes fn_activate_stair_or_ladder(int32 &, int32 *);
622  mcodeFunctionReturnCodes fn_deactivate_stair_or_ladder(int32 &, int32 *);
623  mcodeFunctionReturnCodes fn_set_half_character_width(int32 &, int32 *);
624  mcodeFunctionReturnCodes fn_set_interact_look_height(int32 &, int32 *);
625  mcodeFunctionReturnCodes fn_swordfight(int32 &, int32 *);
626  mcodeFunctionReturnCodes fn_set_visible(int32 &, int32 *);
627  mcodeFunctionReturnCodes fn_set_object_visible(int32 &, int32 *);
628  mcodeFunctionReturnCodes fn_calibrate_chi(int32 &, int32 *);
629  mcodeFunctionReturnCodes fn_set_to_dead(int32 &, int32 *);
630  mcodeFunctionReturnCodes fn_sound_link_floors(int32 &, int32 *);
631  mcodeFunctionReturnCodes fn_remora_blank_line(int32 &, int32 *);
632  mcodeFunctionReturnCodes fn_set_voice_over_colour(int32 &, int32 *);
633  mcodeFunctionReturnCodes fn_default_voice_over_colour(int32 &, int32 *);
634  mcodeFunctionReturnCodes fn_set_camera_hold(int32 &, int32 *);
635  mcodeFunctionReturnCodes fn_set_mega_wait_for_player(int32 &, int32 *);
636  mcodeFunctionReturnCodes fn_set_mega_off_camera_hold(int32 &, int32 *);
637  mcodeFunctionReturnCodes fn_set_mega_slice_hold(int32 &, int32 *);
638  mcodeFunctionReturnCodes fn_set_mesh(int32 &, int32 *);
639  mcodeFunctionReturnCodes fn_sync_with_mega(int32 &, int32 *);
640  mcodeFunctionReturnCodes fn_laser_route(int32 &, int32 *);
641  mcodeFunctionReturnCodes fn_prop_crouch_interact(int32 &, int32 *);
642  mcodeFunctionReturnCodes fn_preload_sting(int32 &, int32 *);
643  mcodeFunctionReturnCodes fn_play_sting(int32 &, int32 *);
644  mcodeFunctionReturnCodes fn_stop_sting(int32 &, int32 *);
645  mcodeFunctionReturnCodes fn_set_sleep(int32 &, int32 *);
646 
647  mcodeFunctionReturnCodes speak_allocate_music(int32 &, int32 *);
648  mcodeFunctionReturnCodes speak_preload_music(int32 &, int32 *);
649  mcodeFunctionReturnCodes speak_play_music(int32 &, int32 *);
650  mcodeFunctionReturnCodes speak_stop_music(int32 &, int32 *);
651  mcodeFunctionReturnCodes speak_end_music(int32 &, int32 *);
652 
653  mcodeFunctionReturnCodes fn_set_sfx(int32 &, int32 *);
654  mcodeFunctionReturnCodes fn_wait_for_button(int32 &, int32 *);
655  mcodeFunctionReturnCodes fn_set_as_player(int32 &, int32 *);
656 
657  mcodeFunctionReturnCodes fn_lock_y(int32 &, int32 *);
658  mcodeFunctionReturnCodes fn_unlock_y(int32 &, int32 *);
659  mcodeFunctionReturnCodes fn_is_current_location(int32 &, int32 *);
660  mcodeFunctionReturnCodes fn_flip_pan(int32 &, int32 *);
661  mcodeFunctionReturnCodes fn_snap_to_ladder_bottom(int32 &, int32 *);
662  mcodeFunctionReturnCodes fn_snap_to_ladder_top(int32 &, int32 *);
663 
664  mcodeFunctionReturnCodes fn_set_manual_interact_object(int32 &, int32 *);
665  mcodeFunctionReturnCodes fn_cancel_manual_interact_object(int32 &, int32 *);
666 
667  mcodeFunctionReturnCodes fn_set_feet_to_pan(int32 &, int32 *);
668  mcodeFunctionReturnCodes fn_room_route(int32 &, int32 *);
669  mcodeFunctionReturnCodes fn_hard_load_generic_anim(int32 &, int32 *);
670  mcodeFunctionReturnCodes fn_hard_load_custom_anim(int32 &, int32 *);
671 
672  mcodeFunctionReturnCodes fn_face_camera(int32 &, int32 *);
673  mcodeFunctionReturnCodes fn_set_interact_distance(int32 &, int32 *);
674  mcodeFunctionReturnCodes fn_display_objects_lvar(int32 &, int32 *);
675 
676  mcodeFunctionReturnCodes fn_activate_sparkle(int32 &, int32 *);
677  mcodeFunctionReturnCodes fn_deactivate_sparkle(int32 &, int32 *);
678 
679  mcodeFunctionReturnCodes fn_is_player_standing_still(int32 &, int32 *);
680  mcodeFunctionReturnCodes fn_set_override_pose(int32 &, int32 *);
681  mcodeFunctionReturnCodes fn_cancel_override_pose(int32 &, int32 *);
682 
683  mcodeFunctionReturnCodes fn_preload_actor_file(int32 &, int32 *);
684  mcodeFunctionReturnCodes fn_preload_mesh(int32 &, int32 *);
685  mcodeFunctionReturnCodes fn_preload_texture(int32 &, int32 *);
686  mcodeFunctionReturnCodes fn_preload_palette(int32 &, int32 *);
687  mcodeFunctionReturnCodes fn_preload_animation(int32 &, int32 *);
688  mcodeFunctionReturnCodes fn_inventory_active(int32 &, int32 *);
689  mcodeFunctionReturnCodes fn_radial_interact(int32 &, int32 *);
690  mcodeFunctionReturnCodes fn_shutdown_inventory(int32 &, int32 *);
691  mcodeFunctionReturnCodes fn_hard_load_mesh(int32 &, int32 *);
692  mcodeFunctionReturnCodes fn_set_mega_height(int32 &, int32 *);
693  mcodeFunctionReturnCodes fn_shadow(int32 &, int32 *);
694 
695  mcodeFunctionReturnCodes fn_is_actor_relative(int32 &, int32 *);
696  mcodeFunctionReturnCodes fn_can_save(int32 &, int32 *);
697 
698  void Set_script(const char *script_name);
699  void Context_check(uint32 script_name);
700  void Shut_down_object();
701  void Shut_down_object(const char *ascii);
702  bool8 Console_shut_down_object(const char *name);
703  void Console_shut_down_all_objects();
704  void Console_shut_down_all_mega_objects();
705  bool8 Free_object(const char *name);
706  void Shut_down_id(uint32 id);
707  void Set_objects_conversation_uid(uint32 id, uint32 uid);
708  uint32 Return_objects_conversation_uid(uint32 id);
709  void List_session_mega_objects();
710 
711  bool8 Call_socket(uint32 id, const char *script, int32 *retval);
712  uint32 socket_id;
713  CGame *socket_object;
714 
715  void Create_initial_route(__rtype type);
716 
717  bool8 Process_route();
718  void Reset_route_manager();
719  uint32 Animate_points(_route_description *route); // the mega character route animator
720  void Calc_dist_and_pan(PXreal x, PXreal z, _route_description *route);
721 
722  void Calc_dist_and_target_pan(PXreal x, PXreal z, _route_description *route);
723  bool8 Calc_target_pan(PXreal x, PXreal z, PXreal x2, PXreal z2);
724  bool8 Calc_target_pan_no_bones(PXreal x, PXreal z, PXreal x2, PXreal z2);
725 
726  void Animate_turn_to_pan(__mega_set_names anim_type, uint32 speedup);
727 
728  void Advance_auto_pan();
729 
730  bool8 Is_route_required(PXreal startx, PXreal startz, PXreal destx, PXreal destz);
731 
732  bool8 Setup_route(int32 &result, int32 corex, int32 corez, int32 runs, __rtype type, int32 end_on_stand);
733  _route_description *Fetch_route_desc(uint32 id);
734 
735  // primitive line router service object
736  _prim_route_builder troute;
737 
738  mcodeFunctionReturnCodes Route_to_near_mega_core(const char *name, int32 run, int32 initial_turn, uint32 dist, int32 walk_to_run, int32 &result);
739 
740  void Start_new_router_game_cycle();
741  void Set_router_busy();
742  bool8 Is_router_busy();
743  bool8 router_busy;
744 
745  char speech_conv_name[ENGINE_STRING_LEN];
746 
747  __conversation speech_info[1];
748 
749  uint32 total_convs;
750 
751  uint32 conv_focus; // which conversation has the view/listen focus
752 
753  uint32 conv; // number of currently processed conversation
754 
755  text_sprite *text_bloc; // render bloc for remora speech
756  text_sprite *text_speech_bloc;
757 
758 #define S speech_info[0]
759 #define CONV_ID 0
760 
761  uint32 menu_number;
762  uint32 no_click_zone; // can't click past text until this reaches a certain number
763 
764  // The object ID of the currently highlighted prop
765  int32 selected_prop_id;
766  // The object ID of the currently highlighted mega
767  int32 selected_mega_id;
768 
769  void Service_speech();
770  void End_conversation(uint32 uid);
771  void Exit_speech(uint32 id);
772  void Render_speech(text_sprite *bloc);
773 
774  void Format_remora_text(const char *pcText, int32 nLineSpacing, int32 nCharSpacing, uint32 nMaxWidth);
775  void Create_remora_text(uint32 x, uint32 y, const char *ascii,
776  int32 margin, _pin_position pin_pos, int32 lineSpacing, int32 charSpacing,
777  uint32 maxWidth,
778  bool8 analysisAlreadyDone = FALSE8,
779  int32 stopAtLine = -1);
780  void Kill_remora_text();
781 
782  uint32 Fetch_no_barriers();
783 
784  uint32 Fetch_no_megas_barriers();
785  uint32 Fetch_no_megas_nudge_barriers();
786 
787  uint32 Fetch_megas_barrier_number(uint32 barrier);
788  uint32 Fetch_megas_nudge_barrier_number(uint32 barrier);
789 
790  uint32 External_fetch_no_megas_barriers(uint32 id);
791  uint32 External_fetch_no_megas_nudge_barriers(uint32 id);
792  uint32 External_fetch_no_megas_anim_barriers(uint32 id);
793  uint32 External_fetch_megas_barrier(uint32 id, uint32 barrier);
794  uint32 External_fetch_megas_nudge_barrier(uint32 id, uint32 barrier);
795 
796  PXfloat adjusted_pan;
797  bool8 made_adjust;
798  PXfloat normalAngle;
799  __barrier_result Check_barrier_bump_and_bounce(PXreal newx, PXreal newy, PXreal newz, PXreal oldx, PXreal oldy, PXreal oldz, bool8 player);
800 
801  __barrier_result Check_this_barrier(RouteBarrier *bar, PXreal newx, PXreal newz, PXreal oldx, PXreal oldz, PXreal bar_close, int32 *ignore);
802 
803  void Prepare_megas_route_barriers(bool8 player);
804  void Prepare_megas_abarriers(uint32 slice_number, uint32 parent_number);
805  void Fetch_mega_barriers_for_player();
806 
807  // animation
808  bool8 Advance_frame_and_motion(__mega_set_names anim_type, bool8 player, uint8 nFrames);
809  __barrier_result Core_advance(__mega_set_names anim_type, bool8 player, uint8 nFrames);
810  bool8 Easy_frame_and_motion(__mega_set_names anim_type, bool8 player, uint8 nFrames);
811  bool8 Easy_frame_motion_and_pan(__mega_set_names anim_type, bool8 player);
812  bool8 Reverse_frame_and_motion(__mega_set_names anim_type, bool8 player, uint8 nFrames);
813  __barrier_result Core_reverse(__mega_set_names anim_type, bool8 player, uint8 nFrames);
814 
815  void Normalise_anim_pc();
816 
817  void Soft_start_with_single_link(__mega_set_names link_anim, __mega_set_names next_anim);
818  void Soft_start_with_double_link(__mega_set_names link_one, __mega_set_names link_two, __mega_set_names next_anim);
819  void Soft_start_single_anim(__mega_set_names next_anim);
820  int32 Soften_up_anim_file(__mega_set_names link, int32 diff);
821 
822  void Hard_start_single_anim(__mega_set_names next_anim);
823  bool8 Play_anim();
824  bool8 Play_reverse_anim();
825  bool8 Play_anim_with_no_movement();
826  bool8 fast_face_object(uint32 id, uint32 speed);
827  bool8 Need_to_turn_to_face_object(uint32 id);
828  bool8 fast_face_rnd(uint32 speed);
829 
830  bool8 Find_interact_marker_in_anim(__mega_set_names anim, PXreal *xoff, PXreal *zoff);
831  bool8 Compute_target_interaction_coordinate(__mega_set_names anim, PXreal *destx, PXreal *destz);
832 
833  void Set_pose(__weapon weapon);
834  void Set_motion(__motion motion);
835  __motion Get_motion();
836  void Change_pose_in_current_anim_set();
837 
838  bool8 Start_generic_ascii_anim(const char *ascii_name);
839  __mega_set_names Fetch_generic_anim_from_ascii(const char *ascii_name);
840 
841  bool8 Fetch_cur_megas_armed_status();
842  __weapon Fetch_cur_megas_pose();
843  bool8 Fetch_custom();
844  void Reset_cur_megas_custom_type();
845  const char *Fetch_cur_megas_custom_text();
846  uint32 Fetch_last_frame(__mega_set_names anim);
847 
848  bool8 speech_face_object(uint32 tar_id);
849 
850  mcodeFunctionReturnCodes Core_prop_interact(int32 &result, int32 *params, bool8 custom, bool8 coord_correction);
851 
852  uint32 Fetch_number_of_megas() const {
853  return (number_of_voxel_ids);
854  }
855  uint32 Fetch_voxel_object_id(uint32 i) const {
856  return (voxel_id_list[i]);
857  }
858 
859  void Snap_to_ladder(_stair *lad, uint32 dist);
860  void Set_init_voxel_floors();
861  void Idle_manager();
862 
863  uint32 cur_camera_number;
864  uint32 anchor_floor; // the floor number that the object was on when the camera changed - used for rubber-banding when moving off
865 
866  uint32 wa_number; // number of current wa camera
867  PXreal wa_pin_x;
868  PXreal wa_pin_y;
869  PXreal wa_pin_z;
870 
871  char manual_camera_name[ENGINE_STRING_LEN]; // saved for save game
872 
873  uint32 num_cameras;
874  char *camera_name_list[64];
875  char *camera_cluster_list[64];
876 
877  uint32 floor_to_camera_index[MAX_floors];
878  _floor_cam_list cam_floor_list[MAX_floors];
879 
880  void Build_camera_table();
881  void Camera_director();
882  void Reset_camera_director();
883  bool8 Object_visible_to_camera(uint32 id);
884  bool8 Process_wa_list();
885  void Prepare_camera_floors();
886 
887  bool8 chi_interacts(int32 id, const char *script_name);
888  __chi_think_mode fn_fetch_chi_mode();
889  bool8 Make_floor_coordinate(PXreal *x, PXreal *z);
890  bool8 Find_a_chi_target();
891  void Chi_leaves_fight_mode();
892  void Set_chi_permission();
893  bool8 Process_chi();
894  PXreal Cord_dist();
895 
896  _history history[MAX_player_history];
897  uint32 cur_history; // players current position
898  uint32 chi_history; // chi's current position
899  uint32 pre_interact_floor; // floor we were on before going up stair or ladder -
900  __chi_think_mode chi_think_mode;
901  __chi_do_mode chi_do_mode;
902  uint32 chi_id; // id of chi object
903  uint32 chi_next_move; // counts down to chi's next move
904  _local_history local_history[MAX_local_history];
905  uint32 local_history_count; // how many moves this floor
906  uint32 next_local;
907  uint32 local_count_down;
908  PXreal hist_pin_x;
909  PXreal hist_pin_y;
910  PXreal hist_pin_z;
911 
912  uint32 chi_target_id; // id of target
913  bool8 chi_has_target; // has a valid target yes or no
914  uint8 fight_pause; // time to next move
915  bool8 permission_to_fire; // only after player has shot
916  PXreal chi_catch_up_dist;
917  PXreal chi_lost_dist;
918 
919  _local_history spectre_hist[MAX_floors];
920 
921  void Process_conveyors();
922  _conveyor conveyors[MAX_conveyors];
923 
924  _lift_platform lifts[MAX_lift_platforms];
925  uint8 num_lifts;
926 
927  void Draw_health_bar();
928  uint32 health_time;
929 
930  bool8 alert_list[MAX_voxel_list];
931  void Process_guard_alert(__alert alert_type);
932  void Reset_guard_alert();
933  void Signal_to_guards();
934  void Signal_to_other_guards();
935 
936  _player_stat player_stat_was; // asyncer remembers previous player state - ready for change
937  _player_stat player_stat_use; // use this which has skipped the linking status
938  void Service_generic_async();
939  bool8 Route_async_ready(bool8 run, bool8 turn);
940 
941  bool8 init_asyncs;
942  uint32 cur_sync_set;
943  bool8 caching;
944  _vox_image sync_set[4];
945 
946  void Async_helper();
947  int32 async_counter;
948  int32 async_off;
949 
950  uint32 num_stairs;
951  _stair stairs[MAX_stairs];
952  uint32 Register_stair_or_ladder(const char *target, bool8 top, uint32 length, bool8 stair, uint32 stepcms);
953 
954  void Set_state_of_stair_or_ladder(uint32 nIndex, bool8 bState);
955 
956  uint32 prop_state_table[MAX_session_objects]; // pointer to pc's of props for current session
957 
958  _set set; // the set object
959 
960  // floor definitions
961  _floor_world *floor_def; // pointer to a _floor_world object
962  // floor viewer and room router
963  // route barriers
964  _barrier_handler *session_barriers; // pointer to _barrier_handler object - loads file so must be pointer
965 
966  // game object stuff - objects.linked
967  LinkedDataFile *objects;
968  uint32 total_objects; // number of objects in the objects.object file - pulled out at session start for convenience
969  _logic *logic_structs[MAX_session_objects]; // pointers to current sessions logic structs
970  uint32 num_megas; // keeps a running total of megas initialised - used when assigning megas structures
971  uint32 num_vox_images; // as above but for vox_images - in theory these 2 counters are the same thing but that would be an assumption too far tbh
972 
973  // and the scripts.linked file
974  LinkedDataFile *scripts;
975 
976  // handles player object and user interface
977  _player player;
978  PXreal prop_interact_dist; // distance to prop player is going to interact with - needed by sony door functions
979 
980  // map markers
981  _marker markers;
982 
983  // initial map tag positions of props, people, etc.
984  LinkedDataFile *features;
985 
986  // ascii speech text
987  LinkedDataFile *text;
988 
989  // list of auto interact objects
990  uint8 auto_interact_list[MAX_auto_interact];
991 
992  // speech text font
993  char speech_font_one[ENGINE_STRING_LEN];
994  char remora_font[ENGINE_STRING_LEN];
995  uint32 speech_font_one_hash; // the hash value of the speech_font_one string
996  uint32 remora_font_hash; // the hash value of the speech_font_one string
997 
998  // prop animations
999  LinkedDataFile *prop_anims; // prop anims are loaded into the special private_session_resman
1000 
1001  // make los_timing be global so we can print it at a global level
1002  uint32 los_time;
1003 
1004  uint32 total_was; // how many individual walk-areas
1005  LinkedDataFile *walk_areas;
1006  const __aWalkArea *wa_list[MAX_was]; // walk areas
1007 
1008  bool8 manual_camera; // overiden by a script command
1009  bool8 camera_lock; // lock camera director - used to fix ladder problems (easier to fix like this than at animation end)
1010  bool8 wa_camera; // currently using a wa camera
1011  bool8 wa_tied_to_pin;
1012  bool8 wa_tied_to_exit_pin;
1013  bool8 is_there_a_chi; // yes or no
1014  bool8 first_session_cycle;
1015 
1016 private:
1017  char session_name[ENGINE_STRING_LEN];
1018  char h_session_name[ENGINE_STRING_LEN];
1019  char session_cluster[ENGINE_STRING_LEN];
1020 
1021  uint32 session_cluster_hash; // the hash value of the session_cluster string
1022  char session_h_name[8]; // filename equivalent of the hash'ed version of session
1023 
1024  uint32 total_props; // holds number of props in current session
1025 
1026  // speech
1027 
1028  // logic cycle stuff
1029  // all these are of course available to fn_functions and associated engine modules
1030  uint32 cur_id; // number of current object
1031  _logic *L; // current objects logic structure
1032  _vox_image *I; // pointer to current objects _voxel_image structure - megas only
1033  _mega *M; // pointer to current objects _mega struct - megas only
1034  CGame *object; // represents the current game object at logic run time
1035  uint32 script_var_value; // holds script variables passed back via fn_pass_flag_to_engine
1036 
1037  // list of ids that are voxel characters - built per game cycle
1038  uint8 voxel_id_list[MAX_voxel_list];
1039  uint32 number_of_voxel_ids; // kept for safety
1040 
1041  // prop state dummy object vars
1042  uint32 number_of_missing_objects;
1043  char missing_obs[MAX_missing_objects][MAX_missing_object_name_length];
1044  uint8 missing_ob_prop_states[MAX_missing_objects];
1045 
1046  // FOOTSTEPS for mega:
1047  void UpdateFootstep();
1048 
1049  // cartridge case for mega
1050  void UpdateCartridgeCase();
1051 
1052  uint32 defaultFootSfx;
1053  uint32 specialFootSfx;
1054  uint32 ladderFootSfx;
1055  uint32 floorFootSfx[MAX_footstepFloors][2]; // gives number of floor (0) and hash of sfx to use (1)...
1056  int32 numFloorFootSfx;
1057 
1058  // Block use of the copy constructor and the default '='.
1059  _game_session(const _game_session &);
1060  void operator=(const _game_session &) { ; }
1061 };
1062 
1063 inline uint32 _game_session::Fetch_script_var() {
1064  return (script_var_value);
1065 }
1066 
1067 inline uint32 _game_session::Fetch_number_of_props() {
1068  return (total_props);
1069 }
1070 
1071 inline uint32 _game_session::Fetch_number_of_objects() {
1072  return (total_objects);
1073 }
1074 
1075 inline _logic *_game_session::Fetch_object_struct(uint32 id) {
1076  assert(id < total_objects);
1077 
1078  return (logic_structs[id]);
1079 }
1080 
1081 inline void _game_session::Force_context_check(uint32 id) {
1082  assert(id < total_objects);
1083 
1084  logic_structs[id]->context_request = TRUE8;
1085 }
1086 
1087 inline _object_status _game_session::Fetch_object_status(uint32 id) {
1088  assert(id < total_objects);
1089 
1090  return (logic_structs[id]->ob_status);
1091 }
1092 
1093 inline void _game_session::Set_object_status(uint32 id, _object_status val) {
1094  assert(id < total_objects);
1095 
1096  logic_structs[id]->ob_status = val;
1097 }
1098 
1099 inline const char *_game_session::Fetch_object_name(uint32 id) {
1100  assert(id < total_objects);
1101 
1102  return ((const char *)(logic_structs[id]->GetName()));
1103 }
1104 
1105 inline uint32 _game_session::Fetch_cur_id() {
1106  return (cur_id);
1107 }
1108 
1109 inline uint32 _game_session::Fetch_no_barriers() {
1110  // return number of current player barriers
1111  return (L->mega->number_of_barriers);
1112 }
1113 
1114 inline uint32 _game_session::Fetch_no_megas_barriers() {
1115  // return number of current player barriers
1116  return (M->number_of_barriers);
1117 }
1118 
1119 inline uint32 _game_session::Fetch_no_megas_nudge_barriers() {
1120  // return number of current player barriers
1121  return (M->number_of_nudge);
1122 }
1123 
1124 inline uint32 _game_session::External_fetch_no_megas_barriers(uint32 id) {
1125  // return number of current barriers
1126  // we are not in logic loop so can't rely on M, I, L etc.
1127 
1128  return (logic_structs[id]->mega->number_of_barriers);
1129 }
1130 
1131 inline uint32 _game_session::External_fetch_no_megas_anim_barriers(uint32 id) {
1132  // return number of current barriers
1133  // we are not in logic loop so can't rely on M, I, L etc.
1134 
1135  return (logic_structs[id]->mega->number_of_animating);
1136 }
1137 
1138 inline uint32 _game_session::External_fetch_no_megas_nudge_barriers(uint32 id) {
1139  // return number of current special player nudgebarriers
1140  // we are not in logic loop so can't rely on M, I, L etc.
1141 
1142  return (logic_structs[id]->mega->number_of_nudge);
1143 }
1144 
1145 inline uint32 _game_session::Fetch_megas_barrier_number(uint32 barrier) {
1146  // can only be called within logic loop
1147 
1148  assert(barrier < M->number_of_barriers + M->number_of_animating);
1149 
1150  return M->barrier_list[barrier];
1151 }
1152 
1153 inline uint32 _game_session::Fetch_megas_nudge_barrier_number(uint32 barrier) {
1154  // can only be called within logic loop
1155 
1156  assert(barrier < M->number_of_nudge);
1157 
1158  return M->nudge_list[barrier];
1159 }
1160 
1161 inline uint32 _game_session::External_fetch_megas_barrier(uint32 id, uint32 barrier) {
1162  // can only be called within logic loop
1163  assert(barrier < (logic_structs[id]->mega->number_of_barriers) + (logic_structs[id]->mega->number_of_animating));
1164 
1165  return logic_structs[id]->mega->barrier_list[barrier];
1166 }
1167 
1168 inline uint32 _game_session::External_fetch_megas_nudge_barrier(uint32 id, uint32 barrier) {
1169  // can only be called within logic loop
1170  assert(barrier < logic_structs[id]->mega->number_of_nudge);
1171 
1172  return logic_structs[id]->mega->nudge_list[barrier];
1173 }
1174 
1175 inline void _game_session::Set_objects_conversation_uid(uint32 id, uint32 uid) {
1176  if (id >= total_objects)
1177  Fatal_error("Object id %d out-of-range (total_objects=%d)", id, total_objects);
1178 
1179  logic_structs[id]->conversation_uid = uid;
1180 }
1181 
1182 inline uint32 _game_session::Return_objects_conversation_uid(uint32 id) {
1183  assert(id < total_objects);
1184 
1185  return (logic_structs[id]->conversation_uid);
1186 }
1187 
1188 inline const char *_game_session::Fetch_session_name() {
1189  return ((const char *)session_name);
1190 }
1191 
1192 inline const char *_game_session::Fetch_session_cluster() {
1193  return ((const char *)session_cluster);
1194 }
1195 
1196 inline const char *_game_session::Fetch_session_h_name() {
1197  return ((const char *)session_h_name);
1198 }
1199 
1200 inline const char *_game_session::Fetch_h_session_name() {
1201  return ((const char *)h_session_name);
1202 }
1203 
1204 inline uint32 _game_session::Fetch_session_cluster_hash() {
1205  return (session_cluster_hash);
1206 }
1207 
1208 inline uint32 _game_session::Fetch_object_integer_variable(const char *pcName, const char *pcVar) const {
1209  int32 nVariableNumber;
1210  CGame *pGameObject;
1211 
1212  // Get the object itself.
1213  pGameObject = (CGame *)LinkedDataObject::Fetch_item_by_name(objects, pcName);
1214 
1215  if (!pGameObject)
1216  Fatal_error("_game_session::Fetch_object_integer_variable( %s, %s ) couldn't find object", pcName, pcVar);
1217 
1218  // Find the position of the requested variable.
1219  nVariableNumber = CGameObject::GetVariable(pGameObject, pcVar);
1220 
1221  if (nVariableNumber == -1)
1222  Fatal_error("_game_session::Fetch_object_integer_variable( %s, %s ) couldn't find variable", pcName, pcVar);
1223 
1224  // Get the lvar.
1225  return (CGameObject::GetIntegerVariable(pGameObject, nVariableNumber));
1226 }
1227 
1228 inline PXcamera &_game_session::GetCamera() { return set.GetCamera(); }
1229 
1230 inline int32 _game_session::SetOK() { return set.OK(); }
1231 
1232 inline void _game_session::SetReset() { set.Reset(); }
1233 
1234 } // End of namespace ICB
1235 
1236 #endif
Definition: speech.h:72
Definition: set_pc.h:59
Definition: session.h:94
Definition: session.h:147
Definition: barriers.h:82
Definition: actor.h:32
Definition: object_structs.h:391
Definition: floors.h:39
Definition: session.h:86
Definition: session.h:173
Definition: map_marker.h:57
Definition: text_sprites.h:111
Definition: prim_route_builder.h:46
Definition: route_manager.h:74
Definition: px_linkeddatafile.h:53
Definition: object_structs.h:83
Definition: px_walkarea_integer.h:45
Definition: px_game_object.h:44
Definition: player.h:173
Definition: session.h:107
Definition: session.h:156
Definition: px_route_barriers.h:146
Definition: session.h:136
Definition: object_structs.h:211
Definition: px_camera.h:39