mirror of
https://github.com/Cesarus85/ringfall-mjolnir-vr.git
synced 2026-10-17 13:00:25 +02:00
wip objects.c work (#12)
* wip objects.c work * objects_disconnect_from_structure_bsp * match more functions * more objects work * objects_update work - 93.42% matching * match matrix4x3_transform_point * more objects work - fix duplicate symbol name at 1870800 * match object_choose_random_change_colors * match object_update * objects_garbage_collection work * match object_set_position * more object work * match objects_update * more object work * match object_select_random_region_permutations_by_variant * objects_in_sphere work 99.90% match * object name list calls * match objects_in_sphere * misc matches * match structure_bsp_definitions object * match objects_in_clusters_by_indices * more object work * match `edit_text_handle_key` * mark edit_text as matching * misc changes - match get_next_character - match data section in objects.c * object_export_function_values work * match object_compute_function_values * match object_get_orientation * added functions and adjust formatting * fix profile macros * formatting changes * more formatting * more formatting --------- Co-authored-by: punpckhdq <121350336+punpckhdq@users.noreply.github.com>
This commit is contained in:
1 parent
10bcbbce16
commit
eb93ce635e
87 files changed
+8336
-566
No files matched your search
+2
-2
@@ -430,7 +430,7 @@
|
||||
{ "name": "source/structures/structure_render.c", "index": 58, "status": "NonMatching" },
|
||||
{ "name": "source/structures/structure_lens_flares.c", "index": 59, "status": "NonMatching" },
|
||||
{ "name": "source/structures/structure_detail_objects.c", "index": 60, "status": "NonMatching" },
|
||||
{ "name": "source/structures/structure_bsp_definitions.c", "index": 61, "status": "NonMatching" },
|
||||
{ "name": "source/structures/structure_bsp_definitions.c", "index": 61, "status": "Matching" },
|
||||
{ "name": "source/structures/leaf_map.c", "index": 62, "status": "NonMatching" },
|
||||
{ "name": "source/structures/detail_object_definitions.c", "index": 63, "status": "Matching" },
|
||||
{ "name": "source/structures/cluster_partitions.c", "index": 64, "status": "NonMatching" },
|
||||
@@ -705,7 +705,7 @@
|
||||
{ "name": "source/dialogs/picture_control.c", "index": 333, "status": "Matching" },
|
||||
{ "name": "source/dialogs/list_control.c", "index": 334, "status": "Matching" },
|
||||
{ "name": "source/dialogs/edit_text_control.c", "index": 335, "status": "Matching" },
|
||||
{ "name": "source/dialogs/edit_text.c", "index": 336, "status": "NonMatching" },
|
||||
{ "name": "source/dialogs/edit_text.c", "index": 336, "status": "Matching" },
|
||||
{ "name": "source/dialogs/dialogs.c", "index": 337, "status": "Matching" },
|
||||
{ "name": "source/dialogs/dialog_templates.c", "index": 338, "status": "Matching" },
|
||||
{ "name": "source/dialogs/dialog_controls.c", "index": 339, "status": "Matching" },
|
||||
|
||||
+42
-41
@@ -1801,7 +1801,7 @@
|
||||
{ "file_offset": 546832, "flags": 32, "name": "_device_frontfacing" },
|
||||
{ "file_offset": 546960, "flags": 32, "name": "_device_set_desired_position" },
|
||||
{ "file_offset": 547024, "flags": 32, "name": "_device_set_power" },
|
||||
{ "file_offset": 547104, "flags": 32, "name": "_code_00085920" },
|
||||
{ "file_offset": 547104, "flags": 32, "name": "_edit_text_fix_selection" },
|
||||
{ "file_offset": 547232, "flags": 32, "name": "_edit_text_selection_reset" },
|
||||
{ "file_offset": 547344, "flags": 32, "name": "_edit_text_get_selection_indices" },
|
||||
{ "file_offset": 547504, "flags": 32, "name": "_edit_text_new" },
|
||||
@@ -3648,15 +3648,15 @@
|
||||
{ "file_offset": 862848, "flags": 32, "name": "_progress_bar_display" },
|
||||
{ "file_offset": 863008, "flags": 32, "name": "_terminal_initialize" },
|
||||
{ "file_offset": 863072, "flags": 32, "name": "_terminal_dispose" },
|
||||
{ "file_offset": 863120, "flags": 32, "name": "_code_000d2b90" },
|
||||
{ "file_offset": 863120, "flags": 32, "name": "_terminal_remove_line" },
|
||||
{ "file_offset": 863264, "flags": 32, "name": "_terminal_clear" },
|
||||
{ "file_offset": 863312, "flags": 32, "name": "_terminal_gets_active" },
|
||||
{ "file_offset": 863328, "flags": 32, "name": "_terminal_gets_begin" },
|
||||
{ "file_offset": 863456, "flags": 32, "name": "_terminal_gets_end" },
|
||||
{ "file_offset": 863488, "flags": 32, "name": "_code_000d2d00" },
|
||||
{ "file_offset": 863680, "flags": 32, "name": "_code_000d2dc0" },
|
||||
{ "file_offset": 863488, "flags": 32, "name": "_terminal_update_input" },
|
||||
{ "file_offset": 863680, "flags": 32, "name": "_terminal_update_output" },
|
||||
{ "file_offset": 863760, "flags": 32, "name": "_terminal_draw" },
|
||||
{ "file_offset": 864448, "flags": 32, "name": "_code_000d30c0" },
|
||||
{ "file_offset": 864448, "flags": 32, "name": "_terminal_new_line" },
|
||||
{ "file_offset": 864608, "flags": 32, "name": "_terminal_update" },
|
||||
{ "file_offset": 864656, "flags": 32, "name": "_terminal_printf" },
|
||||
{ "file_offset": 864960, "flags": 32, "name": "_code_000d32c0" },
|
||||
@@ -5223,37 +5223,37 @@
|
||||
{ "file_offset": 1234416, "flags": 32, "name": "_object_definition_predict" },
|
||||
{ "file_offset": 1234464, "flags": 32, "name": "_object_predict" },
|
||||
{ "file_offset": 1234640, "flags": 32, "name": "_object_beautify" },
|
||||
{ "file_offset": 1234720, "flags": 32, "name": "_code_0012d720" },
|
||||
{ "file_offset": 1234880, "flags": 32, "name": "_code_0012d7c0" },
|
||||
{ "file_offset": 1234720, "flags": 32, "name": "_object_header_new" },
|
||||
{ "file_offset": 1234880, "flags": 32, "name": "_object_header_delete" },
|
||||
{ "file_offset": 1234960, "flags": 32, "name": "_object_header_block_get" },
|
||||
{ "file_offset": 1235104, "flags": 32, "name": "_object_header_block_allocate" },
|
||||
{ "file_offset": 1235440, "flags": 32, "name": "_code_0012d9f0" },
|
||||
{ "file_offset": 1235520, "flags": 32, "name": "_code_0012da40" },
|
||||
{ "file_offset": 1236032, "flags": 32, "name": "_code_0012dc40" },
|
||||
{ "file_offset": 1236144, "flags": 32, "name": "_code_0012dcb0" },
|
||||
{ "file_offset": 1236288, "flags": 32, "name": "_code_0012dd40" },
|
||||
{ "file_offset": 1236320, "flags": 32, "name": "_code_0012dd60" },
|
||||
{ "file_offset": 1236512, "flags": 32, "name": "_code_0012de20" },
|
||||
{ "file_offset": 1236992, "flags": 32, "name": "_code_0012e000" },
|
||||
{ "file_offset": 1235440, "flags": 32, "name": "_object_postprocess_node_matrices" },
|
||||
{ "file_offset": 1235520, "flags": 32, "name": "_object_choose_random_change_colors" },
|
||||
{ "file_offset": 1236032, "flags": 32, "name": "_object_find_region_permutations_available_with_variant" },
|
||||
{ "file_offset": 1236144, "flags": 32, "name": "_object_determine_variant_number" },
|
||||
{ "file_offset": 1236288, "flags": 32, "name": "_object_add_to_list" },
|
||||
{ "file_offset": 1236320, "flags": 32, "name": "_object_remove_from_list" },
|
||||
{ "file_offset": 1236512, "flags": 32, "name": "_object_compute_change_colors" },
|
||||
{ "file_offset": 1236992, "flags": 32, "name": "_object_compute_function_values" },
|
||||
{ "file_offset": 1237888, "flags": 32, "name": "_object_scripting_set_collideable" },
|
||||
{ "file_offset": 1237952, "flags": 32, "name": "_object_marker_begin" },
|
||||
{ "file_offset": 1238032, "flags": 32, "name": "_object_marker_end" },
|
||||
{ "file_offset": 1238096, "flags": 32, "name": "_object_unmarked_function" },
|
||||
{ "file_offset": 1238176, "flags": 32, "name": "_object_mark_function" },
|
||||
{ "file_offset": 1238272, "flags": 32, "name": "_code_0012e500" },
|
||||
{ "file_offset": 1238704, "flags": 32, "name": "_code_0012e6b0" },
|
||||
{ "file_offset": 1238864, "flags": 32, "name": "_code_0012e750" },
|
||||
{ "file_offset": 1238928, "flags": 32, "name": "_code_0012e790" },
|
||||
{ "file_offset": 1238944, "flags": 32, "name": "_code_0012e7a0" },
|
||||
{ "file_offset": 1238976, "flags": 32, "name": "_code_0012e7c0" },
|
||||
{ "file_offset": 1239104, "flags": 32, "name": "_code_0012e840" },
|
||||
{ "file_offset": 1239184, "flags": 32, "name": "_code_0012e890" },
|
||||
{ "file_offset": 1238272, "flags": 32, "name": "_attachments_new" },
|
||||
{ "file_offset": 1238704, "flags": 32, "name": "_object_connect_lights" },
|
||||
{ "file_offset": 1238864, "flags": 32, "name": "_object_name_list_allocate" },
|
||||
{ "file_offset": 1238928, "flags": 32, "name": "_object_name_list_free" },
|
||||
{ "file_offset": 1238944, "flags": 32, "name": "_object_name_list_clear" },
|
||||
{ "file_offset": 1238976, "flags": 32, "name": "_object_name_list_new" },
|
||||
{ "file_offset": 1239104, "flags": 32, "name": "_object_name_list_delete" },
|
||||
{ "file_offset": 1239184, "flags": 32, "name": "_object_name_list_lookup" },
|
||||
{ "file_offset": 1239216, "flags": 32, "name": "_objects_place" },
|
||||
{ "file_offset": 1239248, "flags": 32, "name": "_code_0012e8d0" },
|
||||
{ "file_offset": 1239248, "flags": 32, "name": "_recursive_object_adder" },
|
||||
{ "file_offset": 1239408, "flags": 32, "name": "_find_objects_from_point_vector" },
|
||||
{ "file_offset": 1240016, "flags": 32, "name": "_code_0012ebd0" },
|
||||
{ "file_offset": 1240064, "flags": 32, "name": "_code_0012ec00" },
|
||||
{ "file_offset": 1240208, "flags": 32, "name": "_code_0012ec90" },
|
||||
{ "file_offset": 1240016, "flags": 32, "name": "_sort_dumps" },
|
||||
{ "file_offset": 1240064, "flags": 32, "name": "_object_add_to_dump" },
|
||||
{ "file_offset": 1240208, "flags": 32, "name": "_object_dump_write" },
|
||||
{ "file_offset": 1240320, "flags": 32, "name": "_objects_dump_memory" },
|
||||
{ "file_offset": 1241184, "flags": 32, "name": "_objects_initialize" },
|
||||
{ "file_offset": 1241504, "flags": 32, "name": "_objects_initialize_for_new_map" },
|
||||
@@ -5281,11 +5281,11 @@
|
||||
{ "file_offset": 1245088, "flags": 32, "name": "_objects_disconnect_from_structure_bsp" },
|
||||
{ "file_offset": 1245232, "flags": 32, "name": "_object_visible_to_any_player" },
|
||||
{ "file_offset": 1245728, "flags": 32, "name": "_object_pvs_activate" },
|
||||
{ "file_offset": 1245776, "flags": 32, "name": "_code_00130250" },
|
||||
{ "file_offset": 1245984, "flags": 32, "name": "_code_00130320" },
|
||||
{ "file_offset": 1246112, "flags": 32, "name": "_code_001303a0" },
|
||||
{ "file_offset": 1245776, "flags": 32, "name": "_object_select_random_region_permutations_by_variant" },
|
||||
{ "file_offset": 1245984, "flags": 32, "name": "_object_choose_random_region_permutations" },
|
||||
{ "file_offset": 1246112, "flags": 32, "name": "_object_create_attachments" },
|
||||
{ "file_offset": 1246160, "flags": 32, "name": "_objects_scripting_set_scale" },
|
||||
{ "file_offset": 1246224, "flags": 32, "name": "_code_00130410" },
|
||||
{ "file_offset": 1246224, "flags": 32, "name": "_object_delete_initial_recursive" },
|
||||
{ "file_offset": 1246480, "flags": 32, "name": "_object_delete" },
|
||||
{ "file_offset": 1246512, "flags": 32, "name": "_object_reconnect_to_map" },
|
||||
{ "file_offset": 1246976, "flags": 32, "name": "_object_get_node_matrix" },
|
||||
@@ -5303,19 +5303,19 @@
|
||||
{ "file_offset": 1250240, "flags": 32, "name": "_object_compute_node_matrices" },
|
||||
{ "file_offset": 1256800, "flags": 32, "name": "_objects_scripting_detach" },
|
||||
{ "file_offset": 1256864, "flags": 32, "name": "_object_render_debug" },
|
||||
{ "file_offset": 1258064, "flags": 32, "name": "_code_00133250" },
|
||||
{ "file_offset": 1258064, "flags": 32, "name": "_attachments_delete" },
|
||||
{ "file_offset": 1258288, "flags": 32, "name": "_object_set_position" },
|
||||
{ "file_offset": 1258544, "flags": 32, "name": "_object_translate" },
|
||||
{ "file_offset": 1258704, "flags": 32, "name": "_object_new" },
|
||||
{ "file_offset": 1260176, "flags": 32, "name": "_object_attach_to_node" },
|
||||
{ "file_offset": 1260608, "flags": 32, "name": "_object_force_inside_bsp" },
|
||||
{ "file_offset": 1260864, "flags": 32, "name": "_code_00133d40" },
|
||||
{ "file_offset": 1260864, "flags": 32, "name": "_object_update" },
|
||||
{ "file_offset": 1261296, "flags": 32, "name": "_object_compute_node_matrices_recursive" },
|
||||
{ "file_offset": 1261440, "flags": 32, "name": "_code_00133f80" },
|
||||
{ "file_offset": 1261440, "flags": 32, "name": "_object_delete_attachments" },
|
||||
{ "file_offset": 1261504, "flags": 32, "name": "_object_new_from_scenario" },
|
||||
{ "file_offset": 1261744, "flags": 32, "name": "_object_attach_to_marker" },
|
||||
{ "file_offset": 1261968, "flags": 32, "name": "_object_new_by_name" },
|
||||
{ "file_offset": 1262080, "flags": 32, "name": "_code_00134200" },
|
||||
{ "file_offset": 1262080, "flags": 32, "name": "_object_delete_recursive" },
|
||||
{ "file_offset": 1262384, "flags": 32, "name": "_objects_scripting_attach" },
|
||||
{ "file_offset": 1262464, "flags": 32, "name": "_object_delete_immediately" },
|
||||
{ "file_offset": 1262496, "flags": 32, "name": "_objects_garbage_collection" },
|
||||
@@ -7976,7 +7976,6 @@
|
||||
{ "file_offset": 1870665, "flags": 32, "name": "__fpmath" },
|
||||
{ "file_offset": 1870680, "flags": 32, "name": "__ftol2" },
|
||||
{ "file_offset": 1870800, "flags": 32, "name": "__chkstk" },
|
||||
{ "file_offset": 1870800, "flags": 32, "name": "__alloca_probe" },
|
||||
{ "file_offset": 1870816, "flags": 32, "name": "_sprintf" },
|
||||
{ "file_offset": 1870904, "flags": 32, "name": "__scprintf" },
|
||||
{ "file_offset": 1870953, "flags": 32, "name": "__snprintf" },
|
||||
@@ -18942,7 +18941,7 @@
|
||||
{ "file_offset": 2661600, "flags": 0, "name": "??_C@_0IC@DHNDHHAP@definition?9?$DOpalette_tag_block_of@" },
|
||||
{ "file_offset": 2661732, "flags": 0, "name": "??_C@_0CL@LMPCIGEO@definition?9?$DOpalette_tag_block_of@" },
|
||||
{ "file_offset": 2661776, "flags": 0, "name": "??_C@_07OBIJJHNE@?$CGmatrix?$AA@" },
|
||||
{ "file_offset": 2661784, "flags": 0, "name": "_rdata_00289d98" },
|
||||
{ "file_offset": 2661784, "flags": 0, "name": "_object_memory_release_procs" },
|
||||
{ "file_offset": 2661808, "flags": 0, "name": "??_C@_0P@LFOALBOL@objects_update?$AA@" },
|
||||
{ "file_offset": 2661824, "flags": 0, "name": "??_C@_0IM@GHLCLNJO@iterator?9?$DOcluster_partition?$DN?$DN?$CGco@" },
|
||||
{ "file_offset": 2661964, "flags": 0, "name": "??_C@_0CB@HJEGKKGJ@c?3?2halo?2SOURCE?2objects?2objects?4c@" },
|
||||
@@ -22155,7 +22154,7 @@
|
||||
{ "file_offset": 3195472, "flags": 0, "name": "_light_fixture_data_definition" },
|
||||
{ "file_offset": 3195632, "flags": 0, "name": "_placeholder_data_definition" },
|
||||
{ "file_offset": 3195792, "flags": 0, "name": "_object_type_definitions" },
|
||||
{ "file_offset": 3195840, "flags": 0, "name": "_data_0030c3c0" },
|
||||
{ "file_offset": 3195840, "flags": 0, "name": "?section@?1??objects_update@@9@9" },
|
||||
{ "file_offset": 3197368, "flags": 0, "name": "_debug_objects_bounding_spheres" },
|
||||
{ "file_offset": 3197376, "flags": 0, "name": "_data_0030c9c0" },
|
||||
{ "file_offset": 3197369, "flags": 0, "name": "_debug_objects_collision_models" },
|
||||
@@ -22434,7 +22433,7 @@
|
||||
{ "file_offset": 4538416, "flags": 0, "name": "_bss_00454030" },
|
||||
{ "file_offset": 4538888, "flags": 0, "name": "_progress_bar_mode" },
|
||||
{ "file_offset": 4538908, "flags": 0, "name": "_last_t" },
|
||||
{ "file_offset": 4538916, "flags": 0, "name": "_bss_00454224" },
|
||||
{ "file_offset": 4538916, "flags": 0, "name": "_terminal_globals" },
|
||||
{ "file_offset": 4538944, "flags": 0, "name": "_bss_00454240" },
|
||||
{ "file_offset": 4541168, "flags": 0, "name": "_bss_00454af0" },
|
||||
{ "file_offset": 4541192, "flags": 0, "name": "_single_player_level_data" },
|
||||
@@ -22481,7 +22480,9 @@
|
||||
{ "file_offset": 4550216, "flags": 0, "name": "_bss_00456e48" },
|
||||
{ "file_offset": 4550292, "flags": 0, "name": "_lights_game_globals" },
|
||||
{ "file_offset": 4550296, "flags": 0, "name": "_bss_00456e98" },
|
||||
{ "file_offset": 4550300, "flags": 0, "name": "_bss_00456e9c" },
|
||||
{ "file_offset": 4550300, "flags": 0, "name": "_object_name_list" },
|
||||
{ "file_offset": 4550304, "flags": 0, "name": "_object_memory_pool" },
|
||||
{ "file_offset": 4550308, "flags": 0, "name": "_object_globals" },
|
||||
{ "file_offset": 4550312, "flags": 0, "name": "_debug_objects_position_velocity" },
|
||||
{ "file_offset": 4550316, "flags": 0, "name": "_bss_00456eac" },
|
||||
{ "file_offset": 4550320, "flags": 0, "name": "_bss_00456eb0" },
|
||||
@@ -22552,7 +22553,7 @@
|
||||
{ "file_offset": 4984048, "flags": 0, "name": "_bss_004c0cf0" },
|
||||
{ "file_offset": 4985088, "flags": 0, "name": "_bss_004c1100" },
|
||||
{ "file_offset": 4987144, "flags": 0, "name": "_bss_004c1908" },
|
||||
{ "file_offset": 4987392, "flags": 0, "name": "_bss_004c1a00" },
|
||||
{ "file_offset": 4987392, "flags": 0, "name": "_global_language_code" },
|
||||
{ "file_offset": 4987400, "flags": 0, "name": "_bss_004c1a08" },
|
||||
{ "file_offset": 4987912, "flags": 0, "name": "_bss_004c1c08" },
|
||||
{ "file_offset": 5032720, "flags": 0, "name": "_debug_biped_physics" },
|
||||
|
||||
@@ -42,6 +42,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "actions.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
+66
-1
@@ -14,7 +14,72 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct ai_unit_information_look_data
|
||||
{
|
||||
long unit_index;
|
||||
};
|
||||
|
||||
struct ai_object_information_look_data
|
||||
{
|
||||
long object_index;
|
||||
};
|
||||
|
||||
struct ai_information_look_data
|
||||
{
|
||||
union
|
||||
{
|
||||
struct ai_unit_information_look_data unit;
|
||||
struct ai_object_information_look_data object;
|
||||
};
|
||||
};
|
||||
|
||||
struct ai_allegiance_information_data
|
||||
{
|
||||
short team1_index;
|
||||
short team2_index;
|
||||
boolean broken;
|
||||
};
|
||||
|
||||
struct ai_combat_stimulus_information_data
|
||||
{
|
||||
word pad;
|
||||
};
|
||||
|
||||
struct ai_target_knowledge_information_data
|
||||
{
|
||||
long prop_index;
|
||||
};
|
||||
|
||||
struct ai_information_data
|
||||
{
|
||||
union
|
||||
{
|
||||
struct ai_allegiance_information_data allegiance;
|
||||
struct ai_combat_stimulus_information_data combat_stimulus;
|
||||
struct ai_target_knowledge_information_data target_knowledge;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
struct ai_information_packet
|
||||
{
|
||||
long target_unit_index;
|
||||
short communication_type;
|
||||
short dialogue_type_index;
|
||||
short damage_category;
|
||||
boolean updated_dialogue_timers;
|
||||
short look_priority;
|
||||
short look_type;
|
||||
struct ai_information_look_data look_data;
|
||||
short information_type;
|
||||
struct ai_information_data information_data;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/AI.C */
|
||||
|
||||
boolean ai_release_inactive_swarms(char *result_description, unsigned char *more_to_release, unsigned char *working_memory, short working_memory_size);
|
||||
void ai_find_inactive_encounters(unsigned char *working_memory, short working_memory_size);
|
||||
boolean ai_release_inactive_encounters(char *result_description, unsigned char *more_to_release, unsigned char *working_memory, short working_memory_size);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ void ai_debug_change_selected_encounter(boolean a1);
|
||||
|
||||
void ai_debug_change_selected_actor(boolean a1);
|
||||
|
||||
char *ai_debug_describe_actor(long actor_index, long unit_index, boolean include_squad, char *buffer, long bufsize);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -62,6 +62,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "path.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
@@ -14,7 +14,23 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/BITMAPS.C */
|
||||
|
||||
/* ---------- prototypes/BITMAP_UTILITIES.C */
|
||||
|
||||
union real_rgb_color *rgb_colors_interpolate(
|
||||
union real_rgb_color *rgb_result,
|
||||
unsigned long flags,
|
||||
union real_rgb_color const *rgb_lower_bound,
|
||||
union real_rgb_color const *rgb_upper_bound,
|
||||
real u);
|
||||
union real_rgb_color *rgb_colors_interpolate_and_scale(
|
||||
union real_rgb_color *rgb_result,
|
||||
unsigned long flags,
|
||||
union real_argb_color const *argb_lower_bound,
|
||||
union real_argb_color const *argb_upper_bound,
|
||||
union real_rgb_color const *rgb_scale,
|
||||
real u);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
Vendored
+47
@@ -122,16 +122,63 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "cache_files.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct cache_file_tag_instance
|
||||
{
|
||||
long group_tag;
|
||||
long parent_group_tags[2];
|
||||
long tag_index;
|
||||
char *name;
|
||||
void *base_address;
|
||||
unsigned long unused[2];
|
||||
};
|
||||
|
||||
/* ---------- prototypes */
|
||||
|
||||
// TODO:
|
||||
/*static*/ struct cache_file_tag_instance *cache_get_tag_instance(long tag_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
void *tag_get(
|
||||
long group_tag,
|
||||
long tag_index)
|
||||
{
|
||||
char expected_group[16];
|
||||
char returned_group[16];
|
||||
|
||||
struct cache_file_tag_instance *tag_instance= cache_get_tag_instance(tag_index);
|
||||
match_vassert(
|
||||
"c:\\halo\\SOURCE\\cache\\cache_files.c",
|
||||
298,
|
||||
tag_instance->group_tag == group_tag ||
|
||||
tag_instance->parent_group_tags[0] == group_tag ||
|
||||
tag_instance->parent_group_tags[1] == group_tag,
|
||||
csprintf(
|
||||
temporary,
|
||||
"expected tag group '%s' but got '%s' for %08x",
|
||||
tag_to_string(group_tag, expected_group),
|
||||
tag_to_string(tag_instance->group_tag, returned_group),
|
||||
tag_index)
|
||||
);
|
||||
match_vassert(
|
||||
"c:\\halo\\SOURCE\\cache\\cache_files.c",
|
||||
302,
|
||||
tag_instance->base_address,
|
||||
csprintf(temporary, "can't get() a tag with a base address!")
|
||||
);
|
||||
|
||||
return tag_instance->base_address;
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
Vendored
+4
@@ -8,6 +8,10 @@ header included in hcex build.
|
||||
#define __CACHE_FILES_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "real_math.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
Vendored
+4
-1
@@ -14,7 +14,10 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/PREDICTED_RESOURCES.C */
|
||||
|
||||
void predicted_resources_precache(struct tag_block *predicted_resources);
|
||||
void predicted_resources_sound_precache(long sound_definition_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@ CSERIES.H
|
||||
#define __CSERIES_H
|
||||
#pragma once
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
|
||||
#include <StdDef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
@@ -42,6 +45,33 @@ enum
|
||||
CHAR_BITS_BITS= 3
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_x= 0,
|
||||
_y,
|
||||
_z,
|
||||
NUMBER_OF_RECTANGLE2D_COMPONENTS= 4,
|
||||
NUMBER_OF_RECTANGLE3D_COMPONENTS= 6,
|
||||
NUMBER_OF_VERTICES_PER_LINE= 2,
|
||||
NUMBER_OF_VERTICES_PER_TRIANGLE= 3,
|
||||
NUMBER_OF_VERTICES_PER_QUADRALATERAL= 4,
|
||||
NUMBER_OF_VERTICES_PER_QUADRILATERAL= 4,
|
||||
NUMBER_OF_VERTICES_PER_HEXAGON= 6,
|
||||
NUMBER_OF_VERTICES_PER_PYRAMID= 5,
|
||||
NUMBER_OF_VERTICES_PER_CUBE= 8,
|
||||
NUMBER_OF_TRIANGLES_PER_QUADRILATERAL= 2,
|
||||
NUMBER_OF_EDGES_PER_TRIANGLE= 3,
|
||||
NUMBER_OF_EDGES_PER_QUADRALATERAL= 4,
|
||||
NUMBER_OF_EDGES_PER_HEXAGON= 6,
|
||||
NUMBER_OF_FACES_PER_CUBE= 6,
|
||||
_rectangle_top_left= 0,
|
||||
_rectangle_bottom_left= 1,
|
||||
_rectangle_top_right= 2,
|
||||
_rectangle_bottom_right= 3,
|
||||
NUMBER_OF_POINTS_PER_RECTANGLE= 4,
|
||||
};
|
||||
|
||||
|
||||
#define NONE -1
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -82,7 +112,7 @@ enum
|
||||
#define PIN(n,floor,ceiling) ((n)<(floor) ? (floor) : CEILING(n,ceiling))
|
||||
|
||||
#define FLAG(b) (1<<(b))
|
||||
#define TEST_FLAG(flags, bit) ((flags)&(unsigned)FLAG(bit))
|
||||
#define TEST_FLAG(flags, bit) (((flags)&(unsigned)FLAG(bit))!=0)
|
||||
#define SET_FLAG(f, b, v) ((v) ? ((f)|=(unsigned)FLAG(b)) : ((f)&=(unsigned)~FLAG(b)))
|
||||
|
||||
#define BIT_VECTOR_SIZE_IN_LONGS(bit_count) (((bit_count) + (LONG_BITS - 1)) >> LONG_BITS_BITS)
|
||||
@@ -94,6 +124,12 @@ enum
|
||||
|
||||
#define NUMBEROF(array) (sizeof(array) / sizeof(array[0]))
|
||||
|
||||
#define VALID_INDEX(index, count) (index>=0 && index<count)
|
||||
|
||||
#define DATUM_INDEX_NEW(absolute_index, salt) ((absolute_index) | ((salt)<<SHORT_BITS))
|
||||
#define DATUM_INDEX_TO_ABSOLUTE_INDEX(datum_index) ((datum_index)&UNSIGNED_SHORT_MAX)
|
||||
#define DATUM_INDEX_TO_IDENTIFIER(datum_index) ((datum_index)>>SHORT_BITS)
|
||||
|
||||
/* ---------- fixed math */
|
||||
|
||||
#define SHORT_FIXED_TO_LONG(f) ((f)>>CHAR_BITS)
|
||||
|
||||
@@ -10,12 +10,41 @@ PROFILE.H
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define profile_enter(section) \
|
||||
if (profile_global_enable && section.profile_active) \
|
||||
{ \
|
||||
profile_enter_private(§ion); \
|
||||
} \
|
||||
|
||||
#define profile_exit(section) \
|
||||
if (profile_global_enable && section.profile_active) \
|
||||
{ \
|
||||
profile_exit_private(§ion); \
|
||||
} \
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct profile_section
|
||||
{
|
||||
const char *name;
|
||||
long section_index;
|
||||
boolean profile_active;
|
||||
short stack_depth;
|
||||
long field_C;
|
||||
unsigned __int64 field_10;
|
||||
char __unknown18[1460];
|
||||
long field_5CC;
|
||||
char __unknown5D0[40];
|
||||
};
|
||||
|
||||
/* ---------- prototypes/PROFILE.C */
|
||||
|
||||
void profile_initialize(void);
|
||||
|
||||
void profile_enter_private(struct profile_section *objects_update_section);
|
||||
|
||||
void profile_exit_private(struct profile_section *objects_update_section);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
/* comm */
|
||||
|
||||
@@ -151,7 +151,7 @@ struct _stack_walk_globals stack_walk_globals=
|
||||
void stack_walk_disregard_symbol_names(
|
||||
boolean disregard)
|
||||
{
|
||||
stack_walk_globals.disregard_symbol_names = disregard;
|
||||
stack_walk_globals.disregard_symbol_names= disregard;
|
||||
}
|
||||
|
||||
void free_symbol_table(
|
||||
|
||||
@@ -8,12 +8,103 @@ header included in hcex build.
|
||||
#define __DEVICE_DEFINITIONS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "objects/object_definitions.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
DEVICE_DEFINITION_TAG= 'devi',
|
||||
DEVICE_DEFINITION_VERSION= 1,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_device_position_loops_bit= 0,
|
||||
_device_position_animation_not_interpolated_bit,
|
||||
NUMBER_OF_DEVICE_DEFINITION_FLAGS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MACHINE_DEFINITION_TAG= 'mach',
|
||||
MACHINE_DEFINITION_VERSION= 1,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_machine_is_pathfinding_obstacle_bit= 0,
|
||||
_machine_is_not_pathfinding_obstacle_when_open_bit,
|
||||
_machine_is_elevator_bit,
|
||||
NUMBER_OF_MACHINE_FLAGS,
|
||||
};
|
||||
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define device_definition_get(index) ((struct device_definition *)tag_get(DEVICE_DEFINITION_TAG, index))
|
||||
|
||||
#define machine_definition_get(index) ((struct machine_definition *)tag_get(MACHINE_DEFINITION_TAG, index))
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct _device_definition
|
||||
{
|
||||
unsigned int flags;
|
||||
real power_transition_time;
|
||||
real power_acceleration_time;
|
||||
real powered_position_transition_time;
|
||||
real powered_position_acceleration_time;
|
||||
real depowered_position_transition_time;
|
||||
real depowered_position_acceleration_time;
|
||||
short function_modes[4];
|
||||
struct tag_reference positive_start_effect;
|
||||
struct tag_reference negative_start_effect;
|
||||
struct tag_reference positive_stop_effect;
|
||||
struct tag_reference negative_stop_effect;
|
||||
struct tag_reference depowered_effect;
|
||||
struct tag_reference repowered_effect;
|
||||
real delay_time;
|
||||
unsigned long delay_unused[2];
|
||||
struct tag_reference delay_effect;
|
||||
real automatic_activation_radius;
|
||||
unsigned long unused[21];
|
||||
real runtime_maximum_power_acceleration;
|
||||
real runtime_maximum_power_velocity;
|
||||
real runtime_maximum_depowered_position_acceleration;
|
||||
real runtime_maximum_depowered_position_velocity;
|
||||
real runtime_maximum_powered_position_acceleration;
|
||||
real runtime_maximum_powered_position_velocity;
|
||||
real runtime_delay_ticks;
|
||||
};
|
||||
|
||||
struct device_definition
|
||||
{
|
||||
struct _object_definition object;
|
||||
struct _device_definition device;
|
||||
};
|
||||
|
||||
struct _machine_definition
|
||||
{
|
||||
short type;
|
||||
word flags;
|
||||
real door_open_time;
|
||||
unsigned long unused1[20];
|
||||
short collision_response;
|
||||
short elevator_node_index;
|
||||
unsigned int unused2[13];
|
||||
long runtime_door_open_ticks;
|
||||
};
|
||||
|
||||
struct machine_definition
|
||||
{
|
||||
struct _object_definition object;
|
||||
struct _device_definition device;
|
||||
struct _machine_definition machine;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
@@ -8,13 +8,70 @@ header included in hcex build.
|
||||
#define __DEVICES_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "objects/objects.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
_scenario_device_initially_open_bit= 0,
|
||||
_scenario_device_initially_off_bit,
|
||||
_scenario_device_changes_only_once_bit,
|
||||
_scenario_device_position_reversed_bit,
|
||||
_scenario_device_not_usable_bit,
|
||||
SCENARIO_DEVICE_DATUM_FLAGS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_machine_does_not_operate_automatically_bit= 0,
|
||||
_machine_one_sided_bit,
|
||||
_machine_never_appears_locked_bit,
|
||||
_machine_opened_by_melee_attack_bit,
|
||||
NUMBER_OF_MACHINE_DATUM_FLAGS,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct _device_datum
|
||||
{
|
||||
unsigned long flags;
|
||||
short power_group_index;
|
||||
real power;
|
||||
real power_velocity;
|
||||
short position_group_index;
|
||||
real position;
|
||||
real position_velocity;
|
||||
short delay_ticks;
|
||||
};
|
||||
|
||||
struct device_datum
|
||||
{
|
||||
long definition_index;
|
||||
struct _object_datum object;
|
||||
struct _device_datum device;
|
||||
};
|
||||
|
||||
struct _machine_datum
|
||||
{
|
||||
unsigned long flags;
|
||||
long door_open_ticks;
|
||||
real_point3d elevator_position;
|
||||
};
|
||||
|
||||
struct machine_datum
|
||||
{
|
||||
long definition_index;
|
||||
struct _object_datum object;
|
||||
struct _device_datum device;
|
||||
struct _machine_datum machine;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/DEVICES.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "edit_text.h"
|
||||
|
||||
#include "input/input.h"
|
||||
#include "text/international_strings.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -28,8 +34,216 @@ symbols in this file:
|
||||
|
||||
/* ---------- prototypes */
|
||||
|
||||
static void edit_text_fix_selection(struct edit_text *edit);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
void edit_text_new(
|
||||
struct edit_text *edit)
|
||||
{
|
||||
match_assert("c:\\halo\\SOURCE\\dialogs\\edit_text.c", 25, valid_edit_text(edit));
|
||||
edit_text_selection_reset(edit);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void edit_text_handle_key(
|
||||
struct edit_text *edit,
|
||||
struct key_stroke const *key)
|
||||
{
|
||||
boolean backspace;
|
||||
|
||||
match_assert("c:\\halo\\SOURCE\\dialogs\\edit_text.c", 35, valid_edit_text(edit));
|
||||
edit_text_fix_selection(edit);
|
||||
|
||||
if (key->key_code==_key_backspace)
|
||||
{
|
||||
backspace= TRUE;
|
||||
}
|
||||
|
||||
if (key->key_code==_key_backspace ||
|
||||
key->key_code==_key_delete)
|
||||
{
|
||||
short selection_end;
|
||||
short selection_start;
|
||||
|
||||
if (edit_text_get_selection_indices(
|
||||
edit,
|
||||
&selection_start,
|
||||
&selection_end))
|
||||
{
|
||||
memmove(
|
||||
&edit->buffer[selection_start],
|
||||
&edit->buffer[selection_end],
|
||||
strlen(&edit->buffer[selection_end])+1);
|
||||
edit->insertion_point_index= selection_start;
|
||||
edit->selection_start_index= NONE;
|
||||
}
|
||||
else if (key->key_code==_key_backspace &&
|
||||
edit->insertion_point_index > 0)
|
||||
{
|
||||
short src_index= edit->insertion_point_index;
|
||||
get_previous_character(
|
||||
(unsigned char *)edit->buffer,
|
||||
&edit->insertion_point_index);
|
||||
memmove(
|
||||
&edit->buffer[edit->insertion_point_index],
|
||||
&edit->buffer[src_index],
|
||||
strlen(&edit->buffer[src_index])+1);
|
||||
}
|
||||
else if (key->key_code == _key_delete)
|
||||
{
|
||||
if (edit->insertion_point_index < strlen(edit->buffer))
|
||||
{
|
||||
short next_index= edit->insertion_point_index;
|
||||
get_next_character(
|
||||
(unsigned char *)edit->buffer,
|
||||
&next_index
|
||||
);
|
||||
memmove(
|
||||
&edit->buffer[edit->insertion_point_index],
|
||||
&edit->buffer[next_index],
|
||||
strlen(&edit->buffer[next_index])+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (
|
||||
key->key_code==_key_left_arrow ||
|
||||
key->key_code==_key_right_arrow)
|
||||
{
|
||||
short selection_end;
|
||||
short selection_start;
|
||||
|
||||
if (TEST_FLAG(key->modifier_flags, 0) ||
|
||||
!edit_text_get_selection_indices(
|
||||
edit,
|
||||
&selection_start,
|
||||
&selection_end))
|
||||
{
|
||||
if (TEST_FLAG(key->modifier_flags, 0) && edit->selection_start_index==NONE)
|
||||
{
|
||||
edit->selection_start_index= edit->insertion_point_index;
|
||||
}
|
||||
|
||||
if (key->key_code==_key_left_arrow && edit->insertion_point_index>0)
|
||||
{
|
||||
get_previous_character(
|
||||
(unsigned char *)edit->buffer,
|
||||
&edit->insertion_point_index);
|
||||
}
|
||||
else if (key->key_code==_key_right_arrow)
|
||||
{
|
||||
if (edit->insertion_point_index<strlen(edit->buffer))
|
||||
{
|
||||
get_next_character(
|
||||
(unsigned char *)edit->buffer,
|
||||
&edit->insertion_point_index);
|
||||
}
|
||||
}
|
||||
|
||||
if (edit->selection_start_index==edit->insertion_point_index)
|
||||
{
|
||||
edit->selection_start_index= NONE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (key->key_code==_key_left_arrow)
|
||||
{
|
||||
edit->insertion_point_index= selection_start;
|
||||
edit->selection_start_index= NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
edit->insertion_point_index= selection_end;
|
||||
edit->selection_start_index= NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (key->ascii_code && key->ascii_code!=(byte)NONE)
|
||||
{
|
||||
short selection_end;
|
||||
short selection_start;
|
||||
|
||||
if (edit_text_get_selection_indices(
|
||||
edit,
|
||||
&selection_start,
|
||||
&selection_end))
|
||||
{
|
||||
memmove(
|
||||
&edit->buffer[selection_start+1],
|
||||
&edit->buffer[selection_end],
|
||||
strlen(&edit->buffer[selection_end])+1);
|
||||
|
||||
edit->insertion_point_index= selection_start;
|
||||
edit->selection_start_index= NONE;
|
||||
edit->buffer[edit->insertion_point_index++]= key->ascii_code;
|
||||
}
|
||||
else if (strlen(edit->buffer)<edit->maximum_length)
|
||||
{
|
||||
memmove(
|
||||
&edit->buffer[edit->insertion_point_index+1],
|
||||
&edit->buffer[edit->insertion_point_index],
|
||||
strlen(&edit->buffer[edit->insertion_point_index])+1);
|
||||
edit->buffer[edit->insertion_point_index++]= key->ascii_code;
|
||||
}
|
||||
}
|
||||
|
||||
align_to_character(
|
||||
(unsigned char *)edit->buffer,
|
||||
&edit->insertion_point_index);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
boolean edit_text_get_selection_indices(struct edit_text *edit, short *start_index, short *end_index)
|
||||
{
|
||||
boolean result= FALSE;
|
||||
match_assert("c:\\halo\\SOURCE\\dialogs\\edit_text.c", 174, valid_edit_text(edit));
|
||||
edit_text_fix_selection(edit);
|
||||
|
||||
if (edit->selection_start_index != NONE)
|
||||
{
|
||||
*start_index= edit->selection_start_index > edit->insertion_point_index ? edit->insertion_point_index : edit->selection_start_index;
|
||||
*end_index= edit->selection_start_index > edit->insertion_point_index ? edit->selection_start_index : edit->insertion_point_index;
|
||||
result= TRUE;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void edit_text_selection_reset(
|
||||
struct edit_text *edit)
|
||||
{
|
||||
match_assert("c:\\halo\\SOURCE\\dialogs\\edit_text.c", 159, valid_edit_text(edit));
|
||||
edit_text_fix_selection(edit);
|
||||
edit->insertion_point_index= (short)strlen(edit->buffer);
|
||||
edit->selection_start_index= NONE;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
|
||||
static void edit_text_fix_selection(
|
||||
struct edit_text *edit)
|
||||
{
|
||||
short length= (short)strlen(edit->buffer);
|
||||
edit->insertion_point_index= PIN(edit->insertion_point_index, 0, length);
|
||||
edit->selection_start_index= PIN(edit->selection_start_index, NONE, length);
|
||||
|
||||
if (edit->insertion_point_index == edit->selection_start_index)
|
||||
{
|
||||
edit->selection_start_index= NONE;
|
||||
}
|
||||
|
||||
align_to_character((unsigned char *)edit->buffer, &edit->insertion_point_index);
|
||||
if (edit->selection_start_index != NONE)
|
||||
{
|
||||
align_to_character((unsigned char*)edit->buffer, &edit->selection_start_index);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -27,12 +27,9 @@ struct edit_text
|
||||
|
||||
/* ---------- prototypes/EDIT_TEXT.C */
|
||||
|
||||
void edit_text_handle_key(struct edit_text *edit, struct key_stroke const *key);
|
||||
|
||||
boolean edit_text_get_selection_indices(struct edit_text *edit, short *start_index, short *end_index);
|
||||
|
||||
void edit_text_new(struct edit_text *edit);
|
||||
|
||||
void edit_text_handle_key(struct edit_text *edit, struct key_stroke const *key);
|
||||
boolean edit_text_get_selection_indices(struct edit_text *edit, short *start_index, short *end_index);
|
||||
void edit_text_selection_reset(struct edit_text *edit);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
@@ -10,6 +10,13 @@ header included in hcex build.
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
CONTRAIL_DEFINITION_TAG= 'cont',
|
||||
CONTRAIL_DEFINITION_VERSION= 3,
|
||||
MAXIMUM_CONTRAIL_POINT_STATES_PER_CONTRAIL= 16,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
@@ -14,7 +14,10 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/CONTRAILS.C */
|
||||
|
||||
long contrail_new(long definition_index, long object_index, short attachment_index);
|
||||
void contrail_owner_collision(long contrail_index, unsigned char object_dying, real dt);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -10,6 +10,16 @@ header included in hcex build.
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
EFFECT_DEFINITION_TAG= 'effe',
|
||||
EFFECT_DEFINITION_VERSION= 4,
|
||||
MAXIMUM_EFFECT_PARTICLES_PER_EVENT= 32,
|
||||
MAXIMUM_EFFECT_PARTS_PER_EVENT= 32,
|
||||
MAXIMUM_EFFECT_LOCATIONS= 32,
|
||||
MAXIMUM_EFFECT_EVENTS= 32,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
@@ -14,7 +14,26 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/EFFECTS.C */
|
||||
|
||||
long effect_new_looping(
|
||||
long definition_index,
|
||||
long object_index,
|
||||
short scale_a_function_index,
|
||||
short scale_b_function_index,
|
||||
short change_color_index);
|
||||
|
||||
long effect_new_from_object(
|
||||
long definition_index,
|
||||
long owner_object_index,
|
||||
long object_index,
|
||||
short force_local_player_index,
|
||||
real scale_a,
|
||||
real scale_b,
|
||||
real_rgb_color const *color,
|
||||
struct effect_vector_field const *impulse_field);
|
||||
|
||||
void effect_delete(long effect_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -10,6 +10,12 @@ header included in hcex build.
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
PARTICLE_SYSTEM_DEFINITION_TAG= 'pctl',
|
||||
PARTICLE_SYSTEM_DEFINITION_VERSION= 4,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
@@ -14,7 +14,11 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/PARTICLE_SYSTEMS.C */
|
||||
|
||||
long particle_system_new_attached(long definition_index, long object_index, short attachment_index);
|
||||
|
||||
void particle_system_orphan(long system_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
+63
-1
@@ -32,6 +32,68 @@ enum
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct slayer_statistics
|
||||
{
|
||||
short ignored;
|
||||
};
|
||||
|
||||
struct ctf_statistics
|
||||
{
|
||||
short flag_grabs;
|
||||
short flag_returns;
|
||||
short flag_scores;
|
||||
};
|
||||
|
||||
struct oddball_statistics
|
||||
{
|
||||
short time_with_the_ball;
|
||||
short ball_carrier_kills;
|
||||
short kills_as_ball_carrier;
|
||||
};
|
||||
|
||||
struct king_statistics
|
||||
{
|
||||
short time_on_hill;
|
||||
};
|
||||
|
||||
struct race_statistics
|
||||
{
|
||||
short last_lap_time;
|
||||
short laps;
|
||||
short best_lap_time;
|
||||
};
|
||||
|
||||
union multiplayer_statistics
|
||||
{
|
||||
struct slayer_statistics slayer_statistics;
|
||||
struct ctf_statistics ctf_statistics;
|
||||
struct oddball_statistics oddball_statistics;
|
||||
struct king_statistics king_statistics;
|
||||
struct race_statistics race_statistics;
|
||||
};
|
||||
|
||||
struct game_statistics
|
||||
{
|
||||
short sort_key;
|
||||
short games_played;
|
||||
short games_won;
|
||||
short kills_in_a_row;
|
||||
short multiple_kills;
|
||||
short last_kill_time;
|
||||
short kills[4];
|
||||
short assists[4];
|
||||
short friendly_fire_kills;
|
||||
short deaths;
|
||||
short suicides;
|
||||
long shots_fired;
|
||||
long shots_hit;
|
||||
long seconds_online;
|
||||
short killed_teammate_since_last_death;
|
||||
short custom_data_size;
|
||||
union multiplayer_statistics multiplayer_statistics;
|
||||
};
|
||||
|
||||
|
||||
/* ---------- prototypes/GAME.C */
|
||||
|
||||
void game_initialize(void);
|
||||
@@ -42,7 +104,7 @@ void game_unload(void);
|
||||
void game_dispose_from_old_map(void);
|
||||
void game_frame(real dt);
|
||||
void remove_quitting_players_from_game(void);
|
||||
void game_tick(int ticks_remaining_this_frame);
|
||||
void game_tick(long ticks_remaining_this_frame);
|
||||
void game_options_new(struct game_options *options);
|
||||
boolean game_options_verify(struct game_options *options);
|
||||
void game_initial_pulse(void);
|
||||
|
||||
@@ -536,6 +536,11 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "game_engine.h"
|
||||
|
||||
#include "objects.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -546,6 +551,38 @@ symbols in this file:
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
struct game_engine *game_engine;
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
boolean game_engine_running(
|
||||
void)
|
||||
{
|
||||
return game_engine!=NULL;
|
||||
}
|
||||
|
||||
long game_engine_remap_object_definition(
|
||||
long definition_index)
|
||||
{
|
||||
if (game_engine_running() && definition_index!=NONE)
|
||||
{
|
||||
switch (object_definition_get(definition_index)->object.type)
|
||||
{
|
||||
case _object_type_vehicle:
|
||||
definition_index= game_engine_remap_vehicle(definition_index);
|
||||
break;
|
||||
case _object_type_weapon:
|
||||
definition_index= game_engine_remap_weapon(definition_index);
|
||||
break;
|
||||
case _object_type_equipment:
|
||||
definition_index= game_engine_remap_equipment(definition_index);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return definition_index;
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -14,10 +14,20 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/GAME_ENGINE.C */
|
||||
|
||||
boolean game_engine_running(void);
|
||||
|
||||
long game_engine_remap_object_definition(long definition_index);
|
||||
|
||||
long game_engine_remap_vehicle(long vehicle_definition_index);
|
||||
long game_engine_remap_equipment(long equipment_definition_index);
|
||||
long game_engine_remap_weapon(long weapon_definition_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
extern struct game_engine *game_engine;
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
#endif // __GAME_ENGINE_H
|
||||
@@ -10,12 +10,78 @@ header included in hcex build.
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
_player_powerup_active_camouflage= 0,
|
||||
_player_powerup_full_spectrum_vision,
|
||||
NUMBER_OF_PLAYER_POWERUPS,
|
||||
};
|
||||
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define player_get(index) ((struct player_datum*)datum_get(player_data, index))
|
||||
#define player_try_and_get(index) ((struct player_datum*)datum_try_and_get(player_data, index))
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct player_action
|
||||
{
|
||||
unsigned long control_flags;
|
||||
real_euler_angles2d desired_facing;
|
||||
real_vector2d throttle;
|
||||
real primary_trigger;
|
||||
short desired_weapon_index;
|
||||
short desired_grenade_index;
|
||||
short desired_zoom_level;
|
||||
short pad;
|
||||
};
|
||||
|
||||
struct network_player
|
||||
{
|
||||
wchar_t name[12];
|
||||
short primary_color_index;
|
||||
short icon_index;
|
||||
char machine_index;
|
||||
char controller_index;
|
||||
char team_index;
|
||||
char player_list_index;
|
||||
};
|
||||
|
||||
struct player_datum
|
||||
{
|
||||
short identifier;
|
||||
short local_player_index;
|
||||
wchar_t name[12];
|
||||
long squad_index;
|
||||
long team_index;
|
||||
long action_object_index;
|
||||
short action_result;
|
||||
short action_seat_index;
|
||||
long respawn_timer;
|
||||
long respawn_penalty;
|
||||
long unit_index;
|
||||
long dead_unit_index;
|
||||
short cluster_index;
|
||||
boolean swapped_weapons;
|
||||
byte pad0;
|
||||
long aim_assist_unit_index;
|
||||
long aim_assist_timestamp;
|
||||
struct network_player network_player_data;
|
||||
short powerup_durations[NUMBER_OF_PLAYER_POWERUPS];
|
||||
struct game_statistics statistics;
|
||||
long telefrag_timeout;
|
||||
long quit_out_of_game_time;
|
||||
boolean is_blocking_teleporter;
|
||||
boolean quit_out_of_game;
|
||||
struct player_action action_input;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/PLAYERS.C */
|
||||
|
||||
unsigned long const *players_get_combined_pvs_local(void);
|
||||
unsigned long const *players_get_combined_pvs(void);
|
||||
|
||||
void player_control_fix_for_loaded_game_state(void);
|
||||
|
||||
/* ---------- prototypes/PLAYER_QUEUES_NEW.C */
|
||||
@@ -24,6 +90,9 @@ void update_queues_reset_and_fill_with_lies(void);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
/* comm */
|
||||
struct data_array* player_data;
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
#endif // __PLAYERS_H
|
||||
@@ -213,7 +213,7 @@ void terminal_draw(
|
||||
|
||||
if (terminal_globals.initialized)
|
||||
{
|
||||
struct font_header *font= (struct font_header *)tag_get(FONT_GROUP_TAG, font_tag_index);
|
||||
struct font_header *font= font_definition_get(font_tag_index);
|
||||
short line_height= font->ascending_height + font->descending_height + font->leading_height;
|
||||
if (terminal_globals.input_state)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,9 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/WEAPONS.C */
|
||||
|
||||
boolean weapon_is_flag(long weapon_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -265,7 +265,7 @@ short ceiling_log2(
|
||||
}
|
||||
|
||||
unsigned long floor_power2(
|
||||
unsigned short x)
|
||||
word x)
|
||||
{
|
||||
long result= 1;
|
||||
while (result*2<= x)
|
||||
@@ -277,7 +277,7 @@ unsigned long floor_power2(
|
||||
}
|
||||
|
||||
unsigned long ceiling_power2(
|
||||
unsigned short x)
|
||||
word x)
|
||||
{
|
||||
long result= 1;
|
||||
while (result < x)
|
||||
|
||||
@@ -10,7 +10,7 @@ INTEGER_MATH.H
|
||||
|
||||
enum
|
||||
{
|
||||
_adjust_rectangle_center = 0,
|
||||
_adjust_rectangle_center= 0,
|
||||
_adjust_rectangle_alert,
|
||||
NUMBER_OF_ADJUST_RECTANGLE_MODES,
|
||||
};
|
||||
@@ -33,6 +33,14 @@ union rectangle2d
|
||||
};
|
||||
typedef union rectangle2d rectangle2d;
|
||||
|
||||
union byte_rectangle3d
|
||||
{
|
||||
byte n[6];
|
||||
struct { byte x0, x1, y0, y1, z0, z1; };
|
||||
};
|
||||
typedef union byte_rectangle3d byte_rectangle3d;
|
||||
|
||||
|
||||
typedef unsigned long pixel32;
|
||||
|
||||
/* ---------- prototypes/INTEGER_MATH.C */
|
||||
@@ -54,8 +62,8 @@ unsigned char equal_rectangle2d(const rectangle2d *r1, const rectangle2d *r2);
|
||||
unsigned char equal_point2d(const point2d *p1, const point2d *p2);
|
||||
short floor_log2(unsigned long k);
|
||||
short ceiling_log2(unsigned long k);
|
||||
unsigned long floor_power2(unsigned short x);
|
||||
unsigned long ceiling_power2(unsigned short x);
|
||||
unsigned long floor_power2(word x);
|
||||
unsigned long ceiling_power2(word x);
|
||||
unsigned long integer_square_root(unsigned long k);
|
||||
unsigned char bit_vector_and(short count, const unsigned long *v0, const unsigned long *v1, unsigned long *result);
|
||||
void bit_vector_or(short count, const unsigned long *v0, const unsigned long *v1, unsigned long *result);
|
||||
|
||||
@@ -86,6 +86,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "real_math.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -98,4 +101,122 @@ symbols in this file:
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
void matrix4x3_inverse(
|
||||
real_matrix4x3 const *matrix,
|
||||
real_matrix4x3 *result)
|
||||
{
|
||||
if (matrix->scale!=0.f)
|
||||
{
|
||||
real temp;
|
||||
|
||||
real x= -matrix->position.x;
|
||||
real y= -matrix->position.y;
|
||||
real z= -matrix->position.z;
|
||||
|
||||
if (matrix->scale!=1.f)
|
||||
{
|
||||
real scale= 1.f / matrix->scale;
|
||||
result->scale= scale;
|
||||
x *= scale;
|
||||
y *= scale;
|
||||
z *= scale;
|
||||
}
|
||||
else
|
||||
{
|
||||
result->scale= 1.f;
|
||||
}
|
||||
|
||||
result->n[0][0]= matrix->n[0][0];
|
||||
result->n[1][1]= matrix->n[1][1];
|
||||
result->n[2][2]= matrix->n[2][2];
|
||||
|
||||
temp= matrix->n[1][0];
|
||||
result->n[1][0]= matrix->n[0][1];
|
||||
result->n[0][1]= temp;
|
||||
|
||||
temp= matrix->n[2][0];
|
||||
result->n[2][0]= matrix->n[0][2];
|
||||
result->n[0][2]= temp;
|
||||
|
||||
temp= matrix->n[2][1];
|
||||
result->n[2][1]= matrix->n[1][2];
|
||||
result->n[1][2]= temp;
|
||||
|
||||
result->n[3][0]= (x*result->n[0][0]) + y*result->n[1][0] + (z*result->n[2][0]);
|
||||
result->n[3][1]= (x*result->n[0][1]) + y*result->n[1][1] + (z*result->n[2][1]);
|
||||
result->n[3][2]= (x*result->n[0][2]) + y*result->n[1][2] + (z*result->n[2][2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(result, 0, sizeof(*result));
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void matrix4x3_rotation_from_vectors(
|
||||
real_matrix4x3 *matrix,
|
||||
real_vector3d const *forward,
|
||||
real_vector3d const *up)
|
||||
|
||||
{
|
||||
matrix->scale= 1.f;
|
||||
matrix->forward= *forward;
|
||||
cross_product3d(up, forward, &matrix->left);
|
||||
|
||||
matrix->up= *up;
|
||||
set_real_point3d(&matrix->position, 0.f, 0.f, 0.f);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void matrix4x3_from_point_and_vectors(
|
||||
real_matrix4x3 *matrix,
|
||||
real_point3d const *point,
|
||||
real_vector3d const *forward,
|
||||
real_vector3d const *up)
|
||||
{
|
||||
matrix4x3_rotation_from_vectors(matrix, forward, up);
|
||||
matrix->position= *point;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
real_point3d *matrix4x3_transform_point(
|
||||
real_matrix4x3 const *matrix,
|
||||
real_point3d const *point,
|
||||
real_point3d *result)
|
||||
{
|
||||
real x= point->x;
|
||||
real y= point->y;
|
||||
real z= point->z;
|
||||
|
||||
if (matrix->scale != 1.f)
|
||||
{
|
||||
x *= matrix->scale;
|
||||
y *= matrix->scale;
|
||||
z *= matrix->scale;
|
||||
}
|
||||
|
||||
result->x= matrix->up.i*z + matrix->left.i*y + matrix->forward.i*x + matrix->position.x;
|
||||
result->y= matrix->up.j*z + matrix->left.j*y + matrix->forward.j*x + matrix->position.y;
|
||||
result->z= matrix->up.k*z + matrix->left.k*y + matrix->forward.k*x + matrix->position.z;
|
||||
return result;
|
||||
}
|
||||
|
||||
real_vector3d *matrix4x3_transform_normal(
|
||||
real_matrix4x3 const *matrix,
|
||||
real_vector3d const *normal,
|
||||
real_vector3d *result)
|
||||
{
|
||||
real i= normal->i;
|
||||
real j= normal->j;
|
||||
real k= normal->k;
|
||||
|
||||
result->i= i*matrix->forward.i + j*matrix->left.i + k*matrix->up.i;
|
||||
result->j= i*matrix->forward.j + j*matrix->left.j + k*matrix->up.j;
|
||||
result->k= i*matrix->forward.k + j*matrix->left.k + k*matrix->up.k;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -90,6 +90,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "periodic_functions.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
@@ -8,13 +8,31 @@ header included in hcex build.
|
||||
#define __PERIODIC_FUNCTIONS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "math/real_math.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
_transition_function_linear= 0,
|
||||
_transition_function_early,
|
||||
_transition_function_very_early,
|
||||
_transition_function_late,
|
||||
_transition_function_very_late,
|
||||
_transition_function_cosine,
|
||||
NUMBER_OF_TRANSITION_FUNCTIONS,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/PERIODIC_FUNCTIONS.C */
|
||||
|
||||
real periodic_function_evaluate(short function_type, real time);
|
||||
real transition_function_evaluate(short function_type, real value);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -237,6 +237,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "real_math.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -247,6 +250,42 @@ symbols in this file:
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
static const real_matrix4x3 private_identity4x3 =
|
||||
{
|
||||
1.f,
|
||||
{
|
||||
{ 1.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f }
|
||||
},
|
||||
};
|
||||
|
||||
static const real_matrix4x3 private_negative_identity4x3 =
|
||||
{
|
||||
1.f,
|
||||
{
|
||||
{ -1.f, 0.f, 0.f, 0.f, -1.f, 0.f, 0.f, 0.f, -1.f, 0.f, 0.f, 0.f }
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
const real_point3d *const global_origin3d= (const real_point3d *const)&private_identity4x3.position;
|
||||
|
||||
const real_point3d *const global_x_axis3d= (const real_point3d *const)&private_identity4x3.forward;
|
||||
const real_point3d *const global_y_axis3d= (const real_point3d *const)&private_identity4x3.left;
|
||||
const real_point3d *const global_z_axis3d= (const real_point3d *const)&private_identity4x3.up;
|
||||
const real_point3d *const global_negative_x_axis3d= (const real_point3d *const)&private_negative_identity4x3.forward;
|
||||
const real_point3d *const global_negative_y_axis3d= (const real_point3d *const)&private_negative_identity4x3.left;
|
||||
const real_point3d *const global_negative_z_axis3d= (const real_point3d *const)&private_negative_identity4x3.up;
|
||||
|
||||
const real_vector3d *const global_zero_vector3d= (const real_vector3d *const)&private_identity4x3.position;
|
||||
|
||||
const real_vector3d *const global_forward3d= (const real_vector3d *const)&private_identity4x3.forward;
|
||||
const real_vector3d *const global_left3d= (const real_vector3d *const)&private_identity4x3.left;
|
||||
const real_vector3d *const global_up3d= (const real_vector3d *const)&private_identity4x3.up;
|
||||
|
||||
const real_vector3d *const global_backward3d= (const real_vector3d *const)&private_negative_identity4x3.forward;
|
||||
const real_vector3d *const global_right3d= (const real_vector3d *const)&private_negative_identity4x3.left;
|
||||
const real_vector3d *const global_down3d= (const real_vector3d *const)&private_negative_identity4x3.up;
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -10,8 +10,78 @@ file has inline function assertions.
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
#define _real_epsilon 0.0001f
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define assert_valid_real_point3d(point)\
|
||||
vassert( \
|
||||
valid_real_point3d(point), \
|
||||
csprintf( \
|
||||
temporary, \
|
||||
"%s: assert_valid_real_point3d(%f, %f, %f)", \
|
||||
#point, (*point).x, (*point).y, (*point).z \
|
||||
) \
|
||||
)
|
||||
|
||||
#define assert_valid_real_vector3d(file, line, vector) \
|
||||
vassert( \
|
||||
valid_real_vector3d(vector), \
|
||||
csprintf( \
|
||||
temporary, \
|
||||
"%s: assert_valid_real_vector2d(%f, %f, %f)", \
|
||||
#vector, (*vector).i, (*vector).j, (*vector).k \
|
||||
) \
|
||||
)
|
||||
|
||||
#define assert_valid_real_vector3d_axes2(forward, up) \
|
||||
vassert( \
|
||||
valid_real_vector3d_axes2(forward, up), \
|
||||
csprintf( \
|
||||
temporary, \
|
||||
"%s, %s: assert_valid_real_vector3d_axes2(%f, %f, %f / %f, %f, %f)",\
|
||||
#forward, #up, \
|
||||
(*forward).i, (*forward).j, (*forward).k, (*up).i, (*up).j, (*up).k \
|
||||
) \
|
||||
)
|
||||
|
||||
#define match_assert_valid_real_point3d(file, line, point) \
|
||||
match_vassert( \
|
||||
file, \
|
||||
line, \
|
||||
valid_real_point3d(point), \
|
||||
csprintf( \
|
||||
temporary, \
|
||||
"%s: assert_valid_real_point3d(%f, %f, %f)", \
|
||||
#point, (*point).x, (*point).y, (*point).z \
|
||||
) \
|
||||
)
|
||||
|
||||
#define match_assert_valid_real_vector3d(file, line, vector) \
|
||||
match_vassert( \
|
||||
file, \
|
||||
line, \
|
||||
valid_real_vector3d(vector), \
|
||||
csprintf( \
|
||||
temporary, \
|
||||
"%s: assert_valid_real_vector2d(%f, %f, %f)", \
|
||||
#vector, (*vector).i, (*vector).j, (*vector).k \
|
||||
) \
|
||||
)
|
||||
|
||||
#define match_assert_valid_real_vector3d_axes2(file, line, forward, up) \
|
||||
match_vassert( \
|
||||
file, \
|
||||
line, \
|
||||
valid_real_vector3d_axes2(forward, up), \
|
||||
csprintf( \
|
||||
temporary, \
|
||||
"%s, %s: assert_valid_real_vector3d_axes2(%f, %f, %f / %f, %f, %f)",\
|
||||
#forward, #up, \
|
||||
(*forward).i, (*forward).j, (*forward).k, (*up).i, (*up).j, (*up).k \
|
||||
) \
|
||||
)
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
typedef float real;
|
||||
@@ -169,8 +239,295 @@ typedef union real_argb_color real_argb_color;
|
||||
void real_math_initialize(void);
|
||||
void real_math_dispose(void);
|
||||
|
||||
real normalize3d(real_vector3d *v);
|
||||
|
||||
void vectors3d_from_euler_angles3d(real_vector3d *forward, real_vector3d *up, real_euler_angles3d const *angles);
|
||||
|
||||
/* ---------- prototypes/MATRIX_MATH.C */
|
||||
|
||||
void matrix4x3_identity(real_matrix4x3 *matrix);
|
||||
void matrix4x3_transpose(real_matrix4x3 *matrix);
|
||||
void matrix4x3_inverse(real_matrix4x3 const *matrix, real_matrix4x3 *result);
|
||||
void matrix4x3_scale(real_matrix4x3 *matrix, real scale);
|
||||
void matrix4x3_translation(real_matrix4x3 *matrix, real_point3d const *point);
|
||||
void matrix4x3_rotation_from_axis_and_angle(real_matrix4x3 *matrix, real_vector3d const *axis, real sine, real cosine);
|
||||
void matrix4x3_rotation_from_vectors(real_matrix4x3 *matrix, real_vector3d const *forward, real_vector3d const *up);
|
||||
void matrix4x3_rotation_from_angles(real_matrix4x3 *matrix, real yaw, real pitch, real roll);
|
||||
void matrix4x3_rotation_to_angles(real_matrix4x3 *matrix, real_euler_angles3d *angles);
|
||||
void matrix4x3_rotation_from_quaternion(real_matrix4x3 *matrix, real_quaternion const *quaternion);
|
||||
void matrix4x3_rotation_to_quaternion(real_matrix4x3 const *matrix, real_quaternion *quaternion);
|
||||
void matrix4x3_from_point_and_vectors(real_matrix4x3 *matrix, real_point3d const *point, real_vector3d const *forward, real_vector3d const *up);
|
||||
void matrix4x3_from_point_and_quaternion(real_matrix4x3 *matrix, real_point3d const *point, real_quaternion const *quaternion);
|
||||
void matrix4x3_from_orientation(real_matrix4x3 *matrix, real_orientation const *orientation);
|
||||
void matrix4x3_from_plane(real_matrix4x3 *matrix, real_plane3d const *plane);
|
||||
void matrix4x3_to_point_and_vectors(real_matrix4x3 const *matrix, real_point3d *point, real_vector3d *forward, real_vector3d *up);
|
||||
real_vector3d *vector_from_matrices4x3(real_matrix4x3 const *a, real_matrix4x3 const *b, real_vector3d *rotation);
|
||||
real_point3d *matrix4x3_transform_point(real_matrix4x3 const *matrix, real_point3d const *point, real_point3d *result);
|
||||
real_vector3d *matrix4x3_transform_vector(real_matrix4x3 const *matrix, real_vector3d const *vector, real_vector3d *result);
|
||||
real_vector3d *matrix4x3_transform_normal(real_matrix4x3 const *matrix, real_vector3d const *normal, real_vector3d *result);
|
||||
real_plane3d *matrix4x3_transform_plane(real_matrix4x3 const *matrix, real_plane3d const *plane, real_plane3d *result);
|
||||
real_point3d *matrix4x3_inverse_transform_point(real_matrix4x3 const *matrix, real_point3d const *point, real_point3d *result);
|
||||
real_vector3d *matrix4x3_inverse_transform_vector(real_matrix4x3 const *matrix, real_vector3d const *vector, real_vector3d *result);
|
||||
real_vector3d *matrix4x3_inverse_transform_normal(real_matrix4x3 const *matrix, real_vector3d const *normal, real_vector3d *result);
|
||||
real_plane3d *matrix4x3_inverse_transform_plane(real_matrix4x3 const *matrix, real_plane3d const *plane, real_plane3d *result);
|
||||
void matrix4x3_multiply(real_matrix4x3 const *a, real_matrix4x3 const *b, real_matrix4x3 *result);
|
||||
|
||||
/* ---------- prototypes/RANDOM_MATH.C */
|
||||
|
||||
unsigned long *get_global_random_seed_address(void);
|
||||
|
||||
short seed_random_range(unsigned long *seed, short lower_bound, short upper_bound);
|
||||
|
||||
real real_seed_random(unsigned long *seed);
|
||||
real real_seed_random_range(unsigned long *seed, real lower_bound, real upper_bound);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
extern const real_point3d *const global_origin3d;
|
||||
|
||||
extern const real_point3d *const global_x_axis3d;
|
||||
extern const real_point3d *const global_y_axis3d;
|
||||
extern const real_point3d *const global_z_axis3d;
|
||||
extern const real_point3d *const global_negative_x_axis3d;
|
||||
extern const real_point3d *const global_negative_y_axis3d;
|
||||
extern const real_point3d *const global_negative_z_axis3d;
|
||||
|
||||
extern const real_vector3d *const global_zero_vector3d;
|
||||
|
||||
extern const real_vector3d *const global_forward3d;
|
||||
extern const real_vector3d *const global_left3d;
|
||||
extern const real_vector3d *const global_up3d;
|
||||
|
||||
extern const real_vector3d *const global_backward3d;
|
||||
extern const real_vector3d *const global_right3d;
|
||||
extern const real_vector3d *const global_down3d;
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
__inline real sine(
|
||||
real angle)
|
||||
{
|
||||
return sin(angle);
|
||||
}
|
||||
|
||||
__inline real cosine(
|
||||
real angle)
|
||||
{
|
||||
return cos(angle);
|
||||
}
|
||||
|
||||
__inline real tangent(
|
||||
real angle)
|
||||
{
|
||||
return tan(angle);
|
||||
}
|
||||
|
||||
__inline real arctangent(
|
||||
real y,
|
||||
real x)
|
||||
{
|
||||
return atan2(y, x);
|
||||
}
|
||||
|
||||
__inline real arccosine(real x)
|
||||
{
|
||||
return acos(x);
|
||||
}
|
||||
|
||||
__inline real arcsine(real x)
|
||||
{
|
||||
return asin(x);
|
||||
}
|
||||
|
||||
__inline real signed_angular_difference(
|
||||
real angle1,
|
||||
real angle2)
|
||||
{
|
||||
real result= angle2-angle1;
|
||||
|
||||
if (result>=M_PI)
|
||||
{
|
||||
result-= (M_PI*2.f);
|
||||
}
|
||||
|
||||
if (result<=(-M_PI))
|
||||
{
|
||||
result+= (M_PI*2.f);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
__inline real_point3d *point_from_line3d(real_point3d const *p, real_vector3d const *v, real t, real_point3d *result)
|
||||
{
|
||||
result->x= (v->i*t) + p->x;
|
||||
result->y= (v->j*t) + p->y;
|
||||
result->z= (v->k*t) + p->z;
|
||||
return result;
|
||||
}
|
||||
|
||||
__inline real dot_product3d(
|
||||
real_vector3d const *a,
|
||||
real_vector3d const *b)
|
||||
{
|
||||
return (a->i*b->i) + (a->j*b->j) + (a->k*b->k);
|
||||
}
|
||||
|
||||
__inline real_vector3d *vector_from_points3d(
|
||||
real_point3d const *a,
|
||||
real_point3d const *b,
|
||||
real_vector3d *result)
|
||||
{
|
||||
result->i= b->x-a->x;
|
||||
result->j= b->y-a->y;
|
||||
result->k= b->z-a->z;
|
||||
return result;
|
||||
}
|
||||
|
||||
__inline real magnitude_squared3d(
|
||||
real_vector3d const *vector)
|
||||
{
|
||||
return vector->i*vector->i + vector->j*vector->j + vector->k*vector->k;
|
||||
}
|
||||
|
||||
__inline real distance_squared3d(
|
||||
real_point3d const *a,
|
||||
real_point3d const *b)
|
||||
{
|
||||
real_vector3d v;
|
||||
|
||||
return magnitude_squared3d(vector_from_points3d(a, b, &v));
|
||||
}
|
||||
|
||||
__inline real_vector3d *negate_vector3d(
|
||||
real_vector3d const *a,
|
||||
real_vector3d *result)
|
||||
{
|
||||
result->i= -a->i;
|
||||
result->j= -a->j;
|
||||
result->k= -a->k;
|
||||
return result;
|
||||
}
|
||||
|
||||
__inline real_point3d *set_real_point3d(
|
||||
real_point3d *p,
|
||||
real x,
|
||||
real y,
|
||||
real z)
|
||||
{
|
||||
p->x= x;
|
||||
p->y= y;
|
||||
p->z= z;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
__inline boolean valid_real(
|
||||
real n)
|
||||
{
|
||||
return (*(long *)&n & 0x7F800000) != 0x7F800000;
|
||||
}
|
||||
|
||||
__inline boolean valid_realcmp(
|
||||
real a,
|
||||
real b)
|
||||
{
|
||||
real result= a - b;
|
||||
return valid_real(result) && fabs(result) < 0.01f;
|
||||
}
|
||||
|
||||
__inline boolean valid_real_point3d(
|
||||
real_point3d const *p)
|
||||
{
|
||||
return valid_real(p->x) && valid_real(p->y) && valid_real(p->z);
|
||||
}
|
||||
|
||||
__inline boolean valid_real_vector3d(real_vector3d const *v)
|
||||
{
|
||||
return valid_real(v->i) && valid_real(v->j) && valid_real(v->k);
|
||||
}
|
||||
|
||||
|
||||
__inline boolean valid_real_normal3d(
|
||||
real_vector3d const *n)
|
||||
{
|
||||
return valid_realcmp(magnitude_squared3d(n), 1.f);
|
||||
}
|
||||
|
||||
__inline boolean valid_real_vector3d_axes2(
|
||||
real_vector3d const *forward,
|
||||
real_vector3d const *up)
|
||||
{
|
||||
boolean result= FALSE;
|
||||
if (valid_real_normal3d(forward) && valid_real_normal3d(up))
|
||||
{
|
||||
real product= dot_product3d(forward, up);
|
||||
if (valid_realcmp(product, 0.f))
|
||||
{
|
||||
result= TRUE;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
__inline boolean valid_real_vector3d_axes3(
|
||||
real_vector3d const *f,
|
||||
real_vector3d const *l,
|
||||
real_vector3d const *u)
|
||||
{
|
||||
return
|
||||
valid_real_normal3d(f) &&
|
||||
valid_real_normal3d(l) &&
|
||||
valid_real_normal3d(u) &&
|
||||
valid_realcmp(dot_product3d(f, l), 0.f) &&
|
||||
valid_realcmp(dot_product3d(l, u), 0.f) &&
|
||||
valid_realcmp(dot_product3d(u, f), 0.f);
|
||||
}
|
||||
|
||||
__inline boolean valid_real_matrix4x3(
|
||||
real_matrix4x3 const *matrix)
|
||||
{
|
||||
return
|
||||
valid_real(matrix->scale) &&
|
||||
valid_real_vector3d_axes3(&matrix->forward, &matrix->left, &matrix->up) &&
|
||||
valid_real_point3d(&matrix->position);
|
||||
}
|
||||
|
||||
__inline real_vector3d *cross_product3d(
|
||||
real_vector3d const *a,
|
||||
real_vector3d const *b,
|
||||
real_vector3d *result)
|
||||
{
|
||||
real k= (a->i*b->j) - (a->j*b->i);
|
||||
real j= (a->k*b->i) - (a->i*b->k);
|
||||
real i= (a->j*b->k) - (a->k*b->j);
|
||||
result->i= i;
|
||||
result->j= j;
|
||||
result->k= k;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
__inline boolean point_in_sphere(
|
||||
real_point3d const *point,
|
||||
real_point3d const *center,
|
||||
real radius)
|
||||
{
|
||||
return distance_squared3d(point, center)<=(radius*radius);
|
||||
}
|
||||
|
||||
__inline short random_range(
|
||||
short lower_bound,
|
||||
short upper_bound)
|
||||
{
|
||||
return seed_random_range(get_global_random_seed_address(), lower_bound, upper_bound);
|
||||
}
|
||||
|
||||
__inline real real_random(
|
||||
void)
|
||||
{
|
||||
return real_seed_random(get_global_random_seed_address());
|
||||
}
|
||||
|
||||
#endif // __REAL_MATH_H
|
||||
@@ -62,6 +62,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "data.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -76,4 +79,52 @@ static void datum_initialize(struct data_array *data, struct datum_header *heade
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
void data_verify(
|
||||
struct data_array *data)
|
||||
{
|
||||
match_assert("c:\\halo\\SOURCE\\memory\\data.c", 457, data);
|
||||
|
||||
match_vassert(
|
||||
"c:\\halo\\SOURCE\\memory\\data.c",
|
||||
470,
|
||||
data->data &&
|
||||
data->signature=='d@t@' &&
|
||||
data->maximum_count>=0 &&
|
||||
data->count>=0 &&
|
||||
data->count<=data->maximum_count &&
|
||||
data->first_free_absolute_index>=0 &&
|
||||
data->first_free_absolute_index<=data->maximum_count &&
|
||||
data->actual_count>=0 &&
|
||||
data->actual_count<=data->count,
|
||||
csprintf(temporary, "%s data array @%p is bad or not allocated", data->name, data));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void datum_delete(
|
||||
struct data_array *data,
|
||||
long index)
|
||||
{
|
||||
struct datum_header *header= (struct datum_header *)datum_get(data, index);
|
||||
header->identifier= 0;
|
||||
|
||||
if (((short)index)<data->first_free_absolute_index)
|
||||
{
|
||||
data->first_free_absolute_index= index;
|
||||
}
|
||||
|
||||
if (((short)index)+1==data->count)
|
||||
{
|
||||
do
|
||||
{
|
||||
header=(struct datum_header *)((byte *)header-data->size);
|
||||
data->count--;
|
||||
}
|
||||
while (data->count > 0 && !header->identifier);
|
||||
}
|
||||
data->actual_count--;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -70,6 +70,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "memory_pool.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -82,4 +85,22 @@ symbols in this file:
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
long memory_pool_get_free_size(
|
||||
struct memory_pool *pool)
|
||||
{
|
||||
return pool->free_size;
|
||||
}
|
||||
|
||||
long memory_pool_get_used_size(
|
||||
struct memory_pool *pool)
|
||||
{
|
||||
return !pool->last_block ? 0 : (unsigned long)pool->last_block + pool->last_block->size - (unsigned long)pool->base_address;
|
||||
}
|
||||
|
||||
long memory_pool_get_contiguous_free_size(
|
||||
struct memory_pool *pool)
|
||||
{
|
||||
return pool->size - memory_pool_get_used_size(pool);
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -14,7 +14,40 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct memory_pool_block
|
||||
{
|
||||
unsigned long header_signature;
|
||||
long size;
|
||||
void **reference;
|
||||
struct memory_pool_block *next_block;
|
||||
struct memory_pool_block *previous_block;
|
||||
unsigned long trailer_signature;
|
||||
};
|
||||
|
||||
struct memory_pool
|
||||
{
|
||||
unsigned long signature;
|
||||
char name[32];
|
||||
void *base_address;
|
||||
long size;
|
||||
long free_size;
|
||||
struct memory_pool_block *first_block;
|
||||
struct memory_pool_block *last_block;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/MEMORY_POOL.C */
|
||||
|
||||
struct memory_pool *memory_pool_new(char const *name, long size);
|
||||
void memory_pool_delete(struct memory_pool *pool);
|
||||
long memory_pool_allocation_size(long size);
|
||||
void memory_pool_initialize(struct memory_pool *pool, char const *name, long size);
|
||||
boolean memory_pool_block_allocate(struct memory_pool *pool, void **reference, long size);
|
||||
boolean memory_pool_block_reallocate(struct memory_pool *pool, void **reference, long new_size);
|
||||
void memory_pool_block_free(struct memory_pool *pool, void **reference);
|
||||
void memory_pool_compact(struct memory_pool *pool);
|
||||
long memory_pool_get_free_size(struct memory_pool *pool);
|
||||
long memory_pool_get_used_size(struct memory_pool *pool);
|
||||
long memory_pool_get_contiguous_free_size(struct memory_pool *pool);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -262,6 +262,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "model_animation_definitions.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
@@ -8,13 +8,113 @@ header included in hcex build.
|
||||
#define __MODEL_ANIMATION_DEFINITIONS_H
|
||||
#pragma once
|
||||
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "math/real_math.h"
|
||||
#include "tag_files/tag_files.h"
|
||||
#include "tag_files/tag_groups.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
ANIMATION_GRAPH_TAG= 'antr',
|
||||
ANIMATION_GRAPH_VERSION= 4,
|
||||
MAXIMUM_FRAMES_PER_ANIMATION= 2048,
|
||||
MAXIMUM_NODES_PER_ANIMATION= 64,
|
||||
MAXIMUM_ANIMATIONS_PER_GRAPH= 256,
|
||||
MAXIMUM_SOUND_REFERENCES_PER_ANIMATION_GRAPH= 257,
|
||||
MINIMUM_COMPRESSED_ANIMATION_FRAME_COUNT= 6,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_animation_compressed_bit= 0,
|
||||
_animation_world_relative_bit,
|
||||
_animation_25Hz_bit,
|
||||
NUMBER_OF_ANIMATION_FLAGS,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define animation_graph_definition_get(index) ((struct animation_graph *)tag_get(ANIMATION_GRAPH_TAG, index))
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct animation
|
||||
{
|
||||
char name[TAG_STRING_LENGTH+1];
|
||||
short type;
|
||||
short frame_count;
|
||||
short frame_size;
|
||||
short frame_info_type;
|
||||
unsigned long node_list_checksum;
|
||||
short node_count;
|
||||
short private_loop_frame_index;
|
||||
real weight;
|
||||
short private_key_frame_index;
|
||||
short private_second_key_frame_index;
|
||||
short next_animation_index;
|
||||
word flags;
|
||||
short sound_index;
|
||||
short private_sound_frame_index;
|
||||
byte private_left_foot_frame_index;
|
||||
byte private_right_foot_frame_index;
|
||||
short runtime_parent_animation_index;
|
||||
real runtime_normalized_weight;
|
||||
struct tag_data frame_info;
|
||||
unsigned long nodes_with_translation_flags[2];
|
||||
long unused_translation[2];
|
||||
unsigned long nodes_with_rotation_flags[2];
|
||||
long unused_rotation[2];
|
||||
unsigned int nodes_with_scale_flags[2];
|
||||
long unused_scale[1];
|
||||
long compressed_data_offset;
|
||||
struct tag_data default_data;
|
||||
struct tag_data data;
|
||||
};
|
||||
|
||||
|
||||
struct animation_graph
|
||||
{
|
||||
struct tag_block object_overlays;
|
||||
struct tag_block unit_seats;
|
||||
struct tag_block weapon_animations;
|
||||
struct tag_block vehicle_animations;
|
||||
struct tag_block device_animations;
|
||||
struct tag_block unit_damage_animations;
|
||||
struct tag_block first_person_weapon_animations;
|
||||
struct tag_block sound_references;
|
||||
real limp_body_node_collision_radius;
|
||||
word flags;
|
||||
word pad;
|
||||
struct tag_block nodes;
|
||||
struct tag_block animations; // animation
|
||||
};
|
||||
|
||||
/* ---------- prototypes/MODEL_ANIMATION_DEFINITIONS.C */
|
||||
|
||||
/* ---------- prototypes/MODEL_ANIMATIONS.C */
|
||||
|
||||
void animation_get_node_orientations(
|
||||
struct model const *model,
|
||||
struct animation const *animation,
|
||||
short frame_index,
|
||||
struct real_orientation *node_orientations);
|
||||
|
||||
void inverse_kinematics_adjust_matrices(
|
||||
struct real_matrix4x3 *desired_hand_matrix,
|
||||
struct real_matrix4x3 *shoulder_matrix,
|
||||
struct real_matrix4x3 *elbow_matrix,
|
||||
struct real_matrix4x3 *hand_matrix);
|
||||
|
||||
void interpolate_node_orientations(
|
||||
short node_count,
|
||||
struct real_orientation *original_node_orientations,
|
||||
struct real_orientation *target_node_orientations,
|
||||
short frame_index,
|
||||
short frame_count);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -147,6 +147,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "model_animation_definitions.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
@@ -8,13 +8,116 @@ header included in hcex build.
|
||||
#define __MODEL_DEFINITIONS_H
|
||||
#pragma once
|
||||
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "math/real_math.h"
|
||||
#include "tag_files/tag_files.h"
|
||||
#include "tag_files/tag_groups.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
MODELS_GROUP_TAG= 'mode',
|
||||
MODELS_GROUP_VERSION= 4,
|
||||
MAXIMUM_MARKERS_PER_MODEL= 256,
|
||||
MAXIMUM_INSTANCES_PER_MODEL_MARKER= 32,
|
||||
MAXIMUM_GEOMETRIES_PER_MODEL= 256,
|
||||
MAXIMUM_PARTS_PER_MODEL_GEOMETRY= 32,
|
||||
MAXIMUM_VERTICES_PER_MODEL_GEOMETRY_PART= UNSIGNED_SHORT_MAX,
|
||||
MAXIMUM_TRIANGLES_PER_MODEL_GEOMETRY_PART= UNSIGNED_SHORT_MAX,
|
||||
MAXIMUM_NODES_PER_MODEL_GEOMETRY_PART= 22,
|
||||
PADDED_MAXIMUM_NODES_PER_MODEL_GEOMETRY_PART= 24,
|
||||
MAXIMUM_REGIONS_PER_MODEL= 32,
|
||||
MAXIMUM_PERMUTATIONS_PER_MODEL_REGION= 32,
|
||||
MAXIMUM_MARKERS_PER_MODEL_REGION_PERMUTATION= 64,
|
||||
MAXIMUM_NODES_PER_MODEL= 64,
|
||||
MAXIMUM_SHADERS_PER_MODEL= 32,
|
||||
MAXIMUM_FUNCTION_VALUES_PER_MODEL= 4,
|
||||
MAXIMUM_CHANGE_COLORS_PER_MODEL= 4,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_model_region_permutation_cannot_be_chosen_randomly_bit= 0,
|
||||
NUMBER_OF_MODEL_REGION_PERMUTATION_FLAGS,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define model_definition_get(index) ((struct model *)tag_get(MODELS_GROUP_TAG, index))
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct model_marker_instance
|
||||
{
|
||||
byte region_index;
|
||||
byte permutation_index;
|
||||
byte node_index;
|
||||
byte pad;
|
||||
real_point3d translation;
|
||||
real_quaternion rotation;
|
||||
};
|
||||
|
||||
struct model_marker
|
||||
{
|
||||
char name[32];
|
||||
long unused[5];
|
||||
struct tag_block instances; // model_marker_instance
|
||||
};
|
||||
|
||||
struct model_node
|
||||
{
|
||||
char name[TAG_STRING_LENGTH+1];
|
||||
short next_sibling_node_index;
|
||||
short first_child_node_index;
|
||||
short parent_node_index;
|
||||
word pad;
|
||||
real_point3d default_translation;
|
||||
real_quaternion default_rotation;
|
||||
real node_distance_from_parent;
|
||||
long unused[8];
|
||||
real_matrix4x3 runtime_default_inverse_matrix;
|
||||
};
|
||||
|
||||
struct model_region_permutation
|
||||
{
|
||||
char name[TAG_STRING_LENGTH+1];
|
||||
long flags;
|
||||
short variant_number;
|
||||
word pad;
|
||||
long unused[6];
|
||||
short geometry_indices[5];
|
||||
word pad2;
|
||||
struct tag_block markers; // object_marker
|
||||
};
|
||||
|
||||
struct model_region
|
||||
{
|
||||
char name[TAG_STRING_LENGTH+1];
|
||||
long unused[8];
|
||||
struct tag_block permutations; // model_region_permutation
|
||||
};
|
||||
|
||||
struct model
|
||||
{
|
||||
unsigned long flags;
|
||||
unsigned long node_list_checksum;
|
||||
real detail_cutoff_pixels[5];
|
||||
short node_counts[5];
|
||||
word pad;
|
||||
long unused1[2];
|
||||
real_vector2d base_map_scale;
|
||||
long unused2[29];
|
||||
struct tag_block markers; // model_marker
|
||||
struct tag_block nodes; // model_node
|
||||
struct tag_block regions; // model_region
|
||||
struct tag_block geometries;
|
||||
struct tag_block shaders;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/MODEL_DEFINITIONS.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -60,6 +60,14 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "models.h"
|
||||
|
||||
#include "model_definitions.h"
|
||||
|
||||
#include "math/real_math.h"
|
||||
#include "objects/objects.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -72,4 +80,61 @@ symbols in this file:
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
short model_get_marker_by_name(
|
||||
long model_index,
|
||||
char const *name,
|
||||
byte const *region_permutations,
|
||||
short const *node_remapping_table,
|
||||
short node_count,
|
||||
real_matrix4x3 const *node_matrices,
|
||||
boolean mirrored_flag,
|
||||
struct object_marker *markers,
|
||||
short maximum_marker_count)
|
||||
{
|
||||
short result= 0;
|
||||
short marker_index= model_find_marker(model_index, name);
|
||||
|
||||
match_assert("c:\\halo\\SOURCE\\models\\models.c", 760, node_matrices);
|
||||
match_assert("c:\\halo\\SOURCE\\models\\models.c", 761, markers);
|
||||
|
||||
if (marker_index!=NONE)
|
||||
{
|
||||
short i;
|
||||
|
||||
struct model *model= model_definition_get(model_index);
|
||||
struct model_marker* marker= TAG_BLOCK_GET_ELEMENT(&model->markers, marker_index, struct model_marker);
|
||||
|
||||
for (i=0; i<marker->instances.count; i++)
|
||||
{
|
||||
struct model_marker_instance* instance= TAG_BLOCK_GET_ELEMENT(&marker->instances, i, struct model_marker_instance);
|
||||
if (!region_permutations ||
|
||||
region_permutations[instance->region_index]==instance->permutation_index)
|
||||
{
|
||||
struct object_marker *object_marker;
|
||||
|
||||
if (result>=maximum_marker_count)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
object_marker= &markers[result++];
|
||||
object_marker->node_index= node_remapping_table ? node_remapping_table[instance->node_index] : instance->node_index;
|
||||
matrix4x3_from_point_and_quaternion(&object_marker->node_matrix, &instance->translation, &instance->rotation);
|
||||
match_assert(
|
||||
"c:\\halo\\SOURCE\\models\\models.c",
|
||||
785,
|
||||
object_marker->node_index>=0 && object_marker->node_index<(node_remapping_table ? node_count : model->nodes.count));
|
||||
|
||||
matrix4x3_multiply(&node_matrices[object_marker->node_index], &object_marker->node_matrix, &object_marker->matrix);
|
||||
if (mirrored_flag)
|
||||
{
|
||||
negate_vector3d(&object_marker->matrix.left, &object_marker->matrix.left);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
+15
-1
@@ -14,7 +14,21 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/MODELS.C */
|
||||
|
||||
void model_get_node_orientations(struct model const *model, struct real_orientation *node_orientations);
|
||||
|
||||
short model_find_marker(long model_index, char const *name);
|
||||
short model_get_marker_by_name(
|
||||
long model_index,
|
||||
char const *name,
|
||||
byte const *region_permutations,
|
||||
short const *node_remapping_table,
|
||||
short node_count,
|
||||
struct real_matrix4x3 const *node_matrices,
|
||||
boolean mirrored_flag,
|
||||
struct object_marker *markers,
|
||||
short maximum_marker_count);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
+10
-1
@@ -14,7 +14,16 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/DAMAGE.C */
|
||||
|
||||
void damage_initialize(void);
|
||||
void damage_dispose(void);
|
||||
void damage_initialize_for_new_map(void);
|
||||
void damage_dispose_from_old_map(void);
|
||||
void damage_render_debug(void);
|
||||
void object_initialize_vitality(long object_index, real *custom_body_vitality, real *custom_shield_vitality);
|
||||
|
||||
void object_damage_update(long object_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -8,12 +8,62 @@ header included in hcex build.
|
||||
#define __DAMAGE_RESISTANCES_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "tag_files/tag_groups.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct damage_resistance
|
||||
{
|
||||
unsigned long flags;
|
||||
short indirect_damage_material_index;
|
||||
word pad2;
|
||||
real maximum_body_vitality;
|
||||
real body_system_shock;
|
||||
long body_vitality_unused[6];
|
||||
real body_stun_unused[7];
|
||||
real friendly_damage_resistance;
|
||||
long friendly_damage_unused[2];
|
||||
long body_unused[8];
|
||||
struct tag_reference localized_damage_effect;
|
||||
real area_damage_effect_threshold;
|
||||
struct tag_reference area_damage_effect;
|
||||
real body_damaged_effect_threshold;
|
||||
struct tag_reference body_damaged_effect;
|
||||
struct tag_reference body_depleted_effect;
|
||||
real body_destroyed_threshold;
|
||||
struct tag_reference body_destroyed_effect;
|
||||
real maximum_shield_vitality;
|
||||
word pad0;
|
||||
short shield_material_type;
|
||||
long shield_vitality_unused[6];
|
||||
short shield_failure_function;
|
||||
word pad1;
|
||||
real shield_failure_threshold;
|
||||
real maximum_shield_failure;
|
||||
long shield_failure_unused[4];
|
||||
real minimum_shield_stun_damage;
|
||||
real shield_stun_time;
|
||||
real shield_recharge_time;
|
||||
real shield_recharge_unused[4];
|
||||
long shield_unused[24];
|
||||
real shield_damaged_effect_threshold;
|
||||
struct tag_reference shield_damaged_effect;
|
||||
struct tag_reference shield_depleted_effect;
|
||||
struct tag_reference shield_recharging_effect;
|
||||
unsigned long unused2[2];
|
||||
real runtime_shield_recharge_velocity;
|
||||
unsigned long unused[28];
|
||||
struct tag_block materials;
|
||||
struct tag_block regions;
|
||||
struct tag_block modifiers;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
@@ -10,6 +10,12 @@ header included in hcex build.
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
LIGHT_DEFINITION_TAG= 'ligh',
|
||||
LIGHT_DEFINITION_VERSION= 3,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
@@ -8,13 +8,155 @@ header included in hcex build.
|
||||
#define __OBJECT_DEFINITIONS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "math/real_math.h"
|
||||
#include "tag_files/tag_files.h"
|
||||
#include "tag_files/tag_groups.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
OBJECT_DEFINITION_TAG= 'obje',
|
||||
OBJECT_DEFINITION_VERSION= 1,
|
||||
NUMBER_OF_OUTGOING_OBJECT_FUNCTIONS= 4,
|
||||
NUMBER_OF_INCOMING_OBJECT_FUNCTIONS= 4,
|
||||
MAXIMUM_NUMBER_OF_ATTACHMENTS_PER_OBJECT= 8,
|
||||
MAXIMUM_REGIONS_PER_OBJECT= 8,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_does_not_cast_shadow_bit= 0,
|
||||
_object_transparency_self_occludes_bit,
|
||||
_object_artificially_bright_bit,
|
||||
_object_not_pathfinding_obstacle_bit,
|
||||
NUMBER_OF_OBJECT_DEFINITION_FLAGS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_runtime_scaled_change_colors_bit= 0,
|
||||
NUMBER_OF_OBJECT_DEFINITION_RUNTIME_FLAGS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_function_invert_function_bit= 0,
|
||||
_object_function_additive_bit,
|
||||
_object_function_does_not_deactivate_below_lower_bound_bit,
|
||||
NUMBER_OF_OBJECT_FUNCTION_DEFINITION_FLAGS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_function_clip_to_bounds= 0,
|
||||
_object_function_clip_to_bounds_and_normalize,
|
||||
_object_function_scale_to_fit_bounds,
|
||||
NUMBER_OF_OBJECT_FUNCTION_BOUNDS_MODES,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define object_definition_get(index) ((struct object_definition *)tag_get(OBJECT_DEFINITION_TAG, index))
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct object_attachment_definition
|
||||
{
|
||||
struct tag_reference type;
|
||||
char marker_name[TAG_STRING_LENGTH+1];
|
||||
short primary_scale_function_reference;
|
||||
short secondary_scale_function_reference;
|
||||
short change_color_reference;
|
||||
word pad;
|
||||
long unused[4];
|
||||
};
|
||||
|
||||
struct object_function_definition
|
||||
{
|
||||
unsigned long flags;
|
||||
real period;
|
||||
short scale_period_by_function_index;
|
||||
short function_type;
|
||||
short scale_function_by_function_index;
|
||||
short wobble_function_type;
|
||||
real wobble_period;
|
||||
real wobble_magnitude;
|
||||
real square_wave_threshold;
|
||||
short step_count;
|
||||
short map_result_to_transition_function;
|
||||
short sawtooth_count;
|
||||
short add_function_index;
|
||||
short scale_result_by_function_index;
|
||||
short bounds_mode;
|
||||
real lower_bound;
|
||||
real upper_bound;
|
||||
real pad2;
|
||||
word pad3;
|
||||
short turn_off_with_function_index;
|
||||
real scale_by;
|
||||
int unused1[63];
|
||||
real runtime_reciprocal_bounds_range;
|
||||
real runtime_reciprocal_sawtooth_count;
|
||||
real runtime_reciprocal_step_count;
|
||||
real runtime_one_over_period;
|
||||
char usage[TAG_STRING_LENGTH+1];
|
||||
};
|
||||
|
||||
struct object_change_color_permutation
|
||||
{
|
||||
real weight;
|
||||
real_rgb_color color_lower_bound;
|
||||
real_rgb_color color_upper_bound;
|
||||
};
|
||||
|
||||
struct object_change_color_definition
|
||||
{
|
||||
short darken_by;
|
||||
short scaled_by;
|
||||
unsigned long scale_flags;
|
||||
real_rgb_color color_lower_bound;
|
||||
real_rgb_color color_upper_bound;
|
||||
struct tag_block permutations; // object_change_color_permutation
|
||||
};
|
||||
|
||||
struct _object_definition
|
||||
{
|
||||
short type;
|
||||
word flags;
|
||||
real bounding_radius;
|
||||
real_point3d bounding_offset;
|
||||
real_point3d origin_offset;
|
||||
real acceleration_scale;
|
||||
unsigned long runtime_flags;
|
||||
struct tag_reference model;
|
||||
struct tag_reference animation_graph;
|
||||
long unused3[10];
|
||||
struct tag_reference collision_model;
|
||||
struct tag_reference physics;
|
||||
struct tag_reference modifier_shader;
|
||||
struct tag_reference creation_effect;
|
||||
long unused1[21];
|
||||
real render_bounding_radius;
|
||||
short function_modes[4];
|
||||
long unused2[11];
|
||||
short icon_text_index;
|
||||
short forced_shader_permutation_index;
|
||||
struct tag_block attachments; // object_attachment_definition
|
||||
struct tag_block widgets;
|
||||
struct tag_block functions; // object_function_definition
|
||||
struct tag_block change_colors; // object_change_color_definition
|
||||
struct tag_block predicted_resources;
|
||||
};
|
||||
|
||||
struct object_definition
|
||||
{
|
||||
struct _object_definition object;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/OBJECT_DEFINITIONS.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "objects.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -20,6 +23,23 @@ symbols in this file:
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
object_deleted_proc object_deleted_procs[3];
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
void object_deleted_procs_call(
|
||||
long deleted_object_index)
|
||||
{
|
||||
long i=0;
|
||||
|
||||
do
|
||||
{
|
||||
(object_deleted_procs[i])(deleted_object_index);
|
||||
i++;
|
||||
}
|
||||
while (i<NUMBEROF(object_deleted_procs));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -14,7 +14,18 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/OBJECT_LIGHTS.C */
|
||||
|
||||
void lights_initialize(void);
|
||||
void lights_dispose(void);
|
||||
void lights_initialize_for_new_map(void);
|
||||
void lights_dispose_from_old_map(void);
|
||||
boolean lights_enable(boolean enable);
|
||||
long light_new(long definition_index, long object_index, short object_attachment_index, short object_function_index, short object_change_color_index);
|
||||
void light_delete(long light_index);
|
||||
|
||||
void light_disconnect_from_map(long light_index);
|
||||
void light_reconnect_to_map(long light_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -122,6 +122,11 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "object_types.h"
|
||||
|
||||
#include "objects.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -134,4 +139,47 @@ symbols in this file:
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
boolean object_type_new(
|
||||
long object_index)
|
||||
{
|
||||
short i;
|
||||
|
||||
struct object_type_definition* definition= object_type_definition_get(object_get(object_index)->object.type);
|
||||
boolean result= TRUE;
|
||||
|
||||
for (i= 0; definition->part_definitions[i]; i++)
|
||||
{
|
||||
struct object_type_definition *current_definition= definition->part_definitions[i];
|
||||
|
||||
if (current_definition->datum_new && !current_definition->datum_new(object_index))
|
||||
{
|
||||
result= FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void object_type_delete(
|
||||
long object_index)
|
||||
{
|
||||
short i;
|
||||
|
||||
struct object_type_definition *definition= object_type_definition_get(object_get(object_index)->object.type);
|
||||
boolean result= TRUE;
|
||||
|
||||
for (i= 0; definition->part_definitions[i]; i++)
|
||||
{
|
||||
struct object_type_definition *current_definition= definition->part_definitions[i];
|
||||
if (current_definition->datum_delete)
|
||||
{
|
||||
current_definition->datum_delete(object_index);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -8,6 +8,11 @@ OBJECT_TYPES.H
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
MAXIMUM_CHILDREN_PER_OBJECT_TYPE_DEFINITION= 16,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_type_biped= 0,
|
||||
@@ -47,4 +52,67 @@ enum
|
||||
_object_mask_remove_on_bsp_switch= (FLAG(_object_type_scenery)|FLAG(_object_type_light_fixture))
|
||||
};
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct object_type_definition
|
||||
{
|
||||
char const *name;
|
||||
unsigned long group_tag;
|
||||
short game_datum_size;
|
||||
short placement_tag_block_offset;
|
||||
short palette_tag_block_offset;
|
||||
short placement_tag_block_element_size;
|
||||
void (*initialize)();
|
||||
void (*dispose)();
|
||||
void (*initialize_for_new_map)();
|
||||
void (*dispose_from_old_map)();
|
||||
void (*datum_adjust_placement)(long, struct object_placement_data *);
|
||||
boolean (*datum_new)(long);
|
||||
void (*datum_place)(long, void *);
|
||||
void (*datum_delete)(long);
|
||||
boolean(*datum_update)(long);
|
||||
void (*datum_export_function_values)(long);
|
||||
void (*handle_deleted_object)(long, long);
|
||||
void (*handle_region_destroyed)(long, short, unsigned long);
|
||||
boolean(*handle_parent_destroyed)(long);
|
||||
void (*datum_preprocess_node_orientations)(long, struct real_orientation *);
|
||||
void (*datum_postprocess_node_matrices)(long, struct real_matrix4x3 *);
|
||||
void (*reset)(long);
|
||||
void (*disconnect_from_structure_bsp)(long);
|
||||
void (*notify_impulse_sound)(long, long, long);
|
||||
void (*render_debug)(long);
|
||||
struct object_type_definition *part_definitions[MAXIMUM_CHILDREN_PER_OBJECT_TYPE_DEFINITION];
|
||||
struct object_type_definition *next;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/OBJECT_TYPES.C */
|
||||
|
||||
struct object_type_definition *object_type_definition_get(short object_type);
|
||||
short object_type_get_datum_size(short object_type);
|
||||
char const *object_type_get_name(short object_type);
|
||||
|
||||
void object_types_place_all(struct scenario *scenario);
|
||||
|
||||
void object_types_initialize(void);
|
||||
void object_types_dispose(void);
|
||||
void object_types_initialize_for_new_map(void);
|
||||
void object_types_dispose_from_old_map(void);
|
||||
void object_type_adjust_placement(long object_index, struct object_placement_data *data);
|
||||
boolean object_type_new(long object_index);
|
||||
void object_type_place(long object_index, struct scenario_object_datum *scenario_object);
|
||||
|
||||
void object_type_handle_deleted_object(long object_index, long deleted_object_index);
|
||||
|
||||
void object_type_delete(long object_index);
|
||||
boolean object_type_update(long object_index);
|
||||
void object_type_export_function_values(long object_index);
|
||||
|
||||
void object_type_preprocess_node_orientations(long object_index, struct real_orientation *node_orientations);
|
||||
void object_type_postprocess_node_matrices(long object_index, struct real_matrix4x3 *node_matrices);
|
||||
void object_type_reset(long object_index);
|
||||
void object_type_disconnect_from_structure_bsp(long object_index);
|
||||
|
||||
struct tag_block *scenario_get_object_type_scenario_datums(struct scenario *scenario, short object_type, long *size);
|
||||
struct tag_block *scenario_get_object_type_scenario_palette(struct scenario *scenario, short object_type);
|
||||
|
||||
#endif // __OBJECT_TYPES_H
|
||||
+4446
-445
File diff suppressed because it is too large.
Load diff
+499
-1
@@ -8,16 +8,514 @@ file has inline function assertions.
|
||||
#define __OBJECTS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "object_definitions.h"
|
||||
#include "object_types.h"
|
||||
|
||||
#include "math/real_math.h"
|
||||
#include "memory/data.h"
|
||||
#include "structures/cluster_partitions.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
OBJECT_ITERATOR_SIGNATURE= 0x86868686,
|
||||
MAXIMUM_CLUSTERS_PER_OBJECT= 32,
|
||||
OBJECT_MEMORY_POOL_SIZE= 0x100000,
|
||||
GARBAGE_LIMIT_FREE_MEMORY_CRITICAL= 52428,
|
||||
GARBAGE_LIMIT_FREE_MEMORY_TRIGGER= 104857,
|
||||
GARBAGE_LIMIT_FREE_MEMORY_TARGET= 209715,
|
||||
GARBAGE_LIMIT_FREE_OBJECTS_CRITICAL= 51,
|
||||
GARBAGE_LIMIT_FREE_OBJECTS_TRIGGER= 102,
|
||||
GARBAGE_LIMIT_FREE_OBJECTS_TARGET= 204,
|
||||
GARBAGE_LIMIT_ACTIVE_GARBAGE_CRITICAL= 75,
|
||||
GARBAGE_LIMIT_ACTIVE_GARBAGE_TRIGGER= 50,
|
||||
GARBAGE_LIMIT_ACTIVE_GARBAGE_TARGET= 30,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MAXIMUM_MARKERS_PER_OBJECT= 64,
|
||||
MAXIMUM_OBJECTS_PER_MAP= 2048,
|
||||
MAXIMUM_RENDERED_OBJECTS= 256,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_header_active_bit= 0,
|
||||
_object_header_visible_bit,
|
||||
_object_header_being_created_bit,
|
||||
_object_header_being_deleted_bit,
|
||||
_object_header_do_not_update_bit,
|
||||
_object_header_connected_to_map_bit,
|
||||
_object_header_automatically_deactivate_bit,
|
||||
_object_header_child_bit,
|
||||
NUMBER_OF_OBJECT_HEADER_FLAGS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_invisible_bit= 0,
|
||||
_object_on_ground_bit,
|
||||
_object_on_media_bit,
|
||||
_object_partially_under_media_bit,
|
||||
_object_wholly_under_media_bit,
|
||||
_object_at_rest_bit,
|
||||
_object_child_locations_invalid_bit,
|
||||
_object_animates_automatically_bit,
|
||||
_object_has_attached_lights_bit,
|
||||
_object_has_attached_shader_bit,
|
||||
_object_has_attached_looping_sounds_bit,
|
||||
_object_connected_to_map_bit,
|
||||
_object_mirrored_bit,
|
||||
_object_dynamic_lighting_recompute_bit,
|
||||
_object_static_lighting_recompute_bit,
|
||||
_object_static_lighting_raycast_sideways_bit,
|
||||
_object_garbage_bit,
|
||||
_object_cannot_be_garbage_bit,
|
||||
_object_shadowless_bit,
|
||||
_object_deleted_when_deactivated_bit,
|
||||
_object_cannot_be_activated_bit,
|
||||
_object_outside_of_map_bit,
|
||||
_object_movie_star_bit,
|
||||
_object_do_not_recompute_node_matrices_bit,
|
||||
_object_no_collisions_bit,
|
||||
_object_has_collision_model_bit,
|
||||
_object_force_baseline_update_bit,
|
||||
_object_has_been_updated_from_network_bit,
|
||||
NUMBER_OF_OBJECT_DATA_FLAGS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_new_object_mirrored_bit= 0,
|
||||
_new_object_never_automatically_delete_bit,
|
||||
NUMBER_OF_NEW_OBJECT_DATA_FLAGS,
|
||||
};
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
_object_passed_body_damage_threshold_bit= 0,
|
||||
_object_passed_shield_damage_threshold_bit,
|
||||
_object_dead_bit,
|
||||
_object_shield_depleted_bit,
|
||||
_object_shield_over_charging_bit,
|
||||
_object_die_act_of_god_bit,
|
||||
_object_die_act_of_god_silent_bit,
|
||||
_object_melee_attack_inhibited_bit,
|
||||
_object_ranged_attack_inhibited_bit,
|
||||
_object_walking_inhibited_bit,
|
||||
_object_cannot_hold_weapon_bit,
|
||||
_object_cannot_take_damage_bit,
|
||||
_object_shield_charging_bit,
|
||||
_object_die_act_of_god_no_statistics_bit,
|
||||
NUMBER_OF_OBJECT_DAMAGE_FLAGS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_attachment_type_light= 0,
|
||||
_object_attachment_type_looping_sound,
|
||||
_object_attachment_type_effect,
|
||||
_object_attachment_type_contrail,
|
||||
_object_attachment_type_particle_system,
|
||||
NUMBER_OF_OBJECT_ATTACHMENT_TYPES,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_function_reference_none= 0,
|
||||
_object_function_reference_a,
|
||||
_object_function_reference_b,
|
||||
_object_function_reference_c,
|
||||
_object_function_reference_d,
|
||||
NUMBER_OF_OBJECT_FUNCTION_REFERENCES,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_function_none= 0,
|
||||
_object_function_body_vitality,
|
||||
_object_function_shield_vitality,
|
||||
_object_function_recent_body_damage,
|
||||
_object_function_recent_shield_damage,
|
||||
_object_function_random_constant,
|
||||
_object_function_umbrella_shield_vitality,
|
||||
_object_function_shield_stun,
|
||||
_object_function_recent_umbrella_shield_vitality,
|
||||
_object_function_umbrella_shield_stun,
|
||||
_object_function_first_region_damage,
|
||||
_object_function_last_region_damage= 17,
|
||||
_object_function_alive,
|
||||
_object_function_compass,
|
||||
NUMBER_OF_OBJECT_FUNCTION_MODES,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_object_change_color_a= 0,
|
||||
_object_change_color_b,
|
||||
_object_change_color_c,
|
||||
_object_change_color_d,
|
||||
NUMBER_OF_OBJECT_CHANGE_COLORS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_pvs_activation_normal= 0,
|
||||
_pvs_activation_object,
|
||||
_pvs_activation_cluster,
|
||||
NUMBER_OF_OBJECT_PVS_ACTIVATION_TYPES,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_garbage_collect_everything= 0,
|
||||
_garbage_collect_active_objects,
|
||||
_garbage_collect_for_space,
|
||||
NUMBER_OF_GARBAGE_COLLECTION_MODES,
|
||||
};
|
||||
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define object_header_get(index) ((struct object_header_datum*)datum_get(object_header_data, (index)))
|
||||
#define object_header_try_and_get(index) ((struct object_header_datum*)datum_try_and_get(object_header_data, (index)))
|
||||
|
||||
#define object_get(index) ((struct object_datum*)object_get_and_verify_type(index, _object_mask_all))
|
||||
#define object_try_and_get(index) ((struct object_datum*)object_try_and_get_and_verify_type(index, _object_mask_all))
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
typedef void (*object_deleted_proc)(long);
|
||||
|
||||
|
||||
struct object_cluster_iterator
|
||||
{
|
||||
struct cluster_partition *cluster_partition;
|
||||
long reference_index;
|
||||
};
|
||||
|
||||
struct object_header_datum
|
||||
{
|
||||
short identifier;
|
||||
byte flags;
|
||||
byte type;
|
||||
short cluster_index;
|
||||
short data_size;
|
||||
struct object_datum *datum;
|
||||
};
|
||||
|
||||
struct location
|
||||
{
|
||||
long leaf_index;
|
||||
short cluster_index;
|
||||
word bonus;
|
||||
};
|
||||
|
||||
struct animation_state
|
||||
{
|
||||
short index;
|
||||
short frame_index;
|
||||
};
|
||||
|
||||
struct object_animation_state
|
||||
{
|
||||
long animation_graph_index;
|
||||
struct animation_state state;
|
||||
short interpolation_frame_index;
|
||||
short interpolation_frame_count;
|
||||
};
|
||||
|
||||
struct object_header_block_reference
|
||||
{
|
||||
short size;
|
||||
short offset;
|
||||
};
|
||||
|
||||
struct _object_datum
|
||||
{
|
||||
unsigned long flags;
|
||||
long magic_number;
|
||||
real_point3d position;
|
||||
real_vector3d translational_velocity;
|
||||
real_vector3d forward;
|
||||
real_vector3d up;
|
||||
real_vector3d angular_velocity;
|
||||
struct location location;
|
||||
real_point3d bounding_sphere_center;
|
||||
real bounding_sphere_radius;
|
||||
real scale;
|
||||
short type;
|
||||
word render_flags;
|
||||
short owner_team_index;
|
||||
short name_index;
|
||||
short idle_ticks;
|
||||
short variant_number;
|
||||
long owner_player_index;
|
||||
long owner_object_index;
|
||||
long owner_object_definition_index;
|
||||
struct object_animation_state animation;
|
||||
real maximum_body_vitality;
|
||||
real maximum_shield_vitality;
|
||||
real body_vitality;
|
||||
real shield_vitality;
|
||||
real current_shield_damage;
|
||||
real current_body_damage;
|
||||
long umbrella_shield_object_index;
|
||||
real recent_shield_damage;
|
||||
real recent_body_damage;
|
||||
long shield_damage_decay_timer;
|
||||
long body_damage_decay_timer;
|
||||
short shield_stun_ticks;
|
||||
word damage_flags;
|
||||
long scenery_idx;
|
||||
long first_cluster_reference_index;
|
||||
long next_garbage_object_index;
|
||||
long next_object_index;
|
||||
long first_child_object_index;
|
||||
long parent_object_index;
|
||||
char parent_node_index;
|
||||
byte pad[1];
|
||||
boolean force_shield_update;
|
||||
byte functions_active_flags;
|
||||
real incoming_function_values[NUMBER_OF_INCOMING_OBJECT_FUNCTIONS];
|
||||
real outgoing_function_values[NUMBER_OF_OUTGOING_OBJECT_FUNCTIONS];
|
||||
char attachment_types[MAXIMUM_NUMBER_OF_ATTACHMENTS_PER_OBJECT];
|
||||
long attachment_indices[MAXIMUM_NUMBER_OF_ATTACHMENTS_PER_OBJECT];
|
||||
long first_widget_index;
|
||||
long cached_render_state_index;
|
||||
word regions_destroyed_flags;
|
||||
short forced_shader_permutation_index;
|
||||
byte region_damage[MAXIMUM_REGIONS_PER_OBJECT];
|
||||
byte region_permutations[MAXIMUM_REGIONS_PER_OBJECT];
|
||||
real_rgb_color base_change_colors[NUMBER_OF_OBJECT_CHANGE_COLORS];
|
||||
real_rgb_color outgoing_change_colors[NUMBER_OF_OBJECT_CHANGE_COLORS];
|
||||
struct object_header_block_reference original_node_orientations;
|
||||
struct object_header_block_reference node_orientations;
|
||||
struct object_header_block_reference node_matrices;
|
||||
};
|
||||
|
||||
struct object_datum
|
||||
{
|
||||
long definition_index;
|
||||
struct _object_datum object;
|
||||
};
|
||||
|
||||
struct object_iterator
|
||||
{
|
||||
unsigned long type_flags;
|
||||
byte flags;
|
||||
short absolute_index;
|
||||
long index;
|
||||
unsigned long signature;
|
||||
};
|
||||
|
||||
struct objects_information
|
||||
{
|
||||
short object_count;
|
||||
short active_object_count;
|
||||
real used_memory;
|
||||
};
|
||||
|
||||
struct object_marker
|
||||
{
|
||||
short node_index;
|
||||
real_matrix4x3 node_matrix;
|
||||
real_matrix4x3 matrix;
|
||||
};
|
||||
|
||||
struct object_placement_data
|
||||
{
|
||||
long definition_index;
|
||||
unsigned long flags;
|
||||
long owner_player_index;
|
||||
long owner_object_index;
|
||||
long owner_object_definition_index;
|
||||
short owner_team_index;
|
||||
short variant_number;
|
||||
real_point3d position;
|
||||
real height;
|
||||
real_vector3d translational_velocity;
|
||||
real_vector3d forward;
|
||||
real_vector3d up;
|
||||
real_vector3d angular_velocity;
|
||||
real_rgb_color change_colors[NUMBER_OF_OBJECT_CHANGE_COLORS];
|
||||
};
|
||||
|
||||
/* ---------- prototypes/OBJECTS.C */
|
||||
|
||||
long cluster_get_first_noncollideable_object(long *reference_index, short cluster_index);
|
||||
long cluster_get_next_noncollideable_object(long *reference_index);
|
||||
long cluster_get_first_collideable_object(long *reference_index, short cluster_index);
|
||||
long cluster_get_next_collideable_object(long *reference_index);
|
||||
short object_get_next_cluster(struct object_cluster_iterator *iterator);
|
||||
void *object_try_and_get_and_verify_type(long object_index, unsigned long valid_type_flags);
|
||||
void *object_get_and_verify_type(long object_index, unsigned long valid_type_flags);
|
||||
void object_iterator_new(struct object_iterator *iterator, unsigned long type_flags, byte flags);
|
||||
void *object_iterator_next(struct object_iterator *iterator);
|
||||
long object_get_ultimate_parent(long object_index);
|
||||
void object_add_scenario_permutation(long object_index, struct scenario_object_permutation *permutation);
|
||||
void object_set_object_index_for_name_index(short name_index, long object_index);
|
||||
void objects_fix_for_deleted_object(long deleted_object_index);
|
||||
void object_set_garbage(long object_index, boolean garbage);
|
||||
void garbage_collect_now(void);
|
||||
void objects_information_get(struct objects_information *information);
|
||||
void object_pvs_set_object(long object_index);
|
||||
void object_pvs_set_camera_point(short camera_point_index);
|
||||
void object_pvs_clear(void);
|
||||
short objects_get_activating_cluster_index(void);
|
||||
void object_definition_predict(long definition_index);
|
||||
void object_predict(long object_index);
|
||||
void object_beautify(long object_index, boolean beautiful);
|
||||
void *object_header_block_get(long object_index, struct object_header_block_reference *reference);
|
||||
boolean object_header_block_allocate(long object_index, short block_reference_offset, short size);
|
||||
void object_scripting_set_collideable(long object_index, boolean collideable);
|
||||
void object_marker_begin(void);
|
||||
void object_marker_end(void);
|
||||
boolean object_unmarked_function(long object_index);
|
||||
boolean object_mark_function(long object_index);
|
||||
void objects_place(void);
|
||||
long find_objects_from_point_vector(
|
||||
real_point3d const *position,
|
||||
real_vector3d const *direction,
|
||||
boolean(*add_object_function)(long, void *),
|
||||
void *custom_data,
|
||||
long maximum_object_count,
|
||||
long *object_indices);
|
||||
void objects_dump_memory(void);
|
||||
void objects_initialize(void);
|
||||
void objects_initialize_for_new_map(void);
|
||||
void objects_dispose_from_old_map(void);
|
||||
void objects_dispose(void);
|
||||
void object_activate(long object_index);
|
||||
void object_deactivate(long object_index);
|
||||
void object_reset(long object_index);
|
||||
void object_placement_data_new(struct object_placement_data *data, long definition_index, long owner_object_index);
|
||||
void object_disconnect_from_map(long object_index);
|
||||
short object_get_first_cluster(struct object_cluster_iterator *iterator, long object_index);
|
||||
real_matrix4x3 *object_get_node_matrices(long object_index);
|
||||
char const *object_get_attachment_marker_name(long object_index, short attachment_index);
|
||||
boolean object_has_node(long object_index, short node_index);
|
||||
void object_set_automatic_deactivation(long object_index, boolean automatic_deactivation);
|
||||
void object_set_visibility(long object_index, boolean visible_flag);
|
||||
void object_get_velocities(long object_index, real_vector3d *translational_velocity, real_vector3d *angular_velocity);
|
||||
struct location *object_get_location(long object_index, struct location *location);
|
||||
void object_start_interpolation(long object_index, short frame_count);
|
||||
void object_offset_interpolation(long object_index, real_vector3d *offset);
|
||||
void object_permute_region(long object_index, char *permutation_name, short desired_region_index, boolean active_flag);
|
||||
boolean object_get_function_value(long object_index, short function_index, real *value_reference);
|
||||
short objects_in_clusters_by_indices(unsigned long class_flags, short cluster_count, short const *cluster_indices, short maximum_object_count, long *object_indices);
|
||||
long object_index_from_name_index(short name_index);
|
||||
void objects_disconnect_from_structure_bsp(void);
|
||||
boolean object_visible_to_any_player(long object_index);
|
||||
void object_pvs_activate(long object_index);
|
||||
void objects_scripting_set_scale(long object_index, real scale, short interpolation_frame_count);
|
||||
void object_delete(long object_index);
|
||||
void object_reconnect_to_map(long object_index, struct location const *location);
|
||||
real_matrix4x3 *object_get_node_matrix(long object_index, short node_index);
|
||||
short object_get_marker_by_name(long object_index, char const *name, struct object_marker *markers, short maximum_marker_count);
|
||||
void object_align_marker_to_matrix(struct object_datum *object, struct object_marker const *child_marker, real_matrix4x3 const *destination_matrix);
|
||||
void object_detach(long child_object_index);
|
||||
real_point3d *object_get_origin(long object_index, real_point3d *origin);
|
||||
void object_get_orientation(long object_index, real_vector3d *forward, real_vector3d *up);
|
||||
real_matrix4x3 *object_get_world_matrix(long object_index, real_matrix4x3 *matrix);
|
||||
void object_inverse_kinematics(long hand_object_index, char *hand_marker_name, long grip_object_index, char *grip_marker_name, real_matrix4x3 *node_matrices);
|
||||
short objects_in_sphere(unsigned long class_flags, unsigned long type_flags, struct location const *location, real_point3d const *center, real radius, long *object_indices, short maximum_count);
|
||||
void objects_reconnect_to_structure_bsp(void);
|
||||
void objects_paparazzi(void);
|
||||
void object_export_function_values(long object_index);
|
||||
void object_compute_node_matrices(long object_index);
|
||||
void objects_scripting_detach(long parent_object_index, long child_object_index);
|
||||
void object_render_debug(long object_index);
|
||||
void object_set_position(long object_index, real_point3d const *position, real_vector3d const *forward, real_vector3d const *up);
|
||||
void object_translate(long object_index, real_point3d const *new_position, struct location const *new_location);
|
||||
long object_new(struct object_placement_data *data);
|
||||
void object_attach_to_node(long parent_object_index, long child_object_index, short parent_node_index);
|
||||
boolean object_force_inside_bsp(long object_index, real_point3d const *known_good_point);
|
||||
boolean object_update(long object_index);
|
||||
void object_compute_node_matrices_recursive(long object_index);
|
||||
long object_new_from_scenario(struct scenario_object_datum *scenario_object, struct tag_block *palette);
|
||||
void object_attach_to_marker(long parent_object_index, char const *parent_marker_name, long child_object_index, char const *child_marker_name);
|
||||
long object_new_by_name(short name_index);
|
||||
void objects_scripting_attach(long parent_object_index, char const *parent_marker_name, long child_object_index, char const *child_marker_name);
|
||||
void object_delete_immediately(long object_index);
|
||||
void objects_garbage_collection(void);
|
||||
void objects_update(void);
|
||||
void objects_memory_compact(void);
|
||||
|
||||
|
||||
/* ---------- prototypes/OBJECT_DELETED_PROCS.C */
|
||||
|
||||
void object_deleted_procs_call(long deleted_object_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
/* comm */
|
||||
boolean debug_objects_names;
|
||||
boolean debug_objects_pathfinding_spheres;
|
||||
boolean debug_objects_physics;
|
||||
boolean debug_objects_root_node;
|
||||
|
||||
/* comm */
|
||||
long global_object_marker;
|
||||
|
||||
/* comm */
|
||||
struct cluster_partition noncollideable_object_cluster_partition;
|
||||
struct cluster_partition collideable_object_cluster_partition;
|
||||
|
||||
/* comm */
|
||||
boolean debug_object_garbage_collection;
|
||||
|
||||
/* comm */
|
||||
struct data_array *object_header_data;
|
||||
|
||||
extern boolean debug_objects_position_velocity;
|
||||
extern boolean debug_objects_bounding_spheres;
|
||||
extern boolean debug_objects_collision_models;
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
__inline short object_get_type(
|
||||
long object_index)
|
||||
{
|
||||
return object_header_get(object_index)->type;
|
||||
}
|
||||
|
||||
__inline void object_get_bounding_sphere(
|
||||
long object_index,
|
||||
real_point3d *center,
|
||||
real *radius)
|
||||
{
|
||||
struct object_datum *object= object_get(object_index);
|
||||
|
||||
match_assert("..\\objects\\objects.h", 535, center);
|
||||
match_assert("..\\objects\\objects.h", 536, radius);
|
||||
|
||||
*center= object->object.bounding_sphere_center;
|
||||
*radius= object->object.bounding_sphere_radius;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
__inline void object_get_render_bounding_sphere(
|
||||
long object_index,
|
||||
real_point3d *center,
|
||||
real *radius)
|
||||
{
|
||||
struct object_datum *object= object_get(object_index);
|
||||
|
||||
match_assert("..\\objects\\objects.h", 551, center);
|
||||
match_assert("..\\objects\\objects.h", 552, radius);
|
||||
|
||||
*center= object->object.bounding_sphere_center;
|
||||
*radius= object_definition_get(object->definition_index)->object.render_bounding_radius;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#endif // __OBJECTS_H
|
||||
@@ -14,7 +14,14 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/WIDGETS.C */
|
||||
|
||||
void widgets_initialize(void);
|
||||
void widgets_initialize_for_new_map(void);
|
||||
void widgets_dispose_from_old_map(void);
|
||||
void widgets_dispose(void);
|
||||
void widgets_new(long object_index);
|
||||
void widgets_delete(long object_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -8,12 +8,21 @@ header included in hcex build.
|
||||
#define __BSP2D_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "tag_files/tag_groups.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct bsp2d
|
||||
{
|
||||
struct tag_block nodes;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
+14
-1
@@ -8,13 +8,26 @@ header included in hcex build.
|
||||
#define __BSP3D_H
|
||||
#pragma once
|
||||
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "tag_files/tag_groups.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct bsp3d
|
||||
{
|
||||
struct tag_block nodes;
|
||||
struct tag_block planes;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/BSP3D.C */
|
||||
|
||||
long bsp3d_test_point(struct bsp3d const *bsp, long node_index, union real_point3d const *point);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -14,7 +14,27 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct collision_bsp_test_sphere_result
|
||||
{
|
||||
long surface_count;
|
||||
long surface_indices[256];
|
||||
long edge_count;
|
||||
long edge_indices[256];
|
||||
long vertex_count;
|
||||
long vertex_indices[256];
|
||||
long leaf_count;
|
||||
long leaf_indices[256];
|
||||
};
|
||||
|
||||
/* ---------- prototypes/COLLISION_BSP.C */
|
||||
|
||||
boolean collision_bsp_test_sphere(
|
||||
struct collision_bsp const *bsp,
|
||||
short breakable_surface_count,
|
||||
byte const *breakable_surface_flags,
|
||||
union real_point3d const *center,
|
||||
real radius,
|
||||
struct collision_bsp_test_sphere_result *result);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -8,12 +8,29 @@ header included in hcex build.
|
||||
#define __COLLISION_BSP_DEFINITIONS_H
|
||||
#pragma once
|
||||
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "bsp2d.h"
|
||||
#include "bsp3d.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct collision_bsp
|
||||
{
|
||||
struct bsp3d bsp3d;
|
||||
struct tag_block leaves;
|
||||
struct tag_block bsp2d_references;
|
||||
struct bsp2d bsp2d;
|
||||
struct tag_block surfaces;
|
||||
struct tag_block edges;
|
||||
struct tag_block vertices;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
@@ -8,13 +8,41 @@ header included in hcex build.
|
||||
#define __COLLISION_MODEL_DEFINITIONS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "math/real_math.h"
|
||||
#include "objects/damage_resistances.h"
|
||||
#include "tag_files/tag_groups.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
// Couldn't find tag constants for this definition?
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define collision_model_definition_get(index) ((struct collision_model *)tag_get('coll', index))
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct pathfinding_sphere
|
||||
{
|
||||
short node_index;
|
||||
word pad;
|
||||
long unused[3];
|
||||
real_point3d center;
|
||||
real radius;
|
||||
};
|
||||
|
||||
struct collision_model
|
||||
{
|
||||
struct damage_resistance resistance;
|
||||
long unused[4];
|
||||
real_rectangle3d pathfinding_box;
|
||||
struct tag_block pathfinding_spheres; // pathfinding_sphere
|
||||
struct tag_block nodes;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/COLLISION_MODEL_DEFINITIONS.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -14,7 +14,19 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct collision_model_instance
|
||||
{
|
||||
long object_index;
|
||||
const struct collision_model *model;
|
||||
const byte *region_permutation_indices;
|
||||
const struct real_matrix4x3 *matrices;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/COLLISION_MODELS.C */
|
||||
|
||||
boolean collision_model_instance_new(struct collision_model_instance *instance, long object_index);
|
||||
|
||||
void render_debug_collision_model(struct collision_model_instance *instance);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -10,6 +10,11 @@ header included in hcex build.
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
MAXIMUM_COLLISION_USER_STACK_DEPTH= 32,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
@@ -18,6 +23,9 @@ header included in hcex build.
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
extern short global_current_collision_user_depth;
|
||||
extern short global_current_collision_users[MAXIMUM_COLLISION_USER_STACK_DEPTH];
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
#endif // __COLLISION_USAGE_H
|
||||
@@ -8,16 +8,109 @@ header included in hcex build.
|
||||
#define __COLLISIONS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "objects.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
_collision_test_front_facing_surfaces_bit= 0,
|
||||
_collision_test_back_facing_surfaces_bit,
|
||||
_collision_test_ignore_two_sided_surfaces_bit,
|
||||
_collision_test_ignore_invisible_surfaces_bit,
|
||||
_collision_test_ignore_breakable_surfaces_bit,
|
||||
_collision_test_structure_bit,
|
||||
_collision_test_media_bit,
|
||||
_collision_test_objects_bit,
|
||||
|
||||
_collision_test_objects_first_type_bit,
|
||||
_collision_test_objects_bipeds_bit= _collision_test_objects_first_type_bit,
|
||||
_collision_test_objects_vehicles_bit,
|
||||
_collision_test_objects_weapons_bit,
|
||||
_collision_test_objects_equipment_bit,
|
||||
_collision_test_objects_garbage_bit,
|
||||
_collision_test_objects_projectiles_bit,
|
||||
_collision_test_objects_scenery_bit,
|
||||
_collision_test_objects_machines_bit,
|
||||
_collision_test_objects_controls_bit,
|
||||
_collision_test_objects_light_fixtures_bit,
|
||||
_collision_test_objects_placeholders_bit,
|
||||
_collision_test_objects_last_type_bit,
|
||||
|
||||
_collision_test_try_to_keep_location_valid_bit,
|
||||
_collision_test_skip_passthrough_bipeds_bit,
|
||||
_collision_test_use_vehicle_physics_bit,
|
||||
|
||||
NUMBER_OF_COLLISION_TEST_FLAGS,
|
||||
|
||||
_collision_test_objects_sight_blocking_flags=
|
||||
FLAG(_collision_test_objects_vehicles_bit) |
|
||||
FLAG(_collision_test_objects_scenery_bit) |
|
||||
FLAG(_collision_test_objects_machines_bit),
|
||||
|
||||
_collision_test_objects_all_types_flags=
|
||||
FLAG(_collision_test_objects_last_type_bit+1)-FLAG(_collision_test_objects_first_type_bit),
|
||||
|
||||
_collision_test_environment_flags=
|
||||
FLAG(_collision_test_front_facing_surfaces_bit) |
|
||||
FLAG(_collision_test_structure_bit) |
|
||||
FLAG(_collision_test_media_bit),
|
||||
|
||||
_collision_test_for_projectiles_flags= 0x1000E9,
|
||||
_collision_test_for_projectiles_fat_flags= 0x89,
|
||||
_collision_test_for_line_of_sight_flags= 0xC2AD,
|
||||
_collision_test_for_bipeds_living_flags= 0x20C3A0,
|
||||
_collision_test_for_bipeds_passthrough_living_flags= 0xC2A0,
|
||||
_collision_test_for_bipeds_dead_flags= 0xC0A0,
|
||||
_collision_test_for_vehicles_flags= 0xC0A0,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct collision_result
|
||||
{
|
||||
short type;
|
||||
struct location start_location;
|
||||
struct location location;
|
||||
real t;
|
||||
real_point3d point;
|
||||
real_plane3d plane;
|
||||
short material_type;
|
||||
long object_index;
|
||||
short region_index;
|
||||
short node_index;
|
||||
short bsp_index;
|
||||
long surface_index;
|
||||
long plane_designator;
|
||||
byte flags;
|
||||
byte breakable_surface_index;
|
||||
short material_index;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/COLLISIONS.C */
|
||||
|
||||
boolean collision_test_vector(unsigned long flags, real_point3d const *point, real_vector3d const *vector, long ignore_object_index, struct collision_result *collision);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
__inline boolean collision_test_line(
|
||||
unsigned long flags,
|
||||
real_point3d const *point0,
|
||||
real_point3d const *point1,
|
||||
long ignore_object_index,
|
||||
struct collision_result *collision)
|
||||
{
|
||||
real_vector3d vector;
|
||||
|
||||
vector_from_points3d(point0, point1, &vector);
|
||||
return collision_test_vector(flags, point0, &vector, ignore_object_index, collision);
|
||||
}
|
||||
|
||||
|
||||
#endif // __COLLISIONS_H
|
||||
@@ -8,13 +8,29 @@ header included in hcex build.
|
||||
#define __PHYSICS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "math/real_math.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct physics_instance
|
||||
{
|
||||
long object_index;
|
||||
const struct physics_definition *physics;
|
||||
real_matrix4x3 world_matrix;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/PHYSICS.C */
|
||||
|
||||
boolean physics_instance_new(struct physics_instance *instance, long object_index);
|
||||
|
||||
void render_debug_physics(struct physics_instance *instance);
|
||||
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -94,6 +94,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "rasterizer_geometry.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
@@ -10,10 +10,43 @@ header included in hcex build.
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
_rasterizer_vertex_type_environment_uncompressed= 0,
|
||||
_rasterizer_vertex_type_environment_compressed,
|
||||
_rasterizer_vertex_type_environment_lightmap_uncompressed,
|
||||
_rasterizer_vertex_type_environment_lightmap_compressed,
|
||||
_rasterizer_vertex_type_model_uncompressed,
|
||||
_rasterizer_vertex_type_model_compressed,
|
||||
_rasterizer_vertex_type_dynamic_unlit,
|
||||
_rasterizer_vertex_type_dynamic_lit,
|
||||
_rasterizer_vertex_type_dynamic_screen,
|
||||
_rasterizer_vertex_type_debug,
|
||||
_rasterizer_vertex_type_decal,
|
||||
_rasterizer_vertex_type_detail_object,
|
||||
_rasterizer_vertex_type_environment_uncompressed_ff,
|
||||
_rasterizer_vertex_type_environment_lightmap_uncompressed_ff,
|
||||
_rasterizer_vertex_type_model_uncompressed_ff,
|
||||
_rasterizer_vertex_type_model_processed,
|
||||
_rasterizer_vertex_type_unlit_zsprite,
|
||||
_rasterizer_vertex_type_widget,
|
||||
NUMBER_OF_RASTERIZER_VERTEX_TYPES,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct vertex_buffer
|
||||
{
|
||||
short type;
|
||||
word pad;
|
||||
long count;
|
||||
long offset;
|
||||
void *base_address;
|
||||
void *hardware_format;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
@@ -33,6 +33,27 @@ enum
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct render_distant_light
|
||||
{
|
||||
real_rgb_color color;
|
||||
real_vector3d direction;
|
||||
};
|
||||
|
||||
struct render_lighting
|
||||
{
|
||||
real_rgb_color ambient_color;
|
||||
short distant_light_count;
|
||||
word pad;
|
||||
struct render_distant_light distant_lights[MAXIMUM_RENDERED_DISTANT_LIGHTS];
|
||||
short point_light_count;
|
||||
word pad1;
|
||||
long point_light_indices[MAXIMUM_RENDERED_POINT_LIGHTS];
|
||||
real_argb_color reflection_tint_color;
|
||||
real_vector3d shadow_vector;
|
||||
real_rgb_color shadow_color;
|
||||
};
|
||||
|
||||
|
||||
struct rendered_cluster
|
||||
{
|
||||
short cluster_index;
|
||||
|
||||
@@ -14,7 +14,17 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
/* ---------- prototypes/RENDER_DEBUG.C */
|
||||
|
||||
void render_debug_string_at_point(boolean immediate, real_point3d *point, const char *string, real_argb_color const *color);
|
||||
|
||||
void render_debug_line(boolean immediate, real_point3d const *point0, real_point3d const *point1, real_argb_color const *color);
|
||||
|
||||
void render_debug_vector(boolean immediate, real_point3d const *point, real_vector3d const *vector, real size, real_argb_color const *color);
|
||||
|
||||
void render_debug_matrix(boolean immediate, const struct real_matrix4x3 *matrix, real size);
|
||||
|
||||
void render_debug_sphere(boolean, real_point3d const *center, real radius, real_argb_color const *color);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -161,6 +161,11 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "scenario.h"
|
||||
|
||||
#include "physics/bsp3d.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -173,4 +178,12 @@ symbols in this file:
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
long scenario_leaf_index_from_point(
|
||||
const union real_point3d *point)
|
||||
{
|
||||
match_assert("c:\\halo\\SOURCE\\scenario\\scenario.c", 213, global_bsp3d);
|
||||
|
||||
return bsp3d_test_point(global_bsp3d, 0, point);
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -8,8 +8,46 @@ header included in hcex build.
|
||||
#define __SCENARIO_H
|
||||
#pragma once
|
||||
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "real_math.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
MAXIMUM_SCENARIO_PLAYERS_PER_BLOCK= 0x100,
|
||||
MAXIMUM_TRIGGER_VOLUMES_PER_SCENARIO= 0x100,
|
||||
MAXIMUM_FUNCTIONS_PER_SCENARIO= 0x20,
|
||||
MAXIMUM_OBJECT_NAMES_PER_SCENARIO= 0x200,
|
||||
MAXIMUM_DEVICE_GROUPS_PER_SCENARIO= 0x80,
|
||||
MAXIMUM_SCENARIO_OBJECT_PALETTE_ENTRIES_PER_BLOCK= 0x64,
|
||||
MAXIMUM_CUTSCENE_FLAGS_PER_SCENARIO= 0x200,
|
||||
MAXIMUM_CUTSCENE_CAMERA_POINTS_PER_SCENARIO= 0x200,
|
||||
MAXIMUM_CUTSCENE_TITLES_PER_SCENARIO= 0x40,
|
||||
MAXIMUM_SCENARIO_NETGAME_FLAGS_PER_SCENARIO= 0xC8,
|
||||
MAXIMUM_SCENARIO_NETGAME_EQUIPMENT_PER_SCENARIO= 0xC8,
|
||||
MAXIMUM_SCENARIO_STARTING_EQUIPMDNG_PER_SCENARIO= 0xC8,
|
||||
MAXIMUM_STRUCTURE_BSPS_PER_SCENARIO= 0x10,
|
||||
MAXIMUM_CHILD_SCENARIOS_PER_SCENARIO= 0x10,
|
||||
MAXIMUM_SKIES_PER_SCENARIO= 0x8,
|
||||
MAXIMUM_DECALS_PER_SCENARIO= 0x10000,
|
||||
MAXIMUM_DECAL_PALETTES_PER_SCENARIO= 0x80,
|
||||
MAXIMUM_SCENERY_DATUMS_PER_SCENARIO= 0x7D0,
|
||||
MAXIMUM_SOUND_SCENERY_DATUMS_PER_SCENARIO= 0x100,
|
||||
MAXIMUM_WEAPON_DATUMS_PER_SCENARIO= 0x80,
|
||||
MAXIMUM_EQUIPMENT_DATUMS_PER_SCENARIO= 0x100,
|
||||
MAXIMUM_BIPED_DATUMS_PER_SCENARIO= 0x80,
|
||||
MAXIMUM_VEHICLE_DATUMS_PER_SCENARIO= 0x50,
|
||||
MAXIMUM_MACHINE_DATUMS_PER_SCENARIO= 0x190,
|
||||
MAXIMUM_CONTROL_DATUMS_PER_SCENARIO= 0x64,
|
||||
MAXIMUM_LIGHT_FIXTURE_DATUMS_PER_SCENARIO= 0x1F4,
|
||||
MAXIMUM_EDITOR_SCENARIO_DATA_SIZE= 0x10000,
|
||||
MAXIMUM_EDITOR_COMMENTS= 0x400,
|
||||
MAXIMUM_EDITOR_COMMENT_LENGTH= 0x4000,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
@@ -65,6 +103,12 @@ void scenario_get_atmospheric_fog(short local_player_index, short sky_index, rea
|
||||
extern long global_scenario_index;
|
||||
extern short global_structure_bsp_index;
|
||||
|
||||
/* comm */
|
||||
struct scenario *global_scenario;
|
||||
|
||||
/* comm */
|
||||
struct bsp3d *global_bsp3d;
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
#endif // __SCENARIO_H
|
||||
@@ -8,12 +8,32 @@ header included in hcex build.
|
||||
#define __SCENARIO_DEFINITIONS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "tag_files/tag_files.h"
|
||||
#include "tag_files/tag_groups.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
_scenario_object_placement_not_automatic_bit= 0,
|
||||
_scenario_object_placement_not_on_easy_bit,
|
||||
_scenario_object_placement_not_on_normal_bit,
|
||||
_scenario_object_placement_not_on_hard_bit,
|
||||
NUMBER_OF_SCENARIO_OBJECT_LOCATION_PLACEMENT_FLAGS,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct scenario_object_palette_entry
|
||||
{
|
||||
struct tag_reference reference;
|
||||
unsigned long unused[8];
|
||||
};
|
||||
|
||||
struct scenario_object_datum
|
||||
{
|
||||
short palette_entry_index;
|
||||
@@ -32,6 +52,98 @@ struct scenario_placeholder_datum
|
||||
struct scenario_object_datum object;
|
||||
};
|
||||
|
||||
struct scenario_object_name
|
||||
{
|
||||
char name[TAG_STRING_LENGTH+1];
|
||||
short runtime_object_type;
|
||||
short runtime_scenario_datum_index;
|
||||
};
|
||||
|
||||
struct scenario_cutscene_camera_point
|
||||
{
|
||||
long flags;
|
||||
char name[TAG_STRING_LENGTH+1];
|
||||
long pad;
|
||||
real_point3d position;
|
||||
real_euler_angles3d orientation;
|
||||
real field_of_view;
|
||||
long unused[9];
|
||||
};
|
||||
|
||||
struct scenario
|
||||
{
|
||||
struct tag_reference ugly_structure_bsp;
|
||||
struct tag_reference unloved_globals;
|
||||
struct tag_reference bad_sky;
|
||||
struct tag_block sky_references;
|
||||
short type;
|
||||
word flags;
|
||||
struct tag_block scenario_references;
|
||||
real local_north;
|
||||
unsigned long header_unused[5];
|
||||
long reference_unused[34];
|
||||
struct tag_block predicted_ui_resources;
|
||||
struct tag_block functions;
|
||||
struct tag_data editor_scenario_data;
|
||||
struct tag_block comments;
|
||||
long user_edit_unused[56];
|
||||
struct tag_block object_names; // scenario_object_name
|
||||
struct tag_block scenery;
|
||||
struct tag_block scenery_palette;
|
||||
struct tag_block bipeds;
|
||||
struct tag_block biped_palette;
|
||||
struct tag_block vehicles;
|
||||
struct tag_block vehicle_palette;
|
||||
struct tag_block equipment;
|
||||
struct tag_block equipment_palette;
|
||||
struct tag_block weapons;
|
||||
struct tag_block weapon_palette;
|
||||
struct tag_block device_groups;
|
||||
struct tag_block machines;
|
||||
struct tag_block machine_palette;
|
||||
struct tag_block controls;
|
||||
struct tag_block control_palette;
|
||||
struct tag_block light_fixtures;
|
||||
struct tag_block light_fixtures_palette;
|
||||
struct tag_block sound_scenery;
|
||||
struct tag_block sound_scenery_palette;
|
||||
struct tag_block unused_blocks[7];
|
||||
struct tag_block starting_profiles;
|
||||
struct tag_block players;
|
||||
struct tag_block trigger_volumes;
|
||||
struct tag_block recorded_animations;
|
||||
struct tag_block netgame_flags;
|
||||
struct tag_block netgame_equipment;
|
||||
struct tag_block scenario_starting_equipment;
|
||||
struct tag_block bsp_switch_trigger_volumes;
|
||||
struct tag_block decals;
|
||||
struct tag_block decal_palette;
|
||||
struct tag_block detail_object_collection_palette;
|
||||
long render_unused[21];
|
||||
struct tag_block ai_actor_palette;
|
||||
struct tag_block ai_encounters;
|
||||
struct tag_block ai_command_lists;
|
||||
struct tag_block ai_animation_references;
|
||||
struct tag_block ai_script_references;
|
||||
struct tag_block ai_recording_references;
|
||||
struct tag_block ai_conversations;
|
||||
struct tag_data hs_syntax_data;
|
||||
struct tag_data hs_string_constants;
|
||||
struct tag_block hs_scripts;
|
||||
struct tag_block hs_globals;
|
||||
struct tag_block hs_references;
|
||||
struct tag_block hs_source_files;
|
||||
long scripting_unused[6];
|
||||
struct tag_block cutscene_flags;
|
||||
struct tag_block cutscene_camera_points; // scenario_cutscene_camera_point
|
||||
struct tag_block cutscene_chapter_titles;
|
||||
long rapidly_dwindling_unused_space[27];
|
||||
struct tag_reference custom_object_names;
|
||||
struct tag_reference ingame_help_text;
|
||||
struct tag_reference hud_messages;
|
||||
struct tag_block structure_bsp_references;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
@@ -18,6 +18,8 @@ header included in hcex build.
|
||||
|
||||
void game_sound_clear(void);
|
||||
void game_sound_restore(void);
|
||||
long game_looping_sound_new(long object_index, long definition_index, char const *marker_name, short function_index);
|
||||
void game_looping_sound_delete(long looping_sound_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -10,6 +10,15 @@ file has inline function assertions.
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
LOOPING_SOUND_DEFINITION_TAG= 'lsnd',
|
||||
LOOPING_SOUND_DEFINITION_VERSION= 3,
|
||||
CUSTOM_MUSIC_PLAY_ID= 'mply',
|
||||
MAXIMUM_TRACKS_PER_LOOPING_SOUND= 4,
|
||||
MAXIMUM_DETAIL_SOUNDS_PER_LOOPING_SOUND= 32,
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
@@ -14,7 +14,32 @@ header included in hcex build.
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct cluster_partition
|
||||
{
|
||||
long *cluster_first_data_references;
|
||||
struct data_array *data_reference_data;
|
||||
struct data_array *cluster_reference_data;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/CLUSTER_PARTITIONS.C */
|
||||
|
||||
void cluster_partition_new(struct cluster_partition *partition, char const *name);
|
||||
void cluster_partition_make_valid(struct cluster_partition *partition);
|
||||
void cluster_partition_make_invalid(struct cluster_partition *partition);
|
||||
void cluster_partition_delete(struct cluster_partition *partition);
|
||||
void cluster_partition_reconnect(
|
||||
struct cluster_partition *partition,
|
||||
long datum_index,
|
||||
long *first_cluster_reference,
|
||||
real_point3d const *position,
|
||||
float radius,
|
||||
struct location const *location);
|
||||
void cluster_partition_disconnect(struct cluster_partition *partition, long datum_index, long *first_cluster_reference);
|
||||
long cluster_partition_get_first_datum(struct cluster_partition const *partition, long *reference_index, short cluster_index);
|
||||
long cluster_partition_get_next_datum(struct cluster_partition const *partition, long *reference_index);
|
||||
long cluster_partition_get_first_cluster(struct cluster_partition const *partition, long *reference_index, long first_cluster_reference);
|
||||
long cluster_partition_get_next_cluster(struct cluster_partition const *partition, long *reference_index);
|
||||
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -8,12 +8,23 @@ header included in hcex build.
|
||||
#define __LEAF_MAP_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "tag_files/tag_groups.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct leaf_map
|
||||
{
|
||||
const struct bsp3d *bsp;
|
||||
struct tag_block leaves;
|
||||
struct tag_block portals;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
@@ -1,39 +1,12 @@
|
||||
/*
|
||||
STRUCTURE_BSP_DEFINITIONS.C
|
||||
|
||||
symbols in this file:
|
||||
00182DA0 00a0:
|
||||
_structure_bsp_get_cluster_pvs (0000)
|
||||
00182E40 01b0:
|
||||
_structure_bsp_find_material_for_surface (0000)
|
||||
00182FF0 0030:
|
||||
_vertex_type_from_shader_tag (0000)
|
||||
00183020 00a0:
|
||||
_structure_bsp_get_cluster_encoded_sound_data (0000)
|
||||
001830C0 00a0:
|
||||
_structure_bsp_get_cluster_encoded_sound_distance (0000)
|
||||
002A1078 006c:
|
||||
??_C@_0GM@IEBDGEJL@?$CIcluster_index?$CL1?$CJ?$CKBIT_VECTOR_SIZ@ (0000)
|
||||
002A10E8 0040:
|
||||
??_C@_0EA@EIICKPGK@cluster_index?$DO?$DN0?5?$CG?$CG?5cluster_inde@ (0000)
|
||||
002A1128 0036:
|
||||
??_C@_0DG@NELJLNPJ@c?3?2halo?2SOURCE?2structures?2struct@ (0000)
|
||||
002A1160 0044:
|
||||
??_C@_0EE@GCNBGNLI@surface_index?$DMmaterial?9?$DOfirst_su@ (0000)
|
||||
002A11A4 002d:
|
||||
??_C@_0CN@DMFHEBIB@surface_index?$DO?$DNmaterial?9?$DOfirst_s@ (0000)
|
||||
002A11D4 003b:
|
||||
??_C@_0DL@PINMBEBG@offset?$DO?$DN0?5?$CG?$CG?5offset?$DMstructure_bs@ (0000)
|
||||
002A1210 0017:
|
||||
??_C@_0BH@FKLIMEJG@row_index?$DMcolumn_index?$AA@ (0000)
|
||||
002A1228 0046:
|
||||
??_C@_0EG@FIKJDFNH@to_cluster_index?$DO?$DN0?5?$CG?$CG?5to_cluste@ (0000)
|
||||
002A1270 004a:
|
||||
??_C@_0EK@GPLJLDED@from_cluster_index?$DO?$DN0?5?$CG?$CG?5from_cl@ (0000)
|
||||
*/
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "structure_bsp_definitions.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -46,4 +19,167 @@ symbols in this file:
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
unsigned long *structure_bsp_get_cluster_pvs(
|
||||
struct structure_bsp *structure_bsp,
|
||||
short cluster_index)
|
||||
{
|
||||
match_assert("c:\\halo\\SOURCE\\structures\\structure_bsp_definitions.c", 36, cluster_index>=0 && cluster_index<structure_bsp->clusters.count);
|
||||
match_assert("c:\\halo\\SOURCE\\structures\\structure_bsp_definitions.c",
|
||||
37,
|
||||
(cluster_index+1)*BIT_VECTOR_SIZE_IN_LONGS(structure_bsp->clusters.count)<=structure_bsp->cluster_data.size);
|
||||
|
||||
// Get pointer to bitvector starting at the cluster index
|
||||
return (unsigned long *)(
|
||||
(byte *)structure_bsp->cluster_data.address +
|
||||
sizeof(unsigned long) * cluster_index *
|
||||
BIT_VECTOR_SIZE_IN_LONGS(structure_bsp->clusters.count));
|
||||
}
|
||||
|
||||
void structure_bsp_find_material_for_surface(
|
||||
struct structure_bsp *structure,
|
||||
long surface_index,
|
||||
short *lightmap_index,
|
||||
short *material_index)
|
||||
{
|
||||
struct structure_lightmap *lightmap;
|
||||
struct structure_material *material;
|
||||
short lightmap_last_index;
|
||||
short material_last_index;
|
||||
short i;
|
||||
|
||||
i=0;
|
||||
*lightmap_index= 0;
|
||||
lightmap_last_index= structure->lightmaps.count-1;
|
||||
|
||||
while (lightmap_last_index>i)
|
||||
{
|
||||
struct structure_lightmap *curr_lightmap;
|
||||
|
||||
*lightmap_index= (lightmap_last_index-i) / 2+i;
|
||||
curr_lightmap= TAG_BLOCK_GET_ELEMENT(&structure->lightmaps, *lightmap_index, struct structure_lightmap);
|
||||
|
||||
if (surface_index<TAG_BLOCK_GET_ELEMENT(&curr_lightmap->materials, 0, struct structure_material)->first_surface_index)
|
||||
{
|
||||
lightmap_last_index= *lightmap_index-1;
|
||||
*lightmap_index= lightmap_last_index;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (surface_index<
|
||||
TAG_BLOCK_GET_ELEMENT(&curr_lightmap->materials, curr_lightmap->materials.count-1, struct structure_material)->surface_count+
|
||||
TAG_BLOCK_GET_ELEMENT(&curr_lightmap->materials, curr_lightmap->materials.count-1, struct structure_material)->first_surface_index)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
i= *lightmap_index+1;
|
||||
*lightmap_index= i;
|
||||
}
|
||||
}
|
||||
|
||||
lightmap= TAG_BLOCK_GET_ELEMENT(&structure->lightmaps, *lightmap_index, struct structure_lightmap);
|
||||
|
||||
i=0;
|
||||
*material_index= 0;
|
||||
material_last_index= lightmap->materials.count;
|
||||
|
||||
while (i<material_last_index)
|
||||
{
|
||||
const struct structure_material *curr_material;
|
||||
|
||||
*material_index= (material_last_index-i) / 2+i;
|
||||
curr_material= TAG_BLOCK_GET_ELEMENT(&lightmap->materials, *material_index, struct structure_material);
|
||||
|
||||
if (surface_index<curr_material->first_surface_index)
|
||||
{
|
||||
material_last_index= *material_index-1;
|
||||
*material_index= material_last_index;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (surface_index<curr_material->first_surface_index+curr_material->surface_count)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
i= *material_index+1;
|
||||
*material_index= i;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
material= TAG_BLOCK_GET_ELEMENT(&lightmap->materials, *material_index, struct structure_material);
|
||||
|
||||
match_assert("c:\\halo\\SOURCE\\structures\\structure_bsp_definitions.c", 102, surface_index>=material->first_surface_index);
|
||||
match_assert("c:\\halo\\SOURCE\\structures\\structure_bsp_definitions.c", 103, surface_index<material->first_surface_index+material->surface_count);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void vertex_type_from_shader_tag(
|
||||
unsigned long group_tag,
|
||||
short *vertex_type,
|
||||
short *lightmap_vertex_type,
|
||||
boolean compressed)
|
||||
{
|
||||
if (compressed)
|
||||
{
|
||||
*vertex_type= _rasterizer_vertex_type_environment_compressed;
|
||||
*lightmap_vertex_type= _rasterizer_vertex_type_environment_lightmap_compressed;
|
||||
}
|
||||
else
|
||||
{
|
||||
*vertex_type= _rasterizer_vertex_type_environment_uncompressed;
|
||||
*lightmap_vertex_type= _rasterizer_vertex_type_environment_lightmap_uncompressed;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
byte *structure_bsp_get_cluster_encoded_sound_data(
|
||||
struct structure_bsp *structure_bsp,
|
||||
short row_index,
|
||||
short column_index)
|
||||
{
|
||||
short offset= row_index * (structure_bsp->clusters.count-1)-row_index*(row_index+1)/2+column_index-1;
|
||||
|
||||
match_assert("c:\\halo\\SOURCE\\structures\\structure_bsp_definitions.c", 1202, row_index<column_index);
|
||||
match_assert("c:\\halo\\SOURCE\\structures\\structure_bsp_definitions.c", 1203, offset>=0 && offset<structure_bsp->sound_cluster_data.size);
|
||||
|
||||
return &((byte *)structure_bsp->sound_cluster_data.address)[offset];
|
||||
}
|
||||
|
||||
byte structure_bsp_get_cluster_encoded_sound_distance(
|
||||
struct structure_bsp *structure_bsp,
|
||||
short from_cluster_index,
|
||||
short to_cluster_index)
|
||||
{
|
||||
byte result;
|
||||
|
||||
match_assert("c:\\halo\\SOURCE\\structures\\structure_bsp_definitions.c", 1215, from_cluster_index>=0 && from_cluster_index<structure_bsp->clusters.count);
|
||||
match_assert("c:\\halo\\SOURCE\\structures\\structure_bsp_definitions.c", 1216, to_cluster_index>=0 && to_cluster_index<structure_bsp->clusters.count);
|
||||
|
||||
if (from_cluster_index!=to_cluster_index)
|
||||
{
|
||||
if (from_cluster_index>to_cluster_index)
|
||||
{
|
||||
short temp= from_cluster_index;
|
||||
from_cluster_index= to_cluster_index;
|
||||
to_cluster_index= temp;
|
||||
}
|
||||
|
||||
result= *structure_bsp_get_cluster_encoded_sound_data(
|
||||
structure_bsp,
|
||||
from_cluster_index,
|
||||
to_cluster_index);
|
||||
}
|
||||
else
|
||||
{
|
||||
result= 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -8,13 +8,107 @@ header included in hcex build.
|
||||
#define __STRUCTURE_BSP_DEFINITIONS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "leaf_map.h"
|
||||
|
||||
#include "math/integer_math.h"
|
||||
#include "rasterizer/rasterizer_geometry.h"
|
||||
#include "render/render.h"
|
||||
#include "tag_files/tag_groups.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct structure_leaf
|
||||
{
|
||||
byte_rectangle3d bounds;
|
||||
word pad;
|
||||
short cluster_index;
|
||||
short surface_reference_count;
|
||||
long first_surface_reference_index;
|
||||
};
|
||||
|
||||
struct structure_material
|
||||
{
|
||||
struct tag_reference shader;
|
||||
short permutation_index;
|
||||
word flags;
|
||||
long first_surface_index;
|
||||
long surface_count;
|
||||
real_point3d centroid;
|
||||
struct render_lighting lighting;
|
||||
real_plane3d plane;
|
||||
short breakable_surface_index;
|
||||
word copious_unused_space;
|
||||
struct vertex_buffer vertices;
|
||||
struct vertex_buffer lightmap_vertices;
|
||||
struct tag_data uncompressed_vertex_data;
|
||||
struct tag_data compressed_vertex_data;
|
||||
};
|
||||
|
||||
struct structure_lightmap
|
||||
{
|
||||
short bitmap_index;
|
||||
word pad;
|
||||
long unused[4];
|
||||
struct tag_block materials; // structure_material
|
||||
};
|
||||
|
||||
struct structure_bsp
|
||||
{
|
||||
struct tag_reference lightmap_group;
|
||||
real vehicle_floor;
|
||||
real vehicle_ceiling;
|
||||
long sad_unused[5];
|
||||
struct render_lighting default_lighting;
|
||||
long lonely_unused;
|
||||
struct tag_block collision_materials;
|
||||
struct tag_block collision_bsp; // collision_bsp
|
||||
struct tag_block nodes;
|
||||
real_rectangle3d world_bounds;
|
||||
struct tag_block leaves; // structure_leaf
|
||||
struct tag_block surface_references;
|
||||
struct tag_block surfaces;
|
||||
struct tag_block lightmaps; // structure_lightmap
|
||||
long render_unused[3];
|
||||
struct tag_block lens_flares;
|
||||
struct tag_block lens_flare_markers;
|
||||
struct tag_block clusters;
|
||||
struct tag_data cluster_data;
|
||||
struct tag_block cluster_portals;
|
||||
long cluster_unused[3];
|
||||
struct tag_block breakable_surfaces;
|
||||
struct tag_block fog_planes;
|
||||
struct tag_block fog_regions;
|
||||
struct tag_block fog_palette;
|
||||
long fog_unused[6];
|
||||
struct tag_block weather_palette;
|
||||
struct tag_block weather_polyhedra;
|
||||
long weather_unused[6];
|
||||
struct tag_block pathfinding_surfaces;
|
||||
struct tag_block pathfinding_edges;
|
||||
struct tag_block background_sound_palette;
|
||||
struct tag_block sound_environment_palette;
|
||||
struct tag_data sound_cluster_data;
|
||||
long sound_unused[6];
|
||||
struct tag_block markers;
|
||||
struct tag_block detail_object_data;
|
||||
struct tag_block runtime_decals;
|
||||
long diminishing_misc_unused[2];
|
||||
struct leaf_map leaf_map;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/STRUCTURE_BSP_DEFINITIONS.C */
|
||||
|
||||
unsigned long *structure_bsp_get_cluster_pvs(struct structure_bsp *structure_bsp, short cluster_index);
|
||||
void structure_bsp_find_material_for_surface(struct structure_bsp *structure, long surface_index, short *lightmap_index, short *material_index);
|
||||
void vertex_type_from_shader_tag(unsigned long group_tag, short *vertex_type, short *lightmap_vertex_type, boolean compressed);
|
||||
byte *structure_bsp_get_cluster_encoded_sound_data(struct structure_bsp *structure_bsp, short row_index, short column_index);
|
||||
byte structure_bsp_get_cluster_encoded_sound_distance(struct structure_bsp *structure_bsp, short from_cluster_index, short to_cluster_index);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -48,6 +48,11 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
|
||||
#include "structure_bsp_definitions.h"
|
||||
#include "physics/collision_bsp_definitions.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -60,4 +65,19 @@ symbols in this file:
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
long cluster_index_from_point(
|
||||
struct structure_bsp const *structure_bsp,
|
||||
real_point3d const *point)
|
||||
{
|
||||
long test_result= bsp3d_test_point(&TAG_BLOCK_GET_ELEMENT(&structure_bsp->collision_bsp, 0, struct collision_bsp)->bsp3d, 0, point);
|
||||
long result= NONE;
|
||||
|
||||
if (test_result!=NONE)
|
||||
{
|
||||
result= TAG_BLOCK_GET_ELEMENT(&structure_bsp->leaves, test_result&LONG_MAX, struct structure_leaf)->cluster_index;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -50,10 +50,20 @@ enum
|
||||
|
||||
/* ---------- prototypes/STRUCTURES.C */
|
||||
|
||||
short structure_clusters_in_sphere(short cluster_index, real_point3d const *position, real radius, short maximum_count, short *intersected_indices);
|
||||
|
||||
/* ---------- prototypes/STRUCTURE_DETAIL_OBJECTS.C */
|
||||
|
||||
void structure_detail_objects_flush(void);
|
||||
|
||||
/* ---------- prototypes/STRUCTURE_LENS_FLARES.C */
|
||||
|
||||
long cluster_index_from_point(struct structure_bsp const *structure_bsp, union real_point3d const *point);
|
||||
|
||||
/* ---------- prototypes/STRUCTURE_RUNTIME_DECALS.C */
|
||||
|
||||
void structure_decals_update(unsigned long *old_combined_pvs, unsigned long *new_combined_pvs, short cluster_count);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
@@ -17,7 +17,7 @@ long verify_tag_reference(
|
||||
long index;
|
||||
|
||||
match_assert("c:\\halo\\SOURCE\\tag_files\\tag_groups.c", 3055, reference);
|
||||
index = tag_loaded(reference->group_tag, reference->name);
|
||||
index= tag_loaded(reference->group_tag, reference->name);
|
||||
|
||||
match_vassert(
|
||||
"c:\\halo\\SOURCE\\tag_files\\tag_groups.c", 3061, reference->index==index,
|
||||
|
||||
@@ -8,6 +8,10 @@ header included in hcex build.
|
||||
#define __TAG_GROUPS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "memory/byte_swapping.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
@@ -17,6 +17,8 @@ enum
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define font_definition_get(index) ((struct font_header *)tag_get(FONT_GROUP_TAG, index))
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
struct font_header
|
||||
|
||||
@@ -28,6 +28,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "international_strings.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
@@ -38,6 +41,220 @@ symbols in this file:
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
static short global_language_code;
|
||||
|
||||
/* ---------- public code */
|
||||
|
||||
void set_language_code(short language_code)
|
||||
{
|
||||
if (language_code<0 || language_code>=NUMBER_OF_LANGUAGE_CODES)
|
||||
{
|
||||
language_code= 0;
|
||||
}
|
||||
global_language_code= language_code;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
word get_next_character(
|
||||
byte *string,
|
||||
short *index)
|
||||
{
|
||||
word result;
|
||||
|
||||
match_vassert(
|
||||
"c:\\halo\\SOURCE\\text\\international_strings.c",
|
||||
32,
|
||||
*index>=0 && *index<=strlen((char *)string),
|
||||
csprintf(temporary, "#%d is out of range in string @%p", *index, string));
|
||||
|
||||
string= &string[*index];
|
||||
|
||||
if (double_byte_character(string))
|
||||
{
|
||||
// Construct the wide character by byteswapping the two chars
|
||||
result= 0;
|
||||
result|= string[0]<<8;
|
||||
result|= string[1]<<0;
|
||||
|
||||
*index+= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
result= string[0];
|
||||
*index+= 1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
word get_previous_character(
|
||||
byte *string,
|
||||
short *index)
|
||||
{
|
||||
short i;
|
||||
word result;
|
||||
|
||||
match_vassert(
|
||||
"c:\\halo\\SOURCE\\text\\international_strings.c",
|
||||
55,
|
||||
VALID_INDEX(*index, (short)strlen((char *)string)),
|
||||
csprintf(temporary, "#%d is out of range in string @%p", *index, string));
|
||||
|
||||
i= 0;
|
||||
do
|
||||
{
|
||||
result= get_next_character(string, &i);
|
||||
}
|
||||
while (i<*index);
|
||||
|
||||
|
||||
match_vwarn(
|
||||
"c:\\halo\\SOURCE\\text\\international_strings.c",
|
||||
67,
|
||||
i==*index,
|
||||
csprintf(temporary, "index #%d is inbetween characters in string %p", *index, string));
|
||||
|
||||
*index= i;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void align_to_character(
|
||||
unsigned char *string,
|
||||
short *index)
|
||||
{
|
||||
short i;
|
||||
|
||||
match_vassert(
|
||||
"c:\\halo\\SOURCE\\text\\international_strings.c",
|
||||
85,
|
||||
*index>0 || *index <=(short)strlen((char *)string),
|
||||
csprintf(temporary, "#%d is out of range in string @%p", *index, string));
|
||||
|
||||
i= 0;
|
||||
while (i<*index)
|
||||
{
|
||||
get_next_character(string, &i);
|
||||
}
|
||||
*index= i;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
boolean double_byte_character(
|
||||
byte *string)
|
||||
{
|
||||
boolean result= FALSE;
|
||||
byte character= string[0];
|
||||
|
||||
if (character!='\0')
|
||||
{
|
||||
byte next_character= string[1];
|
||||
if (character==(byte)('|') &&
|
||||
next_character &&
|
||||
strchr("ibukprlctn", next_character)
|
||||
)
|
||||
{
|
||||
result= TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (global_language_code)
|
||||
{
|
||||
case _language_japanese:
|
||||
if ((character>=(byte)('\x81') && character<=(byte)('\x9F') ||
|
||||
character>=(byte)('\xE0') && character!=(byte)('\xFE')) &&
|
||||
next_character>=(byte)('@') &&
|
||||
next_character<=(byte)('\xFC') &&
|
||||
next_character!=(byte)('\x7F')
|
||||
)
|
||||
{
|
||||
result= TRUE;
|
||||
}
|
||||
break;
|
||||
case _language_simple_chinese:
|
||||
if (character>=(byte)('\xA1') &&
|
||||
character!=(byte)('\xFE') &&
|
||||
next_character>=(byte)('\xA1') &&
|
||||
next_character!=(byte)('\xFE')
|
||||
)
|
||||
{
|
||||
result= TRUE;
|
||||
}
|
||||
break;
|
||||
case _language_traditional_chinese:
|
||||
if (character>=(byte)('\x81') &&
|
||||
character!=(byte)('\xFE') &&
|
||||
(next_character>=(byte)('@') && next_character<=(byte)('~') ||
|
||||
next_character>=(byte)('\xA1') && next_character!=(byte)('\xFE'))
|
||||
)
|
||||
{
|
||||
result= TRUE;
|
||||
}
|
||||
break;
|
||||
case _language_korean_wansung:
|
||||
if (character>=(byte)('\x81') &&
|
||||
character!=(byte)('\xFE') &&
|
||||
(
|
||||
next_character>=(byte)('A') && next_character<=(byte)('Z') ||
|
||||
next_character>=(byte)('a') && next_character<=(byte)('z') ||
|
||||
next_character>=(byte)('\x81') && next_character!=(byte)('\xFE')
|
||||
)
|
||||
)
|
||||
{
|
||||
result= TRUE;
|
||||
}
|
||||
break;
|
||||
case _language_korean_johab:
|
||||
if ((character>=(byte)('\x84') && character<=(byte)('\xD3') ||
|
||||
character>=(byte)('\xD8') && character<=(byte)('\xDE') ||
|
||||
character>=(byte)('\xE0') && character<=(byte)('\xF9')
|
||||
) &&
|
||||
(
|
||||
next_character>=(byte)('A') && next_character<=(byte)('~') ||
|
||||
next_character>=(byte)('\x81') && next_character!=(byte)('\xFE')
|
||||
)
|
||||
)
|
||||
{
|
||||
result= TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
boolean character_in_pattern(
|
||||
word character,
|
||||
char *pattern)
|
||||
{
|
||||
boolean result= FALSE;
|
||||
boolean found= FALSE;
|
||||
short index= 0;
|
||||
|
||||
while (!found)
|
||||
{
|
||||
word next_character= get_next_character((unsigned char *)pattern, &index);
|
||||
if (next_character)
|
||||
{
|
||||
if (next_character==character)
|
||||
{
|
||||
found= TRUE;
|
||||
result= TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
found= TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ---------- private code */
|
||||
@@ -41,11 +41,11 @@ enum
|
||||
/* ---------- prototypes/INTERNATIONAL_STRINGS.C */
|
||||
|
||||
void set_language_code(short language_code);
|
||||
unsigned short get_next_character(unsigned char *string, short *index);
|
||||
unsigned short get_previous_character(unsigned char *string, short *index);
|
||||
word get_next_character(byte *string, short *index);
|
||||
word get_previous_character(byte *string, short *index);
|
||||
void align_to_character(unsigned char *string, short *index);
|
||||
boolean double_byte_character(unsigned char *string);
|
||||
boolean character_in_pattern(unsigned short character, char *pattern);
|
||||
boolean double_byte_character(byte *string);
|
||||
boolean character_in_pattern(word character, char *pattern);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
@@ -643,6 +643,9 @@ symbols in this file:
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "cseries.h"
|
||||
#include "units.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
+191
-1
@@ -8,13 +8,203 @@ header included in hcex build.
|
||||
#define __UNITS_H
|
||||
#pragma once
|
||||
|
||||
/* ---------- headers */
|
||||
|
||||
#include "ai/ai.h"
|
||||
#include "objects/objects.h"
|
||||
|
||||
/* ---------- constants */
|
||||
|
||||
enum
|
||||
{
|
||||
MAXIMUM_WEAPONS_PER_UNIT= 4,
|
||||
NUMBER_OF_UNIT_USER_ANIMATIONS= 2,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MAXIMUM_ATTACKERS_PER_UNIT= 4,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
_unit_grenade_human_fragmentation= 0,
|
||||
_unit_grenade_covenant_plasma,
|
||||
NUMBER_OF_UNIT_GRENADE_TYPES
|
||||
};
|
||||
|
||||
/* ---------- macros */
|
||||
|
||||
#define unit_get(index) ((struct unit_datum*)object_get_and_verify_type(index, _object_mask_unit))
|
||||
#define unit_try_and_get(index) ((struct unit_datum*)object_try_and_get_and_verify_type(index, _object_mask_unit))
|
||||
|
||||
/* ---------- structures */
|
||||
|
||||
/* ---------- prototypes/EXAMPLE.C */
|
||||
struct unit_animation
|
||||
{
|
||||
word flags;
|
||||
short aiming_screen_index;
|
||||
short looking_screen_index;
|
||||
short last_ping_animation_index;
|
||||
char seat_index;
|
||||
char weapon_index;
|
||||
char weapon_type_index;
|
||||
char state;
|
||||
char action;
|
||||
char overlay_action;
|
||||
char desired_state;
|
||||
char base_seat_index;
|
||||
char emotion_index;
|
||||
struct animation_state action_animation;
|
||||
struct animation_state overlay_action_animation;
|
||||
struct animation_state soft_ping_animation;
|
||||
boolean aiming_with_euler_screen;
|
||||
boolean looking_with_euler_screen;
|
||||
real_rectangle2d aiming_screen_bounds;
|
||||
real_rectangle2d looking_screen_bounds;
|
||||
long external_animation_graph_index;
|
||||
struct animation_state external_animation;
|
||||
};
|
||||
|
||||
struct unit_speech_item
|
||||
{
|
||||
short priority;
|
||||
short vocalization_type;
|
||||
long sound_definition_index;
|
||||
short delay_time;
|
||||
short ai_notification_delay;
|
||||
short pause_time;
|
||||
unsigned short pad;
|
||||
struct ai_information_packet ai;
|
||||
};
|
||||
|
||||
struct unit_speech
|
||||
{
|
||||
struct unit_speech_item current;
|
||||
struct unit_speech_item queued;
|
||||
short damage_minor_decay_timer;
|
||||
short damage_minor_sounds;
|
||||
short damage_minor_timer;
|
||||
short damage_major_timer;
|
||||
long last_speech_finished_time;
|
||||
boolean played;
|
||||
boolean notified_ai;
|
||||
boolean finished;
|
||||
boolean pad;
|
||||
short pre_delay_timer;
|
||||
short sound_timer;
|
||||
short ai_delay_timer;
|
||||
short post_delay_timer;
|
||||
long impulse_sound_index;
|
||||
};
|
||||
|
||||
struct unit_attacker
|
||||
{
|
||||
unsigned long game_time_stamp;
|
||||
real damage_inflicted;
|
||||
long object_index;
|
||||
long player_index;
|
||||
};
|
||||
|
||||
struct _unit_datum
|
||||
{
|
||||
long actor_index;
|
||||
long swarm_actor_index;
|
||||
long swarm_next_unit_index;
|
||||
long swarm_prev_unit_index;
|
||||
unsigned long flags;
|
||||
unsigned long control_flags;
|
||||
short timer;
|
||||
char shield_sap_timeout;
|
||||
char magic_seat_index;
|
||||
long persistent_control_timer;
|
||||
unsigned long persistent_control_flags;
|
||||
long player_index;
|
||||
short last_unit_effect_type;
|
||||
short override_emotion_animation_index;
|
||||
long game_time_at_last_unit_effect;
|
||||
real_vector3d desired_facing_vector;
|
||||
real_vector3d desired_aiming_vector;
|
||||
real_vector3d aiming_vector;
|
||||
real_vector3d aiming_velocity;
|
||||
real_vector3d desired_looking_vector;
|
||||
real_vector3d looking_vector;
|
||||
real_vector3d looking_velocity;
|
||||
real_vector3d throttle;
|
||||
real primary_trigger;
|
||||
char aiming_speed;
|
||||
char melee_attack_state;
|
||||
char melee_continuous_damage_effect_timer;
|
||||
byte flaming_death_delay;
|
||||
char weapon_drop_delay_ticks;
|
||||
char grenade_throw_state;
|
||||
short grenade_throw_ticks;
|
||||
short grenade_throw_full_power_ticks;
|
||||
long grenade_object_index;
|
||||
struct unit_animation animation;
|
||||
real ambient_illumination;
|
||||
real self_illumination;
|
||||
real mouth_aperture;
|
||||
long last_entrance_attempt;
|
||||
short parent_seat_index;
|
||||
short current_weapon_index;
|
||||
short desired_weapon_index;
|
||||
long weapon_object_indices[MAXIMUM_WEAPONS_PER_UNIT];
|
||||
long weapon_last_used_at_game_time[MAXIMUM_WEAPONS_PER_UNIT];
|
||||
long equipment_object_index;
|
||||
char current_grenade_index;
|
||||
char desired_grenade_index;
|
||||
char grenade_counts[NUMBER_OF_UNIT_GRENADE_TYPES];
|
||||
char current_zoom_level;
|
||||
char desired_zoom_level;
|
||||
char gunner_inactive_ticks;
|
||||
byte aiming_change;
|
||||
long driver_object_index;
|
||||
long gunner_object_index;
|
||||
long last_vehicle_index;
|
||||
long game_time_at_last_vehicle_exit;
|
||||
short fake_encounter_index;
|
||||
short fake_squad_index;
|
||||
real seat_power[2];
|
||||
real integrated_light_power;
|
||||
real integrated_light_battery;
|
||||
real integrated_night_vision_power;
|
||||
real_point3d seat_last_position;
|
||||
real_vector3d seat_last_velocity;
|
||||
real_vector3d seat_acceleration;
|
||||
real_vector3d seat_desired_acceleration;
|
||||
real active_camouflage;
|
||||
real active_camouflage_super_amount;
|
||||
long dialogue_index;
|
||||
struct unit_speech speech;
|
||||
short last_damage_category;
|
||||
short delayed_damage_timer;
|
||||
real delayed_damage_peak;
|
||||
long delayed_damage_attacker_object_index;
|
||||
long flaming_death_attacker_object_index;
|
||||
real run_blindly_angle;
|
||||
real run_blindly_angle_delta;
|
||||
long time_of_death;
|
||||
short feign_death_timer;
|
||||
short cause_for_camo_regrowth;
|
||||
real body_stun;
|
||||
short body_stun_ticks;
|
||||
short killing_spree_count;
|
||||
long killing_spree_last_time;
|
||||
struct unit_attacker attackers[MAXIMUM_ATTACKERS_PER_UNIT];
|
||||
short user_animation_indices[NUMBER_OF_UNIT_USER_ANIMATIONS];
|
||||
};
|
||||
|
||||
struct unit_datum
|
||||
{
|
||||
long definition_index;
|
||||
struct _object_datum object;
|
||||
struct _unit_datum unit;
|
||||
};
|
||||
|
||||
/* ---------- prototypes/UNITS.C */
|
||||
|
||||
void unit_get_head_position(long unit_index, union real_point3d *head_position);
|
||||
|
||||
/* ---------- globals */
|
||||
|
||||
|
||||
Reference in new issue
Block a user