From 5e43a8cbce4e224bfedded163c06e68d0b4c13f1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:51:25 +0000 Subject: [PATCH 001/657] overlay: name set_follow_camera_angle_parameter --- src/overlays/shared/camera/aim_volume_camera.c | 1 + src/overlays/shared/camera/swing_volume_camera.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/overlays/shared/camera/aim_volume_camera.c b/src/overlays/shared/camera/aim_volume_camera.c index 1bee69f9c8..8afea21fef 100644 --- a/src/overlays/shared/camera/aim_volume_camera.c +++ b/src/overlays/shared/camera/aim_volume_camera.c @@ -11,6 +11,7 @@ #include "rnc/overlay/shared/camera/swing_volume_camera.h" #include "rnc/overlay/shared/camera.h" #include "rnc/overlay/shared/camera/follow_camera_set_up_spring.h" +void set_follow_camera_angle_parameter(float) __asm__("FUN_L00_002e8540"); #include "rnc/overlay/shared/rendering/culling/test_point_in_transformed_unit_cylinder.h" #include "rnc/rendering/clip_volume.h" diff --git a/src/overlays/shared/camera/swing_volume_camera.c b/src/overlays/shared/camera/swing_volume_camera.c index 6366372c65..a03acb1e9a 100644 --- a/src/overlays/shared/camera/swing_volume_camera.c +++ b/src/overlays/shared/camera/swing_volume_camera.c @@ -12,6 +12,7 @@ #include "rnc/overlay/shared/camera/swing_volume_camera.h" #include "rnc/overlay/shared/camera.h" #include "rnc/overlay/shared/camera/follow_camera_set_up_spring.h" +void set_follow_camera_angle_parameter(float) __asm__("FUN_L00_002e8540"); #include "rnc/overlay/shared/rendering/culling/test_point_in_transformed_unit_cylinder.h" #include "rnc/rendering/clip_volume.h" From 6049f337bbfd5aff3374f351b90b63caadc495b3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:08:45 +0000 Subject: [PATCH 002/657] decomp: clarify names in hud_release_held_element D_L05_0015F978 -> l05_hud_release_counter: In the authoritative source hud_release_held_element unconditionally increments *(int *)&D_L05_0015F978 after releasing/resetting the animation parameter target and clearing D_L05_0015F97C. Retail 0x002642c4 loads the word at gp-0x7288, 0x002642cc adds one, and 0x002642dc stores it back; the branch at 0x002642ac targets 0x002642c4, so even calls with target -1 advance this release counter. The name describes that per-call counter role only, qualified for level-05 ownership; the short declaration and word-cast operations are preserved. --- src/overlays/shared/ui/hud/draw_trick_combo_hud.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/ui/hud/draw_trick_combo_hud.c b/src/overlays/shared/ui/hud/draw_trick_combo_hud.c index 6d008a29bc..7ef93f321e 100644 --- a/src/overlays/shared/ui/hud/draw_trick_combo_hud.c +++ b/src/overlays/shared/ui/hud/draw_trick_combo_hud.c @@ -18,7 +18,7 @@ extern int D_L05_0015F97C; #include "rnc/overlay/shared/ui/hud/draw_trick_combo_hud_data/hud_release_held_element.h" -extern short D_L05_0015F978 __attribute__((sda)); +extern short l05_hud_release_counter __asm__("D_L05_0015F978") __attribute__((sda)); void hud_release_held_element(void) __asm__("FUN_L05_00264298"); void hud_release_held_element(void) { @@ -27,7 +27,7 @@ void hud_release_held_element(void) { animation_parameter_target_id = -1; } D_L05_0015F97C = 0; - *(int *)&D_L05_0015F978 = *(int *)&D_L05_0015F978 + 1; + *(int *)&l05_hud_release_counter = *(int *)&l05_hud_release_counter + 1; } typedef struct { From 8e9933e31be52ba2d3fc6ab962b8cfc4a42592ba Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:08:45 +0000 Subject: [PATCH 003/657] decomp: clarify names in trooper_start_knockback domain_0_value_0 -> MOTION_RISING: Retail 0x0025c590 binds a1 to the knockback state in s0; sh zero,0x3e(s0) at 0x0025c5f0 matches the original Ghidra halfword assignment and source knockback_state->motion_phase = 0. The supplied step_moby_motion reads this same record member at +0x3e, names its zero case MOTION_RISING, and changes zero to one when vertical motion at +8 becomes negative; floor collision writes two (MOTION_GROUNDED). Thus this is the rising motion phase domain, not the moby's enemy state or a request state. --- src/overlays/shared/mobys/step_moby_motion.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/overlays/shared/mobys/step_moby_motion.c b/src/overlays/shared/mobys/step_moby_motion.c index d476232f58..6401865aa2 100644 --- a/src/overlays/shared/mobys/step_moby_motion.c +++ b/src/overlays/shared/mobys/step_moby_motion.c @@ -140,6 +140,9 @@ void trooper_start_knockback(u8 *moby, int animation_frame_index, float knockback_angle) { + enum { + MOTION_RISING = 0 + }; float *moby_vars_record; knockback_state->velocity[0] = fast_cos(knockback_angle) * knockback_state->speed; knockback_state->velocity[1] = fast_sin(knockback_angle) * knockback_state->speed; From ed7edca513175595bd3daf838dcc052a98f7361a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:10:51 +0000 Subject: [PATCH 004/657] decomp: clarify names in try_select_camera_offset_effect_moby D_0013CA44 -> camera_offset_effect_selection_gate: Bound source src/overlays/shared/camera/follow_camera_offset_effect.c SHA-256 9f306d0d2b11d6c7d7f2108ad37f471948dad721cac7ac481bf159cb6a2ce8ec reads *(float *)D_0013CA44 only as an absolute_float input gating candidate selection. Retail 0x002fa808 establishes 0x00140000; the delay-slot lwc1 at 0x002fa810 loads 0x0013ca44 into f12 for the absolute helper at 0x002fa80c. Instructions 0x002fa814-0x002fa82c compare its absolute result with 0.05f and exit when it exceeds that threshold, before any displacement tests or selection-state writes. Original retail decompilation independently shows func_0x00210280(uRam0013ca44) <= 0.05 as the selection prerequisite. This proves a scalar selection gate, without identifying its producer or units. Preserve the char-array declaration and assembler identity. --- src/overlays/shared/camera/follow_camera_offset_effect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_offset_effect.c b/src/overlays/shared/camera/follow_camera_offset_effect.c index e24f1fd268..0afe524189 100644 --- a/src/overlays/shared/camera/follow_camera_offset_effect.c +++ b/src/overlays/shared/camera/follow_camera_offset_effect.c @@ -22,7 +22,7 @@ void update_camera_offset_effect_state(void) __asm__("FUN_L02_002fa770"); extern CameraOffsetEffect camera_offset_effect __asm__("D_L02_00167600"); extern float D_L02_0016760C NOT_SDA; extern short camera_offset_effect_duration_step_gp __asm__("D_L02_0016238C") __attribute__((sda)); -extern char D_0013CA44[]; +extern char camera_offset_effect_selection_gate[] __asm__("D_0013CA44"); extern short camera_offset_effect_duration_step __asm__("D_L02_0016238C"); s32 D_L02_00167604[1] __attribute__((section(".data"))) = {0}; @@ -193,7 +193,7 @@ void try_select_camera_offset_effect_moby(char *candidate_moby) { float accumulated_amount; float candidate_reference_angle_radians; if (*(short *)(selection_reference + 0x86) == 0) { - if (!(0.05f < absolute_float(*(float *)(D_0013CA44)))) { + if (!(0.05f < absolute_float(*(float *)(camera_offset_effect_selection_gate)))) { candidate_selection_state = camera_selection_context + 0x380; fast_vec_sub(candidate_displacement, candidate_moby + 0x10, &hero.motion.pos); vector_distance = fast_vec_length(candidate_displacement); From 4a65b0d5f99ae8293ccb5f7b4cd1cd9dfddb323e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:10:54 +0000 Subject: [PATCH 005/657] decomp: clarify names in green_mushroom_update f2c -> destruction_trigger: The hit record returned by find_moby_hit at 0x002fd9dc is null-checked at 0x002fda28. Retail 0x002fda30 loads its +0x2c float, and 0x002fda3c-0x002fda48 tests it strictly greater than zero. That condition causes state 2 to be stored at 0x002fda58. State 2 spawns four class-0x719 fragments (0x002fdb64-0x002fdb70), a class-0x718 placement (0x002fdb78), and removes the mushroom (0x002fdb80). The supplied C has exactly this data flow through hit->f2c; destruction_trigger names this demonstrated gate without assuming its physical units. Bounded helper evidence at 0x0026f320-0x0026f374 confirms the returned record is matched to the moby and requested hit mask. --- src/overlays/l01/mobys/green_mushroom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/green_mushroom.c b/src/overlays/l01/mobys/green_mushroom.c index 713e3cde6f..9eaa99a851 100644 --- a/src/overlays/l01/mobys/green_mushroom.c +++ b/src/overlays/l01/mobys/green_mushroom.c @@ -29,7 +29,7 @@ typedef struct { typedef struct { u8 pad0[0x2C]; - f32 f2c; + f32 destruction_trigger; } SparkHit; extern s32 D_L01_0015F580; @@ -60,7 +60,7 @@ void green_mushroom_update(SparkMoby *mushroom_moby) { mushroom_moby->state = GREEN_MUSHROOM_WAIT_FOR_POSITIVE_HIT; break; case GREEN_MUSHROOM_WAIT_FOR_POSITIVE_HIT: - if (hit != 0 && hit->f2c > 0.0f) { + if (hit != 0 && hit->destruction_trigger > 0.0f) { flag = 1; } if (flag) { From 8a6d6aa3805b4b3426d3bda66a7e4d61bc6b803d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:14:13 +0000 Subject: [PATCH 006/657] decomp: clarify names in update_hero_water_height_and_bobbing i198 -> hero_state_elapsed_frames: Retail 0x00227d4c-0x00227d70 calls scale_game_frames(10), loads signed hero+0x198, and tests whether that field exceeds the scaled frame threshold to enable bob damping. In the bound source snapshot, the file-owned Hero_228770 view explicitly places current_state_elapsed_frames at +0x198 and uses it to detect a state change. The same source's update_hero_timers_and_reach_state increments hero.state_timer once per update; hero_set_state saves it to state.prev_timer then resets it to zero, and restores it when a jump transition is refused. Together the matching hero storage, frame comparison and state timer lifecycle prove elapsed frames in the current hero state, rather than an offset-only name. --- src/overlays/shared/hero/hero_set_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index f161ee6e89..d2fe808139 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3177,7 +3177,7 @@ typedef struct { u8 p0[0x88]; f32 water_adjusted_position_z; u8 p1[0x198 - 0x8C]; - s32 i198; + s32 hero_state_elapsed_frames; u8 p2[0x2F0 - 0x19C]; f32 water_surface_height_target; u8 p3[0x690 - 0x2F4]; @@ -3209,7 +3209,7 @@ void update_hero_water_height_and_bobbing(void) { enum { WATER_HEIGHT_CONTROL_ALTERNATE_TARGET = 0x16 }; - if (G.i198 > scale_game_frames(10) || G.water_bob_offset < 0.0f || G.i2094 == 0x11 || + if (G.hero_state_elapsed_frames > scale_game_frames(10) || G.water_bob_offset < 0.0f || G.i2094 == 0x11 || G.i20A0 == 0x11) { if (G.i2084 == 0x36) { vendor_spring(&G.water_bob_offset, From c6f6bae86719207a51f323bd8ba0f2569ad47da5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:23:43 +0000 Subject: [PATCH 007/657] decomp: clarify names in follow_camera_setup h0 -> height_state_timer: Retail 0x002e6eb0-0x002e6ec0 locates the camera height block at camera data+0x20 and clears its first short. At 0x002e7030-0x002e703c scale_game_frames returns the timer duration stored in that short; 0x002e702c clears the same short on the exempt branch. The block's +4/+8 are seeded from target and orbit heights at 0x002e70f0-0x002e7108, establishing a frame timer belonging to the height state without claiming its complete lifecycle. h38 -> orbit_endpoint_collision_direction_class: Retail 0x002e6f78 derives collision block camera data+0x1D0 and 0x002e6f98 clears its +0x38 short. Bound resolve_follow_camera_endpoint_collisions uses exactly this block+0x38 as endpoint_collision_direction_class: starts at 2, classifies normalized collision displacement alignment as 1, -1 or 0 using +/-0.75 thresholds, then clears unused sentinel 2. update_follow_camera_orbit_after_collision also tests this short, corroborating the endpoint collision direction class. h3A -> force_orbit_retraction_decay: Retail 0x002e70d4-0x002e70ec computes desired orbit distance minus remainder length and sets collision block+0x3A when that signed shortfall is below -0.1. Bound follow_camera_avoid_mobies tests the same +0x3A and forces the dec path, which decrements the retraction timer, clears the flag on expiration and cosine-interpolates retraction toward zero. This proves a flag forcing orbit retraction decay, rather than a generic collision flag. h3C -> orbit_distance_override_pending: Retail 0x002e6e44 establishes the orbit block and 0x002e6e70 clears its +0x3C short. In the bound follow_camera_approach C, orbit+0x3C selects between orbit+0x40 and default_orbit+0x2C as the requested value for interpolation into orbit distance +0x2C. The flag is cleared after consumption, proving a pending distance override. h3E -> orbit_height_override_pending: Retail 0x002e6e74 clears orbit block+0x3E. In the bound follow_camera_approach C, this short selects orbit+0x4C instead of default_orbit+0x30 as the interpolation target written into orbit height +0x30, then is cleared after consumption. Retail 0x002e70f0-0x002e70f8 also copies that height to the height state, supporting the pending height override role. hDA -> target_height_override_requested: Retail 0x002e6e18 clears target block+0xDA. Bound follow_camera_approach tests exactly target+0xDA: nonzero chooses target+0xB4, otherwise default_target+0xB0, for interpolation into target height offset +0xB0. reset_follow_camera_state_from_position and rebuild_follow_camera_pose multiply that height by the up direction. This proves a target-height override request selector; no clearing lifecycle is inferred. iB4 -> requested_target_height: Retail 0x002e6e14 clears target block+0xB4. In bound follow_camera_approach the same storage is read as float and supplied as the requested interpolation target for target+0xB0 only when target+0xDA is set. The output height scales the up vector in pose rebuilding, proving the requested target height role while retaining the original int storage declaration. iBC -> target_height_interpolation_state: Retail 0x002e6e1c clears target block+0xBC. Both target-height branches of bound follow_camera_approach pass exactly target+0xBC as the first state-address argument to cam_interp_values, with current height at target+0xB0 and return stored back there. This proves target-height interpolation state without assuming the internal numerical representation. iC0 -> followed_moby: Retail 0x002e6de4 loads hero+0x2080 and 0x002e6df0 stores it at target block+0xC0. The bound C names the loaded member followed_hero_moby; rebuild_follow_camera_pose dereferences this same target+0xC0 as the followed moby's transform basis at +0xC0 and up axis at +0xE0. This identifies the stored followed moby, preserving its declared int type. --- .../shared/camera/follow_camera_setup.c | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 4cda7ed305..665933aed7 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -597,7 +597,7 @@ void reset_follow_camera_state_from_position(char *camera_moby) { /* Initialises the type-0 camera: fills its data blocks and seeds the first position. */ typedef struct CamE { - short h0; /* 0x00 */ + short height_state_timer; /* 0x00 */ short h2; /* 0x02 */ float f4; /* 0x04 */ float f8; /* 0x08 */ @@ -614,10 +614,10 @@ typedef struct CamA { float orbit_origin_position[4]; /* 0x50 */ char pad60[0x50]; float fB0; /* 0xB0 */ - int iB4; /* 0xB4 */ + int requested_target_height; /* 0xB4 */ float fB8; /* 0xB8 */ - int iBC; /* 0xBC */ - int iC0; /* 0xC0 */ + int target_height_interpolation_state; /* 0xBC */ + int followed_moby; /* 0xC0 */ unsigned char bC4; /* 0xC4 */ char padC5; short hC6; /* 0xC6 */ @@ -625,7 +625,7 @@ typedef struct CamA { unsigned char bD6; /* 0xD6 */ char padD7; short hD8; /* 0xD8 */ - short hDA; /* 0xDA */ + short target_height_override_requested; /* 0xDA */ float fDC; /* 0xDC */ float fE0; /* 0xE0 */ float fE4; /* 0xE4 */ @@ -643,8 +643,8 @@ typedef struct CamB { float f30; /* 0x30 */ int i34; /* 0x34 */ int i38; /* 0x38 */ - short h3C; /* 0x3C */ - short h3E; /* 0x3E */ + short orbit_distance_override_pending; /* 0x3C */ + short orbit_height_override_pending; /* 0x3E */ char pad40[4]; int orbit_distance_interpolation_state; /* 0x44 */ float f48; /* 0x48 */ @@ -684,8 +684,8 @@ typedef struct CamG { float f30; /* 0x30 */ short h34; /* 0x34 */ short h36; /* 0x36 */ - short h38; /* 0x38 */ - short h3A; /* 0x3A */ + short orbit_endpoint_collision_direction_class; /* 0x38 */ + short force_orbit_retraction_decay; /* 0x3A */ float f3C; /* 0x3C */ float f40; /* 0x40 */ float f44; /* 0x44 */ @@ -784,7 +784,7 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { a = &camera_moby->cam->a; qcopy(a->pos, D_0013F4D0_2E8210); a->fB0 = 1.5f; - a->iC0 = D_0013F450_2E8210.followed_hero_moby; + a->followed_moby = D_0013F450_2E8210.followed_hero_moby; a->bC4 = 0; a->bD6 = 0; a->fE0 = 0.2f; @@ -794,9 +794,9 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { a->fB8 = 0.005f; a->hC6 = 0; a->hD8 = 0; - a->iB4 = 0; - a->hDA = 0; - a->iBC = 0; + a->requested_target_height = 0; + a->target_height_override_requested = 0; + a->target_height_interpolation_state = 0; b = &camera_moby->cam->b; b->target_orbit_distance = 4.64f; @@ -809,8 +809,8 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { b->i28 = 0; b->i20 = 0; b->i24 = 0; - b->h3C = 0; - b->h3E = 0; + b->orbit_distance_override_pending = 0; + b->orbit_height_override_pending = 0; b->orbit_distance_interpolation_state = 0; b->orbit_height_interpolation_state = 0; @@ -822,7 +822,7 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { D_L00_0015EF40 = 0.75f; e = camera_moby->cam; - e->e.h0 = 0; + e->e.height_state_timer = 0; camera_height_state = &e->e; camera_height_state->i10 = 0; camera_height_state->iC = 0; @@ -865,9 +865,9 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { r = scale_game_frames(0x7D0); g = &camera_state_base->g; g->f30 = 0.0f; - g->h3A = 0; + g->force_orbit_retraction_decay = 0; g->h36 = 0; - g->h38 = 0; + g->orbit_endpoint_collision_direction_class = 0; g->consecutive_camera_obstruction_frames = 0; g->h34 = r; g->f44 = l00_follow_camera_collision_probe_step_growth_factor; @@ -888,7 +888,7 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { if (D_L00_00166E04->camera_class == 7 && D_0013F450_2E8210.h30C == 0) { e->e.h0 = 0; } else { - camera_height_state->h0 = scale_game_frames(D_L00_00161D24_gp); + camera_height_state->height_state_timer = scale_game_frames(D_L00_00161D24_gp); } } else { follow_camera_reset(camera_moby); @@ -904,7 +904,7 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { orbit_distance_shortfall = b->target_orbit_distance - fast_vec_length(orbit_offset_remainder); g->f30 = orbit_distance_shortfall; if (orbit_distance_shortfall < -0.1f) { - g->h3A = 1; + g->force_orbit_retraction_decay = 1; } camera_height_state->f8 = b->f30; camera_height_state->f4 = a->fB0; From f755595843554181d9688b30deedbcc352437f10 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:26:14 +0000 Subject: [PATCH 008/657] decomp: clarify names in update_veldin_robot_damage_and_targeting domain_0_value_253 -> MOBY_STATE_ALTERNATE_REMOVAL_MARKER: Retail 0x002e19fc-0x002e1a0c loads candidate_target_moby_index and forms a moby_table pointer with stride 0x100. At 0x002e1a18 it reads that moby's state byte +0x20; 0x002e1a1c-0x002e1a24 rejects shared removal markers 0xFE and 0xFD, invalidating the index at 0x002e1a34. Original Ghidra confirms state -2/-3 exclusions. Supplied checked removal evidence records mark_moby_for_removal writing 0xFE or 0xFD to this same moby state field depending on pool boundary, proving the shared MobyRemovalState domain rather than robot behavioral states or target-selection status. The supplied include/rnc/mobys/moby_state.h domain defines MOBY_STATE_ALTERNATE_REMOVAL_MARKER = 253; reuse that canonical member. --- src/overlays/l00/mobys/veldin_robot_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l00/mobys/veldin_robot_enemy.c b/src/overlays/l00/mobys/veldin_robot_enemy.c index fc6690f38f..eb6a1979fd 100644 --- a/src/overlays/l00/mobys/veldin_robot_enemy.c +++ b/src/overlays/l00/mobys/veldin_robot_enemy.c @@ -526,7 +526,7 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { if (vars->candidate_target_moby_index >= 0) { candidate_target = (ElectroidMoby *)(moby_table + (vars->candidate_target_moby_index << 8)); if (candidate_target == 0 || candidate_target->state == MOBY_STATE_REMOVAL_MARKER || - candidate_target->state == 0xFD) { + candidate_target->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER) { vars->candidate_target_moby_index = -1; } else { range = vector_distance_xy(&moby->pos, &candidate_target->pos); From edb121bec060cb59be70452d7223ab7fc98f668d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:26:14 +0000 Subject: [PATCH 009/657] decomp: clarify names in chomper_update domain_0_value_2 -> CHOMPER_TARGET_SELECTION_REJECTED: 002e5f6c-002e5f84 tests pvars+0x1C4 != 2 before entering CHOMPER_APPROACH_TARGET. Retail helper 002e6208 loads the same Moby pvars at 002e6230, obtains target +0x180, and stores 2 to +0x1C4 at 002e63ac/002e63dc when home-target XY distance exceeds 16 or height difference exceeds 3. Supplied same-file L16PursuitData.target_selection_status writes existing local CHOMPER_TARGET_SELECTION_REJECTED for these exact rejection conditions. This is target-selection status, not moby or hero state. domain_1_value_2 -> CHOMPER_TARGET_SELECTION_REJECTED: 002e5ff0-002e6008 tests pvars+0x1C4 == 2 before entering CHOMPER_RETURN_HOME. Retail helper 002e6208 loads the same Moby pvars at 002e6230, obtains target +0x180, and stores 2 to +0x1C4 at 002e63ac/002e63dc when home-target XY distance exceeds 16 or height difference exceeds 3. Supplied same-file L16PursuitData.target_selection_status writes existing local CHOMPER_TARGET_SELECTION_REJECTED for these exact rejection conditions. This is target-selection status, not moby or hero state. domain_2_value_2 -> CHOMPER_TARGET_SELECTION_REJECTED: 002e6168-002e617c tests pvars+0x1C4 != 2 before resuming CHOMPER_APPROACH_TARGET. Retail helper 002e6208 loads the same Moby pvars at 002e6230, obtains target +0x180, and stores 2 to +0x1C4 at 002e63ac/002e63dc when home-target XY distance exceeds 16 or height difference exceeds 3. Supplied same-file L16PursuitData.target_selection_status writes existing local CHOMPER_TARGET_SELECTION_REJECTED for these exact rejection conditions. This is target-selection status, not moby or hero state. --- src/overlays/l16/mobys/chomper.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/overlays/l16/mobys/chomper.c b/src/overlays/l16/mobys/chomper.c index 9ba30d2eec..b30ff14d5b 100644 --- a/src/overlays/l16/mobys/chomper.c +++ b/src/overlays/l16/mobys/chomper.c @@ -104,6 +104,9 @@ typedef struct ChomperVars { /* Moby class 1445 */ void chomper_update(struct Moby *chomper_moby) { + enum { + CHOMPER_TARGET_SELECTION_REJECTED = 2 + }; ChomperVars *chomper_data = (ChomperVars *)chomper_moby->pvars; update_chomper_hit_reaction_and_target(chomper_moby); FUN_L00_00263ac8(2.1f, (int)chomper_moby, 1, &chomper_data->big_head_manipulator); @@ -131,7 +134,7 @@ void chomper_update(struct Moby *chomper_moby) { chomper_data->look_height = truncate_float_to_s32(3.2f); break; case CHOMPER_WAIT_TO_APPROACH_TARGET: - if (chomper_data->pursuit_target_selection_status != 2) { + if (chomper_data->pursuit_target_selection_status != CHOMPER_TARGET_SELECTION_REJECTED) { chomper_moby->state = CHOMPER_APPROACH_TARGET; if (chomper_moby->prev_seq != 0) blend_moby_animation(chomper_moby, 0, 0, scale_game_frames(20)); @@ -145,7 +148,7 @@ void chomper_update(struct Moby *chomper_moby) { chomper_moby->state = CHOMPER_FACE_TARGET; if (chomper_moby->prev_seq != 1) blend_moby_animation(chomper_moby, 1, 0, scale_game_frames(20)); - } else if (chomper_data->pursuit_target_selection_status == 2) + } else if (chomper_data->pursuit_target_selection_status == CHOMPER_TARGET_SELECTION_REJECTED) chomper_moby->state = CHOMPER_RETURN_HOME; break; case CHOMPER_FACE_TARGET: { @@ -173,7 +176,7 @@ void chomper_update(struct Moby *chomper_moby) { chomper_moby->state = CHOMPER_WAIT_TO_APPROACH_TARGET; if (chomper_moby->prev_seq != 2) blend_moby_animation(chomper_moby, 2, 0, scale_game_frames(20)); - } else if (chomper_data->pursuit_target_selection_status != 2) + } else if (chomper_data->pursuit_target_selection_status != CHOMPER_TARGET_SELECTION_REJECTED) chomper_moby->state = CHOMPER_APPROACH_TARGET; break; case 7: From d752d6c6bea7457655e58047480610f8d8f8ec0e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:34:28 +0000 Subject: [PATCH 010/657] decomp: clarify names in bolt_pickup_update f208C -> bolt_collection_test_selector: Retail 002b85d4 loads 15, 002b85d8 loads hero+0x208C, and 002b85dc branches on inequality. Equality selects three vector_distance_xy checks against hero+0x510/+0x520/+0x530 with threshold 0.5 at 002b85e8-002b8634; inequality selects hero-position XY radius and absolute Z tolerance checks at 002b8640-002b867c. Both paths set the collection-hit flag that gates bolt-counter credits and pickup removal at 002b8680-002b872c. The exact C binds this selector read to Hero_2B94B0.f208C, proving its bolt-collection-test selection role without identifying its broader domain. --- src/overlays/l08/mobys/bolt_pickup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l08/mobys/bolt_pickup.c b/src/overlays/l08/mobys/bolt_pickup.c index 3d3d982d17..285f9ccd84 100644 --- a/src/overlays/l08/mobys/bolt_pickup.c +++ b/src/overlays/l08/mobys/bolt_pickup.c @@ -57,7 +57,7 @@ typedef struct Hero_2B94B0 { float bolt_collection_probe_b[4]; float bolt_collection_probe_c[4]; char pad540[0x1B4C]; - int f208C; + int bolt_collection_test_selector; char pad2090[0x1F8]; float collection_radius_xy; float collection_height_tolerance; @@ -183,7 +183,7 @@ void bolt_pickup_update(Moby_2B94B0 *moby) { case MOBY_STATE_CHECK_COLLECTION: hit = 0; moby->spin_angle = fast_add_rotations(moby->spin_angle, moby_data->fC); - if (((Hero_2B94B0 *)((char *)&hero))->f208C == 15) { + if (((Hero_2B94B0 *)((char *)&hero))->bolt_collection_test_selector == 15) { if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->bolt_collection_probe_a, moby->pos) < 0.5f) hit = 1; From 81955bfe4bdb01a25898c0783ca766d94a51cf91 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:36:23 +0000 Subject: [PATCH 011/657] decomp: clarify names in psytcopus_update domain_1_value_2 -> PSYTCOPUS_PROJECTILE_CREATION_BLOCKED: The selector is the s32 private projectile_creation_gate_state at pvars+0x114, separate from receiver state at +0x20. Retail 0x00310354 loads it, 0x00310358 loads 2, and 0x0031035c returns when equal; otherwise 0x0031036c stores CREATE_PROJECTILE and starts animation 2. Direct hit helper 0x00310698 runs first; its path probe at 0x00310a40 and distance checks lead to storing 2 into this same field at 0x00310a68/0x00310a98 when horizontal path separation exceeds 24 or vertical separation exceeds 3 (matching authoritative C). Thus 2 means projectile creation is blocked. This constant belongs to its own gate domain, not HeroStateId, the moby's state enum, or the independent path-probe result domain. unk14C -> yaw_velocity: Source passes this f32 by reference to approach_angle alongside &psytcopus->rot.z in FACE_PLAYER, CREATE_PROJECTILE and FIRE_PROJECTILE. Retail 0x00310328/0x00310340/0x0031034c passes receiver+0x48 and pvars+0x14c to 0x00281ca0; repeated at 0x003103cc and 0x003104b8. Bounded helper preserves the latter pointer in s0 (0x00281cb4), loads its signed scalar at 0x00281cf0, computes velocity-squared/(2*deceleration) at 0x00281d1c-0x00281d30, approaches signed target increments through s0 at 0x00281dcc-0x00281dec or zero at 0x00281e28, and loads that increment at 0x00281e34 to update the yaw at 0x00281e38-0x00281e40. This is persistent yaw velocity, not the desired heading itself. --- src/overlays/l11/mobys/psytcopus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/overlays/l11/mobys/psytcopus.c b/src/overlays/l11/mobys/psytcopus.c index 3fe410d467..1e87e448d7 100644 --- a/src/overlays/l11/mobys/psytcopus.c +++ b/src/overlays/l11/mobys/psytcopus.c @@ -106,6 +106,9 @@ void psytcopus_update(struct Moby *m) __asm__("FUN_L11_00310180"); /* Moby class 1231 */ void psytcopus_update(struct Moby *psytcopus) { + enum { + PSYTCOPUS_PROJECTILE_CREATION_BLOCKED = 2 + }; struct PokiPathVars *psytcopus_vars = (struct PokiPathVars *)psytcopus->pvars; struct Moby *target; Vec4f projectile_vector_scratch; From 7d41aca57bdbc3776abc3f9793030033748f1952 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:38:14 +0000 Subject: [PATCH 012/657] decomp: clarify names in update_blarg_paratrooper_damage_and_state domain_0_value_2 -> PARATROOPER_TARGET_UNAVAILABLE: Retail 00302978-0030297c and 003029ac-003029b0 write 2 to instance+0x164 when target XY distance exceeds the active range or absolute Z separation exceeds 3. Source binds +0x164 to target_selection_status, the identical field tested against established PARATROOPER_TARGET_UNAVAILABLE in blarg_paratrooper_update before patrol-to-approach and waypoint-hop transitions. This is target availability, separate from hit reactions and hero states. domain_1_value_2 -> PARATROOPER_TARGET_UNAVAILABLE: Retail 003029b4-003029ec branches on a null target or target moby state 0xfe/0xfd, then clears instance+0x160 target_moby and writes 2 to instance+0x164 target_selection_status. The supplied caller uses PARATROOPER_TARGET_UNAVAILABLE=2 for that same field to suppress target-driven transitions. Reuse the established target-selection member rather than any equal-valued moby or hero state. --- src/overlays/shared/enemies/blarg_paratrooper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/blarg_paratrooper.c b/src/overlays/shared/enemies/blarg_paratrooper.c index e280d885fa..6dd2f0e54b 100644 --- a/src/overlays/shared/enemies/blarg_paratrooper.c +++ b/src/overlays/shared/enemies/blarg_paratrooper.c @@ -616,6 +616,9 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { enum { PARATROOPER_HIT_STATUS_NO_HIT_OR_SUPPRESSED = 1 }; + enum { + PARATROOPER_TARGET_UNAVAILABLE = 2 + }; Paratrooper302618 *paratrooper_instance_state; char *target, *child, *attached, *chased; float pos[4] __attribute__((aligned(16))); @@ -807,7 +810,7 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { qcopy(¶trooper_instance_state->path_search_point, chased + 0x10); } else { paratrooper_instance_state->target_moby = 0; - paratrooper_instance_state->target_selection_status = 2; + paratrooper_instance_state->target_selection_status = PARATROOPER_TARGET_UNAVAILABLE; } } if (*(int *)¶trooper_instance_state->target_moby == 0) From c38ce314ae8020260b51d7ce4c12ca24c1aec538 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:43:39 +0000 Subject: [PATCH 013/657] decomp: clarify names in flying_car_update fA4 -> attached_part_local_offset_x: Assigned retail 0x00307208-0x0030722c loads private +0xA4 to scale the car basis row at moby+0xC0, then adds that vector to the car position to produce the attached moby's position. Reset repeats the same operation at 0x0030740c-0x0030743c. The bound C's rot_row0 scaling proves the attached part's local X offset. fA8 -> attached_part_local_offset_y: Retail 0x00307230-0x0030724c scales car basis row +0xD0 by private +0xA8 and adds the contribution into the attached moby's position. The reset repeats it at 0x00307440-0x0030745c. Bound fast_vec_scale/fast_vec_add operations with rot_row1 prove the attached part's local Y offset. fAC -> attached_part_local_offset_z: Retail 0x00307250-0x0030726c scales car basis row +0xE0 by private +0xAC and accumulates it into the attached moby's position; 0x00307460-0x0030747c repeats this after path reset. Bound C uses rot_row2, proving the attached part's local Z offset. fB0 -> sink_offset: Assigned 0x003070a8 clears +0xB0 on initialization. Checked path-motion helper 0x00307818-0x00307828 accumulates +0xB4 into this scalar while the hero targets the attached part, and 0x0030782c-0x00307854 recovers it toward zero otherwise. At 0x00307858-0x00307878 it is subtracted from sampled path Z before position tracking, proving sink offset. Bound C confirms this floating-point use despite the preserved int member type. fB4 -> sink_offset_step: Assigned 0x003070ac clears +0xB4. Checked path-motion retail 0x003077e4-0x00307814 increases it by +0xB8 times frame_scale_sq and caps it by the named maximum sink offset rate times frame_time. At 0x00307818-0x00307828 it is added to +0xB0 once per update; 0x00307838 clears it during recovery. This proves a persistent sink-offset step without claiming physical velocity units; preserve its int declaration. fBC -> rotation_oscillation_common_phase: Assigned 0x003070b0 initializes +0xBC and 0x003071c4 supplies its address as a1 to the oscillation helper at 0x003071e0. Checked helper 0x0026aa88 retains that pointer in s0, evaluates it identically at 0x0026aaa4 and 0x0026aac4 for both rotation axes, and updates it in place at 0x0026aae8-0x0026aaf0. Bound update_moby_rotation_oscillation C confirms the common phase role. fC0 -> rotation_oscillation_axis_phase: Assigned 0x003070b4 clears +0xC0 and 0x003071cc supplies its address as a2 to the rotation oscillation helper. Checked 0x0026aa80 saves it in s1; 0x0026aab0 and 0x0026aad0 evaluate that phase with different trigonometric functions for moby rotations +0x40/+0x44, and 0x0026aaf8-0x0026ab00 updates it in place. This proves the axis phase paired with the common +0xBC phase. fCC -> attached_part_interaction_hold_timer_frames: Assigned 0x00307270-0x003072a0 tests whether hero grapple/swing target equals the attached moby. While interacting, 0x003072b0-0x003072bc stores scale_game_frames(30) in +0xCC. Otherwise 0x003072c0-0x003072cc decrements and tests it, retaining attached-part private +0x20 at 2.0 until expiry before restoring the idle branch. Initialization clears it at 0x003070bc, proving an attached-part interaction hold timer in scaled frames. --- src/overlays/l14/mobys/flying_car.c | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/l14/mobys/flying_car.c b/src/overlays/l14/mobys/flying_car.c index cb998e444b..12e7afdcf4 100644 --- a/src/overlays/l14/mobys/flying_car.c +++ b/src/overlays/l14/mobys/flying_car.c @@ -166,11 +166,11 @@ void flying_car_update(struct Moby *flying_car_moby) { flying_car_moby->draw_dist = 0xFF; flying_car_data->sound = -1; flying_car_data->timer = scale_game_frames(flying_car_path_reset_delay_frames_gp); - flying_car_data->fB0 = 0; - flying_car_data->fB4 = 0; - flying_car_data->fBC = 0; - flying_car_data->fC0 = 0; - flying_car_data->fCC = 0; + flying_car_data->sink_offset = 0; + flying_car_data->sink_offset_step = 0; + flying_car_data->rotation_oscillation_common_phase = 0; + flying_car_data->rotation_oscillation_axis_phase = 0; + flying_car_data->attached_part_interaction_hold_timer_frames = 0; if (flying_car_data->part >= 0) { struct Moby *o = (struct Moby *)(D_L14_0015FFD8_macro + (flying_car_data->part << 8)); o->draw_dist = (u16)flying_car_moby->draw_dist; @@ -206,8 +206,8 @@ void flying_car_update(struct Moby *flying_car_moby) { flying_car_data->fx.b2 = 1; flying_car_data->fx.f20 = flying_car_data->fx.f24 = flying_car_data->fx.f28 = 0.0001f; update_moby_rotation_oscillation(flying_car_moby, - &flying_car_data->fBC, - &flying_car_data->fC0, + &flying_car_data->rotation_oscillation_common_phase, + &flying_car_data->rotation_oscillation_axis_phase, flying_car_rotation_oscillation_amplitude_gp, flying_car_rotation_oscillation_common_phase_update_gp, flying_car_rotation_oscillation_axis_phase_update_gp); @@ -217,24 +217,24 @@ void flying_car_update(struct Moby *flying_car_moby) { (struct Moby *)(D_L14_0015FFD8_macro + (flying_car_data->part << 8)); fast_vec_scale(&attached_part_offset_component, &flying_car_moby->rot_row0, - flying_car_data->fA4); + flying_car_data->attached_part_local_offset_x); fast_vec_add(&o->pos, &flying_car_moby->pos, &attached_part_offset_component); fast_vec_scale(&attached_part_offset_component, &flying_car_moby->rot_row1, - flying_car_data->fA8); + flying_car_data->attached_part_local_offset_y); fast_vec_add(&o->pos, &o->pos, &attached_part_offset_component); fast_vec_scale(&attached_part_offset_component, &flying_car_moby->rot_row2, - flying_car_data->fAC); + flying_car_data->attached_part_local_offset_z); fast_vec_add(&o->pos, &o->pos, &attached_part_offset_component); if ((hero.state.control_mode == HERO_MODE_GRAPPLE && hero.grapple_target == o) || (hero.state.control_mode == HERO_MODE_GRAPPLE_SWING && hero.swing_target_moby == o)) { seed_linked_record_for_flying_car(flying_car_moby); - flying_car_data->fCC = scale_game_frames(0x1E); + flying_car_data->attached_part_interaction_hold_timer_frames = scale_game_frames(0x1E); } else { - fast_dec_timer(&flying_car_data->fCC); - if (flying_car_data->fCC != 0) { + fast_dec_timer(&flying_car_data->attached_part_interaction_hold_timer_frames); + if (flying_car_data->attached_part_interaction_hold_timer_frames != 0) { ((Part_6ee0 *)o->pvars)->f20 = 2.0f; } else { Part_6ee0 *pd = (Part_6ee0 *)o->pvars; @@ -275,15 +275,15 @@ void flying_car_update(struct Moby *flying_car_moby) { o->flags &= 0xFFBE; fast_vec_scale(&attached_part_offset_component, &flying_car_moby->rot_row0, - flying_car_data->fA4); + flying_car_data->attached_part_local_offset_x); fast_vec_add(&o->pos, &flying_car_moby->pos, &attached_part_offset_component); fast_vec_scale(&attached_part_offset_component, &flying_car_moby->rot_row1, - flying_car_data->fA8); + flying_car_data->attached_part_local_offset_y); fast_vec_add(&o->pos, &o->pos, &attached_part_offset_component); fast_vec_scale(&attached_part_offset_component, &flying_car_moby->rot_row2, - flying_car_data->fAC); + flying_car_data->attached_part_local_offset_z); fast_vec_add(&o->pos, &o->pos, &attached_part_offset_component); } if (flying_car_data->trigger >= 0) { From faec0dc1f3a92007befbc12bf5288839400285e1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:46:03 +0000 Subject: [PATCH 014/657] decomp: clarify names in process_amoeboid_hits_and_update_targeting domain_2_value_2 -> AMOEBOID_TARGET_STATUS_UNAVAILABLE: Selector is s32 moby_vars->target_selection_status at pvars+0x204, distinct from byte Moby.state +0x20. Retail 0x002ef1fc-0x002ef200 and 0x002ef220-0x002ef230 store 2 when selected position exceeds home search radius or vertical tolerance. The supplied large_amoeboid_update also assigns status 2 when follow_path fails and tests it to suppress target-path acquisition/return home. Thus 2 marks an unavailable target for path following, not current moby state 2. Bounded search helper 0x00274df8 stores its selection status at output+0x44 (0x00275248), which is pvars+0x204 because output is pvars+0x1C0. domain_3_value_2 -> AMOEBOID_TARGET_STATUS_UNAVAILABLE: Retail 0x002ef278 loads pvars+0x204 and 0x002ef27c compares it with 2; equality bypasses the current-target distance comparison and accepts an in-range alternate candidate at 0x002ef2a0-0x002ef2a8. This is the same target-selection status field assigned 2 by radius/height rejection at 0x002ef200/0x002ef230 and by failed follow_path calls in supplied caller C. The comparison therefore reuses AMOEBOID_TARGET_STATUS_UNAVAILABLE, separate from the Moby.state domain. domain_4_value_1 -> AMOEBOID_TARGET_STATUS_ALTERNATE_MOBY: Assigned retail calls find_nearest_class_26f_moby_in_list at 0x002ef240, checks candidate distance against search radius and current target through 0x002ef298, then stores selected candidate s0 to pvars+0x200 at 0x002ef2a4 and literal 1 to adjacent target_selection_status +0x204 at 0x002ef2a8. Bounded target helper 0x00274df8 likewise sets status 1 when selecting non-hero mobies at 0x00275058-0x00275060 and 0x00275168-0x00275170, writing output+0x40 target and +0x44 status. This proves alternate-moby selection status, not moby current state 1. unk84 -> knockback_motion_flags: Assigned retail initializes pvars+0x84 to 8 at 0x002eee68, 0x002eeec4 and 0x002eefa4, then ORs bit 4 for both smaller amoeboids at 0x002eef08-0x002eef38 and 0x002eefe8-0x002ef018. The same spawned pvars+0x60 is passed to established trooper_start_knockback at 0x002eef5c-0x002eef74 and 0x002ef03c-0x002ef054. Bounded level-01 helper 0x00271418 retains that motion pointer in s0, reads its +0x24 (pvars+0x84), sets bit 0x20 at 0x002714e8-0x002714ec and tests bit 2 at 0x002714f4-0x002714fc to choose initialization calls. This proves a knockback motion flags word, without assigning meanings to individual bits. --- src/overlays/shared/enemies/large_amoeboid.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index d950133a99..2b56cdf005 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -671,6 +671,10 @@ void large_amoeboid_update(unsigned char *moby) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002B90A8.c: func_L01_002F0040), where it is exact; names translated to the US level program. */ void process_amoeboid_hits_and_update_targeting(char *moby) { + enum { + AMOEBOID_TARGET_STATUS_ALTERNATE_MOBY = 1, + AMOEBOID_TARGET_STATUS_UNAVAILABLE = 2 + }; V_2F0040 scratch_vector; V_2F0040 line_test_endpoint; int flag; @@ -855,11 +859,11 @@ void process_amoeboid_hits_and_update_targeting(char *moby) { if (cand != 0) { candidate_distance = vector_distance_xy(&MOBY(moby)->pos, cand + 0x10); if (candidate_distance < moby_vars->effective_target_search_radius) { - if (moby_vars->target_selection_status == 2 || + if (moby_vars->target_selection_status == AMOEBOID_TARGET_STATUS_UNAVAILABLE || candidate_distance < vector_distance_xy(&MOBY(moby)->pos, moby_vars->target + 0x10)) { moby_vars->target = cand; - moby_vars->target_selection_status = 1; + moby_vars->target_selection_status = AMOEBOID_TARGET_STATUS_ALTERNATE_MOBY; } } } From 782b7c864162a7cfefc91f1cccbf3e7be1c03f1b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:49:35 +0000 Subject: [PATCH 015/657] decomp: clarify names in update_hero_attachment p2FC -> nonresidual_attachment_reference_object: Retail 0x00233fd0..0x00233fdc selects this void* field only when attachment_residual_decay_scale is zero. 0x00233fe8..0x00234000 compares it to attachment_reference_object and invalidates the position anchor on change; 0x00234004..0x0023400c copies it into that reference. A null value clears the reference and both anchors at 0x00234010..0x00234028. The selected object is resolved at 0x002340e0 and used as reference_object by convert_pose_to_reference_local at 0x0023424c..0x00234258. This proves the nonresidual attachment reference source, without claiming ground-contact provenance. p4F8 -> residual_attachment_reference_override: After the nonzero attachment_residual_decay_scale branch at 0x00233fd4, retail 0x0023402c..0x00234078 tests state-like fields against 0x1c or 3 and, when this void* is nonnull, copies it to attachment_reference_object and selects probe mode. Otherwise 0x0023407c..0x002340b0 retains the previous reference and enables residual displacement decay. The override becomes the reference argument resolved at 0x002340e0 and used in pose conversion at 0x0023424c..0x00234258. This proves a conditional reference override during the residual-scale branch, without inferring the object's upstream identity. --- src/overlays/shared/hero/set_hero_animation.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index dca7777553..aee3eba11c 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1407,7 +1407,7 @@ typedef struct Hero_234800 { char p188[0x6E]; short path_clearance_position_anchor_inhibit; char p1F8[0x104]; - void *p2FC; + void *nonresidual_attachment_reference_object; char p300[0xE]; short attachment_residual_decay_scale; Vec_234800 primary_attachment_local_position; @@ -1422,7 +1422,7 @@ typedef struct Hero_234800 { char p4E0[0x4]; float ledge_attachment_heading; char p4E8[0x10]; - void *p4F8; + void *residual_attachment_reference_override; char p4FC[0x1B84]; int hero_moby; int i2084; @@ -1471,28 +1471,28 @@ void update_hero_attachment(void) { amt = 0.0f; saved_hero_yaw = ((Hero_234800 *)hero_233f80)->v90.z; if (((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale == 0) { - if (((Hero_234800 *)hero_233f80)->p2FC != 0) { + if (((Hero_234800 *)hero_233f80)->nonresidual_attachment_reference_object != 0) { mode = HERO_ATTACHMENT_MODE_PROBE; if (((Hero_234800 *)hero_233f80)->attachment_reference_object != - ((Hero_234800 *)hero_233f80)->p2FC) { + ((Hero_234800 *)hero_233f80)->nonresidual_attachment_reference_object) { ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; } ((Hero_234800 *)hero_233f80)->attachment_reference_object = - ((Hero_234800 *)hero_233f80)->p2FC; + ((Hero_234800 *)hero_233f80)->nonresidual_attachment_reference_object; } else { ((Hero_234800 *)hero_233f80)->attachment_reference_object = 0; ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~2; } } else if (((Hero_234800 *)hero_233f80)->i2084 == 0x1C && - ((Hero_234800 *)hero_233f80)->p4F8 != 0) { + ((Hero_234800 *)hero_233f80)->residual_attachment_reference_override != 0) { ((Hero_234800 *)hero_233f80)->attachment_reference_object = - ((Hero_234800 *)hero_233f80)->p4F8; + ((Hero_234800 *)hero_233f80)->residual_attachment_reference_override; mode = HERO_ATTACHMENT_MODE_PROBE; } else if (((Hero_234800 *)hero_233f80)->i208C == 3 && - ((Hero_234800 *)hero_233f80)->p4F8 != 0) { + ((Hero_234800 *)hero_233f80)->residual_attachment_reference_override != 0) { ((Hero_234800 *)hero_233f80)->attachment_reference_object = - ((Hero_234800 *)hero_233f80)->p4F8; + ((Hero_234800 *)hero_233f80)->residual_attachment_reference_override; mode = HERO_ATTACHMENT_MODE_PROBE; } else if (((Hero_234800 *)hero_233f80)->attachment_reference_object != 0) { mode = HERO_ATTACHMENT_MODE_PROBE; From be740d1369b515707fef3d7dfa41479e5f90ca4e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:51:35 +0000 Subject: [PATCH 016/657] decomp: clarify names in homing_shot_update domain_0_value_254 -> MOBY_STATE_MARKED_FOR_REMOVAL: Authoritative C compares D_001403E0_lui->state with 0xFE before voice allocation. Assigned retail 0x002cba4c-0x002cba50 reads Moby byte +0x20 and excludes 0xFE. The assigned cleanup path calls established mark_moby_for_removal at 0x002cb9ac. Checked level-00 helper 0x0024eb68 selects 0xFE at 0x0024eb8c and stores it to the same Moby state byte at 0x0024eb90; it then schedules +0x38 from global time plus two and calls 0x00250b20. Thus 0xFE is a state explicitly assigned when marking a Moby for removal, independent of its numeric value. --- src/overlays/shared/weapons/blaster_shot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/blaster_shot.c b/src/overlays/shared/weapons/blaster_shot.c index b774941636..d44f723c48 100644 --- a/src/overlays/shared/weapons/blaster_shot.c +++ b/src/overlays/shared/weapons/blaster_shot.c @@ -265,6 +265,9 @@ void homing_shot_update(Moby *shot_moby) __asm__("FUN_L00_002cb418"); /* Moby class 305 */ void homing_shot_update(Moby *shot_moby) { + enum { + MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE + }; Vec4A start; Vec4A step; ShotQuery query; @@ -409,7 +412,7 @@ void homing_shot_update(Moby *shot_moby) { add_vector_xyz_2cb418( (Vec4A *)&shot_moby->pos, ((char *)D_L00_00173E60), &spark_and_pushout_scratch); if (D_001403E0_lui != 0 && D_001403E0_lui->oclass == 0xA8 && - D_001403E0_lui->state != 0xFE && D_001403E0_lui->state != 0xFD) { + D_001403E0_lui->state != MOBY_STATE_MARKED_FOR_REMOVAL && D_001403E0_lui->state != 0xFD) { allocate_voice_for_target_entry(4, 0, D_001403E0_lui); } } From 4ce364bd03f833316aafb83f3db5d9300edd3ba9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:53:26 +0000 Subject: [PATCH 017/657] decomp: clarify names in handle_pause_input domain_1_value_2 -> DEBUG_CAMERA_MODE_UPDATE_HERO: The selector is S_297f78.debug_camera_mode, not hero state or vehicle mode. Retail 0x002986f8 loads +0x14 from 0x0016c058; nonzero invokes update_debug_camera at 0x00298704. At 0x0029870c-0x00298714 the same field is reloaded and compared with 2, and equality alone reaches update_hero_from_debug_camera at 0x0029871c. The authoritative C and original Ghidra show this exact branch, proving mode 2 adds the hero update from the debug camera. w18 -> frame_end_callback_selector: Source S_297f78.w18 is read only by five end-of-handle_pause_input comparisons after update_help_state and the gated frame-counter update. Retail 0x002987a8-0x00298814 repeatedly loads +0x18 from 0x0016c058 and compares 2, 3, 4, 5 and 6 to select calls to 0x001f6bf8, 0x001f6c00, 0x001f6c08, 0x001f6c10 and 0x001f6c18 respectively. Original Ghidra preserves these distinct dispatch targets; current C calls them through the established no_op_main_callback_alt name. Thus it selects the callback invoked at the end of this frame update. --- .../shared/cutscenes/update_cutscene_playback.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/cutscenes/update_cutscene_playback.c b/src/overlays/shared/cutscenes/update_cutscene_playback.c index 58c1fc2211..8379513cfa 100644 --- a/src/overlays/shared/cutscenes/update_cutscene_playback.c +++ b/src/overlays/shared/cutscenes/update_cutscene_playback.c @@ -109,7 +109,7 @@ typedef struct { s32 w8; u8 padc[0x14 - 0xC]; s32 debug_camera_mode; - s32 w18; + s32 frame_end_callback_selector; u8 pad1c[0xA0 - 0x1C]; s32 previous_step_held_buttons; u8 padA4[0xEC - 0xA4]; @@ -194,6 +194,9 @@ extern void update_game_frame_and_idle_counters(void) __asm__("FUN_L00_00297e70" void handle_pause_input(void) __asm__("FUN_L00_00297f78"); void handle_pause_input(void) { + enum { + DEBUG_CAMERA_MODE_UPDATE_HERO = 2 + }; s32 lvl, area, noctl, special; if (D_L00_0016C058.single_step_mode_countdown) { if (--D_L00_0016C058.single_step_mode_countdown == 0) @@ -316,7 +319,7 @@ void handle_pause_input(void) { update_camera(); } else if (D_L00_0016C058.debug_camera_mode) { update_debug_camera(); - if (D_L00_0016C058.debug_camera_mode == 2) + if (D_L00_0016C058.debug_camera_mode == DEBUG_CAMERA_MODE_UPDATE_HERO) update_hero_from_debug_camera(); } noop_main_callback(D_L00_00161028, 8); @@ -328,15 +331,15 @@ void handle_pause_input(void) { update_help_state(); if (DBG(2)) update_game_frame_and_idle_counters(); - if (D_L00_0016C058.w18 == 2) + if (D_L00_0016C058.frame_end_callback_selector == 2) no_op_main_callback_alt(); - if (D_L00_0016C058.w18 == 3) + if (D_L00_0016C058.frame_end_callback_selector == 3) no_op_main_callback_alt(); - if (D_L00_0016C058.w18 == 4) + if (D_L00_0016C058.frame_end_callback_selector == 4) no_op_main_callback_alt(); - if (D_L00_0016C058.w18 == 5) + if (D_L00_0016C058.frame_end_callback_selector == 5) no_op_main_callback_alt(); - if (D_L00_0016C058.w18 == 6) + if (D_L00_0016C058.frame_end_callback_selector == 6) no_op_main_callback_alt(); } From 3bd9d28ca2001446049e78758cafddfe7edb113b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 22:59:42 +0000 Subject: [PATCH 018/657] decomp: clarify names in visibomb_missile_update t -> requested_speed_target: In the authoritative C, first t is default speed * frame_time, replaced by max speed * frame_time when held mask 0x40 is set. Retail 002b62fc..002b6320 selects these frame-scaled values in f0; 002b6324..002b634c subtracts smoothed_speed_target (+0x48), multiplies by its blend factor, and accumulates toward this requested target. t -> launch_clearance_target_height: Second t is probe_ground_height(missile position,0,0.5f) plus launch_ground_clearance. Retail 002b657c..002b6590 adds vars+0x44 to probe result and compares missile position z (+0x18) against that height. At 002b65d0..002b65e0 it is the target for the height approach used to correct launch clearance and pitch. --- src/overlays/shared/weapons/visibomb_missile.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/weapons/visibomb_missile.c b/src/overlays/shared/weapons/visibomb_missile.c index 3b275bd635..ebfb4c6c89 100644 --- a/src/overlays/shared/weapons/visibomb_missile.c +++ b/src/overlays/shared/weapons/visibomb_missile.c @@ -868,10 +868,10 @@ void visibomb_missile_update(struct Moby *missile_moby) { return; } { - float t = visibomb_missile_default_speed_gp * frame_time_macro; + float requested_speed_target = visibomb_missile_default_speed_gp * frame_time_macro; if (controller_state.held & 0x40) - t = visibomb_missile_max_speed_gp * frame_time_macro; - missile_vars->smoothed_speed_target += (t - missile_vars->smoothed_speed_target) * + requested_speed_target = visibomb_missile_max_speed_gp * frame_time_macro; + missile_vars->smoothed_speed_target += (requested_speed_target - missile_vars->smoothed_speed_target) * visibomb_missile_speed_target_blend_factor_gp; missile_vars->f4 += (missile_vars->smoothed_speed_target - missile_vars->f4) * visibomb_missile_speed_blend_factor_gp; @@ -912,14 +912,14 @@ void visibomb_missile_update(struct Moby *missile_moby) { qcopy(&v20, &missile_moby->pos); fast_vec_add(&missile_moby->pos, &missile_moby->pos, &v50); if (scale_game_frames(0xBB8) - scale_game_frames(0x3C) < missile_vars->f10) { - float t = probe_ground_height(&missile_moby->pos, 0, 0.5f) + + float launch_clearance_target_height = probe_ground_height(&missile_moby->pos, 0, 0.5f) + missile_vars->launch_ground_clearance; - if (missile_moby->pos.z < t) { + if (missile_moby->pos.z < launch_clearance_target_height) { if (coll_hit_moby == 0 || (coll_hit_moby->pclass != 0 && coll_hit_moby->pclass->type == 5)) { float ground_clearance_pitch_adjustment = fast_arc_tan(missile_vars->f4, - approach_value(&missile_moby->pos.z, t, frame_time_macro * 6.0f)); + approach_value(&missile_moby->pos.z, launch_clearance_target_height, frame_time_macro * 6.0f)); if (frame_time_macro * 1.57079637f < ground_clearance_pitch_adjustment) ground_clearance_pitch_adjustment = frame_time_macro * 1.57079637f; missile_moby->rot.y -= ground_clearance_pitch_adjustment; From 229d668436e1d95e18a1c90695835c07f9547593 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:01:54 +0000 Subject: [PATCH 019/657] decomp: clarify names in shuttle_update f2FC -> route_request_moby: Authoritative shuttle.c SHA-256 eeb4335163c01ae371238b65ece0a577dd0fc315565c953db2a2e7fe79ec0a08 declares this member struct Moby*. Retail 0x0030273c-0x00302748 loads hero+0x2FC and compares it with s3, the shuttle moby. Only equality, with the busy and inhibit checks clear, reaches update_shuttle_route_selection_and_prompt at 0x00302764 and normal request input handling at 0x00302778-0x003027b0. This proves the moby selected for normal route-request eligibility; no physical contact semantics are claimed. f30E -> route_request_inhibit: Retail 0x00302750 loads this signed short from hero+0x30E; 0x00302754 reaches route selection at 0x00302764 only when it is zero. A nonzero value diverts to 0x0030275c, which permits only the forced-return bypass. The authoritative C expresses the same f30E==0 eligibility condition. Checked set_race_camera evidence b117edd584c044d0ac15664974391823, 0x0022d66c-0x0022d6d4, copies hero transforms and writes 1 to this member, confirming an inhibit value set during repositioning. Counter duration or broader reset semantics are not claimed. --- src/overlays/l06/mobys/shuttle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l06/mobys/shuttle.c b/src/overlays/l06/mobys/shuttle.c index e52a68745f..fac4e582ad 100644 --- a/src/overlays/l06/mobys/shuttle.c +++ b/src/overlays/l06/mobys/shuttle.c @@ -81,9 +81,9 @@ typedef struct { typedef struct { char pad0[0x2FC]; - struct Moby *f2FC; + struct Moby *route_request_moby; char pad300[0xE]; - short f30E; + short route_request_inhibit; } Hero_302578; typedef struct { @@ -319,8 +319,8 @@ void shuttle_update(struct Moby *moby) { busy = 1; } } - if ((busy == 0 && ((Hero_302578 *)((char *)&hero))->f2FC == moby && - ((Hero_302578 *)((char *)&hero))->f30E == 0) || + if ((busy == 0 && ((Hero_302578 *)((char *)&hero))->route_request_moby == moby && + ((Hero_302578 *)((char *)&hero))->route_request_inhibit == 0) || shuttle_forced_return_requested_gp != 0) { update_shuttle_route_selection_and_prompt((char *)moby); now = shuttle_forced_return_requested_gp; From 0e4e90629cada27ac12946fb5b2590e37a41aacf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:01:54 +0000 Subject: [PATCH 020/657] decomp: clarify names in bomber_jet_update domain_0_value_254 -> MOBY_STATE_MARKED_FOR_REMOVAL: Assigned retail 0x002f7c7c-0x002f7c98 checks class 0x1CB and its moby state byte at +0x20 against 0xFE before activating turret vars. The assigned direct mark_moby_for_removal calls resolve to checked helper 0x002636c0: 0x002636e4 loads 0xFE and 0x002636e8 stores it to the argument moby's +0x20 state byte. Thus the exact selector domain and removal-mark role are proven by a writer, not numerical coincidence. The helper alternatively writes 0xFD below an unresolved pointer boundary; this proposal makes no claim about the allocation distinction. --- src/overlays/l01/mobys/bomber_jet.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l01/mobys/bomber_jet.c b/src/overlays/l01/mobys/bomber_jet.c index c04652263f..51067169cf 100644 --- a/src/overlays/l01/mobys/bomber_jet.c +++ b/src/overlays/l01/mobys/bomber_jet.c @@ -264,6 +264,9 @@ void bomber_jet_update(GunshipMoby *bomber_jet_moby) { enum { BOMBER_JET_STATE_INITIALIZE = 0 }; + enum { + MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE + }; GunshipVars *gunship_vars = bomber_jet_moby->vars; GunshipFollow *sub = &gunship_vars->sub; float distance_scale; @@ -382,7 +385,7 @@ void bomber_jet_update(GunshipMoby *bomber_jet_moby) { if (gunship_vars->turrets[j] != -1) { GunshipMoby *o = (GunshipMoby *)(ents_macro + (gunship_vars->turrets[j] << 8)); - if (o != 0 && o->oclass == 0x1CB && o->state != 0xFE && + if (o != 0 && o->oclass == 0x1CB && o->state != MOBY_STATE_MARKED_FOR_REMOVAL && o->state != 0xFD) { GunshipTurretVars *t = o->vars; t->activated = 1; From cd55c042b781c7b1c690de8d50950af5db834bf5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:03:48 +0000 Subject: [PATCH 021/657] decomp: clarify names in fred_update fA4 -> joint_0_look_pitch_target: Retail 0x00301a34-0x00301acc computes negative atan2(horizontal target distance, vertical delta) and clamps it to +/-0.5235988; 0x00301aec stores it at pvars+0xa4. The record at pvars+0x40 is passed with joint index 0 at 0x00301b24-0x00301b38. Checked level-06 helper 0x00271ca8-0x00271cc4 reads record+0x64 (pvars+0xa4) as the angular target for its second rotation component. fA8 -> joint_0_look_yaw_target: Retail 0x00301a18-0x00301a8c derives target heading relative to moby rotation and clamps yaw to +/-pi/2. 0x00301ae8-0x00301af4 stores yaw*0.6 at pvars+0xa8. Record pvars+0x40 is passed with joint index 0 at 0x00301b28-0x00301b38; checked helper 0x00271cc8-0x00271ce4 reads record+0x68 as its third angular target and advances the rotation component at record+0x48. fB0 -> joint_0_scale: Retail 0x00301afc-0x00301b18 tests big_head_cheat_enabled and writes 2.75 to pvars+0xb0, which is +0x70 within the joint-0 record passed at 0x00301b28-0x00301b38. Checked helper 0x00271bf0-0x00271c08 compares record+0x70 against neutral 1.0; 0x00271d10-0x00271d24 copies that scalar into all three transform diagonal components +0x20/+0x24/+0x28 and 0x00271d28-0x00271d34 restores the scalar to 1.0, proving uniform joint scale. fC0 -> joint_2_animation_record: Retail 0x00301b44-0x00301b58 passes moby in a0, pvars+0xc0 in a1 and literal joint index 2 in a2 to established update_joint_animation. Checked helper 0x00271b44-0x00271b54 retains that record and index; 0x00271c88-0x00271ce4 advances its angular components, and 0x00271cf4-0x00271d08 passes moby, joint index and record into attachment then constructs its rotation. The array is the beginning of that joint-2 animation record; no anatomical identity or layout change is proposed. --- src/overlays/l06/mobys/fred.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l06/mobys/fred.c b/src/overlays/l06/mobys/fred.c index e6be0ee4cb..900ca728f0 100644 --- a/src/overlays/l06/mobys/fred.c +++ b/src/overlays/l06/mobys/fred.c @@ -47,12 +47,12 @@ typedef struct Data_301070 { char *f20; char pad24[0x1C]; char f40[0x64]; - float fA4; - float fA8; + float joint_0_look_pitch_target; + float joint_0_look_yaw_target; char padAC[4]; - float fB0; + float joint_0_scale; char padB4[0xC]; - char fC0[0x68]; + char joint_2_animation_record[0x68]; float look_yaw_target; char pad12C[0x14]; float idle_look_target_position[4]; @@ -356,15 +356,15 @@ void fred_update(struct Moby *moby) { pitch = 0.5235988f; else if (pitch < -0.5235988f) pitch = -0.5235988f; - fred_vars->fA4 = pitch; - fred_vars->fA8 = yaw * 0.6f; + fred_vars->joint_0_look_pitch_target = pitch; + fred_vars->joint_0_look_yaw_target = yaw * 0.6f; fred_vars->look_yaw_target = yaw * 0.4f; } } if (big_head_cheat_enabled[0]) - fred_vars->fB0 = 2.75f; + fred_vars->joint_0_scale = 2.75f; update_joint_animation( rate * frame_scale_sq_macro, head_rate * frame_scale_sq_macro, moby, fred_vars->f40, 0); update_joint_animation( - rate * frame_scale_sq_macro, head_rate * frame_scale_sq_macro, moby, fred_vars->fC0, 2); + rate * frame_scale_sq_macro, head_rate * frame_scale_sq_macro, moby, fred_vars->joint_2_animation_record, 2); } From b0c1bbced502319e7f843d34d6af5a6367f8e1fa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:03:52 +0000 Subject: [PATCH 022/657] decomp: clarify names in process_hero_equipped_item_input domain_0_value_2 -> HERO_ITEM_SLOT_STATE_READY: Retail 0x00228028-2C requires slot-zero +0x10B4==2 before switching +0x10B8. Prepared checked hero_slot_item_id 0x0020D498-0x0020D4C8 returns the slot item ID only for this same field/value; supplied helper C explicitly names items[0].state==HERO_ITEM_SLOT_STATE_READY. This is slot readiness, not hero state or control mode. domain_10_value_14 -> HERO_STATE_DOUBLE_JUMP: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_DOUBLE_JUMP branch establishes value 14. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_11_value_11 -> HERO_STATE_HIGH_JUMP: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_HIGH_JUMP branch establishes value 11. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_12_value_11 -> HERO_STATE_HIGH_JUMP: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_HIGH_JUMP branch establishes value 11. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_13_value_45 -> HERO_STATE_ITEM_RELEASE_FALL: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_ITEM_RELEASE_FALL branch establishes value 45. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_14_value_17 -> HERO_STATE_REPEATABLE_JUMP: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_REPEATABLE_JUMP branch establishes value 17. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_15_value_11 -> HERO_STATE_HIGH_JUMP: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_HIGH_JUMP branch establishes value 11. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_16_value_14 -> HERO_STATE_DOUBLE_JUMP: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_DOUBLE_JUMP branch establishes value 14. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_17_value_8 -> HERO_STATE_LAND: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_LAND branch establishes value 8. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_18_value_6 -> HERO_CONTROL_MODE_MELEE_ATTACK: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves the shared wrench combo, slam and crouch swing entry assigns state.control_mode=6 and initializes attack records. Name this control-mode value 6 within its own domain. domain_19_value_21 -> HERO_STATE_CROUCH_SWING: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_CROUCH_SWING branch establishes value 21. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_1_value_4 -> HERO_CONTROL_MODE_JUMP: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves the shared jump-state entry assigns state.control_mode=4 before configuring jump gravity and takeoff. Name this control-mode value 4 within its own domain. domain_20_value_4 -> HERO_CONTROL_MODE_JUMP: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves the shared jump-state entry assigns state.control_mode=4 before configuring jump gravity and takeoff. Name this control-mode value 4 within its own domain. domain_21_value_2 -> HERO_CONTROL_MODE_FALL: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_FALL and HERO_STATE_ITEM_RELEASE_FALL assign state.control_mode=2 and initialize falling velocity. Name this control-mode value 2 within its own domain. domain_22_value_15 -> HERO_CONTROL_MODE_GRIND: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_GRIND assigns state.control_mode=0xF and initializes rail direction, segment and grind speed. Name this control-mode value 15 within its own domain. domain_23_value_5 -> HERO_CONTROL_MODE_LAND: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_LAND assigns state.control_mode=5 and configures landing animation. Name this control-mode value 5 within its own domain. domain_24_value_30 -> HERO_STATE_LOOK_RELEASE_WAIT: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_LOOK_RELEASE_WAIT branch establishes value 30. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_25_value_44 -> HERO_STATE_GRAPPLE_SWING_ENTRY: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_GRAPPLE_SWING_ENTRY branch establishes value 44. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_26_value_4 -> HERO_CONTROL_MODE_JUMP: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves the shared jump-state entry assigns state.control_mode=4 before configuring jump gravity and takeoff. Name this control-mode value 4 within its own domain. domain_27_value_5 -> HERO_CONTROL_MODE_LAND: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_LAND assigns state.control_mode=5 and configures landing animation. Name this control-mode value 5 within its own domain. domain_28_value_12 -> HERO_CONTROL_MODE_CROUCH: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_CROUCH assigns state.control_mode=0xC and starts the crouch animation. Name this control-mode value 12 within its own domain. domain_29_value_2 -> HERO_CONTROL_MODE_FALL: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_FALL and HERO_STATE_ITEM_RELEASE_FALL assign state.control_mode=2 and initialize falling velocity. Name this control-mode value 2 within its own domain. domain_2_value_1 -> HERO_STATE_LOOK: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_LOOK branch establishes value 1. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_30_value_4 -> HERO_CONTROL_MODE_JUMP: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves the shared jump-state entry assigns state.control_mode=4 before configuring jump gravity and takeoff. Name this control-mode value 4 within its own domain. domain_31_value_5 -> HERO_CONTROL_MODE_LAND: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_LAND assigns state.control_mode=5 and configures landing animation. Name this control-mode value 5 within its own domain. domain_32_value_15 -> HERO_CONTROL_MODE_GRIND: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_GRIND assigns state.control_mode=0xF and initializes rail direction, segment and grind speed. Name this control-mode value 15 within its own domain. domain_33_value_30 -> HERO_STATE_LOOK_RELEASE_WAIT: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_LOOK_RELEASE_WAIT branch establishes value 30. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_34_value_0 -> HERO_CONTROL_MODE_IDLE: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_IDLE and HERO_STATE_LOOK both assign state.control_mode=0. Name this control-mode value 0 within its own domain. domain_35_value_30 -> HERO_STATE_LOOK_RELEASE_WAIT: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_LOOK_RELEASE_WAIT branch establishes value 30. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_36_value_1 -> HERO_CONTROL_MODE_GROUND_MOVE: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_RUN and HERO_STATE_STOP assign state.control_mode=1 and initialize ground-speed/momentum. Name this control-mode value 1 within its own domain. domain_37_value_12 -> HERO_CONTROL_MODE_CROUCH: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_CROUCH assigns state.control_mode=0xC and starts the crouch animation. Name this control-mode value 12 within its own domain. domain_38_value_5 -> HERO_CONTROL_MODE_LAND: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_LAND assigns state.control_mode=5 and configures landing animation. Name this control-mode value 5 within its own domain. domain_39_value_15 -> HERO_CONTROL_MODE_GRIND: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_GRIND assigns state.control_mode=0xF and initializes rail direction, segment and grind speed. Name this control-mode value 15 within its own domain. domain_3_value_30 -> HERO_STATE_LOOK_RELEASE_WAIT: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_LOOK_RELEASE_WAIT branch establishes value 30. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_40_value_4 -> HERO_CONTROL_MODE_JUMP: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves the shared jump-state entry assigns state.control_mode=4 before configuring jump gravity and takeoff. Name this control-mode value 4 within its own domain. domain_41_value_35 -> HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL branch establishes value 35. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_42_value_12 -> HERO_CONTROL_MODE_CROUCH: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_CROUCH assigns state.control_mode=0xC and starts the crouch animation. Name this control-mode value 12 within its own domain. domain_43_value_0 -> HERO_CONTROL_MODE_IDLE: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_IDLE and HERO_STATE_LOOK both assign state.control_mode=0. Name this control-mode value 0 within its own domain. domain_44_value_3 -> HERO_STATE_STOP: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_STOP branch establishes value 3. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_45_value_1 -> HERO_CONTROL_MODE_GROUND_MOVE: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_RUN and HERO_STATE_STOP assign state.control_mode=1 and initialize ground-speed/momentum. Name this control-mode value 1 within its own domain. domain_46_value_4 -> HERO_CONTROL_MODE_JUMP: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves the shared jump-state entry assigns state.control_mode=4 before configuring jump gravity and takeoff. Name this control-mode value 4 within its own domain. domain_47_value_1 -> HERO_STATE_LOOK: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_LOOK branch establishes value 1. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_48_value_129 -> HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT branch establishes value 129. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_49_value_12 -> HERO_CONTROL_MODE_CROUCH: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_CROUCH assigns state.control_mode=0xC and starts the crouch animation. Name this control-mode value 12 within its own domain. domain_4_value_1 -> HERO_STATE_LOOK: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_LOOK branch establishes value 1. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_50_value_2 -> HERO_CONTROL_MODE_FALL: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves HERO_STATE_FALL and HERO_STATE_ITEM_RELEASE_FALL assign state.control_mode=2 and initialize falling velocity. Name this control-mode value 2 within its own domain. domain_51_value_4 -> HERO_CONTROL_MODE_JUMP: Assigned retail reads hero+0x208C (0x0022806C, 0x00228358, 0x002284D8, 0x002286C4, 0x002287DC, 0x002288E4 and 0x00228A78) as the control selector, independently of current-state +0x2084. Supplied authoritative hero_set_state source proves the shared jump-state entry assigns state.control_mode=4 before configuring jump gravity and takeoff. Name this control-mode value 4 within its own domain. domain_52_value_129 -> HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT branch establishes value 129. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_53_value_19 -> HERO_STATE_WRENCH_COMBO: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_WRENCH_COMBO branch establishes value 19. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_54_value_129 -> HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT branch establishes value 129. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_55_value_21 -> HERO_STATE_CROUCH_SWING: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_CROUCH_SWING branch establishes value 21. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_56_value_22 -> HERO_STATE_HURT: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_HURT branch establishes value 22. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_5_value_30 -> HERO_STATE_LOOK_RELEASE_WAIT: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_LOOK_RELEASE_WAIT branch establishes value 30. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_6_value_7 -> HERO_STATE_JUMP: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_JUMP branch establishes value 7. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_7_value_9 -> HERO_STATE_RUN_JUMP: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_RUN_JUMP branch establishes value 9. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_8_value_8 -> HERO_STATE_LAND: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_LAND branch establishes value 8. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. domain_9_value_6 -> HERO_STATE_FALL: Retail loads hero+0x2084 for this current-state comparison (0x002280FC, 0x0022818C, 0x00228370, 0x002285A8, 0x002288F8 and 0x00228A2C onward). Authoritative hero_set_state stores requested_state in state.current and dispatches the same HeroStateId selector; its HERO_STATE_FALL branch establishes value 6. Reuse the supplied canonical HeroStateId member; equipment +0x10B8 and control mode +0x208C are separate domains. f450 -> high_jump_stick_direction: Assigned retail 0x002281E4-0x00228230 reads hero+0x450 only while hero current state is high jump (0xB), choosing an 18- or 20-animation-frame input gate according to whether it equals 3. Authoritative high-jump entry assigns hero.unk450=stick_direction_vs_facing(); that helper computes move yaw relative to facing and returns 3 for the backward cone. The high-jump animation selection then consumes the same stored direction. fA60 -> active_attack_record_index: Retail 0x00228364 loads hero+0xA60, 0x00228374 multiplies it by 0x2C, and 0x00228378-84 adds attack_records base 0x0017BC28. Source uses &attack_records[fA60] for wrench_attack_record; hero_set_state initializes hero.attack_record for wrench combo/slam/crouch swing. This field selects the active attack record. fAA8 -> hero_animation_frame: Retail 0x002283B4 and 0x00228410 load float hero+0xAA8, compare it to attack-record frame thresholds, and 0x00228424-38 truncates that float before subtracting record+0xC to compute the combo input window. Supplied hero_set_state uses hero.anim_frame with the same attack-record timing checks and animation setup. The field is the current hero animation frame, not elapsed state frames at +0x198. --- src/overlays/shared/hero/hero_set_state.c | 143 ++++++++++++---------- 1 file changed, 77 insertions(+), 66 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index d2fe808139..3819d27584 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3280,7 +3280,7 @@ typedef struct { short f41C; short f41E; char p420[0x30]; - int f450; + int high_jump_stick_direction; char p454[0x58]; short f4AC; char p4AE[0x14E]; @@ -3294,11 +3294,11 @@ typedef struct { short f99C; short swing_target_valid; char p9A0[0xC0]; - int fA60; + int active_attack_record_index; char pA64[0x38]; int fA9C; char pAA0[0x8]; - float fAA8; + float hero_animation_frame; char pAAC[0x5E4]; Moby_227fa0 *slot0_item_moby; char p1094[0xC]; @@ -3353,6 +3353,17 @@ int process_hero_equipped_item_input(void) { enum { WRENCH_MOBY_STATE_READY = 0 }; + enum { + HERO_CONTROL_MODE_IDLE = 0, + HERO_CONTROL_MODE_GROUND_MOVE = 1, + HERO_ITEM_SLOT_STATE_READY = 2, + HERO_CONTROL_MODE_FALL = 2, + HERO_CONTROL_MODE_JUMP = 4, + HERO_CONTROL_MODE_LAND = 5, + HERO_CONTROL_MODE_MELEE_ATTACK = 6, + HERO_CONTROL_MODE_CROUCH = 0xC, + HERO_CONTROL_MODE_GRIND = 0xF + }; int item_press_age_frames[3]; int start; int mask; @@ -3367,7 +3378,7 @@ int process_hero_equipped_item_input(void) { if (D_0013F450_h228770.slot0_item_moby == 0) { return 0; } - if (D_0013F450_h228770.equipped_slot_state != 2) { + if (D_0013F450_h228770.equipped_slot_state != HERO_ITEM_SLOT_STATE_READY) { return 0; } start = D_0013F450_h228770.current_state_elapsed_frames; @@ -3375,7 +3386,7 @@ int process_hero_equipped_item_input(void) { switch (D_0013F450_h228770.equipped_slot_item_id) { case ITEM_WRENCH: if (D_0013F450_h228770.hero_control_mode < 2U || - (D_0013F450_h228770.hero_control_mode == 4 && D_0013F450_h228770.f418 != 0)) { + (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.f418 != 0)) { Moby_227fa0 *equipped_item_moby; if (D_0013F450_h228770.f12EA != 0) { @@ -3395,11 +3406,11 @@ int process_hero_equipped_item_input(void) { break; } if ((controller_state.held & 0xA) || - ((D_0013F450_h228770.hero_current_state == 1 || - D_0013F450_h228770.hero_current_state == 0x1E) && + ((D_0013F450_h228770.hero_current_state == HERO_STATE_LOOK || + D_0013F450_h228770.hero_current_state == HERO_STATE_LOOK_RELEASE_WAIT) && D_0013F450_h228770.current_state_elapsed_frames > scale_game_frames(0x14))) { - if ((D_0013F450_h228770.hero_current_state == 1 || - D_0013F450_h228770.hero_current_state == 0x1E) && + if ((D_0013F450_h228770.hero_current_state == HERO_STATE_LOOK || + D_0013F450_h228770.hero_current_state == HERO_STATE_LOOK_RELEASE_WAIT) && D_0013F450_h228770.current_state_elapsed_frames > scale_game_frames(0x14)) { launch_hero_wrench(); break; @@ -3414,22 +3425,22 @@ int process_hero_equipped_item_input(void) { } break; } - if (D_0013F450_h228770.hero_current_state == 7 || - D_0013F450_h228770.hero_current_state == 9 || - D_0013F450_h228770.hero_current_state == 8 || - D_0013F450_h228770.hero_current_state == 6 || - (D_0013F450_h228770.hero_current_state == 0xE && D_0013F450_h228770.fAA8 > 32.0f) || - (D_0013F450_h228770.hero_current_state == 0xB && D_0013F450_h228770.f450 != 3 && - D_0013F450_h228770.fAA8 > 18.0f) || - (D_0013F450_h228770.hero_current_state == 0xB && D_0013F450_h228770.f450 == 3 && - D_0013F450_h228770.fAA8 > 20.0f) || - D_0013F450_h228770.hero_current_state == 0x2D || - D_0013F450_h228770.hero_current_state == 0x11) { + if (D_0013F450_h228770.hero_current_state == HERO_STATE_JUMP || + D_0013F450_h228770.hero_current_state == HERO_STATE_RUN_JUMP || + D_0013F450_h228770.hero_current_state == HERO_STATE_LAND || + D_0013F450_h228770.hero_current_state == HERO_STATE_FALL || + (D_0013F450_h228770.hero_current_state == HERO_STATE_DOUBLE_JUMP && D_0013F450_h228770.hero_animation_frame > 32.0f) || + (D_0013F450_h228770.hero_current_state == HERO_STATE_HIGH_JUMP && D_0013F450_h228770.high_jump_stick_direction != 3 && + D_0013F450_h228770.hero_animation_frame > 18.0f) || + (D_0013F450_h228770.hero_current_state == HERO_STATE_HIGH_JUMP && D_0013F450_h228770.high_jump_stick_direction == 3 && + D_0013F450_h228770.hero_animation_frame > 20.0f) || + D_0013F450_h228770.hero_current_state == HERO_STATE_ITEM_RELEASE_FALL || + D_0013F450_h228770.hero_current_state == HERO_STATE_REPEATABLE_JUMP) { if (D_0013F450_h228770.current_state_elapsed_frames > scale_game_frames(0xA)) { int t = scale_game_frames(0xA); - if (D_0013F450_h228770.hero_current_state == 0xB || - D_0013F450_h228770.hero_current_state == 0xE) { + if (D_0013F450_h228770.hero_current_state == HERO_STATE_HIGH_JUMP || + D_0013F450_h228770.hero_current_state == HERO_STATE_DOUBLE_JUMP) { t = scale_game_frames(0x12); } if (!pad_pressed_within(mask, t, 0)) { @@ -3437,7 +3448,7 @@ int process_hero_equipped_item_input(void) { } if ((D_0013F450_h228770.f41E == 0 && D_0013F450_h228770.f2DC > 0.1f) || (D_0013F450_h228770.f41E != 0 && D_0013F450_h228770.f2DC > 0.57f) || - (D_0013F450_h228770.hero_current_state == 8 && + (D_0013F450_h228770.hero_current_state == HERO_STATE_LAND && D_0013F450_h228770.f2DC > 0.57f)) { if (D_0013F450_h228770.f5FC != 0) { break; @@ -3452,16 +3463,16 @@ int process_hero_equipped_item_input(void) { break; } } - if (D_0013F450_h228770.hero_control_mode == 6) { - HeroTableRow2C *wrench_attack_record = &attack_records[D_0013F450_h228770.fA60]; + if (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_MELEE_ATTACK) { + HeroTableRow2C *wrench_attack_record = &attack_records[D_0013F450_h228770.active_attack_record_index]; int t; - if (D_0013F450_h228770.hero_current_state == 0x15) { + if (D_0013F450_h228770.hero_current_state == HERO_STATE_CROUCH_SWING) { if (D_0013F450_h228770.current_state_elapsed_frames > scale_game_frames(0x1E)) { if (D_0013F450_h228770.fA9C != 0) { break; } - if (D_0013F450_h228770.fAA8 >= (float)wrench_attack_record->f10 && + if (D_0013F450_h228770.hero_animation_frame >= (float)wrench_attack_record->f10 && (controller_state.held & 0xA) && pad_pressed_within(mask, scale_game_frames(0xF), 0)) { hero_set_state(0x15, 1); @@ -3472,10 +3483,10 @@ int process_hero_equipped_item_input(void) { if (D_0013F450_h228770.fA9C != 0) { break; } - if (!(D_0013F450_h228770.fAA8 >= (float)wrench_attack_record->f10)) { + if (!(D_0013F450_h228770.hero_animation_frame >= (float)wrench_attack_record->f10)) { break; } - t = (truncate_float_to_s32(D_0013F450_h228770.fAA8) - wrench_attack_record->fC) * 2; + t = (truncate_float_to_s32(D_0013F450_h228770.hero_animation_frame) - wrench_attack_record->fC) * 2; if (t <= 0) { t = 1; } @@ -3509,11 +3520,11 @@ int process_hero_equipped_item_input(void) { t = scale_game_frames(8); } if (D_0013F450_h228770.hero_control_mode < 2U || - D_0013F450_h228770.hero_control_mode == 4 || - D_0013F450_h228770.hero_control_mode == 2 || - D_0013F450_h228770.hero_control_mode == 0xF || - D_0013F450_h228770.hero_control_mode == 5 || - D_0013F450_h228770.hero_current_state == 0x1E) { + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_FALL || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GRIND || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_LAND || + D_0013F450_h228770.hero_current_state == HERO_STATE_LOOK_RELEASE_WAIT) { if (pad_pressed_within(mask, t, 0) || ((controller_state.held & mask) && D_0013F450_h228770.f10B0 > scale_game_frames(0xF))) { @@ -3527,7 +3538,7 @@ int process_hero_equipped_item_input(void) { } if (D_0013F450_h228770.swing_target_valid != 0 && D_0013F450_h228770.grapple_entry_lockout == 0 && - D_0013F450_h228770.hero_current_state != 0x2C) { + D_0013F450_h228770.hero_current_state != HERO_STATE_GRAPPLE_SWING_ENTRY) { hero_set_state(0x2C, 1); break; } @@ -3564,8 +3575,8 @@ int process_hero_equipped_item_input(void) { break; case ITEM_REMOTE_VENDOR: if (D_0013F450_h228770.hero_control_mode < 3U || - D_0013F450_h228770.hero_control_mode == 4 || - D_0013F450_h228770.hero_control_mode == 5) { + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_LAND) { if (pad_pressed_within(mask, scale_game_frames(8), 0)) { open_vendor_menu(0); } @@ -3573,12 +3584,12 @@ int process_hero_equipped_item_input(void) { break; case 15: if (D_0013F450_h228770.hero_control_mode < 2U || - D_0013F450_h228770.hero_control_mode == 0xC || - D_0013F450_h228770.hero_control_mode == 2 || - D_0013F450_h228770.hero_control_mode == 4 || - D_0013F450_h228770.hero_control_mode == 5 || - D_0013F450_h228770.hero_control_mode == 0xF || - D_0013F450_h228770.hero_current_state == 0x1E) { + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_FALL || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_LAND || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GRIND || + D_0013F450_h228770.hero_current_state == HERO_STATE_LOOK_RELEASE_WAIT) { PVar *equipped_item_vars; if (D_0013F450_h228770.slot0_item_moby == 0) { @@ -3611,14 +3622,14 @@ int process_hero_equipped_item_input(void) { case 20: case 24: case 25: - if ((D_0013F450_h228770.hero_control_mode == 0 && - D_0013F450_h228770.hero_current_state != 0x1E) || - D_0013F450_h228770.hero_control_mode == 1 || - D_0013F450_h228770.hero_control_mode == 0xC || - D_0013F450_h228770.hero_control_mode == 5 || - D_0013F450_h228770.hero_control_mode == 0xF || - (D_0013F450_h228770.hero_control_mode == 4 && D_0013F450_h228770.f4AC != 0) || - (D_0013F450_h228770.hero_current_state == 0x23 && D_0013F450_h228770.fAA8 > 25.0f)) { + if ((D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_IDLE && + D_0013F450_h228770.hero_current_state != HERO_STATE_LOOK_RELEASE_WAIT) || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GROUND_MOVE || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_LAND || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GRIND || + (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.f4AC != 0) || + (D_0013F450_h228770.hero_current_state == HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL && D_0013F450_h228770.hero_animation_frame > 25.0f)) { int t; int n; @@ -3631,10 +3642,10 @@ int process_hero_equipped_item_input(void) { ((controller_state.held & 0x20) && n > scale_game_frames(8) && n < scale_game_frames(0x11))) { if (get_ammo(-1)) { - if (D_0013F450_h228770.hero_control_mode == 0xC || - D_0013F450_h228770.hero_control_mode == 0 || - D_0013F450_h228770.hero_current_state == 3 || - (D_0013F450_h228770.hero_control_mode == 1 && + if (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_IDLE || + D_0013F450_h228770.hero_current_state == HERO_STATE_STOP || + (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GROUND_MOVE && D_0013F450_h228770.f229C < 0.7f)) { hero_set_state(0x23, 1); } else { @@ -3650,8 +3661,8 @@ int process_hero_equipped_item_input(void) { break; case 18: if (D_0013F450_h228770.hero_control_mode < 2U || - (D_0013F450_h228770.hero_control_mode == 4 && D_0013F450_h228770.f418 != 0)) { - if (D_0013F450_h228770.hero_current_state != 1) { + (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.f418 != 0)) { + if (D_0013F450_h228770.hero_current_state != HERO_STATE_LOOK) { int t = scale_game_frames(0xA); int n = D_0013F450_h228770.f10B0; @@ -3676,28 +3687,28 @@ int process_hero_equipped_item_input(void) { break; } if (D_0013F450_h228770.current_state_elapsed_frames == start) { - if (hero_slot_item_id(3) == 3 && D_0013F450_h228770.hero_current_state != 0x81 && + if (hero_slot_item_id(3) == 3 && D_0013F450_h228770.hero_current_state != HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT && (D_0013F450_h228770.f308 == 0 || item_available[0x1C] == 0) && D_0013F450_h228770.f22D8 == 0) { f_fun_001f9740_227fa0(&hero_repeat_press_window_frames); if (hero_repeat_press_window_frames != 0) { if (D_0013F450_h228770.hero_control_mode < 2U || - D_0013F450_h228770.hero_control_mode == 0xC || - ((D_0013F450_h228770.hero_control_mode == 2 || - D_0013F450_h228770.hero_control_mode == 4) && + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || + ((D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_FALL || + D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP) && D_0013F450_h228770.f300 != 0)) { if ((controller_state.held & 8) && (controller_state.pressed & 8)) { hero_set_state(0x81, 1); } } } - if ((controller_state.pressed & 8) && D_0013F450_h228770.hero_current_state != 0x81) { + if ((controller_state.pressed & 8) && D_0013F450_h228770.hero_current_state != HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT) { hero_repeat_press_window_frames = scale_game_frames(0x1E); } - } else if (D_0013F450_h228770.hero_current_state != 0x13 && - D_0013F450_h228770.hero_current_state != 0x81 && - D_0013F450_h228770.hero_current_state != 0x15 && - D_0013F450_h228770.hero_current_state != 0x16) { + } else if (D_0013F450_h228770.hero_current_state != HERO_STATE_WRENCH_COMBO && + D_0013F450_h228770.hero_current_state != HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT && + D_0013F450_h228770.hero_current_state != HERO_STATE_CROUCH_SWING && + D_0013F450_h228770.hero_current_state != HERO_STATE_HURT) { D_0013F450_h228770.f22CA = 0; } } From 229db5aeec9b5e1cc499b7d4074952cc6ea0fe1d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:03:52 +0000 Subject: [PATCH 023/657] decomp: clarify names in scoutbot_update domain_0_value_2 -> SCOUTBOT_TARGET_SELECTION_UNAVAILABLE: Retail 002d2d4c loads pvars+0x1B4 and 002d2d50-002d2d54 compares it to 2: this value retains idle/wander behavior rather than approaching a target. Checked helper export 08a8d95509de430faf8ff9013f753baa at 002d3708 loads the same moby pvars; 002d37b4-002d37f0 follows its selected path into +0x170. At 002d3800-002d3814, tracked-position distance from home +0x1C0 above 14 stores 2 to +0x1B4; 002d3818-002d3844 also stores 2 when absolute height difference exceeds 3. Supplied authoritative C already names these writes SCOUTBOT_TARGET_SELECTION_UNAVAILABLE inside update_scoutbot_health_and_target, proving the identical selection-status domain and canonical meaning. --- src/overlays/shared/enemies/scoutbot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index b199b82329..12b4fa74a8 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -187,6 +187,9 @@ void scoutbot_update(Moby *moby) __asm__("FUN_L08_002d2af0"); /* Moby class 252 */ void scoutbot_update(Moby *moby) { + enum { + SCOUTBOT_TARGET_SELECTION_UNAVAILABLE = 2 + }; Data_3DF8 *scoutbot_instance_vars = (struct Data_3DF8 *)moby->pvars; float target_pos[4]; float offset[4]; @@ -232,7 +235,7 @@ void scoutbot_update(Moby *moby) { scoutbot_instance_vars->b29 = 0; break; case SCOUTBOT_STATE_IDLE: - if (scoutbot_instance_vars->path_target_selection_status != 2) { + if (scoutbot_instance_vars->path_target_selection_status != SCOUTBOT_TARGET_SELECTION_UNAVAILABLE) { scoutbot_instance_vars->ground_hover_height_offset = 0.0f; scoutbot_instance_vars->hover_bob_amplitude = 0.1f; if (moby->prev_seq != 2) { From e879d41e93ce2ec4edba50bf41b983eb4443075d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:05:42 +0000 Subject: [PATCH 024/657] decomp: clarify names in test_dummy_update domain_0_value_1 -> TEST_DUMMY_RESPAWN_REQUEST_ACKNOWLEDGED: Assigned retail 002cde48 and 002cde54 initializes private respawn_request_state (+0x2E) to 1; original retail Ghidra agrees. Supplied update_test_dummy_damage_and_respawn C and checked helper request d11c46d9546343848dac5fa7fc590113 show 002cea24-002cea28 tests that same byte for request value 2; 002cea04 loads 1 and 002cea3c writes it back when consuming that request. 002cea44-002ceaa0 resets health/timer, decrements lives and respawns at saved position, or removes at 002ceaa4-002ceabc. Thus 1 is the initialized/acknowledged respawn-request state, separate from moby current state, target mode and hit descriptor kind. iCC -> door_moby_group_index: Assigned retail 002cdec0 loads private data+0xCC into a0 and 002cdec8 calls established find_nearest_test_dummy_door with moby position in a1, storing returned door at +0xF8. Checked helper request d535178c248a4444acaa6a09c2d9eb65: 002d5dbc-002d5de0 scales a0 by four and indexes group table 0x001ABCC0, the same table used by supplied activate_test_dummy_group. 002d5e00-002d5e28 resolves packed group member indices through moby array 0x0015FFD8 and filters class 0x28A; 002d5e2c-002d5e4c selects the nearest matching door relative to supplied position, traversing signed-terminated short entries at 002d5e50-002d5e54. This field is the moby group index used for door selection. --- src/overlays/l16/mobys/test_dummy.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/overlays/l16/mobys/test_dummy.c b/src/overlays/l16/mobys/test_dummy.c index 19439e681e..bc13ff981f 100644 --- a/src/overlays/l16/mobys/test_dummy.c +++ b/src/overlays/l16/mobys/test_dummy.c @@ -75,7 +75,7 @@ typedef struct { int kind; int path; int lives; - int iCC; + int door_moby_group_index; int aim[2]; int sound_path; int node; @@ -150,6 +150,9 @@ void test_dummy_update(unsigned char *moby) { enum { TEST_DUMMY_TARGET_MODE_NO_MOBY_TARGET = 2 }; + enum { + TEST_DUMMY_RESPAWN_REQUEST_ACKNOWLEDGED = 1 + }; L16QuadVector position_or_delta, position_or_direction, launch_velocity; L16HitDescriptor fx; L16DummyData *dummy_data = ((L16DummyData *)MOBY(moby)->pvars); @@ -163,7 +166,7 @@ void test_dummy_update(unsigned char *moby) { FUN_L00_00263ac8(2.5f, (int)moby, 2, (unsigned char *)dummy_data->block140); switch (moby[0x20]) { case TEST_DUMMY_STATE_INITIALIZE: /* set up: lives, home position, the held child for the variant */ - dummy_data->respawn_request_state = 1; + dummy_data->respawn_request_state = TEST_DUMMY_RESPAWN_REQUEST_ACKNOWLEDGED; if (dummy_data->lives > 0) { MOBY(moby)->bolts /= dummy_data->lives; } @@ -177,7 +180,7 @@ void test_dummy_update(unsigned char *moby) { dummy_data->max_health = 2; dummy_data->health = 2.0f; dummy_data->glow_pulse_phase = random_angle_radians(); - dummy_data->route = find_nearest_test_dummy_door(dummy_data->iCC, moby + 0x10); + dummy_data->route = find_nearest_test_dummy_door(dummy_data->door_moby_group_index, moby + 0x10); qcopy(dummy_data->spawn, moby + 0x10); switch (dummy_data->kind) { case TEST_DUMMY_KIND_THROWER: From 33e8b8f372805e57500dc1f8ec78d3abc0ef5214 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:08:31 +0000 Subject: [PATCH 025/657] decomp: clarify names in hoven_turret_update domain_0_value_1 -> HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING: The selector is pvars+0x80, the source muzzle_alternation_state, not moby state or a hero domain. Retail 00303d28-00303d44 selects firing animation 4 when it equals 1; 00303d88-00303dac then clears it and obtains moby point 2 for the muzzle. The alternate branch obtains point 1 and stores 1 at 00303dcc, making point 2 pending for the next shot. Thus both comparisons and the assignment share this proven meaning. domain_1_value_1 -> HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING: The selector is pvars+0x80, the source muzzle_alternation_state, not moby state or a hero domain. Retail 00303d28-00303d44 selects firing animation 4 when it equals 1; 00303d88-00303dac then clears it and obtains moby point 2 for the muzzle. The alternate branch obtains point 1 and stores 1 at 00303dcc, making point 2 pending for the next shot. Thus both comparisons and the assignment share this proven meaning. domain_2_value_0 -> HOVEN_TURRET_MUZZLE_POINT_ONE_PENDING: Retail 00303d88-00303dac handles muzzle_alternation_state (pvars+0x80) equal to 1 by storing 0 and extracting moby point 2 for the current shot. On the next shot the alternate branch 00303db8-00303dcc extracts point 1 and stores 1. Source assignment of 0 therefore makes muzzle point 1 pending; this is the alternating muzzle selector, not the moby or hero state enum. domain_3_value_1 -> HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING: The selector is pvars+0x80, the source muzzle_alternation_state, not moby state or a hero domain. Retail 00303d28-00303d44 selects firing animation 4 when it equals 1; 00303d88-00303dac then clears it and obtains moby point 2 for the muzzle. The alternate branch obtains point 1 and stores 1 at 00303dcc, making point 2 pending for the next shot. Thus both comparisons and the assignment share this proven meaning. fA0 -> initial_height: Retail 00303648-00303650 copies moby pos.z (+0x18) into pvars+0xa0 during initialization. 003036b4-003036f4 approaches this saved height minus 1.2 while boarding; 0030376c-0030378c restores toward it, and 00303a24-00303a34 restores pos.z directly after completion. These operations match fA0 in the authoritative C. fA4 -> boarding_yaw_step: In the WAIT_FOR_BOARDING branch, retail 00303704-00303740 derives a horizontal angle toward the hero, subtracts moby rot.z, adds pi/2, and accumulates 0.01 times this difference into pvars+0xa4. 00303754-00303768 damps it by 0.9 and adds it to moby rot.z. Source fA4 therefore holds the boarding yaw increment, distinct from the manned yaw_step at +0x7c. fAC -> destruction_respawn_frames: Retail 003039a4-003039bc initializes pvars+0xac with scale_game_frames(0x78) when depleted turret health enters state 7. In that DESTRUCTION_EFFECTS branch, 00304150-00304160 decrements the same short timer and calls established hero_respawn on expiry. Source fAC also feeds the destruction fade callback's countdown at +0xac. fAE -> destruction_explosion_cooldown_frames: Retail 00304020-00304028 decrements the short at pvars+0xae and gates the state-7 randomized explosion block. After spawn_explosion at 00304130, 00304138-0030414c resets this short to scale_game_frames(random_int_between(5,13)). Source fAE is therefore the countdown between destruction explosions. --- src/overlays/l12/mobys/hoven_turret.c | 44 +++++++++++++++------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/overlays/l12/mobys/hoven_turret.c b/src/overlays/l12/mobys/hoven_turret.c index cc92ec58a1..aa4b70f92b 100644 --- a/src/overlays/l12/mobys/hoven_turret.c +++ b/src/overlays/l12/mobys/hoven_turret.c @@ -125,11 +125,11 @@ typedef struct { int completion_trigger_moby_index; int f98; int f9C; - float fA0; - float fA4; + float initial_height; + float boarding_yaw_step; int fA8; - short fAC; - short fAE; + short destruction_respawn_frames; + short destruction_explosion_cooldown_frames; } Data_304920; typedef struct { @@ -214,6 +214,10 @@ void hoven_turret_update(struct Moby *moby) { HOVEN_TURRET_STATE_DESTRUCTION_EFFECTS = 7, HOVEN_TURRET_STATE_SAVE_DATA = 8 }; + enum { + HOVEN_TURRET_MUZZLE_POINT_ONE_PENDING = 0, + HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING = 1 + }; Data_304920 *hoven_turret_state = *(Data_304920 **)&moby->pvars; ((Snd *)(D_0013E533 + 0x1D))->f6C = moby; @@ -232,7 +236,7 @@ void hoven_turret_update(struct Moby *moby) { hoven_turret_state->f72 = 0; hoven_turret_state->pitch_step = 0.0f; hoven_turret_state->yaw_step = 0.0f; - hoven_turret_state->fA0 = moby->pos.z; + hoven_turret_state->initial_height = moby->pos.z; hoven_turret_state->f98 = -1; moby->rot.z = 3.1415927f; ((Snd *)(D_0013E533 + 0x1D))->f6C = moby; @@ -247,10 +251,10 @@ void hoven_turret_update(struct Moby *moby) { if (vector_distance_xy(((float *)&moby->pos), ((Hero *)(D_0013E533 + 0xE1D))->motion.pos.f) < 7.0f || ((Hero *)(D_0013E533 + 0xE1D))->ground_moby == moby) { - moby->pos.z = moby->pos.z + ((hoven_turret_state->fA0 - 1.2f) - moby->pos.z) * 0.11f; - hoven_turret_state->fA4 = + moby->pos.z = moby->pos.z + ((hoven_turret_state->initial_height - 1.2f) - moby->pos.z) * 0.11f; + hoven_turret_state->boarding_yaw_step = fast_add_rotations( - hoven_turret_state->fA4, + hoven_turret_state->boarding_yaw_step, fast_add_rotations( fast_subtract_rotations( fast_arc_tan( @@ -260,12 +264,12 @@ void hoven_turret_update(struct Moby *moby) { 1.5707964f) * 0.01f) * 0.9f; - moby->rot.z = fast_add_rotations(moby->rot.z, hoven_turret_state->fA4); + moby->rot.z = fast_add_rotations(moby->rot.z, hoven_turret_state->boarding_yaw_step); } else { - if (moby->pos.z < hoven_turret_state->fA0) { + if (moby->pos.z < hoven_turret_state->initial_height) { moby->pos.z = moby->pos.z + D_0015ED6C_gp; } else { - moby->pos.z = hoven_turret_state->fA0; + moby->pos.z = hoven_turret_state->initial_height; } if (((Hero *)(D_0013E533 + 0xE1D))->ground_moby != moby && hoven_turret_state->f98 != -1) { @@ -316,7 +320,7 @@ void hoven_turret_update(struct Moby *moby) { } if (hoven_turret_state->f8C <= 0.0f) { D_L12_00161F04 = 1; - hoven_turret_state->fAC = scale_game_frames(0x78); + hoven_turret_state->destruction_respawn_frames = scale_game_frames(0x78); moby->state = HOVEN_TURRET_STATE_DESTRUCTION_EFFECTS; break; } @@ -332,7 +336,7 @@ void hoven_turret_update(struct Moby *moby) { if (moby->prev_seq != 0) { set_moby_animation(moby, 0, 0); } - moby->pos.z = hoven_turret_state->fA0; + moby->pos.z = hoven_turret_state->initial_height; moby->rot.z = 3.1415927f; } else { jet_clear_persistent(moby->mission); @@ -422,18 +426,18 @@ void hoven_turret_update(struct Moby *moby) { int i; blend_moby_animation( - moby, hoven_turret_state->muzzle_alternation_state == 1 ? 4 : 3, 0, 1); + moby, hoven_turret_state->muzzle_alternation_state == HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING ? 4 : 3, 0, 1); yaw = fast_add_rotations(moby->rot.z, 1.5707964f); build_spherical_offset(firing_offset, hoven_turret_firing_offset_rate * D_0015ED6C_gp, yaw, hoven_turret_state->f74); - if (hoven_turret_state->muzzle_alternation_state == 1) { - hoven_turret_state->muzzle_alternation_state = 0; + if (hoven_turret_state->muzzle_alternation_state == HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING) { + hoven_turret_state->muzzle_alternation_state = HOVEN_TURRET_MUZZLE_POINT_ONE_PENDING; moby_point_position(moby, 2, muz); } else { moby_point_position(moby, 1, muz); - hoven_turret_state->muzzle_alternation_state = 1; + hoven_turret_state->muzzle_alternation_state = HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING; } fast_vec_add(muz, muz, firing_offset); fast_vec_add(muz, muz, firing_offset); @@ -485,7 +489,7 @@ void hoven_turret_update(struct Moby *moby) { break; case HOVEN_TURRET_STATE_DESTRUCTION_EFFECTS: add_draw_callback(draw_hoven_turret_destruction_fade, moby); - if (fast_dec_timer_s16(&hoven_turret_state->fAE)) { + if (fast_dec_timer_s16(&hoven_turret_state->destruction_explosion_cooldown_frames)) { Vec_304920 explosion_position; float randomized_view_offset_distance; float randomized_view_yaw; @@ -523,9 +527,9 @@ void hoven_turret_update(struct Moby *moby) { 0, -1, 0); - hoven_turret_state->fAE = scale_game_frames(random_int_between(5, 0xD)); + hoven_turret_state->destruction_explosion_cooldown_frames = scale_game_frames(random_int_between(5, 0xD)); } - if (fast_dec_timer_s16(&hoven_turret_state->fAC)) { + if (fast_dec_timer_s16(&hoven_turret_state->destruction_respawn_frames)) { hero_respawn(); } break; From 8b0e50a7b25e8d9200b66eddadffef86f5411c80 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:10:24 +0000 Subject: [PATCH 026/657] decomp: clarify names in extermitank_update domain_0_value_2 -> EXTERMITANK_LIFECYCLE_REMOVE: Retail 00304370 loads owner pvars into s2; 0030437c-00304384 compares byte s2+0x2e with 2. Equality executes 0030438c-003043b8, passing each non-null child from +0x184/+0x188 and then owner s4 to mark_moby_for_removal_c3, and returns before behavior dispatch. This proves the removal lifecycle value of extermitank_vars->lifecycle_state, a separate domain from owner state +0x20 and all supplied hero enums. domain_1_value_1 -> EXTERMITANK_LIFECYCLE_INITIALIZED: Retail 00304408 establishes s0=1; initialization creates children, attaches manipulators, sets motion/path and copies the first node at 00304444-003045ec. Retail 00304644 stores s0 into the owner's private lifecycle byte s2+0x2e alongside health initialization at 00304648-00304660. This is the same private byte tested for removal at 0030437c, distinct from the owner behavior state written at 003045f8. The value identifies the initialized lifecycle status; it does not reuse equal-valued path, hero or vehicle constants. --- src/overlays/l05/mobys/extermitank.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/overlays/l05/mobys/extermitank.c b/src/overlays/l05/mobys/extermitank.c index ef82e595db..10efc88500 100644 --- a/src/overlays/l05/mobys/extermitank.c +++ b/src/overlays/l05/mobys/extermitank.c @@ -148,6 +148,10 @@ typedef struct ExtermitankVars { /* Moby class 625 */ void extermitank_update(unsigned char *moby) { + enum { + EXTERMITANK_LIFECYCLE_INITIALIZED = 1, + EXTERMITANK_LIFECYCLE_REMOVE = 2 + }; ExtermitankVars *extermitank_vars = (ExtermitankVars *)MOBY(moby)->pvars; float origin_position[4]; float particle_vector_a[4]; From b896ff9cbff22ed63953d448c6adea9eb29be6fe Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:10:24 +0000 Subject: [PATCH 027/657] decomp: clarify names in plasmabot_update domain_0_value_2 -> PLASMABOT_TARGET_STATUS_REJECTED: Retail 0x002b1b90..0x002b1b98 reads pvars+0x114 and returns on 2 before traversal. Checked producer 0x002b3294 loads the same moby pvars; 0x002b32cc..0x002b32e4 compares target distance with range +0x234 and stores 2 to +0x114 when range is exceeded. Authoritative update_plasmabot_target already calls this exact field/value PLASMABOT_TARGET_STATUS_REJECTED, proving the same status domain rather than moby state +0x20. domain_1_value_2 -> PLASMABOT_TARGET_STATUS_REJECTED: Retail 0x002b1e14..0x002b1e1c compares pvars+0x114 with 2 to retain FACE_TARGET_AND_WAIT instead of entering forward traversal. Producer 0x002b32d4..0x002b32e4 stores 2 to this same field on distance exceeding target_range +0x234. Authoritative update_plasmabot_target names that assignment PLASMABOT_TARGET_STATUS_REJECTED; reuse its exact status-domain member. domain_2_value_2 -> PLASMABOT_TARGET_STATUS_REJECTED: Retail 0x002b1fac..0x002b1fc4 reads pvars+0x114 and, on 2 with a configured path, selects backward traversal state 8; 0x002b1ff4..0x002b2048 reverses path progress and releases the beam. Checked producer 0x002b32d4..0x002b32e4 stores 2 to +0x114 when target distance exceeds range. Supplied C names the same producer assignment PLASMABOT_TARGET_STATUS_REJECTED, proving reuse for this comparison. --- src/overlays/shared/enemies/plasmabot.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index c6b42fd011..9e252168bb 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -365,6 +365,9 @@ void plasmabot_update(char *moby) __asm__("FUN_L14_002b17d8"); /* Moby class 28 */ void plasmabot_update(char *moby) { + enum { + PLASMABOT_TARGET_STATUS_REJECTED = 2 + }; PlasmabotVars *plasmabot_update_private_vars; char *plasmabot_aim_target_moby; int state; @@ -500,7 +503,7 @@ void plasmabot_update(char *moby) { } case PLASMABOT_WAIT_TO_START_PATH_TRAVERSAL: { float *path; - if (plasmabot_update_private_vars->target_selection_status == 2) + if (plasmabot_update_private_vars->target_selection_status == PLASMABOT_TARGET_STATUS_REJECTED) return; if (fast_dec_timer_s16(&plasmabot_update_private_vars->path_traversal_delay_timer) == 0) return; @@ -579,7 +582,7 @@ void plasmabot_update(char *moby) { k, k, frame_time * 6.2831855f); - if (plasmabot_update_private_vars->target_selection_status == 2) + if (plasmabot_update_private_vars->target_selection_status == PLASMABOT_TARGET_STATUS_REJECTED) break; if (fast_dec_timer_s16(&plasmabot_update_private_vars->path_traversal_delay_timer) == 0) break; @@ -634,7 +637,7 @@ void plasmabot_update(char *moby) { frame_time * 6.2831855f); aim = update_plasmabot_aim_quaternion(moby, 0, MOBY(moby)->rot.z); update_plasmabot_aim_joint_rotation(moby, ang); - if (plasmabot_update_private_vars->target_selection_status == 2) { + if (plasmabot_update_private_vars->target_selection_status == PLASMABOT_TARGET_STATUS_REJECTED) { if (plasmabot_update_private_vars->path_index == -1) break; ((unsigned char *)moby)[0x20] = 8; From 7bde1178932e2c67d3851de74fbb2737d6f3f8e7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:12:45 +0000 Subject: [PATCH 028/657] decomp: clarify names in frog_update domain_2_value_2 -> FROG_TARGET_MODE_NO_PURSUIT_TARGET: Retail 0x002e8ea0..0x002e8eb4 reads pvars+0x1C4 and skips ordinary approach selection when it equals 2. frog_update calls update_frog_health_respawn_and_target at 0x002e8764 before this read. That helper writes the identical pvars+0x1C4 target_mode field with FROG_TARGET_MODE_NO_PURSUIT_TARGET when automatic selection yields no target or rejects it (checked 0x002e9854..0x002e985c and 0x002e98c4..0x002e98d0). Thus this is the established frog target-mode domain, not a hero state or control mode. domain_3_value_2 -> FROG_TARGET_MODE_NO_PURSUIT_TARGET: Retail 0x002e9034..0x002e9048 compares pvars+0x1C4 with 2 during APPROACH_TARGET and redirects to RETURN_HOME. The preceding health/target helper call at 0x002e8764 owns that same target_mode field; its supplied C assigns FROG_TARGET_MODE_NO_PURSUIT_TARGET for absent/rejected targets, confirmed by checked writes at 0x002e9854..0x002e985c and 0x002e98c4..0x002e98d0. Reuse that canonical same-domain member for this comparison. domain_4_value_2 -> FROG_TARGET_MODE_NO_PURSUIT_TARGET: Retail 0x002e9450..0x002e9464 reads pvars+0x1C4 during RETURN_HOME and resumes APPROACH_TARGET only when it differs from 2. This is the same pursuit_target_mode/RespawnVars.target_mode storage written by update_frog_health_respawn_and_target, called at 0x002e8764. Its supplied source and checked writes 0x002e9854..0x002e985c and 0x002e98c4..0x002e98d0 identify 2 as FROG_TARGET_MODE_NO_PURSUIT_TARGET for missing/rejected targets. --- src/overlays/shared/enemies/frog.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index 1d4f215ba4..e89a607f30 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -257,6 +257,9 @@ void frog_update(unsigned char *moby) { enum { FROG_STATE_RESPAWN = 0xF }; + enum { + FROG_TARGET_MODE_NO_PURSUIT_TARGET = 2 + }; float A[4] __attribute__((aligned(16))); float B[4] __attribute__((aligned(16))); float C[4] __attribute__((aligned(16))); @@ -481,7 +484,7 @@ void frog_update(unsigned char *moby) { fast_vec_normalize(B, moby + 0xC0, frog_instance_vars->movement_speed * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, B, 1, 0.3f, 0.3f); } - if (frog_instance_vars->pursuit_target_mode != 2 && random_integer_below(9) == 0) { + if (frog_instance_vars->pursuit_target_mode != FROG_TARGET_MODE_NO_PURSUIT_TARGET && random_integer_below(9) == 0) { frog_instance_vars->turn_angle = random_float_between(-frog_instance_vars->turn_range_degrees, frog_instance_vars->turn_range_degrees) * @@ -515,7 +518,7 @@ void frog_update(unsigned char *moby) { MOBY(moby)->state = FROG_STATE_ATTACK; if (MOBY(moby)->prev_seq != 5) blend_moby_animation(moby, 5, 4, scale_game_frames(10)); - } else if (frog_instance_vars->pursuit_target_mode == 2) { + } else if (frog_instance_vars->pursuit_target_mode == FROG_TARGET_MODE_NO_PURSUIT_TARGET) { MOBY(moby)->state = FROG_STATE_RETURN_HOME; } break; @@ -597,7 +600,7 @@ void frog_update(unsigned char *moby) { MOBY(moby)->state = FROG_STATE_WANDER; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(10)); - } else if (frog_instance_vars->pursuit_target_mode != 2) { + } else if (frog_instance_vars->pursuit_target_mode != FROG_TARGET_MODE_NO_PURSUIT_TARGET) { MOBY(moby)->state = FROG_STATE_APPROACH_TARGET; } else if (frog_instance_vars->blink_countdown != 0) { MOBY(moby)->state = FROG_STATE_BLINKING_APPROACH_TARGET; From 73b5b3b5a06aba76030580456c8f095488253288 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:14:41 +0000 Subject: [PATCH 029/657] decomp: clarify names in FUN_L00_002dc9f0 domain_0_value_253 -> MOBY_STATE_ALTERNATE_REMOVAL_MARKER: Retail 0x002dc9fc preserves the Moby argument in s4; 0x002dca34 loads its state byte at +0x20, and 0x002dca40-0x002dca44 compares that same byte with 0xFD and returns before record lookup. The authoritative C explicitly selects moby->state beside MOBY_STATE_REMOVAL_MARKER, establishing the MobyRemovalState domain rather than suction record state +0x68 or hero control mode. Supplied naming_enum_domains identifies the canonical equal-valued member MOBY_STATE_ALTERNATE_REMOVAL_MARKER in include/rnc/mobys/moby_state.h; reuse it for this proven domain. --- src/overlays/shared/weapons/suckcannon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index e9a2219f2c..793e1819cd 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -2280,7 +2280,7 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { Frame_2DDEA0 suction_and_projectile_scratch; R_2DDEA0 *suction_and_projectile_record; - if (moby == 0 || moby->state == MOBY_STATE_REMOVAL_MARKER || moby->state == 0xFD) + if (moby == 0 || moby->state == MOBY_STATE_REMOVAL_MARKER || moby->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER) return 0; suction_and_projectile_record = func_L00_002DCD40_2DDEA0(moby); if (suction_and_projectile_record != 0) { From 18f57e5fcc6bb7de2ebeec397992d25a29df8917 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:18:30 +0000 Subject: [PATCH 030/657] decomp: clarify names in large_amoeboid_update domain_0_value_2 -> AMOEBOID_TARGET_STATUS_UNAVAILABLE: Retail 002edfc4..002ee014 accesses pvars+0x204, the target_selection_status field, separate from moby+0x20 current state. Supplied process_amoeboid_hits_and_update_targeting uses AMOEBOID_TARGET_STATUS_UNAVAILABLE=2 for this identical field when the search is out of bounds, and replaces it with ALTERNATE_MOBY=1 on a valid alternate target. Update also writes 2 on path failure and tests it to choose return/direct pursuit. Reuse that target-status meaning, not equal-valued moby state LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION. domain_1_value_2 -> AMOEBOID_TARGET_STATUS_UNAVAILABLE: Retail 002ee078 accesses pvars+0x204, the target_selection_status field, separate from moby+0x20 current state. Supplied process_amoeboid_hits_and_update_targeting uses AMOEBOID_TARGET_STATUS_UNAVAILABLE=2 for this identical field when the search is out of bounds, and replaces it with ALTERNATE_MOBY=1 on a valid alternate target. Update also writes 2 on path failure and tests it to choose return/direct pursuit. Reuse that target-status meaning, not equal-valued moby state LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION. domain_2_value_2 -> AMOEBOID_TARGET_STATUS_UNAVAILABLE: Retail 002ee080..002ee0a4 accesses pvars+0x204, the target_selection_status field, separate from moby+0x20 current state. Supplied process_amoeboid_hits_and_update_targeting uses AMOEBOID_TARGET_STATUS_UNAVAILABLE=2 for this identical field when the search is out of bounds, and replaces it with ALTERNATE_MOBY=1 on a valid alternate target. Update also writes 2 on path failure and tests it to choose return/direct pursuit. Reuse that target-status meaning, not equal-valued moby state LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION. domain_3_value_2 -> AMOEBOID_TARGET_STATUS_UNAVAILABLE: Retail 002ee270 accesses pvars+0x204, the target_selection_status field, separate from moby+0x20 current state. Supplied process_amoeboid_hits_and_update_targeting uses AMOEBOID_TARGET_STATUS_UNAVAILABLE=2 for this identical field when the search is out of bounds, and replaces it with ALTERNATE_MOBY=1 on a valid alternate target. Update also writes 2 on path failure and tests it to choose return/direct pursuit. Reuse that target-status meaning, not equal-valued moby state LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION. domain_4_value_2 -> AMOEBOID_TARGET_STATUS_UNAVAILABLE: Retail 002ee274..002ee298 accesses pvars+0x204, the target_selection_status field, separate from moby+0x20 current state. Supplied process_amoeboid_hits_and_update_targeting uses AMOEBOID_TARGET_STATUS_UNAVAILABLE=2 for this identical field when the search is out of bounds, and replaces it with ALTERNATE_MOBY=1 on a valid alternate target. Update also writes 2 on path failure and tests it to choose return/direct pursuit. Reuse that target-status meaning, not equal-valued moby state LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION. domain_5_value_2 -> AMOEBOID_TARGET_STATUS_UNAVAILABLE: Retail 002ee5fc..002ee600 accesses pvars+0x204, the target_selection_status field, separate from moby+0x20 current state. Supplied process_amoeboid_hits_and_update_targeting uses AMOEBOID_TARGET_STATUS_UNAVAILABLE=2 for this identical field when the search is out of bounds, and replaces it with ALTERNATE_MOBY=1 on a valid alternate target. Update also writes 2 on path failure and tests it to choose return/direct pursuit. Reuse that target-status meaning, not equal-valued moby state LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION. domain_6_value_2 -> AMOEBOID_TARGET_STATUS_UNAVAILABLE: Retail 002ee604..002ee618 accesses pvars+0x204, the target_selection_status field, separate from moby+0x20 current state. Supplied process_amoeboid_hits_and_update_targeting uses AMOEBOID_TARGET_STATUS_UNAVAILABLE=2 for this identical field when the search is out of bounds, and replaces it with ALTERNATE_MOBY=1 on a valid alternate target. Update also writes 2 on path failure and tests it to choose return/direct pursuit. Reuse that target-status meaning, not equal-valued moby state LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION. domain_7_value_2 -> AMOEBOID_TARGET_STATUS_UNAVAILABLE: Retail 002ee9dc..002ee9f8 accesses pvars+0x204, the target_selection_status field, separate from moby+0x20 current state. Supplied process_amoeboid_hits_and_update_targeting uses AMOEBOID_TARGET_STATUS_UNAVAILABLE=2 for this identical field when the search is out of bounds, and replaces it with ALTERNATE_MOBY=1 on a valid alternate target. Update also writes 2 on path failure and tests it to choose return/direct pursuit. Reuse that target-status meaning, not equal-valued moby state LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION. unk178 -> max_ground_drop: Assigned 002edf30 initializes pvars+0x178 to 2.0 and 002ee19c passes block +0x170 to mover. Checked mover 0026dda4..0026ddb4 reads block+8 and compares it against old position Z minus ground height; exceeding it takes 0026ddd4..0026ddd8, rejecting the move and restoring old position. This is the permitted downward ground-height difference. unk17C -> max_ground_rise: Assigned 002edf3c initializes pvars+0x17c to 2.0 in movement block +0x170. Checked mover 0026ddbc..0026ddd8 compares ground height minus old position Z against block+0xc, and restores old position if that limit is exceeded. This proves the maximum permitted ground rise. unk194 -> horizontal_speed_limit: Assigned 002edf48..002edf5c stores pvars+0x23c * frame_time at +0x194, half at 002ee0dc..002ee0e4 and double on lunge entry 002ee4b0..002ee4b8. Checked mover receives +0x170; 0026da0c..0026da1c reads block+0x24, and 0026da7c..0026daa4 clamps signed horizontal movement speed block+0x10 to plus/minus that limit before cos/sin displacement at 0026dab8..0026daf0. unk220 -> yaw_step: Assigned 002ee14c..002ee174 passes moby+0x48 yaw and pvars+0x220 to approach_angle, repeated for pursuit/lunge. Checked helper saves second pointer in s0 at 00270cd4, reads its float at 00270d10 and adjusts it to brake/accelerate; 00270e54..00270e60 loads that float and adds it to current yaw through fast_add_rotations, storing updated yaw. It holds the persistent angular step used for yaw smoothing; the u8[4] storage type remains unchanged. unk23C -> base_movement_speed: Original retail and source 002edf48..002edf5c read +0x23c, multiply by frame_time and store +0x194. Path acquisition halves this rate (002ee0c4..002ee0e4), lunge entry doubles it (002ee4a4..002ee4b8), and 002ee828..002ee83c restores it. Checked mover uses +0x194 as the horizontal speed clamp, establishing +0x23c as the unscaled base movement speed. unk25C -> activation_volume_index: Assigned 002edf78..002edf8c uses -1 to select dormancy; 002eebc0..002eebc8 passes +0x25c and player position to the activation test before restoring visibility/collision. Checked helper 00274824..00274844 rejects -1, shifts this index by 7 and adds the volume table base; 0027484c..002748dc transforms position relative to indexed volume and checks all three coordinates within [-1,1]. --- src/overlays/shared/enemies/large_amoeboid.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index 2b56cdf005..1e062fd34b 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -236,6 +236,9 @@ void large_amoeboid_update(unsigned char *moby) { enum { LARGE_AMOEBOID_DORMANT = 12 }; + enum { + AMOEBOID_TARGET_STATUS_UNAVAILABLE = 2 + }; LargeAmoeboidVars *large_amoeboid_vars = (LargeAmoeboidVars *)MOBY(moby)->pvars; char *target; char *target_position; @@ -317,7 +320,7 @@ void large_amoeboid_update(unsigned char *moby) { } break; case LARGE_AMOEBOID_TRY_ACQUIRE_TARGET_PATH: - if (large_amoeboid_vars->target_selection_status != 2) { + if (large_amoeboid_vars->target_selection_status != AMOEBOID_TARGET_STATUS_UNAVAILABLE) { if (FUN_00213260(4) == 0) { path_hit = follow_path((int *)(&large_amoeboid_vars->path_ids), 1, @@ -334,7 +337,7 @@ void large_amoeboid_update(unsigned char *moby) { large_amoeboid_vars->path_heading_offset = random_float_between(-0.34906584f, 0.34906584f); } else { - large_amoeboid_vars->target_selection_status = 2; + large_amoeboid_vars->target_selection_status = AMOEBOID_TARGET_STATUS_UNAVAILABLE; } } } @@ -387,7 +390,7 @@ void large_amoeboid_update(unsigned char *moby) { large_amoeboid_vars->path_heading_offset = angle; large_amoeboid_vars->move_control.max_speed = distance; } else { - large_amoeboid_vars->target_selection_status = 2; + large_amoeboid_vars->target_selection_status = AMOEBOID_TARGET_STATUS_UNAVAILABLE; } } if (large_amoeboid_vars->pursuit_timer != 0 && @@ -488,9 +491,9 @@ void large_amoeboid_update(unsigned char *moby) { &large_amoeboid_vars->move_displacement, 1.0f); } else { - large_amoeboid_vars->target_selection_status = 2; + large_amoeboid_vars->target_selection_status = AMOEBOID_TARGET_STATUS_UNAVAILABLE; } - if (large_amoeboid_vars->target_selection_status == 2) + if (large_amoeboid_vars->target_selection_status == AMOEBOID_TARGET_STATUS_UNAVAILABLE) MOBY(moby)->state = LARGE_AMOEBOID_RETURN_TO_STORED_POSITION; spawn_amoeboid_movement_particles(moby); return; @@ -595,7 +598,7 @@ void large_amoeboid_update(unsigned char *moby) { &large_amoeboid_vars->move_displacement, 1.0f); } - if (large_amoeboid_vars->target_selection_status != 2 && + if (large_amoeboid_vars->target_selection_status != AMOEBOID_TARGET_STATUS_UNAVAILABLE && (MOBY(moby)->state = 4, MOBY(moby)->prev_seq != 1)) blend_moby_animation(moby, 1, 0, scale_game_frames(3)); spawn_amoeboid_movement_particles(moby); From a2e829ead7fd7ce08bcae30a2a88ac4b7af22090 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:22:36 +0000 Subject: [PATCH 031/657] decomp: clarify names in blarg_paratrooper_update domain_2_value_2 -> PARATROOPER_REMOVAL_REQUESTED: The selector is the private byte removal_status at moby->pvars+0x2E, not the moby state, target availability or hero domain. Retail 0x00301310-0x00301338 compares that byte to 2 outside initialization; equality immediately calls mark_moby_for_removal on the paratrooper and its nonnull bone attachment, then returns. Thus 2 requests removal of this instance and attachment. fE0 -> waypoint_advance_distance: Retail 0x00301584-0x003015C4 computes XY distance to destination_waypoint_index in the patrol path, compares it with private +0xE0 and advances the waypoint when below it. 0x003016B8-0x00301700 uses the same threshold to finish APPROACH_WAYPOINT, and boundary/arrival branches clear it. Thus this is a waypoint advance distance, without asserting its producer or units. fF8 -> movement_heading_error_limit: Assigned retail 0x00301470 initializes private +0xF8 to 0.34906584; 0x00301604/0x00301704 passes private+0xD0 as movement_control to 0x002635A0. Checked helper 0x00263638-0x00263658 computes target-heading versus moby yaw error and compares control+0x28 (=private+0xF8), setting flag 0x10 at the limit. 0x00263664-0x002636C0 gates movement and computes (limit-error)/limit from the same field. fFC -> movement_arrival_distance: Assigned retail 0x00301474 stores 0.2 to private +0xFC and 0x00301600-0x00301618 passes private+0xD0 and the destination waypoint to movement helper 0x002635A0. Checked helper 0x002635DC-0x002635F8 measures moby-position distance to that target, compares it with control+0x2C (=private+0xFC) and sets arrival-result bit 4 when below it, matching supplied step_mover_2e3f20 context. --- src/overlays/shared/enemies/blarg_paratrooper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/blarg_paratrooper.c b/src/overlays/shared/enemies/blarg_paratrooper.c index 6dd2f0e54b..c48beb5daf 100644 --- a/src/overlays/shared/enemies/blarg_paratrooper.c +++ b/src/overlays/shared/enemies/blarg_paratrooper.c @@ -163,6 +163,9 @@ void blarg_paratrooper_update(char *moby) { enum { PARATROOPER_TARGET_UNAVAILABLE = 2 }; + enum { + PARATROOPER_REMOVAL_REQUESTED = 2 + }; Paratrooper302618 *paratrooper_private_state = (Paratrooper302618 *)(*(char **)((char *)(moby) + 0x78)); char *path; @@ -199,7 +202,7 @@ void blarg_paratrooper_update(char *moby) { (*(unsigned char *)((char *)(moby) + 0x20)) = 8; } if ((*(unsigned char *)((char *)(moby) + 0x20)) != 0 && - paratrooper_private_state->removal_status == 2) { + paratrooper_private_state->removal_status == PARATROOPER_REMOVAL_REQUESTED) { mark_moby_for_removal(moby); if (paratrooper_private_state->bone_attachment_moby) mark_moby_for_removal(paratrooper_private_state->bone_attachment_moby); From bf8172dd03bd4fc8325e7981ceca57efaf91889f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:25:19 +0000 Subject: [PATCH 032/657] decomp: clarify names in sand_shark_update domain_0_value_1 -> SAND_SHARK_RELAUNCH_REQUEST_CONSUMED: Retail 0x002d3fe0 loads 1 into s0 and 0x002d3ff8 stores it to pvars+0x2e. Checked level-02 helper 0x002d5cac loads the same moby pvars; 0x002d5cc4-0x002d5cdc tests request byte +0x2e for pending 2 and consumes it by writing 1 before selecting a relaunch moby and entering inactive state 26. Supplied handle_sand_shark_damage_and_targeting names this exact byte/value SAND_SHARK_RELAUNCH_REQUEST_CONSUMED; this is a request domain, separate from moby->state. domain_3_value_2 -> SAND_SHARK_TARGET_SELECTION_EXCLUDED: Retail 0x002d4344-0x002d4348 (wander branch) reads int pvars+0x214 and compares it with 2, gating target pursuit/reacquisition. The pre-dispatch call at 0x002d3f08 passes this same moby to checked helper 0x002d5c88; helper 0x002d5cac obtains its pvars and 0x002d6098/0x002d60c8 writes 2 to +0x214 when home-to-target range or absolute target-height difference excludes pursuit. Supplied Vars5c88 and handle_sand_shark_damage_and_targeting identify the identical field/value as SAND_SHARK_TARGET_SELECTION_EXCLUDED. This is target-selection status, not a moby or hero state. domain_4_value_2 -> SAND_SHARK_TARGET_SELECTION_EXCLUDED: Retail 0x002d4458-0x002d4460 (wait-for-target-volume branch) reads int pvars+0x214 and compares it with 2, gating target pursuit/reacquisition. The pre-dispatch call at 0x002d3f08 passes this same moby to checked helper 0x002d5c88; helper 0x002d5cac obtains its pvars and 0x002d6098/0x002d60c8 writes 2 to +0x214 when home-to-target range or absolute target-height difference excludes pursuit. Supplied Vars5c88 and handle_sand_shark_damage_and_targeting identify the identical field/value as SAND_SHARK_TARGET_SELECTION_EXCLUDED. This is target-selection status, not a moby or hero state. domain_5_value_2 -> SAND_SHARK_TARGET_SELECTION_EXCLUDED: Retail 0x002d4634-0x002d463c (path-proximity approach branch) reads int pvars+0x214 and compares it with 2, gating target pursuit/reacquisition. The pre-dispatch call at 0x002d3f08 passes this same moby to checked helper 0x002d5c88; helper 0x002d5cac obtains its pvars and 0x002d6098/0x002d60c8 writes 2 to +0x214 when home-to-target range or absolute target-height difference excludes pursuit. Supplied Vars5c88 and handle_sand_shark_damage_and_targeting identify the identical field/value as SAND_SHARK_TARGET_SELECTION_EXCLUDED. This is target-selection status, not a moby or hero state. domain_6_value_2 -> SAND_SHARK_TARGET_SELECTION_EXCLUDED: Retail 0x002d4718-0x002d4720 (face-target branch) reads int pvars+0x214 and compares it with 2, gating target pursuit/reacquisition. The pre-dispatch call at 0x002d3f08 passes this same moby to checked helper 0x002d5c88; helper 0x002d5cac obtains its pvars and 0x002d6098/0x002d60c8 writes 2 to +0x214 when home-to-target range or absolute target-height difference excludes pursuit. Supplied Vars5c88 and handle_sand_shark_damage_and_targeting identify the identical field/value as SAND_SHARK_TARGET_SELECTION_EXCLUDED. This is target-selection status, not a moby or hero state. domain_7_value_2 -> SAND_SHARK_TARGET_SELECTION_EXCLUDED: Retail 0x002d4ab4-0x002d4abc (approach-target branch) reads int pvars+0x214 and compares it with 2, gating target pursuit/reacquisition. The pre-dispatch call at 0x002d3f08 passes this same moby to checked helper 0x002d5c88; helper 0x002d5cac obtains its pvars and 0x002d6098/0x002d60c8 writes 2 to +0x214 when home-to-target range or absolute target-height difference excludes pursuit. Supplied Vars5c88 and handle_sand_shark_damage_and_targeting identify the identical field/value as SAND_SHARK_TARGET_SELECTION_EXCLUDED. This is target-selection status, not a moby or hero state. domain_8_value_2 -> SAND_SHARK_TARGET_SELECTION_EXCLUDED: Retail 0x002d4fa8-0x002d4fb0 (return-home reacquisition branch) reads int pvars+0x214 and compares it with 2, gating target pursuit/reacquisition. The pre-dispatch call at 0x002d3f08 passes this same moby to checked helper 0x002d5c88; helper 0x002d5cac obtains its pvars and 0x002d6098/0x002d60c8 writes 2 to +0x214 when home-to-target range or absolute target-height difference excludes pursuit. Supplied Vars5c88 and handle_sand_shark_damage_and_targeting identify the identical field/value as SAND_SHARK_TARGET_SELECTION_EXCLUDED. This is target-selection status, not a moby or hero state. --- src/overlays/l02/mobys/sand_shark.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 099c6506ec..647565ef36 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -297,6 +297,10 @@ void sand_shark_update(struct Moby *moby) { enum { SAND_SHARK_LANDED_AFTER_KNOCKBACK = 0xB }; + enum { + SAND_SHARK_RELAUNCH_REQUEST_CONSUMED = 1, + SAND_SHARK_TARGET_SELECTION_EXCLUDED = 2 + }; Varsd3e50 *sand_shark_behavior_vars; OvlVec4 position_or_offset_scratch; OvlVec4 target_or_particle_vector; @@ -426,7 +430,7 @@ void sand_shark_update(struct Moby *moby) { FUN_L02_002d5a68_e50(&target_or_particle_vector); } moby->pos.z -= sand_shark_height_offset_gp; - if (sand_shark_behavior_vars->target_selection_status != 2) { + if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED) { if (sand_shark_behavior_vars->wander_target_volume_index >= 0) { if ((!is_point_inside_clip_volume( &sand_shark_behavior_vars->target, @@ -465,7 +469,7 @@ void sand_shark_update(struct Moby *moby) { } break; case SAND_SHARK_WAIT_FOR_TARGET_IN_VOLUME: - if (sand_shark_behavior_vars->target_selection_status != 2 && + if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED && is_point_inside_clip_volume(&sand_shark_behavior_vars->target, sand_shark_behavior_vars->target_activation_volume_index)) { moby->state = SAND_SHARK_APPROACH_TARGET; @@ -515,7 +519,7 @@ void sand_shark_update(struct Moby *moby) { if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(0xA)); } - } else if (sand_shark_behavior_vars->target_selection_status != 2) { + } else if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED) { moby->state = SAND_SHARK_APPROACH_TARGET; if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0xF)); @@ -540,7 +544,7 @@ void sand_shark_update(struct Moby *moby) { if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(0xA)); } - } else if (sand_shark_behavior_vars->target_selection_status != 2) { + } else if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED) { moby->state = SAND_SHARK_APPROACH_TARGET; if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0xF)); @@ -643,7 +647,7 @@ void sand_shark_update(struct Moby *moby) { if (moby->state == SAND_SHARK_APPROACH_TARGET_WITH_HEIGHT_OFFSET) { moby->pos.z -= sand_shark_height_offset_gp; } - if (sand_shark_behavior_vars->target_selection_status != 2) { + if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED) { if (sand_shark_behavior_vars->target_activation_volume_index >= 0 && !is_point_inside_clip_volume( &sand_shark_behavior_vars->target, @@ -760,7 +764,7 @@ void sand_shark_update(struct Moby *moby) { } } if (sand_shark_behavior_vars->outside_path_return_active == 0) { - if (sand_shark_behavior_vars->target_selection_status != 2) { + if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED) { fast_vec_sub(&target_home_delta, &sand_shark_behavior_vars->target, &sand_shark_behavior_vars->home); From 50ead6477326b0e15b1ad2a525d7681f6c391520 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:27:18 +0000 Subject: [PATCH 033/657] decomp: clarify names in blarg_trooper_update v14 -> hit_flags: Shot5BD0.v14 receives integer 1 in melee hit construction: retail 002c5ee4 sets s0=1 and 002c5f18 stores it at sp+0xB4, input block sp+0xA0 +0x14; 002c5f74-002c5f7c passes that block to record_moby_hit. Checked level-04 helper 0024cb8c-0024cb90 copies input+0x14 to hit-record+0x24 (request b180de6e17ea419d88d55d44c9b6847b). Checked find_moby_hit 0024d478 loads this exact record+0x24 word, 0024d484 ANDs it with caller mask a1, and 0024d488-0024d4a4 returns the record only for nonzero overlap (request 8e77e27f3ef143c68341ff99826a39db). These operations prove hit flags tested for eligibility, not a scalar damage amount; individual bit meanings are unresolved. --- src/overlays/l04/mobys/blarg_trooper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l04/mobys/blarg_trooper.c b/src/overlays/l04/mobys/blarg_trooper.c index 9cadde9338..9d54efa9c6 100644 --- a/src/overlays/l04/mobys/blarg_trooper.c +++ b/src/overlays/l04/mobys/blarg_trooper.c @@ -126,7 +126,7 @@ struct Shot5BD0 { float hit_direction_z; float fC; void *p10; - int v14; + int hit_flags; char c18; char c19; short hit_source_class; @@ -718,7 +718,7 @@ void blarg_trooper_update(struct Moby *moby) { update_scratch.w.p.blk.f4 = fast_sin(moby->rot.z) * 0.2f; update_scratch.w.p.blk.hit_direction_z = 0.0f; update_scratch.w.p.blk.p10 = moby; - update_scratch.w.p.blk.v14 = 1; + update_scratch.w.p.blk.hit_flags = 1; update_scratch.w.p.blk.f1C = 1.0f; set_vector_length_xy(&update_scratch.w.p.blk, &update_scratch.w.p.blk, 1.0f); update_scratch.w.p.blk.hit_direction_z = 1.0f; From b6db374dcd15fd66ed8df2869f8c1f62dc25bf26 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:27:19 +0000 Subject: [PATCH 034/657] decomp: clarify names in circular_saw_enemy_update domain_0_value_0 -> CIRCULAR_SAW_POINT_ATTACK_APPROACH_AND_ALIGN: Authoritative C assigns data->point_attack_phase on entry to POINT_ATTACK after selecting a configured cuboid. Retail 002c2fc0-002c2fcc stores the cuboid index, state 5 and zero at pvars+0x15a. The identical short is dispatched at 002c3334-002c3350; its existing phase-0 branch at 002c336c-002c3458 approaches the cuboid position and aligns yaw. Reuse the already declared constant in this exact selector domain. domain_1_value_1 -> CIRCULAR_SAW_POINT_ATTACK_ATTACK: Source assigns data->point_attack_phase=1 only after the phase-0 cuboid distance and yaw gates. Retail 002c3400-002c3458 checks distance <1 and yaw error <0.17453292 then stores 1 at pvars+0x15a. The same short's dispatch at 002c3334-002c333c routes 1 to 002c3464, which plays sequence 7 until completion. This is the existing CIRCULAR_SAW_POINT_ATTACK_ATTACK member of the same field's enum domain. domain_2_value_2 -> CIRCULAR_SAW_POINT_ATTACK_TURN_TO_PATH: Source assigns data->point_attack_phase=2 after attack sequence completion and clearing yaw_turn_step. Retail 002c34bc-002c34f0 tests completion, blends idle, clears pvars+0x130 and stores 2 at +0x15a. Dispatch 002c335c selects 002c34f4 for this short's value 2; that branch turns toward the current patrol point and restores FOLLOW_PATH at 002c35dc. Reuse the existing CIRCULAR_SAW_POINT_ATTACK_TURN_TO_PATH constant for this exact domain. --- src/overlays/l04/mobys/circular_saw_enemy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l04/mobys/circular_saw_enemy.c b/src/overlays/l04/mobys/circular_saw_enemy.c index 5a2adf72d9..96fc433bc7 100644 --- a/src/overlays/l04/mobys/circular_saw_enemy.c +++ b/src/overlays/l04/mobys/circular_saw_enemy.c @@ -850,7 +850,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { is_point_inside_clip_volume(moby->pos, data->point_attack_cuboid_indices[i]) != 0) { data->f158 = data->point_attack_cuboid_indices[i]; moby->state = CIRCULAR_SAW_STATE_POINT_ATTACK; - data->point_attack_phase = 0; + data->point_attack_phase = CIRCULAR_SAW_POINT_ATTACK_APPROACH_AND_ALIGN; break; } } @@ -917,7 +917,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { if (vector_distance_xy(moby->pos, dest) < 1.0f) { if (fast_difference_between_rotations(moby->rot, l04_cuboids[data->f158].rot.z) < 0.17453292f) { - data->point_attack_phase = 1; + data->point_attack_phase = CIRCULAR_SAW_POINT_ATTACK_ATTACK; } } break; @@ -929,7 +929,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { } else if (moby->f70 & 2) { blend_moby_animation(moby, 0, 0, (void *)scale_game_frames(10)); data->yaw_turn_step = 0.0f; - data->point_attack_phase = 2; + data->point_attack_phase = CIRCULAR_SAW_POINT_ATTACK_TURN_TO_PATH; } break; case CIRCULAR_SAW_POINT_ATTACK_TURN_TO_PATH: { From 99cc6040168417d00349845092d692df61fecda1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:27:25 +0000 Subject: [PATCH 035/657] decomp: clarify names in woodcut_bot_update fB0 -> hit_response_interpolation_state: Assigned retail 0x002d1a84-0x002d1a94 and 0x002d1be0-0x002d1bec pass d+0xB0 after hit reactions; 0x002d3270-0x002d3274 updates it each frame. Checked helpers c00c1d9c1f14443cadf4c74e14528e53 and b98fc1ea10c64988bf0f92016caad2cc bind this pointer to s1/s0: 0x002504a0-0x002504c8 initializes a short timer/phase, 0x00250538-0x0025054c saves a byte triplet, and 0x00250594-0x002507ac decrements the timer and interpolates that triplet before applying it to the moby. The seven-byte array is the timer/phase/saved-triplet prefix of this hit-response interpolation state; exact visual channels are unclaimed. fBC -> movement_recovery_flags: Retail 0x002d1b24-0x002d1b2c sets moby+0xBC bits 1 and 4 on hit recovery. 0x002d2690-0x002d26ac consumes bit 8 to reset the leg rig on movement entry; 0x002d2bd4-0x002d2be4 consumes bit 4 before reposition selection. 0x002d3010 and 0x002d30ac test bit 0x10 to select turning toward the saved position, and 0x002d309c-0x002d30a8 clears it and sets movement-entry bit 8. C follows these same bitwise movement/recovery control flows. fC0 -> knockback_motion_vector: Retail 0x002d1a48-0x002d1a50 passes d+0xC0 to trooper_start_knockback; checked helper f8d1d89217b1425faf85af012ac7f433 binds it to s0 at 0x0024f5c0. 0x0024f5c4-0x0024f608 writes horizontal cosine/sine components to record+0/+4, vertical step to +8 and 1.0 to +0xC. Thus this char[0x10] stores the knockback motion vector. 0x002d3188-0x002d3190 passes the same storage to step_moby_motion during death knockback. fD0 -> knockback_gravity_decrement: Assigned 0x002d194c-0x002d1984 stores frame_time_sq*30 at d+0xD0. Checked motion helper abead86447094403ba68d92a9f882130 receives d+0xC0 in s2 at 0x0024f6e8; 0x0024f704-0x0024f718 subtracts record+0x10, exactly d+0xD0, from vertical motion record+8 and stores the reduced vertical step. This proves a per-update downward knockback gravity decrement; distinct spelling preserves the existing local knockback_gravity_step. fD8 -> knockback_horizontal_step: Assigned 0x002d1960-0x002d1990 initializes d+0xD8 from frame_time*5.5; death reaction overwrites it with frame_time*7 and passes its address to arc setup at 0x002d19fc-0x002d1a30. Checked start helper f8d1d89217b1425faf85af012ac7f433 at 0x0024f5c4-0x0024f608 multiplies record+0x18 (d+0xD8) by cosine/sine of the supplied bearing to initialize motion X/Y. This proves the horizontal knockback step magnitude. fDC -> knockback_vertical_step_limit: Assigned 0x002d1a14-0x002d1a30 stores frame_time*13 at d+0xDC and passes its address to arc setup. Checked start helper f8d1d89217b1425faf85af012ac7f433 loads record+0x1C at 0x0024f5e0 and writes it to vertical motion +8 at 0x0024f5fc. Checked motion helper abead86447094403ba68d92a9f882130 at 0x0024f76c-0x0024f780 compares vertical motion +8 with record+0x1C and caps it to that field when larger. Thus d+0xDC supplies both initial vertical step and its upper limit. fE4 -> knockback_motion_flags: Retail 0x002d197c stores 9 at d+0xE4 before passing d+0xC0 to knockback start/update. In checked helper f8d1d89217b1425faf85af012ac7f433, d+0xE4 is record+0x24: 0x0024f638-0x0024f65c tests/sets bit 0x20 and 0x0024f664-0x0024f69c tests bit 2 to choose animation setup. Checked motion helper abead86447094403ba68d92a9f882130 also tests record+0x24 bit 0x10 at 0x0024f840-0x0024f844. These bitwise consumers prove knockback motion control flags without asserting each bit's full meaning. fE8 -> knockback_ground_probe_z_offset: Assigned 0x002d1874-0x002d1890 stores 0.35 at d+0xE8. Checked motion helper abead86447094403ba68d92a9f882130 binds d+0xC0 to s2 at 0x0024f6e8. At 0x0024f784-0x0024f7b8 it copies moby position to sp+0x10, loads record+0x28 (d+0xE8), adds it to copied position Z at sp+0x18, and calls the same ground-height probe used by the assigned C. This proves a Z offset for the knockback ground probe. --- src/overlays/l04/mobys/woodcut_bot.c | 82 ++++++++++++++-------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index 346d435636..f11992e278 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -177,17 +177,17 @@ typedef struct WBData { /* 0x059 */ char pad059; /* 0x05A */ unsigned char f5A; /* 0x05B */ char pad05B[0x55]; - /* 0x0B0 */ char fB0[7]; + /* 0x0B0 */ char hit_response_interpolation_state[7]; /* 0x0B7 */ unsigned char fB7; /* 0x0B8 */ char pad0B8[8]; - /* 0x0C0 */ char fC0[0x10]; - /* 0x0D0 */ float fD0; + /* 0x0C0 */ char knockback_motion_vector[0x10]; + /* 0x0D0 */ float knockback_gravity_decrement; /* 0x0D4 */ float fD4; - /* 0x0D8 */ float fD8; - /* 0x0DC */ float fDC; + /* 0x0D8 */ float knockback_horizontal_step; + /* 0x0DC */ float knockback_vertical_step_limit; /* 0x0E0 */ int fE0; - /* 0x0E4 */ int fE4; - /* 0x0E8 */ float fE8; + /* 0x0E4 */ int knockback_motion_flags; + /* 0x0E8 */ float knockback_ground_probe_z_offset; /* 0x0EC */ char pad0EC[0x11]; /* 0x0FD */ unsigned char fFD; /* 0x0FE */ char pad0FE[0x12]; @@ -240,7 +240,7 @@ typedef struct WBMoby { /* 0x80 */ char pad80[0x24]; /* 0xA4 */ unsigned char fA4; /* 0xA5 */ char padA5[0x17]; - /* 0xBC */ unsigned char fBC; + /* 0xBC */ unsigned char movement_recovery_flags; } WBMoby; typedef struct WBQuery { @@ -371,7 +371,7 @@ void woodcut_bot_update(WBMoby *m) { p = (unsigned char *)find_moby_hit(m, 0xA10000, 0); r = hit_reaction(m, p, &d->hp, 0, &htype, &damage, 0, 4); d->fE0 = 0x15E; - d->fE8 = 0.35f; + d->knockback_ground_probe_z_offset = 0.35f; if (p != 0 && damage != 0.0f && m->state != WOODCUT_BOT_INITIALIZE && d->t3C4 == 0) { unsigned char *hit_source_moby; float knockback_gravity_step; @@ -397,11 +397,11 @@ void woodcut_bot_update(WBMoby *m) { knockback_gravity_step = frame_time_sq * 30.0f; b = frame_time_sq * 10.0f; default_knockback_horizontal_step = frame_time * 5.5f; - d->fE4 = 9; - d->fD0 = knockback_gravity_step; + d->knockback_motion_flags = 9; + d->knockback_gravity_decrement = knockback_gravity_step; d->fFD = 0; d->fD4 = b; - d->fD8 = default_knockback_horizontal_step; + d->knockback_horizontal_step = default_knockback_horizontal_step; d->hp -= damage; if (d->hp <= 0.0f) r = 1; @@ -411,11 +411,11 @@ void woodcut_bot_update(WBMoby *m) { case WOODCUT_BOT_REACTION_START_DEATH_KNOCKBACK: case WOODCUT_BOT_REACTION_DEATH_KNOCKBACK: d->fD4 = frame_time_sq * 17.0f; - d->fD8 = frame_time * 7.0f; - d->fDC = frame_time * 13.0f; + d->knockback_horizontal_step = frame_time * 7.0f; + d->knockback_vertical_step_limit = frame_time * 13.0f; *(OvlQuad *)v = *(OvlQuad *)(p + 0x10); - trooper_knockback_arc(v, &angle, &d->fD8, &d->fDC); - trooper_start_knockback(angle, m, d->fC0, 8, 1, 0); + trooper_knockback_arc(v, &angle, &d->knockback_horizontal_step, &d->knockback_vertical_step_limit); + trooper_start_knockback(angle, m, d->knockback_motion_vector, 8, 1, 0); d->knockback_ascent_target_frame = 14.0f; d->knockback_descent_target_frame = 24.0f; m->state = WOODCUT_BOT_DEATH_KNOCKBACK; @@ -430,7 +430,7 @@ void woodcut_bot_update(WBMoby *m) { if (m->anim != 4 || hd < 16.0f || hd > 27.0f) { short hit_source_moby_class; - m->fBC |= 5; + m->movement_recovery_flags |= 5; blend_moby_animation(m, 5, 0, scale_game_frames(3)); reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_HIT_RECOVERY_AND_REPOSITION; @@ -513,7 +513,7 @@ void woodcut_bot_update(WBMoby *m) { d->f30 = 1.0f; d->f28 = 1; d->f29 = 0; - m->fBC = 0; + m->movement_recovery_flags = 0; d->vertical_fall_step = 0.0f; d->t3C6 = 0; d->f58 = 8; @@ -548,20 +548,20 @@ void woodcut_bot_update(WBMoby *m) { m->state = WOODCUT_BOT_MELEE_ATTACK; } else if (excited ? (target_distance < d->target_engagement_range * 2.0f) : (target_distance < d->target_engagement_range)) { - if (m->fBC & 1) { + if (m->movement_recovery_flags & 1) { if (excited || d->movement_path_index == -1 || point_in_path_xy(selected_target_position, ((int *)l04_paths[d->movement_path_index]) + 4, *((int *)l04_paths[d->movement_path_index])) != 0) { m->state = WOODCUT_BOT_MOVE_TOWARD_TARGET; - m->fBC |= 8; + m->movement_recovery_flags |= 8; } } else { d->yaw_turn_spring_state = 0.0f; blend_moby_animation(m, 0x10, 0, scale_game_frames(10)); reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_TURN_BEFORE_MOVEMENT; - m->fBC |= 1; + m->movement_recovery_flags |= 1; } } if (!excited) { @@ -572,7 +572,7 @@ void woodcut_bot_update(WBMoby *m) { ((int *)l04_paths[d->movement_path_index]) + 4, *((int *)l04_paths[d->movement_path_index])) == 0)) { m->state = WOODCUT_BOT_RETURN_TO_SAVED_POSITION; - m->fBC |= 8; + m->movement_recovery_flags |= 8; } } } @@ -585,7 +585,7 @@ void woodcut_bot_update(WBMoby *m) { ((int *)l04_paths[d->movement_path_index]) + 4, *((int *)l04_paths[d->movement_path_index])) != 0) { m->state = WOODCUT_BOT_MOVE_TOWARD_TARGET; - m->fBC |= 8; + m->movement_recovery_flags |= 8; } else { blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_IDLE; @@ -635,20 +635,20 @@ void woodcut_bot_update(WBMoby *m) { m->state = WOODCUT_BOT_MELEE_ATTACK; } else if (excited ? (target_distance < d->target_engagement_range * 2.0f) : (target_distance < d->target_engagement_range)) { - if (m->fBC & 1) { + if (m->movement_recovery_flags & 1) { if (excited || d->movement_path_index == -1 || point_in_path_xy(selected_target_position, ((int *)l04_paths[d->movement_path_index]) + 4, *((int *)l04_paths[d->movement_path_index])) != 0) { m->state = WOODCUT_BOT_MOVE_TOWARD_TARGET; - m->fBC |= 8; + m->movement_recovery_flags |= 8; } } else { d->yaw_turn_spring_state = 0.0f; blend_moby_animation(m, 0x10, 0, scale_game_frames(10)); reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_TURN_BEFORE_MOVEMENT; - m->fBC |= 1; + m->movement_recovery_flags |= 1; } } } @@ -665,7 +665,7 @@ void woodcut_bot_update(WBMoby *m) { ((int *)l04_paths[d->movement_path_index]) + 4, *((int *)l04_paths[d->movement_path_index])) != 0) { m->state = WOODCUT_BOT_MOVE_TOWARD_TARGET; - m->fBC |= 8; + m->movement_recovery_flags |= 8; } else if (adiff > 1.5707964f) { d->yaw_turn_spring_state = 0.0f; blend_moby_animation(m, 0x10, 0, scale_game_frames(10)); @@ -677,8 +677,8 @@ void woodcut_bot_update(WBMoby *m) { } break; case WOODCUT_BOT_MOVE_TOWARD_TARGET: { - if (m->fBC & 8) { - m->fBC &= ~8; + if (m->movement_recovery_flags & 8) { + m->movement_recovery_flags &= ~8; reset_leg_rig_from_animation(m, d->leg_rig_movement_data); } leg_walker_update(m, @@ -726,8 +726,8 @@ void woodcut_bot_update(WBMoby *m) { break; } case WOODCUT_BOT_RETURN_TO_SAVED_POSITION: - if (m->fBC & 8) { - m->fBC &= ~8; + if (m->movement_recovery_flags & 8) { + m->movement_recovery_flags &= ~8; reset_leg_rig_from_animation(m, d->leg_rig_movement_data); } if (target_distance < 3.0f && adiff < 1.5707964f) { @@ -735,8 +735,8 @@ void woodcut_bot_update(WBMoby *m) { reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_MELEE_ATTACK; } else { - if (m->fBC & 8) { - m->fBC &= ~8; + if (m->movement_recovery_flags & 8) { + m->movement_recovery_flags &= ~8; reset_leg_rig_from_animation(m, d->leg_rig_movement_data); } if (vector_distance_xy(pos, d->initial_position) < 2.0f) { @@ -762,7 +762,7 @@ void woodcut_bot_update(WBMoby *m) { blend_moby_animation(m, 0x10, 0, scale_game_frames(10)); reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_TURN_BEFORE_MOVEMENT; - m->fBC |= 0x10; + m->movement_recovery_flags |= 0x10; } else if (point_in_path_xy(selected_target_position, ((int *)l04_paths[d->movement_path_index]) + 4, *((int *)l04_paths[d->movement_path_index])) != 0) { @@ -798,8 +798,8 @@ void woodcut_bot_update(WBMoby *m) { break; case WOODCUT_BOT_HIT_RECOVERY_AND_REPOSITION: if (m->anim2 != 5 || (m->anim == 5 && (m->f70 & 2))) { - if (m->fBC & 4) { - m->fBC &= ~4; + if (m->movement_recovery_flags & 4) { + m->movement_recovery_flags &= ~4; if (d->movement_path_index == -1) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_IDLE; @@ -894,7 +894,7 @@ void woodcut_bot_update(WBMoby *m) { break; case WOODCUT_BOT_TURN_BEFORE_MOVEMENT: if (m->anim == 0x10 && (m->f70 & 2)) { - if ((m->fBC & 0x10) || + if ((m->movement_recovery_flags & 0x10) || point_in_path_xy(selected_target_position, ((int *)l04_paths[d->movement_path_index]) + 4, *((int *)l04_paths[d->movement_path_index])) == 0) { @@ -904,8 +904,8 @@ void woodcut_bot_update(WBMoby *m) { m->state = WOODCUT_BOT_MOVE_TOWARD_TARGET; blend_moby_animation(m, 0, 0, scale_game_frames(10)); } - m->fBC = (m->fBC | 8) & ~0x10; - } else if (m->fBC & 0x10) { + m->movement_recovery_flags = (m->movement_recovery_flags | 8) & ~0x10; + } else if (m->movement_recovery_flags & 0x10) { m->rot[2] = spring_turn(m->rot[2], fast_arc_tan(d->initial_position[0] - m->pos[0], d->initial_position[1] - m->pos[1]), @@ -924,7 +924,7 @@ void woodcut_bot_update(WBMoby *m) { } break; case WOODCUT_BOT_DEATH_KNOCKBACK: - if ((step_moby_motion(m, d->fC0) & 0x40) || m->pos[2] < 1.0f) { + if ((step_moby_motion(m, d->knockback_motion_vector) & 0x40) || m->pos[2] < 1.0f) { emit_woodcut_bot_death_effects(m); FUN_L00_00263fd8( m, 0x6CB, pos, m->rot, 0, 0, 0.0f, D_L04_0015F580, D_L04_0015F580, D_L04_0015F580); @@ -963,7 +963,7 @@ void woodcut_bot_update(WBMoby *m) { multiply_quaternions(d->recoil_rotation, d->recoil_rotation, recoil_scratch); if (m->state != WOODCUT_BOT_HIT_RECOVERY_AND_REPOSITION) d->saved_non_recovery_state = m->state; - if (m->state != WOODCUT_BOT_MOVE_TOWARD_TARGET && m->fBC != 6) { + if (m->state != WOODCUT_BOT_MOVE_TOWARD_TARGET && m->movement_recovery_flags != 6) { float g; d->vertical_fall_step += frame_time_sq * 9.8f; From 42d8185c29f1a7ff1e063888fe5a63ebb5e59b51 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:35:02 +0000 Subject: [PATCH 036/657] decomp: clarify names in kerwan_path_enemy_update b254 -> projectile_launch_count: Retail 0x002c7968 clears data+0x254 on projectile-attack entry; 0x002c7ac4-0x002c7ad8 increments it in the launch window before spawn_homing_rocket, and 0x002c7c60-0x002c7c68 tests whether any launch occurred. b255 -> death_knockback_update_counter: Retail 0x002c8d5c-0x002c8d70 increments data+0x255 once per ENEMY_DEATH_KNOCKBACK update; 0x002c8dc0-0x002c8dd0 resets it on motion-result bit 1. The supplied lethal-hit setup also clears this byte. b263 -> heading_turn_cooldown: Retail 0x002c715c-0x002c7160 passes data+0x263 to the byte timer decrement; 0x002c8be4-0x002c8bec and 0x002c8cac-0x002c8cb4 set sixty scaled frames after heading convergence. Supplied heading-entry helper tests the same offset for zero. bB0 -> mission_index: Retail 0x002c7058-0x002c7070 and 0x002c8fd0-0x002c8fe8 use moby+0xB0 to index visited52 for the current level. Supplied evaluate_moby_animation_pose context identifies this same Moby byte as mission and uses it in the same per-level mission table. f258 -> heading_angular_velocity: Retail 0x002c7fb0 and 0x002c8bb4 pass data+0x258 as a1 to 0x00246de8. Checked helper request 28ecb6200ef949ee8571e027a7af9d18, 0x00246e74-0x00246ebc, integrates and clamps this float using heading error and damping; 0x00246f1c-0x00246f28 adds it to moby yaw. f278 -> path_reposition_range: Retail 0x002c79fc-0x002c7aa0 compares target XY distance against data+0x278, checks target height, then selects or advances the primary path node and enters ENEMY_MOVE_TO_PATH_NODE. The same range controls repeated repositioning at 0x002c8274-0x002c8354. f27C -> path_follow_activation_range: Retail 0x002c76c4-0x002c770c compares target distance with data+0x27C and height difference with four, consumes the range by clearing it, sets the follow override and enters ENEMY_FOLLOW_PATH_TO_END; 0x002c7c6c-0x002c7cac repeats this activation after a shot. f28C -> desired_turn_heading: Retail 0x002c7198-0x002c71cc subtracts moby yaw from data+0x28C for look offsets; 0x002c8b84-0x002c8bc0 steers toward it and tests heading convergence. The supplied heading-entry function stores desired_heading at this identical offset. f294 -> alternate_path_activation_range: Retail 0x002c7600-0x002c7644 compares target distance with data+0x294 and checks height difference below four before clearing the alternate cursor and entering ENEMY_FOLLOW_ALTERNATE_PATH. Supplied C uses this range only for that alternate-path activation gate. f58 -> animation_playback_speed: Retail 0x002c85cc-0x002c85d8 and 0x002c8c40-0x002c8c4c set moby+0x58 to 1.0 during recovery/turn completion. Supplied blend_moby_animation context identifies the same Moby animation field as anim_speed and initializes it to 1.0. i264 -> heading_turn_gate_moby_index: Retail 0x002c882c-0x002c8830 and 0x002c9520-0x002c9524 use data+0x264 as the sentinel deciding removal versus hiding for respawn. Supplied try_start_kerwan_path_enemy_heading_turn maps that same offset to turn_gate_moby_index, indexes the moby array, and gates heading turns on the referenced class/state. i274 -> use_sequential_path_nodes: Retail 0x002c7a38-0x002c7a88 tests data+0x274: nonzero increments primary pf.idx within node count, while zero invokes select_kerwan_path_enemy_next_node. The same selection policy appears after melee at 0x002c8140-0x002c81c8 and recovery at 0x002c85f4-0x002c86a8. i280 -> supporting_moby_index: Retail 0x002c9248-0x002c9258 derives data+0x280 from CollisionHit.moby minus the instance-array base, divided by 0x100. 0x002c90d4-0x002c90dc resolves that index; 0x002c9170-0x002c9190 uses the supporting moby to transform enemy position and yaw. i284 -> activation_linked_moby_index: Retail 0x002c78c8-0x002c78e4 reads data+0x284, scales by moby stride 0x100 and checks the referenced moby state while in ENEMY_WAIT_FOR_LINKED_MOBY. 0x002c7914-0x002c794c resumes activation waiting and clears this index when the link is released. i290 -> alternate_path_id: Retail 0x002c8460-0x002c848c uses data+0x290 as an index into l03_paths; ENEMY_FOLLOW_ALTERNATE_PATH moves on that path. 0x002c850c-0x002c8518 sets the ID to -1 at path completion, matching the supplied C. i298 -> alternate_path_node_index: Retail 0x002c84ac-0x002c84bc advances data+0x298 to the projected alternate-path segment; 0x002c84c0-0x002c84dc addresses path+0x10+index*0x10 for movement, and 0x002c84ec-0x002c8508 increments it until the final node. i29C -> target_activation_clip_volume_id: Retail 0x002c75bc-0x002c75c8 passes data+0x29C with the selected target record to the point-inside-clip-volume test; a successful test activates the alternate path. Supplied C identifies this call as is_point_inside_clip_volume(selected_target, id). s24 -> respawn_health: Retail 0x002c73d8-0x002c7428 stores initial health 3.0 and its integer copy at data+0x24. On ENEMY_RESPAWN_AT_PATH_START, 0x002c9010-0x002c9020 converts this short back to float and restores data+0x20, whose supplied hit-reaction code subtracts damage and tests lethal health. s250 -> projectile_attack_cooldown_frames: Retail 0x002c77e4-0x002c77ec and 0x002c7d4c-0x002c7d54 decrement/test the short at data+0x250 before projectile attack behavior. 0x002c7938-0x002c7944 sets sixty scaled frames after linked-moby release and 0x002c8d38-0x002c8d44 sets ten after a heading turn. s256 -> follow_path_to_end_override: Retail 0x002c7700-0x002c770c sets data+0x256 when proximity activates full-path following. 0x002c81e8-0x002c81fc checks this short on node-movement entry and redirects immediately to ENEMY_FOLLOW_PATH_TO_END. s28A -> path_height_check_schedule_slot: Retail 0x002c7494-0x002c74ac assigns data+0x28A from an incrementing counter masked with seven. 0x002c9380-0x002c9388 compares it with the frame counter masked with seven before the path-height safety check at 0x002c93a4-0x002c9400. --- src/overlays/l03/mobys/kerwan_path_enemy.c | 194 ++++++++++----------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/src/overlays/l03/mobys/kerwan_path_enemy.c b/src/overlays/l03/mobys/kerwan_path_enemy.c index 0d9eb68a6e..b73fdb5619 100644 --- a/src/overlays/l03/mobys/kerwan_path_enemy.c +++ b/src/overlays/l03/mobys/kerwan_path_enemy.c @@ -204,31 +204,31 @@ typedef struct Data2C8398 { char p138[0x18]; Look2C8398 look0; Look2C8398 look1; - short s250; + short projectile_attack_cooldown_frames; short target_range_boost_timer; - unsigned char b254; - unsigned char b255; - short s256; - float f258; + unsigned char projectile_launch_count; + unsigned char death_knockback_update_counter; + short follow_path_to_end_override; + float heading_angular_velocity; char p25C[6]; unsigned char b262; - unsigned char b263; - int i264; + unsigned char heading_turn_cooldown; + int heading_turn_gate_moby_index; char p268[4]; float base_target_selection_range; float target_selection_range; - int i274; - float f278; - float f27C; - int i280; - int i284; + int use_sequential_path_nodes; + float path_reposition_range; + float path_follow_activation_range; + int supporting_moby_index; + int activation_linked_moby_index; short s288; - short s28A; - float f28C; - int i290; - float f294; - int i298; - int i29C; + short path_height_check_schedule_slot; + float desired_turn_heading; + int alternate_path_id; + float alternate_path_activation_range; + int alternate_path_node_index; + int target_activation_clip_volume_id; } Data2C8398; typedef struct Moby2C8398 { @@ -249,7 +249,7 @@ typedef struct Moby2C8398 { unsigned char b52; unsigned char anim; char p54[4]; - float f58; + float animation_playback_speed; char p5C[0x14]; unsigned char b70; char p71[7]; @@ -263,7 +263,7 @@ typedef struct Moby2C8398 { char pA5; unsigned short cls; char pA8[8]; - unsigned char bB0; + unsigned char mission_index; char pB1[0xB]; unsigned char bBC; char pBD[0x43]; @@ -403,7 +403,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { target_distance = vector_distance_xy(m->pos, &selected_target); manipulator_set_scale(&moby_data->look0, 2.5f); if (moby_data->b262 == 1) { - if ((visited52)[m->bB0 + (current_level_index << 4)] == 0xFF) { + if ((visited52)[m->mission_index + (current_level_index << 4)] == 0xFF) { m->flags |= 0x41; m->i94 = 0; } @@ -421,13 +421,13 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { return; } FUN_L00_001fefc8_cf(m); - fast_subtract_rotations_cf(&moby_data->b263); + fast_subtract_rotations_cf(&moby_data->heading_turn_cooldown); if (m->b31 != 0 || target_distance < 24.0f) { if (m->state == ENEMY_TURN_TO_HEADING) { moby_data->look0.target_yaw_offset = - fast_subtract_rotations(moby_data->f28C, m->rot[2]) * 0.25f; + fast_subtract_rotations(moby_data->desired_turn_heading, m->rot[2]) * 0.25f; moby_data->look1.target_yaw_offset = - fast_subtract_rotations(moby_data->f28C, m->rot[2]) * 0.75f; + fast_subtract_rotations(moby_data->desired_turn_heading, m->rot[2]) * 0.75f; } else if (m->state < ENEMY_MOVE_TO_PATH_NODE && target_distance < moby_data->target_selection_range) { moby_data->look1.target_yaw_offset = @@ -478,7 +478,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { moby_data->b5A = 0xC; clear_u64_value(moby_data->v40); m->flags |= 0x1000; - moby_data->s250 = 0; + moby_data->projectile_attack_cooldown_frames = 0; { char *np = ((char *)l03_paths[moby_data->pf.id]); moby_data->pf.idx = 0; @@ -487,9 +487,9 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } m->state = ENEMY_WAIT_FOR_ACTIVATION; moby_data->s288 = m->s32; - moby_data->s28A = D_L03_001618F4 & 7; + moby_data->path_height_check_schedule_slot = D_L03_001618F4 & 7; D_L03_001618F4_i++; - moby_data->b263 = 0; + moby_data->heading_turn_cooldown = 0; { char *path = moby_data->pf.path; if (path != 0) { @@ -500,7 +500,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } } } - if (moby_data->i284 != -1 && moby_data->i290 == -1) { + if (moby_data->activation_linked_moby_index != -1 && moby_data->alternate_path_id == -1) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = ENEMY_WAIT_FOR_LINKED_MOBY; } @@ -509,28 +509,28 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { if ((m->b70 & 2) && m->b52 != 0) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); } - if (moby_data->i290 != -1) { - char *np = ((char *)l03_paths[moby_data->i290]); + if (moby_data->alternate_path_id != -1) { + char *np = ((char *)l03_paths[moby_data->alternate_path_id]); *(OvlQuad *)m->pos = *(OvlQuad *)(np + 0x10); m->rot[2] = fast_arc_tan(*(float *)(np + 0x20) - *(float *)(np + 0x10), *(float *)(np + 0x24) - *(float *)(np + 0x14)); if (is_point_inside_clip_volume_cf(m->b21) || - is_point_inside_clip_volume(&selected_target, moby_data->i29C) || - (visited52)[m->bB0 + (current_level_index << 4)] == 0xFF || - (target_distance < moby_data->f294 && + is_point_inside_clip_volume(&selected_target, moby_data->target_activation_clip_volume_id) || + (visited52)[m->mission_index + (current_level_index << 4)] == 0xFF || + (target_distance < moby_data->alternate_path_activation_range && absolute_float(selected_target.pos[2] - m->pos[2]) < 4.0f)) { - moby_data->i298 = 0; + moby_data->alternate_path_node_index = 0; m->state = ENEMY_FOLLOW_ALTERNATE_PATH; if (m->anim != 1) { blend_moby_animation(m, 1, 0, scale_game_frames(10)); } } - } else if (moby_data->i284 != -1) { + } else if (moby_data->activation_linked_moby_index != -1) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = ENEMY_WAIT_FOR_LINKED_MOBY; } else { if (target_distance < moby_data->target_selection_range || - target_distance < moby_data->f27C) { + target_distance < moby_data->path_follow_activation_range) { if (try_start_kerwan_path_enemy_heading_turn( fast_arc_tan(selected_target.pos[0] - m->pos[0], selected_target.pos[1] - m->pos[1]), @@ -539,10 +539,10 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { break; } } - if (target_distance < moby_data->f27C && + if (target_distance < moby_data->path_follow_activation_range && absolute_float(selected_target.pos[2] - m->pos[2]) < 4.0f) { - moby_data->f27C = 0.0f; - moby_data->s256 = 1; + moby_data->path_follow_activation_range = 0.0f; + moby_data->follow_path_to_end_override = 1; m->state = ENEMY_FOLLOW_PATH_TO_END; if (m->anim != 1) { blend_moby_animation(m, 1, 0, scale_game_frames(10)); @@ -556,7 +556,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } } else if (target_distance < moby_data->target_selection_range && absolute_float(selected_target.pos[2] - m->pos[2]) < 10.0f && - fast_dec_timer_s16(&moby_data->s250)) { + fast_dec_timer_s16(&moby_data->projectile_attack_cooldown_frames)) { if (fast_difference_between_rotations( m->rot[2], fast_arc_tan(selected_target.pos[0] - m->pos[0], @@ -578,12 +578,12 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { break; } { - Moby2C8398 *o = &D_L03_0015FFD8_m[moby_data->i284]; + Moby2C8398 *o = &D_L03_0015FFD8_m[moby_data->activation_linked_moby_index]; if (o == 0 || o->state == 0xFE || o->state == 0xFD || (m->b52 == 0xA && (m->b70 & 2))) { m->state = ENEMY_WAIT_FOR_ACTIVATION; blend_moby_animation(m, 0, 0, scale_game_frames(10)); - moby_data->s250 = scale_game_frames(0x3C); - moby_data->i284 = -1; + moby_data->projectile_attack_cooldown_frames = scale_game_frames(0x3C); + moby_data->activation_linked_moby_index = -1; } else { try_start_kerwan_path_enemy_heading_turn( fast_arc_tan(selected_target.pos[0] - m->pos[0], @@ -596,7 +596,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { case ENEMY_PROJECTILE_ATTACK_WINDUP: if (m->b70 & 2) { m->state = ENEMY_PROJECTILE_ATTACK; - moby_data->b254 = 0; + moby_data->projectile_launch_count = 0; if (m->anim != 4) { blend_moby_animation(m, 4, 0, 0); } @@ -606,9 +606,9 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { if (m->anim != 2) { blend_moby_animation(m, 2, 0, scale_game_frames(10)); } - } else if (target_distance < moby_data->f278 && + } else if (target_distance < moby_data->path_reposition_range && absolute_float(selected_target.pos[2] - m->pos[2]) < 10.0f) { - if (moby_data->i274 != 0) { + if (moby_data->use_sequential_path_nodes != 0) { Data2C8398 *d2 = m->data; if (d2->pf.idx < *(int *)d2->pf.path - 1) { d2->pf.idx++; @@ -634,7 +634,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { float launch_endpoint[4]; float ang; float df; - moby_data->b254++; + moby_data->projectile_launch_count++; moby_point_position(m, 0, a); fast_vec_sub(b, selected_target.dir, a); fast_vec_normalize(b, b, frame_time * 6.0f); @@ -659,12 +659,12 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { b, a, (struct Moby *)m, scale_game_frames(0x82), ang, frame_time * 6.0f, 0.75f); } if (m->b70 & 2) { - if (moby_data->b254 == 0) { + if (moby_data->projectile_launch_count == 0) { break; } - if (target_distance < moby_data->f27C && + if (target_distance < moby_data->path_follow_activation_range && absolute_float(selected_target.pos[2] - m->pos[2]) < 4.0f) { - moby_data->f27C = 0.0f; + moby_data->path_follow_activation_range = 0.0f; m->state = ENEMY_FOLLOW_PATH_TO_END; if (m->anim != 1) { blend_moby_animation(m, 1, 0, scale_game_frames(10)); @@ -679,7 +679,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } if (target_distance < moby_data->target_selection_range && absolute_float(selected_target.pos[2] - m->pos[2]) < 10.0f && - fast_dec_timer_s16(&moby_data->s250) && + fast_dec_timer_s16(&moby_data->projectile_attack_cooldown_frames) && fast_difference_between_rotations( m->rot[2], fast_arc_tan(selected_target.pos[0] - m->pos[0], @@ -707,9 +707,9 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { if (m->anim != 2) { blend_moby_animation(m, 2, 0, scale_game_frames(10)); } - } else if (target_distance < moby_data->f278 && + } else if (target_distance < moby_data->path_reposition_range && absolute_float(selected_target.pos[2] - m->pos[2]) < 10.0f) { - if (moby_data->i274 != 0) { + if (moby_data->use_sequential_path_nodes != 0) { Data2C8398 *d2 = m->data; if (d2->pf.idx < *(int *)d2->pf.path - 1) { d2->pf.idx++; @@ -737,7 +737,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { fr = compute_interpolated_record_value(m); ang = fast_arc_tan(selected_target.pos[0] - m->pos[0], selected_target.pos[1] - m->pos[1]); - FUN_001f9c48_cf((char *)m, &moby_data->f258, ang, 0.03f, 0.3f, 0.3f); + FUN_001f9c48_cf((char *)m, &moby_data->heading_angular_velocity, ang, 0.03f, 0.3f, 0.3f); moby_point_position(m, 0, v); if (25.0f <= fr && fr <= 31.0f && absolute_float(m->pos[2] - selected_target.pos[2]) < 2.0f && @@ -761,7 +761,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { record_moby_hit(selected_target.obj, &hit); } } else if (m->b70 & 2) { - if (moby_data->i274 != 0) { + if (moby_data->use_sequential_path_nodes != 0) { Data2C8398 *d2 = m->data; if (d2->pf.idx < *(int *)d2->pf.path - 1) { d2->pf.idx++; @@ -793,7 +793,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } case ENEMY_MOVE_TO_PATH_NODE: { PathF2C8398 *pf = &moby_data->pf; - if (moby_data->s256 != 0) { + if (moby_data->follow_path_to_end_override != 0) { m->state = ENEMY_FOLLOW_PATH_TO_END; break; } @@ -814,9 +814,9 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { 0x14)) { break; } - if (target_distance < moby_data->f278 && + if (target_distance < moby_data->path_reposition_range && absolute_float(selected_target.pos[2] - m->pos[2]) < 10.0f) { - if (moby_data->i274 != 0) { + if (moby_data->use_sequential_path_nodes != 0) { Data2C8398 *d2 = m->data; if (d2->pf.idx < *(int *)d2->pf.path - 1) { d2->pf.idx++; @@ -890,30 +890,30 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } case ENEMY_FOLLOW_ALTERNATE_PATH: { { - char *path = ((char *)l03_paths[moby_data->i290]); + char *path = ((char *)l03_paths[moby_data->alternate_path_id]); float v[4]; int seg; float frac; FUN_L00_0025c698_cf(path, m->pos, v, &seg, &frac, 0, 999.0f, 5.0f, 0.0f); - if (moby_data->i298 < seg) { - moby_data->i298 = seg; + if (moby_data->alternate_path_node_index < seg) { + moby_data->alternate_path_node_index = seg; } if (!(step_mover_2e3f20((char *)m, (char *)&moby_data->mv, - (float *)(path + 0x10 + moby_data->i298 * 0x10), + (float *)(path + 0x10 + moby_data->alternate_path_node_index * 0x10), (char *)moby_data->v40) & 0x14)) { break; } - if (moby_data->i298 < *(int *)path - 1) { - moby_data->i298++; + if (moby_data->alternate_path_node_index < *(int *)path - 1) { + moby_data->alternate_path_node_index++; } else { - moby_data->i290 = -1; + moby_data->alternate_path_id = -1; m->state = ENEMY_WAIT_FOR_ACTIVATION; if (m->anim != 0) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); } - if (moby_data->i284 != -1) { + if (moby_data->activation_linked_moby_index != -1) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = ENEMY_WAIT_FOR_LINKED_MOBY; } else { @@ -933,12 +933,12 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { if (moby_data->q.jump_phase != 2) { fl = step_moby_motion(m, &moby_data->q); } else { - m->f58 = 1.0f; + m->animation_playback_speed = 1.0f; fl = (m->b70 << 5) & 0x40; } - moby_data->i290 = -1; + moby_data->alternate_path_id = -1; if (fl & 0x40) { - if (moby_data->i274 != 0) { + if (moby_data->use_sequential_path_nodes != 0) { Data2C8398 *d2 = m->data; if (d2->pf.idx < *(int *)d2->pf.path - 1) { d2->pf.idx++; @@ -1018,7 +1018,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { D_L03_0015F580_macro, D_L03_0015F580_macro); FUN_L00_00259710_cf(m, 0, -1); - if (moby_data->i264 == -1) { + if (moby_data->heading_turn_gate_moby_index == -1) { mark_moby_for_removal(m); return; } @@ -1126,7 +1126,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { D_L03_0015F580_macro, D_L03_0015F580_macro); FUN_L00_00259710_cf(m, 0x200, -1); - if (moby_data->i264 == -1) { + if (moby_data->heading_turn_gate_moby_index == -1) { mark_moby_for_removal(m); return; } @@ -1144,9 +1144,9 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { case ENEMY_TURN_TO_HEADING: switch (m->anim) { case ENEMY_ANIM_LOCOMOTION: - FUN_001f9c48_cf((char *)m, &moby_data->f258, moby_data->f28C, 0.09f, 0.27f, 0.15f); - if (fast_difference_between_rotations(m->rot[2], moby_data->f28C) < 0.034906585f) { - moby_data->b263 = scale_game_frames(0x3C); + FUN_001f9c48_cf((char *)m, &moby_data->heading_angular_velocity, moby_data->desired_turn_heading, 0.09f, 0.27f, 0.15f); + if (fast_difference_between_rotations(m->rot[2], moby_data->desired_turn_heading) < 0.034906585f) { + moby_data->heading_turn_cooldown = scale_game_frames(0x3C); if (m->bBC >= 7 && m->bBC <= 8) { if (m->bBC == 7) { is_value_within_interpolated_window_cf(m); @@ -1155,20 +1155,20 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { if (m->anim != 1) { blend_moby_animation(m, 1, 0, scale_game_frames(10)); } - m->f58 = 1.0f; + m->animation_playback_speed = 1.0f; } else { m->state = ENEMY_WAIT_FOR_ACTIVATION; if (m->anim != 0) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); } - moby_data->s250 = scale_game_frames(10); + moby_data->projectile_attack_cooldown_frames = scale_game_frames(10); } } break; case ENEMY_ANIM_HEADING_TURN: - FUN_001f9c48_cf((char *)m, &moby_data->f258, moby_data->f28C, 0.01f, 0.3f, 0.2f); - if (fast_difference_between_rotations(m->rot[2], moby_data->f28C) < 0.034906585f) { - moby_data->b263 = scale_game_frames(0x3C); + FUN_001f9c48_cf((char *)m, &moby_data->heading_angular_velocity, moby_data->desired_turn_heading, 0.01f, 0.3f, 0.2f); + if (fast_difference_between_rotations(m->rot[2], moby_data->desired_turn_heading) < 0.034906585f) { + moby_data->heading_turn_cooldown = scale_game_frames(0x3C); if (m->bBC >= 7 && m->bBC <= 8) { if (m->bBC == 7) { is_value_within_interpolated_window_cf(m); @@ -1182,7 +1182,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { if (m->anim != 0) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); } - moby_data->s250 = scale_game_frames(10); + moby_data->projectile_attack_cooldown_frames = scale_game_frames(10); } } break; @@ -1191,7 +1191,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { case ENEMY_DEATH_KNOCKBACK: { int fl = step_moby_motion(m, &moby_data->q); float g; - moby_data->b255++; + moby_data->death_knockback_update_counter++; g = allocate_voice_for_target_entry_cf(m->pos); if ((fl & 0x60) && g + 5.0f < m->pos[2] && m->bBC != 0xB) { allocate_voice_for_target_entry(0xA, 0, (int)m); @@ -1199,7 +1199,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } m->flags &= 0xEFFF; if (fl & 1) { - moby_data->b255 = 0; + moby_data->death_knockback_update_counter = 0; } if (fl & 0x60) { { @@ -1255,7 +1255,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { D_L03_0015F580_macro, D_L03_0015F580_macro); FUN_L00_00259710_cf(m, 0, -1); - if (moby_data->i264 == -1) { + if (moby_data->heading_turn_gate_moby_index == -1) { mark_moby_for_removal(m); return; } @@ -1270,7 +1270,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } if (m->pos[2] < 5.0f) { FUN_L00_00259710_cf(m, 0, -1); - if (moby_data->i264 == -1) { + if (moby_data->heading_turn_gate_moby_index == -1) { mark_moby_for_removal(m); return; } @@ -1296,7 +1296,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { break; } case ENEMY_RESPAWN_AT_PATH_START: - if ((visited52)[m->bB0 + (current_level_index << 4)] == 0xFF) { + if ((visited52)[m->mission_index + (current_level_index << 4)] == 0xFF) { mark_moby_for_removal(m); return; } @@ -1313,14 +1313,14 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } } { - int idx = moby_data->i280; + int idx = moby_data->supporting_moby_index; Moby2C8398 *o; if (idx == -1 || (o = &D_L03_0015FFD8_m[idx]) == 0 || o->state == 0xFE || o->state == 0xFD) { - moby_data->i280 = -1; + moby_data->supporting_moby_index = -1; } } - if (moby_data->i280 != -1) { + if (moby_data->supporting_moby_index != -1) { { float transformed_rotation[4]; Moby2C8398 *moby_instances; @@ -1329,7 +1329,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { int i; *(OvlQuad *)transformed_rotation = 0; moby_instances = D_L03_0015FFD8_m; - supporting_moby = &moby_instances[moby_data->i280]; + supporting_moby = &moby_instances[moby_data->supporting_moby_index]; pf = &moby_data->pf; if ((short)supporting_moby->cls == 0x335 || (short)supporting_moby->cls == 0x4BA) { for (i = 0; i < *(int *)pf->path; i++) { @@ -1365,16 +1365,16 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { if (m->pos[2] < g) { CollisionHit *hit = &D_L03_00173F40; if (hit->moby != 0 && FUN_L03_0024fba8_cf(hit->moby) != 0) { - moby_data->i280 = (Moby2C8398 *)hit->moby - D_L03_0015FFD8_m; - } else if (moby_data->i280 != -1) { - short cls = D_L03_0015FFD8_m[moby_data->i280].cls; + moby_data->supporting_moby_index = (Moby2C8398 *)hit->moby - D_L03_0015FFD8_m; + } else if (moby_data->supporting_moby_index != -1) { + short cls = D_L03_0015FFD8_m[moby_data->supporting_moby_index].cls; if (cls != 0x335 && cls != 0x4BA) { - moby_data->i280 = -1; + moby_data->supporting_moby_index = -1; } } m->pos[2] = g; moby_data->mv.f18 = 0.0f; - if (moby_data->i280 != -1) { + if (moby_data->supporting_moby_index != -1) { float a[4]; float b[4]; *(OvlQuad *)a = *(OvlQuad *)D_L03_00173F80; @@ -1391,7 +1391,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } if (moby_data->b262 == 0) { if (vector_distance_xy(m->pos, D_L03_00166EC0) < 70.0f && - (D_L03_0015F5CC & 7) == moby_data->s28A) { + (D_L03_0015F5CC & 7) == moby_data->path_height_check_schedule_slot) { PathF2C8398 *pf = &moby_data->pf; float v[4]; int seg; @@ -1450,7 +1450,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { D_L03_0015F580_macro, D_L03_0015F580_macro); FUN_L00_00259710_cf(m, 0x200, -1); - if (moby_data->i264 == -1) { + if (moby_data->heading_turn_gate_moby_index == -1) { mark_moby_for_removal(m); return; } @@ -1638,7 +1638,7 @@ void update_kerwan_path_enemy_hit_reaction(Moby2C8398 *moby) { moby_data->q.f50 = 10.0f; moby_data->q.f54 = 20.0f; moby_data->q.target_horizontal_speed = 2.0f * frame_time; - moby_data->b255 = 0; + moby_data->death_knockback_update_counter = 0; moby->flags &= 0xEFFF; moby_data->b67 = 0xFA; moby->state = ENEMY_DEATH_KNOCKBACK; From f6d670019ddc3b7bf006c6c414cdf0d275a4b4fc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:37:11 +0000 Subject: [PATCH 037/657] decomp: clarify names in snagglebeast_update domain_1_value_0 -> SNAGGLEBEAST_TURN_CONTROLLER_RESET: Retail 00315178 clears private +0x168, the same controller address passed to turning helper at 003150ac..003150d4. The SHA-bound start_snagglebeast_turn_toward_target source already names zero assigned to this exact turn_controller_state as SNAGGLEBEAST_TURN_CONTROLLER_RESET. Reuse that proven controller-domain member, distinct from main, rope and hero state domains. unk19D -> path_selection_mode: Retail 00316798..003168d0 dispatches this byte through the established SNAGGLEBEAST_PATH_SELECT_* cases, copies first/second/farther paired path point and clears the corresponding navigation bit. 003168ec..003168f4 uses it to select the mapped nav point; 00316288..003163a0 also selects linked-moby pairs. unk19E -> ammo_drain_batch_size: Retail 00316bf8 clears this signed short on capture. 00316d78..00316dc4 initializes it to weapon_ammo_counts[slot]/8 bounded below by the transfer-record count; 00316df8..00316e38 reloads it as the drain batch and adjusts against remaining ammo. 003170b4..003170fc passes the resulting count to spawn and subtracts it on success. unk1A4 -> activation_clip_volume_id: Retail 003141cc loads private +0x1A4 as a1, skips the test for -1, and at 003141d8..003141e0 tests hero position through is_point_inside_clip_volume and returns when outside. The SHA-bound C confirms this ID gates the entire instance update. unk1A8 -> chase_nav_point_index: Retail 003168d4..003168f4 loads path_points[path_selection_mode] and stores its mapped point at private +0x1A8. 003158c0..003158ec multiplies that field by 16 to read a point from nav_path; phase checks 0031453c..0031458c enable forced path following when it is not -1. 00315b18 clears it on stop. unk1B8 -> timed_damage_fall_height: In final timed-damage phase 8, retail 00316438..00316490 applies gravity to velocity, advances moby position, and compares moby Z against float private +0x1B8 to end the fall. 00317704..0031774c also places the death explosion at this height plus 1.0; the name asserts the fall-height reference without claiming terrain identity. unk1C4 -> hero_capture_latched: Retail 00314d34 and 00315d0c clear this byte on entering capture/drain. At 00316b48..00316b74 it bypasses the initial countdown and rope-distance gate once nonzero and is set to 1; 00316b78..00316c9c then captures/eases/spins the hero. It latches capture processing, rather than the separate capture-attack-enabled flag. unk298 -> chase_waypoint_update_counter: Retail 00314df8 and 00316a24 reset private +0x298 when entering chase states 5/6. 0031591c..0031593c tests its low two bits to recompute the chase waypoint every fourth chase update, and 0031594c..00315954 increments it. SHA-bound C calls select_snagglebeast_chase_waypoint in that gate. unk29C -> alternate_path_clip_volume_id: Retail 0031579c..003157cc passes private +0x29C to is_point_inside_clip_volume with the target sight position, after checking ID != -1 and navigation_mask low bits clear. Success selects a point from path_1A0 at 003157d4..00315818 instead of chase_path at 00315834..00315878, proving the alternate-path volume role. unk2A0 -> joint_scale_manipulator: Retail 00314160/003141a8/ac passes joint 0xB, scale 2.5f and private +0x2A0 to checked helper 0028c2f0. Its 0028c314..0028c348 checks attachment byte +1, calls 00277fb8 or 00278030, and writes uniform scale to +0x20/+0x24/+0x28. Checked 003140f8..0031410c uses the same 00277fb8 attach call and scale layout, matching supplied attach_manipulator C. Cheat-option identity is not inferred. --- src/overlays/l07/mobys/snagglebeast.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index 38b7af2dec..93fb1ccd41 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -1003,6 +1003,9 @@ void snagglebeast_update(unsigned char *moby) { SNAGGLEBEAST_PHASE_AFTER_THIRD_HEALTH_THRESHOLD = 7, SNAGGLEBEAST_PHASE_FINAL_TIMED_DAMAGE_SEQUENCE = 8 }; + enum { + SNAGGLEBEAST_TURN_CONTROLLER_RESET = 0 + }; Vec4 oldpos; ChaserSight sight; Vec4 position; @@ -1379,7 +1382,7 @@ void snagglebeast_update(unsigned char *moby) { snagglebeast_instance_state->substate += 1; qcopy(&position, moby + 0x10); speed = frame_time * 8.0f; - snagglebeast_instance_state->turn_controller_state = 0; + snagglebeast_instance_state->turn_controller_state = SNAGGLEBEAST_TURN_CONTROLLER_RESET; spawn_fading_ring_effect((int)moby, &position, 0x3A, 1.0f, 25.0f, 2.0f, speed, 1.0f); FUN_L00_0024f7c8(moby, (snagglebeast_instance_state->substate & 1) + 5, &position); configure_timed_point_light(moby, From 26691b63a6b29116d7b06d305a3fb2f4b16c19dd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:39:29 +0000 Subject: [PATCH 038/657] decomp: clarify names in drek_final_boss_robot_update domain_0_value_2 -> DREK_BOSS_GROUND_TARGET_CENTER_HERO_POSITION: In DREK_BOSS_TARGET_GROUND_POINTS, retail 0x002f47cc loads BossData+0xB4, the bound C ground_target_center_mode. At 0x002f47d0-0x002f47d4 comparing it to 2 forces the randomized-target branch even when random_integer_below(5) returns zero. At 0x002f47e0-0x002f4800 equality with 2 selects hero position 0x0013F3D0 as the center copied to sp+0x30; other values select BossData+0x70. At 0x002f4804-0x002f4858 a random XY radial offset is added to this center. This proves mode 2 means hero-position ground-target center, independently of unrelated equal-valued boss, phase and Hero enum constants. domain_1_value_2 -> DREK_BOSS_GROUND_TARGET_CENTER_HERO_POSITION: In DREK_BOSS_TARGET_GROUND_POINTS, retail 0x002f47cc loads BossData+0xB4, the bound C ground_target_center_mode. At 0x002f47d0-0x002f47d4 comparing it to 2 forces the randomized-target branch even when random_integer_below(5) returns zero. At 0x002f47e0-0x002f4800 equality with 2 selects hero position 0x0013F3D0 as the center copied to sp+0x30; other values select BossData+0x70. At 0x002f4804-0x002f4858 a random XY radial offset is added to this center. This proves mode 2 means hero-position ground-target center, independently of unrelated equal-valued boss, phase and Hero enum constants. The bound C != 2 branch copies boss_data->f70; its else copies hero.motion.pos.f, directly proving the same selector member for the inequality. --- src/overlays/l18/mobys/drek_final_boss_robot.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l18/mobys/drek_final_boss_robot.c b/src/overlays/l18/mobys/drek_final_boss_robot.c index 2286e9f604..8736f84917 100644 --- a/src/overlays/l18/mobys/drek_final_boss_robot.c +++ b/src/overlays/l18/mobys/drek_final_boss_robot.c @@ -444,6 +444,9 @@ void drek_final_boss_robot_update(BossMoby *moby) { DREK_BOSS_PHASE_WAIT_TO_QUEUE_ENDING_MOVIE = 10, DREK_BOSS_PHASE_WAIT_FOR_ENDING_CLEANUP = 0xB }; + enum { + DREK_BOSS_GROUND_TARGET_CENTER_HERO_POSITION = 2 + }; BossData *boss_data = (BossData *)moby->boss_private_data; BossMoby *aim_target_moby; float position_and_displacement_scratch[4]; @@ -1193,11 +1196,11 @@ void drek_final_boss_robot_update(BossMoby *moby) { update_drek_boss_arena_circling_movement((struct Moby *)moby); if (is_value_within_interpolated_window((char *)moby, 1.0f) != 0 || is_value_within_interpolated_window((char *)moby, 16.0f) != 0) { - if (random_integer_below(5) != 0 || boss_data->ground_target_center_mode == 2) { + if (random_integer_below(5) != 0 || boss_data->ground_target_center_mode == DREK_BOSS_GROUND_TARGET_CENTER_HERO_POSITION) { float a; float r; - if (boss_data->ground_target_center_mode != 2) { + if (boss_data->ground_target_center_mode != DREK_BOSS_GROUND_TARGET_CENTER_HERO_POSITION) { qcopy(position_displacement_direction_and_rotation_scratch, boss_data->f70); } else { qcopy(position_displacement_direction_and_rotation_scratch, hero.motion.pos.f); From 8a637f647544c12fa8632599db6eee4a4b59e542 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:48:56 +0000 Subject: [PATCH 039/657] decomp: clarify names in handle_psytcopus_hits domain_0_value_2 -> PSYTCOPUS_PROJECTILE_CREATION_BLOCKED: SHA-256 c14f8d5761dde389a54c7a84d7dd8fe405d67f1567c694559b41de9a89918b4a binds psytcopus.c. Original retail Ghidra and instructions 003106b8 establish s1 as this Moby's pvars. At 00310a04 s3 receives 2; 00310a48-00310a98 test the path-helper result and XY/Z path-point tolerances, storing s3 into pvars+114 at 00310a68 or 00310a98. Authoritative handle_psytcopus_hits identifies that exact field as projectile_creation_gate_state. Supplied caller psytcopus_update invokes this handler before state dispatch, and its FACE_PLAYER branch compares the same member against existing local PSYTCOPUS_PROJECTILE_CREATION_BLOCKED=2 before entering CREATE_PROJECTILE. Thus this assignment uses the same projectile gate domain and blocking value, distinct from Moby state, hit_reaction and the helper's return domain. --- src/overlays/l11/mobys/psytcopus.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/overlays/l11/mobys/psytcopus.c b/src/overlays/l11/mobys/psytcopus.c index 1e87e448d7..b62c654e5a 100644 --- a/src/overlays/l11/mobys/psytcopus.c +++ b/src/overlays/l11/mobys/psytcopus.c @@ -268,6 +268,9 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { HIT_REACTION_HURT_WITHOUT_STATE_CHANGE = 10, HIT_REACTION_NO_RESPONSE = 11 }; + enum { + PSYTCOPUS_PROJECTILE_CREATION_BLOCKED = 2 + }; struct PokiPathVars *psytcopus_vars = (struct PokiPathVars *)psytcopus->pvars; Vec4f projectile_and_hit_vector_scratch; int hits; From e74357d6846588a865e6efd3cb6bf59479386f71 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:53:26 +0000 Subject: [PATCH 040/657] decomp: clarify names in process_hero_equipped_item_input f22DC -> mode3_toggle_requested: In ITEM_VEHICLE_MODE_TOGGLE, retail 0x00228640-44 checks hero+0x22DE is zero, then 0x0022865C-60 stores 1 to short hero+0x22DC and 0x00228658/68 stores 0x12 to the adjacent mode3_toggle_delay_frames. This follows can_select_hero_item_31, the equipped class-0x1E3 guard and accepted input. Supplied update_hero_timers_and_reach_state consumes that delay to exit mode 3 or spawn class 0x27A and enter mode 3. The short records the accepted mode-3 toggle request; the name does not assert how or when it is cleared. fA9C -> wrench_combo_input_lockout: Within ITEM_WRENCH after the hero_control_mode==HERO_CONTROL_MODE_MELEE_ATTACK gate at retail 0x00228354-5C, 0x002283A0-A4 rejects a crouch-swing continuation when int hero+0xA9C is nonzero. Retail 0x002283FC-0x00228400 repeats the same nonzero rejection before the attack-record frame gate and pad window that select the next wrench combo/crouch swing at 0x0022846C-0x002284A4. Authoritative C has precisely these two fA9C uses. The field is functionally a wrench combo input lockout; no countdown, setter or broader lifecycle is claimed. --- src/overlays/shared/hero/hero_set_state.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index 3819d27584..73796f3f8e 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3296,7 +3296,7 @@ typedef struct { char p9A0[0xC0]; int active_attack_record_index; char pA64[0x38]; - int fA9C; + int wrench_combo_input_lockout; char pAA0[0x8]; float hero_animation_frame; char pAAC[0x5E4]; @@ -3326,7 +3326,7 @@ typedef struct { char p22CB[0xD]; short f22D8; char p22DA[0x2]; - short f22DC; + short mode3_toggle_requested; short mode3_toggle_delay_frames; } Hero_228770; @@ -3469,7 +3469,7 @@ int process_hero_equipped_item_input(void) { if (D_0013F450_h228770.hero_current_state == HERO_STATE_CROUCH_SWING) { if (D_0013F450_h228770.current_state_elapsed_frames > scale_game_frames(0x1E)) { - if (D_0013F450_h228770.fA9C != 0) { + if (D_0013F450_h228770.wrench_combo_input_lockout != 0) { break; } if (D_0013F450_h228770.hero_animation_frame >= (float)wrench_attack_record->f10 && @@ -3480,7 +3480,7 @@ int process_hero_equipped_item_input(void) { } } } - if (D_0013F450_h228770.fA9C != 0) { + if (D_0013F450_h228770.wrench_combo_input_lockout != 0) { break; } if (!(D_0013F450_h228770.hero_animation_frame >= (float)wrench_attack_record->f10)) { @@ -3571,7 +3571,7 @@ int process_hero_equipped_item_input(void) { } allocate_hero_voice_for_entry(0x18, 0); D_0013F450_h228770.mode3_toggle_delay_frames = 0x12; - D_0013F450_h228770.f22DC = 1; + D_0013F450_h228770.mode3_toggle_requested = 1; break; case ITEM_REMOTE_VENDOR: if (D_0013F450_h228770.hero_control_mode < 3U || From 3ebdb97ed5ccf2aa2bfe5a4077ee72aa755ac5f6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:53:30 +0000 Subject: [PATCH 041/657] decomp: clarify names in fred_update domain_0_value_1 -> NPC_DIALOGUE_ACTIVATION_AUTOMATIC: fred_update 0x0030120c-0x00301248 compares pvars+8 (dialogue_activation_mode) to 1 and enlarges the dialogue range when the hero is inside the clip volume. The same pvars pointer is passed to update_npc_dialogue at 0x0030126c-0x00301270. Checked helper 0x002752b0 rejects 255; 0x002752ec-0x002752f0 branches for nonzero modes past the facing checks, and 0x002753a0-0x002753bc branches for nonzero modes past the button-bit 0x10 requirement directly into dialogue activation. Thus value 1 activates automatically once the other dialogue gates pass, rather than requiring the mode-zero facing/button interaction. This is the NPC dialogue activation domain, unrelated to hero enums or Fred moby states. f24 -> current_help_message_id: fred_update 0x003016a0-0x003016b8 forms base 0x00179b90 and tests its int +0x24 against -1. Checked level-06 help_request 0x0021b9a8-0x0021b9d0 forms the identical base and rejects requests unless +0x24 is -1. At 0x0021b9b4 incoming a0 (message_id in supplied help_request source) is retained in t0; 0x0021ba20 stores t0 into +0x24 while +0x28 receives the help record index. This proves Busy.f24 is the current help message ID, with -1 denoting none. --- src/overlays/l06/mobys/fred.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/overlays/l06/mobys/fred.c b/src/overlays/l06/mobys/fred.c index 900ca728f0..81d3534ed9 100644 --- a/src/overlays/l06/mobys/fred.c +++ b/src/overlays/l06/mobys/fred.c @@ -71,7 +71,7 @@ typedef struct Obj_301070 { typedef struct Busy { int f0; char pad4[0x20]; - int f24; + int current_help_message_id; } Busy; extern void attach_shared_manipulator_to_matching_class_moby(char *) __asm__("FUN_L03_002db480"); @@ -114,6 +114,9 @@ void fred_update(struct Moby *moby) { RAMP_FRED_POST_CUTSCENE_SCALAR_TO_ZERO = 4, WAIT_FOR_FRED_REMOVAL_TRIGGER = 5 }; + enum { + NPC_DIALOGUE_ACTIVATION_AUTOMATIC = 1 + }; Data_301070 *fred_vars = *(struct Data_301070 **)&moby->pvars; float rate, head_rate; int tracking; @@ -149,7 +152,7 @@ void fred_update(struct Moby *moby) { initialize_npc_dialogue(moby, fred_vars); break; case UPDATE_FRED_DIALOGUE: - if (fred_vars->dialogue_activation_mode == 1 && + if (fred_vars->dialogue_activation_mode == NPC_DIALOGUE_ACTIVATION_AUTOMATIC && is_point_inside_clip_volume(&hero.motion.pos, fred_vars->f168) != 0) { fred_vars->fC = 16.0f; } else { @@ -266,7 +269,7 @@ void fred_update(struct Moby *moby) { set_camera_position(pos); set_camera_rotation(rot); if (fred_vars->f178 >= 1.0f || - (((Busy *)D_L06_00179B90)->f0 == 0 && ((Busy *)D_L06_00179B90)->f24 == -1 && + (((Busy *)D_L06_00179B90)->f0 == 0 && ((Busy *)D_L06_00179B90)->current_help_message_id == -1 && fred_vars->f178 > 0.2f)) { approach_value(&D_L06_0015F3FC_macro, 1.0f, frame_time_macro * 4.0f); } else { From f2cf7e50124a826da45da3bcc247f16dec09bc88 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 23:59:29 +0000 Subject: [PATCH 042/657] decomp: clarify names in kerwan_path_enemy_update b21 -> activation_moby_lookup_selector: Assigned retail 0x002c75a8 loads moby+0x21 into a0 for 0x002c6d98; success at 0x002c75b4 clears the alternate-path cursor and enters alternate-path movement. Checked helper request b0e53c3847d6457db38d1570bbbeae46, 0x002c6d9c-0x002c6db8, rejects selector 0xFF then passes it to a moby lookup producing sp[0]. 0x002c6dc8-0x002c6e04 tests each returned moby with two predicates and advances the lookup until a predicate succeeds or no moby remains. Supplied source is_point_inside_clip_volume_cf name does not establish a clip-volume domain; the name denotes only the proven activation moby lookup selector. domain_2_value_2 -> JUMP_PHASE_LANDED: Source q->jump_phase is Jump2C8398+0x3E within data+0x70, matching assigned retail 0x002c88cc-0x002c8900, where phase 2 approaches horizontal speed zero instead of target_horizontal_speed. Checked motion helper d969f6a6ad0f4152b0c05bf2c75724c7 receives the identical jump record at assigned 0x002c85bc/0x002c85c0. At 0x0024b7bc-0x0024b820 it tests upward ground contact normal and motion into that surface, sets landing bit 1 and stores phase 2. 0x0024b844-0x0024b87c decelerates landed motion toward zero; phase dispatch 0x0024b434/0x0024b5b8-0x0024b5c4 restores animation speed 1.0. Assigned recovery 0x002c85ac-0x002c85e0 likewise skips further jump stepping once landed and waits on animation completion. This is a jump-motion phase, distinct from ENEMY_WAIT_FOR_LINKED_MOBY and all hero enums. --- src/overlays/l03/mobys/kerwan_path_enemy.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/overlays/l03/mobys/kerwan_path_enemy.c b/src/overlays/l03/mobys/kerwan_path_enemy.c index b73fdb5619..56598c9e47 100644 --- a/src/overlays/l03/mobys/kerwan_path_enemy.c +++ b/src/overlays/l03/mobys/kerwan_path_enemy.c @@ -235,7 +235,7 @@ typedef struct Moby2C8398 { char p00[0x10]; float pos[4]; unsigned char state; - unsigned char b21; + unsigned char activation_moby_lookup_selector; char p22[2]; char *p24; char p28[9]; @@ -395,6 +395,9 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { ENEMY_ANIM_LOCOMOTION = 1, ENEMY_ANIM_HEADING_TURN = 9 }; + enum { + JUMP_PHASE_LANDED = 2 + }; Tgt2C8398 selected_target; Data2C8398 *moby_data = m->data; float target_distance; @@ -514,7 +517,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { *(OvlQuad *)m->pos = *(OvlQuad *)(np + 0x10); m->rot[2] = fast_arc_tan(*(float *)(np + 0x20) - *(float *)(np + 0x10), *(float *)(np + 0x24) - *(float *)(np + 0x14)); - if (is_point_inside_clip_volume_cf(m->b21) || + if (is_point_inside_clip_volume_cf(m->activation_moby_lookup_selector) || is_point_inside_clip_volume(&selected_target, moby_data->target_activation_clip_volume_id) || (visited52)[m->mission_index + (current_level_index << 4)] == 0xFF || (target_distance < moby_data->alternate_path_activation_range && @@ -1051,7 +1054,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { q->f8 = q->f8 - q->f10; speed = vector_length_xy(q); want = 0.0f; - if (q->jump_phase != 2) { + if (q->jump_phase != JUMP_PHASE_LANDED) { want = q->target_horizontal_speed; } approach_value(&speed, want, q->f14); From 168649ecbab0f581c0bff17cdc20ef044074b124 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:01:27 +0000 Subject: [PATCH 043/657] decomp: clarify names in woodcut_bot_update fB7 -> hit_response_first_channel_target: Assigned retail 0x002d1a84-0x002d1a94 stores 0x78 at d+0xB7 and passes d+0xB0 to trooper_anim_update; 0x002d3270-0x002d3274 passes that same record to trooper_anim_finish. Checked level-04 helper request 7ad93ecc26814c39a5be39f0d396f265 binds the record to s0 at 0x00250578. At 0x002505f8-0x00250648 record+7 supplies the target interpolated from saved first channel record+4; at 0x002506c4-0x00250710 the reverse phase interpolates back toward the saved channel. The resulting first channel is passed in a1 at 0x002507a0-0x002507ac. Thus this byte is the first hit-response interpolation channel target; the channel's visual meaning is not asserted. fE0 -> knockback_collision_radius_scaled: Authoritative C sets d->fE0=0x15E, matching retail 0x002d1880-0x002d1888. Death motion passes d+0xC0 to step_moby_motion at 0x002d3188-0x002d3190. Checked level-04 helper request 21ad3d36402b460bad5bbd5ada54f549 binds this record to s2 at 0x0024f6e8. Its record+0x20 is therefore d+0xE0. At 0x0024fc50-0x0024fc78 this integer is converted to float, scaled and passed in f12 to the same sphere-collection helper 0x001e51d0 used with explicit radii in assigned melee queries 0x002d1e58-0x002d1ea0. At 0x0024fcf8-0x0024fd14 it is compared after integer-to-float conversion/scaling with the motion-vector length; 0x0024fd40-0x0024fd58 again supplies its scaled value to a collision query. This proves a scaled knockback collision radius without asserting a storage unit. --- src/overlays/l04/mobys/woodcut_bot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index f11992e278..735c076b49 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -178,14 +178,14 @@ typedef struct WBData { /* 0x05A */ unsigned char f5A; /* 0x05B */ char pad05B[0x55]; /* 0x0B0 */ char hit_response_interpolation_state[7]; - /* 0x0B7 */ unsigned char fB7; + /* 0x0B7 */ unsigned char hit_response_first_channel_target; /* 0x0B8 */ char pad0B8[8]; /* 0x0C0 */ char knockback_motion_vector[0x10]; /* 0x0D0 */ float knockback_gravity_decrement; /* 0x0D4 */ float fD4; /* 0x0D8 */ float knockback_horizontal_step; /* 0x0DC */ float knockback_vertical_step_limit; - /* 0x0E0 */ int fE0; + /* 0x0E0 */ int knockback_collision_radius_scaled; /* 0x0E4 */ int knockback_motion_flags; /* 0x0E8 */ float knockback_ground_probe_z_offset; /* 0x0EC */ char pad0EC[0x11]; @@ -370,7 +370,7 @@ void woodcut_bot_update(WBMoby *m) { damage = 0.0f; p = (unsigned char *)find_moby_hit(m, 0xA10000, 0); r = hit_reaction(m, p, &d->hp, 0, &htype, &damage, 0, 4); - d->fE0 = 0x15E; + d->knockback_collision_radius_scaled = 0x15E; d->knockback_ground_probe_z_offset = 0.35f; if (p != 0 && damage != 0.0f && m->state != WOODCUT_BOT_INITIALIZE && d->t3C4 == 0) { unsigned char *hit_source_moby; From 97caabbc79734123b26c04796918c06968c4532a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:03:26 +0000 Subject: [PATCH 044/657] decomp: clarify names in process_hero_equipped_item_input f22D8 -> repeat_press_action_lockout: Retail 0x00228A18-50 checks slot 3 item and current-state eligibility for the repeat-press fallback. 0x00228A54 loads short hero+0x22D8 and 0x00228A58 skips the whole path when nonzero. Only zero permits decrement/testing hero_repeat_press_window_frames at 0x00228A60-70, requesting state 0x81 on a repeat press at 0x00228AD4-DC, and arming the window at 0x00228B04-10. Authoritative C binds these accesses to f22D8. Thus it locks out the repeat-press action path, including window processing; no countdown or physical-button identity is asserted. f5FC -> wrench_slam_input_lockout: In ITEM_WRENCH, retail 0x002282B4-0x00228324 checks the airborne/landing eligibility thresholds. Retail 0x0022832C loads int hero+0x5FC and 0x00228330 branches to the no-action exit when nonzero; only zero reaches 0x00228338-3C, requesting 0x14 through hero_set_state. The authoritative hero_set_state source establishes 0x14 as HERO_STATE_WRENCH_SLAM. The private member f5FC has exactly this nonzero suppression use; the name describes the demonstrated wrench-slam input lockout without asserting a timer or setter. --- src/overlays/shared/hero/hero_set_state.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index 73796f3f8e..2f55ccb49d 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3284,7 +3284,7 @@ typedef struct { char p454[0x58]; short f4AC; char p4AE[0x14E]; - int f5FC; + int wrench_slam_input_lockout; char p600[0x368]; int grapple_target_valid; char p96C[0x18]; @@ -3324,7 +3324,7 @@ typedef struct { char p22A0[0x2A]; unsigned char f22CA; char p22CB[0xD]; - short f22D8; + short repeat_press_action_lockout; char p22DA[0x2]; short mode3_toggle_requested; short mode3_toggle_delay_frames; @@ -3450,7 +3450,7 @@ int process_hero_equipped_item_input(void) { (D_0013F450_h228770.f41E != 0 && D_0013F450_h228770.f2DC > 0.57f) || (D_0013F450_h228770.hero_current_state == HERO_STATE_LAND && D_0013F450_h228770.f2DC > 0.57f)) { - if (D_0013F450_h228770.f5FC != 0) { + if (D_0013F450_h228770.wrench_slam_input_lockout != 0) { break; } hero_set_state(0x14, 1); @@ -3689,7 +3689,7 @@ int process_hero_equipped_item_input(void) { if (D_0013F450_h228770.current_state_elapsed_frames == start) { if (hero_slot_item_id(3) == 3 && D_0013F450_h228770.hero_current_state != HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT && (D_0013F450_h228770.f308 == 0 || item_available[0x1C] == 0) && - D_0013F450_h228770.f22D8 == 0) { + D_0013F450_h228770.repeat_press_action_lockout == 0) { f_fun_001f9740_227fa0(&hero_repeat_press_window_frames); if (hero_repeat_press_window_frames != 0) { if (D_0013F450_h228770.hero_control_mode < 2U || From edb1cb398d463a5f88b5da99680f28a746902d6d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:12:43 +0000 Subject: [PATCH 045/657] decomp: clarify names in process_hero_equipped_item_input f229C -> hero_stick_magnitude: f229C -> hero_stick_magnitude: Assigned retail 0x0022890C loads float hero+0x229C; 0x00228910-28 compares it with 0.7 before selecting hero_set_state(0x23,1) versus start_equipped_item_animation for ground movement. Prepared checked sibling try_start_hero_weapon_fire_state at 0x002276C0, sharing caller 0x00229B70, loads the identical float at 0x00227714 and compares it with 0.7 at 0x00227718-30. Its surrounding item_anim_active, item_anim_framesstick_magnitude. Original assigned Ghidra fRam001415ec is the same absolute address. This proves stick magnitude rather than movement speed or an animation frame. --- src/overlays/shared/hero/hero_set_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index 2f55ccb49d..62f11bbcad 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3320,7 +3320,7 @@ typedef struct { char p20A9[0x3]; unsigned char f20AC; char p20AD[0x1EF]; - float f229C; + float hero_stick_magnitude; char p22A0[0x2A]; unsigned char f22CA; char p22CB[0xD]; @@ -3646,7 +3646,7 @@ int process_hero_equipped_item_input(void) { D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_IDLE || D_0013F450_h228770.hero_current_state == HERO_STATE_STOP || (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GROUND_MOVE && - D_0013F450_h228770.f229C < 0.7f)) { + D_0013F450_h228770.hero_stick_magnitude < 0.7f)) { hero_set_state(0x23, 1); } else { start_equipped_item_animation(); From b3e448320bebe56894ef594f40ab4de11bb05332 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:14:58 +0000 Subject: [PATCH 046/657] decomp: clarify names in woodcut_bot_update fA4 -> hit_record_index: fA4 -> hit_record_index: Authoritative src/overlays/l04/mobys/woodcut_bot.c SHA-256 f0ca86b5cf7b780692d488eea71784cfaa0ca55ab6bc3f7aead0f08970f482d4 calls find_moby_hit at assigned retail 0x002d1844 and resets moby+0xA4 to 0xFF at 0x002d1cb8. Checked level-04 helper evidence fd5b6db646a34dd7a272f23ef670e85a, 0x0024d450-0x0024d46c, loads moby+0xA4, rejects sentinel 0xFF, shifts the byte left six and adds hit-record table base 0x00178280. At 0x0024d470-0x0024d488 it verifies record+0x34 equals this moby and filters record+0x24 using the supplied mask before returning the record pointer. Assigned C then passes that pointer to hit_reaction and reads hit source at record+0x20 and vector at +0x10, matching original retail Ghidra. This proves an index into hit records, not an attack type or state. --- src/overlays/l04/mobys/woodcut_bot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index 735c076b49..b19a590222 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -238,7 +238,7 @@ typedef struct WBMoby { /* 0x7C */ char pad7C[3]; /* 0x7F */ unsigned char f7F; /* 0x80 */ char pad80[0x24]; - /* 0xA4 */ unsigned char fA4; + /* 0xA4 */ unsigned char hit_record_index; /* 0xA5 */ char padA5[0x17]; /* 0xBC */ unsigned char movement_recovery_flags; } WBMoby; @@ -472,7 +472,7 @@ void woodcut_bot_update(WBMoby *m) { } } } - m->fA4 = 0xFF; + m->hit_record_index = 0xFF; if (d->pending_excitement != 0) d->t3C6 = scale_game_frames(0xF0); tm = &d->t3C2; From e3654d2d6836f4d016652157e60e4762a1e64d24 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:21:09 +0000 Subject: [PATCH 047/657] decomp: clarify names in process_hero_equipped_item_input f12EA -> wrench_combo_throw_input_lockout: Retail 0x00228094-98 tests byte hero+0x12EA and rejects the grounded/jump-ready ITEM_WRENCH input path before its pad test, validated wrench object, launch_hero_wrench call at 0x0022815C, and combo/crouch-swing state requests. Retail 0x00228340-44 tests the same byte before the non-slam airborne combo request 0x13; 0x00228460-64 tests it before attack-record-timed combo continuation. Authoritative C binds all these accesses to f12EA. Nonzero therefore locks out these wrench combo/throw inputs; no setter, countdown or slam suppression is claimed. f4AC -> jump_weapon_input_enabled: Retail 0x002287DC-0x00228828 tests hero control mode +0x208C; for jump mode 4, short hero+0x4AC must be nonzero to join the equipment cases 10,17,20,24,25 input path. That path checks pad history, ammo and animation activity, then requests state 0x23 or starts the equipped-item animation at 0x00228864-0x00228938. Authoritative C binds this short to f4AC; supplied hero_set_state initializes corresponding hero.unk4AC to zero in common jump setup and enables it for selected jump families including normal/run/high/repeatable jumps. The name describes this demonstrated jump weapon-input permission only. --- src/overlays/shared/hero/hero_set_state.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index 62f11bbcad..9b6c289740 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3282,7 +3282,7 @@ typedef struct { char p420[0x30]; int high_jump_stick_direction; char p454[0x58]; - short f4AC; + short jump_weapon_input_enabled; char p4AE[0x14E]; int wrench_slam_input_lockout; char p600[0x368]; @@ -3308,7 +3308,7 @@ typedef struct { int equipped_slot_state; int equipped_slot_item_id; char p10BC[0x22E]; - unsigned char f12EA; + unsigned char wrench_combo_throw_input_lockout; char p12EB[0xD99]; int hero_current_state; int f2088; @@ -3389,7 +3389,7 @@ int process_hero_equipped_item_input(void) { (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.f418 != 0)) { Moby_227fa0 *equipped_item_moby; - if (D_0013F450_h228770.f12EA != 0) { + if (D_0013F450_h228770.wrench_combo_throw_input_lockout != 0) { break; } if (!pad_pressed_within(mask, scale_game_frames(7), &item_press_age_frames[0])) { @@ -3456,7 +3456,7 @@ int process_hero_equipped_item_input(void) { hero_set_state(0x14, 1); break; } - if (D_0013F450_h228770.f12EA != 0) { + if (D_0013F450_h228770.wrench_combo_throw_input_lockout != 0) { break; } hero_set_state(0x13, 1); @@ -3493,7 +3493,7 @@ int process_hero_equipped_item_input(void) { if (t > scale_game_frames(0xF)) { t = scale_game_frames(0xF); } - if (D_0013F450_h228770.f12EA != 0) { + if (D_0013F450_h228770.wrench_combo_throw_input_lockout != 0) { break; } if (!pad_pressed_within(mask, t, 0)) { @@ -3628,7 +3628,7 @@ int process_hero_equipped_item_input(void) { D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_LAND || D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GRIND || - (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.f4AC != 0) || + (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.jump_weapon_input_enabled != 0) || (D_0013F450_h228770.hero_current_state == HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL && D_0013F450_h228770.hero_animation_frame > 25.0f)) { int t; int n; From 652071b21eda6376e59e045e4809879567bef1a9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:23:27 +0000 Subject: [PATCH 048/657] decomp: clarify names in is_robot_dog_in_state_5 domain_0_value_253 -> MOBY_STATE_ALTERNATE_REMOVAL_MARKER: Retail 0x002c5b80 loads the input Moby.state byte from +0x20; 0x002c5b88 loads 0xFD and 0x002c5b8c rejects that state before the class/state-5 checks. This is the Moby removal-state domain, not a control/request value: the authoritative source's can_release_linked_robot_dog reads the same struct Moby.state field and rejects MOBY_STATE_PENDING_REMOVAL followed by MOBY_STATE_ALTERNATE_REMOVAL_MARKER. The supplied include/rnc/mobys/moby_state.h MobyRemovalState domain establishes MOBY_STATE_ALTERNATE_REMOVAL_MARKER = 253. Reuse that canonical member for this identical state sentinel. --- src/overlays/l03/mobys/robot_dog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l03/mobys/robot_dog.c b/src/overlays/l03/mobys/robot_dog.c index 2174bcc883..18fd6db1f3 100644 --- a/src/overlays/l03/mobys/robot_dog.c +++ b/src/overlays/l03/mobys/robot_dog.c @@ -42,7 +42,7 @@ enum { int is_robot_dog_in_state_5(struct Moby *moby) __asm__("FUN_L03_002c5b78"); int is_robot_dog_in_state_5(struct Moby *moby) { - if (moby && moby->state != MOBY_STATE_PENDING_REMOVAL && moby->state != 0xFD && + if (moby && moby->state != MOBY_STATE_PENDING_REMOVAL && moby->state != MOBY_STATE_ALTERNATE_REMOVAL_MARKER && moby->oclass == 0x23D && moby->state == ROBOT_DOG_FOLLOW_PATH) { return 1; } From 88095ec442de59c2bed1de378620ba9378f6bfd5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:26:31 +0000 Subject: [PATCH 049/657] decomp: clarify names in save_card_state_formatting domain_0_value_0 -> MEMCARD_QUERY_INFO: Retail 0x00208b30 forms a1 = 0x0013d290; 0x00208b40 loads pending_state at +0xdc and 0x00208b44 uses bgez to reject nonnegative pending operations. Original Ghidra identifies this load as g_nPendingMemoryCardOperationState. The supplied memory_card_state.h declaration context explicitly assigns state/pending_state to MemoryCardOperation, whose canonical zero member is MEMCARD_QUERY_INFO. Thus this existing member supplies the exact zero boundary in that proven domain. --- src/ui/menus/save_data/save_card_state_formatting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/menus/save_data/save_card_state_formatting.c b/src/ui/menus/save_data/save_card_state_formatting.c index e809683793..df73705a7a 100644 --- a/src/ui/menus/save_data/save_card_state_formatting.c +++ b/src/ui/menus/save_data/save_card_state_formatting.c @@ -7,7 +7,7 @@ void save_card_state_formatting(void) __asm__("FUN_00208b28"); void save_card_state_formatting(void) { struct MemoryCardState *card_state = &memory_card_state; - if (card_state->state == MEMCARD_DISPATCH_PENDING_OPERATION && card_state->pending_state < 0) { + if (card_state->state == MEMCARD_DISPATCH_PENDING_OPERATION && card_state->pending_state < MEMCARD_QUERY_INFO) { if (card_state->err != 0) { save_card_state = CS_FORMAT_FAILED; mode_freeze_flags |= 0x40; From 07f44347f78c0452da04fe4eff7a2f3cabbf8b59 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:29:19 +0000 Subject: [PATCH 050/657] decomp: clarify names in get_hero_easing_moby_by_kind domain_0_value_0 -> HERO_EASE_KIND_ON_FOOT_HERO_MOBY: Retail 0x00205110 branches for a0==0 to 0x00205130/0x00205138, returning [0x001413D0], hero base 0x0013F350 + moby offset 0x2080. Checked caller 0x00205188/0x0020518C supplies HeroEase.kind from record+0xA2. Its 0x0020519C load reads byte [0x001413F4], hero+0x20A4 (vehicle_mode in the supplied source); when nonzero, 0x002051D0 rejects kind 0. Thus kind 0 targets the hero moby for on-foot easing. Source HERO_VEHICLE_MODE_ON_FOOT is zero; this proposal names the separate easing-kind domain, not the vehicle-mode value. --- src/overlays/shared/hero/hero_idle_sequence.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 0aad0bcc69..f468ff224b 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -161,7 +161,10 @@ int get_hero_easing_moby_by_kind(int ease_kind) { HERO_EASE_KIND_SLOT_THREE_SECONDARY_MOBY = 1, HERO_EASE_KIND_SLOT_ZERO_PRIMARY_MOBY = 5 }; - if (ease_kind == 0 || ease_kind == 2 || ease_kind == 3 || ease_kind == 4) { + enum { + HERO_EASE_KIND_ON_FOOT_HERO_MOBY = 0 + }; + if (ease_kind == HERO_EASE_KIND_ON_FOOT_HERO_MOBY || ease_kind == 2 || ease_kind == 3 || ease_kind == 4) { return D_001413D0[0]; } if (ease_kind == HERO_EASE_KIND_SLOT_THREE_SECONDARY_MOBY) { From 3bbcf9d892e2bac7e1dcdbb1a3b06d5350684ee3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:31:17 +0000 Subject: [PATCH 051/657] decomp: clarify names in process_hero_equipped_item_input f300 -> airborne_repeat_press_action_enabled: Retail 0x00228A78-0x00228AA8 reads hero control mode +0x208C: modes below 2 and crouch bypass the test, but fall mode 2 and jump mode 4 require int hero+0x300 nonzero before the repeat-press pad test at 0x00228AC4-CC and hero_set_state(0x81,1) at 0x00228AD4-DC. Authoritative C binds this exact permission gate to f300. The name describes its demonstrated airborne repeat-press input permission, without claiming a setter or physical movement condition. f30E -> grapple_extended_press_window_enabled: In ITEM_GRAPPLE, retail 0x002284B8-BC obtains scale_game_frames(5), reads short hero+0x30E at 0x002284C0, and replaces the pad-history window with scale_game_frames(8) at 0x002284CC-D4 only when nonzero. That window is passed to pad_pressed_within at 0x0022851C-20 after the control-mode checks. Authoritative C has the identical f30E conditional. The name describes the proven enabling of the extended grapple press window without asserting the underlying movement condition or timer lifecycle. f418 -> jump_ground_item_input_enabled: Retail 0x0022806C-0x00228098 admits the ground-style ITEM_WRENCH path for control modes below 2, or jump mode 4 only when int hero+0x418 is nonzero. The same nonzero jump gate is repeated for equipment case 18 at 0x00228950-0x00228978. Authoritative C binds both loads to f418; those paths perform their ground-style combo/throw or held-item attack input checks, while the separate airborne wrench-slam branch is later. This is a functional name for jump-mode access to these ground item-input paths, not a claim about its setter or jump phase. --- src/overlays/shared/hero/hero_set_state.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index 9b6c289740..b37f9737a1 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3269,14 +3269,14 @@ typedef struct { char p1E8[0xF4]; float f2DC; char p2E0[0x20]; - int f300; + int airborne_repeat_press_action_enabled; char p304[0x4]; short f308; short f30A; short f30C; - short f30E; + short grapple_extended_press_window_enabled; char p310[0x108]; - int f418; + int jump_ground_item_input_enabled; short f41C; short f41E; char p420[0x30]; @@ -3386,7 +3386,7 @@ int process_hero_equipped_item_input(void) { switch (D_0013F450_h228770.equipped_slot_item_id) { case ITEM_WRENCH: if (D_0013F450_h228770.hero_control_mode < 2U || - (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.f418 != 0)) { + (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.jump_ground_item_input_enabled != 0)) { Moby_227fa0 *equipped_item_moby; if (D_0013F450_h228770.wrench_combo_throw_input_lockout != 0) { @@ -3516,7 +3516,7 @@ int process_hero_equipped_item_input(void) { select_hero_grapple_swing_target(); select_hero_grapple_target(); t = scale_game_frames(5); - if (D_0013F450_h228770.f30E != 0) { + if (D_0013F450_h228770.grapple_extended_press_window_enabled != 0) { t = scale_game_frames(8); } if (D_0013F450_h228770.hero_control_mode < 2U || @@ -3661,7 +3661,7 @@ int process_hero_equipped_item_input(void) { break; case 18: if (D_0013F450_h228770.hero_control_mode < 2U || - (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.f418 != 0)) { + (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.jump_ground_item_input_enabled != 0)) { if (D_0013F450_h228770.hero_current_state != HERO_STATE_LOOK) { int t = scale_game_frames(0xA); int n = D_0013F450_h228770.f10B0; @@ -3696,7 +3696,7 @@ int process_hero_equipped_item_input(void) { D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || ((D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_FALL || D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP) && - D_0013F450_h228770.f300 != 0)) { + D_0013F450_h228770.airborne_repeat_press_action_enabled != 0)) { if ((controller_state.held & 8) && (controller_state.pressed & 8)) { hero_set_state(0x81, 1); } From 64cbc815852b1ea35aaae8529ae6f5feb8a674aa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:37:09 +0000 Subject: [PATCH 052/657] decomp: clarify names in is_turret_group_activated_or_empty domain_0_value_0 -> TURRET_STATE_LIVE_MINIMUM: Retail 0x002b46a0-0x002b46b0 resolves a packed turret-group member into the moby pool; lb at 0x002b46b4 reads signed Moby.state at +0x20. slti at 0x002b46bc and movz at 0x002b46c4 increment the live-member count only for states >= 0. At 0x002b46e4 the function returns true when that count is zero. The prepared original decompilation explicitly identifies empty as no live/nonnegative-state members. Thus zero is the minimum live turret state for this eligibility test, rather than an interceptor or hero state ID. domain_1_value_0 -> TURRET_STATE_LIVE_MINIMUM: This is the second test of the same signed Moby.state loaded at retail 0x002b46b4 from the resolved turret-group member. bltz at 0x002b46c0 skips the pvars+0x88 activation read at 0x002b46c8 for negative states; only states >= 0 may cause the success return via 0x002b46cc. Source uses the same state variable for counting and activation eligibility. The original decompilation confirms this guard and identifies these as live/nonnegative members, proving the same minimum live-state boundary as domain_0_value_0. --- src/overlays/l14/mobys/blarg_heavy_interceptor.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 1893011ffe..f2ff17d2f4 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -2066,6 +2066,9 @@ int try_retract_turret_group(int index) { extern char *D_L14_ffd0_e[] __asm__("D_L14_0015FFD0") MACRO_ADDR; int is_turret_group_activated_or_empty(int index) { + enum { + TURRET_STATE_LIVE_MINIMUM = 0 + }; unsigned short *list = (unsigned short *)D_L14_001AC2C0_2B0168[index]; int count = 0; char *moby_pool_base; @@ -2080,9 +2083,9 @@ int is_turret_group_activated_or_empty(int index) { char *moby = moby_pool_base + ((id & 0x7FFF) << 8); int state = ((signed char)MOBY(moby)->state); char *group_member_vars = ((char *)MOBY(moby)->pvars); - if (state >= 0) + if (state >= TURRET_STATE_LIVE_MINIMUM) count++; - if (state >= 0 && *(short *)(group_member_vars + 0x88)) + if (state >= TURRET_STATE_LIVE_MINIMUM && *(short *)(group_member_vars + 0x88)) goto success; list++; if ((short)id < 0) From c9c5f537d3f9415e2bddb0ee73febebd0d4b7bca Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:39:36 +0000 Subject: [PATCH 053/657] decomp: clarify names in process_hero_equipped_item_input f41E -> jump_apex_passed: f41E -> jump_apex_passed: Assigned retail 0x002282B4 reads short hero+0x41E and 0x002282B8-0x002282E4 selects the 0.1 versus 0.57 wrench-slam clearance threshold according to its zero/nonzero value. Checked shared-caller sibling try_enter_hero_water_state (0x002279B0, caller 0x00229B70 via 0x00229C30) tests the identical short at 0x00227AEC-0x00227AF0 and 0x00227B70-0x00227B74 when control mode is jump, and at 0x00227BD4-0x00227BD8 for water-surface jump state 0x12. These instruction branches match the authoritative supplied C's hero_ptr->past_jump_apex and hero_depth_check_ptr->past_jump_apex conditions, including water-surface-height and descending-displacement checks. Thus this is the flag that the jump apex has passed, rather than a timer or a ground-clearance measurement. --- src/overlays/shared/hero/hero_set_state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index b37f9737a1..740d401fef 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3278,7 +3278,7 @@ typedef struct { char p310[0x108]; int jump_ground_item_input_enabled; short f41C; - short f41E; + short jump_apex_passed; char p420[0x30]; int high_jump_stick_direction; char p454[0x58]; @@ -3446,8 +3446,8 @@ int process_hero_equipped_item_input(void) { if (!pad_pressed_within(mask, t, 0)) { break; } - if ((D_0013F450_h228770.f41E == 0 && D_0013F450_h228770.f2DC > 0.1f) || - (D_0013F450_h228770.f41E != 0 && D_0013F450_h228770.f2DC > 0.57f) || + if ((D_0013F450_h228770.jump_apex_passed == 0 && D_0013F450_h228770.f2DC > 0.1f) || + (D_0013F450_h228770.jump_apex_passed != 0 && D_0013F450_h228770.f2DC > 0.57f) || (D_0013F450_h228770.hero_current_state == HERO_STATE_LAND && D_0013F450_h228770.f2DC > 0.57f)) { if (D_0013F450_h228770.wrench_slam_input_lockout != 0) { From 8acbd66f7660020e5816333f1748851c997c689c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:41:25 +0000 Subject: [PATCH 054/657] decomp: clarify names in refresh_spawner_population_and_find_free_slot domain_0_value_253 -> MOBY_STATE_ALTERNATE_REMOVAL_MARKER: Retail 0x0030ab20 loads slot_moby from the +0xB0 pointer array; 0x0030ab2c checks its moby class +0xA6 against 0x75E. The lbu at 0x0030ab38 reads that same moby's state byte +0x20. li a2,0xFD at 0x0030ab10 and beql v0,a2 at 0x0030ab44 exclude that state from the population increment at 0x0030ab4c-0x0030ab54 and select the reusable slot index. Thus the selector is the moby removal-state domain, not spawner control state. Prepared retail annotation records checked sibling mark_moby_for_removal writing 0xFE to moby +0x20 and alternatively 0xFD below its pool boundary. This supports the supplied canonical MobyRemovalState member MOBY_STATE_ALTERNATE_REMOVAL_MARKER=253 in include/rnc/mobys/moby_state.h, rather than inference from numeric equality alone. --- src/overlays/shared/enemies/spawner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/spawner.c b/src/overlays/shared/enemies/spawner.c index f684768b3a..e3bb670781 100644 --- a/src/overlays/shared/enemies/spawner.c +++ b/src/overlays/shared/enemies/spawner.c @@ -132,7 +132,7 @@ int refresh_spawner_population_and_find_free_slot(int unused, char *spawner_vars char *slot_moby = *slot; if (slot_moby != 0 && MOBY(slot_moby)->oclass == 0x75E && (unsigned char)MOBY(slot_moby)->state != MOBY_STATE_REMOVAL_MARKER && - (unsigned char)MOBY(slot_moby)->state != 0xFD) { + (unsigned char)MOBY(slot_moby)->state != MOBY_STATE_ALTERNATE_REMOVAL_MARKER) { spawner_vars[0x91]++; } else { last = i; From f1af50c9c1717c50287b6a926288d2d6b530a9fe Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:44:38 +0000 Subject: [PATCH 055/657] decomp: clarify names in spawn_homing_spark_projectile domain_0_value_1 -> HOMING_SPARK_PROJECTILE_ACTIVE: Retail 0x002d5238-3c allocates class 0x350, 0x002d5244 skips initialization on null, and 0x002d524c loads 1 which 0x002d5264 stores to this new moby's state byte at +0x20. The same guarded branch enables visibility (0x002d5268), copies spawn position and velocity (0x002d526c-78), and initializes target height, lifetime and target moby (0x002d527c-88) before returning the projectile. Supplied helicopter firing callers retain it as their shot/projectile. The prepared original Ghidra plate explicitly identifies state 1 as active and the class 0x350 consumer as homing, emitting sparks/arcs and cleaning up on timeout/hit. This proves the active homing-spark projectile state, independently of the helicopter's unrelated state-1 activation path. --- src/overlays/shared/enemies/blarg_helicopter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/blarg_helicopter.c b/src/overlays/shared/enemies/blarg_helicopter.c index 132370b608..9e794b94da 100644 --- a/src/overlays/shared/enemies/blarg_helicopter.c +++ b/src/overlays/shared/enemies/blarg_helicopter.c @@ -927,13 +927,16 @@ char *spawn_homing_spark_projectile(char *velocity, int lifetime_frames, float target_height) { + enum { + HOMING_SPARK_PROJECTILE_ACTIVE = 1 + }; char *spawned_moby = (char *)create_moby(0x350); char *projectile_pvars; if (spawned_moby != 0) { MOBY(spawned_moby)->update_dist = 0xFF; MOBY(spawned_moby)->draw_dist = 0x7E; MOBY(spawned_moby)->visible = 1; - MOBY(spawned_moby)->state = 1; + MOBY(spawned_moby)->state = HOMING_SPARK_PROJECTILE_ACTIVE; projectile_pvars = ((char *)MOBY(spawned_moby)->pvars); qcopy(&MOBY(spawned_moby)->pos, spawn_position); qcopy(projectile_pvars, velocity); From 8f30aab85dea104973b8f70ff783e8d6e783c476 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:48:15 +0000 Subject: [PATCH 056/657] decomp: clarify names in process_hero_equipped_item_input f20AC -> equipped_item_input_restricted: Retail 0x00227FD0-0x00227FF8 loads byte hero+0x20AC and, when nonzero, returns zero unless equipped slot item +0x10B8 is ITEM_WRENCH (8) and short +0x308 equals 1. The authoritative C has precisely this early guard before the general input lock, slot readiness and equipment dispatch. Thus this byte activates an equipped-item input restriction with a demonstrated wrench exception; the name does not claim an unconditional lock or identify its setter. f22CA -> repeat_press_action_latch: The authoritative hero_set_state HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT entry sets hero.unk22CA=1. Assigned retail 0x00228AD4-DC requests that same state 0x81 through the repeat-press window path. Retail 0x00228B14-38 clears byte hero+0x22CA only outside current states 0x13,0x81,0x15,0x16 when the fallback eligibility fails; original Ghidra records uRam0014161a=0. Source binds that clear to f22CA. Together the entry set and selective retention/clear establish a latched repeat-press action flag; no unobserved consumer is asserted. --- src/overlays/shared/hero/hero_set_state.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index 740d401fef..1201a745c2 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3318,11 +3318,11 @@ typedef struct { char p20A5[0x3]; unsigned char equipped_item_animation_active; char p20A9[0x3]; - unsigned char f20AC; + unsigned char equipped_item_input_restricted; char p20AD[0x1EF]; float hero_stick_magnitude; char p22A0[0x2A]; - unsigned char f22CA; + unsigned char repeat_press_action_latch; char p22CB[0xD]; short repeat_press_action_lockout; char p22DA[0x2]; @@ -3368,7 +3368,7 @@ int process_hero_equipped_item_input(void) { int start; int mask; - if (D_0013F450_h228770.f20AC != 0 && + if (D_0013F450_h228770.equipped_item_input_restricted != 0 && (D_0013F450_h228770.equipped_slot_item_id != 8 || D_0013F450_h228770.f308 != 1)) { return 0; } @@ -3709,7 +3709,7 @@ int process_hero_equipped_item_input(void) { D_0013F450_h228770.hero_current_state != HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT && D_0013F450_h228770.hero_current_state != HERO_STATE_CROUCH_SWING && D_0013F450_h228770.hero_current_state != HERO_STATE_HURT) { - D_0013F450_h228770.f22CA = 0; + D_0013F450_h228770.repeat_press_action_latch = 0; } } return D_0013F450_h228770.current_state_elapsed_frames < start; From 3d186f29b7f795231c0aee08339612853370164d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 00:57:58 +0000 Subject: [PATCH 057/657] decomp: clarify names in volume_camera_swing_check domain_0_value_11 -> SWING_CAMERA_TYPE_FORCE_FOLLOW_MODE: Retail 0x002ed248-0x002ed254 selects camera_descriptors[record->descriptor_index].params; lh at 0x002ed270 and comparison at 0x002ed274-0x002ed278 therefore test SwingCameraParams.type, not a hero state. Checked direct helper volume_camera_swing (evidence request f3d32437b7f448b2ab05f83f51ac4bb6) tests that same params+0x2c against 11 at 0x002eccc0-0x002eccc8. Its branch calls set_follow_camera_blend_output_flags at 0x002eccd0 and loads current_follow_cam at 0x002ecce0, its state pointer at +0x70 at 0x002ecce4, then unconditionally writes 2 to FollowCamState.tail.mode (+0x230) at 0x002ecce8. Source matches this per-frame assignment. FORCE_FOLLOW_MODE names that proven operation without claiming a gameplay meaning for mode 2 or the global gate. --- src/overlays/shared/camera/swing_volume_camera.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/camera/swing_volume_camera.c b/src/overlays/shared/camera/swing_volume_camera.c index a03acb1e9a..14e1b49946 100644 --- a/src/overlays/shared/camera/swing_volume_camera.c +++ b/src/overlays/shared/camera/swing_volume_camera.c @@ -382,10 +382,13 @@ void volume_camera_swing(struct UpdateCam *swing_camera_record) { s32 volume_camera_swing_check(struct UpdateCam *cam) __asm__("FUN_L00_002ed230"); s32 volume_camera_swing_check(struct UpdateCam *swing_camera_record) { + enum { + SWING_CAMERA_TYPE_FORCE_FOLLOW_MODE = 11 + }; SwingCameraParams *params = camera_descriptors[swing_camera_record->descriptor_index].params; if (params->l_buttons_end == 1 && params->done != 0) return 0; - if (params->type == 11 && D_001413F4 != 2) + if (params->type == SWING_CAMERA_TYPE_FORCE_FOLLOW_MODE && D_001413F4 != 2) return 0; if ((params->type == SWING_CAMERA_TYPE_SLIDE_RELEASE_ANGLE_AT_END || params->type == SWING_CAMERA_TYPE_SLIDE_KEEP_ANGLE_AT_END) && From 259634aa61056dfec9b6196bf59940af7a831b60 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 01:00:15 +0000 Subject: [PATCH 058/657] decomp: clarify names in cancel_suck_cannon_suction domain_0_value_254 -> MOBY_STATE_REMOVAL_MARKER: Retail 0x002dbe28 retains the input moby in s1; 0x002dbe50 loads its state byte at +0x20 and 0x002dbe4c/0x002dbe54 compare it with 0xFE before returning zero. This is source moby->state, not the separate suction state loaded from s2+0x68 at 0x002dbe64. The supplied sibling FUN_L00_002dc9f0 uses MOBY_STATE_REMOVAL_MARKER on this same struct Moby state field to reject removed mobys before obtaining the suction record. Thus the selector belongs to the supplied MobyRemovalState domain in include/rnc/mobys/moby_state.h, whose canonical 254 member is reused. domain_1_value_253 -> MOBY_STATE_ALTERNATE_REMOVAL_MARKER: Retail 0x002dbe50 loads the input moby's +0x20 state byte into v1; 0x002dbe58 loads 0xFD and 0x002dbe5c rejects that state through 0x002dbf08. Original Ghidra expresses this same guard as cVar1 != -3. The source comparison is moby->state, and supplied sibling FUN_L00_002dc9f0 rejects the same struct Moby field with MOBY_STATE_ALTERNATE_REMOVAL_MARKER alongside MOBY_STATE_REMOVAL_MARKER. This proves the shared MobyRemovalState selector domain rather than the independent suction-record state at +0x68; reuse its canonical 253 member. --- src/overlays/shared/weapons/suckcannon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 793e1819cd..d6d756619e 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -1958,7 +1958,7 @@ s32 cancel_suck_cannon_suction(struct Moby *moby) { s32 k; if (suction_record == 0) return 0; - if (moby == 0 || moby->state == 0xFE || moby->state == 0xFD) + if (moby == 0 || moby->state == MOBY_STATE_REMOVAL_MARKER || moby->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER) return 0; k = *(s16 *)(suction_record + 0x68); if (k == 8) From edc736cac51f27f8c724cde6ab8c5e9103c38798 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 01:08:21 +0000 Subject: [PATCH 059/657] decomp: clarify names in store_moby_in_suck_cannon domain_0_value_254 -> MOBY_STATE_REMOVAL_MARKER: Retail 0x002dbb2c preserves the moby argument in s1; 0x002dbb54 loads its state byte at +0x20, and 0x002dbb50/58 rejects 0xFE by branching to the zero return at 0x002dbc10. Original Ghidra likewise compares param_1+0x20 against -2. Authoritative C identifies this exact byte as MOBY(moby)->state, the same field tested with MOBY_STATE_REMOVAL_MARKER by cancel_suck_cannon_suction and FUN_L00_002dc9f0 in the supplied source. This proves the MobyRemovalState domain in include/rnc/mobys/moby_state.h, distinct from suction_record+0x68. domain_1_value_253 -> MOBY_STATE_ALTERNATE_REMOVAL_MARKER: Retail 0x002dbb54 loads the moby argument's state byte at s1+0x20; 0x002dbb5c/60 compares that same byte against 0xFD and rejects it through 0x002dbc10. Original Ghidra compares param_1+0x20 against -3. Authoritative C calls this MOBY(moby)->state; cancel_suck_cannon_suction and FUN_L00_002dc9f0 already use MOBY_STATE_ALTERNATE_REMOVAL_MARKER for that same moby field alongside MOBY_STATE_REMOVAL_MARKER. Therefore the canonical MobyRemovalState member applies, rather than a suction-record or control-mode constant. --- src/overlays/shared/weapons/suckcannon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index d6d756619e..931eb909e7 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -1863,7 +1863,7 @@ s32 store_moby_in_suck_cannon(u8 *moby, OvlQuad *position) { struct Moby *sound_source_moby; if (suction_record == 0) return 0; - if (moby != 0 && MOBY(moby)->state != 0xFE && MOBY(moby)->state != 0xFD && + if (moby != 0 && MOBY(moby)->state != MOBY_STATE_REMOVAL_MARKER && MOBY(moby)->state != MOBY_STATE_ALTERNATE_REMOVAL_MARKER && *(s16 *)(suction_record + 0x68) != 8) { qcopy(&MOBY(moby)->pos, position); FUN_L00_002d9fd0_002dbb20( From c7bf7fc4a5e408094d744251f8986fe1022f349d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 01:11:33 +0000 Subject: [PATCH 060/657] decomp: clarify names in spawn_plasmabot_death_debris domain_0_value_0 -> PLASMABOT_DEBRIS_STATE_INITIAL: In the authoritative source src/overlays/shared/enemies/plasmabot_death_debris.c (SHA-256 cad208a3e959c5e872b74ca3a31292f9c640f9eff9766cf3391dfd39096c170d), this token initializes MOBY(spawned_moby)->state inside the successful create_moby(0x145) branch. Retail 0x002deab4..0x002deac8 allocates class 0x145, saves its pointer in s2 and branches away on null; 0x002deaf8 executes sb zero,0x20(s2). Original Ghidra independently shows *(undefined1 *)(iVar6 + 0x20) = 0 after allocation and before func_0x002592f8(lVar3), the update_entity activation call at 0x002dec10. This proves the initial state of spawned death debris, without implying hero idle, gravity or vehicle semantics. --- src/overlays/shared/enemies/plasmabot_death_debris.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/plasmabot_death_debris.c b/src/overlays/shared/enemies/plasmabot_death_debris.c index c2590f15cd..97698f4712 100644 --- a/src/overlays/shared/enemies/plasmabot_death_debris.c +++ b/src/overlays/shared/enemies/plasmabot_death_debris.c @@ -161,6 +161,9 @@ extern float plasmabot_debris_z_velocity_range_end_gp __asm__("D_L14_00161B14") unsigned char *spawn_plasmabot_death_debris(char *owner, char *pos) __asm__("FUN_L14_002dea98"); unsigned char *spawn_plasmabot_death_debris(char *debris_source_moby, char *pos) { + enum { + PLASMABOT_DEBRIS_STATE_INITIAL = 0 + }; unsigned char *spawned_moby = create_moby(0x145); char *spawned_vars; char *hero_launch_reference; @@ -170,7 +173,7 @@ unsigned char *spawn_plasmabot_death_debris(char *debris_source_moby, char *pos) *(char **)(spawned_vars + 0x24) = debris_source_moby; qcopy(&MOBY(spawned_moby)->pos, pos); MOBY(spawned_moby)->rot.z = MOBY(debris_source_moby)->rot.z; - MOBY(spawned_moby)->state = 0; + MOBY(spawned_moby)->state = PLASMABOT_DEBRIS_STATE_INITIAL; MOBY(spawned_moby)->update_dist = 0xFF; MOBY(spawned_moby)->draw_dist = 0xFF; MOBY(spawned_moby)->visible = 1; From 4ab16ed453cc03d2d399a310ad5a813302a137ca Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 01:14:56 +0000 Subject: [PATCH 061/657] decomp: clarify names in launch_suck_cannon_projectile domain_0_value_254 -> MOBY_STATE_REMOVAL_MARKER: Retail 002dbc3c preserves the input moby in s2; 002dbc78 loads its state byte at +0x20, and 002dbc74/002dbc7c compare that byte with 0xFE and branch to the zero return at 002dbdf4. Original Ghidra likewise tests param_2+0x20 against -2 before launch setup. SHA-bound source identifies this exact selector as MOBY(moby)->state, the same selector guarded with MOBY_STATE_REMOVAL_MARKER in store_moby_in_suck_cannon and cancel_suck_cannon_suction. Thus this belongs to shared MobyRemovalState in include/rnc/mobys/moby_state.h, not the separate projectile_record+0x68 state domain. domain_1_value_253 -> MOBY_STATE_ALTERNATE_REMOVAL_MARKER: Retail 002dbc78 loads v1 from +0x20 of s2, the input moby preserved at 002dbc3c; 002dbc80 loads 0xFD and 002dbc84 compares the same state byte and rejects launch via 002dbdf4. Original Ghidra tests param_2+0x20 against -3. The SHA-bound source maps that byte to MOBY(moby)->state, and adjacent store_moby_in_suck_cannon/cancel_suck_cannon_suction use canonical MOBY_STATE_ALTERNATE_REMOVAL_MARKER for the identical moby-state rejection guard. This proves shared MobyRemovalState membership independently of the distinct record+0x68 projectile states. --- src/overlays/shared/weapons/suckcannon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 931eb909e7..05ece78753 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -1900,7 +1900,7 @@ s32 launch_suck_cannon_projectile(u8 *moby, u8 *d; if (projectile_record == 0) return 0; - if (moby == 0 || MOBY(moby)->state == 0xFE || MOBY(moby)->state == 0xFD || + if (moby == 0 || MOBY(moby)->state == MOBY_STATE_REMOVAL_MARKER || MOBY(moby)->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER || *(s16 *)(projectile_record + 0x68) == 8) goto fail; MOBY(moby)->visible = 1; From d72b2b1e10b1ab3165b859e60606e6ce4ed55f00 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 01:23:02 +0000 Subject: [PATCH 062/657] decomp: clarify names in scatter_moby_from_hazards domain_0_value_253 -> MOBY_STATE_ALTERNATE_REMOVAL_MARKER: Retail 0x002df1ec preserves the candidate moby argument in s0; 0x002df220 loads its +0x20 state byte, and 0x002df22c-0x002df230 compare that same byte with 0xFD and return before collection. Original decompilation likewise excludes *(char *)(param_1+0x20)==-3. This is the moby passed to begin_bolt_attraction (0x002df350-0x002df360) or try_collect_ammo_pickup (0x002df36c-0x002df370), not a suction-record +0x68 selector. Authoritative C defines this +0x20 member as pickup_moby_state and checks MOBY(moby)->state against MOBY_STATE_ALTERNATE_REMOVAL_MARKER in store_moby_in_suck_cannon, launch_suck_cannon_projectile and cancel_suck_cannon_suction. The supplied include/rnc/mobys/moby_state.h MobyRemovalState domain declares that canonical member as 253; reuse it for the identical state exclusion. --- src/overlays/shared/weapons/suckcannon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 05ece78753..5ed4a51b0e 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -3205,7 +3205,7 @@ void scatter_moby_from_hazards(O_2df1e0 *pickup_moby) { return; if (pickup_moby->pickup_moby_state == MOBY_STATE_REMOVAL_MARKER) return; - if (pickup_moby->pickup_moby_state == 0xFD) + if (pickup_moby->pickup_moby_state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER) return; if (random_integer_below(10)) return; From 5528e5fa422df35ec540baeeeffccd30d8414975 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 01:36:33 +0000 Subject: [PATCH 063/657] decomp: clarify names in process_moby_suck_cannon_suction domain_0_value_254 -> MOBY_STATE_REMOVAL_MARKER: Retail 002db904 preserves the incoming moby in s2; 002db934 loads its byte at +0x20 and 002db930/002db938 compare it to 0xFE, returning zero at 002dbafc. Original Ghidra likewise tests param_1+0x20 against -2. Bound C identifies exactly that field as MOBY(moby)->state, the same field tested with MOBY_STATE_REMOVAL_MARKER in store_moby_in_suck_cannon, launch_suck_cannon_projectile and cancel_suck_cannon_suction. Thus this selector belongs to the supplied shared MobyRemovalState domain in include/rnc/mobys/moby_state.h, whose canonical member is 254; it is not the distinct suction record state read at 002db948. domain_1_value_253 -> MOBY_STATE_ALTERNATE_REMOVAL_MARKER: Retail 002db934 loads the incoming moby's +0x20 state byte into v1; 002db93c loads 0xFD and 002db940 rejects that same byte by returning zero at 002dbafc. Original Ghidra tests param_1+0x20 against -3. Authoritative C maps this load to MOBY(moby)->state; adjacent store_moby_in_suck_cannon, launch_suck_cannon_projectile and cancel_suck_cannon_suction already use MOBY_STATE_ALTERNATE_REMOVAL_MARKER for this same moby field and paired exclusion. This proves the supplied shared MobyRemovalState domain, whose canonical alternate removal member is 253, rather than the unrelated record+0x68 suction state. --- src/overlays/shared/weapons/suckcannon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 5ed4a51b0e..a7c9295d37 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -1791,7 +1791,7 @@ s32 process_moby_suck_cannon_suction(u8 *moby, u8 *position, u8 *target) { s16 state; if (moby_suction_record == 0) goto missing; - if (moby == 0 || MOBY(moby)->state == 0xFE || MOBY(moby)->state == 0xFD || + if (moby == 0 || MOBY(moby)->state == MOBY_STATE_REMOVAL_MARKER || MOBY(moby)->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER || *(s16 *)(moby_suction_record + 0x68) == 8) goto fail; qcopy_nc(moby_suction_record, position); From 267264e477502b4174bd50c7746989b6478d8bef Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 01:47:00 +0000 Subject: [PATCH 064/657] decomp: clarify names in spawn_ryno_rocket domain_0_value_0 -> RYNO_ROCKET_STATE_INITIAL: At 0x002ccf1c-0x002ccf28 create_moby(0x1C9) returns the new RYNO rocket in s2; the null guard at 0x002ccf2c precedes 0x002ccf58 sb zero,0x20(s2), which initializes that object's Moby.state. This is separate from the caller's RYNO weapon state: ryno_update passes the weapon as owner, stored at rocket_vars+0x20 (0x002ccf5c), while s2 is the newly allocated rocket returned at 0x002cd1c0. The initial state is assigned alongside visibility and yaw/pitch before owner, spawn position, target and lifetime initialization. INITIAL names only this proven creation-time role, without inferring flight or a state-handler lifecycle. --- src/overlays/shared/weapons/ryno.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/ryno.c b/src/overlays/shared/weapons/ryno.c index 50639b3352..08fd48f258 100644 --- a/src/overlays/shared/weapons/ryno.c +++ b/src/overlays/shared/weapons/ryno.c @@ -456,6 +456,9 @@ unsigned char *spawn_ryno_rocket(int owner_moby, float yaw, float pitch) { + enum { + RYNO_ROCKET_STATE_INITIAL = 0 + }; V_2ccee0 forward_step; V_2ccee0 collision_start; V_2ccee0 explosion_direction; @@ -475,7 +478,7 @@ unsigned char *spawn_ryno_rocket(int owner_moby, MOBY(spawned_moby)->visible = 1; MOBY(spawned_moby)->rot.z = yaw; MOBY(spawned_moby)->rot.y = pitch; - MOBY(spawned_moby)->state = 0; + MOBY(spawned_moby)->state = RYNO_ROCKET_STATE_INITIAL; *(int *)(rocket_vars + 0x20) = owner_moby; qcopy(&MOBY(spawned_moby)->pos, spawn_position); qcopy(rocket_vars + 0x10, spawn_position); From ae65ea8712dd22cd60bea8aed13d56f1a1ff5084 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 01:51:29 +0000 Subject: [PATCH 065/657] decomp: clarify names in update_hero_ground_material_effects domain_3_value_8 -> GROUND_MATERIAL_SLIP: The authoritative source saves hero.ground_type, assigned from collision_hit_material in the supplied ground-contact function. Retail 0x0022cd7c saves that signed halfword in s2. Its material-8 comparison at 0x0022cf50 and store at 0x0022cf60 set hero+0x12ea, the source's on_slip_ground flag. Source clip_hero_horizontal_velocity also treats collision material 8 as a horizontal sliding condition. This is a collision-material behavior name, not HERO_STATE_LAND. domain_5_value_12 -> GROUND_MATERIAL_SLIP_NO_LEDGE: Retail s2 is saved hero.ground_type at 0x0022cd7c. The material-12 comparison at 0x0022cf80 sets hero+0x12ea/on_slip_ground at 0x0022cf8c, just as material 8 does. The bounded level-01 ledge-probe export (request d31498d46cb54689be14adccb2aa5237) loads s8=12 at 0x0022d250; after collision_hit_material at 0x0022d324, 0x0022d338 branches to the next probe for material 12, bypassing the acceptance path at 0x0022d348-0x0022d378. Supplied update_hero_ledge_probe C confirms material 12 is excluded from ledge-top acceptance. Thus slipping plus ledge-probe exclusion distinguishes it from material 8 without assigning a physical substance or hero-state meaning. --- src/overlays/shared/hero/hero_frame_update.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_frame_update.c b/src/overlays/shared/hero/hero_frame_update.c index ac96b60bd6..e419ce729d 100644 --- a/src/overlays/shared/hero/hero_frame_update.c +++ b/src/overlays/shared/hero/hero_frame_update.c @@ -343,6 +343,10 @@ extern int l01_hero_set_state(int, int) __asm__("FUN_L01_0023cf98"); extern void exit_hero_vehicle_mode_if_mode_three(void) __asm__("FUN_L00_0020b930"); void update_hero_ground_material_effects(void) { + enum { + GROUND_MATERIAL_SLIP = 8, + GROUND_MATERIAL_SLIP_NO_LEDGE = 0xC + }; struct Hero *hero_ptr = &hero; int saved_ground_type; int x; @@ -404,7 +408,7 @@ void update_hero_ground_material_effects(void) { struct Hero *q = &hero; q->selector_13 = 1; } - if (saved_ground_type == 8) { + if (saved_ground_type == GROUND_MATERIAL_SLIP) { struct Hero *q = &hero; q->on_slip_ground = 1; } @@ -412,7 +416,7 @@ void update_hero_ground_material_effects(void) { struct Hero *q = &hero; q->grind_jump_block = 1; } - if (saved_ground_type == 0xC) { + if (saved_ground_type == GROUND_MATERIAL_SLIP_NO_LEDGE) { struct Hero *q = &hero; q->on_slip_ground = 1; } From 6e318e6eed650a0dbb16b77fb245f4bb4708c6a0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 01:56:25 +0000 Subject: [PATCH 066/657] decomp: clarify names in update_hero_easing_record domain_3_value_0 -> HERO_EASE_KIND_ON_FOOT_HERO_MOBY: Retail 0x00205178 preserves the HeroEase record in s0; 0x0020518c loads its signed kind at +0xA2 for get_hero_easing_moby_by_kind. The same +0xA2 is loaded at 0x002051a4 and tested against zero at 0x002051d0 when D_001413F4 is nonzero. The authoritative source names precisely ease_kind == 0 as HERO_EASE_KIND_ON_FOOT_HERO_MOBY in that lookup helper. Checked helper retail 0x00205110 branches on zero to 0x00205130-0x00205138, returning D_001413D0[0], the same hero moby selected for kinds 2/3/4. This reuses the established member of the identical easing-kind domain, without treating it as a hero state ID. --- src/overlays/shared/hero/hero_idle_sequence.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index f468ff224b..248a1465c0 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -193,13 +193,16 @@ void build_quaternion_from_axis_rotations(void *, void *) __asm__("FUN_L00_00259 void update_hero_easing_record(struct HeroEase *ease_record) __asm__("FUN_L00_00205168"); void update_hero_easing_record(struct HeroEase *ease_record) { + enum { + HERO_EASE_KIND_ON_FOOT_HERO_MOBY = 0 + }; s32 moby = get_hero_easing_moby_by_kind(ease_record->kind); if (moby == 0) return; if (D_001413F4 == 0) { if (ease_record->kind == 4 || ease_record->kind == 2 || ease_record->kind == 3) return; - } else if (ease_record->kind == 0) { + } else if (ease_record->kind == HERO_EASE_KIND_ON_FOOT_HERO_MOBY) { return; } if (ease_record->rot_target.f[0] == 0.0f && ease_record->rot_target.f[1] == 0.0f && From 945199d15afcfc20f7bdaa68ce7e882b632cdcff Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:06:58 +0000 Subject: [PATCH 067/657] decomp: clarify names in update_bolt_grounded_pose domain_0_value_254 -> MOBY_STATE_PENDING_REMOVAL: Retail 0x002a70cc loads BoltVars.ground_moby from +0x5C and 0x002a70e4-0x002a70ec compares that moby's +0x20 state to 0xFE; the branch forces detachment and clears support at 0x002a71cc. Checked common caller bolt_update directly calls this routine and mark_moby_for_removal (jal 0x0024eb68 at 0x002a6b2c after collection, also 0x002a6600 for culling). Bounded sibling export 7f27581302bc40c98c41e518273efbef proves removal helper 0x0024eb8c loads 0xFE and 0x0024eb90 stores it to the same moby state byte +0x20; 0x0024eb98-0x0024ebb0 also records current frame +2 at +0x38. Original Ghidra agrees. Thus this is the general moby state marking pending removal, not BOLT_FALLING or a control mode. --- src/overlays/shared/pickups/bolt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/pickups/bolt.c b/src/overlays/shared/pickups/bolt.c index 5722117c77..1a6cfd6268 100644 --- a/src/overlays/shared/pickups/bolt.c +++ b/src/overlays/shared/pickups/bolt.c @@ -541,6 +541,9 @@ void collect_bolt(struct Moby *bolt) { void update_bolt_grounded_pose(char *moby, void *out1, void *out2) __asm__("FUN_L00_002a6de8"); void update_bolt_grounded_pose(char *moby, void *base_position_output, void *base_rotation_output) { + enum { + MOBY_STATE_PENDING_REMOVAL = 0xFE + }; char *grounded_bolt_vars = ((char *)MOBY(moby)->pvars); float local_rotation_basis[12]; float base_rotation_basis[12]; @@ -623,7 +626,7 @@ void update_bolt_grounded_pose(char *moby, void *base_position_output, void *bas if (ground_moby != 0 && *(unsigned char *)(grounded_bolt_vars + 0x57) == 0) { int should_detach_from_ground; char *x; - if ((unsigned char)MOBY(ground_moby)->state == 0xFE || + if ((unsigned char)MOBY(ground_moby)->state == MOBY_STATE_PENDING_REMOVAL || (*(unsigned char **)(grounded_bolt_vars + 0x5C))[0x20] == 0xFD) { should_detach_from_ground = 1; } else { From a08afc7edf1cb45ef27b8aa37bd5cfd13a7a0a7e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:10:45 +0000 Subject: [PATCH 068/657] decomp: clarify names in taunter_update domain_0_value_1 -> TAUNTER_TYPE_NONACTIVATION_BLEND_DISABLED: Retail 0x002b720c tests private voice slot +4 for negativity after voice_is_playing returned zero. The no-voice branch loads taunter type byte +0x53 at 0x002b7248, compares it with 1 at 0x002b724c-0x002b7250, and bypasses the sequence-1 blend at 0x002b7258-0x002b7270. Authoritative C names this call blend_moby_animation; its supplied implementation confirms an animation sequence blend. Thus type 1 disables the nonactivation blend in this branch, without asserting sequence visual semantics. domain_1_value_1 -> TAUNTER_TYPE_NONACTIVATION_BLEND_DISABLED: Retail 0x002b72c4-0x002b72cc loads the same taunter object type byte +0x53 and skips the sequence-1 blend at 0x002b72d4-0x002b72ec when equal to 1. This is the voice-stop/cleanup path preceding owner/active checks and release_voice_slot at 0x002b72f0-0x002b733c. Together with the no-voice branch, it proves the same nonactivation-blend-disabled role. The activation sequence-3 blend at 0x002b7140-0x002b7164 instead excludes type 3, so the proposed name deliberately bounds the suppressed blends. --- src/overlays/shared/weapons/taunter.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/taunter.c b/src/overlays/shared/weapons/taunter.c index aee847a7ff..095a101a1a 100644 --- a/src/overlays/shared/weapons/taunter.c +++ b/src/overlays/shared/weapons/taunter.c @@ -471,6 +471,9 @@ void taunter_update(Moby *taunter_moby) { enum { TAUNTER_TYPE_CONTINUOUS_EFFECT_EMISSION = 3 }; + enum { + TAUNTER_TYPE_NONACTIVATION_BLEND_DISABLED = 1 + }; Vars *taunter_vars; s32 taunter_state; s32 voice_slot_index; @@ -551,7 +554,7 @@ void taunter_update(Moby *taunter_moby) { taunter_vars->retry++; else taunter_vars->retry = 0; - if (taunter_moby->type != 1) + if (taunter_moby->type != TAUNTER_TYPE_NONACTIVATION_BLEND_DISABLED) blend_moby_animation(taunter_moby, 1, 0, scale_game_frames(5)); goto end; } @@ -563,7 +566,7 @@ void taunter_update(Moby *taunter_moby) { goto L7340; } } - if (taunter_moby->type != 1) + if (taunter_moby->type != TAUNTER_TYPE_NONACTIVATION_BLEND_DISABLED) blend_moby_animation(taunter_moby, 1, 0, scale_game_frames(5)); voice_slot_index = taunter_vars->anim; if (voice_slot_index != -1) { From 66269f68016d006639f0127032a998588fc60d38 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:13:56 +0000 Subject: [PATCH 069/657] decomp: clarify names in process_ultramech_hits_and_update_target domain_0_value_0 -> ULTRAMECH_TARGET_NOT_OUTSIDE_SEARCH_RANGE: Retail 0x002d1364 clears data+0x164 (UData.target_range_status). After either search helper, 0x002d13e8-0x002d1404 compares distance from instance+0x10 to search output data+0x120 against data+0x1b8 and replaces zero with 2 only when range < distance. Thus zero is the default not-outside-search-range status, without asserting target validity. domain_1_value_2 -> ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE: Retail 0x002d13e8 computes distance to search output; 0x002d13f0-0x002d1404 loads current_target_search_range at data+0x1b8 and writes 2 to data+0x164 only when range < distance. This is the exact target_range_status field read by supplied ultramech_unlimited_update, whose local ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE=2 gates activation and combat. It is separate from instance state and Hero enums. --- src/overlays/l15/mobys/ultramech_unlimited.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/overlays/l15/mobys/ultramech_unlimited.c b/src/overlays/l15/mobys/ultramech_unlimited.c index 6dfe4d7fcb..1483ae3546 100644 --- a/src/overlays/l15/mobys/ultramech_unlimited.c +++ b/src/overlays/l15/mobys/ultramech_unlimited.c @@ -1000,6 +1000,10 @@ void process_ultramech_hits_and_update_target(void *ultramech_instance) { enum { HIT_CLASSIFICATION_NO_DAMAGE = 1 }; + enum { + ULTRAMECH_TARGET_NOT_OUTSIDE_SEARCH_RANGE = 0, + ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE = 2 + }; UMoby *ultramech_moby = ultramech_instance; UData *ultramech_vars = ultramech_moby->data; char *slot = 0; @@ -1135,7 +1139,7 @@ void process_ultramech_hits_and_update_target(void *ultramech_instance) { update_hit_color_flash(ultramech_moby, (char *)ultramech_vars + 0x60); *(float *)((char *)ultramech_moby + 0x2C) = *(float *)(ultramech_moby->cls + 0x24) * ultramech_post_hit_scale_multiplier_gp; - ultramech_vars->target_range_status = 0; + ultramech_vars->target_range_status = ULTRAMECH_TARGET_NOT_OUTSIDE_SEARCH_RANGE; if (ultramech_moby->state != ULTRAMECH_WAIT_FOR_ACTIVATION) { if (ultramech_vars->target_constraint_path_index != -1) goto follow_path; @@ -1163,7 +1167,7 @@ follow_path: { check_path: if (ultramech_vars->current_target_search_range < fast_vec_dist(&ultramech_moby->pos, (char *)ultramech_vars + 0x120)) - ultramech_vars->target_range_status = 2; + ultramech_vars->target_range_status = ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE; if (ultramech_vars->target == 0) ultramech_vars->target = (UMoby *)D_001413D0; } From 59845272d3b892456d3ca863f62419365a5b8199 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:25:41 +0000 Subject: [PATCH 070/657] decomp: clarify names in apply_hero_ground_material_effects domain_3_value_1 -> GROUND_MATERIAL_STATE_DEPENDENT_CONTACT_BYPASS: The assigned retail loads the s16 hero.ground_type snapshot into s2 at 0x00239ff4; comparison 0x0023a208 and store 0x0023a214 map material 1 to hero.selector_1. The supplied update_hero_ground_contact writes hero.ground_type from collision_hit_material() and already names this same material GROUND_MATERIAL_STATE_DEPENDENT_CONTACT_BYPASS: when hero.ground_type equals it and (u32)(hero.state.current - 0x7C) < 2, it jumps to d1, bypassing normal ground-contact processing. Assigned retail 0x0023a28c-0x0023a2d4 consumes selector_1 with grounded_frames, exits vehicle mode three, and selects state 0x3c or 0x7c according to health. This proves the collision-material domain and state-dependent contact bypass, independently of equal-valued state/mode enums. --- src/overlays/l05/hero/apply_hero_ground_material_effects.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l05/hero/apply_hero_ground_material_effects.c b/src/overlays/l05/hero/apply_hero_ground_material_effects.c index 1ffc44f09c..14cbe97012 100644 --- a/src/overlays/l05/hero/apply_hero_ground_material_effects.c +++ b/src/overlays/l05/hero/apply_hero_ground_material_effects.c @@ -34,6 +34,9 @@ void apply_hero_ground_material_effects(void) { GROUND_MATERIAL_SINK_SURFACE_PROBE_THROUGH = 3, GROUND_MATERIAL_SINK_SURFACE_CONTACT_BYPASS = 11 }; + enum { + GROUND_MATERIAL_STATE_DEPENDENT_CONTACT_BYPASS = 1 + }; u8 save = hero.ground_sound_class; s16 saved_ground_type = hero.ground_type; f32 water_depth; @@ -83,7 +86,7 @@ void apply_hero_ground_material_effects(void) { hero.selector_4 = 1; if (saved_ground_type == GROUND_MATERIAL_SINK_TRIGGER) hero.selector_13 = 1; - if (saved_ground_type == 1) + if (saved_ground_type == GROUND_MATERIAL_STATE_DEPENDENT_CONTACT_BYPASS) hero.selector_1 = 1; if (saved_ground_type == 8) hero.on_slip_ground = 1; From 040cc8690cbc047f9360682462b3bcbaf5b0ebd9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:36:39 +0000 Subject: [PATCH 071/657] decomp: clarify names in split_door_update domain_0_value_2 -> SPLIT_DOOR_STATE_NO_UPDATE: Retail 0x002fc000 loads unsigned parent moby+0x20; 0x002fc010-0x002fc024 indexes the six-word jump table at 0x00201790. Checked level-06 data request 8f0b9e64d10e4df2846e4604899bcd31 gives third word e0c52f00 at 0x00201798, little-endian 0x002fc5e0: the register-restore/return epilogue, with no update handler. Initialization 0x002fc0c4-0x002fc0d4 tests pvars+4==2, stores 2 to this same moby+0x20 state, and returns before offset movement. Thus this state skips this function's transform, phase, trigger and reset updates. This is a split-door moby state, distinct from the pvars control value, command+0xbc phase domain and hero enums. --- src/overlays/l06/mobys/split_door.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/overlays/l06/mobys/split_door.c b/src/overlays/l06/mobys/split_door.c index 93015c041a..16e3bf246c 100644 --- a/src/overlays/l06/mobys/split_door.c +++ b/src/overlays/l06/mobys/split_door.c @@ -93,6 +93,9 @@ void split_door_update(char *moby) { SPLIT_DOOR_PHASE_TARGET_CURRENT_TRANSFORMS = 1, SPLIT_DOOR_PHASE_TARGET_CONFIGURED_TRANSFORMS = 2 }; + enum { + SPLIT_DOOR_STATE_NO_UPDATE = 2 + }; SplitDoorVars *pair_transform_vars = (SplitDoorVars *)MOBY(moby)->pvars; char *child; float position_offset[4]; From 3ca6561854dee7f23347750bc415623dcc49823e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:39:15 +0000 Subject: [PATCH 072/657] decomp: clarify names in spawner_update domain_0_value_253 -> MOBY_STATE_ALTERNATE_REMOVAL_MARKER: Retail 0x0030ac5c loads target_moby from spawner private data +0x140; 0x0030acc8 loads that moby's byte +0x20 (MOBY(target_moby)->state), then 0x0030acd0-0x0030acd4 compare it with 0xFD and branch to target invalidation at 0x0030acf4-0x0030acf8. The prepared original Ghidra likewise checks target +0x20 against -2 and -3 before copying target +0x10 position. This is the moby lifecycle state domain: the authoritative source's refresh_spawner_population_and_find_free_slot tests the identical MOBY(slot_moby)->state field against MOBY_STATE_REMOVAL_MARKER and MOBY_STATE_ALTERNATE_REMOVAL_MARKER to exclude removed mobys. The supplied include/rnc/mobys/moby_state.h MobyRemovalState domain defines the canonical alternate marker as 253. Thus domain identity is established by the field and parallel removal filtering, beyond numeric equality. --- src/overlays/shared/enemies/spawner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/spawner.c b/src/overlays/shared/enemies/spawner.c index e3bb670781..ce484d15a3 100644 --- a/src/overlays/shared/enemies/spawner.c +++ b/src/overlays/shared/enemies/spawner.c @@ -194,7 +194,7 @@ void spawner_update(char *moby) { char *target_moby = *(char **)((char *)spawner_vars + 0x140); if (target_moby != 0 && (unsigned char)MOBY(target_moby)->state != MOBY_STATE_REMOVAL_MARKER && - (unsigned char)MOBY(target_moby)->state != 0xFD) { + (unsigned char)MOBY(target_moby)->state != MOBY_STATE_ALTERNATE_REMOVAL_MARKER) { qcopy((char *)spawner_vars + 0x100, &MOBY(target_moby)->pos); } else { *(int *)((char *)spawner_vars + 0x140) = 0; From ee0841b6d3da8bfb896ccaa442d908e5a714082d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:49:29 +0000 Subject: [PATCH 073/657] decomp: clarify names in volume_camera_swing domain_0_value_11 -> SWING_CAMERA_TYPE_FORCE_FOLLOW_MODE: Retail 0x002ec9c4-0x002ec9d8 follows record+0x84 through camera_descriptors to params+0x2c, proving SwingCameraParams.type rather than a hero-state selector. At 0x002eccc0-0x002ecce8 type 11 calls set_follow_camera_blend_output_flags and unconditionally writes 2 to current_follow_cam->state->tail.mode (+0x230). Original Ghidra sVar5==0xb and the bound C agree. The supplied volume_camera_swing_check uses the established local SWING_CAMERA_TYPE_FORCE_FOLLOW_MODE=11 on this exact same params->type domain; reuse its proven name. --- src/overlays/shared/camera/swing_volume_camera.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/camera/swing_volume_camera.c b/src/overlays/shared/camera/swing_volume_camera.c index 14e1b49946..dabb2e7d7e 100644 --- a/src/overlays/shared/camera/swing_volume_camera.c +++ b/src/overlays/shared/camera/swing_volume_camera.c @@ -147,6 +147,9 @@ void volume_camera_swing(struct UpdateCam *swing_camera_record) { enum { SWING_CAMERA_TYPE_SLIDE_RELEASE_ANGLE_ALLOW_AIRBORNE_ENTRY = 7 }; + enum { + SWING_CAMERA_TYPE_FORCE_FOLLOW_MODE = 11 + }; CameraVec gravity_offset_or_yaw_direction; SwingCameraParams *params; struct UpdateCam *current_follow_camera_record; @@ -251,7 +254,7 @@ void volume_camera_swing(struct UpdateCam *swing_camera_record) { set_follow_camera_blend_output_flags(); FOLLOW_CAM_STATE(current_follow_cam)->tail.mode = 0x14D; } - if (params->type == 11) { + if (params->type == SWING_CAMERA_TYPE_FORCE_FOLLOW_MODE) { set_follow_camera_blend_output_flags(); FOLLOW_CAM_STATE(current_follow_cam)->tail.mode = 2; } From d97663acc55f506b9120f108c4e704e1e0f07a01 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 02:51:21 +0000 Subject: [PATCH 074/657] decomp: clarify names in update_hero_ground_contact_and_surface_slopes domain_1_value_13 -> GROUND_MATERIAL_WATER_SURFACE: collision_hit_material at 0x002128f0 stores its result in hero.ground_type (hero+0x12E0) at 0x00212900; bounded helper 4590bbff7be44562b63ed2ab12fa17fe proves this is collision-record material bits, not HeroStateId. The comparison at 0x00212998-0x002129a4 selects material 13; 0x002129bc/0x002129d0 copies collision_hit_z into established hero.water_surface_z, then 0x002129cc/0x002129e0 starts a mask-4 ground query 0.01 below that water surface. Original Ghidra sRam00140630 == 0xd and fRam0013f640 stores agree with the bound C. domain_2_value_3 -> GROUND_MATERIAL_SINK_SURFACE_REPROBE: The collision-material return stored at 0x00212900 is reloaded from hero+0x12E0 and compared with 3 at 0x002129ec-0x002129f4. This branch copies collision_hit_z into established hero.sink_surface_z at 0x00212a0c/0x00212a20, moves ground_ray_start.z to hit_z minus 0.01 at 0x00212a1c/0x00212a30, and performs another mask-4 ground query at 0x00212a2c. Original Ghidra sRam00140630 == 3 agrees. REPROBE names the proven distinction from material 11; no specific substance is asserted. domain_3_value_11 -> GROUND_MATERIAL_SINK_SURFACE_SKIP_GROUND_CONTACT: The same collision-material selector hero+0x12E0 is compared with 11 at 0x00212a3c-0x00212a44. Instructions 0x00212a4c-0x00212a58 copy collision_hit_z into established hero.sink_surface_z and branch directly to 0x00212c48/0x00212c4c. This bypasses the underlying ground query and ground-contact record/counter updates. Original Ghidra sRam00140630 == 0xb and goto LAB_00212c4c agree with the bound C; the name states only the sink-height role and contact bypass. --- src/overlays/shared/hero/hero_switch_item.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index a356863e57..2d6a6badfa 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -3334,6 +3334,11 @@ extern CollisionHit HH __asm__("D_L00_00173E40") NOT_SDA; void update_hero_ground_contact_and_surface_slopes(void) __asm__("FUN_L00_002127b8"); void update_hero_ground_contact_and_surface_slopes(void) { + enum { + GROUND_MATERIAL_SINK_SURFACE_REPROBE = 3, + GROUND_MATERIAL_SINK_SURFACE_SKIP_GROUND_CONTACT = 0xB, + GROUND_MATERIAL_WATER_SURFACE = 0xD + }; V collision_ray_end, ground_ray_start, ground_offset_or_angles, side_ray_start, unused_side_probe_point, side_hit_angles, side_hit_normal; f32 f; @@ -3395,21 +3400,21 @@ void update_hero_ground_contact_and_surface_slopes(void) { } hero.ground_sound_class = collision_sound_class; } - if (hero.ground_type == 0xD) { + if (hero.ground_type == GROUND_MATERIAL_WATER_SURFACE) { hero.water_surface_z = collision_hit_z; ground_ray_start.f[2] = collision_hit_z - 0.01f; if (collision_line(&ground_ray_start, &collision_ray_end, 4, hero.moby, 0) == 0) { goto d1; } } - if (hero.ground_type == 3) { + if (hero.ground_type == GROUND_MATERIAL_SINK_SURFACE_REPROBE) { hero.sink_surface_z = collision_hit_z; ground_ray_start.f[2] = collision_hit_z - 0.01f; if (collision_line(&ground_ray_start, &collision_ray_end, 4, hero.moby, 0) == 0) { goto d1; } } - if (hero.ground_type == 0xB) { + if (hero.ground_type == GROUND_MATERIAL_SINK_SURFACE_SKIP_GROUND_CONTACT) { hero.sink_surface_z = collision_hit_z; goto d1; } From fe270341e8faeb4f1ea7f7f5147b9379bf2be7be Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 03:06:12 +0000 Subject: [PATCH 075/657] decomp: clarify names in walker_update_gait domain_0_value_13 -> WALKER_GAIT_RUN: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1728-0x002a1770 blends run anim[7] and selects 13; walk-to-run 0x002a1a68-0x002a1aac and landing recovery 0x002a3bb4-0x002a3c14 select the same state. Reuse its existing WALKER_GAIT_RUN member for this same selector assignment. domain_10_value_8 -> WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1dd0-0x002a1e88 blends anim[5] for the alternate negative-height entry; 0x002a30e4-0x002a30e8 stores 8. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL member for this same selector assignment. domain_11_value_5 -> WALKER_GAIT_TRANSITION_FROM_UPHILL_TO_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2090-0x002a209c and 0x002a2518-0x002a25d4 select 5 as uphill terrain levels; its branch returns to walk anim[0]/1 through 0x002a2694-0x002a3194. Reuse its existing WALKER_GAIT_TRANSITION_FROM_UPHILL_TO_WALK member for this same selector assignment. domain_12_value_4 -> WALKER_GAIT_WALK_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2064-0x002a22f4 blends anim[3] and stores 4 when corrected probe height remains high; the state retains uphill walking until terrain levels. Reuse its existing WALKER_GAIT_WALK_UPHILL member for this same selector assignment. domain_13_value_7 -> WALKER_GAIT_TRANSITION_TO_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1d80-0x002a1f44 selects anim[4] for corrected probe height below the negative threshold and stores 7 at 0x002a2f60-0x002a2f64. Reuse its existing WALKER_GAIT_TRANSITION_TO_DOWNHILL member for this same selector assignment. domain_14_value_6 -> WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2228-0x002a2234 and 0x002a25d8-0x002a2690 select alternate uphill recovery 6 as terrain levels; its branch returns to walk anim[0]/1. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK member for this same selector assignment. domain_15_value_4 -> WALKER_GAIT_WALK_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2064-0x002a22f4 blends anim[3] and stores 4 when corrected probe height remains high; the state retains uphill walking until terrain levels. Reuse its existing WALKER_GAIT_WALK_UPHILL member for this same selector assignment. domain_16_value_8 -> WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1dd0-0x002a1e88 blends anim[5] for the alternate negative-height entry; 0x002a30e4-0x002a30e8 stores 8. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL member for this same selector assignment. domain_17_value_7 -> WALKER_GAIT_TRANSITION_TO_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1d80-0x002a1f44 selects anim[4] for corrected probe height below the negative threshold and stores 7 at 0x002a2f60-0x002a2f64. Reuse its existing WALKER_GAIT_TRANSITION_TO_DOWNHILL member for this same selector assignment. domain_18_value_5 -> WALKER_GAIT_TRANSITION_FROM_UPHILL_TO_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2090-0x002a209c and 0x002a2518-0x002a25d4 select 5 as uphill terrain levels; its branch returns to walk anim[0]/1 through 0x002a2694-0x002a3194. Reuse its existing WALKER_GAIT_TRANSITION_FROM_UPHILL_TO_WALK member for this same selector assignment. domain_19_value_6 -> WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2228-0x002a2234 and 0x002a25d8-0x002a2690 select alternate uphill recovery 6 as terrain levels; its branch returns to walk anim[0]/1. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK member for this same selector assignment. domain_1_value_1 -> WALKER_GAIT_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a17e8-0x002a184c blends walk anim[0] on idle movement departure and stores 1; run slowdown returns to anim[0]/1 at 0x002a31d8-0x002a32ac. Reuse its existing WALKER_GAIT_WALK member for this same selector assignment. domain_20_value_7 -> WALKER_GAIT_TRANSITION_TO_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1d80-0x002a1f44 selects anim[4] for corrected probe height below the negative threshold and stores 7 at 0x002a2f60-0x002a2f64. Reuse its existing WALKER_GAIT_TRANSITION_TO_DOWNHILL member for this same selector assignment. domain_21_value_2 -> WALKER_GAIT_TRANSITION_TO_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1d20-0x002a1d7c selects anim[1] on raised corrected probe height; 0x002a2e64-0x002a2f1c blends it and stores 2 for uphill entry. Reuse its existing WALKER_GAIT_TRANSITION_TO_UPHILL member for this same selector assignment. domain_22_value_1 -> WALKER_GAIT_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a17e8-0x002a184c blends walk anim[0] on idle movement departure and stores 1; run slowdown returns to anim[0]/1 at 0x002a31d8-0x002a32ac. Reuse its existing WALKER_GAIT_WALK member for this same selector assignment. domain_23_value_8 -> WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1dd0-0x002a1e88 blends anim[5] for the alternate negative-height entry; 0x002a30e4-0x002a30e8 stores 8. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL member for this same selector assignment. domain_24_value_3 -> WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail raised-probe selection chooses anim[2] at 0x002a1d70-0x002a1d74; 0x002a2fe8-0x002a30a0 blends that alternate uphill entry and stores 3. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL member for this same selector assignment. domain_25_value_1 -> WALKER_GAIT_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a17e8-0x002a184c blends walk anim[0] on idle movement departure and stores 1; run slowdown returns to anim[0]/1 at 0x002a31d8-0x002a32ac. Reuse its existing WALKER_GAIT_WALK member for this same selector assignment. domain_26_value_3 -> WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail raised-probe selection chooses anim[2] at 0x002a1d70-0x002a1d74; 0x002a2fe8-0x002a30a0 blends that alternate uphill entry and stores 3. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL member for this same selector assignment. domain_27_value_10 -> WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2c4c-0x002a2d50 levels out of downhill gait through anim[4] and stores 10; its branch recovers normal walk anim[0]/1. Reuse its existing WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK member for this same selector assignment. domain_28_value_9 -> WALKER_GAIT_WALK_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2a1c-0x002a2be8 blends anim[6] and stores 9 while corrected ground height stays below the downhill threshold; state 9 retains downhill gait. Reuse its existing WALKER_GAIT_WALK_DOWNHILL member for this same selector assignment. domain_29_value_2 -> WALKER_GAIT_TRANSITION_TO_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1d20-0x002a1d7c selects anim[1] on raised corrected probe height; 0x002a2e64-0x002a2f1c blends it and stores 2 for uphill entry. Reuse its existing WALKER_GAIT_TRANSITION_TO_UPHILL member for this same selector assignment. domain_2_value_0 -> WALKER_GAIT_IDLE: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a3520-0x002a3540 blends idle_animation_id at entry zero, resets gait helpers and stores zero into +0xB7. Reuse its existing WALKER_GAIT_IDLE member for this same selector assignment. domain_30_value_11 -> WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2c8c-0x002a2e0c selects anim[5] and stores 11 as downhill terrain levels; its alternate recovery branch blends walk anim[0]/1. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK member for this same selector assignment. domain_31_value_9 -> WALKER_GAIT_WALK_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2a1c-0x002a2be8 blends anim[6] and stores 9 while corrected ground height stays below the downhill threshold; state 9 retains downhill gait. Reuse its existing WALKER_GAIT_WALK_DOWNHILL member for this same selector assignment. domain_32_value_3 -> WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail raised-probe selection chooses anim[2] at 0x002a1d70-0x002a1d74; 0x002a2fe8-0x002a30a0 blends that alternate uphill entry and stores 3. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL member for this same selector assignment. domain_33_value_2 -> WALKER_GAIT_TRANSITION_TO_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1d20-0x002a1d7c selects anim[1] on raised corrected probe height; 0x002a2e64-0x002a2f1c blends it and stores 2 for uphill entry. Reuse its existing WALKER_GAIT_TRANSITION_TO_UPHILL member for this same selector assignment. domain_34_value_10 -> WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2c4c-0x002a2d50 levels out of downhill gait through anim[4] and stores 10; its branch recovers normal walk anim[0]/1. Reuse its existing WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK member for this same selector assignment. domain_35_value_11 -> WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a2c8c-0x002a2e0c selects anim[5] and stores 11 as downhill terrain levels; its alternate recovery branch blends walk anim[0]/1. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK member for this same selector assignment. domain_36_value_2 -> WALKER_GAIT_TRANSITION_TO_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1d20-0x002a1d7c selects anim[1] on raised corrected probe height; 0x002a2e64-0x002a2f1c blends it and stores 2 for uphill entry. Reuse its existing WALKER_GAIT_TRANSITION_TO_UPHILL member for this same selector assignment. domain_37_value_7 -> WALKER_GAIT_TRANSITION_TO_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1d80-0x002a1f44 selects anim[4] for corrected probe height below the negative threshold and stores 7 at 0x002a2f60-0x002a2f64. Reuse its existing WALKER_GAIT_TRANSITION_TO_DOWNHILL member for this same selector assignment. domain_38_value_1 -> WALKER_GAIT_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a17e8-0x002a184c blends walk anim[0] on idle movement departure and stores 1; run slowdown returns to anim[0]/1 at 0x002a31d8-0x002a32ac. Reuse its existing WALKER_GAIT_WALK member for this same selector assignment. domain_39_value_3 -> WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail raised-probe selection chooses anim[2] at 0x002a1d70-0x002a1d74; 0x002a2fe8-0x002a30a0 blends that alternate uphill entry and stores 3. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL member for this same selector assignment. domain_3_value_13 -> WALKER_GAIT_RUN: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1728-0x002a1770 blends run anim[7] and selects 13; walk-to-run 0x002a1a68-0x002a1aac and landing recovery 0x002a3bb4-0x002a3c14 select the same state. Reuse its existing WALKER_GAIT_RUN member for this same selector assignment. domain_40_value_8 -> WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1dd0-0x002a1e88 blends anim[5] for the alternate negative-height entry; 0x002a30e4-0x002a30e8 stores 8. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL member for this same selector assignment. domain_41_value_1 -> WALKER_GAIT_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a17e8-0x002a184c blends walk anim[0] on idle movement departure and stores 1; run slowdown returns to anim[0]/1 at 0x002a31d8-0x002a32ac. Reuse its existing WALKER_GAIT_WALK member for this same selector assignment. domain_42_value_1 -> WALKER_GAIT_WALK: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a17e8-0x002a184c blends walk anim[0] on idle movement departure and stores 1; run slowdown returns to anim[0]/1 at 0x002a31d8-0x002a32ac. Reuse its existing WALKER_GAIT_WALK member for this same selector assignment. domain_43_value_15 -> WALKER_GAIT_TAKEOFF_ANIMATION: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1ae0-0x002a1b9c blends anim[11] and stores 15; its handler 0x002a3544-0x002a35c4 computes vertical launch velocity before airborne wait. Reuse its existing WALKER_GAIT_TAKEOFF_ANIMATION member for this same selector assignment. domain_44_value_14 -> WALKER_GAIT_ALTERNATE_TAKEOFF_ANIMATION: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1ba0-0x002a1c5c blends anim[9] and stores 14; its handler 0x002a36ac-0x002a3784 computes launch velocity and then enters airborne wait. Reuse its existing WALKER_GAIT_ALTERNATE_TAKEOFF_ANIMATION member for this same selector assignment. domain_45_value_0 -> WALKER_GAIT_IDLE: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a3520-0x002a3540 blends idle_animation_id at entry zero, resets gait helpers and stores zero into +0xB7. Reuse its existing WALKER_GAIT_IDLE member for this same selector assignment. domain_46_value_16 -> WALKER_GAIT_WAIT_FOR_LANDING: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a3760-0x002a3784 blends airborne_wait_animation_id and stores 16 after takeoff completion; 0x002a384c-0x002a3894 waits for that sequence and imminent landing. Reuse its existing WALKER_GAIT_WAIT_FOR_LANDING member for this same selector assignment. domain_47_value_18 -> WALKER_GAIT_SYNC_LANDING_ANIMATION: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a3868-0x002a38f0 blends landing anim[12] and stores 18; 0x002a38f4-0x002a3990 synchronizes playback toward its landing marker using time to landing. Reuse its existing WALKER_GAIT_SYNC_LANDING_ANIMATION member for this same selector assignment. domain_48_value_16 -> WALKER_GAIT_WAIT_FOR_LANDING: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a3760-0x002a3784 blends airborne_wait_animation_id and stores 16 after takeoff completion; 0x002a384c-0x002a3894 waits for that sequence and imminent landing. Reuse its existing WALKER_GAIT_WAIT_FOR_LANDING member for this same selector assignment. domain_49_value_17 -> WALKER_GAIT_SYNC_ALTERNATE_LANDING_ANIMATION: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a37b8-0x002a3848 blends landing anim[10] and stores 17; 0x002a3994-0x002a3ab4 synchronizes that alternate landing path to the time-to-landing helper. Reuse its existing WALKER_GAIT_SYNC_ALTERNATE_LANDING_ANIMATION member for this same selector assignment. domain_4_value_15 -> WALKER_GAIT_TAKEOFF_ANIMATION: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1ae0-0x002a1b9c blends anim[11] and stores 15; its handler 0x002a3544-0x002a35c4 computes vertical launch velocity before airborne wait. Reuse its existing WALKER_GAIT_TAKEOFF_ANIMATION member for this same selector assignment. domain_50_value_18 -> WALKER_GAIT_SYNC_LANDING_ANIMATION: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a3868-0x002a38f0 blends landing anim[12] and stores 18; 0x002a38f4-0x002a3990 synchronizes playback toward its landing marker using time to landing. Reuse its existing WALKER_GAIT_SYNC_LANDING_ANIMATION member for this same selector assignment. domain_51_value_13 -> WALKER_GAIT_RUN: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1728-0x002a1770 blends run anim[7] and selects 13; walk-to-run 0x002a1a68-0x002a1aac and landing recovery 0x002a3bb4-0x002a3c14 select the same state. Reuse its existing WALKER_GAIT_RUN member for this same selector assignment. domain_52_value_13 -> WALKER_GAIT_RUN: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1728-0x002a1770 blends run anim[7] and selects 13; walk-to-run 0x002a1a68-0x002a1aac and landing recovery 0x002a3bb4-0x002a3c14 select the same state. Reuse its existing WALKER_GAIT_RUN member for this same selector assignment. domain_5_value_14 -> WALKER_GAIT_ALTERNATE_TAKEOFF_ANIMATION: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1ba0-0x002a1c5c blends anim[9] and stores 14; its handler 0x002a36ac-0x002a3784 computes launch velocity and then enters airborne wait. Reuse its existing WALKER_GAIT_ALTERNATE_TAKEOFF_ANIMATION member for this same selector assignment. domain_6_value_3 -> WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail raised-probe selection chooses anim[2] at 0x002a1d70-0x002a1d74; 0x002a2fe8-0x002a30a0 blends that alternate uphill entry and stores 3. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL member for this same selector assignment. domain_7_value_2 -> WALKER_GAIT_TRANSITION_TO_UPHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1d20-0x002a1d7c selects anim[1] on raised corrected probe height; 0x002a2e64-0x002a2f1c blends it and stores 2 for uphill entry. Reuse its existing WALKER_GAIT_TRANSITION_TO_UPHILL member for this same selector assignment. domain_8_value_8 -> WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1dd0-0x002a1e88 blends anim[5] for the alternate negative-height entry; 0x002a30e4-0x002a30e8 stores 8. Reuse its existing WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL member for this same selector assignment. domain_9_value_7 -> WALKER_GAIT_TRANSITION_TO_DOWNHILL: This listed assignment writes gait_data->gait_state, not flags or a request. Retail 0x002a168c retains gait_data in s3; both switches load its byte +0xB7 at 0x002a16b4 and 0x002a1cec, the exact selector named by the existing function-local enum. Retail 0x002a1d80-0x002a1f44 selects anim[4] for corrected probe height below the negative threshold and stores 7 at 0x002a2f60-0x002a2f64. Reuse its existing WALKER_GAIT_TRANSITION_TO_DOWNHILL member for this same selector assignment. --- .../shared/enemies/walker_update_gait.c | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/src/overlays/shared/enemies/walker_update_gait.c b/src/overlays/shared/enemies/walker_update_gait.c index 13a6b6302b..e7f09cea05 100644 --- a/src/overlays/shared/enemies/walker_update_gait.c +++ b/src/overlays/shared/enemies/walker_update_gait.c @@ -216,7 +216,7 @@ void walker_update_gait(WalkMoby *walker_moby, blend_moby_animation(walker_moby, a->id, f, 10); reset_walker_gait_helpers((char *)gait_data); } - gait_data->gait_state = 0xD; + gait_data->gait_state = WALKER_GAIT_RUN; gait_data->gait_phase_mask = walker_gait_mask( gait_data->anim[7], (float)gait_data->anim[7]->initial_animation_position); gait_data->walk_start_counter = 0; @@ -232,7 +232,7 @@ void walker_update_gait(WalkMoby *walker_moby, blend_moby_animation(walker_moby, a->id, f, 10); reset_walker_gait_helpers((char *)gait_data); } - gait_data->gait_state = 1; + gait_data->gait_state = WALKER_GAIT_WALK; gait_data->gait_phase_mask = walker_gait_mask( gait_data->anim[0], (float)gait_data->anim[0]->initial_animation_position); gait_data->walk_start_counter = 0; @@ -259,7 +259,7 @@ void walker_update_gait(WalkMoby *walker_moby, speed < frame_time * 0.19f) { blend_moby_animation(walker_moby, gait_data->idle_animation_id, 0, 10); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0; + gait_data->gait_state = WALKER_GAIT_IDLE; } else if (walker_moby->b52 == gait_data->anim[gait_animation_index]->id) { float t = (gait_data->anim[7]->f08 + gait_data->anim[0]->f08) * 0.375f; if (speed > t && gait_data->gait_speed_reference > t && @@ -295,7 +295,7 @@ void walker_update_gait(WalkMoby *walker_moby, blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); } - gait_data->gait_state = 0xD; + gait_data->gait_state = WALKER_GAIT_RUN; } else if (flags & 5) { if (gait_data->gait_status_flags & 1) { gait_data->gait_status_flags = (gait_data->gait_status_flags & 0xFFFE) | 2; @@ -314,7 +314,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0xF; + gait_data->gait_state = WALKER_GAIT_TAKEOFF_ANIMATION; } else { int bl = truncate_float_to_s32( gait_data->anim[9]->alternate_transition_position_span * 0.25f / @@ -330,7 +330,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0xE; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TAKEOFF_ANIMATION; } } else { float ground_height; @@ -370,7 +370,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 3; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL; } else { int bl = truncate_float_to_s32( gait_data->anim[1]->alternate_transition_position_span * 0.25f / @@ -387,7 +387,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 2; + gait_data->gait_state = WALKER_GAIT_TRANSITION_TO_UPHILL; } } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * @@ -408,7 +408,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 8; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL; } else { int bl = truncate_float_to_s32( gait_data->anim[4]->alternate_transition_position_span * 0.25f / @@ -425,7 +425,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 7; + gait_data->gait_state = WALKER_GAIT_TRANSITION_TO_DOWNHILL; } } break; @@ -452,12 +452,12 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 8; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) < gait_data->terrain_transition_height_scale * 0.75f) { - gait_data->gait_state = 5; + gait_data->gait_state = WALKER_GAIT_TRANSITION_FROM_UPHILL_TO_WALK; } else { int bl = truncate_float_to_s32(gait_data->anim[3]->transition_position_span * @@ -472,7 +472,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 4; + gait_data->gait_state = WALKER_GAIT_WALK_UPHILL; } break; case WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL: @@ -499,12 +499,12 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 7; + gait_data->gait_state = WALKER_GAIT_TRANSITION_TO_DOWNHILL; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) < gait_data->terrain_transition_height_scale * 0.75f) { - gait_data->gait_state = 6; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK; } else { int bl = truncate_float_to_s32( gait_data->anim[3]->alternate_transition_position_span * 0.25f / @@ -520,7 +520,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 4; + gait_data->gait_state = WALKER_GAIT_WALK_UPHILL; } break; case WALKER_GAIT_WALK_UPHILL: @@ -543,7 +543,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 8; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL; } else { int bl = truncate_float_to_s32( gait_data->anim[4]->alternate_transition_position_span * 0.25f / @@ -560,7 +560,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 7; + gait_data->gait_state = WALKER_GAIT_TRANSITION_TO_DOWNHILL; } } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * @@ -580,7 +580,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 5; + gait_data->gait_state = WALKER_GAIT_TRANSITION_FROM_UPHILL_TO_WALK; } else { int bl = truncate_float_to_s32( gait_data->anim[2]->alternate_transition_position_span * 0.25f / @@ -597,7 +597,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 6; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK; } } break; @@ -625,12 +625,12 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 7; + gait_data->gait_state = WALKER_GAIT_TRANSITION_TO_DOWNHILL; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) > gait_data->terrain_transition_height_scale * 0.75f) { - gait_data->gait_state = 2; + gait_data->gait_state = WALKER_GAIT_TRANSITION_TO_UPHILL; } else { int bl = truncate_float_to_s32( gait_data->anim[0]->alternate_transition_position_span * 0.25f / @@ -646,7 +646,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 1; + gait_data->gait_state = WALKER_GAIT_WALK; } break; case WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK: @@ -672,12 +672,12 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 8; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) > gait_data->terrain_transition_height_scale * 0.75f) { - gait_data->gait_state = 3; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL; } else { int bl = truncate_float_to_s32(gait_data->anim[0]->transition_position_span * @@ -692,7 +692,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 1; + gait_data->gait_state = WALKER_GAIT_WALK; } break; case WALKER_GAIT_TRANSITION_TO_DOWNHILL: @@ -713,12 +713,12 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 3; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) > -gait_data->terrain_transition_height_scale * 0.75f) { - gait_data->gait_state = 10; + gait_data->gait_state = WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK; } else { int bl = truncate_float_to_s32(gait_data->anim[6]->transition_position_span * @@ -733,7 +733,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 9; + gait_data->gait_state = WALKER_GAIT_WALK_DOWNHILL; } break; case WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL: @@ -755,12 +755,12 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 2; + gait_data->gait_state = WALKER_GAIT_TRANSITION_TO_UPHILL; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) > -gait_data->terrain_transition_height_scale * 0.75f) { - gait_data->gait_state = 11; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK; } else { int bl = truncate_float_to_s32( gait_data->anim[6]->alternate_transition_position_span * 0.25f / @@ -776,7 +776,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 9; + gait_data->gait_state = WALKER_GAIT_WALK_DOWNHILL; } break; case WALKER_GAIT_WALK_DOWNHILL: @@ -798,7 +798,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 3; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL; } else { int bl = truncate_float_to_s32( gait_data->anim[1]->alternate_transition_position_span * 0.25f / @@ -815,7 +815,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 2; + gait_data->gait_state = WALKER_GAIT_TRANSITION_TO_UPHILL; } } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * @@ -835,7 +835,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 10; + gait_data->gait_state = WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK; } else { int bl = truncate_float_to_s32( gait_data->anim[5]->alternate_transition_position_span * 0.25f / @@ -852,7 +852,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 11; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK; } } break; @@ -875,12 +875,12 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 2; + gait_data->gait_state = WALKER_GAIT_TRANSITION_TO_UPHILL; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) < -gait_data->terrain_transition_height_scale * 0.75f) { - gait_data->gait_state = 7; + gait_data->gait_state = WALKER_GAIT_TRANSITION_TO_DOWNHILL; } else { int bl = truncate_float_to_s32( gait_data->anim[0]->alternate_transition_position_span / @@ -896,7 +896,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 1; + gait_data->gait_state = WALKER_GAIT_WALK; } break; case WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK: @@ -917,12 +917,12 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 3; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) < -gait_data->terrain_transition_height_scale * 0.75f) { - gait_data->gait_state = 8; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL; } else { int bl = truncate_float_to_s32(gait_data->anim[0]->transition_position_span / @@ -937,7 +937,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 1; + gait_data->gait_state = WALKER_GAIT_WALK; } break; } @@ -972,7 +972,7 @@ void walker_update_gait(WalkMoby *walker_moby, blend_moby_animation(walker_moby, a->id, f, 10); reset_walker_gait_helpers((char *)gait_data); } - gait_data->gait_state = 1; + gait_data->gait_state = WALKER_GAIT_WALK; } else if (flags & 5) { if (gait_data->gait_status_flags & 1) { gait_data->gait_status_flags = (gait_data->gait_status_flags & 0xFFFE) | 2; @@ -991,7 +991,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0xF; + gait_data->gait_state = WALKER_GAIT_TAKEOFF_ANIMATION; } else { int bl = truncate_float_to_s32( gait_data->anim[9]->alternate_transition_position_span * 0.25f / @@ -1007,7 +1007,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0xE; + gait_data->gait_state = WALKER_GAIT_ALTERNATE_TAKEOFF_ANIMATION; } } else { ground_probe_position[0] = @@ -1038,7 +1038,7 @@ void walker_update_gait(WalkMoby *walker_moby, case WALKER_GAIT_RESET_TO_IDLE: blend_moby_animation(walker_moby, gait_data->idle_animation_id, 0, 10); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0; + gait_data->gait_state = WALKER_GAIT_IDLE; break; case WALKER_GAIT_TAKEOFF_ANIMATION: if (flags & 0x30) { @@ -1059,7 +1059,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->animation_playback_rate) { blend_moby_animation(walker_moby, gait_data->airborne_wait_animation_id, 0, 10); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0x10; + gait_data->gait_state = WALKER_GAIT_WAIT_FOR_LANDING; } else if ((gait_data->gait_status_flags & 4) && gait_data->jump_vertical_velocity < 0.0f) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); float len = (gait_data->anim[12]->alternate_phase_anchor_position - @@ -1076,7 +1076,7 @@ void walker_update_gait(WalkMoby *walker_moby, f = find_nearest_animation_sequence_entry(walker_moby->pClass->seqs[a->id], 0.0f); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0x12; + gait_data->gait_state = WALKER_GAIT_SYNC_LANDING_ANIMATION; } } break; @@ -1099,7 +1099,7 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->animation_playback_rate) { blend_moby_animation(walker_moby, gait_data->airborne_wait_animation_id, 0, 10); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0x10; + gait_data->gait_state = WALKER_GAIT_WAIT_FOR_LANDING; } else if ((gait_data->gait_status_flags & 4) && gait_data->jump_vertical_velocity < 0.0f) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); float len = (gait_data->anim[10]->alternate_phase_anchor_position - @@ -1116,7 +1116,7 @@ void walker_update_gait(WalkMoby *walker_moby, f = find_nearest_animation_sequence_entry(walker_moby->pClass->seqs[a->id], 0.0f); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0x11; + gait_data->gait_state = WALKER_GAIT_SYNC_ALTERNATE_LANDING_ANIMATION; } } break; @@ -1133,7 +1133,7 @@ void walker_update_gait(WalkMoby *walker_moby, find_nearest_animation_sequence_entry(walker_moby->pClass->seqs[a->id], 0.0f); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = 0x12; + gait_data->gait_state = WALKER_GAIT_SYNC_LANDING_ANIMATION; } } break; @@ -1214,7 +1214,7 @@ void walker_update_gait(WalkMoby *walker_moby, blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); gait_data->jump_vertical_velocity = 0.0f; - gait_data->gait_state = 0xD; + gait_data->gait_state = WALKER_GAIT_RUN; gait_data->gait_phase_mask = 1; gait_data->gait_status_flags &= 0xFFFD; ground_probe_position[0] = fast_cos(movement_heading) * gait_data->anim[7]->f04 * 0.5f; @@ -1244,7 +1244,7 @@ void walker_update_gait(WalkMoby *walker_moby, blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); gait_data->jump_vertical_velocity = 0.0f; - gait_data->gait_state = 0xD; + gait_data->gait_state = WALKER_GAIT_RUN; gait_data->gait_phase_mask = 1; gait_data->gait_status_flags &= 0xFFFD; ground_probe_position[0] = fast_cos(movement_heading) * gait_data->anim[7]->f04 * 0.5f; From 630b2868482b0f30c207e806c34f4eeb6a569c26 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 03:11:23 +0000 Subject: [PATCH 076/657] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS: The second int argument animation_update_mode is retail param_2, saved from a1 into s4 at 0x00227e28. Instructions 0x00227e1c-0x00227e40 reject entry in dying control_mode 0x14 unless requested_state is 0x64 and s4 equals 2. Original Ghidra shows the same param_2 != 2 guard. The same s4 gates animation entry at 0x00228060 and reaches set_hero_animation at 0x0022c20c. This proves the supplied HeroAnimationEntryMode domain and canonical HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS=2, independently of hero state or vehicle IDs. domain_1_value_2 -> HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS: Retail 0x00227e44-0x00227e64 tests special-state global 0x15F5C4 against 2/6 and rejects unless s4 equals 2. s4 is the second animation_update_mode argument saved at 0x00227e28, also used by the preceding dying entry guard and conditional animation calls. Original Ghidra explicitly expresses the global-state condition with param_2 != 2. Thus this literal is the same HeroAnimationEntryMode override member HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS, rather than either global's numeric state values. --- src/overlays/l18/hero/hero_set_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l18/hero/hero_set_state.c b/src/overlays/l18/hero/hero_set_state.c index dccfe625db..ea0c9e79a6 100644 --- a/src/overlays/l18/hero/hero_set_state.c +++ b/src/overlays/l18/hero/hero_set_state.c @@ -82,10 +82,10 @@ int hero_set_state(int requested_state, int animation_update_mode) { struct Hero *p = &hero; if (p->state.control_mode == HERO_MODE_DYING && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - animation_update_mode != 2)) + animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } - if ((D_L18_0015F5C4 == 2 || D_L18_0015F5C4 == 6) && animation_update_mode != 2) + if ((D_L18_0015F5C4 == 2 || D_L18_0015F5C4 == 6) && animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; From bedf4d74bea0544e5a5a93135c9d3b80e06d65f0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 03:24:34 +0000 Subject: [PATCH 077/657] decomp: clarify names in hero_update_items domain_0_value_254 -> MOBY_STATE_MARKED_FOR_REMOVAL: Assigned retail 0x00210798 loads the slot moby into s2; 0x002108a4 loads its state byte at +0x20, and 0x002108a8 skips its +0x74 update callback when state is FE. Checked level-00 mark_moby_for_removal export (request f6e5f7890fb14e02ab0330f02bca5e12) at 0x0024eb8c loads FE and 0x0024eb90 stores it to that same moby +0x20; 0x0024eb98..0x0024ebb0 stores game_frame+2 at +0x38. Supplied clear_hero_item_slot source calls this helper before clearing the slot moby pointer. Thus FE is a moby state marking removal, separate from HeroItemSlot state 3. --- src/overlays/shared/hero/hero_switch_item.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index 2d6a6badfa..da9e17ac33 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -2259,6 +2259,9 @@ extern s32 D_L00_0015F3F8; void hero_update_items(void) __asm__("FUN_L00_00210748"); void hero_update_items(void) { + enum { + MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE + }; int i; int k; struct Moby *moby; @@ -2289,7 +2292,7 @@ void hero_update_items(void) { } break; } - if (moby != 0 && moby->state != 0xFE && moby->state != 0xFD) { + if (moby != 0 && moby->state != MOBY_STATE_MARKED_FOR_REMOVAL && moby->state != 0xFD) { if (i != 6 && moby->update != 0) { moby->update(moby); } From 486623c4e9b9927e3c589c858057c2f558281a7d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 03:33:38 +0000 Subject: [PATCH 078/657] decomp: clarify names in update_hero_ground_contact_and_surface_slopes domain_0_value_0 -> GROUND_MATERIAL_WATER_HEIGHT_QUERY_REPROBE: The selector is hero.ground_type, populated by collision_hit_material at retail 0x002128f0 and stored as a short at hero+0x12E0 at 0x00212900. The zero branch 0x002128fc calls surface-height resolver 0x00259e58 at 0x0021290c with collision hit point and water_surface_normal, stores the returned height to hero.water_surface_z at 0x00212924, compares hero position z against it and starts in_water_frames at 0x00212930, then repeats collision_line with mask 0x24 at 0x00212948-0x00212950. Original assigned Ghidra and current C agree. Bounded evidence request 21b51ad708344cf1a7795e339d47125b confirms resolver uses input xyz, a queried height at 0x00259e90-0x00259e9c, region height fallback at 0x00259eb0-0x00259f1c, or input z fallback at 0x00259f38. The name describes the water-height query and reprobe rather than guessing a substance. --- src/overlays/shared/hero/hero_switch_item.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index da9e17ac33..4be26faf84 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -3342,6 +3342,9 @@ void update_hero_ground_contact_and_surface_slopes(void) { GROUND_MATERIAL_SINK_SURFACE_SKIP_GROUND_CONTACT = 0xB, GROUND_MATERIAL_WATER_SURFACE = 0xD }; + enum { + GROUND_MATERIAL_WATER_HEIGHT_QUERY_REPROBE = 0 + }; V collision_ray_end, ground_ray_start, ground_offset_or_angles, side_ray_start, unused_side_probe_point, side_hit_angles, side_hit_normal; f32 f; @@ -3388,7 +3391,7 @@ void update_hero_ground_contact_and_surface_slopes(void) { } hero.ground_sound_class = collision_sound_class; hero.ground_type = collision_hit_material(); - if (hero.ground_type == 0) { + if (hero.ground_type == GROUND_MATERIAL_WATER_HEIGHT_QUERY_REPROBE) { hero.water_surface_z = resolve_camera_surface_height(((u8 *)&D_L00_00173E60_lui), &hero.water_surface_normal); if (hero.motion.pos.f[2] < hero.water_surface_z && hero.in_water_frames <= 0) { From 58fb6350af6d3ff339b5ba76c5456a0cf968197b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:24:57 +0000 Subject: [PATCH 079/657] decomp: clarify names in initialize_eight_slot_hud_selector x48 -> selector_x_offset: Retail 0x00237b20 clears the s16 at HUD +0x48. In the supplied file's matching HUD layout, hud_draw_gauge_frame adds +0x48 (unk48) to screen_position[0] for both rectangle and sprite X coordinates; +0x4a is separately added to Y. This proves the horizontal drawing-offset role rather than an offset-only name. x4a -> selector_y_offset: Retail 0x00237b24 clears the s16 at HUD +0x4a. The supplied hud_draw_gauge_frame uses the same HUD layout and adds unk4A at +0x4a to screen_position[1] when computing rectangle top and sprite Y, paired with +0x48 on X. This identifies the vertical drawing offset. x58 -> selector_width: Retail 0x00237b10 loads D_L00_0015F718 and 0x00237b28 stores it to +0x58. The supplied draw_hud_item_selector_panel divides this same global by two for sprite half_w and adds the full global to X for the opposite panel corners. The analogous four-slot initializer calls this value element_width, and HUD layouts place w at +0x58. x5c -> selector_height: Retail 0x00237b1c loads D_L00_0015F71C and the delay-slot store at 0x00237b34 writes it to +0x5c. Supplied selector drawing divides this global by two for half_h and adds its full value to Y for lower panel corners. initialize_four_slot_hud_selector names this source element_height, and matching HUD layouts place h at +0x5c. x70 -> selector_fade_counters: Retail 0x00237b40 zeroes the s32 at +0x70. Supplied update_hud_item_selector_selection_and_visibility treats +0x70 and +0x71 as byte counters: the first rises while held and falls on release, while the second resets when selection changes. draw_hud_item_selector_panel divides these bytes by the fade limit to obtain open and fade, proving this word packs the selector fade counters. x74 -> selector_selected_slot_index: Retail 0x00237b0c supplies sentinel -2 and 0x00237b2c writes it to +0x74. Supplied selector update reads the same +0x74 as previous_selected_slot_index and assigns stick_slot_index or pad_slot_index there; the draw callback compares unk74 with slot i and uses it to index the selected 0x1c-byte record. This establishes the selected slot index including negative sentinels. x78 -> selector_input_state: Retail 0x00237b14 passes 30 to the helper and 0x00237b38 stores its return at +0x78. In supplied selector update, w78's high byte gates input state 0 versus 1; while state 0 its word is decremented until -1 or changed after neutral/D-pad input, then replaced by 0x10000FF to enable selection. The word is later saved on close. It is packed selector input state with an initial countdown, not solely a duration. --- .../ui/hud/draw_hud_item_selector_panel.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c b/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c index f074cdd5a4..fb816f9ef2 100644 --- a/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c +++ b/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c @@ -134,15 +134,15 @@ int hud_draw_gauge_frame(HudElem_237840 *gauge_element) { typedef struct { u8 pad[0x48]; - s16 x48; - s16 x4a; + s16 selector_x_offset; + s16 selector_y_offset; u8 p4c[0xC]; - s32 x58; - s32 x5c; + s32 selector_width; + s32 selector_height; u8 p60[0x10]; - s32 x70; - s32 x74; - s32 x78; + s32 selector_fade_counters; + s32 selector_selected_slot_index; + s32 selector_input_state; } O00237ae8; /* One slot of a HUD selector ring: its icon, the slot each pad direction moves to, and what @@ -180,13 +180,13 @@ void initialize_eight_slot_hud_selector(O00237ae8 *hud_element) { ItemDef *tab; D_L00_0015FA90 = 8; D_L00_0015FAC0 = &eight_slot_hud_selector_table_pointer_gp; - hud_element->x48 = 0; - hud_element->x4a = 0; - hud_element->x58 = D_L00_0015F718_gp; - hud_element->x5c = D_L00_0015F71C_gp; - hud_element->x74 = -2; - hud_element->x78 = scale_game_frames(0x1E); - hud_element->x70 = 0; + hud_element->selector_x_offset = 0; + hud_element->selector_y_offset = 0; + hud_element->selector_width = D_L00_0015F718_gp; + hud_element->selector_height = D_L00_0015F71C_gp; + hud_element->selector_selected_slot_index = -2; + hud_element->selector_input_state = scale_game_frames(0x1E); + hud_element->selector_fade_counters = 0; D_L00_0015F72C = 0; slot_entry = eight_slot_hud_selector_slots; tab = item_defs; From 80ba6e64bd98adca4d389bc0c9902f0cd74cb4f7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:25:00 +0000 Subject: [PATCH 080/657] decomp: clarify names in update_timed_line_collision_particle xa -> lifetime_countdown: In the SHA-256-bound particles.c snapshot, O00271d20::xa is s16 and is passed to fast_dec_timer_s16; a true return frees particle. Retail 0x00271d84-0x00271d98 passes particle+0xA to the timer helper and branches to free_effect_particle on expiry. The original Ghidra decompilation shows the same test and free branch. On nonzero line-collision result, 0x00271dc8 stores zero to that same halfword, matching particle->xa = 0. Thus this field is the particle lifetime countdown, rather than a coordinate or opaque state. --- src/overlays/shared/rendering/effects/particles.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index 34a480131b..15a046f67d 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -322,7 +322,7 @@ typedef union { typedef struct { u8 pad[0xA]; - s16 xa; + s16 lifetime_countdown; u8 pc[4]; V00271d20 pos; V00271d20 vel; @@ -344,11 +344,11 @@ void update_timed_line_collision_particle(O00271d20 *particle) { motion_delta_xyz.f[3] = 0.0f; fast_vec_add(pos, pos, &motion_delta_xyz); fast_vec_add(vel, vel, &motion_delta_xyz); - if (fast_dec_timer_s16(&particle->xa)) { + if (fast_dec_timer_s16(&particle->lifetime_countdown)) { free_effect_particle(particle); } else if (coll_line_fix(vel, pos, 0x10, acc->i[3], 0)) { particle->pos.q = D_L00_00173E60.q; - particle->xa = 0; + particle->lifetime_countdown = 0; } } From 3837b365f938542b8c37d9ab7131a92101edd548 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:27:02 +0000 Subject: [PATCH 081/657] decomp: clarify names in check_hero_item_reward_conditions x280 -> qualifying_items_help_request_gate: In the authoritative C, help_records.x280 != 0 returns before the qualifying_item_count scan and help_request(0x4E26,0x50). Retail 0x00206d5c-0x00206d64 loads u16 at 0x00141968+0x280 and branches to return if nonzero; 0x00206dd8-0x00206dec requests help only with at least nine qualifying available items. Helper 0x0020395c-0x00203970 indexes the same table by request argument 0x50 times 8 (=0x280) and checks its first u16, proving this is the qualifying-items help record's request gate rather than an offset-only identity. x3c0 -> special_state_item_help_request_gate: C requires help_records.x3c0 == 0 together with item_available[4] != 0 and hero_is_in_special_state() != 0 before help_request(0x4E2E,0x78). Retail 0x00206d10-0x00206d40 loads u16 at 0x00141968+0x3c0 and skips that request when nonzero, then tests item availability and the hero predicate. Helper 0x0020395c-0x00203970 indexes help records using the second argument times 8; 0x78*8 equals 0x3c0, tying this field to the special-state/item help request gate without assuming a completion or display-count meaning. --- src/overlays/shared/hero/hero_idle_sequence.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 248a1465c0..474d271a3e 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -1081,9 +1081,9 @@ void release_and_clear_hero_voice_slots(void) { typedef struct { u8 p[0x280]; - u16 x280; + u16 qualifying_items_help_request_gate; u8 p282[0x13E]; - u16 x3c0; + u16 special_state_item_help_request_gate; } G00206cf8; extern G00206cf8 help_records __asm__("D_00141968"); @@ -1094,14 +1094,14 @@ void check_hero_item_reward_conditions(void) __asm__("FUN_L00_0 void check_hero_item_reward_conditions(void) { s32 i, qualifying_item_count; - if (help_records.x3c0 == 0 && item_available[4] != 0 && hero_is_in_special_state() != 0) { + if (help_records.special_state_item_help_request_gate == 0 && item_available[4] != 0 && hero_is_in_special_state() != 0) { help_request(0x4E2E, 0x78); } if (D_L00_0015F5CC_00206cf8 <= 0) return; if (D_L00_0015F5CC_00206cf8 & 0x7F) return; - if (help_records.x280 != 0) + if (help_records.qualifying_items_help_request_gate != 0) return; if (D_001418F0 != 0) return; From b030f7114f09fb000f7c2dfe2e0d5cc659379a78 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:27:06 +0000 Subject: [PATCH 082/657] decomp: clarify names in create_moby_transform_history_entry x100 -> initial_decay_values: Retail 0x002625c4-0x002625d0 indexes the s32 array at history_state+0x100 by the entry count and stores s2, the initial_decay_value argument also written to the spawned moby's decay byte at 0x002625b0. Thus these are per-entry initial decay values, not live sample indices. x110 -> sample_delays: Retail 0x00262550/0x00262554 retains sample_delay and bounds it below nine; 0x002625b4-0x002625c0 stores it in the s32 array at +0x110 indexed by entry count. Supplied update_moby_transform_history reads the corresponding w[i], waits for enough samples, and selects (head-sample_delay+8)%8. x120 -> history_mobys: Retail 0x002625d4-0x002625e0 stores the successful create_moby return a3 into the pointer array at +0x120 indexed by entry count. Supplied update_moby_transform_history applies delayed transforms to these pointers; clear_moby_transform_history iterates this same +0x120 array and marks each moby for removal. x134 -> history_source_moby: Retail 0x00262560-0x00262568 loads this pointer and passes its +0xa6 class to create_moby; 0x00262578-0x00262598 copies its +0x32 and +0x38 properties to the spawned moby. Supplied initialize_moby_transform_history stores its source_moby argument at +0x134, and the updater samples this source's position and rotation. x138 -> history_entry_count: Retail 0x00262548-0x0026254c rejects a count equal to four, uses this same s32 at +0x138 to index all three four-element arrays at 0x002625b4-0x002625e0, then increments it at 0x002625e4-0x002625ec. Supplied initialization clears it and cleanup uses it as the tracked moby loop bound. x23 -> history_decay_value: Retail 0x00262538 preserves initial_decay_value in s2 and 0x002625b0 writes its low byte to spawned_moby+0x23. The supplied original annotations and update_moby_transform_history identify this same decay byte as the quantity reduced by min(dec,current) until zero, when all tracked mobys are cleaned up. xa6 -> spawn_class_id: Retail 0x00262560-0x00262568 reads the source moby's signed halfword at +0xa6 directly into a0 for create_moby, creating a same-class history moby. Retail 0x00262580/0x002625a4 also tests that class field on the spawned moby before the class-zero-specific +0x72 initialization; it is the spawn class selector. --- .../mobys/test_path_segment_strict_crossing.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c index 8d6d826f2b..0479cf2fd0 100644 --- a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c +++ b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c @@ -426,7 +426,7 @@ void initialize_moby_transform_history(int source_moby, char *history_state) { typedef struct { u8 p0[0x23]; - u8 x23; + u8 history_decay_value; u8 p24[0xC]; u8 x30; u8 x31; @@ -439,17 +439,17 @@ typedef struct { u8 p73[0x21]; s32 x94; u8 p98[0xE]; - s16 xa6; + s16 spawn_class_id; } E00262528; typedef struct { u8 p0[0x100]; - s32 x100[4]; - s32 x110[4]; - E00262528 *x120[4]; + s32 initial_decay_values[4]; + s32 sample_delays[4]; + E00262528 *history_mobys[4]; u8 p130[4]; - E00262528 *x134; - s32 x138; + E00262528 *history_source_moby; + s32 history_entry_count; } O00262528; void create_moby_transform_history_entry(O00262528 *history_state, @@ -461,26 +461,26 @@ void create_moby_transform_history_entry(O00262528 *history_state, s32 sample_delay) { E00262528 *spawned_moby; - if (history_state->x138 == 4) + if (history_state->history_entry_count == 4) return; if (sample_delay >= 9) return; - spawned_moby = create_moby(history_state->x134->xa6); + spawned_moby = create_moby(history_state->history_source_moby->spawn_class_id); if (spawned_moby == 0) return; - spawned_moby->x32 = history_state->x134->x32; - spawned_moby->x38 = history_state->x134->x38; + spawned_moby->x32 = history_state->history_source_moby->x32; + spawned_moby->x38 = history_state->history_source_moby->x38; spawned_moby->x31 = 1; spawned_moby->x34 = 0x80A; spawned_moby->x30 = 0; spawned_moby->x94 = 0; - if (spawned_moby->xa6 == 0) + if (spawned_moby->spawn_class_id == 0) spawned_moby->x72 = 0; - spawned_moby->x23 = initial_decay_value; - history_state->x110[history_state->x138] = sample_delay; - history_state->x100[history_state->x138] = initial_decay_value; - history_state->x120[history_state->x138] = spawned_moby; - history_state->x138++; + spawned_moby->history_decay_value = initial_decay_value; + history_state->sample_delays[history_state->history_entry_count] = sample_delay; + history_state->initial_decay_values[history_state->history_entry_count] = initial_decay_value; + history_state->history_mobys[history_state->history_entry_count] = spawned_moby; + history_state->history_entry_count++; } typedef struct { From c3e083a5193270be3721c63982d9b6adbc6f5b5e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:27:09 +0000 Subject: [PATCH 083/657] decomp: clarify names in initialize_selection_entries_and_index x224 -> current_selection_value: S_27f448.x224 is loaded from 0x001841f0+0x224 at retail 0x0027f508 and 0x0027f538. Comparisons at 0x0027f50c/0x0027f53c match it against entries of the zero-terminated selection_values list, and a match determines selection_state+0x40. The C uses the same field as the current value whose list position initializes selection. x30 -> selection_flags: Incoming selection_state is saved in t2 at 0x0027f44c. Retail 0x0027f4e4 loads its +0x30 word, 0x0027f4e8 ORs in 0x8000, and 0x0027f4ec stores the word back, preserving other bits. The C selection_state->x30 |= 0x8000 proves a flags word belonging to selection state, without establishing this bit's particular meaning. x40 -> selected_index: Retail 0x0027f4e0 defaults selection_state+0x40 to zero. The selection_values scan increments t0 and uses t0*4 to read list entries at 0x0027f524-0x0027f52c; after matching the current selection value, 0x0027f544 stores t0 at +0x40. The C likewise assigns i only on a matching list entry, proving the selected list index with zero fallback. --- .../ui/menus/find_or_assign_bolt_source_slot.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/ui/menus/find_or_assign_bolt_source_slot.c b/src/overlays/shared/ui/menus/find_or_assign_bolt_source_slot.c index 4b6f1fabd5..8c40e17173 100644 --- a/src/overlays/shared/ui/menus/find_or_assign_bolt_source_slot.c +++ b/src/overlays/shared/ui/menus/find_or_assign_bolt_source_slot.c @@ -24,16 +24,16 @@ typedef struct { typedef struct { char pad[0x224]; - int x224; + int current_selection_value; } S_27f448; extern S_27f448 D_L00_001841F0_lui __asm__("D_L00_001841F0") NOT_SDA; typedef struct { char pad0[0x30]; - int x30; + int selection_flags; char pad34[0xC]; - int x40; + int selected_index; } P_27f448; extern E_27f448 D_L00_001BA3B8[] NOT_SDA; @@ -52,11 +52,11 @@ int initialize_selection_entries_and_index(P_27f448 *selection_state) { D_L00_001BA3B8[i].d = D_L00_001C1E40[D_0013D510_lui[i]].b; } D_L00_001BA3B8[i].a = 0; - selection_state->x40 = 0; - selection_state->x30 |= 0x8000; + selection_state->selected_index = 0; + selection_state->selection_flags |= 0x8000; for (i = 0; selection_values[i]; i++) { - if (D_L00_001841F0_lui.x224 == selection_values[i]) { - selection_state->x40 = i; + if (D_L00_001841F0_lui.current_selection_value == selection_values[i]) { + selection_state->selected_index = i; break; } } From a48ac6941625d75805c8b704d9264de46d0fb4ee Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:29:30 +0000 Subject: [PATCH 084/657] decomp: clarify names in initialize_orbit_camera_from_hero x50 -> orbit_parameters: Retail 0x002ebb64-0x002ebb8c clears five words at camera_state+0x14, sets the third float at +0x1C to 4.64f, then calls copy_five_floats_with_rotation_offset with destination camera_object+0x50, the checked location of O002ebb00.x50. The original Ghidra decompilation confirms these arguments. Supplied initialize_orbit_camera_pose passes object+0x50 to compute_position_from_spherical_offset and combines its +0x54/+0x5C and +0x50/+0x60 values to build view angles. Supplied update_orbit_camera_pose independently interpolates these five slots, using angular spring helpers for four and scalar interpolation for distance at +0x58. These operations prove that the field stores the camera's orbit parameters, rather than merely identifying an offset. --- src/overlays/shared/camera/orbit_camera.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/camera/orbit_camera.c b/src/overlays/shared/camera/orbit_camera.c index 02adf8d71c..a1b41f1f3d 100644 --- a/src/overlays/shared/camera/orbit_camera.c +++ b/src/overlays/shared/camera/orbit_camera.c @@ -43,7 +43,7 @@ typedef struct { typedef struct { u8 pad[0x50]; - u8 x50[0x20]; + u8 orbit_parameters[0x20]; u8 *m; } O002ebb00; @@ -360,6 +360,6 @@ void initialize_orbit_camera_from_hero(O002ebb00 *camera_object) { qcopy(camera_state + 0x80, raised_hero_position); zero_five_words(camera_state + 0x14); *(f32 *)(camera_state + 0x1C) = 4.64f; - copy_five_floats_with_rotation_offset(camera_object->x50, camera_state + 0x14, 0.0f); + copy_five_floats_with_rotation_offset(camera_object->orbit_parameters, camera_state + 0x14, 0.0f); initialize_orbit_camera_state(camera_object); } From 65faf5501849f58edbcc93d1003454e12fd093a8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:29:34 +0000 Subject: [PATCH 085/657] decomp: clarify names in follow_camera_transition x90 -> smoothed_target_position_storage: Retail 0x002e5804 forms a1=s0+0x90, where s0 is camera state+0x40 (0x002e5750-0x002e5754), and 0x002e5808 calls interpolate_follow_camera_position with the computed stack target as a2. The supplied helper treats a1 as current_values, updating xyz in place toward target_values with cam_interp_values. Thus this u8[0x34] storage begins with the smoothed target position; no meaning is assigned to its trailing bytes. xc4 -> current_attach_mode: Retail 0x002e578c loads attach block byte +0xC4 as a3 for compute_follow_camera_target_position at 0x002e5794; 0x002e579c reloads it for comparisons to attach modes 3,5,6,7,1. The authoritative helper switches on named CAM_ATTACH cases, while update_follow_camera_attach_mode sets the same block byte through CamAttach.state. This is the current attach-mode selector. xc5 -> previous_attach_mode: At retail 0x002e5768-0x002e576c the current attach-mode byte +0xC4 is copied into +0xC5 after the timer helper reports completion. The authoritative update_follow_camera_attach_mode uses the identical attach-block layout: CamAttach.prev receives CamAttach.state before assigning a new mode. This identifies +0xC5 as the previous attach mode. xc6 -> transition_timer_remaining: Retail 0x002e5758-0x002e575c decrements the signed timer at camera state+0x106, identical to attach block+0xC6; 0x002e5770 reads that short and 0x002e5798 multiplies it by +0xC8 for the spring blend weight. The authoritative mode updater arms CamAttach.timer at this same layout position from transition durations and sets invTimer from it, proving a remaining transition timer. xc8 -> inverse_transition_duration: Retail 0x002e5778 loads attach block+0xC8 and 0x002e5798 multiplies it by the float-converted remaining timer from +0xC6. The result weights stiffness and damping endpoints at 0x002e57dc-0x002e57f4. In the authoritative updater, the matching CamAttach.invTimer is assigned 1.0f/convert_integer_to_float(attach_state->timer) when a transition is armed, proving reciprocal transition duration. --- .../shared/camera/follow_camera_springs.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_springs.c b/src/overlays/shared/camera/follow_camera_springs.c index 6b0cf64ece..093ad24e77 100644 --- a/src/overlays/shared/camera/follow_camera_springs.c +++ b/src/overlays/shared/camera/follow_camera_springs.c @@ -54,11 +54,11 @@ typedef struct { typedef struct { u8 p0[0x90]; - u8 x90[0x34]; - u8 xc4; - u8 xc5; - s16 xc6; - f32 xc8; + u8 smoothed_target_position_storage[0x34]; + u8 current_attach_mode; + u8 previous_attach_mode; + s16 transition_timer_remaining; + f32 inverse_transition_duration; } A002e5730; typedef struct { @@ -1324,11 +1324,11 @@ void follow_camera_transition(O002e5730 *camera, void *input_offset) { f32 k, x, y; u8 attach_mode; if (fast_dec_timer_s16(m + 0x106)) - attach_state->xc5 = attach_state->xc4; - k = (f32)attach_state->xc6 * attach_state->xc8; + attach_state->previous_attach_mode = attach_state->current_attach_mode; + k = (f32)attach_state->transition_timer_remaining * attach_state->inverse_transition_duration; compute_follow_camera_target_position( - camera, input_offset, &target_position, attach_state->xc4); - attach_mode = attach_state->xc4; + camera, input_offset, &target_position, attach_state->current_attach_mode); + attach_mode = attach_state->current_attach_mode; if (attach_mode == CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY || attach_mode == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION || attach_mode == CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY || @@ -1346,7 +1346,7 @@ void follow_camera_transition(O002e5730 *camera, void *input_offset) { x = follow_camera_position_default_stiffness_gp; y = follow_camera_position_default_damping_gp; } - interpolate_follow_camera_position(camera, attach_state->x90, &target_position, x, y, 0.0f); + interpolate_follow_camera_position(camera, attach_state->smoothed_target_position_storage, &target_position, x, y, 0.0f); } /* Updates the follow camera: eases its focus and offset vectors, then places From 2ce685a8e5a73482cfa1389d57e02b3db851af32 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:29:38 +0000 Subject: [PATCH 086/657] decomp: clarify names in transition_load_wad x20 -> mip_texture_definition: Authoritative src/game/transitions/transition_load_wad.c SHA-256 d470e46568ce21da7e4efb4f5843fbaacfd6f1917d094ec0d110f88e509566f8 declares WadClass30.x20 as u8[0x10] and passes it as the fourth argument of register_shrub_render_class. Retail 0x001eac48-0x001eac90 walks the WAD header +0x2c table in 0x30-byte steps; 0x001eac6c computes a3 = s0 + 0x20 before the call at 0x001eac7c. Original retail Ghidra identifies this exact argument as (ShrubMipTextureDefinition *)(piVar6 + 8), alongside a ShrubRenderClassDescriptor, texture definitions, and material map. This establishes a shrub mip texture definition embedded in each class entry, beyond its numeric offset. --- src/game/transitions/transition_load_wad.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/game/transitions/transition_load_wad.c b/src/game/transitions/transition_load_wad.c index 56b6eb70d5..fbed55a42c 100644 --- a/src/game/transitions/transition_load_wad.c +++ b/src/game/transitions/transition_load_wad.c @@ -76,7 +76,7 @@ typedef struct { s32 x4; s32 pad8[2]; u8 x10[0x10]; - u8 x20[0x10]; + u8 mip_texture_definition[0x10]; } WadClass30; typedef struct { @@ -276,7 +276,7 @@ void transition_load_wad(void) { register_shrub_render_class(data + shrub_class_entry->offset, ((u8 *)hdr) + hdr->x4C, shrub_class_entry->x10, - shrub_class_entry->x20, + shrub_class_entry->mip_texture_definition, shrub_class_entry->x4); shrub_class_entry++; } From b31054b7c0e19bcbbf225e9f0e89db984cc39cbd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:29:41 +0000 Subject: [PATCH 087/657] decomp: clarify names in fan_update x1c -> collision_priority: In assigned fan_update, 0x002f9c74 zeros query +0x1c before 0x002f9c94 passes the query to the sphere collector. Checked level-01 helper 0x00214468 preserves a3 in s5 at 0x002144c4. It copies query +0x10..+0x1f via a2 at 0x00214ca0/0x00214cdc into a per-collided-moby record +0x20..+0x2f, placing x1c at record +0x2c. For an existing record belonging to the same collided moby (0x00214d48-0x00214d50), 0x00214d54 loads its priority +0x2c, 0x00214d58 loads incoming query +0x1c, and 0x00214d5c-0x00214d60 skips replacement if existing minus incoming is positive; otherwise 0x00214d68 branches to record replacement at 0x00214cd0. This is a collision-record priority, with greater existing values retained. --- src/overlays/l01/mobys/fan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/fan.c b/src/overlays/l01/mobys/fan.c index 7f8a815f9e..f6140b1d5e 100644 --- a/src/overlays/l01/mobys/fan.c +++ b/src/overlays/l01/mobys/fan.c @@ -27,7 +27,7 @@ typedef struct { void *moby; s32 flags; s32 x18; - s32 x1c; + s32 collision_priority; s32 x20; } CollQuery; @@ -55,7 +55,7 @@ void fan_update(SwayMoby *fan_moby) { } collision_query.moby = fan_moby; collision_query.flags = 0x10001; - collision_query.x1c = 0; + collision_query.collision_priority = 0; clear_u64_value(&collision_query); collision_query.x20 = 0; collect_mobies_in_sphere(fan_moby->pos, 0x10, fan_moby, &collision_query, 1.2f); From 971872b03bd22112877fe500d64dffcbc8a02ddb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:29:45 +0000 Subject: [PATCH 088/657] decomp: clarify names in piston_platform_update x40 -> rotation: Retail 0x002f97dc computes a2 = platform s2 + 0x40 and 0x002f97ec copies this pointer to a3 for the call at 0x002f97e8. Original Ghidra likewise passes instance+0x40 twice. SHA-bound C maps both arguments to LiftMoby.x40 in update_entity_matrix(vars->x60, dp, platform->x40, platform->x40). The supplied checked update_entity_matrix source names these arguments previous_rotation/current_rotation and feeds both to euler_rotation_matrix before forming the relative rotation matrix. This proves the member's rotation-input role independently of its offset; preserve its u8[0x38] declaration shape and layout. --- src/overlays/l01/mobys/piston_platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/piston_platform.c b/src/overlays/l01/mobys/piston_platform.c index f02092ed3d..b6811cdaae 100644 --- a/src/overlays/l01/mobys/piston_platform.c +++ b/src/overlays/l01/mobys/piston_platform.c @@ -39,7 +39,7 @@ typedef struct { u8 pad31; s16 h32; u8 pad34[0xC]; - u8 x40[0x38]; + u8 rotation[0x38]; LiftVars *pvars; u8 pad7c[0x40]; u8 mode; @@ -123,5 +123,5 @@ void piston_platform_update(LiftMoby *piston_platform) { } dp = δ fast_vec_sub(dp, &piston_platform->pos, &previous_position); - update_entity_matrix(piston_platform_vars->x60, dp, piston_platform->x40, piston_platform->x40); + update_entity_matrix(piston_platform_vars->x60, dp, piston_platform->rotation, piston_platform->rotation); } From 01a8525ff389d89a35efce233d399ff621f8b0b8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:29:48 +0000 Subject: [PATCH 089/657] decomp: clarify names in process_extermitank_particle_hits x19 -> hit_response_tier: Assigned retail 0x00305980 stores 1 to Hit_306CF0 byte +0x19; 0x003059ac passes that record to collect_mobies_in_sphere. Checked helper 0x002214d0 preserves a3 in s5, loads input +0x10 at 0x00221d08 and copies it to recipient hit-record +0x20 at 0x00221d44, mapping this byte to recipient +0x29. Checked sibling child resolve_moby_hit_response (call 0x00305290 -> 0x00284730) reads +0x29 at 0x00284a0c, 0x00284a3c, 0x00284a5c, 0x00284aac and 0x00284ad0. Unsigned comparisons against 2 and 3 choose response categories in s5 and processing status, proving an ordinal hit-response tier rather than merely an offset or constant flag. --- src/overlays/l05/mobys/extermitank.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l05/mobys/extermitank.c b/src/overlays/l05/mobys/extermitank.c index 10efc88500..a63f0479e7 100644 --- a/src/overlays/l05/mobys/extermitank.c +++ b/src/overlays/l05/mobys/extermitank.c @@ -793,7 +793,7 @@ typedef struct { char *owner; int x14; unsigned char x18; - unsigned char x19; + unsigned char hit_response_tier; short type; float x1C; int flags; @@ -830,7 +830,7 @@ void process_extermitank_particle_hits(char *moby) { set_vector_length_xy(hit_info.v, hit_info.v, 1.5f); hit_info.v[2] = 1.0f; hit_info.v[3] = 5627.9248f; - hit_info.x19 = 1; + hit_info.hit_response_tier = 1; hit_info.type = MOBY(moby)->oclass; hit_info.x18 = 0; for (j = 0; j < 8; j++) { From 226e22004306204006878e5bf408736c8d9d7038 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:31:53 +0000 Subject: [PATCH 090/657] decomp: clarify names in memcard_update_state x10 -> save_data_offset: Authoritative C selects (u8 *)chunk+chunk->x10 for indexed-save creation substate 14 and again after the resource read in MEMCARD_WAIT_SAVE_RESOURCE_READ_AND_SELECT_BUFFER. Retail 00209cd0-00209d0c computes main data size + twenty level record sizes + eight header bytes, loads resource +0x10 at 00209d04 and adds it to the resource base for the write source. Retail 0020a974-0020a980 repeats base+loaded +0x10 into MC.buf; 0020aab4-0020aac8 writes that buffer with the same full-save length. Original Ghidra piStack_68[4] and iStack_58+*(iStack_58+0x10) confirm a resource-relative byte offset to full save data including its header. x8 -> static_icon_offset: In creation substate MEMCARD_CREATE_PROCESS_STATIC_ICON_OPEN_RESULT_AND_REQUEST_WRITE (10), authoritative C forms MC.buf=(u8 *)chunk+chunk->x8. Retail 00209c88-00209ca0 loads the resource base from sp+0x48, loads its +8 word and adds it to that base before storing the sceMcWrite source. Original Ghidra agrees via piStack_68+piStack_68[2]. The substate opens static.ico through path 0013d220 (00209b60-00209b6c; supplied checked filename evidence), proving a resource-relative byte offset to the static icon payload. xC -> static_icon_size: In creation substate 10, authoritative C assigns chunk->xC to MC.size while chunk->x8 selects the static.ico payload. Retail 00209c8c-00209c90 loads resource word +0xc and stores it to memory-card-state +0xf0; 00209d18-00209d20 passes this word as a2 to sceMcWrite, and 00209d38-00209d40 compares it with completed byte count. Original Ghidra assigns piStack_68[3] to DAT_0013d380. This proves the static icon payload size in bytes. --- src/save/memcard_update_state.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/save/memcard_update_state.c b/src/save/memcard_update_state.c index af173fe29e..6df658ac27 100644 --- a/src/save/memcard_update_state.c +++ b/src/save/memcard_update_state.c @@ -17,9 +17,9 @@ typedef struct { s32 x0; s32 x4; - s32 x8; - s32 xC; - s32 x10; + s32 static_icon_offset; + s32 static_icon_size; + s32 save_data_offset; } McChunk; extern const char memcard_delete_entry_path_format[] __asm__("D_0015FE98"); @@ -349,8 +349,8 @@ void memcard_update_state(void) { MC.buf = (u8 *)chunk + chunk->x0; break; case MEMCARD_CREATE_PROCESS_STATIC_ICON_OPEN_RESULT_AND_REQUEST_WRITE: - MC.size = chunk->xC; - MC.buf = (u8 *)chunk + chunk->x8; + MC.size = chunk->static_icon_size; + MC.buf = (u8 *)chunk + chunk->static_icon_offset; break; case MEMCARD_CREATE_PROCESS_AUXILIARY_FILE_OPEN_RESULT_AND_REQUEST_WRITE: if (pause_action_list_mode != 0) { @@ -363,7 +363,7 @@ void memcard_update_state(void) { case MEMCARD_CREATE_PROCESS_SAVE_OPEN_RESULT_AND_REQUEST_WRITE: { s32 n = memcard_get_data_size(mc_gamedata); MC.size = n + memcard_get_data_size(mc_leveldata) * 20 + 8; - MC.buf = (u8 *)chunk + chunk->x10; + MC.buf = (u8 *)chunk + chunk->save_data_offset; break; } } @@ -902,7 +902,7 @@ void memcard_update_state(void) { calculate_ring_buffer_bounds(disc_table.memcard_data.size << 11, &chunk, &size); MC.sub = 19; - MC.buf = (u8 *)chunk + chunk->x10; + MC.buf = (u8 *)chunk + chunk->save_data_offset; } MC.busy = 0; break; From e6ae046d7a1defd0eda001d7ba46623463bbe8f6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:31:56 +0000 Subject: [PATCH 091/657] decomp: clarify names in initialize_transform_state_from_level_table x4C -> hero_target_height_offset: Retail 0x002e864c/0x002e865c obtains CamInfo via transform_state+0x70 and its CamSub at +0x10; 0x002e866c initializes CamSub+0x4c to 1.5f, and 0x002e86b0-0x002e86b4 replaces it with level entry subrecord+0x18. Original Ghidra confirms the same auxiliary +0x5c stores. In the authoritative C, smooth_transform_orientation_toward_hero sets height=(float *)(orientation_spring_state+0x10), then adds height[19] (0x10+19*4=0x5c, exactly CamSub.x4C) to position[2] after copying hero.motion.pos.f, before subtracting camera position and normalizing direction. Thus this float offsets the hero target height used to aim the camera. --- src/overlays/shared/camera/clip_volume_camera.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/camera/clip_volume_camera.c b/src/overlays/shared/camera/clip_volume_camera.c index 999e340d97..3bdae883c8 100644 --- a/src/overlays/shared/camera/clip_volume_camera.c +++ b/src/overlays/shared/camera/clip_volume_camera.c @@ -14,7 +14,7 @@ typedef struct { char pad0[0x40]; int x40; char pad1[8]; - float x4C; + float hero_target_height_offset; } CamSub; typedef struct { @@ -43,7 +43,7 @@ void initialize_transform_state_from_level_table(char *transform_state) { char *ent; int level_table_entry_index; char *entry_subrecord; - camera_subrecord->x4C = 1.5f; + camera_subrecord->hero_target_height_offset = 1.5f; camera_subrecord->x40 = 0; (*(CamInfo **)(transform_state + 0x70))->x80 = 0; camera_info = *(CamInfo **)(transform_state + 0x70); @@ -56,7 +56,7 @@ void initialize_transform_state_from_level_table(char *transform_state) { if (level_table_entry_index < 0) { RaiseKernelTrap(); } else { - camera_subrecord->x4C = *(float *)(entry_subrecord + 0x18); + camera_subrecord->hero_target_height_offset = *(float *)(entry_subrecord + 0x18); } qcopy(transform_state + 0x30, ent); qcopy(entry_euler_angles, ent + 0x10); From 872aa3b9bffeca2b2dc7646bf93e092a0196cf92 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:31:59 +0000 Subject: [PATCH 092/657] decomp: clarify names in initialize_level_render_state x23C -> background_color_red: Display.s32 x23C receives the first environment word at retail 0x001e9c64-0x001e9c6c, is loaded into a0 at 0x001e9d14, and is passed to set_background_color at 0x001e9d38. Supplied set_background_color(s32 red,u64 green,u64 blue) ORs this first argument into the low red channel of fs_aa_clear_packet[7]. x240 -> background_color_green: Display.s32 x240 receives the second environment word at retail 0x001e9c70-0x001e9c78, is loaded into a1 at 0x001e9d10, and reaches set_background_color at 0x001e9d38. Supplied callee source shifts this second argument green by eight bits into the background clear packet. x244 -> background_color_blue: Display.s32 x244 receives the third environment word at retail 0x001e9c7c-0x001e9c84, is loaded into a2 at 0x001e9d0c, and reaches set_background_color at 0x001e9d38. Supplied callee source shifts this third argument blue by sixteen bits into the background clear packet. --- .../frame/initialize_level_render_state.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/rendering/frame/initialize_level_render_state.c b/src/rendering/frame/initialize_level_render_state.c index d133d01dd0..15569dbe52 100644 --- a/src/rendering/frame/initialize_level_render_state.c +++ b/src/rendering/frame/initialize_level_render_state.c @@ -72,9 +72,9 @@ typedef struct Ent40 { typedef struct Display { u8 pad00[0x23C]; - s32 x23C; - s32 x240; - s32 x244; + s32 background_color_red; + s32 background_color_green; + s32 background_color_blue; } Display; typedef struct Buf194100 { @@ -198,11 +198,11 @@ u8 *initialize_level_render_state(LevelHeader *header) { fast_mem_zero16(moby_grid_block_bitmap, 0x60); environment = (u8 *)header + header->x0; - D_0018CD00.x23C = *(s32 *)environment; + D_0018CD00.background_color_red = *(s32 *)environment; environment += 4; - D_0018CD00.x240 = *(s32 *)environment; + D_0018CD00.background_color_green = *(s32 *)environment; environment += 4; - D_0018CD00.x244 = *(s32 *)environment; + D_0018CD00.background_color_blue = *(s32 *)environment; environment += 4; fog_color_red = *environment; environment += 4; @@ -220,7 +220,7 @@ u8 *initialize_level_render_state(LevelHeader *header) { occl_fog_density_set = 500.0f; occl_fog_count = 500; part_clip_dist = 0x1F4000; - set_background_color(D_0018CD00.x23C, D_0018CD00.x240, D_0018CD00.x244); + set_background_color(D_0018CD00.background_color_red, D_0018CD00.background_color_green, D_0018CD00.background_color_blue); vu0_load_micro_program(D_00100AE0); fast_mem_zero16(point_lights, 0x100); fast_mem_zero16(point_light_data, 0x180); From 6910a0d4b9637de5941153df8de2ea76a9054537 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:32:03 +0000 Subject: [PATCH 093/657] decomp: clarify names in initialize_level_transition_with_audio x26 -> audio_selection_base_index: E_28e9c8.x26 is a signed short at shared record +0x26, read as sRam0013e056 in original retail Ghidra. Retail lh a0,0x26(v0) at 0x0028eb40 feeds stream selection base+1 (0x0028eb48) and secondary track base+6 (0x0028eb50). The other branch loads it at 0x0028ebc4 and derives secondary track base+3 or base at 0x0028ebd0/0x0028ebdc and alternate stream selection base+5 at 0x0028ebd4. Selected stream indices are passed to load_chunks_with_optional_fade at 0x0028eba8-0x0028ebb0 and 0x0028ec60-0x0028ec64; selected secondary track plus 40000 is stored to music_stream_state.queued_secondary_track at 0x0028ec74-0x0028ec78. Authoritative C copies this field into established local base_audio_selection_index in both branches and uses it in level-specific overrides. This proves an audio-selection base index without asserting gameplay or song identity. --- .../shared/game/initialize_level_transition_with_audio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/game/initialize_level_transition_with_audio.c b/src/overlays/shared/game/initialize_level_transition_with_audio.c index aa10de810e..322f71ddc0 100644 --- a/src/overlays/shared/game/initialize_level_transition_with_audio.c +++ b/src/overlays/shared/game/initialize_level_transition_with_audio.c @@ -91,7 +91,7 @@ typedef struct { char padc[0x14]; int x20; short x24; - short x26; + short audio_selection_base_index; char pad28[4]; short x2c; } E_28e9c8; @@ -149,7 +149,7 @@ void initialize_level_transition_with_audio(int audio_selection_mode) { moby->flags |= 0x80; } if (audio_selection_mode == AUDIO_SELECTION_MODE_ALWAYS_FADE) { - base_audio_selection_index = D_0013E030_28e9c8.x26; + base_audio_selection_index = D_0013E030_28e9c8.audio_selection_base_index; audio_stream_table_index = base_audio_selection_index + 1; secondary_track_index = base_audio_selection_index + 6; if (current_level_index == LEVEL_ORXON && base_audio_selection_index == 1 && @@ -163,7 +163,7 @@ void initialize_level_transition_with_audio(int audio_selection_mode) { load_chunks_with_optional_fade(audio_stream_table_index, scale_game_frames(6)); } else { int k, fade_frame_count; - base_audio_selection_index = D_0013E030_28e9c8.x26; + base_audio_selection_index = D_0013E030_28e9c8.audio_selection_base_index; k = D_0013E030_28e9c8.x2c; secondary_track_index = base_audio_selection_index + 3; if (k) From f33b7bb7736ed16a485f933ca7f8f377440b4bb7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:32:06 +0000 Subject: [PATCH 094/657] decomp: clarify names in load_hand_gadget x60 -> animation_attachment0_moby_address: Retail 0x002248f0 forms hand+0x60, saved at sp+0x30 and loaded as a3 at 0x00224b1c for 0x00225e70. Consumer preserves a3 in s7 (0x00225e84), deletes *s7 at 0x00226310..0x0022631c, and writes create_menu_preview_moby's address to *s7 at 0x00226358..0x00226364 using active record +0x18 class and +0x1c animation. Loader supplies gadget_animations.attachment0_class/attachment0_animation to queue arguments 6/7; 0x0022662c..0x00226630 stores these at queue +0x18/+0x1c, copied to active record at 0x002261d8..0x002261f4. Thus this s32 stores the animation attachment slot 0 moby address. x64 -> animation_attachment1_moby_address: Retail 0x0022490c forms hand+0x64, saved at sp+0x34 and loaded as t0 at 0x00224b20 for 0x00225e70. Consumer saves t0 at sp+0xc (0x00225eb4), deletes the stored moby at 0x00226320..0x00226330 and stores the newly created moby through that pointer at 0x00226414..0x00226424. Class/animation come from active record +0x20/+0x24 (0x00226408 and 0x00226428). Loader supplies attachment1_class/attachment1_animation as queue arguments 8/9, stored to queue +0x20/+0x24 at 0x00226634 and 0x00226640, then copied to the active record. This proves animation attachment slot 1 moby address storage. x68 -> animation_attachment2_moby_address: Retail 0x00224900 forms hand+0x68, saved at sp+0x38 and loaded as t1 at 0x00224b28 for 0x00225e70. Consumer saves t1 at sp+0x10 (0x00225eb8), deletes its stored moby at 0x00226334..0x00226344 and writes the created preview moby through it at 0x002264e4..0x002264f4. Active record +0x28 supplies class and +0x2c supplies animation (0x002264d8, 0x002264f8). Loader passes attachment2_class/attachment2_animation as queue arguments 10/11, which 0x00226648 and 0x00226650 store at queue +0x28/+0x2c before the active-record copy. Thus this s32 stores animation attachment slot 2's moby address. --- src/weapons/load_hand_gadget.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/weapons/load_hand_gadget.c b/src/weapons/load_hand_gadget.c index c8d5ad48c4..eb5c602b74 100644 --- a/src/weapons/load_hand_gadget.c +++ b/src/weapons/load_hand_gadget.c @@ -36,9 +36,9 @@ typedef struct HandGadgetState { Moby *class_pose_moby; Moby *first_attachment_moby; Moby *second_attachment_moby; - s32 x60; - s32 x64; - s32 x68; + s32 animation_attachment0_moby_address; + s32 animation_attachment1_moby_address; + s32 animation_attachment2_moby_address; Moby *class_0197_moby; Moby *class_0266_moby; Moby *class_026a_moby; @@ -327,9 +327,9 @@ s32 load_hand_gadget(HandGadgetState *hand) { update_preview_animation_and_attachments(hand->source_moby_address, hand->class_pose_moby, hand->animation_moby, - &hand->x60, - &hand->x64, - &hand->x68); + &hand->animation_attachment0_moby_address, + &hand->animation_attachment1_moby_address, + &hand->animation_attachment2_moby_address); return 0; } From be92c91e413c4ad560e128ba0e146ba04372637a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:32:09 +0000 Subject: [PATCH 095/657] decomp: clarify names in finish_cutscene x46 -> apply_hero_return_transform: C_298b18 declares a short at checked offset +0x46. Retail 0x00298cd4 establishes s0=0x0016C860; 0x00298ce4 loads lh v0,0x46(s0), and 0x00298ce8 skips to 0x00298d50 when zero. Nonzero gates the ground probe of stored position +0x10, optional Z correction at +0x18 (0x00298d00-0x00298d34), then set_race_camera at 0x00298d48 with a0=0x0016C870 and a1=a0+0x10, mode 0 and camera reset 1. Supplied helper C identifies these as hero position/rotation. Checked level-00 helper retail 0x00216fbc-0x00216fe0 copies a0 into hero position 0x0013F3D0 and hero moby +0x10, and a1 into hero rotation 0x0013F3E0; 0x00216fe8/0x00216ff8 rebuild rotation bases. Thus this field enables applying the stored hero return transform when finishing the cutscene, rather than merely marking an unknown offset. --- src/overlays/shared/cutscenes/update_cutscene_playback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/cutscenes/update_cutscene_playback.c b/src/overlays/shared/cutscenes/update_cutscene_playback.c index 8379513cfa..a945fb4728 100644 --- a/src/overlays/shared/cutscenes/update_cutscene_playback.c +++ b/src/overlays/shared/cutscenes/update_cutscene_playback.c @@ -495,7 +495,7 @@ typedef struct { float x18; char pad1c[0x28]; short n; - short x46; + short apply_hero_return_transform; char pad48[0x130]; M_298b18 *m[1]; } C_298b18; @@ -541,7 +541,7 @@ void finish_cutscene(void) { hero.motion.pos.f[2] = hero_candidate_z; hero.hidden = 0; update_hero_item_moby_flags(); - if (D_L00_0016C860_298b18.x46) { + if (D_L00_0016C860_298b18.apply_hero_return_transform) { f = probe_ground_height(D_L00_0016C860_298b18.v, 0, 0.5f); if (2.0f < f && absolute_float(D_L00_0016C860_298b18.x18 - f) < 2.0f) D_L00_0016C860_298b18.x18 = f; From 1a8cbd89b821ed9f971a3c836425d715186daa6f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:34:51 +0000 Subject: [PATCH 096/657] decomp: clarify names in update_moby_point_attached_particle x4 -> moby_point_selector: Q_2726d8.x4 is the s32 at particle +0x34. Retail 0x0027276c loads it into a1 and 0x00272778 calls moby_point_position with owner in a0 and primary position in a2. The authoritative constructor stores attachment_point_selector at this same location and uses it for the initial moby_point_position call, proving the attachment selector role while preserving its existing s32 type. x8 -> attached_owner_identity: Q_2726d8.x8 is the s32 at particle +0x38. Retail 0x0027270c loads the owner's signed halfword at +0xA6, 0x00272710 loads this saved field, and 0x00272714 branches to free_effect_particle on inequality. The supplied constructor snapshots *(s16 *)(owner_moby +0xA6) into the same +0x38 slot, proving this is the saved attached owner's identity guard. xC -> initial_primary_position_w: Q_2726d8.xC is the f32 at particle +0x3C. The supplied constructor stores primary_position_w both at particle +0x1C and at +0x3C. Retail 0x00272750 obtains random [0.5,1.0], 0x00272758 loads +0x3C, 0x00272760 multiplies them, and 0x0027280c stores the product to primary position W at +0x1C. This proves the retained initial primary-position W role without assigning an unproven visual meaning. --- src/overlays/shared/rendering/effects/particles.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index 15a046f67d..d3d836d898 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -657,9 +657,9 @@ typedef unsigned int u128_2726d8 __attribute__((mode(TI), aligned(16))); typedef struct { u8 *owner; - s32 x4; - s32 x8; - f32 xC; + s32 moby_point_selector; + s32 attached_owner_identity; + f32 initial_primary_position_w; } Q_2726d8; typedef struct { @@ -676,7 +676,7 @@ void update_moby_point_attached_particle(P_2726d8 *particle) { Q_2726d8 *q = &particle->q; u128_2726d8 position_delta; f32 save, sc, length_jitter, target_length; - if (particle->q.owner == 0 || *(s16 *)(particle->q.owner + 0xA6) != q->x8 || + if (particle->q.owner == 0 || *(s16 *)(particle->q.owner + 0xA6) != q->attached_owner_identity || particle->q.owner[0x20] == 0xFE || particle->q.owner[0x20] == 0xFD) { free_effect_particle(particle); return; @@ -684,7 +684,7 @@ void update_moby_point_attached_particle(P_2726d8 *particle) { sc = q->xC * random_float_between(0.5f, 1.0f); save = particle->secondary_position_w; qcopy(&position_delta, &particle->pos); - moby_point_position(particle->q.owner, q->x4, &particle->pos); + moby_point_position(particle->q.owner, q->moby_point_selector, &particle->pos); fast_vec_sub(&position_delta, &position_delta, &particle->pos); length_jitter = random_float_between(-0.021f, 0.021f); if (fast_vec_length(&position_delta) < 0.0625f) { From 0d374a9df6e5196a04cf9dd29413d2c7ba3d7d15 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:37:27 +0000 Subject: [PATCH 097/657] decomp: clarify names in initialize_orbit_camera_state domain_0_value_0 -> CAMERA_SELECTION_MODE_USE_PRESET_TRANSITION: Assigned retail 0x002eb464 stores zero to camera_object+0x7E. Checked caller 0x002eb930 calls both 0x001eb510 at 0x002eb960 and this initializer at 0x002eb9b4 (request 96fd986858204e9083001c2f30ead732). In the checked camera-switch sibling 0x001eb510 (request 5178beb4210047d9bf553d3bd55033b7), 0x001eb550 loads the outgoing camera from globals+0x180, and 0x001eb564 reads its +0x7E selection mode. The incoming camera's +0x84 indexes preset records (0x001eb54c-55c), whose +0x1C pointer supplies transition policy byte +0x1D at 0x001eb568. When outgoing mode is zero, comparisons against overrides 4,2,3,5 fail (0x001eb570/588/654/65c); the incoming preset byte then selects transition setup for 1/5 at 0x001eb594-5f8 or pose inheritance for 3/6 at 0x001eb664-6b0, with the remaining preset path setting incoming +0x8E at 0x001eb670. Thus zero delegates transition selection to the incoming camera preset rather than imposing an outgoing override. 0x001eb76c resets the outgoing mode to zero after selection. This is a camera-selection domain, unrelated to the equal-valued Hero enum members. --- src/overlays/shared/camera/orbit_camera.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/camera/orbit_camera.c b/src/overlays/shared/camera/orbit_camera.c index a1b41f1f3d..390d874683 100644 --- a/src/overlays/shared/camera/orbit_camera.c +++ b/src/overlays/shared/camera/orbit_camera.c @@ -132,6 +132,9 @@ void initialize_orbit_camera_from_parameters(char *camera_object, void initialize_orbit_camera_state(S002eb3b0 *camera_object) __asm__("FUN_L00_002eb3b0"); void initialize_orbit_camera_state(S002eb3b0 *camera_object) { + enum { + CAMERA_SELECTION_MODE_USE_PRESET_TRANSITION = 0 + }; Moby002eb3b0 *m; camera_object->m->fF0 = 0; m = camera_object->m; @@ -154,7 +157,7 @@ void initialize_orbit_camera_state(S002eb3b0 *camera_object) { zero_five_words(m); clear_twelve_bytes((u8 *)m + 0x90); initialize_orbit_camera_pose(camera_object); - camera_object->camera_selection_mode = 0; + camera_object->camera_selection_mode = CAMERA_SELECTION_MODE_USE_PRESET_TRANSITION; } void update_orbit_camera_pose(char *camera_object) __asm__("FUN_L00_002eb480"); From c33677608897dda7a12a83d0c6537945207db778 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:37:31 +0000 Subject: [PATCH 098/657] decomp: clarify names in peckbot_update x130 -> knockback_gravity_step: Retail 0x002efea0 and 0x002f0980 store gravity/acceleration in vars+0x130. The motion record starts at vars+0x120; checked consumer 0x00271594-0x002715a8 subtracts record+0x10 from velocity Z at record+8 each step, proving the vertical gravity step. x134 -> knockback_speed_adjustment_step: Retail 0x002efea4 sets vars+0x134 to 0.0005 and 0x002f0978 clears it for the home arc. With record base vars+0x120, consumer 0x002715c4-0x002715f8 obtains vector magnitude, passes record+0x14 as approach_value step, then rescales the velocity to the adjusted magnitude. x138 -> knockback_initial_horizontal_speed: Retail 0x002efea8 stores the named horizontal-speed global times frame_time in vars+0x138; fatal setup replaces it with 11*frame_time and passes its address to arc adjustment at 0x002efedc-0x002eff00. Supplied checked setup evidence 0x00271454-0x00271498 uses knock+0x18 with cosine/sine to initialize XY velocity. x13C -> knockback_initial_vertical_speed: Retail 0x002efeac stores the named vertical-speed global times frame_time in vars+0x13c; home arc 0x002f0988-0x002f0994 stores its solved vertical velocity there. Supplied checked setup 0x00271454-0x00271498 copies knock+0x1c into velocity Z; consumer 0x002715fc-0x00271610 also uses it as an upper clamp. x144 -> knockback_motion_flags: Retail 0x002efeb0/0x002f0998 stores 9/13 at vars+0x144, record+0x24 relative to knock. Checked consumer masks this word with 0x10 at 0x00271658-0x002716d4, 4 at 0x00271a48-0x00271a54 to gate turning, and 0x20 at 0x00271b38-0x00271b40, proving a knockback motion bitmask. x174 -> knockback_animation_stop_frame: Retail 0x002eff34/0x002effbc/0x002f09d4 sets vars+0x174 to 18 or 10 after knockback setup. Consumer record+0x54 equals this field: 0x00271918-0x00271938 compares it to compute_interpolated_record_value and writes zero animation speed when the current frame reaches it; 0x002719bc-0x002719d4 also uses its remaining frame interval. x188 -> maximum_ground_drop: Retail 0x002f00e0 initializes vars+0x188 to 2 in the movement record based at vars+0x180. Consumer 0x0026dd94-0x0026ddb4 subtracts probed ground height from saved position Z and compares the drop to record+8; excessive drop sets blocked flags and restores position at 0x0026ddd4-0x0026ddd8. x18C -> maximum_ground_rise: Retail 0x002f00e4 initializes vars+0x18c to 2 in the movement record based at vars+0x180. Consumer 0x0026ddbc-0x0026ddd8 computes ground height minus saved position Z, compares the rise against record+0xc and rejects excessive rise by setting blocked flags and restoring position. x198 -> movement_vertical_velocity: Source attack and forward-movement branches subtract frame_time_sq*9.8 from this float and add it to moby position Z, zeroing it at the ground clamp. Retail 0x002f1220-0x002f1250 and 0x002f1b98-0x002f1bc4 implement exactly that gravity integration. Movement consumer 0x0026db14-0x0026db24 likewise reads and decrements record+0x18. x1A4 -> maximum_horizontal_movement_step: Retail 0x002f00cc-0x002f00ec initializes vars+0x1a4 from speed*frame_time. Movement record base vars+0x180 makes it record+0x24: checked consumer 0x0026da0c-0x0026da1c scales it by the call multiplier, then 0x0026da7c-0x0026daa4 clamps signed horizontal step magnitude to that limit before cosine/sine construct XY displacement. x20A -> stay_grounded: Retail 0x002f0018-0x002f0074 tests this signed short: nonzero initializes GROUNDED_IDLE; zero raises Z by six and initializes AIRBORNE_IDLE. Grounded idle 0x002f0764-0x002f077c and face-away 0x002f0c88-0x002f0c9c permit ASCEND only when the same field is zero, proving the stay-grounded option. x214 -> reduced_range_timer: Retail 0x002efd30-0x002efd38 loads this timer with scale_game_frames(240) after vars+0x38 is signaled. 0x002efd48-0x002efd6c decrements it and selects range 12 while active versus 24 otherwise; initialization clears it at 0x002f00a0. x216 -> maximum_leader_distance: Retail 0x002f1bc8-0x002f1be8 computes XY distance from peckbot position to leader+0x10, converts this signed short to float and compares distance to it. A missing leader or exceeding that threshold selects RETURN_HOME at 0x002f1bf8-0x002f1c08, proving the maximum leader distance. x228 -> airborne_idle_timer: Retail 0x002f05d4-0x002f05dc and 0x002f1568-0x002f1570 set this timer to scale_game_frames(180) when returning to AIRBORNE_IDLE. That state's 0x002f0128-0x002f01b8 decrements/tests this same word to gate descent decisions, proving its airborne-idle timing role without asserting an expiry polarity. x38 -> reduced_range_request: Retail 0x002efd20-0x002efd3c tests this word, reloads vars+0x214 with scale_game_frames(240) when nonzero and clears the word after consumption. The following 0x002efd48-0x002efd6c uses that timer to reduce range from 24 to 12, proving a consumed reduced-range request. --- src/overlays/l01/mobys/peckbot.c | 44 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/overlays/l01/mobys/peckbot.c b/src/overlays/l01/mobys/peckbot.c index 5aa806e3f9..2362096827 100644 --- a/src/overlays/l01/mobys/peckbot.c +++ b/src/overlays/l01/mobys/peckbot.c @@ -255,12 +255,12 @@ void peckbot_update(Mob577 *peckbot_moby) { select_moby_combat_target(peckbot_moby, &target, peckbot_vars->range + 4.0f); target_moby = target.combat_target_moby; qcopy(&oldpos, &peckbot_moby->pos); - if (peckbot_vars->x38 != 0) { - peckbot_vars->x214 = scale_game_frames(0xF0); + if (peckbot_vars->reduced_range_request != 0) { + peckbot_vars->reduced_range_timer = scale_game_frames(0xF0); } - peckbot_vars->x38 = 0; + peckbot_vars->reduced_range_request = 0; fast_dec_timer_s16(&peckbot_vars->x208); - if (fast_dec_timer_s16(&peckbot_vars->x214) != 0) { + if (fast_dec_timer_s16(&peckbot_vars->reduced_range_timer) != 0) { peckbot_vars->range = 12.0f; } else { peckbot_vars->range = 24.0f; @@ -328,7 +328,7 @@ void peckbot_update(Mob577 *peckbot_moby) { case PECKBOT_STATE_INITIALIZE: qcopy(&peckbot_vars->home, &peckbot_moby->pos); peckbot_vars->x29 = 0; - if (peckbot_vars->x20A != 0) { + if (peckbot_vars->stay_grounded != 0) { peckbot_moby->state = PECKBOT_STATE_GROUNDED_IDLE; SET_ANIM(peckbot_moby, 4, 0, 0); } else { @@ -336,7 +336,7 @@ void peckbot_update(Mob577 *peckbot_moby) { peckbot_moby->pos.f[2] = peckbot_moby->pos.f[2] + 6.0f; SET_ANIM(peckbot_moby, 0, 0, 0); } - peckbot_vars->x214 = 0; + peckbot_vars->reduced_range_timer = 0; peckbot_vars->x208 = 0; peckbot_vars->health = 1.0f; peckbot_vars->x24 = 1; @@ -344,9 +344,9 @@ void peckbot_update(Mob577 *peckbot_moby) { peckbot_vars->x5A = 4; FUN_L01_0026d930(&peckbot_vars->x180); peckbot_vars->x180 = 0x38D; - peckbot_vars->x18C = 2.0f; - peckbot_vars->x188 = 2.0f; - peckbot_vars->x1A4 = peckbot_vars->speed * frame_time; + peckbot_vars->maximum_ground_rise = 2.0f; + peckbot_vars->maximum_ground_drop = 2.0f; + peckbot_vars->maximum_horizontal_movement_step = peckbot_vars->speed * frame_time; if (rand() & 1) { peckbot_moby->flags |= 0x8000; } @@ -354,12 +354,12 @@ void peckbot_update(Mob577 *peckbot_moby) { break; case PECKBOT_STATE_AIRBORNE_IDLE: fast_vec_sub(&vector_scratch, &target.pos, &peckbot_moby->pos); - if (fast_dec_timer(&peckbot_vars->x228) != 0 && + if (fast_dec_timer(&peckbot_vars->airborne_idle_timer) != 0 && fast_vec_length(&vector_scratch) < peckbot_vars->range + 4.0f && absolute_float(peckbot_moby->pos.f[2] - target.pos.f[2]) < 8.0f && random_integer_below(0x13) == 0) { peckbot_moby->state = PECKBOT_STATE_DESCEND; - } else if (peckbot_vars->x228 == 0 && peckbot_moby->hit == 1 && + } else if (peckbot_vars->airborne_idle_timer == 0 && peckbot_moby->hit == 1 && random_integer_below(0x13) == 0) { if (random_integer_below(0x100) & 1) { peckbot_vars->turn_deg = -peckbot_vars->turn_deg; @@ -425,7 +425,7 @@ void peckbot_update(Mob577 *peckbot_moby) { if (ascent_ground_height + 6.0f <= peckbot_moby->pos.f[2]) { peckbot_moby->pos.f[2] = ascent_ground_height + 6.0f; peckbot_moby->state = PECKBOT_STATE_AIRBORNE_IDLE; - peckbot_vars->x228 = scale_game_frames(0xB4); + peckbot_vars->airborne_idle_timer = scale_game_frames(0xB4); clear_u64_value(&peckbot_vars->vel); } break; @@ -446,7 +446,7 @@ void peckbot_update(Mob577 *peckbot_moby) { SET_ANIM(peckbot_moby, 2, 0, scale_game_frames(3)); peckbot_moby->hit = 0; } else if (fast_vec_length(&vector_scratch) > peckbot_vars->range + 6.0f && - peckbot_vars->x20A == 0) { + peckbot_vars->stay_grounded == 0) { peckbot_moby->state = PECKBOT_STATE_ASCEND; SET_ANIM(peckbot_moby, 0, 0, scale_game_frames(3)); } @@ -536,7 +536,7 @@ void peckbot_update(Mob577 *peckbot_moby) { SET_ANIM(peckbot_moby, 2, 0, scale_game_frames(3)); peckbot_moby->hit = 0; } else if (fast_vec_length(&vector_scratch) > peckbot_vars->range + 6.0f && - peckbot_vars->x20A == 0) { + peckbot_vars->stay_grounded == 0) { peckbot_moby->state = PECKBOT_STATE_ASCEND; SET_ANIM(peckbot_moby, 0, 0, scale_game_frames(3)); } @@ -620,10 +620,10 @@ void peckbot_update(Mob577 *peckbot_moby) { SET_ANIM(peckbot_moby, 2, 0, scale_game_frames(3)); } attack_ground_height = FUN_00213508(&peckbot_moby->pos, 0, 0.5f); - peckbot_vars->x198 = peckbot_vars->x198 - frame_time_sq * 9.8f; - peckbot_moby->pos.f[2] = peckbot_moby->pos.f[2] + peckbot_vars->x198; + peckbot_vars->movement_vertical_velocity = peckbot_vars->movement_vertical_velocity - frame_time_sq * 9.8f; + peckbot_moby->pos.f[2] = peckbot_moby->pos.f[2] + peckbot_vars->movement_vertical_velocity; if (peckbot_moby->pos.f[2] < attack_ground_height) { - peckbot_vars->x198 = 0.0f; + peckbot_vars->movement_vertical_velocity = 0.0f; peckbot_moby->pos.f[2] = attack_ground_height; } break; @@ -685,7 +685,7 @@ void peckbot_update(Mob577 *peckbot_moby) { case 7: if (FUN_L00_002dc9f0(peckbot_moby, &peckbot_vars->knockback) != 0) { peckbot_moby->state = PECKBOT_STATE_AIRBORNE_IDLE; - peckbot_vars->x228 = scale_game_frames(0xB4); + peckbot_vars->airborne_idle_timer = scale_game_frames(0xB4); SET_ANIM(peckbot_moby, 0, 0, 0); peckbot_vars->xC8 = 0; } @@ -846,15 +846,15 @@ void peckbot_update(Mob577 *peckbot_moby) { } qcopy(&peckbot_moby->pos, &position_scratch); forward_movement_ground_height = FUN_00213508(&peckbot_moby->pos, 0, 0.5f); - peckbot_vars->x198 = peckbot_vars->x198 - frame_time_sq * 9.8f; - peckbot_moby->pos.f[2] = peckbot_moby->pos.f[2] + peckbot_vars->x198; + peckbot_vars->movement_vertical_velocity = peckbot_vars->movement_vertical_velocity - frame_time_sq * 9.8f; + peckbot_moby->pos.f[2] = peckbot_moby->pos.f[2] + peckbot_vars->movement_vertical_velocity; if (peckbot_moby->pos.f[2] < forward_movement_ground_height) { - peckbot_vars->x198 = 0.0f; + peckbot_vars->movement_vertical_velocity = 0.0f; peckbot_moby->pos.f[2] = forward_movement_ground_height; } if (peckbot_vars->leader == NULL || vector_distance_xy(&peckbot_moby->pos, &peckbot_vars->leader->pos) > - convert_integer_to_float(peckbot_vars->x216)) { + convert_integer_to_float(peckbot_vars->maximum_leader_distance)) { peckbot_moby->state = PECKBOT_STATE_RETURN_HOME; SET_ANIM(peckbot_moby, 2, 0, scale_game_frames(3)); } From 6770437d04e4987d8419dd41c0687ba994c2baae Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 04:59:36 +0000 Subject: [PATCH 099/657] decomp: clarify names in peckbot_update xA4 -> hit_record_index: Assigned retail 0x002efd80 calls find_moby_hit (checked level-01 0x0026f320) with the peckbot moby; 0x002effec resets moby+0xA4 to 0xFF after hit handling. Checked consumer 0x0026f320 loads moby+0xA4, compares against 0xFF at 0x0026f328, shifts the index left six at 0x0026f334 and adds table base 0x00178580 at 0x0026f338-0x0026f33c. It validates record+0x34 equals the moby at 0x0026f340-0x0026f344, filters record+0x24 against the hit mask and returns the selected record at 0x0026f354-0x0026f374. Therefore this byte is the hit-record index, with 0xFF denoting no selected record. --- src/overlays/l01/mobys/peckbot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/peckbot.c b/src/overlays/l01/mobys/peckbot.c index 2362096827..8a7d885f66 100644 --- a/src/overlays/l01/mobys/peckbot.c +++ b/src/overlays/l01/mobys/peckbot.c @@ -73,7 +73,7 @@ typedef struct Mob577 { u8 pad7c[0x18]; s32 id; u8 pad98[0xC]; - u8 xA4; + u8 hit_record_index; u8 padA5; s16 oclass; u8 padA8[0x14]; @@ -323,7 +323,7 @@ void peckbot_update(Mob577 *peckbot_moby) { } } } - peckbot_moby->xA4 = 0xFF; + peckbot_moby->hit_record_index = 0xFF; switch (peckbot_moby->state) { case PECKBOT_STATE_INITIALIZE: qcopy(&peckbot_vars->home, &peckbot_moby->pos); From 9a5439ff90b36c351990df8482b043c0442369e4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 05:31:03 +0000 Subject: [PATCH 100/657] decomp: clarify names in select_hero_grapple_swing_target q10 -> moby_position: In the authoritative snapshot src/overlays/shared/hero/hero_set_state.c (SHA-256 792448d533321c30bdbaf30f22fbbde378f5442b01ae922fb1a4ec236c8c6207), M_221ee0.q10 is the OvlQuad at checked PS2 offset +0x10. Retail 0x00221fa8..0x00221fb0 passes hero position +0x80 and candidate_moby+0x10 to fast_vec_dist for the range gate; 0x00221f70..0x00221f84 subtracts candidate +0x18 (its Z component) from hero position Z for the height gate. After selecting the best moby, 0x002220e0 and 0x002220f8..0x0022210c copy best+0x10 into the collision-line endpoint. Original Ghidra shows the same iVar4+0x10 distance input and selected +0x10/+0x18 endpoint copy. The supplied companion select_hero_grapple_target explicitly uses MOBY(candidate_moby)->pos for the analogous distance gate and best+0x10 for collision_end. Together these establish moby_position rather than an offset-only name. --- src/overlays/shared/hero/hero_set_state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index 1201a745c2..53592c1d24 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -413,7 +413,7 @@ typedef struct { typedef struct M_221ee0 { u8 p0[0x10]; - OvlQuad q10; + OvlQuad moby_position; u8 p1[0x28 - 0x20]; struct M_221ee0 *next; u8 p2[0x31 - 0x2C]; @@ -459,7 +459,7 @@ void select_hero_grapple_swing_target(void) { continue; if (3.0f < G.q80.f[2] - *(f32 *)((u8 *)candidate_moby + 0x18)) continue; - if (q->f20 != 0.0f && q->f20 < fast_vec_dist(&G.q80, &candidate_moby->q10)) + if (q->f20 != 0.0f && q->f20 < fast_vec_dist(&G.q80, &candidate_moby->moby_position)) continue; k = G.i2084; target_angle_limit = 0.7853982f; @@ -498,7 +498,7 @@ void select_hero_grapple_swing_target(void) { if (best != 0) { qcopy(&v, &G.q80); v.f[2] += 0.5f; - qcopy(&w, &best->q10); + qcopy(&w, &best->moby_position); if (FUN_001efa68_221ee0(&v, &w, 2, 0, 0) == 0) { G.f998 = bestd; G.h99E = 1; From 443d896bff83afe6a4f89e1ea14d69f886e3e2e0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 05:31:07 +0000 Subject: [PATCH 101/657] decomp: clarify names in FUN_L00_002dc9f0 q20 -> suction_start_rotation_quaternion: R_2DDEA0.q20 is the Vec_2DDEA0 at record+0x20. In SUCK_UPDATE_RISING_FOR_SUCTION, retail 0x002dcbb4 and 0x002dcbc0 pass record+0x20 and moby+0xc0 to the rotation-quaternion extraction call at 0x002dcbdc, matching extract_matrix_rotation_quaternion(&record->q20, &moby->rot_row0) in the authoritative C. In SUCK_UPDATE_BEING_PULLED_IN, 0x002dcc70-0x002dcca4 constructs the owner rotation with an Euler offset and converts it to a target quaternion at sp+0x10. Then 0x002dccac-0x002dccbc passes progress record+0x6c, saved record+0x20 and that target into quaternion_nlerp; 0x002dccc0-0x002dccd4 converts the interpolated quaternion to the moby basis. Thus q20 stores the suction starting rotation quaternion, rather than a position or generic vector. --- src/overlays/shared/weapons/suckcannon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index a7c9295d37..14ed988165 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -321,7 +321,7 @@ typedef struct { typedef struct { float x, y, f8, timer; Vec_2DDEA0 vel; - Vec_2DDEA0 q20; + Vec_2DDEA0 suction_start_rotation_quaternion; Vec_2DDEA0 v30; Vec_2DDEA0 v40; Vec_2DDEA0 v50; @@ -2314,7 +2314,7 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { if (1.0f < suction_and_projectile_record->f6C) suction_and_projectile_record->f6C = 1.0f; moby->pos.z += suction_and_projectile_record->f6C / 100.0f * frame_scale; - extract_matrix_rotation_quaternion(&suction_and_projectile_record->q20, + extract_matrix_rotation_quaternion(&suction_and_projectile_record->suction_start_rotation_quaternion, &moby->rot_row0); clear_u64_value(&suction_and_projectile_record->vel); break; @@ -2340,7 +2340,7 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { matrix_to_quaternion(&suction_and_projectile_scratch.v[1], &suction_and_projectile_scratch.v[7]); quaternion_nlerp(&suction_and_projectile_scratch.v[2], - &suction_and_projectile_record->q20, + &suction_and_projectile_record->suction_start_rotation_quaternion, &suction_and_projectile_scratch.v[1], suction_and_projectile_record->f6C); func_001FA6C0_2DDEA0(&suction_and_projectile_scratch.v[2], From b4592df4b06d61f070c288447f2671f5b6ba467f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 05:33:20 +0000 Subject: [PATCH 102/657] decomp: clarify names in hide_teleporter_and_children field94 -> collision_data: Retail hide at 0x00309804 writes zero to parent+0x94. Checked inverse show_teleporter_and_children loads parent pclass at +0x24 (0x00309838), loads its +0x10 collision data (0x00309848), then stores that value to parent+0x94 (0x00309858). The supplied show C expresses this as parent_moby->collision = *(s32 *)(parent_record + 0x10), and teleporter_update explicitly clears moby->collision or restores moby->pclass->collision. This proves collision_data rather than an offset-only name; the private int member type is preserved. --- src/overlays/shared/props/teleporter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/props/teleporter.c b/src/overlays/shared/props/teleporter.c index 1ca0c8f382..3d627ca1d6 100644 --- a/src/overlays/shared/props/teleporter.c +++ b/src/overlays/shared/props/teleporter.c @@ -72,7 +72,7 @@ struct L01Moby { char pad36[0x42]; L01MobyData *data; char pad7c[0x18]; - int field94; + int collision_data; }; extern void approach_value(float *, float, float) __asm__("FUN_00213ed8"); @@ -594,7 +594,7 @@ void hide_teleporter_and_children(L01Moby *moby) { }; L01Moby **slots = moby->data->slots; int i; - moby->field94 = 0; + moby->collision_data = 0; moby->flags |= 1; moby->state = TELEPORTER_VISIBILITY_HIDDEN; for (i = 2; i >= 0; i--, slots++) { From 403a86d7992e95dc6523dde645862e6a75a26edc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 05:33:24 +0000 Subject: [PATCH 103/657] decomp: clarify names in spawn_jittered_effect_particle_with_optional_basis q4 -> fade_alpha: Q_26de90.q4 is the f32 at particle+0x24: retail 0x0026e058 obtains random [0,0.0223456], 0x0026e078 adds 1e-05, and 0x0026e08c stores it through s4=particle+0x20. Supplied C update_moving_fade_in_out_effect_particle has this same payload slot as q->size, advances it by frame scale*0.007*q->vel, reverses at 0.12, and packs truncate(q->size*255)<<24 into particle color. These color-alpha and fade operations support fade_alpha rather than the consumer's misleading size spelling. q8 -> spin_phase: Q_26de90.q8 is the f32 at particle+0x28, initialized to 0 by retail 0x0026e09c (swc1 f20,0x8(s4), s4=particle+0x20). In the supplied matching C updater payload this slot is q->phase: it increases by frame scale*0.002, subtracts 1 when greater than 1, and writes (int)(phase*255) to particle->b8, the spin byte also initialized at retail 0x0026e040. Its wrapped normalized rotation data flow proves spin_phase. qC -> fade_direction: Q_26de90.qC is the f32 at particle+0x2c: retail 0x0026e0a0-0x0026e0b0 loads/stores 1.0 through s4=particle+0x20. Supplied C update_moving_fade_in_out_effect_particle consumes the corresponding q->vel slot as the signed multiplier in alpha += frame scale*0.007*vel, branches on its sign, and negates it when alpha reaches 0.12 to change fade-in to fade-out. This is fade_direction, separate from physical velocity in the vector at particle+0x30. --- .../effects/update_three_phase_effect_particle.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c index 26b0fe9126..f12e3737b1 100644 --- a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c +++ b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c @@ -2279,9 +2279,9 @@ typedef struct { typedef struct { f32 q0; - f32 q4; - f32 q8; - f32 qC; + f32 fade_alpha; + f32 spin_phase; + f32 fade_direction; V_26de90 v30; } Q_26de90; @@ -2346,11 +2346,11 @@ void spawn_jittered_effect_particle_with_optional_basis(void *spawn_origin, particle->b1 = 0; particle->b8 = 0; particle->b2 = *D_L00_001B20F0; - q->q4 = random_float_between(0.0f, 0.0223456f) + 1e-05f; + q->fade_alpha = random_float_between(0.0f, 0.0223456f) + 1e-05f; particle->fC = random_float_between(10080.0f, 19950.0f); - q->q8 = 0.0f; + q->spin_phase = 0.0f; particle->hA = scale_game_frames(0xFC); - q->qC = 1.0f; + q->fade_direction = 1.0f; qzero(&local_velocity); if (optional_spawn_basis) { local_velocity.f[0] = size; From 2b98846d96dc6a172f47b07e5865a5841fdc2f2c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 05:33:27 +0000 Subject: [PATCH 104/657] decomp: clarify names in sharkigator_update q10 -> rotation: Assigned retail 0030f750..0030f75c copies hero position base 0013F3D0+0x10 into target+0x10 (WalkerTarget.q10), and 0030f794..0030f798 clears it when no target exists. Checked level-07 helper 002886d8 (request 7018c04ef36e43bfb7ac7839a5e03995), 00288890..0028889c copies selected Moby+0x40 into output+0x10. Source uses Moby.rot.z for heading and F(moby,0x44) as pitch at 0030fffc..00310014 and 00310238..00310250, proving this is the selected target's rotation vector, rather than an offset-only interpretation. --- src/overlays/l07/mobys/sharkigator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l07/mobys/sharkigator.c b/src/overlays/l07/mobys/sharkigator.c index 028163da07..76ed82c4c5 100644 --- a/src/overlays/l07/mobys/sharkigator.c +++ b/src/overlays/l07/mobys/sharkigator.c @@ -272,7 +272,7 @@ int test_other_group_moby_state_range(unsigned char *moby, /* Ported from rac1-decomp (src/overlays/l07_umbris/vendor_002CE470.c: func_L07_003109D0), where it is exact; names translated to the US level program. */ struct WalkerTarget { float pos[4]; - u128 q10; + u128 rotation; u128 q20; u128 q30; int moby; @@ -811,14 +811,14 @@ void sharkigator_update(unsigned char *moby) { if (vector_distance_xy(moby + 0x10, hero) < 30.0f) { target.moby = *(int *)(hero + 0x2000); qcopy(&target.pos, hero); - qcopy(&target.q10, hero + 0x10); + qcopy(&target.rotation, hero + 0x10); qcopy(&target.q20, hero + 0x40); qcopy(&target.q30, hero + 0x50); target.kind = WALKER_TARGET_HERO; } else { target.moby = 0; qzero(&target.pos); - qzero(&target.q10); + qzero(&target.rotation); qzero(&target.q30); qzero(&target.q20); target.kind = WALKER_TARGET_NONE; From 369b0686d40d6f8075d1917313dedd5db8de65f6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 05:33:31 +0000 Subject: [PATCH 105/657] decomp: clarify names in flag_vendor_item field39 -> flagged: In the authoritative C, flag_vendor_item selects vendor_item_record from slot * 32, loads its Level13VendorItem pointer, and assigns item->field39 = 1 only when moby->class_id == VENDOR_CLASS_ID. Retail 0x00316f58-0x00316f5c scales/selects the record, 0x00316f6c loads its item pointer from +0x1c, 0x00316f64-0x00316f68 checks class 0x13, and 0x00316f70-0x00316f74 stores byte 1 at item +0x39. Thus this member is the item's flagged indicator set by the established flag_vendor_item function; no more specific gameplay meaning is claimed. --- src/overlays/shared/vendor/flag_vendor_item.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/vendor/flag_vendor_item.c b/src/overlays/shared/vendor/flag_vendor_item.c index ffd0a77306..47d56ddb98 100644 --- a/src/overlays/shared/vendor/flag_vendor_item.c +++ b/src/overlays/shared/vendor/flag_vendor_item.c @@ -10,7 +10,7 @@ typedef struct { char pad0[0x39]; - unsigned char field39; + unsigned char flagged; } Level13VendorItem; typedef struct { @@ -34,5 +34,5 @@ void flag_vendor_item(int slot) { (Level13VendorRecord *)(slot * 32 + (int)l13_vendor_item_records); Level13VendorItem *item = vendor_item_record->item; if (moby->class_id == VENDOR_CLASS_ID) - item->field39 = 1; + item->flagged = 1; } From 3dc71b8e594196c999fabf91f1e63b7cd33cba96 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 05:33:37 +0000 Subject: [PATCH 106/657] decomp: clarify names in enable_elevator_alternate_route field124 -> item_gate_active: In the authoritative qwark_oltanis.c snapshot (SHA-256 5bd65c2bd871d7fd3f670ca0c1b6053d01806aae467c85d91cd5f9ccd05ea86d), Level14VendorData declares this short at +0x124. Retail 0x002ef578 loads moby+0x78 into v1; 0x002ef59c loads 1 and 0x002ef5a4 stores it with sh to +0x124(v1) while enabling the alternate elevator route. The original supplied Ghidra plate identifies the member as the item-gate flag. Qwark's caller enables this on the indexed elevator before the item grant, then calls mark_elevator_collected on the same elevator after grant_inventory_item(0x20, 1). The bounded sibling retail export confirms lw v0,0x78(a0) at 0x002ef5a8 and sh zero,0x124(v0) at 0x002ef5b8, alongside resetting elevator state and marking collection bits. Thus item_gate_active denotes the boolean gate lifecycle rather than an offset-only name. --- src/overlays/l14/mobys/qwark_oltanis.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l14/mobys/qwark_oltanis.c b/src/overlays/l14/mobys/qwark_oltanis.c index 21c133e2c7..31f1844b47 100644 --- a/src/overlays/l14/mobys/qwark_oltanis.c +++ b/src/overlays/l14/mobys/qwark_oltanis.c @@ -31,7 +31,7 @@ typedef struct { char pad0[0xAC]; float value; char padB0[0x74]; - short field124; + short item_gate_active; } Level14VendorData; typedef struct { @@ -46,7 +46,7 @@ void enable_elevator_alternate_route(Level14VendorMoby *moby) __asm__("FUN_L14_0 void enable_elevator_alternate_route(Level14VendorMoby *moby) { Level14VendorData *data = moby->data; moby->state = data->value < 0.0f ? 2 : 1; - data->field124 = 1; + data->item_gate_active = 1; } extern int D_L14_001BABD0[]; @@ -58,7 +58,7 @@ void mark_elevator_collected(Level14VendorMoby *vendor_moby) { ELEVATOR_STATE_COLLECTED = 0 }; vendor_moby->state = ELEVATOR_STATE_COLLECTED; - vendor_moby->data->field124 = 0; + vendor_moby->data->item_gate_active = 0; D_0014C190_257218[current_level_index] [(short)*(unsigned short *)((char *)vendor_moby + 0xB2) >> 5] |= 1 << (*(unsigned short *)((char *)vendor_moby + 0xB2) & 0x1F); From 08bb56c796b63d6cdba79a2b13d7235cecdbb52d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 05:33:40 +0000 Subject: [PATCH 107/657] decomp: clarify names in reset_drek_boss_falling_moby_group field330 -> linked_group_transform_progress: Retail 0x002f1cdc loads pvars from moby+0x78; 0x002f1ce8 clears pvars+0x330 after the class-0x565 check. The supplied VData layout places transform_progress at this same checked PS2 offset: the updater passes its address to advance_accelerated_scalar, compares it with approach/fall thresholds, and multiplies it by 0.5 for position and rotation lerp. This is the linked group's transform progress, not a generic counter. field338 -> linked_moby_count: Retail 0x002f1cf0 loads pvars+0x338 into a2; 0x002f1cf8 passes pvars+0x30 as a1 to apply_linked_moby_relative_transforms at 0x00265358. In the supplied VData updater, the same +0x338 slot is cnt, initialized from the number of collected group members and used to bound ent[i] traversal and relative-transform capture/application. Thus this argument counts linked mobys. field344 -> debris_spawn_bound_accumulator: Retail 0x002f1cec clears pvars+0x344 on class-0x565 reset. The supplied VData layout maps +0x344 to debris_spawn_random_bound: the updater initializes it when transform progress crosses the debris threshold, increments it by 0.25, truncates it as the bound to random_integer_below, and spawns debris only when that draw is zero. It is the accumulating debris spawn random bound, not the vertical fall step at +0x340. --- src/overlays/l18/mobys/falling_moby_group.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l18/mobys/falling_moby_group.c b/src/overlays/l18/mobys/falling_moby_group.c index 37e0492137..47b079163f 100644 --- a/src/overlays/l18/mobys/falling_moby_group.c +++ b/src/overlays/l18/mobys/falling_moby_group.c @@ -285,11 +285,11 @@ typedef struct { typedef struct L18VD_1cc8 { char pad0[0x30]; char update_data[0x300]; - int field330; + int linked_group_transform_progress; char pad334[4]; - int field338; + int linked_moby_count; char pad33C[8]; - int field344; + int debris_spawn_bound_accumulator; } L18VD_1cc8; void reset_drek_boss_falling_moby_group(L18VM_1cc8 *moby) __asm__("FUN_L18_002f1cc8"); @@ -298,10 +298,10 @@ void reset_drek_boss_falling_moby_group(L18VM_1cc8 *moby) { L18VD_1cc8 *data = moby->data; if (moby->class_id == 0x565) { moby->state = FALLING_MOBY_GROUP_AWAIT_ACTIVATION; - data->field330 = 0; - data->field344 = 0; + data->linked_group_transform_progress = 0; + data->debris_spawn_bound_accumulator = 0; } - apply_linked_moby_relative_transforms(moby, data->update_data, data->field338); + apply_linked_moby_relative_transforms(moby, data->update_data, data->linked_moby_count); } /* For each entry of block D_L18_001C6480[D_L18_001C6780[A]]: runs func_001F9BF0 / func_001F9EC0 against the records at D_L18_001600EC + B * 0x80 (+0x30, +0x40) From 2cb967ec4dd59c8d3ca158f5cf5e151ba66763b9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:00:52 +0000 Subject: [PATCH 108/657] decomp: clarify names in RfuDispatchEntry status -> exit_status: In the authoritative src/sdk/syscalls/rfu_dispatch_entry.c snapshot (SHA-256 fd5013bcaf2a2b9ebfd0b3006e9a452406319659811956395c613cb66d24fa7b), the int status parameter is used only by _Exit(status). Retail 0x0011dab0 copies incoming a0 to s0 across the JumpToRfuDispatch call at 0x0011daac; 0x0011dab4 restores it to a0 and 0x0011dac0 tail-jumps to _Exit at 0x00118760. Original Ghidra likewise shows _Exit(param_1), proving this is the exit status. --- src/sdk/syscalls/rfu_dispatch_entry.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/syscalls/rfu_dispatch_entry.c b/src/sdk/syscalls/rfu_dispatch_entry.c index 332ae76720..38684fa6ed 100644 --- a/src/sdk/syscalls/rfu_dispatch_entry.c +++ b/src/sdk/syscalls/rfu_dispatch_entry.c @@ -4,7 +4,7 @@ extern void RfuDispatchEntry(int status); extern void _Exit(int status); -void RfuDispatchEntry(int status) { +void RfuDispatchEntry(int exit_status) { JumpToRfuDispatch(); - _Exit(status); + _Exit(exit_status); } From 5f98b79beb3435a2f71178eb472e0f77c322d552 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:00:52 +0000 Subject: [PATCH 109/657] decomp: clarify names in SendIpuCommand state -> decoder_state: Prepared retail signature identifies a0 as MpegVideoDecoderState *pState. At 0x00128424 the command high nibble selects the table word loaded at 0x00128440, and 0x00128448 stores it at 0x818(a0). This matches state->command_result in the bound source and proves this parameter is the decoder state receiving the command class. --- src/sdk/ipu/send_ipu_command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/ipu/send_ipu_command.c b/src/sdk/ipu/send_ipu_command.c index 2a4ca78f62..79448aa3b8 100644 --- a/src/sdk/ipu/send_ipu_command.c +++ b/src/sdk/ipu/send_ipu_command.c @@ -8,13 +8,13 @@ typedef struct IpuCommandState { u32 SendIpuCommand(IpuCommandState *state, u32 command) __asm__("_sendIpuCommand"); -u32 SendIpuCommand(IpuCommandState *state, u32 command) { +u32 SendIpuCommand(IpuCommandState *decoder_state, u32 command) { volatile u32 *ipu_command = (volatile u32 *)0x10002000; u32 command_class; *ipu_command = command; command_class = IpuCommandTable[command >> 28]; - state->command_result = command_class; + decoder_state->command_result = command_class; return command_class; } From ffcaf17f29395deaee9b9bf973fe5efc383280c7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:04:03 +0000 Subject: [PATCH 110/657] decomp: clarify names in GetSysbitPointer state -> bitstream: sceMpegDemuxPssRing passes its bitstream as the first argument for both PES header and payload pointers. Retail 0x0012ab10 loads a0+8, adds the bit offset shifted right three at 0x0012ab14/1c, compares against a0+0x24 and subtracts a0+0x28 on wrap at 0x0012ab2c/30. These match state->bit_pointer, limit and wrap_base in the SHA-256-bound source and prove this parameter is the bitstream owner. --- src/sdk/system/get_sysbit_pointer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/system/get_sysbit_pointer.c b/src/sdk/system/get_sysbit_pointer.c index 4450690f53..ed4bd253cc 100644 --- a/src/sdk/system/get_sysbit_pointer.c +++ b/src/sdk/system/get_sysbit_pointer.c @@ -8,11 +8,11 @@ typedef struct SysbitState { u32 wrap_base; } SysbitState; -s32 GetSysbitPointer(SysbitState *state, s32 bit_offset) { - u32 bit_pointer = state->bit_pointer + (bit_offset >> 3); +s32 GetSysbitPointer(SysbitState *bitstream, s32 bit_offset) { + u32 bit_pointer = bitstream->bit_pointer + (bit_offset >> 3); - if (bit_pointer >= state->limit) { - bit_pointer -= state->wrap_base; + if (bit_pointer >= bitstream->limit) { + bit_pointer -= bitstream->wrap_base; } return bit_pointer; } From 107f3b460145ddd986e5d0e3a455e78af3080be2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:04:03 +0000 Subject: [PATCH 111/657] decomp: clarify names in FUN_L04_00292d48 flags -> gait_mask: In the authoritative leg_walker_update source, rig_pick_mode produces mode and rig_animate(moby, rig, mode, heading) passes it as this third parameter, bound to a2 in retail. At 0x00292dd0 a2 is saved to sp+0x54; 0x00292d4c/0x00292dd4 initialize the tested mask to 3. The AND at 0x00292e40-0x00292e4c chooses between relaxing upper/lower leg turns to zero and maintaining their twist. The same parameter AND at 0x00292fc8-0x00292fd4 gates multiplication of the lower manipulator quaternion by negative moby rot.x tilt. At 0x0029301c the test mask shifts left two bits for the second leg, proving a gait mask with per-leg bit pairs rather than unrelated generic flags. --- src/overlays/l04/mobys/leg_walker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l04/mobys/leg_walker.c b/src/overlays/l04/mobys/leg_walker.c index df067bc0c1..c049050040 100644 --- a/src/overlays/l04/mobys/leg_walker.c +++ b/src/overlays/l04/mobys/leg_walker.c @@ -290,7 +290,7 @@ int update_leg_rig_height_and_tilt(StMoby *moby, Steer *steer_state) { extern float rig_turn_2d48(float, float, float *, float, float, float) __asm__("FUN_L00_00258110"); -void FUN_L04_00292d48(struct Moby *moby, LegRig *rig, int flags) { +void FUN_L04_00292d48(struct Moby *moby, LegRig *rig, int gait_mask) { float joint[16]; float tilt[4]; float twist; @@ -354,7 +354,7 @@ void FUN_L04_00292d48(struct Moby *moby, LegRig *rig, int flags) { build_axis_rotation_quaternion(rig->legs[i].manip_b.rot, 2, rig->legs[i].upper_turn); if (rig->legs[i].manip_a.attached) { build_axis_rotation_quaternion(rig->legs[i].manip_a.rot, 2, rig->legs[i].lower_turn); - if (flags & mask) { + if (gait_mask & mask) { build_axis_rotation_quaternion(tilt, 0, -moby->rot.x); multiply_quaternions(rig->legs[i].manip_a.rot, rig->legs[i].manip_a.rot, tilt); } From ba72eafe7bab935db88400d9eb30595e74307dd9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:04:03 +0000 Subject: [PATCH 112/657] decomp: clarify names in hero_set_attack_ticks id -> attack_ticks: In hero_set_attack_ticks(int id), retail 0x00232644-0x00232658 compares a0 against -1 and replaces it with the return of the five-frame scaling call (source scale_game_frames(5)); 0x00232664 stores a0 to 0x0013fe08, source hero.queued_frame_request. The established function name and callers passing 2 during crouch swing and wrench return identify this scalar as attack ticks rather than an identifier. --- src/overlays/shared/hero/set_hero_animation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index aee3eba11c..203a0132f3 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -552,11 +552,11 @@ void clear_hero_queued_animation(void) { /* Stores id at &hero.queued_frame_request; -1 stands for 5 frames. */ void hero_set_attack_ticks(int id) __asm__("FUN_L00_00232640"); -void hero_set_attack_ticks(int id) { - if (id == -1) { - id = scale_game_frames(5); +void hero_set_attack_ticks(int attack_ticks) { + if (attack_ticks == -1) { + attack_ticks = scale_game_frames(5); } - hero.queued_frame_request = id; + hero.queued_frame_request = attack_ticks; } #include "rnc/sdk/eetypes.h" From d25d22a92b1248285a471ff192797182f2b4250c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:04:04 +0000 Subject: [PATCH 113/657] decomp: clarify names in process_hero_race_object_interactions state -> hoverboard_pvars: Authoritative source src/overlays/shared/hero/process_hero_primary_item_input.c SHA-256 ab71a97b0f2cbcc2a2cf46886315913087133ccd8ad9de9746cdb69d04de2093 initializes state with *(u8 **)(hero.hoverboard_moby + 0x78). Retail 0x00253b80 loads hero+0x86c (hoverboard_moby), and 0x00253b8c loads its +0x78 private-data pointer into s4, matching original decompilation iVar1. Loads at 0x00253b94, 0x00253d88 and 0x00253f24 read s4+0x44/+0x48/+0x4c as group IDs for get_first_moby_in_group. Supplied adjacent source uses ((struct Moby *)hero.hoverboard_moby)->pvars for the same owner, establishing hoverboard_pvars as the pointer role without claiming the whole layout. --- .../hero/process_hero_primary_item_input.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/hero/process_hero_primary_item_input.c b/src/overlays/shared/hero/process_hero_primary_item_input.c index 42f05313bd..293412c02e 100644 --- a/src/overlays/shared/hero/process_hero_primary_item_input.c +++ b/src/overlays/shared/hero/process_hero_primary_item_input.c @@ -1249,7 +1249,7 @@ extern s32 weapon_ammo_counts[37] __asm__("D_0013D428"); void process_hero_race_object_interactions(void) __asm__("FUN_L05_00253b48"); void process_hero_race_object_interactions(void) { - u8 *state; + u8 *hoverboard_pvars; u8 *moby; u8 *boost_trigger_moby; u8 *ground_boost_trigger_moby; @@ -1261,9 +1261,9 @@ void process_hero_race_object_interactions(void) { if (hero.hoverboard_moby == 0) return; - state = *(u8 **)(hero.hoverboard_moby + 0x78); - if (*(s32 *)(state + 0x44) != -1) { - get_first_moby_in_group((void **)&boost_trigger_moby, *(s32 *)(state + 0x44), 0, 0); + hoverboard_pvars = *(u8 **)(hero.hoverboard_moby + 0x78); + if (*(s32 *)(hoverboard_pvars + 0x44) != -1) { + get_first_moby_in_group((void **)&boost_trigger_moby, *(s32 *)(hoverboard_pvars + 0x44), 0, 0); if (boost_trigger_moby != 0) { do { if (*(s16 *)(boost_trigger_moby + 0xA6) == 0x473 && @@ -1294,10 +1294,10 @@ void process_hero_race_object_interactions(void) { blue = truncate_float_to_s32(wave * 24.0f) + 0x3C; if (green > 0xFF) green = 0xFF; - if (*(s32 *)(state + 0x48) != -1) { + if (*(s32 *)(hoverboard_pvars + 0x48) != -1) { if (hero.hoverboard_airborne == 0) { get_first_moby_in_group( - (void **)&ground_boost_trigger_moby, *(s32 *)(state + 0x48), 0, 0); + (void **)&ground_boost_trigger_moby, *(s32 *)(hoverboard_pvars + 0x48), 0, 0); if (ground_boost_trigger_moby != 0) { u32 color = (blue << 16) | (0x80000000U | (green << 8)) | red; do { @@ -1326,8 +1326,8 @@ void process_hero_race_object_interactions(void) { } } } - if (*(s32 *)(state + 0x4C) != -1) { - get_first_moby_in_group((void **)&third, *(s32 *)(state + 0x4C), 0, 0); + if (*(s32 *)(hoverboard_pvars + 0x4C) != -1) { + get_first_moby_in_group((void **)&third, *(s32 *)(hoverboard_pvars + 0x4C), 0, 0); while (third != 0) { if (*(s16 *)(third + 0xA6) == 0x1D6 && fast_subtract_rotations_cf(third + 0xBC) != 0 && fast_vec_dist(&hero.motion.body_center, third + 0x10) < 1.5f) { From 1a0025fe6f6fa18f81c0c856f8a60125fb371d78 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:04:04 +0000 Subject: [PATCH 114/657] decomp: clarify names in matches_first_moby_in_group id -> moby_address: In the SHA-256-bound source, id is the int input compared with current after get_first_moby_in_group(¤t). Retail 0x00281f00 saves incoming a0 in s0; 0x00281f08/0x00281f0c pass sp as the lookup output, 0x00281f10 loads that output, and 0x00281f18..0x00281f20 compare it with saved a0 using xor/sltiu. The prepared original helper evidence at 0x00281cfc..0x00281d24 derives that output as moby base 0x0015ffd8 plus (group entry & 0x7fff) * 0x100. Thus the input is the moby address to compare, also consistent with water_update passing water_moby. --- src/overlays/l07/mobys/matches_first_moby_in_group.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l07/mobys/matches_first_moby_in_group.c b/src/overlays/l07/mobys/matches_first_moby_in_group.c index c1f3999bbf..ceb7a59c9a 100644 --- a/src/overlays/l07/mobys/matches_first_moby_in_group.c +++ b/src/overlays/l07/mobys/matches_first_moby_in_group.c @@ -10,8 +10,8 @@ extern void get_first_moby_in_group(int *) __asm__("FUN_L00_002591d0"); /* Returns whether the current id equals id. */ int matches_first_moby_in_group(int id) __asm__("FUN_L07_00281ef8"); -int matches_first_moby_in_group(int id) { +int matches_first_moby_in_group(int moby_address) { int current; get_first_moby_in_group(¤t); - return current == id; + return current == moby_address; } From 19c91dbb9b90c8d30080794bb0b6e740068bd621 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:04:04 +0000 Subject: [PATCH 115/657] decomp: clarify names in find_or_allocate_moby_render_slot id -> resident_object: In the owned source id is compared with moby_render_slots[i] and stored into that slot before returning i. Retail 0x0020cc28 loads an entry from the 16-slot table at 0x001b2bc0; 0x0020cc34 compares it with argument a0, and 0x0020cc30/0x0020cc3c store a0 into the selected entry. The supplied original Ghidra signature register_pending_object(ResidentObjectState *state) and decompilation identify this unchanged argument as the resident object being registered, distinct from the returned slot index. --- src/mobys/find_or_allocate_moby_render_slot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mobys/find_or_allocate_moby_render_slot.c b/src/mobys/find_or_allocate_moby_render_slot.c index de342588ae..9dd1a97f70 100644 --- a/src/mobys/find_or_allocate_moby_render_slot.c +++ b/src/mobys/find_or_allocate_moby_render_slot.c @@ -4,12 +4,12 @@ s32 find_or_allocate_moby_render_slot(s32 id) __asm__("FUN_0020cc18"); -s32 find_or_allocate_moby_render_slot(s32 id) { +s32 find_or_allocate_moby_render_slot(s32 resident_object) { s32 i; for (i = 0; i < 16; i++) { - if (moby_render_slots[i] == 0 || moby_render_slots[i] == id) { - moby_render_slots[i] = id; + if (moby_render_slots[i] == 0 || moby_render_slots[i] == resident_object) { + moby_render_slots[i] = resident_object; return i; } } From 47ab6971d059b9b82d665f411118a7a5f3ce32da Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:04:04 +0000 Subject: [PATCH 116/657] decomp: clarify names in clear_follow_camera_volume_if_current id -> volume_camera_record: Retail 0x002e83a4 loads the selected-volume slot at state+0x220, 0x002e83a8 compares it directly to a0, and 0x002e83ac clears it only on equality. Original Ghidra expresses the same comparison with param_1. Supplied volume_camera_swing and volume_camera_aim stop paths pass their struct UpdateCam * swing_camera_record/aim_camera_record to this function; neighboring try_select_follow_camera_volume stores the candidate camera object in the same +0x220 slot. Thus the s32 argument is the volume camera record identity to clear, not a numeric descriptor index. --- src/overlays/shared/camera/follow_camera_set_distance.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_set_distance.c b/src/overlays/shared/camera/follow_camera_set_distance.c index a712a58319..a244a07c99 100644 --- a/src/overlays/shared/camera/follow_camera_set_distance.c +++ b/src/overlays/shared/camera/follow_camera_set_distance.c @@ -63,12 +63,12 @@ void run_follow_camera_noop(void) { /* -1 while D_L00_00166E00+0x86 is set; else clears its current id, 1 if it was id. */ s32 clear_follow_camera_volume_if_current(s32 id) __asm__("FUN_L00_002e8388"); -s32 clear_follow_camera_volume_if_current(s32 id) { +s32 clear_follow_camera_volume_if_current(s32 volume_camera_record) { struct P1_388 *current_camera = (struct P1_388 *)current_follow_cam; if (current_camera->f86 != 0) { return -1; } - if (current_camera->p->cur == id) { + if (current_camera->p->cur == volume_camera_record) { current_camera->p->cur = 0; return 1; } From 5f67806689718a55c73840cc440e9b5761aa82f4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:06:14 +0000 Subject: [PATCH 117/657] decomp: clarify names in pause_stage_sprite_lists mode -> sprite_list_source_base: In the authoritative C snapshot (SHA-256 5bdc0797a2930cd89fab62fbd82d2533223e94e2d8fff653ea812e94e760d62c), the u32 * parameter is used only to initialize sprite_list_source = mode + 12. Original retail Ghidra likewise derives puVar3 from param_1 + 0x30. At 0x0021ca64 a0 is advanced by 0x30, then lw at 0x0021ca70 reads the source and 0x0021ca78 advances it by four; sw at 0x0021ca7c writes each word to D_00141EA0/pause_iop_sprite_lists. The counter initialized to 7 and bgez at 0x0021ca84 prove eight copied words. Thus this parameter is the base containing the source sprite-list region, rather than a scalar mode selector. --- src/ui/menus/pause/pause_stage_sprite_lists.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/menus/pause/pause_stage_sprite_lists.c b/src/ui/menus/pause/pause_stage_sprite_lists.c index 6eb24dbdd5..6fad71fbf3 100644 --- a/src/ui/menus/pause/pause_stage_sprite_lists.c +++ b/src/ui/menus/pause/pause_stage_sprite_lists.c @@ -3,8 +3,8 @@ int pause_stage_sprite_lists(u32 *mode) __asm__("FUN_0021ca60"); -int pause_stage_sprite_lists(u32 *mode) { - u32 *sprite_list_source = mode + 12; +int pause_stage_sprite_lists(u32 *sprite_list_source_base) { + u32 *sprite_list_source = sprite_list_source_base + 12; u32 *iop_sprite_list_destination = pause_iop_sprite_lists; int count = 7; From 6ff245db9892b80a43718150746101c073a42de1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:06:14 +0000 Subject: [PATCH 118/657] decomp: clarify names in find_id_in_terminated_table id -> level_index: In authoritative src/world/data/find_id_in_terminated_table.c (SHA-256 0b359d43711a44724cd303538ddf5becff3f69f95abaa795df5952b2a14ef4ba), id is compared directly with menu_level_indices[i]. Retail 0x00205224 loads the table pointer, 0x00205238 loads its s32 entry, and 0x00205240 compares that entry with incoming a0. Equality returns the table position a2 at 0x00205248-0x0020524c; zero termination and the 20-entry bound end failure with -1. Thus this parameter is the sought level index stored in the menu table, distinct from the returned table position. --- src/world/data/find_id_in_terminated_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/world/data/find_id_in_terminated_table.c b/src/world/data/find_id_in_terminated_table.c index 14044da005..855125ac66 100644 --- a/src/world/data/find_id_in_terminated_table.c +++ b/src/world/data/find_id_in_terminated_table.c @@ -4,11 +4,11 @@ s32 find_id_in_terminated_table(s32 id) __asm__("FUN_00205220"); -s32 find_id_in_terminated_table(s32 id) { +s32 find_id_in_terminated_table(s32 level_index) { s32 i; for (i = 0; menu_level_indices[i] != 0 && i < 20; i++) { - if (menu_level_indices[i] == id) { + if (menu_level_indices[i] == level_index) { return i; } } From 9252aa30e8f77ed1d6855c01c7741b689fcaa341 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:06:14 +0000 Subject: [PATCH 119/657] decomp: clarify names in test_hydrodisplacer_activation_flag flags -> hydro_tank_full: Source assigns the u8 flags from (u8)activation_hero->hydro_tank_full. Retail 0x002e02e0/0x002e02ec forms hero at 0x0013F350; 0x002e02f4 loads its +0x20B0 byte into a1. The branch at 0x002e0304 tests that byte for zero, selecting linked Moby command +0xBC mask 2 at 0x002e0310 or mask 1 at 0x002e0328. Original Ghidra cRam00141400 controls precisely these two paths, proving this local is the hydro tank fullness snapshot. --- src/overlays/shared/props/hydrodisplacer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/props/hydrodisplacer.c b/src/overlays/shared/props/hydrodisplacer.c index 1539835f9c..0c3e3ef39c 100644 --- a/src/overlays/shared/props/hydrodisplacer.c +++ b/src/overlays/shared/props/hydrodisplacer.c @@ -362,13 +362,13 @@ s32 test_hydrodisplacer_activation_flag(void) { u8 *linked_moby; s32 ground_moby_address; s32 idx; - u8 flags; + u8 hydro_tank_full; activation_hero = &hero; linked_moby = moby_table; ground_moby_address = ((s32)activation_hero->ground_moby); - flags = (u8)activation_hero->hydro_tank_full; + hydro_tank_full = (u8)activation_hero->hydro_tank_full; linked_moby += *(s32 *)*(s32 *)((u8 *)ground_moby_address + 0x78) << 8; - if (!flags) { + if (!hydro_tank_full) { if (MOBY(linked_moby)->command & 2) return 1; } else { From 9880854d5a0e94fcea238dc087d32ad840312610 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:08:15 +0000 Subject: [PATCH 120/657] decomp: clarify names in find_moby_in_owner_list_by_id id -> target_moby_data_id: Retail 0x003195C0-0x003195CC extracts each owner-list entry's low 15 bits and scales by 0x100 to select a candidate moby. At 0x003195D0 its data pointer is loaded from +0x78; 0x003195D4 loads the signed short at data +0xB4, and 0x003195D8 compares it with a1, the source id parameter (original Ghidra param_2). Equality returns that candidate at 0x003195F4. Thus this parameter is the target moby-data ID used for matching. --- src/overlays/shared/vehicles/taxi_path.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/vehicles/taxi_path.c b/src/overlays/shared/vehicles/taxi_path.c index 0415c728a0..213ce3fe5f 100644 --- a/src/overlays/shared/vehicles/taxi_path.c +++ b/src/overlays/shared/vehicles/taxi_path.c @@ -74,7 +74,7 @@ void reset_selected_moby_to_current_placement(void *moby_v) { char *find_moby_in_owner_list_by_id(unsigned char *list_owner_moby, int id) __asm__("FUN_L05_00319598"); -char *find_moby_in_owner_list_by_id(unsigned char *list_owner_moby, int id) { +char *find_moby_in_owner_list_by_id(unsigned char *list_owner_moby, int target_moby_data_id) { unsigned short *moby_index_entry = D_L05_001ABCC0_9598[MOBY(list_owner_moby)->group]; char *pool; int candidate_moby_pool_index; @@ -82,7 +82,7 @@ char *find_moby_in_owner_list_by_id(unsigned char *list_owner_moby, int id) { pool = D_L05_0015FFD8_9598; do { candidate_moby_pool_index = *moby_index_entry & 0x7FFF; - if (*(short *)(((M_9598 *)pool)[candidate_moby_pool_index].data + 0xB4) == id) + if (*(short *)(((M_9598 *)pool)[candidate_moby_pool_index].data + 0xB4) == target_moby_data_id) goto found; } while ((short)*moby_index_entry++ >= 0); } From 3e78aba58b865b9078e7b488e14ae98a0a57e423 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:08:15 +0000 Subject: [PATCH 121/657] decomp: clarify names in jet_group_flag id -> moby_class_id: Retail 0x0026518c loads the signed class halfword at moby +0xA6 and 0x00265190 compares it with a0 (id). The authoritative C expresses this as MOBY(moby)->oclass == id while scanning 0x100-byte moby slots; fighter_jet_update passes class constant 0x102. --- src/overlays/l13/mobys/fighter_jet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l13/mobys/fighter_jet.c b/src/overlays/l13/mobys/fighter_jet.c index 4b49c14d0b..87ad7827a8 100644 --- a/src/overlays/l13/mobys/fighter_jet.c +++ b/src/overlays/l13/mobys/fighter_jet.c @@ -129,11 +129,11 @@ extern char *l13_moby_scan_inclusive_end __asm__("D_L13_0015FFE0"); void jet_group_flag(int id, int state) __asm__("FUN_L13_00265170"); -void jet_group_flag(int id, int state) { +void jet_group_flag(int moby_class_id, int state) { char *moby = (char *)moby_base; if ((unsigned long)l13_moby_scan_inclusive_end >= (unsigned long)moby) { do { - if (MOBY(moby)->oclass == id) { + if (MOBY(moby)->oclass == moby_class_id) { if (moby[0x20] >= 0) moby[0x20] = state; } From d7bd97d5ed1dea109f6b74f2b7dcf6a2729c2169 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:08:15 +0000 Subject: [PATCH 122/657] decomp: clarify names in snd_play_vag_stream_by_loc_ex_cb id -> callback_address: In the bound source id is the fourth argument to snd_send_iop_command_no_wait(0x2C, 0x1C, playback_request_payload, id, cb_data). Retail 0x0012ec38 loads the tenth incoming argument from sp+0x38 into a3 before jal 0x0012e6e0 at 0x0012ec58. Original Ghidra names this argument dwCallbackAddress. Supplied transport source stores its corresponding cb argument in snd_stream_buffers[snd_batch_index][*snd_batch_command_buffers[snd_batch_index]].func, while cb_data goes to .data, proving callback_address rather than a playback identifier. --- src/audio/streaming/vag/snd_play_vag_stream_by_loc_ex_cb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/streaming/vag/snd_play_vag_stream_by_loc_ex_cb.c b/src/audio/streaming/vag/snd_play_vag_stream_by_loc_ex_cb.c index 8b4fc95431..34d92761c3 100644 --- a/src/audio/streaming/vag/snd_play_vag_stream_by_loc_ex_cb.c +++ b/src/audio/streaming/vag/snd_play_vag_stream_by_loc_ex_cb.c @@ -28,7 +28,7 @@ void snd_play_vag_stream_by_loc_ex_cb(s32 loc, s32 voice, s32 channel, s32 request_word_6, - s32 id, + s32 callback_address, u64 cb_data) { int new_var; @@ -41,7 +41,7 @@ void snd_play_vag_stream_by_loc_ex_cb(s32 loc, playback_request_payload[4] = voice; playback_request_payload[5] = channel; playback_request_payload[6] = request_word_6; - snd_send_iop_command_no_wait(0x2C, 0x1C, playback_request_payload, id, cb_data); + snd_send_iop_command_no_wait(0x2C, 0x1C, playback_request_payload, callback_address, cb_data); } extern __typeof__(snd_play_vag_stream_by_loc_ex_cb) func_0012EC08 From 2e9233b7a3943001b47792014f4d01dc23e3e248 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:08:15 +0000 Subject: [PATCH 123/657] decomp: clarify names in find_group_moby_by_data_id id -> requested_data_id: Retail 0x002e4c18 loads the indexed moby's data pointer at +0x78, 0x002e4c1c reads its signed short at +0xAC, and 0x002e4c20 compares that short with the second argument in a1. Equality returns that moby's pool address at 0x002e4c38-0x002e4c3c. The current C performs this comparison against id; callers taxi_update and transfer_moby_placement_to_linked_moby supply the source taxi's +0xAE short as the requested key. --- src/overlays/l16/mobys/taxi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l16/mobys/taxi.c b/src/overlays/l16/mobys/taxi.c index aff03c24a1..c6ba1778ec 100644 --- a/src/overlays/l16/mobys/taxi.c +++ b/src/overlays/l16/mobys/taxi.c @@ -364,7 +364,7 @@ extern char *D_L16_0015FFD8_gp __asm__("D_L16_0015FFD8") __attribute__((sda)); char *find_group_moby_by_data_id(struct Moby *group_source_moby, int id) __asm__("FUN_L16_002e4be0"); -char *find_group_moby_by_data_id(struct Moby *group_source_moby, int id) { +char *find_group_moby_by_data_id(struct Moby *group_source_moby, int requested_data_id) { unsigned short *moby_index_entry = D_L16_001ABCC0_4be0[group_source_moby->group]; char *pool; int moby_pool_index; @@ -372,7 +372,7 @@ char *find_group_moby_by_data_id(struct Moby *group_source_moby, int id) { pool = D_L16_0015FFD8_gp; do { moby_pool_index = *moby_index_entry & 0x7FFF; - if (*(short *)(((M_4be0 *)pool)[moby_pool_index].data + 0xAC) == id) { + if (*(short *)(((M_4be0 *)pool)[moby_pool_index].data + 0xAC) == requested_data_id) { goto found; } } while ((short)*moby_index_entry++ >= 0); From ca349a32753d13b5154fefb1f2802e50fe00bbca Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:10:17 +0000 Subject: [PATCH 124/657] decomp: clarify names in disable_dmac status -> saved_interrupt_enable_bit: Retail 0x0011910c reads COP0 Status into s0; 0x00119110-0x00119114 masks it with 0x10000. The saved s0 is tested at 0x00119118 to conditionally call DIntr and again at 0x00119138 to conditionally call EnableInterrupts after _DisableDmac and SYNC. Original Ghidra uVar2 has identical flow. Thus source u32 status preserves the prior interrupt-enable bit across the helper call. --- src/sdk/kernel/disable_dmac.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/kernel/disable_dmac.c b/src/sdk/kernel/disable_dmac.c index 01e0a22b8f..1316d5fe05 100644 --- a/src/sdk/kernel/disable_dmac.c +++ b/src/sdk/kernel/disable_dmac.c @@ -11,17 +11,17 @@ s32 disable_dmac(s32 channel_index) { enum { EE_INTERRUPT_ENABLE_CLEAR = 0 }; - u32 status; + u32 saved_interrupt_enable_bit; s32 dmac_disable_result; - status = CpuReadStatus(); - status &= 0x10000; - if (status != EE_INTERRUPT_ENABLE_CLEAR) { + saved_interrupt_enable_bit = CpuReadStatus(); + saved_interrupt_enable_bit &= 0x10000; + if (saved_interrupt_enable_bit != EE_INTERRUPT_ENABLE_CLEAR) { DIntr(); } dmac_disable_result = _DisableDmac(channel_index); CpuSync(); - if (status != EE_INTERRUPT_ENABLE_CLEAR) { + if (saved_interrupt_enable_bit != EE_INTERRUPT_ENABLE_CLEAR) { EnableInterrupts(); } return dmac_disable_result; From c75788e557272c0bf60e8be97942efc051f8e61e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:10:17 +0000 Subject: [PATCH 125/657] decomp: clarify names in enable_intc status -> saved_interrupt_enable_bit: In authoritative src/sdk/kernel/enable_intc.c (SHA-256 ccdf37fde713bb3a67a36fdc560ccadb2f53714000b23e8f6d4aba2c33251c18), u32 status receives CpuReadStatus() and is masked with 0x10000. Retail 0x001190a4 reads COP0 Status into s0; 0x001190ac retains bit 16. The same saved s0 is tested at 0x001190b0 to gate DIntr and at 0x001190d0 to gate EnableInterrupts after _EnableIntc and SYNC. Original Ghidra uVar2 = Status & 0x10000 and its two conditional uses corroborate that this local retains the saved interrupt-enable bit, rather than the full status register. --- src/sdk/kernel/enable_intc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/kernel/enable_intc.c b/src/sdk/kernel/enable_intc.c index ef1e7968ec..e66281c604 100644 --- a/src/sdk/kernel/enable_intc.c +++ b/src/sdk/kernel/enable_intc.c @@ -11,17 +11,17 @@ s32 enable_intc(s32 cause_index) { enum { EE_INTERRUPT_ENABLE_BIT_CLEAR = 0 }; - u32 status; + u32 saved_interrupt_enable_bit; s32 intc_enable_result; - status = CpuReadStatus(); - status &= 0x10000; - if (status != EE_INTERRUPT_ENABLE_BIT_CLEAR) { + saved_interrupt_enable_bit = CpuReadStatus(); + saved_interrupt_enable_bit &= 0x10000; + if (saved_interrupt_enable_bit != EE_INTERRUPT_ENABLE_BIT_CLEAR) { DIntr(); } intc_enable_result = _EnableIntc(cause_index); CpuSync(); - if (status != EE_INTERRUPT_ENABLE_BIT_CLEAR) { + if (saved_interrupt_enable_bit != EE_INTERRUPT_ENABLE_BIT_CLEAR) { EnableInterrupts(); } return intc_enable_result; From 1e6408c697bbce4443208de57cf78731ba7fbaff Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:10:17 +0000 Subject: [PATCH 126/657] decomp: clarify names in enable_dmac status -> saved_interrupt_enable_bit: Retail 0x00119174 reads COP0 Status into s0; 0x00119178-0x0011917c mask it with 0x10000. The saved masked bit is tested at 0x00119180 to conditionally call DIntr and again at 0x001191a0 to conditionally call EnableInterrupts after _EnableDmac and SYNC. Original Ghidra uVar2 and source status follow this same flow, proving a saved caller interrupt-enable bit rather than full processor status. --- src/sdk/kernel/enable_dmac.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/kernel/enable_dmac.c b/src/sdk/kernel/enable_dmac.c index e77405bda9..84b667aa66 100644 --- a/src/sdk/kernel/enable_dmac.c +++ b/src/sdk/kernel/enable_dmac.c @@ -11,17 +11,17 @@ s32 enable_dmac(s32 channel_index) { enum { INTERRUPT_ENABLE_BIT_CLEAR = 0 }; - u32 status; + u32 saved_interrupt_enable_bit; s32 dmac_enable_result; - status = CpuReadStatus(); - status &= 0x10000; - if (status != INTERRUPT_ENABLE_BIT_CLEAR) { + saved_interrupt_enable_bit = CpuReadStatus(); + saved_interrupt_enable_bit &= 0x10000; + if (saved_interrupt_enable_bit != INTERRUPT_ENABLE_BIT_CLEAR) { DIntr(); } dmac_enable_result = _EnableDmac(channel_index); CpuSync(); - if (status != INTERRUPT_ENABLE_BIT_CLEAR) { + if (saved_interrupt_enable_bit != INTERRUPT_ENABLE_BIT_CLEAR) { EnableInterrupts(); } return dmac_enable_result; From d16f746e6e7611f402816a1fdcfc438e8e21eb2b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:12:18 +0000 Subject: [PATCH 127/657] decomp: clarify names in sceCdSyncS mode -> nonblocking: In sceCdSyncS, retail 0x00120cd8 branches on nonzero a0 to 0x00120d20, whose call at 0x00120d24 checks the S-command RPC client at 0x00132d08 once and returns its status. Zero instead polls at 0x00120d08 and loops through the 0x3c delay at 0x00120d00 while busy (0x00120d10), returning zero when idle. The source mode == CD_SYNC_S_WAIT (0) implements exactly this distinction; supplied callers pass 1 to test busy without waiting. --- src/sdk/storage/cdvd/sceCdSyncS.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/storage/cdvd/sceCdSyncS.c b/src/sdk/storage/cdvd/sceCdSyncS.c index 7bedc92589..a0aae0e285 100644 --- a/src/sdk/storage/cdvd/sceCdSyncS.c +++ b/src/sdk/storage/cdvd/sceCdSyncS.c @@ -7,11 +7,11 @@ const char cd_s_command_wait_message[] __asm__("D_00152F00") = "S cmd wait\n"; -s32 sceCdSyncS(s32 mode) { +s32 sceCdSyncS(s32 nonblocking) { enum { CD_SYNC_S_WAIT = 0 }; - if (mode == CD_SYNC_S_WAIT) { + if (nonblocking == CD_SYNC_S_WAIT) { if (cd_debug > 0) { scePrintf(cd_s_command_wait_message); } From 1ca27b4540f2a20247c53bd0251dee5e2bbede1f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:12:18 +0000 Subject: [PATCH 128/657] decomp: clarify names in find_help_entry id -> lookup_key: In the SHA-256-bound src/ui/help/find_help_entry.c snapshot, the s16 id is compared with message_id_code_table[i][which] across 150 rows. Retail 0x001feccc/0x001fecd4 sign-extend a0; 0x001fecd8/0x001fece0 select the column; 0x001fece8 loads its signed halfword and 0x001fecec compares it with a0. A match returns the row index at 0x001fed08/0x001fed0c, proving this parameter is the lookup key. --- src/ui/help/find_help_entry.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/help/find_help_entry.c b/src/ui/help/find_help_entry.c index 5a89f7742c..eeb5574f12 100644 --- a/src/ui/help/find_help_entry.c +++ b/src/ui/help/find_help_entry.c @@ -3,11 +3,11 @@ s32 find_help_entry(s16 id, s32 which, u16 *other) __asm__("FUN_001fecc8"); -s32 find_help_entry(s16 id, s32 which, u16 *paired_column_output) { +s32 find_help_entry(s16 lookup_key, s32 which, u16 *paired_column_output) { s32 i; for (i = 0; i < 150; i++) { - if (message_id_code_table[i][which] == id) { + if (message_id_code_table[i][which] == lookup_key) { if (paired_column_output != 0) { *paired_column_output = message_id_code_table[i][which ? 0 : 1]; } From 312572e926684f0c250cd118ca80861ba213bcf0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:12:18 +0000 Subject: [PATCH 129/657] decomp: clarify names in run_state_handler state -> state_before_handler: Retail 0x00208854 loads the active state into preserved s0; 0x0020885c-0x00208868 uses it to index and call the handler table at 0x001A0438. At 0x0020887c the state global is reloaded and 0x00208884 compares it with s0, resetting the counter at 0x00208890 on change. Source likewise snapshots mode_freeze_state before save_card_state_handlers[state]() and compares it afterward, proving state_before_handler. --- src/ui/menus/save_data/run_state_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/menus/save_data/run_state_handler.c b/src/ui/menus/save_data/run_state_handler.c index 95971d7a00..e034c91457 100644 --- a/src/ui/menus/save_data/run_state_handler.c +++ b/src/ui/menus/save_data/run_state_handler.c @@ -10,7 +10,7 @@ void run_state_handler(void) __asm__("FUN_00208840"); void run_state_handler(void) { s32 state = save_card_state; - save_card_state_handlers[state](); + save_card_state_handlers[state_before_handler](); D_00161280++; if (save_card_state != state) { D_00161280 = 0; From 89f4c72b8d65e7ac938cc9f68b82d22438edf130 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:12:18 +0000 Subject: [PATCH 130/657] decomp: clarify names in test_sharkigator_target_sphere_collision id -> target_moby: Retail 0x0030f4e0 saves the second integer argument a1 in s1; after the sphere query at 0x0030f508 succeeds, 0x0030f518 loads the collision-result reference at 0x00173ed8 and 0x0030f51c compares it with s1. The authoritative C caller sharkigator_update passes target.moby as this argument with radius 1.5f, proving it denotes the requested target moby rather than a numeric identifier. --- src/overlays/l07/mobys/sharkigator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l07/mobys/sharkigator.c b/src/overlays/l07/mobys/sharkigator.c index 76ed82c4c5..88d3c74d2f 100644 --- a/src/overlays/l07/mobys/sharkigator.c +++ b/src/overlays/l07/mobys/sharkigator.c @@ -725,10 +725,10 @@ void handle_sharkigator_contact_attack(struct Moby *moby, moby->state = state_after_target_hit; } -int test_sharkigator_target_sphere_collision(void *moby, int id, float scale) { +int test_sharkigator_target_sphere_collision(void *moby, int target_moby, float scale) { char collision_center[16]; moby_point_position(moby, 0, collision_center); - if (coll_sphere(scale, collision_center, 0x21, moby) && D_L07_00173ED8 == id) { + if (coll_sphere(scale, collision_center, 0x21, moby) && D_L07_00173ED8 == target_moby) { return 1; } return 0; From e9cd06dcb652992c06eed38e5b950127b409ff3c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:12:18 +0000 Subject: [PATCH 131/657] decomp: clarify names in ParseSystemHeader state -> bitstream_context: At 0x0012b128 the incoming a0 is preserved in s0, then restored into a0 for _sysbitGet at 0x0012b134 and 0x0012b14c (40- and 24-bit consumption) and the one-bit peek at 0x0012b158; the first _sysbitGet consumes 56 bits at 0x0012b124. Original Ghidra likewise forwards param_1 unchanged to all reads. Supplied _pack_header calls _system_header(bitstream_context, pack_header_info) after checking the 0x1BB start code with that same bitstream_context. Supplied _sysbitGet forwards its first argument to _sysbitFlush. Together these prove this void * parameter is the bitstream context. --- src/sdk/mpeg/demux/system_header.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/mpeg/demux/system_header.c b/src/sdk/mpeg/demux/system_header.c index 9f7a056840..3b4b921ae7 100644 --- a/src/sdk/mpeg/demux/system_header.c +++ b/src/sdk/mpeg/demux/system_header.c @@ -4,11 +4,11 @@ s32 ParseSystemHeader(void *state) __asm__("_system_header"); -s32 ParseSystemHeader(void *state) { - _sysbitGet(state, 0x38); - _sysbitGet(state, 0x28); - while (peek_bits(state, 1) == 1) { - _sysbitGet(state, 0x18); +s32 ParseSystemHeader(void *bitstream_context) { + _sysbitGet(bitstream_context, 0x38); + _sysbitGet(bitstream_context, 0x28); + while (peek_bits(bitstream_context, 1) == 1) { + _sysbitGet(bitstream_context, 0x18); } return 1; } From 9a756c3d3b6eff94c7299ac5250f9b4a9d7b8ffb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:12:18 +0000 Subject: [PATCH 132/657] decomp: clarify names in SyncDCache status -> saved_interrupt_enable_bit: Retail 0x00118fa4 reads COP0 Status into s0; 0x00118fa8 loads 0x10000 and 0x00118fac masks s0 to bit 16. The preserved s0 feeds zero branches at 0x00118fb0 and 0x00118fd4, respectively gating DIntr at 0x00118fb8 and EnableInterrupts at 0x00118fe8. Source status = CpuReadStatus(); status &= 0x10000; and both comparisons prove that this local retains the caller's interrupt-enable bit across _sceSDC. --- src/sdk/kernel/SyncDCache.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/kernel/SyncDCache.c b/src/sdk/kernel/SyncDCache.c index 7a9ffad31a..55b3c7c090 100644 --- a/src/sdk/kernel/SyncDCache.c +++ b/src/sdk/kernel/SyncDCache.c @@ -11,15 +11,15 @@ void SyncDCache(s32 range_start_address, s32 range_end_address) { enum { INTERRUPT_ENABLE_BIT_CLEAR = 0 }; - u32 status; + u32 saved_interrupt_enable_bit; - status = CpuReadStatus(); - status &= 0x10000; - if (status != INTERRUPT_ENABLE_BIT_CLEAR) { + saved_interrupt_enable_bit = CpuReadStatus(); + saved_interrupt_enable_bit &= 0x10000; + if (saved_interrupt_enable_bit != INTERRUPT_ENABLE_BIT_CLEAR) { DIntr(); } _sceSDC(range_start_address & 0xFFFFFFC0, range_end_address & 0xFFFFFFC0); - if (status != INTERRUPT_ENABLE_BIT_CLEAR) { + if (saved_interrupt_enable_bit != INTERRUPT_ENABLE_BIT_CLEAR) { EnableInterrupts(); } } From 986cc5f5c4bff219e39fec4accdc12ffb55cb495 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:12:18 +0000 Subject: [PATCH 133/657] decomp: clarify names in probe_ground_height flags -> collision_mask: In source src/world/collision/probe_ground_height.c (SHA-256 319f6194572128806c276574dc14fc5e24b4a9c52d29bda60c2abffc9161c04b), s32 flags is used only as collision_line(raised_point, low_point, flags | 2, 0, 0). Retail 0x0021353c ORs incoming a1 with 0x2 into a2, the third argument to the collision segment call at 0x00213550 (0x001efa68). Original Ghidra renders the same flow as cast_collision_segment(..., mask | 2, 0, 0), proving its collision-mask role. --- src/world/collision/probe_ground_height.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/world/collision/probe_ground_height.c b/src/world/collision/probe_ground_height.c index 423420322e..986b939898 100644 --- a/src/world/collision/probe_ground_height.c +++ b/src/world/collision/probe_ground_height.c @@ -8,7 +8,7 @@ extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68" extern char D_00194120[]; f32 probe_ground_height(void *pos, s32 flags, f32 height_offset) __asm__("FUN_00213508"); -f32 probe_ground_height(void *probe_position, s32 flags, f32 height_offset) { +f32 probe_ground_height(void *probe_position, s32 collision_mask, f32 height_offset) { f32 low_point[4]; f32 raised_point[4]; @@ -16,7 +16,7 @@ f32 probe_ground_height(void *probe_position, s32 flags, f32 height_offset) { low_point[2] = 0.01f; qcopy(raised_point, probe_position); raised_point[2] = raised_point[2] + height_offset; - if (collision_line(raised_point, low_point, flags | 2, 0, 0) != 0) { + if (collision_line(raised_point, low_point, collision_mask | 2, 0, 0) != 0) { return *(f32 *)(D_00194120 + 8); } return 0.0f; From bcfe47f15a2fbee3c32486187ac5fee554e7d9fc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:14:06 +0000 Subject: [PATCH 134/657] decomp: clarify names in rumble_by_distance state -> rumble_state: In the SHA-256-bound source rumble_by_distance, state = debris_far_point - 0x140. Retail 0x00312124 computes that same base (0x00166d00); 0x00312138 stores duration 0x14 at base+0x168 (0x00166e68), and 0x00312140 stores ((80-distance)/80)*0.1 at base+0x160 (0x00166e60). The supplied retail decompilation confirms those two writes, supporting a rumble-state pointer rather than unspecified state. --- src/overlays/l07/mobys/snagglebeast_effects.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l07/mobys/snagglebeast_effects.c b/src/overlays/l07/mobys/snagglebeast_effects.c index 05de038257..06bab44eb3 100644 --- a/src/overlays/l07/mobys/snagglebeast_effects.c +++ b/src/overlays/l07/mobys/snagglebeast_effects.c @@ -151,12 +151,12 @@ void configure_timed_point_light(float radius, void rumble_by_distance(char *moby) { float distance = fast_vec_dist(moby + 0x10, debris_far_point); - char *state; + char *rumble_state; if (distance > 80.0f) distance = 80.0f; - state = debris_far_point - 0x140; - *(int *)(state + 0x168) = 0x14; - *(float *)(state + 0x160) = ((80.0f - distance) / 80.0f) * 0.1f; + rumble_state = debris_far_point - 0x140; + *(int *)(rumble_state + 0x168) = 0x14; + *(float *)(rumble_state + 0x160) = ((80.0f - distance) / 80.0f) * 0.1f; } void update_timed_point_light_color(char *light_effect_state) { From 32c631ac02a03fd7f19d7abce0cd16ea29adcb70 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:15:49 +0000 Subject: [PATCH 135/657] decomp: clarify names in handle_sif_rpc_call state -> unused_rpc_state: The authoritative C declares void *state but never references it. Original Ghidra declares the same second parameter SifRpcState *state. Retail entry 0x0011b138 immediately overwrites incoming a1 with lw a1,0x34(a0), before any read of that argument; all subsequent server/queue operations derive from packet in a0. Thus this RPC-state parameter is unused. --- src/sdk/callbacks/handle_sif_rpc_call.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdk/callbacks/handle_sif_rpc_call.c b/src/sdk/callbacks/handle_sif_rpc_call.c index d0d6b5d40e..519e7fbd53 100644 --- a/src/sdk/callbacks/handle_sif_rpc_call.c +++ b/src/sdk/callbacks/handle_sif_rpc_call.c @@ -9,7 +9,7 @@ void handle_sif_rpc_call(u32 *packet, void *state) __asm__("FUN_0011b138"); -void handle_sif_rpc_call(u32 *packet, void *state) { +void handle_sif_rpc_call(u32 *packet, void *unused_rpc_state) { u32 *server = (u32 *)packet[13]; /* packet + 0x34 */ u32 *queue = (u32 *)server[16]; /* server + 0x40 */ From d6c139da072a024ad1d10684f04582bad4a39619 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:17:58 +0000 Subject: [PATCH 136/657] decomp: clarify names in sceGsSyncV mode -> unused_mode: In the bound source src/sdk/graph/sce_gs_sync_v.c (SHA-256 bc5a5b874efb5524ff3f9a5b7df4722a39e5dfd1655d1b02ee68f91a2b16bdda), mode occurs only in the s32 parameter declaration. Retail 0x00122298-0x00122328 never reads or saves incoming a0: the function instead obtains GS parameters at 0x001222a4, selects VSync/VSync2 from offset 8, and returns 1 or CSR bit 13. The only explicit a0 operation is its overwrite at 0x00122308 (andi a0,v0,0x1). Thus unused_mode accurately records the argument's lack of participation without inventing mode semantics. --- src/sdk/graph/sce_gs_sync_v.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdk/graph/sce_gs_sync_v.c b/src/sdk/graph/sce_gs_sync_v.c index 21082ebd9a..47ffc86705 100644 --- a/src/sdk/graph/sce_gs_sync_v.c +++ b/src/sdk/graph/sce_gs_sync_v.c @@ -3,7 +3,7 @@ #include "rnc/sdk/graph/sce_gs_get_gparam.h" #include "rnc/sdk/kernel.h" -s32 sceGsSyncV(s32 mode) { +s32 sceGsSyncV(s32 unused_mode) { sceGsGParam *gp; s64 field; From af69575166fa9eb6080bd420c61c7462c8434172 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:17:58 +0000 Subject: [PATCH 137/657] decomp: clarify names in sceCdNcmdDiskReady status -> drive_state: In the authoritative sceCdNcmdDiskReady source, status receives the u32 word from native_cd_drive_state_response through address OR 0x20000000 and is returned after SignalSema. Retail 0x00120bc0 forms response storage 0x00131340; 0x00120bdc and 0x00120be0 pass it as the four-byte receive buffer for synchronous RPC 0x0E. Instructions 0x00120c08-0x00120c18 load its uncached word into s0, and 0x00120c1c returns that word. The supplied original Ghidra decompilation agrees, and sceCdRead compares this returned drive state with 6. --- src/sdk/storage/cdvd/sceCdNcmdDiskReady.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/storage/cdvd/sceCdNcmdDiskReady.c b/src/sdk/storage/cdvd/sceCdNcmdDiskReady.c index 6b4f654072..839058f94f 100644 --- a/src/sdk/storage/cdvd/sceCdNcmdDiskReady.c +++ b/src/sdk/storage/cdvd/sceCdNcmdDiskReady.c @@ -7,7 +7,7 @@ extern s32 SignalSema(); extern s32 cd_check_ncmd() __asm__("func_00120A28"); s32 sceCdNcmdDiskReady(void) { - s32 status; + s32 drive_state; if (cd_check_ncmd(2) == 0) { return 0; @@ -16,7 +16,7 @@ s32 sceCdNcmdDiskReady(void) { SignalSema(cd_ncmd_sema); return 0; } - status = *(u32 *)((u32)native_cd_drive_state_response | 0x20000000); + drive_state = *(u32 *)((u32)native_cd_drive_state_response | 0x20000000); SignalSema(cd_ncmd_sema); - return status; + return drive_state; } From c3b8186a4932436b7a545370fb152072ea8ac076 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:20:13 +0000 Subject: [PATCH 138/657] decomp: clarify names in sceDmaPause state -> interrupts_were_enabled: In the SHA-256-bound sce_dma_pause.c snapshot, state receives DIntr() and is tested against FALSE before EnableInterrupts. Retail 0x00123360 calls DIntr (0x0011d660), 0x00123368 saves its return from v0 into a3, and 0x001233c0 tests a3 to skip the EnableInterrupts call at 0x001233c8 when zero. The supplied retail annotation documents the saved prior COP0 Status bit-16 predicate at 0x0011d668..0x0011d670, proving this is whether interrupts were enabled before pausing. --- src/sdk/dma/sce_dma_pause.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/dma/sce_dma_pause.c b/src/sdk/dma/sce_dma_pause.c index d9427879f4..f55a53865a 100644 --- a/src/sdk/dma/sce_dma_pause.c +++ b/src/sdk/dma/sce_dma_pause.c @@ -4,13 +4,13 @@ extern s32 DIntr(); extern s32 EnableInterrupts(); s32 sceDmaPause(volatile u32 *chcr) { - s32 state; + s32 interrupts_were_enabled; u32 ctrl; u32 chan; u32 dstat; u32 masked; - state = DIntr(); + interrupts_were_enabled = DIntr(); ctrl = *(volatile u32 *)0x1000F520; if (!(ctrl & 0x10000)) { *(volatile u32 *)0x1000F590 = ctrl | 0x10000; @@ -20,8 +20,8 @@ s32 sceDmaPause(volatile u32 *chcr) { masked = chan & 0xFFFFFEFF; *chcr = masked; *(volatile u32 *)0x1000F590 = ctrl; - if (state != FALSE) { - EnableInterrupts(masked, dstat, ctrl, state); + if (interrupts_were_enabled != FALSE) { + EnableInterrupts(masked, dstat, ctrl, interrupts_were_enabled); } return chan; } From cfe81699240b16fd3d949d2099b44d6d501e960e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:20:14 +0000 Subject: [PATCH 139/657] decomp: clarify names in allocate_voice_for_group_entry flags -> playback_flags: In assigned retail 0x0022dba0, a1 reaches allocate_voice_slot at 0x0022dbf0 unchanged. Prepared helper evidence (request 5ceec25e02574194a3b5b70810c6f65d) shows a1 saved to s2 at 0x0022d804, bit 0x4 tested at 0x0022d814 against sound-definition +0x18, bit 0x10 tested at 0x0022d998 to gate the position-dependent call at 0x0022d9bc, and s2 persisted with sb at 0x0022d9ec to voice_pool + slot_index*0x70 + 0x75, beside slot state at +0x74. When no owner or explicit position exists, 0x0022d98c ORs 0x11 into the same mask. This proves playback-control flags retained by the allocated voice. --- src/audio/voices/allocate_voice_for_group_entry.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/voices/allocate_voice_for_group_entry.c b/src/audio/voices/allocate_voice_for_group_entry.c index 2d277379b3..57ecfeaea8 100644 --- a/src/audio/voices/allocate_voice_for_group_entry.c +++ b/src/audio/voices/allocate_voice_for_group_entry.c @@ -17,7 +17,7 @@ s32 allocate_voice_for_group_entry(s32 group_entry_index, s32 flags, s32 owner) __asm__("FUN_0022dba0"); -s32 allocate_voice_for_group_entry(s32 group_entry_index, s32 flags, s32 owner) { +s32 allocate_voice_for_group_entry(s32 group_entry_index, s32 playback_flags, s32 owner) { s32 entry_index; s32 slot_index; struct VoiceGroupEntryWindow *slot; @@ -26,7 +26,7 @@ s32 allocate_voice_for_group_entry(s32 group_entry_index, s32 flags, s32 owner) if (entry_index >= level_sound_def_count) { return -1; } - slot_index = allocate_voice_slot(level_sound_defs + (entry_index << 5), flags, owner, 0, 0x400); + slot_index = allocate_voice_slot(level_sound_defs + (entry_index << 5), playback_flags, owner, 0, 0x400); if (slot_index >= 0) { slot = (struct VoiceGroupEntryWindow *)(slot_index * 0x70 + ((u8 *)&voice_pool)); slot->owner = owner; From 031e7dc8991a0fb1d022fd1eec97d1e6953a2c3e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:20:14 +0000 Subject: [PATCH 140/657] decomp: clarify names in is_point_inside_clip_volume_cf id -> moby_group_index: Retail 0x002c6da0 rejects the incoming a0 value 0xFF; 0x002c6da8 moves that same value into a1 before the first-group call at 0x002c6db4 (Ghidra func_0x00247e08, checked get_first_moby_in_group binding). The supplied helper uses its second argument moby_group_index to select the group's entry-index list. The supplied robot_dog_update caller passes ((unsigned char *)moby)[0x21], the group byte also used by get_next_moby_in_group. Thus this int selects the moby group being scanned, rather than a clip-volume ID. --- src/overlays/l03/mobys/robot_dog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l03/mobys/robot_dog.c b/src/overlays/l03/mobys/robot_dog.c index 18fd6db1f3..6bd961f9ca 100644 --- a/src/overlays/l03/mobys/robot_dog.c +++ b/src/overlays/l03/mobys/robot_dog.c @@ -590,11 +590,11 @@ extern int is_kerwan_path_enemy_in_state_9(unsigned char *) __asm__("FUN_L03_002 int is_point_inside_clip_volume_cf(int id) __asm__("FUN_L03_002c6d98"); -int is_point_inside_clip_volume_cf(int id) { +int is_point_inside_clip_volume_cf(int moby_group_index) { unsigned char *group_member_moby; - if (id == 0xFF) + if (moby_group_index == 0xFF) goto absent; - get_first_moby_in_group((int *)&group_member_moby, id, 0, 0); + get_first_moby_in_group((int *)&group_member_moby, moby_group_index, 0, 0); while (group_member_moby != 0) { if (is_kerwan_path_enemy_in_state_9(group_member_moby)) return 1; From 2b4b9b6c6ce825bc7586f67b11b7ac409e822f3f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:20:14 +0000 Subject: [PATCH 141/657] decomp: clarify names in allocate_voice_for_bank_entry flags -> voice_control_flags: At 0x0022db58 the wrapper forwards flags unchanged in a1 to allocate_voice_slot (0x0022d7f0). The helper saves a1 in s2 at 0x0022d804, tests bit 0x4 at 0x0022d814 to select eligibility against the sound definition byte +0x18, tests bit 0x10 at 0x0022d998 to bypass the calculation at 0x0022d9bc, and stores s2 as the allocated voice slot control byte at biased pool offset +0x75 at 0x0022d9ec. Thus it is the incoming voice control flag set, rather than the bank index, owner or slot state. --- src/audio/voices/allocate_voice_for_bank_entry.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/voices/allocate_voice_for_bank_entry.c b/src/audio/voices/allocate_voice_for_bank_entry.c index 108f52afaf..d1017c447b 100644 --- a/src/audio/voices/allocate_voice_for_bank_entry.c +++ b/src/audio/voices/allocate_voice_for_bank_entry.c @@ -14,14 +14,14 @@ struct VoiceBankEntryWindow { extern s32 allocate_voice_slot(u8 *, s32, s32, s32, s32) __asm__("func_0022D7F0"); s32 allocate_voice_for_bank_entry(s32 entry_index, s32 flags, s32 owner) __asm__("FUN_0022db10"); -s32 allocate_voice_for_bank_entry(s32 entry_index, s32 flags, s32 owner) { +s32 allocate_voice_for_bank_entry(s32 entry_index, s32 voice_control_flags, s32 owner) { s32 slot_index; struct VoiceBankEntryWindow *slot; if (entry_index >= D_0015F5B4) { return -1; } - slot_index = allocate_voice_slot(level_sound_defs + (entry_index << 5), flags, owner, 0, 0x400); + slot_index = allocate_voice_slot(level_sound_defs + (entry_index << 5), voice_control_flags, owner, 0, 0x400); if (slot_index >= 0) { slot = (struct VoiceBankEntryWindow *)(((u8 *)&voice_pool) + slot_index * 0x70); slot->owner = owner; From 3e594070f5eaad175dc021ed0ba2d68c7c8c8358 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:20:14 +0000 Subject: [PATCH 142/657] decomp: clarify names in count_active_and_visible_listed_mobys type -> target_moby_list_index: Retail 0x00311be8 loads moby private data from moby+0x78; 0x00311bf4 loads its signed halfword at +0x108, 0x00311bfc scales it by four, and 0x00311c04-0x00311c08 fetch the selected D_L11_001AC240 list pointer. Original decompilation sVar1 performs this same table lookup. Authoritative C stores this selector in type; ShipVars documents +0x108 as target_class, and select_ship_lock_on_target uses the same offset to select its target moby list. Thus target_moby_list_index describes the proven table-selection role without claiming a global class ID. --- src/overlays/l11/mobys/jet_fighter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l11/mobys/jet_fighter.c b/src/overlays/l11/mobys/jet_fighter.c index bc6d141881..d4940f86e6 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -244,11 +244,11 @@ void count_active_and_visible_listed_mobys(void *moby, void *visible_moby_count) { char *moby_private_data = *(char **)((char *)moby + 0x78); - int type = *(short *)(moby_private_data + 0x108); + int target_moby_list_index = *(short *)(moby_private_data + 0x108); short *moby_list_entry; *(unsigned short *)active_moby_count = 0; *(unsigned short *)visible_moby_count = 0; - moby_list_entry = D_L11_001AC240[type]; + moby_list_entry = D_L11_001AC240[target_moby_list_index]; if (moby_list_entry == 0) return; do { From b6724ff7e68d887598e257fa4383633adc3f95bc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:22:14 +0000 Subject: [PATCH 143/657] decomp: clarify names in select_moby_context state -> requested_context_selector: Retail 0x00235668 loads the current selector from gp-0x74d8 (0x0015f728), and 0x0023566c compares incoming a0 against it. On mismatch 0x00235674 XORs the stored selector with 1 and 0x002356c0 stores it while four active/inactive moby context words exchange. Authoritative C uses state only in this comparison with l00_active_moby_context_selector. Supplied initialize_pause_menu selects 1 before menu preview creation and update_pause_menu selects 0 during gameplay restoration, proving that this int parameter is the requested context selector. --- .../shared/ui/hud/decompress_and_relocate_selected_groups.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c b/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c index 0e555270ac..800d3fe530 100644 --- a/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c +++ b/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c @@ -157,9 +157,9 @@ extern volatile int l00_active_moby_context_selector __asm__("D_L00_0015F728") _ void select_moby_context(int state) __asm__("FUN_L00_00235668"); -void select_moby_context(int state) { +void select_moby_context(int requested_context_selector) { int oldState = l00_active_moby_context_selector; - if (state != oldState) { + if (requested_context_selector != oldState) { int saved_inactive_moby_array_start, saved_inactive_loaded_moby_end, saved_inactive_moby_pool_last_slot, old7C, oldDC, oldE0, oldE8; oldDC = (int)moby_table; From d2cf714b052e9fd0514f2f49dfa23ae1fb0e68d7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:22:15 +0000 Subject: [PATCH 144/657] decomp: clarify names in handle_cd_read_callback status -> completed_command_state: Retail 0x001206ec loads the s32 at incoming a0; 0x001206f4 stores it to current native CD command state at 0x00131314, and 0x001206f8-0x001206fc copies it to native_cd_last_command_state at 0x00131318. The value is compared with 11 at 0x00120700-0x00120704 before semaphore notification. The original Ghidra parameter pnCommandState and process_native_cd_read_completion caller corroborate that this pointer supplies the completed command state. --- src/sdk/storage/cdvd/handle_cd_read_callback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/storage/cdvd/handle_cd_read_callback.c b/src/sdk/storage/cdvd/handle_cd_read_callback.c index 42a24be057..2382b2435d 100644 --- a/src/sdk/storage/cdvd/handle_cd_read_callback.c +++ b/src/sdk/storage/cdvd/handle_cd_read_callback.c @@ -9,8 +9,8 @@ extern s32 iSignalSema(); void handle_cd_read_callback(s32 *status) __asm__("FUN_001206d8"); -void handle_cd_read_callback(s32 *status) { - D_00131314[0] = *status; +void handle_cd_read_callback(s32 *completed_command_state) { + D_00131314[0] = *completed_command_state; native_cd_last_command_state[0] = D_00131314[0]; if (D_00131314[0] == 11) { D_00131314[0] = 0; From 92f407dccca271b0cf27a00a6a8b3c47bd032784 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:25:04 +0000 Subject: [PATCH 145/657] decomp: clarify names in sceMpegInit state -> interrupts_were_enabled: Source s32 state receives DIntr at retail call 0x0012b738. Helper 0x0011d660 reads COP0 Status, masks 0x10000 at 0x0011d668, and normalizes the pre-DI bit into a0 with sltu at 0x0011d670. It returns saved a0 in v0 at 0x0011d698/0x0011d6a4. The branch at 0x0012b7a4 skips EnableInterrupts (0x0012b7ac) when this return is zero, proving interrupts_were_enabled. --- src/sdk/mpeg/api/sce_mpeg_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/mpeg/api/sce_mpeg_init.c b/src/sdk/mpeg/api/sce_mpeg_init.c index 3be684fd01..997a3e678e 100644 --- a/src/sdk/mpeg/api/sce_mpeg_init.c +++ b/src/sdk/mpeg/api/sce_mpeg_init.c @@ -4,14 +4,14 @@ extern s32 DIntr(); void sceMpegInit(void) { - s32 state; + s32 interrupts_were_enabled; - state = DIntr(); + interrupts_were_enabled = DIntr(); *(volatile u32 *)0x1000F590 = *(volatile u32 *)0x1000F520 | 0x10000; *(volatile u32 *)0x1000B000 &= 0xFFFFFEFF; *(volatile u32 *)0x1000B400 &= 0xFFFFFEFF; *(volatile u32 *)0x1000F590 = *(volatile u32 *)0x1000F520 & 0xFFFEFFFF; - if (state != FALSE) { + if (interrupts_were_enabled != FALSE) { EnableInterrupts(); } *(volatile u32 *)0x1000B020 = 0; From 226db354543449efb84fec1363a9f2a283077f15 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:25:04 +0000 Subject: [PATCH 146/657] decomp: clarify names in allocate_voice_for_target_entry flags -> voice_slot_flags: In assigned source src/audio/voices/allocate_voice_for_target_entry.c (SHA-256 e6125f2fa685c82de932a35afdf80873d507b84b25ab19e50ac47edb6eea2d2c), flags is passed as the second allocate_voice_slot argument. Retail 0x0022dac8 calls 0x0022d7f0 with a1 unchanged. The helper saves a1 in s2 at 0x0022d804, tests s2 & 4 at 0x0022d814 and s2 & 0x10 at 0x0022d998, and stores s2 with sb at 0x0022d9ec to voice_pool + slot_index*0x70 + 0x75, beside the slot state at +0x74. Thus it is the voice slot's retained flag bitfield, rather than the entry index, owner or fixed fifth allocation argument. --- src/audio/voices/allocate_voice_for_target_entry.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/voices/allocate_voice_for_target_entry.c b/src/audio/voices/allocate_voice_for_target_entry.c index 82ee2d654d..adecbef8b1 100644 --- a/src/audio/voices/allocate_voice_for_target_entry.c +++ b/src/audio/voices/allocate_voice_for_target_entry.c @@ -33,7 +33,7 @@ s32 allocate_voice_for_target_entry(s32 entry_index, /* Queue a class sound entry for a moby; return its pool index or -1. * The caller supplies a nonnegative entry index: retail only checks the * upper bound. This does not allocate a hardware voice or play immediately. */ -s32 allocate_voice_for_target_entry(s32 entry_index, s32 flags, struct MobyAudioView *moby) { +s32 allocate_voice_for_target_entry(s32 entry_index, s32 voice_slot_flags, struct MobyAudioView *moby) { struct MobyClassAudioView *pclass; s32 slot_index; s32 sound_defs; @@ -53,7 +53,7 @@ s32 allocate_voice_for_target_entry(s32 entry_index, s32 flags, struct MobyAudio if (entry_index >= (s32)pclass->sound_def_count) { return -1; } - slot_index = allocate_voice_slot(sound_defs + (entry_index << 5), flags, moby, 0, 0x400); + slot_index = allocate_voice_slot(sound_defs + (entry_index << 5), voice_slot_flags, moby, 0, 0x400); if (slot_index >= 0) { slot = (struct VoiceMobyEntryWindow *)((slot_index * 0x70) + (s32)((u8 *)&voice_pool)); slot->owner = moby; From b7b935d9dc4c9cd24a4e49b6d459a8788e47bac0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:25:04 +0000 Subject: [PATCH 147/657] decomp: clarify names in update_moby_bone_attachment mode -> bone_index: At 0x0027b9d0 the original third argument a2 is moved into a1, then passed with parent to build_moby_bone_transform (retail helper 0x00268468) at 0x0027b9e0, with sp as output. The resulting transform translation at sp+0x30 is copied to child+0x10 at 0x0027b9e8..0x0027b9f4, and its basis is copied to child+0xC0 at 0x0027ba0c..0x0027ba18. The established function and helper identify this integer as the selected parent bone index; miner_update supplies 2 for its existing attachment. --- src/overlays/l12/mobys/miner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l12/mobys/miner.c b/src/overlays/l12/mobys/miner.c index af82c7e908..885efff380 100644 --- a/src/overlays/l12/mobys/miner.c +++ b/src/overlays/l12/mobys/miner.c @@ -51,9 +51,9 @@ void update_moby_bone_attachment(struct Moby *parent, unsigned char *child, int mode) __asm__("FUN_L12_0027b9c0"); -void update_moby_bone_attachment(struct Moby *parent, unsigned char *child, int mode) { +void update_moby_bone_attachment(struct Moby *parent, unsigned char *child, int bone_index) { char workspace[0x40]; - build_moby_bone_transform(parent, mode, workspace); + build_moby_bone_transform(parent, bone_index, workspace); qcopy(child + 0x10, workspace + 0x30); advance_moby_animation(child); update_entity(child); From 4c1d0473de8fca2f7169d710bc946f6792ddf1ce Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:25:05 +0000 Subject: [PATCH 148/657] decomp: clarify names in sbrk status -> interrupts_were_enabled: In the authoritative src/sdk/kernel/sbrk.c snapshot (SHA-256 533e9e5b8e02cc5ed1eeb0b01c84d2cea864959603da8b3ea951d70bd7843a5a), status is CpuReadStatus() masked with 0x10000. Retail 0x00118e24-0x00118e30 saves that entry bit in s1 and skips DI when zero; the loop rereads Status into v0 without modifying s1. At 0x00118e80/0x00118e88 and 0x00118e98/0x00118ea0, the saved s1 condition gates EI on failure and success respectively. Original Ghidra uVar4 has this same saved-bit and conditional-EI flow, proving interrupts_were_enabled. --- src/sdk/kernel/sbrk.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/kernel/sbrk.c b/src/sdk/kernel/sbrk.c index 67ad063c3e..338416d8a9 100644 --- a/src/sdk/kernel/sbrk.c +++ b/src/sdk/kernel/sbrk.c @@ -10,12 +10,12 @@ extern char *heap_break __asm__("D_0012FBF4") NOT_SDA; /* Sony libkernel sbrk: moves the program break by increment with interrupts disabled; fails with ENOMEM past the end of the heap. */ void *sbrk(s32 increment) { - u32 status = CpuReadStatus(); + u32 interrupts_were_enabled = CpuReadStatus(); char *proposed_heap_break; void *previous; - status &= 0x10000; - if (status) { + interrupts_were_enabled &= 0x10000; + if (interrupts_were_enabled) { do { CpuDisableInt(); CpuSyncP(); @@ -24,14 +24,14 @@ void *sbrk(s32 increment) { proposed_heap_break = heap_break + increment; if ((char *)EndOfHeap() < proposed_heap_break) { *__errno() = 12; - if (status) { + if (interrupts_were_enabled) { CpuEnableInt(); } return (void *)-1; } previous = heap_break; heap_break = proposed_heap_break; - if (status) { + if (interrupts_were_enabled) { CpuEnableInt(); } return previous; From 39ae54461076dd28947f276088515be676a27e0a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:25:05 +0000 Subject: [PATCH 149/657] decomp: clarify names in test_other_group_moby_state_range state -> group_candidate_state: Source declares state = group_candidate_moby[0x20] inside the self-exclusion branch. Retail 0x0030f580 loads the iterator candidate into a1; 0x0030f590 excludes the input moby in s0; 0x0030f598 lbu v1,0x20(a1) reads that candidate's unsigned state. Comparisons at 0x0030f59c and 0x0030f5a8 compare the same v1 against lower in s2 and upper in s1, proving this is the group candidate's state rather than the input moby's. --- src/overlays/l07/mobys/sharkigator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l07/mobys/sharkigator.c b/src/overlays/l07/mobys/sharkigator.c index 88d3c74d2f..e3cda29216 100644 --- a/src/overlays/l07/mobys/sharkigator.c +++ b/src/overlays/l07/mobys/sharkigator.c @@ -740,9 +740,9 @@ int test_other_group_moby_state_range(unsigned char *moby, int lower, int upper) if (group_candidate_moby) { do { if (group_candidate_moby != moby) { - int state = group_candidate_moby[0x20]; - if (state >= lower) { - if (state <= upper) { + int group_candidate_state = group_candidate_moby[0x20]; + if (group_candidate_state >= lower) { + if (group_candidate_state <= upper) { goto found; } } From 7895c27f9cdc85d7646533ddd05995df7b2e4c55 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:25:05 +0000 Subject: [PATCH 150/657] decomp: clarify names in build_magnet_elevator_camera_pose state -> camera_rotation: Retail 0x002ee9d8 retains third argument a2 in s1; 0x002eea24-0x002eea28 clears that output, 0x002eea48 computes fast_arc_tan from hero body-center XY minus camera_position XY, 0x002eea50 stores the angle at s1+8, and 0x002eea54 zeros s1+4. The authoritative C caller passes camera_rotation as this third argument, blends its angles and passes it to set_camera_rotation. Thus this char pointer is the camera rotation output, not elevator state. --- src/overlays/l17/mobys/magnet_elevator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l17/mobys/magnet_elevator.c b/src/overlays/l17/mobys/magnet_elevator.c index d18d97e8c4..58d0b2b1bf 100644 --- a/src/overlays/l17/mobys/magnet_elevator.c +++ b/src/overlays/l17/mobys/magnet_elevator.c @@ -280,16 +280,16 @@ void build_magnet_elevator_camera_pose(struct Moby *moby, char *camera_position, char *state) __asm__("FUN_L17_002ee9c0"); -void build_magnet_elevator_camera_pose(struct Moby *moby, char *camera_position, char *state) { +void build_magnet_elevator_camera_pose(struct Moby *moby, char *camera_position, char *camera_rotation) { fast_vec_sub(camera_position, D_L17_001676C0, &moby->pos); set_vector_length_xy(camera_position, camera_position, 2.5f); *(float *)(camera_position + 8) = 1.5f; fast_vec_add(camera_position, camera_position, &moby->pos); - clear_u64_value(state); - *(float *)(state + 8) = + clear_u64_value(camera_rotation); + *(float *)(camera_rotation + 8) = fast_arc_tan(hero.motion.body_center.f[0] - *(float *)camera_position, hero.motion.body_center.f[1] - *(float *)(camera_position + 4)); - *(int *)(state + 4) = 0; + *(int *)(camera_rotation + 4) = 0; } extern void transform_vector_by_basis(void *, void *, void *); From b530fe42d8306dc1f062fff0654b9da93a18c412 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:27:11 +0000 Subject: [PATCH 151/657] decomp: clarify names in _waitIpuIdle64 status -> ipu_command_result: In src/sdk/ipu/wait_ipu_idle64.c (snapshot SHA-256 2a10027b01859e4518f56dd82fbfff3e3458b32a5bfd44853f24a668c57bf5b8), status is loaded only from volatile s64 address 0x10002000 and returned unchanged. Retail ld at 0x0012851c and 0x00128570 reads IPU_CMD; bgez at 0x00128520 and 0x00128574 tests its signed busy boundary, and move v0,a0 at 0x00128590 returns that register value. The original Ghidra lVar3 follows precisely this flow; supplied MPEG bitstream callers consume its low 32 bits as the bit window. --- src/sdk/ipu/wait_ipu_idle64.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sdk/ipu/wait_ipu_idle64.c b/src/sdk/ipu/wait_ipu_idle64.c index 6e20586660..8fdb4d1191 100644 --- a/src/sdk/ipu/wait_ipu_idle64.c +++ b/src/sdk/ipu/wait_ipu_idle64.c @@ -6,10 +6,10 @@ s64 _waitIpuIdle64(s32 *ctx) { IPU_CMD_IDLE_THRESHOLD = 0 }; long new_var; - s64 status; + s64 ipu_command_result; int count = 0; - status = *((volatile s64 *)0x10002000); - if (status < IPU_CMD_IDLE_THRESHOLD) { + ipu_command_result = *((volatile s64 *)0x10002000); + if (ipu_command_result < IPU_CMD_IDLE_THRESHOLD) { if (((*((volatile u32 *)0x10002010)) & 0x4000) == 0) { do { new_var = 0x1389; @@ -20,10 +20,10 @@ s64 _waitIpuIdle64(s32 *ctx) { } else { count++; } - status = *((volatile s64 *)0x10002000); - } while ((status < IPU_CMD_IDLE_THRESHOLD) && + ipu_command_result = *((volatile s64 *)0x10002000); + } while ((ipu_command_result < IPU_CMD_IDLE_THRESHOLD) && (((*((volatile u32 *)0x10002010)) & 0x4000) == 0)); } } - return status; + return ipu_command_result; } From a79dd10de2989bfb1a42d3dfc42bb09545da645a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:27:11 +0000 Subject: [PATCH 152/657] decomp: clarify names in assign_moby_class_data id -> class_id: In source src/mobys/assign_moby_class_data.c (SHA-256 d160dcbcd3c311588e77b18a06eb149e651964062e82e94584696c98d5f9bca5), id is compared only against resident_class_defaults[i].oclass. Retail 0x00212da8 compares the first record class word with incoming a0; 0x00212dcc compares later records with the same argument while 0x00212dd0 advances by 12 bytes and 0x00212dbc stops at -1. The selected record supplies update at +4 (0x00212df0-0x00212df8) and methods at +8 (0x00212e08-0x00212e10), proving this is the class ID whose defaults are requested. --- src/mobys/assign_moby_class_data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mobys/assign_moby_class_data.c b/src/mobys/assign_moby_class_data.c index 04bcb61f28..7086bfd98e 100644 --- a/src/mobys/assign_moby_class_data.c +++ b/src/mobys/assign_moby_class_data.c @@ -11,12 +11,12 @@ extern struct MobyClassUpdate resident_class_defaults[] __asm__("D_001E8B80"); void assign_moby_class_data(s32 id) __asm__("FUN_00212d68"); -void assign_moby_class_data(s32 id) { +void assign_moby_class_data(s32 class_id) { struct Obj *class_resource; s32 i; class_resource = moby_class_resources[D_0015FF00]; - for (i = 0; resident_class_defaults[i].oclass != -1 && resident_class_defaults[i].oclass != id; + for (i = 0; resident_class_defaults[i].oclass != -1 && resident_class_defaults[i].oclass != class_id; i++) { } moby_class_updates[D_0015FF00] = (s32)resident_class_defaults[i].update; From e272a1f1babd65baed610e73496d7680c650c0d3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:27:11 +0000 Subject: [PATCH 153/657] decomp: clarify names in spawn_barrier_replacement state -> draw_distance: Authoritative barrier.c snapshot SHA-256 3d1f5e146ed10903511bb0c97a2c67f589bbf02efb25292f0ebe21ffccf7577c declares unsigned char state, assigns BARRIER_REPLACEMENT_DRAW_DISTANCE, and uses it only in MOBY(moby)->draw_dist = state. Original retail decompilation writes 0xff to replacement +0x32; instructions 0x00308244 and 0x0030824c load 255 into v1 and store that halfword through allocated replacement s0. Actual moby state at +0x20 is separately cleared at 0x00308264. Thus draw_distance describes the local's proven field-setting role. --- src/overlays/l09/mobys/barrier.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l09/mobys/barrier.c b/src/overlays/l09/mobys/barrier.c index 6eb5d37bf7..618d99a814 100644 --- a/src/overlays/l09/mobys/barrier.c +++ b/src/overlays/l09/mobys/barrier.c @@ -76,10 +76,10 @@ char *spawn_barrier_replacement(struct Moby *source_moby, int spawned_moby_class }; char *moby = create_moby(spawned_moby_class); if (moby != 0) { - unsigned char state; + unsigned char draw_distance; ((unsigned char *)moby)[0x30] = 0xFF; - state = BARRIER_REPLACEMENT_DRAW_DISTANCE; - MOBY(moby)->draw_dist = state; + draw_distance = BARRIER_REPLACEMENT_DRAW_DISTANCE; + MOBY(moby)->draw_dist = draw_distance; moby[0x31] = 1; moby[0x20] = 0; qcopy(moby + 0x10, &source_moby->pos); From 39ad187352e32488f1170ad82a7d518d9df6e093 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:27:11 +0000 Subject: [PATCH 154/657] decomp: clarify names in find_nearest_moby_by_class type -> target_moby_class: In the bound C source, MOBY(candidate_moby)->oclass == type gates fast_vec_dist and nearest-candidate selection. Retail 0x002c2630 saves a1 in s2; 0x002c2658 loads the candidate's signed class at +0xA6 and 0x002c2660 compares it with s2, skipping nonmatching candidates. Original Ghidra compares sVar1 == param_2; the supplied airship_part_update caller passes class 0x4A0 and uses the result as the parent Moby. --- src/overlays/l09/mobys/airship_part.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l09/mobys/airship_part.c b/src/overlays/l09/mobys/airship_part.c index 156a046d94..df1d74d98c 100644 --- a/src/overlays/l09/mobys/airship_part.c +++ b/src/overlays/l09/mobys/airship_part.c @@ -151,13 +151,13 @@ char *spawn_airship_part(struct Moby *rotation_source_moby, return spawned_moby; } -char *find_nearest_moby_by_class(void *search_position, int type, float *nearest_distance_out) { +char *find_nearest_moby_by_class(void *search_position, int target_moby_class, float *nearest_distance_out) { char *best = 0; float bestd = 100000.0f; char *candidate_moby; for (candidate_moby = D_L09_0015FFE4; candidate_moby != 0; candidate_moby = ((char *)MOBY(candidate_moby)->next)) { - if (MOBY(candidate_moby)->oclass == type) { + if (MOBY(candidate_moby)->oclass == target_moby_class) { float candidate_distance = fast_vec_dist(search_position, candidate_moby + 0x10); if (candidate_distance < bestd) { bestd = candidate_distance; From bd891119e1c5fba585dc7b3bc31f09ffe416e347 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:29:17 +0000 Subject: [PATCH 155/657] decomp: clarify names in sceCdBreak status -> cd_break_response: Source assigns status from *(u32 *)((u32)cd_scmd_result | 0x20000000) after successful sceSifCallRpc command 0x16 with receive size 4, then returns it. Retail 0x0012171c supplies receive buffer 0x001324c0, 0x00121720 sets four bytes, 0x00121754-0x00121764 reads the uncached alias into s0 across SignalSema, and 0x00121768 moves s0 to return register v0. Original Ghidra likewise returns the CD synchronous response on success. --- src/sdk/storage/cdvd/scecdbreak.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/storage/cdvd/scecdbreak.c b/src/sdk/storage/cdvd/scecdbreak.c index 539e1952e8..5810572423 100644 --- a/src/sdk/storage/cdvd/scecdbreak.c +++ b/src/sdk/storage/cdvd/scecdbreak.c @@ -7,7 +7,7 @@ extern s32 SignalSema(s32 semaId); extern s32 cd_check_scmd(s32 cmd) __asm__("func_00120D40"); s32 sceCdBreak(void) { - s32 status; + s32 cd_break_response; if (cd_check_scmd(0x1E) == 0) { return 0; @@ -20,10 +20,10 @@ s32 sceCdBreak(void) { return 0; } D_00131314[0] = 0; - status = *(u32 *)((u32)cd_scmd_result | 0x20000000); + cd_break_response = *(u32 *)((u32)cd_scmd_result | 0x20000000); { s32 sema2 = *(volatile u32 *)&cd_scmd_sema; SignalSema(sema2); } - return status; + return cd_break_response; } From 2afe550b06ea932e746c4b9826e85dba1c02c36d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:29:17 +0000 Subject: [PATCH 156/657] decomp: clarify names in sceDbcCreateSocket mode -> send_address: Retail 0x00124740 stores incoming a2 at D_0015B080 + 0x2c, matching socket_rpc_buffer[11] = mode. The prepared original signature and decompilation identify send_address; scePad2CreateSocket passes (u8 *)addr + 128. RPC mode is independently zeroed at 0x001247a0, so this argument carries the socket send-buffer address. --- src/sdk/input/dbc/sceDbcCreateSocket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/input/dbc/sceDbcCreateSocket.c b/src/sdk/input/dbc/sceDbcCreateSocket.c index e2dbcc4c8b..343466e4cb 100644 --- a/src/sdk/input/dbc/sceDbcCreateSocket.c +++ b/src/sdk/input/dbc/sceDbcCreateSocket.c @@ -10,14 +10,14 @@ extern void debug_print_stub(u8 *) __asm__("func_00124A20"); /* The header words are copied as pointers: their alias set differs from the int port/mode stores, so the header loads need not wait for them. */ -s32 sceDbcCreateSocket(void *socket_configuration, s32 port, s32 mode) { +s32 sceDbcCreateSocket(void *socket_configuration, s32 port, s32 send_address) { s32 *socket_rpc_buffer = D_0015B080; u8 *name_source = (u8 *)socket_configuration + 0x14; u8 *name_target = (u8 *)socket_rpc_buffer + 0x14; s32 i; socket_rpc_buffer[10] = port; - socket_rpc_buffer[11] = mode; + socket_rpc_buffer[11] = send_address; ((void **)socket_rpc_buffer)[0] = ((void **)socket_configuration)[0]; ((void **)socket_rpc_buffer)[1] = ((void **)socket_configuration)[1]; ((void **)socket_rpc_buffer)[2] = ((void **)socket_configuration)[2]; From f99b8a1ed177b6d8e69c1789aaee74cf613248ac Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:31:24 +0000 Subject: [PATCH 157/657] decomp: clarify names in try_start_hero_item_idle_animation id -> slot_zero_item_id: In the SHA-256-bound source, id = hero_slot_item_id(0). Retail 0x00229ad4/0x00229ad8 calls that helper with a0=0; 0x00229adc-0x00229ae4 compares its returned item ID to hero+0x2298 (item_anim_item_id), cancelling on mismatch. On match, 0x00229b00 multiplies the ID by 0x4c and 0x00229b04-0x00229b18 loads item_defs[id].hero_animation from table base 0x00179ac0 plus offset 0x24. The supplied helper returns items[0].item_id for the requested ready slot, proving slot_zero_item_id. --- src/overlays/shared/hero/hero_handle_jump_press.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/hero_handle_jump_press.c b/src/overlays/shared/hero/hero_handle_jump_press.c index 47a75dd1d6..4b391e1a75 100644 --- a/src/overlays/shared/hero/hero_handle_jump_press.c +++ b/src/overlays/shared/hero/hero_handle_jump_press.c @@ -288,12 +288,12 @@ s32 try_start_hero_item_idle_animation(void) { if (hero_ptr->item_anim_active == 0 || hero_ptr->weapon_up == 0 || hero_ptr->weapon_lowered != 0) return 0; - id = hero_slot_item_id(0); - if (id != hero_ptr->item_anim_item_id) { + slot_zero_item_id = hero_slot_item_id(0); + if (slot_zero_item_id != hero_ptr->item_anim_item_id) { cancel_hero_item_animation(); return 0; } - k = item_defs[id].hero_animation; + k = item_defs[slot_zero_item_id].hero_animation; if (hero_set_state(HERO_STATE_IDLE, 0) == 0) return 0; set_hero_animation(k, 0, (f32)scale_game_frames(0xB)); From b9ec6a169c5f6647d50f7bea9aa3117400ec663e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:31:24 +0000 Subject: [PATCH 158/657] decomp: clarify names in _skipMB0 flags -> macroblock_type_flags: Supplied _slice0 source passes &mbtype as _skipMB0 fifth argument and forwards mbtype to _motionComp0. Checked retail caller 0x00127aa0 supplies sp+0x48 in t0 for call 0x00127a9c; 0x00127abc loads that same slot into a3 for motion compensation at 0x00127ac8. _skipMB0 preserves this s32 * in s0 at 0x00127b54 and loads/ANDs -2/stores through it at 0x00127bd8-0x00127bec, proving a mutable macroblock-type flag word. Original Ghidra param_5 performs the same mask. --- src/sdk/mpeg/macroblock/skip_mb0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdk/mpeg/macroblock/skip_mb0.c b/src/sdk/mpeg/macroblock/skip_mb0.c index 0d3200527e..06505e1c9e 100644 --- a/src/sdk/mpeg/macroblock/skip_mb0.c +++ b/src/sdk/mpeg/macroblock/skip_mb0.c @@ -57,6 +57,6 @@ s32 _skipMB0(struct MpegDecoder *decoder, _Error(decoder, skipped_macroblock_in_i_picture_error_message); ok = 0; } - *flags &= ~1; + *macroblock_type_flags &= ~1; return ok; } From 9482dd9778648142648131a672c8f2017a33ce64 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:31:24 +0000 Subject: [PATCH 159/657] decomp: clarify names in release_beam_slot_by_id id -> owner_moby_id: At 0x002e2078-0x002e207c, retail loads the registered key from 0x00161c88 and compares it with incoming a0; the three-slot loop advances this table by four bytes at 0x002e20d8. On equality it clears the slot state/key at 0x002e208c/0x002e2094 and releases both endpoint lights. Supplied veldin_robot_enemy_update and update_veldin_robot_damage_and_targeting calls pass moby as this key, and the source draw routine accesses beam_slot_id[slot] + 0xA6 as a moby field, establishing the key as the beam owner's moby identity rather than a slot index. --- src/overlays/shared/rendering/effects/beam_slots.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/effects/beam_slots.c b/src/overlays/shared/rendering/effects/beam_slots.c index 542f4b4ba7..2666ac7c78 100644 --- a/src/overlays/shared/rendering/effects/beam_slots.c +++ b/src/overlays/shared/rendering/effects/beam_slots.c @@ -267,10 +267,10 @@ s32_2e1f28 register_beam_slot(s32_2e1f28 id, /* Ported from rac1-decomp (src/overlays/shared/vendor_002E1660.c: func_L00_002E34F0), where it is exact; names translated to the US level program. */ int release_beam_slot_by_id(int id) __asm__("FUN_L00_002e2040"); -int release_beam_slot_by_id(int id) { +int release_beam_slot_by_id(int owner_moby_id) { unsigned int i; for (i = 0; (int)i < 3; i++) { - if (beam_slot_id[i] == id) { + if (beam_slot_id[i] == owner_moby_id) { beam_slot_state[i] = 0; beam_slot_id[i] = 0; if (beam_endpoint_light[i] != -1) { From 51bb7a9762479844fc4cadc1e875d5169c6d85ca Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:31:24 +0000 Subject: [PATCH 160/657] decomp: clarify names in _clearEach state -> interrupts_were_enabled: In src/sdk/mpeg/picture/_clearEach.c (SHA-256 05606bdc6154a06f81e9bc5b881835136e47b70f7a90a9a35a1be20863978248), s32 state receives DIntr() and is tested against FALSE before EnableInterrupts(). Retail 0x0012c228 calls DIntr at 0x0011d660; its v0 return survives the DMAC writes, and beq v0,zero at 0x0012c288 skips EnableInterrupts at 0x0012c290 when interrupts were previously disabled. The prepared retail annotation identifies DIntr's Status bit-16 mask and Boolean normalization at 0x0011d660-0x0011d670, proving saved prior interrupt enablement. --- src/sdk/mpeg/picture/_clearEach.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/mpeg/picture/_clearEach.c b/src/sdk/mpeg/picture/_clearEach.c index 7bb0b835d8..0a5df29045 100644 --- a/src/sdk/mpeg/picture/_clearEach.c +++ b/src/sdk/mpeg/picture/_clearEach.c @@ -7,11 +7,11 @@ extern void EnableInterrupts(); extern s32 sceIpuSync(); void _clearEach(u8 *ctx) { - s32 state; + s32 interrupts_were_enabled; *(s32 *)(ctx + 0x818) = 1; *(s32 *)(ctx + 0x1B0) = 0; - state = DIntr(); + interrupts_were_enabled = DIntr(); *(volatile u32 *)0x1000F590 = *(volatile u32 *)0x1000F520 | 0x10000; *(volatile u32 *)0x1000B000 = 0; @@ -19,7 +19,7 @@ void _clearEach(u8 *ctx) { *(volatile u32 *)0x1000D400 = 0; *(volatile u32 *)0x1000F590 = *(volatile u32 *)0x1000F520 & 0xFFFEFFFF; - if (state != FALSE) + if (interrupts_were_enabled != FALSE) EnableInterrupts(); *(volatile u32 *)0x1000B020 = 0; From dca4b8e8561fd725aeb8d5bbcbbe7b823fb81138 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:31:25 +0000 Subject: [PATCH 161/657] decomp: clarify names in clip_volume_dialogue_trigger_update flags -> item_unlock_flags: Authoritative C initializes this unsigned char * from item_unlocked. Retail 0x002e7298-0x002e729c forms array base 0x0013D408; lbu at 0x002e72a0 tests byte +0x19 and sb at 0x002e72b4 sets it to 1 before voice allocation and queue_dialogue_message. Original Ghidra confirms cRam0013d421 changes from zero to one. Thus item_unlock_flags identifies the established source array without guessing the particular item/event. --- src/overlays/l16/mobys/clip_volume_dialogue_trigger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l16/mobys/clip_volume_dialogue_trigger.c b/src/overlays/l16/mobys/clip_volume_dialogue_trigger.c index 3c15d5bdd3..4f0882cce9 100644 --- a/src/overlays/l16/mobys/clip_volume_dialogue_trigger.c +++ b/src/overlays/l16/mobys/clip_volume_dialogue_trigger.c @@ -62,9 +62,9 @@ void clip_volume_dialogue_trigger_update(struct Moby *moby) { *(int *)(trigger_data + 8) = 0; } else if (is_point_inside_clip_volume(&player->motion.pos, *(int *)(trigger_data + 4)) != 0) { - unsigned char *flags = (unsigned char *)item_unlocked; - if (flags[0x19] == 0) { - flags[0x19] = 1; + unsigned char *item_unlock_flags = (unsigned char *)item_unlocked; + if (item_unlock_flags[0x19] == 0) { + item_unlock_flags[0x19] = 1; allocate_voice_for_bank_entry(1, 0, 0); queue_dialogue_message(0x53D6, -1); } From bd31eacaf5050b61d1000ed730cca521a1b01897 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:31:25 +0000 Subject: [PATCH 162/657] decomp: clarify names in topThread type -> command: Source type receives queue->requests[i].command and selects THREAD_COMMAND_WAKEUP, THREAD_COMMAND_ROTATE_READY_QUEUE, or THREAD_COMMAND_SUSPEND. Retail 0x0011922c loads this request byte from queue + 8 + 2 * masked_read_index; comparisons at 0x00119230, 0x00119240, and 0x00119250 dispatch values 1, 0, and 2 to RotateThreadReadyQueue, WakeupThread, and SuspendThread respectively. The separate byte at queue + 9 + 2 * index supplies each call argument, proving this byte is the command selector. --- src/sdk/kernel/topThread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/kernel/topThread.c b/src/sdk/kernel/topThread.c index 8327fe0fb1..a13f39e14d 100644 --- a/src/sdk/kernel/topThread.c +++ b/src/sdk/kernel/topThread.c @@ -19,14 +19,14 @@ void topThread(TopThreadQueue *queue) { THREAD_COMMAND_SUSPEND = 2 }; s32 i; - u8 type; + u8 command; for (;;) { WaitSema(top_thread_semaphore); i = queue->read_index & 0x1FF; queue->read_index = i + 1; - type = queue->requests[i].command; - switch (type) { + command = queue->requests[i].command; + switch (command) { case THREAD_COMMAND_WAKEUP: WakeupThread(queue->requests[i].argument); break; From 49fda70a96c504238990f7ac692969f83603391e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:31:25 +0000 Subject: [PATCH 163/657] decomp: clarify names in patch_moby_gifs id -> moby_class_id_cursor: In the authoritative src/rendering/mobys/patch_moby_gifs.c snapshot (SHA-256 03af85b50c50fedff517c426f1ea614be0749c64769802f02e9c364e8ca4d85d), s32 *id starts at moby_class_rectify, dereferences into moby_class_resources[*id], advances one s32 per class, and stops on a negative ID. Retail 0x0020cf20 loads the current list value; 0x0020cf28-0x0020cf34 scales it by four, indexes the class resource table at 0x001b3200, and loads its GIF array at +0x20. Retail 0x0020cf24 saves the next list address (+4), restored at 0x0020cfb8 before the sentinel test at 0x0020cfbc-0x0020cfc0. Original Ghidra expresses the same traversal with iVar3 and piVar8. Thus this pointer is a moby class ID cursor, not a scalar ID. --- src/rendering/mobys/patch_moby_gifs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rendering/mobys/patch_moby_gifs.c b/src/rendering/mobys/patch_moby_gifs.c index 76f9509e40..a557d32ee1 100644 --- a/src/rendering/mobys/patch_moby_gifs.c +++ b/src/rendering/mobys/patch_moby_gifs.c @@ -17,14 +17,14 @@ extern struct TexRemap moby_gs_loc_stash[] __asm__("D_001B5D80"); void patch_moby_gifs(void) __asm__("FUN_0020cef8"); void patch_moby_gifs(void) { - s32 *id; + s32 *moby_class_id_cursor; struct GifEntry *gif_entry; u8 *tex; u32 *gif; struct TexRemap *texture_remap; - for (id = moby_class_rectify; *id >= 0; id++) { - gif_entry = ((struct MobyClass *)moby_class_resources[*id])->gifs; + for (moby_class_id_cursor = moby_class_rectify; *moby_class_id_cursor >= 0; moby_class_id_cursor++) { + gif_entry = ((struct MobyClass *)moby_class_resources[*moby_class_id_cursor])->gifs; for (;; gif_entry++) { gif = (u32 *)(gif_entry->gif & 0x7FFFFFFF); tex = gif_entry->tex; From 0c0f8f7e625fb11c966eadaa206b8b6176a45cf5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:33:25 +0000 Subject: [PATCH 164/657] decomp: clarify names in sceDmaReset status -> previous_dma_enable_bit: In bound src/sdk/dma/sce_dma_reset.c (SHA-256 cb2c4e6a90e0e041889601c8225c3788aae2c0ab3dc08b52eb88291366271219), status receives the read at 0x1000E000 masked with 1 and is returned unchanged. Retail 0x00123030 reads CTRL, 0x0012303c captures bit 0 in s1, and 0x001230b4/0x001230cc copy s1 to return register v0. The optional CTRL OR-1/store at 0x001230c0-0x001230c8 occurs afterward, proving the returned bit records the previous DMA enable state. --- src/sdk/dma/sce_dma_reset.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/dma/sce_dma_reset.c b/src/sdk/dma/sce_dma_reset.c index 033e236ff5..0ffeb76938 100644 --- a/src/sdk/dma/sce_dma_reset.c +++ b/src/sdk/dma/sce_dma_reset.c @@ -31,11 +31,11 @@ const s32 DmaChannelsUsed[10] __asm__("D_001533F8") = {1, 1, 1, 1, 1, 0, 0, 0, 1 s32 sceDmaReset(s32 enable_dma) { s32 dma_environment[5]; - s32 status; + s32 previous_dma_enable_bit; s32 i; u32 mask; - status = *(volatile u32 *)0x1000E000 & 1; + previous_dma_enable_bit = *(volatile u32 *)0x1000E000 & 1; for (i = 9; i >= 0; i--) { if (DmaChannelsUsed[9 - i] != 0) { sceDmaChan *dma_channel = DmaChannels[9 - i]; @@ -55,5 +55,5 @@ s32 sceDmaReset(s32 enable_dma) { if (enable_dma == 1) { *(volatile u32 *)0x1000E000 |= 1; } - return status; + return previous_dma_enable_bit; } From baee34d7e9eb36f1f03e95664011cdf9d446fc2d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:33:25 +0000 Subject: [PATCH 165/657] decomp: clarify names in sceDbcReceiveData state -> rpc_transfer_buffer: Authoritative src/sdk/input/dbc/scedbcreceivedata.c (SHA-256 dcdacc7027c5c1abf4b4802f75a5728f0d66233f922771d094f13388a29679f9) initializes state to &RpcReceiveData. Retail 0x00124934/0x00124940 forms D_0015B080 in s0; 0x00124944, 0x00124960 and 0x00124980 populate request words at offsets 0, 4 and 8. At 0x0012497c and 0x00124984 s0 supplies both send_buf and recv_buf to sceSifCallRpc at 0x0012498c with sizes 0x400. After the call, offset 0x8c supplies the remote result, offset 8 supplies the returned byte count, and offset 0x0c supplies copied payload bytes (0x001249b8-0x001249f4). Original Ghidra likewise uses g_abDbcSharedRpcBuffer as both RPC buffers and response payload source, proving rpc_transfer_buffer rather than generic state. --- src/sdk/input/dbc/scedbcreceivedata.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/sdk/input/dbc/scedbcreceivedata.c b/src/sdk/input/dbc/scedbcreceivedata.c index bb855eb110..cc3362f1e0 100644 --- a/src/sdk/input/dbc/scedbcreceivedata.c +++ b/src/sdk/input/dbc/scedbcreceivedata.c @@ -19,27 +19,27 @@ s32 sceDbcReceiveData(s32 rpc_request_word_0, s32 *byte_count, u8 *destination) { - struct DbCState *state = &RpcReceiveData; + struct DbCState *rpc_transfer_buffer = &RpcReceiveData; s32 i; - state->unk0 = rpc_request_word_0; - state->unk4 = rpc_request_word_1; - state->unk8 = *byte_count; - if (sceSifCallRpc(&RpcQueueData, 0x8000091A, 0, state, 0x400, state, 0x400, 0, 0) < 0) { + rpc_transfer_buffer->unk0 = rpc_request_word_0; + rpc_transfer_buffer->unk4 = rpc_request_word_1; + rpc_transfer_buffer->unk8 = *byte_count; + if (sceSifCallRpc(&RpcQueueData, 0x8000091A, 0, rpc_transfer_buffer, 0x400, rpc_transfer_buffer, 0x400, 0, 0) < 0) { debug_print_stub(dbc_receive_rpc_error_message); return 0; } - if (state->unk8C < 0) { - return state->unk8C; + if (rpc_transfer_buffer->unk8C < 0) { + return rpc_transfer_buffer->unk8C; } - *byte_count = state->unk8; + *byte_count = rpc_transfer_buffer->unk8; i = 0; - if (state->unk8 > 0) { + if (rpc_transfer_buffer->unk8 > 0) { do { - destination[i] = state->payload[i]; + destination[i] = rpc_transfer_buffer->payload[i]; i++; - } while (i < state->unk8); - return state->unk8C; + } while (i < rpc_transfer_buffer->unk8); + return rpc_transfer_buffer->unk8C; } - return *(volatile s32 *)&state->unk8C; + return *(volatile s32 *)&rpc_transfer_buffer->unk8C; } From a6e6072b520b7e8f012285a1cfa280aa609c8345 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:35:26 +0000 Subject: [PATCH 166/657] decomp: clarify names in push_help_history id -> help_entry_id: In push_help_history, id is passed as the first argument to find_help_entry(id, 0, 0), whose declared first parameter is s16. Retail 0x001fed34 and 0x001fed40 sign-extend the incoming low 16 bits before the call at 0x001fed44 to 0x001fecc8. Its returned slot is checked against -1 at 0x001fed50-0x001fed54, searched in active_message_records, and appended at 0x001fee18. Thus the input identifies the help entry to look up, distinct from the returned history slot. --- src/ui/help/push_help_history.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/help/push_help_history.c b/src/ui/help/push_help_history.c index d6e4926ca3..97e227dc09 100644 --- a/src/ui/help/push_help_history.c +++ b/src/ui/help/push_help_history.c @@ -5,11 +5,11 @@ extern s32 find_help_entry(s16, s32, u16 *) __asm__("func_001FECC8"); void push_help_history(s32 id) __asm__("FUN_001fed30"); -void push_help_history(s32 id) { +void push_help_history(s32 help_entry_id) { s32 slot; s32 i; - slot = find_help_entry(id, 0, 0); + slot = find_help_entry(help_entry_id, 0, 0); if (slot == -1) { return; } From a089ab9d1b07c849d363b65dbe0398a3c6ec39d0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:37:25 +0000 Subject: [PATCH 167/657] decomp: clarify names in hero_get_collision_ray_endpoints mode -> use_gravity_direction: Retail 0x002126dc tests a2 and branches to world-z construction when zero; nonzero uses hero.gravity_dir at 0x0013f5e0 in both normalize calls at 0x002126f8 and 0x00212718. Original Ghidra param_5 selects these same branches. Supplied ground-contact caller passes k=1 iff hero.gravity_mode is nonzero, proving gravity-direction selection rather than an unspecified mode. --- src/overlays/shared/hero/hero_switch_item.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index 4be26faf84..522c087aba 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -3292,9 +3292,9 @@ void clip_negative_segment_endpoint_xyz(Vec4_002126b8 *, void *) __asm__("FUN_L0 void hero_get_collision_ray_endpoints(Vec4_002126b8 *, Vec4_002126b8 *, int, float, float) __asm__("FUN_L00_002126b8"); void hero_get_collision_ray_endpoints( - Vec4_002126b8 *ray_start, Vec4_002126b8 *ray_end, int mode, float fa, float fb) { + Vec4_002126b8 *ray_start, Vec4_002126b8 *ray_end, int use_gravity_direction, float fa, float fb) { Vec4_002126b8 ray_scratch_vectors[2]; - if (mode) { + if (use_gravity_direction) { char *up = (char *)&hero.gravity_dir; char *hero_position = up - 0x210; fast_vec_normalize(&ray_scratch_vectors[0], up, -fb); From a9798d11404460b6a85b0e12485c076071f20cc5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:39:21 +0000 Subject: [PATCH 168/657] decomp: clarify names in hud_frame flags -> layout_flags: Retail 0x0023b13c preserves the fifth argument in t4. Tests at 0x0023b16c, 0x0023b1a8 and 0x0023b1c8 select only layout adjustments: bit 1 subtracts half the draw dimensions from x/y at 0x0023b1a0/1a4; bit 2 adds quarter dimensions and halves width/height at 0x0023b1b8-1c4; bit 4 subtracts half the base dimensions and doubles draw dimensions at 0x0023b1d8-1e4. These match the source flags branches and prove position/size layout controls. id -> frame_id: The supplied draw_hud_item_selector_panel caller passes get_icon_frame(...) as this argument. Retail 0x0023b12c preserves it in t6, 0x0023b138 rejects negative indices, 0x0023b144/160/168 indexes the four-byte frame table and reads its descriptor index at +2, and 0x0023b1e8 passes the same index to draw_hud_sprite at 0x0023b1f0. Source uses tab[id].k and draw_hud_sprite(id,...), proving a frame identifier. --- src/overlays/shared/ui/hud/hud_frame.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/ui/hud/hud_frame.c b/src/overlays/shared/ui/hud/hud_frame.c index ff48afb8df..1720b64eac 100644 --- a/src/overlays/shared/ui/hud/hud_frame.c +++ b/src/overlays/shared/ui/hud/hud_frame.c @@ -32,35 +32,35 @@ typedef struct { extern G0023b120 D_L00_0017E4D8; void hud_frame(O0023b120 *o, s32 id, s32 x, s32 y, u32 flags, s32 extra) __asm__("FUN_L00_0023b120"); -void hud_frame(O0023b120 *hud_element, s32 id, s32 x, s32 y, u32 flags, s32 extra) { +void hud_frame(O0023b120 *hud_element, s32 frame_id, s32 x, s32 y, u32 layout_flags, s32 extra) { s32 base_width, base_height, draw_width, draw_height; R0023b120 *image_page; - if (id < 0) + if (frame_id < 0) return; x += hud_element->x; y += hud_element->y; - image_page = &D_L00_0017E4D8.rec[D_L00_0017E4D8.tab[id].k]; + image_page = &D_L00_0017E4D8.rec[D_L00_0017E4D8.tab[frame_id].k]; base_width = 1 << image_page->lw; base_height = 1 << image_page->lh; draw_width = base_width; draw_height = base_height; - if (flags & 1) { + if (layout_flags & 1) { x -= draw_width >> 1; y -= draw_height >> 1; } - if (flags & 2) { + if (layout_flags & 2) { x += draw_width >> 2; y += draw_height >> 2; draw_width >>= 1; draw_height >>= 1; } - if (flags & 4) { + if (layout_flags & 4) { x -= base_width >> 1; y -= base_height >> 1; draw_width <<= 1; draw_height <<= 1; } - draw_hud_sprite(id, x, y, draw_width, draw_height, extra); + draw_hud_sprite(frame_id, x, y, draw_width, draw_height, extra); } extern char *D_L00_001611C0_23b6c0 __asm__("D_L00_001611C0"); From 1d9939ffeb483bef56e6ca34425132935793b5ba Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:39:22 +0000 Subject: [PATCH 169/657] decomp: clarify names in garage_door_update id -> collection_save_id: Authoritative C assigns door_moby->save_id to u16 id and then to s16 save_id_index. Retail lhu a1,0xb2(a2) at 0x002dca7c loads that save ID; 0x002dca80-8c sign-extends it to index the cleared collection byte. The original Ghidra ushort load at param_1+0xb2 agrees. Retail andi a1,a1,0x1f at 0x002dcab0 and srav at 0x002dcabc select its collection bit from the level bitset. Either collection flag enables GARAGE_DOOR_RISING, proving this is the collection save ID. --- src/overlays/shared/props/garage_door.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/props/garage_door.c b/src/overlays/shared/props/garage_door.c index b678e2f442..0371e7042d 100644 --- a/src/overlays/shared/props/garage_door.c +++ b/src/overlays/shared/props/garage_door.c @@ -27,16 +27,16 @@ void garage_door_update(struct Moby *door_moby) { }; Vec4 *target = (Vec4 *)door_moby->pvars; s16 save_id_index; - u16 id; + u16 collection_save_id; switch (door_moby->state) { case GARAGE_DOOR_WAITING_FOR_COLLECTION: /* one quadword copy (lq/sq); qcopy() schedules differently */ target->q = ((Vec4 *)&door_moby->pos)->q; - id = door_moby->save_id; - save_id_index = id; + collection_save_id = door_moby->save_id; + save_id_index = collection_save_id; if (l03_save_state.cleared[save_id_index] == 0) { - if (!((D_0014C190_257218[current_level_index_gp][save_id_index >> 5] >> (id & 0x1F)) & + if (!((D_0014C190_257218[current_level_index_gp][save_id_index >> 5] >> (collection_save_id & 0x1F)) & 1)) return; } From f46173f7c7fb89ddfc5547246a7d6ecc28c18d4f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:39:22 +0000 Subject: [PATCH 170/657] decomp: clarify names in process_gadgebot_interactions state -> gadgebot_private_vars: Retail 0x002f3314 loads s1 from 0x78(s2), matching state = (char *)MOBY(moby)->pvars in the SHA-256-bound source. At 0x002f331c it reads the target moby group from 0x30C(s1), matching GbVars.target_group. Instructions 0x002f334c and 0x002f33a0 pass s1 as the second argument to process_gadgebot_interaction_candidate, whose supplied source accesses position history at +0x2E0/+0x2F0, absorption_owner_moby at +0x304, and path selection at +0x27C. These uses establish the gadgebot-owned private-variable block rather than the separate state byte at moby+0x20. --- src/overlays/shared/enemies/gadgebot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/enemies/gadgebot.c b/src/overlays/shared/enemies/gadgebot.c index c12420fcea..02b4663cb8 100644 --- a/src/overlays/shared/enemies/gadgebot.c +++ b/src/overlays/shared/enemies/gadgebot.c @@ -1575,18 +1575,18 @@ int process_gadgebot_interactions(char *moby, int flag) __asm__("FUN_L06_002f32f int process_gadgebot_interactions(char *moby, int flag) { char **moby_ref; Iter32f0 iter; - char *state; + char *gadgebot_private_vars; int list_id; int *cursor; int interaction_candidate_moby; - state = ((char *)MOBY(moby)->pvars); + gadgebot_private_vars = ((char *)MOBY(moby)->pvars); iter.out = 0; - list_id = *(int *)(state + 0x30C); + list_id = *(int *)(gadgebot_private_vars + 0x30C); if (list_id != -1) { get_first_moby_in_group(&iter.list, list_id, 0, 0); while (iter.list != 0) { - if (process_gadgebot_interaction_candidate(moby, state, iter.list, flag, &iter.out)) + if (process_gadgebot_interaction_candidate(moby, gadgebot_private_vars, iter.list, flag, &iter.out)) return iter.out; get_next_moby_in_group(&iter.list, iter.list, 0, 0); } @@ -1596,7 +1596,7 @@ int process_gadgebot_interactions(char *moby, int flag) { while (interaction_candidate_moby != 0) { moby_ref = &moby; if (process_gadgebot_interaction_candidate( - *moby_ref, state, interaction_candidate_moby, flag, &iter.out)) + *moby_ref, gadgebot_private_vars, interaction_candidate_moby, flag, &iter.out)) return iter.out; cursor++; interaction_candidate_moby = *cursor; From f9b6364f349edf8b3ead69071286fefa720b3e30 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:39:22 +0000 Subject: [PATCH 171/657] decomp: clarify names in count_live_mobys_in_list id -> moby_index: In the SHA-256-bound source, id is *moby_id_cursor & 0x7FFF and both uses shift it by 8 before adding moby_base. Retail 0030aeb8 loads the list halfword, 0030aec4 masks its low 15 bits, and 0030aecc-0030aed0 multiply that index by the 0x100 moby stride and add the array base; 0030af08 reuses that offset to access moby state +0x20. Thus this integer is the moby array index, with the list termination bit removed. --- src/overlays/l13/mobys/group_clear_trigger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l13/mobys/group_clear_trigger.c b/src/overlays/l13/mobys/group_clear_trigger.c index 2ed46cdda0..17213f34b9 100644 --- a/src/overlays/l13/mobys/group_clear_trigger.c +++ b/src/overlays/l13/mobys/group_clear_trigger.c @@ -20,13 +20,13 @@ int count_live_mobys_in_list(int moby_list_index, int excluded_moby_state) { return 0; moby_id_cursor = moby_id_list; do { - int id = *moby_id_cursor & 0x7FFF; - char *moby = (char *)(id << 8) + (int)moby_base; + int moby_index = *moby_id_cursor & 0x7FFF; + char *moby = (char *)(moby_index << 8) + (int)moby_base; if (moby[0x20] >= 0) { char *moby_callback_record = get_moby_suck_cannon_record(moby); if (moby_callback_record == 0 || *(short *)(moby_callback_record + 0x68) < 4) { if (excluded_moby_state == -1 || - *(unsigned char *)((char *)(id << 8) + (int)moby_base + 0x20) != + *(unsigned char *)((char *)(moby_index << 8) + (int)moby_base + 0x20) != excluded_moby_state) { count++; } From 7f4c1c5e8ae457ee9160c161130537a45d0cd9f1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:39:22 +0000 Subject: [PATCH 172/657] decomp: clarify names in patch_shrub_gifs id -> class_id_cursor: In the bound source src/rendering/shrubs/patch_shrub_gifs.c (SHA-256 f8a3e691d9e1a7506db96345c60102d27cd5e74a8d2dc11464ae64ea713e875e), this s32 pointer starts at shrub_gif_patch_class_ids, indexes shrub_render_classes through *id, and advances with id++ until *id is negative. Retail 0x00228a3c initializes a0 to 0x001d8db0; 0x00228a48 loads its ID, 0x00228a54-0x00228a5c scales that ID by four and selects the class pointer from 0x001d7f30. The next-entry pointer is formed at 0x00228a50 and restored at 0x00228b1c, with the negative sentinel checked at 0x00228b20-0x00228b28. Original decompilation piVar4 agrees with this class-ID cursor role. --- src/rendering/shrubs/patch_shrub_gifs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rendering/shrubs/patch_shrub_gifs.c b/src/rendering/shrubs/patch_shrub_gifs.c index eb02fa5bb5..25ba7b39e7 100644 --- a/src/rendering/shrubs/patch_shrub_gifs.c +++ b/src/rendering/shrubs/patch_shrub_gifs.c @@ -13,7 +13,7 @@ extern struct TexRemap shrub_paging_table[] __asm__("D_001D88B0"); void patch_shrub_gifs(void) __asm__("FUN_00228a30"); void patch_shrub_gifs(void) { - s32 *id; + s32 *class_id_cursor; ShrubRenderClass *tc; s32 i; s32 j; @@ -21,8 +21,8 @@ void patch_shrub_gifs(void) { u8 *gif; struct TexRemap *texture_remap; - for (id = shrub_gif_patch_class_ids; *id >= 0; id++) { - tc = shrub_render_classes[*id]; + for (class_id_cursor = shrub_gif_patch_class_ids; *class_id_cursor >= 0; class_id_cursor++) { + tc = shrub_render_classes[*class_id_cursor]; for (i = 0; i < tc->group_count; i++) { pkt = (struct GifPacket *)tc->groups[i].group + 1; gif = (u8 *)(pkt + pkt->skip) + 0x10; From ac002967dd5df09447c8f47d6bf63291194c7458 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:39:22 +0000 Subject: [PATCH 173/657] decomp: clarify names in spawn_moby_joint_attachment id -> attachment_class_id: In the bound C snapshot, id is passed directly to create_moby(id). Retail param_3/a2 moves to a0 at 0x002ecd2c and is passed to the creation call at 0x002ecd30; its return becomes the attachment moby in s1 at 0x002ecd38. Supplied create_moby(s32 oclass) passes this argument to init_moby_instance, proving class selection. The caller qwarks_starfighter_update supplies qwarks_starfighter_attachment_class_ids[i], while update_moby_joint_attachments supplies class 0x191. --- src/overlays/l13/mobys/qwarks_starfighter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index f65fb15492..630f58dac4 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -2405,8 +2405,8 @@ extern char *create_moby(int); extern char *create_moby(int) __asm__("FUN_0020c4f8"); -char *spawn_moby_joint_attachment(char *parent_moby, int attachment_joint_index, int id) { - char *moby = create_moby(id); +char *spawn_moby_joint_attachment(char *parent_moby, int attachment_joint_index, int attachment_class_id) { + char *moby = create_moby(attachment_class_id); if (moby != 0) { char *attachment_vars; float f = From 642a06a2041ce3ff5a66b24003bc18052dab5096 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:41:24 +0000 Subject: [PATCH 174/657] decomp: clarify names in rebuild_magnet_elevator_world_path state -> elevator_private_state: In the authoritative source (src/overlays/l17/mobys/magnet_elevator.c, SHA-256 9140b2ca368c7095eca4e2722488d041b4f6ef470552db39681c99fa42fd3692), state is initialized from moby->pvars. Retail 0x002eeaac loads s5 from 0x78(a0), matching original Ghidra iVar1 = *(int *)(param_1 + 0x78). At 0x002eeabc its +0x80 field selects a record from 0x001b0db0 via the scaled index at 0x002eeacc..0x002eeae0; 0x002eeb2c..0x002eeb34 copies that field to hero.path_constrain_pending. The supplied magnet_elevator_update source uses the same private block for stop heights +0x60/+0x64, velocity +0x68 and voice +0x6c, while the state-machine byte is separately moby+0x20. Thus this is the elevator's private instance state, not a scalar state code. --- src/overlays/l17/mobys/magnet_elevator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l17/mobys/magnet_elevator.c b/src/overlays/l17/mobys/magnet_elevator.c index 58d0b2b1bf..69505d8f19 100644 --- a/src/overlays/l17/mobys/magnet_elevator.c +++ b/src/overlays/l17/mobys/magnet_elevator.c @@ -314,6 +314,6 @@ void rebuild_magnet_elevator_world_path(struct Moby *moby) { *(float *)(world_path_point + 0xC) = 1.0f; world_path_point += 0x10; } - hero.path_constrain_pending = *(unsigned short *)(state + 0x80); + hero.path_constrain_pending = *(unsigned short *)(elevator_private_state + 0x80); } } From 75046fed09d8d33c8546253567cc08b1e772a915 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:41:24 +0000 Subject: [PATCH 175/657] decomp: clarify names in record_moby_context_bytes mode -> key_base_mode: Retail a3 is preserved in s1 at 0x0029b0bc and compared with 1 at 0x0029b0d0: source minus context_moby is formed at 0x0029b0dc, otherwise source minus context +0x78's unsigned halfword at 0x0029b0f4-0x0029b0f8. This proves selection of the relative key base. The signed key is matched at 0x0029b120-0x0029b124 and stored at 0x0029b180. The same binding takes a matched record's +0xA flag at 0x0029b150 and is stored at +0xA on append at 0x0029b198; key_base_mode describes the input role without claiming meanings for other values. --- src/overlays/shared/mobys/record_moby_context_bytes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/mobys/record_moby_context_bytes.c b/src/overlays/shared/mobys/record_moby_context_bytes.c index ddc2ab7e6b..6b78292e01 100644 --- a/src/overlays/shared/mobys/record_moby_context_bytes.c +++ b/src/overlays/shared/mobys/record_moby_context_bytes.c @@ -28,7 +28,7 @@ void record_moby_context_bytes(char *source, void record_moby_context_bytes( - char *source, int byte_count, char *context_moby, int mode, Table *entry_table) { + char *source, int byte_count, char *context_moby, int key_base_mode, Table *entry_table) { enum { MOBY_CONTEXT_MODE_MOBY_RELATIVE = 1 }; @@ -38,7 +38,7 @@ void record_moby_context_bytes( int i; Entry *e; Entry *ne; - if (mode == MOBY_CONTEXT_MODE_MOBY_RELATIVE) { + if (key_base_mode == MOBY_CONTEXT_MODE_MOBY_RELATIVE) { key = source - context_moby; } else { key = (int)source - *(unsigned short *)(context_moby + 0x78); @@ -46,8 +46,8 @@ void record_moby_context_bytes( for (i = 0; i < entry_table->n; i++) { e = &entry_table->e[i]; if (e->key == key && e->a == byte_count && v20 == e->c && v19 == e->d) { - mode = e->flag; - if (mode) { + key_base_mode = e->flag; + if (key_base_mode) { copy_memory_aligned((int)&e->pad4, source, byte_count); return; } @@ -58,7 +58,7 @@ void record_moby_context_bytes( ne->key = key; copy_memory_aligned((int)&ne->pad4, source, byte_count); ne->a = byte_count; - ne->flag = mode; + ne->flag = key_base_mode; ne->c = v20; ne->d = v19; } From 0f38d9f6ce496468794c9b54406fe467d5e53f27 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:41:24 +0000 Subject: [PATCH 176/657] decomp: clarify names in set_beam_origin_transform_and_endpoint id -> beam_owner_moby_id: Retail 002e219c saves entry a0 in t1; 002e21e0/002e21e4 compare it against entries at 00161c88, advancing that table by 4 bytes at 002e2234 across three slots. Only a matching entry permits state updates and transform/endpoint copies. The authoritative C names that table beam_slot_id; beam_slots_update accesses its level-relative counterpart as a moby and tests byte +0x20, while draw_beam_strand_with_glow dereferences beam_slot_id[slot]+0xA6 as a moby class. Thus the argument is the registered beam owner moby key, not the loop's slot index. --- src/overlays/shared/rendering/effects/beam_slots.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/effects/beam_slots.c b/src/overlays/shared/rendering/effects/beam_slots.c index 2666ac7c78..c2a3b69001 100644 --- a/src/overlays/shared/rendering/effects/beam_slots.c +++ b/src/overlays/shared/rendering/effects/beam_slots.c @@ -306,13 +306,13 @@ void release_beam_slot(s32 i) { s32 set_beam_origin_transform_and_endpoint(s32 id, void *src, void *v) __asm__("FUN_L00_002e2190"); -s32 set_beam_origin_transform_and_endpoint(s32 id, +s32 set_beam_origin_transform_and_endpoint(s32 beam_owner_moby_id, void *beam_origin_transform, void *endpoint_position) { s32 i; for (i = 0; i < 3; i++) { - if (id == beam_slot_id[i]) { + if (beam_owner_moby_id == beam_slot_id[i]) { if (beam_slot_state[i] == 1) beam_slot_state[i] = 2; else if (beam_slot_state[i] == 4) From aed33cb2a11a7c5ccca3acde4d1dfdde4e098d4c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:41:24 +0000 Subject: [PATCH 177/657] decomp: clarify names in giant_clank_hit_sphere_update state -> hit_sphere_vars: In the authoritative source state = (char *)moby->pvars. Retail 0x0029eb08 loads s3 from moby+0x78, matching original Ghidra pfVar1. 0x0029eb10-0x0029eb18 reads its +0 float into the sphere scale update; 0x0029eb34-0x0029eb68 uses its +8 timer to fade alpha; 0x0029ebb4-0x0029ebc8 passes that timer to fast_dec_timer and removes this moby on expiry. Its +0xC float feeds the hit call via 0x0029eb6c-0x0029ebac. These accesses prove this is the hit sphere's private variable record. --- .../shared/vehicles/giant_clank_hit_sphere.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/vehicles/giant_clank_hit_sphere.c b/src/overlays/shared/vehicles/giant_clank_hit_sphere.c index 00fd9417f6..cb9c35ce33 100644 --- a/src/overlays/shared/vehicles/giant_clank_hit_sphere.c +++ b/src/overlays/shared/vehicles/giant_clank_hit_sphere.c @@ -59,26 +59,26 @@ void giant_clank_hit_sphere_update(struct Moby *moby) __asm__("FUN_L15_0029ead0" /* Moby class 1427 */ void giant_clank_hit_sphere_update(struct Moby *moby) { char *moby_class = moby->pclass; - char *state = (char *)moby->pvars; + char *hit_sphere_vars = (char *)moby->pvars; float half_relative_scale = moby->scale / *(float *)(moby_class + 0x24) * 0.5f; char *pos; struct Hero *globals; - half_relative_scale = half_relative_scale + *(float *)state; + half_relative_scale = half_relative_scale + *(float *)hit_sphere_vars; moby->scale = half_relative_scale + half_relative_scale; moby->scale = moby->scale * *(float *)(moby_class + 0x24); - if (*(int *)(state + 8) < scale_game_frames(0x28)) - moby->alpha = *(int *)(state + 8) * 127 / scale_game_frames(0x28); + if (*(int *)(hit_sphere_vars + 8) < scale_game_frames(0x28)) + moby->alpha = *(int *)(hit_sphere_vars + 8) * 127 / scale_game_frames(0x28); globals = &hero; pos = &moby->pos; play_entity_sound(half_relative_scale, ((char *)globals->moby), pos, - (float)truncate_float_to_s32(*(float *)(state + 0xC)), + (float)truncate_float_to_s32(*(float *)(hit_sphere_vars + 0xC)), 1.0f, 0x30000, 0, 1, 0); - if (fast_dec_timer((int *)(state + 8))) + if (fast_dec_timer((int *)(hit_sphere_vars + 8))) mark_moby_for_removal(moby); } From efacbd8918a24544e1c31072c8b6dd7348bfc636 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:43:12 +0000 Subject: [PATCH 178/657] decomp: clarify names in sceSifBindRpc mode -> completion_mode: Retail 0x0011b01c saves argument a2 in s2; 0x0011b040 masks s2 with 1 and 0x0011b054 branches on that bit. Bit clear creates a semaphore at 0x0011b068, stores its ID in client at 0x0011b074, then waits at 0x0011b0c8 and deletes it after a successful send. Bit set stores -1 in the client semaphore slot at 0x0011b0e8 and sends without waiting at 0x0011b100. The supplied original Ghidra decompilation and C mode & 1 branch agree: this parameter selects bind completion mode. --- src/sdk/rpc/rpc/sce_sif_bind_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdk/rpc/rpc/sce_sif_bind_rpc.c b/src/sdk/rpc/rpc/sce_sif_bind_rpc.c index c79866e0e5..0ea2e433e0 100644 --- a/src/sdk/rpc/rpc/sce_sif_bind_rpc.c +++ b/src/sdk/rpc/rpc/sce_sif_bind_rpc.c @@ -17,7 +17,7 @@ extern s32 DeleteSema(); extern s32 WaitSema(); extern s32 get_available_rpc_packet() __asm__("func_0011ACE8"); -s32 sceSifBindRpc(struct sceSifClientData *client, s32 rpc_number, s32 mode) { +s32 sceSifBindRpc(struct sceSifClientData *client, s32 rpc_number, s32 completion_mode) { s32 sema_param[6]; s32 sema_id; struct SifRpcPacket *packet; From 47bd44c0fbc356f8cf1a2e884b96a076a9e37034 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:45:07 +0000 Subject: [PATCH 179/657] decomp: clarify names in sceMcGetDir mode -> continue_search: Original Ghidra param_4 and retail 0x00123f18 save the fourth argument in s3; 0x00123f94 stores it unchanged at directory request +8 for command 0xD. Supplied memcard_update_state case MEMCARD_DELETE_REQUEST_FIRST_DIRECTORY_ENTRY calls sceMcGetDir(CARD.port, CARD.slot, D_0013D1E8, 0, 1, D_001A0880); MEMCARD_DELETE_REQUEST_NEXT_DIRECTORY_ENTRY passes the same arguments with this fourth argument changed to 1. These checked caller roles prove zero starts the search and one continues enumeration. --- src/sdk/storage/memory_card/sce_mc_get_dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdk/storage/memory_card/sce_mc_get_dir.c b/src/sdk/storage/memory_card/sce_mc_get_dir.c index 477cb66d91..94921031b3 100644 --- a/src/sdk/storage/memory_card/sce_mc_get_dir.c +++ b/src/sdk/storage/memory_card/sce_mc_get_dir.c @@ -20,7 +20,7 @@ extern s32 SignalSema(); extern s32 sceSifWriteBackDCache(); extern s32 strncpy(s8 *, s8 *, s32); -s32 sceMcGetDir(s32 port, s32 slot, s8 *name, s32 mode, s32 maxent, s32 table) { +s32 sceMcGetDir(s32 port, s32 slot, s8 *name, s32 continue_search, s32 maxent, s32 table) { enum { RPC_SUBMISSION_SUCCESS = 0 }; From 455da0a8363fda2be1135afa2d4a177292680ca4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:45:08 +0000 Subject: [PATCH 180/657] decomp: clarify names in sceMcOpen mode -> open_flags: Retail 0x001235d8 saves a3 in s3; 0x00123650 stores s3 at offset 8 of the request, matching request->flags = mode in the bound source. At 0x00123674 the RPC mode is independently set to 1. sceMcMkdir passes 0x40 as this fourth argument, while the memory-card open caller passes 1, proving these are open-operation flags. --- src/sdk/storage/memory_card/sce_mc_open.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/storage/memory_card/sce_mc_open.c b/src/sdk/storage/memory_card/sce_mc_open.c index 8fed75e4b9..30c3357ec5 100644 --- a/src/sdk/storage/memory_card/sce_mc_open.c +++ b/src/sdk/storage/memory_card/sce_mc_open.c @@ -17,7 +17,7 @@ extern s32 PollSema(); extern s32 SignalSema(); extern char *strncpy(); -s32 sceMcOpen(s32 port, s32 slot, char *name, s32 mode) { +s32 sceMcOpen(s32 port, s32 slot, char *name, s32 open_flags) { struct MemoryCardNameParam *request; s32 rpc_result; @@ -34,7 +34,7 @@ s32 sceMcOpen(s32 port, s32 slot, char *name, s32 mode) { strncpy(D_00159AC4, name, 0x3FF); request = (struct MemoryCardNameParam *)(D_00159AC4 - 0x14); request->port = port; - request->flags = mode; + request->flags = open_flags; request->slot = slot; request->name[0x3FF] = 0; rpc_result = From 63d53e470d8483e69038f224523a4cf375edc90b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:47:03 +0000 Subject: [PATCH 181/657] decomp: clarify names in _extensionAndUserData id -> extension_id: In src/sdk/mpeg/headers/_extensionAndUserData.c (SHA-256 b4dfc470c52ed0341e24fd49cf8240b73805d6bf7c2b1007762b1c5f3076fbd2), id is assigned _nextBit(decoder_state, 4) only after extension start code 0x1B5 is consumed. Retail 0x00128dd4-0x00128dd8 reads those four bits; 0x00128ddc-0x00128de0 maps identifiers above ten to zero; 0x00128de4-0x00128df4 indexes the copied eleven-entry extension handler table and calls the selected handler. This proves the binding is the normalized MPEG extension identifier. --- src/sdk/mpeg/headers/_extensionAndUserData.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/mpeg/headers/_extensionAndUserData.c b/src/sdk/mpeg/headers/_extensionAndUserData.c index cabb7dbdbe..c5e9002a49 100644 --- a/src/sdk/mpeg/headers/_extensionAndUserData.c +++ b/src/sdk/mpeg/headers/_extensionAndUserData.c @@ -38,15 +38,15 @@ const ExtTable mpeg_extension_dispatch_table __asm__("D_001538B8") = { void _extensionAndUserData(void *decoder_state) { ExtTable extension_handlers = mpeg_extension_dispatch_table; u32 code; - u32 id; + u32 extension_id; _nextStartCode(decoder_state); while ((code = _peepBit(decoder_state, 32)) == 0x1B5 || code == 0x1B2) { if (code == 0x1B5) { _flushBuf(decoder_state, 32); - id = _nextBit(decoder_state, 4); - id = id > 10 ? 0 : id; - extension_handlers.f[id](decoder_state); + extension_id = _nextBit(decoder_state, 4); + extension_id = extension_id > 10 ? 0 : extension_id; + extension_handlers.f[extension_id](decoder_state); _nextStartCode(decoder_state); } else { _flushBuf(decoder_state, 32); From 240be3316f50ef891685e891a6cbebed771bfb6a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:47:03 +0000 Subject: [PATCH 182/657] decomp: clarify names in draw_number flags -> frame_and_blend_flags: Original Ghidra param_6 is the source flags byte, masked into s1 at 0x002857a8. For kind 0xFF, 0x002857f8-0x0028580c shift its high three bits right by 5, multiply by 16, add truncate_float_to_s32(4.0f), and store particle+9; 0x002857fc and 0x00285808-0x00285824 use bit zero to select 0x48 or 0x44 at particle+3. Otherwise 0x00285828 copies the byte directly to particle+9. The authoritative source comment explicitly identifies these as frame derivation and two blend modes, proving frame_and_blend_flags rather than bare flags. --- .../shared/rendering/effects/spawn_type_10_particle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/rendering/effects/spawn_type_10_particle.c b/src/overlays/shared/rendering/effects/spawn_type_10_particle.c index 8c362b85d5..d1a129db52 100644 --- a/src/overlays/shared/rendering/effects/spawn_type_10_particle.c +++ b/src/overlays/shared/rendering/effects/spawn_type_10_particle.c @@ -94,7 +94,7 @@ char *draw_number(float scale, int source_moby, int number_table_index, int particle_color, - unsigned char flags, + unsigned char frame_and_blend_flags, short particle_lifetime, unsigned char kind) { @@ -107,14 +107,14 @@ char *draw_number(float scale, qcopy(particle + 0x10, particle_spawn_position); *(int *)(particle + 4) = particle_color; if (kind == DRAW_NUMBER_KIND_FROM_FLAGS) { - particle[9] = (flags >> 5) * 16 + truncate_float_to_s32(4.0f); - if (flags & 1) { + particle[9] = (frame_and_blend_flags >> 5) * 16 + truncate_float_to_s32(4.0f); + if (frame_and_blend_flags & 1) { particle[3] = 0x48; } else { particle[3] = 0x44; } } else { - particle[9] = flags; + particle[9] = frame_and_blend_flags; particle[3] = kind; } particle[1] = 0; From 19ed55a760cf54a5bae689e2cbcedd8de50844d8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:47:04 +0000 Subject: [PATCH 183/657] decomp: clarify names in spawn_timed_hero_relative_particle mode -> position_mode: Retail 00272fa4 retains t2 (original Ghidra param_8) in s1. At 00272fc8-00272fe0 it stores this argument at particle+0x30, compares it with 1, and conditionally subtracts D_0013F3D0 from input position into particle+0x20. Authoritative C stores mode in particle_data[4] and tests PARTICLE_MODE_HERO_RELATIVE before fast_vec_sub. The supplied update_timed_hero_relative_particle tests that same payload+0x10 word and reconstructs particle->pos from hero.motion.pos plus the stored offset. Therefore this argument selects the particle position reference mode, distinct from the separate flag controlling header+3. --- src/overlays/shared/rendering/effects/particles.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index d3d836d898..edb31f5568 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -937,7 +937,7 @@ unsigned char *spawn_timed_hero_relative_particle(u128 *position, int particle_texture_index, int flag, int lifetime_frames, - int mode, + int position_mode, float size_scale) { enum { @@ -946,8 +946,8 @@ unsigned char *spawn_timed_hero_relative_particle(u128 *position, unsigned char *particle = create_part(0x3B); if (particle) { int *particle_data = (int *)(particle + 0x20); - particle_data[4] = mode; - if (mode == PARTICLE_MODE_HERO_RELATIVE) + particle_data[4] = position_mode; + if (position_mode == PARTICLE_MODE_HERO_RELATIVE) fast_vec_sub(particle_data, position, D_0013F3D0); qcopy(particle + 0x10, position); *(int *)(particle + 4) = packed_color; From a8f1ce742b670fefe7bd4acf701c32aae0a4c049 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:49:03 +0000 Subject: [PATCH 184/657] decomp: clarify names in set_up_vis_gif_viewer mode -> material_index: Source mode * 3 indexes the three u64 words of resident_material_templates. Retail 0x00202fd0..0x00203018 computes its 24-byte stride and tests its sign; 0x00203044..0x0020305c packs it at bit 24 of material control; 0x00203070..0x0020308c selects negative special templates. Original Ghidra calls this argument lMaterialIndex and uses it to index the material-template array. --- src/rendering/packets/set_up_vis_gif_viewer.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/rendering/packets/set_up_vis_gif_viewer.c b/src/rendering/packets/set_up_vis_gif_viewer.c index 94e07e7172..3b19524b49 100644 --- a/src/rendering/packets/set_up_vis_gif_viewer.c +++ b/src/rendering/packets/set_up_vis_gif_viewer.c @@ -15,7 +15,7 @@ void set_up_vis_gif_viewer(u64 *packet_destination, s32 material_control_base, s32 material_control_shift2, - s32 mode) { + s32 material_index) { enum { FIRST_REGULAR_MATERIAL_INDEX = 0 }; @@ -24,21 +24,21 @@ void set_up_vis_gif_viewer(u64 *packet_destination, u64 template_texture_state1; u64 *selected_special_material_template; - template_texture_state0 = resident_material_templates[mode * 3]; - template_draw_control_bits = resident_material_templates[mode * 3 + 1]; - template_texture_state1 = resident_material_templates[mode * 3 + 2]; - if (mode >= FIRST_REGULAR_MATERIAL_INDEX) { + template_texture_state0 = resident_material_templates[material_index * 3]; + template_draw_control_bits = resident_material_templates[material_index * 3 + 1]; + template_texture_state1 = resident_material_templates[material_index * 3 + 2]; + if (material_index >= FIRST_REGULAR_MATERIAL_INDEX) { packet_destination[0] = (0x20 | (template_draw_control_bits & 0x1C)) | ((u64)prim << 6) | ((u64)(u32)draw_control_high_word << 32); packet_destination += 2; packet_destination[0] = - (material_control_base | ((u64)material_control_shift2 << 2)) | ((u64)mode << 24); + (material_control_base | ((u64)material_control_shift2 << 2)) | ((u64)material_index << 24); packet_destination += 2; packet_destination[0] = template_texture_state0; packet_destination[2] = template_texture_state1; - } else if (mode < -1) { + } else if (material_index < -1) { selected_special_material_template = special_material_template; - if (mode == -3) { + if (material_index == -3) { selected_special_material_template = alternate_special_material_template; } packet_destination[0] = From f7555445f3cdf4c89062ea2283e032c5b79a8932 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:49:03 +0000 Subject: [PATCH 185/657] decomp: clarify names in tresspasser_door2_update id -> linked_moby_index: In tresspasser_door2_update, id is loaded from tresspasser_door2_vars+0x10. Retail 0x002e01a0 loads that word, 0x002e01a4 rejects negative indices, and 0x002e01ac-0x002e01b4 shifts it left by 8 and adds the moby-array base. The resulting linked_moby supplies oclass at +0xA6 and state at +0x20 (0x002e01b8-0x002e01d4), proving this is the linked moby's array index. --- src/overlays/l02/mobys/tresspasser_door2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l02/mobys/tresspasser_door2.c b/src/overlays/l02/mobys/tresspasser_door2.c index 7d77133b64..63013510c6 100644 --- a/src/overlays/l02/mobys/tresspasser_door2.c +++ b/src/overlays/l02/mobys/tresspasser_door2.c @@ -33,9 +33,9 @@ void tresspasser_door2_update(struct Moby *moby) { moby->state = TRESSPASSER_DOOR2_WAIT_FOR_LINKED_MOBY; break; case TRESSPASSER_DOOR2_WAIT_FOR_LINKED_MOBY: { - int id = *(int *)(tresspasser_door2_vars + 0x10); - if (id >= 0) { - char *linked_moby = (char *)((id << 8) + *(int *)&D_L02_0015FFD8_c3); + int linked_moby_index = *(int *)(tresspasser_door2_vars + 0x10); + if (linked_moby_index >= 0) { + char *linked_moby = (char *)((linked_moby_index << 8) + *(int *)&D_L02_0015FFD8_c3); int linked_moby_class = MOBY(linked_moby)->oclass; if (linked_moby_class == 0x267 || linked_moby_class == 0x23F) { if (((unsigned char *)linked_moby)[0x20] == 4) From 886ee7559f98bcda0933b3590786d21271560697 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:49:03 +0000 Subject: [PATCH 186/657] decomp: clarify names in tracked_group_watcher_update id -> tracked_moby_index: In the authoritative C, id = ids[i], where ids = moby_vars + 4. Retail 0x0030bf28 loads this tracked-list entry, 0x0030bf2c rejects -1, 0x0030bf3c shifts it left by 8, and 0x0030bf40 adds moby_base. The resulting pointer supplies the tracked moby's class at +0xA6 and state at +0x20 (0x0030bf4c-0x0030bf68), proving this is a tracked moby array index. --- src/overlays/l13/mobys/tracked_group_watcher.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l13/mobys/tracked_group_watcher.c b/src/overlays/l13/mobys/tracked_group_watcher.c index e21f513321..8369919114 100644 --- a/src/overlays/l13/mobys/tracked_group_watcher.c +++ b/src/overlays/l13/mobys/tracked_group_watcher.c @@ -37,11 +37,11 @@ void tracked_group_watcher_update(struct Moby *moby) { int valid_tracked_moby_count = 0; int i; for (i = 0; i < 8; i++) { - int id = ids[i]; + int tracked_moby_index = ids[i]; int saved_moby_class; unsigned char *o; - if (id != -1 && (saved_moby_class = cls[i]) != -1) { - o = (unsigned char *)(base + (id << 8)); + if (tracked_moby_index != -1 && (saved_moby_class = cls[i]) != -1) { + o = (unsigned char *)(base + (tracked_moby_index << 8)); if (o != 0 && *(short *)(o + 0xA6) == saved_moby_class && o[0x20] != 0xFE && o[0x20] != 0xFD) { valid_tracked_moby_count++; From e36ab483725f52f2f469f4e3844903a75a2f8536 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:49:03 +0000 Subject: [PATCH 187/657] decomp: clarify names in blend_moby_animation_ex flags -> pose_slot_and_flags: At retail 0x00213154 the allocator result is retained in s1; 0x00213160-0x00213164 forms a1 as s1 | 0x100 when options bit 0 is set, otherwise s1. This is the source flags binding. At 0x00213168-0x00213178 options bit 1 optionally adds 0x200 before passing a1 to FUN_0020ede8 (prepare_resident_pose_buffer in the supplied Ghidra). The same s1 indexes D_001B2C00 in 16-byte units at 0x00213180-0x00213194 and is stored as the primary slot at 0x002131ac, proving the local packs a pose slot and flags. --- src/mobys/animation/blend_moby_animation_ex.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mobys/animation/blend_moby_animation_ex.c b/src/mobys/animation/blend_moby_animation_ex.c index 0ec832cc7b..4e0eccdefb 100644 --- a/src/mobys/animation/blend_moby_animation_ex.c +++ b/src/mobys/animation/blend_moby_animation_ex.c @@ -30,15 +30,15 @@ void blend_moby_animation_ex( MobyAnim *moby, int new_seq, int frame_index, int blend_frames, int options) { int slot; - int flags; + int pose_slot_and_flags; unsigned char oldSeq; float scale; if (moby->anim_time > 0.025f || moby->pose_layers != 0 || moby->manips != 0 || (options & 4)) { slot = find_or_allocate_moby_render_slot((int)moby); if (slot >= 0) { - flags = (options & 1) ? (slot | 0x100) : slot; - FUN_0020ede8(moby, (options & 2) ? (flags | 0x200) : flags); + pose_slot_and_flags = (options & 1) ? (slot | 0x100) : slot; + FUN_0020ede8(moby, (options & 2) ? (pose_slot_and_flags | 0x200) : pose_slot_and_flags); qcopy(D_001B2C00 + slot * 0x10, moby->unkF0); oldSeq = moby->seq; if (oldSeq != 0xFF) { From 7e9518fe36285b495c180fff94425aa49a159f56 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:51:37 +0000 Subject: [PATCH 188/657] decomp: clarify names in dmaRefImage id -> second_tag_id: In the bound dma_ref_image.c snapshot (SHA-256 80071996fcaf29130437087a831bc72037168985184dc86c0c76ff32002dfc3f), id is 3 unless i == count - 1, when it is 0; it is shifted by 28 and ORed only into tag[2]. Retail 0x0012a01c compares the entry index with count-1; 0x0012a028/0x0012a030 select 3 or 0; 0x0012a038 shifts that selection by 28; 0x0012a070 merges it into the second tag, stored at tag+0x10 at 0x0012a084. Thus second_tag_id identifies the exact tag field and distinguishes it from buffer selection. --- src/sdk/mpeg/ref_images/dma_ref_image.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/mpeg/ref_images/dma_ref_image.c b/src/sdk/mpeg/ref_images/dma_ref_image.c index ac032f0997..066a4a2bf3 100644 --- a/src/sdk/mpeg/ref_images/dma_ref_image.c +++ b/src/sdk/mpeg/ref_images/dma_ref_image.c @@ -35,7 +35,7 @@ void dmaRefImage(MpegRefImageState *state) { u64 *tag; s32 count; s32 interrupts; - s32 id; + s32 second_tag_id; u32 address; u64 first_tag; @@ -47,12 +47,12 @@ void dmaRefImage(MpegRefImageState *state) { first_tag = ((u64)(state->buffers[state->index].first_source[i] & 0x0fffffff) << 32) | 0x30000030; address = state->buffers[state->index].second_source[i]; - id = 3; + second_tag_id = 3; if (i == count - 1) { - id = 0; + second_tag_id = 0; } tag[0] = first_tag; - tag[2] = ((u64)(address & 0x0fffffff) << 32) | ((u64)id << 28) | 0x30; + tag[2] = ((u64)(address & 0x0fffffff) << 32) | ((u64)second_tag_id << 28) | 0x30; tag += 4; i++; } while (i < count); From 972d4e15acdce183c8971e671a47460c13a1fb59 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:53:34 +0000 Subject: [PATCH 189/657] decomp: clarify names in _getpic status -> decode_or_skip_result: In the authoritative source, status is assigned exclusively the scan initializer and _decodeOrSkip returns. Retail s2 is initialized to zero at 0x0012bca4; _decodeOrSkip calls at 0x0012bd68, 0x0012bd8c and 0x0012bdb0 store v0 into s2 at 0x0012bd74, 0x0012bd98 and 0x0012bdbc. The comparison at 0x0012bce8 tests s2 against -1 and bypasses _nextHeader to dispatch on equality, proving it carries the decode-or-skip result. --- src/sdk/mpeg/picture/_getpic.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sdk/mpeg/picture/_getpic.c b/src/sdk/mpeg/picture/_getpic.c index 85c8062a9d..f68f5f0fea 100644 --- a/src/sdk/mpeg/picture/_getpic.c +++ b/src/sdk/mpeg/picture/_getpic.c @@ -19,12 +19,12 @@ s32 _getpic(struct sceMpeg *mpeg) { MPEG_DECODE_SCAN_NEXT_HEADER = 0 }; s32 image_addr; - s32 status; + s32 decode_or_skip_result; u32 start_code; struct MpegDecoder *decoder; start_code = 1; - status = MPEG_DECODE_SCAN_NEXT_HEADER; + decode_or_skip_result = MPEG_DECODE_SCAN_NEXT_HEADER; decoder = mpeg->sys; image_addr = decoder->unkD8; decoder->is_end = 0; @@ -34,7 +34,7 @@ s32 _getpic(struct sceMpeg *mpeg) { } decoder->picture_ready = 0; do { - if (status == -1) { + if (decode_or_skip_result == -1) { goto dispatch; } do { @@ -56,16 +56,16 @@ s32 _getpic(struct sceMpeg *mpeg) { decoder->picture_count_b = 0; decoder->picture_count_p = 0; decoder->picture_count_i = 0; - status = _decodeOrSkip(mpeg, 0, decoder->decode_count_i); + decode_or_skip_result = _decodeOrSkip(mpeg, 0, decoder->decode_count_i); decoder->picture_count_i = (s32)(decoder->picture_count_i + 1); break; case MPEG_PREDICTIVE_PICTURE: - status = _decodeOrSkip(mpeg, decoder->picture_count_p, decoder->decode_count_p); + decode_or_skip_result = _decodeOrSkip(mpeg, decoder->picture_count_p, decoder->decode_count_p); decoder->picture_count_p = (s32)(decoder->picture_count_p + 1); break; case MPEG_BIDIRECTIONAL_PICTURE: case MPEG_DC_INTRA_PICTURE: - status = _decodeOrSkip(mpeg, decoder->picture_count_b, decoder->decode_count_b); + decode_or_skip_result = _decodeOrSkip(mpeg, decoder->picture_count_b, decoder->decode_count_b); decoder->picture_count_b = (s32)(decoder->picture_count_b + 1); break; } From 44063ac5a160a7dd867a5a8f62774c8794bbe02e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:53:34 +0000 Subject: [PATCH 190/657] decomp: clarify names in update_menu_help_text_load state -> help_text_state: In the bound source, this HelpState pointer is assigned &help_state and its count is saved to menu->data.help.saved_text_count before entry_count is installed. Retail 0x0021d418-0x0021d430 constructs base 0x001996d0, reads its +0x2c count, saves it to menu+0x38 and replaces it with s1 from the language header (0x0021d3f0). Original Ghidra identifies the count as DAT_001996fc; 0x0021d460-0x0021d468 reads that count to bound relocation of the installed help-text entries. --- src/ui/menus/widgets/update_menu_help_text_load.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/menus/widgets/update_menu_help_text_load.c b/src/ui/menus/widgets/update_menu_help_text_load.c index 20832e43da..9f36b6973c 100644 --- a/src/ui/menus/widgets/update_menu_help_text_load.c +++ b/src/ui/menus/widgets/update_menu_help_text_load.c @@ -46,15 +46,15 @@ int update_menu_help_text_load(struct MenuScreen *menu) { int *language_entries = (int *)((char *)archive + archive[game_language]); int entry_count = *language_entries++; int entry_bytes = *language_entries++; - HelpState *state; + HelpState *help_text_state; int *text_entries; int i; copy_memory_aligned(archive, language_entries, ((entry_bytes + 3) & ~3) - 8); - state = &help_state; + help_text_state = &help_state; menu->data.help.saved_text_table = help_msgs; - menu->data.help.saved_text_count = state->count; - state->count = entry_count; + menu->data.help.saved_text_count = help_text_state->count; + help_text_state->count = entry_count; text_entries = (int *)menu_system_state->help_text_buffer; help_msgs = (int)text_entries; for (i = 0; i < help_text_count(); i++) { From 8345ed8a61ac3a18aa9050082aa2063f626cd2de Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:55:37 +0000 Subject: [PATCH 191/657] decomp: clarify names in initialize_menu_stream_buffers mode -> use_full_buffer_layout: At 0x00225acc the incoming a0 is tested only for zero. Zero sets primary/secondary/large counts to 1/0/0 at 0x00225ad4-0x00225ae0; nonzero sets 2/1/2 at 0x00225ae4-0x00225aec. Stores at 0x00225b18, 0x00225b60, and 0x00225bb0 populate all five descriptors for nonzero, whereas 0x00225bf0/0x00225bf8 clear the four residual descriptors for zero. This proves selection of the full buffer layout without assigning a higher-level subsystem meaning. --- src/ui/menus/stream_buffers/initialize_menu_stream_buffers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/menus/stream_buffers/initialize_menu_stream_buffers.c b/src/ui/menus/stream_buffers/initialize_menu_stream_buffers.c index 5694d8a05e..c6482b14e8 100644 --- a/src/ui/menus/stream_buffers/initialize_menu_stream_buffers.c +++ b/src/ui/menus/stream_buffers/initialize_menu_stream_buffers.c @@ -9,7 +9,7 @@ void initialize_menu_stream_buffers(s32 mode) __asm__("FUN_00225ac0"); * and two further primary descriptors. Address strides are 0x11800 for * the first two groups and 0x4F000 for the final group. The flag word * is one only for the final group. */ -void initialize_menu_stream_buffers(s32 mode) { +void initialize_menu_stream_buffers(s32 use_full_buffer_layout) { enum { MENU_STREAM_MODE_SINGLE_PRIMARY_BUFFER = 0 }; From db9640a9d41165c0687a250136685de048e0541b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:55:37 +0000 Subject: [PATCH 192/657] decomp: clarify names in move_moby_with_sphere_collision flags -> collision_query_flags: In the authoritative helicopter.c snapshot (SHA-256 9a5ca9bc6644c3f1e8e23fb2c793c701e1f659156d0b83b92af088b214b6c357), flags is used only by mask = (flags << 1) & 0x20, then mask | 4 is passed to coll_sphere. Retail 0x00247eb4 saves a2 into s0; 0x00247f10 shifts s0 left one and 0x00247f24 masks it with 0x20. At 0x00247f3c the result is ORed with 4 into a1 for the sphere-query call at 0x00247f48. The supplied original Ghidra decompilation agrees: (param_5 & 0x10) << 1 | 4 feeds the collision helper. This proves collision-query flags, without identifying the bit's policy semantics. --- src/overlays/l15/mobys/helicopter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l15/mobys/helicopter.c b/src/overlays/l15/mobys/helicopter.c index 6c8137f150..17d7deb98f 100644 --- a/src/overlays/l15/mobys/helicopter.c +++ b/src/overlays/l15/mobys/helicopter.c @@ -100,7 +100,7 @@ int move_moby_with_sphere_collision(struct Moby *moving_moby, int move_moby_with_sphere_collision( - struct Moby *moving_moby, u128 *delta, int flags, float step, float radius) { + struct Moby *moving_moby, u128 *delta, int collision_query_flags, float step, float radius) { Vec4 start; Vec4 probe; int pushed = 0; @@ -111,7 +111,7 @@ int move_moby_with_sphere_collision( fast_vec_add(&moving_moby->pos, &moving_moby->pos, delta); i = 0; do { - mask = (flags << 1) & 0x20; + mask = (collision_query_flags << 1) & 0x20; qcopy(&probe, &moving_moby->pos); probe.f[2] += step; if (coll_sphere(&probe, radius, mask | 4, moving_moby) == 0) { From 36b52c986117d415ff3abf7bd3796d126e9ca201 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:55:38 +0000 Subject: [PATCH 193/657] decomp: clarify names in spawn_rocket_explosion flags -> rocket_kind_flags: Source create_rocket_moby stores its int kind at rocket_private_vars+0x38. This local loads that same pvars+0x38 word: retail 0x002d5638 loads moby+0x78 and 0x002d5640 loads +0x38 (original Ghidra uVar1). Mask 1 at 0x002d5644 selects effect_scale and the two effect arguments through 0x002d5684; mask 4 at 0x002d567c selects hit_radius 1.5/0 at 0x002d5688-0x002d5698. The caller also tests the same stored flags for target pulse and preserves bit 4 on a selected collision. Thus this is the rocket's stored kind bitfield, not an effect-helper output or temporary comparison. --- src/overlays/l18/mobys/rocket.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l18/mobys/rocket.c b/src/overlays/l18/mobys/rocket.c index dce0f0ce94..f7d8fe0109 100644 --- a/src/overlays/l18/mobys/rocket.c +++ b/src/overlays/l18/mobys/rocket.c @@ -267,14 +267,14 @@ void spawn_rocket_explosion(void *moby_object, void *movement_step) { char *moby = moby_object; float movement_step_copy[4]; float *qp = movement_step_copy; - int flags; + int rocket_kind_flags; float flag_selected_effect_scalar, flag_selected_effect_argument, effect_scale, hit_radius, e; *(OvlQuad *)qp = *(OvlQuad *)movement_step; - flags = *(int *)(((char *)MOBY(moby)->pvars) + 0x38); - effect_scale = (flags & 1) ? 2.0f : 0.75f; - flag_selected_effect_scalar = (flags & 1) ? 4.0f : 2.0f; - flag_selected_effect_argument = (flags & 1) ? 2.0f : 1.0f; - hit_radius = (flags & 4) ? 0.0f : 1.5f; + rocket_kind_flags = *(int *)(((char *)MOBY(moby)->pvars) + 0x38); + effect_scale = (rocket_kind_flags & 1) ? 2.0f : 0.75f; + flag_selected_effect_scalar = (rocket_kind_flags & 1) ? 4.0f : 2.0f; + flag_selected_effect_argument = (rocket_kind_flags & 1) ? 2.0f : 1.0f; + hit_radius = (rocket_kind_flags & 4) ? 0.0f : 1.5f; func_L00_0025F4A8_alt(moby, qp, moby + 0x10, From 1d0d1d5f75fb8d17fd1c4546cb0b94133ee49b8c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:55:38 +0000 Subject: [PATCH 194/657] decomp: clarify names in select_drek_boss_next_action state -> candidate_action_state: SHA-256 58245b08b1423f427c782784901e6bb0f55a608fd9eb2dc612ed79e63cc91ef7 source initializes state from boss_action_vars+0x350, then assigns six established action codes in the choice switch and returns it. Original Ghidra iVar4 follows the same flow: retail 0x002f70e0 loads s1, 0x002f711c/24/2c/34/3c/40 set s1 to 0xD/0xE/0xF/0x10/0x11/0x13; 0x002f715c and 0x002f7174 reject repetition against the stored previous action, and 0x002f7170..0x002f71e4 apply candidate-specific restrictions. 0x002f71fc returns s1; the supplied drek_final_boss_robot_update dispatches that code to initialize an action. Thus it is the candidate action state, not the choice index or current moby state. --- .../l18/mobys/drek_final_boss_robot.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l18/mobys/drek_final_boss_robot.c b/src/overlays/l18/mobys/drek_final_boss_robot.c index 8736f84917..feec729474 100644 --- a/src/overlays/l18/mobys/drek_final_boss_robot.c +++ b/src/overlays/l18/mobys/drek_final_boss_robot.c @@ -2458,7 +2458,7 @@ int select_drek_boss_next_action(struct Moby *moby) { BOSS_ACTION_CHOICE_FOLLOW_HERO = 5 }; char *boss_action_vars = (char *)moby->pvars; - int state = *(int *)(boss_action_vars + 0x350); + int candidate_action_state = *(int *)(boss_action_vars + 0x350); int tries = 0; int boss_action_choice_index; int ok; @@ -2466,29 +2466,29 @@ int select_drek_boss_next_action(struct Moby *moby) { boss_action_choice_index = random_integer_below(6); switch (boss_action_choice_index) { case BOSS_ACTION_CHOICE_LAUNCH_FORWARD_WITH_LATERAL_OFFSET: - state = DREK_BOSS_LAUNCH_FORWARD_WITH_LATERAL_OFFSET; + candidate_action_state = DREK_BOSS_LAUNCH_FORWARD_WITH_LATERAL_OFFSET; break; case BOSS_ACTION_CHOICE_REPOSITION_AND_AIM: - state = DREK_BOSS_ACTION_REPOSITION_AND_AIM; + candidate_action_state = DREK_BOSS_ACTION_REPOSITION_AND_AIM; break; case BOSS_ACTION_CHOICE_TARGET_GROUND_POINTS: - state = DREK_BOSS_TARGET_GROUND_POINTS; + candidate_action_state = DREK_BOSS_TARGET_GROUND_POINTS; break; case BOSS_ACTION_CHOICE_TARGET_RANDOM_ARENA_POINTS: - state = DREK_BOSS_TARGET_RANDOM_ARENA_POINTS; + candidate_action_state = DREK_BOSS_TARGET_RANDOM_ARENA_POINTS; break; case BOSS_ACTION_CHOICE_TARGET_SIDE_GROUND_POINTS: - state = DREK_BOSS_TARGET_SIDE_GROUND_POINTS; + candidate_action_state = DREK_BOSS_TARGET_SIDE_GROUND_POINTS; break; case BOSS_ACTION_CHOICE_FOLLOW_HERO: - state = DREK_BOSS_FOLLOW_HERO; + candidate_action_state = DREK_BOSS_FOLLOW_HERO; break; } ok = *(short *)((char *)drek_boss_action_eligibility_by_phase + boss_action_choice_index * 2 + *(int *)(boss_action_vars + 0x34C) * 12); - if (state == *(int *)(boss_action_vars + 0x350)) + if (candidate_action_state == *(int *)(boss_action_vars + 0x350)) ok = 0; - if (state == DREK_BOSS_FOLLOW_HERO) { + if (candidate_action_state == DREK_BOSS_FOLLOW_HERO) { if (*(int *)(boss_action_vars + 0x364) != 0) { ok = 0; } else { @@ -2499,7 +2499,7 @@ int select_drek_boss_next_action(struct Moby *moby) { ok = 0; } } - if (state == DREK_BOSS_TARGET_SIDE_GROUND_POINTS) { + if (candidate_action_state == DREK_BOSS_TARGET_SIDE_GROUND_POINTS) { if (*(int *)(boss_action_vars + 0x350) == 0xE) ok = 0; } @@ -2507,7 +2507,7 @@ int select_drek_boss_next_action(struct Moby *moby) { break; tries++; } while (tries < 100); - return state; + return candidate_action_state; } typedef unsigned int u128_f7220 __attribute__((mode(TI))); From ecea7a7492daa3274bb1857c2f54379a518886ac Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:55:38 +0000 Subject: [PATCH 195/657] decomp: clarify names in draw_timed_text_line mode -> alignment: The int mode argument is copied from a2 to s1 at 0x001fcb4c. At 0x001fcb90-0x001fcbcc it selects horizontal placement: 0 computes left=x-(width>>1) and right=x+(width>>1), 1 subtracts full scaled text width from left, and -1 extends right by width. The endpoints then determine the padded frame at 0x001fcbd8-0x001fcc04 and text x coordinates at 0x001fcc20 and 0x001fcc50. Source switch labels TEXT_ALIGN_CENTER and TEXT_ALIGN_RIGHT confirm alignment as the domain; the caller forwards timed_text_entry->mode. --- src/overlays/shared/ui/text/draw_timed_text.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/ui/text/draw_timed_text.c b/src/overlays/shared/ui/text/draw_timed_text.c index dd59101015..af45189b2f 100644 --- a/src/overlays/shared/ui/text/draw_timed_text.c +++ b/src/overlays/shared/ui/text/draw_timed_text.c @@ -13,7 +13,7 @@ extern void font_print_large(int, int, u64, char *, int) __asm__("FUN_001f6530") void draw_timed_text_line(int x, int y, int mode, float scale, float alpha, char *text) __asm__("FUN_L00_001fcb28"); -void draw_timed_text_line(int x, int y, int mode, float scale, float alpha, char *text) { +void draw_timed_text_line(int x, int y, int alignment, float scale, float alpha, char *text) { enum { TEXT_ALIGN_CENTER = 0, TEXT_ALIGN_RIGHT = 1 @@ -24,7 +24,7 @@ void draw_timed_text_line(int x, int y, int mode, float scale, float alpha, char width = measure_text_width_regular(text, -1) * scale; left = x; right = left; - switch (mode) { + switch (alignment) { case TEXT_ALIGN_CENTER: left -= width >> 1; right = x + (width >> 1); From daf43c5feff5ea4eb0d3c54ccdf318255b806496 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:57:36 +0000 Subject: [PATCH 196/657] decomp: clarify names in sceClose state -> close_request: In the authoritative sceClose.c snapshot (SHA-256 ff62c1fd4c3a5a1e12950218b2a65083568a90d7ad5fddcf9e6f126d2aa73f96), state points to D_00156880. Retail 0x0011bf1c forms that address in s2; 0x0011bf8c and 0x0011bf9c store the file handle and slot index at offsets 12 and 16. Stores at 0x0011bfbc, 0x0011bfcc, and 0x0011bfd0 add the completion semaphore, output address, and output size. At 0x0011bfd8 s2 becomes a3, and 0x0011bfe8 supplies send size 0x14 before sceSifCallRpc at 0x0011bff4 with RPC number 1. The original Ghidra decompilation likewise passes g_abSifFileRequest as the send buffer. This proves close_request denotes the close RPC request buffer. --- src/sdk/storage/fileio/sceClose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdk/storage/fileio/sceClose.c b/src/sdk/storage/fileio/sceClose.c index 1b23b3b684..91ec1aa62a 100644 --- a/src/sdk/storage/fileio/sceClose.c +++ b/src/sdk/storage/fileio/sceClose.c @@ -28,7 +28,7 @@ s32 sceClose(s32 fd) { s32 ok; s32 sid; struct SifFileSlot *io; - struct SifFileState *state = &D_00156880; + struct SifFileState *close_request = &D_00156880; io = get_iob(fd); _sceFsWaitS(1); From 2706e237a94095d9ac8bf698efe27b530c9b0dde Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:57:37 +0000 Subject: [PATCH 197/657] decomp: clarify names in blend_hero_slot3_mapped_animation_pair id -> requested_hero_animation_id: The supplied set_hero_animation caller passes requested_animation_id at 0x0023254c. Retail stores incoming a0 at sp+8 at 0x00231eb8 and passes it unchanged to select_hero_slot3_animation_pair at 0x00231ed0, whose first argument is input_animation_id. The saved request is tested for zero at 0x00231edc-0x00231ee0. Original Ghidra param_2/iStack_78 follows this same flow. On fallback, 0x00231f38-0x00231f48 reuses sp+8 as the lookup output and tests it for zero; the name describes the incoming hero animation request. --- src/overlays/shared/hero/set_hero_animation.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index 203a0132f3..fc5a27f6ee 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -112,7 +112,7 @@ void blend_hero_slot3_mapped_animation_pair(int id, int frame_index, float blend_frames) __asm__("FUN_L00_00231e78"); -void blend_hero_slot3_mapped_animation_pair(int id, int frame_index, float blend_frames) { +void blend_hero_slot3_mapped_animation_pair(int requested_hero_animation_id, int frame_index, float blend_frames) { struct Hero *hero_slot3_mapped_animation_state = &hero; struct Hero *blk2; struct Hero *blk3; @@ -131,7 +131,7 @@ void blend_hero_slot3_mapped_animation_pair(int id, int frame_index, float blend if (slot3_moby == 0 || slot3_secondary_moby == 0) { return; } - if (select_hero_slot3_animation_pair(id, &seq0, &seq1) != 0 && id != 0) { + if (select_hero_slot3_animation_pair(requested_hero_animation_id, &seq0, &seq1) != 0 && requested_hero_animation_id != 0) { if (MOBY(slot3_moby)->prev_seq == seq0) { return; } From 86f7fe49e7c5adeada4b4ff5529e3cff42559485 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:57:37 +0000 Subject: [PATCH 198/657] decomp: clarify names in select_localized_moby_voice_line id -> voice_line_id: Source initializes id=-1 and assigns voice_vars->greet[lang], ->chatter[chatter_index][lang], or ->leave[lang]. Original retail Ghidra assigns these table loads to iVar2 and queues iVar2+20000. Retail 0030246C loads the greeting ID from pvars+0x38, 00302530 loads the selected localized chatter ID from pvars+0x68 plus row/language offsets, and 0030254C loads the leaving ID from pvars+0x50. At 00302550-00302560 the selected ID is compared to -1, increased by 0x4E20 and stored at 001516EC (queued_dialogue_id). This proves voice_line_id, distinct from language and chatter-row indices. --- src/overlays/l06/mobys/countdown_sequence.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l06/mobys/countdown_sequence.c b/src/overlays/l06/mobys/countdown_sequence.c index f02df2669f..d8c6c3defb 100644 --- a/src/overlays/l06/mobys/countdown_sequence.c +++ b/src/overlays/l06/mobys/countdown_sequence.c @@ -369,7 +369,7 @@ void select_localized_moby_voice_line(struct Moby *moby, s32 kind) { VOICE_KIND_LEAVING = 2 }; struct TauntVoiceVars *voice_vars = (struct TauntVoiceVars *)moby->pvars; - s32 id = -1; + s32 voice_line_id = -1; s32 lang; s32 chatter_index; s32 i; @@ -379,7 +379,7 @@ void select_localized_moby_voice_line(struct Moby *moby, s32 kind) { lang = game_language; if (lang != 0) lang--; - id = voice_vars->greet[lang]; + voice_line_id = voice_vars->greet[lang]; break; case VOICE_KIND_CHATTER: chatter_index = random_integer_below(3); @@ -398,18 +398,18 @@ void select_localized_moby_voice_line(struct Moby *moby, s32 kind) { lang = game_language; if (lang != 0) lang--; - id = voice_vars->chatter[chatter_index][lang]; + voice_line_id = voice_vars->chatter[chatter_index][lang]; break; case VOICE_KIND_LEAVING: lang = game_language; if (lang != 0) lang--; - id = voice_vars->leave[lang]; + voice_line_id = voice_vars->leave[lang]; break; } - if (id != -1) { - id += 20000; - queued_dialogue_id[0] = id; + if (voice_line_id != -1) { + voice_line_id += 20000; + queued_dialogue_id[0] = voice_line_id; } } From 46e4d13517197d9ac360b1ab0b9ba43e9807c8a3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:59:34 +0000 Subject: [PATCH 199/657] decomp: clarify names in sceMcGetInfo type -> card_type_output: Retail 0x00123d8c saves the third argument in s3; 0x00123dec tests s3 for NULL and sets request offset 0x14, then 0x00123e50 saves that same address to D_00159A28. Supplied callers check_memory_card and memcard_update_state pass &card_type and &CARD.type in this position, proving an optional card-type output address rather than a scalar type. --- src/sdk/storage/memory_card/sce_mc_get_info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/storage/memory_card/sce_mc_get_info.c b/src/sdk/storage/memory_card/sce_mc_get_info.c index 2116997fc0..b26c4e0dc5 100644 --- a/src/sdk/storage/memory_card/sce_mc_get_info.c +++ b/src/sdk/storage/memory_card/sce_mc_get_info.c @@ -24,7 +24,7 @@ extern s32 PollSema(); extern s32 SignalSema(); extern s32 sceSifWriteBackDCache(); -s32 sceMcGetInfo(s32 port, s32 slot, s32 type, s32 free_blocks, s32 format) { +s32 sceMcGetInfo(s32 port, s32 slot, s32 card_type_output, s32 free_blocks, s32 format) { s32 rpc_dispatch_result; if (mc_rpc_client.serve == 0) { @@ -51,7 +51,7 @@ s32 sceMcGetInfo(s32 port, s32 slot, s32 type, s32 free_blocks, s32 format) { } else { D_00159A80.want_format = 0; } - D_00159A28[0] = type; + D_00159A28[0] = card_type_output; D_00159A2C[0] = free_blocks; D_00159A30[0] = (u32)format; sceSifWriteBackDCache(D_00159F00, 0xC0); From a1022a40b63841219cf6f6e1c8eff9ca8b9115e1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 06:59:35 +0000 Subject: [PATCH 200/657] decomp: clarify names in set_race_camera mode -> requested_hero_state: Retail 0x00216fac saves a2 in s3. At 0x00217088-0x00217098 it compares s3 with -1 and, unless equal, moves it to a0 and calls 0x002223f8 (hero_set_state) with a1=1. Original Ghidra param_3 follows the same conditional call, matching source if (mode != -1) hero_set_state(mode, 1). Thus this is the requested hero state, with -1 skipping the state request. --- src/overlays/shared/hero/hero_move_state_velocity.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/hero_move_state_velocity.c b/src/overlays/shared/hero/hero_move_state_velocity.c index b152fd0e40..68549c6dce 100644 --- a/src/overlays/shared/hero/hero_move_state_velocity.c +++ b/src/overlays/shared/hero/hero_move_state_velocity.c @@ -1013,7 +1013,7 @@ void set_race_camera(Vec4_00216f90 *hero_world_position, void set_race_camera(Vec4_00216f90 *hero_world_position, Vec4_00216f90 *hero_euler_rotation, - int mode, + int requested_hero_state, int flag) { char *position_destination = D_0013F3D0; @@ -1044,8 +1044,8 @@ void set_race_camera(Vec4_00216f90 *hero_world_position, reset_pad_history(); cancel_hero_item_animation(); reset_hero_easing_records(); - if (mode != -1) - hero_set_state(mode, 1); + if (requested_hero_state != -1) + hero_set_state(requested_hero_state, 1); set_hero_animation_sequence_and_frame( *(unsigned char *)(*(char **)(hero_base + 0x2080) + 0x53), *(unsigned char *)(*(char **)(hero_base + 0x2080) + 0x51)); From 01b0355b8c80cd391b856b47e54caff36b7c8099 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:01:29 +0000 Subject: [PATCH 201/657] decomp: clarify names in sceSifInitRpc mode -> unused_mode: The authoritative source declares u32 mode but never reads it. Original retail instructions at 0x0011ab20-0x0011acb8 never save or read incoming a0: the first call is DIntr at 0x0011ab30, and a0 is explicitly set for later calls (for example lui a0,0x8000 at 0x0011abbc). The original Ghidra decompilation likewise has no use of its int mode parameter. Thus this parameter is unused by sceSifInitRpc. --- src/sdk/rpc/rpc/sce_sif_init_rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdk/rpc/rpc/sce_sif_init_rpc.c b/src/sdk/rpc/rpc/sce_sif_init_rpc.c index 5cfea995ff..ce06aa3d02 100644 --- a/src/sdk/rpc/rpc/sce_sif_init_rpc.c +++ b/src/sdk/rpc/rpc/sce_sif_init_rpc.c @@ -26,7 +26,7 @@ extern s32 DIntr(void); extern u32 sceSifGetReg(u32 reg); extern u32 sceSifSetReg(u32 reg, u32 val); -void sceSifInitRpc(u32 mode) { +void sceSifInitRpc(u32 unused_mode) { s32 *packet; DIntr(); From b7b4b84766a4f925da3641fe3a124e8ecb1e701f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:01:29 +0000 Subject: [PATCH 202/657] decomp: clarify names in GetMpegPictureTimestampsAndFlags flags -> packed_picture_attributes: In source src/sdk/mpeg/demux/_getPtsDtsFlags.c (SHA-256 7cc2732b153ebe92cc40a45db5446bf240412bf33573948dc26d103f76db0edd), this s64 pointer receives the OR of field_flags, sequence_flags and picture_flags. Retail 0x00129c6c-0x00129cb4 loads picture offsets +0x40,+0x3c,+0x34,+0x30,+0x2c,+0x38 and packs repeat_first_field<<5, top_field_first<<6, progressive_sequence<<8, picture_structure<<3, coding_type and progressive_frame<<7. At 0x00129cbc the fifth argument pointer is restored from the stack, and 0x00129ce0 stores that packed word through it. The original Ghidra param_5 assignment confirms the same combined picture-attribute output. --- src/sdk/mpeg/demux/_getPtsDtsFlags.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/mpeg/demux/_getPtsDtsFlags.c b/src/sdk/mpeg/demux/_getPtsDtsFlags.c index 31d7061620..f2c642754e 100644 --- a/src/sdk/mpeg/demux/_getPtsDtsFlags.c +++ b/src/sdk/mpeg/demux/_getPtsDtsFlags.c @@ -39,7 +39,7 @@ void GetMpegPictureTimestampsAndFlags(struct MpegTimestampState *state, s64 *presentation_timestamp, s64 *decoding_timestamp, - s64 *flags) { + s64 *packed_picture_attributes) { enum { MPEG_PTS_OVERRIDE_INACTIVE = 0, MPEG_PTS_OVERRIDE_PENDING = 2 @@ -87,5 +87,5 @@ void GetMpegPictureTimestampsAndFlags(struct MpegTimestampState *state, field_flags = ((s64)picture->repeat_first_field << 5) | ((s64)picture->top_field_first << 6); sequence_flags = ((s64)picture->progressive_sequence << 8) | picture->coding_type; picture_flags = ((s64)picture->progressive_frame << 7) | ((s64)picture->picture_structure << 3); - *flags = (sequence_flags | field_flags) | picture_flags; + *packed_picture_attributes = (sequence_flags | field_flags) | picture_flags; } From 61977ee7b9538a37072f1843e93d5fef69b0bfe0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:01:29 +0000 Subject: [PATCH 203/657] decomp: clarify names in initialize_render_archive_transfer state -> render_archive: Source binds RenderArchiveState *state to &D_L00_001841F0. Retail 0x002468c4/0x002468cc forms that base in s2; 0x002468d8 loads archive_index at +0x224, 0x00246908 loads file_handle at +0x22c, and 0x00246970-0x002469c0 uses the indexed disc archive, buffer +0x27c and stash handle to read/send its contents and save the transfer count at +0x234. Stores at 0x002469d0-0x002469e4 update this same archive object's load state, last transfer count and active flag. Thus render_archive identifies the pointed-to archive object rather than an unspecified state. --- .../shared/game/run_level_main_loop.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/shared/game/run_level_main_loop.c b/src/overlays/shared/game/run_level_main_loop.c index a73c790a09..4d1ea1528e 100644 --- a/src/overlays/shared/game/run_level_main_loop.c +++ b/src/overlays/shared/game/run_level_main_loop.c @@ -512,10 +512,10 @@ void initialize_render_archive_transfer(void) { s32 buffer; s32 bytes; s32 archive_index; - RenderArchiveState *state = &D_L00_001841F0; + RenderArchiveState *render_archive = &D_L00_001841F0; noop_main_callback(); - update_map_icons(state->archive_index, 1); + update_map_icons(render_archive->archive_index, 1); first_base = D_L00_001B9CF0.first_base; second_base = D_L00_001B9CF0.second_base; buffer = first_base + 0x9a800; @@ -525,17 +525,17 @@ void initialize_render_archive_transfer(void) { D_L00_001841F0.buffer = buffer; D_L00_001841F0.old_end = second_base; D_L00_001B9CF0.second_base = second_base + 0x48000; - state->zero_284 = 0; - state->zero_288 = 0; - state->slot_28c = -1; - state->level_slot = -1; - state->slot_294 = -1; - state->slot_298 = -1; - state->slot_29c = -1; - state->slot_2a0 = -1; - if (state->file_handle != -1) { - if (state->loaded == 0 && D_0013D4E1 != 0) { - archive_index = state->archive_index; + render_archive->zero_284 = 0; + render_archive->zero_288 = 0; + render_archive->slot_28c = -1; + render_archive->level_slot = -1; + render_archive->slot_294 = -1; + render_archive->slot_298 = -1; + render_archive->slot_29c = -1; + render_archive->slot_2a0 = -1; + if (render_archive->file_handle != -1) { + if (render_archive->loaded == 0 && D_0013D4E1 != 0) { + archive_index = render_archive->archive_index; bytes = disc_table.render_archives[archive_index].size << 7; start_audio_stream_read(buffer, disc_table.render_archives[archive_index].sector, From 1baba2644864008e34915c85502938c4a4cef542 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:03:34 +0000 Subject: [PATCH 204/657] decomp: clarify names in spawn_crate_debris type -> debris_moby_type: Retail 0x002af8f4 moves fifth integer argument t0 to a0 immediately before allocator call 0x002af8fc (0x0024e838); original Ghidra expresses this as FUN_0024e838(param_7). Authoritative C is create_moby(type), whose nullable result debris_moby is initialized as a crate fragment and returned at 0x002afa0c. Supplied callers pass 0x5EC, 0x165 or random_integer_below(2)+0x166 in this position, separately from source entity and bounce count, establishing the allocated debris moby's type selector. --- src/overlays/shared/pickups/crate_fragment.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/pickups/crate_fragment.c b/src/overlays/shared/pickups/crate_fragment.c index 9ff3bc9187..892afd7584 100644 --- a/src/overlays/shared/pickups/crate_fragment.c +++ b/src/overlays/shared/pickups/crate_fragment.c @@ -144,12 +144,12 @@ unsigned char *spawn_crate_debris(unsigned char *debris_source_moby, void *initial_velocity, void *spawn_position, void *initial_rotation, - int type, + int debris_moby_type, int initial_bounce_count, float lo, float hi) { - unsigned char *debris_moby = create_moby(type); + unsigned char *debris_moby = create_moby(debris_moby_type); if (debris_moby) { V_2af8b0 *debris_data = ((V_2af8b0 *)MOBY(debris_moby)->pvars); float scale_multiplier; From a610c9791eada52e6b0531c0959c3aad8f0e371f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:03:35 +0000 Subject: [PATCH 205/657] decomp: clarify names in FUN_L00_00272060 domain_0_value_0 -> PARTICLE_INITIAL_ROTATION_MODE_ZERO: The selector is a3/s4, the initial rotation mode: retail 0x0027213c tests s4 against zero and 0x00272144-0x00272148 stores zero into particle+8. Original retail param_7==0 does the same. Supplied updater identifies +8 as spin, and the paired-particle caller supplies 0 for its first particle. This names zero initialization of the rotation byte, not a hero state or boolean. domain_1_value_1 -> PARTICLE_INITIAL_ROTATION_MODE_EIGHTH_TURN_OFFSET: Retail 0x0027214c-0x00272160 compares initial rotation selector s4 to 1 and stores 0x20 into particle+8; other nonzero values call the random initializer. Original param_7 branch agrees. Supplied spawn_texture_indexed_rotated_particle converts radians to this same byte field using radians*128/pi-0x20, establishing 256 byte units per full turn: 0x20 is an eighth-turn offset from mode 0's zero byte. Paired callers select 0 and 1 for their two particles. mode -> initial_rotation_mode: Retail 0x0027208c saves a3 in s4; 0x0027213c-0x00272160 tests it against 0 and 1 solely to initialize particle+8 to zero, 0x20 or random_integer_below(0xFF). Original Ghidra param_7 has the same branches. Supplied update_moving_size_alpha_tween_particle increments this field as part->spin from the separately stored rotation_increment, proving an initial rotation selection mode rather than an ongoing particle state. --- src/overlays/shared/rendering/effects/particles.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index edb31f5568..2053b4f6e1 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -427,13 +427,17 @@ FUN_L00_00272060(void *pos, int s, int color, int mode, int b, float *v, float x unsigned char *FUN_L00_00272060(void *initial_position, int lifetime_frames, int color, - int mode, + int initial_rotation_mode, int rotation_increment, float *initial_velocity, float x, float y, float z) { + enum { + PARTICLE_INITIAL_ROTATION_MODE_ZERO = 0, + PARTICLE_INITIAL_ROTATION_MODE_EIGHTH_TURN_OFFSET = 1 + }; unsigned char *particle = create_part(0x35); if (particle) { unsigned char *particle_data = particle + 0x20; @@ -446,9 +450,9 @@ unsigned char *FUN_L00_00272060(void *initial_position, particle[2] = *D_L00_001B2154; *(short *)(particle + 0xA) = lifetime_frames; *(float *)(particle + 0xC) = x * 210000.0f; - if (mode == 0) { + if (initial_rotation_mode == PARTICLE_INITIAL_ROTATION_MODE_ZERO) { particle[8] = 0; - } else if (mode == 1) { + } else if (initial_rotation_mode == PARTICLE_INITIAL_ROTATION_MODE_EIGHTH_TURN_OFFSET) { particle[8] = 0x20; } else { particle[8] = random_integer_below(0xFF); From 55f5959edfc4f6c14f6e40dbb7f1bb7abb38bf98 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:03:35 +0000 Subject: [PATCH 206/657] decomp: clarify names in update_metropolis_train_idle_motion id -> car_moby_index: In the authoritative C, id starts from next_id loaded from locomotive_pvars +0xA0, selects car = D_L03_0015FFD8_292d10 + (id << 8), and is replaced by *(int *)(car_data +0xC0) until -1. Retail 0x00292d68-74 loads the first linked-car index, 0x00292d98-0x00292da4 scales it by 256, adds the moby-array base and loads car pvars, and 0x00292df0-0x00292df8 loads the next car index and loops. Original Ghidra agrees through iVar2 and iVar7 + iVar2 * 0x100. Thus this binding is the current carriage's moby-array index. --- src/overlays/l03/mobys/metropolis_train_locomotive.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l03/mobys/metropolis_train_locomotive.c b/src/overlays/l03/mobys/metropolis_train_locomotive.c index a995ef2b7e..b5aa8e4b0f 100644 --- a/src/overlays/l03/mobys/metropolis_train_locomotive.c +++ b/src/overlays/l03/mobys/metropolis_train_locomotive.c @@ -263,7 +263,7 @@ void update_metropolis_train_idle_motion(struct Moby *moby) { char *moby_position; char *moby_rotation; int next_id; - int id; + int car_moby_index; float *dp; char *motion; @@ -275,19 +275,19 @@ void update_metropolis_train_idle_motion(struct Moby *moby) { qcopy(old_rot, moby_rotation); next_id = *(int *)(locomotive_pvars + 0xA0); if (next_id != -1) { - id = next_id; + car_moby_index = next_id; dp = delta; motion = locomotive_pvars + 0x60; do { - car = D_L03_0015FFD8_292d10 + (id << 8); + car = D_L03_0015FFD8_292d10 + (car_moby_index << 8); car_data = *(char **)(car + 0x78); car[0x72] = 0x40; fast_vec_sub(delta, car + 0x10, car_data + 0xA0); update_entity_matrix(car_data + 0x20, delta, car_data + 0xB0, car + 0x40); qcopy(car_data + 0xA0, car + 0x10); qcopy(car_data + 0xB0, car + 0x40); - id = *(int *)(car_data + 0xC0); - } while (id != -1); + car_moby_index = *(int *)(car_data + 0xC0); + } while (car_moby_index != -1); fast_vec_sub(dp, &moby->pos, old_pos); update_entity_matrix(motion, dp, old_rot, &moby->rot); } else { From 962bb9806db7891d79376ee2c51e04bf5afa031b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:03:35 +0000 Subject: [PATCH 207/657] decomp: clarify names in gate_update id -> gate_save_id: In the SHA-bound gate.c snapshot, unsigned short id is assigned MOBY(gate_moby)->save_id. Retail 0x002bf034 loads this halfword from gate+0xb2; 0x002bf038-0x002bf044 sign-extends it to index the cleared byte. Retail 0x002bf050-0x002bf078 uses its signed value >>5 for the save-bit word and its low five bits for the bit shift. Original Ghidra iVar6 and the ushort reload at param_1+0xb2 show the same data flow, proving this is the gate save ID. --- src/overlays/l10/mobys/gate.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l10/mobys/gate.c b/src/overlays/l10/mobys/gate.c index 72333ceeae..14f5f698e7 100644 --- a/src/overlays/l10/mobys/gate.c +++ b/src/overlays/l10/mobys/gate.c @@ -28,15 +28,15 @@ void gate_update(unsigned char *gate_moby) { GATE_STATE_AT_LOWER_Y = 2 }; float *saved_position = ((float *)MOBY(gate_moby)->pvars); - unsigned short id; + unsigned short gate_save_id; switch (gate_moby[0x20]) { case GATE_STATE_WAIT_FOR_SAVE_FLAG: *(OvlQuad *)saved_position = *(OvlQuad *)&MOBY(gate_moby)->pos; - id = MOBY(gate_moby)->save_id; - if (l10_save_state.cleared[(short)id] != 0 || + gate_save_id = MOBY(gate_moby)->save_id; + if (l10_save_state.cleared[(short)gate_save_id] != 0 || (*(int *)((unsigned char *)D_0014C190_257218 + - (((short)id >> 5) * 4 + (current_level_index << 8))) >> - (id & 0x1F)) & + (((short)gate_save_id >> 5) * 4 + (current_level_index << 8))) >> + (gate_save_id & 0x1F)) & 1) { gate_moby[0x20] = 1; } From dc49273e161e727200ab00c72198bdb23235fa72 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:03:35 +0000 Subject: [PATCH 208/657] decomp: clarify names in create_drone_flight_trail_record mode -> use_short_step_range: Retail saves a1 in s1 at 0x0026fdec. At 0x0026fdf8-0x0026fe04 zero selects 15 and nonzero selects 5 before subtracting step; 0x0026fe08 rejects negative remainder. The same selector branches at 0x0026fe44 to store 15-step at record +0xA (0x0026fe54, 0x0026fe7c) or 5-step (0x0026feb8, 0x0026fee0). Original Ghidra param_2 and current C mode agree, including the existing zero-valued EXTENDED_STEP_RANGE constant. Thus nonzero requests the short accepted step range. --- src/overlays/l17/mobys/dreks_fleet_turret_shot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l17/mobys/dreks_fleet_turret_shot.c b/src/overlays/l17/mobys/dreks_fleet_turret_shot.c index 1e975a9702..73c775dca8 100644 --- a/src/overlays/l17/mobys/dreks_fleet_turret_shot.c +++ b/src/overlays/l17/mobys/dreks_fleet_turret_shot.c @@ -49,13 +49,13 @@ unsigned char *create_drone_flight_trail_record(char *position_source, int mode, int step) __asm__("FUN_L17_0026fdd0"); -unsigned char *create_drone_flight_trail_record(char *position_source, int mode, int step) { +unsigned char *create_drone_flight_trail_record(char *position_source, int use_short_step_range, int step) { enum { DRONE_FLIGHT_TRAIL_MODE_EXTENDED_STEP_RANGE = 0 }; unsigned char *flight_trail_record; int remaining_steps; - if (mode) + if (use_short_step_range) remaining_steps = 5 - step; else remaining_steps = 0xF - step; @@ -64,8 +64,8 @@ unsigned char *create_drone_flight_trail_record(char *position_source, int mode, if (flight_trail_record != 0) { qcopy(flight_trail_record + 0x10, position_source); flight_trail_record[9] = truncate_float_to_s32(1.0f) + 0x70; - *(int *)(flight_trail_record + 0x20) = mode; - if (mode == DRONE_FLIGHT_TRAIL_MODE_EXTENDED_STEP_RANGE) { + *(int *)(flight_trail_record + 0x20) = use_short_step_range; + if (use_short_step_range == DRONE_FLIGHT_TRAIL_MODE_EXTENDED_STEP_RANGE) { int d = 0xF - step; *(int *)(flight_trail_record + 4) = 0x60FF3020; flight_trail_record[3] = 0x48; From bea79d5c238253adede59f20b1c47f2b3dba5b47 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:05:27 +0000 Subject: [PATCH 209/657] decomp: clarify names in PrepareMpegPictureFieldTransfers flags -> picture_structure_flag_mask: Retail s6 is zeroed at 0x00129e10 and set to 0x40 at 0x00129e4c only when decoder picture_structure (+0x174) equals 2. At 0x00129ea4 it becomes t0, which is ORed into transfer +0x20 at 0x00129ec4 and +0x38 at 0x00129ed4. Source identifies these as first_flags and second_flags; this is the picture-structure-selected mask applied to both transfers. state -> decoder: Retail 0x00129e24 retains a0 in s1; s1 supplies picture_structure at +0x174 and transfer at +0x858, receives timestamps/display metadata, and is passed as a0 to _isOutSizeOK (0x00129f00), _csc_storeRefImage (0x00129f40) or _cpr8 (0x00129f50), then finalization. Supplied _outputFrame and _lastFrame pass their MpegDecoder object as this argument, proving decoder ownership. --- src/sdk/mpeg/ref_images/disprefimagefield.c | 54 ++++++++++----------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/sdk/mpeg/ref_images/disprefimagefield.c b/src/sdk/mpeg/ref_images/disprefimagefield.c index 3809d893a3..6c22e78cfd 100644 --- a/src/sdk/mpeg/ref_images/disprefimagefield.c +++ b/src/sdk/mpeg/ref_images/disprefimagefield.c @@ -72,7 +72,7 @@ void PrepareMpegPictureFieldTransfers( struct MpegPictureBuffer *first, struct MpegPictureBuffer *second) __asm__("_dispRefImageField"); -void PrepareMpegPictureFieldTransfers(struct MpegFieldTransferState *state, +void PrepareMpegPictureFieldTransfers(struct MpegFieldTransferState *decoder, struct MpegPictureBuffer *first_field_ref_image, struct MpegPictureBuffer *second_field_ref_image) { @@ -88,56 +88,56 @@ void PrepareMpegPictureFieldTransfers(struct MpegFieldTransferState *state, struct MpegPictureTransfer *transfer; struct MpegPictureTransfer *second_transfer; struct MpegPictureTransfer *final_transfer; - s32 flags; - flags = 0; - if (state->picture_structure == 2) { + s32 picture_structure_flag_mask; + picture_structure_flag_mask = 0; + if (decoder->picture_structure == 2) { primary = first_field_ref_image; secondary = second_field_ref_image; - flags = 0x40; + picture_structure_flag_mask = 0x40; } else { primary = second_field_ref_image; secondary = first_field_ref_image; } - transfer = state->transfer; - GetMpegPictureTimestampsAndFlags(state, + transfer = decoder->transfer; + GetMpegPictureTimestampsAndFlags(decoder, primary, &transfer->first_timestamp.value, &transfer->first_decode_timestamp, &transfer->first_flags); - second_transfer = state->transfer; + second_transfer = decoder->transfer; timestamp = second_transfer->first_timestamp.words.low; - state->timestamp_step = 1; - state->last_timestamp = timestamp; - GetMpegPictureTimestampsAndFlags(state, + decoder->timestamp_step = 1; + decoder->last_timestamp = timestamp; + GetMpegPictureTimestampsAndFlags(decoder, secondary, &second_transfer->second_timestamp.value, &second_transfer->second_decode_timestamp, &second_transfer->second_flags); - final_transfer = state->transfer; + final_transfer = decoder->transfer; second_timestamp = final_transfer->second_timestamp.words.low; - state->timestamp_step = 1; - state->last_timestamp = second_timestamp; - first_flags = final_transfer->first_flags | flags; - state->display_width = primary->display_width; + decoder->timestamp_step = 1; + decoder->last_timestamp = second_timestamp; + first_flags = final_transfer->first_flags | picture_structure_flag_mask; + decoder->display_width = primary->display_width; second_flags = final_transfer->second_flags; final_transfer->first_flags = first_flags; - second_flags |= flags; + second_flags |= picture_structure_flag_mask; display_height = primary->display_height; final_transfer->second_flags = second_flags; - state->display_height = display_height; - state->horizontal_offset0 = primary->horizontal_offset0; - state->horizontal_offset1 = secondary->horizontal_offset1; - state->vertical_offset0 = primary->vertical_offset0; - state->vertical_offset1 = secondary->vertical_offset1; - if (_isOutSizeOK(state, first_field_ref_image) && + decoder->display_height = display_height; + decoder->horizontal_offset0 = primary->horizontal_offset0; + decoder->horizontal_offset1 = secondary->horizontal_offset1; + decoder->vertical_offset0 = primary->vertical_offset0; + decoder->vertical_offset1 = secondary->vertical_offset1; + if (_isOutSizeOK(decoder, first_field_ref_image) && first_field_ref_image->status == MPEG_PICTURE_STATUS_OUTPUT_READY && second_field_ref_image->status == MPEG_PICTURE_STATUS_OUTPUT_READY) { first_field_ref_image->macroblock_height *= 2; - if (state->decoder_initialized) - _csc_storeRefImage(state, first_field_ref_image); + if (decoder->decoder_initialized) + _csc_storeRefImage(decoder, first_field_ref_image); else - _cpr8(state, first_field_ref_image); + _cpr8(decoder, first_field_ref_image); first_field_ref_image->macroblock_height >>= 1; - FinishMpegReferenceImage(state); + FinishMpegReferenceImage(decoder); } } From e79ab2615f1fbd82b0f9aa759425712482d7b74e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:05:27 +0000 Subject: [PATCH 210/657] decomp: clarify names in cvt flags -> format_flags: In authoritative src/sdk/libc/stdio/cvt.c, the s32 flags parameter is used solely as flags & ALT (ALT=0x001) when deciding whether g/G output receives zero padding. Retail 0x00118350 saves a3 in s7; 0x00118400-0x00118418 tests g/G then masks s7 with 1 and skips padding if clear. Original Ghidra param_4 has the same formatting-option test, proving format_flags. mode -> dtoa_mode: The source s32 mode is assigned DTOA_MODE_FRACTIONAL_DIGITS for ch=='f', otherwise DTOA_MODE_SIGNIFICANT_DIGITS, then supplied as _dtoa_r's third argument. Retail 0x00118384-0x001183ac selects s3=3 or 2; 0x001183d8 moves s3 to a2 for the 0x001183f0 _dtoa_r call. Original Ghidra uVar5 shows the same selector flow, proving dtoa_mode. --- src/sdk/libc/stdio/cvt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sdk/libc/stdio/cvt.c b/src/sdk/libc/stdio/cvt.c index caf67a6a53..a80d436e97 100644 --- a/src/sdk/libc/stdio/cvt.c +++ b/src/sdk/libc/stdio/cvt.c @@ -36,7 +36,7 @@ typedef union { static s8 *cvt(struct _reent *reentrancy_state, f64 number_to_format, s32 ndigits, - s32 flags, + s32 format_flags, s8 *sign, s32 *decpt, s32 ch, @@ -46,17 +46,17 @@ static s8 *cvt(struct _reent *reentrancy_state, DTOA_MODE_SIGNIFICANT_DIGITS = 2, DTOA_MODE_FRACTIONAL_DIGITS = 3 }; - s32 mode, dsgn; + s32 dtoa_mode, dsgn; s8 *digits, *bp, *rve; double_union value_bits; if (ch == 'f') { - mode = DTOA_MODE_FRACTIONAL_DIGITS; + dtoa_mode = DTOA_MODE_FRACTIONAL_DIGITS; } else { if (ch == 'e' || ch == 'E') { ndigits++; } - mode = DTOA_MODE_SIGNIFICANT_DIGITS; + dtoa_mode = DTOA_MODE_SIGNIFICANT_DIGITS; } value_bits.d = number_to_format; if (word0(value_bits) & Sign_bit) { @@ -65,8 +65,8 @@ static s8 *cvt(struct _reent *reentrancy_state, } else { *sign = '\000'; } - digits = _dtoa_r(reentrancy_state, number_to_format, mode, ndigits, decpt, &dsgn, &rve); - if ((ch != 'g' && ch != 'G') || (flags & ALT)) { + digits = _dtoa_r(reentrancy_state, number_to_format, dtoa_mode, ndigits, decpt, &dsgn, &rve); + if ((ch != 'g' && ch != 'G') || (format_flags & ALT)) { bp = digits + ndigits; if (ch == 'f') { if (*digits == '0' && number_to_format) { From 7bee2937f9c1f229259273df7ed71e59ff619be3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:05:27 +0000 Subject: [PATCH 211/657] decomp: clarify names in dec_bs0 status -> completion_status: In src/movies/decoder/dec_bs0.c (SHA-256 2dae9263381912c75fbb30fa87331da090465a06891b3774ca0f1c4c6f446928), int status starts as DEC_BS0_COMPLETED and changes only to -1 on VD_STATE_ABORT. Retail 0x0023cecc/0x0023cf00 initializes the stack return slot to 1; 0x0023d034/0x0023d03c stores -1 on abort. MPEG end at 0x0023d008-0x0023d010 reaches reset, and 0x0023d048 returns that slot. The negative picture result at 0x0023cf3c only triggers logging, proving this is loop completion status rather than per-picture error status. --- src/movies/decoder/dec_bs0.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/movies/decoder/dec_bs0.c b/src/movies/decoder/dec_bs0.c index fb53bfa150..7826661ec6 100644 --- a/src/movies/decoder/dec_bs0.c +++ b/src/movies/decoder/dec_bs0.c @@ -26,12 +26,12 @@ int dec_bs0(struct VideoDec *vd) { DEC_BS0_COMPLETED = 1 }; struct VoData *voData; - int status = DEC_BS0_COMPLETED; + int completion_status = DEC_BS0_COMPLETED; int i; while (!sceMpegIsEnd(&vd->mpeg)) { if (video_dec_get_state(vd) == VD_STATE_ABORT) { - status = -1; + completion_status = -1; DebugPrint(decode_thread_aborted_message); break; } @@ -57,7 +57,7 @@ int dec_bs0(struct VideoDec *vd) { switch_thread(); } sceMpegReset(&vd->mpeg); - return status; + return completion_status; } extern __typeof__(dec_bs0) func_0023CEC8 __attribute__((alias("FUN_0023cec8"))); From 6ba0d426e34969e37aae4c214b04e2d95b010cb4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:05:27 +0000 Subject: [PATCH 212/657] decomp: clarify names in restore_or_clear_level_state id -> vehicle_moby_class_id: Authoritative source src/overlays/shared/game/restore_or_clear_level_state.c SHA-256 a1fe188d365124ab52834ab2a80f5cc395a96a6931c7129c0cb840f66fdbaed5 declares short id. Saved +0x44 is captured from hero.vehicle_mode. Retail 0x00285104/0x00285124 selects 0x57 for Clank; 0x00285110/0x00285114 selects 0x1A3 for Giant Clank. Original Ghidra sVar3 has the same assignments. Retail lh at 0x0028515C reads moby record +0xA6, compared with this key at 0x00285160; the matching 0x100-byte record is passed in a2 to enter_hero_vehicle_mode at 0x00285170. Thus this is the vehicle moby class identifier, rather than the separate instance id at +0xB2 used by find_moby_by_id. --- .../shared/game/restore_or_clear_level_state.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/game/restore_or_clear_level_state.c b/src/overlays/shared/game/restore_or_clear_level_state.c index 4b79340654..f8da8f5f3b 100644 --- a/src/overlays/shared/game/restore_or_clear_level_state.c +++ b/src/overlays/shared/game/restore_or_clear_level_state.c @@ -93,7 +93,7 @@ void restore_or_clear_level_state(void) __asm__("FUN_L00_00285008"); void restore_or_clear_level_state(void) { char *s = D_L00_001BB230; int i; - short id; + short vehicle_moby_class_id; u8 *record_cursor; struct Hero *hero_state; @@ -117,13 +117,13 @@ void restore_or_clear_level_state(void) { D_00151708 = *(unsigned short *)(s + 0xC54); } if (*(int *)(s + 0x44) != 0 && *(int *)(s + 0x44) != 3) { - id = 0; + vehicle_moby_class_id = 0; switch (*(int *)(s + 0x44)) { case HERO_VEHICLE_MODE_CLANK: - id = 0x57; + vehicle_moby_class_id = 0x57; break; case HERO_VEHICLE_MODE_GIANT_CLANK: - id = 0x1A3; + vehicle_moby_class_id = 0x1A3; break; default: raise_kernel_trap(); @@ -134,7 +134,7 @@ void restore_or_clear_level_state(void) { record_cursor = moby_table + i * 0x100; if (record_cursor >= D_L00_0015FFDC) break; - if (*(short *)(record_cursor + 0xA6) == id) { + if (*(short *)(record_cursor + 0xA6) == vehicle_moby_class_id) { char *s = D_L00_001BB230; enter_hero_vehicle_mode(*(int *)(s + 0x44), *(int *)(s + 0x4C), record_cursor); break; From 3c25c54dc5fda90be9cd6ca597d6140077c984d0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:07:21 +0000 Subject: [PATCH 213/657] decomp: clarify names in hero_update mode -> resolved_gravity_mode: At 0x00211680 retail calls resolve_hero_gravity_mode; 0x00211694 stores returned v0 as a byte at hero+0x20B3. In the authoritative source mode is the u8 receiving that return and assigned directly to hero_state->gravity_mode, proving the resolved gravity mode role. --- src/overlays/shared/hero/hero_switch_item.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index 522c087aba..e826481b2c 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -2752,14 +2752,14 @@ void hero_update(void) { s32 index; s32 buttons; s32 negative_x; - u8 mode; + u8 resolved_gravity_mode; struct Hero *hero_state; u8 *source; Vec4 *positions; - mode = resolve_hero_gravity_mode(); + resolved_gravity_mode = resolve_hero_gravity_mode(); hero_state = &hero; - hero_state->gravity_mode = mode; + hero_state->gravity_mode = resolved_gravity_mode; hero_state->stick_magnitude = get_capped_hero_stick_magnitude(); hero_state->wall_moby = 0; source = (u8 *)&controller_state; From 63194240447571b23715c56d7b7911e522bfa77e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:09:10 +0000 Subject: [PATCH 214/657] decomp: clarify names in sceSifCallRpc mode -> call_options: The third parameter is saved in s8 at 0x0011b1e4. Retail 0x0011b230 masks it with 2 and 0x0011b264 skips cache writeback when set. Separately, 0x0011b2ac masks it with 1 and 0x0011b2b0 selects asynchronous send versus the synchronous CreateSema/WaitSema/DeleteSema path. Thus it holds independent RPC call options rather than a single mutually exclusive mode. --- src/sdk/rpc/rpc/sce_sif_call_rpc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/rpc/rpc/sce_sif_call_rpc.c b/src/sdk/rpc/rpc/sce_sif_call_rpc.c index aa8a80d1dd..b1e4c0b04b 100644 --- a/src/sdk/rpc/rpc/sce_sif_call_rpc.c +++ b/src/sdk/rpc/rpc/sce_sif_call_rpc.c @@ -46,7 +46,7 @@ extern s32 sceSifSendCmd(); extern s32 sceSifWriteBackDCache(); s32 sceSifCallRpc(struct SifRpcClient *client, s32 rpc_number, - s32 mode, + s32 call_options, s32 send_buf, s32 send_size, s32 recv_buf, @@ -70,7 +70,7 @@ s32 sceSifCallRpc(struct SifRpcClient *client, return allocation_failure_result; } request_id = packet->request_id; - skip_cache_writeback = mode & 2; + skip_cache_writeback = call_options & 2; client->end_argument = end_data; client->packet = (s32)packet; client->request_id = request_id; @@ -94,7 +94,7 @@ s32 sceSifCallRpc(struct SifRpcClient *client, } } } - if (mode & 1) { + if (call_options & 1) { if (end_func == 0) { packet->completion_mode = RPC_COMPLETION_DISABLED; } else { From d977380fe4258b17f07c48f7b7aa85c4bd0f176d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:09:10 +0000 Subject: [PATCH 215/657] decomp: clarify names in draw_hud_sprite id -> frame_index: In the authoritative source, id indexes hud_state.frame_refs[id].image_index and is passed unchanged to get_frame_texture(id). Retail 0x001ffc34 multiplies first argument a0 by four; 0x001ffca0/0x001ffcb0 add the frame-reference table base, and 0x001ffcb8 reads its image index at offset 2. 0x001ffcbc-0x001ffcc0 select the corresponding eight-byte image-page record. The same a0 reaches get_frame_texture at 0x001ffd14. Original Ghidra calls this logical paired-texture index texture_index; frame_index names its directly proven source table role. --- src/ui/hud/sprites/draw_hud_sprite.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/hud/sprites/draw_hud_sprite.c b/src/ui/hud/sprites/draw_hud_sprite.c index 13b0e0e082..a25591b500 100644 --- a/src/ui/hud/sprites/draw_hud_sprite.c +++ b/src/ui/hud/sprites/draw_hud_sprite.c @@ -8,14 +8,14 @@ extern u64 get_frame_texture(s32) __asm__("func_001FFA10"); void draw_hud_sprite(s32 id, s32 x, s32 y, s32 w, s32 h, s32 alpha) __asm__("FUN_001ffc30"); -void draw_hud_sprite(s32 id, s32 x, s32 y, s32 width, s32 height, s32 alpha) { +void draw_hud_sprite(s32 frame_index, s32 x, s32 y, s32 width, s32 height, s32 alpha) { struct HudTexPage *image_page; struct DmaTag *tag; u64 *sprite_packet_words; s32 tw; s32 th; - image_page = &hud_state.image_pages[hud_state.frame_refs[id].image_index]; + image_page = &hud_state.image_pages[hud_state.frame_refs[frame_index].image_index]; tw = 1 << image_page->width_log2; th = 1 << image_page->height_log2; render_packet_cursor.tag->tag = 0x10000005; @@ -27,7 +27,7 @@ void draw_hud_sprite(s32 id, s32 x, s32 y, s32 width, s32 height, s32 alpha) { render_packet_cursor.tag = tag + 1; sprite_packet_words[0] = 0x7400000000008001; sprite_packet_words[1] = 0x5353106; - sprite_packet_words[2] = get_frame_texture(id); + sprite_packet_words[2] = get_frame_texture(frame_index); sprite_packet_words[3] = 0x156; sprite_packet_words[4] = ((u64)alpha << 24) | 0x7F7F7F; sprite_packet_words[5] = 0; From a734787561b4976d0a28bf3646752b476ad07d01 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:09:10 +0000 Subject: [PATCH 216/657] decomp: clarify names in draw_hud_sprite_subpixel id -> frame_index: Authoritative C uses the s32 id as hud->frame_refs[id].image_index and passes it unchanged to get_frame_texture(id). Retail 0x00200094 shifts first argument a0 left by 2; 0x002000e8/0x002000f8 add the frame-reference base; 0x00200100 reads its image index at +2, then 0x00200108-0x00200114 select the image page and dimensions. a0 remains the first argument for get_frame_texture at 0x00200164. Original Ghidra likewise indexes param_1 * 4 + DAT_0019a408 and calls get_frame_texture(param_1), proving a frame index rather than an image-page index. --- src/ui/hud/sprites/draw_hud_sprite_subpixel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/hud/sprites/draw_hud_sprite_subpixel.c b/src/ui/hud/sprites/draw_hud_sprite_subpixel.c index a5d55d9994..e6cecad522 100644 --- a/src/ui/hud/sprites/draw_hud_sprite_subpixel.c +++ b/src/ui/hud/sprites/draw_hud_sprite_subpixel.c @@ -7,14 +7,14 @@ extern u64 get_frame_texture(s32) __asm__("func_001FFA10"); void draw_hud_sprite_subpixel(s32 id, s32 x, s32 y, s32 w, s32 h, s32 alpha) __asm__("FUN_00200080"); -void draw_hud_sprite_subpixel(s32 id, s32 x, s32 y, s32 width, s32 height, s32 alpha) { +void draw_hud_sprite_subpixel(s32 frame_index, s32 x, s32 y, s32 width, s32 height, s32 alpha) { struct HudState *hud = &hud_state; struct HudTexPage *image_page; s32 tw; s32 th; u64 *sprite_packet; - image_page = &hud->image_pages[hud->frame_refs[id].image_index]; + image_page = &hud->image_pages[hud->frame_refs[frame_index].image_index]; tw = 1 << image_page->width_log2; th = 1 << image_page->height_log2; render_packet_cursor.tag->tag = 0x10000005; @@ -24,7 +24,7 @@ void draw_hud_sprite_subpixel(s32 id, s32 x, s32 y, s32 width, s32 height, s32 a sprite_packet = (u64 *)++render_packet_cursor.tag; sprite_packet[0] = (u64)0xE800 << 47 | 0x8001; sprite_packet[1] = 0x5353106; - sprite_packet[2] = get_frame_texture(id); + sprite_packet[2] = get_frame_texture(frame_index); sprite_packet[3] = 0x156; sprite_packet[4] = (u64)alpha << 24 | 0x7F7F7F; sprite_packet[5] = 0; From 58e58215c355323070533f14d372af581385b136 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:11:23 +0000 Subject: [PATCH 217/657] decomp: clarify names in decompress_and_relocate_selected_groups mode -> optional_bank_selection: In the SHA-256-bound current C, mode controls only the optional bank branches. Retail 0x00234ffc saves a0 in s3; 0x002350c0..0x002350c8 admits selections 0/2 for slot 4, followed by link_hud_bank with bank 3 at 0x0023511c/0x00235120. The unsigned selection-minus-one check at 0x00235128..0x00235130 admits 1/2 for slot 5, followed by bank 4 at 0x00235184/0x00235188. Banks 0 and 2 precede both selection tests. This proves optional_bank_selection rather than a generic processing mode, bank index, bit mask or pause-menu state. --- .../shared/ui/hud/decompress_and_relocate_selected_groups.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c b/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c index 800d3fe530..1f83a86bff 100644 --- a/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c +++ b/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c @@ -27,7 +27,7 @@ extern int D_L00_0017E51C NOT_SDA; extern int D_L00_0017E520 NOT_SDA; void decompress_and_relocate_selected_groups(int mode) __asm__("FUN_L00_00234fd0"); -void decompress_and_relocate_selected_groups(int mode) { +void decompress_and_relocate_selected_groups(int optional_bank_selection) { enum { HUD_DECOMPRESS_OPTIONAL_BANK_3 = 0, HUD_DECOMPRESS_BOTH_OPTIONAL_BANKS = 2 @@ -61,7 +61,7 @@ void decompress_and_relocate_selected_groups(int mode) { decompression_destination += slot_3_size; } } - if (mode == HUD_DECOMPRESS_OPTIONAL_BANK_3 || mode == HUD_DECOMPRESS_BOTH_OPTIONAL_BANKS) { + if (optional_bank_selection == HUD_DECOMPRESS_OPTIONAL_BANK_3 || optional_bank_selection == HUD_DECOMPRESS_BOTH_OPTIONAL_BANKS) { { int slot_4_size; if ((slot_4_size = decompression_slot_state->t->sz[4])) { @@ -76,7 +76,7 @@ void decompress_and_relocate_selected_groups(int mode) { } } } - if ((unsigned)(mode - 1) < 2) { + if ((unsigned)(optional_bank_selection - 1) < 2) { G_234fd0 *group_4_decompression_state = &D_L00_0017E4D8_lui; if (group_4_decompression_state->t->sz[5]) { stash_receive_data(compressed_data_buffer, From 3f6deb17e1d1b4746d1c29c08df87f45a91d2078 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:11:24 +0000 Subject: [PATCH 218/657] decomp: clarify names in handle_sharkigator_contact_attack id -> attack_target_moby: Retail 0x0030f32c preserves incoming t3 in s6; after collect_mobies_in_sphere succeeds at 0x0030f414-0x0030f41c, 0x0030f424 loads D_L07_00173ED8 and 0x0030f428 compares it with s6 before recoil. Original Ghidra compares iRam00173ed8 with param_13. Supplied sharkigator_update passes target.moby, and adjacent test_sharkigator_target_sphere_collision uses the same global equality against target_moby. Thus id represents the attack target moby identity, not an unspecified ID. --- src/overlays/l07/mobys/sharkigator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l07/mobys/sharkigator.c b/src/overlays/l07/mobys/sharkigator.c index e3cda29216..fe14f20efe 100644 --- a/src/overlays/l07/mobys/sharkigator.c +++ b/src/overlays/l07/mobys/sharkigator.c @@ -679,7 +679,7 @@ void handle_sharkigator_contact_attack(struct Moby *moby, int seq, int frame, int state_after_target_hit, - int id, + int attack_target_moby, float lo, float hi, float hit_direction_length, @@ -713,7 +713,7 @@ void handle_sharkigator_contact_attack(struct Moby *moby, if (collect_mobies_in_sphere(probe_center, radius, 0x21, moby, hit_descriptor) == 0) { return; } - if (D_L07_00173ED8 != id) { + if (D_L07_00173ED8 != attack_target_moby) { return; } fast_vec_scale(moby_velocity, moby_velocity, -1.0f); From 1a47f8fff61f69516b25cc840342ccc4d52ec318 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:11:24 +0000 Subject: [PATCH 219/657] decomp: clarify names in unlock_sequence_controller_update id -> save_id: In the SHA-256-bound source, short id is assigned (short)moby->save_id and used in D_L14_001BB930.cleared[id] and current-level saved-unlock words indexed by id >> 5. Retail 0x00305478 loads the moby's ushort at +0xb2; 0x00305494-0x0030549c sign-extends it for the cleared-byte lookup at 0x003054a0. The same shifted value forms the saved-unlock word index at 0x003054b4-0x003054d4, proving this is the controller's save_id rather than a trigger-moby index. --- src/overlays/l14/mobys/unlock_sequence_controller.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l14/mobys/unlock_sequence_controller.c b/src/overlays/l14/mobys/unlock_sequence_controller.c index 2099da309b..b05d42fa0f 100644 --- a/src/overlays/l14/mobys/unlock_sequence_controller.c +++ b/src/overlays/l14/mobys/unlock_sequence_controller.c @@ -37,7 +37,7 @@ void unlock_sequence_controller_update(struct Moby *moby) { UNLOCK_SEQUENCE_COMPLETE = 3 }; int *unlock_sequence_data = ((int *)moby->pvars); - short id; + short save_id; switch (moby->state) { case UNLOCK_SEQUENCE_INITIALIZE: @@ -46,12 +46,12 @@ void unlock_sequence_controller_update(struct Moby *moby) { mark_moby_for_removal(moby); return; } - id = ((short)moby->save_id); - if (D_L14_001BB930.cleared[id] != 0) { + save_id = ((short)moby->save_id); + if (D_L14_001BB930.cleared[save_id] != 0) { moby->state = UNLOCK_SEQUENCE_COMPLETE; return; } - if (D_0014C190_257218[current_level_index][id >> 5] >> (moby->save_id & 0x1F) & 1) { + if (D_0014C190_257218[current_level_index][save_id >> 5] >> (moby->save_id & 0x1F) & 1) { moby->state = UNLOCK_SEQUENCE_COMPLETE; return; } From 5cbf08ab85a7de7704f161a15f3d2033d4302d71 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:13:07 +0000 Subject: [PATCH 220/657] decomp: clarify names in update_plasmabot_aim_quaternion state -> plasmabot_aim_private_vars: Authoritative C declares PlasmabotVars *state = (PlasmabotVars *)MOBY(moby)->pvars. Retail 0x002b35ec keeps moby in s2 and 0x002b3608 loads s1 from moby+0x78; Ghidra iVar1 is that same private record. 0x002b3614 reads its target at +0x110; 0x002b3668/0x002b3684 pass +0x268/+0x26c for yaw easing, 0x002b3698 selects quaternion storage at +0x170, and 0x002b373c/0x002b3744 pass +0x280/+0x284 for pitch easing. This proves the plasmabot aim private-variable record rather than a scalar state code. --- src/overlays/shared/enemies/plasmabot.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index 9e252168bb..423a9a7a3b 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -1271,8 +1271,8 @@ func_L00_0025CE58_2B4828(float *, float, float *, float, float, float) __asm__(" /* Eases the moby's yaw offset toward target_angle (clamped to about 70 degrees); with `flag` also eases the pitch toward its owner. Returns the remaining difference between the target and the current yaw offset. */ float update_plasmabot_aim_quaternion(char *moby, int flag, float target_angle) { - PlasmabotVars *state = (PlasmabotVars *)MOBY(moby)->pvars; - char *aim_target_moby = *(char **)(&state->target); + PlasmabotVars *plasmabot_aim_private_vars = (PlasmabotVars *)MOBY(moby)->pvars; + char *aim_target_moby = *(char **)(&plasmabot_aim_private_vars->target); float turn = fast_subtract_rotations(target_angle, MOBY(moby)->rot.z); if (turn > 1.2217304706573486f) turn = 1.2217304706573486f; @@ -1280,14 +1280,14 @@ float update_plasmabot_aim_quaternion(char *moby, int flag, float target_angle) turn = -1.2217304706573486f; { float yaw_easing_coefficient = frame_time_sq * 12.566370964050293f; - func_L00_0025CE58_2B4828((float *)(&state->aim_yaw_offset), + func_L00_0025CE58_2B4828((float *)(&plasmabot_aim_private_vars->aim_yaw_offset), turn, - (float *)(&state->aim_yaw_angular_velocity), + (float *)(&plasmabot_aim_private_vars->aim_yaw_angular_velocity), yaw_easing_coefficient, yaw_easing_coefficient, frame_time * 6.2831854820251465f); } - build_axis_rotation_quaternion(&state->aim_quaternion_storage, 2, state->aim_yaw_offset); + build_axis_rotation_quaternion(&plasmabot_aim_private_vars->aim_quaternion_storage, 2, plasmabot_aim_private_vars->aim_yaw_offset); if (flag) { float owner_aim_position[4]; float owner_aim_offset[4]; @@ -1304,17 +1304,17 @@ float update_plasmabot_aim_quaternion(char *moby, int flag, float target_angle) fast_vec_sub(bp, owner_aim_position, &MOBY(moby)->pos); owner_aim_offset[2] = owner_aim_offset[2] + 1.5f; target_pitch_angle = -fast_arc_tan(vector_length_xy(bp), owner_aim_offset[2]); - func_L00_0025CE58_2B4828((float *)(&state->aim_pitch_angle), + func_L00_0025CE58_2B4828((float *)(&plasmabot_aim_private_vars->aim_pitch_angle), target_pitch_angle, - (float *)(&state->aim_pitch_angular_velocity), + (float *)(&plasmabot_aim_private_vars->aim_pitch_angular_velocity), frame_time_sq * 12.566370964050293f, frame_time_sq * 12.566370964050293f, frame_time * 6.2831854820251465f); cp = pitch_quaternion; - build_axis_rotation_quaternion(cp, 1, *(float *)&state->aim_pitch_angle); - multiply_quaternions(&state->aim_quaternion_storage, &state->aim_quaternion_storage, cp); + build_axis_rotation_quaternion(cp, 1, *(float *)&plasmabot_aim_private_vars->aim_pitch_angle); + multiply_quaternions(&plasmabot_aim_private_vars->aim_quaternion_storage, &plasmabot_aim_private_vars->aim_quaternion_storage, cp); } - return fast_difference_between_rotations(turn, state->aim_yaw_offset); + return fast_difference_between_rotations(turn, plasmabot_aim_private_vars->aim_yaw_offset); } extern short *D_L14_001ABF40_3920[] __asm__("D_L14_001ABF40"); From 5d98c8d9b7938c16a6d9d0a5b66948adb2f989de Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:13:07 +0000 Subject: [PATCH 221/657] decomp: clarify names in sceMpegCreate state -> work_area_allocator: Bound source src/sdk/mpeg/api/sce_mpeg_create.c SHA-256 47796d22cbce4734527723a4c8159feee87deace2382ff4b3283009eaa773a6a assigns state = decoder + 0x108. Retail 0x0012b83c forms this address in s1; 0x0012b848-0x0012b850 passes it as the first argument to InitializeStateRecord with trailing storage decoder+0x10c0 and remaining size. The supplied init_work_area source initializes base, cursor, size and mark. Retail 0x0012b88c/0x0012b8f8 passes s1 to alloc_work_area for a 0x600-byte, 8-aligned allocation; 0x0012b988/0x0012b9a4 passes the same pointer to mark_work_area. The original Ghidra decompilation types it MpegWorkAreaAllocator *pAllocator and identifies decoder->workAreaAllocator, proving this local is the work-area allocator rather than the decoder state. --- src/sdk/mpeg/api/sce_mpeg_create.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/mpeg/api/sce_mpeg_create.c b/src/sdk/mpeg/api/sce_mpeg_create.c index 8e10770045..4d8b70c5e2 100644 --- a/src/sdk/mpeg/api/sce_mpeg_create.c +++ b/src/sdk/mpeg/api/sce_mpeg_create.c @@ -16,7 +16,7 @@ extern s32 ClearMpegReferenceBuffer(void *); s32 sceMpegCreate(void *mp, u8 *mpeg_work_area, s32 size) { u8 *decoder; - u8 *state; + u8 *work_area_allocator; s32 rest; s32 decode_workspace_address; @@ -27,9 +27,9 @@ s32 sceMpegCreate(void *mp, u8 *mpeg_work_area, s32 size) { _Error(decoder, mpeg_work_area_too_small_message); return 0; } - state = decoder + 0x108; + work_area_allocator = decoder + 0x108; W(mp, 0x40) = (s32)decoder; - init_work_area(state, decoder + 0x10C0, rest - 0x10C0); + init_work_area(work_area_allocator, decoder + 0x10C0, rest - 0x10C0); W(mp, 0x0) = 0; W(mp, 0x4) = 0; W(mp, 0x8) = 0; @@ -62,7 +62,7 @@ s32 sceMpegCreate(void *mp, u8 *mpeg_work_area, s32 size) { L(decoder, 0xF0) = -1; W(decoder, 0x1C) = (s32)D_0012CB30; W(decoder, 0x24) = (s32)D_0012CB40; - decode_workspace_address = alloc_work_area(decoder, state, 0x600, 8); + decode_workspace_address = alloc_work_area(decoder, work_area_allocator, 0x600, 8); W(decoder, 0x48) = 0; W(decoder, 0xFC) = 0; W(decoder, 0x100) = 0; @@ -91,7 +91,7 @@ s32 sceMpegCreate(void *mp, u8 *mpeg_work_area, s32 size) { W(decoder, 0x1D8) = (s32)(decoder + 0x458); W(decoder, 0x1DC) = (s32)(decoder + 0x4C0); W(decoder, 0x1E4) = (s32)(decoder + 0x528); - mark_work_area(state); + mark_work_area(work_area_allocator); W(decoder, 0x850) = -1; W(decoder, 0x84C) = 0; W(decoder, 0x81C) = 0x70003600; From 5510e00790c6513e70de1850d1fe7e8290a69d94 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:13:07 +0000 Subject: [PATCH 222/657] decomp: clarify names in draw_hud_sprite_uv id -> frame_index: In bound source src/ui/hud/sprites/draw_hud_sprite_uv.c (SHA-256 765d7ee23e43815d02333434c06b9ea178c6516c1b89f12e4e3f01f5fe35e026), s32 id indexes hud->frame_refs[id]; its image_index then selects hud->image_pages. Retail 0x0020026c shifts argument a0 by 2, 0x002002c8/0x002002d8 add the frame-reference array base, and 0x002002e0 loads the record's halfword at +2; 0x002002e4-0x002002e8 scale that separate image index by 8 to select the image page. Original Ghidra param_1 * 4 and subsequent short * 8 confirm the two distinct indices. The same argument is passed to get_frame_texture at 0x00200358, matching source get_frame_texture(id). Thus frame_index names the proven array selection rather than an unspecified ID. --- src/ui/hud/sprites/draw_hud_sprite_uv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/hud/sprites/draw_hud_sprite_uv.c b/src/ui/hud/sprites/draw_hud_sprite_uv.c index aaa9c7cad9..f6ad894999 100644 --- a/src/ui/hud/sprites/draw_hud_sprite_uv.c +++ b/src/ui/hud/sprites/draw_hud_sprite_uv.c @@ -9,14 +9,14 @@ void draw_hud_sprite_uv(s32 id, s32 x, s32 y, s32 w, s32 h, s32 u, s32 v, s32 al void draw_hud_sprite_uv( - s32 id, s32 x, s32 y, s32 sprite_width, s32 sprite_height, s32 u, s32 v, s32 alpha) { + s32 frame_index, s32 x, s32 y, s32 sprite_width, s32 sprite_height, s32 u, s32 v, s32 alpha) { struct HudState *hud = &hud_state; struct HudTexPage *image_page; s32 tw; s32 th; u64 *packet_words; - image_page = &hud->image_pages[hud->frame_refs[id].image_index]; + image_page = &hud->image_pages[hud->frame_refs[frame_index].image_index]; tw = 1 << (image_page->width_log2 + 4); th = 1 << (image_page->height_log2 + 4); render_packet_cursor.tag->tag = 0x10000005; @@ -26,7 +26,7 @@ void draw_hud_sprite_uv( packet_words = (u64 *)++render_packet_cursor.tag; packet_words[0] = (u64)0xE800 << 47 | 0x8001; packet_words[1] = 0x5353106; - packet_words[2] = get_frame_texture(id); + packet_words[2] = get_frame_texture(frame_index); packet_words[3] = 0x156; packet_words[4] = (u64)alpha << 24 | 0x7F7F7F; packet_words[5] = u | ((u64)v << 16); From 32f536ca7e3056cd63d267514449e9394023f64e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:13:07 +0000 Subject: [PATCH 223/657] decomp: clarify names in vi_buf_add_dma id -> dma_tag_id: In the authoritative vi_buf_add_dma source, id selects DMA_ID_REFE (0) for i == read_n - 1 and DMA_ID_REF (3) otherwise, then becomes the third argument of sc_tag2 for input_fifo->tag[index]. Retail 0x0023c0a8 computes the final block ordinal, 0x0023c0b4 compares it with s1, and 0x0023c0bc/0x0023c0c8 select a2 = 0 or 3 before the tag helper call at 0x0023c0d4. The original Ghidra uVar3 follows the same selection and third-argument flow, proving this is the DMA tag ID. --- src/movies/decoder/video_input/vi_buf_add_dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/movies/decoder/video_input/vi_buf_add_dma.c b/src/movies/decoder/video_input/vi_buf_add_dma.c index f26d23a80c..62d7f83e37 100644 --- a/src/movies/decoder/video_input/vi_buf_add_dma.c +++ b/src/movies/decoder/video_input/vi_buf_add_dma.c @@ -38,7 +38,7 @@ s32 vi_buf_add_dma(ViBuf *f) __asm__("FUN_0023bf70"); s32 vi_buf_add_dma(ViBuf *input_fifo) { s32 i; s32 index; - s32 id; + s32 dma_tag_id; s32 last; u32 d4chcr; u32 madr; @@ -77,10 +77,10 @@ s32 vi_buf_add_dma(ViBuf *input_fifo) { index = read_start; for (i = 0; i < read_n; i++) { - id = (i == read_n - 1) ? DMA_ID_REFE : DMA_ID_REF; + dma_tag_id = (i == read_n - 1) ? DMA_ID_REFE : DMA_ID_REF; sc_tag2((u64 *)(input_fifo->tag + index), (u32)((u8 *)input_fifo->data + VIBUF_ELM_SIZE * index), - id, + dma_tag_id, VIBUF_ELM_SIZE / 16); index = (index + 1) % input_fifo->n; } From 7c259d7ef7b071ffbb713fc3f72f847be761a093 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:13:08 +0000 Subject: [PATCH 224/657] decomp: clarify names in queue_starfighter_voice_line id -> voice_line_id: Retail 0x002e8754-0x002e8760 loads s2 (Ghidra uVar5, C id) as an unsigned byte from l13_starfighter_voice_line_ids at 0x001d3558 indexed by line_group_start_index plus randomized j. 0x002e885c-0x002e886c reloads the same ID after candidate advancement. At 0x002e8804-0x002e880c it selects the voice_line_history_mask bit at moby_data+0x13C, and 0x002e8870-0x002e887c and 0x002e88cc-0x002e88d8 add 50000 to this ID and store the queued secondary track. This proves voice_line_id rather than an index into the candidate group. --- src/overlays/l13/mobys/qwarks_starfighter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index 630f58dac4..6ac2767792 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -121,7 +121,7 @@ int queue_starfighter_voice_line(void *unused, int line_count) { int j = rand_q() % line_count; - int id = l13_starfighter_voice_line_ids[line_group_start_index + j]; + int voice_line_id = l13_starfighter_voice_line_ids[line_group_start_index + j]; int i; int lt; if (line_group_start_index < 0x1D) { @@ -146,23 +146,23 @@ int queue_starfighter_voice_line(void *unused, } if (line_group_start_index < 0x1D) { for (i = 0; i < line_count; i++) { - if ((*(int *)(moby_data + 0x13C) >> id) & 1) { + if ((*(int *)(moby_data + 0x13C) >> voice_line_id) & 1) { if (line_group_start_index < 0xC && random_integer_below(4) == 0) - *(int *)(moby_data + 0x13C) &= ~(1 << id); + *(int *)(moby_data + 0x13C) &= ~(1 << voice_line_id); j++; j %= line_count; - id = l13_starfighter_voice_line_ids[line_group_start_index + j]; + voice_line_id = l13_starfighter_voice_line_ids[line_group_start_index + j]; } else { - music_stream_state.queued_secondary_track = id + 50000; + music_stream_state.queued_secondary_track = voice_line_id + 50000; moby_data[0x13A] = 1; - *(int *)(moby_data + 0x13C) |= 1 << id; + *(int *)(moby_data + 0x13C) |= 1 << voice_line_id; return 1; } } if (line_group_start_index < 0xC) - *(int *)(moby_data + 0x13C) &= ~(1 << id); + *(int *)(moby_data + 0x13C) &= ~(1 << voice_line_id); } else { - music_stream_state.queued_secondary_track = id + 50000; + music_stream_state.queued_secondary_track = voice_line_id + 50000; moby_data[0x13A] = 1; return 1; } From d94603cb184406db0147428205e2552d16c2bbae Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:15:02 +0000 Subject: [PATCH 225/657] decomp: clarify names in draw_hud_sprite_flipped id -> frame_index: Retail 0x001ffe1c scales a0 by four; 0x001ffe94 and 0x001ffea4 select the frame-reference record, and 0x001ffeac loads its image_index at +2 before selecting the image page. The unchanged first argument is passed to get_frame_texture at 0x001fff08. Original Ghidra param_1 * 4 and get_frame_texture(param_1) agree with source hud_state.frame_refs[id] and get_frame_texture(id), proving a frame index rather than an image-page index. --- src/ui/hud/sprites/draw_hud_sprite_flipped.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/hud/sprites/draw_hud_sprite_flipped.c b/src/ui/hud/sprites/draw_hud_sprite_flipped.c index d4a3bc8f6f..df1f526bc5 100644 --- a/src/ui/hud/sprites/draw_hud_sprite_flipped.c +++ b/src/ui/hud/sprites/draw_hud_sprite_flipped.c @@ -8,14 +8,14 @@ extern u64 get_frame_texture(s32) __asm__("func_001FFA10"); void draw_hud_sprite_flipped(s32 id, s32 x, s32 y, s32 w, s32 h, s32 alpha) __asm__("FUN_001ffe18"); -void draw_hud_sprite_flipped(s32 id, s32 x, s32 y, s32 sprite_width, s32 sprite_height, s32 alpha) { +void draw_hud_sprite_flipped(s32 frame_index, s32 x, s32 y, s32 sprite_width, s32 sprite_height, s32 alpha) { struct HudTexPage *image_page; struct DmaTag *tag; u64 *packet_words; s32 tw; s32 th; - image_page = &hud_state.image_pages[hud_state.frame_refs[id].image_index]; + image_page = &hud_state.image_pages[hud_state.frame_refs[frame_index].image_index]; tw = 1 << image_page->width_log2; th = 1 << image_page->height_log2; render_packet_cursor.tag->tag = 0x10000007; @@ -27,7 +27,7 @@ void draw_hud_sprite_flipped(s32 id, s32 x, s32 y, s32 sprite_width, s32 sprite_ render_packet_cursor.tag = tag + 1; packet_words[0] = 0xB400000000008001; packet_words[1] = 0x53535353106; - packet_words[2] = get_frame_texture(id); + packet_words[2] = get_frame_texture(frame_index); packet_words[3] = 0x154; packet_words[4] = ((u64)alpha << 24) | 0x7F7F7F; packet_words[5] = tw << 4; From 84fadaca4a7caa70ec85088b7d2bb8228d631985 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:16:54 +0000 Subject: [PATCH 226/657] decomp: clarify names in update_world_object_animation id -> moby_id: In the authoritative C, id is read from sp[0], optionally replaced by cutscene_moby_ids_by_content_variant[level_render_state.content_variant], and passed to create_moby(id). Retail 0x00204864 loads the part-record word into a1; 0x00204884-0x002048AC compares it with 0x215 and optionally loads the variant-specific replacement. At 0x002048C8/0x002048CC that value becomes a0 for the moby factory. Original Ghidra iVar6 follows the same record-word, substitution and FUN_0020c4f8 argument flow, proving moby_id. --- src/world/update_world_object_animation.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/world/update_world_object_animation.c b/src/world/update_world_object_animation.c index ff04364e9d..15b2ab2bf6 100644 --- a/src/world/update_world_object_animation.c +++ b/src/world/update_world_object_animation.c @@ -90,7 +90,7 @@ void update_world_object_animation(void *unused_arg) { int i; int k; int idx; - int id; + int moby_id; int part_record_offset; int endp; int pc; @@ -116,12 +116,12 @@ void update_world_object_animation(void *unused_arg) { for (i = 0; i < D_0018CB20_lui.num_parts; i++) { part_record_offset = *cp++; sp = (int *)((unsigned char *)rec + part_record_offset); - id = sp[0]; + moby_id = sp[0]; sp = (int *)((unsigned char *)sp + 0xC); endp = (int)rec + sp[0]; sp = (int *)((unsigned char *)sp + 4); - if (game_mode_macro == 6 && i == 0 && id == 0x215) { - id = cutscene_moby_ids_by_content_variant[level_render_state.content_variant]; + if (game_mode_macro == 6 && i == 0 && moby_id == 0x215) { + moby_id = cutscene_moby_ids_by_content_variant[level_render_state.content_variant]; } mob = D_0018CB20_lui.slots[i]; if (mob == 0) { From 7d7922543ed92a0ece68353a4a5b02e98aeb8c35 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:16:54 +0000 Subject: [PATCH 227/657] decomp: clarify names in memcard_save_data flags -> level_index_override: Retail 0020b18c saves argument a1 in s1. At 0020b260 a negative s1 skips the override; 0020b270 stores nonnegative s1 into current_level_index (D_0015ED84), and 0020b278-0020b28c uses it to index and temporarily mark level_visit_state. The save entry records that level at 0020b2b4/0020b2ec. After preparation, 0020b350-0020b370 restores the visit byte and original current level from MemoryCardState +C8. Source flags therefore supplies a temporary level index, not a bitmask. --- src/save/memcard_save_data.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/save/memcard_save_data.c b/src/save/memcard_save_data.c index c2b775b649..e358a2b836 100644 --- a/src/save/memcard_save_data.c +++ b/src/save/memcard_save_data.c @@ -25,7 +25,7 @@ int memcard_save_data(int slot, int flags) __asm__("FUN_0020b178"); extern s32 current_bolt_count_macro __asm__("D_0015ED98") MACRO_ADDR; -int memcard_save_data(int slot, int flags) { +int memcard_save_data(int slot, int level_index_override) { enum { LEVEL_VISIT_UNVISITED = 0 }; @@ -59,11 +59,11 @@ int memcard_save_data(int slot, int flags) { } card_state->record_index = current_level_index; saved_visit_state = LEVEL_VISIT_UNVISITED; - if (flags >= 0) { - current_level_index = flags; - saved_visit_state = level_visit_state[flags]; + if (level_index_override >= 0) { + current_level_index = level_index_override; + saved_visit_state = level_visit_state[level_index_override]; if (saved_visit_state == LEVEL_VISIT_UNVISITED) { - level_visit_state[flags] = 1; + level_visit_state[level_index_override] = 1; } } } @@ -83,7 +83,7 @@ int memcard_save_data(int slot, int flags) { alternate_animation_sequence_macro; memcard_prepare_data(memcard_game_data_buffer, 0, mc_gamedata); memcard_prepare_data(memcard_level_data_buffer, card_state->record_index, mc_leveldata); - if (flags >= 0) { + if (level_index_override >= 0) { level_visit_state[current_level_index] = saved_visit_state; current_level_index = card_state->record_index; } From 5423887418cf4c4fbf2b6ef888b9d4600e5ea98c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:19:04 +0000 Subject: [PATCH 228/657] decomp: clarify names in emit_hero_randomized_motion_effects mode -> emission_position_mode: Retail 0x00209a54 copies a1 into s3. Comparisons at 0x00209ac8, 0x00209b20 and 0x00209b44 select randomized hero position (hero+0x80/+0x84/+0x88 stored at sp+0/4/8) or alternating moby points 0/14 and 23/22 written to sp by moby_point_position at 0x00209b5c/0x00209b70. At 0x00209c5c-0x00209c60 sp is passed as the position argument to FUN_0026f080. The bound C agrees: mode controls only construction of pos before the common effect call. --- src/overlays/shared/hero/hero_idle_sequence.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 474d271a3e..1e050b6e75 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -2581,7 +2581,7 @@ extern int random_integer_below_cf(void *, void *, float, float) __asm__("FUN_L0 void emit_hero_randomized_motion_effects(int iteration_count, int mode) __asm__("FUN_L00_00209a40"); -void emit_hero_randomized_motion_effects(int iteration_count, int mode) { +void emit_hero_randomized_motion_effects(int iteration_count, int emission_position_mode) { enum { HERO_MOTION_EFFECT_RANDOMIZED_HERO_POSITION = 0 }; @@ -2598,17 +2598,17 @@ void emit_hero_randomized_motion_effects(int iteration_count, int mode) { for (i = 0; i < iteration_count; i++) { hero_state = &hero; hero_displacement_source = (V_209a40 *)&hero_state->motion.displacement; - if (mode == HERO_MOTION_EFFECT_RANDOMIZED_HERO_POSITION) { + if (emission_position_mode == HERO_MOTION_EFFECT_RANDOMIZED_HERO_POSITION) { pos[0] = hero_state->motion.pos.f[0] + random_float_between(-0.1f, 0.1f); pos[1] = hero_state->motion.pos.f[1] + random_float_between(-0.1f, 0.1f); pos[2] = hero_state->motion.pos.f[2] + random_float_between(-0.5f, 0.1f); - } else if (mode == HERO_MOTION_EFFECT_ALTERNATING_MOBY_POINTS_0_AND_14) { + } else if (emission_position_mode == HERO_MOTION_EFFECT_ALTERNATING_MOBY_POINTS_0_AND_14) { if (!(i & 1)) { moby_point_position(hero_state->moby, 0, pos); } else { moby_point_position(hero_state->moby, 0xE, pos); } - } else if (mode == HERO_MOTION_EFFECT_ALTERNATING_MOBY_POINTS_23_AND_22) { + } else if (emission_position_mode == HERO_MOTION_EFFECT_ALTERNATING_MOBY_POINTS_23_AND_22) { if (!(i & 1)) { moby_point_position(hero_state->moby, 0x17, pos); } else { From 6900ef5b88773dc13582102a6040a6b00a2f3b03 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:21:00 +0000 Subject: [PATCH 229/657] decomp: clarify names in draw_rotated_hud_sprite id -> sprite_frame_id: Retail 0x0023bac4 scales first argument a0 by four; 0x0023bb3c/0x0023bb4c add the frame-table base, and 0x0023bb54 loads its signed +2 image index. 0x0023bb58-0x0023bb64 select the eight-byte image record supplying texture dimensions. The same a0 reaches the texture helper call at 0x0023bbb0; authoritative C explicitly uses tab[id].k and get_frame_texture(id). Adjacent draw_cropped_hud_sprite uses frame_id for get_frame_texture, proving this input identifies the sprite frame rather than a destination coordinate or image-page index. --- src/overlays/shared/ui/hud/hud_frame.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/ui/hud/hud_frame.c b/src/overlays/shared/ui/hud/hud_frame.c index 1720b64eac..8fbb0c6020 100644 --- a/src/overlays/shared/ui/hud/hud_frame.c +++ b/src/overlays/shared/ui/hud/hud_frame.c @@ -130,11 +130,11 @@ extern G_23bac0 D_L00_0017E4D8_23bac0 __asm__("D_L00_0017E4D8") NOT_SDA; void draw_rotated_hud_sprite( int id, int x, int y, int draw_width, int draw_height, int alpha) __asm__("FUN_L00_0023bac0"); -void draw_rotated_hud_sprite(int id, int x, int y, int draw_width, int draw_height, int alpha) { +void draw_rotated_hud_sprite(int sprite_frame_id, int x, int y, int draw_width, int draw_height, int alpha) { u64_23bac0 *packet_words; int *coordinate_offsets; G_23bac0 *sprite_render_data = &D_L00_0017E4D8_23bac0; - R_23bac0 *image_page = &sprite_render_data->rec[sprite_render_data->tab[id].k]; + R_23bac0 *image_page = &sprite_render_data->rec[sprite_render_data->tab[sprite_frame_id].k]; int ww = 1 << image_page->lw; int hh = 1 << image_page->lh; *(int *)(D_L00_001611C0_23bac0 + 0) = 0x10000007; @@ -145,7 +145,7 @@ void draw_rotated_hud_sprite(int id, int x, int y, int draw_width, int draw_heig packet_words = (u64_23bac0 *)D_L00_001611C0_23bac0; packet_words[0] = 0xB400000000008001UL; packet_words[1] = 0x53535353106UL; - packet_words[2] = get_frame_texture(id); + packet_words[2] = get_frame_texture(sprite_frame_id); packet_words[3] = 0x154; packet_words[4] = ((u64_23bac0)alpha << 24) | 0x7F7F7F; packet_words[5] = ww << 4; From f7289221c9c87dd1823098ff335553f74426aa7e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:21:00 +0000 Subject: [PATCH 230/657] decomp: clarify names in initialize_path_walker_group flags -> draw_distance: Source assigns flags from path_walker_draw_distance_gp and stores it as an unsigned short at current + 0x32. Retail 0x002e7d34 loads that setting with lhu v1,-0x4d70(gp), then 0x002e7d5c stores v1 with sh v1,0x32(s1) into the selected walker. Original Ghidra shows the same halfword transfer. Supplied path_walker_update also uses this established global as the distance argument to fast_bsphere_check. --- src/overlays/l16/mobys/path_walker.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l16/mobys/path_walker.c b/src/overlays/l16/mobys/path_walker.c index d4166affa2..f2a597e6bb 100644 --- a/src/overlays/l16/mobys/path_walker.c +++ b/src/overlays/l16/mobys/path_walker.c @@ -288,7 +288,7 @@ void initialize_path_walker_group(struct Moby *moby) { for (i = 0; i < count; i++) { unsigned char *current; L16WalkerData *selected_walker_data; - unsigned short flags; + unsigned short draw_distance; if (i == count - 1) { /* the last one takes the slot the loop index is on */ @@ -306,11 +306,11 @@ void initialize_path_walker_group(struct Moby *moby) { selected = (selected + 1) % (count - 1); } } - flags = path_walker_draw_distance_gp; + draw_distance = path_walker_draw_distance_gp; current[0x30] = 255; *(float *)(current + 0x2C) *= path_walker_initial_scale_multiplier; *(int *)(current + 0x94) = 0; - *(unsigned short *)(current + 0x32) = flags; + *(unsigned short *)(current + 0x32) = draw_distance; selected_walker_data = *(L16WalkerData **)(current + 0x78); selected_walker_data->parameter = (float)rank * (period / convert_integer_to_float(count)); selected_walker_data->owner = previous; From 2d5f0f77cbe43279f7c4d25bbeb2f8ffff88ba57 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:21:00 +0000 Subject: [PATCH 231/657] decomp: clarify names in update_snagglebeast_chase_movement mode -> waypoint_position: In source SHA-256 64e23353a5ed71bc6f0afd56a311860ed953db78b87765e61fe265e0f2979e86, snagglebeast_update copies the selected chase waypoint from unk140 into position and passes (int)&position as argument four. Retail 0x00313b14 saves a3 in s4; 0x00313b58 forwards s4 in a2 to the navigation helper at 0x00313b64, alongside navigation control +0x70 and displacement output +0x100. The supplied step_mover_2e3f20 context uses this third argument as target_position for distance, heading and move_w, proving a waypoint position address rather than a mode. --- src/overlays/l07/mobys/snagglebeast.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index 93fb1ccd41..6b61c18f5e 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -692,7 +692,7 @@ int update_snagglebeast_chase_movement(struct Moby *chaser_moby, int update_snagglebeast_chase_movement( - struct Moby *chaser_moby, struct ChaserVars *chaser_vars, Vec4 *goal, int mode, float range) { + struct Moby *chaser_moby, struct ChaserVars *chaser_vars, Vec4 *goal, int waypoint_position, float range) { float position_delta[4]; char *path; struct Moby *target_moby; @@ -704,7 +704,7 @@ int update_snagglebeast_chase_movement( path = D_L07_001B0530[chaser_vars->path]; if (range < goal_distance) { navigation_result = - step_mover_2e3f20(chaser_moby, chaser_vars->nav, mode, chaser_vars->navOut); + step_mover_2e3f20(chaser_moby, chaser_vars->nav, waypoint_position, chaser_vars->navOut); if (navigation_result == 2) { fast_vec_sub( position_delta, From fe3d92e315acff16127ee37a6b4196a579574835 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:21:00 +0000 Subject: [PATCH 232/657] decomp: clarify names in sample_camera_path flags -> rotation_output_flags: In src/camera/sample_camera_path.c (SHA-256 298b0660c741479105e446c18fa378ecba74e8adbf1c27bdeb36c8592c3e256a), lerp_vector writes position before if (!(flags & 1)) guards every rotation calculation and write. Retail 0x00214e6c saves the incoming parameter in s7; 0x00214f7c calls position interpolation, then 0x00214f84 ANDs s7 with 1 and 0x00214f88 branches to the epilogue at 0x00215090 when set. Rotation stores at 0x0021502c, 0x00215058, 0x00215074 and 0x00215088 are thereby skipped. The original Ghidra (flags & 1) == 0 guard agrees, proving rotation output control flags. --- src/camera/sample_camera_path.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/camera/sample_camera_path.c b/src/camera/sample_camera_path.c index ab1075d849..85e068aac3 100644 --- a/src/camera/sample_camera_path.c +++ b/src/camera/sample_camera_path.c @@ -25,7 +25,7 @@ void sample_camera_path(struct CameraPath *path, void sample_camera_path( - struct CameraPath *path, s32 loop, void *position, f32 *rotation, s32 flags, f32 progress) { + struct CameraPath *path, s32 loop, void *position, f32 *rotation, s32 rotation_output_flags, f32 progress) { Vec4 current_point; Vec4 next_point; Vec4 following_point; @@ -68,7 +68,7 @@ void sample_camera_path( qcopy(¤t_point.q, &path->points[point_index]); qcopy(&next_point.q, &path->points[next_index]); lerp_vector(position, ¤t_point, &next_point, fraction); - if (!(flags & 1)) { + if (!(rotation_output_flags & 1)) { fast_vec_sub(&segment, &next_point, ¤t_point); heading = fast_arc_tan(segment.f[0], segment.f[1]); pitch = fast_arc_tan(vector_length_xy(&segment), segment.f[2]); From 50fd2cd3c399e58753d2ca2dd9a7f8b90ba83898 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:21:00 +0000 Subject: [PATCH 233/657] decomp: clarify names in trooper_anim_finish id -> color_target_moby: Supplied decoy_update passes moby and process_horny_toad_hit_reaction passes toad_moby as argument one. Retail 0x0025d560 preserves a0 in s3; 0x0025d578 restores s3 to a0 before set_moby_color at 0x0025d584, and 0x0025d768/76c restores the same target before set_moby_color at 0x0025d778. No indexing or ID conversion occurs: this s32 carries the moby receiving restored or interpolated RGB. --- src/overlays/shared/rendering/effects/spawn_explosion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/rendering/effects/spawn_explosion.c b/src/overlays/shared/rendering/effects/spawn_explosion.c index 2381965955..649fb81a9f 100644 --- a/src/overlays/shared/rendering/effects/spawn_explosion.c +++ b/src/overlays/shared/rendering/effects/spawn_explosion.c @@ -141,7 +141,7 @@ void update_hit_color_flash(s32 id, struct HitColorFlash *animation_state) { else b = animation_state->original_blue; } - set_moby_color(id, r, g, b); + set_moby_color(color_target_moby, r, g, b); } s32 offset_path_index(s32 *tab, s32 i, s32 index_offset, s32 wrap) __asm__("FUN_L00_0025d7a0"); From 1cc43e4cdd5ec62fbb4d815e50e425fbce298613 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:23:04 +0000 Subject: [PATCH 234/657] decomp: clarify names in start_vendor_exit_cutscene mode -> secondary_stream_state: Authoritative source assigns mode from music_stream_state.secondary.state before and inside the audio wait loop. Retail 0x0029af24 and 0x0029af48 load signed halfword +0x5a of music_stream_state (0x001516d0); 0x0029af2c/0x0029af4c wait for SECONDARY_MUSIC_STREAM_READY_TO_CONTINUE (3), then 0x0029af54 calls continue_audio_stream_if_ready. Original Ghidra likewise polls uRam0015172a until 3. --- src/overlays/shared/vendor/vendor_menu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/vendor/vendor_menu.c b/src/overlays/shared/vendor/vendor_menu.c index cc025e7524..6da2375068 100644 --- a/src/overlays/shared/vendor/vendor_menu.c +++ b/src/overlays/shared/vendor/vendor_menu.c @@ -587,7 +587,7 @@ void start_vendor_exit_cutscene(void) { f32 *cutscene_world_origin; struct MusicStreamState *state; s32 *selected; - s16 mode; + s16 secondary_stream_state; jet_end_mount(2); if ((u16)(music_stream_state.secondary.state - 6) >= 2) @@ -632,11 +632,11 @@ void start_vendor_exit_cutscene(void) { state = &music_stream_state; state->queued_secondary_track = 0x2734; FUN_L00_002455c0(0); - mode = music_stream_state.secondary.state; - while (mode != SECONDARY_MUSIC_STREAM_READY_TO_CONTINUE) { + secondary_stream_state = music_stream_state.secondary.state; + while (secondary_stream_state != SECONDARY_MUSIC_STREAM_READY_TO_CONTINUE) { sound_update(); sce_gs_sync_v(0); - mode = music_stream_state.secondary.state; + secondary_stream_state = music_stream_state.secondary.state; } continue_audio_stream_if_ready(); } From 33c1bd699367a2dce15332e58d1fab72fa13a5aa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:25:54 +0000 Subject: [PATCH 235/657] decomp: clarify names in move_moby_with_step_collision flags -> collision_query_flags: Retail 0x00258834 shifts incoming a2 left one; 0x00258858 masks it with 0x20 into s5, matching source coll_flags = (flags * 2) & 0x20 and original Ghidra (param_6 & 0x10) << 1. That derived mask reaches the forward line query via a2 at 0x00258900-0x00258910, sphere query with OR 4 at 0x00258974-0x00258980, and downward line query with OR 2 through s7 at 0x0025894c and 0x002589e4-0x002589f8. Thus this parameter supplies collision-query flags, separately from s6's returned collision-result bits. --- src/overlays/shared/math/interpolation/spring_turn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/math/interpolation/spring_turn.c b/src/overlays/shared/math/interpolation/spring_turn.c index d55bbafbe5..88d9731052 100644 --- a/src/overlays/shared/math/interpolation/spring_turn.c +++ b/src/overlays/shared/math/interpolation/spring_turn.c @@ -333,7 +333,7 @@ int move_moby_with_step_collision(char *moby, float height) __asm__("FUN_L00_00258830"); int move_moby_with_step_collision(char *moby, char *velocity, - int flags, + int collision_query_flags, float step_height, float radius, @@ -343,7 +343,7 @@ int move_moby_with_step_collision(char *moby, Vs probe_end; Vs scaled_displacement; int movement_collision_result_flags = 0; - int coll_flags = (flags * 2) & 0x20; + int coll_flags = (collision_query_flags * 2) & 0x20; char *movement_position = &MOBY(moby)->pos; int i; char *collision_position; From b2cc14cf426ceaa57744493ebfbbec92787531f7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:28:20 +0000 Subject: [PATCH 236/657] decomp: clarify names in read_mpeg mode -> skip_mode: Retail 0x0023a4d4 loads D_0015EED8, identified as g_nMpegInputMode in original Ghidra; 0x0023a4dc bypasses all skip tests for -1, while 0x0023a4e4 selects policy 2 and 0x0023a4f0-0x0023a4f4 checks any pressed button before skip handling. Source assigns DECODE_MODE to mode solely for these skip-policy comparisons, proving skip_mode. --- src/movies/decoder/read_mpeg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/movies/decoder/read_mpeg.c b/src/movies/decoder/read_mpeg.c index 518c42a81e..b718430350 100644 --- a/src/movies/decoder/read_mpeg.c +++ b/src/movies/decoder/read_mpeg.c @@ -67,7 +67,7 @@ s32 read_mpeg(struct VideoDec *video_dec, s32 skipped; s32 started; s32 skip; - s32 mode; + s32 skip_mode; s32 decode_remaining; s32 read_remaining; s32 space; @@ -83,9 +83,9 @@ s32 read_mpeg(struct VideoDec *video_dec, sceGsSyncV(0); while (decode_remaining >= 5 && video_dec_get_state(video_dec) != VD_STATE_END) { update_primary_pad_state(); - mode = DECODE_MODE; - if (mode != -1) { - if ((mode == MOVIE_SKIP_MODE_ANY_BUTTON && pad_pressed(&controller_state, -1)) || + skip_mode = DECODE_MODE; + if (skip_mode != -1) { + if ((skip_mode == MOVIE_SKIP_MODE_ANY_BUTTON && pad_pressed(&controller_state, -1)) || ((D_0015EEA0 != 0 || alternate_animation_sequence != 0 || DECODE_MODE != 0 || current_level_index <= 0) && pad_pressed(&controller_state, 0x800))) { From ff42c53a609cd1f2be15e480918d383ca7f36238 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:28:21 +0000 Subject: [PATCH 237/657] decomp: clarify names in spawn_spinning_and_fading_effect_particle flags -> variant_flags: Retail 0x0026b24c retains the unsigned low byte of a2 in s4. Tests at 0x0026b294-0x0026b298 select alternate versus default lifetime bounds, color endpoints, texture and blend initialization. Bit 2 at 0x0026b3e4-0x0026b400 selects the texture-bank offset; 0x0026b474-0x0026b4c4 scales lifetime and invokes color-channel helpers. 0x0026b478 stores the byte in particle data+0x1F; the supplied update uses its bits 0 and 2 for size endpoint variants. Thus variant_flags identifies the selector domain beyond bare flags. --- .../effects/update_three_phase_effect_particle.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c index f12e3737b1..2d0a6cc652 100644 --- a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c +++ b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c @@ -874,7 +874,7 @@ unsigned char *spawn_spinning_and_fading_effect_particle(v unsigned char *spawn_spinning_and_fading_effect_particle(void *spawn_position, void *initial_velocity, - unsigned char flags, + unsigned char variant_flags, float size) { void *source = spawn_position; @@ -883,7 +883,7 @@ unsigned char *spawn_spinning_and_fading_effect_particle(void *spawn_pos unsigned char *motion = particle + 0x20; qcopy(particle + 0x10, source); qcopy(motion, initial_velocity); - if (flags & 1) { + if (variant_flags & 1) { float one = 1.0f; float zero = 0.0f; float scale = D_L00_001601D8_gp; @@ -925,7 +925,7 @@ unsigned char *spawn_spinning_and_fading_effect_particle(void *spawn_pos FUN_001fa6e0_26b230(spinning_particle_default_final_color_blend_source_gp, spinning_particle_default_final_color_blend_target_gp, random_float_between(zero, one)); - if (flags & 4) { + if (variant_flags & 4) { offset = 8; if (!item_text_variant[0x10]) offset = 0; @@ -938,8 +938,8 @@ unsigned char *spawn_spinning_and_fading_effect_particle(void *spawn_pos particle[8] = random_integer_below(0xFF); motion[0x1E] = truncate_float_to_s32(randf_sym(1.0f, 4.0f)); *(float *)(motion + 0x10) = size; - motion[0x1F] = flags; - if (flags & 4) { + motion[0x1F] = variant_flags; + if (variant_flags & 4) { *(short *)(particle + 0xA) = *(short *)(particle + 0xA) * (item_text_variant[0x10] + 2) / 2; swap_packed_color_channels(*(int *)(particle + 4), item_text_variant[0x10]); From 70e8e0106c0f87898a39f0bdbf3f92acc764d177 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:28:21 +0000 Subject: [PATCH 238/657] decomp: clarify names in cull_and_submit_water_grid_tile mode -> clip_mode: Original Ghidra param_3 and retail 0x002b8cc8 place a2 in s4. At 0x002b8ce8 zero bypasses corner clip tests; 0x002b8e7c..80 distinguishes value 1, and 0x002b8ed4 clears s4 when packed far clip bits s7 are zero. The other surviving tested branch clears s4 at 0x002b8f2c. Finally 0x002b8f44..5c replaces this clip control with VU entry 0xe or 0xc and passes it to 0x00262388. The supplied caller derives the argument from near/far clip masks. This proves a clipping mode, reused for clip-dependent dispatch, rather than a general rendering mode. --- .../shared/rendering/render_water_grids.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/rendering/render_water_grids.c b/src/overlays/shared/rendering/render_water_grids.c index 87917381c2..619e126c32 100644 --- a/src/overlays/shared/rendering/render_water_grids.c +++ b/src/overlays/shared/rendering/render_water_grids.c @@ -65,7 +65,7 @@ void cull_and_submit_water_grid_tile(f32 *grid_center_position, s32 index, s32 mode) __asm__("FUN_L01_002b8cb0"); -void cull_and_submit_water_grid_tile(f32 *grid_center_position, s32 index, s32 mode) { +void cull_and_submit_water_grid_tile(f32 *grid_center_position, s32 index, s32 clip_mode) { enum { WATER_TILE_MODE_SKIP_CLIP_TESTS = 0, WATER_TILE_MODE_TEST_FAR_CLIP = 1 @@ -84,7 +84,7 @@ void cull_and_submit_water_grid_tile(f32 *grid_center_position, s32 index, s32 m u32 near_bits, far_bits; s32 i, tile_vertex_offset, row, column; - if (mode != WATER_TILE_MODE_SKIP_CLIP_TESTS) { + if (clip_mode != WATER_TILE_MODE_SKIP_CLIP_TESTS) { row = index >> 2; column = index & 3; half_x = 0.5f * -pool_light[2]; @@ -130,7 +130,7 @@ void cull_and_submit_water_grid_tile(f32 *grid_center_position, s32 index, s32 m far_bits = (far_bits << 8) | is_vector_outside_clip(far_clip); near_bits = (near_bits << 8) | is_vector_outside_clip(near_clip); } - if (mode == WATER_TILE_MODE_TEST_FAR_CLIP) { + if (clip_mode == WATER_TILE_MODE_TEST_FAR_CLIP) { if ((near_bits & 0x01010101) == 0x01010101) return; if ((near_bits & 0x02020202) == 0x02020202) @@ -140,7 +140,7 @@ void cull_and_submit_water_grid_tile(f32 *grid_center_position, s32 index, s32 m if ((near_bits & 0x08080808) == 0x08080808) return; if (far_bits == 0) - mode = WATER_TILE_MODE_SKIP_CLIP_TESTS; + clip_mode = WATER_TILE_MODE_SKIP_CLIP_TESTS; if ((near_bits & 0x20202020) == 0x20202020) return; } else { @@ -154,16 +154,16 @@ void cull_and_submit_water_grid_tile(f32 *grid_center_position, s32 index, s32 m return; if ((near_bits & 0x20202020) == 0x20202020) return; - mode = WATER_TILE_MODE_SKIP_CLIP_TESTS; + clip_mode = WATER_TILE_MODE_SKIP_CLIP_TESTS; } } tile_vertex_offset = (index & 3) * 4 + (index >> 2) * 0x44; - if (mode != WATER_TILE_MODE_SKIP_CLIP_TESTS) { - mode = WATER_TILE_VU_ENTRY_FAR_CLIP_PENDING; + if (clip_mode != WATER_TILE_MODE_SKIP_CLIP_TESTS) { + clip_mode = WATER_TILE_VU_ENTRY_FAR_CLIP_PENDING; } else { - mode = WATER_TILE_VU_ENTRY_NO_FAR_CLIP; + clip_mode = WATER_TILE_VU_ENTRY_NO_FAR_CLIP; } - FUN_L01_00262388(mode, tile_vertex_offset); + FUN_L01_00262388(clip_mode, tile_vertex_offset); } void build_water_render_setup_packet(void) __asm__("FUN_L01_002b8f98"); From 08c8880101d39cc2499860037b29c4f98e6c7a4c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:30:25 +0000 Subject: [PATCH 239/657] decomp: clarify names in draw_dual_texture_50_quad_mesh flags -> packed_blend_settings: In the SHA-256-bound source, flags is a long assembled from dual_texture_mesh_blend_color_a_selector_gp, color_b_selector_gp, alpha_c_selector_gp, color_d_selector_gp and fixed_alpha_gp at shifts 0, 2, 4, 6 and 32. Retail 0x002fd20c-0x002fd24c performs these loads, shifts and ORs into v1; 0x002fd258/0x002fd25c stores that same word into both quad packets at +0x88. Original Ghidra uStack_1c8 is the identical packed expression, copied to uStack_138. These are packed blend settings shared by the two rendering passes, rather than unrelated boolean flags. --- src/overlays/l06/mobys/dual_texture_meshes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l06/mobys/dual_texture_meshes.c b/src/overlays/l06/mobys/dual_texture_meshes.c index 4748d0f13d..c31e4495d2 100644 --- a/src/overlays/l06/mobys/dual_texture_meshes.c +++ b/src/overlays/l06/mobys/dual_texture_meshes.c @@ -5423,7 +5423,7 @@ void draw_dual_texture_50_quad_mesh(void) { float y_offset = dual_texture_mesh_first_pass_u_offset_multiplier_gp * l06_camera.yaw; float x_offset = dual_texture_mesh_first_pass_v_offset_multiplier_gp * l06_camera.pitch; void *matrix_ptr; - long flags; + long packed_blend_settings; int i, j; long tex = get_effect_texture(dual_texture_mesh_first_pass_texture_index_gp); From cb5ca427040f6dcb2cf45ce9e3076d1b0b0dc4d0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:30:25 +0000 Subject: [PATCH 240/657] decomp: clarify names in try_fire_sandmouse_projectile state -> sandmouse_pvars: The authoritative sandmouse_update obtains sandmouse_vars = (Pv *)sandmouse_moby->pvars and passes it as the second argument to try_fire_sandmouse_projectile. Retail 0x0030d5fc preserves a1 in s2; 0x0030d60c-0x0030d61c accesses its +0x54 cooldown, 0x0030d62c-0x0030d668 reads/toggles its +0x56 joint selector, 0x0030d6a0 stores the selected target at +0x60 (cleared at 0x0030d854), and 0x0030d840-0x0030d850 increments +0x5C after firing. Original Ghidra param_2 follows these same offsets, proving this char pointer is the sandmouse pvars block rather than a scalar state. --- src/overlays/shared/enemies/sandmouse.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/enemies/sandmouse.c b/src/overlays/shared/enemies/sandmouse.c index 4a9070df4a..6cd9b74629 100644 --- a/src/overlays/shared/enemies/sandmouse.c +++ b/src/overlays/shared/enemies/sandmouse.c @@ -174,7 +174,7 @@ typedef union { extern s32 cutscene_mode_gp __asm__("D_L01_0015F5C4") __attribute__((sda)); void try_fire_sandmouse_projectile(char *moby, char *state) __asm__("FUN_L01_0030d5f0"); -void try_fire_sandmouse_projectile(char *moby, char *state) { +void try_fire_sandmouse_projectile(char *moby, char *sandmouse_pvars) { V4_w22c spawn_position; V4_w22c target_aim_position; V4_w22c spawn_offset; @@ -182,10 +182,10 @@ void try_fire_sandmouse_projectile(char *moby, char *state) { float target_yaw, target_pitch, initial_yaw, initial_pitch, target_bearing_yaw, spawn_to_target_distance; - if (fast_dec_timer_s16(state + 0x54) == 0) + if (fast_dec_timer_s16(sandmouse_pvars + 0x54) == 0) return; - moby_point_position(moby, (state[0x56] & 1) + 1, &spawn_position); - state[0x56] = state[0x56] ^ 1; + moby_point_position(moby, (sandmouse_pvars[0x56] & 1) + 1, &spawn_position); + sandmouse_pvars[0x56] = sandmouse_pvars[0x56] ^ 1; target_moby = select_sandmouse_projectile_target( moby, &spawn_position, @@ -197,7 +197,7 @@ void try_fire_sandmouse_projectile(char *moby, char *state) { 3.1415927f, 3.1415927f); if (target_moby != 0) { - *(char **)(state + 0x60) = target_moby; + *(char **)(sandmouse_pvars + 0x60) = target_moby; if (hero.motion.pos.f[2] + 1.1f < MOBY(moby)->pos.z) { target_bearing_yaw = fast_arc_tan(MOBY(target_moby)->pos.x - MOBY(moby)->pos.x, MOBY(target_moby)->pos.y - MOBY(moby)->pos.y); @@ -237,13 +237,13 @@ void try_fire_sandmouse_projectile(char *moby, char *state) { initial_yaw, initial_pitch); allocate_voice_for_target_entry(0, 0, (struct VoiceTarget *)moby); - *(short *)(state + 0x54) = scale_game_frames(D_L01_00162080_gp); - *(int *)(state + 0x5C) = *(int *)(state + 0x5C) + 1; + *(short *)(sandmouse_pvars + 0x54) = scale_game_frames(D_L01_00162080_gp); + *(int *)(sandmouse_pvars + 0x5C) = *(int *)(sandmouse_pvars + 0x5C) + 1; } } } } else { - *(int *)(state + 0x60) = 0; + *(int *)(sandmouse_pvars + 0x60) = 0; } } From 3d314e8f87e68ab2b7e89d35ec7555eef1272d42 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:30:25 +0000 Subject: [PATCH 241/657] decomp: clarify names in process_gunship_part_hits state -> voice_entry_index: In the bound gunship.c snapshot, state is initialized to -1 and assigned the existing GUNSHIP_*_VOICE_ENTRY enum members before allocate_voice_for_target_entry(state, 0, moby). Original Ghidra lVar8 maps to retail s3: -1 at 0x002e2278, 1 at 0x002e22d4/0x002e22f0, 2 at 0x002e2308, and 0 at 0x002e234c. The bltz at 0x002e24a4 excludes the sentinel, moves s3 into a0 at 0x002e24a8 and calls the voice allocator at 0x002e24b0. This is a voice-entry index, separate from the actual moby state store at 0x002e24a0. --- src/overlays/l08/mobys/gunship.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l08/mobys/gunship.c b/src/overlays/l08/mobys/gunship.c index eb696a98a6..096e920c9f 100644 --- a/src/overlays/l08/mobys/gunship.c +++ b/src/overlays/l08/mobys/gunship.c @@ -252,7 +252,7 @@ void process_gunship_part_hits(struct Moby *moby) { char *part_entry_cursor = entries; int i; int score = 0; - int state = -1; + int voice_entry_index = -1; int chosen = 0; char *gunship_part_table; for (i = 0; i < 34; i++, part_entry_cursor += 16) { @@ -261,18 +261,18 @@ void process_gunship_part_hits(struct Moby *moby) { if (i < 7) { if (score <= 0) { score = 1; - state = GUNSHIP_NON_TARGET_HIT_VOICE_ENTRY; + voice_entry_index = GUNSHIP_NON_TARGET_HIT_VOICE_ENTRY; } } else if (i < 10) { if (score < 2) { score = 2; - state = GUNSHIP_NON_TARGET_HIT_VOICE_ENTRY; + voice_entry_index = GUNSHIP_NON_TARGET_HIT_VOICE_ENTRY; } } else { if (score < 4) { score += 4; chosen = i; - state = GUNSHIP_TARGET_HIT_VOICE_ENTRY; + voice_entry_index = GUNSHIP_TARGET_HIT_VOICE_ENTRY; } } (*(unsigned char **)part_entry_cursor)[0xA4] = 0xFF; @@ -280,7 +280,7 @@ void process_gunship_part_hits(struct Moby *moby) { } *(short *)(gunship_instance_vars + 0x28C) += score; if (*(short *)(gunship_instance_vars + 0x28C) >= 8) { - state = GUNSHIP_TARGETS_EXHAUSTED_VOICE_ENTRY; + voice_entry_index = GUNSHIP_TARGETS_EXHAUSTED_VOICE_ENTRY; *(short *)(gunship_instance_vars + 0x28C) = *(short *)(gunship_instance_vars + 0x28C) % 8; if (chosen != 0) { int off = chosen * 16; @@ -319,8 +319,8 @@ void process_gunship_part_hits(struct Moby *moby) { ((char *)moby)[0x20] = 99; } } - if (state >= GUNSHIP_TARGETS_EXHAUSTED_VOICE_ENTRY) - allocate_voice_for_target_entry(state, 0, moby); + if (voice_entry_index >= GUNSHIP_TARGETS_EXHAUSTED_VOICE_ENTRY) + allocate_voice_for_target_entry(voice_entry_index, 0, moby); } /* Moby class 444 */ From b82b27ae7dd8ac2e580b33f88e05496732daccaa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:30:26 +0000 Subject: [PATCH 242/657] decomp: clarify names in update_test_dummy_damage_and_respawn status -> hit_reaction_status: Retail 0x002ceb0c passes sp+0x40 as t0 to hit_reaction at 0x002ceb18; 0x002ceb20 loads that output and 0x002ceb24 compares it with 1 to skip damage handling. Source passes &status and tests HIT_REACTION_STATUS_NO_DAMAGE. Original Ghidra iStack_70 follows the same output-pointer and branch data flow, proving this is the hit_reaction status rather than the moby state. --- src/overlays/l16/mobys/test_dummy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l16/mobys/test_dummy.c b/src/overlays/l16/mobys/test_dummy.c index bc13ff981f..4d6f4ebc0e 100644 --- a/src/overlays/l16/mobys/test_dummy.c +++ b/src/overlays/l16/mobys/test_dummy.c @@ -542,7 +542,7 @@ void update_test_dummy_damage_and_respawn(void *moby) { }; L16HitMoby *hit_moby = moby; float matrix[16]; - int status; + int hit_reaction_status; float amount; L16HitData *hit_data; char *dummy_hit_record; @@ -575,8 +575,8 @@ void update_test_dummy_damage_and_respawn(void *moby) { } amount = 0.0f; dummy_hit_record = find_moby_hit(hit_moby, 0x330000, 0); - hit_reaction(hit_moby, dummy_hit_record, &hit_data->health, 0, &status, &amount, 0, 4); - if (status != HIT_REACTION_STATUS_NO_DAMAGE && hit_moby->state != TEST_DUMMY_STATE_BURST && + hit_reaction(hit_moby, dummy_hit_record, &hit_data->health, 0, &hit_reaction_status, &amount, 0, 4); + if (hit_reaction_status != HIT_REACTION_STATUS_NO_DAMAGE && hit_moby->state != TEST_DUMMY_STATE_BURST && hit_moby->state != TEST_DUMMY_STATE_RESPAWN) { hit_data->health -= amount; if (hit_data->health <= 0.0f) { From 29e4eb79c2ba486f606c847652ccdbea11045d93 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:30:26 +0000 Subject: [PATCH 243/657] decomp: clarify names in spawn_amoeboid_burst_sparks mode -> input_motion: Authoritative large_amoeboid.c SHA-256 15fe7b952c0abd8d2ef9f91783850b3983585dfc53cd9f620175ca72359ca1a8 passes this f32 pointer to fast_vec_scale(origin_copy, mode, vertical * frame_time_gp). Retail 0x002ef7b8 saves a1 at sp+0x40, 0x002ef858 reloads it as the source vector for 0x002ef85c, with a random input-motion multiplier times frame time at 0x002ef83c-0x002ef860. The original Ghidra param_2/uStack_d0 follows this same flow. Random radial XY and vertical Z terms are added at 0x002ef878-0x002ef8b8; the vector is copied to velocity at 0x002ef8bc-0x002ef8c0, adjusted downward, and both vectors reach spawn_spark at 0x002efa14-0x002efa1c. Thus it is input motion contributing to emitted sparks. --- src/overlays/shared/enemies/large_amoeboid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index 1e062fd34b..86992f0988 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -1030,7 +1030,7 @@ void spawn_amoeboid_movement_particles(unsigned char *moby) { } } -void spawn_amoeboid_burst_sparks(unsigned char *moby, f32 *mode) { +void spawn_amoeboid_burst_sparks(unsigned char *moby, f32 *input_motion) { LargeAmoeboidVars *burst_amoeboid_vars = (LargeAmoeboidVars *)MOBY(moby)->pvars; f32 spawn_position[4], origin[4], velocity[4]; u128 *dest; @@ -1057,7 +1057,7 @@ void spawn_amoeboid_burst_sparks(unsigned char *moby, f32 *mode) { lateral = random_float_between(amoeboid_burst_vertical_speed_min_gp, amoeboid_burst_vertical_speed_max_gp); vertical = random_float_between(0.0f, amoeboid_burst_input_motion_scale_max_gp); - fast_vec_scale(origin_copy, mode, vertical * frame_time_gp); + fast_vec_scale(origin_copy, input_motion, vertical * frame_time_gp); scale = fast_cos(angle); origin[0] += scale * (radius * frame_time_gp); scale = fast_sin(angle); From d28a6594e9710d9ac4780ff408d42500d23d71aa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:30:26 +0000 Subject: [PATCH 244/657] decomp: clarify names in button_update id -> save_entry_index: In button_update, id is assigned (s16)moby->save_id in both cases and indexes D_L14_001BB930.cleared[id] and the save-bit word [id >> 5]. Retail 0x00306bd0-0x00306be8 loads moby+0xB2, sign-extends it, and indexes the cleared byte; 0x00306bf4-0x00306c14 selects its save-bit word. Retail 0x00306db4-0x00306de8 repeats the signed save-entry word-index calculation before the activation bit store at 0x00306e08. Thus this is the save entry index, not a path list index or mission index. --- src/overlays/l14/mobys/button.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l14/mobys/button.c b/src/overlays/l14/mobys/button.c index 26f9952756..32b26b8418 100644 --- a/src/overlays/l14/mobys/button.c +++ b/src/overlays/l14/mobys/button.c @@ -29,7 +29,7 @@ void button_update(struct Moby *moby) { BUTTON_ACTIVATED = 2 }; s32 *button_pvars = (s32 *)moby->pvars; - s16 id; + s16 save_entry_index; s32 i; s32 list; char *path_entry_base; @@ -42,9 +42,9 @@ void button_update(struct Moby *moby) { case BUTTON_INITIALIZE: *(f32 *)(button_pvars + 3) = random_angle_radians(); moby->pos.z -= 0.35f; - id = (s16)moby->save_id; - if (D_L14_001BB930.cleared[id] != 0 || - (D_0014C190_257218[current_level_index][id >> 5] >> (moby->save_id & 31) & 1) != 0 || + save_entry_index = (s16)moby->save_id; + if (D_L14_001BB930.cleared[save_entry_index] != 0 || + (D_0014C190_257218[current_level_index][save_entry_index >> 5] >> (moby->save_id & 31) & 1) != 0 || (button_pvars[2] != 0 && D_0014C050[moby->mission + current_level_index * 16] == 0xFF)) { moby->command = 2; @@ -79,8 +79,8 @@ void button_update(struct Moby *moby) { high = color << 16; moby->glow_color = high | shade | color; if (hero.ground_moby == moby && hero.air_frames.s == 0) { - id = (s16)moby->save_id; - D_0014C190_257218[current_level_index][id >> 5] |= 1 << (moby->save_id & 31); + save_entry_index = (s16)moby->save_id; + D_0014C190_257218[current_level_index][save_entry_index >> 5] |= 1 << (moby->save_id & 31); D_L14_001BABD0[(s16)moby->save_id >> 5] |= 1 << (moby->save_id & 31); moby->state = BUTTON_ACTIVATED; moby->command = 1; From 32fcede04548489af609280546af2f11596c9394 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:32:25 +0000 Subject: [PATCH 245/657] decomp: clarify names in draw_electric_gate_beams id -> moby_list_entry: In authoritative source src/overlays/l05/mobys/electric_gate.c (SHA-256 f443595b433af68c3ae581677425c1794a450238e243099d51146891edb57c1e), id = *(short *)list captures the current entry before list advances, and while (id >= 0) tests its sign. Retail 0030e110-0030e124 loads the same halfword, masks 0x7fff, scales by 256 and adds the moby-table base; 0030e1b0 loads it signed and 0030e1b4 branches on nonnegative, with the pointer advance at 0030e1b8. Original Ghidra likewise captures uVar2 = *puVar22 before advancing and tests (short)uVar2 < 0. This is the encoded moby list entry, including its termination bit, rather than a bare identifier. --- src/overlays/l05/mobys/electric_gate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l05/mobys/electric_gate.c b/src/overlays/l05/mobys/electric_gate.c index 0c6dfba5b4..934f0c9aa9 100644 --- a/src/overlays/l05/mobys/electric_gate.c +++ b/src/overlays/l05/mobys/electric_gate.c @@ -127,7 +127,7 @@ void draw_electric_gate_beams(struct Moby *moby) { float angle, blend; unsigned short *list; unsigned short *next_moby_index_ptr; - short id; + short moby_list_entry; angle = convert_integer_to_float(frame_number & 0x3F) / 63.0f * 6.28318f; for (i = 0; i < 5; i++) { @@ -183,9 +183,9 @@ void draw_electric_gate_beams(struct Moby *moby) { draw_geometry_quad(&quads[1][k], matrix, 0); } } - id = *(short *)list; + moby_list_entry = *(short *)list; list = next_moby_index_ptr; - } while (id >= 0); + } while (moby_list_entry >= 0); } float D_L05_0020B740[4][2] = { From b49d5b24bb961a5abd2eb44cc41c33a313a7f343 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:32:25 +0000 Subject: [PATCH 246/657] decomp: clarify names in process_menu_entry flags -> source_entry_flags: Retail 0x00216cac loads u16 entry+0x10 from s1 before 0x00216cb8 replaces s1 with the linked entry pointer. The saved bits are masked with 4 at 0x00216cb4 and tested at 0x00216cc4 to gate callback handling for the linked entry. Original Ghidra uVar1 is likewise captured before piVar9 is reassigned; the authoritative C captures current_menu_entry->unk10 before selecting the linked entry. Thus this local holds the source entry's flags, rather than the newly selected entry's flags. --- src/ui/menus/system/process_menu_entry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/menus/system/process_menu_entry.c b/src/ui/menus/system/process_menu_entry.c index 1240a49968..0557ec899d 100644 --- a/src/ui/menus/system/process_menu_entry.c +++ b/src/ui/menus/system/process_menu_entry.c @@ -84,7 +84,7 @@ void process_menu_entry(void *callback_context, Menu *menu, s32 follow_entry_lin char *substring_match; s32 ok; s32 condition_target_entry_index; - u16 flags; + u16 source_entry_flags; s16 linked_entry_index; s16 kind; s32 bolt_threshold; From 8399a8852e2fd6ec5812e6f92fb337782e2a257d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:34:23 +0000 Subject: [PATCH 247/657] decomp: clarify names in initialize_level_map_archive flags -> item_availability: Authoritative C assigns flags the unsigned-char view of item_available and reads only flags[0x21]. Retail 0x002465c8..0x002465d4 forms base 0x0013d4c0 and loads its byte at +0x21 (Ghidra cRam0013d4e1), whose zero/nonzero test selects archive table 0x001383a0/0x00138438 and loaded=0/1. This proves item-availability array provenance without identifying the particular item. state -> map_archive_state: Authoritative C assigns this RenderArchiveState pointer &D_L00_001841F0 in initialize_level_map_archive. Retail 0x00246618 establishes s3=0x001841f0; stores at 0x00246678/+0x22c and 0x00246680/+0x234 retain the map archive stash handle and transfer count, while 0x002466d0, 0x002466ec and 0x0024671c store copied section and scratch pointers at +4,+0x14,+8. Original Ghidra shows the same global destinations, proving the pointer owns map archive setup state. --- .../shared/game/run_level_main_loop.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/game/run_level_main_loop.c b/src/overlays/shared/game/run_level_main_loop.c index 4d1ea1528e..77308c1a29 100644 --- a/src/overlays/shared/game/run_level_main_loop.c +++ b/src/overlays/shared/game/run_level_main_loop.c @@ -394,7 +394,7 @@ extern char D_001383A0[]; void initialize_level_map_archive(void) { int i; - RenderArchiveState *state; + RenderArchiveState *map_archive_state; int level; struct DiscFile *file; int heap_tag, first_size, second_size, archive_transfer_qwords; @@ -402,7 +402,7 @@ void initialize_level_map_archive(void) { unsigned char *level_data; int x, y, mask_buffer; float radius_sq; - unsigned char *flags; + unsigned char *item_availability; D_L00_001841F0.initialized = 1; { @@ -431,8 +431,8 @@ void initialize_level_map_archive(void) { map_coefficients[i * 4 + 2] = map_y0 - scale_y * world_y0; } } - flags = (unsigned char *)((unsigned char *)item_available); - if (flags[0x21] != 0) { + item_availability = (unsigned char *)((unsigned char *)item_available); + if (item_availability[0x21] != 0) { D_L00_001841F0.loaded = 1; file = (struct DiscFile *)D_00138438 + D_L00_001841F0.archive_index; } else { @@ -447,16 +447,16 @@ void initialize_level_map_archive(void) { archive = (int *)((int)archive_base + 0x9A800); archive_transfer_qwords = file->size << 7; read_disc_sectors_and_wait(archive, file->sector, file->size); - state->file_handle = stash_send_data( + map_archive_state->file_handle = stash_send_data( (int)archive, archive_transfer_qwords, 0x4800, (int)map_archive_stash_tag); - state->transfer_bytes = archive_transfer_qwords; + map_archive_state->transfer_bytes = archive_transfer_qwords; fast_decompress((int)archive, (int)archive_base); archive = archive_base; first_size = archive[1] - archive[0]; - state->first_data = hud_heap_alloc(first_size, 0, (char *)heap_tag, 0x2DB); - fast_mem_copy((void *)state->first_data, (char *)archive + archive[0], first_size); - state->first_data += 8; - state->second_data = state->first_data; + map_archive_state->first_data = hud_heap_alloc(first_size, 0, (char *)heap_tag, 0x2DB); + fast_mem_copy((void *)map_archive_state->first_data, (char *)archive + archive[0], first_size); + map_archive_state->first_data += 8; + map_archive_state->second_data = map_archive_state->first_data; second_size = archive[2] - archive[1]; state->coverage_runs = hud_heap_alloc(second_size, 0, (char *)heap_tag, 0x2EC); fast_mem_copy((void *)state->coverage_runs, (char *)archive + archive[1], second_size); From e650d3c09cde25bf0fb6fc7ce12b102426f0cbf0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:34:23 +0000 Subject: [PATCH 248/657] decomp: clarify names in initialize_vendor_selected_item_mobys id -> selected_item_moby_class: In the authoritative source, int id receives item_defs_lui[k].cls after k is loaded from rows[cursor].item. Retail 0x0029b6c4-0x0029b6e0 indexes the selected row with stride 0x14, then ItemDef with stride 0x4c and loads class offset 0x10 into s3. At 0x0029b6e8 item 0x18 overrides s3 with 0x1df; otherwise 0x0029b6ec-0x0029b6f4 passes it to select_world_object_resource_tables. Instructions 0x0029b6fc-0x0029b714 and 0x0029b974-0x0029b980 pass the same s3 as init_moby_instance's class argument for menu_mobys+0x100 and +0x300. The original Ghidra decompilation represents this binding as uVar1 with the same class lookup, override and two initialization uses. --- src/overlays/shared/vendor/vendor_menu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/vendor/vendor_menu.c b/src/overlays/shared/vendor/vendor_menu.c index 6da2375068..6a6a2a7edb 100644 --- a/src/overlays/shared/vendor/vendor_menu.c +++ b/src/overlays/shared/vendor/vendor_menu.c @@ -757,18 +757,18 @@ void initialize_vendor_selected_item_mobys(void) __asm__("FUN_L00_0029b6 void initialize_vendor_selected_item_mobys(void) { V_29b680 item_local_position; - int id; + int selected_item_moby_class; int k; int x; k = vendor_menu_lui.rows[vendor_menu_lui.cursor].item; - id = item_defs_lui[k].cls; + selected_item_moby_class = item_defs_lui[k].cls; if (k == 0x18) { - id = 0x1DF; + selected_item_moby_class = 0x1DF; } else { - select_world_object_resource_tables(id, -1); + select_world_object_resource_tables(selected_item_moby_class, -1); } - init_moby_instance(((u8 *)vendor_menu_lui.menu_mobys) + 0x100, id); + init_moby_instance(((u8 *)vendor_menu_lui.menu_mobys) + 0x100, selected_item_moby_class); *(short *)(((u8 *)vendor_menu_lui.menu_mobys) + 0x132) = 0x40; *(int *)(((u8 *)vendor_menu_lui.menu_mobys) + 0x194) = 0; fast_vec_add(item_local_position, @@ -819,7 +819,7 @@ void initialize_vendor_selected_item_mobys(void) { update_entity(((u8 *)vendor_menu_lui.menu_mobys) + 0x200); FUN_0020d4f0_29b680(((u8 *)vendor_menu_lui.menu_mobys) + 0x200, 0x202020, 0xE, 0xE, 0); } - init_moby_instance(((u8 *)vendor_menu_lui.menu_mobys) + 0x300, id); + init_moby_instance(((u8 *)vendor_menu_lui.menu_mobys) + 0x300, selected_item_moby_class); if ((*(unsigned char **)(((u8 *)vendor_menu_lui.menu_mobys) + 0x224))[6]) { ((u8 *)vendor_menu_lui.menu_mobys)[0x273] = 0x18; } From 56a4936058f87491173f9a1d4df5c5394e38caca Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:36:44 +0000 Subject: [PATCH 249/657] decomp: clarify names in update_box_emitter flags -> voice_playback_flags: In update_box_emitter, flags is initialized to 0x10 and changed to 0x14 when the selected sound definition byte +0x18 is nonzero. Retail 0x003199e8 initializes s1; 0x00319b54-0x00319b68 conditionally selects 0x14 into s1. At 0x00319b84 s1 moves to a1, the second argument of the play_voice call at 0x00319b90, alongside sound_data[0], moby, and volume. This proves it is the voice playback flag argument, without assigning undocumented bit meanings. --- src/overlays/shared/audio/emitters/box_emitter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/audio/emitters/box_emitter.c b/src/overlays/shared/audio/emitters/box_emitter.c index d7e2a00bc5..e35ffb5704 100644 --- a/src/overlays/shared/audio/emitters/box_emitter.c +++ b/src/overlays/shared/audio/emitters/box_emitter.c @@ -23,7 +23,7 @@ void update_box_emitter(char *moby) { OvlVec4 delta, radius, box_size, listener; int *sound_data = *(int **)(moby + 8); int volume; - int flags; + int voice_playback_flags; float box_length, listener_length; radius.f[2] = radius.f[1] = radius.f[0] = MOBY(moby)->bsphere.w; @@ -34,7 +34,7 @@ void update_box_emitter(char *moby) { listener_length = fast_vec_length(&listener); box_length = fast_vec_length(&box_size); if (box_length < listener_length) { - flags = 0x10; + voice_playback_flags = 0x10; if (absolute_float(box_size.f[0]) <= 1.0f && absolute_float(box_size.f[1]) <= 1.0f && absolute_float(box_size.f[2]) <= 1.0f) { volume = *(int *)(D_L00_0015F5F4 + sound_data[0] * 0x20 + 0xc); @@ -57,12 +57,12 @@ void update_box_emitter(char *moby) { D_L00_0015F5F4 + sound_data[0] * 0x20); } if (*(u8 *)(D_L00_0015F5F4 + sound_data[0] * 0x20 + 0x18)) - flags = 0x14; + voice_playback_flags = 0x14; { char *slot = D_0013E550 + sound_data[4] * 0x70; if (*(char **)(slot + 0x8c) != moby || *(u8 *)(slot + 0x74) == 0) { if (fast_dec_timer(&sound_data[3])) { - sound_data[4] = play_voice(sound_data[0], flags, moby, volume); + sound_data[4] = play_voice(sound_data[0], voice_playback_flags, moby, volume); if (sound_data[2] > 0) { sound_data[3] = (int)((float)scale_game_frames( From 70e7b01cbfe9c346d8ebba8db43b11bb01961543 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:36:44 +0000 Subject: [PATCH 250/657] decomp: clarify names in volume_camera_aim state -> current_follow_camera_state: Source assigns rig = FOLLOW_CAM_STATE(current_follow_camera_record), where the record comes from current_follow_cam, then state = rig. Retail 0x002ed654 loads current_follow_cam, 0x002ed658 loads its +0x70 state pointer into s4, and 0x002ed660 copies it to s0. The original Ghidra puVar4 = *(undefined4 **)(DAT_00166e00 + 0x70) agrees. This pointer supplies eye and look_target destinations at 0x002ed698/0x002ed6c4 and 0x002ed6f4/0x002ed70c, copies position at 0x002ed740-0x002ed750, and derives reset at 0x002ed66c. Thus this binding is the current follow-camera state being initialized. --- src/overlays/shared/camera/aim_volume_camera.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/camera/aim_volume_camera.c b/src/overlays/shared/camera/aim_volume_camera.c index 8afea21fef..2edde5c981 100644 --- a/src/overlays/shared/camera/aim_volume_camera.c +++ b/src/overlays/shared/camera/aim_volume_camera.c @@ -94,7 +94,7 @@ void volume_camera_aim(struct UpdateCam *aim_camera_record) { struct UpdateCam *current_follow_camera_record; Vec4f *rec_pos; FollowCamState *rig; - FollowCamState *state; + FollowCamState *current_follow_camera_state; FollowCamBlock *follow; FollowCamTail *tail; FollowCamSnap *snap; @@ -149,8 +149,8 @@ void volume_camera_aim(struct UpdateCam *aim_camera_record) { tail = &rig->tail; snap = &rig->tail.snap; /* A second pointer to the same state: retail keeps both. */ - state = rig; - reset = &state->reset; + current_follow_camera_state = rig; + reset = ¤t_follow_camera_state->reset; qcopy(rec_pos, pos); tail->distance = params->distance; tail->pivot_height = params->height; From ffa926483c71e3669c8a1dfbc7c73c9ece6c2dae Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:36:44 +0000 Subject: [PATCH 251/657] decomp: clarify names in draw_moby_wobble_quads flags -> blend_control: Authoritative lamp.c SHA-256 0a8ea93caf51d9ed92b9b8abc6de944e207e6f60f91935c07d3889a58fc1ea04 declares this u64 and packs wobble_quad_blend_a/b/c/d_selector_gp at shifts 0/2/4/6 with 0x8000000000ULL, then assigns both quad_a.control[3] and quad_b.control[3]. Original Ghidra uStack_1f8/uStack_168 and retail 0030c32c..0030c388 show these loads, shifts and ORs; 0030c390 and 0030c3a0 store the same packed word to sp+0x88 and sp+0x118. The supplied checked-helper annotation identifies quad+0x88 as the GS ALPHA control consumed at 0022c2f0..0022c30c. This proves blend_control rather than generic flags. --- src/overlays/shared/props/lamp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/props/lamp.c b/src/overlays/shared/props/lamp.c index 65562ff7fd..c02521ac29 100644 --- a/src/overlays/shared/props/lamp.c +++ b/src/overlays/shared/props/lamp.c @@ -111,7 +111,7 @@ void draw_moby_wobble_quads(struct Moby *moby) { float *direction; float *up; u64 texture; - u64 flags; + u64 blend_control; float phase; float sign; float pass; @@ -135,7 +135,7 @@ void draw_moby_wobble_quads(struct Moby *moby) { qcopy(matrix + 12, position); texture = get_effect_texture(wobble_quad_texture_index_gp); - flags = (u64)(s64)wobble_quad_blend_a_selector_gp | + blend_control = (u64)(s64)wobble_quad_blend_a_selector_gp | ((u64)(s64)wobble_quad_blend_b_selector_gp << 2) | ((u64)(s64)wobble_quad_blend_c_selector_gp << 4) | ((u64)(s64)wobble_quad_blend_d_selector_gp << 6) | 0x8000000000ULL; @@ -145,8 +145,8 @@ void draw_moby_wobble_quads(struct Moby *moby) { quad_b.control[1] = texture; quad_a.control[1] = texture; quad_a.control[0] = 0; - quad_b.control[3] = flags; - quad_a.control[3] = flags; + quad_b.control[3] = blend_control; + quad_a.control[3] = blend_control; for (k = 0; k < 4; k++) { float u = wobble_quad_texcoords[k][0]; float v = wobble_quad_texcoords[k][1]; From 47db776275ed6b7f95827ecdadb74ce1b21f95bd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:38:47 +0000 Subject: [PATCH 252/657] decomp: clarify names in resolve_hero_current_position_collisions mode -> history_attempt_index: In the SHA-256-bound current C, resolve_hero_collisions_with_history passes i from its 0..15 loop, rewinding hero.pos_history_index and restoring a history position after each failed attempt. Retail 0x002133b8 preserves a0 in s8; 0x00213678-0x0021367c compares that saved argument to 15, matching param_1 == 0xf in the original decompilation. Only that final attempt clamps correction components at 0x00213684-0x00213740 and normalizes/adds the correction at 0x00213750-0x00213760. Thus it is the history attempt index, distinct from hero.state.control_mode and hero.gravity_mode. --- src/overlays/shared/hero/hero_switch_item.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index e826481b2c..860bbe34f5 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -3672,7 +3672,7 @@ extern s32 rig_probe(void *, s32, f32, s32, f32) __asm__("FUN_L00_001f19a0"); extern s32 FUN_L00_001f3170(void *, f32); s32 resolve_hero_current_position_collisions(s32 mode) __asm__("FUN_L00_002133a8"); -s32 resolve_hero_current_position_collisions(s32 mode) { +s32 resolve_hero_current_position_collisions(s32 history_attempt_index) { enum { HERO_COLLISION_HISTORY_FINAL_ATTEMPT_INDEX = 0xF }; @@ -3746,7 +3746,7 @@ s32 resolve_hero_current_position_collisions(s32 mode) { fast_vec_sub(&collision_correction, &hero.motion.pos.q, &pre_collision_position); probe_height_or_correction_length = fast_vec_length(&collision_correction); if (hero.capsule_radius * 1.5f < probe_height_or_correction_length) { - if (mode == HERO_COLLISION_HISTORY_FINAL_ATTEMPT_INDEX) { + if (history_attempt_index == HERO_COLLISION_HISTORY_FINAL_ATTEMPT_INDEX) { if (512.0f < collision_correction.f[0]) collision_correction.f[0] = 512.0f; else if (collision_correction.f[0] < -512.0f) From 3f2d5f6d56f48977d88580fbe42bfa251e50c6ad Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:38:47 +0000 Subject: [PATCH 253/657] decomp: clarify names in floor_button_update id -> save_flag_index: Authoritative floor_button_update source declares s16 id and assigns (s16)moby->save_id. Retail 0030c608 loads moby+0xB2; 0030c610-0030c614 sign-extends it, and 0030c61c-0030c620 uses it to select the collected byte at save-table base+0x454. At 0030c62c-0030c650 the same signed identifier shifted right by 5 selects the save-bitset word, while the low five save_id bits select its bit. Thus this local is the save-flag index, not a path or mission identifier. --- src/overlays/shared/props/floor_button.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/props/floor_button.c b/src/overlays/shared/props/floor_button.c index 9dc333f2dd..6fec818591 100644 --- a/src/overlays/shared/props/floor_button.c +++ b/src/overlays/shared/props/floor_button.c @@ -34,7 +34,7 @@ void floor_button_update(struct Moby *moby) { FLOOR_BUTTON_STATE_DISABLED = 2 }; s32 *floor_button_private_state = (s32 *)moby->pvars; - s16 id; + s16 save_flag_index; s32 i; s32 list; char *path_key_cursor; @@ -47,9 +47,9 @@ void floor_button_update(struct Moby *moby) { case FLOOR_BUTTON_STATE_INITIALIZE: *(f32 *)(floor_button_private_state + 3) = random_angle_radians(); moby->pos.z -= 0.35f; - id = (s16)moby->save_id; - if (l05_mission_gated_moby_save_flags.collected[id] != 0 || - (D_0014C190_257218[current_level_index][id >> 5] >> (moby->save_id & 31) & 1) != 0 || + save_flag_index = (s16)moby->save_id; + if (l05_mission_gated_moby_save_flags.collected[save_flag_index] != 0 || + (D_0014C190_257218[current_level_index][save_flag_index >> 5] >> (moby->save_id & 31) & 1) != 0 || (floor_button_private_state[2] != 0 && D_0014C050[moby->mission + current_level_index * 16] == 0xFF)) { moby->command = 2; From 4e9077882244a553dfbf0220c238f6e62a4a6b1b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:38:48 +0000 Subject: [PATCH 254/657] decomp: clarify names in draw_dual_texture_58_quad_mesh flags -> packed_quad_blend_settings: Authoritative source src/overlays/l06/mobys/dual_texture_meshes.c (SHA-256 91ba4b234425ca6c3609b873ca47aabd666f4f94b436a41efe3f92d66358c49d) initializes long flags from dual_texture_mesh_blend_color_a_selector_gp, color_b << 2, alpha_c << 4, color_d << 6 and fixed_alpha << 32. Retail 0x002fd4d0-0x002fd510 loads these globals, shifts and ORs them into v1; 0x002fd51c/0x002fd520 store the same word at sp+0x88 and sp+0x118, the two packets' unk88 fields. Original Ghidra uStack_1f8 packs those five inputs and is copied into uStack_168. Both packets reach draw calls at 0x002fd6e4/0x002fd6f4, proving shared packed quad blend settings. --- src/overlays/l06/mobys/dual_texture_meshes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l06/mobys/dual_texture_meshes.c b/src/overlays/l06/mobys/dual_texture_meshes.c index c31e4495d2..9b7bd69b3c 100644 --- a/src/overlays/l06/mobys/dual_texture_meshes.c +++ b/src/overlays/l06/mobys/dual_texture_meshes.c @@ -5490,7 +5490,7 @@ void draw_dual_texture_58_quad_mesh(void) { void *matrix_ptr; float y_offset = dual_texture_mesh_first_pass_u_offset_multiplier_gp * l06_camera.yaw; float x_offset = dual_texture_mesh_first_pass_v_offset_multiplier_gp * l06_camera.pitch; - long flags; + long packed_quad_blend_settings; int i, j; float facing; @@ -5498,7 +5498,7 @@ void draw_dual_texture_58_quad_mesh(void) { get_effect_texture(dual_texture_mesh_first_pass_texture_index_gp); mesh_second_pass_quad_packet.tex = get_effect_texture(0x2a); matrix_ptr = matrix; - flags = (long)dual_texture_mesh_blend_color_a_selector_gp | + packed_quad_blend_settings = (long)dual_texture_mesh_blend_color_a_selector_gp | (long)dual_texture_mesh_blend_color_b_selector_gp << 2 | (long)dual_texture_mesh_blend_alpha_c_selector_gp << 4 | (long)dual_texture_mesh_blend_color_d_selector_gp << 6 | From 4ac91c96d27326f07e1c67a43735824ac1411ded Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:38:48 +0000 Subject: [PATCH 255/657] decomp: clarify names in update_metropolis_train_motion id -> current_car_moby_index: In the authoritative C, id is initialized from next_id loaded from locomotive_state->first_car_moby_index. Retail 0x00292918 loads pvars+0xA0 and 0x00292928 moves it to s4. At 0x00292B08-0x00292B14, s4 is shifted by eight and added to the moby array base to select the carriage updated in that iteration. Retail 0x00292C64 loads the updated carriage's pvars+0xC0 into s4; 0x00292C68-0x00292C70 tests -1 before selecting the next carriage. Thus this binding is the current carriage's moby index throughout traversal, matching original Ghidra iVar6. --- src/overlays/l03/mobys/metropolis_train_locomotive.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l03/mobys/metropolis_train_locomotive.c b/src/overlays/l03/mobys/metropolis_train_locomotive.c index b5aa8e4b0f..81ed32532f 100644 --- a/src/overlays/l03/mobys/metropolis_train_locomotive.c +++ b/src/overlays/l03/mobys/metropolis_train_locomotive.c @@ -148,7 +148,7 @@ void update_metropolis_train_motion(char *moby) { Car292890 *car_data; char *target; int next_id; - int id; + int current_car_moby_index; float distance_margin_or_target_angle; locomotive_state = ((Train292890 *)MOBY(moby)->pvars); @@ -167,7 +167,7 @@ void update_metropolis_train_motion(char *moby) { if (next_id != 0) { locomotive_state->first_car_moby_index = next_id; } - id = next_id; + current_car_moby_index = next_id; target = coupling + 0x10; distance_margin_or_target_angle = locomotive_state->fDC - vector_distance_xy(moby + 0x10, target); @@ -209,7 +209,7 @@ void update_metropolis_train_motion(char *moby) { (locomotive_state->fC8 * 60.0f / locomotive_state->fC0) * frame_time); moby_point_position(moby, 0, front); do { - car = D_L03_0015FFD8_292890 + (id << 8); + car = D_L03_0015FFD8_292890 + (current_car_moby_index << 8); ((unsigned char *)car)[0x72] = 0xFF; car_data = *(Car292890 **)(car + 0x78); moby_point_position(car, 0, rear); @@ -236,8 +236,8 @@ void update_metropolis_train_motion(char *moby) { update_entity_matrix(car_data->motion, delta, car_data->prev_rot, car + 0x40); qcopy(car_data->prev_pos, car + 0x10); qcopy(car_data->prev_rot, car + 0x40); - id = car_data->next_car_moby_index; - } while (id != -1); + current_car_moby_index = car_data->next_car_moby_index; + } while (current_car_moby_index != -1); fast_vec_sub(delta, moby + 0x10, old_pos); update_entity_matrix(locomotive_state->motion, delta, old_rot, moby + 0x40); } else { From 481355635b913cb4edff42c70cd3b21f71bc612c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:38:48 +0000 Subject: [PATCH 256/657] decomp: clarify names in equalizer_ammo_spawner_update id -> weapon_index: Bound source SHA-256 7cd34f3a34ec95a27ad5054f46d6f6a2a6b0e3593118fe2b7fa8f392f51a7016 declares id from D_L07_00161CA0[i]. Retail 0031d4c4 loads this value into s7; 0031d4d0-0031d4dc index weapon_ammo_counts by s7*4, and 0031d4f4-0031d4fc index scaling rows by s7*0x18. At 0031d6d0 s7 becomes a1 for the spawn call at 0031d6d8. The supplied spawn_on_path context names that argument weapon_index and uses it to select item_defs ammo_pickup_cls and initialize the pickup weapon index. Thus this binding identifies the weapon whose ammo is examined and spawned. --- src/overlays/l07/mobys/equalizer_ammo_spawner.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l07/mobys/equalizer_ammo_spawner.c b/src/overlays/l07/mobys/equalizer_ammo_spawner.c index 83dd07a9a0..87e75e6de2 100644 --- a/src/overlays/l07/mobys/equalizer_ammo_spawner.c +++ b/src/overlays/l07/mobys/equalizer_ammo_spawner.c @@ -89,10 +89,10 @@ state_one: { if (is_point_inside_clip_volume(D_0013F3D0, ammo_spawner_state[0]) == 0) return; for (i = 0; D_L07_00161CA0[i] != -1; i++) { - int id = D_L07_00161CA0[i]; - float current_ammo_count = convert_integer_to_float(weapon_ammo_counts[id]); + int weapon_index = D_L07_00161CA0[i]; + float current_ammo_count = convert_integer_to_float(weapon_ammo_counts[weapon_index]); float scale = convert_integer_to_float( - ((L07ScaleRow *)((char *)l07_ammo_spawner_scaling_rows + id * 0x18))->scale); + ((L07ScaleRow *)((char *)l07_ammo_spawner_scaling_rows + weapon_index * 0x18))->scale); float ratio = current_ammo_count / scale; float step = random_float_between(0.0f, *(float *)(ammo_spawner_state + 8)); float min_ratio = *(float *)(ammo_spawner_state + 2) / 100.0f; @@ -142,13 +142,13 @@ state_one: { } while (accepted == 0); total = remaining; debug_print(D_L07_00211B78, - id, + weapon_index, batch, fptodp(position[0]), fptodp(position[1]), fptodp(position[2]), fptodp(step)); - spawn_on_path(position, id, batch, 0); + spawn_on_path(position, weapon_index, batch, 0); step += random_float_between(*(float *)(ammo_spawner_state + 8) / retry_step, 2.0f); if (remaining < batch) { From 7f1ff6e27255539518e72685021d2a1636f96597 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:40:41 +0000 Subject: [PATCH 257/657] decomp: clarify names in _decMB0 type -> macroblock_type_flags: The authoritative C assigns this int from *mb_type after vector decoding. Retail 0x00127ef8 loads that word; 0x00127efc tests its intra flag and 0x00127f04 masks its low two block-decode flags. It is a macroblock-type snapshot, distinct from motion_type and dct_type. --- src/sdk/mpeg/macroblock/_decMB0.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/mpeg/macroblock/_decMB0.c b/src/sdk/mpeg/macroblock/_decMB0.c index 6c0030fed4..d43e8935f3 100644 --- a/src/sdk/mpeg/macroblock/_decMB0.c +++ b/src/sdk/mpeg/macroblock/_decMB0.c @@ -38,7 +38,7 @@ int _decMB0(struct MpegDecoder *decoder, u32 dc_reset_command_base; int motion_vector_count; int type_code; - int type; + int macroblock_type_flags; int coding_type; int new_var; int command_base; @@ -150,9 +150,9 @@ int _decMB0(struct MpegDecoder *decoder, } decode_success = 0; if (decoder->slice_error == 0) { - type = *mb_type; - coded = type & 3; - if (type & 1) { + macroblock_type_flags = *mb_type; + coded = macroblock_type_flags & 3; + if (macroblock_type_flags & 1) { if (decoder->concealment_motion_vectors != 0) { _flushBuf(decoder, 1); }; From e7b0ae4568025fc2eb7ee988e716c37cce05cc94 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:42:46 +0000 Subject: [PATCH 258/657] decomp: clarify names in draw_health_hud_panel mode -> icon_capacity: Retail 0x00239998-0x002399bc reads hero_max_health or Clank vehicle-mode HP into sp+0x14. This value selects the capacity-8/5 icon-offset layouts at 0x002399c0-0x00239a20 and bounds the number of health icons drawn at 0x00239b50-0x00239b54 and 0x00239c74-0x00239c80, matching source mode. --- .../shared/ui/hud/draw_hud_item_selector_panel.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c b/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c index fb816f9ef2..d32f32548b 100644 --- a/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c +++ b/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c @@ -1045,7 +1045,7 @@ s32 draw_health_hud_panel(Hud *hud_element) { s16 *p; s32 sel; Pt *tab; - s32 mode; + s32 icon_capacity; s32 first_panel_half_width; s32 second_panel_half_width; s32 x0; @@ -1086,16 +1086,16 @@ s32 draw_health_hud_panel(Hud *hud_element) { panel_alpha = truncate_float_to_s32((f32)health_hud_panel_max_alpha * ratio_x); p = hud_element->p; sel = p[0] >> 1; - mode = hero_max_health; + icon_capacity = hero_max_health; if (cnt == 0) sel = 0x1E; if (hero.vehicle_mode == HERO_VEHICLE_MODE_CLANK) - mode = hero.health.vehicle_mode_hp; - if (mode == HEALTH_HUD_EIGHT_ICON_CAPACITY) { + icon_capacity = hero.health.vehicle_mode_hp; + if (icon_capacity == HEALTH_HUD_EIGHT_ICON_CAPACITY) { tab = l00_health_hud_eight_capacity_icon_offsets; first_panel_half_width = truncate_float_to_s32(ratio_x * 48.0f); second_panel_half_width = truncate_float_to_s32(ratio_x * 48.0f); - } else if (mode == HEALTH_HUD_FIVE_ICON_CAPACITY) { + } else if (icon_capacity == HEALTH_HUD_FIVE_ICON_CAPACITY) { tab = l00_health_hud_five_capacity_icon_offsets; first_panel_half_width = truncate_float_to_s32(ratio_x * 32.0f); second_panel_half_width = truncate_float_to_s32(ratio_x * 16.0f); @@ -1147,7 +1147,7 @@ s32 draw_health_hud_panel(Hud *hud_element) { health_hud_panel_cap_size, panel_alpha); } - for (i = 0; i < mode; i++) { + for (i = 0; i < icon_capacity; i++) { health_icon_frame_index = get_icon_frame(0x7536, sel); hud_frame(hud_element, health_icon_frame_index, x + tab[i].x, y + tab[i].y, 1, alpha); if (sel != 0x1E) { From f9d7b264fa13e0acfe32ede92d3cc05f694062ab Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:42:46 +0000 Subject: [PATCH 259/657] decomp: clarify names in update_cutscene_playback id -> current_keyframe_index: Retail 0x002992a8 loads cutscene frame counter +0x38; 0x002992bc arithmetic-shifts it right by one, then 0x002992c0/+0x002992c8 and 0x002992d0 store index+1 to moby next_frame +0x51 and index to frame +0x50. At 0x00299310-0x00299324 the frame byte selects a 16-byte vector from keys +0x78 for the current weighted position. Original Ghidra cVar3 has this same flow; supplied C assigns id=f38>>1 then frame=id, next_frame=id+1. --- src/overlays/shared/cutscenes/update_cutscene_playback.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/cutscenes/update_cutscene_playback.c b/src/overlays/shared/cutscenes/update_cutscene_playback.c index a945fb4728..543f624e00 100644 --- a/src/overlays/shared/cutscenes/update_cutscene_playback.c +++ b/src/overlays/shared/cutscenes/update_cutscene_playback.c @@ -715,7 +715,7 @@ void update_cutscene_playback(void) { s32 done; s32 last; s32 i; - s32 id; + s32 current_keyframe_index; s32 audio_chunk_frame_threshold; Vec4 *keys; f32 fade; @@ -780,9 +780,9 @@ void update_cutscene_playback(void) { last = apply_cutscene_camera_key(); for (i = 0; i < D_L00_0016C860.h44; i++) { cutscene_moby = D_L00_0016C860.f178[i]; - id = D_L00_0016C860.f38 >> 1; - cutscene_moby->frame = id; - cutscene_moby->next_frame = id + 1; + current_keyframe_index = D_L00_0016C860.f38 >> 1; + cutscene_moby->frame = current_keyframe_index; + cutscene_moby->next_frame = current_keyframe_index + 1; update_moby_animation_state(cutscene_moby); cutscene_moby->blend = convert_integer_to_float(D_L00_0016C860.f38 & 1) * 0.5f; if (last && (D_L00_0016C860.f38 & 1)) { From 74cef28c2c063a1af186ea316ceba740ccf13201 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:44:40 +0000 Subject: [PATCH 260/657] decomp: clarify names in break_apart_shuttle_linked_mobys id -> linked_moby_index: Authoritative src/overlays/l06/mobys/shuttle.c SHA-256 f2e0169cfb727d244eecd71a02c77b41c4eeba51f868fdcc6758c61a420b5812 declares id once and assigns *list & 0x7FFF in both passes. Retail 0x00303c30-0x00303c50 loads and masks the linked-list element, then shifts it by 8 to select a Moby from D_L06_0015FFD8; its position is used at 0x00303c74-0x00303c94. The second pass repeats the mask and stride at 0x00303d10-0x00303d30 and passes the selected Moby to begin_moby_linear_and_angular_motion at 0x00303dd8. Original Ghidra uStack_e0 = *puVar13 & 0x7fff, iVar11 = uStack_e0 * 0x100 corroborates this indexing. Retail 0x00303fcc-0x00304018 reuses the last index to write command 30. Thus this is a linked Moby array index, not an arbitrary identifier. --- src/overlays/l06/mobys/shuttle.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/l06/mobys/shuttle.c b/src/overlays/l06/mobys/shuttle.c index fac4e582ad..6fc7b27e94 100644 --- a/src/overlays/l06/mobys/shuttle.c +++ b/src/overlays/l06/mobys/shuttle.c @@ -801,7 +801,7 @@ void break_apart_shuttle_linked_mobys(struct Moby *moby) { struct Moby *piece; short *list; short count; - int id; + int linked_moby_index; int i; float largest; u8 *particle; @@ -818,33 +818,33 @@ void break_apart_shuttle_linked_mobys(struct Moby *moby) { list = D_L06_001ABFC0_03b68[*(int *)(shuttle_linkage_vars + 0xCC)]; count = 0; do { - id = *list & 0x7FFF; + linked_moby_index = *list & 0x7FFF; random_vector(push, 1.0f, 2.0f); spawn_shuttle_explosion_effect( - 30.0f, moby, &((struct Moby *)(D_L06_0015FFD8_03b68 + (id << 8)))->pos, push, 1); - fast_vec_add(middle, middle, &((struct Moby *)(D_L06_0015FFD8_03b68 + (id << 8)))->pos); + 30.0f, moby, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos, push, 1); + fast_vec_add(middle, middle, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos); count++; - if (largest < ((struct Moby *)((id << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w) { - largest = ((struct Moby *)((id << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w; + if (largest < ((struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w) { + largest = ((struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w; } } while (*list++ >= 0); fast_vec_scale(middle, middle, 1.0f / convert_integer_to_float(count)); list = D_L06_001ABFC0_03b68[*(int *)(shuttle_linkage_vars + 0xCC)]; do { float speed; - id = *list & 0x7FFF; - fast_vec_sub(push, &((struct Moby *)(D_L06_0015FFD8_03b68 + (id << 8)))->pos, middle); - piece = (struct Moby *)((id << 8) + (int)D_L06_0015FFD8_03b68); + linked_moby_index = *list & 0x7FFF; + fast_vec_sub(push, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos, middle); + piece = (struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68); speed = frame_time * 30.0f; fast_vec_normalize(push, push, -((piece->bsphere.w - largest) / largest) * speed + speed); push[3] = 6.0f; random_vector(spin, frame_time * 0.2617994f, frame_time * 0.08726646f); begin_moby_linear_and_angular_motion( - (char *)(D_L06_0015FFD8_03b68 + (id << 8)), push, spin); + (char *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)), push, spin); for (i = 0; i < shuttle_breakup_particles_per_piece_gp; i++) { - piece = (struct Moby *)((id << 8) + (int)D_L06_0015FFD8_03b68); + piece = (struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68); random_vector(pos, 0.0f, piece->bsphere.w * 0.00048828125f); - fast_vec_add(pos, pos, &((struct Moby *)(D_L06_0015FFD8_03b68 + (id << 8)))->pos); + fast_vec_add(pos, pos, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos); random_vector( particle_velocity, 0.0f, shuttle_breakup_particle_max_speed_gp * frame_time); clear_u64_value(particle_acceleration); @@ -884,7 +884,7 @@ void break_apart_shuttle_linked_mobys(struct Moby *moby) { } } } while (*list++ >= 0); - ((struct Moby *)((id << 8) + (int)D_L06_0015FFD8_03b68))->command = 30; + ((struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68))->command = 30; } /* Marks every moby in the moby's list for removal; the list ends after its first negative entry. */ From 7f1864b86caa07a5199e67539d0ef0df4b7afead Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:44:40 +0000 Subject: [PATCH 261/657] decomp: clarify names in render_water_grids mode -> tile_clip_mode: Retail 002b94ac-002b94c4 sets s3 to 1 when far_bits & 0x2f2f2f2f is nonzero, otherwise 2 for near_bits intersections or 0 when clear. At 002b9614 s3 becomes a2 of cull_and_submit_water_grid_tile (call 002b9610), whose supplied source uses that argument to bypass or select tile clip tests. Thus this is the clipping policy for each enabled tile, rather than a general water rendering mode. --- src/overlays/shared/rendering/render_water_grids.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/rendering/render_water_grids.c b/src/overlays/shared/rendering/render_water_grids.c index 619e126c32..9c277871d0 100644 --- a/src/overlays/shared/rendering/render_water_grids.c +++ b/src/overlays/shared/rendering/render_water_grids.c @@ -238,7 +238,7 @@ void render_water_grids(f32 *water_record, s32 count) { f32 x_offset, y_offset, x_end, y_end, z; u32 near_bits, far_bits; s32 mask; - s32 i, j, mode; + s32 i, j, tile_clip_mode; s32 height_index, index; f32 *height; u32 *packet; @@ -320,11 +320,11 @@ void render_water_grids(f32 *water_record, s32 count) { for (height_index = 0x10; height_index >= 0; height_index--, height += 0x33) *height = water_record[2]; } - mode = (far_bits & 0x2f2f2f2f) != 0; - if (!mode) { - mode = WATER_GRID_MODE_TEST_NEAR_CLIP; + tile_clip_mode = (far_bits & 0x2f2f2f2f) != 0; + if (!tile_clip_mode) { + tile_clip_mode = WATER_GRID_MODE_TEST_NEAR_CLIP; if (!(near_bits & 0x2f2f2f2f)) - mode = WATER_GRID_MODE_SKIP_CLIP_TESTS; + tile_clip_mode = WATER_GRID_MODE_SKIP_CLIP_TESTS; } mask = *(u16 *)((u8 *)water_record + 0x1e); if (*(u32 *)(water_record + 5) != cached_water_texture_id_gp || @@ -360,7 +360,7 @@ void render_water_grids(f32 *water_record, s32 count) { } for (index = 0; index < 16; index++, mask = (s32)mask >> 1) { if (mask & 1) - cull_and_submit_water_grid_tile(water_record, index, mode); + cull_and_submit_water_grid_tile(water_record, index, tile_clip_mode); } next_entity: i++; From aa6714b63e5cc9226c5eb3e333f4192ee238d154 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:46:40 +0000 Subject: [PATCH 262/657] decomp: clarify names in draw_map_screen id -> selected_map_id: Retail 0x0021c038 loads level_map_selection.level into s8; 0x0021c03c-0x0021c044 conditionally adds 0x100 according to D_0013D4E1. The same s8 is passed to find_map_entry_slot at 0x0021c048-0x0021c04c and 0x0021c3a0-0x0021c3a4. Authoritative C assigns id from level, conditionally adds 0x100, and uses it only for these lookups; supplied find_map_entry_slot context compares its map_id argument against slot_id entries. --- src/ui/map/draw_map_screen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/map/draw_map_screen.c b/src/ui/map/draw_map_screen.c index 2f1c2a7e1f..60db607177 100644 --- a/src/ui/map/draw_map_screen.c +++ b/src/ui/map/draw_map_screen.c @@ -61,7 +61,7 @@ s32 draw_map_screen(struct MenuScreen *screen) { s32 previous_selected_level_id; s32 selected_level_table_index; s32 next_level_id; - s32 id; + s32 selected_map_id; s32 slot; s32 eviction_slot_index; struct MapHdr *hdr; @@ -131,7 +131,7 @@ s32 draw_map_screen(struct MenuScreen *screen) { if (item_available[ITEM_MAP_SHIFT] != 0) { id += 0x100; } - slot = find_map_entry_slot(id); + slot = find_map_entry_slot(selected_map_id); if (level_map_selection.level != level_map_selection.loaded && slot != -1) { eviction_slot_index = pick_map_slot_to_evict(); if (level_map_selection.slot[0] != 0 && eviction_slot_index > 0) { @@ -234,7 +234,7 @@ s32 draw_map_screen(struct MenuScreen *screen) { } } } - slot = find_map_entry_slot(id); + slot = find_map_entry_slot(selected_map_id); if (level_map_selection.level != level_map_selection.loaded) { if (music_stream_state.read_state == MUSIC_STREAM_READ_IDLE && slot == -1 && pick == slot) { pick_map_slot_to_evict(level_map_selection.loaded); From 23baeae3ee4719275488d391a4437f95a0d836f2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:46:40 +0000 Subject: [PATCH 263/657] decomp: clarify names in predict_thrown_moby_landing mode -> linked_moby_policy: Retail a2 is retained in s7 at 0x002c3b10 (Ghidra param_3). At 0x002c3c40-0x002c3c6c, after checking hero.ground_moby and helper 0x002603d0, nonzero s7 enables adding hero.motion.displacement to predicted_velocity. At 0x002c3fa4-0x002c3fc4, zero requires a hit moby with a non-null pvars link; at 0x002c3fcc-0x002c4000, value two suppresses the draw callback only when the hit moby has that link. Supplied get_moby_pvars_link context proves the helper checks flag 0x20 and returns pvars+8. decoy_update selects values 1/0/2 based on linked ground-moby handling, proving this parameter selects linked-moby policy. --- src/overlays/shared/weapons/decoy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/weapons/decoy.c b/src/overlays/shared/weapons/decoy.c index 537211051c..372e6350aa 100644 --- a/src/overlays/shared/weapons/decoy.c +++ b/src/overlays/shared/weapons/decoy.c @@ -362,7 +362,7 @@ s32 predict_thrown_moby_landing(ThrowVars *throw_vars, struct Moby *thrown_moby, s32 mode) __asm__("FUN_L00_002c3af8"); -s32 predict_thrown_moby_landing(ThrowVars *throw_vars, struct Moby *thrown_moby, s32 mode) { +s32 predict_thrown_moby_landing(ThrowVars *throw_vars, struct Moby *thrown_moby, s32 linked_moby_policy) { Vec4 predicted_position, predicted_velocity, position_scratch, q, ground_probe_position; s32 prediction_countdown; s32 found = 0; @@ -388,7 +388,7 @@ s32 predict_thrown_moby_landing(ThrowVars *throw_vars, struct Moby *thrown_moby, qcopy(&predicted_velocity, &throw_vars->vel); if (hero.state.control_mode == HERO_MODE_GRIND) fast_vec_add(&predicted_velocity, &predicted_velocity, &hero.motion.displacement); - if (hero.ground_moby && FUN_L00_002603d0((int)hero.ground_moby) && mode) + if (hero.ground_moby && FUN_L00_002603d0((int)hero.ground_moby) && linked_moby_policy) fast_vec_add(&predicted_velocity, &predicted_velocity, &hero.motion.displacement); prediction_countdown = scale_game_frames(300); } else { @@ -454,13 +454,13 @@ s32 predict_thrown_moby_landing(ThrowVars *throw_vars, struct Moby *thrown_moby, } if (prediction_countdown == 0) return 0; - if (mode == LANDING_REQUIRE_MOBY_PVARS_LINK) { + if (linked_moby_policy == LANDING_REQUIRE_MOBY_PVARS_LINK) { if (coll_hit.moby == 0) return 0; if (FUN_L00_002603d0(coll_hit.moby) == 0) goto ret0; } - if (mode != LANDING_SKIP_LINKED_MOBY_DRAW || coll_hit.moby == 0 || + if (linked_moby_policy != LANDING_SKIP_LINKED_MOBY_DRAW || coll_hit.moby == 0 || !FUN_L00_002603d0(coll_hit.moby)) add_draw_callback(draw_moby_oscillating_textured_quads, thrown_moby); throw_vars->normal.q = coll_hit_normal.q; From c84113892aaa2e688cae4814dd55c5b85eb02a7e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:46:41 +0000 Subject: [PATCH 264/657] decomp: clarify names in level_13_mine_update flags -> detonation_flags: In the authoritative mine.c snapshot (SHA-256 8840763cb4f62230dee15e98a60ebe715537732345bdad1456368331c668c3cf), this sole int binding receives collect_mobies_in_sphere and ORs the second collision query. Retail 002c2354 stores the first result in s1 and 002c236c ORs the second. Health depletion ORs 0x2000 at 002c23ac; excluded collision classes clear s1 at 002c247c. The nonzero test at 002c2480 gates explosion effects and removal, while 002c2490 tests bit 0x2000 to select the effect variant. Thus the accumulated bits control mine detonation. --- src/overlays/l13/mobys/mine.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l13/mobys/mine.c b/src/overlays/l13/mobys/mine.c index e5e6fe8baf..dbd088864e 100644 --- a/src/overlays/l13/mobys/mine.c +++ b/src/overlays/l13/mobys/mine.c @@ -102,7 +102,7 @@ void level_13_mine_update(ProjectileMoby *moby) { ProjectileHero *hero_state; ProjectileMoby *target; ProjectileMoby *hit; - int flags; + int detonation_flags; float distance; float factor; float magnitude; @@ -149,14 +149,14 @@ void level_13_mine_update(ProjectileMoby *moby) { make_hit_descriptor(16.0f, &hitpos, moby, 0x30000, velocity); qcopy(&steering_and_collision_vector, pos); steering_and_collision_vector.z += 0.75f; - flags = collect_mobies_in_sphere(1.7f, &steering_and_collision_vector, 0x10, moby, &hitpos); - flags = flags | FUN_L00_001f0d60_2048(&steering_and_collision_vector, 1.7f, 4, moby); + detonation_flags = collect_mobies_in_sphere(1.7f, &steering_and_collision_vector, 0x10, moby, &hitpos); + detonation_flags = detonation_flags | FUN_L00_001f0d60_2048(&steering_and_collision_vector, 1.7f, 4, moby); hit = (ProjectileMoby *)FUN_L00_0025a420(moby, -1, 0); if (hit != 0) { float health = *(float *)(moby_data + 0x20) - *(float *)((char *)hit + 0x2C); *(float *)(moby_data + 0x20) = health; if (health <= 0.0f) { - flags |= 0x2000; + detonation_flags |= 0x2000; D_L13_00174140.moby = 0; } } @@ -168,7 +168,7 @@ void level_13_mine_update(ProjectileMoby *moby) { cls_id == 0x185 || cls_id == 0x186 || cls_id == 0x187 || cls_id == 0x188 || cls_id == 0x189 || cls_id == 0x18A || cls_id == 0x18B || cls_id == 0x18C || cls_id == 0x18F || cls_id == 0x190) - flags = 0; + detonation_flags = 0; } if (flags != 0) { if (moby->visible != 0) { From 92a05d93591a0a991522f025563e718cac4c7bd7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:46:41 +0000 Subject: [PATCH 265/657] decomp: clarify names in linked_spark_emitter_update id -> emitter_save_id: Authoritative src/overlays/shared/props/linked_spark_emitter.c (SHA-256 efad31595814aaaab0aca2a4fa2307c021a2aa3b04a14a258d292f9f17c9af21) assigns unsigned short id from MOBY(moby)->save_id in INITIALIZE_EFFECT. Original retail Ghidra and instructions agree: 0x002a2c74 loads the halfword at moby+0xB2; 0x002a2c84-0x002a2c94 sign-extends it to index the cleared-state byte, and 0x002a2ca8-0x002a2ccc uses its upper bits to select the kill-bit word and low five bits to select the bit. This identifies the emitter's save ID rather than a generic object identifier. --- src/overlays/shared/props/linked_spark_emitter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/props/linked_spark_emitter.c b/src/overlays/shared/props/linked_spark_emitter.c index 117c26ad14..c9f303c1f6 100644 --- a/src/overlays/shared/props/linked_spark_emitter.c +++ b/src/overlays/shared/props/linked_spark_emitter.c @@ -86,12 +86,12 @@ void linked_spark_emitter_update(unsigned char *moby) { switch (MOBY(moby)->state) { case INITIALIZE_EFFECT: { - unsigned short id; + unsigned short emitter_save_id; MOBY(moby)->flags |= 1; MOBY(moby)->visible = 0; - id = MOBY(moby)->save_id; - if (l15_save_state.cleared[(short)id] == 0 && - (((*(int *)(D_0014C190 + (((short)id >> 5) * 4) + (D_0015ED84 << 8)) >> (id & 0x1F)) ^ + emitter_save_id = MOBY(moby)->save_id; + if (l15_save_state.cleared[(short)emitter_save_id] == 0 && + (((*(int *)(D_0014C190 + (((short)emitter_save_id >> 5) * 4) + (D_0015ED84 << 8)) >> (emitter_save_id & 0x1F)) ^ 1) & 1)) { MOBY(moby)->state = EMIT_SPARKS; From c5f32e0d2f1983ec63a509f3b7166a986666d0e0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:48:35 +0000 Subject: [PATCH 266/657] decomp: clarify names in sam_update id -> moby_save_state_index: In SAM_STATE_INITIALIZE, unsigned short id is loaded from moby->hB2. Retail 0x002ff064-0x002ff078 loads moby+0xB2, sign-extends it and indexes LevelSaveState.cleared; 0x002ff084-0x002ff0ac uses its high bits as a saved-state word index and low five bits as a bit selector. Original Ghidra confirms both tests gate removal. The same moby+0xB2 is used at 0x002ff210-0x002ff288 to set saved-state bits before memcard_save_data(0,-1), proving a per-moby saved-state index. --- src/overlays/l14/mobys/sam.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l14/mobys/sam.c b/src/overlays/l14/mobys/sam.c index 7e074d050d..6631e8e4bc 100644 --- a/src/overlays/l14/mobys/sam.c +++ b/src/overlays/l14/mobys/sam.c @@ -126,14 +126,14 @@ void sam_update(L14WatchMoby *moby) { attach_big_head_cheat_manipulator_to_matching_moby(moby); switch (moby->state) { case SAM_STATE_INITIALIZE: { - unsigned short id; + unsigned short moby_save_state_index; if (D_0013DD4F) { mark_moby_for_removal(moby); return; } - id = moby->hB2; - if (D_L14_001BB930.cleared[(short)id] != 0 || - (D_0014C190_257218[current_level_index][(short)id >> 5] >> (id & 0x1F)) & 1) { + moby_save_state_index = moby->hB2; + if (D_L14_001BB930.cleared[(short)moby_save_state_index] != 0 || + (D_0014C190_257218[current_level_index][(short)moby_save_state_index >> 5] >> (moby_save_state_index & 0x1F)) & 1) { mark_moby_for_removal(moby); return; } From b0e8c6901c0f3b546645cc4f6e65dbc35d889890 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:48:35 +0000 Subject: [PATCH 267/657] decomp: clarify names in draw_dual_texture_864_quad_mesh flags -> packed_texture_pass_blend_settings: In the authoritative source src/overlays/l06/mobys/dual_texture_meshes.c (SHA-256 bd9fbfd138f66820699147a09f7a6393379f5a3d982de26afab5e9fefe22aa1b), flags combines dual_texture_mesh_blend_color_a_selector_gp, color_b_selector shifted 2, alpha_c_selector shifted 4, color_d_selector shifted 6, and fixed_alpha shifted 32. Retail 0x002fd7b8-0x002fd7f8 loads these five scalars and ORs those shifted values into v1; 0x002fd804 and 0x002fd808 store the identical packed value at sp+0x88 and sp+0x118, the two texture-pass packets' unk88 fields. Original retail Ghidra likewise builds uStack_1f8 with shifts 2/4/6/0x20 and copies it to uStack_168. This proves shared packed texture-pass blend settings, rather than unspecified flags. --- src/overlays/l06/mobys/dual_texture_meshes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l06/mobys/dual_texture_meshes.c b/src/overlays/l06/mobys/dual_texture_meshes.c index 9b7bd69b3c..e4bb41d18f 100644 --- a/src/overlays/l06/mobys/dual_texture_meshes.c +++ b/src/overlays/l06/mobys/dual_texture_meshes.c @@ -5563,7 +5563,7 @@ void draw_dual_texture_864_quad_mesh(void) { void *matrix_ptr; float y_offset = dual_texture_mesh_first_pass_u_offset_multiplier_gp * l06_camera.yaw; float x_offset = dual_texture_mesh_first_pass_v_offset_multiplier_gp * l06_camera.pitch; - long flags; + long packed_texture_pass_blend_settings; int i, j; float facing; @@ -5571,7 +5571,7 @@ void draw_dual_texture_864_quad_mesh(void) { get_effect_texture(dual_texture_mesh_first_pass_texture_index_gp); second_texture_pass_quad_packet.tex = get_effect_texture(0x2a); matrix_ptr = matrix; - flags = (long)dual_texture_mesh_blend_color_a_selector_gp | + packed_texture_pass_blend_settings = (long)dual_texture_mesh_blend_color_a_selector_gp | (long)dual_texture_mesh_blend_color_b_selector_gp << 2 | (long)dual_texture_mesh_blend_alpha_c_selector_gp << 4 | (long)dual_texture_mesh_blend_color_d_selector_gp << 6 | From 67a7b84e1d2e03ba25f93b6322307550d1fd1649 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:48:35 +0000 Subject: [PATCH 268/657] decomp: clarify names in sentrybot_alarm_update mode -> configuration_mode: Source initializes this int from alarm_state[0], the moby's pvars configuration word. Retail 0x002cb4f0 loads pvars into s2; 0x002cb510 loads its word 0 and 0x002cb520 compares it with 2, choosing group-release wait state 6 at 0x002cb538 versus alarm-trigger wait state 3 at 0x002cb554. This configuration selector is separate from the moby state byte dispatched at 0x002cb4e4 and external control mode reads at 0x002cb5dc. --- src/overlays/shared/enemies/sentrybot_alarm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot_alarm.c b/src/overlays/shared/enemies/sentrybot_alarm.c index 254535ab92..1f886f36ca 100644 --- a/src/overlays/shared/enemies/sentrybot_alarm.c +++ b/src/overlays/shared/enemies/sentrybot_alarm.c @@ -115,15 +115,15 @@ void sentrybot_alarm_update(unsigned char *moby) { float position[4]; float step; int color; - int mode; + int configuration_mode; int *alarm_state = ((int *)MOBY(moby)->pvars); switch (MOBY(moby)->state) { case SENTRYBOT_ALARM_STATE_INITIALIZE: - mode = alarm_state[0]; + configuration_mode = alarm_state[0]; l15_sentrybot_alarm_effect_update_stamp = 0; D_L15_00161AB8 = 0; *(int *)&D_L15_00161ABC_gp = 0; - if (mode == SENTRYBOT_ALARM_MODE_GROUP_RELEASE_ONLY) { + if (configuration_mode == SENTRYBOT_ALARM_MODE_GROUP_RELEASE_ONLY) { MOBY(moby)->state = SENTRYBOT_ALARM_STATE_WAIT_FOR_GROUP_RELEASE_TRIGGER; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, 0); From 30f69f1feb346a12cb0619d2235da354cbc1faeb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:50:30 +0000 Subject: [PATCH 269/657] decomp: clarify names in reveal_map_around_position mode15 -> hero_control_mode_is_15: Source assigns mode15 = hero.state.control_mode == 15. Retail 0x00248608 loads hero +0x208c; xori by 0xf at 0x00248618 and sltiu s7,v1,1 at 0x00248620 produce a Boolean equality predicate (Ghidra bVar2). At 0x00248750-0x0024876c, filter flags 0x10 require it true and 0x20 require it false before allowing map mask clearing. mode16 -> hero_control_mode_is_16: Source assigns mode16 = hero.state.control_mode == 16. Retail load of hero +0x208c at 0x00248608 feeds xori a0,a0,0x10 at 0x00248624 and sltiu s8,a0,1 at 0x0024862c, proving a Boolean equality predicate (Ghidra bVar3). Consumers at 0x00248728-0x00248748 reject filters for flags 4 when false and flags 8 when true. --- .../shared/ui/map/reveal_map_around_position.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/ui/map/reveal_map_around_position.c b/src/overlays/shared/ui/map/reveal_map_around_position.c index 267b039e1e..91e5139be7 100644 --- a/src/overlays/shared/ui/map/reveal_map_around_position.c +++ b/src/overlays/shared/ui/map/reveal_map_around_position.c @@ -44,8 +44,8 @@ void reveal_map_around_position(f32 *position) { s32 y; s32 state; s32 level; - s32 mode15; - s32 mode16; + s32 hero_control_mode_is_15; + s32 hero_control_mode_is_16; s32 i; s32 *filter; s32 index; @@ -132,19 +132,19 @@ void reveal_map_around_position(f32 *position) { *filter = 0; continue; } - if ((flags & 4) && !mode16) { + if ((flags & 4) && !hero_control_mode_is_16) { *filter = 0; continue; } - if ((flags & 8) && mode16) { + if ((flags & 8) && hero_control_mode_is_16) { *filter = 0; continue; } - if ((flags & 0x10) && !mode15) { + if ((flags & 0x10) && !hero_control_mode_is_15) { *filter = 0; continue; } - if ((flags & 0x20) && mode15) { + if ((flags & 0x20) && hero_control_mode_is_15) { *filter = 0; continue; } From bb766773511c96c8ca366171136cfda6dbd69252 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:50:30 +0000 Subject: [PATCH 270/657] decomp: clarify names in spawn_hero_item_mobies id -> slot_zero_spawn_item_id: Authoritative C loads id from hero.selected_item[0], resolves zero through fallback_item_id or 8, then stores hero.items[0].item_id and indexes item_defs_lui. Retail 0x0020eae4 loads s2 from hero+0x20d4; 0x0020eaf0-0x0020eb10 resolves fallback 8 or 0x00141660; 0x0020eb18 uses s2 with the 0x4c item stride, 0x0020eb80 stores it at hero+0x10b8, and 0x0020ebf4 compares it with item 8 for button/animation setup. id3 -> slot_three_spawn_item_id: Authoritative C resolves id3 from hero.selected_item[3], D_00141660_lui[3], or fallback item 2/3, stores hero.items[3].item_id, and passes the corresponding definition class to create_moby. Retail 0x0020ec64 reads hero+0x20e0, 0x0020ec74 reads 0x0014166c, 0x0020ec80-0x0020ec90 selects 2 or 3; 0x0020eca8 stores the resolved id at hero+0x11a8 and 0x0020ec9c-0x0020ecb4 uses its 0x4c table stride to load the spawn class. --- src/overlays/shared/hero/hero_switch_item.c | 36 ++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index 860bbe34f5..88b43c42c2 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -1247,7 +1247,7 @@ void spawn_hero_item_mobies(void) __asm__("FUN_L00_0020ea80"); void spawn_hero_item_mobies(void) { struct Moby *created_moby; - s32 id; + s32 slot_zero_spawn_item_id; s32 slot; struct Hero *slot_owner; s32 i; @@ -1255,25 +1255,25 @@ void spawn_hero_item_mobies(void) { struct Moby *slot_four_moby; struct Moby *slot_four_secondary_moby; struct Moby *slot_five_moby; - s32 id3; + s32 slot_three_spawn_item_id; s32 fallback_item_id; if (hero.items[0].moby == 0 && D_L00_0015F3F8_ea80 > hero.items[0].respawn_frame && (hero.pending_item[0] == 0 || hero.pending_item[0] == 0x24)) { - id = hero.selected_item[0]; - if (id == 0) { + slot_zero_spawn_item_id = hero.selected_item[0]; + if (slot_zero_spawn_item_id == 0) { if (D_0015ED90 != 0 || (fallback_item_id = D_00141660_lui[0]) == 0) - id = 8; + slot_zero_spawn_item_id = 8; else - id = fallback_item_id; + slot_zero_spawn_item_id = fallback_item_id; } - select_world_object_resource_tables(item_defs_lui[id].cls, -1); + select_world_object_resource_tables(item_defs_lui[slot_zero_spawn_item_id].cls, -1); for (i = 0; i < 3; i++) { fill_transfer_words(&hero.item_eases[i], 0, sizeof(struct HeroEase)); hero.item_eases[i].attach_joint = -1; } - hero.items[0].item_id = id; - slot = item_defs_lui[id].slot; + hero.items[0].item_id = slot_zero_spawn_item_id; + slot = item_defs_lui[slot_zero_spawn_item_id].slot; slot_owner = (struct Hero *)((char *)&hero + slot * sizeof(struct HeroItemSlot)); created_moby = create_moby(item_defs_lui[slot_owner->items[0].item_id].cls); if (created_moby != 0) { @@ -1284,7 +1284,7 @@ void spawn_hero_item_mobies(void) { created_moby->metal_alpha = 0x18; slot_owner->items[0].moby = created_moby; slot_owner->items[0].state = 2; - if (id == 8) { + if (slot_zero_spawn_item_id == 8) { slot_owner->items[0].button_mask = 0x80; blend_moby_animation(created_moby, 1, 0, 1); } else { @@ -1301,14 +1301,14 @@ void spawn_hero_item_mobies(void) { } if (hero.items[3].moby == 0) { - id3 = hero.selected_item[3]; - if (id3 == 0) { - id3 = D_00141660_lui[3]; - if (id3 == 0) - id3 = D_0015ED94 != 0 ? 3 : 2; - } - hero.items[3].item_id = id3; - created_moby = create_moby(item_defs_lui[id3].cls); + slot_three_spawn_item_id = hero.selected_item[3]; + if (slot_three_spawn_item_id == 0) { + slot_three_spawn_item_id = D_00141660_lui[3]; + if (slot_three_spawn_item_id == 0) + slot_three_spawn_item_id = D_0015ED94 != 0 ? 3 : 2; + } + hero.items[3].item_id = slot_three_spawn_item_id; + created_moby = create_moby(item_defs_lui[slot_three_spawn_item_id].cls); if (created_moby != 0) { created_moby->draw_dist = 0x20; created_moby->visible = 1; From e811d247cdd7f7a5524701a151854d4b13191f74 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:52:38 +0000 Subject: [PATCH 271/657] decomp: clarify names in update_splitting_effect_particle_with_collision_and_fade flags -> rotation_and_motion_flags: In the authoritative C, the sole block-local u8 flags snapshots e->b18 and tests bits 1 and 8. Original Ghidra bVar1 and retail lbu v1,0x18(s1) at 0x00270f30/0x00270f58 provide this snapshot. At 0x00270f64-0x00270f74 bit 1 selects -1/+1 for the rotation multiplier. At 0x00270f6c-0x00270f78 bit 8 selects the branch that adds vertical velocity (0x00270f8c-0x00270fa0) and divides the rotation increment by converted e->h16 (0x00270f94-0x00270fd0); the other branch updates rotation without division (0x00270fd4-0x00270ff8). Phase wrapping and scaling to particle byte 8 at 0x00270ffc-0x00271064 establish rotation. --- .../rendering/effects/update_three_phase_effect_particle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c index 2d0a6cc652..86272e2b1c 100644 --- a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c +++ b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c @@ -3702,11 +3702,11 @@ void update_splitting_effect_particle_with_collision_and_fade(M_270948 *particle e->v.f[1] *= 0.95f; } { - u8 flags = e->b18; + u8 rotation_and_motion_flags = e->b18; alpha_input_or_rotation_sign = -1.0f; - if (flags & 1) + if (rotation_and_motion_flags & 1) alpha_input_or_rotation_sign = 1.0f; - if (flags & 8) { + if (rotation_and_motion_flags & 8) { e->v.f[2] += frame_scale_sq * 0.008f; e->x10 += alpha_input_or_rotation_sign * (D_0015ED60 * -0.01f) / convert_integer_to_float(e->h16); From a0363361253a814817048f9bfe1707a761679e2a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:52:39 +0000 Subject: [PATCH 272/657] decomp: clarify names in draw_pause_menu_pages flags -> page_width_or_render_flags: In authoritative source SHA-256 071c05ac718bc887ea9292fc17370342edbb3ddff5a3a065cb170bac8c34ff7d, flags first receives rect.w and is stored into page_objects[k]+0x20. Retail 002774c0 loads the projected width from sp+0xc0 into a1 and 002774e4 stores it to object+0x20; the same width becomes page_data->w at 00277524-00277528. In the later loop, 002775b8 selects the page object and 002775c4 loads its +0x10 rendering bits into a1: bit 4 skips rendering (002775c8-002775cc), bit 2 selects pass (00277618-00277634), and bit 1 selects direct callback dispatch (0027763c-00277648). Original Ghidra shows iStack_c0 for width and uVar13 for the later bit tests. The C has one reused flags declaration, so page_width_or_render_flags accurately identifies both live ranges. --- .../shared/ui/menus/initialize_pause_menu.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/ui/menus/initialize_pause_menu.c b/src/overlays/shared/ui/menus/initialize_pause_menu.c index 7a25fb3cb4..47ffa267dc 100644 --- a/src/overlays/shared/ui/menus/initialize_pause_menu.c +++ b/src/overlays/shared/ui/menus/initialize_pause_menu.c @@ -757,7 +757,7 @@ void draw_pause_menu_pages(int transfer_only) { int j; int flashing_panel_index; int pass; - int flags; + int page_width_or_render_flags; int never; append_gif_transfer_packet(); @@ -806,11 +806,11 @@ void draw_pause_menu_pages(int transfer_only) { box[0] = corners[0]; box[1] = corners[3]; project_graphics_bounds(&box[0], &box[1], &rect.w, &rect.h, &rect.x, &rect.y); - flags = rect.w; + page_width_or_render_flags = rect.w; rect.x++; rect.y++; if (page_objects != 0 && page_objects[k] != 0) { - *(int *)(page_objects[k] + 0x20) = flags; + *(int *)(page_objects[k] + 0x20) = page_width_or_render_flags; *(int *)(page_objects[k] + 0x24) = rect.h; *(int *)(page_objects[k] + 0x18) = rect.x; *(int *)(page_objects[k] + 0x1C) = rect.y; @@ -837,8 +837,8 @@ void draw_pause_menu_pages(int transfer_only) { if (moby == 0 || page_objects == 0 || page_objects[j] == 0) { continue; } - flags = *(int *)(page_objects[j] + 0x10); - if (flags & 4) { + page_width_or_render_flags = *(int *)(page_objects[j] + 0x10); + if (page_width_or_render_flags & 4) { continue; } if (pause_menu_page_render_enabled[j] == 0 || *(int *)(page_objects[j] + 4) == 0) { @@ -847,13 +847,13 @@ void draw_pause_menu_pages(int transfer_only) { if (j == 6 && D_L00_001B9CF0.goodies_tab_shown == 0) { continue; } - if (pass == 0 && !(flags & 2)) { + if (pass == 0 && !(page_width_or_render_flags & 2)) { continue; } - if (pass == 1 && (flags & 2)) { + if (pass == 1 && (page_width_or_render_flags & 2)) { continue; } - if (flags & 1) { + if (page_width_or_render_flags & 1) { (*(int (**)(char *))(page_objects[j] + 4))(page_objects[j]); continue; } From 72eaec0a68bfd27024d6736205f18d498fc5cbe2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:52:39 +0000 Subject: [PATCH 273/657] decomp: clarify names in elevator_update id -> elevator_save_id: Bound source src/overlays/l14/mobys/elevator.c SHA-256 215825b94e5a992dafdbcad619133e47497e208fd8eb72036374f6bf3c609487 assigns the u16 local id from elevator_moby->save_id. Retail 002eea08 loads moby+0xB2 with lhu a1; 002eea14-002eea20 sign-extends it and indexes the cleared-state array. 002eea34-002eea58 derives the save-word index from id >> 5, masks id & 0x1F and shifts the per-level save word by that bit. Original Ghidra iVar4/ushort data flow agrees. Thus this is the elevator's save identifier, not its path, item or voice index. --- src/overlays/l14/mobys/elevator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l14/mobys/elevator.c b/src/overlays/l14/mobys/elevator.c index deb03a86d5..7dc9caaaa9 100644 --- a/src/overlays/l14/mobys/elevator.c +++ b/src/overlays/l14/mobys/elevator.c @@ -108,15 +108,15 @@ void elevator_update(struct Moby *elevator_moby) { qcopy(&rot, &elevator_moby->rot); switch (elevator_moby->state) { case ELEVATOR_STATE_INITIALIZE: { - u16 id; + u16 elevator_save_id; elevator_moby->command = 0; elevator_moby->state = ELEVATOR_STATE_WAIT_FOR_RIDER; initialize_elevator_path_state(elevator_moby); qcopy(&elevator_moby->pos, ((char *)l14_paths[elevator_vars->path]) + 0x10); qcopy(&elevator_moby->rot, elevator_vars->rot); - id = elevator_moby->save_id; - if (D_L14_001BB930.cleared[(short)id] == 0 && - (((D_0014C190_257218[current_level_index][(short)id >> 5] >> (id & 0x1F)) ^ 1) & 1) && + elevator_save_id = elevator_moby->save_id; + if (D_L14_001BB930.cleared[(short)elevator_save_id] == 0 && + (((D_0014C190_257218[current_level_index][(short)elevator_save_id >> 5] >> (elevator_save_id & 0x1F)) ^ 1) & 1) && visited52[elevator_vars->item + current_level_index * 16] == 0xFF) elevator_vars->bought = 1; else From 31f7d8d21dcbe079a99ddda17ccba75469cd7995 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:52:39 +0000 Subject: [PATCH 274/657] decomp: clarify names in rocket_strike_fighter_update id -> fighter_save_id: Authoritative source src/overlays/l14/mobys/rocket_strike_fighter.c SHA-256 307436c8c457d1b8753747e5f51e4e650495832aeec436a6192106d05e0a83c8 declares u16 id = moby->save_id. Retail 0x002fcbec loads this halfword from s1+0xB2; 0x002fcbf8-0x002fcc04 sign-extends it to index the cleared byte array. Instructions 0x002fcc18-0x002fcc40 use its upper bits for the save-word index and low five bits for the bit shift in the current-level table. Original retail decompilation shows the same +0xB2 source and both save checks, proving this is the updated fighter's save identifier. --- src/overlays/l14/mobys/rocket_strike_fighter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l14/mobys/rocket_strike_fighter.c b/src/overlays/l14/mobys/rocket_strike_fighter.c index d76e9f6481..77306d530f 100644 --- a/src/overlays/l14/mobys/rocket_strike_fighter.c +++ b/src/overlays/l14/mobys/rocket_strike_fighter.c @@ -99,9 +99,9 @@ void rocket_strike_fighter_update(struct Moby *moby) { Vec4 rocket_position; if (moby->state == ROCKET_STRIKE_FIGHTER_STATE_INITIALIZE) { - u16 id = moby->save_id; - if (D_L14_001BB930.cleared[(short)id] != 0 || - (D_0014C190_257218[current_level_index][(short)id >> 5] >> (id & 0x1F)) & 1) { + u16 fighter_save_id = moby->save_id; + if (D_L14_001BB930.cleared[(short)fighter_save_id] != 0 || + (D_0014C190_257218[current_level_index][(short)fighter_save_id >> 5] >> (fighter_save_id & 0x1F)) & 1) { mark_moby_and_linked_moby_for_removal(&D_L14_0015FFD8_t[moby_vars->rocket]); mark_moby_for_removal(moby); return; From 5f9576a478674d3c7c5a429f441e8b5da1b8c086 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:52:39 +0000 Subject: [PATCH 275/657] decomp: clarify names in pool_splash mode -> add_to_existing_height: The authoritative source uses int mode only in mode == POOL_SPLASH_KEEP_GREATER_MAGNITUDE (zero): zero compares absolute_float(height) with the existing write-bank cell, whereas the else branch executes height += tile->heights[l00_pool_height_additive_read_bank_index][row][col]. Retail saves a2 at 0x002a3f3c and tests it at 0x002a40ec-0x002a40f0. Nonzero branches to 0x002a41a4, addresses the read-bank cell using its bank selector and row/column offsets, loads its height at 0x002a41c8 and adds it to f21 at 0x002a41cc before the common store at 0x002a41ec. Original Ghidra param_7 has the identical zero/nonzero branch. Thus add_to_existing_height names the proven nonzero behavior rather than an unspecified mode. --- src/overlays/shared/vendor/draw_vendor_purchase_text.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/vendor/draw_vendor_purchase_text.c b/src/overlays/shared/vendor/draw_vendor_purchase_text.c index bbbccc1ea4..b6251902de 100644 --- a/src/overlays/shared/vendor/draw_vendor_purchase_text.c +++ b/src/overlays/shared/vendor/draw_vendor_purchase_text.c @@ -146,7 +146,7 @@ void pool_splash(HeightTile *tile, void pool_splash( - HeightTile *tile, int count, int mode, float x, float z, float radius, float amount) { + HeightTile *tile, int count, int add_to_existing_height, float x, float z, float radius, float amount) { enum { POOL_SPLASH_KEEP_GREATER_MAGNITUDE = 0 }; @@ -190,7 +190,7 @@ void pool_splash( } else { height = amount / square_root(dist_sq); } - if (mode == POOL_SPLASH_KEEP_GREATER_MAGNITUDE) { + if (add_to_existing_height == POOL_SPLASH_KEEP_GREATER_MAGNITUDE) { float magnitude = absolute_float(height); if (magnitude < absolute_float(tile->heights[l00_pool_height_write_bank_index][row][col])) { From 457b7a1f0e5784c47f89451da6591d893d7161ed Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:52:39 +0000 Subject: [PATCH 276/657] decomp: clarify names in leg_walker_update flags -> movement_constraint_flags: In the SHA-256-bound source, flags receives update_leg_rig_height_and_tilt(moby, rig), whose supplied implementation returns 2 for excessive tilt. Retail 0x00295ab0..0x00295ab8 saves this return in s5; 0x00295bdc ORs bit 0 after a successful collision probe and collision-position copy; 0x00295c44..0x00295c54 ORs bit 1 when XY displacement is below rig->speed * 0.5. The same aggregate is returned at 0x00295cbc or 0x00295d9c, proving a returned mask of movement constraints rather than rig configuration flags. --- src/overlays/l04/mobys/leg_walker.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l04/mobys/leg_walker.c b/src/overlays/l04/mobys/leg_walker.c index c049050040..4d7627b6b7 100644 --- a/src/overlays/l04/mobys/leg_walker.c +++ b/src/overlays/l04/mobys/leg_walker.c @@ -395,7 +395,7 @@ s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f3 s32 probe_kind; f32 probe_start, probe_end; s32 mode; - s32 flags; + s32 movement_constraint_flags; s32 changed; f32 time; s32 i; @@ -500,7 +500,7 @@ s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f3 if (rig->speed < speed) rig->speed = speed; } - flags = update_leg_rig_height_and_tilt(moby, rig); + movement_constraint_flags = update_leg_rig_height_and_tilt(moby, rig); walker_update_gait(moby, rig, speed, heading, step, changed); if (!(rig->control_flags & 4)) { rig_probe_setup(moby, 0, &probe_kind, &local.v.ground, &probe_start, &probe_end); @@ -518,12 +518,12 @@ s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f3 for (tries = 0; tries < 8 && rig_probe(&local.v.ground, 4, probe_start, moby, probe_end); tries++) { qcopy(&local.v.ground, D_L04_00173FF0); - flags |= 1; + movement_constraint_flags |= 1; } fast_vec_sub(transformed, &local.v.ground, pos); fast_vec_add(pos, &local.v.ground, &local.v.offset); if (vector_length_xy(transformed) < rig->speed * 0.5f) - flags |= 2; + movement_constraint_flags |= 2; } local.joints[0] = rig->legs[0].joint; local.joints[1] = rig->legs[0].joint2; @@ -561,7 +561,7 @@ s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f3 fallback++; } } - return flags; + return movement_constraint_flags; } u8 D_L04_001CA938[13][4] = { From 8d997e3999039ccb6ae2ce7c931ab2dfa10df222 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:52:39 +0000 Subject: [PATCH 277/657] decomp: clarify names in magnet_elevator_update state -> elevator_runtime_state: Retail 0x002ee2f4 loads s5 from moby+0x78, matching source char *state = P(moby,0x78) and original Ghidra iVar1. This record supplies stop heights +0x60/+0x64 at 0x002ee5c4-0x002ee5c8, velocity storage +0x68 at 0x002ee5f0, voice handle +0x6C at 0x002ee588-0x002ee5ac, camera blend progress/velocity +0x70/+0x74 at 0x002ee40c-0x002ee43c, and pulse phase +0x78 at 0x002ee708-0x002ee71c. Its +0x20 receives the pose delta at 0x002ee97c-0x002ee98c. These uses prove a per-elevator runtime state record; the discrete state selector is separately read from moby+0x20 at 0x002ee38c. --- src/overlays/l17/mobys/magnet_elevator.c | 72 ++++++++++++------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/overlays/l17/mobys/magnet_elevator.c b/src/overlays/l17/mobys/magnet_elevator.c index 69505d8f19..e4772dfa24 100644 --- a/src/overlays/l17/mobys/magnet_elevator.c +++ b/src/overlays/l17/mobys/magnet_elevator.c @@ -80,7 +80,7 @@ void magnet_elevator_update(struct Moby *moby) { MAGNET_ELEVATOR_STATE_WAIT_FOR_HERO_TO_LEAVE_FIRST_STOP = 8, MAGNET_ELEVATOR_STATE_WAIT_FOR_HERO_TO_LEAVE_SECOND_STOP = 9 }; - char *state = P(moby, 0x78); + char *elevator_runtime_state = P(moby, 0x78); float delta[4]; float rot[4]; float camera_position_offset[4]; @@ -89,11 +89,11 @@ void magnet_elevator_update(struct Moby *moby) { fast_vec_scale(delta, &moby->pos, -1.0f); qcopy(rot, &moby->rot); - if (W(state, 0x7C) == 0) { + if (W(elevator_runtime_state, 0x7C) == 0) { float f = 1.0f - - ((*(float *)((char *)(moby) + (0x18))) - (*(float *)((char *)(state) + (0x64)))) / - ((*(float *)((char *)(state) + (0x60))) - (*(float *)((char *)(state) + (0x64)))); + ((*(float *)((char *)(moby) + (0x18))) - (*(float *)((char *)(elevator_runtime_state) + (0x64)))) / + ((*(float *)((char *)(elevator_runtime_state) + (0x60))) - (*(float *)((char *)(elevator_runtime_state) + (0x64)))); if (f > 1.0f) { f = 1.0f; } else if (f < 0.0f) { @@ -104,24 +104,24 @@ void magnet_elevator_update(struct Moby *moby) { } switch (B(moby, 0x20)) { case MAGNET_ELEVATOR_STATE_INITIALIZE: - (*(float *)((char *)(state) + (0x78))) = random_angle_radians(); - W(state, 0x6C) = -1; - if (W(state, 0x80) == -1 || **(int **)(D_L17_001B0DB0 + W(state, 0x80) * 4) != 0xB) { + (*(float *)((char *)(elevator_runtime_state) + (0x78))) = random_angle_radians(); + W(elevator_runtime_state, 0x6C) = -1; + if (W(elevator_runtime_state, 0x80) == -1 || **(int **)(D_L17_001B0DB0 + W(elevator_runtime_state, 0x80) * 4) != 0xB) { mark_moby_for_removal(moby); return; } B(moby, 0x20) = 6; break; case MAGNET_ELEVATOR_STATE_BLEND_CAMERA: { - float previous_camera_blend_progress = (*(float *)((char *)(state) + (0x70))); - advance_accelerated_scalar((float *)(state + 0x70), - (float *)(state + 0x74), + float previous_camera_blend_progress = (*(float *)((char *)(elevator_runtime_state) + (0x70))); + advance_accelerated_scalar((float *)(elevator_runtime_state + 0x70), + (float *)(elevator_runtime_state + 0x74), 1.0f, frame_time_sq * 4.0f, frame_time_sq * 4.0f, frame_time * 4.0f); - if ((*(float *)((char *)(state) + (0x70))) < 1.0f) { - float remaining_camera_blend_ratio = (1.0f - (*(float *)((char *)(state) + (0x70)))) / + if ((*(float *)((char *)(elevator_runtime_state) + (0x70))) < 1.0f) { + float remaining_camera_blend_ratio = (1.0f - (*(float *)((char *)(elevator_runtime_state) + (0x70)))) / (1.0f - previous_camera_blend_progress); char *camera_pose_base; FUN_L17_002ee9c0_c(moby, (char *)camera_position, (char *)camera_rotation); @@ -163,16 +163,16 @@ void magnet_elevator_update(struct Moby *moby) { if (B(moby, 0x20) == 3 && P(D_0013E533_u, 0x1119) != moby) { B(moby, 0x20) = 5; } - if (!voice_is_playing(moby, W(state, 0x6C))) { - W(state, 0x6C) = allocate_voice_for_target_entry(0, 4, (int)moby); + if (!voice_is_playing(moby, W(elevator_runtime_state, 0x6C))) { + W(elevator_runtime_state, 0x6C) = allocate_voice_for_target_entry(0, 4, (int)moby); } if (B(moby, 0x20) == 2 || B(moby, 0x20) == 4) { - target = (*(float *)((char *)(state) + (0x60))); + target = (*(float *)((char *)(elevator_runtime_state) + (0x60))); } else { - target = (*(float *)((char *)(state) + (0x64))); + target = (*(float *)((char *)(elevator_runtime_state) + (0x64))); } advance_accelerated_scalar(&moby->pos.z, - (float *)(state + 0x68), + (float *)(elevator_runtime_state + 0x68), target, frame_time_sq * 0.3f, frame_time_sq * 0.3f, @@ -191,18 +191,18 @@ void magnet_elevator_update(struct Moby *moby) { if (B(moby, 0xBC) != 0) { hero_set_state(HERO_STATE_IDLE, 0); } - if (voice_is_playing(moby, W(state, 0x6C))) { - release_voice_slot(W(state, 0x6C)); - W(state, 0x6C) = -1; + if (voice_is_playing(moby, W(elevator_runtime_state, 0x6C))) { + release_voice_slot(W(elevator_runtime_state, 0x6C)); + W(elevator_runtime_state, 0x6C) = -1; } } break; } case MAGNET_ELEVATOR_STATE_WAIT_FOR_HERO_TO_LEAVE_FIRST_STOP: case MAGNET_ELEVATOR_STATE_WAIT_FOR_HERO_TO_LEAVE_SECOND_STOP: - if (voice_is_playing(moby, W(state, 0x6C))) { - release_voice_slot(W(state, 0x6C)); - W(state, 0x6C) = -1; + if (voice_is_playing(moby, W(elevator_runtime_state, 0x6C))) { + release_voice_slot(W(elevator_runtime_state, 0x6C)); + W(elevator_runtime_state, 0x6C) = -1; } if (P(D_0013E533_u, 0x1119) != moby) { if (B(moby, 0x20) == 9) { @@ -216,9 +216,9 @@ void magnet_elevator_update(struct Moby *moby) { case MAGNET_ELEVATOR_STATE_WAIT_AT_SECOND_STOP: { int i; char *hero_state; - (*(float *)((char *)(state) + (0x78))) = - fast_add_rotations((*(float *)((char *)(state) + (0x78))), frame_time * 6.2831855f); - i = truncate_float_to_s32((fast_sin((*(float *)((char *)(state) + (0x78)))) * 4.0f - 3.0f) * + (*(float *)((char *)(elevator_runtime_state) + (0x78))) = + fast_add_rotations((*(float *)((char *)(elevator_runtime_state) + (0x78))), frame_time * 6.2831855f); + i = truncate_float_to_s32((fast_sin((*(float *)((char *)(elevator_runtime_state) + (0x78)))) * 4.0f - 3.0f) * 128.0f); if (i > 0x80) { i = 0x80; @@ -230,7 +230,7 @@ void magnet_elevator_update(struct Moby *moby) { W(moby, 0x90) = (i << 16) | pulse_color_green_alpha_bits | i; } hero_state = (char *)((char *)&hero); - if (H(hero_state, 0x308) != 0 || W(state, 0x7C) == 0) { + if (H(hero_state, 0x308) != 0 || W(elevator_runtime_state, 0x7C) == 0) { if (P(hero_state, 0x2FC) == moby && H(hero_state, 0x30E) == 0 && vector_distance_xy(hero_state + 0x80, &moby->pos) < 0.5f) { allocate_voice_for_target_entry(1, 0, (int)moby); @@ -243,27 +243,27 @@ void magnet_elevator_update(struct Moby *moby) { char *p = (char *)(&hero.motion.pos); float d = vector_distance_xy(&moby->pos, p); float e = absolute_float((*(float *)((char *)(p) + (0x258))) - - (*(float *)((char *)(state) + (0x64)))); - if (e < absolute_float((*(float *)((char *)(state) + (0x60))) - - (*(float *)((char *)(state) + (0x64)))) * + (*(float *)((char *)(elevator_runtime_state) + (0x64)))); + if (e < absolute_float((*(float *)((char *)(elevator_runtime_state) + (0x60))) - + (*(float *)((char *)(elevator_runtime_state) + (0x64)))) * 0.5f && d < 32.0f && d > 2.0f) { B(moby, 0xBC) = 0; B(moby, 0x20) = 3; - W(state, 0x68) = 0; + W(elevator_runtime_state, 0x68) = 0; } } else if (B(moby, 0x20) == 7) { char *p = (char *)(&hero.motion.pos); float d = vector_distance_xy(&moby->pos, p); float e = absolute_float((*(float *)((char *)(p) + (0x258))) - - (*(float *)((char *)(state) + (0x60)))); - if (e < absolute_float((*(float *)((char *)(state) + (0x60))) - - (*(float *)((char *)(state) + (0x64)))) * + (*(float *)((char *)(elevator_runtime_state) + (0x60)))); + if (e < absolute_float((*(float *)((char *)(elevator_runtime_state) + (0x60))) - + (*(float *)((char *)(elevator_runtime_state) + (0x64)))) * 0.5f && d < 32.0f && d > 2.0f) { B(moby, 0xBC) = 0; B(moby, 0x20) = 2; - W(state, 0x68) = 0; + W(elevator_runtime_state, 0x68) = 0; } } } @@ -271,7 +271,7 @@ void magnet_elevator_update(struct Moby *moby) { } } fast_vec_add(delta, delta, &moby->pos); - update_entity_matrix(state + 0x20, delta, rot, &moby->rot); + update_entity_matrix(elevator_runtime_state + 0x20, delta, rot, &moby->rot); } /* Ported from rac1-decomp (src/overlays/l17_fleet/vendor_002AA068.c: func_L17_002F04D0), where it is exact; names translated to the US level program. */ From 74e11c2e5bd6a8796642d69d6e7fc2f50ee356fb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:54:51 +0000 Subject: [PATCH 278/657] decomp: clarify names in novalis_elevator_update id -> save_id: The unsigned short id is assigned MOBY(moby)->save_id in the cleared-state lookup. Retail 0x002b9f94 loads the halfword at moby+0xB2; 0x002b9fa0-0x002b9fac sign-extends it for the cleared array, while 0x002b9fc0-0x002b9fe8 uses its upper bits as the save-bit word index and id & 0x1F as the bit position. Original Ghidra shows the same moby+0xB2 load and both save-state tests, proving this is the moby's save_id. --- src/overlays/shared/props/novalis_elevator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/props/novalis_elevator.c b/src/overlays/shared/props/novalis_elevator.c index 721b3af230..daec146768 100644 --- a/src/overlays/shared/props/novalis_elevator.c +++ b/src/overlays/shared/props/novalis_elevator.c @@ -58,10 +58,10 @@ void novalis_elevator_update(unsigned char *moby) { } } if (*(int *)(elevator_vars + 0xC0) != -1) { - unsigned short id; + unsigned short save_id; if (is_point_inside_clip_volume(&hero.motion.pos, *(int *)(elevator_vars + 0xC0)) || - l01_save_state.cleared[(short)(id = MOBY(moby)->save_id)] != 0 || - (D_0014C190_257218[current_level_index][(short)id >> 5] >> (id & 0x1F)) & 1) { + l01_save_state.cleared[(short)(save_id = MOBY(moby)->save_id)] != 0 || + (D_0014C190_257218[current_level_index][(short)save_id >> 5] >> (save_id & 0x1F)) & 1) { if (*(int *)(elevator_vars + 0xC0) != -1) { D_0014C190_257218[current_level_index][(short)MOBY(moby)->save_id >> 5] |= 1 << (MOBY(moby)->save_id & 0x1F); From 78ed7da61ce25af3634e2fbd83aba3c249a3ded6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:54:51 +0000 Subject: [PATCH 279/657] decomp: clarify names in elevator_update id -> save_id: In the authoritative source, unsigned short id is assigned MOBY(moby)->save_id and indexes l09_moby_collection_state.collected after a short cast; its >>5 and &0x1F select the saved-bit word and bit. Retail 0030340c loads lhu a1,0xb2(s3); 00303418-00303424 sign-extends it and loads the collected byte, while 00303438-00303460 uses the same value for the level_moby_killed word/bit test. Original Ghidra iVar8 and ushort(param_1+0xb2) corroborate this data flow. --- src/overlays/l09/mobys/elevator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l09/mobys/elevator.c b/src/overlays/l09/mobys/elevator.c index 9fac9c0ca6..c8b3e0c3b7 100644 --- a/src/overlays/l09/mobys/elevator.c +++ b/src/overlays/l09/mobys/elevator.c @@ -52,10 +52,10 @@ void elevator_update(unsigned char *moby) { } path = ((char *)l09_paths[*(int *)(elevator_vars + 0xB4)]); if (*(int *)(elevator_vars + 0xC0) != -1) { - unsigned short id; + unsigned short save_id; if (is_point_inside_clip_volume(&hero.motion.pos, *(int *)(elevator_vars + 0xC0)) || - l09_moby_collection_state.collected[(short)(id = MOBY(moby)->save_id)] != 0 || - (level_moby_killed[current_level_index][(short)id >> 5] >> (id & 0x1F)) & 1) { + l09_moby_collection_state.collected[(short)(save_id = MOBY(moby)->save_id)] != 0 || + (level_moby_killed[current_level_index][(short)save_id >> 5] >> (save_id & 0x1F)) & 1) { if (*(int *)(elevator_vars + 0xC0) != -1) { level_moby_killed[current_level_index][(short)MOBY(moby)->save_id >> 5] |= 1 << (MOBY(moby)->save_id & 0x1F); From b4909e427e724621fc3cf39e1f060a2352e6eaa9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:56:46 +0000 Subject: [PATCH 280/657] decomp: clarify names in EnableInterrupts status -> saved_interrupt_enable_bit: At 0x0011d6a8 mfc0 v0,Status captures the entry Status; lui/and at 0x0011d6ac-0x0011d6b0 retain only 0x10000. EI at 0x0011d6b4 does not replace that saved value, and sltu at 0x0011d6bc returns whether it was set. This is the source u32 status assigned CpuReadStatus(), masked before CpuEnableInt(), and tested on return. Prepared SyncDCache uses saved_interrupt_enable_bit for the identical saved-status mask. --- src/sdk/interrupts/enable_interrupts.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/interrupts/enable_interrupts.c b/src/sdk/interrupts/enable_interrupts.c index cdac4d7bce..e406324ea2 100644 --- a/src/sdk/interrupts/enable_interrupts.c +++ b/src/sdk/interrupts/enable_interrupts.c @@ -5,10 +5,10 @@ s32 EnableInterrupts(void) { enum { INTERRUPT_ENABLE_BIT_CLEAR = 0 }; - u32 status; + u32 saved_interrupt_enable_bit; - status = CpuReadStatus(); - status &= 0x10000; + saved_interrupt_enable_bit = CpuReadStatus(); + saved_interrupt_enable_bit &= 0x10000; CpuEnableInt(); - return status != INTERRUPT_ENABLE_BIT_CLEAR; + return saved_interrupt_enable_bit != INTERRUPT_ENABLE_BIT_CLEAR; } From 7a49b1f6cd549ec74692664a4cc33e4531e11494 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:59:22 +0000 Subject: [PATCH 281/657] decomp: clarify names in spawn_randomized_bolt_drop flags -> drop_behavior_mask: Retail 00260ab8 saves fourth argument a3 at sp+0x7c. 00260af0-00260b68 tests its 0x20 bit for mission/accounting gating; 00260b6c-00260b70 returns when the mask is zero. 00260b88-00260ba8 tests bit 4 to copy target-info +0x20 into base_velocity, and 00260e6c-00260e70 tests bit 8 before three-pickup denomination consolidation. 00261278/00261298/002612bc/002612d8 reload this same mask into a3 for spawn_bolt_by_value at 002612ec. The authoritative C reproduces these tests and forwards the unchanged int, proving a drop behavior control mask rather than a moby field. --- src/overlays/shared/game/unlock_planet.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/game/unlock_planet.c b/src/overlays/shared/game/unlock_planet.c index afbff88961..a26a3a508a 100644 --- a/src/overlays/shared/game/unlock_planet.c +++ b/src/overlays/shared/game/unlock_planet.c @@ -495,7 +495,7 @@ void spawn_randomized_bolt_drop(struct Moby *moby, void spawn_randomized_bolt_drop( - struct Moby *moby, int min_bolts, int max_bolts, int flags, int path_index) { + struct Moby *moby, int min_bolts, int max_bolts, int drop_behavior_mask, int path_index) { float base_velocity[4], position[4], velocity[4], spread[4], landing[4], path_point[4], quarter[4]; float first_root, second_root; @@ -512,24 +512,24 @@ void spawn_randomized_bolt_drop( twenties = 0; fifties = 0; clear_u64_value(base_velocity); - if (!(flags & 0x20)) { + if (!(drop_behavior_mask & 0x20)) { if (moby->mission != 0xFF && (unsigned)((unsigned short)moby->oclass - 0x1F4) >= 0x29) { D_L00_0015F598 = D_L00_0015FC88_macro[moby->mission] == 0xFF; } } counted = 0; if (D_L00_0015F598) { - if (!(flags & 0x20)) { + if (!(drop_behavior_mask & 0x20)) { counted = 1; } } - if (flags == 0) { + if (drop_behavior_mask == 0) { return; } if (min_bolts == 0 && max_bolts == 0) { return; } - if (flags & 4) { + if (drop_behavior_mask & 4) { aim = (unsigned char *)get_moby_target_info(moby); if (aim) { qcopy(base_velocity, aim + 0x20); @@ -605,7 +605,7 @@ void spawn_randomized_bolt_drop( } ones = remaining; sum = fifties + twenties + fives + ones; - if (sum >= 4 && (flags & 8)) { + if (sum >= 4 && (drop_behavior_mask & 8)) { down_ones = 0; down_fives = 0; down_twenties = 0; @@ -701,16 +701,16 @@ void spawn_randomized_bolt_drop( } fast_vec_add(velocity, velocity, base_velocity); if (fifties) { - spawn_bolt_by_value(moby, position, velocity, flags, 50, counted); + spawn_bolt_by_value(moby, position, velocity, drop_behavior_mask, 50, counted); fifties--; } else if (twenties) { - spawn_bolt_by_value(moby, position, velocity, flags, 20, counted); + spawn_bolt_by_value(moby, position, velocity, drop_behavior_mask, 20, counted); twenties--; } else if (fives) { - spawn_bolt_by_value(moby, position, velocity, flags, 5, counted); + spawn_bolt_by_value(moby, position, velocity, drop_behavior_mask, 5, counted); fives--; } else { - spawn_bolt_by_value(moby, position, velocity, flags, 1, counted); + spawn_bolt_by_value(moby, position, velocity, drop_behavior_mask, 1, counted); ones--; } } From 66c84a2168d2b3c1170df8ee1e47cd9ebc568aa4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 07:59:22 +0000 Subject: [PATCH 282/657] decomp: clarify names in step_moby_motion flags -> motion_outcome_flags: Authoritative step_moby_motion C initializes local int flags to zero and returns it; it accumulates outcomes rather than motion-record controls. Retail 0x0025c6a8 clears s6; 0x0025c908..0x0025c98c assigns 0x100 for coordinate bounds; 0x0025cb84..0x0025cb98 adds 0x40 from moby animation bit 2; 0x0025cc78..0x0025cc94 conditionally adds 0x100 for a queried moby while grounded; 0x0025cd2c..0x0025cd34 adds collision bit 2, and 0x0025cdbc..0x0025cdd8 adds bit 1 on qualified ground contact. 0x0025ce98 and 0x0025cebc move s6 into return v0. Original Ghidra uVar11/uVar12 corroborates the accumulator and return, and supplied sand_shark/constructorbot callers test these returned bits for landing/recovery. --- src/overlays/shared/mobys/step_moby_motion.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/mobys/step_moby_motion.c b/src/overlays/shared/mobys/step_moby_motion.c index 6401865aa2..ef36b474f7 100644 --- a/src/overlays/shared/mobys/step_moby_motion.c +++ b/src/overlays/shared/mobys/step_moby_motion.c @@ -209,7 +209,7 @@ int step_moby_motion(char *moby, struct KnockbackMotion *motion_state) { Vec4 *collision_result_position; char *collision_metadata; - int flags = 0; + int motion_outcome_flags = 0; float sc, ground_reference_height, landing_prediction_divisor, f12, motion_or_record_value, r, rr, one; @@ -265,7 +265,7 @@ int step_moby_motion(char *moby, struct KnockbackMotion *motion_state) { } if (MOBY(moby)->pos.x < 2.0f || 1021.0f < MOBY(moby)->pos.x || MOBY(moby)->pos.y < 2.0f || 1021.0f < MOBY(moby)->pos.y || MOBY(moby)->pos.z < 2.0f || 1021.0f < MOBY(moby)->pos.z) { - flags = 0x100; + motion_outcome_flags = 0x100; } if (motion_state->landing_animation_frame != -1.0f && @@ -321,7 +321,7 @@ int step_moby_motion(char *moby, struct KnockbackMotion *motion_state) { } if (MOBY(moby)->anim_flags & 2) { - flags |= 0x40; + motion_outcome_flags |= 0x40; } if (!(motion_state->flags & 4)) { FUN_L00_00258278(moby, @@ -377,7 +377,7 @@ int step_moby_motion(char *moby, struct KnockbackMotion *motion_state) { convert_integer_to_float(motion_state->collision_radius_1024ths) * sc, 36, moby) != 0) { - flags |= 2; + motion_outcome_flags |= 2; collision_result_position = (Vec4 *)&coll_hit_position; qcopy(&MOBY(moby)->pos, collision_result_position); one = 1.0f; @@ -416,5 +416,5 @@ int step_moby_motion(char *moby, struct KnockbackMotion *motion_state) { motion_state->phase = 1; } } - return flags; + return motion_outcome_flags; } From 68b20dd0901543a20a01ee3f594ae51b5d203cb7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:01:28 +0000 Subject: [PATCH 283/657] decomp: clarify names in apply_moby_camera_control id -> encoded_group_target: Bound source src/overlays/shared/camera/moby_controlled_camera.c SHA-256 ff104594037215a71976192c3b711c1ad2686a59d502f3ad829870eaece87a50 assigns id from each unsigned-short *group entry. Retail 002fba50..002fba64 loads the first halfword, masks 0x7fff and shifts by 8 to resolve a moby, while preserving the full entry in a3 at 002fba58. Retail 002fba74/78 shifts that saved entry by 16 and tests its high bit before advancing the group. Later entries repeat the mask/preserve/resolve sequence at 002fba80..002fba9c. Original Ghidra uVar2 likewise supplies both (uVar2 & 0x7fff)*0x100 and the signed high-bit termination test. Thus this is an encoded group target, not a bare identifier. --- src/overlays/shared/camera/moby_controlled_camera.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/camera/moby_controlled_camera.c b/src/overlays/shared/camera/moby_controlled_camera.c index 6959c7ab29..235e8b7f2a 100644 --- a/src/overlays/shared/camera/moby_controlled_camera.c +++ b/src/overlays/shared/camera/moby_controlled_camera.c @@ -197,7 +197,7 @@ void apply_moby_camera_control(char *moby) { char **)(l02_moby_record_table + *(short *)(moby + 0x84) * 32 + 0x1c)); char *target; unsigned short *group; - int id; + int encoded_group_target; int index; int duration; int count; @@ -232,7 +232,7 @@ void apply_moby_camera_control(char *moby) { int e = *group; moby_table_base = D_L02_0015FFD8; first_group_target = (char *)(moby_table_base + ((e & 0x7fff) << 8)); - id = e; + encoded_group_target = e; } if (*(signed char *)(first_group_target + 0x20) < 0) { do { @@ -246,7 +246,7 @@ void apply_moby_camera_control(char *moby) { int e = *group; moby_table_base = D_L02_0015FFD8; group_target_candidate = (char *)(moby_table_base + ((e & 0x7fff) << 8)); - id = e; + encoded_group_target = e; } } while (*(signed char *)(group_target_candidate + 0x20) < 0); target = group_target_candidate; From e995b29f0051d9953cfe42f859b58271bd20e688 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:01:28 +0000 Subject: [PATCH 284/657] decomp: clarify names in draw_pokitaru_ocean id -> wave_texture_offset: In the checked source, int id = layer + 0x28 is used only by get_effect_texture(ocean_vars->f1C + id) in the two-wave-layer loop. Retail 0x0030ae88 loads layer from sp+0x130, 0x0030ae8c loads the instance texture base at s4+0x1c, 0x0030ae94 forms layer+0x28 in a0, and 0x0030ae9c/0x0030aea0 calls the texture lookup with their sum. Original Ghidra likewise shows func_0x0022ab00(puVar1[7] + iStack_110 + 0x28). Thus this local is the wave texture offset, rather than the final texture identifier. --- src/overlays/shared/props/ocean_pokitaru.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/props/ocean_pokitaru.c b/src/overlays/shared/props/ocean_pokitaru.c index b9fff0e354..6e312c9786 100644 --- a/src/overlays/shared/props/ocean_pokitaru.c +++ b/src/overlays/shared/props/ocean_pokitaru.c @@ -236,8 +236,8 @@ void draw_pokitaru_ocean(struct Moby *moby) { colA = fast_tween_color(0, colA, color_interpolation_scalar); colB = fast_tween_color(0, colB, color_interpolation_scalar); for (layer = 0; layer < 2; layer++) { - int id = layer + 0x28; - vu1_add_g_sregister(6, get_effect_texture(ocean_vars->f1C + id)); + int wave_texture_offset = layer + 0x28; + vu1_add_g_sregister(6, get_effect_texture(ocean_vars->f1C + wave_texture_offset)); for (y = ocean_vars->f18 * -2.0f; y < ocean_vars->f18 * 2.0f; y += ocean_vars->f18) { vertex_count = 0; for (x = ocean_vars->f18 * -2.0f; x < ocean_vars->f18 * 2.0f; From 6a0b6f36c738142b062399df97ef5f5c87b900c6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:01:28 +0000 Subject: [PATCH 285/657] decomp: clarify names in update_camera_position_and_orientation_from_paths mode -> preset_kind: Retail 003153dc selects the CameraPreset pointer and 003153e0 loads its +0x30 kind into a0. 003153e8 branches on zero and 00315580-00315584 compares against 2; authoritative C binds this value from camera_path_preset->kind and compares CAMERA_PRESET_KIND_RAIL_SEGMENT_SYNC and CAMERA_PRESET_KIND_MAPPED_PATHS. Thus this local selects a preset kind, distinct from camera control/orbit mode fields. --- src/overlays/shared/camera/grindrail_camera.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/camera/grindrail_camera.c b/src/overlays/shared/camera/grindrail_camera.c index 0235ecb0d8..a680b1ff1f 100644 --- a/src/overlays/shared/camera/grindrail_camera.c +++ b/src/overlays/shared/camera/grindrail_camera.c @@ -337,7 +337,7 @@ void update_camera_position_and_orientation_from_paths(Cam *camera_to_update) { float look_length; float pitch_step; - if (mode == CAMERA_PRESET_KIND_RAIL_SEGMENT_SYNC) { + if (preset_kind == CAMERA_PRESET_KIND_RAIL_SEGMENT_SYNC) { Path *path; float dist; @@ -361,7 +361,7 @@ void update_camera_position_and_orientation_from_paths(Cam *camera_to_update) { camera_to_update->pos[1], rail_point[1], &data->vel[1], rate, 0.175f, 0.0f); camera_to_update->pos[2] = cam_interp_values( camera_to_update->pos[2], rail_point[2], &data->vel[2], rate, 0.175f, 0.0f); - } else if (mode == CAMERA_PRESET_KIND_MAPPED_PATHS) { + } else if (preset_kind == CAMERA_PRESET_KIND_MAPPED_PATHS) { Path *pathA = ((Path *)l01_paths[path_index]); Path *pathD = (Path *)l01_splines_macro[camera_path_preset->target].path; Path *pathC = ((Path *)l01_paths[camera_path_preset->path]); From 43c913f4cebf2a0ddd25a56ad758b7734ece9d00 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:01:29 +0000 Subject: [PATCH 286/657] decomp: clarify names in draw_tresspasser_puzzle state -> selected_ring: The unique source int state is loaded from puzzle_state->unkE0 in both rotation-threshold branches and compared with TRESSPASSER_SELECTED_RING_FIRST/SECOND to assign first_step or second_step, otherwise third_step. Retail 0x002d949c..0x002d94c4 and 0x002d94e8..0x002d950c load pvars+0xe0 and route +1/-1 into the corresponding ring steps. Original retail Ghidra tests the same +0xe0 word against 1 and 2. Ring bases +0x20/+0x50/+0x80 at 0x002d9514..0x002d951c and selection-dependent rotation at 0x002d9538..0x002d9544, 0x002d97b8..0x002d97c8 and 0x002d9a08..0x002d9a18 establish that this scalar selects a ring. --- src/overlays/shared/props/trespasser_pad.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/props/trespasser_pad.c b/src/overlays/shared/props/trespasser_pad.c index b05d85ba4e..12aed115fc 100644 --- a/src/overlays/shared/props/trespasser_pad.c +++ b/src/overlays/shared/props/trespasser_pad.c @@ -511,7 +511,7 @@ void draw_tresspasser_puzzle(char *moby) { Ring12 *markers = (Ring12 *)(&puzzle_state->markers); Ring12 *first_ring, *second_ring, *third; - int i, state, third_step; + int i, selected_ring, third_step; float phase; vu1_add_g_sregister(0x47, 0x5380b); @@ -533,7 +533,7 @@ void draw_tresspasser_puzzle(char *moby) { state = puzzle_state->turning_ring; if (state == TRESSPASSER_SELECTED_RING_FIRST) first_step = 1; - else if (state == TRESSPASSER_SELECTED_RING_SECOND) + else if (selected_ring == TRESSPASSER_SELECTED_RING_SECOND) second_step = 1; else third_step = 1; @@ -541,7 +541,7 @@ void draw_tresspasser_puzzle(char *moby) { state = puzzle_state->turning_ring; if (state == TRESSPASSER_SELECTED_RING_FIRST) first_step = -1; - else if (state == TRESSPASSER_SELECTED_RING_SECOND) + else if (selected_ring == TRESSPASSER_SELECTED_RING_SECOND) second_step = -1; else third_step = -1; From 17d2f7e222e5b32d36a16a936f86c0af49561142 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:01:29 +0000 Subject: [PATCH 287/657] decomp: clarify names in path_mover_update id -> save_id: Source assigns the u16 local from moby->save_id before indexing D_L14_001BB930.cleared and the current-level save bitset. Retail 0x002abb6c loads moby+0xB2 with lhu a1; 0x002abb78-0x002abb84 sign-extends it for the saved-state byte lookup; 0x002abb98-0x002abbc0 uses its signed value >>5 for the word and low five bits for the bit test. Thus this local is the moby's save_id, not a path or clip-volume identifier. --- src/overlays/l14/mobys/path_mover.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l14/mobys/path_mover.c b/src/overlays/l14/mobys/path_mover.c index 7bbdb4aa95..d7c61044bc 100644 --- a/src/overlays/l14/mobys/path_mover.c +++ b/src/overlays/l14/mobys/path_mover.c @@ -99,12 +99,12 @@ void path_mover_update(struct Moby *moby) { } } { - u16 id; + u16 save_id; if (path_mover_vars->trigger == -1 || is_point_inside_clip_volume(&hero.motion.pos, path_mover_vars->trigger) || - D_L14_001BB930.cleared[(s16)(id = moby->save_id)] != 0 || - (D_0014C190_257218[current_level_index][(s16)id >> 5] >> (id & 0x1F)) & 1) { + D_L14_001BB930.cleared[(s16)(save_id = moby->save_id)] != 0 || + (D_0014C190_257218[current_level_index][(s16)save_id >> 5] >> (save_id & 0x1F)) & 1) { if (path_mover_vars->trigger != -1) { D_0014C190_257218[current_level_index][(s16)moby->save_id >> 5] |= 1 << (moby->save_id & 0x1F); From 7ddc440a6183695e77192b0e2bbd96ae07732b30 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:01:29 +0000 Subject: [PATCH 288/657] decomp: clarify names in _vfprintf_r state -> multibyte_conversion_state: The authoritative C declares int state = 0 and uses its address only as the fifth argument of convert_multibyte_character(_REENT, &wc, fmt, MB_CUR_MAX, &state) in the format scan. Retail 0x00116e78 zeros sp+0x1d8; 0x00116edc and 0x00116ef8 retain its address at sp+0x21c; 0x00116f24 loads that pointer into t0 for the call at 0x00116f20 to 0x00115098. Original Ghidra likewise initializes uStack_f8 and passes puStack_b4=&uStack_f8 to FUN_00115098 while scanning pcStack_e4 for '%'. This identifies persistent multibyte conversion state, distinct from format flags and reentrancy_state. --- src/sdk/libc/stdio/_vfprintf_r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/libc/stdio/_vfprintf_r.c b/src/sdk/libc/stdio/_vfprintf_r.c index a20f43e9b1..40ac673c7e 100644 --- a/src/sdk/libc/stdio/_vfprintf_r.c +++ b/src/sdk/libc/stdio/_vfprintf_r.c @@ -89,7 +89,7 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li RncStdioIov iov[NIOV]; /* ... and individual io vectors */ char conversion_buffer[BUF]; /* space for %c, %[diouxX], %[eEfgG] */ char ox[2]; /* space for 0x hex-prefix */ - int state = 0; /* mbtowc calls from library must not change state */ + int multibyte_conversion_state = 0; /* mbtowc calls from library must not change state */ /* * Choose PADSIZE to trade efficiency vs. size. If larger printf @@ -162,7 +162,7 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li */ for (;;) { cp = fmt; - while ((n = convert_multibyte_character(_REENT, &wc, fmt, MB_CUR_MAX, &state)) > 0) { + while ((n = convert_multibyte_character(_REENT, &wc, fmt, MB_CUR_MAX, &multibyte_conversion_state)) > 0) { fmt += n; if (wc == '%') { fmt--; From ef7139bd7bea67ead93ba1ac1bf69ca0a5bc1582 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:01:29 +0000 Subject: [PATCH 289/657] decomp: clarify names in gadgetron_ceo_update flags -> challenge_score_announcement_flags: In source src/overlays/l16/mobys/gadgetron_ceo.c SHA-256 f4f930d1ff17e09b2bd57b9d30d9435fba66dd28fd467e67508b76168604aff3, flags is an unsigned-char pointer to D_0013D408 used only after player->points >= 4500. Original retail decompilation tests cRam0013d422 then sets it to 1 before two audio/notification calls. Instructions 0x002e6ba4-0x002e6bac compare points at player+0x8A8 against 0x1194; 0x002e6bb8-0x002e6bcc address D_0013D408, test byte +0x1A and set it to 1; 0x002e6bd4 and 0x002e6be0 call allocate_voice_for_bank_entry(1,0,0) and FUN_L00_00263d40(0x53D6,-1). This local accesses the flags guarding the challenge score announcement. --- src/overlays/l16/mobys/gadgetron_ceo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l16/mobys/gadgetron_ceo.c b/src/overlays/l16/mobys/gadgetron_ceo.c index 3df5d67ad7..03ea8c8ed4 100644 --- a/src/overlays/l16/mobys/gadgetron_ceo.c +++ b/src/overlays/l16/mobys/gadgetron_ceo.c @@ -270,9 +270,9 @@ void gadgetron_ceo_update(L16ChallengeMoby *ceo_moby) { L16ChallengePlayer *player = (L16ChallengePlayer *)((char *)&D_0013E633_challenge + 0xE1D); unsigned char event; if (player->points >= 4500) { - unsigned char *flags = D_0013D408; - if (!flags[0x1A]) { - flags[0x1A] = 1; + unsigned char *challenge_score_announcement_flags = D_0013D408; + if (!challenge_score_announcement_flags[0x1A]) { + challenge_score_announcement_flags[0x1A] = 1; allocate_voice_for_bank_entry(1, 0, 0); FUN_L00_00263d40(0x53D6, -1); } From 1b61d536b6c6146f9c608ebcd2c84a09c0820480 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:01:29 +0000 Subject: [PATCH 290/657] decomp: clarify names in update_vendor_menu id -> cutscene_animation_frame: Authoritative C src/overlays/shared/vendor/vendor_menu.c SHA-256 79ad37eb8e5af2b7b6cfac739cd9cffd9c1d05aba57bf147b90730941875e41c assigns id = D_L00_0016C860.f38 >> 1, then mb->next_frame = id + 1 and mb->frame = id. Original retail Ghidra cVar4 agrees. Retail 0029d950 loads cutscene counter +0x38; 0029d964 arithmetic-shifts it right one, 0029d968 adds one, and 0029d970/0029d978 store next/current animation frame bytes at moby+0x51/+0x50 before update_moby_animation_state. 0029d9b8-0029d9e8 uses these frame bytes to index position keys for interpolation. --- src/overlays/shared/vendor/vendor_menu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/vendor/vendor_menu.c b/src/overlays/shared/vendor/vendor_menu.c index 6a6a2a7edb..3f457414d5 100644 --- a/src/overlays/shared/vendor/vendor_menu.c +++ b/src/overlays/shared/vendor/vendor_menu.c @@ -1148,7 +1148,7 @@ void update_vendor_menu(void) { s32 i; s32 j; s32 k; - s32 id; + s32 cutscene_animation_frame; f32 k1; f32 k2; f32 k3; @@ -1592,9 +1592,9 @@ void update_vendor_menu(void) { l00_camera.rows[10] = camera_rotation_matrix[1][2]; for (i = 0; i < D_L00_0016C860.h44; i++) { mb = D_L00_0016C860.f178[i]; - id = D_L00_0016C860.f38 >> 1; - mb->next_frame = id + 1; - mb->frame = id; + cutscene_animation_frame = D_L00_0016C860.f38 >> 1; + mb->next_frame = cutscene_animation_frame + 1; + mb->frame = cutscene_animation_frame; update_moby_animation_state(mb); mb->blend = convert_integer_to_float(D_L00_0016C860.f38 & 1) * 0.5f; if (flag && (D_L00_0016C860.f38 & 1)) { From 7997309396a92b3fae314317ebba6715d2987a3a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:03:43 +0000 Subject: [PATCH 291/657] decomp: clarify names in sentrybot_update mode -> target_mode: In SENTRYBOT_ALERT_IDLE, source initializes mode directly from sentrybot_instance_data->target_mode. Retail 0x002991d8 loads pvars+0x114 into v1; 0x00299244-0x00299268 compares it with 2 to gate the emission-facing transition, and 0x002992e8-0x00299334 reuses this selector for emission versus alert-idle continuation. Original Ghidra case 0xc confirms the same +0x114 field. This proves the target-mode domain, distinct from moby state byte +0x20 and animation byte +0x52. --- src/overlays/shared/enemies/sentrybot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index fa1fdffa58..d8a234b5dc 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -1059,8 +1059,8 @@ void sentrybot_update(unsigned char *moby) { set_sentrybot_alarm_duration(linked_alarm_moby, -1); } } else { - int mode = sentrybot_instance_data->target_mode; - if (mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && + int target_mode = sentrybot_instance_data->target_mode; + if (target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && sentrybot_instance_data->alert_engagement_suppressed == 0) { begin_sentrybot_turn_toward_point( (char *)moby, @@ -1080,7 +1080,7 @@ void sentrybot_update(unsigned char *moby) { set_sentrybot_alarm_duration(linked_alarm_moby, scale_game_frames(0x1E)); } } else if (sentrybot_instance_data->has_line_of_sight != 0) { - if (mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && + if (target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && sentrybot_instance_data->alert_engagement_suppressed == 0) { begin_sentrybot_turn_toward_point((char *)moby, sentrybot_instance_data, From 4777b106a0a38f80178addb98dfd0ff611e78709 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:05:53 +0000 Subject: [PATCH 292/657] decomp: clarify names in set_hero_item_switch_timer_for_item id -> selected_item_id: Retail caller 0x0021061c with delay slot 0x00210620 passes hero.selected_item[i] when equipment changes, as shown in the checked caller/source excerpt. At 0x0020fde4 the incoming a0 is reduced by 9 and at 0x0020fde8..0x0020fe08 used solely for the item-ID switch dispatch; matching items reach scale_game_frames(70) and the halfword store at hero+0x1DA (0x0020fe10..0x0020fe1c). Thus this parameter is the selected equipment item ID, rather than a hero state or pad selector. --- src/overlays/shared/hero/hero_switch_item.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index 88b43c42c2..5a340059b3 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -1879,8 +1879,8 @@ void set_hero_condition_animation_timer_for_item(int id) { /* Sets the short at hero.item_swap_timer to scale_game_frames(0x46) for the listed ids. */ void set_hero_item_switch_timer_for_item(int id) __asm__("FUN_L00_0020fde0"); -void set_hero_item_switch_timer_for_item(int id) { - switch (id) { +void set_hero_item_switch_timer_for_item(int selected_item_id) { + switch (selected_item_id) { case 9: case 11: case 13: From 9249e79285e41fac36d5d2413a231bef0956bb4a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:08:17 +0000 Subject: [PATCH 293/657] decomp: clarify names in disable_intc status -> saved_interrupt_enable_bit: Retail 0x0011903c reads COP0 Status into s0; 0x00119040-0x00119044 mask it with 0x10000. The saved bit controls branches at 0x00119048 and 0x00119068 around DIntr and EnableInterrupts. Source status follows exactly this flow, and supplied EnableInterrupts uses saved_interrupt_enable_bit for the same mask. --- src/sdk/kernel/disable_intc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/kernel/disable_intc.c b/src/sdk/kernel/disable_intc.c index 8bc5223ff1..ae316d7434 100644 --- a/src/sdk/kernel/disable_intc.c +++ b/src/sdk/kernel/disable_intc.c @@ -11,17 +11,17 @@ s32 disable_intc(s32 intc_cause) { enum { EE_INTERRUPT_ENABLE_CLEAR = 0 }; - u32 status; + u32 saved_interrupt_enable_bit; s32 result; - status = CpuReadStatus(); - status &= 0x10000; - if (status != EE_INTERRUPT_ENABLE_CLEAR) { + saved_interrupt_enable_bit = CpuReadStatus(); + saved_interrupt_enable_bit &= 0x10000; + if (saved_interrupt_enable_bit != EE_INTERRUPT_ENABLE_CLEAR) { DIntr(); } result = _DisableIntc(intc_cause); CpuSync(); - if (status != EE_INTERRUPT_ENABLE_CLEAR) { + if (saved_interrupt_enable_bit != EE_INTERRUPT_ENABLE_CLEAR) { EnableInterrupts(); } return result; From 201615fd812a42e6ac7128d6afe55cf40af5d31f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:08:17 +0000 Subject: [PATCH 294/657] decomp: clarify names in request_taxi_return_help_message mode -> route_help_mode: Retail caller 0x002d31d8 loads taxi pvars into s3; 0x002d36a8 loads taxi command (route index) from 0xBC(s0), 0x002d36ac scales it by 4, 0x002d36b0 adds pvars, and call delay slot 0x002d36b8 loads a1 from +0xD0. This matches RailTaxiVars.help[taxi_moby->command] in the authoritative source. Callee 0x002d3104-08 compares this incoming a1 with 1 before requesting help owner 8/message 0xBC9 at either 0x002d3114 or 0x002d3128, proving this is the selected route's help mode. --- src/overlays/l03/mobys/taxi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l03/mobys/taxi.c b/src/overlays/l03/mobys/taxi.c index 612b205d46..10db1e27f9 100644 --- a/src/overlays/l03/mobys/taxi.c +++ b/src/overlays/l03/mobys/taxi.c @@ -36,8 +36,8 @@ s32 is_taxi_in_round_trip_phase(u8 *tested_moby) { void request_taxi_return_help_message(void *taxi_moby, int mode) __asm__("FUN_L03_002d3100"); -void request_taxi_return_help_message(void *taxi_moby, int mode) { - if (mode == 1) { +void request_taxi_return_help_message(void *taxi_moby, int route_help_mode) { + if (route_help_mode == 1) { try_set_help_message(8, 0xBC9); } else { try_set_help_message(8, 0xBC9); From fc34d3cabb257c6c33bdf75c80990bb1fdc524ba Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:08:17 +0000 Subject: [PATCH 295/657] decomp: clarify names in _Error state -> library_context: Retail 0x0012c330 loads decoder_state+0x858 into v1; 0x0012c334 checks it for null and 0x0012c34c moves it to a0 for the callback dispatcher at 0x0012c358. Original Ghidra identifies this field as MpegVideoLibraryContext *pLibraryContext; supplied _dispatchMpegCallback uses its first argument as callback_context. Thus the u32 local carries the library context pointer, not a state ID. --- src/sdk/mpeg/errors/_Error.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/mpeg/errors/_Error.c b/src/sdk/mpeg/errors/_Error.c index 238128f838..7ccffa5f69 100644 --- a/src/sdk/mpeg/errors/_Error.c +++ b/src/sdk/mpeg/errors/_Error.c @@ -12,14 +12,14 @@ void print_mpeg_error(int argument) __asm__("JumpToImageSetup"); void _Error(struct ErrorContext *context, int argument) __asm__("_Error"); void _Error(struct ErrorContext *decoder_state, int argument) { - u32 state; + u32 library_context; int callback_arguments[2]; - state = FIELD(u32, decoder_state, 0x858); - if (state != 0 && decoder_state != 0 && FIELD(u32, decoder_state, 0x0C) != 0) { + library_context = FIELD(u32, decoder_state, 0x858); + if (library_context != 0 && decoder_state != 0 && FIELD(u32, decoder_state, 0x0C) != 0) { callback_arguments[1] = argument; callback_arguments[0] = 0; - _dispatchMpegCallback(state, callback_arguments); + _dispatchMpegCallback(library_context, callback_arguments); } else { print_mpeg_error(argument); } From 53eae13e006609da40c47051b3d23bdc7ef54c52 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:10:11 +0000 Subject: [PATCH 296/657] decomp: clarify names in save_card_state_prompt_create_save flags -> freeze_flags_snapshot: In the authoritative C, int flags is assigned mode_freeze_flags once and is used only for tests and XOR clearing of bits 0x20 and 0x10 back into that global. Retail 00208cb4 loads the original freeze flag word from -0x7d4c(gp) into v1; 00208cc4/00208ccc test and XOR bit 0x20, with writeback at 00208cdc. The alternative path 00208cf8/00208d00 tests and XORs bit 0x10 from the same loaded word, writing to DAT_0015eeb4 at 00208d0c. Thus this binding is the snapshot of the freeze flags before consumption, rather than a distinct state or card operation. --- .../menus/save_data/save_card_state_prompt_create_save.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/menus/save_data/save_card_state_prompt_create_save.c b/src/ui/menus/save_data/save_card_state_prompt_create_save.c index 243b25ece0..09e4bf661b 100644 --- a/src/ui/menus/save_data/save_card_state_prompt_create_save.c +++ b/src/ui/menus/save_data/save_card_state_prompt_create_save.c @@ -6,15 +6,15 @@ void save_card_state_prompt_create_save(void) __asm__("FUN_00208ca8"); void save_card_state_prompt_create_save(void) { - int flags; + int freeze_flags_snapshot; if (memory_card_state.card[0].sync_result != 0) { save_card_state = CS_NOCARD; return; } - flags = mode_freeze_flags; - if (flags & 0x20) { - mode_freeze_flags = flags ^ 0x20; + freeze_flags_snapshot = mode_freeze_flags; + if (freeze_flags_snapshot & 0x20) { + mode_freeze_flags = freeze_flags_snapshot ^ 0x20; if (boot_level_active != 0) { save_card_state = CS_PROMPT_BEGIN_NOSAVE; } else { From c554c0290c111db52d04215e7733ab70ff993a80 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:10:12 +0000 Subject: [PATCH 297/657] decomp: clarify names in dispatch_game_state_update state -> render_dispatch_state: In the bound source, state is assigned ship_substate[0] and used only for the unsigned <9 guard and rendering switch. Retail 0x00230f00 loads this selector from 0x0013e050; 0x00230f04 checks it below 9 and 0x00230f10-0x00230f20 indexes the jump table. Branches call prepare_debug_profiler_render at 0x00230f28, draw_debug_profiler at 0x00230f3c, or render_level_frame at 0x00230f4c. Thus it is the rendering dispatch state, without requiring a lifecycle interpretation of individual values. --- src/game/dispatch_game_state_update.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/dispatch_game_state_update.c b/src/game/dispatch_game_state_update.c index b29e5923f0..51bc85672e 100644 --- a/src/game/dispatch_game_state_update.c +++ b/src/game/dispatch_game_state_update.c @@ -14,16 +14,16 @@ void dispatch_game_state_update(void) { enum { LEVEL_FRAME_RENDER = 4 }; - s32 state; + s32 render_dispatch_state; if (space_load_in_progress != 0) { return; } - state = ship_substate[0]; - if ((u32)state >= 9U) { + render_dispatch_state = ship_substate[0]; + if ((u32)render_dispatch_state >= 9U) { return; } - switch (state) { + switch (render_dispatch_state) { case 0: case 8: prepare_debug_profiler_render(); From e0f8434ddff678d3510d5ed516f07a26d0aee105 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:10:12 +0000 Subject: [PATCH 298/657] decomp: clarify names in save_card_state_saving flags -> updated_freeze_flags: In source src/ui/menus/save_data/save_card_state_saving.c (SHA-256 27536503ece337927feafe004391ca3dcddf5e5bc071c816721ceb73e366e81a), flags receives mode_freeze_flags | 0x40 and is then written back to mode_freeze_flags. Retail 0x00208f6c loads the existing word at 0x0015eeb4 into v0, 0x00208f7c ORs v0 with 0x40, and 0x00208f84 stores that updated word through gp-relative storage. The original Ghidra likewise shows DAT_0015eeb4 | 0x40 feeding the flag writeback. Thus this local holds the updated freeze flags word, without claiming a meaning for the individual bit. --- src/ui/menus/save_data/save_card_state_saving.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/menus/save_data/save_card_state_saving.c b/src/ui/menus/save_data/save_card_state_saving.c index a545c8f007..ae57f97f12 100644 --- a/src/ui/menus/save_data/save_card_state_saving.c +++ b/src/ui/menus/save_data/save_card_state_saving.c @@ -14,7 +14,7 @@ extern void mode_freeze_init() __asm__("func_001FBAB8"); void save_card_state_saving(void) __asm__("FUN_00208f28"); void save_card_state_saving(void) { - s32 flags; + s32 updated_freeze_flags; if ((memory_card_state.state < MEMCARD_REQUEST_FORMAT) && (memory_card_state.pending_state < MEMCARD_QUERY_INFO)) { From b870dcab2fe380f3a4489eea57a58b74469bc04c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:12:32 +0000 Subject: [PATCH 299/657] decomp: clarify names in save_card_state_good_save flags -> original_flags: Source initializes flags from mode_freeze_flags before clearing bits 4 and 2. Retail 0x002088d4 loads the entry value from 0x0015eeb4 into a1; 0x002088e8-0x002088ec mask a separate value into a0, stored at 0x002088f8. The unchanged a1 is tested at 0x00208908, 0x0020892c and 0x00208958 for bits 0x80, 0x100 and 0x200 after the global store, proving this local retains the original flags. --- src/ui/menus/save_data/save_card_state_good_save.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/menus/save_data/save_card_state_good_save.c b/src/ui/menus/save_data/save_card_state_good_save.c index 492e31a5a6..6c4c94a1b8 100644 --- a/src/ui/menus/save_data/save_card_state_good_save.c +++ b/src/ui/menus/save_data/save_card_state_good_save.c @@ -11,10 +11,10 @@ void save_card_state_good_save(void) __asm__("FUN_002088d0"); void save_card_state_good_save(void) { - int flags = mode_freeze_flags; + int original_flags = mode_freeze_flags; struct MemoryCardState *card_state; int nf; - mode_freeze_flags = flags & ~4; + mode_freeze_flags = original_flags & ~4; card_state = &memory_card_state; nf = mode_freeze_flags & ~2; mode_freeze_flags = nf; @@ -38,7 +38,7 @@ void save_card_state_good_save(void) { save_card_state = CS_WARNING; return; } - if (flags & 0x200) { + if (original_flags & 0x200) { mode_freeze_flags = nf ^ 0x200; save_card_state = CS_SAVING; } From 75d99903f29ec2721bf3332034aff122fb5b69ac Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:12:32 +0000 Subject: [PATCH 300/657] decomp: clarify names in update_rail_lift_help_and_hud mode -> help_message_mode: Retail a1 (Ghidra param_2) is compared with 2/1/3/4 at 0x002dcbd8, 0x002dcbec, 0x002dcc00 and 0x002dcc08, selecting try_set_help_message(8, 0xBCF/0xBCE/0xBCB/0xBCD); default passes -1 at 0x002dcc60-64. The supplied rail_lift_update caller passes lift_vars->help[lift_moby->command ^ 1], the opposite endpoint's help setting. The parameter therefore selects the help message, while HUD handling after 0x002dcc68 does not depend on it. --- src/overlays/l03/mobys/rail_lift.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l03/mobys/rail_lift.c b/src/overlays/l03/mobys/rail_lift.c index 9bb08d6377..237bf1ad69 100644 --- a/src/overlays/l03/mobys/rail_lift.c +++ b/src/overlays/l03/mobys/rail_lift.c @@ -42,10 +42,10 @@ extern void draw_hud_text_panel(void) __asm__("FUN_L00_00237200"); void update_rail_lift_help_and_hud(struct Moby *lift_moby, int mode) __asm__("FUN_L03_002dcbc8"); -void update_rail_lift_help_and_hud(struct Moby *lift_moby, int mode) { +void update_rail_lift_help_and_hud(struct Moby *lift_moby, int help_message_mode) { char *lift_vars = (char *)lift_moby->pvars; int hud_key; - switch (mode) { + switch (help_message_mode) { case 1: try_set_help_message(8, 0xBCE); break; From 73c5beda7d0488f46d99b0912a499c94d8cc1c78 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:12:32 +0000 Subject: [PATCH 301/657] decomp: clarify names in set_hero_condition_animation_timer_for_item id -> switched_item_id: Authoritative source passes hero.selected_item[i] from hero_switch_item only in its changed branch. Checked level-00 retail caller 0x00210614..0x00210618 forms 0x00141424 + slot*4, then 0x00210624 calls 0x0020fd80 with lw a0,0(s0) in delay slot 0x00210628. Caller Ghidra likewise passes the selected-item array element. Target retail 0x0020fd84 subtracts 9 from incoming a0 and 0x0020fd8c..0x0020fdac dispatches it through the jump table. Thus the integer is the switched item ID, not the slot index, animation selector or hero state. --- src/overlays/shared/hero/hero_switch_item.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index 5a340059b3..a3561bdfe2 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -1858,10 +1858,10 @@ void clear_hero_item_slot(int i, int respawn_threshold) { /* For the listed ids sets hero.face_expression to 3 and hero.face_expression_timer to scale_game_frames(0x46). */ void set_hero_condition_animation_timer_for_item(int id) __asm__("FUN_L00_0020fd80"); -void set_hero_condition_animation_timer_for_item(int id) { +void set_hero_condition_animation_timer_for_item(int switched_item_id) { struct Hero *hero_condition_animation_state; - switch (id) { + switch (switched_item_id) { case 9: case 11: case 13: From 86bc7f4b392fc38a754769c8d618a3c0b99eba80 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:14:32 +0000 Subject: [PATCH 302/657] decomp: clarify names in hero_anim_tilt_lookup id -> tilt_selector: In authoritative hero_anim_tilt_lookup, int id is used only as the switch selector. Retail param_1/a0 is reduced by 0x1c at 0x0023b394/0x0023b3b8, range-checked at 0x0023b3c4, and indexes the branch table at 0x0023b3d0-0x0023b3e0. Its selected branches either retain the zero tilt, write -0.95993108 radians at 0x0023b3fc, or conditionally write -1.30899692 radians at 0x0023b430 after anim_frame > 25. This proves a tilt lookup selector without asserting the unproved upstream ID domain. --- src/overlays/shared/hero/process_hero_primary_item_input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/process_hero_primary_item_input.c b/src/overlays/shared/hero/process_hero_primary_item_input.c index 293412c02e..7041a08260 100644 --- a/src/overlays/shared/hero/process_hero_primary_item_input.c +++ b/src/overlays/shared/hero/process_hero_primary_item_input.c @@ -72,12 +72,12 @@ void smooth_and_clamp_value_pair(float *clamped_values, float *smoothed_values, int hero_anim_tilt_lookup(int id, float *out) __asm__("FUN_L05_0023b378"); -int hero_anim_tilt_lookup(int id, float *out_tilt_radians) { +int hero_anim_tilt_lookup(int tilt_selector, float *out_tilt_radians) { *out_tilt_radians = 0.0f; if (hero.state.control_mode == 0x16 && hero.race_ammo && (unsigned)(hero.moby->prev_seq - 0x69) < 4) return 1; - switch (id) { + switch (tilt_selector) { case 0x37: *out_tilt_radians = -0.95993108f; /* -55 degrees */ return 1; From 45fa988e49991586d3cd41acb07499e414de07c2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:14:32 +0000 Subject: [PATCH 303/657] decomp: clarify names in lookup_hero_slot3_animation_key mode -> slot3_item_id: Source initializes mode from hero_slot_item_id(3). Retail 0x00231e10-0x00231e20 calls 0x0020d498 with a0=3 and compares its return to 4 to retain the gp-relative animation table. Checked helper 0x0020d498-0x0020d4c0 multiplies the slot by 0x50, indexes hero at 0x0013f350, checks slot state at +0x10b4 equals 2, and returns item_id at +0x10b8 (otherwise -1). Thus this local is the slot-3 item ID, not a control mode. --- src/overlays/shared/hero/set_hero_animation.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index fc5a27f6ee..8c9ad331ae 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -89,9 +89,9 @@ int lookup_hero_slot3_animation_key(int key, int *out_animation_key) { } else if (hero_slot_item_id(3) == 3) { animation_lookup_table = D_L00_0017BBD0; } else { - int mode = hero_slot_item_id(3); + int slot3_item_id = hero_slot_item_id(3); animation_lookup_table = (SeqEntry *)&D_L00_0015F6B8; - if (mode != 4) { + if (slot3_item_id != 4) { animation_lookup_table = 0; } } From fa2c4ef15ae05a8d2e3312ee84fe76820219867a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:14:33 +0000 Subject: [PATCH 304/657] decomp: clarify names in update_shuttle_help_message mode -> selected_stop_index: Retail 002f20e0 loads moby->pvars and 002f20e4 loads its +0x94 into the local mode; 002f20e8..002f2104 recognizes stop values 0/1 and propagates them to +0x80. In checked caller shuttle_update (evidence request 180cf7b2fb884943b99fbea39dca842b, report SHA-256 094ffe372845cf5fd67fdb05b078a5da2a828619e5f53c5f34b7dd360dcbca67), 002f1dc4..002f1de8 scales +0x94 by four to index the paired stop-transform IDs at pvars+0x78. 002f1e48..002f1e70 toggles this index with XOR 1, then 002f1e7c..002f1ea0 copies the selected stop position/rotation into the shuttle. 002f1ee4..002f1f1c uses the same index for arrival placement. Source maps +0x94 to Vars1448.sel and cam[sel], proving selected_stop_index rather than an unspecified mode. --- src/overlays/l17/mobys/shuttle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l17/mobys/shuttle.c b/src/overlays/l17/mobys/shuttle.c index d80c1088b0..ea12deb9ba 100644 --- a/src/overlays/l17/mobys/shuttle.c +++ b/src/overlays/l17/mobys/shuttle.c @@ -286,13 +286,13 @@ void shuttle_update(struct Moby *shuttle_moby) { void update_shuttle_help_message(struct Moby *moby) { char *shuttle_private_vars = (char *)moby->pvars; - int mode = *(int *)(shuttle_private_vars + 0x94); - switch (mode) { + int selected_stop_index = *(int *)(shuttle_private_vars + 0x94); + switch (selected_stop_index) { case SHUTTLE_STOP_FIRST: *(int *)(shuttle_private_vars + 0x80) = 0; break; case SHUTTLE_STOP_SECOND: - *(int *)(shuttle_private_vars + 0x80) = mode; + *(int *)(shuttle_private_vars + 0x80) = selected_stop_index; break; } switch (*(int *)(shuttle_private_vars + 0x80)) { From f15f14e848ddf47609e37bc9c172f4feb16c1fe4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:14:33 +0000 Subject: [PATCH 305/657] decomp: clarify names in queue_animation_update id -> queued_animation_id: Retail 0x001ff330 preserves second s32 argument a1 in t5; 0x001ff370-0x001ff374 compares it with slot+0x20, and 0x001ff3d4 writes it there (source anim->next_id). This is part of pending animation configuration, separately from slot+0x64 serial generated at 0x001ff3b0-0x001ff3d0 and returned at 0x001ff400. Supplied hero callers pass 0x753A for the bolt-exclamation HUD and 0x754E for the bolt-counter HUD, or zero for the item selector. Prepared helper evidence request 018e38a5bdc54877a925e37cbc30b506 shows apply_pending_animation loading pending +0x20 into a1 at 0x001ff42c for the activation helper call. Thus queued_animation_id identifies the queued configuration identifier without claiming its resource namespace or confusing it with a channel or serial. mode -> channel_flags: Retail 0x001ff308 extracts channel slot with a0 & 0xF; 0x001ff324 independently extracts a0 & 0xFFF0 into t4, matching local mode. Retail 0x001ff37c-0x001ff380 compares these upper channel bits against pending +0x24, and 0x001ff3e8 stores them there. At 0x001ff3bc/0x001ff3c4 the bits are ANDed with slot flags at +4 and 0x20 to gate apply_pending_animation at 0x001ff3f8. Prepared helper 0x001ff434/0x001ff448 copies pending +0x24 to active flags at +4. This proves channel configuration flags, distinguishing this bitmask from the separate global game_mode. --- src/mobys/animation/queue_animation_update.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mobys/animation/queue_animation_update.c b/src/mobys/animation/queue_animation_update.c index 0c219100fe..6df7d604e5 100644 --- a/src/mobys/animation/queue_animation_update.c +++ b/src/mobys/animation/queue_animation_update.c @@ -28,7 +28,7 @@ extern void apply_pending_animation(struct Anim *) __asm__("func_001FF418 s32 queue_animation_update(s32 chan, s32 id, s32 fn, s32 d, s32 e, s32 c, s32 b) __asm__("FUN_001ff308"); s32 queue_animation_update(s32 chan, - s32 id, + s32 queued_animation_id, s32 fn, s32 animation_callback, s32 queued_animation_callback, @@ -36,19 +36,19 @@ s32 queue_animation_update(s32 chan, s32 queued_animation_value) { s32 slot = chan & 0xF; - s32 mode = chan & 0xFFF0; + s32 channel_flags = chan & 0xFFF0; struct Anim *anim = &hud_chan_slots[slot]; if (game_mode == 5 && slot != 2 && slot != 0) { return 0; } if (anim->next_c != animation_context || anim->next_b != queued_animation_value || - anim->next_id != id || anim->next_mode != mode || anim->next_fn != fn || + anim->next_id != queued_animation_id || anim->next_mode != channel_flags || anim->next_fn != fn || anim->next_d != animation_callback || anim->next_e != queued_animation_callback) { anim->next_c = animation_context; anim->serial = hud_state.serial++; anim->next_b = queued_animation_value; - anim->next_id = id; + anim->next_id = queued_animation_id; anim->next_fn = fn; anim->next_d = animation_callback; anim->next_e = queued_animation_callback; From 52af9715cda6472d80ec6beb8a2f05530054d62d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:14:33 +0000 Subject: [PATCH 306/657] decomp: clarify names in spawn_randomly_rotated_colored_moby flags -> lifetime_frames: Retail 0x002df868 saves a3, 0x002df938 reloads it, 0x002df944 writes it to spawned private data +0x14, and 0x002df948/0x002df950 copy its low halfword to +0x1c (Ghidra puVar1[5] = param_5). In authoritative glow_particle.c, the shared glow_particle_update explicitly covers classes 112 and 1192 (0x4a8): V_2acad8.n is at +0x14 and h1c at +0x1c; n is converted to total_lifetime_frames and divides scale interpolation, while fast_dec_timer_s16(&v->h1c) triggers removal and n/2 controls alpha fading. Supplied callers pass frame-scaled 15/24-frame durations in this slot. These operations establish a lifetime in frames, not bit flags. --- src/overlays/shared/rendering/effects/glow_particle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/effects/glow_particle.c b/src/overlays/shared/rendering/effects/glow_particle.c index aa6a4a0d87..231da776d3 100644 --- a/src/overlays/shared/rendering/effects/glow_particle.c +++ b/src/overlays/shared/rendering/effects/glow_particle.c @@ -157,7 +157,7 @@ unsigned char *spawn_randomly_rotated_colored_moby(int owner, unsigned char *spawn_randomly_rotated_colored_moby(int source_moby_address, V_2df808 *position, V_2df808 *vector, - int flags, + int lifetime_frames, unsigned char red, unsigned char green, unsigned char blue, @@ -188,7 +188,7 @@ unsigned char *spawn_randomly_rotated_colored_moby(int source_moby_add qcopy(spawned_moby_private_data, vector); qcopy(moby + 0x40, &rotation_copy); *(unsigned short *)(spawned_moby_private_data + 0x1e) = alpha; - *(int *)(spawned_moby_private_data + 0x14) = flags; + *(int *)(spawned_moby_private_data + 0x14) = lifetime_frames; *(unsigned short *)(spawned_moby_private_data + 0x1c) = *(unsigned short *)(spawned_moby_private_data + 0x14); update_entity(moby); From 26b5d578d1b978ad475277b23690ab161085090f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:14:33 +0000 Subject: [PATCH 307/657] decomp: clarify names in jet_end_mount mode -> camera_handoff_request: Retail 0x002eac30 saves incoming a0 in s0; 0x002eac48 and 0x002eacd8/0x002eacf8/0x002ead0c compare it against 0/2/1/4 after initialize_camera_record_handoff_defaults. It is a caller-supplied request selecting handoff operations, not a loaded camera state: zero reconstructs the follow-camera basis and hero-relative position (0x002eac50-0x002eacc4); other values select writes of 2/3/5 to follow-camera +0x7E. Original Ghidra confirms param_1 selects these branches. The established jet_end_mount name, source camera handback description, and supplied birdbot mount-release/fighter-jet exit callers prove the camera handoff domain. --- src/overlays/shared/camera/scripted_camera.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/camera/scripted_camera.c b/src/overlays/shared/camera/scripted_camera.c index a89f866250..140d382c1c 100644 --- a/src/overlays/shared/camera/scripted_camera.c +++ b/src/overlays/shared/camera/scripted_camera.c @@ -129,14 +129,14 @@ void jet_mount(V_2eaaa0 *pa, V_2eaaa0 *pb, s32 mode, s32 transition_duration_fra void jet_end_mount(int mode) __asm__("FUN_L00_002eac18"); -void jet_end_mount(int mode) { +void jet_end_mount(int camera_handoff_request) { enum { JET_END_MOUNT_REPOSITION_BEHIND_HERO = 0 }; LevelCamera *camera_globals = &l00_camera_lui; char *current_follow_camera = ((char *)camera_globals->current_camera); initialize_camera_record_handoff_defaults(); - if (mode == JET_END_MOUNT_REPOSITION_BEHIND_HERO) { + if (camera_handoff_request == JET_END_MOUNT_REPOSITION_BEHIND_HERO) { float camera_up_offset[4] __attribute__((aligned(16))); float camera_backward_offset[4] __attribute__((aligned(16))); float hero_rotation_matrix[16] __attribute__((aligned(16))); From 3350851ce192d015774e08d65e945ac367073628 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:17:14 +0000 Subject: [PATCH 308/657] decomp: clarify names in sceGsResetGraph mode -> operation: Retail 0x0012187c/0x0012189c sign-extends first argument a0; comparisons at 0x001218ac-0x001218d4 dispatch values 1, 0 and 5. Source switch(mode) selects GS_RESET_AND_CONFIGURE_VIDEO, the CSR-only write, or GS_UPDATE_VIDEO_MODE. Unlike third argument video_output_mode in s2, this argument never reaches SetGsCrt or sceGsOutMode. It therefore selects the reset/configuration operation. Supplied startlevel and transition_do_transition callers pass 0 for reset and configuration. --- src/sdk/graph/sce_gs_reset_graph.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/graph/sce_gs_reset_graph.c b/src/sdk/graph/sce_gs_reset_graph.c index c8b3494f12..48e63a196c 100644 --- a/src/sdk/graph/sce_gs_reset_graph.c +++ b/src/sdk/graph/sce_gs_reset_graph.c @@ -7,14 +7,14 @@ extern s32 RemoveIntcHandler(); extern s32 disable_intc() __asm__("func_00119028"); extern void SetGsCrt(s32, s32, s32); -void sceGsResetGraph(s16 mode, s16 inter, s16 video_output_mode, s16 ff) { +void sceGsResetGraph(s16 operation, s16 inter, s16 video_output_mode, s16 ff) { enum { GS_RESET_AND_CONFIGURE_VIDEO = 0, GS_UPDATE_VIDEO_MODE = 5 }; sceGsGParam *gp; - switch (mode) { + switch (operation) { case GS_RESET_AND_CONFIGURE_VIDEO: gp = sceGsGetGParam(); *(volatile u64 *)0x12001000 = 0x200; From e44663e5e7def521ad4eaada22b56de1e3742c27 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:19:23 +0000 Subject: [PATCH 309/657] decomp: clarify names in mode_freeze_init mode -> initial_state: Retail 0x001fbad8 preserves incoming a0 in s0; 0x001fbb24 stores it unchanged at freeze base 0x00193300 +0, matching source freeze.state = mode and original Ghidra DAT_00193300 = param_1. Retail 0x001fbb14 bounds it to 0..6 and 0x001fbb2c-0x001fbb3c uses it to dispatch state-specific initialization. The separate game_mode global is assigned 4 at 0x001fbb1c. Thus this parameter selects the initial freeze state rather than the outer game mode; initial_state adds its destination and initialization role without claiming unknown state semantics. --- src/game/mode_freeze_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/mode_freeze_init.c b/src/game/mode_freeze_init.c index a4eb069fae..c453797eca 100644 --- a/src/game/mode_freeze_init.c +++ b/src/game/mode_freeze_init.c @@ -10,7 +10,7 @@ extern s32 push_help_history() __asm__("func_001FED30"); void mode_freeze_init(u32 mode, s32 freeze_context) __asm__("FUN_001fbab8"); -void mode_freeze_init(u32 mode, s32 freeze_context) { +void mode_freeze_init(u32 initial_state, s32 freeze_context) { enum { FREEZE_CONTROL_MODE_16_PAUSE = 0, FREEZE_HERO_STATE_32_PAUSE = 1, @@ -31,8 +31,8 @@ void mode_freeze_init(u32 mode, s32 freeze_context) { freeze.return_game_mode = game_mode; freeze.context = freeze_context; game_mode = GAME_MODE_FREEZE; - freeze.state = mode; - switch (mode) { + freeze.state = initial_state; + switch (initial_state) { case FREEZE_CONTROL_MODE_16_PAUSE: freeze_state = &freeze; freeze_state->title = (char *)get_help_message_text(0x4F6E); From ff8f248848163ee66a5fcd79ff7dba0daad93360 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:19:23 +0000 Subject: [PATCH 310/657] decomp: clarify names in pause_all_sounds mode -> menu_state: In authoritative C the s32 parameter mode is assigned directly to g->state with g = &menu_system, while game_mode_macro is separately assigned 3. Retail saves a0 in s1 at 0x00218d80 and stores s1 to 0x001D5BF0 (menu_system.state) at 0x00218eec. Original Ghidra also assigns param_1 to the first word of that same object. The comparison at 0x00218e68/0x00218e74 tests this same menu state against 0x23 and writes the boolean at menu_system+0xDC. Thus menu_state identifies the destination state domain without guessing any state's purpose. --- src/audio/voices/pause_all_sounds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/voices/pause_all_sounds.c b/src/audio/voices/pause_all_sounds.c index 01a442f8ce..715e86f5d8 100644 --- a/src/audio/voices/pause_all_sounds.c +++ b/src/audio/voices/pause_all_sounds.c @@ -40,7 +40,7 @@ void pause_all_sounds(s32 mode) __asm__("FUN_00218d78"); extern s32 game_mode_macro __asm__("D_0015F604") MACRO_ADDR; -void pause_all_sounds(s32 mode) { +void pause_all_sounds(s32 menu_state) { struct MenuSystem *g; snd_pause_all_sounds_in_group(0x1D); music_pause(0); @@ -81,7 +81,7 @@ void pause_all_sounds(s32 mode) { { struct MenuSystem *g = &menu_system; game_mode_macro = 3; - g->state = mode; + g->state = menu_state; g->close_request = 0; g->graphics_workspace = 0; g->update_count = 0; From 4b1c640605a44569218f87b33c644c5c4d99be62 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:21:29 +0000 Subject: [PATCH 311/657] decomp: clarify names in spawn_moby_break_fragments mode -> spawned_fragment_mode: Retail 0x263e40 initializes s7 to zero and 0x263e34/0x263e48 selects 2 when final flag t2 is nonzero. At 0x263ebc and 0x263f7c s7 is forwarded in t1 to fragment initializer 0x263fd8 in both spawn loops. Helper retail 0x263ff4 saves t1 in s7; 0x264074 loads the newly allocated fragment's pvars from moby+0x78, and 0x264104 stores s7 at pvars+0x34. Authoritative helper C names that argument fragment_mode and stores it at fragment_pvars+0x34, proving this local is the spawned fragment mode, without proving the behaviors of 0 or 2. --- src/overlays/shared/mobys/select_auto_aim_target_moby.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/mobys/select_auto_aim_target_moby.c b/src/overlays/shared/mobys/select_auto_aim_target_moby.c index c73ecc1ae1..e2771fd265 100644 --- a/src/overlays/shared/mobys/select_auto_aim_target_moby.c +++ b/src/overlays/shared/mobys/select_auto_aim_target_moby.c @@ -493,10 +493,10 @@ void spawn_moby_break_fragments(unsigned char *source_moby, int flag) { u128_263e30 fragment_spawn_positions[16]; float random_fragment_euler_rotation[4] __attribute__((aligned(16))); - int mode = 0; + int spawned_fragment_mode = 0; int i, k; if (flag) { - mode = 2; + spawned_fragment_mode = 2; } if (first_fragment_class > 0) { if (consecutive_class_fragment_count > 0) @@ -506,7 +506,7 @@ void spawn_moby_break_fragments(unsigned char *source_moby, &MOBY(source_moby)->pos, source_moby + 0x40, 0, - mode, + spawned_fragment_mode, &zero_vector, &zero_vector, 0.0f, @@ -527,7 +527,7 @@ void spawn_moby_break_fragments(unsigned char *source_moby, &fragment_spawn_positions[i], random_fragment_euler_rotation, 0, - mode, + spawned_fragment_mode, &zero_vector, &zero_vector, 0.0f, From 3fa8a342d5154db2bc06223a8ef38ba8a2d3ba96 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:21:29 +0000 Subject: [PATCH 312/657] decomp: clarify names in create_spark_particle mode -> particle_mode_override: Retail 0x0027e928 masks incoming t1 into s4; 0x0027e9b8-0x0027e9bc compares it to 255. If unequal, 0x0027ea04 stores s4 directly to Spark+3, named particle_mode in authoritative C. The 255 sentinel instead derives that member as 0x48/0x44 from kind bit 0 at 0x0027e9d8-0x0027ea00. Original Ghidra param_14 has the same sentinel/direct-store branches. Thus this parameter optionally overrides the kind-derived particle mode, rather than naming a broader control mode. --- src/overlays/l01/mobys/create_spark_particle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l01/mobys/create_spark_particle.c b/src/overlays/l01/mobys/create_spark_particle.c index 21424d330d..3e789804b1 100644 --- a/src/overlays/l01/mobys/create_spark_particle.c +++ b/src/overlays/l01/mobys/create_spark_particle.c @@ -60,7 +60,7 @@ void create_spark_particle(s32 id, s32 life, u8 kind, u8 texture_table_index, - u8 mode, + u8 particle_mode_override, f32 x, f32 y, f32 z, @@ -88,7 +88,7 @@ void create_spark_particle(s32 id, } spark_body = &spark->body; qcopy(&spark->pos, position_copy_source); - if (mode == SPARK_MODE_FROM_KIND) { + if (particle_mode_override == SPARK_MODE_FROM_KIND) { spark->b9 = (kind >> 5) * 16 + truncate_float_to_s32(4.0f); if (kind & 1) { spark->particle_mode = 0x48; @@ -97,7 +97,7 @@ void create_spark_particle(s32 id, } } else { spark->b9 = kind; - spark->particle_mode = mode; + spark->particle_mode = particle_mode_override; } spark->b1 = 0; spark->texture_id = *spark_texture_table[texture_table_index]; From 0ab53f052f90e063e94d4d29c150057d666132bb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:23:37 +0000 Subject: [PATCH 313/657] decomp: clarify names in spawn_lightning_arc_particle_pairs id -> particle_lifetime_frames: At 0x002ee7bc a0 is set to 0x3c and 0x002ee7c4 calls scale_game_frames; its v0 return is passed in a1 at 0x002ee7e0 to particle helper 0x002ee7fc. Authoritative C stores this return in id. Supplied FUN_L00_00272060 context identifies this argument as lifetime_frames and writes it to particle+0xA and particle_data+8. Original Ghidra uVar3 follows the same scale-call-to-helper flow. --- src/overlays/l14/mobys/path_lightning_controller.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l14/mobys/path_lightning_controller.c b/src/overlays/l14/mobys/path_lightning_controller.c index 17a73ad36a..eff90685d1 100644 --- a/src/overlays/l14/mobys/path_lightning_controller.c +++ b/src/overlays/l14/mobys/path_lightning_controller.c @@ -610,7 +610,7 @@ void spawn_lightning_arc_particle_pairs(float *particle_spawn_position, int spaw float initial_velocity[4]; float saved_position[4]; float particle_scale, velocity_horizontal_angle, velocity_vertical_angle; - int random_sign, r0, i, id; + int random_sign, r0, i, particle_lifetime_frames; unsigned char *particle; if (spawn_pair_count > 0) { i = spawn_pair_count; @@ -633,9 +633,9 @@ void spawn_lightning_arc_particle_pairs(float *particle_spawn_position, int spaw particle_spawn_position[0] += randf_sym(0.0f, 0.15f); particle_spawn_position[1] += randf_sym(0.0f, 0.15f); particle_spawn_position[2] += randf_sym(0.0f, 0.15f); - id = scale_game_frames(0x3C); + particle_lifetime_frames = scale_game_frames(0x3C); particle = FUN_L00_00272060(particle_spawn_position, - id, + particle_lifetime_frames, particle_scale * 0.1f, particle_scale, 0x7F7F2020, From 29372d2fd81e11c3e8ae6e981af346198d359ab5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:23:38 +0000 Subject: [PATCH 314/657] decomp: clarify names in find_sentrybot_attention_target id -> candidate_moby_index: Retail 0x00299e58 loads the unsigned 16-bit group_moby_entry; 0x00299e68 masks its low 15 bits into s1, and 0x00299e6c-0x00299e70 shifts by 8 and adds l15_moby_array to address candidate_moby. At 0x00299f20-0x00299f34 the same index selects the candidate position, and 0x00299f94 forms the selected return pointer. Original Ghidra likewise computes (uVar4 & 0x7fff)*0x100 and adds the moby-array base. Thus id is the candidate moby's array index, not its class or state. --- src/overlays/shared/enemies/sentrybot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index d8a234b5dc..7506c34318 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -1393,26 +1393,26 @@ int find_sentrybot_attention_target(char *moby) { line_start[2] += 1.0f; bd = 0.0f; do { - int id = *(unsigned short *)group_moby_entry & 0x7FFF; - char *candidate_moby = (char *)((id << 8) + (int)l15_moby_array); + int candidate_moby_index = *(unsigned short *)group_moby_entry & 0x7FFF; + char *candidate_moby = (char *)((candidate_moby_index << 8) + (int)l15_moby_array); if (MOBY(candidate_moby)->oclass == 0x27B && MOBY(candidate_moby)->state >= 6 && MOBY(candidate_moby)->state < 0x10) { float f = fast_difference_between_rotations( MOBY(moby)->rot.z, fast_arc_tan(MOBY(candidate_moby)->pos.x - MOBY(moby)->pos.x, MOBY(candidate_moby)->pos.y - MOBY(moby)->pos.y)); - unsigned char candidate_state = ((char *)((id << 8) + (int)l15_moby_array))[0x20]; + unsigned char candidate_state = ((char *)((candidate_moby_index << 8) + (int)l15_moby_array))[0x20]; if (candidate_state == 7 || candidate_state == 0xF) moby_data->priority_attention_active = 1; if (moby_data->priority_attention_active != 0 || f < 1.2217305f) { - qcopy(candidate_line_endpoint, (char *)((id << 8) + (int)l15_moby_array) + 0x10); + qcopy(candidate_line_endpoint, (char *)((candidate_moby_index << 8) + (int)l15_moby_array) + 0x10); line_start[2] += 1.0f; if (collision_line(line_start, candidate_line_endpoint, 2, 0, 0) == 0) { float candidate_line_distance = fast_vec_dist(line_start, candidate_line_endpoint); if (best == 0 || candidate_line_distance < bd) { bd = candidate_line_distance; - best = (int)l15_moby_array + (id << 8); + best = (int)l15_moby_array + (candidate_moby_index << 8); } } } From 5a2b429417c9e45a69f349d22fd0b9330ca86b0a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:23:38 +0000 Subject: [PATCH 315/657] decomp: clarify names in upper_door_update id -> moby_save_id: Bound source src/overlays/l04/mobys/upper_door.c SHA-256 6d4e8fe2c8e4740fec2615061325268d97bde530e40b3331cef9b8a39862b4b4 assigns this u16 local directly from moby->save_id, then converts it to save_id_index and uses its low five bits to select the saved activation bit. Retail 0x002e183c loads the unsigned halfword at owner s0+0xB2 into a1; 0x002e1848-0x002e1854 sign-extends it for the collected-byte index; 0x002e1880 masks a1 with 0x1F and 0x002e1888-0x002e1890 shifts/masks the per-level bitset word. Original Ghidra decompilation corroborates the same +0xB2 load and save-bit selection, proving that this is the moby's save ID rather than a trigger index or state. --- src/overlays/l04/mobys/upper_door.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l04/mobys/upper_door.c b/src/overlays/l04/mobys/upper_door.c index 154509b6eb..d54f92a392 100644 --- a/src/overlays/l04/mobys/upper_door.c +++ b/src/overlays/l04/mobys/upper_door.c @@ -61,7 +61,7 @@ void upper_door_update(struct Moby *moby) { struct RiserVars *riser_vars = (struct RiserVars *)moby->pvars; struct Moby *trigger_moby; s16 save_id_index; - u16 id; + u16 moby_save_id; switch (moby->state) { case UPPER_DOOR_INITIALIZE: @@ -69,10 +69,10 @@ void upper_door_update(struct Moby *moby) { moby->state = UPPER_DOOR_WAIT_FOR_ACTIVATION; break; case UPPER_DOOR_WAIT_FOR_ACTIVATION: - id = moby->save_id; - save_id_index = id; + moby_save_id = moby->save_id; + save_id_index = moby_save_id; if (l04_save_id_collection_state.collected[save_id_index] == 0 && - !((D_0014C190_257218[current_level_index][save_id_index >> 5] >> (id & 0x1F)) & 1)) { + !((D_0014C190_257218[current_level_index][save_id_index >> 5] >> (moby_save_id & 0x1F)) & 1)) { if (riser_vars->trigger == -1) break; trigger_moby = (struct Moby *)((riser_vars->trigger << 8) + D_L04_0015FFD8); From 537f0a81dcedd5ab97ca1d25eb5d027994b1d4e9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:23:38 +0000 Subject: [PATCH 316/657] decomp: clarify names in update_robot_dog_glow_effects mode -> glow_pulse_mode: Authoritative update_robot_dog_glow_effects assigns mode from ROBOT_DOG_GLOW_MODE_* members. Original Ghidra iVar8 and retail s2 are initialized to 0 at 0x002f0264, set to 1/2/-1 at 0x002f0288/0x002f0290/0x002f0294. At 0x002f0298 negative suppresses the effect; 0x002f02a0-0x002f02c0 selects scaled 0x32 or 0x5A frames versus default 0xAA. At 0x002f0374-0x002f03c0 the same selector controls pulse-color packing, which is tweened into moby->glow_color at 0x002f03d0-0x002f03d8. Thus it is a derived glow pulse mode, separate from the Moby.state byte read at 0x002f0250. --- src/overlays/l17/mobys/robot_dog.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/l17/mobys/robot_dog.c b/src/overlays/l17/mobys/robot_dog.c index d9209b3e04..bdc010b8f9 100644 --- a/src/overlays/l17/mobys/robot_dog.c +++ b/src/overlays/l17/mobys/robot_dog.c @@ -788,7 +788,7 @@ void update_robot_dog_glow_effects(struct Moby *moby) { char *robot_dog_glow_vars; int glow_pulse_period_frames; int alpha; - int mode; + int glow_pulse_mode; int i; int x, y, z; int r, g, b; @@ -810,12 +810,12 @@ void update_robot_dog_glow_effects(struct Moby *moby) { robot_dog_glow_vars = (char *)moby->pvars; glow_pulse_period_frames = scale_game_frames(glow_pulse_period_frames); alpha = 0x80; - mode = ROBOT_DOG_GLOW_MODE_SLOW_PULSE; + glow_pulse_mode = ROBOT_DOG_GLOW_MODE_SLOW_PULSE; switch (moby->state) { case ROBOT_DOG_STATE_FALL_UNTIL_LANDING: case ROBOT_DOG_STATE_TRACK_TARGET_FACING: case ROBOT_DOG_STATE_WAIT_FOR_CHASE_TRIGGER: - mode = ROBOT_DOG_GLOW_MODE_MEDIUM_PULSE; + glow_pulse_mode = ROBOT_DOG_GLOW_MODE_MEDIUM_PULSE; break; case ROBOT_DOG_STATE_WAIT_FOR_CHASE_TRIGGER_FAST_PULSE: case ROBOT_DOG_STATE_TURN_TOWARD_TARGET: @@ -825,16 +825,16 @@ void update_robot_dog_glow_effects(struct Moby *moby) { case 13: case 14: case ROBOT_DOG_STATE_FALL_THEN_REMOVE: - mode = ROBOT_DOG_GLOW_MODE_FAST_PULSE; + glow_pulse_mode = ROBOT_DOG_GLOW_MODE_FAST_PULSE; break; case ROBOT_DOG_STATE_RECOVER_THEN_REINITIALIZE: - mode = -1; + glow_pulse_mode = -1; break; } - if (mode >= ROBOT_DOG_GLOW_MODE_SLOW_PULSE) { - if (mode == ROBOT_DOG_GLOW_MODE_FAST_PULSE) { + if (glow_pulse_mode >= ROBOT_DOG_GLOW_MODE_SLOW_PULSE) { + if (glow_pulse_mode == ROBOT_DOG_GLOW_MODE_FAST_PULSE) { glow_pulse_period_frames = scale_game_frames(0x32); - } else if (mode == ROBOT_DOG_GLOW_MODE_MEDIUM_PULSE) { + } else if (glow_pulse_mode == ROBOT_DOG_GLOW_MODE_MEDIUM_PULSE) { glow_pulse_period_frames = scale_game_frames(0x5A); } glow_pulse_sine = fast_sin(((float)(D_L17_0015F5CC % glow_pulse_period_frames) / @@ -853,9 +853,9 @@ void update_robot_dog_glow_effects(struct Moby *moby) { if (g > 255) { g = 255; } - if (mode == ROBOT_DOG_GLOW_MODE_FAST_PULSE) { + if (glow_pulse_mode == ROBOT_DOG_GLOW_MODE_FAST_PULSE) { color = (alpha << 24) | (b << 16) | ((r / 2) << 8) | g; - } else if (mode != ROBOT_DOG_GLOW_MODE_SLOW_PULSE) { + } else if (glow_pulse_mode != ROBOT_DOG_GLOW_MODE_SLOW_PULSE) { color = (alpha << 24) | (b << 16) | ((r / 2) << 8) | g; } else { color = (alpha << 24) | (b << 16) | (g << 8) | r; From 19bddebcec2ff274a364a2dd1fe33d44d5bf296a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:25:33 +0000 Subject: [PATCH 317/657] decomp: clarify names in hero_get_state_aim_pitch mode -> animation_id: Source update_hero_item_slot_blends passes hero_blend_owner->moby->prev_seq to this first parameter. Bounded retail caller FUN_0020dd20 at call 0x0020dfec likewise passes the byte at moby +0x53: FUN_0020d5d0(*(undefined1 *)(iRam001413d0 + 0x53), &fStack_d0). Retail callee 0x0020d5d0 subtracts 0x1C from a0, bounds that biased animation ID at 0x0020d5d4, and indexes the jump table at 0x0020d5e4..0x0020d5f4. Thus this integer selects the moby animation sequence whose aim-pitch override is queried; animation_id specifies the proven domain. --- src/overlays/shared/hero/hero_switch_item.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index a3561bdfe2..318b4f80c3 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -503,10 +503,10 @@ s32 resolve_moby_animation_id(u8 *moby_bytes, s32 animation_id) { int hero_get_state_aim_pitch(int mode, float *out) __asm__("FUN_L00_0020d5d0"); -int hero_get_state_aim_pitch(int mode, float *aim_pitch_output) { +int hero_get_state_aim_pitch(int animation_id, float *aim_pitch_output) { int i; *aim_pitch_output = 0.0f; - i = mode - 0x1C; + i = animation_id - 0x1C; switch (i) { case 27: *aim_pitch_output = -0.9599311f; From 199929a2a2f984154b8bddacee6f1c67a5049bef Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:27:26 +0000 Subject: [PATCH 318/657] decomp: clarify names in update_sand_mouse_targeted_spawning state -> sand_mouse_instance_vars: The supplied sand_mouse_update source loads Data *sand_mouse_vars from moby->pvars and passes that pointer as this function's second argument. Original Ghidra param_2 and retail 0x002e35b4 retain a1 in s2; 0x002e35c4 addresses its +0x4E cooldown, 0x002e365c stores the selected target at +0x68, 0x002e37ec-0x002e37fc increments its +0x64 count, and 0x002e37f0 resets the +0x4E timer. These offsets match the supplied Data instance-variable layout (s4E, count, tgt). Thus the char * parameter is the sand mouse instance variable record, not moby->state or a cutscene mode. --- src/overlays/shared/enemies/sand_mouse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/enemies/sand_mouse.c b/src/overlays/shared/enemies/sand_mouse.c index 8c7cf85bbf..b6ac28b50b 100644 --- a/src/overlays/shared/enemies/sand_mouse.c +++ b/src/overlays/shared/enemies/sand_mouse.c @@ -281,14 +281,14 @@ void *select_sand_mouse_spawn_target(void *moby, void update_sand_mouse_targeted_spawning(char *moby, char *state) __asm__("FUN_L01_002e35a8"); -void update_sand_mouse_targeted_spawning(char *moby, char *state) { +void update_sand_mouse_targeted_spawning(char *moby, char *sand_mouse_instance_vars) { V4_w22c spawn_position; V4_w22c target_aim_position; V4_w22c spawn_offset; char *target_moby; float aim_yaw, aim_pitch, initial_yaw, initial_pitch, target_yaw, spawn_to_target_distance; - if (fast_dec_timer_s16(state + 0x4E) == 0) + if (fast_dec_timer_s16(sand_mouse_instance_vars + 0x4E) == 0) return; qzero(&spawn_position); fast_vec_add(&spawn_position, &spawn_position, &MOBY(moby)->pos); @@ -304,7 +304,7 @@ void update_sand_mouse_targeted_spawning(char *moby, char *state) { 3.1415927f, 3.1415927f); if (target_moby != 0) { - *(char **)(state + 0x68) = target_moby; + *(char **)(sand_mouse_instance_vars + 0x68) = target_moby; if (hero.motion.pos.f[2] + 1.1f < MOBY(moby)->pos.z) { target_yaw = fast_arc_tan(MOBY(target_moby)->pos.x - MOBY(moby)->pos.x, MOBY(target_moby)->pos.y - MOBY(moby)->pos.y); @@ -339,14 +339,14 @@ void update_sand_mouse_targeted_spawning(char *moby, char *state) { target_aim_position.f[2] - spawn_position.f[2]); spawn_sandmouse_projectile( moby, &spawn_position, aim_yaw, aim_pitch, initial_yaw, initial_pitch); - *(short *)(state + 0x4E) = + *(short *)(sand_mouse_instance_vars + 0x4E) = scale_game_frames(sand_mouse_projectile_spawn_interval_frames_gp); - *(int *)(state + 0x64) = *(int *)(state + 0x64) + 1; + *(int *)(sand_mouse_instance_vars + 0x64) = *(int *)(sand_mouse_instance_vars + 0x64) + 1; } } } } else { - *(int *)(state + 0x68) = 0; + *(int *)(sand_mouse_instance_vars + 0x68) = 0; } } From 5ab3e86c83657b5e17575c3e53f910cd1c1ae9e7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:29:28 +0000 Subject: [PATCH 319/657] decomp: clarify names in FUN_L00_00257470 flags -> bolt_drop_flags: Retail 00257484 preserves parameter a1 in s2. The masks at 0025766c (0x100), 00257684 (0x200), 002576d8 (0x400) and 002576f0 (0x800) exclusively select or OR bits into s0, which 00257798 passes as a3 to 00260a88 at 0025779c. The authoritative C identifies that callee as spawn_randomized_bolt_drop and shows the same flags-to-call_flags construction; original Ghidra param_2/uVar7 confirms it. Thus this parameter controls bolt-drop flags rather than unrelated moby fields. --- src/overlays/shared/mobys/evaluate_moby_animation_pose.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/mobys/evaluate_moby_animation_pose.c b/src/overlays/shared/mobys/evaluate_moby_animation_pose.c index fd30eb463f..849d55cdfb 100644 --- a/src/overlays/shared/mobys/evaluate_moby_animation_pose.c +++ b/src/overlays/shared/mobys/evaluate_moby_animation_pose.c @@ -110,7 +110,7 @@ extern int D_L00_001BA4D0_lui[] __asm__("D_L00_001BA4D0") NOT_SDA; extern struct Hero hero_lui __asm__("D_0013F350") NOT_SDA; void FUN_L00_00257470(unsigned char *m, int flags, int arg); -void FUN_L00_00257470(unsigned char *moby, int flags, int trajectory_target_index) { +void FUN_L00_00257470(unsigned char *moby, int bolt_drop_flags, int trajectory_target_index) { float amt; int lvl; int k; @@ -161,7 +161,7 @@ void FUN_L00_00257470(unsigned char *moby, int flags, int trajectory_target_inde debug_print(D_L00_001E8F28, truncate_float_to_s32(amt)); } call_flags = 1; - if (flags & 0x100) { + if (bolt_drop_flags & 0x100) { call_flags = 5; } if (hero_lui.on_hoverboard || (flags & 0x200)) { @@ -172,10 +172,10 @@ void FUN_L00_00257470(unsigned char *moby, int flags, int trajectory_target_inde call_flags |= 2; } cnt = D_L00_0015FFBC; - if (flags & 0x400) { + if (bolt_drop_flags & 0x400) { call_flags |= 0x10; } - if (cnt < 100 || (flags & 0x800)) { + if (cnt < 100 || (bolt_drop_flags & 0x800)) { call_flags |= 8; } if (D_L00_0015FFBC < 50) { From 59cffee200550e36fa655321f1f5b91b132b6562 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:29:28 +0000 Subject: [PATCH 320/657] decomp: clarify names in draw_hero_glow_quads mode -> glow_dispatch_mode: Source assigns this int from D_L00_0015F5C4. Retail 0x00207D48 loads that word into v1; 0x00207D64 and 0x00207D70 compare it with 2 and 6 and route either value to the queued-glow loop at 0x00207D78-0x00207DC8, which then returns. Other values reach the separate hero+0x20A4 vehicle-mode dispatch at 0x00207DDC. Original Ghidra likewise tests DAT_0015f5c4 before its cRam001413f4 branches. This proves a local glow dispatch selector without asserting the global selector's broader domain or individual value identities. --- src/overlays/shared/hero/hero_idle_sequence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 1e050b6e75..9a1abed90e 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -1661,11 +1661,11 @@ void draw_hero_glow_quads(void) { int i; int vehicle_mode; int glow_color; - int mode; + int glow_dispatch_mode; V_207d40 *glow_position_cursor; - mode = D_L00_0015F5C4; - if (mode == 2 || mode == 6) { + glow_dispatch_mode = D_L00_0015F5C4; + if (glow_dispatch_mode == 2 || glow_dispatch_mode == 6) { for (i = 0; i < P.queued_glow_count; i++) draw_offset_textured_effect_quad(&P.queued_glow_positions[i], P.queued_glow_colors[i], From aef6cdf8a2cb3d773a0ab3b520b1a79fa754a40c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:31:21 +0000 Subject: [PATCH 321/657] decomp: clarify names in sceGsSetDefDispEnv mode -> display_mode: Source mode = state->wMode caches the display-mode selector, separate from interlace and nSFrame_mode. Retail 0x00121b5c/0x00121b60 load the +2 halfword, 0x00121bac/0x00121bbc sign-extend it, and 0x00121bc8, 0x00121c7c and 0x00121d8c dispatch DISPLAY packing for 2, 3 and 0x50. The rejection path 0x00121e08 prints the unsupported displaymode diagnostic. Thus this is the display selector, rather than PMODE, SMODE2 or frame mode. state -> video_mode_state: Source declares GsVideoModeState *state and assigns sceGsGetGParam(). Retail 0x00121b14 calls the getter, 0x00121b1c retains its pointer in s1; halfword loads at 0x00121b20 (+2 wMode), 0x00121b78/0x00121b80 (+0 interlace) and 0x00121b8c (+4 frame mode) use this shared video configuration to build SMODE2 and DISPLAY, distinguishing it from the output register block. --- src/sdk/graph/sce_gs_set_def_disp_env.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/sdk/graph/sce_gs_set_def_disp_env.c b/src/sdk/graph/sce_gs_set_def_disp_env.c index a6eb1e876d..d8954b1268 100644 --- a/src/sdk/graph/sce_gs_set_def_disp_env.c +++ b/src/sdk/graph/sce_gs_set_def_disp_env.c @@ -31,9 +31,9 @@ void sceGsSetDefDispEnv(struct sceGsDispEnv *output, enum { GS_FRAME_MODE_FIELD = 0 }; - GsVideoModeState *state; + GsVideoModeState *video_mode_state; s32 kernel_horizontal, kernel_vertical, kernel_width, kernel_height; - s32 mode, scale; + s32 display_mode, scale; s64 scaled_horizontal; u64 display_width; u16 interlace; @@ -50,12 +50,12 @@ void sceGsSetDefDispEnv(struct sceGsDispEnv *output, kernel_vertical = 0; kernel_horizontal = 0; } - mode = state->wMode; - interlace = state->nSInterlace; + display_mode = video_mode_state->wMode; + interlace = video_mode_state->nSInterlace; output->pmode = 0x66; - if (state->nSInterlace != 0) { - if (state->nSFrame_mode == GS_FRAME_MODE_FIELD) + if (video_mode_state->nSInterlace != 0) { + if (video_mode_state->nSFrame_mode == GS_FRAME_MODE_FIELD) output->smode2 = 1; else output->smode2 = 3; @@ -65,7 +65,7 @@ void sceGsSetDefDispEnv(struct sceGsDispEnv *output, output->dispfb = ((u64)(pixel_storage_format & 15) << 15) | ((u64)(((width + 63) >> 6) & 63) << 9); - if ((s16)mode == 2) { + if ((s16)display_mode == 2) { if ((s16)interlace == 1) { s32 scale; u64 value; @@ -76,7 +76,7 @@ void sceGsSetDefDispEnv(struct sceGsDispEnv *output, scaled_horizontal = scaled_horizontal + 0x27c; scaled_horizontal = (scaled_horizontal + horizontal_offset * scale) & 0xfff; value = (u64)(s64)(scale - 1) << 23; - if (state->nSFrame_mode != GS_FRAME_MODE_FIELD) { + if (video_mode_state->nSFrame_mode != GS_FRAME_MODE_FIELD) { display_width = (value | display_width) | ((u64)scaled_horizontal | ((u64)(s64)(height * 2 - 1) << 44)); } else { @@ -96,7 +96,7 @@ void sceGsSetDefDispEnv(struct sceGsDispEnv *output, ((s64)(height - 1) << 44))) | ((s64)((vertical_offset + kernel_vertical + 0x19) & 0xfff) << 12); } - } else if ((s16)mode == 3) { + } else if ((s16)display_mode == 3) { if ((s16)interlace == 1) { s32 scale; u64 value; @@ -107,7 +107,7 @@ void sceGsSetDefDispEnv(struct sceGsDispEnv *output, scaled_horizontal = scaled_horizontal + 0x290; scaled_horizontal = (scaled_horizontal + horizontal_offset * scale) & 0xfff; value = (u64)(s64)(scale - 1) << 23; - if (state->nSFrame_mode != GS_FRAME_MODE_FIELD) { + if (video_mode_state->nSFrame_mode != GS_FRAME_MODE_FIELD) { display_width = (value | display_width) | ((u64)scaled_horizontal | ((u64)(s64)(height * 2 - 1) << 44)); } else { @@ -127,7 +127,7 @@ void sceGsSetDefDispEnv(struct sceGsDispEnv *output, ((s64)(height - 1) << 44))) | ((s64)((vertical_offset + kernel_vertical + 0x24) & 0xfff) << 12); } - } else if ((s16)mode == 0x50) { + } else if ((s16)display_mode == 0x50) { output->display = ((u64)(s64)(height - 1) << 44) | ((u64)((vertical_offset + kernel_vertical + 0x23) & 0xfff) << 12) | 0x800000ULL | From b4acfd70b40ac46775e7049792a0aba43fb1ee61 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:31:21 +0000 Subject: [PATCH 322/657] decomp: clarify names in process_hero_hurt_response id -> hurt_response_state: In the bound source process_hero_hurt_response, id is assigned 0x80 after checking damage_source_moby class 0x4EB or 0x558 and is consumed as hero_set_state(id, 1) at call_ret. Original retail decompilation shows the same conditional state call; decoded instructions 0x00220140-0x00220150 test those classes, 0x00220158 loads a0 with 0x80, and 0x0022015c-0x00220160 call hero_set_state with a1=1. Supplied hero_set_state context copies its requested_state argument into hero.state.current, proving that this scalar selects the hurt-response state rather than identifying a moby or record. --- src/overlays/l02/hero/update_hero_state_motion.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l02/hero/update_hero_state_motion.c b/src/overlays/l02/hero/update_hero_state_motion.c index 1902bf9574..1208b5983b 100644 --- a/src/overlays/l02/hero/update_hero_state_motion.c +++ b/src/overlays/l02/hero/update_hero_state_motion.c @@ -179,7 +179,7 @@ s32 process_hero_hurt_response(s32 apply_hurt_response) { OvlMobyEntry40 *hurt_response_entry; u8 *mob; s32 flag; - s32 id; + s32 hurt_response_state; f32 planar_impulse_scale, vertical_impulse_scale, cached_frame_time; OvlVec4 hurt_impulse; @@ -234,9 +234,9 @@ s32 process_hero_hurt_response(s32 apply_hurt_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - id = 0x80; + hurt_response_state = 0x80; call_ret: - hero_set_state(id, 1); + hero_set_state(hurt_response_state, 1); return 1; } if (G.state.control_mode == 0x16) { From 34560151bea8ef2bd7c8ef0dfc88fb98ff074536 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:31:21 +0000 Subject: [PATCH 323/657] decomp: clarify names in process_hero_hit_reaction id -> hit_reaction_state: Authoritative C assigns id = 0x80 after testing damage_source_moby classes 0x4EB/0x558, then passes id as the first argument to hero_set_state(id, 1). Retail 00222c94-00222ca4 tests those classes; 00222cac loads a0=0x80 and 00222cb0 calls hero_set_state at 0022ff58. Supplied hero_set_state source stores requested_state into hero.state.current. Original retail Ghidra likewise calls func_0x0022ff58(0x80,1) in that incoming-hit branch, proving the requested hit-reaction state role. --- src/overlays/l14/hero/update_hero_motion_by_state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l14/hero/update_hero_motion_by_state.c b/src/overlays/l14/hero/update_hero_motion_by_state.c index 1f590a2c75..0f09b6d366 100644 --- a/src/overlays/l14/hero/update_hero_motion_by_state.c +++ b/src/overlays/l14/hero/update_hero_motion_by_state.c @@ -144,7 +144,7 @@ s32 process_hero_hit_reaction(s32 apply_hit_reaction) { OvlMobyEntry40 *hero_hit_entry; u8 *mob; s32 flag; - s32 id; + s32 hit_reaction_state; f32 horizontal_knockback_scale, vertical_knockback_scale, knockback_scale; OvlVec4 knockback_impulse; @@ -203,9 +203,9 @@ s32 process_hero_hit_reaction(s32 apply_hit_reaction) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - id = 0x80; + hit_reaction_state = 0x80; call_ret: - hero_set_state(id, 1); + hero_set_state(hit_reaction_state, 1); return 1; } if (G.state.control_mode == 0x16) { From 5c172ba7ba1420c32de726755b48e6285f4913c5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:31:22 +0000 Subject: [PATCH 324/657] decomp: clarify names in update_hero_animation_for_movement_speed mode -> vehicle_mode: Source initializes mode from player->vehicle_mode with player=&hero. Retail 00228c30 forms &hero (0013f350), 00228c3c loads its byte at +0x20a4 into a0, and 00228c40/00228c68 compare that same selector with 3 and 1. These branches select speed_xy*54/*90 and anim_speed floors, proving this is the vehicle-mode selector rather than state.step or state.current. --- src/overlays/shared/hero/hero_set_state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index 53592c1d24..ec2f6ba028 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3764,13 +3764,13 @@ void update_hero_animation_for_movement_speed(void) { HERO_SPEED_STEP_HIGH = 1 }; struct Hero *player = &hero; - int mode = player->vehicle_mode; - if (mode == 3) { + int vehicle_mode = player->vehicle_mode; + if (vehicle_mode == 3) { float speed = player->motion.speed_xy * 54.0f; player->anim_speed = speed; if (speed < 0.7f) player->anim_speed = 0.7f; - } else if (mode == HERO_VEHICLE_MODE_CLANK) { + } else if (vehicle_mode == HERO_VEHICLE_MODE_CLANK) { float speed = player->motion.speed_xy * 90.0f; player->anim_speed = speed; if (speed < 0.5f) From 0f4dca8a94e3ea1fd87a1045c66020fd792db9c3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:35:27 +0000 Subject: [PATCH 325/657] decomp: clarify names in resolve_hero_position_with_collision_queries mode -> large_correction_mode: Retail 0x00233950 preserves incoming a0 in s8. After current position minus saved entry position is formed at 0x00233ba4-0x00233bb0 and its length exceeds 1.5*capsule_radius at 0x00233bbc-0x00233bd8, the only use of s8 is comparison with 15 at 0x00233bdc-0x00233be0. That selection enables component clamps to +/-512 and normalization to capsule_radius, followed by adding the correction to the saved entry position at 0x00233be8-0x00233cc8. Other argument values leave the large correction in place; both paths return -1. Thus this parameter selects large-correction handling, without proving its caller enum domain. --- src/overlays/shared/hero/hero_frame_update.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_frame_update.c b/src/overlays/shared/hero/hero_frame_update.c index e419ce729d..ca8e7aa63d 100644 --- a/src/overlays/shared/hero/hero_frame_update.c +++ b/src/overlays/shared/hero/hero_frame_update.c @@ -1349,7 +1349,7 @@ extern s32 coll3_233940(void *, f32) __asm__("FUN_L00_001f3170"); extern u128_233940 D_L01_001742F0[] NOT_SDA; s32 resolve_hero_position_with_collision_queries(s32 mode) __asm__("FUN_L01_00233940"); -s32 resolve_hero_position_with_collision_queries(s32 mode) { +s32 resolve_hero_position_with_collision_queries(s32 large_correction_mode) { V_233940 pre_collision_position; V_233940 collision_query_offset; V_233940 resolved_position_delta; @@ -1416,7 +1416,7 @@ s32 resolve_hero_position_with_collision_queries(s32 mode) { fast_vec_sub(&resolved_position_delta, &hero.motion.pos.q, &pre_collision_position); query_height_or_displacement_length = fast_vec_length(&resolved_position_delta); if (hero.capsule_radius * 1.5f < query_height_or_displacement_length) { - if (mode == 0xF) { + if (large_correction_mode == 0xF) { if (512.0f < resolved_position_delta.f[0]) resolved_position_delta.f[0] = 512.0f; else if (resolved_position_delta.f[0] < -512.0f) From 9f2120310666e88f151b1c862dea92d07dad366e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:37:47 +0000 Subject: [PATCH 326/657] decomp: clarify names in resolve_hero_position_collisions mode -> excess_displacement_mode: Authoritative resolve_hero_position_collisions(s32 mode) and original Ghidra param_1 agree: incoming a0 is preserved in s8 at 0x00240ee0 and used only in the comparison at 0x002411e0. That comparison is reached after 0x002411ac-0x002411d8 computes resolved position minus initial_position, measures its length and detects length greater than capsule_radius * 1.5f. Value 0xF selects component bounding to +/-512 at 0x002411e8-0x002412a4, normalization to capsule_radius at 0x002412b4, and reconstruction of position at 0x002412c4; other values return -1 without that adjustment. Thus this parameter selects handling of excessive resolved displacement, without implying a state or control-mode enum. --- src/overlays/l05/hero/apply_hero_ground_material_effects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l05/hero/apply_hero_ground_material_effects.c b/src/overlays/l05/hero/apply_hero_ground_material_effects.c index 14cbe97012..9e555f1563 100644 --- a/src/overlays/l05/hero/apply_hero_ground_material_effects.c +++ b/src/overlays/l05/hero/apply_hero_ground_material_effects.c @@ -398,7 +398,7 @@ extern s32 FUN_L00_001f3170(void *, f32); extern u128_2133a8 D_L05_00174270[] NOT_SDA; s32 resolve_hero_position_collisions(s32 mode) __asm__("FUN_L05_00240ed0"); -s32 resolve_hero_position_collisions(s32 mode) { +s32 resolve_hero_position_collisions(s32 excess_displacement_mode) { V_2133a8 initial_position; V_2133a8 collision_query_offset; V_2133a8 resolved_displacement; @@ -472,7 +472,7 @@ s32 resolve_hero_position_collisions(s32 mode) { fast_vec_sub(&resolved_displacement, &hero.motion.pos.q, &initial_position); query_height_or_displacement_length = fast_vec_length(&resolved_displacement); if (hero.capsule_radius * 1.5f < query_height_or_displacement_length) { - if (mode == 0xF) { + if (excess_displacement_mode == 0xF) { if (512.0f < resolved_displacement.f[0]) resolved_displacement.f[0] = 512.0f; else if (resolved_displacement.f[0] < -512.0f) From 83c97dc545de525678e25bb2b99e6d0ac26cfc92 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:37:47 +0000 Subject: [PATCH 327/657] decomp: clarify names in process_hero_hit_response id -> hurt_response_state: Bound C declares s32 id once, assigns 0x80 after damage_source_moby class checks 0x4EB/0x558, then passes id as hero_set_state's requested_state argument at call_ret. Original retail Ghidra shows func_0x002356a0(0x80,1); instructions 0x0022807C-0x0022808C test the source class, 0x00228094 loads a0=0x80 and 0x00228098 calls hero_set_state. This proves a hero state requested by the hurt response, without identifying state 0x80's lifecycle. --- .../l06/hero/update_hero_motion_for_current_state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l06/hero/update_hero_motion_for_current_state.c b/src/overlays/l06/hero/update_hero_motion_for_current_state.c index 19b0a8ca96..c2f7382e5b 100644 --- a/src/overlays/l06/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l06/hero/update_hero_motion_for_current_state.c @@ -151,7 +151,7 @@ s32 process_hero_hit_response(s32 apply_hurt_response) { OvlMobyEntry40 *hero_hit_entry; u8 *mob; s32 flag; - s32 id; + s32 hurt_response_state; f32 horizontal_hurt_impulse_scale, vertical_hurt_impulse_scale, hurt_impulse_scale; OvlVec4 hurt_impulse; @@ -210,9 +210,9 @@ s32 process_hero_hit_response(s32 apply_hurt_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - id = 0x80; + hurt_response_state = 0x80; call_ret: - hero_set_state(id, 1); + hero_set_state(hurt_response_state, 1); return 1; } if (G.state.control_mode == 0x16) { From fee03dbc258cea490d0242106ac53a4442a82d5e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:37:47 +0000 Subject: [PATCH 328/657] decomp: clarify names in resolve_hero_position_collisions mode -> displacement_limit_mode: Retail 0x0022a1e0 saves incoming a0 in s8. Its only subsequent use is the comparison with 15 at 0x0022a460-0x0022a464, after displacement length exceeds capsule_radius * 1.5 at 0x0022a430-0x0022a454. Equality enables component clamps to +/-512 at 0x0022a46c-0x0022a528, normalization of position_displacement to capsule_radius at 0x0022a538, and reconstruction from pre_collision_position at 0x0022a548. Original Ghidra param_1 == 0xf and the bound C mode == 0xF corroborate that this parameter selects displacement limiting, without proving a broader enum domain. --- .../shared/hero/update_hero_vehicle_attachments_and_effects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/update_hero_vehicle_attachments_and_effects.c b/src/overlays/shared/hero/update_hero_vehicle_attachments_and_effects.c index 5fc0f75dcc..b7ba9decc0 100644 --- a/src/overlays/shared/hero/update_hero_vehicle_attachments_and_effects.c +++ b/src/overlays/shared/hero/update_hero_vehicle_attachments_and_effects.c @@ -575,7 +575,7 @@ extern s32 rig_probe(void *, s32, f32, s32, f32) __asm__("FUN_L00_001f19a0"); extern s32 coll3_22a1d0(void *, f32) __asm__("FUN_L00_001f3170"); s32 resolve_hero_position_collisions(s32 mode) __asm__("FUN_L06_0022a1d0"); -s32 resolve_hero_position_collisions(s32 mode) { +s32 resolve_hero_position_collisions(s32 displacement_limit_mode) { V_22a1d0 pre_collision_position; V_22a1d0 collision_query_offset; V_22a1d0 position_displacement; @@ -641,7 +641,7 @@ s32 resolve_hero_position_collisions(s32 mode) { fast_vec_sub(&position_displacement, &hero.motion.pos.q, &pre_collision_position); query_height_or_displacement_length = fast_vec_length(&position_displacement); if (hero.capsule_radius * 1.5f < query_height_or_displacement_length) { - if (mode == 0xF) { + if (displacement_limit_mode == 0xF) { if (512.0f < position_displacement.f[0]) position_displacement.f[0] = 512.0f; else if (position_displacement.f[0] < -512.0f) From 5b7c4e25eb34fdd2cf4ff843983de8fbba99b5c6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:39:33 +0000 Subject: [PATCH 329/657] decomp: clarify names in handle_hero_hit id -> hit_response_state: In source snapshot 9f5fdbd588605c5621a789a16599bf66b3c373b4da6f3cd2e2ad7e2366c9444d, id is assigned 0x80 or 0x82 on damage-source class branches and consumed only by hero_set_state(id, 1) at call_ret. Retail 00222a04 loads a0=0x80; 00222a78, 00222aac and 00222b28 select a0=0x82 and converge on 00222a08 jal 00230b38 with a1=1. Original Ghidra uVar6 similarly feeds func_0x00230b38 at LAB_00222a08. This proves the local selects the hero state entered in response to the hit. --- src/overlays/shared/hero/handle_hero_hit.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/hero/handle_hero_hit.c b/src/overlays/shared/hero/handle_hero_hit.c index 52c9520502..e2c2fa516d 100644 --- a/src/overlays/shared/hero/handle_hero_hit.c +++ b/src/overlays/shared/hero/handle_hero_hit.c @@ -29,7 +29,7 @@ s32 handle_hero_hit(s32 apply_response) { OvlMobyEntry40 *hero_moby_entry; u8 *mob; s32 flag; - s32 id; + s32 hit_response_state; f32 xy_response_scale, z_response_amount, frame_time_scale; OvlVec4 response_vector; @@ -88,9 +88,9 @@ s32 handle_hero_hit(s32 apply_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - id = 0x80; + hit_response_state = 0x80; call_ret: - hero_set_state(id, 1); + hero_set_state(hit_response_state, 1); return 1; } if (G.state.control_mode == 0x16) { @@ -101,14 +101,14 @@ s32 handle_hero_hit(s32 apply_response) { if (G.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + hit_response_state = 0x82; goto call_ret; } hero_set_state(0x75, 1); } else if (G.state.control_mode == HERO_MODE_SWIM) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + hit_response_state = 0x82; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -122,7 +122,7 @@ s32 handle_hero_hit(s32 apply_response) { } else if (G.state.control_mode == HERO_MODE_LEDGE) { mob = (u8 *)G.damage_source_moby; if (mob != 0) { - id = 0x82; + hit_response_state = 0x82; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From d8b87a0b2fa33c6c46285f523fc96ab14bb49743 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:39:33 +0000 Subject: [PATCH 330/657] decomp: clarify names in resolve_hero_position_collisions mode -> correction_limit_mode: Retail 0x00210b70 preserves incoming a0 in s8. Its only subsequent use is comparison with 15 at 0x00210e94 after 0x00210e60-0x00210e84 computes resolved minus pre-collision position length and tests it against capsule_radius * 1.5. The selected branch 0x00210e9c-0x00210f58 clamps correction components to +/-512; 0x00210f64-0x00210f7c normalizes that correction to capsule_radius and reconstructs position from pre_collision_position. Thus the parameter selects correction limiting, independently of the separately loaded hero.state.control_mode; no caller or state-enum identity is assumed. --- src/overlays/l16/hero/apply_hero_ground_material_effects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l16/hero/apply_hero_ground_material_effects.c b/src/overlays/l16/hero/apply_hero_ground_material_effects.c index fceb8ce17c..549b602c39 100644 --- a/src/overlays/l16/hero/apply_hero_ground_material_effects.c +++ b/src/overlays/l16/hero/apply_hero_ground_material_effects.c @@ -407,7 +407,7 @@ extern s32 FUN_L00_001f3170(void *, f32); extern u128_2133a8 D_L16_00174270[] NOT_SDA; s32 resolve_hero_position_collisions(s32 mode) __asm__("FUN_L16_00210b60"); -s32 resolve_hero_position_collisions(s32 mode) { +s32 resolve_hero_position_collisions(s32 correction_limit_mode) { V_2133a8 pre_collision_position; V_2133a8 collision_position_offset; V_2133a8 resolved_position_delta; @@ -484,7 +484,7 @@ s32 resolve_hero_position_collisions(s32 mode) { fast_vec_sub(&resolved_position_delta, &hero.motion.pos.q, &pre_collision_position); collision_extent_or_displacement_length = fast_vec_length(&resolved_position_delta); if (hero.capsule_radius * 1.5f < collision_extent_or_displacement_length) { - if (mode == 0xF) { + if (correction_limit_mode == 0xF) { if (512.0f < resolved_position_delta.f[0]) resolved_position_delta.f[0] = 512.0f; else if (resolved_position_delta.f[0] < -512.0f) From a0a7dbbee11027deaa0df92997d85763cf61a4c5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:39:33 +0000 Subject: [PATCH 331/657] decomp: clarify names in resolve_hero_position_collisions mode -> excessive_correction_mode: In the authoritative s32 resolve_hero_position_collisions(s32 mode), the parameter is used only inside the branch where corrected_displacement length exceeds hero.capsule_radius * 1.5f. Retail 0x00222280 saves incoming a0 in s8; 0x0022249c-0x002224c8 computes corrected minus entry position, measures it and tests that threshold. At 0x002224d8 s8 is compared with 15 to select component clamping at 0x002224e0-0x0022259c, normalization to capsule radius at 0x002225a4-0x002225b0, and reconstruction from entry position at 0x002225b4-0x002225c0. Other selector values retain the excessive correction and return -1. This proves selection of excessive correction handling without claiming a HeroStateId domain. --- src/overlays/l02/hero/update_hero_state_motion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l02/hero/update_hero_state_motion.c b/src/overlays/l02/hero/update_hero_state_motion.c index 1208b5983b..522e7a6168 100644 --- a/src/overlays/l02/hero/update_hero_state_motion.c +++ b/src/overlays/l02/hero/update_hero_state_motion.c @@ -576,7 +576,7 @@ extern s32 coll3_222270(void *, f32) __asm__("FUN_L00_001f3170"); extern u128_222270 D_L02_00174470[] NOT_SDA; s32 resolve_hero_position_collisions(s32 mode) __asm__("FUN_L02_00222270"); -s32 resolve_hero_position_collisions(s32 mode) { +s32 resolve_hero_position_collisions(s32 excessive_correction_mode) { V_222270 pre_collision_position; V_222270 collision_probe_offset; V_222270 corrected_displacement; @@ -640,7 +640,7 @@ s32 resolve_hero_position_collisions(s32 mode) { fast_vec_sub(&corrected_displacement, &hero.motion.pos.q, &pre_collision_position); probe_height_or_displacement_length = fast_vec_length(&corrected_displacement); if (hero.capsule_radius * 1.5f < probe_height_or_displacement_length) { - if (mode == 0xF) { + if (excessive_correction_mode == 0xF) { if (512.0f < corrected_displacement.f[0]) corrected_displacement.f[0] = 512.0f; else if (corrected_displacement.f[0] < -512.0f) From 1cb17a1cb8e70639001fa42d6e8d65c1392dde2d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:41:20 +0000 Subject: [PATCH 332/657] decomp: clarify names in process_hero_hit_response id -> hit_response_state: In the SHA-256-bound source, id is assigned only 0x80 or 0x82 in hit-response branches and consumed by hero_set_state(id, 1) at call_ret. Retail 0x0020de08 loads a0=0x80 and 0x0020de0c calls hero_set_state (0x0021e530); branches at 0x0020de78/0x0020de7c, 0x0020deac/0x0020deb0 and 0x0020df28/0x0020df2c converge on the same call with a0=0x82. The original decompilation shows the equivalent uVar6 state selection and LAB_0020de0c call. --- src/overlays/l17/hero/process_hero_hit_response.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l17/hero/process_hero_hit_response.c b/src/overlays/l17/hero/process_hero_hit_response.c index 374703d586..6cc1d6ed85 100644 --- a/src/overlays/l17/hero/process_hero_hit_response.c +++ b/src/overlays/l17/hero/process_hero_hit_response.c @@ -81,7 +81,7 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { OvlMobyEntry40 *hero_moby_entry; u8 *mob; s32 flag; - s32 id; + s32 hit_response_state; f32 xy_scale, z_response, frame_duration; OvlVec4 motion_delta; @@ -140,9 +140,9 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - id = 0x80; + hit_response_state = 0x80; call_ret: - hero_set_state(id, 1); + hero_set_state(hit_response_state, 1); return 1; } if (G.state.control_mode == 0x16) { @@ -153,14 +153,14 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { if (G.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + hit_response_state = 0x82; goto call_ret; } hero_set_state(0x75, 1); } else if (G.state.control_mode == HERO_MODE_SWIM) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + hit_response_state = 0x82; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -174,7 +174,7 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { } else if (G.state.control_mode == HERO_MODE_LEDGE) { mob = (u8 *)G.damage_source_moby; if (mob != 0) { - id = 0x82; + hit_response_state = 0x82; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From 34a406f7efd8bb7aacce45ced341232f6954a0fc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:43:03 +0000 Subject: [PATCH 333/657] decomp: clarify names in update_hero_target_tracking mode -> control_mode: In SHA-bound src/overlays/shared/hero/hero_idle_sequence.c (409a218bb8f68c22cde37b55f73ab6e9e8a4ab4a2e6c23974ffd729a0d894389), mode loads *(int *)(hero_control_mode_owner + 0x208C), with hero_control_mode_owner = hero_pos - 0x80. Retail 0x0020aca4 forms hero base 0x0013f350 and 0x0020acdc loads a0 from +0x208c (0x001413dc); 0x0020ace0-0x0020ad04 compare that loaded selector against 1,4,2,7,0, otherwise 0x0020ad10 clears tracked target +0x2274. Original Ghidra decompilation shows the same iRam001413dc gate. Supplied typed hero source identifies +0x208c as state.control_mode, separately from current-state +0x2084, proving control_mode describes this local's domain. --- src/overlays/shared/hero/hero_idle_sequence.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 9a1abed90e..b1d79add4a 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -3070,8 +3070,8 @@ void update_hero_target_tracking(void) { char *selected_moby; struct HeroEase *manipulator_table; float yaw_delta, pitch, s; - int mode = *(int *)(hero_control_mode_owner + 0x208C); - if (mode != 1 && mode != 4 && mode != 2 && mode != 7 && mode != 0) { + int control_mode = *(int *)(hero_control_mode_owner + 0x208C); + if (control_mode != 1 && control_mode != 4 && control_mode != 2 && control_mode != 7 && control_mode != 0) { *(int *)(hero_control_mode_owner + 0x2274) = 0; return; } From 565c558b350af1c8876fd56c5ea59b461063d596 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:44:51 +0000 Subject: [PATCH 334/657] decomp: clarify names in process_hero_hit_response id -> hit_response_state: Bound source src/overlays/shared/hero/hero_frame_update.c SHA-256 1899428edbfb6a267cc666800fdea4c32f568f409c1077d1a2f7f5c3652b7db7 declares id once and assigns 0x80/0x82 before the shared call_ret label invokes l01_hero_set_state(id, 1) and returns success. Retail 0x00231768 loads a0=0x80 and 0x0023176c calls 0x0023cf98; 0x002317d8-0x002317dc, 0x0023180c-0x00231810 and 0x00231888-0x0023188c route a0=0x82 to that same call. Original Ghidra uVar5 and LAB_0023176c corroborate the requested hero state selected by damage-source class checks. --- src/overlays/shared/hero/hero_frame_update.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/hero/hero_frame_update.c b/src/overlays/shared/hero/hero_frame_update.c index ca8e7aa63d..f0fc13bbca 100644 --- a/src/overlays/shared/hero/hero_frame_update.c +++ b/src/overlays/shared/hero/hero_frame_update.c @@ -838,7 +838,7 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { OvlMobyEntry40 *hero_moby_entry; u8 *mob; s32 flag; - s32 id; + s32 hit_response_state; f32 horizontal_scale, vertical_amount, cached_frame_time; OvlVec4 motion_delta; @@ -893,9 +893,9 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - id = 0x80; + hit_response_state = 0x80; call_ret: - l01_hero_set_state(id, 1); + l01_hero_set_state(hit_response_state, 1); return 1; } if (G.state.control_mode == 0x16) { @@ -906,14 +906,14 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { if (G.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + hit_response_state = 0x82; goto call_ret; } l01_hero_set_state(0x75, 1); } else if (G.state.control_mode == HERO_MODE_SWIM) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + hit_response_state = 0x82; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -927,7 +927,7 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { } else if (G.state.control_mode == HERO_MODE_LEDGE) { mob = (u8 *)G.damage_source_moby; if (mob != 0) { - id = 0x82; + hit_response_state = 0x82; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From d2e303e88475758ea1465cfe1c22c2e22c986453 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:48:42 +0000 Subject: [PATCH 335/657] decomp: clarify names in process_hero_incoming_hit id -> hit_reaction_state: The single s32 id binding is assigned 0x80 for damage-source classes 0x4EB/0x558 and 0x82 for class 0x28F, then passed only as hero_set_state(id, 1) at call_ret before returning 1. Retail 00209064 loads a0=0x80; 002090d4-002090d8, 00209108-0020910c and 00209184-00209188 route a0=0x82 to the same 00209068 hero_set_state call. Original Ghidra uVar7/LAB_00209068 confirms the selected incoming-hit reaction state role. --- .../l15/hero/update_hero_motion_for_current_state.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l15/hero/update_hero_motion_for_current_state.c b/src/overlays/l15/hero/update_hero_motion_for_current_state.c index 7b504c9cb9..6bf5843430 100644 --- a/src/overlays/l15/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l15/hero/update_hero_motion_for_current_state.c @@ -200,7 +200,7 @@ s32 process_hero_incoming_hit(s32 apply_hit_reaction) { T_210ce8 *incoming_hit_record; u8 *mob; s32 flag; - s32 id; + s32 hit_reaction_state; f32 horizontal_knockback_scale, vertical_knockback_scale, knockback_scale_factor; V_210ce8 knockback_vector; @@ -267,9 +267,9 @@ s32 process_hero_incoming_hit(s32 apply_hit_reaction) { case HERO_VEHICLE_MODE_ON_FOOT: mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - id = 0x80; + hit_reaction_state = 0x80; call_ret: - hero_set_state(id, 1); + hero_set_state(hit_reaction_state, 1); return 1; } if (hero.state.control_mode == 0x16) { @@ -280,14 +280,14 @@ s32 process_hero_incoming_hit(s32 apply_hit_reaction) { if (hero.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + hit_reaction_state = 0x82; goto call_ret; } hero_set_state(0x75, 1); } else if (hero.state.control_mode == HERO_MODE_SWIM) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + hit_reaction_state = 0x82; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -301,7 +301,7 @@ s32 process_hero_incoming_hit(s32 apply_hit_reaction) { } else if (hero.state.control_mode == HERO_MODE_LEDGE) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0) { - id = 0x82; + hit_reaction_state = 0x82; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From 9608a1cd14e1d083e358506e8e17d02ef4ea18f1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:48:42 +0000 Subject: [PATCH 336/657] decomp: clarify names in process_hero_hurt_response id -> hurt_response_state: In the authoritative source id is assigned 0x80 for damage-source moby classes 0x4EB/0x558 and 0x82 for class 0x28F, then used only as hero_set_state(id, 1) at call_ret. Retail 0x00218d04 loads a0=0x80, while 0x00218d78, 0x00218dac and 0x00218e28 load a0=0x82 and branch to the shared hero_set_state call at 0x00218d08. The supplied hero_set_state source establishes its first argument as requested_state, stored into hero.state.current. Thus this local selects the hero state for a special hurt response, rather than identifying a moby or vehicle. --- .../l18/hero/apply_hero_ground_type_effects.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l18/hero/apply_hero_ground_type_effects.c b/src/overlays/l18/hero/apply_hero_ground_type_effects.c index ac21447ab1..872b29401d 100644 --- a/src/overlays/l18/hero/apply_hero_ground_type_effects.c +++ b/src/overlays/l18/hero/apply_hero_ground_type_effects.c @@ -189,7 +189,7 @@ s32 process_hero_hurt_response(s32 apply_hurt_response) { T_210ce8 *response_record; u8 *mob; s32 flag; - s32 id; + s32 hurt_response_state; f32 horizontal_response_scale, vertical_response_scale, response_frame_time; V_210ce8 response_motion_delta; @@ -258,9 +258,9 @@ s32 process_hero_hurt_response(s32 apply_hurt_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - id = 0x80; + hurt_response_state = 0x80; call_ret: - hero_set_state(id, 1); + hero_set_state(hurt_response_state, 1); return 1; } if (hero.state.control_mode == 0x16) { @@ -271,14 +271,14 @@ s32 process_hero_hurt_response(s32 apply_hurt_response) { if (hero.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + hurt_response_state = 0x82; goto call_ret; } hero_set_state(0x75, 1); } else if (hero.state.control_mode == HERO_MODE_SWIM) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + hurt_response_state = 0x82; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -292,7 +292,7 @@ s32 process_hero_hurt_response(s32 apply_hurt_response) { } else if (hero.state.control_mode == HERO_MODE_LEDGE) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0) { - id = 0x82; + hurt_response_state = 0x82; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From 8083017b24318f8bb0be3d8c9c24144963d5a5ca Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:50:32 +0000 Subject: [PATCH 337/657] decomp: clarify names in hero_check_damage id -> damage_response_state: Authoritative C assigns id=0x80 for damage source classes 0x4EB/0x558 and id=0x82 for class 0x28F paths, then passes id as the first argument of hero_set_state(id,1) at call_ret and returns 1. Retail 0x00210f64 loads a0=0x80; 0x00210fd8, 0x0021100c and 0x00211088 load a0=0x82 before reaching the shared hero_set_state call at 0x00210f68. Original Ghidra uVar6 and LAB_00210f68 show the same selected damage-response state flow. --- src/overlays/shared/hero/hero_switch_item.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index 318b4f80c3..d16014b6bf 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -2473,7 +2473,7 @@ s32 hero_check_damage(s32 apply_damage_response) { MobyHit *hero_hit_entry; u8 *mob; s32 flag; - s32 id; + s32 damage_response_state; f32 horizontal_knockback_strength, vertical_knockback_strength, knockback_scale; V_210ce8 knockback_vector; @@ -2542,9 +2542,9 @@ s32 hero_check_damage(s32 apply_damage_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - id = 0x80; + damage_response_state = 0x80; call_ret: - hero_set_state(id, 1); + hero_set_state(damage_response_state, 1); return 1; } if (hero.state.control_mode == 0x16) { @@ -2555,14 +2555,14 @@ s32 hero_check_damage(s32 apply_damage_response) { if (hero.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + damage_response_state = 0x82; goto call_ret; } hero_set_state(0x75, 1); } else if (hero.state.control_mode == HERO_MODE_SWIM) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - id = 0x82; + damage_response_state = 0x82; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -2576,7 +2576,7 @@ s32 hero_check_damage(s32 apply_damage_response) { } else if (hero.state.control_mode == HERO_MODE_LEDGE) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0) { - id = 0x82; + damage_response_state = 0x82; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From 2c78d0161a4071b6fb3939f3551c69159297b2f3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:50:32 +0000 Subject: [PATCH 338/657] decomp: clarify names in resolve_moby_hit_response flags -> cooldown_override_flags: Retail 0x00213940 saves fourth argument a3 in s8. After fast_dec_timer_s16(q+0x1C) at 0x00213d28, its zero (active cooldown) branch reaches 0x00213da0 and dispatches on hit_response_index. Only here are s8 bits tested: 0x10/0x20 at 0x00213dbc-0x00213dcc, 1/2 at 0x00213dd0-0x00213de0, and 4/8 at 0x00213de4-0x00213df0. Set first bits prevent replacement of selected response code s1 with 0xB; set second bits prevent replacing hit_status_output with 1 at 0x00213dfc-0x00213e00. Damage at hit_record+0x2C is still cleared at 0x00213df8 or 0x00213e08. Authoritative C's active-cooldown switch agrees; original Ghidra shows the same fourth parameter and timer dispatch, whose indirect branches are resolved by the supplied retail instructions. Thus these are caller-provided cooldown suppression override flags, not hit-record state or moby flags. --- src/mobys/resolve_moby_hit_response.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mobys/resolve_moby_hit_response.c b/src/mobys/resolve_moby_hit_response.c index 4ec6e555d6..bf08f0e0a4 100644 --- a/src/mobys/resolve_moby_hit_response.c +++ b/src/mobys/resolve_moby_hit_response.c @@ -72,7 +72,7 @@ s32 resolve_moby_hit_response(O_25a478 *obj, s32 resolve_moby_hit_response(O_25a478 *hit_recipient_moby, P_25a478 *hit_record, Q_25a478 *q, - u32 flags, + u32 cooldown_override_flags, s32 *hit_status_output, f32 *fp, s32 *kp, @@ -281,21 +281,21 @@ s32 resolve_moby_hit_response(O_25a478 *hit_recipient_moby, switch (hit_response_index) { case KIND_GATED_HIT_RESPONSE: case DEFAULT_HIT_RESPONSE: - if (!(flags & 0x10)) + if (!(cooldown_override_flags & 0x10)) hit_response_code = 0xB; - if (!(flags & 0x20)) + if (!(cooldown_override_flags & 0x20)) *hit_status_output = 1; goto z; case AUXILIARY_FLAG_SETTING_HIT_RESPONSE: - if (!(flags & 1)) + if (!(cooldown_override_flags & 1)) hit_response_code = 0xB; - if (!(flags & 2)) + if (!(cooldown_override_flags & 2)) *hit_status_output = 1; goto z; case CONDITIONAL_DURATION_HIT_RESPONSE: - if (!(flags & 4)) + if (!(cooldown_override_flags & 4)) hit_response_code = 0xB; - if (!(flags & 8)) + if (!(cooldown_override_flags & 8)) *hit_status_output = 1; z: hit_record->f2C = 0; From 9c8eb8fac84ecbf49405034c47ab4c7d506bb956 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:50:32 +0000 Subject: [PATCH 339/657] decomp: clarify names in help_desk_lady_update flags -> help_desk_progress_flags: L16WatchFlags *flags is assigned the shared base (char *)&D_0013D355_watch + 0x13B. Retail 002e32ec constructs s0=0013d388; 002e32f0 reads +70 (0013d3f8), 002e3300 loads watch_data->entry_region at s2+164, and 002e3304 tests player position against that volume before 002e3314 latches +70 to 1. Original Ghidra confirms cRam0013d3f8 is set only on nonzero volume-test result. The same shared structure's +71 byte is latched at 002e3340 after the control-mode check. This is the shared help-desk progress-flags block, rather than per-moby animation or dialogue activation data. --- src/overlays/l16/mobys/help_desk_lady.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l16/mobys/help_desk_lady.c b/src/overlays/l16/mobys/help_desk_lady.c index a140c7017a..f75d10aaf2 100644 --- a/src/overlays/l16/mobys/help_desk_lady.c +++ b/src/overlays/l16/mobys/help_desk_lady.c @@ -120,7 +120,7 @@ void help_desk_lady_update(L16WatchMoby *moby) { }; L16WatchScratch gaze_vectors; L16WatchData *watch_data = moby->data; - L16WatchFlags *flags; + L16WatchFlags *help_desk_progress_flags; float rate; float head_rate; int tracking; @@ -158,10 +158,10 @@ void help_desk_lady_update(L16WatchMoby *moby) { } break; } - flags = (L16WatchFlags *)((char *)&D_0013D355_watch + 0x13B); - if (!flags->entered && + help_desk_progress_flags = (L16WatchFlags *)((char *)&D_0013D355_watch + 0x13B); + if (!help_desk_progress_flags->entered && is_point_inside_clip_volume((char *)&D_0013E533 + 0xE9D, watch_data->entry_region)) - flags->entered = 1; + help_desk_progress_flags->entered = 1; if (!((L16WatchFlags *)((char *)&D_0013D355_watch + 0x13B))->mission && hero.state.control_mode == HERO_MODE_GRIND) ((L16WatchFlags *)((char *)&D_0013D355_watch + 0x13B))->mission = 1; From 970b0b55a31b962eb253c46a74359530ef8bbe83 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 08:55:30 +0000 Subject: [PATCH 340/657] decomp: clarify names in gemlik_projectile_update flags -> hit_descriptor_flags: Current C initializes flags=0x10001 and derives hit_mask=flags|1 for make_hit_descriptor; the matched target row receives that same hit_mask in hit_flags. Retail 00306388/0030638C constructs s3=0x10001, 0030645C ORs bit 1, 00306464 passes s3 in a2 to the descriptor helper at 0030646C, and 00306508 stores s3 at hit-entry +0x24. Original retail decompilation independently shows 0x10001 in that descriptor call and row store; record_moby_hit context confirms descriptor y maps to hit-record flags. --- src/overlays/l13/mobys/gemlik_projectile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l13/mobys/gemlik_projectile.c b/src/overlays/l13/mobys/gemlik_projectile.c index e104d98cf9..5120d01dd5 100644 --- a/src/overlays/l13/mobys/gemlik_projectile.c +++ b/src/overlays/l13/mobys/gemlik_projectile.c @@ -126,7 +126,7 @@ void gemlik_projectile_update(struct Moby *moby) { work.velocity.z = 0.0f; set_vector_length_xy(&work.velocity, &work.velocity, 1.0f); work.velocity.z = 1.0f; - flags = 0x10001; + hit_descriptor_flags = 0x10001; hero_bytes = (unsigned char *)((char *)((char *)&hero)); if (hero_bytes[0x1FF6] != 0 && projectile_vars->deflected_marker != 31337.6015625f && fast_vec_dist(&moby->pos, hero_bytes + 0x80) < 2.0f) { @@ -139,7 +139,7 @@ void gemlik_projectile_update(struct Moby *moby) { unsigned char *hero_base = (unsigned char *)((char *)((char *)&hero)); ent = ((char **)(hero_base + 0x2020))[i]; if (ent != 0) { - int hit_mask = flags | 1; + int hit_mask = hit_descriptor_flags | 1; make_hit_descriptor(work.hit, moby, hit_mask, 1.0f, &work.velocity); work.hit[0x18] = 1; *(unsigned short *)(work.hit + 0x1A) = *(unsigned short *)((char *)moby + 0xA6); From 52c06973479cf14fe117425584e03941551e5ee2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:06:35 +0000 Subject: [PATCH 341/657] decomp: clarify names in update_hud_item_selector_selection_and_visibility id -> selected_item_id: Retail 0x002380b0-0x002380dc reads HUD selected slot +0x74, indexes the 0x1c-stride active slot table, and loads entry+0x18 into s1 (source id). 0x002380f4-0x002380f8 compares it with hero.items[0].item_id; 0x00238198-0x002381b0 handles special 0x18 or stores it to hero.pending_item[0]. 0x002381b4-0x002381f0 uses the same item identifier for 24-byte VendorItemInfo and weapon_ammo_counts indexing, proving selected_item_id. --- .../shared/ui/hud/draw_hud_item_selector_panel.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c b/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c index d32f32548b..71a352f578 100644 --- a/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c +++ b/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c @@ -251,7 +251,7 @@ void update_hud_item_selector_selection_and_visibility(Obj *hud_element) __asm__ void update_hud_item_selector_selection_and_visibility(Obj *hud_element) { float x, y, mag, stick_angle, a, slot_position, previous_slot_angle; - int previous_selected_slot_index, slot_step, stick_slot_index, k, id; + int previous_selected_slot_index, slot_step, stick_slot_index, k, selected_item_id; u8 *counters = &hud_element->b70; hud_element->w7C = scale_game_frames(0xB4); @@ -359,8 +359,8 @@ void update_hud_item_selector_selection_and_visibility(Obj *hud_element) { int sel = hud_element->w74; if (sel >= 0 && (id = D_L00_0015FAC0_c[D_L00_0015F72C][sel].command) != 0) { VendorItemInfo *rr; - int ri = id; - if (hero_lui.items[0].item_id != id) { + int ri = selected_item_id; + if (hero_lui.items[0].item_id != selected_item_id) { if (usage_stats.stat[20].count < 0xFFFF) usage_stats.stat[20].count++; } @@ -371,10 +371,10 @@ void update_hud_item_selector_selection_and_visibility(Obj *hud_element) { if (id == 0x18) hero_lui.launch_drones = 1; else - hero_lui.pending_item[0] = id; + hero_lui.pending_item[0] = selected_item_id; rr = &D_L00_001C40B0[ri]; - if (rr->h8 && rr->hE < weapon_ammo_counts[id]) - weapon_ammo_counts[id] = rr->hE; + if (rr->h8 && rr->hE < weapon_ammo_counts[selected_item_id]) + weapon_ammo_counts[selected_item_id] = rr->hE; } if (counters[0]) counters[0]--; From e4dbd4c1cb8bc9ddae4b1bf790ede8b888d9ebe3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:08:37 +0000 Subject: [PATCH 342/657] decomp: clarify names in generate_random_points_from_shape_entries flags -> shape_entry_flags: Retail 0025ad60 sets s1 to shape entry s2+4; 0025ad70 loads its header word from -4(s1). The loaded word supplies terminal bit31 through srl at 0025ad80, shape selector low byte through andi at 0025ad84, and eligibility bit0x20000 through and at 0025ad90-0025ad94. The authoritative C assigns this word to flags, then derives last, type and active. Entry and field pointers advance together by 0x20 at 0025af78-0025af7c, proving this is each shape entry's packed flags rather than entity or output flags. --- src/overlays/shared/mobys/find_moby_hit.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/mobys/find_moby_hit.c b/src/overlays/shared/mobys/find_moby_hit.c index c0866461b1..716d9bfae3 100644 --- a/src/overlays/shared/mobys/find_moby_hit.c +++ b/src/overlays/shared/mobys/find_moby_hit.c @@ -604,7 +604,7 @@ int generate_random_points_from_shape_entries( unsigned char *list; unsigned char *entry; int count, index, chosen, emitted, limit; - unsigned int flags; + unsigned int shape_entry_flags; unsigned int last; float total, weight, radius, extent, random; int type; @@ -629,10 +629,10 @@ int generate_random_points_from_shape_entries( float radius, extent; int type; unsigned int active; - flags = *(unsigned int *)(list - 4); - last = flags >> 31; - type = flags & 0xff; - active = flags & 0x20000; + shape_entry_flags = *(unsigned int *)(list - 4); + last = shape_entry_flags >> 31; + type = shape_entry_flags & 0xff; + active = shape_entry_flags & 0x20000; if (!(((mask >> index) ^ 1) & 1) && active) { entries[count] = entry; switch (type) { From 2153d18aeb00d811979f8602f4171abe5034a66d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:08:37 +0000 Subject: [PATCH 343/657] decomp: clarify names in update_splitting_effect_particle_with_collision_response_and_fade mode -> collision_query_mode: In the authoritative C, s32 mode is assigned only 4 or 0 and used only as the third argument to FUN_001efa68_26ff10(pa, pb, mode, col, aux). Retail 00270248 loads a2=4 with t0=NULL at 00270250; 00270294 supplies stack collision_parameters in t0 and 002702a0 sets a2=0. Both reach collision query 001efc70 at 002702a4. Original Ghidra uVar8 has these same assignments and third-argument use; the return controls reflection, collision-normal offset and acceptance of the next position at 002702b0-00270370. This proves the collision query selector role without asserting the meanings of its values. --- .../effects/update_three_phase_effect_particle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c index 86272e2b1c..5caa1c7541 100644 --- a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c +++ b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c @@ -3343,7 +3343,7 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff u8 fl; s32 fm; s64 hit; - s32 k, mode, kk2, t; + s32 k, collision_query_mode, kk2, t; void *aux, *col, *pa, *pb; f32 f, rotation_direction_sign, alpha_factor; @@ -3399,7 +3399,7 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff col = pv->f1C; pa = v1u.f; pb = v0u.f; - mode = 4; + collision_query_mode = 4; aux = 0; } else { collision_parameters.f10 = pv->f1C; @@ -3413,9 +3413,9 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff aux = &collision_parameters; pa = v1u.f; pb = v0u.f; - mode = 0; + collision_query_mode = 0; } - hit = FUN_001efa68_26ff10(pa, pb, mode, col, aux) != 0; + hit = FUN_001efa68_26ff10(pa, pb, collision_query_mode, col, aux) != 0; if (hit) { fast_vec_normalize(collision_offset, coll_hit_normal.f, 1.0f); reflect_vector(pv, pv, coll_hit_normal.f); From 59bf87797d06ff6d146915862267391e4b60ae85 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:08:37 +0000 Subject: [PATCH 344/657] decomp: clarify names in drawbridge_update status -> mission_status: In authoritative drawbridge_update, status is initialized from visited52[moby->mission + (current_level_index << 4)] and used only for the DRAWBRIDGE_MISSION_ALREADY_COMPLETE comparison. Retail 0x002f5608 loads the level index, 0x002f5610 loads moby+0xB0 mission, 0x002f5618 multiplies the level by 16, and 0x002f5620-0x002f5628 loads that indexed mission-table byte. The 0xFF test at 0x002f561c/0x002f562c selects completion state 6 and final bridge scalars at 0x002f5634-0x002f5658. Original retail Ghidra corroborates the same indexed byte and branch. Thus this binding is the mission status, not the moby's current state or an activation gate. --- src/overlays/l06/mobys/drawbridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l06/mobys/drawbridge.c b/src/overlays/l06/mobys/drawbridge.c index 423daa0021..eaa8b2802b 100644 --- a/src/overlays/l06/mobys/drawbridge.c +++ b/src/overlays/l06/mobys/drawbridge.c @@ -137,8 +137,8 @@ void drawbridge_update(Moby *moby) { switch (moby->state) { case INITIALIZE_DRAWBRIDGE_SEGMENTS: { - int status = visited52[moby->mission + (current_level_index << 4)]; - if (status == DRAWBRIDGE_MISSION_ALREADY_COMPLETE) { + int mission_status = visited52[moby->mission + (current_level_index << 4)]; + if (mission_status == DRAWBRIDGE_MISSION_ALREADY_COMPLETE) { moby->state = DRAWBRIDGE_COMPLETE; drawbridge_extension_gp = 20.0f; drawbridge_pitch_degrees_gp = 1000.0f; From b692d2cd34e22d8121653c828e726d33b1285c93 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:10:49 +0000 Subject: [PATCH 345/657] decomp: clarify names in seeker_update mode -> state_dispatch_mode: Authoritative C assigns mode = seeker_state_dispatch_mode and compares it only with SEEKER_DISPATCH_MODE_SKIP_STATE_UPDATE before switch(moby->state). Retail 0x002c5a20-0x002c5a24 loads global 0x0015f5c4 (alternate load at 0x002c5a0c); 0x002c5a28-0x002c5a2c compares with 2 and branches to the epilogue before the moby state read and jump-table dispatch at 0x002c5a34-0x002c5a54. Original Ghidra iVar7 follows the same load and early-return data flow, proving this local stores the state dispatch mode. --- src/overlays/shared/enemies/seeker.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/seeker.c b/src/overlays/shared/enemies/seeker.c index 7e59200d01..14e43bb179 100644 --- a/src/overlays/shared/enemies/seeker.c +++ b/src/overlays/shared/enemies/seeker.c @@ -107,7 +107,7 @@ void seeker_update(struct Moby *moby) { Moby52Vars *seeker_instance_vars = (Moby52Vars *)moby->pvars; struct Moby *target; Vec4 vel; - s32 mode; + s32 state_dispatch_mode; s32 voice; f32 target_distance_xy; f32 z; @@ -123,8 +123,8 @@ void seeker_update(struct Moby *moby) { FUN_L00_0025a120(moby); moby->shadow_range = 0x17; } - mode = seeker_state_dispatch_mode; - if (mode == SEEKER_DISPATCH_MODE_SKIP_STATE_UPDATE) { + state_dispatch_mode = seeker_state_dispatch_mode; + if (state_dispatch_mode == SEEKER_DISPATCH_MODE_SKIP_STATE_UPDATE) { return; } switch (moby->state) { From a1e6de70c560980f5e8eb6496bdfdcf7646775d3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:10:49 +0000 Subject: [PATCH 346/657] decomp: clarify names in volume_camera_swing state -> snap_camera_state: Local naming finding: state -> snap_camera_state. The bound source assigns this FollowCamState pointer from rig = FOLLOW_CAM_STATE(current_follow_camera_record) only in the type-5 first-frame snap block. Retail 0x002ecb38-0x002ecb44 loads current_follow_cam, follows +0x70, and retains the state base in s0; original Ghidra puVar2 is that same base. Retail 0x002ecb60 derives reset at base+0x20; 0x002ecba0-0x002ecbf8 constructs eye (+0x90) and look_target (+0x80), 0x002ecbfc-0x002ecc34 copies look_target, focus, offset, position and snap position into this state, and 0x002ecc50-0x002ecc70 resets its spring values. Thus the alias represents camera state being initialized for the entry snap, rather than the SwingCameraParams behavior selector. --- src/overlays/shared/camera/swing_volume_camera.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/camera/swing_volume_camera.c b/src/overlays/shared/camera/swing_volume_camera.c index dabb2e7d7e..ff2d8ff1f7 100644 --- a/src/overlays/shared/camera/swing_volume_camera.c +++ b/src/overlays/shared/camera/swing_volume_camera.c @@ -155,7 +155,7 @@ void volume_camera_swing(struct UpdateCam *swing_camera_record) { struct UpdateCam *current_follow_camera_record; Vec4f *pos; FollowCamState *rig; - FollowCamState *state; + FollowCamState *snap_camera_state; FollowCamBlock *follow; FollowCamTail *tail; FollowCamSnap *snap; From 8eb47ff5cdcdf1ee1affcdeb6a91202b9dc95123 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:13:07 +0000 Subject: [PATCH 347/657] decomp: clarify names in process_moby_attachment_damage mode -> damage_outcome: In process_moby_attachment_damage, mode is initialized to ATTACHMENT_DAMAGE_NONE and holds only damage outcomes. Retail s8 is cleared at 002e9aa4, set to 3 after lethal helper calls at 002e9c30/002e9f90, set to 1 on nonlethal health subtraction at 002e9c5c/002e9fb8, and set to 2 after damage-stage advancement at 002e9dbc/002ea12c. Tests at 002e9e30 and 002ea1b0 stop further attachment scanning once an outcome exists; 002ea1b8 gates post-damage line handling. Original Ghidra iVar14 outcome flow and authoritative C agree. --- src/overlays/l13/mobys/qwarks_starfighter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index 6ac2767792..b23c539412 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -741,7 +741,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { }; int hit; int rf; - int mode; + int damage_outcome; int i; int k; int j; @@ -754,7 +754,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { if (moby->state < STARFIGHTER_STATE_OWNER_UNAVAILABLE) { dd = &moby_data->sub; - mode = ATTACHMENT_DAMAGE_NONE; + damage_outcome = ATTACHMENT_DAMAGE_NONE; rf = 0; k6 = 6.0f; step = (float)dd->max_health / k6; @@ -848,7 +848,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { } } } - for (i = 0; i < 11 && mode == ATTACHMENT_DAMAGE_NONE; i++) { + for (i = 0; i < 11 && damage_outcome == ATTACHMENT_DAMAGE_NONE; i++) { if (moby_data->list[i] == 0) { continue; } @@ -942,7 +942,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { moby_data->b148 = 1; } } - if (mode > ATTACHMENT_DAMAGE_NONE) { + if (damage_outcome > ATTACHMENT_DAMAGE_NONE) { if (rf != 0) { switch (moby->command - 1) { case DAMAGE_STAGE_SKIP_LINE_QUEUE: From ee12ca022d571300a2e4045325ff57bad7632e77 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:20:21 +0000 Subject: [PATCH 348/657] decomp: clarify names in sand_mouse_update id -> moby_save_id: Authoritative C assigns the unsigned-short local from moby->save_id and uses it to index l01_save_state.cleared and the completion bitmap. Original retail Ghidra case 0 agrees: 0x002e40b8 loads lhu a1,0xb2(s3); 0x002e40c0-0x002e40d0 sign-extends the save ID and indexes the saved completion byte. 0x002e40e4-0x002e410c derives the bitmap word from save ID >> 5 and bit from save ID & 0x1f. Either set completion check leads to the already-completed message and removal at 0x002e4118-0x002e4134. This proves the local is the moby's save ID. --- src/overlays/shared/enemies/sand_mouse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/enemies/sand_mouse.c b/src/overlays/shared/enemies/sand_mouse.c index b6ac28b50b..e5e6191263 100644 --- a/src/overlays/shared/enemies/sand_mouse.c +++ b/src/overlays/shared/enemies/sand_mouse.c @@ -534,13 +534,13 @@ void sand_mouse_update(struct Moby *moby) { moby->update_dist = 0xFF; moby->draw_dist = 0xFF; if (sand_mouse_vars->parent != -1) { - unsigned short id; + unsigned short moby_save_id; qcopy(((float *)&moby->pos), ((float *)&((struct Moby *)ents)[sand_mouse_vars->parent].pos)); moby->pos.z = moby->pos.z + 0.02f; - if (l01_save_state.cleared[(short)(id = moby->save_id)] != 0 || - (*(int *)((char *)D_0014C190_257218 + (((short)id >> 5) * 4 + (D_0015ED84 << 8))) >> - (id & 0x1F)) & + if (l01_save_state.cleared[(short)(moby_save_id = moby->save_id)] != 0 || + (*(int *)((char *)D_0014C190_257218 + (((short)moby_save_id >> 5) * 4 + (D_0015ED84 << 8))) >> + (moby_save_id & 0x1F)) & 1) { debug_print(sand_mouse_already_completed_message); mark_moby_for_removal(moby); From 1fa8819e860cfdcee2492890ca12cd8617c72be9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:22:16 +0000 Subject: [PATCH 349/657] decomp: clarify names in metropolis_train_locomotive_update mode -> hero_control_mode: Authoritative C assigns mode = hero.state.control_mode in TRAIN_WAIT_FOR_BOARDING. Retail 0x00293168 sets s0 to 0x0013f3d0; 0x00293188 loads a0 from s0+0x200c (0x001413dc), which original Ghidra identifies as uRam001413dc. The unsigned <2 and ==9/12 tests at 0x0029318c-0x002931a4 gate command 4, music and turret activation at 0x002931b4-0x002931f8. This proves a snapshot of the hero control mode, without assigning meanings to its numeric members. --- src/overlays/l03/mobys/metropolis_train_locomotive.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l03/mobys/metropolis_train_locomotive.c b/src/overlays/l03/mobys/metropolis_train_locomotive.c index 81ed32532f..f79630edbd 100644 --- a/src/overlays/l03/mobys/metropolis_train_locomotive.c +++ b/src/overlays/l03/mobys/metropolis_train_locomotive.c @@ -440,7 +440,7 @@ void metropolis_train_locomotive_update(char *moby) { struct Moby *linked_moby; int second_path_node_index; char *second_path; - u32 mode; + u32 hero_control_mode; int ident; train_engine_pvars = ((Engine292e98 *)MOBY(moby)->pvars); @@ -526,8 +526,8 @@ void metropolis_train_locomotive_update(char *moby) { if (train_engine_pvars->boarding_turret_moby_index == -1) { break; } - mode = hero.state.control_mode; - if (mode < 2 || mode == 9 || mode == 12) { + hero_control_mode = hero.state.control_mode; + if (hero_control_mode < 2 || hero_control_mode == 9 || hero_control_mode == 12) { MOBY(moby)->command = 4; D_L03_0015FDFC = 1; request_music_track(4, 7); From f47fab093c7544fd411c5afa384c545e220981c2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:27:16 +0000 Subject: [PATCH 350/657] decomp: clarify names in plasmabot_update status -> unused_debris_spawn_input: In PLASMABOT_SPAWN_DEBRIS_AND_REMOVE, retail 0x002b2564 initializes sp+0xb0 to zero; 0x002b256c passes its address as a1 to spawn_path_or_ballistic_debris at 0x002b2570, with a2=1 at 0x002b2574. Checked helper evidence request 06ec3e7101954cd5b01932ffdce44d37 shows a1 saved in s5 at 0x002e0184 and mode a2 saved in s4 at 0x002e018c, then copied to spawned moby state at 0x002e01d4. The nonzero state branches at 0x002e01ec..0x002e01f0 to 0x002e0274, bypassing the only s5 dereference at 0x002e0214; the complete mode-one branch through 0x002e03b4 never reads or writes that input. Thus this is unused debris-spawn input storage, not an observed status output. --- src/overlays/shared/enemies/plasmabot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index 423a9a7a3b..fff0d37ba8 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -375,7 +375,7 @@ void plasmabot_update(char *moby) { float direction[4]; float end[4]; LineInfo beam_line_trace_descriptor; - int status; + int unused_debris_spawn_input; plasmabot_update_private_vars = (PlasmabotVars *)MOBY(moby)->pvars; plasmabot_aim_target_moby = 0; @@ -815,8 +815,8 @@ void plasmabot_update(char *moby) { case PLASMABOT_SPAWN_DEBRIS_AND_REMOVE: { FUN_L00_0024f7c8(moby, 2, bone_transform_scratch); spawn_plasmabot_death_debris(moby, (char *)bone_transform_scratch); - status = 0; - ((void (*)(char *, int *, int))spawn_path_or_ballistic_debris)(moby, &status, 1); + unused_debris_spawn_input = 0; + ((void (*)(char *, int *, int))spawn_path_or_ballistic_debris)(moby, &unused_debris_spawn_input, 1); release_beam_slot_by_id(moby); call_D678(moby); return; From a5df20552770e0abfa5c514149f4e16a357be46c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:29:11 +0000 Subject: [PATCH 351/657] decomp: clarify names in process_hero_primary_item_input id -> target_moby_index: In ITEM_RACE_PROJECTILE, source reads id = pv->f2C[i] from hoverboard pvars, skips -1, and resolves candidate = D_L05_0015FFD8_macro + (id << 8). Retail 0x252754 loads hoverboard pvars; 0x252768-0x25277c loads pvars+0x2c+i*4 and rejects -1; 0x252780-0x252798 loads the global moby base and adds index<<8. Original Ghidra likewise reads iVar4 from pvars+0x2c and resolves iGpffff93d8+iVar4*0x100. The resulting candidate's position feeds yaw/pitch and distance scoring at 0x25279c-0x252840; a selected candidate becomes s7 at 0x25285c and is passed as the projectile target at 0x252950-0x252954. This proves a potential target's moby-array index. --- src/overlays/shared/hero/process_hero_primary_item_input.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/process_hero_primary_item_input.c b/src/overlays/shared/hero/process_hero_primary_item_input.c index 7041a08260..1517729a06 100644 --- a/src/overlays/shared/hero/process_hero_primary_item_input.c +++ b/src/overlays/shared/hero/process_hero_primary_item_input.c @@ -1069,15 +1069,15 @@ int process_hero_primary_item_input(void) { i = 0; while (i < 5) { - int id = pv->f2C[i]; + int target_moby_index = pv->f2C[i]; Moby *candidate; float yaw_error, pitch_error, distance, score; - if (id == -1) { + if (target_moby_index == -1) { i++; continue; } - candidate = (Moby *)((char *)D_L05_0015FFD8_macro + (id << 8)); + candidate = (Moby *)((char *)D_L05_0015FFD8_macro + (target_moby_index << 8)); yaw_error = fast_difference_between_rotations( (*(Hero *)((char *)&hero)).motion.rot.f[2], fast_arc_tan(candidate->pos.x - (*(Hero *)((char *)&hero)).motion.pos.f[0], From dc579efa6f22a4a401f35140a3920bb963c5f3dc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:29:12 +0000 Subject: [PATCH 352/657] decomp: clarify names in frog_update mode -> visibility_override_mode: Retail 0x002e86bc loads D_L06_0015F5C4 into v1, the source local mode. At 0x002e86c4..0x002e86f0 its value 2 sets frog pvars+0x1EA to remember the override and sets Moby flags 0x41 when flag bit 1 was clear. At 0x002e86f4..0x002e8714 value 0 restores those flags only when that remembered override is nonzero, then clears the marker. The same source uses flags 0x41 for the hidden waiting-child and respawn configurations and clears them when releasing the child. The local therefore controls the visibility override; this name makes no claim about the upstream selector's full enum domain. --- src/overlays/shared/enemies/frog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index e89a607f30..322cfdd044 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -266,7 +266,7 @@ void frog_update(unsigned char *moby) { float D[4] __attribute__((aligned(16))); FrogVars *frog_instance_vars; unsigned char *target; - int mode; + int visibility_override_mode; frog_instance_vars = (FrogVars *)MOBY(moby)->pvars; if (l06_frog_updates_disabled != 0) { From 51f795bea200d7ebd7887146fc888a5ab23d0ad1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:31:15 +0000 Subject: [PATCH 353/657] decomp: clarify names in level_draw_dialog_text id -> body_message_id: Within MESSAGE_BOX_CHOICE_DIALOG, source assigns id = 0x522A/0x522B/0x522C according to l00_message_box.choice, or zero for unsupported choices, and uses get_help_message_text(id) as font_print_window body text. Original retail Ghidra lVar14 has this same role. Retail 0x00202180, 0x002021cc and 0x002021f4 load these keys into a0; 0x002021fc skips zero, 0x00202204 calls the help lookup, and 0x0020220c/0x00202224 pass its returned string as a2 to font_print_window at 0x00202230. Button strings are looked up and printed separately before body-key selection. --- .../shared/ui/text/level_draw_dialog_text.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/ui/text/level_draw_dialog_text.c b/src/overlays/shared/ui/text/level_draw_dialog_text.c index fcef538d3b..7ed523227d 100644 --- a/src/overlays/shared/ui/text/level_draw_dialog_text.c +++ b/src/overlays/shared/ui/text/level_draw_dialog_text.c @@ -319,7 +319,7 @@ void level_draw_dialog_text(void) { case MESSAGE_BOX_CHOICE_DIALOG: { s32 text_color; s32 button_color; - s32 id; + s32 body_message_id; f32 alpha; box = l00_choice_dialog_text_region_template; @@ -333,25 +333,25 @@ void level_draw_dialog_text(void) { case CHOICE_DIALOG_SHARED_PAIRED_BUTTONS: font_print_center(0xCA, 0x118, button_color, get_help_message_text(0x524E), -1); font_print_center(0x135, 0x118, button_color, get_help_message_text(0x524B), -1); - id = 0x522A; + body_message_id = 0x522A; break; case CHOICE_DIALOG_ALTERNATE_BODY_PAIRED_BUTTONS: font_print_center(0xCA, 0x118, button_color, get_help_message_text(0x524E), -1); font_print_center(0x135, 0x118, button_color, get_help_message_text(0x524B), -1); - id = 0x522B; + body_message_id = 0x522B; break; case CHOICE_DIALOG_SINGLE_CENTERED_BUTTON: font_print_center(0x100, 0x118, button_color, get_help_message_text(0x524A), -1); - id = 0x522C; + body_message_id = 0x522C; break; default: - id = 0; + body_message_id = 0; break; } - if (id != 0) { + if (body_message_id != 0) { font_print_window(&box, text_color, - get_help_message_text(id), + get_help_message_text(body_message_id), -1, get_effect_texture(1), dialog_font_glyph_metrics); From 8be13ad7bbeeb81d23fb245d03b2d05c558b6e11 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:34:42 +0000 Subject: [PATCH 354/657] decomp: clarify names in blarg_paratrooper_update flags -> motion_result_flags: In PARATROOPER_STATE_KNOCKBACK_RECOVERY, flags -> motion_result_flags. Retail 0x003022A4-0x003022B0 calls 0x00266B88 (the source step_moby_motion) with moby and private_state+0x70 and copies its return v0 into v1. 0x003022B4 tests v1 & 0x40 to resume melee or projectile attacks; 0x00302390-0x003023A0 tests the same return against 0x120 to remove the moby. Original Ghidra case 10 likewise assigns the helper return to uVar13 and tests these masks. This proves a bitset returned by the motion step without asserting individual bit meanings. --- src/overlays/shared/enemies/blarg_paratrooper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_paratrooper.c b/src/overlays/shared/enemies/blarg_paratrooper.c index c48beb5daf..e1a9046f21 100644 --- a/src/overlays/shared/enemies/blarg_paratrooper.c +++ b/src/overlays/shared/enemies/blarg_paratrooper.c @@ -552,8 +552,8 @@ void blarg_paratrooper_update(char *moby) { } break; case PARATROOPER_STATE_KNOCKBACK_RECOVERY: { - int flags = step_moby_motion(moby, (char *)paratrooper_private_state + 0x70); - if (flags & 0x40) { + int motion_result_flags = step_moby_motion(moby, (char *)paratrooper_private_state + 0x70); + if (motion_result_flags & 0x40) { if (vector_distance_xy(&MOBY(moby)->pos, target + 0x10) < melee302618) { melee_state: (*(unsigned char *)((char *)(moby) + 0x20)) = 7; @@ -571,7 +571,7 @@ void blarg_paratrooper_update(char *moby) { moby, 6, 0, ticks + random_int_between(0, scale_game_frames(7))); } } - } else if (flags & 0x120) { + } else if (motion_result_flags & 0x120) { delete_moby: mark_moby_for_removal(moby); } From f45660577fad33587866f0a71580679fcecc9a17 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:36:25 +0000 Subject: [PATCH 355/657] decomp: clarify names in draw_dialog_text id -> body_message_id: Source assigns 0x522A/0x522B/0x522C or zero after drawing choice footers. Retail 0x001fc508, 0x001fc554 and 0x001fc57c load these IDs into a0; 0x001fc580 supplies zero for unsupported choices. The guard at 0x001fc584 skips zero, and 0x001fc58c resolves this ID through get_help_message_text (0x001fdd10). Its returned text is moved to s1 at 0x001fc594 and passed as a2 to font_print_window at 0x001fc5ac-0x001fc5bc, proving it identifies the dialog body message rather than a footer or state. --- src/ui/text/draw_dialog_text.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ui/text/draw_dialog_text.c b/src/ui/text/draw_dialog_text.c index 6422a5c99a..093b9c1878 100644 --- a/src/ui/text/draw_dialog_text.c +++ b/src/ui/text/draw_dialog_text.c @@ -311,7 +311,7 @@ void draw_dialog_text(void) { case FREEZE_CHOICE_MESSAGE_DIALOG: { s32 text_color; s32 button_color; - s32 id; + s32 body_message_id; f32 alpha; box = D_001E7908; @@ -326,25 +326,25 @@ void draw_dialog_text(void) { case FREEZE_CHOICE_SHARED_PAIRED_FOOTER_MESSAGE: font_print_center(0xCA, 0x118, button_color, get_help_message_text(0x524E), -1); font_print_center(0x135, 0x118, button_color, get_help_message_text(0x524B), -1); - id = 0x522A; + body_message_id = 0x522A; break; case FREEZE_CHOICE_ALTERNATE_PAIRED_FOOTER_MESSAGE: font_print_center(0xCA, 0x118, button_color, get_help_message_text(0x524E), -1); font_print_center(0x135, 0x118, button_color, get_help_message_text(0x524B), -1); - id = 0x522B; + body_message_id = 0x522B; break; case FREEZE_CHOICE_CENTERED_FOOTER_MESSAGE: font_print_center(0x100, 0x118, button_color, get_help_message_text(0x524A), -1); - id = 0x522C; + body_message_id = 0x522C; break; default: - id = 0; + body_message_id = 0; break; } - if (id != 0) { + if (body_message_id != 0) { font_print_window(&box, text_color, - get_help_message_text(id), + get_help_message_text(body_message_id), -1, get_effect_texture(1), normal_font_metrics); From 991f8c614dbbde77d71ca265ba66424d9d6a1cb3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:40:38 +0000 Subject: [PATCH 356/657] decomp: clarify names in load_level_gameplay flags -> moby_load_flags: Retail 0x002428a4 loads the third word of each hdr->f44 moby record into s0 (original Ghidra uVar22 = piVar30[2]); source flags reads this word after mission. Tests at 0x002428c8-0x002428e8 use bit 0x10 to select bolt-source slot lookup. Masks 3, 1, 2, 8 and 0xC at 0x00242904-0x00242a3c choose mission/UID-bitset load exclusion and primary/alternate or halved bolt counts. Skip at 0x00242a40-0x00242a50 writes -1 to the moby remap, while the retained branch initializes the moby. This proves flags encode moby loading policy, rather than runtime instance flags at +0x34. --- .../shared/world/load_level_gameplay.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/world/load_level_gameplay.c b/src/overlays/shared/world/load_level_gameplay.c index 42e06c645c..8eff18d870 100644 --- a/src/overlays/shared/world/load_level_gameplay.c +++ b/src/overlays/shared/world/load_level_gameplay.c @@ -945,7 +945,7 @@ char *load_level_gameplay(int skip_gameplay_read) { FillTransferWords(mem, 0, (n + n2) << 8); for (i = 0; i < n; i++) { int mission; - int flags; + int moby_load_flags; int uid; int bolts; int bolts2; @@ -958,7 +958,7 @@ char *load_level_gameplay(int skip_gameplay_read) { p += 4; mission = *(int *)p; p += 4; - flags = *(int *)p; + moby_load_flags = *(int *)p; p += 4; uid = *(int *)p; p += 4; @@ -968,18 +968,18 @@ char *load_level_gameplay(int skip_gameplay_read) { p += 4; selected_bolt_count = bolts; adjusted_bolt_count = selected_bolt_count; - if (flags != 0) { + if (moby_load_flags != 0) { level_or_group_scratch = D_0015ED84; /* read before the test: see the group loop */ - if (flags & 0x10) { + if (moby_load_flags & 0x10) { vis = find_or_assign_bolt_source_slot(level_or_group_scratch, uid); } else { vis = 0xFF; } if (l00_moby_load_exclusion_flags_by_uid[uid] != 0) { skip = 1; - } else if (flags & 3) { + } else if (moby_load_flags & 3) { if (mission_state[mission] == 0xFF) { - if (flags & 2) { + if (moby_load_flags & 2) { selected_bolt_count = bolts2; if ((D_L00_001BA4D0[uid >> 5] >> (uid & 0x1F)) & 1) { adjusted_bolt_count = (selected_bolt_count + 1) / 2; @@ -990,7 +990,7 @@ char *load_level_gameplay(int skip_gameplay_read) { skip = 1; } } else { - if (flags & 1) { + if (moby_load_flags & 1) { if ((D_0014C190_257218[D_0015ED84][uid >> 5] >> (uid & 0x1F)) & 1) { adjusted_bolt_count = (bolts + 1) / 2; } @@ -998,11 +998,11 @@ char *load_level_gameplay(int skip_gameplay_read) { skip = 1; } } - } else if (flags & 8) { + } else if (moby_load_flags & 8) { if ((D_L00_001BA4D0[uid >> 5] >> (uid & 0x1F)) & 1) { skip = 1; } - } else if ((flags & 0xC) == 4) { + } else if ((moby_load_flags & 0xC) == 4) { if ((D_0014C190_257218[D_0015ED84][uid >> 5] >> (uid & 0x1F)) & 1) { skip = 1; } From df14c5fbe817363568c2a571023913b1f43b3fb2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:42:24 +0000 Subject: [PATCH 357/657] decomp: clarify names in walker_update_gait flags -> gait_update_trigger_mask: Incoming int a2 is retained as s5 at 0x002a167c (Ghidra param_6). Mask 5 gates terrain probing or takeoff entry at 0x002a193c/0x002a1960 and 0x002a1ab0-0x002a1adc, repeated in RUN at 0x002a32b0-0x002a32e0. Mask 1 selects the paired +0x10/+0x30 probe anchors at 0x002a1c7c-0x002a1cd4 and takeoff variants at 0x002a1acc-0x002a1ba0. Mask 0x30 gates jump-velocity initialization at 0x002a3544-0x002a35c4 and 0x002a36ac-0x002a372c. Mask 1 gates landing-to-RUN recovery at 0x002a3ab8/0x002a3b1c. These uses prove an input mask triggering gait-update stages, separate from persistent +0xEE status flags; source flags tests agree. --- .../shared/enemies/walker_update_gait.c | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/overlays/shared/enemies/walker_update_gait.c b/src/overlays/shared/enemies/walker_update_gait.c index e7f09cea05..4c60a67555 100644 --- a/src/overlays/shared/enemies/walker_update_gait.c +++ b/src/overlays/shared/enemies/walker_update_gait.c @@ -175,7 +175,7 @@ void walker_update_gait(WalkMoby *m, float accel) __asm__("FUN_L00_002a1670"); void walker_update_gait(WalkMoby *walker_moby, WalkData *gait_data, - int flags, + int gait_update_trigger_mask, float speed, float movement_heading, @@ -245,7 +245,7 @@ void walker_update_gait(WalkMoby *walker_moby, case WALKER_GAIT_WALK_UPHILL: case WALKER_GAIT_TRANSITION_FROM_UPHILL_TO_WALK: case WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK: - if (flags & 5) { + if (gait_update_trigger_mask & 5) { gait_data->gait_status_flags &= 0xFFF7; } case WALKER_GAIT_TRANSITION_TO_DOWNHILL: @@ -296,11 +296,11 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); } gait_data->gait_state = WALKER_GAIT_RUN; - } else if (flags & 5) { + } else if (gait_update_trigger_mask & 5) { if (gait_data->gait_status_flags & 1) { gait_data->gait_status_flags = (gait_data->gait_status_flags & 0xFFFE) | 2; gait_data->gait_ground_height_reference = walker_moby->pos[2]; - if (flags & 1) { + if (gait_update_trigger_mask & 1) { int bl = truncate_float_to_s32(gait_data->anim[11]->transition_position_span * 0.25f / (speed / gait_data->anim[11]->f08)); @@ -339,7 +339,7 @@ void walker_update_gait(WalkMoby *walker_moby, ground_probe_position[1] = fast_sin(movement_heading) * gait_data->anim[gait_animation_index]->f04 * 0.5f; ground_probe_position[2] = 0.0f; - if (flags & 1) { + if (gait_update_trigger_mask & 1) { fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); @@ -356,7 +356,7 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) > gait_data->terrain_transition_height_scale * 0.75f) { - if (flags & 1) { + if (gait_update_trigger_mask & 1) { int bl = truncate_float_to_s32( gait_data->anim[2]->transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); @@ -394,7 +394,7 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(gait_data->ground_probe_correction_angle) < -gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_status_flags |= 8; - if (flags & 1) { + if (gait_update_trigger_mask & 1) { int bl = truncate_float_to_s32( gait_data->anim[5]->transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); @@ -529,7 +529,7 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(gait_data->ground_probe_correction_angle) < -gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_status_flags |= 8; - if (flags & 1) { + if (gait_update_trigger_mask & 1) { int bl = truncate_float_to_s32( gait_data->anim[5]->transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); @@ -566,7 +566,7 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) < gait_data->terrain_transition_height_scale * 0.75f) { - if (flags & 1) { + if (gait_update_trigger_mask & 1) { int bl = truncate_float_to_s32( gait_data->anim[1]->transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); @@ -784,7 +784,7 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) > gait_data->terrain_transition_height_scale * 0.75f) { - if (flags & 1) { + if (gait_update_trigger_mask & 1) { int bl = truncate_float_to_s32( gait_data->anim[2]->transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); @@ -821,7 +821,7 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) > -gait_data->terrain_transition_height_scale * 0.75f) { - if (flags & 1) { + if (gait_update_trigger_mask & 1) { int bl = truncate_float_to_s32( gait_data->anim[4]->transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); @@ -973,11 +973,11 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); } gait_data->gait_state = WALKER_GAIT_WALK; - } else if (flags & 5) { + } else if (gait_update_trigger_mask & 5) { if (gait_data->gait_status_flags & 1) { gait_data->gait_status_flags = (gait_data->gait_status_flags & 0xFFFE) | 2; gait_data->gait_ground_height_reference = walker_moby->pos[2]; - if (flags & 1) { + if (gait_update_trigger_mask & 1) { int bl = truncate_float_to_s32(gait_data->anim[11]->transition_position_span * 0.25f / (speed / gait_data->anim[11]->f08)); @@ -1015,7 +1015,7 @@ void walker_update_gait(WalkMoby *walker_moby, ground_probe_position[1] = fast_sin(movement_heading) * gait_data->anim[0]->f04 * 0.5f; ground_probe_position[2] = 0.0f; - if (flags & 1) { + if (gait_update_trigger_mask & 1) { fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); @@ -1041,7 +1041,7 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->gait_state = WALKER_GAIT_IDLE; break; case WALKER_GAIT_TAKEOFF_ANIMATION: - if (flags & 0x30) { + if (gait_update_trigger_mask & 0x30) { float dist = vector_distance_xy(walker_moby->pos, gait_data->jump_target_position); debug_print(walker_jump_distance_debug_format, dist); gait_data->jump_vertical_velocity = @@ -1081,7 +1081,7 @@ void walker_update_gait(WalkMoby *walker_moby, } break; case WALKER_GAIT_ALTERNATE_TAKEOFF_ANIMATION: - if (flags & 0x30) { + if (gait_update_trigger_mask & 0x30) { float dist = fast_vec_dist(walker_moby->pos, gait_data->jump_target_position); debug_print(walker_jump_distance_debug_format, dist); gait_data->jump_vertical_velocity = @@ -1200,7 +1200,7 @@ void walker_update_gait(WalkMoby *walker_moby, } break; case WALKER_GAIT_RESUME_RUN_AFTER_LANDING: - if (flags & 1) { + if (gait_update_trigger_mask & 1) { int bl = truncate_float_to_s32( (gait_data->anim[7]->transition_position_span * 0.25f + 2.0f) / (speed / gait_data->anim[7]->f08)); @@ -1229,7 +1229,7 @@ void walker_update_gait(WalkMoby *walker_moby, } break; case WALKER_GAIT_RESUME_RUN_AFTER_ALTERNATE_LANDING: - if (flags & 1) { + if (gait_update_trigger_mask & 1) { int bl = truncate_float_to_s32( (gait_data->anim[7]->alternate_transition_position_span * 0.25f + 2.0f) / (speed / gait_data->anim[7]->f08)); From 78702cc9e65374f699153ee6f235395726b9cdd2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:45:16 +0000 Subject: [PATCH 358/657] decomp: clarify names in mine_update mode -> homing_phase: In mine_update, int mode receives v->h52 only inside the active homing-target branch. Retail 0x002ab5ac loads private-data+0x52 as a signed halfword; 0x002ab5b4 tests phase 1 and 0x002ab5dc adds frame_scale*0.05 to mine Z. Timer expiry at 0x002ab5e0-0x002ab604 resets seven frames and changes phase to 2. The phase-2 branch at 0x002ab608-0x002ab640 subtracts the same Z offset and clears the phase when its timer expires. Original Ghidra shows the same +0x52 tests and timed 1->2->0 transitions; source constants MINE_HOMING_RISE_PHASE and MINE_HOMING_FALL_PHASE establish this local as the homing phase. --- src/overlays/shared/weapons/mine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/mine.c b/src/overlays/shared/weapons/mine.c index 97c2741551..8c63f2b48c 100644 --- a/src/overlays/shared/weapons/mine.c +++ b/src/overlays/shared/weapons/mine.c @@ -984,7 +984,7 @@ void mine_update(M910 *mine_moby) { { float sp; float max_homing_step; - int mode; + int homing_phase; *(OvlQuad *)n = mine_moby->pos.q; if ((mine_moby->b70 & 2) && mine_moby->b52 == 1 && mine_moby->anim != 2) { @@ -1006,7 +1006,7 @@ void mine_update(M910 *mine_moby) { v->homing_phase_timer = scale_game_frames(7); v->homing_phase = 2; } - } else if (mode == MINE_HOMING_FALL_PHASE) { + } else if (homing_phase == MINE_HOMING_FALL_PHASE) { mine_moby->pos.f[2] -= frame_scale * 0.05f; if (fast_dec_timer(&v->homing_phase_timer) != 0) { v->homing_phase = 0; From f0e371cfafcafa937a03892528e0dfff7e4e5cda Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:47:19 +0000 Subject: [PATCH 359/657] decomp: clarify names in big_axebot_update fA4 -> hit_record_index: Assigned retail 002ba744 calls find_moby_hit with the owner moby; 002bac3c resets owner+0xa4 to 255. Checked level-04 helper request 9a52304c18444177aa418fc3e5a9e095: 0024d450 loads owner+0xa4, 0024d454..0024d45c treats 255 as absent and returns null via 0024d47c; 0024d460..0024d46c shifts the byte left six and adds hit-record table base 0x00178280. At 0024d470..0024d478 record+0x34 must equal the owner; record+0x24 is tested against requested hit mask at 0024d484..0024d488, and 0024d48c/0024d4a0 returns the selected hit record. This proves the unsigned byte is the hit-record index, not update distance (checked axe spawn sets update_dist at +0x30). --- src/overlays/l04/mobys/big_axebot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l04/mobys/big_axebot.c b/src/overlays/l04/mobys/big_axebot.c index 73e2ed9f63..40a3e2b7ba 100644 --- a/src/overlays/l04/mobys/big_axebot.c +++ b/src/overlays/l04/mobys/big_axebot.c @@ -192,7 +192,7 @@ typedef struct M_B7B0 { char pad7C[3]; char f7F; char pad80[0x24]; - unsigned char fA4; + unsigned char hit_record_index; char padA5; short cls; char padA8[0x14]; @@ -477,7 +477,7 @@ void big_axebot_update(M_B7B0 *moby) { } } } - moby->fA4 = 0xFF; + moby->hit_record_index = 0xFF; if (data->extended_detection_request != 0) { data->extended_detection_timer = scale_game_frames(0xF0); } From e97689e83bcfc68bf373fe053cd082e6d99f012d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 09:47:19 +0000 Subject: [PATCH 360/657] decomp: clarify names in frog_update domain_0_value_2 -> FROG_VISIBILITY_OVERRIDE_APPLY: The established visibility_override_mode local is loaded from D_L06_0015F5C4 at retail 0x002e86bc. Its comparison with 2 at 0x002e86c0..0x002e86c4 enters 0x002e86cc..0x002e86f0: when Moby flags bit 1 is clear, it records pvars+0x1EA=1 and ORs flags with 0x41. The matching zero branch clears that remembered override and the same flags. Thus 2 applies this frog visibility override; this names its proven consumer effect, not an upstream hero state or vehicle mode. domain_1_value_0 -> FROG_VISIBILITY_OVERRIDE_RESTORE: At retail 0x002e86f4 the selector previously loaded at 0x002e86bc must equal zero before 0x002e86fc..0x002e8714 tests the remembered pvars+0x1EA override, clears it and masks Moby flags with 0xFFBE, undoing the exact 0x41 bits installed by selector 2. The authoritative C expresses this as visibility_override_mode == 0 && frog_instance_vars->unk1EA != 0. Thus 0 restores visibility after this remembered override; no shared hero enum equivalence is asserted. --- src/overlays/shared/enemies/frog.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index 322cfdd044..8ae0e83c30 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -260,6 +260,10 @@ void frog_update(unsigned char *moby) { enum { FROG_TARGET_MODE_NO_PURSUIT_TARGET = 2 }; + enum { + FROG_VISIBILITY_OVERRIDE_RESTORE = 0, + FROG_VISIBILITY_OVERRIDE_APPLY = 2 + }; float A[4] __attribute__((aligned(16))); float B[4] __attribute__((aligned(16))); float C[4] __attribute__((aligned(16))); From a0d12999a619aac7046ebf24b83fdc105029deeb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:23:01 +0000 Subject: [PATCH 361/657] decomp: clarify names in process_hero_hit_response domain_0_value_128 -> HERO_STATE_DYING_SPEED_LIMITED: Bound source SHA-256 75f24440558f1e0a5aa805d92e96f7e78aff231d13eec7e87c049845ab4f600a assigns 0x80 to hurt_response_state and passes that binding as hero_set_state's first argument. Retail 0x0022807C-0x0022808C tests damage-source classes, then 0x00228094 loads a0=0x80 and 0x00228098 calls 0x002356A0 with a1=1. Original retail Ghidra independently shows func_0x002356a0(0x80,1). Supplied hero_set_state context assigns requested_state to p->state.current, proving this is the HeroStateId domain rather than vehicle_mode, a control mode, or PAD_SQUARE. The supplied include/rnc/hero/hero_state.h enum HeroStateId canonically defines HERO_STATE_DYING_SPEED_LIMITED=128; current bound source also consumes this member in the hero.state.current movement switch. Reuse that canonical member for this state request. --- src/overlays/l06/hero/update_hero_motion_for_current_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l06/hero/update_hero_motion_for_current_state.c b/src/overlays/l06/hero/update_hero_motion_for_current_state.c index c2f7382e5b..357fd19a98 100644 --- a/src/overlays/l06/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l06/hero/update_hero_motion_for_current_state.c @@ -210,7 +210,7 @@ s32 process_hero_hit_response(s32 apply_hurt_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - hurt_response_state = 0x80; + hurt_response_state = HERO_STATE_DYING_SPEED_LIMITED; call_ret: hero_set_state(hurt_response_state, 1); return 1; From ed0e48db6e97e42ee21902e3a61529b2d48c053f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:25:11 +0000 Subject: [PATCH 362/657] decomp: clarify names in process_hero_hurt_response domain_1_value_128 -> HERO_STATE_DYING_SPEED_LIMITED: Authoritative source assigns 0x80 to hurt_response_state and immediately passes it as the first argument to hero_set_state at call_ret. Original retail decompilation calls func_0x0022b728(0x80,1); instructions 0x00220140-0x00220150 check damage-source classes, 0x00220158 loads a0=0x80, and 0x0022015c-0x00220160 call hero_set_state with a1=1. Supplied hero_set_state source stores requested_state into hero.state.current, proving this is the HeroStateId domain rather than a control or vehicle selector. Supplied include/rnc/hero/hero_state.h enum HeroStateId canonically defines HERO_STATE_DYING_SPEED_LIMITED=128, and the current motion source already handles that canonical member in its hero.state.current switch. Reuse that member without claiming this entry site establishes its full lifecycle. --- src/overlays/l02/hero/update_hero_state_motion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l02/hero/update_hero_state_motion.c b/src/overlays/l02/hero/update_hero_state_motion.c index 522e7a6168..32fb231248 100644 --- a/src/overlays/l02/hero/update_hero_state_motion.c +++ b/src/overlays/l02/hero/update_hero_state_motion.c @@ -234,7 +234,7 @@ s32 process_hero_hurt_response(s32 apply_hurt_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - hurt_response_state = 0x80; + hurt_response_state = HERO_STATE_DYING_SPEED_LIMITED; call_ret: hero_set_state(hurt_response_state, 1); return 1; From fb5b6662b954db554610510cc35885b41ca7e943 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:25:11 +0000 Subject: [PATCH 363/657] decomp: clarify names in process_hero_hit_reaction domain_0_value_128 -> HERO_STATE_DYING_SPEED_LIMITED: Authoritative source src/overlays/l14/hero/update_hero_motion_by_state.c SHA-256 b9cb7ed5087a42fcfac66093ef5e6f9b38d4aa628e4a6673dac092b01dffc1da assigns hit_reaction_state=0x80 and passes it directly as hero_set_state's first argument. Retail 00222c94-00222ca4 tests the damage-source classes; 00222cac loads a0=0x80 and 00222cb0 calls 0022ff58 with a1=1. Original retail Ghidra independently shows func_0x0022ff58(0x80,1). Supplied hero_set_state source stores requested_state into hero.state.current, proving the HeroStateId domain rather than control_mode, vehicle_mode or pad input. The shared include/rnc/hero/hero_state.h enum HeroStateId canonically defines HERO_STATE_DYING_SPEED_LIMITED=128; supplied movement source also consumes that member through switch(hero.state.current). Reuse this canonical member. --- src/overlays/l14/hero/update_hero_motion_by_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l14/hero/update_hero_motion_by_state.c b/src/overlays/l14/hero/update_hero_motion_by_state.c index 0f09b6d366..15cc23b11b 100644 --- a/src/overlays/l14/hero/update_hero_motion_by_state.c +++ b/src/overlays/l14/hero/update_hero_motion_by_state.c @@ -203,7 +203,7 @@ s32 process_hero_hit_reaction(s32 apply_hit_reaction) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - hit_reaction_state = 0x80; + hit_reaction_state = HERO_STATE_DYING_SPEED_LIMITED; call_ret: hero_set_state(hit_reaction_state, 1); return 1; From 8098a5d2a5d4b0fab9a9baf171f5b9e2701f3f5b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:27:13 +0000 Subject: [PATCH 364/657] decomp: clarify names in resolve_hero_position_with_collision_queries domain_0_value_15 -> HERO_LARGE_CORRECTION_LIMIT_TO_CAPSULE_RADIUS: Incoming a0 is saved in s8 at 0x00233950. After current minus pre-collision position is measured at 0x00233ba4-0x00233bb8, 0x00233bbc-0x00233bd8 gates on length > 1.5*capsule_radius. The comparison at 0x00233bdc-0x00233be0 allows value 15 to enter component clamps at 0x00233be8-0x00233ca4, normalize the correction to hero.capsule_radius at 0x00233cac-0x00233cb8, then replace position with saved entry position plus that correction at 0x00233cbc-0x00233cc8. Other values skip adjustment and return -1. This proves a local large-correction limiting behavior; no shared HeroStateId equivalence is asserted. --- src/overlays/shared/hero/hero_frame_update.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/hero/hero_frame_update.c b/src/overlays/shared/hero/hero_frame_update.c index f0fc13bbca..ccae5e2ab9 100644 --- a/src/overlays/shared/hero/hero_frame_update.c +++ b/src/overlays/shared/hero/hero_frame_update.c @@ -1350,6 +1350,9 @@ extern u128_233940 D_L01_001742F0[] NOT_SDA; s32 resolve_hero_position_with_collision_queries(s32 mode) __asm__("FUN_L01_00233940"); s32 resolve_hero_position_with_collision_queries(s32 large_correction_mode) { + enum { + HERO_LARGE_CORRECTION_LIMIT_TO_CAPSULE_RADIUS = 0xF + }; V_233940 pre_collision_position; V_233940 collision_query_offset; V_233940 resolved_position_delta; @@ -1416,7 +1419,7 @@ s32 resolve_hero_position_with_collision_queries(s32 large_correction_mode) { fast_vec_sub(&resolved_position_delta, &hero.motion.pos.q, &pre_collision_position); query_height_or_displacement_length = fast_vec_length(&resolved_position_delta); if (hero.capsule_radius * 1.5f < query_height_or_displacement_length) { - if (large_correction_mode == 0xF) { + if (large_correction_mode == HERO_LARGE_CORRECTION_LIMIT_TO_CAPSULE_RADIUS) { if (512.0f < resolved_position_delta.f[0]) resolved_position_delta.f[0] = 512.0f; else if (resolved_position_delta.f[0] < -512.0f) From d41f0808c348e76874002e49ca14de84ea212e09 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:29:03 +0000 Subject: [PATCH 365/657] decomp: clarify names in resolve_hero_position_collisions domain_0_value_15 -> EXCESS_DISPLACEMENT_NORMALIZE_TO_CAPSULE_RADIUS: Incoming a0 is preserved in s8 at retail 0x00240ee0 and compared against 0xF at 0x002411dc-0x002411e0 only after resolved displacement length exceeds capsule_radius*1.5 at 0x002411ac-0x002411d8. The selected branch bounds all three displacement components to +/-512 at 0x002411e8-0x002412a4, loads hero.capsule_radius into f12 at 0x002412b0, normalizes resolved_displacement in place at 0x002412b4, then adds it to initial_position at 0x002412c4. Original Ghidra param_1==0xf and authoritative C excess_displacement_mode==0xF show the same branch. This proves the local response name independently of any shared state enum. --- src/overlays/l05/hero/apply_hero_ground_material_effects.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l05/hero/apply_hero_ground_material_effects.c b/src/overlays/l05/hero/apply_hero_ground_material_effects.c index 9e555f1563..1065f17ace 100644 --- a/src/overlays/l05/hero/apply_hero_ground_material_effects.c +++ b/src/overlays/l05/hero/apply_hero_ground_material_effects.c @@ -399,6 +399,9 @@ extern u128_2133a8 D_L05_00174270[] NOT_SDA; s32 resolve_hero_position_collisions(s32 mode) __asm__("FUN_L05_00240ed0"); s32 resolve_hero_position_collisions(s32 excess_displacement_mode) { + enum { + EXCESS_DISPLACEMENT_NORMALIZE_TO_CAPSULE_RADIUS = 0xF + }; V_2133a8 initial_position; V_2133a8 collision_query_offset; V_2133a8 resolved_displacement; @@ -472,7 +475,7 @@ s32 resolve_hero_position_collisions(s32 excess_displacement_mode) { fast_vec_sub(&resolved_displacement, &hero.motion.pos.q, &initial_position); query_height_or_displacement_length = fast_vec_length(&resolved_displacement); if (hero.capsule_radius * 1.5f < query_height_or_displacement_length) { - if (excess_displacement_mode == 0xF) { + if (excess_displacement_mode == EXCESS_DISPLACEMENT_NORMALIZE_TO_CAPSULE_RADIUS) { if (512.0f < resolved_displacement.f[0]) resolved_displacement.f[0] = 512.0f; else if (resolved_displacement.f[0] < -512.0f) From 43ca43c3709add1637962d6f8f6c21b4348d1327 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:29:03 +0000 Subject: [PATCH 366/657] decomp: clarify names in handle_hero_hit domain_1_value_128 -> HERO_STATE_DYING_SPEED_LIMITED: Authoritative source handle_hero_hit assigns hit_response_state=0x80 after damage-source class 0x4EB/0x558 tests and passes it to hero_set_state at call_ret. Retail 002229ec-00222a04 performs those tests and loads a0=0x80; 00222a08 calls checked hero_set_state 00230b38 with a1=1. This is the same state-ID argument domain as the existing HERO_STATE_HURT calls at 00222b2c-00222b44, not the separately loaded control_mode or vehicle_mode. Supplied include/rnc/hero/hero_state.h HeroStateId canonically names 128 HERO_STATE_DYING_SPEED_LIMITED. domain_2_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: In the authoritative source control_mode 0x12 branch, source class 0x28F selects hit_response_state=0x82 and jumps to call_ret, hero_set_state(hit_response_state,1). Retail 00222a60-00222a78 loads the damage-source pointer, tests its +0xA6 class against 0x28F, and loads a0=0x82 in the branch delay slot before the shared state-setter call at 00222a08. The consumer proves the HeroStateId domain, shared with existing HERO_STATE_HURT calls; supplied hero_state.h canonically names 130 HERO_STATE_DYING_ZERO_HEALTH. The control-mode comparison itself is a separate domain. domain_3_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: Authoritative source control_mode 0x11 branch assigns hit_response_state=0x82 only for damage-source class 0x28F and jumps to the same hero_set_state call_ret. Retail 00222a8c-00222aac tests the source and class, then branches to 00222a08 with a0=0x82. The value is consumed as the first hero_set_state argument, proving HeroStateId rather than control_mode or vehicle_mode. Supplied include/rnc/hero/hero_state.h declares canonical HeroStateId member HERO_STATE_DYING_ZERO_HEALTH=130, which must be reused for this state request. domain_4_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: Authoritative source control_mode 3 branch assigns hit_response_state=0x82 when damage_source_moby exists and takes call_ret only when its +0xA6 class is 0x28F; otherwise it requests existing HERO_STATE_HURT. Retail 00222b10-00222b28 confirms the source/class test and a0=0x82 on the branch to hero_set_state at 00222a08. Thus the assigned value belongs to the same HeroStateId argument domain as HERO_STATE_HURT, not the control_mode selector value 3. Supplied hero_state.h canonically defines HERO_STATE_DYING_ZERO_HEALTH=130. --- src/overlays/shared/hero/handle_hero_hit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/handle_hero_hit.c b/src/overlays/shared/hero/handle_hero_hit.c index e2c2fa516d..6ed330f8cf 100644 --- a/src/overlays/shared/hero/handle_hero_hit.c +++ b/src/overlays/shared/hero/handle_hero_hit.c @@ -88,7 +88,7 @@ s32 handle_hero_hit(s32 apply_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - hit_response_state = 0x80; + hit_response_state = HERO_STATE_DYING_SPEED_LIMITED; call_ret: hero_set_state(hit_response_state, 1); return 1; @@ -101,14 +101,14 @@ s32 handle_hero_hit(s32 apply_response) { if (G.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - hit_response_state = 0x82; + hit_response_state = HERO_STATE_DYING_ZERO_HEALTH; goto call_ret; } hero_set_state(0x75, 1); } else if (G.state.control_mode == HERO_MODE_SWIM) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - hit_response_state = 0x82; + hit_response_state = HERO_STATE_DYING_ZERO_HEALTH; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -122,7 +122,7 @@ s32 handle_hero_hit(s32 apply_response) { } else if (G.state.control_mode == HERO_MODE_LEDGE) { mob = (u8 *)G.damage_source_moby; if (mob != 0) { - hit_response_state = 0x82; + hit_response_state = HERO_STATE_DYING_ZERO_HEALTH; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From d1a39d887232ad85ed0ccda3743c1824de6985d4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:30:48 +0000 Subject: [PATCH 367/657] decomp: clarify names in process_hero_hit_response domain_0_value_128 -> HERO_STATE_DYING_SPEED_LIMITED: Source hit_response_state is passed directly to hero_set_state(hit_response_state, 1) at call_ret, the same state-ID consumer used with HERO_STATE_HURT. Original retail uVar6=0x80 reaches LAB_0020de0c; instructions 0x0020de08 load a0=0x80 and 0x0020de0c call hero_set_state at 0x0021e530. This proves HeroStateId domain membership, allowing canonical HERO_STATE_DYING_SPEED_LIMITED=128 from include/rnc/hero/hero_state.h, rather than inferring from the triggering object classes. domain_1_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: In the control_mode 0x12 branch, source assigns hit_response_state=0x82 for damage-source class 0x28F and jumps to call_ret, which passes it to hero_set_state. Retail 0x0020de78 branches to 0x0020de0c with delay-slot 0x0020de7c loading a0=0x82. The original decompilation likewise passes uVar6=0x82 to that state setter. Its destination is the same HeroStateId consumer used for HERO_STATE_HURT, so reuse the supplied canonical HERO_STATE_DYING_ZERO_HEALTH=130; control_mode itself is a separate domain. domain_2_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: In the control_mode 0x11 branch, source assigns hit_response_state=0x82 after damage-source class 0x28F and jumps to hero_set_state at call_ret. Retail 0x0020deac branches to the state setter call at 0x0020de0c and 0x0020deb0 loads a0=0x82 in its delay slot; original Ghidra represents this as uVar6=0x82 and goto LAB_0020de0c. The consumer proves the shared HeroStateId domain, whose supplied canonical member for 130 is HERO_STATE_DYING_ZERO_HEALTH. domain_3_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: In the control_mode 3 branch, source assigns hit_response_state=0x82 when a damage source exists and passes it to hero_set_state only when the source class is 0x28F. Retail 0x0020df28 branches to 0x0020de0c with 0x0020df2c loading a0=0x82; the other path replaces a0 with HERO_STATE_HURT's 0x16 at 0x0020df30. Original Ghidra confirms this state-selection flow. Thus the assigned value belongs to HeroStateId and reuses canonical HERO_STATE_DYING_ZERO_HEALTH=130, independently of control_mode 3. --- src/overlays/l17/hero/process_hero_hit_response.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l17/hero/process_hero_hit_response.c b/src/overlays/l17/hero/process_hero_hit_response.c index 6cc1d6ed85..f5ed2c9eb1 100644 --- a/src/overlays/l17/hero/process_hero_hit_response.c +++ b/src/overlays/l17/hero/process_hero_hit_response.c @@ -140,7 +140,7 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - hit_response_state = 0x80; + hit_response_state = HERO_STATE_DYING_SPEED_LIMITED; call_ret: hero_set_state(hit_response_state, 1); return 1; @@ -153,14 +153,14 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { if (G.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - hit_response_state = 0x82; + hit_response_state = HERO_STATE_DYING_ZERO_HEALTH; goto call_ret; } hero_set_state(0x75, 1); } else if (G.state.control_mode == HERO_MODE_SWIM) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - hit_response_state = 0x82; + hit_response_state = HERO_STATE_DYING_ZERO_HEALTH; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -174,7 +174,7 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { } else if (G.state.control_mode == HERO_MODE_LEDGE) { mob = (u8 *)G.damage_source_moby; if (mob != 0) { - hit_response_state = 0x82; + hit_response_state = HERO_STATE_DYING_ZERO_HEALTH; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From ae85245c071fd7c1a06940afde58358d3e437d3f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:32:42 +0000 Subject: [PATCH 368/657] decomp: clarify names in hero_check_damage domain_0_value_128 -> HERO_STATE_DYING_SPEED_LIMITED: Retail 0x00210f4c..0x00210f60 checks damage-source moby class 0x4EB/0x558, then 0x00210f64 loads a0=0x80 for hero_set_state at 0x00210f68. Original Ghidra uVar6=0x80 reaches the same call. Bound C assigns damage_response_state and immediately passes it to hero_set_state(damage_response_state,1), proving the HeroStateId domain used by the same function's HERO_STATE_HURT calls. Reuse canonical HeroStateId member HERO_STATE_DYING_SPEED_LIMITED=128 from include/rnc/hero/hero_state.h. domain_1_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: In the control_mode 0x12 branch, retail 0x00210fc0..0x00210fd4 checks damage-source moby class 0x28F and 0x00210fd8 loads a0=0x82 in the branch delay slot for hero_set_state at 0x00210f68. Original Ghidra uVar6=0x82 flows to that call. Bound C's damage_response_state assignment reaches call_ret and hero_set_state directly, proving HeroStateId rather than the tested control-mode domain. Reuse canonical HERO_STATE_DYING_ZERO_HEALTH=130 from HeroStateId. domain_2_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: In the control_mode 0x11 branch, retail 0x00210fec..0x00211000 tests nonnull damage source and class 0x28F; 0x00211008 branches to hero_set_state at 0x00210f68 with a0=0x82 loaded at 0x0021100c. Original Ghidra likewise sends uVar6=0x82 to LAB_00210f68. Bound C passes damage_response_state as the hero state setter's first argument, proving HeroStateId. Reuse its canonical HERO_STATE_DYING_ZERO_HEALTH=130, not a control-mode constant. domain_3_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: In the control_mode 3 branch, retail 0x00211070..0x00211084 checks nonnull damage-source moby and class 0x28F; 0x00211088 loads a0=0x82 for the taken branch to hero_set_state at 0x00210f68. Original Ghidra uVar6=0x82 has the same use. Bound C assigns damage_response_state before the class test but consumes it only through goto call_ret and hero_set_state(damage_response_state,1), proving the HeroStateId domain. Reuse canonical HERO_STATE_DYING_ZERO_HEALTH=130. --- src/overlays/shared/hero/hero_switch_item.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index d16014b6bf..6f05e7a593 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -2542,7 +2542,7 @@ s32 hero_check_damage(s32 apply_damage_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - damage_response_state = 0x80; + damage_response_state = HERO_STATE_DYING_SPEED_LIMITED; call_ret: hero_set_state(damage_response_state, 1); return 1; @@ -2555,14 +2555,14 @@ s32 hero_check_damage(s32 apply_damage_response) { if (hero.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - damage_response_state = 0x82; + damage_response_state = HERO_STATE_DYING_ZERO_HEALTH; goto call_ret; } hero_set_state(0x75, 1); } else if (hero.state.control_mode == HERO_MODE_SWIM) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - damage_response_state = 0x82; + damage_response_state = HERO_STATE_DYING_ZERO_HEALTH; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -2576,7 +2576,7 @@ s32 hero_check_damage(s32 apply_damage_response) { } else if (hero.state.control_mode == HERO_MODE_LEDGE) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0) { - damage_response_state = 0x82; + damage_response_state = HERO_STATE_DYING_ZERO_HEALTH; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From d06f23420c48ebee4b93e9d94a9855e8aeeccc91 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:35:31 +0000 Subject: [PATCH 369/657] decomp: clarify names in process_hero_incoming_hit domain_0_value_128 -> HERO_STATE_DYING_SPEED_LIMITED: Retail 0020904c-00209064 tests damage-source Moby class 0x4EB/0x558 and loads a0=0x80; 00209068 calls hero_set_state (00216c38) with a1=1, then returns. Source hit_reaction_state flows directly to hero_set_state at call_ret, proving the HeroStateId domain. Supplied include/rnc/hero/hero_state.h declares canonical HERO_STATE_DYING_SPEED_LIMITED=128; the same source's motion handler consumes that member under switch(hero.state.current). domain_1_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: In control_mode 0x12, retail 002090c0-002090d8 tests damage_source_moby class 0x28F and passes a0=0x82 to the shared hero_set_state call at 00209068. Source assigns hit_reaction_state then goto call_ret, proving this is a HeroStateId rather than a control mode. Supplied shared HeroStateId canonically defines HERO_STATE_DYING_ZERO_HEALTH=130; the source motion handler consumes it in switch(hero.state.current), grouped with HERO_STATE_DROWN. domain_2_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: In control_mode 0x11, retail 002090ec-0020910c checks damage_source_moby class 0x28F and branches to 00209068 with a0=0x82 for hero_set_state(a0,1). Source hit_reaction_state assignment reaches that same setter via call_ret. This proves the shared HeroStateId domain, whose supplied canonical member is HERO_STATE_DYING_ZERO_HEALTH=130, also consumed by the same source's current-state motion switch. domain_3_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: For control_mode 3, source assigns hit_reaction_state=0x82 when damage_source_moby exists and uses it only when its class is 0x28F. Retail 00209170-00209188 confirms the class test and delay-slot a0=0x82 on the branch to hero_set_state at 00209068. The setter argument proves HeroStateId domain membership; reuse supplied canonical HERO_STATE_DYING_ZERO_HEALTH=130 rather than a control-mode or vehicle-mode constant. --- .../l15/hero/update_hero_motion_for_current_state.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l15/hero/update_hero_motion_for_current_state.c b/src/overlays/l15/hero/update_hero_motion_for_current_state.c index 6bf5843430..91be1a97a5 100644 --- a/src/overlays/l15/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l15/hero/update_hero_motion_for_current_state.c @@ -267,7 +267,7 @@ s32 process_hero_incoming_hit(s32 apply_hit_reaction) { case HERO_VEHICLE_MODE_ON_FOOT: mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - hit_reaction_state = 0x80; + hit_reaction_state = HERO_STATE_DYING_SPEED_LIMITED; call_ret: hero_set_state(hit_reaction_state, 1); return 1; @@ -280,14 +280,14 @@ s32 process_hero_incoming_hit(s32 apply_hit_reaction) { if (hero.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - hit_reaction_state = 0x82; + hit_reaction_state = HERO_STATE_DYING_ZERO_HEALTH; goto call_ret; } hero_set_state(0x75, 1); } else if (hero.state.control_mode == HERO_MODE_SWIM) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - hit_reaction_state = 0x82; + hit_reaction_state = HERO_STATE_DYING_ZERO_HEALTH; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -301,7 +301,7 @@ s32 process_hero_incoming_hit(s32 apply_hit_reaction) { } else if (hero.state.control_mode == HERO_MODE_LEDGE) { mob = ((u8 *)hero.damage_source_moby); if (mob != 0) { - hit_reaction_state = 0x82; + hit_reaction_state = HERO_STATE_DYING_ZERO_HEALTH; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From b771affd79820ee606bcaf86d052263bee996474 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:37:32 +0000 Subject: [PATCH 370/657] decomp: clarify names in process_hero_hit_response domain_0_value_128 -> HERO_STATE_DYING_SPEED_LIMITED: Bound source SHA-256 155d73e891e25fd0be2047e8cde082f1ccaa956edb818874cefc0707ad00b390 assigns 0x80 to hit_response_state and immediately passes it at call_ret to l01_hero_set_state. Retail 0x00231750-0x00231770 checks damage-source classes 0x4EB/0x558 and loads a0=0x80 for jal 0x0023cf98. Original Ghidra uVar5=0x80 reaches LAB_0023176c. Supplied l01_hero_set_state source stores requested_state into p->state.current, proving the HeroStateId domain; include/rnc/hero/hero_state.h canonically names 128 HERO_STATE_DYING_SPEED_LIMITED. domain_1_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: The bound source assigns 0x82 to hit_response_state when control_mode is 0x12 and damage_source_moby class is 0x28F, then goes to call_ret. Retail 0x002317bc-0x002317dc branches to jal 0x0023cf98 at 0x0023176c with a0=0x82; original Ghidra confirms this flow. Supplied setter source writes requested_state into p->state.current, proving HeroStateId rather than the control-mode domain. Its shared header canonically names 130 HERO_STATE_DYING_ZERO_HEALTH. domain_2_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: For control_mode 0x11, bound source assigns hit_response_state=0x82 on damage-source class 0x28F and goes to call_ret. Retail 0x002317e8-0x00231810 checks that class and branches to 0x0023176c, supplying a0=0x82 to l01_hero_set_state; original Ghidra uVar5 confirms it. Supplied setter writes requested_state into p->state.current. Thus this value belongs to shared HeroStateId, whose canonical member for 130 is HERO_STATE_DYING_ZERO_HEALTH. domain_3_value_130 -> HERO_STATE_DYING_ZERO_HEALTH: In the control_mode==3 branch, bound source assigns hit_response_state=0x82 for a nonnull damage source and uses it at call_ret only when its class is 0x28F. Retail 0x0023186c-0x0023188c checks these conditions and branches to jal 0x0023cf98 at 0x0023176c with a0=0x82. Original Ghidra corroborates the selected state. Setter source stores requested_state into p->state.current, proving shared HeroStateId; its canonical 130 member is HERO_STATE_DYING_ZERO_HEALTH. --- src/overlays/shared/hero/hero_frame_update.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/hero_frame_update.c b/src/overlays/shared/hero/hero_frame_update.c index ccae5e2ab9..403354a18d 100644 --- a/src/overlays/shared/hero/hero_frame_update.c +++ b/src/overlays/shared/hero/hero_frame_update.c @@ -893,7 +893,7 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { case HERO_VEHICLE_MODE_ON_FOOT: mob = (u8 *)G.damage_source_moby; if (mob != 0 && (*(s16 *)(mob + 0xA6) == 0x4EB || *(s16 *)(mob + 0xA6) == 0x558)) { - hit_response_state = 0x80; + hit_response_state = HERO_STATE_DYING_SPEED_LIMITED; call_ret: l01_hero_set_state(hit_response_state, 1); return 1; @@ -906,14 +906,14 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { if (G.state.control_mode == HERO_MODE_WATER_SURFACE) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - hit_response_state = 0x82; + hit_response_state = HERO_STATE_DYING_ZERO_HEALTH; goto call_ret; } l01_hero_set_state(0x75, 1); } else if (G.state.control_mode == HERO_MODE_SWIM) { mob = (u8 *)G.damage_source_moby; if (mob != 0 && *(s16 *)(mob + 0xA6) == 0x28F) { - hit_response_state = 0x82; + hit_response_state = HERO_STATE_DYING_ZERO_HEALTH; goto call_ret; } if (current_level_index == LEVEL_QUARTU || current_level_index == LEVEL_VELDIN_ORBIT) { @@ -927,7 +927,7 @@ s32 process_hero_hit_response(s32 apply_state_and_motion_response) { } else if (G.state.control_mode == HERO_MODE_LEDGE) { mob = (u8 *)G.damage_source_moby; if (mob != 0) { - hit_response_state = 0x82; + hit_response_state = HERO_STATE_DYING_ZERO_HEALTH; if (*(s16 *)(mob + 0xA6) == 0x28F) { goto call_ret; } From 5f6e2023ca925b29ca5a8c3496ad721755f27b72 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 10:39:23 +0000 Subject: [PATCH 371/657] decomp: clarify names in resolve_hero_position_collisions domain_0_value_15 -> EXCESSIVE_CORRECTION_LIMIT_TO_CAPSULE_RADIUS: Incoming a0 is saved in s8 at 0x00222280 and compared to 15 at 0x002224d8 only after corrected position minus entry position (0x0022249c-0x002224a8) has length exceeding capsule_radius * 1.5 (0x002224ac-0x002224d0). Equality selects component clamps to +/-512 at 0x002224e0-0x0022259c, normalization of that correction to hero.capsule_radius at 0x002225a4-0x002225b0, and reconstruction of hero position from entry position plus the limited correction at 0x002225b4-0x002225c0. Thus the literal selects a locally proven excessive-correction policy that limits displacement to the capsule radius; no HeroStateId equivalence is asserted. --- src/overlays/l02/hero/update_hero_state_motion.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l02/hero/update_hero_state_motion.c b/src/overlays/l02/hero/update_hero_state_motion.c index 32fb231248..4a4d451301 100644 --- a/src/overlays/l02/hero/update_hero_state_motion.c +++ b/src/overlays/l02/hero/update_hero_state_motion.c @@ -577,6 +577,9 @@ extern u128_222270 D_L02_00174470[] NOT_SDA; s32 resolve_hero_position_collisions(s32 mode) __asm__("FUN_L02_00222270"); s32 resolve_hero_position_collisions(s32 excessive_correction_mode) { + enum { + EXCESSIVE_CORRECTION_LIMIT_TO_CAPSULE_RADIUS = 0xF + }; V_222270 pre_collision_position; V_222270 collision_probe_offset; V_222270 corrected_displacement; @@ -640,7 +643,7 @@ s32 resolve_hero_position_collisions(s32 excessive_correction_mode) { fast_vec_sub(&corrected_displacement, &hero.motion.pos.q, &pre_collision_position); probe_height_or_displacement_length = fast_vec_length(&corrected_displacement); if (hero.capsule_radius * 1.5f < probe_height_or_displacement_length) { - if (excessive_correction_mode == 0xF) { + if (excessive_correction_mode == EXCESSIVE_CORRECTION_LIMIT_TO_CAPSULE_RADIUS) { if (512.0f < corrected_displacement.f[0]) corrected_displacement.f[0] = 512.0f; else if (corrected_displacement.f[0] < -512.0f) From 5435e7ca02ca23efbbc7490221839e239a289862 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:49:50 +0000 Subject: [PATCH 372/657] decomp: clarify names in create_linked_class_0326_moby t78 -> nanotech_ball_private_state: Retail 0x002d8154-0x002d815c allocates class 0x326 (806); 0x002d8168 loads its +0x78 pointer into v1, and 0x002d817c stores the input owner s0 through v1+0xC. Original Ghidra expresses the same nested owner store. Authoritative C expresses this as spawned_moby->t78->p = p, with T2d8138 containing the owner pointer at +0xC. The supplied nanotech_ball_update is explicitly class 806 and casts moby->pvars to D_2D9EA0, whose owner member follows two floats and two shorts at +0xC; FOLLOW_OWNER reads that owner and copies its position, matching the creator's owner link and position copy at 0x002d8190-0x002d8194. Thus t78 is the nanotech ball's private state pointer, not the owner pointer itself. --- src/overlays/shared/pickups/nanotech_ball.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/pickups/nanotech_ball.c b/src/overlays/shared/pickups/nanotech_ball.c index a85e3cb82c..092f7c5b8a 100644 --- a/src/overlays/shared/pickups/nanotech_ball.c +++ b/src/overlays/shared/pickups/nanotech_ball.c @@ -51,7 +51,7 @@ typedef struct { char pad3[3]; unsigned short h34; char pad4[0x42]; - T2d8138 *t78; + T2d8138 *nanotech_ball_private_state; char pad5[0x18]; int f94; } O2d8138; @@ -1031,7 +1031,7 @@ O2d8138 *create_linked_class_0326_moby(P2d8138 *p) { if (spawned_moby) { spawned_moby->b30 = 0x40; spawned_moby->b20 = 0; - spawned_moby->t78->p = p; + spawned_moby->nanotech_ball_private_state->p = p; spawned_moby->f94 = 0; spawned_moby->h34 |= 0x41; qcopy(&spawned_moby->q, &p->q); From c57fe46a6b80ad1379ff58fd65fba8696e66715e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:51:44 +0000 Subject: [PATCH 373/657] decomp: clarify names in handle_sand_shark_damage_and_targeting t25C -> proximity_range_refresh_delay: Vars5c88 short at +0x25C is passed to fast_dec_timer_s16 at retail 0x002d5d5c-0x002d5d60. The branch at 0x002d5d64 bypasses proximity testing and timer refresh while the countdown helper reports nonzero; otherwise 0x002d5d74-0x002d5d90 tests hero XY distance <10 before loading randomized scaled 180-240 into +0x25E at 0x002d5dc0. A nonzero +0x38 request bypasses this delay. Supplied sand_shark_update initializes this same +0x25C timer with scale_game_frames(0x1518) when the linked-moby gate opens. Thus it delays proximity-triggered range refresh. t25E -> target_selection_range_extension_timer: Vars5c88 short at +0x25E receives the truncated scale_time(random_float_between(180,240)) at retail 0x002d5d98-0x002d5dc0. fast_dec_timer_s16 consumes its address at 0x002d5dc8-0x002d5dcc; 0x002d5dd0-0x002d5df0 selects base_target_selection_range or that range +5 for effective_target_selection_range according to expiry. That effective range feeds target selection at 0x002d6050-0x002d6070 and target-home rejection at 0x002d6080-0x002d6098. Supplied extend_group_sand_shark_timers also extends this same +0x25E countdown, corroborating its temporary range-extension role. --- src/overlays/l02/mobys/sand_shark.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 647565ef36..b7404a4c88 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -1300,7 +1300,7 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { MOBY(moby)->pos.z -= 10.0f; } if (moby_vars->target_range_timer_refresh_request != 0 || - (!fast_dec_timer_s16(&moby_vars->t25C) && + (!fast_dec_timer_s16(&moby_vars->proximity_range_refresh_delay) && vector_distance_xy(moby + 0x10, &hero.motion.pos) < 10.0f)) { moby_vars->range_boost_timer = truncate_float_to_s32(scale_time(random_float_between(180.0f, 240.0f))); From fb7ca82cafe53d4cd33ea46990326eb00f728f67 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:51:47 +0000 Subject: [PATCH 374/657] decomp: clarify names in woodcut_bot_update t3C2 -> action_selection_cooldown: WBData short at d+0x3C2 is loaded and tested at retail 0x002d2030-0x002d2034 and 0x002d2464-0x002d2468: nonzero bypasses target distance/bearing/path decisions in IDLE and PLAY_ANIMATION_AND_EMIT_DEBRIS. Its address is saved at 0x002d1cd8-0x002d1ce4 and passed to fast_dec_timer_s16 at 0x002d1ea4-0x002d1ea8 each update. Recoil-to-idle reloads scale_game_frames(0xB4) at 0x002d1c98-0x002d1ca4, while melee completion and recovery exit clear it at 0x002d2ba0 and 0x002d2fec. Authoritative C and original Ghidra confirm a cooldown gating action selection, not a general animation timer. t3C4 -> hit_response_cooldown: WBData short at d+0x3C4 is passed to fast_dec_timer_s16 at retail 0x002d1818-0x002d181c. After hit_reaction yields damage, 0x002d18b4-0x002d18b8 skips damage subtraction and reaction dispatch while this timer is nonzero. Hit-recovery entry reloads scale_game_frames(15) at 0x002d1bf0-0x002d1bfc; recoil-to-idle reloads scale_game_frames(30) at 0x002d1c90-0x002d1ca0. Original Ghidra and authoritative C show the same decrement, gate, and reload flow, proving a hit-response cooldown without claiming invulnerability in other consumers. t3C6 -> excitement_timer: Retail 0x002d1710-0x002d1728 sets excited when pending_excitement or WBData short d+0x3C6 is nonzero; 0x002d1730-0x002d1748 then doubles target_engagement_range while excited. Pending excitement reloads scale_game_frames(240) at 0x002d1cbc-0x002d1cd4 and is consumed; hit responses also reload the timer at 0x002d1ca8-0x002d1cb0. The field is decremented via fast_dec_timer_s16 at 0x002d1cdc-0x002d1ce4 and cleared during initialization at 0x002d1f14. Original Ghidra and authoritative C prove that this countdown sustains the function's excited behavior. --- src/overlays/l04/mobys/woodcut_bot.c | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index b19a590222..6189a88d39 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -204,9 +204,9 @@ typedef struct WBData { /* 0x3B0 */ float initial_position[4]; /* 0x3C0 */ unsigned char initial_debris_animation_enabled; /* 0x3C1 */ unsigned char saved_non_recovery_state; - /* 0x3C2 */ short t3C2; - /* 0x3C4 */ short t3C4; - /* 0x3C6 */ short t3C6; + /* 0x3C2 */ short action_selection_cooldown; + /* 0x3C4 */ short hit_response_cooldown; + /* 0x3C6 */ short excitement_timer; /* 0x3C8 */ float recoil_tilt_angle; /* 0x3CC */ char pad3CC[4]; /* 0x3D0 */ float yaw_turn_spring_state; @@ -335,7 +335,7 @@ void woodcut_bot_update(WBMoby *m) { float target_distance; float hd; - if (d->pending_excitement != 0 || d->t3C6 != 0) + if (d->pending_excitement != 0 || d->excitement_timer != 0) excited = 1; select_moby_combat_target(m, selected_target_position, @@ -357,7 +357,7 @@ void woodcut_bot_update(WBMoby *m) { hd = compute_interpolated_record_value(m); qcopy(position_snapshot, pos); qcopy(duplicate_position_snapshot, pos); - fast_dec_timer_s16(&d->t3C4); + fast_dec_timer_s16(&d->hit_response_cooldown); if (m->state != WOODCUT_BOT_DEATH_KNOCKBACK && m->state != WOODCUT_BOT_INITIALIZE) { int r; @@ -372,7 +372,7 @@ void woodcut_bot_update(WBMoby *m) { r = hit_reaction(m, p, &d->hp, 0, &htype, &damage, 0, 4); d->knockback_collision_radius_scaled = 0x15E; d->knockback_ground_probe_z_offset = 0.35f; - if (p != 0 && damage != 0.0f && m->state != WOODCUT_BOT_INITIALIZE && d->t3C4 == 0) { + if (p != 0 && damage != 0.0f && m->state != WOODCUT_BOT_INITIALIZE && d->hit_response_cooldown == 0) { unsigned char *hit_source_moby; float knockback_gravity_step; float b; @@ -474,10 +474,10 @@ void woodcut_bot_update(WBMoby *m) { } m->hit_record_index = 0xFF; if (d->pending_excitement != 0) - d->t3C6 = scale_game_frames(0xF0); - tm = &d->t3C2; + d->excitement_timer = scale_game_frames(0xF0); + tm = &d->action_selection_cooldown; d->pending_excitement = 0; - fast_dec_timer_s16(&d->t3C6); + fast_dec_timer_s16(&d->excitement_timer); if (m->state == WOODCUT_BOT_MELEE_ATTACK) { if (m->anim == 4 && hd > 16.0f && hd < 27.0f) { @@ -515,7 +515,7 @@ void woodcut_bot_update(WBMoby *m) { d->f29 = 0; m->movement_recovery_flags = 0; d->vertical_fall_step = 0.0f; - d->t3C6 = 0; + d->excitement_timer = 0; d->f58 = 8; d->f5A = 8; qcopy(d->initial_position, pos); @@ -542,7 +542,7 @@ void woodcut_bot_update(WBMoby *m) { blend_moby_animation(m, 0, 0, scale_game_frames(0x14)); } } - if (d->t3C2 == 0) { + if (d->action_selection_cooldown == 0) { if (target_distance < 3.0f && adiff < 1.5707964f) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_MELEE_ATTACK; @@ -629,7 +629,7 @@ void woodcut_bot_update(WBMoby *m) { spawn_crate_debris(m, debris_horizontal_step, p, rot, 0x5EC, 0, 0.35f, 0.7f); } } - if (d->t3C2 == 0) { + if (d->action_selection_cooldown == 0) { if (target_distance < 3.0f && adiff < 1.5707964f) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_MELEE_ATTACK; @@ -791,7 +791,7 @@ void woodcut_bot_update(WBMoby *m) { break; case WOODCUT_BOT_MELEE_ATTACK: if (m->anim == 4 && (m->f70 & 2)) { - d->t3C2 = 0; + d->action_selection_cooldown = 0; blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_IDLE; } @@ -803,7 +803,7 @@ void woodcut_bot_update(WBMoby *m) { if (d->movement_path_index == -1) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_IDLE; - d->t3C2 = 0; + d->action_selection_cooldown = 0; } else { WBAngles tab = D_L04_001DC468; float v[4]; @@ -850,7 +850,7 @@ void woodcut_bot_update(WBMoby *m) { } else { blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_IDLE; - d->t3C2 = 0; + d->action_selection_cooldown = 0; } } } @@ -887,7 +887,7 @@ void woodcut_bot_update(WBMoby *m) { frame_time * 4.1887903f); } else { m->state = WOODCUT_BOT_IDLE; - d->t3C2 = 0; + d->action_selection_cooldown = 0; } } } From 6cd9ba4379866db11c8af637711a926ef203b03c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:51:50 +0000 Subject: [PATCH 375/657] decomp: clarify names in initialize_wind_spark n320 -> spark_lifetime_remaining_frames: Retail 0x002eb4fc-0x002eb510 computes and frame-scales twice the longitudinal extent divided by spark_step_distance; 0x002eb514-0x002eb524 stores that lifetime as a short at pvars+0x320+i*2. Supplied update_wind_sparks decrements n320[i] through fast_dec_timer_s16, respawns on expiry and uses the remaining count in fade arithmetic; draw_wind_sparks skips slots whose count is zero. This is the per-spark remaining lifetime in frames. n380 -> spark_lifetime_initial_frames: Retail 0x002eb50c-0x002eb530 copies the same frame-scaled lifetime result into both +0x320+i*2 and +0x380+i*2. In supplied update_wind_sparks only n320 is decremented, while n380[i]-n320[i] supplies elapsed lifetime for fade-in and n380[i]-wind_spark_fade_in_frames_gp supplies the fade-out denominator. Thus n380 retains each spark's initial lifetime in frames. n3E0 -> spark_opacity: Retail 0x002eb514-0x002eb534 selects the short element at pvars+0x3e0+i*2 and initializes it to zero. Supplied update_wind_sparks points shade at n3E0 and writes the integer product of wind_spark_peak_alpha_gp and spark_fade_fraction for each slot. Supplied draw_wind_sparks shifts n3E0[i] left 24 and ORs it with wind_spark_base_color_gp for every quad vertex, proving per-spark opacity/alpha. --- src/overlays/l14/mobys/wind_control.c | 32 +++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/l14/mobys/wind_control.c b/src/overlays/l14/mobys/wind_control.c index af737d2e6d..de481f6853 100644 --- a/src/overlays/l14/mobys/wind_control.c +++ b/src/overlays/l14/mobys/wind_control.c @@ -179,9 +179,9 @@ typedef struct { char pad0[0x14]; float f14, f18, f1C; float pos[48][4]; - short n320[48]; - short n380[48]; - short n3E0[48]; + short spark_lifetime_remaining_frames[48]; + short spark_lifetime_initial_frames[48]; + short spark_opacity[48]; float spark_step_distance[48]; int pad500; int spark_area_cuboid_index; @@ -228,9 +228,9 @@ void initialize_wind_spark(struct Moby *wind_control_moby, int i, void *spark_tr frame_time; lifetime_frames = scale_game_frames(ftoi_k(spark_vars->f14 * 2.0f / spark_vars->spark_step_distance[i])); - spark_vars->n320[i] = lifetime_frames; - spark_vars->n380[i] = lifetime_frames; - spark_vars->n3E0[i] = 0; + spark_vars->spark_lifetime_remaining_frames[i] = lifetime_frames; + spark_vars->spark_lifetime_initial_frames[i] = lifetime_frames; + spark_vars->spark_opacity[i] = 0; } extern int spark_float_to_integer(float) __asm__("FUN_001fa6d0"); @@ -261,24 +261,24 @@ void update_wind_sparks(struct Moby *wind_control_moby) { in_clip = is_point_inside_clip_volume(clip, spark_vars->spark_area_cuboid_index); i = 0; pos = spark_vars->pos[0]; - shade = spark_vars->n3E0; + shade = spark_vars->spark_opacity; do { - if (fast_dec_timer_s16(&spark_vars->n320[i]) != 0) { + if (fast_dec_timer_s16(&spark_vars->spark_lifetime_remaining_frames[i]) != 0) { if (in_clip == 0 || i < 24) { initialize_wind_spark(wind_control_moby, i, spark_travel_direction); } } else { opacity = wind_spark_peak_alpha_gp; - if (spark_vars->n380[i] - wind_spark_fade_in_frames_gp < spark_vars->n320[i]) { + if (spark_vars->spark_lifetime_initial_frames[i] - wind_spark_fade_in_frames_gp < spark_vars->spark_lifetime_remaining_frames[i]) { spark_fade_fraction = - convert_integer_to_float(spark_vars->n380[i] - spark_vars->n320[i]); + convert_integer_to_float(spark_vars->spark_lifetime_initial_frames[i] - spark_vars->spark_lifetime_remaining_frames[i]); spark_fade_fraction = spark_fade_fraction / convert_integer_to_float(wind_spark_fade_in_frames_gp); } else { - spark_fade_fraction = convert_integer_to_float(spark_vars->n320[i]); + spark_fade_fraction = convert_integer_to_float(spark_vars->spark_lifetime_remaining_frames[i]); spark_fade_fraction = spark_fade_fraction / - convert_integer_to_float(spark_vars->n380[i] - wind_spark_fade_in_frames_gp); + convert_integer_to_float(spark_vars->spark_lifetime_initial_frames[i] - wind_spark_fade_in_frames_gp); } { int spark_alpha = @@ -297,8 +297,8 @@ void update_wind_sparks(struct Moby *wind_control_moby) { absolute_float(pos[1] - l14_camera.pos.f[1]) < 8.0f && fast_difference_between_rotations(wind_control_moby->rot.z, l14_camera.yaw) > 2.3561945f) { - if (spark_vars->n320[i] > scale_game_frames(20)) { - spark_vars->n320[i] = scale_game_frames(20); + if (spark_vars->spark_lifetime_remaining_frames[i] > scale_game_frames(20)) { + spark_vars->spark_lifetime_remaining_frames[i] = scale_game_frames(20); } } } @@ -352,8 +352,8 @@ void draw_wind_sparks(struct Moby *m) { pk.uv[6] = 0.0f; pk.uv[7] = 0.0f; for (i = 0; i < 48; i++) { - if (d->n320[i] != 0) { - col = wind_spark_base_color_gp | (d->n3E0[i] << 24); + if (d->spark_lifetime_remaining_frames[i] != 0) { + col = wind_spark_base_color_gp | (d->spark_opacity[i] << 24); pk.col[3] = col; pk.col[2] = col; pk.col[1] = col; From 616cc8e9f8b5b2cae3fb86755d626344d4a756fa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:51:53 +0000 Subject: [PATCH 376/657] decomp: clarify names in update_fighter_jet_flight r40 -> roll: FighterJetMoby.r40 is assigned fast_add_rotations(ship_vars->f30, ship_vars->f6C * D_L17_00162160). Retail 0x002ecc5c-0x002ecc70 loads vars+0x30 and horizontal steering +0x6C, adds the scaled angular correction and stores moby+0x40. Vars+0x30 is the roll angle spring target at 0x002ec668-0x002ec68c, using the established fighter_jet_roll coefficients. Supplied ShipMoby maps the same +0x40 storage to rot[0]; this is roll, not an offset-only inference. r44 -> pitch: FighterJetMoby.r44 at moby+0x44 is interpolated toward negative atan(horizontal target distance, target Z minus moby Z) at retail 0x002ec8e4-0x002ec938, proving elevation/pitch. It is clamped to +/-1.3962634 at 0x002ec708-0x002ec74c, and 0x002ecc74-0x002ecc8c finally writes vars+0x34 plus scaled negative vertical steering +0x70. Source uses -vars->f34 as spherical elevation and maps the same storage to ShipMoby.rot[1]. r48 -> yaw: FighterJetMoby.r48 at moby+0x48 is interpolated toward fast_arc_tan(target X minus moby X, target Y minus moby Y) at retail 0x002ec84c-0x002ec890, proving horizontal heading/yaw. Retail 0x002ecc90-0x002eccb8 then writes vars+0x38 plus scaled negative horizontal steering +0x6C. The source passes vars->f38 as build_spherical_offset azimuth and maps the same +0x48 storage to ShipMoby.rot[2], corroborating yaw. --- src/overlays/l17/mobys/fighter_jet.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/l17/mobys/fighter_jet.c b/src/overlays/l17/mobys/fighter_jet.c index 378693dcbf..44deeabb5a 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -1062,9 +1062,9 @@ typedef struct { char pad21[0x13]; unsigned short flags; char pad36[0xA]; - float r40; - float r44; - float r48; + float roll; + float pitch; + float yaw; char pad4C[0x70]; unsigned char bc; } FighterJetMoby; @@ -1338,10 +1338,10 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v } else if (ship_vars->f34 < -1.3962634f) { ship_vars->f34 = -1.3962634f; } - if (ship_moby->r44 > 1.3962634f) { - ship_moby->r44 = 1.3962634f; - } else if (ship_moby->r44 < -1.3962634f) { - ship_moby->r44 = -1.3962634f; + if (ship_moby->pitch > 1.3962634f) { + ship_moby->pitch = 1.3962634f; + } else if (ship_moby->pitch < -1.3962634f) { + ship_moby->pitch = -1.3962634f; } } @@ -1370,11 +1370,11 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v fast_arc_tan(target[0] - ship_moby->pos[0], target[1] - ship_moby->pos[1]), 50.0f, lenB); - ship_moby->r48 = interpolate_value_with_repeated_squaring( + ship_moby->yaw = interpolate_value_with_repeated_squaring( 1, 5, distance_to_default_target, - ship_moby->r48, + ship_moby->yaw, fast_arc_tan(target[0] - ship_moby->pos[0], target[1] - ship_moby->pos[1]), 50.0f, lenB); @@ -1388,11 +1388,11 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v 50.0f, lenA); target_height_distance_for_moby_pitch = absolute_float(target[2] - ship_moby->pos[2]); - ship_moby->r44 = interpolate_value_with_repeated_squaring( + ship_moby->pitch = interpolate_value_with_repeated_squaring( 1, 5, target_height_distance_for_moby_pitch, - ship_moby->r44, + ship_moby->pitch, -fast_arc_tan(vector_distance_xy(ship_moby->pos, target), target[2] - ship_moby->pos[2]), 50.0f, lenA); @@ -1499,9 +1499,9 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v tn = fast_sin(half_fov) / fast_cos(half_fov); D_L17_0016D3F0 = tn; update_view_context(); - ship_moby->r40 = fast_add_rotations(ship_vars->f30, ship_vars->f6C * D_L17_00162160); - ship_moby->r44 = fast_add_rotations(ship_vars->f34, -ship_vars->f70 * D_L17_00162164); - ship_moby->r48 = fast_add_rotations(ship_vars->f38, -ship_vars->f6C * D_L17_00162168); + ship_moby->roll = fast_add_rotations(ship_vars->f30, ship_vars->f6C * D_L17_00162160); + ship_moby->pitch = fast_add_rotations(ship_vars->f34, -ship_vars->f70 * D_L17_00162164); + ship_moby->yaw = fast_add_rotations(ship_vars->f38, -ship_vars->f6C * D_L17_00162168); if (coll_sphere(1.2f, ship_moby->pos, 0, ship_moby)) { collision_result = D_L17_00174740; if (*(char **)(collision_result + 0x18) == 0 || From 58c4f9892c1f0636efadb8f4c724b1049d356376 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:51:59 +0000 Subject: [PATCH 377/657] decomp: clarify names in update_path_key_camera n30 -> linked_moby_event_stage: Retail 0x00315ee4-0x00315f20 loads record+0x30, tests stage <3, and indexes path_key_camera_linked_moby_event_progress_thresholds using stage*12+side*4. Crossing the threshold dispatches linked-moby commands and timers at 0x00315f28-0x003160d4, then increments record+0x30 at 0x003160d8-0x003160e0; C rec->n30 follows precisely this flow. n32 -> angle_override_stage: Retail 0x00315e40-0x00315ea0 loads record+0x32, tests stage <2, indexes path_key_camera_angle_override_progress_thresholds by stage*12+side*4 and increments it upon threshold crossing. At 0x00315ea4-0x00315ee0 only stage 1 enables the degree-to-radian angle override writes, matching rec->n32 in the authoritative C. t18 -> side_zero_heading_override: At 0x00316428-0x00316438 side zero selects CamKey5d48+0x18. Current/next keys are loaded at 0x00316454-0x00316480 and used as angular blend targets at 0x003164ec/0x0031654c/0x0031659c. The blended heading becomes placement parameter 0 at 0x003165b8 for 0x003165e4, matching the C current_key_heading_override and heading_blend_target assignments from t18. t1C -> side_one_heading_override: Retail 0x0031643c-0x0031644c selects key+0x1C when side is 1. Current/next key loads at 0x00316454-0x00316480 feed angular heading blending at 0x003164ec/0x0031654c/0x0031659c, then spherical placement parameter 0 at 0x003165b8-0x003165e4. C t1C supplies the side-one current_key_heading_override and heading_blend_target. t20 -> side_two_heading_override: Retail side selection 0x00316428-0x00316450 uses key+0x20 for side 2. Current/next key values loaded at 0x00316454-0x00316480 feed angular heading blending at 0x003164ec/0x0031654c/0x0031659c and camera placement parameter 0 at 0x003165b8-0x003165e4. C t20 supplies the corresponding current_key_heading_override and heading_blend_target. t24 -> side_zero_progress_threshold: Retail 0x003160e4-0x0031611c selects the next 0x30-byte camera key's +0x24 when side is zero, compares it <= normalized rail progress and advances the key index. At 0x003161d8-0x00316220 the same field supplies current/next thresholds for (progress-current)/(next-current), proving the role of C t24. t28 -> side_one_progress_threshold: Retail 0x00316120-0x00316158 selects the next camera key's +0x28 when side is one, compares it <= normalized rail progress and advances the key index. At 0x003161ec-0x00316220 side one selects +0x28 for the current/next threshold differences computing key_interpolation_fraction, matching C t28. t2C -> side_two_progress_threshold: Retail 0x00316160-0x0031619c selects next camera key+0x2C when side is two, compares it <= normalized rail progress and advances the key index. At 0x003161ec-0x00316220 the side-two branch selects +0x2C for (progress-current)/(next-current), matching C t2C. --- src/overlays/l14/path_key_camera.c | 82 +++++++++++++++--------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/overlays/l14/path_key_camera.c b/src/overlays/l14/path_key_camera.c index 45be36c59a..7e323f87bd 100644 --- a/src/overlays/l14/path_key_camera.c +++ b/src/overlays/l14/path_key_camera.c @@ -134,8 +134,8 @@ typedef struct { int first_linked_moby_index; int second_linked_moby_index; int third_linked_moby_index; - short n30; - short n32; + short linked_moby_event_stage; + short angle_override_stage; int side_zero_rail_spline_index; int p38; } CamRec5d48; @@ -189,12 +189,12 @@ typedef struct { float aC; float a10; int n14; - float t18; - float t1C; - float t20; - float t24; - float t28; - float t2C; + float side_zero_heading_override; + float side_one_heading_override; + float side_two_heading_override; + float side_zero_progress_threshold; + float side_one_progress_threshold; + float side_two_progress_threshold; } CamKey5d48; typedef struct { @@ -271,16 +271,16 @@ void update_path_key_camera(char *path_key_camera) { D_L14_001624C0 = (path_key_camera_rail_distances[side][hero.rail_segment] + hero.rail_seg_frac) / path_key_camera_rail_distances[side][999]; - if (rec->n32 < 2 && - path_key_camera_angle_override_progress_thresholds[rec->n32][side] <= D_L14_001624C0) { - rec->n32++; + if (rec->angle_override_stage < 2 && + path_key_camera_angle_override_progress_thresholds[rec->angle_override_stage][side] <= D_L14_001624C0) { + rec->angle_override_stage++; } - if (rec->n32 == 1) { + if (rec->angle_override_stage == 1) { ((CamBones5d48 *)D_L14_0017AD80)->f274 = D_L14_001624B0 * 0.017453292f; ((CamBones5d48 *)D_L14_0017AD80)->f278 = D_L14_001624AC * 0.017453292f; } - if (rec->n30 < 3 && - path_key_camera_linked_moby_event_progress_thresholds[rec->n30][side] <= D_L14_001624C0) { + if (rec->linked_moby_event_stage < 3 && + path_key_camera_linked_moby_event_progress_thresholds[rec->linked_moby_event_stage][side] <= D_L14_001624C0) { struct Moby *first_linked_moby = (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->first_linked_moby_index << 8)); struct Moby *second_linked_moby = @@ -291,19 +291,19 @@ void update_path_key_camera(char *path_key_camera) { if (hero.rail_spline == (s32)l14_splines_macro[MOBYDATA_5d48(first_linked_moby)->zone].path) { first_linked_moby->command = 1; - if (rec->n30 > 0) { + if (rec->linked_moby_event_stage > 0) { { CamMobyData5d48 *d = MOBYDATA_5d48(second_linked_moby); second_linked_moby->command = 5; - if (rec->n30 == 2) { + if (rec->linked_moby_event_stage == 2) { CamMobyData5d48 *d2; d->timer = scale_game_frames(0x2D); third_linked_moby->command = 5; d2 = MOBYDATA_5d48(third_linked_moby); d2->timer = scale_game_frames(0x6E); - } else if (rec->n30 == 3) { + } else if (rec->linked_moby_event_stage == 3) { d->timer = scale_game_frames(0x2D); } else { d->timer = scale_game_frames(0x50); @@ -313,19 +313,19 @@ void update_path_key_camera(char *path_key_camera) { } else if (hero.rail_spline == (s32)l14_splines_macro[MOBYDATA_5d48(second_linked_moby)->zone].path) { second_linked_moby->command = 1; - if (rec->n30 > 0) { + if (rec->linked_moby_event_stage > 0) { if (random_integer_below(2)) { CamMobyData5d48 *d = MOBYDATA_5d48(first_linked_moby); first_linked_moby->command = 5; - if (rec->n30 == 2) { + if (rec->linked_moby_event_stage == 2) { CamMobyData5d48 *d2; d->timer = scale_game_frames(0x2D); third_linked_moby->command = 5; d2 = MOBYDATA_5d48(third_linked_moby); d2->timer = scale_game_frames(0x6E); - } else if (rec->n30 == 3) { + } else if (rec->linked_moby_event_stage == 3) { d->timer = scale_game_frames(0x2D); } else { d->timer = scale_game_frames(0x50); @@ -334,14 +334,14 @@ void update_path_key_camera(char *path_key_camera) { CamMobyData5d48 *d = MOBYDATA_5d48(third_linked_moby); third_linked_moby->command = 5; - if (rec->n30 == 2) { + if (rec->linked_moby_event_stage == 2) { CamMobyData5d48 *d2; d->timer = scale_game_frames(0x2D); first_linked_moby->command = 5; d2 = MOBYDATA_5d48(first_linked_moby); d2->timer = scale_game_frames(0x6E); - } else if (rec->n30 == 3) { + } else if (rec->linked_moby_event_stage == 3) { d->timer = scale_game_frames(0x2D); } else { d->timer = scale_game_frames(0x50); @@ -350,19 +350,19 @@ void update_path_key_camera(char *path_key_camera) { } } else { third_linked_moby->command = 1; - if (rec->n30 > 0) { + if (rec->linked_moby_event_stage > 0) { { CamMobyData5d48 *d = MOBYDATA_5d48(second_linked_moby); second_linked_moby->command = 5; - if (rec->n30 == 2) { + if (rec->linked_moby_event_stage == 2) { CamMobyData5d48 *d2; d->timer = scale_game_frames(0x2D); first_linked_moby->command = 5; d2 = MOBYDATA_5d48(first_linked_moby); d2->timer = scale_game_frames(0x6E); - } else if (rec->n30 == 3) { + } else if (rec->linked_moby_event_stage == 3) { d->timer = scale_game_frames(0x2D); } else { d->timer = scale_game_frames(0x50); @@ -370,17 +370,17 @@ void update_path_key_camera(char *path_key_camera) { } } } - rec->n30++; + rec->linked_moby_event_stage++; } /* Unused reads (not in rac1-decomp's SN build): with them the game compiler computes the key table's * high half and the next key index above the three side tests, as retail does. */ keys = D_L14_001F6488; next_camera_key_index = st->idx + 1; - if (side == 0 && D_L14_001F6488[st->idx + 1].t24 <= D_L14_001624C0) { + if (side == 0 && D_L14_001F6488[st->idx + 1].side_zero_progress_threshold <= D_L14_001624C0) { st->idx++; - } else if (side == 1 && D_L14_001F6488[st->idx + 1].t28 <= D_L14_001624C0) { + } else if (side == 1 && D_L14_001F6488[st->idx + 1].side_one_progress_threshold <= D_L14_001624C0) { st->idx++; - } else if (side == 2 && D_L14_001F6488[st->idx + 1].t2C <= D_L14_001624C0) { + } else if (side == 2 && D_L14_001F6488[st->idx + 1].side_two_progress_threshold <= D_L14_001624C0) { st->idx++; } if (D_L14_001F6488[st->idx + 1].n14 == 0x2710) { @@ -391,14 +391,14 @@ void update_path_key_camera(char *path_key_camera) { float den; if (side == 0) { - den = D_L14_001F6488[st->idx + 1].t24 - D_L14_001F6488[st->idx].t24; - num = D_L14_001624C0 - D_L14_001F6488[st->idx].t24; + den = D_L14_001F6488[st->idx + 1].side_zero_progress_threshold - D_L14_001F6488[st->idx].side_zero_progress_threshold; + num = D_L14_001624C0 - D_L14_001F6488[st->idx].side_zero_progress_threshold; } else if (side == 1) { - den = D_L14_001F6488[st->idx + 1].t28 - D_L14_001F6488[st->idx].t28; - num = D_L14_001624C0 - D_L14_001F6488[st->idx].t28; + den = D_L14_001F6488[st->idx + 1].side_one_progress_threshold - D_L14_001F6488[st->idx].side_one_progress_threshold; + num = D_L14_001624C0 - D_L14_001F6488[st->idx].side_one_progress_threshold; } else { - den = D_L14_001F6488[st->idx + 1].t2C - D_L14_001F6488[st->idx].t2C; - num = D_L14_001624C0 - D_L14_001F6488[st->idx].t2C; + den = D_L14_001F6488[st->idx + 1].side_two_progress_threshold - D_L14_001F6488[st->idx].side_two_progress_threshold; + num = D_L14_001624C0 - D_L14_001F6488[st->idx].side_two_progress_threshold; } key_interpolation_fraction = num / den; } @@ -434,14 +434,14 @@ void update_path_key_camera(char *path_key_camera) { fast_add_rotations(fast_arc_tan(hero.moby->rot_row1.x, hero.moby->rot_row1.y), cur->f0); D_L14_001624BC = camera_placement_heading; if (side == 0) { - current_key_heading_override = D_L14_001F6488[st->idx].t18; - heading_blend_target = D_L14_001F6488[st->idx + 1].t18; + current_key_heading_override = D_L14_001F6488[st->idx].side_zero_heading_override; + heading_blend_target = D_L14_001F6488[st->idx + 1].side_zero_heading_override; } else if (side == 1) { - current_key_heading_override = D_L14_001F6488[st->idx].t1C; - heading_blend_target = D_L14_001F6488[st->idx + 1].t1C; + current_key_heading_override = D_L14_001F6488[st->idx].side_one_heading_override; + heading_blend_target = D_L14_001F6488[st->idx + 1].side_one_heading_override; } else { - current_key_heading_override = D_L14_001F6488[st->idx].t20; - heading_blend_target = D_L14_001F6488[st->idx + 1].t20; + current_key_heading_override = D_L14_001F6488[st->idx].side_two_heading_override; + heading_blend_target = D_L14_001F6488[st->idx + 1].side_two_heading_override; } if (heading_blend_target == 0.0f && current_key_heading_override == 0.0f) { heading_blend_target = (st->fC != 0.0f) ? st->fC : st->f8; From 1d0817287d2e5be44db5a7d8e0b3a993d8b785fd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 11:53:49 +0000 Subject: [PATCH 378/657] decomp: clarify names in robot_dog_update t1E0 -> blocked_line_idle_delay_frames: Vars1382.t1E0 is the short at pvars+0x1e0. Retail 002eeef8-002eef00 and 002ef8c4-002ef8d0 store scale_game_frames(120) when entering target-facing state 5; original Ghidra confirms those stores. In state 5, retail 002ef124-002ef148 masks the packed load with 0xff0000ffff to require both this short and detection mode +0x1e4 to be zero before entering state 3, which selects idle sequence 0. Authoritative C expresses this as t1E0 == 0 && mode == ROBOT_DOG_DETECTION_LINE_BLOCKED. Thus it is the frame-delay gate for blocked-line transition to idle. t1E2 -> clear_line_response_delay_frames: Vars1382.t1E2 is the short at pvars+0x1e2, initialized from scale_game_frames(120) at retail 002eef04-002eef10 and 002ef8b8-002ef8c0 when entering target-facing state 5. Retail 002ef060-002ef090 first requires detection mode 2, then passes its address to fast_dec_timer_s16 at 002ef06c/002ef070; expiry or the separate global-condition bypass permits randomized sequence-2/chase-state response selection. Original Ghidra and authoritative C agree on this countdown and clear-line response gate. --- src/overlays/l17/mobys/robot_dog.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/l17/mobys/robot_dog.c b/src/overlays/l17/mobys/robot_dog.c index bdc010b8f9..9a7997dd46 100644 --- a/src/overlays/l17/mobys/robot_dog.c +++ b/src/overlays/l17/mobys/robot_dog.c @@ -97,8 +97,8 @@ typedef struct { float f1D4; float speed; float yawvel; - short t1E0; - short t1E2; + short blocked_line_idle_delay_frames; + short clear_line_response_delay_frames; unsigned char mode; unsigned char b1E5; char pad1E6[2]; @@ -261,8 +261,8 @@ void robot_dog_update(unsigned char *robot_dog_moby) { if (robot_dog_moby[0x53] != 3) { blend_moby_animation(robot_dog_moby, 3, 0, scale_game_frames(10)); } - robot_dog_vars->t1E0 = scale_game_frames(120); - robot_dog_vars->t1E2 = scale_game_frames(120); + robot_dog_vars->blocked_line_idle_delay_frames = scale_game_frames(120); + robot_dog_vars->clear_line_response_delay_frames = scale_game_frames(120); } } break; @@ -294,7 +294,7 @@ void robot_dog_update(unsigned char *robot_dog_moby) { MOBY(robot_dog_moby)->anim_speed = 1.7f; mode = robot_dog_vars->mode; if (mode == ROBOT_DOG_DETECTION_CLEAR_LINE_IN_FACING_CONE && - (fast_dec_timer_s16(&robot_dog_vars->t1E2) || D_0013E533[0x2EC1] != 3)) { + (fast_dec_timer_s16(&robot_dog_vars->clear_line_response_delay_frames) || D_0013E533[0x2EC1] != 3)) { if (random_integer_below(3) == 0) { if (robot_dog_moby[0x53] != mode) { blend_moby_animation(robot_dog_moby, 2, 0, scale_game_frames(10)); @@ -310,7 +310,7 @@ void robot_dog_update(unsigned char *robot_dog_moby) { blend_moby_animation(robot_dog_moby, 7, 0, scale_game_frames(10)); } } - } else if (robot_dog_vars->t1E0 == 0 && + } else if (robot_dog_vars->blocked_line_idle_delay_frames == 0 && robot_dog_vars->mode == ROBOT_DOG_DETECTION_LINE_BLOCKED) { robot_dog_moby[0x20] = 3; if (robot_dog_moby[0x53] != 0) { @@ -352,8 +352,8 @@ void robot_dog_update(unsigned char *robot_dog_moby) { if (robot_dog_moby[0x53] != 3) { blend_moby_animation(robot_dog_moby, 3, 0, scale_game_frames(10)); } - robot_dog_vars->t1E2 = scale_game_frames(120); - robot_dog_vars->t1E0 = scale_game_frames(120); + robot_dog_vars->clear_line_response_delay_frames = scale_game_frames(120); + robot_dog_vars->blocked_line_idle_delay_frames = scale_game_frames(120); } break; } @@ -471,8 +471,8 @@ void robot_dog_update(unsigned char *robot_dog_moby) { if (robot_dog_moby[0x53] != 3) { blend_moby_animation(robot_dog_moby, 3, 0, scale_game_frames(10)); } - robot_dog_vars->t1E2 = scale_game_frames(120); - robot_dog_vars->t1E0 = scale_game_frames(120); + robot_dog_vars->clear_line_response_delay_frames = scale_game_frames(120); + robot_dog_vars->blocked_line_idle_delay_frames = scale_game_frames(120); } else if (robot_dog_moby[0x70] & 2) { far = vector_distance_xy(robot_dog_moby + 0x10, robot_dog_vars->v180); k1 = scale_time(40.0f); @@ -498,8 +498,8 @@ void robot_dog_update(unsigned char *robot_dog_moby) { if (robot_dog_moby[0x53] != 3) { blend_moby_animation(robot_dog_moby, 3, 0, scale_game_frames(10)); } - robot_dog_vars->t1E2 = scale_game_frames(120); - robot_dog_vars->t1E0 = scale_game_frames(120); + robot_dog_vars->clear_line_response_delay_frames = scale_game_frames(120); + robot_dog_vars->blocked_line_idle_delay_frames = scale_game_frames(120); } else if (MOBY(robot_dog_moby)->pos.z < 2.0f) { FUN_L00_00257470(robot_dog_moby, 0, -1); mark_moby_for_removal(robot_dog_moby); From df582fdec830f1e4b67eb44c541016152953ecc0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:01:04 +0000 Subject: [PATCH 379/657] decomp: clarify names in update_path_key_camera n14 -> interpolation_stop_marker: CamKey5d48.n14 is the +0x14 integer in each 0x30-byte key. Retail 0x003161a4-0x003161bc forms the next key address and loads +0x14; 0x003161ac/0x003161c0 compares it with 0x2710. Equality bypasses progress-based interpolation, sets f24 to 1.0 at 0x003161c8-0x003161cc, and decrements the saved key index at 0x003161c4/0x003161d4. Original Ghidra and current C show the same branch. This proves its interpolation-stop-marker role without claiming duration units or broader timing semantics. --- src/overlays/l14/path_key_camera.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/path_key_camera.c b/src/overlays/l14/path_key_camera.c index 7e323f87bd..b5801ebcfe 100644 --- a/src/overlays/l14/path_key_camera.c +++ b/src/overlays/l14/path_key_camera.c @@ -188,7 +188,7 @@ typedef struct { float a8; float aC; float a10; - int n14; + int interpolation_stop_marker; float side_zero_heading_override; float side_one_heading_override; float side_two_heading_override; @@ -383,7 +383,7 @@ void update_path_key_camera(char *path_key_camera) { } else if (side == 2 && D_L14_001F6488[st->idx + 1].side_two_progress_threshold <= D_L14_001624C0) { st->idx++; } - if (D_L14_001F6488[st->idx + 1].n14 == 0x2710) { + if (D_L14_001F6488[st->idx + 1].interpolation_stop_marker == 0x2710) { key_interpolation_fraction = 1.0f; st->idx--; } else { From f25bc7d5d2b07168ac50024aae33e7d904b9f353 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:03:54 +0000 Subject: [PATCH 380/657] decomp: clarify names in woodcut_bot_update domain_0_value_0 -> LEG_RIG_ANIMATION_STRIDE_SCALING_DISABLED: Authoritative src/overlays/l04/mobys/woodcut_bot.c SHA-256 ae41a9e24e887f850ad2b825047152c6aae29f87b5af09e5756f862fae1f78cd passes d+0x160 to leg_walker_update, then tests d+0x217 == 0 in STOP_MOVEMENT (assigned retail 0x002d2b30-0x002d2b78). Checked level-04 helper request d8e7461c6aa24aec98f4adf9463037e3 binds that movement record to s2 at 0x00295790; record+0xB7 is therefore d+0x217. At 0x00295cc0-0x00295ccc it sets moby animation playback scale +0x58 to 1.0. At 0x00295cd0-0x00295cd8 zero branches directly to return 0x00295d9c, bypassing animation-record scanning and the movement/stride-derived playback rate calculation and store at 0x00295d6c-0x00295d88. Thus zero disables stride-based animation rate scaling; this is a leg-rig animation mode, separate from moby state, hit reactions and HeroStateId. --- src/overlays/l04/mobys/woodcut_bot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index 6189a88d39..7148894906 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -321,6 +321,9 @@ void woodcut_bot_update(WBMoby *m) { WOODCUT_BOT_REACTION_RECOIL_TO_IDLE_WITH_COOLDOWNS = 5, WOODCUT_BOT_REACTION_HIT_RECOVERY_WITH_MELEE_WINDOW_GUARD = 6 }; + enum { + LEG_RIG_ANIMATION_STRIDE_SCALING_DISABLED = 0 + }; int excited = 0; WBData *d = m->d; unsigned char *manipulator; @@ -780,7 +783,7 @@ void woodcut_bot_update(WBMoby *m) { } else { leg_walker_update( m, d->leg_rig_movement_data, frame_time * 0.0f, m->rot[2], frame_time_sq * 20.0f); - if (d->leg_rig_animation_mode == 0) { + if (d->leg_rig_animation_mode == LEG_RIG_ANIMATION_STRIDE_SCALING_DISABLED) { if (excited) { m->state = WOODCUT_BOT_SELECT_ACTION_WHILE_EXCITED; } else { From f53646e077b28065289df5c5ad9c2af7a4656ec9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:05:53 +0000 Subject: [PATCH 381/657] decomp: clarify names in draw_beam_endpoint_quads_with_glow domain_0_value_5 -> TEXTURE_CLAMP_UV: Authoritative beam_slots.c SHA-256 22b2a60700ac45a4c3eafe7ab86a0609d1a777ebc33a2147e80d8e173c65a7f9 assigns 5 to geometry_quad.texture_clamp_state. Original retail decompilation stores uStack_130=5; instructions 0x002e3494/0x002e34cc load 5 and store sp+0x70, retained through all four draw calls. Checked level-00 helper evidence 8314342b21324af7ba4a39c23be6c86d retains the quad pointer in s2 at 0x001fd2d4, reads +0x70 at 0x001fd640, and packs it with +0x78 at 0x001fd658 into packet+0x40 at 0x001fd65c. GIF descriptor construction 0x001fd560-0x001fd588 yields 0x0412412412412068: its first packed register is CLAMP_1 (8), followed by TEX0_1 (6). This proves the selector's GS clamp-register domain rather than a gameplay state domain. As recorded in supplied retail findings, 5 sets WMS=WMT=1, selecting clamp on both U and V; hence TEXTURE_CLAMP_UV. No existing canonical constants or enum domains were supplied. --- src/overlays/shared/rendering/effects/beam_slots.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/overlays/shared/rendering/effects/beam_slots.c b/src/overlays/shared/rendering/effects/beam_slots.c index c2a3b69001..acaf621034 100644 --- a/src/overlays/shared/rendering/effects/beam_slots.c +++ b/src/overlays/shared/rendering/effects/beam_slots.c @@ -700,6 +700,9 @@ void draw_beam_strand_with_glow( void draw_beam_endpoint_quads_with_glow(s32 unused, s32 beam_slot) __asm__("FUN_L00_002e3388"); void draw_beam_endpoint_quads_with_glow(s32 unused, s32 beam_slot) { + enum { + TEXTURE_CLAMP_UV = 5 + }; Q_e3388 geometry_quad; f32 endpoint_to_camera_axis[4] __attribute__((aligned(16))); f32 endpoint_quad_side_axis[4] __attribute__((aligned(16))); From 18436f646d28e61a80d55c852d4289e4a65d4e8b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:40:20 +0000 Subject: [PATCH 382/657] decomp: clarify names in _sysbitInit size -> buffer_size_bytes: Retail 0x0012a938 adds incoming a3 to base address a2, and 0x0012a940 stores that end address at ctx+0x24; 0x0012a944 also saves a3 at ctx+0x28. The original Ghidra decompilation confirms param_3 + param_4 and the separate param_4 store. The authoritative source computes ctx->limit = base_addr + size. Caller sceMpegDemuxPssRing supplies bufstart and bufsize as the third and fourth arguments. _sysbitFlush advances ctx->ptr once per fetched byte, adds 8 to its bit count, and wraps at ctx->end to ctx->base, proving that this buffer extent is measured in bytes. --- src/sdk/system/sysbit_init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/system/sysbit_init.c b/src/sdk/system/sysbit_init.c index 52cc122c33..8d73638da4 100644 --- a/src/sdk/system/sysbit_init.c +++ b/src/sdk/system/sysbit_init.c @@ -13,14 +13,14 @@ typedef struct SysbitState { u32 wrap_base; } SysbitState; -void _sysbitInit(SysbitState *ctx, s32 initial_bit_pointer, s32 base_addr, s32 size) { +void _sysbitInit(SysbitState *ctx, s32 initial_bit_pointer, s32 base_addr, s32 buffer_size_bytes) { ctx->field8 = initial_bit_pointer; ctx->bit_pointer = initial_bit_pointer; ctx->bits = 0; ctx->cnt = 0; ctx->total = 0; ctx->base = base_addr; - ctx->limit = base_addr + size; - ctx->wrap_base = size; + ctx->limit = base_addr + buffer_size_bytes; + ctx->wrap_base = buffer_size_bytes; _sysbitFlush(ctx, 0); } From 9ead4c6913f49532356b21986ae7e6c3658012b2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:40:20 +0000 Subject: [PATCH 383/657] decomp: clarify names in mark_menu_stream_buffer_read_active count -> descriptors_examined: In the authoritative source, s32 count starts at zero, increments once before each descriptor-address test, and bounds the search by MENU_STREAM_BUFFER_COUNT. Original retail Ghidra iVar2 has the same loop role. Retail 0x00225ddc initializes a2 to zero, 0x00225df0 increments it on each comparison, 0x00225e08 tests it against five, and 0x00225e10 advances the flags pointer by eight bytes to the next descriptor. Thus this is the number of descriptors examined, not bytes or successful matches. --- .../stream_buffers/mark_menu_stream_buffer_read_active.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/menus/stream_buffers/mark_menu_stream_buffer_read_active.c b/src/ui/menus/stream_buffers/mark_menu_stream_buffer_read_active.c index 3be7921665..952cd4351a 100644 --- a/src/ui/menus/stream_buffers/mark_menu_stream_buffer_read_active.c +++ b/src/ui/menus/stream_buffers/mark_menu_stream_buffer_read_active.c @@ -4,14 +4,14 @@ s32 mark_menu_stream_buffer_read_active(s32 buffer_address) __asm__("FUN_00225dd8"); s32 mark_menu_stream_buffer_read_active(s32 buffer_address) { - s32 count = 0; + s32 descriptors_examined = 0; u8 *stream_buffer_descriptors = (u8 *)menu_stream_buffers; s32 *stream_buffer_flags = (s32 *)(stream_buffer_descriptors + 4); loop: - count += 1; + descriptors_examined += 1; if (stream_buffer_flags[-1] != buffer_address) { stream_buffer_flags += 2; - if (count >= MENU_STREAM_BUFFER_COUNT) { + if (descriptors_examined >= MENU_STREAM_BUFFER_COUNT) { return 1; } goto loop; From a1dca1690f5ce2866ffe440874d690716094a06a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:43:06 +0000 Subject: [PATCH 384/657] decomp: clarify names in read_buf_end_get size -> requested_count: In the source snapshot (SHA-256 90f0a24ff408d0ba5d13ad2b61fac9a80041857010afc3bae2c67ba9e70c6bdc), size replaces taken only when size < read_source->count, and taken is subtracted from that count and returned. Retail 0023ba28 loads the available count; slt at 0023ba30 compares a1 against it, movn at 0023ba34 selects a1 when smaller, and subu/sw at 0023ba38/40 subtracts and stores the remainder. Ghidra param_2 follows the same clamped-request flow, proving requested_count. --- src/movies/decoder/buffers/read_buf_end_get.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/movies/decoder/buffers/read_buf_end_get.c b/src/movies/decoder/buffers/read_buf_end_get.c index bf6a81a3e8..ef07a55d87 100644 --- a/src/movies/decoder/buffers/read_buf_end_get.c +++ b/src/movies/decoder/buffers/read_buf_end_get.c @@ -2,14 +2,14 @@ s32 read_buf_end_get(struct ReadBuf *buf, s32 size) __asm__("GetStateTableWord"); -s32 read_buf_end_get(struct ReadBuf *read_source, s32 size) { +s32 read_buf_end_get(struct ReadBuf *read_source, s32 requested_count) { s32 taken; s32 remaining_count; taken = read_source->count; remaining_count = taken; - if (size < taken) { - taken = size; + if (requested_count < taken) { + taken = requested_count; } remaining_count -= taken; read_source->count = remaining_count; From b6fbe6aeeb5627046c74b84b744a208d7ad3a2ce Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:43:07 +0000 Subject: [PATCH 385/657] decomp: clarify names in FUN_L00_0026d000 size -> initial_particle_size: Authoritative C stores size directly to *(float *)(particle + 0xC) after allocating type 0x17. Retail 0x0026d03c preserves incoming f15 in f22, and 0x0026d0a4 stores f22 to 0xc(s0). Original Ghidra agrees with *(undefined4 *)(iVar8 + 0xc) = param_4. The supplied update_moving_spinning_fade_in_out_effect_particle subsequently multiplies particle->size by a frame-scaled factor. Thus this argument is the initial particle size, not the multiplicative size factor. --- .../rendering/effects/update_three_phase_effect_particle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c index 5caa1c7541..5353b847c1 100644 --- a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c +++ b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c @@ -1818,7 +1818,7 @@ unsigned char *FUN_L00_0026d000(void *spawn_position, float lo, float hi, - float size) { + float initial_particle_size) { unsigned char *particle = FUN_L00_002678b8_26d000(0x17); if (particle) { unsigned char *particle_data; @@ -1829,7 +1829,7 @@ unsigned char *FUN_L00_0026d000(void *spawn_position, particle_data = particle + 0x20; particle[9] = truncate_float_to_s32(4.0f) + 0x70; particle[3] = 0x48; - *(float *)(particle + 0xC) = size; + *(float *)(particle + 0xC) = initial_particle_size; particle[1] = 0; particle[8] = 0; particle[2] = *D_L00_001B20DC; From e751d7172706d0511557916e5b38d849fc185ccc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:43:07 +0000 Subject: [PATCH 386/657] decomp: clarify names in spawn_moby_particle_and_glow_burst count -> particle_count: In the authoritative src/overlays/shared/weapons/visibomb_missile.c snapshot (SHA-256 1ddb7e5102acd429042d3a09f592afeafa98f5e6408a5bebe8d732f1c282275d), count is truncate_float_to_s32(view_origin_distance)+2 below distance 8, otherwise 10; it initializes i for the do/while containing exactly one FUN_L00_0026a9f0 call. Retail 0x002b5e54-0x002b5e64 selects v0=10 or truncated distance+2; 0x002b5e84-0x002b5e88 checks positivity and retains it in s4. The decrement at 0x002b5eac and back-edge at 0x002b5fd0 bound one particle-spawner call at 0x002b5fc8 per iteration. Original Ghidra iVar8 follows this same selection and countdown. The existing assembler binding and supplied callee allocate one particle per accepted call, proving the requested particle count role. --- src/overlays/shared/weapons/visibomb_missile.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/weapons/visibomb_missile.c b/src/overlays/shared/weapons/visibomb_missile.c index ebfb4c6c89..5bfacd9dc6 100644 --- a/src/overlays/shared/weapons/visibomb_missile.c +++ b/src/overlays/shared/weapons/visibomb_missile.c @@ -724,7 +724,7 @@ void spawn_moby_particle_and_glow_burst(char *source_moby, int flag) { V6 A; V6 B; float view_origin_distance, extra, sc; - int count, i, j; + int particle_count, i, j; qcopy(elevated_spawn_position, &MOBY(source_moby)->pos); elevated_spawn_position[2] += 0.3f; @@ -739,15 +739,15 @@ void spawn_moby_particle_and_glow_burst(char *source_moby, int flag) { clear_u64_value(particle_velocity); view_origin_distance = fast_vec_length(view_origin_delta); if (view_origin_distance < 8.0f) { - count = truncate_float_to_s32(view_origin_distance) + 2; + particle_count = truncate_float_to_s32(view_origin_distance) + 2; } else { - count = 10; + particle_count = 10; } extra = 0.0f; if (view_origin_distance < 7.0f) extra = 7.0f - view_origin_distance; - if (count > 0) { - i = count; + if (particle_count > 0) { + i = particle_count; do { int *pa, *pb; int particle_frame_count, particle_random_frame_value; From ca46d5dd238e1e4a368ebac992d2e22baadf54ad Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:43:07 +0000 Subject: [PATCH 387/657] decomp: clarify names in break_crate count -> debris_count: Source assigns count 1, 2 or 4 and uses it solely as the bound of the first spawn_crate_debris loop, which traverses position table D_L00_001DE6F0 and spin table D_L00_001DE750. Retail 002d0cec-002d0d34 sets s0 to these counts; 002d0dc0 tests s0, 002d0de0 copies it to loop counter s3, 002d0eb0 calls spawn_crate_debris, and 002d0ee4-002d0ef0 advances both tables by 16 bytes and decrements s3 until zero. Original decompilation independently shows iVar15 bounding that sequence. This is the requested number of debris spawn attempts, separate from trail_count at sp+0xE0; it does not assert allocation success. --- src/overlays/shared/pickups/crate.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/pickups/crate.c b/src/overlays/shared/pickups/crate.c index 01d119cb6f..36c2e74864 100644 --- a/src/overlays/shared/pickups/crate.c +++ b/src/overlays/shared/pickups/crate.c @@ -1037,7 +1037,7 @@ void break_crate(M2d1428 *moby, s32 hit, s32 source) { V2d09b8 position, away, rotation, basis[3], launch, spawn_pos, spin; s32 kind; M2d1428 *broken_crate_moby; - s32 close, count, trail_count, particle, i, choice; + s32 close, debris_count, trail_count, particle, i, choice; s32 random_range_lower_bound, random_range_upper_bound, first_color, second_color; f32 angle, distance, height, speed, rise; u32 colors[6], other_colors[6]; @@ -1118,22 +1118,22 @@ void break_crate(M2d1428 *moby, s32 hit, s32 source) { break; } if (D_L00_0015FFBC >= 201) { - count = 4; + debris_count = 4; trail_count = 4; } else if (D_L00_0015FFBC >= 151) { - count = 2; + debris_count = 2; trail_count = 2; } else if (D_L00_0015FFBC >= 101) { - count = 2; + debris_count = 2; trail_count = 1; } else { if (!angle) { } if (D_L00_0015FFBC >= 51) { - count = 1; + debris_count = 1; trail_count = 0; } else { - count = 1; + debris_count = 1; trail_count = 0; } } @@ -1147,7 +1147,7 @@ void break_crate(M2d1428 *moby, s32 hit, s32 source) { clear_u64_value(&rotation); rotation.f[2] = angle; euler_rotation_basis(&basis, &rotation); - for (i = 0; i < count; ++i) { + for (i = 0; i < debris_count; ++i) { transform_vector_by_basis(&spawn_pos, &D_L00_001DE6F0_2d09b8[i], &basis); fast_vec_add(&spawn_pos, &spawn_pos, &moby->pos); qcopy(&spin, &D_L00_001DE750_2d09b8[i]); From 0caf1c637b65fc45548fa9ee39ab4042791ff7b4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:43:07 +0000 Subject: [PATCH 388/657] decomp: clarify names in rebuild_follow_camera_pose offset -> target_to_camera_offset: The sole float offset[4] binding maps to retail sp+0x40 (original Ghidra auStack_130). At 0x002e6760-0x002e6770 transform_vector_by_basis writes it from part=(-orbit distance,0,orbit height,0) using the followed moby's basis at target+0xC0 -> +0xC0. At 0x002e6774-0x002e6780 it is added to target (s6) to write camera_moby+0x30 (s2), proving a target-to-camera displacement. At 0x002e6a1c-0x002e6a28 the same buffer receives camera_moby+0x30 minus target. At 0x002e6a2c-0x002e6a5c its tracked-up projection is subtracted in place and the remaining length tested against 0.05 at 0x002e6a70, deciding whether to nudge camera position. Thus target_to_camera_offset describes both placement and displacement-check uses. --- src/overlays/shared/camera/follow_camera_setup.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 665933aed7..efbe15e60b 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -457,7 +457,7 @@ void rebuild_follow_camera_pose(int snap) { int mask; float *from, *to; if (snap) { - float offset[4], part[4], basis[12], delta[4], start[4]; + float target_to_camera_offset[4], part[4], basis[12], delta[4], start[4]; float length; struct Hero *player = &hero; struct Hero *hero2, *hero3; @@ -467,8 +467,8 @@ void rebuild_follow_camera_pose(int snap) { part[3] = 0.0f; mask = 0x94; copy_matrix3x4(basis, player->rot_matrix); - transform_vector_by_basis(offset, part, *(char **)(target + 0xC0) + 0xC0); - fast_vec_add(camera_moby + 0x30, target, offset); + transform_vector_by_basis(target_to_camera_offset, part, *(char **)(target + 0xC0) + 0xC0); + fast_vec_add(camera_moby + 0x30, target, target_to_camera_offset); fast_vec_scale(rise, *(char **)(target + 0xC0) + 0xE0, *(float *)(target + 0xB0)); fast_vec_add(eye, target, rise); if (FUN_001efa68(eye, camera_moby + 0x30, mask, (int)player->moby, 0)) { @@ -522,11 +522,11 @@ void rebuild_follow_camera_pose(int snap) { } } /* straight above or below the target: nudge the camera sideways */ - fast_vec_sub(offset, (float *)&MOBY(camera_moby)->update_dist, (float *)target); - length = fast_vec_dot(offset, track + 0x30); + fast_vec_sub(target_to_camera_offset, (float *)&MOBY(camera_moby)->update_dist, (float *)target); + length = fast_vec_dot(target_to_camera_offset, track + 0x30); fast_vec_scale(part, track + 0x30, length); - fast_vec_sub(offset, offset, part); - if (fast_vec_length(offset) < 0.05f) { + fast_vec_sub(target_to_camera_offset, target_to_camera_offset, part); + if (fast_vec_length(target_to_camera_offset) < 0.05f) { if (random_integer_below(2)) *(float *)(camera_moby + 0x30) += 0.5f; else From 292c552de4d90e9b22a202b0ce263759c72454af Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:43:07 +0000 Subject: [PATCH 389/657] decomp: clarify names in process_hero_race_object_interactions count -> color_pulse_period_frames: Retail 0x00253cdc-0x00253cec calls scale_game_frames with 0x32, retains its integer result in s0 and converts it to float. At 0x00253d0c-0x00253d3c the frame counter at 0x0015f5cc is reduced modulo s0, divided by that float period, doubled and mapped through sine. At 0x00253d40-0x00253d7c this wave produces RGB components, packed at 0x00253dc4-0x00253ddc and stored to class 0x474 Moby+0x90 at 0x00253e08. Current C count has exactly this frame-period data flow; original retail decompilation agrees. --- .../shared/hero/process_hero_primary_item_input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/process_hero_primary_item_input.c b/src/overlays/shared/hero/process_hero_primary_item_input.c index 1517729a06..ea887a5fe9 100644 --- a/src/overlays/shared/hero/process_hero_primary_item_input.c +++ b/src/overlays/shared/hero/process_hero_primary_item_input.c @@ -1256,7 +1256,7 @@ void process_hero_race_object_interactions(void) { u8 *third; f32 delta[4]; f32 matrix[16]; - s32 count, red, green, blue; + s32 color_pulse_period_frames, red, green, blue; f32 period, wave, ratio; if (hero.hoverboard_moby == 0) @@ -1284,9 +1284,9 @@ void process_hero_race_object_interactions(void) { } while (boost_trigger_moby != 0); } } - count = scale_game_frames(0x32); - period = convert_integer_to_float(count); - ratio = (f32)(D_L00_0015F5CC % count) / period; + color_pulse_period_frames = scale_game_frames(0x32); + period = convert_integer_to_float(color_pulse_period_frames); + ratio = (f32)(D_L00_0015F5CC % color_pulse_period_frames) / period; ratio += ratio; wave = fast_sin(ratio * 3.1415927f + -3.1415927f); red = truncate_float_to_s32(wave * 48.0f) + 0x68; From 6d7a0bc13cbe8be58ac6686d2eff73613121eebd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:43:07 +0000 Subject: [PATCH 390/657] decomp: clarify names in ship_rocket_update offset -> trail_particle_vector: In the authoritative source offset is the single Vec4 reused for trail emission. Retail 00309610 binds it to sp+0x40 (s0, then s7/s5 at 00309614/00309620). At 00309624-00309640 fast_vec_normalize writes the negated random-length rocket_vars->step contribution there and fast_vec_add adds it to velocity for the first particle. At 003096c4-003096e4 the same s5 vector is rebuilt from step with random fractional speed, then moby+0x10 is added; 00309720/00309730 passes it as the grey smoke particle spawn position. 003097b8/003097c8 passes the same vector via s7 as the second trail effect's spawn position. Original Ghidra auStack_100 follows these same normalize/add and two spawn uses. Thus trail_particle_vector describes both proven roles without falsely claiming a permanent offset or world position. --- src/overlays/shared/vehicles/ship_rocket.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/vehicles/ship_rocket.c b/src/overlays/shared/vehicles/ship_rocket.c index c80d508c40..25b57264e1 100644 --- a/src/overlays/shared/vehicles/ship_rocket.c +++ b/src/overlays/shared/vehicles/ship_rocket.c @@ -61,7 +61,7 @@ void ship_rocket_update(struct Moby *moby) { }; Missile_94f8 *rocket_vars = (Missile_94f8 *)moby->pvars; Vec4f *pos; - Vec4 previous_pos, spray, offset, velocity, random; + Vec4 previous_pos, spray, trail_particle_vector, velocity, random; float fraction; struct Moby *target; char *texture; @@ -75,8 +75,8 @@ void ship_rocket_update(struct Moby *moby) { velocity.q = random.q; fast_vec_normalize(&velocity, &velocity, random_float_between(0.1f, 0.2f) * frame_time); fast_vec_normalize( - &offset, &rocket_vars->step, -random_float_between(frame_time * 0.1f, frame_time)); - fast_vec_add(&velocity, &velocity, &offset); + &trail_particle_vector, &rocket_vars->step, -random_float_between(frame_time * 0.1f, frame_time)); + fast_vec_add(&velocity, &velocity, &trail_particle_vector); FUN_L00_002712b8(&moby->pos, &velocity, scale_game_frames(6), @@ -91,12 +91,12 @@ void ship_rocket_update(struct Moby *moby) { texture = rocket_smoke_texture; for (fraction = 0.0f; fraction < 1.0f; fraction += 0.33333334f) { unsigned char *particle; - fast_vec_normalize(&offset, + fast_vec_normalize(&trail_particle_vector, &rocket_vars->step, random_float_between(fraction, fraction + 0.33333334f) * rocket_vars->speed); - fast_vec_add(&offset, &offset, &moby->pos); - particle = FUN_L00_002712b8(&offset, + fast_vec_add(&trail_particle_vector, &trail_particle_vector, &moby->pos); + particle = FUN_L00_002712b8(&trail_particle_vector, &velocity, scale_game_frames(60), 0x7f, @@ -118,7 +118,7 @@ void ship_rocket_update(struct Moby *moby) { transform_vector_by_basis(&random, &random, &moby->rot_row0); build_look_at_matrix(&random, &random, &moby->rot_row0, random_angle_radians()); FUN_L00_0026cbb0( - &offset, &random, 0x4f007fff, 0x1fffffff, scale_game_frames(5), 1, 20000.0f); + &trail_particle_vector, &random, 0x4f007fff, 0x1fffffff, scale_game_frames(5), 1, 20000.0f); } pos = &moby->pos; target = rocket_vars->target; From 762e5e5c2619333b20907a8de9e282ed29b14645 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:45:37 +0000 Subject: [PATCH 391/657] decomp: clarify names in set_voice_position offset -> voice_slot_byte_offset: Source declares offset = index * 0x70 and adds it to char-pointer voice_table and vector_base. Retail 0x002982e8 loads stride 0x70 and 0x002982f0 multiplies a0 by it; 0x002982fc adds the displacement to voice storage origin 0x0013e550 for the flag byte at +0x75, and 0x00298304 adds it to origin +0xA0 for the 16-byte position store at 0x00298314. The supplied caller passes the index returned by start_moby_voice. Thus this is the selected voice slot's byte displacement. --- src/overlays/l13/mobys/forcefield_tower.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l13/mobys/forcefield_tower.c b/src/overlays/l13/mobys/forcefield_tower.c index 627544db10..f47d1d08d4 100644 --- a/src/overlays/l13/mobys/forcefield_tower.c +++ b/src/overlays/l13/mobys/forcefield_tower.c @@ -93,12 +93,12 @@ typedef struct { int set_voice_position(int index, const void *vector) __asm__("FUN_L13_002982e8"); int set_voice_position(int index, const void *vector) { - int offset = index * 0x70; + int voice_slot_byte_offset = index * 0x70; char *voice_table = D_0013E533 + 0x1D; char *vector_base = voice_table + 0xA0; - Level13SoundEffectTarget *effect = (Level13SoundEffectTarget *)(voice_table + offset); + Level13SoundEffectTarget *effect = (Level13SoundEffectTarget *)(voice_table + voice_slot_byte_offset); effect->flags |= 0x40; - qcopy(vector_base + offset, vector); + qcopy(vector_base + voice_slot_byte_offset, vector); return 1; } From a3244f73636cff03802c6af4746483a85902758d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:45:37 +0000 Subject: [PATCH 392/657] decomp: clarify names in emit_blarg_elite_commando_death_particles count -> particle_count: Authoritative C assigns count = truncate_float_to_s32(distance) + 2 below distance 8, otherwise 10, then initializes remaining = count. Retail 0x002d4288-0x002d4298 produces this integer in v0; 0x002d42b8 guards positivity and 0x002d42c0 copies it to s4. The decrement at 0x002d42e4 and back-edge at 0x002d4408 bound a loop containing exactly one particle spawn at 0x002d4400 (FUN_L00_0026a9f0 binding), proving this is the randomized particle count. Subsequent glow calls are outside this loop. --- src/overlays/shared/enemies/blarg_elite_commando.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_elite_commando.c b/src/overlays/shared/enemies/blarg_elite_commando.c index d4fee5b356..1097929b59 100644 --- a/src/overlays/shared/enemies/blarg_elite_commando.c +++ b/src/overlays/shared/enemies/blarg_elite_commando.c @@ -807,7 +807,7 @@ void emit_blarg_elite_commando_death_particles(void *moby) { float delta[4], velocity[4], position[4]; L16ParticleChoices first_particle_choices, second_particle_choices; float distance, range, delay; - int count; + int particle_count; void *origin; float *joint = position; void *movement; @@ -816,16 +816,16 @@ void emit_blarg_elite_commando_death_particles(void *moby) { clear_u64_value(velocity); distance = fast_vec_length(delta); if (distance < 8.0f) - count = truncate_float_to_s32(distance) + 2; + particle_count = truncate_float_to_s32(distance) + 2; else - count = 10; + particle_count = 10; range = 0.0f; if (distance < 7.0f) range = 7.0f - distance; origin = position; movement = velocity; - if (count > 0) { - int remaining = count; + if (particle_count > 0) { + int remaining = particle_count; do { float sample; int *first_choice, *second_choice, duration1, duration2; From cad0bb88e9e56ddbfdfdef03c34efb5619b860d8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:45:37 +0000 Subject: [PATCH 393/657] decomp: clarify names in wrench_update count -> hit_descriptor_amount: In the active melee branch, retail 002a8d50 sets s2=1 and 002a8d60 sets s2=2 for hero state 20; 002a8d78-002a8d80 converts that scalar to f12 and 002a8d98 passes it to established make_hit_descriptor. Checked retail helper 00259894 stores f12 at descriptor+0x1c, separately from its direction vector and owner/flags fields. At 002a8df8 the descriptor is passed to sweep_hit_segment; checked 00259d2c retains it in s6 and 00259dfc forwards it as t0 to collision_line. Thus this is the hit descriptor amount, not the sweep sample count (the separate t2=5 at 002a8df0). --- src/overlays/shared/weapons/wrench.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/wrench.c b/src/overlays/shared/weapons/wrench.c index dee0aa6fec..dfa47e2ad2 100644 --- a/src/overlays/shared/weapons/wrench.c +++ b/src/overlays/shared/weapons/wrench.c @@ -818,11 +818,11 @@ void wrench_update(WrenchMoby *wrench_moby) { spawn_wrench_impact_effects((char *)wrench_moby); } if (active) { - int count = 1; + int hit_descriptor_amount = 1; float scale = 1.0f, radius; if (wrench_hero()->state == 20) { scale = 1.55f; - count = 2; + hit_descriptor_amount = 2; } wrench_collision_scratch.v[3][0] = fast_cos(yaw); wrench_collision_scratch.v[3][1] = fast_sin(yaw); @@ -830,7 +830,7 @@ void wrench_update(WrenchMoby *wrench_moby) { make_hit_descriptor(wrench_collision_scratch.v[0], wrench_moby, 0x10000, - (float)count, + (float)hit_descriptor_amount, wrench_collision_scratch.v[3]); set_vector_length_xy( wrench_collision_scratch.v[0], wrench_collision_scratch.v[0], scale); From c829d918816eea821b910424a45e71c0c6e49808 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:45:37 +0000 Subject: [PATCH 394/657] decomp: clarify names in _sysbitJump offset -> byte_position: In src/sdk/system/sysbit_jump.c (SHA-256 150a73f5fd458b6dabd150d392b66f32fae9e15ce959f723e672b43a08a099bf), offset is first (u32)(total >> 3), converting the accumulated bit total to a byte position, then receives unwrapped_byte_pointer and supplies the wrap subtraction. Retail 0x0012aad0-0x0012aad4 derives the shifted total; 0x0012aadc adds ctx+0x8; 0x0012aaf0 stores the byte pointer at ctx+0xc; 0x0012aaf4-0x0012aafc subtracts ctx+0x28 on wrapping. The original Ghidra uVar2 follows that same pointer and wrap data flow. Thus byte_position describes both the initial byte position and its subsequent base-adjusted position without asserting an unproven origin. --- src/sdk/system/sysbit_jump.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/system/sysbit_jump.c b/src/sdk/system/sysbit_jump.c index 1af758c8ec..e646b68684 100644 --- a/src/sdk/system/sysbit_jump.c +++ b/src/sdk/system/sysbit_jump.c @@ -15,18 +15,18 @@ typedef struct SysbitState { void _sysbitJump(SysbitState *ctx, s32 bits) { s64 total; - u32 offset; + u32 byte_position; u32 unwrapped_byte_pointer; ctx->bits = 0; ctx->cnt = 0; total = (ctx->total = (bits * 8) + ctx->total); - offset = (u32)(total >> 3); - unwrapped_byte_pointer = ctx->field8 + offset; - offset = unwrapped_byte_pointer; + byte_position = (u32)(total >> 3); + unwrapped_byte_pointer = ctx->field8 + byte_position; + byte_position = unwrapped_byte_pointer; ctx->bit_pointer = unwrapped_byte_pointer; if (unwrapped_byte_pointer >= ctx->limit) { - ctx->bit_pointer = offset - ctx->wrap_base; + ctx->bit_pointer = byte_position - ctx->wrap_base; } _sysbitFlush(ctx, 0); } From 4d10a9a8e9365d2bba814741ecbb1b4e2a2aab27 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:47:32 +0000 Subject: [PATCH 395/657] decomp: clarify names in measure_text_width count -> chars_processed: In source snapshot src/ui/text/font/measure_text_width.c SHA-256 ececd11211aac59776dc1c3abc01fa1ad78b62fdc5b4983ff815290213aa25a4, count starts at zero, increments once after each text byte is read, and is compared to max_chars independently of glyph_advance. Retail 0x001f6208 initializes t1; 0x001f6218 reads the text byte, 0x001f621c increments t1, and 0x001f6234 compares t1 with a1 (max_chars). The original Ghidra iVar3 likewise tracks consumed characters and terminates at maximum_characters. Thus chars_processed identifies the counted entity and progress role, including zero-advance glyphs. --- src/ui/text/font/measure_text_width.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/text/font/measure_text_width.c b/src/ui/text/font/measure_text_width.c index 86fb29bd27..b99309e069 100644 --- a/src/ui/text/font/measure_text_width.c +++ b/src/ui/text/font/measure_text_width.c @@ -4,13 +4,13 @@ s32 measure_text_width(u8 *text, s32 max_chars, s32 glyph_table) __asm__("FUN_00 s32 measure_text_width(u8 *text, s32 max_chars, s32 glyph_table) { s32 total; - s32 count; + s32 chars_processed; s8 glyph_advance; u8 *text_cursor; u8 index; total = 0; - count = 0; + chars_processed = 0; if (max_chars == 0) goto done; if (*text == 0) @@ -19,11 +19,11 @@ s32 measure_text_width(u8 *text, s32 max_chars, s32 glyph_table) { do { index = *text_cursor; text_cursor++; - count++; + chars_processed++; glyph_advance = *(s8 *)(glyph_table + index * 4 + 3); if (glyph_advance != 0) total += glyph_advance; - } while (count != max_chars && *text_cursor != 0); + } while (chars_processed != max_chars && *text_cursor != 0); done: return total; } From 139d1c11c33d8304d47a19eaa34408508ac404be Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:47:32 +0000 Subject: [PATCH 396/657] decomp: clarify names in compose_bitmap_from_mask count -> mask_bit_countdown: Authoritative C initializes count to 7 inside each mask-byte iteration, decrements it once per selected source byte and repeats while count >= 0. Retail 0x002053ec initializes v1 to 7, 0x002053f4 decrements it, and 0x0020541c branches while nonnegative. Each iteration tests *mask against the shifting bit (0x002053f0-0x00205400), selects one source byte and writes it at 0x00205410. Original Ghidra iVar3 confirms the same eight-iteration signed countdown before param_4 advances one byte. --- src/rendering/texture/compose_bitmap_from_mask.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rendering/texture/compose_bitmap_from_mask.c b/src/rendering/texture/compose_bitmap_from_mask.c index c9f9e8e703..8728dd1394 100644 --- a/src/rendering/texture/compose_bitmap_from_mask.c +++ b/src/rendering/texture/compose_bitmap_from_mask.c @@ -11,7 +11,7 @@ void compose_bitmap_from_mask(u8 *composed_bitmap, u8 *src_set, u8 *src_clear, u do { s32 bit = 1; u8 *next_mask_byte = mask + 1; - s32 count = 7; + s32 mask_bit_countdown = 7; do { u8 selected_source_byte; if (*mask & bit) @@ -22,9 +22,9 @@ void compose_bitmap_from_mask(u8 *composed_bitmap, u8 *src_set, u8 *src_clear, u src_set += 1; src_clear += 1; composed_bitmap += 1; - count -= 1; + mask_bit_countdown -= 1; bit <<= 1; - } while (count >= 0); + } while (mask_bit_countdown >= 0); outer += 1; mask = next_mask_byte; } while (outer <= limit); From 1abf34d61988df457ced0686553fbcd8ac1772b8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:47:32 +0000 Subject: [PATCH 397/657] decomp: clarify names in count_gold_weapons count -> purchased_gold_weapon_count: In the bound source count starts at zero and increments only when item_text_variant[i] is nonzero across 0x25 classes. Retail 0x00215304 initializes a2; 0x00215318 loads each flag and 0x00215314/0x00215328 conditionally increment a2. The supplied original Ghidra decompilation identifies these bytes as g_bGold_weapon_purchased. Instructions 0x0021532c-0x00215344 clamp this purchase tally to [0,10] for return. --- src/ui/menus/weapons/count_gold_weapons.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ui/menus/weapons/count_gold_weapons.c b/src/ui/menus/weapons/count_gold_weapons.c index 5a620998c4..a2b1916f79 100644 --- a/src/ui/menus/weapons/count_gold_weapons.c +++ b/src/ui/menus/weapons/count_gold_weapons.c @@ -4,18 +4,18 @@ s32 count_gold_weapons(void) __asm__("FUN_00215300"); s32 count_gold_weapons(void) { - s32 count = 0; + s32 purchased_gold_weapon_count = 0; s32 i; for (i = 0; i < 0x25; i++) { if (item_text_variant[i] != 0) { - count++; + purchased_gold_weapon_count++; } } - if (count < 0) { - count = 0; + if (purchased_gold_weapon_count < 0) { + purchased_gold_weapon_count = 0; } - return (count < 0xB) ? count : 0xA; + return (purchased_gold_weapon_count < 0xB) ? purchased_gold_weapon_count : 0xA; } extern __typeof__(count_gold_weapons) func_00215300 __attribute__((alias("FUN_00215300"))); From 5ffff52a0758080f1fdd35b90de584ff830e5e94 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:47:32 +0000 Subject: [PATCH 398/657] decomp: clarify names in count_skill_points count -> completed_skill_points: In the authoritative count_skill_points source, count starts at zero and increments only when item_unlocked[i] is nonzero across 32 slots. Retail 0x0021534c initializes a2 to zero; 0x0021535c forms a2+1, 0x00215360 loads a completion byte, and 0x00215370 conditionally updates a2 only for a nonzero byte. The prepared Ghidra decompilation names this array g_bSkill_point_completed. Instructions 0x00215378-0x0021538c cap the returned completed skill-point total at 30. --- src/ui/menus/weapons/count_skill_points.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ui/menus/weapons/count_skill_points.c b/src/ui/menus/weapons/count_skill_points.c index 31e298e423..792f629e72 100644 --- a/src/ui/menus/weapons/count_skill_points.c +++ b/src/ui/menus/weapons/count_skill_points.c @@ -4,18 +4,18 @@ s32 count_skill_points(void) __asm__("FUN_00215348"); s32 count_skill_points(void) { - s32 count = 0; + s32 completed_skill_points = 0; s32 i; for (i = 0; i < 0x20; i++) { if (item_unlocked[i] != 0) { - count++; + completed_skill_points++; } } - if (count < 0) { - count = 0; + if (completed_skill_points < 0) { + completed_skill_points = 0; } - return (count < 0x1F) ? count : 0x1E; + return (completed_skill_points < 0x1F) ? completed_skill_points : 0x1E; } extern __typeof__(count_skill_points) func_00215348 __attribute__((alias("FUN_00215348"))); From d9c1d318e0c19697ef7607843dc75c48947de4c9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:47:32 +0000 Subject: [PATCH 399/657] decomp: clarify names in collect_oil_tanker_chain_mobys count -> chain_moby_count: In the authoritative C snapshot ad47850b118dd138e4d58a3053bc7a1982ea53ce7e4a5f38f35e70bb30368956, count is initialized from tanker_chain_vars+0x64 plus one and returned. Retail 0x00318058 loads the active link count into v1, 0x00318068 adds one, and 0x0031809c returns it. The head is stored at output[0] by 0x0031805c, and 0x00318078-0x00318094 copies link pointers from pvars+0x70 into subsequent slots. Thus this local counts the collected chain mobys including the head; supplied targeting and HUD callers use the return as the array traversal bound. --- src/overlays/l11/mobys/oil_tanker_front.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l11/mobys/oil_tanker_front.c b/src/overlays/l11/mobys/oil_tanker_front.c index 5bd6c11a68..d6ce6abc6a 100644 --- a/src/overlays/l11/mobys/oil_tanker_front.c +++ b/src/overlays/l11/mobys/oil_tanker_front.c @@ -421,12 +421,12 @@ int collect_oil_tanker_chain_mobys(struct Moby *moby, void **out) __asm__("FUN_L int collect_oil_tanker_chain_mobys(struct Moby *moby, void **chain_mobys_output) { char *tanker_chain_vars = (char *)moby->pvars; int i; - int count = *(int *)(tanker_chain_vars + 0x64) + 1; + int chain_moby_count = *(int *)(tanker_chain_vars + 0x64) + 1; chain_mobys_output[0] = moby; for (i = 0; i < *(int *)(tanker_chain_vars + 0x64); i++) { chain_mobys_output[i + 1] = ((void **)(tanker_chain_vars + 0x70))[i]; } - return count; + return chain_moby_count; } /* Spreads the 0x527 chain mobys of a D_L11_001AC240 group evenly along path table_index: each gets a start point and its path index. */ From d9018bffe4b66f8393c47c323cc17a5a87e25563 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:47:32 +0000 Subject: [PATCH 400/657] decomp: clarify names in draw_hoven_turret_destruction_fade count -> fade_duration_frames: In draw_hoven_turret_destruction_fade, count is initialized by scale_game_frames(0x50), matching retail jal 0x00221df0 at 0x00304da8 with a0=0x50. Retail 0x00304db4 keeps that result in v1, 0x00304db8 compares the +0xac signed destruction countdown against it, and 0x00304dc0..0x00304de0 computes (v1-countdown)*80/v1 as the RGBA alpha. The supplied update initializes and decrements destruction_respawn_frames at +0xac and registers this callback in destruction state 7, proving count is the fade duration in scaled game frames. --- src/overlays/l12/mobys/hoven_turret.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l12/mobys/hoven_turret.c b/src/overlays/l12/mobys/hoven_turret.c index aa4b70f92b..0ddc1a6501 100644 --- a/src/overlays/l12/mobys/hoven_turret.c +++ b/src/overlays/l12/mobys/hoven_turret.c @@ -855,9 +855,9 @@ void draw_hoven_turret_destruction_fade(Level12VendorCounterMoby *moby) __asm__( void draw_hoven_turret_destruction_fade(Level12VendorCounterMoby *moby) { Level12VendorCounterData *data = moby->data; - int count = scale_game_frames(0x50); + int fade_duration_frames = scale_game_frames(0x50); int value = data->value; - if (value < count) { - emit_rgba_draw_packet(0xAA, 0, 0, (count - value) * 0x50 / count); + if (value < fade_duration_frames) { + emit_rgba_draw_packet(0xAA, 0, 0, (fade_duration_frames - value) * 0x50 / fade_duration_frames); } } From 084345a10ce3ea7e1a2d934ebd51eac9d0fc1eb3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:49:34 +0000 Subject: [PATCH 401/657] decomp: clarify names in vi_buf_count count -> byte_count: In source snapshot cb924238e20220161c3b0cf797bea11583937bba3280135c675a89ed636133dd, count receives (input_buffer->dma_n << 0xB) + input_buffer->read_bytes and is returned. Retail 0x0023c62c/0x0023c630 load the corresponding fields at +0x10/+0x14, 0x0023c638 scales the first by 2048, 0x0023c640 adds the byte field, and 0x0023c644 returns the sum. Original Ghidra likewise returns iVar1 * 0x800 + iVar2 under the semaphore. Thus byte_count names the proven unit without claiming wider lifecycle semantics. --- src/movies/decoder/video_input/vi_buf_count.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/movies/decoder/video_input/vi_buf_count.c b/src/movies/decoder/video_input/vi_buf_count.c index 14634c224e..80ef66382d 100644 --- a/src/movies/decoder/video_input/vi_buf_count.c +++ b/src/movies/decoder/video_input/vi_buf_count.c @@ -6,12 +6,12 @@ extern s32 wait_semaphore() __asm__("FUN_001189b0"); s32 vi_buf_count(struct ViBuf *buf) __asm__("FUN_0023c610"); s32 vi_buf_count(struct ViBuf *input_buffer) { - s32 count; + s32 byte_count; wait_semaphore(input_buffer->sema); - count = (input_buffer->dma_n << 0xB) + input_buffer->read_bytes; + byte_count = (input_buffer->dma_n << 0xB) + input_buffer->read_bytes; signal_semaphore(input_buffer->sema); - return count; + return byte_count; } extern s32 func_0023C610(struct ViBuf *buf) __attribute__((alias("FUN_0023c610"))); From 11f6d6c98ed676cf0e7e753c1c0920fc541b0e56 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:49:34 +0000 Subject: [PATCH 402/657] decomp: clarify names in __sseek offset -> byte_offset: In src/sdk/libc/stdio/sseek.c (SHA-256 989da73b5ca07005a6ca1a91728ac5efd2b0f769d7881b62fe636572d23c4b7b), s32 offset is passed unchanged as the third argument of established _lseek_r(fp->_data, fp->_file, offset, whence). Retail 0x001163a4 preserves incoming a1 in v0 and 0x001163b8 moves it into a2 before the call at 0x001163c0; 0x001163ac supplies whence in a3. This is the byte displacement for the file seek, relative to the origin selected by whence. The returned position is separately cached at FILE+0x50 at 0x001163e8. --- src/sdk/libc/stdio/sseek.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/libc/stdio/sseek.c b/src/sdk/libc/stdio/sseek.c index 77721c29f4..a1904b15f2 100644 --- a/src/sdk/libc/stdio/sseek.c +++ b/src/sdk/libc/stdio/sseek.c @@ -32,11 +32,11 @@ typedef struct __sFILE { extern s64 _lseek_r() __asm__("func_00114518"); -s64 __sseek(void *cookie, s32 offset, s32 whence) { +s64 __sseek(void *cookie, s32 byte_offset, s32 whence) { register FILE *fp = (FILE *)cookie; register s64 ret; - ret = _lseek_r(fp->_data, fp->_file, offset, whence); + ret = _lseek_r(fp->_data, fp->_file, byte_offset, whence); if (ret == -1L) fp->_flags &= ~__SOFF; else { From ab3e1ca7ab05d63b604fe7470ed3ca7288adbd61 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:49:34 +0000 Subject: [PATCH 403/657] decomp: clarify names in calculate_ring_buffer_bounds size -> byte_count: Retail caller 0x0020938c loads DAT_00137b94 and 0x00209394 shifts it left by 11 into a0 for the call at 0x00209390. The same unshifted quantity is passed as a2 to read_cd_sectors_blocking at 0x002093a8, whose destination is the returned start address. Thus a0 is the byte count for that sector extent. In the assigned retail function, 0x001fd6e8 rejects counts above 0x20000; 0x001fd710 and 0x001fd728 subtract that same unsigned parameter from each configured address plus current_vu_chain, matching the authoritative source snapshot SHA-256 20717c0e33619f511008a0faaf0812403830e00c58a72611c41a0efff3567b59. --- src/runtime/memory/calculate_ring_buffer_bounds.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/memory/calculate_ring_buffer_bounds.c b/src/runtime/memory/calculate_ring_buffer_bounds.c index 60ee437f91..a1bbd63ee6 100644 --- a/src/runtime/memory/calculate_ring_buffer_bounds.c +++ b/src/runtime/memory/calculate_ring_buffer_bounds.c @@ -10,8 +10,8 @@ struct RingBufferConfig { extern struct RingBufferConfig D_001940C0; s32 calculate_ring_buffer_bounds(u32 size, s32 *out_start, s32 *out_end) __asm__("FUN_001fd6e0"); -s32 calculate_ring_buffer_bounds(u32 size, s32 *out_start, s32 *out_end) { - if (size > 0x20000U) { +s32 calculate_ring_buffer_bounds(u32 byte_count, s32 *out_start, s32 *out_end) { + if (byte_count > 0x20000U) { *out_start = 0; *out_end = 0; return -1; From 4c0280acc9e101e2167decc07b8393b187ed24b1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:49:34 +0000 Subject: [PATCH 404/657] decomp: clarify names in restore_teleporter_visibility_and_collision count -> child_slot_countdown: The authoritative source initializes count to 2, decrements it once per child++ and loops while count >= 0. Retail 0x002f305c loads a2=2, 0x002f3078 decrements it even for a null child, and 0x002f30a0 branches on a2>=0 while 0x002f30a4 advances the slot pointer by 4. Starting at pvars+0x14 (0x002f3060/68), this visits the three child slots at +0x14,+0x18,+0x1c, matching teleporter_update's three-part creation loop. --- src/overlays/l11/mobys/teleporter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l11/mobys/teleporter.c b/src/overlays/l11/mobys/teleporter.c index c1760908a2..670a81e1eb 100644 --- a/src/overlays/l11/mobys/teleporter.c +++ b/src/overlays/l11/mobys/teleporter.c @@ -359,7 +359,7 @@ void restore_teleporter_visibility_and_collision(struct Moby *moby) { moby->flags &= 0xFFFE; moby->collision = moby->pclass->collision; on = 1; - count = 2; + child_slot_countdown = 2; do { if (*child) { *(unsigned short *)(*child + 0x34) &= 0xFFFE; @@ -367,6 +367,6 @@ void restore_teleporter_visibility_and_collision(struct Moby *moby) { *(int *)(*child + 0x94) = *(int *)(*(char **)(*child + 0x24) + 0x10); } child++; - count--; - } while (count >= 0); + child_slot_countdown--; + } while (child_slot_countdown >= 0); } From 5ff89652e2d783d6d120e889934f56a292020261 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:49:34 +0000 Subject: [PATCH 405/657] decomp: clarify names in load_compressed_hud_bank size -> aligned_raw_size: In the authoritative load_compressed_hud_bank source (SHA-256 1c5e9d17d5db3f4a64827ff230aadce59079de9301fc0b0fb575fd56f3140be5), size = (raw_size + 0xF) & 0xFFFFFFF0. Retail 0x00202d1c adds 15 to a1, 0x00202d20 establishes the mask and 0x00202d28 applies it; 0x00202d2c tests that aligned value, and a1 retains it through the call at 0x00202d48 to func_0020B618. Thus aligned_raw_size describes the proven derivation and use. --- src/ui/hud/banks/load_compressed_hud_bank.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/hud/banks/load_compressed_hud_bank.c b/src/ui/hud/banks/load_compressed_hud_bank.c index efa09061fa..00df23ab56 100644 --- a/src/ui/hud/banks/load_compressed_hud_bank.c +++ b/src/ui/hud/banks/load_compressed_hud_bank.c @@ -5,14 +5,14 @@ extern s32 decompress_wad() __asm__("func_0020B618"); void load_compressed_hud_bank(s32 bank, s32 raw_size) __asm__("FUN_00202d10"); void load_compressed_hud_bank(s32 bank, s32 raw_size) { - s32 size; + s32 aligned_raw_size; u32 level_archive_base; - size = (raw_size + 0xF) & 0xFFFFFFF0; - if (size != 0) { + aligned_raw_size = (raw_size + 0xF) & 0xFFFFFFF0; + if (aligned_raw_size != 0) { level_archive_base = *(u32 *)0x15EE4C; decompress_wad( - *(s32 *)((u8 *)(level_archive_base - (-(bank * 8))) + 0x28) + level_archive_base, size); + *(s32 *)((u8 *)(level_archive_base - (-(bank * 8))) + 0x28) + level_archive_base, aligned_raw_size); } { register u32 b2; From 53d13564377f3b49f941b072c2048f3f32140edb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:52:06 +0000 Subject: [PATCH 406/657] decomp: clarify names in sceSifAllocIopHeap size -> size_bytes: In sceSifAllocIopHeap, retail 0x0011c8d4 copies the incoming a0 to a1 and 0x0011c8ec stores it unchanged at 0x001580C0; 0x0011c900 selects heap RPC 1 and 0x0011c914 sends that four-byte request. The supplied load_irx_module caller passes size_bytes to this allocation and also assigns the same quantity to transfer.size for the DMA into the returned allocation, proving that this parameter measures the requested allocation in bytes. --- src/sdk/rpc/iop/sce_sif_alloc_iop_heap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/rpc/iop/sce_sif_alloc_iop_heap.c b/src/sdk/rpc/iop/sce_sif_alloc_iop_heap.c index 7b5b3b9af9..9f12f0c7b0 100644 --- a/src/sdk/rpc/iop/sce_sif_alloc_iop_heap.c +++ b/src/sdk/rpc/iop/sce_sif_alloc_iop_heap.c @@ -7,10 +7,10 @@ extern u8 D_00158040[]; extern u32 D_00158080[]; extern u8 D_001580C0[]; -void *sceSifAllocIopHeap(s32 size) { +void *sceSifAllocIopHeap(s32 size_bytes) { if (D_0012FCAC < 0) return 0; - *(s32 *)D_001580C0 = size; + *(s32 *)D_001580C0 = size_bytes; if (sceSifCallRpc(D_00158040, 1, 0, D_001580C0, 4, D_00158080, 4, 0, 0) < 0) return 0; return *(void **)D_00158080; From 164fb0f1d6c67b29e285510c57c45e34741ac089 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:52:06 +0000 Subject: [PATCH 407/657] decomp: clarify names in init_mem_slots size -> runtime_reserve_bytes: In src/runtime/memory/init_mem_slots.c (snapshot SHA-256 78452e05c4b4afc2fdcd284bf4f0f7a7a58e816d819410d5fa1b38504682eb08), size is loaded from current_vu_chain. Retail 0x002015e4 loads that value from 0x00160f0c; 0x002015fc adds it to the aligned runtime_memory_base to form level_zero_workspace_base, then 0x00201604 adds the same value again to form memory_slot_three_base. Stores at 0x0020163c/0x00201640 publish those boundaries at 0x001940c8/0x001940cc. These unscaled address additions prove a reserve measured in bytes. The supplied Ghidra plate identifies it as the runtime reserve, and the decompilation uses DAT_00160f0c in both boundary calculations. --- src/runtime/memory/init_mem_slots.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/runtime/memory/init_mem_slots.c b/src/runtime/memory/init_mem_slots.c index 6a8cdef27e..c9676691fb 100644 --- a/src/runtime/memory/init_mem_slots.c +++ b/src/runtime/memory/init_mem_slots.c @@ -6,9 +6,9 @@ void init_mem_slots(void) __asm__("FUN_002015d8"); void init_mem_slots(void) { int runtime_memory_base = (int)D_24135F & 0xFFFFC000; - int size = current_vu_chain; - int level_zero_workspace_base = runtime_memory_base + size; - int memory_slot_three_base = level_zero_workspace_base + size; + int runtime_reserve_bytes = current_vu_chain; + int level_zero_workspace_base = runtime_memory_base + runtime_reserve_bytes; + int memory_slot_three_base = level_zero_workspace_base + runtime_reserve_bytes; int memory_slot_four_base = memory_slot_three_base + 0x64000; int common_archive_base = memory_slot_four_base + 0x30000; D_001940C0[0] = runtime_memory_base; From 5378f27029d10b00bd95710ab0a4a5552dfdc5e6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:54:04 +0000 Subject: [PATCH 408/657] decomp: clarify names in reserve_expired_frame_slot offset -> slot_reuse_delay_frames: The third s32 parameter arrives in a2: retail 0x002efc20 and 0x002efc50 add it to the loaded level_frame_count, then 0x002efc28/0x002efc54 store that sum into the expired slot. Comparisons at 0x002efc14/0x002efc44 require the prior slot deadline to be below the current frame. The supplied robosquawker_update caller passes slot_reuse_delay_frames computed as scale_game_frames(1) * 60.0f, confirming the delay is measured in frames. --- src/overlays/shared/mobys/reserve_expired_frame_slot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/mobys/reserve_expired_frame_slot.c b/src/overlays/shared/mobys/reserve_expired_frame_slot.c index 867af5e601..05c62c2c8d 100644 --- a/src/overlays/shared/mobys/reserve_expired_frame_slot.c +++ b/src/overlays/shared/mobys/reserve_expired_frame_slot.c @@ -8,12 +8,12 @@ extern s32 level_frame_count __asm__("D_L01_0015F5CC"); s32 reserve_expired_frame_slot(s32 *values, s32 count, s32 offset) __asm__("FUN_L01_002efbf8"); -s32 reserve_expired_frame_slot(s32 *values, s32 count, s32 offset) { +s32 reserve_expired_frame_slot(s32 *values, s32 count, s32 slot_reuse_delay_frames) { s32 index = (s32)((u32)count - 1); if (index >= 0) { for (; index >= 0; index--) { if (values[index] < level_frame_count) { - values[index] = (s32)((u32)level_frame_count + (u32)offset); + values[index] = (s32)((u32)level_frame_count + (u32)slot_reuse_delay_frames); break; } } From 301952732fd10cc0c8d2c2f5fdf7b607b338e374 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:54:04 +0000 Subject: [PATCH 409/657] decomp: clarify names in WaitDma count -> timeout_countdown: In src/sdk/dma/wait_dma.c (SHA-256 b540ef2b5d6d1e431d09340438824441852b17aa90a3700d39707f7690946fcc), signed count is initialized to 0x1000000 and predecremented while *chcr & 0x100 remains set. Retail 0x00122f14 initializes s1, 0x00122f34 and 0x00122f5c decrement it, and 0x00122f38 tests its sign. Negative values reach scePrintf("libdma: sync timeout\n") at 0x00122f40 and sceDmaPause at 0x00122f48. Original Ghidra iVar1 has the same countdown and timeout flow, proving timeout_countdown. --- src/sdk/dma/wait_dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/dma/wait_dma.c b/src/sdk/dma/wait_dma.c index 18640695f8..f9dbd444f4 100644 --- a/src/sdk/dma/wait_dma.c +++ b/src/sdk/dma/wait_dma.c @@ -5,11 +5,11 @@ const u8 D_001533E0[] = "libdma: sync timeout\n"; void WaitDma(volatile u32 *chcr) { - s32 count; + s32 timeout_countdown; - count = 0x1000000; + timeout_countdown = 0x1000000; while (*chcr & 0x100) { - if (--count < 0) { + if (--timeout_countdown < 0) { scePrintf(D_001533E0); sceDmaPause(chcr); } From 7ad08ba92087040e987cfde09e149da3c7aa17a9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:54:04 +0000 Subject: [PATCH 410/657] decomp: clarify names in _lastFrame count -> saved_frame_count: Authoritative C assigns count = decoder->frame_count once. Retail 0x0012c150 loads decoder +0x118 into a2 before either branch: _Error at 0x0012c158 receives it unchanged; 0x0012c174 and 0x0012c17c subtract one for the field/frame display paths at 0x0012c198 and 0x0012c180. This proves a saved frame-count value, consistent with _sceMpegFlush reading decoder->frame_count after _lastFrame. --- src/sdk/mpeg/picture/_lastFrame.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/mpeg/picture/_lastFrame.c b/src/sdk/mpeg/picture/_lastFrame.c index b6c4c0a264..c6dc05520c 100644 --- a/src/sdk/mpeg/picture/_lastFrame.c +++ b/src/sdk/mpeg/picture/_lastFrame.c @@ -8,15 +8,15 @@ extern s32 _dispRefImageField(struct MpegDecoder *, struct MpegRefImage *, struct MpegRefImage *, s32); void _lastFrame(struct MpegDecoder *decoder) { - s32 count; - count = decoder->frame_count; + s32 saved_frame_count; + saved_frame_count = decoder->frame_count; if (decoder->second_field != 0) { - _Error(decoder, missing_second_field_message, count); + _Error(decoder, missing_second_field_message, saved_frame_count); } else { if (decoder->picture_structure == 3) { - _dispRefImage(decoder, decoder->ref_images[1], count - 1); + _dispRefImage(decoder, decoder->ref_images[1], saved_frame_count - 1); } else { - _dispRefImageField(decoder, decoder->ref_images[5], decoder->ref_images[9], count - 1); + _dispRefImageField(decoder, decoder->ref_images[5], decoder->ref_images[9], saved_frame_count - 1); } } decoder->second_field = 0; From 6e5f786f9cc398d13e3a19e7b0dd9c5ea0f80f3f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:54:04 +0000 Subject: [PATCH 411/657] decomp: clarify names in hud_heap_alloc size -> allocation_size_bytes: In hud_heap_alloc, retail 0x001ff2a8 saves incoming a0 in s0. At 0x001ff2b4-0x001ff2c0 the heap end minus cursor address is compared with s0. At 0x001ff2d0/0x001ff2dc (s0 + 15) & 0xfffffff0 rounds this byte quantity to 16 bytes, and 0x001ff2e0-0x001ff2e4 adds it directly to the heap cursor. Original Ghidra param_1 has the same comparison and cursor increment; source size is both the requested and then aligned allocation size in bytes. --- src/ui/hud/banks/hud_heap_alloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/hud/banks/hud_heap_alloc.c b/src/ui/hud/banks/hud_heap_alloc.c index 7ae45ffd43..651058dcb4 100644 --- a/src/ui/hud/banks/hud_heap_alloc.c +++ b/src/ui/hud/banks/hud_heap_alloc.c @@ -4,19 +4,19 @@ s32 hud_heap_alloc(s32 size) __asm__("FUN_001ff288"); -s32 hud_heap_alloc(s32 size) { +s32 hud_heap_alloc(s32 allocation_size_bytes) { struct HudState *hud_state_ptr = &hud_state; s32 allocation_address; if (hud_state_ptr->heap_cur == 0) { hud_heap_reset(); } - if (hud_state_ptr->heap_end - hud_state_ptr->heap_cur < size) { + if (hud_state_ptr->heap_end - hud_state_ptr->heap_cur < allocation_size_bytes) { return 0; } allocation_address = hud_state_ptr->heap_cur; - size = (size + 15) & 0xFFFFFFF0; - hud_state_ptr->heap_cur = allocation_address + size; + allocation_size_bytes = (allocation_size_bytes + 15) & 0xFFFFFFF0; + hud_state_ptr->heap_cur = allocation_address + allocation_size_bytes; return allocation_address; } From a32d463cce943c1cdc835f35b2089486b0426d04 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:54:04 +0000 Subject: [PATCH 412/657] decomp: clarify names in count_gold_bolts count -> collected_bolt_count: In the SHA-256-bound count_gold_bolts source, s32 count starts at zero and increments only for D_0014BEC0[row * 4 + k] != 0. Retail 0x00215294 initializes a2 to zero; 0x002152b8 loads a collection-flag byte, 0x002152bc computes a2+1, and 0x002152d0 conditionally commits that increment only when the byte is nonzero. The supplied original Ghidra names this table g_bGold_bolt_collected. The 20-by-4 scan accumulates collected bolts and 0x002152e4-0x002152fc clamps the returned total to [0,40]. --- src/ui/menus/weapons/count_gold_bolts.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/menus/weapons/count_gold_bolts.c b/src/ui/menus/weapons/count_gold_bolts.c index ce50349f74..c57f50e8e5 100644 --- a/src/ui/menus/weapons/count_gold_bolts.c +++ b/src/ui/menus/weapons/count_gold_bolts.c @@ -4,7 +4,7 @@ s32 count_gold_bolts(void) __asm__("FUN_00215290"); s32 count_gold_bolts(void) { - s32 count = 0; + s32 collected_bolt_count = 0; s32 row; s32 k; @@ -15,10 +15,10 @@ s32 count_gold_bolts(void) { } } } - if (count < 0) { - count = 0; + if (collected_bolt_count < 0) { + collected_bolt_count = 0; } - return (count < 0x29) ? count : 0x28; + return (collected_bolt_count < 0x29) ? collected_bolt_count : 0x28; } extern __typeof__(count_gold_bolts) func_00215290 __attribute__((alias("FUN_00215290"))); From 7c3fc30879f3944b4cbb89cef11bc96faba36325 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:54:04 +0000 Subject: [PATCH 413/657] decomp: clarify names in vi_buf_create size -> buffer_element_count: In authoritative src/movies/decoder/video_input/vi_buf_create.c (SHA-256 4d948793a2a0b0b7e7e3b9731608fee5618bcb21ad79f9d28e8a684c381731ea), size is assigned to ViBuf.n and multiplied by VIBUF_ELM_SIZE (2048) for ViBuf.buffSize. Original retail Ghidra likewise stores param_4 in puVar2[2] and param_4 << 0xb in puVar2[6]. Retail 0x0023bc80 shifts the fourth argument a3 left 11 bits, 0x0023bc88 stores the byte capacity at +0x18, and 0x0023bc98 stores the unscaled count at +0x08. Thus it is the buffer element count, each element contributing 2048 bytes. --- src/movies/decoder/video_input/vi_buf_create.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/movies/decoder/video_input/vi_buf_create.c b/src/movies/decoder/video_input/vi_buf_create.c index 57ea331011..448bb87618 100644 --- a/src/movies/decoder/video_input/vi_buf_create.c +++ b/src/movies/decoder/video_input/vi_buf_create.c @@ -40,13 +40,13 @@ s32 vi_buf_create(ViBuf *f, u128 *data, u128 *tag, s32 size, TimeStamp *ts, s32 s32 vi_buf_create( - ViBuf *video_input_buffer, u128 *data, u128 *tag, s32 size, TimeStamp *ts, s32 n_ts) { + ViBuf *video_input_buffer, u128 *data, u128 *tag, s32 buffer_element_count, TimeStamp *ts, s32 n_ts) { struct SemaParam param; video_input_buffer->data = data; video_input_buffer->tag = (u128 *)((((u32)tag) & UNCMASK) | UNCBASE); - video_input_buffer->n = size; - video_input_buffer->buffSize = size * VIBUF_ELM_SIZE; + video_input_buffer->n = buffer_element_count; + video_input_buffer->buffSize = buffer_element_count * VIBUF_ELM_SIZE; video_input_buffer->ts = ts; video_input_buffer->n_ts = n_ts; From 02407be06ac1b45d03cced5811b3b63a2b0e4c17 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:54:04 +0000 Subject: [PATCH 414/657] decomp: clarify names in AdjustTime offset -> minute_delta: In the authoritative src/sdk/time/adjust_time.c snapshot (SHA-256 44ad3e01b0e235d665f7b68ee39dd5938f34dd813cbebf51247ab503d2c288d7), offset is s32 and added to the decoded byte at time+2. Retail 0x0012d660 saves a1 in s0; 0x0012d664 loads clock+2, identified as bMinute in the original Ghidra decompilation; 0x0012d668 adds it to s0. Negative totals add 60 and call decrement_clock_hour at 0x0012d6a8; totals above 60 subtract 60 and call increment_clock_hour at 0x0012d688. The supplied sceScfGetLocalTimefromRTC caller passes time_zone + summer_minutes, with summer_minutes computed using 60. These operations prove a signed minute delta. --- src/sdk/time/adjust_time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/time/adjust_time.c b/src/sdk/time/adjust_time.c index facd608e58..45dfffa6a9 100644 --- a/src/sdk/time/adjust_time.c +++ b/src/sdk/time/adjust_time.c @@ -11,11 +11,11 @@ struct AdjustTimeArg { extern void decode_bcd_time_fields() __asm__("func_0012D3C0"); extern void encode_bcd_time_fields() __asm__("func_0012D428"); -void AdjustTime(struct AdjustTimeArg *time, s32 offset) { +void AdjustTime(struct AdjustTimeArg *time, s32 minute_delta) { s32 hour; decode_bcd_time_fields(); - hour = time->hour + offset; + hour = time->hour + minute_delta; if (hour >= 0) { if (hour >= 0x3D) { do { From 325d84bebf9286f87e7b2e4189f29ac72ca9a391 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:55:59 +0000 Subject: [PATCH 415/657] decomp: clarify names in round_float_to_decimal_places count -> remaining_decimal_places: In the authoritative src/math/round_float_to_decimal_places.c snapshot (SHA-256 5cb4576927e4c385b10120fa66a8ca93e7f2350ceac72575ce6ea78b9753d454), s32 count is initialized from decimal_places, checked positive, decremented once per decimal_scale_factor *= 10, and tested for zero. Retail a0 is checked at 0x00214c54, decremented at 0x00214c60, and tested at 0x00214c74 while the delay-slot multiplication at 0x00214c78 multiplies the scale by ten. The prepared original Ghidra decompilation shows the same decrementing decimal_places loop. Thus this local is remaining_decimal_places. --- src/math/round_float_to_decimal_places.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/math/round_float_to_decimal_places.c b/src/math/round_float_to_decimal_places.c index 88d167b71e..eecf0816fb 100644 --- a/src/math/round_float_to_decimal_places.c +++ b/src/math/round_float_to_decimal_places.c @@ -4,18 +4,18 @@ f32 round_float_to_decimal_places(s32 decimal_places, f32 input_value) __asm__("FUN_00214c48"); f32 round_float_to_decimal_places(s32 decimal_places, f32 input_value) { - s32 count; + s32 remaining_decimal_places; s32 decimal_scale_factor; f32 scale; f32 half; - count = decimal_places; + remaining_decimal_places = decimal_places; decimal_scale_factor = 1; - if (count > 0) { + if (remaining_decimal_places > 0) { do { - count--; + remaining_decimal_places--; decimal_scale_factor *= 10; - } while (count != 0); + } while (remaining_decimal_places != 0); } scale = (f32)decimal_scale_factor; half = 1.0f / (2.0f * scale); From c72946fae9edab29fea899fe552430d30388711b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:55:59 +0000 Subject: [PATCH 416/657] decomp: clarify names in send_dma_to_stash_slot size -> transfer_quadwords: In the bound source (SHA-256 808531fbb20b079efeca8d3769623af8eef3577323052362d3c6c7335776f3ee), size is added to slot_offset_quadwords for the slot_limit_quadwords check and multiplied by 16 into req[2]. Retail a3/param_4 is added to a2 at 0x00293d60 and compared against the selected slot bound at 0x00293d6c. At 0x00293d84 a3 is shifted left four bits, then stored at request +8 at 0x00293d90 before sceSifSetDma at 0x00293da0. Thus the parameter measures transfer length in 16-byte quadwords. --- src/overlays/shared/streaming/send_dma_to_stash_slot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/streaming/send_dma_to_stash_slot.c b/src/overlays/shared/streaming/send_dma_to_stash_slot.c index 9d06ef5c1c..b50aafabc5 100644 --- a/src/overlays/shared/streaming/send_dma_to_stash_slot.c +++ b/src/overlays/shared/streaming/send_dma_to_stash_slot.c @@ -25,7 +25,7 @@ int send_dma_to_stash_slot(int dma_source_address, unsigned int slot, int slot_offset_quadwords, - int size) { + int transfer_quadwords) { int req[4]; int slot_limit_quadwords; if (slot >= 0x40) @@ -33,11 +33,11 @@ int send_dma_to_stash_slot(int dma_source_address, slot_limit_quadwords = l00_stash_slots[slot].limit; if (slot_limit_quadwords == 0) return -3; - if (slot_limit_quadwords < slot_offset_quadwords + size) + if (slot_limit_quadwords < slot_offset_quadwords + transfer_quadwords) return -1; req[0] = dma_source_address; req[1] = (int)(l00_stash_slots[slot].base + slot_offset_quadwords * 16); - req[2] = size * 16; + req[2] = transfer_quadwords * 16; req[3] = 0; sceSifSetDma(req, 1); return 0; From f2c001903a89bd223821eb2bf704537e39176f2a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:55:59 +0000 Subject: [PATCH 417/657] decomp: clarify names in cache_path_segment_lengths count -> point_count: In the SHA-256-bound source, count is loaded from *(int *)path_record, used in (i + 1) % count for next_point_index, and bounds i while each point is addressed at path_record + 0x10 + i * 16. Retail 0x0030eb54 loads v1 from 0(s2), 0x0030eb6c divides the successor index by v1, 0x0030eb80-0x0030eb90 addresses the remainder-selected point, and 0x0030eba0-0x0030eba8 reloads that same header word and compares the incremented point index against it. Original Ghidra *piVar4 and iVar3 % iVar5 show the same point-count flow. --- src/overlays/l07/mobys/sharkigator.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l07/mobys/sharkigator.c b/src/overlays/l07/mobys/sharkigator.c index fe14f20efe..6c3ea01b30 100644 --- a/src/overlays/l07/mobys/sharkigator.c +++ b/src/overlays/l07/mobys/sharkigator.c @@ -474,20 +474,20 @@ void handle_sharkigator_hit(struct Moby *moby, char *x, float *hp) { } void cache_path_segment_lengths(char *path_record) { - int i, count; + int i, point_count; if (path_record != 0) { - count = *(int *)path_record; + point_count = *(int *)path_record; i = 0; - if (count > 0) { + if (point_count > 0) { do { int point_byte_offset = i * 16; - int next_point_index = (i + 1) % count; + int next_point_index = (i + 1) % point_count; *(float *)(path_record + point_byte_offset + 0x1C) = fast_vec_dist(path_record + (point_byte_offset + 0x10), path_record + (next_point_index * 16 + 0x10)); i++; - count = *(int *)path_record; - } while (i < count); + point_count = *(int *)path_record; + } while (i < point_count); } } } From b794cca77cc8ca42ecea5dfb1b906a956bd05e0c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:58:15 +0000 Subject: [PATCH 418/657] decomp: clarify names in transform_scaled_vertex_batch count -> point_count: Incoming a1 is retained in s1 at 0x0020cd64, tested as signed positive at 0x0020cd80, decremented once at 0x0020cd9c per scale/basis/translation sequence, and tested again at 0x0020cdc4. The point cursor advances by 0x10 at 0x0020cdc0. Supplied callers pass 3 for transformed_panel_vertices[3] and 6 for pts[6][4], proving this counts points rather than bytes. --- src/rendering/packets/transform_scaled_vertex_batch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rendering/packets/transform_scaled_vertex_batch.c b/src/rendering/packets/transform_scaled_vertex_batch.c index d2a49d6fa6..d11f5c6cd6 100644 --- a/src/rendering/packets/transform_scaled_vertex_batch.c +++ b/src/rendering/packets/transform_scaled_vertex_batch.c @@ -16,7 +16,7 @@ void transform_scaled_vertex_batch(struct VertexBatch *object, u8 *cursor) __asm__("FUN_0020cd48"); void transform_scaled_vertex_batch(struct VertexBatch *render_instance, - s32 count, + s32 point_count, s32 point_indices, u8 *cursor) { @@ -24,14 +24,14 @@ void transform_scaled_vertex_batch(struct VertexBatch *render_instance, scale = *(f32 *)((u8 *)render_instance + 0x2C) * 0.0009765625f; func_002106F8(); - if (count > 0) { + if (point_count > 0) { do { fast_vec_scale(cursor, cursor, scale); - count -= 1; + point_count -= 1; transform_vector_by_basis(cursor, cursor, (u8 *)render_instance + 0xC0); fast_vec_add(cursor, cursor, (u8 *)render_instance + 0x10); cursor += 0x10; - } while (count != 0); + } while (point_count != 0); } } From 7f1103379a14436039d5ec642f880a2cc6bf8adf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 12:58:15 +0000 Subject: [PATCH 419/657] decomp: clarify names in _waitIpuIdle count -> polls_since_callback: In src/sdk/ipu/wait_ipu_idle.c (SHA-256 2c817d815b9a3f2377c8b6802ad5fbdc6586a5cf5b47346aa6e497feae3be432), count starts at zero, increments while IPU_CTRL at 0x10002010 satisfies the busy mask, and resets after DispatchMpegCallbackNoData. Retail 0x0012847c initializes a0; 0x001284b0 compares its saved value against 0x1389, 0x001284b8 increments it, and 0x001284bc invokes the callback followed by zeroing at 0x001284c4. The original Ghidra iVar3 has the same polling-counter role. At 0x001284c0 a0 transiently receives ctx+0x858's contents as the callback argument, matching the source's reuse of count. --- src/sdk/ipu/wait_ipu_idle.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sdk/ipu/wait_ipu_idle.c b/src/sdk/ipu/wait_ipu_idle.c index 2cc8a52499..2e2ec8ad08 100644 --- a/src/sdk/ipu/wait_ipu_idle.c +++ b/src/sdk/ipu/wait_ipu_idle.c @@ -3,16 +3,16 @@ void _waitIpuIdle(s32 *ctx) { long new_var; - s32 count = 0; + s32 polls_since_callback = 0; if (((*((volatile u32 *)0x10002010)) & 0x80004000) == 0x80000000) { do { new_var = 0x1389; - if (count >= new_var) { - count = *((s32 *)(((u8 *)ctx) + 0x858)); - DispatchMpegCallbackNoData(count); - count = 0; + if (polls_since_callback >= new_var) { + polls_since_callback = *((s32 *)(((u8 *)ctx) + 0x858)); + DispatchMpegCallbackNoData(polls_since_callback); + polls_since_callback = 0; } else { - count++; + polls_since_callback++; } } while (((*((volatile u32 *)0x10002010)) & 0x80004000) == 0x80000000); } From 7af6d3c4a82040ce6b686963628329b3451107b5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:00:48 +0000 Subject: [PATCH 420/657] decomp: clarify names in read_cd_stream_sectors size -> requested_byte_count: Retail 0x0023ba78 saves incoming a2 in s3; 0x0023ba80 computes s3 >> 11 into s2, passed as sceCdRead sector count at 0x0023baa0/0x0023baac. The data-pattern byte is zero at 0x0023bab0, selecting 2048-byte sectors in the supplied sceCdRead source. Original Ghidra likewise computes dwSectorCount = (int)param_3 >> 0xb. At 0x0023bac4/0x0023bad4 the original requested count is returned on the synchronous branch, matching source returned_byte_count = size. --- src/movies/decoder/read_cd_stream_sectors.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/movies/decoder/read_cd_stream_sectors.c b/src/movies/decoder/read_cd_stream_sectors.c index 377b6fcf5e..61bb14c12c 100644 --- a/src/movies/decoder/read_cd_stream_sectors.c +++ b/src/movies/decoder/read_cd_stream_sectors.c @@ -13,14 +13,14 @@ s32 read_cd_stream_sectors(struct CdStream *stream, s32 read_cd_stream_sectors(struct CdStream *stream, u32 sector_read_destination, - s32 size, + s32 requested_byte_count, s32 is_async) { u8 readcmd[0x10]; s32 blocks; s32 returned_byte_count; - blocks = size >> 11; + blocks = requested_byte_count >> 11; returned_byte_count = 0; readcmd[0] = 0x64; readcmd[1] = 0; @@ -29,7 +29,7 @@ s32 read_cd_stream_sectors(struct CdStream *stream, if (is_async == 0) { stream->sector += blocks; sceCdSync(0); - returned_byte_count = size; + returned_byte_count = requested_byte_count; } return returned_byte_count; } From 981c336ab7042460d9a06d0155785d95a8312b3d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:00:48 +0000 Subject: [PATCH 421/657] decomp: clarify names in find_nearest_point_index_xy count -> point_count: Retail 0x001f3054 copies a2 to s2; 0x001f3070 skips the scan when s2 <= 0. The index s0 increments once per distance comparison and 0x001f30a8 tests s0 < s2, while 0x001f30b0 advances the point pointer by 0x10 bytes. Source loops i < count over points + i * 0x10; steer_child_moby supplies &path[1] and path[0].n, proving this is a point count. --- src/overlays/l04/mobys/butterfly_swarm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l04/mobys/butterfly_swarm.c b/src/overlays/l04/mobys/butterfly_swarm.c index 47b341c854..b892896678 100644 --- a/src/overlays/l04/mobys/butterfly_swarm.c +++ b/src/overlays/l04/mobys/butterfly_swarm.c @@ -11,11 +11,11 @@ int find_nearest_point_index_xy(char *moby, char *points, int count) __asm__("FUN_L04_001f3038"); -int find_nearest_point_index_xy(char *moby, char *points, int count) { +int find_nearest_point_index_xy(char *moby, char *points, int point_count) { int best = -1; int i; float best_distance = 32767.0f; - for (i = 0; i < count; i++) { + for (i = 0; i < point_count; i++) { float distance = vector_distance_xy(moby + 0x10, points + i * 0x10); if (distance < best_distance) { best_distance = distance; From 4d5b45a74cbe834ebc228a5299ecc87c9187b420 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:00:49 +0000 Subject: [PATCH 422/657] decomp: clarify names in sceTtyRead size -> max_bytes: In src/sdk/deci2/sce_tty_read.c (SHA-256 04fe95e41a58ffc6a0ad59aec6f86b0c98263436f080c6f1b0ce1464d3606330), size bounds i in the loop copying one byte to destination[i]. Retail 0x00119910 preserves a1 in s2; 0x0011991c skips copying for a nonpositive bound; 0x00119968-0x0011996c copies one byte, 0x00119930 increments the copied-byte index, and 0x00119998 compares that index against s2. LF/CR tests at 0x00119980 and 0x00119988 allow earlier return. Original Ghidra nCapacity and the supplied read caller passing max_bytes confirm this is the maximum bytes to copy. --- src/sdk/deci2/sce_tty_read.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/deci2/sce_tty_read.c b/src/sdk/deci2/sce_tty_read.c index 24945687c1..02e97035f2 100644 --- a/src/sdk/deci2/sce_tty_read.c +++ b/src/sdk/deci2/sce_tty_read.c @@ -19,10 +19,10 @@ typedef struct { extern TtyQueue *tty_read_input_queues[] __asm__("D_00154A68"); extern TtyState D_00154A50; -s32 sceTtyRead(s8 *destination, s32 size) { +s32 sceTtyRead(s8 *destination, s32 max_bytes) { s32 i; - for (i = 0; i < size; i++) { + for (i = 0; i < max_bytes; i++) { while (tty_read_input_queues[0]->avail == 0) { } destination[i] = *D_00154A50.rcv->data; From 038ed53521719c7b2fcbb24a72b439c0e6fa5d0a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:00:49 +0000 Subject: [PATCH 423/657] decomp: clarify names in memcard_make_whole_save size -> level_record_bytes: In the bound source, s32 size receives memcard_prepare_data(cursor, index, mc_leveldata) and is added to the u8 *cursor. Retail 0x0020ac18 passes the record index in a1, 0x0020ac1c selects mc_leveldata at 0x001a07c0 in a2, and 0x0020ac20 calls 0x0020ad78; 0x0020ac28 adds returned v0 to output cursor s2. The original decompilation likewise adds this return to its output address. Thus this is the byte extent of the prepared level record in the 20-record loop. --- src/save/memcard_make_whole_save.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/save/memcard_make_whole_save.c b/src/save/memcard_make_whole_save.c index 0720bf5cd2..86b0202e72 100644 --- a/src/save/memcard_make_whole_save.c +++ b/src/save/memcard_make_whole_save.c @@ -10,7 +10,7 @@ void memcard_make_whole_save(u8 *cursor) __asm__("FUN_0020abb0"); void memcard_make_whole_save(u8 *cursor) { s32 index; - s32 size; + s32 level_record_bytes; ((struct MemoryCardSaveSizes *)cursor)->main_size = memcard_get_data_size(mc_gamedata); ((struct MemoryCardSaveSizes *)cursor)->record_size = memcard_get_data_size(mc_leveldata); @@ -18,8 +18,8 @@ void memcard_make_whole_save(u8 *cursor) { cursor += memcard_prepare_data(cursor, 0, mc_gamedata); index = 0; do { - size = memcard_prepare_data(cursor, index, mc_leveldata); - cursor += size; + level_record_bytes = memcard_prepare_data(cursor, index, mc_leveldata); + cursor += level_record_bytes; index++; } while (index < 0x14); } From 78ad0fac5f0b89bf80dc4d8190e63902b5a94011 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:02:37 +0000 Subject: [PATCH 424/657] decomp: clarify names in gadgetron_sign_update size -> initialized_scale: In the authoritative C initialization case, float size = moby->scale * 4.0f is used only by moby->scale = size. Original retail Ghidra shows the same multiply and store at param_1+0x2c. Retail 0x002e88fc loads scale from 0x2c(s0), 0x002e8904-0x002e8908 supplies 4.0, 0x002e891c multiplies, and 0x002e892c stores the initialized scale back to 0x2c(s0). --- src/overlays/l16/mobys/gadgetron_sign.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l16/mobys/gadgetron_sign.c b/src/overlays/l16/mobys/gadgetron_sign.c index f53acfcf6d..6495858d50 100644 --- a/src/overlays/l16/mobys/gadgetron_sign.c +++ b/src/overlays/l16/mobys/gadgetron_sign.c @@ -50,14 +50,14 @@ void gadgetron_sign_update(struct Moby *moby) { }; switch (moby->state) { case GADGETRON_SIGN_INITIALIZE: { - float size = moby->scale * 4.0f; + float initialized_scale = moby->scale * 4.0f; int ff = 0xFF; int twohundred = 0x200; moby->state = GADGETRON_SIGN_ROTATE; moby->update_dist = ff; moby->draw_dist = twohundred; moby->pos.z = 160.0f; - moby->scale = size; + moby->scale = initialized_scale; } break; case GADGETRON_SIGN_ROTATE: moby->rot.z = fast_add_rotations(moby->rot.z, frame_time * -0.2617993950843811f); From 2e7e1a45ed4964680ddee79774dbba2ec20063c7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:02:37 +0000 Subject: [PATCH 425/657] decomp: clarify names in normalize_vector_triplet count -> component_countdown: The single source count binding controls both gather and scatter of row_vector's three float components. Retail 0x00214158 and 0x00214198 initializes a0 to 2; 0x00214164 and 0x002141a4 decrements it after each component load, and bgez at 0x00214174/0x002141b4 repeats through three transfers until -1. Thus this is the signed component-transfer loop countdown, reused before and after unit normalization. offset -> row_byte_offset: In source SHA-256 633abb577b110f9dd0e69831c5627e965f5ccf2be3884d08c37c311c033a4bbf, offset = i * 4 is added to (u8 *)matrix_base for both gather and scatter. Retail 0x00214144/0x002141c8 shifts the row index by 2 into s0, and 0x00214154/0x00214190 adds s0 to saved matrix base s1. The three outer iterations select row byte offsets 0, 4 and 8; inner matrix accesses stride 16 bytes. --- src/math/normalize_vector_triplet.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/math/normalize_vector_triplet.c b/src/math/normalize_vector_triplet.c index 70bb48be0f..9d66531d78 100644 --- a/src/math/normalize_vector_triplet.c +++ b/src/math/normalize_vector_triplet.c @@ -15,38 +15,38 @@ void normalize_vector_triplet(f32 *matrix) { f32 *component_read_cursor; f32 *component_write_cursor; f32 vector_component; - s32 offset; + s32 row_byte_offset; s32 i; s32 next_row_index; - s32 count; + s32 component_countdown; matrix_base = matrix; i = 0; do { next_row_index = i + 1; - offset = i * 4; + row_byte_offset = i * 4; row_vector.pad = 0; component_write_cursor = row_vector.values; - component_read_cursor = (f32 *)((u8 *)matrix_base + offset); - count = 2; + component_read_cursor = (f32 *)((u8 *)matrix_base + row_byte_offset); + component_countdown = 2; do { vector_component = *component_read_cursor; - count--; + component_countdown--; component_read_cursor += 4; *component_write_cursor = vector_component; component_write_cursor++; - } while (count >= 0); + } while (component_countdown >= 0); fast_vec_normalize(row_vector.values, row_vector.values, 1.0f); - component_write_cursor = (f32 *)((u8 *)matrix_base + offset); + component_write_cursor = (f32 *)((u8 *)matrix_base + row_byte_offset); component_read_cursor = row_vector.values; - count = 2; + component_countdown = 2; do { vector_component = *component_read_cursor; - count--; + component_countdown--; component_read_cursor++; *component_write_cursor = vector_component; component_write_cursor += 4; - } while (count >= 0); + } while (component_countdown >= 0); i = next_row_index; } while (i < 3); } From f913972662692541ab126b6560e36f7bca8f155c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:02:37 +0000 Subject: [PATCH 426/657] decomp: clarify names in send_to_spu size -> transfer_byte_count: Incoming a2 is saved in s2 at 0x0023af34 and stored at sp+8 at 0x0023af54, the length word of the SIF DMA descriptor whose source and destination occupy sp+0 and sp+4. sceSifSetDma submits this descriptor at 0x0023af60. After completion polling, 0x0023af98 passes the same s2 as a0 to 0x0012f148. Original Ghidra likewise assigns param_3 to uStack_58 and forwards it to notify_mpeg_audio_rpc_transfer; current C assigns size to descriptor[2] and forwards it to snd_update_movie_adpcm. This proves the transferred byte count. --- src/audio/decoder/send_to_spu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/audio/decoder/send_to_spu.c b/src/audio/decoder/send_to_spu.c index 3cc54d83e2..a6ed9580b8 100644 --- a/src/audio/decoder/send_to_spu.c +++ b/src/audio/decoder/send_to_spu.c @@ -13,7 +13,7 @@ void send_to_spu(struct AudioDec *dec, void send_to_spu(struct AudioDec *dec, s32 adpcm_source_address, - s32 size, + s32 transfer_byte_count, s32 staging_byte_offset) { u32 descriptor[4]; @@ -22,14 +22,14 @@ void send_to_spu(struct AudioDec *dec, FlushCache(0); descriptor[0] = adpcm_source_address; descriptor[1] = dec->iopBuff; - descriptor[2] = size; + descriptor[2] = transfer_byte_count; descriptor[3] = 0; do { dma_id = sceSifSetDma(descriptor, 1); } while (dma_id == 0); while (sceSifDmaStat(dma_id) >= 0) { } - snd_update_movie_adpcm(size, staging_byte_offset); + snd_update_movie_adpcm(transfer_byte_count, staging_byte_offset); } extern __typeof__(send_to_spu) func_0023AF18 __attribute__((alias("FUN_0023af18"))); From b6d54e7ebaec3b1095d999e36bad2224572fc715 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:02:37 +0000 Subject: [PATCH 427/657] decomp: clarify names in audio_dec_begin_put size1 -> first_destination_byte_count: In audio_dec_begin_put, s32 *size1 corresponds to retail a2 / Ghidra param_3. At 0x0023ad94 it receives 0x28-hdrCount beside first_destination=hdr+hdrCount; 0x0023adb4 returns dec->size beside data; 0x0023adec returns size-count beside data+put; 0x0023ae04 returns size-put when wrapping. The u8 header arithmetic and data offsets establish the first destination span length in bytes. size2 -> second_destination_byte_count: In audio_dec_begin_put, s32 *size2 corresponds to retail t0 / Ghidra param_5. At 0x0023ada8 it receives dec->size beside second_destination=data; 0x0023adc0 writes zero beside NULL; 0x0023ae24 writes (size-count)-(size-put) beside the wrapped second_destination=data at 0x0023ae0c. Thus it is the byte length of the second writable destination span, zero when absent. --- src/audio/decoder/audio_dec_begin_put.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/audio/decoder/audio_dec_begin_put.c b/src/audio/decoder/audio_dec_begin_put.c index c0a8bee47f..b995540d65 100644 --- a/src/audio/decoder/audio_dec_begin_put.c +++ b/src/audio/decoder/audio_dec_begin_put.c @@ -6,10 +6,10 @@ void audio_dec_begin_put( void audio_dec_begin_put(struct AudioDec *dec, void **first_destination, - s32 *size1, + s32 *first_destination_byte_count, void **second_destination, - s32 *size2) { + s32 *second_destination_byte_count) { enum { AUDIO_DEC_STATE_HEADER_PENDING = 0 }; @@ -18,27 +18,27 @@ void audio_dec_begin_put(struct AudioDec *dec, if (dec->state == AUDIO_DEC_STATE_HEADER_PENDING) { if (dec->strType != 4) { *first_destination = ((u8 *)&dec->hdr + dec->hdrCount); - *size1 = 0x28 - dec->hdrCount; + *first_destination_byte_count = 0x28 - dec->hdrCount; *second_destination = dec->data; - *size2 = dec->size; + *second_destination_byte_count = dec->size; } else { *first_destination = dec->data; - *size1 = dec->size; + *first_destination_byte_count = dec->size; *second_destination = NULL; - *size2 = 0; + *second_destination_byte_count = 0; } } else { writable_byte_count = dec->size - dec->count; if ((dec->size - dec->put) >= writable_byte_count) { *first_destination = dec->data + dec->put; - *size1 = writable_byte_count; + *first_destination_byte_count = writable_byte_count; *second_destination = NULL; - *size2 = 0; + *second_destination_byte_count = 0; } else { *first_destination = dec->data + dec->put; - *size1 = dec->size - dec->put; + *first_destination_byte_count = dec->size - dec->put; *second_destination = dec->data; - *size2 = writable_byte_count - (dec->size - dec->put); + *second_destination_byte_count = writable_byte_count - (dec->size - dec->put); } } } From 961177efcbaff8b6345539237422c6fe56680a86 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:02:37 +0000 Subject: [PATCH 428/657] decomp: clarify names in transfer_draw_buffer_chunks size -> byte_count: Retail parameter three (Ghidra param_3, a2) is increased by 0x3fff at 0x002a0f1c and masked with -0x4000 at 0x002a0f24/0x002a0f40, matching source left = (size + 0x3FFF) & ~0x3FFF. The rounded remainder s0 decreases by 0x4000 at 0x002a0f78 while the shared source/destination byte offset s1 increases by 0x4000 at 0x002a0f90 and is added to both byte addresses at 0x002a0f4c and 0x002a0f84. Thus size is the requested byte count before chunk rounding, rather than a chunk count or dimension. --- .../shared/rendering/buffers/transfer_draw_buffer_chunks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/buffers/transfer_draw_buffer_chunks.c b/src/overlays/shared/rendering/buffers/transfer_draw_buffer_chunks.c index 908dda226d..cc28b68c1d 100644 --- a/src/overlays/shared/rendering/buffers/transfer_draw_buffer_chunks.c +++ b/src/overlays/shared/rendering/buffers/transfer_draw_buffer_chunks.c @@ -13,9 +13,9 @@ void transfer_draw_buffer_chunks(int dst, void transfer_draw_buffer_chunks(int destination_byte_address, int draw_buffer_byte_address, - int size) { + int byte_count) { char chunk_transfer_descriptor[0x70] __attribute__((aligned(16))); - int left = (size + 0x3FFF) & ~0x3FFF; + int left = (byte_count + 0x3FFF) & ~0x3FFF; int transfer_byte_offset = 0; while (left > 0) { FUN_00122518(chunk_transfer_descriptor, From 3e00f492ac028e6907389ab2bfa08ae8a43a0f1e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:02:37 +0000 Subject: [PATCH 429/657] decomp: clarify names in memcard_restore_game size0 -> expected_game_span_bytes: Source initializes size0 with memcard_get_data_size(mc_gamedata) and compares it with MemoryCardSaveSizes.main_size. Retail 0x002092a8/0x002092b8 supplies 0x001a04c0 to the call at 0x002092c8; 0x002092dc preserves its return in s1 and 0x002092e0/0x002092e4 compares the first saved header word against s1. That validated header word advances the u8 save cursor at 0x0020931c after game-data restoration. Original Ghidra iVar1 likewise computes the expected first span and checks *param_1. size1 -> expected_level_span_bytes: Source initializes size1 with memcard_get_data_size(mc_leveldata), checks MemoryCardSaveSizes.record_size against it, and adds size1 to the u8 save cursor after each of 20 level restores. Retail 0x002092d4 supplies 0x001a07c0 to the call at 0x002092d8; 0x002092e8 preserves its result in s3, 0x002092ec/0x002092f0 compares the second header word against s3, and 0x00209344 adds s3 to the input cursor for the next level record. Original Ghidra iVar2 has the same check and stride. --- src/save/memcard_restore_game.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/save/memcard_restore_game.c b/src/save/memcard_restore_game.c index fc480b90bc..0c2a34f8c8 100644 --- a/src/save/memcard_restore_game.c +++ b/src/save/memcard_restore_game.c @@ -21,13 +21,13 @@ extern void memcard_restore_data(u8 *, s32, void *) __asm__("func_0020AF20"); void memcard_restore_game(u8 *p) __asm__("FUN_00209298"); void memcard_restore_game(u8 *save_buffer) { - s32 size0 = memcard_get_data_size(mc_gamedata); - s32 size1 = memcard_get_data_size(mc_leveldata); + s32 expected_game_span_bytes = memcard_get_data_size(mc_gamedata); + s32 expected_level_span_bytes = memcard_get_data_size(mc_leveldata); s32 saved_game_span_bytes = ((struct MemoryCardSaveSizes *)save_buffer)->main_size; s32 i; - if (saved_game_span_bytes != size0 || - ((struct MemoryCardSaveSizes *)save_buffer)->record_size != size1) { + if (saved_game_span_bytes != expected_game_span_bytes || + ((struct MemoryCardSaveSizes *)save_buffer)->record_size != expected_level_span_bytes) { DebugPrint(out_of_date_save_message); return; } @@ -36,7 +36,7 @@ void memcard_restore_game(u8 *save_buffer) { save_buffer += saved_game_span_bytes; for (i = 0; i < 20; i++) { memcard_restore_data(save_buffer, i, mc_leveldata); - save_buffer += size1; + save_buffer += expected_level_span_bytes; } } From 88642c917417bc2fa14313594782df83c5ee226c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:04:37 +0000 Subject: [PATCH 430/657] decomp: clarify names in start_cutscene_chunk_read size -> sector_count: In the SHA-256-bound load_level_gameplay.c snapshot, both PAL and standard branches assign size = sectors[i+1] - sectors[i] and pass it as the third argument to start_audio_stream_read(buf, start, size). Retail 0x00245238/0x0024523c loads these consecutive sector boundaries, 0x00245240 subtracts them into a2, 0x00245244 gates on a positive count, and 0x00245250 calls the stream reader with that count still in a2. Thus this s32 is the chunk's sector count, not an unspecified size. --- src/overlays/shared/world/load_level_gameplay.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/world/load_level_gameplay.c b/src/overlays/shared/world/load_level_gameplay.c index 8eff18d870..8ff3d929d0 100644 --- a/src/overlays/shared/world/load_level_gameplay.c +++ b/src/overlays/shared/world/load_level_gameplay.c @@ -2161,19 +2161,19 @@ s32 start_cutscene_chunk_read(s32 i) __asm__("FUN_L00_002451b8"); s32 start_cutscene_chunk_read(s32 i) { u8 *buf = D_L00_0016C860.buf; s32 start; - s32 size; + s32 sector_count; if (pal_mode != FALSE) { - size = disc_table.sector_lists[D_L00_0016C860.list].sectors_alt[i + 1] - + sector_count = disc_table.sector_lists[D_L00_0016C860.list].sectors_alt[i + 1] - disc_table.sector_lists[D_L00_0016C860.list].sectors_alt[i]; start = disc_table.sector_lists[D_L00_0016C860.list].sectors_alt[i]; } else { - size = disc_table.sector_lists[D_L00_0016C860.list].sectors[i + 1] - + sector_count = disc_table.sector_lists[D_L00_0016C860.list].sectors[i + 1] - disc_table.sector_lists[D_L00_0016C860.list].sectors[i]; start = disc_table.sector_lists[D_L00_0016C860.list].sectors[i]; } - if (size > 0) { - start_audio_stream_read(buf, start, size); + if (sector_count > 0) { + start_audio_stream_read(buf, start, sector_count); update_audio_stream_until_idle(0); } return 1; From 7aee4506600f93637963146d363fabc053255020 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:04:37 +0000 Subject: [PATCH 431/657] decomp: clarify names in sceGsPutDrawEnv count -> dma_busy_poll_count: In the authoritative src/sdk/graph/sce_gs_put_draw_env.c snapshot (SHA-256 99abded6ed337e146bff88e4c8827199dcdf07c28b7c36763b7bece4a5d1c986), u32 count is initialized to zero and incremented only inside the loop polling bit 0x100 of GIF DMA CHCR at 0x1000A000. Retail 0x001221d0 clears a0; 0x001221e8 compares its old value against 0x01000000, and 0x001221f0 increments it. The repeated CHCR read/test at 0x001221f4-0x001221fc continues while busy. Exceeding the threshold branches to 0x00122250, prints the DMA Ch.2 timeout diagnostic and returns -1. The original Ghidra uVar3 follows this same counter flow, proving a DMA busy-poll iteration count. --- src/sdk/graph/sce_gs_put_draw_env.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/graph/sce_gs_put_draw_env.c b/src/sdk/graph/sce_gs_put_draw_env.c index b31e0b6960..240996b415 100644 --- a/src/sdk/graph/sce_gs_put_draw_env.c +++ b/src/sdk/graph/sce_gs_put_draw_env.c @@ -5,13 +5,13 @@ const char gs_draw_env_dma_timeout_message[] __asm__("D_00153078") = "sceGsPutDrawEnv: DMA Ch.2 does not terminate\r\n"; s32 sceGsPutDrawEnv(u64 *env) { - u32 count; + u32 dma_busy_poll_count; u32 tag; u32 addr; - count = 0; + dma_busy_poll_count = 0; while (*(volatile u32 *)0x1000A000 & 0x100) { - if (count++ > 0x1000000) { + if (dma_busy_poll_count++ > 0x1000000) { scePrintf(gs_draw_env_dma_timeout_message); return -1; } From 315a0f8066a775e022778776e76d80b3b6141fc3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:07:01 +0000 Subject: [PATCH 432/657] decomp: clarify names in _peepBit count -> requested_bit_count: In the SHA-256-bound _peepBit source, count is compared with ctx->available_bit_count and selects the returned leading bits through (u32)ctx->bit_window >> (0x20 - count). Retail 0x00128740 saves a1 into s2; 0x00128744-0x0012874c compares the available width at +0x83c against s2; 0x00128808 and 0x00128814 negate s2 and logically shift the window. Original Ghidra calls it nBitCount. Supplied _extensionAndUserData passes 32 to inspect a start code and _mbAddressIncrement passes 0xB to inspect an eleven-bit code. --- src/sdk/mpeg/bitstream/_peepBit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/mpeg/bitstream/_peepBit.c b/src/sdk/mpeg/bitstream/_peepBit.c index e3e8ed2ce1..f4c50f2a7b 100644 --- a/src/sdk/mpeg/bitstream/_peepBit.c +++ b/src/sdk/mpeg/bitstream/_peepBit.c @@ -13,10 +13,10 @@ typedef struct PeepBitContext { s32 unk858; } PeepBitContext; -s32 _peepBit(PeepBitContext *ctx, s32 count) { +s32 _peepBit(PeepBitContext *ctx, s32 requested_bit_count) { s32 counter; - if (ctx->ipu_command_class != 0 || ctx->available_bit_count < count) { + if (ctx->ipu_command_class != 0 || ctx->available_bit_count < requested_bit_count) { counter = 0; if ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000) { do { @@ -31,5 +31,5 @@ s32 _peepBit(PeepBitContext *ctx, s32 count) { ctx->bit_window = (s32)_waitIpuIdle64(ctx); ctx->available_bit_count = 0x20; } - return (u32)ctx->bit_window >> (0x20 - count); + return (u32)ctx->bit_window >> (0x20 - requested_bit_count); } From e2fec81304f591f3c17068fe90252c50ac482e12 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:07:01 +0000 Subject: [PATCH 433/657] decomp: clarify names in unpack_point_records count -> texture_record_count: Retail 0x00202814 retains argument a1 in s2; 0x00202824 skips nonpositive counts and 0x002028a8/0x002028b0 increments the resident record index and compares it with s2. Each iteration reads four consecutive 32-bit words at 0x00202838/48/58/68, advances the source 16 bytes and writes one 16-byte resident texture definition. Authoritative C uses count solely as that loop bound; the caller passes header->pointCount beside header->points, and prepared Ghidra identifies nSourceCount of ResidentIndexedTextureSource records. --- src/world/loaders/unpack_point_records.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/world/loaders/unpack_point_records.c b/src/world/loaders/unpack_point_records.c index 91c5736059..2c7c29fa28 100644 --- a/src/world/loaders/unpack_point_records.c +++ b/src/world/loaders/unpack_point_records.c @@ -14,13 +14,13 @@ extern struct Point effect_texture_definitions[] __asm__("D_0018D440"); extern s16 log2dim(s32) __asm__("FUN_001f97a0"); void unpack_point_records(s32 *src, s32 count) __asm__("FUN_00202800"); -void unpack_point_records(s32 *serialized_texture_records, s32 count) { +void unpack_point_records(s32 *serialized_texture_records, s32 texture_record_count) { s32 x; s32 y; s32 u; s32 v; - for (effect_tex_cnt = 0; effect_tex_cnt < count; effect_tex_cnt++) { + for (effect_tex_cnt = 0; effect_tex_cnt < texture_record_count; effect_tex_cnt++) { x = *serialized_texture_records++; y = *serialized_texture_records++; u = *serialized_texture_records++; From e8287b062220ca842dfc15d55a30ee0e98fdb28f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:09:22 +0000 Subject: [PATCH 434/657] decomp: clarify names in decode_map_rle_row count -> remaining_run_nibbles: In src/ui/map/coverage/decode_map_rle_row.c (SHA-256 fd961100860a185dc8348113df909713dd2f0753feb17362e7e6b7967ae17500), count corresponds to original Ghidra uVar9 and retail t1. Instructions 0x002068fc-0x00206904 initialize it to 256 or the packed run repeat count. At 0x00206918 it decreases by one when filling the pending high nibble, while 0x00206930-0x00206944 emit a byte containing two copies of the run nibble and decrease it by two. A residual -1 selects the low-nibble correction at 0x00206954-0x0020695c. Thus it tracks remaining decoded run nibbles, rather than compressed bytes or the number of runs. --- src/ui/map/coverage/decode_map_rle_row.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ui/map/coverage/decode_map_rle_row.c b/src/ui/map/coverage/decode_map_rle_row.c index 5ac4db77ab..919d411102 100644 --- a/src/ui/map/coverage/decode_map_rle_row.c +++ b/src/ui/map/coverage/decode_map_rle_row.c @@ -13,7 +13,7 @@ void decode_map_rle_row(u8 *decoded_row_dst, s32 row, u8 *compressed_data_base, u8 *packed_run_src; u32 lo; u32 hi; - s32 count; + s32 remaining_run_nibbles; u32 pair; decoded_row_cursor = decoded_row_dst; @@ -35,23 +35,23 @@ void decode_map_rle_row(u8 *decoded_row_dst, s32 row, u8 *compressed_data_base, hi = ((hi << 4) | (lo >> 4)) & 0xFF; lo = lo & 0xF; } - count = 0x100; + remaining_run_nibbles = 0x100; if (hi != 0) { - count = hi; + remaining_run_nibbles = hi; } pair = (lo | (lo << 4)) & 0xFF; if (half) { *decoded_row_cursor = *decoded_row_cursor | (lo << 4); half = 0; - count--; + remaining_run_nibbles--; decoded_row_cursor++; } - if (count != 0) { + if (remaining_run_nibbles != 0) { do { *decoded_row_cursor++ = pair; - count -= 2; - } while (count > 0); - if (count != 0) { + remaining_run_nibbles -= 2; + } while (remaining_run_nibbles > 0); + if (remaining_run_nibbles != 0) { decoded_row_cursor--; half = 1; *decoded_row_cursor = lo; From f77d8ed4f459670f81a76ab9a0e52308d69d337d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:09:23 +0000 Subject: [PATCH 435/657] decomp: clarify names in vi_buf_begin_put offset -> read_byte_count: Source offset loads ring_buffer->read_bytes. Retail 0x0023be60 loads +0x14 into a1; 0x0023be70-0x0023be78 adds it to the block-derived byte position before modulo, and 0x0023be8c-0x0023be90 subtracts it from block-derived available bytes. Original Ghidra param_1[5] participates in both byte calculations, proving the read-byte count role without inferring its lifecycle. size -> ring_capacity_bytes: Source size loads ring_buffer->buff_size. Retail 0x0023be6c loads +0x18 into v1, used as the divisor at 0x0023be84 for a position computed in bytes after <<11. At 0x0023be98 and 0x0023bec8-0x0023bed0 this capacity minus the byte write position bounds the first writable span. Original Ghidra iVar2 has the same modulo and wrap-boundary role. --- src/movies/decoder/video_input/vi_buf_begin_put.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/movies/decoder/video_input/vi_buf_begin_put.c b/src/movies/decoder/video_input/vi_buf_begin_put.c index 3a6dc061e2..c79c84880a 100644 --- a/src/movies/decoder/video_input/vi_buf_begin_put.c +++ b/src/movies/decoder/video_input/vi_buf_begin_put.c @@ -11,21 +11,21 @@ void vi_buf_begin_put(struct ViBuf *ring_buffer, s32 *wrapped_write_address_out, s32 *wrapped_write_byte_count_out) { - s32 size; + s32 ring_capacity_bytes; s32 pending; - s32 offset; + s32 read_byte_count; s32 free_bytes; s32 used_blocks; s32 write_pos; wait_semaphore(ring_buffer->sema); pending = ring_buffer->dma_n; - offset = ring_buffer->read_bytes; + read_byte_count = ring_buffer->read_bytes; used_blocks = pending + 2; - size = ring_buffer->buff_size; - free_bytes = ((ring_buffer->n - used_blocks) << 0xB) - offset; - write_pos = (s32)(((ring_buffer->dma_start + pending) << 0xB) + offset) % size; - if ((size - write_pos) >= free_bytes) { + ring_capacity_bytes = ring_buffer->buff_size; + free_bytes = ((ring_buffer->n - used_blocks) << 0xB) - read_byte_count; + write_pos = (s32)(((ring_buffer->dma_start + pending) << 0xB) + read_byte_count) % ring_capacity_bytes; + if ((ring_capacity_bytes - write_pos) >= free_bytes) { *first_write_address_out = (s32)ring_buffer->data + write_pos; *first_write_byte_count_out = free_bytes; *wrapped_write_address_out = 0; From 60caea934aa6b25d7d944eb2e9769cbf233bd10f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:09:23 +0000 Subject: [PATCH 436/657] decomp: clarify names in collect_mission_ids count -> collected_mission_count: Authoritative C initializes count to zero, indexes mission_ids[count] and the corresponding mask bit, increments only within the branch that emits a mission ID, and returns count. Original Ghidra uVar7 has the same increment and return. Retail 0x0020bc04 initializes t3 to zero; 0x0020bcc4 uses t3 for the output mask bit; 0x0020bc90/0x0020bcb0 write the emitted ID, 0x0020bcd8 advances its output pointer, and 0x0020bcf0 increments t3 only on that emission path. Skipped nodes bypass that increment, and 0x0020bd28 returns t3. Thus this is the collected mission entry count, not the number of nodes visited. --- src/game/missions/collect_mission_ids.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/game/missions/collect_mission_ids.c b/src/game/missions/collect_mission_ids.c index 76daaaede8..a22ce09db1 100644 --- a/src/game/missions/collect_mission_ids.c +++ b/src/game/missions/collect_mission_ids.c @@ -20,7 +20,7 @@ int collect_mission_ids(int *mission_ids, int *mask, int *nums, int use_selected MISSION_STATUS_ALL_CONDITIONS_MET = 2 }; MissionNode *mission_node_cursor = mission_id_collection_node_source[0]; - int count = 0; + int collected_mission_count = 0; int all = 1; *mission_ids = 0; @@ -41,27 +41,27 @@ int collect_mission_ids(int *mission_ids, int *mask, int *nums, int use_selected all = 0; } if (!(f & 2) && t != 0 && !((f & 1) && t == 2)) { - mission_ids[count] = mission_node_cursor->id; + mission_ids[collected_mission_count] = mission_node_cursor->id; if (use_selected_ids != 0) { - mission_ids[count] = + mission_ids[collected_mission_count] = (mission_node_cursor->status == MISSION_STATUS_ALL_CONDITIONS_MET) ? 0x523E : mission_node_cursor->ids[mission_node_cursor->sel]; } if (mask != 0 && mission_node_cursor->status == MISSION_STATUS_ALL_CONDITIONS_MET) { - *mask |= 1 << count; + *mask |= 1 << collected_mission_count; } if (nums != 0) { *nums++ = mission_node_cursor->base + mission_node_cursor->sel; } - count++; + collected_mission_count++; } mission_node_cursor++; } if (mask != 0 && all != 0) { *mask |= 0x80000000; } - return count; + return collected_mission_count; } extern __typeof__(collect_mission_ids) func_0020BC00 __attribute__((alias("FUN_0020bc00"))); From b286cd5d6caaa0cfd505ad4b63f18db58e638b63 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:09:23 +0000 Subject: [PATCH 437/657] decomp: clarify names in video_dec_create size -> video_input_block_count: Retail 0x0023caec preserves incoming sixth argument t1 in s3; 0x0023cb90 forwards s3 in a3 to vi_buf_create at 0x0023cb98 with &vd->vi_buf (vd+0x48). Helper 0x0023bc98 stores a3 at buffer-record +8, while 0x0023bc80 shifts a3 left 11 and 0x0023bc88 stores the resulting byte capacity at +0x18. Its input backing address is stored separately at +0 by 0x0023bc64. Thus size counts the video input buffer's 2048-byte blocks, rather than bytes or MPEG workspace capacity. --- src/movies/decoder/video_dec_create.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/movies/decoder/video_dec_create.c b/src/movies/decoder/video_dec_create.c index a492aaa474..1d506a013c 100644 --- a/src/movies/decoder/video_dec_create.c +++ b/src/movies/decoder/video_dec_create.c @@ -23,7 +23,7 @@ s32 video_dec_create(struct VideoDec *vd, s32 mpeg_work_area_size, s32 video_input_buffer, s32 tag, - s32 size, + s32 video_input_block_count, s32 ts, s32 ts_count) { @@ -34,6 +34,6 @@ s32 video_dec_create(struct VideoDec *vd, AddMpegCallback(vd, 3, mpeg_restart_video_dma, 0); AddMpegCallback(vd, 5, D_0023D140, 0); video_dec_reset(vd); - vi_buf_create(&vd->vi_buf, video_input_buffer, tag, size, ts, ts_count); + vi_buf_create(&vd->vi_buf, video_input_buffer, tag, video_input_block_count, ts, ts_count); return 1; } From 712b5d36ed39beb9d42a1f033222d841735a15ed Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:09:23 +0000 Subject: [PATCH 438/657] decomp: clarify names in create_particle_with_velocity_and_lifetime size -> initial_particle_size: Authoritative drain_cover.c snapshot SHA-256 813bb50f264bccd671cdf0e309586d2d016b60f074b27972908c29930aaa377d: emit_drain_cover_particles samples particle_size via truncate_float_to_s32(randf_sym(fi, size sampling bound)) and passes it as the fifth argument. The assigned function writes size once to *(volatile short *)(velocity_block+0x1c), i.e. new particle record+0x3c. Original Ghidra param_5 has the same +0x3c store; retail 0x0029bbf4 saves incoming a3 to s6 and 0x0029bcc8 stores s6 with sh to 0x1c(s1), where 0x0029bc50 establishes s1=allocated_object+0x20. This proves an initial particle-size input without asserting physical units. --- src/overlays/l05/mobys/drain_cover.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l05/mobys/drain_cover.c b/src/overlays/l05/mobys/drain_cover.c index 9193251792..d6fd8e70c3 100644 --- a/src/overlays/l05/mobys/drain_cover.c +++ b/src/overlays/l05/mobys/drain_cover.c @@ -36,7 +36,7 @@ unsigned char *create_particle_with_velocity_and_lifetime(float unscaled_particl void *initial_position_source, void *initial_velocity_source, int life, - int size, + int initial_particle_size, int color) { unsigned char *allocated_object = create_part(0x30); @@ -55,7 +55,7 @@ unsigned char *create_particle_with_velocity_and_lifetime(float unscaled_particl *(float *)(velocity_block + 0x10) = 2.0f / convert_integer_to_float(life); *(short *)(allocated_object + 0xa) = life; *(volatile int *)(velocity_block + 0x18) = color; - *(volatile short *)(velocity_block + 0x1c) = size; + *(volatile short *)(velocity_block + 0x1c) = initial_particle_size; *(volatile int *)(velocity_block + 0x14) = color & 0xffffff; } return allocated_object; From e069849e874537b79b8bf6d50f78a14559b35fde Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:09:23 +0000 Subject: [PATCH 439/657] decomp: clarify names in hud_send_resident_bank size -> image_pixel_count: In the authoritative src/ui/hud/banks/hud_send_resident_bank.c snapshot (SHA-256 ba3383e0d9b1d715e205843485f74ad0292df93f484945cd09570887c411cba7), size = 1 << (width_log2 + height_log2), hence image width times height in pixels. Retail 0x001ff1f0 and 0x001ff1f8 load the dimension exponents from entry+6/+7; 0x001ff208 adds them and 0x001ff210 shifts one by their sum. At 0x001ff218-0x001ff21c this count is multiplied by four and added to the destination address. The original Ghidra loop expresses the same area-times-four address advance. --- src/ui/hud/banks/hud_send_resident_bank.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/hud/banks/hud_send_resident_bank.c b/src/ui/hud/banks/hud_send_resident_bank.c index 6ed5d2db7e..e1384f1c47 100644 --- a/src/ui/hud/banks/hud_send_resident_bank.c +++ b/src/ui/hud/banks/hud_send_resident_bank.c @@ -19,7 +19,7 @@ void hud_send_resident_bank(s32 bank, s32 bank_source_address, s32 immediate) { s32 page; s32 width_log2; s32 height_log2; - s32 size; + s32 image_pixel_count; if (hud_state.header.counts->loaded[bank] == 0) { link_hud_bank(0, bank_source_address); @@ -36,14 +36,14 @@ void hud_send_resident_bank(s32 bank, s32 bank_source_address, s32 immediate) { page = address >> 8; width_log2 = hud_state.image_pages[i].width_log2; height_log2 = hud_state.image_pages[i].height_log2; - size = 1 << (width_log2 + height_log2); + image_pixel_count = 1 << (width_log2 + height_log2); hud_send_texture(hud_state.image_pages[i].source_address, page, 0x1B, width_log2, height_log2, immediate); - address += size * 4; + address += image_pixel_count * 4; hud_state.image_pages[i].gs_block_offset = page; } } From 56b51eef87ddb4b943f62985a291c8e4dfd861db Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:09:23 +0000 Subject: [PATCH 440/657] decomp: clarify names in parse_particle_textures offset -> payload_offset: Source snapshot 5b87fb507a344d444268aca8e650895d3aa04f3c73a898fd75ee3a2037de92bd assigns this s32 from hdr->data_offset. Retail 0x00202700 loads header+8 into t2; 0x00202748 adds t2 to the header pointer for the copy source. At 0x00202714 the same offset minus resident payload base is subtracted from nonzero relocation words at 0x00202728. Original Ghidra identifies it as dwPayloadOffset. It is the header-relative payload byte offset. size -> payload_byte_count: Source assigns this s32 from hdr->data_size and uses it solely as the third argument of copy_memory_aligned(resident_lookup_payload, (u8 *)hdr + offset, size). Retail 0x00202708 loads header+0xc into a2, retained as the copy length for jal 0x001f9838 at 0x0020274c. Original Ghidra identifies it as dwPayloadSize and passes uVar2 with the header-relative payload source and resident destination, proving the copied payload byte count. --- src/rendering/texture/parse_particle_textures.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/rendering/texture/parse_particle_textures.c b/src/rendering/texture/parse_particle_textures.c index 68740270a0..671ad8d1c4 100644 --- a/src/rendering/texture/parse_particle_textures.c +++ b/src/rendering/texture/parse_particle_textures.c @@ -32,8 +32,8 @@ void parse_particle_textures(struct ParticleHdr *hdr, s32 count) { s32 relocation_count; - s32 offset; - s32 size; + s32 payload_offset; + s32 payload_byte_count; s32 i; s32 start_page; s32 start_offset; @@ -43,18 +43,18 @@ void parse_particle_textures(struct ParticleHdr *hdr, relocation_cursor = hdr->ptrs; relocation_count = hdr->count; - offset = hdr->data_offset; - size = hdr->data_size; + payload_offset = hdr->data_offset; + payload_byte_count = hdr->data_size; for (i = 0; i < relocation_count; i = i + 1, relocation_cursor = relocation_cursor + 1) { s32 relocation_word; relocation_word = *relocation_cursor; if (relocation_word == 0) { D_001CDF80[i] = (s32)resident_lookup_payload; } else { - D_001CDF80[i] = relocation_word - (offset - (s32)resident_lookup_payload); + D_001CDF80[i] = relocation_word - (payload_offset - (s32)resident_lookup_payload); } } - copy_memory_aligned(resident_lookup_payload, (u8 *)hdr + offset, size); + copy_memory_aligned(resident_lookup_payload, (u8 *)hdr + payload_offset, payload_byte_count); particle_texture_range_count = 0; while (particle_texture_range_count < count) { start_page = range_page_base + *range_source_cursor++; From c2e176bde0bf87fd2c83f99efd2c5a85fcf879d0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:11:26 +0000 Subject: [PATCH 441/657] decomp: clarify names in dma_shrub_textures size -> shrub_texture_dma_size: In the authoritative C, size receives build_shrub_texture_dma(gs_texture_allocation_cursor). Retail jal 0x0022a330 at 0x00228970 returns v0, saved in s0 at 0x0022897c (Ghidra iVar2). Retail 0x00228980-0x00228994 checks it against 0x400000 and prints the shrub texture overflow message; 0x00228998-0x002289a8 compares it with max_shrub_texture_dma_size and conditionally stores it as the new maximum. These uses prove the shrub texture DMA size role without asserting units. --- src/rendering/texture/dma_shrub_textures.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rendering/texture/dma_shrub_textures.c b/src/rendering/texture/dma_shrub_textures.c index ac1968c9e7..d084537c36 100644 --- a/src/rendering/texture/dma_shrub_textures.c +++ b/src/rendering/texture/dma_shrub_textures.c @@ -15,7 +15,7 @@ void dma_shrub_textures(void) __asm__("FUN_002288f0"); void dma_shrub_textures(void) { struct DmaTag *tag; - s32 size; + s32 shrub_texture_dma_size; tag = render_packet_cursor.tag; render_packet_cursor.tag = tag + 1; @@ -24,13 +24,13 @@ void dma_shrub_textures(void) { D_001603F0.p->vif0 = 0; D_001603F0.p->vif1 = 0; if (draw_config.shrub.enabled != 0 && draw_config.shrub.count != 0) { - size = build_shrub_texture_dma(gs_texture_allocation_cursor); + shrub_texture_dma_size = build_shrub_texture_dma(gs_texture_allocation_cursor); vu1_tex_flush(); - if (size > 0x400000) { + if (shrub_texture_dma_size > 0x400000) { DebugPrint(shrub_texture_overflow_message); } - if (max_shrub_texture_dma_size < size) { - max_shrub_texture_dma_size = size; + if (max_shrub_texture_dma_size < shrub_texture_dma_size) { + max_shrub_texture_dma_size = shrub_texture_dma_size; } } render_packet_cursor.tag->tag = 0x20000000; From 4886ab50774dad9640edbef60eec0da0442943c0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:11:26 +0000 Subject: [PATCH 442/657] decomp: clarify names in dma_tie_textures size -> tie_texture_dma_size: In the authoritative src/rendering/texture/dma_tie_textures.c snapshot (SHA-256 4354a4ab34256b9713fabad69b5f9bc102a8e2fddff1193c582e35bc6df4572b), s32 size receives build_tie_texture_dma(gs_texture_allocation_cursor). Retail jal 0x002370c0 at 0x002356c0 returns v0, saved to s0 at 0x002356cc (Ghidra iVar2). That same s0 is compared against 0x400000 at 0x002356d0-0x002356d8 to gate tie_texture_overflow_message, and against max_tie_texture_dma_size at 0x002356ec-0x002356f0 before the conditional maximum update at 0x002356f8. These uses prove the tie texture DMA size role without establishing units. --- src/rendering/texture/dma_tie_textures.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rendering/texture/dma_tie_textures.c b/src/rendering/texture/dma_tie_textures.c index 7eb05576a6..5787e3d8cc 100644 --- a/src/rendering/texture/dma_tie_textures.c +++ b/src/rendering/texture/dma_tie_textures.c @@ -15,7 +15,7 @@ void dma_tie_textures(void) __asm__("FUN_00235640"); void dma_tie_textures(void) { struct DmaTag *tag; - s32 size; + s32 tie_texture_dma_size; tag = render_packet_cursor.tag; render_packet_cursor.tag = tag + 1; @@ -24,13 +24,13 @@ void dma_tie_textures(void) { D_00160F68.p->vif0 = 0; D_00160F68.p->vif1 = 0; if (draw_config.tie.enabled != 0 && draw_config.tie.count != 0) { - size = build_tie_texture_dma(gs_texture_allocation_cursor); + tie_texture_dma_size = build_tie_texture_dma(gs_texture_allocation_cursor); vu1_tex_flush(); - if (size > 0x400000) { + if (tie_texture_dma_size > 0x400000) { DebugPrint(tie_texture_overflow_message); } - if (max_tie_texture_dma_size < size) { - max_tie_texture_dma_size = size; + if (max_tie_texture_dma_size < tie_texture_dma_size) { + max_tie_texture_dma_size = tie_texture_dma_size; } } render_packet_cursor.tag->tag = 0x20000000; From 2314bb4f534bf9086d109e1d706702ec51d8006d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:11:26 +0000 Subject: [PATCH 443/657] decomp: clarify names in dma_tfrag_textures size -> tfrag_texture_dma_size: In the authoritative dma_tfrag_textures.c snapshot (SHA-256 1de28b847fdde55aa964abd3ca524df856418309787065deb3e9f57f0d21d04f), size receives build_tfrag_texture_dma(gs_texture_allocation_cursor). Retail 0x00233248 calls that builder and 0x00233254 preserves its v0 return in s0 (Ghidra iVar2). At 0x00233258-0x0023326c this scalar is compared against 0x400000 and triggers tfrag_texture_overflow_message; 0x00233274-0x00233280 compares it to max_tfrag_texture_dma_size and stores it when larger. These uses prove the tfrag texture DMA size role without asserting units. --- src/rendering/texture/dma_tfrag_textures.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rendering/texture/dma_tfrag_textures.c b/src/rendering/texture/dma_tfrag_textures.c index 5d261681b3..6f70112e27 100644 --- a/src/rendering/texture/dma_tfrag_textures.c +++ b/src/rendering/texture/dma_tfrag_textures.c @@ -16,7 +16,7 @@ void dma_tfrag_textures(void) __asm__("FUN_002331c0"); void dma_tfrag_textures(void) { struct DmaTag *tag; - s32 size; + s32 tfrag_texture_dma_size; tag = render_packet_cursor.tag; render_packet_cursor.tag = tag + 1; @@ -26,13 +26,13 @@ void dma_tfrag_textures(void) { D_00160EBC.p->vif1 = 0; if (draw_config.tfrag.enabled != 0 && draw_config.tfrag.count != 0) { compute_tfrag_texture_usage(); - size = build_tfrag_texture_dma(gs_texture_allocation_cursor); + tfrag_texture_dma_size = build_tfrag_texture_dma(gs_texture_allocation_cursor); vu1_tex_flush(); - if (size > 0x400000) { + if (tfrag_texture_dma_size > 0x400000) { DebugPrint(tfrag_texture_overflow_message); } - if (max_tfrag_texture_dma_size < size) { - max_tfrag_texture_dma_size = size; + if (max_tfrag_texture_dma_size < tfrag_texture_dma_size) { + max_tfrag_texture_dma_size = tfrag_texture_dma_size; } } render_packet_cursor.tag->tag = 0x20000000; From ba54a82fb998306b7c16ede38e7bb19dd199ccdf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:11:26 +0000 Subject: [PATCH 444/657] decomp: clarify names in draw_textured_effect_list count -> effect_entry_count: In the authoritative source draw_textured_effect_list, count initializes the entry loop while list advances by 0x20 each iteration. Original retail param_2 follows this same flow: incoming a1 is saved in s3 at 0x002bc21c, checked positive at 0x002bc2d4, copied to s2 at 0x002bc2d8, and decremented at 0x002bc330 while s1 advances 0x20 at 0x002bc338. The decrement occurs even when the sphere check rejects an entry at 0x002bc2f4. Caller draw_level_12_effects supplies level_12_effect_entries and 0x2F, proving a count of input effect entries rather than bytes or successful draws. --- .../shared/rendering/effects/draw_textured_effect_list.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/rendering/effects/draw_textured_effect_list.c b/src/overlays/shared/rendering/effects/draw_textured_effect_list.c index 51b2d4671a..391fd840cf 100644 --- a/src/overlays/shared/rendering/effects/draw_textured_effect_list.c +++ b/src/overlays/shared/rendering/effects/draw_textured_effect_list.c @@ -29,7 +29,7 @@ void draw_textured_effect_list(void *list_, int context_two_texture_state) __asm__("FUN_L12_002bc210"); void draw_textured_effect_list(void *list_, - int count, + int effect_entry_count, int context_one_texture_state, int context_two_texture_state) { @@ -49,8 +49,8 @@ void draw_textured_effect_list(void *list_, for (i = 0xB3; i >= 0; i--) { *sp++ = 0x80808080; } - if (count > 0) { - for (i = count; i != 0; i--) { + if (effect_entry_count > 0) { + for (i = effect_entry_count; i != 0; i--) { sphere_check_result = fast_bsphere_check(list, 256.0f); if (sphere_check_result != -1) { FUN_L12_002667fc(*(int *)(list + 0x1C), From f7112c41f869240b545bfca90adcf7697a1e1f42 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:11:26 +0000 Subject: [PATCH 445/657] decomp: clarify names in spawn_blarg_ship_shot size -> draw_distance: Retail 0x00308f74 saves incoming float f12 in f21; 0x00308fa4/0x00308fac converts it with truncate_float_to_s32 and 0x00308fbc stores the result at spawned_moby+0x32, identified in authoritative C as MOBY(spawned_moby)->draw_dist. Original Ghidra param_1 follows that same conversion and halfword store. Its second use at 0x00309044 divides f21 by effective step_length f20, then stores the converted ratio at pvars+0x14 and ratio-13 at +0x18. Both supplied blarg_ship_update callers pass 128.0f for this parameter; draw_distance names the directly proven field-initialization role. --- src/overlays/shared/enemies/blarg_ship_shot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_ship_shot.c b/src/overlays/shared/enemies/blarg_ship_shot.c index bd7894c284..e61dcc9473 100644 --- a/src/overlays/shared/enemies/blarg_ship_shot.c +++ b/src/overlays/shared/enemies/blarg_ship_shot.c @@ -39,7 +39,7 @@ char *spawn_blarg_ship_shot(int owner, char *spawn_blarg_ship_shot(int firing_moby, float *launch_direction, float *spawn_position, - float size, + float draw_distance, float step_length, float z) { @@ -50,7 +50,7 @@ char *spawn_blarg_ship_shot(int firing_moby, MOBY(spawned_moby)->collision = 0; *(int *)(moby_vars + 0x1C) = firing_moby; MOBY(spawned_moby)->update_dist = 0xFF; - MOBY(spawned_moby)->draw_dist = truncate_float_to_s32(size); + MOBY(spawned_moby)->draw_dist = truncate_float_to_s32(draw_distance); *(int *)(spawned_moby + 0x40) = 0; MOBY(spawned_moby)->visible = 1; MOBY(spawned_moby)->rot.y = @@ -64,7 +64,7 @@ char *spawn_blarg_ship_shot(int firing_moby, step_length = fast_vec_length(launch_direction); } qcopy(&MOBY(spawned_moby)->pos, spawn_position); - size_length_ratio = truncate_float_to_s32(size / step_length); + size_length_ratio = truncate_float_to_s32(draw_distance / step_length); *(int *)(moby_vars + 0x14) = size_length_ratio; *(float *)(moby_vars + 0x20) = z; *(int *)(moby_vars + 0x18) = size_length_ratio - 13; From b394e3263917ac6a9d94cbff61962cf891505573 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:13:16 +0000 Subject: [PATCH 446/657] decomp: clarify names in __smakebuf size -> buffer_bytes: In the supplied C, size is set to 0x400 on both status paths, passed as _malloc_r(fp->_data, size), and assigned to fp->_bf._size on successful allocation. Retail 0x001145e8 and 0x001145ec load s2 with 0x400; 0x00114638/0x0011463c call the allocator with a1=0x400, and 0x00114688 stores s2 into the buffer size at fp+0x14. Original Ghidra likewise shows FUN_00114920(...,0x400) followed by param_1[5]=0x400. Thus buffer_bytes names the allocated stream buffer capacity measured in bytes. --- src/sdk/libc/stdio/smakebuf.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/libc/stdio/smakebuf.c b/src/sdk/libc/stdio/smakebuf.c index 159236e520..b8a13484f3 100644 --- a/src/sdk/libc/stdio/smakebuf.c +++ b/src/sdk/libc/stdio/smakebuf.c @@ -36,7 +36,7 @@ extern s32 isatty() __asm__("func_00118EC0"); extern s32 __sseek(void *, s32, s32); void __smakebuf(RncFile *fp) { - u32 size, couldbetty; + u32 buffer_bytes, couldbetty; void *allocated_buffer; struct RncStatBuffer file_status; @@ -47,11 +47,11 @@ void __smakebuf(RncFile *fp) { } if ((s16)fp->_file < 0 || _fstat_r(fp->_data, (s16)fp->_file, &file_status) < 0) { couldbetty = 0; - size = 0x400; + buffer_bytes = 0x400; fp->_flags |= 0x800; } else { couldbetty = (file_status.st_mode & 0xF000) == 0x2000; - size = 0x400; + buffer_bytes = 0x400; if ((file_status.st_mode & 0xF000) == 0x8000 && fp->_seek == __sseek) { fp->_flags |= 0x400; fp->_blksize = 1024; @@ -59,7 +59,7 @@ void __smakebuf(RncFile *fp) { fp->_flags |= 0x800; } } - if ((allocated_buffer = _malloc_r(fp->_data, size)) == NULL) { + if ((allocated_buffer = _malloc_r(fp->_data, buffer_bytes)) == NULL) { fp->_flags |= 2; fp->_bf._base = fp->_p = fp->_nbuf; fp->_bf._size = 1; @@ -67,7 +67,7 @@ void __smakebuf(RncFile *fp) { fp->_data->__cleanup = (void (*)(RncReent *))D_00113AC8; fp->_flags |= 0x80; fp->_bf._base = fp->_p = (u8 *)allocated_buffer; - fp->_bf._size = size; + fp->_bf._size = buffer_bytes; if (couldbetty && isatty((s16)fp->_file)) fp->_flags |= 1; } From 837c0b0630d079bf7ca24123ddc1e77bfac855d2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:15:07 +0000 Subject: [PATCH 447/657] decomp: clarify names in _nextBit count -> bit_count: Retail 0x00128944 preserves argument a1 in s2; 0x001289b8-0x001289bc compares available bits at ctx+0x83c against s2. At 0x00128a20, 32-s2 supplies the right shift at 0x00128a28 extracting the returned leading bits. At 0x00128a00/0x00128a14, s2 is ORed with 0x40000000 and issued to IPU_CMD, advancing by that same bit width. The source mirrors these operations, and supplied _decMB0 calls use widths 1, 2 and 5 for MPEG syntax fields. --- src/sdk/mpeg/bitstream/nextbit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/mpeg/bitstream/nextbit.c b/src/sdk/mpeg/bitstream/nextbit.c index 447f0f637e..e33f344edc 100644 --- a/src/sdk/mpeg/bitstream/nextbit.c +++ b/src/sdk/mpeg/bitstream/nextbit.c @@ -13,7 +13,7 @@ typedef struct NextBitContext { s32 unk858; } NextBitContext; -s32 _nextBit(NextBitContext *ctx, s32 count) { +s32 _nextBit(NextBitContext *ctx, s32 bit_count) { s32 consumed_bits; s32 counter; u32 word; @@ -26,14 +26,14 @@ s32 _nextBit(NextBitContext *ctx, s32 count) { } } while ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000); } - if (ctx->ipu_command_class != 0 || ctx->available_bit_count < count) { + if (ctx->ipu_command_class != 0 || ctx->available_bit_count < bit_count) { *(volatile u32 *)0x10002000 = 0x40000000; ctx->ipu_command_class = IpuCommandTable[4]; ctx->cached_bit_window = (s32)(s64)_waitIpuIdle64(ctx); } - consumed_bits = ((u32)ctx->cached_bit_window) >> (0x20 - count); + consumed_bits = ((u32)ctx->cached_bit_window) >> (0x20 - bit_count); ctx->available_bit_count = 0x20; - word = count | 0x40000000; + word = bit_count | 0x40000000; *(volatile u32 *)0x10002000 = word; ctx->ipu_command_class = IpuCommandTable[word >> 28]; ctx->cached_bit_window = (s32)(s64)_waitIpuIdle64(ctx); From 167bf308ee5594e37f2c55acd37f97738e6c9a56 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:15:07 +0000 Subject: [PATCH 448/657] decomp: clarify names in sceGsExecLoadImage count -> dma_busy_poll_count: In the authoritative source snapshot d1bf8f0cea0834883cf829ff330a552f307ac7b9c3e5e08a2e6a912a8b139130, count is initialized once and incremented only in the two loops testing GIF CHCR at 0x1000A000 bit 0x100. Retail 0x0012267c zeros a2; 0x00122690-0x00122698 compares it against 0x01000000 and increments it while busy. After launching the six-QWC packet, 0x00122724-0x00122730 reuses and increments the same a2 without resetting it. Both threshold branches reach 0x0012278c, print the DMA Ch.2 nontermination message and return -1. Original Ghidra uVar3 has this same shared busy-poll data flow, proving dma_busy_poll_count. --- src/sdk/graph/sce_gs_exec_load_image.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/graph/sce_gs_exec_load_image.c b/src/sdk/graph/sce_gs_exec_load_image.c index ff21a9b2de..53b37ad5e5 100644 --- a/src/sdk/graph/sce_gs_exec_load_image.c +++ b/src/sdk/graph/sce_gs_exec_load_image.c @@ -5,11 +5,11 @@ const char gs_load_image_dma_timeout_message[] __asm__("D_001531D0") = "sceGsExecLoadImage: DMA Ch.2 does not terminate\r\n"; s32 sceGsExecLoadImage(u8 *lp, u8 *image_payload) { - u32 count; + u32 dma_busy_poll_count; - count = 0; + dma_busy_poll_count = 0; while (*(volatile u32 *)0x1000A000 & 0x100) { - if (count++ > 0x1000000) { + if (dma_busy_poll_count++ > 0x1000000) { scePrintf(gs_load_image_dma_timeout_message); return -1; } @@ -22,7 +22,7 @@ s32 sceGsExecLoadImage(u8 *lp, u8 *image_payload) { } *(volatile u32 *)0x1000A000 = 0x101; while (*(volatile u32 *)0x1000A000 & 0x100) { - if (count++ > 0x1000000) { + if (dma_busy_poll_count++ > 0x1000000) { scePrintf(gs_load_image_dma_timeout_message); return -1; } From c0730f2ba07487109fab0275bc7a4c9a9021ccac Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:17:53 +0000 Subject: [PATCH 449/657] decomp: clarify names in sceIpuRestartDMA count -> buffered_quadword_count: In src/sdk/ipu/sce_ipu_restart_dma.c (SHA-256 62cf3e36729aee2cb532d670321a63de6d51a9f23813bff574e4f9f551b71031), count sums saved BP bits 16-17 and 8-11. Retail 0x0012cd2c-0x0012cd44 extracts and sums these fields; 0x0012cd4c adds that sum to saved input QWC, while 0x0012cd50 and 0x0012cd58 multiply it by 16 and subtract it from the saved input address. The adjusted values reach IPU_TO QWC at 0x0012ce20 and MADR at 0x0012ce04. The supplied original Ghidra decompilation identifies this same sum as buffered QWC, proving buffered_quadword_count. --- src/sdk/ipu/sce_ipu_restart_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdk/ipu/sce_ipu_restart_dma.c b/src/sdk/ipu/sce_ipu_restart_dma.c index 895c0ea8e6..6922be8a4e 100644 --- a/src/sdk/ipu/sce_ipu_restart_dma.c +++ b/src/sdk/ipu/sce_ipu_restart_dma.c @@ -16,7 +16,7 @@ struct sceIpuDmaEnv { void sceIpuRestartDMA(struct sceIpuDmaEnv *ctx) { u32 bits; u32 magic; - u32 count; + u32 buffered_quadword_count; s32 input_dma_quadword_count; s32 input_dma_address; From 08767cd170d1a716584d8bf5c4e37149577479f6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:17:53 +0000 Subject: [PATCH 450/657] decomp: clarify names in load_preview_resource_bindings count -> binding_count: In the SHA-256-bound source, count copies resource_count and bounds resource_index while binding advances once per iteration. Retail 0x00226858 saves a1, 0x0022688c-0x00226894 guards and publishes that count; 0x002268e4 advances the eight-byte PreviewResourceBinding pointer, 0x00226914 increments the processed binding index, and 0x00226980-0x00226988 compares it against the saved count. The count==2 buffer-selection branch at 0x002268c8-0x002268dc also uses this binding total. --- .../item_preview/load_preview_resource_bindings.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ui/menus/item_preview/load_preview_resource_bindings.c b/src/ui/menus/item_preview/load_preview_resource_bindings.c index 487a676e5a..7a089648a9 100644 --- a/src/ui/menus/item_preview/load_preview_resource_bindings.c +++ b/src/ui/menus/item_preview/load_preview_resource_bindings.c @@ -17,7 +17,7 @@ void load_preview_resource_bindings(s32 first_resource, s32 resource_count) __as preview_resource_buffers array; reading them through the struct gives the state base its own register. */ void load_preview_resource_bindings(s32 first_resource, s32 resource_count) { - s32 count; + s32 binding_count; s32 *class_resource_slot; s32 read_address; s32 buffer_address; @@ -31,13 +31,13 @@ void load_preview_resource_bindings(s32 first_resource, s32 resource_count) { PreviewResourceBinding *binding; s32 resource_index; - count = resource_count; + binding_count = resource_count; resource_index = 0; menu_system.preview_resource_first = first_resource; menu_system.preview_resource_count = count; /* Testing the index, not count, lets combine drop the constant note on its zero, so its live range is not doubled. */ - if (resource_index < count) { + if (resource_index < binding_count) { resource_offset = first_resource * 4; binding = preview_resource_bindings + first_resource; do { @@ -47,7 +47,7 @@ void load_preview_resource_bindings(s32 first_resource, s32 resource_count) { /* Fakematch: two bindings use resource buffers 0 and 2. The do-while weights the index use one loop deeper, so the index is allocated before the binding pointer. */ - if (count == 2) { + if (binding_count == 2) { do { if (resource_index == 1) { buffer_skip = 1; @@ -74,6 +74,6 @@ void load_preview_resource_bindings(s32 first_resource, s32 resource_count) { buffer_address; } relocate_asset_entry_pointers(*class_resource_slot, animation_index); - } while (resource_index < count); + } while (resource_index < binding_count); } } From 4a4f6846fc182b2aeabfb896f4d21ba2afaeede5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:17:53 +0000 Subject: [PATCH 451/657] decomp: clarify names in spawn_spinning_fade_in_out_effect_particle size -> initial_spawn_size: Retail 0x0026b7cc preserves incoming f16 in f22; 0x0026b82c stores f22 directly at allocation+0xC. Original Ghidra likewise stores param_5 at iVar8+0xC, matching the authoritative C assignment *(float *)(particle + 0xC) = size. The supplied update_spinning_fade_in_out_effect_particle subsequently multiplies particle->fC (the same +0xC size slot) by particle_data->fC each tick, proving this argument is the initial size at spawn rather than the evolving size or its multiplier. --- .../rendering/effects/update_three_phase_effect_particle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c index 5353b847c1..c472f33037 100644 --- a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c +++ b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c @@ -1034,7 +1034,7 @@ unsigned char *spawn_spinning_fade_in_out_effect_particle(void *spawn_origin, float hi, float vertical_position_step, - float size) { + float initial_spawn_size) { unsigned char *particle = FUN_L00_002678b8_26b790(0xD); if (particle) { unsigned char *particle_data; @@ -1043,7 +1043,7 @@ unsigned char *spawn_spinning_fade_in_out_effect_particle(void *spawn_origin, *(int *)(particle + 4) = color; particle[9] = truncate_float_to_s32(4.0f) + 0x40; particle[3] = 0x48; - *(float *)(particle + 0xC) = size; + *(float *)(particle + 0xC) = initial_spawn_size; particle[1] = 0; particle[8] = 0; particle[2] = *D_L00_001B20B4; From f67914175f08dada8c2b16f13419c1f4554b2692 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:19:44 +0000 Subject: [PATCH 452/657] decomp: clarify names in append_draw_buffer_upload_packets size -> upload_byte_count: Original Ghidra param_3 initializes uVar3 as (param_3 + 0x3fffU) & 0xffffc000; retail 0x002a0fcc adds 0x3fff to a2 and 0x002a0ff4 masks it into s0. At 0x002a106c s0 decreases by 0x4000 per packet, while 0x002a10ac advances the byte offset by 0x4000 and 0x002a10a8/0x002a10c8 put upload_source_byte_address plus that offset into the packet address. The authoritative C expresses the same flow as left = (size + 0x3FFF) & ~0x3FFF. Supplied callers pass frame_size << 11. Thus size is the requested upload byte count before rounding. --- .../shared/rendering/buffers/transfer_draw_buffer_chunks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/buffers/transfer_draw_buffer_chunks.c b/src/overlays/shared/rendering/buffers/transfer_draw_buffer_chunks.c index cc28b68c1d..e0724511c9 100644 --- a/src/overlays/shared/rendering/buffers/transfer_draw_buffer_chunks.c +++ b/src/overlays/shared/rendering/buffers/transfer_draw_buffer_chunks.c @@ -43,8 +43,8 @@ void append_draw_buffer_upload_packets(int dst, void append_draw_buffer_upload_packets(int upload_source_byte_address, int draw_buffer_byte_address, - int size) { - int left = (size + 0x3FFF) & ~0x3FFF; + int upload_byte_count) { + int left = (upload_byte_count + 0x3FFF) & ~0x3FFF; int transfer_byte_offset = 0; while (left > 0) { *(int *)D_L00_001611C0_002a0fc8 = 0x10000006; From 85cd9edf57ac81eb76a4faf37a6cebaf4c4575cf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:19:44 +0000 Subject: [PATCH 453/657] decomp: clarify names in snd_send_iop_command_and_wait size -> payload_byte_count: Retail 0x0012e554 preserves incoming a1 in s0; 0x0012e588-0x0012e5a0 copies individual bytes from incoming a2 into 0x00133140, increments the index by one and compares it with s0. At 0x0012e61c s0 becomes the fifth sceSifCallRpc argument (send_size) for the staged payload at call 0x0012e630; zero selects the null-payload call. This matches the C byte-copy bound and size argument and Ghidra nPayloadBytes. --- src/audio/rpc/snd_send_iop_command_and_wait.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/audio/rpc/snd_send_iop_command_and_wait.c b/src/audio/rpc/snd_send_iop_command_and_wait.c index 6b816ffc20..d8e732e479 100644 --- a/src/audio/rpc/snd_send_iop_command_and_wait.c +++ b/src/audio/rpc/snd_send_iop_command_and_wait.c @@ -17,11 +17,11 @@ s32 snd_send_iop_command_and_wait(s32 cmd, s32 size, u8 *data) __asm__(" extern s32 snd_batches_held __asm__("D_0015ECC4") __attribute__((sda)); -s32 snd_send_iop_command_and_wait(s32 cmd, s32 size, u8 *command_payload) { +s32 snd_send_iop_command_and_wait(s32 cmd, s32 payload_byte_count, u8 *command_payload) { s32 i; s32 iop_command_result; - for (i = 0; i < size; i++) { + for (i = 0; i < payload_byte_count; i++) { snd_sync_send_buffer[i] = command_payload[i]; } goto check; @@ -36,9 +36,9 @@ s32 snd_send_iop_command_and_wait(s32 cmd, s32 size, u8 *command_payload) { snd_flush_sound_commands(); FlushCache(0); } - if (size != 0) { + if (payload_byte_count != 0) { sceSifCallRpc( - sound_command_client, cmd, 1, snd_sync_send_buffer, size, snd_sync_buffer, 0xC, 0, 0); + sound_command_client, cmd, 1, snd_sync_send_buffer, payload_byte_count, snd_sync_buffer, 0xC, 0, 0); } else { sceSifCallRpc(sound_command_client, cmd, 1, 0, 0, snd_sync_buffer, 0xC, 0, 0); } From c61427e9323c4d4352f071f2b6263dfca93250bf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:19:44 +0000 Subject: [PATCH 454/657] decomp: clarify names in initialize_hero_relative_camera timer -> camera_data_for_timer: In the bound source src/overlays/l03/hero_relative_camera.c (SHA-256 d40a2a22786ff0a64195bb583f01d0ffa85df8e187acb6972d8ff75855e30b9b), timer loads *(char **)(camera+0x70), then ((s32 *)timer)[12] receives scale_game_frames(0x78). Retail 0x002eba38 loads this camera data base into s1; 0x002eba3c-0x002eba40 calls the scaling helper with 0x78; 0x002eba44 stores v0 at 0x30(s1). Original Ghidra confirms iVar1=*(int *)(iVar6+0x70) followed by *(undefined4 *)(iVar1+0x30)=uVar7. Thus the local represents the camera data base for timer initialization, not a scalar timer or pointer directly to its field. --- src/overlays/l03/hero_relative_camera.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l03/hero_relative_camera.c b/src/overlays/l03/hero_relative_camera.c index 073fd908ee..a88bf2cefe 100644 --- a/src/overlays/l03/hero_relative_camera.c +++ b/src/overlays/l03/hero_relative_camera.c @@ -49,7 +49,7 @@ void initialize_hero_relative_camera(void *camera_instance) { char *target; char *pos; char *camera_data; - char *timer; + char *camera_data_for_timer; char *camera_back_direction_data; int camera_table_base; float *camera_parameter_values; @@ -75,8 +75,8 @@ void initialize_hero_relative_camera(void *camera_instance) { *(float *)(pos + 0x24) = 0.2f; clear_u64_value(pos + 0x10); qcopy(pos, &hero.motion.pos); - timer = *(char **)(camera + 0x70); - ((s32 *)timer)[12] = scale_game_frames(0x78); + camera_data_for_timer = *(char **)(camera + 0x70); + ((s32 *)camera_data_for_timer)[12] = scale_game_frames(0x78); camera_table_base = D_L03_0015EF50; camera_back_direction_data = *(char **)(camera + 0x70) + 0xF0; *(s32 *)(camera_back_direction_data + 0x30) = 0; From ae75daa35416865315f530e408c034ff980f7e00 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:19:44 +0000 Subject: [PATCH 455/657] decomp: clarify names in initialize_planetbuster_maximus_detached_part_motion offset -> vertical_step_decrement_byte_offset: Retail 0x00306384 sets s1 to 0x44 for owner slot 17; 0x0030638c shifts slot left two and 0x003063a0 copies that byte offset to s1 otherwise. At 0x003063ec and 0x003063fc it is added to owner pvars +0x570, producing the float destination initialized at 0x00306404 and overridden at 0x0030649c/0x003064c0. Original Ghidra iVar1 and pfVar3=(float *)(iVar2+0x570+iVar1) agree with current C offset. The supplied detached-parts consumer subtracts this per-slot float from the vertical step before adding the updated step to moby Z, proving vertical_step_decrement_byte_offset. --- src/overlays/l12/mobys/planetbuster_maximus_part.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l12/mobys/planetbuster_maximus_part.c b/src/overlays/l12/mobys/planetbuster_maximus_part.c index a0a83a6d7d..be201c4a5d 100644 --- a/src/overlays/l12/mobys/planetbuster_maximus_part.c +++ b/src/overlays/l12/mobys/planetbuster_maximus_part.c @@ -416,7 +416,7 @@ void initialize_planetbuster_maximus_detached_part_motion(struct Moby *moby, int char *motion_owner_pvars = (char *)moby->pvars; struct Moby *selected; float *speed; - int offset; + int vertical_step_decrement_byte_offset; float initial_speed; float angle_scale; float first_angle; @@ -425,17 +425,17 @@ void initialize_planetbuster_maximus_detached_part_motion(struct Moby *moby, int if (slot == 0x11) { selected = moby; - offset = 0x44; + vertical_step_decrement_byte_offset = 0x44; } else { selected = (struct Moby *)(D_L12_0015FFD8_p + D_L12_001FB688[slot] * 0x100); - offset = slot * 4; + vertical_step_decrement_byte_offset = slot * 4; } initial_speed = random_float_between(frame_time_sq * 3.7f, frame_time_sq * 5.0f); angle_scale = frame_time; { char *vertical_step_decrements = motion_owner_pvars + 0x570; - speed = (float *)(vertical_step_decrements + offset); + speed = (float *)(vertical_step_decrements + vertical_step_decrement_byte_offset); } *speed = initial_speed; first_angle = randf_sym(angle_scale * 0.05235988f, angle_scale * 0.13962634f); From d9b411e809fa0ebb9081b22a43b6e9e6747a25b8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:19:44 +0000 Subject: [PATCH 456/657] decomp: clarify names in spawn_moving_resizing_height_snapped_alpha_fade_particle size -> initial_size_scale: Retail 0x00271614 saves incoming f12 in f20; 0x002716a4-0x002716ac load 210000.0f, 0x002716b8 multiplies f20 by that constant, and 0x002716c4 stores the product at particle+0xC. Original Ghidra expresses this as *(float *)(iVar8+0xc)=param_1*210000.0. Bound C identifies +0xC as particle size and its updater subsequently adds size_increment. Supplied callers pass random_effect_scale (0.4..0.6) or random_float_between(0.3f,0.6f), proving an initial size scale rather than a size in stored units. --- src/overlays/shared/rendering/effects/particles.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index 2053b4f6e1..3680702f08 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -138,7 +138,7 @@ unsigned char *spawn_moving_resizing_height_snapped_alpha_ unsigned char *spawn_moving_resizing_height_snapped_alpha_fade_particle( - void *initial_position, int x, int color, float size, float size_increment) { + void *initial_position, int x, int color, float initial_size_scale, float size_increment) { unsigned char *particle = create_part(0x2D); if (particle) { unsigned char *particle_data; @@ -158,7 +158,7 @@ unsigned char *spawn_moving_resizing_height_snapped_alpha_fade_particle( particle[2] = *D_L00_001B2134; particle[8] = rand(); *(short *)(particle + 0xA) = 4; - *(float *)(particle + 0xC) = size * 210000.0f; + *(float *)(particle + 0xC) = initial_size_scale * 210000.0f; drift_angle_radians = random_angle_radians(); horizontal_drift_speed = random_float_between(0.0015f, 0.0025f); *(float *)(particle_data + 0) = fast_cos(drift_angle_radians) * horizontal_drift_speed; From 96d7ba774e3db226a4e7b652d410edb95032b32e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:19:44 +0000 Subject: [PATCH 457/657] decomp: clarify names in classify_resort_owner_target_proximity offset -> target_moby_byte_offset: Retail 0x002d2500 loads the group-list short, 0x002d250c masks it with 0x7fff, and 0x002d2510 shifts the index left by 8 into s1. At 0x002d2514 this byte offset is added to D_L11_0015FFD8 to form the target Moby pointer; 0x002d2550-0x002d2558 reuse it to address that moby's position at +0x10. Original Ghidra iVar9 = (*puVar8 & 0x7fff) * 0x100 and the authoritative C offset expression confirm the same array-relative byte displacement. --- src/overlays/l11/mobys/resort_owner.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l11/mobys/resort_owner.c b/src/overlays/l11/mobys/resort_owner.c index b2a16653d8..8e78053915 100644 --- a/src/overlays/l11/mobys/resort_owner.c +++ b/src/overlays/l11/mobys/resort_owner.c @@ -769,14 +769,14 @@ int classify_resort_owner_target_proximity(struct Moby *moby) { if (group_moby_entry == 0) continue; do { - int offset = (*group_moby_entry & 0x7fff) << 8; - struct Moby *target_group_moby = (struct Moby *)(offset + D_L11_0015FFD8); + int target_moby_byte_offset = (*group_moby_entry & 0x7fff) << 8; + struct Moby *target_group_moby = (struct Moby *)(target_moby_byte_offset + D_L11_0015FFD8); if ((signed char)target_group_moby->state >= RESORT_OWNER_TARGET_MIN_LIVE_STATE) { if (target_group_moby->oclass != 0x4de || is_moby_in_bob_target_exclusion_state((const u8 *)target_group_moby) == 0) { found = 1; if (fast_vec_dist(&moby->pos, - &((struct Moby *)(D_L11_0015FFD8 + offset))->pos) < 10.0f) + &((struct Moby *)(D_L11_0015FFD8 + target_moby_byte_offset))->pos) < 10.0f) return 2; } } From 853e830b63f87c807a5f8a85f7f90cf3296d663e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:19:45 +0000 Subject: [PATCH 458/657] decomp: clarify names in setup_menu_display_text count -> collected_gold_bolt_count: Source snapshot src/ui/menus/system/setup_menu_display_text.c (SHA-256 377b14cf20882911bf536115a9e8eea3efa4c939ce1af798cdc62a9b92ea75a4) initializes count to zero and increments it for nonzero D_0014BEC0[level_map_selection.level * 4 + k] entries across four slots. Original retail Ghidra names the same byte array g_bGold_bolt_collected. Retail 0x0021f004 clears s3; 0x0021f010-0x0021f020 select the level's four-byte group at 0x0014bec0; 0x0021f028-0x0021f040 load each byte and conditionally increment s3. At 0x0021f084 s3 becomes a3 for sprintf at 0x0021f094, proving this is the collected gold-bolt total displayed for the selected level. --- src/ui/menus/system/setup_menu_display_text.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/menus/system/setup_menu_display_text.c b/src/ui/menus/system/setup_menu_display_text.c index 7179154bdd..b5054aed64 100644 --- a/src/ui/menus/system/setup_menu_display_text.c +++ b/src/ui/menus/system/setup_menu_display_text.c @@ -35,7 +35,7 @@ int setup_menu_display_text(struct MenuScreen *menu) { draw_moby_list(menu->data.preview.moby, 1); } setup_gif_paging(0); - count = 0; + collected_gold_bolt_count = 0; { int k; for (k = 0; k < 4; k++) { @@ -47,7 +47,7 @@ int setup_menu_display_text(struct MenuScreen *menu) { sprintf(formatted_menu_text, setup_menu_text_format, get_help_message_text(0x4F4F), - count, + collected_gold_bolt_count, get_help_message_text(0x4F53), gold_bolts_per_level[level_map_selection.level]); font_print_right( From 60a556fe5723fa7eb807c6bcb7cb0bb199331063 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:19:45 +0000 Subject: [PATCH 459/657] decomp: clarify names in smoke_emitter_update size -> target_particle_scalar: In the authoritative smoke_emitter.c snapshot (SHA-256 542e9e645e3416c731270b3a091df7bc0a63e239f8684fa0014bcbc5927f9e71), f32 size receives random_float_between(125000.0f, 175000.0f) and is passed as the float argument to spawn_effect_particle_with_target_scalar. Retail 0x002ffc3c-0x002ffc54 loads those bounds and samples the float; 0x002ffc5c saves f0 into f20, and 0x002ffc7c supplies it in f12 to the particle call at 0x002ffc90. Original Ghidra uVar7 follows that same sample-to-call flow. The supplied helper context calls this input target_particle_scalar, initializes particle+0xc to its 0.2 fraction, and computes (target_particle_scalar - initial_scalar) / lifetime at particle_data+0x1c, proving a target particle scalar rather than merely an unspecified size. --- src/overlays/l01/mobys/smoke_emitter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l01/mobys/smoke_emitter.c b/src/overlays/l01/mobys/smoke_emitter.c index ad957ff4b7..74fea442f1 100644 --- a/src/overlays/l01/mobys/smoke_emitter.c +++ b/src/overlays/l01/mobys/smoke_emitter.c @@ -35,7 +35,7 @@ void smoke_emitter_update(SmokeMoby *smoke_emitter_moby) { Vec4 pos; Vec4 particle_velocity; Vec4 local_velocity; - f32 size; + f32 target_particle_scalar; s32 i; smoke_vars = smoke_emitter_moby->vars; @@ -52,12 +52,12 @@ void smoke_emitter_update(SmokeMoby *smoke_emitter_moby) { particle_velocity.q = local_velocity.q; transform_vector_by_basis(&particle_velocity, &particle_velocity, smoke_emitter_moby->mtx); fast_vec_add(&pos, &pos, &smoke_emitter_moby->pos); - size = random_float_between(125000.0f, 175000.0f); + target_particle_scalar = random_float_between(125000.0f, 175000.0f); spawn_effect_particle_with_target_scalar(&pos, &particle_velocity, 0x207F7F7F, 0x272727, - size, + target_particle_scalar, scale_game_frames(random_int_between(0x2D, 0x3C))); } } From 0438838f5f806d25755bb05c3dc1d5b70af2ad0b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:21:34 +0000 Subject: [PATCH 460/657] decomp: clarify names in update_drain_cover_tilt offset -> hero_offset_from_cover: Authoritative C declares float offset[4] and writes fast_vec_sub(offset, &game->motion.pos, &MOBY(moby)->pos). Retail 0x0030f454-0x0030f460 passes stack vector destination, hero position 0x0013f3d0, and moby+0x10 to subtraction at 0x0022df90; original Ghidra shows the same operand order. Retail 0x0030f464-0x0030f478 then dots that vector with moby basis rows +0xc0 and +0xd0, proving it is the hero offset from the cover used for tilt. --- src/overlays/l05/mobys/drain_cover.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l05/mobys/drain_cover.c b/src/overlays/l05/mobys/drain_cover.c index d6fd8e70c3..14325e5285 100644 --- a/src/overlays/l05/mobys/drain_cover.c +++ b/src/overlays/l05/mobys/drain_cover.c @@ -485,7 +485,7 @@ typedef struct DrainCoverVars { void update_drain_cover_tilt(char *moby, float turn_scale, float speed_scale) { DrainCoverVars *drain_cover_vars = (DrainCoverVars *)MOBY(moby)->pvars; struct Hero *game = &hero; - float offset[4]; + float hero_offset_from_cover[4]; float horizontal; float vertical; float angle0; @@ -499,9 +499,9 @@ void update_drain_cover_tilt(char *moby, float turn_scale, float speed_scale) { float dot1; if ((char *)game->ground_moby == moby && game->air_frames.s == 0) { - fast_vec_sub(offset, &game->motion.pos, &MOBY(moby)->pos); - dot0 = fast_vec_dot(offset, &MOBY(moby)->rot_row0); - dot1 = fast_vec_dot(offset, &MOBY(moby)->rot_row1); + fast_vec_sub(hero_offset_from_cover, &game->motion.pos, &MOBY(moby)->pos); + dot0 = fast_vec_dot(hero_offset_from_cover, &MOBY(moby)->rot_row0); + dot1 = fast_vec_dot(hero_offset_from_cover, &MOBY(moby)->rot_row1); horizontal = turn_scale * dot0; vertical = -turn_scale * dot1; } else { From d9b5e077ec12c7a2b4ee14f9dd10bb0f0b2981a0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:21:34 +0000 Subject: [PATCH 461/657] decomp: clarify names in sceCdRead size -> transfer_byte_count: In source src/sdk/storage/cdvd/sceCdRead.c (SHA-256 9ffcf20b610c886150cfe45072c165c843a86fb82456e1c695a60da133f528a9), size is assigned count * 2328, count * 2340, or count * 2048 according to mode->datapattern and used only as sceSifWriteBackDCache(buffer, size)'s length. Retail 0x00121508 shifts sector count s1 by 11 into a1; 0x00121520-0x0012152c multiply it by 0x918 or 0x924. The resulting a1 is consumed by the cache-writeback call at 0x00121544 with destination s4 moved to a0 at 0x00121548. Original Ghidra likewise passes the selected sector-count product to writeback_sif_cache(pDestination,iVar2), proving transfer extent in bytes. --- src/sdk/storage/cdvd/sceCdRead.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sdk/storage/cdvd/sceCdRead.c b/src/sdk/storage/cdvd/sceCdRead.c index ffcc53aef3..ff64ba9f04 100644 --- a/src/sdk/storage/cdvd/sceCdRead.c +++ b/src/sdk/storage/cdvd/sceCdRead.c @@ -32,7 +32,7 @@ s32 sceCdRead(u32 sector, u32 count, void *buffer, struct sceCdRMode *mode) { CD_READ_PATTERN_2340_BYTES_PER_SECTOR = 2 }; struct CdReadCommand *command = &native_cd_read_request; - s32 size; + s32 transfer_byte_count; if (!(D_001312F4[0] & 1) && sceCdNcmdDiskReady() == 6) { return 0; @@ -50,19 +50,19 @@ s32 sceCdRead(u32 sector, u32 count, void *buffer, struct sceCdRMode *mode) { command->status = (s32 *)native_cd_read_response; switch (mode->datapattern) { case CD_READ_PATTERN_2328_BYTES_PER_SECTOR: - size = count * 2328; + transfer_byte_count = count * 2328; break; case CD_READ_PATTERN_2340_BYTES_PER_SECTOR: - size = count * 2340; + transfer_byte_count = count * 2340; break; case CD_READ_PATTERN_2048_BYTES_PER_SECTOR: default: - size = count * 2048; + transfer_byte_count = count * 2048; break; } *(s32 *)native_cd_read_response = 0; if (!(D_001312F4[0] & 2)) { - sceSifWriteBackDCache(buffer, size); + sceSifWriteBackDCache(buffer, transfer_byte_count); } sceSifWriteBackDCache(native_cd_read_completion_buffer, 0x90); sceSifWriteBackDCache(command, sizeof(*command)); From 0f20652e9a1e45ee4b557fd4db4847ac96211f25 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:23:40 +0000 Subject: [PATCH 462/657] decomp: clarify names in sceGsSetDefLoadImage size -> image_qword_count: In the SHA-256-bound source src/sdk/graph/sce_gs_set_def_load_image.c (78f71f060882072c7265f55b7c0999aae23ba4451a49616122fcd7fd42b38a5c), s32 size receives width*height/4 for 32-bit pixels, pixels*3/16 for 24-bit, pixels/8 for 16-bit, pixels/16 for 8-bit and pixels/32 for 4-bit: each is payload bytes divided by 16. Original retail decompilation uVar2 has these same assignments. Retail 0x0012239c-0x001223d8 computes the count in a2, 0x001223dc-0x001223e4 rejects counts above 0x7fff, and 0x00122400 masks it to 15 bits before 0x00122444 combines it into the IMAGE GIF tag stored at descriptor+0x50 by 0x001224d4. Source assigns it to ((struct GifTag *)&image->q[10])->NLOOP with FLG=2, proving image_qword_count. --- src/sdk/graph/sce_gs_set_def_load_image.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sdk/graph/sce_gs_set_def_load_image.c b/src/sdk/graph/sce_gs_set_def_load_image.c index a0b04c4c8f..842f03ae3d 100644 --- a/src/sdk/graph/sce_gs_set_def_load_image.c +++ b/src/sdk/graph/sce_gs_set_def_load_image.c @@ -14,35 +14,35 @@ s32 sceGsSetDefLoadImage(sceGsLoadImage *image, s16 width, s16 height) { - s32 size = 0; + s32 image_qword_count = 0; switch (pixel_format) { case PIXEL_FORMAT_32_BIT: case PIXEL_FORMAT_32_BIT_ALTERNATE: - size = (width * height) >> 2; + image_qword_count = (width * height) >> 2; break; case PIXEL_FORMAT_24_BIT: case PIXEL_FORMAT_24_BIT_ALTERNATE: - size = (width * height * 3) >> 4; + image_qword_count = (width * height * 3) >> 4; break; case PIXEL_FORMAT_16_BIT: case PIXEL_FORMAT_16_BIT_ALTERNATE: case PIXEL_FORMAT_16_BIT_ALTERNATE_2: case PIXEL_FORMAT_16_BIT_ALTERNATE_3: - size = (width * height) >> 3; + image_qword_count = (width * height) >> 3; break; case PIXEL_FORMAT_8_BIT: case PIXEL_FORMAT_8_BIT_ALTERNATE: - size = (width * height) >> 4; + image_qword_count = (width * height) >> 4; break; case PIXEL_FORMAT_4_BIT: case PIXEL_FORMAT_4_BIT_ALTERNATE: case PIXEL_FORMAT_4_BIT_ALTERNATE_2: - size = (width * height) >> 5; + image_qword_count = (width * height) >> 5; break; } - if (size > 0x7fff) { + if (image_qword_count > 0x7fff) { scePrintf("sceGsSetDefLoadImage: too big size\r\n"); return 0; } @@ -61,7 +61,7 @@ s32 sceGsSetDefLoadImage(sceGsLoadImage *image, image->q[7] = 0x52; image->q[8] = 0; image->q[9] = 0x53; - ((struct GifTag *)&image->q[10])->NLOOP = size; + ((struct GifTag *)&image->q[10])->NLOOP = image_qword_count; ((struct GifTag *)&image->q[10])->EOP = 1; ((struct GifTag *)&image->q[10])->FLG = 2; CpuSync(); From 41f6a532439601de459aeae15e3871533b740b1b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:23:40 +0000 Subject: [PATCH 463/657] decomp: clarify names in upload_texture_images count -> texture_image_count: Authoritative source src/world/loaders/upload_texture_images.c (SHA-256 647f49257122d2e98169abecce1cf28c6e337d6fbb24c89aa527b1ed1a11eb40) assigns count to the upload-loop counter i. Retail 0x00203160 tests a1, 0x00203168 saves it in s3, 0x0020327c decrements s3 once per iteration, and 0x00203280 advances the TextureImage descriptor pointer by 0x10; 0x00203288 transfers one image before 0x0020329c repeats. Original Ghidra uses nPageCount for this same loop. initialize_level_runtime supplies header->texCount alongside header + header->texInfo, proving this is the texture image record count. --- src/world/loaders/upload_texture_images.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/world/loaders/upload_texture_images.c b/src/world/loaders/upload_texture_images.c index 85b59c239f..5d0f308fdd 100644 --- a/src/world/loaders/upload_texture_images.c +++ b/src/world/loaders/upload_texture_images.c @@ -21,7 +21,7 @@ extern s32 sceGsExecLoadImage(sceGsLoadImage *img, s32 src); void upload_texture_images(s32 base, s32 count, struct TextureImage *p) __asm__("FUN_00203120"); -void upload_texture_images(s32 pixel_data_base, s32 count, struct TextureImage *texture_image) { +void upload_texture_images(s32 pixel_data_base, s32 texture_image_count, struct TextureImage *texture_image) { sceGsLoadImage img; s32 i; s32 pixel_data_source; @@ -35,8 +35,8 @@ void upload_texture_images(s32 pixel_data_base, s32 count, struct TextureImage * gs_texture_allocation_cursor = gs_texture_allocation_base; gs_texture_allocation_start = gs_texture_allocation_base; - if (count > 0) { - i = count; + if (texture_image_count > 0) { + i = texture_image_count; one = 1; while (i != 0) { size = texture_image->size; From 76305c855e8be2947c5b680f57fa3a4dabde95c9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:26:17 +0000 Subject: [PATCH 464/657] decomp: clarify names in queue_framebuffer_upload count -> chunk_row_count: In the authoritative queue_framebuffer_upload.c snapshot (SHA-256 c58cf27741f3ebd77e8af850b7eea00e3b38b61580b74a094c329025d8071088), count takes remaining from frame_size[0] and is capped at 0x80. Retail 0x001fc5f8..0x001fc614 implements that cap in a0; 0x001fc624/0x001fc630 forms (count<<32)|0x200, stored at 0x001fc698 beside GS TRXREG selector 0x52 at 0x001fc6b4, proving height in rows for a 512-pixel-wide transfer. Retail 0x001fc664..0x001fc668 and 0x001fc6d8 advance source by count<<11 (2048 bytes per row), while 0x001fc634..0x001fc648 advances the destination by count<<3. Thus this unsigned long is the row count of this capped upload chunk. --- .../rendering/frame/queue_framebuffer_upload.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/rendering/frame/queue_framebuffer_upload.c b/src/overlays/shared/rendering/frame/queue_framebuffer_upload.c index 5a174b68b4..e2d6b0bf96 100644 --- a/src/overlays/shared/rendering/frame/queue_framebuffer_upload.c +++ b/src/overlays/shared/rendering/frame/queue_framebuffer_upload.c @@ -16,15 +16,15 @@ void queue_framebuffer_upload(unsigned int source) __asm__("FUN_L00_001fc558"); void queue_framebuffer_upload(unsigned int source) { int remaining = frame_size[0]; int destination = draw_buffer_address >> 8; - unsigned long count; + unsigned long chunk_row_count; unsigned long transfer; unsigned char *packet; unsigned long *words; do { - count = (long)remaining; - if (count > 0x80) - count = 0x80; + chunk_row_count = (long)remaining; + if (chunk_row_count > 0x80) + chunk_row_count = 0x80; *(unsigned int *)(PK + 0) = 0x10000006; remaining -= 0x80; *(unsigned int *)(PK + 4) = 0; @@ -32,7 +32,7 @@ void queue_framebuffer_upload(unsigned int source) { *(unsigned int *)(PK + 12) = 0x50000006; packet = PK; (*(int **)&D_L00_001611C0) = (int *)(packet + 0x10); - transfer = (unsigned long)count << 7; + transfer = (unsigned long)chunk_row_count << 7; words = (unsigned long *)(packet + 0x10); words[0] = 0x4000000000000001UL; words[1] = 0x0eeeeeee; @@ -40,7 +40,7 @@ void queue_framebuffer_upload(unsigned int source) { words[3] = 0x50; words[4] = 0; words[5] = 0x51; - words[6] = ((unsigned long)count << 32) | 0x200; + words[6] = ((unsigned long)chunk_row_count << 32) | 0x200; words[7] = 0x52; words[8] = 0; words[9] = 0x53; @@ -49,8 +49,8 @@ void queue_framebuffer_upload(unsigned int source) { (*(int **)&D_L00_001611C0) = (int *)(packet + 0x70); *(unsigned int *)(packet + 0x70) = (unsigned int)(long)(int)(transfer | 0x30000000); *(unsigned int *)(PK + 4) = source; - source += (int)(count * 0x800); - destination += (int)(count * 8); + source += (int)(chunk_row_count * 0x800); + destination += (int)(chunk_row_count * 8); *(unsigned int *)(PK + 8) = 0; *(unsigned int *)(PK + 12) = (unsigned int)transfer | 0x50000000; (*(int **)&D_L00_001611C0) = (int *)(PK + 0x10); From aa44ffd10d347c75925883d7e8964b4a701c0862 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:26:18 +0000 Subject: [PATCH 465/657] decomp: clarify names in draw_projected_fading_quad size -> radius_scale: Retail 0x0030bfdc loads effect_data[0] into f21; 0x0030bfe0-0x0030bfec caps it at 1.0. At 0x0030c0b0-0x0030c0d8 the base-radius global is shifted left four, converted to float, multiplied by f21, and truncated; the result is added/subtracted from both axes at 0x0030c0dc-0x0030c120. Original decompilation fVar7 and authoritative C size follow this same flow: radius = truncate_float_to_s32((float)(projected_quad_base_radius_gp << 4) * size). This proves a radius scale factor. --- .../shared/rendering/effects/timed_sprite_effect.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/rendering/effects/timed_sprite_effect.c b/src/overlays/shared/rendering/effects/timed_sprite_effect.c index b1a5aa5610..1ea9de2102 100644 --- a/src/overlays/shared/rendering/effects/timed_sprite_effect.c +++ b/src/overlays/shared/rendering/effects/timed_sprite_effect.c @@ -87,7 +87,7 @@ void draw_projected_fading_quad(char *moby) { u32 colors[4]; s32 uvs[4]; float screen[4]; - float size; + float radius_scale; float fade; s32 y, x, radius; s32 raw_x; @@ -97,9 +97,9 @@ void draw_projected_fading_quad(char *moby) { float screen_offset; qcopy(&world_position, &MOBY(moby)->pos); - size = effect_data[0]; - if (1.0f < size) - size = 1.0f; + radius_scale = effect_data[0]; + if (1.0f < radius_scale) + radius_scale = 1.0f; fade = effect_data[0] - 1.0f; if (1.0f < fade) fade = 1.0f; @@ -122,7 +122,7 @@ void draw_projected_fading_quad(char *moby) { colors[2] = color; colors[1] = color; colors[0] = color; - radius = truncate_float_to_s32((float)(projected_quad_base_radius_gp << 4) * size); + radius = truncate_float_to_s32((float)(projected_quad_base_radius_gp << 4) * radius_scale); corners[3] = 0xfffff080008000LL; corners[2] = 0xfffff080008000LL; corners[1] = 0xfffff080008000LL; From d4e72388d485212c2284bd790a0b43a82072c185 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:28:23 +0000 Subject: [PATCH 466/657] decomp: clarify names in test_path_segment_strict_crossing offset -> current_path_point_byte_offset: Authoritative source src/overlays/shared/mobys/test_path_segment_strict_crossing.c (SHA-256 f936ac39dc4b1fc3a70bb198d4c378fe676d943f9cf6834be07a6fa21daee3c9) declares offset once in the assigned function and adds it to (u8 *)*path_slot for fast_vec_sub(current,...,start). Original retail decompilation maps it to iVar2. Retail 0x00261a4c initializes s2 to 0x20; 0x00261a50 loads the path structure pointer and 0x00261a60 adds s2 to address the current point; 0x00261b10 advances s2 by 0x10 alongside point index i. The structure points start at 0x10, so initial 0x20 selects points[1]. Thus this is the current path point's byte offset from the path structure base. --- .../shared/mobys/test_path_segment_strict_crossing.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c index 0479cf2fd0..87db40c67a 100644 --- a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c +++ b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c @@ -36,7 +36,7 @@ s32 test_path_segment_strict_crossing(s32 path_index, OvlVec4 *start, OvlVec4 *e OvlVec4 *current; SegmentPath_261968 **path_slot; s32 i; - s32 offset; + s32 current_path_point_byte_offset; f32 crossing; f32 zero; @@ -55,10 +55,10 @@ s32 test_path_segment_strict_crossing(s32 path_index, OvlVec4 *start, OvlVec4 *e previous = &transformed_previous_point; current = &transformed_current_point; if (i < (*path_slot)->count) { - offset = 0x20; + current_path_point_byte_offset = 0x20; zero = 0.0f; do { - fast_vec_sub(current, (OvlVec4 *)((u8 *)*path_slot + offset), start); + fast_vec_sub(current, (OvlVec4 *)((u8 *)*path_slot + current_path_point_byte_offset), start); transform_vector_by_basis(current, current, &direction); if (transformed_previous_point.f[3] != zero || transformed_current_point.f[3] != zero) { if (transformed_current_point.f[1] * transformed_previous_point.f[1] < 0.0f) { @@ -73,7 +73,7 @@ s32 test_path_segment_strict_crossing(s32 path_index, OvlVec4 *start, OvlVec4 *e } qcopy(previous, current); i++; - offset += 0x10; + current_path_point_byte_offset += 0x10; } while (i < (*path_slot)->count); } return 0; From 75c0cef23966855d2b16d73d1e7c8945ca9ebebc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:28:23 +0000 Subject: [PATCH 467/657] decomp: clarify names in spawn_radially_scattered_moby offset -> direction_velocity_contribution: In the authoritative source, float offset[4] receives fast_vec_normalize(offset, direction, gap * gap * 0.25f * frame_time), then is added to spawned_velocity. Retail 0x002eff28 computes pi minus angular difference; 0x002eff3c sets a0=sp and 0x002eff40 sets a1=s3 (direction); 0x002eff44-0x002eff50 square and scale that magnitude for normalization. At 0x002eff54 a2=sp and 0x002eff58-0x002eff60 add this stack vector to the pvars velocity in s0. Thus it is the direction-derived velocity contribution, not a position offset. --- src/overlays/l09/mobys/asteroid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l09/mobys/asteroid.c b/src/overlays/l09/mobys/asteroid.c index fbf33013ce..931c493ef8 100644 --- a/src/overlays/l09/mobys/asteroid.c +++ b/src/overlays/l09/mobys/asteroid.c @@ -709,7 +709,7 @@ void asteroid_update(struct Moby *asteroid_moby) { char *spawn_radially_scattered_moby( void *unused, float lower_radius, float upper_radius, void *origin, float *direction) { - float offset[4]; + float direction_velocity_contribution[4]; char *moby = (char *)create_moby(0x1A1); if (moby != 0) { float pi = 3.1415927f; @@ -729,8 +729,8 @@ char *spawn_radially_scattered_moby( fast_vec_normalize(spawned_velocity, &MOBY(moby)->pos, difference * speed); } gap = pi - difference; - fast_vec_normalize(offset, direction, gap * gap * 0.25f * frame_time); - fast_vec_add(spawned_velocity, spawned_velocity, offset); + fast_vec_normalize(direction_velocity_contribution, direction, gap * gap * 0.25f * frame_time); + fast_vec_add(spawned_velocity, spawned_velocity, direction_velocity_contribution); *(int *)(spawned_velocity + 8) = 0; fast_vec_add(&MOBY(moby)->pos, &MOBY(moby)->pos, origin); fast_vec_add(&MOBY(moby)->pos, &MOBY(moby)->pos, direction); From 74346cbc622d91ff7cea73c7e92776f35d3634db Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:28:23 +0000 Subject: [PATCH 468/657] decomp: clarify names in _sceSifLoadModuleBuffer size -> argument_byte_count: Rename the sole issued identifier, s32 parameter size, to argument_byte_count. Retail 0x0011cb8c saves a1 in s1; 0x0011cbdc compares it against 0xFD. For the smaller branch, 0x0011ccf0-0x0011ccf4 passes s1 as memcpy's byte count for module_arguments into request offset 0x104, and 0x0011ccfc stores s1 into request word 1. The larger branch copies 0xFC bytes and stores that cap at 0x0011cce8. Original Ghidra names the same parameter argument_size, and the supplied public caller passes arguments_length as argument 2. Thus it counts argument payload bytes, not module image bytes. --- src/sdk/rpc/iop/sce_sif_load_module_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/rpc/iop/sce_sif_load_module_buffer.c b/src/sdk/rpc/iop/sce_sif_load_module_buffer.c index 31b59b6207..00f3f6ec9f 100644 --- a/src/sdk/rpc/iop/sce_sif_load_module_buffer.c +++ b/src/sdk/rpc/iop/sce_sif_load_module_buffer.c @@ -11,7 +11,7 @@ extern u8 D_00158400[]; extern s32 sif_load_module_server_changed() __asm__("func_0011CAE0"); extern s32 memcpy(); #define SIFCMD ((struct SifLoadModuleArgs *)D_00158200) -s32 _sceSifLoadModuleBuffer(s32 iop_address, s32 size, s32 module_arguments, s32 *result_out) { +s32 _sceSifLoadModuleBuffer(s32 iop_address, s32 argument_byte_count, s32 module_arguments, s32 *result_out) { s32 mask; s32 rpc_return_value; @@ -24,7 +24,7 @@ s32 _sceSifLoadModuleBuffer(s32 iop_address, s32 size, s32 module_arguments, s32 } SIFCMD->module_or_result = iop_address; if (module_arguments != 0) { - if (size >= 0xFD) { + if (argument_byte_count >= 0xFD) { memcpy(D_00158200 + 0x104, (void *)module_arguments, 0xFC); SIFCMD->arg_len_or_modres = 0xFC; } else { From 76f125632ce276527b7a2140a69774400ef518b4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:28:23 +0000 Subject: [PATCH 469/657] decomp: clarify names in process_unlock_code_input count -> recorded_input_count: Authoritative C loads count from unlock_code_input_count, uses unlock_code_input_sequence[count++] = direction, writes the incremented count back, and starts matching only when count == 20. Retail 0x002831f0-0x002831f4 loads gp-0x6808 into a0; 0x00283240 doubles the old a0 to address a halfword input slot, 0x0028324c increments a0, 0x00283254 stores it back, 0x0028325c compares it to 20, and 0x00283260 stores the input symbol. Original Ghidra shows the same append and twentieth-entry trigger, proving the number of recorded input symbols. --- .../shared/ui/menus/process_unlock_code_input.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/ui/menus/process_unlock_code_input.c b/src/overlays/shared/ui/menus/process_unlock_code_input.c index affa9de40e..58bc913933 100644 --- a/src/overlays/shared/ui/menus/process_unlock_code_input.c +++ b/src/overlays/shared/ui/menus/process_unlock_code_input.c @@ -46,7 +46,7 @@ void process_unlock_code_input(void) { struct PadState *pad = &controller_state; int staged_candidate_index_limit, candidate_index_limit; int va, vb, vc; - int pressed, direction, count, j, code, index, matched; + int pressed, direction, recorded_input_count, j, code, index, matched; if ((*(long *)&pad->held_unmasked & 0xF) == 6) { pressed = *(s32 *)&pad->pressed_unmasked; if (!(pressed & 0xF0A0)) @@ -64,10 +64,10 @@ void process_unlock_code_input(void) { direction = 3; else direction = (pressed & 0x80) ? 4 : 5; - count = *(int *)&unlock_code_input_count; - unlock_code_input_sequence[count++] = direction; - *(int *)&unlock_code_input_count = count; - if (count != 20) + recorded_input_count = *(int *)&unlock_code_input_count; + unlock_code_input_sequence[recorded_input_count++] = direction; + *(int *)&unlock_code_input_count = recorded_input_count; + if (recorded_input_count != 20) return; code = -1; index = 2; From cf775e7874aa6e9d2fda5686b9d56fb908c3c742 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:28:23 +0000 Subject: [PATCH 470/657] decomp: clarify names in prepare_movie_playback size -> movie_file_size: The authoritative source (src/overlays/shared/cutscenes/update_cutscene_playback.c, SHA-256 0c599e1ddbe76a60ac0050e34fa7677b0f5e13d52a915c9b5db3d3b9d0ea19a9) shows queue_scene_movie_with_game_language, queue_language_zero_movie and queue_movie_with_game_language passing the selected disc_table movie entry's .size as the second s32 argument. Original retail Ghidra has DAT_0016104c = param_2; instructions 0x002995f4 (move s2,a1) and 0x00299648 (sw s2,0x104c(at), with at=0x00160000) prove that argument is saved unchanged at 0x0016104c. Source play_queued_movie passes that saved value as the second argument of play_mpeg_movie, proving movie file size rather than a GS image transfer size. Units are not inferred. --- src/overlays/shared/cutscenes/update_cutscene_playback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/cutscenes/update_cutscene_playback.c b/src/overlays/shared/cutscenes/update_cutscene_playback.c index 543f624e00..8d99d1d98c 100644 --- a/src/overlays/shared/cutscenes/update_cutscene_playback.c +++ b/src/overlays/shared/cutscenes/update_cutscene_playback.c @@ -902,7 +902,7 @@ extern void raise_kernel_trap(void) __asm__("FUN_001f97b0"); extern char mpeg_memory_alloc_error_format[] __asm__("D_L00_001E9480"); /* Sets up a movie load, then uploads image data from the level buffer to GS memory in two runs of strips. */ -void prepare_movie_playback(s32 sector, s32 size, s32 language) { +void prepare_movie_playback(s32 sector, s32 movie_file_size, s32 language) { s32 image[24]; s32 large_count, small_count, gs_address, source, i, j; @@ -911,7 +911,7 @@ void prepare_movie_playback(s32 sector, s32 size, s32 language) { sound_stop_all_sounds(); music_stop(); D_L00_00161048_macro = sector; - D_L00_0016104C_macro = size; + D_L00_0016104C_macro = movie_file_size; D_L00_00161050_macro = language; D_L00_0015F5D8 = 1; fade_to_black(4); From 964823c2b86af2732f3e14ebff776cb79a9e009f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:28:23 +0000 Subject: [PATCH 471/657] decomp: clarify names in draw_beam_barrier_segments offset -> transformed_segment_offset: Authoritative beam_barrier.c SHA-256 1db5f6902a304d4afe59563ca3602f1a7bfe423d42535e5c82db6441e6f3c04e declares offset[4] in draw_beam_barrier_segments. Retail 0x002f6ecc binds s2 to sp+0x2c0; 0x002f6f04-0x002f6f14 transforms the successive local-offset record from 0x001dafd0 using the base matrix at sp into this vector. At 0x002f6f18-0x002f6f28 this same s2 vector is added to moby+0x10 and written to the segment matrix translation. Source transform_vector(offset, offset_src, base_matrix) followed by fast_vec_add(translation, offset, moby+0x10) proves this is the transformed segment offset before entity-position addition. --- src/overlays/l06/mobys/beam_barrier.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l06/mobys/beam_barrier.c b/src/overlays/l06/mobys/beam_barrier.c index 37099c7992..83ad9a2d83 100644 --- a/src/overlays/l06/mobys/beam_barrier.c +++ b/src/overlays/l06/mobys/beam_barrier.c @@ -368,7 +368,7 @@ void draw_beam_barrier_segments(char *moby) { float base_matrix[16]; float yaw_matrix[16]; float segment_matrix[9][16]; - float offset[4]; + float transformed_segment_offset[4]; int beam_segment_draw_params[9]; char *beam_barrier_vars = ((char *)MOBY(moby)->pvars); float *matrix; @@ -406,9 +406,9 @@ void draw_beam_barrier_segments(char *moby) { euler_rotation_matrix(matrix, rotation); rotation += 4; multiply_matrix(matrix, base_matrix, matrix); - transform_vector(offset, offset_src, base_matrix); + transform_vector(transformed_segment_offset, offset_src, base_matrix); offset_src += 4; - fast_vec_add(translation, offset, moby + 0x10); + fast_vec_add(translation, transformed_segment_offset, moby + 0x10); matrix[15] = 1.0f; matrix += 16; translation += 16; From b7df705728ab1cc86a7b5f5f3f6c0b953e13895a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:28:23 +0000 Subject: [PATCH 472/657] decomp: clarify names in emit_timed_spark_particle timer -> emission_countdown: In authoritative emit_timed_spark_particle, short *timer is passed to fast_dec_timer_s16 and a false result returns before spawn_spark. Retail 0x002ea7c0 preserves a1 in s7; 0x002ea868-0x002ea870 passes s7 to the decrement helper and gates the spawn at 0x002ea9a0. After that spawn, 0x002ea9a8-0x002ea9c8 samples the configured reset bounds, truncates the sample and stores it as a short through s7. Caller supplies effect_pvars+8 for the moby position or successive shorts for successive path positions. This is the per-position countdown to the next emission, rather than a particle lifetime. --- src/overlays/l10/mobys/configurable_particle_emitter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l10/mobys/configurable_particle_emitter.c b/src/overlays/l10/mobys/configurable_particle_emitter.c index c81f8c51a5..c41541c992 100644 --- a/src/overlays/l10/mobys/configurable_particle_emitter.c +++ b/src/overlays/l10/mobys/configurable_particle_emitter.c @@ -257,7 +257,7 @@ int l10_timed_spark_second_color_from __asm__("D_L10_00161FF0") = 0x200 int l10_timed_spark_second_color_to __asm__("D_L10_00161FF4") = 0x200080ff; extern void clear_u64_value(void *); -void emit_timed_spark_particle(void *emission_position, short *timer) { +void emit_timed_spark_particle(void *emission_position, short *emission_countdown) { float visibility_sphere[4]; float spark_vertical_vector[4]; float acc[4]; @@ -270,7 +270,7 @@ void emit_timed_spark_particle(void *emission_position, short *timer) { visibility_sphere[3] = 5.0f; if (fast_bsphere_check((char *)visibility_sphere, 32.0f) == -1 && random_integer_below(3) != 0) return; - if (!fast_dec_timer_s16(timer)) + if (!fast_dec_timer_s16(emission_countdown)) return; clear_u64_value(spark_vertical_vector); spark_vertical_vector[2] = timed_spark_vertical_vector_z_scale_gp * frame_time; @@ -302,7 +302,7 @@ void emit_timed_spark_particle(void *emission_position, short *timer) { second_frame_count, third_frame_count, -1); - *timer = truncate_float_to_s32(random_float_between((float)timed_spark_timer_reset_min_gp, + *emission_countdown = truncate_float_to_s32(random_float_between((float)timed_spark_timer_reset_min_gp, (float)timed_spark_timer_reset_max_gp)); } From a548232041050bb49a146cd88fb027a2df857657 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:28:23 +0000 Subject: [PATCH 473/657] decomp: clarify names in draw_group_moby_effect_quads count -> uv_pair_countdown: In the authoritative source count is initialized to 3 in the block copying group_moby_effect_quad_uvs into effect_quad.uv. Retail 0x002a2a0c initializes a1 to 3; 0x002a2a30-0x002a2a50 loads two floats from 0x001ce210, decrements a1 at 0x002a2a34, stores the U/V pair at stack offsets 0x50/0x54 and advances all pointers by eight bytes. The bgez at 0x002a2a4c repeats through four UV pairs, ending at -1. Original Ghidra iVar10 has the same initialization, decrement and signed termination, proving a UV-pair countdown rather than a byte count. --- src/overlays/shared/enemies/hero_seeking_mine.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/hero_seeking_mine.c b/src/overlays/shared/enemies/hero_seeking_mine.c index ccb4552121..2ada28cf58 100644 --- a/src/overlays/shared/enemies/hero_seeking_mine.c +++ b/src/overlays/shared/enemies/hero_seeking_mine.c @@ -211,18 +211,18 @@ void draw_group_moby_effect_quads(unsigned char *moby) { effect_quad.alpha = 0x8000000044LL; effect_quad.clamp = 0; { - int count = 3; + int uv_pair_countdown = 3; float *source = group_moby_effect_quad_uvs; float *v = &effect_quad.uv[0][1]; float *u = &effect_quad.uv[0][0]; do { - count--; + uv_pair_countdown--; *u = source[0]; *v = source[1]; source += 2; u += 2; v += 2; - } while (count >= 0); + } while (uv_pair_countdown >= 0); } group_moby_entry = (unsigned short *)D_L15_001ABE40[MOBY(moby)->group]; do { From 0ab311cce1466a04207b7829256f27dc550898ab Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:30:33 +0000 Subject: [PATCH 474/657] decomp: clarify names in draw_missions_menu2 count -> mission_count: Bound source src/ui/menus/missions/draw_missions_menu2.c SHA-256 f66e221bf76778c08aade854b201b802fee7ac28c7c973bea17e2ffdeca6b06d assigns count the s32 return of collect_mission_ids(0x70000000, &mask, 0, 0). Retail call 0x0021f6d8 stores v0 at sp+0x44 at 0x0021f6e0. The positive-count gate at 0x0021f724-0x0021f728 and loop bound reload/comparison at 0x0021f7f8-0x0021f804 use this value. Each iteration loads one mission ID from s8 for get_help_message_text at 0x0021f784-0x0021f788, advances that cursor four bytes at 0x0021f7f4, and increments the mission index at 0x0021f7f0. Original Ghidra iStack_ac has the same producer and loop-bound uses, proving mission_count. --- src/ui/menus/missions/draw_missions_menu2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/menus/missions/draw_missions_menu2.c b/src/ui/menus/missions/draw_missions_menu2.c index fd9515de01..6ce054d9c1 100644 --- a/src/ui/menus/missions/draw_missions_menu2.c +++ b/src/ui/menus/missions/draw_missions_menu2.c @@ -42,7 +42,7 @@ s32 draw_missions_menu2(struct MissionsMenu *menu) { struct Rect trailing_text_region; struct Rect text_region_settings; s32 mask; - s32 count; + s32 mission_count; s32 i; s32 mission_text_y; s32 flag; @@ -57,11 +57,11 @@ s32 draw_missions_menu2(struct MissionsMenu *menu) { i = 0; mask = 0; setup_gif_paging(0); - count = collect_mission_ids(0x70000000, &mask, 0, 0); + mission_count = collect_mission_ids(0x70000000, &mask, 0, 0); vu1_add_g_sregister(0x42, 0x44); vu1_add_g_sregister(0x47, 0x10B); font_print_large(4, 4, 0x80FFA888, get_help_message_text(0x4F59), -1); - if (i < count) { + if (i < mission_count) { mission_id_cursor = (u32 *)0x70000000; do { y = mission_text_y + 0xA; @@ -90,7 +90,7 @@ s32 draw_missions_menu2(struct MissionsMenu *menu) { draw_menu_selection_marker(9, y, bit); mission_id_cursor++; mission_text_y += step * 16; - } while (i < count); + } while (i < mission_count); } if (mask < 0) { memset(&text_region_settings, 0, 0x18); From 7b8ffa57b150f7691f3f0564f6fa5cbb3b607966 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:32:20 +0000 Subject: [PATCH 475/657] decomp: clarify names in build_vendor_menu_rows count -> stocked_item_count: In the bound source src/overlays/shared/vendor/vendor_menu.c (SHA-256 a1ee24068e55adfdccc7102f9f469988619ed997e81dbc8cf4e8307379a72534), count starts at zero, advances over D_0015EDD0_macro until 0xFF or 12, and bounds for (i = 0; i < count; i++). Original Ghidra iVar7 and retail t1 match this role: 0x0029a418 initializes t1, 0x0029a438-0x0029a458 increments and tests it against 12 and the sentinel, 0x0029a468 skips an empty list, and 0x0029a4b8 compares the stock traversal index against t1. Output row_count is separately reset at 0x0029a46c and incremented only on accepted rows, proving this is the stocked-item entry count rather than the output row count. --- src/overlays/shared/vendor/vendor_menu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/vendor/vendor_menu.c b/src/overlays/shared/vendor/vendor_menu.c index 3f457414d5..cb0251e762 100644 --- a/src/overlays/shared/vendor/vendor_menu.c +++ b/src/overlays/shared/vendor/vendor_menu.c @@ -265,16 +265,16 @@ extern u8 D_0015EDD0_macro[] __asm__("D_0015EDD0") MACRO_ADDR; void build_vendor_menu_rows(s32 skip_unflagged) __asm__("FUN_L00_0029a400"); void build_vendor_menu_rows(s32 skip_unflagged) { - s32 count, i, j, stocked_item_entry, item, k; + s32 stocked_item_count, i, j, stocked_item_entry, item, k; - count = 0; + stocked_item_count = 0; if (D_0015EDD0_macro[0] != 0xFF) { do - count++; - while (count < 12 && D_0015EDD0_macro[count] != 0xFF); + stocked_item_count++; + while (stocked_item_count < 12 && D_0015EDD0_macro[stocked_item_count] != 0xFF); } vendor_menu_lui.row_count = 0; - for (i = 0; i < count; i++) { + for (i = 0; i < stocked_item_count; i++) { stocked_item_entry = D_0015EDD0_macro[i]; if (stocked_item_entry == 0xFF) continue; From ea420c4fe3607c32e57635e7454246ee4b13736b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:32:20 +0000 Subject: [PATCH 476/657] decomp: clarify names in compute_sampled_spline_path_lengths count -> path_node_count: In the authoritative source count = *path->f10. Retail 0x0028bbf0 loads node storage from descriptor +0x10, 0x0028bbf8 loads its leading integer and 0x0028bbfc saves it at sp+0x64 (Ghidra iStack_ec). This bounds the outer node traversal at 0x0028bc64..0x0028bc68 and 0x0028bdc0..0x0028bdd0. Each iteration resolves the next node, samples its Hermite segment and writes length to storage + (index << 4) +0x1c at 0x0028bdd4. The supplied get_path_node/resolve_path_node_index helpers use the same header as the number of path nodes. --- .../shared/rendering/effects/spawn_type_10_particle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/effects/spawn_type_10_particle.c b/src/overlays/shared/rendering/effects/spawn_type_10_particle.c index d1a129db52..034cd63bcc 100644 --- a/src/overlays/shared/rendering/effects/spawn_type_10_particle.c +++ b/src/overlays/shared/rendering/effects/spawn_type_10_particle.c @@ -484,7 +484,7 @@ float compute_sampled_spline_path_lengths( OvlVec4 nextNode; OvlVec4 point; OvlVec4 previousPoint; - int count = *path->f10; + int path_node_count = *path->f10; int savedIndex = *(int *)path; int index; float total = 0.0f; @@ -500,7 +500,7 @@ float compute_sampled_spline_path_lengths( &nextTangent, (int *)path, tangent_tension, tangent_bias, 0); index = 0; - while (index < count) { + while (index < path_node_count) { float segment_parameter; float step; float segmentLength; From e8575815ee9b3021a1af5a3766d0825dc0c11c76 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:33:59 +0000 Subject: [PATCH 477/657] decomp: clarify names in spawn_birdbot_movement_particles size -> target_particle_scalar: Retail 0x002e66f0-0x002e670c loads float bounds 105000.0 and 157500.0 and samples the scalar; 0x002e6714 saves f0 in f20, and 0x002e6730 passes it in f12 to the particle spawn at 0x002e6740. The authoritative C assigns this sample to size and passes it to spawn_effect_particle_with_target_scalar. Supplied callee source names that float target_particle_scalar, stores target_particle_scalar * 0.2f at particle+0xc, and computes (target_particle_scalar - initial scalar) / lifetime_float at particle_data+0x1c, proving its target-scalar role independently of rendering units. --- src/overlays/l01/mobys/birdbot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l01/mobys/birdbot.c b/src/overlays/l01/mobys/birdbot.c index f645e8a915..5148e0b696 100644 --- a/src/overlays/l01/mobys/birdbot.c +++ b/src/overlays/l01/mobys/birdbot.c @@ -67,7 +67,7 @@ void spawn_birdbot_movement_particles(SplashMoby_u *moby, u128 *origin) { Vec4 *bp; u32 *inner_color_entry; u32 *outer_color_entry; - f32 size; + f32 target_particle_scalar; s32 i; previous_moby_position.q = *origin; @@ -86,12 +86,12 @@ void spawn_birdbot_movement_particles(SplashMoby_u *moby, u128 *origin) { fast_vec_add(&world_motion_delta, &world_motion_delta, &rel); inner_color_entry = &inner.c[random_integer_below(6)]; outer_color_entry = &outer.c[random_integer_below(6)]; - size = random_float_between(105000.0f, 157500.0f); + target_particle_scalar = random_float_between(105000.0f, 157500.0f); spawn_effect_particle_with_target_scalar(&vector_scratch, &world_motion_delta, *inner_color_entry, *outer_color_entry, - size, + target_particle_scalar, scale_game_frames(random_int_between(5, 0xF))); } } From 6b772a4bea295e924854c6c69bc7e6a7dbb99ebc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:33:59 +0000 Subject: [PATCH 478/657] decomp: clarify names in destroy_frog_child_moby offset -> debris_spawn_offset: In both source loops offset[0:2] receives random X/Y in [-0.625,0.625] and Z in [0,1.25]. Retail 0x002e9fdc-0x002ea014 and 0x002ea0b4-0x002ea0ec construct this vector at sp+0x30 (original Ghidra uStack_a0/uStack_9c/uStack_98). The lq/sq pairs at 0x002ea024/0x002ea02c and 0x002ea0fc/0x002ea104 copy it into pos at sp+0x20. That copy supplies the velocity direction, then fast_vec_add at 0x002ea038 and 0x002ea110 adds origin at sp, the moby position raised 0.5, before spawn_crate_debris at 0x002ea070/0x002ea14c. This proves offset is the debris spawn displacement relative to origin. --- src/overlays/shared/enemies/frog.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index 8ae0e83c30..3e0c9cb47c 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -834,7 +834,7 @@ void destroy_frog_child_moby(struct Moby *moby) { float origin[4]; float debris_velocity[4]; float pos[4]; - float offset[4]; + float debris_spawn_offset[4]; FrogVars *frog_vars; int i; int j; @@ -845,11 +845,11 @@ void destroy_frog_child_moby(struct Moby *moby) { origin[2] = origin[2] + 0.5f; for (i = 3; i >= 0; i--) { float speed = random_float_between(1.0f, 4.0f) * frame_time; - *(u128 *)offset = 0; - offset[0] = random_float_between(-0.625f, 0.625f); - offset[1] = random_float_between(-0.625f, 0.625f); - offset[2] = random_float_between(0.0f, 1.25f); - *(u128 *)pos = *(u128 *)offset; + *(u128 *)debris_spawn_offset = 0; + debris_spawn_offset[0] = random_float_between(-0.625f, 0.625f); + debris_spawn_offset[1] = random_float_between(-0.625f, 0.625f); + debris_spawn_offset[2] = random_float_between(0.0f, 1.25f); + *(u128 *)pos = *(u128 *)debris_spawn_offset; fast_vec_normalize(debris_velocity, pos, speed); fast_vec_add(pos, pos, origin); spawn_crate_debris( @@ -857,11 +857,11 @@ void destroy_frog_child_moby(struct Moby *moby) { } for (j = 7; j >= 0; j--) { float speed = random_float_between(1.0f, 4.0f) * frame_time; - *(u128 *)offset = 0; - offset[0] = random_float_between(-0.625f, 0.625f); - offset[1] = random_float_between(-0.625f, 0.625f); - offset[2] = random_float_between(0.0f, 1.25f); - *(u128 *)pos = *(u128 *)offset; + *(u128 *)debris_spawn_offset = 0; + debris_spawn_offset[0] = random_float_between(-0.625f, 0.625f); + debris_spawn_offset[1] = random_float_between(-0.625f, 0.625f); + debris_spawn_offset[2] = random_float_between(0.0f, 1.25f); + *(u128 *)pos = *(u128 *)debris_spawn_offset; fast_vec_normalize(debris_velocity, pos, speed); fast_vec_add(pos, pos, origin); spawn_crate_debris(((void *)frog_vars->child), From bc7c7caf5a6ea28a9d1eddab89b42294f8b7418d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:33:59 +0000 Subject: [PATCH 479/657] decomp: clarify names in draw_level09_scrolling_textured_strips count -> strip_entry_count: Retail 0x0021e8d0 saves a1 (original Ghidra param_2) in s6. At 0x0021e9e8 it gates the outer loop; 0x0021e9f4-0x0021ea00 forms list + index*64, and 0x0021eb0c-0x0021eb10 compares that entry index against s6. The separate load at entry+0x1c bounds the inner strip loop. Authoritative C uses count only in for (i = 0; i < count; i++), constructs strip_entry = list + i*64, and caller draw_level09_textured_surfaces passes level09_scrolling_strip_entries with 0x6C, matching its 108-record array. Thus count is the number of strip entries, not vertices or individual strips. --- src/overlays/l09/draw_level09_textured_surfaces.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l09/draw_level09_textured_surfaces.c b/src/overlays/l09/draw_level09_textured_surfaces.c index 9d5d3ccea1..ce7ec4d558 100644 --- a/src/overlays/l09/draw_level09_textured_surfaces.c +++ b/src/overlays/l09/draw_level09_textured_surfaces.c @@ -139,7 +139,7 @@ void draw_level09_scrolling_textured_strips(char *list, void draw_level09_scrolling_textured_strips( - char *list, int count, float unused, long first_texture_index, long second_texture_index) { + char *list, int strip_entry_count, float unused, long first_texture_index, long second_texture_index) { int i; int j; int strip_vertex_index; @@ -160,7 +160,7 @@ void draw_level09_scrolling_textured_strips( for (i = 0; i < 256; i++) { sp[i] = ((i * 0x89) & 0xF) * 0x20200 + 0x80787070; } - for (i = 0; i < count; i++) { + for (i = 0; i < strip_entry_count; i++) { char *strip_entry = list + i * 64; idx = fast_bsphere_check(strip_entry, 256.0f); if (idx == -1) From 872f83b4e0a219e947ca105da7849ac448f69792 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:36:01 +0000 Subject: [PATCH 480/657] decomp: clarify names in path_spark_effect_update count -> nearby_moby_count: Authoritative path_spark_effect.c binds int count to collect_mobies_in_sphere at the spark position and passes it beside nearby_mobys to send_blast_hits. Retail jal 0x001e5ed0 at 0x002dd5dc returns this value in v0; 0x002dd608 moves v0 to a3 while 0x002dd5e8/0x002dd5fc loads nearby_mobys (0x00178380) into a2 for the hit call at 0x002dd624. Original Ghidra likewise passes collector return uVar5 with 0x178380. Supplied checked collector evidence records pointer writes to that array and the returned pointer count at 0x001e6768..0x001e676c. --- src/overlays/l10/mobys/path_spark_effect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l10/mobys/path_spark_effect.c b/src/overlays/l10/mobys/path_spark_effect.c index 0eb4867807..f3b25a6997 100644 --- a/src/overlays/l10/mobys/path_spark_effect.c +++ b/src/overlays/l10/mobys/path_spark_effect.c @@ -76,7 +76,7 @@ void path_spark_effect_update(char *moby) { send_blast_hits(effect_data->blast_source, blast_hit_position, nearby_mobys, - count, + nearby_moby_count, 0, 0x810001, 2, From c168fb50ab80fb9911a40c0ff6d4cd9ea662883f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:36:01 +0000 Subject: [PATCH 481/657] decomp: clarify names in snd_send_iop_command_no_wait size -> payload_byte_count: Retail 0x0012e710 preserves a1 in s1. At 0x0012e8e8 s1 is serialized as the second header halfword; 0x0012e8ec-0x0012e910 tests s1 and copies exactly s1 bytes using lbu/sb and a unit-incremented index. At 0x0012e7bc-0x0012e7ec s1 + 4 is independently aligned for buffer consumption, proving s1 excludes header/padding. Original Ghidra names this argument nPayloadBytes. The supplied snd_play_vag_stream_by_loc_ex_cb caller passes 0x1C with its seven-s32 payload. --- src/audio/rpc/snd_send_iop_command_no_wait.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/audio/rpc/snd_send_iop_command_no_wait.c b/src/audio/rpc/snd_send_iop_command_no_wait.c index 970c2c6312..b3b6d20ee7 100644 --- a/src/audio/rpc/snd_send_iop_command_no_wait.c +++ b/src/audio/rpc/snd_send_iop_command_no_wait.c @@ -25,7 +25,7 @@ void snd_send_iop_command_no_wait(s32 cmd, s32 size, u8 *data, s32 cb, s64 cb_da extern s32 snd_batches_held __asm__("D_0015ECC4") __attribute__((sda)); -void snd_send_iop_command_no_wait(s32 cmd, s32 size, u8 *data, s32 cb, s64 cb_data) { +void snd_send_iop_command_no_wait(s32 cmd, s32 payload_byte_count, u8 *data, s32 cb, s64 cb_data) { s32 need; s32 tries; s32 held; @@ -33,7 +33,7 @@ void snd_send_iop_command_no_wait(s32 cmd, s32 size, u8 *data, s32 cb, s64 cb_da u8 *command_write_cursor; held = 0; - if (snd_batches_held == 0 && snd_current_buffer == 0 && size == 0 && cb == 0) { + if (snd_batches_held == 0 && snd_current_buffer == 0 && payload_byte_count == 0 && cb == 0) { snd_prepare_return_buffer(snd_sync_buffer, 1); while (SceSifCheckStatRpc(sound_command_client) != 0) { Printf(snd_non_idle_error_string); @@ -43,7 +43,7 @@ void snd_send_iop_command_no_wait(s32 cmd, s32 size, u8 *data, s32 cb, s64 cb_da sceSifCallRpc(sound_command_client, cmd, 1, 0, 0, snd_sync_buffer, 0xC, 0, 0); return; } - need = size + 4; + need = payload_byte_count + 4; tries = 0; if (need % 4 != 0) { need += 4 - need % 4; @@ -73,9 +73,9 @@ void snd_send_iop_command_no_wait(s32 cmd, s32 size, u8 *data, s32 cb, s64 cb_da (snd_batch_free_bytes[snd_batch_index] - 0x1000); *(s16 *)command_write_cursor = cmd; command_write_cursor += 2; - *(s16 *)command_write_cursor = size; + *(s16 *)command_write_cursor = payload_byte_count; command_write_cursor += 2; - for (i = 0; i < size; i++) { + for (i = 0; i < payload_byte_count; i++) { command_write_cursor[i] = data[i]; } snd_batch_free_bytes[snd_batch_index] -= need; From 3455c079090ff5882acf40799bf0d01d1b02e3f7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:36:01 +0000 Subject: [PATCH 482/657] decomp: clarify names in draw_map_screen_layers size -> screen_inset: In source SHA-256 239e0d972102cec31b562a344e5f51a310edbbead9fe39b9369311f6f5a985f2, s32 size receives map_layer_screen_insets[loaded_map_index]. Retail 0x002209d0-0x002209e4 indexes table 0x001DDF68 and loads s1 (Ghidra x_min). 0x00220a38/0x00220a64, 0x00220a84/0x00220a8c and 0x00220ac0/0x00220ac8 pass s1 as both screen coordinates of tex0/tex1/tex2. 0x00220a00 doubles it; 0x00220a50/0x00220a54, 0x00220a9c/0x00220aa0 and 0x00220ad8/0x00220ae0 subtract that doubled amount from the target width and height shifted left four. This proves a shared screen inset rather than a generic size. --- src/ui/map/draw_map_screen_layers.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ui/map/draw_map_screen_layers.c b/src/ui/map/draw_map_screen_layers.c index f94707867e..9ca85f9fb5 100644 --- a/src/ui/map/draw_map_screen_layers.c +++ b/src/ui/map/draw_map_screen_layers.c @@ -14,7 +14,7 @@ s32 draw_map_screen_layers(void) __asm__("FUN_00220850"); s32 draw_map_screen_layers(void) { s32 loaded_map_index = level_map_selection.loaded; - s32 size; + s32 screen_inset; s32 screen_extent_reduction; s32 map_adjusted_frame_count; s32 ph; @@ -62,15 +62,15 @@ s32 draw_map_screen_layers(void) { } } else { map_adjusted_frame_count = game_frame_counter + loaded_map_index * 0x2AB; - size = map_layer_screen_insets[loaded_map_index]; - screen_extent_reduction = size * 2; + screen_inset = map_layer_screen_insets[loaded_map_index]; + screen_extent_reduction = screen_inset * 2; ph = map_adjusted_frame_count % 0x800; vu1_add_g_sregister(0x47, 0); vu1_add_g_sregister(8, 0); append_power_of_two_textured_screen_sprite( level_map_selection.tex0, - size, - size, + screen_inset, + screen_inset, 7, 7, (fs_aa_buffer.target_width << 4) - screen_extent_reduction, @@ -82,8 +82,8 @@ s32 draw_map_screen_layers(void) { vu1_add_g_sregister(8, 5); append_power_of_two_textured_screen_sprite( level_map_selection.tex1, - size, - size, + screen_inset, + screen_inset, 7, 7, (fs_aa_buffer.target_width << 4) - screen_extent_reduction, @@ -93,8 +93,8 @@ s32 draw_map_screen_layers(void) { 0x80); append_power_of_two_textured_screen_sprite( level_map_selection.tex2, - size, - size, + screen_inset, + screen_inset, 7, 7, (fs_aa_buffer.target_width << 4) - screen_extent_reduction, From ca70f7fb6c9abf8db0b6e50dab3ccdbcbcbb4bce Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:36:01 +0000 Subject: [PATCH 483/657] decomp: clarify names in nanotech_upgrade_vendor_update timer -> purchase_cooldown_base: Bound source src/overlays/l10/mobys/nanotech_upgrade_vendor.c SHA-256 4f822f9457bf1064857058ff036a861012fcfe2bbc89145e0cc9b16c6190a946 assigns this int * from moby->pvars. Original retail iVar1 and lw s0,0x78(s1) at 0x002e8374 identify that storage base; 0x002e8378-0x002e837c passes base+4 to fast_dec_timer. Loads at 0x002e8410 and 0x002e84c4 require the +4 word to be zero before purchase. After saving and queueing the purchase message, 0x002e8588-0x002e8594 scales 0xf0 game frames and stores the result at base+4, then 0x002e8598 restores READY. Thus the pointer is the base for purchase-cooldown storage, accessed as [1], rather than the timer scalar itself. --- src/overlays/l10/mobys/nanotech_upgrade_vendor.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l10/mobys/nanotech_upgrade_vendor.c b/src/overlays/l10/mobys/nanotech_upgrade_vendor.c index 6f21d883a8..9111897e52 100644 --- a/src/overlays/l10/mobys/nanotech_upgrade_vendor.c +++ b/src/overlays/l10/mobys/nanotech_upgrade_vendor.c @@ -36,13 +36,13 @@ void nanotech_upgrade_vendor_update(struct Moby *moby) { NANOTECH_VENDOR_STATE_READY = 0, NANOTECH_VENDOR_STATE_FINALIZE_PURCHASE = 1 }; - int *timer; + int *purchase_cooldown_base; float angle; int purchase; int upgrade_level; - timer = (int *)moby->pvars; - fast_dec_timer(timer + 1); + purchase_cooldown_base = (int *)moby->pvars; + fast_dec_timer(purchase_cooldown_base + 1); if (moby->state != NANOTECH_VENDOR_STATE_READY) { if (moby->state == NANOTECH_VENDOR_STATE_FINALIZE_PURCHASE) goto state_one; @@ -52,7 +52,7 @@ void nanotech_upgrade_vendor_update(struct Moby *moby) { angle = fast_arc_tan(hero.motion.pos.f[0] - moby->pos.x, hero.motion.pos.f[1] - moby->pos.y); if (fast_difference_between_rotations(moby->rot.z, angle) < 1.5707964f && - vector_distance_xy(&moby->pos, hero.motion.pos.f) < 4.0f && timer[1] == 0 && + vector_distance_xy(&moby->pos, hero.motion.pos.f) < 4.0f && purchase_cooldown_base[1] == 0 && D_L10_0015F5C4_vendor != 2) { set_moby_dialogue_record_value(moby, 1); if (alternate_item_available[4] == 0) { @@ -74,7 +74,7 @@ void nanotech_upgrade_vendor_update(struct Moby *moby) { return; } } else { - if (alternate_item_available[5] != 0 || timer[1] != 0) + if (alternate_item_available[5] != 0 || purchase_cooldown_base[1] != 0) return; if (current_bolt_count >= 30001) { int accepted = try_set_help_message(1, 0x271f) != 0; @@ -113,7 +113,7 @@ void nanotech_upgrade_vendor_update(struct Moby *moby) { } queue_dialogue_message(purchase, -1); D_L10_0013F640 = 0xb4; - timer[1] = scale_game_frames(0xf0); + purchase_cooldown_base[1] = scale_game_frames(0xf0); moby->state = NANOTECH_VENDOR_STATE_READY; } } From 409b1c57043e9d6cff12b48e4a8d96a011d7b36a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:37:49 +0000 Subject: [PATCH 484/657] decomp: clarify names in cutscene_set_camera_target count -> spawn_attempt_countdown: In cutscene_set_camera_target, the sole s32 count is set to 1 and 4 before the two do/while spawn_puff loops, decremented regardless of spawn success, and tested >= 0. Retail initializes s2 at 0x0026390c and 0x00263a18, decrements it at 0x00263984 and 0x00263a50/0x00263a80, and uses bgez at 0x00263988 and 0x00263a84. Original Ghidra iVar6 has the same inclusive countdown, proving two and five spawn attempts rather than successful effect counts. size -> position_jitter_scale: The sole f32 size is fraction*0.02+0.01 or fraction*0.015000001+0.01 and reaches f12 via f21 at 0x00263944 and 0x00263a24 before spawn calls 0x00263954/0x00263a40. Checked level-00 helper 0x0026d000 saves incoming f12 in f21 at 0x0026d044, then passes it with zero to random helper 0x00257c48 at 0x0026d0bc/0x0026d0d4/0x0026d0ec and adds the results to copied spawn-position components at particle+0x10/+0x14/+0x18 through 0x0026d104. Supplied helper source names this input position_jitter_scale; f15 is independently stored at particle+0x0c. Thus this local controls position jitter. --- .../mobys/select_auto_aim_target_moby.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/shared/mobys/select_auto_aim_target_moby.c b/src/overlays/shared/mobys/select_auto_aim_target_moby.c index e2771fd265..b982defb89 100644 --- a/src/overlays/shared/mobys/select_auto_aim_target_moby.c +++ b/src/overlays/shared/mobys/select_auto_aim_target_moby.c @@ -254,8 +254,8 @@ void cutscene_set_camera_target(u8 *moby) { Vec4_2634f8 vectors[4]; Vec4_2634f8 effect_spawn_position; Vec4_2634f8 scaled; - f32 fraction, size, lifetime, scale; - s32 count; + f32 fraction, position_jitter_scale, lifetime, scale; + s32 spawn_attempt_countdown; s32 w24; Effect *effect; if (MOBY(moby)->oclass == 0x2ee && moby != 0) { @@ -267,19 +267,19 @@ void cutscene_set_camera_target(u8 *moby) { s32 b2A; scale = fraction * -0.025f + -0.025f; lifetime = fraction * 44000.0f + 6000.0f; - size = fraction * 0.02f + 0.01f; + position_jitter_scale = fraction * 0.02f + 0.01f; w24 = 2; fast_vec_normalize(&scaled, &vectors[2], scale); fast_vec_add(&effect_spawn_position, &vectors[3], &scaled); b2A = 0x50; - count = 1; + spawn_attempt_countdown = 1; do { s32 signed_random_value; signed_random_value = random_integer_below(0x10); if (random_integer_below(2) != 0) signed_random_value = -signed_random_value; effect = spawn_puff(&effect_spawn_position, - size, + position_jitter_scale, 1.0f, 0.75f, signed_random_value, @@ -293,22 +293,22 @@ void cutscene_set_camera_target(u8 *moby) { tail->b2A = b2A; tail->initial_frame_count = effect->hA; } - count--; - } while (count >= 0); + spawn_attempt_countdown--; + } while (spawn_attempt_countdown >= 0); } { s32 b2A; scale = fraction * -0.015000001f + -0.01f; lifetime = fraction * 25000.0f + 5000.0f; - size = fraction * 0.015000001f + 0.01f; + position_jitter_scale = fraction * 0.015000001f + 0.01f; w24 = 2; b2A = 0x7f; fast_vec_normalize(&scaled, &vectors[2], scale); fast_vec_add(&effect_spawn_position, &vectors[3], &scaled); - count = 4; + spawn_attempt_countdown = 4; do { effect = spawn_puff(&effect_spawn_position, - size, + position_jitter_scale, 1.0f, 1.0f, 0x10, @@ -323,8 +323,8 @@ void cutscene_set_camera_target(u8 *moby) { tail->b2A = b2A; tail->initial_frame_count = effect->hA; } - count--; - } while (count >= 0); + spawn_attempt_countdown--; + } while (spawn_attempt_countdown >= 0); } } } From 43ead933ef2ed95bb39bb5b24d43b18d402cc94c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:37:49 +0000 Subject: [PATCH 485/657] decomp: clarify names in update_oscillating_target_link_strips count -> interior_point_index: Retail 0x00302da0 initializes s6 to 1, 0x00302da4..0x00302dac bounds it below strip_point_count-1, and 0x00302de0 increments it once per smoothed delta. Source count selects intermediate_storage[count-1], [count], and [count+1]; retail 0x00302dd0..0x00302e14 sums these neighboring vectors and scales by 0.333f into the delta array at strip*0x460+0x1190. The alternate branch at 0x00302e74..0x00302ea8 applies that first delta to point 1 and subsequent deltas to successive interior points. Thus count is an interior point index, not a quantity. --- src/overlays/l12/mobys/oscillating_target_link.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l12/mobys/oscillating_target_link.c b/src/overlays/l12/mobys/oscillating_target_link.c index 757bc79f9c..cbafe191de 100644 --- a/src/overlays/l12/mobys/oscillating_target_link.c +++ b/src/overlays/l12/mobys/oscillating_target_link.c @@ -166,7 +166,7 @@ void update_oscillating_target_link_strips(struct Moby *moby) { if (cycle > 1.0f) oscillating_link_strip_scroll_phase_gp = cycle - 1.0f; for (strip = 0; strip < 4; strip++) { - int count; + int interior_point_index; int i; float *points; float *intermediate; @@ -195,17 +195,17 @@ void update_oscillating_target_link_strips(struct Moby *moby) { i++; } while (i < oscillating_link_strip_state->strip_point_count); } - count = 1; - if (count < oscillating_link_strip_state->strip_point_count - 1) { + interior_point_index = 1; + if (interior_point_index < oscillating_link_strip_state->strip_point_count - 1) { points = (float *)((char *)oscillating_link_strip_state + strip * 0x460 + 0x1190); do { fast_vec_add( - points, intermediate_storage[count - 1], intermediate_storage[count]); - fast_vec_add(points, points, intermediate_storage[count + 1]); + points, intermediate_storage[interior_point_index - 1], intermediate_storage[interior_point_index]); + fast_vec_add(points, points, intermediate_storage[interior_point_index + 1]); fast_vec_scale(points, points, 0.333f); - count++; + interior_point_index++; points += 4; - } while (count < oscillating_link_strip_state->strip_point_count - 1); + } while (interior_point_index < oscillating_link_strip_state->strip_point_count - 1); } *(int *)(timers + (strip << 2)) = oscillating_link_strip_reset_ticks; } else { From 947b2b8f86ce540f2035f0a4e3f24707e03db347 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:39:39 +0000 Subject: [PATCH 486/657] decomp: clarify names in sceMpegDemuxPssRing size -> available_bytes: In the authoritative sceMpegDemuxPssRing C snapshot (SHA-256 280add52f9c021c7789e9f8d8a1d90bdf54b67a5a5b91da3fe704a45d0e0f898), size is the third parameter and every use compares bitstream->pos against size * 8. Retail 0x0012ac04 saves a2 in s0; 0x0012ac48/0x0012aca0 shifts it left three into s6, which bounds the bit position at 0x0012ae50-0x0012ae58 and 0x0012ae70-0x0012ae78. Original Ghidra param_3 becomes uVar9=(param_3<<3) for these comparisons. Caller read_mpeg at the supplied 0x0023a60c call passes avail from read_buf_begin_get as this third argument, while passing read_buf->size separately as ring capacity. This proves available input bytes. --- src/sdk/mpeg/api/sce_mpeg_demux_pss_ring.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/mpeg/api/sce_mpeg_demux_pss_ring.c b/src/sdk/mpeg/api/sce_mpeg_demux_pss_ring.c index c521456d21..fa02230ba7 100644 --- a/src/sdk/mpeg/api/sce_mpeg_demux_pss_ring.c +++ b/src/sdk/mpeg/api/sce_mpeg_demux_pss_ring.c @@ -68,7 +68,7 @@ typedef struct { extern void _sysbitInit(SysBit *bs, u8 *start, u8 *bufstart, s32 bufsize); extern u8 *GetSysbitPointer(SysBit *bs, s32 pos); -int sceMpegDemuxPssRing(sceMpeg *mp, u8 *start, int size, u8 *bufstart, int bufsize) { +int sceMpegDemuxPssRing(sceMpeg *mp, u8 *start, int available_bytes, u8 *bufstart, int bufsize) { enum { MPEG_CALLBACK_PES_PACKET = 6 }; @@ -111,9 +111,9 @@ int sceMpegDemuxPssRing(sceMpeg *mp, u8 *start, int size, u8 *bufstart, int bufs _pack_header(bitstream, &pss_header->pack); } while (peek_bits(bitstream, 24) == 1 && peek_bits(bitstream, 32) != 0x1BA && - peek_bits(bitstream, 32) != 0x1B9 && bitstream->pos < size * 8 && cont) { + peek_bits(bitstream, 32) != 0x1B9 && bitstream->pos < available_bytes * 8 && cont) { _PES_packet(sys, bitstream, &pss_header->pes); - if (bitstream->pos > size * 8) { + if (bitstream->pos > available_bytes * 8) { continue; } for (i = 0; i < sys->n; i++) { @@ -143,7 +143,7 @@ int sceMpegDemuxPssRing(sceMpeg *mp, u8 *start, int size, u8 *bufstart, int bufs consumed_bytes = bitstream->pos >> 3; } } - if (bitstream->pos > size * 8 || peek_bits(bitstream, 32) != 0x1BA) { + if (bitstream->pos > available_bytes * 8 || peek_bits(bitstream, 32) != 0x1BA) { break; } } From 6796784467247d5e36670ad056002134fda05be2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:41:33 +0000 Subject: [PATCH 487/657] decomp: clarify names in update_ammo_preview_transform offset -> preview_position_offset: In the bound source, offset[0:2] receives cos(orbit_angle), sin(orbit_angle), and sin(bob_angle)*0.25+0.5+ammo_preview_offsets[slot]. Retail 0x002253A0-0x00225400 stores these components at sp+0/+4/+8 and transforms that same vector in place through source_moby->basis (s1+0xC0). At 0x00225404-0x00225410 it is the third argument to fast_vec_add, adding the displacement to moby->position, previously copied from source_moby at 0x002251C8-0x002251D4. Thus it is the preview position offset from the source Moby. --- .../item_preview/update_ammo_preview_transform.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ui/menus/item_preview/update_ammo_preview_transform.c b/src/ui/menus/item_preview/update_ammo_preview_transform.c index 77df5bd08a..3cfdb0a76d 100644 --- a/src/ui/menus/item_preview/update_ammo_preview_transform.c +++ b/src/ui/menus/item_preview/update_ammo_preview_transform.c @@ -58,7 +58,7 @@ void update_ammo_preview_transform(struct AmmoPreviewMoby *moby) __asm__("FUN_00 /* The hand-gadget loader installs this callback on its ammo preview Mobys. The slot selects a phase and a spring offset around the source Moby. */ void update_ammo_preview_transform(struct AmmoPreviewMoby *moby) { - f32 offset[4]; + f32 preview_position_offset[4]; f32 rotation_basis[12]; f32 angles[4]; struct AmmoPreviewMoby *source_moby; @@ -103,12 +103,12 @@ void update_ammo_preview_transform(struct AmmoPreviewMoby *moby) { frame_time_sq * 6.0f, frame_time * 6.0f); } - offset[0] = fast_cos(orbit_angle); - offset[1] = fast_sin(orbit_angle); - offset[2] = zero; - offset[2] = fast_sin(bob_angle) * 0.25f + 0.5f + ammo_preview_offsets[moby->slot]; - transform_vector_by_basis(offset, offset, source_moby->basis); - fast_vec_add(moby->position, moby->position, offset); + preview_position_offset[0] = fast_cos(orbit_angle); + preview_position_offset[1] = fast_sin(orbit_angle); + preview_position_offset[2] = zero; + preview_position_offset[2] = fast_sin(bob_angle) * 0.25f + 0.5f + ammo_preview_offsets[moby->slot]; + transform_vector_by_basis(preview_position_offset, preview_position_offset, source_moby->basis); + fast_vec_add(moby->position, moby->position, preview_position_offset); clear_u64_value(angles); angles[2] = fast_add_rotations(orbit_angle, 1.5707964f); euler_rotation_basis(rotation_basis, angles); From a423a1bb98d346b4b2f22d36dc0d57c62e737fcf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:41:33 +0000 Subject: [PATCH 488/657] decomp: clarify names in process_bgm_display_text_event size -> glyph_quad_size: In source src/audio/music/process_bgm_display_text_event.c (SHA-256 66623f195ec66923cae3c7add6b127c7ec3f3fa6c7e932675b288cbc87d8dab0), size = scale * 16.0f and size supplies both dimensions of the additional and ordinary glyph rectangles. Original Ghidra fVar9 = param_3 * 16.0 has the same uses. Retail 0x001f66b4-0x001f66c4 computes f24 = f21 * 16.0; 0x001f679c-0x001f67a0 and 0x001f687c-0x001f6884 copy f24 into both f14/f15 for emit_textured_rectangle, with 16-by-16 texture extents at 0x001f67a8/0x001f67ac and 0x001f688c/0x001f6894. Thus this is the scaled glyph quad side length. --- src/audio/music/process_bgm_display_text_event.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/audio/music/process_bgm_display_text_event.c b/src/audio/music/process_bgm_display_text_event.c index 09c3257c2d..45bb807143 100644 --- a/src/audio/music/process_bgm_display_text_event.c +++ b/src/audio/music/process_bgm_display_text_event.c @@ -34,7 +34,7 @@ void process_bgm_display_text_event(u64 color, f32 scale) { u8 *text_cursor; s32 i; - f32 size; + f32 glyph_quad_size; f32 top; f32 dx; f32 dy; @@ -45,7 +45,7 @@ void process_bgm_display_text_event(u64 color, if (font_window_active == 0) { font_palette_colors[0] = color; } - size = scale * 16.0f; + glyph_quad_size = scale * 16.0f; i = 0; if (byte_limit == 0 || *str == 0) { return; @@ -66,8 +66,8 @@ void process_bgm_display_text_event(u64 color, dy = convert_integer_to_float(additional_glyph->top) * scale; emit_textured_rectangle(x + dx, y + dy, - size, - size, + glyph_quad_size, + glyph_quad_size, additional_glyph->u, additional_glyph->v, 16, @@ -94,8 +94,8 @@ void process_bgm_display_text_event(u64 color, } else if (*text_cursor > 0x20) { emit_textured_rectangle(x, y + top, - size, - size, + glyph_quad_size, + glyph_quad_size, glyph_table[*text_cursor].u, glyph_table[*text_cursor].v, 16, From b79daa793921c154858153fb755716c19dafe6e6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:43:21 +0000 Subject: [PATCH 489/657] decomp: clarify names in path_8808 offset -> path_vertex_byte_offset: In the bound C path_8808, offset starts at 0x20 and is added to the char-cast SegmentPath pointer for fast_vec_sub's current vertex input, then advances by 0x10 with i. Retail 0x00261c48 initializes s2 to 0x20; 0x00261c50 loads the selected path record and 0x00261c60 adds s2 to it for the subtraction call. 0x00261d18 advances s2 by 0x10 per vertex. Original Ghidra iVar2 has the identical initialization, path-base addition and stride. SegmentPath has a 0x10-byte header and 16-byte vertices, proving this is the current path vertex's byte offset from the path record base. --- .../shared/mobys/test_path_segment_strict_crossing.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c index 87db40c67a..d9b4fb169a 100644 --- a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c +++ b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c @@ -120,7 +120,7 @@ int path_8808(int segment_path_index, float zero; int found = 0; int i = 1; - int offset; + int path_vertex_byte_offset; float *previous_path_point_slot; float *current_path_point_slot; fast_vec_sub(v, segment_end, segment_start); @@ -139,12 +139,12 @@ int path_8808(int segment_path_index, previous_path_point_slot = previous_path_point_in_basis; current_path_point_slot = u; if (i < ((SegmentPath **)D_L00_001B04B0_261968)[segment_path_index]->count) { - offset = 0x20; + path_vertex_byte_offset = 0x20; zero = 0.0f; do { fast_vec_sub(current_path_point_slot, (char *)((SegmentPath **)D_L00_001B04B0_261968)[segment_path_index] + - offset, + path_vertex_byte_offset, segment_start); transform_vector_by_basis(current_path_point_slot, current_path_point_slot, v); if (previous_path_point_in_basis[3] != zero || u[3] != zero) { @@ -163,7 +163,7 @@ int path_8808(int segment_path_index, qcopy(previous_path_point_slot, current_path_point_slot); next: i++; - offset += 0x10; + path_vertex_byte_offset += 0x10; } while (i < ((SegmentPath **)D_L00_001B04B0_261968)[segment_path_index]->count); } lerp_vector(adjusted_endpoint, segment_start, segment_end, best); From 34a856d23ab93c311e0c0df6d27ef00728c26a33 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:43:22 +0000 Subject: [PATCH 490/657] decomp: clarify names in load_level_zero_preserving_progress count -> saved_alternate_animation_sequence: The authoritative source declares u32 count, assigns alternate_animation_sequence before load_and_initialize_level_chunk(), and writes count + 1 back afterward. Retail 0x00226bfc-0x00226c00 loads 0x0015ee20 into s5 before the call at 0x00226c18; 0x00226c84 computes s5 + 1 and 0x00226d5c-0x00226d60 stores it to 0x0015ee20. Original Ghidra agrees via iVar4 = DAT_0015ee20 and DAT_0015ee20 = iVar4 + 1. --- src/game/load_level_zero_preserving_progress.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/load_level_zero_preserving_progress.c b/src/game/load_level_zero_preserving_progress.c index 062e46c237..dd9230c4ce 100644 --- a/src/game/load_level_zero_preserving_progress.c +++ b/src/game/load_level_zero_preserving_progress.c @@ -49,7 +49,7 @@ void load_level_zero_preserving_progress(s32 slot) __asm__("FUN_00226b08"); void load_level_zero_preserving_progress(s32 slot) { s32 saved; - u32 count; + u32 saved_alternate_animation_sequence; u8 flag4; u8 flag5; s32 *items = (s32 *)0x70000150; @@ -65,7 +65,7 @@ void load_level_zero_preserving_progress(s32 slot) { copy_memory_aligned((void *)0x70000170, D_0015EDD0_macro, 0xC); copy_memory_aligned((void *)0x70000180, item_unlocked, 0x20); saved = current_bolt_count; - count = alternate_animation_sequence; + saved_alternate_animation_sequence = alternate_animation_sequence; flag4 = alternate_item_available[4] != 0; flag5 = alternate_item_available[5] != 0; bytes = (u8 *)0x70000030; @@ -92,7 +92,7 @@ void load_level_zero_preserving_progress(s32 slot) { alternate_item_available[5] = 1; hero_max_health = 8; } - alternate_animation_sequence = count + 1; + alternate_animation_sequence = saved_alternate_animation_sequence + 1; D_0015EE1C = 0; D_0015EE1D = 0; sceCdReadClock(D_0015EE98); From 2687c8c317e41a770fdff83f9923bbdec594f234 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:43:22 +0000 Subject: [PATCH 491/657] decomp: clarify names in place_metropolis_train offset -> placement_offset_or_attachment_position: Reviewed the entire issued inventory (sole local offset). Rename offset to placement_offset_or_attachment_position. The authoritative source declares one float[4] binding. Retail 0x00292600..0x0029263c writes heading cosine/sine times negative locomotive pvars+0xDC into sp+0x10 and adds that displacement to the supplied start to position the locomotive. At 0x00292694..0x002926cc the same array receives the heading displacement from pvars+0xBC and is converted in place to an attachment position by adding locomotive position. Retail 0x00292738..0x00292754 uses sp+0x10 as the anchor for the carriage-spacing displacement. At 0x002927e8..0x002927fc moby_point_position(car, 1, sp+0x10) replaces it with the current carriage attachment position for the next iteration. Original Ghidra fStack_110/fStack_10c/uStack_108 follows this same flow. The same-file motion updater corroborates attachment-point chaining. The combined name preserves the array's distinct displacement and absolute-position phases. --- .../l03/mobys/metropolis_train_locomotive.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l03/mobys/metropolis_train_locomotive.c b/src/overlays/l03/mobys/metropolis_train_locomotive.c index f79630edbd..8e9ad58465 100644 --- a/src/overlays/l03/mobys/metropolis_train_locomotive.c +++ b/src/overlays/l03/mobys/metropolis_train_locomotive.c @@ -38,7 +38,7 @@ void place_metropolis_train(struct Moby *moby, void place_metropolis_train(struct Moby *moby, float *pos, float heading) { float start[4]; - float offset[4]; + float placement_offset_or_attachment_position[4]; float delta[4]; float old_pos[4]; float old_rot[4]; @@ -54,20 +54,20 @@ void place_metropolis_train(struct Moby *moby, float *pos, float heading) { *(OvlQuad *)old_pos = *(OvlQuad *)&moby->pos; *(OvlQuad *)old_rot = *(OvlQuad *)&moby->rot; qcopy(coupling + 0x10, start); - offset[0] = fast_cos(heading) * -*(float *)(locomotive_data + 0xDC); - offset[1] = fast_sin(heading) * -*(float *)(locomotive_data + 0xDC); - offset[2] = 0.0f; - fast_vec_add(&moby->pos, start, offset); + placement_offset_or_attachment_position[0] = fast_cos(heading) * -*(float *)(locomotive_data + 0xDC); + placement_offset_or_attachment_position[1] = fast_sin(heading) * -*(float *)(locomotive_data + 0xDC); + placement_offset_or_attachment_position[2] = 0.0f; + fast_vec_add(&moby->pos, start, placement_offset_or_attachment_position); moby->rot.z = fast_add_rotations(heading, 3.1415927f); moby->rot.y = 0.0f; fast_vec_sub(delta, &moby->pos, old_pos); update_entity_matrix(locomotive_data + 0x60, delta, old_rot, &moby->rot); *(int *)(locomotive_data + 0xCC) = 0; *(int *)(locomotive_data + 0xD0) = 0; - offset[0] = fast_cos(heading) * -*(float *)(locomotive_data + 0xBC); - offset[1] = fast_sin(heading) * -*(float *)(locomotive_data + 0xBC); - offset[2] = 0.0f; - fast_vec_add(offset, offset, &moby->pos); + placement_offset_or_attachment_position[0] = fast_cos(heading) * -*(float *)(locomotive_data + 0xBC); + placement_offset_or_attachment_position[1] = fast_sin(heading) * -*(float *)(locomotive_data + 0xBC); + placement_offset_or_attachment_position[2] = 0.0f; + fast_vec_add(placement_offset_or_attachment_position, placement_offset_or_attachment_position, &moby->pos); while (next_id != -1) { char *car = D_L03_0015FFD8 + (next_id << 8); char *car_data = *(char **)(car + 0x78); @@ -76,7 +76,7 @@ void place_metropolis_train(struct Moby *moby, float *pos, float heading) { car_pos[0] = fast_cos(heading) * -*(float *)&metropolis_train_carriage_spacing; car_pos[1] = fast_sin(heading) * -*(float *)&metropolis_train_carriage_spacing; car_pos[2] = 0.0f; - fast_vec_add(car_pos, car_pos, offset); + fast_vec_add(car_pos, car_pos, placement_offset_or_attachment_position); car_off[0] = fast_cos(heading) * -*(float *)(car_data + 0xC4); car_off[1] = fast_sin(heading) * -*(float *)(car_data + 0xC4); car_off[2] = 0.0f; @@ -89,7 +89,7 @@ void place_metropolis_train(struct Moby *moby, float *pos, float heading) { advance_moby_animation(car); update_entity(car); *(unsigned short *)(car + 0x34) |= 6; - moby_point_position(car, 1, offset); + moby_point_position(car, 1, placement_offset_or_attachment_position); fast_vec_sub(delta, car + 0x10, car_data + 0xA0); update_entity_matrix(car_data + 0x20, delta, car_data + 0xB0, car + 0x40); qcopy(car_data + 0xA0, car + 0x10); From 855eddeb4a858e48f8ada4dc25c3f2127f9252af Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:45:12 +0000 Subject: [PATCH 492/657] decomp: clarify names in directional_particle_emitter_update offset -> spawn_position_offset: In the SHA-256-bound source, Vec4 offset is filled from yaw+pi/2 cosine/sine times random +/-pvars[4], with z sampled from +/-pvars[5], then added to position copied from moby->pos. Retail 0x002e5c60-0x002e5c64 copies moby position to sp; 0x002e5c68-0x002e5cd0 fills the displacement at sp+0x20. At 0x002e5cd4-0x002e5ce0 fast_vec_add receives sp as destination/source and sp+0x20 as its added vector. The resulting position reaches spawn_gravity_floor_burst_particle via a0=sp at 0x002e5e68-0x002e5e6c, proving a spawn-position displacement. --- .../l10/mobys/directional_particle_emitter.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l10/mobys/directional_particle_emitter.c b/src/overlays/l10/mobys/directional_particle_emitter.c index 8d434588cc..d3fd96ade8 100644 --- a/src/overlays/l10/mobys/directional_particle_emitter.c +++ b/src/overlays/l10/mobys/directional_particle_emitter.c @@ -50,7 +50,7 @@ void directional_particle_emitter_update(struct Moby *moby) { for (; i < ((s32 *)pvars)[3]; ++i) { Vec4 position; Vec4 velocity; - Vec4 offset; + Vec4 spawn_position_offset; f32 amount; f32 radius; f32 x; @@ -68,13 +68,13 @@ void directional_particle_emitter_update(struct Moby *moby) { variant = i < directional_particle_variant_threshold_percent_gp; i = life; qcopy(&position, moby_position); - offset.f[0] = fast_cos(fast_add_rotations(moby->rot.z, 1.5707964f)) * + spawn_position_offset.f[0] = fast_cos(fast_add_rotations(moby->rot.z, 1.5707964f)) * random_float_between(-pvars[4], pvars[4]); - offset.f[1] = fast_sin(fast_add_rotations(moby->rot.z, 1.5707964f)) * + spawn_position_offset.f[1] = fast_sin(fast_add_rotations(moby->rot.z, 1.5707964f)) * random_float_between(-pvars[4], pvars[4]); - *(volatile f32 *)&offset.f[2] = 0.0f; - offset.f[2] = random_float_between(-pvars[5], pvars[5]); - fast_vec_add(&position, &position, &offset); + *(volatile f32 *)&spawn_position_offset.f[2] = 0.0f; + spawn_position_offset.f[2] = random_float_between(-pvars[5], pvars[5]); + fast_vec_add(&position, &position, &spawn_position_offset); x = random_float_between(directional_particle_speed_range_start_gp, directional_particle_speed_range_end_gp); From 73e6346f1d56a5f3461c47afcdbc2e633716b8ae Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:45:12 +0000 Subject: [PATCH 493/657] decomp: clarify names in emit_burst_spark_particle timer -> spark_emission_countdown: Retail 0x002ea4f4 saves argument two in s7. At 0x002ea60c-0x002ea614 it is passed to the short countdown helper and a zero result skips emission. After spawn_spark at 0x002ea744, 0x002ea74c-0x002ea76c samples the timer-reset bounds, truncates the sample and stores a halfword through s7. Original Ghidra param_2 has exactly these helper and reset-store uses; the authoritative C expresses fast_dec_timer_s16(timer) before spawn_spark and assigns *timer afterward. The caller supplies the per-position short at effect_pvars+8, separate from the burst counter at +0x48, proving a countdown between spark emissions. --- src/overlays/l10/mobys/configurable_particle_emitter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l10/mobys/configurable_particle_emitter.c b/src/overlays/l10/mobys/configurable_particle_emitter.c index c41541c992..7ea50ab7df 100644 --- a/src/overlays/l10/mobys/configurable_particle_emitter.c +++ b/src/overlays/l10/mobys/configurable_particle_emitter.c @@ -171,7 +171,7 @@ extern int burst_spark_active_duration_max_gp __asm__("D_L10_00161FB0") __attr extern int burst_spark_pause_duration_min_gp __asm__("D_L10_00161FB4") __attribute__((sda)); extern int burst_spark_pause_duration_max_gp __asm__("D_L10_00161FB8") __attribute__((sda)); -void emit_burst_spark_particle(void *emission_position, short *timer, short *burst) { +void emit_burst_spark_particle(void *emission_position, short *spark_emission_countdown, short *burst) { float visibility_sphere[4]; float burst_spark_vertical_vector[4]; float acc[4]; @@ -193,7 +193,7 @@ void emit_burst_spark_particle(void *emission_position, short *timer, short *bur visibility_sphere[3] = 2.0f; if (fast_bsphere_check((char *)visibility_sphere, 32.0f) == -1 && random_integer_below(3) != 0) return; - if (!fast_dec_timer_s16(timer)) + if (!fast_dec_timer_s16(spark_emission_countdown)) return; clear_u64_value(burst_spark_vertical_vector); burst_spark_vertical_vector[2] = burst_spark_vertical_vector_z_scale_gp * frame_time; @@ -225,7 +225,7 @@ void emit_burst_spark_particle(void *emission_position, short *timer, short *bur second_frame_count, third_frame_count, -1); - *timer = truncate_float_to_s32(random_float_between((float)burst_spark_timer_reset_min_gp, + *spark_emission_countdown = truncate_float_to_s32(random_float_between((float)burst_spark_timer_reset_min_gp, (float)burst_spark_timer_reset_max_gp)); } From 89a44551eb43a15ee9f9e6b392921245122b5022 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:45:12 +0000 Subject: [PATCH 494/657] decomp: clarify names in spawn_moby_directional_spark_bursts size -> spark_size_scale: Authoritative frog.c snapshot SHA-256 69a8dacacf97b9602763b6c06f272a6186ff385eb7a6b9ca05ac949a5b80e028 declares size inside the per-spark loop as random_float_between(0.5f, 1.5f), then multiplies both burst_spark_velocity.f[3] and jittered_spark_velocity.f[3] coefficients by it. Retail 0x002ea338-0x002ea344 samples those bounds; 0x002ea34c-0x002ea36c multiplies the same f0 sample by GP globals at -0x4fc0 and -0x4fbc and stores the products at sp+0x2c and sp+0x3c. Those vectors are passed to spawn_spark at 0x002ea42c-0x002ea434. Original Ghidra likewise uses the sampled fStack_d4 for both W products. Thus it is a per-spark shared size scale, rather than a byte count or independently measured dimension. --- src/overlays/shared/enemies/frog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index 3e0c9cb47c..24e5401282 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -913,14 +913,14 @@ void spawn_moby_directional_spark_bursts(struct Moby *moby, Vec4 *spark_push_dir moby_spark_vertical_velocity_correction_scale_gp * frame_time_sq * (float)scale_game_frames(moby_spark_second_frame_count_base_gp); for (j = 0; j < moby_sparks_per_burst_gp; j++) { - float size = random_float_between(0.5f, 1.5f); + float spark_size_scale = random_float_between(0.5f, 1.5f); int color0; int color1; int life; int fade; float third_frame_count_base; - burst_spark_velocity.f[3] = size * D_L06_00161C40; - jittered_spark_velocity.f[3] = size * D_L06_00161C44; + burst_spark_velocity.f[3] = spark_size_scale * D_L06_00161C40; + jittered_spark_velocity.f[3] = spark_size_scale * D_L06_00161C44; add_random_offset_to_vector_xyz(&pos, moby_spark_position_jitter_bound_gp); add_random_offset_to_vector_xyz(&jittered_spark_velocity, moby_spark_velocity_jitter_bound_gp * frame_time); From 069a9d8eec96ddc1f1ae55777ac6e9ab8d1ae3d6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:45:12 +0000 Subject: [PATCH 495/657] decomp: clarify names in underwater_door_update offset -> displacement_from_origin: Authoritative underwater_door.c SHA-256 87cf662208a7e513e9021f656d2ae66ce6246ea70e8a3509479c7ef47c15bb22 declares a single Vec4 offset. Retail 0x002bdee0-0x002bdf18 computes cos/sin of moby rotation +0x48 times signed travel from pvars+0x14 into sp+0/sp+4 and zeroes sp+8. At 0x002bdf08-0x002bdf20 the vector is added to saved origin s0+0 and copied to moby position +0x10. Return motion repeats this at 0x002be038-0x002be07c. Thus the vector is displacement from the saved origin, not a memory offset. --- src/overlays/shared/props/underwater_door.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/props/underwater_door.c b/src/overlays/shared/props/underwater_door.c index 75735d1a40..dfeacf5679 100644 --- a/src/overlays/shared/props/underwater_door.c +++ b/src/overlays/shared/props/underwater_door.c @@ -36,7 +36,7 @@ void underwater_door_update(struct Moby *moby) { DOOR_HOLD_AWAY_FROM_ORIGIN = 3 }; MovingMobyVars *door_motion_data = (MovingMobyVars *)moby->pvars; - Vec4 offset; + Vec4 displacement_from_origin; Vec4 updated_door_position; f32 step; f32 magnitude; @@ -78,10 +78,10 @@ void underwater_door_update(struct Moby *moby) { increment = (moby->scale * 3.0f / moby->pclass->scale) / 3.0f * frame_time; increment = reversed ? -increment : increment; door_motion_data->travel = travel + increment; - offset.f[0] = fast_cos(moby->rot.z) * door_motion_data->travel; - offset.f[1] = fast_sin(moby->rot.z) * door_motion_data->travel; - offset.f[2] = 0.0f; - fast_vec_add(&updated_door_position, &door_motion_data->origin, &offset); + displacement_from_origin.f[0] = fast_cos(moby->rot.z) * door_motion_data->travel; + displacement_from_origin.f[1] = fast_sin(moby->rot.z) * door_motion_data->travel; + displacement_from_origin.f[2] = 0.0f; + fast_vec_add(&updated_door_position, &door_motion_data->origin, &displacement_from_origin); *(u128 *)&moby->pos = updated_door_position.q; magnitude = absolute_float(door_motion_data->travel); scale = moby->scale; @@ -129,10 +129,10 @@ void underwater_door_update(struct Moby *moby) { } else { door_motion_data->travel = 0.0f; } - offset.f[0] = fast_cos(moby->rot.z) * door_motion_data->travel; - offset.f[1] = fast_sin(moby->rot.z) * door_motion_data->travel; - offset.f[2] = 0.0f; - fast_vec_add(&updated_door_position, &door_motion_data->origin, &offset); + displacement_from_origin.f[0] = fast_cos(moby->rot.z) * door_motion_data->travel; + displacement_from_origin.f[1] = fast_sin(moby->rot.z) * door_motion_data->travel; + displacement_from_origin.f[2] = 0.0f; + fast_vec_add(&updated_door_position, &door_motion_data->origin, &displacement_from_origin); *(u128 *)&moby->pos = updated_door_position.q; if (door_motion_data->travel != 0.0f) return; From 638412e44e68c482a55b3ac0f37f06a7ea446a0b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:45:12 +0000 Subject: [PATCH 496/657] decomp: clarify names in spawn_linked_hitbox_contact_effects count -> hitbox_candidate_count: In the authoritative source, count receives collect_mobies_in_sphere(¢er, radius, 0x10, moby, 0), sizes found[count], supplies memcpy's count * 4 bytes, and bounds the outer found[i] candidate loop. Retail 0x002c9a2c returns this query count in v0, saved in s7 at 0x002c9a34; 0x002c9a50 multiplies it by four for the saved pointer copy at 0x002c9a68, and 0x002c9c28 compares the outer index with s7. Original Ghidra uVar2 follows this same query/copy/loop flow. The later point query instead supplies the existing distinct point_moby_count. --- src/overlays/l10/mobys/linked_moby_hitbox.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l10/mobys/linked_moby_hitbox.c b/src/overlays/l10/mobys/linked_moby_hitbox.c index 694aab1dcf..ace2cae904 100644 --- a/src/overlays/l10/mobys/linked_moby_hitbox.c +++ b/src/overlays/l10/mobys/linked_moby_hitbox.c @@ -52,7 +52,7 @@ void spawn_linked_hitbox_contact_effects(struct Moby *moby, HitBox *box) { OvlVec4 inv[4]; OvlVec4 point; f32 radius; - s32 count; + s32 hitbox_candidate_count; s32 i; s32 j; s32 point_moby_count; @@ -70,12 +70,12 @@ void spawn_linked_hitbox_contact_effects(struct Moby *moby, HitBox *box) { center.f[2] = radius; transform_vector_by_basis(¢er, ¢er, moby_rotation_basis); fast_vec_add(¢er, ¢er, &moby->pos); - count = collect_mobies_in_sphere(¢er, radius, 0x10, moby, 0); - if (count != 0) { - struct Moby *found[count]; + hitbox_candidate_count = collect_mobies_in_sphere(¢er, radius, 0x10, moby, 0); + if (hitbox_candidate_count != 0) { + struct Moby *found[hitbox_candidate_count]; - memcpy(found, D_L10_00178380_u, count * 4); - for (i = 0; i < count; i++) { + memcpy(found, D_L10_00178380_u, hitbox_candidate_count * 4); + for (i = 0; i < hitbox_candidate_count; i++) { struct Moby *hitbox_candidate_moby = found[i]; if (hitbox_candidate_moby == 0 || From 910bdfbcff78591c229b53334a6fb536a8507f05 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:45:12 +0000 Subject: [PATCH 497/657] decomp: clarify names in update_moby_path_transform count -> path_point_count: In the SHA-256-bound source count = *(int *)table, where table is l11_paths[pvars+0x60]; it is the divisor for (i+1)%count and (i+2)%count when copying 16-byte next/lookahead path points after the 0x10-byte header. Original retail decompilation has iVar5 = *piVar4 and the same modulo data flow. Retail 0x0031a490 loads the selected path pointer into a2, 0x0031a4a4 loads its first word into a0, and 0x0031a4b0/0x0031a4e0 divide the following indices by that word before remainder-based point addressing. The supplied blarg_ship_update caller also wraps its path index with l11_paths[path_60]->count. --- src/overlays/shared/props/thruster_pack_lock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/props/thruster_pack_lock.c b/src/overlays/shared/props/thruster_pack_lock.c index 1b174ceb4f..568ae7a4b6 100644 --- a/src/overlays/shared/props/thruster_pack_lock.c +++ b/src/overlays/shared/props/thruster_pack_lock.c @@ -877,7 +877,7 @@ void update_moby_path_transform(char *moby) { char *moby_vars = (char *)MOBY(moby)->pvars; int i = *(int *)(moby_vars + 0x64); char *table = (char *)l11_paths[*(int *)(moby_vars + 0x60)]; - int count; + int path_point_count; float matrix[16]; float current_path_point[4], next_path_point[4], lookahead_path_point[4]; float point[4], turn[4], direction[4]; @@ -886,9 +886,9 @@ void update_moby_path_transform(char *moby) { float speed; qcopy(current_path_point, table + i * 16 + 0x10); - count = *(int *)table; - qcopy(next_path_point, table + (i + 1) % count * 16 + 0x10); - qcopy(lookahead_path_point, table + (i + 2) % count * 16 + 0x10); + path_point_count = *(int *)table; + qcopy(next_path_point, table + (i + 1) % path_point_count * 16 + 0x10); + qcopy(lookahead_path_point, table + (i + 2) % path_point_count * 16 + 0x10); clear_u64_value(turn); angle_a = fast_arc_tan(current_path_point[0] - next_path_point[0], current_path_point[1] - next_path_point[1]); From 85cd7e7d7124a51b01a6fb96481aca6581ab28aa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:45:13 +0000 Subject: [PATCH 498/657] decomp: clarify names in update_armed_transport_damage_and_targeting count -> passenger_slot_countdown: Retail 0x002e2d64 sets s0 to pvars+0xc0 and 0x002e2d68 initializes s1 to 3. At 0x002e2d70-0x002e2d84 each nonnegative slot selects a moby by pool + (slot << 8) for removal; 0x002e2d88-0x002e2d90 decrements s1, continues while nonnegative, and advances the slot pointer by four bytes. Supplied armed_transport_update identifies these same four pvars+0xc0 entries as attached/released passengers. Thus count is the inclusive-zero passenger-slot countdown, not the number of occupied slots. --- src/overlays/shared/enemies/armed_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/armed_transport.c b/src/overlays/shared/enemies/armed_transport.c index 7b39157176..0d1cfe42f5 100644 --- a/src/overlays/shared/enemies/armed_transport.c +++ b/src/overlays/shared/enemies/armed_transport.c @@ -499,7 +499,7 @@ void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) { if (*child >= 0) mark_moby_for_removal(pool + (*child << 8)); child++; - } while (--count >= 0); + } while (--passenger_slot_countdown >= 0); } transport_moby->state = ARMED_TRANSPORT_STATE_DYING; transport_data->death_timer_frames = scale_game_frames(90); From 8e559d9ca665853cf79c5558413c922049e427e3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:47:00 +0000 Subject: [PATCH 499/657] decomp: clarify names in vi_buf_restart_dma size -> ring_capacity_bytes: In the authoritative source, size = video_buffer->n << 11 and is the divisor of (video_buffer->d4_madr - (u32)video_buffer->data) before adding the data base back. Retail 0x0023c3bc loads n from 0x8(s0), 0x0023c3cc shifts it by 11 into v1, 0x0023c3dc subtracts the data base from saved D4 MADR, and 0x0023c3e4 performs divu by v1; 0x0023c414/0x0023c41c retrieve the remainder and add the data base. Together with saved_block << 11 addressing, this proves the total ring capacity in bytes used to wrap the DMA byte offset. --- src/movies/decoder/video_input/vi_buf_restart_dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/movies/decoder/video_input/vi_buf_restart_dma.c b/src/movies/decoder/video_input/vi_buf_restart_dma.c index 8ad2e5519e..3745510c51 100644 --- a/src/movies/decoder/video_input/vi_buf_restart_dma.c +++ b/src/movies/decoder/video_input/vi_buf_restart_dma.c @@ -41,12 +41,12 @@ s32 vi_buf_restart_dma(struct ViBuf *video_buffer) { s32 block = get_fifo_index(video_buffer, madr); if (saved_block != block) { s32 tag_id; - s32 size = video_buffer->n << 11; + s32 ring_capacity_bytes = video_buffer->n << 11; qwc = ((u32)video_buffer->data + (saved_block << 11) - madr) >> 4; tadr = ((saved_block << 4) + (u32)video_buffer->tag) & 0x0FFFFFFF; tag_id = ((u32)video_buffer->data + - (video_buffer->d4_madr - (u32)video_buffer->data) % size == + (video_buffer->d4_madr - (u32)video_buffer->data) % ring_capacity_bytes == (u32)video_buffer->data + (((video_buffer->dma_start + video_buffer->dma_n) % video_buffer->n) << 11)) ? 0 From 58e0485e8fcea9626f27710957a4356965460705 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:48:46 +0000 Subject: [PATCH 500/657] decomp: clarify names in update_hero_held_items_and_orientation offset -> facing_direction: In the SHA-256-bound source, float *offset = &pose_owner->facing_x; clear_u64_value(offset), facing_x = 1.0f and transform_vector_by_basis(offset, offset, basis) initialize and rotate the hero facing vector. Retail 0x0020e9e4 forms s1 = hero+0x670; 0x0020ea00 clears that vector; 0x0020ea20 stores 1.0f at +0x670; 0x0020ea10-0x0020ea1c pass s1 as both destination and input and hero+0x640 as basis. The basis was copied from moby+0xC0/+0xD0/+0xE0 at 0x0020e9e8-0x0020ea04. Original Ghidra likewise clears 0x13f9c0, writes 0x3f800000 and transforms it in place with 0x13f990. --- src/overlays/shared/hero/hero_switch_item.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index 6f05e7a593..d0dfc8d8d8 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -1216,13 +1216,13 @@ void update_hero_held_items_and_orientation(void) { } else { char *moby = (char *)pose_owner->moby; u128 *basis = (u128 *)pose_owner->basis; - float *offset = &pose_owner->facing_x; + float *facing_direction = &pose_owner->facing_x; basis[0] = *(u128 *)(moby + 0xC0); basis[1] = *(u128 *)(moby + 0xD0); basis[2] = *(u128 *)(moby + 0xE0); - clear_u64_value(offset); + clear_u64_value(facing_direction); pose_owner->facing_x = 1.0f; - transform_vector_by_basis(offset, offset, basis); + transform_vector_by_basis(facing_direction, facing_direction, basis); HERO_ROTATION(pose_owner) = pose_owner->motion.rot.q; } } From 2b877b9e7569b730f6377f0bd0711c1e023d8c03 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:48:46 +0000 Subject: [PATCH 501/657] decomp: clarify names in draw_uniform_size_hud_stars offset -> star_y_threshold: In the bound C snapshot src/overlays/shared/ui/hud/hud_keep_visible.c (SHA-256 2be5349208919cf3883ba66261d15be9257e3fdf253746ccbaeb3f83ab5c896a), offset becomes 116 - 2*((10000-hud_element->unk74)/10000.0f)*116, then gains star_init_limit0_gp at i==0. Retail 0x00236f34/0x00236f58/0x00236f9c and 0x00237018-0x0023703c compute this in f21; 0x002370d0 adds the first inset. At 0x002370dc-0x002370ec, the particle Y at 0x0017e664 plus 16-byte strides is compared using c.lt.S f21,f0 and drawing is skipped when the threshold is below Y. Original Ghidra fVar5 follows the same calculation and gates the sprite draw. Thus this is the particle-space star Y visibility threshold, rather than a position offset. --- src/overlays/shared/ui/hud/hud_keep_visible.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/ui/hud/hud_keep_visible.c b/src/overlays/shared/ui/hud/hud_keep_visible.c index 5bbaefa797..9d247baaa6 100644 --- a/src/overlays/shared/ui/hud/hud_keep_visible.c +++ b/src/overlays/shared/ui/hud/hud_keep_visible.c @@ -559,7 +559,7 @@ int draw_uniform_size_hud_stars(HudElem *hud_element) __asm__("FUN_L00_00236e50" int draw_uniform_size_hud_stars(HudElem *hud_element) { float origin[4], direction[4], first_step[4], second_step[4], third_step[4], star_position[4]; int x, y; - float offset; + float star_y_threshold; s32 image; int star_width, i; @@ -605,9 +605,9 @@ int draw_uniform_size_hud_stars(HudElem *hud_element) { if (i == 0) { fast_vec_sub(direction, direction, first_step); star_width = (int)(star_init_limit0_gp * 32.0f); - offset += star_init_limit0_gp; + star_y_threshold += star_init_limit0_gp; } - if (offset < l00_hud_star_particles[i].y) + if (star_y_threshold < l00_hud_star_particles[i].y) continue; FUN_L00_001ff348(star_position, &l00_hud_star_particles[i], origin); fast_vec_add(star_position, star_position, direction); From 9dc69ea28587a0b44b7525f048be7c64cbefbbb8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:50:32 +0000 Subject: [PATCH 502/657] decomp: clarify names in draw_starfighter_tractor_beam offset -> beam_phase_offset: In the bound C snapshot, float offset[4] is written by fast_vec_normalize(offset, direction, convert_integer_to_float(frame_count % 20) / 20.0f) and subtracted from position copied from the joint-0x13 start. Retail 0x002eaa0c selects sp+0xc0, 0x002eaa18-0x002eaa3c computes the modulo-20 phase and normalizes the beam direction into that vector, and 0x002eaa40-0x002eaa4c subtracts it from sp+0xb0 before quad construction. Ghidra auStack_e0 has this same write/use chain, proving a longitudinal beam phase offset. --- src/overlays/l13/mobys/qwarks_starfighter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index b23c539412..7170820d1a 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -1147,7 +1147,7 @@ void draw_starfighter_tractor_beam(struct Moby *moby) { float start[4]; float direction[4]; float position[4]; - float offset[4]; + float beam_phase_offset[4]; float side[4]; float up[4]; float edge[4]; @@ -1189,8 +1189,8 @@ void draw_starfighter_tractor_beam(struct Moby *moby) { fast_vec_normalize(direction, direction, step); qcopy(position, start); distance = zero; - fast_vec_normalize(offset, direction, convert_integer_to_float(frame_count % 20) / 20.0f); - fast_vec_sub(position, position, offset); + fast_vec_normalize(beam_phase_offset, direction, convert_integer_to_float(frame_count % 20) / 20.0f); + fast_vec_sub(position, position, beam_phase_offset); while (distance < length) { width = (distance * 0.0f) / (length + length) + 0.5f; fast_vec_cross(side, direction, D_L13_00160680); From c8190feb07f07238ba1abfa2e0e481732842a2c0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:50:33 +0000 Subject: [PATCH 503/657] decomp: clarify names in draw_snagglebeast_rope_attack_layer offset -> rope_radial_offset: Retail 0x003130cc-0x003130fc constructs the stack+0x120 vector as (0, radius*cos(wrapped), radius*sin(wrapped)); 0x003130ec-0x003130fc transforms that same vector in place using moby+0xC0. At 0x00313100-0x0031310c it is added to vars+0x140 to produce quad.positions[3]. The supplied caller positions vars+0x140 along the rope direction at 0.8 times rope_extension_length. Thus this is the rotating radial displacement around that rope point, matching float offset[4] in the authoritative C. --- src/overlays/l07/mobys/snagglebeast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index 6b61c18f5e..41fc0bffb5 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -286,7 +286,7 @@ void draw_snagglebeast_rope_attack_layer( SnagglebeastVars *rope_layer_moby_vars = (SnagglebeastVars *)MOBY(moby)->pvars; struct GeometryQuad quad; struct GeometryQuad inner; - float offset[4]; + float rope_radial_offset[4]; float spin; float step; float angle; From 450a011aaec9d4eadec87cdccf2137e2a551f7cc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:52:30 +0000 Subject: [PATCH 504/657] decomp: clarify names in spawn_forcefield_contact_effects count -> candidate_count: The first collect_mobies_in_sphere call at 0x002ed224 returns its total in v0, saved to s7 at 0x002ed22c (Ghidra uVar3; C count). Retail 0x002ed234-0x002ed260 uses s7 to allocate and copy s7*4 bytes of candidate pointers from 0x00178200. The outer loop loads each saved candidate at 0x002ed298 and compares its index against s7 at 0x002ed464. This is the initial candidate moby count, distinct from the second query's hit_count. --- src/overlays/l13/mobys/forcefield.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l13/mobys/forcefield.c b/src/overlays/l13/mobys/forcefield.c index e7cdc6a24f..86e82a04a0 100644 --- a/src/overlays/l13/mobys/forcefield.c +++ b/src/overlays/l13/mobys/forcefield.c @@ -31,7 +31,7 @@ void spawn_forcefield_contact_effects(void *moby, void *forcefield_vars) { float rotation_matrix[16]; float probe[4]; void **candidates; - int count, hit_count, i, j; + int candidate_count, hit_count, i, j; char *candidate; short half_width, half_height, max_size; float radius; @@ -46,12 +46,12 @@ void spawn_forcefield_contact_effects(void *moby, void *forcefield_vars) { query[2] = radius; transform_vector_by_basis(query, query, matrix); fast_vec_add(query, query, moby + 0x10); - count = collect_mobies_in_sphere(query, radius, 0x10, moby, 0); - if (count == 0) + candidate_count = collect_mobies_in_sphere(query, radius, 0x10, moby, 0); + if (candidate_count == 0) return; - candidates = __builtin_alloca(((unsigned)count << 5) >> 3); - memcpy(candidates, sphere_hits_ed158, count * 4); - for (i = 0; i < count; i++) { + candidates = __builtin_alloca(((unsigned)candidate_count << 5) >> 3); + memcpy(candidates, sphere_hits_ed158, candidate_count * 4); + for (i = 0; i < candidate_count; i++) { candidate = *(void **)((u32)candidates + (i << 2)); if (candidate == 0 || (unsigned char)candidate[0x20] == 0xfe || (unsigned char)candidate[0x20] == 0xfd) From 0e2ea31b9aa53332e219a8d9b8ed24e3dd7a965b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:52:31 +0000 Subject: [PATCH 505/657] decomp: clarify names in resolve_point_path_segment_clearance offset -> axis_address_or_point_byte_offset: In the authoritative C, offset initially holds (s32)(OvlVec4 *)D_0013F5E0, is cast back for original_height and height_axis, then is reassigned i << 4. Retail 0x00262090/0x00262098 constructs address 0x0013f5e0 in s1, 0x002620ac supplies it to the initial dot product, and 0x002620d8 preserves it in s6. At 0x002620e0 and 0x002622d8, s1 becomes current index times 16. Uses at 0x002620e8..0x002620ec test the current point's fourth float at path+offset+0x1c; 0x0026211c..0x00262124 form path+offset+0x10 for the current point, and 0x00262138..0x00262140 form path+offset+0x20 for the next point. The original Ghidra iVar2 is likewise the loop point-byte displacement. Thus the binding first stores the reference-axis address and then a byte offset relative to points[0]. --- .../mobys/test_path_segment_strict_crossing.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c index d9b4fb169a..8d944d32f6 100644 --- a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c +++ b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c @@ -273,7 +273,7 @@ s32 resolve_point_path_segment_clearance(f32 distance, OvlVec4 *current; s32 next_point_index; s32 i; - s32 offset; + s32 axis_address_or_point_byte_offset; OvlVec4 *saved_out; s32 found; f32 original_height; @@ -284,19 +284,19 @@ s32 resolve_point_path_segment_clearance(f32 distance, saved_out = clearance_adjusted_point; qcopy(&working, point); segment_path = D_L00_001B04B0_262030[path_index]; - offset = (s32) & (*(OvlVec4 *)D_0013F5E0); - original_height = fast_vec_dot(&working, (OvlVec4 *)offset); + axis_address_or_point_byte_offset = (s32) & (*(OvlVec4 *)D_0013F5E0); + original_height = fast_vec_dot(&working, (OvlVec4 *)axis_address_or_point_byte_offset); i = 0; if (segment_path->count - 1 > found) { - height_axis = (OvlVec4 *)offset; + height_axis = (OvlVec4 *)axis_address_or_point_byte_offset; do { - offset = i << 4; + axis_address_or_point_byte_offset = i << 4; next_point_index = i + 1; - if (((OvlVec4 *)((u8 *)segment_path + offset + 0x10))->f[3] != 0.0f || + if (((OvlVec4 *)((u8 *)segment_path + axis_address_or_point_byte_offset + 0x10))->f[3] != 0.0f || segment_path->points[next_point_index].f[3] != 0.0f) { - current = (OvlVec4 *)((u8 *)segment_path + (offset + 0x10)); + current = (OvlVec4 *)((u8 *)segment_path + (axis_address_or_point_byte_offset + 0x10)); fast_vec_sub(&difference, &working, current); - fast_vec_sub(&segment, (OvlVec4 *)((u8 *)segment_path + (offset + 0x20)), current); + fast_vec_sub(&segment, (OvlVec4 *)((u8 *)segment_path + (axis_address_or_point_byte_offset + 0x20)), current); projection = fast_vec_dot(&difference, height_axis); FUN_001ff500_262030(projection, &scaled_cross, height_axis); fast_vec_sub(&difference, &difference, &scaled_cross); From 4b10a1e583ac981439380e14c6bde6d085627c8e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:52:31 +0000 Subject: [PATCH 506/657] decomp: clarify names in draw_drek_fight_missile_group_trails offset -> frame_color_blend_offset: Authoritative src/overlays/l18/mobys/drek_fight_missile.c (SHA-256 c719ce38f1994c8974fb1816bc89839d8b0d156b16b753becc22ebbdc45c3192) assigns offset = convert_integer_to_float((game_frame + 3) & 3) * 0.0625f and adds it to color_blend_factor. Retail 0x002f0458..0x002f048c loads game_frame, adds 3, masks with 3 and converts to float; 0x002f0498..0x002f04a8 multiplies by 0.0625 into f20. At 0x002f04d8..0x002f04dc this is added to the segment/vertex blend contribution in f12; 0x002f04e0..0x002f0510 clamps it, 0x002f0524 interpolates the two colors and 0x002f052c stores the vertex color. Original Ghidra expresses the same sum as fVar18 * fVar20 + fVar17 * 0.0625. Thus this float is specifically the frame-derived color blend offset. --- src/overlays/l18/mobys/drek_fight_missile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l18/mobys/drek_fight_missile.c b/src/overlays/l18/mobys/drek_fight_missile.c index c74b153110..f2336a2ef1 100644 --- a/src/overlays/l18/mobys/drek_fight_missile.c +++ b/src/overlays/l18/mobys/drek_fight_missile.c @@ -414,7 +414,7 @@ void draw_drek_fight_missile_group_trails(struct Moby *moby) { short *group_entry; struct Moby *missile_moby; char *missile_trail_private_vars; - float offset; + float frame_color_blend_offset; float color_blend_factor; int i; int j; @@ -434,11 +434,11 @@ void draw_drek_fight_missile_group_trails(struct Moby *moby) { ((u64)drek_missile_trail_blend_factor_selector_gp << 4) | ((u64)drek_missile_trail_blend_addend_selector_gp << 6) | 0x8000000000ULL; - offset = convert_integer_to_float((game_frame + 3) & 3) * 0.0625f; + frame_color_blend_offset = convert_integer_to_float((game_frame + 3) & 3) * 0.0625f; for (j = 0; j < 4; j++) { quads[i].texture_coordinates[j][0] = drek_missile_trail_texture_coordinates[j][0]; quads[i].texture_coordinates[j][1] = drek_missile_trail_texture_coordinates[j][1]; - color_blend_factor = convert_integer_to_float(i + 1 - (j >> 1)) * 0.25f + offset; + color_blend_factor = convert_integer_to_float(i + 1 - (j >> 1)) * 0.25f + frame_color_blend_offset; if (color_blend_factor > 1.0f) { color_blend_factor = 1.0f; } else if (color_blend_factor < 0.0f) { From e03ff58deb057e2deee43a00d968fa9e68d76c32 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:52:31 +0000 Subject: [PATCH 507/657] decomp: clarify names in spawn_turret_rocket offset -> secondary_particle_motion: Retail 0x002e8000 binds s3 to sp+0x80, the source offset array through offset_ptr. 0x002e8044-0x002e8058 writes the sine-scaled matrix[1] vector there; 0x002e805c-0x002e8068 adds it to primary velocity at sp+0x70. 0x002e806c-0x002e8070 then copies the combined primary motion to sp+0x80, and 0x002e807c/0x002e808c sets its distinct secondary-motion w component at sp+0x8c. 0x002e8160-0x002e8168 passes primary motion as a1 and this array as a2 to spark helper 0x00273228. Original Ghidra likewise copies auStack_f0 xyz into uStack_e0/uStack_dc/uStack_d8 and supplies &uStack_e0 as the third helper argument. Thus secondary_particle_motion describes the array's proven lifecycle without inferring acceleration or a spatial displacement. --- src/overlays/shared/weapons/turret_rocket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/turret_rocket.c b/src/overlays/shared/weapons/turret_rocket.c index dce0de2c33..f673aecc8b 100644 --- a/src/overlays/shared/weapons/turret_rocket.c +++ b/src/overlays/shared/weapons/turret_rocket.c @@ -94,7 +94,7 @@ char *spawn_turret_rocket(int firing_moby, float *position, float *rotation, int float rotation_copy[4] __attribute__((aligned(16))); float matrix[4][4] __attribute__((aligned(16))); float velocity[4] __attribute__((aligned(16))); - float offset[4] __attribute__((aligned(16))); + float secondary_particle_motion[4] __attribute__((aligned(16))); float angle, magnitude; int i, particle_frame_count, particle_second_frame_count, particle_third_frame_count; char *moby; @@ -130,7 +130,7 @@ char *spawn_turret_rocket(int firing_moby, float *position, float *rotation, int /* Retail intentionally uses the matrix third row as the particle input. */ particle_position_ptr = matrix[2]; velocity_ptr = velocity; - offset_ptr = offset; + offset_ptr = secondary_particle_motion; matrix_row_ptr = matrix[1]; do { angle = random_angle_radians(); @@ -144,7 +144,7 @@ char *spawn_turret_rocket(int firing_moby, float *position, float *rotation, int fast_vec_add(velocity_ptr, velocity_ptr, offset_ptr); qcopy(offset_ptr, velocity_ptr); velocity[3] = moby_creation_particle_primary_motion_w_gp; - offset[3] = moby_creation_particle_secondary_motion_w_gp; + secondary_particle_motion[3] = moby_creation_particle_secondary_motion_w_gp; i++; spawn_burst(&MOBY(moby)->pos, velocity_ptr, From 9c5458998fd5cb0dd5f11857e1982e30237c0a19 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:52:31 +0000 Subject: [PATCH 508/657] decomp: clarify names in emit_moby_particles count -> group_count: Source assigns count=l10_toxic_crab_particle_group_count and uses it only as the outer i-loop bound; each outer iteration constructs shared position and velocity before the inner spark loop. Retail 0x002e3a90 loads gp-0x4d8c, 0x002e3adc saves it at sp+0x58, and 0x002e3d90..0x002e3d9c compares the incremented outer counter against this captured bound. Ghidra represents the same bound as iStack_e8. size -> random_particle_scale: Source samples size=random_float_between(0.5f,1.5f) once per inner particle iteration, then multiplies it by D_L10_00161E9C and D_L10_00161EA0 for particle_velocity[3] and adjusted_particle_velocity[3]. Retail 0x002e3c80..0x002e3c8c samples those bounds; 0x002e3c94..0x002e3cb4 multiplies the same f0 sample by both globals and stores at sp+0x2c and sp+0x3c. Original Ghidra fStack_104 shows the same shared sample before its second scaled overwrite. This proves a random per-particle scale without assuming the downstream physical units. --- src/overlays/l10/mobys/toxic_crab.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index 408a4114f3..2c488e1a9c 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -909,7 +909,7 @@ void emit_moby_particles(struct Moby *moby) { float adjusted_particle_velocity[4]; float push[4]; char *particle_moby_data; - int count; + int group_count; float *pos_ptr; void *moby_position_source; int i; @@ -917,16 +917,16 @@ void emit_moby_particles(struct Moby *moby) { float angle; float speed; float rise; - float size; + float random_particle_scale; float time_base; int start_color; int end_color; int life; int fade; - count = l10_toxic_crab_particle_group_count; + group_count = l10_toxic_crab_particle_group_count; particle_moby_data = (char *)moby->pvars; - for (i = 0; i < count; i++) { + for (i = 0; i < group_count; i++) { pos_ptr = pos; moby_position_source = &moby->pos; qcopy_nc(pos, moby_position_source); @@ -953,9 +953,9 @@ void emit_moby_particles(struct Moby *moby) { l10_toxic_crab_particle_vertical_velocity_drop_scale * D_0015ED70 * (float)scale_game_frames(l10_toxic_crab_particle_fade_frames); for (j = 0; j < l10_toxic_crab_particles_per_group; j++) { - size = random_float_between(0.5f, 1.5f); - particle_velocity[3] = size * D_L10_00161E9C; - adjusted_particle_velocity[3] = size * D_L10_00161EA0; + random_particle_scale = random_float_between(0.5f, 1.5f); + particle_velocity[3] = random_particle_scale * D_L10_00161E9C; + adjusted_particle_velocity[3] = random_particle_scale * D_L10_00161EA0; add_random_offset_to_vector_xyz(pos, l10_toxic_crab_particle_position_jitter); add_random_offset_to_vector_xyz(adjusted_particle_velocity, l10_toxic_crab_particle_adjusted_velocity_jitter * From 8c2f37331a48607fca8c0a63ab1315d902f614ed Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:52:31 +0000 Subject: [PATCH 509/657] decomp: clarify names in effect_slots_fire offset -> randomized_particle_velocity: In the authoritative effect_slots_fire source, aligned float offset[4] maps to retail sp+0x40. At 0x00264fe4 s2 selects that buffer; random_vector fills it at 0x00265018, vector addition at 0x00265028 adds adjusted travel motion, and 0x0026506c passes it as a1 to spawn_spinning_and_fading_effect_particle at 0x00265074. The supplied helper source copies initial_velocity into particle+0x20. The timer branch reuses the same sp+0x40 buffer at 0x00265128..0x0026513c for a random velocity perturbation, added into velocity at 0x0026516c..0x00265178 before the color-decaying particle spawn. --- src/overlays/shared/weapons/effect_slots_fire.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/weapons/effect_slots_fire.c b/src/overlays/shared/weapons/effect_slots_fire.c index 3d516727de..6652705966 100644 --- a/src/overlays/shared/weapons/effect_slots_fire.c +++ b/src/overlays/shared/weapons/effect_slots_fire.c @@ -62,7 +62,7 @@ void effect_slots_fire(char *slots, float *position, float *direction, float dis float end[4] __attribute__((aligned(16))); float adjusted[4] __attribute__((aligned(16))); float velocity[4] __attribute__((aligned(16))); - float offset[4] __attribute__((aligned(16))); + float randomized_particle_velocity[4] __attribute__((aligned(16))); float travel_step = 0.0f; float speed = 0.0f; float travel; @@ -102,20 +102,20 @@ void effect_slots_fire(char *slots, float *position, float *direction, float dis first_count = 1; for (i = 0; i < default_particle_count + first_count; i++) { random_vector( - offset, + randomized_particle_velocity, 0.0f, (((l02_effect_particle_full_travel_spread) - (l02_effect_particle_zero_travel_spread)) * (travel / distance) + (l02_effect_particle_zero_travel_spread)) * frame_time_macro); - fast_vec_add(offset, offset, adjusted); + fast_vec_add(randomized_particle_velocity, randomized_particle_velocity, adjusted); fast_vec_scale(velocity, adjusted, random_float_between(0.0f, 1.0f)); fast_vec_add(velocity, velocity, origin); if (i < first_count) fl = 1; else fl = 0; - shot = spawn_spinning_and_fading_effect_particle(velocity, offset, fl, travel); + shot = spawn_spinning_and_fading_effect_particle(velocity, randomized_particle_velocity, fl, travel); if (i == 2 && save_shot) { int j; for (j = 0; j < 7; j++) { @@ -130,9 +130,9 @@ void effect_slots_fire(char *slots, float *position, float *direction, float dis float color_particle_spawn_delay = random_float_between(10.0f, 30.0f); color_particle_spawn_delay = FUN_L04_001f1978(color_particle_spawn_delay); ((Slots *)slots)->timer = truncate_float_to_s32(color_particle_spawn_delay); - random_vector(offset, 0.0f, frame_time_macro + frame_time_macro); + random_vector(randomized_particle_velocity, 0.0f, frame_time_macro + frame_time_macro); fast_vec_scale(velocity, adjusted, random_float_between(0.5f, 0.1f)); - fast_vec_add(velocity, velocity, offset); + fast_vec_add(velocity, velocity, randomized_particle_velocity); velocity[3] = 0.0f; spawn_color_decaying_effect_particle(position, velocity, 0); } From ab5963632b6d10a9427f8c7b0bf2ae571e48ac10 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:52:31 +0000 Subject: [PATCH 510/657] decomp: clarify names in draw_blarg_heavy_interceptor_spinning_beam size -> quad_scale: Authoritative source src/overlays/l14/mobys/blarg_heavy_interceptor.c SHA-256 91b57888fef8ffd1188b8ca20534a29c8d96619eb944c793bb3b663e89e405a5 declares float size and initializes it from blarg_heavy_interceptor_spinning_beam_initial_quad_scale_gp. Retail 0x002adee8 loads this value into f21; 0x002adf68-0x002adf74 passes f21 to the vector scale helper with each template vertex at 0x001D8600, before transformation at 0x002adf84. Original Ghidra fVar14 has the same scale-helper flow. After both draws, 0x002ae044/0x002ae054 adds the per-pair quad scale increment to f21 (Ghidra fVar14 += fGpffffa840). Thus this is the quad template scale, distinct from the translation multiplier step/f20. --- src/overlays/l14/mobys/blarg_heavy_interceptor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index f2ff17d2f4..5321a1dbcc 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -1260,7 +1260,7 @@ void draw_blarg_heavy_interceptor_spinning_beam(struct Moby *moby) { float beam_to_camera_vector[4]; float camera_facing_angles[4]; float rm[3][4]; - float size; + float quad_scale; float step; int r, g, b, a; u32 col; @@ -1301,7 +1301,7 @@ void draw_blarg_heavy_interceptor_spinning_beam(struct Moby *moby) { pk.uv[5] = 0.0f; pk.uv[6] = 0.0f; pk.uv[7] = 0.0f; - size = blarg_heavy_interceptor_spinning_beam_initial_quad_scale_gp; + quad_scale = blarg_heavy_interceptor_spinning_beam_initial_quad_scale_gp; step = blarg_heavy_interceptor_spinning_beam_initial_offset_scale_gp; r = blarg_heavy_interceptor_spinning_beam_initial_red_gp; g = blarg_heavy_interceptor_spinning_beam_initial_green_gp; @@ -1316,7 +1316,7 @@ void draw_blarg_heavy_interceptor_spinning_beam(struct Moby *moby) { pk.col[0] = col; fast_vec_scale(quad_translation_offset, beam_offset_direction, step); for (j = 0; j < 4; j++) { - fast_vec_scale(pk.m[j], D_L14_001D8600[j], size); + fast_vec_scale(pk.m[j], D_L14_001D8600[j], quad_scale); transform_vector(pk.m[j], pk.m[j], beam_quad_transform); fast_vec_add(pk.m[j], pk.m[j], quad_translation_offset); } @@ -1330,7 +1330,7 @@ void draw_blarg_heavy_interceptor_spinning_beam(struct Moby *moby) { g -= blarg_heavy_interceptor_spinning_beam_green_decrement_per_pair_gp; b -= blarg_heavy_interceptor_spinning_beam_blue_decrement_per_pair_gp; a -= blarg_heavy_interceptor_spinning_beam_alpha_decrement_per_pair_gp; - size += blarg_heavy_interceptor_spinning_beam_quad_scale_increment_per_pair_gp; + quad_scale += blarg_heavy_interceptor_spinning_beam_quad_scale_increment_per_pair_gp; step += blarg_heavy_interceptor_spinning_beam_offset_scale_increment_per_pair_gp; if (r < 0) r = 0; From e912ebf9b0b2207debdc22bdf23fa6f49a7ce008 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:54:21 +0000 Subject: [PATCH 511/657] decomp: clarify names in spark_particle_emitter_update size -> sampled_particle_size: In the authoritative spark_particle_emitter.c snapshot (SHA-256 ea6f67ba1e38e4692714e2f50507dc596289e6f702be48e04bf48e81fd2e5ca2), the single f32 size binding receives random_float_between(emitter_vars->size_min, emitter_vars->size_max) in both branches. Retail 0x002bd2e0-0x002bd2f0 and 0x002bd3c0-0x002bd3d0 load bounds s0+0xa8/+0xac, call the random sampler, and retain the sample in f20; 0x002bd308 and 0x002bd3e8 copy it to f15 for create_spark_particle calls at 0x002bd338/0x002bd418. Original Ghidra uVar7 follows the same sample-to-call flow. This proves a sampled particle size setting rather than a buffer or object byte size. --- src/overlays/l01/mobys/spark_particle_emitter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l01/mobys/spark_particle_emitter.c b/src/overlays/l01/mobys/spark_particle_emitter.c index a31101df07..082cd2a16b 100644 --- a/src/overlays/l01/mobys/spark_particle_emitter.c +++ b/src/overlays/l01/mobys/spark_particle_emitter.c @@ -81,7 +81,7 @@ void spark_particle_emitter_update(EmitterMoby *emitter_moby) { EmitMtx m; } lin; } u; - f32 size; + f32 sampled_particle_size; s32 i; emitter_vars = emitter_moby->vars; @@ -125,14 +125,14 @@ void spark_particle_emitter_update(EmitterMoby *emitter_moby) { } euler_rotation_matrix(&u.rot.m, &u.rot.ang); transform_vector(&rotated_particle_velocity, &emitter_vars->vel, &u.rot.m); - size = random_float_between(emitter_vars->size_min, emitter_vars->size_max); + sampled_particle_size = random_float_between(emitter_vars->size_min, emitter_vars->size_max); create_spark_particle( emitter_vars, &position_scratch, rotated_particle_velocity.f[0], rotated_particle_velocity.f[1], rotated_particle_velocity.f[2], - size, + sampled_particle_size, random_float_between(emitter_vars->life_min, emitter_vars->life_max), emitter_vars->fade[0], emitter_vars->fade[1], @@ -156,14 +156,14 @@ void spark_particle_emitter_update(EmitterMoby *emitter_moby) { euler_rotation_matrix(&u.lin.m, emitter_moby->rot); transform_vector(&u.lin.vel, &u.lin.vel, &u.lin.m); } - size = random_float_between(emitter_vars->size_min, emitter_vars->size_max); + sampled_particle_size = random_float_between(emitter_vars->size_min, emitter_vars->size_max); create_spark_particle( emitter_vars, &position_scratch, u.lin.vel.f[0], u.lin.vel.f[1], u.lin.vel.f[2], - size, + sampled_particle_size, random_float_between(emitter_vars->life_min, emitter_vars->life_max), emitter_vars->fade[0], emitter_vars->fade[1], From 9c5d172de9772662590257744e8652658c709b3e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:54:21 +0000 Subject: [PATCH 512/657] decomp: clarify names in emit_height_adjusted_burst_spark_particle timer -> particle_emission_countdown: Retail 0x002eaa14 preserves a1 in s7. At 0x002eab10-0x002eab18 s7 is passed to fast_dec_timer_s16 and a zero result skips particle creation. After spawn_spark at 0x002eac70, 0x002eac78-0x002eac98 samples the configured timer-reset bounds, truncates the result and stores it through s7. Original Ghidra shows param_3 used by the timer helper and reloaded after spawning; authoritative C has the same fast_dec_timer_s16(timer) gate and *timer reset. Thus this parameter points to the individual particle emission countdown, distinct from burst. --- src/overlays/l10/mobys/configurable_particle_emitter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l10/mobys/configurable_particle_emitter.c b/src/overlays/l10/mobys/configurable_particle_emitter.c index 7ea50ab7df..3ced5d4801 100644 --- a/src/overlays/l10/mobys/configurable_particle_emitter.c +++ b/src/overlays/l10/mobys/configurable_particle_emitter.c @@ -352,7 +352,7 @@ void emit_height_adjusted_burst_spark_particle(void *emission_position, float height) __asm__("FUN_L10_002eaa08"); void emit_height_adjusted_burst_spark_particle(void *emission_position, - short *timer, + short *particle_emission_countdown, short *burst, float height) { @@ -380,7 +380,7 @@ void emit_height_adjusted_burst_spark_particle(void *emission_position, visibility_sphere[2] -= 4.0f; if (fast_bsphere_check((char *)visibility_sphere, 32.0f) == -1) return; - if (!fast_dec_timer_s16(timer)) + if (!fast_dec_timer_s16(particle_emission_countdown)) return; frame_count_scale = random_float_between(1.0f - *(float *)&height_adjusted_spark_frame_count_scale_spread_gp, @@ -419,7 +419,7 @@ void emit_height_adjusted_burst_spark_particle(void *emission_position, second_frame_count, third_frame_count, l10_height_adjusted_spark_lookup_index_and_flags); - *timer = truncate_float_to_s32( + *particle_emission_countdown = truncate_float_to_s32( random_float_between((float)*(int *)&height_adjusted_spark_timer_reset_min_gp, (float)*(int *)&height_adjusted_spark_timer_reset_max_gp)); } From 2bb09267cde214d128ca01e4b0a7bd24a33b6189 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:54:21 +0000 Subject: [PATCH 513/657] decomp: clarify names in sandmouse_projectile_update offset -> movement_delta: In the authoritative sandmouse_projectile.c snapshot (SHA-256 c4a94a1f9c4514e1f0333e233cfb0b219a204cfda28f724993e1948a8da868fc), OvlVec4 offset is populated by build_spherical_offset with frame_time * 40.0f, current yaw and negated updated pitch, then passed as the added vector to fast_vec_add(moby_position, moby_position, &offset). Retail 0x0030cad8 forms s0 = sp+0x10 (original Ghidra auStack_c0); 0x0030cacc-0x0030caec supplies negated pitch, yaw and frame_time*40 to the spherical helper; 0x0030caf8-0x0030cb04 passes s0 as a2 to the in-place position addition. Thus this vector is the projectile movement delta for the update. --- src/overlays/shared/enemies/sandmouse_projectile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/sandmouse_projectile.c b/src/overlays/shared/enemies/sandmouse_projectile.c index 310e547e1c..833d4303ad 100644 --- a/src/overlays/shared/enemies/sandmouse_projectile.c +++ b/src/overlays/shared/enemies/sandmouse_projectile.c @@ -84,7 +84,7 @@ void sandmouse_projectile_update(char *moby) { char *moby_vars = ((char *)MOBY(moby)->pvars); f32 *moby_position; OvlVec4 old_pos; - OvlVec4 offset; + OvlVec4 movement_delta; DropProbe probe; f32 desired_yaw, desired_pitch; f32 pitch_k, pitch_d, pitch_max; @@ -116,10 +116,10 @@ void sandmouse_projectile_update(char *moby) { (f32 *)(moby_vars + 4), MOBY(moby)->rot.y, desired_pitch, pitch_k, pitch_d, pitch_max); pitch_max = frame_time * 40.0f; MOBY(moby)->rot.y = pitch_result; - build_spherical_offset(offset.f, pitch_max, MOBY(moby)->rot.z, -pitch_result); + build_spherical_offset(movement_delta.f, pitch_max, MOBY(moby)->rot.z, -pitch_result); } qcopy(&old_pos, moby_position); - fast_vec_add(moby_position, moby_position, &offset); + fast_vec_add(moby_position, moby_position, &movement_delta); if (MOBY(moby)->pos.x < 2.0f || MOBY(moby)->pos.x > 1021.0f || MOBY(moby)->pos.y < 2.0f || MOBY(moby)->pos.y > 1021.0f || MOBY(moby)->pos.z < 2.0f || MOBY(moby)->pos.z > 1021.0f || MOBY(moby)->pos.x < 0.0f || MOBY(moby)->pos.y < 0.0f || MOBY(moby)->pos.z < 0.0f || From ea0df0082f77131556e5d28da2597d06a423ba49 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:56:16 +0000 Subject: [PATCH 514/657] decomp: clarify names in draw_lens_flare size -> texture_size: Retail 0x001eddb0 sets s3 to 0x40 and 0x001eddd4/0x001edddc selects 0x20 for nonzero layer indices. At 0x001edf08..0x001edf2c s3 is converted to float and multiplied by the layer scale to produce quad_size; 0x001edf80 and 0x001edfa4 pass s3 as both texture-coordinate extents to draw_textured_quad. Original Ghidra calls this binding texture_width and emits (x,y,width,width,0,0,texture_width,texture_width,...). The supplied C likewise uses size for both UV extents and size * effect_ribbon.scale[i], proving a square source texture extent rather than the scaled screen quad side. --- src/rendering/effects/draw_lens_flare.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rendering/effects/draw_lens_flare.c b/src/rendering/effects/draw_lens_flare.c index a6f481ce44..f416071e26 100644 --- a/src/rendering/effects/draw_lens_flare.c +++ b/src/rendering/effects/draw_lens_flare.c @@ -33,7 +33,7 @@ void draw_lens_flare(void) { f32 fy; f32 half; s32 i; - s32 size; + s32 texture_size; s64 tex; s32 rgba; s32 quad_size; @@ -57,7 +57,7 @@ void draw_lens_flare(void) { screen_center_delta[1] = ctr[1] - scr[1]; for (i = 0; i < 16; i++) { tex = get_effect_texture(effect_ribbon.tex[i] + 6); - size = (i != 0) ? 0x20 : 0x40; + texture_size = (i != 0) ? 0x20 : 0x40; sprite_center_offset[0] = screen_center_delta[0] * effect_ribbon.dist[i]; sprite_center_offset[1] = screen_center_delta[1] * effect_ribbon.dist[i]; at[0] = ctr[0] + sprite_center_offset[0]; @@ -83,11 +83,11 @@ void draw_lens_flare(void) { fade = fade * (fx * fy); rgba = (truncate_float_to_s32(fade * effect_ribbon.alpha[i]) << 24) | (effect_ribbon.color[i] & 0xFFFFFF); - quad_size = truncate_float_to_s32(size * effect_ribbon.scale[i]); + quad_size = truncate_float_to_s32(texture_size * effect_ribbon.scale[i]); half = quad_size >> 1; x = truncate_float_to_s32(at[0] - half); y = truncate_float_to_s32(at[1] - half); - draw_textured_quad(x, y, quad_size, quad_size, 0, 0, size, size, rgba, tex); + draw_textured_quad(x, y, quad_size, quad_size, 0, 0, texture_size, texture_size, rgba, tex); } effect_ribbon.intensity = 0.0f; } From 632eefb5fa85eb3850bb4807197c68d992539054 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:56:16 +0000 Subject: [PATCH 515/657] decomp: clarify names in pick_idle_fidget count -> eligible_fidget_count: In the SHA-256-bound C snapshot, count starts at zero and increments only after an eligible idle_fidgets row index is stored through choice_write_cursor into choices. Retail initializes s5 at 0x00229060, stores the accepted row index at 0x00229228 (or 0x002291e4), then increments s5 at 0x0022922c. The zero test at 0x00229244 rejects an empty eligible list; s5 bounds weight accumulation via 0x00229274 and final selection via 0x00229308. Ghidra's iVar8 has the same increment and loop-bound data flow, proving this is the eligible fidget count. --- src/overlays/shared/hero/hero_handle_jump_press.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/hero/hero_handle_jump_press.c b/src/overlays/shared/hero/hero_handle_jump_press.c index 4b391e1a75..e52b7c0eb7 100644 --- a/src/overlays/shared/hero/hero_handle_jump_press.c +++ b/src/overlays/shared/hero/hero_handle_jump_press.c @@ -28,12 +28,12 @@ s32 pick_idle_fidget(s32 *index) { Vec4 start; HeroTableEntry70 *fidget_candidate; Vec4 *startp, *endp; - s32 i, slot_zero_item_id, count, j; + s32 i, slot_zero_item_id, eligible_fidget_count, j; s32 *choice_write_cursor; HeroTableEntry70 *table; f32 total, pick; - count = 0; + eligible_fidget_count = 0; if (hero.fidget_cooldown != 0) return 0; if (hero.health.hp == 1) { @@ -81,19 +81,19 @@ s32 pick_idle_fidget(s32 *index) { continue; } *choice_write_cursor = i; - count++; + eligible_fidget_count++; choice_write_cursor++; } - if (count == 0) + if (eligible_fidget_count == 0) return 0; total = 0.0f; - for (i = 0; i < count; i++) { + for (i = 0; i < eligible_fidget_count; i++) { HeroTableEntry70 *choice = &idle_fidgets[choices[i]]; total += 1.0f / (f32)(s32)(scale_time(choice->interval) * 60.0f); } pick = random_float_between(0.0f, 1.0f); if (pick < total) { - for (j = 0; j < count; j++) { + for (j = 0; j < eligible_fidget_count; j++) { s32 picked = choices[j]; HeroTableEntry70 *choice; *index = picked; From ea8a9fc3fdc93e5cb50fdc52b5e82757eec80784 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:58:10 +0000 Subject: [PATCH 516/657] decomp: clarify names in FUN_L00_0025df68 count -> path_vertex_count: In the bound source count is loaded from *path, forms (best_segment + count - 1) % count, bounds best_segment < count - 1, and wraps (best_segment + 1) % count for 16-byte path vertices at path+4. Retail 0x0025e198 loads v1 from 0(s2); 0x0025e1b0-0x0025e1d0 subtracts one and computes the preceding vertex remainder; 0x0025e21c-0x0025e25c reloads that header, tests the last vertex and computes the next vertex remainder. The original decompilation expresses these same *piVar2-based vertex operations. --- .../shared/rendering/effects/spawn_explosion.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/rendering/effects/spawn_explosion.c b/src/overlays/shared/rendering/effects/spawn_explosion.c index 649fb81a9f..50ee8d683d 100644 --- a/src/overlays/shared/rendering/effects/spawn_explosion.c +++ b/src/overlays/shared/rendering/effects/spawn_explosion.c @@ -425,7 +425,7 @@ s32 FUN_L00_0025df68(s32 *path, OvlQuad path_search_points[4]; s32 current = 0; s32 best_segment; - s32 start, end, previous, count; + s32 start, end, previous, path_vertex_count; s32 crossed; f32 current_fraction = 0.0f; f32 best_fraction; @@ -485,9 +485,9 @@ s32 FUN_L00_0025df68(s32 *path, previous_distance = 1000000000.0f; if (best_segment > 0 || wrap) { f32 distance; - count = *path; - previous = count - 1; - previous = (best_segment + previous) % count; + path_vertex_count = *path; + previous = path_vertex_count - 1; + previous = (best_segment + previous) % path_vertex_count; distance = resolve_level_path_segment_point(nearest, point, (OvlQuad *)(path + 4 + previous * 4), @@ -500,13 +500,13 @@ s32 FUN_L00_0025df68(s32 *path, *fraction = path_distance_25df68(&path_search_points[1], &path_search_points[2], 0.0f); previous_distance = distance; } - count = *path; - if (best_segment < count - 1 || wrap) { + path_vertex_count = *path; + if (best_segment < path_vertex_count - 1 || wrap) { next_distance = resolve_level_path_segment_point( &path_search_points[1], point, (OvlQuad *)(path + 4 + best_segment * 4), - (OvlQuad *)(path + 4 + ((best_segment + 1) % count) * 4), + (OvlQuad *)(path + 4 + ((best_segment + 1) % path_vertex_count) * 4), height_tolerance); if (next_distance < previous_distance) { qcopy_nc(nearest, &path_search_points[1]); From 4c275f9103c371daf0d9e3541dfe32fa2817376f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:58:11 +0000 Subject: [PATCH 517/657] decomp: clarify names in glove_of_doom_update offset -> grip_bone_offset: In authoritative glove_of_doom.c, OvlVec4 offset is zeroed and set to (0.01,-0.14,-0.05), matching retail sp+0x10 initialization at 0x002c7a60 and 0x002c7ab0-0x002c7abc. Retail 0x002c7ac0-0x002c7ad0 builds bone 0's grip_bone_transform; 0x002c7ad8-0x002c7ae4 passes sp+0x10 as transform_vector input with that matrix. The transformed local at sp+0x20 is added to moby_point_position's position into glove_carrier_vars->grip at 0x002c7ae8-0x002c7af4. Original Ghidra &uStack_d0 -> auStack_c0 -> iVar2+0x40 confirms the same grip bone displacement data flow. --- src/overlays/shared/weapons/glove_of_doom.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/weapons/glove_of_doom.c b/src/overlays/shared/weapons/glove_of_doom.c index af8d90a577..a0ba67d5f2 100644 --- a/src/overlays/shared/weapons/glove_of_doom.c +++ b/src/overlays/shared/weapons/glove_of_doom.c @@ -289,19 +289,19 @@ void glove_of_doom_update(struct Moby *moby) { GLOVE_SKIP_HELD_MOBY_SYNC_AND_SPAWN = 6 }; OvlVec4 pos; - OvlVec4 offset; + OvlVec4 grip_bone_offset; OvlVec4 local; OvlVec4 grip_bone_transform[4]; OvlVec4 grip; CarrierVars *glove_carrier_vars = (CarrierVars *)moby->pvars; - offset.q = 0; - offset.f[0] = 0.01f; - offset.f[1] = -0.14f; - offset.f[2] = -0.05f; + grip_bone_offset.q = 0; + grip_bone_offset.f[0] = 0.01f; + grip_bone_offset.f[1] = -0.14f; + grip_bone_offset.f[2] = -0.05f; moby_point_position((u8 *)moby, 0, &pos); build_moby_bone_transform(moby, 0, grip_bone_transform); - transform_vector(&local, &offset, grip_bone_transform); + transform_vector(&local, &grip_bone_offset, grip_bone_transform); fast_vec_add(&glove_carrier_vars->grip, &pos, &local); if (glove_carrier_vars->held != 0) { glove_carrier_vars->held->collision_disable = 1; From 852f04acb0662ebf4ade7679d8e8b4b9520a832c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 13:58:11 +0000 Subject: [PATCH 518/657] decomp: clarify names in rising_debris_emitter_update size -> initial_particle_size: Retail 0x002f8f30..0x002f8f54 samples a float between 70000.0 and 140000.0; 0x002f8f5c preserves it in f20 and 0x002f8f88 passes it in f12 to mine_debris at 0x002f8f9c. Original Ghidra uVar11 sample/call flow agrees with authoritative C size passed as the fifth mine_debris argument. Supplied mine_debris C calls that argument initial_size and stores it at particle+0xC and particle_data+0x1C, proving initial particle size. --- src/overlays/l01/mobys/rising_debris_emitter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l01/mobys/rising_debris_emitter.c b/src/overlays/l01/mobys/rising_debris_emitter.c index 53a88a10a9..f3f310ffa0 100644 --- a/src/overlays/l01/mobys/rising_debris_emitter.c +++ b/src/overlays/l01/mobys/rising_debris_emitter.c @@ -66,7 +66,7 @@ void rising_debris_emitter_update(SteamMoby *steam_moby) { SteamParticle *debris_particle; f32 spawn_radius_or_vertical_velocity_increment; f32 spawn_offset_angle_radians; - f32 size; + f32 initial_particle_size; s32 life; s32 i; @@ -123,13 +123,13 @@ void rising_debris_emitter_update(SteamMoby *steam_moby) { spawn_radius_or_vertical_velocity_increment *= 8.0f; puff.f[2] += steam_vars->height; particle_initial_velocity.f[2] += spawn_radius_or_vertical_velocity_increment; - size = random_float_between(70000.0f, 140000.0f); + initial_particle_size = random_float_between(70000.0f, 140000.0f); life = scale_game_frames(0xB4); debris_particle = mine_debris(&puff, &particle_initial_velocity, 0x0F081020, 0x00081020, - size, + initial_particle_size, life, colors.c[random_integer_below(3)]); if (debris_particle != 0) { From 23274285e35d6a565c18a7451361fb62f7449a8e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:00:22 +0000 Subject: [PATCH 519/657] decomp: clarify names in spawn_bomber_tank_joint_particles offset -> horizontal_spread_offset: Bound src/overlays/l08/mobys/bomber_tank.c SHA-256 8c3d6061cc21a1cae3488e1630ddaf56bc9b91bc84e3cfe4cfc24606480312ec uses offset for angle-helper results multiplied by randomized horizontal spread and D_0015ED6C, then added to spread_vector[0] and [1] in both branches. Retail 0x002d5af4..0x002d5b2c and 0x002d5b84..0x002d5bc0 hold the x contribution in f20 and add it to sp+0x70; 0x002d5b28/0x002d5bbc obtain the y angle result, and 0x002d5bd4..0x002d5c00 scale it and add it to sp+0x74. Original Ghidra fVar7/fVar8 calculations agree. These are horizontal spread offsets, not position offsets. --- src/overlays/l08/mobys/bomber_tank.c | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/overlays/l08/mobys/bomber_tank.c b/src/overlays/l08/mobys/bomber_tank.c index d4d482ac85..466310163a 100644 --- a/src/overlays/l08/mobys/bomber_tank.c +++ b/src/overlays/l08/mobys/bomber_tank.c @@ -866,7 +866,7 @@ void spawn_bomber_tank_joint_particles(struct Moby *moby, int joint, int count) float spawn_pos[4]; int i; int frames1, frames2, frames3; - float random_angle, offset; + float random_angle, horizontal_spread_offset; moby_point_position(moby, joint, joint_pos); build_moby_bone_transform(moby, joint, joint_transform_buffer); @@ -889,18 +889,18 @@ void spawn_bomber_tank_joint_particles(struct Moby *moby, int joint, int count) D_0015ED6C); fast_vec_add(velocity, velocity, jitter); fast_vec_scale(spread_vector, spread_vector, 0.5f); - offset = func_001F9F90_2D6C58(random_angle); - offset = - offset * (random_float_between( + horizontal_spread_offset = func_001F9F90_2D6C58(random_angle); + horizontal_spread_offset = + horizontal_spread_offset * (random_float_between( 0.0f, bomber_tank_joint_particle_horizontal_spread_range_end_gp) * D_0015ED6C); - spread_vector[0] = spread_vector[0] + offset; - offset = func_001F9FA8_2D6C58(random_angle); - offset = - offset * (random_float_between( + spread_vector[0] = spread_vector[0] + horizontal_spread_offset; + horizontal_spread_offset = func_001F9FA8_2D6C58(random_angle); + horizontal_spread_offset = + horizontal_spread_offset * (random_float_between( 0.0f, bomber_tank_joint_particle_horizontal_spread_range_end_gp) * D_0015ED6C); - spread_vector[1] = spread_vector[1] + offset; + spread_vector[1] = spread_vector[1] + horizontal_spread_offset; spread_vector[2] = bomber_tank_joint_particle_vertical_spread_gp * D_0015ED6C; } else { func_L00_001FF4B0_2D6C58( @@ -910,18 +910,18 @@ void spawn_bomber_tank_joint_particles(struct Moby *moby, int joint, int count) D_0015ED6C); fast_vec_add(velocity, velocity, jitter); fast_vec_scale(spread_vector, spread_vector, 0.5f); - offset = func_001F9F90_2D6C58(random_angle); - offset = offset * + horizontal_spread_offset = func_001F9F90_2D6C58(random_angle); + horizontal_spread_offset = horizontal_spread_offset * (random_float_between( 0.0f, bomber_tank_joint_particle_horizontal_spread_range_end_gp * 0.25f) * D_0015ED6C); - spread_vector[0] = spread_vector[0] + offset; - offset = func_001F9FA8_2D6C58(random_angle); - offset = offset * + spread_vector[0] = spread_vector[0] + horizontal_spread_offset; + horizontal_spread_offset = func_001F9FA8_2D6C58(random_angle); + horizontal_spread_offset = horizontal_spread_offset * (random_float_between( 0.0f, bomber_tank_joint_particle_horizontal_spread_range_end_gp * 0.25f) * D_0015ED6C); - spread_vector[1] = spread_vector[1] + offset; + spread_vector[1] = spread_vector[1] + horizontal_spread_offset; spread_vector[2] = bomber_tank_joint_particle_vertical_spread_gp * D_0015ED6C; } velocity[3] = bomber_tank_joint_particle_velocity_w_gp; From c958177afce74c7f454bedfd06ce3f6350f13422 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:00:22 +0000 Subject: [PATCH 520/657] decomp: clarify names in update_hero_movement_and_collision_probes offset -> edge_probe_scan_offset: In the bound source, offset scans from -0.4f while below 0.5f in 0.1f steps, supplies 1.1f + offset to transform_hero_local_offset_to_world(probe,...), and on a clear coll_sphere stores capsule_radius + offset in hero.edge_probe_offset. Retail 0x0024bf98..0x0024bfa0 initializes f20=-0.4; 0x0024bfc4 adds f20 to the 1.1 base in f25 for the probe transform at 0x0024bfd0. The sphere query at 0x0024bfe4 controls acceptance; 0x0024c00c..0x0024c020 adds f20 to hero+0x234 and stores the clamped edge offset at +0x25c. Retail 0x0024bff0 and 0x0024c02c..0x0024c038 implement the 0.1 increment and 0.5 scan bound; Ghidra represents this same binding as fVar10. --- .../shared/hero/process_hero_primary_item_input.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/process_hero_primary_item_input.c b/src/overlays/shared/hero/process_hero_primary_item_input.c index ea887a5fe9..1a5bf07599 100644 --- a/src/overlays/shared/hero/process_hero_primary_item_input.c +++ b/src/overlays/shared/hero/process_hero_primary_item_input.c @@ -474,7 +474,7 @@ void update_hero_movement_and_collision_probes(void) { float start[4], end[4], probe[4]; u128 moby_rotation[4], rotation[4], combined[4]; float distance; - float offset; + float edge_probe_scan_offset; int hit; if (hero.tilt_disabled == 0) { integrate_hero_motion_with_collisions(); @@ -505,15 +505,15 @@ void update_hero_movement_and_collision_probes(void) { distance = 20.0f; hit = collision_line(start, end, 2, hero.moby, 0); if (!hit || (distance = fast_vec_dist(start, D_L05_00174260), distance > 3.0f)) { - for (offset = -0.4f; offset < 0.5f; offset += 0.1f) { - transform_hero_local_offset_to_world(probe, 1.1f + offset, 0.0f, 0.0f); + for (edge_probe_scan_offset = -0.4f; edge_probe_scan_offset < 0.5f; edge_probe_scan_offset += 0.1f) { + transform_hero_local_offset_to_world(probe, 1.1f + edge_probe_scan_offset, 0.0f, 0.0f); if (!coll_sphere(hero.capsule_radius, probe, 2, 0)) { hero.edge_ahead = 1; if (!hit) hero.edge_drop_depth = 20.0f; else hero.edge_drop_depth = distance; - hero.edge_probe_offset = hero.capsule_radius + offset; + hero.edge_probe_offset = hero.capsule_radius + edge_probe_scan_offset; if (hero.edge_probe_offset < 0.0f) hero.edge_probe_offset = 0.0f; break; From d88ff93d91bdc15c872db1fef98a7195c6cd79ab Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:00:22 +0000 Subject: [PATCH 521/657] decomp: clarify names in draw_linked_moby_trails offset -> trail_corner_z_offsets: In source snapshot src/overlays/shared/props/thruster_pack_lock.c SHA-256 f4e31f4f3502bd009e82a5bbbb1a62e6f494c521cd60976e3e2165aea9e21ded, float offset[2][4] is cleared for 0x20 bytes and assigned offset[0][2]=0.25f and offset[1][2]=-0.25f. Retail 0x00319340/0x00319360 preserves sp+0x900 as this array base; 0x00319494..0x003194a0 clears it and 0x003194c8/0x003194d0 stores the Z components at sp+0x908/sp+0x918. At 0x0031959c/0x003195a4 the corner index is masked with 1 and scaled by 16, and 0x003195b8/0x003195c8 selects the corresponding vector as a2 for the vector-add call at 0x003195dc. The source adds offset[corner & 1] to each sampled trail point to produce quads[segment].positions[corner], proving alternating trail-corner Z offsets. --- src/overlays/shared/props/thruster_pack_lock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/props/thruster_pack_lock.c b/src/overlays/shared/props/thruster_pack_lock.c index 568ae7a4b6..9c07fc8213 100644 --- a/src/overlays/shared/props/thruster_pack_lock.c +++ b/src/overlays/shared/props/thruster_pack_lock.c @@ -590,7 +590,7 @@ int draw_linked_moby_trails(struct Moby *moby) __asm__("FUN_L11_003192c8"); int draw_linked_moby_trails(struct Moby *moby) { TrailQuad quads[16]; - float offset[2][4]; + float trail_corner_z_offsets[2][4]; short *list, *next_list; int i, j, segment, side, slot, more, next_segment, next_side, own_class, other_class, visible, half, corner; @@ -634,9 +634,9 @@ int draw_linked_moby_trails(struct Moby *moby) { } } - memset(offset, 0, 0x20); - offset[0][2] = 0.25f; - offset[1][2] = -0.25f; + memset(trail_corner_z_offsets, 0, 0x20); + trail_corner_z_offsets[0][2] = 0.25f; + trail_corner_z_offsets[1][2] = -0.25f; list = D_L11_001AC240[moby->group]; do { @@ -671,7 +671,7 @@ int draw_linked_moby_trails(struct Moby *moby) { int point = (slot + (corner >> 1)) % 16; fast_vec_add(quads[segment].positions[corner], &((float(*)[16][4])(trail + 0xC0))[side][point][0], - offset[corner & 1]); + trail_corner_z_offsets[corner & 1]); } draw_geometry_quad(&quads[segment], 0, 0); side = next_side; From d44da796e3ca27c8e2fcb9fdcc990d2dae0f1dd0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:02:13 +0000 Subject: [PATCH 522/657] decomp: clarify names in emit_toxic_gas_vent_sparks offset -> spark_spawn_offset: C Vec4 offset maps to original Ghidra auStack_e0, retail sp+0x80 (s2 initialized at 0x002f3f8c). At 0x002f3f98 a scalar is sampled between 0 and 1; 0x002f3fa8 scales spark_emission_step into that vector. At 0x002f3fb0-0x002f3fbc it is added to vent position s6 (vent_moby+0x10) to form at, passed as spawn_spark's position at 0x002f4010-0x002f4014. The same displacement construction repeats at 0x002f4074-0x002f4098 before the second spawn at 0x002f40ec, proving a spark spawn offset relative to the vent. --- src/overlays/l06/mobys/toxic_gas_vent.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l06/mobys/toxic_gas_vent.c b/src/overlays/l06/mobys/toxic_gas_vent.c index 00b33aafee..5f28a573c2 100644 --- a/src/overlays/l06/mobys/toxic_gas_vent.c +++ b/src/overlays/l06/mobys/toxic_gas_vent.c @@ -186,7 +186,7 @@ void emit_toxic_gas_vent_sparks(char *vent_moby) { Vec4 at; Vec4 spark_emission_step; Vec4 drift; - Vec4 offset; + Vec4 spark_spawn_offset; Vec4 spark_spread_with_drift; Vec4 sphere; Vec4 *pos = (Vec4 *)&MOBY(vent_moby)->pos; @@ -225,8 +225,8 @@ void emit_toxic_gas_vent_sparks(char *vent_moby) { fade = sampled_frame_count; frames = truncate_float_to_s32(scale_game_frames(spark_frames)); - fast_vec_scale(&offset, &spark_emission_step, random_float_between(0.0f, 1.0f)); - fast_vec_add(&at, pos, &offset); + fast_vec_scale(&spark_spawn_offset, &spark_emission_step, random_float_between(0.0f, 1.0f)); + fast_vec_add(&at, pos, &spark_spawn_offset); random_vector(&spark_spread_with_drift, 0.0f, spark_spread * frame_time); fast_vec_add(&spark_spread_with_drift, &spark_spread_with_drift, &drift); spawn_spark(&at, @@ -241,8 +241,8 @@ void emit_toxic_gas_vent_sparks(char *vent_moby) { life = truncate_float_to_s32(scale_time(random_float_between(spark_life_min, spark_life_max))); fade = truncate_float_to_s32(scale_time(random_float_between(spark_fade_min, spark_fade_max))); - fast_vec_scale(&offset, &spark_emission_step, random_float_between(0.0f, 1.0f)); - fast_vec_add(&at, pos, &offset); + fast_vec_scale(&spark_spawn_offset, &spark_emission_step, random_float_between(0.0f, 1.0f)); + fast_vec_add(&at, pos, &spark_spawn_offset); random_vector(&spark_spread_with_drift, 0.0f, spark_spread * frame_time); fast_vec_add(&spark_spread_with_drift, &spark_spread_with_drift, &drift); spawn_spark(&at, From 58187bd41344607e0d3d4c18d766de127d6cefd4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:02:13 +0000 Subject: [PATCH 523/657] decomp: clarify names in spawn_hoven_anklebiter_death_sparks count -> burst_count: In bound src/overlays/l12/mobys/hoven_anklebiter.c (SHA-256 969e5a95b4887e258b30fe0caf8c5e1f485df35e66fb2c2dc0c7c52f1d28c263), count loads l12_anklebiter_spark_burst_count and bounds outer i, whose body copies/jitters an origin and constructs launch velocity before the inner sparks-per-burst loop. Retail 0x002e30e0 loads s8, 0x002e30f8-0x002e3114 scales it by 1.5 for state 15, and 0x002e33cc-0x002e33d0 compares the outer counter against s8. Original decompilation expresses this bound as iVar1, distinct from the inner D_L12_00161840 count. size -> spark_vector_w_scale: The bound C assigns size = random_float_between(0.5f, 1.5f) inside the per-spark loop and uses it only as a shared multiplier for spark_launch_velocity[3] and gravity_adjusted_spark_velocity[3]. Retail 0x002e32b8-0x002e32c4 obtains that random f0, 0x002e32cc-0x002e32e0 multiplies it by the two global coefficients, and 0x002e32e4/0x002e32ec store products at sp+0x2c/sp+0x3c, the fourth components of vectors at sp+0x20/sp+0x30. Original decompilation fStack_104 feeds both products; downstream visual size semantics are not needed for this data-flow name. --- src/overlays/l12/mobys/hoven_anklebiter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l12/mobys/hoven_anklebiter.c b/src/overlays/l12/mobys/hoven_anklebiter.c index 976a579d72..9bbaa20751 100644 --- a/src/overlays/l12/mobys/hoven_anklebiter.c +++ b/src/overlays/l12/mobys/hoven_anklebiter.c @@ -764,7 +764,7 @@ void spawn_hoven_anklebiter_death_sparks(struct Moby *moby) { float gravity_adjusted_spark_velocity[4]; float push[4]; char *spark_moby_vars; - int count; + int burst_count; float *pos_ptr; void *moby_position_source; int i; @@ -772,18 +772,18 @@ void spawn_hoven_anklebiter_death_sparks(struct Moby *moby) { float angle; float speed; float rise; - float size; + float spark_vector_w_scale; float time_base; int start_color; int end_color; int life; int fade; - count = l12_anklebiter_spark_burst_count; + burst_count = l12_anklebiter_spark_burst_count; spark_moby_vars = (char *)moby->pvars; if (moby->state == ANKLEBITER_DEATH_EFFECTS_AND_REMOVE) - count = truncate_float_to_s32((float)count * 1.5f); - for (i = 0; i < count; i++) { + burst_count = truncate_float_to_s32((float)burst_count * 1.5f); + for (i = 0; i < burst_count; i++) { pos_ptr = pos; moby_position_source = &moby->pos; qcopy_nc(pos, moby_position_source); @@ -810,9 +810,9 @@ void spawn_hoven_anklebiter_death_sparks(struct Moby *moby) { l12_anklebiter_spark_downward_velocity_scale * D_0015ED70 * (float)scale_game_frames(l12_anklebiter_spark_fade_frames); for (j = 0; j < l12_anklebiter_sparks_per_burst; j++) { - size = random_float_between(0.5f, 1.5f); - spark_launch_velocity[3] = size * D_L12_00161864; - gravity_adjusted_spark_velocity[3] = size * D_L12_00161868; + spark_vector_w_scale = random_float_between(0.5f, 1.5f); + spark_launch_velocity[3] = spark_vector_w_scale * D_L12_00161864; + gravity_adjusted_spark_velocity[3] = spark_vector_w_scale * D_L12_00161868; add_random_offset_to_vector_xyz(pos, l12_anklebiter_spark_position_jitter); add_random_offset_to_vector_xyz(gravity_adjusted_spark_velocity, l12_anklebiter_spark_velocity_jitter_scale * From ecf3df568bdf09186d2b02092ed88595e4041b3b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:02:13 +0000 Subject: [PATCH 524/657] decomp: clarify names in data_processor_linked_effect_update timer -> fade_duration_frames: Authoritative source assigns timer = data_processor_linked_effect_fade_duration_seconds_gp * 60.0f, then passes it through truncate_float_to_s32 and scale_game_frames to initialize linked_effect_vars->timer_34. Retail 0x002da460-0x002da470 loads 60.0 and the duration at GP-0x4f68 and multiplies them into f12; calls at 0x002da474 and 0x002da47c convert and scale before the store to pvars+0x34 at 0x002da484. Original Ghidra likewise feeds fGpffffb098 * 60.0 through these calls into pfVar4[0xd]. Supplied renderer uses that countdown divided by the scaled same duration to produce state-2 alpha, proving the fade purpose. --- src/overlays/l10/mobys/data_processor_linked_effect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l10/mobys/data_processor_linked_effect.c b/src/overlays/l10/mobys/data_processor_linked_effect.c index 458fb60b3b..df3b6680ae 100644 --- a/src/overlays/l10/mobys/data_processor_linked_effect.c +++ b/src/overlays/l10/mobys/data_processor_linked_effect.c @@ -98,14 +98,14 @@ void data_processor_linked_effect_update(struct Moby *moby) { } while (copy_index < linked_effect_vars->strip_count); } { - float timer; + float fade_duration_frames; float new_rotation = fast_add_rotations(moby->rot.z, 1.5707964f); moby->update_dist = 0x60; moby->state = MOBY_STATE_ACTIVE_WITH_SOUND; - timer = data_processor_linked_effect_fade_duration_seconds_gp * 60.0f; + fade_duration_frames = data_processor_linked_effect_fade_duration_seconds_gp * 60.0f; moby->rot.z = new_rotation; linked_effect_vars->voice = -1; - linked_effect_vars->timer_34 = scale_game_frames(truncate_float_to_s32(timer)); + linked_effect_vars->timer_34 = scale_game_frames(truncate_float_to_s32(fade_duration_frames)); } moby->flags |= 0x41; From 6334a04ddaebf951eb291ddd187f6cf2094f4b25 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:02:13 +0000 Subject: [PATCH 525/657] decomp: clarify names in bombomatic_bomb_update size -> explosion_effect_size: Authoritative bomb.c SHA-256 5619ccbbe5941abee53cdd100729b38e4bcfc2c3cdad0795b96add5d58ad0adc declares float size once and passes it only to spawn_explosion's fG slot in all four branches. Original retail Ghidra uVar9 is 0 or 0x41200000. Retail 0x0030bcf8 clears f20; variant remainder zero at 0x0030bcfc-0x0030bd10 selects 10.0f. 0x0030bd6c/0x0030bdcc/0x0030be34/0x0030be84 move f20 to f18 before the 0x0030beb4 explosion call. Checked level-07 helper 0x00286f04 preserves f18 in f26; 0x00287998-0x002879b4 skips the optional effect when zero or effects are reduced. 0x002879c0-0x002879d4 copies the explosion position and places f26 in its fourth component for a query. For a positive size, 0x002879e4-0x00287a04 copies f26 equally into effect-template fields at 0x001b02f0, 0x001b02f4 and 0x001b02f8, then 0x00287a44-0x00287a54 passes that template and explosion position to the effect call. Thus explosion_effect_size identifies the domain of this optional effect sizing scalar without asserting its visual subtype. --- src/overlays/l07/mobys/bomb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l07/mobys/bomb.c b/src/overlays/l07/mobys/bomb.c index 3681bea13a..98a2c6ee17 100644 --- a/src/overlays/l07/mobys/bomb.c +++ b/src/overlays/l07/mobys/bomb.c @@ -111,7 +111,7 @@ void bombomatic_bomb_update(struct Moby *moby) { Vec4f *pos = &moby->pos; DebrisVars *debris_vars = (DebrisVars *)moby->pvars; Vec4 previous_debris_position; - float size; + float explosion_effect_size; qcopy(&previous_debris_position, pos); fast_vec_add(pos, pos, debris_vars); @@ -122,9 +122,9 @@ void bombomatic_bomb_update(struct Moby *moby) { coll_sphere(0.5f, pos, 0, debris_vars->ignore) != 0) { if (debris_target == NULL || (u16)(debris_target->oclass - 0x371) >= 2) { if (moby->visible != 0 || vector_distance_xy(pos, &hero.motion.pos) < 5.0f) { - size = 0.0f; + explosion_effect_size = 0.0f; if (debris_vars->variant % 3 == 0) { - size = 10.0f; + explosion_effect_size = 10.0f; } if (vector_distance_xy(pos, debris_far_point) > 50.0f) { if (debris_vars->variant & 1) { @@ -141,7 +141,7 @@ void bombomatic_bomb_update(struct Moby *moby) { 1000.0f, 1.3f, -1, - size, + explosion_effect_size, 0, 1, -1, @@ -160,7 +160,7 @@ void bombomatic_bomb_update(struct Moby *moby) { 1000.0f, 1.2f, 0, - size, + explosion_effect_size, 0, 1, -1, @@ -181,7 +181,7 @@ void bombomatic_bomb_update(struct Moby *moby) { 1000.0f, 1.0f, 0, - size, + explosion_effect_size, 0, 1, -1, @@ -200,7 +200,7 @@ void bombomatic_bomb_update(struct Moby *moby) { 1000.0f, 1.0f, 0, - size, + explosion_effect_size, 0, 1, -1, From 8515377be2aa404ebd837740a03bd21647b23360 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:02:13 +0000 Subject: [PATCH 526/657] decomp: clarify names in spawn_particle_line_effect count -> line_puff_count: Retail 0x002da40c saves count in s7; 0x002da424 converts it for (to-from)/count and 0x002da4a0 for the scalar difference divisor. At 0x002da620-0x002da628 i/s5 increments and compares against s7, controlling one spawn_puff call at 0x002da5b4 per iteration. Original Ghidra param_6 and iVar7 confirm it counts line-puff spawn attempts, excluding the two subsequent endpoint effects. size -> puff_scalar_range_end: Source size receives random_float_between(1.0f,1.02f); retail 0x002da570/0x002da578 preserves that result in f20 and 0x002da594 passes it in f14 to puff helper 0x002772c8. Checked helper 0x002772f4 saves f14 in f24, then 0x00277420-0x0027742c calls random_float_between with f13/f23 (caller constant 1.0) and f14/f24 as the range endpoints, storing the sampled scalar at puff+0x2C. Thus this local is the endpoint of the puff scalar random range, rather than a proven geometric size. --- src/overlays/l08/spawn_particle_line_effect.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l08/spawn_particle_line_effect.c b/src/overlays/l08/spawn_particle_line_effect.c index 2a36d74ff2..f1c1ad5062 100644 --- a/src/overlays/l08/spawn_particle_line_effect.c +++ b/src/overlays/l08/spawn_particle_line_effect.c @@ -26,24 +26,24 @@ void spawn_particle_line_effect(struct Moby *moby, void spawn_particle_line_effect( - struct Moby *moby, void *from, void *to, int count, f32 size0, f32 size1) { + struct Moby *moby, void *from, void *to, int line_puff_count, f32 size0, f32 size1) { Vec4 step; Vec4 puff_spawn_position; Vec4 effect_initial_velocity; f32 grow; - f32 size; + f32 puff_scalar_range_end; unsigned char *puff; unsigned char *tail; int alpha, grey; int i; fast_vec_sub(&step, to, from); - fast_vec_scale(&step, &step, 1.0f / (f32)count); - grow = (size1 - size0) / (f32)count; + fast_vec_scale(&step, &step, 1.0f / (f32)line_puff_count); + grow = (size1 - size0) / (f32)line_puff_count; effect_initial_velocity.q = 0; effect_initial_velocity.f[3] = 1.0f; effect_initial_velocity.f[2] = 0.01f; - for (i = 0; i < count; i++) { + for (i = 0; i < line_puff_count; i++) { fast_vec_scale(&puff_spawn_position, &step, convert_integer_to_float(i)); fast_vec_add(&puff_spawn_position, from, &puff_spawn_position); effect_initial_velocity.f[0] = randf_sym(0.0f, 0.005f); @@ -54,11 +54,11 @@ void spawn_particle_line_effect( alpha = random_int_between(0x30, 0x70); grey = random_int_between(0x30, 0x7F); grey |= (grey << 16) | (grey << 8); - size = random_float_between(1.0f, 1.02f); + puff_scalar_range_end = random_float_between(1.0f, 1.02f); puff = spawn_puff(&puff_spawn_position, line_puff_position_jitter_range_end_gp, 1.0f, - size, + puff_scalar_range_end, random_int_between(-2, 2), &effect_initial_velocity, grow + size0 * 210000.0f, From cf09b66ac04abdd4aefc81b1f8affa5d3b0d60bc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:04:05 +0000 Subject: [PATCH 527/657] decomp: clarify names in actuator_calc_power count -> active_wave_count: Source initializes count to zero, increments it only after actuator_wave[i].f00 != 0, and returns it. Retail 001e8d38 initializes s5=0; 001e8d90-001e8d94 skips zero wave selectors; 001e8d9c increments s5 before countdown expiry clearing at 001e8db8 and delay skipping at 001e8dc8-001e8dd8; 001e90ec returns s5. Thus it counts initially active wave entries, including delayed or newly expired ones. --- src/input/actuator_calc_power.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/input/actuator_calc_power.c b/src/input/actuator_calc_power.c index 75a86672b1..b5b94d0b74 100644 --- a/src/input/actuator_calc_power.c +++ b/src/input/actuator_calc_power.c @@ -19,9 +19,9 @@ s32 actuator_calc_power(s32 *output_power) { s32 *power_wave_counts; s32 *scale_wave_counts; s32 i; - s32 count; + s32 active_wave_count; - count = 0; + active_wave_count = 0; scale_wave_counts = aa[1]; power_wave_counts = aa[2]; for (i = 0; i < 2; i++) { @@ -40,7 +40,7 @@ s32 actuator_calc_power(s32 *output_power) { continue; } wave_entry = &actuator_wave[i]; - count++; + active_wave_count++; wave_countdown = actuator_wave[i].f06; actuator_wave[i].f06 = wave_countdown - 1; if ((s16)wave_countdown <= 0) { @@ -130,7 +130,7 @@ s32 actuator_calc_power(s32 *output_power) { output_power[i] = (output_power[i] * aa[0][i]) / 255; } } - return count; + return active_wave_count; } extern __typeof__(actuator_calc_power) func_001E8D08 __attribute__((alias("FUN_001e8d08"))); From cdd82706916549c87f61b363df9ade49c6ec2e65 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:05:57 +0000 Subject: [PATCH 528/657] decomp: clarify names in steer_blarg_trooper_toward_point count -> low_movement_frame_count: In the authoritative C, count reads pvars+0x243 after its increment when fast_vec_dist(current position, trooper_pre_move_position) < frame_time*0.5. Retail 0x002e8bb8-0x002e8bc8 loads, increments, stores and zero-extends that byte into s0; 0x002e8bc4-0x002e8bdc compares it against scale_game_frames(15) and sets turn-only byte +0x242. Retail 0x002e8be0 clears +0x243 when movement exceeds the threshold. Original Ghidra bVar3 follows the same load/increment/store/comparison data flow. --- src/overlays/l12/mobys/blarg_trooper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l12/mobys/blarg_trooper.c b/src/overlays/l12/mobys/blarg_trooper.c index f306fe7593..96bb45ad96 100644 --- a/src/overlays/l12/mobys/blarg_trooper.c +++ b/src/overlays/l12/mobys/blarg_trooper.c @@ -735,7 +735,7 @@ void steer_blarg_trooper_toward_point(struct Moby *moby, float path_constrained_position[4] __attribute__((aligned(16))); float path_constraint_test_position[4] __attribute__((aligned(16))); float delta[4] __attribute__((aligned(16))); - int count; + int low_movement_frame_count; if (*(unsigned char *)(trooper_steering_vars + 0x242)) { float *rotation = &moby->rot.z; @@ -793,8 +793,8 @@ void steer_blarg_trooper_toward_point(struct Moby *moby, *(OvlQuad *)&moby->pos = *(OvlQuad *)path_constrained_position; if (fast_vec_dist(&moby->pos, trooper_pre_move_position) < frame_time * 0.5f) { ++*(unsigned char *)(trooper_steering_vars + 0x243); - count = *(unsigned char *)(trooper_steering_vars + 0x243); - if (scale_game_frames(15) < count) + low_movement_frame_count = *(unsigned char *)(trooper_steering_vars + 0x243); + if (scale_game_frames(15) < low_movement_frame_count) *(unsigned char *)(trooper_steering_vars + 0x242) = 1; } else { *(unsigned char *)(trooper_steering_vars + 0x243) = 0; From 4676e657191377929eeb4b05dfe6b99315378c17 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:05:57 +0000 Subject: [PATCH 529/657] decomp: clarify names in update_gemlik_trail timer -> trail_frames_remaining: In source snapshot src/overlays/l13/mobys/blarg_space_commando.c SHA-256 3229156e398a1af15e0e89f884679dd69051164f286dca96574d17a27a7ff559, initialize_gemlik_trail stores scale_game_frames(l13_gemlik_trail_lifetime_frames) at pvars+0x1fc, the anchor.w field. Retail 0x00309538-0x00309554 converts that float into the int local at sp+0x50, passes its address to fast_dec_timer and writes the decremented value back as float. At 0x00309558-0x00309560 zero skips all trail processing; 0x00309584 compares the remaining count with 20 before clamping the sixteen point.w values. The original Ghidra iStack_d0 follows the same data flow, proving remaining trail lifetime frames. --- src/overlays/l13/mobys/blarg_space_commando.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l13/mobys/blarg_space_commando.c b/src/overlays/l13/mobys/blarg_space_commando.c index c479a25841..9551cec6e9 100644 --- a/src/overlays/l13/mobys/blarg_space_commando.c +++ b/src/overlays/l13/mobys/blarg_space_commando.c @@ -867,17 +867,17 @@ void update_gemlik_trail(struct Moby *moby) { TrailHit_94f8 hit; } work; TrailPoint_94f8 upper, lower; - int timer, i, j, clamp_count; + int trail_frames_remaining, i, j, clamp_count; char *clamp_cursor; float prior_height, dot; - timer = truncate_float_to_s32(gemlik_trail_vars->anchor.w); - fast_dec_timer(&timer); - gemlik_trail_vars->anchor.w = (float)timer; - if (!timer) + trail_frames_remaining = truncate_float_to_s32(gemlik_trail_vars->anchor.w); + fast_dec_timer(&trail_frames_remaining); + gemlik_trail_vars->anchor.w = (float)trail_frames_remaining; + if (!trail_frames_remaining) return; - if (timer == 20) { + if (trail_frames_remaining == 20) { for (clamp_cursor = (char *)gemlik_trail_vars, clamp_count = 15; clamp_count >= 0; clamp_count--, clamp_cursor += 16) { if (*(float *)(clamp_cursor + 0x21c) >= 1.0f) From b7c8520de97d835cb1c1e38b708a46caec1e4aa5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:05:57 +0000 Subject: [PATCH 530/657] decomp: clarify names in spawn_shuttle_explosion_effect count -> particle_count: In src/overlays/l06/mobys/shuttle.c (SHA-256 cc586be15cccdb929d9d8ba8455f7e3342d1a7973e05d4a452ece05e54294eb5), count bounds the first spawn_particle loop and scales the spark loop. Retail incoming a3 is saved at 0x00303774, loaded at 0x0030381c, copied to s4 at 0x00303840 and decremented at 0x00303850 once per spawn_particle call at 0x003038e0. Retail 0x003038f0-0x003038fc and 0x00303b10-0x00303b20 multiply this same argument by D_L06_00162150 for spark emissions. Thus it counts primary particle emissions and proportionally controls sparks. size -> spark_timing_frames: The authoritative source assigns size from truncation of scale_time(random_float_between(float(l06_shuttle_explosion_spark_timing_base_a_frames), base*1.2f)), then passes it as spawn_spark argument seven. Retail 0x00303a78-0x00303aa4 loads integer frame base D_L06_00162148, samples [base,1.2*base], calls scale_time and truncation; 0x00303abc preserves this result in s0 and 0x00303af4 passes it in t2 to 0x00303b08. Checked level-06 helper 0x00277ef4 saves t2, then 0x00278030-0x00278034 stores it as a halfword at particle+0x32. This proves a frame timing input, without asserting an unverified phase or visual size. --- src/overlays/l06/mobys/shuttle.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l06/mobys/shuttle.c b/src/overlays/l06/mobys/shuttle.c index 6fc7b27e94..840d3e52bf 100644 --- a/src/overlays/l06/mobys/shuttle.c +++ b/src/overlays/l06/mobys/shuttle.c @@ -692,7 +692,7 @@ void spawn_shuttle_explosion_effect( void spawn_shuttle_explosion_effect( - float scale, char *moby, char *explosion_origin, char *push, int count) { + float scale, char *moby, char *explosion_origin, char *push, int particle_count) { float position[4], direction[4], velocity[4], acceleration[4]; Colors first_colors, second_colors; int i; @@ -702,7 +702,7 @@ void spawn_shuttle_explosion_effect( second_colors = D_L06_00201960; { int piece; - for (piece = 0; piece < count; piece++) { + for (piece = 0; piece < particle_count; piece++) { int *first_color = first_colors.v + random_integer_below(6); int *second_color; int first_time, second_time; @@ -732,8 +732,8 @@ void spawn_shuttle_explosion_effect( frame_time * 10.0f * scale); } } - for (i = 0; i < count * D_L06_00162150;) { - int color1, color2, life, size, fade; + for (i = 0; i < particle_count * D_L06_00162150;) { + int color1, color2, life, spark_timing_frames, fade; i++; random_vector(position, 0.0f, 1.0f); fast_vec_add(position, position, explosion_origin); @@ -769,7 +769,7 @@ void spawn_shuttle_explosion_effect( life = truncate_float_to_s32(scale_time(random_float_between( (float)l06_shuttle_explosion_spark_timing_random_min_frames, (float)(l06_shuttle_explosion_spark_timing_random_min_frames << 1)))); - size = truncate_float_to_s32(scale_time( + spark_timing_frames = truncate_float_to_s32(scale_time( random_float_between((float)l06_shuttle_explosion_spark_timing_base_a_frames, (float)l06_shuttle_explosion_spark_timing_base_a_frames * 1.2f))); fade = truncate_float_to_s32(scale_time( @@ -781,7 +781,7 @@ void spawn_shuttle_explosion_effect( color1, color2, life, - size, + spark_timing_frames, fade, l06_shuttle_explosion_spark_table_index + (l06_shuttle_explosion_spark_alternate_mode_flag << 16)); From 7bb469cbdab1c57b7bcff9ea878590a5b8f313c4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:05:57 +0000 Subject: [PATCH 531/657] decomp: clarify names in draw_conveyor_belt_strips count -> interior_strip_count: In the authoritative C, count is truncate_float_to_s32(scale), limit=count+2, and strip iterates from 0 to limit-1. Retail 0x002c9d30-0x002c9d3c saves the converted length-derived value in s7; 0x002c9dd4 forms s6=s7+2, and 0x002c9f98 forms s1=s7+1. The branches at 0x002c9fa0 and 0x002c9fbc fade the first and last strips; paired quad calls at 0x002ca008/0x002ca028 run for every strip. Thus positions 1 through count are the interior strips, with two additional end strips. --- src/overlays/l16/mobys/conveyor_belt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l16/mobys/conveyor_belt.c b/src/overlays/l16/mobys/conveyor_belt.c index f925d1a22e..5a19964a73 100644 --- a/src/overlays/l16/mobys/conveyor_belt.c +++ b/src/overlays/l16/mobys/conveyor_belt.c @@ -220,7 +220,7 @@ void draw_conveyor_belt_strips(struct Moby *moby) { modebits = 0x8000000000L; period = scale_game_frames(120); flags = 0xFF9000000260L; - limit = count + 2; + limit = interior_strip_count + 2; phase = convert_integer_to_float(D_L16_0015F5CC % period); phase = phase / convert_integer_to_float(period); phase = fast_sin(phase * 6.28318f - 3.14159f) * 0.5f + 0.5f; @@ -268,7 +268,7 @@ void draw_conveyor_belt_strips(struct Moby *moby) { packets[0].color[0] = 0; packets[1].color[1] = 0; packets[1].color[0] = 0; - } else if (strip == count + 1) { + } else if (strip == interior_strip_count + 1) { packets[0].color[3] = 0; packets[0].color[2] = 0; packets[1].color[3] = 0; From 2c3e38f81563a74bc434d82689f555f2024a490f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:05:58 +0000 Subject: [PATCH 532/657] decomp: clarify names in draw_grindrail_barrier_effect count -> accent_draw_countdown: Authoritative source src/overlays/shared/props/grindrail_barrier.c (SHA-256 df995d7ea005a6209eb32f42bc5f47dd653cbe9c94acc6b40ec6c5184d915542) declares count in the final accent loop, initializes it to 3, reads angles[3 - count], and decrements through 0. Original retail decompilation agrees: its final iVar12 countdown accompanies successive cardinal-angle loads and four draw calls. Retail 002e5a44 derives the cardinal-angle pointer from private data +0x10; 002e5c44-002e5c4c copies that pointer and initializes s2 to 3; 002e5c50-002e5c6c reads each float angle, advances the pointer by 4, builds the rotation basis and decrements s2; 002e5c78-002e5c84 draws the accent quad and repeats while s2 is nonnegative. This proves an accent-draw countdown rather than a ring-quad count. --- src/overlays/shared/props/grindrail_barrier.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/props/grindrail_barrier.c b/src/overlays/shared/props/grindrail_barrier.c index 4c3bf0b543..fdd3b6fbb5 100644 --- a/src/overlays/shared/props/grindrail_barrier.c +++ b/src/overlays/shared/props/grindrail_barrier.c @@ -204,9 +204,9 @@ void draw_grindrail_barrier_effect(char *barrier_moby) { } } { - int count; - for (count = 3; count >= 0; --count) { - rotation[0] = angles[3 - count]; + int accent_draw_countdown; + for (accent_draw_countdown = 3; accent_draw_countdown >= 0; --accent_draw_countdown) { + rotation[0] = angles[3 - accent_draw_countdown]; euler_rotation_basis(transform, rotation); draw_geometry_quad(&quad, transform, 0); } From 9784af025c7914b86cf2e59da59adcc280b4bdf6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:05:58 +0000 Subject: [PATCH 533/657] decomp: clarify names in plasmabot_death_debris_update size -> particle_size: In the SHA-256 d561b5601c7d912a9e137c92479031c0f597f55c80637c6ee0ea84aa39cb0cea source, f32 size receives random_float_between(40000.0f, 100000.0f) inside the two-particle loop and is used only as the size argument to FUN_L00_0026d000_de670. Retail 0x002de9c0..0x002de9e0 produces and saves this float in f20; 0x002dea10 moves it to f15 before the particle helper call at 0x002dea28. Bounded helper instructions at 0x00274cc4 preserve f15 in f22 and 0x00274d2c stores it at returned particle+0x0c. Thus particle_size clarifies the established size scalar's owning particle; no units or radius/diameter interpretation is asserted. --- src/overlays/shared/enemies/plasmabot_death_debris.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot_death_debris.c b/src/overlays/shared/enemies/plasmabot_death_debris.c index 97698f4712..1df475398b 100644 --- a/src/overlays/shared/enemies/plasmabot_death_debris.c +++ b/src/overlays/shared/enemies/plasmabot_death_debris.c @@ -60,7 +60,7 @@ void plasmabot_death_debris_update(struct Moby *moby) { s32 signed_particle_variation; s32 alpha; s32 color; - f32 size; + f32 particle_size; f32 absolute_velocity; u8 *particle; u8 *fade; @@ -125,7 +125,7 @@ void plasmabot_death_debris_update(struct Moby *moby) { signed_particle_variation = random_integer_below(6); if (random_integer_below(2) != 0) signed_particle_variation = -signed_particle_variation; - size = random_float_between(40000.0f, 100000.0f); + particle_size = random_float_between(40000.0f, 100000.0f); color = random_int_between(0x30, 0xFF); alpha = 0x60000000; particle = FUN_L00_0026d000_de670(&moby->pos, @@ -134,7 +134,7 @@ void plasmabot_death_debris_update(struct Moby *moby) { 1.0f, signed_particle_variation, D_L14_0015F580, - size, + particle_size, color | ((color << 16) | ((color << 8) | alpha))); if (particle != 0) { particle[3] = 0x44; From 52f0690a19305967841ee680ef72f4fe569f71b7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:05:58 +0000 Subject: [PATCH 534/657] decomp: clarify names in draw_vendor_purchase_text size -> box_byte_count: In source snapshot src/overlays/shared/vendor/draw_vendor_purchase_text.c SHA-256 f67f3b851b4311870276e6714f1fd71b3610cbdf0bf4c466466d428a3decc01b, s32 size = sizeof(box) is used only as memset((void *)&box, 0, size)'s byte-count argument. Original retail decompilation calls func_0x001153fc(auStack_180,0,0x18); instructions 0x0029eb20 move a0,sp, 0x0029eb24 move a1,zero, and 0x0029eb28 jal 0x001153fc with 0x0029eb2c li a2,0x18 prove the 24-byte box initialization extent. --- src/overlays/shared/vendor/draw_vendor_purchase_text.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/vendor/draw_vendor_purchase_text.c b/src/overlays/shared/vendor/draw_vendor_purchase_text.c index b6251902de..a66622b287 100644 --- a/src/overlays/shared/vendor/draw_vendor_purchase_text.c +++ b/src/overlays/shared/vendor/draw_vendor_purchase_text.c @@ -47,8 +47,8 @@ void draw_vendor_purchase_text(void *moby, s32 x, s32 y) { draw_framebuffer_rect(0, 0, 0x200, 0x80, 0x200, 0x80, 0); { - s32 size = sizeof(box); - memset((void *)&box, 0, size); + s32 box_byte_count = sizeof(box); + memset((void *)&box, 0, box_byte_count); } box.half_x = x / 2; box.half_y = y / 2; From 7e01794f2fabced1e89d54701e5d882706d55b46 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:05:58 +0000 Subject: [PATCH 535/657] decomp: clarify names in spawn_homing_shot timer -> shot_lifetime_and_spark_lifetime_max_frames: In source src/overlays/shared/weapons/blaster_shot.c (SHA-256 71b66ef7031791c172ae39984764c99489b3509d328f7f0e851f38ce6ba48945), int timer receives scale_game_frames(0x23) plus variant[0xF]*10. Retail 002cb084..002cb0cc calls frame scaling, adds the variant term and stores the same duration at homing_shot_vars+0x26 (life) and +0x24 (timer); existing homing_shot_update decrements +0x24 and uses life-timer. The same C binding is reassigned scale_game_frames(15) in the collision spark loop. Retail 002cb208..002cb218 passes that returned duration as the second/upper bound to random_int_between, with scale_game_frames(10) as the lower bound; 002cb22c..002cb238 passes the random lifetime to FUN_L00_0026dd20. Supplied particle helper stores lifetime at particle_data+0x10 and +0x14. Thus this is initial shot lifetime followed by maximum spark lifetime, measured in game frames. --- src/overlays/shared/weapons/blaster_shot.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/weapons/blaster_shot.c b/src/overlays/shared/weapons/blaster_shot.c index d44f723c48..e0fb4a4511 100644 --- a/src/overlays/shared/weapons/blaster_shot.c +++ b/src/overlays/shared/weapons/blaster_shot.c @@ -133,7 +133,7 @@ char *spawn_homing_shot( char *trail; unsigned char *variant; int collision_hit_lifetime_min_and_alpha_scratch; - int timer; + int shot_lifetime_and_spark_lifetime_max_frames; int lifetime; int i; int sparks; @@ -174,12 +174,12 @@ char *spawn_homing_shot( *(float *)(homing_shot_vars + 0x1C) = vy; *(int *)(homing_shot_vars + 0x10) = 0; *(int *)(homing_shot_vars + 0x14) = 0; - timer = scale_game_frames(0x23); + shot_lifetime_and_spark_lifetime_max_frames = scale_game_frames(0x23); variant = item_text_variant; - timer = timer + variant[0xF] * 10; + shot_lifetime_and_spark_lifetime_max_frames = shot_lifetime_and_spark_lifetime_max_frames + variant[0xF] * 10; *(int *)(homing_shot_vars + 0x28) = 0; - *(short *)(homing_shot_vars + 0x24) = timer; - *(short *)(homing_shot_vars + 0x26) = timer; + *(short *)(homing_shot_vars + 0x24) = shot_lifetime_and_spark_lifetime_max_frames; + *(short *)(homing_shot_vars + 0x26) = shot_lifetime_and_spark_lifetime_max_frames; *(w128 *)probe = *(w128 *)&MOBY(firing_moby)->pos; probe[2] = start[2]; collision_hit_lifetime_min_and_alpha_scratch = @@ -204,8 +204,8 @@ char *spawn_homing_shot( fast_vec_normalize( spark, spark, random_float_between(D_0015ED6C * 3.0f, D_0015ED6C * 6.0f)); collision_hit_lifetime_min_and_alpha_scratch = scale_game_frames(10); - timer = scale_game_frames(15); - lifetime = random_int_between(collision_hit_lifetime_min_and_alpha_scratch, timer); + shot_lifetime_and_spark_lifetime_max_frames = scale_game_frames(15); + lifetime = random_int_between(collision_hit_lifetime_min_and_alpha_scratch, shot_lifetime_and_spark_lifetime_max_frames); FUN_L00_0026dd20(moby + 0x10, (char *)spark, 0x7F2F4F6F, lifetime, 30000.0f); } while (sparks >= 0); variant = item_text_variant; From 242ba72a65fa19654d7b4e421882c15ec3fbdac3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:07:54 +0000 Subject: [PATCH 536/657] decomp: clarify names in pipe_mounted_grating_update size -> particle_size_scale: In the bound source, size is a float sampled by random_float_between(0.4f, 0.5f) inside the ten-iteration particle loop. Retail 0x0030f834-0x0030f858 sets those bounds and retains the return in f20. At 0x0030f878-0x0030f898 it supplies f20*0.2 and f20 as the two float size arguments to the particle helper (source FUN_L00_00272060); 0x0030f8c8-0x0030f8e4 reuses f20*0.14 and f20*0.7 for the second particle. The supplied helper context stores these size inputs scaled by 210000 into particle size storage. Thus this is the shared random particle size scale, rather than a buffer size or piece size. --- src/overlays/l05/mobys/pipe_mounted_grating.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l05/mobys/pipe_mounted_grating.c b/src/overlays/l05/mobys/pipe_mounted_grating.c index 75fafd2cfb..e28d2c70e6 100644 --- a/src/overlays/l05/mobys/pipe_mounted_grating.c +++ b/src/overlays/l05/mobys/pipe_mounted_grating.c @@ -72,7 +72,7 @@ void pipe_mounted_grating_update(struct Moby *moby) { transform_vector_by_basis( particle_spawn_offset, particle_spawn_offset, &moby->rot_row0); for (j = 0; j < 10; j++) { - float size; + float particle_size_scale; random_vector(drift, frame_time * 1.5f, frame_time * 2.0f); fast_vec_scale(pos, drift, 5.0f); fast_vec_add(pos, pos, particle_spawn_offset); @@ -81,11 +81,11 @@ void pipe_mounted_grating_update(struct Moby *moby) { if (spin == 0) { spin--; } - size = random_float_between(0.4f, 0.5f); + particle_size_scale = random_float_between(0.4f, 0.5f); FUN_L00_00272060(pos, scale_game_frames(25), - size * 0.2f, - size, + particle_size_scale * 0.2f, + particle_size_scale, 0x7F207F7F, 0, spin, @@ -94,8 +94,8 @@ void pipe_mounted_grating_update(struct Moby *moby) { spin = -spin; FUN_L00_00272060(pos, scale_game_frames(25), - size * 0.14f, - size * 0.7f, + particle_size_scale * 0.14f, + particle_size_scale * 0.7f, 0x7F7F7F7F, 1, spin, From 28ab6f2cd423ad52ebe7712b7037fee286ec2d5f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:07:55 +0000 Subject: [PATCH 537/657] decomp: clarify names in bolt_thief_mine_update count -> hit_status: In the bound source src/overlays/shared/enemies/bolt_thief_mine.c (SHA-256 64c1d8a603364040fa57a7b9c6ce4f74342b418dfd27d3b626f356d7b64ad070), count is passed by address as the fifth argument to resolve_moby_hit_response, whose supplied context names that parameter hit_status_output. Retail 0x002ff868 sets t0 to sp+0x70 for the call at 0x002ff874; 0x002ff87c loads that output and 0x002ff880 compares it with 2 before the hit-moby/class and explosion gate. Original Ghidra likewise passes aiStack_70 and tests aiStack_70[0] < 2. This proves a hit-status output rather than an entity count. --- src/overlays/shared/enemies/bolt_thief_mine.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/bolt_thief_mine.c b/src/overlays/shared/enemies/bolt_thief_mine.c index d6cea15902..f6e9eb4de8 100644 --- a/src/overlays/shared/enemies/bolt_thief_mine.c +++ b/src/overlays/shared/enemies/bolt_thief_mine.c @@ -80,7 +80,7 @@ void bolt_thief_mine_update(struct Moby *moby) { float sphere[4]; } scratch; float explosion_vector[4]; - int count; + int hit_status; MobyHit *hit; float glow_pulse_sine; int glow_red_intensity; @@ -121,8 +121,8 @@ void bolt_thief_mine_update(struct Moby *moby) { scratch.info.aim_height = 0.5f; scratch.info.look_height = 7; scratch.info.unk3B = 0xFF; - resolve_moby_hit_response(moby, hit, &scratch.info, 0, &count, 0, 0, 4); - if ((count >= 2 && hit != 0 && hit->moby->oclass != 0x283) || + resolve_moby_hit_response(moby, hit, &scratch.info, 0, &hit_status, 0, 0, 4); + if ((hit_status >= 2 && hit != 0 && hit->moby->oclass != 0x283) || hero.coll_hit_moby == (u8 *)moby) { clear_u64_value(explosion_vector); allocate_voice_for_target_entry(0, 0, moby); From 3610aaed891bab705bf71c75b4a60266935c16db Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:09:37 +0000 Subject: [PATCH 538/657] decomp: clarify names in hero_integrate_velocity offset -> reference_to_hero_displacement: Source fast_vec_sub(&offset, hero_pos, hero_pos+0x380) writes the Vec4 displacement from the reference position to the current hero position. Retail 0x00214180..0x0021418c passes sp as destination, 0x0013f3d0 as a1, and a1+0x380 (0x0013f750) as a2 to subtraction at 0x001ff2a8; the prepared Ghidra decompilation shows the same arguments. At 0x00214190..0x00214194 gravity_z projects that stack vector, then 0x002141b0..0x00214234 compares the projection with height thresholds to scale max_speed. --- src/overlays/shared/hero/hero_switch_item.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index d0dfc8d8d8..af1d99f348 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -4206,7 +4206,7 @@ void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); void hero_integrate_velocity(void) { struct Curve *velocity_curve; f32 z; - Vec4 offset; + Vec4 reference_to_hero_displacement; f32 speed; f32 max_speed; s32 boost; @@ -4221,8 +4221,8 @@ void hero_integrate_velocity(void) { if (D_0013D4C2 != 0 && hero.pack_disabled == 0) { boost = hero_slot_item_id(3) == 3; } - fast_vec_sub(&offset, hero_pos, hero_pos + 0x380); - gravity_axis_offset = gravity_z(&offset); + fast_vec_sub(&reference_to_hero_displacement, hero_pos, hero_pos + 0x380); + gravity_axis_offset = gravity_z(&reference_to_hero_displacement); if (boost) { if (2.7f < gravity_axis_offset) { max_speed *= 0.47f; From e7824cbfcbb3166a2edc648188911de62854ecee Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:09:37 +0000 Subject: [PATCH 539/657] decomp: clarify names in draw_hud_stars offset -> star_visibility_y_threshold: In authoritative src/overlays/shared/ui/hud/hud_keep_visible.c (SHA-256 0a60c36d335d6a2495c36825712f5140c2a49c2865100135c29eb42ae9b355de), offset is initialized from (10000 - element->unk74) / 10000.0f and mapped to 116 - 232 times that fraction. Retail 0x00236870-0x00236954 computes this in f21; 0x002369e8 and 0x00236a50 add the current band's inset or inset difference at indices 0, 10 and 30. At 0x00236a64-0x00236a74 the float Y at D_L00_0017E660 + i*16 + 4 is compared with f21 using c.lt.S and the draw path is skipped when f21 < star.y, proving a band-adjusted star visibility Y threshold. The prepared original Ghidra decompilation carries this same flow in fVar13 then fVar10. --- src/overlays/shared/ui/hud/hud_keep_visible.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/ui/hud/hud_keep_visible.c b/src/overlays/shared/ui/hud/hud_keep_visible.c index 9d247baaa6..59a5b9a6a9 100644 --- a/src/overlays/shared/ui/hud/hud_keep_visible.c +++ b/src/overlays/shared/ui/hud/hud_keep_visible.c @@ -427,7 +427,7 @@ int draw_hud_stars(HudElem *element) __asm__("FUN_L00_002365a8"); int draw_hud_stars(HudElem *element) { int x, y, i, previous, current, frames, image, star_width; float origin[4], direction[4], first_step[4], second_step[4], third_step[4], star_position[4]; - float seconds, sixteen, offset, thirty_two; + float seconds, sixteen, star_visibility_y_threshold, thirty_two; { int width = D_L00_0015F760; @@ -523,7 +523,7 @@ int draw_hud_stars(HudElem *element) { fast_vec_sub(direction, direction, first_step); limit = star_init_limit0_gp; star_width = (int)(limit * thirty_two); - offset = offset + limit; + star_visibility_y_threshold = star_visibility_y_threshold + limit; } else if (i == 10) { float limit, previous_limit, width; fast_vec_sub(direction, direction, second_step); @@ -532,7 +532,7 @@ int draw_hud_stars(HudElem *element) { width = limit * thirty_two; limit = limit - previous_limit; star_width = (int)width; - offset = offset + limit; + star_visibility_y_threshold = star_visibility_y_threshold + limit; } else if (i == 30) { float limit, previous_limit, width; fast_vec_sub(direction, direction, third_step); @@ -541,9 +541,9 @@ int draw_hud_stars(HudElem *element) { width = limit * thirty_two; limit = limit - previous_limit; star_width = (int)width; - offset = offset + limit; + star_visibility_y_threshold = star_visibility_y_threshold + limit; } - if (offset < l00_hud_star_particles[i].y) + if (star_visibility_y_threshold < l00_hud_star_particles[i].y) continue; FUN_L00_001ff348(star_position, &l00_hud_star_particles[i], origin); fast_vec_add(star_position, star_position, direction); From 9329519d8dd23a3b36290051af7de070d5598571 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:11:27 +0000 Subject: [PATCH 540/657] decomp: clarify names in turret_rocket_update offset -> trail_secondary_motion: Retail 0x002e835c binds s2 to sp+0x60 (original Ghidra auStack_e0). At 0x002e83b0-0x002e83c4 fast_sin(angle) times randomized frame-scaled magnitude normalizes moby+0xd0 into this vector. At 0x002e83c8-0x002e83d4 it is added to the primary velocity at sp+0x50; 0x002e83d8-0x002e83dc preserves the self-copy and 0x002e83f4 sets its W component. At 0x002e8488-0x002e848c s2 is the third spawn_spark argument in the trail loop. These flows match the authoritative offset array and establish secondary trail particle motion. --- src/overlays/shared/weapons/turret_rocket.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/weapons/turret_rocket.c b/src/overlays/shared/weapons/turret_rocket.c index f673aecc8b..3cbe1c0412 100644 --- a/src/overlays/shared/weapons/turret_rocket.c +++ b/src/overlays/shared/weapons/turret_rocket.c @@ -195,7 +195,7 @@ void turret_rocket_update(char *moby) { float position[4] __attribute__((aligned(16))); float direction[4] __attribute__((aligned(16))); float velocity[4] __attribute__((aligned(16))); - float offset[4] __attribute__((aligned(16))); + float trail_secondary_motion[4] __attribute__((aligned(16))); float angle, magnitude, length, radius, spread; int i, particle_frame_count, particle_second_frame_count, particle_third_frame_count; int *timer_ptr; @@ -220,11 +220,11 @@ void turret_rocket_update(char *moby) { spread = homing_projectile_trail_spread_speed_limit_gp; magnitude = random_float_between(0.0f, spread) * frame_time; fast_vec_normalize(velocity, moby + 0xe0, magnitude * fast_cos(angle)); - fast_vec_normalize(offset, moby + 0xd0, magnitude * fast_sin(angle)); - fast_vec_add(velocity, velocity, offset); - qcopy(offset, offset); + fast_vec_normalize(trail_secondary_motion, moby + 0xd0, magnitude * fast_sin(angle)); + fast_vec_add(velocity, velocity, trail_secondary_motion); + qcopy(trail_secondary_motion, trail_secondary_motion); velocity[3] = homing_projectile_trail_primary_motion_w_gp; - offset[3] = homing_projectile_trail_secondary_motion_w_gp; + trail_secondary_motion[3] = homing_projectile_trail_secondary_motion_w_gp; i++; particle_frame_count = truncate_float_to_s32(scale_game_frames_002e8210( random_float_between((float)l08_turret_rocket_spark_first_frame_count_base, @@ -237,7 +237,7 @@ void turret_rocket_update(char *moby) { (float)l08_turret_rocket_spark_third_frame_count_base * 1.5f))); spawn_spark(position, velocity, - offset, + trail_secondary_motion, homing_projectile_trail_initial_spark_word_gp, homing_projectile_trail_second_spark_word_gp, particle_frame_count, From 7f0171209f6976d7e7b4dda2aa55679f029ffa26 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:11:27 +0000 Subject: [PATCH 541/657] decomp: clarify names in build_packet_and_draw_scaled_entries count -> scaled_surface_entry_count: Retail 002c1988 retains third argument a2 in s6; 002c1d64 skips the entry loop when nonpositive, and 002c1e04 compares the incremented entry index s2 against s6. Instructions 002c1d70/002c1d80 compute list + index*32 for fast_bsphere_check. Original Ghidra param_3 bounds the same loop. The SHA-bound C caller supplies level09_scaled_surface_entries and 10, proving this counts scaled surface entries rather than their float pairs. offset -> offset_vector: The authoritative C declares float offset[4], passes it as the output argument to setup_offset_vector(-1024.0f, offset, D_L09_00166F40), then sets offset[3] = 1.0f. Retail 002c1a2c-002c1a3c supplies -1024.0f in f12, sp+0x30 in a0 and 00166f40 in a1 to helper 0021efe0; 002c1a40-002c1a54 writes 1.0f at sp+0x3c. Original Ghidra auStack_90/uStack_84 agrees. This proves a four-component offset vector output; no subsequent explicit use is asserted. --- src/overlays/l09/draw_level09_textured_surfaces.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l09/draw_level09_textured_surfaces.c b/src/overlays/l09/draw_level09_textured_surfaces.c index ce7ec4d558..7ed23deeb2 100644 --- a/src/overlays/l09/draw_level09_textured_surfaces.c +++ b/src/overlays/l09/draw_level09_textured_surfaces.c @@ -217,7 +217,7 @@ void build_packet_and_draw_scaled_entries(void *data_ptr, void *list_ptr, int count) __asm__("FUN_L09_002c1978"); -void build_packet_and_draw_scaled_entries(void *data_ptr, void *list_ptr, int count) { +void build_packet_and_draw_scaled_entries(void *data_ptr, void *list_ptr, int scaled_surface_entry_count) { enum { TEXTURED_GRID_USE_CURRENT_VIEW_SETTINGS = 1 }; @@ -229,7 +229,7 @@ void build_packet_and_draw_scaled_entries(void *data_ptr, void *list_ptr, int co int *packet; u64 *words; float matrix[12]; - float offset[4]; + float offset_vector[4]; u64 color; int *scratchpad_colors; int scratch_color; @@ -252,8 +252,8 @@ void build_packet_and_draw_scaled_entries(void *data_ptr, void *list_ptr, int co update_view_context(); update_camera_view_matrices(); set_scale_matrix(matrix, 1024.0f); - setup_offset_vector(-1024.0f, offset, D_L09_00166F40); - offset[3] = 1.0f; + setup_offset_vector(-1024.0f, offset_vector, D_L09_00166F40); + offset_vector[3] = 1.0f; vu1_add_data_ref(scaled_entries_vu1_setup_data, l09_scaled_entries_vu1_setup_qword_count[0]); { int *packet; @@ -348,7 +348,7 @@ void build_packet_and_draw_scaled_entries(void *data_ptr, void *list_ptr, int co for (i = 255; i >= 0; i--) scratchpad_colors[i] = scratch_color; i = 0; - if (count > 0) + if (scaled_surface_entry_count > 0) do { char *scaled_surface_entry; int visible; @@ -373,7 +373,7 @@ void build_packet_and_draw_scaled_entries(void *data_ptr, void *list_ptr, int co visible == 0); } i++; - } while (i < count); + } while (i < scaled_surface_entry_count); restore_view_after_textured_grid(surface_draw_settings); } From 7ecbe47611489699f73fb658cc6087b53641a589 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:11:27 +0000 Subject: [PATCH 542/657] decomp: clarify names in barrier_update count -> radial_effect_iteration_count: In the authoritative barrier_update source, count bounds i < count and sets angle += 6.2831855f / convert_integer_to_float(count). Retail 0x0030847c-0x003084b8 stores default 40 or reduced 30 at sp+0x78; 0x003086d8-0x00308700 converts that same integer for 2*pi/count spacing and compares incremented s3 against it. Original Ghidra iStack_d8 has the same uses. The loop constructs radial piece positions, conditionally calls spawn_tumbling_debris at 0x00308680, and calls cart_burst every third iteration at 0x003086d0, proving a radial effect iteration count. --- src/overlays/l09/mobys/barrier.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l09/mobys/barrier.c b/src/overlays/l09/mobys/barrier.c index 618d99a814..a8563b4ee0 100644 --- a/src/overlays/l09/mobys/barrier.c +++ b/src/overlays/l09/mobys/barrier.c @@ -104,7 +104,7 @@ void barrier_update(Moby *moby) { float origin[4], center[4], piece_pos[4], piece_velocity[4], push[4]; Hit_309688 *hit; int has_next; - int count; + int radial_effect_iteration_count; int i; float angle; float scale; @@ -141,12 +141,12 @@ void barrier_update(Moby *moby) { allocate_voice_for_target_entry(0, 0, moby); } moby->hit_slot = 0xFF; - count = 40; + radial_effect_iteration_count = 40; if (0.85f < radial_effect_count_reduction_control || 0.85f < barrier_radial_effect_count_reduction_control) - count = 30; + radial_effect_iteration_count = 30; angle = -3.1415927f; - for (i = 0; i < count; i++) { + for (i = 0; i < radial_effect_iteration_count; i++) { *(u128 *)piece_velocity = 0; piece_velocity[0] = random_float_between(-0.4f, 0.4f); piece_velocity[1] = random_float_between(-0.6f, 0.6f); @@ -173,7 +173,7 @@ void barrier_update(Moby *moby) { if (i % 3 == 0) { cart_burst(moby, piece_pos, -1, random_float_between(0.3f, 0.6f), 0.0f); } - angle = angle + 6.2831855f / convert_integer_to_float(count); + angle = angle + 6.2831855f / convert_integer_to_float(radial_effect_iteration_count); } fast_vec_scale(piece_pos, hit->pos, 0.5f); func_L00_0025F4A8_309688(moby, From 2e14cf95e72a8fb92df39f6a3b64420ecd9c5d81 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:13:16 +0000 Subject: [PATCH 543/657] decomp: clarify names in moving_platform_small_update count -> path_node_count: In PLATFORM_FOLLOW_PATH_NODES, source count = *path reads the selected path header. Retail 0x00294f50 loads the path pointer from pvars+0xC0 and 0x00294f60 loads its first word into v0. 0x00294f74 computes count-1 for the terminal node; 0x00294f70-0x00294f90 adds the count and signed node step to the current node and divides by count to obtain the wrapped next-node index. The resulting index selects 16-byte path node positions at 0x00294f94-0x00294fa4. Original Ghidra case 3 corroborates the header count and modulo use. --- src/overlays/l03/mobys/moving_platform_small.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l03/mobys/moving_platform_small.c b/src/overlays/l03/mobys/moving_platform_small.c index f852b25d69..717c55152b 100644 --- a/src/overlays/l03/mobys/moving_platform_small.c +++ b/src/overlays/l03/mobys/moving_platform_small.c @@ -72,7 +72,7 @@ void moving_platform_small_update(char *moby) { int easing_frame_count; int next_path_node_index; int end; - int count; + int path_node_count; int next_path_node_byte_offset; int node_off; signed char path_node_step; From 6d3858baf086e3fefcd0e3cc11e21af85bfe8de4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:13:16 +0000 Subject: [PATCH 544/657] decomp: clarify names in render_data_processor_linked_effect offset -> strip_transform_byte_offset: Authoritative C assigns offset = i * 0x40 and uses it only as strip_transforms + offset in draw_geometry_quad. Retail 0x002daae4 computes s6 = s3 << 6; 0x002dab58 loads the transform-buffer base from fp+0x16c, and 0x002dab68-0x002dab6c passes base+s6 as the quad draw's transform argument. Original Ghidra agrees: iVar18 = iVar13 * 0x40, followed by func_0x001f0890(auStack_200,puStack_124 + iVar18,0). The buffer is allocated and initialized as count-sized 0x40-byte strip transforms at 0x002da6f0-0x002da714 and 0x002da7ac-0x002da810. --- src/overlays/l10/mobys/data_processor_linked_effect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l10/mobys/data_processor_linked_effect.c b/src/overlays/l10/mobys/data_processor_linked_effect.c index df3b6680ae..7729ead842 100644 --- a/src/overlays/l10/mobys/data_processor_linked_effect.c +++ b/src/overlays/l10/mobys/data_processor_linked_effect.c @@ -312,7 +312,7 @@ void render_data_processor_linked_effect(u8 *moby) { color = (truncate_float_to_s32(alpha * 255.0f / duration) << 24) | 0xffffff; } vertex = 0; - offset = i * 0x40; + strip_transform_byte_offset = i * 0x40; next_strip_index = i + 1; *(unsigned int *)(buffers.packet.quad + 0x4c) = color; *(unsigned int *)(buffers.packet.quad + 0x48) = color; @@ -325,7 +325,7 @@ void render_data_processor_linked_effect(u8 *moby) { linked_processor_vars + group_vertices + (row + (vertex >> 1)) * 0x140 + order[i] * 0x10); } - draw_geometry_quad(buffers.packet.quad, strip_transforms + offset, 0); + draw_geometry_quad(buffers.packet.quad, strip_transforms + strip_transform_byte_offset, 0); } row = next_row; } while (row < 19); From 58d632ed5ee49caae19ac424410fe3cb2b79a2b5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:13:16 +0000 Subject: [PATCH 545/657] decomp: clarify names in spawn_explosion_burst offset -> second_spark_vector_or_particle_position: In spawn_explosion_burst, retail 0x002ea898 binds s3 to stack+0x20. At 0x002ea8fc-0x002ea908 fast_vec_scale writes the scaled spherical velocity there; 0x002ea938 sets its W and 0x002ea944-0x002ea94c adjusts its Z before 0x002ea9d8 passes it in a2 as spawn_spark's second vector. In the particle loop, 0x002eaa90/0x002eaabc store independent cosine/sine XY offsets into the same array, 0x002eaaa8 zeros Z, and 0x002eaaac-0x002eaab8 adds moby+0x10 in place. 0x002eab40 passes that array as the spawn position to the particle helper at 0x002eab4c. Original Ghidra follows both roles through &fStack_c0; the authoritative C declares this single aligned float[4] as offset. --- .../l18/mobys/drek_boss_electric_ball.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/l18/mobys/drek_boss_electric_ball.c b/src/overlays/l18/mobys/drek_boss_electric_ball.c index 747e62b2fd..278d810be8 100644 --- a/src/overlays/l18/mobys/drek_boss_electric_ball.c +++ b/src/overlays/l18/mobys/drek_boss_electric_ball.c @@ -474,7 +474,7 @@ extern unsigned char D_L18_00161FE1[3] MACRO_ADDR; /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002A8400.c: func_L18_002EBBF0). */ void spawn_explosion_burst(void *source_moby) { float velocity[4] __attribute__((aligned(16))); - float offset[4] __attribute__((aligned(16))); + float second_spark_vector_or_particle_position[4] __attribute__((aligned(16))); struct Moby *moby = source_moby; int i = 0; int j; @@ -492,10 +492,10 @@ void spawn_explosion_burst(void *source_moby) { speed = random_float_between(explosion_burst_spark_speed_min_gp, explosion_burst_spark_speed_max_gp); build_spherical_offset(velocity, speed * frame_time, angle, elevation); - fast_vec_scale(offset, velocity, explosion_burst_spark_second_vector_scale_gp); + fast_vec_scale(second_spark_vector_or_particle_position, velocity, explosion_burst_spark_second_vector_scale_gp); scale = random_float_between(0.8f, 1.2f); - offset[3] = velocity[3] = explosion_burst_spark_vector_w_gp; - offset[2] += explosion_burst_spark_second_vector_z_rate_gp * scale * frame_time; + second_spark_vector_or_particle_position[3] = velocity[3] = explosion_burst_spark_vector_w_gp; + second_spark_vector_or_particle_position[2] += explosion_burst_spark_second_vector_z_rate_gp * scale * frame_time; scale = random_float_between(0.8f, 1.2f); a = truncate_float_to_s32( (float)scale_game_frames(explosion_burst_spark_frame_count_gp) * scale); @@ -505,7 +505,7 @@ void spawn_explosion_burst(void *source_moby) { (float)scale_game_frames(explosion_burst_spark_third_frame_count_gp) * scale); spawn_spark(&moby->pos, velocity, - offset, + second_spark_vector_or_particle_position, explosion_burst_spark_initial_color_gp, explosion_burst_spark_second_color_gp, a, @@ -529,15 +529,15 @@ void spawn_explosion_burst(void *source_moby) { build_spherical_offset(velocity, speed, angle, elevation); angle = random_angle_radians(); offset_x = fast_cos(angle); - offset[0] = random_float_between(0.0f, explosion_burst_particle_xy_offset_limit_gp); - offset_x *= offset[0]; - offset[0] = offset_x; + second_spark_vector_or_particle_position[0] = random_float_between(0.0f, explosion_burst_particle_xy_offset_limit_gp); + offset_x *= second_spark_vector_or_particle_position[0]; + second_spark_vector_or_particle_position[0] = offset_x; offset_y = fast_sin(angle); - offset[1] = random_float_between(0.0f, explosion_burst_particle_xy_offset_limit_gp); - offset_y *= offset[1]; - offset[1] = offset_y; - offset[2] = 0.0f; - fast_vec_add(offset, offset, &moby->pos); + second_spark_vector_or_particle_position[1] = random_float_between(0.0f, explosion_burst_particle_xy_offset_limit_gp); + offset_y *= second_spark_vector_or_particle_position[1]; + second_spark_vector_or_particle_position[1] = offset_y; + second_spark_vector_or_particle_position[2] = 0.0f; + fast_vec_add(second_spark_vector_or_particle_position, second_spark_vector_or_particle_position, &moby->pos); color1 = explosion_burst_particle_first_color_choices[random_integer_below(6)]; color2 = explosion_burst_particle_second_color_choices[random_integer_below(6)]; scale = explosion_burst_particle_scale_multiplier_gp * 400000.0f; @@ -547,7 +547,7 @@ void spawn_explosion_burst(void *source_moby) { b = scale_game_frames( random_int_between(explosion_burst_particle_second_frame_count_range_start_gp, explosion_burst_particle_second_frame_count_range_end_gp)); - spawn_particle(offset, velocity, color1, color2, scale, a, b, speed, 0, 0); + spawn_particle(second_spark_vector_or_particle_position, velocity, color1, color2, scale, a, b, speed, 0, 0); } while (j < explosion_burst_particle_count_gp); } if (explosion_burst_first_glow_scale_multiplier_gp > 0.0f) { From 701c5117909498b110403010802b81093e6fbb8c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:13:16 +0000 Subject: [PATCH 546/657] decomp: clarify names in leaf_update timer -> activation_delay: In the authoritative leaf.c snapshot, timer receives random_int_between(120, 2400) after motion expiry and saved-position restoration. Retail 0x002d8458-0x002d8460 calls that generator; 0x002d8464 and 0x002d846c store its v0 return into pvars+0x40 and +0x44, and 0x002d8470 sets state 1 (LEAF_WAIT_FOR_ACTIVATION). At 0x002d7fc4-0x002d7ff8 that state requires distance <32 and fast_dec_timer(pvars+0x44) expiry before initializing motion. Thus this local supplies the next activation delay, rather than the active-motion lifetime reloaded with 720..1200 at 0x002d8108-0x002d811c. --- src/overlays/l04/mobys/leaf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l04/mobys/leaf.c b/src/overlays/l04/mobys/leaf.c index 7853246f53..efa40c6686 100644 --- a/src/overlays/l04/mobys/leaf.c +++ b/src/overlays/l04/mobys/leaf.c @@ -35,7 +35,7 @@ void leaf_update(struct Moby *moby) { char *leaf_vars = (char *)moby->pvars; float speed; float amount; - int timer; + int activation_delay; float *motion; random_direction_or_collision_start_position.q = 0; @@ -134,10 +134,10 @@ void leaf_update(struct Moby *moby) { if (*(int *)(leaf_vars + 0x44) > 0) return; qcopy(&moby->pos, leaf_vars + 0x30); - timer = random_int_between(120, 2400); + activation_delay = random_int_between(120, 2400); /* Preserve the retail ordering of the timer reload stores. */ - *(volatile int *)(leaf_vars + 0x40) = timer; - *(volatile int *)(leaf_vars + 0x44) = timer; + *(volatile int *)(leaf_vars + 0x40) = activation_delay; + *(volatile int *)(leaf_vars + 0x44) = activation_delay; moby->state = LEAF_WAIT_FOR_ACTIVATION; break; default: From 1a6b87284f1e60967a7d0e94a5073d5898992498 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:13:16 +0000 Subject: [PATCH 547/657] decomp: clarify names in landmine_update timer -> fade_alpha: In PATH_FOLLOWER_FADE_OUT, timer.f[0] is initialized from moby->alpha. Retail 0x002f49bc..49d8 loads the byte at moby+0x23, converts it to float and stores it at sp+0x50. At 0x002f49f0..49fc approach_value updates that storage toward zero with step 128/scale_game_frames(30). At 0x002f4a00..4a14 the updated float is converted and stored back to the alpha byte, with zero causing removal at 0x002f4a18..4a1c. Thus this is fade alpha storage rather than a timer. --- src/overlays/l08/mobys/landmine.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l08/mobys/landmine.c b/src/overlays/l08/mobys/landmine.c index 2237a391f4..d5144cb4d9 100644 --- a/src/overlays/l08/mobys/landmine.c +++ b/src/overlays/l08/mobys/landmine.c @@ -198,10 +198,10 @@ void landmine_update(struct Moby *moby) { return; } case PATH_FOLLOWER_FADE_OUT: { - Vec4 timer; - timer.f[0] = (f32)moby->alpha; - approach_value(&timer, 0.0f, 128.0f / (f32)scale_game_frames(30)); - moby->alpha = (u8)(s32)timer.f[0]; + Vec4 fade_alpha; + fade_alpha.f[0] = (f32)moby->alpha; + approach_value(&fade_alpha, 0.0f, 128.0f / (f32)scale_game_frames(30)); + moby->alpha = (u8)(s32)fade_alpha.f[0]; if (moby->alpha == 0) mark_moby_for_removal(moby); } From 32d8361c96c51bba64bfcbf08c476e532310adb0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:14:57 +0000 Subject: [PATCH 548/657] decomp: clarify names in draw_electric_beam offset -> strip_half_width_offset: The aligned float[4] offset corresponds to retail s3 = sp+0x250 (0x00302080), auStack_120 in the original decompilation. Main 0x0030218c..0x003021dc computes tangent from points[point] minus points[point+2], view from points[point+1] minus local camera, then cross(view,tangent) and normalization to 0.1f into s3. At 0x00302278..0x003022a0 this vector is added/subtracted from the next centerline point for the two end vertices, proving a strip half-width displacement. Branch 0x0030235c..0x003023c0 and 0x00302478..0x003024a0 repeat this role. Copies to prev_offset at 0x00302178..0x0030217c and 0x00302348..0x0030234c supply the adjoining end's displacement; clears close the main and branch tips. --- src/overlays/shared/props/electric_beam.c | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/shared/props/electric_beam.c b/src/overlays/shared/props/electric_beam.c index 15f0c59792..199845d8a6 100644 --- a/src/overlays/shared/props/electric_beam.c +++ b/src/overlays/shared/props/electric_beam.c @@ -384,7 +384,7 @@ void draw_electric_beam(char *moby) { float inverse[16] __attribute__((aligned(16))); float camera[4] __attribute__((aligned(16))); float prev_offset[4] __attribute__((aligned(16))); - float offset[4] __attribute__((aligned(16))); + float strip_half_width_offset[4] __attribute__((aligned(16))); float view[4] __attribute__((aligned(16))); float tangent[4] __attribute__((aligned(16))); u64 texture; @@ -426,18 +426,18 @@ void draw_electric_beam(char *moby) { packet[1].colors[k] = color; packet[0].colors[k] = color; } - clear_u64_value(offset); + clear_u64_value(strip_half_width_offset); { int point; for (point = 0; point < 31; point++) { - qcopy(prev_offset, offset); + qcopy(prev_offset, strip_half_width_offset); if (point < 30) { fast_vec_sub(tangent, &beam->points[point], &beam->points[point + 2]); fast_vec_sub(view, &beam->points[point + 1], camera); - fast_vec_cross(offset, view, tangent); - fast_vec_normalize(offset, offset, 0.1f); + fast_vec_cross(strip_half_width_offset, view, tangent); + fast_vec_normalize(strip_half_width_offset, strip_half_width_offset, 0.1f); } else { - clear_u64_value(offset); + clear_u64_value(strip_half_width_offset); } for (corner = 0; corner < 4; corner++) { if (corner < 2) { @@ -452,10 +452,10 @@ void draw_electric_beam(char *moby) { qcopy(&packet[0].vertices[corner], &beam->points[point + 1]); if (corner & 1) fast_vec_add( - &packet[0].vertices[corner], &packet[0].vertices[corner], offset); + &packet[0].vertices[corner], &packet[0].vertices[corner], strip_half_width_offset); else fast_vec_sub( - &packet[0].vertices[corner], &packet[0].vertices[corner], offset); + &packet[0].vertices[corner], &packet[0].vertices[corner], strip_half_width_offset); } /* Fakematch: 34 block notes push this loop past haifa-sched's 100-insn region limit, * so sched1 moves nothing between its blocks, as in retail. */ @@ -469,26 +469,26 @@ void draw_electric_beam(char *moby) { } } for (branch = 0; branch < 4; branch++) { - clear_u64_value(offset); + clear_u64_value(strip_half_width_offset); start_point = beam->branch_start[branch]; if (start_point >= 0x1F) continue; if (start_point <= -1) continue; for (branch_segment_index = 0; branch_segment_index < 3; branch_segment_index++) { - qcopy(prev_offset, offset); + qcopy(prev_offset, strip_half_width_offset); if (branch_segment_index < 2) { fast_vec_sub(tangent, &beam->branches[branch_segment_index][branch], &beam->branches[branch_segment_index + 2][branch]); fast_vec_sub(view, &beam->branches[branch_segment_index + 1][branch], camera); - fast_vec_cross(offset, view, tangent); - fast_vec_normalize(offset, offset, 0.1f); + fast_vec_cross(strip_half_width_offset, view, tangent); + fast_vec_normalize(strip_half_width_offset, strip_half_width_offset, 0.1f); } else { - clear_u64_value(offset); + clear_u64_value(strip_half_width_offset); } if (branch_segment_index == 0) - qcopy(prev_offset, offset); + qcopy(prev_offset, strip_half_width_offset); for (corner = 0; corner < 4; corner++) { if (corner < 2) { qcopy(&packet[0].vertices[corner], @@ -504,10 +504,10 @@ void draw_electric_beam(char *moby) { &beam->branches[branch_segment_index + 1][branch]); if (corner & 1) fast_vec_add( - &packet[0].vertices[corner], &packet[0].vertices[corner], offset); + &packet[0].vertices[corner], &packet[0].vertices[corner], strip_half_width_offset); else fast_vec_sub( - &packet[0].vertices[corner], &packet[0].vertices[corner], offset); + &packet[0].vertices[corner], &packet[0].vertices[corner], strip_half_width_offset); } /* Fakematch: 32 block notes push this loop past haifa-sched's 100-insn region limit, * so sched1 moves nothing between its blocks, as in retail. */ From 712bfc8cedf5f5cb0046f4cd3dff3b287de365a7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:14:57 +0000 Subject: [PATCH 549/657] decomp: clarify names in asteroid_update size -> class_scale_ratio: Authoritative asteroid_update source SHA-256 ce10b0ced9d755f98f5f99c3b645388851b926f25f2889d27ec0e6cb72da57fa assigns size = moby->scale / moby->pclass->scale. Retail 0x002e1820 loads moby+0x2c, 0x002e1838 loads pclass+0x24, and 0x002e1844 divides into f20. This ratio is multiplied by 6.2 at 0x002e1864 for the collision query and passed to the hit handler at 0x002e18a4/0x002e18bc. In the alternate hit branch, 0x002e1908/0x002e1910/0x002e191c recompute the identical quotient, passed at 0x002e1938/0x002e1940. Original Ghidra confirms fVar9 and fVar11/fVar9 at these uses. --- src/overlays/l13/mobys/asteroid.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l13/mobys/asteroid.c b/src/overlays/l13/mobys/asteroid.c index 25ee0c4743..938c82aa72 100644 --- a/src/overlays/l13/mobys/asteroid.c +++ b/src/overlays/l13/mobys/asteroid.c @@ -248,7 +248,7 @@ void asteroid_update(struct Moby *moby) __asm__("FUN_L13_002e1638"); void asteroid_update(struct Moby *moby) { struct BlobVars *asteroid_vars = (struct BlobVars *)moby->pvars; f32 distance = fast_vec_dist(&moby->pos, &hero_pos); - f32 size; + f32 class_scale_ratio; f32 spin; char *hit; @@ -283,26 +283,26 @@ void asteroid_update(struct Moby *moby) { } if (asteroid_vars->cooldown == 0) { moby->collision = moby->pclass->collision; - size = moby->scale / moby->pclass->scale; + class_scale_ratio = moby->scale / moby->pclass->scale; if ((frame_count & 1) == (((char *)moby - (char *)moby_base) >> 8 & 1) && - FUN_L00_001f0d60_1638(size * 6.2f, &moby->pos, 0, moby) != 0) { + FUN_L00_001f0d60_1638(class_scale_ratio * 6.2f, &moby->pos, 0, moby) != 0) { if ((struct Moby *)coll_hit_1638.moby != asteroid_vars->owner) { reflect_vector(asteroid_vars, asteroid_vars, &coll_hit_1638.normal_x); qcopy(&moby->pos, coll_hit_1638.pad30); if (coll_hit_1638.moby == 0 || ((struct Moby *)coll_hit_1638.moby)->oclass != 0xD4) { - FUN_L13_002e1348_1638(moby, asteroid_vars, size); + FUN_L13_002e1348_1638(moby, asteroid_vars, class_scale_ratio); } } } else { hit = find_moby_hit_1638(moby, 0x330000, 0); if (hit != 0 && (*(struct Moby **)(hit + 0x20))->oclass != 0xD4) { hit += 0x10; - size = moby->scale; - size /= moby->pclass->scale; + class_scale_ratio = moby->scale; + class_scale_ratio /= moby->pclass->scale; clamp_vector_length(hit, hit, frame_time * 20.0f); fast_vec_add(asteroid_vars, asteroid_vars, hit); - FUN_L13_002e1348_1638(moby, asteroid_vars, size); + FUN_L13_002e1348_1638(moby, asteroid_vars, class_scale_ratio); } moby->hit_slot = 0xFF; } From 6e9c79ddec94547e74066967e1315138ca040ddb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:14:58 +0000 Subject: [PATCH 550/657] decomp: clarify names in process_blarg_trooper_damage_and_alerts count -> active_group_member_count: Authoritative src/overlays/l12/mobys/blarg_trooper.c snapshot SHA-256 1d0f11448a670d3492242e0ce8d5de8655e6523284023991ef2d5a29e476760f declares s32 count=0 in the help-call block. Retail 0x002e8294 zeroes s1; 0x002e8298/0x002e82b0/0x002e82c8/0x002e82e0 call count_active_moby_group_members for non--1 group IDs from pvars+0x278..0x284, accumulating returns into s1 at 0x002e82a0/0x002e82b8/0x002e82d0/0x002e82e8. Comparison against 9 at 0x002e82ec gates the help call at 0x002e8364. Original Ghidra iVar5 follows the same zero, sum and threshold data flow, proving an active group member count. --- src/overlays/l12/mobys/blarg_trooper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l12/mobys/blarg_trooper.c b/src/overlays/l12/mobys/blarg_trooper.c index 96bb45ad96..06dad32cfd 100644 --- a/src/overlays/l12/mobys/blarg_trooper.c +++ b/src/overlays/l12/mobys/blarg_trooper.c @@ -577,16 +577,16 @@ void process_blarg_trooper_damage_and_alerts(struct Moby *moby) { moby->state != BLARG_TROOPER_WAIT_FOR_ACTIVATION) { trooper_damage_alert_vars->call_timer++; if (scale_game_frames(0x3C) * 17 < trooper_damage_alert_vars->call_timer) { - s32 count = 0; + s32 active_group_member_count = 0; if (trooper_damage_alert_vars->groups[0] != -1) - count += count_active_moby_group_members(trooper_damage_alert_vars->groups[0], 2); + active_group_member_count += count_active_moby_group_members(trooper_damage_alert_vars->groups[0], 2); if (trooper_damage_alert_vars->groups[1] != -1) - count += count_active_moby_group_members(trooper_damage_alert_vars->groups[1], 2); + active_group_member_count += count_active_moby_group_members(trooper_damage_alert_vars->groups[1], 2); if (trooper_damage_alert_vars->groups[2] != -1) - count += count_active_moby_group_members(trooper_damage_alert_vars->groups[2], 2); + active_group_member_count += count_active_moby_group_members(trooper_damage_alert_vars->groups[2], 2); if (trooper_damage_alert_vars->groups[3] != -1) - count += count_active_moby_group_members(trooper_damage_alert_vars->groups[3], 2); - if (count >= 9 && random_integer_below(0x27) == 0) { + active_group_member_count += count_active_moby_group_members(trooper_damage_alert_vars->groups[3], 2); + if (active_group_member_count >= 9 && random_integer_below(0x27) == 0) { help_direction_or_hit_position.f[0] = fast_cos(fast_add_rotations(moby->rot.z, 3.1415927f)); help_direction_or_hit_position.f[1] = From 73e152c7e427e0a92cf0066973e4f6cdb1a5f4a3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:17:08 +0000 Subject: [PATCH 551/657] decomp: clarify names in update_target_tracking_camera_position offset -> position_delta: The authoritative source src/overlays/shared/camera/target_tracking_camera.c (SHA-256 c56d82df40651cbca0918f26bf6b5f75fd5d3bee01c1c5fd6e24e660c1d689d1) declares offset as aligned float[4]. Retail 002ec174..002ec184 subtracts current_target+0x10 from candidate+0x10 into sp+0x10 (Ghidra &uStack_100), then normalizes and measures that displacement at 002ec194 and 002ec1d8. 002ec214..002ec22c reuses it for chosen-minus-current-target and reads its x/y for heading. 002ec37c..002ec39c subtracts camera_object+0x30 from collision position 00173e60 into the same vector, measures it, then 002ec3bc..002ec3e0 shortens it and adds it to camera position. Finally 002ec434..002ec44c overwrites it with hero position minus camera position and reads x/y for heading. These source and original retail decompilation/instruction flows prove position_delta across every use. --- .../shared/camera/target_tracking_camera.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/shared/camera/target_tracking_camera.c b/src/overlays/shared/camera/target_tracking_camera.c index 0d273a04d9..3e9cf8e83f 100644 --- a/src/overlays/shared/camera/target_tracking_camera.c +++ b/src/overlays/shared/camera/target_tracking_camera.c @@ -146,7 +146,7 @@ void update_target_tracking_camera_position(char *camera_object) { float *distance = (float *)(state + 0xa0); float *angle = (float *)(state + 0xb8); float position[4] __attribute__((aligned(16))); - float offset[4] __attribute__((aligned(16))); + float position_delta[4] __attribute__((aligned(16))); float direction[4] __attribute__((aligned(16))); float aim[4] __attribute__((aligned(16))); float target, rate, fraction, score, best, length; @@ -206,14 +206,14 @@ void update_target_tracking_camera_position(char *camera_object) { candidate = moby_table + (*neighbours & 0x7fff) * 0x100; if (candidate != current_target && (*(short *)(candidate + 0xa6) == 0x323 || *(short *)(candidate + 0xa6) == 0x2f6)) { - fast_vec_sub(offset, candidate + 0x10, current_target + 0x10); - FUN_001ff500_2ebe70(1.0f, direction, offset); + fast_vec_sub(position_delta, candidate + 0x10, current_target + 0x10); + FUN_001ff500_2ebe70(1.0f, direction, position_delta); aim[0] = fast_cos(hero.motion.rot.f[2]); aim[1] = fast_sin(hero.motion.rot.f[2]); aim[2] = 0.0f; score = fast_vec_dot(direction, aim); if (score > 0.0f) { - target = fast_vec_length(offset) - score * 10.0f; + target = fast_vec_length(position_delta) - score * 10.0f; if (target < best) { chosen = candidate; best = target; @@ -223,9 +223,9 @@ void update_target_tracking_camera_position(char *camera_object) { } while ((short)*neighbours++ >= 0); } if (chosen != 0) { - fast_vec_sub(offset, chosen + 0x10, current_target + 0x10); + fast_vec_sub(position_delta, chosen + 0x10, current_target + 0x10); *angle = rope_spring_turn( - turn, *angle, fast_arc_tan(offset[0], offset[1]), 0.00125f, 0.175f, 0.0f); + turn, *angle, fast_arc_tan(position_delta[0], position_delta[1]), 0.00125f, 0.175f, 0.0f); } else if (*(int *)(follow + 0x40) == 1) *angle = rope_spring_turn(turn, *angle, @@ -261,12 +261,12 @@ void update_target_tracking_camera_position(char *camera_object) { position[2] += distance[4]; fast_vec_add(position, position, &hero.motion.pos); if (collision_line(camera_object + 0x30, position, 0x12, 0, 0) != 0) { - fast_vec_sub(offset, &D_L00_00173E60_2ebe70, camera_object + 0x30); + fast_vec_sub(position_delta, &D_L00_00173E60_2ebe70, camera_object + 0x30); collision_position = &D_L00_00173E60_2ebe70; - length = fast_vec_length(offset); + length = fast_vec_length(position_delta); if (length > 0.5f) { - FUN_001ff300_2ebe70((length - 0.5f) / length, offset, offset); - fast_vec_add(position, camera_object + 0x30, offset); + FUN_001ff300_2ebe70((length - 0.5f) / length, position_delta, position_delta); + fast_vec_add(position, camera_object + 0x30, position_delta); for (i = 0; i < 5; i++) { if (FUN_001f0d60_2ebe70(0.75f, position, 0, 0) != 0) qcopy(position, collision_position + 1); @@ -275,8 +275,8 @@ void update_target_tracking_camera_position(char *camera_object) { } } qcopy(camera_object + 0x30, position); - fast_vec_sub(offset, &hero.motion.pos, camera_object + 0x30); - *angle = fast_arc_tan(offset[0], offset[1]); + fast_vec_sub(position_delta, &hero.motion.pos, camera_object + 0x30); + *angle = fast_arc_tan(position_delta[0], position_delta[1]); *(int *)(angle + 1) = 0; } else qcopy(camera_object + 0x30, position); From 14e77d9058f21528646a14bc04b888d800c65cc8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:19:07 +0000 Subject: [PATCH 552/657] decomp: clarify names in draw_trick_combo_hud count -> collected_pose_count: Source initializes count to zero, writes pose_ids[count] = pose only for nonzero D_L05_0015FAE0[pose], increments count, and stops when count reaches D_L05_0015FAD8. Retail 0x0026328c zeroes a0; 0x002632b0 skips storage for zero pose entries; 0x002632b8 stores the pose index to the stack array, 0x002632bc increments a0, and 0x002632d8 compares that collected-entry count with the requested pose count. Original Ghidra represents this as iVar1 incrementing beside *piVar10 = iVar8; collected indices feed pose message lookups at 0x00263324 and 0x002633b4. --- src/overlays/shared/ui/hud/draw_trick_combo_hud.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/ui/hud/draw_trick_combo_hud.c b/src/overlays/shared/ui/hud/draw_trick_combo_hud.c index 7ef93f321e..abfb3b7b2d 100644 --- a/src/overlays/shared/ui/hud/draw_trick_combo_hud.c +++ b/src/overlays/shared/ui/hud/draw_trick_combo_hud.c @@ -338,12 +338,12 @@ s32 draw_trick_combo_hud(char *element) { draw_framed_text( trick_combo_reward_text_x_gp, trick_combo_reward_label_y_gp, color, text); } else if (D_L05_0015FAD8 > 0) { - s32 count = 0; + s32 collected_pose_count = 0; s32 pose; - for (pose = 0; pose < 4 && count < D_L05_0015FAD8; pose++) { + for (pose = 0; pose < 4 && collected_pose_count < D_L05_0015FAD8; pose++) { if (D_L05_0015FAE0[pose] != 0) { - pose_ids[count] = pose; - count++; + pose_ids[collected_pose_count] = pose; + collected_pose_count++; } } if (D_L05_0015FAD8 == 1) { From 4714a64609b31c1c9d2a72482e1191b7f1a772b9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:21:39 +0000 Subject: [PATCH 553/657] decomp: clarify names in assign_gadgebot_attack_targets count -> selected_moby_count: In the SHA-256-bound source, count is initialized to zero for each target, indexes selected[count] = best_moby, and increments only after best_moby receives claimed_target. Retail 0x002f2704 clears s3; 0x002f27c8-0x002f27e0 increments s3, stores the target at vars+0x178, and appends the selected moby. Original Ghidra lVar19 follows this flow. Retail 0x002f27e4-0x002f2870 uses s3 for count-1 angular gaps and the selected-moby angle loop, proving selected_moby_count rather than target count or capacity. --- src/overlays/shared/enemies/gadgebot.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/enemies/gadgebot.c b/src/overlays/shared/enemies/gadgebot.c index 02b4663cb8..931c952072 100644 --- a/src/overlays/shared/enemies/gadgebot.c +++ b/src/overlays/shared/enemies/gadgebot.c @@ -1292,7 +1292,7 @@ void assign_gadgebot_attack_targets(void) { float max_spread = 1.7453293f; int weight = 0; int m; - int count; + int selected_moby_count; int wanted; int target; char *target_capacity_record; @@ -1305,12 +1305,12 @@ void assign_gadgebot_attack_targets(void) { } weights[index] = -1; target = targets[index]; - count = 0; + selected_moby_count = 0; wanted = 1; target_capacity_record = (char *)get_moby_target_info(target); if (target_capacity_record != 0) wanted = S16(target_capacity_record, 4); - while (count < wanted) { + while (selected_moby_count < wanted) { float best_score = 9999999.0f; char *best_moby = 0; for (i = 0; i < moby_count; i++) { @@ -1329,21 +1329,21 @@ void assign_gadgebot_attack_targets(void) { if (best_moby == 0) break; ((GbSlots *)PVARS(best_moby))->claimed_target = target; - selected[count] = best_moby; - count++; + selected[selected_moby_count] = best_moby; + selected_moby_count++; } - if (count != 0) { - float gaps = (float)(count - 1); + if (selected_moby_count != 0) { + float gaps = (float)(selected_moby_count - 1); float spread = gaps * spread_per_gap; float step; float first_angle; if (max_spread < spread) spread = 1.7453293f; step = 0.0f; - if (count >= 2) + if (selected_moby_count >= 2) step = spread / gaps; first_angle = spread * -0.5f; - for (i = 0; i < count; i++) { + for (i = 0; i < selected_moby_count; i++) { char *vars = PVARS(selected[i]); ((GbSlots *)vars)->spread_angle = fast_add_rotations(first_angle, (float)i * step); } From ed6e7e07fa7cca5278ce2e2449375fa9c34e904a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:21:40 +0000 Subject: [PATCH 554/657] decomp: clarify names in update_alien_queen_hit_response_and_recovery timer -> intro_or_recovery_delay_frames: Authoritative C assigns timer = alien_queen_hit_recovery_vars->timer_12C and uses timer != 0 with intro_or_recovery_delay_active before decrementing the stored counter. Retail 0x002fad4c/0x002fad78 loads pvars+0x12C into v1; 0x002fad7c tests that snapshot, 0x002fad80-0x002fad84 gates countdown on pvars+0x170, and 0x002fad88-0x002fad94 stores snapshot minus one. Original Ghidra iVar6 agrees. Counter initialization uses scale_game_frames(30) at 0x002fabcc-0x002fabdc for threshold recovery; supplied alien_queen_update also sets this shared counter with scale_game_frames(10) for its state-1 intro delay. Thus this local is the shared intro/recovery delay frame count before countdown. --- src/overlays/l06/mobys/alien_queen.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l06/mobys/alien_queen.c b/src/overlays/l06/mobys/alien_queen.c index 4639bad761..44c751a721 100644 --- a/src/overlays/l06/mobys/alien_queen.c +++ b/src/overlays/l06/mobys/alien_queen.c @@ -817,7 +817,7 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { int hit_status; float dmg; int kind; - int timer; + int intro_or_recovery_delay_frames; float hp; float recovery_hp; int *path; @@ -923,8 +923,8 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { } if ((unsigned char)moby[0x20] >= 2 && D_L06_00140408 != 8 && (pad_held_lui & 0x20)) alien_queen_hit_recovery_vars->suppress_death_dialogue = 1; - timer = alien_queen_hit_recovery_vars->timer_12C; - if (timer != 0 && alien_queen_hit_recovery_vars->intro_or_recovery_delay_active != 0) { + intro_or_recovery_delay_frames = alien_queen_hit_recovery_vars->timer_12C; + if (intro_or_recovery_delay_frames != 0 && alien_queen_hit_recovery_vars->intro_or_recovery_delay_active != 0) { --alien_queen_hit_recovery_vars->timer_12C; if (alien_queen_hit_recovery_vars->timer_12C < scale_game_frames(10)) D_L06_0015F3FC = From 966fa0a0ea9bf5955c8757c33e62a784054ef684 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:21:40 +0000 Subject: [PATCH 555/657] decomp: clarify names in bot_door_lock_update offset -> digit_layout_offset: In authoritative bot_door_lock_update, float offset[3] receives cos/sin(moby->rot.z + 1.5707964f) scaled by +0.15 or -0.4, with Z zero. Retail 0x00308038-0x003080a8 writes this vector at sp+0x10 and adds it to number_anchor_position at sp into separate sp+0x20 storage. At 0x003080bc-0x003080e0 the tens quotient is drawn using sp+0x10; 0x00308114-0x00308168 reuses that vector for the units remainder. The alternate branch at 0x00308174-0x003082b0 reverses the two displacement magnitudes. Thus this is the digit-layout displacement, not the anchor or sum. --- src/overlays/shared/props/bot_door_lock.c | 42 +++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/overlays/shared/props/bot_door_lock.c b/src/overlays/shared/props/bot_door_lock.c index c0b25b9b3d..860bcf025b 100644 --- a/src/overlays/shared/props/bot_door_lock.c +++ b/src/overlays/shared/props/bot_door_lock.c @@ -229,7 +229,7 @@ void bot_door_lock_update(char *moby) { float *bot_door_lock_data = ((float *)MOBY(moby)->pvars); int *idata = (int *)bot_door_lock_data; float number_anchor_position[4]; - float offset[3]; + float digit_layout_offset[3]; float number_position_sum[4]; float angle; int number_color_pulse_delta; @@ -283,34 +283,34 @@ void bot_door_lock_update(char *moby) { } else { if (D_0015EDB4) { angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); - offset[0] = fast_cos(angle) * 0.15f; + digit_layout_offset[0] = fast_cos(angle) * 0.15f; angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); - offset[1] = fast_sin(angle) * 0.15f; - offset[2] = 0.0f; - add_vectors(number_position_sum, offset, number_anchor_position); - draw_number(offset, moby, idata[5] / 10 + 2, color, 0x7f, 4, 0xff, 0.5f); + digit_layout_offset[1] = fast_sin(angle) * 0.15f; + digit_layout_offset[2] = 0.0f; + add_vectors(number_position_sum, digit_layout_offset, number_anchor_position); + draw_number(digit_layout_offset, moby, idata[5] / 10 + 2, color, 0x7f, 4, 0xff, 0.5f); angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); - offset[0] = fast_cos(angle) * -0.4f; + digit_layout_offset[0] = fast_cos(angle) * -0.4f; angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); - offset[1] = fast_sin(angle) * -0.4f; - offset[2] = 0.0f; - add_vectors(number_position_sum, offset, number_anchor_position); - draw_number(offset, moby, idata[5] % 10 + 2, color, 0x7f, 4, 0xff, 0.5f); + digit_layout_offset[1] = fast_sin(angle) * -0.4f; + digit_layout_offset[2] = 0.0f; + add_vectors(number_position_sum, digit_layout_offset, number_anchor_position); + draw_number(digit_layout_offset, moby, idata[5] % 10 + 2, color, 0x7f, 4, 0xff, 0.5f); } else { angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); - offset[0] = fast_cos(angle) * -0.4f; + digit_layout_offset[0] = fast_cos(angle) * -0.4f; angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); - offset[1] = fast_sin(angle) * -0.4f; - offset[2] = 0.0f; - add_vectors(number_position_sum, offset, number_anchor_position); - draw_number(offset, moby, idata[5] / 10 + 2, color, 0x7f, 4, 0xff, 0.5f); + digit_layout_offset[1] = fast_sin(angle) * -0.4f; + digit_layout_offset[2] = 0.0f; + add_vectors(number_position_sum, digit_layout_offset, number_anchor_position); + draw_number(digit_layout_offset, moby, idata[5] / 10 + 2, color, 0x7f, 4, 0xff, 0.5f); angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); - offset[0] = fast_cos(angle) * 0.15f; + digit_layout_offset[0] = fast_cos(angle) * 0.15f; angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); - offset[1] = fast_sin(angle) * 0.15f; - offset[2] = 0.0f; - add_vectors(number_position_sum, offset, number_anchor_position); - draw_number(offset, moby, idata[5] % 10 + 2, color, 0x7f, 4, 0xff, 0.5f); + digit_layout_offset[1] = fast_sin(angle) * 0.15f; + digit_layout_offset[2] = 0.0f; + add_vectors(number_position_sum, digit_layout_offset, number_anchor_position); + draw_number(digit_layout_offset, moby, idata[5] % 10 + 2, color, 0x7f, 4, 0xff, 0.5f); } } } From d0672d9de4e699c08bacfc772e99cc8f84df4251 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:21:40 +0000 Subject: [PATCH 556/657] decomp: clarify names in flying_debris_update size -> offset_scale_or_puff_scalar: The sole float size declaration first receives randf_sym(0.01f,0.5f): retail 0x002bafcc-0x002bafe4 passes its f0 result as f12 to fast_vec_scale, scaling moby+0xC0 into ofs before adding joint at 0x002baff8. It is reassigned random_float_between(20000.0f,100000.0f): 0x002bb114-0x002bb11c retains f0 in f20, and 0x002bb154 supplies it as f15 to spawn_puff at 0x002bb168. Original Ghidra uVar14 follows these same two uses. Checked helper 0x00274cc4 retains f15 in f22 and 0x00274d2c stores it at allocated puff+0xC. Thus this reused binding is an offset scale followed by a puff initialization scalar; physical size is unproven. --- src/overlays/l14/mobys/flying_debris.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l14/mobys/flying_debris.c b/src/overlays/l14/mobys/flying_debris.c index f14fcd29c3..3e83cda771 100644 --- a/src/overlays/l14/mobys/flying_debris.c +++ b/src/overlays/l14/mobys/flying_debris.c @@ -91,7 +91,7 @@ void flying_debris_update(struct Moby *moby) { int i; int signed_puff_random_value; int puff_rgb_component; - float size; + float offset_scale_or_puff_scalar; float bright; u8 *puff_particle; u8 *puff_tail; @@ -152,8 +152,8 @@ void flying_debris_update(struct Moby *moby) { moby->rot.y = fast_add_rotations(moby->rot.y, debris_vars->spin_y); moby->rot.z = fast_add_rotations(moby->rot.z, debris_vars->spin_z); moby_point_position(moby, 0, joint); - size = randf_sym(0.01f, 0.5f); - fast_vec_scale(ofs, (char *)moby + 0xC0, size); + offset_scale_or_puff_scalar = randf_sym(0.01f, 0.5f); + fast_vec_scale(ofs, (char *)moby + 0xC0, offset_scale_or_puff_scalar); fast_vec_add(at, joint, ofs); fast_vec_sub(moby_to_joint_direction, joint, &moby->pos); normalize_d(moby_to_joint_direction, moby_to_joint_direction, 0.05f); @@ -174,7 +174,7 @@ void flying_debris_update(struct Moby *moby) { signed_puff_random_value = random_integer_below(6); if (random_integer_below(2) != 0) signed_puff_random_value = -signed_puff_random_value; - size = random_float_between(20000.0f, 100000.0f); + offset_scale_or_puff_scalar = random_float_between(20000.0f, 100000.0f); puff_rgb_component = random_int_between(0x10, 0xFF); puff_particle = (u8 *)spawn_puff(at, @@ -183,7 +183,7 @@ void flying_debris_update(struct Moby *moby) { 1.0f, signed_puff_random_value, D_L14_0015F580, - size, + offset_scale_or_puff_scalar, puff_rgb_component | (0x60000000 | (puff_rgb_component << 16) | (puff_rgb_component << 8))); if (puff_particle != NULL) { From e3aaba350eca89b333809fe80f6419aa4da4df6a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:21:40 +0000 Subject: [PATCH 557/657] decomp: clarify names in spawn_poison_vessel_destruction_effects count -> particle_count: In the authoritative source src/overlays/l13/mobys/poison_vessel.c (SHA-256 5fbb3af1d4fe58b4c464f39e06f5f16d1b8085a38602eecd9e6d010222e4849c), count is assigned distance < 6.0f ? truncate_float_to_s32(distance) + 1 : 4, then initializes i for the particle loop. Retail 0x003077fc..0x00307814 computes that quantity; 0x00307834..0x00307838 tests it and copies it into s4. At 0x00307868 s4 is decremented once per iteration, each iteration calls the particle helper at 0x0030797c with independently selected entries from the two color palettes, and 0x00307984 repeats until s4 is zero. Thus the quantity counts particles emitted by this loop, separately from the preceding fragment loops and following colored-moby effects. --- src/overlays/l13/mobys/poison_vessel.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l13/mobys/poison_vessel.c b/src/overlays/l13/mobys/poison_vessel.c index adf6249df2..a85ab0c007 100644 --- a/src/overlays/l13/mobys/poison_vessel.c +++ b/src/overlays/l13/mobys/poison_vessel.c @@ -49,7 +49,7 @@ void spawn_poison_vessel_destruction_effects(struct Moby *moby, void *poison_ves struct { OvlVec4 direction, velocity, axis, offset, pos, random_direction, random_vector; } work; - int count; + int particle_count; int duration; int *color, *second_color; float distance, twice_distance, extra, speed, amount; @@ -137,12 +137,12 @@ void spawn_poison_vessel_destruction_effects(struct Moby *moby, void *poison_ves duration = random_int_between(lo, hi); } spawn_poison_vessel_fragment(&work.pos, &work.random_direction, duration, 1); - count = distance < 6.0f ? truncate_float_to_s32(distance) + 1 : 4; + particle_count = distance < 6.0f ? truncate_float_to_s32(distance) + 1 : 4; extra = 0.0f; if (distance < 7.0f) extra = 7.0f - distance; - if (count > 0) { - int i = count; + if (particle_count > 0) { + int i = particle_count; L13EffectColors colors __attribute__((aligned(16))); L13EffectColors second_colors __attribute__((aligned(16))); float magnitude = 400000.0f; From 6cd9d4f42bc7390d5b3593cd3d8c3c3d63668d76 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:23:37 +0000 Subject: [PATCH 558/657] decomp: clarify names in check_ledge_grab offset -> ledge_normal_offset: In the bound C check_ledge_grab, offset starts at zero and advances by 0.03 while below 2.4. Retail 0x0020c654 clears f20; 0x0020c680-0x0020c6a4 multiply it by cosine/sine of hero+0x4e4 (ledge_normal_yaw) and add those components to the copied ledge X/Y before the vertical collision test at 0x0020c6d8. 0x0020c6e8-0x0020c6f4 advance and bound that distance. On success the C reuses offset as -step*0.5; retail 0x0020c434-0x0020c474 applies that negative half-step along the same normal to grab_point before copying it to hero+0x4d0. Thus it is a signed ledge-normal offset, not a byte offset or unspecified displacement. --- src/overlays/shared/hero/hero_idle_sequence.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index b1d79add4a..d08913f53e 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -3606,7 +3606,7 @@ void check_ledge_grab(void) { float probe[4], ledge[4], ray_end[4], hero_level[4], clearance[4], edge_start[4], edge_end[4], grab_point[4]; float down, fwd, up, top, drop, rise, back; - float speed, ledge_yaw, offset; + float speed, ledge_yaw, ledge_normal_offset; int can_grab, found, edge, i, j, surface, grabbable, frames; Obj *moby_info; Obj *moby_props; @@ -3762,22 +3762,22 @@ void check_ledge_grab(void) { float max = 2.4f; float step = 0.03f; - for (offset = 0.0f; offset < max; offset += step) { + for (ledge_normal_offset = 0.0f; ledge_normal_offset < max; ledge_normal_offset += step) { qcopy(edge_end, ledge); edge_end[2] = ledge[2]; - edge_end[0] += fast_cos(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * offset; - edge_end[1] += fast_sin(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * offset; + edge_end[0] += fast_cos(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; + edge_end[1] += fast_sin(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; qcopy(edge_start, edge_end); edge_end[2] += 0.5f; edge_start[2] -= 0.5f; if (!func_L00_001EFFF0_20C568( edge_end, edge_start, 4, (int)((Hero *)D_0013F450_20C568)->moby, 0)) { qcopy(grab_point, edge_end); - offset = step * 0.5f; - offset = -offset; + ledge_normal_offset = step * 0.5f; + ledge_normal_offset = -ledge_normal_offset; grab_point[2] = ledge[2]; - grab_point[0] += fast_cos(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * offset; - grab_point[1] += fast_sin(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * offset; + grab_point[0] += fast_cos(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; + grab_point[1] += fast_sin(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; qcopy(((Hero *)D_0013F450_20C568)->ledge_hang_pos.f, grab_point); ((Hero *)D_0013F450_20C568)->ledge_hang_pos.f[0] += fast_cos(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * back; From ae9e1827ec984a78b8ff0c099aaa601dec54256f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:23:37 +0000 Subject: [PATCH 559/657] decomp: clarify names in exploding_prop_update offset -> effect_spawn_position: Authoritative src/overlays/l15/mobys/exploding_prop.c (SHA-256 f5b04b83c4c5b529804fa009731f19d5d6e4ad193f96184526b8f03dce738990) declares offset as Vec4. Retail 0x002aa4ac, 0x002aa4e0 and 0x002aa4e4 construct its components at sp+0x50; 0x002aa5e4 passes s4=sp+0x50 as a0 to the debris spawn call at 0x002aa5ec. In the second loop 0x002aa704-0x002aa714 adds moby->pos to that same vector, 0x002aa728-0x002aa740 raises its z, and 0x002aa840 passes s4 as a0 to mine_debris at 0x002aa844. The original Ghidra shows the same fStack_140/pfVar3 data flow, and the supplied mine_debris source identifies a0 as spawn_position copied to particle+0x10. Thus this vector supplies effect spawn positions in both loops, without claiming the same coordinate space. --- src/overlays/l15/mobys/exploding_prop.c | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/overlays/l15/mobys/exploding_prop.c b/src/overlays/l15/mobys/exploding_prop.c index ea545603bd..19d0ff90f3 100644 --- a/src/overlays/l15/mobys/exploding_prop.c +++ b/src/overlays/l15/mobys/exploding_prop.c @@ -73,7 +73,7 @@ void exploding_prop_update(struct Moby *moby) { EXPLODING_PROP_STATE_INITIALIZED = 1 }; char *hit = 0; - Vec4 velocity, hit_direction, push, offset, center; + Vec4 velocity, hit_direction, push, effect_spawn_position, center; u32 palette[4]; u32 colors[4]; Vec4 delta; @@ -112,15 +112,15 @@ void exploding_prop_update(struct Moby *moby) { angle = random_float_between(moby->rot.z, 1.5707963267948966f); radius = fast_cos(angle); radius *= random_float_between(-3.0f, 3.0f); - offset.f[0] = radius; + effect_spawn_position.f[0] = radius; angle = random_float_between(moby->rot.z, 1.5707963267948966f); radius = fast_sin(angle); radius *= random_float_between(-3.0f, 3.0f); - offset.f[1] = radius; - offset.f[2] = 0.0f; - offset.f[2] = random_float_between(1.0f, 7.0f); - add_vectors(colors, &offset, &moby->pos); - fast_vec_sub(colors, ¢er, &offset); + effect_spawn_position.f[1] = radius; + effect_spawn_position.f[2] = 0.0f; + effect_spawn_position.f[2] = random_float_between(1.0f, 7.0f); + add_vectors(colors, &effect_spawn_position, &moby->pos); + fast_vec_sub(colors, ¢er, &effect_spawn_position); velocity.q = *(u128 *)colors; fast_vec_normalize(&velocity, &velocity, frame_time * 5.0f); add_vectors(colors, &velocity, &push); @@ -132,7 +132,7 @@ void exploding_prop_update(struct Moby *moby) { radius = random_float_between(0.1f, 0.3f); life = random_int_between(100, 160); size = random_float_between(3.0f, 7.0f); - spawn_debris_chunk(&offset, &velocity, *color, radius, life, size, 0.15f, 2.0f, 1); + spawn_debris_chunk(&effect_spawn_position, &velocity, *color, radius, life, size, 0.15f, 2.0f, 1); } clear_u64_value(&velocity); spawn_explosion(moby, @@ -161,15 +161,15 @@ void exploding_prop_update(struct Moby *moby) { angle = random_float_between(moby->rot.z, 1.5707963267948966f); radius = fast_cos(angle); radius *= random_float_between(-3.0f, 3.0f); - offset.f[0] = radius; + effect_spawn_position.f[0] = radius; angle = random_float_between(moby->rot.z, 1.5707963267948966f); radius = fast_sin(angle); radius *= random_float_between(-3.0f, 3.0f); - offset.f[1] = radius; - offset.f[2] = 0.0f; - fast_vec_add(&offset, &offset, &moby->pos); - offset.f[2] += random_float_between(1.0f, 5.5f); - fast_vec_sub(&delta, ¢er, &offset); + effect_spawn_position.f[1] = radius; + effect_spawn_position.f[2] = 0.0f; + fast_vec_add(&effect_spawn_position, &effect_spawn_position, &moby->pos); + effect_spawn_position.f[2] += random_float_between(1.0f, 5.5f); + fast_vec_sub(&delta, ¢er, &effect_spawn_position); velocity.q = delta.q; fast_vec_normalize(&velocity, &velocity, frame_time * 5.0f); add_vectors(&delta, &velocity, &hit_direction); @@ -182,7 +182,7 @@ void exploding_prop_update(struct Moby *moby) { size = random_float_between(1.0f, 3.0f) * 210000.0f; life = scale_game_frames(180); pick = random_integer_below(3); - debris = mine_debris(&offset, &velocity, color1, color2, size, life, colors[pick]); + debris = mine_debris(&effect_spawn_position, &velocity, color1, color2, size, life, colors[pick]); if (debris != 0) *(float *)((char *)debris + 0x2c) = moby->pos.z - 0.5f; } From 3961d034583dc38e9d189c9821d41a6edb4e0b0f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:23:37 +0000 Subject: [PATCH 560/657] decomp: clarify names in help_hints_update count -> available_inactive_item_count: In the bound source snapshot (src/overlays/l02/mobys/help_hints.c, SHA-256 3eb2a4e69f67f31f57e77d21459c263ef7e9be1d18e02978e0bc037ba32ce418), count starts at zero and increments only when D_L02_0017A0C0[i].active == 0, i != 8, i != 24 and item_available[i] != 0. Retail 0x002ee928 initializes a2 to zero; 0x002ee940-0x002ee964 tests the entry word and exclusions and conditionally increments a2 using the byte at 0x0013d4c0+i; 0x002ee974 advances entries by 0x4c. Original Ghidra mirrors this accumulator as iVar4. Retail 0x002ee978-0x002ee98c requests help 0x4e25/0x4f only when at least two qualify. --- src/overlays/l02/mobys/help_hints.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l02/mobys/help_hints.c b/src/overlays/l02/mobys/help_hints.c index 664a4edba1..cf6442e856 100644 --- a/src/overlays/l02/mobys/help_hints.c +++ b/src/overlays/l02/mobys/help_hints.c @@ -52,16 +52,16 @@ void help_hints_update(struct Moby *moby) { ((unsigned int)hero.state.control_mode) < 2) { char *b = ((char *)&D_00141968); if (*(unsigned short *)(b + 0x278) == 0 && D_001418E8 == 0) { - int count = 0; + int available_inactive_item_count = 0; int i; for (i = 0; i < 37; i++) { if (D_L02_0017A0C0[i].active == 0 && i != 8 && i != 24) { if ((item_available)[i] != 0) { - count++; + available_inactive_item_count++; } } } - if (count >= 2) { + if (available_inactive_item_count >= 2) { help_request(0x4E25, 0x4F); } } From a558444015116c26ed20d0f09c0266896aba5bf8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:23:37 +0000 Subject: [PATCH 561/657] decomp: clarify names in radial_exploding_prop_update offset -> debris_spawn_position: Authoritative src/overlays/l15/mobys/radial_exploding_prop.c SHA-256 41fd430283492713d7d43d32caafbd79a30189e5cbc6e65305d4280278ab5e2c declares offset as Vec and passes &offset as the position argument to spawn_debris_chunk and mine_debris. Retail 002a7a88..002a7ac8 constructs this vector at sp+0x50 from cosine/sine times radius and randomized z; 002a7bc4..002a7bcc passes its address as a0 to the primary spawn. 002a7be8..002a7c18 replaces it with moby position plus z=10 for the optional spawn at 002a7cb8. 002a7dc8..002a7e24 builds the secondary spawn position, adds moby position and randomized height, then 002a7f28..002a7f30 passes sp+0x50 as a0 to mine_debris. Supplied mine_debris context copies spawn_position into particle+0x10, proving the spawn-position role. --- .../l15/mobys/radial_exploding_prop.c | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/overlays/l15/mobys/radial_exploding_prop.c b/src/overlays/l15/mobys/radial_exploding_prop.c index a1c0c28a49..2d4a0eef28 100644 --- a/src/overlays/l15/mobys/radial_exploding_prop.c +++ b/src/overlays/l15/mobys/radial_exploding_prop.c @@ -76,7 +76,7 @@ void radial_exploding_prop_update(struct Moby *moby) { RADIAL_EXPLODING_PROP_STATE_INITIALIZED = 1 }; char *slot = 0; - Vec velocity, hit_direction_step, doubled_hit_direction_step, offset, debris_origin; + Vec velocity, hit_direction_step, doubled_hit_direction_step, debris_spawn_position, debris_origin; u32 palette[4]; u32 colors[4]; Vec position; @@ -123,12 +123,12 @@ void radial_exploding_prop_update(struct Moby *moby) { angle = random_angle_radians(); if (moby->oclass == 0x94) radius *= 3.0f; - offset.f[0] = fast_cos(angle) * radius; - offset.f[1] = fast_sin(angle) * radius; - offset.f[2] = 0.0f; - offset.f[2] = random_float_between(1.0f, 7.0f); - add_vectors(colors, &offset, &moby->pos); - fast_vec_sub(colors, base_position, &offset); + debris_spawn_position.f[0] = fast_cos(angle) * radius; + debris_spawn_position.f[1] = fast_sin(angle) * radius; + debris_spawn_position.f[2] = 0.0f; + debris_spawn_position.f[2] = random_float_between(1.0f, 7.0f); + add_vectors(colors, &debris_spawn_position, &moby->pos); + fast_vec_sub(colors, base_position, &debris_spawn_position); velocity.q = *(u128 *)colors; normalize_vector_xyz_7880(frame_time * 5.0f, &velocity, &velocity); add_vectors(colors, &velocity, &doubled_hit_direction_step); @@ -141,15 +141,15 @@ void radial_exploding_prop_update(struct Moby *moby) { duration = random_int_between(60, 100); size = random_float_between(3.0f, 7.0f); spawn_debris_chunk( - &offset, &velocity, *palette_entry, radius, duration, size, 0.15f, 2.0f, 1); + &debris_spawn_position, &velocity, *palette_entry, radius, duration, size, 0.15f, 2.0f, 1); i--; } while (i >= 0); } if (moby->oclass == 0x94) { - offset.q = *(u128 *)&moby->pos; - offset.f[2] += 10.0f; + debris_spawn_position.q = *(u128 *)&moby->pos; + debris_spawn_position.f[2] += 10.0f; radius = 1.0f; - fast_vec_sub(colors, base_position, &offset); + fast_vec_sub(colors, base_position, &debris_spawn_position); velocity.q = *(u128 *)colors; normalize_vector_xyz_7880(frame_time * 5.0f, &velocity, &velocity); add_vectors(colors, &velocity, &doubled_hit_direction_step); @@ -158,7 +158,7 @@ void radial_exploding_prop_update(struct Moby *moby) { scale_vector_xyz_7880(size, &velocity, &velocity); duration = random_int_between(60, 100); effect = - spawn_debris_chunk(&offset, &velocity, 0xc9, radius, duration, 5.0f, radius, 2.0f, 1); + spawn_debris_chunk(&debris_spawn_position, &velocity, 0xc9, radius, duration, 5.0f, radius, 2.0f, 1); if (effect != 0) scale_vector_xyz_7880(0.35f, (char *)effect + 0x40, (char *)effect + 0x40); } @@ -191,12 +191,12 @@ void radial_exploding_prop_update(struct Moby *moby) { angle = random_angle_radians(); if (moby->oclass == 0x94) radius *= 3.0f; - offset.f[0] = fast_cos(angle) * radius; - offset.f[1] = fast_sin(angle) * radius; - offset.f[2] = 0.0f; - fast_vec_add(&offset, &offset, &moby->pos); - offset.f[2] += random_float_between(1.0f, 5.5f); - fast_vec_sub(&position, base_position, &offset); + debris_spawn_position.f[0] = fast_cos(angle) * radius; + debris_spawn_position.f[1] = fast_sin(angle) * radius; + debris_spawn_position.f[2] = 0.0f; + fast_vec_add(&debris_spawn_position, &debris_spawn_position, &moby->pos); + debris_spawn_position.f[2] += random_float_between(1.0f, 5.5f); + fast_vec_sub(&position, base_position, &debris_spawn_position); velocity.q = position.q; normalize_vector_xyz_7880(frame_time * 5.0f, &velocity, &velocity); add_vectors(&position, &velocity, &hit_direction_step); @@ -209,7 +209,7 @@ void radial_exploding_prop_update(struct Moby *moby) { size = random_float_between(1.0f, 3.0f) * 210000.0f; duration = scale_game_frames(180); index = random_integer_below(3); - effect = mine_debris(&offset, &velocity, color, color2, size, duration, colors[index]); + effect = mine_debris(&debris_spawn_position, &velocity, color, color2, size, duration, colors[index]); if (effect != 0) *(float *)((char *)effect + 0x2c) = moby->pos.z - 0.5f; i--; From 12ac59e1f964b049cfa5af2d0b49b321414a7e33 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:23:37 +0000 Subject: [PATCH 562/657] decomp: clarify names in command_falling_platform_update timer -> random_bits_or_sink_hold_frames: In source SHA-256 207e5fa834c59684956743aacaefb776351c8cef89454a79df673c2ace5d470c, the single function-scope int timer first receives rand(). Retail 003113c0 calls rand, 003113c8 masks bit 0, and 003113d4-003113e8 conditionally adds pi to moby rotation +0x48. In PLATFORM_HEIGHT_RECOVERY_AND_SWAY it instead receives scale_game_frames(90): 00311704-00311718 requires hero.air_frames==0 and hero.ground_moby==moby; 00311734-00311754 compares that duration with pvars+0xAC and extends the latter. While +0xAC is nonzero, 00311764-003117ac sets downward velocity or zero below the 2.6-unit sink threshold, and 003118d8-003118dc decrements it. Thus random bits and sink-hold frames are both demonstrated roles of this reused local. --- src/overlays/l07/mobys/command_falling_platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l07/mobys/command_falling_platform.c b/src/overlays/l07/mobys/command_falling_platform.c index 80be4c4269..2e166e9b1f 100644 --- a/src/overlays/l07/mobys/command_falling_platform.c +++ b/src/overlays/l07/mobys/command_falling_platform.c @@ -82,7 +82,7 @@ void command_falling_platform_update(char *moby) { float sway; float roll; float speed; - int timer; + int random_bits_or_sink_hold_frames; qcopy(previous, moby + 0x10); fast_vec_scale(delta, moby + 0x10, -1.0f); From 2fee76fbd3f05fa9e37c3e9b8f7f2a6d7d2f0c4c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:23:38 +0000 Subject: [PATCH 563/657] decomp: clarify names in gadgebot_telepot_pad_update offset -> jittered_origin: Bound source assigns offset_buffer to offset. Retail 0x002be924 sets s7 to sp+0x20; 0x002be9e0..0x002be9f4 passes hero position 0x0013f3d0, randomized stack vector sp+0x10, and s7 as add_vectors destination. At 0x002bec44..0x002bec6c the same destination receives the randomized vector plus linked moby position (moby array + (*telepot_pad_vars << 8) + 0x10). Original Ghidra shows both sums into auStack_e0. Thus the pointer holds a jittered origin position, although the sum is not read later here. timer -> effect_timer_frames: Bound source derives this short pointer from current effect +0x70, then +0x20, and writes scale_game_frames(0x5a). Retail 0x002beb20 loads the effect at table 0x00167100+0x180; 0x002beb38 loads its +0x70 pointer into s1, 0x002beb3c..0x002beb40 converts 90 game frames, and 0x002beb44 stores the halfword at s1+0x20. Original Ghidra preserves this exact ownership and store, proving an effect-owned timer field measured in scaled frames without asserting its consumer. --- src/overlays/l10/mobys/gadgebot_telepot_pad.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l10/mobys/gadgebot_telepot_pad.c b/src/overlays/l10/mobys/gadgebot_telepot_pad.c index 14c10c5e77..8223fa133e 100644 --- a/src/overlays/l10/mobys/gadgebot_telepot_pad.c +++ b/src/overlays/l10/mobys/gadgebot_telepot_pad.c @@ -76,7 +76,7 @@ void gadgebot_telepot_pad_update(char *moby) { float velocity[4]; float offset_buffer[4]; float angle; - float *offset; + float *jittered_origin; int i; char *hero_bytes; int life; @@ -91,7 +91,7 @@ void gadgebot_telepot_pad_update(char *moby) { hero_bytes = D_0013F350; if ((unsigned char)hero_bytes[0x20A4] == 1 && *telepot_pad_vars != -1 && func_001F9D48_2BFBB8(moby + 0x10, hero_bytes + 0x80) < 0.5f) { - offset = offset_buffer; + jittered_origin = offset_buffer; i = 9; do { float size, size_scaled; @@ -107,7 +107,7 @@ void gadgebot_telepot_pad_update(char *moby) { func_001F9FA8_2BFBB8(func_00214158_2BFBB8()) * func_002140F8_2BFBB8(0.0f, 0.5f); velocity[2] = 0.0f; velocity[2] += func_002140F8_2BFBB8(0.0f, 0.5f); - add_vectors(offset, velocity, D_0013F350 + 0x80); + add_vectors(jittered_origin, velocity, D_0013F350 + 0x80); func_L00_001FF4B0_2BFBB8(position, position, func_002140F8_2BFBB8(0.0f, D_0015ED6C)); position[2] = func_002140F8_2BFBB8(D_0015ED6C * 2.5f, D_0015ED6C * 5.0f); life = func_001F9850_2BFBB8(func_L00_00258BC8_2BFBB8(15, 30)); @@ -132,8 +132,8 @@ void gadgebot_telepot_pad_update(char *moby) { gadgebot_telepot_camera_effect_duration_frames_gp; if (*(short *)(effect + 0x86) == 0) { char *current = *(char **)(table + 0x180); - short *timer = (short *)(*(char **)(current + 0x70) + 0x20); - *timer = func_001F9850_2BFBB8(0x5a); + short *effect_timer_frames = (short *)(*(char **)(current + 0x70) + 0x20); + *effect_timer_frames = func_001F9850_2BFBB8(0x5a); qcopy(current + 0x40, current); } } @@ -157,7 +157,7 @@ void gadgebot_telepot_pad_update(char *moby) { velocity[2] = 0.0f; velocity[2] += func_002140F8_2BFBB8(0.0f, 0.5f); add_vectors( - offset, velocity, (*(char **)&D_L10_0015FFD8) + (*telepot_pad_vars << 8) + 0x10); + jittered_origin, velocity, (*(char **)&D_L10_0015FFD8) + (*telepot_pad_vars << 8) + 0x10); func_L00_001FF4B0_2BFBB8(position, position, func_002140F8_2BFBB8(0.0f, D_0015ED6C)); position[2] = func_002140F8_2BFBB8(D_0015ED6C * 2.5f, D_0015ED6C * 5.0f); life = func_001F9850_2BFBB8(func_L00_00258BC8_2BFBB8(15, 30)); From c4dd4bf4c912cb064219c790b504035acf64f0f4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:25:20 +0000 Subject: [PATCH 564/657] decomp: clarify names in mine_glove_update offset -> grip_local_offset: Retail 002c1b50 clears the Vec4 at sp+0x10; 002c1b60/002c1b68 store -0.09 and -0.02 in its y/z components. The bone-0 transform is built at 002c1b98..002c1ba4 into sp+0x30. At 002c1bac..002c1bb8 transform_vector reads sp+0x10 through that matrix into sp+0x20; 002c1bbc..002c1bc8 adds the transformed displacement to the saved position and writes pvars+0x40 (grip). Authoritative C confirms offset is used only for this bone-local grip displacement. --- src/overlays/shared/weapons/mine_glove.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/mine_glove.c b/src/overlays/shared/weapons/mine_glove.c index 9a0d092f9a..60c66fc7e5 100644 --- a/src/overlays/shared/weapons/mine_glove.c +++ b/src/overlays/shared/weapons/mine_glove.c @@ -146,7 +146,7 @@ void mine_glove_update(struct Moby *moby) { MINE_GLOVE_IDLE = 2 }; GloveVars *mine_glove_vars; - Vec4 saved, offset, rotatedOffset; + Vec4 saved, grip_local_offset, rotatedOffset; Vec4 local[4]; Vec4 pos, target; Vec4 basis[3]; @@ -172,7 +172,7 @@ void mine_glove_update(struct Moby *moby) { return; FUN_L00_0024f7c8(moby, 0, &saved); build_moby_bone_transform(moby, 0, local); - transform_vector(&rotatedOffset, &offset, local); + transform_vector(&rotatedOffset, &grip_local_offset, local); fast_vec_add(&mine_glove_vars->grip, &saved, &rotatedOffset); if (mine_glove_vars->held != 0) mine_glove_vars->held->collision_disable = 1; From a7fdca32bf96fd7d93d45ecdfa07830757ddf765 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:27:37 +0000 Subject: [PATCH 565/657] decomp: clarify names in doom_bot_spawner_update size -> size_multiplier: In THROWN_MOBY_STATE_MOVE_WITH_COLLISION, retail 002c8cac..002c8cc4 converts byte D_0013E534 and adds 1.0 into f21 (source size). Retail 002c8ccc..002c8cd4 multiplies pclass scale by 0.5 and f21 for the growth threshold; 002c8cf4..002c8d04 also multiplies the growth increment by f21. At 002c8e00 and 002c8e18 this same scalar multiplies 0.2 for the probe-height offset and 0.3 for coll_sphere radius, with 002c8e4c undoing the height offset on hit. Thus it is a shared dimensionless size multiplier, not a byte count or absolute radius. --- src/overlays/shared/weapons/glove_of_doom_bomb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/weapons/glove_of_doom_bomb.c b/src/overlays/shared/weapons/glove_of_doom_bomb.c index d43b0fdfcf..3215a86999 100644 --- a/src/overlays/shared/weapons/glove_of_doom_bomb.c +++ b/src/overlays/shared/weapons/glove_of_doom_bomb.c @@ -253,16 +253,16 @@ void doom_bot_spawner_update(struct Moby *thrown_moby) { goto remove; } case THROWN_MOBY_STATE_MOVE_WITH_COLLISION: { - f32 size, speed, rest_speed, sink; + f32 size_multiplier, speed, rest_speed, sink; f32 half = 0.5f; u8 *carry; struct Hero *player; - size = convert_integer_to_float(D_0013E534) + 1.0f; + size_multiplier = convert_integer_to_float(D_0013E534) + 1.0f; { f32 class_scale = thrown_moby->pclass->scale; - if (thrown_moby->scale < class_scale * half * size) + if (thrown_moby->scale < class_scale * half * size_multiplier) thrown_moby->scale = - thrown_moby->scale + class_scale * (frame_scale * 0.05f) * size; + thrown_moby->scale + class_scale * (frame_scale * 0.05f) * size_multiplier; } if (fast_dec_timer(&spawner_throw_vars->effect_timer)) { spawner_throw_vars->effect_timer = scale_game_frames(4); @@ -279,12 +279,12 @@ void doom_bot_spawner_update(struct Moby *thrown_moby) { sink = sink / thrown_moby->pclass->scale; end.f[2] -= sink; qcopy_nc(&probe, &next_pos); - probe.f[2] += size * 0.2f; + probe.f[2] += size_multiplier * 0.2f; player = (struct Hero *)(carry - 0x140); - if (coll_sphere(size * 0.3f, &probe, 4, player->moby)) { + if (coll_sphere(size_multiplier * 0.3f, &probe, 4, player->moby)) { collision_point = coll_hit.pad30; qcopy_nc(&thrown_moby->pos, collision_point); - thrown_moby->pos.z -= size * 0.2f; + thrown_moby->pos.z -= size_multiplier * 0.2f; collision_point += 0x10; rest_speed = 0.01f; reflect_vector(spawner_throw_vars, spawner_throw_vars, collision_point); From 6afc6107ec2b69c4ae7f4a749d8d8415245ee43c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:27:37 +0000 Subject: [PATCH 566/657] decomp: clarify names in infobot_update offset -> orbit_offset: Authoritative src/overlays/shared/pickups/infobot.c SHA-256 d6746aba4ad08e0befed06d47f7fa8ec795bbb9e9def34b91ea7c6f2f997e67d declares one Vec offset. Retail 002d5dec..002d5df4 zeroes its quad at sp+0. In INFOBOT_ORBIT_CARRIER, 002d6330..002d6350 stores cos(bob), sin(bob), and height 3 there; 002d6b84..002d6ba8 adds that vector to the transformed attachment position and copies the sum to moby+0x10. In INFOBOT_ORBIT_PATH_ENDPOINT, 002d6884..002d68b8 stores cos(bob)*sway, sin(bob)*sway and zero Z, then 002d6904..002d6928 adds it to the final path point and stores the moby position. Original Ghidra fStack_100/fStack_fc/uStack_f8 and both FUN_001ff278 calls show the same shared orbit displacement. --- src/overlays/shared/pickups/infobot.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/pickups/infobot.c b/src/overlays/shared/pickups/infobot.c index 908e5417c0..a5890d46c7 100644 --- a/src/overlays/shared/pickups/infobot.c +++ b/src/overlays/shared/pickups/infobot.c @@ -333,7 +333,7 @@ void infobot_update(struct Moby *moby) { INFOBOT_WAIT_TO_START_FINAL_SCENE = 10, INFOBOT_SAVE_AND_REMOVE = 11 }; - Vec offset; + Vec orbit_offset; Vec step; Vec point; s32 segment; @@ -354,7 +354,7 @@ void infobot_update(struct Moby *moby) { f32 tilt_x; f32 max_speed; - offset.q = 0; + orbit_offset.q = 0; infobot = (Infobot *)moby->pvars; switch (moby->state) { case INFOBOT_INITIALIZE: @@ -466,9 +466,9 @@ void infobot_update(struct Moby *moby) { return; } infobot->bob = fast_add_rotations(infobot->bob, D_0015ED6C * 3.1415927f); - offset.v.x = fast_cos(infobot->bob); - offset.v.y = fast_sin(infobot->bob); - offset.v.z = 3.0f; + orbit_offset.v.x = fast_cos(infobot->bob); + orbit_offset.v.y = fast_sin(infobot->bob); + orbit_offset.v.z = 3.0f; moby->rot.z = fast_add_rotations(infobot->bob, 1.5707964f); if (infobot->carrier == -1) { break; @@ -560,9 +560,9 @@ void infobot_update(struct Moby *moby) { infobot->sway = 1.0f; } infobot->bob = fast_add_rotations(infobot->bob, D_0015ED6C * 3.1415927f); - offset.v.x = fast_cos(infobot->bob) * infobot->sway; - offset.v.y = fast_sin(infobot->bob) * infobot->sway; - offset.v.z = 0.0f; + orbit_offset.v.x = fast_cos(infobot->bob) * infobot->sway; + orbit_offset.v.y = fast_sin(infobot->bob) * infobot->sway; + orbit_offset.v.z = 0.0f; heading = fast_add_rotations(infobot->bob, 1.5707964f); moby->rot.z = spring_turn(moby->rot.z, heading, @@ -570,7 +570,7 @@ void infobot_update(struct Moby *moby) { D_0015ED6C * 25.132742f, D_0015ED6C * 12.566371f, &infobot->spin[2]); - fast_vec_add(&step, &offset, &orbit_path->pts[orbit_path->count - 1]); + fast_vec_add(&step, &orbit_offset, &orbit_path->pts[orbit_path->count - 1]); MPOS(moby)->q = step.q; if (fast_vec_dist(&D_0013F3D0, &orbit_path->pts[orbit_path->count - 1]) < 2.0f && D_0013F3D0.active != 0) { @@ -640,7 +640,7 @@ void infobot_update(struct Moby *moby) { &step, &D_L00_001600EC_2d5de8[infobot->attach].pos, &step); - fast_vec_add(&point, &offset, &D_L00_001600EC_2d5de8[infobot->attach].pos); + fast_vec_add(&point, &orbit_offset, &D_L00_001600EC_2d5de8[infobot->attach].pos); MPOS(moby)->q = point.q; } } From c0e421cf89cd2f0e1e6dd7201b978b20f032e781 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:27:37 +0000 Subject: [PATCH 567/657] decomp: clarify names in bolt_crank_update offset -> radial_correction: In the authoritative C, target is moby->pos plus (cos(angle), sin(angle))*1.05. Retail 0x002e1774..0x002e1784 subtracts hero position from that target into sp+0x90 (offset), and 0x002e1788 zeros its Z. 0x002e178c measures its XY length for the spring; 0x002e17e8..0x002e17f4 scales the same vector using bolt_crank_radial_correction_step_gp, then 0x002e17f8..0x002e1804 adds it to hero position. Hero height is restored at 0x002e1820. Thus this float[4] is the radial correction toward the crank's target ring. --- src/overlays/shared/props/bolt_crank.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/props/bolt_crank.c b/src/overlays/shared/props/bolt_crank.c index 353b06cf7c..84048342a1 100644 --- a/src/overlays/shared/props/bolt_crank.c +++ b/src/overlays/shared/props/bolt_crank.c @@ -96,7 +96,7 @@ void bolt_crank_update(struct Moby *moby) { float matrix[16]; float stick[4], step[4], facing[4]; Vec4 rotation, target; - float offset[4], spring_pos; + float radial_correction[4], spring_pos; float distance, yaw_diff, angle, old_angle, height_diff, max_speed, height, ground; int save_id, area_clear; struct Moby *clearance_candidate_moby; @@ -313,9 +313,9 @@ void bolt_crank_update(struct Moby *moby) { step[1] = fast_sin(angle) * 1.05f; step[2] = 0.0f; fast_vec_add(&target, &moby->pos, step); - fast_vec_sub(offset, &target, &player->motion.pos); - offset[2] = 0.0f; - distance = vector_length_xy(offset); + fast_vec_sub(radial_correction, &target, &player->motion.pos); + radial_correction[2] = 0.0f; + distance = vector_length_xy(radial_correction); spring_pos = -distance; vendor_spring(&spring_pos, &bolt_crank_radial_correction_step_gp, @@ -323,8 +323,8 @@ void bolt_crank_update(struct Moby *moby) { frame_scale_sq * 0.015f, frame_scale_sq * 0.3f, frame_time * 7.0f); - fast_vec_normalize(offset, offset, bolt_crank_radial_correction_step_gp); - fast_vec_add(&player->motion.pos, &player->motion.pos, offset); + fast_vec_normalize(radial_correction, radial_correction, bolt_crank_radial_correction_step_gp); + fast_vec_add(&player->motion.pos, &player->motion.pos, radial_correction); player->motion.pos.f[2] = height; if (opt_mirror_anim) { player->motion.move_yaw = fast_add_rotations(-1.5707964f, angle); From 8ab8fa21bf33de0a1774334f8944437994c32f36 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:27:37 +0000 Subject: [PATCH 568/657] decomp: clarify names in update_orbit_camera_position offset -> focus_axis_offset: In the bound C snapshot cab7a04fb03ecb00e07fd55f54802dc702fce43dbdf66147d844d3077c519546, offset is a V_32B1F8 populated only from focus_state->axis. Retail 00329db4-00329dd8 uses orbit+0xA0 and dot(rel, axis) to produce sp+0x70, then 00329de0-00329dec subtracts it from rel to obtain lateral. Retail 00329e18-00329e38 overwrites the same temporary with that axis normalized to spring->height and adds it to camera_position_before_height. Retail 0032a494-0032a4b8 again writes sp+0x70 from the same axis with focus_state->dist (focus+0x4C) and adds it to focus to form the viewing goal. These three uses prove a focus-axis displacement, hence focus_axis_offset. --- src/overlays/shared/camera/hoverboard_camera.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/camera/hoverboard_camera.c b/src/overlays/shared/camera/hoverboard_camera.c index ae9b0b6bf7..ce3f6d3523 100644 --- a/src/overlays/shared/camera/hoverboard_camera.c +++ b/src/overlays/shared/camera/hoverboard_camera.c @@ -487,7 +487,7 @@ void update_orbit_camera_position(Camera_32B1F8 *camera) { V_32B1F8 radial; V_32B1F8 camera_position_before_height; V_32B1F8 goal; - V_32B1F8 offset; + V_32B1F8 focus_axis_offset; V_32B1F8 probe; V_32B1F8 step; Orbit_32B1F8 *orbit = camera->orbit; @@ -514,12 +514,12 @@ void update_orbit_camera_position(Camera_32B1F8 *camera) { fast_vec_sub(&rel, pos = &camera->pos, &focus); probe_step = 0; along = fast_vec_dot(&rel, &focus_state->axis); - fast_vec_normalize(&offset, &focus_state->axis, along); - fast_vec_sub(&lateral, &rel, &offset); + fast_vec_normalize(&focus_axis_offset, &focus_state->axis, along); + fast_vec_sub(&lateral, &rel, &focus_axis_offset); fast_vec_normalize(&radial, &lateral, spring->dist); fast_vec_add(&camera_position_before_height, &focus, &radial); - fast_vec_normalize(&offset, &focus_state->axis, spring->height); - fast_vec_add(&goal, &camera_position_before_height, &offset); + fast_vec_normalize(&focus_axis_offset, &focus_state->axis, spring->height); + fast_vec_add(&goal, &camera_position_before_height, &focus_axis_offset); fast_vec_add(&goal, &goal, &orbit->bias); camera->pos.x = cam_interp_values(camera->pos.x, goal.x, @@ -636,8 +636,8 @@ void update_orbit_camera_position(Camera_32B1F8 *camera) { update_hero_follow_camera_orbit(camera); qcopy(&focus_state->pos, &orbit->next); qcopy(&focus, &focus_state->pos); - fast_vec_normalize(&offset, &focus_state->axis, focus_state->dist); - fast_vec_add(&goal, &focus, &offset); + fast_vec_normalize(&focus_axis_offset, &focus_state->axis, focus_state->dist); + fast_vec_add(&goal, &focus, &focus_axis_offset); fast_vec_sub(&rel, &goal, &camera->pos); fast_vec_normalize(&rel, &rel, 1.0f); along = fast_vec_dot(&camera->fwd, &rel); From 168a9f4e6102cc9ed0f0f5c4c5ccd9960842a080 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:29:41 +0000 Subject: [PATCH 569/657] decomp: clarify names in explosive_projectile_update size -> spark_particle_size: In the authoritative C, float size is declared solely inside the spark loop, assigned 105000.0f or 21000.0f when cutscene_active_macro is nonzero, and passed to spawn_shrinking_effect_particle_with_gravity_and_secondary_spawns with spark_vel. Retail 0x002f7540-0x002f7548 loads 105000 into f20; 0x002f7564-0x002f757c conditionally replaces it with 21000. 0x002f75b8 moves f20 to f12 for call 0x002f75d4 -> checked level-01 helper 0x00280bd0. Helper 0x00280c1c preserves f12, then stores it at allocated particle+0x0c (0x00280c84) and +0x3c (0x00280cb4); position and spark velocity are copied separately at +0x10 and +0x20. This proves the spark particle size-scalar role without assigning units. --- src/overlays/shared/enemies/bomber_jet_projectile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/enemies/bomber_jet_projectile.c b/src/overlays/shared/enemies/bomber_jet_projectile.c index 3586a5e1ba..aff8283127 100644 --- a/src/overlays/shared/enemies/bomber_jet_projectile.c +++ b/src/overlays/shared/enemies/bomber_jet_projectile.c @@ -353,7 +353,7 @@ void explosive_projectile_update(struct Moby *moby) { for (spark = 0; cutscene_active_macro != 0 ? spark < 10 : spark < 40; spark++) { Vec_2F7E08 spark_vel; float speed; - float size; + float spark_particle_size; { Vec_2F7E08 random_dir; *(u128_f6 *)&random_dir = 0; @@ -365,17 +365,17 @@ void explosive_projectile_update(struct Moby *moby) { speed = random_float_between(10.0f, 40.0f) * D_0015ED6C; fast_vec_normalize( &spark_vel, &spark_vel, cutscene_active_macro != 0 ? speed * 0.2f : speed); - size = 105000.0f; + spark_particle_size = 105000.0f; fast_vec_add(&spark_vel, &spark_vel, projectile_vars); if (cutscene_active_macro != 0) { - size = 21000.0f; + spark_particle_size = 21000.0f; } spawn_shrinking_effect_particle_with_gravity_and_secondary_spawns( &(*(Vec_2F7E08 *)&moby->pos), &spark_vel, 0x4F007FFF, 0x1F00007F, - size, + spark_particle_size, random_int_between(scale_game_frames(0x5A), scale_game_frames(0x96)) / rate_divisor, 1, -1, From a7650f1a91cc01eda7d0a1b6867b5e3095f3b6b4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:29:41 +0000 Subject: [PATCH 570/657] decomp: clarify names in smoke_vent_update count1 -> view_gated_burst_particle_count: Authoritative smoke_vent.c declares count1 as s32 and assigns random_integer_below(7) != 0 ? 1 : random_integer_below(5) + 5 in SMOKE_VENT_STATE_VIEW_GATED_EMISSION; k1 < count1 bounds a loop with one spawn_spark per iteration. Retail 0x002ef134-0x002ef154 selects 1 or the random-plus-5 quantity into s5, 0x002ef188 decrements it, 0x002ef324 spawns one smoke particle and 0x002ef32c repeats until zero. Original Ghidra iVar11 has the corresponding random selection and decrementing spawn loop. count2 -> alternating_burst_particle_count: Authoritative smoke_vent.c declares count2 as s32 and assigns random_integer_below(7) != 0 ? 1 : random_integer_below(5) + 5 in SMOKE_VENT_STATE_ALTERNATING_PUFF_TIMING; k2 < count2 bounds a loop with one spawn_spark per iteration. Retail 0x002ef5e4-0x002ef5fc selects 1 or the random-plus-5 quantity, 0x002ef628 moves it into s6, 0x002ef650 decrements it, 0x002ef7ec spawns one smoke particle and 0x002ef7f4 repeats until zero. Original Ghidra iVar11 has the corresponding second decrementing spawn loop. --- src/overlays/l02/mobys/smoke_vent.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l02/mobys/smoke_vent.c b/src/overlays/l02/mobys/smoke_vent.c index 56d41f4a8e..dd86fca830 100644 --- a/src/overlays/l02/mobys/smoke_vent.c +++ b/src/overlays/l02/mobys/smoke_vent.c @@ -137,13 +137,13 @@ void smoke_vent_update(struct Moby *moby) { Vec4 smoke_particle_velocity; Vec4 acc; Vec4 vector_perturbation; - s32 count1; + s32 view_gated_burst_particle_count; s32 k1; s32 time_a1_burst; s32 time_b1_burst; s32 color_a1_burst; s32 color_b1_burst; - s32 count2; + s32 alternating_burst_particle_count; s32 k2; s32 time_a2_burst; s32 time_b2_burst; @@ -175,8 +175,8 @@ void smoke_vent_update(struct Moby *moby) { smoke_vent_vars->timer_C0 = truncate_float_to_s32( scale_time(random_float_between((f32)view_gated_smoke_burst_interval_min_gp, (f32)view_gated_smoke_burst_interval_max_gp))); - count1 = random_integer_below(7) != 0 ? 1 : random_integer_below(5) + 5; - for (k1 = 0; k1 < count1; k1++) { + view_gated_burst_particle_count = random_integer_below(7) != 0 ? 1 : random_integer_below(5) + 5; + for (k1 = 0; k1 < view_gated_burst_particle_count; k1++) { random_vector(&vector_perturbation, 0.0f, view_gated_smoke_burst_jitter_magnitude_max_gp * frame_time); @@ -316,8 +316,8 @@ void smoke_vent_update(struct Moby *moby) { smoke_vent_vars->timer_C0 = truncate_float_to_s32( scale_time(random_float_between((f32)alternating_smoke_burst_interval_min_gp, (f32)alternating_smoke_burst_interval_max_gp))); - count2 = random_integer_below(7) != 0 ? 1 : random_integer_below(5) + 5; - for (k2 = 0; k2 < count2; k2++) { + alternating_burst_particle_count = random_integer_below(7) != 0 ? 1 : random_integer_below(5) + 5; + for (k2 = 0; k2 < alternating_burst_particle_count; k2++) { random_vector(&vector_perturbation, 0.0f, alternating_smoke_burst_jitter_magnitude_max_gp * frame_time); From 1e91ba968c9dfca668ae3f5192528cf88939e684 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:29:42 +0000 Subject: [PATCH 571/657] decomp: clarify names in devastator_update size -> target_reticle_scale: Bound source src/overlays/shared/weapons/devastator.c SHA-256 9be2acfd88f70fcbc0b9c73994516b5c5bc649ee46426322bb4d450b063cf6af declares one float size, assigned absolute_float(0.9f - scaled_target_distance * 0.57f) and used only as the scale argument of suck_draw_reticle for the tracked target point. Retail 0x002b23b4-0x002b23d0 computes view-origin-to-target distance divided by 100; 0x002b23f4-0x002b240c multiplies by 0.57, subtracts from 0.9 and takes absolute value. 0x002b2414 saves this in f21; 0x002b246c passes f21 in f12 to the target reticle draw at 0x002b248c, alongside target point a2 and color 0xFF0FFF0F. Original Ghidra uVar19 follows this same calculation into func_0x001edf60. --- src/overlays/shared/weapons/devastator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/devastator.c b/src/overlays/shared/weapons/devastator.c index 5c7bab1979..1b6c07d98e 100644 --- a/src/overlays/shared/weapons/devastator.c +++ b/src/overlays/shared/weapons/devastator.c @@ -315,7 +315,7 @@ void devastator_update(struct Moby *devastator_moby) { UsageStat_2b2100 *stats; Hit_2b2100 *hit; float height, limit, yaw, pitch, yaw0, pitch0; - float size; + float target_reticle_scale; float muzzle_light_color_x, muzzle_light_color_y, muzzle_light_color_z; int i; @@ -364,11 +364,11 @@ void devastator_update(struct Moby *devastator_moby) { fast_vec_dist(view_origin_2b2100, &devastator_vars->target->pos) / 100.0f; qcopy(&point, &devastator_vars->target->pos); point.f.z += devastator_vars->target_height; - size = absolute_float(0.9f - scaled_target_distance * 0.57f); + target_reticle_scale = absolute_float(0.9f - scaled_target_distance * 0.57f); suck_draw_reticle( (int)devastator_moby, 0xFF0FFF0F, - size, + target_reticle_scale, &point, fast_normalize_angle( convert_integer_to_float(D_L00_0015F5CC_2b2100 % scale_game_frames(240)) * From 93378b4faf9dff1a8cbac9b957fc42be26d214ef Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:29:42 +0000 Subject: [PATCH 572/657] decomp: clarify names in update_electric_water_bolt_effect timer -> side_arc_remaining_frames: Bound source src/overlays/shared/props/electric_water.c SHA-256 0cbd5348f69156525cc19f8227e8188d459394262159515d114e3b1bede84aa0 declares timer = D_L15_00161CC0[k] in the non-reset branch of the four-side-arc loop. Retail 0x002d8190-0x002d81a8 selects and decrements the signed halfword at 0x00161cc0 + 2*k; 0x002d81b0-0x002d81cc resets it with scale_game_frames(D_L15_00161CD0[k]) when regenerating the arc. Retail 0x002d8484-0x002d84a0 loads this remaining countdown into a1 and takes its absolute difference from the fade-peak timer at 0x00161cd8 + 2*k; 0x002d84a4-0x002d84ec converts that difference into the arc fade level. Thus this local is the remaining frame count for the selected side arc, not an elapsed timer. --- src/overlays/shared/props/electric_water.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/props/electric_water.c b/src/overlays/shared/props/electric_water.c index 8caba1ffee..3296a6bd64 100644 --- a/src/overlays/shared/props/electric_water.c +++ b/src/overlays/shared/props/electric_water.c @@ -970,12 +970,12 @@ void update_electric_water_bolt_effect(Moby *moby) { } { int elapsed = D_L15_00161CD8[k]; - int timer = D_L15_00161CC0[k]; + int side_arc_remaining_frames = D_L15_00161CC0[k]; float fade; - if (elapsed < timer) { - elapsed = timer - elapsed; + if (elapsed < side_arc_remaining_frames) { + elapsed = side_arc_remaining_frames - elapsed; } else { - elapsed = elapsed - timer; + elapsed = elapsed - side_arc_remaining_frames; } fade = convert_integer_to_float(elapsed); fade = fade / convert_integer_to_float(scale_game_frames(15)); From 9b73f63ec0789d026cb63544a99c80b9c573d578 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:29:42 +0000 Subject: [PATCH 573/657] decomp: clarify names in snow_plow_update timer -> instance_index_or_spawn_frames: Authoritative snow_plow_update source declares timer once. Warning path assigns truncate_float_to_s32((float)(((int)moby-D_L04_0015FFD8)>>8)) and passes it as the instance %d argument to debug_print. Retail 0x002ca4f4-0x002ca508 subtracts the Moby array base, shifts by 8 and converts; 0x002ca51c passes that result in a2. Every subsequent source assignment is scale_game_frames(90), passed to FUN_L00_00263fd8 on hit-spawn paths; retail 0x002caf60-0x002caf88 calls frame scaling with 0x5a and moves its result into t0 before spawn call 0x002cafa4, repeated throughout 0x002cafac-0x002cb650. Checked helper level-04 0x00256768 saves incoming t0 in s3 at 0x002567a4 and stores it at spawned Moby pvars+0x30 at 0x00256878. Thus instance_index_or_spawn_frames states both proven roles without guessing the timer consumer. --- src/overlays/l04/mobys/snow_plow.c | 102 ++++++++++++++--------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/src/overlays/l04/mobys/snow_plow.c b/src/overlays/l04/mobys/snow_plow.c index c8c3794bf3..7c6e8b291e 100644 --- a/src/overlays/l04/mobys/snow_plow.c +++ b/src/overlays/l04/mobys/snow_plow.c @@ -143,7 +143,7 @@ void snow_plow_update(struct Moby *moby) { unsigned char state = moby->state; int i, *p, *path; float amount, length, step, speed; - int timer; + int instance_index_or_spawn_frames; qcopy(&update_start_position, &moby->pos); if (!snow_plow_vars) return; @@ -157,8 +157,8 @@ void snow_plow_update(struct Moby *moby) { } else { char *message = snow_plow_missing_path_warning_format; int oclass = moby->oclass; - timer = truncate_float_to_s32((float)(((int)moby - D_L04_0015FFD8) >> 8)); - debug_print(message, oclass, timer); + instance_index_or_spawn_frames = truncate_float_to_s32((float)(((int)moby - D_L04_0015FFD8) >> 8)); + debug_print(message, oclass, instance_index_or_spawn_frames); } moby->draw_dist = 0x7f; moby->update_dist = 0xff; @@ -436,68 +436,68 @@ void snow_plow_update(struct Moby *moby) { fast_vec_scale(&delta, &moby->rot_row0, frame_scale * 0.075f); delta.f[2] += frame_scale * 0.08f; if (moby->oclass == 0x1d2) { - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x63f, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x641, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x642, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1e0) { - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x642, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x643, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x644, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, @@ -505,12 +505,12 @@ void snow_plow_update(struct Moby *moby) { D_L04_0015F580); } else if (moby->oclass == 0x1e6) { int i; - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x645, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, @@ -519,12 +519,12 @@ void snow_plow_update(struct Moby *moby) { i = 5; do { --i; - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x646, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, @@ -532,159 +532,159 @@ void snow_plow_update(struct Moby *moby) { D_L04_0015F580); } while (i >= 0); } else if (moby->oclass == 0x1ea) { - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x647, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x648, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x649, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1ee) { - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x64d, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x64e, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1ef) { - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x64f, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x650, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x651, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x658, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1f2) { - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x652, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x653, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x654, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1ed) { - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x793, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x794, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, @@ -694,12 +694,12 @@ void snow_plow_update(struct Moby *moby) { int i = 2; do { --i; - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x795, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, @@ -711,12 +711,12 @@ void snow_plow_update(struct Moby *moby) { int i = 2; do { --i; - timer = scale_game_frames(90); + instance_index_or_spawn_frames = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x796, &moby->pos, &moby->rot, - timer, + instance_index_or_spawn_frames, 0, frame_time_sq * 12.0f, &delta, From b2d255a6efc42ea536303da5e56250eabe1798b0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:29:42 +0000 Subject: [PATCH 574/657] decomp: clarify names in draw_flickering_mesh_effect size -> particle_size: Source assigns this first size binding from random_float_between(particle_size0, particle_size1) and passes it to spawn_colored_effect_size_first. Retail 002f6c54-002f6c68 loads pvars+0xe4/+0xe8 as bounds and saves the returned float in f20; 002f6c94 moves f20 to f12 for emitter 0027b450 at 002f6cb0. Supplied spawn_colored_effect context stores its size argument at effect+0x0c. size -> puff_size: Source initializes the second size binding from random_float_between(puff_size0, puff_size1) and passes it to spawn_effect_particle_with_target_scalar alongside the two packed puff colors and lifetime. Retail 002f6d5c-002f6d78 loads pvars+0x10c/+0x110 as random bounds and saves the result in f22; 002f6ea4 supplies f22 in f12 to the puff emitter 00277198 at 002f6eb0. --- src/overlays/l08/mobys/flickering_mesh_effect.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l08/mobys/flickering_mesh_effect.c b/src/overlays/l08/mobys/flickering_mesh_effect.c index ec87a2daa9..28c0b5a555 100644 --- a/src/overlays/l08/mobys/flickering_mesh_effect.c +++ b/src/overlays/l08/mobys/flickering_mesh_effect.c @@ -502,7 +502,7 @@ void draw_flickering_mesh_effect(struct Moby *moby) { float x = random_float_between(-1.0f, 1.0f) * flickering_mesh_vars->particle_range; float fraction = random_float_between(0.0f, x); - float size; + float particle_size; short life; int r, g, b, a; Vec4 *particle_motion = &sv0; @@ -522,7 +522,7 @@ void draw_flickering_mesh_effect(struct Moby *moby) { frame_scale; sv0.f[2] = random_float_between(0.0f, flickering_mesh_vars->particle_z) * frame_scale; - size = random_float_between(flickering_mesh_vars->particle_size0, + particle_size = random_float_between(flickering_mesh_vars->particle_size0, flickering_mesh_vars->particle_size1); life = scale_game_frames(flickering_mesh_vars->particle_life); r = flickering_mesh_vars->particle_r; @@ -531,7 +531,7 @@ void draw_flickering_mesh_effect(struct Moby *moby) { a = truncate_float_to_s32( convert_integer_to_float(flickering_mesh_vars->particle_a) * fraction); spawn_colored_effect_size_first( - moby, &sv1, particle_motion, size, life, r, g, b, a); + moby, &sv1, particle_motion, particle_size, life, r, g, b, a); } } if (fast_dec_timer_s16(&flickering_mesh_vars->puff_timer)) { @@ -547,7 +547,7 @@ void draw_flickering_mesh_effect(struct Moby *moby) { (flickering_mesh_vars->puff_c1[1] << 8) | flickering_mesh_vars->puff_c1[0]; float width = flickering_mesh_vars->size_x * 0.5f; - float size = random_float_between(flickering_mesh_vars->puff_size0, + float puff_size = random_float_between(flickering_mesh_vars->puff_size0, flickering_mesh_vars->puff_size1); int life = scale_game_frames(random_int_between( flickering_mesh_vars->puff_life0, flickering_mesh_vars->puff_life1)); @@ -576,7 +576,7 @@ void draw_flickering_mesh_effect(struct Moby *moby) { 1.0f - flickering_mesh_vars->puff_blend + shape * flickering_mesh_vars->puff_blend); spawn_effect_particle_with_target_scalar( - &sv1, &sv0, puff_spawn_color, puff_payload_color, size, life); + &sv1, &sv0, puff_spawn_color, puff_payload_color, puff_size, life); } } if (flickering_mesh_vars->light != -1) { From fdb066bf66201c14608089852883d6199d6b1ae3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:31:40 +0000 Subject: [PATCH 575/657] decomp: clarify names in update_batalia_bolt_pickup size -> collection_effect_scale: In the supplied source's BOLT_PICKUP_FLY_TO_HERO_AND_CREDIT_BOLTS collection branch, size is random_float_between(0.4f, 0.5f) and supplies size*0.2f,size to the first FUN_L00_00272060 call and size*0.14f,size*shrink to the second. Original retail decompilation uses fVar22 for these same arguments. Retail 0x002e445c..0x002e4480 loads 0.4/0.5, calls 0x002620e8 and saves f0 in f20; 0x002e44a4..0x002e44c0 passes f20*0.2 and f20 to 0x0027c540, while 0x002e44dc..0x002e4504 passes f20*0.7 and f20*0.14 to the paired call. This proves a shared random collection-effect scale, distinct from moby->scale. --- src/overlays/l08/mobys/batalia_bolt_pickup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l08/mobys/batalia_bolt_pickup.c b/src/overlays/l08/mobys/batalia_bolt_pickup.c index 5590b4b40b..3dcb04b3c6 100644 --- a/src/overlays/l08/mobys/batalia_bolt_pickup.c +++ b/src/overlays/l08/mobys/batalia_bolt_pickup.c @@ -462,7 +462,7 @@ void update_batalia_bolt_pickup(struct Moby *moby) { int value; int spin; float shrink; - float size; + float collection_effect_scale; BoltSource_4BE8 *source; switch (moby->oclass) { @@ -506,11 +506,11 @@ void update_batalia_bolt_pickup(struct Moby *moby) { if (spin == 0) { spin--; } - size = random_float_between(0.4f, 0.5f); + collection_effect_scale = random_float_between(0.4f, 0.5f); FUN_L00_00272060(surface_basis_and_collection_vectors + 4, scale_game_frames(0x19), - size * 0.2f, - size, + collection_effect_scale * 0.2f, + collection_effect_scale, 0x7F207F7F, 0, spin, @@ -519,8 +519,8 @@ void update_batalia_bolt_pickup(struct Moby *moby) { spin = -spin; FUN_L00_00272060(surface_basis_and_collection_vectors + 4, scale_game_frames(0x19), - size * 0.14f, - size * shrink, + collection_effect_scale * 0.14f, + collection_effect_scale * shrink, 0x7F7F7F7F, 1, spin, From 6bfdcc3381a7d69c3b25434ea6261d286d63a677 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:31:40 +0000 Subject: [PATCH 576/657] decomp: clarify names in update_fighter_jet_flight offset -> path_sum_or_camera_offset: Retail 0x002ba650..0x002ba680 adds the selected 128-byte path record vectors at +0 and +0x10 into sp+0x90 and takes its length for yaw_limit (f22). Original Ghidra exposes this as uStack_150. Later 0x002baa34..0x002baa5c overwrites the same sp+0x90 vector with FlightData +0xB4/+0xB8/+0xBC camera offsets and W=0; 0x002baa60..0x002baa80 transforms it by the jet rotation basis and adds moby position to obtain camera position. Current C FlightVec offset has precisely both data flows, so path_sum_or_camera_offset records its two roles without claiming the unknown path-vector semantics. --- src/overlays/l13/mobys/fighter_jet.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l13/mobys/fighter_jet.c b/src/overlays/l13/mobys/fighter_jet.c index 87ad7827a8..b410f12eb1 100644 --- a/src/overlays/l13/mobys/fighter_jet.c +++ b/src/overlays/l13/mobys/fighter_jet.c @@ -1258,7 +1258,7 @@ void update_fighter_jet_flight(void *moby_arg, void *data_arg) { FlightVec vertical; FlightVec camera_angles; FlightVec target; - FlightVec offset; + FlightVec path_sum_or_camera_offset; float steer_x; float steer_y; float steer_rate_x; @@ -1392,10 +1392,10 @@ void update_fighter_jet_flight(void *moby_arg, void *data_arg) { char *paths = (char *)l13_cuboids_gp; qcopy(target, ((char(*)[128])paths)[jet_flight_state->target_path] + 0x30); pitch_limit = fast_vec_length(paths + path_offset + 0x20); - fast_vec_add(offset, + fast_vec_add(path_sum_or_camera_offset, (jet_flight_state->target_path << 7) + (char *)l13_cuboids_gp, (jet_flight_state->target_path << 7) + (char *)l13_cuboids_gp + 0x10); - yaw_limit = fast_vec_length(offset); + yaw_limit = fast_vec_length(path_sum_or_camera_offset); } else { qcopy(target, &fighter_jet_steering_reference_position); } @@ -1498,12 +1498,12 @@ void update_fighter_jet_flight(void *moby_arg, void *data_arg) { frame_scale_sq_gp * 0.8f, frame_scale_gp); } - offset[0] = jet_flight_state->camera_offset_x; - offset[1] = jet_flight_state->camera_offset_y; - offset[2] = jet_flight_state->camera_offset_z; - offset[3] = 0.0f; + path_sum_or_camera_offset[0] = jet_flight_state->camera_offset_x; + path_sum_or_camera_offset[1] = jet_flight_state->camera_offset_y; + path_sum_or_camera_offset[2] = jet_flight_state->camera_offset_z; + path_sum_or_camera_offset[3] = 0.0f; euler_rotation_basis(basis, (char *)&jet_flight_state->roll); - transform_vector_by_basis(target, offset, basis); + transform_vector_by_basis(target, path_sum_or_camera_offset, basis); fast_vec_add(camera.v.pos, moby->pos, target); set_camera_position(camera.v.pos); camera.v.rot[0] = From 2cb3a5b8eb4bf89f44a741767d192ff6f9a9e30a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:33:38 +0000 Subject: [PATCH 577/657] decomp: clarify names in snd_play_vag_stream_by_loc_ex_cb size -> request_word_1: Retail 0x0012ec30 stores incoming a1 unchanged at sp+0x4, the zero-based second 32-bit word. At 0x0012ec2c sp becomes the payload pointer; 0x0012ec34/0x0012ec3c select playback command 0x2c and 28-byte payload for 0x0012ec58. Original Ghidra dwWord1 -> uStack_2c agrees with source playback_request_payload[1] = size. The supplied transport copies this word as payload bytes. This names the proven request-word role without claiming an unsupported size unit, consistent with existing request_word_6. --- src/audio/streaming/vag/snd_play_vag_stream_by_loc_ex_cb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/streaming/vag/snd_play_vag_stream_by_loc_ex_cb.c b/src/audio/streaming/vag/snd_play_vag_stream_by_loc_ex_cb.c index 34d92761c3..4cdbc6b93a 100644 --- a/src/audio/streaming/vag/snd_play_vag_stream_by_loc_ex_cb.c +++ b/src/audio/streaming/vag/snd_play_vag_stream_by_loc_ex_cb.c @@ -20,7 +20,7 @@ void snd_play_vag_stream_by_loc_ex_cb(s32 loc, u64 cb_data) __asm__("FUN_0012ec08"); void snd_play_vag_stream_by_loc_ex_cb(s32 loc, - s32 size, + s32 request_word_1, s32 vol_l, s32 vol_r, s32 pitch, @@ -35,7 +35,7 @@ void snd_play_vag_stream_by_loc_ex_cb(s32 loc, s32 playback_request_payload[7]; new_var = (pitch << 16) | (vol_l & 0xFFFF); playback_request_payload[0] = loc; - playback_request_payload[1] = size; + playback_request_payload[1] = request_word_1; playback_request_payload[2] = new_var; playback_request_payload[3] = (flags << 16) | (vol_r & 0xFFFF); playback_request_payload[4] = voice; From 19196e348077b97c2228da573873590854473c1d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:35:34 +0000 Subject: [PATCH 578/657] decomp: clarify names in pause_stage_sprite_lists count -> word_copy_countdown: In the bound source src/ui/menus/pause/pause_stage_sprite_lists.c (SHA-256 49220c3d3d805eadd1d52b64f9eac924349a47783cb3db214173e625b335e1b9), count starts at 7, decrements after each u32 copy, and controls count >= 0. Retail 0x0021ca6c initializes v1 to 7; lw at 0x0021ca70 and sw at 0x0021ca7c copy one 32-bit word, the source/destination advance by four bytes at 0x0021ca78/0x0021ca88, 0x0021ca74 decrements v1, and bgez at 0x0021ca84 repeats through eight copies. The original Ghidra iVar2 has the same initialization, decrement and nonnegative loop test, proving a word-copy countdown. --- src/ui/menus/pause/pause_stage_sprite_lists.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/menus/pause/pause_stage_sprite_lists.c b/src/ui/menus/pause/pause_stage_sprite_lists.c index 6fad71fbf3..ca9829d114 100644 --- a/src/ui/menus/pause/pause_stage_sprite_lists.c +++ b/src/ui/menus/pause/pause_stage_sprite_lists.c @@ -6,14 +6,14 @@ int pause_stage_sprite_lists(u32 *mode) __asm__("FUN_0021ca60"); int pause_stage_sprite_lists(u32 *sprite_list_source_base) { u32 *sprite_list_source = sprite_list_source_base + 12; u32 *iop_sprite_list_destination = pause_iop_sprite_lists; - int count = 7; + int word_copy_countdown = 7; do { *iop_sprite_list_destination = *sprite_list_source; sprite_list_source++; iop_sprite_list_destination++; - count--; - } while (count >= 0); + word_copy_countdown--; + } while (word_copy_countdown >= 0); return 0; } From 5aa018f556677c96e3717fa63118170f9ffa4dfb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:35:34 +0000 Subject: [PATCH 579/657] decomp: clarify names in morphoray_chicken_update size -> relative_scale: In src/overlays/shared/weapons/morphoray_chicken.c (SHA-256 00ac349f8d1c428d0410b56f60756e954f58b11f1ac8c1897d25064d34fe9d14), size = chicken_moby->scale / chicken_moby->pclass->scale. Retail 002c9a74 loads pclass, 002c9a7c loads Moby scale at +0x2c, 002c9a80 loads class scale at +0x24, and 002c9a88 divides f1/f0 into f22. Original Ghidra fVar19 has the same quotient. This ratio scales particle offsets (002c9b34, 002c9b6c), feather offsets (002c9e08, 002c9e38), hero-distance thresholds (002ca004), collision dimensions (002ca084/002ca094), and movement clamp (002cab40). Thus relative_scale denotes the proven dimensionless ratio rather than an absolute spatial size. --- .../shared/weapons/morphoray_chicken.c | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/src/overlays/shared/weapons/morphoray_chicken.c b/src/overlays/shared/weapons/morphoray_chicken.c index 406cd1a81f..d8f0a8c29a 100644 --- a/src/overlays/shared/weapons/morphoray_chicken.c +++ b/src/overlays/shared/weapons/morphoray_chicken.c @@ -381,7 +381,7 @@ void morphoray_chicken_update(Moby *chicken_moby) { struct Hero *player; float anim_speed; float flee_angle; - float size; + float relative_scale; float speed; float radius; float angle; @@ -447,7 +447,7 @@ void morphoray_chicken_update(Moby *chicken_moby) { chicken_moby->scale) * 0.1f; } - size = chicken_moby->scale / chicken_moby->pclass->scale; + relative_scale = chicken_moby->scale / chicken_moby->pclass->scale; if (fast_dec_timer(&chicken_vars->hit_cooldown) != 0) { hit = find_moby_hit(chicken_moby, -1, 0); if (hit != 0) { @@ -459,13 +459,13 @@ void morphoray_chicken_update(Moby *chicken_moby) { chicken_moby->hit_slot = 0xFF; if (chicken_vars->health < 1.0f) { if (chicken_vars->gold == 0) { - for (i = 0; i < truncate_float_to_s32(size) * 20; i++) { - radius = random_float_between(0.0f, 0.37f) * size; + for (i = 0; i < truncate_float_to_s32(relative_scale) * 20; i++) { + radius = random_float_between(0.0f, 0.37f) * relative_scale; angle = random_angle_radians(); build_spherical_offset(&point, radius, angle, random_angle_radians()); - point.z += random_float_between(0.25f, 0.5f) * size; + point.z += random_float_between(0.25f, 0.5f) * relative_scale; fast_vec_add(&point, &point, &next_pos); - radius = random_float_between(frame_time * 0.1f, frame_time) * size; + radius = random_float_between(frame_time * 0.1f, frame_time) * relative_scale; angle = random_angle_radians(); build_spherical_offset( &motion_and_normal_scratch, radius, angle, random_angle_radians()); @@ -474,7 +474,7 @@ void morphoray_chicken_update(Moby *chicken_moby) { &motion_and_normal_scratch, 0x3F7F7F7F, 0x2F2F2F, - size * 150000.0f, + relative_scale * 150000.0f, random_int_between(scale_game_frames(0x1E), scale_game_frames(0x39))); } } else { @@ -515,10 +515,10 @@ void morphoray_chicken_update(Moby *chicken_moby) { } } for (j = 0; j < count; j++) { - radius = random_float_between(feather_radius_min, feather_radius_max) * size; + radius = random_float_between(feather_radius_min, feather_radius_max) * relative_scale; angle = random_angle_radians(); build_spherical_offset(&point, radius, angle, random_angle_radians()); - point.z += feather_height * size; + point.z += feather_height * relative_scale; fast_vec_add(&point, &point, &next_pos); angle = random_float_between(feather_speed_min * frame_time, feather_speed_max * frame_time); @@ -547,7 +547,7 @@ void morphoray_chicken_update(Moby *chicken_moby) { random_int_between(scale_game_frames(0x78), scale_game_frames(0x12C)); } if (chicken_vars->expire_timer >= 0) { - speed = (frame_time + frame_time) * size; + speed = (frame_time + frame_time) * relative_scale; } else { speed = 0.333f; } @@ -560,35 +560,35 @@ void morphoray_chicken_update(Moby *chicken_moby) { chicken_moby, random_integer_below(2) == 0, 0, scale_game_frames(5)); } if (fast_dec_timer_s16(&chicken_vars->flee_timer) != 0 && - vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < size * 5.0f) { - ahead.x = fast_cos(chicken_moby->rot.z) * frame_time * size; - ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * size; + vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < relative_scale * 5.0f) { + ahead.x = fast_cos(chicken_moby->rot.z) * frame_time * relative_scale; + ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * relative_scale; ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); path_clear = move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &ahead, 0, size * 0.2f, size * 0.5f, speed, 0.2617994f); + chicken_moby, &next_pos, &ahead, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); if (path_clear != 0 || (fast_difference_between_rotations(chicken_moby->rot.z, fast_arc_tan(next_pos.x - chicken_moby->pos.x, next_pos.y - chicken_moby->pos.y)) < 1.5707964f && - fast_vec_dist(&chicken_moby->pos, &next_pos) > size * 0.01f)) { + fast_vec_dist(&chicken_moby->pos, &next_pos) > relative_scale * 0.01f)) { chicken_moby->state = CHICKEN_STATE_FLEE_FROM_HERO; blend_moby_animation(chicken_moby, 3, 0, scale_game_frames(10)); } else { chicken_vars->flee_timer = random_int_between(scale_game_frames(0x3C), scale_game_frames(0xB4)); } - } else if (vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < size * 5.0f && + } else if (vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < relative_scale * 5.0f && 0.5235988f < fast_difference_between_rotations(flee_angle, chicken_moby->rot.z)) { move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &next_pos, 0, size * 0.2f, size * 0.5f, speed, 0.2617994f); + chicken_moby, &next_pos, &next_pos, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); chicken_moby->state = CHICKEN_STATE_TURN_AWAY_FROM_HERO; blend_moby_animation(chicken_moby, 3, 0, scale_game_frames(10)); } else { move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &next_pos, 0, size * 0.2f, size * 0.5f, speed, 0.2617994f); + chicken_moby, &next_pos, &next_pos, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); } break; case CHICKEN_STATE_TURN_AWAY_FROM_HERO: @@ -599,21 +599,21 @@ void morphoray_chicken_update(Moby *chicken_moby) { frame_time_sq * 1.5707964f, frame_time * 0.7853982f); move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &next_pos, 0, size * 0.2f, size * 0.5f, speed, 0.2617994f); + chicken_moby, &next_pos, &next_pos, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); if (fast_dec_timer_s16(&chicken_vars->flee_timer) != 0 && - vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < size * 5.0f) { - ahead.x = fast_cos(chicken_moby->rot.z) * frame_time * size; - ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * size; + vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < relative_scale * 5.0f) { + ahead.x = fast_cos(chicken_moby->rot.z) * frame_time * relative_scale; + ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * relative_scale; ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); if (absolute_float(probe_ground_height(&ahead, 0, 0.5f) - ahead.z) <= - (frame_time + frame_time) * size) { + (frame_time + frame_time) * relative_scale) { chicken_moby->state = CHICKEN_STATE_FLEE_FROM_HERO; blend_moby_animation(chicken_moby, 3, 0, scale_game_frames(10)); } } else if (fast_difference_between_rotations(flee_angle, chicken_moby->rot.z) < 0.08726646f || - vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) > size * 6.0f) { + vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) > relative_scale * 6.0f) { chicken_moby->state = CHICKEN_STATE_IDLE; chicken_vars->flee_timer = random_int_between(scale_game_frames(0x3C), scale_game_frames(0xB4)); @@ -622,15 +622,15 @@ void morphoray_chicken_update(Moby *chicken_moby) { } break; case CHICKEN_STATE_FLEE_FROM_HERO: - if (vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) > size * 6.0f) { + if (vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) > relative_scale * 6.0f) { chicken_moby->state = CHICKEN_STATE_IDLE; chicken_vars->flee_timer = random_int_between(scale_game_frames(0x3C), scale_game_frames(0xB4)); blend_moby_animation( chicken_moby, random_integer_below(2) == 0, 0, scale_game_frames(5)); move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &next_pos, 0, size * 0.2f, size * 0.5f, speed, 0.2617994f); - } else if (vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < size * 3.0f) { + chicken_moby, &next_pos, &next_pos, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); + } else if (vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < relative_scale * 3.0f) { FUN_L00_00258278(chicken_moby, &chicken_vars->turn_speed, flee_angle, @@ -642,13 +642,13 @@ void morphoray_chicken_update(Moby *chicken_moby) { ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); path_clear = move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &ahead, 0, size * 0.2f, size * 0.5f, speed, 0.2617994f); + chicken_moby, &next_pos, &ahead, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); if (path_clear == 0 && (1.5707964f < fast_difference_between_rotations( chicken_moby->rot.z, fast_arc_tan(next_pos.x - chicken_moby->pos.x, next_pos.y - chicken_moby->pos.y)) || - fast_vec_dist(&chicken_moby->pos, &next_pos) < size * 0.01f)) { + fast_vec_dist(&chicken_moby->pos, &next_pos) < relative_scale * 0.01f)) { chicken_moby->state = CHICKEN_STATE_IDLE; chicken_vars->flee_timer = random_int_between(scale_game_frames(0x3C), scale_game_frames(0xB4)); @@ -665,18 +665,18 @@ void morphoray_chicken_update(Moby *chicken_moby) { frame_time_sq * 0.7853982f, frame_time_sq * 1.5707964f, frame_time * 0.7853982f); - ahead.x = fast_cos(chicken_moby->rot.z) * frame_time * size; - ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * size; + ahead.x = fast_cos(chicken_moby->rot.z) * frame_time * relative_scale; + ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * relative_scale; ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); path_clear = move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &ahead, 0, size * 0.2f, size * 0.5f, speed, 0.2617994f); + chicken_moby, &next_pos, &ahead, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); if (path_clear == 0 && (1.5707964f < fast_difference_between_rotations( chicken_moby->rot.z, fast_arc_tan(next_pos.x - chicken_moby->pos.x, next_pos.y - chicken_moby->pos.y)) || - fast_vec_dist(&chicken_moby->pos, &next_pos) < size * 0.01f)) { + fast_vec_dist(&chicken_moby->pos, &next_pos) < relative_scale * 0.01f)) { chicken_moby->state = CHICKEN_STATE_IDLE; chicken_vars->flee_timer = random_int_between(scale_game_frames(0x3C), scale_game_frames(0xB4)); @@ -687,25 +687,25 @@ void morphoray_chicken_update(Moby *chicken_moby) { break; case CHICKEN_STATE_CLOSE_RANGE_FLEE_FROM_HERO: if (fast_dec_timer_s16(&chicken_vars->flee_timer) != 0 && - vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) > size * 4.0f) { + vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) > relative_scale * 4.0f) { FUN_L00_00258278(chicken_moby, &chicken_vars->turn_speed, flee_angle, frame_time_sq * 0.7853982f, frame_time_sq * 1.5707964f, frame_time * 0.7853982f); - ahead.x = fast_cos(chicken_moby->rot.z) * frame_time * size; - ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * size; + ahead.x = fast_cos(chicken_moby->rot.z) * frame_time * relative_scale; + ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * relative_scale; ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); path_clear = move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &ahead, 0, size * 0.2f, size * 0.5f, speed, 0.2617994f); + chicken_moby, &next_pos, &ahead, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); if (path_clear == 0 && (1.5707964f < fast_difference_between_rotations( chicken_moby->rot.z, fast_arc_tan(next_pos.x - chicken_moby->pos.x, next_pos.y - chicken_moby->pos.y)) || - fast_vec_dist(&chicken_moby->pos, &next_pos) < size * 0.01f)) { + fast_vec_dist(&chicken_moby->pos, &next_pos) < relative_scale * 0.01f)) { chicken_moby->state = CHICKEN_STATE_IDLE; chicken_vars->flee_timer = random_int_between(scale_game_frames(0x3C), scale_game_frames(0xB4)); @@ -722,18 +722,18 @@ void morphoray_chicken_update(Moby *chicken_moby) { frame_time_sq * 0.7853982f, frame_time_sq * 1.5707964f, frame_time * 0.7853982f); - ahead.x = fast_cos(chicken_moby->rot.z) * (frame_time + frame_time) * size; - ahead.y = fast_sin(chicken_moby->rot.z) * (frame_time + frame_time) * size; + ahead.x = fast_cos(chicken_moby->rot.z) * (frame_time + frame_time) * relative_scale; + ahead.y = fast_sin(chicken_moby->rot.z) * (frame_time + frame_time) * relative_scale; ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); path_clear = move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &ahead, 0, size * 0.2f, size * 0.5f, speed, 0.2617994f); + chicken_moby, &next_pos, &ahead, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); if (path_clear == 0 && (1.5707964f < fast_difference_between_rotations( chicken_moby->rot.z, fast_arc_tan(next_pos.x - chicken_moby->pos.x, next_pos.y - chicken_moby->pos.y)) || - fast_vec_dist(&chicken_moby->pos, &next_pos) < size * 0.01f)) { + fast_vec_dist(&chicken_moby->pos, &next_pos) < relative_scale * 0.01f)) { chicken_moby->state = CHICKEN_STATE_IDLE; chicken_vars->flee_timer = random_int_between(scale_game_frames(0x3C), scale_game_frames(0xB4)); @@ -754,10 +754,10 @@ void morphoray_chicken_update(Moby *chicken_moby) { Vec4A *spawn_point; Vec4A *spawn_velocity; spawn_point = &point; - radius = random_float_between(feather_radius_min, feather_radius_max) * size; + radius = random_float_between(feather_radius_min, feather_radius_max) * relative_scale; angle = random_angle_radians(); build_spherical_offset(spawn_point, radius, angle, random_angle_radians()); - point.z += feather_height * size; + point.z += feather_height * relative_scale; fast_vec_add(spawn_point, spawn_point, &next_pos); spawn_velocity = &motion_and_normal_scratch; angle = random_float_between(feather_speed_min * frame_time, @@ -774,13 +774,13 @@ void morphoray_chicken_update(Moby *chicken_moby) { float max; fast_vec_sub(&motion_and_normal_scratch, &next_pos, &chicken_moby->pos); movement_distance = fast_vec_length(&motion_and_normal_scratch); - max = frame_time * size; + max = frame_time * relative_scale; if (max < movement_distance) { fast_vec_normalize(&motion_and_normal_scratch, &motion_and_normal_scratch, max); } fast_vec_add(&next_pos, &chicken_moby->pos, &motion_and_normal_scratch); if (absolute_float(FUN_L00_00259710(&next_pos) - chicken_moby->pos.z) <= - frame_time * size) { + frame_time * relative_scale) { qcopy(&chicken_moby->pos, &next_pos); } } else { @@ -790,7 +790,7 @@ void morphoray_chicken_update(Moby *chicken_moby) { chicken_moby->pos.z -= chicken_vars->fall_speed; { float ground = probe_ground_height(&chicken_moby->pos, 0, 0.5f); - if (chicken_moby->pos.z < ground && ground < chicken_moby->pos.z + size * 0.25f) { + if (chicken_moby->pos.z < ground && ground < chicken_moby->pos.z + relative_scale * 0.25f) { chicken_vars->fall_speed = 0.0f; chicken_moby->pos.z = ground; } From 065573a84eda99867ce6a787c28801cd448a8899 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:35:34 +0000 Subject: [PATCH 580/657] decomp: clarify names in is_turret_group_activated_or_empty count -> live_member_count: In the SHA-256-bound source, count starts at zero and increments only when signed Moby.state >= TURRET_STATE_LIVE_MINIMUM (0). Retail 0x002b4688 initializes t1 to zero; 0x002b46a4 computes t1+1; 0x002b46b4 loads signed state at Moby+0x20; 0x002b46bc and 0x002b46c4 commit the increment only for nonnegative state. At list termination, 0x002b46e4 tests t1==0. Original Ghidra iVar4 follows the same conditional increment and final zero test, proving this counts live/nonnegative-state group members. --- src/overlays/l14/mobys/blarg_heavy_interceptor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 5321a1dbcc..dc9469e718 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -2070,7 +2070,7 @@ int is_turret_group_activated_or_empty(int index) { TURRET_STATE_LIVE_MINIMUM = 0 }; unsigned short *list = (unsigned short *)D_L14_001AC2C0_2B0168[index]; - int count = 0; + int live_member_count = 0; char *moby_pool_base; if (list) goto scan; @@ -2084,12 +2084,12 @@ int is_turret_group_activated_or_empty(int index) { int state = ((signed char)MOBY(moby)->state); char *group_member_vars = ((char *)MOBY(moby)->pvars); if (state >= TURRET_STATE_LIVE_MINIMUM) - count++; + live_member_count++; if (state >= TURRET_STATE_LIVE_MINIMUM && *(short *)(group_member_vars + 0x88)) goto success; list++; if ((short)id < 0) - return count == 0; + return live_member_count == 0; } while (1); } From 90d4f8d1d4e02dda51ffcaa9f1dce5b4c7d93865 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:35:34 +0000 Subject: [PATCH 581/657] decomp: clarify names in _waitIpuIdle64 count -> input_callback_poll_count: In the authoritative C, count starts at zero, is compared against new_var = 0x1389, increments on ordinary polls, and resets after DispatchMpegCallbackNoData. Retail 0x00128514 initializes a1 to zero; 0x00128558 compares the carried count against 0x1389; 0x00128560 increments a1; 0x00128564 calls the input callback and 0x0012856c resets a1. The next IPU_CMD read is at 0x00128570. Ghidra iVar4 likewise counts loop polls between request_mpeg_video_input calls. The C binding briefly receives ctx+0x858 as the callback argument before resetting, so it is not exclusively a counter at every statement. --- src/sdk/ipu/wait_ipu_idle64.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sdk/ipu/wait_ipu_idle64.c b/src/sdk/ipu/wait_ipu_idle64.c index 8fdb4d1191..b665798817 100644 --- a/src/sdk/ipu/wait_ipu_idle64.c +++ b/src/sdk/ipu/wait_ipu_idle64.c @@ -7,18 +7,18 @@ s64 _waitIpuIdle64(s32 *ctx) { }; long new_var; s64 ipu_command_result; - int count = 0; + int input_callback_poll_count = 0; ipu_command_result = *((volatile s64 *)0x10002000); if (ipu_command_result < IPU_CMD_IDLE_THRESHOLD) { if (((*((volatile u32 *)0x10002010)) & 0x4000) == 0) { do { new_var = 0x1389; - if (count >= new_var) { - count = *((s32 *)(((u8 *)ctx) + 0x858)); - DispatchMpegCallbackNoData(count); - count = 0; + if (input_callback_poll_count >= new_var) { + input_callback_poll_count = *((s32 *)(((u8 *)ctx) + 0x858)); + DispatchMpegCallbackNoData(input_callback_poll_count); + input_callback_poll_count = 0; } else { - count++; + input_callback_poll_count++; } ipu_command_result = *((volatile s64 *)0x10002000); } while ((ipu_command_result < IPU_CMD_IDLE_THRESHOLD) && From 2a564978ce5a2ead5a2e3ba70aa10fd3ae3f9659 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:37:22 +0000 Subject: [PATCH 582/657] decomp: clarify names in count_live_mobys_in_list count -> eligible_moby_count: In the bound source count starts at zero and is incremented only inside all three moby eligibility filters. Retail 0030aea0 initializes s3 to zero; 0030aed4-0030aed8 reject negative moby state, 0030aee8-0030aef8 require a null callback record or signed +0x68 < 4, and 0030af00-0030af10 apply excluded_moby_state. Only passing entries reach addiu s3,s3,1 at 0030af1c; 0030af2c returns s3. Thus this is the eligible moby count, rather than the number of list entries traversed. --- src/overlays/l13/mobys/group_clear_trigger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l13/mobys/group_clear_trigger.c b/src/overlays/l13/mobys/group_clear_trigger.c index 17213f34b9..c89ee4128a 100644 --- a/src/overlays/l13/mobys/group_clear_trigger.c +++ b/src/overlays/l13/mobys/group_clear_trigger.c @@ -15,7 +15,7 @@ int count_live_mobys_in_list(int moby_list_index, int count_live_mobys_in_list(int moby_list_index, int excluded_moby_state) { short *moby_id_list = D_L13_001ABB40[moby_list_index]; short *moby_id_cursor; - int count = 0; + int eligible_moby_count = 0; if (moby_id_list == 0) return 0; moby_id_cursor = moby_id_list; @@ -28,12 +28,12 @@ int count_live_mobys_in_list(int moby_list_index, int excluded_moby_state) { if (excluded_moby_state == -1 || *(unsigned char *)((char *)(moby_index << 8) + (int)moby_base + 0x20) != excluded_moby_state) { - count++; + eligible_moby_count++; } } } } while (*moby_id_cursor++ >= 0); - return count; + return eligible_moby_count; } void group_clear_trigger_update(struct Moby *moby) __asm__("FUN_L13_0030af50"); From 7bc728235d31956ee7a168405b0db280131dc214 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:39:05 +0000 Subject: [PATCH 583/657] decomp: clarify names in sceMpegCreate size -> mpeg_work_area_size: Retail 0x0012b7ec saves incoming a2 in s1 while 0x0012b7f0/0x0012b7f8 selects the supplied work area for memset at 0x0012b800; a2 remains its byte length. At 0x0012b814-0x0012b818 the alignment prefix is subtracted from that saved length, 0x0012b81c tests remaining bytes against 0x10c0, and 0x0012b844-0x0012b850 passes the trailing byte capacity to InitializeStateRecord. Bound source uses size in memset(mpeg_work_area,0,size) and rest=size-(decoder-mpeg_work_area). Original Ghidra names this parameter dwWorkAreaSize. Together these prove the original supplied MPEG work-area size in bytes. --- src/sdk/mpeg/api/sce_mpeg_create.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sdk/mpeg/api/sce_mpeg_create.c b/src/sdk/mpeg/api/sce_mpeg_create.c index 4d8b70c5e2..8dbaf4568e 100644 --- a/src/sdk/mpeg/api/sce_mpeg_create.c +++ b/src/sdk/mpeg/api/sce_mpeg_create.c @@ -14,15 +14,15 @@ extern void _clearOnce(void *); extern s32 sceMpegReset(void *); extern s32 ClearMpegReferenceBuffer(void *); -s32 sceMpegCreate(void *mp, u8 *mpeg_work_area, s32 size) { +s32 sceMpegCreate(void *mp, u8 *mpeg_work_area, s32 mpeg_work_area_size) { u8 *decoder; u8 *work_area_allocator; s32 rest; s32 decode_workspace_address; - memset(mpeg_work_area, 0, size); + memset(mpeg_work_area, 0, mpeg_work_area_size); decoder = (u8 *)((((u32)mpeg_work_area + 3) >> 2) << 2); - rest = size - (decoder - mpeg_work_area); + rest = mpeg_work_area_size - (decoder - mpeg_work_area); if ((u32)rest < 0x10C0) { _Error(decoder, mpeg_work_area_too_small_message); return 0; From fa92b0fc694a70071ff7708d202ba3aa891606f7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:41:22 +0000 Subject: [PATCH 584/657] decomp: clarify names in start_vendor_exit_cutscene offset -> cutscene_resource_base_address: Authoritative source SHA-256 deb52d0b05e6ea67275eac7025080ffe77d95bf78eb4e7924ebe3db5deaf21a8 assigns offset = D_L00_001611CC - 0x40000, stores it back, and adds it to D_L00_00173E00[1] and [2] for the cutscene resource addresses at D_L00_0016C860_lui.x58/x5c. Retail 0x0029ae58 loads that base into a1; 0x0029ae70/0x0029ae7c subtract 0x40000; 0x0029ae90-0x0029ae9c add the same adjusted base to both table entries and store the addresses at cutscene +0x58/+0x5c; 0x0029aea4 persists the base. Original Ghidra likewise shows DAT_001611cc -= 0x40000 and both additions. Supplied open_vendor_menu also turns those same table entries into resource pointers by adding a base. --- src/overlays/shared/vendor/vendor_menu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/vendor/vendor_menu.c b/src/overlays/shared/vendor/vendor_menu.c index cb0251e762..1ee8799910 100644 --- a/src/overlays/shared/vendor/vendor_menu.c +++ b/src/overlays/shared/vendor/vendor_menu.c @@ -583,7 +583,7 @@ void start_vendor_exit_cutscene(void) { }; VendorMenu *vendor_state; VendorMoby_29a6b0 *moby; - s32 index, exit_cutscene_id, offset; + s32 index, exit_cutscene_id, cutscene_resource_base_address; f32 *cutscene_world_origin; struct MusicStreamState *state; s32 *selected; @@ -614,11 +614,11 @@ void start_vendor_exit_cutscene(void) { vu1_sync_chain(1); select_level_vu_chain(); selected = (s32 *)((char *)vendor_state + 0x48); - offset = D_L00_001611CC - 0x40000; - D_L00_001611CC = offset; + cutscene_resource_base_address = D_L00_001611CC - 0x40000; + D_L00_001611CC = cutscene_resource_base_address; index = vendor_menu.purchased_item; - D_L00_0016C860_lui.x58 = D_L00_00173E00[1] + offset; - D_L00_0016C860_lui.x5c = D_L00_00173E00[2] + offset; + D_L00_0016C860_lui.x58 = D_L00_00173E00[1] + cutscene_resource_base_address; + D_L00_0016C860_lui.x5c = D_L00_00173E00[2] + cutscene_resource_base_address; exit_cutscene_id = vendor_exit_cutscene_ids_by_item[index]; D_L00_0015F3FC = 0; D_L00_0015F400 = 0; From 45b7ce5b810e8d2fc62eb18f9080b40e61d811a1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:42:59 +0000 Subject: [PATCH 585/657] decomp: clarify names in pool_init_tiles count -> tile_count: The second argument is saved from a1 at 0x002b7a50, tested for positivity at 0x002b7a80, and compared against the incremented outer record index at 0x002b7bf8. That index selects records with stride 0x1190 at 0x002b7aa0 and 0x002b7bb8; a separate fixed three-slot loop advances buffers by 0x5c0. Authoritative C uses count only as i < count in pool_init_tiles, and supplied pool_tiles_and_effects_update passes pool_tiles and 21 then sets pool_draw_count = 21. Thus the parameter counts tile records, rather than bytes or per-tile slots. --- src/overlays/shared/props/pool_init_tiles.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/props/pool_init_tiles.c b/src/overlays/shared/props/pool_init_tiles.c index 2919e784b0..92baa37770 100644 --- a/src/overlays/shared/props/pool_init_tiles.c +++ b/src/overlays/shared/props/pool_init_tiles.c @@ -42,9 +42,9 @@ extern void memset(void *, s32, s32); void pool_init_tiles(VuChainRecord *records, int count) __asm__("FUN_L01_002b7a48"); -void pool_init_tiles(VuChainRecord *records, int count) { +void pool_init_tiles(VuChainRecord *records, int tile_count) { int i; - for (i = 0; i < count; i++) { + for (i = 0; i < tile_count; i++) { int j; for (j = 0; j < 3; j++) { memset(records[i].slots[j].data, 0, 0x400); From 0a16f5e16220855678f040a738c9ce7f7f7e1f8b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:42:59 +0000 Subject: [PATCH 586/657] decomp: clarify names in create_spark_particle size -> packed_color_high_byte_component: Authoritative C passes size as the fourth component to FUN_L00_0025bfe0(r,g,b,size) and also stores it unchanged in SparkBody.f10. Original retail param_17 and instructions agree: 0x0027e994 loads f29, 0x0027ea78 stores f29 to body+0x10, 0x0027eaac passes f29 as f15 to 0x00270ea0, and 0x0027eab0 stores the result in packed_color. Checked helper 0x00270ec8 saves f15 to f23; 0x00270ef8 multiplies this component by 255, 0x00270efc converts it, 0x00270f10 shifts the converted result by 24 and 0x00270f1c ORs it with packed RGB. Thus this float supplies the packed color high byte; no alpha or downstream size semantics are asserted. --- src/overlays/l01/mobys/create_spark_particle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l01/mobys/create_spark_particle.c b/src/overlays/l01/mobys/create_spark_particle.c index 3e789804b1..055b9ae29d 100644 --- a/src/overlays/l01/mobys/create_spark_particle.c +++ b/src/overlays/l01/mobys/create_spark_particle.c @@ -70,7 +70,7 @@ void create_spark_particle(s32 id, f32 g, f32 b, - f32 size) { + f32 packed_color_high_byte_component) { enum { SPARK_MODE_FROM_KIND = 0xFF }; @@ -108,11 +108,11 @@ void create_spark_particle(s32 id, spark_body->r = truncate_float_to_s32(r * 65535.0f); spark_body->g = truncate_float_to_s32(g * 65535.0f); spark_body->b = truncate_float_to_s32(b * 65535.0f); - spark_body->f10 = size; + spark_body->f10 = packed_color_high_byte_component; spark_body->id = id; spark->fC = w; spark->b8 = alpha * 255.0f; spark->hA = scale_game_frames(life); spark_body->b1B = 0; - spark->packed_color = FUN_L00_0025bfe0(r, g, b, size); + spark->packed_color = FUN_L00_0025bfe0(r, g, b, packed_color_high_byte_component); } From e29b23199df1c6a4e76d0d06f29aab20055444c3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:44:59 +0000 Subject: [PATCH 587/657] decomp: clarify names in emit_minibomber_exhaust_puffs size -> exhaust_puff_size: In emit_minibomber_exhaust_puffs, source size starts at 100000.0f, supplies spawn_puff's seventh C argument and decreases by 20000.0f after each of three white exhaust puffs. Retail 0x002b5f08-0x002b5f10 loads 100000 into f20, 0x002b5f88 moves f20 into f15 for the spawn_puff call at 0x002b5f8c, and 0x002b5fd0 subtracts f22=20000. Original Ghidra fVar9 has exactly this flow. The same authoritative source names this argument puff_size in emit_minibomber_bomb_release_effects. Checked helper 0x00274cc4 saves incoming f15 in f22 and 0x00274d2c stores it at puff+0x0c, independently confirming it belongs to each puff rather than its lifetime or position. --- src/overlays/l14/mobys/minibomber.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l14/mobys/minibomber.c b/src/overlays/l14/mobys/minibomber.c index 7f076833d2..bd9cecc21f 100644 --- a/src/overlays/l14/mobys/minibomber.c +++ b/src/overlays/l14/mobys/minibomber.c @@ -1128,7 +1128,7 @@ void emit_minibomber_exhaust_puffs(struct Moby *moby) { int j; int signed_puff_value; int life; - float size; + float exhaust_puff_size; if (moby->state < MINIBOMBER_STATE_FOLLOW_INTRO_OR_EXIT_PATH || moby->state == MINIBOMBER_STATE_DESTROY) return; @@ -1158,12 +1158,12 @@ void emit_minibomber_exhaust_puffs(struct Moby *moby) { fast_vec_add(pos, &moby->pos, exhaust_position_offset); signed_puff_value = 0x10; life = scale_game_frames(2); - size = 100000.0f; + exhaust_puff_size = 100000.0f; for (j = 0; j < 3; j++) { L14Puff *part; L14PuffTail *tail; part = spawn_puff( - pos, 0.05f, 1.0f, 1.0f, signed_puff_value, D_L14_0015F580_macro, size, 0x7FFFFFFF); + pos, 0.05f, 1.0f, 1.0f, signed_puff_value, D_L14_0015F580_macro, exhaust_puff_size, 0x7FFFFFFF); if (part) { tail = &part->tail; part->life = life; @@ -1174,7 +1174,7 @@ void emit_minibomber_exhaust_puffs(struct Moby *moby) { } signed_puff_value = -signed_puff_value; life *= 2; - size -= 20000.0f; + exhaust_puff_size -= 20000.0f; } } From a307b9c485db87518c8eec9c8cc4795b3546861c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:44:59 +0000 Subject: [PATCH 588/657] decomp: clarify names in emit_path_walker_particle offset -> particle_position: Source fast_vec_normalize(offset, source_moby+0xC0, -0.5f) followed by fast_vec_add(offset, offset, source_moby+0x10) converts the displacement into the emission position. Retail 0x002e7adc..0x002e7b08 constructs this vector at sp+0x10; 0x002e7b64 passes that same s1 vector in a0 to the checked particle emitter at 0x002e7b74. size -> random_velocity_magnitude: Source loads path_walker_particle_random_velocity_scale_gp, multiplies by frame_time, and passes size as build_spherical_offset's magnitude before adding movement_velocity into velocity. Retail 0x002e7ae0/af8 computes this product in f21, 0x002e7b28 passes it in f12 to spherical construction at 0x002e7b2c, and 0x002e7b3c adds the movement contribution before emission. --- src/overlays/l16/mobys/path_walker.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l16/mobys/path_walker.c b/src/overlays/l16/mobys/path_walker.c index f2a597e6bb..f0692bdd5d 100644 --- a/src/overlays/l16/mobys/path_walker.c +++ b/src/overlays/l16/mobys/path_walker.c @@ -212,10 +212,10 @@ extern float path_walker_particle_target_scalar_scale_gp __asm__("D_L16_00161EA8 void emit_path_walker_particle(unsigned char *source_moby, void *previous_position) { float input[4]; - float offset[4]; + float particle_position[4]; float movement_velocity[4]; float velocity[4]; - float random_offset_angle, second_random_offset_angle, size, movement_distance, final_size; + float random_offset_angle, second_random_offset_angle, random_velocity_magnitude, movement_distance, final_size; *(OvlQuad *)input = *(OvlQuad *)previous_position; if ((unsigned char)source_moby[0x31] == 0) return; @@ -227,17 +227,17 @@ void emit_path_walker_particle(unsigned char *source_moby, void *previous_positi fast_vec_scale(movement_velocity, source_moby + 0xC0, path_walker_particle_movement_velocity_scale_gp * movement_distance); - size = path_walker_particle_random_velocity_scale_gp; - size *= frame_time; - fast_vec_normalize(offset, source_moby + 0xC0, -0.5f); - fast_vec_add(offset, offset, source_moby + 0x10); + random_velocity_magnitude = path_walker_particle_random_velocity_scale_gp; + random_velocity_magnitude *= frame_time; + fast_vec_normalize(particle_position, source_moby + 0xC0, -0.5f); + fast_vec_add(particle_position, particle_position, source_moby + 0x10); random_offset_angle = random_angle_radians(); second_random_offset_angle = random_angle_radians(); - build_spherical_offset(velocity, size, random_offset_angle, second_random_offset_angle); + build_spherical_offset(velocity, random_velocity_magnitude, random_offset_angle, second_random_offset_angle); fast_vec_add(velocity, velocity, movement_velocity); final_size = path_walker_particle_target_scalar_scale_gp; final_size *= 210000.0f; - func_L00_0026DD70_emit(offset, + func_L00_0026DD70_emit(particle_position, velocity, l16_path_walker_particle_initial_color, D_L16_00161E9C, From 491c10aadb669bdd72d6d0cb38e99fb9a82b0c99 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:45:00 +0000 Subject: [PATCH 589/657] decomp: clarify names in emit_moby_offset_particles size -> particle_spawn_size: Authoritative src/overlays/shared/enemies/bolt_thief.c SHA-256 c33a5552d4cb3253c70103603aa86dddaca1e35fa91d3476dee5c803fa788dd3 declares float size, initializes it to 80000.0f, passes it as spawn_puff's size argument only in the three-particle loop, and subtracts 20000.0f after each spawn. Original Ghidra fVar9 follows the same data flow. Retail 0x002fedd0-0x002fedd8 initializes f20 to 80000, 0x002fee60 copies it into f15 for the call at 0x002fee78, and 0x002fee80 subtracts f22 (20000). Checked helper 0x00274cc4 retains incoming f15 in f22 and 0x00274d2c stores it to the allocated particle's +0x0C. This proves the spawn-time particle size quantity rather than lifetime or position; no physical units are asserted. --- src/overlays/shared/enemies/bolt_thief.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/enemies/bolt_thief.c b/src/overlays/shared/enemies/bolt_thief.c index b6366685fb..f4bd6cb2fa 100644 --- a/src/overlays/shared/enemies/bolt_thief.c +++ b/src/overlays/shared/enemies/bolt_thief.c @@ -96,7 +96,7 @@ void emit_moby_offset_particles(unsigned char *moby) { int j; int signed_particle_variation; int life; - float size; + float particle_spawn_size; fast_vec_scale(emission_position_offset, moby + 0xC0, particle_pair_moby_c0_offset_scale_gp); fast_vec_add(particle_spawn_position, &MOBY(moby)->pos, emission_position_offset); fast_vec_scale(emission_position_offset, moby + 0xE0, particle_pair_moby_e0_offset_scale_gp); @@ -128,7 +128,7 @@ void emit_moby_offset_particles(unsigned char *moby) { fast_vec_add(particle_spawn_position, particle_spawn_position, emission_position_offset); signed_particle_variation = 0x10; life = scale_game_frames(2); - size = 80000.0f; + particle_spawn_size = 80000.0f; for (j = 0; j < 3; j++) { P_eca8 *part; T_eca8 *tail; @@ -138,7 +138,7 @@ void emit_moby_offset_particles(unsigned char *moby) { 1.0f, signed_particle_variation, D_L14_0015F580_macro, - size, + particle_spawn_size, 0x7FFFFFFF); if (part) { tail = &part->tail; @@ -149,7 +149,7 @@ void emit_moby_offset_particles(unsigned char *moby) { tail->bB = part->hA; } signed_particle_variation = -signed_particle_variation; - size -= 20000.0f; + particle_spawn_size -= 20000.0f; life *= 2; } } From 063c8121dab94d311030cd398b669da7022a9bc3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:45:00 +0000 Subject: [PATCH 590/657] decomp: clarify names in read_mpeg count -> transferred_bytes: Retail 0x0023a5bc calls read_cd_stream_sectors with 0x10000 bytes; its returned v0 is passed to read_buf_end_put at 0x0023a5cc and subtracted from read_remaining/s3 at 0x0023a5d0. Retail 0x0023a60c calls sceMpegDemuxPssRing; its returned v0 is passed to read_buf_end_get at 0x0023a61c and subtracted from decode_remaining/s2 at 0x0023a620. Original Ghidra shows both returns as uVar3. The supplied demux implementation measures available bytes via bitstream positions, and the authoritative source assigns both returns to the single s32 count binding, proving a transferred byte total rather than a sector or packet count. --- src/movies/decoder/read_mpeg.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/movies/decoder/read_mpeg.c b/src/movies/decoder/read_mpeg.c index b718430350..c625c675f4 100644 --- a/src/movies/decoder/read_mpeg.c +++ b/src/movies/decoder/read_mpeg.c @@ -72,7 +72,7 @@ s32 read_mpeg(struct VideoDec *video_dec, s32 read_remaining; s32 space; s32 avail; - s32 count; + s32 transferred_bytes; skipped = 0; started = 0; @@ -100,17 +100,17 @@ s32 read_mpeg(struct VideoDec *video_dec, } space = read_buf_begin_put(read_buf, &write_ptr); if (read_remaining > 0 && space > 0xFFFF) { - count = read_cd_stream_sectors(cd_stream, write_ptr, 0x10000, 0); - read_remaining -= count; - read_buf_end_put(read_buf, count); + transferred_bytes = read_cd_stream_sectors(cd_stream, write_ptr, 0x10000, 0); + read_remaining -= transferred_bytes; + read_buf_end_put(read_buf, transferred_bytes); } proceed_audio(); switch_thread(); avail = read_buf_begin_get(read_buf, &read_ptr); if (avail > 0) { - count = sceMpegDemuxPssRing(video_dec, read_ptr, avail, read_buf, read_buf->size); - decode_remaining -= count; - read_buf_end_get(read_buf, count); + transferred_bytes = sceMpegDemuxPssRing(video_dec, read_ptr, avail, read_buf, read_buf->size); + decode_remaining -= transferred_bytes; + read_buf_end_get(read_buf, transferred_bytes); } proceed_audio(); if (!started && vo_buf_is_full(&movie_player->vo_buf) && is_audio_ok()) { From 0dda111e72762061cd3e4c051e4a43fbe6d58172 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:45:00 +0000 Subject: [PATCH 591/657] decomp: clarify names in collect_bolt size -> sparkle_size: In collect_bolt, retail 0x002a6d1c-0x002a6d40 samples random_float_between(0.4f,0.5f) and retains it in f20 (original Ghidra fVar8). The two sparkle calls at 0x002a6d80 and 0x002a6dc0 receive f12/f13 = size*0.2,size and size*0.14,size*0.7, respectively (0x002a6d60-0x002a6d64 and 0x002a6d9c-0x002a6da8), proving a shared sparkle size input. The owned source explicitly declares these helper arguments size0/size1. Checked helper retail 0x002720a4/0x002720ac saves f13/f12; 0x0027212c-0x00272140 scales the first by 210000 into particle+0xC and 0x00272174-0x0027218c stores it at particle+0x20 alongside the equally scaled second at +0x24. Position, lifetime, color, rotation and velocity use separate arguments/storage. Bounded helper evidence request 381f6a9dcbb84bcc800aec11ffc606e6 confirms this data flow; no physical unit or later motion is claimed. --- src/overlays/shared/pickups/bolt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/pickups/bolt.c b/src/overlays/shared/pickups/bolt.c index 1a6cfd6268..c0b1e6851e 100644 --- a/src/overlays/shared/pickups/bolt.c +++ b/src/overlays/shared/pickups/bolt.c @@ -470,7 +470,7 @@ void collect_bolt(struct Moby *bolt) { s32 bolt_value; s32 spin; f32 k; - f32 size; + f32 sparkle_size; BoltSource *bolt_source; switch (bolt->oclass) { @@ -513,11 +513,11 @@ void collect_bolt(struct Moby *bolt) { spin = random_integer_below(2); if (spin == 0) spin--; - size = random_float_between(0.4f, 0.5f); + sparkle_size = random_float_between(0.4f, 0.5f); FUN_L00_00272060(&pos, scale_game_frames(0x19), - size * 0.2f, - size, + sparkle_size * 0.2f, + sparkle_size, 0x7F207F7F, 0, spin, @@ -526,8 +526,8 @@ void collect_bolt(struct Moby *bolt) { spin = -spin; FUN_L00_00272060(&pos, scale_game_frames(0x19), - size * 0.14f, - size * k, + sparkle_size * 0.14f, + sparkle_size * k, 0x7F7F7F7F, 1, spin, From 541ebae33f95461c7769f200f000661f469b1952 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:45:00 +0000 Subject: [PATCH 592/657] decomp: clarify names in initialize_moby_motion_at_position count -> other_same_class_moby_count: count -> other_same_class_moby_count. In authoritative mine.c (SHA-256 dbf6629451232142ddebdd2992edd1364a7527c777238044872572daa0825f4d), count starts at zero and increments only for scanned mobies whose state is neither 0xFE nor 0xFD, whose moby_class equals initialized_moby->moby_class, and which are not initialized_moby. Retail initializes a2 at 0x002aa148, filters states at 0x002aa160-0x002aa174, compares signed class halfwords at 0x002aa178-0x002aa184, excludes self at 0x002aa188-0x002aa18c, and increments a2 once per qualifying moby at 0x002aa1a4 or 0x002aa1b0. The comparison against eight at 0x002aa1c0 controls marking the selected moby's private+0x5C as -1. Original Ghidra iVar8 follows this same zero/increment/threshold data flow. --- src/overlays/shared/weapons/mine.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/mine.c b/src/overlays/shared/weapons/mine.c index 8c63f2b48c..d034f193e1 100644 --- a/src/overlays/shared/weapons/mine.c +++ b/src/overlays/shared/weapons/mine.c @@ -464,7 +464,7 @@ void initialize_moby_motion_at_position(V_2aa008 *requested_position, M_2aa008 *moby_vars; struct Hero *P; N_2aa008 *scanned_moby; - s32 count; + s32 other_same_class_moby_count; N_2aa008 *best; s32 bestv; V_2aa008 *k; @@ -485,7 +485,7 @@ void initialize_moby_motion_at_position(V_2aa008 *requested_position, fast_vec_add(moby_vars, moby_vars, &P->motion.displacement); } moby_vars->h34 = scale_game_frames(0x78); - count = 0; + other_same_class_moby_count = 0; best = 0; bestv = 0; for (scanned_moby = D_L00_0015FFE4_2aa008; scanned_moby; scanned_moby = scanned_moby->p28) { @@ -498,7 +498,7 @@ void initialize_moby_motion_at_position(V_2aa008 *requested_position, bestv = ((D_2aa008 *)scanned_moby->moby_private_vars)->spawn_frame; best = scanned_moby; } - count++; + other_same_class_moby_count++; } } if (count >= 8) From cfbd693896906cde8143143f7c5fffb50e2b3f3a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:47:04 +0000 Subject: [PATCH 593/657] decomp: clarify names in spawn_explosion_effects size -> particle_size: Source assigns size = scale * 400000.0f and uses it only as spawn_particle's size argument in the three-particle loop. Retail loads 400000.0 into f24 at 0x002fa20c..0x002fa214, multiplies scale f22 into f21 at 0x002fa240, and moves f21 to f12 at 0x002fa344 for particle helper call 0x002fa35c. Original decompilation agrees (fVar11 = param_1 * 400000.0). Checked level-01 helper 0x0027f8f8 preserves f12 in f23 at 0x0027f944 and stores it at particle+0x3c via 0x0027fb2c, while the separate f13 input drives randomized velocity. This proves the size belongs to the spawned particle rather than the burst position, velocity or lifetime. --- src/overlays/l01/mobys/birdbot_projectile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l01/mobys/birdbot_projectile.c b/src/overlays/l01/mobys/birdbot_projectile.c index ce53419f4e..ba38653ca1 100644 --- a/src/overlays/l01/mobys/birdbot_projectile.c +++ b/src/overlays/l01/mobys/birdbot_projectile.c @@ -130,7 +130,7 @@ void spawn_explosion_effects(struct Moby *moby, u128 *where, s32 sound, f32 scal BurstPalette outer; BurstPalette *inner_p; Vec4 *pos_p; - f32 size; + f32 particle_size; f32 speed; s32 i; @@ -141,14 +141,14 @@ void spawn_explosion_effects(struct Moby *moby, u128 *where, s32 sound, f32 scal inner_p = &inner; for (i = 2; i >= 0; i--) { speed = random_float_between(8.0f, 10.0f) * frame_time; - size = scale * 400000.0f; + particle_size = scale * 400000.0f; inner = D_L01_0020B4F0; outer = D_L01_0020B508; spawn_particle(pos_p, &particle_base_velocity, inner_p->c[random_integer_below(6)], outer.c[random_integer_below(6)], - size, + particle_size, random_int_between(scale_game_frames(0xF), scale_game_frames(0x14)), random_int_between(scale_game_frames(0x19), scale_game_frames(0x1E)), speed * scale, From f4bba87d7604d9b533893c606c258f75ac73b244 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:47:04 +0000 Subject: [PATCH 594/657] decomp: clarify names in spawn_jittered_effect_particle_with_optional_basis size -> local_velocity_scale: Authoritative source src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c SHA-256 9450a7660ce9ebb217840d90bfded5379a14d56d226bb2f70fd555395d67dc13 uses size only to initialize local_velocity.f[0] before basis transformation, or as the symmetric bounds for q->v30.f[0..1]. Retail 0x0026deac preserves input f12 in f22; 0x0026e0d0 stores f22 at sp+0x20 and 0x0026e0cc-0x0026e0dc transforms that vector into particle+0x30. Without a basis, 0x0026e0e8-0x0026e114 passes -f22 and f22 to both random draws stored at particle+0x30/+0x34. Supplied updater adds that vector to position. Render size at particle+0x0c is separately randomized at 0x0026e088-0x0026e090, so this parameter scales initial local velocity. --- .../effects/update_three_phase_effect_particle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c index c472f33037..b7e4f2bc8c 100644 --- a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c +++ b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c @@ -2313,7 +2313,7 @@ void spawn_jittered_effect_particle_with_optional_basis(voi void spawn_jittered_effect_particle_with_optional_basis(void *spawn_origin, void *optional_spawn_basis, - f32 size) { + f32 local_velocity_scale) { M_26de90 *particle; V_26de90 transformed_spawn_offset, spawn_offset, local_velocity; X_26de90 x; @@ -2353,12 +2353,12 @@ void spawn_jittered_effect_particle_with_optional_basis(void *spawn_origin, q->fade_direction = 1.0f; qzero(&local_velocity); if (optional_spawn_basis) { - local_velocity.f[0] = size; + local_velocity.f[0] = local_velocity_scale; local_velocity.f[2] = -0.0025f; transform_vector_by_basis(&q->v30, &local_velocity, optional_spawn_basis); } else { - q->v30.f[0] = random_float_between(-size, size); - q->v30.f[1] = random_float_between(-size, size); + q->v30.f[0] = random_float_between(-local_velocity_scale, local_velocity_scale); + q->v30.f[1] = random_float_between(-local_velocity_scale, local_velocity_scale); q->v30.f[2] = -0.0025f; } } From f31fea93d5eef09d0078dc5f091dfd4e97c248f4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:49:38 +0000 Subject: [PATCH 595/657] decomp: clarify names in hoverboard_update offset -> effect_sine_offset: Source fast_vec_normalize(offset, moby + 0xd0, distance_scale * fast_sin(angle)) and subsequent fast_vec_add(effect_position, effect_position, offset) establish a sine-weighted effect offset. Retail 0x002f898c forms moby+0xd0 in s1; 0x002f89c4 sets s0=sp+0x30; 0x002f89c8 calls sine with the saved random angle, 0x002f89d0 multiplies it by frame_time*0.25, and 0x002f89d4-0x002f89dc normalizes that axis into sp+0x30. 0x002f89f0-0x002f89fc adds this vector to effect_position at sp+0x20. The original Ghidra auStack_90 has the same producer and add use. Retail then overwrites the sum at 0x002f8a00-04, which is preserved. --- src/overlays/shared/vehicles/hoverboard.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/vehicles/hoverboard.c b/src/overlays/shared/vehicles/hoverboard.c index 9d9f2d1e11..e18c131862 100644 --- a/src/overlays/shared/vehicles/hoverboard.c +++ b/src/overlays/shared/vehicles/hoverboard.c @@ -34,7 +34,7 @@ void hoverboard_update(unsigned char *moby) { HOVERBOARD_STATE_WAIT_FOR_CONTROL_MODE_EXIT = 1 }; char *hoverboard_vars = ((char *)MOBY(moby)->pvars); - float delta[4], position[4], effect_position[4], offset[4], second_position[4]; + float delta[4], position[4], effect_position[4], effect_sine_offset[4], second_position[4]; float angle, distance_scale, delta_length; int state = (u8)MOBY(moby)->state; struct Hero *player_hero; @@ -88,9 +88,9 @@ void hoverboard_update(unsigned char *moby) { angle = random_angle_radians(); distance_scale = frame_time * 0.25f; fast_vec_normalize(effect_position, moby + 0xe0, distance_scale * fast_cos(angle)); - fast_vec_normalize(offset, moby + 0xd0, distance_scale * fast_sin(angle)); + fast_vec_normalize(effect_sine_offset, moby + 0xd0, distance_scale * fast_sin(angle)); fast_vec_add(effect_position, effect_position, delta); - fast_vec_add(effect_position, effect_position, offset); + fast_vec_add(effect_position, effect_position, effect_sine_offset); qcopy(effect_position, delta); effect_position[3] = (float)hoverboard_effect_displacement_w_gp; if ((unsigned char)MOBY(moby)->command == 0) { From fe7a226acec50f9009861a58664d435750c38f7c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:49:38 +0000 Subject: [PATCH 596/657] decomp: clarify names in apply_taunter_to_nearby_mobies count -> taunter_assignment_count: Source initializes count to zero, increments it immediately after storing taunter_moby into first-scan state+0x18 or second-scan candidate Vars+0x78, and returns it. Original Ghidra iVar10 has those same two increments and return. Retail initializes s7 at 0x002b6bd8; sw s5,0x18(s2) at 0x002b6df4 is followed by addiu s7,s7,1 at 0x002b6df8; sw s5,0x78(s1) at 0x002b6eb4 is followed by the other increment at 0x002b6eb8; move v0,s7 at 0x002b6ed0 returns the assignment count. s5 is the input Taunter saved at 0x002b6be0. Thus taunter_assignment_count describes the measured events without claiming unique recipients or downstream effects. --- src/overlays/shared/weapons/taunter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/weapons/taunter.c b/src/overlays/shared/weapons/taunter.c index 095a101a1a..59c71f44a4 100644 --- a/src/overlays/shared/weapons/taunter.c +++ b/src/overlays/shared/weapons/taunter.c @@ -361,7 +361,7 @@ s32 apply_taunter_to_nearby_mobies(Moby *taunter_moby, f32 radius) { Vars *vars; struct Hero *player; s32 limit; - s32 count = 0; + s32 taunter_assignment_count = 0; s32 i; f32 distance; f32 angle; @@ -421,7 +421,7 @@ s32 apply_taunter_to_nearby_mobies(Moby *taunter_moby, f32 radius) { distance < vector_distance_xy((u8 *)current + 0x10, (u8 *)taunter_candidate_moby + 0x10)) { *(Moby **)(state + 0x18) = taunter_moby; - count++; + taunter_assignment_count++; } } } @@ -443,12 +443,12 @@ s32 apply_taunter_to_nearby_mobies(Moby *taunter_moby, f32 radius) { *(f32 *)((u8 *)taunter_candidate_moby + 0x14) - hero.motion.pos.f[1])); if (angle < 0.9599311f) { *(Moby **)((u8 *)vars + 0x78) = taunter_moby; - count++; + taunter_assignment_count++; } } } } - return count; + return taunter_assignment_count; } void taunter_update(Moby *m) __asm__("FUN_L00_002b6f10"); From 4e2ecb6366866f7f3c25f90a3153732d1d9013ff Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:49:39 +0000 Subject: [PATCH 597/657] decomp: clarify names in draw_electric_gate_beams offset -> moby_table_byte_offset: Source assigns offset = (*list & 0x7FFF) << 8 and adds it to the moby-table base for listed_moby and its translation copy. Retail 0030e110 loads the list halfword, 0030e11c masks 0x7fff, 0030e120 shifts into s0 by eight (256-byte records), and 0030e124 adds the base loaded from 0015ffd8. Retail 0030e150-0030e158 reloads that base, adds the same displacement and then +0x10 for moby translation. Original Ghidra likewise computes iVar19 = (*puVar22 & 0x7fff) * 0x100 and adds iRam0015ffd8. --- src/overlays/l05/mobys/electric_gate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l05/mobys/electric_gate.c b/src/overlays/l05/mobys/electric_gate.c index 934f0c9aa9..98f6cb1772 100644 --- a/src/overlays/l05/mobys/electric_gate.c +++ b/src/overlays/l05/mobys/electric_gate.c @@ -123,7 +123,7 @@ void draw_electric_gate_beams(struct Moby *moby) { struct GeometryQuad quads[2][5]; char matrix[0x40]; u64 texture; - int i, j, k, vertex_index, outer_color, inner_color, offset; + int i, j, k, vertex_index, outer_color, inner_color, moby_table_byte_offset; float angle, blend; unsigned short *list; unsigned short *next_moby_index_ptr; From d22957c4d74b1f2a237c9580d373019a19ee618b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:51:28 +0000 Subject: [PATCH 598/657] decomp: clarify names in water_reservoir_update offset0 -> shared_random_offset: Authoritative float offset0[4] is initialized by random_vector with radius water_reservoir_random_offset_radius_gp. Retail 0x002ec8a4-0x002ec8b4 initializes sp+0x20 (s2); 0x002ec8d0-0x002ec8dc uses it as a2 in pos minus offset0, and 0x002ec8f8-0x002ec910 uses it as a1 in offset0 minus offset1. It is therefore the random spatial offset shared by both delta calculations, not a numbered temporary. offset1 -> pair_delta_reference_offset: Authoritative float offset1[4] is initialized by random_vector and used only as the subtracted spatial reference in fast_vec_sub(offset_pair_delta, offset0, offset1). Retail 0x002ec8b8-0x002ec8c8 initializes sp+0x30 (s3), then 0x002ec8f0 moves s3 to a2 for subtraction at 0x002ec90c. The resulting offset_pair_delta receives a configured Z adjustment, scaling and passes to spawn_spark as a2 at 0x002eca04. Reference denotes the subtraction operand, without claiming a physical or temporal endpoint. --- src/overlays/l12/mobys/water_reservoir.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l12/mobys/water_reservoir.c b/src/overlays/l12/mobys/water_reservoir.c index c2bf049723..9ff879a7c1 100644 --- a/src/overlays/l12/mobys/water_reservoir.c +++ b/src/overlays/l12/mobys/water_reservoir.c @@ -50,7 +50,7 @@ void water_reservoir_update(struct Moby *moby) { WATER_RESERVOIR_STATE_ACTIVE = 1 }; float *reservoir_state = (float *)moby->pvars; - float pos[4], offset0[4], offset1[4], pos_offset_delta[4], offset_pair_delta[4]; + float pos[4], shared_random_offset[4], pair_delta_reference_offset[4], pos_offset_delta[4], offset_pair_delta[4]; float fraction, frame_scale; int scaled; if (moby->state != WATER_RESERVOIR_STATE_INITIALIZE) { @@ -89,12 +89,12 @@ void water_reservoir_update(struct Moby *moby) { } if (random_float_between(0.0f, 1.0f) < fraction) { random_vector(pos, 0.0f, water_reservoir_random_offset_radius_gp); - random_vector(offset0, 0.0f, water_reservoir_random_offset_radius_gp); - random_vector(offset1, 0.0f, water_reservoir_random_offset_radius_gp); - fast_vec_sub(pos_offset_delta, pos, offset0); + random_vector(shared_random_offset, 0.0f, water_reservoir_random_offset_radius_gp); + random_vector(pair_delta_reference_offset, 0.0f, water_reservoir_random_offset_radius_gp); + fast_vec_sub(pos_offset_delta, pos, shared_random_offset); pos_offset_delta[2] += water_reservoir_effect_delta_z_reference_gp - water_reservoir_unmirrored_effect_spawn_z_offset_gp; - fast_vec_sub(offset_pair_delta, offset0, offset1); + fast_vec_sub(offset_pair_delta, shared_random_offset, pair_delta_reference_offset); offset_pair_delta[2] += water_reservoir_mirrored_effect_spawn_z_offset_gp - water_reservoir_effect_delta_z_reference_gp; scaled = water_reservoir_effect_delta_scale_divisor_gp; From ded581ec5194ce168e976d7922389512920c1582 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:51:28 +0000 Subject: [PATCH 599/657] decomp: clarify names in spawn_smoke_puff_trail_with_endpoint_bursts count -> trail_puff_count: Retail 002c41fc saves incoming a3 in s7; 002c420c-002c4214 converts it for the (to-from)/count step division at 002c426c and scale-delta division at 002c4290. The zero-based s5 loop increments at 002c4418 and compares against s7 at 002c441c, issuing one puff allocation/spawn at 002c43a4 per iteration. Prepared Ghidra param_6 and the bound C for-loop corroborate this. Endpoint bursts at 002c44d4/002c4564 are outside the loop, proving this counts attempted trail puffs rather than all effect particles. size -> puff_scalar_upper_bound: Bound C size samples random_float_between(1.0f,1.02f); retail 002c4360 returns that sample, 002c4368 retains it in f20, and 002c4384 passes it in f14 to puff helper 0025f990 at 002c43a4. Checked helper 0025f9bc preserves incoming f14 in f24; 0025f9c4 preserves incoming f13 (the caller's 1.0f) in f23. At 0025fae8-0025faf0 those become f12/f13 for random_float_between at 0025faec, whose result is stored at tail+0xC / particle+0x2C at 0025faf4. Thus this local is the upper endpoint of the puff's scalar random range, not the particle size directly stored from f15 at particle+0xC. Supplied helper source's lo/hi call corroborates this exact role. --- .../spawn_smoke_puff_trail_with_endpoint_bursts.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l04/spawn_smoke_puff_trail_with_endpoint_bursts.c b/src/overlays/l04/spawn_smoke_puff_trail_with_endpoint_bursts.c index 8a790a1491..975ab304f9 100644 --- a/src/overlays/l04/spawn_smoke_puff_trail_with_endpoint_bursts.c +++ b/src/overlays/l04/spawn_smoke_puff_trail_with_endpoint_bursts.c @@ -48,7 +48,7 @@ void spawn_smoke_puff_trail_with_endpoint_bursts( void *unused_moby, void *from, void *to, - int count, + int trail_puff_count, float from_puff_scale, float to_puff_scale) { @@ -59,18 +59,18 @@ void spawn_smoke_puff_trail_with_endpoint_bursts( int i; int tint; int grey; - float size; + float puff_scalar_upper_bound; Puff *puff; PuffTail *tail; int spin; fast_vec_sub(&step, to, from); - fast_vec_scale(&step, &step, 1.0f / (float)count); - grow = (to_puff_scale - from_puff_scale) / (float)count; + fast_vec_scale(&step, &step, 1.0f / (float)trail_puff_count); + grow = (to_puff_scale - from_puff_scale) / (float)trail_puff_count; particle_spawn_velocity.q = 0; particle_spawn_velocity.f[3] = 1.0f; particle_spawn_velocity.f[2] = 0.01f; - for (i = 0; i < count; i++) { + for (i = 0; i < trail_puff_count; i++) { fast_vec_scale(&at, &step, convert_integer_to_float(i)); fast_vec_add(&at, from, &at); particle_spawn_velocity.f[0] = randf_sym(0.0f, 0.005f); @@ -81,12 +81,12 @@ void spawn_smoke_puff_trail_with_endpoint_bursts( tint = random_int_between(0x40, 0x70); grey = random_int_between(0x40, 0x7F); grey = grey | (grey << 16 | grey << 8); - size = random_float_between(1.0f, 1.02f); + puff_scalar_upper_bound = random_float_between(1.0f, 1.02f); spin = random_int_between(-2, 2); puff = spawn_puff(&at, smoke_trail_puff_position_jitter_scale_gp, 1.0f, - size, + puff_scalar_upper_bound, spin, &particle_spawn_velocity, grow + from_puff_scale * 210000.0f, From 81515f8c15269e058132700d15362c98571d9e14 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:51:28 +0000 Subject: [PATCH 600/657] decomp: clarify names in linked_moby_hitbox_update size -> moby_scale: In authoritative source SHA-256 e5cb2a90a7a7e82145703a10351f73298650b58abc92738c306b005e4a4b14af, initialization-local size selects one of pvars floats +0/+4 multiplied by moby->pclass->scale, then is assigned directly to moby->scale. Original retail decompilation stores the selected product at owner+0x2c. Retail 0x002c9f10-0x002c9f34 loads both extents, compares f2min_scale; float now = *(float *)linked_hitbox_vars; float scale = moby->pclass->scale; - float size = (now < initial ? initial * scale : now * scale); + float moby_scale = (now < initial ? initial * scale : now * scale); moby->state = LINKED_HITBOX_STATE_WAIT_FOR_LINKED_MOBIES; - moby->scale = size; + moby->scale = moby_scale; } break; case LINKED_HITBOX_STATE_WAIT_FOR_LINKED_MOBIES: From 85bc458e65f4425844b4bb7a0262967fbe25d9be Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:53:18 +0000 Subject: [PATCH 601/657] decomp: clarify names in emit_debris_trail_particles size -> initial_particle_size: Source size holds random_float_between(60000.0f, 140000.0f) and is passed to the final particle creator. Original Ghidra uVar10 follows this same creation-argument flow. Retail 0x002e0710 returns the randomized float, 0x002e0718 saves it in f20, and 0x002e075c moves it to f15 before jal 0x00274c88 at 0x002e0764. Checked level-14 creator instructions preserve f15 in f22 at 0x00274cc4 and store f22 into the newly allocated particle+0x0c at 0x00274d2c. The supplied corresponding creator C names this argument initial_particle_size. Thus this binding is the particle's initial size, not a byte count or duration. --- src/overlays/shared/enemies/path_or_ballistic_debris.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/path_or_ballistic_debris.c b/src/overlays/shared/enemies/path_or_ballistic_debris.c index bcfc8b9bb9..a1e5c108af 100644 --- a/src/overlays/shared/enemies/path_or_ballistic_debris.c +++ b/src/overlays/shared/enemies/path_or_ballistic_debris.c @@ -311,7 +311,7 @@ void emit_debris_trail_particles(Moby *moby) { int signed_particle_variation; int color_intensity; int alpha; - float size; + float initial_particle_size; debris_motion_state = *(Vars **)&moby->pvars; fast_vec_normalize(&emission_axis_offset, &*(Vec4_2E17B8 *)&moby->rot_row2, 0.2f); @@ -373,7 +373,7 @@ void emit_debris_trail_particles(Moby *moby) { if (func_002140B0_2E17B8(2) != 0) { signed_particle_variation = -signed_particle_variation; } - size = func_002140F8_2E17B8(60000.0f, 140000.0f); + initial_particle_size = func_002140F8_2E17B8(60000.0f, 140000.0f); color_intensity = random_int_between(0x30, 0xFF); alpha = 0x60000000; spawned_particle = func_L00_0026DEA0_2E17B8( @@ -383,7 +383,7 @@ void emit_debris_trail_particles(Moby *moby) { 1.0f, signed_particle_variation, &particle_initial_velocity, - size, + initial_particle_size, color_intensity | ((color_intensity << 16) | ((color_intensity << 8) | alpha))); if (spawned_particle != 0) { ParticleFade_2E17B8 *ef; From 159cb6ddb4ed4b72f40220d7c90cd747f766e697 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:53:18 +0000 Subject: [PATCH 602/657] decomp: clarify names in emit_minibomber_bomb_release_effects offset -> release_point_offset: Retail 0x002b59c8-0x002b59fc writes cos/sin of angle plus moby rotation, scaled by 0.8, to sp+0/sp+4 and zero to sp+8, then adds that vector to the supplied point to form effect_spawn_position at sp+0x10. Original Ghidra represents this vector as fStack_110/fStack_10c/uStack_108. At 0x002b5adc-0x002b5af4 it is copied to sp+0x20 and scaled in place by 0.0625; 0x002b5b18 sets its Z and 0x002b5b64-0x002b5b7c passes it as the direction-building seed. This proves a displacement from the release point, reused for the associated particle directions. --- src/overlays/l14/mobys/minibomber.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l14/mobys/minibomber.c b/src/overlays/l14/mobys/minibomber.c index bd9cecc21f..84996b8b3e 100644 --- a/src/overlays/l14/mobys/minibomber.c +++ b/src/overlays/l14/mobys/minibomber.c @@ -980,7 +980,7 @@ void emit_minibomber_bomb_release_effects(struct Moby *moby, float angle) __asm__("FUN_L14_002b5968"); void emit_minibomber_bomb_release_effects(struct Moby *moby, float *point, float angle) { - float offset[4]; + float release_point_offset[4]; float effect_spawn_position[4]; float small_offset[4]; float direction[4]; @@ -999,10 +999,10 @@ void emit_minibomber_bomb_release_effects(struct Moby *moby, float *point, float int high_color; effect_rotation_angle = fast_add_rotations(angle, moby->rot.z); - offset[0] = fast_cos(effect_rotation_angle) * 0.8f; - offset[1] = fast_sin(effect_rotation_angle) * 0.8f; - offset[2] = 0.0f; - fast_vec_add(effect_spawn_position, point, offset); + release_point_offset[0] = fast_cos(effect_rotation_angle) * 0.8f; + release_point_offset[1] = fast_sin(effect_rotation_angle) * 0.8f; + release_point_offset[2] = 0.0f; + fast_vec_add(effect_spawn_position, point, release_point_offset); for (i = 5; i >= 0; i--) { signed_puff_random_value = random_integer_below(2); if (random_integer_below(2)) @@ -1028,15 +1028,15 @@ void emit_minibomber_bomb_release_effects(struct Moby *moby, float *point, float tail->fade = part->life; } } - qcopy(small_offset, offset); - fast_vec_scale(offset, offset, 0.0625f); - offset[2] = random_float_between(0.025f, 0.06f); + qcopy(small_offset, release_point_offset); + fast_vec_scale(release_point_offset, release_point_offset, 0.0625f); + release_point_offset[2] = random_float_between(0.025f, 0.06f); qcopy(original_pos, effect_spawn_position); step = 0.6283f; for (j = 0; j < 16; j++) { effect_rotation_angle = randf_sym(0.0f, 0.5f); build_look_at_matrix( - direction, offset, small_offset, (float)j * step + effect_rotation_angle); + direction, release_point_offset, small_offset, (float)j * step + effect_rotation_angle); effect_spawn_position[0] = original_pos[0] + randf_sym(0.0f, 0.2f); effect_spawn_position[1] = original_pos[1] + randf_sym(0.0f, 0.2f); effect_spawn_position[2] = original_pos[2] + randf_sym(0.0f, 0.2f); From 8a15307d66f5e1e73f0f1c446b0a76033d7c6263 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:55:41 +0000 Subject: [PATCH 603/657] decomp: clarify names in spawn_spinning_and_fading_effect_particle offset -> texture_bank_offset: In the assigned C default branch, offset is initialized to zero and conditionally set to eight under variant_flags bit 2 and item_text_variant[0x10]. Retail 0x0026b374 initializes s0=0; 0x0026b3f8-0x0026b400 selects 8 or 0. At 0x0026b404-0x0026b420 it is added to random_integer_below(8) and the effect_texture_ids base, and the selected byte is stored to particle texture at +2 (0x0026b428). Original Ghidra iVar9 has this same exclusive texture-bank selection flow. size -> initial_travel_distance: Supplied effect_slots_fire passes travel as the fourth argument to spawn_spinning_and_fading_effect_particle, with travel/distance also controlling the emitted velocity spread. Retail 0x0026b254 preserves incoming f12 in f22 and 0x0026b470 stores it at particle+0x30 (motion+0x10); original Ghidra stores param_1 to +0x30. Supplied update_spinning_and_fading_effect_particle advances this exact scalar through advance_accelerated_scalar using negated particle speed, then shortens life when it falls below 0.01. Render size is initialized separately at particle+0xC (0x0026b2dc or 0x0026b390), proving this input is the initial travel-distance scalar rather than rendered size. --- .../effects/update_three_phase_effect_particle.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c index b7e4f2bc8c..e9be4f4e3e 100644 --- a/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c +++ b/src/overlays/shared/rendering/effects/update_three_phase_effect_particle.c @@ -876,7 +876,7 @@ unsigned char *spawn_spinning_and_fading_effect_particle(void *spawn_pos void *initial_velocity, unsigned char variant_flags, - float size) { + float initial_travel_distance) { void *source = spawn_position; unsigned char *particle = create_part2(0xC, 0); if (particle) { @@ -907,7 +907,7 @@ unsigned char *spawn_spinning_and_fading_effect_particle(void *spawn_pos particle[2] = texture; } } else { - int offset = 0; + int texture_bank_offset = 0; float one = 1.0f; float zero = 0.0f; float scale = D_L00_001601B8_gp; @@ -926,18 +926,18 @@ unsigned char *spawn_spinning_and_fading_effect_particle(void *spawn_pos spinning_particle_default_final_color_blend_target_gp, random_float_between(zero, one)); if (variant_flags & 4) { - offset = 8; + texture_bank_offset = 8; if (!item_text_variant[0x10]) - offset = 0; + texture_bank_offset = 0; } - particle[2] = effect_texture_ids[random_integer_below(8) + offset]; + particle[2] = effect_texture_ids[random_integer_below(8) + texture_bank_offset]; particle[3] = 0x44; } particle[9] = truncate_float_to_s32(4.0f) + 0x40; particle[1] = 0; particle[8] = random_integer_below(0xFF); motion[0x1E] = truncate_float_to_s32(randf_sym(1.0f, 4.0f)); - *(float *)(motion + 0x10) = size; + *(float *)(motion + 0x10) = initial_travel_distance; motion[0x1F] = variant_flags; if (variant_flags & 4) { *(short *)(particle + 0xA) = From 5d4d1cf88a9d8eecb9e4f10867644de3c0f2b0f2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:57:56 +0000 Subject: [PATCH 604/657] decomp: clarify names in render_water_grids count -> water_record_count: Retail 002b9204 saves a1 to sp+0x60; 002b9208-002b920c skips traversal when it is nonpositive. The outer counter increments at 002b9224 even for inactive records and is compared with that saved argument at 002b9628-002b9634. Retail 002b9230 computes the next water_record at +0x1190 bytes and 002b9638 installs it. Original Ghidra param_2/iStack_c0 bounds the same loop advancing param_1 by 0x464 floats. Current render_water_grids C uses count in count > 0 and i < count while water_record advances via next_pos, proving a water-record traversal count rather than a tile count. --- src/overlays/shared/rendering/render_water_grids.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/rendering/render_water_grids.c b/src/overlays/shared/rendering/render_water_grids.c index 9c277871d0..ad3e0b0937 100644 --- a/src/overlays/shared/rendering/render_water_grids.c +++ b/src/overlays/shared/rendering/render_water_grids.c @@ -227,7 +227,7 @@ void build_water_render_setup_packet(void) { void render_water_grids(f32 *water_record, s32 count) __asm__("FUN_L01_002b91c8"); -void render_water_grids(f32 *water_record, s32 count) { +void render_water_grids(f32 *water_record, s32 water_record_count) { enum { WATER_GRID_MODE_SKIP_CLIP_TESTS = 0, WATER_GRID_MODE_TEST_NEAR_CLIP = 2 @@ -246,7 +246,7 @@ void render_water_grids(f32 *water_record, s32 count) { build_water_render_setup_packet(); i = 0; - if (count > 0) + if (water_record_count > 0) do { f32 *next_pos = water_record + 0x464; u16 active = *(u16 *)((u8 *)water_record + 0x1e); @@ -365,7 +365,7 @@ void render_water_grids(f32 *water_record, s32 count) { next_entity: i++; water_record = next_pos; - } while (i < count); + } while (i < water_record_count); l01_packet.words[0] = 0x10000000; l01_packet.words[1] = 0; l01_packet.words[2] = 0x13000000; From 066070af26a762f0a4f115439fa7c52e10ec82c9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:57:56 +0000 Subject: [PATCH 605/657] decomp: clarify names in break_apart_shuttle_linked_mobys count -> linked_moby_count: In the authoritative shuttle.c snapshot, short count starts at zero and increments once per linked-list entry after adding that indexed Moby's position to middle; its only subsequent use divides the accumulated positions by convert_integer_to_float(count). Retail 0x00303c30-0x00303c50 masks the list entry and applies the 0x100-byte Moby stride; 0x00303c90 adds its position. The short counter is represented by s3: 0x00303b90 initializes 0x10000, 0x00303ca0-0x00303ca4 extracts the current count, and 0x00303cc0 increments by 0x10000 once per entry. After the signed list termination test at 0x00303cc8-0x00303cd0, 0x00303cd4 converts that count and 0x00303cf0-0x00303cf4 scales the summed positions by its reciprocal. Original Ghidra iVar12/iVar9 and the auStack_140 scaling corroborate a linked Moby count, distinct from the per-piece particle loop. --- src/overlays/l06/mobys/shuttle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l06/mobys/shuttle.c b/src/overlays/l06/mobys/shuttle.c index 840d3e52bf..291e47df91 100644 --- a/src/overlays/l06/mobys/shuttle.c +++ b/src/overlays/l06/mobys/shuttle.c @@ -800,7 +800,7 @@ void break_apart_shuttle_linked_mobys(struct Moby *moby) { float particle_acceleration[4]; struct Moby *piece; short *list; - short count; + short linked_moby_count; int linked_moby_index; int i; float largest; @@ -816,19 +816,19 @@ void break_apart_shuttle_linked_mobys(struct Moby *moby) { largest = 0.0f; clear_u64_value(middle); list = D_L06_001ABFC0_03b68[*(int *)(shuttle_linkage_vars + 0xCC)]; - count = 0; + linked_moby_count = 0; do { linked_moby_index = *list & 0x7FFF; random_vector(push, 1.0f, 2.0f); spawn_shuttle_explosion_effect( 30.0f, moby, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos, push, 1); fast_vec_add(middle, middle, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos); - count++; + linked_moby_count++; if (largest < ((struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w) { largest = ((struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w; } } while (*list++ >= 0); - fast_vec_scale(middle, middle, 1.0f / convert_integer_to_float(count)); + fast_vec_scale(middle, middle, 1.0f / convert_integer_to_float(linked_moby_count)); list = D_L06_001ABFC0_03b68[*(int *)(shuttle_linkage_vars + 0xCC)]; do { float speed; From ecc2625f26b2bfe5ea18a286326d620d2b997349 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:59:43 +0000 Subject: [PATCH 606/657] decomp: clarify names in mine_group_update count -> hit_damage_code: Assigned retail 0030b06c passes sp+30 as t0 to hit-response helper 00282ed8; original Ghidra calls this iStack_c0. Helper evidence 9b495b5bc49b4b049aa87aa698a09d57 moves t0 to s3 at 00282ee8, initializes *s3=0 at 00282f30, writes 1 for absent hit at 0028300c, writes classification constants 2/3/4 at 00283248..002832a0 and downgrades to 1 while clearing hit damage at 002833ac..002833b8. Thus this is a hit damage code, separate from mapped response s1 returned at 00283420. Assigned 0030b0ac..0030b0b4 tests code >=2 before comparing/subtracting hit+2c damage and triggering explosion/removal or surviving-hit handling. offset -> path_point_byte_offset: In authoritative C, offset = j * 16 and path + offset + 0x1c receives fast_vec_dist between point j at path+0x10+j*16 and cyclic point j+1. Assigned retail 0030b208 shifts point index a0 left four into s0; 0030b210..0030b230 forms the two path point addresses and calls distance helper; 0030b234 adds path base to the same byte offset and 0030b23c stores the segment distance at +0x1c. Original Ghidra piVar3[iVar11*4+7] agrees. This offset selects the 16-byte path point record, relative to the point-array origin before the explicit header/component offsets. --- src/overlays/l07/mobys/mine_group.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l07/mobys/mine_group.c b/src/overlays/l07/mobys/mine_group.c index be6555239b..a10cc0e337 100644 --- a/src/overlays/l07/mobys/mine_group.c +++ b/src/overlays/l07/mobys/mine_group.c @@ -228,7 +228,7 @@ void mine_group_update(struct Moby *moby) { MineGroupVars *boltcrate_pvars; char *path; float *remaining; - int count; + int hit_damage_code; int current; int child; int i; @@ -247,7 +247,7 @@ void mine_group_update(struct Moby *moby) { remaining = &boltcrate_pvars->health; if (boltcrate_pvars->hittable) { limit = find_moby_hit(moby, 0x230000, 0); - hit_response_code = resolve_moby_hit_response(moby, limit, remaining, 0, &count, 0, 0, 4); + hit_response_code = resolve_moby_hit_response(moby, limit, remaining, 0, &hit_damage_code, 0, 0, 4); switch ((unsigned)hit_response_code) { case HIT_REACTION_NONE: case HIT_REACTION_START_KNOCKBACK: @@ -265,7 +265,7 @@ void mine_group_update(struct Moby *moby) { *remaining = 0.0f; break; } - if (count > 1) { + if (hit_damage_code > 1) { float step = *(float *)(limit + 0x2c); if (*remaining <= step) { *remaining = 0.0f; @@ -311,8 +311,8 @@ void mine_group_update(struct Moby *moby) { child_placement_segment_distance = 0; qcopy(position, path + 0x10); for (j = 0; j < *(int *)path; j++) { - int offset = j * 16; - *(float *)(path + offset + 0x1c) = + int path_point_byte_offset = j * 16; + *(float *)(path + path_point_byte_offset + 0x1c) = fast_vec_dist(path + 0x10 + j * 16, path + 0x10 + ((j + 1) % *(int *)path) * 16); } if (get_first_moby_in_group(¤t, boltcrate_pvars->group, 1, 0)) { From aa49fb3cd6b33e34ab3f98f887448411ca0bd694 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:59:43 +0000 Subject: [PATCH 607/657] decomp: clarify names in sliding_gate_update offset -> home_offset: In the authoritative sliding_gate.c snapshot, offset is a Vec4 passed as the third operand of fast_vec_add(&pos, &gate_vars->home, &offset) in both opening and closing branches, with pos copied to gate_moby->pos. Retail 0x0029b034-0x0029b03c saves the initial object position as home at s0+0. At 0x0029b2a0-0x0029b2e0, cos/sin of yaw at s1+0x48 multiply negative travel from s0+0x18 into sp+0 and sp+4, and sp+8 is zero; a1=s0 and a2=sp supply home and this displacement to vector addition. The result is copied to object position at 0x0029b2ec. Closing repeats this data flow at 0x0029b3f8-0x0029b448. Thus home_offset identifies the vector's origin without assuming additional subsystem behavior. --- src/overlays/l15/mobys/sliding_gate.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l15/mobys/sliding_gate.c b/src/overlays/l15/mobys/sliding_gate.c index fa06957fea..d6d8ab0c2e 100644 --- a/src/overlays/l15/mobys/sliding_gate.c +++ b/src/overlays/l15/mobys/sliding_gate.c @@ -51,7 +51,7 @@ void sliding_gate_update(struct Moby *gate_moby) { GATE_OPEN_LATCHED = 5 }; MovingVars *gate_vars = (MovingVars *)gate_moby->pvars; - Vec4 offset; + Vec4 home_offset; Vec4 pos; s32 slot; VoiceSlot_29aff0 *voice_slot; @@ -122,10 +122,10 @@ void sliding_gate_update(struct Moby *gate_moby) { gate_moby->state = GATE_OPEN; } } - offset.f[0] = fast_cos(gate_moby->rot.z) * -gate_vars->travel; - offset.f[1] = fast_sin(gate_moby->rot.z) * -gate_vars->travel; - offset.f[2] = 0.0f; - fast_vec_add(&pos, &gate_vars->home, &offset); + home_offset.f[0] = fast_cos(gate_moby->rot.z) * -gate_vars->travel; + home_offset.f[1] = fast_sin(gate_moby->rot.z) * -gate_vars->travel; + home_offset.f[2] = 0.0f; + fast_vec_add(&pos, &gate_vars->home, &home_offset); *(u128 *)&gate_moby->pos = pos.q; return; case GATE_OPEN: @@ -150,10 +150,10 @@ void sliding_gate_update(struct Moby *gate_moby) { gate_vars->sound = -1; gate_moby->state = GATE_WAIT_TO_OPEN; } - offset.f[0] = fast_cos(gate_moby->rot.z) * -gate_vars->travel; - offset.f[1] = fast_sin(gate_moby->rot.z) * -gate_vars->travel; - offset.f[2] = 0.0f; - fast_vec_add(&pos, &gate_vars->home, &offset); + home_offset.f[0] = fast_cos(gate_moby->rot.z) * -gate_vars->travel; + home_offset.f[1] = fast_sin(gate_moby->rot.z) * -gate_vars->travel; + home_offset.f[2] = 0.0f; + fast_vec_add(&pos, &gate_vars->home, &home_offset); *(u128 *)&gate_moby->pos = pos.q; if (is_point_inside_clip_volume(D_0013F3D0, gate_vars->open_volume) || is_point_inside_clip_volume(D_L15_001673C0, gate_vars->open_volume)) From 37e95370e9aa759781a2973f9abfa6b65079fbf7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 14:59:43 +0000 Subject: [PATCH 608/657] decomp: clarify names in initialize_pause_menu count -> texture_slots_cleared: In initialize_pause_menu's non-reservation branch, s32 count starts at zero, increments once after *slot=0 and slot--, and stops at four; slot starts at &D_L00_001841F0.texture_slots[3]. Thus it counts cleared texture slots, not bytes or an animation index. Original Ghidra zeroes DAT_00184444 backwards for four iterations. Retail 0027679C forms descriptor+0x254 (texture_slots[3]); 002767A4 initializes a four-iteration countdown; 002767A8 stores zero, 002767AC decrements the counter, and 002767BC/002767C0 repeat while moving the pointer back four bytes. The source upward count is the same completed-slot count. --- src/overlays/shared/ui/menus/initialize_pause_menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/ui/menus/initialize_pause_menu.c b/src/overlays/shared/ui/menus/initialize_pause_menu.c index 47ffa267dc..88dd16ff3a 100644 --- a/src/overlays/shared/ui/menus/initialize_pause_menu.c +++ b/src/overlays/shared/ui/menus/initialize_pause_menu.c @@ -370,7 +370,7 @@ void initialize_pause_menu(void) { D_L00_001841F0.map_image_vram = 0; D_L00_001841F0.tex_clut_vram = 0; slot = &D_L00_001841F0.texture_slots[3]; - for (count = 0; count < 4; count++) { + for (texture_slots_cleared = 0; texture_slots_cleared < 4; texture_slots_cleared++) { *slot = 0; slot--; } From a24fc92478a98a753ba4b47acb3c4dae20fe3ce3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:01:39 +0000 Subject: [PATCH 609/657] decomp: clarify names in butterfly_swarm_update size -> spawn_radius: Authoritative source assigns size = random_float_between(0.6f, 0.9f), then uses it solely in child position offsets cos(angle)*sin(angle2)*size, sin(angle)*sin(angle2)*size, and cos(angle2)*size after copying the parent position. Retail 0029f080 returns this random scalar, 0029f088 preserves it in f22, and 0029f0ac, 0029f0d4, 0029f0e4 multiply each spherical direction component by f22 before stores to child+0x10/+0x14/+0x18. Original Ghidra fVar5 has the same three-component flow. Thus the scalar is the child's spawn offset radius, separate from child scale randomized at 0029f008..0029f01c. --- src/overlays/l04/mobys/butterfly_swarm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l04/mobys/butterfly_swarm.c b/src/overlays/l04/mobys/butterfly_swarm.c index b892896678..b161eee638 100644 --- a/src/overlays/l04/mobys/butterfly_swarm.c +++ b/src/overlays/l04/mobys/butterfly_swarm.c @@ -560,7 +560,7 @@ void butterfly_swarm_update(struct Moby *moby) { f32 angle; f32 angle2; f32 speed; - f32 size; + f32 spawn_radius; f32 average; f32 effect[8]; @@ -634,10 +634,10 @@ void butterfly_swarm_update(struct Moby *moby) { qcopy(&child->pos, &moby->pos); angle = random_angle_radians(); angle2 = random_angle_radians(); - size = random_float_between(0.6f, 0.9f); - child->pos.x += fast_cos(angle) * fast_sin(angle2) * size; - child->pos.y += fast_sin(angle) * fast_sin(angle2) * size; - child->pos.z += fast_cos(angle2) * size; + spawn_radius = random_float_between(0.6f, 0.9f); + child->pos.x += fast_cos(angle) * fast_sin(angle2) * spawn_radius; + child->pos.y += fast_sin(angle) * fast_sin(angle2) * spawn_radius; + child->pos.z += fast_cos(angle2) * spawn_radius; part->unk50 = 0; part->leader_pos = &moby->pos; part->unk58 = 0; From 899d2d5bc40c5c813734b1e2943d36d4e29edc9e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:01:39 +0000 Subject: [PATCH 610/657] decomp: clarify names in spawn_rocket_strike_fighter_exhaust size -> puff_spawn_size: The authoritative C uses this single float binding only as the size scalar passed to spawn_puff: 100000.0f for each three-puff loop, decremented by 20000.0f, and 300000.0f for the optional grey puff. Retail 002fd484-002fd48c and 002fd704-002fd70c initialize f20; 002fd500/002fd780 move f20 into f15 before calls 002fd504/002fd784, and 002fd548/002fd7c8 decrement it. 002fd554-002fd55c resets f20 for the grey call via 002fd5e0/002fd5f0. Original Ghidra fVar12 agrees for the loops. Checked helper 00274cc4 saves incoming f15 in f22 and 00274d2c stores it at allocated puff+0x0C, proving this is the puff creation scalar rather than a vector offset or allocation byte count. --- src/overlays/l14/mobys/rocket_strike_fighter.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l14/mobys/rocket_strike_fighter.c b/src/overlays/l14/mobys/rocket_strike_fighter.c index 77306d530f..9b3426f0e7 100644 --- a/src/overlays/l14/mobys/rocket_strike_fighter.c +++ b/src/overlays/l14/mobys/rocket_strike_fighter.c @@ -287,7 +287,7 @@ void spawn_rocket_strike_fighter_exhaust(struct Moby *moby) { int spin; int life; int grey; - float size; + float puff_spawn_size; if (moby->state == ROCKET_STRIKE_FIGHTER_STATE_INITIALIZE || moby->state == ROCKET_STRIKE_FIGHTER_STATE_WAIT_FOR_RESPAWN || @@ -318,13 +318,13 @@ void spawn_rocket_strike_fighter_exhaust(struct Moby *moby) { tail->fade = puff->life; } } - size = 100000.0f; + puff_spawn_size = 100000.0f; fast_vec_scale(&step, &moby->rot_row0, rocket_strike_fighter_exhaust_ring_row0_offset_gp); fast_vec_add(&pos, &pos, &step); spin = 16; life = scale_game_frames(2); for (i = 0; i < 3; i++) { - puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, size, 0x7FFFFFFF); + puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, puff_spawn_size, 0x7FFFFFFF); if (puff != 0) { L14PuffTail *tail = &puff->tail; puff->life = life; @@ -335,9 +335,9 @@ void spawn_rocket_strike_fighter_exhaust(struct Moby *moby) { } spin = -spin; life *= 2; - size -= 20000.0f; + puff_spawn_size -= 20000.0f; } - size = 300000.0f; + puff_spawn_size = 300000.0f; fast_vec_scale(&step, &moby->rot_row0, rocket_strike_fighter_exhaust_grey_puff_row0_offset_gp); fast_vec_add(&pos, &common_exhaust_origin, &step); grey = random_int_between(0x40, 0x80); @@ -351,7 +351,7 @@ void spawn_rocket_strike_fighter_exhaust(struct Moby *moby) { 1.0f, random_integer_below(2) == 0 ? spin : -spin, D_L14_0015F580, - size, + puff_spawn_size, grey); if (grey_puff != 0) { L14PuffTail *tail = &grey_puff->tail; @@ -383,13 +383,13 @@ void spawn_rocket_strike_fighter_exhaust(struct Moby *moby) { tail->fade = puff->life; } } - size = 100000.0f; + puff_spawn_size = 100000.0f; fast_vec_scale(&step, &moby->rot_row0, rocket_strike_fighter_exhaust_ring_row0_offset_gp); fast_vec_add(&pos, &pos, &step); spin = 16; life = scale_game_frames(2); for (i = 0; i < 3; i++) { - puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, size, 0x7FFFFFFF); + puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, puff_spawn_size, 0x7FFFFFFF); if (puff != 0) { L14PuffTail *tail = &puff->tail; puff->life = life; @@ -400,7 +400,7 @@ void spawn_rocket_strike_fighter_exhaust(struct Moby *moby) { } spin = -spin; life *= 2; - size -= 20000.0f; + puff_spawn_size -= 20000.0f; } } From 2ae41497a0c216b3aea618a7bfc1439d7ac301f5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:01:39 +0000 Subject: [PATCH 611/657] decomp: clarify names in spawn_enemy_fighter_exhaust size -> ring_puff_size: The single float size binding is reset to 100000.0f before each three-puff group following enemy_fighter_exhaust_ring_row0_offset_gp, passed only to those spawn_puff calls, and reduced by 20000.0f per iteration. Retail f20 is initialized at 0x002fc590-0x002fc598 and 0x002fc76c-0x002fc774, copied to f15 at 0x002fc608/0x002fc7e0 for calls 0x002fc60c/0x002fc7e4, and decremented at 0x002fc678/0x002fc850. Original decompilation independently shows fVar11 with this flow. Checked helper 0x00274cc4 retains f15 in f22 and 0x00274d2c stores it at puff+0x0c. This identifies the existing size as the ring-puff group size rather than the paired larger puffs' fixed 200000.0f argument; no radius or unit inference is made. --- src/overlays/l14/mobys/enemy_fighter.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l14/mobys/enemy_fighter.c b/src/overlays/l14/mobys/enemy_fighter.c index 4e644294be..d8dd5bf2db 100644 --- a/src/overlays/l14/mobys/enemy_fighter.c +++ b/src/overlays/l14/mobys/enemy_fighter.c @@ -161,7 +161,7 @@ void spawn_enemy_fighter_exhaust(struct Moby *emitter_moby) { int r; int spin; int life; - float size; + float ring_puff_size; if (emitter_moby->state == ENEMY_FIGHTER_STATE_INITIALIZE || emitter_moby->state == ENEMY_FIGHTER_STATE_WAIT_FOR_RESPAWN || emitter_moby->visible == 0) @@ -193,12 +193,12 @@ void spawn_enemy_fighter_exhaust(struct Moby *emitter_moby) { } } spin = 16; - size = 100000.0f; + ring_puff_size = 100000.0f; fast_vec_scale(&step, &emitter_moby->rot_row0, enemy_fighter_exhaust_ring_row0_offset_gp); fast_vec_add(&pos, &pos, &step); life = scale_game_frames(2); for (i = 0; i < 3; i++) { - puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, size, 0x7FFFFFFF); + puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, ring_puff_size, 0x7FFFFFFF); if (puff != 0) { L14PuffTail *tail = &puff->tail; puff->frame = (emitter_moby->draw_dist >> 5 << 4) + exhaust_ftoi(4.0f); @@ -210,7 +210,7 @@ void spawn_enemy_fighter_exhaust(struct Moby *emitter_moby) { } spin = -spin; life *= 2; - size -= 20000.0f; + ring_puff_size -= 20000.0f; } fast_vec_scale(&step, &emitter_moby->rot_row1, enemy_fighter_exhaust_paired_emitter_offset_gp); fast_vec_sub(&pos, &paired_exhaust_origin, &step); @@ -234,12 +234,12 @@ void spawn_enemy_fighter_exhaust(struct Moby *emitter_moby) { } } spin = 16; - size = 100000.0f; + ring_puff_size = 100000.0f; fast_vec_scale(&step, &emitter_moby->rot_row0, enemy_fighter_exhaust_ring_row0_offset_gp); fast_vec_add(&pos, &pos, &step); life = scale_game_frames(2); for (i = 0; i < 3; i++) { - puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, size, 0x7FFFFFFF); + puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, ring_puff_size, 0x7FFFFFFF); if (puff != 0) { L14PuffTail *tail = &puff->tail; puff->frame = (emitter_moby->draw_dist >> 5 << 4) + exhaust_ftoi(4.0f); @@ -251,7 +251,7 @@ void spawn_enemy_fighter_exhaust(struct Moby *emitter_moby) { } spin = -spin; life *= 2; - size -= 20000.0f; + ring_puff_size -= 20000.0f; } } From e99dded02ee6cee30c22bf72aa87a4b1b78eac95 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:01:40 +0000 Subject: [PATCH 612/657] decomp: clarify names in pool_splash count -> tile_count: Authoritative source src/overlays/shared/vendor/draw_vendor_purchase_text.c SHA-256 d058d7ace47740f29a08912ec9c1f89959f69b5f6766389ed9148e82912c3ea7 uses count as i < count in the outer loop and advances HeightTile *tile with tile++ once per iteration. Retail a1 is saved at 0x002a3efc and checked for nonpositive at 0x002a3f38. The iteration counter increments at 0x002a3f44; 0x002a3f54 computes the next record at s2 + 0x1190. At 0x002a44c4-0x002a44d4 the incremented counter is compared with saved a1 and s2 advances to that next record. Original Ghidra param_6 bounds the loop while pfVar6 advances by 0x464 floats (0x1190 bytes), matching sizeof HeightTile. Thus it counts height tiles, not cells or bytes. --- src/overlays/shared/vendor/draw_vendor_purchase_text.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/vendor/draw_vendor_purchase_text.c b/src/overlays/shared/vendor/draw_vendor_purchase_text.c index a66622b287..aa95c64e86 100644 --- a/src/overlays/shared/vendor/draw_vendor_purchase_text.c +++ b/src/overlays/shared/vendor/draw_vendor_purchase_text.c @@ -146,7 +146,7 @@ void pool_splash(HeightTile *tile, void pool_splash( - HeightTile *tile, int count, int add_to_existing_height, float x, float z, float radius, float amount) { + HeightTile *tile, int tile_count, int add_to_existing_height, float x, float z, float radius, float amount) { enum { POOL_SPLASH_KEEP_GREATER_MAGNITUDE = 0 }; @@ -154,7 +154,7 @@ void pool_splash( int row; int i; - for (i = 0; i < count; i++) { + for (i = 0; i < tile_count; i++) { float tile_z = tile->z + l00_pool_height_grid_layout.origin_z; float cell_z = (z - tile_z) / l00_pool_height_grid_layout.cell_height; float cell_x = (x - (tile->x + l00_pool_height_grid_layout.origin_x)) / From 32461a2113ec10bb5507e71b512c64f6e3af2165 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:03:26 +0000 Subject: [PATCH 613/657] decomp: clarify names in bomber_tank_bomb_update size -> initial_particle_size: Retail 002dcd98..002dcdb0 samples random_float_between(200000.0f, 300000.0f); 002dcdb8 saves its result in f20 and 002dcde4 restores it to f12 for emitter 002dcdfc (00276198). Original Ghidra tracks the same uVar14 from random sampling into the emitter's float argument. Authoritative C passes size to mine_debris's initial_size parameter; supplied mine_debris source stores initial_size at particle+0xC and particle_data+0x1C. This proves the initial particle size role. --- src/overlays/l08/mobys/bomber_tank_bomb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l08/mobys/bomber_tank_bomb.c b/src/overlays/l08/mobys/bomber_tank_bomb.c index 25ba8d13f0..5c77fd35f7 100644 --- a/src/overlays/l08/mobys/bomber_tank_bomb.c +++ b/src/overlays/l08/mobys/bomber_tank_bomb.c @@ -189,7 +189,7 @@ void bomber_tank_bomb_update(struct Moby *moby) { switch (axis) { case DETONATION_EFFECT_FIXED_COLORS: { int color, color2, alpha; - float size = random_float_between(200000.0f, 300000.0f); + float initial_particle_size = random_float_between(200000.0f, 300000.0f); color = FUN_L08_002dc9a8_random_color(60); color2 = FUN_L08_002dc9a8_random_color(120); alpha = random_int_between(color, color2); @@ -197,7 +197,7 @@ void bomber_tank_bomb_update(struct Moby *moby) { position, 0x1f101820, 0x101010, - size, + initial_particle_size, alpha, 0); } break; From 73ba5cda98d6ff9fa199ec6a017b77cd5c51330f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:03:26 +0000 Subject: [PATCH 614/657] decomp: clarify names in homing_mine_update timer -> chase_timeout_frames: In authoritative homing_mine.c, the sole s32 timer receives scale_game_frames(600) and is assigned to homing_mine_vars->timeout. Original retail case 1 calls the scaler at 0x00319220-0x00319224 with 600 and stores v0 at pvars+0x78 at 0x0031923c. Chase activation reloads the same countdown at 0x003192e4-0x003192ec. During chase, 0x003195dc-0x003195e4 decrements pvars+0x78 and expiration enters explosion/removal at 0x003195ec-0x00319650, proving a frame-scaled chase timeout duration. --- src/overlays/l07/mobys/homing_mine.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l07/mobys/homing_mine.c b/src/overlays/l07/mobys/homing_mine.c index 0390f9b5c8..5ce150cc16 100644 --- a/src/overlays/l07/mobys/homing_mine.c +++ b/src/overlays/l07/mobys/homing_mine.c @@ -126,7 +126,7 @@ void homing_mine_update(struct Moby *moby) { f32 turn; f32 new_speed; f32 max_speed; - s32 timer; + s32 chase_timeout_frames; if (moby == NULL) return; @@ -177,9 +177,9 @@ void homing_mine_update(struct Moby *moby) { moby->state = HOMING_MINE_WAIT_FOR_PROXIMITY; break; case HOMING_MINE_WAIT_FOR_PROXIMITY: - timer = scale_game_frames(600); + chase_timeout_frames = scale_game_frames(600); turn = D_0015ED6C * 6.2831855f; - homing_mine_vars->timeout = timer; + homing_mine_vars->timeout = chase_timeout_frames; moby->rot.z = fast_add_rotations(moby->rot.z, turn); if ((homing_mine_vars->target != NULL && vector_distance_xy(&moby->pos, &(homing_mine_vars->target)->pos) < 20.0f && From 16214578d5a35f9d18ffe8e8fa7b360eefc0cd6f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:06:32 +0000 Subject: [PATCH 615/657] decomp: clarify names in leg_walker_update count -> active_point_count: In the SHA-256-bound source, count starts at 0.0f, increments once inside if (active & bit) while six rig->pts/transformed pairs are traversed, and divides their accumulated positional difference in divide_vector_xyz. Retail 0x00295948 clears f20; 0x00295978..0x00295990 tests the selection bit and adds 1.0f to f20 only for a contributing point; 0x00295994..0x002959b4 accumulates differences and advances both point cursors; 0x002959b8..0x002959c4 passes f20 as the divisor. Original Ghidra likewise increments fVar17 only inside (uVar14 & uVar7) != 0 and passes it to the division helper. --- src/overlays/l04/mobys/leg_walker.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l04/mobys/leg_walker.c b/src/overlays/l04/mobys/leg_walker.c index 4d7627b6b7..86afd76667 100644 --- a/src/overlays/l04/mobys/leg_walker.c +++ b/src/overlays/l04/mobys/leg_walker.c @@ -448,7 +448,7 @@ s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f3 if (!(rig->control_flags & 4)) { s32 active = mode | (rig->mode & 0x30); s32 bit = 1; - f32 count = 0.0f; + f32 active_point_count = 0.0f; RigVec *moved = transformed; RigVec *point = (RigVec *)rig->pts; @@ -456,7 +456,7 @@ s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f3 pos = &moby->pos; for (i = 5; i >= 0; i--) { if (active & bit) { - count += 1.0f; + active_point_count += 1.0f; fast_vec_add(&shift, &shift, point); fast_vec_sub(&shift, &shift, moved); } @@ -464,7 +464,7 @@ s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f3 moved++; point++; } - divide_vector_xyz(&shift, &shift, count); + divide_vector_xyz(&shift, &shift, active_point_count); } else { pos = &moby->pos; shift.x = fast_cos(rig->heading) * rig->speed; From db330901ffbb7e45e03950755bf0f4d5e2457aba Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:08:14 +0000 Subject: [PATCH 616/657] decomp: clarify names in spawner_update offset -> spawn_position_offset: Authoritative src/overlays/shared/enemies/spawner.c SHA-256 46dfbbaf6d084cb376f07e1db37fea0f27e338a04875037f60c3778170efbb55 declares float offset[4] once. Retail 0x0030ad48-0x0030ad6c (also 0x0030ae6c-0x0030ae84) saves stack +0x50 as its address. At 0x0030b028-0x0030b03c fast_vec_normalize writes this vector from launch_velocity with magnitude 0.05; 0x0030b040-0x0030b050 adds random XYZ offsets bounded by 0.025 using the supplied add_random_offset_to_vector_xyz helper. At 0x0030b054-0x0030b060 it is added to spawn_position at stack +0x40. Original Ghidra shows the same puStack_c8/auStack_e0 flow into auStack_f0, subsequently used as trajectory origin and egg creation position at 0x0030b080-0x0030b0ac. Thus it is specifically the spawn-position displacement. --- src/overlays/shared/enemies/spawner.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/enemies/spawner.c b/src/overlays/shared/enemies/spawner.c index ce484d15a3..fb809c0ffc 100644 --- a/src/overlays/shared/enemies/spawner.c +++ b/src/overlays/shared/enemies/spawner.c @@ -152,7 +152,7 @@ void spawner_update(char *moby) { float target[4]; float launch_velocity[4]; float spawn_position[4]; - float offset[4]; + float spawn_position_offset[4]; process_spawner_hit_record(moby, spawner_vars); switch ((unsigned char)MOBY(moby)->state) { @@ -275,9 +275,9 @@ void spawner_update(char *moby) { float speed = target_distance * (frame_time_macro * 0.6f); fast_vec_normalize(launch_velocity, launch_velocity, speed); moby_point_position(moby, 0, spawn_position); - fast_vec_normalize(offset, launch_velocity, 0.05f); - add_random_offset_to_vector_xyz(offset, 0.025f); - fast_vec_add(spawn_position, spawn_position, offset); + fast_vec_normalize(spawn_position_offset, launch_velocity, 0.05f); + add_random_offset_to_vector_xyz(spawn_position_offset, 0.025f); + fast_vec_add(spawn_position, spawn_position, spawn_position_offset); launch_velocity[2] = FUN_L00_0025abf0_30ab80( spawn_position, target, 0, speed, -(frame_time_sq_macro * 9.8f)); } From bce41d5fd7b3cd74386e5b8bec45d76159a6d01d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:08:14 +0000 Subject: [PATCH 617/657] decomp: clarify names in update_path_flythrough_camera offset -> orientation_vector: The authoritative float offset[4] corresponds to retail sp+0x10 / Ghidra uStack_110. At 0x002f600c-0x002f6060 it receives descriptor+0x2c XYZ with W=0, transforms by the anchor offset basis and is added to anchor position to construct the initial aim target. At 0x002f60a8-0x002f60cc that same buffer is overwritten with -D_0013F5E0_5f18 and supplies the cross-product reference for cam->m1. During traversal, 0x002f64c8 and 0x002f6550 write target minus camera position to it; 0x002f6580 normalizes it into cam->m0 before rebuilding m1/m2. These distinct uses prove a shared orientation-construction vector, rather than a consistently meaningful bare offset. --- .../shared/camera/path_flythrough_camera.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/camera/path_flythrough_camera.c b/src/overlays/shared/camera/path_flythrough_camera.c index 2c2585b277..fb1b09392d 100644 --- a/src/overlays/shared/camera/path_flythrough_camera.c +++ b/src/overlays/shared/camera/path_flythrough_camera.c @@ -205,7 +205,7 @@ void update_path_flythrough_camera(struct UpdateCam *cam) __asm__("FUN_L10_002f5 void update_path_flythrough_camera(struct UpdateCam *cam) { float initial_aim_or_previous_position[4]; - float offset[4]; + float orientation_vector[4]; float point[4]; float look_point[4]; s32 look_seg; @@ -238,12 +238,12 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { (struct Moby *)(D_L10_0015FFD8_5f18 + *(int *)(flythrough_descriptor_record + 0x28) * 256); float *ofs = (float *)(flythrough_descriptor_record + 0x2C); - offset[0] = ofs[0]; - offset[1] = ofs[1]; - offset[2] = ofs[2]; - offset[3] = 0.0f; - transform_vector_by_basis(offset, offset, l10_path_camera_anchor_offset_basis); - fast_vec_add(point, &anchor->pos, offset); + orientation_vector[0] = ofs[0]; + orientation_vector[1] = ofs[1]; + orientation_vector[2] = ofs[2]; + orientation_vector[3] = 0.0f; + transform_vector_by_basis(orientation_vector, orientation_vector, l10_path_camera_anchor_offset_basis); + fast_vec_add(point, &anchor->pos, orientation_vector); fast_vec_sub(initial_aim_or_previous_position, point, &cam->pos); } else { fast_vec_sub(initial_aim_or_previous_position, look_path + 0x10, &cam->pos); @@ -334,7 +334,7 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { point[3] = 0.0f; transform_vector_by_basis(point, point, l10_path_camera_anchor_offset_basis); fast_vec_add(look_point, &anchor->pos, point); - fast_vec_sub(offset, look_point, &cam->pos); + fast_vec_sub(orientation_vector, look_point, &cam->pos); } else { char *look = ((char *)l10_paths[*(int *)(flythrough_descriptor_record + 0x24)]); look_seg = 0; @@ -347,7 +347,7 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { run->dist / run->path_length * run->look_path_length); debug_point_5f18(point, 0.2f); noop_main_callback(look + 0x10, look + *(int *)look * 16); - fast_vec_sub(offset, point, &cam->pos); + fast_vec_sub(orientation_vector, point, &cam->pos); } fast_vec_scale(point, D_0013F5E0_5f18, -1.0f); fast_vec_normalize(&cam->forward, offset, 1.0f); From dde9d96cfb495404e919a244f6f7ba9fe31b43c4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:08:14 +0000 Subject: [PATCH 618/657] decomp: clarify names in construction_arm_update count -> nonwaiting_arm_count: Function-scope int count corresponds to original Ghidra iVar10 and retail a3: initialized to zero at 0x002c2adc. Group-list entries decode into mobies at 0x002c2af0-0x002c2b00; signed state >=0, matching oclass, and state != CONSTRUCTION_ARM_WAIT_TO_TURN gate its increment at 0x002c2b04-0x002c2b28. A nonzero count at 0x002c2b38 forces a 60-frame retry and clears ready, proving it counts nonwaiting arms in this group. offset -> velocity_spread: Function-scope Vec4 offset is the spread contribution to velocity. Source computes spread from random_float_between(0, effect_speed_max/5)*frame_time, matching f23 at 0x002c2d18-0x002c2d40. Retail 0x002c2d68-0x002c2da0 multiplies cosine/sine of an independent random direction by f23 into stack+0x30/+0x34, sets Z to zero, and adds that vector to the primary velocity at stack+0x20. Original Ghidra fStack_90/fStack_8c agrees. The sum is unused by the effect call; the name describes the computed velocity spread without claiming it affects the emitted effect. --- src/overlays/l15/mobys/construction_arm.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l15/mobys/construction_arm.c b/src/overlays/l15/mobys/construction_arm.c index 61760d6fa2..09e7553603 100644 --- a/src/overlays/l15/mobys/construction_arm.c +++ b/src/overlays/l15/mobys/construction_arm.c @@ -78,12 +78,12 @@ void construction_arm_update(struct Moby *moby) { UpdateVars_2938 *arm_vars = (UpdateVars_2938 *)moby->pvars; int hit = 0; char *slot; - int ready, count; + int ready, nonwaiting_arm_count; unsigned short *list; struct Moby *group_member_moby; float minimum, maximum, speed, spread, direction; int animation, duration, minimum_effect_duration_frames; - Vec4 origin, velocity, offset, sum; + Vec4 origin, velocity, velocity_spread, sum; if (moby->state != CONSTRUCTION_ARM_DESTROY) { slot = find_moby_hit(moby, 0x10000, 0); @@ -111,7 +111,7 @@ void construction_arm_update(struct Moby *moby) { ready = 1; if (moby->group != 0xff) { slot = (char *)l15_moby_group_member_lists[moby->group]; - count = 0; + nonwaiting_arm_count = 0; if (slot == 0) return; list = (unsigned short *)slot; @@ -121,9 +121,9 @@ void construction_arm_update(struct Moby *moby) { if ((signed char)group_member_moby->state >= 0 && group_member_moby->oclass == moby->oclass && group_member_moby->state != CONSTRUCTION_ARM_WAIT_TO_TURN) - count++; + nonwaiting_arm_count++; } while ((short)*list++ >= 0); - if (count != 0) { + if (nonwaiting_arm_count != 0) { arm_vars->timer = scale_game_frames(60); ready = 0; } @@ -171,11 +171,11 @@ void construction_arm_update(struct Moby *moby) { velocity.f[0] = fast_cos(arm_vars->direction) * speed; velocity.f[1] = fast_sin(arm_vars->direction) * speed; velocity.f[2] = 0.0f; - offset.f[0] = fast_cos(direction) * spread; - offset.f[1] = fast_sin(direction) * spread; - offset.f[2] = 0.0f; + velocity_spread.f[0] = fast_cos(direction) * spread; + velocity_spread.f[1] = fast_sin(direction) * spread; + velocity_spread.f[2] = 0.0f; /* Retail computes the sum but passes velocity to the effect helper. */ - add_vectors(&sum, &velocity, &offset); + add_vectors(&sum, &velocity, &velocity_spread); moby_point_position(moby, 1, &origin); minimum_effect_duration_frames = scale_game_frames(construction_arm_effect_duration_min_frames_gp); From ec910bd3e65970e81f8fe79c4196ec605d4b07f7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:08:14 +0000 Subject: [PATCH 619/657] decomp: clarify names in breakable_lamp_update size -> trail_size: Authoritative C and original retail decompilation agree: random_float_between(0.3f,4.0f) at 0x0031ccb8 yields f22 at 0x0031ccc8. It supplies f12=size*0.1 and f13=size at 0x0031cd88/0031cd98 to trail helper 0x0029c350 at 0x0031cdb0, then f12=size*0.07 and f13=size*0.7 at 0x0031cde0/0031cde8 to the second trail at 0x0031cdfc. No other effect consumes this local. Checked helper evidence request d7be768f2947469ca3a9c31460810bcf shows f12/f13 saved at 0x0029c394/0031c39c [correct helper address 0x0029c39c], multiplied by the same conversion constant at 0x0029c41c/0031c46c [correct helper address 0x0029c46c], and stored in allocated trail fields +0x20/+0x24 at 0x0029c474/0x0029c47c. This proves a shared trail size quantity without assuming its exact dimension or units. --- src/overlays/shared/props/breakable_lamp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/props/breakable_lamp.c b/src/overlays/shared/props/breakable_lamp.c index c05d4d1aa6..df8b765276 100644 --- a/src/overlays/shared/props/breakable_lamp.c +++ b/src/overlays/shared/props/breakable_lamp.c @@ -87,7 +87,7 @@ void breakable_lamp_update(struct Moby *moby) { Vec4 start; f32 distance; f32 fade; - f32 size; + f32 trail_size; f32 speed; f32 yaw; f32 pitch; @@ -184,7 +184,7 @@ void breakable_lamp_update(struct Moby *moby) { debris->spawn_frame = moby->spawn_frame; } for (i = 0; i < 24; i++) { - size = random_float_between(0.3f, 4.0f); + trail_size = random_float_between(0.3f, 4.0f); sign = random_integer_below(2); if (sign == 0) { sign--; @@ -200,8 +200,8 @@ void breakable_lamp_update(struct Moby *moby) { frames = scale_game_frames(0x3C); spawn_trail_c8e0(&start, frames, - size * 0.1f, - size, + trail_size * 0.1f, + trail_size, glow_and_spark_state->color | 0x7F000000, 0, sign, @@ -210,7 +210,7 @@ void breakable_lamp_update(struct Moby *moby) { sign = -sign; frames = scale_game_frames(0x3C); spawn_trail_c8e0( - &start, frames, size * 0.07f, size * 0.7f, 0x7F7F7F7F, 1, sign, &effect_motion, 0.003f); + &start, frames, trail_size * 0.07f, trail_size * 0.7f, 0x7F7F7F7F, 1, sign, &effect_motion, 0.003f); effect_motion.f[1] = 0.0f; effect_motion.f[0] = 0.0f; effect_motion.f[2] = random_float_between(0.01f, 0.05f) * frame_scale; From 70ca02140c1a2587eca3721c4b0eeda9285ad6e4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:11:16 +0000 Subject: [PATCH 620/657] decomp: clarify names in run_level_main_loop size -> rotating_sprite_size: Authoritative src/overlays/shared/game/run_level_main_loop.c SHA-256 99656d42de41410e4a76b637996092768ef67f5934b2427e0317628bbc7f53d2 declares float size within the memory-card busy indicator branch, assigns 272.0f, and passes it twice to draw_rotated_sprite after the frame texture. Original retail Ghidra uses uVar12=0x43880000 twice for that call. Retail 0x00246128..0x0024612c loads 272.0 into f21; 0x002461c0 and 0x002461d4 copy it to f14/f15, while f16 receives sprite_rotation_radians at 0x002461d8 before the rotated sprite call 0x002461e4. This proves the common size of the rotating sprite without asserting dimension units. --- src/overlays/shared/game/run_level_main_loop.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/game/run_level_main_loop.c b/src/overlays/shared/game/run_level_main_loop.c index 77308c1a29..d05d57c6bf 100644 --- a/src/overlays/shared/game/run_level_main_loop.c +++ b/src/overlays/shared/game/run_level_main_loop.c @@ -235,12 +235,12 @@ void run_level_main_loop(void) { memory_card_state.pending_state >= MEMCARD_QUERY_INFO) { if (D_L00_001B9CF0.card_icon_hidden == 0) { int rotation_period_frames = 55; - float size; + float rotating_sprite_size; float sprite_rotation_radians; int hud_sprite; setup_gif_paging(0); - size = 272.0f; + rotating_sprite_size = 272.0f; vu1_add_g_sregister(0x47, 0x3004B); hud_sprite = get_icon_frame(0x755D, 0); draw_hud_sprite(hud_sprite, 0x32, 0x12C, 0x40, 0x40, 0x80); @@ -251,8 +251,8 @@ void run_level_main_loop(void) { 0x40, 0x40, get_frame_texture(get_icon_frame(0x755D, 1)), - size, - size, + rotating_sprite_size, + rotating_sprite_size, sprite_rotation_radians); do_gif_paging(); } From 4f9fb7b3d876eef92bb351fab0e588895cb53ae2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:13:08 +0000 Subject: [PATCH 621/657] decomp: clarify names in generate_random_points_from_shape_entries count -> eligible_shape_entry_count: Retail initializes sp+0xfc to zero at 0025ad3c. The mask-bit and entry-header 0x20000 tests at 0025ad68-0025ad94 gate storage of the entry pointer into the compact entries array at 0025ada4. Only this eligible path increments sp+0xfc at 0025af60-0025af70, whereas the source-entry index advances unconditionally at 0025af74-0025af88. Weighted selection loads this count at 0025aff8 and 0025b02c and compares chosen against it at 0025b034. In the authoritative C, entries[count] and weights[count] are populated under exactly those two filters, count++ occurs there, and chosen> index) ^ 1) & 1) && active) { - entries[count] = entry; + entries[eligible_shape_entry_count] = entry; switch (type) { case SHAPE_INLINE_CENTER_SPHERE: case 1: @@ -655,7 +655,7 @@ int generate_random_points_from_shape_entries( radius = *(float *)(entity + 0x2c); radius = *(float *)(list + 8) * radius * 0.0009765625f; } - weights[count] = radius * 4.1887903f * radius * radius; + weights[eligible_shape_entry_count] = radius * 4.1887903f * radius * radius; break; } case SHAPE_XY_DISK_WITH_Z_EXTENT: { @@ -666,7 +666,7 @@ int generate_random_points_from_shape_entries( radius = shape_anchor.f[3] * *(float *)(entity + 0x2c); radius *= 0.0009765625f; extent = *(float *)list * (*(float *)(entity + 0x2c) * 0.0009765625f); - weights[count] = radius * 4.187743f * radius * radius + + weights[eligible_shape_entry_count] = radius * 4.187743f * radius * radius + radius * 1.5707964f * radius * extent; break; } @@ -680,12 +680,12 @@ int generate_random_points_from_shape_entries( fast_vec_sub(&third, &shape_anchor, &second); radius = FUN_001f9af0_25aca0(&third); extent = *(float *)(list + 8) * *(float *)(entity + 0x2c) * 0.0009765625f; - weights[count] = extent * 1.5707964f * extent * radius; + weights[eligible_shape_entry_count] = extent * 1.5707964f * extent * radius; break; } } - total += weights[count]; - count++; + total += weights[eligible_shape_entry_count]; + eligible_shape_entry_count++; } index++; list += 0x20; @@ -698,7 +698,7 @@ int generate_random_points_from_shape_entries( limit = maximum; for (emitted = 0; emitted < limit; emitted++) { random = random_float_between(0.0f, total); - for (chosen = 0; chosen < count; chosen++) { + for (chosen = 0; chosen < eligible_shape_entry_count; chosen++) { if (random < weights[chosen]) break; random -= weights[chosen]; From d10cc358bdb65e5113b61b755a2593c8d0a2cbfe Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:13:08 +0000 Subject: [PATCH 622/657] decomp: clarify names in predict_throw_landing offset -> ground_probe_position: The sole U910 offset binding is the retail stack vector at sp+0x40 (Ghidra uStack_e0..uStack_d4). At 0x002ad698 and 0x002ad6ac it is zeroed and its Z set to 0.5; 0x002ad700..0x002ad724 copies the hit moby's position to v->landing and adds that landing position to the vector. The resulting absolute position is passed as a0 to probe_ground_height at 0x002ad730..0x002ad738. The trajectory-hit path repeats this at 0x002ad8e0..0x002ad8f4 and 0x002ad948..0x002ad97c. Source shows both uses as probe_ground_height(&offset, 0, 0.5f), proving ground_probe_position rather than an unspecified offset. --- src/overlays/shared/weapons/bomb_glove_bomb.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/weapons/bomb_glove_bomb.c b/src/overlays/shared/weapons/bomb_glove_bomb.c index 0066958c62..96d4acbd83 100644 --- a/src/overlays/shared/weapons/bomb_glove_bomb.c +++ b/src/overlays/shared/weapons/bomb_glove_bomb.c @@ -943,7 +943,7 @@ void launch_bomb(float *pos, unsigned char *moby, float *velocity) { int predict_throw_landing(LandingVars *v, M910 *thrown_moby, int mode) __asm__("FUN_L00_002ad410"); int predict_throw_landing(LandingVars *v, M910 *thrown_moby, int mode) { - U910 position, velocity, previous, hero_position, offset, start; + U910 position, velocity, previous, hero_position, ground_probe_position, start; int timer; int object_hit; int found = 0, i; @@ -990,8 +990,8 @@ int predict_throw_landing(LandingVars *v, M910 *thrown_moby, int mode) { if (coll_hit.moby && coll_hit.i1C <= 0) { if ((coll_hit.moby != hero.moby && coll_hit.moby != v->holder) || timer < scale_game_frames(300) - scale_game_frames(10)) { - offset.q = 0; - offset.f[2] = 0.5f; + ground_probe_position.q = 0; + ground_probe_position.f[2] = 0.5f; { H910 *h = &coll_hit; if (v->last_hit != h->moby) { @@ -1008,8 +1008,8 @@ int predict_throw_landing(LandingVars *v, M910 *thrown_moby, int mode) { object_hit = 1; qcopy(&v->landing, (char *)coll_hit.moby + 0x10); found = 1; - fast_vec_add(&offset, &offset, &v->landing); - probe_ground_height(&offset, 0, 0.5f); + fast_vec_add(&ground_probe_position, &ground_probe_position, &v->landing); + probe_ground_height(&ground_probe_position, 0, 0.5f); } } else if (coll_hit.i1C > 0) { qcopy(&v->landing, &coll_hit.pos); @@ -1038,8 +1038,8 @@ int predict_throw_landing(LandingVars *v, M910 *thrown_moby, int mode) { if ((coll_hit.moby == hero.moby || coll_hit.moby == v->holder) && timer >= scale_game_frames(300) - scale_game_frames(10)) continue; - offset.q = 0; - offset.f[2] = 0.5f; + ground_probe_position.q = 0; + ground_probe_position.f[2] = 0.5f; { H910 *h = &coll_hit; if (v->last_hit != h->moby) { @@ -1055,8 +1055,8 @@ int predict_throw_landing(LandingVars *v, M910 *thrown_moby, int mode) { } object_hit = 1; qcopy(&v->landing, (char *)coll_hit.moby + 0x10); - fast_vec_add(&offset, &offset, &v->landing); - probe_ground_height(&offset, 0, 0.5f); + fast_vec_add(&ground_probe_position, &ground_probe_position, &v->landing); + probe_ground_height(&ground_probe_position, 0, 0.5f); break; } check_surface: From 5c3ae8896828503300bbedc01c97312079039f4e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:14:50 +0000 Subject: [PATCH 623/657] decomp: clarify names in apply_moby_camera_control count -> wait_or_elapsed_frames: In the bound C, count receives scale_game_frames(400) for mode 1 or scale_game_frames(350) otherwise. Retail 002fbcb0/002fbccc calls the frame scaler and 002fbcdc preserves that result in s3. For modes 1/2, 002fbe24..002fbe3c increments record+0x3e and compares its signed halfword with s3 before the target-angle check at 002fbe4c, proving a wait threshold measured in frames. Mode 7 overwrites s3 with signed record+0x20 at 002fbd1c, compares it with scaled duration at 002fbd20 and duration plus scale_game_frames(30) at 002fbd44..002fbd48, proving an elapsed-frame snapshot. Original Ghidra sVar6 follows these same two roles. The compound name preserves both meanings of the single C binding. --- src/overlays/shared/camera/moby_controlled_camera.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/camera/moby_controlled_camera.c b/src/overlays/shared/camera/moby_controlled_camera.c index 235e8b7f2a..7a3d530ba0 100644 --- a/src/overlays/shared/camera/moby_controlled_camera.c +++ b/src/overlays/shared/camera/moby_controlled_camera.c @@ -200,7 +200,7 @@ void apply_moby_camera_control(char *moby) { int encoded_group_target; int index; int duration; - int count; + int wait_or_elapsed_frames; int end; int frames; int active; @@ -301,12 +301,12 @@ void apply_moby_camera_control(char *moby) { moby_camera_control_record->active_frames += 1; if (moby_camera_control_record->mode == 1) { duration = scale_game_frames(300); - count = scale_game_frames(400); + wait_or_elapsed_frames = scale_game_frames(400); end = scale_game_frames(560); frames = scale_game_frames(200); } else { duration = scale_game_frames(300); - count = scale_game_frames(350); + wait_or_elapsed_frames = scale_game_frames(350); end = scale_game_frames(400); frames = scale_game_frames(200); } From 3a0132499d695f83b86e054785c9c8e529547007 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:16:35 +0000 Subject: [PATCH 624/657] decomp: clarify names in draw_ship_hud size -> hp_step_magnitude: In the bound C, size = absolute_float(step), where step = (hero.ship_hp - ship_hud_vars->shown_hp) * 0.2f; size is compared with 1.0f and divides step before shown_hp += step. Retail 0x00312438-0x0031245c computes that health delta and passes it to absolute_float; 0x00312460-0x0031247c retains the returned magnitude, compares it to 1.0 and divides f20 by it. Original Ghidra fVar22 = absolute(fVar23) confirms this magnitude limits the displayed-health update to one health unit. --- src/overlays/l11/mobys/jet_fighter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l11/mobys/jet_fighter.c b/src/overlays/l11/mobys/jet_fighter.c index d4940f86e6..5b2b708833 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -384,7 +384,7 @@ void draw_ship_hud(struct Moby *moby) { u8 alpha; s32 blink; f32 step; - f32 size; + f32 hp_step_magnitude; s32 fill; s32 lo; s32 hi; @@ -581,9 +581,9 @@ void draw_ship_hud(struct Moby *moby) { step = hero.ship_hp - ship_hud_vars->shown_hp; step *= 0.2f; - size = absolute_float(step); - if (size > 1.0f) { - step /= size; + hp_step_magnitude = absolute_float(step); + if (hp_step_magnitude > 1.0f) { + step /= hp_step_magnitude; } ship_hud_vars->shown_hp += step; fill = truncate_float_to_s32(ship_hud_vars->shown_hp * 251.0f / hero.ship_hp_max) + 2; From 1a5e22c7b519c75e5d9f07e576a6cf3b04096f8e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:16:35 +0000 Subject: [PATCH 625/657] decomp: clarify names in spawn_suck_cannon_projectile_explosion size -> colored_moby_scale: In the authoritative C, the sole float size is variant_effect_scale * 4.0f in the camera_distance > 9 block and feeds the floating scale argument of both func_L00_002E0CB8_DD3D8 calls. Retail 0x002dc63c-0x002dc648 loads 4.0 and multiplies f22 into retained f20; 0x002dc654 and 0x002dc6b0 move f20 into f12 before calls to 0x002df808 at 0x002dc66c and 0x002dc6cc. Original Ghidra shows fVar17 * 4.0 for both calls. Supplied checked naming context identifies that target as spawn_randomly_rotated_colored_moby and shows its scale parameter multiplying MOBY(moby)->scale into spawned_moby_private_data+0x18, proving this is colored moby scale. --- src/overlays/shared/weapons/suckcannon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 14ed988165..d712d1084f 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -2139,8 +2139,8 @@ void spawn_suck_cannon_projectile_explosion(char *projectile_moby, } while (--color_effects_remaining); } if (camera_distance > 9.0f) { - float size = variant_effect_scale * 4.0f; - func_L00_002E0CB8_DD3D8(size, + float colored_moby_scale = variant_effect_scale * 4.0f; + func_L00_002E0CB8_DD3D8(colored_moby_scale, projectile_moby, &MOBY(projectile_moby)->pos, spray_bias_vector, @@ -2153,7 +2153,7 @@ void spawn_suck_cannon_projectile_explosion(char *projectile_moby, g0 = 0x20; b0 = 0; swap_color_channel_words(&r0, &g0, &b0, (&D_0013E520)->b9); - func_L00_002E0CB8_DD3D8(size, + func_L00_002E0CB8_DD3D8(colored_moby_scale, projectile_moby, &MOBY(projectile_moby)->pos, spray_bias_vector, From 2a16d4ee933917f29ad85947507f963b42228ad2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:21:54 +0000 Subject: [PATCH 626/657] decomp: clarify names in update_camera_position_and_orientation_from_paths count -> hero_path_segment_count: In the mapped-path branch, count is hero.rail_segment minus hero_path_range_start_segment, increased by pathD->n when negative. Retail 00315730-00315758 converts pathB[j].w to the start segment (t1), subtracts it from hero rail_segment into t0, and adds the target/hero path point count on wrap. At 0031575c-003157a0 t0 bounds accumulation of pathD segment w lengths, followed by the hero's partial-segment offset at 003157a4-003157b8. Original Ghidra iVar4 has the same subtraction, wrap and loop-bound data flow. Thus this counts traversed whole hero-path segments, rather than nodes of the mapped camera path. --- src/overlays/shared/camera/grindrail_camera.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/camera/grindrail_camera.c b/src/overlays/shared/camera/grindrail_camera.c index a680b1ff1f..5e6855cbbe 100644 --- a/src/overlays/shared/camera/grindrail_camera.c +++ b/src/overlays/shared/camera/grindrail_camera.c @@ -371,7 +371,7 @@ void update_camera_position_and_orientation_from_paths(Cam *camera_to_update) { int range_start = 0; int range_end = 0; int j = 0; - int count; + int hero_path_segment_count; int hero_path_range_start_segment; int camera_path_sample_segment; float node_fraction; @@ -407,11 +407,11 @@ void update_camera_position_and_orientation_from_paths(Cam *camera_to_update) { lead = pathB->nodes[j].x; } hero_path_range_start_segment = truncate_float_to_s32(pathB->nodes[j].w); - count = ((Hero *)(((char *)((char *)&hero))))->rail_segment - hero_path_range_start_segment; - if (count < 0) { - count += pathD->n; + hero_path_segment_count = ((Hero *)(((char *)((char *)&hero))))->rail_segment - hero_path_range_start_segment; + if (hero_path_segment_count < 0) { + hero_path_segment_count += pathD->n; } - for (i = 0; i < count; i++) { + for (i = 0; i < hero_path_segment_count; i++) { sum += pathD->nodes[(hero_path_range_start_segment + i) % pathD->n].w; } sum += ((Hero *)(((char *)((char *)&hero))))->rail_seg_frac; From 7fb28accd1bcd106cfccbd01a07d6d960fecdf17 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:23:42 +0000 Subject: [PATCH 627/657] decomp: clarify names in bomb_glove_update offset -> grip_local_offset: Retail 0x002c2730 zeroes sp+0x50; 0x002c2738 and 0x002c2740 store -0.09 and -0.02 in its Y/Z components. At 0x002c27b0-0x002c27bc this vector is transformed using the moby bone-0 transform built at 0x002c27a4. The transformed displacement is added to the saved point at 0x002c27c0-0x002c27cc into pvars+0x40, the source grip field. Thus offset is the fixed local-space grip displacement before transformation. --- src/overlays/shared/weapons/bomb_glove.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/bomb_glove.c b/src/overlays/shared/weapons/bomb_glove.c index e7bcd30be3..d605c18197 100644 --- a/src/overlays/shared/weapons/bomb_glove.c +++ b/src/overlays/shared/weapons/bomb_glove.c @@ -172,7 +172,7 @@ void bomb_glove_update(struct Moby *moby) { BOMB_GLOVE_READY = 2 }; CarrierVars_2c26c8 *bomb_glove_vars; - OvlVec4 local[4], saved, offset, rotatedOffset, pos, target, basis[3], matrix[4]; + OvlVec4 local[4], saved, grip_local_offset, rotatedOffset, pos, target, basis[3], matrix[4]; OvlVec4 launch; union { OvlVec4 arc; @@ -199,7 +199,7 @@ void bomb_glove_update(struct Moby *moby) { } FUN_L00_0024f7c8((u8 *)moby, 0, &saved); build_moby_bone_transform(moby, 0, local); - transform_vector(&rotatedOffset, &offset, local); + transform_vector(&rotatedOffset, &grip_local_offset, local); fast_vec_add(&bomb_glove_vars->grip, &saved, &rotatedOffset); if (bomb_glove_vars->held != 0) bomb_glove_vars->held->collision_disable = 1; From be6dd1809b1fdf55ce45cdab3abe8f58fd126bbb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:23:43 +0000 Subject: [PATCH 628/657] decomp: clarify names in skids_agent_update offset -> prop_world_offset: Source declares Vec4 offset solely in the carried-prop attachment block. Retail 0x002e1494-0x002e14a8 transforms skids_agent_prop_local_offset through carried_prop+0xC0 into sp+0x40; 0x002e14ac-0x002e14bc adds that vector to carried_prop+0x10 (pos). Original Ghidra confirms auStack_90 is the transform destination and the subsequent position-add operand, proving the world-space positioning offset for the carried prop. --- src/overlays/l02/mobys/skids_agent.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l02/mobys/skids_agent.c b/src/overlays/l02/mobys/skids_agent.c index eaadc9439a..7dc7f38100 100644 --- a/src/overlays/l02/mobys/skids_agent.c +++ b/src/overlays/l02/mobys/skids_agent.c @@ -272,16 +272,16 @@ void skids_agent_update(struct Moby *moby) { /* A statement expression: retail reuses this scope's stack for the head-tracking block below. */ ({ float mtx[16]; - Vec4 offset; + Vec4 prop_world_offset; if (skids_agent_vars->carried_prop != 0) { moby_point_position(moby, 2, &skids_agent_vars->carried_prop->pos); build_moby_bone_transform(moby, 2, mtx); copy_matrix3x4(&skids_agent_vars->carried_prop->rot_row0, mtx); transform_vector_by_basis( - &offset, skids_agent_prop_local_offset, &skids_agent_vars->carried_prop->rot_row0); + &prop_world_offset, skids_agent_prop_local_offset, &skids_agent_vars->carried_prop->rot_row0); fast_vec_add(&skids_agent_vars->carried_prop->pos, &skids_agent_vars->carried_prop->pos, - &offset); + &prop_world_offset); update_entity(skids_agent_vars->carried_prop); } }); From e8e4c63fe8abd089c609c9c2dd02a3203410d281 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:23:43 +0000 Subject: [PATCH 629/657] decomp: clarify names in scoutbot_update offset -> wander_or_effect_vector: The sole float offset[4] in scoutbot_update maps to retail sp+0x30. At 002d2db8-002d2dec its XY components are cos/sin(random heading)*radius in [0,3] and Z=0; fast_vec_add adds it to pvars+0x1C0 home to produce +0x1F0 wander_goal. At 002d341c-002d3474 the same storage holds cos/sin(moby->rot.z)*0.2 with Z=0 and is passed as the vector argument to spawn_nearby_effect. At 002d3598-002d35c4 it receives moby->pos with Z raised by 1, then 002d360c-002d3620 passes it as explode_3DF8's position. Thus wander_or_effect_vector names all proven uses, including the absolute explosion position that bare offset obscures. --- src/overlays/shared/enemies/scoutbot.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index 12b4fa74a8..ebddcbd3d0 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -192,7 +192,7 @@ void scoutbot_update(Moby *moby) { }; Data_3DF8 *scoutbot_instance_vars = (struct Data_3DF8 *)moby->pvars; float target_pos[4]; - float offset[4]; + float wander_or_effect_vector[4]; float shot_pos[4]; sound_3DF8(3.6f, moby, 2, scoutbot_instance_vars->sound_state); @@ -246,10 +246,10 @@ void scoutbot_update(Moby *moby) { float heading = random_angle_radians(); float radius = random_float_between(0.0f, 3.0f); - offset[0] = fast_cos(heading) * radius; - offset[1] = fast_sin(heading) * radius; - offset[2] = 0.0f; - fast_vec_add(scoutbot_instance_vars->wander_goal, scoutbot_instance_vars->home, offset); + wander_or_effect_vector[0] = fast_cos(heading) * radius; + wander_or_effect_vector[1] = fast_sin(heading) * radius; + wander_or_effect_vector[2] = 0.0f; + fast_vec_add(scoutbot_instance_vars->wander_goal, scoutbot_instance_vars->home, wander_or_effect_vector); if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, 6); } @@ -339,13 +339,13 @@ void scoutbot_update(Moby *moby) { if (vector_distance_xy(&scoutbot_instance_vars->target->pos, &moby->pos) < 3.0f && absolute_float(scoutbot_instance_vars->current_target->pos.z - moby->pos.z) < 1.0f) { - offset[0] = fast_cos(moby->rot.z) * 0.2f; - offset[1] = fast_sin(moby->rot.z) * 0.2f; - offset[2] = 0.0f; + wander_or_effect_vector[0] = fast_cos(moby->rot.z) * 0.2f; + wander_or_effect_vector[1] = fast_sin(moby->rot.z) * 0.2f; + wander_or_effect_vector[2] = 0.0f; qcopy(shot_pos, target_pos); shot_pos[2] += 0.75f; spawn_nearby_effect( - scoutbot_instance_vars->current_target, moby, 1, shot_pos, offset, 1.0f); + scoutbot_instance_vars->current_target, moby, 1, shot_pos, wander_or_effect_vector, 1.0f); } scoutbot_instance_vars->ground_hover_height_offset = 4.0f; scoutbot_instance_vars->hover_bob_amplitude = 0.5f; @@ -379,12 +379,12 @@ void scoutbot_update(Moby *moby) { } break; case SCOUTBOT_STATE_EXPLODE_AND_REMOVE: - qcopy(offset, &moby->pos); - offset[2] += 1.0f; + qcopy(wander_or_effect_vector, &moby->pos); + wander_or_effect_vector[2] += 1.0f; allocate_voice_for_target_entry(1, 0, moby); explode_3DF8(moby, scoutbot_instance_vars->vel, - offset, + wander_or_effect_vector, 0.0f, 0.0f, 5, From 46e7770bdeee0d15b569e03d4c39bf309cff0b1a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:23:43 +0000 Subject: [PATCH 630/657] decomp: clarify names in turret_update offset -> hero_seat_offset: Authoritative turret_update copies seat into hero.motion.pos. Retail 00304d48-00304d4c copies sp+0 to hero position 0013f3d0; 00304d84-00304db4 constructs sp+0x10 XYZ as cos(hero yaw)*-0.7, sin(hero yaw)*-0.7, zero and passes it as a2 to fast_vec_add with hero position as input/output. Original Ghidra fStack_120/fStack_11c/uStack_118 confirms this displacement from the copied seat. This is the sole use of source Vec4 offset. --- src/overlays/l09/mobys/turret.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l09/mobys/turret.c b/src/overlays/l09/mobys/turret.c index b17e0cef4c..46dbdabf05 100644 --- a/src/overlays/l09/mobys/turret.c +++ b/src/overlays/l09/mobys/turret.c @@ -96,7 +96,7 @@ void turret_update(struct Moby *moby) { TURRET_STATE_MOUNTED = 5 }; Vec4 seat; - Vec4 offset; + Vec4 hero_seat_offset; Vec4 work_vector; Vec4 shot; Vec4 muzzle; @@ -120,10 +120,10 @@ void turret_update(struct Moby *moby) { qcopy(&hero.motion.pos, &seat); qcopy(&hero.motion.rot, &moby->rot); hero.motion.rot.f[2] = fast_add_rotations(1.5707964f, hero.motion.rot.f[2]); - offset.f[0] = fast_cos(hero.motion.rot.f[2]) * -0.7f; - offset.f[1] = fast_sin(hero.motion.rot.f[2]) * -0.7f; - offset.f[2] = 0.0f; - fast_vec_add(&hero.motion.pos, &hero.motion.pos, &offset); + hero_seat_offset.f[0] = fast_cos(hero.motion.rot.f[2]) * -0.7f; + hero_seat_offset.f[1] = fast_sin(hero.motion.rot.f[2]) * -0.7f; + hero_seat_offset.f[2] = 0.0f; + fast_vec_add(&hero.motion.pos, &hero.motion.pos, &hero_seat_offset); fast_mem_zero16(&hero.motion.velocity, 0x90); if (((u32)pad_pressed_lui) & 0x10) { jet_end_mount(0); From d6f68d88073841af550a3666922de4ca5f88a11f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:23:43 +0000 Subject: [PATCH 631/657] decomp: clarify names in sound_update offset -> occlusion_history_pool_offset: Authoritative C declares offset once as slot_index * (s32)sizeof(VoiceSlot) + 0xB4, adds history_offset to it, and uses the sum with repeat_index to index ((u8 *)&voice_pool), copying the selected occlusion_history byte into the next five history bytes. Retail 0x0022d218-0x0022d240 multiplies the slot index by 0x70 into s2 and forms s7=s2+0xB4. At 0x0022d25c-0x0022d284 the history displacement is added to s7 and then s8 (the pool base 0x0013e550), before incrementing the destination by one; 0x0022d290-0x0022d2a8 copies the byte five times. Original Ghidra likewise identifies the destination as the selected slot's aReserved_10 + history displacement + 0x34. Thus this binding measures bytes from the pool origin to this slot's occlusion-history start. --- src/audio/voices/sound_update.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/voices/sound_update.c b/src/audio/voices/sound_update.c index c72f174ecc..6261227df1 100644 --- a/src/audio/voices/sound_update.c +++ b/src/audio/voices/sound_update.c @@ -277,8 +277,8 @@ s32 sound_update(void) { { /* Fakematch: the byte index in a local keeps the copy's start address as (index + base) + 1, unflattened as retail's loop pass emits it. */ - s32 offset = slot_index * (s32)sizeof(VoiceSlot) + 0xB4; - s32 index = history_offset + offset; + s32 occlusion_history_pool_offset = slot_index * (s32)sizeof(VoiceSlot) + 0xB4; + s32 index = history_offset + occlusion_history_pool_offset; for (repeat_index = 1; repeat_index < 6; repeat_index++) { ((u8 *)&voice_pool)[index + repeat_index] = voice_pool.voices[slot_index].occlusion_history[history_offset]; From 40ab33ac23a94dc9c695e27ad1edf003c3390435 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:23:43 +0000 Subject: [PATCH 632/657] decomp: clarify names in blarg_elite_commando_update count -> updated_fire_cycle_count: In COMMANDO_STATE_FIRE_ROCKETS the source initializes count from commando_data->rocket_fire_cycle_count + 1, stores it back, and compares (short)count against 3. Retail 0x002d34ac-0x002d34bc gates this on animation window 10; 0x002d34c4 loads pvars+0x2DE, 0x002d34c8 increments it, 0x002d34cc-0x002d34d4 sign-extends and compares against 3, and 0x002d34dc stores it. Reaching three enters IDLE, seeds cooldown, and clears the field at 0x002d351c. Thus this local is the updated firing-cycle count, not an individual rocket count. --- src/overlays/shared/enemies/blarg_elite_commando.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_elite_commando.c b/src/overlays/shared/enemies/blarg_elite_commando.c index 1097929b59..d2ff046c03 100644 --- a/src/overlays/shared/enemies/blarg_elite_commando.c +++ b/src/overlays/shared/enemies/blarg_elite_commando.c @@ -413,9 +413,9 @@ void blarg_elite_commando_update(char *commando_moby) { fast_vec_normalize(delta, delta, frame_time * 20.0f); spawn_blarg_elite_commando_rocket(commando_moby, delta, (char *)scratch_vector); } else if (is_value_within_interpolated_window(commando_moby, 10.0f)) { - int count = commando_data->rocket_fire_cycle_count + 1; - commando_data->rocket_fire_cycle_count = count; - if ((short)count >= 3) { + int updated_fire_cycle_count = commando_data->rocket_fire_cycle_count + 1; + commando_data->rocket_fire_cycle_count = updated_fire_cycle_count; + if ((short)updated_fire_cycle_count >= 3) { MOBY(commando_moby)->state = COMMANDO_STATE_IDLE; if (((unsigned char *)commando_moby)[0x53] != 0) blend_moby_animation(commando_moby, 0, 0, scale_game_frames(10)); From caac1302eed8fab1cba3497293c5f4b1cc9636ea Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:23:43 +0000 Subject: [PATCH 633/657] decomp: clarify names in test_dummy_on_hoverboard_update count -> reactivation_elapsed_frames: In the wait-for-reactivation case, source count is the unsigned 16-bit reactivation_timer_frames plus one, written back to that field and converted to short timer for the scale_game_frames(240) gate. Retail 0x002d074c loads +0x2F2, 0x002d0754 increments it, 0x002d075c stores it, and 0x002d0758/0x002d0764 sign-extend the short for comparison at 0x002d0768. Ghidra sVar5 records the same increment and gate; hit handling resets +0x2F2 at 0x002d08dc. offset -> competitor_speed_offset: Source offset is race_competitor_index multiplied by time*1.55f and is added to both normal_speed_target and boost_speed_target. Retail 0x002d05d4-0x002d0600 converts private +0x2CC to float and multiplies it by the time-scaled 1.55 factor; additions at 0x002d0604/0x002d0608 feed the +0x2B8/+0x2B4 speed target stores at 0x002d060c/0x002d0610. Original Ghidra fVar18 shows this same shared additive speed adjustment. --- src/overlays/l16/mobys/test_dummy_on_hoverboard.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c index 55b6d2c6fc..181bac69b4 100644 --- a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c +++ b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c @@ -571,7 +571,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { expression table, and that size orders the stack slots of the cached addresses (sp+0x90..0xC4): with the literal at both calls every one of those slots is rotated by three. */ int mask = 0x30000; - float distance, duration, target, z, gap, speed, angle, scale, rate, limit, offset, slow; + float distance, duration, target, z, gap, speed, angle, scale, rate, limit, competitor_speed_offset, slow; /* No pointer locals: every address is written where it is used. The compiler caches them itself (d + 0x1E0 from here on, the others at the top of the active state). */ @@ -594,9 +594,9 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { *(float *)(path + 0x24) - *(float *)(path + 0x14)); hoverboard_dummy_data->unk2B = 1; time = D_0015ED6C; - offset = (float)hoverboard_dummy_data->race_competitor_index * (time * 1.55f); - hoverboard_dummy_data->normal_speed_target = time * 17.0f + offset; - hoverboard_dummy_data->boost_speed_target = time * 24.0f + offset; + competitor_speed_offset = (float)hoverboard_dummy_data->race_competitor_index * (time * 1.55f); + hoverboard_dummy_data->normal_speed_target = time * 17.0f + competitor_speed_offset; + hoverboard_dummy_data->boost_speed_target = time * 24.0f + competitor_speed_offset; if (D_0013D4DF == 0) { slow = (float)(D_0015EE3C_gp - 5); if (slow < 0.0f) { @@ -637,10 +637,10 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { if (hero.state.control_mode != 22) { MOBY(moby)->state = HOVERBOARD_DUMMY_STATE_INITIALIZE; } else { - int count = *(unsigned short *)&hoverboard_dummy_data->reactivation_timer_frames + 1; - short timer = count; + int reactivation_elapsed_frames = *(unsigned short *)&hoverboard_dummy_data->reactivation_timer_frames + 1; + short timer = reactivation_elapsed_frames; - hoverboard_dummy_data->reactivation_timer_frames = count; + hoverboard_dummy_data->reactivation_timer_frames = reactivation_elapsed_frames; if (scale_game_frames(240) < timer) { LevelCamera *player = &l16_camera; From f49687fdba0e03a7c4eb20a14573a732d9cab78e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:25:42 +0000 Subject: [PATCH 634/657] decomp: clarify names in drone_update count -> exclusion_entry_count: Retail 002ce42c initializes s6 to zero. For each valid slot drone, 002ce4a4-002ce4b0 loads its pvars+0x30 target, increments s6 and writes the next hero+0x1FFC exclusion entry. At 002ce4fc-002ce530 s6 starts the suffix-clear index; 002ce540 passes this exclusions array to target selection. At 002ce68c-002ce69c s6*4 indexes the next exclusion slot for the newly assigned target. Original decompilation iVar22 has these same uses. Current C count indexes exclusions[count], increments after each entry, initializes exclusion_clear_index, and indexes the appended assignment; exclusion_entry_count names the populated prefix length, including null entries. --- src/overlays/shared/weapons/drone.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/weapons/drone.c b/src/overlays/shared/weapons/drone.c index 9f318ca8f2..2499ee160d 100644 --- a/src/overlays/shared/weapons/drone.c +++ b/src/overlays/shared/weapons/drone.c @@ -371,7 +371,7 @@ void drone_update(struct Moby *updated_moby) { struct Moby *closest; struct Moby *selected_target_moby; f32 f, distance; - s32 i, count, category, random, health; + s32 i, exclusion_entry_count, category, random, health; s32 state; struct Moby *drone; s32 k, exclusion_clear_index; @@ -386,7 +386,7 @@ void drone_update(struct Moby *updated_moby) { ((DroneSlots *)&hero)->counter++; if (((DroneSlots *)&hero)->ammo_used < ((DroneSlots *)&hero)->counter) { closest = 0; - count = 0; + exclusion_entry_count = 0; distance = 1000000.0f; ((DroneSlots *)&hero)->counter = 1; ((DroneSlots *)&hero)->ammo_capacity = 0; @@ -401,12 +401,12 @@ void drone_update(struct Moby *updated_moby) { } else if (drone->state == 0xFD) { ((DroneSlots *)&hero)->slots[k] = 0; } else { - ((DroneSlots *)&hero)->exclusions[count] = + ((DroneSlots *)&hero)->exclusions[exclusion_entry_count] = *(struct Moby **)(drone->pvars + 0x30); - count++; + exclusion_entry_count++; if (drone->state < DRONE_STATE_FADE) ((DroneSlots *)&hero)->ammo_capacity++; - if (count > 8) + if (exclusion_entry_count > 8) break; } } else { @@ -414,7 +414,7 @@ void drone_update(struct Moby *updated_moby) { } } } - for (exclusion_clear_index = count; exclusion_clear_index < 9; exclusion_clear_index++) + for (exclusion_clear_index = exclusion_entry_count; exclusion_clear_index < 9; exclusion_clear_index++) ((DroneSlots *)&hero)->exclusions[exclusion_clear_index] = 0; selected_target_moby = func_L00_002CF3D8_2CF808(&hero.motion, ((DroneSlots *)&hero)->exclusions); @@ -452,7 +452,7 @@ void drone_update(struct Moby *updated_moby) { closest->state = DRONE_STATE_PURSUE_TARGET; random = rand_2cc608() % 3; allocate_voice_for_target_entry(random + (random > 0), 0, updated_moby); - ((DroneSlots *)&hero)->exclusions[count] = assigned->target; + ((DroneSlots *)&hero)->exclusions[exclusion_entry_count] = assigned->target; } } } From b315e8a02a0624f544461ea4a50a9540d733054c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:25:42 +0000 Subject: [PATCH 635/657] decomp: clarify names in update_snagglebeast_rope offset -> ring_radial_offset: In the authoritative C, this RopeVec is first cross(normal, step), then dotted with cross(normal, previous segment direction) to choose normal orientation. Retail 00318508..0031854c writes that vector through stack+0x120 (pointer saved at 00317f00..00317f28). The same stack+0x120 buffer is loaded at 00318624, filled by scaling the C700 ring profile by the segment radius at 00318668..0031867c, transformed by the side/perpendicular/normal basis at 00318680..0031868c, and added to the rope point at 00318690..003186a4 to produce rope_grid[i][column]. Thus it is a radial displacement from the rope center to a ring vertex, with an earlier radial orientation-test use. --- src/overlays/l07/mobys/snagglebeast.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index 41fc0bffb5..b9efe47ae4 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -2580,7 +2580,7 @@ float update_snagglebeast_rope(void *moby, void *anchor) { RopeVec side; RopeVec perpendicular; RopeVec normal; - RopeVec offset; + RopeVec ring_radial_offset; RopeVec previous; RopeVec previous_cross; extern RopeParticle rope_particles[]; @@ -2692,13 +2692,13 @@ float update_snagglebeast_rope(void *moby, void *anchor) { qcopy(tangent, step); if (absolute_float(step[2]) > 2.1f) { qcopy(normal, up); - fast_vec_cross(offset, normal, step); + fast_vec_cross(ring_radial_offset, normal, step); fast_vec_sub(previous_cross, l07_rope_previous_segment_start_points[i], rope_previous_points[i]); fast_vec_cross(previous, normal, previous_cross); { - float facing = fast_vec_dot(offset, previous); + float facing = fast_vec_dot(ring_radial_offset, previous); if (facing > 0.0f) { fast_vec_scale(normal, normal, -1.0f); } @@ -2719,9 +2719,9 @@ float update_snagglebeast_rope(void *moby, void *anchor) { radius += radius * 0.25f * fast_sin(fast_add_rotations( (*(float *)&D_L07_00161B84_gp) + index * 0.7f, 0.0f)); - fast_vec_scale(offset, l07_rope_ring_profile_vectors[column], radius); - transform_vector_by_basis(offset, offset, side); - fast_vec_add(rope_grid[i][column], rope_points[i], offset); + fast_vec_scale(ring_radial_offset, l07_rope_ring_profile_vectors[column], radius); + transform_vector_by_basis(ring_radial_offset, ring_radial_offset, side); + fast_vec_add(rope_grid[i][column], rope_points[i], ring_radial_offset); } } fast_vec_normalize(step, extension, 2.8f); From 0c60e7cae7319251dc1ffc9dbd2a6d0be5c37831 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:27:26 +0000 Subject: [PATCH 636/657] decomp: clarify names in _vfprintf_r size -> converted_field_byte_count: In the authoritative source src/sdk/libc/stdio/_vfprintf_r.c (SHA-256 dd60879518495cb9e5e33aaf2f2d6d47ea9064c2a6421e61c6cdb3fa1dfba5ae), size is 1 for %c, strlen(cp) or bounded memchr(cp,0,prec)-cp for %s, and conversion_buffer+BUF-cp for integer digits. Retail s5 receives 1 at 0x001171c0, the bounded string length at 0x001174b8/0x001174c4 or strlen result at 0x001174dc, and the backward-generated digit span at 0x001176d8. Float paths 0x00117348-0x001173c8 compute the corresponding formatted content length including decimal point and exponent. Original Ghidra pcVar5 carries this quantity into LAB_001176f8, where it is compared with integer precision before sign/prefix expansion. Retail 0x0011799c subtracts s5 from integer precision for leading zeroes, and 0x00117a6c stores s5 directly as the non-floating I/O vector byte length. Thus converted_field_byte_count identifies the counted entity and byte unit, excluding separately emitted prefixes and padding. --- src/sdk/libc/stdio/_vfprintf_r.c | 46 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/sdk/libc/stdio/_vfprintf_r.c b/src/sdk/libc/stdio/_vfprintf_r.c index 40ac673c7e..2fd33002a9 100644 --- a/src/sdk/libc/stdio/_vfprintf_r.c +++ b/src/sdk/libc/stdio/_vfprintf_r.c @@ -82,7 +82,7 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li } base; /* base for [diouxX] conversion */ int dprec; /* a copy of prec if [diouxX], 0 otherwise */ int realsz; /* field size expanded by dprec */ - int size; /* size of converted field or string */ + int converted_field_byte_count; /* size of converted field or string */ char *xdigs; /* digits for [xX] conversion */ #define NIOV 8 RncStdioUio uio; /* output information: summary */ @@ -272,7 +272,7 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li goto rflag; case 'c': *(cp = conversion_buffer) = va_arg(ap, int); - size = 1; + converted_field_byte_count = 1; sign = '\0'; break; case 'D': @@ -313,7 +313,7 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li cp = (char *)inf; } - size = 3; + converted_field_byte_count = 3; break; } if (isnan(_double)) { @@ -322,7 +322,7 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li cp = (char *)nan; } - size = 3; + converted_field_byte_count = 3; break; } @@ -337,22 +337,22 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li if (ch <= 'e') { /* 'e' or 'E' fmt */ --expt; expsize = exponent(expstr, expt, ch); - size = expsize + ndig; + converted_field_byte_count = expsize + ndig; if (ndig > 1 || flags & ALT) - ++size; + ++converted_field_byte_count; } else if (ch == 'f') { /* f fmt */ if (expt > 0) { - size = expt; + converted_field_byte_count = expt; if (prec || flags & ALT) - size += prec + 1; + converted_field_byte_count += prec + 1; } else /* "0.X" */ - size = prec + 2; + converted_field_byte_count = prec + 2; } else if (expt >= ndig) { /* fixed g fmt */ - size = expt; + converted_field_byte_count = expt; if (flags & ALT) - ++size; + ++converted_field_byte_count; } else - size = ndig + (expt > 0 ? 1 : 2 - expt); + converted_field_byte_count = ndig + (expt > 0 ? 1 : 2 - expt); if (softsign) sign = '-'; @@ -402,13 +402,13 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li char *string_terminator = memchr(cp, 0, prec); if (string_terminator != NULL) { - size = string_terminator - cp; - if (size > prec) - size = prec; + converted_field_byte_count = string_terminator - cp; + if (converted_field_byte_count > prec) + converted_field_byte_count = prec; } else - size = prec; + converted_field_byte_count = prec; } else - size = strlen(cp); + converted_field_byte_count = strlen(cp); sign = '\0'; break; case 'U': @@ -483,11 +483,11 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li default: cp = "bug in vfprintf: bad base"; - size = strlen(cp); + converted_field_byte_count = strlen(cp); goto skipsize; } } - size = conversion_buffer + BUF - cp; + converted_field_byte_count = conversion_buffer + BUF - cp; skipsize: break; default: /* "%?" prints ?, unless ? is NUL */ @@ -496,7 +496,7 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li /* pretend it was %c with argument ch */ cp = conversion_buffer; *cp = ch; - size = 1; + converted_field_byte_count = 1; sign = '\0'; break; } @@ -515,7 +515,7 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li * Compute actual size, so we know how much to pad. * size excludes decimal prec; realsz includes it. */ - realsz = dprec > size ? dprec : size; + realsz = dprec > converted_field_byte_count ? dprec : converted_field_byte_count; if (sign) realsz++; else if (flags & HEXPREFIX) @@ -539,11 +539,11 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li PAD(width - realsz, zeroes); /* leading zeroes from decimal precision */ - PAD(dprec - size, zeroes); + PAD(dprec - converted_field_byte_count, zeroes); /* the string or number proper */ if ((flags & FPT) == 0) { - PRINT(cp, size); + PRINT(cp, converted_field_byte_count); } else { /* glue together f_p fragments */ static _CONST char zero[] RODATA = "0"; static _CONST char point[] RODATA = "."; From 8e879e3381b27186dfece7feb13696bb456c55ba Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:29:14 +0000 Subject: [PATCH 637/657] decomp: clarify names in update_debug_menu size -> sample_file_byte_count: In the authoritative C capture branch, size receives sceLseek(fd, 0, 2) for the occlusion_samples_file_name file. Retail 001f5750..001f5760 calls sceLseek with zero offset/end origin and saves its result in s1. 001f5764..001f576c checks it against 0x100000; 001f5784..001f5790 passes s1 as sceRead's byte length into occlusion_samples. 001f5794..001f57ac divides s1 by 12 and stores occlusion_sample_count. Original Ghidra shows the identical lVar9 seek/read/divide flow, proving this is the sample file byte count. --- .../shared/rendering/debug/update_debug_menu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/rendering/debug/update_debug_menu.c b/src/overlays/shared/rendering/debug/update_debug_menu.c index 4563a3dc56..6d8c80e69d 100644 --- a/src/overlays/shared/rendering/debug/update_debug_menu.c +++ b/src/overlays/shared/rendering/debug/update_debug_menu.c @@ -874,7 +874,7 @@ void update_debug_menu(void) { if (g_debug_menu.selected_row == 2 && (controller_words.buttons.w.pressed & 0xF0)) { char *directory = level_directory_macro; char *path_format = level_file_path_format_gp; - s32 i = 0, found, fd, size; + s32 i = 0, found, fd, sample_file_byte_count; { f32 *sample; s32 count = occlusion_sample_count; @@ -930,11 +930,11 @@ void update_debug_menu(void) { sceWrite(fd, &l00_camera.pos.f[1], 4); sceWrite(fd, &l00_camera.pos.f[2], 4); sceLseek(fd, 0, 0); - size = sceLseek(fd, 0, 2); - if (size <= 0x100000) { + sample_file_byte_count = sceLseek(fd, 0, 2); + if (sample_file_byte_count <= 0x100000) { sceLseek(fd, 0, 0); - sceRead(fd, samples, size); - occlusion_sample_count = size / 12; + sceRead(fd, samples, sample_file_byte_count); + occlusion_sample_count = sample_file_byte_count / 12; } else { occlusion_sample_count = 0; } From f17b342cdd25ec6391e9ce5dd771f1d0b4da163b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:31:05 +0000 Subject: [PATCH 638/657] decomp: clarify names in gold_devastator_missile_update size -> impact_scale_multiplier: Authoritative C initializes this float to convert_integer_to_float(D_0013E520.bB)+1.0f. Retail 0x002b0578-0x002b0594 loads byte 0x0013e52b, converts it and keeps the sum in f24 (original Ghidra fVar18). At 0x002b0e28-0x002b0e40 twice f24 is the radius passed to collect_mobies_in_sphere. The same multiplier scales impact-particle velocities at 0x002b1020-0x002b1028 and 0x002b1690-0x002b1698, shrinking-particle scale by 40000 at 0x002b111c-0x002b1134, debris scale by 200000 at 0x002b16dc-0x002b16f4, and glow scale by four at 0x002b1798-0x002b17b0. Thus it is a shared impact scale multiplier, not an individual particle size or byte quantity. --- .../shared/weapons/gold_devastator_missile.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/shared/weapons/gold_devastator_missile.c b/src/overlays/shared/weapons/gold_devastator_missile.c index 4617eaca8b..160107346a 100644 --- a/src/overlays/shared/weapons/gold_devastator_missile.c +++ b/src/overlays/shared/weapons/gold_devastator_missile.c @@ -636,7 +636,7 @@ void gold_devastator_missile_update(M910 *missile_moby) { int reduced = 0; Missile1688 *missile_data; M910 *target; - float size, yaw, pitch; + float impact_scale_multiplier, yaw, pitch; normal.q = 0; normal.f[2] = D_0015ED6C * 8.0f; blast_velocity.q = normal.q; @@ -657,7 +657,7 @@ void gold_devastator_missile_update(M910 *missile_moby) { hero_velocity.q = phase.vectors.direction.q; scale_vector_xyz(&hero_velocity, &hero_velocity, turn); } - size = convert_integer_to_float(D_0013E520.bB) + 1.0f; + impact_scale_multiplier = convert_integer_to_float(D_0013E520.bB) + 1.0f; if (target && missile_data->life < scale_game_frames(300) - scale_game_frames(5) && (signed char)target->state >= 0) { float time = 0.0f; @@ -873,7 +873,7 @@ void gold_devastator_missile_update(M910 *missile_moby) { int particle_reduction; int i, j; int hit = - collect_mobies_in_sphere((&missile_moby->pos), 16, missile_moby, 0, (size + size)); + collect_mobies_in_sphere((&missile_moby->pos), 16, missile_moby, 0, (impact_scale_multiplier + impact_scale_multiplier)); particles = 10; predicted.q = missile_moby->pos.q; FUN_L00_0025a9f8(missile_moby, @@ -922,9 +922,9 @@ void gold_devastator_missile_update(M910 *missile_moby) { transform_vector(&predicted, &surface_motion, rotation); fast_vec_normalize(&predicted, &predicted, - random_float_between(8.5f, 16.5f) * D_0015ED6C * size); + random_float_between(8.5f, 16.5f) * D_0015ED6C * impact_scale_multiplier); } else { - float speed = random_float_between(8.5f, 16.5f) * D_0015ED6C * size; + float speed = random_float_between(8.5f, 16.5f) * D_0015ED6C * impact_scale_multiplier; float a = random_angle_radians(); build_spherical_offset(&predicted, speed, a, random_angle_radians()); } @@ -937,7 +937,7 @@ void gold_devastator_missile_update(M910 *missile_moby) { float particle_scale; if (fast_vec_length(&predicted) > 1.0f) fast_vec_normalize(&predicted, &predicted, D_0015ED6C * 8.0f); - particle_scale = size * 40000.0f; + particle_scale = impact_scale_multiplier * 40000.0f; life = random_int_between(scale_game_frames(60), scale_game_frames(120)) - particle_reduction * 35; spawn_shrinking_effect_particle_with_gravity_and_secondary_spawns( @@ -964,7 +964,7 @@ void gold_devastator_missile_update(M910 *missile_moby) { fast_vec_sub(&camera_delta, D_L00_00166DC0, (&missile_moby->pos)); distance = fast_vec_length(&camera_delta); camera_delta.f[2] += distance * 0.5f; - fast_vec_normalize(&predicted, &predicted, distance / 5.0f * D_0015ED6C * size); + fast_vec_normalize(&predicted, &predicted, distance / 5.0f * D_0015ED6C * impact_scale_multiplier); fast_vec_normalize(&camera_delta, &camera_delta, (distance + distance) * D_0015ED6C); fast_vec_add(&predicted, &predicted, &camera_delta); clamp_vector_length(&predicted, &predicted, D_0015ED6C * 10.0f); @@ -984,7 +984,7 @@ void gold_devastator_missile_update(M910 *missile_moby) { j /= 2; for (i = 0; i < j; i++) { float speed = - random_float_between(8.0f, 10.0f) * size * D_0015ED6C - near_adjust * D_0015ED6C; + random_float_between(8.0f, 10.0f) * impact_scale_multiplier * D_0015ED6C - near_adjust * D_0015ED6C; Colors1688 color = l00_devastator_missile_impact_color_palette; Colors1688 fade = l00_devastator_missile_impact_fade_palette; int c = @@ -1026,10 +1026,10 @@ void gold_devastator_missile_update(M910 *missile_moby) { random.f[2] = random_float_between(-1.0f, 1.0f); v.q = random.q; } - fast_vec_normalize(&v, &v, random_float_between(0.0f, 3.0f) * D_0015ED6C * size); + fast_vec_normalize(&v, &v, random_float_between(0.0f, 3.0f) * D_0015ED6C * impact_scale_multiplier); c = swap_packed_color_channels(color.colors[random_integer_below(6)], D_0013E520.bB); f = swap_packed_color_channels(fade.colors[random_integer_below(6)], D_0013E520.bB); - debris_scale = size * 200000.0f; + debris_scale = impact_scale_multiplier * 200000.0f; life = random_int_between(scale_game_frames(20), scale_game_frames(35)) - particle_reduction * 10; spawn_particle_alt_9768((&missile_moby->pos), &v, c, f, debris_scale, life); @@ -1043,7 +1043,7 @@ void gold_devastator_missile_update(M910 *missile_moby) { spawn_glow_particle_u8(missile_moby, (&missile_moby->pos), &blast_velocity, - size * 4.0f, + impact_scale_multiplier * 4.0f, scale_game_frames(15), c, 127, @@ -1052,7 +1052,7 @@ void gold_devastator_missile_update(M910 *missile_moby) { spawn_glow_particle_u8(missile_moby, (&missile_moby->pos), &blast_velocity, - size * 4.0f, + impact_scale_multiplier * 4.0f, scale_game_frames(24), c, 127, @@ -1062,7 +1062,7 @@ void gold_devastator_missile_update(M910 *missile_moby) { { unsigned char color = 127; int life; - float flash_scale = size * 4.0f; + float flash_scale = impact_scale_multiplier * 4.0f; if (D_0013E520.bB) color = 32; life = scale_game_frames(20); @@ -1080,7 +1080,7 @@ void gold_devastator_missile_update(M910 *missile_moby) { spawn_glow_particle_u8(missile_moby, (&missile_moby->pos), &blast_velocity, - (size + size), + (impact_scale_multiplier + impact_scale_multiplier), scale_game_frames(19), 255, 255, From 3680515450f02dbd9c7213c4e2967c1abdc493e0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:33:02 +0000 Subject: [PATCH 639/657] decomp: clarify names in build_beam_and_arc_points offset -> secondary_beam_horizontal_offset: Authoritative src/overlays/shared/weapons/tesla_claw_beam.c SHA-256 3cac07b0c822aa96f95d6d47fc6ae02572a8cb22df50001c162668f07debf425 constructs offset XY from cos/sin of delta heading plus pi/2, scaled by secondary_beam_horizontal_wave_amplitude*cos(side_phase), and sets Z=0. Retail 002b9e7c..002b9ec8 computes these components at sp+0xa0/+0xa4/+0xa8; 002b9ed8..002b9eec caches the vector in 001db890[seg] and adds it to secondary point s5. The later arm at 002b9f44..002b9f50 loads the cached vector for seg into the same local. Thus it holds the secondary beam's horizontal displacement vector. --- src/overlays/shared/weapons/tesla_claw_beam.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/weapons/tesla_claw_beam.c b/src/overlays/shared/weapons/tesla_claw_beam.c index 6df8e338bd..39dde91575 100644 --- a/src/overlays/shared/weapons/tesla_claw_beam.c +++ b/src/overlays/shared/weapons/tesla_claw_beam.c @@ -911,7 +911,7 @@ void build_beam_and_arc_points(struct Moby *beam_owner_moby) { float amount; int flag; } hit; - Vec4 camera_direction, direction, delta, blend, step, offset; + Vec4 camera_direction, direction, delta, blend, step, secondary_beam_horizontal_offset; struct Moby *collided[128]; Vec4 target_delta; union { @@ -1147,17 +1147,17 @@ void build_beam_and_arc_points(struct Moby *beam_owner_moby) { *(float *)((char *)&beam[seg] + 0x148) += x_c; x_a = fast_add_rotations(fast_arc_tan(delta.f[0], delta.f[1]), 1.5707964f); x_m = secondary_beam_horizontal_wave_amplitude * fast_cos(side_phase); - offset.f[0] = fast_cos(x_a) * x_m; - offset.f[1] = fast_sin(x_a) * x_m; - offset.f[2] = 0.0f; - qcopy_nc(&D_L00_001DB890[seg], &offset); - fast_vec_add(side, side, &offset); + secondary_beam_horizontal_offset.f[0] = fast_cos(x_a) * x_m; + secondary_beam_horizontal_offset.f[1] = fast_sin(x_a) * x_m; + secondary_beam_horizontal_offset.f[2] = 0.0f; + qcopy_nc(&D_L00_001DB890[seg], &secondary_beam_horizontal_offset); + fast_vec_add(side, side, &secondary_beam_horizontal_offset); } else { mirror = 21 - seg; qcopy(side, &beam[seg]); *(float *)((char *)&beam[seg] + 0x148) += side_waves[mirror]; fast_vec_add(side, side, &D_L00_001DB890[mirror]); - qcopy(&offset, &D_L00_001DB890[seg]); + qcopy(&secondary_beam_horizontal_offset, &D_L00_001DB890[seg]); } if (seg == 1) { struct Hero *collision_source_hero = &hero; From f908aa991c33dfe1185f7f5fe4d73fe1ec1bf599 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:33:02 +0000 Subject: [PATCH 640/657] decomp: clarify names in sandmouse_update size -> fade_particle_size: In the authoritative fade-out branch, size receives random_float_between(sandmouse_fade_particle_min_size_gp, sandmouse_fade_particle_max_size_gp) and is passed to the particle creation helper. Retail 0030ecc4 and 0030ecd0 load those bounds into f12/f13, 0030eccc calls the random float helper, and 0030ecd8 forwards f0 as f12 to the particle helper at 0030ed08. Original Ghidra case 6 shows the same result flow; supplied checked helper findings at 00287374 and 002873f4..00287408 retain, scale and store initial particle size. --- src/overlays/shared/enemies/sandmouse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/sandmouse.c b/src/overlays/shared/enemies/sandmouse.c index 6cd9b74629..633a56440e 100644 --- a/src/overlays/shared/enemies/sandmouse.c +++ b/src/overlays/shared/enemies/sandmouse.c @@ -848,7 +848,7 @@ void sandmouse_update(Moby *sandmouse_moby) { Vec4 vel = {0}; int fade_particle_color_low_byte, fade_particle_color_second_byte, fade_particle_color_third_byte, color, life, spin; - f32 size; + f32 fade_particle_size; qcopy(&pos, &sandmouse_moby->pos); add_random_offset_to_vector_xyz( &pos, *(f32 *)&sandmouse_fade_particle_position_offset_distance_gp); @@ -863,11 +863,11 @@ void sandmouse_update(Moby *sandmouse_moby) { spin = -spin; life = FUN_L00_00257b90(*(int *)&sandmouse_fade_particle_min_lifetime_gp, *(int *)&sandmouse_fade_particle_max_lifetime_gp); - size = random_float_between(*(f32 *)&sandmouse_fade_particle_min_size_gp, + fade_particle_size = random_float_between(*(f32 *)&sandmouse_fade_particle_min_size_gp, *(f32 *)&sandmouse_fade_particle_max_size_gp); FUN_L00_00272060(&pos, life, - size, + fade_particle_size, 0.001f, color, 2, From 5bb2c14cec395f9a04e1be35751e30b674146150 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:33:02 +0000 Subject: [PATCH 641/657] decomp: clarify names in suck_beam_update count -> spawned_beam_particle_count: Retail 002de8d8 initializes stack+0x19c to zero before the 200-record update loop. At 002de900-002de914, an empty particle record is eligible only while this counter is below five. The spawn_puff result at 002deb00-002deb1c is stored in the beam record; only its non-null branch increments stack+0x19c at 002deb3c-002deb44. The separate spark success counter uses stack+0x1a0 at 002dea5c-002dea7c. Thus count measures successful tracked beam-particle spawns in this invocation, not active particles or attempted allocations. --- src/overlays/shared/weapons/suckcannon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index d712d1084f..df9f289c64 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -3006,8 +3006,8 @@ void suck_beam_update(void *moby, void *position) { } add_draw_callback(suck_beam_draw_mesh, (int)moby); { - int count, sparks; - count = 0; + int spawned_beam_particle_count, sparks; + spawned_beam_particle_count = 0; sparks = 0; for (i = 0; i < 200; i++) { if (!D_L00_001E4C80_lui[i].p && count < 5) { @@ -3051,7 +3051,7 @@ void suck_beam_update(void *moby, void *position) { Tail41 *tail = &main->tail; main->life = 200; tail->mode = 2; - count++; + spawned_beam_particle_count++; tail->r = 127; tail->g = 200; } From da1d78b5533aea49856171a976f6217d41fa9a58 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:33:03 +0000 Subject: [PATCH 642/657] decomp: clarify names in batalia_cannon_update offset -> mounted_hero_position_offset: The sole source float offset[4] is used only in the command==1 anchoring block. Retail 0x002e03b4-0x002e03c8 copies cannon position and rotation to hero motion; 0x002e03e0-0x002e03f8 computes cos/sin(hero yaw)*-0.7 into stack +0x10/+0x14, 0x002e03fc zeros its z, and 0x002e0400-0x002e0410 passes that vector to fast_vec_add with hero motion position as both destination and first operand. It is the heading-dependent displacement applied to the mounted hero's position, distinct from subsequent dismount positioning. --- src/overlays/l08/mobys/batalia_cannon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l08/mobys/batalia_cannon.c b/src/overlays/l08/mobys/batalia_cannon.c index 1e65b9fc01..4bd715f8b4 100644 --- a/src/overlays/l08/mobys/batalia_cannon.c +++ b/src/overlays/l08/mobys/batalia_cannon.c @@ -734,7 +734,7 @@ void batalia_cannon_update(Moby *moby) { CANNON_THREE_INACTIVE_INDEXED_TARGETS = 3, CANNON_ALL_INDEXED_TARGETS_INACTIVE = 4 }; - float position[4], offset[4], work[4], direction[4], muzzle[4], scatter[4], random_vec[4]; + float position[4], mounted_hero_position_offset[4], work[4], direction[4], muzzle[4], scatter[4], random_vec[4]; CannonData52 *cannon_control_vars = (*(CannonData52 **)&moby->pvars); int i, target, all_done, dead, best, min_life; Moby **links; @@ -744,10 +744,10 @@ void batalia_cannon_update(Moby *moby) { if (fast_dec_timer_s16(&cannon_control_vars->exit_timer) && moby->command == 1) { qcopy(hero.motion.pos.f, position); qcopy(hero.motion.rot.f, (*(float(*)[4]) & moby->rot)); - offset[0] = fast_cos(hero.motion.rot.f[2]) * -0.7f; - offset[1] = fast_sin(hero.motion.rot.f[2]) * -0.7f; - offset[2] = 0.0f; - fast_vec_add(hero.motion.pos.f, hero.motion.pos.f, offset); + mounted_hero_position_offset[0] = fast_cos(hero.motion.rot.f[2]) * -0.7f; + mounted_hero_position_offset[1] = fast_sin(hero.motion.rot.f[2]) * -0.7f; + mounted_hero_position_offset[2] = 0.0f; + fast_vec_add(hero.motion.pos.f, hero.motion.pos.f, mounted_hero_position_offset); fast_mem_zero16((char *)hero.motion.pos.f + 0x60, 0x90); if (cannon_control_vars->health == 0) { Moby *node; From 880498405d8c87579cbee374482458df7fcf3e73 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:33:03 +0000 Subject: [PATCH 643/657] decomp: clarify names in blarg_heavy_interceptor_update size -> puff_size: In the death-fall puff loop, source float size receives random_float_between(40000.0f, 100000.0f) and is passed exclusively to the size argument of FUN_L00_0026d000_c618. Retail 0x002ad708..0x002ad728 loads these bounds, calls 0x002600e8 and saves f0 in f20; 0x002ad758 moves f20 into f15 for the puff spawn at 0x002ad770. Original Ghidra case 9 tracks the same random result as uVar17 into func_0x00274c88, corroborating the puff-specific size role. --- src/overlays/l14/mobys/blarg_heavy_interceptor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index dc9469e718..d3a5975ed0 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -756,14 +756,14 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { 60000.0f); for (i = 0; i < 2; i++) { int signed_puff_random_value = random_integer_below(6); - float size; + float puff_size; int puff_rgb_component; unsigned char *p; if (random_integer_below(2)) { signed_puff_random_value = -signed_puff_random_value; } - size = random_float_between(40000.0f, 100000.0f); + puff_size = random_float_between(40000.0f, 100000.0f); puff_rgb_component = random_int_between(0x30, 0xFF); p = FUN_L00_0026d000_c618( &moby->pos, @@ -772,7 +772,7 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { 1.0f, signed_puff_random_value, D_L14_0015F580, - size, + puff_size, puff_rgb_component | (0x60000000 | (puff_rgb_component << 16) | (puff_rgb_component << 8))); if (p != 0) { From 42f001dc65dd6f9f5d2872a8eff36bf3d3ef6f7e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:36:30 +0000 Subject: [PATCH 644/657] decomp: clarify names in load_level_gameplay count -> loaded_moby_count: count -> loaded_moby_count: In the authoritative C hdr->f44 block this int starts at zero, is written to moby_index_remap[i] and selects moby_table + count only in the non-skipped branch. Retail 0x0024282c clears sp+0x18; 0x00242a54-0x00242a70 loads that count, stores its low halfword into the file-order remap and multiplies it by 0x100 to select the MobyInst passed to init_moby_instance. Only the retained branch reaches 0x00242c34-0x00242c38 to increment it. 0x00242c5c-0x00242c84 uses the final count to set the loaded-table end and its 0xFF sentinel. Original Ghidra iStack_e8 and source count agree. This counts loaded file mobies, excluding skipped records and the separate reserved n2 slots. --- src/overlays/shared/world/load_level_gameplay.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/world/load_level_gameplay.c b/src/overlays/shared/world/load_level_gameplay.c index 8ff3d929d0..6697b6baa5 100644 --- a/src/overlays/shared/world/load_level_gameplay.c +++ b/src/overlays/shared/world/load_level_gameplay.c @@ -932,7 +932,7 @@ char *load_level_gameplay(int skip_gameplay_read) { { char *p = (char *)hdr + hdr->f44; int n2; - int count = 0; + int loaded_moby_count = 0; int n; char *next_moby_record; int i; @@ -1022,9 +1022,9 @@ char *load_level_gameplay(int skip_gameplay_read) { { short *slot = moby_index_remap + i; - *slot = count; + *slot = loaded_moby_count; } - m = moby_table + count; + m = moby_table + loaded_moby_count; init_moby_instance(m, *(int *)p); p += 4; m->bolt_source_slot = vis; @@ -1092,17 +1092,17 @@ char *load_level_gameplay(int skip_gameplay_read) { if (*(int *)p != -1) { store_current_level_table_value((int)m, *(int *)p); } - count++; + loaded_moby_count++; } p = next_moby_record; } - D_L00_0015FFDC = moby_table + count; + D_L00_0015FFDC = moby_table + loaded_moby_count; D_L00_0015FFDC->f20 = 0xFF; - mem += (count + n2) << 8; + mem += (loaded_moby_count + n2) << 8; D_L00_0015FFE8_macro = mem; mem += n2 << 7; mem = (char *)(((u32)mem + 0x3F) & 0xFFFFFFC0); - D_L00_0015FFE0 = (MobyInst *)((int)moby_table + ((count + n2) << 8) - 0x100); + D_L00_0015FFE0 = (MobyInst *)((int)moby_table + ((loaded_moby_count + n2) << 8) - 0x100); } if (hdr->f58 != 0) { char *pv = (char *)hdr + hdr->f58; From a2b48254012afed9954609a84b1aaadb469efbe9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:38:53 +0000 Subject: [PATCH 645/657] decomp: clarify names in doom_bot_update count -> collected_moby_count: In DOOM_BOT_DETONATE, count receives collect_mobies_in_sphere(&moby->pos, speed, 0x15, moby, 0). Retail 002c137c calls 001f2868; 002c1398 moves its v0 return directly to a3 for send_blast_hits at 002c13bc, alongside collection storage D_L00_00177F00 in a2 (002c138c/002c13a0). Original Ghidra likewise passes uVar6 from FUN_001f2868 into FUN_0025a9f8. This is the collected moby count consumed by blast-hit dispatch, and its sole assignment/use in the authoritative C establishes the local's entity domain. --- src/overlays/shared/weapons/doom_bot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/doom_bot.c b/src/overlays/shared/weapons/doom_bot.c index 325e45585c..7d3dbba1ae 100644 --- a/src/overlays/shared/weapons/doom_bot.c +++ b/src/overlays/shared/weapons/doom_bot.c @@ -587,12 +587,12 @@ void doom_bot_update(struct Moby *moby) { -1, item_text_variant[0x14]); movement_and_detonation_vectors[1].f[2] += scale * 0.5f; - count = collect_mobies_in_sphere(&moby->pos, speed, 0x15, moby, 0); + collected_moby_count = collect_mobies_in_sphere(&moby->pos, speed, 0x15, moby, 0); movement_and_detonation_vectors[3].q = *(OvlQuad *)&moby->pos; send_blast_hits(moby, &movement_and_detonation_vectors[3], D_L00_00177F00, - count, + collected_moby_count, 0, 0x10000, 2, From b9260d9b22bb07cb0ab69e29f696fe6225b964a1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:38:53 +0000 Subject: [PATCH 646/657] decomp: clarify names in sharkigator_update offset -> attachment_point_offset: In SHARKIGATOR_TARGET_LUNGE_INTERPOLATION, retail 0031019c..003101c0 obtains moby attachment point index 0 in sp+0x70 and subtracts moby position s2+0x10 into sp+0x80. At 00310268..00310278 this same vector is subtracted from target.pos to form the moby-position goal. Current C expresses fast_vec_sub(offset, point, mpos) and fast_vec_sub(goal, &target, offset), proving attachment-point displacement from the moby position. size -> particle_size: Retail 0030f9d4..0030fa08 calls random_float_between with 1.5f and 2.4f and retains its float return in f22; 0030fa58 moves it into f12 for particle spawn 0030fa68. Current C passes size as the first float argument to the established spawn_moving_resizing_height_snapped_alpha_fade_particle after adjusting point coordinates. This proves the randomized particle-size input without claiming radius, diameter or units. --- src/overlays/l07/mobys/sharkigator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l07/mobys/sharkigator.c b/src/overlays/l07/mobys/sharkigator.c index 6c3ea01b30..3c03f6de51 100644 --- a/src/overlays/l07/mobys/sharkigator.c +++ b/src/overlays/l07/mobys/sharkigator.c @@ -768,7 +768,7 @@ void sharkigator_update(unsigned char *moby) { char *sharkigator_instance_vars; struct WalkerTarget target; float point[4]; - float offset[4]; + float attachment_point_offset[4]; float goal[4]; float delta[4]; float previous[4]; @@ -872,11 +872,11 @@ void sharkigator_update(unsigned char *moby) { D_L07_001612D0, D_L07_001612D8, 1, F(moby, 0x10), F(moby, 0x14), scale, height); } if (D_L07_0015F5CC % ((rand() & 7) + 20) == 0) { - float size = random_float_between(1.5f, 2.4f); + float particle_size = random_float_between(1.5f, 2.4f); point[0] += random_float_between(-0.15f, 0.15f); point[1] += random_float_between(-0.15f, 0.15f); point[2] = resolve_camera_surface_height((Vec4 *)&D_L07_00173EE0, 0); - spawn_moving_resizing_height_snapped_alpha_fade_particle(point, 0, -1, size, 5250.0f); + spawn_moving_resizing_height_snapped_alpha_fade_particle(point, 0, -1, particle_size, 5250.0f); } } if (1.0f <= F(sharkigator_instance_vars, 0x14C)) { @@ -1078,7 +1078,7 @@ void sharkigator_update(unsigned char *moby) { float one; FUN_L00_0024f7c8(moby, 0, point); mpos = (char *)moby + 0x10; - fast_vec_sub(offset, point, mpos); + fast_vec_sub(attachment_point_offset, point, mpos); angle = fast_arc_tan(target.pos[0] - point[0], target.pos[1] - point[1]); func_L00_002592B0_t((char *)moby, angle, @@ -1089,7 +1089,7 @@ void sharkigator_update(unsigned char *moby) { F(moby, 0x44) *= frame_scale * 0.7f; F(sharkigator_instance_vars, 0x14C) += 0.028f; qcopy(previous, mpos); - fast_vec_sub(goal, &target, offset); + fast_vec_sub(goal, &target, attachment_point_offset); start = sharkigator_instance_vars + 0x100; fast_vec_sub(delta, goal, start); one = 1.0f; From c012c435187568f9d41d2549485f771d8531b620 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:41:02 +0000 Subject: [PATCH 647/657] decomp: clarify names in snagglebeast_update offset -> hero_motion_prediction_offset: Within SNAGGLEBEAST_SWEEP_BEAM_ATTACK, retail 003155f0..00315604 copies hero+0x100 (0013f450) to projection at sp+0xe0 and clears its Z. 00315608..00315624 scales that horizontal hero-motion vector by scale_game_frames(0x28) into sp+0xc0, the C local offset (Ghidra auStack_130). 00315678..003156a4 subtracts the current sweep midpoint-relative displacement from this vector and adds the correction to both sweep endpoints. Thus offset is the horizontal hero-motion prediction displacement used to shift the beam sweep. timer194 -> triple_spawn_attack_ready: Retail 00314380..0031438c passes instance+0x194 to fast_dec_timer_s16 and converts its return to boolean s3 (Ghidra bVar3). Phase handling suppresses s3 at 00314554/00314584/0031459c/003145b4. Its true branch at 00314c68..00314cd8 starts animation 4 and stores main state 3, the established SNAGGLEBEAST_TRIPLE_SPAWN_ATTACK; the shared chase branch 00315c0c..00315c60 does the same. Attack completion reloads the countdown at 003152c8/003152e4. The C uses this local only as that attack-readiness gate, not as a timer quantity. --- src/overlays/l07/mobys/snagglebeast.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index b9efe47ae4..94c169c842 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -1012,12 +1012,12 @@ void snagglebeast_update(unsigned char *moby) { Vec4 velocity; Vec4 direction; Vec4 start; - Vec4 offset; + Vec4 hero_motion_prediction_offset; Vec4 step; Vec4 projection; SnagglebeastVars *snagglebeast_instance_state = (SnagglebeastVars *)MOBY(moby)->pvars; int follow_target; - int timer194; + int triple_spawn_attack_ready; int timer19a; int sight_ready; int target_close; @@ -1067,7 +1067,7 @@ void snagglebeast_update(unsigned char *moby) { } } timer19a = 0; - timer194 = fast_dec_timer_s16(&snagglebeast_instance_state->timer_194) != 0; + triple_spawn_attack_ready = fast_dec_timer_s16(&snagglebeast_instance_state->timer_194) != 0; if (fast_dec_timer_s16(&snagglebeast_instance_state->timer_19A) && target_distance > 9.0f) timer19a = 1; sight_ready = 0; @@ -1105,7 +1105,7 @@ void snagglebeast_update(unsigned char *moby) { if (snagglebeast_instance_state->target_nav_point != -1) { follow_target = 1; path_point_ready = 1; - timer194 = 0; + triple_spawn_attack_ready = 0; target_close = 0; } else { follow_target = 0; @@ -1116,7 +1116,7 @@ void snagglebeast_update(unsigned char *moby) { if (snagglebeast_instance_state->target_nav_point != -1) { follow_target = 1; path_point_ready = 1; - timer194 = 0; + triple_spawn_attack_ready = 0; target_close = 0; } else { follow_target = 0; @@ -1125,7 +1125,7 @@ void snagglebeast_update(unsigned char *moby) { case SNAGGLEBEAST_PHASE_AFTER_FIRST_HEALTH_THRESHOLD: case SNAGGLEBEAST_PHASE_AFTER_SECOND_HEALTH_THRESHOLD: case SNAGGLEBEAST_PHASE_AFTER_THIRD_HEALTH_THRESHOLD: - timer194 = 0; + triple_spawn_attack_ready = 0; sight_ready = 0; if (MOBY(moby)->state != SNAGGLEBEAST_IDLE) timer19a = 0; @@ -1134,7 +1134,7 @@ void snagglebeast_update(unsigned char *moby) { case SNAGGLEBEAST_PHASE_SECOND_TIMED_DAMAGE_SEQUENCE: case SNAGGLEBEAST_PHASE_FINAL_TIMED_DAMAGE_SEQUENCE: target_close = 0; - timer194 = 0; + triple_spawn_attack_ready = 0; sight_ready = 0; timer19a = 0; break; @@ -1289,7 +1289,7 @@ void snagglebeast_update(unsigned char *moby) { } MOBY(moby)->state = SNAGGLEBEAST_SWEEP_BEAM_ATTACK; } - if (timer194) { + if (triple_spawn_attack_ready) { if (MOBY(moby)->state != SNAGGLEBEAST_CHASE_TARGET || FUN_00213260(4) == 0) { snagglebeast_instance_state->substate = 0; if (MOBY(moby)->prev_seq != 4) { @@ -1473,13 +1473,13 @@ void snagglebeast_update(unsigned char *moby) { fast_vec_sub(&direction, &direction, &velocity); qcopy(&projection, ((char *)&hero) + 0x100); projection.f[2] = 0.0f; - fast_vec_scale(&offset, &projection, (float)scale_game_frames(0x28)); + fast_vec_scale(&hero_motion_prediction_offset, &projection, (float)scale_game_frames(0x28)); fast_vec_sub(&velocity, &direction, &start); fast_vec_scale(&velocity, &velocity, 0.5f); fast_vec_add(&velocity, &velocity, &start); fast_vec_sub(&velocity, &velocity, &position); fast_vec_sub(&velocity, &velocity, &step); - fast_vec_sub(&velocity, &offset, &velocity); + fast_vec_sub(&velocity, &hero_motion_prediction_offset, &velocity); fast_vec_add(&start, &start, &velocity); fast_vec_add(&direction, &direction, &velocity); qcopy(snagglebeast_instance_state->rope_start_position, &start); From 8f5e9d5ff1798de22dcec797aa1d138217f4969a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:41:02 +0000 Subject: [PATCH 648/657] decomp: clarify names in qwarks_starfighter_update offset -> effect_position_or_beam_step: offset -> effect_position_or_beam_step: The sole float[4] local corresponds to original Ghidra fStack_110 at sp+0x20. Retail 0x002eb9ac-0x002eb9e0 subtracts tractor endpoint (+0x80) from hero position, normalizes the vector to frame_time*40 and adds it to the endpoint. 0x002eb9ec-0x002eb9f8 also copies hero position into this storage. During capture, 0x002ebd64-0x002ebdd8 forms ray_start minus endpoint, bounds the movement step and adds it to the endpoint. In death flight, 0x002ec354-0x002ec3e0 accumulates random basis displacements onto moby position in the same storage and passes it as cart_burst position. Finally 0x002eca88-0x002ecb24 transforms a basis vector, normalizes to 7, subtracts it from moby position, sets W=50 and allocates or updates the point-light position. Authoritative C matches these uses. The new name identifies its alternating position and beam-step roles instead of implying it always holds an offset. --- src/overlays/l13/mobys/qwarks_starfighter.c | 38 ++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index 7170820d1a..dba8110b9c 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -1635,7 +1635,7 @@ void qwarks_starfighter_update(Moby388 *moby) { STARFIGHTER_SHIELD_STATE_DEACTIVATE_REQUESTED = 3 }; Ship388 *starfighter_vars = moby->d; - float offset[4]; + float effect_position_or_beam_step[4]; float joint[4]; float ray_start[4]; float probe[4]; @@ -1882,13 +1882,13 @@ void qwarks_starfighter_update(Moby388 *moby) { (frame_time * 30.0f - starfighter_vars->flight_speed) * 0.1f; if (frame_time * 40.0f < hero_distance) { fast_vec_sub( - offset, ((char *)&D_0013F3D0), starfighter_vars->tractor_beam_endpoint); - fast_vec_normalize(offset, offset, frame_time * 40.0f); + effect_position_or_beam_step, ((char *)&D_0013F3D0), starfighter_vars->tractor_beam_endpoint); + fast_vec_normalize(effect_position_or_beam_step, effect_position_or_beam_step, frame_time * 40.0f); fast_vec_add(starfighter_vars->tractor_beam_endpoint, starfighter_vars->tractor_beam_endpoint, - offset); + effect_position_or_beam_step); } else { - qcopy(offset, ((char *)&D_0013F3D0)); + qcopy(effect_position_or_beam_step, ((char *)&D_0013F3D0)); starfighter_vars->attack_and_death_timer_frames = scale_game_frames(0x78); if (!(starfighter_vars->voice_line_flags & 4)) { if (queue_starfighter_voice_line(moby, starfighter_vars, 0x17, 4) != 0) { @@ -1965,15 +1965,15 @@ void qwarks_starfighter_update(Moby388 *moby) { fast_vec_sub(ray_start, starfighter_vars->tractor_beam_endpoint, probe); fast_vec_normalize(ray_start, ray_start, 30.0f); fast_vec_add(ray_start, ray_start, probe); - fast_vec_sub(offset, ray_start, starfighter_vars->tractor_beam_endpoint); + fast_vec_sub(effect_position_or_beam_step, ray_start, starfighter_vars->tractor_beam_endpoint); distance = fast_vec_dist(ray_start, ((char *)&D_0013F3D0)); if (distance != 30.0f) { - fast_vec_normalize(offset, - offset, + fast_vec_normalize(effect_position_or_beam_step, + effect_position_or_beam_step, (frame_time * 15.0f < distance) ? frame_time * 15.0f : distance); fast_vec_add(starfighter_vars->tractor_beam_endpoint, starfighter_vars->tractor_beam_endpoint, - offset); + effect_position_or_beam_step); } { char *hero = ((char *)&D_0013F350); @@ -2113,12 +2113,12 @@ void qwarks_starfighter_update(Moby388 *moby) { if (random_integer_below(0x11) == 0) { float size_ratio = moby->scale / (*(float *)(moby->cls + 0x24) * 3.0f); fast_vec_normalize(joint, moby->mat[0], random_float_between(-5.0f, 5.0f) * size_ratio); - fast_vec_add(offset, moby->pos, joint); + fast_vec_add(effect_position_or_beam_step, moby->pos, joint); fast_vec_normalize(joint, moby->mat[1], random_float_between(-4.0f, 4.0f) * size_ratio); - fast_vec_add(offset, offset, joint); + fast_vec_add(effect_position_or_beam_step, effect_position_or_beam_step, joint); fast_vec_normalize(joint, moby->mat[2], random_float_between(-4.0f, 4.0f) * size_ratio); - fast_vec_add(offset, offset, joint); - cart_burst(moby, offset, -1, size_ratio * 1.6f, 13.0f); + fast_vec_add(effect_position_or_beam_step, effect_position_or_beam_step, joint); + cart_burst(moby, effect_position_or_beam_step, -1, size_ratio * 1.6f, 13.0f); } func_L13_002E9F90_2(moby, starfighter_vars); { @@ -2334,16 +2334,16 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->snd114 = -1; starfighter_vars->snd114 = allocate_voice_for_target_entry(0, 4, (int)moby); have114: - transform_vector_by_basis(offset, D_L13_00160660, moby->mat[0]); - fast_vec_normalize(offset, offset, 7.0f); - fast_vec_sub(offset, moby->pos, offset); - offset[3] = 50.0f; + transform_vector_by_basis(effect_position_or_beam_step, D_L13_00160660, moby->mat[0]); + fast_vec_normalize(effect_position_or_beam_step, effect_position_or_beam_step, 7.0f); + fast_vec_sub(effect_position_or_beam_step, moby->pos, effect_position_or_beam_step); + effect_position_or_beam_step[3] = 50.0f; if (starfighter_vars->light120 == -1) { starfighter_vars->light120 = - allocate_colored_effect_slot(offset, 50.0f, 0.0f, 3.0f, 0.5f, 0.01f); + allocate_colored_effect_slot(effect_position_or_beam_step, 50.0f, 0.0f, 3.0f, 0.5f, 0.01f); } else { char *light = level13_point_light_slots + (starfighter_vars->light120 << 5); - qcopy(light + 0x10, offset); + qcopy(light + 0x10, effect_position_or_beam_step); } } starfighter_vars->b10F = 0; From 9a0e45892194567c3e57dcdc98598aeacc27062c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:56:11 +0000 Subject: [PATCH 649/657] decomp: clarify names in bolt_thief_mine_update domain_0_value_2 -> MINE_DETONATION_HIT_STATUS_MIN: Authoritative source SHA-256 41e9792092fe264d26c832752b805749f7680c4a8b9d9e0150ed3ad1031c480c passes &hit_status as resolve_moby_hit_response's fifth argument. Retail 0x002ff868 supplies sp+0x70 in t0; 0x002ff874 calls checked level-14 helper 0x002628a0. The helper preserves t0 in s3 at 0x002628b0, initializes *s3 to 0 at 0x002628f8, writes 1 on the no-hit path at 0x002629d4, and writes 2 for selected hit responses via 0x00262c60-0x00262c68 (with special branches writing 3/4 at 0x00262c28-0x00262c38 and suppression potentially writing 1 at 0x00262d74-0x00262d78). The caller loads this output at 0x002ff87c and tests <2 at 0x002ff880; outputs at least 2 pass to the non-null hit and class-0x283 exclusion before explosion calls 0x002ff93c/0x002ff9a8. Original Ghidra aiStack_70[0] < 2 confirms the same gate. Thus 2 is proven as this mine's minimum detonation hit status, not a mine state, hero mode, response return code or damage guarantee. --- src/overlays/shared/enemies/bolt_thief_mine.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/bolt_thief_mine.c b/src/overlays/shared/enemies/bolt_thief_mine.c index f6e9eb4de8..3a4d4d3234 100644 --- a/src/overlays/shared/enemies/bolt_thief_mine.c +++ b/src/overlays/shared/enemies/bolt_thief_mine.c @@ -74,6 +74,9 @@ void bolt_thief_mine_update(struct Moby *moby) __asm__("FUN_L14_002ff640"); /* Moby class 933 */ void bolt_thief_mine_update(struct Moby *moby) { + enum { + MINE_DETONATION_HIT_STATUS_MIN = 2 + }; FloatMineVars *floating_mine_private_vars = (FloatMineVars *)moby->pvars; union { HitInfo info; @@ -122,7 +125,7 @@ void bolt_thief_mine_update(struct Moby *moby) { scratch.info.look_height = 7; scratch.info.unk3B = 0xFF; resolve_moby_hit_response(moby, hit, &scratch.info, 0, &hit_status, 0, 0, 4); - if ((hit_status >= 2 && hit != 0 && hit->moby->oclass != 0x283) || + if ((hit_status >= MINE_DETONATION_HIT_STATUS_MIN && hit != 0 && hit->moby->oclass != 0x283) || hero.coll_hit_moby == (u8 *)moby) { clear_u64_value(explosion_vector); allocate_voice_for_target_entry(0, 0, moby); From 526d2dcb67bff031b710b3b72a9808f0eba40160 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:39:12 +0000 Subject: [PATCH 650/657] chore: format clarified batch 38 names --- src/audio/rpc/snd_send_iop_command_and_wait.c | 11 ++- .../voices/allocate_voice_for_bank_entry.c | 3 +- .../voices/allocate_voice_for_group_entry.c | 3 +- .../voices/allocate_voice_for_target_entry.c | 8 +- src/audio/voices/sound_update.c | 3 +- src/camera/sample_camera_path.c | 8 +- src/mobys/animation/queue_animation_update.c | 5 +- src/mobys/assign_moby_class_data.c | 3 +- src/movies/decoder/read_mpeg.c | 3 +- .../decoder/video_input/vi_buf_begin_put.c | 3 +- .../decoder/video_input/vi_buf_create.c | 8 +- src/overlays/l01/mobys/bomber_jet.c | 4 +- src/overlays/l01/mobys/peckbot.c | 6 +- src/overlays/l01/mobys/piston_platform.c | 3 +- .../l01/mobys/spark_particle_emitter.c | 6 +- src/overlays/l02/mobys/sand_shark.c | 18 ++-- src/overlays/l02/mobys/skids_agent.c | 5 +- src/overlays/l02/mobys/smoke_vent.c | 6 +- src/overlays/l03/mobys/kerwan_path_enemy.c | 35 +++++-- .../l03/mobys/metropolis_train_locomotive.c | 16 ++- src/overlays/l03/mobys/robot_dog.c | 5 +- src/overlays/l04/mobys/snow_plow.c | 3 +- src/overlays/l04/mobys/upper_door.c | 4 +- src/overlays/l04/mobys/woodcut_bot.c | 6 +- src/overlays/l06/mobys/alien_queen.c | 3 +- src/overlays/l06/mobys/dual_texture_meshes.c | 16 +-- src/overlays/l06/mobys/fred.c | 10 +- src/overlays/l06/mobys/shuttle.c | 22 +++-- src/overlays/l07/mobys/mine_group.c | 3 +- src/overlays/l07/mobys/sharkigator.c | 3 +- src/overlays/l07/mobys/snagglebeast.c | 17 +++- src/overlays/l08/mobys/batalia_cannon.c | 3 +- src/overlays/l08/mobys/bomber_tank.c | 32 +++--- .../l08/mobys/flickering_mesh_effect.c | 4 +- .../l09/draw_level09_textured_surfaces.c | 12 ++- src/overlays/l09/mobys/airship_part.c | 5 +- src/overlays/l09/mobys/asteroid.c | 3 +- .../l10/mobys/configurable_particle_emitter.c | 13 ++- .../l10/mobys/data_processor_linked_effect.c | 6 +- .../l10/mobys/directional_particle_emitter.c | 4 +- src/overlays/l10/mobys/gadgebot_telepot_pad.c | 5 +- .../l10/mobys/nanotech_upgrade_vendor.c | 4 +- src/overlays/l11/mobys/resort_owner.c | 9 +- src/overlays/l12/mobys/blarg_trooper.c | 12 ++- src/overlays/l12/mobys/hoven_turret.c | 27 +++-- .../l12/mobys/oscillating_target_link.c | 8 +- src/overlays/l12/mobys/water_reservoir.c | 10 +- src/overlays/l13/mobys/forcefield_tower.c | 3 +- src/overlays/l13/mobys/mine.c | 6 +- src/overlays/l13/mobys/qwarks_starfighter.c | 23 +++-- src/overlays/l14/mobys/button.c | 6 +- src/overlays/l14/mobys/elevator.c | 5 +- src/overlays/l14/mobys/enemy_fighter.c | 6 +- src/overlays/l14/mobys/flying_car.c | 3 +- src/overlays/l14/mobys/minibomber.c | 10 +- .../l14/mobys/rocket_strike_fighter.c | 10 +- src/overlays/l14/mobys/sam.c | 4 +- src/overlays/l14/mobys/wind_control.c | 12 ++- src/overlays/l14/path_key_camera.c | 21 ++-- src/overlays/l15/mobys/exploding_prop.c | 6 +- .../l15/mobys/radial_exploding_prop.c | 21 ++-- src/overlays/l16/mobys/chomper.c | 6 +- src/overlays/l16/mobys/path_walker.c | 6 +- src/overlays/l16/mobys/test_dummy.c | 10 +- .../l16/mobys/test_dummy_on_hoverboard.c | 9 +- .../l17/mobys/dreks_fleet_turret_shot.c | 4 +- src/overlays/l17/mobys/magnet_elevator.c | 33 ++++--- src/overlays/l17/mobys/robot_dog.c | 3 +- src/overlays/l18/hero/hero_set_state.c | 3 +- .../l18/mobys/drek_boss_electric_ball.c | 31 ++++-- src/overlays/l18/mobys/drek_fight_missile.c | 3 +- .../l18/mobys/drek_final_boss_robot.c | 6 +- .../shared/camera/aim_volume_camera.c | 2 + .../shared/camera/follow_camera_setup.c | 85 ++++++++-------- .../shared/camera/follow_camera_springs.c | 3 +- src/overlays/shared/camera/grindrail_camera.c | 3 +- src/overlays/shared/camera/orbit_camera.c | 3 +- .../shared/camera/path_flythrough_camera.c | 3 +- .../shared/camera/swing_volume_camera.c | 2 + .../shared/camera/target_tracking_camera.c | 8 +- src/overlays/shared/enemies/bolt_thief_mine.c | 3 +- src/overlays/shared/enemies/frog.c | 3 +- src/overlays/shared/enemies/gadgebot.c | 3 +- src/overlays/shared/enemies/large_amoeboid.c | 3 +- src/overlays/shared/enemies/plasmabot.c | 23 +++-- src/overlays/shared/enemies/sand_mouse.c | 6 +- src/overlays/shared/enemies/sandmouse.c | 2 +- src/overlays/shared/enemies/scoutbot.c | 15 ++- src/overlays/shared/enemies/sentrybot.c | 6 +- .../shared/enemies/walker_update_gait.c | 21 ++-- .../shared/game/run_level_main_loop.c | 3 +- src/overlays/shared/hero/hero_idle_sequence.c | 21 ++-- src/overlays/shared/hero/hero_set_state.c | 49 ++++++--- src/overlays/shared/hero/hero_switch_item.c | 7 +- .../hero/process_hero_primary_item_input.c | 9 +- src/overlays/shared/hero/set_hero_animation.c | 8 +- src/overlays/shared/mobys/find_moby_hit.c | 2 +- .../mobys/test_path_segment_strict_crossing.c | 14 ++- src/overlays/shared/props/bolt_crank.c | 3 +- src/overlays/shared/props/bot_door_lock.c | 48 +++++++-- src/overlays/shared/props/breakable_lamp.c | 11 ++- src/overlays/shared/props/electric_beam.c | 20 ++-- src/overlays/shared/props/floor_button.c | 3 +- src/overlays/shared/props/garage_door.c | 3 +- src/overlays/shared/props/lamp.c | 6 +- .../shared/props/linked_spark_emitter.c | 3 +- .../shared/rendering/effects/particles.c | 3 +- .../decompress_and_relocate_selected_groups.c | 3 +- src/overlays/shared/ui/hud/hud_frame.c | 4 +- src/overlays/shared/vehicles/hoverboard.c | 8 +- src/overlays/shared/vehicles/ship_rocket.c | 14 ++- src/overlays/shared/vehicles/taxi_path.c | 3 +- .../shared/vendor/draw_vendor_purchase_text.c | 9 +- src/overlays/shared/weapons/blaster_shot.c | 9 +- src/overlays/shared/weapons/bomb_glove.c | 4 +- src/overlays/shared/weapons/decoy.c | 5 +- src/overlays/shared/weapons/drone.c | 3 +- .../shared/weapons/effect_slots_fire.c | 3 +- .../shared/weapons/gold_devastator_missile.c | 23 +++-- .../shared/weapons/morphoray_chicken.c | 99 +++++++++++++++---- src/overlays/shared/weapons/suckcannon.c | 19 ++-- .../shared/weapons/visibomb_missile.c | 11 ++- .../shared/world/load_level_gameplay.c | 4 +- .../frame/initialize_level_render_state.c | 4 +- src/rendering/mobys/patch_moby_gifs.c | 3 +- src/rendering/packets/set_up_vis_gif_viewer.c | 4 +- src/sdk/input/dbc/scedbcreceivedata.c | 10 +- src/sdk/libc/stdio/_vfprintf_r.c | 15 +-- src/sdk/mpeg/picture/_getpic.c | 6 +- src/sdk/mpeg/picture/_lastFrame.c | 3 +- src/sdk/rpc/iop/sce_sif_load_module_buffer.c | 6 +- src/ui/hud/banks/load_compressed_hud_bank.c | 5 +- src/ui/hud/sprites/draw_hud_sprite_flipped.c | 4 +- .../update_ammo_preview_transform.c | 3 +- .../save_data/save_card_state_formatting.c | 3 +- src/world/loaders/upload_texture_images.c | 5 +- 136 files changed, 923 insertions(+), 432 deletions(-) diff --git a/src/audio/rpc/snd_send_iop_command_and_wait.c b/src/audio/rpc/snd_send_iop_command_and_wait.c index d8e732e479..663df2767f 100644 --- a/src/audio/rpc/snd_send_iop_command_and_wait.c +++ b/src/audio/rpc/snd_send_iop_command_and_wait.c @@ -37,8 +37,15 @@ s32 snd_send_iop_command_and_wait(s32 cmd, s32 payload_byte_count, u8 *command_p FlushCache(0); } if (payload_byte_count != 0) { - sceSifCallRpc( - sound_command_client, cmd, 1, snd_sync_send_buffer, payload_byte_count, snd_sync_buffer, 0xC, 0, 0); + sceSifCallRpc(sound_command_client, + cmd, + 1, + snd_sync_send_buffer, + payload_byte_count, + snd_sync_buffer, + 0xC, + 0, + 0); } else { sceSifCallRpc(sound_command_client, cmd, 1, 0, 0, snd_sync_buffer, 0xC, 0, 0); } diff --git a/src/audio/voices/allocate_voice_for_bank_entry.c b/src/audio/voices/allocate_voice_for_bank_entry.c index d1017c447b..4f63552061 100644 --- a/src/audio/voices/allocate_voice_for_bank_entry.c +++ b/src/audio/voices/allocate_voice_for_bank_entry.c @@ -21,7 +21,8 @@ s32 allocate_voice_for_bank_entry(s32 entry_index, s32 voice_control_flags, s32 if (entry_index >= D_0015F5B4) { return -1; } - slot_index = allocate_voice_slot(level_sound_defs + (entry_index << 5), voice_control_flags, owner, 0, 0x400); + slot_index = allocate_voice_slot( + level_sound_defs + (entry_index << 5), voice_control_flags, owner, 0, 0x400); if (slot_index >= 0) { slot = (struct VoiceBankEntryWindow *)(((u8 *)&voice_pool) + slot_index * 0x70); slot->owner = owner; diff --git a/src/audio/voices/allocate_voice_for_group_entry.c b/src/audio/voices/allocate_voice_for_group_entry.c index 57ecfeaea8..7ae77f67c6 100644 --- a/src/audio/voices/allocate_voice_for_group_entry.c +++ b/src/audio/voices/allocate_voice_for_group_entry.c @@ -26,7 +26,8 @@ s32 allocate_voice_for_group_entry(s32 group_entry_index, s32 playback_flags, s3 if (entry_index >= level_sound_def_count) { return -1; } - slot_index = allocate_voice_slot(level_sound_defs + (entry_index << 5), playback_flags, owner, 0, 0x400); + slot_index = + allocate_voice_slot(level_sound_defs + (entry_index << 5), playback_flags, owner, 0, 0x400); if (slot_index >= 0) { slot = (struct VoiceGroupEntryWindow *)(slot_index * 0x70 + ((u8 *)&voice_pool)); slot->owner = owner; diff --git a/src/audio/voices/allocate_voice_for_target_entry.c b/src/audio/voices/allocate_voice_for_target_entry.c index adecbef8b1..f5ea93432a 100644 --- a/src/audio/voices/allocate_voice_for_target_entry.c +++ b/src/audio/voices/allocate_voice_for_target_entry.c @@ -33,7 +33,10 @@ s32 allocate_voice_for_target_entry(s32 entry_index, /* Queue a class sound entry for a moby; return its pool index or -1. * The caller supplies a nonnegative entry index: retail only checks the * upper bound. This does not allocate a hardware voice or play immediately. */ -s32 allocate_voice_for_target_entry(s32 entry_index, s32 voice_slot_flags, struct MobyAudioView *moby) { +s32 allocate_voice_for_target_entry(s32 entry_index, + s32 voice_slot_flags, + + struct MobyAudioView *moby) { struct MobyClassAudioView *pclass; s32 slot_index; s32 sound_defs; @@ -53,7 +56,8 @@ s32 allocate_voice_for_target_entry(s32 entry_index, s32 voice_slot_flags, struc if (entry_index >= (s32)pclass->sound_def_count) { return -1; } - slot_index = allocate_voice_slot(sound_defs + (entry_index << 5), voice_slot_flags, moby, 0, 0x400); + slot_index = + allocate_voice_slot(sound_defs + (entry_index << 5), voice_slot_flags, moby, 0, 0x400); if (slot_index >= 0) { slot = (struct VoiceMobyEntryWindow *)((slot_index * 0x70) + (s32)((u8 *)&voice_pool)); slot->owner = moby; diff --git a/src/audio/voices/sound_update.c b/src/audio/voices/sound_update.c index 6261227df1..d8783c699f 100644 --- a/src/audio/voices/sound_update.c +++ b/src/audio/voices/sound_update.c @@ -277,7 +277,8 @@ s32 sound_update(void) { { /* Fakematch: the byte index in a local keeps the copy's start address as (index + base) + 1, unflattened as retail's loop pass emits it. */ - s32 occlusion_history_pool_offset = slot_index * (s32)sizeof(VoiceSlot) + 0xB4; + s32 occlusion_history_pool_offset = + slot_index * (s32)sizeof(VoiceSlot) + 0xB4; s32 index = history_offset + occlusion_history_pool_offset; for (repeat_index = 1; repeat_index < 6; repeat_index++) { ((u8 *)&voice_pool)[index + repeat_index] = diff --git a/src/camera/sample_camera_path.c b/src/camera/sample_camera_path.c index 85e068aac3..fe35554df6 100644 --- a/src/camera/sample_camera_path.c +++ b/src/camera/sample_camera_path.c @@ -25,7 +25,13 @@ void sample_camera_path(struct CameraPath *path, void sample_camera_path( - struct CameraPath *path, s32 loop, void *position, f32 *rotation, s32 rotation_output_flags, f32 progress) { + struct CameraPath *path, + s32 loop, + void *position, + f32 *rotation, + s32 rotation_output_flags, + + f32 progress) { Vec4 current_point; Vec4 next_point; Vec4 following_point; diff --git a/src/mobys/animation/queue_animation_update.c b/src/mobys/animation/queue_animation_update.c index 6df7d604e5..b949c916dc 100644 --- a/src/mobys/animation/queue_animation_update.c +++ b/src/mobys/animation/queue_animation_update.c @@ -43,8 +43,9 @@ s32 queue_animation_update(s32 chan, return 0; } if (anim->next_c != animation_context || anim->next_b != queued_animation_value || - anim->next_id != queued_animation_id || anim->next_mode != channel_flags || anim->next_fn != fn || - anim->next_d != animation_callback || anim->next_e != queued_animation_callback) { + anim->next_id != queued_animation_id || anim->next_mode != channel_flags || + anim->next_fn != fn || anim->next_d != animation_callback || + anim->next_e != queued_animation_callback) { anim->next_c = animation_context; anim->serial = hud_state.serial++; anim->next_b = queued_animation_value; diff --git a/src/mobys/assign_moby_class_data.c b/src/mobys/assign_moby_class_data.c index 7086bfd98e..1dcf2d5e19 100644 --- a/src/mobys/assign_moby_class_data.c +++ b/src/mobys/assign_moby_class_data.c @@ -16,7 +16,8 @@ void assign_moby_class_data(s32 class_id) { s32 i; class_resource = moby_class_resources[D_0015FF00]; - for (i = 0; resident_class_defaults[i].oclass != -1 && resident_class_defaults[i].oclass != class_id; + for (i = 0; + resident_class_defaults[i].oclass != -1 && resident_class_defaults[i].oclass != class_id; i++) { } moby_class_updates[D_0015FF00] = (s32)resident_class_defaults[i].update; diff --git a/src/movies/decoder/read_mpeg.c b/src/movies/decoder/read_mpeg.c index c625c675f4..1d696c92a1 100644 --- a/src/movies/decoder/read_mpeg.c +++ b/src/movies/decoder/read_mpeg.c @@ -108,7 +108,8 @@ s32 read_mpeg(struct VideoDec *video_dec, switch_thread(); avail = read_buf_begin_get(read_buf, &read_ptr); if (avail > 0) { - transferred_bytes = sceMpegDemuxPssRing(video_dec, read_ptr, avail, read_buf, read_buf->size); + transferred_bytes = + sceMpegDemuxPssRing(video_dec, read_ptr, avail, read_buf, read_buf->size); decode_remaining -= transferred_bytes; read_buf_end_get(read_buf, transferred_bytes); } diff --git a/src/movies/decoder/video_input/vi_buf_begin_put.c b/src/movies/decoder/video_input/vi_buf_begin_put.c index c79c84880a..c80eb38dad 100644 --- a/src/movies/decoder/video_input/vi_buf_begin_put.c +++ b/src/movies/decoder/video_input/vi_buf_begin_put.c @@ -24,7 +24,8 @@ void vi_buf_begin_put(struct ViBuf *ring_buffer, used_blocks = pending + 2; ring_capacity_bytes = ring_buffer->buff_size; free_bytes = ((ring_buffer->n - used_blocks) << 0xB) - read_byte_count; - write_pos = (s32)(((ring_buffer->dma_start + pending) << 0xB) + read_byte_count) % ring_capacity_bytes; + write_pos = + (s32)(((ring_buffer->dma_start + pending) << 0xB) + read_byte_count) % ring_capacity_bytes; if ((ring_capacity_bytes - write_pos) >= free_bytes) { *first_write_address_out = (s32)ring_buffer->data + write_pos; *first_write_byte_count_out = free_bytes; diff --git a/src/movies/decoder/video_input/vi_buf_create.c b/src/movies/decoder/video_input/vi_buf_create.c index 448bb87618..6ecd036955 100644 --- a/src/movies/decoder/video_input/vi_buf_create.c +++ b/src/movies/decoder/video_input/vi_buf_create.c @@ -40,7 +40,13 @@ s32 vi_buf_create(ViBuf *f, u128 *data, u128 *tag, s32 size, TimeStamp *ts, s32 s32 vi_buf_create( - ViBuf *video_input_buffer, u128 *data, u128 *tag, s32 buffer_element_count, TimeStamp *ts, s32 n_ts) { + ViBuf *video_input_buffer, + u128 *data, + u128 *tag, + s32 buffer_element_count, + TimeStamp *ts, + + s32 n_ts) { struct SemaParam param; video_input_buffer->data = data; diff --git a/src/overlays/l01/mobys/bomber_jet.c b/src/overlays/l01/mobys/bomber_jet.c index 51067169cf..ba0bb2729b 100644 --- a/src/overlays/l01/mobys/bomber_jet.c +++ b/src/overlays/l01/mobys/bomber_jet.c @@ -385,8 +385,8 @@ void bomber_jet_update(GunshipMoby *bomber_jet_moby) { if (gunship_vars->turrets[j] != -1) { GunshipMoby *o = (GunshipMoby *)(ents_macro + (gunship_vars->turrets[j] << 8)); - if (o != 0 && o->oclass == 0x1CB && o->state != MOBY_STATE_MARKED_FOR_REMOVAL && - o->state != 0xFD) { + if (o != 0 && o->oclass == 0x1CB && + o->state != MOBY_STATE_MARKED_FOR_REMOVAL && o->state != 0xFD) { GunshipTurretVars *t = o->vars; t->activated = 1; t->activate_delay = scale_game_frames(2); diff --git a/src/overlays/l01/mobys/peckbot.c b/src/overlays/l01/mobys/peckbot.c index 8a7d885f66..030f2c1817 100644 --- a/src/overlays/l01/mobys/peckbot.c +++ b/src/overlays/l01/mobys/peckbot.c @@ -620,7 +620,8 @@ void peckbot_update(Mob577 *peckbot_moby) { SET_ANIM(peckbot_moby, 2, 0, scale_game_frames(3)); } attack_ground_height = FUN_00213508(&peckbot_moby->pos, 0, 0.5f); - peckbot_vars->movement_vertical_velocity = peckbot_vars->movement_vertical_velocity - frame_time_sq * 9.8f; + peckbot_vars->movement_vertical_velocity = + peckbot_vars->movement_vertical_velocity - frame_time_sq * 9.8f; peckbot_moby->pos.f[2] = peckbot_moby->pos.f[2] + peckbot_vars->movement_vertical_velocity; if (peckbot_moby->pos.f[2] < attack_ground_height) { peckbot_vars->movement_vertical_velocity = 0.0f; @@ -846,7 +847,8 @@ void peckbot_update(Mob577 *peckbot_moby) { } qcopy(&peckbot_moby->pos, &position_scratch); forward_movement_ground_height = FUN_00213508(&peckbot_moby->pos, 0, 0.5f); - peckbot_vars->movement_vertical_velocity = peckbot_vars->movement_vertical_velocity - frame_time_sq * 9.8f; + peckbot_vars->movement_vertical_velocity = + peckbot_vars->movement_vertical_velocity - frame_time_sq * 9.8f; peckbot_moby->pos.f[2] = peckbot_moby->pos.f[2] + peckbot_vars->movement_vertical_velocity; if (peckbot_moby->pos.f[2] < forward_movement_ground_height) { peckbot_vars->movement_vertical_velocity = 0.0f; diff --git a/src/overlays/l01/mobys/piston_platform.c b/src/overlays/l01/mobys/piston_platform.c index b6811cdaae..5613d9c40e 100644 --- a/src/overlays/l01/mobys/piston_platform.c +++ b/src/overlays/l01/mobys/piston_platform.c @@ -123,5 +123,6 @@ void piston_platform_update(LiftMoby *piston_platform) { } dp = δ fast_vec_sub(dp, &piston_platform->pos, &previous_position); - update_entity_matrix(piston_platform_vars->x60, dp, piston_platform->rotation, piston_platform->rotation); + update_entity_matrix( + piston_platform_vars->x60, dp, piston_platform->rotation, piston_platform->rotation); } diff --git a/src/overlays/l01/mobys/spark_particle_emitter.c b/src/overlays/l01/mobys/spark_particle_emitter.c index 082cd2a16b..803fb9ebeb 100644 --- a/src/overlays/l01/mobys/spark_particle_emitter.c +++ b/src/overlays/l01/mobys/spark_particle_emitter.c @@ -125,7 +125,8 @@ void spark_particle_emitter_update(EmitterMoby *emitter_moby) { } euler_rotation_matrix(&u.rot.m, &u.rot.ang); transform_vector(&rotated_particle_velocity, &emitter_vars->vel, &u.rot.m); - sampled_particle_size = random_float_between(emitter_vars->size_min, emitter_vars->size_max); + sampled_particle_size = + random_float_between(emitter_vars->size_min, emitter_vars->size_max); create_spark_particle( emitter_vars, &position_scratch, @@ -156,7 +157,8 @@ void spark_particle_emitter_update(EmitterMoby *emitter_moby) { euler_rotation_matrix(&u.lin.m, emitter_moby->rot); transform_vector(&u.lin.vel, &u.lin.vel, &u.lin.m); } - sampled_particle_size = random_float_between(emitter_vars->size_min, emitter_vars->size_max); + sampled_particle_size = + random_float_between(emitter_vars->size_min, emitter_vars->size_max); create_spark_particle( emitter_vars, &position_scratch, diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index b7404a4c88..d11a87244d 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -430,7 +430,8 @@ void sand_shark_update(struct Moby *moby) { FUN_L02_002d5a68_e50(&target_or_particle_vector); } moby->pos.z -= sand_shark_height_offset_gp; - if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED) { + if (sand_shark_behavior_vars->target_selection_status != + SAND_SHARK_TARGET_SELECTION_EXCLUDED) { if (sand_shark_behavior_vars->wander_target_volume_index >= 0) { if ((!is_point_inside_clip_volume( &sand_shark_behavior_vars->target, @@ -469,7 +470,8 @@ void sand_shark_update(struct Moby *moby) { } break; case SAND_SHARK_WAIT_FOR_TARGET_IN_VOLUME: - if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED && + if (sand_shark_behavior_vars->target_selection_status != + SAND_SHARK_TARGET_SELECTION_EXCLUDED && is_point_inside_clip_volume(&sand_shark_behavior_vars->target, sand_shark_behavior_vars->target_activation_volume_index)) { moby->state = SAND_SHARK_APPROACH_TARGET; @@ -519,7 +521,8 @@ void sand_shark_update(struct Moby *moby) { if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(0xA)); } - } else if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED) { + } else if (sand_shark_behavior_vars->target_selection_status != + SAND_SHARK_TARGET_SELECTION_EXCLUDED) { moby->state = SAND_SHARK_APPROACH_TARGET; if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0xF)); @@ -544,7 +547,8 @@ void sand_shark_update(struct Moby *moby) { if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(0xA)); } - } else if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED) { + } else if (sand_shark_behavior_vars->target_selection_status != + SAND_SHARK_TARGET_SELECTION_EXCLUDED) { moby->state = SAND_SHARK_APPROACH_TARGET; if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0xF)); @@ -647,7 +651,8 @@ void sand_shark_update(struct Moby *moby) { if (moby->state == SAND_SHARK_APPROACH_TARGET_WITH_HEIGHT_OFFSET) { moby->pos.z -= sand_shark_height_offset_gp; } - if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED) { + if (sand_shark_behavior_vars->target_selection_status != + SAND_SHARK_TARGET_SELECTION_EXCLUDED) { if (sand_shark_behavior_vars->target_activation_volume_index >= 0 && !is_point_inside_clip_volume( &sand_shark_behavior_vars->target, @@ -764,7 +769,8 @@ void sand_shark_update(struct Moby *moby) { } } if (sand_shark_behavior_vars->outside_path_return_active == 0) { - if (sand_shark_behavior_vars->target_selection_status != SAND_SHARK_TARGET_SELECTION_EXCLUDED) { + if (sand_shark_behavior_vars->target_selection_status != + SAND_SHARK_TARGET_SELECTION_EXCLUDED) { fast_vec_sub(&target_home_delta, &sand_shark_behavior_vars->target, &sand_shark_behavior_vars->home); diff --git a/src/overlays/l02/mobys/skids_agent.c b/src/overlays/l02/mobys/skids_agent.c index 7dc7f38100..207524fac8 100644 --- a/src/overlays/l02/mobys/skids_agent.c +++ b/src/overlays/l02/mobys/skids_agent.c @@ -277,8 +277,9 @@ void skids_agent_update(struct Moby *moby) { moby_point_position(moby, 2, &skids_agent_vars->carried_prop->pos); build_moby_bone_transform(moby, 2, mtx); copy_matrix3x4(&skids_agent_vars->carried_prop->rot_row0, mtx); - transform_vector_by_basis( - &prop_world_offset, skids_agent_prop_local_offset, &skids_agent_vars->carried_prop->rot_row0); + transform_vector_by_basis(&prop_world_offset, + skids_agent_prop_local_offset, + &skids_agent_vars->carried_prop->rot_row0); fast_vec_add(&skids_agent_vars->carried_prop->pos, &skids_agent_vars->carried_prop->pos, &prop_world_offset); diff --git a/src/overlays/l02/mobys/smoke_vent.c b/src/overlays/l02/mobys/smoke_vent.c index dd86fca830..806846a360 100644 --- a/src/overlays/l02/mobys/smoke_vent.c +++ b/src/overlays/l02/mobys/smoke_vent.c @@ -175,7 +175,8 @@ void smoke_vent_update(struct Moby *moby) { smoke_vent_vars->timer_C0 = truncate_float_to_s32( scale_time(random_float_between((f32)view_gated_smoke_burst_interval_min_gp, (f32)view_gated_smoke_burst_interval_max_gp))); - view_gated_burst_particle_count = random_integer_below(7) != 0 ? 1 : random_integer_below(5) + 5; + view_gated_burst_particle_count = + random_integer_below(7) != 0 ? 1 : random_integer_below(5) + 5; for (k1 = 0; k1 < view_gated_burst_particle_count; k1++) { random_vector(&vector_perturbation, 0.0f, @@ -316,7 +317,8 @@ void smoke_vent_update(struct Moby *moby) { smoke_vent_vars->timer_C0 = truncate_float_to_s32( scale_time(random_float_between((f32)alternating_smoke_burst_interval_min_gp, (f32)alternating_smoke_burst_interval_max_gp))); - alternating_burst_particle_count = random_integer_below(7) != 0 ? 1 : random_integer_below(5) + 5; + alternating_burst_particle_count = + random_integer_below(7) != 0 ? 1 : random_integer_below(5) + 5; for (k2 = 0; k2 < alternating_burst_particle_count; k2++) { random_vector(&vector_perturbation, 0.0f, diff --git a/src/overlays/l03/mobys/kerwan_path_enemy.c b/src/overlays/l03/mobys/kerwan_path_enemy.c index 56598c9e47..165d6be04a 100644 --- a/src/overlays/l03/mobys/kerwan_path_enemy.c +++ b/src/overlays/l03/mobys/kerwan_path_enemy.c @@ -518,7 +518,8 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { m->rot[2] = fast_arc_tan(*(float *)(np + 0x20) - *(float *)(np + 0x10), *(float *)(np + 0x24) - *(float *)(np + 0x14)); if (is_point_inside_clip_volume_cf(m->activation_moby_lookup_selector) || - is_point_inside_clip_volume(&selected_target, moby_data->target_activation_clip_volume_id) || + is_point_inside_clip_volume(&selected_target, + moby_data->target_activation_clip_volume_id) || (visited52)[m->mission_index + (current_level_index << 4)] == 0xFF || (target_distance < moby_data->alternate_path_activation_range && absolute_float(selected_target.pos[2] - m->pos[2]) < 4.0f)) { @@ -740,7 +741,8 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { fr = compute_interpolated_record_value(m); ang = fast_arc_tan(selected_target.pos[0] - m->pos[0], selected_target.pos[1] - m->pos[1]); - FUN_001f9c48_cf((char *)m, &moby_data->heading_angular_velocity, ang, 0.03f, 0.3f, 0.3f); + FUN_001f9c48_cf( + (char *)m, &moby_data->heading_angular_velocity, ang, 0.03f, 0.3f, 0.3f); moby_point_position(m, 0, v); if (25.0f <= fr && fr <= 31.0f && absolute_float(m->pos[2] - selected_target.pos[2]) < 2.0f && @@ -901,10 +903,11 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { if (moby_data->alternate_path_node_index < seg) { moby_data->alternate_path_node_index = seg; } - if (!(step_mover_2e3f20((char *)m, - (char *)&moby_data->mv, - (float *)(path + 0x10 + moby_data->alternate_path_node_index * 0x10), - (char *)moby_data->v40) & + if (!(step_mover_2e3f20( + (char *)m, + (char *)&moby_data->mv, + (float *)(path + 0x10 + moby_data->alternate_path_node_index * 0x10), + (char *)moby_data->v40) & 0x14)) { break; } @@ -1147,8 +1150,14 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { case ENEMY_TURN_TO_HEADING: switch (m->anim) { case ENEMY_ANIM_LOCOMOTION: - FUN_001f9c48_cf((char *)m, &moby_data->heading_angular_velocity, moby_data->desired_turn_heading, 0.09f, 0.27f, 0.15f); - if (fast_difference_between_rotations(m->rot[2], moby_data->desired_turn_heading) < 0.034906585f) { + FUN_001f9c48_cf((char *)m, + &moby_data->heading_angular_velocity, + moby_data->desired_turn_heading, + 0.09f, + 0.27f, + 0.15f); + if (fast_difference_between_rotations(m->rot[2], moby_data->desired_turn_heading) < + 0.034906585f) { moby_data->heading_turn_cooldown = scale_game_frames(0x3C); if (m->bBC >= 7 && m->bBC <= 8) { if (m->bBC == 7) { @@ -1169,8 +1178,14 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } break; case ENEMY_ANIM_HEADING_TURN: - FUN_001f9c48_cf((char *)m, &moby_data->heading_angular_velocity, moby_data->desired_turn_heading, 0.01f, 0.3f, 0.2f); - if (fast_difference_between_rotations(m->rot[2], moby_data->desired_turn_heading) < 0.034906585f) { + FUN_001f9c48_cf((char *)m, + &moby_data->heading_angular_velocity, + moby_data->desired_turn_heading, + 0.01f, + 0.3f, + 0.2f); + if (fast_difference_between_rotations(m->rot[2], moby_data->desired_turn_heading) < + 0.034906585f) { moby_data->heading_turn_cooldown = scale_game_frames(0x3C); if (m->bBC >= 7 && m->bBC <= 8) { if (m->bBC == 7) { diff --git a/src/overlays/l03/mobys/metropolis_train_locomotive.c b/src/overlays/l03/mobys/metropolis_train_locomotive.c index 8e9ad58465..b60447c496 100644 --- a/src/overlays/l03/mobys/metropolis_train_locomotive.c +++ b/src/overlays/l03/mobys/metropolis_train_locomotive.c @@ -54,8 +54,10 @@ void place_metropolis_train(struct Moby *moby, float *pos, float heading) { *(OvlQuad *)old_pos = *(OvlQuad *)&moby->pos; *(OvlQuad *)old_rot = *(OvlQuad *)&moby->rot; qcopy(coupling + 0x10, start); - placement_offset_or_attachment_position[0] = fast_cos(heading) * -*(float *)(locomotive_data + 0xDC); - placement_offset_or_attachment_position[1] = fast_sin(heading) * -*(float *)(locomotive_data + 0xDC); + placement_offset_or_attachment_position[0] = + fast_cos(heading) * -*(float *)(locomotive_data + 0xDC); + placement_offset_or_attachment_position[1] = + fast_sin(heading) * -*(float *)(locomotive_data + 0xDC); placement_offset_or_attachment_position[2] = 0.0f; fast_vec_add(&moby->pos, start, placement_offset_or_attachment_position); moby->rot.z = fast_add_rotations(heading, 3.1415927f); @@ -64,10 +66,14 @@ void place_metropolis_train(struct Moby *moby, float *pos, float heading) { update_entity_matrix(locomotive_data + 0x60, delta, old_rot, &moby->rot); *(int *)(locomotive_data + 0xCC) = 0; *(int *)(locomotive_data + 0xD0) = 0; - placement_offset_or_attachment_position[0] = fast_cos(heading) * -*(float *)(locomotive_data + 0xBC); - placement_offset_or_attachment_position[1] = fast_sin(heading) * -*(float *)(locomotive_data + 0xBC); + placement_offset_or_attachment_position[0] = + fast_cos(heading) * -*(float *)(locomotive_data + 0xBC); + placement_offset_or_attachment_position[1] = + fast_sin(heading) * -*(float *)(locomotive_data + 0xBC); placement_offset_or_attachment_position[2] = 0.0f; - fast_vec_add(placement_offset_or_attachment_position, placement_offset_or_attachment_position, &moby->pos); + fast_vec_add(placement_offset_or_attachment_position, + placement_offset_or_attachment_position, + &moby->pos); while (next_id != -1) { char *car = D_L03_0015FFD8 + (next_id << 8); char *car_data = *(char **)(car + 0x78); diff --git a/src/overlays/l03/mobys/robot_dog.c b/src/overlays/l03/mobys/robot_dog.c index 6bd961f9ca..d40e277149 100644 --- a/src/overlays/l03/mobys/robot_dog.c +++ b/src/overlays/l03/mobys/robot_dog.c @@ -42,8 +42,9 @@ enum { int is_robot_dog_in_state_5(struct Moby *moby) __asm__("FUN_L03_002c5b78"); int is_robot_dog_in_state_5(struct Moby *moby) { - if (moby && moby->state != MOBY_STATE_PENDING_REMOVAL && moby->state != MOBY_STATE_ALTERNATE_REMOVAL_MARKER && - moby->oclass == 0x23D && moby->state == ROBOT_DOG_FOLLOW_PATH) { + if (moby && moby->state != MOBY_STATE_PENDING_REMOVAL && + moby->state != MOBY_STATE_ALTERNATE_REMOVAL_MARKER && moby->oclass == 0x23D && + moby->state == ROBOT_DOG_FOLLOW_PATH) { return 1; } return 0; diff --git a/src/overlays/l04/mobys/snow_plow.c b/src/overlays/l04/mobys/snow_plow.c index 7c6e8b291e..5857c04149 100644 --- a/src/overlays/l04/mobys/snow_plow.c +++ b/src/overlays/l04/mobys/snow_plow.c @@ -157,7 +157,8 @@ void snow_plow_update(struct Moby *moby) { } else { char *message = snow_plow_missing_path_warning_format; int oclass = moby->oclass; - instance_index_or_spawn_frames = truncate_float_to_s32((float)(((int)moby - D_L04_0015FFD8) >> 8)); + instance_index_or_spawn_frames = + truncate_float_to_s32((float)(((int)moby - D_L04_0015FFD8) >> 8)); debug_print(message, oclass, instance_index_or_spawn_frames); } moby->draw_dist = 0x7f; diff --git a/src/overlays/l04/mobys/upper_door.c b/src/overlays/l04/mobys/upper_door.c index d54f92a392..3a03dc0e7c 100644 --- a/src/overlays/l04/mobys/upper_door.c +++ b/src/overlays/l04/mobys/upper_door.c @@ -72,7 +72,9 @@ void upper_door_update(struct Moby *moby) { moby_save_id = moby->save_id; save_id_index = moby_save_id; if (l04_save_id_collection_state.collected[save_id_index] == 0 && - !((D_0014C190_257218[current_level_index][save_id_index >> 5] >> (moby_save_id & 0x1F)) & 1)) { + !((D_0014C190_257218[current_level_index][save_id_index >> 5] >> + (moby_save_id & 0x1F)) & + 1)) { if (riser_vars->trigger == -1) break; trigger_moby = (struct Moby *)((riser_vars->trigger << 8) + D_L04_0015FFD8); diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index 7148894906..3ea9bb8692 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -375,7 +375,8 @@ void woodcut_bot_update(WBMoby *m) { r = hit_reaction(m, p, &d->hp, 0, &htype, &damage, 0, 4); d->knockback_collision_radius_scaled = 0x15E; d->knockback_ground_probe_z_offset = 0.35f; - if (p != 0 && damage != 0.0f && m->state != WOODCUT_BOT_INITIALIZE && d->hit_response_cooldown == 0) { + if (p != 0 && damage != 0.0f && m->state != WOODCUT_BOT_INITIALIZE && + d->hit_response_cooldown == 0) { unsigned char *hit_source_moby; float knockback_gravity_step; float b; @@ -417,7 +418,8 @@ void woodcut_bot_update(WBMoby *m) { d->knockback_horizontal_step = frame_time * 7.0f; d->knockback_vertical_step_limit = frame_time * 13.0f; *(OvlQuad *)v = *(OvlQuad *)(p + 0x10); - trooper_knockback_arc(v, &angle, &d->knockback_horizontal_step, &d->knockback_vertical_step_limit); + trooper_knockback_arc( + v, &angle, &d->knockback_horizontal_step, &d->knockback_vertical_step_limit); trooper_start_knockback(angle, m, d->knockback_motion_vector, 8, 1, 0); d->knockback_ascent_target_frame = 14.0f; d->knockback_descent_target_frame = 24.0f; diff --git a/src/overlays/l06/mobys/alien_queen.c b/src/overlays/l06/mobys/alien_queen.c index 44c751a721..2989d964e6 100644 --- a/src/overlays/l06/mobys/alien_queen.c +++ b/src/overlays/l06/mobys/alien_queen.c @@ -924,7 +924,8 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { if ((unsigned char)moby[0x20] >= 2 && D_L06_00140408 != 8 && (pad_held_lui & 0x20)) alien_queen_hit_recovery_vars->suppress_death_dialogue = 1; intro_or_recovery_delay_frames = alien_queen_hit_recovery_vars->timer_12C; - if (intro_or_recovery_delay_frames != 0 && alien_queen_hit_recovery_vars->intro_or_recovery_delay_active != 0) { + if (intro_or_recovery_delay_frames != 0 && + alien_queen_hit_recovery_vars->intro_or_recovery_delay_active != 0) { --alien_queen_hit_recovery_vars->timer_12C; if (alien_queen_hit_recovery_vars->timer_12C < scale_game_frames(10)) D_L06_0015F3FC = diff --git a/src/overlays/l06/mobys/dual_texture_meshes.c b/src/overlays/l06/mobys/dual_texture_meshes.c index e4bb41d18f..7fb4af54da 100644 --- a/src/overlays/l06/mobys/dual_texture_meshes.c +++ b/src/overlays/l06/mobys/dual_texture_meshes.c @@ -5499,10 +5499,10 @@ void draw_dual_texture_58_quad_mesh(void) { mesh_second_pass_quad_packet.tex = get_effect_texture(0x2a); matrix_ptr = matrix; packed_quad_blend_settings = (long)dual_texture_mesh_blend_color_a_selector_gp | - (long)dual_texture_mesh_blend_color_b_selector_gp << 2 | - (long)dual_texture_mesh_blend_alpha_c_selector_gp << 4 | - (long)dual_texture_mesh_blend_color_d_selector_gp << 6 | - (long)dual_texture_mesh_blend_fixed_alpha_gp << 32; + (long)dual_texture_mesh_blend_color_b_selector_gp << 2 | + (long)dual_texture_mesh_blend_alpha_c_selector_gp << 4 | + (long)dual_texture_mesh_blend_color_d_selector_gp << 6 | + (long)dual_texture_mesh_blend_fixed_alpha_gp << 32; mesh_second_pass_quad_packet.alpha = flags; mesh_first_pass_quad_packet.alpha = flags; mesh_second_pass_quad_packet.tex1 = 0xFF9000000260L; @@ -5572,10 +5572,10 @@ void draw_dual_texture_864_quad_mesh(void) { second_texture_pass_quad_packet.tex = get_effect_texture(0x2a); matrix_ptr = matrix; packed_texture_pass_blend_settings = (long)dual_texture_mesh_blend_color_a_selector_gp | - (long)dual_texture_mesh_blend_color_b_selector_gp << 2 | - (long)dual_texture_mesh_blend_alpha_c_selector_gp << 4 | - (long)dual_texture_mesh_blend_color_d_selector_gp << 6 | - (long)dual_texture_mesh_blend_fixed_alpha_gp << 32; + (long)dual_texture_mesh_blend_color_b_selector_gp << 2 | + (long)dual_texture_mesh_blend_alpha_c_selector_gp << 4 | + (long)dual_texture_mesh_blend_color_d_selector_gp << 6 | + (long)dual_texture_mesh_blend_fixed_alpha_gp << 32; second_texture_pass_quad_packet.alpha = flags; first_texture_pass_quad_packet.alpha = flags; second_texture_pass_quad_packet.tex1 = 0xFF9000000260L; diff --git a/src/overlays/l06/mobys/fred.c b/src/overlays/l06/mobys/fred.c index 81d3534ed9..2bdc1a9a08 100644 --- a/src/overlays/l06/mobys/fred.c +++ b/src/overlays/l06/mobys/fred.c @@ -269,7 +269,8 @@ void fred_update(struct Moby *moby) { set_camera_position(pos); set_camera_rotation(rot); if (fred_vars->f178 >= 1.0f || - (((Busy *)D_L06_00179B90)->f0 == 0 && ((Busy *)D_L06_00179B90)->current_help_message_id == -1 && + (((Busy *)D_L06_00179B90)->f0 == 0 && + ((Busy *)D_L06_00179B90)->current_help_message_id == -1 && fred_vars->f178 > 0.2f)) { approach_value(&D_L06_0015F3FC_macro, 1.0f, frame_time_macro * 4.0f); } else { @@ -368,6 +369,9 @@ void fred_update(struct Moby *moby) { fred_vars->joint_0_scale = 2.75f; update_joint_animation( rate * frame_scale_sq_macro, head_rate * frame_scale_sq_macro, moby, fred_vars->f40, 0); - update_joint_animation( - rate * frame_scale_sq_macro, head_rate * frame_scale_sq_macro, moby, fred_vars->joint_2_animation_record, 2); + update_joint_animation(rate * frame_scale_sq_macro, + head_rate * frame_scale_sq_macro, + moby, + fred_vars->joint_2_animation_record, + 2); } diff --git a/src/overlays/l06/mobys/shuttle.c b/src/overlays/l06/mobys/shuttle.c index 291e47df91..e5ab669407 100644 --- a/src/overlays/l06/mobys/shuttle.c +++ b/src/overlays/l06/mobys/shuttle.c @@ -821,11 +821,19 @@ void break_apart_shuttle_linked_mobys(struct Moby *moby) { linked_moby_index = *list & 0x7FFF; random_vector(push, 1.0f, 2.0f); spawn_shuttle_explosion_effect( - 30.0f, moby, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos, push, 1); - fast_vec_add(middle, middle, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos); + 30.0f, + moby, + &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos, + push, + 1); + fast_vec_add(middle, + middle, + &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos); linked_moby_count++; - if (largest < ((struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w) { - largest = ((struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w; + if (largest < + ((struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w) { + largest = + ((struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w; } } while (*list++ >= 0); fast_vec_scale(middle, middle, 1.0f / convert_integer_to_float(linked_moby_count)); @@ -833,7 +841,8 @@ void break_apart_shuttle_linked_mobys(struct Moby *moby) { do { float speed; linked_moby_index = *list & 0x7FFF; - fast_vec_sub(push, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos, middle); + fast_vec_sub( + push, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos, middle); piece = (struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68); speed = frame_time * 30.0f; fast_vec_normalize(push, push, -((piece->bsphere.w - largest) / largest) * speed + speed); @@ -844,7 +853,8 @@ void break_apart_shuttle_linked_mobys(struct Moby *moby) { for (i = 0; i < shuttle_breakup_particles_per_piece_gp; i++) { piece = (struct Moby *)((linked_moby_index << 8) + (int)D_L06_0015FFD8_03b68); random_vector(pos, 0.0f, piece->bsphere.w * 0.00048828125f); - fast_vec_add(pos, pos, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos); + fast_vec_add( + pos, pos, &((struct Moby *)(D_L06_0015FFD8_03b68 + (linked_moby_index << 8)))->pos); random_vector( particle_velocity, 0.0f, shuttle_breakup_particle_max_speed_gp * frame_time); clear_u64_value(particle_acceleration); diff --git a/src/overlays/l07/mobys/mine_group.c b/src/overlays/l07/mobys/mine_group.c index a10cc0e337..5a497275c0 100644 --- a/src/overlays/l07/mobys/mine_group.c +++ b/src/overlays/l07/mobys/mine_group.c @@ -247,7 +247,8 @@ void mine_group_update(struct Moby *moby) { remaining = &boltcrate_pvars->health; if (boltcrate_pvars->hittable) { limit = find_moby_hit(moby, 0x230000, 0); - hit_response_code = resolve_moby_hit_response(moby, limit, remaining, 0, &hit_damage_code, 0, 0, 4); + hit_response_code = + resolve_moby_hit_response(moby, limit, remaining, 0, &hit_damage_code, 0, 0, 4); switch ((unsigned)hit_response_code) { case HIT_REACTION_NONE: case HIT_REACTION_START_KNOCKBACK: diff --git a/src/overlays/l07/mobys/sharkigator.c b/src/overlays/l07/mobys/sharkigator.c index 3c03f6de51..89b58988ec 100644 --- a/src/overlays/l07/mobys/sharkigator.c +++ b/src/overlays/l07/mobys/sharkigator.c @@ -876,7 +876,8 @@ void sharkigator_update(unsigned char *moby) { point[0] += random_float_between(-0.15f, 0.15f); point[1] += random_float_between(-0.15f, 0.15f); point[2] = resolve_camera_surface_height((Vec4 *)&D_L07_00173EE0, 0); - spawn_moving_resizing_height_snapped_alpha_fade_particle(point, 0, -1, particle_size, 5250.0f); + spawn_moving_resizing_height_snapped_alpha_fade_particle( + point, 0, -1, particle_size, 5250.0f); } } if (1.0f <= F(sharkigator_instance_vars, 0x14C)) { diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index 94c169c842..73d56caaaa 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -692,7 +692,12 @@ int update_snagglebeast_chase_movement(struct Moby *chaser_moby, int update_snagglebeast_chase_movement( - struct Moby *chaser_moby, struct ChaserVars *chaser_vars, Vec4 *goal, int waypoint_position, float range) { + struct Moby *chaser_moby, + struct ChaserVars *chaser_vars, + Vec4 *goal, + int waypoint_position, + + float range) { float position_delta[4]; char *path; struct Moby *target_moby; @@ -703,8 +708,8 @@ int update_snagglebeast_chase_movement( navigation_result = 4; path = D_L07_001B0530[chaser_vars->path]; if (range < goal_distance) { - navigation_result = - step_mover_2e3f20(chaser_moby, chaser_vars->nav, waypoint_position, chaser_vars->navOut); + navigation_result = step_mover_2e3f20( + chaser_moby, chaser_vars->nav, waypoint_position, chaser_vars->navOut); if (navigation_result == 2) { fast_vec_sub( position_delta, @@ -1473,7 +1478,8 @@ void snagglebeast_update(unsigned char *moby) { fast_vec_sub(&direction, &direction, &velocity); qcopy(&projection, ((char *)&hero) + 0x100); projection.f[2] = 0.0f; - fast_vec_scale(&hero_motion_prediction_offset, &projection, (float)scale_game_frames(0x28)); + fast_vec_scale( + &hero_motion_prediction_offset, &projection, (float)scale_game_frames(0x28)); fast_vec_sub(&velocity, &direction, &start); fast_vec_scale(&velocity, &velocity, 0.5f); fast_vec_add(&velocity, &velocity, &start); @@ -2719,7 +2725,8 @@ float update_snagglebeast_rope(void *moby, void *anchor) { radius += radius * 0.25f * fast_sin(fast_add_rotations( (*(float *)&D_L07_00161B84_gp) + index * 0.7f, 0.0f)); - fast_vec_scale(ring_radial_offset, l07_rope_ring_profile_vectors[column], radius); + fast_vec_scale( + ring_radial_offset, l07_rope_ring_profile_vectors[column], radius); transform_vector_by_basis(ring_radial_offset, ring_radial_offset, side); fast_vec_add(rope_grid[i][column], rope_points[i], ring_radial_offset); } diff --git a/src/overlays/l08/mobys/batalia_cannon.c b/src/overlays/l08/mobys/batalia_cannon.c index 4bd715f8b4..8e6b9af8fa 100644 --- a/src/overlays/l08/mobys/batalia_cannon.c +++ b/src/overlays/l08/mobys/batalia_cannon.c @@ -734,7 +734,8 @@ void batalia_cannon_update(Moby *moby) { CANNON_THREE_INACTIVE_INDEXED_TARGETS = 3, CANNON_ALL_INDEXED_TARGETS_INACTIVE = 4 }; - float position[4], mounted_hero_position_offset[4], work[4], direction[4], muzzle[4], scatter[4], random_vec[4]; + float position[4], mounted_hero_position_offset[4], work[4], direction[4], muzzle[4], + scatter[4], random_vec[4]; CannonData52 *cannon_control_vars = (*(CannonData52 **)&moby->pvars); int i, target, all_done, dead, best, min_life; Moby **links; diff --git a/src/overlays/l08/mobys/bomber_tank.c b/src/overlays/l08/mobys/bomber_tank.c index 466310163a..953ef510cf 100644 --- a/src/overlays/l08/mobys/bomber_tank.c +++ b/src/overlays/l08/mobys/bomber_tank.c @@ -891,15 +891,17 @@ void spawn_bomber_tank_joint_particles(struct Moby *moby, int joint, int count) fast_vec_scale(spread_vector, spread_vector, 0.5f); horizontal_spread_offset = func_001F9F90_2D6C58(random_angle); horizontal_spread_offset = - horizontal_spread_offset * (random_float_between( - 0.0f, bomber_tank_joint_particle_horizontal_spread_range_end_gp) * - D_0015ED6C); + horizontal_spread_offset * + (random_float_between(0.0f, + bomber_tank_joint_particle_horizontal_spread_range_end_gp) * + D_0015ED6C); spread_vector[0] = spread_vector[0] + horizontal_spread_offset; horizontal_spread_offset = func_001F9FA8_2D6C58(random_angle); horizontal_spread_offset = - horizontal_spread_offset * (random_float_between( - 0.0f, bomber_tank_joint_particle_horizontal_spread_range_end_gp) * - D_0015ED6C); + horizontal_spread_offset * + (random_float_between(0.0f, + bomber_tank_joint_particle_horizontal_spread_range_end_gp) * + D_0015ED6C); spread_vector[1] = spread_vector[1] + horizontal_spread_offset; spread_vector[2] = bomber_tank_joint_particle_vertical_spread_gp * D_0015ED6C; } else { @@ -911,16 +913,18 @@ void spawn_bomber_tank_joint_particles(struct Moby *moby, int joint, int count) fast_vec_add(velocity, velocity, jitter); fast_vec_scale(spread_vector, spread_vector, 0.5f); horizontal_spread_offset = func_001F9F90_2D6C58(random_angle); - horizontal_spread_offset = horizontal_spread_offset * - (random_float_between( - 0.0f, bomber_tank_joint_particle_horizontal_spread_range_end_gp * 0.25f) * - D_0015ED6C); + horizontal_spread_offset = + horizontal_spread_offset * + (random_float_between( + 0.0f, bomber_tank_joint_particle_horizontal_spread_range_end_gp * 0.25f) * + D_0015ED6C); spread_vector[0] = spread_vector[0] + horizontal_spread_offset; horizontal_spread_offset = func_001F9FA8_2D6C58(random_angle); - horizontal_spread_offset = horizontal_spread_offset * - (random_float_between( - 0.0f, bomber_tank_joint_particle_horizontal_spread_range_end_gp * 0.25f) * - D_0015ED6C); + horizontal_spread_offset = + horizontal_spread_offset * + (random_float_between( + 0.0f, bomber_tank_joint_particle_horizontal_spread_range_end_gp * 0.25f) * + D_0015ED6C); spread_vector[1] = spread_vector[1] + horizontal_spread_offset; spread_vector[2] = bomber_tank_joint_particle_vertical_spread_gp * D_0015ED6C; } diff --git a/src/overlays/l08/mobys/flickering_mesh_effect.c b/src/overlays/l08/mobys/flickering_mesh_effect.c index 28c0b5a555..6846fc506b 100644 --- a/src/overlays/l08/mobys/flickering_mesh_effect.c +++ b/src/overlays/l08/mobys/flickering_mesh_effect.c @@ -523,7 +523,7 @@ void draw_flickering_mesh_effect(struct Moby *moby) { sv0.f[2] = random_float_between(0.0f, flickering_mesh_vars->particle_z) * frame_scale; particle_size = random_float_between(flickering_mesh_vars->particle_size0, - flickering_mesh_vars->particle_size1); + flickering_mesh_vars->particle_size1); life = scale_game_frames(flickering_mesh_vars->particle_life); r = flickering_mesh_vars->particle_r; g = flickering_mesh_vars->particle_g; @@ -548,7 +548,7 @@ void draw_flickering_mesh_effect(struct Moby *moby) { flickering_mesh_vars->puff_c1[0]; float width = flickering_mesh_vars->size_x * 0.5f; float puff_size = random_float_between(flickering_mesh_vars->puff_size0, - flickering_mesh_vars->puff_size1); + flickering_mesh_vars->puff_size1); int life = scale_game_frames(random_int_between( flickering_mesh_vars->puff_life0, flickering_mesh_vars->puff_life1)); float fraction = diff --git a/src/overlays/l09/draw_level09_textured_surfaces.c b/src/overlays/l09/draw_level09_textured_surfaces.c index 7ed23deeb2..44a0f1c6e8 100644 --- a/src/overlays/l09/draw_level09_textured_surfaces.c +++ b/src/overlays/l09/draw_level09_textured_surfaces.c @@ -139,7 +139,12 @@ void draw_level09_scrolling_textured_strips(char *list, void draw_level09_scrolling_textured_strips( - char *list, int strip_entry_count, float unused, long first_texture_index, long second_texture_index) { + char *list, + int strip_entry_count, + float unused, + long first_texture_index, + + long second_texture_index) { int i; int j; int strip_vertex_index; @@ -217,7 +222,10 @@ void build_packet_and_draw_scaled_entries(void *data_ptr, void *list_ptr, int count) __asm__("FUN_L09_002c1978"); -void build_packet_and_draw_scaled_entries(void *data_ptr, void *list_ptr, int scaled_surface_entry_count) { +void build_packet_and_draw_scaled_entries(void *data_ptr, + void *list_ptr, + + int scaled_surface_entry_count) { enum { TEXTURED_GRID_USE_CURRENT_VIEW_SETTINGS = 1 }; diff --git a/src/overlays/l09/mobys/airship_part.c b/src/overlays/l09/mobys/airship_part.c index df1d74d98c..1dffed48e8 100644 --- a/src/overlays/l09/mobys/airship_part.c +++ b/src/overlays/l09/mobys/airship_part.c @@ -151,7 +151,10 @@ char *spawn_airship_part(struct Moby *rotation_source_moby, return spawned_moby; } -char *find_nearest_moby_by_class(void *search_position, int target_moby_class, float *nearest_distance_out) { +char *find_nearest_moby_by_class(void *search_position, + int target_moby_class, + + float *nearest_distance_out) { char *best = 0; float bestd = 100000.0f; char *candidate_moby; diff --git a/src/overlays/l09/mobys/asteroid.c b/src/overlays/l09/mobys/asteroid.c index 931c493ef8..0149d72acb 100644 --- a/src/overlays/l09/mobys/asteroid.c +++ b/src/overlays/l09/mobys/asteroid.c @@ -729,7 +729,8 @@ char *spawn_radially_scattered_moby( fast_vec_normalize(spawned_velocity, &MOBY(moby)->pos, difference * speed); } gap = pi - difference; - fast_vec_normalize(direction_velocity_contribution, direction, gap * gap * 0.25f * frame_time); + fast_vec_normalize( + direction_velocity_contribution, direction, gap * gap * 0.25f * frame_time); fast_vec_add(spawned_velocity, spawned_velocity, direction_velocity_contribution); *(int *)(spawned_velocity + 8) = 0; fast_vec_add(&MOBY(moby)->pos, &MOBY(moby)->pos, origin); diff --git a/src/overlays/l10/mobys/configurable_particle_emitter.c b/src/overlays/l10/mobys/configurable_particle_emitter.c index 3ced5d4801..ab807c0fff 100644 --- a/src/overlays/l10/mobys/configurable_particle_emitter.c +++ b/src/overlays/l10/mobys/configurable_particle_emitter.c @@ -171,7 +171,10 @@ extern int burst_spark_active_duration_max_gp __asm__("D_L10_00161FB0") __attr extern int burst_spark_pause_duration_min_gp __asm__("D_L10_00161FB4") __attribute__((sda)); extern int burst_spark_pause_duration_max_gp __asm__("D_L10_00161FB8") __attribute__((sda)); -void emit_burst_spark_particle(void *emission_position, short *spark_emission_countdown, short *burst) { +void emit_burst_spark_particle(void *emission_position, + short *spark_emission_countdown, + + short *burst) { float visibility_sphere[4]; float burst_spark_vertical_vector[4]; float acc[4]; @@ -225,8 +228,8 @@ void emit_burst_spark_particle(void *emission_position, short *spark_emission_co second_frame_count, third_frame_count, -1); - *spark_emission_countdown = truncate_float_to_s32(random_float_between((float)burst_spark_timer_reset_min_gp, - (float)burst_spark_timer_reset_max_gp)); + *spark_emission_countdown = truncate_float_to_s32(random_float_between( + (float)burst_spark_timer_reset_min_gp, (float)burst_spark_timer_reset_max_gp)); } /* Emits a smoke particle from pos on its timer, when the camera is near and the spot is visible. */ @@ -302,8 +305,8 @@ void emit_timed_spark_particle(void *emission_position, short *emission_countdow second_frame_count, third_frame_count, -1); - *emission_countdown = truncate_float_to_s32(random_float_between((float)timed_spark_timer_reset_min_gp, - (float)timed_spark_timer_reset_max_gp)); + *emission_countdown = truncate_float_to_s32(random_float_between( + (float)timed_spark_timer_reset_min_gp, (float)timed_spark_timer_reset_max_gp)); } /* Ported from rac1-decomp (src/overlays/l10_orxon/vendor_002E30F8.c: func_L10_002EBDC8), where it is exact; names translated to the US level program. */ diff --git a/src/overlays/l10/mobys/data_processor_linked_effect.c b/src/overlays/l10/mobys/data_processor_linked_effect.c index 7729ead842..df9d70d195 100644 --- a/src/overlays/l10/mobys/data_processor_linked_effect.c +++ b/src/overlays/l10/mobys/data_processor_linked_effect.c @@ -105,7 +105,8 @@ void data_processor_linked_effect_update(struct Moby *moby) { fade_duration_frames = data_processor_linked_effect_fade_duration_seconds_gp * 60.0f; moby->rot.z = new_rotation; linked_effect_vars->voice = -1; - linked_effect_vars->timer_34 = scale_game_frames(truncate_float_to_s32(fade_duration_frames)); + linked_effect_vars->timer_34 = + scale_game_frames(truncate_float_to_s32(fade_duration_frames)); } moby->flags |= 0x41; @@ -325,7 +326,8 @@ void render_data_processor_linked_effect(u8 *moby) { linked_processor_vars + group_vertices + (row + (vertex >> 1)) * 0x140 + order[i] * 0x10); } - draw_geometry_quad(buffers.packet.quad, strip_transforms + strip_transform_byte_offset, 0); + draw_geometry_quad( + buffers.packet.quad, strip_transforms + strip_transform_byte_offset, 0); } row = next_row; } while (row < 19); diff --git a/src/overlays/l10/mobys/directional_particle_emitter.c b/src/overlays/l10/mobys/directional_particle_emitter.c index d3fd96ade8..bf59513bf7 100644 --- a/src/overlays/l10/mobys/directional_particle_emitter.c +++ b/src/overlays/l10/mobys/directional_particle_emitter.c @@ -69,9 +69,9 @@ void directional_particle_emitter_update(struct Moby *moby) { i = life; qcopy(&position, moby_position); spawn_position_offset.f[0] = fast_cos(fast_add_rotations(moby->rot.z, 1.5707964f)) * - random_float_between(-pvars[4], pvars[4]); + random_float_between(-pvars[4], pvars[4]); spawn_position_offset.f[1] = fast_sin(fast_add_rotations(moby->rot.z, 1.5707964f)) * - random_float_between(-pvars[4], pvars[4]); + random_float_between(-pvars[4], pvars[4]); *(volatile f32 *)&spawn_position_offset.f[2] = 0.0f; spawn_position_offset.f[2] = random_float_between(-pvars[5], pvars[5]); fast_vec_add(&position, &position, &spawn_position_offset); diff --git a/src/overlays/l10/mobys/gadgebot_telepot_pad.c b/src/overlays/l10/mobys/gadgebot_telepot_pad.c index 8223fa133e..24a8bd2304 100644 --- a/src/overlays/l10/mobys/gadgebot_telepot_pad.c +++ b/src/overlays/l10/mobys/gadgebot_telepot_pad.c @@ -156,8 +156,9 @@ void gadgebot_telepot_pad_update(char *moby) { func_001F9FA8_2BFBB8(func_00214158_2BFBB8()) * func_002140F8_2BFBB8(0.0f, 0.5f); velocity[2] = 0.0f; velocity[2] += func_002140F8_2BFBB8(0.0f, 0.5f); - add_vectors( - jittered_origin, velocity, (*(char **)&D_L10_0015FFD8) + (*telepot_pad_vars << 8) + 0x10); + add_vectors(jittered_origin, + velocity, + (*(char **)&D_L10_0015FFD8) + (*telepot_pad_vars << 8) + 0x10); func_L00_001FF4B0_2BFBB8(position, position, func_002140F8_2BFBB8(0.0f, D_0015ED6C)); position[2] = func_002140F8_2BFBB8(D_0015ED6C * 2.5f, D_0015ED6C * 5.0f); life = func_001F9850_2BFBB8(func_L00_00258BC8_2BFBB8(15, 30)); diff --git a/src/overlays/l10/mobys/nanotech_upgrade_vendor.c b/src/overlays/l10/mobys/nanotech_upgrade_vendor.c index 9111897e52..29bf071d10 100644 --- a/src/overlays/l10/mobys/nanotech_upgrade_vendor.c +++ b/src/overlays/l10/mobys/nanotech_upgrade_vendor.c @@ -52,8 +52,8 @@ void nanotech_upgrade_vendor_update(struct Moby *moby) { angle = fast_arc_tan(hero.motion.pos.f[0] - moby->pos.x, hero.motion.pos.f[1] - moby->pos.y); if (fast_difference_between_rotations(moby->rot.z, angle) < 1.5707964f && - vector_distance_xy(&moby->pos, hero.motion.pos.f) < 4.0f && purchase_cooldown_base[1] == 0 && - D_L10_0015F5C4_vendor != 2) { + vector_distance_xy(&moby->pos, hero.motion.pos.f) < 4.0f && + purchase_cooldown_base[1] == 0 && D_L10_0015F5C4_vendor != 2) { set_moby_dialogue_record_value(moby, 1); if (alternate_item_available[4] == 0) { if (current_bolt_count >= 4001) { diff --git a/src/overlays/l11/mobys/resort_owner.c b/src/overlays/l11/mobys/resort_owner.c index 8e78053915..e811ff339f 100644 --- a/src/overlays/l11/mobys/resort_owner.c +++ b/src/overlays/l11/mobys/resort_owner.c @@ -770,13 +770,16 @@ int classify_resort_owner_target_proximity(struct Moby *moby) { continue; do { int target_moby_byte_offset = (*group_moby_entry & 0x7fff) << 8; - struct Moby *target_group_moby = (struct Moby *)(target_moby_byte_offset + D_L11_0015FFD8); + struct Moby *target_group_moby = + (struct Moby *)(target_moby_byte_offset + D_L11_0015FFD8); if ((signed char)target_group_moby->state >= RESORT_OWNER_TARGET_MIN_LIVE_STATE) { if (target_group_moby->oclass != 0x4de || is_moby_in_bob_target_exclusion_state((const u8 *)target_group_moby) == 0) { found = 1; - if (fast_vec_dist(&moby->pos, - &((struct Moby *)(D_L11_0015FFD8 + target_moby_byte_offset))->pos) < 10.0f) + if (fast_vec_dist( + &moby->pos, + &((struct Moby *)(D_L11_0015FFD8 + target_moby_byte_offset))->pos) < + 10.0f) return 2; } } diff --git a/src/overlays/l12/mobys/blarg_trooper.c b/src/overlays/l12/mobys/blarg_trooper.c index 06dad32cfd..cd84a7e099 100644 --- a/src/overlays/l12/mobys/blarg_trooper.c +++ b/src/overlays/l12/mobys/blarg_trooper.c @@ -579,13 +579,17 @@ void process_blarg_trooper_damage_and_alerts(struct Moby *moby) { if (scale_game_frames(0x3C) * 17 < trooper_damage_alert_vars->call_timer) { s32 active_group_member_count = 0; if (trooper_damage_alert_vars->groups[0] != -1) - active_group_member_count += count_active_moby_group_members(trooper_damage_alert_vars->groups[0], 2); + active_group_member_count += + count_active_moby_group_members(trooper_damage_alert_vars->groups[0], 2); if (trooper_damage_alert_vars->groups[1] != -1) - active_group_member_count += count_active_moby_group_members(trooper_damage_alert_vars->groups[1], 2); + active_group_member_count += + count_active_moby_group_members(trooper_damage_alert_vars->groups[1], 2); if (trooper_damage_alert_vars->groups[2] != -1) - active_group_member_count += count_active_moby_group_members(trooper_damage_alert_vars->groups[2], 2); + active_group_member_count += + count_active_moby_group_members(trooper_damage_alert_vars->groups[2], 2); if (trooper_damage_alert_vars->groups[3] != -1) - active_group_member_count += count_active_moby_group_members(trooper_damage_alert_vars->groups[3], 2); + active_group_member_count += + count_active_moby_group_members(trooper_damage_alert_vars->groups[3], 2); if (active_group_member_count >= 9 && random_integer_below(0x27) == 0) { help_direction_or_hit_position.f[0] = fast_cos(fast_add_rotations(moby->rot.z, 3.1415927f)); diff --git a/src/overlays/l12/mobys/hoven_turret.c b/src/overlays/l12/mobys/hoven_turret.c index 0ddc1a6501..1d3a2b734d 100644 --- a/src/overlays/l12/mobys/hoven_turret.c +++ b/src/overlays/l12/mobys/hoven_turret.c @@ -251,7 +251,8 @@ void hoven_turret_update(struct Moby *moby) { if (vector_distance_xy(((float *)&moby->pos), ((Hero *)(D_0013E533 + 0xE1D))->motion.pos.f) < 7.0f || ((Hero *)(D_0013E533 + 0xE1D))->ground_moby == moby) { - moby->pos.z = moby->pos.z + ((hoven_turret_state->initial_height - 1.2f) - moby->pos.z) * 0.11f; + moby->pos.z = + moby->pos.z + ((hoven_turret_state->initial_height - 1.2f) - moby->pos.z) * 0.11f; hoven_turret_state->boarding_yaw_step = fast_add_rotations( hoven_turret_state->boarding_yaw_step, @@ -425,19 +426,27 @@ void hoven_turret_update(struct Moby *moby) { float yaw; int i; - blend_moby_animation( - moby, hoven_turret_state->muzzle_alternation_state == HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING ? 4 : 3, 0, 1); + blend_moby_animation(moby, + hoven_turret_state->muzzle_alternation_state == + HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING + ? 4 + : 3, + 0, + 1); yaw = fast_add_rotations(moby->rot.z, 1.5707964f); build_spherical_offset(firing_offset, hoven_turret_firing_offset_rate * D_0015ED6C_gp, yaw, hoven_turret_state->f74); - if (hoven_turret_state->muzzle_alternation_state == HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING) { - hoven_turret_state->muzzle_alternation_state = HOVEN_TURRET_MUZZLE_POINT_ONE_PENDING; + if (hoven_turret_state->muzzle_alternation_state == + HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING) { + hoven_turret_state->muzzle_alternation_state = + HOVEN_TURRET_MUZZLE_POINT_ONE_PENDING; moby_point_position(moby, 2, muz); } else { moby_point_position(moby, 1, muz); - hoven_turret_state->muzzle_alternation_state = HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING; + hoven_turret_state->muzzle_alternation_state = + HOVEN_TURRET_MUZZLE_POINT_TWO_PENDING; } fast_vec_add(muz, muz, firing_offset); fast_vec_add(muz, muz, firing_offset); @@ -527,7 +536,8 @@ void hoven_turret_update(struct Moby *moby) { 0, -1, 0); - hoven_turret_state->destruction_explosion_cooldown_frames = scale_game_frames(random_int_between(5, 0xD)); + hoven_turret_state->destruction_explosion_cooldown_frames = + scale_game_frames(random_int_between(5, 0xD)); } if (fast_dec_timer_s16(&hoven_turret_state->destruction_respawn_frames)) { hero_respawn(); @@ -858,6 +868,7 @@ void draw_hoven_turret_destruction_fade(Level12VendorCounterMoby *moby) { int fade_duration_frames = scale_game_frames(0x50); int value = data->value; if (value < fade_duration_frames) { - emit_rgba_draw_packet(0xAA, 0, 0, (fade_duration_frames - value) * 0x50 / fade_duration_frames); + emit_rgba_draw_packet( + 0xAA, 0, 0, (fade_duration_frames - value) * 0x50 / fade_duration_frames); } } diff --git a/src/overlays/l12/mobys/oscillating_target_link.c b/src/overlays/l12/mobys/oscillating_target_link.c index cbafe191de..154d58692a 100644 --- a/src/overlays/l12/mobys/oscillating_target_link.c +++ b/src/overlays/l12/mobys/oscillating_target_link.c @@ -199,13 +199,15 @@ void update_oscillating_target_link_strips(struct Moby *moby) { if (interior_point_index < oscillating_link_strip_state->strip_point_count - 1) { points = (float *)((char *)oscillating_link_strip_state + strip * 0x460 + 0x1190); do { - fast_vec_add( - points, intermediate_storage[interior_point_index - 1], intermediate_storage[interior_point_index]); + fast_vec_add(points, + intermediate_storage[interior_point_index - 1], + intermediate_storage[interior_point_index]); fast_vec_add(points, points, intermediate_storage[interior_point_index + 1]); fast_vec_scale(points, points, 0.333f); interior_point_index++; points += 4; - } while (interior_point_index < oscillating_link_strip_state->strip_point_count - 1); + } while (interior_point_index < + oscillating_link_strip_state->strip_point_count - 1); } *(int *)(timers + (strip << 2)) = oscillating_link_strip_reset_ticks; } else { diff --git a/src/overlays/l12/mobys/water_reservoir.c b/src/overlays/l12/mobys/water_reservoir.c index 9ff879a7c1..bdfc86d2ab 100644 --- a/src/overlays/l12/mobys/water_reservoir.c +++ b/src/overlays/l12/mobys/water_reservoir.c @@ -50,9 +50,10 @@ void water_reservoir_update(struct Moby *moby) { WATER_RESERVOIR_STATE_ACTIVE = 1 }; float *reservoir_state = (float *)moby->pvars; - float pos[4], shared_random_offset[4], pair_delta_reference_offset[4], pos_offset_delta[4], offset_pair_delta[4]; - float fraction, frame_scale; - int scaled; + float pos[4], shared_random_offset[4], pair_delta_reference_offset[4], pos_offset_delta[4], + offset_pair_delta[4]; + float fraction, frame_scale; + int scaled; if (moby->state != WATER_RESERVOIR_STATE_INITIALIZE) { extern float D_L12_0015F3FC __attribute__((sda)); frame_scale = D_L12_0015F3FC; @@ -90,7 +91,8 @@ void water_reservoir_update(struct Moby *moby) { if (random_float_between(0.0f, 1.0f) < fraction) { random_vector(pos, 0.0f, water_reservoir_random_offset_radius_gp); random_vector(shared_random_offset, 0.0f, water_reservoir_random_offset_radius_gp); - random_vector(pair_delta_reference_offset, 0.0f, water_reservoir_random_offset_radius_gp); + random_vector( + pair_delta_reference_offset, 0.0f, water_reservoir_random_offset_radius_gp); fast_vec_sub(pos_offset_delta, pos, shared_random_offset); pos_offset_delta[2] += water_reservoir_effect_delta_z_reference_gp - water_reservoir_unmirrored_effect_spawn_z_offset_gp; diff --git a/src/overlays/l13/mobys/forcefield_tower.c b/src/overlays/l13/mobys/forcefield_tower.c index f47d1d08d4..9b079181c5 100644 --- a/src/overlays/l13/mobys/forcefield_tower.c +++ b/src/overlays/l13/mobys/forcefield_tower.c @@ -96,7 +96,8 @@ int set_voice_position(int index, const void *vector) { int voice_slot_byte_offset = index * 0x70; char *voice_table = D_0013E533 + 0x1D; char *vector_base = voice_table + 0xA0; - Level13SoundEffectTarget *effect = (Level13SoundEffectTarget *)(voice_table + voice_slot_byte_offset); + Level13SoundEffectTarget *effect = + (Level13SoundEffectTarget *)(voice_table + voice_slot_byte_offset); effect->flags |= 0x40; qcopy(vector_base + voice_slot_byte_offset, vector); return 1; diff --git a/src/overlays/l13/mobys/mine.c b/src/overlays/l13/mobys/mine.c index dbd088864e..ff4b3c5111 100644 --- a/src/overlays/l13/mobys/mine.c +++ b/src/overlays/l13/mobys/mine.c @@ -149,8 +149,10 @@ void level_13_mine_update(ProjectileMoby *moby) { make_hit_descriptor(16.0f, &hitpos, moby, 0x30000, velocity); qcopy(&steering_and_collision_vector, pos); steering_and_collision_vector.z += 0.75f; - detonation_flags = collect_mobies_in_sphere(1.7f, &steering_and_collision_vector, 0x10, moby, &hitpos); - detonation_flags = detonation_flags | FUN_L00_001f0d60_2048(&steering_and_collision_vector, 1.7f, 4, moby); + detonation_flags = + collect_mobies_in_sphere(1.7f, &steering_and_collision_vector, 0x10, moby, &hitpos); + detonation_flags = + detonation_flags | FUN_L00_001f0d60_2048(&steering_and_collision_vector, 1.7f, 4, moby); hit = (ProjectileMoby *)FUN_L00_0025a420(moby, -1, 0); if (hit != 0) { float health = *(float *)(moby_data + 0x20) - *(float *)((char *)hit + 0x2C); diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index dba8110b9c..3a16741cab 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -1189,7 +1189,8 @@ void draw_starfighter_tractor_beam(struct Moby *moby) { fast_vec_normalize(direction, direction, step); qcopy(position, start); distance = zero; - fast_vec_normalize(beam_phase_offset, direction, convert_integer_to_float(frame_count % 20) / 20.0f); + fast_vec_normalize( + beam_phase_offset, direction, convert_integer_to_float(frame_count % 20) / 20.0f); fast_vec_sub(position, position, beam_phase_offset); while (distance < length) { width = (distance * 0.0f) / (length + length) + 0.5f; @@ -1881,9 +1882,11 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->flight_speed += (frame_time * 30.0f - starfighter_vars->flight_speed) * 0.1f; if (frame_time * 40.0f < hero_distance) { - fast_vec_sub( - effect_position_or_beam_step, ((char *)&D_0013F3D0), starfighter_vars->tractor_beam_endpoint); - fast_vec_normalize(effect_position_or_beam_step, effect_position_or_beam_step, frame_time * 40.0f); + fast_vec_sub(effect_position_or_beam_step, + ((char *)&D_0013F3D0), + starfighter_vars->tractor_beam_endpoint); + fast_vec_normalize( + effect_position_or_beam_step, effect_position_or_beam_step, frame_time * 40.0f); fast_vec_add(starfighter_vars->tractor_beam_endpoint, starfighter_vars->tractor_beam_endpoint, effect_position_or_beam_step); @@ -1965,7 +1968,8 @@ void qwarks_starfighter_update(Moby388 *moby) { fast_vec_sub(ray_start, starfighter_vars->tractor_beam_endpoint, probe); fast_vec_normalize(ray_start, ray_start, 30.0f); fast_vec_add(ray_start, ray_start, probe); - fast_vec_sub(effect_position_or_beam_step, ray_start, starfighter_vars->tractor_beam_endpoint); + fast_vec_sub( + effect_position_or_beam_step, ray_start, starfighter_vars->tractor_beam_endpoint); distance = fast_vec_dist(ray_start, ((char *)&D_0013F3D0)); if (distance != 30.0f) { fast_vec_normalize(effect_position_or_beam_step, @@ -2339,8 +2343,8 @@ void qwarks_starfighter_update(Moby388 *moby) { fast_vec_sub(effect_position_or_beam_step, moby->pos, effect_position_or_beam_step); effect_position_or_beam_step[3] = 50.0f; if (starfighter_vars->light120 == -1) { - starfighter_vars->light120 = - allocate_colored_effect_slot(effect_position_or_beam_step, 50.0f, 0.0f, 3.0f, 0.5f, 0.01f); + starfighter_vars->light120 = allocate_colored_effect_slot( + effect_position_or_beam_step, 50.0f, 0.0f, 3.0f, 0.5f, 0.01f); } else { char *light = level13_point_light_slots + (starfighter_vars->light120 << 5); qcopy(light + 0x10, effect_position_or_beam_step); @@ -2405,7 +2409,10 @@ extern char *create_moby(int); extern char *create_moby(int) __asm__("FUN_0020c4f8"); -char *spawn_moby_joint_attachment(char *parent_moby, int attachment_joint_index, int attachment_class_id) { +char *spawn_moby_joint_attachment(char *parent_moby, + int attachment_joint_index, + + int attachment_class_id) { char *moby = create_moby(attachment_class_id); if (moby != 0) { char *attachment_vars; diff --git a/src/overlays/l14/mobys/button.c b/src/overlays/l14/mobys/button.c index 32b26b8418..cc03cbb63d 100644 --- a/src/overlays/l14/mobys/button.c +++ b/src/overlays/l14/mobys/button.c @@ -44,7 +44,8 @@ void button_update(struct Moby *moby) { moby->pos.z -= 0.35f; save_entry_index = (s16)moby->save_id; if (D_L14_001BB930.cleared[save_entry_index] != 0 || - (D_0014C190_257218[current_level_index][save_entry_index >> 5] >> (moby->save_id & 31) & 1) != 0 || + (D_0014C190_257218[current_level_index][save_entry_index >> 5] >> (moby->save_id & 31) & + 1) != 0 || (button_pvars[2] != 0 && D_0014C050[moby->mission + current_level_index * 16] == 0xFF)) { moby->command = 2; @@ -80,7 +81,8 @@ void button_update(struct Moby *moby) { moby->glow_color = high | shade | color; if (hero.ground_moby == moby && hero.air_frames.s == 0) { save_entry_index = (s16)moby->save_id; - D_0014C190_257218[current_level_index][save_entry_index >> 5] |= 1 << (moby->save_id & 31); + D_0014C190_257218[current_level_index][save_entry_index >> 5] |= + 1 << (moby->save_id & 31); D_L14_001BABD0[(s16)moby->save_id >> 5] |= 1 << (moby->save_id & 31); moby->state = BUTTON_ACTIVATED; moby->command = 1; diff --git a/src/overlays/l14/mobys/elevator.c b/src/overlays/l14/mobys/elevator.c index 7dc9caaaa9..ea2a0321bf 100644 --- a/src/overlays/l14/mobys/elevator.c +++ b/src/overlays/l14/mobys/elevator.c @@ -116,7 +116,10 @@ void elevator_update(struct Moby *elevator_moby) { qcopy(&elevator_moby->rot, elevator_vars->rot); elevator_save_id = elevator_moby->save_id; if (D_L14_001BB930.cleared[(short)elevator_save_id] == 0 && - (((D_0014C190_257218[current_level_index][(short)elevator_save_id >> 5] >> (elevator_save_id & 0x1F)) ^ 1) & 1) && + (((D_0014C190_257218[current_level_index][(short)elevator_save_id >> 5] >> + (elevator_save_id & 0x1F)) ^ + 1) & + 1) && visited52[elevator_vars->item + current_level_index * 16] == 0xFF) elevator_vars->bought = 1; else diff --git a/src/overlays/l14/mobys/enemy_fighter.c b/src/overlays/l14/mobys/enemy_fighter.c index d8dd5bf2db..e56d46e104 100644 --- a/src/overlays/l14/mobys/enemy_fighter.c +++ b/src/overlays/l14/mobys/enemy_fighter.c @@ -198,7 +198,8 @@ void spawn_enemy_fighter_exhaust(struct Moby *emitter_moby) { fast_vec_add(&pos, &pos, &step); life = scale_game_frames(2); for (i = 0; i < 3; i++) { - puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, ring_puff_size, 0x7FFFFFFF); + puff = + spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, ring_puff_size, 0x7FFFFFFF); if (puff != 0) { L14PuffTail *tail = &puff->tail; puff->frame = (emitter_moby->draw_dist >> 5 << 4) + exhaust_ftoi(4.0f); @@ -239,7 +240,8 @@ void spawn_enemy_fighter_exhaust(struct Moby *emitter_moby) { fast_vec_add(&pos, &pos, &step); life = scale_game_frames(2); for (i = 0; i < 3; i++) { - puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, ring_puff_size, 0x7FFFFFFF); + puff = + spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, ring_puff_size, 0x7FFFFFFF); if (puff != 0) { L14PuffTail *tail = &puff->tail; puff->frame = (emitter_moby->draw_dist >> 5 << 4) + exhaust_ftoi(4.0f); diff --git a/src/overlays/l14/mobys/flying_car.c b/src/overlays/l14/mobys/flying_car.c index 12e7afdcf4..cba866d9aa 100644 --- a/src/overlays/l14/mobys/flying_car.c +++ b/src/overlays/l14/mobys/flying_car.c @@ -231,7 +231,8 @@ void flying_car_update(struct Moby *flying_car_moby) { (hero.state.control_mode == HERO_MODE_GRAPPLE_SWING && hero.swing_target_moby == o)) { seed_linked_record_for_flying_car(flying_car_moby); - flying_car_data->attached_part_interaction_hold_timer_frames = scale_game_frames(0x1E); + flying_car_data->attached_part_interaction_hold_timer_frames = + scale_game_frames(0x1E); } else { fast_dec_timer(&flying_car_data->attached_part_interaction_hold_timer_frames); if (flying_car_data->attached_part_interaction_hold_timer_frames != 0) { diff --git a/src/overlays/l14/mobys/minibomber.c b/src/overlays/l14/mobys/minibomber.c index 84996b8b3e..1936eeb25a 100644 --- a/src/overlays/l14/mobys/minibomber.c +++ b/src/overlays/l14/mobys/minibomber.c @@ -1162,8 +1162,14 @@ void emit_minibomber_exhaust_puffs(struct Moby *moby) { for (j = 0; j < 3; j++) { L14Puff *part; L14PuffTail *tail; - part = spawn_puff( - pos, 0.05f, 1.0f, 1.0f, signed_puff_value, D_L14_0015F580_macro, exhaust_puff_size, 0x7FFFFFFF); + part = spawn_puff(pos, + 0.05f, + 1.0f, + 1.0f, + signed_puff_value, + D_L14_0015F580_macro, + exhaust_puff_size, + 0x7FFFFFFF); if (part) { tail = &part->tail; part->life = life; diff --git a/src/overlays/l14/mobys/rocket_strike_fighter.c b/src/overlays/l14/mobys/rocket_strike_fighter.c index 9b3426f0e7..e7766807f8 100644 --- a/src/overlays/l14/mobys/rocket_strike_fighter.c +++ b/src/overlays/l14/mobys/rocket_strike_fighter.c @@ -101,7 +101,9 @@ void rocket_strike_fighter_update(struct Moby *moby) { if (moby->state == ROCKET_STRIKE_FIGHTER_STATE_INITIALIZE) { u16 fighter_save_id = moby->save_id; if (D_L14_001BB930.cleared[(short)fighter_save_id] != 0 || - (D_0014C190_257218[current_level_index][(short)fighter_save_id >> 5] >> (fighter_save_id & 0x1F)) & 1) { + (D_0014C190_257218[current_level_index][(short)fighter_save_id >> 5] >> + (fighter_save_id & 0x1F)) & + 1) { mark_moby_and_linked_moby_for_removal(&D_L14_0015FFD8_t[moby_vars->rocket]); mark_moby_for_removal(moby); return; @@ -324,7 +326,8 @@ void spawn_rocket_strike_fighter_exhaust(struct Moby *moby) { spin = 16; life = scale_game_frames(2); for (i = 0; i < 3; i++) { - puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, puff_spawn_size, 0x7FFFFFFF); + puff = + spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, puff_spawn_size, 0x7FFFFFFF); if (puff != 0) { L14PuffTail *tail = &puff->tail; puff->life = life; @@ -389,7 +392,8 @@ void spawn_rocket_strike_fighter_exhaust(struct Moby *moby) { spin = 16; life = scale_game_frames(2); for (i = 0; i < 3; i++) { - puff = spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, puff_spawn_size, 0x7FFFFFFF); + puff = + spawn_puff(&pos, 0.05f, 1.0f, 1.0f, spin, D_L14_0015F580, puff_spawn_size, 0x7FFFFFFF); if (puff != 0) { L14PuffTail *tail = &puff->tail; puff->life = life; diff --git a/src/overlays/l14/mobys/sam.c b/src/overlays/l14/mobys/sam.c index 6631e8e4bc..476920c8a4 100644 --- a/src/overlays/l14/mobys/sam.c +++ b/src/overlays/l14/mobys/sam.c @@ -133,7 +133,9 @@ void sam_update(L14WatchMoby *moby) { } moby_save_state_index = moby->hB2; if (D_L14_001BB930.cleared[(short)moby_save_state_index] != 0 || - (D_0014C190_257218[current_level_index][(short)moby_save_state_index >> 5] >> (moby_save_state_index & 0x1F)) & 1) { + (D_0014C190_257218[current_level_index][(short)moby_save_state_index >> 5] >> + (moby_save_state_index & 0x1F)) & + 1) { mark_moby_for_removal(moby); return; } diff --git a/src/overlays/l14/mobys/wind_control.c b/src/overlays/l14/mobys/wind_control.c index de481f6853..a579ff569d 100644 --- a/src/overlays/l14/mobys/wind_control.c +++ b/src/overlays/l14/mobys/wind_control.c @@ -269,16 +269,20 @@ void update_wind_sparks(struct Moby *wind_control_moby) { } } else { opacity = wind_spark_peak_alpha_gp; - if (spark_vars->spark_lifetime_initial_frames[i] - wind_spark_fade_in_frames_gp < spark_vars->spark_lifetime_remaining_frames[i]) { + if (spark_vars->spark_lifetime_initial_frames[i] - wind_spark_fade_in_frames_gp < + spark_vars->spark_lifetime_remaining_frames[i]) { spark_fade_fraction = - convert_integer_to_float(spark_vars->spark_lifetime_initial_frames[i] - spark_vars->spark_lifetime_remaining_frames[i]); + convert_integer_to_float(spark_vars->spark_lifetime_initial_frames[i] - + spark_vars->spark_lifetime_remaining_frames[i]); spark_fade_fraction = spark_fade_fraction / convert_integer_to_float(wind_spark_fade_in_frames_gp); } else { - spark_fade_fraction = convert_integer_to_float(spark_vars->spark_lifetime_remaining_frames[i]); + spark_fade_fraction = + convert_integer_to_float(spark_vars->spark_lifetime_remaining_frames[i]); spark_fade_fraction = spark_fade_fraction / - convert_integer_to_float(spark_vars->spark_lifetime_initial_frames[i] - wind_spark_fade_in_frames_gp); + convert_integer_to_float(spark_vars->spark_lifetime_initial_frames[i] - + wind_spark_fade_in_frames_gp); } { int spark_alpha = diff --git a/src/overlays/l14/path_key_camera.c b/src/overlays/l14/path_key_camera.c index b5801ebcfe..e089319240 100644 --- a/src/overlays/l14/path_key_camera.c +++ b/src/overlays/l14/path_key_camera.c @@ -272,7 +272,8 @@ void update_path_key_camera(char *path_key_camera) { (path_key_camera_rail_distances[side][hero.rail_segment] + hero.rail_seg_frac) / path_key_camera_rail_distances[side][999]; if (rec->angle_override_stage < 2 && - path_key_camera_angle_override_progress_thresholds[rec->angle_override_stage][side] <= D_L14_001624C0) { + path_key_camera_angle_override_progress_thresholds[rec->angle_override_stage][side] <= + D_L14_001624C0) { rec->angle_override_stage++; } if (rec->angle_override_stage == 1) { @@ -280,7 +281,8 @@ void update_path_key_camera(char *path_key_camera) { ((CamBones5d48 *)D_L14_0017AD80)->f278 = D_L14_001624AC * 0.017453292f; } if (rec->linked_moby_event_stage < 3 && - path_key_camera_linked_moby_event_progress_thresholds[rec->linked_moby_event_stage][side] <= D_L14_001624C0) { + path_key_camera_linked_moby_event_progress_thresholds[rec->linked_moby_event_stage][side] <= + D_L14_001624C0) { struct Moby *first_linked_moby = (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->first_linked_moby_index << 8)); struct Moby *second_linked_moby = @@ -378,9 +380,11 @@ void update_path_key_camera(char *path_key_camera) { next_camera_key_index = st->idx + 1; if (side == 0 && D_L14_001F6488[st->idx + 1].side_zero_progress_threshold <= D_L14_001624C0) { st->idx++; - } else if (side == 1 && D_L14_001F6488[st->idx + 1].side_one_progress_threshold <= D_L14_001624C0) { + } else if (side == 1 && + D_L14_001F6488[st->idx + 1].side_one_progress_threshold <= D_L14_001624C0) { st->idx++; - } else if (side == 2 && D_L14_001F6488[st->idx + 1].side_two_progress_threshold <= D_L14_001624C0) { + } else if (side == 2 && + D_L14_001F6488[st->idx + 1].side_two_progress_threshold <= D_L14_001624C0) { st->idx++; } if (D_L14_001F6488[st->idx + 1].interpolation_stop_marker == 0x2710) { @@ -391,13 +395,16 @@ void update_path_key_camera(char *path_key_camera) { float den; if (side == 0) { - den = D_L14_001F6488[st->idx + 1].side_zero_progress_threshold - D_L14_001F6488[st->idx].side_zero_progress_threshold; + den = D_L14_001F6488[st->idx + 1].side_zero_progress_threshold - + D_L14_001F6488[st->idx].side_zero_progress_threshold; num = D_L14_001624C0 - D_L14_001F6488[st->idx].side_zero_progress_threshold; } else if (side == 1) { - den = D_L14_001F6488[st->idx + 1].side_one_progress_threshold - D_L14_001F6488[st->idx].side_one_progress_threshold; + den = D_L14_001F6488[st->idx + 1].side_one_progress_threshold - + D_L14_001F6488[st->idx].side_one_progress_threshold; num = D_L14_001624C0 - D_L14_001F6488[st->idx].side_one_progress_threshold; } else { - den = D_L14_001F6488[st->idx + 1].side_two_progress_threshold - D_L14_001F6488[st->idx].side_two_progress_threshold; + den = D_L14_001F6488[st->idx + 1].side_two_progress_threshold - + D_L14_001F6488[st->idx].side_two_progress_threshold; num = D_L14_001624C0 - D_L14_001F6488[st->idx].side_two_progress_threshold; } key_interpolation_fraction = num / den; diff --git a/src/overlays/l15/mobys/exploding_prop.c b/src/overlays/l15/mobys/exploding_prop.c index 19d0ff90f3..73e38d2e32 100644 --- a/src/overlays/l15/mobys/exploding_prop.c +++ b/src/overlays/l15/mobys/exploding_prop.c @@ -132,7 +132,8 @@ void exploding_prop_update(struct Moby *moby) { radius = random_float_between(0.1f, 0.3f); life = random_int_between(100, 160); size = random_float_between(3.0f, 7.0f); - spawn_debris_chunk(&effect_spawn_position, &velocity, *color, radius, life, size, 0.15f, 2.0f, 1); + spawn_debris_chunk( + &effect_spawn_position, &velocity, *color, radius, life, size, 0.15f, 2.0f, 1); } clear_u64_value(&velocity); spawn_explosion(moby, @@ -182,7 +183,8 @@ void exploding_prop_update(struct Moby *moby) { size = random_float_between(1.0f, 3.0f) * 210000.0f; life = scale_game_frames(180); pick = random_integer_below(3); - debris = mine_debris(&effect_spawn_position, &velocity, color1, color2, size, life, colors[pick]); + debris = mine_debris( + &effect_spawn_position, &velocity, color1, color2, size, life, colors[pick]); if (debris != 0) *(float *)((char *)debris + 0x2c) = moby->pos.z - 0.5f; } diff --git a/src/overlays/l15/mobys/radial_exploding_prop.c b/src/overlays/l15/mobys/radial_exploding_prop.c index 2d4a0eef28..5c7e039aac 100644 --- a/src/overlays/l15/mobys/radial_exploding_prop.c +++ b/src/overlays/l15/mobys/radial_exploding_prop.c @@ -76,7 +76,8 @@ void radial_exploding_prop_update(struct Moby *moby) { RADIAL_EXPLODING_PROP_STATE_INITIALIZED = 1 }; char *slot = 0; - Vec velocity, hit_direction_step, doubled_hit_direction_step, debris_spawn_position, debris_origin; + Vec velocity, hit_direction_step, doubled_hit_direction_step, debris_spawn_position, + debris_origin; u32 palette[4]; u32 colors[4]; Vec position; @@ -140,8 +141,15 @@ void radial_exploding_prop_update(struct Moby *moby) { radius = random_float_between(0.1f, 0.3f); duration = random_int_between(60, 100); size = random_float_between(3.0f, 7.0f); - spawn_debris_chunk( - &debris_spawn_position, &velocity, *palette_entry, radius, duration, size, 0.15f, 2.0f, 1); + spawn_debris_chunk(&debris_spawn_position, + &velocity, + *palette_entry, + radius, + duration, + size, + 0.15f, + 2.0f, + 1); i--; } while (i >= 0); } @@ -157,8 +165,8 @@ void radial_exploding_prop_update(struct Moby *moby) { size = random_float_between(0.75f, 1.25f); scale_vector_xyz_7880(size, &velocity, &velocity); duration = random_int_between(60, 100); - effect = - spawn_debris_chunk(&debris_spawn_position, &velocity, 0xc9, radius, duration, 5.0f, radius, 2.0f, 1); + effect = spawn_debris_chunk( + &debris_spawn_position, &velocity, 0xc9, radius, duration, 5.0f, radius, 2.0f, 1); if (effect != 0) scale_vector_xyz_7880(0.35f, (char *)effect + 0x40, (char *)effect + 0x40); } @@ -209,7 +217,8 @@ void radial_exploding_prop_update(struct Moby *moby) { size = random_float_between(1.0f, 3.0f) * 210000.0f; duration = scale_game_frames(180); index = random_integer_below(3); - effect = mine_debris(&debris_spawn_position, &velocity, color, color2, size, duration, colors[index]); + effect = mine_debris( + &debris_spawn_position, &velocity, color, color2, size, duration, colors[index]); if (effect != 0) *(float *)((char *)effect + 0x2c) = moby->pos.z - 0.5f; i--; diff --git a/src/overlays/l16/mobys/chomper.c b/src/overlays/l16/mobys/chomper.c index b30ff14d5b..2e0428a741 100644 --- a/src/overlays/l16/mobys/chomper.c +++ b/src/overlays/l16/mobys/chomper.c @@ -148,7 +148,8 @@ void chomper_update(struct Moby *chomper_moby) { chomper_moby->state = CHOMPER_FACE_TARGET; if (chomper_moby->prev_seq != 1) blend_moby_animation(chomper_moby, 1, 0, scale_game_frames(20)); - } else if (chomper_data->pursuit_target_selection_status == CHOMPER_TARGET_SELECTION_REJECTED) + } else if (chomper_data->pursuit_target_selection_status == + CHOMPER_TARGET_SELECTION_REJECTED) chomper_moby->state = CHOMPER_RETURN_HOME; break; case CHOMPER_FACE_TARGET: { @@ -176,7 +177,8 @@ void chomper_update(struct Moby *chomper_moby) { chomper_moby->state = CHOMPER_WAIT_TO_APPROACH_TARGET; if (chomper_moby->prev_seq != 2) blend_moby_animation(chomper_moby, 2, 0, scale_game_frames(20)); - } else if (chomper_data->pursuit_target_selection_status != CHOMPER_TARGET_SELECTION_REJECTED) + } else if (chomper_data->pursuit_target_selection_status != + CHOMPER_TARGET_SELECTION_REJECTED) chomper_moby->state = CHOMPER_APPROACH_TARGET; break; case 7: diff --git a/src/overlays/l16/mobys/path_walker.c b/src/overlays/l16/mobys/path_walker.c index f0692bdd5d..0c66190690 100644 --- a/src/overlays/l16/mobys/path_walker.c +++ b/src/overlays/l16/mobys/path_walker.c @@ -215,7 +215,8 @@ void emit_path_walker_particle(unsigned char *source_moby, void *previous_positi float particle_position[4]; float movement_velocity[4]; float velocity[4]; - float random_offset_angle, second_random_offset_angle, random_velocity_magnitude, movement_distance, final_size; + float random_offset_angle, second_random_offset_angle, random_velocity_magnitude, + movement_distance, final_size; *(OvlQuad *)input = *(OvlQuad *)previous_position; if ((unsigned char)source_moby[0x31] == 0) return; @@ -233,7 +234,8 @@ void emit_path_walker_particle(unsigned char *source_moby, void *previous_positi fast_vec_add(particle_position, particle_position, source_moby + 0x10); random_offset_angle = random_angle_radians(); second_random_offset_angle = random_angle_radians(); - build_spherical_offset(velocity, random_velocity_magnitude, random_offset_angle, second_random_offset_angle); + build_spherical_offset( + velocity, random_velocity_magnitude, random_offset_angle, second_random_offset_angle); fast_vec_add(velocity, velocity, movement_velocity); final_size = path_walker_particle_target_scalar_scale_gp; final_size *= 210000.0f; diff --git a/src/overlays/l16/mobys/test_dummy.c b/src/overlays/l16/mobys/test_dummy.c index 4d6f4ebc0e..dd289a909b 100644 --- a/src/overlays/l16/mobys/test_dummy.c +++ b/src/overlays/l16/mobys/test_dummy.c @@ -180,7 +180,8 @@ void test_dummy_update(unsigned char *moby) { dummy_data->max_health = 2; dummy_data->health = 2.0f; dummy_data->glow_pulse_phase = random_angle_radians(); - dummy_data->route = find_nearest_test_dummy_door(dummy_data->door_moby_group_index, moby + 0x10); + dummy_data->route = + find_nearest_test_dummy_door(dummy_data->door_moby_group_index, moby + 0x10); qcopy(dummy_data->spawn, moby + 0x10); switch (dummy_data->kind) { case TEST_DUMMY_KIND_THROWER: @@ -575,9 +576,10 @@ void update_test_dummy_damage_and_respawn(void *moby) { } amount = 0.0f; dummy_hit_record = find_moby_hit(hit_moby, 0x330000, 0); - hit_reaction(hit_moby, dummy_hit_record, &hit_data->health, 0, &hit_reaction_status, &amount, 0, 4); - if (hit_reaction_status != HIT_REACTION_STATUS_NO_DAMAGE && hit_moby->state != TEST_DUMMY_STATE_BURST && - hit_moby->state != TEST_DUMMY_STATE_RESPAWN) { + hit_reaction( + hit_moby, dummy_hit_record, &hit_data->health, 0, &hit_reaction_status, &amount, 0, 4); + if (hit_reaction_status != HIT_REACTION_STATUS_NO_DAMAGE && + hit_moby->state != TEST_DUMMY_STATE_BURST && hit_moby->state != TEST_DUMMY_STATE_RESPAWN) { hit_data->health -= amount; if (hit_data->health <= 0.0f) { hit_moby->state = TEST_DUMMY_STATE_BURST; diff --git a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c index 181bac69b4..4e228b124d 100644 --- a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c +++ b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c @@ -571,7 +571,8 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { expression table, and that size orders the stack slots of the cached addresses (sp+0x90..0xC4): with the literal at both calls every one of those slots is rotated by three. */ int mask = 0x30000; - float distance, duration, target, z, gap, speed, angle, scale, rate, limit, competitor_speed_offset, slow; + float distance, duration, target, z, gap, speed, angle, scale, rate, limit, + competitor_speed_offset, slow; /* No pointer locals: every address is written where it is used. The compiler caches them itself (d + 0x1E0 from here on, the others at the top of the active state). */ @@ -594,7 +595,8 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { *(float *)(path + 0x24) - *(float *)(path + 0x14)); hoverboard_dummy_data->unk2B = 1; time = D_0015ED6C; - competitor_speed_offset = (float)hoverboard_dummy_data->race_competitor_index * (time * 1.55f); + competitor_speed_offset = + (float)hoverboard_dummy_data->race_competitor_index * (time * 1.55f); hoverboard_dummy_data->normal_speed_target = time * 17.0f + competitor_speed_offset; hoverboard_dummy_data->boost_speed_target = time * 24.0f + competitor_speed_offset; if (D_0013D4DF == 0) { @@ -637,7 +639,8 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { if (hero.state.control_mode != 22) { MOBY(moby)->state = HOVERBOARD_DUMMY_STATE_INITIALIZE; } else { - int reactivation_elapsed_frames = *(unsigned short *)&hoverboard_dummy_data->reactivation_timer_frames + 1; + int reactivation_elapsed_frames = + *(unsigned short *)&hoverboard_dummy_data->reactivation_timer_frames + 1; short timer = reactivation_elapsed_frames; hoverboard_dummy_data->reactivation_timer_frames = reactivation_elapsed_frames; diff --git a/src/overlays/l17/mobys/dreks_fleet_turret_shot.c b/src/overlays/l17/mobys/dreks_fleet_turret_shot.c index 73c775dca8..7a16ed028a 100644 --- a/src/overlays/l17/mobys/dreks_fleet_turret_shot.c +++ b/src/overlays/l17/mobys/dreks_fleet_turret_shot.c @@ -49,7 +49,9 @@ unsigned char *create_drone_flight_trail_record(char *position_source, int mode, int step) __asm__("FUN_L17_0026fdd0"); -unsigned char *create_drone_flight_trail_record(char *position_source, int use_short_step_range, int step) { +unsigned char * + +create_drone_flight_trail_record(char *position_source, int use_short_step_range, int step) { enum { DRONE_FLIGHT_TRAIL_MODE_EXTENDED_STEP_RANGE = 0 }; diff --git a/src/overlays/l17/mobys/magnet_elevator.c b/src/overlays/l17/mobys/magnet_elevator.c index e4772dfa24..b214659e13 100644 --- a/src/overlays/l17/mobys/magnet_elevator.c +++ b/src/overlays/l17/mobys/magnet_elevator.c @@ -90,10 +90,10 @@ void magnet_elevator_update(struct Moby *moby) { fast_vec_scale(delta, &moby->pos, -1.0f); qcopy(rot, &moby->rot); if (W(elevator_runtime_state, 0x7C) == 0) { - float f = - 1.0f - - ((*(float *)((char *)(moby) + (0x18))) - (*(float *)((char *)(elevator_runtime_state) + (0x64)))) / - ((*(float *)((char *)(elevator_runtime_state) + (0x60))) - (*(float *)((char *)(elevator_runtime_state) + (0x64)))); + float f = 1.0f - ((*(float *)((char *)(moby) + (0x18))) - + (*(float *)((char *)(elevator_runtime_state) + (0x64)))) / + ((*(float *)((char *)(elevator_runtime_state) + (0x60))) - + (*(float *)((char *)(elevator_runtime_state) + (0x64)))); if (f > 1.0f) { f = 1.0f; } else if (f < 0.0f) { @@ -106,14 +106,16 @@ void magnet_elevator_update(struct Moby *moby) { case MAGNET_ELEVATOR_STATE_INITIALIZE: (*(float *)((char *)(elevator_runtime_state) + (0x78))) = random_angle_radians(); W(elevator_runtime_state, 0x6C) = -1; - if (W(elevator_runtime_state, 0x80) == -1 || **(int **)(D_L17_001B0DB0 + W(elevator_runtime_state, 0x80) * 4) != 0xB) { + if (W(elevator_runtime_state, 0x80) == -1 || + **(int **)(D_L17_001B0DB0 + W(elevator_runtime_state, 0x80) * 4) != 0xB) { mark_moby_for_removal(moby); return; } B(moby, 0x20) = 6; break; case MAGNET_ELEVATOR_STATE_BLEND_CAMERA: { - float previous_camera_blend_progress = (*(float *)((char *)(elevator_runtime_state) + (0x70))); + float previous_camera_blend_progress = + (*(float *)((char *)(elevator_runtime_state) + (0x70))); advance_accelerated_scalar((float *)(elevator_runtime_state + 0x70), (float *)(elevator_runtime_state + 0x74), 1.0f, @@ -121,8 +123,9 @@ void magnet_elevator_update(struct Moby *moby) { frame_time_sq * 4.0f, frame_time * 4.0f); if ((*(float *)((char *)(elevator_runtime_state) + (0x70))) < 1.0f) { - float remaining_camera_blend_ratio = (1.0f - (*(float *)((char *)(elevator_runtime_state) + (0x70)))) / - (1.0f - previous_camera_blend_progress); + float remaining_camera_blend_ratio = + (1.0f - (*(float *)((char *)(elevator_runtime_state) + (0x70)))) / + (1.0f - previous_camera_blend_progress); char *camera_pose_base; FUN_L17_002ee9c0_c(moby, (char *)camera_position, (char *)camera_rotation); fast_vec_sub(camera_position_offset, D_L17_001676C0, camera_position); @@ -216,10 +219,11 @@ void magnet_elevator_update(struct Moby *moby) { case MAGNET_ELEVATOR_STATE_WAIT_AT_SECOND_STOP: { int i; char *hero_state; - (*(float *)((char *)(elevator_runtime_state) + (0x78))) = - fast_add_rotations((*(float *)((char *)(elevator_runtime_state) + (0x78))), frame_time * 6.2831855f); - i = truncate_float_to_s32((fast_sin((*(float *)((char *)(elevator_runtime_state) + (0x78)))) * 4.0f - 3.0f) * - 128.0f); + (*(float *)((char *)(elevator_runtime_state) + (0x78))) = fast_add_rotations( + (*(float *)((char *)(elevator_runtime_state) + (0x78))), frame_time * 6.2831855f); + i = truncate_float_to_s32( + (fast_sin((*(float *)((char *)(elevator_runtime_state) + (0x78)))) * 4.0f - 3.0f) * + 128.0f); if (i > 0x80) { i = 0x80; } else if (i < 0x20) { @@ -280,7 +284,10 @@ void build_magnet_elevator_camera_pose(struct Moby *moby, char *camera_position, char *state) __asm__("FUN_L17_002ee9c0"); -void build_magnet_elevator_camera_pose(struct Moby *moby, char *camera_position, char *camera_rotation) { +void build_magnet_elevator_camera_pose(struct Moby *moby, + char *camera_position, + + char *camera_rotation) { fast_vec_sub(camera_position, D_L17_001676C0, &moby->pos); set_vector_length_xy(camera_position, camera_position, 2.5f); *(float *)(camera_position + 8) = 1.5f; diff --git a/src/overlays/l17/mobys/robot_dog.c b/src/overlays/l17/mobys/robot_dog.c index 9a7997dd46..1987ad95be 100644 --- a/src/overlays/l17/mobys/robot_dog.c +++ b/src/overlays/l17/mobys/robot_dog.c @@ -294,7 +294,8 @@ void robot_dog_update(unsigned char *robot_dog_moby) { MOBY(robot_dog_moby)->anim_speed = 1.7f; mode = robot_dog_vars->mode; if (mode == ROBOT_DOG_DETECTION_CLEAR_LINE_IN_FACING_CONE && - (fast_dec_timer_s16(&robot_dog_vars->clear_line_response_delay_frames) || D_0013E533[0x2EC1] != 3)) { + (fast_dec_timer_s16(&robot_dog_vars->clear_line_response_delay_frames) || + D_0013E533[0x2EC1] != 3)) { if (random_integer_below(3) == 0) { if (robot_dog_moby[0x53] != mode) { blend_moby_animation(robot_dog_moby, 2, 0, scale_game_frames(10)); diff --git a/src/overlays/l18/hero/hero_set_state.c b/src/overlays/l18/hero/hero_set_state.c index ea0c9e79a6..446fbe140c 100644 --- a/src/overlays/l18/hero/hero_set_state.c +++ b/src/overlays/l18/hero/hero_set_state.c @@ -85,7 +85,8 @@ int hero_set_state(int requested_state, int animation_update_mode) { animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } - if ((D_L18_0015F5C4 == 2 || D_L18_0015F5C4 == 6) && animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) + if ((D_L18_0015F5C4 == 2 || D_L18_0015F5C4 == 6) && + animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l18/mobys/drek_boss_electric_ball.c b/src/overlays/l18/mobys/drek_boss_electric_ball.c index 278d810be8..8823336202 100644 --- a/src/overlays/l18/mobys/drek_boss_electric_ball.c +++ b/src/overlays/l18/mobys/drek_boss_electric_ball.c @@ -492,10 +492,14 @@ void spawn_explosion_burst(void *source_moby) { speed = random_float_between(explosion_burst_spark_speed_min_gp, explosion_burst_spark_speed_max_gp); build_spherical_offset(velocity, speed * frame_time, angle, elevation); - fast_vec_scale(second_spark_vector_or_particle_position, velocity, explosion_burst_spark_second_vector_scale_gp); + fast_vec_scale(second_spark_vector_or_particle_position, + velocity, + explosion_burst_spark_second_vector_scale_gp); scale = random_float_between(0.8f, 1.2f); - second_spark_vector_or_particle_position[3] = velocity[3] = explosion_burst_spark_vector_w_gp; - second_spark_vector_or_particle_position[2] += explosion_burst_spark_second_vector_z_rate_gp * scale * frame_time; + second_spark_vector_or_particle_position[3] = velocity[3] = + explosion_burst_spark_vector_w_gp; + second_spark_vector_or_particle_position[2] += + explosion_burst_spark_second_vector_z_rate_gp * scale * frame_time; scale = random_float_between(0.8f, 1.2f); a = truncate_float_to_s32( (float)scale_game_frames(explosion_burst_spark_frame_count_gp) * scale); @@ -529,15 +533,19 @@ void spawn_explosion_burst(void *source_moby) { build_spherical_offset(velocity, speed, angle, elevation); angle = random_angle_radians(); offset_x = fast_cos(angle); - second_spark_vector_or_particle_position[0] = random_float_between(0.0f, explosion_burst_particle_xy_offset_limit_gp); + second_spark_vector_or_particle_position[0] = + random_float_between(0.0f, explosion_burst_particle_xy_offset_limit_gp); offset_x *= second_spark_vector_or_particle_position[0]; second_spark_vector_or_particle_position[0] = offset_x; offset_y = fast_sin(angle); - second_spark_vector_or_particle_position[1] = random_float_between(0.0f, explosion_burst_particle_xy_offset_limit_gp); + second_spark_vector_or_particle_position[1] = + random_float_between(0.0f, explosion_burst_particle_xy_offset_limit_gp); offset_y *= second_spark_vector_or_particle_position[1]; second_spark_vector_or_particle_position[1] = offset_y; second_spark_vector_or_particle_position[2] = 0.0f; - fast_vec_add(second_spark_vector_or_particle_position, second_spark_vector_or_particle_position, &moby->pos); + fast_vec_add(second_spark_vector_or_particle_position, + second_spark_vector_or_particle_position, + &moby->pos); color1 = explosion_burst_particle_first_color_choices[random_integer_below(6)]; color2 = explosion_burst_particle_second_color_choices[random_integer_below(6)]; scale = explosion_burst_particle_scale_multiplier_gp * 400000.0f; @@ -547,7 +555,16 @@ void spawn_explosion_burst(void *source_moby) { b = scale_game_frames( random_int_between(explosion_burst_particle_second_frame_count_range_start_gp, explosion_burst_particle_second_frame_count_range_end_gp)); - spawn_particle(second_spark_vector_or_particle_position, velocity, color1, color2, scale, a, b, speed, 0, 0); + spawn_particle(second_spark_vector_or_particle_position, + velocity, + color1, + color2, + scale, + a, + b, + speed, + 0, + 0); } while (j < explosion_burst_particle_count_gp); } if (explosion_burst_first_glow_scale_multiplier_gp > 0.0f) { diff --git a/src/overlays/l18/mobys/drek_fight_missile.c b/src/overlays/l18/mobys/drek_fight_missile.c index f2336a2ef1..f8891cf0cc 100644 --- a/src/overlays/l18/mobys/drek_fight_missile.c +++ b/src/overlays/l18/mobys/drek_fight_missile.c @@ -438,7 +438,8 @@ void draw_drek_fight_missile_group_trails(struct Moby *moby) { for (j = 0; j < 4; j++) { quads[i].texture_coordinates[j][0] = drek_missile_trail_texture_coordinates[j][0]; quads[i].texture_coordinates[j][1] = drek_missile_trail_texture_coordinates[j][1]; - color_blend_factor = convert_integer_to_float(i + 1 - (j >> 1)) * 0.25f + frame_color_blend_offset; + color_blend_factor = + convert_integer_to_float(i + 1 - (j >> 1)) * 0.25f + frame_color_blend_offset; if (color_blend_factor > 1.0f) { color_blend_factor = 1.0f; } else if (color_blend_factor < 0.0f) { diff --git a/src/overlays/l18/mobys/drek_final_boss_robot.c b/src/overlays/l18/mobys/drek_final_boss_robot.c index feec729474..082c0f31ae 100644 --- a/src/overlays/l18/mobys/drek_final_boss_robot.c +++ b/src/overlays/l18/mobys/drek_final_boss_robot.c @@ -1196,11 +1196,13 @@ void drek_final_boss_robot_update(BossMoby *moby) { update_drek_boss_arena_circling_movement((struct Moby *)moby); if (is_value_within_interpolated_window((char *)moby, 1.0f) != 0 || is_value_within_interpolated_window((char *)moby, 16.0f) != 0) { - if (random_integer_below(5) != 0 || boss_data->ground_target_center_mode == DREK_BOSS_GROUND_TARGET_CENTER_HERO_POSITION) { + if (random_integer_below(5) != 0 || boss_data->ground_target_center_mode == + DREK_BOSS_GROUND_TARGET_CENTER_HERO_POSITION) { float a; float r; - if (boss_data->ground_target_center_mode != DREK_BOSS_GROUND_TARGET_CENTER_HERO_POSITION) { + if (boss_data->ground_target_center_mode != + DREK_BOSS_GROUND_TARGET_CENTER_HERO_POSITION) { qcopy(position_displacement_direction_and_rotation_scratch, boss_data->f70); } else { qcopy(position_displacement_direction_and_rotation_scratch, hero.motion.pos.f); diff --git a/src/overlays/shared/camera/aim_volume_camera.c b/src/overlays/shared/camera/aim_volume_camera.c index 2edde5c981..1f56b02734 100644 --- a/src/overlays/shared/camera/aim_volume_camera.c +++ b/src/overlays/shared/camera/aim_volume_camera.c @@ -11,7 +11,9 @@ #include "rnc/overlay/shared/camera/swing_volume_camera.h" #include "rnc/overlay/shared/camera.h" #include "rnc/overlay/shared/camera/follow_camera_set_up_spring.h" + void set_follow_camera_angle_parameter(float) __asm__("FUN_L00_002e8540"); + #include "rnc/overlay/shared/rendering/culling/test_point_in_transformed_unit_cylinder.h" #include "rnc/rendering/clip_volume.h" diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index efbe15e60b..8fc7aca542 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -522,7 +522,8 @@ void rebuild_follow_camera_pose(int snap) { } } /* straight above or below the target: nudge the camera sideways */ - fast_vec_sub(target_to_camera_offset, (float *)&MOBY(camera_moby)->update_dist, (float *)target); + fast_vec_sub( + target_to_camera_offset, (float *)&MOBY(camera_moby)->update_dist, (float *)target); length = fast_vec_dot(target_to_camera_offset, track + 0x30); fast_vec_scale(part, track + 0x30, length); fast_vec_sub(target_to_camera_offset, target_to_camera_offset, part); @@ -597,14 +598,14 @@ void reset_follow_camera_state_from_position(char *camera_moby) { /* Initialises the type-0 camera: fills its data blocks and seeds the first position. */ typedef struct CamE { - short height_state_timer; /* 0x00 */ - short h2; /* 0x02 */ - float f4; /* 0x04 */ - float f8; /* 0x08 */ - int iC; /* 0x0C */ - int i10; /* 0x10 */ - int i14; /* 0x14 */ - int i18; /* 0x18 */ + short height_state_timer; /* 0x00 */ + short h2; /* 0x02 */ + float f4; /* 0x04 */ + float f8; /* 0x08 */ + int iC; /* 0x0C */ + int i10; /* 0x10 */ + int i14; /* 0x14 */ + int i18; /* 0x18 */ int pad1C; } CamE; @@ -613,38 +614,38 @@ typedef struct CamA { char pad10[0x40]; float orbit_origin_position[4]; /* 0x50 */ char pad60[0x50]; - float fB0; /* 0xB0 */ - int requested_target_height; /* 0xB4 */ - float fB8; /* 0xB8 */ + float fB0; /* 0xB0 */ + int requested_target_height; /* 0xB4 */ + float fB8; /* 0xB8 */ int target_height_interpolation_state; /* 0xBC */ - int followed_moby; /* 0xC0 */ - unsigned char bC4; /* 0xC4 */ + int followed_moby; /* 0xC0 */ + unsigned char bC4; /* 0xC4 */ char padC5; short hC6; /* 0xC6 */ char padC8[0xE]; unsigned char bD6; /* 0xD6 */ char padD7; - short hD8; /* 0xD8 */ + short hD8; /* 0xD8 */ short target_height_override_requested; /* 0xDA */ - float fDC; /* 0xDC */ - float fE0; /* 0xE0 */ - float fE4; /* 0xE4 */ - float fE8; /* 0xE8 */ + float fDC; /* 0xDC */ + float fE0; /* 0xE0 */ + float fE4; /* 0xE4 */ + float fE8; /* 0xE8 */ char padEC[4]; } CamA; typedef struct CamB { - float v0[4]; /* 0x00 */ - float v10[4]; /* 0x10 */ - int i20; /* 0x20 */ - int i24; /* 0x24 */ - int i28; /* 0x28 */ - float target_orbit_distance; /* 0x2C */ - float f30; /* 0x30 */ - int i34; /* 0x34 */ - int i38; /* 0x38 */ - short orbit_distance_override_pending; /* 0x3C */ - short orbit_height_override_pending; /* 0x3E */ + float v0[4]; /* 0x00 */ + float v10[4]; /* 0x10 */ + int i20; /* 0x20 */ + int i24; /* 0x24 */ + int i28; /* 0x28 */ + float target_orbit_distance; /* 0x2C */ + float f30; /* 0x30 */ + int i34; /* 0x34 */ + int i38; /* 0x38 */ + short orbit_distance_override_pending; /* 0x3C */ + short orbit_height_override_pending; /* 0x3E */ char pad40[4]; int orbit_distance_interpolation_state; /* 0x44 */ float f48; /* 0x48 */ @@ -679,18 +680,18 @@ typedef struct Cam1A8 { typedef struct CamG { char pad0[0x10]; - float v10[4]; /* 0x10 */ - float v20[4]; /* 0x20 */ - float f30; /* 0x30 */ - short h34; /* 0x34 */ - short h36; /* 0x36 */ - short orbit_endpoint_collision_direction_class; /* 0x38 */ - short force_orbit_retraction_decay; /* 0x3A */ - float f3C; /* 0x3C */ - float f40; /* 0x40 */ - float f44; /* 0x44 */ - int i48; /* 0x48 */ - int consecutive_camera_obstruction_frames; /* 0x4C */ + float v10[4]; /* 0x10 */ + float v20[4]; /* 0x20 */ + float f30; /* 0x30 */ + short h34; /* 0x34 */ + short h36; /* 0x36 */ + short orbit_endpoint_collision_direction_class; /* 0x38 */ + short force_orbit_retraction_decay; /* 0x3A */ + float f3C; /* 0x3C */ + float f40; /* 0x40 */ + float f44; /* 0x44 */ + int i48; /* 0x48 */ + int consecutive_camera_obstruction_frames; /* 0x4C */ } CamG; typedef struct Cam220 { diff --git a/src/overlays/shared/camera/follow_camera_springs.c b/src/overlays/shared/camera/follow_camera_springs.c index 093ad24e77..13dce08966 100644 --- a/src/overlays/shared/camera/follow_camera_springs.c +++ b/src/overlays/shared/camera/follow_camera_springs.c @@ -1346,7 +1346,8 @@ void follow_camera_transition(O002e5730 *camera, void *input_offset) { x = follow_camera_position_default_stiffness_gp; y = follow_camera_position_default_damping_gp; } - interpolate_follow_camera_position(camera, attach_state->smoothed_target_position_storage, &target_position, x, y, 0.0f); + interpolate_follow_camera_position( + camera, attach_state->smoothed_target_position_storage, &target_position, x, y, 0.0f); } /* Updates the follow camera: eases its focus and offset vectors, then places diff --git a/src/overlays/shared/camera/grindrail_camera.c b/src/overlays/shared/camera/grindrail_camera.c index 5e6855cbbe..2285d35ebe 100644 --- a/src/overlays/shared/camera/grindrail_camera.c +++ b/src/overlays/shared/camera/grindrail_camera.c @@ -407,7 +407,8 @@ void update_camera_position_and_orientation_from_paths(Cam *camera_to_update) { lead = pathB->nodes[j].x; } hero_path_range_start_segment = truncate_float_to_s32(pathB->nodes[j].w); - hero_path_segment_count = ((Hero *)(((char *)((char *)&hero))))->rail_segment - hero_path_range_start_segment; + hero_path_segment_count = + ((Hero *)(((char *)((char *)&hero))))->rail_segment - hero_path_range_start_segment; if (hero_path_segment_count < 0) { hero_path_segment_count += pathD->n; } diff --git a/src/overlays/shared/camera/orbit_camera.c b/src/overlays/shared/camera/orbit_camera.c index 390d874683..e1ee51772f 100644 --- a/src/overlays/shared/camera/orbit_camera.c +++ b/src/overlays/shared/camera/orbit_camera.c @@ -363,6 +363,7 @@ void initialize_orbit_camera_from_hero(O002ebb00 *camera_object) { qcopy(camera_state + 0x80, raised_hero_position); zero_five_words(camera_state + 0x14); *(f32 *)(camera_state + 0x1C) = 4.64f; - copy_five_floats_with_rotation_offset(camera_object->orbit_parameters, camera_state + 0x14, 0.0f); + copy_five_floats_with_rotation_offset( + camera_object->orbit_parameters, camera_state + 0x14, 0.0f); initialize_orbit_camera_state(camera_object); } diff --git a/src/overlays/shared/camera/path_flythrough_camera.c b/src/overlays/shared/camera/path_flythrough_camera.c index fb1b09392d..e874ad0374 100644 --- a/src/overlays/shared/camera/path_flythrough_camera.c +++ b/src/overlays/shared/camera/path_flythrough_camera.c @@ -242,7 +242,8 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { orientation_vector[1] = ofs[1]; orientation_vector[2] = ofs[2]; orientation_vector[3] = 0.0f; - transform_vector_by_basis(orientation_vector, orientation_vector, l10_path_camera_anchor_offset_basis); + transform_vector_by_basis( + orientation_vector, orientation_vector, l10_path_camera_anchor_offset_basis); fast_vec_add(point, &anchor->pos, orientation_vector); fast_vec_sub(initial_aim_or_previous_position, point, &cam->pos); } else { diff --git a/src/overlays/shared/camera/swing_volume_camera.c b/src/overlays/shared/camera/swing_volume_camera.c index ff2d8ff1f7..4bfa206ee6 100644 --- a/src/overlays/shared/camera/swing_volume_camera.c +++ b/src/overlays/shared/camera/swing_volume_camera.c @@ -12,7 +12,9 @@ #include "rnc/overlay/shared/camera/swing_volume_camera.h" #include "rnc/overlay/shared/camera.h" #include "rnc/overlay/shared/camera/follow_camera_set_up_spring.h" + void set_follow_camera_angle_parameter(float) __asm__("FUN_L00_002e8540"); + #include "rnc/overlay/shared/rendering/culling/test_point_in_transformed_unit_cylinder.h" #include "rnc/rendering/clip_volume.h" diff --git a/src/overlays/shared/camera/target_tracking_camera.c b/src/overlays/shared/camera/target_tracking_camera.c index 3e9cf8e83f..8b179cd641 100644 --- a/src/overlays/shared/camera/target_tracking_camera.c +++ b/src/overlays/shared/camera/target_tracking_camera.c @@ -224,8 +224,12 @@ void update_target_tracking_camera_position(char *camera_object) { } if (chosen != 0) { fast_vec_sub(position_delta, chosen + 0x10, current_target + 0x10); - *angle = rope_spring_turn( - turn, *angle, fast_arc_tan(position_delta[0], position_delta[1]), 0.00125f, 0.175f, 0.0f); + *angle = rope_spring_turn(turn, + *angle, + fast_arc_tan(position_delta[0], position_delta[1]), + 0.00125f, + 0.175f, + 0.0f); } else if (*(int *)(follow + 0x40) == 1) *angle = rope_spring_turn(turn, *angle, diff --git a/src/overlays/shared/enemies/bolt_thief_mine.c b/src/overlays/shared/enemies/bolt_thief_mine.c index 3a4d4d3234..a1b6b60c22 100644 --- a/src/overlays/shared/enemies/bolt_thief_mine.c +++ b/src/overlays/shared/enemies/bolt_thief_mine.c @@ -125,7 +125,8 @@ void bolt_thief_mine_update(struct Moby *moby) { scratch.info.look_height = 7; scratch.info.unk3B = 0xFF; resolve_moby_hit_response(moby, hit, &scratch.info, 0, &hit_status, 0, 0, 4); - if ((hit_status >= MINE_DETONATION_HIT_STATUS_MIN && hit != 0 && hit->moby->oclass != 0x283) || + if ((hit_status >= MINE_DETONATION_HIT_STATUS_MIN && hit != 0 && + hit->moby->oclass != 0x283) || hero.coll_hit_moby == (u8 *)moby) { clear_u64_value(explosion_vector); allocate_voice_for_target_entry(0, 0, moby); diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index 24e5401282..b515bcd2a4 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -488,7 +488,8 @@ void frog_update(unsigned char *moby) { fast_vec_normalize(B, moby + 0xC0, frog_instance_vars->movement_speed * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, B, 1, 0.3f, 0.3f); } - if (frog_instance_vars->pursuit_target_mode != FROG_TARGET_MODE_NO_PURSUIT_TARGET && random_integer_below(9) == 0) { + if (frog_instance_vars->pursuit_target_mode != FROG_TARGET_MODE_NO_PURSUIT_TARGET && + random_integer_below(9) == 0) { frog_instance_vars->turn_angle = random_float_between(-frog_instance_vars->turn_range_degrees, frog_instance_vars->turn_range_degrees) * diff --git a/src/overlays/shared/enemies/gadgebot.c b/src/overlays/shared/enemies/gadgebot.c index 931c952072..0ea69f5a85 100644 --- a/src/overlays/shared/enemies/gadgebot.c +++ b/src/overlays/shared/enemies/gadgebot.c @@ -1586,7 +1586,8 @@ int process_gadgebot_interactions(char *moby, int flag) { if (list_id != -1) { get_first_moby_in_group(&iter.list, list_id, 0, 0); while (iter.list != 0) { - if (process_gadgebot_interaction_candidate(moby, gadgebot_private_vars, iter.list, flag, &iter.out)) + if (process_gadgebot_interaction_candidate( + moby, gadgebot_private_vars, iter.list, flag, &iter.out)) return iter.out; get_next_moby_in_group(&iter.list, iter.list, 0, 0); } diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index 86992f0988..b4225816b9 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -337,7 +337,8 @@ void large_amoeboid_update(unsigned char *moby) { large_amoeboid_vars->path_heading_offset = random_float_between(-0.34906584f, 0.34906584f); } else { - large_amoeboid_vars->target_selection_status = AMOEBOID_TARGET_STATUS_UNAVAILABLE; + large_amoeboid_vars->target_selection_status = + AMOEBOID_TARGET_STATUS_UNAVAILABLE; } } } diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index fff0d37ba8..c2c2844366 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -503,7 +503,8 @@ void plasmabot_update(char *moby) { } case PLASMABOT_WAIT_TO_START_PATH_TRAVERSAL: { float *path; - if (plasmabot_update_private_vars->target_selection_status == PLASMABOT_TARGET_STATUS_REJECTED) + if (plasmabot_update_private_vars->target_selection_status == + PLASMABOT_TARGET_STATUS_REJECTED) return; if (fast_dec_timer_s16(&plasmabot_update_private_vars->path_traversal_delay_timer) == 0) return; @@ -582,7 +583,8 @@ void plasmabot_update(char *moby) { k, k, frame_time * 6.2831855f); - if (plasmabot_update_private_vars->target_selection_status == PLASMABOT_TARGET_STATUS_REJECTED) + if (plasmabot_update_private_vars->target_selection_status == + PLASMABOT_TARGET_STATUS_REJECTED) break; if (fast_dec_timer_s16(&plasmabot_update_private_vars->path_traversal_delay_timer) == 0) break; @@ -637,7 +639,8 @@ void plasmabot_update(char *moby) { frame_time * 6.2831855f); aim = update_plasmabot_aim_quaternion(moby, 0, MOBY(moby)->rot.z); update_plasmabot_aim_joint_rotation(moby, ang); - if (plasmabot_update_private_vars->target_selection_status == PLASMABOT_TARGET_STATUS_REJECTED) { + if (plasmabot_update_private_vars->target_selection_status == + PLASMABOT_TARGET_STATUS_REJECTED) { if (plasmabot_update_private_vars->path_index == -1) break; ((unsigned char *)moby)[0x20] = 8; @@ -816,7 +819,8 @@ void plasmabot_update(char *moby) { FUN_L00_0024f7c8(moby, 2, bone_transform_scratch); spawn_plasmabot_death_debris(moby, (char *)bone_transform_scratch); unused_debris_spawn_input = 0; - ((void (*)(char *, int *, int))spawn_path_or_ballistic_debris)(moby, &unused_debris_spawn_input, 1); + ((void (*)(char *, int *, int))spawn_path_or_ballistic_debris)( + moby, &unused_debris_spawn_input, 1); release_beam_slot_by_id(moby); call_D678(moby); return; @@ -1287,7 +1291,9 @@ float update_plasmabot_aim_quaternion(char *moby, int flag, float target_angle) yaw_easing_coefficient, frame_time * 6.2831854820251465f); } - build_axis_rotation_quaternion(&plasmabot_aim_private_vars->aim_quaternion_storage, 2, plasmabot_aim_private_vars->aim_yaw_offset); + build_axis_rotation_quaternion(&plasmabot_aim_private_vars->aim_quaternion_storage, + 2, + plasmabot_aim_private_vars->aim_yaw_offset); if (flag) { float owner_aim_position[4]; float owner_aim_offset[4]; @@ -1311,8 +1317,11 @@ float update_plasmabot_aim_quaternion(char *moby, int flag, float target_angle) frame_time_sq * 12.566370964050293f, frame_time * 6.2831854820251465f); cp = pitch_quaternion; - build_axis_rotation_quaternion(cp, 1, *(float *)&plasmabot_aim_private_vars->aim_pitch_angle); - multiply_quaternions(&plasmabot_aim_private_vars->aim_quaternion_storage, &plasmabot_aim_private_vars->aim_quaternion_storage, cp); + build_axis_rotation_quaternion( + cp, 1, *(float *)&plasmabot_aim_private_vars->aim_pitch_angle); + multiply_quaternions(&plasmabot_aim_private_vars->aim_quaternion_storage, + &plasmabot_aim_private_vars->aim_quaternion_storage, + cp); } return fast_difference_between_rotations(turn, plasmabot_aim_private_vars->aim_yaw_offset); } diff --git a/src/overlays/shared/enemies/sand_mouse.c b/src/overlays/shared/enemies/sand_mouse.c index e5e6191263..a6406acd30 100644 --- a/src/overlays/shared/enemies/sand_mouse.c +++ b/src/overlays/shared/enemies/sand_mouse.c @@ -341,7 +341,8 @@ void update_sand_mouse_targeted_spawning(char *moby, char *sand_mouse_instance_v moby, &spawn_position, aim_yaw, aim_pitch, initial_yaw, initial_pitch); *(short *)(sand_mouse_instance_vars + 0x4E) = scale_game_frames(sand_mouse_projectile_spawn_interval_frames_gp); - *(int *)(sand_mouse_instance_vars + 0x64) = *(int *)(sand_mouse_instance_vars + 0x64) + 1; + *(int *)(sand_mouse_instance_vars + 0x64) = + *(int *)(sand_mouse_instance_vars + 0x64) + 1; } } } @@ -539,7 +540,8 @@ void sand_mouse_update(struct Moby *moby) { ((float *)&((struct Moby *)ents)[sand_mouse_vars->parent].pos)); moby->pos.z = moby->pos.z + 0.02f; if (l01_save_state.cleared[(short)(moby_save_id = moby->save_id)] != 0 || - (*(int *)((char *)D_0014C190_257218 + (((short)moby_save_id >> 5) * 4 + (D_0015ED84 << 8))) >> + (*(int *)((char *)D_0014C190_257218 + + (((short)moby_save_id >> 5) * 4 + (D_0015ED84 << 8))) >> (moby_save_id & 0x1F)) & 1) { debug_print(sand_mouse_already_completed_message); diff --git a/src/overlays/shared/enemies/sandmouse.c b/src/overlays/shared/enemies/sandmouse.c index 633a56440e..78d47bb7cd 100644 --- a/src/overlays/shared/enemies/sandmouse.c +++ b/src/overlays/shared/enemies/sandmouse.c @@ -864,7 +864,7 @@ void sandmouse_update(Moby *sandmouse_moby) { life = FUN_L00_00257b90(*(int *)&sandmouse_fade_particle_min_lifetime_gp, *(int *)&sandmouse_fade_particle_max_lifetime_gp); fade_particle_size = random_float_between(*(f32 *)&sandmouse_fade_particle_min_size_gp, - *(f32 *)&sandmouse_fade_particle_max_size_gp); + *(f32 *)&sandmouse_fade_particle_max_size_gp); FUN_L00_00272060(&pos, life, fade_particle_size, diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index ebddcbd3d0..08461369b0 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -235,7 +235,8 @@ void scoutbot_update(Moby *moby) { scoutbot_instance_vars->b29 = 0; break; case SCOUTBOT_STATE_IDLE: - if (scoutbot_instance_vars->path_target_selection_status != SCOUTBOT_TARGET_SELECTION_UNAVAILABLE) { + if (scoutbot_instance_vars->path_target_selection_status != + SCOUTBOT_TARGET_SELECTION_UNAVAILABLE) { scoutbot_instance_vars->ground_hover_height_offset = 0.0f; scoutbot_instance_vars->hover_bob_amplitude = 0.1f; if (moby->prev_seq != 2) { @@ -249,7 +250,9 @@ void scoutbot_update(Moby *moby) { wander_or_effect_vector[0] = fast_cos(heading) * radius; wander_or_effect_vector[1] = fast_sin(heading) * radius; wander_or_effect_vector[2] = 0.0f; - fast_vec_add(scoutbot_instance_vars->wander_goal, scoutbot_instance_vars->home, wander_or_effect_vector); + fast_vec_add(scoutbot_instance_vars->wander_goal, + scoutbot_instance_vars->home, + wander_or_effect_vector); if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, 6); } @@ -344,8 +347,12 @@ void scoutbot_update(Moby *moby) { wander_or_effect_vector[2] = 0.0f; qcopy(shot_pos, target_pos); shot_pos[2] += 0.75f; - spawn_nearby_effect( - scoutbot_instance_vars->current_target, moby, 1, shot_pos, wander_or_effect_vector, 1.0f); + spawn_nearby_effect(scoutbot_instance_vars->current_target, + moby, + 1, + shot_pos, + wander_or_effect_vector, + 1.0f); } scoutbot_instance_vars->ground_hover_height_offset = 4.0f; scoutbot_instance_vars->hover_bob_amplitude = 0.5f; diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index 7506c34318..43709136e1 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -1401,11 +1401,13 @@ int find_sentrybot_attention_target(char *moby) { MOBY(moby)->rot.z, fast_arc_tan(MOBY(candidate_moby)->pos.x - MOBY(moby)->pos.x, MOBY(candidate_moby)->pos.y - MOBY(moby)->pos.y)); - unsigned char candidate_state = ((char *)((candidate_moby_index << 8) + (int)l15_moby_array))[0x20]; + unsigned char candidate_state = + ((char *)((candidate_moby_index << 8) + (int)l15_moby_array))[0x20]; if (candidate_state == 7 || candidate_state == 0xF) moby_data->priority_attention_active = 1; if (moby_data->priority_attention_active != 0 || f < 1.2217305f) { - qcopy(candidate_line_endpoint, (char *)((candidate_moby_index << 8) + (int)l15_moby_array) + 0x10); + qcopy(candidate_line_endpoint, + (char *)((candidate_moby_index << 8) + (int)l15_moby_array) + 0x10); line_start[2] += 1.0f; if (collision_line(line_start, candidate_line_endpoint, 2, 0, 0) == 0) { float candidate_line_distance = diff --git a/src/overlays/shared/enemies/walker_update_gait.c b/src/overlays/shared/enemies/walker_update_gait.c index 4c60a67555..f1f6347722 100644 --- a/src/overlays/shared/enemies/walker_update_gait.c +++ b/src/overlays/shared/enemies/walker_update_gait.c @@ -408,7 +408,8 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL; + gait_data->gait_state = + WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL; } else { int bl = truncate_float_to_s32( gait_data->anim[4]->alternate_transition_position_span * 0.25f / @@ -504,7 +505,8 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) < gait_data->terrain_transition_height_scale * 0.75f) { - gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK; + gait_data->gait_state = + WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK; } else { int bl = truncate_float_to_s32( gait_data->anim[3]->alternate_transition_position_span * 0.25f / @@ -543,7 +545,8 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL; + gait_data->gait_state = + WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL; } else { int bl = truncate_float_to_s32( gait_data->anim[4]->alternate_transition_position_span * 0.25f / @@ -597,7 +600,8 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK; + gait_data->gait_state = + WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK; } } break; @@ -760,7 +764,8 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->ground_probe_correction_angle) > -gait_data->terrain_transition_height_scale * 0.75f) { - gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK; + gait_data->gait_state = + WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK; } else { int bl = truncate_float_to_s32( gait_data->anim[6]->alternate_transition_position_span * 0.25f / @@ -835,7 +840,8 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK; + gait_data->gait_state = + WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK; } else { int bl = truncate_float_to_s32( gait_data->anim[5]->alternate_transition_position_span * 0.25f / @@ -852,7 +858,8 @@ void walker_update_gait(WalkMoby *walker_moby, walker_moby->pClass->seqs[a->id], (float)fr); blend_moby_animation(walker_moby, a->id, f, bl); reset_walker_gait_helpers((char *)gait_data); - gait_data->gait_state = WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK; + gait_data->gait_state = + WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK; } } break; diff --git a/src/overlays/shared/game/run_level_main_loop.c b/src/overlays/shared/game/run_level_main_loop.c index d05d57c6bf..2af8d0bdc9 100644 --- a/src/overlays/shared/game/run_level_main_loop.c +++ b/src/overlays/shared/game/run_level_main_loop.c @@ -454,7 +454,8 @@ void initialize_level_map_archive(void) { archive = archive_base; first_size = archive[1] - archive[0]; map_archive_state->first_data = hud_heap_alloc(first_size, 0, (char *)heap_tag, 0x2DB); - fast_mem_copy((void *)map_archive_state->first_data, (char *)archive + archive[0], first_size); + fast_mem_copy( + (void *)map_archive_state->first_data, (char *)archive + archive[0], first_size); map_archive_state->first_data += 8; map_archive_state->second_data = map_archive_state->first_data; second_size = archive[2] - archive[1]; diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index d08913f53e..e41b91f61d 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -164,7 +164,8 @@ int get_hero_easing_moby_by_kind(int ease_kind) { enum { HERO_EASE_KIND_ON_FOOT_HERO_MOBY = 0 }; - if (ease_kind == HERO_EASE_KIND_ON_FOOT_HERO_MOBY || ease_kind == 2 || ease_kind == 3 || ease_kind == 4) { + if (ease_kind == HERO_EASE_KIND_ON_FOOT_HERO_MOBY || ease_kind == 2 || ease_kind == 3 || + ease_kind == 4) { return D_001413D0[0]; } if (ease_kind == HERO_EASE_KIND_SLOT_THREE_SECONDARY_MOBY) { @@ -1094,7 +1095,8 @@ void check_hero_item_reward_conditions(void) __asm__("FUN_L00_0 void check_hero_item_reward_conditions(void) { s32 i, qualifying_item_count; - if (help_records.special_state_item_help_request_gate == 0 && item_available[4] != 0 && hero_is_in_special_state() != 0) { + if (help_records.special_state_item_help_request_gate == 0 && item_available[4] != 0 && + hero_is_in_special_state() != 0) { help_request(0x4E2E, 0x78); } if (D_L00_0015F5CC_00206cf8 <= 0) @@ -3071,7 +3073,8 @@ void update_hero_target_tracking(void) { struct HeroEase *manipulator_table; float yaw_delta, pitch, s; int control_mode = *(int *)(hero_control_mode_owner + 0x208C); - if (control_mode != 1 && control_mode != 4 && control_mode != 2 && control_mode != 7 && control_mode != 0) { + if (control_mode != 1 && control_mode != 4 && control_mode != 2 && control_mode != 7 && + control_mode != 0) { *(int *)(hero_control_mode_owner + 0x2274) = 0; return; } @@ -3765,8 +3768,10 @@ void check_ledge_grab(void) { for (ledge_normal_offset = 0.0f; ledge_normal_offset < max; ledge_normal_offset += step) { qcopy(edge_end, ledge); edge_end[2] = ledge[2]; - edge_end[0] += fast_cos(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; - edge_end[1] += fast_sin(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; + edge_end[0] += + fast_cos(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; + edge_end[1] += + fast_sin(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; qcopy(edge_start, edge_end); edge_end[2] += 0.5f; edge_start[2] -= 0.5f; @@ -3776,8 +3781,10 @@ void check_ledge_grab(void) { ledge_normal_offset = step * 0.5f; ledge_normal_offset = -ledge_normal_offset; grab_point[2] = ledge[2]; - grab_point[0] += fast_cos(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; - grab_point[1] += fast_sin(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; + grab_point[0] += + fast_cos(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; + grab_point[1] += + fast_sin(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * ledge_normal_offset; qcopy(((Hero *)D_0013F450_20C568)->ledge_hang_pos.f, grab_point); ((Hero *)D_0013F450_20C568)->ledge_hang_pos.f[0] += fast_cos(((Hero *)D_0013F450_20C568)->ledge_normal_yaw) * back; diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index ec2f6ba028..cca2bfa368 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3209,8 +3209,8 @@ void update_hero_water_height_and_bobbing(void) { enum { WATER_HEIGHT_CONTROL_ALTERNATE_TARGET = 0x16 }; - if (G.hero_state_elapsed_frames > scale_game_frames(10) || G.water_bob_offset < 0.0f || G.i2094 == 0x11 || - G.i20A0 == 0x11) { + if (G.hero_state_elapsed_frames > scale_game_frames(10) || G.water_bob_offset < 0.0f || + G.i2094 == 0x11 || G.i20A0 == 0x11) { if (G.i2084 == 0x36) { vendor_spring(&G.water_bob_offset, &G.water_bob_spring_velocity, @@ -3386,7 +3386,8 @@ int process_hero_equipped_item_input(void) { switch (D_0013F450_h228770.equipped_slot_item_id) { case ITEM_WRENCH: if (D_0013F450_h228770.hero_control_mode < 2U || - (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.jump_ground_item_input_enabled != 0)) { + (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && + D_0013F450_h228770.jump_ground_item_input_enabled != 0)) { Moby_227fa0 *equipped_item_moby; if (D_0013F450_h228770.wrench_combo_throw_input_lockout != 0) { @@ -3429,10 +3430,13 @@ int process_hero_equipped_item_input(void) { D_0013F450_h228770.hero_current_state == HERO_STATE_RUN_JUMP || D_0013F450_h228770.hero_current_state == HERO_STATE_LAND || D_0013F450_h228770.hero_current_state == HERO_STATE_FALL || - (D_0013F450_h228770.hero_current_state == HERO_STATE_DOUBLE_JUMP && D_0013F450_h228770.hero_animation_frame > 32.0f) || - (D_0013F450_h228770.hero_current_state == HERO_STATE_HIGH_JUMP && D_0013F450_h228770.high_jump_stick_direction != 3 && + (D_0013F450_h228770.hero_current_state == HERO_STATE_DOUBLE_JUMP && + D_0013F450_h228770.hero_animation_frame > 32.0f) || + (D_0013F450_h228770.hero_current_state == HERO_STATE_HIGH_JUMP && + D_0013F450_h228770.high_jump_stick_direction != 3 && D_0013F450_h228770.hero_animation_frame > 18.0f) || - (D_0013F450_h228770.hero_current_state == HERO_STATE_HIGH_JUMP && D_0013F450_h228770.high_jump_stick_direction == 3 && + (D_0013F450_h228770.hero_current_state == HERO_STATE_HIGH_JUMP && + D_0013F450_h228770.high_jump_stick_direction == 3 && D_0013F450_h228770.hero_animation_frame > 20.0f) || D_0013F450_h228770.hero_current_state == HERO_STATE_ITEM_RELEASE_FALL || D_0013F450_h228770.hero_current_state == HERO_STATE_REPEATABLE_JUMP) { @@ -3464,15 +3468,17 @@ int process_hero_equipped_item_input(void) { } } if (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_MELEE_ATTACK) { - HeroTableRow2C *wrench_attack_record = &attack_records[D_0013F450_h228770.active_attack_record_index]; - int t; + HeroTableRow2C *wrench_attack_record = + &attack_records[D_0013F450_h228770.active_attack_record_index]; + int t; if (D_0013F450_h228770.hero_current_state == HERO_STATE_CROUCH_SWING) { if (D_0013F450_h228770.current_state_elapsed_frames > scale_game_frames(0x1E)) { if (D_0013F450_h228770.wrench_combo_input_lockout != 0) { break; } - if (D_0013F450_h228770.hero_animation_frame >= (float)wrench_attack_record->f10 && + if (D_0013F450_h228770.hero_animation_frame >= + (float)wrench_attack_record->f10 && (controller_state.held & 0xA) && pad_pressed_within(mask, scale_game_frames(0xF), 0)) { hero_set_state(0x15, 1); @@ -3486,7 +3492,9 @@ int process_hero_equipped_item_input(void) { if (!(D_0013F450_h228770.hero_animation_frame >= (float)wrench_attack_record->f10)) { break; } - t = (truncate_float_to_s32(D_0013F450_h228770.hero_animation_frame) - wrench_attack_record->fC) * 2; + t = (truncate_float_to_s32(D_0013F450_h228770.hero_animation_frame) - + wrench_attack_record->fC) * + 2; if (t <= 0) { t = 1; } @@ -3628,8 +3636,11 @@ int process_hero_equipped_item_input(void) { D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_LAND || D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GRIND || - (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.jump_weapon_input_enabled != 0) || - (D_0013F450_h228770.hero_current_state == HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL && D_0013F450_h228770.hero_animation_frame > 25.0f)) { + (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && + D_0013F450_h228770.jump_weapon_input_enabled != 0) || + (D_0013F450_h228770.hero_current_state == + HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL && + D_0013F450_h228770.hero_animation_frame > 25.0f)) { int t; int n; @@ -3661,7 +3672,8 @@ int process_hero_equipped_item_input(void) { break; case 18: if (D_0013F450_h228770.hero_control_mode < 2U || - (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && D_0013F450_h228770.jump_ground_item_input_enabled != 0)) { + (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && + D_0013F450_h228770.jump_ground_item_input_enabled != 0)) { if (D_0013F450_h228770.hero_current_state != HERO_STATE_LOOK) { int t = scale_game_frames(0xA); int n = D_0013F450_h228770.f10B0; @@ -3687,7 +3699,9 @@ int process_hero_equipped_item_input(void) { break; } if (D_0013F450_h228770.current_state_elapsed_frames == start) { - if (hero_slot_item_id(3) == 3 && D_0013F450_h228770.hero_current_state != HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT && + if (hero_slot_item_id(3) == 3 && + D_0013F450_h228770.hero_current_state != + HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT && (D_0013F450_h228770.f308 == 0 || item_available[0x1C] == 0) && D_0013F450_h228770.repeat_press_action_lockout == 0) { f_fun_001f9740_227fa0(&hero_repeat_press_window_frames); @@ -3702,11 +3716,14 @@ int process_hero_equipped_item_input(void) { } } } - if ((controller_state.pressed & 8) && D_0013F450_h228770.hero_current_state != HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT) { + if ((controller_state.pressed & 8) && + D_0013F450_h228770.hero_current_state != + HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT) { hero_repeat_press_window_frames = scale_game_frames(0x1E); } } else if (D_0013F450_h228770.hero_current_state != HERO_STATE_WRENCH_COMBO && - D_0013F450_h228770.hero_current_state != HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT && + D_0013F450_h228770.hero_current_state != + HERO_STATE_DELAYED_JUMP_OR_R1_REPEAT_EXIT_WAIT && D_0013F450_h228770.hero_current_state != HERO_STATE_CROUCH_SWING && D_0013F450_h228770.hero_current_state != HERO_STATE_HURT) { D_0013F450_h228770.repeat_press_action_latch = 0; diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index af1d99f348..1e83273f98 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -3292,7 +3292,12 @@ void clip_negative_segment_endpoint_xyz(Vec4_002126b8 *, void *) __asm__("FUN_L0 void hero_get_collision_ray_endpoints(Vec4_002126b8 *, Vec4_002126b8 *, int, float, float) __asm__("FUN_L00_002126b8"); void hero_get_collision_ray_endpoints( - Vec4_002126b8 *ray_start, Vec4_002126b8 *ray_end, int use_gravity_direction, float fa, float fb) { + Vec4_002126b8 *ray_start, + Vec4_002126b8 *ray_end, + int use_gravity_direction, + float fa, + + float fb) { Vec4_002126b8 ray_scratch_vectors[2]; if (use_gravity_direction) { char *up = (char *)&hero.gravity_dir; diff --git a/src/overlays/shared/hero/process_hero_primary_item_input.c b/src/overlays/shared/hero/process_hero_primary_item_input.c index 1a5bf07599..4e8c06dd96 100644 --- a/src/overlays/shared/hero/process_hero_primary_item_input.c +++ b/src/overlays/shared/hero/process_hero_primary_item_input.c @@ -505,8 +505,10 @@ void update_hero_movement_and_collision_probes(void) { distance = 20.0f; hit = collision_line(start, end, 2, hero.moby, 0); if (!hit || (distance = fast_vec_dist(start, D_L05_00174260), distance > 3.0f)) { - for (edge_probe_scan_offset = -0.4f; edge_probe_scan_offset < 0.5f; edge_probe_scan_offset += 0.1f) { - transform_hero_local_offset_to_world(probe, 1.1f + edge_probe_scan_offset, 0.0f, 0.0f); + for (edge_probe_scan_offset = -0.4f; edge_probe_scan_offset < 0.5f; + edge_probe_scan_offset += 0.1f) { + transform_hero_local_offset_to_world( + probe, 1.1f + edge_probe_scan_offset, 0.0f, 0.0f); if (!coll_sphere(hero.capsule_radius, probe, 2, 0)) { hero.edge_ahead = 1; if (!hit) @@ -1263,7 +1265,8 @@ void process_hero_race_object_interactions(void) { return; hoverboard_pvars = *(u8 **)(hero.hoverboard_moby + 0x78); if (*(s32 *)(hoverboard_pvars + 0x44) != -1) { - get_first_moby_in_group((void **)&boost_trigger_moby, *(s32 *)(hoverboard_pvars + 0x44), 0, 0); + get_first_moby_in_group( + (void **)&boost_trigger_moby, *(s32 *)(hoverboard_pvars + 0x44), 0, 0); if (boost_trigger_moby != 0) { do { if (*(s16 *)(boost_trigger_moby + 0xA6) == 0x473 && diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index 8c9ad331ae..e8256610f3 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -112,7 +112,10 @@ void blend_hero_slot3_mapped_animation_pair(int id, int frame_index, float blend_frames) __asm__("FUN_L00_00231e78"); -void blend_hero_slot3_mapped_animation_pair(int requested_hero_animation_id, int frame_index, float blend_frames) { +void blend_hero_slot3_mapped_animation_pair(int requested_hero_animation_id, + int frame_index, + + float blend_frames) { struct Hero *hero_slot3_mapped_animation_state = &hero; struct Hero *blk2; struct Hero *blk3; @@ -131,7 +134,8 @@ void blend_hero_slot3_mapped_animation_pair(int requested_hero_animation_id, int if (slot3_moby == 0 || slot3_secondary_moby == 0) { return; } - if (select_hero_slot3_animation_pair(requested_hero_animation_id, &seq0, &seq1) != 0 && requested_hero_animation_id != 0) { + if (select_hero_slot3_animation_pair(requested_hero_animation_id, &seq0, &seq1) != 0 && + requested_hero_animation_id != 0) { if (MOBY(slot3_moby)->prev_seq == seq0) { return; } diff --git a/src/overlays/shared/mobys/find_moby_hit.c b/src/overlays/shared/mobys/find_moby_hit.c index a85e49a245..20f72f387d 100644 --- a/src/overlays/shared/mobys/find_moby_hit.c +++ b/src/overlays/shared/mobys/find_moby_hit.c @@ -667,7 +667,7 @@ int generate_random_points_from_shape_entries( radius *= 0.0009765625f; extent = *(float *)list * (*(float *)(entity + 0x2c) * 0.0009765625f); weights[eligible_shape_entry_count] = radius * 4.187743f * radius * radius + - radius * 1.5707964f * radius * extent; + radius * 1.5707964f * radius * extent; break; } case SHAPE_ENDPOINT_SEGMENT_WITH_BALL_OFFSET: { diff --git a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c index 8d944d32f6..135f2acf5f 100644 --- a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c +++ b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c @@ -58,7 +58,8 @@ s32 test_path_segment_strict_crossing(s32 path_index, OvlVec4 *start, OvlVec4 *e current_path_point_byte_offset = 0x20; zero = 0.0f; do { - fast_vec_sub(current, (OvlVec4 *)((u8 *)*path_slot + current_path_point_byte_offset), start); + fast_vec_sub( + current, (OvlVec4 *)((u8 *)*path_slot + current_path_point_byte_offset), start); transform_vector_by_basis(current, current, &direction); if (transformed_previous_point.f[3] != zero || transformed_current_point.f[3] != zero) { if (transformed_current_point.f[1] * transformed_previous_point.f[1] < 0.0f) { @@ -292,11 +293,16 @@ s32 resolve_point_path_segment_clearance(f32 distance, do { axis_address_or_point_byte_offset = i << 4; next_point_index = i + 1; - if (((OvlVec4 *)((u8 *)segment_path + axis_address_or_point_byte_offset + 0x10))->f[3] != 0.0f || + if (((OvlVec4 *)((u8 *)segment_path + axis_address_or_point_byte_offset + 0x10)) + ->f[3] != 0.0f || segment_path->points[next_point_index].f[3] != 0.0f) { - current = (OvlVec4 *)((u8 *)segment_path + (axis_address_or_point_byte_offset + 0x10)); + current = + (OvlVec4 *)((u8 *)segment_path + (axis_address_or_point_byte_offset + 0x10)); fast_vec_sub(&difference, &working, current); - fast_vec_sub(&segment, (OvlVec4 *)((u8 *)segment_path + (axis_address_or_point_byte_offset + 0x20)), current); + fast_vec_sub( + &segment, + (OvlVec4 *)((u8 *)segment_path + (axis_address_or_point_byte_offset + 0x20)), + current); projection = fast_vec_dot(&difference, height_axis); FUN_001ff500_262030(projection, &scaled_cross, height_axis); fast_vec_sub(&difference, &difference, &scaled_cross); diff --git a/src/overlays/shared/props/bolt_crank.c b/src/overlays/shared/props/bolt_crank.c index 84048342a1..08776442b3 100644 --- a/src/overlays/shared/props/bolt_crank.c +++ b/src/overlays/shared/props/bolt_crank.c @@ -323,7 +323,8 @@ void bolt_crank_update(struct Moby *moby) { frame_scale_sq * 0.015f, frame_scale_sq * 0.3f, frame_time * 7.0f); - fast_vec_normalize(radial_correction, radial_correction, bolt_crank_radial_correction_step_gp); + fast_vec_normalize( + radial_correction, radial_correction, bolt_crank_radial_correction_step_gp); fast_vec_add(&player->motion.pos, &player->motion.pos, radial_correction); player->motion.pos.f[2] = height; if (opt_mirror_anim) { diff --git a/src/overlays/shared/props/bot_door_lock.c b/src/overlays/shared/props/bot_door_lock.c index 860bcf025b..645163c7b4 100644 --- a/src/overlays/shared/props/bot_door_lock.c +++ b/src/overlays/shared/props/bot_door_lock.c @@ -287,30 +287,62 @@ void bot_door_lock_update(char *moby) { angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); digit_layout_offset[1] = fast_sin(angle) * 0.15f; digit_layout_offset[2] = 0.0f; - add_vectors(number_position_sum, digit_layout_offset, number_anchor_position); - draw_number(digit_layout_offset, moby, idata[5] / 10 + 2, color, 0x7f, 4, 0xff, 0.5f); + add_vectors( + number_position_sum, digit_layout_offset, number_anchor_position); + draw_number(digit_layout_offset, + moby, + idata[5] / 10 + 2, + color, + 0x7f, + 4, + 0xff, + 0.5f); angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); digit_layout_offset[0] = fast_cos(angle) * -0.4f; angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); digit_layout_offset[1] = fast_sin(angle) * -0.4f; digit_layout_offset[2] = 0.0f; - add_vectors(number_position_sum, digit_layout_offset, number_anchor_position); - draw_number(digit_layout_offset, moby, idata[5] % 10 + 2, color, 0x7f, 4, 0xff, 0.5f); + add_vectors( + number_position_sum, digit_layout_offset, number_anchor_position); + draw_number(digit_layout_offset, + moby, + idata[5] % 10 + 2, + color, + 0x7f, + 4, + 0xff, + 0.5f); } else { angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); digit_layout_offset[0] = fast_cos(angle) * -0.4f; angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); digit_layout_offset[1] = fast_sin(angle) * -0.4f; digit_layout_offset[2] = 0.0f; - add_vectors(number_position_sum, digit_layout_offset, number_anchor_position); - draw_number(digit_layout_offset, moby, idata[5] / 10 + 2, color, 0x7f, 4, 0xff, 0.5f); + add_vectors( + number_position_sum, digit_layout_offset, number_anchor_position); + draw_number(digit_layout_offset, + moby, + idata[5] / 10 + 2, + color, + 0x7f, + 4, + 0xff, + 0.5f); angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); digit_layout_offset[0] = fast_cos(angle) * 0.15f; angle = fast_add_rotations(MOBY(moby)->rot.z, 1.5707964f); digit_layout_offset[1] = fast_sin(angle) * 0.15f; digit_layout_offset[2] = 0.0f; - add_vectors(number_position_sum, digit_layout_offset, number_anchor_position); - draw_number(digit_layout_offset, moby, idata[5] % 10 + 2, color, 0x7f, 4, 0xff, 0.5f); + add_vectors( + number_position_sum, digit_layout_offset, number_anchor_position); + draw_number(digit_layout_offset, + moby, + idata[5] % 10 + 2, + color, + 0x7f, + 4, + 0xff, + 0.5f); } } } diff --git a/src/overlays/shared/props/breakable_lamp.c b/src/overlays/shared/props/breakable_lamp.c index df8b765276..5d7cdb861e 100644 --- a/src/overlays/shared/props/breakable_lamp.c +++ b/src/overlays/shared/props/breakable_lamp.c @@ -209,8 +209,15 @@ void breakable_lamp_update(struct Moby *moby) { 0.003f); sign = -sign; frames = scale_game_frames(0x3C); - spawn_trail_c8e0( - &start, frames, trail_size * 0.07f, trail_size * 0.7f, 0x7F7F7F7F, 1, sign, &effect_motion, 0.003f); + spawn_trail_c8e0(&start, + frames, + trail_size * 0.07f, + trail_size * 0.7f, + 0x7F7F7F7F, + 1, + sign, + &effect_motion, + 0.003f); effect_motion.f[1] = 0.0f; effect_motion.f[0] = 0.0f; effect_motion.f[2] = random_float_between(0.01f, 0.05f) * frame_scale; diff --git a/src/overlays/shared/props/electric_beam.c b/src/overlays/shared/props/electric_beam.c index 199845d8a6..5e57d623a2 100644 --- a/src/overlays/shared/props/electric_beam.c +++ b/src/overlays/shared/props/electric_beam.c @@ -451,11 +451,13 @@ void draw_electric_beam(char *moby) { } else { qcopy(&packet[0].vertices[corner], &beam->points[point + 1]); if (corner & 1) - fast_vec_add( - &packet[0].vertices[corner], &packet[0].vertices[corner], strip_half_width_offset); + fast_vec_add(&packet[0].vertices[corner], + &packet[0].vertices[corner], + strip_half_width_offset); else - fast_vec_sub( - &packet[0].vertices[corner], &packet[0].vertices[corner], strip_half_width_offset); + fast_vec_sub(&packet[0].vertices[corner], + &packet[0].vertices[corner], + strip_half_width_offset); } /* Fakematch: 34 block notes push this loop past haifa-sched's 100-insn region limit, * so sched1 moves nothing between its blocks, as in retail. */ @@ -503,11 +505,13 @@ void draw_electric_beam(char *moby) { qcopy(&packet[0].vertices[corner], &beam->branches[branch_segment_index + 1][branch]); if (corner & 1) - fast_vec_add( - &packet[0].vertices[corner], &packet[0].vertices[corner], strip_half_width_offset); + fast_vec_add(&packet[0].vertices[corner], + &packet[0].vertices[corner], + strip_half_width_offset); else - fast_vec_sub( - &packet[0].vertices[corner], &packet[0].vertices[corner], strip_half_width_offset); + fast_vec_sub(&packet[0].vertices[corner], + &packet[0].vertices[corner], + strip_half_width_offset); } /* Fakematch: 32 block notes push this loop past haifa-sched's 100-insn region limit, * so sched1 moves nothing between its blocks, as in retail. */ diff --git a/src/overlays/shared/props/floor_button.c b/src/overlays/shared/props/floor_button.c index 6fec818591..2430a952d9 100644 --- a/src/overlays/shared/props/floor_button.c +++ b/src/overlays/shared/props/floor_button.c @@ -49,7 +49,8 @@ void floor_button_update(struct Moby *moby) { moby->pos.z -= 0.35f; save_flag_index = (s16)moby->save_id; if (l05_mission_gated_moby_save_flags.collected[save_flag_index] != 0 || - (D_0014C190_257218[current_level_index][save_flag_index >> 5] >> (moby->save_id & 31) & 1) != 0 || + (D_0014C190_257218[current_level_index][save_flag_index >> 5] >> (moby->save_id & 31) & + 1) != 0 || (floor_button_private_state[2] != 0 && D_0014C050[moby->mission + current_level_index * 16] == 0xFF)) { moby->command = 2; diff --git a/src/overlays/shared/props/garage_door.c b/src/overlays/shared/props/garage_door.c index 0371e7042d..40567e8a55 100644 --- a/src/overlays/shared/props/garage_door.c +++ b/src/overlays/shared/props/garage_door.c @@ -36,7 +36,8 @@ void garage_door_update(struct Moby *door_moby) { collection_save_id = door_moby->save_id; save_id_index = collection_save_id; if (l03_save_state.cleared[save_id_index] == 0) { - if (!((D_0014C190_257218[current_level_index_gp][save_id_index >> 5] >> (collection_save_id & 0x1F)) & + if (!((D_0014C190_257218[current_level_index_gp][save_id_index >> 5] >> + (collection_save_id & 0x1F)) & 1)) return; } diff --git a/src/overlays/shared/props/lamp.c b/src/overlays/shared/props/lamp.c index c02521ac29..54c5bd95c9 100644 --- a/src/overlays/shared/props/lamp.c +++ b/src/overlays/shared/props/lamp.c @@ -136,9 +136,9 @@ void draw_moby_wobble_quads(struct Moby *moby) { texture = get_effect_texture(wobble_quad_texture_index_gp); blend_control = (u64)(s64)wobble_quad_blend_a_selector_gp | - ((u64)(s64)wobble_quad_blend_b_selector_gp << 2) | - ((u64)(s64)wobble_quad_blend_c_selector_gp << 4) | - ((u64)(s64)wobble_quad_blend_d_selector_gp << 6) | 0x8000000000ULL; + ((u64)(s64)wobble_quad_blend_b_selector_gp << 2) | + ((u64)(s64)wobble_quad_blend_c_selector_gp << 4) | + ((u64)(s64)wobble_quad_blend_d_selector_gp << 6) | 0x8000000000ULL; quad_b.control[0] = 0; quad_b.control[2] = 0xff9000000260ULL; quad_a.control[2] = 0xff9000000260ULL; diff --git a/src/overlays/shared/props/linked_spark_emitter.c b/src/overlays/shared/props/linked_spark_emitter.c index c9f303c1f6..9d268f0f90 100644 --- a/src/overlays/shared/props/linked_spark_emitter.c +++ b/src/overlays/shared/props/linked_spark_emitter.c @@ -91,7 +91,8 @@ void linked_spark_emitter_update(unsigned char *moby) { MOBY(moby)->visible = 0; emitter_save_id = MOBY(moby)->save_id; if (l15_save_state.cleared[(short)emitter_save_id] == 0 && - (((*(int *)(D_0014C190 + (((short)emitter_save_id >> 5) * 4) + (D_0015ED84 << 8)) >> (emitter_save_id & 0x1F)) ^ + (((*(int *)(D_0014C190 + (((short)emitter_save_id >> 5) * 4) + (D_0015ED84 << 8)) >> + (emitter_save_id & 0x1F)) ^ 1) & 1)) { MOBY(moby)->state = EMIT_SPARKS; diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index 3680702f08..14112c5a7d 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -680,7 +680,8 @@ void update_moby_point_attached_particle(P_2726d8 *particle) { Q_2726d8 *q = &particle->q; u128_2726d8 position_delta; f32 save, sc, length_jitter, target_length; - if (particle->q.owner == 0 || *(s16 *)(particle->q.owner + 0xA6) != q->attached_owner_identity || + if (particle->q.owner == 0 || + *(s16 *)(particle->q.owner + 0xA6) != q->attached_owner_identity || particle->q.owner[0x20] == 0xFE || particle->q.owner[0x20] == 0xFD) { free_effect_particle(particle); return; diff --git a/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c b/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c index 1f83a86bff..8926358264 100644 --- a/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c +++ b/src/overlays/shared/ui/hud/decompress_and_relocate_selected_groups.c @@ -61,7 +61,8 @@ void decompress_and_relocate_selected_groups(int optional_bank_selection) { decompression_destination += slot_3_size; } } - if (optional_bank_selection == HUD_DECOMPRESS_OPTIONAL_BANK_3 || optional_bank_selection == HUD_DECOMPRESS_BOTH_OPTIONAL_BANKS) { + if (optional_bank_selection == HUD_DECOMPRESS_OPTIONAL_BANK_3 || + optional_bank_selection == HUD_DECOMPRESS_BOTH_OPTIONAL_BANKS) { { int slot_4_size; if ((slot_4_size = decompression_slot_state->t->sz[4])) { diff --git a/src/overlays/shared/ui/hud/hud_frame.c b/src/overlays/shared/ui/hud/hud_frame.c index 8fbb0c6020..6cacfb081a 100644 --- a/src/overlays/shared/ui/hud/hud_frame.c +++ b/src/overlays/shared/ui/hud/hud_frame.c @@ -130,7 +130,9 @@ extern G_23bac0 D_L00_0017E4D8_23bac0 __asm__("D_L00_0017E4D8") NOT_SDA; void draw_rotated_hud_sprite( int id, int x, int y, int draw_width, int draw_height, int alpha) __asm__("FUN_L00_0023bac0"); -void draw_rotated_hud_sprite(int sprite_frame_id, int x, int y, int draw_width, int draw_height, int alpha) { +void draw_rotated_hud_sprite( + + int sprite_frame_id, int x, int y, int draw_width, int draw_height, int alpha) { u64_23bac0 *packet_words; int *coordinate_offsets; G_23bac0 *sprite_render_data = &D_L00_0017E4D8_23bac0; diff --git a/src/overlays/shared/vehicles/hoverboard.c b/src/overlays/shared/vehicles/hoverboard.c index e18c131862..213bdba488 100644 --- a/src/overlays/shared/vehicles/hoverboard.c +++ b/src/overlays/shared/vehicles/hoverboard.c @@ -33,10 +33,10 @@ void hoverboard_update(unsigned char *moby) { HOVERBOARD_STATE_WAIT_FOR_PLAYER_APPROACH = 0, HOVERBOARD_STATE_WAIT_FOR_CONTROL_MODE_EXIT = 1 }; - char *hoverboard_vars = ((char *)MOBY(moby)->pvars); - float delta[4], position[4], effect_position[4], effect_sine_offset[4], second_position[4]; - float angle, distance_scale, delta_length; - int state = (u8)MOBY(moby)->state; + char *hoverboard_vars = ((char *)MOBY(moby)->pvars); + float delta[4], position[4], effect_position[4], effect_sine_offset[4], second_position[4]; + float angle, distance_scale, delta_length; + int state = (u8)MOBY(moby)->state; struct Hero *player_hero; switch (state) { diff --git a/src/overlays/shared/vehicles/ship_rocket.c b/src/overlays/shared/vehicles/ship_rocket.c index 25b57264e1..9008d1787a 100644 --- a/src/overlays/shared/vehicles/ship_rocket.c +++ b/src/overlays/shared/vehicles/ship_rocket.c @@ -74,8 +74,9 @@ void ship_rocket_update(struct Moby *moby) { random.f[2] = random_float_between(-1.0f, 1.0f); velocity.q = random.q; fast_vec_normalize(&velocity, &velocity, random_float_between(0.1f, 0.2f) * frame_time); - fast_vec_normalize( - &trail_particle_vector, &rocket_vars->step, -random_float_between(frame_time * 0.1f, frame_time)); + fast_vec_normalize(&trail_particle_vector, + &rocket_vars->step, + -random_float_between(frame_time * 0.1f, frame_time)); fast_vec_add(&velocity, &velocity, &trail_particle_vector); FUN_L00_002712b8(&moby->pos, &velocity, @@ -117,8 +118,13 @@ void ship_rocket_update(struct Moby *moby) { random.f[2] = 0.02f; transform_vector_by_basis(&random, &random, &moby->rot_row0); build_look_at_matrix(&random, &random, &moby->rot_row0, random_angle_radians()); - FUN_L00_0026cbb0( - &trail_particle_vector, &random, 0x4f007fff, 0x1fffffff, scale_game_frames(5), 1, 20000.0f); + FUN_L00_0026cbb0(&trail_particle_vector, + &random, + 0x4f007fff, + 0x1fffffff, + scale_game_frames(5), + 1, + 20000.0f); } pos = &moby->pos; target = rocket_vars->target; diff --git a/src/overlays/shared/vehicles/taxi_path.c b/src/overlays/shared/vehicles/taxi_path.c index 213ce3fe5f..299d486b67 100644 --- a/src/overlays/shared/vehicles/taxi_path.c +++ b/src/overlays/shared/vehicles/taxi_path.c @@ -82,7 +82,8 @@ char *find_moby_in_owner_list_by_id(unsigned char *list_owner_moby, int target_m pool = D_L05_0015FFD8_9598; do { candidate_moby_pool_index = *moby_index_entry & 0x7FFF; - if (*(short *)(((M_9598 *)pool)[candidate_moby_pool_index].data + 0xB4) == target_moby_data_id) + if (*(short *)(((M_9598 *)pool)[candidate_moby_pool_index].data + 0xB4) == + target_moby_data_id) goto found; } while ((short)*moby_index_entry++ >= 0); } diff --git a/src/overlays/shared/vendor/draw_vendor_purchase_text.c b/src/overlays/shared/vendor/draw_vendor_purchase_text.c index aa95c64e86..43c54b4f48 100644 --- a/src/overlays/shared/vendor/draw_vendor_purchase_text.c +++ b/src/overlays/shared/vendor/draw_vendor_purchase_text.c @@ -146,7 +146,14 @@ void pool_splash(HeightTile *tile, void pool_splash( - HeightTile *tile, int tile_count, int add_to_existing_height, float x, float z, float radius, float amount) { + HeightTile *tile, + int tile_count, + int add_to_existing_height, + float x, + float z, + float radius, + + float amount) { enum { POOL_SPLASH_KEEP_GREATER_MAGNITUDE = 0 }; diff --git a/src/overlays/shared/weapons/blaster_shot.c b/src/overlays/shared/weapons/blaster_shot.c index e0fb4a4511..b46dc87e14 100644 --- a/src/overlays/shared/weapons/blaster_shot.c +++ b/src/overlays/shared/weapons/blaster_shot.c @@ -176,7 +176,8 @@ char *spawn_homing_shot( *(int *)(homing_shot_vars + 0x14) = 0; shot_lifetime_and_spark_lifetime_max_frames = scale_game_frames(0x23); variant = item_text_variant; - shot_lifetime_and_spark_lifetime_max_frames = shot_lifetime_and_spark_lifetime_max_frames + variant[0xF] * 10; + shot_lifetime_and_spark_lifetime_max_frames = + shot_lifetime_and_spark_lifetime_max_frames + variant[0xF] * 10; *(int *)(homing_shot_vars + 0x28) = 0; *(short *)(homing_shot_vars + 0x24) = shot_lifetime_and_spark_lifetime_max_frames; *(short *)(homing_shot_vars + 0x26) = shot_lifetime_and_spark_lifetime_max_frames; @@ -205,7 +206,8 @@ char *spawn_homing_shot( spark, spark, random_float_between(D_0015ED6C * 3.0f, D_0015ED6C * 6.0f)); collision_hit_lifetime_min_and_alpha_scratch = scale_game_frames(10); shot_lifetime_and_spark_lifetime_max_frames = scale_game_frames(15); - lifetime = random_int_between(collision_hit_lifetime_min_and_alpha_scratch, shot_lifetime_and_spark_lifetime_max_frames); + lifetime = random_int_between(collision_hit_lifetime_min_and_alpha_scratch, + shot_lifetime_and_spark_lifetime_max_frames); FUN_L00_0026dd20(moby + 0x10, (char *)spark, 0x7F2F4F6F, lifetime, 30000.0f); } while (sparks >= 0); variant = item_text_variant; @@ -412,7 +414,8 @@ void homing_shot_update(Moby *shot_moby) { add_vector_xyz_2cb418( (Vec4A *)&shot_moby->pos, ((char *)D_L00_00173E60), &spark_and_pushout_scratch); if (D_001403E0_lui != 0 && D_001403E0_lui->oclass == 0xA8 && - D_001403E0_lui->state != MOBY_STATE_MARKED_FOR_REMOVAL && D_001403E0_lui->state != 0xFD) { + D_001403E0_lui->state != MOBY_STATE_MARKED_FOR_REMOVAL && + D_001403E0_lui->state != 0xFD) { allocate_voice_for_target_entry(4, 0, D_001403E0_lui); } } diff --git a/src/overlays/shared/weapons/bomb_glove.c b/src/overlays/shared/weapons/bomb_glove.c index d605c18197..9288231874 100644 --- a/src/overlays/shared/weapons/bomb_glove.c +++ b/src/overlays/shared/weapons/bomb_glove.c @@ -172,8 +172,8 @@ void bomb_glove_update(struct Moby *moby) { BOMB_GLOVE_READY = 2 }; CarrierVars_2c26c8 *bomb_glove_vars; - OvlVec4 local[4], saved, grip_local_offset, rotatedOffset, pos, target, basis[3], matrix[4]; - OvlVec4 launch; + OvlVec4 local[4], saved, grip_local_offset, rotatedOffset, pos, target, basis[3], matrix[4]; + OvlVec4 launch; union { OvlVec4 arc; } temporary; diff --git a/src/overlays/shared/weapons/decoy.c b/src/overlays/shared/weapons/decoy.c index 372e6350aa..440d5b0c0f 100644 --- a/src/overlays/shared/weapons/decoy.c +++ b/src/overlays/shared/weapons/decoy.c @@ -362,7 +362,10 @@ s32 predict_thrown_moby_landing(ThrowVars *throw_vars, struct Moby *thrown_moby, s32 mode) __asm__("FUN_L00_002c3af8"); -s32 predict_thrown_moby_landing(ThrowVars *throw_vars, struct Moby *thrown_moby, s32 linked_moby_policy) { +s32 predict_thrown_moby_landing(ThrowVars *throw_vars, + struct Moby *thrown_moby, + + s32 linked_moby_policy) { Vec4 predicted_position, predicted_velocity, position_scratch, q, ground_probe_position; s32 prediction_countdown; s32 found = 0; diff --git a/src/overlays/shared/weapons/drone.c b/src/overlays/shared/weapons/drone.c index 2499ee160d..0f858254fd 100644 --- a/src/overlays/shared/weapons/drone.c +++ b/src/overlays/shared/weapons/drone.c @@ -414,7 +414,8 @@ void drone_update(struct Moby *updated_moby) { } } } - for (exclusion_clear_index = exclusion_entry_count; exclusion_clear_index < 9; exclusion_clear_index++) + for (exclusion_clear_index = exclusion_entry_count; exclusion_clear_index < 9; + exclusion_clear_index++) ((DroneSlots *)&hero)->exclusions[exclusion_clear_index] = 0; selected_target_moby = func_L00_002CF3D8_2CF808(&hero.motion, ((DroneSlots *)&hero)->exclusions); diff --git a/src/overlays/shared/weapons/effect_slots_fire.c b/src/overlays/shared/weapons/effect_slots_fire.c index 6652705966..2a1f0b4e9f 100644 --- a/src/overlays/shared/weapons/effect_slots_fire.c +++ b/src/overlays/shared/weapons/effect_slots_fire.c @@ -115,7 +115,8 @@ void effect_slots_fire(char *slots, float *position, float *direction, float dis fl = 1; else fl = 0; - shot = spawn_spinning_and_fading_effect_particle(velocity, randomized_particle_velocity, fl, travel); + shot = spawn_spinning_and_fading_effect_particle( + velocity, randomized_particle_velocity, fl, travel); if (i == 2 && save_shot) { int j; for (j = 0; j < 7; j++) { diff --git a/src/overlays/shared/weapons/gold_devastator_missile.c b/src/overlays/shared/weapons/gold_devastator_missile.c index 160107346a..a9ceddf1fe 100644 --- a/src/overlays/shared/weapons/gold_devastator_missile.c +++ b/src/overlays/shared/weapons/gold_devastator_missile.c @@ -872,8 +872,11 @@ void gold_devastator_missile_update(M910 *missile_moby) { int particles; int particle_reduction; int i, j; - int hit = - collect_mobies_in_sphere((&missile_moby->pos), 16, missile_moby, 0, (impact_scale_multiplier + impact_scale_multiplier)); + int hit = collect_mobies_in_sphere((&missile_moby->pos), + 16, + missile_moby, + 0, + (impact_scale_multiplier + impact_scale_multiplier)); particles = 10; predicted.q = missile_moby->pos.q; FUN_L00_0025a9f8(missile_moby, @@ -922,9 +925,11 @@ void gold_devastator_missile_update(M910 *missile_moby) { transform_vector(&predicted, &surface_motion, rotation); fast_vec_normalize(&predicted, &predicted, - random_float_between(8.5f, 16.5f) * D_0015ED6C * impact_scale_multiplier); + random_float_between(8.5f, 16.5f) * D_0015ED6C * + impact_scale_multiplier); } else { - float speed = random_float_between(8.5f, 16.5f) * D_0015ED6C * impact_scale_multiplier; + float speed = + random_float_between(8.5f, 16.5f) * D_0015ED6C * impact_scale_multiplier; float a = random_angle_radians(); build_spherical_offset(&predicted, speed, a, random_angle_radians()); } @@ -964,7 +969,8 @@ void gold_devastator_missile_update(M910 *missile_moby) { fast_vec_sub(&camera_delta, D_L00_00166DC0, (&missile_moby->pos)); distance = fast_vec_length(&camera_delta); camera_delta.f[2] += distance * 0.5f; - fast_vec_normalize(&predicted, &predicted, distance / 5.0f * D_0015ED6C * impact_scale_multiplier); + fast_vec_normalize( + &predicted, &predicted, distance / 5.0f * D_0015ED6C * impact_scale_multiplier); fast_vec_normalize(&camera_delta, &camera_delta, (distance + distance) * D_0015ED6C); fast_vec_add(&predicted, &predicted, &camera_delta); clamp_vector_length(&predicted, &predicted, D_0015ED6C * 10.0f); @@ -983,8 +989,8 @@ void gold_devastator_missile_update(M910 *missile_moby) { if (reduced) j /= 2; for (i = 0; i < j; i++) { - float speed = - random_float_between(8.0f, 10.0f) * impact_scale_multiplier * D_0015ED6C - near_adjust * D_0015ED6C; + float speed = random_float_between(8.0f, 10.0f) * impact_scale_multiplier * D_0015ED6C - + near_adjust * D_0015ED6C; Colors1688 color = l00_devastator_missile_impact_color_palette; Colors1688 fade = l00_devastator_missile_impact_fade_palette; int c = @@ -1026,7 +1032,8 @@ void gold_devastator_missile_update(M910 *missile_moby) { random.f[2] = random_float_between(-1.0f, 1.0f); v.q = random.q; } - fast_vec_normalize(&v, &v, random_float_between(0.0f, 3.0f) * D_0015ED6C * impact_scale_multiplier); + fast_vec_normalize( + &v, &v, random_float_between(0.0f, 3.0f) * D_0015ED6C * impact_scale_multiplier); c = swap_packed_color_channels(color.colors[random_integer_below(6)], D_0013E520.bB); f = swap_packed_color_channels(fade.colors[random_integer_below(6)], D_0013E520.bB); debris_scale = impact_scale_multiplier * 200000.0f; diff --git a/src/overlays/shared/weapons/morphoray_chicken.c b/src/overlays/shared/weapons/morphoray_chicken.c index d8f0a8c29a..a1d503a147 100644 --- a/src/overlays/shared/weapons/morphoray_chicken.c +++ b/src/overlays/shared/weapons/morphoray_chicken.c @@ -565,8 +565,14 @@ void morphoray_chicken_update(Moby *chicken_moby) { ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * relative_scale; ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); - path_clear = move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &ahead, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); + path_clear = move_moby_xy_with_collision_constraints(chicken_moby, + &next_pos, + &ahead, + 0, + relative_scale * 0.2f, + relative_scale * 0.5f, + speed, + 0.2617994f); if (path_clear != 0 || (fast_difference_between_rotations(chicken_moby->rot.z, fast_arc_tan(next_pos.x - chicken_moby->pos.x, @@ -579,16 +585,29 @@ void morphoray_chicken_update(Moby *chicken_moby) { chicken_vars->flee_timer = random_int_between(scale_game_frames(0x3C), scale_game_frames(0xB4)); } - } else if (vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < relative_scale * 5.0f && + } else if (vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < + relative_scale * 5.0f && 0.5235988f < fast_difference_between_rotations(flee_angle, chicken_moby->rot.z)) { - move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &next_pos, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); + move_moby_xy_with_collision_constraints(chicken_moby, + &next_pos, + &next_pos, + 0, + relative_scale * 0.2f, + relative_scale * 0.5f, + speed, + 0.2617994f); chicken_moby->state = CHICKEN_STATE_TURN_AWAY_FROM_HERO; blend_moby_animation(chicken_moby, 3, 0, scale_game_frames(10)); } else { - move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &next_pos, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); + move_moby_xy_with_collision_constraints(chicken_moby, + &next_pos, + &next_pos, + 0, + relative_scale * 0.2f, + relative_scale * 0.5f, + speed, + 0.2617994f); } break; case CHICKEN_STATE_TURN_AWAY_FROM_HERO: @@ -598,8 +617,14 @@ void morphoray_chicken_update(Moby *chicken_moby) { frame_time_sq * 0.7853982f, frame_time_sq * 1.5707964f, frame_time * 0.7853982f); - move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &next_pos, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); + move_moby_xy_with_collision_constraints(chicken_moby, + &next_pos, + &next_pos, + 0, + relative_scale * 0.2f, + relative_scale * 0.5f, + speed, + 0.2617994f); if (fast_dec_timer_s16(&chicken_vars->flee_timer) != 0 && vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < relative_scale * 5.0f) { ahead.x = fast_cos(chicken_moby->rot.z) * frame_time * relative_scale; @@ -613,7 +638,8 @@ void morphoray_chicken_update(Moby *chicken_moby) { } } else if (fast_difference_between_rotations(flee_angle, chicken_moby->rot.z) < 0.08726646f || - vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) > relative_scale * 6.0f) { + vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) > + relative_scale * 6.0f) { chicken_moby->state = CHICKEN_STATE_IDLE; chicken_vars->flee_timer = random_int_between(scale_game_frames(0x3C), scale_game_frames(0xB4)); @@ -628,9 +654,16 @@ void morphoray_chicken_update(Moby *chicken_moby) { random_int_between(scale_game_frames(0x3C), scale_game_frames(0xB4)); blend_moby_animation( chicken_moby, random_integer_below(2) == 0, 0, scale_game_frames(5)); - move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &next_pos, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); - } else if (vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < relative_scale * 3.0f) { + move_moby_xy_with_collision_constraints(chicken_moby, + &next_pos, + &next_pos, + 0, + relative_scale * 0.2f, + relative_scale * 0.5f, + speed, + 0.2617994f); + } else if (vector_distance_xy(&chicken_moby->pos, &hero.motion.pos) < + relative_scale * 3.0f) { FUN_L00_00258278(chicken_moby, &chicken_vars->turn_speed, flee_angle, @@ -641,8 +674,14 @@ void morphoray_chicken_update(Moby *chicken_moby) { ahead.y = fast_sin(chicken_moby->rot.z) * (frame_time + frame_time); ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); - path_clear = move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &ahead, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); + path_clear = move_moby_xy_with_collision_constraints(chicken_moby, + &next_pos, + &ahead, + 0, + relative_scale * 0.2f, + relative_scale * 0.5f, + speed, + 0.2617994f); if (path_clear == 0 && (1.5707964f < fast_difference_between_rotations( chicken_moby->rot.z, @@ -669,8 +708,14 @@ void morphoray_chicken_update(Moby *chicken_moby) { ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * relative_scale; ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); - path_clear = move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &ahead, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); + path_clear = move_moby_xy_with_collision_constraints(chicken_moby, + &next_pos, + &ahead, + 0, + relative_scale * 0.2f, + relative_scale * 0.5f, + speed, + 0.2617994f); if (path_clear == 0 && (1.5707964f < fast_difference_between_rotations( chicken_moby->rot.z, @@ -698,8 +743,14 @@ void morphoray_chicken_update(Moby *chicken_moby) { ahead.y = fast_sin(chicken_moby->rot.z) * frame_time * relative_scale; ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); - path_clear = move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &ahead, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); + path_clear = move_moby_xy_with_collision_constraints(chicken_moby, + &next_pos, + &ahead, + 0, + relative_scale * 0.2f, + relative_scale * 0.5f, + speed, + 0.2617994f); if (path_clear == 0 && (1.5707964f < fast_difference_between_rotations( chicken_moby->rot.z, @@ -726,8 +777,14 @@ void morphoray_chicken_update(Moby *chicken_moby) { ahead.y = fast_sin(chicken_moby->rot.z) * (frame_time + frame_time) * relative_scale; ahead.z = 0.0f; fast_vec_add(&ahead, &ahead, &next_pos); - path_clear = move_moby_xy_with_collision_constraints( - chicken_moby, &next_pos, &ahead, 0, relative_scale * 0.2f, relative_scale * 0.5f, speed, 0.2617994f); + path_clear = move_moby_xy_with_collision_constraints(chicken_moby, + &next_pos, + &ahead, + 0, + relative_scale * 0.2f, + relative_scale * 0.5f, + speed, + 0.2617994f); if (path_clear == 0 && (1.5707964f < fast_difference_between_rotations( chicken_moby->rot.z, diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index df9f289c64..2d37840511 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -1791,7 +1791,8 @@ s32 process_moby_suck_cannon_suction(u8 *moby, u8 *position, u8 *target) { s16 state; if (moby_suction_record == 0) goto missing; - if (moby == 0 || MOBY(moby)->state == MOBY_STATE_REMOVAL_MARKER || MOBY(moby)->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER || + if (moby == 0 || MOBY(moby)->state == MOBY_STATE_REMOVAL_MARKER || + MOBY(moby)->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER || *(s16 *)(moby_suction_record + 0x68) == 8) goto fail; qcopy_nc(moby_suction_record, position); @@ -1863,7 +1864,8 @@ s32 store_moby_in_suck_cannon(u8 *moby, OvlQuad *position) { struct Moby *sound_source_moby; if (suction_record == 0) return 0; - if (moby != 0 && MOBY(moby)->state != MOBY_STATE_REMOVAL_MARKER && MOBY(moby)->state != MOBY_STATE_ALTERNATE_REMOVAL_MARKER && + if (moby != 0 && MOBY(moby)->state != MOBY_STATE_REMOVAL_MARKER && + MOBY(moby)->state != MOBY_STATE_ALTERNATE_REMOVAL_MARKER && *(s16 *)(suction_record + 0x68) != 8) { qcopy(&MOBY(moby)->pos, position); FUN_L00_002d9fd0_002dbb20( @@ -1900,7 +1902,8 @@ s32 launch_suck_cannon_projectile(u8 *moby, u8 *d; if (projectile_record == 0) return 0; - if (moby == 0 || MOBY(moby)->state == MOBY_STATE_REMOVAL_MARKER || MOBY(moby)->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER || + if (moby == 0 || MOBY(moby)->state == MOBY_STATE_REMOVAL_MARKER || + MOBY(moby)->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER || *(s16 *)(projectile_record + 0x68) == 8) goto fail; MOBY(moby)->visible = 1; @@ -1958,7 +1961,8 @@ s32 cancel_suck_cannon_suction(struct Moby *moby) { s32 k; if (suction_record == 0) return 0; - if (moby == 0 || moby->state == MOBY_STATE_REMOVAL_MARKER || moby->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER) + if (moby == 0 || moby->state == MOBY_STATE_REMOVAL_MARKER || + moby->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER) return 0; k = *(s16 *)(suction_record + 0x68); if (k == 8) @@ -2280,7 +2284,8 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { Frame_2DDEA0 suction_and_projectile_scratch; R_2DDEA0 *suction_and_projectile_record; - if (moby == 0 || moby->state == MOBY_STATE_REMOVAL_MARKER || moby->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER) + if (moby == 0 || moby->state == MOBY_STATE_REMOVAL_MARKER || + moby->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER) return 0; suction_and_projectile_record = func_L00_002DCD40_2DDEA0(moby); if (suction_and_projectile_record != 0) { @@ -2314,8 +2319,8 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { if (1.0f < suction_and_projectile_record->f6C) suction_and_projectile_record->f6C = 1.0f; moby->pos.z += suction_and_projectile_record->f6C / 100.0f * frame_scale; - extract_matrix_rotation_quaternion(&suction_and_projectile_record->suction_start_rotation_quaternion, - &moby->rot_row0); + extract_matrix_rotation_quaternion( + &suction_and_projectile_record->suction_start_rotation_quaternion, &moby->rot_row0); clear_u64_value(&suction_and_projectile_record->vel); break; case SUCK_UPDATE_BEING_PULLED_IN: { diff --git a/src/overlays/shared/weapons/visibomb_missile.c b/src/overlays/shared/weapons/visibomb_missile.c index 5bfacd9dc6..0839e0bbef 100644 --- a/src/overlays/shared/weapons/visibomb_missile.c +++ b/src/overlays/shared/weapons/visibomb_missile.c @@ -871,8 +871,9 @@ void visibomb_missile_update(struct Moby *missile_moby) { float requested_speed_target = visibomb_missile_default_speed_gp * frame_time_macro; if (controller_state.held & 0x40) requested_speed_target = visibomb_missile_max_speed_gp * frame_time_macro; - missile_vars->smoothed_speed_target += (requested_speed_target - missile_vars->smoothed_speed_target) * - visibomb_missile_speed_target_blend_factor_gp; + missile_vars->smoothed_speed_target += + (requested_speed_target - missile_vars->smoothed_speed_target) * + visibomb_missile_speed_target_blend_factor_gp; missile_vars->f4 += (missile_vars->smoothed_speed_target - missile_vars->f4) * visibomb_missile_speed_blend_factor_gp; if (visibomb_missile_max_speed_gp * frame_time_macro < missile_vars->f4) @@ -913,13 +914,15 @@ void visibomb_missile_update(struct Moby *missile_moby) { fast_vec_add(&missile_moby->pos, &missile_moby->pos, &v50); if (scale_game_frames(0xBB8) - scale_game_frames(0x3C) < missile_vars->f10) { float launch_clearance_target_height = probe_ground_height(&missile_moby->pos, 0, 0.5f) + - missile_vars->launch_ground_clearance; + missile_vars->launch_ground_clearance; if (missile_moby->pos.z < launch_clearance_target_height) { if (coll_hit_moby == 0 || (coll_hit_moby->pclass != 0 && coll_hit_moby->pclass->type == 5)) { float ground_clearance_pitch_adjustment = fast_arc_tan(missile_vars->f4, - approach_value(&missile_moby->pos.z, launch_clearance_target_height, frame_time_macro * 6.0f)); + approach_value(&missile_moby->pos.z, + launch_clearance_target_height, + frame_time_macro * 6.0f)); if (frame_time_macro * 1.57079637f < ground_clearance_pitch_adjustment) ground_clearance_pitch_adjustment = frame_time_macro * 1.57079637f; missile_moby->rot.y -= ground_clearance_pitch_adjustment; diff --git a/src/overlays/shared/world/load_level_gameplay.c b/src/overlays/shared/world/load_level_gameplay.c index 6697b6baa5..3dbf617e4b 100644 --- a/src/overlays/shared/world/load_level_gameplay.c +++ b/src/overlays/shared/world/load_level_gameplay.c @@ -2165,11 +2165,11 @@ s32 start_cutscene_chunk_read(s32 i) { if (pal_mode != FALSE) { sector_count = disc_table.sector_lists[D_L00_0016C860.list].sectors_alt[i + 1] - - disc_table.sector_lists[D_L00_0016C860.list].sectors_alt[i]; + disc_table.sector_lists[D_L00_0016C860.list].sectors_alt[i]; start = disc_table.sector_lists[D_L00_0016C860.list].sectors_alt[i]; } else { sector_count = disc_table.sector_lists[D_L00_0016C860.list].sectors[i + 1] - - disc_table.sector_lists[D_L00_0016C860.list].sectors[i]; + disc_table.sector_lists[D_L00_0016C860.list].sectors[i]; start = disc_table.sector_lists[D_L00_0016C860.list].sectors[i]; } if (sector_count > 0) { diff --git a/src/rendering/frame/initialize_level_render_state.c b/src/rendering/frame/initialize_level_render_state.c index 15569dbe52..6ed38ea318 100644 --- a/src/rendering/frame/initialize_level_render_state.c +++ b/src/rendering/frame/initialize_level_render_state.c @@ -220,7 +220,9 @@ u8 *initialize_level_render_state(LevelHeader *header) { occl_fog_density_set = 500.0f; occl_fog_count = 500; part_clip_dist = 0x1F4000; - set_background_color(D_0018CD00.background_color_red, D_0018CD00.background_color_green, D_0018CD00.background_color_blue); + set_background_color(D_0018CD00.background_color_red, + D_0018CD00.background_color_green, + D_0018CD00.background_color_blue); vu0_load_micro_program(D_00100AE0); fast_mem_zero16(point_lights, 0x100); fast_mem_zero16(point_light_data, 0x180); diff --git a/src/rendering/mobys/patch_moby_gifs.c b/src/rendering/mobys/patch_moby_gifs.c index a557d32ee1..d4e8a098e0 100644 --- a/src/rendering/mobys/patch_moby_gifs.c +++ b/src/rendering/mobys/patch_moby_gifs.c @@ -23,7 +23,8 @@ void patch_moby_gifs(void) { u32 *gif; struct TexRemap *texture_remap; - for (moby_class_id_cursor = moby_class_rectify; *moby_class_id_cursor >= 0; moby_class_id_cursor++) { + for (moby_class_id_cursor = moby_class_rectify; *moby_class_id_cursor >= 0; + moby_class_id_cursor++) { gif_entry = ((struct MobyClass *)moby_class_resources[*moby_class_id_cursor])->gifs; for (;; gif_entry++) { gif = (u32 *)(gif_entry->gif & 0x7FFFFFFF); diff --git a/src/rendering/packets/set_up_vis_gif_viewer.c b/src/rendering/packets/set_up_vis_gif_viewer.c index 3b19524b49..7f401167dd 100644 --- a/src/rendering/packets/set_up_vis_gif_viewer.c +++ b/src/rendering/packets/set_up_vis_gif_viewer.c @@ -31,8 +31,8 @@ void set_up_vis_gif_viewer(u64 *packet_destination, packet_destination[0] = (0x20 | (template_draw_control_bits & 0x1C)) | ((u64)prim << 6) | ((u64)(u32)draw_control_high_word << 32); packet_destination += 2; - packet_destination[0] = - (material_control_base | ((u64)material_control_shift2 << 2)) | ((u64)material_index << 24); + packet_destination[0] = (material_control_base | ((u64)material_control_shift2 << 2)) | + ((u64)material_index << 24); packet_destination += 2; packet_destination[0] = template_texture_state0; packet_destination[2] = template_texture_state1; diff --git a/src/sdk/input/dbc/scedbcreceivedata.c b/src/sdk/input/dbc/scedbcreceivedata.c index cc3362f1e0..86e816f89b 100644 --- a/src/sdk/input/dbc/scedbcreceivedata.c +++ b/src/sdk/input/dbc/scedbcreceivedata.c @@ -25,7 +25,15 @@ s32 sceDbcReceiveData(s32 rpc_request_word_0, rpc_transfer_buffer->unk0 = rpc_request_word_0; rpc_transfer_buffer->unk4 = rpc_request_word_1; rpc_transfer_buffer->unk8 = *byte_count; - if (sceSifCallRpc(&RpcQueueData, 0x8000091A, 0, rpc_transfer_buffer, 0x400, rpc_transfer_buffer, 0x400, 0, 0) < 0) { + if (sceSifCallRpc(&RpcQueueData, + 0x8000091A, + 0, + rpc_transfer_buffer, + 0x400, + rpc_transfer_buffer, + 0x400, + 0, + 0) < 0) { debug_print_stub(dbc_receive_rpc_error_message); return 0; } diff --git a/src/sdk/libc/stdio/_vfprintf_r.c b/src/sdk/libc/stdio/_vfprintf_r.c index 2fd33002a9..14cf7a7fa1 100644 --- a/src/sdk/libc/stdio/_vfprintf_r.c +++ b/src/sdk/libc/stdio/_vfprintf_r.c @@ -79,17 +79,17 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li OCT, DEC, HEX - } base; /* base for [diouxX] conversion */ - int dprec; /* a copy of prec if [diouxX], 0 otherwise */ - int realsz; /* field size expanded by dprec */ - int converted_field_byte_count; /* size of converted field or string */ - char *xdigs; /* digits for [xX] conversion */ + } base; /* base for [diouxX] conversion */ + int dprec; /* a copy of prec if [diouxX], 0 otherwise */ + int realsz; /* field size expanded by dprec */ + int converted_field_byte_count; /* size of converted field or string */ + char *xdigs; /* digits for [xX] conversion */ #define NIOV 8 RncStdioUio uio; /* output information: summary */ RncStdioIov iov[NIOV]; /* ... and individual io vectors */ char conversion_buffer[BUF]; /* space for %c, %[diouxX], %[eEfgG] */ char ox[2]; /* space for 0x hex-prefix */ - int multibyte_conversion_state = 0; /* mbtowc calls from library must not change state */ + int multibyte_conversion_state = 0; /* mbtowc calls from library must not change state */ /* * Choose PADSIZE to trade efficiency vs. size. If larger printf @@ -162,7 +162,8 @@ s32 _vfprintf_r(RncReent *reentrancy_state, RncFile *fp, const char *fmt0, va_li */ for (;;) { cp = fmt; - while ((n = convert_multibyte_character(_REENT, &wc, fmt, MB_CUR_MAX, &multibyte_conversion_state)) > 0) { + while ((n = convert_multibyte_character( + _REENT, &wc, fmt, MB_CUR_MAX, &multibyte_conversion_state)) > 0) { fmt += n; if (wc == '%') { fmt--; diff --git a/src/sdk/mpeg/picture/_getpic.c b/src/sdk/mpeg/picture/_getpic.c index f68f5f0fea..181c9ea441 100644 --- a/src/sdk/mpeg/picture/_getpic.c +++ b/src/sdk/mpeg/picture/_getpic.c @@ -60,12 +60,14 @@ s32 _getpic(struct sceMpeg *mpeg) { decoder->picture_count_i = (s32)(decoder->picture_count_i + 1); break; case MPEG_PREDICTIVE_PICTURE: - decode_or_skip_result = _decodeOrSkip(mpeg, decoder->picture_count_p, decoder->decode_count_p); + decode_or_skip_result = + _decodeOrSkip(mpeg, decoder->picture_count_p, decoder->decode_count_p); decoder->picture_count_p = (s32)(decoder->picture_count_p + 1); break; case MPEG_BIDIRECTIONAL_PICTURE: case MPEG_DC_INTRA_PICTURE: - decode_or_skip_result = _decodeOrSkip(mpeg, decoder->picture_count_b, decoder->decode_count_b); + decode_or_skip_result = + _decodeOrSkip(mpeg, decoder->picture_count_b, decoder->decode_count_b); decoder->picture_count_b = (s32)(decoder->picture_count_b + 1); break; } diff --git a/src/sdk/mpeg/picture/_lastFrame.c b/src/sdk/mpeg/picture/_lastFrame.c index c6dc05520c..c3a651d51e 100644 --- a/src/sdk/mpeg/picture/_lastFrame.c +++ b/src/sdk/mpeg/picture/_lastFrame.c @@ -16,7 +16,8 @@ void _lastFrame(struct MpegDecoder *decoder) { if (decoder->picture_structure == 3) { _dispRefImage(decoder, decoder->ref_images[1], saved_frame_count - 1); } else { - _dispRefImageField(decoder, decoder->ref_images[5], decoder->ref_images[9], saved_frame_count - 1); + _dispRefImageField( + decoder, decoder->ref_images[5], decoder->ref_images[9], saved_frame_count - 1); } } decoder->second_field = 0; diff --git a/src/sdk/rpc/iop/sce_sif_load_module_buffer.c b/src/sdk/rpc/iop/sce_sif_load_module_buffer.c index 00f3f6ec9f..b66c8682f7 100644 --- a/src/sdk/rpc/iop/sce_sif_load_module_buffer.c +++ b/src/sdk/rpc/iop/sce_sif_load_module_buffer.c @@ -11,7 +11,11 @@ extern u8 D_00158400[]; extern s32 sif_load_module_server_changed() __asm__("func_0011CAE0"); extern s32 memcpy(); #define SIFCMD ((struct SifLoadModuleArgs *)D_00158200) -s32 _sceSifLoadModuleBuffer(s32 iop_address, s32 argument_byte_count, s32 module_arguments, s32 *result_out) { +s32 _sceSifLoadModuleBuffer(s32 iop_address, + s32 argument_byte_count, + s32 module_arguments, + + s32 *result_out) { s32 mask; s32 rpc_return_value; diff --git a/src/ui/hud/banks/load_compressed_hud_bank.c b/src/ui/hud/banks/load_compressed_hud_bank.c index 00df23ab56..4d8d5af5be 100644 --- a/src/ui/hud/banks/load_compressed_hud_bank.c +++ b/src/ui/hud/banks/load_compressed_hud_bank.c @@ -11,8 +11,9 @@ void load_compressed_hud_bank(s32 bank, s32 raw_size) { aligned_raw_size = (raw_size + 0xF) & 0xFFFFFFF0; if (aligned_raw_size != 0) { level_archive_base = *(u32 *)0x15EE4C; - decompress_wad( - *(s32 *)((u8 *)(level_archive_base - (-(bank * 8))) + 0x28) + level_archive_base, aligned_raw_size); + decompress_wad(*(s32 *)((u8 *)(level_archive_base - (-(bank * 8))) + 0x28) + + level_archive_base, + aligned_raw_size); } { register u32 b2; diff --git a/src/ui/hud/sprites/draw_hud_sprite_flipped.c b/src/ui/hud/sprites/draw_hud_sprite_flipped.c index df1f526bc5..8672a516fd 100644 --- a/src/ui/hud/sprites/draw_hud_sprite_flipped.c +++ b/src/ui/hud/sprites/draw_hud_sprite_flipped.c @@ -8,7 +8,9 @@ extern u64 get_frame_texture(s32) __asm__("func_001FFA10"); void draw_hud_sprite_flipped(s32 id, s32 x, s32 y, s32 w, s32 h, s32 alpha) __asm__("FUN_001ffe18"); -void draw_hud_sprite_flipped(s32 frame_index, s32 x, s32 y, s32 sprite_width, s32 sprite_height, s32 alpha) { +void draw_hud_sprite_flipped( + + s32 frame_index, s32 x, s32 y, s32 sprite_width, s32 sprite_height, s32 alpha) { struct HudTexPage *image_page; struct DmaTag *tag; u64 *packet_words; diff --git a/src/ui/menus/item_preview/update_ammo_preview_transform.c b/src/ui/menus/item_preview/update_ammo_preview_transform.c index 3cfdb0a76d..4f08fa911b 100644 --- a/src/ui/menus/item_preview/update_ammo_preview_transform.c +++ b/src/ui/menus/item_preview/update_ammo_preview_transform.c @@ -106,7 +106,8 @@ void update_ammo_preview_transform(struct AmmoPreviewMoby *moby) { preview_position_offset[0] = fast_cos(orbit_angle); preview_position_offset[1] = fast_sin(orbit_angle); preview_position_offset[2] = zero; - preview_position_offset[2] = fast_sin(bob_angle) * 0.25f + 0.5f + ammo_preview_offsets[moby->slot]; + preview_position_offset[2] = + fast_sin(bob_angle) * 0.25f + 0.5f + ammo_preview_offsets[moby->slot]; transform_vector_by_basis(preview_position_offset, preview_position_offset, source_moby->basis); fast_vec_add(moby->position, moby->position, preview_position_offset); clear_u64_value(angles); diff --git a/src/ui/menus/save_data/save_card_state_formatting.c b/src/ui/menus/save_data/save_card_state_formatting.c index df73705a7a..384e4cd9e1 100644 --- a/src/ui/menus/save_data/save_card_state_formatting.c +++ b/src/ui/menus/save_data/save_card_state_formatting.c @@ -7,7 +7,8 @@ void save_card_state_formatting(void) __asm__("FUN_00208b28"); void save_card_state_formatting(void) { struct MemoryCardState *card_state = &memory_card_state; - if (card_state->state == MEMCARD_DISPATCH_PENDING_OPERATION && card_state->pending_state < MEMCARD_QUERY_INFO) { + if (card_state->state == MEMCARD_DISPATCH_PENDING_OPERATION && + card_state->pending_state < MEMCARD_QUERY_INFO) { if (card_state->err != 0) { save_card_state = CS_FORMAT_FAILED; mode_freeze_flags |= 0x40; diff --git a/src/world/loaders/upload_texture_images.c b/src/world/loaders/upload_texture_images.c index 5d0f308fdd..4d8723aeff 100644 --- a/src/world/loaders/upload_texture_images.c +++ b/src/world/loaders/upload_texture_images.c @@ -21,7 +21,10 @@ extern s32 sceGsExecLoadImage(sceGsLoadImage *img, s32 src); void upload_texture_images(s32 base, s32 count, struct TextureImage *p) __asm__("FUN_00203120"); -void upload_texture_images(s32 pixel_data_base, s32 texture_image_count, struct TextureImage *texture_image) { +void upload_texture_images(s32 pixel_data_base, + s32 texture_image_count, + + struct TextureImage *texture_image) { sceGsLoadImage img; s32 i; s32 pixel_data_source; From ffcf1f56f1d736b3701f7bf989abb3fb5ca92eda Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:41:44 +0000 Subject: [PATCH 651/657] decomp: preserve canonical names and enum domains after rebase --- src/overlays/l01/mobys/bomber_jet.c | 6 +- src/overlays/l11/mobys/psytcopus.c | 10 ++- .../shared/camera/aim_volume_camera.c | 2 - .../shared/camera/swing_volume_camera.c | 11 +--- src/overlays/shared/hero/hero_idle_sequence.c | 10 ++- src/overlays/shared/hero/hero_set_state.c | 62 ++++++++----------- src/overlays/shared/hero/hero_switch_item.c | 6 +- src/overlays/shared/pickups/bolt.c | 6 +- src/overlays/shared/weapons/blaster_shot.c | 6 +- src/sdk/rpc/rpc/sce_sif_bind_rpc.c | 2 +- .../save_data/save_card_state_formatting.c | 3 +- 11 files changed, 47 insertions(+), 77 deletions(-) diff --git a/src/overlays/l01/mobys/bomber_jet.c b/src/overlays/l01/mobys/bomber_jet.c index ba0bb2729b..5eb0a0151c 100644 --- a/src/overlays/l01/mobys/bomber_jet.c +++ b/src/overlays/l01/mobys/bomber_jet.c @@ -1,3 +1,4 @@ +#include "rnc/mobys/moby_state.h" /* Level 01 moby class bomber_jet. */ #include "types.h" #include "rnc/game/item_state.h" @@ -264,9 +265,6 @@ void bomber_jet_update(GunshipMoby *bomber_jet_moby) { enum { BOMBER_JET_STATE_INITIALIZE = 0 }; - enum { - MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE - }; GunshipVars *gunship_vars = bomber_jet_moby->vars; GunshipFollow *sub = &gunship_vars->sub; float distance_scale; @@ -386,7 +384,7 @@ void bomber_jet_update(GunshipMoby *bomber_jet_moby) { GunshipMoby *o = (GunshipMoby *)(ents_macro + (gunship_vars->turrets[j] << 8)); if (o != 0 && o->oclass == 0x1CB && - o->state != MOBY_STATE_MARKED_FOR_REMOVAL && o->state != 0xFD) { + o->state != MOBY_STATE_REMOVAL_MARKER && o->state != 0xFD) { GunshipTurretVars *t = o->vars; t->activated = 1; t->activate_delay = scale_game_frames(2); diff --git a/src/overlays/l11/mobys/psytcopus.c b/src/overlays/l11/mobys/psytcopus.c index b62c654e5a..738a4e2b4d 100644 --- a/src/overlays/l11/mobys/psytcopus.c +++ b/src/overlays/l11/mobys/psytcopus.c @@ -89,6 +89,10 @@ FUN_L00_0025f3e8_p(struct Moby *, void *, int, float, float) __asm__("FUN_L00_00 #include "rnc/overlay/l11/mobys/psytcopus_data/psytcopus_update.h" +enum { + PSYTCOPUS_PROJECTILE_CREATION_BLOCKED = 2 +}; + extern float D_L11_00161F9C __attribute__((sda)); extern void set_moby_position_and_refresh_removal_timer(void *, void *) __asm__("FUN_L11_00318e78"); extern void FUN_L00_0025ab48_p(void *, float *, float *, float *) __asm__("FUN_L00_0025ab48"); @@ -106,9 +110,6 @@ void psytcopus_update(struct Moby *m) __asm__("FUN_L11_00310180"); /* Moby class 1231 */ void psytcopus_update(struct Moby *psytcopus) { - enum { - PSYTCOPUS_PROJECTILE_CREATION_BLOCKED = 2 - }; struct PokiPathVars *psytcopus_vars = (struct PokiPathVars *)psytcopus->pvars; struct Moby *target; Vec4f projectile_vector_scratch; @@ -268,9 +269,6 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { HIT_REACTION_HURT_WITHOUT_STATE_CHANGE = 10, HIT_REACTION_NO_RESPONSE = 11 }; - enum { - PSYTCOPUS_PROJECTILE_CREATION_BLOCKED = 2 - }; struct PokiPathVars *psytcopus_vars = (struct PokiPathVars *)psytcopus->pvars; Vec4f projectile_and_hit_vector_scratch; int hits; diff --git a/src/overlays/shared/camera/aim_volume_camera.c b/src/overlays/shared/camera/aim_volume_camera.c index 1f56b02734..b0981dad6d 100644 --- a/src/overlays/shared/camera/aim_volume_camera.c +++ b/src/overlays/shared/camera/aim_volume_camera.c @@ -12,8 +12,6 @@ #include "rnc/overlay/shared/camera.h" #include "rnc/overlay/shared/camera/follow_camera_set_up_spring.h" -void set_follow_camera_angle_parameter(float) __asm__("FUN_L00_002e8540"); - #include "rnc/overlay/shared/rendering/culling/test_point_in_transformed_unit_cylinder.h" #include "rnc/rendering/clip_volume.h" diff --git a/src/overlays/shared/camera/swing_volume_camera.c b/src/overlays/shared/camera/swing_volume_camera.c index 4bfa206ee6..0e68d291d9 100644 --- a/src/overlays/shared/camera/swing_volume_camera.c +++ b/src/overlays/shared/camera/swing_volume_camera.c @@ -13,8 +13,6 @@ #include "rnc/overlay/shared/camera.h" #include "rnc/overlay/shared/camera/follow_camera_set_up_spring.h" -void set_follow_camera_angle_parameter(float) __asm__("FUN_L00_002e8540"); - #include "rnc/overlay/shared/rendering/culling/test_point_in_transformed_unit_cylinder.h" #include "rnc/rendering/clip_volume.h" @@ -23,7 +21,8 @@ enum { SWING_CAMERA_TYPE_ONE_FRAME_SWING = 3, SWING_CAMERA_TYPE_RETAIN_ON_CAMERA_REQUEST = 4, SWING_CAMERA_TYPE_SNAP_ON_ENTRY = 5, - SWING_CAMERA_TYPE_SLIDE_KEEP_ANGLE_AT_END = 10 + SWING_CAMERA_TYPE_SLIDE_KEEP_ANGLE_AT_END = 10, + SWING_CAMERA_TYPE_FORCE_FOLLOW_MODE = 11 }; typedef float CameraVec[4] __attribute__((aligned(16))); @@ -149,9 +148,6 @@ void volume_camera_swing(struct UpdateCam *swing_camera_record) { enum { SWING_CAMERA_TYPE_SLIDE_RELEASE_ANGLE_ALLOW_AIRBORNE_ENTRY = 7 }; - enum { - SWING_CAMERA_TYPE_FORCE_FOLLOW_MODE = 11 - }; CameraVec gravity_offset_or_yaw_direction; SwingCameraParams *params; struct UpdateCam *current_follow_camera_record; @@ -387,9 +383,6 @@ void volume_camera_swing(struct UpdateCam *swing_camera_record) { s32 volume_camera_swing_check(struct UpdateCam *cam) __asm__("FUN_L00_002ed230"); s32 volume_camera_swing_check(struct UpdateCam *swing_camera_record) { - enum { - SWING_CAMERA_TYPE_FORCE_FOLLOW_MODE = 11 - }; SwingCameraParams *params = camera_descriptors[swing_camera_record->descriptor_index].params; if (params->l_buttons_end == 1 && params->done != 0) return 0; diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index e41b91f61d..dae85a994c 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -161,9 +161,6 @@ int get_hero_easing_moby_by_kind(int ease_kind) { HERO_EASE_KIND_SLOT_THREE_SECONDARY_MOBY = 1, HERO_EASE_KIND_SLOT_ZERO_PRIMARY_MOBY = 5 }; - enum { - HERO_EASE_KIND_ON_FOOT_HERO_MOBY = 0 - }; if (ease_kind == HERO_EASE_KIND_ON_FOOT_HERO_MOBY || ease_kind == 2 || ease_kind == 3 || ease_kind == 4) { return D_001413D0[0]; @@ -194,9 +191,6 @@ void build_quaternion_from_axis_rotations(void *, void *) __asm__("FUN_L00_00259 void update_hero_easing_record(struct HeroEase *ease_record) __asm__("FUN_L00_00205168"); void update_hero_easing_record(struct HeroEase *ease_record) { - enum { - HERO_EASE_KIND_ON_FOOT_HERO_MOBY = 0 - }; s32 moby = get_hero_easing_moby_by_kind(ease_record->kind); if (moby == 0) return; @@ -3572,6 +3566,10 @@ void apply_hero_selected_flags_and_state_transitions(void) { #undef P #include "rnc/math/vector.h" +enum { + HERO_EASE_KIND_ON_FOOT_HERO_MOBY = 0 +}; + /* the ledge probe of the hero: looks for an edge ahead to grab, and where it finds one stores the grab point and direction */ /* Ported from rac1-decomp (src/overlays/shared/help_00203E98.c: func_L00_0020C568), where it is exact; names translated to the US level program. */ diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index cca2bfa368..7b4c0271eb 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3354,15 +3354,7 @@ int process_hero_equipped_item_input(void) { WRENCH_MOBY_STATE_READY = 0 }; enum { - HERO_CONTROL_MODE_IDLE = 0, - HERO_CONTROL_MODE_GROUND_MOVE = 1, - HERO_ITEM_SLOT_STATE_READY = 2, - HERO_CONTROL_MODE_FALL = 2, - HERO_CONTROL_MODE_JUMP = 4, - HERO_CONTROL_MODE_LAND = 5, - HERO_CONTROL_MODE_MELEE_ATTACK = 6, - HERO_CONTROL_MODE_CROUCH = 0xC, - HERO_CONTROL_MODE_GRIND = 0xF + HERO_ITEM_SLOT_STATE_READY = 2 }; int item_press_age_frames[3]; int start; @@ -3386,7 +3378,7 @@ int process_hero_equipped_item_input(void) { switch (D_0013F450_h228770.equipped_slot_item_id) { case ITEM_WRENCH: if (D_0013F450_h228770.hero_control_mode < 2U || - (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && + (D_0013F450_h228770.hero_control_mode == HERO_MODE_JUMP && D_0013F450_h228770.jump_ground_item_input_enabled != 0)) { Moby_227fa0 *equipped_item_moby; @@ -3467,7 +3459,7 @@ int process_hero_equipped_item_input(void) { break; } } - if (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_MELEE_ATTACK) { + if (D_0013F450_h228770.hero_control_mode == HERO_MODE_ATTACK) { HeroTableRow2C *wrench_attack_record = &attack_records[D_0013F450_h228770.active_attack_record_index]; int t; @@ -3528,10 +3520,10 @@ int process_hero_equipped_item_input(void) { t = scale_game_frames(8); } if (D_0013F450_h228770.hero_control_mode < 2U || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_FALL || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GRIND || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_LAND || + D_0013F450_h228770.hero_control_mode == HERO_MODE_JUMP || + D_0013F450_h228770.hero_control_mode == HERO_MODE_FALL || + D_0013F450_h228770.hero_control_mode == HERO_MODE_GRIND || + D_0013F450_h228770.hero_control_mode == HERO_MODE_LAND || D_0013F450_h228770.hero_current_state == HERO_STATE_LOOK_RELEASE_WAIT) { if (pad_pressed_within(mask, t, 0) || ((controller_state.held & mask) && @@ -3583,8 +3575,8 @@ int process_hero_equipped_item_input(void) { break; case ITEM_REMOTE_VENDOR: if (D_0013F450_h228770.hero_control_mode < 3U || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_LAND) { + D_0013F450_h228770.hero_control_mode == HERO_MODE_JUMP || + D_0013F450_h228770.hero_control_mode == HERO_MODE_LAND) { if (pad_pressed_within(mask, scale_game_frames(8), 0)) { open_vendor_menu(0); } @@ -3592,11 +3584,11 @@ int process_hero_equipped_item_input(void) { break; case 15: if (D_0013F450_h228770.hero_control_mode < 2U || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_FALL || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_LAND || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GRIND || + D_0013F450_h228770.hero_control_mode == HERO_MODE_CROUCH || + D_0013F450_h228770.hero_control_mode == HERO_MODE_FALL || + D_0013F450_h228770.hero_control_mode == HERO_MODE_JUMP || + D_0013F450_h228770.hero_control_mode == HERO_MODE_LAND || + D_0013F450_h228770.hero_control_mode == HERO_MODE_GRIND || D_0013F450_h228770.hero_current_state == HERO_STATE_LOOK_RELEASE_WAIT) { PVar *equipped_item_vars; @@ -3630,13 +3622,13 @@ int process_hero_equipped_item_input(void) { case 20: case 24: case 25: - if ((D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_IDLE && + if ((D_0013F450_h228770.hero_control_mode == HERO_MODE_IDLE && D_0013F450_h228770.hero_current_state != HERO_STATE_LOOK_RELEASE_WAIT) || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GROUND_MOVE || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_LAND || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GRIND || - (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && + D_0013F450_h228770.hero_control_mode == HERO_MODE_RUN || + D_0013F450_h228770.hero_control_mode == HERO_MODE_CROUCH || + D_0013F450_h228770.hero_control_mode == HERO_MODE_LAND || + D_0013F450_h228770.hero_control_mode == HERO_MODE_GRIND || + (D_0013F450_h228770.hero_control_mode == HERO_MODE_JUMP && D_0013F450_h228770.jump_weapon_input_enabled != 0) || (D_0013F450_h228770.hero_current_state == HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL && @@ -3653,10 +3645,10 @@ int process_hero_equipped_item_input(void) { ((controller_state.held & 0x20) && n > scale_game_frames(8) && n < scale_game_frames(0x11))) { if (get_ammo(-1)) { - if (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_IDLE || + if (D_0013F450_h228770.hero_control_mode == HERO_MODE_CROUCH || + D_0013F450_h228770.hero_control_mode == HERO_MODE_IDLE || D_0013F450_h228770.hero_current_state == HERO_STATE_STOP || - (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_GROUND_MOVE && + (D_0013F450_h228770.hero_control_mode == HERO_MODE_RUN && D_0013F450_h228770.hero_stick_magnitude < 0.7f)) { hero_set_state(0x23, 1); } else { @@ -3672,7 +3664,7 @@ int process_hero_equipped_item_input(void) { break; case 18: if (D_0013F450_h228770.hero_control_mode < 2U || - (D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP && + (D_0013F450_h228770.hero_control_mode == HERO_MODE_JUMP && D_0013F450_h228770.jump_ground_item_input_enabled != 0)) { if (D_0013F450_h228770.hero_current_state != HERO_STATE_LOOK) { int t = scale_game_frames(0xA); @@ -3707,9 +3699,9 @@ int process_hero_equipped_item_input(void) { f_fun_001f9740_227fa0(&hero_repeat_press_window_frames); if (hero_repeat_press_window_frames != 0) { if (D_0013F450_h228770.hero_control_mode < 2U || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_CROUCH || - ((D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_FALL || - D_0013F450_h228770.hero_control_mode == HERO_CONTROL_MODE_JUMP) && + D_0013F450_h228770.hero_control_mode == HERO_MODE_CROUCH || + ((D_0013F450_h228770.hero_control_mode == HERO_MODE_FALL || + D_0013F450_h228770.hero_control_mode == HERO_MODE_JUMP) && D_0013F450_h228770.airborne_repeat_press_action_enabled != 0)) { if ((controller_state.held & 8) && (controller_state.pressed & 8)) { hero_set_state(0x81, 1); diff --git a/src/overlays/shared/hero/hero_switch_item.c b/src/overlays/shared/hero/hero_switch_item.c index 1e83273f98..e3fa6c725a 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -1,3 +1,4 @@ +#include "rnc/mobys/moby_state.h" /* Hero items and targeting: item slots and switching, ledge and grind rail probes, aim pitch, target scoring and selection. */ #include "rnc/input/pad_globals.h" #include "types.h" @@ -2259,9 +2260,6 @@ extern s32 D_L00_0015F3F8; void hero_update_items(void) __asm__("FUN_L00_00210748"); void hero_update_items(void) { - enum { - MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE - }; int i; int k; struct Moby *moby; @@ -2292,7 +2290,7 @@ void hero_update_items(void) { } break; } - if (moby != 0 && moby->state != MOBY_STATE_MARKED_FOR_REMOVAL && moby->state != 0xFD) { + if (moby != 0 && moby->state != MOBY_STATE_REMOVAL_MARKER && moby->state != 0xFD) { if (i != 6 && moby->update != 0) { moby->update(moby); } diff --git a/src/overlays/shared/pickups/bolt.c b/src/overlays/shared/pickups/bolt.c index c0b1e6851e..3ec407d2ad 100644 --- a/src/overlays/shared/pickups/bolt.c +++ b/src/overlays/shared/pickups/bolt.c @@ -1,3 +1,4 @@ +#include "rnc/mobys/moby_state.h" /* Shared moby class bolt (and bolt_hexnut, bolt_starnut, bolt_circlenut): bolts dropped and collected. */ #include "types.h" #include "rnc/game/level_progress.h" @@ -541,9 +542,6 @@ void collect_bolt(struct Moby *bolt) { void update_bolt_grounded_pose(char *moby, void *out1, void *out2) __asm__("FUN_L00_002a6de8"); void update_bolt_grounded_pose(char *moby, void *base_position_output, void *base_rotation_output) { - enum { - MOBY_STATE_PENDING_REMOVAL = 0xFE - }; char *grounded_bolt_vars = ((char *)MOBY(moby)->pvars); float local_rotation_basis[12]; float base_rotation_basis[12]; @@ -626,7 +624,7 @@ void update_bolt_grounded_pose(char *moby, void *base_position_output, void *bas if (ground_moby != 0 && *(unsigned char *)(grounded_bolt_vars + 0x57) == 0) { int should_detach_from_ground; char *x; - if ((unsigned char)MOBY(ground_moby)->state == MOBY_STATE_PENDING_REMOVAL || + if ((unsigned char)MOBY(ground_moby)->state == MOBY_STATE_REMOVAL_MARKER || (*(unsigned char **)(grounded_bolt_vars + 0x5C))[0x20] == 0xFD) { should_detach_from_ground = 1; } else { diff --git a/src/overlays/shared/weapons/blaster_shot.c b/src/overlays/shared/weapons/blaster_shot.c index b46dc87e14..89b5e811be 100644 --- a/src/overlays/shared/weapons/blaster_shot.c +++ b/src/overlays/shared/weapons/blaster_shot.c @@ -1,3 +1,4 @@ +#include "rnc/mobys/moby_state.h" /* Shared moby class 0x131: a homing shot, and the function that spawns it. */ #include "types.h" #include "rnc/mobys/moby.h" @@ -267,9 +268,6 @@ void homing_shot_update(Moby *shot_moby) __asm__("FUN_L00_002cb418"); /* Moby class 305 */ void homing_shot_update(Moby *shot_moby) { - enum { - MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE - }; Vec4A start; Vec4A step; ShotQuery query; @@ -414,7 +412,7 @@ void homing_shot_update(Moby *shot_moby) { add_vector_xyz_2cb418( (Vec4A *)&shot_moby->pos, ((char *)D_L00_00173E60), &spark_and_pushout_scratch); if (D_001403E0_lui != 0 && D_001403E0_lui->oclass == 0xA8 && - D_001403E0_lui->state != MOBY_STATE_MARKED_FOR_REMOVAL && + D_001403E0_lui->state != MOBY_STATE_REMOVAL_MARKER && D_001403E0_lui->state != 0xFD) { allocate_voice_for_target_entry(4, 0, D_001403E0_lui); } diff --git a/src/sdk/rpc/rpc/sce_sif_bind_rpc.c b/src/sdk/rpc/rpc/sce_sif_bind_rpc.c index 0ea2e433e0..111d8e38c5 100644 --- a/src/sdk/rpc/rpc/sce_sif_bind_rpc.c +++ b/src/sdk/rpc/rpc/sce_sif_bind_rpc.c @@ -33,7 +33,7 @@ s32 sceSifBindRpc(struct sceSifClientData *client, s32 rpc_number, s32 completio packet->sid = rpc_number; packet->pkt_addr = (s32)packet; packet->client = (s32)client; - if (mode & 1) { + if (completion_mode & 1) { goto block_7; } sema_param[1] = 1; diff --git a/src/ui/menus/save_data/save_card_state_formatting.c b/src/ui/menus/save_data/save_card_state_formatting.c index 384e4cd9e1..e809683793 100644 --- a/src/ui/menus/save_data/save_card_state_formatting.c +++ b/src/ui/menus/save_data/save_card_state_formatting.c @@ -7,8 +7,7 @@ void save_card_state_formatting(void) __asm__("FUN_00208b28"); void save_card_state_formatting(void) { struct MemoryCardState *card_state = &memory_card_state; - if (card_state->state == MEMCARD_DISPATCH_PENDING_OPERATION && - card_state->pending_state < MEMCARD_QUERY_INFO) { + if (card_state->state == MEMCARD_DISPATCH_PENDING_OPERATION && card_state->pending_state < 0) { if (card_state->err != 0) { save_card_state = CS_FORMAT_FAILED; mode_freeze_flags |= 0x40; From 85c26f7cf49bc77cc98b62e9cde9fe3dff2608e7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:46:34 +0000 Subject: [PATCH 652/657] decomp: complete rebased parameter and local renames --- src/audio/voices/pause_all_sounds.c | 4 ++-- src/mobys/animation/queue_animation_update.c | 7 ++++--- src/runtime/memory/calculate_ring_buffer_bounds.c | 8 +++++--- src/sdk/graph/sce_gs_set_def_disp_env.c | 11 +++++++---- src/sdk/ipu/sce_ipu_restart_dma.c | 6 +++--- src/sdk/mpeg/macroblock/skip_mb0.c | 2 +- src/sdk/rpc/iop/sce_sif_load_module_buffer.c | 4 ++-- src/sdk/storage/fileio/sceClose.c | 12 ++++++------ src/sdk/storage/memory_card/sce_mc_get_dir.c | 2 +- src/sdk/storage/memory_card/sce_mc_get_info.c | 2 +- src/ui/map/draw_map_screen.c | 4 ++-- .../item_preview/load_preview_resource_bindings.c | 4 ++-- src/ui/menus/save_data/run_state_handler.c | 2 +- src/ui/menus/save_data/save_card_state_good_save.c | 4 ++-- .../save_data/save_card_state_prompt_create_save.c | 4 ++-- src/ui/menus/save_data/save_card_state_saving.c | 6 +++--- .../stream_buffers/initialize_menu_stream_buffers.c | 6 +++--- src/ui/menus/system/process_menu_entry.c | 4 ++-- src/ui/menus/system/setup_menu_display_text.c | 4 ++-- src/ui/menus/weapons/count_gold_bolts.c | 2 +- src/world/update_world_object_animation.c | 2 +- 21 files changed, 53 insertions(+), 47 deletions(-) diff --git a/src/audio/voices/pause_all_sounds.c b/src/audio/voices/pause_all_sounds.c index 715e86f5d8..ff13ec6b16 100644 --- a/src/audio/voices/pause_all_sounds.c +++ b/src/audio/voices/pause_all_sounds.c @@ -36,7 +36,7 @@ extern s32 extern void update_skill_point_and_gold_weapon_menu_entries() __asm__("func_00226E58"); -void pause_all_sounds(s32 mode) __asm__("FUN_00218d78"); +void pause_all_sounds(s32 menu_state) __asm__("FUN_00218d78"); extern s32 game_mode_macro __asm__("D_0015F604") MACRO_ADDR; @@ -68,7 +68,7 @@ void pause_all_sounds(s32 menu_state) { { struct MenuSystem *g = &menu_system; struct MenuTextListScreen *head = &pause_menu_chain_head; - g->sequence_autoclose = mode == 0x23; + g->sequence_autoclose = menu_state == 0x23; head->list.up = g->goodies_tab_shown ? (struct MenuScreen *)&pause_goodies_tab : (struct MenuScreen *)&pause_menu_chain_tail; } diff --git a/src/mobys/animation/queue_animation_update.c b/src/mobys/animation/queue_animation_update.c index b949c916dc..ecf93cf2c6 100644 --- a/src/mobys/animation/queue_animation_update.c +++ b/src/mobys/animation/queue_animation_update.c @@ -25,7 +25,8 @@ struct Anim { extern struct Anim hud_chan_slots[] __asm__("D_00199B60"); extern void apply_pending_animation(struct Anim *) __asm__("func_001FF418"); -s32 queue_animation_update(s32 chan, s32 id, s32 fn, s32 d, s32 e, s32 c, s32 b) __asm__("FUN_001ff308"); +s32 queue_animation_update(s32 chan, s32 id, s32 fn, s32 d, s32 e, s32 c, s32 b) __asm__( + "FUN_001ff308"); s32 queue_animation_update(s32 chan, s32 queued_animation_id, @@ -54,10 +55,10 @@ s32 queue_animation_update(s32 chan, anim->next_d = animation_callback; anim->next_e = queued_animation_callback; anim->pending = 1; - anim->next_mode = mode; + anim->next_mode = channel_flags; anim->visible_timer = 0; anim->counter_digits = 0; - if (mode & anim->flags & 0x20) { + if (channel_flags & anim->flags & 0x20) { apply_pending_animation(anim); } } diff --git a/src/runtime/memory/calculate_ring_buffer_bounds.c b/src/runtime/memory/calculate_ring_buffer_bounds.c index a1bbd63ee6..04849c813b 100644 --- a/src/runtime/memory/calculate_ring_buffer_bounds.c +++ b/src/runtime/memory/calculate_ring_buffer_bounds.c @@ -8,7 +8,9 @@ struct RingBufferConfig { }; extern struct RingBufferConfig D_001940C0; -s32 calculate_ring_buffer_bounds(u32 size, s32 *out_start, s32 *out_end) __asm__("FUN_001fd6e0"); +s32 calculate_ring_buffer_bounds(u32 byte_count, + s32 *out_start, + s32 *out_end) __asm__("FUN_001fd6e0"); s32 calculate_ring_buffer_bounds(u32 byte_count, s32 *out_start, s32 *out_end) { if (byte_count > 0x20000U) { @@ -16,8 +18,8 @@ s32 calculate_ring_buffer_bounds(u32 byte_count, s32 *out_start, s32 *out_end) { *out_end = 0; return -1; } - *out_start = (D_001940C0.ring_start + current_vu_chain) - size; - *out_end = (D_001940C0.ring_end + current_vu_chain) - size; + *out_start = (D_001940C0.ring_start + current_vu_chain) - byte_count; + *out_end = (D_001940C0.ring_end + current_vu_chain) - byte_count; return 0; } diff --git a/src/sdk/graph/sce_gs_set_def_disp_env.c b/src/sdk/graph/sce_gs_set_def_disp_env.c index d8954b1268..dd2d34523c 100644 --- a/src/sdk/graph/sce_gs_set_def_disp_env.c +++ b/src/sdk/graph/sce_gs_set_def_disp_env.c @@ -40,10 +40,13 @@ void sceGsSetDefDispEnv(struct sceGsDispEnv *output, u64 display_vertical; u64 progressive_width; - state = sceGsGetGParam(); - if (!((u32)(state->wMode - 2) < 2) && checkModelVersion() != 0) { - _GetGsDxDyOffset( - (s16)state->wMode, &kernel_horizontal, &kernel_vertical, &kernel_width, &kernel_height); + video_mode_state = sceGsGetGParam(); + if (!((u32)(video_mode_state->wMode - 2) < 2) && checkModelVersion() != 0) { + _GetGsDxDyOffset((s16)video_mode_state->wMode, + &kernel_horizontal, + &kernel_vertical, + &kernel_width, + &kernel_height); } else { kernel_height = 0; kernel_width = 0; diff --git a/src/sdk/ipu/sce_ipu_restart_dma.c b/src/sdk/ipu/sce_ipu_restart_dma.c index 6922be8a4e..054ec27340 100644 --- a/src/sdk/ipu/sce_ipu_restart_dma.c +++ b/src/sdk/ipu/sce_ipu_restart_dma.c @@ -22,9 +22,9 @@ void sceIpuRestartDMA(struct sceIpuDmaEnv *ctx) { bits = (u32)ctx->ipubp; magic = bits & 0x7F; - count = ((bits >> 16) & 3) + ((bits >> 8) & 0xF); - input_dma_address = ctx->d4madr - count * 0x10; - input_dma_quadword_count = ctx->d4qwc + count; + buffered_quadword_count = ((bits >> 16) & 3) + ((bits >> 8) & 0xF); + input_dma_address = ctx->d4madr - buffered_quadword_count * 0x10; + input_dma_quadword_count = ctx->d4qwc + buffered_quadword_count; if (ctx->d3madr != 0) { if (ctx->d3qwc != 0) { *(volatile u32 *)0x1000B010 = ctx->d3madr; diff --git a/src/sdk/mpeg/macroblock/skip_mb0.c b/src/sdk/mpeg/macroblock/skip_mb0.c index 06505e1c9e..0d3200527e 100644 --- a/src/sdk/mpeg/macroblock/skip_mb0.c +++ b/src/sdk/mpeg/macroblock/skip_mb0.c @@ -57,6 +57,6 @@ s32 _skipMB0(struct MpegDecoder *decoder, _Error(decoder, skipped_macroblock_in_i_picture_error_message); ok = 0; } - *macroblock_type_flags &= ~1; + *flags &= ~1; return ok; } diff --git a/src/sdk/rpc/iop/sce_sif_load_module_buffer.c b/src/sdk/rpc/iop/sce_sif_load_module_buffer.c index b66c8682f7..ec7fecec41 100644 --- a/src/sdk/rpc/iop/sce_sif_load_module_buffer.c +++ b/src/sdk/rpc/iop/sce_sif_load_module_buffer.c @@ -32,8 +32,8 @@ s32 _sceSifLoadModuleBuffer(s32 iop_address, memcpy(D_00158200 + 0x104, (void *)module_arguments, 0xFC); SIFCMD->arg_len_or_modres = 0xFC; } else { - memcpy(D_00158200 + 0x104, (void *)module_arguments, size); - SIFCMD->arg_len_or_modres = size; + memcpy(D_00158200 + 0x104, (void *)module_arguments, argument_byte_count); + SIFCMD->arg_len_or_modres = argument_byte_count; } } else { SIFCMD->arg_len_or_modres = 0; diff --git a/src/sdk/storage/fileio/sceClose.c b/src/sdk/storage/fileio/sceClose.c index 91ec1aa62a..b39d40a1a3 100644 --- a/src/sdk/storage/fileio/sceClose.c +++ b/src/sdk/storage/fileio/sceClose.c @@ -40,16 +40,16 @@ s32 sceClose(s32 fd) { _sceFsSigSema(); return -9; } - state->fd = io->fd; + close_request->fd = io->fd; sema.maxCount = 1; - state->iob_index = io - fio_iob; + close_request->iob_index = io - fio_iob; sema.initCount = 0; sema.option = 0; sid = CreateSema(&sema); - state->sema = sid; - state->result_addr = (s32)&close_completion_result; - state->result_size = 4; - if (sceSifCallRpc(&fio_rpc_client, 1, 0, state, 0x14, fio_rpc_result, 4, 0, 0) < 0) { + close_request->sema = sid; + close_request->result_addr = (s32)&close_completion_result; + close_request->result_size = 4; + if (sceSifCallRpc(&fio_rpc_client, 1, 0, close_request, 0x14, fio_rpc_result, 4, 0, 0) < 0) { DeleteSema(sid); _sceFsSigSema(); return -0xB; diff --git a/src/sdk/storage/memory_card/sce_mc_get_dir.c b/src/sdk/storage/memory_card/sce_mc_get_dir.c index 94921031b3..4fa465f80b 100644 --- a/src/sdk/storage/memory_card/sce_mc_get_dir.c +++ b/src/sdk/storage/memory_card/sce_mc_get_dir.c @@ -39,7 +39,7 @@ s32 sceMcGetDir(s32 port, s32 slot, s8 *name, s32 continue_search, s32 maxent, s } D_00159AB0.port = port; D_00159AB0.slot = path_arg; - D_00159AB0.mode = mode; + D_00159AB0.mode = continue_search; D_00159AB0.maxent = maxent; D_00159AB0.table = table; strncpy(D_00159AB0.name, name, 0x3FF); diff --git a/src/sdk/storage/memory_card/sce_mc_get_info.c b/src/sdk/storage/memory_card/sce_mc_get_info.c index b26c4e0dc5..e3b9380892 100644 --- a/src/sdk/storage/memory_card/sce_mc_get_info.c +++ b/src/sdk/storage/memory_card/sce_mc_get_info.c @@ -36,7 +36,7 @@ s32 sceMcGetInfo(s32 port, s32 slot, s32 card_type_output, s32 free_blocks, s32 D_00159A80.port = port; D_00159A80.slot = slot; D_00159A80.result = D_00159F00; - if (type != NULL) { + if (card_type_output != NULL) { D_00159A80.want_type = 1; } else { D_00159A80.want_type = 0; diff --git a/src/ui/map/draw_map_screen.c b/src/ui/map/draw_map_screen.c index 60db607177..571acdbb1c 100644 --- a/src/ui/map/draw_map_screen.c +++ b/src/ui/map/draw_map_screen.c @@ -127,9 +127,9 @@ s32 draw_map_screen(struct MenuScreen *screen) { } } - id = level_map_selection.level; + selected_map_id = level_map_selection.level; if (item_available[ITEM_MAP_SHIFT] != 0) { - id += 0x100; + selected_map_id += 0x100; } slot = find_map_entry_slot(selected_map_id); if (level_map_selection.level != level_map_selection.loaded && slot != -1) { diff --git a/src/ui/menus/item_preview/load_preview_resource_bindings.c b/src/ui/menus/item_preview/load_preview_resource_bindings.c index 7a089648a9..c169fe5ea7 100644 --- a/src/ui/menus/item_preview/load_preview_resource_bindings.c +++ b/src/ui/menus/item_preview/load_preview_resource_bindings.c @@ -34,8 +34,8 @@ void load_preview_resource_bindings(s32 first_resource, s32 resource_count) { binding_count = resource_count; resource_index = 0; menu_system.preview_resource_first = first_resource; - menu_system.preview_resource_count = count; - /* Testing the index, not count, lets combine drop the constant note on + menu_system.preview_resource_count = binding_count; + /* Testing the index, not binding_count, lets combine drop the constant note on its zero, so its live range is not doubled. */ if (resource_index < binding_count) { resource_offset = first_resource * 4; diff --git a/src/ui/menus/save_data/run_state_handler.c b/src/ui/menus/save_data/run_state_handler.c index e034c91457..95971d7a00 100644 --- a/src/ui/menus/save_data/run_state_handler.c +++ b/src/ui/menus/save_data/run_state_handler.c @@ -10,7 +10,7 @@ void run_state_handler(void) __asm__("FUN_00208840"); void run_state_handler(void) { s32 state = save_card_state; - save_card_state_handlers[state_before_handler](); + save_card_state_handlers[state](); D_00161280++; if (save_card_state != state) { D_00161280 = 0; diff --git a/src/ui/menus/save_data/save_card_state_good_save.c b/src/ui/menus/save_data/save_card_state_good_save.c index 6c4c94a1b8..91e1b155aa 100644 --- a/src/ui/menus/save_data/save_card_state_good_save.c +++ b/src/ui/menus/save_data/save_card_state_good_save.c @@ -22,12 +22,12 @@ void save_card_state_good_save(void) { save_card_state = CS_NOCARD; return; } - if (flags & 0x80) { + if (original_flags & 0x80) { save_card_state = CS_SAVE_FAILED; mode_freeze_flags = (nf ^ 0x80) | 0x40; return; } - if (flags & 0x100) { + if (original_flags & 0x100) { save_card_state = CS_LOAD_FAILED; mode_freeze_flags = (nf ^ 0x100) | 0x40; return; diff --git a/src/ui/menus/save_data/save_card_state_prompt_create_save.c b/src/ui/menus/save_data/save_card_state_prompt_create_save.c index 09e4bf661b..5381cdf874 100644 --- a/src/ui/menus/save_data/save_card_state_prompt_create_save.c +++ b/src/ui/menus/save_data/save_card_state_prompt_create_save.c @@ -22,8 +22,8 @@ void save_card_state_prompt_create_save(void) { } return; } - if (flags & 0x10) { - mode_freeze_flags = flags ^ 0x10; + if (freeze_flags_snapshot & 0x10) { + mode_freeze_flags = freeze_flags_snapshot ^ 0x10; save_card_state = CS_CREATE_SAVE_PENDING; } } diff --git a/src/ui/menus/save_data/save_card_state_saving.c b/src/ui/menus/save_data/save_card_state_saving.c index ae57f97f12..18d4c6abfe 100644 --- a/src/ui/menus/save_data/save_card_state_saving.c +++ b/src/ui/menus/save_data/save_card_state_saving.c @@ -17,12 +17,12 @@ void save_card_state_saving(void) { s32 updated_freeze_flags; if ((memory_card_state.state < MEMCARD_REQUEST_FORMAT) && - (memory_card_state.pending_state < MEMCARD_QUERY_INFO)) { + (memory_card_state.pending_state < 0)) { if (memory_card_state.err != 0) { mode_freeze_init(3, 0); save_card_state = CS_SAVE_FAILED; - flags = mode_freeze_flags | 0x40; - mode_freeze_flags = flags; + updated_freeze_flags = mode_freeze_flags | 0x40; + mode_freeze_flags = updated_freeze_flags; } else { save_card_state = CS_GOOD_SAVE; } diff --git a/src/ui/menus/stream_buffers/initialize_menu_stream_buffers.c b/src/ui/menus/stream_buffers/initialize_menu_stream_buffers.c index c6482b14e8..f70c7dd417 100644 --- a/src/ui/menus/stream_buffers/initialize_menu_stream_buffers.c +++ b/src/ui/menus/stream_buffers/initialize_menu_stream_buffers.c @@ -2,10 +2,10 @@ #include "rnc/ui/menus/menu_system.h" #include "rnc/ui/menus/stream_buffers.h" -void initialize_menu_stream_buffers(s32 mode) __asm__("FUN_00225ac0"); +void initialize_menu_stream_buffers(s32 use_full_buffer_layout) __asm__("FUN_00225ac0"); /* Mode zero writes one primary descriptor and clears four entries. - * Nonzero mode writes two primary descriptors, one secondary descriptor, + * Nonzero use_full_buffer_layout writes two primary descriptors, one secondary descriptor, * and two further primary descriptors. Address strides are 0x11800 for * the first two groups and 0x4F000 for the final group. The flag word * is one only for the final group. */ @@ -25,7 +25,7 @@ void initialize_menu_stream_buffers(s32 use_full_buffer_layout) { primary_address = menu_system.help_text_buffer; secondary_address = menu_system.stream_buffer_base; - if (mode == MENU_STREAM_MODE_SINGLE_PRIMARY_BUFFER) { + if (use_full_buffer_layout == MENU_STREAM_MODE_SINGLE_PRIMARY_BUFFER) { primary_count = 1; secondary_count = 0; large_count = 0; diff --git a/src/ui/menus/system/process_menu_entry.c b/src/ui/menus/system/process_menu_entry.c index 0557ec899d..573f616a9b 100644 --- a/src/ui/menus/system/process_menu_entry.c +++ b/src/ui/menus/system/process_menu_entry.c @@ -98,11 +98,11 @@ void process_menu_entry(void *callback_context, Menu *menu, s32 follow_entry_lin menu->entry_time = world_update_time; linked_entry_index = current_menu_entry->link; if (menu->current_entry != linked_entry_index) { - flags = current_menu_entry->flags; + source_entry_flags = current_menu_entry->flags; menu->current_entry = current_menu_entry->link; current_menu_entry = (MenuItem *)(menu->entries + linked_entry_index * 0x1C); menu->entry_flag = *(u8 *)¤t_menu_entry->flags & 1; - if (flags & 4) { + if (source_entry_flags & 4) { menu_entry_context[2] = (s32)callback_context; menu_entry_context[3] = (s32)menu; if (current_menu_entry->action & 0x4000) { diff --git a/src/ui/menus/system/setup_menu_display_text.c b/src/ui/menus/system/setup_menu_display_text.c index b5054aed64..7179154bdd 100644 --- a/src/ui/menus/system/setup_menu_display_text.c +++ b/src/ui/menus/system/setup_menu_display_text.c @@ -35,7 +35,7 @@ int setup_menu_display_text(struct MenuScreen *menu) { draw_moby_list(menu->data.preview.moby, 1); } setup_gif_paging(0); - collected_gold_bolt_count = 0; + count = 0; { int k; for (k = 0; k < 4; k++) { @@ -47,7 +47,7 @@ int setup_menu_display_text(struct MenuScreen *menu) { sprintf(formatted_menu_text, setup_menu_text_format, get_help_message_text(0x4F4F), - collected_gold_bolt_count, + count, get_help_message_text(0x4F53), gold_bolts_per_level[level_map_selection.level]); font_print_right( diff --git a/src/ui/menus/weapons/count_gold_bolts.c b/src/ui/menus/weapons/count_gold_bolts.c index c57f50e8e5..b61f39281a 100644 --- a/src/ui/menus/weapons/count_gold_bolts.c +++ b/src/ui/menus/weapons/count_gold_bolts.c @@ -11,7 +11,7 @@ s32 count_gold_bolts(void) { for (row = 0; row < 0x14; row++) { for (k = 0; k < 4; k++) { if (gold_bolts_collected[row * 4 + k] != 0) { - count++; + collected_bolt_count++; } } } diff --git a/src/world/update_world_object_animation.c b/src/world/update_world_object_animation.c index 15b2ab2bf6..6ea7b6fa64 100644 --- a/src/world/update_world_object_animation.c +++ b/src/world/update_world_object_animation.c @@ -125,7 +125,7 @@ void update_world_object_animation(void *unused_arg) { } mob = D_0018CB20_lui.slots[i]; if (mob == 0) { - mob = create_moby(id); + mob = create_moby(moby_id); idx = mob->pclass->seq_count; mob->pclass->seq_count = idx + 1; mob->seq = idx; From 06dc03820b9ab3159b4c34286a54396e487d21e5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:47:30 +0000 Subject: [PATCH 653/657] decomp: separate sand shark enum domains and finish particle count rename --- src/overlays/l02/mobys/sand_shark.c | 27 +++++++++++++----------- src/overlays/shared/weapons/suckcannon.c | 8 ++++--- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index d11a87244d..4e50a3b68d 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -48,6 +48,15 @@ enum { SAND_SHARK_WAIT_FOR_LINKED_MOBY_BEFORE_INITIALIZE = 29 }; +enum SandSharkRelaunchRequestState { + SAND_SHARK_RELAUNCH_REQUEST_CONSUMED = 1, + SAND_SHARK_RELAUNCH_REQUEST_PENDING = 2 +}; + +enum SandSharkTargetSelectionStatus { + SAND_SHARK_TARGET_SELECTION_EXCLUDED = 2 +}; + extern float sand_shark_dust_vertical_velocity_scale_gp __asm__("D_L02_001619D4") __attribute__((sda)); extern float sand_shark_dust_position_jitter_radius_gp __asm__("D_L02_001619DC") @@ -55,7 +64,8 @@ extern float sand_shark_dust_position_jitter_radius_gp __asm__("D_L02_001619DC") unsigned short D_L02_001619E0 = 0; /* Dust puff emitter, declared in the argument order the other levels use (pos, three floats, n, vel, size, colour). */ extern unsigned char * -spawn_puff(void *pos, float r, float lo, float hi, int n, void *vel, float size, int color) __asm__("FUN_L00_0026d000"); +spawn_puff(void *pos, float r, float lo, float hi, int n, void *vel, float size, int color) __asm__( + "FUN_L00_0026d000"); /* Emits n dust puffs evenly spaced along the segment from a to b. */ void emit_sand_shark_dust_puffs_along_segment(void *moby, @@ -265,7 +275,8 @@ extern void FUN_L00_00258278_c(void *, float, float *, float, float, float) __asm__("FUN_L00_00258278"); extern void move_moby_with_ground_and_collision_checks( void *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); -extern void play_entity_sound(void *, void *, float, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); +extern void play_entity_sound(void *, void *, float, int, float, float, int, int, int) __asm__( + "FUN_L00_002598b0"); extern void FUN_L00_0025a120_e50(void *) __asm__("FUN_L00_0025a120"); extern void turn_angle_e50(float *, float, float *, float, float, float) __asm__("FUN_L00_0025be00"); @@ -297,10 +308,6 @@ void sand_shark_update(struct Moby *moby) { enum { SAND_SHARK_LANDED_AFTER_KNOCKBACK = 0xB }; - enum { - SAND_SHARK_RELAUNCH_REQUEST_CONSUMED = 1, - SAND_SHARK_TARGET_SELECTION_EXCLUDED = 2 - }; Varsd3e50 *sand_shark_behavior_vars; OvlVec4 position_or_offset_scratch; OvlVec4 target_or_particle_vector; @@ -1258,7 +1265,8 @@ extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_ extern int FUN_L00_0025ff38(float, void *, void *, int, int, void *, int); extern int select_group_class_29c_moby(void *argp) __asm__("FUN_L02_002d5658"); extern void extend_group_sand_shark_timers(char *arg) __asm__("FUN_L02_002d5728"); -extern int resolve_moby_hit_response(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_00213928"); +extern int resolve_moby_hit_response(void *, void *, void *, int, int *, float *, int, int) __asm__( + "FUN_00213928"); extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); @@ -1270,11 +1278,6 @@ extern void update_hit_color_flash(void *, void *) __asm__("FUN_L00_0025d538"); void handle_sand_shark_damage_and_targeting(unsigned char *moby) __asm__("FUN_L02_002d5c88"); void handle_sand_shark_damage_and_targeting(unsigned char *moby) { - enum { - SAND_SHARK_RELAUNCH_REQUEST_CONSUMED = 1, - SAND_SHARK_RELAUNCH_REQUEST_PENDING = 2, - SAND_SHARK_TARGET_SELECTION_EXCLUDED = 2 - }; Vars5c88 *moby_vars = ((Vars5c88 *)MOBY(moby)->pvars); char *hit_record; int *path; diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 2d37840511..3804a3bf9f 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -507,9 +507,11 @@ extern char *mine_camera_blast(char *, char *, int, char *) __asm__("FUN_L00_ extern s32 scale_game_frames_c(s32) __asm__("func_001F96F8"); extern unsigned swap_packed_color_channels(unsigned, int) __asm__("FUN_L00_0025c0e8"); extern void -send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); +send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__( + "FUN_L00_0025a9f8"); extern void swap_color_channel_words(int *, int *, int *, int) __asm__("FUN_L00_0025c088"); -extern void spawn_particle(void *, void *, int, int, float, int, int, int, int, float) __asm__("FUN_L00_0026a9f0"); +extern void spawn_particle(void *, void *, int, int, float, int, int, int, int, float) __asm__( + "FUN_L00_0026a9f0"); extern char *func_L00_002E0CB8_DD3D8(float, void *, void *, @@ -3015,7 +3017,7 @@ void suck_beam_update(void *moby, void *position) { spawned_beam_particle_count = 0; sparks = 0; for (i = 0; i < 200; i++) { - if (!D_L00_001E4C80_lui[i].p && count < 5) { + if (!D_L00_001E4C80_lui[i].p && spawned_beam_particle_count < 5) { for (segment = 9; segment >= 0 && suck_beam_ring_alphas[segment] < 64; segment--) ; if (segment > 0) { From 859c028b1a98da3fac016ce92ee81d3b599d09ba Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:49:19 +0000 Subject: [PATCH 654/657] overlay: declare clarified camera and HUD globals in headers --- .../shared/camera/follow_camera_offset_effect_data.h | 6 ++++++ .../draw_trick_combo_hud_data/hud_release_held_element.h | 2 ++ src/overlays/shared/camera/follow_camera_offset_effect.c | 2 +- src/overlays/shared/ui/hud/draw_trick_combo_hud.c | 3 +-- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 include/rnc/overlay/shared/camera/follow_camera_offset_effect_data.h diff --git a/include/rnc/overlay/shared/camera/follow_camera_offset_effect_data.h b/include/rnc/overlay/shared/camera/follow_camera_offset_effect_data.h new file mode 100644 index 0000000000..5d93a4dc16 --- /dev/null +++ b/include/rnc/overlay/shared/camera/follow_camera_offset_effect_data.h @@ -0,0 +1,6 @@ +#ifndef LOMBYTE_RNC_OVERLAY_SHARED_CAMERA_FOLLOW_CAMERA_OFFSET_EFFECT_DATA_H +#define LOMBYTE_RNC_OVERLAY_SHARED_CAMERA_FOLLOW_CAMERA_OFFSET_EFFECT_DATA_H + +extern char camera_offset_effect_selection_gate[] __asm__("D_0013CA44"); + +#endif diff --git a/include/rnc/overlay/shared/ui/hud/draw_trick_combo_hud_data/hud_release_held_element.h b/include/rnc/overlay/shared/ui/hud/draw_trick_combo_hud_data/hud_release_held_element.h index 025acc183a..652f4006b9 100644 --- a/include/rnc/overlay/shared/ui/hud/draw_trick_combo_hud_data/hud_release_held_element.h +++ b/include/rnc/overlay/shared/ui/hud/draw_trick_combo_hud_data/hud_release_held_element.h @@ -7,4 +7,6 @@ * Keep its include at this declaration block: SN small-data ordering matters. */ extern int animation_parameter_target_id __asm__("D_L05_0015F980"); +extern short l05_hud_release_counter __asm__("D_L05_0015F978") __attribute__((sda)); + #endif /* LOMBYTE_RNC_OVERLAY_SHARED_UI_HUD_DRAW_TRICK_COMBO_HUD_DATA_HUD_RELEASE_HELD_ELEMENT_H */ diff --git a/src/overlays/shared/camera/follow_camera_offset_effect.c b/src/overlays/shared/camera/follow_camera_offset_effect.c index 0afe524189..9ade072551 100644 --- a/src/overlays/shared/camera/follow_camera_offset_effect.c +++ b/src/overlays/shared/camera/follow_camera_offset_effect.c @@ -22,7 +22,7 @@ void update_camera_offset_effect_state(void) __asm__("FUN_L02_002fa770"); extern CameraOffsetEffect camera_offset_effect __asm__("D_L02_00167600"); extern float D_L02_0016760C NOT_SDA; extern short camera_offset_effect_duration_step_gp __asm__("D_L02_0016238C") __attribute__((sda)); -extern char camera_offset_effect_selection_gate[] __asm__("D_0013CA44"); +#include "rnc/overlay/shared/camera/follow_camera_offset_effect_data.h" extern short camera_offset_effect_duration_step __asm__("D_L02_0016238C"); s32 D_L02_00167604[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/ui/hud/draw_trick_combo_hud.c b/src/overlays/shared/ui/hud/draw_trick_combo_hud.c index abfb3b7b2d..9468a1e41f 100644 --- a/src/overlays/shared/ui/hud/draw_trick_combo_hud.c +++ b/src/overlays/shared/ui/hud/draw_trick_combo_hud.c @@ -18,8 +18,7 @@ extern int D_L05_0015F97C; #include "rnc/overlay/shared/ui/hud/draw_trick_combo_hud_data/hud_release_held_element.h" -extern short l05_hud_release_counter __asm__("D_L05_0015F978") __attribute__((sda)); -void hud_release_held_element(void) __asm__("FUN_L05_00264298"); +void hud_release_held_element(void) __asm__("FUN_L05_00264298"); void hud_release_held_element(void) { if (animation_parameter_target_id != -1) { From 8bd70de59052db8a0f26c39f0e08628b77dabce4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:55:16 +0000 Subject: [PATCH 655/657] overlay: complete field and local renames against current main --- src/overlays/l01/mobys/peckbot.c | 21 ++++++++------- src/overlays/l02/mobys/sand_shark.c | 2 +- .../l03/mobys/moving_platform_small.c | 7 ++--- src/overlays/l04/mobys/leg_walker.c | 7 ++--- src/overlays/l04/mobys/woodcut_bot.c | 27 ++++++++++--------- src/overlays/l05/mobys/electric_gate.c | 6 ++--- src/overlays/l06/mobys/dual_texture_meshes.c | 22 +++++++-------- .../l07/mobys/command_falling_platform.c | 10 +++---- src/overlays/l07/mobys/snagglebeast.c | 22 ++++++++------- .../l10/mobys/data_processor_linked_effect.c | 2 +- src/overlays/l10/mobys/path_spark_effect.c | 6 +++-- src/overlays/l11/mobys/psytcopus.c | 11 ++++---- src/overlays/l11/mobys/teleporter.c | 5 ++-- src/overlays/l13/mobys/gemlik_projectile.c | 2 +- src/overlays/l13/mobys/mine.c | 4 +-- src/overlays/l13/mobys/qwarks_starfighter.c | 21 ++++++++------- src/overlays/l14/mobys/flying_car.c | 25 +++++++++-------- src/overlays/l16/mobys/conveyor_belt.c | 5 ++-- src/overlays/l17/mobys/magnet_elevator.c | 2 +- .../shared/camera/aim_volume_camera.c | 20 +++++++------- .../shared/camera/follow_camera_setup.c | 5 ++-- src/overlays/shared/camera/grindrail_camera.c | 5 ++-- .../shared/camera/moby_controlled_camera.c | 10 +++---- .../shared/camera/path_flythrough_camera.c | 6 ++--- src/overlays/shared/camera/scripted_camera.c | 6 ++--- .../shared/camera/swing_volume_camera.c | 25 +++++++++-------- src/overlays/shared/enemies/armed_transport.c | 8 +++--- src/overlays/shared/enemies/frog.c | 18 ++++++++----- .../shared/game/run_level_main_loop.c | 25 ++++++++--------- .../shared/hero/hero_handle_jump_press.c | 2 +- src/overlays/shared/hero/hero_idle_sequence.c | 26 +++++++++++------- src/overlays/shared/hero/set_hero_animation.c | 8 +++--- .../mobys/evaluate_moby_animation_pose.c | 2 +- src/overlays/shared/mobys/step_moby_motion.c | 7 ++--- src/overlays/shared/props/trespasser_pad.c | 8 +++--- .../rendering/effects/spawn_explosion.c | 14 ++++++---- .../ui/hud/draw_hud_item_selector_panel.c | 13 +++++---- src/overlays/shared/ui/hud/hud_keep_visible.c | 9 ++++--- .../ui/map/reveal_map_around_position.c | 4 +-- .../shared/ui/menus/initialize_pause_menu.c | 2 +- src/overlays/shared/weapons/bomb_glove.c | 9 ++++--- src/overlays/shared/weapons/doom_bot.c | 10 ++++--- src/overlays/shared/weapons/mine.c | 12 +++++---- src/overlays/shared/weapons/mine_glove.c | 6 ++--- 44 files changed, 261 insertions(+), 206 deletions(-) diff --git a/src/overlays/l01/mobys/peckbot.c b/src/overlays/l01/mobys/peckbot.c index 030f2c1817..c80d1c8240 100644 --- a/src/overlays/l01/mobys/peckbot.c +++ b/src/overlays/l01/mobys/peckbot.c @@ -98,7 +98,7 @@ typedef struct { u8 pad28; u8 x29; u8 pad2a[0xE]; - s32 x38; + s32 reduced_range_request; u8 pad3c[0x4]; Vec577 vel; u8 pad50[0x8]; @@ -114,12 +114,12 @@ typedef struct { struct KnockbackMotion knockback; s32 x180; u8 pad184[0x4]; - f32 x188; - f32 x18C; + f32 maximum_ground_drop; + f32 maximum_ground_rise; u8 pad190[0x8]; - f32 x198; + f32 movement_vertical_velocity; u8 pad19c[0x8]; - f32 x1A4; + f32 maximum_horizontal_movement_step; u8 pad1a8[0x28]; Vec577 home; Vec577 dest; @@ -130,15 +130,15 @@ typedef struct { u8 pad200[0x4]; f32 speed; s16 x208; - s16 x20A; + s16 stay_grounded; s32 idle_timer; s32 turn_timer; - s16 x214; - s16 x216; + s16 reduced_range_timer; + s16 maximum_leader_distance; Mob577 *leader; s32 path; u8 pad220[0x8]; - s32 x228; + s32 airborne_idle_timer; u8 pad22c[0x4]; u8 x230[0x10]; } Mob577Vars; @@ -166,7 +166,8 @@ extern s32 FUN_L00_001f35d8_cf(void) __asm__("FUN_001f0b58"); extern void FUN_L00_001ff500_cf(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L00_00257470(void *, s32, s32); extern void FUN_L00_00258278(void *, void *, f32, f32, f32, f32); -extern s32 move_moby_with_ground_and_collision_checks(void *, void *, void *, void *, f32) __asm__("FUN_L00_00258b50"); +extern s32 move_moby_with_ground_and_collision_checks(void *, void *, void *, void *, f32) __asm__( + "FUN_L00_00258b50"); extern void FUN_L00_0025a120(void *); extern void hit_reaction(void *, void *, void *, s32, void *, void *, s32, s32) __asm__("FUN_L00_0025a478"); diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 4e50a3b68d..3cd4401b5e 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -1239,7 +1239,7 @@ typedef struct { float base_target_selection_range; /* 0x24C */ float effective_target_selection_range; char pad254[8]; - short t25C; /* 0x25C */ + short proximity_range_refresh_delay; /* 0x25C */ short range_boost_timer; /* while it runs the target range is 5 longer */ char pad260[0x1C]; int selected_relaunch_moby; /* 0x27C */ diff --git a/src/overlays/l03/mobys/moving_platform_small.c b/src/overlays/l03/mobys/moving_platform_small.c index 717c55152b..eae4436598 100644 --- a/src/overlays/l03/mobys/moving_platform_small.c +++ b/src/overlays/l03/mobys/moving_platform_small.c @@ -164,9 +164,10 @@ void moving_platform_small_update(char *moby) { pc = &platform_pvars->path_cursor; path = *(int **)(pc + 0x10); path_node_step = pc[4]; - count = *path; - end = path_node_step < 0 ? 0 : count - 1; - next_path_node_index = (platform_pvars->path_cursor + count + path_node_step) % count; + path_node_count = *path; + end = path_node_step < 0 ? 0 : path_node_count - 1; + next_path_node_index = + (platform_pvars->path_cursor + path_node_count + path_node_step) % path_node_count; node_off = next_path_node_index * 0x10; platform_position = moby + 0x10; fast_vec_sub( diff --git a/src/overlays/l04/mobys/leg_walker.c b/src/overlays/l04/mobys/leg_walker.c index 86afd76667..6a065a6a41 100644 --- a/src/overlays/l04/mobys/leg_walker.c +++ b/src/overlays/l04/mobys/leg_walker.c @@ -309,7 +309,7 @@ void FUN_L04_00292d48(struct Moby *moby, LegRig *rig, int gait_mask) { fast_add_rotations(fast_subtract_rotations(leg->yaw, heading), leg->upper_turn), leg->lower_turn); base_yaw = fast_subtract_rotations(heading, twist); - if (rig->gait == 0 || (flags & mask) == 0) { + if (rig->gait == 0 || (gait_mask & mask) == 0) { leg->upper_turn = rig_turn_2d48(leg->upper_turn, 0.0f, &rig->legs[i].upper_turn_speed, @@ -380,7 +380,8 @@ extern s32 rig_probe(void *, s32, f32, struct Moby *, f32) __asm__("FUN_L00_001f extern f32 D_0015ED60; extern s32 D_L04_00173FF0[] NOT_SDA; -s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f32 step) __asm__("FUN_L04_00295778"); +s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f32 step) __asm__( + "FUN_L04_00295778"); s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f32 step) { union { @@ -533,7 +534,7 @@ s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f3 local.joints[5] = rig->jointB5; transform_scaled_vertex_batch(moby, 6, local.joints, rig); if (rig->gait == 0x12 && moby->seq == rig->anims[12]->id) - return flags; + return movement_constraint_flags; moby->anim_speed = 1.0f; if (rig->gait != 0) { LegRigAnim **fallback = rig->anims; diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index 3ea9bb8692..bd8e7828c0 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -284,7 +284,8 @@ extern void update_hit_color_flash(void *, void *) __asm__("FUN_L00_0025d538"); extern void select_moby_combat_target(void *, void *, float) __asm__("FUN_L00_0025fcb8"); extern void FUN_L00_00263ac8(float, void *, int, void *); extern void reset_walker_gait_helpers(void *) __asm__("FUN_L00_002a1538"); -extern void spawn_crate_debris(void *, void *, void *, void *, int, int, float, float) __asm__("FUN_L00_002af8b0"); +extern void spawn_crate_debris(void *, void *, void *, void *, int, int, float, float) __asm__( + "FUN_L00_002af8b0"); extern void reset_leg_rig_from_animation(void *, void *) __asm__("FUN_L04_00295de8"); extern void initialize_woodcut_bot_movement_data(void *) __asm__("FUN_L04_002d1418"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); @@ -425,8 +426,8 @@ void woodcut_bot_update(WBMoby *m) { d->knockback_descent_target_frame = 24.0f; m->state = WOODCUT_BOT_DEATH_KNOCKBACK; FUN_L00_00257470(m, 0, -1); - d->fB7 = 0x78; - start_hit_color_flash(m, d->fB0); + d->hit_response_first_channel_target = 0x78; + start_hit_color_flash(m, d->hit_response_interpolation_state); d->recoil_horizontal_step = (2.0f / scale_time(15.0f)) * 2.0f; break; case WOODCUT_BOT_REACTION_HIT_RECOVERY_AND_REPOSITION: @@ -447,10 +448,10 @@ void woodcut_bot_update(WBMoby *m) { } *(OvlQuad *)v = *(OvlQuad *)(p + 0x10); trooper_knockback_arc(v, &angle, &d->recoil_horizontal_step, &one); - d->fB7 = 0x78; - start_hit_color_flash(m, d->fB0); - d->t3C4 = scale_game_frames(0xF); - d->t3C6 = scale_game_frames(0xF0); + d->hit_response_first_channel_target = 0x78; + start_hit_color_flash(m, d->hit_response_interpolation_state); + d->hit_response_cooldown = scale_game_frames(0xF); + d->excitement_timer = scale_game_frames(0xF0); } break; case WOODCUT_BOT_REACTION_RECOIL_TO_IDLE: @@ -462,11 +463,11 @@ void woodcut_bot_update(WBMoby *m) { *(OvlQuad *)v = *(OvlQuad *)(p + 0x10); trooper_knockback_arc(v, &angle, &d->recoil_horizontal_step, &one); m->rot[2] = fast_add_rotations(3.1415927f, angle); - d->fB7 = 0x78; - start_hit_color_flash(m, d->fB0); - d->t3C4 = scale_game_frames(0x1E); - d->t3C2 = scale_game_frames(0xB4); - d->t3C6 = scale_game_frames(0xF0); + d->hit_response_first_channel_target = 0x78; + start_hit_color_flash(m, d->hit_response_interpolation_state); + d->hit_response_cooldown = scale_game_frames(0x1E); + d->action_selection_cooldown = scale_game_frames(0xB4); + d->excitement_timer = scale_game_frames(0xF0); break; case 7: case 8: @@ -946,7 +947,7 @@ void woodcut_bot_update(WBMoby *m) { { float recoil_scratch[16]; - update_hit_color_flash(m, d->fB0); + update_hit_color_flash(m, d->hit_response_interpolation_state); if (d->recoil_horizontal_step > 0.0f) { struct Hero *h = &hero; diff --git a/src/overlays/l05/mobys/electric_gate.c b/src/overlays/l05/mobys/electric_gate.c index 98f6cb1772..d25f6ee13d 100644 --- a/src/overlays/l05/mobys/electric_gate.c +++ b/src/overlays/l05/mobys/electric_gate.c @@ -170,13 +170,13 @@ void draw_electric_gate_beams(struct Moby *moby) { list = (unsigned short *)D_L05_001ABCC0[moby->group]; do { char *listed_moby; - offset = (*list & 0x7FFF) << 8; - listed_moby = (char *)(offset + (int)l05_moby_array); + moby_table_byte_offset = (*list & 0x7FFF) << 8; + listed_moby = (char *)(moby_table_byte_offset + (int)l05_moby_array); next_moby_index_ptr = list + 1; if (*(short *)(listed_moby + 0xA6) == 0x346 && *(unsigned char *)(listed_moby + 0x20) == 1) { copy_matrix_rotation(matrix, listed_moby + 0xC0); - qcopy(matrix + 0x30, (char *)(offset + (int)l05_moby_array) + 0x10); + qcopy(matrix + 0x30, (char *)(moby_table_byte_offset + (int)l05_moby_array) + 0x10); *(float *)(matrix + 0x3C) = 1.0f; for (k = 0; k < 5; k++) { draw_geometry_quad(&quads[0][k], matrix, 0); diff --git a/src/overlays/l06/mobys/dual_texture_meshes.c b/src/overlays/l06/mobys/dual_texture_meshes.c index 7fb4af54da..dbbd6f6ea4 100644 --- a/src/overlays/l06/mobys/dual_texture_meshes.c +++ b/src/overlays/l06/mobys/dual_texture_meshes.c @@ -5431,13 +5431,13 @@ void draw_dual_texture_50_quad_mesh(void) { second_pass_quad_packet.tex = get_effect_texture(0x2a); second_pass_quad_packet.tex1 = 0xFF9000000260L; first_pass_quad_packet.tex1 = 0xFF9000000260L; - flags = (long)dual_texture_mesh_blend_color_a_selector_gp; - flags |= (long)dual_texture_mesh_blend_color_b_selector_gp << 2; - flags |= (long)dual_texture_mesh_blend_alpha_c_selector_gp << 4; - flags |= (long)dual_texture_mesh_blend_color_d_selector_gp << 6; - flags |= (long)dual_texture_mesh_blend_fixed_alpha_gp << 32; - second_pass_quad_packet.alpha = flags; - first_pass_quad_packet.alpha = flags; + packed_blend_settings = (long)dual_texture_mesh_blend_color_a_selector_gp; + packed_blend_settings |= (long)dual_texture_mesh_blend_color_b_selector_gp << 2; + packed_blend_settings |= (long)dual_texture_mesh_blend_alpha_c_selector_gp << 4; + packed_blend_settings |= (long)dual_texture_mesh_blend_color_d_selector_gp << 6; + packed_blend_settings |= (long)dual_texture_mesh_blend_fixed_alpha_gp << 32; + second_pass_quad_packet.alpha = packed_blend_settings; + first_pass_quad_packet.alpha = packed_blend_settings; second_pass_quad_packet.clamp = 0; first_pass_quad_packet.clamp = 0; matrix_ptr = matrix; @@ -5503,8 +5503,8 @@ void draw_dual_texture_58_quad_mesh(void) { (long)dual_texture_mesh_blend_alpha_c_selector_gp << 4 | (long)dual_texture_mesh_blend_color_d_selector_gp << 6 | (long)dual_texture_mesh_blend_fixed_alpha_gp << 32; - mesh_second_pass_quad_packet.alpha = flags; - mesh_first_pass_quad_packet.alpha = flags; + mesh_second_pass_quad_packet.alpha = packed_quad_blend_settings; + mesh_first_pass_quad_packet.alpha = packed_quad_blend_settings; mesh_second_pass_quad_packet.tex1 = 0xFF9000000260L; mesh_first_pass_quad_packet.tex1 = 0xFF9000000260L; mesh_second_pass_quad_packet.clamp = 0; @@ -5576,8 +5576,8 @@ void draw_dual_texture_864_quad_mesh(void) { (long)dual_texture_mesh_blend_alpha_c_selector_gp << 4 | (long)dual_texture_mesh_blend_color_d_selector_gp << 6 | (long)dual_texture_mesh_blend_fixed_alpha_gp << 32; - second_texture_pass_quad_packet.alpha = flags; - first_texture_pass_quad_packet.alpha = flags; + second_texture_pass_quad_packet.alpha = packed_texture_pass_blend_settings; + first_texture_pass_quad_packet.alpha = packed_texture_pass_blend_settings; second_texture_pass_quad_packet.tex1 = 0xFF9000000260L; first_texture_pass_quad_packet.tex1 = 0xFF9000000260L; second_texture_pass_quad_packet.clamp = 0; diff --git a/src/overlays/l07/mobys/command_falling_platform.c b/src/overlays/l07/mobys/command_falling_platform.c index 2e166e9b1f..adb57af0e8 100644 --- a/src/overlays/l07/mobys/command_falling_platform.c +++ b/src/overlays/l07/mobys/command_falling_platform.c @@ -16,7 +16,7 @@ #include "rnc/overlay/shared/mobys/count_active_moby_group_members.h" #include "rnc/overlay/shared/rendering/effects/spawn_explosion.h" -/* steps a hit-effect emitter: orient, spawn a puff, and reseed the timer */ +/* steps a hit-effect emitter: orient, spawn a puff, and reseed the random_bits_or_sink_hold_frames */ /* Ported from rac1-decomp (src/overlays/l07_umbris/vendor_002CE470.c: func_L07_00313690), where it is exact; names translated to the US level program. */ extern int FUN_0022da68(int, int, int); extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); @@ -102,8 +102,8 @@ void command_falling_platform_update(char *moby) { falling_platform_vars->max_health = 0; falling_platform_vars->hit_weight = 4; falling_platform_vars->target_flags = 13; - timer = rand(); - if (timer & 1) + random_bits_or_sink_hold_frames = rand(); + if (random_bits_or_sink_hold_frames & 1) MOBY(moby)->rot.z = fast_add_rotations(MOBY(moby)->rot.z, 3.1415927f); falling_platform_vars->saved_rot_x = MOBY(moby)->rot.x; falling_platform_vars->saved_rot_y = MOBY(moby)->rot.y; @@ -199,8 +199,8 @@ void command_falling_platform_update(char *moby) { if (hero.air_frames.s == 0 && (char *)hero.ground_moby == moby) { if (falling_platform_vars->sway_timer == 0) FUN_0022da68(0, 0, (int)moby); - timer = scale_game_frames(90); - if (falling_platform_vars->sway_timer < timer) + random_bits_or_sink_hold_frames = scale_game_frames(90); + if (falling_platform_vars->sway_timer < random_bits_or_sink_hold_frames) falling_platform_vars->sway_timer = scale_game_frames(90); } if (falling_platform_vars->sway_timer != 0) { diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index 73d56caaaa..c386465d77 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -339,11 +339,12 @@ void draw_snagglebeast_rope_attack_layer( qcopy(&quad.positions[0], &quad.positions[1]); qcopy(&quad.positions[2], &quad.positions[3]); wrapped = normalize_angle(angle + spin * 0.02f); - offset[1] = radius * fast_cos(wrapped); - offset[2] = radius * fast_sin(wrapped); - offset[0] = 0.0f; - transform_vector_by_basis(offset, offset, moby + 0xC0); - fast_vec_add(&quad.positions[3], rope_layer_moby_vars->rope_tip_position, offset); + rope_radial_offset[1] = radius * fast_cos(wrapped); + rope_radial_offset[2] = radius * fast_sin(wrapped); + rope_radial_offset[0] = 0.0f; + transform_vector_by_basis(rope_radial_offset, rope_radial_offset, moby + 0xC0); + fast_vec_add( + &quad.positions[3], rope_layer_moby_vars->rope_tip_position, rope_radial_offset); if (angle != -3.1415927f) { draw_geometry_quad(&quad, 0, 1); qcopy(&inner.positions[2], &quad.positions[2]); @@ -444,7 +445,8 @@ void *collect_snagglebeast_navigation_ids(void *unused, void *dp, void *op) { return (void *)output_count; } -extern int resolve_moby_hit_response(void *, void *, void *, int, int *, int, int, int) __asm__("FUN_00213928"); +extern int resolve_moby_hit_response(void *, void *, void *, int, int *, int, int, int) __asm__( + "FUN_00213928"); extern void FUN_L00_00257470(void *, int, int); extern void start_hit_color_flash(void *, void *) __asm__("FUN_L00_0025d458"); extern void update_hit_color_flash(void *, void *) __asm__("FUN_L00_0025d538"); @@ -683,7 +685,8 @@ extern s32 level_frame_count_lui __asm__("D_L07_0015F5CC"); extern float D_0015ED6C; extern struct ChaserTarget D_L07_00173EC0; extern int step_mover_2e3f20(struct Moby *, void *, int, void *) __asm__("FUN_L00_00259028"); -extern int probe_vertical_ground_collision(void *, struct Moby *, int, float, float) __asm__("FUN_L00_002583f0"); +extern int probe_vertical_ground_collision(void *, struct Moby *, int, float, float) __asm__( + "FUN_L00_002583f0"); int update_snagglebeast_chase_movement(struct Moby *chaser_moby, struct ChaserVars *chaser_vars, Vec4 *goal, @@ -959,7 +962,8 @@ extern void spawn_moby_point_offset_particle(char *, int, float, float) __asm__( extern int update_alternating_joint_emission_burst(void *, char *, float *) __asm__("FUN_L07_003122b0"); extern int is_value_within_interpolated_window(void *, float) __asm__("FUN_00214cc8"); -extern void *spawn_fading_ring_effect(int, void *, int, float, float, float, float, float) __asm__("FUN_L07_0030dbb0"); +extern void *spawn_fading_ring_effect(int, void *, int, float, float, float, float, float) __asm__( + "FUN_L07_0030dbb0"); extern void FUN_L00_0024f7c8(void *, int, void *); extern void configure_timed_point_light( void *, void *, int, void *, short, unsigned int, int, float) __asm__("FUN_L07_00311eb8"); @@ -1637,7 +1641,7 @@ void snagglebeast_update(unsigned char *moby) { } MOBY(moby)->state = SNAGGLEBEAST_SWEEP_BEAM_ATTACK; } - if (timer194) { + if (triple_spawn_attack_ready) { snagglebeast_instance_state->substate = 0; if (MOBY(moby)->prev_seq != 4) { int r = random_int_between(0, 5); diff --git a/src/overlays/l10/mobys/data_processor_linked_effect.c b/src/overlays/l10/mobys/data_processor_linked_effect.c index df9d70d195..6feeb6ae29 100644 --- a/src/overlays/l10/mobys/data_processor_linked_effect.c +++ b/src/overlays/l10/mobys/data_processor_linked_effect.c @@ -282,7 +282,7 @@ void render_data_processor_linked_effect(u8 *moby) { *(float *)(linked_processor_vars + 0x12de0); } for (i = 0; i < linked_effect_render_vars->strip_count; i = next_strip_index) { - int offset; + int strip_transform_byte_offset; int age; float progress; unsigned int color; diff --git a/src/overlays/l10/mobys/path_spark_effect.c b/src/overlays/l10/mobys/path_spark_effect.c index f3b25a6997..ee8843005f 100644 --- a/src/overlays/l10/mobys/path_spark_effect.c +++ b/src/overlays/l10/mobys/path_spark_effect.c @@ -25,7 +25,8 @@ typedef struct { } EffectData; extern void -send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); +send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__( + "FUN_L00_0025a9f8"); void path_spark_effect_update(char *moby) __asm__("FUN_L10_002dd3d8"); @@ -71,7 +72,8 @@ void path_spark_effect_update(char *moby) { convert_integer_to_float(truncate_float_to_s32(10.0f / (frame_time * 5.0f)) / 4) * 0.5f; } if (MOBY(moby)->pclass->scale * 0.25f < MOBY(moby)->scale) { - int count = collect_mobies_in_sphere(moby + 0x10, 0.15f, 16, effect_data->blast_source, 0); + int nearby_moby_count = + collect_mobies_in_sphere(moby + 0x10, 0.15f, 16, effect_data->blast_source, 0); *(OvlQuad *)blast_hit_position = *(OvlQuad *)&MOBY(moby)->pos; send_blast_hits(effect_data->blast_source, blast_hit_position, diff --git a/src/overlays/l11/mobys/psytcopus.c b/src/overlays/l11/mobys/psytcopus.c index 738a4e2b4d..b0481173b9 100644 --- a/src/overlays/l11/mobys/psytcopus.c +++ b/src/overlays/l11/mobys/psytcopus.c @@ -1,3 +1,7 @@ +enum { + PSYTCOPUS_PROJECTILE_CREATION_BLOCKED = 2 +}; + /* Level 11 moby class psytcopus: hits and its path state machine. */ #include "types.h" #include "rnc/overlay/shared/mobys/hit_color_flash.h" @@ -26,7 +30,8 @@ enum { extern float approach_angle(float *p, float a, float *v, float b, float c, float d) __asm__("FUN_L00_0025be00"); extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern int resolve_moby_hit_response(void *, void *, float *, int, int *, int, int, int) __asm__("FUN_00213928"); +extern int resolve_moby_hit_response(void *, void *, float *, int, int *, int, int, int) __asm__( + "FUN_00213928"); /* pvars of the moby run by psytcopus_update (FUN_L11_00310698 does its hit handling) */ struct PokiPathVars { @@ -89,10 +94,6 @@ FUN_L00_0025f3e8_p(struct Moby *, void *, int, float, float) __asm__("FUN_L00_00 #include "rnc/overlay/l11/mobys/psytcopus_data/psytcopus_update.h" -enum { - PSYTCOPUS_PROJECTILE_CREATION_BLOCKED = 2 -}; - extern float D_L11_00161F9C __attribute__((sda)); extern void set_moby_position_and_refresh_removal_timer(void *, void *) __asm__("FUN_L11_00318e78"); extern void FUN_L00_0025ab48_p(void *, float *, float *, float *) __asm__("FUN_L00_0025ab48"); diff --git a/src/overlays/l11/mobys/teleporter.c b/src/overlays/l11/mobys/teleporter.c index 670a81e1eb..d5cad1395f 100644 --- a/src/overlays/l11/mobys/teleporter.c +++ b/src/overlays/l11/mobys/teleporter.c @@ -26,7 +26,8 @@ extern void FUN_L11_002f2cd0_2518(char *) __asm__("FUN_L11_002f2cd0"); extern void FUN_L11_002f2d58_2518(char *) __asm__("FUN_L11_002f2d58"); extern void update_teleporter_child_transforms(char *) __asm__("FUN_L01_003092d0"); extern void request_hero_target_pose(float *, int, float) __asm__("FUN_L00_00233ee8"); -extern void FUN_L00_002598b0_2518(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); +extern void FUN_L00_002598b0_2518(int, float, void *, int, float, float, int, int, int) __asm__( + "FUN_L00_002598b0"); extern int get_hero_target_pose_status(void) __asm__("FUN_L00_00233f38"); extern void advance_accelerated_scalar(float *, float *, float, float, float, float) __asm__("FUN_00213f38"); @@ -353,7 +354,7 @@ void restore_teleporter_visibility_and_collision(struct Moby *moby) __asm__("FUN void restore_teleporter_visibility_and_collision(struct Moby *moby) { TeleporterVars *teleporter_vars = (TeleporterVars *)moby->pvars; char **child = teleporter_vars->parts; - int count; + int child_slot_countdown; int on; moby->visible = 1; moby->flags &= 0xFFFE; diff --git a/src/overlays/l13/mobys/gemlik_projectile.c b/src/overlays/l13/mobys/gemlik_projectile.c index 5120d01dd5..1da7e0a32e 100644 --- a/src/overlays/l13/mobys/gemlik_projectile.c +++ b/src/overlays/l13/mobys/gemlik_projectile.c @@ -114,7 +114,7 @@ void gemlik_projectile_update(struct Moby *moby) { L13Vec_p random_direction; } work; int i; - int flags; + int hit_descriptor_flags; int skip_level; unsigned char *hero_bytes; char *ent; diff --git a/src/overlays/l13/mobys/mine.c b/src/overlays/l13/mobys/mine.c index ff4b3c5111..526459f093 100644 --- a/src/overlays/l13/mobys/mine.c +++ b/src/overlays/l13/mobys/mine.c @@ -172,9 +172,9 @@ void level_13_mine_update(ProjectileMoby *moby) { cls_id == 0x18F || cls_id == 0x190) detonation_flags = 0; } - if (flags != 0) { + if (detonation_flags != 0) { if (moby->visible != 0) { - if ((flags & 0x2000) != 0) { + if ((detonation_flags & 0x2000) != 0) { func_L00_0025F4A8_alt(moby, velocity, 0, diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index 3a16741cab..9e7d101994 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -86,7 +86,8 @@ extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); extern void start_hit_color_flash(void *m, void *p) __asm__("FUN_L00_0025d458"); -extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__("FUN_L00_00258110"); +extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__( + "FUN_L00_00258110"); extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); @@ -779,12 +780,12 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { } if (dd->health <= r->damage_amount) { func_L13_002EAC18_2EAE80(moby, moby_data, dd, r); - mode = ATTACHMENT_DAMAGE_LETHAL; + damage_outcome = ATTACHMENT_DAMAGE_LETHAL; moby_data->first->hit_slot = 0xFF; } else { dd->health = dd->health - r->damage_amount; moby_data->hit_flash.flash_red = 0xFA; - mode = ATTACHMENT_DAMAGE_APPLIED; + damage_outcome = ATTACHMENT_DAMAGE_APPLIED; moby_data->sub.h6 = scale_game_frames(0); start_hit_color_flash(moby, &moby_data->hit_flash); moby_data->first->hit_slot = 0xFF; @@ -833,7 +834,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { } moby_data->voice_line_flags = 0; moby_data->b148 = 0; - mode = ATTACHMENT_DAMAGE_STAGE_ADVANCED; + damage_outcome = ATTACHMENT_DAMAGE_STAGE_ADVANCED; if (moby->command == 7) { for (j = moby->command - 1; j < 10; j++) { func_L13_002EAAB8_2EAE80( @@ -878,12 +879,12 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { } if (dd->health <= r->damage_amount) { func_L13_002EAC18_2EAE80(moby, moby_data, dd, r); - mode = ATTACHMENT_DAMAGE_LETHAL; + damage_outcome = ATTACHMENT_DAMAGE_LETHAL; moby_data->list[i]->hit_slot = 0xFF; } else { dd->health = dd->health - r->damage_amount; moby_data->hit_flash.flash_red = 0xFA; - mode = ATTACHMENT_DAMAGE_APPLIED; + damage_outcome = ATTACHMENT_DAMAGE_APPLIED; moby_data->sub.h6 = scale_game_frames(0); start_hit_color_flash(moby, &moby_data->hit_flash); moby_data->list[i]->hit_slot = 0xFF; @@ -930,7 +931,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { } moby_data->voice_line_flags = 0; moby_data->b148 = 0; - mode = ATTACHMENT_DAMAGE_STAGE_ADVANCED; + damage_outcome = ATTACHMENT_DAMAGE_STAGE_ADVANCED; if (moby->command == 7) { for (k = moby->command - 1; k < 10; k++) { func_L13_002EAAB8_2EAE80( @@ -1561,7 +1562,8 @@ extern char qwarks_starfighter_tractor_offscreen_abort_message[] __asm__("D_L13_ extern float D_L13_00160660[] MACRO_ADDR; -extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__("FUN_L00_00258110"); +extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__( + "FUN_L00_00258110"); extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); @@ -1579,7 +1581,8 @@ extern int qwarks_starfighter_attachment_class_ids[] __asm__("D_L13_001D34D8"); extern int DebugPrint_alt() __asm__("FUN_001e93b0"); -extern int allocate_colored_effect_slot(float *, float, float, float, float, float) __asm__("FUN_L00_0023e738"); +extern int allocate_colored_effect_slot(float *, float, float, float, float, float) __asm__( + "FUN_L00_0023e738"); extern int queue_animation_update(int, int, int, int, int, int, int) __asm__("FUN_001ff308"); diff --git a/src/overlays/l14/mobys/flying_car.c b/src/overlays/l14/mobys/flying_car.c index cba866d9aa..00256ee179 100644 --- a/src/overlays/l14/mobys/flying_car.c +++ b/src/overlays/l14/mobys/flying_car.c @@ -58,17 +58,17 @@ typedef struct { float yaw_spring_state; char pad9C[4]; int part; /* 0xA0 */ - float fA4; - float fA8; - float fAC; - int fB0; - int fB4; + float attached_part_local_offset_x; + float attached_part_local_offset_y; + float attached_part_local_offset_z; + int sink_offset; + int sink_offset_step; int fB8; - int fBC; - int fC0; + int rotation_oscillation_common_phase; + int rotation_oscillation_axis_phase; int trigger; /* 0xC4 */ int fC8; - int fCC; + int attached_part_interaction_hold_timer_frames; Fx_6ee0 fx; /* 0xD0 */ } Data_6ee0; @@ -105,7 +105,8 @@ extern void fill_transfer_words(void *, int, int) __asm__("FUN_001f97e8"); extern void start_hit_color_flash(void *, void *) __asm__("FUN_L00_0025d458"); -extern void update_moby_rotation_oscillation(void *, void *, void *, float, float, float) __asm__("FUN_L00_00262b80"); +extern void update_moby_rotation_oscillation(void *, void *, void *, float, float, float) __asm__( + "FUN_L00_00262b80"); extern int FUN_L14_00307620_6ee0(void *) __asm__("FUN_L14_00307620"); @@ -331,7 +332,8 @@ extern char *D_L14_0015FFD8_7620 __asm__("D_L14_0015FFD8"); extern float D_L14_00162274 __attribute__((sda)); -extern int sample_path(char *path, float *out, void *pos, void *t, int dir, float step) __asm__("FUN_L00_0025d808"); +extern int sample_path(char *path, float *out, void *pos, void *t, int dir, float step) __asm__( + "FUN_L00_0025d808"); extern void cart_burst(void *, void *, f32, f32, s32) __asm__("FUN_L00_0025f090"); @@ -473,6 +475,7 @@ void seed_linked_record_for_flying_car(u8 *flying_car_moby) { *(f32 *)(linked_record + 0xB0) = 2.0f; } -extern int sample_path(char *path, float *out, void *seg, void *t, int dir, float step) __asm__("FUN_L00_0025d808"); +extern int sample_path(char *path, float *out, void *seg, void *t, int dir, float step) __asm__( + "FUN_L00_0025d808"); int flying_car_path_reset_delay_frames_gp __asm__("D_L14_0016227C") = 0x1f4; diff --git a/src/overlays/l16/mobys/conveyor_belt.c b/src/overlays/l16/mobys/conveyor_belt.c index 5a19964a73..d6894a680a 100644 --- a/src/overlays/l16/mobys/conveyor_belt.c +++ b/src/overlays/l16/mobys/conveyor_belt.c @@ -19,7 +19,8 @@ extern float D_0015ED6C; -void update_conveyor_group_motion_transforms(int index, void *conveyor_motion_vector) __asm__("FUN_L16_002c9c38"); +void update_conveyor_group_motion_transforms(int index, void *conveyor_motion_vector) __asm__( + "FUN_L16_002c9c38"); extern void add_draw_callback(void (*)(void), void *) __asm__("FUN_001f4600"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern float D_0015ED6C, frame_time; @@ -207,7 +208,7 @@ void draw_conveyor_belt_strips(struct Moby *moby) { L16RibbonPacket_u packets[2]; ConveyorBeltVars *conveyor_data = (ConveyorBeltVars *)moby->pvars; float scale = fast_vec_length(D_L16_001600EC_m + ((conveyor_data->belt_cuboid) << 7)) * 2.001f; - int count = truncate_float_to_s32(scale); + int interior_strip_count = truncate_float_to_s32(scale); float step = 2.0f / scale; int period, tint, color, limit, j; float phase; diff --git a/src/overlays/l17/mobys/magnet_elevator.c b/src/overlays/l17/mobys/magnet_elevator.c index b214659e13..e9e487ab03 100644 --- a/src/overlays/l17/mobys/magnet_elevator.c +++ b/src/overlays/l17/mobys/magnet_elevator.c @@ -321,6 +321,6 @@ void rebuild_magnet_elevator_world_path(struct Moby *moby) { *(float *)(world_path_point + 0xC) = 1.0f; world_path_point += 0x10; } - hero.path_constrain_pending = *(unsigned short *)(elevator_private_state + 0x80); + hero.path_constrain_pending = *(unsigned short *)(state + 0x80); } } diff --git a/src/overlays/shared/camera/aim_volume_camera.c b/src/overlays/shared/camera/aim_volume_camera.c index b0981dad6d..814bdcc2cb 100644 --- a/src/overlays/shared/camera/aim_volume_camera.c +++ b/src/overlays/shared/camera/aim_volume_camera.c @@ -148,7 +148,7 @@ void volume_camera_aim(struct UpdateCam *aim_camera_record) { follow = &rig->follow; tail = &rig->tail; snap = &rig->tail.snap; - /* A second pointer to the same state: retail keeps both. */ + /* A second pointer to the same current_follow_camera_state: retail keeps both. */ current_follow_camera_state = rig; reset = ¤t_follow_camera_state->reset; qcopy(rec_pos, pos); @@ -156,16 +156,18 @@ void volume_camera_aim(struct UpdateCam *aim_camera_record) { tail->pivot_height = params->height; follow->look_height = params->offset_scale; fast_vec_scale(gravity_offset, &hero.gravity_dir, -tail->pivot_height); - fast_vec_add(state->follow.pivot, &hero.motion.pos, gravity_offset); - fast_vec_sub(tail->eye_offset, pos, state->follow.pivot); - qcopy(state->tail.saved_eye_offset, tail->eye_offset); + fast_vec_add(current_follow_camera_state->follow.pivot, &hero.motion.pos, gravity_offset); + fast_vec_sub(tail->eye_offset, pos, current_follow_camera_state->follow.pivot); + qcopy(current_follow_camera_state->tail.saved_eye_offset, tail->eye_offset); fast_vec_scale(gravity_offset, &hero.gravity_dir, -follow->look_height); - fast_vec_add(state->follow.look_target, &hero.motion.pos, gravity_offset); - qcopy(state->follow.snap_look_target, state->follow.look_target); + fast_vec_add( + current_follow_camera_state->follow.look_target, &hero.motion.pos, gravity_offset); + qcopy(current_follow_camera_state->follow.snap_look_target, + current_follow_camera_state->follow.look_target); qcopy(follow->focus, &hero.motion.pos); - qcopy(state->follow.offset, follow->focus); - qcopy(state->position, rec_pos); - qcopy(state->tail.snap.shot_pos, rec_pos); + qcopy(current_follow_camera_state->follow.offset, follow->focus); + qcopy(current_follow_camera_state->position, rec_pos); + qcopy(current_follow_camera_state->tail.snap.shot_pos, rec_pos); *(s32 *)&snap->distance_reduction = 0; *(s32 *)&reset->pitch_bias = 0; reset->look_height = follow->look_height; diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 8fc7aca542..d053e447ef 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -887,7 +887,7 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { reset_follow_camera_state_from_position(camera_moby); qcopy(camera_moby->v40, camera_moby->v0); if (D_L00_00166E04->camera_class == 7 && D_0013F450_2E8210.h30C == 0) { - e->e.h0 = 0; + e->e.height_state_timer = 0; } else { camera_height_state->height_state_timer = scale_game_frames(D_L00_00161D24_gp); } @@ -1272,7 +1272,8 @@ extern int test_follow_camera_point_in_collision_volume(void *) __asm__( extern int FUN_L00_001f0d60_2e7a30(void *, int, int, float) __asm__("FUN_L00_001f0d60"); extern int FUN_L00_002e79c8_2e7a30(void *, int, void *, float) __asm__("FUN_L00_002e79c8"); -int resolve_follow_camera_orbit_path_collisions(unsigned char *camera_moby) __asm__("FUN_L00_002e7a30"); +int resolve_follow_camera_orbit_path_collisions(unsigned char *camera_moby) __asm__( + "FUN_L00_002e7a30"); int resolve_follow_camera_orbit_path_collisions(unsigned char *camera_moby) { OvlQuad initial_orbit_vector[1]; diff --git a/src/overlays/shared/camera/grindrail_camera.c b/src/overlays/shared/camera/grindrail_camera.c index 2285d35ebe..13e278bc29 100644 --- a/src/overlays/shared/camera/grindrail_camera.c +++ b/src/overlays/shared/camera/grindrail_camera.c @@ -119,7 +119,8 @@ extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s /* Resets the camera's orbit, focus, spring, view and track from fixed values; for a kind 2 preset it also prepares its two paths once, measuring each point against the path it follows. */ -void reset_camera_state_and_prepare_preset_paths(Camera *destination_camera) __asm__("FUN_L01_00314e98"); +void reset_camera_state_and_prepare_preset_paths(Camera *destination_camera) __asm__( + "FUN_L01_00314e98"); void reset_camera_state_and_prepare_preset_paths(Camera *destination_camera) { Vec4 at; @@ -330,7 +331,7 @@ void update_camera_position_and_orientation_from_paths(Cam *camera_to_update) { CameraPreset *camera_path_preset = l01_camera_preset_rows_macro[camera_to_update->preset].preset; float rate = 0.01f; - int mode = camera_path_preset->kind; + int preset_kind = camera_path_preset->kind; int path_index = camera_path_preset->track_path; float lead = camera_path_preset->lead; float pitch_error; diff --git a/src/overlays/shared/camera/moby_controlled_camera.c b/src/overlays/shared/camera/moby_controlled_camera.c index 7a3d530ba0..f7c4887bf9 100644 --- a/src/overlays/shared/camera/moby_controlled_camera.c +++ b/src/overlays/shared/camera/moby_controlled_camera.c @@ -236,7 +236,7 @@ void apply_moby_camera_control(char *moby) { } if (*(signed char *)(first_group_target + 0x20) < 0) { do { - if ((id << 16) < 0) { + if ((encoded_group_target << 16) < 0) { moby_camera_control_record->active_frames = -1; clear_follow_camera_volume_if_current(moby); return; @@ -313,11 +313,11 @@ void apply_moby_camera_control(char *moby) { if (moby_camera_control_record->mode == 7) { if (controller_state.analog[0] != 0.0f) moby_camera_control_record->active_frames = duration; - count = moby_camera_control_record->active_frames; - if (count >= duration) { + wait_or_elapsed_frames = moby_camera_control_record->active_frames; + if (wait_or_elapsed_frames >= duration) { active = 0; moby_camera_control_record->idle_frames += 1; - if (duration + scale_game_frames(30) < count) { + if (duration + scale_game_frames(30) < wait_or_elapsed_frames) { scale = 0.1f; active = 1; } @@ -340,7 +340,7 @@ void apply_moby_camera_control(char *moby) { if (moby_camera_control_record->active_frames >= duration) { int waited = (unsigned short)moby_camera_control_record->idle_frames + 1; moby_camera_control_record->idle_frames = waited; - if ((short)waited >= count) { + if ((short)waited >= wait_or_elapsed_frames) { if (test_moby_camera_target_angle_limits(moby, 30.0f, 0.0f) != 0) moby_camera_control_record->active_frames = end; else diff --git a/src/overlays/shared/camera/path_flythrough_camera.c b/src/overlays/shared/camera/path_flythrough_camera.c index e874ad0374..16760cf00e 100644 --- a/src/overlays/shared/camera/path_flythrough_camera.c +++ b/src/overlays/shared/camera/path_flythrough_camera.c @@ -249,9 +249,9 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { } else { fast_vec_sub(initial_aim_or_previous_position, look_path + 0x10, &cam->pos); } - fast_vec_scale(offset, D_0013F5E0_5f18, -1.0f); + fast_vec_scale(orientation_vector, D_0013F5E0_5f18, -1.0f); fast_vec_normalize(&cam->forward, initial_aim_or_previous_position, 1.0f); - fast_vec_cross(&cam->right, &cam->forward, offset); + fast_vec_cross(&cam->right, &cam->forward, orientation_vector); fast_vec_normalize(&cam->right, &cam->right, 1.0f); fast_vec_cross(&cam->up, &cam->right, &cam->forward); } @@ -351,7 +351,7 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { fast_vec_sub(orientation_vector, point, &cam->pos); } fast_vec_scale(point, D_0013F5E0_5f18, -1.0f); - fast_vec_normalize(&cam->forward, offset, 1.0f); + fast_vec_normalize(&cam->forward, orientation_vector, 1.0f); fast_vec_cross(&cam->right, &cam->forward, point); fast_vec_normalize(&cam->right, &cam->right, 1.0f); fast_vec_cross(&cam->up, &cam->right, &cam->forward); diff --git a/src/overlays/shared/camera/scripted_camera.c b/src/overlays/shared/camera/scripted_camera.c index 140d382c1c..d94b74279b 100644 --- a/src/overlays/shared/camera/scripted_camera.c +++ b/src/overlays/shared/camera/scripted_camera.c @@ -149,14 +149,14 @@ void jet_end_mount(int camera_handoff_request) { FUN_001f9a10_2eac18(camera_position, hero_rotation - 0x10, camera_up_offset); FUN_001f9a10_2eac18(camera_position, camera_position, camera_backward_offset); *(short *)(((char *)camera_globals->current_camera) + 0x8A) = 1; - } else if (mode == 2) { + } else if (camera_handoff_request == 2) { *(char *)&camera_globals->transition_requested_kind = 0; *(short *)(current_follow_camera + 0x7E) = 2; camera_globals->transition_position_rate = 0.018f; camera_globals->transition_rotation_rate = 0.018f; - } else if (mode == 1) { + } else if (camera_handoff_request == 1) { *(short *)(current_follow_camera + 0x7E) = 3; - } else if (mode == 4) { + } else if (camera_handoff_request == 4) { *(char *)&camera_globals->transition_requested_kind = 0; *(short *)(current_follow_camera + 0x7E) = 5; camera_globals->transition_position_rate = 0.018f; diff --git a/src/overlays/shared/camera/swing_volume_camera.c b/src/overlays/shared/camera/swing_volume_camera.c index 0e68d291d9..b9c22fdcbc 100644 --- a/src/overlays/shared/camera/swing_volume_camera.c +++ b/src/overlays/shared/camera/swing_volume_camera.c @@ -214,25 +214,28 @@ void volume_camera_swing(struct UpdateCam *swing_camera_record) { follow = &rig->follow; tail = &rig->tail; snap = &rig->tail.snap; - /* A second pointer to the same state: retail keeps both. */ - state = rig; - reset = &state->reset; + /* A second pointer to the same snap_camera_state: retail keeps both. */ + snap_camera_state = rig; + reset = &snap_camera_state->reset; fast_vec_normalize(tail->eye_offset, tail->eye_offset, params->distance); tail->distance = params->distance; tail->pivot_height = params->height; follow->look_height = params->offset_scale; - qcopy(state->tail.saved_eye_offset, tail->eye_offset); + qcopy(snap_camera_state->tail.saved_eye_offset, tail->eye_offset); fast_vec_scale(gravity_offset_or_yaw_direction, &hero.gravity_dir, -tail->pivot_height); pos = ¤t_follow_camera_record->pos; - fast_vec_add(state->follow.pivot, &hero.motion.pos, gravity_offset_or_yaw_direction); - fast_vec_add(pos, state->follow.pivot, tail->eye_offset); + fast_vec_add( + snap_camera_state->follow.pivot, &hero.motion.pos, gravity_offset_or_yaw_direction); + fast_vec_add(pos, snap_camera_state->follow.pivot, tail->eye_offset); fast_vec_scale(gravity_offset_or_yaw_direction, &hero.gravity_dir, -follow->look_height); - fast_vec_add(state->follow.look_target, &hero.motion.pos, gravity_offset_or_yaw_direction); - qcopy(state->follow.snap_look_target, state->follow.look_target); + fast_vec_add(snap_camera_state->follow.look_target, + &hero.motion.pos, + gravity_offset_or_yaw_direction); + qcopy(snap_camera_state->follow.snap_look_target, snap_camera_state->follow.look_target); qcopy(follow->focus, &hero.motion.pos); - qcopy(state->follow.offset, follow->focus); - qcopy(state->position, pos); - qcopy(state->tail.snap.shot_pos, pos); + qcopy(snap_camera_state->follow.offset, follow->focus); + qcopy(snap_camera_state->position, pos); + qcopy(snap_camera_state->tail.snap.shot_pos, pos); snap->distance_reduction = tail->distance - fast_vec_length(tail->eye_offset); *(s32 *)&reset->pitch_bias = 0; reset->look_height = follow->look_height; diff --git a/src/overlays/shared/enemies/armed_transport.c b/src/overlays/shared/enemies/armed_transport.c index 0d1cfe42f5..6be308a5d1 100644 --- a/src/overlays/shared/enemies/armed_transport.c +++ b/src/overlays/shared/enemies/armed_transport.c @@ -91,7 +91,8 @@ typedef struct { PathPoint2fa0 pts[1]; } Path2fa0; -char *spawn_armed_transport_rocket(char *owner, char *vec, void *pos, void *vel, int c) __asm__("FUN_L16_002a0dc0"); +char *spawn_armed_transport_rocket(char *owner, char *vec, void *pos, void *vel, int c) __asm__( + "FUN_L16_002a0dc0"); extern char *D_L16_0015FFD8; extern char *D_L16_001B0930[]; extern f32 advance_accelerated_scalar(f32 *, f32 *, f32, f32, f32, f32) __asm__("func_00213F38"); @@ -128,7 +129,8 @@ extern void spawn_explosion(void *, int, int, int) __asm__("FUN_L00_0025e450"); -void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) __asm__("FUN_L16_002e2b60"); +void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) __asm__( + "FUN_L16_002e2b60"); extern void update_armed_transport_damage_and_targeting(struct Moby *) __asm__("FUN_L16_002e2b60"); void compute_armed_transport_path_headings(void *path_data) __asm__("FUN_L16_002e2fa0"); @@ -499,7 +501,7 @@ void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) { if (*child >= 0) mark_moby_for_removal(pool + (*child << 8)); child++; - } while (--passenger_slot_countdown >= 0); + } while (--count >= 0); } transport_moby->state = ARMED_TRANSPORT_STATE_DYING; transport_data->death_timer_frames = scale_game_frames(90); diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index b515bcd2a4..48732e13dc 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -147,10 +147,12 @@ blend_frog_rotation_to_facing_frame(char *, float *, float *) __asm__("FUN_L06_0 extern void probe_frog_local_z_collision(char *) __asm__("FUN_L06_002e9aa8"); extern void FUN_L06_002e9b60_c(void *, void *, int, float, float) __asm__("FUN_L06_002e9b60"); extern void blend_moby_animation(void *, s32, s32, s32) __asm__("FUN_00212f90"); -void trooper_start_knockback(u8 *a, void *b, int c, int d, int e, float f) __asm__("FUN_L00_0025c558"); +void trooper_start_knockback(u8 *a, void *b, int c, int d, int e, float f) __asm__( + "FUN_L00_0025c558"); void update_frog_health_respawn_and_target(struct Moby *moby) __asm__("FUN_L06_002e94f0"); void destroy_frog_child_moby(struct Moby *moby) __asm__("FUN_L06_002e9f30"); -extern int resolve_moby_hit_response(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_00213928"); +extern int resolve_moby_hit_response(void *, void *, void *, int, int *, float *, int, int) __asm__( + "FUN_00213928"); extern void mark_moby_for_removal_cf(void *, int, int) __asm__("FUN_L00_00257470"); void spawn_moby_directional_spark_bursts(struct Moby *moby, Vec4 *spark_push_direction) __asm__("FUN_L06_002ea198"); @@ -165,7 +167,8 @@ activate_effect_l08(void *, void *, float, int, int, void *, int) __asm__("FUN_L extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern void resolve_point_path_segment_xy_clearance(float, int, void *, void *) __asm__("FUN_L00_00261d78"); -extern void spawn_crate_debris(void *, void *, void *, void *, int, int, float, float) __asm__("FUN_L00_002af8b0"); +extern void spawn_crate_debris(void *, void *, void *, void *, int, int, float, float) __asm__( + "FUN_L00_002af8b0"); extern void add_random_offset_to_vector_xyz(void *, float) __asm__("FUN_L00_0025f8e0"); extern float fast_cos(float); extern float fast_sin(float); @@ -204,7 +207,8 @@ extern struct Moby *D_001413D0_lui __asm__("D_001413D0") NOT_SDA; extern float frog_facing_rotation_blend_factor_gp __asm__("D_L06_00161C00") __attribute__((sda)); extern f32 D_0015ED6C; extern u128 D_L06_001745E0 NOT_SDA; -extern OvlVec4 coll_hit_pos __asm__("D_L06_001745F0") NOT_SDA; /* position after push-out of the last collision query */ +extern OvlVec4 coll_hit_pos __asm__( + "D_L06_001745F0") NOT_SDA; /* position after push-out of the last collision query */ extern s32 moby_spark_burst_count_gp __asm__("D_L06_00161C18") __attribute__((sda)); extern s32 moby_sparks_per_burst_gp __asm__("D_L06_00161C1C") __attribute__((sda)); extern f32 moby_spark_burst_position_jitter_bound_gp __asm__("D_L06_00161C20") __attribute__((sda)); @@ -276,11 +280,11 @@ void frog_update(unsigned char *moby) { if (l06_frog_updates_disabled != 0) { return; } - mode = D_L06_0015F5C4; - if (mode == 2 && ((MOBY(moby)->flags ^ 1) & 1)) { + visibility_override_mode = D_L06_0015F5C4; + if (visibility_override_mode == 2 && ((MOBY(moby)->flags ^ 1) & 1)) { frog_instance_vars->hidden = 1; MOBY(moby)->flags |= 0x41; - } else if (mode == 0 && frog_instance_vars->hidden != 0) { + } else if (visibility_override_mode == 0 && frog_instance_vars->hidden != 0) { frog_instance_vars->hidden = 0; MOBY(moby)->flags &= 0xFFBE; } diff --git a/src/overlays/shared/game/run_level_main_loop.c b/src/overlays/shared/game/run_level_main_loop.c index 2af8d0bdc9..c578b6e056 100644 --- a/src/overlays/shared/game/run_level_main_loop.c +++ b/src/overlays/shared/game/run_level_main_loop.c @@ -440,8 +440,8 @@ void initialize_level_map_archive(void) { file = (struct DiscFile *)D_001383A0 + D_L00_001841F0.archive_index; } if (file->size != 0) { - state = &D_L00_001841F0; - state->coverage_enabled = 1; + map_archive_state = &D_L00_001841F0; + map_archive_state->coverage_enabled = 1; heap_tag = (int)render_archive_source_file; archive_base = ((int **)&D_L00_00173E08)[0]; archive = (int *)((int)archive_base + 0x9A800); @@ -459,9 +459,10 @@ void initialize_level_map_archive(void) { map_archive_state->first_data += 8; map_archive_state->second_data = map_archive_state->first_data; second_size = archive[2] - archive[1]; - state->coverage_runs = hud_heap_alloc(second_size, 0, (char *)heap_tag, 0x2EC); - fast_mem_copy((void *)state->coverage_runs, (char *)archive + archive[1], second_size); - state->scratch_data = hud_heap_alloc(0x1000, 0, (char *)heap_tag, 0x2F3); + map_archive_state->coverage_runs = hud_heap_alloc(second_size, 0, (char *)heap_tag, 0x2EC); + fast_mem_copy( + (void *)map_archive_state->coverage_runs, (char *)archive + archive[1], second_size); + map_archive_state->scratch_data = hud_heap_alloc(0x1000, 0, (char *)heap_tag, 0x2F3); for (i = 0; i < 8; i++) { D_L00_001841F0.slots[i].cell = -1; D_L00_001841F0.slots[i].unk4 = -1; @@ -542,13 +543,13 @@ void initialize_render_archive_transfer(void) { disc_table.render_archives[archive_index].sector, disc_table.render_archives[archive_index].size); update_audio_stream_until_idle(1); - state->loaded = 1; - state->transfer_bytes = bytes; - send_dma_to_stash_slot(state->buffer, state->file_handle, 0, bytes); - state->level_slot = current_level_index + 0x100; - state->last_transfer_bytes = bytes; - state->map_ready = 1; - state->load_state = -2; + render_archive->loaded = 1; + render_archive->transfer_bytes = bytes; + send_dma_to_stash_slot(render_archive->buffer, render_archive->file_handle, 0, bytes); + render_archive->level_slot = current_level_index + 0x100; + render_archive->last_transfer_bytes = bytes; + render_archive->map_ready = 1; + render_archive->load_state = -2; return; } if (D_L00_001841F0.file_handle != -1) { diff --git a/src/overlays/shared/hero/hero_handle_jump_press.c b/src/overlays/shared/hero/hero_handle_jump_press.c index e52b7c0eb7..901d2039ab 100644 --- a/src/overlays/shared/hero/hero_handle_jump_press.c +++ b/src/overlays/shared/hero/hero_handle_jump_press.c @@ -284,7 +284,7 @@ s32 try_start_hero_item_idle_animation(void) __asm__("FUN_L00_00229a98"); s32 try_start_hero_item_idle_animation(void) { struct Hero *hero_ptr = &hero; - s32 id, k; + s32 slot_zero_item_id, k; if (hero_ptr->item_anim_active == 0 || hero_ptr->weapon_up == 0 || hero_ptr->weapon_lowered != 0) return 0; diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index dae85a994c..e7495a803b 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -1,3 +1,7 @@ +enum { + HERO_EASE_KIND_ON_FOOT_HERO_MOBY = 0 +}; + /* Hero idle sequence and per-frame helpers: health, easing records, random timers, rotation targets, glow and HUD effects. */ #include "types.h" #include "rnc/overlay/shared/world/level_globals.h" @@ -560,7 +564,8 @@ extern unsigned char D_0013D4D5[]; extern void reset_numeric_hud_element_32x32_base(void) __asm__("FUN_L00_00235dc0"); extern void update_hud_panel_visibility(void) __asm__("FUN_L00_0023a218"); extern void draw_hud_bolt_exclamation_panel(void) __asm__("FUN_L00_0023a2d0"); -s32 queue_animation_update(s32 chan, s32 id, s32 fn, s32 d, s32 e, s32 c, s32 b) __asm__("FUN_001ff308"); +s32 queue_animation_update(s32 chan, s32 id, s32 fn, s32 d, s32 e, s32 c, s32 b) __asm__( + "FUN_001ff308"); void update_hero_bolt_exclamation_hud(void) __asm__("FUN_L00_00205ea8"); @@ -1493,7 +1498,8 @@ typedef struct { } S13F350; extern float D_0015ED6C; -void update_moby_vertical_oscillation(char *, float *, float *, float, float) __asm__("FUN_L00_00262b00"); +void update_moby_vertical_oscillation(char *, float *, float *, float, float) __asm__( + "FUN_L00_00262b00"); extern char D_L00_0017A6C0[] NOT_SDA; void apply_hero_vertical_oscillation(void) __asm__("FUN_L00_002078a8"); @@ -1525,7 +1531,8 @@ void apply_hero_vertical_oscillation(void) { /* Ported from rac1-decomp (src/overlays/shared/help_00203E98.c: func_L00_00208000), where it is exact; names translated to the US level program. */ -extern void update_moby_rotation_oscillation(int, char *, char *, float, float, float) __asm__("FUN_L00_00262b80"); +extern void update_moby_rotation_oscillation(int, char *, char *, float, float, float) __asm__( + "FUN_L00_00262b80"); void apply_hero_rotation_oscillation(void) __asm__("FUN_L00_002079e8"); @@ -2370,7 +2377,8 @@ extern void FUN_00254b58_002092c8(s32) __asm__("FUN_L00_00254b58"); /* Packs the scratchpad joints listed in joints[1..] (ended by a negative entry) into pose: every rotation, padding identity rotations, the scales that are not 1.0 and the translations that differ from the bind pose. */ -void pack_pose(s32 *joints, PackedPose *pose, u8 *model, s32 padding, s32 context) __asm__("FUN_L00_002092c8"); +void pack_pose(s32 *joints, PackedPose *pose, u8 *model, s32 padding, s32 context) __asm__( + "FUN_L00_002092c8"); void pack_pose(s32 *joints, PackedPose *pose, u8 *model, s32 padding, s32 pose_source_moby) { u64 *packed_pose_write_cursor; @@ -3566,10 +3574,6 @@ void apply_hero_selected_flags_and_state_transitions(void) { #undef P #include "rnc/math/vector.h" -enum { - HERO_EASE_KIND_ON_FOOT_HERO_MOBY = 0 -}; - /* the ledge probe of the hero: looks for an edge ahead to grab, and where it finds one stores the grab point and direction */ /* Ported from rac1-decomp (src/overlays/shared/help_00203E98.c: func_L00_0020C568), where it is exact; names translated to the US level program. */ @@ -3595,9 +3599,11 @@ extern int FUN_001efa68_c(void *, void *, int, int, int) __asm__("FUN_ extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int rig_probe() __asm__("FUN_L00_001f19a0"); extern unsigned char D_0013F350[]; -void predict_position_with_vertical_drop(void *a, void *b, void *c, int d, float f) __asm__("FUN_L00_00259508"); +void predict_position_with_vertical_drop(void *a, void *b, void *c, int d, float f) __asm__( + "FUN_L00_00259508"); extern char D_0013F450_20C568[] __asm__("D_0013F350"); -extern void predict_position_with_vertical_drop(void *a, void *b, void *c, int d, float f) __asm__("FUN_L00_00259508"); +extern void predict_position_with_vertical_drop(void *a, void *b, void *c, int d, float f) __asm__( + "FUN_L00_00259508"); extern int func_L00_001EFFF0_20C568(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int func_L00_001F3958_20C568(void) __asm__("FUN_001f0b58"); extern Obj *FUN_L00_002603d0(char *); diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index e8256610f3..bea4911561 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -146,8 +146,9 @@ void blend_hero_slot3_mapped_animation_pair(int requested_hero_animation_id, blk2 = &hero; ok = 1; if (blk2->state.control_mode == HERO_MODE_IDLE && - lookup_hero_slot3_animation_key(MOBY(slot3_moby)->prev_seq, &id) != 0) { - if (id == 0) { + lookup_hero_slot3_animation_key(MOBY(slot3_moby)->prev_seq, &requested_hero_animation_id) != + 0) { + if (requested_hero_animation_id == 0) { ok = 0; } } @@ -1446,7 +1447,8 @@ extern void scale_game_frames_v_233f80(int) __asm__("FUN_001f96f8"); extern Plat *f_L00_002603d0(void *) __asm__("FUN_L00_002603d0"); extern void probe_ground_height_cf(int, void *, void *, void *, void *, void *) __asm__("FUN_L00_00260400"); -extern int convert_pose_to_reference_local(int, void *, void *, void *, void *, void *) __asm__("FUN_L00_00260668"); +extern int convert_pose_to_reference_local(int, void *, void *, void *, void *, void *) __asm__( + "FUN_L00_00260668"); extern void transform_attachment_pose(int, void *, void *, void *, void *, void *) __asm__("FUN_L00_002604f0"); extern float approach_value(float *, float, float) __asm__("FUN_00213ed8"); diff --git a/src/overlays/shared/mobys/evaluate_moby_animation_pose.c b/src/overlays/shared/mobys/evaluate_moby_animation_pose.c index 849d55cdfb..128ca6c1f0 100644 --- a/src/overlays/shared/mobys/evaluate_moby_animation_pose.c +++ b/src/overlays/shared/mobys/evaluate_moby_animation_pose.c @@ -164,7 +164,7 @@ void FUN_L00_00257470(unsigned char *moby, int bolt_drop_flags, int trajectory_t if (bolt_drop_flags & 0x100) { call_flags = 5; } - if (hero_lui.on_hoverboard || (flags & 0x200)) { + if (hero_lui.on_hoverboard || (bolt_drop_flags & 0x200)) { call_flags |= 2; } if (hero_lui.state.current == 0x10 && diff --git a/src/overlays/shared/mobys/step_moby_motion.c b/src/overlays/shared/mobys/step_moby_motion.c index ef36b474f7..e898bee0fd 100644 --- a/src/overlays/shared/mobys/step_moby_motion.c +++ b/src/overlays/shared/mobys/step_moby_motion.c @@ -75,7 +75,8 @@ typedef struct { } V4 __attribute__((aligned(16))); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int generate_random_points_from_shape_entries(void *, int, void *, void *, float) __asm__("FUN_L00_0025aca0"); +extern int generate_random_points_from_shape_entries(void *, int, void *, void *, float) __asm__( + "FUN_L00_0025aca0"); extern void spawn_effect(void *, void *, int, int, int, int, int, int) __asm__("FUN_L00_00269958"); void spawn_particles_at_shape_points(void *source_object, @@ -352,7 +353,7 @@ int step_moby_motion(char *moby, struct KnockbackMotion *motion_state) { if (is_moby_in_class_range_500_to_540(*pp) == 0) { if (motion_state->flags & 0x20) { if (motion_state->phase == 2) { - flags |= 0x100; + motion_outcome_flags |= 0x100; } } } else { @@ -389,7 +390,7 @@ int step_moby_motion(char *moby, struct KnockbackMotion *motion_state) { collision_metadata = (char *)collision_result_position - 0x30; if (*(int *)(collision_metadata + 0x18) == 0 || *(int *)(collision_metadata + 0x1C) > 0) { - flags |= 1; + motion_outcome_flags |= 1; motion_state->phase = 2; } fast_vec_normalize(normal_response_vector, surface_normal, motion_normal_dot); diff --git a/src/overlays/shared/props/trespasser_pad.c b/src/overlays/shared/props/trespasser_pad.c index 12aed115fc..b02dbb997c 100644 --- a/src/overlays/shared/props/trespasser_pad.c +++ b/src/overlays/shared/props/trespasser_pad.c @@ -530,16 +530,16 @@ void draw_tresspasser_puzzle(char *moby) { second_step = 0; third_step = 0; if (puzzle_state->turn_angle > 0.31415927f) { - state = puzzle_state->turning_ring; - if (state == TRESSPASSER_SELECTED_RING_FIRST) + selected_ring = puzzle_state->turning_ring; + if (selected_ring == TRESSPASSER_SELECTED_RING_FIRST) first_step = 1; else if (selected_ring == TRESSPASSER_SELECTED_RING_SECOND) second_step = 1; else third_step = 1; } else if (puzzle_state->turn_angle < -0.31415927f) { - state = puzzle_state->turning_ring; - if (state == TRESSPASSER_SELECTED_RING_FIRST) + selected_ring = puzzle_state->turning_ring; + if (selected_ring == TRESSPASSER_SELECTED_RING_FIRST) first_step = -1; else if (selected_ring == TRESSPASSER_SELECTED_RING_SECOND) second_step = -1; diff --git a/src/overlays/shared/rendering/effects/spawn_explosion.c b/src/overlays/shared/rendering/effects/spawn_explosion.c index 50ee8d683d..4914597358 100644 --- a/src/overlays/shared/rendering/effects/spawn_explosion.c +++ b/src/overlays/shared/rendering/effects/spawn_explosion.c @@ -141,7 +141,7 @@ void update_hit_color_flash(s32 id, struct HitColorFlash *animation_state) { else b = animation_state->original_blue; } - set_moby_color(color_target_moby, r, g, b); + set_moby_color(id, r, g, b); } s32 offset_path_index(s32 *tab, s32 i, s32 index_offset, s32 wrap) __asm__("FUN_L00_0025d7a0"); @@ -540,7 +540,8 @@ f32 normalize_angle(f32 angle_radians) { extern int FUN_L00_0025e3b8_u(void *) __asm__("FUN_L00_0025e3b8"); /* False for null; true for a moby outside FUN_L00_0025e3b8's range or of class 0x1F6. */ -int is_nonnull_moby_outside_table_or_class_range_500_to_540_or_class_502(struct Moby *moby) __asm__("FUN_L00_0025e368"); +int is_nonnull_moby_outside_table_or_class_range_500_to_540_or_class_502(struct Moby *moby) __asm__( + "FUN_L00_0025e368"); int is_nonnull_moby_outside_table_or_class_range_500_to_540_or_class_502(struct Moby *moby) { int predicate_result; @@ -607,10 +608,12 @@ extern int collect_mobies_in_sphere(float, void *, int, void *, void *) __asm__( extern void *spawn_shrinking_effect_particle_with_gravity_and_secondary_spawns( void *, void *, int, int, int, int, int, int, float) __asm__("FUN_L00_0026bb70"); extern void *spawn_debris(void *, void *, int, int, int) __asm__("FUN_L00_002af450"); -extern void spawn_particle(void *, void *, int, int, float, int, int, int, int, float) __asm__("FUN_L00_0026a9f0"); +extern void spawn_particle(void *, void *, int, int, float, int, int, int, int, float) __asm__( + "FUN_L00_0026a9f0"); extern void spawn_particle_alt_9768(void *, void *, int, int, int, float) __asm__("FUN_L00_0026a4c8"); -extern int spawn_glow_particle(void *, void *, void *, float, int, int, int, int, int) __asm__("FUN_L00_002ac910"); +extern int spawn_glow_particle(void *, void *, void *, float, int, int, int, int, int) __asm__( + "FUN_L00_002ac910"); extern void mine_camera_blast(void *, void *, int, int) __asm__("FUN_L00_002d3838"); extern char default_explosion_flash_descriptor[] __asm__("D_L00_001B0250"); @@ -936,7 +939,8 @@ typedef struct { /* Explosion burst at `pos`: three random-coloured particles, two tinted particles on `owner`, a camera shake when the spot is in view, the owner's sound unless it is dying, and a light flash of intensity `flash` (13 if negative). */ -void cart_burst(u8 *owner, u128 *pos, int sound, float scale, float flash) __asm__("FUN_L00_0025f090"); +void cart_burst(u8 *owner, u128 *pos, int sound, float scale, float flash) __asm__( + "FUN_L00_0025f090"); void cart_burst(u8 *burst_owner_moby, u128 *burst_position, int sound, float scale, float flash) { Vy10 particle_velocity; diff --git a/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c b/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c index 71a352f578..5b8ab7947a 100644 --- a/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c +++ b/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c @@ -247,7 +247,8 @@ extern int D_0015EEA4; extern struct Hero hero_lui __asm__("D_0013F350") NOT_SDA; /* Picks slot w74 from the stick angle (or steps it with the 0x1000-0x8000 pad bits), counts hold frames in b71/b70, records the slot's entry when released, and closes when b70 runs out. */ -void update_hud_item_selector_selection_and_visibility(Obj *hud_element) __asm__("FUN_L00_00237ba0"); +void update_hud_item_selector_selection_and_visibility(Obj *hud_element) __asm__( + "FUN_L00_00237ba0"); void update_hud_item_selector_selection_and_visibility(Obj *hud_element) { float x, y, mag, stick_angle, a, slot_position, previous_slot_angle; @@ -357,7 +358,7 @@ void update_hud_item_selector_selection_and_visibility(Obj *hud_element) { counters[1]++; if (!(((s32)controller_state.held_unmasked) & 0x10)) { int sel = hud_element->w74; - if (sel >= 0 && (id = D_L00_0015FAC0_c[D_L00_0015F72C][sel].command) != 0) { + if (sel >= 0 && (selected_item_id = D_L00_0015FAC0_c[D_L00_0015F72C][sel].command) != 0) { VendorItemInfo *rr; int ri = selected_item_id; if (hero_lui.items[0].item_id != selected_item_id) { @@ -368,7 +369,7 @@ void update_hud_item_selector_selection_and_visibility(Obj *hud_element) { usage_stats.stat[20].latest_time_bucket = scale_game_frames(D_0015EEA4) / 600; usage_stats.stat[20].level_mask = usage_stats.stat[20].level_mask | (1 << current_level_index) | 0x80000000; - if (id == 0x18) + if (selected_item_id == 0x18) hero_lui.launch_drones = 1; else hero_lui.pending_item[0] = selected_item_id; @@ -629,7 +630,8 @@ void initialize_four_slot_hud_selector(char *hud_element) { D_L00_0015F72C = 0; } -void update_hud_radial_selector_selection_and_visibility(Obj *hud_element) __asm__("FUN_L00_00238b80"); +void update_hud_radial_selector_selection_and_visibility(Obj *hud_element) __asm__( + "FUN_L00_00238b80"); void update_hud_radial_selector_selection_and_visibility(Obj *hud_element) { float x, y, input_magnitude, selection_angle; @@ -1201,7 +1203,8 @@ typedef struct T00239d00 { extern s32 bolt_panel_open_steps_gp __asm__("D_L00_0015F824") __attribute__((sda)); extern s32 bolt_text_fade_steps_gp __asm__("D_L00_0015F828") __attribute__((sda)); -void update_bolt_counter_hud_animation_and_visibility(T00239d00 *hud_element) __asm__("FUN_L00_00239d00"); +void update_bolt_counter_hud_animation_and_visibility(T00239d00 *hud_element) __asm__( + "FUN_L00_00239d00"); void update_bolt_counter_hud_animation_and_visibility(T00239d00 *hud_element) { enum { diff --git a/src/overlays/shared/ui/hud/hud_keep_visible.c b/src/overlays/shared/ui/hud/hud_keep_visible.c index 59a5b9a6a9..f6dfab12d9 100644 --- a/src/overlays/shared/ui/hud/hud_keep_visible.c +++ b/src/overlays/shared/ui/hud/hud_keep_visible.c @@ -493,8 +493,9 @@ int draw_hud_stars(HudElem *element) { origin[0] = half_w * sixteen; origin[1] = half_h * sixteen; } - offset = (float)(10000 - element->shown_value) / 10000.0f; - offset = 116.0f - (offset + offset) * 116.0f; + star_visibility_y_threshold = (float)(10000 - element->shown_value) / 10000.0f; + star_visibility_y_threshold = + 116.0f - (star_visibility_y_threshold + star_visibility_y_threshold) * 116.0f; image = get_icon_frame(*(int *)element, 2); clear_u64_value(first_step); @@ -591,8 +592,8 @@ int draw_uniform_size_hud_stars(HudElem *hud_element) { origin[0] = half_w * 16.0f; origin[1] = half_h * 16.0f; } - offset = (10000 - hud_element->shown_value) / 10000.0f; - offset = 116.0f - (offset + offset) * 116.0f; + star_y_threshold = (10000 - hud_element->shown_value) / 10000.0f; + star_y_threshold = 116.0f - (star_y_threshold + star_y_threshold) * 116.0f; image = get_icon_frame(*(int *)hud_element, 1); clear_u64_value(first_step); clear_u64_value(second_step); diff --git a/src/overlays/shared/ui/map/reveal_map_around_position.c b/src/overlays/shared/ui/map/reveal_map_around_position.c index 91e5139be7..6d88858b1e 100644 --- a/src/overlays/shared/ui/map/reveal_map_around_position.c +++ b/src/overlays/shared/ui/map/reveal_map_around_position.c @@ -102,8 +102,8 @@ void reveal_map_around_position(f32 *position) { hero.state.control_mode == HERO_MODE_WATER_SURFACE || hero.base_condition == 1) { state = TRUE; } - mode16 = hero.state.control_mode == 16; - mode15 = hero.state.control_mode == HERO_MODE_GRIND; + hero_control_mode_is_16 = hero.state.control_mode == 16; + hero_control_mode_is_15 = hero.state.control_mode == HERO_MODE_GRIND; y_min = y - 16; for (i = 0, filter = filters; i < 16; i++, filter++) { diff --git a/src/overlays/shared/ui/menus/initialize_pause_menu.c b/src/overlays/shared/ui/menus/initialize_pause_menu.c index 88dd16ff3a..47ffa267dc 100644 --- a/src/overlays/shared/ui/menus/initialize_pause_menu.c +++ b/src/overlays/shared/ui/menus/initialize_pause_menu.c @@ -370,7 +370,7 @@ void initialize_pause_menu(void) { D_L00_001841F0.map_image_vram = 0; D_L00_001841F0.tex_clut_vram = 0; slot = &D_L00_001841F0.texture_slots[3]; - for (texture_slots_cleared = 0; texture_slots_cleared < 4; texture_slots_cleared++) { + for (count = 0; count < 4; count++) { *slot = 0; slot--; } diff --git a/src/overlays/shared/weapons/bomb_glove.c b/src/overlays/shared/weapons/bomb_glove.c index 9288231874..598b8ce398 100644 --- a/src/overlays/shared/weapons/bomb_glove.c +++ b/src/overlays/shared/weapons/bomb_glove.c @@ -101,7 +101,8 @@ extern float frame_time_sq_macro __asm__("D_0015ED70") MACRO_ADDR; * After the route is fixed: re-score this file, expect EXACT 572/572, then * promote normally. Do NOT add inline asm or a per-unit exception for this. */ -void aim_throw_arc(V2c2488 *pos, V2c2488 *tgt, f32 *out, f32 speed, f32 unused, f32 range) __asm__("FUN_L00_002c2488"); +void aim_throw_arc(V2c2488 *pos, V2c2488 *tgt, f32 *out, f32 speed, f32 unused, f32 range) __asm__( + "FUN_L00_002c2488"); void aim_throw_arc(V2c2488 *origin_position, V2c2488 *target_position, @@ -186,9 +187,9 @@ void bomb_glove_update(struct Moby *moby) { if (moby == 0) return; bomb_glove_vars = (CarrierVars_2c26c8 *)moby->pvars; - offset.q = 0; - offset.f[1] = -0.09f; - offset.f[2] = -0.02f; + grip_local_offset.q = 0; + grip_local_offset.f[1] = -0.09f; + grip_local_offset.f[2] = -0.02f; copy_matrix3x4(basis, l00_camera_lui.view_matrix); transpose_rotation_matrix(matrix, basis); if (bomb_glove_vars == 0) diff --git a/src/overlays/shared/weapons/doom_bot.c b/src/overlays/shared/weapons/doom_bot.c index 7d3dbba1ae..e0ee20af87 100644 --- a/src/overlays/shared/weapons/doom_bot.c +++ b/src/overlays/shared/weapons/doom_bot.c @@ -84,11 +84,13 @@ extern void spawn_explosion(float, int) __asm__("FUN_L00_0025e450"); extern int collect_mobies_in_sphere(void *, float, int, void *, void *) __asm__("FUN_L00_001f2868"); extern void -send_blast_hits(void *, void *, void *, int, void *, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); +send_blast_hits(void *, void *, void *, int, void *, int, int, int, float, float, float) __asm__( + "FUN_L00_0025a9f8"); extern int FUN_L00_001ff600(float, void *, void *); extern int probe_moby_raised_sphere_collision(char *, int, void *) __asm__("FUN_L00_002beab0"); extern void FUN_L00_00260400(void *, int, void *, void *, void *, void *); -extern int move_moby_with_collision_integer_radius(void *, void *, int, int, float, float) __asm__("FUN_L00_00258ad0"); +extern int move_moby_with_collision_integer_radius(void *, void *, int, int, float, float) __asm__( + "FUN_L00_00258ad0"); extern void FUN_L00_00258278(void *, float *, float, float, float, float); extern struct Moby * select_class5_target_or_hero(void *, void *, void *, void *, int) __asm__("FUN_L00_002bed90"); @@ -587,12 +589,12 @@ void doom_bot_update(struct Moby *moby) { -1, item_text_variant[0x14]); movement_and_detonation_vectors[1].f[2] += scale * 0.5f; - collected_moby_count = collect_mobies_in_sphere(&moby->pos, speed, 0x15, moby, 0); + count = collect_mobies_in_sphere(&moby->pos, speed, 0x15, moby, 0); movement_and_detonation_vectors[3].q = *(OvlQuad *)&moby->pos; send_blast_hits(moby, &movement_and_detonation_vectors[3], D_L00_00177F00, - collected_moby_count, + count, 0, 0x10000, 2, diff --git a/src/overlays/shared/weapons/mine.c b/src/overlays/shared/weapons/mine.c index d034f193e1..c24e820ca7 100644 --- a/src/overlays/shared/weapons/mine.c +++ b/src/overlays/shared/weapons/mine.c @@ -84,7 +84,8 @@ extern void reflect_vector(void *, void *, void *) __asm__("FUN_L00_001ff660"); extern void make_hit_descriptor(void *, void *, int, void *, float) __asm__("FUN_L00_00259888"); extern void jet_animate(unsigned char *, float) __asm__("FUN_L00_00259fe8"); extern void -send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); +send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__( + "FUN_L00_0025a9f8"); extern void spawn_explosion(void *, void *, void *, @@ -105,7 +106,8 @@ extern void spawn_explosion(void *, int) __asm__("FUN_L00_0025e450"); extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void mine_spawn_drops(void *, void *) __asm__("FUN_L00_0025f800"); -extern void update_moby_rotation_oscillation(void *, char *, char *, float, float, float) __asm__("FUN_L00_00262b80"); +extern void update_moby_rotation_oscillation(void *, char *, char *, float, float, float) __asm__( + "FUN_L00_00262b80"); extern void spawn_debris_chunk(void *, void *, int, int) __asm__("FUN_L00_0026f548"); extern void spawn_gravity_floor_burst_particle( void *, void *, int, float, float, float, int, int, int) __asm__("FUN_L00_002738e8"); @@ -501,7 +503,7 @@ void initialize_moby_motion_at_position(V_2aa008 *requested_position, other_same_class_moby_count++; } } - if (count >= 8) + if (other_same_class_moby_count >= 8) ((D_2aa008 *)best->moby_private_vars)->spawn_frame = -1; qcopy(&initialized_moby->v10, requested_position); vector_scratch.q = ((Q_2aa008 *)hero.moby)->v10.q; @@ -999,8 +1001,8 @@ void mine_update(M910 *mine_moby) { if (max_homing_step < sp) { v->homing_speed = max_homing_step; } - mode = v->homing_phase; - if (mode == MINE_HOMING_RISE_PHASE) { + homing_phase = v->homing_phase; + if (homing_phase == MINE_HOMING_RISE_PHASE) { mine_moby->pos.f[2] += frame_scale * 0.05f; if (fast_dec_timer(&v->homing_phase_timer) != 0) { v->homing_phase_timer = scale_game_frames(7); diff --git a/src/overlays/shared/weapons/mine_glove.c b/src/overlays/shared/weapons/mine_glove.c index 60c66fc7e5..dd4d1b1333 100644 --- a/src/overlays/shared/weapons/mine_glove.c +++ b/src/overlays/shared/weapons/mine_glove.c @@ -163,9 +163,9 @@ void mine_glove_update(struct Moby *moby) { ++mine_glove_vars->delay; return; } - offset.q = 0; - offset.f[1] = -0.09f; - offset.f[2] = -0.02f; + grip_local_offset.q = 0; + grip_local_offset.f[1] = -0.09f; + grip_local_offset.f[2] = -0.02f; copy_matrix3x4(basis, l00_camera.view_matrix); transpose_rotation_matrix(matrix, basis); if (mine_glove_vars == 0) From 276a8dd5fd891e8610707744707b0aff2d7aa267 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:55:48 +0000 Subject: [PATCH 656/657] overlay: update remaining audio and particle field references --- .../initialize_level_transition_with_audio.c | 6 ++- .../shared/rendering/effects/particles.c | 53 ++++++++++++------- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/src/overlays/shared/game/initialize_level_transition_with_audio.c b/src/overlays/shared/game/initialize_level_transition_with_audio.c index 322f71ddc0..a3bd79fcd0 100644 --- a/src/overlays/shared/game/initialize_level_transition_with_audio.c +++ b/src/overlays/shared/game/initialize_level_transition_with_audio.c @@ -156,7 +156,8 @@ void initialize_level_transition_with_audio(int audio_selection_mode) { D_0013D4C6_lui == 0) { audio_stream_table_index = 0; secondary_track_index = 11; - } else if (current_level_index == LEVEL_OLTANIS && D_0013E030_28e9c8.x26 == 2) { + } else if (current_level_index == LEVEL_OLTANIS && + D_0013E030_28e9c8.audio_selection_base_index == 2) { audio_stream_table_index = 8; secondary_track_index = 14; } @@ -175,7 +176,8 @@ void initialize_level_transition_with_audio(int audio_selection_mode) { if (k) secondary_track_index = 9; alternate_audio_stream_table_index = 4; - } else if (current_level_index == LEVEL_OLTANIS && D_0013E030_28e9c8.x26 == 2) { + } else if (current_level_index == LEVEL_OLTANIS && + D_0013E030_28e9c8.audio_selection_base_index == 2) { secondary_track_index = 13; if (D_0013E030_28e9c8.x2c) secondary_track_index = 12; diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index 14112c5a7d..f618faffef 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -84,7 +84,8 @@ unsigned char *FUN_L00_002712b8(OvlQuad *initial_position, extern void FUN_L00_001ff318_271450(void *, void *, float) __asm__("FUN_L00_001ff318"); -void update_moving_rotating_resizing_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_00271450"); +void update_moving_rotating_resizing_alpha_fade_particle(struct EffectParticle *) __asm__( + "FUN_L00_00271450"); void update_moving_rotating_resizing_alpha_fade_particle(struct EffectParticle *particle) { float particle_velocity[4]; @@ -170,7 +171,8 @@ unsigned char *spawn_moving_resizing_height_snapped_alpha_fade_particle( return particle; } -void update_moving_resizing_height_snapped_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_00271748"); +void update_moving_resizing_height_snapped_alpha_fade_particle(struct EffectParticle *) __asm__( + "FUN_L00_00271748"); void update_moving_resizing_height_snapped_alpha_fade_particle(struct EffectParticle *particle) { unsigned char *particle_data = particle->data; @@ -231,7 +233,8 @@ unsigned char *spawn_splash(u128 *initial_position, return particle; } -void update_expanding_rotating_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_002719f0"); +void update_expanding_rotating_alpha_fade_particle(struct EffectParticle *) __asm__( + "FUN_L00_002719f0"); void update_expanding_rotating_alpha_fade_particle(struct EffectParticle *particle) { float *particle_data = (float *)particle->data; @@ -527,7 +530,8 @@ void update_moving_size_alpha_tween_particle(struct EffectParticle *part) { typedef unsigned int u128_272438 __attribute__((mode(TI), aligned(16))); extern unsigned char D_L00_00177F00_272438[] __asm__("D_L00_00177F00"); -void path_sample_at_distance(int, float *, float *, void *, float, float) __asm__("FUN_L00_00262360"); +void path_sample_at_distance(int, float *, float *, void *, float, float) __asm__( + "FUN_L00_00262360"); int FUN_L00_0025bfe0_272438(float, float, float, float) __asm__("FUN_L00_0025bfe0"); int collect_mobies_in_sphere(float, void *, int, void *, void *) __asm__("FUN_L00_001f2868"); void send_blast_hits(void *, @@ -686,7 +690,7 @@ void update_moby_point_attached_particle(P_2726d8 *particle) { free_effect_particle(particle); return; } - sc = q->xC * random_float_between(0.5f, 1.0f); + sc = q->initial_primary_position_w * random_float_between(0.5f, 1.0f); save = particle->secondary_position_w; qcopy(&position_delta, &particle->pos); moby_point_position(particle->q.owner, q->moby_point_selector, &particle->pos); @@ -703,7 +707,8 @@ void update_moby_point_attached_particle(P_2726d8 *particle) { particle->secondary_position_w = save; } -void update_expanding_damped_rgb_fading_particle(struct EffectParticle *) __asm__("FUN_L00_00272838"); +void update_expanding_damped_rgb_fading_particle(struct EffectParticle *) __asm__( + "FUN_L00_00272838"); void update_expanding_damped_rgb_fading_particle(struct EffectParticle *particle) { s32 faded_intensity; @@ -821,7 +826,8 @@ extern char D_0013F3D0[] NOT_SDA; extern unsigned char *D_L00_0016016C_272bc0 __asm__("D_L00_0016016C"); extern int fast_tween_color(float, int, int) __asm__("FUN_001fa6e0"); extern void add_random_offset_to_vector_xyz(void *, float) __asm__("FUN_L00_0025f8e0"); -extern int FUN_L00_002729c8_272bc0(void *, int, int, int, int, int, int, float, float) __asm__("FUN_L00_002729c8"); +extern int FUN_L00_002729c8_272bc0(void *, int, int, int, int, int, int, float, float) __asm__( + "FUN_L00_002729c8"); extern void spawn_nearby_effect(int, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); void update_color_tween_emitter_particle(struct EffectParticle *) __asm__("FUN_L00_00272bc0"); @@ -1059,7 +1065,8 @@ typedef struct { } G_273298; u32 FUN_001fa6e0_273298(u32, u32, f32) __asm__("FUN_001fa6e0"); -void update_moving_hero_relative_alpha_fade_particle(Part_273298 *particle) __asm__("FUN_L00_00273298"); +void update_moving_hero_relative_alpha_fade_particle(Part_273298 *particle) __asm__( + "FUN_L00_00273298"); void update_moving_hero_relative_alpha_fade_particle(Part_273298 *particle) { enum { @@ -1121,7 +1128,8 @@ typedef struct { extern u8 *D_L00_001B2174_lui __asm__("D_L00_001B2174") NOT_SDA; extern float g_debug_camera[4] __asm__("D_L00_00166DC0") NOT_SDA; -void update_moby_point_attached_alpha_pulse_particle(P_273448 *particle) __asm__("FUN_L00_00273448"); +void update_moby_point_attached_alpha_pulse_particle(P_273448 *particle) __asm__( + "FUN_L00_00273448"); void update_moby_point_attached_alpha_pulse_particle(P_273448 *particle) { E_273448 *e; @@ -1219,7 +1227,8 @@ unsigned char *spawn_mode_controlled_alpha_fade_particle(void *position, /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_002746A0), where it is exact; names translated to the US level program. */ -void update_mode_controlled_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_00273800"); +void update_mode_controlled_alpha_fade_particle(struct EffectParticle *) __asm__( + "FUN_L00_00273800"); void update_mode_controlled_alpha_fade_particle(struct EffectParticle *particle) { char *particle_data = particle->data; @@ -1323,7 +1332,8 @@ extern int FUN_L00_002371e0(int, int, float); extern u32 large_floor_burst_random_limit_plus_one_gp __asm__("D_L00_00160228") __attribute__((sda)); -void update_gravity_floor_burst_particle(struct EmberParticle *ember_particle) __asm__("FUN_L00_00273a68"); +void update_gravity_floor_burst_particle(struct EmberParticle *ember_particle) __asm__( + "FUN_L00_00273a68"); void update_gravity_floor_burst_particle(struct EmberParticle *ember_particle) { struct EmberMotion *m = &ember_particle->m; @@ -1510,7 +1520,8 @@ spawn_random_planar_drift_particle(void *position, int color, float size_scale, /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_002751A8), where it is exact; names translated to the US level program. */ -void update_moving_resizing_periodic_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_00274308"); +void update_moving_resizing_periodic_alpha_fade_particle(struct EffectParticle *) __asm__( + "FUN_L00_00274308"); void update_moving_resizing_periodic_alpha_fade_particle(struct EffectParticle *particle) { char *particle_data = particle->data; @@ -1610,7 +1621,8 @@ typedef struct { } M_274518; s32 decrement_packed_countdown(void *, s32) __asm__("FUN_L00_00259430"); -u8 *FUN_L00_002743a8_274518(s32, void *, s32, f32, f32, s32, s32, void *) __asm__("FUN_L00_002743a8"); +u8 *FUN_L00_002743a8_274518(s32, void *, s32, f32, f32, s32, s32, void *) __asm__( + "FUN_L00_002743a8"); void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) __asm__("FUN_L00_00274518"); void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { @@ -1701,7 +1713,8 @@ typedef struct { float offset_length; /* 0x0C: second point distance along the bone */ } S_274818; -void update_randomized_moby_point_attached_particle(struct EffectParticle *) __asm__("FUN_L00_00274818"); +void update_randomized_moby_point_attached_particle(struct EffectParticle *) __asm__( + "FUN_L00_00274818"); void update_randomized_moby_point_attached_particle(struct EffectParticle *particle) { S_274818 *attachment_data = (S_274818 *)(particle->data + 0x10); @@ -1767,7 +1780,8 @@ unsigned char *spawn_mode_controlled_rotating_alpha_fade_particle(u128 *position return particle; } -void update_mode_controlled_rotating_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_00274a70"); +void update_mode_controlled_rotating_alpha_fade_particle(struct EffectParticle *) __asm__( + "FUN_L00_00274a70"); void update_mode_controlled_rotating_alpha_fade_particle(struct EffectParticle *particle) { u8 *particle_data = particle->data; @@ -2093,7 +2107,8 @@ void update_gravity_ground_culled_particle(O_275320 *particle) { extern int hud_counter_update(float, int, int) __asm__("FUN_L00_002371e0"); extern void transform_vector_by_basis(void *, void *, void *); -void update_damped_moby_relative_color_size_tween_particle(struct EffectParticle *) __asm__("FUN_L00_00275510"); +void update_damped_moby_relative_color_size_tween_particle(struct EffectParticle *) __asm__( + "FUN_L00_00275510"); void update_damped_moby_relative_color_size_tween_particle(struct EffectParticle *particle) { char *particle_data = particle->data; @@ -2283,7 +2298,8 @@ static __inline__ void vcopy_276940(float *d, float *s) { *(int *)&d[3] = 0; } -void update_proximity_corrected_size_alpha_tween_particle(struct EffectParticle *) __asm__("FUN_L00_00275aa0"); +void update_proximity_corrected_size_alpha_tween_particle(struct EffectParticle *) __asm__( + "FUN_L00_00275aa0"); void update_proximity_corrected_size_alpha_tween_particle(struct EffectParticle *particle) { char *particle_data = particle->data; @@ -2403,7 +2419,8 @@ typedef struct { } Part; u32 FUN_001fa6e0_00275eb0(u32, u32, f32) __asm__("FUN_001fa6e0"); -void update_mode_controlled_shrinking_color_tween_particle(Part *particle) __asm__("FUN_L00_00275eb0"); +void update_mode_controlled_shrinking_color_tween_particle(Part *particle) __asm__( + "FUN_L00_00275eb0"); void update_mode_controlled_shrinking_color_tween_particle(Part *particle) { float remaining_frames_minus_one; From 2c0bfec668f20dda7de51c9335b4f3195f65329a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Wed, 11 Nov 2026 00:58:13 +0000 Subject: [PATCH 657/657] chore: apply project formatting to rebased names --- src/mobys/animation/queue_animation_update.c | 3 +- src/overlays/l01/mobys/peckbot.c | 3 +- src/overlays/l02/mobys/sand_shark.c | 9 ++-- src/overlays/l04/mobys/leg_walker.c | 3 +- src/overlays/l04/mobys/woodcut_bot.c | 3 +- src/overlays/l07/mobys/snagglebeast.c | 9 ++-- src/overlays/l10/mobys/path_spark_effect.c | 3 +- src/overlays/l11/mobys/psytcopus.c | 3 +- src/overlays/l11/mobys/teleporter.c | 3 +- src/overlays/l13/mobys/qwarks_starfighter.c | 9 ++-- src/overlays/l14/mobys/flying_car.c | 9 ++-- src/overlays/l16/mobys/conveyor_belt.c | 3 +- .../camera/follow_camera_offset_effect.c | 2 + .../shared/camera/follow_camera_setup.c | 3 +- src/overlays/shared/camera/grindrail_camera.c | 3 +- src/overlays/shared/enemies/armed_transport.c | 6 +-- src/overlays/shared/enemies/frog.c | 12 ++--- src/overlays/shared/hero/hero_idle_sequence.c | 18 +++---- src/overlays/shared/hero/set_hero_animation.c | 3 +- src/overlays/shared/mobys/step_moby_motion.c | 3 +- .../shared/rendering/effects/particles.c | 51 +++++++------------ .../rendering/effects/spawn_explosion.c | 12 ++--- .../ui/hud/draw_hud_item_selector_panel.c | 9 ++-- src/overlays/shared/weapons/bomb_glove.c | 3 +- src/overlays/shared/weapons/doom_bot.c | 6 +-- src/overlays/shared/weapons/mine.c | 6 +-- src/overlays/shared/weapons/suckcannon.c | 6 +-- 27 files changed, 69 insertions(+), 134 deletions(-) diff --git a/src/mobys/animation/queue_animation_update.c b/src/mobys/animation/queue_animation_update.c index ecf93cf2c6..5bbc2a6cee 100644 --- a/src/mobys/animation/queue_animation_update.c +++ b/src/mobys/animation/queue_animation_update.c @@ -25,8 +25,7 @@ struct Anim { extern struct Anim hud_chan_slots[] __asm__("D_00199B60"); extern void apply_pending_animation(struct Anim *) __asm__("func_001FF418"); -s32 queue_animation_update(s32 chan, s32 id, s32 fn, s32 d, s32 e, s32 c, s32 b) __asm__( - "FUN_001ff308"); +s32 queue_animation_update(s32 chan, s32 id, s32 fn, s32 d, s32 e, s32 c, s32 b) __asm__("FUN_001ff308"); s32 queue_animation_update(s32 chan, s32 queued_animation_id, diff --git a/src/overlays/l01/mobys/peckbot.c b/src/overlays/l01/mobys/peckbot.c index c80d1c8240..ba5e240c58 100644 --- a/src/overlays/l01/mobys/peckbot.c +++ b/src/overlays/l01/mobys/peckbot.c @@ -166,8 +166,7 @@ extern s32 FUN_L00_001f35d8_cf(void) __asm__("FUN_001f0b58"); extern void FUN_L00_001ff500_cf(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L00_00257470(void *, s32, s32); extern void FUN_L00_00258278(void *, void *, f32, f32, f32, f32); -extern s32 move_moby_with_ground_and_collision_checks(void *, void *, void *, void *, f32) __asm__( - "FUN_L00_00258b50"); +extern s32 move_moby_with_ground_and_collision_checks(void *, void *, void *, void *, f32) __asm__("FUN_L00_00258b50"); extern void FUN_L00_0025a120(void *); extern void hit_reaction(void *, void *, void *, s32, void *, void *, s32, s32) __asm__("FUN_L00_0025a478"); diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 3cd4401b5e..dba4803080 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -64,8 +64,7 @@ extern float sand_shark_dust_position_jitter_radius_gp __asm__("D_L02_001619DC") unsigned short D_L02_001619E0 = 0; /* Dust puff emitter, declared in the argument order the other levels use (pos, three floats, n, vel, size, colour). */ extern unsigned char * -spawn_puff(void *pos, float r, float lo, float hi, int n, void *vel, float size, int color) __asm__( - "FUN_L00_0026d000"); +spawn_puff(void *pos, float r, float lo, float hi, int n, void *vel, float size, int color) __asm__("FUN_L00_0026d000"); /* Emits n dust puffs evenly spaced along the segment from a to b. */ void emit_sand_shark_dust_puffs_along_segment(void *moby, @@ -275,8 +274,7 @@ extern void FUN_L00_00258278_c(void *, float, float *, float, float, float) __asm__("FUN_L00_00258278"); extern void move_moby_with_ground_and_collision_checks( void *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); -extern void play_entity_sound(void *, void *, float, int, float, float, int, int, int) __asm__( - "FUN_L00_002598b0"); +extern void play_entity_sound(void *, void *, float, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern void FUN_L00_0025a120_e50(void *) __asm__("FUN_L00_0025a120"); extern void turn_angle_e50(float *, float, float *, float, float, float) __asm__("FUN_L00_0025be00"); @@ -1265,8 +1263,7 @@ extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_ extern int FUN_L00_0025ff38(float, void *, void *, int, int, void *, int); extern int select_group_class_29c_moby(void *argp) __asm__("FUN_L02_002d5658"); extern void extend_group_sand_shark_timers(char *arg) __asm__("FUN_L02_002d5728"); -extern int resolve_moby_hit_response(void *, void *, void *, int, int *, float *, int, int) __asm__( - "FUN_00213928"); +extern int resolve_moby_hit_response(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_00213928"); extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); diff --git a/src/overlays/l04/mobys/leg_walker.c b/src/overlays/l04/mobys/leg_walker.c index 6a065a6a41..7ffbc583b7 100644 --- a/src/overlays/l04/mobys/leg_walker.c +++ b/src/overlays/l04/mobys/leg_walker.c @@ -380,8 +380,7 @@ extern s32 rig_probe(void *, s32, f32, struct Moby *, f32) __asm__("FUN_L00_001f extern f32 D_0015ED60; extern s32 D_L04_00173FF0[] NOT_SDA; -s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f32 step) __asm__( - "FUN_L04_00295778"); +s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f32 step) __asm__("FUN_L04_00295778"); s32 leg_walker_update(struct Moby *moby, LegRig *rig, f32 speed, f32 heading, f32 step) { union { diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index bd8e7828c0..cd949c81f5 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -284,8 +284,7 @@ extern void update_hit_color_flash(void *, void *) __asm__("FUN_L00_0025d538"); extern void select_moby_combat_target(void *, void *, float) __asm__("FUN_L00_0025fcb8"); extern void FUN_L00_00263ac8(float, void *, int, void *); extern void reset_walker_gait_helpers(void *) __asm__("FUN_L00_002a1538"); -extern void spawn_crate_debris(void *, void *, void *, void *, int, int, float, float) __asm__( - "FUN_L00_002af8b0"); +extern void spawn_crate_debris(void *, void *, void *, void *, int, int, float, float) __asm__("FUN_L00_002af8b0"); extern void reset_leg_rig_from_animation(void *, void *) __asm__("FUN_L04_00295de8"); extern void initialize_woodcut_bot_movement_data(void *) __asm__("FUN_L04_002d1418"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index c386465d77..be10c281c0 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -445,8 +445,7 @@ void *collect_snagglebeast_navigation_ids(void *unused, void *dp, void *op) { return (void *)output_count; } -extern int resolve_moby_hit_response(void *, void *, void *, int, int *, int, int, int) __asm__( - "FUN_00213928"); +extern int resolve_moby_hit_response(void *, void *, void *, int, int *, int, int, int) __asm__("FUN_00213928"); extern void FUN_L00_00257470(void *, int, int); extern void start_hit_color_flash(void *, void *) __asm__("FUN_L00_0025d458"); extern void update_hit_color_flash(void *, void *) __asm__("FUN_L00_0025d538"); @@ -685,8 +684,7 @@ extern s32 level_frame_count_lui __asm__("D_L07_0015F5CC"); extern float D_0015ED6C; extern struct ChaserTarget D_L07_00173EC0; extern int step_mover_2e3f20(struct Moby *, void *, int, void *) __asm__("FUN_L00_00259028"); -extern int probe_vertical_ground_collision(void *, struct Moby *, int, float, float) __asm__( - "FUN_L00_002583f0"); +extern int probe_vertical_ground_collision(void *, struct Moby *, int, float, float) __asm__("FUN_L00_002583f0"); int update_snagglebeast_chase_movement(struct Moby *chaser_moby, struct ChaserVars *chaser_vars, Vec4 *goal, @@ -962,8 +960,7 @@ extern void spawn_moby_point_offset_particle(char *, int, float, float) __asm__( extern int update_alternating_joint_emission_burst(void *, char *, float *) __asm__("FUN_L07_003122b0"); extern int is_value_within_interpolated_window(void *, float) __asm__("FUN_00214cc8"); -extern void *spawn_fading_ring_effect(int, void *, int, float, float, float, float, float) __asm__( - "FUN_L07_0030dbb0"); +extern void *spawn_fading_ring_effect(int, void *, int, float, float, float, float, float) __asm__("FUN_L07_0030dbb0"); extern void FUN_L00_0024f7c8(void *, int, void *); extern void configure_timed_point_light( void *, void *, int, void *, short, unsigned int, int, float) __asm__("FUN_L07_00311eb8"); diff --git a/src/overlays/l10/mobys/path_spark_effect.c b/src/overlays/l10/mobys/path_spark_effect.c index ee8843005f..7a4ec625db 100644 --- a/src/overlays/l10/mobys/path_spark_effect.c +++ b/src/overlays/l10/mobys/path_spark_effect.c @@ -25,8 +25,7 @@ typedef struct { } EffectData; extern void -send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__( - "FUN_L00_0025a9f8"); +send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); void path_spark_effect_update(char *moby) __asm__("FUN_L10_002dd3d8"); diff --git a/src/overlays/l11/mobys/psytcopus.c b/src/overlays/l11/mobys/psytcopus.c index b0481173b9..5ee8bf6c6f 100644 --- a/src/overlays/l11/mobys/psytcopus.c +++ b/src/overlays/l11/mobys/psytcopus.c @@ -30,8 +30,7 @@ enum { extern float approach_angle(float *p, float a, float *v, float b, float c, float d) __asm__("FUN_L00_0025be00"); extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern int resolve_moby_hit_response(void *, void *, float *, int, int *, int, int, int) __asm__( - "FUN_00213928"); +extern int resolve_moby_hit_response(void *, void *, float *, int, int *, int, int, int) __asm__("FUN_00213928"); /* pvars of the moby run by psytcopus_update (FUN_L11_00310698 does its hit handling) */ struct PokiPathVars { diff --git a/src/overlays/l11/mobys/teleporter.c b/src/overlays/l11/mobys/teleporter.c index d5cad1395f..18aec636ce 100644 --- a/src/overlays/l11/mobys/teleporter.c +++ b/src/overlays/l11/mobys/teleporter.c @@ -26,8 +26,7 @@ extern void FUN_L11_002f2cd0_2518(char *) __asm__("FUN_L11_002f2cd0"); extern void FUN_L11_002f2d58_2518(char *) __asm__("FUN_L11_002f2d58"); extern void update_teleporter_child_transforms(char *) __asm__("FUN_L01_003092d0"); extern void request_hero_target_pose(float *, int, float) __asm__("FUN_L00_00233ee8"); -extern void FUN_L00_002598b0_2518(int, float, void *, int, float, float, int, int, int) __asm__( - "FUN_L00_002598b0"); +extern void FUN_L00_002598b0_2518(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern int get_hero_target_pose_status(void) __asm__("FUN_L00_00233f38"); extern void advance_accelerated_scalar(float *, float *, float, float, float, float) __asm__("FUN_00213f38"); diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index 9e7d101994..68c38e0c08 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -86,8 +86,7 @@ extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); extern void start_hit_color_flash(void *m, void *p) __asm__("FUN_L00_0025d458"); -extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__( - "FUN_L00_00258110"); +extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__("FUN_L00_00258110"); extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); @@ -1562,8 +1561,7 @@ extern char qwarks_starfighter_tractor_offscreen_abort_message[] __asm__("D_L13_ extern float D_L13_00160660[] MACRO_ADDR; -extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__( - "FUN_L00_00258110"); +extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__("FUN_L00_00258110"); extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); @@ -1581,8 +1579,7 @@ extern int qwarks_starfighter_attachment_class_ids[] __asm__("D_L13_001D34D8"); extern int DebugPrint_alt() __asm__("FUN_001e93b0"); -extern int allocate_colored_effect_slot(float *, float, float, float, float, float) __asm__( - "FUN_L00_0023e738"); +extern int allocate_colored_effect_slot(float *, float, float, float, float, float) __asm__("FUN_L00_0023e738"); extern int queue_animation_update(int, int, int, int, int, int, int) __asm__("FUN_001ff308"); diff --git a/src/overlays/l14/mobys/flying_car.c b/src/overlays/l14/mobys/flying_car.c index 00256ee179..146042bd3e 100644 --- a/src/overlays/l14/mobys/flying_car.c +++ b/src/overlays/l14/mobys/flying_car.c @@ -105,8 +105,7 @@ extern void fill_transfer_words(void *, int, int) __asm__("FUN_001f97e8"); extern void start_hit_color_flash(void *, void *) __asm__("FUN_L00_0025d458"); -extern void update_moby_rotation_oscillation(void *, void *, void *, float, float, float) __asm__( - "FUN_L00_00262b80"); +extern void update_moby_rotation_oscillation(void *, void *, void *, float, float, float) __asm__("FUN_L00_00262b80"); extern int FUN_L14_00307620_6ee0(void *) __asm__("FUN_L14_00307620"); @@ -332,8 +331,7 @@ extern char *D_L14_0015FFD8_7620 __asm__("D_L14_0015FFD8"); extern float D_L14_00162274 __attribute__((sda)); -extern int sample_path(char *path, float *out, void *pos, void *t, int dir, float step) __asm__( - "FUN_L00_0025d808"); +extern int sample_path(char *path, float *out, void *pos, void *t, int dir, float step) __asm__("FUN_L00_0025d808"); extern void cart_burst(void *, void *, f32, f32, s32) __asm__("FUN_L00_0025f090"); @@ -475,7 +473,6 @@ void seed_linked_record_for_flying_car(u8 *flying_car_moby) { *(f32 *)(linked_record + 0xB0) = 2.0f; } -extern int sample_path(char *path, float *out, void *seg, void *t, int dir, float step) __asm__( - "FUN_L00_0025d808"); +extern int sample_path(char *path, float *out, void *seg, void *t, int dir, float step) __asm__("FUN_L00_0025d808"); int flying_car_path_reset_delay_frames_gp __asm__("D_L14_0016227C") = 0x1f4; diff --git a/src/overlays/l16/mobys/conveyor_belt.c b/src/overlays/l16/mobys/conveyor_belt.c index d6894a680a..69b4c02a41 100644 --- a/src/overlays/l16/mobys/conveyor_belt.c +++ b/src/overlays/l16/mobys/conveyor_belt.c @@ -19,8 +19,7 @@ extern float D_0015ED6C; -void update_conveyor_group_motion_transforms(int index, void *conveyor_motion_vector) __asm__( - "FUN_L16_002c9c38"); +void update_conveyor_group_motion_transforms(int index, void *conveyor_motion_vector) __asm__("FUN_L16_002c9c38"); extern void add_draw_callback(void (*)(void), void *) __asm__("FUN_001f4600"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern float D_0015ED6C, frame_time; diff --git a/src/overlays/shared/camera/follow_camera_offset_effect.c b/src/overlays/shared/camera/follow_camera_offset_effect.c index 9ade072551..259d1ada47 100644 --- a/src/overlays/shared/camera/follow_camera_offset_effect.c +++ b/src/overlays/shared/camera/follow_camera_offset_effect.c @@ -22,7 +22,9 @@ void update_camera_offset_effect_state(void) __asm__("FUN_L02_002fa770"); extern CameraOffsetEffect camera_offset_effect __asm__("D_L02_00167600"); extern float D_L02_0016760C NOT_SDA; extern short camera_offset_effect_duration_step_gp __asm__("D_L02_0016238C") __attribute__((sda)); + #include "rnc/overlay/shared/camera/follow_camera_offset_effect_data.h" + extern short camera_offset_effect_duration_step __asm__("D_L02_0016238C"); s32 D_L02_00167604[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index d053e447ef..e3059de1bc 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -1272,8 +1272,7 @@ extern int test_follow_camera_point_in_collision_volume(void *) __asm__( extern int FUN_L00_001f0d60_2e7a30(void *, int, int, float) __asm__("FUN_L00_001f0d60"); extern int FUN_L00_002e79c8_2e7a30(void *, int, void *, float) __asm__("FUN_L00_002e79c8"); -int resolve_follow_camera_orbit_path_collisions(unsigned char *camera_moby) __asm__( - "FUN_L00_002e7a30"); +int resolve_follow_camera_orbit_path_collisions(unsigned char *camera_moby) __asm__("FUN_L00_002e7a30"); int resolve_follow_camera_orbit_path_collisions(unsigned char *camera_moby) { OvlQuad initial_orbit_vector[1]; diff --git a/src/overlays/shared/camera/grindrail_camera.c b/src/overlays/shared/camera/grindrail_camera.c index 13e278bc29..59c7bd4970 100644 --- a/src/overlays/shared/camera/grindrail_camera.c +++ b/src/overlays/shared/camera/grindrail_camera.c @@ -119,8 +119,7 @@ extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s /* Resets the camera's orbit, focus, spring, view and track from fixed values; for a kind 2 preset it also prepares its two paths once, measuring each point against the path it follows. */ -void reset_camera_state_and_prepare_preset_paths(Camera *destination_camera) __asm__( - "FUN_L01_00314e98"); +void reset_camera_state_and_prepare_preset_paths(Camera *destination_camera) __asm__("FUN_L01_00314e98"); void reset_camera_state_and_prepare_preset_paths(Camera *destination_camera) { Vec4 at; diff --git a/src/overlays/shared/enemies/armed_transport.c b/src/overlays/shared/enemies/armed_transport.c index 6be308a5d1..7b39157176 100644 --- a/src/overlays/shared/enemies/armed_transport.c +++ b/src/overlays/shared/enemies/armed_transport.c @@ -91,8 +91,7 @@ typedef struct { PathPoint2fa0 pts[1]; } Path2fa0; -char *spawn_armed_transport_rocket(char *owner, char *vec, void *pos, void *vel, int c) __asm__( - "FUN_L16_002a0dc0"); +char *spawn_armed_transport_rocket(char *owner, char *vec, void *pos, void *vel, int c) __asm__("FUN_L16_002a0dc0"); extern char *D_L16_0015FFD8; extern char *D_L16_001B0930[]; extern f32 advance_accelerated_scalar(f32 *, f32 *, f32, f32, f32, f32) __asm__("func_00213F38"); @@ -129,8 +128,7 @@ extern void spawn_explosion(void *, int, int, int) __asm__("FUN_L00_0025e450"); -void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) __asm__( - "FUN_L16_002e2b60"); +void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) __asm__("FUN_L16_002e2b60"); extern void update_armed_transport_damage_and_targeting(struct Moby *) __asm__("FUN_L16_002e2b60"); void compute_armed_transport_path_headings(void *path_data) __asm__("FUN_L16_002e2fa0"); diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index 48732e13dc..b857231a6e 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -147,12 +147,10 @@ blend_frog_rotation_to_facing_frame(char *, float *, float *) __asm__("FUN_L06_0 extern void probe_frog_local_z_collision(char *) __asm__("FUN_L06_002e9aa8"); extern void FUN_L06_002e9b60_c(void *, void *, int, float, float) __asm__("FUN_L06_002e9b60"); extern void blend_moby_animation(void *, s32, s32, s32) __asm__("FUN_00212f90"); -void trooper_start_knockback(u8 *a, void *b, int c, int d, int e, float f) __asm__( - "FUN_L00_0025c558"); +void trooper_start_knockback(u8 *a, void *b, int c, int d, int e, float f) __asm__("FUN_L00_0025c558"); void update_frog_health_respawn_and_target(struct Moby *moby) __asm__("FUN_L06_002e94f0"); void destroy_frog_child_moby(struct Moby *moby) __asm__("FUN_L06_002e9f30"); -extern int resolve_moby_hit_response(void *, void *, void *, int, int *, float *, int, int) __asm__( - "FUN_00213928"); +extern int resolve_moby_hit_response(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_00213928"); extern void mark_moby_for_removal_cf(void *, int, int) __asm__("FUN_L00_00257470"); void spawn_moby_directional_spark_bursts(struct Moby *moby, Vec4 *spark_push_direction) __asm__("FUN_L06_002ea198"); @@ -167,8 +165,7 @@ activate_effect_l08(void *, void *, float, int, int, void *, int) __asm__("FUN_L extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern void resolve_point_path_segment_xy_clearance(float, int, void *, void *) __asm__("FUN_L00_00261d78"); -extern void spawn_crate_debris(void *, void *, void *, void *, int, int, float, float) __asm__( - "FUN_L00_002af8b0"); +extern void spawn_crate_debris(void *, void *, void *, void *, int, int, float, float) __asm__("FUN_L00_002af8b0"); extern void add_random_offset_to_vector_xyz(void *, float) __asm__("FUN_L00_0025f8e0"); extern float fast_cos(float); extern float fast_sin(float); @@ -207,8 +204,7 @@ extern struct Moby *D_001413D0_lui __asm__("D_001413D0") NOT_SDA; extern float frog_facing_rotation_blend_factor_gp __asm__("D_L06_00161C00") __attribute__((sda)); extern f32 D_0015ED6C; extern u128 D_L06_001745E0 NOT_SDA; -extern OvlVec4 coll_hit_pos __asm__( - "D_L06_001745F0") NOT_SDA; /* position after push-out of the last collision query */ +extern OvlVec4 coll_hit_pos __asm__("D_L06_001745F0") NOT_SDA; /* position after push-out of the last collision query */ extern s32 moby_spark_burst_count_gp __asm__("D_L06_00161C18") __attribute__((sda)); extern s32 moby_sparks_per_burst_gp __asm__("D_L06_00161C1C") __attribute__((sda)); extern f32 moby_spark_burst_position_jitter_bound_gp __asm__("D_L06_00161C20") __attribute__((sda)); diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index e7495a803b..ba1cf23616 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -564,8 +564,7 @@ extern unsigned char D_0013D4D5[]; extern void reset_numeric_hud_element_32x32_base(void) __asm__("FUN_L00_00235dc0"); extern void update_hud_panel_visibility(void) __asm__("FUN_L00_0023a218"); extern void draw_hud_bolt_exclamation_panel(void) __asm__("FUN_L00_0023a2d0"); -s32 queue_animation_update(s32 chan, s32 id, s32 fn, s32 d, s32 e, s32 c, s32 b) __asm__( - "FUN_001ff308"); +s32 queue_animation_update(s32 chan, s32 id, s32 fn, s32 d, s32 e, s32 c, s32 b) __asm__("FUN_001ff308"); void update_hero_bolt_exclamation_hud(void) __asm__("FUN_L00_00205ea8"); @@ -1498,8 +1497,7 @@ typedef struct { } S13F350; extern float D_0015ED6C; -void update_moby_vertical_oscillation(char *, float *, float *, float, float) __asm__( - "FUN_L00_00262b00"); +void update_moby_vertical_oscillation(char *, float *, float *, float, float) __asm__("FUN_L00_00262b00"); extern char D_L00_0017A6C0[] NOT_SDA; void apply_hero_vertical_oscillation(void) __asm__("FUN_L00_002078a8"); @@ -1531,8 +1529,7 @@ void apply_hero_vertical_oscillation(void) { /* Ported from rac1-decomp (src/overlays/shared/help_00203E98.c: func_L00_00208000), where it is exact; names translated to the US level program. */ -extern void update_moby_rotation_oscillation(int, char *, char *, float, float, float) __asm__( - "FUN_L00_00262b80"); +extern void update_moby_rotation_oscillation(int, char *, char *, float, float, float) __asm__("FUN_L00_00262b80"); void apply_hero_rotation_oscillation(void) __asm__("FUN_L00_002079e8"); @@ -2377,8 +2374,7 @@ extern void FUN_00254b58_002092c8(s32) __asm__("FUN_L00_00254b58"); /* Packs the scratchpad joints listed in joints[1..] (ended by a negative entry) into pose: every rotation, padding identity rotations, the scales that are not 1.0 and the translations that differ from the bind pose. */ -void pack_pose(s32 *joints, PackedPose *pose, u8 *model, s32 padding, s32 context) __asm__( - "FUN_L00_002092c8"); +void pack_pose(s32 *joints, PackedPose *pose, u8 *model, s32 padding, s32 context) __asm__("FUN_L00_002092c8"); void pack_pose(s32 *joints, PackedPose *pose, u8 *model, s32 padding, s32 pose_source_moby) { u64 *packed_pose_write_cursor; @@ -3599,11 +3595,9 @@ extern int FUN_001efa68_c(void *, void *, int, int, int) __asm__("FUN_ extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int rig_probe() __asm__("FUN_L00_001f19a0"); extern unsigned char D_0013F350[]; -void predict_position_with_vertical_drop(void *a, void *b, void *c, int d, float f) __asm__( - "FUN_L00_00259508"); +void predict_position_with_vertical_drop(void *a, void *b, void *c, int d, float f) __asm__("FUN_L00_00259508"); extern char D_0013F450_20C568[] __asm__("D_0013F350"); -extern void predict_position_with_vertical_drop(void *a, void *b, void *c, int d, float f) __asm__( - "FUN_L00_00259508"); +extern void predict_position_with_vertical_drop(void *a, void *b, void *c, int d, float f) __asm__("FUN_L00_00259508"); extern int func_L00_001EFFF0_20C568(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int func_L00_001F3958_20C568(void) __asm__("FUN_001f0b58"); extern Obj *FUN_L00_002603d0(char *); diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index bea4911561..829bfdccc6 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1447,8 +1447,7 @@ extern void scale_game_frames_v_233f80(int) __asm__("FUN_001f96f8"); extern Plat *f_L00_002603d0(void *) __asm__("FUN_L00_002603d0"); extern void probe_ground_height_cf(int, void *, void *, void *, void *, void *) __asm__("FUN_L00_00260400"); -extern int convert_pose_to_reference_local(int, void *, void *, void *, void *, void *) __asm__( - "FUN_L00_00260668"); +extern int convert_pose_to_reference_local(int, void *, void *, void *, void *, void *) __asm__("FUN_L00_00260668"); extern void transform_attachment_pose(int, void *, void *, void *, void *, void *) __asm__("FUN_L00_002604f0"); extern float approach_value(float *, float, float) __asm__("FUN_00213ed8"); diff --git a/src/overlays/shared/mobys/step_moby_motion.c b/src/overlays/shared/mobys/step_moby_motion.c index e898bee0fd..69961d1526 100644 --- a/src/overlays/shared/mobys/step_moby_motion.c +++ b/src/overlays/shared/mobys/step_moby_motion.c @@ -75,8 +75,7 @@ typedef struct { } V4 __attribute__((aligned(16))); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int generate_random_points_from_shape_entries(void *, int, void *, void *, float) __asm__( - "FUN_L00_0025aca0"); +extern int generate_random_points_from_shape_entries(void *, int, void *, void *, float) __asm__("FUN_L00_0025aca0"); extern void spawn_effect(void *, void *, int, int, int, int, int, int) __asm__("FUN_L00_00269958"); void spawn_particles_at_shape_points(void *source_object, diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index f618faffef..6d53011fe4 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -84,8 +84,7 @@ unsigned char *FUN_L00_002712b8(OvlQuad *initial_position, extern void FUN_L00_001ff318_271450(void *, void *, float) __asm__("FUN_L00_001ff318"); -void update_moving_rotating_resizing_alpha_fade_particle(struct EffectParticle *) __asm__( - "FUN_L00_00271450"); +void update_moving_rotating_resizing_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_00271450"); void update_moving_rotating_resizing_alpha_fade_particle(struct EffectParticle *particle) { float particle_velocity[4]; @@ -171,8 +170,7 @@ unsigned char *spawn_moving_resizing_height_snapped_alpha_fade_particle( return particle; } -void update_moving_resizing_height_snapped_alpha_fade_particle(struct EffectParticle *) __asm__( - "FUN_L00_00271748"); +void update_moving_resizing_height_snapped_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_00271748"); void update_moving_resizing_height_snapped_alpha_fade_particle(struct EffectParticle *particle) { unsigned char *particle_data = particle->data; @@ -233,8 +231,7 @@ unsigned char *spawn_splash(u128 *initial_position, return particle; } -void update_expanding_rotating_alpha_fade_particle(struct EffectParticle *) __asm__( - "FUN_L00_002719f0"); +void update_expanding_rotating_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_002719f0"); void update_expanding_rotating_alpha_fade_particle(struct EffectParticle *particle) { float *particle_data = (float *)particle->data; @@ -530,8 +527,7 @@ void update_moving_size_alpha_tween_particle(struct EffectParticle *part) { typedef unsigned int u128_272438 __attribute__((mode(TI), aligned(16))); extern unsigned char D_L00_00177F00_272438[] __asm__("D_L00_00177F00"); -void path_sample_at_distance(int, float *, float *, void *, float, float) __asm__( - "FUN_L00_00262360"); +void path_sample_at_distance(int, float *, float *, void *, float, float) __asm__("FUN_L00_00262360"); int FUN_L00_0025bfe0_272438(float, float, float, float) __asm__("FUN_L00_0025bfe0"); int collect_mobies_in_sphere(float, void *, int, void *, void *) __asm__("FUN_L00_001f2868"); void send_blast_hits(void *, @@ -707,8 +703,7 @@ void update_moby_point_attached_particle(P_2726d8 *particle) { particle->secondary_position_w = save; } -void update_expanding_damped_rgb_fading_particle(struct EffectParticle *) __asm__( - "FUN_L00_00272838"); +void update_expanding_damped_rgb_fading_particle(struct EffectParticle *) __asm__("FUN_L00_00272838"); void update_expanding_damped_rgb_fading_particle(struct EffectParticle *particle) { s32 faded_intensity; @@ -826,8 +821,7 @@ extern char D_0013F3D0[] NOT_SDA; extern unsigned char *D_L00_0016016C_272bc0 __asm__("D_L00_0016016C"); extern int fast_tween_color(float, int, int) __asm__("FUN_001fa6e0"); extern void add_random_offset_to_vector_xyz(void *, float) __asm__("FUN_L00_0025f8e0"); -extern int FUN_L00_002729c8_272bc0(void *, int, int, int, int, int, int, float, float) __asm__( - "FUN_L00_002729c8"); +extern int FUN_L00_002729c8_272bc0(void *, int, int, int, int, int, int, float, float) __asm__("FUN_L00_002729c8"); extern void spawn_nearby_effect(int, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); void update_color_tween_emitter_particle(struct EffectParticle *) __asm__("FUN_L00_00272bc0"); @@ -1065,8 +1059,7 @@ typedef struct { } G_273298; u32 FUN_001fa6e0_273298(u32, u32, f32) __asm__("FUN_001fa6e0"); -void update_moving_hero_relative_alpha_fade_particle(Part_273298 *particle) __asm__( - "FUN_L00_00273298"); +void update_moving_hero_relative_alpha_fade_particle(Part_273298 *particle) __asm__("FUN_L00_00273298"); void update_moving_hero_relative_alpha_fade_particle(Part_273298 *particle) { enum { @@ -1128,8 +1121,7 @@ typedef struct { extern u8 *D_L00_001B2174_lui __asm__("D_L00_001B2174") NOT_SDA; extern float g_debug_camera[4] __asm__("D_L00_00166DC0") NOT_SDA; -void update_moby_point_attached_alpha_pulse_particle(P_273448 *particle) __asm__( - "FUN_L00_00273448"); +void update_moby_point_attached_alpha_pulse_particle(P_273448 *particle) __asm__("FUN_L00_00273448"); void update_moby_point_attached_alpha_pulse_particle(P_273448 *particle) { E_273448 *e; @@ -1227,8 +1219,7 @@ unsigned char *spawn_mode_controlled_alpha_fade_particle(void *position, /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_002746A0), where it is exact; names translated to the US level program. */ -void update_mode_controlled_alpha_fade_particle(struct EffectParticle *) __asm__( - "FUN_L00_00273800"); +void update_mode_controlled_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_00273800"); void update_mode_controlled_alpha_fade_particle(struct EffectParticle *particle) { char *particle_data = particle->data; @@ -1332,8 +1323,7 @@ extern int FUN_L00_002371e0(int, int, float); extern u32 large_floor_burst_random_limit_plus_one_gp __asm__("D_L00_00160228") __attribute__((sda)); -void update_gravity_floor_burst_particle(struct EmberParticle *ember_particle) __asm__( - "FUN_L00_00273a68"); +void update_gravity_floor_burst_particle(struct EmberParticle *ember_particle) __asm__("FUN_L00_00273a68"); void update_gravity_floor_burst_particle(struct EmberParticle *ember_particle) { struct EmberMotion *m = &ember_particle->m; @@ -1520,8 +1510,7 @@ spawn_random_planar_drift_particle(void *position, int color, float size_scale, /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_002751A8), where it is exact; names translated to the US level program. */ -void update_moving_resizing_periodic_alpha_fade_particle(struct EffectParticle *) __asm__( - "FUN_L00_00274308"); +void update_moving_resizing_periodic_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_00274308"); void update_moving_resizing_periodic_alpha_fade_particle(struct EffectParticle *particle) { char *particle_data = particle->data; @@ -1621,8 +1610,7 @@ typedef struct { } M_274518; s32 decrement_packed_countdown(void *, s32) __asm__("FUN_L00_00259430"); -u8 *FUN_L00_002743a8_274518(s32, void *, s32, f32, f32, s32, s32, void *) __asm__( - "FUN_L00_002743a8"); +u8 *FUN_L00_002743a8_274518(s32, void *, s32, f32, f32, s32, s32, void *) __asm__("FUN_L00_002743a8"); void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) __asm__("FUN_L00_00274518"); void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { @@ -1713,8 +1701,7 @@ typedef struct { float offset_length; /* 0x0C: second point distance along the bone */ } S_274818; -void update_randomized_moby_point_attached_particle(struct EffectParticle *) __asm__( - "FUN_L00_00274818"); +void update_randomized_moby_point_attached_particle(struct EffectParticle *) __asm__("FUN_L00_00274818"); void update_randomized_moby_point_attached_particle(struct EffectParticle *particle) { S_274818 *attachment_data = (S_274818 *)(particle->data + 0x10); @@ -1780,8 +1767,7 @@ unsigned char *spawn_mode_controlled_rotating_alpha_fade_particle(u128 *position return particle; } -void update_mode_controlled_rotating_alpha_fade_particle(struct EffectParticle *) __asm__( - "FUN_L00_00274a70"); +void update_mode_controlled_rotating_alpha_fade_particle(struct EffectParticle *) __asm__("FUN_L00_00274a70"); void update_mode_controlled_rotating_alpha_fade_particle(struct EffectParticle *particle) { u8 *particle_data = particle->data; @@ -2107,8 +2093,7 @@ void update_gravity_ground_culled_particle(O_275320 *particle) { extern int hud_counter_update(float, int, int) __asm__("FUN_L00_002371e0"); extern void transform_vector_by_basis(void *, void *, void *); -void update_damped_moby_relative_color_size_tween_particle(struct EffectParticle *) __asm__( - "FUN_L00_00275510"); +void update_damped_moby_relative_color_size_tween_particle(struct EffectParticle *) __asm__("FUN_L00_00275510"); void update_damped_moby_relative_color_size_tween_particle(struct EffectParticle *particle) { char *particle_data = particle->data; @@ -2298,8 +2283,7 @@ static __inline__ void vcopy_276940(float *d, float *s) { *(int *)&d[3] = 0; } -void update_proximity_corrected_size_alpha_tween_particle(struct EffectParticle *) __asm__( - "FUN_L00_00275aa0"); +void update_proximity_corrected_size_alpha_tween_particle(struct EffectParticle *) __asm__("FUN_L00_00275aa0"); void update_proximity_corrected_size_alpha_tween_particle(struct EffectParticle *particle) { char *particle_data = particle->data; @@ -2419,8 +2403,7 @@ typedef struct { } Part; u32 FUN_001fa6e0_00275eb0(u32, u32, f32) __asm__("FUN_001fa6e0"); -void update_mode_controlled_shrinking_color_tween_particle(Part *particle) __asm__( - "FUN_L00_00275eb0"); +void update_mode_controlled_shrinking_color_tween_particle(Part *particle) __asm__("FUN_L00_00275eb0"); void update_mode_controlled_shrinking_color_tween_particle(Part *particle) { float remaining_frames_minus_one; diff --git a/src/overlays/shared/rendering/effects/spawn_explosion.c b/src/overlays/shared/rendering/effects/spawn_explosion.c index 4914597358..8acd4a1a73 100644 --- a/src/overlays/shared/rendering/effects/spawn_explosion.c +++ b/src/overlays/shared/rendering/effects/spawn_explosion.c @@ -540,8 +540,7 @@ f32 normalize_angle(f32 angle_radians) { extern int FUN_L00_0025e3b8_u(void *) __asm__("FUN_L00_0025e3b8"); /* False for null; true for a moby outside FUN_L00_0025e3b8's range or of class 0x1F6. */ -int is_nonnull_moby_outside_table_or_class_range_500_to_540_or_class_502(struct Moby *moby) __asm__( - "FUN_L00_0025e368"); +int is_nonnull_moby_outside_table_or_class_range_500_to_540_or_class_502(struct Moby *moby) __asm__("FUN_L00_0025e368"); int is_nonnull_moby_outside_table_or_class_range_500_to_540_or_class_502(struct Moby *moby) { int predicate_result; @@ -608,12 +607,10 @@ extern int collect_mobies_in_sphere(float, void *, int, void *, void *) __asm__( extern void *spawn_shrinking_effect_particle_with_gravity_and_secondary_spawns( void *, void *, int, int, int, int, int, int, float) __asm__("FUN_L00_0026bb70"); extern void *spawn_debris(void *, void *, int, int, int) __asm__("FUN_L00_002af450"); -extern void spawn_particle(void *, void *, int, int, float, int, int, int, int, float) __asm__( - "FUN_L00_0026a9f0"); +extern void spawn_particle(void *, void *, int, int, float, int, int, int, int, float) __asm__("FUN_L00_0026a9f0"); extern void spawn_particle_alt_9768(void *, void *, int, int, int, float) __asm__("FUN_L00_0026a4c8"); -extern int spawn_glow_particle(void *, void *, void *, float, int, int, int, int, int) __asm__( - "FUN_L00_002ac910"); +extern int spawn_glow_particle(void *, void *, void *, float, int, int, int, int, int) __asm__("FUN_L00_002ac910"); extern void mine_camera_blast(void *, void *, int, int) __asm__("FUN_L00_002d3838"); extern char default_explosion_flash_descriptor[] __asm__("D_L00_001B0250"); @@ -939,8 +936,7 @@ typedef struct { /* Explosion burst at `pos`: three random-coloured particles, two tinted particles on `owner`, a camera shake when the spot is in view, the owner's sound unless it is dying, and a light flash of intensity `flash` (13 if negative). */ -void cart_burst(u8 *owner, u128 *pos, int sound, float scale, float flash) __asm__( - "FUN_L00_0025f090"); +void cart_burst(u8 *owner, u128 *pos, int sound, float scale, float flash) __asm__("FUN_L00_0025f090"); void cart_burst(u8 *burst_owner_moby, u128 *burst_position, int sound, float scale, float flash) { Vy10 particle_velocity; diff --git a/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c b/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c index 5b8ab7947a..b0cc957510 100644 --- a/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c +++ b/src/overlays/shared/ui/hud/draw_hud_item_selector_panel.c @@ -247,8 +247,7 @@ extern int D_0015EEA4; extern struct Hero hero_lui __asm__("D_0013F350") NOT_SDA; /* Picks slot w74 from the stick angle (or steps it with the 0x1000-0x8000 pad bits), counts hold frames in b71/b70, records the slot's entry when released, and closes when b70 runs out. */ -void update_hud_item_selector_selection_and_visibility(Obj *hud_element) __asm__( - "FUN_L00_00237ba0"); +void update_hud_item_selector_selection_and_visibility(Obj *hud_element) __asm__("FUN_L00_00237ba0"); void update_hud_item_selector_selection_and_visibility(Obj *hud_element) { float x, y, mag, stick_angle, a, slot_position, previous_slot_angle; @@ -630,8 +629,7 @@ void initialize_four_slot_hud_selector(char *hud_element) { D_L00_0015F72C = 0; } -void update_hud_radial_selector_selection_and_visibility(Obj *hud_element) __asm__( - "FUN_L00_00238b80"); +void update_hud_radial_selector_selection_and_visibility(Obj *hud_element) __asm__("FUN_L00_00238b80"); void update_hud_radial_selector_selection_and_visibility(Obj *hud_element) { float x, y, input_magnitude, selection_angle; @@ -1203,8 +1201,7 @@ typedef struct T00239d00 { extern s32 bolt_panel_open_steps_gp __asm__("D_L00_0015F824") __attribute__((sda)); extern s32 bolt_text_fade_steps_gp __asm__("D_L00_0015F828") __attribute__((sda)); -void update_bolt_counter_hud_animation_and_visibility(T00239d00 *hud_element) __asm__( - "FUN_L00_00239d00"); +void update_bolt_counter_hud_animation_and_visibility(T00239d00 *hud_element) __asm__("FUN_L00_00239d00"); void update_bolt_counter_hud_animation_and_visibility(T00239d00 *hud_element) { enum { diff --git a/src/overlays/shared/weapons/bomb_glove.c b/src/overlays/shared/weapons/bomb_glove.c index 598b8ce398..6b59da9dff 100644 --- a/src/overlays/shared/weapons/bomb_glove.c +++ b/src/overlays/shared/weapons/bomb_glove.c @@ -101,8 +101,7 @@ extern float frame_time_sq_macro __asm__("D_0015ED70") MACRO_ADDR; * After the route is fixed: re-score this file, expect EXACT 572/572, then * promote normally. Do NOT add inline asm or a per-unit exception for this. */ -void aim_throw_arc(V2c2488 *pos, V2c2488 *tgt, f32 *out, f32 speed, f32 unused, f32 range) __asm__( - "FUN_L00_002c2488"); +void aim_throw_arc(V2c2488 *pos, V2c2488 *tgt, f32 *out, f32 speed, f32 unused, f32 range) __asm__("FUN_L00_002c2488"); void aim_throw_arc(V2c2488 *origin_position, V2c2488 *target_position, diff --git a/src/overlays/shared/weapons/doom_bot.c b/src/overlays/shared/weapons/doom_bot.c index e0ee20af87..325e45585c 100644 --- a/src/overlays/shared/weapons/doom_bot.c +++ b/src/overlays/shared/weapons/doom_bot.c @@ -84,13 +84,11 @@ extern void spawn_explosion(float, int) __asm__("FUN_L00_0025e450"); extern int collect_mobies_in_sphere(void *, float, int, void *, void *) __asm__("FUN_L00_001f2868"); extern void -send_blast_hits(void *, void *, void *, int, void *, int, int, int, float, float, float) __asm__( - "FUN_L00_0025a9f8"); +send_blast_hits(void *, void *, void *, int, void *, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); extern int FUN_L00_001ff600(float, void *, void *); extern int probe_moby_raised_sphere_collision(char *, int, void *) __asm__("FUN_L00_002beab0"); extern void FUN_L00_00260400(void *, int, void *, void *, void *, void *); -extern int move_moby_with_collision_integer_radius(void *, void *, int, int, float, float) __asm__( - "FUN_L00_00258ad0"); +extern int move_moby_with_collision_integer_radius(void *, void *, int, int, float, float) __asm__("FUN_L00_00258ad0"); extern void FUN_L00_00258278(void *, float *, float, float, float, float); extern struct Moby * select_class5_target_or_hero(void *, void *, void *, void *, int) __asm__("FUN_L00_002bed90"); diff --git a/src/overlays/shared/weapons/mine.c b/src/overlays/shared/weapons/mine.c index c24e820ca7..48515d96f8 100644 --- a/src/overlays/shared/weapons/mine.c +++ b/src/overlays/shared/weapons/mine.c @@ -84,8 +84,7 @@ extern void reflect_vector(void *, void *, void *) __asm__("FUN_L00_001ff660"); extern void make_hit_descriptor(void *, void *, int, void *, float) __asm__("FUN_L00_00259888"); extern void jet_animate(unsigned char *, float) __asm__("FUN_L00_00259fe8"); extern void -send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__( - "FUN_L00_0025a9f8"); +send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); extern void spawn_explosion(void *, void *, void *, @@ -106,8 +105,7 @@ extern void spawn_explosion(void *, int) __asm__("FUN_L00_0025e450"); extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void mine_spawn_drops(void *, void *) __asm__("FUN_L00_0025f800"); -extern void update_moby_rotation_oscillation(void *, char *, char *, float, float, float) __asm__( - "FUN_L00_00262b80"); +extern void update_moby_rotation_oscillation(void *, char *, char *, float, float, float) __asm__("FUN_L00_00262b80"); extern void spawn_debris_chunk(void *, void *, int, int) __asm__("FUN_L00_0026f548"); extern void spawn_gravity_floor_burst_particle( void *, void *, int, float, float, float, int, int, int) __asm__("FUN_L00_002738e8"); diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 3804a3bf9f..bc4cb89b6d 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -507,11 +507,9 @@ extern char *mine_camera_blast(char *, char *, int, char *) __asm__("FUN_L00_ extern s32 scale_game_frames_c(s32) __asm__("func_001F96F8"); extern unsigned swap_packed_color_channels(unsigned, int) __asm__("FUN_L00_0025c0e8"); extern void -send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__( - "FUN_L00_0025a9f8"); +send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); extern void swap_color_channel_words(int *, int *, int *, int) __asm__("FUN_L00_0025c088"); -extern void spawn_particle(void *, void *, int, int, float, int, int, int, int, float) __asm__( - "FUN_L00_0026a9f0"); +extern void spawn_particle(void *, void *, int, int, float, int, int, int, int, float) __asm__("FUN_L00_0026a9f0"); extern char *func_L00_002E0CB8_DD3D8(float, void *, void *,