diff --git a/config/config.json b/config/config.json index 2f655516..f7b12f97 100644 --- a/config/config.json +++ b/config/config.json @@ -495,7 +495,7 @@ { "name": "source/rasterizer/xbox/rasterizer_xbox_environment_fog.c", "index": 120, "status": "NonMatching" }, { "name": "source/rasterizer/xbox/rasterizer_xbox_environment.c", "index": 121, "status": "NonMatching" }, { "name": "source/rasterizer/xbox/rasterizer_xbox_dynavobgeom.c", "index": 122, "status": "Matching" }, - { "name": "source/rasterizer/xbox/rasterizer_xbox_draw_primitives.c", "index": 123, "status": "NonMatching" }, + { "name": "source/rasterizer/xbox/rasterizer_xbox_draw_primitives.c", "index": 123, "status": "Matching" }, { "name": "source/rasterizer/xbox/rasterizer_xbox_detail_objects.c", "index": 124, "status": "Matching" }, { "name": "source/rasterizer/xbox/rasterizer_xbox_decals.c", "index": 125, "status": "Matching" }, { "name": "source/rasterizer/xbox/rasterizer_xbox_debug.c", "index": 126, "status": "Matching" }, @@ -537,7 +537,7 @@ { "name": "source/objects/widgets/light_volume_definitions.c", "index": 162, "status": "Matching" }, { "name": "source/objects/widgets/glow_definitions.c", "index": 163, "status": "Matching" }, { "name": "source/objects/widgets/glow.c", "index": 164, "status": "NonMatching" }, - { "name": "source/objects/widgets/flags.c", "index": 165, "status": "NonMatching" }, + { "name": "source/objects/widgets/flags.c", "index": 165, "status": "Matching" }, { "name": "source/objects/widgets/flag_definitions.c", "index": 166, "status": "Matching" }, { "name": "source/objects/widgets/cellular_automata2d.c", "index": 167, "status": "Matching" }, { "name": "source/objects/widgets/cellular_automata.c", "index": 168, "status": "Matching" }, @@ -727,7 +727,7 @@ { "name": "source/cseries/stack_walk_windows.c", "index": 352, "status": "Matching" }, { "name": "source/cseries/sort.c", "index": 353, "status": "Matching" }, { "name": "source/cseries/progress.c", "index": 354, "status": "Matching" }, - { "name": "source/cseries/profile.c", "index": 355, "status": "NonMatching" }, + { "name": "source/cseries/profile.c", "index": 355, "status": "Matching" }, { "name": "source/cseries/errors.c", "index": 356, "status": "Matching" }, { "name": "source/cseries/debug_memory.c", "index": 357, "status": "Matching" }, { "name": "source/cseries/cseries_windows.c", "index": 358, "status": "Matching" }, @@ -764,7 +764,7 @@ { "name": "source/bitmaps/bitmap_utilities.c", "index": 389, "status": "NonMatching" }, { "name": "source/bitmaps/bitmap_group.c", "index": 390, "status": "NonMatching" }, { "name": "source/bitmaps/bitmap_extract.c", "index": 391, "status": "Matching" }, - { "name": "source/bitmaps/bitmap_drawing.c", "index": 392, "status": "Matching" }, + { "name": "source/bitmaps/bitmap_drawing.c", "index": 392, "status": "NonMatching" }, { "name": "source/bitmaps/bitmap_compress.c", "index": 393, "status": "Matching" }, { "name": "source/bitmaps/s3tc/s3tc.c", "index": 394, "status": "NonMatching" }, { "name": "source/bitmaps/libtiff/tif_write.c", "index": 395, "status": "Matching" }, diff --git a/config/parked.json b/config/parked.json index 579dc89b..992c755b 100644 --- a/config/parked.json +++ b/config/parked.json @@ -202,25 +202,6 @@ "objdiff_percent": 78.47794 } }, - { - "unit": "source/cseries/profile", - "function": "_compare_profile_sections", - "class": "unclassified", - "evidence": "Natural private qsort callback reconstructed as the sole real profile_dump dependency. It orders active sections first, then implements target-backed name ascending, average elapsed time descending with zero-sample handling, and signed64 rolling-total descending modes using correct public enums and semantic fields. The invalid-mode path preserves the January !\"unreachable\" assertion but returns a defined zero result if fatal system_exit unexpectedly returns. The older Opus donor's exact288B body used an uninitialized return whose accidental value reproduced January after the fatal call; that fake/undefined source is explicitly rejected. Candidate304B/8 relocs versus target288B/8. No return-recipe/register/control-flow search was performed after the defined natural pass. Private linkage is a source-ownership inference supported by the sole incoming relocation from profile_dump, not recovered PDB linkage proof; all35 inherited strict owners remain exact and no forbidden helper is emitted. Reopen only for authentic original-source/type/compiler-context evidence. See docs/object_matching_logs/profile_obj_dump_comparator_natural_boundary_20260905.md.", - "measurements": { - "target": { - "size": 288, - "relocation_count": 8, - "normalized_sha256": "d94ba79bf813177b3186d21957777d58068c95b63f28ea1131ff8ff68ee039a1" - }, - "base": { - "size": 304, - "relocation_count": 8, - "normalized_sha256": "aebbef78d074d93227bcb077dadf533651dc5c60c2d7b75b63f127a7cbd93072" - }, - "objdiff_percent": 21.59292 - } - }, { "unit": "source/bungie_net/network/transport_endpoint_set_winsock", "function": "_poll_ep_array_compare_proc", @@ -543,7 +524,7 @@ "unit": "source/interface/virtual_keyboard", "function": "_virtual_keyboard_select", "class": "unclassified", - "evidence": "Fuzzy-parked under the current house rule after reconstructing the complete virtual-key selection dispatcher in ordinary typed C from January disassembly and the independent HaloCEA implementation. The retained body handles done/save validation, shift/caps/symbol modes, backspace, cursor motion, space insertion, configurable character insertion, the .fortune easter egg, feedback sounds, and one-shot shift reset through semantic enums and owner-header prototypes. January and the candidate are both 1,088 padded bytes with 123 relocations, and objdiff reports 93.7518 percent similarity. The fail-closed blocker classifier returns UNKNOWN: the remaining differences are distributed source-order, branch-layout, and register-scheduling choices rather than missing behavior, and prior natural HaloCEA adaptation had a worse 1,120-byte envelope. No forced inline/noinline, barrier, volatile/register forcing, pragma, assembly, raw address, invented dependency, fake branch, or nonsensical matching construct is retained. Reopen only for authenticated January source/local records or a natural compatible-compiler donor that explains the residual schedule.", + "evidence": "Fuzzy-parked under the current house rule after reconstructing the complete virtual-key selection dispatcher in ordinary typed C from January disassembly and the independent HaloCEA implementation. The retained body handles done/save validation, shift/caps/symbol modes, backspace, cursor motion, space insertion, configurable character insertion, the .fortune easter egg, feedback sounds, and one-shot shift reset through semantic enums and owner-header prototypes. January and the candidate are both 1,088 padded bytes with 123 relocations, and objdiff reports 93.7518 percent similarity. The fail-closed blocker classifier returns UNKNOWN: the remaining differences are distributed source-order, branch-layout, and register-scheduling choices rather than missing behavior, and prior natural HaloCEA adaptation had a worse 1,120-byte envelope. No forced inline/noinline, barrier, volatile/register forcing, pragma, assembly, raw address, invented dependency, fake branch, or nonsensical matching construct is retained. Reopen only for authenticated January source/local records or a natural compatible-compiler donor that explains the residual schedule. 2026-09-27 B3 declaration-batch rebaseline (owner-approved batch B3, RF-CB F11): virtual_keyboard_free_space_in_text_buffer becomes static and this body's character-insert path calls it instead of the hand-written free-space copy (the /Od build calls it at that site; VC7 inlines this call and keeps the space site's out-of-line call, January's per-site pattern); the body moves 025bd53f -> ff65b27b at the same 1,088 padded bytes and 123 relocations, objdiff 3.3.1 93.7518 -> 93.805756 (measured at landing HEAD 9736deed + B3). No new exact credit; reopen criterion unchanged.", "measurements": { "target": { "size": 1088, @@ -553,9 +534,9 @@ "base": { "size": 1088, "relocation_count": 123, - "normalized_sha256": "025bd53f5f2169bb649702adf79e4603dd2a13ac0b5967aca9297e7e983565d9" + "normalized_sha256": "ff65b27bb63875dcc188e0f77880d6449e4396208d51722e58ecb8db2f0fb960" }, - "objdiff_percent": 93.7518 + "objdiff_percent": 93.805756 } }, { @@ -653,25 +634,6 @@ "objdiff_percent": 95.816666 } }, - { - "unit": "source/effects/effects", - "function": "_effect_allowed_by_environment", - "class": "unclassified", - "evidence": "The retained ordinary-C environment switch implements the complete January air, water, vacuum, and anywhere behavior with named enum constants and typed location/point arguments, and the later HCEA reconstruction independently corroborates those four arms. January's invalid-enum arm calls the fatal assertion path and then reloads an uninitialized result byte if system_exit unexpectedly returns. The Opus donor reproduced that indeterminate fallthrough and was exact, but it is rejected under the no-undefined-behavior rule. The closest safe natural source initializes the result from the meaningful anywhere predicate before overriding the air/water arms; invalid and vacuum values therefore remain FALSE. It compiles to 112 padded bytes and ten relocations versus January's 128, with 55.909092 percent objdiff, while preserving the donor's better 1,616-byte and 592-byte shapes in both real callers. Simple FALSE initialization and assignment-after-assert forms also produced 112 bytes but caused both callers to inline the assertion body and regress broadly. The fail-closed classifier returns UNKNOWN. No uninitialized read, false noreturn declaration, volatile/register forcing, barrier, pragma, assembly, fake dependency, or nonsensical branch is retained. Reopen only for authoritative January source proving a safe result lifetime or a truthful shared noreturn contract that naturally reproduces the target. 2026-09-15 (250K lane wave w3d): re-measured after the coupled A8 callee re-baseline. The body is strictly closer - padded size is now January-exact (was 112), 10 relocations with every external target identical, and four distinct jump-table case entries instead of three. Zero strict credit; the row stays parked and fuzzy [sha], and its strict-exact reopen criterion is unchanged and NOT met.", - "measurements": { - "target": { - "size": 128, - "relocation_count": 10, - "normalized_sha256": "a005be4ac405246678b6c4e9a4bf65deb16b96b5208fad9454b45df70e8fa7cd" - }, - "base": { - "size": 128, - "relocation_count": 10, - "normalized_sha256": "8f9a2185534b3801351e0f354e1fa4e5e3e39f7250559d1020cf2388df9248cf" - }, - "objdiff_percent": 63.909092 - } - }, { "unit": "source/effects/effects", "function": "_effect_generate_part", @@ -968,7 +930,7 @@ "unit": "source/ai/ai", "function": "_ai_test_ballistic_line_of_fire", "class": "instruction-scheduling", - "evidence": "Complete typed ballistic trajectory, world-collision, friendly-pill, and debug-recording reconstruction from January code/relocations and HCEA semantics. Target and candidate are both 944 padded bytes with all 49 relocations. Remaining differences are compiler-local x87 and independent instruction scheduling. No fake dependency, raw offset, forced inline, or nonsensical logic is retained. Zero exact credit. See docs/object_matching_logs/ai_obj_large_visibility_spatial_packet_20260909.md. 2026-09-20 Lane A re-baseline (zero exact credit): the recorded 250K-lane w3c 'b5' shape is rebuilt from this baseline and landed. Three changes: block-scope segment_time to the coordinate statement; parenthesise the linear term of the z row as (segment_time * arc_velocity.k + point.z); spell the post-call velocity update as (segment_end_time - segment_start_time) * gravity + arc_velocity.k. Instruction counts become 296/296 (HEAD was 292/296) and objdiff rises 94.50 to 98.99645. It reproduces January's x87 structure for segment_time exactly: fsubr of the parameter home at +0x1e7, fst (store-and-keep) to a dead parameter home at +0x1f4, and a post-call fld from that same home at +0x2cc feeding fmul gravity / fadd / fstp. Surviving hunks: an ebx/edi reload transposition at +0x159, a collision_flags/segment_time parameter-home swap, one 3-versus-2 x87 hunk at +0x21a and a consequent 3-byte alignment pad. Reopen only with a spelling that materialises the second x87 copy the way January does; do not replay operand or declaration sweeps. 2026-09-22 integration rebaseline: shared declaration context changed the normalized code hash while preserving the 944-byte envelope and all 49 relocations; similarity improves to 99.05674, with zero exact-row regressions. No new exact credit is claimed. 2026-09-24 R3 bipeds storage rebaseline: removing the four January file-static prototypes (biped_falling_danger, biped_update_airborne, biped_snap_facing, biped_update_moving) from units/bipeds.h changes only this TU's declaration context; the body returns to the Lane A wave A2 hash 5c03c751 (944 bytes, 49 relocations, objdiff 3.3.1 98.99645: the collision_flags/segment_time parameter-home swap reappears). Zero exact-row change in all 23 bipeds.h includers. 2026-09-27 type-ownership rebaseline (owner-approved RF-BE packet K: the hudg, itmc and netgame tag layouts consolidated into hud_definitions.h, item_definitions.h and scenario_definitions.h, hud_globals declared once in hud.h): ai.c is unchanged and sees only scenario_definitions.h, whose three added netgame block types shift this TU's C1 numbering by +23; the body returns to the 2026-09-22 integration hash ea5eb3a4 (944 bytes, 49 relocations, objdiff 3.3.1 99.05674, recorded at 4f4c8502), superseding the 2026-09-24 hash 5c03c751 / 98.99645. Zero exact-row change in the 467-unit sweeps at 04d57ab5 and 399a556b. No new exact credit; reopen criterion unchanged. 2026-09-27 interface owner-header rebaseline (RF-BR minimal packet MP, held for an owner ruling): the game_globals_interface_tag_references element type is declared once in game_globals.h, which includes interface.h for NUMBER_OF_INTERFACE_TAGS; ai.c is unchanged and sees it through game_globals.h (C1 +104); the body returns to hash 5c03c751 (944 bytes, 49 relocations, objdiff 3.3.1 98.99645, remeasured at 6470611a), superseding ea5eb3a4 / 99.05674. No new exact credit; reopen criterion unchanged.", + "evidence": "Complete typed ballistic trajectory, world-collision, friendly-pill, and debug-recording reconstruction from January code/relocations and HCEA semantics. Target and candidate are both 944 padded bytes with all 49 relocations. Remaining differences are compiler-local x87 and independent instruction scheduling. No fake dependency, raw offset, forced inline, or nonsensical logic is retained. Zero exact credit. See docs/object_matching_logs/ai_obj_large_visibility_spatial_packet_20260909.md. 2026-09-20 Lane A re-baseline (zero exact credit): the recorded 250K-lane w3c 'b5' shape is rebuilt from this baseline and landed. Three changes: block-scope segment_time to the coordinate statement; parenthesise the linear term of the z row as (segment_time * arc_velocity.k + point.z); spell the post-call velocity update as (segment_end_time - segment_start_time) * gravity + arc_velocity.k. Instruction counts become 296/296 (HEAD was 292/296) and objdiff rises 94.50 to 98.99645. It reproduces January's x87 structure for segment_time exactly: fsubr of the parameter home at +0x1e7, fst (store-and-keep) to a dead parameter home at +0x1f4, and a post-call fld from that same home at +0x2cc feeding fmul gravity / fadd / fstp. Surviving hunks: an ebx/edi reload transposition at +0x159, a collision_flags/segment_time parameter-home swap, one 3-versus-2 x87 hunk at +0x21a and a consequent 3-byte alignment pad. Reopen only with a spelling that materialises the second x87 copy the way January does; do not replay operand or declaration sweeps. 2026-09-22 integration rebaseline: shared declaration context changed the normalized code hash while preserving the 944-byte envelope and all 49 relocations; similarity improves to 99.05674, with zero exact-row regressions. No new exact credit is claimed. 2026-09-24 R3 bipeds storage rebaseline: removing the four January file-static prototypes (biped_falling_danger, biped_update_airborne, biped_snap_facing, biped_update_moving) from units/bipeds.h changes only this TU's declaration context; the body returns to the Lane A wave A2 hash 5c03c751 (944 bytes, 49 relocations, objdiff 3.3.1 98.99645: the collision_flags/segment_time parameter-home swap reappears). Zero exact-row change in all 23 bipeds.h includers. 2026-09-27 type-ownership rebaseline (owner-approved RF-BE packet K: the hudg, itmc and netgame tag layouts consolidated into hud_definitions.h, item_definitions.h and scenario_definitions.h, hud_globals declared once in hud.h): ai.c is unchanged and sees only scenario_definitions.h, whose three added netgame block types shift this TU's C1 numbering by +23; the body returns to the 2026-09-22 integration hash ea5eb3a4 (944 bytes, 49 relocations, objdiff 3.3.1 99.05674, recorded at 4f4c8502), superseding the 2026-09-24 hash 5c03c751 / 98.99645. Zero exact-row change in the 467-unit sweeps at 04d57ab5 and 399a556b. No new exact credit; reopen criterion unchanged. 2026-09-27 interface owner-header rebaseline (RF-BR minimal packet MP, held for an owner ruling): the game_globals_interface_tag_references element type is declared once in game_globals.h, which includes interface.h for NUMBER_OF_INTERFACE_TAGS; ai.c is unchanged and sees it through game_globals.h (C1 +104); the body returns to hash 5c03c751 (944 bytes, 49 relocations, objdiff 3.3.1 98.99645, remeasured at 6470611a), superseding ea5eb3a4 / 99.05674. No new exact credit; reopen criterion unchanged. 2026-09-27 B3 declaration-batch rebaseline (owner-approved batch B3): the body is unchanged; the batch adds main/console.h to ai.c (P04a: console_printf was implicit) and changes declarations in its include closure (actions.h, actors.h, ai_debug.h, ai_script.h, props.h, profile.h, game_allegiance.h, players.h, units.h), shifting this TU's C1 numbering; the body returns to the hash ea5eb3a4 (944 bytes, 49 relocations, objdiff 3.3.1 99.05674) recorded 2026-09-22 and 2026-09-27, superseding 5c03c751 / 98.99645 (measured at landing HEAD 9736deed + B3). No new exact credit; reopen criterion unchanged. 2026-09-28 rebaseline (zero credit; K1-K16 + S ownership packet, owner-approved): the evidence-selected declaration batch shifts this TU's compiler numbering; base ea5eb3a4/99.05674 -> 5c03c751/98.99645. The function stays residual; its source is unchanged.", "measurements": { "target": { "size": 944, "relocation_count": 49, "normalized_sha256": "6c90076033e91f26356e42166cf4bb0a8d5a902ae35bc67db15aec19ee9982ac" }, "base": { "size": 944, "relocation_count": 49, "normalized_sha256": "5c03c751c19c33cde8c6645c5fd39d505e2bca6bf161beb6e6126101f3fbcaa8" }, @@ -1001,11 +963,11 @@ "unit": "source/rasterizer/xbox/rasterizer_xbox_models", "function": "__rasterizer_model_draw", "class": "tu-context-optimization", - "evidence": "Best complete typed model draw reconstruction retained from the Opus rasterizer lane after house-rule reconciliation. January and the candidate are both 5,168 padded bytes; January has 350 relocations and the candidate has 348 at 95.32371 percent similarity. The established REAL_MATH_EXTERNAL_POINT_FROM_LINE3D include schedule remains in force and this TU emits no point_from_line3d COMDAT. The shader-plasma access now uses its authentic enclosing definition instead of a raw byte offset, texture-animation outputs use true real_vector4d storage, self-illumination colors are interpolated component by component without incompatible point/vector/color casts, and the atmosphere-dominant test uses the named flag. These defined semantic choices account for part of the measured residual and are retained rather than restoring the closer prohibited representation-cast form. The correctly owned environment-fog backend declaration changes only compiler scheduling in this already-fuzzy owner and adds no exact credit. Semantic model-effect enums and render_lighting fields replace misleading donor placeholders. No forced inline, fake dependency, raw offset, representation pun, undefined behavior, or nonsensical branch is retained. Zero exact credit. See docs/object_matching_logs/rasterizer_xbox_models_obj_opus_reconciliation_20260909.md. On September 14 (lane opus/150k-house-clean-20260914, header packet P6) the real_math.h real_local_random_range named-result correction changed only this unchanged, already-fuzzy body's allocation hash at identical size and relocations (5168/348, sha 112b4321...), the same alternate hash measured under the P7, P8 and P9 real_math.h evaluations (header-inline definition effect). No source change. Re-measured 2026-09-19 after restoring real_rgb_color_to_pixel32 to its authentic bitmaps inline/header ownership: the unchanged zero-credit body returns to the previously documented 5,168/348 hash and 95.32371 percent state, with no inherited exact-function regression. 2026-09-26 (compiler-application lane, worker A2, render_debug owner-prototype packet): adding the genuine render_debug_fog_planes prototype to structures/structures.h, which this TU includes directly, shifts its declaration context by one C1 number; the retained body moves 89b0d7ea -> cbfa8585 at the same 5,168 padded bytes and 348 relocations, objdiff 3.3.1 95.08453 -> 95.07629. Zero exact-row change in the 447-unit shadow sweep; zero exact credit, reopen criterion unchanged. 2026-09-27 render_skinning rebaseline (owner-approved packet P-b2: one struct render_skinning in render/render.h, the HCEX and PC-demo type, replaces the nine lane copies of the skinning struct, this TU's local rasterizer_model_skinning_parameters among them): the body is unchanged; the removed local copy and the new render.h type shift this TU's C1 numbering by -2 at this function, and the body returns to the hash 89b0d7ea (5,168 padded bytes, 348 relocations, objdiff 3.3.1 95.08453) that this entry recorded before the 2026-09-26 render_debug packet, superseding cbfa8585 / 95.07629. Zero exact-row change in the 467-unit sweep at 36e80830; zero exact credit, reopen criterion unchanged.", + "evidence": "Best complete typed model draw reconstruction retained from the Opus rasterizer lane after house-rule reconciliation. January and the candidate are both 5,168 padded bytes; January has 350 relocations and the candidate has 348 at 95.32371 percent similarity. The established REAL_MATH_EXTERNAL_POINT_FROM_LINE3D include schedule remains in force and this TU emits no point_from_line3d COMDAT. The shader-plasma access now uses its authentic enclosing definition instead of a raw byte offset, texture-animation outputs use true real_vector4d storage, self-illumination colors are interpolated component by component without incompatible point/vector/color casts, and the atmosphere-dominant test uses the named flag. These defined semantic choices account for part of the measured residual and are retained rather than restoring the closer prohibited representation-cast form. The correctly owned environment-fog backend declaration changes only compiler scheduling in this already-fuzzy owner and adds no exact credit. Semantic model-effect enums and render_lighting fields replace misleading donor placeholders. No forced inline, fake dependency, raw offset, representation pun, undefined behavior, or nonsensical branch is retained. Zero exact credit. See docs/object_matching_logs/rasterizer_xbox_models_obj_opus_reconciliation_20260909.md. On September 14 (lane opus/150k-house-clean-20260914, header packet P6) the real_math.h real_local_random_range named-result correction changed only this unchanged, already-fuzzy body's allocation hash at identical size and relocations (5168/348, sha 112b4321...), the same alternate hash measured under the P7, P8 and P9 real_math.h evaluations (header-inline definition effect). No source change. Re-measured 2026-09-19 after restoring real_rgb_color_to_pixel32 to its authentic bitmaps inline/header ownership: the unchanged zero-credit body returns to the previously documented 5,168/348 hash and 95.32371 percent state, with no inherited exact-function regression. 2026-09-26 (compiler-application lane, worker A2, render_debug owner-prototype packet): adding the genuine render_debug_fog_planes prototype to structures/structures.h, which this TU includes directly, shifts its declaration context by one C1 number; the retained body moves 89b0d7ea -> cbfa8585 at the same 5,168 padded bytes and 348 relocations, objdiff 3.3.1 95.08453 -> 95.07629. Zero exact-row change in the 447-unit shadow sweep; zero exact credit, reopen criterion unchanged. 2026-09-27 render_skinning rebaseline (owner-approved packet P-b2: one struct render_skinning in render/render.h, the HCEX and PC-demo type, replaces the nine lane copies of the skinning struct, this TU's local rasterizer_model_skinning_parameters among them): the body is unchanged; the removed local copy and the new render.h type shift this TU's C1 numbering by -2 at this function, and the body returns to the hash 89b0d7ea (5,168 padded bytes, 348 relocations, objdiff 3.3.1 95.08453) that this entry recorded before the 2026-09-26 render_debug packet, superseding cbfa8585 / 95.07629. Zero exact-row change in the 467-unit sweep at 36e80830; zero exact credit, reopen criterion unchanged. 2026-09-27 B3 declaration-batch rebaseline (owner-approved batch B3): the batch removes this TU's local copies of rasterizer_debug_options, the frame-statistics view and pixel_shader_definition in favour of their owner headers (P_XMO, RF-CF rasterizer_console_vars.h, CE-F2 / RT5 rasterizer.h, rasterizer_xbox_pixel_shader.h), so this body's statistics and debug-option references use the owner member names at the same offsets and widths, and rasterizer.h, rasterizer_models.h, rasterizer_transparent_geometry.h and structures.h change; the TU's C1 numbering shifts and the body moves 89b0d7ea -> 3bf3e583 at the same 5,168 padded bytes and 348 relocations, objdiff 3.3.1 95.08453 -> 95.24948 (measured at landing HEAD 9736deed + B3). No new exact credit; reopen criterion unchanged. 2026-09-28 rebaseline (zero credit; K1-K16 + S ownership packet, owner-approved): the evidence-selected declaration batch shifts this TU's compiler numbering; base 3bf3e583/95.24948 -> 8af3fbbf/95.241234. The function stays residual; its source is unchanged.", "measurements": { "target": { "size": 5168, "relocation_count": 350, "normalized_sha256": "99d8b95f1ce011781cedc3a123887065a0f8af4a54c842194fcd90c22fa2cc4e" }, - "base": { "size": 5168, "relocation_count": 348, "normalized_sha256": "89b0d7ea77a71d69d21eda1926e973006f54ed531bf346aaa87a18718e225c01" }, - "objdiff_percent": 95.08453 + "base": { "size": 5168, "relocation_count": 348, "normalized_sha256": "8af3fbbf93eff5296cb9be8e147423d85f7f1c693f40ed12068de429e333f9cc" }, + "objdiff_percent": 95.241234 } }, { diff --git a/config/semantic_data_matches.json b/config/semantic_data_matches.json index f0a9e519..38005f03 100644 --- a/config/semantic_data_matches.json +++ b/config/semantic_data_matches.json @@ -52,7 +52,7 @@ }, { "symbol": "_rdata_002a0a88", - "base_symbol": "$T18502", + "base_symbol": "$T18685", "source_function": "_main", "measurements": { "target": { diff --git a/config/semantic_matches.json b/config/semantic_matches.json index 5d323402..855bbc37 100644 --- a/config/semantic_matches.json +++ b/config/semantic_matches.json @@ -569,11 +569,6 @@ "function": "_first_person_weapon_set_state", "reason": "hardened COFF comparison proves all 688 padded bytes and all 26 semantic relocations exact (SHA-256 965964af9115913e36fa06e152828b2e857e7ac59e2cc0e6fdcff29ddebcb91f); objdiff reports a private switch-table/local-label ownership false negative" }, - { - "unit": "source/interface/ui_widget_game_data_input_functions", - "function": "_mutliplayer_settings_select_list_update_displayed_items", - "reason": "hardened COFF comparison proves all 1424 padded bytes and all 73 semantic relocations exact (SHA-256 adce7f9ab32aee72ec9d542efc297df9295a839a27406848eb8467ffea97594f); objdiff reports compiler-local switch-table labels as a false negative; January's original misspelling of multiplayer in the owner name is preserved" - }, { "unit": "source/interface/ui_widget_game_data_input_functions", "function": "_server_list_menu_update", diff --git a/config/symbols.json b/config/symbols.json index fc1dc720..979ae32e 100644 --- a/config/symbols.json +++ b/config/symbols.json @@ -946,7 +946,7 @@ { "file_offset": 337856, "flags": 32, "name": "_props_initialize_for_new_map" }, { "file_offset": 337872, "flags": 32, "name": "_props_dispose_from_old_map" }, { "file_offset": 337888, "flags": 32, "name": "_prop_add", "static": true }, -{ "file_offset": 338496, "flags": 32, "name": "_prop_new_blank" }, +{ "file_offset": 338496, "flags": 32, "name": "_prop_new_blank", "static": true }, { "file_offset": 338544, "flags": 32, "name": "_prop_remove", "static": true }, { "file_offset": 338864, "flags": 32, "name": "_prop_iterator_new" }, { "file_offset": 338912, "flags": 32, "name": "_prop_iterator_next" }, @@ -3297,8 +3297,8 @@ { "file_offset": 780976, "flags": 32, "name": "_input_get_gamepad_state" }, { "file_offset": 781088, "flags": 32, "name": "_input_set_gamepad_rumbler_state" }, { "file_offset": 781184, "flags": 32, "name": "_input_vertical_blank_interrupt" }, -{ "file_offset": 781232, "flags": 32, "name": "_input_unidentified_noop_1" }, -{ "file_offset": 781248, "flags": 32, "name": "_input_unidentified_noop_2" }, +{ "file_offset": 781232, "flags": 32, "name": "_acquire_input_mutex", "static": true }, +{ "file_offset": 781248, "flags": 32, "name": "_release_input_mutex", "static": true }, { "file_offset": 781264, "flags": 32, "name": "_input_get_device_states", "static": true }, { "file_offset": 782496, "flags": 32, "name": "_input_flush_rumble", "static": true }, { "file_offset": 782672, "flags": 32, "name": "_input_update_keyboard_devices", "static": true }, @@ -3323,12 +3323,12 @@ { "file_offset": 786352, "flags": 32, "name": "_hud_picked_up_ammunition" }, { "file_offset": 786400, "flags": 32, "name": "_hud_picked_up_weapon" }, { "file_offset": 786432, "flags": 32, "name": "_hud_picked_up_powerup" }, -{ "file_offset": 786464, "flags": 32, "name": "_temporary_hud_draw_reticle" }, +{ "file_offset": 786464, "flags": 32, "name": "_temporary_hud_draw_reticle", "static": true }, { "file_offset": 786672, "flags": 32, "name": "_hud_load" }, { "file_offset": 786768, "flags": 32, "name": "_hud_autosave" }, { "file_offset": 786992, "flags": 32, "name": "_hud_draw_friendly_indicator", "static": true }, -{ "file_offset": 787344, "flags": 32, "name": "_hud_draw_players" }, -{ "file_offset": 787504, "flags": 32, "name": "_temporary_hud_draw" }, +{ "file_offset": 787344, "flags": 32, "name": "_hud_draw_players", "static": true }, +{ "file_offset": 787504, "flags": 32, "name": "_temporary_hud_draw", "static": true }, { "file_offset": 788384, "flags": 32, "name": "_hud_draw_screen" }, { "file_offset": 788704, "flags": 32, "name": "_get_return_eip" }, { "file_offset": 788720, "flags": 32, "name": "_check_stack_buffer" }, @@ -3629,7 +3629,7 @@ { "file_offset": 857856, "flags": 32, "name": "_gen_cloud_coord" }, { "file_offset": 857904, "flags": 32, "name": "_gen_mask_coord" }, { "file_offset": 857968, "flags": 32, "name": "_draw_layer_int", "static": true }, -{ "file_offset": 858320, "flags": 32, "name": "_draw_layer" }, +{ "file_offset": 858320, "flags": 32, "name": "_draw_layer", "static": true }, { "file_offset": 858416, "flags": 32, "name": "_draw_initial_layer", "static": true }, { "file_offset": 858512, "flags": 32, "name": "_this_is_awful", "static": true }, { "file_offset": 858560, "flags": 32, "name": "_do_convoluation_coords", "static": true }, @@ -3927,7 +3927,7 @@ { "file_offset": 937904, "flags": 32, "name": "_virtual_keyboard_get_character", "static": true }, { "file_offset": 938112, "flags": 32, "name": "_virtual_keyboard_get_current_character", "static": true }, { "file_offset": 938160, "flags": 32, "name": "_virtual_keyboard_render_internal", "static": true }, -{ "file_offset": 939776, "flags": 32, "name": "_virtual_keyboard_free_space_in_text_buffer" }, +{ "file_offset": 939776, "flags": 32, "name": "_virtual_keyboard_free_space_in_text_buffer", "static": true }, { "file_offset": 939808, "flags": 32, "name": "_virtual_keyboard_backspace", "static": true }, { "file_offset": 939904, "flags": 32, "name": "_virtual_keyboard_close" }, { "file_offset": 939920, "flags": 32, "name": "_virtual_keyboard_render" }, @@ -4185,7 +4185,7 @@ { "file_offset": 991008, "flags": 32, "name": "_main_framerate_render" }, { "file_offset": 991680, "flags": 32, "name": "_halt_and_catch_fire" }, { "file_offset": 992352, "flags": 32, "name": "_main_loop_of_death" }, -{ "file_offset": 992416, "flags": 32, "name": "_main_game_render" }, +{ "file_offset": 992416, "flags": 32, "name": "_main_game_render", "static": true }, { "file_offset": 992864, "flags": 32, "name": "_main_loop" }, { "file_offset": 994512, "flags": 32, "name": "_connected_geometry_new" }, { "file_offset": 994560, "flags": 32, "name": "_connected_geometry_delete" }, @@ -4768,7 +4768,7 @@ { "file_offset": 1127888, "flags": 32, "name": "_model_find_marker" }, { "file_offset": 1128048, "flags": 32, "name": "_model_get_default_inverse_matrix" }, { "file_offset": 1128096, "flags": 32, "name": "_model_find_node" }, -{ "file_offset": 1128208, "flags": 32, "name": "_model_geometry_part_build_tangent_matrices" }, +{ "file_offset": 1128208, "flags": 32, "name": "_model_geometry_part_build_tangent_matrices", "static": true }, { "file_offset": 1128224, "flags": 32, "name": "_render_model" }, { "file_offset": 1130368, "flags": 32, "name": "_model_get_marker_by_name" }, { "file_offset": 1130832, "flags": 32, "name": "_model_build_tangent_matrices" }, @@ -4897,7 +4897,7 @@ { "file_offset": 1155904, "flags": 32, "name": "_network_game_generate_local_machine_name" }, { "file_offset": 1156048, "flags": 32, "name": "_network_game_end_and_load_ui" }, { "file_offset": 1156112, "flags": 32, "name": "_network_game_reset_for_next_round" }, -{ "file_offset": 1156288, "flags": 32, "name": "_network_game_dump" }, +{ "file_offset": 1156288, "flags": 32, "name": "_network_game_assign_players_to_team" }, { "file_offset": 1156304, "flags": 32, "name": "_network_player_is_valid" }, { "file_offset": 1156352, "flags": 32, "name": "_network_game_invalidate_machine" }, { "file_offset": 1156528, "flags": 32, "name": "_network_game_add_player" }, @@ -6244,7 +6244,7 @@ { "file_offset": 1519552, "flags": 32, "name": "_hardware_character_cache_get_origin", "static": true }, { "file_offset": 1519728, "flags": 32, "name": "_flush_hardware_character", "static": true }, { "file_offset": 1519824, "flags": 32, "name": "_cache_hardware_format_character", "static": true }, -{ "file_offset": 1520720, "flags": 32, "name": "_rasterizer_draw_character" }, +{ "file_offset": 1520720, "flags": 32, "name": "_rasterizer_draw_character", "static": true }, { "file_offset": 1520960, "flags": 32, "name": "_rasterizer_draw_character_with_dropshadow", "static": true }, { "file_offset": 1521328, "flags": 32, "name": "_rasterizer_draw_string" }, { "file_offset": 1521840, "flags": 32, "name": "_rasterizer_draw_unicode_string" }, @@ -6265,7 +6265,7 @@ { "file_offset": 1523552, "flags": 32, "name": "_rasterizer_transparent_geometry_stop" }, { "file_offset": 1523568, "flags": 32, "name": "_rasterizer_sort_internal", "static": true }, { "file_offset": 1523616, "flags": 32, "name": "_group_sorted_indices_cmpfn", "static": true }, -{ "file_offset": 1524000, "flags": 32, "name": "_rasterizer_sort_external" }, +{ "file_offset": 1524000, "flags": 32, "name": "_rasterizer_sort_external", "static": true }, { "file_offset": 1524176, "flags": 32, "name": "_rasterizer_transparent_geometry_draw" }, { "file_offset": 1524656, "flags": 32, "name": "_render_effects" }, { "file_offset": 1524688, "flags": 32, "name": "_render_initialize" }, @@ -6388,8 +6388,8 @@ { "file_offset": 1562672, "flags": 32, "name": "_triangle_strip_iterator_get_triangle" }, { "file_offset": 1563024, "flags": 32, "name": "_multiplayer_scenario_description_get_list" }, { "file_offset": 1563168, "flags": 32, "name": "_map_name_from_multiplayer_scenario_description_item" }, -{ "file_offset": 1563280, "flags": 32, "name": "_scenario_call_disconnect_from_structure_bsp_procs" }, -{ "file_offset": 1563312, "flags": 32, "name": "_scenario_call_reconnect_to_structure_bsp_procs" }, +{ "file_offset": 1563280, "flags": 32, "name": "_scenario_call_disconnect_from_structure_bsp_procs", "static": true }, +{ "file_offset": 1563312, "flags": 32, "name": "_scenario_call_reconnect_to_structure_bsp_procs", "static": true }, { "file_offset": 1563344, "flags": 32, "name": "_scenario_initialize" }, { "file_offset": 1563376, "flags": 32, "name": "_scenario_initialize_for_new_map" }, { "file_offset": 1563456, "flags": 32, "name": "_scenario_dispose_from_old_map" }, @@ -22545,7 +22545,7 @@ { "file_offset": 3033952, "flags": 0, "name": "_hs_source_files_block" }, { "file_offset": 3034132, "flags": 0, "name": "_hs_syntax_data_definition" }, { "file_offset": 3034148, "flags": 0, "name": "_hs_string_data_definition" }, -{ "file_offset": 3034164, "flags": 0, "name": "_default_string" }, +{ "file_offset": 3034164, "flags": 0, "name": "_default_string", "static": true }, { "file_offset": 3034168, "flags": 0, "name": "_global_hud_anchor_names" }, { "file_offset": 3034188, "flags": 0, "name": "_button_mappings", "static": true }, { "file_offset": 3034204, "flags": 0, "name": "_time_code_time" }, @@ -23014,7 +23014,7 @@ { "file_offset": 4450632, "flags": 0, "name": "_king_globals", "static": true }, { "file_offset": 4451060, "flags": 0, "name": "_king_engine_num_hills", "static": true }, { "file_offset": 4451064, "flags": 0, "name": "_king_engine_hills", "static": true }, -{ "file_offset": 4451192, "flags": 0, "name": "_mp_sound_queue_count" }, +{ "file_offset": 4451192, "flags": 0, "name": "_mp_sound_queue_count", "static": true }, { "file_offset": 4451196, "flags": 0, "name": "_mp_sound_queue", "static": true }, { "file_offset": 4451240, "flags": 0, "name": "_oddball_globals", "static": true }, { "file_offset": 4451504, "flags": 0, "name": "_race_globals", "static": true }, diff --git a/docs/object_matching_logs/astra_five_function_reconciliation_20260928.md b/docs/object_matching_logs/astra_five_function_reconciliation_20260928.md new file mode 100644 index 00000000..85f4c6ce --- /dev/null +++ b/docs/object_matching_logs/astra_five_function_reconciliation_20260928.md @@ -0,0 +1,154 @@ +# Five-function reconciliation — 2026-09-28 + +Canonical base: `51cd4d8b6793f863663d31a9b2a33fd68c5935e4`. +User request: reconcile the five-function handoff and push to the two canonical +repositories. The donor worktree was read only; no agents were launched. + +## Bounded source package + +The reconciliation takes the complete B3 declaration batch (`49905d70`), its +approved plane2d owner/body repair (`95acf7d6`) and network-game type-ownership +prerequisite K17 (`08aadd01`), and the complete K1–K16 + S follow-up +(`0f1a6c4d`). It does not harvest B3's gaining edits while discarding its debits. +The independent function patches are `b5bf62c4` (profile) and `5ac57092` +(effects), each with its park retirement and approved original-bug disclosure. + +The source/ownership justification records are the donor's RF-CI, RF-CK, +RF-CR, RF-CQ, RF-DV and RF-EC packets under +`research/remaining_frontier_20260926/workers/`. The handoff being reconciled +is `95c0bff9`, `lead/UNPUSHED_EXACT_20260928b.md`. These are provenance +references, not a claim that every other donor commit was integrated. + +Two mechanical conflicts were resolved: + +- Virtual keyboard: retain canonical's genuine + `virtual_keyboard_get_current_character()` call while taking B3's attested + free-space helper call, static storage and `move_size` form. Do not revert + canonical's independent helper recovery to the donor's expansion. +- `hs_library_internal_compile.h`: retire the duplicate prototypes into the + owner headers as K1 requires. Preserve the completed packet's parameter + names in the moved `hs_compile_postprocess` declaration. No prototype-count + padding or alternative placement was introduced. + +Canonical's separate physics water-depth recovery and talk-weight landing +remain intact. No whole donor-tree replacement or scorer change was made. + +## Exact-function result against canonical + +| Function | Meaningful | Padded | Classification | +| --- | ---: | ---: | --- | +| `_collision_move_point` | +4,744 | +4,752 | Recovered approved debit | +| `_player_profile_3wide_list_update` | +1,222 | +1,232 | Recovered approved debit | +| `_rasterizer_dynamic_geometry_initialize` | +473 | +480 | Recovered approved debit | +| `_compare_profile_sections` | +276 | +288 | New reconstruction under narrow ruling | +| `_effect_allowed_by_environment` | +124 | +128 | New reconstruction under narrow ruling | +| `_bitmap_copy` | −2,784 | −2,784 | Explicitly approved B3 debit | +| `__rasterizer_model_transparent_geometry_submit` | −1,285 | −1,296 | Explicitly approved B3 debit | +| **Net** | **+2,770** | **+2,800** | **+3 strict-exact functions** | + +There are no additional exact losses. These two losing rows and their exact +source/header contexts remain preserved in the published base commit above; +pre-batch objects and trial receipts are retained locally as well. + +The unchanged production progress model credits 128 rather than 124 bytes for +the effects function. Thus the progress-code increase is **2,774**, not 2,770. +This four-byte padding distinction is disclosed, not reported as newly +reconstructed meaningful code. + +| Measure | Before | After | +| --- | ---: | ---: | +| Strict exact / 8,252 stable target owners | 7,642 | 7,645 | +| Halo credited code / 1,770,166 | 1,593,655 | 1,596,429 | +| Halo credited functions / 7,574 | 7,469 | 7,472 | +| Complete Halo objects / 468 | 394 | 396 | +| Halo credited data / 3,923,451 | 2,648,123 | 2,648,123 | +| Valid active parks | 70 | 68 | + +Profile, flags and draw-primitives are admitted after current whole-object +audits. Bitmap-drawing is honestly revoked for `_bitmap_copy`. Screen-effect +stays Matching: the combined follow-up recovers the intermediate B3 loss, +and a fresh complete audit confirms it. These flips do not create function +credit. The three input/network naming changes are renames, not new matches. + +## Source-policy disclosures + +The complete owner corrections remain sensitive to VC7 declaration numbering. +Their gains are recoveries, not a general solution to that sensitivity. +S alone loses the units sentinel; the reviewed coherent combination does not. +S completes the January-sized projectile datum and removes both remaining +actor-perception views. Its five inherited offset assertions check real +January offsets (0x1FC, 0x200, 0x20C, 0x214, 0x224); they remain in place, +retargeted to the genuine type. Their numbering effect is load-bearing. No +new assertions, filler declarations, decorative parentheses, assembly, +optimization directives or yield-selected function moves were added. + +RT1 prototype placement remains rule-derived rather than proven by January +image order. Later-build ownership/name evidence is not relabelled as original +January source text. The O function-order proposal and R research are not +part of this landing. + +The two independent original-bug exceptions are narrow: + +- Profile: the invalid-mode arm leaves `result` unassigned. January's range + check/sole-writer proof excludes that arm, and its read also follows the + genuinely nonreturning fatal-exit path. RF-EE independently re-derived the + range, callers, writer, SEH and halt evidence; RF-DW records `/Od`'s + `_RTC_UninitUse("result")` witness. +- Effects: invalid tag data can reach the default arm, but its unassigned + `allowed` read is reached only after the same nonreturning exit. This is + **not** a claim that the arm or invalid tag value is unreachable. RF-EB + records the `/Od` uninitialized-local witness and the explicit vacuum FALSE + assignment. + +The canonical check independently decoded January's calls at 0x47e89C and +0x48b1BA, reads at 0x47e8A1 and 0x48b1BF, and the tail jump at 0x47c960. +A conservative intra-frame walk assuming every call returns reaches 205 +instructions in the halt/death-loop region and no `ret`. No noreturn annotation, +initializer, warning suppression or general reachable-UB exception was added. + +## Verification + +- Independent two-function trial: exactly two gains, zero losses; only those + two objects change, and only their target code sections change outside debug + metadata. Named storage/imports/COMMON and all surplus helpers are unchanged. +- Combined full build and stable sweep: exactly the five gains and two approved + losses above; same 8,252 target identities. Talk-weight and units' sentinel + remain exact. +- A second checkpoint after cleaning all compiler-rule outputs rebuilt from + scratch and reproduced the identical 8,252-row snapshot, parks, admission, + fake-scan and test results. The admission/provider and shell-rebinding checks + were repeated on those freshly rebuilt objects. +- Profile (44/44), flags (16/16), draw-primitives (36/36), and screen-effect + (13/13): complete owned-section/symbol audits PASS; zero disagreements with + January PDB publics. All 56 surplus-provider identity rows pass, with 74 + bounded pair links in both orders and no duplicate-definition diagnostics. + Expected unresolved-import exits are not represented as executable-link + success. +- Across the board, the only changed surplus definition is geometry's + `_plane2d_from_points`. It now equals January's selected decals copy and the + rebuilt decals provider in bytes and relocations; both link orders pass. +- Shell's semantic data owner is rebound `$T18502` → `$T18685` only after fresh + name-independent checks pass all 31 items: unchanged payload, flags, layout, + relocation destinations, referrers, owner properties and exact `_main`. + No data pin or credited amount is relaxed. +- Parks: 68 active, zero stale/invalid. Profile/effects retired together with + source; affected residuals retain the donor's dated rebaseline history. +- Admission audit: seven review candidates, zero contradicted, rejected or + revoked statuses after the explicit bitmap-drawing revocation. +- Full 467-unit `/W3 /Zs` comparison against archived canonical: 4,107 → 4,067, + no compile errors. Additions are exactly the disclosed 11 inherited math + conversion warnings exposed in vertex-shaders-runtime, one long-to-short + warning in main, and two qualifier warnings in hs-scenario-definitions. + The two independent functions have unchanged `/W3`, with one approved `/W4` + C4701 each. +- Pytest: 1,318 passed, five skipped, 100 subtests passed. Fake-source scan: + the same 26 leads. `git diff --check` clean. +- Objdiff remains 3.3.1, SHA-256 + `090987aa22c0fe9b7d252b2b44c2c0c92c5dd3e9b5965d353060802226a13677`. + +All generated receipts, original park records, preserved pre-batch objects, +candidate/rollback patches, fresh warning controls and provider-link logs are +under `scratch/astra_five_reconcile_20260928/`. Private executables, PDBs and SDK +assets are not published. Q10, COMMON waves, actions/main data-credit packets, +the jump-table denominator correction and unrelated donor research are outside +this reconciliation. Existing README and untracked research work are untouched. diff --git a/source/ai/action_charge.c b/source/ai/action_charge.c index e35425c7..272c6bca 100644 --- a/source/ai/action_charge.c +++ b/source/ai/action_charge.c @@ -86,7 +86,6 @@ symbols in this file: #include "actions.h" #include "actor_definitions.h" -#include "actor_perception.h" #include "actors.h" #include "ai.h" #include "ai_communication.h" @@ -121,14 +120,6 @@ enum /* ---------- prototypes */ -boolean unit_get_melee_range_and_ticks( - long unit_index, - boolean secondary, - short *melee_tick, - real *attack_time, - short *frame_count, - real *damage_time); - static real action_charge_find_target_range( long actor_index, short goal, diff --git a/source/ai/action_converse.c b/source/ai/action_converse.c index 7b2a8a73..57d97fac 100644 --- a/source/ai/action_converse.c +++ b/source/ai/action_converse.c @@ -28,7 +28,6 @@ symbols in this file: #include "cseries.h" #include "actions.h" -#include "action_converse.h" #include "actors.h" #include "ai_communication.h" diff --git a/source/ai/action_converse.h b/source/ai/action_converse.h deleted file mode 100644 index 84834c0a..00000000 --- a/source/ai/action_converse.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -ACTION_CONVERSE.H - -Public interface owned by ACTION_CONVERSE.C. -*/ - -#ifndef __ACTION_CONVERSE_H -#define __ACTION_CONVERSE_H -#pragma once - -/* ---------- headers */ - -#include "cseries.h" - -/* ---------- structures */ - -struct converse_state_data; - -/* ---------- prototypes/ACTION_CONVERSE.C */ - -boolean action_converse_setup( - long actor_index, - long conversation_index, - struct converse_state_data *state_data); - -#endif /* __ACTION_CONVERSE_H */ diff --git a/source/ai/action_fight.c b/source/ai/action_fight.c index 895d5d60..db51fee7 100644 --- a/source/ai/action_fight.c +++ b/source/ai/action_fight.c @@ -24,7 +24,6 @@ symbols in this file: #include "actions.h" #include "actor_definitions.h" -#include "actor_perception.h" #include "actors.h" #include "ai_scenario_definitions.h" #include "props.h" diff --git a/source/ai/action_flee.c b/source/ai/action_flee.c index a034720d..c3c0b952 100644 --- a/source/ai/action_flee.c +++ b/source/ai/action_flee.c @@ -46,7 +46,6 @@ symbols in this file: #define PATH_EXTERNAL_FLEE_ROUTINES #include "actors.h" #undef PATH_EXTERNAL_FLEE_ROUTINES -#include "actor_perception.h" #include "ai.h" #include "ai_communication.h" #include "ai_scenario_definitions.h" diff --git a/source/ai/action_guard.c b/source/ai/action_guard.c index 0fc9265f..b0eaddb4 100644 --- a/source/ai/action_guard.c +++ b/source/ai/action_guard.c @@ -53,6 +53,7 @@ symbols in this file: #include "actor_definitions.h" #include "ai_communication.h" #include "props.h" +#include "game/game_allegiance.h" /* ---------- constants */ @@ -78,24 +79,6 @@ enum /* ---------- prototypes */ -boolean game_team_is_ally( - short team_a, - short team_b); - -long actor_target_unit_index( - long actor_index); - -void actor_perception_forget_recent_damage( - long actor_index); - -void actor_perception_retreat_successful( - long actor_index); - -void actor_stimulus_suspicion( - long actor_index, - short suspicion_level, - long ticks); - /* ---------- globals */ /* ---------- public code */ diff --git a/source/ai/action_obey.c b/source/ai/action_obey.c index 251cdc3a..d7260e4b 100644 --- a/source/ai/action_obey.c +++ b/source/ai/action_obey.c @@ -249,7 +249,6 @@ symbols in this file: #include "cseries.h" #include "actions.h" -#include "actor_looking.h" #include "actors.h" #include "ai_communication.h" #include "ai_debug.h" diff --git a/source/ai/action_search.c b/source/ai/action_search.c index 7e853bc2..948780f5 100644 --- a/source/ai/action_search.c +++ b/source/ai/action_search.c @@ -55,13 +55,6 @@ symbols in this file: /* ---------- prototypes */ -long actor_target_unit_index( - long actor_index); - -boolean actors_searching_same_position( - long actor_index, - long other_actor_index); - /* ---------- public code */ boolean action_search_setup_target( diff --git a/source/ai/action_uncover.c b/source/ai/action_uncover.c index 74acdd3e..61ca1767 100644 --- a/source/ai/action_uncover.c +++ b/source/ai/action_uncover.c @@ -16,6 +16,7 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "cseries/errors.h" #include "actions.h" #include "actor_definitions.h" diff --git a/source/ai/action_vehicle.c b/source/ai/action_vehicle.c index ee2cab8c..26b7b71a 100644 --- a/source/ai/action_vehicle.c +++ b/source/ai/action_vehicle.c @@ -79,6 +79,7 @@ symbols in this file: #include "physics/collisions.h" #include "scenario/scenario.h" #include "units/unit_definitions.h" +#include "units/units.h" #include "units/vehicle_definitions.h" #include "units/vehicles.h" @@ -139,16 +140,6 @@ static short action_vehicle_find_impromptu_seat( real_vector3d *entry_facing, real_point3d *hint_point); -/* This public Units owner is temporarily repeated here while its broad owner - * header is held stable for the parallel Bipeds closure audit. */ -boolean unit_get_seat_entrance_point( - long unit_index, - long parent_unit_index, - short seat_index, - real_point3d *entrance_point, - real_point3d *seat_point, - real_point3d *hint_point); - /* ---------- globals */ /* ---------- public code */ diff --git a/source/ai/actions.c b/source/ai/actions.c index 0d4d5a6c..0488e6ca 100644 --- a/source/ai/actions.c +++ b/source/ai/actions.c @@ -416,41 +416,6 @@ typedef char firing_position_evaluation_context_size_assert[ /* ---------- prototypes */ -boolean action_guard_setup_from_fleeing( - long actor_index, - struct flee_state_data *flee_state, - struct guard_state_data *state_data); - -boolean action_guard_setup_from_combat_transition( - long actor_index, - struct guard_state_data *state_data); - -boolean action_guard_setup_current_position( - long actor_index, - struct guard_state_data *state_data); - -boolean action_guard_setup_find_position( - long actor_index, - long wait_ticks, - struct guard_state_data *state_data); - -boolean action_guard_setup_postcombat( - long actor_index, - struct guard_state_data *state_data); - -void actor_action_change( - long actor_index, - long new_action_type, - struct action_state_data *new_action_data); - -long actor_perception_find_recent_damaging_prop_index( - long actor_index, - boolean enemies_only); - -long ai_get_responsible_unit( - long object_index, - boolean include_self); - boolean actor_action_handle_combat_selection( long actor_index); @@ -461,34 +426,6 @@ boolean actor_action_allow_cover_seeking( long actor_index, boolean unopposable); -short vehicle_scripting_find_available_seats( - long vehicle_index, - char const *seat_substring_name, - short seat_desire_type, - short *seat_indices, - short maximum_seat_count); - -boolean action_vehicle_setup_specific( - long actor_index, - long vehicle_index, - short seat_index, - struct vehicle_state_data *state_data); - -void actor_perception_tried_to_uncover( - long actor_index, - long prop_index); - -void actor_perception_tried_to_search( - long actor_index, - long prop_index); - -void actor_perception_abandoned_search( - long actor_index, - long prop_index); - -boolean actor_action_consider_grenade( - long actor_index); - boolean actor_action_test_grenade( long actor_index); @@ -507,63 +444,6 @@ boolean actor_action_try_to_throw_grenade( long actor_index, boolean known_trajectory); -boolean action_vehicle_setup_impromptu( - long actor_index, - long vehicle_index, - real attempt_distance, - real continue_distance, - struct vehicle_state_data *state_data); - -boolean action_charge_setup( - long actor_index, - short goal, - struct charge_state_data *state_data); - -boolean action_fight_setup( - long actor_index, - struct fight_state_data *state_data); - -boolean action_uncover_setup_target( - long actor_index, - boolean able_to_search, - struct uncover_state_data *state_data); - -boolean action_uncover_setup_pursuit( - long actor_index, - short firing_position_index, - struct uncover_state_data *state_data); - -boolean action_search_setup_target( - long actor_index, - boolean must_charge, - struct search_state_data *state_data); - -boolean action_search_setup_pursuit( - long actor_index, - short firing_position_index, - boolean tenacious, - struct search_state_data *state_data); - -boolean action_search_setup_undirected( - long actor_index, - boolean tenacious, - struct search_state_data *state_data); - -boolean action_wait_setup( - long actor_index, - boolean was_actively_searching, - struct wait_state_data *state_data); - -boolean action_avoid_setup( - long actor_index, - struct avoid_state_data *state_data); - -real vector_to_line_distance_squared3d( - real_point3d const *point, - real_vector3d const *vector, - real_point3d const *base, - real_vector3d const *height); - boolean actor_move_try_evasion_direction( long actor_index, real_vector2d *alignment_vector, @@ -581,122 +461,6 @@ boolean actor_move_try_evasion_vector( boolean *is_ledge, void *collision_result); -void actor_stimulus_was_surprised( - long actor_index); - -boolean actor_situation_try_new_target( - long actor_index, - long prop_index); - -void action_sleep_control( - long actor_index); - -void action_fight_begin( - long actor_index); -boolean action_fight_perform( - long actor_index); -void action_fight_update( - long actor_index); -void action_fight_control( - long actor_index); -void action_fight_end( - long actor_index); - -void action_uncover_begin( - long actor_index); -boolean action_uncover_perform( - long actor_index); -void action_uncover_update( - long actor_index); -void action_uncover_control( - long actor_index); -void action_uncover_modify_color( - long actor_index, - real_argb_color *color); -void action_uncover_flush_position_indices( - long actor_index); - -void action_guard_begin( - long actor_index); -boolean action_guard_perform( - long actor_index); -void action_guard_update( - long actor_index); -void action_guard_control( - long actor_index); -void action_guard_end( - long actor_index); -void action_guard_modify_color( - long actor_index, - real_argb_color *color); -void action_guard_replace_prop( - long actor_index, - long invalid_prop_index, - long replacement_prop_index); -void action_guard_flush_position_indices( - long actor_index); -void action_guard_flush_structure_indices( - long actor_index); - -void action_search_begin( - long actor_index); -boolean action_search_perform( - long actor_index); -void action_search_update( - long actor_index); -void action_search_control( - long actor_index); -void action_search_flush_position_indices( - long actor_index); - -void action_wait_begin( - long actor_index); -boolean action_wait_perform( - long actor_index); -void action_wait_update( - long actor_index); -void action_wait_control( - long actor_index); - -boolean action_vehicle_perform( - long actor_index); -void action_vehicle_update( - long actor_index); - -void action_charge_begin( - long actor_index); -boolean action_charge_perform( - long actor_index); -void action_charge_update( - long actor_index); -void action_charge_control( - long actor_index); - -void action_converse_begin( - long actor_index); -boolean action_converse_perform( - long actor_index); -void action_converse_update( - long actor_index); -void action_converse_control( - long actor_index); -void action_converse_end( - long actor_index); -void action_converse_replace_prop( - long actor_index, - long invalid_prop_index, - long replacement_prop_index); - -void action_avoid_begin( - long actor_index); -boolean action_avoid_perform( - long actor_index); -void action_avoid_update( - long actor_index); -void action_avoid_control( - long actor_index); -void action_avoid_end( - long actor_index); static boolean actor_action_allowed_to_enter_vehicle( long actor_index, diff --git a/source/ai/actions.h b/source/ai/actions.h index f55b89f7..34376905 100644 --- a/source/ai/actions.h +++ b/source/ai/actions.h @@ -426,8 +426,20 @@ boolean actor_action_set_default_state( boolean actor_action_handle_initial_action( long actor_index); +void action_charge_begin( + long actor_index); +void action_charge_update( + long actor_index); +void action_charge_control( + long actor_index); boolean action_charge_is_leaping( long actor_index); +boolean action_charge_perform( + long actor_index); +boolean action_charge_setup( + long actor_index, + short goal, + struct charge_state_data *state_data); boolean actor_action_handle_pending_command_list( long actor_index); boolean actor_action_handle_surprise( @@ -467,6 +479,9 @@ boolean actor_action_handle_active_cover_seeking( long actor_index, boolean allow_defensive_cover, boolean allow_active_cover); +boolean actors_searching_same_position( + long actor_index, + long other_actor_index); boolean actor_action_handle_danger_avoidance( long actor_index); boolean actor_action_handle_vehicle_entry( @@ -534,11 +549,6 @@ void action_alert_flush_structure_indices( /* ---------- prototypes/ACTION_CHARGE.C */ -real normalize2d( - real_vector2d *vector); -real normalize3d( - real_vector3d *vector); - /* ---------- prototypes/ACTION_OBEY.C */ boolean action_obey_command_list_setup( @@ -569,10 +579,19 @@ void action_obey_describe_command( /* ---------- prototypes/ACTION_FIGHT.C */ +boolean action_fight_setup( + long actor_index, + struct fight_state_data *state_data); void action_fight_begin( long actor_index); void action_fight_end( long actor_index); +void action_fight_update( + long actor_index); +void action_fight_control( + long actor_index); +boolean action_fight_perform( + long actor_index); /* ---------- prototypes/ACTION_FLEE.C */ @@ -608,15 +627,175 @@ boolean action_flee_blind_panic( /* ---------- prototypes/ACTION_CONVERSE.C */ +boolean action_converse_setup( + long actor_index, + long conversation_index, + struct converse_state_data *state_data); +void action_converse_begin( + long actor_index); +boolean action_converse_perform( + long actor_index); +void action_converse_update( + long actor_index); +void action_converse_control( + long actor_index); +void action_converse_replace_prop( + long actor_index, + long old_prop_index, + long new_prop_index); void actor_conversation_control( long actor_index); +void action_converse_end( + long actor_index); /* ---------- prototypes/ACTION_VEHICLE.C */ void action_vehicle_begin( long actor_index); +void action_vehicle_update( + long actor_index); void action_vehicle_control( long actor_index); +boolean action_vehicle_setup_specific( + long actor_index, + long vehicle_index, + short seat_index, + struct vehicle_state_data *state_data); +boolean action_vehicle_perform( + long actor_index); +boolean action_vehicle_setup_impromptu( + long actor_index, + long vehicle_index, + real attempt_distance, + real continue_distance, + struct vehicle_state_data *state_data); + +/* ---------- prototypes/ACTION_GUARD.C */ + +boolean action_guard_setup_current_position( + long actor_index, + struct guard_state_data *state_data); +boolean action_guard_setup_find_position( + long actor_index, + long wait_ticks, + struct guard_state_data *state_data); +boolean action_guard_setup_postcombat( + long actor_index, + struct guard_state_data *state_data); +boolean action_guard_setup_from_combat_transition( + long actor_index, + struct guard_state_data *state_data); +boolean action_guard_setup_from_fleeing( + long actor_index, + struct flee_state_data *flee_state, + struct guard_state_data *state_data); +void action_guard_begin( + long actor_index); +void action_guard_end( + long actor_index); +void action_guard_flush_position_indices( + long actor_index); +void action_guard_flush_structure_indices( + long actor_index); +void action_guard_modify_color( + long actor_index, + real_argb_color *color); +void action_guard_replace_prop( + long actor_index, + long old_prop_index, + long new_prop_index); +void action_guard_update( + long actor_index); +boolean action_guard_perform( + long actor_index); +void action_guard_control( + long actor_index); + +/* ---------- prototypes/ACTION_UNCOVER.C */ + +boolean action_uncover_setup_target( + long actor_index, + boolean able_to_search, + struct uncover_state_data *state_data); +boolean action_uncover_setup_pursuit( + long actor_index, + short firing_position_index, + struct uncover_state_data *state_data); +boolean action_uncover_perform( + long actor_index); +void action_uncover_control( + long actor_index); +void action_uncover_flush_position_indices( + long actor_index); +void action_uncover_modify_color( + long actor_index, + real_argb_color *color); +void action_uncover_begin( + long actor_index); +void action_uncover_update( + long actor_index); + +/* ---------- prototypes/ACTION_SEARCH.C */ + +boolean action_search_setup_target( + long actor_index, + boolean must_charge, + struct search_state_data *state_data); +boolean action_search_setup_pursuit( + long actor_index, + short firing_position_index, + boolean tenacious, + struct search_state_data *state_data); +boolean action_search_setup_undirected( + long actor_index, + boolean tenacious, + struct search_state_data *state_data); +void action_search_update( + long actor_index); +void action_search_flush_position_indices( + long actor_index); +void action_search_control( + long actor_index); +void action_search_begin( + long actor_index); +boolean action_search_perform( + long actor_index); + +/* ---------- prototypes/ACTION_WAIT.C */ + +void action_wait_begin( + long actor_index); +boolean action_wait_perform( + long actor_index); +void action_wait_control( + long actor_index); +boolean action_wait_setup( + long actor_index, + boolean was_actively_searching, + struct wait_state_data *state_data); +void action_wait_update( + long actor_index); + +/* ---------- prototypes/ACTION_AVOID.C */ + +boolean action_avoid_setup( + long actor_index, + struct avoid_state_data *state_data); +void action_avoid_begin( + long actor_index); +void action_avoid_end( + long actor_index); +boolean action_avoid_perform( + long actor_index); +void action_avoid_update( + long actor_index); +void action_avoid_control( + long actor_index); + +/* ---------- prototypes/ACTION_SLEEP.C */ + +void action_sleep_control( + long actor_index); /* ---------- globals */ diff --git a/source/ai/actor_firing_position.c b/source/ai/actor_firing_position.c index ae1da85c..d0776f41 100644 --- a/source/ai/actor_firing_position.c +++ b/source/ai/actor_firing_position.c @@ -153,9 +153,9 @@ symbols in this file: #include "cseries.h" #include "cseries/errors.h" +#include "cseries/sort.h" #include "actor_definitions.h" -#include "actor_perception.h" #include "actors.h" #include "ai.h" #include "ai_debug.h" diff --git a/source/ai/actor_iterators.h b/source/ai/actor_iterators.h deleted file mode 100644 index 4bedb126..00000000 --- a/source/ai/actor_iterators.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __ACTOR_ITERATORS_H -#define __ACTOR_ITERATORS_H - -struct actor_datum; -struct actor_iterator; - -void actor_iterator_new( - struct actor_iterator *iterator, - boolean active_only); -struct actor_datum *actor_iterator_next( - struct actor_iterator *iterator); - -#endif // __ACTOR_ITERATORS_H diff --git a/source/ai/actor_looking.c b/source/ai/actor_looking.c index 1e2483f7..c657235f 100644 --- a/source/ai/actor_looking.c +++ b/source/ai/actor_looking.c @@ -166,13 +166,14 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" -#include "ai/actor_looking.h" +#include "math/real_math.h" #include "actors.h" #include "actor_definitions.h" #include "ai_debug.h" #include "ai_profile.h" #include "cseries/errors.h" +#include "game/game.h" #include "items/weapon_definitions.h" #include "main/console.h" #include "physics/collisions.h" diff --git a/source/ai/actor_looking.h b/source/ai/actor_looking.h deleted file mode 100644 index 8723eda0..00000000 --- a/source/ai/actor_looking.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef __ACTOR_LOOKING_H -#define __ACTOR_LOOKING_H - -union real_vector2d; - -void actor_look_affect_movement( - long actor_index); -void actor_look_update( - long actor_index); -boolean valid_real_normal2d( - union real_vector2d const *normal); -void actor_look_secondary_stop( - long actor_index); - -#endif // __ACTOR_LOOKING_H diff --git a/source/ai/actor_moving.c b/source/ai/actor_moving.c index 70e89537..24ff6f7a 100644 --- a/source/ai/actor_moving.c +++ b/source/ai/actor_moving.c @@ -210,7 +210,7 @@ symbols in this file: #define PATH_EXTERNAL_FLEE_ROUTINES #include "ai/actions.h" #include "ai/actor_definitions.h" -#include "ai/actor_looking.h" +#include "math/real_math.h" #include "ai/actor_types.h" #include "ai/actors.h" #include "ai/ai_communication.h" diff --git a/source/ai/actor_perception.c b/source/ai/actor_perception.c index 85d2e7b8..c176e2af 100644 --- a/source/ai/actor_perception.c +++ b/source/ai/actor_perception.c @@ -260,6 +260,7 @@ symbols in this file: #include "ai_profile.h" #include "encounters.h" #include "game/game.h" +#include "game/game_allegiance.h" #include "items/projectile_definitions.h" #include "items/projectiles.h" #include "items/weapon_definitions.h" @@ -438,31 +439,6 @@ enum /* ---------- structures */ -struct actor_perception_ai_debug_state_view -{ - byte __unknown000[6]; - boolean perception_ignore_player_props; - boolean perception_blind_player_props; - byte __unknown008[3]; - boolean perception_blind_all_props; - boolean perception_deaf_all_props; - byte __unknown00D[0x94]; - boolean perception_trace_player_awareness; -}; - -struct actor_perception_debug_info_view -{ - byte __unknown0000[0x6578]; - short perception_awareness_speed; - short evaluation_mode; -}; - -#define actor_perception_ai_debug_get() \ - ((struct actor_perception_ai_debug_state_view *)&ai_debug) - -#define actor_perception_debug_get(index) \ - ((struct actor_perception_debug_info_view *)&actor_debug_array[(index)]) - #define actor_perception_object_get(index) \ ((struct object_datum *)object_get_and_verify_type( \ (index), _object_mask_all)) @@ -748,12 +724,6 @@ struct actor_target_weight_weapon_definition_view real minimum_target_range; }; -struct actor_perception_projectile_datum_view -{ - byte __unknown000[0x1DC]; - byte attachment_flags; -}; - struct actor_perception_vehicle_definition_view { byte __unknown000[4]; @@ -762,13 +732,6 @@ struct actor_perception_vehicle_definition_view byte danger_zone_flags; }; -struct actor_perception_projectile_view -{ - byte __unknown000[0x1F0]; - real time_remaining; - real arming_rate; -}; - struct actor_perception_communication_context { short source_team; @@ -991,20 +954,8 @@ typedef char actor_emotion_definition_minimum_stand_offset_assert[ offsetof(struct actor_definition, defensive.defensive_crouch_min_stand_time) == 0x304 ? 1 : -1]; typedef char actor_emotion_definition_minimum_crouch_offset_assert[ offsetof(struct actor_definition, defensive.defensive_crouch_min_crouch_time) == 0x308 ? 1 : -1]; -typedef char actor_perception_ai_debug_ignore_players_offset_assert[ - offsetof(struct actor_perception_ai_debug_state_view, perception_ignore_player_props) == 6 ? 1 : -1]; -typedef char actor_perception_ai_debug_blind_players_offset_assert[ - offsetof(struct actor_perception_ai_debug_state_view, perception_blind_player_props) == 7 ? 1 : -1]; -typedef char actor_perception_ai_debug_blind_all_offset_assert[ - offsetof(struct actor_perception_ai_debug_state_view, perception_blind_all_props) == 11 ? 1 : -1]; -typedef char actor_perception_ai_debug_deaf_all_offset_assert[ - offsetof(struct actor_perception_ai_debug_state_view, perception_deaf_all_props) == 12 ? 1 : -1]; -typedef char actor_perception_ai_debug_trace_offset_assert[ - offsetof(struct actor_perception_ai_debug_state_view, perception_trace_player_awareness) == 0xA1 ? 1 : -1]; typedef char actor_perception_debug_awareness_speed_offset_assert[ - offsetof(struct actor_perception_debug_info_view, perception_awareness_speed) == 0x6578 ? 1 : -1]; -typedef char actor_perception_projectile_attachment_flags_offset_assert[ - offsetof(struct actor_perception_projectile_datum_view, attachment_flags) == 0x1DC ? 1 : -1]; + offsetof(struct actor_debug_info, perception_awareness_speed) == 0x6578 ? 1 : -1]; typedef char actor_perception_source_unit_sound_offset_assert[ offsetof(struct unit_definition, unit.constant_sound) == 0x182 ? 1 : -1]; typedef char actor_perception_source_actor_target_offset_assert[ @@ -1097,41 +1048,6 @@ static long actor_perception_qsort_compare_optional_props( void const *a, void const *b); -void actor_situation_update_target_status( - long actor_index); - -void actor_situation_combat_status_update( - long actor_index); - -real actor_compute_prop_target_weight( - long actor_index, - long prop_index); - -boolean actor_compute_prop_unopposable( - long actor_index, - long prop_index); - -long ai_get_responsible_unit( - long object_index, - boolean include_self); - -long vehicle_find_pathfinding_surface_index( - long vehicle_index, - real_point3d *position); - -long biped_find_pathfinding_surface_index( - long biped_index, - real_point3d *position); - -boolean actor_attacking_target( - long actor_index, - real_vector3d *attack_vector); - -void actor_stimulus_prop_sighted( - long actor_index, - long prop_index, - boolean initial_acknowledgement); - static long actor_perception_unit_from_swarm( long swarm_actor_index, long actor_index, @@ -1154,37 +1070,6 @@ static void actor_perception_refresh_test_object( struct actor_perception_refresh_list *friend_list, struct actor_perception_refresh_list *enemy_list); -void actor_input_sample_position( - long actor_index, - long unit_index, - struct actor_position_data *position); - -boolean vehicle_causes_collision_damage( - long vehicle_index); - -boolean game_team_is_enemy( - short team_index0, - short team_index1); - -short actor_visibility_at_point( - long actor_index, - struct actor_position_data const *position, - real_point3d const *target_position, - char lighting, - short line_of_sight, - boolean use_maximum_distance, - boolean target_is_player, - short perception_knowledge); - -short actor_audibility_at_point( - long actor_index, - struct actor_position_data const *position, - real_point3d const *source_position, - struct location const *source_location, - short source_type, - real scale, - short line_of_sight); - static boolean actor_perception_assess_suicide_danger( long actor_index, long object_index, @@ -1193,10 +1078,6 @@ static boolean actor_perception_assess_suicide_danger( boolean enemy, boolean visible); -real actor_look_compute_prop_interest( - long actor_index, - long prop_index); - /* TU-local copy: the same macro exists in actor_stimulus.c. */ #define prop_acknowledged(prop) \ ((prop)->state >= _prop_state_becoming_unacknowledged && \ @@ -5513,8 +5394,8 @@ static void actor_perception_refresh_test_object( } else if (current_object->object.type == _object_type_projectile) { - struct actor_perception_projectile_datum_view *projectile = - (struct actor_perception_projectile_datum_view *) + struct projectile_datum *projectile = + (struct projectile_datum *) current_object; struct projectile_definition *projectile_definition = projectile_definition_get( @@ -5522,7 +5403,7 @@ static void actor_perception_refresh_test_object( if (projectile_definition->projectile.danger_radius > 0.0f && (current_object->object.parent_object_index == NONE || - TEST_FLAG(projectile->attachment_flags, 5))) + TEST_FLAG(projectile->projectile.flags, 5))) { struct actor_position_data position; real_point3d origin; @@ -6637,7 +6518,7 @@ void actor_perception_update( case _prop_state_becoming_acknowledged: { - struct actor_perception_debug_info_view *debug = actor_perception_debug_get(DATUM_INDEX_TO_ABSOLUTE_INDEX(actor_index)); + struct actor_debug_info *debug = &actor_debug_array[DATUM_INDEX_TO_ABSOLUTE_INDEX(actor_index)]; if (prop->perception == _actor_perception_none) { diff --git a/source/ai/actor_perception.h b/source/ai/actor_perception.h deleted file mode 100644 index c9507d23..00000000 --- a/source/ai/actor_perception.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -ACTOR_PERCEPTION.H - -header included in hcex build. -*/ - -#ifndef __ACTOR_PERCEPTION_H -#define __ACTOR_PERCEPTION_H -#pragma once - -/* ---------- prototypes/ACTOR_PERCEPTION.C */ - -struct actor_position_data; -union real_point3d; - -short actor_get_perception_knowledge( - long actor_index, - long prop_index); -short actor_visibility_at_point( - long actor_index, - struct actor_position_data const *position, - union real_point3d const *target_position, - char lighting, - short line_of_sight, - boolean use_maximum_distance, - boolean target_is_player, - short perception_knowledge); - -void actor_situation_update_target_status( - long actor_index); -void actor_situation_combat_status_update( - long actor_index); -boolean actor_situation_try_new_target( - long actor_index, - long prop_index); -boolean actor_perception_friend_prop_is_attacking( - long actor_index, - long friend_prop_index, - real_vector3d *attack_vector); -void actor_perception_unreachable( - long actor_index, - long prop_index, - boolean unreachable); - -#endif // __ACTOR_PERCEPTION_H diff --git a/source/ai/actor_type_infection.c b/source/ai/actor_type_infection.c index faa71408..eb03cdd3 100644 --- a/source/ai/actor_type_infection.c +++ b/source/ai/actor_type_infection.c @@ -159,9 +159,6 @@ void infection_swarm_aim_jump( real jump_magnitude, real_vector3d *jump_velocity); -void unit_detach_from_parent( - long unit_index); - /* ---------- globals */ struct actor_type_definition actor_type_infection = diff --git a/source/ai/actors.c b/source/ai/actors.c index 976de769..732b059b 100644 --- a/source/ai/actors.c +++ b/source/ai/actors.c @@ -283,14 +283,13 @@ symbols in this file: #include "cseries.h" #include "actors.h" #include "actor_definitions.h" -#include "actor_iterators.h" #include "actor_placement.h" #include "actor_types.h" #include "encounters.h" #include "props.h" #include "ai.h" -#include "actor_looking.h" +#include "math/real_math.h" #include "ai_communication.h" #include "ai_debug.h" #include "ai_profile.h" @@ -2372,7 +2371,7 @@ long actor_new( actor_debug_info->charge_last_time = NONE; actor_debug_info->field_19C = NONE; actor_debug_info->vision_last_time = NONE; - actor_debug_info->num_debug_evaluations = NONE; + actor_debug_info->perception_awareness_speed = NONE; actor_type_initialize(actor_index); } diff --git a/source/ai/actors.h b/source/ai/actors.h index 90779e92..da8a1eff 100644 --- a/source/ai/actors.h +++ b/source/ai/actors.h @@ -1341,6 +1341,15 @@ boolean actor_compute_prop_unopposable( real actor_compute_prop_target_weight( long actor_index, long prop_index); +short actor_visibility_at_point( + long actor_index, + struct actor_position_data const *position, + union real_point3d const *target_position, + char lighting, + short line_of_sight, + boolean use_maximum_distance, + boolean target_is_player, + short perception_knowledge); boolean actor_perception_desire_prop( long actor_index, short desired_target_state, @@ -1363,10 +1372,17 @@ void actor_perception_acknowledge( long prop_index, boolean had_orphan, boolean expected_acknowledgement); +short actor_get_perception_knowledge( + long actor_index, + long prop_index); boolean actor_perception_become_acknowledged( long actor_index, long prop_index, boolean *expected_acknowledgement_out); +void prop_status_refresh( + long actor_index, + long prop_index, + struct actor_position_data *position); boolean actor_perception_create_orphan_from_friend( long actor_index, long unit_index, @@ -1376,14 +1392,36 @@ long actor_perception_find_killer_prop_index( long actor_index, long prop_index, boolean enemies_only); +long actor_perception_find_recent_damaging_prop_index( + long actor_index, + boolean enemies_only); +void actor_perception_forget_recent_damage( + long actor_index); +void actor_perception_retreat_successful( + long actor_index); void actor_perception_find_prop_pathfinding_location( long actor_index, long prop_index); +void actor_perception_tried_to_uncover( + long actor_index, + long prop_index); +void actor_perception_tried_to_search( + long actor_index, + long prop_index); +void actor_perception_abandoned_search( + long actor_index, + long prop_index); void actor_perception_find_sense_position( long actor_index, real_point3d const *position, long prop_index, struct actor_position_data *sense_position); +void prop_position_refresh( + long actor_index, + long prop_index, + struct actor_position_data *position, + boolean refresh_position, + boolean refresh_vehicle); short actor_audibility_at_point( long actor_index, struct actor_position_data const *sense_position, @@ -1396,11 +1434,22 @@ void actor_perception_update( long actor_index); void actor_situation_update( long actor_index); +boolean actor_perception_friend_prop_is_attacking( + long actor_index, + long friend_prop_index, + real_vector3d *attack_vector); void actor_emotion_update( long actor_index); +void actor_perception_unreachable( + long actor_index, + long prop_index, + boolean unreachable); boolean actor_emotion_flee_with_friends( long actor_index, real *desire_to_flee); +boolean actor_situation_try_new_target( + long actor_index, + long prop_index); /* ---------- prototypes/ACTOR_STIMULUS.C */ @@ -1411,6 +1460,10 @@ void actor_stimulus_surprise( short surprise_level, long prop_index, real_vector3d const *surprise_vector); +void actor_stimulus_suspicion( + long actor_index, + short suspicion_combat_status, + long suspicion_timer); void actor_stimulus_enter_combat_found_body( long actor_index, long prop_index); @@ -1433,6 +1486,10 @@ void actor_stimulus_environmental_noise( void actor_stimulus_heard_shooting( long actor_index, long prop_index); +void actor_stimulus_prop_sighted( + long actor_index, + long prop_index, + boolean initial_acknowledgement); void actor_stimulus_noticed_danger_zone( long actor_index, short danger_type, @@ -1471,13 +1528,24 @@ void actor_stimulus_prop_acknowledged( long prop_index, boolean reappearance, boolean expected_acknowledgement); +void actor_stimulus_was_surprised( + long actor_index); // prototypes/ACTOR_LOOKING.C +void actor_look_secondary_stop( + long actor_index); +real actor_look_compute_prop_interest( + long actor_index, + long prop_index); void actor_looking_test_validity( long actor_index, real_vector3d const *vector, boolean *aiming_valid, boolean *looking_valid); +void actor_look_update( + long actor_index); +void actor_look_affect_movement( + long actor_index); void actor_get_vision_distances( long actor_index, @@ -1486,6 +1554,10 @@ void actor_get_vision_distances( real horizontal_angle, real *full_distance_reference, real *partial_distance_reference); +void actor_situation_update_target_status( + long actor_index); +void actor_situation_combat_status_update( + long actor_index); void actor_berserk( long actor_index, diff --git a/source/ai/ai.c b/source/ai/ai.c index 8a5234f5..9b178624 100644 --- a/source/ai/ai.c +++ b/source/ai/ai.c @@ -208,10 +208,8 @@ symbols in this file: #include "ai/ai_communication.h" #include "ai/ai_debug.h" #include "ai/ai_profile.h" -#include "ai/ai_runtime.h" #include "ai/ai_scenario_definitions.h" #include "ai/ai_script.h" -#include "ai/actor_iterators.h" #include "ai/actor_placement.h" #include "ai/actor_types.h" #include "ai/actions.h" @@ -228,6 +226,7 @@ symbols in this file: #include "game/game_globals.h" #include "game/players.h" +#include "main/console.h" #include "memory/data.h" #include "objects/damage.h" #include "physics/collision_usage.h" diff --git a/source/ai/ai.h b/source/ai/ai.h index 619ce378..924cccd3 100644 --- a/source/ai/ai.h +++ b/source/ai/ai.h @@ -97,10 +97,16 @@ struct ai_information_packet void ai_initialize( void); +void ai_dispose( + void); +void ai_dispose_from_old_map( + void); void ai_initialize_for_new_map( void); void ai_place( void); +void ai_globals_ai_active( + boolean enabled); void ai_update( void); void ai_disconnect_from_structure_bsp( @@ -109,8 +115,16 @@ void ai_reconnect_to_structure_bsp( void); void ai_globals_dialogue_triggers_enabled( boolean enabled); +void ai_globals_grenades_enabled( + boolean enabled); void ai_update_team_status( void); +void ai_handle_bump( + long unit_index, + long object_index, + union real_vector3d const *old_velocity); +void ai_create_mounted_weapons_for_unit( + long unit_index); long ai_get_race_from_team_index( short team_index); void ai_get_major_upgrade_chance( @@ -118,6 +132,11 @@ void ai_get_major_upgrade_chance( boolean *upgrade_major, boolean *random, real *chance); +void ai_erase( + long encounter_index, + long platoon_index, + long squad_index, + boolean immediate); boolean ai_consider_major_upgrade( long encounter_index, short squad_index, @@ -131,6 +150,25 @@ boolean ai_try_vehicle_eviction( long actor_index, long entering_unit_index, boolean immediate); +long ai_get_responsible_unit( + long object_index, + boolean responsible_for_weapon_fire); +void ai_handle_death( + long unit_index, + long killer_object_index, + short damage_category); +boolean ai_handle_killing_spree( + long unit_index, + short killing_spree_count); +void ai_handle_allegiance_status_changed( + short team1_index, + short team2_index, + boolean currently_broken, + boolean permanently_broken); +void ai_handle_allegiance_broken_notification( + short team1_index, + short team2_index, + boolean broken); boolean ai_test_ballistic_line_of_fire( long actor_index, union real_point3d const *origin, @@ -184,6 +222,12 @@ void ai_handle_damage( real fraction, union real_vector3d *damage_velocity, boolean delayed); +void ai_handle_deleted_object( + long object_index); +void ai_handle_unit_effect( + long unit_index, + short effect_type, + short volume); void ai_handle_enter_vehicle( long unit_index, long vehicle_index); diff --git a/source/ai/ai_communication.c b/source/ai/ai_communication.c index 998a2c03..54692247 100644 --- a/source/ai/ai_communication.c +++ b/source/ai/ai_communication.c @@ -549,9 +549,7 @@ symbols in this file: #include "ai_profile.h" #include "ai_script.h" #include "actions.h" -#include "action_converse.h" #include "actor_definitions.h" -#include "actor_perception.h" #include "actors.h" #include "actor_types.h" #include "ai_scenario_definitions.h" @@ -1054,8 +1052,6 @@ static boolean ai_conversation_line_perform( long conversation_index); static void ai_conversation_line_end( long conversation_index); -boolean actor_is_fighting( - long actor_index); static void actor_reset_idle_vocalization_timer( long actor_index); static void ai_communication_handle_received_looking( @@ -1068,29 +1064,8 @@ static void ai_communication_update_speech_timers( short vocalization_type, short dialogue_type_index, short reply_table_index); -short unit_test_speech( - long unit_index, - short priority, - boolean allow_recursive_lookup, - boolean allow_queue, - long *unit_last_speech_time, - short *vocalization_type_reference, - long *sound_definition_index_reference); -void unit_speak( - long unit_index, - short play_type, - struct unit_speech_item const *speech_item); boolean sound_scripted_dialog_is_playing( void); -void ai_handle_allegiance_broken_notification( - short team1_index, - short team2_index, - boolean broken); -void actor_iterator_new( - struct actor_iterator *iterator, - boolean active_only); -struct actor_datum *actor_iterator_next( - struct actor_iterator *iterator); static boolean ai_conversation_find_participant( long conversation_index, short participant_index, @@ -1107,23 +1082,6 @@ static long ai_communication_find_actor_to_reply_to_player( short vocalization_type, short damage_category, real *reply_rating_reference); -void actor_perception_find_sense_position( - long actor_index, - real_point3d const *position, - long prop_index, - struct actor_position_data *sense_position); -short actor_audibility_at_point( - long actor_index, - struct actor_position_data const *position, - real_point3d const *source_position, - struct location const *source_location, - short source_type, - real scale, - short line_of_sight); -void actor_handle_communication( - long actor_index, - long prop_index, - struct ai_information_packet *information); extern short global_communication_table_indices[NUMBER_OF_COMMUNICATION_TYPES]; extern struct ai_communication_globals_view *ai_globals; diff --git a/source/ai/ai_debug.c b/source/ai/ai_debug.c index 46f2cb9f..f12187dd 100644 --- a/source/ai/ai_debug.c +++ b/source/ai/ai_debug.c @@ -5,6 +5,7 @@ AI_DEBUG.C /* ---------- headers */ #include "cseries.h" +#include "cseries/errors.h" #include "ai_debug.h" #include "actions.h" @@ -22,8 +23,8 @@ AI_DEBUG.C #include "camera/observer.h" #include "editor/editor_stubs.h" #include "game/game.h" -#include "game/player_control.h" #include "game/players.h" +#include "main/console.h" #include "memory/data.h" #include "objects/damage.h" #include "physics/collision_bsp_definitions.h" @@ -231,11 +232,6 @@ static void ai_debug_render_path_nodes( boolean render_polygons, boolean render_costs, boolean render_closest); -void actor_iterator_new( - struct actor_iterator *iterator, - boolean active_only); -struct actor_datum *actor_iterator_next( - struct actor_iterator *iterator); /* ---------- globals */ struct ai_debug_state ai_debug; @@ -4221,13 +4217,13 @@ static void ai_debug_communication_toggle_bits( if (clear_count) { bit_vector_or(vector_size, new_vector, vector, vector); - console_printf(NULL, "set %d flags", clear_count); + console_printf(FALSE, "set %d flags", clear_count); } else if (set_count) { bit_vector_not(vector_size, new_vector, new_vector); bit_vector_and(vector_size, new_vector, vector, vector); - console_printf(NULL, "cleared %d flags", set_count); + console_printf(FALSE, "cleared %d flags", set_count); } return; diff --git a/source/ai/ai_debug.h b/source/ai/ai_debug.h index f19cbbba..29f113c2 100644 --- a/source/ai/ai_debug.h +++ b/source/ai/ai_debug.h @@ -504,7 +504,7 @@ struct actor_debug_info long vision_last_time; real vision_last_maximum_distance; real vision_last_perception_factor; - short num_debug_evaluations; + short perception_awareness_speed; short firing_position_type_mismatch_ticks; }; @@ -539,9 +539,13 @@ void ai_debug_render( void ai_debug_vocalize( char const *priority_name, char const *vocalization_name); +void ai_debug_speak_list( + char const *list_name); void ai_debug_change_selected_encounter( boolean a1); +void ai_debug_teleport_to( + long ai_index); void ai_debug_change_selected_actor( boolean a1); diff --git a/source/ai/ai_profile.c b/source/ai/ai_profile.c index fe3d38cc..2c9876a4 100644 --- a/source/ai/ai_profile.c +++ b/source/ai/ai_profile.c @@ -83,7 +83,6 @@ symbols in this file: #include "cseries/cseries.h" #include "ai/actors.h" -#include "ai/actor_iterators.h" #include "ai/encounters.h" #include "ai/props.h" @@ -116,7 +115,7 @@ enum /* ---------- structures */ -/* The iterator's public API is in actor_iterators.h. This concrete layout +/* The iterator's public API is in encounters.h. This concrete layout * agrees with its ACTORS.C owner and the January 28-byte caller frame. */ struct actor_iterator { diff --git a/source/ai/ai_runtime.h b/source/ai/ai_runtime.h deleted file mode 100644 index b3f04285..00000000 --- a/source/ai/ai_runtime.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -AI_RUNTIME.H -*/ - -#ifndef __AI_RUNTIME_H -#define __AI_RUNTIME_H -#pragma once - -/* ---------- headers */ - -#include "cseries/cseries.h" - -/* ---------- prototypes/AI.C */ - -void ai_dispose( - void); -void ai_dispose_from_old_map( - void); -void ai_globals_ai_active( - boolean enabled); -void ai_globals_grenades_enabled( - boolean enabled); -long ai_get_responsible_unit( - long object_index, - boolean responsible_for_weapon_fire); -void ai_handle_bump( - long unit_index, - long object_index, - union real_vector3d const *old_velocity); -void ai_handle_death( - long unit_index, - long killer_object_index, - short damage_category); -boolean ai_handle_killing_spree( - long unit_index, - short killing_spree_count); -void ai_handle_allegiance_broken_notification( - short team1_index, - short team2_index, - boolean broken); -void ai_handle_allegiance_status_changed( - short team1_index, - short team2_index, - boolean currently_broken, - boolean permanently_broken); -void ai_create_mounted_weapons_for_unit( - long unit_index); -void ai_handle_deleted_object( - long object_index); -void ai_handle_unit_effect( - long unit_index, - short effect_type, - short volume); -void ai_erase( - long encounter_index, - long platoon_index, - long squad_index, - boolean immediate); - -#endif // __AI_RUNTIME_H diff --git a/source/ai/ai_script.c b/source/ai/ai_script.c index 9dde437b..4a176731 100644 --- a/source/ai/ai_script.c +++ b/source/ai/ai_script.c @@ -446,12 +446,9 @@ symbols in this file: #include "cseries.h" #include "ai/ai.h" -#include "ai/ai_runtime.h" #include "ai/actions.h" -#include "ai/actor_iterators.h" #include "ai/actor_definitions.h" #include "ai/actor_types.h" -#include "ai/actor_looking.h" #include "ai/actors.h" #include "ai/ai_communication.h" #include "ai/ai_debug.h" @@ -472,7 +469,6 @@ symbols in this file: #include "scenario/scenario_definitions.h" #include "units/bipeds.h" #include "units/units.h" -#include "units/vehicle_scripting.h" /* ---------- constants */ diff --git a/source/ai/ai_script.h b/source/ai/ai_script.h index c0a3ebd1..cd4cdd30 100644 --- a/source/ai/ai_script.h +++ b/source/ai/ai_script.h @@ -68,6 +68,12 @@ void ai_script_dispose_from_old_map( void); void ai_scripting_reconnect( void); +short ai_scripting_conversation_line( + short conversation_index); +short ai_scripting_conversation_status( + short conversation_index); +void ai_scripting_retreat( + long ai_reference); void ai_scripting_erase_all( void); void ai_index_to_string( @@ -93,6 +99,22 @@ long object_list_from_ai_reference( long ai_reference); struct ai_script_vehicle_enterable *ai_scripting_find_vehicle_enterable( long vehicle_index); +void ai_scripting_vehicle_enterable_distance( + long ai_reference, + real distance); +void ai_scripting_vehicle_enterable_team( + long object_list_index, + short team); +void ai_scripting_vehicle_enterable_actor_type( + long object_list_index, + short actor_type); +void ai_scripting_vehicle_enterable_actors( + long vehicle_index, + long actor_list_index); +void ai_scripting_vehicle_enterable_disable( + long vehicle_index); +void ai_scripting_detach_unit( + long unit_index); void ai_scripting_attach_unit( long unit_index, long ai_reference); @@ -126,6 +148,13 @@ void ai_scripting_maneuver_enable( void ai_scripting_migrate_by_unit( long object_list_index, long target_ai_reference); +void ai_scripting_migrate_and_speak( + long source_ai_reference, + long target_ai_reference, + char const *speech_type); +void ai_scripting_allegiance_remove( + short team_a, + short team_b); void ai_scripting_berserk( long ai_reference, boolean berserk); @@ -164,8 +193,46 @@ void ai_scripting_follow_target_ai( void ai_scripting_force_active( long ai_reference, boolean force); +void ai_scripting_deselect( + void); +void ai_scripting_attach_units( + long ai_reference, + long object_list_index); +void ai_scripting_magically_see_units( + long ai_reference, + long object_list_index); +void ai_scripting_set_respawn( + long ai_reference, + boolean respawn); +void ai_scripting_set_deaf( + long ai_reference, + boolean deaf); +void ai_scripting_set_blind( + long ai_reference, + boolean blind); void ai_scripting_detach_units( long object_list_index); +void ai_scripting_kill( + long ai_reference); +void ai_scripting_kill_silent( + long ai_reference); +short ai_scripting_swarm_count( + long ai_reference); +short ai_scripting_nonswarm_count( + long ai_reference); +short ai_scripting_living_count( + long ai_reference); +real ai_scripting_living_fraction( + long ai_reference); +real ai_scripting_strength( + long ai_reference); +boolean ai_scripting_is_attacking( + long encounter_index); +short ai_scripting_going_to_vehicle( + long ai_reference); +void ai_scripting_migrate( + long source_ai_index, + long destination_ai_index); void ai_scripting_select( long ai_reference); short ai_scripting_status( @@ -181,6 +248,14 @@ void ai_scripting_allegiance( boolean ai_scripting_allegiance_broken( short team1_index, short team2_index); +boolean ai_scripting_conversation( + short conversation_index); +void ai_scripting_conversation_stop( + short conversation_index); +void ai_scripting_conversation_advance( + short conversation_index); +void ai_scripting_stop_looking( + long ai_index); void ai_scripting_renew( long ai_reference); void ai_scripting_braindead_by_unit( @@ -247,6 +322,8 @@ void ai_scripting_set_team( short team_index); void ai_scripting_command_list_advance_by_unit( long unit_index); +short ai_scripting_command_list_status( + long ai_reference); /* ---------- globals */ diff --git a/source/ai/encounters.c b/source/ai/encounters.c index fe6b46da..fb7d7cf6 100644 --- a/source/ai/encounters.c +++ b/source/ai/encounters.c @@ -281,13 +281,11 @@ symbols in this file: #include "cseries.h" #include "ai/actor_activation.h" -#include "ai/actor_iterators.h" #include "encounters.h" #include "actions.h" #include "actors.h" #include "actor_definitions.h" -#include "actor_iterators.h" #include "actor_placement.h" #include "actor_types.h" #include "ai.h" diff --git a/source/ai/encounters.h b/source/ai/encounters.h index 7de9104e..e2d4a2dc 100644 --- a/source/ai/encounters.h +++ b/source/ai/encounters.h @@ -153,6 +153,8 @@ struct actor_datum *encounter_actor_iterator_next( struct encounter_actor_iterator *iterator); struct actor_datum *encounter_actor_iterator_prev( struct encounter_actor_iterator *iterator); +struct actor_datum *actor_iterator_next( + struct actor_iterator *iterator); void encounter_compute_activation_cluster_bit_vector( long encounter_index, boolean update_actor_dormancy, @@ -239,6 +241,9 @@ void encounter_set_respawn( void encounter_set_deaf( long encounter_index, boolean deaf); +void actor_iterator_new( + struct actor_iterator *iterator, + boolean active_only); void encounter_set_blind( long encounter_index, boolean blind); diff --git a/source/ai/props.c b/source/ai/props.c index 359314b3..933e937e 100644 --- a/source/ai/props.c +++ b/source/ai/props.c @@ -72,6 +72,7 @@ symbols in this file: #include "actors.h" #include "cseries/errors.h" #include "game/game.h" +#include "game/game_allegiance.h" #include "memory/data.h" #include "saved games/game_state.h" #include "units/unit_definitions.h" @@ -85,19 +86,6 @@ symbols in this file: /* ---------- prototypes */ -boolean game_team_is_enemy(short team_index0, short team_index1); -boolean game_team_is_ally(short team_index0, short team_index1); -boolean game_team_ally_status_changed(short team_index0, short team_index1); -void prop_position_refresh( - long actor_index, - long prop_index, - struct actor_position_data *position, - boolean force, - boolean update_status); -void prop_status_refresh( - long actor_index, - long prop_index, - struct actor_position_data *position); /* ---------- globals */ static long last_prop_data_full_warn_time = NONE; @@ -243,7 +231,7 @@ static void prop_add( return; } -long prop_new_blank( +static long prop_new_blank( long actor_index) { long prop_index = datum_new(prop_data); @@ -485,9 +473,8 @@ long prop_orphan_transition( long actor_index, long parent_prop_index) { - long prop_index = datum_new(prop_data); + long prop_index = prop_new_blank(actor_index); - prop_add(actor_index, NONE, prop_index); if (prop_index != NONE) { struct prop_datum *parent_prop = prop_get(parent_prop_index); @@ -515,9 +502,8 @@ long prop_orphan_from_friend( long unacknowledged_prop_index, long friend_acknowledged_prop_index) { - long prop_index = datum_new(prop_data); + long prop_index = prop_new_blank(actor_index); - prop_add(actor_index, NONE, prop_index); if (prop_index != NONE) { struct prop_datum *parent_prop = prop_get(unacknowledged_prop_index); diff --git a/source/ai/props.h b/source/ai/props.h index 7c7e3089..3d8d8c2a 100644 --- a/source/ai/props.h +++ b/source/ai/props.h @@ -160,13 +160,13 @@ void props_initialize_for_new_map( void); void props_dispose( void); +void props_dispose_from_old_map( + void); void prop_delete( long actor_index, long prop_index); void prop_iterator_new(struct prop_iterator *iterator, long actor_index); struct prop_datum *prop_iterator_next(struct prop_iterator *iterator); -long prop_new_blank( - long actor_index); long prop_new_unacknowledged( long actor_index, long unit_index, diff --git a/source/bitmaps/bitmap_drawing.c b/source/bitmaps/bitmap_drawing.c index 5dd6e4cd..5a4db182 100644 --- a/source/bitmaps/bitmap_drawing.c +++ b/source/bitmaps/bitmap_drawing.c @@ -47,7 +47,7 @@ symbols in this file: #include "bitmaps/bitmap_drawing.h" -#include "bitmaps/bitmaps_internal.h" +#include "bitmaps/bitmaps.h" #include "bitmaps/bitmap_group.h" #include "bitmaps/bitmap_utilities.h" #include "cseries/errors.h" diff --git a/source/bitmaps/bitmap_extract.c b/source/bitmaps/bitmap_extract.c index 1cc0e3d6..052ef7a7 100644 --- a/source/bitmaps/bitmap_extract.c +++ b/source/bitmaps/bitmap_extract.c @@ -223,8 +223,6 @@ symbols in this file: #include "bitmaps/bitmap_group_internal.h" #include "bitmaps/bitmap_drawing.h" #include "bitmaps/bitmaps.h" -#include "bitmaps/bitmaps_internal.h" -#include "bitmaps/bitmaps_mipmap.h" #include "bitmaps/bitmaps_quantitize_internal.h" #include "bitmaps/bitmap_utilities.h" #include "cache/cache_files.h" diff --git a/source/bitmaps/bitmap_group.c b/source/bitmaps/bitmap_group.c index 111f919c..f0c462f0 100644 --- a/source/bitmaps/bitmap_group.c +++ b/source/bitmaps/bitmap_group.c @@ -302,7 +302,6 @@ symbols in this file: #include "bitmaps/bitmap_group.h" #include "bitmaps/bitmaps.h" -#include "bitmaps/bitmaps_internal.h" #include "cache/cache_files.h" #include "cseries/errors.h" #include "tag_files/tag_files.h" diff --git a/source/bitmaps/bitmap_strings_internal.h b/source/bitmaps/bitmap_strings_internal.h deleted file mode 100644 index 00c72700..00000000 --- a/source/bitmaps/bitmap_strings_internal.h +++ /dev/null @@ -1,16 +0,0 @@ -/* -BITMAP_STRINGS_INTERNAL.H - -Narrow string-query interface owned by BITMAPS.C. It remains separate from -bitmaps_internal.h because January's VC7 output is declaration-position -sensitive in bitmap_group.c. -*/ - -#ifndef __BITMAP_STRINGS_INTERNAL_H -#define __BITMAP_STRINGS_INTERNAL_H -#pragma once - -char const *bitmap_type_get_string( - short type); - -#endif /* __BITMAP_STRINGS_INTERNAL_H */ diff --git a/source/bitmaps/bitmap_utilities.c b/source/bitmaps/bitmap_utilities.c index 2f32d270..f4e0662e 100644 --- a/source/bitmaps/bitmap_utilities.c +++ b/source/bitmaps/bitmap_utilities.c @@ -228,7 +228,7 @@ symbols in this file: #include "cseries.h" -#include "bitmaps/bitmaps_internal.h" +#include "bitmaps/bitmaps.h" #include "bitmaps/bitmap_utilities.h" #include "bitmaps/bitmap_group.h" #include "bitmaps/s3tc/s3tc.h" @@ -2277,9 +2277,9 @@ real real_rgb_color_brightness( color->blue * 0.114f; } -struct hsv_color *rgb_color_to_hsv_color( +union hsv_color *rgb_color_to_hsv_color( union rgb_color const *rgb, - struct hsv_color *hsv) + union hsv_color *hsv) { real red = (real)(long)rgb->red * (1.0f / 65535.0f); real green = (real)(long)rgb->green * (1.0f / 65535.0f); @@ -2367,7 +2367,7 @@ struct hsv_color *rgb_color_to_hsv_color( } union rgb_color *hsv_color_to_rgb_color( - struct hsv_color const *hsv, + union hsv_color const *hsv, union rgb_color *rgb) { real scaled_hue; diff --git a/source/bitmaps/bitmap_utilities.h b/source/bitmaps/bitmap_utilities.h index 6ecea0fb..09ca2bc8 100644 --- a/source/bitmaps/bitmap_utilities.h +++ b/source/bitmaps/bitmap_utilities.h @@ -58,11 +58,10 @@ union rgb_color }; typedef union rgb_color rgb_color; -struct hsv_color +union hsv_color { - word hue; - word saturation; - word value; + word n[3]; + struct { word hue, saturation, value; }; }; union argb_color @@ -90,11 +89,11 @@ union real_hsv_color }; }; -struct hsv_color *rgb_color_to_hsv_color( +union hsv_color *rgb_color_to_hsv_color( union rgb_color const *rgb, - struct hsv_color *hsv); + union hsv_color *hsv); union rgb_color *hsv_color_to_rgb_color( - struct hsv_color const *hsv, + union hsv_color const *hsv, union rgb_color *rgb); union real_hsv_color *real_rgb_color_to_real_hsv_color( union real_rgb_color const *rgb, diff --git a/source/bitmaps/bitmaps.c b/source/bitmaps/bitmaps.c index 8cc8efdf..6340a8ff 100644 --- a/source/bitmaps/bitmaps.c +++ b/source/bitmaps/bitmaps.c @@ -230,8 +230,6 @@ symbols in this file: #include "cseries.h" #include "bitmaps/bitmaps.h" -#include "bitmaps/bitmaps_internal.h" -#include "bitmaps/bitmaps_mipmap.h" #include "bitmaps/bitmap_group.h" #include "bitmaps/s3tc/s3tc.h" #include "cseries/errors.h" @@ -243,8 +241,6 @@ symbols in this file: enum { - NUMBER_OF_ENTRIES_IN_PALETTE = 256, - MAXIMUM_BITMAP_WIDTH = 30000, MAXIMUM_BITMAP_HEIGHT = 30000, MAXIMUM_BITMAP_DEPTH = 256, @@ -303,6 +299,9 @@ enum /* ---------- prototypes */ +long bitmap_mipmap_get_pixel_count( + struct bitmap_data *bitmap, + short mipmap_index); static boolean bitmap_format_type_valid_width( short format, short type, diff --git a/source/bitmaps/bitmaps.h b/source/bitmaps/bitmaps.h index 9eeb05f8..51406ae4 100644 --- a/source/bitmaps/bitmaps.h +++ b/source/bitmaps/bitmaps.h @@ -14,6 +14,11 @@ header included in hcex build. /* ---------- constants */ +enum +{ + NUMBER_OF_ENTRIES_IN_PALETTE = 256 +}; + /* ---------- macros */ /* ---------- structures */ @@ -22,6 +27,10 @@ struct bitmap_data; /* ---------- prototypes/BITMAPS.C */ +char const *bitmap_type_get_string( + short type); +char const *bitmap_format_get_string( + short format); void bitmap_rebuild( struct bitmap_data *bitmap); void bitmap_delete( @@ -30,15 +39,93 @@ void bitmap_delete( boolean bitmap_verify( struct bitmap_data *bitmap, boolean repair); +void bitmap_3d_slice_extract( + struct bitmap_data *bitmap, + short mipmap_index, + short slice_index, + struct bitmap_data *slice_bitmap); +void bitmap_3d_slice_insert( + struct bitmap_data *slice_bitmap, + struct bitmap_data *bitmap, + short mipmap_index, + short slice_index); +void bitmap_cube_map_face_extract( + struct bitmap_data *bitmap, + short mipmap_index, + short face_index, + struct bitmap_data *face_bitmap); +void bitmap_cube_map_face_insert( + struct bitmap_data *face_bitmap, + struct bitmap_data *bitmap, + short mipmap_index, + short face_index); short bitmap_format_get_bits_per_pixel( short format); +struct bitmap_data *bitmap_2d_new( + short width, + short height, + short mipmap_count, + short format); +struct bitmap_data *bitmap_3d_new( + short width, + short height, + short depth, + short mipmap_count, + short format); +struct bitmap_data *bitmap_cube_map_new( + short width, + short mipmap_count, + short format); void *bitmap_2d_address( struct bitmap_data *bitmap, short x, short y, short mipmap_index); +void *bitmap_3d_address( + struct bitmap_data *bitmap, + short x, + short y, + short z, + short mipmap_index); +void *bitmap_cube_map_address( + struct bitmap_data *bitmap, + short x, + short y, + short face_index, + short mipmap_index); +void *bitmap_mipmap_address( + struct bitmap_data *bitmap, + short mipmap_index); +pixel32 bitmap_format_to_a8r8g8b8( + short format, + void const *mipmap_address, + long pixel_index); +byte palette_find_closest_match( + pixel32 const *palette, + pixel32 color); +short bitmap_get_max_mipmap_count( + struct bitmap_data *bitmap); +long bitmap_get_pixel_count( + struct bitmap_data *bitmap); +long bitmap_get_pixel_data_size( + struct bitmap_data *bitmap); +short bitmap_mipmap_get_width( + struct bitmap_data *bitmap, + short mipmap_index); +short bitmap_mipmap_get_height( + struct bitmap_data *bitmap, + short mipmap_index); +short bitmap_mipmap_get_depth( + struct bitmap_data *bitmap, + short mipmap_index); +long bitmap_mipmap_get_pixel_data_size( + struct bitmap_data *bitmap, + short mipmap_index); +long bitmap_mipmap_get_row_pitch( + struct bitmap_data *bitmap, + short mipmap_index); /* ---------- prototypes/BITMAPS_QUANTITIZE.C */ @@ -75,6 +162,8 @@ union real_rgb_color *rgb_colors_interpolate_and_scale( /* ---------- globals */ +extern pixel32 global_vector_palette[NUMBER_OF_ENTRIES_IN_PALETTE]; + /* ---------- public code */ #endif // __BITMAPS_H diff --git a/source/bitmaps/bitmaps_internal.h b/source/bitmaps/bitmaps_internal.h deleted file mode 100644 index 7b84c2fb..00000000 --- a/source/bitmaps/bitmaps_internal.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -BITMAPS_INTERNAL.H - -Narrow cross-translation-unit interface owned by BITMAPS.C. -*/ - -#ifndef __BITMAPS_INTERNAL_H -#define __BITMAPS_INTERNAL_H -#pragma once - -#include "bitmaps/bitmaps.h" - -extern pixel32 global_vector_palette[]; - -char const *bitmap_format_get_string( - short format); -pixel32 bitmap_format_to_a8r8g8b8( - short format, - void const *mipmap_address, - long pixel_index); -byte palette_find_closest_match( - pixel32 const *palette, - pixel32 color); -void *bitmap_3d_address( - struct bitmap_data *bitmap, - short x, - short y, - short z, - short mipmap_index); -void *bitmap_mipmap_address( - struct bitmap_data *bitmap, - short mipmap_index); -short bitmap_mipmap_get_width( - struct bitmap_data *bitmap, - short mipmap_index); -short bitmap_mipmap_get_height( - struct bitmap_data *bitmap, - short mipmap_index); -long bitmap_get_pixel_count( - struct bitmap_data *bitmap); -long bitmap_get_pixel_data_size( - struct bitmap_data *bitmap); -struct bitmap_data *bitmap_2d_new( - short width, - short height, - short mipmap_count, - short format); -struct bitmap_data *bitmap_3d_new( - short width, - short height, - short depth, - short mipmap_count, - short format); -struct bitmap_data *bitmap_cube_map_new( - short width, - short mipmap_count, - short format); -void bitmap_3d_slice_extract( - struct bitmap_data *bitmap, - short mipmap_index, - short slice_index, - struct bitmap_data *slice_bitmap); -void bitmap_3d_slice_insert( - struct bitmap_data *slice_bitmap, - struct bitmap_data *bitmap, - short mipmap_index, - short slice_index); -void bitmap_cube_map_face_extract( - struct bitmap_data *bitmap, - short mipmap_index, - short face_index, - struct bitmap_data *face_bitmap); -void bitmap_cube_map_face_insert( - struct bitmap_data *face_bitmap, - struct bitmap_data *bitmap, - short mipmap_index, - short face_index); - -#endif /* __BITMAPS_INTERNAL_H */ diff --git a/source/bitmaps/bitmaps_mipmap.h b/source/bitmaps/bitmaps_mipmap.h deleted file mode 100644 index 38b8391d..00000000 --- a/source/bitmaps/bitmaps_mipmap.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -BITMAPS_MIPMAP.H - -Narrow cross-translation-unit mipmap interface owned by BITMAPS.C. -*/ - -#ifndef __BITMAPS_MIPMAP_H -#define __BITMAPS_MIPMAP_H -#pragma once - -/* ---------- structures */ - -struct bitmap_data; - -/* ---------- prototypes/BITMAPS.C */ - -void *bitmap_mipmap_address( - struct bitmap_data *bitmap, - short mipmap_index); -void *bitmap_cube_map_address( - struct bitmap_data *bitmap, - short x, - short y, - short face_index, - short mipmap_index); -short bitmap_mipmap_get_width( - struct bitmap_data *bitmap, - short mipmap_index); -short bitmap_mipmap_get_height( - struct bitmap_data *bitmap, - short mipmap_index); -short bitmap_mipmap_get_depth( - struct bitmap_data *bitmap, - short mipmap_index); -long bitmap_mipmap_get_pixel_count( - struct bitmap_data *bitmap, - short mipmap_index); -long bitmap_mipmap_get_pixel_data_size( - struct bitmap_data *bitmap, - short mipmap_index); -long bitmap_mipmap_get_row_pitch( - struct bitmap_data *bitmap, - short mipmap_index); -short bitmap_get_max_mipmap_count( - struct bitmap_data *bitmap); - -#endif /* __BITMAPS_MIPMAP_H */ diff --git a/source/bitmaps/targa_file.c b/source/bitmaps/targa_file.c index 15b67b41..a7316895 100644 --- a/source/bitmaps/targa_file.c +++ b/source/bitmaps/targa_file.c @@ -25,6 +25,7 @@ symbols in this file: #include "cseries.h" #include "bitmaps/bitmap_group.h" +#include "bitmaps/bitmaps.h" #include "tag_files/files.h" /* ---------- constants */ @@ -59,8 +60,6 @@ struct targa_header /* ---------- prototypes */ -void *bitmap_2d_address(struct bitmap_data *bitmap, short x, short y, short mipmap_index); - /* ---------- globals */ /* ---------- public code */ diff --git a/source/bitmaps/tiff_file.c b/source/bitmaps/tiff_file.c index 52a1268e..99162a29 100644 --- a/source/bitmaps/tiff_file.c +++ b/source/bitmaps/tiff_file.c @@ -48,7 +48,6 @@ symbols in this file: #include "bitmaps/bitmaps.h" #include "bitmaps/bitmap_group.h" -#include "bitmaps/bitmaps_internal.h" #include "bitmaps/libtiff/tiffio.h" #include "bitmaps/tiff_file.h" #include "math/integer_math.h" diff --git a/source/bungie_net/common/public_key_crypt.c b/source/bungie_net/common/public_key_crypt.c index c2968414..43538070 100644 --- a/source/bungie_net/common/public_key_crypt.c +++ b/source/bungie_net/common/public_key_crypt.c @@ -37,8 +37,10 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "cseries/errors.h" #include "bungie_net/common/64bit_math.h" #include "bungie_net/common/public_key_crypt.h" +#include "bungie_net/common/prime_numbers.h" #include "bungie_net/common/random_numbers.h" #include "memory/byte_swapping.h" @@ -50,9 +52,6 @@ symbols in this file: /* ---------- prototypes */ -unsigned long randomprime( - unsigned long maximum); - static unsigned long x_exp_y_mod_n( unsigned long base, unsigned long exponent, diff --git a/source/bungie_net/common/random_numbers.c b/source/bungie_net/common/random_numbers.c index b6aaa990..2af9428e 100644 --- a/source/bungie_net/common/random_numbers.c +++ b/source/bungie_net/common/random_numbers.c @@ -25,6 +25,8 @@ symbols in this file: #include "cseries.h" #include "bungie_net/common/random_numbers.h" +#include + /* ---------- constants */ /* ---------- macros */ diff --git a/source/bungie_net/network/transport_endpoint.h b/source/bungie_net/network/transport_endpoint.h index 7b784580..1be87380 100644 --- a/source/bungie_net/network/transport_endpoint.h +++ b/source/bungie_net/network/transport_endpoint.h @@ -116,9 +116,6 @@ short delete_endpoint_set( struct transport_endpoint_set *set); void delete_transport_endpoint( struct transport_endpoint *endpoint); -void transport_get_nonce( - void *nonce, - long nonce_length); char const *winsock_error_to_string( long error); diff --git a/source/cache/cache_file_precaching.h b/source/cache/cache_file_precaching.h deleted file mode 100644 index 8399c04e..00000000 --- a/source/cache/cache_file_precaching.h +++ /dev/null @@ -1,14 +0,0 @@ -/* -CACHE_FILE_PRECACHING.H -*/ - -#ifndef __CACHE_FILE_PRECACHING_H -#define __CACHE_FILE_PRECACHING_H -#pragma once - -/* ---------- prototypes/CACHE_FILES.C */ - -boolean cache_files_give_time_to_precache( - char const *map_name); - -#endif /* __CACHE_FILE_PRECACHING_H */ diff --git a/source/cache/cache_files.c b/source/cache/cache_files.c index f555e271..36cea03e 100644 --- a/source/cache/cache_files.c +++ b/source/cache/cache_files.c @@ -130,6 +130,8 @@ symbols in this file: #include "cache_files.h" #include "physical_memory_map.h" #include "sound_cache.h" +#include "texture_cache.h" +#include "interface/ui_widget.h" #include "scenario/scenario_definitions.h" #include "sound/sound_manager.h" @@ -219,14 +221,6 @@ typedef char verify_cache_file_header_size[ static struct cache_file_tag_instance *cache_get_tag_instance( long tag_index); -void texture_cache_close( - void); -void display_error_damaged_media( - void); -void texture_cache_open( - void); -void sound_idle( - void); /* ---------- globals */ diff --git a/source/cache/cache_files.h b/source/cache/cache_files.h index da7339d0..ae526fb3 100644 --- a/source/cache/cache_files.h +++ b/source/cache/cache_files.h @@ -51,6 +51,8 @@ boolean cache_file_header_verify( struct cache_file_header *header, char const *scenario_name, boolean fatal); +boolean cache_files_give_time_to_precache( + char const *map_name); unsigned long cache_files_get_checksum( void); diff --git a/source/cache/cache_files_decompress_windows.c b/source/cache/cache_files_decompress_windows.c index d0499859..57b2fe38 100644 --- a/source/cache/cache_files_decompress_windows.c +++ b/source/cache/cache_files_decompress_windows.c @@ -455,9 +455,6 @@ static void cache_copy_block_on_raw_write( struct simple_decompressor_definition *self); static void cache_copy_wait_for_async_io( struct simple_decompressor_definition *self); -struct cache_copy_read_request *acquire_read_request( - struct simple_decompressor_definition *self, - short read_sequence_index); static void cache_copy_issue_read( struct simple_decompressor_definition *self, void *buffer, diff --git a/source/cache/predicted_resources.c b/source/cache/predicted_resources.c index a5cc89da..d784c8ab 100644 --- a/source/cache/predicted_resources.c +++ b/source/cache/predicted_resources.c @@ -14,6 +14,7 @@ symbols in this file: #include "cache/predicted_resources.h" #include "cache/sound_cache.h" #include "bitmaps/bitmap_group.h" +#include "cache/texture_cache.h" #include "sound/sound_definitions.h" #include "tag_files/tag_groups.h" @@ -25,11 +26,6 @@ symbols in this file: /* ---------- prototypes */ -void *_texture_cache_bitmap_get_hardware_format( - struct bitmap_data *bitmap, - boolean block, - boolean load); - static void predicted_resources_sound_precache(long sound_definition_index); /* ---------- globals */ diff --git a/source/cache/texture_cache.h b/source/cache/texture_cache.h index 7014f9ae..2ca17399 100644 --- a/source/cache/texture_cache.h +++ b/source/cache/texture_cache.h @@ -28,12 +28,18 @@ void texture_cache_bitmap_delete( struct bitmap_data *bitmap); void texture_cache_new( void); +void texture_cache_close( + void); void texture_cache_delete( void); +void texture_cache_open( + void); void texture_cache_idle( void); void texture_cache_return_memory( void); +void texture_cache_flush( + void); void *texture_cache_steal_memory( long size); void texture_cache_debug_render( diff --git a/source/cache/xbox_sound_cache.c b/source/cache/xbox_sound_cache.c index 4417f434..a7ec2126 100644 --- a/source/cache/xbox_sound_cache.c +++ b/source/cache/xbox_sound_cache.c @@ -93,7 +93,9 @@ symbols in this file: /* ---------- headers */ #include "cseries/cseries.h" +#include "cseries/cseries_windows.h" #include "cseries/errors.h" +#include "cache/cache_files.h" #include "cache/physical_memory_map.h" #include "cache/sound_cache.h" #include "interface/terminal.h" diff --git a/source/cache/xbox_texture_cache.c b/source/cache/xbox_texture_cache.c index 672a3ce5..8d6553ee 100644 --- a/source/cache/xbox_texture_cache.c +++ b/source/cache/xbox_texture_cache.c @@ -98,11 +98,9 @@ symbols in this file: #include "cseries/errors.h" #include "cseries/sort.h" #include "bitmaps/bitmap_group.h" -#include "bitmaps/bitmaps_internal.h" -#include "bitmaps/bitmaps_mipmap.h" +#include "bitmaps/bitmaps.h" #include "cache/cache_files.h" #include "cache/texture_cache.h" -#include "cache/xbox_texture_cache.h" #include "cache/physical_memory_map.h" #include "interface/interface.h" #include "interface/terminal.h" @@ -262,6 +260,12 @@ static void texture_cache_delete_block_proc( long block_index); static const char *texture_cache_name_block_proc( long block_index); +long bitmap_format_to_d3d_format( + short format, + word flags); +long bitmap_format_to_d3d_linear_format( + short format, + word flags); static boolean compare( struct bitmap_data *first, struct bitmap_data *second); diff --git a/source/cache/xbox_texture_cache.h b/source/cache/xbox_texture_cache.h deleted file mode 100644 index dea6cafa..00000000 --- a/source/cache/xbox_texture_cache.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -XBOX_TEXTURE_CACHE.H - -focused owner header for the xbox_texture_cache.c bitmap-format-to-D3D mapping -routines that the platform-neutral texture_cache.h does not declare; adding them -to texture_cache.h regresses exact consumers through declaration-count -sensitivity. -*/ - -#ifndef __XBOX_TEXTURE_CACHE_H -#define __XBOX_TEXTURE_CACHE_H -#pragma once - -/* ---------- headers */ - -#include "cseries/cseries.h" - -/* ---------- prototypes/XBOX_TEXTURE_CACHE.C */ - -long bitmap_format_to_d3d_format( - short format, - word flags); -long bitmap_format_to_d3d_linear_format( - short format, - word flags); - -#endif // __XBOX_TEXTURE_CACHE_H diff --git a/source/camera/bored_camera.c b/source/camera/bored_camera.c index 48620e27..710e6834 100644 --- a/source/camera/bored_camera.c +++ b/source/camera/bored_camera.c @@ -39,7 +39,7 @@ symbols in this file: #include "bored_camera.h" #include "camera/static_camera.h" #include "cseries/cseries_windows.h" -#include "game/player_control.h" +#include "game/players.h" #include "math/real_math.h" #include "units/unit_definitions.h" #include "units/units.h" @@ -67,15 +67,6 @@ typedef char unit_camera_track_size_assert[ /* ---------- prototypes */ -unsigned long *get_global_local_random_seed_address( - void); -float real_seed_random_range( - unsigned long *seed, - float lower_bound, - float upper_bound); -long player_control_get_aiming_unit_index( - short local_player_index); - static long bored_camera_shot_threshold_milliseconds( long boredom_count); static long bored_camera_shot_duration_milliseconds( diff --git a/source/camera/camera_scripting.c b/source/camera/camera_scripting.c index d69dae3f..6166ae5f 100644 --- a/source/camera/camera_scripting.c +++ b/source/camera/camera_scripting.c @@ -137,8 +137,6 @@ void scripted_camera_set( short camera_point_index, word transition_time, long relative_object_index); -void observer_update( - real dt); void first_person_camera_fake( long unit_index, struct scripted_camera_command *result); diff --git a/source/camera/camera_scripting.h b/source/camera/camera_scripting.h index 18445b1a..a677c51e 100644 --- a/source/camera/camera_scripting.h +++ b/source/camera/camera_scripting.h @@ -28,6 +28,22 @@ union real_vector3d; void scripted_camera_enable( boolean enabled); +void scripted_camera_set_animation( + long animation_graph_index, + char const *animation_name); +void scripted_camera_set_first_person( + long object_index); +void scripted_camera_set_dead( + long object_index); +boolean scripted_camera_object_is_first_person_camera( + long object_index); +void scripted_camera_set( + short camera_point_index, + word transition_time, + long relative_object_index); +void scripted_camera_set_absolute( + short camera_point_index, + word transition_time); void scripted_camera_set_camera_point_relative( union real_point3d const *position, union real_vector3d const *forward, @@ -35,6 +51,8 @@ void scripted_camera_set_camera_point_relative( real field_of_view, word transition_time, long relative_object_index); +short scripted_camera_time( + void); void scripted_camera_update( struct dead_camera *camera, struct camera_control const *controls, diff --git a/source/camera/director.c b/source/camera/director.c index 158f6278..b835a2f3 100644 --- a/source/camera/director.c +++ b/source/camera/director.c @@ -129,7 +129,6 @@ symbols in this file: #include "orbiting_camera.h" #include "editor/editor_stubs.h" -#include "game/player_control.h" #include "game/players.h" #include "input/input.h" #include "main/console.h" diff --git a/source/camera/editor_flying_camera.c b/source/camera/editor_flying_camera.c index b0f4c9d4..70220548 100644 --- a/source/camera/editor_flying_camera.c +++ b/source/camera/editor_flying_camera.c @@ -91,7 +91,8 @@ symbols in this file: #include "flying_camera.h" #include "camera_scripting.h" #include "director.h" -#include "game/player_control.h" +#include "game/players.h" +#include "interface/terminal.h" #include "main/console.h" #include "observer.h" #include "static_camera.h" diff --git a/source/camera/first_person_camera.c b/source/camera/first_person_camera.c index 252d1422..dd1b95d9 100644 --- a/source/camera/first_person_camera.c +++ b/source/camera/first_person_camera.c @@ -26,6 +26,7 @@ symbols in this file: #include "observer.h" #include "static_camera.h" +#include "game/players.h" #include "objects/objects.h" #include "units/unit_definitions.h" #include "units/units.h" @@ -54,14 +55,6 @@ struct first_person_camera_result /* ---------- prototypes */ -long player_control_get_unit_index( - short local_player_index); -void player_control_get_facing_direction( - short local_player_index, - real_vector3d *facing_direction); -real player_control_get_field_of_view( - short local_player_index); - static void first_person_camera_for_unit_and_vector( long unit_index, real_vector3d const *forward, diff --git a/source/camera/flying_camera.c b/source/camera/flying_camera.c index 4a5b9e85..a324216a 100644 --- a/source/camera/flying_camera.c +++ b/source/camera/flying_camera.c @@ -17,6 +17,7 @@ symbols in this file: #include "flying_camera.h" #include "observer.h" #include "static_camera.h" +#include "rasterizer/rasterizer_console_vars.h" /* ---------- constants */ @@ -24,19 +25,10 @@ symbols in this file: /* ---------- structures */ -struct rasterizer_debug_options -{ - byte reserved[0x5E]; - short flying_camera_reset_ticks; - byte trailing[8]; -}; - /* ---------- prototypes */ /* ---------- globals */ -extern struct rasterizer_debug_options rasterizer_debug_options; - /* ---------- public code */ void flying_camera_new( @@ -81,12 +73,12 @@ void flying_camera_update( camera->roll += controls->facing_delta.roll; } - if (rasterizer_debug_options.flying_camera_reset_ticks > 0) + if (rasterizer_debug_options.freeze_flying_camera > 0) { camera->facing.yaw = 0.f; camera->facing.pitch = 0.f; camera->roll = 0.f; - rasterizer_debug_options.flying_camera_reset_ticks--; + rasterizer_debug_options.freeze_flying_camera--; } result->timer = 0.3f; diff --git a/source/camera/following_camera.c b/source/camera/following_camera.c index 2ef4fa92..6d75c468 100644 --- a/source/camera/following_camera.c +++ b/source/camera/following_camera.c @@ -46,7 +46,7 @@ symbols in this file: #include "static_camera.h" #include "game/game_globals.h" -#include "game/player_control.h" +#include "game/players.h" #include "objects/objects.h" #include "scenario/scenario.h" #include "tag_files/tag_groups.h" diff --git a/source/cseries/debug_memory.c b/source/cseries/debug_memory.c index ccf6fe50..0e1b1fb1 100644 --- a/source/cseries/debug_memory.c +++ b/source/cseries/debug_memory.c @@ -167,10 +167,6 @@ struct file_pointer_totals /* ---------- prototypes */ -unsigned long *get_global_local_random_seed_address( - void); -word seed_random( - unsigned long *seed); static int compare_file_pointer_totals( const void *a, const void *b); diff --git a/source/cseries/errors.c b/source/cseries/errors.c index d5726e3e..4d8e5358 100644 --- a/source/cseries/errors.c +++ b/source/cseries/errors.c @@ -172,7 +172,7 @@ void write_to_error_file( return; } -void reset_error_state( +static void reset_error_state( void) { error_globals.delayed = FALSE; @@ -186,8 +186,7 @@ void errors_initialize( { error_globals.output_to_debug_file = TRUE; error_globals.overflow_suppression = TRUE; - error_globals.delayed = FALSE; - error_globals.message_buffer_size = 0; + reset_error_state(); stack_walk_initialize(); return; @@ -323,8 +322,7 @@ boolean errors_handle( { boolean delayed = error_globals.delayed; - error_globals.delayed = FALSE; - error_globals.message_buffer_size = 0; + reset_error_state(); return delayed; } @@ -332,8 +330,7 @@ boolean errors_handle( void errors_clear( void) { - error_globals.delayed = FALSE; - error_globals.message_buffer_size = 0; + reset_error_state(); return; } diff --git a/source/cseries/profile.c b/source/cseries/profile.c index 9f61b425..b3084365 100644 --- a/source/cseries/profile.c +++ b/source/cseries/profile.c @@ -1589,7 +1589,7 @@ int compare_profile_sections( { struct profile_section *const *first = (struct profile_section *const *)section0; struct profile_section *const *second = (struct profile_section *const *)section1; - int result = 0; + int result; if ((*first)->active && !(*second)->active) { @@ -1620,6 +1620,8 @@ int compare_profile_sections( result = -1; else if (first_averagerecent_elapsed_timebase<(*second)->recent_elapsed_timebase) result = 1; + else + result = 0; break; default: match_assert("c:\\halo\\SOURCE\\cseries\\profile.c", 844, !"unreachable"); + /* BUG (original, preserved for exact matching): this arm leaves result + * unassigned, and January returns it after the fatal assertion: 0x47e840 +0x61 mov eax,[ebp+8] + * reads the dead first-parameter home. The Sept-25-2001 build is identical; the Aug-15-2001 + * build reads its uninitialised [ebp-4] slot the same way. The later /Od+/RTC build attests the + * uninitialised declaration: its single exit calls _RTC_UninitUse("result"). + * The arm is unreachable in defined execution. compare_type is written only by profile_dump, + * after its sort_mode range assertion; January's two profile_dump callers pass 0/1 and 2; and + * each of the NUMBER_OF_PROFILE_SORT_MODES (3) modes has a case above that assigns result. + * Were the arm entered, display_assert returns into an unconditional system_exit, which never + * returns: halt_and_catch_fire loops, or calls exit() on re-entry. So the uninitialised return + * is not executed in January. A corrected build assigns result in this arm. */ break; } } diff --git a/source/cseries/profile.h b/source/cseries/profile.h index 580d390a..b9786550 100644 --- a/source/cseries/profile.h +++ b/source/cseries/profile.h @@ -173,6 +173,10 @@ real profile_frame_get_value( struct profile_frame_iterator *iterator, short frame_value, short section_index); +void profile_sections_activate( + char const *section_name); +void profile_sections_deactivate( + char const *section_name); void profile_seconds_elapsed( real seconds); void profile_texture_start( diff --git a/source/cutscene/cinematics.c b/source/cutscene/cinematics.c index 43e41ba9..0184ff1e 100644 --- a/source/cutscene/cinematics.c +++ b/source/cutscene/cinematics.c @@ -120,10 +120,6 @@ typedef char verify_hud_global_default_title_bounds_offset[ /* ---------- prototypes */ -void draw_quad( - rectangle2d *rectangle, - pixel32 color); - /* ---------- globals */ struct cinematic_global_data *cinematic_globals = NULL; diff --git a/source/cutscene/recorded_animations.h b/source/cutscene/recorded_animations.h index 2f76c780..54250dde 100644 --- a/source/cutscene/recorded_animations.h +++ b/source/cutscene/recorded_animations.h @@ -18,6 +18,10 @@ header included in hcex build. void recorded_animations_initialize( void); +void recorded_animations_dispose( + void); +void recorded_animations_dispose_from_old_map( + void); void recorded_animations_initialize_for_new_map( void); void recorded_animations_update( @@ -27,6 +31,10 @@ void recorded_animations_clear_debug_storage( boolean recorded_animation_controlling_unit( long unit_index); +void recorded_animation_kill( + long unit_index); +long recorded_animation_get_time_left( + long unit_index); boolean recorded_animation_play( long unit_index, diff --git a/source/devices/device_light_fixtures.h b/source/devices/device_light_fixtures.h index 7e2869e7..be01e0ab 100644 --- a/source/devices/device_light_fixtures.h +++ b/source/devices/device_light_fixtures.h @@ -60,6 +60,21 @@ struct light_fixture_datum /* ---------- prototypes/DEVICE_LIGHT_FIXTURES.C */ +void light_fixtures_initialize( + void); +void light_fixtures_dispose( + void); +void light_fixtures_initialize_for_new_map( + void); +void light_fixtures_dispose_from_old_map( + void); +boolean light_fixture_new( + long object_index); +void light_fixture_delete( + long object_index); +boolean light_fixture_update( + long object_index); + /* ---------- globals */ /* ---------- public code */ diff --git a/source/devices/device_machines.c b/source/devices/device_machines.c index df26e3c8..2d09966d 100644 --- a/source/devices/device_machines.c +++ b/source/devices/device_machines.c @@ -30,6 +30,7 @@ symbols in this file: #include "device_machines.h" #include "game/game.h" +#include "game/game_allegiance.h" #include "memory/data.h" #include "units/bipeds.h" #include "units/unit_definitions.h" @@ -66,9 +67,6 @@ struct device_group_datum /* ---------- prototypes */ -boolean game_team_is_enemy( - short team_index0, - short team_index1); /* ---------- globals */ /* ---------- public code */ diff --git a/source/devices/devices.h b/source/devices/devices.h index 9b359258..591443f4 100644 --- a/source/devices/devices.h +++ b/source/devices/devices.h @@ -82,8 +82,18 @@ struct machine_datum /* ---------- prototypes/DEVICES.C */ +void devices_initialize( + void); +void devices_initialize_for_new_map( + void); +void device_delete( + long object_index); void devices_dispose( void); +void devices_dispose_from_old_map( + void); +boolean device_new( + long object_index); void device_add_scenario_information( long object_index, struct scenario_device_datum *scenario_device); @@ -98,6 +108,9 @@ real device_get_power( void device_set_never_appears_locked( long device_index, boolean never_locked); +void device_group_set_actual_value( + short group_index, + real actual_value); void device_one_sided_set( long device_index, boolean one_sided); @@ -107,6 +120,12 @@ void device_operates_automatically_set( void device_set_actual_position( long device_index, real position); +boolean device_set_desired_position( + long device_index, + real position); +void device_set_power( + long device_index, + real power); boolean device_group_set_desired_value( short group_index, real desired_value); diff --git a/source/editor/editor_stubs.c b/source/editor/editor_stubs.c index eb861c52..f8b06e27 100644 --- a/source/editor/editor_stubs.c +++ b/source/editor/editor_stubs.c @@ -22,7 +22,8 @@ boolean game_in_editor( } boolean editor_preprocess_rendered_object( - void) + long object_index, + struct render_lighting *lighting) { return TRUE; } diff --git a/source/editor/editor_stubs.h b/source/editor/editor_stubs.h index c85760d2..bbe88531 100644 --- a/source/editor/editor_stubs.h +++ b/source/editor/editor_stubs.h @@ -6,11 +6,15 @@ EDITOR_STUBS.H #define __EDITOR_STUBS_H #pragma once +/* ---------- structures */ + +struct render_lighting; + /* ---------- prototypes/EDITOR_STUBS.C */ void editor_render(void); boolean game_in_editor(void); -boolean editor_preprocess_rendered_object(void); +boolean editor_preprocess_rendered_object(long object_index, struct render_lighting *lighting); boolean editor_should_exit(void); void editor_initialize(void); void editor_dispose(void); diff --git a/source/effects/decals.c b/source/effects/decals.c index 148c7c73..9071b9ad 100644 --- a/source/effects/decals.c +++ b/source/effects/decals.c @@ -212,12 +212,10 @@ symbols in this file: /* ---------- headers */ -#define plane2d_from_points plane2d_from_points_inline #include "effects/decals.h" #include "cseries/cseries.h" #include "math/real_math.h" #include "physics/collision_bsp_definitions.h" -#undef plane2d_from_points #include "cseries/errors.h" #include "game/game.h" @@ -233,7 +231,7 @@ symbols in this file: #include "bitmaps/bitmaps.h" #include "cache/texture_cache.h" #include "effects/decal_definitions.h" -#include "rasterizer/rasterizer_debug_options.h" +#include "rasterizer/rasterizer_console_vars.h" #include "render/render.h" #include "render/render_debug.h" #include "saved games/game_state.h" @@ -810,26 +808,6 @@ static void decal_sprite_get_bounds( return; } -real_plane2d *plane2d_from_points( - real_plane2d *plane, - real_point2d const *point0, - real_point2d const *point1) -{ - plane->n.i = point1->y - point0->y; - plane->n.j = point0->x - point1->x; - - if (normalize2d(&plane->n) == 0.0f) - { - plane->d = 0.0f; - - return NULL; - } - - plane->d = dot_product2d((real_vector2d *)point0, &plane->n); - - return plane; -} - pixel32 real_a_rgb_color_to_pixel32( real alpha, real_rgb_color const *color) diff --git a/source/effects/effects.c b/source/effects/effects.c index 95bd0808..6b5232ce 100644 --- a/source/effects/effects.c +++ b/source/effects/effects.c @@ -2596,7 +2596,7 @@ static boolean effect_allowed_by_environment( struct location const *location, real_point3d const *world_point) { - boolean allowed = FALSE; + boolean allowed; switch (environment) { @@ -2613,6 +2613,7 @@ static boolean effect_allowed_by_environment( break; case _effect_environment_vacuum: + allowed = FALSE; break; default: @@ -2621,6 +2622,16 @@ static boolean effect_allowed_by_environment( 888, FALSE, NULL); + /* BUG (original, preserved for exact matching): this arm leaves allowed + * unassigned, and January returns it after the fatal assertion: 0x48b160 +0x5f mov al,[ebp-1] + * reads the never-written byte slot. The later /Od+/RTC build attests the uninitialised + * declaration: its single exit calls _RTC_UninitUse("allowed"). + * The read is not executed in January: display_assert returns into an unconditional + * system_exit, which never returns (it jumps to halt_and_catch_fire, which loops, or calls + * _exit on re-entry), and no other path reaches the read. The arm itself is entered only for + * an environment value outside the four cases above, each of which assigns allowed; the + * value comes from effect tag data, so this arm is not proven unreachable. A corrected build + * assigns allowed in this arm. */ break; } diff --git a/source/effects/player_effects.c b/source/effects/player_effects.c index 691705b3..2c00b34a 100644 --- a/source/effects/player_effects.c +++ b/source/effects/player_effects.c @@ -91,11 +91,10 @@ symbols in this file: #include "camera/observer.h" #include "game/game.h" #include "game/game_globals.h" -#include "game/player_control.h" #include "game/player_rumble.h" #include "game/players.h" #include "math/periodic_functions.h" -#include "math/random_math.h" +#include "math/real_math.h" #include "main/console.h" #include "networking/network_connection.h" #include "objects/damage.h" diff --git a/source/game/aim_assist.c b/source/game/aim_assist.c index 7cfd4370..dd5c80fa 100644 --- a/source/game/aim_assist.c +++ b/source/game/aim_assist.c @@ -50,7 +50,6 @@ symbols in this file: #include "game/game.h" #include "game/game_allegiance.h" #include "game/game_globals.h" -#include "game/player_control.h" #include "game/players.h" #include "math/real_math_cones.h" #include "items/weapon_definitions.h" @@ -114,12 +113,6 @@ static void object_compute_autoaim_target( real_point3d const *position, real_vector3d const *direction, real_point3d *target); -boolean aim_assist_compute_target( - struct aim_assist_parameters const *parameters, - long object_index, - real_point3d const *position, - real_vector3d const *direction, - struct aim_assist_target *target); static short find_aim_assist_targets_recursive( struct aim_assist_parameters const *parameters, long object_index, @@ -141,13 +134,6 @@ static short find_aim_assist_targets( short ignore_team_index, short maximum_target_count, struct aim_assist_target *targets); -boolean aim_assist( - struct aim_assist_parameters const *parameters, - real_point3d const *position, - real_vector3d const *direction, - long ignore_object_index, - short ignore_team_index, - struct aim_assist_target *target); /* ---------- globals */ diff --git a/source/game/cheats.c b/source/game/cheats.c index 796cb41d..7980ae57 100644 --- a/source/game/cheats.c +++ b/source/game/cheats.c @@ -49,6 +49,7 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "cseries/errors.h" #include "cheats.h" #include "cache/cache_files.h" #include "camera/director.h" diff --git a/source/game/cheats.h b/source/game/cheats.h index 895881fd..692da5dd 100644 --- a/source/game/cheats.h +++ b/source/game/cheats.h @@ -34,12 +34,26 @@ void cheats_initialize( void); void cheats_initialize_for_new_map( void); +void cheat_teleport_to_camera( + void); +void cheat_active_camouflage( + void); +void cheat_all_weapons( + void); +void cheat_all_powerups( + void); +void cheat_all_vehicles( + void); void cheats_dispose( void); void cheats_dispose_from_old_map( void); void cheats_update( void); +void cheats_load( + void); +void cheat_active_camouflage_local_player( + short player_index); /* ---------- globals */ diff --git a/source/game/game.c b/source/game/game.c index ae9cd329..4adf61a3 100644 --- a/source/game/game.c +++ b/source/game/game.c @@ -123,7 +123,6 @@ struct game_options; #include "game/game.h" #undef set_random_seed #include "ai/ai.h" -#include "ai/ai_runtime.h" #include "bink/bink_playback.h" #include "bungie_net/network/transport.h" #include "cache/cache_files.h" @@ -144,8 +143,6 @@ struct game_options; #include "game/cheats.h" #include "game/game_allegiance.h" #include "game/game_engine.h" -#include "game/game_engine_runtime.h" -#include "game/player_control.h" #include "game/player_queues_new.h" #include "game/player_rumble.h" #include "game/players.h" @@ -162,20 +159,22 @@ struct game_options; #include "items/projectiles.h" #include "main/main.h" #include "main/console.h" -#include "math/random_math.h" #include "math/real_math.h" #include "memory/data.h" #include "networking/network_messages.h" #include "networking/telnet_console.h" #include "objects/objects.h" +#include "objects/widgets/widgets.h" #include "physics/breakable_surfaces.h" #include "physics/collision_usage.h" #include "physics/point_physics.h" +#include "rasterizer/common/rasterizer_common.h" #include "rasterizer/rasterizer.h" #include "render/render.h" #include "saved games/game_state.h" #include "saved games/saved_game_files.h" #include "scenario/scenario.h" +#include "shaders/shaders.h" #include "sound/game_sound.h" #include "sound/sound_classes.h" #include "sound/sound_manager.h" @@ -226,134 +225,6 @@ typedef char verify_game_runtime_globals_difficulty_offset[ /* ---------- prototypes */ -void game_engine_game_starting( - void); - -void game_engine_player_added( - long player_index); - -void recorded_animations_dispose( - void); -void cinematic_dispose( - void); -void hs_dispose( - void); -void cheats_dispose( - void); -void ui_widgets_dispose( - void); -void editor_dispose( - void); -void player_effect_dispose( - void); -void rumble_dispose( - void); -void game_sound_dispose( - void); -void sound_classes_dispose( - void); -void particles_dispose( - void); -void contrails_dispose( - void); -void players_dispose( - void); -void decals_dispose( - void); -void breakable_surfaces_dispose( - void); -void structures_dispose( - void); -void render_dispose( - void); -void objects_dispose( - void); -void director_dispose( - void); -void game_allegiance_dispose( - void); -void saved_game_files_dispose( - void); -void event_manager_dispose( - void); -void input_abstraction_dispose( - void); -void player_ui_dispose( - void); -void game_state_dispose( - void); -void bink_playback_dispose( - void); -void progress_bar_dispose( - void); - -void rasterizer_dispose_from_old_map( - void); -void game_state_dispose_from_old_map( - void); -void cheats_dispose_from_old_map( - void); -void recorded_animations_dispose_from_old_map( - void); -void hs_dispose_from_old_map( - void); -void cinematic_dispose_from_old_map( - void); -void editor_dispose_from_old_map( - void); -void ai_dispose_from_old_map( - void); -void player_effect_dispose_from_old_map( - void); -void rumble_dispose_from_old_map( - void); -void point_physics_dispose_from_old_map( - void); -void decals_dispose_from_old_map( - void); -void breakable_surfaces_dispose_from_old_map( - void); -void structures_dispose_from_old_map( - void); -void render_dispose_from_old_map( - void); -void objects_dispose_from_old_map( - void); -void director_dispose_from_old_map( - void); -void observer_dispose_from_old_map( - void); -void players_dispose_from_old_map( - void); -void contrails_dispose_from_old_map( - void); -void particles_dispose_from_old_map( - void); -void game_sound_dispose_from_old_map( - void); -void sound_classes_dispose_from_old_map( - void); -void sound_dispose_from_old_map( - void); -void game_allegiance_dispose_from_old_map( - void); -void game_engine_dispose_from_old_map( - void); -void scenario_dispose_from_old_map( - void); -void particles_update( - real dt); -void contrails_update( - real dt); -void widgets_update( - real dt); -void scenario_frame_update( - real dt); -void rasterizer_frame_update( - real dt); -void numeric_countdown_timer_update( - void); - /* ---------- globals */ static struct game_runtime_globals_prefix *game_globals = NULL; diff --git a/source/game/game_allegiance.c b/source/game/game_allegiance.c index c4b55088..feba88c3 100644 --- a/source/game/game_allegiance.c +++ b/source/game/game_allegiance.c @@ -52,7 +52,7 @@ symbols in this file: #include "cseries/cseries.h" #include "cseries/errors.h" -#include "ai/ai_runtime.h" +#include "ai/ai.h" #include "game/game_allegiance.h" #include "saved games/game_state.h" diff --git a/source/game/game_allegiance.h b/source/game/game_allegiance.h index 10b03672..e607caeb 100644 --- a/source/game/game_allegiance.h +++ b/source/game/game_allegiance.h @@ -37,6 +37,7 @@ boolean game_team_is_enemy( boolean game_team_is_ally( short our_team_index, short other_team_index); +boolean game_team_ally_status_changed(short team_index0, short team_index1); short game_allegiance_get_incidents( short our_team_index, short other_team_index, diff --git a/source/game/game_engine.c b/source/game/game_engine.c index dc9f6180..6f10a155 100644 --- a/source/game/game_engine.c +++ b/source/game/game_engine.c @@ -543,7 +543,6 @@ symbols in this file: #include "game_engine.h" #include "game_engine_list.h" #include "game_engine_place.h" -#include "game_engine_runtime.h" #include "bitmaps/bitmap_group.h" #include "bitmaps/bitmap_group_lookup.h" @@ -570,12 +569,11 @@ symbols in this file: #include "objects.h" #include "objects/damage_effect_definitions.h" #include "physics/collision_features.h" -#include "player_control.h" #include "player_rumble.h" #include "players.h" #include "players_runtime.h" #include "rasterizer/rasterizer.h" -#include "rasterizer/rasterizer_debug_options.h" +#include "rasterizer/rasterizer_console_vars.h" #include "render/render.h" #include "saved games/player_profile.h" #include "scenario/scenario.h" @@ -825,14 +823,6 @@ static void netgame_verify_equipment( short game_type, char const *error_message); -long game_engine_did_player_win_default( - long player_index); - -void game_show_score_extended( - long player_index, - long score, - long team_index); - boolean multiple_teams_alive( void); diff --git a/source/game/game_engine.h b/source/game/game_engine.h index ffb2ba7b..dc2569d3 100644 --- a/source/game/game_engine.h +++ b/source/game/game_engine.h @@ -329,6 +329,8 @@ void game_engine_post_rasterize( void game_engine_nonplayer_post_rasterize( void); +void game_engine_update( + void); void game_engine_update_non_deterministic( real delta_seconds); @@ -337,12 +339,17 @@ boolean match_game_type( long game_type, long count, short const *game_types); +void game_engine_flag_reset( + long weapon_index, + union real_point3d const *position); void game_engine_initialize( struct game_variant *variant); void game_engine_initialize_for_new_map( void); +void game_engine_player_added( + long player_index); real game_engine_get_distance_rating_for_spawn( long player_index, @@ -385,6 +392,8 @@ void game_engine_prespawn_player_update( long game_engine_did_player_win( long player_index); +long game_engine_did_player_win_default( + long player_index); struct game_variant *game_engine_get_variant( void); @@ -395,6 +404,9 @@ struct game_variant *game_engine_get_variant_by_name( boolean game_engine_get_goal_in_use( short goal_index); +real_point3d *game_engine_get_goal_position( + real_point3d *position, + short goal_index); void game_engine_set_goal_position( short goal_index, @@ -522,6 +534,19 @@ 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); +void game_show_score_team( + long team_index, + long score); +void game_show_score_you_ally_enemy( + long player_index, + long you_score, + long ally_score, + long enemy_score, + long other_player_index); +void game_show_score_extended( + long player_index, + long score, + long team_index); long game_engine_remap_weapon(long weapon_definition_index); diff --git a/source/game/game_engine_ctf.c b/source/game/game_engine_ctf.c index 83196541..cea753f8 100644 --- a/source/game/game_engine_ctf.c +++ b/source/game/game_engine_ctf.c @@ -122,7 +122,6 @@ symbols in this file: #include "cseries/cseries_windows.h" #include "cseries/errors.h" #include "game_engine.h" -#include "game_engine_runtime.h" #include "players.h" #include "players_runtime.h" #include "items/weapons.h" @@ -232,6 +231,8 @@ typedef char verify_ctf_globals_size[ /* ---------- prototypes */ +void ctf_state_message_update_warning( + long team_index); static long ctf_create_flag_object( struct scenario_netgame_flag *flag); diff --git a/source/game/game_engine_multiplayer_sounds.c b/source/game/game_engine_multiplayer_sounds.c index 5de84930..29eb57d3 100644 --- a/source/game/game_engine_multiplayer_sounds.c +++ b/source/game/game_engine_multiplayer_sounds.c @@ -103,11 +103,6 @@ struct multiplayer_sound_queue struct queued_multiplayer_sound sounds[MAXIMUM_QUEUED_MULTIPLAYER_SOUNDS]; }; -struct multiplayer_sound_queue_count -{ - long count; -}; - struct game_globals_multiplayer_sound_view { byte unused[0x164]; @@ -115,7 +110,6 @@ struct game_globals_multiplayer_sound_view }; typedef char verify_multiplayer_sound_queue_size[sizeof(struct multiplayer_sound_queue) == 0x2C ? 1 : -1]; -typedef char verify_multiplayer_sound_queue_count_size[sizeof(struct multiplayer_sound_queue_count) == sizeof(long) ? 1 : -1]; typedef char verify_game_globals_multiplayer_information_offset[ offsetof(struct game_globals_multiplayer_sound_view, multiplayer_information) == 0x164 ? 1 : -1]; @@ -145,13 +139,10 @@ static boolean sound_is_queueable[_multiplayer_sound_ting] = TRUE, TRUE, FALSE, }; -struct multiplayer_sound_queue_count mp_sound_queue_count = { 0 }; +static long mp_sound_queue_count = 0; static struct queued_multiplayer_sound mp_sound_queue[ MAXIMUM_QUEUED_MULTIPLAYER_SOUNDS] = { 0 }; -#define multiplayer_sound_queue_count mp_sound_queue_count.count -#define multiplayer_sound_queue_sounds mp_sound_queue - /* ---------- public code */ static void _game_engine_play_multiplayer_sound( @@ -184,13 +175,11 @@ static void push_queued_sound( long sound_index, long delay_ticks) { - long queue_index = multiplayer_sound_queue_count; - - if (queue_index < MAXIMUM_QUEUED_MULTIPLAYER_SOUNDS) + if (mp_sound_queue_count < MAXIMUM_QUEUED_MULTIPLAYER_SOUNDS) { - multiplayer_sound_queue_sounds[queue_index].sound_index = sound_index; - multiplayer_sound_queue_sounds[queue_index].delay_ticks = delay_ticks; - multiplayer_sound_queue_count++; + mp_sound_queue[mp_sound_queue_count].sound_index = sound_index; + mp_sound_queue[mp_sound_queue_count].delay_ticks = delay_ticks; + mp_sound_queue_count++; } return; @@ -200,17 +189,14 @@ void game_engine_update_multiplayer_sound( void) { long i; - long queue_count = multiplayer_sound_queue_count; - if (queue_count && --multiplayer_sound_queue_sounds[0].delay_ticks == 0) + if (mp_sound_queue_count && --mp_sound_queue[0].delay_ticks == 0) { - for (i = 1; i < queue_count; i++) - multiplayer_sound_queue_sounds[i - 1] = multiplayer_sound_queue_sounds[i]; + for (i = 1; i < mp_sound_queue_count; i++) + mp_sound_queue[i - 1] = mp_sound_queue[i]; - queue_count--; - multiplayer_sound_queue_count = queue_count; - if (queue_count) - _game_engine_play_multiplayer_sound(multiplayer_sound_queue_sounds[0].sound_index); + if (--mp_sound_queue_count) + _game_engine_play_multiplayer_sound(mp_sound_queue[0].sound_index); } return; @@ -254,7 +240,7 @@ void game_engine_play_multiplayer_sound( push_queued_sound( sound_index, get_sound_length_in_ticks(sound_index) + 5); - if (multiplayer_sound_queue_count == 1) + if (mp_sound_queue_count == 1) _game_engine_play_multiplayer_sound(sound_index); } else @@ -269,12 +255,12 @@ void game_engine_intialize_queued_sounds( void) { csmemset( - multiplayer_sound_queue_sounds, + mp_sound_queue, 0, - sizeof(multiplayer_sound_queue_sounds)); - multiplayer_sound_queue_count = 1; - multiplayer_sound_queue_sounds[0].sound_index = NONE; - multiplayer_sound_queue_sounds[0].delay_ticks = MULTIPLAYER_SOUND_QUEUE_INITIAL_DELAY_TICKS; + sizeof(mp_sound_queue)); + mp_sound_queue_count = 1; + mp_sound_queue[0].sound_index = NONE; + mp_sound_queue[0].delay_ticks = MULTIPLAYER_SOUND_QUEUE_INITIAL_DELAY_TICKS; return; } diff --git a/source/game/game_engine_oddball.c b/source/game/game_engine_oddball.c index be7f65a4..c1420cd3 100644 --- a/source/game/game_engine_oddball.c +++ b/source/game/game_engine_oddball.c @@ -107,7 +107,7 @@ symbols in this file: #include "cseries/cseries.h" #include "cseries/errors.h" #include "game/game_engine_place.h" -#include "game/game_engine_runtime.h" +#include "game/game_engine.h" #include "game.h" #include "items/weapon_definitions.h" #include "items/weapons.h" diff --git a/source/game/game_engine_runtime.h b/source/game/game_engine_runtime.h deleted file mode 100644 index 2119270a..00000000 --- a/source/game/game_engine_runtime.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -GAME_ENGINE_RUNTIME.H -*/ - -#ifndef __GAME_ENGINE_RUNTIME_H -#define __GAME_ENGINE_RUNTIME_H -#pragma once - -/* ---------- headers */ - -#include "cseries/cseries.h" -#include "game/game_engine.h" - -/* ---------- structures */ - -union real_point3d; - - -/* ---------- prototypes/GAME_ENGINE.C */ - -void game_engine_update( - void); - -void game_show_score_team( - long team_index, - long score); - -void game_show_score_you_ally_enemy( - long player_index, - long you_score, - long ally_score, - long enemy_score, - long other_player_index); - -void game_engine_flag_reset( - long weapon_index, - union real_point3d const *position); - -/* ---------- prototypes/GAME_ENGINE_CTF.C */ - -void ctf_state_message_update_warning( - long team_index); - -#endif // __GAME_ENGINE_RUNTIME_H diff --git a/source/game/game_globals.c b/source/game/game_globals.c index f47ce8c0..f38abdaf 100644 --- a/source/game/game_globals.c +++ b/source/game/game_globals.c @@ -84,6 +84,7 @@ symbols in this file: #include "game/game.h" #include "game/game_engine.h" #include "game/game_globals.h" +#include "game/game_allegiance.h" #include "scenario/scenario.h" /* ---------- constants */ @@ -94,8 +95,6 @@ symbols in this file: /* ---------- prototypes */ -boolean game_team_is_enemy(short team_index0, short team_index1); - /* ---------- globals */ char const *global_material_type_strings[NUMBER_OF_MATERIAL_TYPES] = diff --git a/source/game/game_time.c b/source/game/game_time.c index 43a09025..793246b6 100644 --- a/source/game/game_time.c +++ b/source/game/game_time.c @@ -71,6 +71,8 @@ symbols in this file: #include "real_math.h" #include "game.h" #include "player_queues_new.h" +#include "networking/network_game_globals.h" +#include "saved games/game_state.h" /* ---------- constants */ @@ -121,9 +123,7 @@ struct game_time_globals_struct /* ---------- prototypes */ -extern void *game_state_malloc(char const *, char const *, long); struct network_game_server; -extern struct network_game_server *global_network_game_server_get(void); extern long network_game_server_get_oldest_client_update_received(struct network_game_server *server); extern void network_game_server_stalled_on_client(struct network_game_server *server, boolean stalled); extern void network_game_server_update_ticks(struct network_game_server *server, long ticks); diff --git a/source/game/player_control.c b/source/game/player_control.c index 63047462..072cb43d 100644 --- a/source/game/player_control.c +++ b/source/game/player_control.c @@ -184,7 +184,6 @@ symbols in this file: #define limit2d limit2d_inline #include "game/game.h" #undef limit2d -#include "game/player_control.h" #include "game/player_control_runtime.h" #include "players.h" #include "player_queues_new.h" @@ -242,6 +241,42 @@ real const MOUSE_YAW_SCALE = 0.0031415927f; real const MOUSE_PITCH_SCALE = 0.0031415927f; static real const ANALOG_BUTTON_SCALE = 1.f / 255.f; +enum +{ + _player_control_action_bit, + _player_control_jump_bit, + _player_control_accept_bit, + _player_control_back_bit, + _player_control_primary_trigger_bit, + _player_control_grenade_trigger_bit, + _player_control_zoom_bit, + _player_control_look_relative_up_bit, + _player_control_look_relative_down_bit, + _player_control_look_relative_left_bit, + _player_control_look_relative_right_bit, + _player_control_move_relative_forward_bit, + _player_control_move_relative_backward_bit, + _player_control_move_relative_right_bit, + _player_control_move_relative_left_bit, +}; + +enum +{ + _player_control_camera_control_disabled_bit, + _player_control_look_relative_all_directions_flags = 0x780, + _player_control_move_relative_all_directions_flags = 0x7800, +}; + +enum +{ + _player_control_rotate_weapons_bit, + _player_control_rotate_grenades_bit, + _player_control_input_zoom_bit, + _player_control_debug_rotate_units_bit, + _player_control_debug_rotate_all_units_bit, + _player_control_debug_ninja_rope_bit, +}; + /* ---------- macros */ #define valid_euler_angles2d(angles) ( \ @@ -292,13 +327,32 @@ typedef char mouse_state_size_assert[ typedef char mouse_state_buttons_offset_assert[ offsetof(struct mouse_state, buttons) == 0xC ? 1 : -1]; +struct player_control_globals_data +{ + unsigned long action_flags; + unsigned long action_test_flags; + unsigned long suppressed_action_flags; + unsigned long flags; + struct player_control players[MAXIMUM_NUMBER_OF_LOCAL_PLAYERS]; +}; + +typedef char player_control_globals_size_assert[ + sizeof(struct player_control_globals_data) == 0x110 ? 1 : -1]; +typedef char player_control_globals_players_offset_assert[ + offsetof(struct player_control_globals_data, players) == 0x10 ? 1 : -1]; +typedef char player_control_globals_action_test_flags_offset_assert[ + offsetof(struct player_control_globals_data, action_test_flags) == 0x4 ? 1 : -1]; +typedef char player_control_globals_suppressed_action_flags_offset_assert[ + offsetof(struct player_control_globals_data, suppressed_action_flags) == 0x8 ? 1 : -1]; +typedef char player_control_globals_flags_offset_assert[ + offsetof(struct player_control_globals_data, flags) == 0xC ? 1 : -1]; + /* ---------- prototypes */ -void player_aiming_vector_from_facing( - long player_index, - real_vector3d *facing_direction, - real_euler_angles2d const *facing_angles); - +struct player_control *player_control_get( + short local_player_index); +void player_control_dispose_from_old_map( + void); static void player_control_modify_desired_angles( short local_player_index, real delta_yaw, @@ -314,6 +368,9 @@ static void get_local_player_input_blob( static void handle_one_player_input( short local_player_index, real time_delta_sec); +long player_control_get_desired_weapon( + short local_player_index, + long unit_index); static boolean player_control_camera_control_is_active( void); diff --git a/source/game/player_control.h b/source/game/player_control.h deleted file mode 100644 index 8fcbc34e..00000000 --- a/source/game/player_control.h +++ /dev/null @@ -1,221 +0,0 @@ -#ifndef __PLAYER_CONTROL_H -#define __PLAYER_CONTROL_H -#pragma once - -#include "networking/network_connection.h" - -/* ---------- constants */ - -enum -{ - _player_control_action_bit, - _player_control_jump_bit, - _player_control_accept_bit, - _player_control_back_bit, - _player_control_primary_trigger_bit, - _player_control_grenade_trigger_bit, - _player_control_zoom_bit, - _player_control_look_relative_up_bit, - _player_control_look_relative_down_bit, - _player_control_look_relative_left_bit, - _player_control_look_relative_right_bit, - _player_control_move_relative_forward_bit, - _player_control_move_relative_backward_bit, - _player_control_move_relative_right_bit, - _player_control_move_relative_left_bit, -}; - -enum -{ - _player_control_camera_control_disabled_bit, - _player_control_look_relative_all_directions_flags = 0x780, - _player_control_move_relative_all_directions_flags = 0x7800, -}; - -enum -{ - _player_control_rotate_weapons_bit, - _player_control_rotate_grenades_bit, - _player_control_input_zoom_bit, - _player_control_debug_rotate_units_bit, - _player_control_debug_rotate_all_units_bit, - _player_control_debug_ninja_rope_bit, -}; - -/* ---------- structures */ - -struct unit_camera; - -struct player_control_unit_camera_info -{ - long unit_index; - short seat_index; - short pad6; - struct unit_camera const *camera; - real_point3d position; -}; - -struct player_control -{ - long unit_index; - unsigned long control_flags; - word inhibited_button_bit_vector; - word reset_button_when_released_bit_vector; - real_euler_angles2d desired_angles; - real_vector2d throttle; - real primary_trigger; - short desired_weapon_index; - short desired_grenade_index; - short zoom_level; - boolean use_autolevel; - char autolevel_ticks; - long target_object_index; - real autoaim_level; - real magnetism_level; - real look_acceleration_time; - real pitch_minimum; - real pitch_maximum; -}; - -struct player_control_globals_data -{ - unsigned long action_flags; - unsigned long action_test_flags; - unsigned long suppressed_action_flags; - unsigned long flags; - struct player_control players[MAXIMUM_NUMBER_OF_LOCAL_PLAYERS]; -}; - -typedef char player_control_size_assert[ - sizeof(struct player_control) == 0x40 ? 1 : -1]; -typedef char player_control_unit_index_offset_assert[ - offsetof(struct player_control, unit_index) == 0x0 ? 1 : -1]; -typedef char player_control_inhibited_action_flags_offset_assert[ - offsetof(struct player_control, inhibited_button_bit_vector) == 0x8 ? 1 : -1]; -typedef char player_control_desired_yaw_offset_assert[ - offsetof(struct player_control, desired_angles.yaw) == 0xC ? 1 : -1]; -typedef char player_control_desired_pitch_offset_assert[ - offsetof(struct player_control, desired_angles.pitch) == 0x10 ? 1 : -1]; -typedef char player_control_desired_weapon_index_offset_assert[ - offsetof(struct player_control, desired_weapon_index) == 0x20 ? 1 : -1]; -typedef char player_control_desired_grenade_index_offset_assert[ - offsetof(struct player_control, desired_grenade_index) == 0x22 ? 1 : -1]; -typedef char player_control_zoom_level_offset_assert[ - offsetof(struct player_control, zoom_level) == 0x24 ? 1 : -1]; -typedef char player_control_target_object_index_offset_assert[ - offsetof(struct player_control, target_object_index) == 0x28 ? 1 : -1]; -typedef char player_control_autoaim_level_offset_assert[ - offsetof(struct player_control, autoaim_level) == 0x2C ? 1 : -1]; -typedef char player_control_magnetism_level_offset_assert[ - offsetof(struct player_control, magnetism_level) == 0x30 ? 1 : -1]; -typedef char player_control_look_acceleration_time_offset_assert[ - offsetof(struct player_control, look_acceleration_time) == 0x34 ? 1 : -1]; -typedef char player_control_pitch_minimum_offset_assert[ - offsetof(struct player_control, pitch_minimum) == 0x38 ? 1 : -1]; -typedef char player_control_pitch_maximum_offset_assert[ - offsetof(struct player_control, pitch_maximum) == 0x3C ? 1 : -1]; -typedef char player_control_unit_camera_info_size_assert[ - sizeof(struct player_control_unit_camera_info) == 0x18 ? 1 : -1]; -typedef char player_control_globals_size_assert[ - sizeof(struct player_control_globals_data) == 0x110 ? 1 : -1]; -typedef char player_control_globals_players_offset_assert[ - offsetof(struct player_control_globals_data, players) == 0x10 ? 1 : -1]; -typedef char player_control_globals_action_test_flags_offset_assert[ - offsetof(struct player_control_globals_data, action_test_flags) == 0x4 ? 1 : -1]; -typedef char player_control_globals_suppressed_action_flags_offset_assert[ - offsetof(struct player_control_globals_data, suppressed_action_flags) == 0x8 ? 1 : -1]; -typedef char player_control_globals_flags_offset_assert[ - offsetof(struct player_control_globals_data, flags) == 0xC ? 1 : -1]; - -/* ---------- prototypes */ - -void player_control_initialize( - void); -void player_control_dispose( - void); -void player_control_dispose_from_old_map( - void); -struct player_control *player_control_get( - short local_player_index); -void player_control_inhibit_buttons( - short local_player_index, - word action_flags, - boolean persistent); -long player_control_get_target_object_index( - short local_player_index); -real player_control_get_field_of_view( - short local_player_index); -void player_control_get_unit_camera_info( - short local_player_index, - struct player_control_unit_camera_info *camera_info); -long player_control_get_unit_index( - short local_player_index); -short unit_get_local_player_index( - long unit_index); -long player_control_get_desired_weapon( - short local_player_index, - long unit_index); -short player_control_get_zoom_level( - short local_player_index); -real player_control_get_autoaim_level( - short local_player_index); -void players_unzoom_all( - void); -void player_control_unzoom( - long unit_index); -real_euler_angles2d const *player_control_get_facing_angles( - short local_player_index); -real_vector3d *player_control_get_facing_direction( - short local_player_index, - real_vector3d *facing_direction); -void player_control_set_desired_weapon( - long unit_index, - short desired_weapon_index); -void player_control_set_facing( - short local_player_index, - real_vector3d const *facing_direction); -void player_control_new_unit( - short local_player_index, - long unit_index); -void player_control_initialize_for_new_map( - void); -void player_control_permanent_impulse( - short local_player_index, - real_euler_angles2d const *delta); -boolean scripted_player_control_set_camera_control( - boolean camera_control); -void player_control_action_test_reset( - void); -boolean player_control_action_test_accept( - void); -boolean player_control_action_test_back( - void); -boolean player_control_action_test_action( - void); -boolean player_control_action_test_jump( - void); -boolean player_control_action_test_primary_trigger( - void); -boolean player_control_action_test_grenade_trigger( - void); -boolean player_control_action_test_zoom( - void); -boolean player_control_action_test_look_relative_left( - void); -boolean player_control_action_test_look_relative_right( - void); -boolean player_control_action_test_look_relative_up( - void); -boolean player_control_action_test_look_relative_down( - void); -boolean player_control_action_test_move_relative_all_directions( - void); -boolean player_control_action_test_look_relative_all_directions( - void); - -/* ---------- globals */ - -extern real player_look_yaw_rate[MAXIMUM_NUMBER_OF_LOCAL_PLAYERS]; -extern real player_look_pitch_rate[MAXIMUM_NUMBER_OF_LOCAL_PLAYERS]; - -#endif // __PLAYER_CONTROL_H diff --git a/source/game/player_rumble.c b/source/game/player_rumble.c index 331137a0..9d98510e 100644 --- a/source/game/player_rumble.c +++ b/source/game/player_rumble.c @@ -44,6 +44,7 @@ symbols in this file: #include "input/input.h" #include "interface/player_ui.h" #include "math/periodic_functions.h" +#include "memory/data.h" #include "saved games/game_state.h" /* ---------- constants */ diff --git a/source/game/players.c b/source/game/players.c index 576c8cce..59118c93 100644 --- a/source/game/players.c +++ b/source/game/players.c @@ -228,6 +228,7 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "cseries/errors.h" #include "cseries/profile.h" #include "ai/ai.h" #include "ai/ai_debug.h" @@ -261,7 +262,6 @@ symbols in this file: #include "render/render_debug.h" #include "players.h" #include "player_queues_new.h" -#include "player_control.h" #include "objects/objects.h" #include "saved games/game_state.h" #include "scenario/scenario.h" diff --git a/source/game/players.h b/source/game/players.h index efa91252..1ddbfff7 100644 --- a/source/game/players.h +++ b/source/game/players.h @@ -11,6 +11,7 @@ header included in hcex build. /* ---------- headers */ #include "game/game.h" +#include "networking/network_connection.h" /* ---------- constants */ @@ -176,6 +177,70 @@ typedef char player_datum_quit_out_of_game_offset_assert[ typedef char player_datum_size_assert[ sizeof(struct player_datum) == 0xD4 ? 1 : -1]; +struct unit_camera; + +struct player_control_unit_camera_info +{ + long unit_index; + short seat_index; + short pad6; + struct unit_camera const *camera; + real_point3d position; +}; + +struct player_control +{ + long unit_index; + unsigned long control_flags; + word inhibited_button_bit_vector; + word reset_button_when_released_bit_vector; + real_euler_angles2d desired_angles; + real_vector2d throttle; + real primary_trigger; + short desired_weapon_index; + short desired_grenade_index; + short zoom_level; + boolean use_autolevel; + char autolevel_ticks; + long target_object_index; + real autoaim_level; + real magnetism_level; + real look_acceleration_time; + real pitch_minimum; + real pitch_maximum; +}; + +typedef char player_control_size_assert[ + sizeof(struct player_control) == 0x40 ? 1 : -1]; +typedef char player_control_unit_index_offset_assert[ + offsetof(struct player_control, unit_index) == 0x0 ? 1 : -1]; +typedef char player_control_inhibited_action_flags_offset_assert[ + offsetof(struct player_control, inhibited_button_bit_vector) == 0x8 ? 1 : -1]; +typedef char player_control_desired_yaw_offset_assert[ + offsetof(struct player_control, desired_angles.yaw) == 0xC ? 1 : -1]; +typedef char player_control_desired_pitch_offset_assert[ + offsetof(struct player_control, desired_angles.pitch) == 0x10 ? 1 : -1]; +typedef char player_control_desired_weapon_index_offset_assert[ + offsetof(struct player_control, desired_weapon_index) == 0x20 ? 1 : -1]; +typedef char player_control_desired_grenade_index_offset_assert[ + offsetof(struct player_control, desired_grenade_index) == 0x22 ? 1 : -1]; +typedef char player_control_zoom_level_offset_assert[ + offsetof(struct player_control, zoom_level) == 0x24 ? 1 : -1]; +typedef char player_control_target_object_index_offset_assert[ + offsetof(struct player_control, target_object_index) == 0x28 ? 1 : -1]; +typedef char player_control_autoaim_level_offset_assert[ + offsetof(struct player_control, autoaim_level) == 0x2C ? 1 : -1]; +typedef char player_control_magnetism_level_offset_assert[ + offsetof(struct player_control, magnetism_level) == 0x30 ? 1 : -1]; +typedef char player_control_look_acceleration_time_offset_assert[ + offsetof(struct player_control, look_acceleration_time) == 0x34 ? 1 : -1]; +typedef char player_control_pitch_minimum_offset_assert[ + offsetof(struct player_control, pitch_minimum) == 0x38 ? 1 : -1]; +typedef char player_control_pitch_maximum_offset_assert[ + offsetof(struct player_control, pitch_maximum) == 0x3C ? 1 : -1]; +typedef char player_control_unit_camera_info_size_assert[ + sizeof(struct player_control_unit_camera_info) == 0x18 ? 1 : -1]; + /* ---------- prototypes/PLAYER_CONTROL.C */ void player_input_enable( @@ -184,7 +249,83 @@ void player_input_enable( boolean player_input_enabled( void); +short unit_get_local_player_index( + long unit_index); +void player_control_initialize( + void); +void player_control_dispose( + void); +boolean scripted_player_control_set_camera_control( + boolean camera_control); +void player_control_inhibit_buttons( + short local_player_index, + word action_flags, + boolean persistent); +long player_control_get_target_object_index( + short local_player_index); +real player_control_get_field_of_view( + short local_player_index); +void player_control_get_unit_camera_info( + short local_player_index, + struct player_control_unit_camera_info *camera_info); +long player_control_get_aiming_unit_index( + short local_player_index); +long player_control_get_unit_index( + short local_player_index); +short player_control_get_zoom_level( + short local_player_index); +real player_control_get_autoaim_level( + short local_player_index); +void players_unzoom_all( + void); void player_control_unzoom(long unit_index); +real_euler_angles2d const *player_control_get_facing_angles( + short local_player_index); +real_vector3d *player_control_get_facing_direction( + short local_player_index, + real_vector3d *facing_direction); +void player_control_set_desired_weapon( + long unit_index, + short desired_weapon_index); +void player_control_set_facing( + short local_player_index, + real_vector3d const *facing_direction); +void player_control_new_unit( + short local_player_index, + long unit_index); +void player_control_action_test_reset( + void); +boolean player_control_action_test_accept( + void); +boolean player_control_action_test_back( + void); +boolean player_control_action_test_action( + void); +boolean player_control_action_test_jump( + void); +boolean player_control_action_test_primary_trigger( + void); +boolean player_control_action_test_grenade_trigger( + void); +boolean player_control_action_test_zoom( + void); +boolean player_control_action_test_look_relative_left( + void); +boolean player_control_action_test_look_relative_right( + void); +boolean player_control_action_test_look_relative_up( + void); +boolean player_control_action_test_look_relative_down( + void); +boolean player_control_action_test_move_relative_all_directions( + void); +boolean player_control_action_test_look_relative_all_directions( + void); +void player_control_initialize_for_new_map( + void); +void player_control_permanent_impulse( + short local_player_index, + real_euler_angles2d const *delta); /* ---------- prototypes/PLAYERS.C */ @@ -192,6 +333,10 @@ void players_initialize( void); void players_initialize_for_new_map( void); +void players_dispose_from_old_map( + void); +void players_dispose( + void); long *machine_get_player_list( long machine_index); @@ -201,6 +346,10 @@ long player_new( long player_index, short local_player_index, struct network_player const *network_player); +boolean player_teleport( + long player_index, + long source_unit_index, + real_point3d const *position); boolean local_player_exists( long local_player_index); @@ -221,6 +370,8 @@ short players_get_respawn_failure( boolean players_respawn_coop( void); +void players_reconnect_to_structure_bsp( + void); boolean players_are_all_dead( void); @@ -230,6 +381,8 @@ boolean any_player_is_dead( void); long player_index_from_unit_index(long unit_index); +void player_died( + long player_index); unsigned long const *players_get_combined_pvs_local( void); @@ -243,11 +396,16 @@ void player_handle_powerup_minor( long player_index, short powerup_index, short duration); +void players_handle_deleted_object(long deleted_object_index); void player_add_equipment( long unit_index, short starting_profile_index, boolean reset_equipment); +void player_aiming_vector_from_facing( + long player_index, + real_vector3d *facing_direction, + real_euler_angles2d const *facing_angles); void players_update_before_game( void); @@ -255,12 +413,18 @@ void players_update_after_game( void); void players_debug_render( void); +void debug_player_teleport( + short player_index, + short location_index); /* ---------- globals */ extern struct data_array *player_data; extern struct players_globals *players_globals; +extern real player_look_yaw_rate[MAXIMUM_NUMBER_OF_LOCAL_PLAYERS]; +extern real player_look_pitch_rate[MAXIMUM_NUMBER_OF_LOCAL_PLAYERS]; + /* ---------- public code */ #endif // __PLAYERS_H diff --git a/source/hs/hs.c b/source/hs/hs.c index 358dae78..f425e8d5 100644 --- a/source/hs/hs.c +++ b/source/hs/hs.c @@ -2780,11 +2780,37 @@ symbols in this file: #include "camera/director.h" #include "cache/sound_cache.h" #include "hs.h" -#include "hs_library_internal_compile.h" +#include "hs_library_external.h" +#include "hs_library_internal.h" #include "object_lists.h" #include "hs_scenario_definitions.h" +#include "ai/ai.h" +#include "ai/ai_debug.h" +#include "cache/cache_files.h" +#include "cache/texture_cache.h" +#include "camera/camera_scripting.h" +#include "cutscene/cinematics.h" +#include "effects/player_effects.h" +#include "game/cheats.h" +#include "game/players.h" +#include "interface/attract_mode.h" +#include "interface/hud.h" +#include "interface/terminal.h" +#include "interface/ui_widget.h" +#include "main/console.h" #include "math/real_math.h" #include "memory/data.h" +#include "networking/network_game_globals.h" +#include "networking/network_game_manager.h" +#include "objects/damage.h" +#include "objects/object_lights.h" +#include "objects/scenery.h" +#include "physics/breakable_surfaces.h" +#include "rasterizer/rasterizer.h" +#include "render/render.h" +#include "saved games/game_state.h" +#include "saved games/saved_game_files.h" +#include "scenario/scenario.h" #include "scenario/scenario_definitions.h" #include "ai/ai_scenario_definitions.h" #include "ai/ai_profile.h" @@ -2800,11 +2826,16 @@ symbols in this file: #include "interface/interface.h" #include "interface/player_ui.h" #include "rasterizer/rasterizer_cinematics.h" +#include "shaders/shaders.h" #include "sound/game_sound.h" +#include "sound/sound_classes.h" +#include "sound/sound_manager.h" #include "structures/structure_lens_flares.h" #include "structures/structure_visibility.h" #include "tag_files/files.h" #include "main/main.h" +#include "units/units.h" +#include "units/vehicles.h" /* ---------- constants */ @@ -3514,61 +3545,9 @@ union hs_boolean_result /* ---------- prototypes */ -void console_printf( - boolean clear, - char const *format, - ...); static long alphabetize( char const **left, char const **right); -struct scenario *global_scenario_get( - void); -void hs_teleport_players_not_in_trigger_volume( - short trigger_volume_index, - short cutscene_flag_index); -void hs_object_set_shield( - long object_index, - real shield_vitality); -void hs_object_set_permutation( - long object_index, - char const *region_name, - char const *permutation_name); -void hs_effect_new_from_object_marker( - long effect_definition_index, - long object_index, - char const *marker_name); -boolean hs_objects_can_see_object( - long object_list_index, - long object_index, - real degrees); -boolean hs_objects_can_see_flag( - long object_list_index, - short cutscene_flag_index, - real degrees); -void hs_sound_set_gain( - char const *tag_name, - real gain); -void objects_scripting_set_scale( - long object_index, - real scale, - short interpolation_frame_count); -void objects_scripting_attach( - long parent_object_index, - char const *parent_marker_name, - long child_object_index, - char const *child_marker_name); -void object_beautify( - long object_index, - boolean beautiful); -void scenery_animation_start( - long object_index, - long animation_graph_index, - char const *animation_name); -void scenery_animation_start_at_frame( - long object_index, - long animation_graph_index, - char const *animation_name, - short frame_index); void unit_scripting_set_maximum_vitality( long unit_index, real body_vitality, @@ -3585,736 +3564,40 @@ void units_scripting_set_current_vitality( long object_list_index, real body_vitality, real shield_vitality); -void device_set_power( - long device_index, - real power); -boolean device_set_desired_position( - long device_index, - real position); -void device_set_actual_position( - long device_index, - real position); -boolean device_group_set_desired_value( - short group_index, - real desired_value); -void device_group_set_actual_value( - short group_index, - real actual_value); -void ai_scripting_vehicle_enterable_distance( - long ai_reference, - real distance); -void ai_scripting_follow_distance( - long ai_reference, - real distance); -void player_effect_screen_fade_in( - real red, - real green, - real blue, - short ticks); -void player_effect_screen_fade_out( - real red, - real green, - real blue, - short ticks); -void cinematic_set_title_delayed( - short title_index, - real delay); -void debug_sound_classes_set_distances( - char const *name, - real minimum_distance, - real maximum_distance); -void debug_sound_classes_set_wet( - char const *name, - real wet); -void sound_class_set_gain( - char const *name, - real gain, - short interpolation_ticks); -void hud_unit_activate_nav_point_with_flag( - short player_index, - long unit_index, - short flag_index, - real vertical_offset); -void hud_unit_activate_nav_point_with_object( - short player_index, - long unit_index, - long object_index, - real vertical_offset); -void hud_activate_team_nav_point_with_flag( - short player_index, - short team, - short flag_index, - real vertical_offset); -void hud_activate_team_nav_point_with_object( - short player_index, - short team, - long object_index, - real vertical_offset); -void scripted_player_effect_set_translation( - real horizontal, - real vertical, - real depth); -void scripted_player_effect_set_rotation( - real yaw, - real pitch, - real roll); -void scripted_player_effect_set_rumble( - real left_motor, - real right_motor); -void scripted_player_effect_start( - real maximum_intensity, - real attack_time); void rasterizer_model_ambient_reflection_tint( real alpha, real red, real green, real blue); -short object_list_count( - long object_list_index); -short numeric_countdown_timer_get( - short digit_index); -long recorded_animation_get_time_left( - long unit_index); -short scenery_get_animation_time( - long scenery_index); -short unit_get_custom_animation_time( - long unit_index); short unit_scripting_get_grenade_count( long unit_index); -short ai_scripting_command_list_status( - long ai_reference); -short ai_scripting_going_to_vehicle( - long ai_reference); -short ai_scripting_living_count( - long ai_reference); -short ai_scripting_swarm_count( - long ai_reference); -short ai_scripting_nonswarm_count( - long ai_reference); -short ai_scripting_status( - long ai_reference); -short ai_scripting_conversation_line( - short conversation_index); -short ai_scripting_conversation_status( - short conversation_index); -short scripted_camera_time( - void); -short global_structure_bsp_index_get( - void); -short vehicle_scripting_load_magic( - long vehicle_index, - char const *seat_name, - long object_list_index); -short vehicle_scripting_unload( - long vehicle_index, - char const *seat_name); -boolean unit_solo_player_integrated_night_vision_is_active( - void); -void hud_unit_deactivate_nav_point_with_flag( - long unit_index, - short flag_index); -void hud_unit_deactivate_nav_point_with_object( - long unit_index, - long object_index); -void hud_deactivate_team_nav_point_with_flag( - short team, - short flag_index); -void hud_deactivate_team_nav_point_with_object( - short team, - long object_index); -void scripted_player_effect_stop( - real decay_time); -void scripted_hud_set_state_message( - short message_index); -void scripted_hud_set_timer_warning_cutoff( - short minutes, - word seconds); -void scripted_hud_show_timer( - boolean show); -void scripted_hud_pause_timer( - boolean pause); -void scripted_hud_time_code_show( - boolean show); -void scripted_hud_time_code_start( - boolean start); -void rasterizer_screen_effect_start( - boolean clear); -void rasterizer_set_near_clip_distance( - real distance); -void ui_widget_debug_show_path( - boolean show); -void display_scenario_help( - short string_index); -void xbox_set_machine_name( - char const *machine_name); void hs_help( char const *function_name); -boolean hs_not( - boolean value); -boolean scenario_trigger_volume_test_object( - short trigger_volume_index, - long object_index); -boolean hs_trigger_volume_test_objects_any( - short trigger_volume_index, - long object_list_index); -boolean hs_trigger_volume_test_objects_all( - short trigger_volume_index, - long object_list_index); -boolean lights_enable( - boolean enable); -boolean unit_start_user_animation( - long unit_index, - long animation_graph_index, - char const *animation_name, - boolean interpolate); boolean unit_scripting_start_user_animation_list( long object_list_index, long animation_graph_index, char const *animation_name, boolean interpolate); -boolean unit_custom_animation_at_frame( - long unit_index, - long animation_graph_index, - char const *animation_name, - boolean interpolate, - short frame_index); -boolean unit_is_playing_custom_animation( - long unit_index); -boolean unit_scripting_vehicle_test_seat_list( - long vehicle_index, - char const *seat_name, - long object_list_index); -boolean unit_scripting_vehicle_test_seat( - long vehicle_index, - char const *seat_name, - long unit_index); boolean unit_scripting_has_weapon( long unit_index, long weapon_definition_index); boolean unit_scripting_has_weapon_readied( long unit_index, long weapon_definition_index); -boolean unit_get_current_flashlight_state( - long unit_index); -boolean ai_scripting_is_attacking( - long encounter_index); -boolean ai_scripting_conversation( - short conversation_index); -boolean scripted_player_control_set_camera_control( - boolean enabled); -boolean scripted_show_hud( - boolean show); -boolean scripted_show_hud_help_text( - boolean show); -long hs_players( - void); -long game_time_get( - void); -long unit_scripting_unit_riders( - long unit_index); -long unit_scripting_unit_driver( - long unit_index); -long unit_scripting_unit_gunner( - long unit_index); -long object_list_from_ai_reference( - long ai_reference); -long hs_object_list_get_element( - long object_list_index, - short element_index); -void hs_object_destroy( - long object_index); -void hs_object_create( - short object_name_index); -void hs_object_create_anew( - short object_name_index); -void cheat_active_camouflage_local_player( - short player_index); -void breakable_surfaces_enable( - boolean enabled); -void render_effects( - boolean enabled); -void ai_globals_ai_active( - boolean enabled); -void ai_globals_dialogue_triggers_enabled( - boolean enabled); -void ai_globals_grenades_enabled( - boolean enabled); -void recorded_animation_kill( - long unit_index); -void object_cannot_take_damage( - long object_list_index); -void object_can_take_damage( - long object_list_index); -void hs_objects_predict( - long object_list_index); -void object_definition_predict( - long definition_index); -void object_pvs_set_object( - long object_index); -void object_pvs_activate( - long object_index); -void unit_open( - long unit_index); -void unit_close( - long unit_index); -void unit_kill( - long unit_index); -void unit_kill_silent( - long unit_index); -void unit_stop_custom_animation( - long unit_index); -void unit_scripting_exit_vehicle( - long unit_index); -void unit_scripting_doesnt_drop_items( - long unit_index); -void ai_scripting_free( - long ai_reference); -void ai_scripting_free_units( - long ai_reference); -void ai_scripting_detach_unit( - long unit_index); -void ai_scripting_detach_units( - long object_list_index); -void ai_scripting_place( - long ai_reference); -void ai_scripting_kill( - long ai_reference); -void ai_scripting_kill_silent( - long ai_reference); -void ai_scripting_erase( - long ai_reference); -void ai_scripting_select( - long ai_reference); -void ai_scripting_spawn_actor( - long ai_reference); -void ai_scripting_magically_see_players( - long ai_reference); -void ai_scripting_timer_start( - long ai_reference); -void ai_scripting_timer_expire( - long ai_reference); -void ai_scripting_attack( - long ai_reference); -void ai_scripting_defend( - long ai_reference); -void ai_scripting_retreat( - long ai_reference); -void hs_print( - char const *message); -void hs_object_create_containing( - char const *object_name); -void hs_object_create_anew_containing( - char const *object_name); -void hs_object_destroy_containing( - char const *object_name); -void hs_objects_delete_by_definition( - long definition_index); -void scripting_set_magic_base_seat( - char const *seat_name); -void object_set_ranged_attack_inhibited( - long object_index, - boolean inhibited); -void object_set_melee_attack_inhibited( - long object_index, - boolean inhibited); -void object_scripting_set_collideable( - long object_index, - boolean collideable); -void unit_scripting_can_blink( - long unit_index, - boolean can_blink); -void unit_aim_without_turning( - long unit_index, - boolean enabled); -void unit_set_enterable_by_player( - long unit_index, - boolean enterable); void unit_scripting_impervious( long object_list_index, boolean impervious); -void unit_scripting_suspended( - long unit_index, - boolean suspended); -void units_set_desired_flashlight_state( - long object_list_index, - boolean desired_state); -void unit_set_desired_flashlight_state( - long unit_index, - boolean desired_state); -void ai_scripting_set_respawn( - long ai_reference, - boolean respawn); -void ai_scripting_set_deaf( - long ai_reference, - boolean deaf); -void ai_scripting_set_blind( - long ai_reference, - boolean blind); -void hs_damage_object( - long damage_definition_index, - long object_index); -void objects_scripting_detach( - long parent_object_index, - long child_object_index); -void ai_scripting_attach_unit( - long ai_reference, - long unit_index); -void ai_scripting_attach_units( - long ai_reference, - long object_list_index); -void ai_scripting_attach_free( - long ai_reference, - long unit_index); -void ai_scripting_magically_see_encounter( - long ai_reference, - long encounter_index); -void ai_scripting_magically_see_unit( - long ai_reference, - long unit_index); -void ai_scripting_magically_see_units( - long ai_reference, - long object_list_index); -void hs_object_teleport( - long object_index, - short cutscene_flag_index); -void hs_object_set_facing( - long object_index, - short cutscene_flag_index); -void hs_effect_new( - long effect_definition_index, - short cutscene_flag_index); -void hs_damage_new( - long damage_definition_index, - short cutscene_flag_index); -void numeric_countdown_timer_set( - long milliseconds, - boolean auto_start); -void unit_scripting_set_emotion_animation( - long unit_index, - char const *animation_name); -void unit_scripting_set_seat( - long unit_index, - char const *seat_name); -void unit_set_emotion( - long unit_index, - word emotion_index); -void unit_scripting_enter_vehicle( - long unit_index, - long vehicle_index, - char const *seat_name); -real hs_sound_get_gain( - char const *tag_name); real unit_scripting_get_health( long unit_index); real unit_scripting_get_shield( long unit_index); -real ai_scripting_living_fraction( - long ai_reference); -real ai_scripting_strength( - long ai_reference); -void hs_object_destroy_all( - void); -void numeric_countdown_timer_stop( - void); -void numeric_countdown_timer_restart( - void); -void objects_dump_memory( - void); -void garbage_collect_now( - void); -void object_pvs_clear( - void); -void breakable_surfaces_reset( - void); -void cheat_all_powerups( - void); -void cheat_all_weapons( - void); -void cheat_all_vehicles( - void); -void cheat_teleport_to_camera( - void); -void cheat_active_camouflage( - void); -void scripting_magic_melee_attack( - void); -void cheats_load( - void); -void ai_scripting_erase_all( - void); -void ai_scripting_deselect( - void); -void ai_scripting_reconnect( - void); -void players_unzoom_all( - void); -void player_control_action_test_reset( - void); -void texture_cache_flush( - void); -void debug_dump_memory( - void); -void debug_dump_memory_by_file( - void); -void profile_initialize( - void); -void ai_debug_sound_point_set( - void); -void cinematic_start( - void); -void cinematic_stop( - void); -void cinematic_skip_start( - void); -void cinematic_skip_stop( - void); -void attract_mode_start( - void); -void scripted_hud_restart_flashing( - void); -void terminal_clear( - void); -void scripted_hud_time_code_reset( - void); -void rasterizer_decals_flush( - void); -void rasterizer_fps_accumulate( - void); -void rasterizer_lights_reset_for_new_map( - void); -void rasterizer_screen_effect_stop( - void); -void enumerate_memory_units_test( - void); -void saved_game_files_delete_all_custom_profiles( - void); -void network_game_client_request_immediate_start( - void); void hs_doc( void); -void ai_scripting_maneuver( - long ai_index); -void ai_scripting_maneuver_enable( - long ai_index, - boolean enable); -void ai_scripting_migrate( - long source_ai_index, - long destination_ai_index); -void ai_scripting_migrate_and_speak( - long source_ai_reference, - long target_ai_reference, - char const *speech_type); -void ai_scripting_allegiance_remove( - short team_a, - short team_b); -void ai_scripting_go_to_vehicle( - long ai_reference, - long unit_index, - char const *seat_substring_name); -void ai_scripting_go_to_vehicle_override( - long ai_reference, - long unit_index, - char const *seat_substring_name); -void ai_scripting_exit_vehicle( - long ai_index); -void ai_scripting_braindead( - long ai_index, - boolean braindead); -void ai_scripting_braindead_by_unit( - long unit_index, - boolean braindead); -void ai_scripting_ignore( - long ai_index, - boolean ignore); -void ai_scripting_prefer_target( - long ai_index, - boolean prefer); -void ai_scripting_renew( - long ai_index); -void ai_scripting_try_to_fight_nothing( - long ai_index); -void ai_scripting_try_to_fight( - long source_ai_index, - long target_ai_index); -void ai_scripting_try_to_fight_player( - long ai_index); -void ai_scripting_command_list( - long ai_index, - short command_list_index); -void ai_scripting_command_list_by_unit( - long unit_index, - short command_list_index); -void ai_scripting_command_list_advance( - long ai_index); -void ai_scripting_command_list_advance_by_unit( - long unit_index); -void ai_scripting_force_active( - long ai_index, - boolean force_active); -void ai_scripting_force_active_by_unit( - long unit_index, - boolean force_active); -void ai_scripting_set_return_state( - long ai_index, - short state); -void ai_scripting_set_current_state( - long ai_index, - short state); -void ai_scripting_playfight( - long ai_index, - boolean playfight); -void ai_scripting_vehicle_encounter( - long vehicle_index, - long encounter_index); -void ai_scripting_vehicle_enterable_team( - long object_list_index, - short team); -void ai_scripting_vehicle_enterable_actor_type( - long object_list_index, - short actor_type); -void ai_scripting_vehicle_enterable_actors( - long vehicle_index, - long actor_list_index); -void ai_scripting_vehicle_enterable_disable( - long vehicle_index); -void ai_scripting_look_at_object( - long ai_index, - long object_index); -void ai_scripting_stop_looking( - long ai_index); -void ai_scripting_automatic_migration_target( - long ai_index, - boolean enable); -void ai_scripting_follow_target_disable( - long ai_index); -void ai_scripting_follow_target_players( - long ai_index); -void ai_scripting_follow_target_unit( - long ai_index, - long unit_index); -void ai_scripting_follow_target_ai( - long ai_index, - long target_ai_index); -void ai_scripting_conversation_stop( - short conversation_index); -void ai_scripting_conversation_advance( - short conversation_index); -void ai_scripting_link_activation( - long source_ai_index, - long target_ai_index); -void ai_scripting_berserk( - long ai_index, - boolean enable); -void ai_scripting_set_team( - long ai_index, - short team); -void ai_scripting_allow_charge( - long ai_index, - boolean allow_charge); -void ai_scripting_allow_dormant( - long ai_index, - boolean allow_dormant); -void scripted_camera_set_first_person( - long object_index); -void scripted_camera_set_dead( - long object_index); -void game_set_game_variant_from_name( - char const *name); -void player_input_enable( - boolean enable); -boolean player_control_action_test_jump( - void); -boolean player_control_action_test_primary_trigger( - void); -boolean player_control_action_test_grenade_trigger( - void); -boolean player_control_action_test_zoom( - void); -boolean player_control_action_test_action( - void); -boolean player_control_action_test_accept( - void); -boolean player_control_action_test_back( - void); -boolean player_control_action_test_look_relative_up( - void); -boolean player_control_action_test_look_relative_down( - void); -boolean player_control_action_test_look_relative_left( - void); -boolean player_control_action_test_look_relative_right( - void); -boolean player_control_action_test_look_relative_all_directions( - void); -boolean player_control_action_test_move_relative_all_directions( - void); -boolean player0_look_pitch_is_inverted( - void); -boolean player0_joystick_set_is_normal( - void); -void debug_dump_memory_for_file( - char const *file_name); -void profile_sections_activate( - char const *section_name); -void profile_sections_deactivate( - char const *section_name); -void ai_debug_vocalize( - char const *priority_name, - char const *vocalization_name); -void ai_debug_teleport_to( - long ai_index); -void ai_debug_speak( - char const *vocalization); -void ai_debug_speak_list( - char const *list_name); -void scripted_camera_set_absolute( - short camera_point_index, - word transition_time); -void scripted_camera_set( - short camera_point_index0, - word camera_point_index1, - long transition_time); -void scripted_camera_set_animation( - long animation_graph_index, - char const *animation_name); -void game_time_set_speed( - real speed); -void player_add_equipment( - long player_index, - short equipment_definition_index, - boolean force); -void debug_player_teleport( - short player_index, - short location_index); -boolean scenario_switch_structure_bsp( - short structure_bsp_index); -void cinematic_show_letterbox( - boolean show); -void cinematic_set_title( - unsigned short title_index); -void cinematic_suppress_bsp_object_creation( - boolean suppress); -void debug_sound_classes_enable( - char const *name, - boolean enable); -void sound_enable( - boolean enable); -void vehicle_hover( - long vehicle_index, - boolean hover); void hs_dispose_from_old_map( void); static long alphabetize_file_references( struct file_reference const *left, struct file_reference const *right); -boolean tag_data_resize( - struct tag_data *data, - long size); -boolean tag_block_resize( - struct tag_block *block, - long count); -long tag_block_add_element( - struct tag_block *block); int isspace( int character); boolean hs_scenario_merge( @@ -4328,10 +3611,6 @@ static boolean hs_compile_source( void); boolean hs_scenario_postprocess( boolean restore_syntax_data); -void object_lists_dispose( - void); -boolean game_state_reverted( - void); /* ---------- constants */ @@ -5038,58 +4317,6 @@ static void hs_effect_new_from_object_marker_evaluate( short function_index, long thread_index, boolean initialize); -void hs_evaluate_arithmetic( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_begin( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_begin_random( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_debug_string( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_equality( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_if( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_inequality( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_inspect( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_logical( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_object_cast_up( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_set( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_sleep( - short function_index, - long thread_index, - boolean initialize); -void hs_evaluate_sleep_until( - short function_index, - long thread_index, - boolean initialize); static void hs_help_evaluate( short function_index, long thread_index, diff --git a/source/hs/hs.h b/source/hs/hs.h index 5a550223..2ec84cc9 100644 --- a/source/hs/hs.h +++ b/source/hs/hs.h @@ -157,6 +157,8 @@ void hs_initialize( void); void hs_initialize_for_new_map( void); +void hs_dispose_from_old_map( + void); void hs_update( void); void hs_node_gc( @@ -234,6 +236,15 @@ char const *hs_global_get_name( short global_index); /* ---------- prototypes/HS_COMPILE.C */ +void hs_compile_initialize( + boolean compiling_scenario); +void hs_compile_dispose( + void); +long hs_compile_expression( + long source_size, + char const *source, + char const **error_message, + char const **error_source); boolean hs_parse( long expression_index, short expected_type); @@ -242,6 +253,9 @@ void hs_compile( char const *source, char const **error_message, char const **error_source); +boolean hs_compile_postprocess( + char const **error_message_pointer, + char const **error_source_pointer); /* ---------- globals */ diff --git a/source/hs/hs_compile.c b/source/hs/hs_compile.c index 79a401ec..5171a3be 100644 --- a/source/hs/hs_compile.c +++ b/source/hs/hs_compile.c @@ -412,6 +412,7 @@ symbols in this file: #include "cache/cache_files.h" #include "ai/ai_script.h" #include "hs/hs.h" +#include "hs/hs_library_internal.h" #include "hs/hs_library_internal_compile.h" #include "hs/hs_scenario_definitions.h" #include "interface/hud_definitions.h" diff --git a/source/hs/hs_globals_external.c b/source/hs/hs_globals_external.c index a202b14b..f038616a 100644 --- a/source/hs/hs_globals_external.c +++ b/source/hs/hs_globals_external.c @@ -903,7 +903,7 @@ symbols in this file: #include "networking/network_connection.h" #include "physics/collision_debug.h" #include "rasterizer/rasterizer.h" -#include "rasterizer/rasterizer_debug_options.h" +#include "rasterizer/rasterizer_console_vars.h" /* ---------- constants */ @@ -1091,9 +1091,9 @@ static struct hs_external_global_definition rasterizer_first_person_weapon_near_ static struct hs_external_global_definition rasterizer_first_person_weapon_far_clip_distance_definition = { "rasterizer_first_person_weapon_far_clip_distance", _hs_type_real, 0, &rasterizer_globals.first_person_weapon_far_clip_distance }; -static struct hs_external_global_definition rasterizer_pushbuffer_size_definition = { "rasterizer_pushbuffer_size", _hs_type_short_integer, 0, &rasterizer_globals.reserved38[0] }; +static struct hs_external_global_definition rasterizer_pushbuffer_size_definition = { "rasterizer_pushbuffer_size", _hs_type_short_integer, 0, &rasterizer_globals.push_buffer_size }; -static struct hs_external_global_definition rasterizer_pushbuffer_kickoff_size_definition = { "rasterizer_pushbuffer_kickoff_size", _hs_type_short_integer, 0, &rasterizer_globals.reserved38[2] }; +static struct hs_external_global_definition rasterizer_pushbuffer_kickoff_size_definition = { "rasterizer_pushbuffer_kickoff_size", _hs_type_short_integer, 0, &rasterizer_globals.kick_off_size }; static struct hs_external_global_definition rasterizer_floating_point_zbuffer_definition = { "rasterizer_floating_point_zbuffer", _hs_type_boolean, 0, &rasterizer_globals.floating_point_zbuffer }; @@ -1111,127 +1111,127 @@ static struct hs_external_global_definition rasterizer_frame_bounds_top_definiti static struct hs_external_global_definition rasterizer_frame_bounds_bottom_definition = { "rasterizer_frame_bounds_bottom", _hs_type_short_integer, 0, &rasterizer_globals.reserved04.frame_bounds.y1 }; -static struct hs_external_global_definition rasterizer_stats_definition = { "rasterizer_stats", _hs_type_short_integer, 0, &rasterizer_debug_options.stats }; +static struct hs_external_global_definition rasterizer_stats_definition = { "rasterizer_stats", _hs_type_short_integer, 0, &rasterizer_debug_options.statistics_mode }; -static struct hs_external_global_definition rasterizer_mode_definition = { "rasterizer_mode", _hs_type_short_integer, 0, &rasterizer_debug_options.mode }; +static struct hs_external_global_definition rasterizer_mode_definition = { "rasterizer_mode", _hs_type_short_integer, 0, &rasterizer_debug_options.drawing_mode }; -static struct hs_external_global_definition rasterizer_wireframe_definition = { "rasterizer_wireframe", _hs_type_boolean, 0, &rasterizer_debug_options.wireframe }; +static struct hs_external_global_definition rasterizer_wireframe_definition = { "rasterizer_wireframe", _hs_type_boolean, 0, &rasterizer_debug_options.wireframe_enabled }; -static struct hs_external_global_definition rasterizer_smart_definition = { "rasterizer_smart", _hs_type_boolean, 0, &rasterizer_debug_options.smart }; +static struct hs_external_global_definition rasterizer_smart_definition = { "rasterizer_smart", _hs_type_boolean, 0, &rasterizer_debug_options.smart_states_enabled }; -static struct hs_external_global_definition rasterizer_debug_model_vertices_definition = { "rasterizer_debug_model_vertices", _hs_type_boolean, 0, &rasterizer_debug_options.debug_model_vertices }; +static struct hs_external_global_definition rasterizer_debug_model_vertices_definition = { "rasterizer_debug_model_vertices", _hs_type_boolean, 0, &rasterizer_debug_options.debug_model_vertices_enabled }; static struct hs_external_global_definition rasterizer_debug_model_lod_definition = { "rasterizer_debug_model_lod", _hs_type_short_integer, 0, &rasterizer_debug_options.debug_model_lod }; -static struct hs_external_global_definition rasterizer_debug_transparents_definition = { "rasterizer_debug_transparents", _hs_type_boolean, 0, &rasterizer_debug_options.debug_transparents }; +static struct hs_external_global_definition rasterizer_debug_transparents_definition = { "rasterizer_debug_transparents", _hs_type_boolean, 0, &rasterizer_debug_options.debug_transparent_geometry_enabled }; -static struct hs_external_global_definition rasterizer_debug_meter_shader_definition = { "rasterizer_debug_meter_shader", _hs_type_boolean, 0, &rasterizer_debug_options.debug_meter_shader }; +static struct hs_external_global_definition rasterizer_debug_meter_shader_definition = { "rasterizer_debug_meter_shader", _hs_type_boolean, 0, &rasterizer_debug_options.debug_meter_shader_enabled }; -static struct hs_external_global_definition rasterizer_models_definition = { "rasterizer_models", _hs_type_boolean, 0, &rasterizer_debug_options.models }; +static struct hs_external_global_definition rasterizer_models_definition = { "rasterizer_models", _hs_type_boolean, 0, &rasterizer_debug_options.draw_models }; -static struct hs_external_global_definition rasterizer_model_transparents_definition = { "rasterizer_model_transparents", _hs_type_boolean, 0, &rasterizer_debug_options.model_transparents }; +static struct hs_external_global_definition rasterizer_model_transparents_definition = { "rasterizer_model_transparents", _hs_type_boolean, 0, &rasterizer_debug_options.draw_model_transparent_geometry }; static struct hs_external_global_definition rasterizer_draw_first_person_weapon_first_definition = { "rasterizer_draw_first_person_weapon_first", _hs_type_boolean, 0, &rasterizer_debug_options.draw_first_person_weapon_first }; -static struct hs_external_global_definition rasterizer_stencil_mask_definition = { "rasterizer_stencil_mask", _hs_type_boolean, 0, &rasterizer_debug_options.stencil_mask }; +static struct hs_external_global_definition rasterizer_stencil_mask_definition = { "rasterizer_stencil_mask", _hs_type_boolean, 0, &rasterizer_debug_options.stencil_mask_enabled }; -static struct hs_external_global_definition rasterizer_environment_definition = { "rasterizer_environment", _hs_type_boolean, 0, &rasterizer_debug_options.environment }; +static struct hs_external_global_definition rasterizer_environment_definition = { "rasterizer_environment", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment }; -static struct hs_external_global_definition rasterizer_environment_lightmaps_definition = { "rasterizer_environment_lightmaps", _hs_type_boolean, 0, &rasterizer_debug_options.environment_lightmaps }; +static struct hs_external_global_definition rasterizer_environment_lightmaps_definition = { "rasterizer_environment_lightmaps", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_lightmaps }; -static struct hs_external_global_definition rasterizer_environment_shadows_definition = { "rasterizer_environment_shadows", _hs_type_boolean, 0, &rasterizer_debug_options.environment_shadows }; +static struct hs_external_global_definition rasterizer_environment_shadows_definition = { "rasterizer_environment_shadows", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_shadows }; -static struct hs_external_global_definition rasterizer_environment_diffuse_lights_definition = { "rasterizer_environment_diffuse_lights", _hs_type_boolean, 0, &rasterizer_debug_options.environment_diffuse_lights }; +static struct hs_external_global_definition rasterizer_environment_diffuse_lights_definition = { "rasterizer_environment_diffuse_lights", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_diffuse_lights }; -static struct hs_external_global_definition rasterizer_environment_diffuse_textures_definition = { "rasterizer_environment_diffuse_textures", _hs_type_boolean, 0, &rasterizer_debug_options.environment_diffuse_textures }; +static struct hs_external_global_definition rasterizer_environment_diffuse_textures_definition = { "rasterizer_environment_diffuse_textures", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_textures }; -static struct hs_external_global_definition rasterizer_environment_decals_definition = { "rasterizer_environment_decals", _hs_type_boolean, 0, &rasterizer_debug_options.environment_decals }; +static struct hs_external_global_definition rasterizer_environment_decals_definition = { "rasterizer_environment_decals", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_decals }; -static struct hs_external_global_definition rasterizer_environment_specular_lights_definition = { "rasterizer_environment_specular_lights", _hs_type_boolean, 0, &rasterizer_debug_options.environment_specular_lights }; +static struct hs_external_global_definition rasterizer_environment_specular_lights_definition = { "rasterizer_environment_specular_lights", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_specular_lights }; -static struct hs_external_global_definition rasterizer_environment_specular_lightmaps_definition = { "rasterizer_environment_specular_lightmaps", _hs_type_boolean, 0, &rasterizer_debug_options.environment_specular_lightmaps }; +static struct hs_external_global_definition rasterizer_environment_specular_lightmaps_definition = { "rasterizer_environment_specular_lightmaps", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_specular_lightmaps }; -static struct hs_external_global_definition rasterizer_environment_reflection_lightmap_mask_definition = { "rasterizer_environment_reflection_lightmap_mask", _hs_type_boolean, 0, &rasterizer_debug_options.environment_reflection_lightmap_mask }; +static struct hs_external_global_definition rasterizer_environment_reflection_lightmap_mask_definition = { "rasterizer_environment_reflection_lightmap_mask", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_reflection_lightmap_masks }; -static struct hs_external_global_definition rasterizer_environment_reflection_mirrors_definition = { "rasterizer_environment_reflection_mirrors", _hs_type_boolean, 0, &rasterizer_debug_options.environment_reflection_mirrors }; +static struct hs_external_global_definition rasterizer_environment_reflection_mirrors_definition = { "rasterizer_environment_reflection_mirrors", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_reflection_mirrors }; -static struct hs_external_global_definition rasterizer_environment_reflections_definition = { "rasterizer_environment_reflections", _hs_type_boolean, 0, &rasterizer_debug_options.environment_reflections }; +static struct hs_external_global_definition rasterizer_environment_reflections_definition = { "rasterizer_environment_reflections", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_reflections }; -static struct hs_external_global_definition rasterizer_environment_transparents_definition = { "rasterizer_environment_transparents", _hs_type_boolean, 0, &rasterizer_debug_options.environment_transparents }; +static struct hs_external_global_definition rasterizer_environment_transparents_definition = { "rasterizer_environment_transparents", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_transparent_geometry }; -static struct hs_external_global_definition rasterizer_environment_fog_definition = { "rasterizer_environment_fog", _hs_type_boolean, 0, &rasterizer_debug_options.environment_fog }; +static struct hs_external_global_definition rasterizer_environment_fog_definition = { "rasterizer_environment_fog", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_fog }; -static struct hs_external_global_definition rasterizer_environment_fog_screen_definition = { "rasterizer_environment_fog_screen", _hs_type_boolean, 0, &rasterizer_debug_options.environment_fog_screen }; +static struct hs_external_global_definition rasterizer_environment_fog_screen_definition = { "rasterizer_environment_fog_screen", _hs_type_boolean, 0, &rasterizer_debug_options.draw_environment_fog_screen }; -static struct hs_external_global_definition rasterizer_water_definition = { "rasterizer_water", _hs_type_boolean, 0, &rasterizer_debug_options.water }; +static struct hs_external_global_definition rasterizer_water_definition = { "rasterizer_water", _hs_type_boolean, 0, &rasterizer_debug_options.draw_water }; -static struct hs_external_global_definition rasterizer_lens_flares_definition = { "rasterizer_lens_flares", _hs_type_boolean, 0, &rasterizer_debug_options.lens_flares }; +static struct hs_external_global_definition rasterizer_lens_flares_definition = { "rasterizer_lens_flares", _hs_type_boolean, 0, &rasterizer_debug_options.draw_lens_flares }; -static struct hs_external_global_definition rasterizer_dynamic_unlit_geometry_definition = { "rasterizer_dynamic_unlit_geometry", _hs_type_boolean, 0, &rasterizer_debug_options.dynamic_unlit_geometry }; +static struct hs_external_global_definition rasterizer_dynamic_unlit_geometry_definition = { "rasterizer_dynamic_unlit_geometry", _hs_type_boolean, 0, &rasterizer_debug_options.draw_dynamic_unlit_geometry }; -static struct hs_external_global_definition rasterizer_dynamic_lit_geometry_definition = { "rasterizer_dynamic_lit_geometry", _hs_type_boolean, 0, &rasterizer_debug_options.dynamic_lit_geometry }; +static struct hs_external_global_definition rasterizer_dynamic_lit_geometry_definition = { "rasterizer_dynamic_lit_geometry", _hs_type_boolean, 0, &rasterizer_debug_options.draw_dynamic_lit_geometry }; -static struct hs_external_global_definition rasterizer_dynamic_screen_geometry_definition = { "rasterizer_dynamic_screen_geometry", _hs_type_boolean, 0, &rasterizer_debug_options.dynamic_screen_geometry }; +static struct hs_external_global_definition rasterizer_dynamic_screen_geometry_definition = { "rasterizer_dynamic_screen_geometry", _hs_type_boolean, 0, &rasterizer_debug_options.draw_dynamic_screen_geometry }; -static struct hs_external_global_definition rasterizer_hud_motion_sensor_definition = { "rasterizer_hud_motion_sensor", _hs_type_boolean, 0, &rasterizer_debug_options.hud_motion_sensor }; +static struct hs_external_global_definition rasterizer_hud_motion_sensor_definition = { "rasterizer_hud_motion_sensor", _hs_type_boolean, 0, &rasterizer_debug_options.draw_hud_motion_sensor }; -static struct hs_external_global_definition rasterizer_detail_objects_definition = { "rasterizer_detail_objects", _hs_type_boolean, 0, &rasterizer_debug_options.detail_objects }; +static struct hs_external_global_definition rasterizer_detail_objects_definition = { "rasterizer_detail_objects", _hs_type_boolean, 0, &rasterizer_debug_options.draw_detail_objects }; -static struct hs_external_global_definition rasterizer_debug_geometry_definition = { "rasterizer_debug_geometry", _hs_type_boolean, 0, &rasterizer_debug_options.debug_geometry }; +static struct hs_external_global_definition rasterizer_debug_geometry_definition = { "rasterizer_debug_geometry", _hs_type_boolean, 0, &rasterizer_debug_options.draw_debug_geometry }; static struct hs_external_global_definition rasterizer_debug_geometry_multipass_definition = { "rasterizer_debug_geometry_multipass", _hs_type_boolean, 0, &rasterizer_debug_options.debug_geometry_multipass }; -static struct hs_external_global_definition rasterizer_fog_atmosphere_definition = { "rasterizer_fog_atmosphere", _hs_type_boolean, 0, &rasterizer_debug_options.fog_atmosphere }; +static struct hs_external_global_definition rasterizer_fog_atmosphere_definition = { "rasterizer_fog_atmosphere", _hs_type_boolean, 0, &rasterizer_debug_options.fog_atmospheric_enabled }; -static struct hs_external_global_definition rasterizer_fog_plane_definition = { "rasterizer_fog_plane", _hs_type_boolean, 0, &rasterizer_debug_options.fog_plane }; +static struct hs_external_global_definition rasterizer_fog_plane_definition = { "rasterizer_fog_plane", _hs_type_boolean, 0, &rasterizer_debug_options.fog_planar_enabled }; -static struct hs_external_global_definition rasterizer_bump_mapping_definition = { "rasterizer_bump_mapping", _hs_type_boolean, 0, &rasterizer_debug_options.bump_mapping }; +static struct hs_external_global_definition rasterizer_bump_mapping_definition = { "rasterizer_bump_mapping", _hs_type_boolean, 0, &rasterizer_debug_options.bump_mapping_enabled }; static struct hs_external_global_definition rasterizer_lightmap_ambient_definition = { "rasterizer_lightmap_ambient", _hs_type_real, 0, &rasterizer_debug_options.lightmap_ambient }; static struct hs_external_global_definition rasterizer_lightmap_mode_definition = { "rasterizer_lightmap_mode", _hs_type_short_integer, 0, &rasterizer_globals.lightmap_mode }; -static struct hs_external_global_definition rasterizer_lightmaps_incident_radiosity_definition = { "rasterizer_lightmaps_incident_radiosity", _hs_type_boolean, 0, &rasterizer_debug_options.lightmaps_incident_radiosity }; +static struct hs_external_global_definition rasterizer_lightmaps_incident_radiosity_definition = { "rasterizer_lightmaps_incident_radiosity", _hs_type_boolean, 0, &rasterizer_debug_options.lightmap_incident_radiosity_enabled }; -static struct hs_external_global_definition rasterizer_lightmaps_filtering_definition = { "rasterizer_lightmaps_filtering", _hs_type_boolean, 0, &rasterizer_debug_options.lightmaps_filtering }; +static struct hs_external_global_definition rasterizer_lightmaps_filtering_definition = { "rasterizer_lightmaps_filtering", _hs_type_boolean, 0, &rasterizer_debug_options.lightmap_filtering_enabled }; static struct hs_external_global_definition rasterizer_model_lighting_ambient_definition = { "rasterizer_model_lighting_ambient", _hs_type_real, 0, &rasterizer_debug_options.model_lighting_ambient }; -static struct hs_external_global_definition rasterizer_environment_alpha_testing_definition = { "rasterizer_environment_alpha_testing", _hs_type_boolean, 0, &rasterizer_debug_options.environment_alpha_testing }; +static struct hs_external_global_definition rasterizer_environment_alpha_testing_definition = { "rasterizer_environment_alpha_testing", _hs_type_boolean, 0, &rasterizer_debug_options.environment_alpha_testing_enabled }; -static struct hs_external_global_definition rasterizer_environment_specular_mask_definition = { "rasterizer_environment_specular_mask", _hs_type_boolean, 0, &rasterizer_debug_options.environment_specular_mask }; +static struct hs_external_global_definition rasterizer_environment_specular_mask_definition = { "rasterizer_environment_specular_mask", _hs_type_boolean, 0, &rasterizer_debug_options.environment_specular_mask_enabled }; -static struct hs_external_global_definition rasterizer_shadows_convolution_definition = { "rasterizer_shadows_convolution", _hs_type_boolean, 0, &rasterizer_debug_options.shadows_convolution }; +static struct hs_external_global_definition rasterizer_shadows_convolution_definition = { "rasterizer_shadows_convolution", _hs_type_boolean, 0, &rasterizer_debug_options.shadow_convolution_enabled }; -static struct hs_external_global_definition rasterizer_shadows_debug_definition = { "rasterizer_shadows_debug", _hs_type_boolean, 0, &rasterizer_debug_options.shadows_debug }; +static struct hs_external_global_definition rasterizer_shadows_debug_definition = { "rasterizer_shadows_debug", _hs_type_boolean, 0, &rasterizer_debug_options.shadow_debug_enabled }; -static struct hs_external_global_definition rasterizer_water_mipmapping_definition = { "rasterizer_water_mipmapping", _hs_type_boolean, 0, &rasterizer_debug_options.water_mipmapping }; +static struct hs_external_global_definition rasterizer_water_mipmapping_definition = { "rasterizer_water_mipmapping", _hs_type_boolean, 0, &rasterizer_debug_options.water_mipmapping_enabled }; -static struct hs_external_global_definition rasterizer_active_camouflage_definition = { "rasterizer_active_camouflage", _hs_type_boolean, 0, &rasterizer_debug_options.active_camouflage }; +static struct hs_external_global_definition rasterizer_active_camouflage_definition = { "rasterizer_active_camouflage", _hs_type_boolean, 0, &rasterizer_debug_options.active_camouflage_enabled }; -static struct hs_external_global_definition rasterizer_active_camouflage_multipass_definition = { "rasterizer_active_camouflage_multipass", _hs_type_boolean, 0, &rasterizer_debug_options.active_camouflage_multipass }; +static struct hs_external_global_definition rasterizer_active_camouflage_multipass_definition = { "rasterizer_active_camouflage_multipass", _hs_type_boolean, 0, &rasterizer_debug_options.active_camouflage_multipass_enabled }; -static struct hs_external_global_definition rasterizer_plasma_energy_definition = { "rasterizer_plasma_energy", _hs_type_boolean, 0, &rasterizer_debug_options.plasma_energy }; +static struct hs_external_global_definition rasterizer_plasma_energy_definition = { "rasterizer_plasma_energy", _hs_type_boolean, 0, &rasterizer_debug_options.plasma_energy_enabled }; -static struct hs_external_global_definition rasterizer_lens_flares_occlusion_definition = { "rasterizer_lens_flares_occlusion", _hs_type_boolean, 0, &rasterizer_debug_options.lens_flares_occlusion }; +static struct hs_external_global_definition rasterizer_lens_flares_occlusion_definition = { "rasterizer_lens_flares_occlusion", _hs_type_boolean, 0, &rasterizer_debug_options.lens_flare_occlusion_enabled }; -static struct hs_external_global_definition rasterizer_lens_flares_occlusion_debug_definition = { "rasterizer_lens_flares_occlusion_debug", _hs_type_boolean, 0, &rasterizer_debug_options.lens_flares_occlusion_debug }; +static struct hs_external_global_definition rasterizer_lens_flares_occlusion_debug_definition = { "rasterizer_lens_flares_occlusion_debug", _hs_type_boolean, 0, &rasterizer_debug_options.lens_flare_occlusion_debug }; -static struct hs_external_global_definition rasterizer_ray_of_buddha_definition = { "rasterizer_ray_of_buddha", _hs_type_boolean, 0, &rasterizer_debug_options.ray_of_buddha }; +static struct hs_external_global_definition rasterizer_ray_of_buddha_definition = { "rasterizer_ray_of_buddha", _hs_type_boolean, 0, &rasterizer_debug_options.lens_flare_sun_glow_enabled }; -static struct hs_external_global_definition rasterizer_screen_flashes_definition = { "rasterizer_screen_flashes", _hs_type_boolean, 0, &rasterizer_debug_options.screen_flashes }; +static struct hs_external_global_definition rasterizer_screen_flashes_definition = { "rasterizer_screen_flashes", _hs_type_boolean, 0, &rasterizer_debug_options.screen_flash_enabled }; -static struct hs_external_global_definition rasterizer_screen_effects_definition = { "rasterizer_screen_effects", _hs_type_boolean, 0, &rasterizer_debug_options.screen_effects }; +static struct hs_external_global_definition rasterizer_screen_effects_definition = { "rasterizer_screen_effects", _hs_type_boolean, 0, &rasterizer_debug_options.screen_effects_enabled }; -static struct hs_external_global_definition rasterizer_DXTC_noise_definition = { "rasterizer_DXTC_noise", _hs_type_boolean, 0, &rasterizer_debug_options.DXTC_noise }; +static struct hs_external_global_definition rasterizer_DXTC_noise_definition = { "rasterizer_DXTC_noise", _hs_type_boolean, 0, &rasterizer_debug_options.DXTC_noise_enabled }; -static struct hs_external_global_definition rasterizer_soft_filter_definition = { "rasterizer_soft_filter", _hs_type_boolean, 0, &rasterizer_debug_options.soft_filter }; +static struct hs_external_global_definition rasterizer_soft_filter_definition = { "rasterizer_soft_filter", _hs_type_boolean, 0, &rasterizer_debug_options.soft_filter_enabled }; -static struct hs_external_global_definition rasterizer_secondary_render_target_debug_definition = { "rasterizer_secondary_render_target_debug", _hs_type_boolean, 0, &rasterizer_debug_options.secondary_render_target_debug }; +static struct hs_external_global_definition rasterizer_secondary_render_target_debug_definition = { "rasterizer_secondary_render_target_debug", _hs_type_boolean, 0, &rasterizer_debug_options.secondary_render_target_debug_enabled }; -static struct hs_external_global_definition rasterizer_profile_log_definition = { "rasterizer_profile_log", _hs_type_boolean, 0, &rasterizer_debug_options.profile_log }; +static struct hs_external_global_definition rasterizer_profile_log_definition = { "rasterizer_profile_log", _hs_type_boolean, 0, &rasterizer_debug_options.profile_log_enabled }; -static struct hs_external_global_definition rasterizer_detail_objects_offset_multiplier_definition = { "rasterizer_detail_objects_offset_multiplier", _hs_type_real, 0, &rasterizer_debug_options.detail_objects_offset_multiplier }; +static struct hs_external_global_definition rasterizer_detail_objects_offset_multiplier_definition = { "rasterizer_detail_objects_offset_multiplier", _hs_type_real, 0, &rasterizer_debug_options.detail_object_screen_facing_offset_multiplier }; static struct hs_external_global_definition rasterizer_zbias_definition = { "rasterizer_zbias", _hs_type_long_integer, 0, &rasterizer_debug_options.zbias }; @@ -1239,15 +1239,15 @@ static struct hs_external_global_definition rasterizer_zoffset_definition = { "r static struct hs_external_global_definition force_all_player_views_to_default_player_definition = { "force_all_player_views_to_default_player", _hs_type_boolean, 0, &rasterizer_debug_options.force_all_player_views_to_default_player }; -static struct hs_external_global_definition rasterizer_safe_frame_bounds_definition = { "rasterizer_safe_frame_bounds", _hs_type_boolean, 0, &rasterizer_debug_options.safe_frame_bounds }; +static struct hs_external_global_definition rasterizer_safe_frame_bounds_definition = { "rasterizer_safe_frame_bounds", _hs_type_boolean, 0, &rasterizer_debug_options.safe_frame_bounds_adjust_enabled }; static struct hs_external_global_definition freeze_flying_camera_definition = { "freeze_flying_camera", _hs_type_short_integer, 0, &rasterizer_debug_options.freeze_flying_camera }; -static struct hs_external_global_definition rasterizer_zsprites_definition = { "rasterizer_zsprites", _hs_type_boolean, 0, &rasterizer_debug_options.zsprites }; +static struct hs_external_global_definition rasterizer_zsprites_definition = { "rasterizer_zsprites", _hs_type_boolean, 0, &rasterizer_debug_options.zsprite_enabled }; -static struct hs_external_global_definition rasterizer_filthy_decal_fog_hack_definition = { "rasterizer_filthy_decal_fog_hack", _hs_type_boolean, 0, &rasterizer_debug_options.filthy_decal_fog_hack }; +static struct hs_external_global_definition rasterizer_filthy_decal_fog_hack_definition = { "rasterizer_filthy_decal_fog_hack", _hs_type_boolean, 0, &rasterizer_debug_options.filthy_decal_fog_hack_enabled }; -static struct hs_external_global_definition rasterizer_splitscreen_VB_optimization_definition = { "rasterizer_splitscreen_VB_optimization", _hs_type_boolean, 0, &rasterizer_debug_options.splitscreen_VB_optimization }; +static struct hs_external_global_definition rasterizer_splitscreen_VB_optimization_definition = { "rasterizer_splitscreen_VB_optimization", _hs_type_boolean, 0, &rasterizer_debug_options.splitscreen_VB_optimization_enabled }; static struct hs_external_global_definition rasterizer_profile_print_locks_definition = { "rasterizer_profile_print_locks", _hs_type_boolean, 0, &rasterizer_debug_options.profile_print_locks }; diff --git a/source/hs/hs_library_external.c b/source/hs/hs_library_external.c index 82d7168b..e9c465a6 100644 --- a/source/hs/hs_library_external.c +++ b/source/hs/hs_library_external.c @@ -90,19 +90,20 @@ symbols in this file: #include "cseries.h" #include "cseries/errors.h" +#include "interface/terminal.h" #include "main/console.h" #include "memory/data.h" #include "models/model_definitions.h" #include "objects/damage.h" #include "objects/objects.h" #include "effects/effects.h" -#include "game/player_control.h" #include "game/players.h" #include "items/items.h" #include "scenario/scenario.h" #include "scenario/scenario_definitions.h" #include "sound/sound_definitions.h" #include "units/units.h" +#include "object_lists.h" /* ---------- constants */ @@ -147,19 +148,6 @@ struct hs_looping_sound_definition /* ---------- prototypes */ -long object_index_from_name_index( - short name_index); -long object_list_new( - void); -void object_list_add( - long object_list_index, - long object_index); -long object_list_get_first( - long object_list_index, - long *reference_index); -long object_list_get_next( - long object_list_index, - long *reference_index); boolean hs_trigger_volume_test_objects( short trigger_volume_index, long object_list_index, @@ -170,19 +158,6 @@ void hs_object_create_anew( short object_name_index); void hs_object_destroy( long object_index); -void terminal_printf( - union real_argb_color const *color, - char const *format, - ...); -void area_of_effect_cause_damage( - struct damage_data *damage, - long unlucky_object_index); -boolean player_teleport( - long player_index, - long source_unit_index, - real_point3d const *position); -void unit_exit_seat_end( - long unit_index); /* ---------- globals */ diff --git a/source/hs/hs_library_external.h b/source/hs/hs_library_external.h index b84710b8..df5698d8 100644 --- a/source/hs/hs_library_external.h +++ b/source/hs/hs_library_external.h @@ -16,8 +16,81 @@ header included in hcex build. /* ---------- prototypes/EXAMPLE.C */ +boolean hs_not( + boolean value); +void hs_print( + char const *message); +long hs_players( + void); +boolean hs_objects_can_see_object( + long object_list_index, + long object_index, + real degrees); +boolean hs_objects_can_see_flag( + long object_list_index, + short cutscene_flag_index, + real degrees); +void hs_object_create( + short object_name_index); void hs_object_destroy( long object_index); +void hs_object_destroy_all( + void); +void hs_object_create_containing( + char const *object_name); +void hs_object_destroy_containing( + char const *object_name); +long hs_object_list_get_element( + long object_list_index, + short element_index); +void hs_object_set_shield( + long object_index, + real shield_vitality); +void hs_object_set_permutation( + long object_index, + char const *region_name, + char const *permutation_name); +void hs_objects_predict( + long object_list_index); +void hs_objects_delete_by_definition( + long definition_index); +void hs_effect_new( + long effect_definition_index, + short cutscene_flag_index); +void hs_effect_new_from_object_marker( + long effect_definition_index, + long object_index, + char const *marker_name); +void hs_damage_new( + long damage_definition_index, + short cutscene_flag_index); +void hs_damage_object( + long damage_definition_index, + long object_index); +real hs_sound_get_gain( + char const *tag_name); +void hs_sound_set_gain( + char const *tag_name, + real gain); +boolean hs_trigger_volume_test_objects_all( + short trigger_volume_index, + long object_list_index); +boolean hs_trigger_volume_test_objects_any( + short trigger_volume_index, + long object_list_index); +void hs_object_create_anew( + short object_name_index); +void hs_object_create_anew_containing( + char const *object_name); +void hs_object_teleport( + long object_index, + short cutscene_flag_index); +void hs_object_set_facing( + long object_index, + short cutscene_flag_index); +void hs_teleport_players_not_in_trigger_volume( + short trigger_volume_index, + short cutscene_flag_index); /* ---------- globals */ diff --git a/source/hs/hs_library_internal.h b/source/hs/hs_library_internal.h index 1b8c126a..fca475b9 100644 --- a/source/hs/hs_library_internal.h +++ b/source/hs/hs_library_internal.h @@ -16,6 +16,109 @@ header included in hcex build. /* ---------- prototypes/EXAMPLE.C */ +/* ---------- prototypes/HS_RUNTIME.C */ + +void hs_evaluate_begin( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_equality( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_inequality( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_logical( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_if( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_set( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_inspect( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_arithmetic( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_object_cast_up( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_begin_random( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_debug_string( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_sleep_until( + short function_index, + long thread_index, + boolean initialize); +void hs_evaluate_sleep( + short function_index, + long thread_index, + boolean initialize); + +/* ---------- prototypes/HS_COMPILE.C */ + +boolean hs_macro_function_parse( + short function_index, + long expression_index); +boolean hs_parse_begin( + short function_index, + long expression_index); +boolean hs_parse_if( + short function_index, + long expression_index); +boolean hs_parse_cond( + short function_index, + long expression_index); +boolean hs_parse_set( + short function_index, + long expression_index); +boolean hs_parse_logical( + short function_index, + long expression_index); +boolean hs_parse_arithmetic( + short function_index, + long expression_index); +boolean hs_parse_equality( + short function_index, + long expression_index); +boolean hs_parse_inequality( + short function_index, + long expression_index); +boolean hs_parse_sleep( + short function_index, + long expression_index); +boolean hs_parse_sleep_until( + short function_index, + long expression_index); +boolean hs_parse_wake( + short function_index, + long expression_index); +boolean hs_parse_inspect( + short function_index, + long expression_index); +boolean hs_parse_object_cast_up( + short function_index, + long expression_index); +boolean hs_parse_debug_string( + short function_index, + long expression_index); + /* ---------- globals */ /* ---------- public code */ diff --git a/source/hs/hs_library_internal_compile.h b/source/hs/hs_library_internal_compile.h index 61146d91..80ebfedf 100644 --- a/source/hs/hs_library_internal_compile.h +++ b/source/hs/hs_library_internal_compile.h @@ -16,66 +16,6 @@ file has inline function assertions. /* ---------- prototypes/HS_COMPILE.C */ -void hs_compile_initialize( - boolean compiling_scenario); -void hs_compile_dispose( - void); -long hs_compile_expression( - long source_size, - char const *source, - char const **error_message, - char const **error_source); - -boolean hs_compile_postprocess( - char const **error_message, - char const **error_source); -boolean hs_parse_sleep( - short function_index, - long expression_index); - -boolean hs_macro_function_parse( - short function_index, - long expression_index); -boolean hs_parse_if( - short function_index, - long expression_index); -boolean hs_parse_begin( - short function_index, - long expression_index); -boolean hs_parse_logical( - short function_index, - long expression_index); -boolean hs_parse_arithmetic( - short function_index, - long expression_index); -boolean hs_parse_equality( - short function_index, - long expression_index); -boolean hs_parse_inequality( - short function_index, - long expression_index); -boolean hs_parse_cond( - short function_index, - long expression_index); -boolean hs_parse_set( - short function_index, - long expression_index); -boolean hs_parse_sleep_until( - short function_index, - long expression_index); -boolean hs_parse_wake( - short function_index, - long expression_index); -boolean hs_parse_object_cast_up( - short function_index, - long expression_index); -boolean hs_parse_debug_string( - short function_index, - long expression_index); -boolean hs_parse_inspect( - short function_index, - long expression_index); - /* ---------- globals */ /* ---------- public code */ diff --git a/source/hs/hs_library_internal_runtime.h b/source/hs/hs_library_internal_runtime.h index 1a34123b..6b51fde9 100644 --- a/source/hs/hs_library_internal_runtime.h +++ b/source/hs/hs_library_internal_runtime.h @@ -16,16 +16,6 @@ file has inline function assertions. /* ---------- prototypes/HS_RUNTIME.C */ -void hs_evaluate_inequality( - short function_index, - long thread_index, - boolean initialize); - -void hs_evaluate_set( - short function_index, - long thread_index, - boolean initialize); - /* ---------- globals */ /* ---------- public code */ diff --git a/source/hs/hs_runtime.c b/source/hs/hs_runtime.c index 3a5263af..2fb40de0 100644 --- a/source/hs/hs_runtime.c +++ b/source/hs/hs_runtime.c @@ -265,6 +265,7 @@ symbols in this file: #include "ai/ai_debug_scripting.h" #include "ai/ai_script.h" #include "hs/hs.h" +#include "hs/hs_library_internal.h" #include "hs/hs_library_internal_runtime.h" #include "hs/object_lists.h" #include "hs/hs_scenario_definitions.h" diff --git a/source/hs/hs_scenario_definitions.c b/source/hs/hs_scenario_definitions.c index 7aaa4314..c5cbc3ba 100644 --- a/source/hs/hs_scenario_definitions.c +++ b/source/hs/hs_scenario_definitions.c @@ -61,6 +61,7 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "hs/hs.h" #include "hs/hs_scenario_definitions.h" #include "memory/byte_swapping.h" #include "memory/data.h" @@ -73,8 +74,6 @@ symbols in this file: /* ---------- prototypes */ -extern char *hs_script_type_names[]; -extern char *hs_type_names[]; static void hs_syntax_data_byte_swap( void *owner, void *data, diff --git a/source/hs/object_lists.h b/source/hs/object_lists.h index f8d851ef..00d51a7e 100644 --- a/source/hs/object_lists.h +++ b/source/hs/object_lists.h @@ -46,6 +46,8 @@ void object_list_remove_reference( long object_list_index); void object_list_gc( void); +short object_list_count( + long object_list_index); /* ---------- globals */ diff --git a/source/input/input_abstraction.c b/source/input/input_abstraction.c index 8ea3598f..bb07a829 100644 --- a/source/input/input_abstraction.c +++ b/source/input/input_abstraction.c @@ -57,7 +57,6 @@ symbols in this file: #include "cseries/errors.h" #include "cseries/cseries_windows.h" #include "game/game_globals.h" -#include "game/player_control.h" #include "game/players.h" #include "input/input.h" #include "input/input_abstraction.h" diff --git a/source/input/input_abstraction.h b/source/input/input_abstraction.h index bf2e6df5..9bdfa0a4 100644 --- a/source/input/input_abstraction.h +++ b/source/input/input_abstraction.h @@ -37,6 +37,8 @@ typedef char verify_game_input_preferences_size[ void input_abstraction_initialize( void); +void input_abstraction_dispose( + void); void input_abstraction_update( void); void input_abstraction_update_device_changes( diff --git a/source/input/input_xbox.c b/source/input/input_xbox.c index aac4ecf1..0f279850 100644 --- a/source/input/input_xbox.c +++ b/source/input/input_xbox.c @@ -385,13 +385,13 @@ void update_ticks( return; } -void input_unidentified_noop_1( +static void acquire_input_mutex( void) { return; } -void input_unidentified_noop_2( +static void release_input_mutex( void) { return; @@ -667,6 +667,7 @@ void input_frame_begin( void) { input_get_device_states(); + acquire_input_mutex(); input_globals.frame_active = TRUE; return; @@ -676,6 +677,7 @@ void input_frame_end( void) { input_globals.frame_active = FALSE; + release_input_mutex(); return; } @@ -1126,7 +1128,9 @@ static DWORD WINAPI input_keyboard_thread( for (;;) { WaitForSingleObject(input_globals.update_event_handle, INFINITE); + acquire_input_mutex(); input_flush_rumble(); + release_input_mutex(); } return ERROR_SUCCESS; diff --git a/source/interface/attract_mode.c b/source/interface/attract_mode.c index 127a4501..de29eb33 100644 --- a/source/interface/attract_mode.c +++ b/source/interface/attract_mode.c @@ -28,10 +28,6 @@ enum /* ---------- prototypes */ -/* random_math.c doesn't appear to have a header? */ -extern unsigned long *get_global_local_random_seed_address(void); -extern short seed_random_range(unsigned long *seed, short lower_bound, short upper_bound); - /* ---------- globals */ static unsigned long attract_mode_countdown_timer; diff --git a/source/interface/first_person_weapons.c b/source/interface/first_person_weapons.c index 09f5628d..06b0a72c 100644 --- a/source/interface/first_person_weapons.c +++ b/source/interface/first_person_weapons.c @@ -108,18 +108,16 @@ symbols in this file: #include "effects/effects.h" #include "effects/particles.h" #include "game/game_globals.h" -#include "game/player_control.h" #include "game/players.h" #include "items/weapon_datum_flags.h" #include "items/weapon_definitions.h" #include "items/weapons.h" -#include "models/model_animations.h" +#include "models/model_animation_definitions.h" #include "models/model_definitions.h" #include "models/models.h" #include "networking/network_connection.h" #include "objects/objects.h" #include "render/render.h" -#include "render/render_objects.h" #include "saved games/game_state.h" #include "scenario/scenario.h" #include "sound/game_sound.h" diff --git a/source/interface/hud.c b/source/interface/hud.c index 7a5568d0..2eedfe4e 100644 --- a/source/interface/hud.c +++ b/source/interface/hud.c @@ -83,7 +83,6 @@ symbols in this file: #include "devices/device_controls.h" #include "game/game_engine.h" #include "game/game_globals.h" -#include "game/player_control.h" #include "game/players.h" #include "interface/hud.h" #include "interface/hud_definitions.h" @@ -192,6 +191,13 @@ typedef char weapon_interface_state_size_assert[ sizeof(struct weapon_interface_state) == 0x20 ? 1 : -1]; /* ---------- prototypes */ +static void hud_draw_players( + void); +static void temporary_hud_draw_reticle( + real angle, + union real_argb_color const *color); +static void temporary_hud_draw( + void); /* ---------- globals */ @@ -199,7 +205,7 @@ struct hud_globals_definition *hud_globals = NULL; struct hud_scripted_globals_definition *hud_scripted_globals = NULL; extern boolean temporary_hud; -wchar_t const *default_string = L""; +static wchar_t const *default_string = L""; /* ---------- public code */ @@ -792,7 +798,7 @@ void hud_picked_up_powerup( return; } -void temporary_hud_draw_reticle( +static void temporary_hud_draw_reticle( real angle, real_argb_color const *color) { @@ -945,7 +951,7 @@ static void hud_draw_friendly_indicator( return; } -void hud_draw_players( +static void hud_draw_players( void) { long player_index = local_player_get_player_index(render.local_player_index); @@ -981,7 +987,7 @@ void hud_draw_players( return; } -void temporary_hud_draw( +static void temporary_hud_draw( void) { long player_index = local_player_get_player_index(render.local_player_index); diff --git a/source/interface/hud.h b/source/interface/hud.h index c2fdc55e..850431f6 100644 --- a/source/interface/hud.h +++ b/source/interface/hud.h @@ -34,6 +34,10 @@ void hud_dispose( void); void hud_dispose_from_old_map( void); +boolean scripted_show_hud( + boolean show); +boolean scripted_show_hud_help_text( + boolean show); void hud_update( void); void hud_initialize_for_new_map( @@ -46,6 +50,38 @@ void hud_dispose_nav_points_from_old_map( void); void hud_dispose_nav_points( void); +void hud_activate_team_nav_point_with_flag( + short nav_index, + short team_index, + short flag_index, + float vertical_offset); +void hud_activate_team_nav_point_with_object( + short nav_index, + short team_index, + long object_index, + float vertical_offset); +void hud_deactivate_team_nav_point_with_flag( + short team_index, + short flag_index); +void hud_deactivate_team_nav_point_with_object( + short team_index, + long object_index); +void hud_unit_activate_nav_point_with_flag( + short nav_index, + long unit_index, + short flag_index, + float vertical_offset); +void hud_unit_activate_nav_point_with_object( + short nav_index, + long unit_index, + long object_index, + float vertical_offset); +void hud_unit_deactivate_nav_point_with_flag( + long unit_index, + short flag_index); +void hud_unit_deactivate_nav_point_with_object( + long unit_index, + long object_index); void hud_update_nav_points( void); @@ -56,8 +92,6 @@ void hud_load( boolean load); void hud_autosave( boolean active); -void hud_draw_players( - void); void hud_picked_up_powerup( short local_player_index, @@ -74,11 +108,6 @@ void hud_picked_up_weapon( long weapon_definition_index); void hud_render_nav_points( short local_player_index); -void temporary_hud_draw_reticle( - real angle, - union real_argb_color const *color); -void temporary_hud_draw( - void); void hud_draw_screen( void); diff --git a/source/interface/hud_draw.c b/source/interface/hud_draw.c index 2f8f3523..92e98c35 100644 --- a/source/interface/hud_draw.c +++ b/source/interface/hud_draw.c @@ -91,7 +91,6 @@ symbols in this file: #include "cache/texture_cache.h" #include "effects/particles.h" #include "game/game.h" -#include "game/player_control.h" #include "game/players.h" #include "interface/hud_definitions.h" #include "interface/hud_draw.h" diff --git a/source/interface/hud_draw.h b/source/interface/hud_draw.h index f041b019..c0b53469 100644 --- a/source/interface/hud_draw.h +++ b/source/interface/hud_draw.h @@ -66,7 +66,7 @@ void hud_retrieve_bitmap_and_bounding_rect( struct bitmap_data const **bitmap, real_rectangle2d const **clip); long fast_ftol_C( - real value); + real x); pixel32 real_alpha_intensity_to_pixel32( real alpha, real intensity); diff --git a/source/interface/hud_messaging.c b/source/interface/hud_messaging.c index 161cf78c..20a816c9 100644 --- a/source/interface/hud_messaging.c +++ b/source/interface/hud_messaging.c @@ -133,6 +133,7 @@ symbols in this file: #include "interface/interface.h" #include "interface/ui_widget.h" #include "items/item_definitions.h" +#include "memory/data.h" #include "rasterizer/rasterizer.h" #include "render/render.h" #include "render/render_debug.h" diff --git a/source/interface/hud_messaging.h b/source/interface/hud_messaging.h index 8f82ad9a..76cb0e90 100644 --- a/source/interface/hud_messaging.h +++ b/source/interface/hud_messaging.h @@ -27,21 +27,38 @@ void hud_messaging_dispose_from_old_map( void); void hud_messaging_dispose( void); +void scripted_hud_set_state_message( + short message_index); void hud_messaging_globals_update( void); void scripted_hud_set_flashing_state( boolean flash); +void scripted_hud_restart_flashing( + void); void scripted_hud_set_objective( short message_index); void scripted_hud_set_timer_position( short x, short y, short corner); +void scripted_hud_show_timer( + boolean show); +void scripted_hud_pause_timer( + boolean pause); void scripted_hud_set_timer_time( short minutes, word seconds); +void scripted_hud_set_timer_warning_cutoff( + short minutes, + word seconds); short scripted_hud_get_timer_ticks( void); +void scripted_hud_time_code_show( + boolean show); +void scripted_hud_time_code_start( + boolean start); +void scripted_hud_time_code_reset( + void); void scripted_hud_messages_clear( void); void hud_render_timer( diff --git a/source/interface/hud_nav_points.c b/source/interface/hud_nav_points.c index b44af9b0..e4d21d01 100644 --- a/source/interface/hud_nav_points.c +++ b/source/interface/hud_nav_points.c @@ -99,7 +99,9 @@ symbols in this file: /* ---------- headers */ #include "cseries/cseries.h" +#include "cseries/errors.h" #include "game_state.h" +#include "game/game_engine.h" #include "game/players.h" #include "networking/network_connection.h" #include "memory/data.h" @@ -222,26 +224,6 @@ struct hud_nav_object_datum static void hud_update_nav_point_local_player( short local_player_index); -void *object_try_and_get_and_verify_type( - long object_index, - unsigned long valid_type_flags); - -void object_get_bounding_sphere( - long object_index, - real_point3d *center, - real *radius); - -real_point3d *game_engine_get_goal_position( - real_point3d *position, - short goal_index); - -void game_engine_render_nav_points( - short local_player_index); - -void unit_get_head_position( - long unit_index, - real_point3d *head_position); - /* ---------- globals */ static struct hud_nav_point_player_datum *nav_point_data; diff --git a/source/interface/hud_unit.c b/source/interface/hud_unit.c index 0ad26fe4..5b04897f 100644 --- a/source/interface/hud_unit.c +++ b/source/interface/hud_unit.c @@ -98,11 +98,6 @@ enum _hud_panel_motion_sensor_blink_bit }; -enum -{ - MAXIMUM_NUMBER_OF_LOCAL_PLAYERS = 4, -}; - enum hud_damage_indicator_direction { _hud_damage_indicator_top = 0, diff --git a/source/interface/hud_weapon.c b/source/interface/hud_weapon.c index f659be49..8795f64a 100644 --- a/source/interface/hud_weapon.c +++ b/source/interface/hud_weapon.c @@ -58,7 +58,6 @@ symbols in this file: #include "cache/texture_cache.h" #include "game/game.h" #include "game/game_globals.h" -#include "game/player_control.h" #include "game/players.h" #include "interface/hud_draw.h" #include "interface/hud.h" diff --git a/source/interface/interface.c b/source/interface/interface.c index c24512e6..996b8957 100644 --- a/source/interface/interface.c +++ b/source/interface/interface.c @@ -82,7 +82,6 @@ symbols in this file: #include "effects/particles.h" #include "game/game_globals.h" #include "game/game_engine.h" -#include "game/player_control.h" #include "game/players.h" #include "interface/first_person_weapons.h" #include "interface/hud.h" diff --git a/source/interface/marketing_and_strategic_business_development.c b/source/interface/marketing_and_strategic_business_development.c index 7d98655d..ed3ebbf4 100644 --- a/source/interface/marketing_and_strategic_business_development.c +++ b/source/interface/marketing_and_strategic_business_development.c @@ -122,6 +122,6 @@ static void clean_up_for_image_launch( } match_vassert("c:\\halo\\SOURCE\\interface\\marketing_and_strategic_business_development.c", 64, - SUCCEEDED(IDirect3DDevice8_PersistDisplay(&global_d3d_device)), + SUCCEEDED(IDirect3DDevice8_PersistDisplay(global_d3d_device)), "IDirect3DDevice8_PersistDisplay() failed in clean_up_for_image_launch()"); } diff --git a/source/interface/motion_sensor.c b/source/interface/motion_sensor.c index 12f8f13c..5aec1662 100644 --- a/source/interface/motion_sensor.c +++ b/source/interface/motion_sensor.c @@ -98,7 +98,6 @@ symbols in this file: #include "game/game.h" #include "game/game_allegiance.h" #include "game/game_engine.h" -#include "game/player_control.h" #include "game/players.h" #include "game_state.h" #include "interface/hud.h" diff --git a/source/interface/player_ui.c b/source/interface/player_ui.c index 6ac16ed8..644c6ad1 100644 --- a/source/interface/player_ui.c +++ b/source/interface/player_ui.c @@ -167,7 +167,6 @@ symbols in this file: enum { - MAXIMUM_NUMBER_OF_LOCAL_PLAYERS = 4, _variant_is_system_default_bit = 0 }; diff --git a/source/interface/player_ui.h b/source/interface/player_ui.h index 16346bf2..dc87e76c 100644 --- a/source/interface/player_ui.h +++ b/source/interface/player_ui.h @@ -61,8 +61,6 @@ void player_ui_clear_multiplayer_autojoin_for_local_player( short local_player_index); short player_ui_get_last_single_player_level_played( short local_player_index); -short player_ui_get_single_player_local_player_controller( - short local_player_index); void player_ui_local_player_joined_multiplayer_game( short local_player_index); boolean player_ui_rumble_disabled( diff --git a/source/interface/progress_bar.c b/source/interface/progress_bar.c index 7b4d990b..a59196ce 100644 --- a/source/interface/progress_bar.c +++ b/source/interface/progress_bar.c @@ -182,6 +182,8 @@ symbols in this file: * ABI and code shape. */ #include +#include "rasterizer/xbox/rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" #include "interface/progress_bar_internal.h" @@ -221,28 +223,6 @@ struct progress_bar_mode unsigned char padding1[3]; }; -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - struct gravy_layer { real texture_width; @@ -285,7 +265,7 @@ static void draw_layer_int( real alpha, real progress); -void draw_layer( +static void draw_layer( real distance, real alpha, real_rgb_color const *color, @@ -333,7 +313,6 @@ void tgaLoadImageData( /* ---------- globals */ -extern void *global_d3d_device; extern struct pixel_shader_definition blur_shader; extern struct pixel_shader_definition regular_shader; extern unsigned long current_time; @@ -1915,7 +1894,7 @@ static void draw_layer_int( return; } -void draw_layer( +static void draw_layer( real distance, real alpha, real_rgb_color const *color, @@ -1939,16 +1918,7 @@ static void draw_initial_layer( real_rgb_color const *color, real progress) { - struct gravy_layer layer; - - layer.texture_width= 640.f; - layer.texture_height= 480.f; - layer.x= 0.f; - layer.y= 0.f; - layer.half_width= (real)fabs(640.0/2.0); - layer.half_height= (real)fabs(480.0/2.0); - layer.distance= 0.f; - draw_layer_int(&layer, color, 1.f, progress); + draw_layer(0.f, 1.f, color, progress); return; } diff --git a/source/interface/progress_bar.h b/source/interface/progress_bar.h index d8701bc6..819f508f 100644 --- a/source/interface/progress_bar.h +++ b/source/interface/progress_bar.h @@ -33,6 +33,8 @@ boolean progress_bar_is_active( void); void progress_bar_enable( boolean enabled); +void progress_bar_eachframe( + void); void progress_bar_display( real progress); boolean progress_bar_is_stuff_ready( diff --git a/source/interface/ui_widget.c b/source/interface/ui_widget.c index 2500adbe..e2f41181 100644 --- a/source/interface/ui_widget.c +++ b/source/interface/ui_widget.c @@ -639,7 +639,6 @@ struct widget_instance; #include "event_manager.h" #include "game/game_engine.h" #include "game/game_globals.h" -#include "game/player_control.h" #include "game/players.h" #include "hs/hs.h" #include "input/input.h" diff --git a/source/interface/ui_widget_event_handler_functions.c b/source/interface/ui_widget_event_handler_functions.c index 182b2f3d..73bd5913 100644 --- a/source/interface/ui_widget_event_handler_functions.c +++ b/source/interface/ui_widget_event_handler_functions.c @@ -910,10 +910,22 @@ symbols in this file: #include "cseries.h" #include "bungie_net/network/transport.h" #include "bungie_net/network/transport_endpoint_winsock.h" +#include "cseries/errors.h" +#include "game/game_engine.h" +#include "interface/marketing_and_strategic_business_development.h" #include "interface/player_ui.h" +#include "interface/ui_widget.h" +#include "main/console.h" #include "main/main.h" +#include "networking/network_game_globals.h" +#include "networking/network_game_manager.h" +#include "networking/network_messages.h" +#include "networking/network_server_manager.h" +#include "saved games/game_state.h" #include "saved games/player_profile.h" #include "interface/ui_widget_definitions.h" +#include "saved games/saved_game_files.h" +#include "text/unicode.h" /* ---------- constants */ @@ -963,11 +975,6 @@ struct event_record short controller_index; }; -struct network_player_data -{ - byte data[0x20]; -}; - struct network_game_join_descriptor { byte unknown00[2]; @@ -1008,123 +1015,41 @@ struct playlist_profile_item_options_prefix /* ---------- prototypes */ -void game_state_save_to_persistent_storage( - void); -void xbox_dashboard_launch( - void); -void dispose_global_network_game_client( - void); -void dispose_global_network_game_server( - void); -void game_engine_playlist_initialize( - void); void game_engine_playlist_next( long, long, long); -void network_game_set_quickstart_local( - void); -void network_game_server_open_game( - void *server); -void network_game_server_pause_countdown( - void *server, - boolean pause); -void *global_network_game_server_get( - void); -boolean xbox_demos_available( - void); -void ui_stop_main_menu_music( - void); -void ui_widgets_pop_stack( - short local_player_index); -boolean ui_main_menu_music_active( - void); -void *widget_free( - void *pointer); -boolean create_global_network_game_client( - void); -boolean create_global_network_game_server( - void); -void game_engine_playlist_begin( - void); -void network_game_accept_remote_connections( - boolean accept); -void ui_start_main_menu_music( - void); -void error( - long priority, - char *format, - ...); void playlist_profile_delete( long profile_index); -void ui_play_audio_feedback_sound( - short feedback); -void display_error_deferred( - short error_code, - short local_player_index, - boolean modal, - boolean pause_game_time); boolean virtual_keyboard_launch( void *text, long maximum_length, long keyboard_type); -void network_game_client_local_player_quit( - word controller_index); -struct widget_instance *widget_instance_get_topmost_parent( - struct widget_instance *widget); -struct widget_instance *widget_instance_get_nth_child( - struct widget_instance *widget, - long n); -void display_error( - short error_code, - short local_player_index, - boolean modal, - boolean pause_game_time); -void *global_network_game_client_get( - void); void *network_game_client_get_game( void *client); short network_game_client_get_machine_index( void *client); -boolean network_player_is_valid( - void *player); boolean network_game_client_request_start_time_change( void *client, boolean start); boolean network_game_client_request_remove_player( void *client, void *player); -boolean network_game_should_accept_remote_connections( - void); boolean network_game_client_initiate_join_game( void *client, void *server, struct network_game_join_descriptor *join_descriptor, struct transport_address *address); -void *network_game_get_game( - void); -short network_game_client_get_local_machine_index( - void); boolean network_game_client_update_local_player_data( void *client, - struct network_player_data *player); + struct network_player *player); boolean network_game_client_add_player( void *client, short controller_index); -void network_event( - char *format, - ...); -void ui_widget_delete( - struct widget_instance *widget); void playlist_profiles_enumerate_available_to_local_player_index( short local_player_index, long *profile_count, long *profile_indices); -boolean saved_game_file_retrieve_last_used_multiplayer_variant_directory( - char *directory_path); -long saved_game_file_find_profile_index_for_directory_path( - char *directory_path, - short profile_type); extern byte cached_variant_profile[0x144]; static boolean new_campaign_chosen( struct widget_instance *widget, @@ -1137,33 +1062,12 @@ static boolean network_game_start_new_server( struct widget_instance *widget, struct event_record *event, boolean *widget_deleted); -void console_warning( - char *format, - ...); -void saved_game_file_get_useable_untitled_profile_name( - wchar_t *name); -boolean saved_game_file_retrieve_last_used_multiplayer_map( - char *map_name); -wchar_t *ustrncpy( - wchar_t *destination, - wchar_t const *source, - long count); -void *ui_widget_realloc( - void *pointer, - word size, - char *file, - long line); extern byte cached_player_profile[0x9C]; long playlist_profile_new( short local_player_index, wchar_t *name); -boolean saved_game_file_get_path_to_enclosing_directory( - long profile_index, - char *directory_path); -void saved_game_file_remember_last_used_multiplayer_variant_directory( - char *directory_path); struct game_variant_data *build_game_variant_slayer( struct game_variant_data *variant); @@ -1565,14 +1469,6 @@ static boolean solo_level_initialize_list_single_player( struct widget_instance *widget, struct event_record *event, boolean *widget_deleted); -boolean widget_event_function_list_widget_goto_next_item( - struct widget_instance *widget, - struct event_record *event, - boolean *widget_deleted); -boolean widget_event_function_list_widget_goto_previous_item( - struct widget_instance *widget, - struct event_record *event, - boolean *widget_deleted); /* ---------- globals */ @@ -2550,12 +2446,12 @@ static boolean netgame_unjoin_player( if (network_game_client_get_state(client, &state) == 2) { - byte *game = network_game_client_get_game(client); + struct network_game *game = network_game_client_get_game(client); short machine_index; long machine_player_count; - byte *player; + struct network_player *player; long player_index; - byte *test_player; + struct network_player *test_player; player = NULL; machine_index = network_game_client_get_local_machine_index(); @@ -2563,14 +2459,14 @@ static boolean netgame_unjoin_player( if ((short)machine_index != NONE) { - test_player = game + 0x226; - for (player_index = 0; player_index < 16; player_index++, test_player += 0x20) + test_player = game->players; + for (player_index = 0; player_index < 16; player_index++, test_player++) { if (network_player_is_valid(test_player) && - (short)(signed char)test_player[0x1C] == (short)machine_index) + (short)test_player->machine_index == (short)machine_index) { machine_player_count++; - if ((short)(signed char)test_player[0x1D] == event->controller_index) + if ((short)test_player->controller_index == event->controller_index) { match_vassert("c:\\halo\\SOURCE\\interface\\ui_widget_event_handler_functions.c", 4646, !player, "duplicate player registered in game"); player = test_player; @@ -2584,7 +2480,7 @@ static boolean netgame_unjoin_player( { if (!network_game_client_request_remove_player(client, player)) error(2, "failed to request player removal"); - player_ui_clear_multiplayer_autojoin_for_local_player((short)(signed char)player[0x1D]); + player_ui_clear_multiplayer_autojoin_for_local_player((short)player->controller_index); } if (machine_player_count == 1) @@ -2901,31 +2797,28 @@ static boolean multiplayer_game_swap_teams( struct event_record *event, boolean *widget_deleted) { - struct network_player_data player_data; + struct network_player player; short machine_index; - byte *game; + struct network_game *game; long player_index; - byte *player; match_assert("c:\\halo\\SOURCE\\interface\\ui_widget_event_handler_functions.c", 1572, event); game = network_game_get_game(); - if (game && game[0xC0] == TRUE) + if (game && game->variant.universal_variant.teams == TRUE) { machine_index = network_game_client_get_local_machine_index(); if ((short)machine_index != NONE) { - player_index = 0; - player = game + 0x242; - for (; player_index < 16; player_index++, player += 0x20) + for (player_index = 0; player_index < 16; player_index++) { - if (network_player_is_valid(player - 0x1C) && - (short)(signed char)player[0] == (short)machine_index && - (short)(signed char)player[1] == event->controller_index) + if (network_player_is_valid(&game->players[player_index]) && + (short)game->players[player_index].machine_index == (short)machine_index && + (short)game->players[player_index].controller_index == event->controller_index) { - player_data = *(struct network_player_data *)(game + 0x226 + player_index * 0x20); - player_data.data[0x1E] = !player_data.data[0x1E]; + player = game->players[player_index]; + player.team_index = !player.team_index; if (!network_game_client_update_local_player_data( - global_network_game_client_get(), &player_data)) + global_network_game_client_get(), &player)) { error(2, "failed to update player's team for multiplayer game"); } @@ -2943,22 +2836,18 @@ static boolean network_game_start_faster( boolean *widget_deleted) { void *client = global_network_game_client_get(); - byte *player; short machine_index; long player_index; if (client) { - void *game = network_game_client_get_game(client); + struct network_game *game = network_game_client_get_game(client); machine_index = network_game_client_get_machine_index(client); - player_index = 0; - player = (byte *)game; - player += 0x242; - for (; player_index < 16; player_index++, player += 0x20) + for (player_index = 0; player_index < 16; player_index++) { - if (network_player_is_valid(player - 0x1C) && - (short)(signed char)player[0] == (short)machine_index && - (short)(signed char)player[1] == event->controller_index) + if (network_player_is_valid(&game->players[player_index]) && + (short)game->players[player_index].machine_index == (short)machine_index && + (short)game->players[player_index].controller_index == event->controller_index) { if (!network_game_client_request_start_time_change(client, TRUE)) error(2, "network_game_client_request_start_time_change() failed"); @@ -2975,22 +2864,18 @@ static boolean network_game_start_slower( boolean *widget_deleted) { void *client = global_network_game_client_get(); - byte *player; short machine_index; long player_index; if (client) { - void *game = network_game_client_get_game(client); + struct network_game *game = network_game_client_get_game(client); machine_index = network_game_client_get_machine_index(client); - player_index = 0; - player = (byte *)game; - player += 0x242; - for (; player_index < 16; player_index++, player += 0x20) + for (player_index = 0; player_index < 16; player_index++) { - if (network_player_is_valid(player - 0x1C) && - (short)(signed char)player[0] == (short)machine_index && - (short)(signed char)player[1] == event->controller_index) + if (network_player_is_valid(&game->players[player_index]) && + (short)game->players[player_index].machine_index == (short)machine_index && + (short)game->players[player_index].controller_index == event->controller_index) { if (!network_game_client_request_start_time_change(client, FALSE)) error(2, "network_game_client_request_start_time_change() failed"); @@ -4324,16 +4209,16 @@ static boolean netgame_join_player( if (network_game_client_get_state(client, &value) != 2) return TRUE; { - byte *game = network_game_get_game(); + struct network_game *game = network_game_get_game(); short machine_index = network_game_client_get_local_machine_index(); match_assert("c:\\halo\\SOURCE\\interface\\ui_widget_event_handler_functions.c", 1627, game); if ((short)machine_index != NONE) { for (value = 0; value < 16; value++) { - if (network_player_is_valid(game + 0x226 + value * 0x20) && - (short)(signed char)game[0x242 + value * 0x20] == (short)machine_index && - (short)(signed char)game[0x243 + value * 0x20] == event->controller_index) + if (network_player_is_valid(&game->players[value]) && + (short)game->players[value].machine_index == (short)machine_index && + (short)game->players[value].controller_index == event->controller_index) return TRUE; } } @@ -5663,31 +5548,20 @@ static boolean multiplayer_level_select( return TRUE; } -struct playlist_profile_data -{ - byte data[0x68]; -}; - -struct playlist_profile_data *game_engine_get_variant_by_name( - struct playlist_profile_data *result, - char *name); boolean playlist_profile_get( long profile_index, - struct playlist_profile_data *profile); -boolean saved_game_file_get_path_to_enclosing_directory( - long profile_index, - char *directory_path); + struct game_variant *profile); static boolean multiplayer_profile_set_for_game( struct widget_instance *widget, struct event_record *event, boolean *widget_deleted) { - struct playlist_profile_data profile; + struct game_variant profile; char variant_name[128]; - struct playlist_profile_data automation_profile; - struct playlist_profile_data empty_profile; - struct playlist_profile_data temporary_profile; + struct game_variant automation_profile; + struct game_variant empty_profile; + struct game_variant temporary_profile; char directory_path[256]; struct widget_instance *profile_select_screen; struct widget_instance *profile_list; diff --git a/source/interface/ui_widget_game_data_input_functions.c b/source/interface/ui_widget_game_data_input_functions.c index af097353..b0027f59 100644 --- a/source/interface/ui_widget_game_data_input_functions.c +++ b/source/interface/ui_widget_game_data_input_functions.c @@ -336,6 +336,7 @@ symbols in this file: #include "cseries/cseries.h" #include "cseries/cseries_windows.h" +#include "cseries/errors.h" #include "bungie_net/network/transport.h" #include "interface/ui_widget.h" #include "interface/ui_widget_definitions.h" @@ -483,25 +484,6 @@ struct widget_instance struct ui_widget_animation_data animation; }; -struct ui_game_variant -{ - byte padding00[0x18]; - enum game_engine_type engine_type; - boolean has_teams; - byte padding1D[0x23]; - long score_to_win; - byte padding44[0x08]; - union - { - boolean ctf_assault; - long race_type; - } game_mode; - long single_flag_time; - byte padding54[0x08]; - long oddball_ball_type; - byte padding60[0x08]; -}; - struct network_advertised_game { byte padding00[0x30]; @@ -520,29 +502,6 @@ struct network_advertised_game boolean oddball_variant; }; -struct network_machine -{ - wchar_t name[32]; - char machine_index; - byte padding41[3]; -}; - -struct network_game -{ - byte padding000[0x24]; - char map_name[0x80]; - struct ui_game_variant variant; - byte padding10C; - byte game_mode; - byte maximum_player_count; - byte padding10F; - short difficulty; - short machine_count; - struct network_machine machines[MAXIMUM_NETWORK_MACHINE_COUNT]; - short player_count; - struct network_player players[16]; -}; - typedef char network_advertised_game_size_assert[ sizeof(struct network_advertised_game) == 0xE4 ? 1 : -1]; typedef char network_advertised_game_game_name_offset_assert[ @@ -1424,7 +1383,7 @@ static void network_pregame_status_screen_update( seconds_to_game_start - (hours * 60 + minutes) * 60); } } - else if (waiting_for_machines || game->variant.has_teams == TRUE) + else if (waiting_for_machines || game->variant.universal_variant.teams == TRUE) { status_text->visible = FALSE; countdown_text->visible = FALSE; @@ -1528,7 +1487,7 @@ static void network_pregame_status_screen_update( team_list && team_list->type == _ui_widget_type_spinner_list, "expected a spinner list for local player team display"); - if (!game->variant.has_teams) + if (!game->variant.universal_variant.teams) widget_instance_set_visibility_recursive(team_list, FALSE); else widget_instance_set_visibility_recursive(team_list, TRUE); @@ -1564,7 +1523,7 @@ static void network_pregame_status_screen_update( name_text->parameters.text_box.text[name_length] = 0; } - if (!game->variant.has_teams) + if (!game->variant.universal_variant.teams) { controller_bitmap->animation.current_frame_index = 1; } @@ -1705,7 +1664,7 @@ static void network_pregame_status_screen_update( { player_widget->animation.current_frame_index = 2; } - else if (!game->variant.has_teams) + else if (!game->variant.universal_variant.teams) { player_widget->animation.current_frame_index = local_player_controller_bitmap_frames[0][local_player_index][0]; @@ -1822,7 +1781,7 @@ static void splitscreen_pregame_status_screen_update( seconds_to_game_start - (hours * 60 + minutes) * 60); } } - else if (game->player_count < 2 || game->variant.has_teams == TRUE) + else if (game->player_count < 2 || game->variant.universal_variant.teams == TRUE) { status_text->visible = FALSE; countdown_text->visible = FALSE; @@ -1912,7 +1871,7 @@ static void splitscreen_pregame_status_screen_update( name_text = controller_bitmap->next; team_list = name_text->next; - if (!game->variant.has_teams) + if (!game->variant.universal_variant.teams) widget_instance_set_visibility_recursive(team_list, FALSE); if (local_player_indices[local_player_index] == NONE) @@ -1946,7 +1905,7 @@ static void splitscreen_pregame_status_screen_update( name_text->parameters.text_box.text[name_length] = 0; } - if (!game->variant.has_teams) + if (!game->variant.universal_variant.teams) { controller_bitmap->animation.current_frame_index = 1; } @@ -2427,7 +2386,7 @@ static void multiplayer_game_set_text_box_for_map_name( game = network_game_get_game(); if (game) { - map_name = game->map_name; + map_name = game->map.name; if (strstr(map_name, "beavercreek")) { widget->parameters.text_box.string_list_index = 0; @@ -2511,20 +2470,20 @@ static void multiplayer_game_set_text_box_for_game_ruleset( game = network_game_get_game(); if (game) { - switch (game->variant.engine_type) + switch (game->variant.game_engine_index) { case game_engine_ctf: - if (game->variant.game_mode.ctf_assault == TRUE) + if (game->variant.game_engine_variant.ctf.assault == TRUE) { widget->parameters.text_box.string_list_index = - game->variant.single_flag_time ? + game->variant.game_engine_variant.ctf.single_flag_time ? _multiplayer_game_text_string_single_flag_assault : _multiplayer_game_text_string_assault; } else { widget->parameters.text_box.string_list_index = - game->variant.single_flag_time ? + game->variant.game_engine_variant.ctf.single_flag_time ? _multiplayer_game_text_string_single_flag_ctf : _multiplayer_game_text_string_capture_the_flag; } @@ -2534,7 +2493,7 @@ static void multiplayer_game_set_text_box_for_game_ruleset( _multiplayer_game_text_string_slayer; break; case game_engine_oddball: - switch (game->variant.oddball_ball_type) + switch (game->variant.game_engine_variant.oddball.oddball_ball_type) { case 1: widget->parameters.text_box.string_list_index = @@ -2555,7 +2514,7 @@ static void multiplayer_game_set_text_box_for_game_ruleset( _multiplayer_game_text_string_king_of_the_hill; break; case game_engine_race: - switch (game->variant.game_mode.race_type) + switch (game->variant.game_engine_variant.race.race_type) { case 2: widget->parameters.text_box.string_list_index = @@ -2593,7 +2552,7 @@ static void multiplayer_game_set_text_box_for_teams_noteams( game = network_game_get_game(); if (game) { - widget->parameters.text_box.string_list_index = game->variant.has_teams != TRUE ? 13 : 12; + widget->parameters.text_box.string_list_index = game->variant.universal_variant.teams != TRUE ? 13 : 12; return; } @@ -2622,7 +2581,7 @@ static void multiplayer_game_set_text_box_for_score_limit( 0xAC8); if (widget->parameters.text_box.text) { - usnprintf(widget->parameters.text_box.text, 7, L"%d", game->variant.score_to_win); + usnprintf(widget->parameters.text_box.text, 7, L"%d", game->variant.universal_variant.score_to_win); widget->parameters.text_box.text[7] = 0; } return; @@ -2646,7 +2605,7 @@ static void multiplayer_game_set_text_box_for_score_limit_type( game = network_game_get_game(); if (game) { - switch (game->variant.engine_type) + switch (game->variant.game_engine_index) { case game_engine_ctf: widget->parameters.text_box.string_list_index = @@ -2657,7 +2616,7 @@ static void multiplayer_game_set_text_box_for_score_limit_type( _multiplayer_game_text_string_frags; break; case game_engine_oddball: - widget->parameters.text_box.string_list_index = game->variant.oddball_ball_type == 2 ? + widget->parameters.text_box.string_list_index = game->variant.game_engine_variant.oddball.oddball_ball_type == 2 ? _multiplayer_game_text_string_frags : _multiplayer_game_text_string_minutes; break; case game_engine_king: @@ -2695,7 +2654,7 @@ static void multiplayer_game_set_bitmap_for_map( game = network_game_get_game(); if (game) { - map_name = game->map_name; + map_name = game->map.name; if (strstr(map_name, "beavercreek")) { widget->animation.current_frame_index = 0; @@ -2779,7 +2738,7 @@ static void multiplayer_game_set_bitmap_for_ruleset( game = network_game_get_game(); if (game) { - switch (game->variant.engine_type) + switch (game->variant.game_engine_index) { case game_engine_ctf: widget->animation.current_frame_index = _multiplayer_game_bitmap_ctf; @@ -2939,7 +2898,7 @@ static void multiplayer_game_directions( } if (game && - game->variant.has_teams == TRUE && + game->variant.universal_variant.teams == TRUE && network_game_client_get_seconds_to_game_start(global_network_game_client_get()) < 0) { long team_one_player_count = 0; @@ -2995,7 +2954,7 @@ static void teams_no_teams_mp_game_bitmap_update( "expected a container bitmap for mp pregame header widget"); if (game) - widget->animation.current_frame_index = game->variant.has_teams != TRUE; + widget->animation.current_frame_index = game->variant.universal_variant.teams != TRUE; return; } diff --git a/source/interface/virtual_keyboard.c b/source/interface/virtual_keyboard.c index d6305acd..bd924d49 100644 --- a/source/interface/virtual_keyboard.c +++ b/source/interface/virtual_keyboard.c @@ -905,7 +905,7 @@ static void virtual_keyboard_render_internal( return; } -long virtual_keyboard_free_space_in_text_buffer( +static long virtual_keyboard_free_space_in_text_buffer( void) { return virtual_keyboard_globals.buffer_size - @@ -1094,15 +1094,15 @@ static boolean virtual_keyboard_select( virtual_keyboard_globals.first_key_replaces_buffer = FALSE; } { - long buffer_size = virtual_keyboard_globals.buffer_size; - long free_space = buffer_size - 2 * (ustrlen(virtual_keyboard_globals.text_buffer) + 1); + long move_size; - if (free_space >= 2) + if (virtual_keyboard_free_space_in_text_buffer() >= 2) { + move_size = virtual_keyboard_globals.buffer_size - ((byte *)virtual_keyboard_globals.cursor - (byte *)virtual_keyboard_globals.text_buffer) - sizeof(wchar_t); csmemmove( virtual_keyboard_globals.cursor + 1, virtual_keyboard_globals.cursor, - buffer_size - ((byte *)virtual_keyboard_globals.cursor - (byte *)virtual_keyboard_globals.text_buffer) - sizeof(wchar_t)); + move_size); *virtual_keyboard_globals.cursor++ = virtual_keyboard_get_current_character(); if (ustrcmp(virtual_keyboard_globals.text_buffer, L".fortune") == 0) { diff --git a/source/items/projectiles.c b/source/items/projectiles.c index 622d807b..ceff81fe 100644 --- a/source/items/projectiles.c +++ b/source/items/projectiles.c @@ -253,61 +253,26 @@ enum /* ---------- macros */ -#define projectile_runtime_get(index) \ - ((struct projectile_runtime_datum *)object_get_and_verify_type( \ - (index), \ - _object_mask_projectile)) - /* ---------- structures */ -struct _projectile_runtime_datum -{ - unsigned long flags; - short action; - short hit_material_type; - long ignore_object_index; - long target_object_index; - long tracer_attachment_index; - real detonation_timer; - real detonation_timer_delta; - real arming_time; - real arming_time_delta; - real odometer; - real deceleration_timer; - real deceleration_timer_delta; - real deceleration; - real maximum_damage_distance; - real_vector3d rotation_axis; - real rotation_sine; - real rotation_cosine; -}; - -struct projectile_runtime_datum -{ - long definition_index; - struct _object_datum object; - struct _item_datum item; - struct _projectile_runtime_datum projectile; -}; - typedef char projectile_runtime_arming_time_delta_offset_assert[ - offsetof(struct projectile_runtime_datum, projectile.arming_time_delta) == 0x1FC + offsetof(struct projectile_datum, projectile.arming_time_delta) == 0x1FC ? 1 : -1]; typedef char projectile_runtime_odometer_offset_assert[ - offsetof(struct projectile_runtime_datum, projectile.odometer) == 0x200 + offsetof(struct projectile_datum, projectile.odometer) == 0x200 ? 1 : -1]; typedef char projectile_runtime_deceleration_offset_assert[ - offsetof(struct projectile_runtime_datum, projectile.deceleration) == 0x20C + offsetof(struct projectile_datum, projectile.deceleration) == 0x20C ? 1 : -1]; typedef char projectile_runtime_rotation_axis_offset_assert[ - offsetof(struct projectile_runtime_datum, projectile.rotation_axis) == 0x214 + offsetof(struct projectile_datum, projectile.rotation_axis) == 0x214 ? 1 : -1]; typedef char projectile_runtime_rotation_cosine_offset_assert[ - offsetof(struct projectile_runtime_datum, projectile.rotation_cosine) == 0x224 + offsetof(struct projectile_datum, projectile.rotation_cosine) == 0x224 ? 1 : -1]; @@ -502,11 +467,11 @@ boolean dangerous_projectiles_near_player( void projectile_export_function_values( long projectile_index) { - struct projectile_runtime_datum *projectile; + struct projectile_datum *projectile; struct projectile_definition const *definition; short function_index; - projectile = projectile_runtime_get(projectile_index); + projectile = projectile_get(projectile_index); definition = projectile_definition_get(projectile->definition_index); for (function_index = 0; function_index < NUMBEROF(definition->projectile.function_inputs); function_index++) @@ -560,7 +525,7 @@ void projectile_export_function_values( boolean projectile_new( long projectile_index) { - struct projectile_runtime_datum *projectile; + struct projectile_datum *projectile; struct projectile_definition const *definition; struct tag_block const *attachments; real detonation_ticks; @@ -569,7 +534,7 @@ boolean projectile_new( short attachment_index; boolean underwater; - projectile = projectile_runtime_get(projectile_index); + projectile = projectile_get(projectile_index); definition = projectile_definition_get(projectile->definition_index); SET_FLAG(projectile->object.flags, _object_dynamic_lighting_recompute_bit, TRUE); @@ -649,9 +614,9 @@ void projectile_accelerate( long projectile_index, real_vector3d const *acceleration) { - struct projectile_runtime_datum *projectile; + struct projectile_datum *projectile; - projectile = projectile_runtime_get(projectile_index); + projectile = projectile_get(projectile_index); projectile_definition_get(projectile->definition_index); match_assert_valid_real_vector3d( @@ -702,14 +667,14 @@ void projectile_accelerate( boolean projectile_update( long projectile_index) { - struct projectile_runtime_datum *projectile; + struct projectile_datum *projectile; struct projectile_definition const *definition; real time_remaining; short collision_count; boolean flyby_sound_played; boolean detonation_timer_running; - projectile = projectile_runtime_get(projectile_index); + projectile = projectile_get(projectile_index); definition = projectile_definition_get(projectile->definition_index); time_remaining = 1.0f; collision_count = 0; @@ -1167,10 +1132,10 @@ static real projectile_calculate_deceleration_from_distances( static void projectile_adjust_for_angular_velocity_change( long projectile_index) { - struct projectile_runtime_datum *projectile; + struct projectile_datum *projectile; real angular_velocity_magnitude; - projectile = projectile_runtime_get(projectile_index); + projectile = projectile_get(projectile_index); angular_velocity_magnitude = magnitude3d(&projectile->object.angular_velocity); if (angular_velocity_magnitude != 0.f) @@ -1202,10 +1167,10 @@ static void projectile_adjust_for_angular_velocity_change( static void projectile_calculate_deceleration( long projectile_index) { - struct projectile_runtime_datum *projectile; + struct projectile_datum *projectile; struct projectile_definition const *definition; - projectile = projectile_runtime_get(projectile_index); + projectile = projectile_get(projectile_index); definition = projectile_definition_get(projectile->definition_index); if (TEST_FLAG(projectile->object.flags, _object_wholly_under_media_bit)) @@ -1256,9 +1221,9 @@ static void projectile_set_action( long projectile_index, short action) { - struct projectile_runtime_datum *projectile; + struct projectile_datum *projectile; - projectile = projectile_runtime_get(projectile_index); + projectile = projectile_get(projectile_index); if (action > projectile->projectile.action) projectile->projectile.action = action; @@ -1315,7 +1280,7 @@ static boolean projectile_collision_test_line( real_point3d const *new_position, struct collision_result *collision) { - struct projectile_runtime_datum *projectile = projectile_runtime_get(projectile_index); + struct projectile_datum *projectile = projectile_get(projectile_index); struct projectile_definition const *definition = projectile_definition_get(projectile->definition_index); if (collision_test_line( @@ -1378,7 +1343,7 @@ static void projectile_detonate( boolean first_collision, real time_left) { - struct projectile_runtime_datum *projectile; + struct projectile_datum *projectile; struct projectile_definition const *definition; char const *marker_names[2]; real_point3d marker_points[2]; @@ -1386,7 +1351,7 @@ static void projectile_detonate( real_vector3d up; long effect_definition_index; - projectile = projectile_runtime_get(projectile_index); + projectile = projectile_get(projectile_index); definition = projectile_definition_get(projectile->definition_index); marker_names[0] = ""; @@ -1408,7 +1373,7 @@ static void projectile_detonate( { child = object_get(child_index); if (child->definition_index == projectile->definition_index && - !TEST_FLAG(projectile_runtime_get(child_index)->projectile.flags, _projectile_already_super_exploded_bit)) + !TEST_FLAG(projectile_get(child_index)->projectile.flags, _projectile_already_super_exploded_bit)) { combining_projectile_count++; } @@ -1427,9 +1392,9 @@ static void projectile_detonate( { child = object_get(child_index); if (child->definition_index == projectile->definition_index && - !TEST_FLAG(projectile_runtime_get(child_index)->projectile.flags, _projectile_already_super_exploded_bit)) + !TEST_FLAG(projectile_get(child_index)->projectile.flags, _projectile_already_super_exploded_bit)) { - struct projectile_runtime_datum *child_projectile = projectile_runtime_get(child_index); + struct projectile_datum *child_projectile = projectile_get(child_index); if (combining_projectile_count <= MAXIMUM_COMBINING_PROJECTILES) { @@ -1544,7 +1509,7 @@ static void projectile_collision( real_vector3d *new_velocity, real time_left) { - struct projectile_runtime_datum *projectile; + struct projectile_datum *projectile; struct projectile_definition const *definition; struct projectile_material_response_definition const *material_response; real_vector3d direction; @@ -1559,7 +1524,7 @@ static void projectile_collision( short material_type; short response; - projectile = projectile_runtime_get(projectile_index); + projectile = projectile_get(projectile_index); definition = projectile_definition_get(projectile->definition_index); material_type = collision->material_type; effect_scale = 1.0f; @@ -1848,9 +1813,9 @@ static void projectile_collision( struct object_datum *child = object_get(child_index); if (child->definition_index == projectile->definition_index && - !TEST_FLAG(projectile_runtime_get(child_index)->projectile.flags, _projectile_already_super_exploded_bit)) + !TEST_FLAG(projectile_get(child_index)->projectile.flags, _projectile_already_super_exploded_bit)) { - struct projectile_runtime_datum *child_projectile = projectile_runtime_get(child_index); + struct projectile_datum *child_projectile = projectile_get(child_index); child_projectile->projectile.arming_time = 0.0f; child_projectile->projectile.detonation_timer = 0.0f; diff --git a/source/items/projectiles.h b/source/items/projectiles.h index cb6156a4..70a18464 100644 --- a/source/items/projectiles.h +++ b/source/items/projectiles.h @@ -34,6 +34,15 @@ struct _projectile_datum real detonation_timer; real detonation_timer_delta; real arming_time; + real arming_time_delta; + real odometer; + real deceleration_timer; + real deceleration_timer_delta; + real deceleration; + real maximum_damage_distance; + real_vector3d rotation_axis; + real rotation_sine; + real rotation_cosine; }; struct projectile_datum diff --git a/source/items/weapons.c b/source/items/weapons.c index e35b5e2e..62b3a4bc 100644 --- a/source/items/weapons.c +++ b/source/items/weapons.c @@ -211,7 +211,7 @@ symbols in this file: #include "projectiles.h" #include "ai/actors.h" -#include "ai/ai_runtime.h" +#include "ai/ai.h" #include "cache/cache_files.h" #include "cseries/profile.h" #include "effects/effect_definitions.h" @@ -221,6 +221,7 @@ symbols in this file: #include "game/game_engine.h" #include "game/players.h" #include "interface/first_person_weapons.h" +#include "math/periodic_functions.h" #include "models/model_animation_definitions.h" #include "objects/damage.h" #include "scenario/scenario.h" @@ -357,13 +358,6 @@ struct trigger_firing_effect /* ---------- prototypes */ -real transition_function_evaluate( - short function_type, - real value); -void unit_handle_weapon_state_change( - long object_index, - short new_state); - static struct weapon_trigger *weapon_trigger_get( struct weapon_datum *weapon, short trigger_index); @@ -2018,7 +2012,8 @@ static boolean weapon_state_interruptable( } void weapon_preprocess_node_orientations( - long weapon_index) + long weapon_index, + struct real_orientation *node_orientations) { struct weapon_datum *weapon = weapon_get(weapon_index); struct weapon_definition *weapon_definition = weapon_definition_get(weapon->definition_index); diff --git a/source/items/weapons.h b/source/items/weapons.h index cc7b6d7c..a9c5c830 100644 --- a/source/items/weapons.h +++ b/source/items/weapons.h @@ -253,12 +253,20 @@ boolean weapon_handle_potential_inventory_item( long item_object_index, short local_player_index, short *rounds_picked_up); +short animation_choose_random_permutation( + long animation_graph_index, + short animation_index); void weapon_unready(long weapon_index); boolean weapon_put_away(long weapon_index, boolean immediate); void weapon_set_integrated_light_power(long weapon_index, real light_power); void weapon_owner_update(long weapon_index, word control_flags, real primary_trigger); +void weapon_preprocess_node_orientations( + long weapon_index, + struct real_orientation *node_orientations); +boolean weapon_update( + long object_index); struct weapon_interface_state; @@ -267,6 +275,8 @@ void weapon_export_function_values( long weapon_index); void weapon_set_total_rounds(long weapon_index, short *rounds_array); +void weapon_delete( + long object_index); void weapon_set_current_amount( long weapon_index, real current_amount); diff --git a/source/main/main.c b/source/main/main.c index ed639ecc..c0c64ca6 100644 --- a/source/main/main.c +++ b/source/main/main.c @@ -339,14 +339,15 @@ symbols in this file: #include "real_math.h" #include "game.h" #include "game_engine.h" +#include "camera/camera_scripting.h" #include "game/cheats.h" -#include "game/player_control.h" #include "game/player_control_runtime.h" #include "game/players.h" #include "game/local_players.h" #include "game/player_queues_new.h" #include "integer_math.h" #include "input.h" +#include "input/input_abstraction.h" #include "shell.h" #include "event_manager.h" #include "telnet_console.h" @@ -359,19 +360,20 @@ symbols in this file: #include "cache/cache_files.h" #include "cache/predicted_resources.h" #include "bitmaps/bitmap_group.h" -#include "bitmaps/bitmaps_internal.h" +#include "bitmaps/bitmaps.h" #include "bitmaps/tiff_file.h" #include "interface/hud.h" #include "interface/hud_definitions.h" #include "interface/attract_mode.h" #include "interface/interface.h" +#include "interface/marketing_and_strategic_business_development.h" +#include "interface/player_ui.h" #include "interface/terminal.h" #include "saved games/player_profile.h" #include "saved games/game_state.h" #include "sound/sound_manager.h" #include "rasterizer/rasterizer.h" -#include "rasterizer/rasterizer_debug.h" -#include "rasterizer/rasterizer_debug_options.h" +#include "rasterizer/rasterizer_console_vars.h" #include "bink/bink_playback.h" #include "main/d3d_intimacy.h" #include "networking/network_game_globals.h" @@ -671,10 +673,8 @@ static void main_frame_rate_debug( static void main_new_map( struct game_options *options); -extern void scripted_camera_set( - word camera_point_index0, - word camera_point_index1, - long transition_time); +static void main_game_render( + double time_delta_since_tick_sec); /* ---------- globals */ @@ -2894,7 +2894,7 @@ void main_loop_of_death( return; } -void main_game_render( +static void main_game_render( double time_delta_since_tick_sec) { boolean force_single_screen; diff --git a/source/main/main.h b/source/main/main.h index 5e4f6532..a6159e0d 100644 --- a/source/main/main.h +++ b/source/main/main.h @@ -31,9 +31,6 @@ void set_window_camera_values( struct render_window *window, struct observer_result const *observer); -void main_game_render( - double time_delta_since_tick_sec); - void game_connection_set( short connection); diff --git a/source/math/matrix_math.h b/source/math/matrix_math.h deleted file mode 100644 index fe35d3c1..00000000 --- a/source/math/matrix_math.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -MATRIX_MATH.H - -focused owner header for matrix_math.c routines that real_math.h does not -declare; adding them to the broad real_math.h regresses exact consumers -through declaration-count sensitivity. -*/ - -#ifndef __MATRIX_MATH_H -#define __MATRIX_MATH_H -#pragma once - -#include "cseries/cseries.h" -#include "math/real_math.h" - -real_matrix3x3 *matrix3x3_multiply( - real_matrix3x3 const *a, - real_matrix3x3 const *b, - real_matrix3x3 *result); - -#endif /* __MATRIX_MATH_H */ diff --git a/source/math/random_math.c b/source/math/random_math.c index b9319fdb..76ed4239 100644 --- a/source/math/random_math.c +++ b/source/math/random_math.c @@ -58,7 +58,6 @@ symbols in this file: #include "cseries_windows.h" #include "real_math.h" #include "geometry.h" -#include "random_math.h" #include "game_engine.h" /* ---------- constants */ diff --git a/source/math/random_math.h b/source/math/random_math.h deleted file mode 100644 index ebe2a652..00000000 --- a/source/math/random_math.h +++ /dev/null @@ -1,17 +0,0 @@ -/* -RANDOM_MATH.H -*/ - -#ifndef __RANDOM_MATH_H -#define __RANDOM_MATH_H -#pragma once - -/* ---------- prototypes/RANDOM_MATH.C */ - -unsigned long get_random_seed( - void); - -void random_seed_debug_log( - boolean log); - -#endif /* __RANDOM_MATH_H */ diff --git a/source/math/real_math.c b/source/math/real_math.c index c15cf837..bcb97d94 100644 --- a/source/math/real_math.c +++ b/source/math/real_math.c @@ -6,6 +6,7 @@ REAL_MATH.C #include "cseries.h" #include "real_math.h" +#include "periodic_functions.h" /* ---------- constants */ diff --git a/source/math/real_math.h b/source/math/real_math.h index 0c9834bf..80ff069e 100644 --- a/source/math/real_math.h +++ b/source/math/real_math.h @@ -806,6 +806,9 @@ void matrix4x3_rotation_from_angles(real_matrix4x3 *matrix, real yaw, real pitch 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 matrix3x3_rotation_to_quaternion( + real_matrix3x3 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); @@ -824,6 +827,10 @@ void matrix4x3_multiply(real_matrix4x3 const *a, real_matrix4x3 const *b, real_m real_matrix3x3 *matrix3x3_transpose( real_matrix3x3 const *matrix, real_matrix3x3 *result); +real_matrix3x3 *matrix3x3_multiply( + real_matrix3x3 const *a, + real_matrix3x3 const *b, + real_matrix3x3 *result); real_matrix3x3 *matrix3x3_from_forward_and_up( real_matrix3x3 *matrix, real_vector3d const *forward, @@ -835,10 +842,18 @@ real_vector3d *matrix3x3_transform_vector(real_matrix3x3 const *matrix, real_vec unsigned long *get_global_random_seed_address(void); unsigned long *get_global_local_random_seed_address(void); +void random_seed_debug_log( + boolean log); +void random_math_initialize( + void); +void random_math_dispose( + void); void lock_global_random_seed( void); void unlock_global_random_seed( void); +unsigned long get_random_seed( + void); unsigned short seed_random(unsigned long *seed); short seed_random_range(unsigned long *seed, short lower_bound, short upper_bound); @@ -849,6 +864,11 @@ real real_seed_random_range(unsigned long *seed, real lower_bound, real upper_bo real_vector3d *seed_random_direction3d(unsigned long *seed, real_vector3d *direction); real_vector3d *seed_random_vector_in_cone3d(unsigned long *seed, real_vector3d const *axis, real inner_cone_angle, real outer_cone_angle, real_vector3d *result); +/* ---------- prototypes/ACTOR_LOOKING.C */ + +boolean valid_real_normal2d( + union real_vector2d const *normal); + /* ---------- globals */ extern short const global_projection3d_mappings[3][2][2]; @@ -1446,18 +1466,21 @@ __inline real_plane2d *plane2d_from_points( real_point2d const *point0, real_point2d const *point1) { - vector_from_points2d(point0, point1, &plane->n); + plane->n.i = point1->y - point0->y; + plane->n.j = point0->x - point1->x; - if (normalize2d(&plane->n) == 0.0f) + if (normalize2d(&plane->n) != 0.0f) { - plane->d = 0.0f; + plane->d = dot_product2d((real_vector2d *)point0, &plane->n); + + return plane; } else { - plane->d = dot_product2d((real_vector2d *)point0, &plane->n); - } + plane->d = 0.0f; - return plane; + return NULL; + } } __inline real plane2d_distance_to_point( diff --git a/source/math/vector_tree.c b/source/math/vector_tree.c index b69b922d..11c43eb1 100644 --- a/source/math/vector_tree.c +++ b/source/math/vector_tree.c @@ -15,13 +15,7 @@ symbols in this file: */ #include "cseries/cseries.h" - -struct dynamic_array -{ - long element_size; - long count; - void *elements; -}; +#include "memory/array.h" struct vector_tree_node { @@ -45,11 +39,6 @@ struct vector_tree vector_tree_compare_component compare_component; }; -void dynamic_array_new(struct dynamic_array *array, long element_size); -void dynamic_array_delete(struct dynamic_array *array); -long dynamic_array_add_element(struct dynamic_array *array); -void *dynamic_array_get_element(struct dynamic_array *array, long index, long element_size); - void vector_tree_new( struct vector_tree *tree, short component_count, diff --git a/source/models/model_animation_definitions.h b/source/models/model_animation_definitions.h index 67ba9779..22922696 100644 --- a/source/models/model_animation_definitions.h +++ b/source/models/model_animation_definitions.h @@ -258,6 +258,13 @@ short animation_update_internal( long animation_graph_index, struct animation_state *state, long *sound_index); +void animation_graph_node_matrices_from_orientations( + long animation_graph_index, + struct real_matrix4x3 *node_matrices, + struct real_orientation const *node_orientations, + real_point3d const *origin, + real_vector3d const *forward, + real_vector3d const *up); void animation_get_node_orientations( struct model const *model, @@ -287,6 +294,17 @@ void inverse_kinematics_adjust_matrices( struct real_matrix4x3 *shoulder_matrix, struct real_matrix4x3 *elbow_matrix, struct real_matrix4x3 *hand_matrix); +void overlay_animation_apply_continuous_scaled( + struct animation const *animation, + real real_frame_index, + real animation_scale, + struct real_orientation *node_orientations); +void aiming_screen_apply( + struct animation const *animation, + struct animation_aiming_screen_bounds const *aiming_screen_bounds, + real yaw, + real pitch, + struct real_orientation *node_orientations); void interpolate_node_orientations( short node_count, diff --git a/source/models/model_animations.c b/source/models/model_animations.c index 9ae4f2f3..de412ce4 100644 --- a/source/models/model_animations.c +++ b/source/models/model_animations.c @@ -149,7 +149,7 @@ symbols in this file: #include "cseries.h" #include "cseries/errors.h" -#include "models/model_animations.h" +#include "models/model_animation_definitions.h" #include "models/models.h" #include "models/model_definitions.h" #include "objects/objects.h" diff --git a/source/models/model_animations.h b/source/models/model_animations.h deleted file mode 100644 index b5c5ebc2..00000000 --- a/source/models/model_animations.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -MODEL_ANIMATIONS.H -*/ - -#ifndef __MODEL_ANIMATIONS_H -#define __MODEL_ANIMATIONS_H -#pragma once - -/* ---------- headers */ - -#include "models/model_animation_definitions.h" - -/* ---------- prototypes/MODEL_ANIMATIONS.C */ - -void overlay_animation_apply_continuous_scaled( - struct animation const *animation, - real real_frame_index, - real animation_scale, - struct real_orientation *node_orientations); -void animation_graph_node_matrices_from_orientations( - long animation_graph_index, - struct real_matrix4x3 *node_matrices, - struct real_orientation const *node_orientations, - real_point3d const *origin, - real_vector3d const *forward, - real_vector3d const *up); - -#endif // __MODEL_ANIMATIONS_H diff --git a/source/models/models.c b/source/models/models.c index a8dd2f34..29757d3a 100644 --- a/source/models/models.c +++ b/source/models/models.c @@ -72,6 +72,7 @@ symbols in this file: #include "game/game.h" #include "math/real_math.h" #include "objects/objects.h" +#include "rasterizer/rasterizer.h" #include "rasterizer/rasterizer_geometry.h" #include "render/render.h" #include "render/render_debug.h" @@ -79,6 +80,7 @@ symbols in this file: #include "scenario/scenario_definitions.h" #include "shaders/shader_definitions.h" #include "shaders/shaders.h" +#include "rasterizer/rasterizer_console_vars.h" /* ---------- constants */ @@ -242,15 +244,6 @@ struct rasterizer_model_begin_parameters typedef char verify_render_model_effect_size[sizeof(struct render_model_effect) == 0x28 ? 1 : -1]; typedef char verify_rasterizer_model_begin_parameters_size[sizeof(struct rasterizer_model_begin_parameters) == 0xCC ? 1 : -1]; -struct rasterizer_debug_options -{ - byte reserved[8]; - short debug_model_lod; - byte trailing[0x5E]; -}; - -typedef char verify_rasterizer_debug_options_size[sizeof(struct rasterizer_debug_options) == 0x68 ? 1 : -1]; - /* ---------- prototypes */ #include "rasterizer/rasterizer_models.h" @@ -263,10 +256,11 @@ static void render_model_parts( short geometry_detail_level_index, short forced_shader_permutation_index, long flags); +static void model_geometry_part_build_tangent_matrices( + struct model_geometry_part *part); /* ---------- globals */ -extern struct rasterizer_debug_options rasterizer_debug_options; extern boolean rasterizer_model_cortana_hack; extern boolean render_model_nodes; @@ -733,17 +727,17 @@ void model_build_tangent_matrices( for (part_index = 0; part_index < geometry->parts.count; part_index++) { - struct model_geometry_part *part = TAG_BLOCK_GET_ELEMENT( + model_geometry_part_build_tangent_matrices(TAG_BLOCK_GET_ELEMENT( &geometry->parts, part_index, - struct model_geometry_part); + struct model_geometry_part)); } } return; } -void model_geometry_part_build_tangent_matrices( +static void model_geometry_part_build_tangent_matrices( struct model_geometry_part *part) { return; diff --git a/source/models/models.h b/source/models/models.h index 12ce3738..2673da20 100644 --- a/source/models/models.h +++ b/source/models/models.h @@ -70,8 +70,6 @@ short model_get_marker_by_name( short maximum_marker_count); void model_build_tangent_matrices( struct model *model); -void model_geometry_part_build_tangent_matrices( - struct model_geometry_part *part); void render_model( long model_index, real level_of_detail_pixels, diff --git a/source/networking/network_client_manager.c b/source/networking/network_client_manager.c index e9409901..8c27f844 100644 --- a/source/networking/network_client_manager.c +++ b/source/networking/network_client_manager.c @@ -370,7 +370,6 @@ symbols in this file: #include "bungie_net/network/transport.h" #include "bungie_net/network/transport_address_constants.h" #include "bungie_net/network/transport_endpoint_winsock.h" -#include "cache/cache_file_precaching.h" #include "cache/cache_files.h" #include "cseries/cseries_windows.h" #include "cseries/errors.h" @@ -471,45 +470,6 @@ enum /* ---------- structures */ -struct network_machine -{ - byte __unknown0[0x40]; - char machine_index; - byte __padding41[3]; -}; - -struct network_game_map -{ - long __unknown0; - char name[0x80]; -}; - -struct network_game_local_data -{ - boolean game_objects_loaded; - byte __padding431[3]; -}; - -struct network_game -{ - wchar_t name[16]; - struct network_game_map map; - struct game_variant variant; - byte __padding10C; - byte game_mode; - char maximum_player_count; - byte __padding10F; - short difficulty; - short machine_count; - struct network_machine machines[MAXIMUM_NETWORK_MACHINE_COUNT]; - short player_count; - struct network_player players[MAXIMUM_NUMBER_OF_PLAYERS]; - short __unknown426; - unsigned long random_seed; - byte __unknown42C[4]; - struct network_game_local_data local_data; -}; - struct transport_key_id { byte data[8]; diff --git a/source/networking/network_client_message_handler.c b/source/networking/network_client_message_handler.c index f1798436..66d1f756 100644 --- a/source/networking/network_client_message_handler.c +++ b/source/networking/network_client_message_handler.c @@ -198,6 +198,7 @@ symbols in this file: #include "game/players.h" #include "networking/network_client_manager.h" #include "networking/network_client_message_handler.h" +#include "networking/network_game_manager.h" #include "networking/network_messages.h" /* ---------- constants */ @@ -247,45 +248,6 @@ enum network_game_packet_class struct network_game_client; -struct network_machine -{ - wchar_t name[32]; - char machine_index; - byte padding41[3]; -}; - -struct network_game_map -{ - long unknown; - char name[0x80]; -}; - -struct network_game_local_data -{ - boolean game_objects_loaded; - byte padding431[3]; -}; - -struct network_game -{ - wchar_t name[NETWORK_GAME_NAME_LENGTH]; - struct network_game_map map; - struct game_variant variant; - byte unknown10C; - char minimum_player_count; - char maximum_player_count; - byte team_count; - short difficulty; - short machine_count; - struct network_machine machines[MAXIMUM_NETWORK_MACHINE_COUNT]; - short player_count; - struct network_player players[MAXIMUM_NUMBER_OF_PLAYERS]; - word reserved_after_players; - unsigned long random_seed; - long number_of_games_played; - struct network_game_local_data local_data; -}; - struct message_server_game_advertise { byte client_nonce[TRANSPORT_NONCE_LENGTH]; diff --git a/source/networking/network_game_globals.c b/source/networking/network_game_globals.c index 37351e76..1d7d0333 100644 --- a/source/networking/network_game_globals.c +++ b/source/networking/network_game_globals.c @@ -177,27 +177,12 @@ struct client_game_update_message byte update[0x80]; }; -struct network_machine -{ - byte __unknown0[0x40]; - char machine_index; -}; - struct local_network_player { byte __unknown0[0x1C]; boolean machine_index; }; -struct network_game -{ - byte __unknown0[0x226]; - struct network_player players[16]; - byte __unknown426[2]; - long random_seed; - long number_of_games_played; -}; - typedef char network_machine_index_offset_assert[ offsetof(struct network_machine, machine_index) == 0x40 ? 1 : -1]; typedef char network_game_players_offset_assert[ @@ -221,11 +206,6 @@ typedef char network_game_globals_size_assert[ /* ---------- prototypes */ -unsigned long *get_global_local_random_seed_address( - void); -unsigned short seed_random( - unsigned long *seed); - /* ---------- globals */ static struct network_game_globals bss_004566dc = { 0 }; diff --git a/source/networking/network_game_manager.c b/source/networking/network_game_manager.c index c32d0842..9179e129 100644 --- a/source/networking/network_game_manager.c +++ b/source/networking/network_game_manager.c @@ -17,7 +17,7 @@ symbols in this file: 0011A410 00b0: _network_game_reset_for_next_round (0000) 0011A4C0 0010: - _network_game_dump (0000) + _network_game_assign_players_to_team (0000) 0011A4D0 0030: _network_player_is_valid (0000) 0011A500 00b0: @@ -112,45 +112,6 @@ struct game_options char map_name[256]; }; -struct network_machine -{ - wchar_t name[32]; - char machine_index; - byte __padding41[3]; -}; - -struct network_game_map -{ - long __unknown0; - char name[0x80]; -}; - -struct network_game_local_data -{ - boolean game_objects_loaded; - byte __padding431[3]; -}; - -struct network_game -{ - wchar_t name[16]; - struct network_game_map map; - struct game_variant variant; - byte __padding10C; - byte game_mode; - char maximum_player_count; - byte __padding10F; - short difficulty; - short machine_count; - struct network_machine machines[4]; - short player_count; - struct network_player players[16]; - short __unknown426; - unsigned long random_seed; - byte __unknown42C[4]; - struct network_game_local_data local_data; -}; - /* ---------- prototypes */ static long compare_network_players( @@ -286,7 +247,7 @@ void network_game_end_and_load_ui( return; } -void network_game_dump( +void network_game_assign_players_to_team( struct network_game *game, char const *prefix) { @@ -306,7 +267,7 @@ boolean network_game_add_player( 0xBB, game && player); - if (game->player_count < game->maximum_player_count) + if (game->player_count < game->maximum_players) { if (VALID_INDEX(player->machine_index, MAXIMUM_NETWORK_MACHINE_COUNT) && VALID_INDEX(player->controller_index, MAXIMUM_LOCAL_PLAYERS)) @@ -487,8 +448,8 @@ void network_game_invalidate( network_game_invalidate_machine(game, (short)machine_index); csmemset(game->players, NONE, sizeof(game->players)); - game->game_mode = 2; - game->maximum_player_count = 16; + game->minimum_players = 2; + game->maximum_players = 16; game->local_data.game_objects_loaded = FALSE; return; diff --git a/source/networking/network_game_manager.h b/source/networking/network_game_manager.h index 9e2a169d..0b038f76 100644 --- a/source/networking/network_game_manager.h +++ b/source/networking/network_game_manager.h @@ -8,6 +8,11 @@ header included in hcex build. #define __NETWORK_GAME_MANAGER_H #pragma once +/* ---------- headers */ + +#include "game/game_engine.h" +#include "game/players.h" + /* ---------- constants */ /* ---------- macros */ @@ -18,13 +23,52 @@ struct network_game; struct network_machine; struct network_player; +struct network_machine +{ + wchar_t name[32]; + char machine_index; + byte __padding41[3]; +}; + +struct network_game_map +{ + long version; + char name[0x80]; +}; + +struct network_game_local_data +{ + boolean game_objects_loaded; + byte __padding431[3]; +}; + +struct network_game +{ + wchar_t name[16]; + struct network_game_map map; + struct game_variant variant; + byte __padding10C; + char minimum_players; + char maximum_players; + byte maximum_teams; + short difficulty; + short machine_count; + struct network_machine machines[4]; + short player_count; + struct network_player players[16]; + short __unknown426; + unsigned long random_seed; + long number_of_games_played; + struct network_game_local_data local_data; +}; + /* ---------- prototypes/EXAMPLE.C */ void network_game_invalidate_player( struct network_player *player); void network_game_end_and_load_ui( struct network_game *game); -void network_game_dump( +void network_game_assign_players_to_team( struct network_game *game, char const *prefix); boolean network_player_is_valid( diff --git a/source/networking/network_server_manager.c b/source/networking/network_server_manager.c index 66ae1844..1690263e 100644 --- a/source/networking/network_server_manager.c +++ b/source/networking/network_server_manager.c @@ -458,12 +458,12 @@ symbols in this file: #include "cseries/cseries_windows.h" #include "cseries/errors.h" #include "game/game.h" -#include "game/game_engine_runtime.h" +#include "game/game_engine.h" #include "game/player_queues_new.h" #include "game/players.h" #include "interface/ui_widget.h" #include "main/main.h" -#include "math/random_math.h" +#include "math/real_math.h" #include "networking/network_client_manager.h" #include "networking/network_connection.h" #include "networking/network_game_globals.h" @@ -628,43 +628,9 @@ struct message_server_game_update byte player_updates[MAXIMUM_NETWORK_PLAYER_COUNT * PLAYER_UPDATE_SIZE]; }; -struct network_machine -{ - wchar_t name[32]; - char machine_index; - byte padding41[3]; -}; - typedef char network_machine_size_assert[ sizeof(struct network_machine) == 0x44 ? 1 : -1]; -struct network_game_map -{ - long version; - char name[NETWORK_GAME_MAP_NAME_LENGTH]; -}; - -struct network_game -{ - wchar_t name[NETWORK_GAME_NAME_LENGTH]; - struct network_game_map map; - struct game_variant variant; - byte opaque10C; - char minimum_players; - byte maximum_players; - byte maximum_teams; - short difficulty; - short machine_count; - struct network_machine machines[MAXIMUM_NETWORK_MACHINE_COUNT]; - short player_count; - struct network_player players[MAXIMUM_NETWORK_PLAYER_COUNT]; - byte opaque426[2]; - long random_seed; - long number_of_games_played; - boolean load_ui; - byte padding431[3]; -}; - struct network_game_server_client_machine { struct network_connection *connection; @@ -1548,11 +1514,11 @@ void network_game_server_all_machines_have_loaded( server->state = _network_game_server_state_ingame; server->time_of_first_client_loading_completion = 0; - server->game.load_ui = global_network_game_client_get() - ? network_game_client_get_game(global_network_game_client_get())->load_ui + server->game.local_data.game_objects_loaded = global_network_game_client_get() + ? network_game_client_get_game(global_network_game_client_get())->local_data.game_objects_loaded : FALSE; - match_vassert(NETWORK_SERVER_MANAGER_FILE, 0x4E0, server->game.load_ui, + match_vassert(NETWORK_SERVER_MANAGER_FILE, 0x4E0, server->game.local_data.game_objects_loaded, "local game data not loaded"); return; diff --git a/source/networking/network_server_message_handler.c b/source/networking/network_server_message_handler.c index 88491308..9bdea6e9 100644 --- a/source/networking/network_server_message_handler.c +++ b/source/networking/network_server_message_handler.c @@ -330,45 +330,6 @@ struct network_connection; struct network_game_server; struct network_game_server_client_machine; -struct network_machine -{ - wchar_t name[MAXIMUM_MACHINE_NAME_LENGTH]; - char machine_index; - byte padding41[3]; -}; - -struct network_game_map -{ - long unknown; - char name[0x80]; -}; - -struct network_game_local_data -{ - boolean game_objects_loaded; - byte padding[3]; -}; - -struct network_game -{ - wchar_t name[NETWORK_GAME_NAME_LENGTH]; - struct network_game_map map; - struct game_variant variant; - byte unknown; - char minimum_player_count; - char maximum_player_count; - byte team_count; - short difficulty; - short machine_count; - struct network_machine machines[MAXIMUM_NETWORK_MACHINE_COUNT]; - short player_count; - struct network_player players[MAXIMUM_NUMBER_OF_PLAYERS]; - word reserved_after_players; - unsigned long random_seed; - long number_of_games_played; - struct network_game_local_data local_data; -}; - struct network_message { word header; @@ -1207,7 +1168,7 @@ static boolean network_game_server_handle_message_client_broadcast_game_search( csmemcpy(&advertisement.map, &game->map, sizeof(game->map)); advertisement.machine_count = game->machine_count; advertisement.player_count = game->player_count; - advertisement.maximum_player_count = game->maximum_player_count; + advertisement.maximum_player_count = game->maximum_players; advertisement.variant_setting = (short)game->variant.universal_variant.score_to_win; advertisement.flags = 0; if (game->variant.universal_variant.teams == TRUE) diff --git a/source/networking/telnet_console.c b/source/networking/telnet_console.c index 6ac7ed20..e7d54775 100644 --- a/source/networking/telnet_console.c +++ b/source/networking/telnet_console.c @@ -42,6 +42,7 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "cseries/errors.h" #include "bungie_net/network/transport.h" #include "bungie_net/network/transport_endpoint.h" #include "hs/hs.h" diff --git a/source/objects/damage.c b/source/objects/damage.c index 3d19af3d..293ed0d4 100644 --- a/source/objects/damage.c +++ b/source/objects/damage.c @@ -325,10 +325,6 @@ typedef char object_damage_body_body_destroyed_threshold_offset_assert[ static long get_player_index_from_object_or_parents( long object_index); -boolean unit_unsuspecting( - long unit_index, - real_point3d const *point); - static void object_permutation_shield_regions( long object_index, boolean active); diff --git a/source/objects/object_deleted_procs.c b/source/objects/object_deleted_procs.c index c52e45ab..6203741b 100644 --- a/source/objects/object_deleted_procs.c +++ b/source/objects/object_deleted_procs.c @@ -11,7 +11,9 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "ai/ai.h" #include "objects.h" +#include "game/players.h" /* ---------- constants */ @@ -21,9 +23,6 @@ symbols in this file: /* ---------- prototypes */ -void ai_handle_deleted_object(long deleted_object_index); -void players_handle_deleted_object(long deleted_object_index); - /* ---------- globals */ object_deleted_proc object_deleted_procs[3] = diff --git a/source/objects/object_types.c b/source/objects/object_types.c index e15f8905..fcff21ab 100644 --- a/source/objects/object_types.c +++ b/source/objects/object_types.c @@ -127,8 +127,10 @@ symbols in this file: #include "cache/cache_files.h" #include "cutscene/cinematics.h" +#include "devices/device_light_fixtures.h" #include "devices/devices.h" #include "editor/editor_stubs.h" +#include "items/garbage.h" #include "items/items.h" #include "items/projectiles.h" #include "items/projectiles_callbacks.h" @@ -136,7 +138,10 @@ symbols in this file: #include "objects.h" #include "scenario/scenario.h" #include "scenario/scenario_definitions.h" +#include "sound/sound_scenery.h" #include "units/bipeds.h" +#include "units/units.h" +#include "units/vehicles.h" /* ---------- constants */ @@ -159,83 +164,24 @@ void object_types_place_objects( void prefix##_dispose_from_old_map( \ void) -DECLARE_OBJECT_TYPE_LIFECYCLE(units); -DECLARE_OBJECT_TYPE_LIFECYCLE(bipeds); -DECLARE_OBJECT_TYPE_LIFECYCLE(vehicles); -DECLARE_OBJECT_TYPE_LIFECYCLE(items); -DECLARE_OBJECT_TYPE_LIFECYCLE(weapons); DECLARE_OBJECT_TYPE_LIFECYCLE(scenery); -DECLARE_OBJECT_TYPE_LIFECYCLE(devices); DECLARE_OBJECT_TYPE_LIFECYCLE(machines); DECLARE_OBJECT_TYPE_LIFECYCLE(controls); -DECLARE_OBJECT_TYPE_LIFECYCLE(light_fixtures); DECLARE_OBJECT_TYPE_LIFECYCLE(placeholder); #undef DECLARE_OBJECT_TYPE_LIFECYCLE -void object_export_function_values( - long object_index); -void object_render_debug( - long object_index); - -boolean unit_new( - long object_index); -void unit_delete( - long object_index); -boolean unit_update( - long object_index); -void unit_export_function_values( - long object_index); -void unit_handle_deleted_object( - long object_index, - long deleted_object_index); -void unit_handle_region_destroyed( - long object_index, - short region_index, - unsigned long damage_flags); -void unit_postprocess_node_matrices( - long object_index, - struct real_matrix4x3 *node_matrices); -void unit_render_debug( - long object_index); - -boolean vehicle_new( - long object_index); void vehicle_place( long object_index, struct scenario_object_datum *scenario_object); -void vehicle_delete( - long object_index); -boolean vehicle_update( - long object_index); -void vehicle_export_function_values( - long object_index); -void vehicle_preprocess_node_orientations( - long object_index, - struct real_orientation *node_orientations); -void vehicle_reset( - long object_index); -void vehicle_render_debug( - long object_index); void weapon_place( long object_index, struct scenario_object_datum *scenario_object); -void weapon_delete( - long object_index); -boolean weapon_update( - long object_index); -void weapon_preprocess_node_orientations( - long object_index, - struct real_orientation *node_orientations); void equipment_place( long object_index, struct scenario_object_datum *scenario_object); -boolean garbage_new( - long object_index); -boolean garbage_update( - long object_index); boolean scenery_new( long object_index); @@ -247,16 +193,6 @@ void scenery_delete( boolean scenery_update( long object_index); -boolean sound_scenery_new( - long object_index); -void sound_scenery_delete( - long object_index); - -boolean device_new( - long object_index); -void device_delete( - long object_index); - boolean machine_new( long object_index); void machine_place( @@ -277,15 +213,9 @@ void control_delete( boolean control_update( long object_index); -boolean light_fixture_new( - long object_index); void light_fixture_place( long object_index, struct scenario_object_datum *scenario_object); -void light_fixture_delete( - long object_index); -boolean light_fixture_update( - long object_index); boolean placeholder_new( long object_index); diff --git a/source/physics/bsp3d.c b/source/physics/bsp3d.c index 67f8813b..053d3c7b 100644 --- a/source/physics/bsp3d.c +++ b/source/physics/bsp3d.c @@ -30,6 +30,7 @@ symbols in this file: #include "cseries.h" #include "bsp3d.h" +#include "math/geometry.h" /* ---------- constants */ @@ -59,16 +60,6 @@ typedef void (*bsp3d_polygon_leaf_proc)( /* ---------- prototypes */ -short convex_polygon3d_clip_to_plane( - short vertex_count, - real_point3d const *vertices, - real_plane3d const *plane, - short maximum_vertex_count, - real_point3d *clipped_vertices, - short *vertex_indices, - real epsilon, - boolean keep_degenerate); - static long bsp3d_clip_polygon_to_leaves_recursive( struct bsp3d const *bsp, long node_index, diff --git a/source/physics/collision_bsp.h b/source/physics/collision_bsp.h index c9ecf4d3..ada7e97d 100644 --- a/source/physics/collision_bsp.h +++ b/source/physics/collision_bsp.h @@ -169,6 +169,7 @@ void render_debug_collision_surface( long surface_index, real_matrix4x3 const *matrix, real_argb_color const *color); +void render_debug_collision_bsp(struct collision_bsp *bsp, const real_matrix4x3 *matrix); /* ---------- globals */ diff --git a/source/physics/collision_models.c b/source/physics/collision_models.c index 5eeaf586..88f54153 100644 --- a/source/physics/collision_models.c +++ b/source/physics/collision_models.c @@ -11,6 +11,7 @@ COLLISION_MODELS.C #include "collision_bsp_definitions.h" #include "collision_model_definitions.h" #include "collision_models.h" +#include "collision_features.h" #include "collision_usage.h" #include "objects/object_types.h" @@ -25,33 +26,6 @@ COLLISION_MODELS.C /* ---------- prototypes */ -long bsp3d_test_point(const struct bsp3d *bsp, long node_index, const real_point3d *point); -boolean collision_bsp_test_vector( - unsigned long flags, - const struct collision_bsp *bsp, - short breakable_surface_count, - const byte *breakable_surface_flags, - const real_point3d *point, - const real_vector3d *vector, - real maximum_t, - struct collision_bsp_test_vector_result *result); -boolean collision_bsp_test_pill( - const struct collision_bsp *bsp, - const real_point3d *point, - const real_vector3d *vector, - real radius, - real maximum_t, - struct collision_bsp_test_pill_result *result); -void collision_bsp_get_features_in_sphere( - const struct collision_bsp *bsp, - const struct collision_bsp_test_sphere_result *result, - const real_matrix4x3 *matrix, - real height, - real width, - long object_index, - struct collision_feature_list *features); -void render_debug_collision_bsp(struct collision_bsp *bsp, const real_matrix4x3 *matrix); - /* ---------- globals */ /* ---------- public code */ diff --git a/source/physics/collisions.c b/source/physics/collisions.c index 7bed93e0..7c600cd9 100644 --- a/source/physics/collisions.c +++ b/source/physics/collisions.c @@ -144,22 +144,6 @@ struct collision_usage_times /* ---------- prototypes */ -boolean collision_bsp_test_pill_new( - struct collision_bsp const *bsp, - short breakable_surface_count, - byte const *breakable_surface_flags, - real_point3d const *point, - real_vector3d const *vector, - real radius, - real *t, - real_vector3d *normal); -boolean collision_bsp_test_pill( - struct collision_bsp const *bsp, - real_point3d const *point, - real_vector3d const *vector, - real radius, - real maximum_t, - struct collision_bsp_test_pill_result *result); static boolean object_test_point( long object_index, unsigned long flags, diff --git a/source/physics/physics.c b/source/physics/physics.c index 7e93fd4c..17bdcc47 100644 --- a/source/physics/physics.c +++ b/source/physics/physics.c @@ -103,7 +103,7 @@ symbols in this file: #include "effects/material_effect_definitions.h" #include "game/game.h" #include "game/game_globals.h" -#include "math/matrix_math.h" +#include "math/real_math.h" #include "objects/damage.h" #include "objects/object_definitions.h" #include "objects/object_types.h" diff --git a/source/rasterizer/rasterizer.c b/source/rasterizer/rasterizer.c index 6bbe6c0e..b80443b8 100644 --- a/source/rasterizer/rasterizer.c +++ b/source/rasterizer/rasterizer.c @@ -304,7 +304,7 @@ symbols in this file: #include "real_math.h" #include "rasterizer_widgets.h" #include "rasterizer.h" -#include "rasterizer/rasterizer_debug_options.h" +#include "rasterizer/rasterizer_console_vars.h" #include "rasterizer/rasterizer_globals_internal.h" #include "rasterizer_geometry.h" #include "rasterizer_models.h" @@ -329,7 +329,7 @@ enum /* ---------- macros */ #define rasterizer_model_obscurer_object_index bss_004662ec -#define rasterizer_debug_model_vertices_enabled rasterizer_debug_options.debug_model_vertices +#define rasterizer_debug_model_vertices_enabled rasterizer_debug_options.debug_model_vertices_enabled /* ---------- structures */ @@ -402,8 +402,6 @@ void _rasterizer_decal_vertices_delete( long decal_vertex_buffer_index); void _rasterizer_decal_vertices_unlock( void); -void _rasterizer_widget_end( - void); void _rasterizer_decals_update_function_pointers(void); void _rasterizer_decals_initialize( @@ -425,9 +423,9 @@ void _rasterizer_decals_flush( void _rasterizer_detail_objects_begin( void); void _rasterizer_detail_objects_rebuild_vertices( - struct detail_object_view_data *view_data); + struct detail_object_view_data const *detail_object_view_data); void _rasterizer_detail_objects_draw( - struct detail_object_view_data *view_data); + struct detail_object_view_data const *detail_object_view_data); void _rasterizer_detail_objects_end( void); void _rasterizer_screen_effect( @@ -585,7 +583,8 @@ struct rasterizer_globals_definition rasterizer_globals = { 0 }, { 0 }, { 0 }, - { 0, 3, 0, 0 }, + 768, + 0, FALSE, TRUE, FALSE, @@ -596,85 +595,87 @@ struct rasterizer_globals_definition rasterizer_globals = 1024.f, 0.01171875f, 1024.f, - { 0 } + NULL, + NULL, + NULL }; -struct rasterizer_debug_options_definition rasterizer_debug_options = +struct rasterizer_debug_options rasterizer_debug_options = { FALSE, /* fps_accumulation */ 0, /* pad01 */ - 0, /* stats */ - 0, /* mode */ - FALSE, /* wireframe */ - FALSE, /* debug_model_vertices */ + 0, /* statistics_mode */ + 0, /* drawing_mode */ + FALSE, /* wireframe_enabled */ + FALSE, /* debug_model_vertices_enabled */ NONE, /* debug_model_lod */ - FALSE, /* debug_transparents */ - FALSE, /* debug_meter_shader */ - TRUE, /* models */ - TRUE, /* model_transparents */ + FALSE, /* debug_transparent_geometry_enabled */ + FALSE, /* debug_meter_shader_enabled */ + TRUE, /* draw_models */ + TRUE, /* draw_model_transparent_geometry */ TRUE, /* draw_first_person_weapon_first */ - TRUE, /* stencil_mask */ - 2, /* environment */ - TRUE, /* environment_lightmaps */ - TRUE, /* environment_shadows */ - TRUE, /* environment_diffuse_lights */ - TRUE, /* environment_diffuse_textures */ - TRUE, /* environment_decals */ - TRUE, /* environment_specular_lights */ - TRUE, /* environment_specular_lightmaps */ - TRUE, /* environment_reflection_lightmap_mask */ - TRUE, /* environment_reflection_mirrors */ - TRUE, /* environment_reflections */ - TRUE, /* environment_transparents */ - TRUE, /* environment_fog */ - TRUE, /* environment_fog_screen */ - TRUE, /* water */ - TRUE, /* lens_flares */ - TRUE, /* dynamic_unlit_geometry */ - TRUE, /* dynamic_lit_geometry */ - TRUE, /* dynamic_screen_geometry */ - TRUE, /* hud_motion_sensor */ - TRUE, /* detail_objects */ - TRUE, /* debug_geometry */ + TRUE, /* stencil_mask_enabled */ + 2, /* draw_environment */ + TRUE, /* draw_environment_lightmaps */ + TRUE, /* draw_environment_shadows */ + TRUE, /* draw_environment_diffuse_lights */ + TRUE, /* draw_environment_textures */ + TRUE, /* draw_environment_decals */ + TRUE, /* draw_environment_specular_lights */ + TRUE, /* draw_environment_specular_lightmaps */ + TRUE, /* draw_environment_reflection_lightmap_masks */ + TRUE, /* draw_environment_reflection_mirrors */ + TRUE, /* draw_environment_reflections */ + TRUE, /* draw_environment_transparent_geometry */ + TRUE, /* draw_environment_fog */ + TRUE, /* draw_environment_fog_screen */ + TRUE, /* draw_water */ + TRUE, /* draw_lens_flares */ + TRUE, /* draw_dynamic_unlit_geometry */ + TRUE, /* draw_dynamic_lit_geometry */ + TRUE, /* draw_dynamic_screen_geometry */ + TRUE, /* draw_hud_motion_sensor */ + TRUE, /* draw_detail_objects */ + TRUE, /* draw_debug_geometry */ FALSE, /* debug_geometry_multipass */ - TRUE, /* fog_atmosphere */ - TRUE, /* fog_plane */ - TRUE, /* bump_mapping */ + TRUE, /* fog_atmospheric_enabled */ + TRUE, /* fog_planar_enabled */ + TRUE, /* bump_mapping_enabled */ { 0 }, /* pad2A[2] */ 1.0f, /* lightmap_ambient */ - { 0 }, /* reserved30[2] */ + 0, /* _lightmap_mode */ 0, /* pad3 */ - TRUE, /* lightmaps_incident_radiosity */ - TRUE, /* lightmaps_filtering */ + TRUE, /* lightmap_incident_radiosity_enabled */ + TRUE, /* lightmap_filtering_enabled */ { 0 }, /* pad36[2] */ 0.0f, /* model_lighting_ambient */ - TRUE, /* environment_alpha_testing */ - TRUE, /* environment_specular_mask */ - TRUE, /* shadows_convolution */ - FALSE, /* shadows_debug */ - FALSE, /* water_mipmapping */ - TRUE, /* active_camouflage */ - TRUE, /* active_camouflage_multipass */ - TRUE, /* plasma_energy */ - TRUE, /* lens_flares_occlusion */ - FALSE, /* lens_flares_occlusion_debug */ - TRUE, /* ray_of_buddha */ - TRUE, /* screen_flashes */ - TRUE, /* screen_effects */ - FALSE, /* DXTC_noise */ - FALSE, /* soft_filter */ - FALSE, /* secondary_render_target_debug */ - FALSE, /* profile_log */ + TRUE, /* environment_alpha_testing_enabled */ + TRUE, /* environment_specular_mask_enabled */ + TRUE, /* shadow_convolution_enabled */ + FALSE, /* shadow_debug_enabled */ + FALSE, /* water_mipmapping_enabled */ + TRUE, /* active_camouflage_enabled */ + TRUE, /* active_camouflage_multipass_enabled */ + TRUE, /* plasma_energy_enabled */ + TRUE, /* lens_flare_occlusion_enabled */ + FALSE, /* lens_flare_occlusion_debug */ + TRUE, /* lens_flare_sun_glow_enabled */ + TRUE, /* screen_flash_enabled */ + TRUE, /* screen_effects_enabled */ + FALSE, /* DXTC_noise_enabled */ + FALSE, /* soft_filter_enabled */ + FALSE, /* secondary_render_target_debug_enabled */ + FALSE, /* profile_log_enabled */ { 0 }, /* pad4D[3] */ - 0.4f, /* detail_objects_offset_multiplier */ + 0.4f, /* detail_object_screen_facing_offset_multiplier */ 8, /* zbias */ 1.0f / 256.0f, /* zoffset */ FALSE, /* force_all_player_views_to_default_player */ - FALSE, /* safe_frame_bounds */ + FALSE, /* safe_frame_bounds_adjust_enabled */ 0, /* freeze_flying_camera */ - TRUE, /* zsprites */ - TRUE, /* filthy_decal_fog_hack */ - TRUE, /* smart */ - FALSE, /* splitscreen_VB_optimization */ + TRUE, /* zsprite_enabled */ + TRUE, /* filthy_decal_fog_hack_enabled */ + TRUE, /* smart_states_enabled */ + FALSE, /* splitscreen_VB_optimization_enabled */ FALSE, /* profile_print_locks */ { 0 }, /* pad65[3] */ 0.0f, /* profile_objectlock_time */ @@ -716,22 +717,22 @@ void rasterizer_reset_state( void rasterizer_frame_begin( struct rasterizer_frame_begin_parameters const *parameters) { - if (rasterizer_debug_options.environment <= 1) + if (rasterizer_debug_options.draw_environment <= 1) { - rasterizer_debug_options.environment_fog = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_transparents = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_reflections = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_reflection_mirrors = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_reflection_lightmap_mask = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_specular_lightmaps = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_specular_lights = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_decals = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_diffuse_textures = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_shadows = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_diffuse_lights = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_lightmaps = rasterizer_debug_options.environment; - rasterizer_debug_options.environment_fog_screen = rasterizer_debug_options.environment; - rasterizer_debug_options.environment = 2; + rasterizer_debug_options.draw_environment_fog = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_transparent_geometry = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_reflections = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_reflection_mirrors = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_reflection_lightmap_masks = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_specular_lightmaps = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_specular_lights = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_decals = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_textures = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_shadows = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_diffuse_lights = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_lightmaps = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment_fog_screen = rasterizer_debug_options.draw_environment; + rasterizer_debug_options.draw_environment = 2; } if (rasterizer_globals.near_clip_distance == 0.f) diff --git a/source/rasterizer/rasterizer.h b/source/rasterizer/rasterizer.h index 2841065e..6bd49437 100644 --- a/source/rasterizer/rasterizer.h +++ b/source/rasterizer/rasterizer.h @@ -204,7 +204,8 @@ struct rasterizer_globals_definition volatile unsigned long previous_vertical_blank_index; }; }; - byte reserved38[4]; + short push_buffer_size; + short kick_off_size; boolean floating_point_zbuffer; boolean framerate_throttle; boolean framerate_throttle_debug; @@ -215,7 +216,9 @@ struct rasterizer_globals_definition real far_clip_distance; real first_person_weapon_near_clip_distance; real first_person_weapon_far_clip_distance; - byte reserved54[0xC]; + void *default_2d_hardware_format; + void *default_3d_hardware_format; + void *default_cm_hardware_format; short lightmap_mode; byte reserved62[0x6]; }; @@ -259,6 +262,129 @@ struct rasterizer_window_begin_parameters struct render_screen_effect screen_effect; }; +/* January's 0x170-byte linker-common record. Only counters already used by + * reconstructed writers are named here; unreviewed interiors stay reserved. */ +struct rasterizer_frame_statistics_globals +{ + real frames_per_second; + short fps_sample_count; + short pad006; + real average_frames_per_second; + real minimum_frames_per_second; + real maximum_frames_per_second; + long vertices_by_permutation[4]; /* per model vertex-shader permutation */ + unsigned long lightmap_dynamic_vertex_count; + unsigned long lightmap_dynamic_triangle_count; + unsigned long lightmap_dynamic_draw_count; + unsigned long shadow_count; + unsigned long shadow_vertex_count; + unsigned long shadow_triangle_count; + unsigned long shadow_draw_count; + unsigned long environment_dynamic_vertex_count; + unsigned long environment_dynamic_triangle_count; + unsigned long environment_dynamic_draw_count; + unsigned long decal_vertex_count; + unsigned long decal_triangle_count; + unsigned long decal_draw_count; + unsigned long decal_shader_change_count; + unsigned long decal_texture_change_count; + unsigned long diffuse_texture_dynamic_vertex_count; + unsigned long diffuse_texture_dynamic_triangle_count; + unsigned long diffuse_texture_dynamic_draw_count; + unsigned long specular_light_dynamic_vertex_count; + unsigned long specular_light_dynamic_triangle_count; + unsigned long specular_light_dynamic_draw_count; + unsigned long specular_lightmap_dynamic_vertex_count; + unsigned long specular_lightmap_dynamic_triangle_count; + unsigned long specular_lightmap_dynamic_draw_count; + unsigned long reflection_mask_dynamic_vertex_count; + unsigned long reflection_mask_dynamic_triangle_count; + unsigned long reflection_mask_dynamic_draw_count; + unsigned long reflection_dynamic_vertex_count; + unsigned long reflection_dynamic_triangle_count; + unsigned long reflection_dynamic_draw_count; + unsigned long transparent_geometry_dynamic_vertex_count; + unsigned long transparent_geometry_dynamic_triangle_count; + long transparent_geometry_largest_dynamic_triangle_count; + unsigned long transparent_geometry_dynamic_draw_count; + unsigned long environment_fog_dynamic_vertex_count; + unsigned long environment_fog_dynamic_triangle_count; + unsigned long environment_fog_dynamic_draw_count; + unsigned long environment_fog_screen_dynamic_vertex_count; + unsigned long environment_fog_screen_dynamic_triangle_count; + unsigned long environment_fog_screen_dynamic_draw_count; + unsigned long environment_fog_screen_model_count; + unsigned long environment_fog_screen_static_vertex_count; + unsigned long environment_fog_screen_static_triangle_count; + unsigned long environment_fog_screen_static_draw_count; + unsigned long model_count; + unsigned long model_vertex_count; + unsigned long model_triangle_count; + unsigned long model_draw_count; + long transparent_model_vertex_count; + long transparent_model_triangle_count; + long transparent_model_maximum_triangle_count; + long transparent_model_submit_count; + unsigned long model_shadow_count; + unsigned long model_shadow_vertex_count; + unsigned long model_shadow_triangle_count; + unsigned long model_shadow_draw_count; + unsigned long dynamic_unlit_draw_count; + unsigned long dynamic_unlit_triangle_count; + long largest_dynamic_unlit_triangle_count; + unsigned long dynamic_unlit_vertex_count; + byte reserved114[0x1C]; + long dynamic_vertex_count; + long dynamic_vertex_buffer_count; + long dynamic_triangle_count; + long dynamic_triangle_buffer_count; + long debug_primitive_count; + byte reserved144[4]; + long dynamic_light_count; + long lens_flare_count; + long vertex_shader_skinning_constant_bytes; + long vertex_shader_lighting_constant_bytes; + long vertex_shader_instruction_count; + long pixel_shader_pushbuffer_bytes; + unsigned long model_skinning_constant_bytes; + unsigned long model_lighting_constant_bytes; + unsigned long model_vertex_shader_work_accumulated; + byte reserved16C[4]; +}; + +typedef char rasterizer_frame_statistics_globals_size_assert[ + sizeof(struct rasterizer_frame_statistics_globals) == 0x170 ? 1 : -1]; +typedef char rasterizer_frame_statistics_environment_fog_screen_dynamic_vertex_count_offset_assert[ + offsetof( + struct rasterizer_frame_statistics_globals, + environment_fog_screen_dynamic_vertex_count) == 0xB8 ? 1 : -1]; +typedef char rasterizer_frame_statistics_environment_fog_screen_dynamic_triangle_count_offset_assert[ + offsetof( + struct rasterizer_frame_statistics_globals, + environment_fog_screen_dynamic_triangle_count) == 0xBC ? 1 : -1]; +typedef char rasterizer_frame_statistics_environment_fog_screen_dynamic_draw_count_offset_assert[ + offsetof( + struct rasterizer_frame_statistics_globals, + environment_fog_screen_dynamic_draw_count) == 0xC0 ? 1 : -1]; +typedef char rasterizer_frame_statistics_environment_fog_screen_model_count_offset_assert[ + offsetof( + struct rasterizer_frame_statistics_globals, + environment_fog_screen_model_count) == 0xC4 ? 1 : -1]; +typedef char rasterizer_frame_statistics_environment_fog_screen_static_vertex_count_offset_assert[ + offsetof( + struct rasterizer_frame_statistics_globals, + environment_fog_screen_static_vertex_count) == 0xC8 ? 1 : -1]; +typedef char rasterizer_frame_statistics_environment_fog_screen_static_triangle_count_offset_assert[ + offsetof( + struct rasterizer_frame_statistics_globals, + environment_fog_screen_static_triangle_count) == 0xCC ? 1 : -1]; +typedef char rasterizer_frame_statistics_environment_fog_screen_static_draw_count_offset_assert[ + offsetof( + struct rasterizer_frame_statistics_globals, + environment_fog_screen_static_draw_count) == 0xD0 ? 1 : -1]; + +struct transparent_geometry_group; + /* ---------- prototypes/RASTERIZER.C */ void rasterizer_reset_state( @@ -363,6 +489,8 @@ void rasterizer_decals_end( void); void rasterizer_decals_draw( short cluster_index); +void rasterizer_decals_flush( + void); void rasterizer_decals_update_function_pointers(void); void rasterizer_detail_objects_begin( void); @@ -568,14 +696,6 @@ void rasterizer_psuedo_dynamic_screen_quad_draw( struct rasterizer_dynamic_screen_geometry_parameters *parameters, struct dynamic_screen_vertex *vertices); #ifndef RASTERIZER_WIDGET_SIGNATURES_OWNED -void rasterizer_widget_submit( - long object_index, - long widget_index, - real_point3d const *centroid, - rasterizer_widget_render_proc render_proc); -void rasterizer_widget_begin( - short type, - word flags); #endif void rasterizer_profile_enable( boolean enable); @@ -602,27 +722,6 @@ void rasterizer_environment_fog_screen_draw( long triangle_count, struct vertex_buffer const *vertex_buffer); #ifndef RASTERIZER_WIDGET_SIGNATURES_OWNED -boolean rasterizer_widget_set_texture( - short stage_index, - long bitmap_group_index, - short sequence_index); -void rasterizer_widget_set_tint_factor( - long handle); -long rasterizer_widget_set_zbuffer_enable( - long handle, - long enable); -short rasterizer_widget_draw_sprite2d( - long dynamic_vertex_buffer_index); -void rasterizer_widget_draw_sprite3d( - real_point3d const *point, - real radius, - real_vector2d const *scale, - real rotation, - unsigned long color); -void rasterizer_widget_submit_occlusion_test( - long handle); -long rasterizer_widget_get_occlusion_test_result( - long handle); #endif /* ---------- prototypes/RASTERIZER_XBOX_ACTIVE_CAMOUFLAGE.C */ @@ -663,6 +762,19 @@ boolean rasterizer_frame_statistics_initialize( void); void rasterizer_frame_statistics_begin( void); +void rasterizer_frame_statistics_get_fps( + struct rasterizer_frame_statistics_globals *frame_statistics); +void rasterizer_fps_accumulate( + void); +long rasterizer_frame_statistics_count_static_vertices( + struct triangle_buffer const *triangle_buffer, + struct vertex_buffer const *vertex_buffer); +long rasterizer_frame_statistics_count_dynamic_vertices( + long dynamic_triangle_buffer_index, + long first_triangle_index, + long triangle_count); +void rasterizer_frame_statistics_draw( + void); void rasterizer_frame_statistics_end( void); void rasterizer_frame_statistics_dispose( @@ -680,15 +792,54 @@ void rasterizer_transparent_geometry_begin( void); void rasterizer_transparent_geometry_end( void); +short rasterizer_transparent_geometry_get_primary_vertex_type( + struct transparent_geometry_group const *group); +void rasterizer_transparent_geometry_set_group_pending_status( + struct transparent_geometry_group const *group, + boolean pending); +boolean rasterizer_transparent_geometry_get_group_pending_status( + struct transparent_geometry_group const *group); +short rasterizer_transparent_geometry_get_group_presorted_index( + struct transparent_geometry_group const *group); +void *rasterizer_transparent_geometry_get_group_from_presorted_index( + short presorted_index); +void *rasterizer_transparent_geometry_get_groups2( + short *group_count); +struct transparent_geometry_group *rasterizer_transparent_geometry_next_group( + struct transparent_geometry_group const *group); +struct transparent_geometry_group *rasterizer_transparent_geometry_new_group( + void); +struct transparent_geometry_group *rasterizer_transparent_geometry_new_group2( + void); +void rasterizer_transparent_geometry_stop( + void); +void rasterizer_transparent_geometry_dispose( + void); void rasterizer_transparent_geometry_draw( boolean water); /* ---------- prototypes/RASTERIZER_DEBUG.C */ +boolean rasterizer_debug_initialize( + void); void rasterizer_debug_begin( void); void rasterizer_debug_end( void); +void rasterizer_debug_dispose( + void); +void rasterizer_debug_draw( + void); +void rasterizer_debug_line_shaded( + real_point3d const *p0, + real_point3d const *p1, + real_argb_color const *color0, + real_argb_color const *color1); +void rasterizer_debug_triangle( + real_point3d const *p0, + real_point3d const *p1, + real_point3d const *p2, + real_argb_color const *color); /* ---------- prototypes/RASTERIZER_XBOX_DEBUG.C */ @@ -750,6 +901,8 @@ extern struct rasterizer_globals_definition rasterizer_globals; extern struct rasterizer_frame_begin_parameters global_frame_parameters; extern struct rasterizer_window_begin_parameters global_window_parameters; +extern struct rasterizer_frame_statistics_globals rasterizer_frame_statistics; + /* ---------- public code */ #endif // __RASTERIZER_H diff --git a/source/rasterizer/rasterizer_console_vars.h b/source/rasterizer/rasterizer_console_vars.h index 8fee0e31..e2dcfdb0 100644 --- a/source/rasterizer/rasterizer_console_vars.h +++ b/source/rasterizer/rasterizer_console_vars.h @@ -1,23 +1,129 @@ /* RASTERIZER_CONSOLE_VARS.H -header included in hcex build. +Rasterizer debug options (the rasterizer_* script and console globals). + +Header ownership is INFERRED: every HCEX (2011) compiland that corresponds to a +January user of these globals lists rasterizer_console_vars.h, and no +first-party build lists a rasterizer_debug_options.h. +Type and member names are LATER-BUILD-ATTESTED: the Halo PC demo PDB (2003) and +the HCEX PDB (2011) agree on every member name; the type name follows the demo +(HCEX spells it rasterizer_debug_options_struct). +Offsets, widths and types are January's: January's script-global table registers +zbias as a long integer (the later PDBs say float); January has pad3_scale at +0x6C and f at 0x70, where the later builds insert three shorts; the transparent +pixel counter bytes at 0x88 exist only in January. Bytes no PDB names keep +descriptive names. */ #ifndef __RASTERIZER_CONSOLE_VARS_H #define __RASTERIZER_CONSOLE_VARS_H #pragma once +/* ---------- headers */ + +#include "cseries.h" + /* ---------- constants */ /* ---------- macros */ /* ---------- structures */ +struct rasterizer_debug_options +{ + boolean fps_accumulation; /* 0x00 */ + byte pad01; /* 0x01 */ + short statistics_mode; /* 0x02 */ + short drawing_mode; /* 0x04 */ + boolean wireframe_enabled; /* 0x06 */ + boolean debug_model_vertices_enabled; /* 0x07 */ + short debug_model_lod; /* 0x08 */ + boolean debug_transparent_geometry_enabled; /* 0x0A */ + boolean debug_meter_shader_enabled; /* 0x0B */ + boolean draw_models; /* 0x0C */ + boolean draw_model_transparent_geometry; /* 0x0D */ + boolean draw_first_person_weapon_first; /* 0x0E */ + boolean stencil_mask_enabled; /* 0x0F */ + byte draw_environment; /* 0x10 */ + boolean draw_environment_lightmaps; /* 0x11 */ + boolean draw_environment_shadows; /* 0x12 */ + boolean draw_environment_diffuse_lights; /* 0x13 */ + boolean draw_environment_textures; /* 0x14 */ + boolean draw_environment_decals; /* 0x15 */ + boolean draw_environment_specular_lights; /* 0x16 */ + boolean draw_environment_specular_lightmaps; /* 0x17 */ + boolean draw_environment_reflection_lightmap_masks; /* 0x18 */ + boolean draw_environment_reflection_mirrors; /* 0x19 */ + boolean draw_environment_reflections; /* 0x1A */ + boolean draw_environment_transparent_geometry; /* 0x1B */ + boolean draw_environment_fog; /* 0x1C */ + boolean draw_environment_fog_screen; /* 0x1D */ + boolean draw_water; /* 0x1E */ + boolean draw_lens_flares; /* 0x1F */ + boolean draw_dynamic_unlit_geometry; /* 0x20 */ + boolean draw_dynamic_lit_geometry; /* 0x21 */ + boolean draw_dynamic_screen_geometry; /* 0x22 */ + boolean draw_hud_motion_sensor; /* 0x23 */ + boolean draw_detail_objects; /* 0x24 */ + boolean draw_debug_geometry; /* 0x25 */ + boolean debug_geometry_multipass; /* 0x26 */ + boolean fog_atmospheric_enabled; /* 0x27 */ + boolean fog_planar_enabled; /* 0x28 */ + boolean bump_mapping_enabled; /* 0x29 */ + byte pad2A[2]; /* 0x2A */ + real lightmap_ambient; /* 0x2C */ + short _lightmap_mode; /* 0x30 */ + short pad3; /* 0x32 */ + boolean lightmap_incident_radiosity_enabled; /* 0x34 */ + boolean lightmap_filtering_enabled; /* 0x35 */ + byte pad36[2]; /* 0x36 */ + real model_lighting_ambient; /* 0x38 */ + boolean environment_alpha_testing_enabled; /* 0x3C */ + boolean environment_specular_mask_enabled; /* 0x3D */ + boolean shadow_convolution_enabled; /* 0x3E */ + boolean shadow_debug_enabled; /* 0x3F */ + boolean water_mipmapping_enabled; /* 0x40 */ + boolean active_camouflage_enabled; /* 0x41 */ + boolean active_camouflage_multipass_enabled; /* 0x42 */ + boolean plasma_energy_enabled; /* 0x43 */ + boolean lens_flare_occlusion_enabled; /* 0x44 */ + boolean lens_flare_occlusion_debug; /* 0x45 */ + boolean lens_flare_sun_glow_enabled; /* 0x46 */ + boolean screen_flash_enabled; /* 0x47 */ + boolean screen_effects_enabled; /* 0x48 */ + boolean DXTC_noise_enabled; /* 0x49 */ + boolean soft_filter_enabled; /* 0x4A */ + boolean secondary_render_target_debug_enabled; /* 0x4B */ + boolean profile_log_enabled; /* 0x4C */ + byte pad4D[3]; /* 0x4D */ + real detail_object_screen_facing_offset_multiplier; /* 0x50 */ + long zbias; /* 0x54 */ + real zoffset; /* 0x58 */ + boolean force_all_player_views_to_default_player; /* 0x5C */ + boolean safe_frame_bounds_adjust_enabled; /* 0x5D */ + short freeze_flying_camera; /* 0x5E */ + boolean zsprite_enabled; /* 0x60 */ + boolean filthy_decal_fog_hack_enabled; /* 0x61 */ + boolean smart_states_enabled; /* 0x62 */ + boolean splitscreen_VB_optimization_enabled; /* 0x63 */ + boolean profile_print_locks; /* 0x64 */ + byte pad65[3]; /* 0x65 */ + real profile_objectlock_time; /* 0x68 */ + real pad3_scale; /* 0x6C */ + real f[6]; /* 0x70 */ + boolean transparent_pixel_counter_active; /* 0x88 */ + boolean transparent_pixel_counter; /* 0x89 */ + byte pad8A[2]; /* 0x8A */ +}; + /* ---------- prototypes/EXAMPLE.C */ /* ---------- globals */ +extern struct rasterizer_debug_options rasterizer_debug_options; +extern boolean debug_render_freeze; + /* ---------- public code */ #endif // __RASTERIZER_CONSOLE_VARS_H diff --git a/source/rasterizer/rasterizer_debug.c b/source/rasterizer/rasterizer_debug.c index bfada374..abd08e5d 100644 --- a/source/rasterizer/rasterizer_debug.c +++ b/source/rasterizer/rasterizer_debug.c @@ -58,7 +58,6 @@ symbols in this file: /* ---------- headers */ -#include "rasterizer/rasterizer_frame_statistics.h" #include #include "cseries.h" @@ -66,7 +65,7 @@ symbols in this file: #include "interface/hud_draw.h" #include "bitmaps/bitmap_color_conversion.h" #include "rasterizer.h" -#include "rasterizer_debug.h" +#include "rasterizer_console_vars.h" #include "rasterizer_geometry.h" #include "rasterizer/xbox/rasterizer_xbox_debug.h" #include "rasterizer/xbox/rasterizer_xbox_draw_primitives.h" @@ -126,33 +125,20 @@ struct rasterizer_debug_data }; #pragma pack(pop) -struct rasterizer_debug_options_prefix -{ - byte reserved00[2]; - short stats; - byte reserved04[0x21]; - boolean debug_geometry; -}; - typedef char rasterizer_debug_data_size_assert[ sizeof(struct rasterizer_debug_data) == 0x21 ? 1 : -1]; typedef char rasterizer_debug_primitive_size_assert[ sizeof(struct rasterizer_debug_primitive) == 0x3C ? 1 : -1]; -typedef char rasterizer_debug_options_debug_geometry_offset_assert[ - offsetof(struct rasterizer_debug_options_prefix, debug_geometry) == 0x25 ? 1 : -1]; /* ---------- prototypes */ +long rasterizer_debug_new_primitive( + long *primitive_count); +void rasterizer_debug_test( + void); static int __cdecl rasterizer_debug_compare_primitives( void const *primitive0_pointer, void const *primitive1_pointer); -long rasterizer_debug_new_primitive( - long *primitive_count); -void rasterizer_debug_line_shaded( - real_point3d const *p0, - real_point3d const *p1, - real_argb_color const *color0, - real_argb_color const *color1); void rasterizer_debug_triangle_shaded( real_point3d const *p0, real_point3d const *p1, @@ -165,8 +151,6 @@ void rasterizer_debug_triangle_shaded( static struct rasterizer_debug_data debug_data; -extern struct rasterizer_debug_options_prefix rasterizer_debug_options; - /* ---------- public code */ long rasterizer_debug_new_primitive( @@ -180,7 +164,7 @@ long rasterizer_debug_new_primitive( primitive_index = (*primitive_count)++; debug_data.primitive_count++; - if (rasterizer_debug_options.stats==_rasterizer_stats_geometry) + if (rasterizer_debug_options.statistics_mode==_rasterizer_stats_geometry) { rasterizer_frame_statistics.debug_primitive_count++; } @@ -331,7 +315,7 @@ void rasterizer_debug_draw( if (debug_data.initialized && debug_data.primitive_count>0 && - rasterizer_debug_options.debug_geometry) + rasterizer_debug_options.draw_debug_geometry) { match_assert( "c:\\halo\\SOURCE\\rasterizer\\rasterizer_debug.c", @@ -536,7 +520,7 @@ void rasterizer_debug_line_shaded( real_argb_color const *color0, real_argb_color const *color1) { - if (debug_data.initialized && rasterizer_debug_options.debug_geometry) + if (debug_data.initialized && rasterizer_debug_options.draw_debug_geometry) { match_assert( "c:\\halo\\SOURCE\\rasterizer\\rasterizer_debug.c", @@ -602,7 +586,7 @@ void rasterizer_debug_triangle_shaded( real_argb_color const *color1, real_argb_color const *color2) { - if (debug_data.initialized && rasterizer_debug_options.debug_geometry) + if (debug_data.initialized && rasterizer_debug_options.draw_debug_geometry) { match_assert( "c:\\halo\\SOURCE\\rasterizer\\rasterizer_debug.c", diff --git a/source/rasterizer/rasterizer_debug.h b/source/rasterizer/rasterizer_debug.h deleted file mode 100644 index a6923320..00000000 --- a/source/rasterizer/rasterizer_debug.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -RASTERIZER_DEBUG.H -*/ - -#ifndef __RASTERIZER_DEBUG_H -#define __RASTERIZER_DEBUG_H -#pragma once - -/* ---------- headers */ - -#include "cseries.h" -#include "math/real_math.h" - -/* ---------- prototypes/RASTERIZER_DEBUG.C */ - -boolean rasterizer_debug_initialize( - void); -long rasterizer_debug_new_primitive( - long *primitive_count); -void rasterizer_debug_dispose( - void); -void rasterizer_debug_test( - void); -void rasterizer_debug_draw( - void); -void rasterizer_debug_line_shaded( - real_point3d const *p0, - real_point3d const *p1, - real_argb_color const *color0, - real_argb_color const *color1); -void rasterizer_debug_triangle_shaded( - real_point3d const *p0, - real_point3d const *p1, - real_point3d const *p2, - real_argb_color const *color0, - real_argb_color const *color1, - real_argb_color const *color2); -void rasterizer_debug_triangle( - real_point3d const *p0, - real_point3d const *p1, - real_point3d const *p2, - real_argb_color const *color); - -#endif // __RASTERIZER_DEBUG_H diff --git a/source/rasterizer/rasterizer_debug_options.h b/source/rasterizer/rasterizer_debug_options.h deleted file mode 100644 index b75dc754..00000000 --- a/source/rasterizer/rasterizer_debug_options.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -RASTERIZER_DEBUG_OPTIONS.H - -January rasterizer debug settings. Named members are corroborated by the -scripting globals and rasterizer use sites. Unknown bytes remain reserved; -later builds have a different tail and are not the layout authority. -*/ - -#ifndef __RASTERIZER_DEBUG_OPTIONS_H -#define __RASTERIZER_DEBUG_OPTIONS_H -#pragma once - -#include "cseries.h" - -struct rasterizer_debug_options_definition -{ - boolean fps_accumulation; /* 0x00 */ - byte pad01; /* 0x01 */ - short stats; /* 0x02 */ - short mode; /* 0x04 */ - boolean wireframe; /* 0x06 */ - boolean debug_model_vertices; /* 0x07 */ - short debug_model_lod; /* 0x08 */ - boolean debug_transparents; /* 0x0A */ - boolean debug_meter_shader; /* 0x0B */ - boolean models; /* 0x0C */ - boolean model_transparents; /* 0x0D */ - boolean draw_first_person_weapon_first; /* 0x0E */ - boolean stencil_mask; /* 0x0F */ - byte environment; /* 0x10 */ - boolean environment_lightmaps; /* 0x11 */ - boolean environment_shadows; /* 0x12 */ - boolean environment_diffuse_lights; /* 0x13 */ - boolean environment_diffuse_textures; /* 0x14 */ - boolean environment_decals; /* 0x15 */ - boolean environment_specular_lights; /* 0x16 */ - boolean environment_specular_lightmaps; /* 0x17 */ - boolean environment_reflection_lightmap_mask; /* 0x18 */ - boolean environment_reflection_mirrors; /* 0x19 */ - boolean environment_reflections; /* 0x1A */ - boolean environment_transparents; /* 0x1B */ - boolean environment_fog; /* 0x1C */ - boolean environment_fog_screen; /* 0x1D */ - boolean water; /* 0x1E */ - boolean lens_flares; /* 0x1F */ - boolean dynamic_unlit_geometry; /* 0x20 */ - boolean dynamic_lit_geometry; /* 0x21 */ - boolean dynamic_screen_geometry; /* 0x22 */ - boolean hud_motion_sensor; /* 0x23 */ - boolean detail_objects; /* 0x24 */ - boolean debug_geometry; /* 0x25 */ - boolean debug_geometry_multipass; /* 0x26 */ - boolean fog_atmosphere; /* 0x27 */ - boolean fog_plane; /* 0x28 */ - boolean bump_mapping; /* 0x29 */ - byte pad2A[2]; /* 0x2A */ - real lightmap_ambient; /* 0x2C */ - byte reserved30[2]; /* 0x30 */ - short pad3; /* 0x32 */ - boolean lightmaps_incident_radiosity; /* 0x34 */ - boolean lightmaps_filtering; /* 0x35 */ - byte pad36[2]; /* 0x36 */ - real model_lighting_ambient; /* 0x38 */ - boolean environment_alpha_testing; /* 0x3C */ - boolean environment_specular_mask; /* 0x3D */ - boolean shadows_convolution; /* 0x3E */ - boolean shadows_debug; /* 0x3F */ - boolean water_mipmapping; /* 0x40 */ - boolean active_camouflage; /* 0x41 */ - boolean active_camouflage_multipass; /* 0x42 */ - boolean plasma_energy; /* 0x43 */ - boolean lens_flares_occlusion; /* 0x44 */ - boolean lens_flares_occlusion_debug; /* 0x45 */ - boolean ray_of_buddha; /* 0x46 */ - boolean screen_flashes; /* 0x47 */ - boolean screen_effects; /* 0x48 */ - boolean DXTC_noise; /* 0x49 */ - boolean soft_filter; /* 0x4A */ - boolean secondary_render_target_debug; /* 0x4B */ - boolean profile_log; /* 0x4C */ - byte pad4D[3]; /* 0x4D */ - real detail_objects_offset_multiplier; /* 0x50 */ - long zbias; /* 0x54 */ - real zoffset; /* 0x58 */ - boolean force_all_player_views_to_default_player; /* 0x5C */ - boolean safe_frame_bounds; /* 0x5D */ - short freeze_flying_camera; /* 0x5E */ - boolean zsprites; /* 0x60 */ - boolean filthy_decal_fog_hack; /* 0x61 */ - boolean smart; /* 0x62 */ - boolean splitscreen_VB_optimization; /* 0x63 */ - boolean profile_print_locks; /* 0x64 */ - byte pad65[3]; /* 0x65 */ - real profile_objectlock_time; /* 0x68 */ - real pad3_scale; /* 0x6C */ - real f[6]; /* 0x70 */ - boolean transparent_pixel_counter_active; /* 0x88 */ - boolean transparent_pixel_counter; /* 0x89 */ - byte pad8A[2]; /* 0x8A */ -}; - -extern struct rasterizer_debug_options_definition rasterizer_debug_options; -extern boolean debug_render_freeze; - -#endif /* __RASTERIZER_DEBUG_OPTIONS_H */ diff --git a/source/rasterizer/rasterizer_frame_statistics.c b/source/rasterizer/rasterizer_frame_statistics.c index b21343ba..531aa45b 100644 --- a/source/rasterizer/rasterizer_frame_statistics.c +++ b/source/rasterizer/rasterizer_frame_statistics.c @@ -143,8 +143,7 @@ symbols in this file: #include "main/main.h" #include "math/integer_math.h" #include "rasterizer.h" -#include "rasterizer_debug_options.h" -#include "rasterizer_frame_statistics.h" +#include "rasterizer_console_vars.h" #include "rasterizer_geometry.h" #include "rasterizer/xbox/rasterizer_xbox.h" #include "text/draw_string.h" @@ -271,7 +270,7 @@ void rasterizer_frame_statistics_begin( void rasterizer_frame_statistics_get_fps( struct rasterizer_frame_statistics_globals *frame_statistics) { - if (rasterizer_debug_options.stats && frame_statistics) + if (rasterizer_debug_options.statistics_mode && frame_statistics) { unsigned long current_time = system_milliseconds(); short sample_count = fps_sample_count; @@ -459,7 +458,7 @@ long rasterizer_frame_statistics_count_dynamic_vertices( void rasterizer_frame_statistics_draw( void) { - if (rasterizer_debug_options.stats) + if (rasterizer_debug_options.statistics_mode) { char string[STATISTICS_TEXT_BUFFER_SIZE]; point2d cursor = { 0, 0 }; @@ -572,17 +571,17 @@ void rasterizer_frame_statistics_draw( rasterizer_draw_string(&bounds, NULL, &cursor, height_adjust, string); bounds.y0 = cursor.y + line_advance; - if (rasterizer_debug_options.stats == _rasterizer_statistics_mode_objects) + if (rasterizer_debug_options.statistics_mode == _rasterizer_statistics_mode_objects) { tab_stops[0] = left; draw_string_set_tab_stops(tab_stops, NUMBER_OF_STATISTICS_TAB_STOPS); draw_string_set_color(&data_color); sprintf(string, "|tfogged|t%d|n|tnormal|t%d|n|tfast|t%d|n|tscenery|t%d|n", - rasterizer_frame_statistics.fogged_object_count, - rasterizer_frame_statistics.normal_object_count, - rasterizer_frame_statistics.fast_object_count, - rasterizer_frame_statistics.scenery_object_count); + rasterizer_frame_statistics.vertices_by_permutation[0], + rasterizer_frame_statistics.vertices_by_permutation[1], + rasterizer_frame_statistics.vertices_by_permutation[2], + rasterizer_frame_statistics.vertices_by_permutation[3]); rasterizer_draw_string(&bounds, NULL, &cursor, height_adjust, string); bounds.y0 = cursor.y + line_advance; @@ -599,7 +598,7 @@ void rasterizer_frame_statistics_draw( rasterizer_draw_string(&bounds, NULL, &cursor, height_adjust, string); bounds.y0 = cursor.y + line_advance; } - else if (rasterizer_debug_options.stats == _rasterizer_statistics_mode_geometry) + else if (rasterizer_debug_options.statistics_mode == _rasterizer_statistics_mode_geometry) { sprintf(string, "|t|tvertices|ttriangles|tprimitives"); tab_stops[0] = left; @@ -725,7 +724,7 @@ void rasterizer_frame_statistics_draw( rasterizer_draw_string(&bounds, NULL, &cursor, height_adjust, string); bounds.y0 = cursor.y + line_advance; } - else if (rasterizer_debug_options.stats == _rasterizer_statistics_mode_profile) + else if (rasterizer_debug_options.statistics_mode == _rasterizer_statistics_mode_profile) { short profile; @@ -771,7 +770,7 @@ void rasterizer_frame_statistics_draw( rasterizer_draw_string(&bounds, NULL, &cursor, height_adjust, string); bounds.y0 = cursor.y + line_advance; } - else if (rasterizer_debug_options.stats == _rasterizer_statistics_mode_memory) + else if (rasterizer_debug_options.statistics_mode == _rasterizer_statistics_mode_memory) { long total_allocation = 0; long total_unique_allocation = 0; @@ -843,7 +842,7 @@ void rasterizer_frame_statistics_draw( draw_string_set_color(&default_color); } - if (rasterizer_debug_options.profile_log) + if (rasterizer_debug_options.profile_log_enabled) { if (!rasterizer_frame_statistics_private_globals.profile_log_file) { @@ -856,7 +855,7 @@ void rasterizer_frame_statistics_draw( _error_silent, "### ERROR failed to open rasterizer profile log (%s)", profile_log_path); - rasterizer_debug_options.profile_log = FALSE; + rasterizer_debug_options.profile_log_enabled = FALSE; } profile_accumulated_time = 0.0f; diff --git a/source/rasterizer/rasterizer_frame_statistics.h b/source/rasterizer/rasterizer_frame_statistics.h deleted file mode 100644 index 32263cd3..00000000 --- a/source/rasterizer/rasterizer_frame_statistics.h +++ /dev/null @@ -1,156 +0,0 @@ -/* -RASTERIZER_FRAME_STATISTICS.H - -Narrow cross-translation-unit interface owned by RASTERIZER_FRAME_STATISTICS.C. -*/ - -#ifndef __RASTERIZER_FRAME_STATISTICS_H -#define __RASTERIZER_FRAME_STATISTICS_H -#pragma once - -#include "cseries.h" -#include - -/* January's 0x170-byte linker-common record. Only counters already used by - * reconstructed writers are named here; unreviewed interiors stay reserved. */ -struct rasterizer_frame_statistics_globals -{ - real frames_per_second; - short fps_sample_count; - short pad006; - real average_frames_per_second; - real minimum_frames_per_second; - real maximum_frames_per_second; - long fogged_object_count; - long normal_object_count; - long fast_object_count; - long scenery_object_count; - unsigned long lightmap_dynamic_vertex_count; - unsigned long lightmap_dynamic_triangle_count; - unsigned long lightmap_dynamic_draw_count; - unsigned long shadow_count; - unsigned long shadow_vertex_count; - unsigned long shadow_triangle_count; - unsigned long shadow_draw_count; - unsigned long environment_dynamic_vertex_count; - unsigned long environment_dynamic_triangle_count; - unsigned long environment_dynamic_draw_count; - unsigned long decal_vertex_count; - unsigned long decal_triangle_count; - unsigned long decal_draw_count; - unsigned long decal_shader_change_count; - unsigned long decal_texture_change_count; - unsigned long diffuse_texture_dynamic_vertex_count; - unsigned long diffuse_texture_dynamic_triangle_count; - unsigned long diffuse_texture_dynamic_draw_count; - unsigned long specular_light_dynamic_vertex_count; - unsigned long specular_light_dynamic_triangle_count; - unsigned long specular_light_dynamic_draw_count; - unsigned long specular_lightmap_dynamic_vertex_count; - unsigned long specular_lightmap_dynamic_triangle_count; - unsigned long specular_lightmap_dynamic_draw_count; - unsigned long reflection_mask_dynamic_vertex_count; - unsigned long reflection_mask_dynamic_triangle_count; - unsigned long reflection_mask_dynamic_draw_count; - unsigned long reflection_dynamic_vertex_count; - unsigned long reflection_dynamic_triangle_count; - unsigned long reflection_dynamic_draw_count; - unsigned long transparent_geometry_dynamic_vertex_count; - unsigned long transparent_geometry_dynamic_triangle_count; - long transparent_geometry_largest_dynamic_triangle_count; - unsigned long transparent_geometry_dynamic_draw_count; - unsigned long environment_fog_dynamic_vertex_count; - unsigned long environment_fog_dynamic_triangle_count; - unsigned long environment_fog_dynamic_draw_count; - unsigned long environment_fog_screen_dynamic_vertex_count; - unsigned long environment_fog_screen_dynamic_triangle_count; - unsigned long environment_fog_screen_dynamic_draw_count; - unsigned long environment_fog_screen_model_count; - unsigned long environment_fog_screen_static_vertex_count; - unsigned long environment_fog_screen_static_triangle_count; - unsigned long environment_fog_screen_static_draw_count; - unsigned long model_count; - unsigned long model_vertex_count; - unsigned long model_triangle_count; - unsigned long model_draw_count; - long transparent_model_vertex_count; - long transparent_model_triangle_count; - long transparent_model_maximum_triangle_count; - long transparent_model_submit_count; - unsigned long model_shadow_count; - unsigned long model_shadow_vertex_count; - unsigned long model_shadow_triangle_count; - unsigned long model_shadow_draw_count; - unsigned long dynamic_unlit_draw_count; - unsigned long dynamic_unlit_triangle_count; - long largest_dynamic_unlit_triangle_count; - unsigned long dynamic_unlit_vertex_count; - byte reserved114[0x1C]; - long dynamic_vertex_count; - long dynamic_vertex_buffer_count; - long dynamic_triangle_count; - long dynamic_triangle_buffer_count; - long debug_primitive_count; - byte reserved144[4]; - long dynamic_light_count; - long lens_flare_count; - long vertex_shader_skinning_constant_bytes; - long vertex_shader_lighting_constant_bytes; - long vertex_shader_instruction_count; - long pixel_shader_pushbuffer_bytes; - unsigned long model_skinning_constant_bytes; - unsigned long model_lighting_constant_bytes; - unsigned long model_vertex_shader_work_accumulated; - byte reserved16C[4]; -}; - -typedef char rasterizer_frame_statistics_globals_size_assert[ - sizeof(struct rasterizer_frame_statistics_globals) == 0x170 ? 1 : -1]; -typedef char rasterizer_frame_statistics_environment_fog_screen_dynamic_vertex_count_offset_assert[ - offsetof( - struct rasterizer_frame_statistics_globals, - environment_fog_screen_dynamic_vertex_count) == 0xB8 ? 1 : -1]; -typedef char rasterizer_frame_statistics_environment_fog_screen_dynamic_triangle_count_offset_assert[ - offsetof( - struct rasterizer_frame_statistics_globals, - environment_fog_screen_dynamic_triangle_count) == 0xBC ? 1 : -1]; -typedef char rasterizer_frame_statistics_environment_fog_screen_dynamic_draw_count_offset_assert[ - offsetof( - struct rasterizer_frame_statistics_globals, - environment_fog_screen_dynamic_draw_count) == 0xC0 ? 1 : -1]; -typedef char rasterizer_frame_statistics_environment_fog_screen_model_count_offset_assert[ - offsetof( - struct rasterizer_frame_statistics_globals, - environment_fog_screen_model_count) == 0xC4 ? 1 : -1]; -typedef char rasterizer_frame_statistics_environment_fog_screen_static_vertex_count_offset_assert[ - offsetof( - struct rasterizer_frame_statistics_globals, - environment_fog_screen_static_vertex_count) == 0xC8 ? 1 : -1]; -typedef char rasterizer_frame_statistics_environment_fog_screen_static_triangle_count_offset_assert[ - offsetof( - struct rasterizer_frame_statistics_globals, - environment_fog_screen_static_triangle_count) == 0xCC ? 1 : -1]; -typedef char rasterizer_frame_statistics_environment_fog_screen_static_draw_count_offset_assert[ - offsetof( - struct rasterizer_frame_statistics_globals, - environment_fog_screen_static_draw_count) == 0xD0 ? 1 : -1]; - -extern struct rasterizer_frame_statistics_globals rasterizer_frame_statistics; - -struct triangle_buffer; -struct vertex_buffer; - -void rasterizer_frame_statistics_get_fps( - struct rasterizer_frame_statistics_globals *frame_statistics); -void rasterizer_frame_statistics_draw( - void); - -long rasterizer_frame_statistics_count_static_vertices( - struct triangle_buffer const *triangle_buffer, - struct vertex_buffer const *vertex_buffer); -long rasterizer_frame_statistics_count_dynamic_vertices( - long dynamic_triangle_buffer_index, - long first_triangle_index, - long triangle_count); - -#endif /* __RASTERIZER_FRAME_STATISTICS_H */ diff --git a/source/rasterizer/rasterizer_lights.c b/source/rasterizer/rasterizer_lights.c index dff9453d..0f881bbd 100644 --- a/source/rasterizer/rasterizer_lights.c +++ b/source/rasterizer/rasterizer_lights.c @@ -80,7 +80,6 @@ symbols in this file: /* ---------- headers */ -#include "rasterizer/rasterizer_frame_statistics.h" #include "cseries.h" #include "errors.h" #include "bitmaps/bitmaps.h" @@ -96,7 +95,7 @@ symbols in this file: #include "rasterizer_lights.h" #include "rasterizer_geometry.h" #include "rasterizer_geometry_compression.h" -#include "rasterizer_debug_options.h" +#include "rasterizer_console_vars.h" #include "objects/widgets/widget_types.h" #include "main/main.h" #include @@ -528,7 +527,7 @@ void rasterizer_lens_flare_submit( 268, (parameters->compressed_window_index&_lens_flare_window_index_mask)==global_window_parameters.window_index); - if (rasterizer_debug_options.lens_flares && !screenshot_in_progress() && + if (rasterizer_debug_options.draw_lens_flares && !screenshot_in_progress() && global_window_parameters.rasterizer_target==_rasterizer_target_render_primary) { if (local_lens_flare_countclusters, cluster_index, struct structure_cluster); @@ -774,7 +773,7 @@ void rasterizer_lens_flares_submit_occlusion_tests( { rasterizer_profile_begin(_rasterizer_profile_lens_flare_occlusion_submit); - if (rasterizer_debug_options.lens_flares && !screenshot_in_progress() && + if (rasterizer_debug_options.draw_lens_flares && !screenshot_in_progress() && global_window_parameters.rasterizer_target == _rasterizer_target_render_primary && local_lens_flare_count > 0) { @@ -846,7 +845,7 @@ void rasterizer_lens_flares_draw( { rasterizer_profile_begin(_rasterizer_profile_lens_flares); - if (rasterizer_debug_options.lens_flares && + if (rasterizer_debug_options.draw_lens_flares && global_window_parameters.rasterizer_target == _rasterizer_target_render_primary && local_lens_flare_count > 0) { @@ -1107,7 +1106,7 @@ void rasterizer_lens_flares_draw( rasterizer_set_stencil_mode(RASTERIZER_STENCIL_MODE_NONE); rasterizer_widget_end(); - if (rasterizer_debug_options.ray_of_buddha) + if (rasterizer_debug_options.lens_flare_sun_glow_enabled) { for (lens_flare_index = 0; lens_flare_index < local_lens_flare_count; lens_flare_index++) { diff --git a/source/rasterizer/rasterizer_memory_pool.h b/source/rasterizer/rasterizer_memory_pool.h index fe2b537b..29ec4acf 100644 --- a/source/rasterizer/rasterizer_memory_pool.h +++ b/source/rasterizer/rasterizer_memory_pool.h @@ -8,8 +8,4 @@ Narrow cross-translation-unit interface owned by RASTERIZER_MEMORY_POOL.C. #define __RASTERIZER_MEMORY_POOL_H #pragma once -const void *rasterizer_memory_alloc_const( - const void *source, - unsigned long size); - #endif /* __RASTERIZER_MEMORY_POOL_H */ diff --git a/source/rasterizer/rasterizer_models.h b/source/rasterizer/rasterizer_models.h index 1dec9e34..a1d2cc73 100644 --- a/source/rasterizer/rasterizer_models.h +++ b/source/rasterizer/rasterizer_models.h @@ -28,10 +28,6 @@ void rasterizer_model_begin( boolean is_dynamic); void rasterizer_model_end( void); -void rasterizer_environment_shadow_model_begin( - struct rasterizer_model_begin_parameters const *parameters); -void rasterizer_environment_shadow_model_end( - void); void rasterizer_model_draw( struct shader *shader, short shader_permutation_index, @@ -50,11 +46,6 @@ void rasterizer_model_transparent_geometry_submit( long dynamic_vertex_buffer_index, union real_point3d const *centroid, struct render_sort_filth *sort_filth); -void rasterizer_environment_shadow_model_draw( - struct shader const *shader, - short shader_permutation_index, - struct triangle_buffer const *triangle_buffer, - struct vertex_buffer const *vertex_buffer); void rasterizer_debug_model_vertices( long object_index, struct render_skinning const *skinning, diff --git a/source/rasterizer/rasterizer_swizzle.c b/source/rasterizer/rasterizer_swizzle.c index ad6e2b66..2e04157b 100644 --- a/source/rasterizer/rasterizer_swizzle.c +++ b/source/rasterizer/rasterizer_swizzle.c @@ -10,7 +10,6 @@ RASTERIZER_SWIZZLE.C #include "math/integer_math.h" #include "bitmaps/bitmaps.h" #include "bitmaps/bitmap_group.h" -#include "bitmaps/bitmaps_mipmap.h" #include "rasterizer/rasterizer_swizzle.h" /* ---------- constants */ diff --git a/source/rasterizer/rasterizer_text.c b/source/rasterizer/rasterizer_text.c index 1d031e92..22d9b98b 100644 --- a/source/rasterizer/rasterizer_text.c +++ b/source/rasterizer/rasterizer_text.c @@ -66,13 +66,14 @@ symbols in this file: #include "cseries/cseries.h" #include "cseries/errors.h" #include "bitmaps/bitmap_group.h" -#include "bitmaps/bitmaps_internal.h" +#include "bitmaps/bitmaps.h" #include "math/integer_math.h" #include "rasterizer/rasterizer.h" -#include "rasterizer/rasterizer_debug_options.h" +#include "rasterizer/rasterizer_console_vars.h" #include "rasterizer/rasterizer_text.h" #include "rasterizer/xbox/rasterizer_xbox_hardware_bitmaps.h" #include "render/render.h" +#include "text/draw_string.h" #include "text/font_group.h" #include "text/unicode.h" @@ -151,20 +152,6 @@ struct hardware_character_cache static struct bitmap_data *hardware_character_cache_get_bitmap( void); -void draw_string( - draw_character_proc draw_character, - rectangle2d const *bounds, - point2d *cursor_reference, - rectangle2d const *clip, - short height_adjust, - char const *string); -void draw_unicode_string( - draw_character_proc draw_character, - rectangle2d const *bounds, - point2d *cursor_reference, - rectangle2d const *clip, - short height_adjust, - wchar_t const *string); static void hardware_character_cache_get_origin( short hardware_character_index, short *x0, @@ -174,7 +161,7 @@ static void flush_hardware_character( static void cache_hardware_format_character( struct font_header *font, struct font_character *font_character); -void rasterizer_draw_character( +static void rasterizer_draw_character( struct parse_string_state *state, struct font_header *font, struct font_character *font_character, @@ -304,7 +291,7 @@ rasterizer_text_cache_dispose( return; } -void +static void rasterizer_draw_character( struct parse_string_state *state, struct font_header *font, @@ -355,7 +342,9 @@ rasterizer_draw_string( short height_adjust, char const *string) { - if (rasterizer_debug_options.dynamic_screen_geometry + boolean drop_shadow = TRUE; + + if (rasterizer_debug_options.draw_dynamic_screen_geometry && global_window_parameters.rasterizer_target == _rasterizer_target_render_primary) { struct bitmap_data *bitmap; @@ -371,9 +360,20 @@ rasterizer_draw_string( if (bitmap && string[0]) { - /* January calls strlen() here and discards the result; the call is - part of the object and is reproduced. */ - strlen(string); + long length = strlen(string); + long vertex_count; + draw_character_proc draw_character; + + if (drop_shadow) + { + vertex_count = length * NUMBER_OF_VERTICES_PER_QUADRILATERAL * 2; + draw_character = rasterizer_draw_character_with_dropshadow; + } + else + { + vertex_count = length * NUMBER_OF_VERTICES_PER_QUADRILATERAL; + draw_character = rasterizer_draw_character; + } if (!bounds) { @@ -417,7 +417,7 @@ rasterizer_draw_string( rasterizer_text_begin(¶meters); draw_string( - rasterizer_draw_character_with_dropshadow, + draw_character, &window_bounds, cursor_reference, &viewport_bounds, @@ -438,7 +438,9 @@ rasterizer_draw_unicode_string( short height_adjust, wchar_t const *string) { - if (rasterizer_debug_options.dynamic_screen_geometry + boolean drop_shadow = TRUE; + + if (rasterizer_debug_options.draw_dynamic_screen_geometry && global_window_parameters.rasterizer_target == _rasterizer_target_render_primary) { struct bitmap_data *bitmap; @@ -454,9 +456,20 @@ rasterizer_draw_unicode_string( if (bitmap && string[0]) { - /* January calls ustrlen() here and discards the result; the call is - part of the object and is reproduced. */ - ustrlen(string); + long length = ustrlen(string); + long vertex_count; + draw_character_proc draw_character; + + if (drop_shadow) + { + vertex_count = length * NUMBER_OF_VERTICES_PER_QUADRILATERAL * 2; + draw_character = rasterizer_draw_character_with_dropshadow; + } + else + { + vertex_count = length * NUMBER_OF_VERTICES_PER_QUADRILATERAL; + draw_character = rasterizer_draw_character; + } if (!bounds) { @@ -500,7 +513,7 @@ rasterizer_draw_unicode_string( rasterizer_text_begin(¶meters); draw_unicode_string( - rasterizer_draw_character_with_dropshadow, + draw_character, &window_bounds, cursor_reference, &viewport_bounds, diff --git a/source/rasterizer/rasterizer_text.h b/source/rasterizer/rasterizer_text.h index 9b8c9a90..cc73be82 100644 --- a/source/rasterizer/rasterizer_text.h +++ b/source/rasterizer/rasterizer_text.h @@ -29,17 +29,6 @@ boolean rasterizer_text_cache_initialize( void); void rasterizer_text_draw_character( struct dynamic_screen_vertex const *vertices); -void rasterizer_draw_character( - struct parse_string_state *state, - struct font_header *font, - struct font_character *font_character, - unsigned long color, - short x0, - short y0, - short x, - short y, - short dx, - short dy); void rasterizer_text_begin( struct rasterizer_dynamic_screen_geometry_parameters const *parameters); void rasterizer_text_end( diff --git a/source/rasterizer/rasterizer_transparent_geometry.c b/source/rasterizer/rasterizer_transparent_geometry.c index ff4e12bd..b1b251ee 100644 --- a/source/rasterizer/rasterizer_transparent_geometry.c +++ b/source/rasterizer/rasterizer_transparent_geometry.c @@ -85,7 +85,7 @@ symbols in this file: #include "cseries.h" #include "cseries/errors.h" #include "rasterizer.h" -#include "rasterizer_debug_options.h" +#include "rasterizer_console_vars.h" #include "rasterizer_geometry.h" #include "rasterizer_transparent_geometry.h" #include "rasterizer/xbox/rasterizer_xbox_internal.h" @@ -148,6 +148,8 @@ typedef char transparent_geometry_group_cortana_hack_offset_assert[ offsetof(struct transparent_geometry_group, cortana_hack) == 0x9D ? 1 : -1]; /* ---------- prototypes */ +static void rasterizer_sort_external( + void); /* ---------- globals */ @@ -499,7 +501,7 @@ static int __cdecl group_sorted_indices_cmpfn( return comparison; } -void rasterizer_sort_external( +static void rasterizer_sort_external( void) { short group_index; diff --git a/source/rasterizer/rasterizer_transparent_geometry.h b/source/rasterizer/rasterizer_transparent_geometry.h index 440ffe61..ae18bf31 100644 --- a/source/rasterizer/rasterizer_transparent_geometry.h +++ b/source/rasterizer/rasterizer_transparent_geometry.h @@ -12,40 +12,13 @@ Narrow cross-translation-unit interface owned by RASTERIZER_TRANSPARENT_GEOMETRY struct transparent_geometry_group; -boolean rasterizer_transparent_geometry_initialize_aux_buffer( - void); -void rasterizer_transparent_geometry_dispose_aux_buffer( - void); -void rasterizer_transparent_geometry_dispose( - void); void rasterizer_transparent_geometry_groups_begin( void); void rasterizer_transparent_geometry_groups_end( void); -void rasterizer_sort_external( - void); -struct transparent_geometry_group *rasterizer_transparent_geometry_new_group( - void); -struct transparent_geometry_group *rasterizer_transparent_geometry_new_group2( - void); -short rasterizer_transparent_geometry_get_group_presorted_index( - struct transparent_geometry_group const *group); void rasterizer_transparent_geometry_group_draw( struct transparent_geometry_group *group, boolean dirty); -void rasterizer_transparent_geometry_set_group_pending_status( - struct transparent_geometry_group const *group, - boolean pending); -boolean rasterizer_transparent_geometry_get_group_pending_status( - struct transparent_geometry_group const *group); -void *rasterizer_transparent_geometry_get_group_from_presorted_index( - short presorted_index); -struct transparent_geometry_group *rasterizer_transparent_geometry_next_group( - struct transparent_geometry_group const *group); -void *rasterizer_transparent_geometry_get_groups2( - short *group_count); -short rasterizer_transparent_geometry_get_primary_vertex_type( - struct transparent_geometry_group const *group); void rasterizer_transparent_geometry_group_draw__internal( struct transparent_geometry_group const *group, boolean has_lightmap); diff --git a/source/rasterizer/xbox/rasterizer_xbox.c b/source/rasterizer/xbox/rasterizer_xbox.c index 12e25d09..fe839f10 100644 --- a/source/rasterizer/xbox/rasterizer_xbox.c +++ b/source/rasterizer/xbox/rasterizer_xbox.c @@ -389,7 +389,6 @@ symbols in this file: #include "bitmaps/bitmap_group.h" #include "bitmaps/bitmap_group_internal.h" #include "bitmaps/bitmaps.h" -#include "bitmaps/bitmap_strings_internal.h" #include "cache/texture_cache.h" #include "cseries/profile.h" #include "effects/decals.h" @@ -401,12 +400,9 @@ symbols in this file: #include "cseries/errors.h" #include "rasterizer/rasterizer.h" #include "rasterizer/rasterizer_cinematics.h" -#include "rasterizer/rasterizer_debug.h" -#include "rasterizer/rasterizer_debug_options.h" -#include "rasterizer/rasterizer_frame_statistics.h" +#include "rasterizer/rasterizer_console_vars.h" #include "rasterizer/rasterizer_lights.h" #include "rasterizer/rasterizer_text.h" -#include "rasterizer/rasterizer_transparent_geometry.h" #include "rasterizer/xbox/rasterizer_xbox_draw_primitives.h" #include "render/render.h" #include "render/render_cameras.h" @@ -638,27 +634,8 @@ enum DEFAULT_BITMAP_PIXEL1 = 0xf0f0 }; -enum -{ - NUMBER_OF_ENTRIES_IN_PALETTE = 256 -}; - /* ---------- macros */ -#define rasterizer_push_buffer_size \ - (((struct rasterizer_xbox_rasterizer_globals *)&rasterizer_globals)->push_buffer_size) -#define rasterizer_kick_off_size \ - (((struct rasterizer_xbox_rasterizer_globals *)&rasterizer_globals)->kick_off_size) -#define rasterizer_floating_point_z_buffer \ - (((struct rasterizer_xbox_rasterizer_globals *)&rasterizer_globals)->floating_point_z_buffer) -#define rasterizer_refresh_rate \ - (((struct rasterizer_xbox_rasterizer_globals *)&rasterizer_globals)->refresh_rate) -#define rasterizer_default_2d_hardware_format \ - (((struct rasterizer_xbox_rasterizer_globals *)&rasterizer_globals)->default_2d_hardware_format) -#define rasterizer_default_3d_hardware_format \ - (((struct rasterizer_xbox_rasterizer_globals *)&rasterizer_globals)->default_3d_hardware_format) -#define rasterizer_default_cm_hardware_format \ - (((struct rasterizer_xbox_rasterizer_globals *)&rasterizer_globals)->default_cm_hardware_format) /* ---------- structures */ @@ -836,9 +813,6 @@ static struct rasterizer_hardware_state_cache rasterizer_state_cache = extern struct window_data window_globals; -/* owned by source/bitmaps/bitmaps.c */ -extern pixel32 global_vector_palette[NUMBER_OF_ENTRIES_IN_PALETTE]; - /* the shadow tables of the SetRenderStateSmart family; that object owns them, * this one only primes them from the XDK's own shadows at initialization. */ extern unsigned long renderstate_table[D3DRS_MAX]; @@ -914,7 +888,7 @@ void _rasterizer_window_set_fog( if (global_window_parameters.fog.atmospheric_maximum_density <= 0.0f) global_window_parameters.fog.atmospheric_maximum_density = 1.0f; if (global_window_parameters.fog.atmospheric_maximum_distance == 0.0f || - !rasterizer_debug_options.fog_atmosphere) + !rasterizer_debug_options.fog_atmospheric_enabled) { global_window_parameters.fog.atmospheric_maximum_density = 0.0f; global_window_parameters.fog.atmospheric_minimum_distance = @@ -926,7 +900,7 @@ void _rasterizer_window_set_fog( global_window_parameters.fog.planar_maximum_density = 1.0f; if (global_window_parameters.fog.planar_mode && !TEST_FLAG(fog->fog_definition_flags, _fog_definition_screen_effect_only_bit) && - rasterizer_debug_options.fog_plane) + rasterizer_debug_options.fog_planar_enabled) { if (global_window_parameters.fog.planar_mode == _render_planar_fog_mode_fully_fogged) @@ -1098,7 +1072,7 @@ void rasterizer_set_pixel_shader( D3DRS_PSCONSTANT1_0 + combiner_index, pixel_shader->constant_1[combiner_index]); } - if (rasterizer_debug_options.stats == 2) + if (rasterizer_debug_options.statistics_mode == 2) rasterizer_frame_statistics.pixel_shader_pushbuffer_bytes += (4 + unique_constant_0 + unique_constant_1) * combiner_count * sizeof(unsigned long) + 32; @@ -1108,7 +1082,7 @@ void rasterizer_set_pixel_shader( IDirect3DDevice8_SetPixelShaderProgram( global_d3d_device, (D3DPIXELSHADERDEF *)pixel_shader); - if (rasterizer_debug_options.stats == 2) + if (rasterizer_debug_options.statistics_mode == 2) rasterizer_frame_statistics.pixel_shader_pushbuffer_bytes += 228; } return; @@ -1247,7 +1221,7 @@ void rasterizer_set_model_lighting( -79, &lighting_constants, NUMBER_OF_MODEL_LIGHTING_CONSTANTS); - if (rasterizer_debug_options.stats) + if (rasterizer_debug_options.statistics_mode) rasterizer_frame_statistics.vertex_shader_lighting_constant_bytes += sizeof(lighting_constants); return; @@ -1293,7 +1267,7 @@ void rasterizer_set_model_skinning( -36, vsh_constants__nodematrices, skinning->node_matrix_count * 3); - if (rasterizer_debug_options.stats) + if (rasterizer_debug_options.statistics_mode) rasterizer_frame_statistics.vertex_shader_skinning_constant_bytes += skinning->node_matrix_count * sizeof(vsh_constants__nodematrices[0]); return; @@ -1320,7 +1294,7 @@ boolean rasterizer_set_texture_non_blocking( "c:\\halo\\SOURCE\\rasterizer\\xbox\\rasterizer_xbox.c", 2144, usage>=0 && usagefog); - if (rasterizer_debug_options.mode == _rasterizer_mode_clear_to_black) + if (rasterizer_debug_options.drawing_mode == _rasterizer_mode_clear_to_black) clear_color = 0; else clear_color = real_rgb_color_to_pixel32( @@ -1760,7 +1734,7 @@ void _rasterizer_window_begin( rasterizer_set_frustum_z(-1.0f, -1.0f); D3DDevice_SetRenderState( D3DRS_FILLMODE, - rasterizer_debug_options.wireframe ? D3DFILL_WIREFRAME : D3DFILL_SOLID); + rasterizer_debug_options.wireframe_enabled ? D3DFILL_WIREFRAME : D3DFILL_SOLID); return; } @@ -2044,7 +2018,7 @@ union point2d *rasterizer_set_texture( "c:\\halo\\SOURCE\\rasterizer\\xbox\\rasterizer_xbox.c", 2060, usage>=0 && usagetype) { case _bitmap_type_2d: - hardware_format = rasterizer_default_2d_hardware_format; + hardware_format = rasterizer_globals.default_2d_hardware_format; break; case _bitmap_type_3d: - hardware_format = rasterizer_default_2d_hardware_format; + hardware_format = rasterizer_globals.default_2d_hardware_format; break; case _bitmap_type_cube_map: - hardware_format = rasterizer_default_cm_hardware_format; + hardware_format = rasterizer_globals.default_cm_hardware_format; break; /* hardware_format is left unassigned only by this default arm. Not reached unassigned: the @@ -3683,8 +3636,8 @@ static void rasterizer_filthy_bitmap_defaults_initialize( 311, success, "### ERROR rasterizer_filthy_bitmap_default_initialize failed"); - rasterizer_default_2d_hardware_format = default_2d_hardware_format; - rasterizer_default_3d_hardware_format = default_3d_hardware_format; - rasterizer_default_cm_hardware_format = default_cm_hardware_format; + rasterizer_globals.default_2d_hardware_format = default_2d_hardware_format; + rasterizer_globals.default_3d_hardware_format = default_3d_hardware_format; + rasterizer_globals.default_cm_hardware_format = default_cm_hardware_format; return; } diff --git a/source/rasterizer/xbox/rasterizer_xbox_active_camouflage.c b/source/rasterizer/xbox/rasterizer_xbox_active_camouflage.c index 93010b31..32632436 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_active_camouflage.c +++ b/source/rasterizer/xbox/rasterizer_xbox_active_camouflage.c @@ -67,7 +67,7 @@ symbols in this file: #include "rasterizer/xbox/rasterizer_xbox.h" #include "rasterizer/xbox/rasterizer_xbox_internal.h" -#include "rasterizer/rasterizer_debug_options.h" +#include "rasterizer/rasterizer_console_vars.h" #include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" /* ---------- constants */ @@ -281,7 +281,7 @@ void rasterizer_active_camouflage_cache_primary_render_target( 41, global_d3d_device); - if (rasterizer_debug_options.active_camouflage && + if (rasterizer_debug_options.active_camouflage_enabled && local_active_camouflage_visibility_flag) { real screen_projection[5][4]; @@ -464,7 +464,7 @@ void rasterizer_active_camouflage_cache_primary_render_target( rasterizer_secondary_render_target_debug(&bounds); local_active_camouflage_debug_cache_count++; - if (!rasterizer_debug_options.active_camouflage_multipass) + if (!rasterizer_debug_options.active_camouflage_multipass_enabled) { local_active_camouflage_visibility_flag = FALSE; } @@ -502,7 +502,7 @@ void rasterizer_active_camouflage_draw( 157, global_d3d_device); - if (rasterizer_debug_options.active_camouflage && + if (rasterizer_debug_options.active_camouflage_enabled && global_window_parameters.rasterizer_target==_rasterizer_target_render_primary) { struct shader_model_definition *model; diff --git a/source/rasterizer/xbox/rasterizer_xbox_debug.c b/source/rasterizer/xbox/rasterizer_xbox_debug.c index 6d0396ac..cf90d66a 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_debug.c +++ b/source/rasterizer/xbox/rasterizer_xbox_debug.c @@ -20,9 +20,11 @@ RASTERIZER_XBOX_DEBUG.C * IDirect3DDevice8 render-state, vertex-data, begin, and end wrappers. */ #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" #include #include "rasterizer/xbox/rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" /* ---------- constants */ @@ -30,42 +32,10 @@ RASTERIZER_XBOX_DEBUG.C /* ---------- structures */ -struct rasterizer_xbox_debug_options_prefix -{ - byte reserved00[0x25]; - boolean debug_geometry; - byte reserved26[0x2E]; - long zbias; -}; - -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - /* ---------- prototypes */ /* ---------- globals */ -extern struct rasterizer_xbox_debug_options_prefix rasterizer_debug_options; - /* ---------- public code */ void rasterizer_debug_drawing_begin( @@ -76,7 +46,7 @@ void rasterizer_debug_drawing_begin( 19, global_d3d_device); - if (rasterizer_debug_options.debug_geometry) + if (rasterizer_debug_options.draw_debug_geometry) { rasterizer_set_vertex_shader_permutation(0, 9, 0); IDirect3DDevice8_SetRenderState( diff --git a/source/rasterizer/xbox/rasterizer_xbox_decals.c b/source/rasterizer/xbox/rasterizer_xbox_decals.c index d50d8206..de201e0a 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_decals.c +++ b/source/rasterizer/xbox/rasterizer_xbox_decals.c @@ -122,7 +122,6 @@ symbols in this file: /* ---------- headers */ -#include "rasterizer/rasterizer_frame_statistics.h" #include "cseries/cseries.h" #include "cseries/errors.h" #include "effects/decal_definitions.h" @@ -131,12 +130,14 @@ symbols in this file: #include "memory/data.h" #include "memory/lruv_cache.h" #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" /* The XDK's stock D3DINLINE (static __forceinline) definitions supply both the * inline expansions used below and the out-of-line wrapper bodies January * retains in this object. Do not redefine D3DINLINE, take a wrapper's address * or hand-write a wrapper body: any of those changes the emitted ABI. */ #include #include "rasterizer/xbox/rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" #include "saved games/game_state.h" /* ---------- constants */ @@ -209,41 +210,6 @@ enum /* ---------- structures */ -struct rasterizer_decals_debug_options -{ - byte reserved0000[2]; - short statistics_mode; - short drawing_mode; - byte reserved0006[0xf]; - boolean draw_environment_decals; - byte reserved0016[0x3e]; - long decal_zbias; - byte reserved0058[9]; - boolean filthy_decal_fog_hack_enabled; -}; - -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - struct decal_vertex { real_point3d position; @@ -321,7 +287,6 @@ static struct lruv_cache *local_vertex_cache = NULL; static boolean locked_decal_reported = FALSE; static boolean permanent_decal_reported = FALSE; static boolean local_filthy_decal_fog_hack_enabled = FALSE; -extern struct rasterizer_decals_debug_options rasterizer_debug_options; extern struct pixel_shader_definition pixel_shader; static long last_decal_index_queried_by_lruv_cache = NONE; @@ -602,7 +567,7 @@ void _rasterizer_decals_begin( IDirect3DDevice8_SetRenderState( global_d3d_device, D3DRS_ZBIAS, - rasterizer_debug_options.decal_zbias); + rasterizer_debug_options.zbias); if (layer == _decal_layer_alpha_tested) { IDirect3DDevice8_SetRenderState( diff --git a/source/rasterizer/xbox/rasterizer_xbox_detail_objects.c b/source/rasterizer/xbox/rasterizer_xbox_detail_objects.c index 7aaae574..aac1572f 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_detail_objects.c +++ b/source/rasterizer/xbox/rasterizer_xbox_detail_objects.c @@ -77,6 +77,7 @@ symbols in this file: #include "cseries/errors.h" #include "main/main.h" #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" #include "scenario/scenario.h" #include "scenario/scenario_definitions.h" #include "structures/structure_bsp_definitions.h" @@ -84,6 +85,7 @@ symbols in this file: #include #include "rasterizer/xbox/rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" /* ---------- constants */ @@ -103,14 +105,6 @@ enum /* ---------- structures */ -struct detail_objects_debug_options -{ - byte reserved00[0x24]; - boolean detail_objects; - byte reserved25[0x2B]; - float detail_objects_offset_multiplier; -}; - struct detail_object { byte position[3]; @@ -208,32 +202,6 @@ struct detail_object_view_data word pad; }; -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - -typedef char detail_objects_enabled_offset_assert[ - offsetof(struct detail_objects_debug_options, detail_objects) == 0x24 ? 1 : -1]; -typedef char detail_objects_multiplier_offset_assert[ - offsetof(struct detail_objects_debug_options, detail_objects_offset_multiplier) == 0x50 ? 1 : -1]; typedef char detail_objects_pixel_shader_size_assert[ sizeof(struct pixel_shader_definition) == 0xF0 ? 1 : -1]; typedef char detail_object_size_assert[ @@ -263,7 +231,6 @@ typedef char detail_object_view_data_size_assert[ /* ---------- globals */ -extern struct detail_objects_debug_options rasterizer_debug_options; static D3DVertexBuffer *bss_0045e904 = NULL; #define local_d3d_vertex_buffer bss_0045e904 @@ -370,7 +337,7 @@ void _rasterizer_detail_objects_begin( void) { rasterizer_profile_begin(_rasterizer_profile_detail_objects); - if (!rasterizer_debug_options.detail_objects) + if (!rasterizer_debug_options.draw_detail_objects) { return; } @@ -413,7 +380,7 @@ void _rasterizer_detail_objects_begin( 8.0f, 8.0f, 8.0f, - rasterizer_debug_options.detail_objects_offset_multiplier, + rasterizer_debug_options.detail_object_screen_facing_offset_multiplier, 1.0f, 1.0f, 0.5f, @@ -476,7 +443,7 @@ void _rasterizer_detail_objects_rebuild_vertices( long cell_index; boolean warned; - if (!rasterizer_debug_options.detail_objects) + if (!rasterizer_debug_options.draw_detail_objects) { return; } @@ -617,7 +584,7 @@ void _rasterizer_detail_objects_draw( boolean success; success = TRUE; - if (!rasterizer_debug_options.detail_objects) + if (!rasterizer_debug_options.draw_detail_objects) { return; } diff --git a/source/rasterizer/xbox/rasterizer_xbox_draw_primitives.c b/source/rasterizer/xbox/rasterizer_xbox_draw_primitives.c index 1594be53..c5aa7a3a 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_draw_primitives.c +++ b/source/rasterizer/xbox/rasterizer_xbox_draw_primitives.c @@ -212,11 +212,11 @@ symbols in this file: /* ---------- headers */ -#include "rasterizer/rasterizer_frame_statistics.h" #include "cseries.h" #include "cseries/errors.h" #include "main/main.h" #include "rasterizer.h" +#include "rasterizer_console_vars.h" #include "rasterizer_geometry.h" #include "rasterizer_xbox_draw_primitives.h" /* The January object retains out-of-line copies of the D3D inline wrappers. @@ -317,14 +317,6 @@ struct dynamic_triangles_globals byte pad300d[3]; }; -struct rasterizer_draw_primitives_debug_options_prefix -{ - byte reserved00[2]; - short stats; - byte reserved04[0x5F]; - boolean split_dynamic_geometry_between_windows; -}; - typedef char dynamic_vertex_group_size_assert[ sizeof(struct dynamic_vertex_group) == 0x14 ? 1 : -1]; typedef char dynamic_vertex_buffer_size_assert[ @@ -341,8 +333,6 @@ static D3DVertexBuffer *dynamic_vertex_group_get_d3d_vertex_buffer( /* ---------- globals */ -extern struct rasterizer_draw_primitives_debug_options_prefix rasterizer_debug_options; - static D3DPRIMITIVETYPE const d3d_primitive_type_table[NUMBER_OF_TRIANGLE_BUFFER_TYPES] = { D3DPT_TRIANGLELIST, @@ -513,7 +503,7 @@ void rasterizer_dynamic_geometry_begin( { long vertex_type; - if (rasterizer_debug_options.split_dynamic_geometry_between_windows) + if (rasterizer_debug_options.splitscreen_VB_optimization_enabled) { match_assert( RASTERIZER_XBOX_DRAW_PRIMITIVES_FILE, @@ -641,7 +631,7 @@ long _rasterizer_dynamic_triangles_new( dynamic_triangles.triangle_count += count; dynamic_triangles.buffer_count++; - if (rasterizer_debug_options.stats==_rasterizer_stats_geometry) + if (rasterizer_debug_options.statistics_mode==_rasterizer_stats_geometry) { rasterizer_frame_statistics.dynamic_triangle_count += count; rasterizer_frame_statistics.dynamic_triangle_buffer_count++; @@ -791,7 +781,7 @@ long _rasterizer_dynamic_vertices_new( group->vertex_count += count; dynamic_vertices.buffer_count++; - if (rasterizer_debug_options.stats==_rasterizer_stats_geometry) + if (rasterizer_debug_options.statistics_mode==_rasterizer_stats_geometry) { rasterizer_frame_statistics.dynamic_vertex_count += count; rasterizer_frame_statistics.dynamic_vertex_buffer_count++; diff --git a/source/rasterizer/xbox/rasterizer_xbox_dynavobgeom.c b/source/rasterizer/xbox/rasterizer_xbox_dynavobgeom.c index 6e860e9c..6bebb418 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_dynavobgeom.c +++ b/source/rasterizer/xbox/rasterizer_xbox_dynavobgeom.c @@ -74,10 +74,8 @@ symbols in this file: #include "interface/hud_draw.h" #include "bitmaps/bitmaps_inlines.h" #include "rasterizer.h" -#include "rasterizer/rasterizer_debug_options.h" -#include "rasterizer/rasterizer_frame_statistics.h" +#include "rasterizer/rasterizer_console_vars.h" #include "rasterizer/rasterizer_model_types.h" -#include "rasterizer/rasterizer_transparent_geometry.h" #include "render/render_cameras.h" #include "shaders/shader_definitions.h" #include "rasterizer_xbox_pixel_shader.h" @@ -268,7 +266,7 @@ void _rasterizer_psuedo_dynamic_screen_quad_draw( 756, global_d3d_device); - if (!rasterizer_debug_options.dynamic_screen_geometry) + if (!rasterizer_debug_options.draw_dynamic_screen_geometry) { return; } @@ -683,7 +681,7 @@ void _rasterizer_dynamic_unlit_geometry_draw( 38, global_d3d_device); - if (!rasterizer_debug_options.dynamic_unlit_geometry) + if (!rasterizer_debug_options.draw_dynamic_unlit_geometry) { return; } @@ -746,7 +744,7 @@ void _rasterizer_dynamic_unlit_geometry_draw( group->lighting = NULL; group->animation = NULL; - if (rasterizer_debug_options.stats == _rasterizer_statistics_mode_geometry) + if (rasterizer_debug_options.statistics_mode == _rasterizer_statistics_mode_geometry) { rasterizer_frame_statistics.dynamic_unlit_draw_count++; rasterizer_frame_statistics.dynamic_unlit_triangle_count += triangle_count; diff --git a/source/rasterizer/xbox/rasterizer_xbox_environment.c b/source/rasterizer/xbox/rasterizer_xbox_environment.c index 7e3cd22b..6b8961cf 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_environment.c +++ b/source/rasterizer/xbox/rasterizer_xbox_environment.c @@ -152,9 +152,9 @@ symbols in this file: #undef REAL_MATH_EXTERNAL_POINT_FROM_LINE3D #undef REAL_MATH_EXTERNAL_SCALE_VECTOR3D #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" #include "rasterizer/rasterizer_environment.h" #include "rasterizer/common/rasterizer_common.h" -#include "rasterizer/rasterizer_frame_statistics.h" #include "rasterizer/rasterizer_geometry.h" #include "rasterizer/rasterizer_lights.h" #include "rasterizer/rasterizer_memory_pool.h" @@ -166,6 +166,7 @@ symbols in this file: #include "interface/progress_bar_internal.h" #include "rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" #include "rasterizer_xbox_draw_primitives.h" #include "rasterizer_xbox_internal.h" @@ -292,36 +293,6 @@ enum struct bitmap_data; -struct rasterizer_environment_debug_options -{ - byte reserved0[0x2]; - short statistics_mode; - short drawing_mode; - byte reserved06[0xB]; - boolean draw_environment_lightmaps; - boolean draw_environment_shadows; - boolean draw_environment_diffuse_lights; - boolean draw_environment_textures; - boolean draw_environment_decals; - boolean draw_environment_specular_lights; - boolean draw_environment_specular_lightmaps; - boolean draw_environment_reflection_lightmap_masks; - boolean draw_environment_reflection_mirrors; - boolean draw_environment_reflections; - boolean draw_environment_transparent_geometry; - byte reserved1C[0x10]; - real lightmap_ambient; - byte reserved30[0x2]; - short vector_drawing_mode; - boolean lightmap_bump_enabled; - boolean lightmap_filtering; - byte reserved36[0x6]; - boolean alpha_testing_enabled; - boolean environment_specular_mask_enabled; - byte reserved3E[0x2E]; - real vector_scale; -}; - struct transparent_geometry_group { unsigned long geometry_flags; @@ -366,28 +337,6 @@ struct rasterizer_environment_globals real specular_light_brightness; }; -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - struct point_light_geometry_parameters { real radius; @@ -553,7 +502,6 @@ static void rasterizer_environment_specular_spot_light_begin( /* ---------- globals */ -extern struct rasterizer_environment_debug_options rasterizer_debug_options; static struct rasterizer_environment_globals rasterizer_environment_globals; static boolean warned = FALSE; extern struct pixel_shader_definition pixel_shader; @@ -637,8 +585,8 @@ void _rasterizer_environment_lightmap_draw( short vector_bitmap_index; boolean vector_test_pattern; - vector_index = (short)(rasterizer_debug_options.vector_drawing_mode % 1000); - vector_bitmap_index = (short)(rasterizer_debug_options.vector_drawing_mode / 1000); + vector_index = (short)(rasterizer_debug_options.pad3 % 1000); + vector_bitmap_index = (short)(rasterizer_debug_options.pad3 / 1000); if (vector_index >= 0 && vector_index < NUMBER_OF_RASTERIZER_ENVIRONMENT_VECTOR_MODES && vector_modes[vector_index].vertex_shader_permutation_index != NONE) @@ -722,7 +670,7 @@ void _rasterizer_environment_lightmap_draw( pixel_shader.texture_modes = 0x00018C60 | (vector_test_pattern ? 1 : 3); if (vector_test_pattern) { - texture_transform_constants[0].i = rasterizer_debug_options.vector_scale; + texture_transform_constants[0].i = rasterizer_debug_options.pad3_scale; texture_transform_constants[0].j = 1.0f; texture_transform_constants[0].k = 1.0f; texture_transform_constants[0].l = 1.0f; @@ -806,7 +754,7 @@ void _rasterizer_environment_lightmap_draw( TEST_FLAG( shader_environment->environment.flags, _shader_environment_alpha_tested_bit) && - rasterizer_debug_options.alpha_testing_enabled); + rasterizer_debug_options.environment_alpha_testing_enabled); rasterizer_set_texture( 0, 0, @@ -877,7 +825,7 @@ void _rasterizer_environment_lightmap_draw( ? 0x00018001 : 0x00018401; pixel_shader.rgb_inputs[0] = - rasterizer_debug_options.lightmap_bump_enabled + rasterizer_debug_options.lightmap_incident_radiosity_enabled ? 0x484B0A01 : 0x20200000; pixel_shader.rgb_outputs[0] = 0x0000208C; @@ -958,7 +906,7 @@ void _rasterizer_environment_lightmap_draw( pixel_shader.alpha_inputs[1] = 0xDCDCCCCC; pixel_shader.alpha_outputs[1] = 0x00024C00; pixel_shader.rgb_inputs[1] = - rasterizer_debug_options.lightmap_bump_enabled + rasterizer_debug_options.lightmap_incident_radiosity_enabled ? 0x484B0A01 : 0x20200000; pixel_shader.rgb_outputs[1] = 0x00002080; @@ -1160,9 +1108,9 @@ void _rasterizer_environment_lightmap_begin( rasterizer_set_texture_bitmap_data(2, lightmap_bitmap); D3DDevice_SetTextureState_Deferred(2, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP); D3DDevice_SetTextureState_Deferred(2, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP); - D3DDevice_SetTextureState_Deferred(2, D3DTSS_MAGFILTER, (rasterizer_debug_options.lightmap_filtering != FALSE) + 1); - D3DDevice_SetTextureState_Deferred(2, D3DTSS_MINFILTER, (rasterizer_debug_options.lightmap_filtering != FALSE) + 1); - D3DDevice_SetTextureState_Deferred(2, D3DTSS_MIPFILTER, (rasterizer_debug_options.lightmap_filtering != FALSE) + 1); + D3DDevice_SetTextureState_Deferred(2, D3DTSS_MAGFILTER, (rasterizer_debug_options.lightmap_filtering_enabled != FALSE) + 1); + D3DDevice_SetTextureState_Deferred(2, D3DTSS_MINFILTER, (rasterizer_debug_options.lightmap_filtering_enabled != FALSE) + 1); + D3DDevice_SetTextureState_Deferred(2, D3DTSS_MIPFILTER, (rasterizer_debug_options.lightmap_filtering_enabled != FALSE) + 1); rasterizer_environment_globals.lightmap_missing = FALSE; } else @@ -2232,9 +2180,9 @@ void _rasterizer_environment_specular_lightmap_begin( rasterizer_set_texture_bitmap_data(1, lightmap_bitmap); D3DDevice_SetTextureState_Deferred(1, _d3d_texture_state_address_u, _d3d_texture_address_clamp); D3DDevice_SetTextureState_Deferred(1, _d3d_texture_state_address_v, _d3d_texture_address_clamp); - D3DDevice_SetTextureState_Deferred(1, _d3d_texture_state_mag_filter, (rasterizer_debug_options.lightmap_filtering != FALSE) + 1); - D3DDevice_SetTextureState_Deferred(1, _d3d_texture_state_min_filter, (rasterizer_debug_options.lightmap_filtering != FALSE) + 1); - D3DDevice_SetTextureState_Deferred(1, _d3d_texture_state_mip_filter, (rasterizer_debug_options.lightmap_filtering != FALSE) + 1); + D3DDevice_SetTextureState_Deferred(1, _d3d_texture_state_mag_filter, (rasterizer_debug_options.lightmap_filtering_enabled != FALSE) + 1); + D3DDevice_SetTextureState_Deferred(1, _d3d_texture_state_min_filter, (rasterizer_debug_options.lightmap_filtering_enabled != FALSE) + 1); + D3DDevice_SetTextureState_Deferred(1, _d3d_texture_state_mip_filter, (rasterizer_debug_options.lightmap_filtering_enabled != FALSE) + 1); rasterizer_environment_globals.lightmap_missing = FALSE; } else @@ -2454,9 +2402,9 @@ void _rasterizer_environment_reflection_lightmap_mask_begin( rasterizer_set_texture_bitmap_data(0, lightmap_bitmap); D3DDevice_SetTextureState_Deferred(0, _d3d_texture_state_address_u, _d3d_texture_address_clamp); D3DDevice_SetTextureState_Deferred(0, _d3d_texture_state_address_v, _d3d_texture_address_clamp); - D3DDevice_SetTextureState_Deferred(0, _d3d_texture_state_mag_filter, (rasterizer_debug_options.lightmap_filtering != FALSE) + 1); - D3DDevice_SetTextureState_Deferred(0, _d3d_texture_state_min_filter, (rasterizer_debug_options.lightmap_filtering != FALSE) + 1); - D3DDevice_SetTextureState_Deferred(0, _d3d_texture_state_mip_filter, (rasterizer_debug_options.lightmap_filtering != FALSE) + 1); + D3DDevice_SetTextureState_Deferred(0, _d3d_texture_state_mag_filter, (rasterizer_debug_options.lightmap_filtering_enabled != FALSE) + 1); + D3DDevice_SetTextureState_Deferred(0, _d3d_texture_state_min_filter, (rasterizer_debug_options.lightmap_filtering_enabled != FALSE) + 1); + D3DDevice_SetTextureState_Deferred(0, _d3d_texture_state_mip_filter, (rasterizer_debug_options.lightmap_filtering_enabled != FALSE) + 1); rasterizer_environment_globals.lightmap_missing = FALSE; } else diff --git a/source/rasterizer/xbox/rasterizer_xbox_environment_fog.c b/source/rasterizer/xbox/rasterizer_xbox_environment_fog.c index 6c910485..2c2b68fb 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_environment_fog.c +++ b/source/rasterizer/xbox/rasterizer_xbox_environment_fog.c @@ -131,8 +131,8 @@ symbols in this file: #include "game/game_globals.h" #include "interface/hud_draw.h" #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" #include "rasterizer/common/rasterizer_common.h" -#include "rasterizer/rasterizer_frame_statistics.h" #include "rasterizer/rasterizer_geometry.h" #include "rasterizer/rasterizer_transparent_geometry.h" #include "render/render.h" @@ -144,6 +144,8 @@ symbols in this file: #include #include "rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" +#include "rasterizer_xbox_draw_primitives.h" #include "rasterizer_xbox_water.h" /* ---------- constants */ @@ -235,17 +237,6 @@ struct real_bounds real upper; }; -struct rasterizer_environment_fog_debug_options -{ - byte reserved00[2]; - short statistics_mode; - short drawing_mode; - byte reserved06[0x16]; - boolean draw_environment_fog; - boolean draw_environment_fog_screen; - boolean draw_water; -}; - struct fog_screen { word flags; @@ -271,28 +262,6 @@ struct fog_screen real wind_perpendicular_weight; }; -struct pixel_shader_definition -{ - unsigned long alpha_inputs[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long constant_1[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long alpha_outputs[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long rgb_inputs[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - struct rasterizer_environment_fog_screen_wind { real_vector2d direction; @@ -441,8 +410,6 @@ static struct render_animation const *cached_animation = NULL; static boolean reported_too_many_opaque_models = FALSE; static boolean local_fog_screen_first_time = TRUE; -extern struct rasterizer_environment_fog_debug_options rasterizer_debug_options; - static boolean rasterizer_environment_fog_screen_is_active( void); static void rasterizer_environment_fog_screen_wind_update( diff --git a/source/rasterizer/xbox/rasterizer_xbox_errors.c b/source/rasterizer/xbox/rasterizer_xbox_errors.c index 0edc7376..415dd656 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_errors.c +++ b/source/rasterizer/xbox/rasterizer_xbox_errors.c @@ -59,6 +59,7 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "cseries/errors.h" /* ---------- constants */ diff --git a/source/rasterizer/xbox/rasterizer_xbox_hardware_bitmaps.c b/source/rasterizer/xbox/rasterizer_xbox_hardware_bitmaps.c index 48ec57bb..8b08dd02 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_hardware_bitmaps.c +++ b/source/rasterizer/xbox/rasterizer_xbox_hardware_bitmaps.c @@ -76,7 +76,6 @@ symbols in this file: #include "cseries/errors.h" #include "bitmaps/bitmaps.h" #include "bitmaps/bitmap_group.h" -#include "bitmaps/bitmaps_mipmap.h" #include "cache/texture_cache.h" #include "rasterizer/rasterizer.h" #include "rasterizer/rasterizer_swizzle.h" diff --git a/source/rasterizer/xbox/rasterizer_xbox_lights.c b/source/rasterizer/xbox/rasterizer_xbox_lights.c index ec3d9d64..1ae95b0c 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_lights.c +++ b/source/rasterizer/xbox/rasterizer_xbox_lights.c @@ -88,6 +88,7 @@ symbols in this file: #include #include "rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" /* ---------- constants */ @@ -109,28 +110,6 @@ enum /* ---------- structures */ -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - struct lens_flare_definition { byte reserved00[0x10]; diff --git a/source/rasterizer/xbox/rasterizer_xbox_models.c b/source/rasterizer/xbox/rasterizer_xbox_models.c index 6bb8e003..ae5b6e5a 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_models.c +++ b/source/rasterizer/xbox/rasterizer_xbox_models.c @@ -106,6 +106,7 @@ symbols in this file: #include "math/real_math.h" #undef REAL_MATH_EXTERNAL_POINT_FROM_LINE3D #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" #include "rasterizer/rasterizer_geometry.h" #include "rasterizer/rasterizer_models.h" #include "rasterizer/rasterizer_transparent_geometry.h" @@ -117,6 +118,7 @@ symbols in this file: #include "interface/progress_bar_internal.h" #include "rasterizer/xbox/rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" #include "rasterizer/xbox/rasterizer_xbox_draw_primitives.h" #include "rasterizer/xbox/rasterizer_xbox_internal.h" #include "rasterizer/xbox/rasterizer_xbox_models.h" @@ -207,21 +209,6 @@ enum /* ---------- structures */ -struct rasterizer_debug_options -{ - byte reserved00[2]; - short statistics_mode; - byte reserved04[8]; - boolean draw_models; - boolean draw_transparent_models; - byte reserved0E[0xE]; - boolean fog; - byte reserved1D[0x24]; - boolean active_camouflage; - byte reserved42[0x12]; - unsigned long zbias; -}; - struct rasterizer_model_effect_parameters { short type; @@ -344,52 +331,6 @@ struct transparent_geometry_group byte pad9E[2]; }; -struct rasterizer_models_frame_statistics -{ - byte reserved000[0x14]; - unsigned long vertices_by_permutation[ - NUMBER_OF_MODEL_VERTEX_SHADER_PERMUTATIONS]; - byte reserved024[0xB0]; - unsigned long model_count; - unsigned long model_vertex_count; - unsigned long model_triangle_count; - unsigned long model_draw_count; - long transparent_model_vertex_count; - long transparent_model_triangle_count; - long transparent_model_maximum_triangle_count; - long transparent_model_submit_count; - byte reserved0F4[0x5C]; - unsigned long skinning_work; - unsigned long lighting_work; - unsigned long vertex_shader_work; - unsigned long pushbuffer_words; - unsigned long skinning_work_accumulated; - unsigned long lighting_work_accumulated; - unsigned long vertex_shader_work_accumulated; -}; - -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - struct shader_environment_diffuse_properties { byte reserved00[0x1C]; @@ -451,13 +392,6 @@ struct shader_environment_definition struct shader_environment_properties environment; }; -typedef char verify_rasterizer_models_draw_models_offset[ - offsetof(struct rasterizer_debug_options, draw_models) == 0x0C - ? 1 : -1]; -typedef char verify_rasterizer_models_active_camouflage_offset[ - offsetof( - struct rasterizer_debug_options, - active_camouflage) == 0x41 ? 1 : -1]; typedef char verify_rasterizer_model_parameters_skinning_offset[ offsetof(struct rasterizer_model_begin_parameters, skinning) == 0x08 ? 1 : -1]; @@ -472,15 +406,15 @@ typedef char verify_rasterizer_models_window_fog_offset[ ? 1 : -1]; typedef char verify_rasterizer_models_statistics_skinning_offset[ offsetof( - struct rasterizer_models_frame_statistics, - skinning_work) == 0x150 ? 1 : -1]; + struct rasterizer_frame_statistics_globals, + vertex_shader_skinning_constant_bytes) == 0x150 ? 1 : -1]; typedef char verify_rasterizer_models_statistics_pushbuffer_offset[ offsetof( - struct rasterizer_models_frame_statistics, - pushbuffer_words) == 0x15C ? 1 : -1]; + struct rasterizer_frame_statistics_globals, + pixel_shader_pushbuffer_bytes) == 0x15C ? 1 : -1]; typedef char verify_rasterizer_models_statistics_vertex_offset[ offsetof( - struct rasterizer_models_frame_statistics, + struct rasterizer_frame_statistics_globals, model_vertex_count) == 0xD8 ? 1 : -1]; typedef char verify_rasterizer_model_parameters_position_offset[ offsetof(struct rasterizer_model_begin_parameters, centroid) == 0xB4 @@ -506,7 +440,7 @@ typedef char verify_transparent_geometry_group_cortana_hack_offset[ ? 1 : -1]; typedef char verify_rasterizer_models_statistics_transparent_offset[ offsetof( - struct rasterizer_models_frame_statistics, + struct rasterizer_frame_statistics_globals, transparent_model_vertex_count) == 0xE4 ? 1 : -1]; typedef char verify_rasterizer_model_pixel_shader_size[ sizeof(struct pixel_shader_definition) == 0xF0 ? 1 : -1]; @@ -533,9 +467,6 @@ typedef char verify_shader_environment_cube_map_offset[ struct shader_environment_definition, environment.reflection.cube_map) == 0x324 ? 1 : -1]; -typedef char verify_rasterizer_models_debug_options_zbias_offset[ - offsetof(struct rasterizer_debug_options, zbias) == 0x54 - ? 1 : -1]; typedef char verify_rasterizer_model_parameters_effect_shader_offset[ offsetof(struct rasterizer_model_begin_parameters, effect.shader) == 0xA8 ? 1 : -1]; @@ -544,12 +475,12 @@ typedef char verify_rasterizer_model_parameters_effect_animation_offset[ ? 1 : -1]; typedef char verify_rasterizer_models_statistics_vertex_shader_work_offset[ offsetof( - struct rasterizer_models_frame_statistics, - vertex_shader_work) == 0x158 ? 1 : -1]; + struct rasterizer_frame_statistics_globals, + vertex_shader_instruction_count) == 0x158 ? 1 : -1]; typedef char verify_rasterizer_models_statistics_vertex_shader_accum_offset[ offsetof( - struct rasterizer_models_frame_statistics, - vertex_shader_work_accumulated) == 0x168 ? 1 : -1]; + struct rasterizer_frame_statistics_globals, + model_vertex_shader_work_accumulated) == 0x168 ? 1 : -1]; typedef char verify_shader_plasma_intensity_exponent_source_offset[ offsetof( struct shader_transparent_plasma_definition, @@ -614,7 +545,6 @@ typedef char verify_shader_model_reflection_cube_map_offset[ /* ---------- globals */ -extern struct rasterizer_debug_options rasterizer_debug_options; static struct render_animation const *transparent_geometry_cached_animation = NULL; static struct render_lighting const *transparent_geometry_cached_lighting = NULL; static short transparent_geometry_cached_node_matrix_count = 0; @@ -630,7 +560,6 @@ static boolean local_do_not_change_z_stencil_states = FALSE; static boolean local_reported_too_many_transparent_geometry_groups = FALSE; static boolean local_pixel_shader_dirty_flag = TRUE; extern boolean rasterizer_model_cortana_hack; -extern struct rasterizer_models_frame_statistics rasterizer_frame_statistics; /* ---------- public code */ @@ -748,7 +677,7 @@ void _rasterizer_model_begin( local_do_not_change_z_stencil_states = do_not_change_z_stencil_states; - if (rasterizer_debug_options.active_camouflage && + if (rasterizer_debug_options.active_camouflage_enabled && global_window_parameters.rasterizer_target == 0 && parameters->effect.type == _render_model_effect_type_active_camouflage && parameters->effect.intensity > 0.0f) @@ -764,16 +693,16 @@ void _rasterizer_model_begin( } else { - skinning_work = rasterizer_frame_statistics.skinning_work; + skinning_work = rasterizer_frame_statistics.vertex_shader_skinning_constant_bytes; rasterizer_set_model_skinning(¶meters->skinning); skinning_work = - rasterizer_frame_statistics.skinning_work - skinning_work; - lighting_work = rasterizer_frame_statistics.lighting_work; + rasterizer_frame_statistics.vertex_shader_skinning_constant_bytes - skinning_work; + lighting_work = rasterizer_frame_statistics.vertex_shader_lighting_constant_bytes; rasterizer_set_model_lighting(¶meters->lighting); - rasterizer_frame_statistics.skinning_work_accumulated += + rasterizer_frame_statistics.model_skinning_constant_bytes += skinning_work; - rasterizer_frame_statistics.lighting_work_accumulated += - rasterizer_frame_statistics.lighting_work - lighting_work; + rasterizer_frame_statistics.model_lighting_constant_bytes += + rasterizer_frame_statistics.vertex_shader_lighting_constant_bytes - lighting_work; local_model_effect_type = _render_model_effect_type_none; } @@ -1146,7 +1075,7 @@ static void set_environment_shader_pixel_shader( if (rasterizer_debug_options.statistics_mode == _rasterizer_statistics_mode_enabled) { - rasterizer_frame_statistics.pushbuffer_words += 44; + rasterizer_frame_statistics.pixel_shader_pushbuffer_bytes += 44; } } @@ -1469,7 +1398,7 @@ void rasterizer_model_draw_environment_shader( 439, global_window_parameters.fog.planar_maximum_depth>0.0f); - if (rasterizer_debug_options.fog && + if (rasterizer_debug_options.draw_environment_fog && !TEST_FLAG( local_parameters->geometry_flags, _rasterizer_geometry_no_fog_bit)) @@ -1674,7 +1603,7 @@ void rasterizer_model_draw_environment_shader( if (rasterizer_debug_options.statistics_mode == _rasterizer_statistics_mode_enabled) { - rasterizer_frame_statistics.pushbuffer_words += 24; + rasterizer_frame_statistics.pixel_shader_pushbuffer_bytes += 24; rasterizer_frame_statistics.model_draw_count++; rasterizer_frame_statistics.model_triangle_count += triangle_count; rasterizer_frame_statistics.model_vertex_count += @@ -2102,7 +2031,7 @@ void _rasterizer_model_draw( } vertex_shader_work = - rasterizer_frame_statistics.vertex_shader_work; + rasterizer_frame_statistics.vertex_shader_instruction_count; if (!TEST_FLAG( shader_model->model.flags, @@ -2157,8 +2086,8 @@ void _rasterizer_model_draw( if (rasterizer_debug_options.statistics_mode >= _rasterizer_statistics_mode_summary) { - rasterizer_frame_statistics.vertex_shader_work_accumulated += - rasterizer_frame_statistics.vertex_shader_work - + rasterizer_frame_statistics.model_vertex_shader_work_accumulated += + rasterizer_frame_statistics.vertex_shader_instruction_count - vertex_shader_work; rasterizer_frame_statistics.vertices_by_permutation[ vertex_shader_permutation] += vertex_buffer->count; @@ -2280,7 +2209,7 @@ void _rasterizer_model_draw( 1077, global_window_parameters.fog.planar_maximum_depth>0.0f); - if (rasterizer_debug_options.fog && + if (rasterizer_debug_options.draw_environment_fog && !TEST_FLAG( local_parameters->geometry_flags, _rasterizer_geometry_no_fog_bit)) @@ -2550,7 +2479,7 @@ struct transparent_geometry_group *_rasterizer_model_transparent_geometry_submit boolean submit_decals; if (rasterizer_debug_options.draw_models && - rasterizer_debug_options.draw_transparent_models) + rasterizer_debug_options.draw_model_transparent_geometry) { alpha_blended_decal = shader && diff --git a/source/rasterizer/xbox/rasterizer_xbox_motion_sensor.c b/source/rasterizer/xbox/rasterizer_xbox_motion_sensor.c index 7742b9f5..4c210fc0 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_motion_sensor.c +++ b/source/rasterizer/xbox/rasterizer_xbox_motion_sensor.c @@ -39,13 +39,16 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "cache/texture_cache.h" #include "cseries/errors.h" #include "bitmaps/bitmap_group.h" #include "game/players.h" #include "interface/interface.h" #include "math/real_math.h" #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" #include +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" /* ---------- constants */ @@ -53,45 +56,12 @@ symbols in this file: /* ---------- structures */ -struct motion_sensor_debug_options -{ - byte reserved00[0x23]; - boolean motion_sensor; -}; - -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - /* ---------- prototypes */ struct bitmap_data *bitmap_group_try_and_get_bitmap( long bitmap_group_index, short bitmap_index); -void *_texture_cache_bitmap_get_hardware_format( - struct bitmap_data *bitmap, - boolean block, - boolean load); - void rasterizer_set_target( word target, boolean use_depth_buffer, @@ -123,7 +93,6 @@ void SetRenderStateSmart( /* ---------- globals */ extern void *global_d3d_device; -extern struct motion_sensor_debug_options rasterizer_debug_options; extern struct pixel_shader_definition pixel_shader; static boolean bss_00465e27 = {0}; @@ -150,7 +119,7 @@ void _rasterizer_hud_motion_sensor_blip_begin( global_d3d_device); bss_00465e27 = FALSE; - if (rasterizer_debug_options.motion_sensor && + if (rasterizer_debug_options.draw_hud_motion_sensor && _texture_cache_bitmap_get_hardware_format(blip_bitmap, FALSE, TRUE) && _texture_cache_bitmap_get_hardware_format(large_blip_bitmap, FALSE, TRUE)) { @@ -288,7 +257,7 @@ void _rasterizer_hud_motion_sensor_blip_draw( rasterizer_set_texture_bitmap_data( 0, large_blip ? large_blip_bitmap : blip_bitmap); - if (rasterizer_debug_options.motion_sensor && bss_00465e27) + if (rasterizer_debug_options.draw_hud_motion_sensor && bss_00465e27) { radius = size * 0.0625f; scaled_position.x = position->x * -0.03125f; @@ -358,7 +327,7 @@ void _rasterizer_hud_motion_sensor_blip_end( 156, global_d3d_device); - if (rasterizer_debug_options.motion_sensor) + if (rasterizer_debug_options.draw_hud_motion_sensor) { if (bss_00465e27 && _texture_cache_bitmap_get_hardware_format(sweep_bitmap, FALSE, TRUE) && @@ -628,7 +597,7 @@ void _rasterizer_hud_motion_sensor_blip_end( } } - if (rasterizer_debug_options.motion_sensor && bss_00465e27) + if (rasterizer_debug_options.draw_hud_motion_sensor && bss_00465e27) { rasterizer_set_target( global_window_parameters.rasterizer_target, diff --git a/source/rasterizer/xbox/rasterizer_xbox_plasma_energy.c b/source/rasterizer/xbox/rasterizer_xbox_plasma_energy.c index e2ea423e..7e6aed30 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_plasma_energy.c +++ b/source/rasterizer/xbox/rasterizer_xbox_plasma_energy.c @@ -27,6 +27,7 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "rasterizer/rasterizer.h" #include "real_math.h" #include "rasterizer/rasterizer_transparent_geometry.h" #include "rasterizer/xbox/rasterizer_xbox_plasma_energy.h" @@ -37,6 +38,8 @@ symbols in this file: * Keep the stock D3DINLINE definition: the real calls below make VC7 emit * the target's complete wrapper bodies. */ #include +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" +#include "rasterizer/rasterizer_console_vars.h" /* ---------- constants */ @@ -44,18 +47,6 @@ symbols in this file: /* ---------- structures */ -struct rasterizer_debug_options_plasma -{ - byte reserved00[0x43]; - boolean plasma_energy; -}; - -struct rasterizer_frame_begin_parameters -{ - real game_time_sec; - real dt; -}; - struct plasma_runtime_parameters { real_rgb_color const *colors; @@ -101,28 +92,6 @@ struct shader_transparent_plasma_definition long secondary_noise_map; }; -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - typedef char plasma_group_size_assert[ sizeof(struct rasterizer_transparent_geometry_group_plasma) == 0x70 ? 1 : -1]; typedef char plasma_group_shader_offset_assert[ @@ -142,10 +111,6 @@ typedef char pixel_shader_definition_size_assert[ /* ---------- prototypes */ -double pow( - double x, - double y); - void rasterizer_set_texture( short stage, short bitmap_type, @@ -164,7 +129,6 @@ void rasterizer_set_pixel_shader( /* ---------- globals */ extern void *global_d3d_device; -extern struct rasterizer_debug_options_plasma rasterizer_debug_options; extern struct rasterizer_frame_begin_parameters global_frame_parameters; extern struct pixel_shader_definition pixel_shader; @@ -192,7 +156,7 @@ void rasterizer_plasma_energy_draw( "c:\\halo\\SOURCE\\rasterizer\\xbox\\rasterizer_xbox_plasma_energy.c", 21, global_d3d_device); - if (rasterizer_debug_options.plasma_energy) + if (rasterizer_debug_options.plasma_energy_enabled) { plasma = (struct shader_transparent_plasma_definition const *)( (byte *)shader_get_and_verify_type(group->shader, 10) + sizeof(struct shader)); diff --git a/source/rasterizer/xbox/rasterizer_xbox_profile.c b/source/rasterizer/xbox/rasterizer_xbox_profile.c index a5d5a07c..3f528298 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_profile.c +++ b/source/rasterizer/xbox/rasterizer_xbox_profile.c @@ -136,7 +136,7 @@ symbols in this file: #include "cseries/errors.h" #include "cseries/profile_rasterizer.h" #include "rasterizer/rasterizer.h" -#include "rasterizer/rasterizer_debug_options.h" +#include "rasterizer/rasterizer_console_vars.h" #include @@ -604,8 +604,8 @@ void rasterizer_profile_dispose( static boolean rasterizer_profile_enabled( void) { - return rasterizer_debug_options.stats == 3 || - rasterizer_debug_options.profile_log; + return rasterizer_debug_options.statistics_mode == 3 || + rasterizer_debug_options.profile_log_enabled; } static void profile_assert( diff --git a/source/rasterizer/xbox/rasterizer_xbox_screen_effect.c b/source/rasterizer/xbox/rasterizer_xbox_screen_effect.c index c5509cb4..172b292d 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_screen_effect.c +++ b/source/rasterizer/xbox/rasterizer_xbox_screen_effect.c @@ -103,7 +103,7 @@ symbols in this file: #include "render/render_cameras.h" #include "rasterizer/rasterizer.h" #include "rasterizer/rasterizer_cinematics.h" -#include "rasterizer/rasterizer_debug_options.h" +#include "rasterizer/rasterizer_console_vars.h" #include #include #include "rasterizer_xbox.h" @@ -168,9 +168,9 @@ enum /* ---------- structures */ typedef char rasterizer_screen_effect_debug_options_flashes_offset_assert[ - offsetof(struct rasterizer_debug_options_definition, screen_flashes) == 0x47 ? 1 : -1]; + offsetof(struct rasterizer_debug_options, screen_flash_enabled) == 0x47 ? 1 : -1]; typedef char rasterizer_screen_effect_debug_options_effects_offset_assert[ - offsetof(struct rasterizer_debug_options_definition, screen_effects) == 0x48 ? 1 : -1]; + offsetof(struct rasterizer_debug_options, screen_effects_enabled) == 0x48 ? 1 : -1]; typedef char rasterizer_screen_effect_parameters_mask_offset_assert[ offsetof(struct rasterizer_cinematic_screen_effect_parameters, convolution_mask) == 0x08 ? 1 : -1]; typedef char rasterizer_screen_effect_parameters_tint_offset_assert[ @@ -468,7 +468,7 @@ void _rasterizer_screen_effect( parameters->filter_light_enhancement_intensity > 0.0f || parameters->filter_desaturation_intensity > 0.0f || parameters->video_on) && - rasterizer_debug_options.screen_effects && + rasterizer_debug_options.screen_effects_enabled && global_window_parameters.rasterizer_target == _rasterizer_target_render_primary) { short pass_count = (parameters->convolution_extra_passes + 1) * 2; @@ -1181,7 +1181,7 @@ void _rasterizer_screen_flash( rasterizer_profile_begin(_rasterizer_profile_screen_flash); - if (rasterizer_debug_options.screen_flashes && + if (rasterizer_debug_options.screen_flash_enabled && global_window_parameters.screen_flash.type != _render_screen_flash_type_none) { flash_color.alpha = global_window_parameters.screen_flash.intensity * diff --git a/source/rasterizer/xbox/rasterizer_xbox_shadows.c b/source/rasterizer/xbox/rasterizer_xbox_shadows.c index 760c7f96..1e44ba6f 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_shadows.c +++ b/source/rasterizer/xbox/rasterizer_xbox_shadows.c @@ -74,7 +74,6 @@ symbols in this file: #include "bitmaps/bitmap_color_conversion.h" #include "interface/hud_draw.h" #include "rasterizer/common/rasterizer_common.h" -#include "rasterizer/rasterizer_frame_statistics.h" #include "rasterizer/rasterizer_geometry.h" #include "render/render.h" #include "shaders/shader_definitions.h" @@ -84,8 +83,10 @@ symbols in this file: * the real device calls below. Keep the stock inline definitions and do not * replace these wrappers with handwritten bodies. */ #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" #include #include "rasterizer/xbox/rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" #include "rasterizer/xbox/rasterizer_xbox_draw_primitives.h" /* ---------- constants */ @@ -132,39 +133,6 @@ enum /* ---------- structures */ -struct rasterizer_shadows_debug_options_prefix -{ - byte reserved00[2]; - short statistics_mode; - byte reserved04[0xE]; - boolean draw_environment_shadows; - byte reserved13[0x2B]; - boolean shadows_convolution; - boolean shadows_debug; -}; - -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - struct rasterizer_model_lighting_parameters { byte data[0x74]; @@ -206,10 +174,6 @@ struct shader_model_definition struct shader_texture_animation animation; }; -typedef char verify_rasterizer_shadows_draw_shadows_offset[ - offsetof( - struct rasterizer_shadows_debug_options_prefix, - draw_environment_shadows) == 0x12 ? 1 : -1]; typedef char verify_rasterizer_shadows_model_shadow_count_offset[ offsetof( struct rasterizer_frame_statistics_globals, @@ -241,7 +205,6 @@ static void rasterizer_shadow_convolve( /* ---------- globals */ extern D3DDevice *global_d3d_device; -extern struct rasterizer_shadows_debug_options_prefix rasterizer_debug_options; extern struct pixel_shader_definition pixel_shader; static boolean shadow_restored = TRUE; @@ -363,7 +326,7 @@ boolean _rasterizer_environment_shadow_begin( rasterizer_set_target( 2, 0, - rasterizer_debug_options.shadows_debug ? 0x88888888 : 0, + rasterizer_debug_options.shadow_debug_enabled ? 0x88888888 : 0, TRUE, FALSE); rasterizer_set_stencil_mode(0); @@ -638,14 +601,14 @@ void _rasterizer_environment_shadow_draw( { if (!shadow_setup) { - if (rasterizer_debug_options.shadows_convolution) + if (rasterizer_debug_options.shadow_convolution_enabled) { rasterizer_shadow_convolve(); } rasterizer_set_target_as_texture( 0, - (rasterizer_debug_options.shadows_convolution != FALSE) + 2, + (rasterizer_debug_options.shadow_convolution_enabled != FALSE) + 2, FALSE); IDirect3DDevice8_SetTextureStageState( global_d3d_device, @@ -802,7 +765,7 @@ void _rasterizer_environment_shadow_draw( pixel_shader.rgb_outputs[3] = 0x000020D0; pixel_shader.final_combiner_inputs_abcd = 0x0000002C; pixel_shader.final_combiner_inputs_efg = 0x00000D00; - if (rasterizer_debug_options.shadows_debug) + if (rasterizer_debug_options.shadow_debug_enabled) { pixel_shader.final_combiner_inputs_abcd = 0x0000000C; IDirect3DDevice8_SetRenderState( @@ -919,7 +882,7 @@ static void rasterizer_shadow_convolve( global_d3d_device); if (rasterizer_debug_options.draw_environment_shadows && - rasterizer_debug_options.shadows_convolution) + rasterizer_debug_options.shadow_convolution_enabled) { for (stage = 0; stage < 4; stage++) { diff --git a/source/rasterizer/xbox/rasterizer_xbox_text.c b/source/rasterizer/xbox/rasterizer_xbox_text.c index 9473790f..b4da3254 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_text.c +++ b/source/rasterizer/xbox/rasterizer_xbox_text.c @@ -64,7 +64,9 @@ symbols in this file: * code_00163380 = IDirect3DDevice8_End */ #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" #include +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" /* ---------- constants */ @@ -81,12 +83,6 @@ struct rasterizer_text_vertex unsigned long color; }; -struct rasterizer_text_debug_options -{ - byte reserved00[0x22]; - boolean render_text; -}; - struct bitmap_data; struct rasterizer_text_begin_parameters @@ -111,28 +107,6 @@ struct rasterizer_text_begin_parameters byte pad8B; }; -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - /* ---------- prototypes */ void rasterizer_error( @@ -159,7 +133,6 @@ void rasterizer_set_pixel_shader( /* ---------- globals */ extern void *global_d3d_device; -extern struct rasterizer_text_debug_options rasterizer_debug_options; extern struct pixel_shader_definition pixel_shader; /* ---------- public code */ @@ -184,7 +157,7 @@ void rasterizer_text_begin( "c:\\halo\\SOURCE\\rasterizer\\xbox\\rasterizer_xbox_text.c", 13, global_d3d_device); - if (rasterizer_debug_options.render_text && + if (rasterizer_debug_options.draw_dynamic_screen_geometry && global_window_parameters.rasterizer_target == 0) { match_assert( @@ -431,7 +404,7 @@ void rasterizer_text_draw_character( 216, global_d3d_device); - if (rasterizer_debug_options.render_text && + if (rasterizer_debug_options.draw_dynamic_screen_geometry && global_window_parameters.rasterizer_target == 0) { success = IDirect3DDevice8_Begin( diff --git a/source/rasterizer/xbox/rasterizer_xbox_transparent_geometry.c b/source/rasterizer/xbox/rasterizer_xbox_transparent_geometry.c index c43342c2..403bc890 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_transparent_geometry.c +++ b/source/rasterizer/xbox/rasterizer_xbox_transparent_geometry.c @@ -135,6 +135,7 @@ symbols in this file: #include "main/main.h" #include "real_math.h" #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" #include "rasterizer/rasterizer_active_camouflage.h" #include "rasterizer/rasterizer_geometry.h" #include "rasterizer/rasterizer_transparent_geometry.h" @@ -161,6 +162,7 @@ symbols in this file: #include #include "interface/progress_bar_internal.h" #include "rasterizer/xbox/rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" #include "rasterizer/xbox/rasterizer_xbox_plasma_energy.h" #include "rasterizer/xbox/rasterizer_xbox_water.h" #include "rasterizer/xbox/shader_transparent_chicago_preprocessor.h" @@ -381,73 +383,6 @@ enum /* ---------- structures */ -struct rasterizer_transparent_geometry_debug_options_prefix -{ - byte reserved00[0xA]; - boolean debug_transparent_geometry; - boolean debug_meter_shader; - byte reserved0C[0x10]; - boolean draw_environment_fog; - byte reserved1D[0x15]; - short transparent_geometry_index; - byte reserved34[0xE]; - boolean active_camouflage_multipass; - byte reserved43[0x11]; - unsigned long zbias; - byte reserved58[0x8]; - boolean zsprites; - byte reserved61[0xB]; - real transparent_geometry_intensity; - real debug_shader_values[6]; - boolean transparent_pixel_counter_active; - boolean transparent_pixel_counter; - byte reserved8A[2]; -}; - -typedef char rasterizer_transparent_geometry_debug_options_index_offset_assert[ - offsetof(struct rasterizer_transparent_geometry_debug_options_prefix, - transparent_geometry_index) == 0x32 ? 1 : -1]; -typedef char rasterizer_transparent_geometry_debug_options_zbias_offset_assert[ - offsetof(struct rasterizer_transparent_geometry_debug_options_prefix, - zbias) == 0x54 ? 1 : -1]; -typedef char rasterizer_transparent_geometry_debug_options_intensity_offset_assert[ - offsetof(struct rasterizer_transparent_geometry_debug_options_prefix, - transparent_geometry_intensity) == 0x6C ? 1 : -1]; -typedef char rasterizer_transparent_geometry_debug_options_counter_offset_assert[ - offsetof(struct rasterizer_transparent_geometry_debug_options_prefix, - transparent_pixel_counter_active) == 0x88 ? 1 : -1]; -typedef char rasterizer_transparent_geometry_debug_options_fog_offset_assert[ - offsetof(struct rasterizer_transparent_geometry_debug_options_prefix, - draw_environment_fog) == 0x1C ? 1 : -1]; -typedef char rasterizer_transparent_geometry_debug_options_zsprites_offset_assert[ - offsetof(struct rasterizer_transparent_geometry_debug_options_prefix, - zsprites) == 0x60 ? 1 : -1]; -typedef char rasterizer_transparent_geometry_debug_options_values_offset_assert[ - offsetof(struct rasterizer_transparent_geometry_debug_options_prefix, - debug_shader_values) == 0x70 ? 1 : -1]; - -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - /* the transparent shader tag layouts January reads here; the same file-local * form SHADER_TRANSPARENT_GENERIC_PREPROCESSOR.C and * SHADER_TRANSPARENT_CHICAGO_PREPROCESSOR.C use, extended with the fields this @@ -707,9 +642,6 @@ typedef char rasterizer_xbox_transparent_geometry_globals_size_assert[ static struct rasterizer_xbox_transparent_geometry_globals rasterizer_xbox_transparent_geometry_globals = { 0 }; -extern struct rasterizer_transparent_geometry_debug_options_prefix - rasterizer_debug_options; - /* ---------- public code */ boolean rasterizer_transparent_geometry_initialize_aux_buffer( @@ -1061,7 +993,7 @@ void rasterizer_transparent_geometry_group_draw( group->previous_group_presorted_index), dirty); - if (rasterizer_debug_options.debug_transparent_geometry) + if (rasterizer_debug_options.debug_transparent_geometry_enabled) { struct render_skinning skinning; @@ -1076,9 +1008,9 @@ void rasterizer_transparent_geometry_group_draw( short vertex_type = rasterizer_transparent_geometry_get_primary_vertex_type(group); boolean accumulate = - rasterizer_debug_options.transparent_geometry_index >= + rasterizer_debug_options.pad3 >= RASTERIZER_TRANSPARENT_GEOMETRY_ALL_GROUPS_INDEX || - rasterizer_debug_options.transparent_geometry_index < 0; + rasterizer_debug_options.pad3 < 0; unsigned long seed; real_argb_color color; real minimum; @@ -1147,7 +1079,7 @@ void rasterizer_transparent_geometry_group_draw( csmemset(&pixel_shader, 0, sizeof(pixel_shader)); - seed = rasterizer_debug_options.transparent_geometry_index + + seed = rasterizer_debug_options.pad3 + group->sorted_index; color.alpha = 1.0f; color.red = real_seed_random(&seed); @@ -1166,12 +1098,12 @@ void rasterizer_transparent_geometry_group_draw( if (accumulate) { real intensity = PIN( - rasterizer_debug_options.transparent_geometry_intensity, 0.0f, 1.0f); + rasterizer_debug_options.pad3_scale, 0.0f, 1.0f); if (intensity == 0.0f) intensity = 0.03125f; - if (rasterizer_debug_options.transparent_geometry_index >= + if (rasterizer_debug_options.pad3 >= RASTERIZER_TRANSPARENT_GEOMETRY_ALL_GROUPS_INDEX) { color.red *= intensity; @@ -1349,7 +1281,7 @@ void rasterizer_transparent_geometry_group_draw( global_window_parameters.rasterizer_target == 0 && !dirty) { - if (rasterizer_debug_options.active_camouflage_multipass ? + if (rasterizer_debug_options.active_camouflage_multipass_enabled ? (group->shader && group->shader->base.type == _shader_type_model && group->effect_type == _render_model_effect_type_active_camouflage && @@ -1686,7 +1618,7 @@ void rasterizer_transparent_geometry_group_draw( "IDirect3DDevice8_SetVertexShaderConstant(global_d3d_device, VSH_CONSTANTS__TEXANIM_OFFSET, vsh_constants__texanim, 4)"); } - if (rasterizer_debug_options.zsprites && + if (rasterizer_debug_options.zsprite_enabled && shader_effect->secondary_map_anchor == _shader_effect_secondary_map_anchor_zsprite && shader_effect->secondary_map.index != NONE && @@ -1768,7 +1700,7 @@ void rasterizer_transparent_geometry_group_draw( combiner_index++; } - if (rasterizer_debug_options.zsprites && + if (rasterizer_debug_options.zsprite_enabled && shader_effect->secondary_map_anchor == _shader_effect_secondary_map_anchor_zsprite && shader_effect->secondary_map.index != NONE && @@ -3271,28 +3203,28 @@ void rasterizer_transparent_geometry_group_draw( meter->flash_extension_source-1]; } - if (rasterizer_debug_options.debug_meter_shader) + if (rasterizer_debug_options.debug_meter_shader_enabled) { real debug_value = periodic_function_evaluate( 2, global_frame_parameters.game_time_sec/ - rasterizer_debug_options.transparent_geometry_intensity); + rasterizer_debug_options.pad3_scale); meter_brightness = - rasterizer_debug_options.debug_shader_values[0] >= 0.0f ? - rasterizer_debug_options.debug_shader_values[0] : debug_value; + rasterizer_debug_options.f[0] >= 0.0f ? + rasterizer_debug_options.f[0] : debug_value; flash_brightness = - rasterizer_debug_options.debug_shader_values[1] >= 0.0f ? - rasterizer_debug_options.debug_shader_values[1] : debug_value; + rasterizer_debug_options.f[1] >= 0.0f ? + rasterizer_debug_options.f[1] : debug_value; meter_value = - rasterizer_debug_options.debug_shader_values[2] >= 0.0f ? - rasterizer_debug_options.debug_shader_values[2] : debug_value; + rasterizer_debug_options.f[2] >= 0.0f ? + rasterizer_debug_options.f[2] : debug_value; gradient_value = - rasterizer_debug_options.debug_shader_values[3] >= 0.0f ? - rasterizer_debug_options.debug_shader_values[3] : debug_value; + rasterizer_debug_options.f[3] >= 0.0f ? + rasterizer_debug_options.f[3] : debug_value; flash_extension = - rasterizer_debug_options.debug_shader_values[4] >= 0.0f ? - rasterizer_debug_options.debug_shader_values[4] : debug_value; + rasterizer_debug_options.f[4] >= 0.0f ? + rasterizer_debug_options.f[4] : debug_value; } flash_color.red = flash_brightness*meter->flash_color.red; @@ -3452,8 +3384,8 @@ void rasterizer_transparent_geometry_group_draw( pixel_shader.final_combiner_inputs_abcd = 0x0C180000; pixel_shader.final_combiner_inputs_efg = 0x1C00; - if (rasterizer_debug_options.debug_meter_shader && - rasterizer_debug_options.transparent_geometry_index) + if (rasterizer_debug_options.debug_meter_shader_enabled && + rasterizer_debug_options.pad3) { csmemset(&pixel_shader, 0, sizeof(pixel_shader)); SetTextureStageStateSmart(0, D3DTSS_ALPHAKILL, D3DTALPHAKILL_DISABLE); @@ -3461,7 +3393,7 @@ void rasterizer_transparent_geometry_group_draw( pixel_shader.texture_modes = 1; pixel_shader.combiner_count = 1; pixel_shader.final_combiner_inputs_abcd = - (rasterizer_debug_options.transparent_geometry_index<=1 ? + (rasterizer_debug_options.pad3<=1 ? 0 : 0x10) + 8; } @@ -3527,7 +3459,7 @@ void rasterizer_transparent_geometry_group_draw( { rasterizer_transparent_geometry_group_draw(&groups2[group_index], TRUE); - if (rasterizer_debug_options.transparent_geometry_index) + if (rasterizer_debug_options.pad3) rasterizer_xbox_transparent_geometry_globals.test_no_more_active_camo = TRUE; } diff --git a/source/rasterizer/xbox/rasterizer_xbox_vertex_shaders_initialize.c b/source/rasterizer/xbox/rasterizer_xbox_vertex_shaders_initialize.c index 177ac346..bade3ad4 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_vertex_shaders_initialize.c +++ b/source/rasterizer/xbox/rasterizer_xbox_vertex_shaders_initialize.c @@ -36,6 +36,7 @@ symbols in this file: /* The January object retains exact out-of-line copies of the two D3D wrappers. */ #define D3DINLINE static #include +#include "rasterizer/xbox/rasterizer_xbox.h" /* ---------- constants */ @@ -52,8 +53,6 @@ void rasterizer_error( /* ---------- globals */ -extern void *global_d3d_device; - static unsigned long const vertex_shader_declarations[] = { 0x20000000, 0x40320000, 0x40400009, 0xFFFFFFFF, diff --git a/source/rasterizer/xbox/rasterizer_xbox_vertex_shaders_runtime.c b/source/rasterizer/xbox/rasterizer_xbox_vertex_shaders_runtime.c index 70b0bf2f..2b15c8fc 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_vertex_shaders_runtime.c +++ b/source/rasterizer/xbox/rasterizer_xbox_vertex_shaders_runtime.c @@ -44,11 +44,13 @@ symbols in this file: /* ---------- headers */ -#include "rasterizer/rasterizer_frame_statistics.h" #include "cseries.h" #include "cseries/errors.h" #include "rasterizer_xbox_vertex_shaders.h" #include +#include "rasterizer/rasterizer.h" +#include "rasterizer/xbox/rasterizer_xbox.h" +#include "rasterizer/rasterizer_console_vars.h" /* ---------- constants */ @@ -76,12 +78,6 @@ struct rasterizer_vertex_shader_runtime_globals struct packed_vertex_shader packed_shaders[3]; }; -struct rasterizer_vertex_shader_debug_options -{ - byte reserved00[2]; - short vertex_shader_statistics; -}; - /* ---------- prototypes */ void rasterizer_error( @@ -161,9 +157,6 @@ static struct rasterizer_vertex_shader_runtime_globals vertex_shader_runtime_glo }, }; -extern struct rasterizer_vertex_shader_debug_options rasterizer_debug_options; -extern void *global_d3d_device; - /* ---------- public code */ void rasterizer_set_vertex_shader_permutation( @@ -359,7 +352,7 @@ void rasterizer_set_vertex_shader_permutation( vertex_shader_runtime_globals.packed_shaders[packed_shader_index].loaded = FALSE; } - if (rasterizer_debug_options.vertex_shader_statistics) + if (rasterizer_debug_options.statistics_mode) rasterizer_frame_statistics.vertex_shader_instruction_count += vertex_shader_table[vertex_shader_index].instruction_count; diff --git a/source/rasterizer/xbox/rasterizer_xbox_water.c b/source/rasterizer/xbox/rasterizer_xbox_water.c index d14fe0ae..5a7274c4 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_water.c +++ b/source/rasterizer/xbox/rasterizer_xbox_water.c @@ -55,6 +55,7 @@ symbols in this file: #include "math/real_math.h" #include "rasterizer/common/rasterizer_common.h" #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" #include "shaders/shader_definitions.h" #include "shaders/shaders.h" #include "tag_files/tag_groups.h" @@ -65,6 +66,7 @@ symbols in this file: * nine of them; the real calls below are what instantiates them. */ #include #include "rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" #include "rasterizer/rasterizer_transparent_geometry.h" #include "rasterizer_xbox_water.h" @@ -111,12 +113,6 @@ enum /* ---------- structures */ -struct rasterizer_water_debug_options -{ - byte reserved00[0x1E]; - boolean water; -}; - struct transparent_geometry_group { unsigned long geometry_flags; @@ -166,28 +162,6 @@ struct shader_transparent_water_definition struct tag_block ripples; }; -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - typedef char verify_water_ripple_size[ sizeof(struct water_ripple) == 0x4C ? 1 : -1]; typedef char verify_water_ripple_animation_angle_offset[ @@ -224,8 +198,6 @@ typedef char verify_pixel_shader_definition_size[ static boolean water_needs_update_flag = FALSE; static boolean water_visible_for_window_flag = FALSE; -extern struct rasterizer_water_debug_options rasterizer_debug_options; - /* ---------- public code */ void rasterizer_water_set_visibility_for_frame( @@ -274,7 +246,7 @@ void rasterizer_water_build_bumpmap( "c:\\halo\\SOURCE\\rasterizer\\xbox\\rasterizer_xbox_water.c", 48, global_d3d_device); - if (rasterizer_debug_options.water) + if (rasterizer_debug_options.draw_water) { water = SHADER_GET_TRANSPARENT_WATER(shader); mipmap_level_count = MIN(water->ripple_mipmap_levels, NUMBER_OF_WATER_RIPPLES); @@ -639,7 +611,7 @@ void rasterizer_water_draw( "c:\\halo\\SOURCE\\rasterizer\\xbox\\rasterizer_xbox_water.c", 239, global_d3d_device); - if (rasterizer_debug_options.water) + if (rasterizer_debug_options.draw_water) { water = SHADER_GET_TRANSPARENT_WATER(group->shader); permutation_index = shader_get_vertex_shader_permutation(group->shader); diff --git a/source/rasterizer/xbox/rasterizer_xbox_widgets.c b/source/rasterizer/xbox/rasterizer_xbox_widgets.c index 78f7a4e1..03c09cca 100644 --- a/source/rasterizer/xbox/rasterizer_xbox_widgets.c +++ b/source/rasterizer/xbox/rasterizer_xbox_widgets.c @@ -78,12 +78,13 @@ symbols in this file: #include "math/real_math.h" #include "rasterizer/common/rasterizer_common.h" #include "rasterizer/rasterizer_geometry.h" -#include "rasterizer/rasterizer_transparent_geometry.h" #include #include "rasterizer/xbox/rasterizer_xbox.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" #include "rasterizer/rasterizer_widgets.h" #include "rasterizer/rasterizer.h" +#include "rasterizer/rasterizer_console_vars.h" /* ---------- constants */ @@ -149,43 +150,6 @@ typedef char transparent_geometry_group_size_assert[ sizeof(struct transparent_geometry_group) == 0xA0 ? 1 : -1]; -struct rasterizer_debug_options -{ - byte reserved00[0x44]; - boolean lens_flare_occlusion_enabled; - boolean lens_flare_occlusion_debug; - byte reserved46[0xE]; - unsigned long zbias; - byte reserved58[0x10]; -}; - -typedef char rasterizer_debug_options_size_assert[ - sizeof(struct rasterizer_debug_options) == 0x68 ? 1 : -1]; -typedef char rasterizer_debug_options_zbias_offset_assert[ - offsetof(struct rasterizer_debug_options, zbias) == 0x54 ? 1 : -1]; - -struct pixel_shader_definition -{ - unsigned long alpha_inputs[8]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[8]; - unsigned long constant_1[8]; - unsigned long alpha_outputs[8]; - unsigned long rgb_inputs[8]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[8]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - /* ---------- prototypes */ static boolean rasterizer_widget_project_billboard( @@ -197,7 +161,6 @@ static boolean rasterizer_widget_project_billboard( /* ---------- globals */ extern D3DDevice *global_d3d_device; -extern struct rasterizer_debug_options rasterizer_debug_options; extern struct pixel_shader_definition pixel_shader; static boolean warned_about_too_many_transparent_geometry_groups; diff --git a/source/rasterizer/xbox/shader_transparent_chicago_preprocessor.c b/source/rasterizer/xbox/shader_transparent_chicago_preprocessor.c index 31e8680d..9c1bbc37 100644 --- a/source/rasterizer/xbox/shader_transparent_chicago_preprocessor.c +++ b/source/rasterizer/xbox/shader_transparent_chicago_preprocessor.c @@ -83,10 +83,6 @@ static boolean shader_map_verify( struct shader_transparent_chicago_map *map, short map_index); -boolean shader_transparent_chicago_create( - struct shader *shader, - struct pixel_shader_definition *pixel_shader); - /* ---------- globals */ static const struct shader_transparent_chicago_combiner_table shader_transparent_chicago_combiner_table = diff --git a/source/rasterizer/xbox/shader_transparent_generic_preprocessor.c b/source/rasterizer/xbox/shader_transparent_generic_preprocessor.c index 8daa3f0c..c805cbd4 100644 --- a/source/rasterizer/xbox/shader_transparent_generic_preprocessor.c +++ b/source/rasterizer/xbox/shader_transparent_generic_preprocessor.c @@ -10,6 +10,7 @@ SHADER_TRANSPARENT_GENERIC_PREPROCESSOR.C #include "bitmaps/bitmap_color_conversion.h" #include "shaders/shader_definitions.h" #include "tag_files/tag_groups.h" +#include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" /* ---------- constants */ @@ -78,28 +79,6 @@ enum /* ---------- structures */ -struct pixel_shader_definition -{ - unsigned long alpha_inputs[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long final_combiner_inputs_abcd; - unsigned long final_combiner_inputs_efg; - unsigned long constant_0[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long constant_1[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long alpha_outputs[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long rgb_inputs[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long compare_mode; - unsigned long final_combiner_constant_0; - unsigned long final_combiner_constant_1; - unsigned long rgb_outputs[NUMBER_OF_PIXEL_SHADER_STAGES]; - unsigned long combiner_count; - unsigned long texture_modes; - unsigned long dot_mapping; - unsigned long input_texture; - unsigned long c0_mapping; - unsigned long c1_mapping; - unsigned long final_combiner_constants; -}; - struct shader_transparent_generic_map { word flags; diff --git a/source/render/render.c b/source/render/render.c index e37508e0..0cd0acb0 100644 --- a/source/render/render.c +++ b/source/render/render.c @@ -60,12 +60,15 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "cseries/errors.h" #include "render.h" #include "render_cameras_internal.h" #include "render_particles.h" #include "objects.h" +#include "render_sprite.h" #include "scenario.h" #include "structure_bsp_definitions.h" +#include "effects/player_effects.h" #include "structures/structure_visibility.h" #include "rasterizer.h" #include "rasterizer/rasterizer_lights.h" @@ -83,6 +86,7 @@ symbols in this file: #include "effects/particle_systems.h" #include "effects/weather_particle_systems.h" #include "main/main.h" +#include "structures/structures.h" /* ---------- constants */ @@ -130,28 +134,8 @@ static void render_player_frame( struct render_window *window, const point2d *screenshot_combined_index); -void structure_get_planar_fog( - short cluster_index, - struct render_fog *fog); -void player_effect_get_screen_flash( - short local_player_index, - struct render_screen_flash *screen_flash); -void build_sprite_prepare_for_window( - void); void render_sky( void); -void render_objects( - void); -void render_object_shadows( - void); -void rasterizer_transparent_geometry_stop( - void); -void rasterizer_debug_draw( - void); -void render_debug( - void); -void progress_bar_eachframe( - void); /* ---------- globals */ diff --git a/source/render/render.h b/source/render/render.h index 09ede28b..02e28826 100644 --- a/source/render/render.h +++ b/source/render/render.h @@ -142,6 +142,13 @@ void render_objects_dispose_from_old_map( void); void render_objects_dispose( void); +struct render_lighting *object_get_cached_render_lighting( + long object_index, + real level_of_detail_pixels); +void render_objects( + void); +void render_object_shadows( + void); /* ---------- globals */ diff --git a/source/render/render_contrails.c b/source/render/render_contrails.c index 575dafd7..4a6620ac 100644 --- a/source/render/render_contrails.c +++ b/source/render/render_contrails.c @@ -25,6 +25,7 @@ symbols in this file: /* ---------- headers */ #include "cseries.h" +#include "cache/texture_cache.h" #include "effects/contrail_definitions.h" #include "effects/contrails.h" #include "bitmaps/bitmap_group.h" @@ -75,15 +76,6 @@ static void render_contrail( struct contrail_definition *definition, short instance_index); -struct bitmap_data *bitmap_group_get_bitmap_from_sequence( - long bitmap_group_index, - short sequence_index, - short frame_index); -void *_texture_cache_bitmap_get_hardware_format( - struct bitmap_data *bitmap, - boolean block, - boolean load); - real contrail_fade( struct contrail_definition *definition, short fade_mode, diff --git a/source/render/render_debug.c b/source/render/render_debug.c index 7ac17976..803edaeb 100644 --- a/source/render/render_debug.c +++ b/source/render/render_debug.c @@ -155,7 +155,6 @@ symbols in this file: #include "physics/collision_usage.h" #include "physics/collisions.h" #include "rasterizer/rasterizer.h" -#include "rasterizer/rasterizer_debug.h" #include "render/render.h" #include "render/render_cameras_internal.h" #include "render/render_debug.h" diff --git a/source/render/render_debug_geometry.h b/source/render/render_debug_geometry.h index cc0a5f20..f5949740 100644 --- a/source/render/render_debug_geometry.h +++ b/source/render/render_debug_geometry.h @@ -23,22 +23,10 @@ void render_debug_quadrilateral( real_point3d const *point2, real_point3d const *point3, real_argb_color const *color); -void render_debug_box( - boolean immediate, - real_rectangle3d const *bounds, - real_argb_color const *color); void render_debug_box2d_outline( boolean immediate, real_rectangle2d const *bounds, real_argb_color const *color); -void render_debug_polygon( - real_point3d const *points, - short point_count, - real_argb_color const *color); -void render_debug_polygon_edges( - real_point3d const *points, - short point_count, - real_argb_color const *color); void render_debug_point2d( boolean immediate, real_plane3d const *plane, diff --git a/source/render/render_objects.c b/source/render/render_objects.c index 7615000a..7e5f7074 100644 --- a/source/render/render_objects.c +++ b/source/render/render_objects.c @@ -90,7 +90,9 @@ symbols in this file: #include "math/real_math.h" #include "bitmaps/bitmaps.h" #include "render/render.h" -#include "render/render_objects.h" +#include "camera/camera_scripting.h" +#include "editor/editor_stubs.h" +#include "rasterizer/rasterizer.h" #include "render/render_cameras_internal.h" #include "render/render_debug.h" #include "objects/objects.h" @@ -108,6 +110,7 @@ symbols in this file: #include "cutscene/cinematics.h" #include "tag_files/tag_files.h" #include "saved games/game_state.h" +#include "rasterizer/rasterizer_console_vars.h" /* ---------- constants */ @@ -197,12 +200,6 @@ struct render_object_globals long rendered_object_indices[MAXIMUM_RENDERED_OBJECTS]; }; -struct rasterizer_debug_options -{ - byte unused00[0xE]; - boolean draw_first_person_weapon_first; -}; - typedef char render_model_effect_size_assert[ sizeof(struct render_model_effect) == 0x28 ? 1 : -1]; typedef char object_render_data_size_assert[ @@ -259,8 +256,6 @@ static void render_object( static void process_rendered_objects( struct object_render_data *data); -boolean scripted_camera_object_is_first_person_camera( - long object_index); short structure_visibility_find_objects( long *object_indices, short maximum_object_count, @@ -269,27 +264,7 @@ short structure_visibility_find_objects( void (*get_bounding_sphere_function)(long object_index, real_point3d *center, real *radius), boolean (*unmarked_function)(long object_index), boolean (*mark_function)(long object_index)); -void rasterizer_models_begin( - boolean sky); -void rasterizer_models_end( - void); -void rasterizer_environment_shadows_begin( - void); -void rasterizer_environment_shadows_end( - void); -boolean rasterizer_environment_shadow_begin( - long object_index, - real_matrix4x3 const *shadow_matrix, - union real_rgb_color const *shadow_color, - real object_bounding_radius, - real *shadow_bounding_radius); -void rasterizer_environment_shadow_end( - void); -boolean editor_preprocess_rendered_object( - long object_index, - struct render_lighting const *lighting); -extern struct rasterizer_debug_options rasterizer_debug_options; extern boolean debug_objects; extern short debug_rasterizer_light_count; diff --git a/source/render/render_objects.h b/source/render/render_objects.h deleted file mode 100644 index 85b95531..00000000 --- a/source/render/render_objects.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -RENDER_OBJECTS.H -*/ - -#ifndef __RENDER_OBJECTS_H -#define __RENDER_OBJECTS_H -#pragma once - -/* ---------- headers */ - -#include "cseries.h" - -/* ---------- structures */ - -struct render_lighting; - -/* ---------- prototypes/RENDER_OBJECTS.C */ - -void render_objects_initialize( - void); -void render_objects_initialize_for_new_map( - void); -void render_objects_dispose_from_old_map( - void); -void render_objects_dispose( - void); -struct render_lighting *object_get_cached_render_lighting( - long object_index, - real level_of_detail_pixels); -void render_objects( - void); -void render_object_shadows( - void); - -#endif // __RENDER_OBJECTS_H diff --git a/source/render/render_sky.c b/source/render/render_sky.c index 06feea95..5b63b290 100644 --- a/source/render/render_sky.c +++ b/source/render/render_sky.c @@ -24,7 +24,9 @@ symbols in this file: #include "models/model_animation_definitions.h" #include "models/model_definitions.h" #include "models/models.h" +#include "objects/object_lights.h" #include "objects/objects.h" +#include "rasterizer/rasterizer.h" #include "scenario/scenario.h" /* ---------- constants */ @@ -73,17 +75,6 @@ typedef char verify_sky_render_lighting_size[sizeof(struct render_lighting) == 0 /* ---------- prototypes */ -void lights_queue_lens_flare( - long lens_flare_index, - real_point3d const *position, - real_vector3d const *forward, - real_vector3d const *up, - real_rgb_color const *color, - real scale); -void rasterizer_models_begin( - boolean sky_mode); -void rasterizer_models_end( - void); /* ---------- globals */ static real render_sky_globals[MAXIMUM_SKIES_PER_SCENARIO] = {0.f}; diff --git a/source/render/render_sprite.c b/source/render/render_sprite.c index e7e0cbad..952ed427 100644 --- a/source/render/render_sprite.c +++ b/source/render/render_sprite.c @@ -86,6 +86,7 @@ symbols in this file: #include "render/render_cameras_internal.h" #include "render/render_debug.h" #include "render/render_sprite.h" +#include "cache/texture_cache.h" #include "tag_files/tag_files.h" #include "tag_files/tag_groups.h" @@ -152,11 +153,6 @@ typedef char build_sprite_globals_data_size_assert[ /* ---------- prototypes */ -void *_texture_cache_bitmap_get_hardware_format( - struct bitmap_data *bitmap, - boolean block, - boolean load); - static void build_sprite_transform_origin_and_direction( struct build_sprite_data const *data, unsigned long flags, diff --git a/source/scenario/scenario.c b/source/scenario/scenario.c index 6d388742..19d616d6 100644 --- a/source/scenario/scenario.c +++ b/source/scenario/scenario.c @@ -168,13 +168,17 @@ symbols in this file: #include "bink/bink_playback.h" #include "cache/cache_files.h" #include "cseries/errors.h" +#include "effects/contrails.h" +#include "effects/decals.h" #include "effects/effects.h" #include "effects/material_effect_definitions.h" #include "effects/particle_systems.h" +#include "effects/particles.h" #include "game/game_globals.h" #include "game/players.h" #include "camera/observer.h" #include "main/main.h" +#include "objects/object_lights.h" #include "objects/objects.h" #include "physics/bsp3d.h" #include "physics/collision_usage.h" @@ -187,6 +191,7 @@ symbols in this file: #include "render/render_debug.h" #include "scenario/wind.h" #include "sound/sound_definitions.h" +#include "sound/sound_manager.h" #include "structures/structure_bsp_definitions.h" #include "units/units.h" @@ -217,40 +222,6 @@ void _ReadWriteBarrier( void); #pragma intrinsic(_ReadWriteBarrier) -void objects_reconnect_to_structure_bsp( - void); -void lights_reconnect_to_structure_bsp( - void); -void particles_reconnect_to_structure_bsp( - void); -void contrails_reconnect_to_structure_bsp( - void); -void decals_reconnect_to_structure_bsp( - void); -void structure_decals_reconnect_to_structure_bsp( - void); -void players_reconnect_to_structure_bsp( - void); -void sound_reconnect_to_structure_bsp( - void); -void object_types_reconnect_to_structure_bsp( - void); - -void object_types_disconnect_from_structure_bsp( - void); -void objects_disconnect_from_structure_bsp( - void); -void lights_disconnect_from_structure_bsp( - void); -void particles_disconnect_from_structure_bsp( - void); -void contrails_disconnect_from_structure_bsp( - void); -void structure_decals_disconnect_from_structure_bsp( - void); -void decals_disconnect_from_structure_bsp( - void); - typedef void (*scenario_structure_bsp_connection_proc)( void); @@ -315,7 +286,7 @@ struct game_globals *global_game_globals; /* ---------- public code */ -void scenario_call_disconnect_from_structure_bsp_procs( +static void scenario_call_disconnect_from_structure_bsp_procs( void) { short proc_index; @@ -326,7 +297,7 @@ void scenario_call_disconnect_from_structure_bsp_procs( return; } -void scenario_call_reconnect_to_structure_bsp_procs( +static void scenario_call_reconnect_to_structure_bsp_procs( void) { short proc_index; @@ -1017,7 +988,6 @@ boolean scenario_switch_structure_bsp( { boolean result = FALSE; boolean had_old_structure_bsp; - short proc_index; struct scenario_structure_bsp_reference *reference; if (structure_bsp_index != global_structure_bsp_index && @@ -1036,8 +1006,7 @@ boolean scenario_switch_structure_bsp( if (global_structure_bsp_index != NONE) { - for (proc_index = 0; proc_index < NUMBEROF(scenario_structure_bsp_disconnect_proc_table); proc_index++) - scenario_structure_bsp_disconnect_procs[proc_index](); + scenario_call_disconnect_from_structure_bsp_procs(); had_old_structure_bsp = TRUE; scenario_structure_bsp_unload(TAG_BLOCK_GET_ELEMENT( @@ -1064,8 +1033,7 @@ boolean scenario_switch_structure_bsp( if (had_old_structure_bsp) { - for (proc_index = 0; proc_index < NUMBEROF(scenario_structure_bsp_reconnect_proc_table); proc_index++) - scenario_structure_bsp_reconnect_procs[proc_index](); + scenario_call_reconnect_to_structure_bsp_procs(); } result = TRUE; } diff --git a/source/scenario/wind.h b/source/scenario/wind.h index b59d23f0..5a00226e 100644 --- a/source/scenario/wind.h +++ b/source/scenario/wind.h @@ -15,16 +15,6 @@ WIND.H /* ---------- prototypes/WIND.C */ -boolean scenario_get_current( - struct location const *location, - real_point3d const *position, - real_vector3d *current, - long flags); -void scenario_get_current_from_weather_palette( - real_point3d const *position, - real_vector3d *current, - long flags, - short weather_palette_index); void wind_dispose_from_old_map( void); void wind_initialize_for_new_map( diff --git a/source/shell/shell_xbox.c b/source/shell/shell_xbox.c index 0144e4ba..02695dec 100644 --- a/source/shell/shell_xbox.c +++ b/source/shell/shell_xbox.c @@ -35,15 +35,13 @@ symbols in this file: #include "shell.h" #include "physical_memory_map.h" #include "main.h" +#include "rasterizer/xbox/rasterizer_xbox.h" /* ---------- prototypes */ static void fuck_code_in_the_eye( void); -void rasterizer_preinitialize__fill_you_up_with_the_devils_cock( - void); - /* ---------- globals */ static char faked_xbox_command_line[8] = { 0 }; diff --git a/source/sound/sound_classes.c b/source/sound/sound_classes.c index 585d3356..f519b788 100644 --- a/source/sound/sound_classes.c +++ b/source/sound/sound_classes.c @@ -138,9 +138,6 @@ typedef char verify_sound_class_definition_size[ /* ---------- prototypes */ -struct sound_class_definition *sound_class_get( - short sound_class); - /* ---------- globals */ extern struct sound_class_runtime *sound_class_data; diff --git a/source/sound/sound_classes.h b/source/sound/sound_classes.h index d3c615d9..e58d5d5c 100644 --- a/source/sound/sound_classes.h +++ b/source/sound/sound_classes.h @@ -64,6 +64,13 @@ struct sound_class_definition *sound_class_get( real sound_class_get_gain( short class_index); +void debug_sound_classes_enable( + char const *name, + boolean enable); +void debug_sound_classes_set_distances( + char const *name, + real minimum_distance, + real maximum_distance); void sound_class_set_gain( char const *name, real gain, @@ -75,6 +82,9 @@ void sound_classes_dispose( void); void sound_classes_update( long ticks); +void debug_sound_classes_set_wet( + char const *name, + real wet); /* ---------- globals */ diff --git a/source/sound/sound_manager.c b/source/sound/sound_manager.c index d70f3d27..b7f00fa2 100644 --- a/source/sound/sound_manager.c +++ b/source/sound/sound_manager.c @@ -249,7 +249,6 @@ symbols in this file: enum { MAXIMUM_SOUND_CHANNELS = 256, - MAXIMUM_NUMBER_OF_LOCAL_PLAYERS = 4, MAXIMUM_SOUND_CALLBACK_DATA = 0x30, }; diff --git a/source/sound/sound_manager.h b/source/sound/sound_manager.h index a4ce38b6..113aa8e1 100644 --- a/source/sound/sound_manager.h +++ b/source/sound/sound_manager.h @@ -36,6 +36,8 @@ boolean sound_valid_for_channel( void sound_dispose( void); +void sound_enable( + boolean enable); void sound_initialize( void); diff --git a/source/sound/sound_scenery.h b/source/sound/sound_scenery.h index 57b2b203..6a40d470 100644 --- a/source/sound/sound_scenery.h +++ b/source/sound/sound_scenery.h @@ -22,6 +22,11 @@ header included in hcex build. /* ---------- prototypes/EXAMPLE.C */ +boolean sound_scenery_new( + long object_index); +void sound_scenery_delete( + long object_index); + /* ---------- globals */ /* ---------- public code */ diff --git a/source/structures/leaf_map.c b/source/structures/leaf_map.c index 6ee6beb5..432303dd 100644 --- a/source/structures/leaf_map.c +++ b/source/structures/leaf_map.c @@ -140,6 +140,7 @@ symbols in this file: #include "cseries/profile.h" #include "physics/bsp3d.h" #include "math/geometry.h" +#include "render/render_debug.h" #include "render/render_debug_geometry.h" /* ---------- constants */ diff --git a/source/structures/structure_visibility.c b/source/structures/structure_visibility.c index 4832dff3..7ada088e 100644 --- a/source/structures/structure_visibility.c +++ b/source/structures/structure_visibility.c @@ -661,7 +661,7 @@ short structure_visibility_find_objects( long (*cluster_get_next)(long *iterator), void (*get_bounding_sphere)(long object_index, real_point3d *center, real *radius), boolean (*unmarked)(long object_index), - long (*mark)(long object_index)) + boolean (*mark)(long object_index)) { struct structure_bsp *structure = global_structure_bsp_get(); short found_count = 0; diff --git a/source/structures/structure_visibility.h b/source/structures/structure_visibility.h index dfb266ff..e3cff4b9 100644 --- a/source/structures/structure_visibility.h +++ b/source/structures/structure_visibility.h @@ -43,7 +43,7 @@ short structure_visibility_find_objects( long (*cluster_get_next)(long *iterator), void (*get_bounding_sphere)(long object_index, real_point3d *center, real *radius), boolean (*unmarked)(long object_index), - long (*mark)(long object_index)); + boolean (*mark)(long object_index)); boolean structure_visibility_find_mirror( struct render_camera const *camera, struct render_frustum const *frustum, diff --git a/source/structures/structures.c b/source/structures/structures.c index eef17d1f..780e17e3 100644 --- a/source/structures/structures.c +++ b/source/structures/structures.c @@ -65,7 +65,6 @@ symbols in this file: #include "physics/collisions.h" #include "physics/collision_usage.h" #include "rasterizer/rasterizer.h" -#include "rasterizer/rasterizer_debug.h" #include "rasterizer/rasterizer_geometry_environment.h" #include "render/render.h" #include "scenario/scenario.h" diff --git a/source/structures/structures.h b/source/structures/structures.h index 33f902e9..c90ed0c4 100644 --- a/source/structures/structures.h +++ b/source/structures/structures.h @@ -73,6 +73,9 @@ short structure_clusters_in_cone( real cosine, short maximum_cluster_count, short *cluster_indices); +void structure_get_planar_fog( + short cluster_index, + struct render_fog *fog); short structure_clusters_in_sphere( short cluster_index, real_point3d const *position, diff --git a/source/units/bipeds.c b/source/units/bipeds.c index 7d3eb65d..caee40c6 100644 --- a/source/units/bipeds.c +++ b/source/units/bipeds.c @@ -238,7 +238,7 @@ symbols in this file: #include "cseries.h" #include "ai/ai_communication.h" #include "ai/ai_debug.h" -#include "ai/ai_runtime.h" +#include "ai/ai.h" #include "ai/actors.h" #include "cseries/errors.h" #include "cseries/profile.h" @@ -456,12 +456,6 @@ struct vehicle_runtime_datum } vehicle; }; -struct unit_animation_update_data -{ - char state_desired; - boolean crouching; -}; - struct scenario_object_datum { short palette_entry_index; diff --git a/source/units/unit_dialogue.c b/source/units/unit_dialogue.c index f614baef..d62e4145 100644 --- a/source/units/unit_dialogue.c +++ b/source/units/unit_dialogue.c @@ -81,7 +81,7 @@ symbols in this file: #include "ai/ai_communication.h" #include "ai/ai_debug.h" -#include "ai/ai_runtime.h" +#include "ai/ai.h" #include "ai/actors.h" #include "dialogue_definitions.h" #include "game/game.h" diff --git a/source/units/units.c b/source/units/units.c index 060a21fe..5162cdcf 100644 --- a/source/units/units.c +++ b/source/units/units.c @@ -651,20 +651,23 @@ symbols in this file: #include "dialogue_definitions.h" #include "unit_definitions.h" -#include "ai/actor_looking.h" +#include "math/real_math.h" #include "ai/actors.h" #include "ai/ai_debug.h" -#include "ai/ai_runtime.h" +#include "ai/ai.h" #include "bitmaps/bitmaps.h" #include "cseries/errors.h" #include "cseries/profile.h" +#include "devices/device_machines.h" #include "effects/effects.h" #include "effects/material_effect_definitions.h" #include "game/cheats.h" +#include "game/game_allegiance.h" #include "game/game_globals.h" #include "game/game_engine.h" #include "game/players.h" #include "hs/object_lists.h" +#include "interface/first_person_weapons.h" #include "items/equipment.h" #include "items/equipment_definitions.h" #include "items/projectiles.h" @@ -676,6 +679,7 @@ symbols in this file: #include "objects/damage.h" #include "objects/damage_effect_definitions.h" #include "objects/object_lights.h" +#include "physics/breakable_surfaces.h" #include "physics/collision_bsp.h" #include "physics/collision_models.h" #include "physics/collision_usage.h" @@ -817,15 +821,6 @@ struct unit_control_data typedef char unit_control_data_size_assert[ sizeof(struct unit_control_data) == 0x40 ? 1 : -1]; -struct unit_animation_update_data -{ - char state_desired; - boolean crouching; -}; - -typedef char unit_animation_update_data_size_assert[ - sizeof(struct unit_animation_update_data) == 0x2 ? 1 : -1]; - struct unit_initial_weapon { struct tag_reference weapon; @@ -852,18 +847,8 @@ typedef char game_globals_flaming_death_offset_check[ /* ---------- prototypes */ -void player_died( - long player_index); -void actor_died( - long actor_index); -void actor_swarm_unit_died( - long swarm_actor_index, - long unit_index); - void unit_detach_from_parent( long unit_index); -void unit_start_running_blindly( - long unit_index); void unit_start_flaming_to_death( long unit_index, long attacker_object_index); @@ -872,15 +857,6 @@ void unit_flame_to_death( boolean unit_unsuspecting( long unit_index, real_point3d const *point); -void unit_impact_melee_damage( - long unit_index, - long target_object_index, - short node_index, - short region_index, - short material_index, - real_point3d const *position, - real_vector3d const *object_normal, - struct location const *location); void unit_cause_melee_damage( long unit_index, boolean melee_hit, @@ -896,10 +872,6 @@ static char const *base_weapon_label_get(short base_weapon_index); static void unit_refresh_illumination(long unit_index); -void unit_animation_start_action( - long unit_index, - short action); - static boolean unit_euler_axis_doplan( struct unit_acceleration_plan *plan, real delta_time, @@ -965,21 +937,6 @@ static void unit_align_facing( long unit_index, real_vector2d const *alignment_vector); -void player_control_set_desired_weapon( - long unit_index, - short desired_weapon_index); -boolean ai_try_vehicle_eviction( - long actor_index, - long entering_unit_index, - boolean immediate); -void biped_stop_melee_attack( - long unit_index); -void first_person_weapon_message_from_unit( - long unit_index, - short message_type); -void weapon_stop_reload( - long weapon_index); - static short unit_weapon_next_index(long unit_index, short current_index, short delta); static void unit_ready_desired_weapon( long unit_index, @@ -1003,9 +960,6 @@ static boolean unit_set_or_test_seat_and_weapon_label( static boolean unit_animation_set_state( long unit_index, short new_state); -short unit_update_animation( - long unit_index, - struct unit_animation_update_data *data); static boolean unit_vectors_are_valid(long unit_index); static void unit_throw_grenade_release(long unit_index, boolean premature); @@ -1028,32 +982,8 @@ static void unit_running_blind(long unit_index, real_vector3d *run_vector); static boolean unit_integrated_night_vision_is_active(long unit_index); -boolean game_team_is_enemy( - short team_index0, - short team_index1); -void player_died( - long player_index); -void actor_died( - long actor_index); -void actor_swarm_unit_died( - long swarm_actor_index, - long unit_index); void unit_detach_from_parent( long unit_index); -void unit_exit_seat_end( - long unit_index); -void aiming_screen_apply( - struct animation const *animation, - struct animation_aiming_screen_bounds const *aiming_screen_bounds, - real yaw, - real pitch, - struct real_orientation *node_orientations); -void biped_exit_seat_end( - long biped_index, - long parent_unit_index); -short animation_choose_random_permutation( - long animation_graph_index, - short animation_index); extern char const *base_seat_labels[NUMBER_OF_UNIT_BASE_SEATS]; @@ -8658,16 +8588,6 @@ enum _collision_result_breakable_surface_bit = 3, }; -void breakable_surface_damage( - short breakable_surface_index, - struct damage_data *damage_data, - long seed_surface_index); -void machine_try_to_open_with_damage( - long machine_index); -void vehicle_accelerate( - long vehicle_index, - real_vector3d const *acceleration); - void unit_cause_player_melee_damage( long unit_index) { @@ -11697,4 +11617,3 @@ static boolean unit_integrated_night_vision_is_active( /* Verify the public seat-helper declaration without perturbing this legacy * translation unit's authenticated function-declaration order. */ -#include "vehicle_scripting.h" diff --git a/source/units/units.h b/source/units/units.h index f06325ca..20ca7cca 100644 --- a/source/units/units.h +++ b/source/units/units.h @@ -394,6 +394,15 @@ struct unit_animation struct animation_state external_animation; }; +struct unit_animation_update_data +{ + char state_desired; + boolean crouching; +}; + +typedef char unit_animation_update_data_size_assert[ + sizeof(struct unit_animation_update_data) == 0x2 ? 1 : -1]; + struct unit_speech_item { short priority; @@ -537,6 +546,9 @@ struct unit_control_data; void unit_control( long unit_index, struct unit_control_data const *control_data); +boolean unit_unsuspecting( + long unit_index, + real_point3d const *point); void units_initialize( void); long units_debug_get_next_unit( @@ -559,9 +571,15 @@ void unit_kill_no_statistics( long unit_index); void unit_delete( long unit_index); +void unit_handle_region_destroyed( + long object_index, + short region_index, + unsigned long damage_flags); void unit_exit_seat_end( long unit_index); void units_update(void); +void unit_export_function_values( + long object_index); short unit_get_zoom_level( long unit_index); @@ -574,6 +592,20 @@ void unit_persistent_control( long unit_index, long control_ticks, unsigned long persistent_control_flags); +boolean unit_get_seat_entrance_point( + long unit_index, + long parent_unit_index, + short seat_index, + real_point3d *entrance_point, + real_point3d *seat_point, + real_point3d *hint_point); +boolean unit_get_melee_range_and_ticks( + long unit_index, + boolean secondary, + short *melee_tick, + real *attack_time, + short *frame_count, + real *damage_time); boolean unit_can_see_point( long unit_index, real_point3d const *point, @@ -596,9 +628,16 @@ boolean unit_has_weapon_with_flag( long flag_index); long unit_scripting_unit_riders( long unit_index); +boolean unit_scripting_vehicle_test_seat_list( + long vehicle_index, + char const *seat_name, + long object_list_index); void unit_scripting_set_seat( long unit_index, char const *seat_label); +void unit_handle_deleted_object( + long object_index, + long deleted_object_index); boolean unit_update(long unit_index); @@ -661,6 +700,8 @@ long unit_scripting_unit_driver( long unit_index); long unit_scripting_unit_gunner( long unit_index); +void unit_detach_from_parent( + long unit_index); boolean unit_scripting_vehicle_test_seat( long vehicle_index, char const *seat_name, @@ -727,6 +768,9 @@ void scripting_magic_melee_attack( void); boolean unit_try_and_exit_seat( long unit_index); +short vehicle_scripting_unload( + long vehicle_index, + char const *seat_name); void unit_scripting_exit_vehicle( long unit_index); void unit_adjust_projectile_ray( @@ -736,6 +780,8 @@ void unit_adjust_projectile_ray( real *velocity, boolean adjust_origin, boolean use_aiming_vector); +void unit_render_debug( + long object_index); boolean unit_clip_to_aiming_bounds(long unit_index, real_vector3d *vector, boolean use_aiming_screen); long unit_inventory_get_weapon(long unit_index, short index); short unit_inventory_next_weapon( @@ -780,6 +826,8 @@ boolean unit_approve_weapon_swap( long weapon_index); boolean unit_solo_player_integrated_night_vision_is_active( void); +boolean unit_new( + long object_index); short unit_get_animation_frames_remaining( long unit_index, short *animation_state); @@ -789,6 +837,16 @@ short unit_find_nearby_seat( long unit_index, long target_unit_index, short *seat_index); +short vehicle_scripting_find_available_seats( + long vehicle_index, + char const *seat_substring_name, + short seat_desire_type, + short *seat_indices, + short maximum_seat_count); +short vehicle_scripting_load_magic( + long vehicle_index, + char const *seat_name, + long object_list_index); boolean unit_can_enter_seat( long unit_index, long target_unit_index, @@ -874,9 +932,16 @@ void unit_damage_aftermath( void unit_place( long unit_index, struct scenario_unit_datum const *scenario_unit); +void unit_scripting_enter_vehicle( + long unit_index, + long vehicle_index, + char const *seat_name); void unit_preprocess_node_orientations( long unit_index, struct real_orientation *node_orientations); +void unit_postprocess_node_matrices( + long object_index, + struct real_matrix4x3 *node_matrices); /* ---------- prototypes/UNIT_DIALOGUE.C */ @@ -911,11 +976,12 @@ boolean unit_make_damage_sound( boolean unit_scream( long unit_index, short scream_type); -struct unit_animation_update_data; - void unit_animation_start_action( long unit_index, short action); +void unit_handle_weapon_state_change( + long object_index, + short new_state); void unit_cause_player_melee_damage( long unit_index); short unit_update_animation( diff --git a/source/units/vehicle_scripting.h b/source/units/vehicle_scripting.h deleted file mode 100644 index aee50dbd..00000000 --- a/source/units/vehicle_scripting.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __VEHICLE_SCRIPTING_H -#define __VEHICLE_SCRIPTING_H - -short vehicle_scripting_find_available_seats( - long vehicle_index, - char const *seat_substring_name, - short seat_desire_type, - short *seat_indices, - short maximum_seat_count); - -#endif // __VEHICLE_SCRIPTING_H diff --git a/source/units/vehicles.c b/source/units/vehicles.c index d13f9b1f..86877966 100644 --- a/source/units/vehicles.c +++ b/source/units/vehicles.c @@ -255,7 +255,8 @@ struct physics_mass_point_definition struct vehicle_animation { - byte unused0[0x5c]; + struct animation_aiming_screen_bounds steering_screen_bounds; + long unused[0x11]; struct tag_block animations; struct tag_block suspensions; }; @@ -285,16 +286,6 @@ struct scenario_vehicle /* ---------- prototypes */ -void aiming_screen_apply( - struct animation const *animation, - struct vehicle_animation const *vehicle_animation, - real yaw, - real pitch, - struct real_orientation *node_orientations); -short unit_update_animation( - long unit_index, - void *update_data); - /* NOTE: code_001a5e50 and code_001a6290 are file statics in January, but they are not reconstructed yet. They are declared here rather than defined so that code_001a8800 can call them: January passes their arguments on the stack, and a @@ -1407,7 +1398,7 @@ void vehicle_preprocess_node_orientations( { aiming_screen_apply(TAG_BLOCK_GET_ELEMENT(&graph->animations, ((short *)animation->animations.address)[0], struct animation), - animation, vehicle->vehicle.turn, 0.0f, node_orientations); + &animation->steering_screen_bounds, vehicle->vehicle.turn, 0.0f, node_orientations); } if (animation->animations.count>1 @@ -2695,11 +2686,11 @@ boolean vehicle_update( animate: if (definition->unit.object.animation_graph.index!=NONE) { - byte animation_update[2]; + struct unit_animation_update_data data; - animation_update[0] = 0; - animation_update[1] = 0; - unit_update_animation(vehicle_index, animation_update); + data.state_desired = _unit_state_idle; + data.crouching = FALSE; + unit_update_animation(vehicle_index, &data); } { diff --git a/source/units/vehicles.h b/source/units/vehicles.h index fa6fc008..c56c6565 100644 --- a/source/units/vehicles.h +++ b/source/units/vehicles.h @@ -39,6 +39,10 @@ struct vehicle_runtime_datum; void vehicle_hover( long vehicle_index, boolean hover); +void vehicle_reset( + long object_index); +boolean vehicle_new( + long object_index); void vehicles_initialize( void); @@ -53,14 +57,25 @@ boolean vehicle_moving_near_any_player( boolean vehicle_stuck( long vehicle_index, real_vector3d *direction); +void vehicle_export_function_values( + long object_index); void vehicle_delete( long vehicle_index); +boolean vehicle_causes_collision_damage( + long vehicle_index); long vehicle_find_pathfinding_surface_index( long vehicle_index, real_point3d *position); +void vehicle_preprocess_node_orientations( + long object_index, + struct real_orientation *node_orientations); +boolean vehicle_update( + long object_index); void vehicle_accelerate( long vehicle_index, real_vector3d const *acceleration); +void vehicle_render_debug( + long object_index); /* ---------- globals */ diff --git a/tools/fixtures/rasterizer_frame_statistics_owner.c b/tools/fixtures/rasterizer_frame_statistics_owner.c index 703146ff..1128dfe8 100644 --- a/tools/fixtures/rasterizer_frame_statistics_owner.c +++ b/tools/fixtures/rasterizer_frame_statistics_owner.c @@ -1,5 +1,6 @@ /* January frame-statistics layout, linkage, and Models arithmetic contract. */ -#include "rasterizer/rasterizer_frame_statistics.h" +#include "cseries.h" +#include "rasterizer/rasterizer.h" #define FRAME_STATISTICS_FIELD(member) \ offsetof(struct rasterizer_frame_statistics_globals, member), \ @@ -14,10 +15,7 @@ unsigned long const rasterizer_frame_statistics_layout[] = FRAME_STATISTICS_FIELD(average_frames_per_second), FRAME_STATISTICS_FIELD(minimum_frames_per_second), FRAME_STATISTICS_FIELD(maximum_frames_per_second), - FRAME_STATISTICS_FIELD(fogged_object_count), - FRAME_STATISTICS_FIELD(normal_object_count), - FRAME_STATISTICS_FIELD(fast_object_count), - FRAME_STATISTICS_FIELD(scenery_object_count), + FRAME_STATISTICS_FIELD(vertices_by_permutation), FRAME_STATISTICS_FIELD(lightmap_dynamic_vertex_count), FRAME_STATISTICS_FIELD(lightmap_dynamic_triangle_count), FRAME_STATISTICS_FIELD(lightmap_dynamic_draw_count), @@ -119,10 +117,7 @@ static void frame_statistics_expect_unsigned( void rasterizer_frame_statistics_type_contract( struct rasterizer_frame_statistics_globals *statistics) { - EXPECT_SIGNED(fogged_object_count); - EXPECT_SIGNED(normal_object_count); - EXPECT_SIGNED(fast_object_count); - EXPECT_SIGNED(scenery_object_count); + EXPECT_SIGNED(vertices_by_permutation[0]); EXPECT_UNSIGNED(lightmap_dynamic_vertex_count); EXPECT_UNSIGNED(lightmap_dynamic_triangle_count); EXPECT_UNSIGNED(lightmap_dynamic_draw_count); diff --git a/tools/fixtures/rasterizer_shared_state.c b/tools/fixtures/rasterizer_shared_state.c index 78eae3ca..5d46b6f1 100644 --- a/tools/fixtures/rasterizer_shared_state.c +++ b/tools/fixtures/rasterizer_shared_state.c @@ -1,177 +1,177 @@ /* January debug-state offsets and the Xbox pixel-shader ABI. */ -#include "rasterizer/rasterizer_debug_options.h" +#include "rasterizer/rasterizer_console_vars.h" #include "rasterizer/xbox/rasterizer_xbox_pixel_shader.h" #include unsigned long const rasterizer_debug_options_layout[] = { - sizeof(struct rasterizer_debug_options_definition), - offsetof(struct rasterizer_debug_options_definition, fps_accumulation), - sizeof(((struct rasterizer_debug_options_definition *)0)->fps_accumulation), - offsetof(struct rasterizer_debug_options_definition, pad01), - sizeof(((struct rasterizer_debug_options_definition *)0)->pad01), - offsetof(struct rasterizer_debug_options_definition, stats), - sizeof(((struct rasterizer_debug_options_definition *)0)->stats), - offsetof(struct rasterizer_debug_options_definition, mode), - sizeof(((struct rasterizer_debug_options_definition *)0)->mode), - offsetof(struct rasterizer_debug_options_definition, wireframe), - sizeof(((struct rasterizer_debug_options_definition *)0)->wireframe), - offsetof(struct rasterizer_debug_options_definition, debug_model_vertices), - sizeof(((struct rasterizer_debug_options_definition *)0)->debug_model_vertices), - offsetof(struct rasterizer_debug_options_definition, debug_model_lod), - sizeof(((struct rasterizer_debug_options_definition *)0)->debug_model_lod), - offsetof(struct rasterizer_debug_options_definition, debug_transparents), - sizeof(((struct rasterizer_debug_options_definition *)0)->debug_transparents), - offsetof(struct rasterizer_debug_options_definition, debug_meter_shader), - sizeof(((struct rasterizer_debug_options_definition *)0)->debug_meter_shader), - offsetof(struct rasterizer_debug_options_definition, models), - sizeof(((struct rasterizer_debug_options_definition *)0)->models), - offsetof(struct rasterizer_debug_options_definition, model_transparents), - sizeof(((struct rasterizer_debug_options_definition *)0)->model_transparents), - offsetof(struct rasterizer_debug_options_definition, draw_first_person_weapon_first), - sizeof(((struct rasterizer_debug_options_definition *)0)->draw_first_person_weapon_first), - offsetof(struct rasterizer_debug_options_definition, stencil_mask), - sizeof(((struct rasterizer_debug_options_definition *)0)->stencil_mask), - offsetof(struct rasterizer_debug_options_definition, environment), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment), - offsetof(struct rasterizer_debug_options_definition, environment_lightmaps), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_lightmaps), - offsetof(struct rasterizer_debug_options_definition, environment_shadows), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_shadows), - offsetof(struct rasterizer_debug_options_definition, environment_diffuse_lights), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_diffuse_lights), - offsetof(struct rasterizer_debug_options_definition, environment_diffuse_textures), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_diffuse_textures), - offsetof(struct rasterizer_debug_options_definition, environment_decals), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_decals), - offsetof(struct rasterizer_debug_options_definition, environment_specular_lights), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_specular_lights), - offsetof(struct rasterizer_debug_options_definition, environment_specular_lightmaps), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_specular_lightmaps), - offsetof(struct rasterizer_debug_options_definition, environment_reflection_lightmap_mask), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_reflection_lightmap_mask), - offsetof(struct rasterizer_debug_options_definition, environment_reflection_mirrors), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_reflection_mirrors), - offsetof(struct rasterizer_debug_options_definition, environment_reflections), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_reflections), - offsetof(struct rasterizer_debug_options_definition, environment_transparents), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_transparents), - offsetof(struct rasterizer_debug_options_definition, environment_fog), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_fog), - offsetof(struct rasterizer_debug_options_definition, environment_fog_screen), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_fog_screen), - offsetof(struct rasterizer_debug_options_definition, water), - sizeof(((struct rasterizer_debug_options_definition *)0)->water), - offsetof(struct rasterizer_debug_options_definition, lens_flares), - sizeof(((struct rasterizer_debug_options_definition *)0)->lens_flares), - offsetof(struct rasterizer_debug_options_definition, dynamic_unlit_geometry), - sizeof(((struct rasterizer_debug_options_definition *)0)->dynamic_unlit_geometry), - offsetof(struct rasterizer_debug_options_definition, dynamic_lit_geometry), - sizeof(((struct rasterizer_debug_options_definition *)0)->dynamic_lit_geometry), - offsetof(struct rasterizer_debug_options_definition, dynamic_screen_geometry), - sizeof(((struct rasterizer_debug_options_definition *)0)->dynamic_screen_geometry), - offsetof(struct rasterizer_debug_options_definition, hud_motion_sensor), - sizeof(((struct rasterizer_debug_options_definition *)0)->hud_motion_sensor), - offsetof(struct rasterizer_debug_options_definition, detail_objects), - sizeof(((struct rasterizer_debug_options_definition *)0)->detail_objects), - offsetof(struct rasterizer_debug_options_definition, debug_geometry), - sizeof(((struct rasterizer_debug_options_definition *)0)->debug_geometry), - offsetof(struct rasterizer_debug_options_definition, debug_geometry_multipass), - sizeof(((struct rasterizer_debug_options_definition *)0)->debug_geometry_multipass), - offsetof(struct rasterizer_debug_options_definition, fog_atmosphere), - sizeof(((struct rasterizer_debug_options_definition *)0)->fog_atmosphere), - offsetof(struct rasterizer_debug_options_definition, fog_plane), - sizeof(((struct rasterizer_debug_options_definition *)0)->fog_plane), - offsetof(struct rasterizer_debug_options_definition, bump_mapping), - sizeof(((struct rasterizer_debug_options_definition *)0)->bump_mapping), - offsetof(struct rasterizer_debug_options_definition, pad2A), - sizeof(((struct rasterizer_debug_options_definition *)0)->pad2A), - offsetof(struct rasterizer_debug_options_definition, lightmap_ambient), - sizeof(((struct rasterizer_debug_options_definition *)0)->lightmap_ambient), - offsetof(struct rasterizer_debug_options_definition, reserved30), - sizeof(((struct rasterizer_debug_options_definition *)0)->reserved30), - offsetof(struct rasterizer_debug_options_definition, pad3), - sizeof(((struct rasterizer_debug_options_definition *)0)->pad3), - offsetof(struct rasterizer_debug_options_definition, lightmaps_incident_radiosity), - sizeof(((struct rasterizer_debug_options_definition *)0)->lightmaps_incident_radiosity), - offsetof(struct rasterizer_debug_options_definition, lightmaps_filtering), - sizeof(((struct rasterizer_debug_options_definition *)0)->lightmaps_filtering), - offsetof(struct rasterizer_debug_options_definition, pad36), - sizeof(((struct rasterizer_debug_options_definition *)0)->pad36), - offsetof(struct rasterizer_debug_options_definition, model_lighting_ambient), - sizeof(((struct rasterizer_debug_options_definition *)0)->model_lighting_ambient), - offsetof(struct rasterizer_debug_options_definition, environment_alpha_testing), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_alpha_testing), - offsetof(struct rasterizer_debug_options_definition, environment_specular_mask), - sizeof(((struct rasterizer_debug_options_definition *)0)->environment_specular_mask), - offsetof(struct rasterizer_debug_options_definition, shadows_convolution), - sizeof(((struct rasterizer_debug_options_definition *)0)->shadows_convolution), - offsetof(struct rasterizer_debug_options_definition, shadows_debug), - sizeof(((struct rasterizer_debug_options_definition *)0)->shadows_debug), - offsetof(struct rasterizer_debug_options_definition, water_mipmapping), - sizeof(((struct rasterizer_debug_options_definition *)0)->water_mipmapping), - offsetof(struct rasterizer_debug_options_definition, active_camouflage), - sizeof(((struct rasterizer_debug_options_definition *)0)->active_camouflage), - offsetof(struct rasterizer_debug_options_definition, active_camouflage_multipass), - sizeof(((struct rasterizer_debug_options_definition *)0)->active_camouflage_multipass), - offsetof(struct rasterizer_debug_options_definition, plasma_energy), - sizeof(((struct rasterizer_debug_options_definition *)0)->plasma_energy), - offsetof(struct rasterizer_debug_options_definition, lens_flares_occlusion), - sizeof(((struct rasterizer_debug_options_definition *)0)->lens_flares_occlusion), - offsetof(struct rasterizer_debug_options_definition, lens_flares_occlusion_debug), - sizeof(((struct rasterizer_debug_options_definition *)0)->lens_flares_occlusion_debug), - offsetof(struct rasterizer_debug_options_definition, ray_of_buddha), - sizeof(((struct rasterizer_debug_options_definition *)0)->ray_of_buddha), - offsetof(struct rasterizer_debug_options_definition, screen_flashes), - sizeof(((struct rasterizer_debug_options_definition *)0)->screen_flashes), - offsetof(struct rasterizer_debug_options_definition, screen_effects), - sizeof(((struct rasterizer_debug_options_definition *)0)->screen_effects), - offsetof(struct rasterizer_debug_options_definition, DXTC_noise), - sizeof(((struct rasterizer_debug_options_definition *)0)->DXTC_noise), - offsetof(struct rasterizer_debug_options_definition, soft_filter), - sizeof(((struct rasterizer_debug_options_definition *)0)->soft_filter), - offsetof(struct rasterizer_debug_options_definition, secondary_render_target_debug), - sizeof(((struct rasterizer_debug_options_definition *)0)->secondary_render_target_debug), - offsetof(struct rasterizer_debug_options_definition, profile_log), - sizeof(((struct rasterizer_debug_options_definition *)0)->profile_log), - offsetof(struct rasterizer_debug_options_definition, pad4D), - sizeof(((struct rasterizer_debug_options_definition *)0)->pad4D), - offsetof(struct rasterizer_debug_options_definition, detail_objects_offset_multiplier), - sizeof(((struct rasterizer_debug_options_definition *)0)->detail_objects_offset_multiplier), - offsetof(struct rasterizer_debug_options_definition, zbias), - sizeof(((struct rasterizer_debug_options_definition *)0)->zbias), - offsetof(struct rasterizer_debug_options_definition, zoffset), - sizeof(((struct rasterizer_debug_options_definition *)0)->zoffset), - offsetof(struct rasterizer_debug_options_definition, force_all_player_views_to_default_player), - sizeof(((struct rasterizer_debug_options_definition *)0)->force_all_player_views_to_default_player), - offsetof(struct rasterizer_debug_options_definition, safe_frame_bounds), - sizeof(((struct rasterizer_debug_options_definition *)0)->safe_frame_bounds), - offsetof(struct rasterizer_debug_options_definition, freeze_flying_camera), - sizeof(((struct rasterizer_debug_options_definition *)0)->freeze_flying_camera), - offsetof(struct rasterizer_debug_options_definition, zsprites), - sizeof(((struct rasterizer_debug_options_definition *)0)->zsprites), - offsetof(struct rasterizer_debug_options_definition, filthy_decal_fog_hack), - sizeof(((struct rasterizer_debug_options_definition *)0)->filthy_decal_fog_hack), - offsetof(struct rasterizer_debug_options_definition, smart), - sizeof(((struct rasterizer_debug_options_definition *)0)->smart), - offsetof(struct rasterizer_debug_options_definition, splitscreen_VB_optimization), - sizeof(((struct rasterizer_debug_options_definition *)0)->splitscreen_VB_optimization), - offsetof(struct rasterizer_debug_options_definition, profile_print_locks), - sizeof(((struct rasterizer_debug_options_definition *)0)->profile_print_locks), - offsetof(struct rasterizer_debug_options_definition, pad65), - sizeof(((struct rasterizer_debug_options_definition *)0)->pad65), - offsetof(struct rasterizer_debug_options_definition, profile_objectlock_time), - sizeof(((struct rasterizer_debug_options_definition *)0)->profile_objectlock_time), - offsetof(struct rasterizer_debug_options_definition, pad3_scale), - sizeof(((struct rasterizer_debug_options_definition *)0)->pad3_scale), - offsetof(struct rasterizer_debug_options_definition, f), - sizeof(((struct rasterizer_debug_options_definition *)0)->f), - offsetof(struct rasterizer_debug_options_definition, transparent_pixel_counter_active), - sizeof(((struct rasterizer_debug_options_definition *)0)->transparent_pixel_counter_active), - offsetof(struct rasterizer_debug_options_definition, transparent_pixel_counter), - sizeof(((struct rasterizer_debug_options_definition *)0)->transparent_pixel_counter), - offsetof(struct rasterizer_debug_options_definition, pad8A), - sizeof(((struct rasterizer_debug_options_definition *)0)->pad8A), + sizeof(struct rasterizer_debug_options), + offsetof(struct rasterizer_debug_options, fps_accumulation), + sizeof(((struct rasterizer_debug_options *)0)->fps_accumulation), + offsetof(struct rasterizer_debug_options, pad01), + sizeof(((struct rasterizer_debug_options *)0)->pad01), + offsetof(struct rasterizer_debug_options, statistics_mode), + sizeof(((struct rasterizer_debug_options *)0)->statistics_mode), + offsetof(struct rasterizer_debug_options, drawing_mode), + sizeof(((struct rasterizer_debug_options *)0)->drawing_mode), + offsetof(struct rasterizer_debug_options, wireframe_enabled), + sizeof(((struct rasterizer_debug_options *)0)->wireframe_enabled), + offsetof(struct rasterizer_debug_options, debug_model_vertices_enabled), + sizeof(((struct rasterizer_debug_options *)0)->debug_model_vertices_enabled), + offsetof(struct rasterizer_debug_options, debug_model_lod), + sizeof(((struct rasterizer_debug_options *)0)->debug_model_lod), + offsetof(struct rasterizer_debug_options, debug_transparent_geometry_enabled), + sizeof(((struct rasterizer_debug_options *)0)->debug_transparent_geometry_enabled), + offsetof(struct rasterizer_debug_options, debug_meter_shader_enabled), + sizeof(((struct rasterizer_debug_options *)0)->debug_meter_shader_enabled), + offsetof(struct rasterizer_debug_options, draw_models), + sizeof(((struct rasterizer_debug_options *)0)->draw_models), + offsetof(struct rasterizer_debug_options, draw_model_transparent_geometry), + sizeof(((struct rasterizer_debug_options *)0)->draw_model_transparent_geometry), + offsetof(struct rasterizer_debug_options, draw_first_person_weapon_first), + sizeof(((struct rasterizer_debug_options *)0)->draw_first_person_weapon_first), + offsetof(struct rasterizer_debug_options, stencil_mask_enabled), + sizeof(((struct rasterizer_debug_options *)0)->stencil_mask_enabled), + offsetof(struct rasterizer_debug_options, draw_environment), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment), + offsetof(struct rasterizer_debug_options, draw_environment_lightmaps), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_lightmaps), + offsetof(struct rasterizer_debug_options, draw_environment_shadows), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_shadows), + offsetof(struct rasterizer_debug_options, draw_environment_diffuse_lights), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_diffuse_lights), + offsetof(struct rasterizer_debug_options, draw_environment_textures), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_textures), + offsetof(struct rasterizer_debug_options, draw_environment_decals), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_decals), + offsetof(struct rasterizer_debug_options, draw_environment_specular_lights), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_specular_lights), + offsetof(struct rasterizer_debug_options, draw_environment_specular_lightmaps), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_specular_lightmaps), + offsetof(struct rasterizer_debug_options, draw_environment_reflection_lightmap_masks), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_reflection_lightmap_masks), + offsetof(struct rasterizer_debug_options, draw_environment_reflection_mirrors), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_reflection_mirrors), + offsetof(struct rasterizer_debug_options, draw_environment_reflections), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_reflections), + offsetof(struct rasterizer_debug_options, draw_environment_transparent_geometry), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_transparent_geometry), + offsetof(struct rasterizer_debug_options, draw_environment_fog), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_fog), + offsetof(struct rasterizer_debug_options, draw_environment_fog_screen), + sizeof(((struct rasterizer_debug_options *)0)->draw_environment_fog_screen), + offsetof(struct rasterizer_debug_options, draw_water), + sizeof(((struct rasterizer_debug_options *)0)->draw_water), + offsetof(struct rasterizer_debug_options, draw_lens_flares), + sizeof(((struct rasterizer_debug_options *)0)->draw_lens_flares), + offsetof(struct rasterizer_debug_options, draw_dynamic_unlit_geometry), + sizeof(((struct rasterizer_debug_options *)0)->draw_dynamic_unlit_geometry), + offsetof(struct rasterizer_debug_options, draw_dynamic_lit_geometry), + sizeof(((struct rasterizer_debug_options *)0)->draw_dynamic_lit_geometry), + offsetof(struct rasterizer_debug_options, draw_dynamic_screen_geometry), + sizeof(((struct rasterizer_debug_options *)0)->draw_dynamic_screen_geometry), + offsetof(struct rasterizer_debug_options, draw_hud_motion_sensor), + sizeof(((struct rasterizer_debug_options *)0)->draw_hud_motion_sensor), + offsetof(struct rasterizer_debug_options, draw_detail_objects), + sizeof(((struct rasterizer_debug_options *)0)->draw_detail_objects), + offsetof(struct rasterizer_debug_options, draw_debug_geometry), + sizeof(((struct rasterizer_debug_options *)0)->draw_debug_geometry), + offsetof(struct rasterizer_debug_options, debug_geometry_multipass), + sizeof(((struct rasterizer_debug_options *)0)->debug_geometry_multipass), + offsetof(struct rasterizer_debug_options, fog_atmospheric_enabled), + sizeof(((struct rasterizer_debug_options *)0)->fog_atmospheric_enabled), + offsetof(struct rasterizer_debug_options, fog_planar_enabled), + sizeof(((struct rasterizer_debug_options *)0)->fog_planar_enabled), + offsetof(struct rasterizer_debug_options, bump_mapping_enabled), + sizeof(((struct rasterizer_debug_options *)0)->bump_mapping_enabled), + offsetof(struct rasterizer_debug_options, pad2A), + sizeof(((struct rasterizer_debug_options *)0)->pad2A), + offsetof(struct rasterizer_debug_options, lightmap_ambient), + sizeof(((struct rasterizer_debug_options *)0)->lightmap_ambient), + offsetof(struct rasterizer_debug_options, _lightmap_mode), + sizeof(((struct rasterizer_debug_options *)0)->_lightmap_mode), + offsetof(struct rasterizer_debug_options, pad3), + sizeof(((struct rasterizer_debug_options *)0)->pad3), + offsetof(struct rasterizer_debug_options, lightmap_incident_radiosity_enabled), + sizeof(((struct rasterizer_debug_options *)0)->lightmap_incident_radiosity_enabled), + offsetof(struct rasterizer_debug_options, lightmap_filtering_enabled), + sizeof(((struct rasterizer_debug_options *)0)->lightmap_filtering_enabled), + offsetof(struct rasterizer_debug_options, pad36), + sizeof(((struct rasterizer_debug_options *)0)->pad36), + offsetof(struct rasterizer_debug_options, model_lighting_ambient), + sizeof(((struct rasterizer_debug_options *)0)->model_lighting_ambient), + offsetof(struct rasterizer_debug_options, environment_alpha_testing_enabled), + sizeof(((struct rasterizer_debug_options *)0)->environment_alpha_testing_enabled), + offsetof(struct rasterizer_debug_options, environment_specular_mask_enabled), + sizeof(((struct rasterizer_debug_options *)0)->environment_specular_mask_enabled), + offsetof(struct rasterizer_debug_options, shadow_convolution_enabled), + sizeof(((struct rasterizer_debug_options *)0)->shadow_convolution_enabled), + offsetof(struct rasterizer_debug_options, shadow_debug_enabled), + sizeof(((struct rasterizer_debug_options *)0)->shadow_debug_enabled), + offsetof(struct rasterizer_debug_options, water_mipmapping_enabled), + sizeof(((struct rasterizer_debug_options *)0)->water_mipmapping_enabled), + offsetof(struct rasterizer_debug_options, active_camouflage_enabled), + sizeof(((struct rasterizer_debug_options *)0)->active_camouflage_enabled), + offsetof(struct rasterizer_debug_options, active_camouflage_multipass_enabled), + sizeof(((struct rasterizer_debug_options *)0)->active_camouflage_multipass_enabled), + offsetof(struct rasterizer_debug_options, plasma_energy_enabled), + sizeof(((struct rasterizer_debug_options *)0)->plasma_energy_enabled), + offsetof(struct rasterizer_debug_options, lens_flare_occlusion_enabled), + sizeof(((struct rasterizer_debug_options *)0)->lens_flare_occlusion_enabled), + offsetof(struct rasterizer_debug_options, lens_flare_occlusion_debug), + sizeof(((struct rasterizer_debug_options *)0)->lens_flare_occlusion_debug), + offsetof(struct rasterizer_debug_options, lens_flare_sun_glow_enabled), + sizeof(((struct rasterizer_debug_options *)0)->lens_flare_sun_glow_enabled), + offsetof(struct rasterizer_debug_options, screen_flash_enabled), + sizeof(((struct rasterizer_debug_options *)0)->screen_flash_enabled), + offsetof(struct rasterizer_debug_options, screen_effects_enabled), + sizeof(((struct rasterizer_debug_options *)0)->screen_effects_enabled), + offsetof(struct rasterizer_debug_options, DXTC_noise_enabled), + sizeof(((struct rasterizer_debug_options *)0)->DXTC_noise_enabled), + offsetof(struct rasterizer_debug_options, soft_filter_enabled), + sizeof(((struct rasterizer_debug_options *)0)->soft_filter_enabled), + offsetof(struct rasterizer_debug_options, secondary_render_target_debug_enabled), + sizeof(((struct rasterizer_debug_options *)0)->secondary_render_target_debug_enabled), + offsetof(struct rasterizer_debug_options, profile_log_enabled), + sizeof(((struct rasterizer_debug_options *)0)->profile_log_enabled), + offsetof(struct rasterizer_debug_options, pad4D), + sizeof(((struct rasterizer_debug_options *)0)->pad4D), + offsetof(struct rasterizer_debug_options, detail_object_screen_facing_offset_multiplier), + sizeof(((struct rasterizer_debug_options *)0)->detail_object_screen_facing_offset_multiplier), + offsetof(struct rasterizer_debug_options, zbias), + sizeof(((struct rasterizer_debug_options *)0)->zbias), + offsetof(struct rasterizer_debug_options, zoffset), + sizeof(((struct rasterizer_debug_options *)0)->zoffset), + offsetof(struct rasterizer_debug_options, force_all_player_views_to_default_player), + sizeof(((struct rasterizer_debug_options *)0)->force_all_player_views_to_default_player), + offsetof(struct rasterizer_debug_options, safe_frame_bounds_adjust_enabled), + sizeof(((struct rasterizer_debug_options *)0)->safe_frame_bounds_adjust_enabled), + offsetof(struct rasterizer_debug_options, freeze_flying_camera), + sizeof(((struct rasterizer_debug_options *)0)->freeze_flying_camera), + offsetof(struct rasterizer_debug_options, zsprite_enabled), + sizeof(((struct rasterizer_debug_options *)0)->zsprite_enabled), + offsetof(struct rasterizer_debug_options, filthy_decal_fog_hack_enabled), + sizeof(((struct rasterizer_debug_options *)0)->filthy_decal_fog_hack_enabled), + offsetof(struct rasterizer_debug_options, smart_states_enabled), + sizeof(((struct rasterizer_debug_options *)0)->smart_states_enabled), + offsetof(struct rasterizer_debug_options, splitscreen_VB_optimization_enabled), + sizeof(((struct rasterizer_debug_options *)0)->splitscreen_VB_optimization_enabled), + offsetof(struct rasterizer_debug_options, profile_print_locks), + sizeof(((struct rasterizer_debug_options *)0)->profile_print_locks), + offsetof(struct rasterizer_debug_options, pad65), + sizeof(((struct rasterizer_debug_options *)0)->pad65), + offsetof(struct rasterizer_debug_options, profile_objectlock_time), + sizeof(((struct rasterizer_debug_options *)0)->profile_objectlock_time), + offsetof(struct rasterizer_debug_options, pad3_scale), + sizeof(((struct rasterizer_debug_options *)0)->pad3_scale), + offsetof(struct rasterizer_debug_options, f), + sizeof(((struct rasterizer_debug_options *)0)->f), + offsetof(struct rasterizer_debug_options, transparent_pixel_counter_active), + sizeof(((struct rasterizer_debug_options *)0)->transparent_pixel_counter_active), + offsetof(struct rasterizer_debug_options, transparent_pixel_counter), + sizeof(((struct rasterizer_debug_options *)0)->transparent_pixel_counter), + offsetof(struct rasterizer_debug_options, pad8A), + sizeof(((struct rasterizer_debug_options *)0)->pad8A), }; unsigned long const rasterizer_pixel_shader_layout[] = diff --git a/tools/test_rasterizer_frame_statistics_owner.py b/tools/test_rasterizer_frame_statistics_owner.py index 9d7335c3..da784a84 100644 --- a/tools/test_rasterizer_frame_statistics_owner.py +++ b/tools/test_rasterizer_frame_statistics_owner.py @@ -15,8 +15,19 @@ from tools import coff_compare as cc ROOT = Path(__file__).resolve().parents[1] COMPILER = ROOT / "xbox/bin/vc7/CL.Exe" FIXTURE = ROOT / "tools/fixtures/rasterizer_frame_statistics_owner.c" -HEADER = ROOT / "source/rasterizer/rasterizer_frame_statistics.h" +HEADER = ROOT / "source/rasterizer/rasterizer.h" MODELS_SOURCE = ROOT / "source/rasterizer/xbox/rasterizer_xbox_models.c" +# The owner header rasterizer.h resolves its own includes through the build's source include directories +# (build.ninja cflags order). +SOURCE_INCLUDE_DIRECTORIES = ( + "source", "source/main", "source/cseries", "source/sound", "source/bink", "source/saved films", + "source/saved games", "source/cache", "source/units", "source/text", "source/tag_files", "source/structures", + "source/shell", "source/shaders", "source/scenario", "source/render", "source/rasterizer", "source/physics", + "source/objects", "source/objects/widgets", "source/networking", "source/models", "source/memory", + "source/memory/zlib", "source/math", "source/tool", "source/items", "source/interface", "source/input", "source/hs", + "source/game", "source/effects", "source/editor", "source/dialogs", "source/devices", "source/cutscene", + "source/camera", "source/bungie_net", "source/bitmaps", "source/ai", +) BASE_ROOT = ROOT / "build/base" TARGET_ROOT = ROOT / "build/split" SYMBOL = "_rasterizer_frame_statistics" @@ -30,10 +41,7 @@ FIELDS = ( ("average_frames_per_second", 0x008, 4, None), ("minimum_frames_per_second", 0x00C, 4, None), ("maximum_frames_per_second", 0x010, 4, None), - ("fogged_object_count", 0x014, 4, "signed"), - ("normal_object_count", 0x018, 4, "signed"), - ("fast_object_count", 0x01C, 4, "signed"), - ("scenery_object_count", 0x020, 4, "signed"), + ("vertices_by_permutation", 0x014, 0x10, "signed"), ("lightmap_dynamic_vertex_count", 0x024, 4, "unsigned"), ("lightmap_dynamic_triangle_count", 0x028, 4, "unsigned"), ("lightmap_dynamic_draw_count", 0x02C, 4, "unsigned"), @@ -137,7 +145,8 @@ def compile_fixture(output, override_root=None, check=True): include_roots = [] if override_root is not None: include_roots.append(Path(override_root)) - include_roots.extend((ROOT / "source", ROOT / "source/cseries", ROOT / "xbox/include")) + include_roots.extend(ROOT / directory for directory in SOURCE_INCLUDE_DIRECTORIES) + include_roots.append(ROOT / "xbox/include") command = [str(COMPILER), "/nologo", "/c", "/Dxbox", "/W1", "/WX"] command.extend("/I" + str(path) for path in include_roots) command.extend(("/Fo" + str(output), str(FIXTURE))) @@ -184,7 +193,7 @@ def require_layout(obj): def write_override(tmp_path, old, new): source = HEADER.read_text(encoding="utf-8") assert source.count(old) == 1 - override = tmp_path / "include/rasterizer/rasterizer_frame_statistics.h" + override = tmp_path / "include/rasterizer/rasterizer.h" override.parent.mkdir(parents=True) override.write_text(source.replace(old, new), encoding="utf-8") return override.parents[1] @@ -228,7 +237,7 @@ def test_source_has_one_extern_declaration_and_no_tentative_storage(): continue for match in pattern.finditer(path.read_text(encoding="utf-8", errors="replace")): records.append((path.relative_to(ROOT).as_posix(), bool(match.group(1)))) - assert records == [("source/rasterizer/rasterizer_frame_statistics.h", True)] + assert records == [("source/rasterizer/rasterizer.h", True)] def test_january_has_one_0x170_bss_owner_and_exact_importer_set(): @@ -273,19 +282,19 @@ def test_models_keeps_unsigned_delta_and_accumulator_contract(): assert body.count("unsigned long lighting_work;") == 1 assert body.count( "skinning_work = rasterizer_frame_statistics." - "skinning_work;") == 1 + "vertex_shader_skinning_constant_bytes;") == 1 assert body.count( "skinning_work = rasterizer_frame_statistics." - "skinning_work - skinning_work;") == 1 + "vertex_shader_skinning_constant_bytes - skinning_work;") == 1 assert body.count( "lighting_work = rasterizer_frame_statistics." - "lighting_work;") == 1 + "vertex_shader_lighting_constant_bytes;") == 1 assert body.count( - "rasterizer_frame_statistics.skinning_work_accumulated += " + "rasterizer_frame_statistics.model_skinning_constant_bytes += " "skinning_work;") == 1 assert body.count( - "rasterizer_frame_statistics.lighting_work_accumulated += " - "rasterizer_frame_statistics.lighting_work - " + "rasterizer_frame_statistics.model_lighting_constant_bytes += " + "rasterizer_frame_statistics.vertex_shader_lighting_constant_bytes - " "lighting_work;") == 1 diff --git a/tools/test_rasterizer_shared_state.py b/tools/test_rasterizer_shared_state.py index 30b33140..8362e1b1 100644 --- a/tools/test_rasterizer_shared_state.py +++ b/tools/test_rasterizer_shared_state.py @@ -12,79 +12,79 @@ COMPILER = ROOT / "xbox/bin/vc7/CL.Exe" DEBUG_FIELDS = [ ["fps_accumulation",0,1], ["pad01",1,1], - ["stats",2,2], - ["mode",4,2], - ["wireframe",6,1], - ["debug_model_vertices",7,1], + ["statistics_mode",2,2], + ["drawing_mode",4,2], + ["wireframe_enabled",6,1], + ["debug_model_vertices_enabled",7,1], ["debug_model_lod",8,2], - ["debug_transparents",10,1], - ["debug_meter_shader",11,1], - ["models",12,1], - ["model_transparents",13,1], + ["debug_transparent_geometry_enabled",10,1], + ["debug_meter_shader_enabled",11,1], + ["draw_models",12,1], + ["draw_model_transparent_geometry",13,1], ["draw_first_person_weapon_first",14,1], - ["stencil_mask",15,1], - ["environment",16,1], - ["environment_lightmaps",17,1], - ["environment_shadows",18,1], - ["environment_diffuse_lights",19,1], - ["environment_diffuse_textures",20,1], - ["environment_decals",21,1], - ["environment_specular_lights",22,1], - ["environment_specular_lightmaps",23,1], - ["environment_reflection_lightmap_mask",24,1], - ["environment_reflection_mirrors",25,1], - ["environment_reflections",26,1], - ["environment_transparents",27,1], - ["environment_fog",28,1], - ["environment_fog_screen",29,1], - ["water",30,1], - ["lens_flares",31,1], - ["dynamic_unlit_geometry",32,1], - ["dynamic_lit_geometry",33,1], - ["dynamic_screen_geometry",34,1], - ["hud_motion_sensor",35,1], - ["detail_objects",36,1], - ["debug_geometry",37,1], + ["stencil_mask_enabled",15,1], + ["draw_environment",16,1], + ["draw_environment_lightmaps",17,1], + ["draw_environment_shadows",18,1], + ["draw_environment_diffuse_lights",19,1], + ["draw_environment_textures",20,1], + ["draw_environment_decals",21,1], + ["draw_environment_specular_lights",22,1], + ["draw_environment_specular_lightmaps",23,1], + ["draw_environment_reflection_lightmap_masks",24,1], + ["draw_environment_reflection_mirrors",25,1], + ["draw_environment_reflections",26,1], + ["draw_environment_transparent_geometry",27,1], + ["draw_environment_fog",28,1], + ["draw_environment_fog_screen",29,1], + ["draw_water",30,1], + ["draw_lens_flares",31,1], + ["draw_dynamic_unlit_geometry",32,1], + ["draw_dynamic_lit_geometry",33,1], + ["draw_dynamic_screen_geometry",34,1], + ["draw_hud_motion_sensor",35,1], + ["draw_detail_objects",36,1], + ["draw_debug_geometry",37,1], ["debug_geometry_multipass",38,1], - ["fog_atmosphere",39,1], - ["fog_plane",40,1], - ["bump_mapping",41,1], + ["fog_atmospheric_enabled",39,1], + ["fog_planar_enabled",40,1], + ["bump_mapping_enabled",41,1], ["pad2A[2]",42,2], ["lightmap_ambient",44,4], - ["reserved30[2]",48,2], + ["_lightmap_mode",48,2], ["pad3",50,2], - ["lightmaps_incident_radiosity",52,1], - ["lightmaps_filtering",53,1], + ["lightmap_incident_radiosity_enabled",52,1], + ["lightmap_filtering_enabled",53,1], ["pad36[2]",54,2], ["model_lighting_ambient",56,4], - ["environment_alpha_testing",60,1], - ["environment_specular_mask",61,1], - ["shadows_convolution",62,1], - ["shadows_debug",63,1], - ["water_mipmapping",64,1], - ["active_camouflage",65,1], - ["active_camouflage_multipass",66,1], - ["plasma_energy",67,1], - ["lens_flares_occlusion",68,1], - ["lens_flares_occlusion_debug",69,1], - ["ray_of_buddha",70,1], - ["screen_flashes",71,1], - ["screen_effects",72,1], - ["DXTC_noise",73,1], - ["soft_filter",74,1], - ["secondary_render_target_debug",75,1], - ["profile_log",76,1], + ["environment_alpha_testing_enabled",60,1], + ["environment_specular_mask_enabled",61,1], + ["shadow_convolution_enabled",62,1], + ["shadow_debug_enabled",63,1], + ["water_mipmapping_enabled",64,1], + ["active_camouflage_enabled",65,1], + ["active_camouflage_multipass_enabled",66,1], + ["plasma_energy_enabled",67,1], + ["lens_flare_occlusion_enabled",68,1], + ["lens_flare_occlusion_debug",69,1], + ["lens_flare_sun_glow_enabled",70,1], + ["screen_flash_enabled",71,1], + ["screen_effects_enabled",72,1], + ["DXTC_noise_enabled",73,1], + ["soft_filter_enabled",74,1], + ["secondary_render_target_debug_enabled",75,1], + ["profile_log_enabled",76,1], ["pad4D[3]",77,3], - ["detail_objects_offset_multiplier",80,4], + ["detail_object_screen_facing_offset_multiplier",80,4], ["zbias",84,4], ["zoffset",88,4], ["force_all_player_views_to_default_player",92,1], - ["safe_frame_bounds",93,1], + ["safe_frame_bounds_adjust_enabled",93,1], ["freeze_flying_camera",94,2], - ["zsprites",96,1], - ["filthy_decal_fog_hack",97,1], - ["smart",98,1], - ["splitscreen_VB_optimization",99,1], + ["zsprite_enabled",96,1], + ["filthy_decal_fog_hack_enabled",97,1], + ["smart_states_enabled",98,1], + ["splitscreen_VB_optimization_enabled",99,1], ["profile_print_locks",100,1], ["pad65[3]",101,3], ["profile_objectlock_time",104,4],