From beff447e05673165e319a5f5d85259fc0fdc132a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 18:02:50 +0000 Subject: [PATCH 001/758] overlay: name path_8808 --- .../shared/mobys/test_path_segment_strict_crossing.h | 2 +- src/overlays/l02/mobys/sand_shark.c | 3 ++- src/overlays/l05/mobys/extermibot.c | 4 ++-- src/overlays/l06/mobys/alien_snapper.c | 3 ++- src/overlays/l12/mobys/hoven_anklebiter.c | 3 ++- src/overlays/l13/mobys/blarg_space_commando.c | 6 +++--- src/overlays/shared/enemies/blarg_space_commando.c | 4 ++-- src/overlays/shared/enemies/frog.c | 4 ++-- src/overlays/shared/enemies/large_amoeboid.c | 4 ++-- src/overlays/shared/game/unlock_planet.c | 4 ++-- .../shared/mobys/test_path_segment_strict_crossing.c | 4 ++-- src/overlays/shared/pickups/crate.c | 4 ++-- 12 files changed, 24 insertions(+), 21 deletions(-) diff --git a/include/rnc/overlay/shared/mobys/test_path_segment_strict_crossing.h b/include/rnc/overlay/shared/mobys/test_path_segment_strict_crossing.h index f9cbe3aef8..d681232c09 100644 --- a/include/rnc/overlay/shared/mobys/test_path_segment_strict_crossing.h +++ b/include/rnc/overlay/shared/mobys/test_path_segment_strict_crossing.h @@ -7,7 +7,7 @@ void update_joint_animation(void *m, unsigned char *p, int c, float fa, float fb void initialize_moby_transform_history(int source_moby, char *history_state) __asm__("FUN_L00_00262500"); -int FUN_L00_00261b48(int, void *, void *, void *); +int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); void path_sample_at_distance(int, float *, float *, void *, float, float) __asm__("FUN_L00_00262360"); #endif /* LOMBYTE_RNC_OVERLAY_SHARED_MOBYS_TEST_PATH_SEGMENT_STRICT_CROSSING_H */ diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 560b7a6a20..a6a5ff014e 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -14,6 +14,7 @@ #include "rnc/overlay/l02/mobys/sand_shark_globals.h" #include "rnc/overlay/shared/math/random/random_int_between.h" #include "rnc/overlay/shared/mobys/test_path_segment_strict_crossing.h" +int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); #include "rnc/rendering/clip_volume.h" #include "rnc/world/collision/ground_probe.h" @@ -488,7 +489,7 @@ void sand_shark_update(struct Moby *moby) { &target_home_delta, 1.0f); FUN_L02_002d63c0_e50(moby); - if (FUN_L00_00261b48(sand_shark_behavior_vars->path, + if (path_8808(sand_shark_behavior_vars->path, &moby->pos, &target_or_particle_vector, &navigation_point) && diff --git a/src/overlays/l05/mobys/extermibot.c b/src/overlays/l05/mobys/extermibot.c index 1b02c8273c..744b7cdcb9 100644 --- a/src/overlays/l05/mobys/extermibot.c +++ b/src/overlays/l05/mobys/extermibot.c @@ -61,7 +61,7 @@ extern float fast_vec_dist(void *, void *); extern int D_L05_0015FFD8; extern int D_L05_0015F5C4; extern int step_moby_motion(void *, void *) __asm__("FUN_L00_0025c698"); -extern int FUN_L00_00261b48(int, void *, void *, void *); +extern int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); extern int is_point_inside_clip_volume(void *point, int volume_index) __asm__("func_00214720"); extern s32 follow_path(void *, s32, s32, void *, s32, void *, f32) __asm__("FUN_L01_00276fe8"); extern s32 @@ -330,7 +330,7 @@ void extermibot_update(unsigned char *moby) { moby_data->path, moby_position, moby_position, (D_L05_00161A98) * 0.4f); } near = 0; - if (FUN_L00_00261b48(moby_data->path, moby_position, target_moby + 0x10, hit) != 0 && + if (path_8808(moby_data->path, moby_position, target_moby + 0x10, hit) != 0 && fast_vec_dist((float *)moby_position, hit) < 1.5f) { near = 1; } diff --git a/src/overlays/l06/mobys/alien_snapper.c b/src/overlays/l06/mobys/alien_snapper.c index 2678dbc082..8e640f1138 100644 --- a/src/overlays/l06/mobys/alien_snapper.c +++ b/src/overlays/l06/mobys/alien_snapper.c @@ -14,6 +14,7 @@ #include "rnc/math/random.h" #include "rnc/mobys/moby_spawn.h" #include "rnc/overlay/shared/mobys/test_path_segment_strict_crossing.h" +int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); #include "rnc/rendering/clip_volume.h" enum { @@ -490,7 +491,7 @@ void alien_snapper_update(Moby *moby) { moby, &snapper_behavior->movement, scratch.m.dir, scratch.m.out, 1.0f); moby->rot.z = saved_rot; func_L00_00262DF0_91A8(0.5f, snapper_behavior->path, &moby->pos, &moby->pos); - if (FUN_L00_00261b48( + if (path_8808( snapper_behavior->path, &moby->pos, &target->pos, scratch.m.path_point) != 0 && fast_vec_dist(&moby->pos, scratch.m.path_point) < snapper_behavior->reach_distance) { near = 1; diff --git a/src/overlays/l12/mobys/hoven_anklebiter.c b/src/overlays/l12/mobys/hoven_anklebiter.c index f8eaec66c5..a550ba97fd 100644 --- a/src/overlays/l12/mobys/hoven_anklebiter.c +++ b/src/overlays/l12/mobys/hoven_anklebiter.c @@ -21,6 +21,7 @@ #include "rnc/overlay/shared/mobys/count_active_moby_group_members.h" #include "rnc/overlay/shared/mobys.h" #include "rnc/overlay/shared/mobys/test_path_segment_strict_crossing.h" +int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); #include "rnc/overlay/shared/weapons/suckcannon.h" /* Suck cannon suction method: state 8 while sucked (alerting its group), back to 1 when released; no suction in states 9, 11 and 13. */ @@ -702,7 +703,7 @@ int move_hoven_anklebiter_toward_heading(struct Moby *moby, float speed) { fast_vec_sub(path_test_offset, pre_move_position, &moby->pos); fast_vec_normalize(path_test_offset, path_test_offset, 0.05f); fast_vec_add(path_test_position, pre_move_position, path_test_offset); - if (FUN_L00_00261b48(*(int *)(moby_vars + 0x2D0), + if (path_8808(*(int *)(moby_vars + 0x2D0), &moby->pos, path_test_position, path_corrected_position) != 0) { diff --git a/src/overlays/l13/mobys/blarg_space_commando.c b/src/overlays/l13/mobys/blarg_space_commando.c index d4e1dcb889..802bc77fbd 100644 --- a/src/overlays/l13/mobys/blarg_space_commando.c +++ b/src/overlays/l13/mobys/blarg_space_commando.c @@ -133,7 +133,7 @@ typedef struct { extern int FUN_L00_00258b50(struct Moby *, void *, void *, void *, float); -extern int FUN_L00_00261b48(int, void *, void *, void *); +extern int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); extern s32 rand(void); @@ -382,7 +382,7 @@ void blarg_space_commando_update(struct Moby *moby) { resolve_point_path_segment_xy_clearance( blarg_space_commando_vars->path, &moby->pos, &moby->pos, 0.75f); path_blocked = 0; - if (FUN_L00_00261b48( + if (path_8808( blarg_space_commando_vars->path, &moby->pos, &target->pos, &direction) != 0 && fast_vec_dist(&moby->pos, &direction) < 0.8f) { path_blocked = 1; @@ -422,7 +422,7 @@ void blarg_space_commando_update(struct Moby *moby) { FUN_L00_00258b50(moby, &blarg_space_commando_vars->ctl, &point, &origin, 1.0f); resolve_point_path_segment_xy_clearance( blarg_space_commando_vars->path, &moby->pos, &moby->pos, 0.75f); - if (FUN_L00_00261b48( + if (path_8808( blarg_space_commando_vars->path, &moby->pos, &target->pos, &direction) != 0 && fast_vec_dist(&moby->pos, &direction) < 0.8f) { blocked = 1; diff --git a/src/overlays/shared/enemies/blarg_space_commando.c b/src/overlays/shared/enemies/blarg_space_commando.c index c096d6b189..87f5902b9b 100644 --- a/src/overlays/shared/enemies/blarg_space_commando.c +++ b/src/overlays/shared/enemies/blarg_space_commando.c @@ -131,7 +131,7 @@ extern void spawn_explosion(struct Moby *, s32, s32, s32) __asm__("FUN_L00_0025e450"); -extern s32 FUN_L00_00261b48(s32, void *, void *, void *); +extern s32 path_8808(s32, void *, void *, void *) __asm__("FUN_L00_00261b48"); extern void resolve_point_path_segment_xy_clearance(s32, void *, void *, f32) __asm__("FUN_L00_00261d78"); extern void FUN_L00_00263ac8(struct Moby *, s32, void *, f32); @@ -395,7 +395,7 @@ void blarg_space_commando_update(struct Moby *moby) { 1.0f); resolve_point_path_segment_xy_clearance( blarg_commando_state->path, &moby->pos, &moby->pos, 0.75f); - if (FUN_L00_00261b48(blarg_commando_state->path, + if (path_8808(blarg_commando_state->path, &moby->pos, &target->pos, &movement_output_or_hit_vector_or_path_point) != 0 && diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index ac30a43815..924567c4f7 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -143,7 +143,7 @@ extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern float FUN_L00_0025abf0(void *, void *, void *, float, float); extern int step_moby_motion(void *, void *) __asm__("FUN_L00_0025c698"); -extern int FUN_L00_00261b48(int, void *, void *, void *); +extern int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); extern int FUN_L00_002dc9f0(void *, void *); extern void FUN_L00_00257470(void *, int, int); extern void collect_mobies_in_sphere_at_moby_point( @@ -536,7 +536,7 @@ void frog_update(unsigned char *moby) { blend_frog_rotation_to_facing_frame((char *)moby, (float *)D_L06_00174600, B); fast_vec_normalize(A, moby + 0xC0, frog_instance_vars->unk1E4 * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, A, 1, 0.3f, 0.3f); - if (FUN_L00_00261b48(frog_instance_vars->unk1EC, &MOBY(moby)->pos, target + 0x10, D) != 0 && + if (path_8808(frog_instance_vars->unk1EC, &MOBY(moby)->pos, target + 0x10, D) != 0 && fast_vec_dist(&MOBY(moby)->pos, D) < frog_instance_vars->unk244) { near = 1; } diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index 00ebd75d25..8953b8186a 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -139,7 +139,7 @@ extern void spawn_amoeboid_burst_sparks(unsigned char *, float *) __asm__("FUN_L extern int follow_path(int *, int, int, float, void *, void *, void *) __asm__("FUN_L01_00276fe8"); extern void FUN_L01_0026d930(void *); extern void FUN_L00_00258b50(void *, void *, void *, void *, float); -extern int FUN_L00_00261b48(int, void *, void *, void *); +extern int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); extern int FUN_L00_002dc9f0(void *, void *); extern int FUN_L00_00257470(void *, int, int); extern int is_value_within_interpolated_window(float, void *) __asm__("FUN_00214cc8"); @@ -414,7 +414,7 @@ void large_amoeboid_update(unsigned char *moby) { move[2] = 0.0f; FUN_L00_00258b50( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); - if (FUN_L00_00261b48(large_amoeboid_vars->unk240, &MOBY(moby)->pos, target + 0x10, hit) != + if (path_8808(large_amoeboid_vars->unk240, &MOBY(moby)->pos, target + 0x10, hit) != 0 && fast_vec_dist(&MOBY(moby)->pos, hit) < 1.5f) blocked = 1; diff --git a/src/overlays/shared/game/unlock_planet.c b/src/overlays/shared/game/unlock_planet.c index 79e5961a97..afbff88961 100644 --- a/src/overlays/shared/game/unlock_planet.c +++ b/src/overlays/shared/game/unlock_planet.c @@ -484,7 +484,7 @@ extern s32 D_0015EEA0_macro __asm__("D_0015EEA0") MACRO_ADDR; extern int D_L00_0015F598; extern unsigned char D_L00_0015FC88_macro[] __asm__("D_L00_0015FC88") MACRO_ADDR; extern void debug_print() __asm__("FUN_001e93b0"); -extern int FUN_L00_00261b48(int, void *, void *, void *); +extern int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); extern void spawn_bolt_by_value(void *, void *, void *, int, int, int) __asm__("FUN_L00_002a7438"); void spawn_randomized_bolt_drop(struct Moby *moby, @@ -690,7 +690,7 @@ void spawn_randomized_bolt_drop( } fast_vec_scale(landing, velocity, time); fast_vec_add(landing, landing, &moby->pos); - roots = FUN_L00_00261b48(path_index, &moby->pos, landing, path_point); + roots = path_8808(path_index, &moby->pos, landing, path_point); fast_vec_sub(landing, path_point, position); landing[2] = 0.0f; fast_vec_normalize(quarter, landing, 0.25f); 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 8c183fd2a2..17c6c37607 100644 --- a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c +++ b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c @@ -108,9 +108,9 @@ typedef struct { OvlVec4_261b48 points[1]; } SegmentPath_261d78_261b48; -int FUN_L00_00261b48(int idx, void *a, void *b, void *c); +int path_8808(int idx, void *a, void *b, void *c) __asm__("FUN_L00_00261b48"); -int FUN_L00_00261b48(int segment_path_index, +int path_8808(int segment_path_index, void *segment_start, void *segment_end, diff --git a/src/overlays/shared/pickups/crate.c b/src/overlays/shared/pickups/crate.c index 46302e4cd7..108df05bfc 100644 --- a/src/overlays/shared/pickups/crate.c +++ b/src/overlays/shared/pickups/crate.c @@ -604,7 +604,7 @@ void mark_moby_for_removal_cf(u8 *, s32, s32) __asm__("FUN_L00_00257470"); s32 FUN_L00_00257218_2d0538(u8 *, s32 *) __asm__("FUN_L00_00257218"); f32 random_angle_radians(void) __asm__("FUN_00213308"); s32 solve_quadratic_equation(f32 *, f32 *, f32, f32, f32) __asm__("FUN_L00_002595a0"); -void FUN_L00_00261b48(s32, void *, void *, void *); +void path_8808(s32, void *, void *, void *) __asm__("FUN_L00_00261b48"); u8 *spawn_on_path(u8 *, s32, s32, s32) __asm__("FUN_L00_002c52a8"); void crate_drop_bolts(u8 *a) __asm__("FUN_L00_002d0538"); @@ -989,7 +989,7 @@ void crate_drop_bolts(u8 *crate_moby) { trajectory_time = larger_trajectory_time_root; fast_vec_scale(&trajectory_vector, spawned_vars + 0x10, trajectory_time); fast_vec_add(&trajectory_vector, &trajectory_vector, &MOBY(crate_moby)->pos); - FUN_L00_00261b48(*(s32 *)(crate_vars + 0xC0), + path_8808(*(s32 *)(crate_vars + 0xC0), &MOBY(crate_moby)->pos, &trajectory_vector, &adjusted_position); From 2dc31d75c082ecf12faeee69f22d81cef5a28b2e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 18:24:31 +0000 Subject: [PATCH 002/758] decomp: clarify names in check_path_key_camera_priority other -> comparison_camera: The established check_path_key_camera_priority receives this second char * separately from the owning moby. Original Ghidra param_2 and retail 0x00316768 preserve a1 in a3; 0x003167C4 null-tests a3, and 0x003167CC loads its signed-short +0x7E state, with 0x003167D0 returning 1 for nonzero. The supplied source exit_path_key_camera writes the same +0x7E camera state. Thus this is the optional comparison camera whose state gates the priority decision, without asserting whether it is active or a candidate. --- 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 824aac53b4..01f5a91d56 100644 --- a/src/overlays/l14/path_key_camera.c +++ b/src/overlays/l14/path_key_camera.c @@ -494,14 +494,14 @@ extern char *l14_camera_preset_rows __asm__("D_L14_0015EF50"); int check_path_key_camera_priority(char *moby, char *other) __asm__("FUN_L14_00316748"); -int check_path_key_camera_priority(char *moby, char *other) { +int check_path_key_camera_priority(char *moby, char *comparison_camera) { char *slot_record = *(char **)(l14_camera_preset_rows + *(short *)(moby + 0x84) * 32 + 0x1C); if (*(int *)(slot_record + 0x20) == 0 && *(short *)(D_L14_00167500 + 0x86) == 0x14) { *(int *)(slot_record + 0x20) = 1; } else if (*(int *)(slot_record + 0x20) == 1) { if (*(short *)(D_L14_00167500 + 0x86) != 0x14) return 1; - if (other == 0 || *(short *)(other + 0x7E) != 0) + if (comparison_camera == 0 || *(short *)(comparison_camera + 0x7E) != 0) return 1; } return 0; From 3213ae43aa84bdba74fe8e64e3ee351b2baf09d0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 18:35:13 +0000 Subject: [PATCH 003/758] decomp: clarify names in read_buf_delete buf -> stream_read_buffer: Source binds buf as struct ReadBuf * in read_buf_delete, with original readBufDelete__FP7ReadBuf alias. Retail caller 0x0023aa68, called by play_mpeg_stream at 0x0023a42c, loads the pointer at 0x0016120c into a0 at 0x0023aa80-0x0023aa84 and calls this function at 0x0023aa88 during stream cleanup, before thread and DMA/INTC handler removal. This identifies the stream's read buffer; the target's 0x0023b958 jr ra and 0x0023b95c nop do not establish release behavior. --- src/movies/decoder/buffers/read_buf_delete.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/movies/decoder/buffers/read_buf_delete.c b/src/movies/decoder/buffers/read_buf_delete.c index a93b8678d4..3063f9970a 100644 --- a/src/movies/decoder/buffers/read_buf_delete.c +++ b/src/movies/decoder/buffers/read_buf_delete.c @@ -2,7 +2,7 @@ void read_buf_delete(struct ReadBuf *buf) __asm__("func_0023B958"); -void read_buf_delete(struct ReadBuf *buf) { +void read_buf_delete(struct ReadBuf *stream_read_buffer) { } /* Recovered original symbol name. */ From 5caa4624b4a497f4e96930a4af8836dc5a6a5069 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 18:49:41 +0000 Subject: [PATCH 004/758] overlay: name fast_add_rotations_cf_spherical_offset --- include/rnc/overlay/shared/game/queue_planet_unlock_message.h | 2 +- src/overlays/l01/hero/update_hero_motion_for_current_state.c | 4 ++-- src/overlays/l03/hero/update_hero_motion_for_current_state.c | 4 ++-- src/overlays/l05/hero/update_hero_motion_by_state.c | 4 ++-- src/overlays/l06/hero/update_hero_motion_for_current_state.c | 2 +- src/overlays/l08/hero/update_hero_motion_for_current_state.c | 4 ++-- src/overlays/l08/mobys/rocket.c | 4 ++-- src/overlays/l11/hero/update_hero_motion_by_state.c | 4 ++-- src/overlays/l12/hero/update_hero_motion_for_current_state.c | 4 ++-- src/overlays/l12/mobys/hoven_turret.c | 4 ++-- src/overlays/l14/hero/update_hero_motion_by_state.c | 2 +- src/overlays/l15/hero/update_hero_motion_for_current_state.c | 4 ++-- src/overlays/l16/hero/update_hero_motion_for_current_state.c | 4 ++-- src/overlays/l17/hero/update_hero_motion_for_current_state.c | 4 ++-- src/overlays/l18/hero/update_hero_motion_for_current_state.c | 4 ++-- src/overlays/shared/game/queue_planet_unlock_message.c | 4 ++-- src/overlays/shared/hero/hero_update_movement.c | 4 ++-- .../shared/rendering/effects/parent_following_effect.c | 4 ++-- 18 files changed, 33 insertions(+), 33 deletions(-) diff --git a/include/rnc/overlay/shared/game/queue_planet_unlock_message.h b/include/rnc/overlay/shared/game/queue_planet_unlock_message.h index 97877941bd..7b432b8ad5 100644 --- a/include/rnc/overlay/shared/game/queue_planet_unlock_message.h +++ b/include/rnc/overlay/shared/game/queue_planet_unlock_message.h @@ -5,6 +5,6 @@ void queue_planet_unlock_message(s32) __asm__("FUN_L00_00262d38"); -void FUN_L00_00262cf0(void *, void *); +void fast_add_rotations_cf_spherical_offset(void *, void *) __asm__("FUN_L00_00262cf0"); #endif /* LOMBYTE_RNC_OVERLAY_SHARED_GAME_QUEUE_PLANET_UNLOCK_MESSAGE_H */ diff --git a/src/overlays/l01/hero/update_hero_motion_for_current_state.c b/src/overlays/l01/hero/update_hero_motion_for_current_state.c index eafef45818..de76326ce9 100644 --- a/src/overlays/l01/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l01/hero/update_hero_motion_for_current_state.c @@ -442,7 +442,7 @@ extern void clip_hero_horizontal_velocity(int) __asm__("FUN_L01_00232978"); extern void air_accel(float) __asm__("FUN_L01_00234358"); extern void update_hero_airborne_planar_motion(void) __asm__("FUN_L01_00234b40"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void fast_add_rotations_cf(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); extern void fast_sin_cf(int, int) __asm__("FUN_L00_00209638"); extern void correct_hero_airborne_wall_velocity(void) __asm__("FUN_L00_002121c0"); extern void release_voice_slot_cf(int, int, int) __asm__("FUN_L00_00216e48"); @@ -904,7 +904,7 @@ void update_hero_motion_for_current_state(void) { vector_and_hit_scratch[0][1] += random_float_between(0.0f, 0.03f); vector_and_hit_scratch[0][2] += random_float_between(0.0f, 0.03f); qcopy(vector_and_hit_scratch[1], hero.motion.displacement.f); - fast_add_rotations_cf(vector_and_hit_scratch[1], + fast_add_rotations_cf_spherical_offset(vector_and_hit_scratch[1], vector_and_hit_scratch[1], frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/l03/hero/update_hero_motion_for_current_state.c b/src/overlays/l03/hero/update_hero_motion_for_current_state.c index a497c13e25..2ae34f2aac 100644 --- a/src/overlays/l03/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l03/hero/update_hero_motion_for_current_state.c @@ -224,7 +224,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -744,7 +744,7 @@ void update_hero_motion_for_current_state(void) { spatial_scratch_or_hit_descriptor.f[1] += random_float_between(0.0f, 0.03f); spatial_scratch_or_hit_descriptor.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - FUN_L00_00262cf0(&v10, + fast_add_rotations_cf_spherical_offset(&v10, &v10, frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/l05/hero/update_hero_motion_by_state.c b/src/overlays/l05/hero/update_hero_motion_by_state.c index dfb92d1cc9..0a4ce1ddd3 100644 --- a/src/overlays/l05/hero/update_hero_motion_by_state.c +++ b/src/overlays/l05/hero/update_hero_motion_by_state.c @@ -177,7 +177,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -703,7 +703,7 @@ void update_hero_motion_by_state(void) { vector_and_hit_scratch.f[1] += random_float_between(0.0f, 0.03f); vector_and_hit_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - FUN_L00_00262cf0(&v10, + fast_add_rotations_cf_spherical_offset(&v10, &v10, frame_time * -0.75f, hero.motion.rot.f[2], 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 aa15aa4243..164fb5f441 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 @@ -917,7 +917,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); diff --git a/src/overlays/l08/hero/update_hero_motion_for_current_state.c b/src/overlays/l08/hero/update_hero_motion_for_current_state.c index 6b6b2907ae..999ae626f3 100644 --- a/src/overlays/l08/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l08/hero/update_hero_motion_for_current_state.c @@ -291,7 +291,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -815,7 +815,7 @@ void update_hero_motion_for_current_state(void) { vector_and_attack_descriptor_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - FUN_L00_00262cf0(&v10, + fast_add_rotations_cf_spherical_offset(&v10, &v10, frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/l08/mobys/rocket.c b/src/overlays/l08/mobys/rocket.c index c19e2f21aa..e182a96f2c 100644 --- a/src/overlays/l08/mobys/rocket.c +++ b/src/overlays/l08/mobys/rocket.c @@ -159,7 +159,7 @@ extern int D_L08_0015F5C4_macro __asm__("D_L08_0015F5C4") MACRO_ADDR; #include "rnc/overlay/l08/mobys/rocket_data/rocket_update.h" extern unsigned int D_L08_0015FFDC MACRO_ADDR; -extern void FUN_L00_00262cf0(void *, void *, float, float, float); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); extern void spawn_effect(void *, void *, int, int, int, int, int, int) __asm__("FUN_L00_00269958"); extern void FUN_L08_002de528_u(void *, int, int, int) __asm__("FUN_L08_002de528"); void rocket_update(M46 *moby) __asm__("FUN_L08_002dd3c0"); @@ -225,7 +225,7 @@ void rocket_update(M46 *moby) { yaw = fast_arc_tan(moby->position[0] - target[0], moby->position[1] - target[1]); pitch = fast_arc_tan(vector_distance_xy(target, moby->position), moby->position[2] - target[2]); - FUN_L00_00262cf0(target, target, data->roll, data->yaw, data->pitch); + fast_add_rotations_cf_spherical_offset(target, target, data->roll, data->yaw, data->pitch); fast_vec_sub(delta, target, moby->position); FUN_L00_0025f730(delta, target_data->speed * D_0015ED6C); fast_vec_sub(velocity_correction_or_effect_velocity, delta, data->velocity); diff --git a/src/overlays/l11/hero/update_hero_motion_by_state.c b/src/overlays/l11/hero/update_hero_motion_by_state.c index 57d5b67c3b..50f3a6eb2e 100644 --- a/src/overlays/l11/hero/update_hero_motion_by_state.c +++ b/src/overlays/l11/hero/update_hero_motion_by_state.c @@ -276,7 +276,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -799,7 +799,7 @@ void update_hero_motion_by_state(void) { vector_and_hit_descriptor_head_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - FUN_L00_00262cf0(&v10, + fast_add_rotations_cf_spherical_offset(&v10, &v10, frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/l12/hero/update_hero_motion_for_current_state.c b/src/overlays/l12/hero/update_hero_motion_for_current_state.c index d7fbdc307c..a0ed4fdedd 100644 --- a/src/overlays/l12/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l12/hero/update_hero_motion_for_current_state.c @@ -559,7 +559,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); @@ -1092,7 +1092,7 @@ void update_hero_motion_for_current_state(void) { geometry_and_hit_descriptor_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - FUN_L00_00262cf0(&v10, + fast_add_rotations_cf_spherical_offset(&v10, &v10, frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/l12/mobys/hoven_turret.c b/src/overlays/l12/mobys/hoven_turret.c index 9e6ed614c5..af0f4c4014 100644 --- a/src/overlays/l12/mobys/hoven_turret.c +++ b/src/overlays/l12/mobys/hoven_turret.c @@ -182,7 +182,7 @@ extern void spawn_explosion(void *, int, int, int) __asm__("FUN_L00_0025e450"); -extern void FUN_L00_00262cf0(void *, void *, float, float, float); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void queue_scene_movie_with_game_language(int) __asm__("FUN_L00_00299460"); extern void spawn_turret_rocket(void *, void *, void *, int) __asm__("FUN_L08_002e7eb0"); @@ -494,7 +494,7 @@ void hoven_turret_update(struct Moby *moby) { randomized_view_pitch = fast_add_rotations(l12_camera.pitch, randf_sym(0.0f, 0.5235988f)); qcopy(explosion_position, &l12_camera.pos); - FUN_L00_00262cf0(explosion_position, + fast_add_rotations_cf_spherical_offset(explosion_position, explosion_position, randomized_view_offset_distance, randomized_view_yaw, 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 987e9fe9c0..88ac50a603 100644 --- a/src/overlays/l14/hero/update_hero_motion_by_state.c +++ b/src/overlays/l14/hero/update_hero_motion_by_state.c @@ -431,7 +431,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); 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 066fcba351..f0103c9152 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 @@ -488,7 +488,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -981,7 +981,7 @@ void update_hero_motion_for_current_state(void) { spatial_or_hit_descriptor_work.f[1] += random_float_between(0.0f, 0.03f); spatial_or_hit_descriptor_work.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - FUN_L00_00262cf0(&v10, + fast_add_rotations_cf_spherical_offset(&v10, &v10, frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/l16/hero/update_hero_motion_for_current_state.c b/src/overlays/l16/hero/update_hero_motion_for_current_state.c index e0dc43af8f..4a5af02b0a 100644 --- a/src/overlays/l16/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l16/hero/update_hero_motion_for_current_state.c @@ -181,7 +181,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -701,7 +701,7 @@ void update_hero_motion_for_current_state(void) { primary_vector_scratch.f[1] += random_float_between(0.0f, 0.03f); primary_vector_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - FUN_L00_00262cf0(&v10, + fast_add_rotations_cf_spherical_offset(&v10, &v10, frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/l17/hero/update_hero_motion_for_current_state.c b/src/overlays/l17/hero/update_hero_motion_for_current_state.c index 16646456d1..87368a8aec 100644 --- a/src/overlays/l17/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l17/hero/update_hero_motion_for_current_state.c @@ -165,7 +165,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -694,7 +694,7 @@ void update_hero_motion_for_current_state(void) { scratch_vector.f[1] += random_float_between(0.0f, 0.03f); scratch_vector.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - FUN_L00_00262cf0(&v10, + fast_add_rotations_cf_spherical_offset(&v10, &v10, frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/l18/hero/update_hero_motion_for_current_state.c b/src/overlays/l18/hero/update_hero_motion_for_current_state.c index a7dea1b0d9..090ee02fa2 100644 --- a/src/overlays/l18/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l18/hero/update_hero_motion_for_current_state.c @@ -165,7 +165,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -657,7 +657,7 @@ void update_hero_motion_for_current_state(void) { general_vector_or_hit_descriptor_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - FUN_L00_00262cf0(&v10, + fast_add_rotations_cf_spherical_offset(&v10, &v10, frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/shared/game/queue_planet_unlock_message.c b/src/overlays/shared/game/queue_planet_unlock_message.c index f15f4737f1..2d812bb060 100644 --- a/src/overlays/shared/game/queue_planet_unlock_message.c +++ b/src/overlays/shared/game/queue_planet_unlock_message.c @@ -5,9 +5,9 @@ #include "rnc/overlay/shared/mobys/select_auto_aim_target_moby.h" void build_spherical_offset(void *) __asm__("FUN_00214db0"); -void FUN_L00_00262cf0(void *a, void *b); +void fast_add_rotations_cf_spherical_offset(void *a, void *b) __asm__("FUN_L00_00262cf0"); -void FUN_L00_00262cf0(void *destination, void *base_vector) { +void fast_add_rotations_cf_spherical_offset(void *destination, void *base_vector) { char spherical_offset[16]; build_spherical_offset(spherical_offset); fast_vec_add(destination, spherical_offset, base_vector); diff --git a/src/overlays/shared/hero/hero_update_movement.c b/src/overlays/shared/hero/hero_update_movement.c index dcf211db94..cf7a0107ff 100644 --- a/src/overlays/shared/hero/hero_update_movement.c +++ b/src/overlays/shared/hero/hero_update_movement.c @@ -126,7 +126,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -676,7 +676,7 @@ void hero_update_movement(void) { movement_and_hit_descriptor_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - FUN_L00_00262cf0(&v10, + fast_add_rotations_cf_spherical_offset(&v10, &v10, frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/shared/rendering/effects/parent_following_effect.c b/src/overlays/shared/rendering/effects/parent_following_effect.c index 0b93684f66..7c3995dc9f 100644 --- a/src/overlays/shared/rendering/effects/parent_following_effect.c +++ b/src/overlays/shared/rendering/effects/parent_following_effect.c @@ -7,7 +7,7 @@ #include "qcopy.h" extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); -extern void FUN_L00_00262cf0(void *, void *, float, float, float); +extern void fast_add_rotations_cf_spherical_offset(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); /* update: follow the parent, blend its color, scale by the wind factor */ @@ -32,7 +32,7 @@ void parent_following_effect_update(char *moby) { qcopy(&MOBY(moby)->pos, *(char **)(*(char **)moby_pvars + 0x78) + 0xF0); accumulated_offset = *(float *)(moby_pvars + 0x10) + *(float *)(moby_pvars + 0x14); *(float *)(moby_pvars + 0x10) = accumulated_offset; - FUN_L00_00262cf0(&MOBY(moby)->pos, + fast_add_rotations_cf_spherical_offset(&MOBY(moby)->pos, &MOBY(moby)->pos, -accumulated_offset, MOBY(moby)->rot.z, From 53e8add340557f513e115b863c965f29ae1d0396 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:05:36 +0000 Subject: [PATCH 005/758] decomp: clarify names in restore_camera_vectors domain_0_value_0 -> CAMERA_TRANSITION_ALTERNATE_DISABLED: The authoritative source compares transition->kind != 0. Retail 0x001ec870 loads the byte at cam_trans_state+2 and 0x001ec874 branches directly to return when zero, skipping the +0xc0 -> +0x50 and +0xd0 -> +0x60 quadword copies at 0x001ec880-0x001ec894. Original retail Ghidra identifies that same tested byte as g_bCameraUseAlternateTransition and the copies as alternate position/rotation restoration into primary fields. Thus zero disables alternate transition restoration; no additional kind-domain semantics are inferred. --- src/camera/restore_camera_vectors.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/camera/restore_camera_vectors.c b/src/camera/restore_camera_vectors.c index b4668ddf96..9584774041 100644 --- a/src/camera/restore_camera_vectors.c +++ b/src/camera/restore_camera_vectors.c @@ -6,8 +6,11 @@ void restore_camera_vectors(void) __asm__("FUN_001ec868"); void restore_camera_vectors(void) { + enum { + CAMERA_TRANSITION_ALTERNATE_DISABLED = 0 + }; struct CameraTransition *transition = &cam_trans_state; - if (transition->kind != 0) { + if (transition->kind != CAMERA_TRANSITION_ALTERNATE_DISABLED) { qcopy(transition->blend.position, transition->orbit.saved_position); qcopy(transition->blend.rotation, transition->orbit.saved_rotation); } From a62bbc4b86a5ec52b8b0b9fa9643d1dbff6f1e67 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:05:36 +0000 Subject: [PATCH 006/758] decomp: clarify names in save_card_state_formatting domain_0_value_0 -> MEMCARD_QUERY_INFO: The authoritative source binds card_state to memory_card_state; retail 0x00208b30 forms a1=0x0013d290, 0x00208b40 loads pending_state at +0xdc, and 0x00208b44 bgez excludes nonnegative operations. The supplied include/rnc/save/memory_card_state.h MemoryCardOperation declaration context explicitly states MemoryCardState.state/pending_state use MemoryCardOperation, and its canonical MEMCARD_QUERY_INFO member equals zero. Reuse that member solely as the existing signed comparison boundary; this does not claim that the branch requests query-info. --- 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 2e94b3b4e3..15c97c977d 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) { mode_freeze_state = 0x11; mode_freeze_flags |= 0x40; From ad1cda21395f2d11c62d79c6b6179761e32f7c4e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:05:36 +0000 Subject: [PATCH 007/758] decomp: clarify names in save_card_state_checking_save domain_1_value_19 -> SAVE_CARD_STATE_INSUFFICIENT_FREE_SPACE: In save_card_state_checking_save, mode_freeze_state is the destination state selector. Retail 0x00208c30 loads card[0].free from memory_card_state+0xc; 0x00208c34 compares it with 0x15e (350). Only the below-threshold path loads 19 at 0x00208c40 and stores it to mode_freeze_state at 0x00208c48, after save_index == -2 at 0x00208c28. Thus this destination represents insufficient free space for the checked save. This is a menu-state value, not MemoryCardOperation or its substeps. --- src/ui/menus/save_data/save_card_state_checking_save.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ui/menus/save_data/save_card_state_checking_save.c b/src/ui/menus/save_data/save_card_state_checking_save.c index 3dcda2281d..6df3cee85f 100644 --- a/src/ui/menus/save_data/save_card_state_checking_save.c +++ b/src/ui/menus/save_data/save_card_state_checking_save.c @@ -5,6 +5,9 @@ void save_card_state_checking_save(void) __asm__("FUN_00208c00"); void save_card_state_checking_save(void) { + enum { + SAVE_CARD_STATE_INSUFFICIENT_FREE_SPACE = 0x13 + }; struct MemoryCardState *card_state = &memory_card_state; int save_index; if (card_state->card[0].sync_result < -1) { @@ -14,7 +17,7 @@ void save_card_state_checking_save(void) { save_index = card_state->card[0].save_index; if (save_index == -2) { if (card_state->card[0].free < 0x15E) { - mode_freeze_state = 0x13; + mode_freeze_state = SAVE_CARD_STATE_INSUFFICIENT_FREE_SPACE; } else { mode_freeze_state = 0xC; } From 971e4a8bc0420414aac421fa4b14a9801f97a9de Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:05:36 +0000 Subject: [PATCH 008/758] decomp: clarify names in init_pads domain_0_value_0 -> CONTROLLER_PROFILE_INITIAL_STATE: In the authoritative init_pads snapshot, controller_state.profile_state is initialized after sceDbcInit, scePad2Init and scePad2CreateSocket. Retail 0x002170a4 stores zero to 0x19c(s0), with s0 = controller_state at 0x0013c940. The original decompilation likewise clears DAT_0013cadc after opening the socket. This proves the profile state's initial selection, without asserting its subsequent behavior. domain_1_value_0 -> CONTROLLER_DEVICE_INITIAL_STATE: In the authoritative init_pads snapshot, controller_state.device_state is initialized after controller_state.socket receives scePad2CreateSocket's return. Retail 0x002170a0 stores the socket at 0x194(s0), then 0x002170a8 stores zero at 0x198(s0), address 0x0013cad8. The original decompilation confirms that final clear. This establishes the device state's initial selection in its own domain, not a libpad socket state or a boolean. --- src/input/init_pads.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/input/init_pads.c b/src/input/init_pads.c index de8b6d172b..f9ceec8fea 100644 --- a/src/input/init_pads.c +++ b/src/input/init_pads.c @@ -16,6 +16,10 @@ extern s32 scePad2CreateSocket(scePad2SocketParam *, void *); void init_pads(void) __asm__("FUN_00217048"); void init_pads(void) { + enum { + CONTROLLER_PROFILE_INITIAL_STATE = 0, + CONTROLLER_DEVICE_INITIAL_STATE = 0 + }; sceDbcInit(); scePad2Init(0); D_001CD760.port = 2; @@ -23,8 +27,8 @@ void init_pads(void) { controller_state.socket = scePad2CreateSocket(&D_001CD760, &controller_state); D_001CD760.port = 2; D_001CD760.slot = 1; - controller_state.profile_state = 0; - controller_state.device_state = 0; + controller_state.profile_state = CONTROLLER_PROFILE_INITIAL_STATE; + controller_state.device_state = CONTROLLER_DEVICE_INITIAL_STATE; } extern __typeof__(init_pads) func_00217048 __attribute__((alias("FUN_00217048"))); From bff0bbaabb580e71201a399448aded45e9b24fa7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:08:30 +0000 Subject: [PATCH 009/758] decomp: preserve upstream helper name and format rebased batch --- .../shared/game/queue_planet_unlock_message.h | 2 +- .../l01/hero/update_hero_motion_for_current_state.c | 4 ++-- src/overlays/l02/mobys/sand_shark.c | 8 ++++---- .../l03/hero/update_hero_motion_for_current_state.c | 12 ++++++------ src/overlays/l05/hero/update_hero_motion_by_state.c | 12 ++++++------ .../l06/hero/update_hero_motion_for_current_state.c | 2 +- src/overlays/l06/mobys/alien_snapper.c | 6 +++--- .../l08/hero/update_hero_motion_for_current_state.c | 12 ++++++------ src/overlays/l08/mobys/rocket.c | 4 ++-- src/overlays/l11/hero/update_hero_motion_by_state.c | 12 ++++++------ .../l12/hero/update_hero_motion_for_current_state.c | 12 ++++++------ src/overlays/l12/mobys/hoven_anklebiter.c | 8 ++++---- src/overlays/l12/mobys/hoven_turret.c | 12 ++++++------ src/overlays/l13/mobys/blarg_space_commando.c | 6 ++---- src/overlays/l14/hero/update_hero_motion_by_state.c | 2 +- .../l15/hero/update_hero_motion_for_current_state.c | 12 ++++++------ .../l16/hero/update_hero_motion_for_current_state.c | 12 ++++++------ .../l17/hero/update_hero_motion_for_current_state.c | 12 ++++++------ .../l18/hero/update_hero_motion_for_current_state.c | 12 ++++++------ src/overlays/shared/enemies/blarg_space_commando.c | 6 +++--- src/overlays/shared/enemies/large_amoeboid.c | 3 +-- .../shared/game/queue_planet_unlock_message.c | 4 ++-- src/overlays/shared/hero/hero_update_movement.c | 12 ++++++------ .../shared/mobys/test_path_segment_strict_crossing.c | 6 +++--- src/overlays/shared/pickups/crate.c | 6 +++--- .../rendering/effects/parent_following_effect.c | 12 ++++++------ src/ui/menus/save_data/save_card_state_formatting.c | 3 ++- 27 files changed, 106 insertions(+), 108 deletions(-) diff --git a/include/rnc/overlay/shared/game/queue_planet_unlock_message.h b/include/rnc/overlay/shared/game/queue_planet_unlock_message.h index 7b432b8ad5..f48927f636 100644 --- a/include/rnc/overlay/shared/game/queue_planet_unlock_message.h +++ b/include/rnc/overlay/shared/game/queue_planet_unlock_message.h @@ -5,6 +5,6 @@ void queue_planet_unlock_message(s32) __asm__("FUN_L00_00262d38"); -void fast_add_rotations_cf_spherical_offset(void *, void *) __asm__("FUN_L00_00262cf0"); +void fast_add_rotations_cf(void *, void *) __asm__("FUN_L00_00262cf0"); #endif /* LOMBYTE_RNC_OVERLAY_SHARED_GAME_QUEUE_PLANET_UNLOCK_MESSAGE_H */ diff --git a/src/overlays/l01/hero/update_hero_motion_for_current_state.c b/src/overlays/l01/hero/update_hero_motion_for_current_state.c index de76326ce9..eafef45818 100644 --- a/src/overlays/l01/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l01/hero/update_hero_motion_for_current_state.c @@ -442,7 +442,7 @@ extern void clip_hero_horizontal_velocity(int) __asm__("FUN_L01_00232978"); extern void air_accel(float) __asm__("FUN_L01_00234358"); extern void update_hero_airborne_planar_motion(void) __asm__("FUN_L01_00234b40"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); extern void fast_sin_cf(int, int) __asm__("FUN_L00_00209638"); extern void correct_hero_airborne_wall_velocity(void) __asm__("FUN_L00_002121c0"); extern void release_voice_slot_cf(int, int, int) __asm__("FUN_L00_00216e48"); @@ -904,7 +904,7 @@ void update_hero_motion_for_current_state(void) { vector_and_hit_scratch[0][1] += random_float_between(0.0f, 0.03f); vector_and_hit_scratch[0][2] += random_float_between(0.0f, 0.03f); qcopy(vector_and_hit_scratch[1], hero.motion.displacement.f); - fast_add_rotations_cf_spherical_offset(vector_and_hit_scratch[1], + fast_add_rotations_cf(vector_and_hit_scratch[1], vector_and_hit_scratch[1], frame_time * -0.75f, hero.motion.rot.f[2], diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index a6a5ff014e..bb11d13d72 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -14,7 +14,7 @@ #include "rnc/overlay/l02/mobys/sand_shark_globals.h" #include "rnc/overlay/shared/math/random/random_int_between.h" #include "rnc/overlay/shared/mobys/test_path_segment_strict_crossing.h" -int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); + #include "rnc/rendering/clip_volume.h" #include "rnc/world/collision/ground_probe.h" @@ -490,9 +490,9 @@ void sand_shark_update(struct Moby *moby) { 1.0f); FUN_L02_002d63c0_e50(moby); if (path_8808(sand_shark_behavior_vars->path, - &moby->pos, - &target_or_particle_vector, - &navigation_point) && + &moby->pos, + &target_or_particle_vector, + &navigation_point) && fast_vec_dist(&moby->pos, &navigation_point) < sand_shark_behavior_vars->unk294) { hit14 = 1; } diff --git a/src/overlays/l03/hero/update_hero_motion_for_current_state.c b/src/overlays/l03/hero/update_hero_motion_for_current_state.c index 2ae34f2aac..7cea70c686 100644 --- a/src/overlays/l03/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l03/hero/update_hero_motion_for_current_state.c @@ -224,7 +224,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -744,11 +744,11 @@ void update_hero_motion_for_current_state(void) { spatial_scratch_or_hit_descriptor.f[1] += random_float_between(0.0f, 0.03f); spatial_scratch_or_hit_descriptor.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - fast_add_rotations_cf_spherical_offset(&v10, - &v10, - frame_time * -0.75f, - hero.motion.rot.f[2], - hero.motion.rot.f[1]); + fast_add_rotations_cf(&v10, + &v10, + frame_time * -0.75f, + hero.motion.rot.f[2], + hero.motion.rot.f[1]); hero.pack_particle_timer = truncate_float_to_s32((frame_time * 7.0f - hero.ground_speed) / (frame_time * 7.0f) * scale_game_frames(5)); diff --git a/src/overlays/l05/hero/update_hero_motion_by_state.c b/src/overlays/l05/hero/update_hero_motion_by_state.c index 0a4ce1ddd3..86f041fc7a 100644 --- a/src/overlays/l05/hero/update_hero_motion_by_state.c +++ b/src/overlays/l05/hero/update_hero_motion_by_state.c @@ -177,7 +177,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -703,11 +703,11 @@ void update_hero_motion_by_state(void) { vector_and_hit_scratch.f[1] += random_float_between(0.0f, 0.03f); vector_and_hit_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - fast_add_rotations_cf_spherical_offset(&v10, - &v10, - frame_time * -0.75f, - hero.motion.rot.f[2], - hero.motion.rot.f[1]); + fast_add_rotations_cf(&v10, + &v10, + frame_time * -0.75f, + hero.motion.rot.f[2], + hero.motion.rot.f[1]); hero.pack_particle_timer = truncate_float_to_s32((frame_time * 7.0f - hero.ground_speed) / (frame_time * 7.0f) * scale_game_frames(5)); 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 164fb5f441..c7a2729309 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 @@ -917,7 +917,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); diff --git a/src/overlays/l06/mobys/alien_snapper.c b/src/overlays/l06/mobys/alien_snapper.c index 8e640f1138..7bd46683b0 100644 --- a/src/overlays/l06/mobys/alien_snapper.c +++ b/src/overlays/l06/mobys/alien_snapper.c @@ -14,7 +14,7 @@ #include "rnc/math/random.h" #include "rnc/mobys/moby_spawn.h" #include "rnc/overlay/shared/mobys/test_path_segment_strict_crossing.h" -int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); + #include "rnc/rendering/clip_volume.h" enum { @@ -491,8 +491,8 @@ void alien_snapper_update(Moby *moby) { moby, &snapper_behavior->movement, scratch.m.dir, scratch.m.out, 1.0f); moby->rot.z = saved_rot; func_L00_00262DF0_91A8(0.5f, snapper_behavior->path, &moby->pos, &moby->pos); - if (path_8808( - snapper_behavior->path, &moby->pos, &target->pos, scratch.m.path_point) != 0 && + if (path_8808(snapper_behavior->path, &moby->pos, &target->pos, scratch.m.path_point) != + 0 && fast_vec_dist(&moby->pos, scratch.m.path_point) < snapper_behavior->reach_distance) { near = 1; } diff --git a/src/overlays/l08/hero/update_hero_motion_for_current_state.c b/src/overlays/l08/hero/update_hero_motion_for_current_state.c index 999ae626f3..585eb274f0 100644 --- a/src/overlays/l08/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l08/hero/update_hero_motion_for_current_state.c @@ -291,7 +291,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -815,11 +815,11 @@ void update_hero_motion_for_current_state(void) { vector_and_attack_descriptor_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - fast_add_rotations_cf_spherical_offset(&v10, - &v10, - frame_time * -0.75f, - hero.motion.rot.f[2], - hero.motion.rot.f[1]); + fast_add_rotations_cf(&v10, + &v10, + frame_time * -0.75f, + hero.motion.rot.f[2], + hero.motion.rot.f[1]); hero.pack_particle_timer = truncate_float_to_s32((frame_time * 7.0f - hero.ground_speed) / (frame_time * 7.0f) * scale_game_frames(5)); diff --git a/src/overlays/l08/mobys/rocket.c b/src/overlays/l08/mobys/rocket.c index e182a96f2c..f8e96fbcdf 100644 --- a/src/overlays/l08/mobys/rocket.c +++ b/src/overlays/l08/mobys/rocket.c @@ -159,7 +159,7 @@ extern int D_L08_0015F5C4_macro __asm__("D_L08_0015F5C4") MACRO_ADDR; #include "rnc/overlay/l08/mobys/rocket_data/rocket_update.h" extern unsigned int D_L08_0015FFDC MACRO_ADDR; -extern void fast_add_rotations_cf_spherical_offset(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); extern void spawn_effect(void *, void *, int, int, int, int, int, int) __asm__("FUN_L00_00269958"); extern void FUN_L08_002de528_u(void *, int, int, int) __asm__("FUN_L08_002de528"); void rocket_update(M46 *moby) __asm__("FUN_L08_002dd3c0"); @@ -225,7 +225,7 @@ void rocket_update(M46 *moby) { yaw = fast_arc_tan(moby->position[0] - target[0], moby->position[1] - target[1]); pitch = fast_arc_tan(vector_distance_xy(target, moby->position), moby->position[2] - target[2]); - fast_add_rotations_cf_spherical_offset(target, target, data->roll, data->yaw, data->pitch); + fast_add_rotations_cf(target, target, data->roll, data->yaw, data->pitch); fast_vec_sub(delta, target, moby->position); FUN_L00_0025f730(delta, target_data->speed * D_0015ED6C); fast_vec_sub(velocity_correction_or_effect_velocity, delta, data->velocity); diff --git a/src/overlays/l11/hero/update_hero_motion_by_state.c b/src/overlays/l11/hero/update_hero_motion_by_state.c index 50f3a6eb2e..702458cec8 100644 --- a/src/overlays/l11/hero/update_hero_motion_by_state.c +++ b/src/overlays/l11/hero/update_hero_motion_by_state.c @@ -276,7 +276,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -799,11 +799,11 @@ void update_hero_motion_by_state(void) { vector_and_hit_descriptor_head_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - fast_add_rotations_cf_spherical_offset(&v10, - &v10, - frame_time * -0.75f, - hero.motion.rot.f[2], - hero.motion.rot.f[1]); + fast_add_rotations_cf(&v10, + &v10, + frame_time * -0.75f, + hero.motion.rot.f[2], + hero.motion.rot.f[1]); hero.pack_particle_timer = truncate_float_to_s32((frame_time * 7.0f - hero.ground_speed) / (frame_time * 7.0f) * scale_game_frames(5)); diff --git a/src/overlays/l12/hero/update_hero_motion_for_current_state.c b/src/overlays/l12/hero/update_hero_motion_for_current_state.c index a0ed4fdedd..9c3c2633b5 100644 --- a/src/overlays/l12/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l12/hero/update_hero_motion_for_current_state.c @@ -559,7 +559,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); @@ -1092,11 +1092,11 @@ void update_hero_motion_for_current_state(void) { geometry_and_hit_descriptor_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - fast_add_rotations_cf_spherical_offset(&v10, - &v10, - frame_time * -0.75f, - hero.motion.rot.f[2], - hero.motion.rot.f[1]); + fast_add_rotations_cf(&v10, + &v10, + frame_time * -0.75f, + hero.motion.rot.f[2], + hero.motion.rot.f[1]); hero.pack_particle_timer = truncate_float_to_s32((frame_time * 7.0f - hero.ground_speed) / (frame_time * 7.0f) * scale_game_frames(5)); diff --git a/src/overlays/l12/mobys/hoven_anklebiter.c b/src/overlays/l12/mobys/hoven_anklebiter.c index a550ba97fd..1e34a73d4b 100644 --- a/src/overlays/l12/mobys/hoven_anklebiter.c +++ b/src/overlays/l12/mobys/hoven_anklebiter.c @@ -21,7 +21,7 @@ #include "rnc/overlay/shared/mobys/count_active_moby_group_members.h" #include "rnc/overlay/shared/mobys.h" #include "rnc/overlay/shared/mobys/test_path_segment_strict_crossing.h" -int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); + #include "rnc/overlay/shared/weapons/suckcannon.h" /* Suck cannon suction method: state 8 while sucked (alerting its group), back to 1 when released; no suction in states 9, 11 and 13. */ @@ -704,9 +704,9 @@ int move_hoven_anklebiter_toward_heading(struct Moby *moby, float speed) { fast_vec_normalize(path_test_offset, path_test_offset, 0.05f); fast_vec_add(path_test_position, pre_move_position, path_test_offset); if (path_8808(*(int *)(moby_vars + 0x2D0), - &moby->pos, - path_test_position, - path_corrected_position) != 0) { + &moby->pos, + path_test_position, + path_corrected_position) != 0) { char *path = ((char *)l12_paths[*(int *)(moby_vars + 0x2D0)]); if (point_in_path_xy(&moby->pos, path + 0x10, *(int *)path) == 0) *(OvlQuad *)&moby->pos = *(OvlQuad *)path_corrected_position; diff --git a/src/overlays/l12/mobys/hoven_turret.c b/src/overlays/l12/mobys/hoven_turret.c index af0f4c4014..169a8b9ccc 100644 --- a/src/overlays/l12/mobys/hoven_turret.c +++ b/src/overlays/l12/mobys/hoven_turret.c @@ -182,7 +182,7 @@ extern void spawn_explosion(void *, int, int, int) __asm__("FUN_L00_0025e450"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void queue_scene_movie_with_game_language(int) __asm__("FUN_L00_00299460"); extern void spawn_turret_rocket(void *, void *, void *, int) __asm__("FUN_L08_002e7eb0"); @@ -494,11 +494,11 @@ void hoven_turret_update(struct Moby *moby) { randomized_view_pitch = fast_add_rotations(l12_camera.pitch, randf_sym(0.0f, 0.5235988f)); qcopy(explosion_position, &l12_camera.pos); - fast_add_rotations_cf_spherical_offset(explosion_position, - explosion_position, - randomized_view_offset_distance, - randomized_view_yaw, - randomized_view_pitch); + fast_add_rotations_cf(explosion_position, + explosion_position, + randomized_view_offset_distance, + randomized_view_yaw, + randomized_view_pitch); t = random_float_between(0.5f, 1.3f); spawn_explosion(moby, D_L12_0015F580_macro, diff --git a/src/overlays/l13/mobys/blarg_space_commando.c b/src/overlays/l13/mobys/blarg_space_commando.c index 802bc77fbd..007997b0eb 100644 --- a/src/overlays/l13/mobys/blarg_space_commando.c +++ b/src/overlays/l13/mobys/blarg_space_commando.c @@ -382,8 +382,7 @@ void blarg_space_commando_update(struct Moby *moby) { resolve_point_path_segment_xy_clearance( blarg_space_commando_vars->path, &moby->pos, &moby->pos, 0.75f); path_blocked = 0; - if (path_8808( - blarg_space_commando_vars->path, &moby->pos, &target->pos, &direction) != 0 && + if (path_8808(blarg_space_commando_vars->path, &moby->pos, &target->pos, &direction) != 0 && fast_vec_dist(&moby->pos, &direction) < 0.8f) { path_blocked = 1; } @@ -422,8 +421,7 @@ void blarg_space_commando_update(struct Moby *moby) { FUN_L00_00258b50(moby, &blarg_space_commando_vars->ctl, &point, &origin, 1.0f); resolve_point_path_segment_xy_clearance( blarg_space_commando_vars->path, &moby->pos, &moby->pos, 0.75f); - if (path_8808( - blarg_space_commando_vars->path, &moby->pos, &target->pos, &direction) != 0 && + if (path_8808(blarg_space_commando_vars->path, &moby->pos, &target->pos, &direction) != 0 && fast_vec_dist(&moby->pos, &direction) < 0.8f) { blocked = 1; } 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 88ac50a603..2579a50ea3 100644 --- a/src/overlays/l14/hero/update_hero_motion_by_state.c +++ b/src/overlays/l14/hero/update_hero_motion_by_state.c @@ -431,7 +431,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); 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 f0103c9152..82fcf915c6 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 @@ -488,7 +488,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -981,11 +981,11 @@ void update_hero_motion_for_current_state(void) { spatial_or_hit_descriptor_work.f[1] += random_float_between(0.0f, 0.03f); spatial_or_hit_descriptor_work.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - fast_add_rotations_cf_spherical_offset(&v10, - &v10, - frame_time * -0.75f, - hero.motion.rot.f[2], - hero.motion.rot.f[1]); + fast_add_rotations_cf(&v10, + &v10, + frame_time * -0.75f, + hero.motion.rot.f[2], + hero.motion.rot.f[1]); hero.pack_particle_timer = truncate_float_to_s32((frame_time * 7.0f - hero.ground_speed) / (frame_time * 7.0f) * scale_game_frames(5)); diff --git a/src/overlays/l16/hero/update_hero_motion_for_current_state.c b/src/overlays/l16/hero/update_hero_motion_for_current_state.c index 4a5af02b0a..5f3cb483a1 100644 --- a/src/overlays/l16/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l16/hero/update_hero_motion_for_current_state.c @@ -181,7 +181,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -701,11 +701,11 @@ void update_hero_motion_for_current_state(void) { primary_vector_scratch.f[1] += random_float_between(0.0f, 0.03f); primary_vector_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - fast_add_rotations_cf_spherical_offset(&v10, - &v10, - frame_time * -0.75f, - hero.motion.rot.f[2], - hero.motion.rot.f[1]); + fast_add_rotations_cf(&v10, + &v10, + frame_time * -0.75f, + hero.motion.rot.f[2], + hero.motion.rot.f[1]); hero.pack_particle_timer = truncate_float_to_s32((frame_time * 7.0f - hero.ground_speed) / (frame_time * 7.0f) * scale_game_frames(5)); diff --git a/src/overlays/l17/hero/update_hero_motion_for_current_state.c b/src/overlays/l17/hero/update_hero_motion_for_current_state.c index 87368a8aec..227db75fd3 100644 --- a/src/overlays/l17/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l17/hero/update_hero_motion_for_current_state.c @@ -165,7 +165,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -694,11 +694,11 @@ void update_hero_motion_for_current_state(void) { scratch_vector.f[1] += random_float_between(0.0f, 0.03f); scratch_vector.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - fast_add_rotations_cf_spherical_offset(&v10, - &v10, - frame_time * -0.75f, - hero.motion.rot.f[2], - hero.motion.rot.f[1]); + fast_add_rotations_cf(&v10, + &v10, + frame_time * -0.75f, + hero.motion.rot.f[2], + hero.motion.rot.f[1]); hero.pack_particle_timer = truncate_float_to_s32((frame_time * 7.0f - hero.ground_speed) / (frame_time * 7.0f) * scale_game_frames(5)); diff --git a/src/overlays/l18/hero/update_hero_motion_for_current_state.c b/src/overlays/l18/hero/update_hero_motion_for_current_state.c index 090ee02fa2..9c7afda397 100644 --- a/src/overlays/l18/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l18/hero/update_hero_motion_for_current_state.c @@ -165,7 +165,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -657,11 +657,11 @@ void update_hero_motion_for_current_state(void) { general_vector_or_hit_descriptor_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - fast_add_rotations_cf_spherical_offset(&v10, - &v10, - frame_time * -0.75f, - hero.motion.rot.f[2], - hero.motion.rot.f[1]); + fast_add_rotations_cf(&v10, + &v10, + frame_time * -0.75f, + hero.motion.rot.f[2], + hero.motion.rot.f[1]); hero.pack_particle_timer = truncate_float_to_s32((frame_time * 7.0f - hero.ground_speed) / (frame_time * 7.0f) * scale_game_frames(5)); diff --git a/src/overlays/shared/enemies/blarg_space_commando.c b/src/overlays/shared/enemies/blarg_space_commando.c index 87f5902b9b..c668046c88 100644 --- a/src/overlays/shared/enemies/blarg_space_commando.c +++ b/src/overlays/shared/enemies/blarg_space_commando.c @@ -396,9 +396,9 @@ void blarg_space_commando_update(struct Moby *moby) { resolve_point_path_segment_xy_clearance( blarg_commando_state->path, &moby->pos, &moby->pos, 0.75f); if (path_8808(blarg_commando_state->path, - &moby->pos, - &target->pos, - &movement_output_or_hit_vector_or_path_point) != 0 && + &moby->pos, + &target->pos, + &movement_output_or_hit_vector_or_path_point) != 0 && fast_vec_dist(&moby->pos, &movement_output_or_hit_vector_or_path_point) < 0.8f) { near = 1; } diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index 8953b8186a..01d4d8bc19 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -414,8 +414,7 @@ void large_amoeboid_update(unsigned char *moby) { move[2] = 0.0f; FUN_L00_00258b50( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); - if (path_8808(large_amoeboid_vars->unk240, &MOBY(moby)->pos, target + 0x10, hit) != - 0 && + if (path_8808(large_amoeboid_vars->unk240, &MOBY(moby)->pos, target + 0x10, hit) != 0 && fast_vec_dist(&MOBY(moby)->pos, hit) < 1.5f) blocked = 1; if (large_amoeboid_vars->unk22C == 0) { diff --git a/src/overlays/shared/game/queue_planet_unlock_message.c b/src/overlays/shared/game/queue_planet_unlock_message.c index 2d812bb060..8e15594c2c 100644 --- a/src/overlays/shared/game/queue_planet_unlock_message.c +++ b/src/overlays/shared/game/queue_planet_unlock_message.c @@ -5,9 +5,9 @@ #include "rnc/overlay/shared/mobys/select_auto_aim_target_moby.h" void build_spherical_offset(void *) __asm__("FUN_00214db0"); -void fast_add_rotations_cf_spherical_offset(void *a, void *b) __asm__("FUN_L00_00262cf0"); +void fast_add_rotations_cf(void *a, void *b) __asm__("FUN_L00_00262cf0"); -void fast_add_rotations_cf_spherical_offset(void *destination, void *base_vector) { +void fast_add_rotations_cf(void *destination, void *base_vector) { char spherical_offset[16]; build_spherical_offset(spherical_offset); fast_vec_add(destination, spherical_offset, base_vector); diff --git a/src/overlays/shared/hero/hero_update_movement.c b/src/overlays/shared/hero/hero_update_movement.c index cf7a0107ff..0f69529e6b 100644 --- a/src/overlays/shared/hero/hero_update_movement.c +++ b/src/overlays/shared/hero/hero_update_movement.c @@ -126,7 +126,7 @@ extern f32 spring_angle(f32 *, f32, f32 *, s32, f32, f32, f32) __asm__("FUN_L00 extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern u8 *FUN_L00_0026f080(void *, void *, f32, f32); extern s32 random_int_between(s32, s32) __asm__("FUN_L00_00257b90"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, f32, f32, f32) __asm__("FUN_L00_00262cf0"); extern f32 vector_length_xyz_cf(void *, s32) __asm__("FUN_L00_00209018"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void set_first_hero_easing_parameters(f32, f32) __asm__("FUN_L00_0020a1e0"); @@ -676,11 +676,11 @@ void hero_update_movement(void) { movement_and_hit_descriptor_scratch.f[2] += random_float_between(0.0f, 0.03f); qcopy(&v10, &hero.motion.displacement); - fast_add_rotations_cf_spherical_offset(&v10, - &v10, - frame_time * -0.75f, - hero.motion.rot.f[2], - hero.motion.rot.f[1]); + fast_add_rotations_cf(&v10, + &v10, + frame_time * -0.75f, + hero.motion.rot.f[2], + hero.motion.rot.f[1]); hero.pack_particle_timer = truncate_float_to_s32((frame_time * 7.0f - hero.ground_speed) / (frame_time * 7.0f) * scale_game_frames(5)); 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 17c6c37607..30ae8ae9ce 100644 --- a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c +++ b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c @@ -111,10 +111,10 @@ typedef struct { int path_8808(int idx, void *a, void *b, void *c) __asm__("FUN_L00_00261b48"); int path_8808(int segment_path_index, - void *segment_start, - void *segment_end, + void *segment_start, + void *segment_end, - void *adjusted_endpoint) { + void *adjusted_endpoint) { float v[4], perpendicular_xy_axis[4], z[4], previous_path_point_in_basis[4], u[4]; float best; float zero; diff --git a/src/overlays/shared/pickups/crate.c b/src/overlays/shared/pickups/crate.c index 108df05bfc..2d7beb167f 100644 --- a/src/overlays/shared/pickups/crate.c +++ b/src/overlays/shared/pickups/crate.c @@ -990,9 +990,9 @@ void crate_drop_bolts(u8 *crate_moby) { fast_vec_scale(&trajectory_vector, spawned_vars + 0x10, trajectory_time); fast_vec_add(&trajectory_vector, &trajectory_vector, &MOBY(crate_moby)->pos); path_8808(*(s32 *)(crate_vars + 0xC0), - &MOBY(crate_moby)->pos, - &trajectory_vector, - &adjusted_position); + &MOBY(crate_moby)->pos, + &trajectory_vector, + &adjusted_position); fast_vec_sub(&trajectory_vector, &adjusted_position, &MOBY(spawned_moby)->pos); trajectory_vector.f[2] = 0.0f; fast_vec_normalize(&scratch_vector, &trajectory_vector, 0.25f); diff --git a/src/overlays/shared/rendering/effects/parent_following_effect.c b/src/overlays/shared/rendering/effects/parent_following_effect.c index 7c3995dc9f..dd3acdbc30 100644 --- a/src/overlays/shared/rendering/effects/parent_following_effect.c +++ b/src/overlays/shared/rendering/effects/parent_following_effect.c @@ -7,7 +7,7 @@ #include "qcopy.h" extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); -extern void fast_add_rotations_cf_spherical_offset(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); +extern void fast_add_rotations_cf(void *, void *, float, float, float) __asm__("FUN_L00_00262cf0"); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); /* update: follow the parent, blend its color, scale by the wind factor */ @@ -32,11 +32,11 @@ void parent_following_effect_update(char *moby) { qcopy(&MOBY(moby)->pos, *(char **)(*(char **)moby_pvars + 0x78) + 0xF0); accumulated_offset = *(float *)(moby_pvars + 0x10) + *(float *)(moby_pvars + 0x14); *(float *)(moby_pvars + 0x10) = accumulated_offset; - fast_add_rotations_cf_spherical_offset(&MOBY(moby)->pos, - &MOBY(moby)->pos, - -accumulated_offset, - MOBY(moby)->rot.z, - MOBY(moby)->rot.y); + fast_add_rotations_cf(&MOBY(moby)->pos, + &MOBY(moby)->pos, + -accumulated_offset, + MOBY(moby)->rot.z, + MOBY(moby)->rot.y); MOBY(moby)->rot.x = fast_add_rotations(MOBY(moby)->rot.x, frame_time * 5.235987663269043f); ratio = convert_integer_to_float(*(short *)(moby_pvars + 0xE)); ratio = ratio / convert_integer_to_float(*(short *)(moby_pvars + 0xC)); 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 15c97c977d..fb539d8701 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) { mode_freeze_state = 0x11; mode_freeze_flags |= 0x40; From 62da126638b483f3aeac423565782f2645383855 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:17:15 +0000 Subject: [PATCH 010/758] decomp: preserve distinct spherical offset call signatures --- include/rnc/overlay/shared/game/queue_planet_unlock_message.h | 2 +- src/overlays/shared/game/queue_planet_unlock_message.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/rnc/overlay/shared/game/queue_planet_unlock_message.h b/include/rnc/overlay/shared/game/queue_planet_unlock_message.h index f48927f636..7b432b8ad5 100644 --- a/include/rnc/overlay/shared/game/queue_planet_unlock_message.h +++ b/include/rnc/overlay/shared/game/queue_planet_unlock_message.h @@ -5,6 +5,6 @@ void queue_planet_unlock_message(s32) __asm__("FUN_L00_00262d38"); -void fast_add_rotations_cf(void *, void *) __asm__("FUN_L00_00262cf0"); +void fast_add_rotations_cf_spherical_offset(void *, void *) __asm__("FUN_L00_00262cf0"); #endif /* LOMBYTE_RNC_OVERLAY_SHARED_GAME_QUEUE_PLANET_UNLOCK_MESSAGE_H */ diff --git a/src/overlays/shared/game/queue_planet_unlock_message.c b/src/overlays/shared/game/queue_planet_unlock_message.c index 8e15594c2c..2d812bb060 100644 --- a/src/overlays/shared/game/queue_planet_unlock_message.c +++ b/src/overlays/shared/game/queue_planet_unlock_message.c @@ -5,9 +5,9 @@ #include "rnc/overlay/shared/mobys/select_auto_aim_target_moby.h" void build_spherical_offset(void *) __asm__("FUN_00214db0"); -void fast_add_rotations_cf(void *a, void *b) __asm__("FUN_L00_00262cf0"); +void fast_add_rotations_cf_spherical_offset(void *a, void *b) __asm__("FUN_L00_00262cf0"); -void fast_add_rotations_cf(void *destination, void *base_vector) { +void fast_add_rotations_cf_spherical_offset(void *destination, void *base_vector) { char spherical_offset[16]; build_spherical_offset(spherical_offset); fast_vec_add(destination, spherical_offset, base_vector); From 96ed2cf414ccbd6cb92cb887bbbc54a891e519bd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:28:41 +0000 Subject: [PATCH 011/758] decomp: clarify names in _waitIpuIdle64 domain_0_value_0 -> IPU_CMD_IDLE_THRESHOLD: The source status is the signed 64-bit load from IPU_CMD at 0x10002000. Retail 0x0012851c loads it and 0x00128520 bgez returns the register value immediately when >= 0; the source status < 0 therefore tests whether it is below the idle threshold. This is a signed command-register boundary, not FALSE or NULL. domain_1_value_0 -> IPU_CMD_IDLE_THRESHOLD: The loop reloads the same 64-bit IPU_CMD register at retail 0x00128570 and bgez at 0x00128574 exits to the return at 0x00128590 when nonnegative. Thus the source loop status < 0 uses exactly the same signed idle threshold as the initial test. IPU_CTRL bit 0x4000 is a separate termination condition. --- src/sdk/ipu/wait_ipu_idle64.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sdk/ipu/wait_ipu_idle64.c b/src/sdk/ipu/wait_ipu_idle64.c index b7c25d2ddd..9d05a27424 100644 --- a/src/sdk/ipu/wait_ipu_idle64.c +++ b/src/sdk/ipu/wait_ipu_idle64.c @@ -2,11 +2,14 @@ #include "rnc/sdk/mpeg/api.h" s64 _waitIpuIdle64(s32 *ctx) { + enum { + IPU_CMD_IDLE_THRESHOLD = 0 + }; long new_var; s64 status; int count = 0; status = *((volatile s64 *)0x10002000); - if (status < 0) { + if (status < IPU_CMD_IDLE_THRESHOLD) { if (((*((volatile u32 *)0x10002010)) & 0x4000) == 0) { do { new_var = 0x1389; @@ -18,7 +21,7 @@ s64 _waitIpuIdle64(s32 *ctx) { count++; } status = *((volatile s64 *)0x10002000); - } while ((status < 0) && (((*((volatile u32 *)0x10002010)) & 0x4000) == 0)); + } while ((status < IPU_CMD_IDLE_THRESHOLD) && (((*((volatile u32 *)0x10002010)) & 0x4000) == 0)); } } return status; From 777c7b6b626b6a26538eb26a402fc074204dc05e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:33:07 +0000 Subject: [PATCH 012/758] decomp: clarify names in exit_hero_vehicle_mode_and_restore_moby domain_0_value_0 -> HERO_VEHICLE_MODE_ON_FOOT: Retail 0x00231464-0x00231468 forms the hero base 0x0013F350 and 0x00231474 stores zero to hero+0x20A4, the source hero_state_base->vehicle_mode field. The entry function assigns its vehicle_mode parameter to that same field before installing the vehicle moby; this exit restores the saved hero moby at 0x002314A4-0x002314C4. Embedded hero_frame_update and update_hero_frame already compare this exact field with HERO_VEHICLE_MODE_ON_FOOT, and the shared HeroVehicleMode enum defines that canonical member as 0. This proves the selector's vehicle-mode domain independently of hero state IDs. --- src/overlays/shared/hero/hero_frame_update.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/hero/hero_frame_update.c b/src/overlays/shared/hero/hero_frame_update.c index 3202a8bcb2..5d0f58a080 100644 --- a/src/overlays/shared/hero/hero_frame_update.c +++ b/src/overlays/shared/hero/hero_frame_update.c @@ -791,7 +791,7 @@ void exit_hero_vehicle_mode_and_restore_moby(void) { reset_hero_easing_records(); hero_state_base = (struct Hero *)((char *)D_0013E533 + 0xE1D); previous_active_moby = ((char *)hero_state_base->unkA84); - hero_state_base->vehicle_mode = 0; + hero_state_base->vehicle_mode = HERO_VEHICLE_MODE_ON_FOOT; if (previous_active_moby != 0) { MOBY(previous_active_moby)->flags &= 0xFFF9; } From 0cecb3052c0d3bc323a0aae2f1d655235baa3d45 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:39:14 +0000 Subject: [PATCH 013/758] decomp: clarify names in _dispRefImage domain_0_value_1 -> MPEG_REF_IMAGE_STATUS_DISPLAYABLE: Authoritative _dispRefImage source (SHA-256 1101bb89ed901f4108e9e9723a61b2f8fad36e4cc5436e25861fc9c08e72b422) identifies the selector as ref_image->status. Retail preserves the image argument in s1 at 0x00129cfc; after _isOutSizeOK passes, 0x00129da0 loads 1, 0x00129da4 reads image +0x28, and 0x00129da8 skips all output for unequal status. Equality permits either _csc_storeRefImage at 0x00129dbc or _cpr8 at 0x00129dcc, then the common display completion helper at 0x00129de4. Original Ghidra reproduces this exact gate. Supplied _outputFrame and _lastFrame source selects decoder reference images and passes them to _dispRefImage for frame output. Thus status 1 is the displayable reference-image status; no stronger lifecycle claim is made. --- src/sdk/mpeg/ref_images/_dispRefImage.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sdk/mpeg/ref_images/_dispRefImage.c b/src/sdk/mpeg/ref_images/_dispRefImage.c index cfe65c0120..73f6845d66 100644 --- a/src/sdk/mpeg/ref_images/_dispRefImage.c +++ b/src/sdk/mpeg/ref_images/_dispRefImage.c @@ -15,6 +15,9 @@ struct MpegDisplayState { extern u32 display_values_by_picture_flags[] __asm__("D_00132E98"); void _dispRefImage(struct MpegDecoder *decoder, struct MpegRefImage *ref_image) { + enum { + MPEG_REF_IMAGE_STATUS_DISPLAYABLE = 1 + }; u64 display_value; struct MpegDisplayState *ref_info; s32 *mpeg_words; @@ -38,7 +41,7 @@ void _dispRefImage(struct MpegDecoder *decoder, struct MpegRefImage *ref_image) decoder->unkC4 = (s32)ref_image->unk54; decoder->unkC8 = (s32)ref_image->unk58; if (_isOutSizeOK(decoder, ref_image) != 0) { - if (ref_image->status == 1) { + if (ref_image->status == MPEG_REF_IMAGE_STATUS_DISPLAYABLE) { if (decoder->unkB0 != 0) { _csc_storeRefImage(decoder, ref_image); } else { From a58bc5d8bf7341b3659ec410909641c5061daca3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:41:04 +0000 Subject: [PATCH 014/758] decomp: clarify names in collect_mission_ids domain_0_value_2 -> MISSION_STATUS_ALL_CONDITIONS_MET: The authoritative SHA-256-bound C compares mission_node_cursor->status (short +0x24) before choosing 0x523E. Retail 0x0020bc94-0x0020bc9c confirms this comparison. Checked common caller 0x0021c4c0 calls updater 0x0020b950 and collector 0x0020bc00. Updater selects and writes the same node source D_001A2C20 at 0x0020b998-0x0020b9a0, advances records by 0x28, and at 0x0020b9f4 tests the first configured condition (+2,+4). False writes status 0 at 0x0020ba08. Success evaluates the second (+8,+0xC) at 0x0020ba0c: true writes 2 at 0x0020ba18, false writes 1 at 0x0020ba1c. Evaluator 0x0020baf0 returns Boolean predicate results from flags, counters or callbacks, proving status 2 means all configured conditions met, without asserting mission lifecycle completion. domain_1_value_2 -> MISSION_STATUS_ALL_CONDITIONS_MET: Authoritative C and original Ghidra psVar6[0x12] compare the same MissionNode.status short +0x24 when setting mask bit 1<id; if (use_selected_ids != 0) { - mission_ids[count] = (mission_node_cursor->status == 2) + mission_ids[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 == 2) { + if (mask != 0 && mission_node_cursor->status == MISSION_STATUS_ALL_CONDITIONS_MET) { *mask |= 1 << count; } if (nums != 0) { From 5336bccc12ff9cce98a454451c0072a51454f4e0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:42:44 +0000 Subject: [PATCH 015/758] decomp: clarify names in blarg_commander_update domain_0_value_1 -> BLARG_COMMANDER_STATE_TUMBLING: The selector is the incoming moby's byte at +0x53: lbu s3,0x53(s1) at 0x0030893c and bne against 1 at 0x00308940. In this gated branch, 0x00308948-0x0030895c passes pvars+0x20 to step_moby_motion; checked helper 0x002755c4-0x002755d8 subtracts its +0x10 acceleration from +0x08 vertical motion, and 0x00275adc updates the moby position using that motion vector. The assigned source and retail 0x0030896c-0x00308998 independently advance both rotation components at moby+0x40/+0x44 by frame_time*4.3633232 through fast_add_rotations, proving tumbling during this state. At 0x00308994-0x00308a28 mask 0x61 triggers an explosion at raised position and removal; 0x00308a34-0x00308a58 also removes below Z=5. The name describes this observed state behavior without asserting a knockback/death entry cause or equating the helper's +0x3e substate to the moby state. --- src/overlays/shared/enemies/blarg_commander.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/blarg_commander.c b/src/overlays/shared/enemies/blarg_commander.c index e81497e17d..3fb4796c2d 100644 --- a/src/overlays/shared/enemies/blarg_commander.c +++ b/src/overlays/shared/enemies/blarg_commander.c @@ -139,6 +139,9 @@ void blarg_commander_update(char *m) __asm__("FUN_L12_00308918"); /* Moby class 1371 */ void blarg_commander_update(char *moby) { + enum { + BLARG_COMMANDER_STATE_TUMBLING = 1 + }; int moby_state; char *moby_pvars; char *motion_state; @@ -147,7 +150,7 @@ void blarg_commander_update(char *moby) { char raised_position[16]; moby_state = MOBY(moby)->prev_seq; moby_pvars = ((char *)MOBY(moby)->pvars); - if (moby_state == 1) { + if (moby_state == BLARG_COMMANDER_STATE_TUMBLING) { motion_state = moby_pvars + 0x20; motion_result_flags = step_moby_motion(moby, motion_state); mo->vx = fast_add_rotations(mo->vx, frame_time * 4.3633232f); From b814871e394f2b036d6238d6654e588269fd4f04 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:48:13 +0000 Subject: [PATCH 016/758] decomp: clarify names in poll_pad_device_state domain_0_value_1 -> PAD_INPUT_POLLING: The authoritative assignment writes pad_state->profile_state, the exact selector already using PAD_INPUT_POLLING=1. Retail 0x00217168 tests scePad2GetButtonProfile's returned count against 5; the smaller-count branch loads 1 at 0x002171a0 and stores it to PAD+0x198 at 0x002171a8. Retail 0x00217108-0x0021710c reads that same field and dispatches value 1 to scePad2Read at 0x00217268 and process_pad_input at 0x00217278. Original Ghidra shows the same store and dispatch, proving reuse of the existing local profile-phase member rather than PAD_DEVICE_READY. domain_1_value_2 -> PAD_BUTTON_PROFILE_TOO_LARGE: The assignment targets pad_state->profile_state, whose existing switch names value 2 PAD_BUTTON_PROFILE_TOO_LARGE. Retail scePad2GetButtonProfile at 0x0021713c returns the count tested at 0x00217168; counts >=5 keep v0=2 from 0x00217170 and reach the PAD+0x198 store at 0x002171a8. The same field is loaded at 0x00217108, and value 2 branches at 0x0021712c to clear_pad_input at 0x00217288. Source and original Ghidra agree on this oversized-button-profile phase, establishing the same enum domain. domain_2_value_0 -> PAD_PROFILE_INITIALIZATION: The not-ready branch assigns zero to the same pad_state->profile_state selector already using PAD_PROFILE_INITIALIZATION=0. Retail 0x00217100 branches on scePad2GetState !=1 to clear_pad_input at 0x00217298 and clears PAD+0x198 at 0x002172a0. On a subsequent ready poll, 0x00217108 loads that field and 0x0021711c dispatches zero to the button-profile query at 0x0021713c and vibration-profile query at 0x002171e0. Original Ghidra preserves this reset/query flow, proving reuse of the local initialization phase. --- src/input/poll_pad_device_state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/input/poll_pad_device_state.c b/src/input/poll_pad_device_state.c index 8a1fa50661..6fb1fd959d 100644 --- a/src/input/poll_pad_device_state.c +++ b/src/input/poll_pad_device_state.c @@ -41,9 +41,9 @@ void poll_pad_device_state(struct PadState *pad_state) { for (i = 0; i < byte_count; i++) { pad_state->button_profile[i] = pad_response_buffer[i]; } - pad_state->profile_state = 1; + pad_state->profile_state = PAD_INPUT_POLLING; } else { - pad_state->profile_state = 2; + pad_state->profile_state = PAD_BUTTON_PROFILE_TOO_LARGE; byte_count = 0; } for (i = byte_count; i < 4; i++) { @@ -73,7 +73,7 @@ void poll_pad_device_state(struct PadState *pad_state) { } } else { clear_pad_input(pad_state); - pad_state->profile_state = 0; + pad_state->profile_state = PAD_PROFILE_INITIALIZATION; } pad_state->unk188 = 0; pad_state->unk189 = 0; From a4110f7ba91ec6046a403a5003dd09d6593ad5b0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:50:36 +0000 Subject: [PATCH 017/758] decomp: clarify names in update_joint_animation domain_0_value_127 -> JOINT_ANIMATION_PREVIOUS_OWNER_DETACH_STATE_LIMIT: Exact source binds the selector to MOBY(previous_moby)->state. Retail 0x0026290c loads the previous owner from joint_animation_state+0x78; 0x00262918 skips the owner-change path when it equals the current moby. After testing the attached flag at +1, 0x0026292c loads the previous owner's unsigned state byte at +0x20 and 0x00262930 compares it strictly below 0x7F. Only the below-limit branch calls detach_manipulator at 0x0026293c; both outcomes clear the attachment flag and replace the owner. Bounded helper evidence at 0x0024f608 shows unlinking through the owner's +0x64 list and manipulator +8 links (0x0024f61c..0x0024f67c), confirming that this constant is the previous-owner detachment state limit. This name makes no claim about the unknown lifecycle meaning of state 127. --- .../shared/mobys/test_path_segment_strict_crossing.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 30ae8ae9ce..08fdd72ae3 100644 --- a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c +++ b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c @@ -580,12 +580,15 @@ void update_joint_animation(void *m, unsigned char *p, int c, float fa, float fb void update_joint_animation( void *moby, unsigned char *joint_animation_state, int joint_index, float fa, float fb) { + enum { + JOINT_ANIMATION_PREVIOUS_OWNER_DETACH_STATE_LIMIT = 0x7F + }; unsigned char *previous_moby = *(unsigned char **)(joint_animation_state + 0x78); float uniform_scale; if (!previous_moby) { *(void **)(joint_animation_state + 0x78) = moby; } else if (previous_moby != moby) { - if (joint_animation_state[1] && MOBY(previous_moby)->state < 0x7F) + if (joint_animation_state[1] && MOBY(previous_moby)->state < JOINT_ANIMATION_PREVIOUS_OWNER_DETACH_STATE_LIMIT) detach_manipulator(previous_moby, joint_animation_state); joint_animation_state[1] = 0; *(void **)(joint_animation_state + 0x78) = moby; From f268f8f5c58c1b7b4dcadbf6a6b9c74aa5117b0d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:53:25 +0000 Subject: [PATCH 018/758] decomp: clarify names in draw_sky_shells domain_0_value_0 -> SKY_SHELL_RELOCATION_RESET: Retail 0x0022b2a8-0x0022b2ac loads the descriptor pointer from 0x0016045c; 0x0022b2b8 performs sh zero,0x4(v0). Source identifies this halfword as level_sky_effect_data->relocation_state; original Ghidra likewise assigns wRelocationState=0. This unconditional clearing follows setup_sky_gif_paging and precedes matrix setup, shell-count testing and every sky_draw_shell call (0x0022b454). Thus RESET names the observed relocation-state reset before the shell pass without claiming any nonzero-state lifecycle or borrowing shell-index constants. --- src/rendering/sky/draw_sky_shells.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rendering/sky/draw_sky_shells.c b/src/rendering/sky/draw_sky_shells.c index d82b8453e0..f80bd0c29a 100644 --- a/src/rendering/sky/draw_sky_shells.c +++ b/src/rendering/sky/draw_sky_shells.c @@ -43,6 +43,9 @@ void draw_sky_shells(void) { SKY_SHELL_ONE_AND_THREE_QUARTERS_SCALE = 4, SKY_SHELL_DOUBLE_SCALE = 5 }; + enum { + SKY_SHELL_RELOCATION_RESET = 0 + }; f32 rotation_angles[4]; f32 shell_scale; u8 *transform_row; @@ -50,7 +53,7 @@ void draw_sky_shells(void) { shell_index = 0; setup_sky_gif_paging(); - level_sky_effect_data->relocation_state = 0; + level_sky_effect_data->relocation_state = SKY_SHELL_RELOCATION_RESET; set_identity_matrix(&sky_matrix); clear_u64_value(rotation_angles); if (level_sky_effect_data->shell_count > 0) { From 673280568fbbd156a542bee118473b1c460fce3b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 19:58:52 +0000 Subject: [PATCH 019/758] decomp: clarify names in update_all_mobys_profiled domain_0_value_0 -> MOBY_STATE_UPDATE_MIN: Retail 0x002649b0 loads signed byte Moby.state at offset 0x20; 0x002649b8 bltzl skips negative states and advances to Moby.next at 0x002649bc/0x00264a3c. Nonnegative states enter counter reset 0x002649c0, optional preparation, update callback at 0x002649ec, optional update_entity at 0x00264a04, and class profiling accumulation through 0x00264a34. The authoritative C expresses this exact gate as (s8)moby->state >= 0. Thus zero is the inclusive minimum state accepted for updates, without asserting a specific class state meaning. --- src/overlays/shared/mobys/update_all_mobys_profiled.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/mobys/update_all_mobys_profiled.c b/src/overlays/shared/mobys/update_all_mobys_profiled.c index 15f105830d..5135fcee6e 100644 --- a/src/overlays/shared/mobys/update_all_mobys_profiled.c +++ b/src/overlays/shared/mobys/update_all_mobys_profiled.c @@ -32,6 +32,9 @@ extern s32 fptodp(f32) __asm__("FUN_00120478"); void update_all_mobys_profiled(void) __asm__("FUN_L00_002648e0"); void update_all_mobys_profiled(void) { + enum { + MOBY_STATE_UPDATE_MIN = 0 + }; struct Moby *moby; MobyProfile *profile; s32 i; @@ -58,7 +61,7 @@ void update_all_mobys_profiled(void) { moby = suck_moby_list = FUN_L00_00250768(); while (moby != 0) { s32 current_ticks; - if ((s8)moby->state >= 0) { + if ((s8)moby->state >= MOBY_STATE_UPDATE_MIN) { *(volatile u32 *)0x10000000 = 0; if (!(moby->flags & 0x40)) { FUN_L00_00250480(moby); From dabff497af0a82a03ca835d11c5c68ae60dd7a72 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:10:39 +0000 Subject: [PATCH 020/758] decomp: clarify names in apply_hero_ground_type_effects domain_0_value_3 -> GROUND_TYPE_SINKING: The selector is the signed Hero+0x12E0 ground_type saved into s2 at 0x00213b74 before reset. Comparing s2 with 3 at 0x00213c94 sets Hero+0x12E6 (selector_3) at 0x00213ca4. That flag gates 0x00213dd0-0x00213e90: compare sink_surface_z (Hero+0x2F4) with motion.pos.z+0.25, require the surface above the hero and negative vertical displacement, exit vehicle mode, then request 0x68 for positive health or 0x7B for zero health. The original Ghidra cRam00140636 branch confirms this data flow. GROUND_TYPE_SINKING describes this proven sinking-surface behavior without asserting a particular material or borrowing a HeroStateId. --- src/overlays/l18/hero/apply_hero_ground_type_effects.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 0d6dc5733e..dd3a36b74a 100644 --- a/src/overlays/l18/hero/apply_hero_ground_type_effects.c +++ b/src/overlays/l18/hero/apply_hero_ground_type_effects.c @@ -26,6 +26,9 @@ void apply_hero_ground_type_effects(void) { GROUND_TYPE_MAGNETIC = 2, GROUND_TYPE_SHALLOW_WATER = 0xE }; + enum { + GROUND_TYPE_SINKING = 3 + }; struct Hero *hero_state = &hero; int keep = hero_state->ground_sound_class; int saved_ground_type = hero_state->ground_type; @@ -67,7 +70,7 @@ void apply_hero_ground_type_effects(void) { } else { collision_check_selector = current_level_index; } - if (saved_ground_type == 3) { + if (saved_ground_type == GROUND_TYPE_SINKING) { struct Hero *q = &hero; *(char *)&q->selector_3 = 1; collision_check_selector = D_0015ED84_d; From 344a97789fa2a0f425fd6aedd732c75169f3a5c2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:30:51 +0000 Subject: [PATCH 021/758] decomp: clarify names in hoverboard_girl_update domain_2_value_4 -> HOVERBOARD_GIRL_DIALOGUE_ALTERNATE_ITEM_REWARD: Retail 0x00316cb4-0x00316ce0 tests alternate_item_available at 0x0013d388 after dialogue_event 1; only when absent it saves dialogue_state +0x36 into previous_dialogue_state +4, assigns node 4 at 0x00316cd4, records frame and sets race_return_pending +8. At 0x00316e4c-0x00316e80 previous node 4 uniquely sets that same availability byte to 1, queues message 0x1395 and saves the game. Helper 0x00290570-0x0029057c indexes 0x1c-byte dialogue nodes with +0x36; initializer 0x00290870-0x00290874 loads the node table from race_entries into +0x3c. This is an alternate-item reward dialogue node, not hero/moby state 4. domain_3_value_4 -> HOVERBOARD_GIRL_DIALOGUE_ALTERNATE_ITEM_REWARD: Retail 0x00316e50 loads previous_dialogue_state at +4 and 0x00316e54 compares against 4 after cutscene mode ends. The matched branch 0x00316e68 sets alternate_item_available (0x0013d388) to 1, queues message 0x1395 and invokes memcard_save_data. The same node value is assigned to dialogue_state +0x36 at 0x00316cd4 only while that item is unavailable, with +4 explicitly preserving previous dialogue state at 0x00316cd8 and 0x00316c28. Both fields represent the same dialogue-node domain, so reuse the reward node member for assignment and completion comparison. --- src/overlays/l05/mobys/hoverboard_girl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l05/mobys/hoverboard_girl.c b/src/overlays/l05/mobys/hoverboard_girl.c index 48f69c9fab..528fbe0473 100644 --- a/src/overlays/l05/mobys/hoverboard_girl.c +++ b/src/overlays/l05/mobys/hoverboard_girl.c @@ -203,6 +203,9 @@ void hoverboard_girl_update(HoverboardGirlMoby *moby) { HOVERBOARD_GIRL_STATE_UPDATE_DIALOGUE = 1, HOVERBOARD_GIRL_STATE_WAIT_TO_RESUME_DIALOGUE = 3 }; + enum { + HOVERBOARD_GIRL_DIALOGUE_ALTERNATE_ITEM_REWARD = 4 + }; HoverboardGirlState *state = moby->data; HoverboardGirlVector target_position; HoverboardGirlVector head_position; @@ -253,7 +256,7 @@ void hoverboard_girl_update(HoverboardGirlMoby *moby) { request_music_track(0, 8); if (alternate_item_available == 0) { state->previous_dialogue_state = state->dialogue_state; - state->dialogue_state = 4; + state->dialogue_state = HOVERBOARD_GIRL_DIALOGUE_ALTERNATE_ITEM_REWARD; state->dialogue_state_frame = frame_number; state->race_return_pending = 1; } @@ -287,7 +290,7 @@ void hoverboard_girl_update(HoverboardGirlMoby *moby) { case HOVERBOARD_GIRL_STATE_WAIT_TO_RESUME_DIALOGUE: if (game_mode != GAME_MODE_CUTSCENE) { moby->state = HOVERBOARD_GIRL_STATE_UPDATE_DIALOGUE; - if (state->previous_dialogue_state == 4) { + if (state->previous_dialogue_state == HOVERBOARD_GIRL_DIALOGUE_ALTERNATE_ITEM_REWARD) { alternate_item_available = 1; queue_dialogue_message(0x1395, scale_game_frames(300)); memcard_save_data(0, -1); From aebea30db78154e7afa45f5bde570f744c8d3da1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:40:20 +0000 Subject: [PATCH 022/758] decomp: clarify names in init_pads D_001CD760 -> controller_socket_params: In the authoritative src/input/init_pads.c snapshot (SHA-256 a7756d4d6538272ed9b2f82d0a504d475b46a90a17cce019748ca6116b3d6f58), D_001CD760 is a zero-initialized scePad2SocketParam. Retail 0x0021706c forms its address 0x001cd760 in s1; 0x0021707c writes 2 to its port word and 0x00217090 writes 0 to its slot word. At 0x00217084 its address becomes a0 for scePad2CreateSocket at 0x0021708c, with controller_state (0x0013c940) as a1; the returned socket is stored at controller_state+0x194 at 0x002170a0. The original Ghidra decompilation confirms this argument flow. Retail 0x00217094 and 0x0021709c subsequently set the same object's port/slot words to 2/1. These operations prove controller socket parameters, without interpreting the numeric port encoding. --- src/input/init_pads.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/input/init_pads.c b/src/input/init_pads.c index f9ceec8fea..e3e0e85eda 100644 --- a/src/input/init_pads.c +++ b/src/input/init_pads.c @@ -9,7 +9,7 @@ typedef struct { u8 reserve[4]; } scePad2SocketParam; -scePad2SocketParam D_001CD760 = {0}; +scePad2SocketParam controller_socket_params __asm__("D_001CD760") = {0}; extern s32 scePad2Init(s32); extern s32 scePad2CreateSocket(scePad2SocketParam *, void *); @@ -22,11 +22,11 @@ void init_pads(void) { }; sceDbcInit(); scePad2Init(0); - D_001CD760.port = 2; - D_001CD760.slot = 0; - controller_state.socket = scePad2CreateSocket(&D_001CD760, &controller_state); - D_001CD760.port = 2; - D_001CD760.slot = 1; + controller_socket_params.port = 2; + controller_socket_params.slot = 0; + controller_state.socket = scePad2CreateSocket(&controller_socket_params, &controller_state); + controller_socket_params.port = 2; + controller_socket_params.slot = 1; controller_state.profile_state = CONTROLLER_PROFILE_INITIAL_STATE; controller_state.device_state = CONTROLLER_DEVICE_INITIAL_STATE; } From 426654aa8655315d49f6b0215f844dfcfe746cf4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:42:28 +0000 Subject: [PATCH 023/758] decomp: clarify names in allocate_colored_effect_slot D_L00_00180640 -> l00_point_light_slot_buffers: Bound source src/overlays/shared/rendering/effects/glow_quads_draw.c SHA-256 e179100d10f27244f4d0173054f180b4bfe041393b620443faea1603bf011293 declares u8 D_L00_00180640[8][1024] = {0}. allocate_colored_effect_slot selects an unused index i from eight state records, initializes point_lights[i], and assigns (char *)D_L00_00180640[i] to slot_state->buf. Retail 0x0023e7fc shifts selected s1 by 10; 0x0023e7f8/0x0023e800 form 0x00180640; 0x0023e808 adds the slot offset; 0x0023e810 stores that address at state +0x0c after marking +0x10 used at 0x0023e80c. Original Ghidra independently shows iVar6*0x400+0x180640 stored to 0x001804cc+iVar6*0x30. The adjacent packed-color point-light allocator uses the same buffer array and index. Prepared explosion_light_update callers retain the returned light slot and update point_lights[slot], proving the light-slot association. l00 qualifies this exact overlay binding without asserting buffer contents. --- src/overlays/shared/rendering/effects/glow_quads_draw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/rendering/effects/glow_quads_draw.c b/src/overlays/shared/rendering/effects/glow_quads_draw.c index eda4caa190..f0e4eff10f 100644 --- a/src/overlays/shared/rendering/effects/glow_quads_draw.c +++ b/src/overlays/shared/rendering/effects/glow_quads_draw.c @@ -235,7 +235,7 @@ typedef struct { } T_0023e5e0; extern T_0023e5e0 D_L00_001804C0_0023e5e0[] __asm__("D_L00_001804C0"); -u8 D_L00_00180640[8][1024] = {0}; +u8 l00_point_light_slot_buffers[8][1024] __asm__("D_L00_00180640") = {0}; u8 D_L01_00180AC0[8][1024] = {0}; @@ -299,7 +299,7 @@ int allocate_packed_color_point_light_slot(u128 *position, float radius, float b parameter_entry->unkC = b; fast_mem_zero16(slot_state, 0x30); slot_state->used = 1; - slot_state->buf = (char *)D_L00_00180640[i]; + slot_state->buf = (char *)l00_point_light_slot_buffers[i]; return i; } @@ -340,7 +340,7 @@ int allocate_colored_effect_slot(u128 *position, parameter_entry->unkC = b_0023e738; fast_mem_zero16(slot_state, 0x30); slot_state->used = 1; - slot_state->buf = (char *)D_L00_00180640[i]; + slot_state->buf = (char *)l00_point_light_slot_buffers[i]; return i; } From 634ef264415c24b0d64cce34545e0430e2a76953 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:47:29 +0000 Subject: [PATCH 024/758] decomp: clarify names in update_hero_motion_for_current_state D_L06_0015F68C -> l06_look_usage_record_count: Source snapshot d74b2aa50674430815f7956024989dd357b50b31ca51b53d0584946fdad63db5 declares a zero-initialized s32 and increments it only in the LOOK/LOOK_RELEASE_WAIT branch that records usage_stats.stat[18]. Retail 0022e0fc-0022e114 gates current-state 1/0x1E and hero+20A5; 0022e170-0022e188 gates the timer helper. 0022e198-0022e22c updates stat[18] count/time/level mask. At 0022e218 the counter is loaded from gp-0x7574, incremented at 0022e228, and stored at 0022e230. Original retail Ghidra corroborates iGpffff8a8c = iGpffff8a8c + 1 in that same usage-record block; no expiration or vehicle-form identity is claimed. --- src/overlays/l06/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 c7a2729309..b5b127382b 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 @@ -875,7 +875,7 @@ struct PlayerJointTable { extern f32 D_0015ED6C_c __asm__("D_0015ED6C"); extern f32 D_0015ED6C_a __asm__("D_0015ED6C"); extern s32 D_L06_0015F688 __attribute__((sda)); -s32 D_L06_0015F68C = 0; +s32 l06_look_usage_record_count __asm__("D_L06_0015F68C") = 0; extern u8 D_L06_00167558[]; extern void emit_hero_periodic_surface_effect(s32, s32) __asm__("FUN_L00_00209540"); @@ -1067,7 +1067,7 @@ void update_hero_motion_for_current_state(void) { D_L06_0015F688 = -1; usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; - D_L06_0015F68C++; + l06_look_usage_record_count++; } } } From 1cff4e6237d6a72ff5e55a06c6195bea8dd7b86b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:49:29 +0000 Subject: [PATCH 025/758] decomp: clarify names in update_hero_motion_for_current_state D_L16_0015F68C -> l16_recorded_look_usage_count: The authoritative C declares this s32 zero-initialized and increments it only in the HERO_STATE_LOOK / 0x1E look-release branch after the positive D_L16_0015F688 timer test, usage_stats.stat[18] count/time/level-mask recording, and timer invalidation to -1. Original Ghidra identifies the same iGpffff8a8c increment. Retail 0x00214688-0x002146a0 gates the look states; 0x00214794-0x002147bc loads gp-0x7574, adds one at 0x002147b4 and stores it at 0x002147bc while recording the usage mask and invalidating gp-0x7578. Thus it counts recorded look-usage events; l16 qualifies this assigned overlay binding. --- src/overlays/l16/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l16/hero/update_hero_motion_for_current_state.c b/src/overlays/l16/hero/update_hero_motion_for_current_state.c index 5f3cb483a1..419f9a6c77 100644 --- a/src/overlays/l16/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l16/hero/update_hero_motion_for_current_state.c @@ -127,7 +127,7 @@ extern struct Hero hero_b __asm__("D_0013F350"); /* Second name for the same global: retail reloads it after the f85C clamp store. */ extern f32 D_0015ED6C_b __asm__("D_0015ED6C"); extern f32 D_0015ED6C_a __asm__("D_0015ED6C"); -s32 D_L16_0015F68C = 0; +s32 l16_recorded_look_usage_count __asm__("D_L16_0015F68C") = 0; extern void emit_hero_periodic_surface_effect(s32, s32) __asm__("FUN_L00_00209540"); extern void build_scaled_hero_move_impulse(f32, f32) __asm__("FUN_L00_002132b8"); @@ -328,7 +328,7 @@ void update_hero_motion_for_current_state(void) { D_L16_0015F688 = -1; usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; - D_L16_0015F68C++; + l16_recorded_look_usage_count++; } } } From 4fc9520762760b38eb5b11098d72216ec3fcf66a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:49:40 +0000 Subject: [PATCH 026/758] decomp: clarify names in update_hero_motion_for_current_state D_L17_0015F68C -> l17_look_usage_event_count: The authoritative C declares this s32 zero-initialized counter and increments it only in the LOOK/LOOK_RELEASE_WAIT heading branch when the positive D_L17_0015F688 timer helper returns nonzero, alongside usage_stats.stat[18] count/time/level-mask recording. Original Ghidra shows iGpffff8a8c = iGpffff8a8c + 1 in that same branch. Retail 0x00214880-0x00214898 selects current states 1/0x1e and the heading flag; 0x0021499c loads gp-0x7574, 0x002149ac adds one and 0x002149b4 stores it after the statistic update. This proves a look usage-event counter; l17 qualifies its overlay ownership. --- src/overlays/l17/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l17/hero/update_hero_motion_for_current_state.c b/src/overlays/l17/hero/update_hero_motion_for_current_state.c index 227db75fd3..5c96257aa9 100644 --- a/src/overlays/l17/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l17/hero/update_hero_motion_for_current_state.c @@ -123,7 +123,7 @@ struct PlayerJointTable { /* second name for hero: gcc reloads the base through it (exactness) */ extern struct Hero hero_b __asm__("D_0013F350"); extern f32 D_0015ED6C_a __asm__("D_0015ED6C"); -s32 D_L17_0015F68C = 0; +s32 l17_look_usage_event_count __asm__("D_L17_0015F68C") = 0; extern void emit_hero_periodic_surface_effect(s32, s32) __asm__("FUN_L00_00209540"); extern void build_scaled_hero_move_impulse(f32, f32) __asm__("FUN_L00_002132b8"); @@ -318,7 +318,7 @@ void update_hero_motion_for_current_state(void) { D_L17_0015F688 = -1; usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; - D_L17_0015F68C++; + l17_look_usage_event_count++; } } } From 036c3207fe87e5e4574036758617c24f282688b3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:49:50 +0000 Subject: [PATCH 027/758] decomp: clarify names in update_hero_motion_for_current_state D_L18_0015F68C -> l18_look_timer_expiration_count: D_L18_0015F68C -> l18_look_timer_expiration_count: the authoritative C declares a zero-initialized s32 and increments it only inside the LOOK/LOOK_RELEASE_WAIT branch, with hero.unk20A5 enabled, after the positive D_L18_0015F688 timer expires through fast_dec_timer. Original retail Ghidra confirms iGpffff8a8c = iGpffff8a8c + 1 alongside usage-stat 18 updates. Retail 0x0021ebb8-0x0021ebcc selects states 1/0x1e; 0x0021ec2c-0x0021ec44 tests/decrements the timer; 0x0021ecd4 loads the counter, 0x0021ece4 increments it, and 0x0021ecec stores it while 0x0021ecdc resets the timer to -1. This proves a count of these LOOK timer-expiry events, without claiming the timer's gameplay purpose. --- src/overlays/l18/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l18/hero/update_hero_motion_for_current_state.c b/src/overlays/l18/hero/update_hero_motion_for_current_state.c index 9c7afda397..43c4b62905 100644 --- a/src/overlays/l18/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l18/hero/update_hero_motion_for_current_state.c @@ -123,7 +123,7 @@ struct PlayerJointTable { /* second name for hero: gcc reloads the base through it (exactness) */ extern struct Hero hero_b __asm__("D_0013F350"); extern f32 D_0015ED6C_a __asm__("D_0015ED6C"); -s32 D_L18_0015F68C = 0; +s32 l18_look_timer_expiration_count __asm__("D_L18_0015F68C") = 0; extern void emit_hero_periodic_surface_effect(s32, s32) __asm__("FUN_L00_00209540"); extern void build_scaled_hero_move_impulse(f32, f32) __asm__("FUN_L00_002132b8"); @@ -319,7 +319,7 @@ void update_hero_motion_for_current_state(void) { D_L18_0015F688 = -1; usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; - D_L18_0015F68C++; + l18_look_timer_expiration_count++; } } } From 73affaf5367834480edf15140a57a263a560c45e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:51:44 +0000 Subject: [PATCH 028/758] decomp: clarify names in update_view_context D_0018CFC0 -> view_clip_constants: Retail 0x001f2ed0 sets a2 to 0x0018cfc0. Quadword loads/stores at 0x001f2f18-0x001f2f4c copy view_context+0xb0, +0x1d0, +0x1e0 and +0x1f0 to destination offsets 0, 0x10, 0x20 and 0x30. The authoritative Vec4[4] source names those inputs fov, aspect_scale, clip_scale and clip_distances; preceding 0x001f2eb8-0x001f2f14 computes reciprocal aspects, combined clip scale and near/far clip distances. Original retail Ghidra shows the same destination fields at DAT_0018cfc0 through DAT_0018cffc. This proves a current-view clip constants block without claiming a specific downstream renderer. --- src/rendering/view/update_view_context.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rendering/view/update_view_context.c b/src/rendering/view/update_view_context.c index cedafbe352..e43865c8ce 100644 --- a/src/rendering/view/update_view_context.c +++ b/src/rendering/view/update_view_context.c @@ -20,7 +20,7 @@ struct Clip { Vec4 constants[3]; }; -Vec4 D_0018CFC0[4] = {0}; +Vec4 view_clip_constants[4] __asm__("D_0018CFC0") = {0}; extern f32 view_projection_scale_bias_constants[4] __asm__("D_00160720"); @@ -104,10 +104,10 @@ void update_view_context(void) { near_clip = view->near_clip; view->clip_distances.f[1] = near_clip; view->clip_scale.f[2] = (horizontal_clip_scale + vertical_clip_scale) * 0.5f; - qcopy(&D_0018CFC0[0], &view->fov); - qcopy(&D_0018CFC0[1], &view->aspect_scale); - qcopy(&D_0018CFC0[2], &view->clip_scale); - qcopy(&D_0018CFC0[3], &view->clip_distances); + qcopy(&view_clip_constants[0], &view->fov); + qcopy(&view_clip_constants[1], &view->aspect_scale); + qcopy(&view_clip_constants[2], &view->clip_scale); + qcopy(&view_clip_constants[3], &view->clip_distances); /* Retail lw instructions carry the fog endpoint float bits into packet fields. */ far_bits = *(s32 *)&view->fog_far_int; From 70b28a1eeb3d3c687a7d4dc29f4e0bf4830211b0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:53:44 +0000 Subject: [PATCH 029/758] decomp: clarify names in update_hero_motion_by_state D_L14_0015F68C -> l14_look_usage_event_count: Authoritative source defines this s32 as zero and increments it only in the LOOK/LOOK_RELEASE_WAIT branch, guarded by hero.unk20A5 and the positive timer/fast_dec_timer result, alongside usage_stats.stat[18].count, latest_time_bucket and level_mask updates. Retail 0x00228ddc-0x00228df4 tests current states 1/0x1E and +0x20A5; 0x00228e50-0x00228e68 gates the event on gp-0x7578 and the timer helper. At 0x00228ef8 it loads gp-0x7574 (original Ghidra iGpffff8a8c, source D_L14_0015F68C), 0x00228f08 adds one and 0x00228f10 stores it back, immediately alongside stat18 level-mask update at 0x00228f0c. Thus this is a LOOK usage-event counter; no specific statistic trigger or lifetime beyond this consumer is inferred. --- src/overlays/l14/hero/update_hero_motion_by_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 2579a50ea3..c98182accf 100644 --- a/src/overlays/l14/hero/update_hero_motion_by_state.c +++ b/src/overlays/l14/hero/update_hero_motion_by_state.c @@ -389,7 +389,7 @@ struct PlayerJointTable { }; extern f32 D_0015ED6C_a __asm__("D_0015ED6C"); -s32 D_L14_0015F68C = 0; +s32 l14_look_usage_event_count __asm__("D_L14_0015F68C") = 0; extern void emit_hero_periodic_surface_effect(s32, s32) __asm__("FUN_L00_00209540"); extern void build_scaled_hero_move_impulse(f32, f32) __asm__("FUN_L00_002132b8"); @@ -580,7 +580,7 @@ void update_hero_motion_by_state(void) { D_L14_0015F688 = -1; usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; - D_L14_0015F68C++; + l14_look_usage_event_count++; } } } From df4c500d1262b7096be0c52efbcd134d83caa566 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 20:55:55 +0000 Subject: [PATCH 030/758] decomp: clarify names in update_hero_motion_for_current_state D_L08_0015F68C -> l08_look_timer_completion_count: Embedded source declares this s32 counter zero-initialized and increments it only inside the HERO_STATE_LOOK/HERO_STATE_LOOK_RELEASE_WAIT branch after D_L08_0015F688 > 0 and fast_dec_timer returns nonzero. Retail 0x002285d0-0x002285e8 proves the current-state/flag gate; 0x00228644-0x0022865c checks and decrements the timer. 0x002286ec loads the counter from gp-0x7574, 0x002286fc increments it, and 0x00228704 stores it back, alongside timer=-1 at 0x002286f4 and usage_stats.stat[18] level-mask update at 0x00228700. Original Ghidra shows iGpffff8a8c=iGpffff8a8c+1 under the same gate, proving a count of these look-timer completions without inferring the timer's wider purpose. --- src/overlays/l08/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l08/hero/update_hero_motion_for_current_state.c b/src/overlays/l08/hero/update_hero_motion_for_current_state.c index 585eb274f0..a7f9a55d76 100644 --- a/src/overlays/l08/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l08/hero/update_hero_motion_for_current_state.c @@ -250,7 +250,7 @@ struct PlayerJointTable { }; extern f32 D_0015ED6C_a __asm__("D_0015ED6C"); -s32 D_L08_0015F68C = 0; +s32 l08_look_timer_completion_count __asm__("D_L08_0015F68C") = 0; extern void emit_hero_periodic_surface_effect(s32, s32) __asm__("FUN_L00_00209540"); extern void build_scaled_hero_move_impulse(f32, f32) __asm__("FUN_L00_002132b8"); @@ -439,7 +439,7 @@ void update_hero_motion_for_current_state(void) { D_L08_0015F688 = -1; usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; - D_L08_0015F68C++; + l08_look_timer_completion_count++; } } } From 44eb8875471afdfb75e47e5d7165dd52c2c783f8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 21:19:35 +0000 Subject: [PATCH 031/758] decomp: clarify names in hoverboard_girl_update domain_0_value_3 -> HOVERBOARD_GIRL_DIALOGUE_SETUP_RACE_CAMERA: Retail 0x00316c0c-0x00316c18 loads and compares the signed halfword at state +0x36 against 3. Its matching branch 0x00316c28-0x00316c80 preserves that node, changes it to 2, records the frame, clears the dialogue event, calls set_race_camera with 0x00215bc0/0x00215bd0, copies the alternate camera vectors to saved_camera_vectors and requests music (2,6). Thus node 3 triggers race-camera setup. Checked helper 0x00290570-0x0029057c multiplies the same +0x36 field by 0x1c to index the +0x3c dialogue table; initializer 0x00290870-0x00290874 binds it to race_entries. The original decompilation and current C show this same conditional camera-setup branch. This is a dialogue-node constant distinct from moby state 3 and all hero selectors. --- src/overlays/l05/mobys/hoverboard_girl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l05/mobys/hoverboard_girl.c b/src/overlays/l05/mobys/hoverboard_girl.c index 528fbe0473..7315ba95bb 100644 --- a/src/overlays/l05/mobys/hoverboard_girl.c +++ b/src/overlays/l05/mobys/hoverboard_girl.c @@ -206,6 +206,9 @@ void hoverboard_girl_update(HoverboardGirlMoby *moby) { enum { HOVERBOARD_GIRL_DIALOGUE_ALTERNATE_ITEM_REWARD = 4 }; + enum { + HOVERBOARD_GIRL_DIALOGUE_SETUP_RACE_CAMERA = 3 + }; HoverboardGirlState *state = moby->data; HoverboardGirlVector target_position; HoverboardGirlVector head_position; @@ -241,7 +244,7 @@ void hoverboard_girl_update(HoverboardGirlMoby *moby) { begin_dialogue_camera_transition(2.0f, moby); moby->state = HOVERBOARD_GIRL_STATE_WAIT_TO_RESUME_DIALOGUE; } - if (state->dialogue_state == 3) { + if (state->dialogue_state == HOVERBOARD_GIRL_DIALOGUE_SETUP_RACE_CAMERA) { state->previous_dialogue_state = state->dialogue_state; state->dialogue_state = 2; state->dialogue_state_frame = frame_number; From 5b3d702fdc7320cab805eabe660b6cfa010bb4a7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 21:28:42 +0000 Subject: [PATCH 032/758] overlay: name moby movement with ground and collision checks --- src/overlays/l01/mobys/peckbot.c | 8 ++-- src/overlays/l02/mobys/sand_shark.c | 33 +++++++-------- src/overlays/l03/mobys/robot_dog.c | 15 ++++--- src/overlays/l05/mobys/amoeboid.c | 6 ++- src/overlays/l05/mobys/extermibot.c | 28 +++++++------ src/overlays/l06/mobys/alien_snapper.c | 12 +++--- src/overlays/l10/mobys/toxic_crab.c | 9 +++-- src/overlays/l11/mobys/puffoid.c | 5 ++- src/overlays/l12/mobys/blarg_trooper.c | 5 ++- src/overlays/l13/mobys/blarg_space_commando.c | 13 ++++-- src/overlays/l13/mobys/robosquawker.c | 12 ++++-- .../shared/enemies/blarg_space_commando.c | 33 +++++++-------- src/overlays/shared/enemies/gadgebot.c | 40 ++++++++++--------- .../shared/enemies/ground_melee_enemy.c | 2 +- src/overlays/shared/enemies/large_amoeboid.c | 27 +++++++------ .../shared/math/interpolation/spring_turn.c | 12 +++--- 16 files changed, 143 insertions(+), 117 deletions(-) diff --git a/src/overlays/l01/mobys/peckbot.c b/src/overlays/l01/mobys/peckbot.c index 7aac95d861..5d8af93714 100644 --- a/src/overlays/l01/mobys/peckbot.c +++ b/src/overlays/l01/mobys/peckbot.c @@ -178,7 +178,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 FUN_L00_00258b50(void *, void *, void *, void *, f32); +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"); @@ -566,7 +566,7 @@ void peckbot_update(Mob577 *peckbot_moby) { vector_scratch.f[0] = fast_cos(peckbot_moby->rot.f[2]) * 2.0f; vector_scratch.f[1] = fast_sin(peckbot_moby->rot.f[2]) * 2.0f; vector_scratch.f[2] = 0.0f; - movement_result_flags = FUN_L00_00258b50( + movement_result_flags = move_moby_with_ground_and_collision_checks( peckbot_moby, &peckbot_vars->x180, &vector_scratch, &position_scratch, 1.0f); if (fast_dec_timer(&peckbot_vars->turn_timer) != 0) { peckbot_vars->turn_timer = scale_game_frames(random_float_between(30.0f, 90.0f)); @@ -646,7 +646,7 @@ void peckbot_update(Mob577 *peckbot_moby) { vector_scratch.f[0] = fast_cos(peckbot_moby->rot.f[2]) * 2.0f; vector_scratch.f[1] = fast_sin(peckbot_moby->rot.f[2]) * 2.0f; vector_scratch.f[2] = 0.0f; - movement_result_flags = FUN_L00_00258b50( + movement_result_flags = move_moby_with_ground_and_collision_checks( peckbot_moby, &peckbot_vars->x180, &vector_scratch, &position_scratch, 1.0f); if (vector_distance_xy(&peckbot_moby->pos, &peckbot_vars->home) < 2.0f) { peckbot_moby->state = PECKBOT_STATE_GROUNDED_IDLE; @@ -788,7 +788,7 @@ void peckbot_update(Mob577 *peckbot_moby) { vector_scratch.f[0] = fast_cos(peckbot_moby->rot.f[2]) * 2.0f; vector_scratch.f[1] = fast_sin(peckbot_moby->rot.f[2]) * 2.0f; vector_scratch.f[2] = 0.0f; - recovery_movement_result_flags = FUN_L00_00258b50( + recovery_movement_result_flags = move_moby_with_ground_and_collision_checks( peckbot_moby, &peckbot_vars->x180, &vector_scratch, &position_scratch, 1.0f); fast_vec_sub(&home_to_target, &target.pos, &peckbot_vars->home); if (vector_distance_xy(&peckbot_moby->pos, &target.pos) < 1.5f && diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index bb11d13d72..0e455dc978 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -261,7 +261,8 @@ extern void FUN_L00_00257470_e50(void *, int, int) __asm__("FUN_L00_0025 extern void random_vector(void *, float, float) __asm__("FUN_L00_00257d78"); extern void FUN_L00_00258278_c(void *, float, float *, float, float, float) __asm__("FUN_L00_00258278"); -extern void FUN_L00_00258b50(void *, void *, void *, void *, float); +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 FUN_L00_0025a120_e50(void *) __asm__("FUN_L00_0025a120"); extern void @@ -483,11 +484,11 @@ void sand_shark_update(struct Moby *moby) { position_or_offset_scratch.f[1] = 2.0f * fast_sin(moby->rot.z); position_or_offset_scratch.f[2] = 0.0f; fast_vec_add(&position_or_offset_scratch, &position_or_offset_scratch, &moby->pos); - FUN_L00_00258b50(moby, - &sand_shark_behavior_vars->walk_mode, - &position_or_offset_scratch, - &target_home_delta, - 1.0f); + move_moby_with_ground_and_collision_checks(moby, + &sand_shark_behavior_vars->walk_mode, + &position_or_offset_scratch, + &target_home_delta, + 1.0f); FUN_L02_002d63c0_e50(moby); if (path_8808(sand_shark_behavior_vars->path, &moby->pos, @@ -625,11 +626,11 @@ void sand_shark_update(struct Moby *moby) { position_or_offset_scratch.f[1] = 2.0f * fast_sin(moby->rot.z); position_or_offset_scratch.f[2] = 0.0f; fast_vec_add(&position_or_offset_scratch, &position_or_offset_scratch, &moby->pos); - FUN_L00_00258b50(moby, - &sand_shark_behavior_vars->walk_mode, - &position_or_offset_scratch, - &target_or_particle_vector, - 1.0f); + move_moby_with_ground_and_collision_checks(moby, + &sand_shark_behavior_vars->walk_mode, + &position_or_offset_scratch, + &target_or_particle_vector, + 1.0f); FUN_L02_002d63c0_e50(moby); if (moby->state == SAND_SHARK_APPROACH_TARGET_WITH_HEIGHT_OFFSET) { moby->pos.z -= sand_shark_height_offset_gp; @@ -718,11 +719,11 @@ void sand_shark_update(struct Moby *moby) { position_or_offset_scratch.f[1] = 2.0f * fast_sin(moby->rot.z); position_or_offset_scratch.f[2] = 0.0f; fast_vec_add(&position_or_offset_scratch, &position_or_offset_scratch, &moby->pos); - FUN_L00_00258b50(moby, - &sand_shark_behavior_vars->walk_mode, - &position_or_offset_scratch, - &target_or_particle_vector, - 1.0f); + move_moby_with_ground_and_collision_checks(moby, + &sand_shark_behavior_vars->walk_mode, + &position_or_offset_scratch, + &target_or_particle_vector, + 1.0f); if (moby->state == SAND_SHARK_RETURN_HOME_WITH_HEIGHT_OFFSET) { moby->pos.z -= sand_shark_height_offset_gp; } diff --git a/src/overlays/l03/mobys/robot_dog.c b/src/overlays/l03/mobys/robot_dog.c index 9eeee3c0b2..2aa9163bb5 100644 --- a/src/overlays/l03/mobys/robot_dog.c +++ b/src/overlays/l03/mobys/robot_dog.c @@ -121,9 +121,10 @@ char D_L03_001618D0 = 3; extern float D_L03_0015F580_macro[] __asm__("D_L03_0015F580") MACRO_ADDR; extern float FUN_L04_001f1978(float); extern int rand(void) __asm__("FUN_001160d8"); -extern int FUN_L00_00258b50(void *, void *, void *, void *, float); -extern int step_mover_2e3f20(char *m, char *p, char *pos, char *v) __asm__("FUN_L00_00259028"); -extern int FUN_L00_002dc9f0(void *, void *); +extern int move_moby_with_ground_and_collision_checks( + void *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); +extern int step_mover_2e3f20(char *m, char *p, char *pos, char *v) __asm__("FUN_L00_00259028"); +extern int FUN_L00_002dc9f0(void *, void *); extern int select_moby_target_with_hero_fallback(char *, char *, float) __asm__("FUN_L03_0024e830"); extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_00258278(char *moby, float *vel, float target, float k, float d, float max); @@ -286,7 +287,8 @@ void robot_dog_update(char *moby) { forward_vector_or_path_point[0] = 2.0f * fast_cos(MOBY(moby)->rot.z); forward_vector_or_path_point[1] = 2.0f * fast_sin(MOBY(moby)->rot.z); forward_vector_or_path_point[2] = 0.0f; - FUN_L00_00258b50(moby, &robot_dog_state->i180, forward_vector_or_path_point, push, 1.0f); + move_moby_with_ground_and_collision_checks( + moby, &robot_dog_state->i180, forward_vector_or_path_point, push, 1.0f); if (fast_dec_timer(&robot_dog_state->i23C)) { robot_dog_state->i23C = scale_game_frames((int)random_float_between(30.0f, 90.0f)); } @@ -359,7 +361,7 @@ void robot_dog_update(char *moby) { forward_vector_or_path_point[0] = 2.0f * fast_cos(MOBY(moby)->rot.z); forward_vector_or_path_point[1] = 2.0f * fast_sin(MOBY(moby)->rot.z); forward_vector_or_path_point[2] = 0.0f; - FUN_L00_00258b50( + move_moby_with_ground_and_collision_checks( moby, &robot_dog_state->i180, forward_vector_or_path_point, robot_dog_state->v40, 1.0f); if (((unsigned char *)moby)[0x52] == 5) { approach_value(&robot_dog_state->f1A4, @@ -401,7 +403,8 @@ void robot_dog_update(char *moby) { forward_vector_or_path_point[0] = 2.0f * fast_cos(MOBY(moby)->rot.z); forward_vector_or_path_point[1] = 2.0f * fast_sin(MOBY(moby)->rot.z); forward_vector_or_path_point[2] = 0.0f; - FUN_L00_00258b50(moby, &robot_dog_state->i180, forward_vector_or_path_point, push, 1.0f); + move_moby_with_ground_and_collision_checks( + moby, &robot_dog_state->i180, forward_vector_or_path_point, push, 1.0f); if (vector_distance_xy(moby + 0x10, robot_dog_state->home) < 1.0f) { MOBY(moby)->state = ROBOT_DOG_WAIT_FOR_ACTIVATION; if (((unsigned char *)moby)[0x53] != 1) { diff --git a/src/overlays/l05/mobys/amoeboid.c b/src/overlays/l05/mobys/amoeboid.c index 161decf5b6..c072bb7914 100644 --- a/src/overlays/l05/mobys/amoeboid.c +++ b/src/overlays/l05/mobys/amoeboid.c @@ -16,7 +16,8 @@ extern float fast_sin(float); extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); -extern int FUN_L00_00258b50(void *, void *, void *, void *, float); +extern int move_moby_with_ground_and_collision_checks( + void *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); extern void FUN_L01_0026d930(char *p); extern void handle_amoeboid_hits(unsigned char *m) __asm__("FUN_L05_002daf58"); extern void spawn_amoeboid_particles(unsigned char *moby) __asm__("FUN_L05_002db018"); @@ -85,7 +86,8 @@ void amoeboid_update(struct Moby *moby) { facing_direction[0] = fast_cos(moby->rot.z); facing_direction[1] = fast_sin(moby->rot.z); facing_direction[2] = 0.0f; - FUN_L00_00258b50(moby, &moby_data->unk60, facing_direction, &moby_data->unk40, 1.0f); + move_moby_with_ground_and_collision_checks( + moby, &moby_data->unk60, facing_direction, &moby_data->unk40, 1.0f); if (fast_dec_timer(&moby_data->timer_B8) != 0 || vector_distance_xy(&moby->pos, ((char *)l05_paths[moby_data->path_B0]) + diff --git a/src/overlays/l05/mobys/extermibot.c b/src/overlays/l05/mobys/extermibot.c index 744b7cdcb9..5b394d52ba 100644 --- a/src/overlays/l05/mobys/extermibot.c +++ b/src/overlays/l05/mobys/extermibot.c @@ -45,7 +45,8 @@ extern float D_0015ED70; float absolute_float(float input) __asm__("func_001F99C0"); extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); -extern int FUN_L00_00258b50(void *, void *, void *, void *, float); +extern int move_moby_with_ground_and_collision_checks( + void *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); extern void FUN_L01_0026d930(char *p); /* Extermibot update: wakes from its dormant pose, walks its path, closes in on the target and strikes it, bursts into sparks between strikes, and dies on a hit. */ /* Ported from rac1-decomp (src/overlays/l05_rilgar/vendor_002D28D0.c: func_L05_003033A0), where it is exact; names translated to the US level program. */ @@ -284,11 +285,12 @@ void extermibot_update(unsigned char *moby) { path_goal_or_facing_vector[0] = fast_cos(MOBY(moby)->rot.z) * 2.0f; path_goal_or_facing_vector[1] = fast_sin(MOBY(moby)->rot.z) * 2.0f; path_goal_or_facing_vector[2] = 0.0f; - FUN_L00_00258b50(moby, - &moby_data->move, - path_goal_or_facing_vector, - movement_displacement_or_spark_vector_or_strike_position, - 1.0f); + move_moby_with_ground_and_collision_checks( + moby, + &moby_data->move, + path_goal_or_facing_vector, + movement_displacement_or_spark_vector_or_strike_position, + 1.0f); resolve_point_path_segment_xy_clearance( moby_data->path, moby_position, moby_position, (D_L05_00161A98) * 0.4f); } @@ -321,11 +323,12 @@ void extermibot_update(unsigned char *moby) { path_goal_or_facing_vector[0] = fast_cos(MOBY(moby)->rot.z) * 2.0f; path_goal_or_facing_vector[1] = fast_sin(MOBY(moby)->rot.z) * 2.0f; path_goal_or_facing_vector[2] = 0.0f; - FUN_L00_00258b50(moby, - &moby_data->move, - path_goal_or_facing_vector, - movement_displacement_or_spark_vector_or_strike_position, - 1.0f); + move_moby_with_ground_and_collision_checks( + moby, + &moby_data->move, + path_goal_or_facing_vector, + movement_displacement_or_spark_vector_or_strike_position, + 1.0f); resolve_point_path_segment_xy_clearance( moby_data->path, moby_position, moby_position, (D_L05_00161A98) * 0.4f); } @@ -1020,7 +1023,8 @@ void move_extermibot_along_path(struct Moby *moby, s32 destination_position, f32 facing_direction.x = fast_cos(moby->rot.z) * 2.0f; facing_direction.y = fast_sin(moby->rot.z) * 2.0f; facing_direction.z = 0.0f; - FUN_L00_00258b50(moby, walker_vars->move, &facing_direction, &movement_displacement, 1.0f); + move_moby_with_ground_and_collision_checks( + moby, walker_vars->move, &facing_direction, &movement_displacement, 1.0f); if (walker_vars->stuck_timer == 0) { if (FUN_L05_00304058_u( walker_vars->path, &moby->pos, &moby->pos, D_L05_00161A98_gp * 0.4f) > 2.0f) diff --git a/src/overlays/l06/mobys/alien_snapper.c b/src/overlays/l06/mobys/alien_snapper.c index 7bd46683b0..f60a3d7682 100644 --- a/src/overlays/l06/mobys/alien_snapper.c +++ b/src/overlays/l06/mobys/alien_snapper.c @@ -178,8 +178,8 @@ extern void func_L00_002592B0_91A8(Moby *, float, float *, float, float, float) __asm__("FUN_L00_00258278"); extern float approach_value(float *, float, float) __asm__("FUN_00213ed8"); extern float func_L06_002FAB28_91A8(Moby *) __asm__("FUN_L06_002f96f8"); -extern int -func_L00_00259B88_91A8(Moby *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); +extern int move_moby_with_ground_and_collision_checks( + Moby *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); extern void func_L00_00262DF0_91A8(float, int, void *, void *) __asm__("FUN_L00_00261d78"); extern void func_L00_00262DF0_b91A8(int, void *, void *, float) __asm__("FUN_L00_00261d78"); extern float compute_interpolated_record_value(Moby *) __asm__("FUN_0020c9e0"); @@ -487,7 +487,7 @@ void alien_snapper_update(Moby *moby) { scratch.m.dir[0] = fast_cos(moby->rot.z) * 2.0f; scratch.m.dir[1] = fast_sin(moby->rot.z) * 2.0f; scratch.m.dir[2] = 0.0f; - func_L00_00259B88_91A8( + move_moby_with_ground_and_collision_checks( moby, &snapper_behavior->movement, scratch.m.dir, scratch.m.out, 1.0f); moby->rot.z = saved_rot; func_L00_00262DF0_91A8(0.5f, snapper_behavior->path, &moby->pos, &moby->pos); @@ -561,7 +561,7 @@ void alien_snapper_update(Moby *moby) { scratch.m.dir[0] = fast_cos(moby->rot.z) * 2.0f; scratch.m.dir[1] = fast_sin(moby->rot.z) * 2.0f; scratch.m.dir[2] = 0.0f; - func_L00_00259B88_91A8( + move_moby_with_ground_and_collision_checks( moby, &snapper_behavior->movement, scratch.m.dir, scratch.m.out, 1.0f); moby->rot.z = saved_rot; func_L00_00262DF0_91A8(0.5f, snapper_behavior->path, &moby->pos, &moby->pos); @@ -630,7 +630,7 @@ void alien_snapper_update(Moby *moby) { scratch.m.dir[0] = fast_cos(moby->rot.z) * 2.0f; scratch.m.dir[1] = fast_sin(moby->rot.z) * 2.0f; scratch.m.dir[2] = 0.0f; - func_L00_00259B88_91A8( + move_moby_with_ground_and_collision_checks( moby, &snapper_behavior->movement, scratch.m.dir, scratch.m.out, 1.0f); moby->rot.z = saved_rot; func_L00_00262DF0_91A8(0.5f, snapper_behavior->path, &moby->pos, &moby->pos); @@ -664,7 +664,7 @@ void alien_snapper_update(Moby *moby) { scratch.m.dir[0] = fast_cos(moby->rot.z) * 2.0f; scratch.m.dir[1] = fast_sin(moby->rot.z) * 2.0f; scratch.m.dir[2] = 0.0f; - func_L00_00259B88_91A8( + move_moby_with_ground_and_collision_checks( moby, &snapper_behavior->movement, scratch.m.dir, scratch.m.out, 1.0f); func_L00_00262DF0_b91A8(snapper_behavior->path, &moby->pos, &moby->pos, 0.5f); if (fast_vec_dist(&moby->pos, &snapper_behavior->home) < 1.0f) { diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index e511c16312..870c490da0 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -193,7 +193,8 @@ extern float fast_cos(float); extern float fast_sin(float); extern int D_L10_0015F5CC; extern int D_L10_0015FFD8; -extern int FUN_L00_00258b50(void *, void *, void *, void *, float); +extern int move_moby_with_ground_and_collision_checks( + void *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); extern float l10_toxic_crab_size_scale __asm__("D_L10_00161E24") __attribute__((sda)); #include "rnc/overlay/l10/mobys/toxic_crab_data/toxic_crab_update_2.h" @@ -478,7 +479,7 @@ void toxic_crab_update(Moby2E30F8 *m) { } } } - r = FUN_L00_00258b50(m, &crab_data->iD0, dir, out, 1.0f); + r = move_moby_with_ground_and_collision_checks(m, &crab_data->iD0, dir, out, 1.0f); m->f48 = rot; if (r & 3) { if (vector_distance_xy(m->pos, pre_movement_position) < @@ -675,7 +676,7 @@ void toxic_crab_update(Moby2E30F8 *m) { dir[0] = fast_cos(m->f48) * 2.0f; dir[1] = fast_sin(m->f48) * 2.0f; dir[2] = 0.0f; - FUN_L00_00258b50(m, &crab_data->iD0, dir, out, 1.0f); + move_moby_with_ground_and_collision_checks(m, &crab_data->iD0, dir, out, 1.0f); m->f48 = rot; if (see) { if (fast_dec_timer(&crab_data->i1A8) || @@ -713,7 +714,7 @@ void toxic_crab_update(Moby2E30F8 *m) { dir[0] = fast_cos(m->f48) * 2.0f; dir[1] = fast_sin(m->f48) * 2.0f; dir[2] = 0.0f; - FUN_L00_00258b50(m, &crab_data->iD0, dir, out, 1.0f); + move_moby_with_ground_and_collision_checks(m, &crab_data->iD0, dir, out, 1.0f); if (fast_vec_dist(m->pos, crab_data->v170) < 1.0f) { m->state = TOXIC_CRAB_STATE_FACE_TRACKED_POSITION; if (m->anim != 1) { diff --git a/src/overlays/l11/mobys/puffoid.c b/src/overlays/l11/mobys/puffoid.c index d1a715d5e2..9130c2b193 100644 --- a/src/overlays/l11/mobys/puffoid.c +++ b/src/overlays/l11/mobys/puffoid.c @@ -920,7 +920,8 @@ void update_puffoid_damage_and_path_goal(struct Moby *moby) { } extern float frame_scale_inv_macro[] __asm__("D_0015ED68") MACRO_ADDR; -extern void FUN_L00_00258b50_c(char *, char *, float *, float *, float) __asm__("FUN_L00_00258b50"); +extern void move_moby_with_ground_and_collision_checks( + char *, char *, float *, float *, float) __asm__("FUN_L00_00258b50"); void update_moby_target_heading_and_conditional_movement( char *moby, float *target_position) __asm__("FUN_L11_00315f58"); @@ -947,7 +948,7 @@ void update_moby_target_heading_and_conditional_movement(char *moby, float *targ planar_heading_vector[0] = fast_cos(MOBY(moby)->rot.z) * 2.0f; planar_heading_vector[1] = fast_sin(MOBY(moby)->rot.z) * 2.0f; *(int *)&planar_heading_vector[2] = 0; - FUN_L00_00258b50_c( + move_moby_with_ground_and_collision_checks( moby, moby_vars + 0x180, planar_heading_vector, helper_scratch_buffer, 1.0f); } } diff --git a/src/overlays/l12/mobys/blarg_trooper.c b/src/overlays/l12/mobys/blarg_trooper.c index 02ed23f2d0..7bc95812bd 100644 --- a/src/overlays/l12/mobys/blarg_trooper.c +++ b/src/overlays/l12/mobys/blarg_trooper.c @@ -68,7 +68,7 @@ extern float vector_length_xy(void *); extern int D_L12_0015F5C4 __asm__("D_L12_0015F5C4"); extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); -extern s32 FUN_L00_00258b50(void *, void *, void *, void *, f32); +extern s32 move_moby_with_ground_and_collision_checks(void *, void *, void *, void *, f32) __asm__("FUN_L00_00258b50"); /* Steers the moby toward a point 100 units ahead along its heading. */ s32 move_moby_along_heading(struct Moby *moby, void *ctl) __asm__("FUN_L12_00271dd8"); @@ -80,7 +80,8 @@ s32 move_moby_along_heading(struct Moby *moby, void *ctl) { qcopy(&ahead, &moby->pos); ahead.f[0] += fast_cos(moby->rot.z) * 100.0f; ahead.f[1] += fast_sin(moby->rot.z) * 100.0f; - return FUN_L00_00258b50(moby, ctl, &ahead, &movement_displacement, 1.0f); + return move_moby_with_ground_and_collision_checks( + moby, ctl, &ahead, &movement_displacement, 1.0f); } /* Tests whether a point lies within height, distance and heading limits of a moby. */ diff --git a/src/overlays/l13/mobys/blarg_space_commando.c b/src/overlays/l13/mobys/blarg_space_commando.c index 007997b0eb..debe8df182 100644 --- a/src/overlays/l13/mobys/blarg_space_commando.c +++ b/src/overlays/l13/mobys/blarg_space_commando.c @@ -131,7 +131,8 @@ typedef struct { u8 unk400[1]; } Vars_309330; -extern int FUN_L00_00258b50(struct Moby *, void *, void *, void *, float); +extern int move_moby_with_ground_and_collision_checks( + struct Moby *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); extern int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); @@ -373,7 +374,9 @@ void blarg_space_commando_update(struct Moby *moby) { point.f[0] = 2.0f * fast_cos(moby->rot.z); point.f[1] = 2.0f * fast_sin(moby->rot.z); point.f[2] = 0.0f; - if (FUN_L00_00258b50(moby, &blarg_space_commando_vars->ctl, &point, &origin, 1.0f) & 2) { + if (move_moby_with_ground_and_collision_checks( + moby, &blarg_space_commando_vars->ctl, &point, &origin, 1.0f) & + 2) { rand(); blarg_space_commando_vars->unk1A8 = convert_integer_to_float(-1) * 1.0995574f; } else { @@ -418,7 +421,8 @@ void blarg_space_commando_update(struct Moby *moby) { point.f[0] = 2.0f * fast_cos(moby->rot.z); point.f[1] = 2.0f * fast_sin(moby->rot.z); point.f[2] = 0.0f; - FUN_L00_00258b50(moby, &blarg_space_commando_vars->ctl, &point, &origin, 1.0f); + move_moby_with_ground_and_collision_checks( + moby, &blarg_space_commando_vars->ctl, &point, &origin, 1.0f); resolve_point_path_segment_xy_clearance( blarg_space_commando_vars->path, &moby->pos, &moby->pos, 0.75f); if (path_8808(blarg_space_commando_vars->path, &moby->pos, &target->pos, &direction) != 0 && @@ -483,7 +487,8 @@ void blarg_space_commando_update(struct Moby *moby) { moby->rot.z, fast_arc_tan(blarg_space_commando_vars->home.f[0] - moby->pos.x, blarg_space_commando_vars->home.f[1] - moby->pos.y)) < 0.7853982f) { - FUN_L00_00258b50(moby, &blarg_space_commando_vars->ctl, &point, &origin, 1.0f); + move_moby_with_ground_and_collision_checks( + moby, &blarg_space_commando_vars->ctl, &point, &origin, 1.0f); resolve_point_path_segment_xy_clearance( blarg_space_commando_vars->path, &moby->pos, &moby->pos, 0.75f); } diff --git a/src/overlays/l13/mobys/robosquawker.c b/src/overlays/l13/mobys/robosquawker.c index fbb2b3a157..e2cb266f24 100644 --- a/src/overlays/l13/mobys/robosquawker.c +++ b/src/overlays/l13/mobys/robosquawker.c @@ -411,7 +411,8 @@ extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern int FUN_L00_00258830(void *, void *, float, float, float, int); -extern int FUN_L00_00258b50(void *, void *, void *, void *, float); +extern int move_moby_with_ground_and_collision_checks( + void *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); extern int FUN_L00_002dc9f0(void *, void *); @@ -1026,7 +1027,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * 2.0f; va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * 2.0f; va.f[2] = 0.0f; - res = FUN_L00_00258b50(robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); + res = move_moby_with_ground_and_collision_checks( + robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); if (fast_dec_timer(&robosquawker_vars->w210) != 0) { robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_vars->f1F4 = -robosquawker_vars->f1F4; @@ -1131,7 +1133,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * 2.0f; va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * 2.0f; va.f[2] = 0.0f; - res = FUN_L00_00258b50(robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); + res = move_moby_with_ground_and_collision_checks( + robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); if (vector_distance_xy(&robosquawker_moby->pos, &robosquawker_vars->v1D0) < 2.0f) { robosquawker_moby->state = ROBOSQUAWKER_STATE_GROUND_IDLE; if (robosquawker_moby->b53 != 3) { @@ -1227,7 +1230,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * 2.0f; va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * 2.0f; va.f[2] = 0.0f; - res = FUN_L00_00258b50(robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); + res = move_moby_with_ground_and_collision_checks( + robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); fast_vec_sub(&vc, &selected_target_record, &robosquawker_vars->v1D0); if (vector_distance_xy(&robosquawker_moby->pos, &selected_target_record) < 1.5f && r <= 1.0f) { diff --git a/src/overlays/shared/enemies/blarg_space_commando.c b/src/overlays/shared/enemies/blarg_space_commando.c index c668046c88..2a3b05a893 100644 --- a/src/overlays/shared/enemies/blarg_space_commando.c +++ b/src/overlays/shared/enemies/blarg_space_commando.c @@ -105,7 +105,8 @@ extern f32 D_L06_0015F580[] MACRO_ADDR; extern void moby_point_position(struct Moby *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_00258278(struct Moby *, f32, f32 *, f32, f32, f32); -extern s32 FUN_L00_00258b50(struct Moby *, MoveCtl *, void *, void *, f32); +extern s32 move_moby_with_ground_and_collision_checks( + struct Moby *, MoveCtl *, void *, void *, f32) __asm__("FUN_L00_00258b50"); extern void make_hit_descriptor(ShotInfo *, struct Moby *, s32, void *, f32) __asm__("FUN_L00_00259888"); extern void sweep_hit_segment( @@ -265,11 +266,11 @@ void blarg_space_commando_update(struct Moby *moby) { movement_input_or_output_or_melee_origin.f[1] = fast_sin(moby->rot.z) * route_destination_distance; movement_input_or_output_or_melee_origin.f[2] = 0.0f; - FUN_L00_00258b50(moby, - &blarg_commando_state->ctl, - &movement_input_or_output_or_melee_origin, - &movement_output_or_hit_vector_or_path_point, - 1.0f); + move_moby_with_ground_and_collision_checks(moby, + &blarg_commando_state->ctl, + &movement_input_or_output_or_melee_origin, + &movement_output_or_hit_vector_or_path_point, + 1.0f); } break; case BLARG_COMMANDO_STATE_RANGED_ATTACK_WINDUP: @@ -388,11 +389,11 @@ void blarg_space_commando_update(struct Moby *moby) { position_or_movement_vector.f[0] = 2.0f * fast_cos(moby->rot.z); position_or_movement_vector.f[1] = 2.0f * fast_sin(moby->rot.z); position_or_movement_vector.f[2] = 0.0f; - FUN_L00_00258b50(moby, - &blarg_commando_state->ctl, - &position_or_movement_vector, - &movement_input_or_output_or_melee_origin, - 1.0f); + move_moby_with_ground_and_collision_checks(moby, + &blarg_commando_state->ctl, + &position_or_movement_vector, + &movement_input_or_output_or_melee_origin, + 1.0f); resolve_point_path_segment_xy_clearance( blarg_commando_state->path, &moby->pos, &moby->pos, 0.75f); if (path_8808(blarg_commando_state->path, @@ -462,11 +463,11 @@ void blarg_space_commando_update(struct Moby *moby) { moby->rot.z, fast_arc_tan(blarg_commando_state->home.f[0] - moby->pos.x, blarg_commando_state->home.f[1] - moby->pos.y)) < 0.7853982f) { - FUN_L00_00258b50(moby, - &blarg_commando_state->ctl, - &position_or_movement_vector, - &movement_input_or_output_or_melee_origin, - 1.0f); + move_moby_with_ground_and_collision_checks(moby, + &blarg_commando_state->ctl, + &position_or_movement_vector, + &movement_input_or_output_or_melee_origin, + 1.0f); resolve_point_path_segment_xy_clearance( blarg_commando_state->path, &moby->pos, &moby->pos, 0.75f); } diff --git a/src/overlays/shared/enemies/gadgebot.c b/src/overlays/shared/enemies/gadgebot.c index 4c5cf7a4a4..da93d6832f 100644 --- a/src/overlays/shared/enemies/gadgebot.c +++ b/src/overlays/shared/enemies/gadgebot.c @@ -255,9 +255,10 @@ extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_ extern float fast_add_rotations(float, float); extern float vector_length_xy(void *); extern int coll_sphere(void *, float, int, void *) __asm__("FUN_L00_001f0d60"); -extern int FUN_L00_00258b50(void *, void *, void *, void *, float); -extern int is_moby_in_class_range_500_to_540(void *) __asm__("FUN_L00_0025e3b8"); -extern int test_path_segment_strict_crossing(int, void *, void *) __asm__("FUN_L00_00261968"); +extern int move_moby_with_ground_and_collision_checks( + void *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); +extern int is_moby_in_class_range_500_to_540(void *) __asm__("FUN_L00_0025e3b8"); +extern int test_path_segment_strict_crossing(int, void *, void *) __asm__("FUN_L00_00261968"); extern int trooper_play_sound(int i, int voice_flags, int moby, int k) __asm__("FUN_L00_0028dc90"); extern int compute_clear_path_point_mask(float, int *, int, int, void *) __asm__("FUN_L01_00276a48"); @@ -620,11 +621,11 @@ void gadgebot_update(GbMoby *moby) { gadgebot_vars->ctl.unk24 = frame_time * 3.0f * 1.35f; } if (hero_distance > 0.8f) { - flags = FUN_L00_00258b50(moby, - &gadgebot_vars->ctl, - hero.motion.pos.f, - movement_displacement_output, - 1.0f); + flags = move_moby_with_ground_and_collision_checks(moby, + &gadgebot_vars->ctl, + hero.motion.pos.f, + movement_displacement_output, + 1.0f); } { int ph = ((int)moby >> 8) % 8; @@ -788,11 +789,11 @@ void gadgebot_update(GbMoby *moby) { frame_scale_sq * 0.3f, frame_time * 5.2359877f); gadgebot_vars->ctl.unk24 = frame_time * 4.5f; - if (FUN_L00_00258b50(moby, - &gadgebot_vars->ctl, - gadgebot_vars->target->pos, - movement_displacement_output, - 1.0f) & + if (move_moby_with_ground_and_collision_checks(moby, + &gadgebot_vars->ctl, + gadgebot_vars->target->pos, + movement_displacement_output, + 1.0f) & 0x20) { moby->state = GADGEBOT_STAND_AND_FACE_HERO; *(OvlQuad *)moby->pos = *(OvlQuad *)save0; @@ -901,11 +902,11 @@ void gadgebot_update(GbMoby *moby) { frame_scale_sq * 0.07f, frame_scale_sq * 0.3f, frame_time * 5.2359877f); - if (FUN_L00_00258b50(moby, - &gadgebot_vars->ctl, - vector_and_hit_scratch, - movement_displacement_output, - 1.0f) & + if (move_moby_with_ground_and_collision_checks(moby, + &gadgebot_vars->ctl, + vector_and_hit_scratch, + movement_displacement_output, + 1.0f) & 0x20) { moby->state = GADGEBOT_STAND_AND_FACE_HERO; *(OvlQuad *)moby->pos = *(OvlQuad *)save0; @@ -1021,7 +1022,8 @@ void gadgebot_update(GbMoby *moby) { saved_control_f24 = gadgebot_vars->ctl.unk24; gadgebot_vars->ctl.unk10 = 0.0f; gadgebot_vars->ctl.unk24 = 0.0f; - FUN_L00_00258b50(moby, &gadgebot_vars->ctl, moby->pos, movement_displacement_output, 1.0f); + move_moby_with_ground_and_collision_checks( + moby, &gadgebot_vars->ctl, moby->pos, movement_displacement_output, 1.0f); gadgebot_vars->ctl.unk10 = saved_control_f10; gadgebot_vars->ctl.unk24 = saved_control_f24; moby->pos[2] = vector_and_hit_scratch[2]; diff --git a/src/overlays/shared/enemies/ground_melee_enemy.c b/src/overlays/shared/enemies/ground_melee_enemy.c index fd68ffa342..f2df75b822 100644 --- a/src/overlays/shared/enemies/ground_melee_enemy.c +++ b/src/overlays/shared/enemies/ground_melee_enemy.c @@ -135,7 +135,7 @@ int select_list_point_toward_target(char *a0, void *list, char *pt, char *out) __asm__("FUN_L01_0028b5e0"); -s32 FUN_L00_00258b50(void *m, void *c, void *v, Vec4 *out, f32 f); +s32 move_moby_with_ground_and_collision_checks(void *m, void *c, void *v, Vec4 *out, f32 f) __asm__("FUN_L00_00258b50"); void FUN_L00_00258278(unsigned char *m, float *ptr, float t, float b, float c, float limit); void FUN_L00_0025a120_c(char *o) __asm__("FUN_L00_0025a120"); void FUN_L00_00263ac8_c(float x, int a, int b, unsigned char *p) __asm__("FUN_L00_00263ac8"); diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index 01d4d8bc19..4406aede43 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -138,14 +138,15 @@ void spawn_amoeboid_burst_sparks(unsigned char *moby, f32 *mode) __asm__( extern void spawn_amoeboid_burst_sparks(unsigned char *, float *) __asm__("FUN_L01_002ef770"); extern int follow_path(int *, int, int, float, void *, void *, void *) __asm__("FUN_L01_00276fe8"); extern void FUN_L01_0026d930(void *); -extern void FUN_L00_00258b50(void *, void *, void *, void *, float); -extern int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); -extern int FUN_L00_002dc9f0(void *, void *); -extern int FUN_L00_00257470(void *, int, int); -extern int is_value_within_interpolated_window(float, void *) __asm__("FUN_00214cc8"); -extern int FUN_00214720(void *, int); -extern void FUN_0022da68(int, int, char *); -extern int FUN_00213260(int); +extern void move_moby_with_ground_and_collision_checks( + void *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); +extern int path_8808(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); +extern int FUN_L00_002dc9f0(void *, void *); +extern int FUN_L00_00257470(void *, int, int); +extern int is_value_within_interpolated_window(float, void *) __asm__("FUN_00214cc8"); +extern int FUN_00214720(void *, int); +extern void FUN_0022da68(int, int, char *); +extern int FUN_00213260(int); extern float FUN_00213308(void); extern float frame_time_gp __asm__("D_0015ED6C") MACRO_ADDR; extern float D_0015ED70 MACRO_ADDR; @@ -368,7 +369,7 @@ void large_amoeboid_update(unsigned char *moby) { move[0] = fast_cos(MOBY(moby)->rot.z); move[1] = fast_sin(MOBY(moby)->rot.z); move[2] = 0.0f; - FUN_L00_00258b50( + move_moby_with_ground_and_collision_checks( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); result = large_amoeboid_vars->unk204; if (result != 2 && FUN_00213260(4) == 0) { @@ -412,7 +413,7 @@ void large_amoeboid_update(unsigned char *moby) { move[0] = fast_cos(MOBY(moby)->rot.z); move[1] = fast_sin(MOBY(moby)->rot.z); move[2] = 0.0f; - FUN_L00_00258b50( + move_moby_with_ground_and_collision_checks( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); if (path_8808(large_amoeboid_vars->unk240, &MOBY(moby)->pos, target + 0x10, hit) != 0 && fast_vec_dist(&MOBY(moby)->pos, hit) < 1.5f) @@ -480,7 +481,7 @@ void large_amoeboid_update(unsigned char *moby) { move[1] = fast_sin(MOBY(moby)->rot.z); move[1] += move[1]; move[2] = 0.0f; - FUN_L00_00258b50( + move_moby_with_ground_and_collision_checks( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); } else { large_amoeboid_vars->unk204 = 2; @@ -509,7 +510,7 @@ void large_amoeboid_update(unsigned char *moby) { move[1] = fast_sin(*rotation); move[1] += move[1]; move[2] = 0.0f; - FUN_L00_00258b50( + move_moby_with_ground_and_collision_checks( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); } if (is_value_within_interpolated_window(15.5f, moby) != 0 && @@ -580,7 +581,7 @@ void large_amoeboid_update(unsigned char *moby) { move[1] = fast_sin(MOBY(moby)->rot.z); move[1] += move[1]; move[2] = 0.0f; - FUN_L00_00258b50( + move_moby_with_ground_and_collision_checks( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); } if (large_amoeboid_vars->unk204 != 2 && (MOBY(moby)->state = 4, MOBY(moby)->prev_seq != 1)) diff --git a/src/overlays/shared/math/interpolation/spring_turn.c b/src/overlays/shared/math/interpolation/spring_turn.c index 69ee2c836d..678885a76a 100644 --- a/src/overlays/shared/math/interpolation/spring_turn.c +++ b/src/overlays/shared/math/interpolation/spring_turn.c @@ -468,14 +468,14 @@ extern s32 FUN_L00_002583f0_c(void *, void *, s32, f32, f32) __asm__("FUN_L00_00 extern s32 FUN_L00_00258ad0_c(void *, void *, f32, s32, f32, s32) __asm__("FUN_L00_00258ad0"); extern f32 frame_time_sq_gp __asm__("D_0015ED70") __attribute__((sda)); -s32 FUN_L00_00258b50(Obj *m, Ctl *c, void *v, Vec4 *out, f32 f); +s32 move_moby_with_ground_and_collision_checks(Obj *m, Ctl *c, void *v, Vec4 *out, f32 f) __asm__("FUN_L00_00258b50"); -s32 FUN_L00_00258b50(Obj *moby, - Ctl *movement_control, - void *target_position, - Vec4 *movement_displacement_vector_output, +s32 move_moby_with_ground_and_collision_checks(Obj *moby, + Ctl *movement_control, + void *target_position, + Vec4 *movement_displacement_vector_output, - f32 f) { + f32 f) { Vec4 save; Vec4 displacement; Vec4 probe_or_direction; From 910edccc0f824177043f56eda8f1813839626a2c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 21:30:21 +0000 Subject: [PATCH 033/758] decomp: format recent naming integrations --- src/game/missions/collect_mission_ids.c | 7 ++++--- .../shared/mobys/test_path_segment_strict_crossing.c | 3 ++- src/sdk/ipu/wait_ipu_idle64.c | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/game/missions/collect_mission_ids.c b/src/game/missions/collect_mission_ids.c index 9cc74985fe..76daaaede8 100644 --- a/src/game/missions/collect_mission_ids.c +++ b/src/game/missions/collect_mission_ids.c @@ -43,9 +43,10 @@ int collect_mission_ids(int *mission_ids, int *mask, int *nums, int use_selected if (!(f & 2) && t != 0 && !((f & 1) && t == 2)) { mission_ids[count] = mission_node_cursor->id; if (use_selected_ids != 0) { - mission_ids[count] = (mission_node_cursor->status == MISSION_STATUS_ALL_CONDITIONS_MET) - ? 0x523E - : mission_node_cursor->ids[mission_node_cursor->sel]; + mission_ids[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; 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 08fdd72ae3..8d6d826f2b 100644 --- a/src/overlays/shared/mobys/test_path_segment_strict_crossing.c +++ b/src/overlays/shared/mobys/test_path_segment_strict_crossing.c @@ -588,7 +588,8 @@ void update_joint_animation( if (!previous_moby) { *(void **)(joint_animation_state + 0x78) = moby; } else if (previous_moby != moby) { - if (joint_animation_state[1] && MOBY(previous_moby)->state < JOINT_ANIMATION_PREVIOUS_OWNER_DETACH_STATE_LIMIT) + if (joint_animation_state[1] && + MOBY(previous_moby)->state < JOINT_ANIMATION_PREVIOUS_OWNER_DETACH_STATE_LIMIT) detach_manipulator(previous_moby, joint_animation_state); joint_animation_state[1] = 0; *(void **)(joint_animation_state + 0x78) = moby; diff --git a/src/sdk/ipu/wait_ipu_idle64.c b/src/sdk/ipu/wait_ipu_idle64.c index 9d05a27424..6e20586660 100644 --- a/src/sdk/ipu/wait_ipu_idle64.c +++ b/src/sdk/ipu/wait_ipu_idle64.c @@ -21,7 +21,8 @@ s64 _waitIpuIdle64(s32 *ctx) { count++; } status = *((volatile s64 *)0x10002000); - } while ((status < IPU_CMD_IDLE_THRESHOLD) && (((*((volatile u32 *)0x10002010)) & 0x4000) == 0)); + } while ((status < IPU_CMD_IDLE_THRESHOLD) && + (((*((volatile u32 *)0x10002010)) & 0x4000) == 0)); } } return status; From d4a71bf9f66450005a20f2e8ddb5c9c4465bddab Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:18:46 +0000 Subject: [PATCH 034/758] overlay: name select_kerwan_path_enemy_next_node --- src/overlays/l03/mobys/kerwan_path_enemy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/overlays/l03/mobys/kerwan_path_enemy.c b/src/overlays/l03/mobys/kerwan_path_enemy.c index a0e6ad1fbc..2a8d411c3c 100644 --- a/src/overlays/l03/mobys/kerwan_path_enemy.c +++ b/src/overlays/l03/mobys/kerwan_path_enemy.c @@ -1651,7 +1651,9 @@ extern int select_moby_target_with_hero_fallback(char *, char *, float) __asm__( /* Picks the path node to head for next: walks the path ring from the start and keeps the node best aligned * with the target direction, else the one nearest the target (but at least 16 units away). */ -void FUN_L03_002c9ca0(Moby2C8398 *moby) { +void select_kerwan_path_enemy_next_node(Moby2C8398 *moby) __asm__("FUN_L03_002c9ca0"); + +void select_kerwan_path_enemy_next_node(Moby2C8398 *moby) { Tgt2C8398 target; float near[4]; float pt[4]; From 494632bd6b79718e865c7be299db0af02cfa26a2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:24:23 +0000 Subject: [PATCH 035/758] overlay: name compute_follow_camera_focus_velocity --- src/overlays/shared/camera/follow_camera_springs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/camera/follow_camera_springs.c b/src/overlays/shared/camera/follow_camera_springs.c index 70daee4200..3d10abe798 100644 --- a/src/overlays/shared/camera/follow_camera_springs.c +++ b/src/overlays/shared/camera/follow_camera_springs.c @@ -1083,7 +1083,9 @@ void FUN_L00_002e4930(char *camera) { /* per-frame state machine that eases a moby's attach pose toward the camera block's vector */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002E1660.c: func_L00_002E6498), where it is exact; names translated to the US level program. */ -void FUN_L00_002e4fe8(char *camera, float *out_focus_velocity) { +void compute_follow_camera_focus_velocity(char *camera, float *out_focus_velocity) __asm__("FUN_L00_002e4fe8"); + +void compute_follow_camera_focus_velocity(char *camera, float *out_focus_velocity) { float hero_position[4]; float target_position_or_up_offset[4]; char *camera_state; From e0017d17dd23688b75c7b359bc014ca4fd513c00 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:24:24 +0000 Subject: [PATCH 036/758] decomp: clarify names in hero_set_state b -> animation_request_mode: b -> animation_request_mode: Authoritative hero_set_state(int requested_state, int b) uses b to gate optional state-entry animations and treats 2 as the admission override. Retail 0x0024cf40 saves a1 in s5; 0x0024cf50-0x0024cf78 compares that same s5 with 2 in the death-control and game-mode refusal guards. At 0x0024d180, s5==0 skips idle animation selection; 0x0024d2c0 similarly skips dying animation, and 0x0024ff18 skips jump animation selection. Original retail Ghidra param_2 follows these exact tests. The integer therefore represents the animation request mode, with zero suppressing conditional entry animation and two additionally overriding the admission guards; it is not a boolean or animation ID. --- src/overlays/l05/hero/hero_set_state.c | 134 ++++++++++++------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/src/overlays/l05/hero/hero_set_state.c b/src/overlays/l05/hero/hero_set_state.c index 73fd29270e..0bd9214217 100644 --- a/src/overlays/l05/hero/hero_set_state.c +++ b/src/overlays/l05/hero/hero_set_state.c @@ -81,17 +81,17 @@ extern void draw_hud_timer(void) __asm__("FUN_L05_00266710"); extern int hero_set_state(int, int) __asm__("FUN_L05_0024cee8"); extern char level05_hero_water_surface_jump_velocity_keys[] __asm__("D_L05_0017C3C0"); -int hero_set_state(int requested_state, int b) { +int hero_set_state(int requested_state, int animation_request_mode) { int saved_state_step; char *moby; int old20A7; { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || b != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_request_mode != 2)) return 0; } - if ((D_L05_0015F5C4 == 2 || D_L05_0015F5C4 == 6) && b != 2) + if ((D_L05_0015F5C4 == 2 || D_L05_0015F5C4 == 6) && animation_request_mode != 2) return 0; { struct Hero *p = &hero; @@ -163,7 +163,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; q->rand_timer.range = 0x68; } - if (b) { + if (animation_request_mode) { if (get_hero_idle_animation_index(0) == 0x54) { set_hero_animation( get_hero_idle_animation_index(0), 0, (float)scale_game_frames(0x12)); @@ -179,7 +179,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; clear_u64_value(&p->motion.momentum); p->rand_timer.range = 0x68; - if (b) { + if (animation_request_mode) { if (get_hero_idle_animation_index(0) == 0x54) { set_hero_animation( get_hero_idle_animation_index(0), 0, (float)scale_game_frames(0x12)); @@ -205,7 +205,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_request_mode) set_hero_animation(0x45, 0, (float)scale_game_frames(0xC)); break; } @@ -216,7 +216,7 @@ int hero_set_state(int requested_state, int b) { p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); FUN_L00_0025f730(&p->motion.momentum, frame_time * 3.5f); - if (b) + if (animation_request_mode) set_hero_animation(0x7C, 0, (float)scale_game_frames(0xC)); break; } @@ -232,7 +232,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->unk6A0 = 0; p->unk690 = p->motion.pos.f[2] - p->unk69C; - if (b) + if (animation_request_mode) set_hero_animation(0x74, 0, (float)scale_game_frames(0xB)); break; } @@ -254,7 +254,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->unk8E0 = 0; n = scale_game_frames(0xC); - if (b) + if (animation_request_mode) set_hero_animation(0x3B, 0, (float)n); } break; @@ -275,7 +275,7 @@ int hero_set_state(int requested_state, int b) { n = scale_game_frames(0xB); if (p->state.prev == 0x33) n = scale_game_frames(0xF); - if (b) + if (animation_request_mode) set_hero_animation(0x3D, 0, (float)n); break; } @@ -292,7 +292,7 @@ int hero_set_state(int requested_state, int b) { t = -2; if (p->state.prev != 0x35) t = n; - if (b) + if (animation_request_mode) set_hero_animation(0x3C, 0, (float)t); break; } @@ -365,7 +365,7 @@ int hero_set_state(int requested_state, int b) { s->motion.momentum.f[2] = 0.0f; FUN_L00_0025f730(&s->motion.momentum, frame_time * 5.5f); s->rand_timer.range = 0x68; - if (b) + if (animation_request_mode) set_hero_animation(0x3A, 0, (float)scale_game_frames(0x16)); } break; @@ -389,7 +389,7 @@ int hero_set_state(int requested_state, int b) { int t = scale_game_frames(0x4D); struct Hero *q = &hero; q->invulnerable_frames = t; - if (b) { + if (animation_request_mode) { if (q->state.current == 0x75) { set_hero_animation(0x70, 3, -3.0f); } else { @@ -413,7 +413,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->drown_sink_speed = 0; p->unk698 = scale_game_frames(0x2D); p->rand_timer.range = 0x68; - if (b) + if (animation_request_mode) set_hero_animation(0x65, 0, (float)scale_game_frames(0x11)); break; } @@ -453,7 +453,7 @@ int hero_set_state(int requested_state, int b) { v = (char *)&hero.motion.momentum; qcopy(v, v - 0x40); } - if (b) + if (animation_request_mode) set_hero_animation(0x5F, 0, (float)scale_game_frames(0xA)); break; } @@ -464,7 +464,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_request_mode) set_hero_animation(0x80, 0, (float)scale_game_frames(0xA)); break; } @@ -541,7 +541,7 @@ int hero_set_state(int requested_state, int b) { q->board_vertical_speed = -fast_vec_dot(&q->gravity_dir, &q->motion.displacement); } } - if (b) { + if (animation_request_mode) { struct Hero *t = &hero; if (t->race_ammo != 0) { set_hero_animation(0x7D, 0, (float)scale_game_frames(5)); @@ -557,7 +557,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 8; p->item_select_blocked = 1; p->unk870 = 0; - if (b) + if (animation_request_mode) set_hero_animation( select_hero_hoverboard_animation_variant(), 5, (float)scale_game_frames(8)); break; @@ -610,7 +610,7 @@ int hero_set_state(int requested_state, int b) { gravity_flatten((float *)w, (float *)w); FUN_L00_0025f730(w, frame_time * 9.5f); *(int *)(hero_velocity_bytes + 0xF18) = 0x68; - if (b) + if (animation_request_mode) set_hero_animation(0x3A, 0, (float)scale_game_frames(0x11)); } break; @@ -622,7 +622,7 @@ int hero_set_state(int requested_state, int b) { release_and_clear_hero_voice_slots(); p->boost_pad_timer = 0; p->rand_timer.range = 0x68; - if (b) + if (animation_request_mode) set_hero_animation(0x62, 4, (float)scale_game_frames(4)); break; } @@ -630,7 +630,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (animation_request_mode) set_hero_animation(0x46, 0, (float)scale_game_frames(8)); break; } @@ -638,7 +638,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (animation_request_mode) set_hero_animation(0x47, 0, (float)scale_game_frames(8)); break; } @@ -646,7 +646,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (animation_request_mode) set_hero_animation(0x48, 0, (float)scale_game_frames(8)); break; } @@ -658,7 +658,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&D_L05_0015F688 = scale_game_frames(0x3C); if (p->unk20AA == 0) { t = get_hero_idle_animation_index(1); - if (p->moby->prev_seq != t && b) { + if (p->moby->prev_seq != t && animation_request_mode) { set_hero_animation(t, 0, (float)scale_game_frames(0x12)); } } @@ -747,7 +747,7 @@ int hero_set_state(int requested_state, int b) { scale_game_frames(5) < u->rail_land_frames) n = scale_game_frames(0xD); } - if (b) { + if (animation_request_mode) { struct Hero *v = &hero; set_hero_animation(v->state.step + 3, D_L05_0015F6E8[v->state.step], (float)n); } @@ -763,7 +763,7 @@ int hero_set_state(int requested_state, int b) { p->item_use_locked = 1; if (p->vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) cancel_hero_item_animation(); - if (b) { + if (animation_request_mode) { if (p->vehicle_mode == 3) { set_hero_animation(1, 0, (float)scale_game_frames(8)); } else if (p->vehicle_mode == HERO_VEHICLE_MODE_CLANK) { @@ -782,7 +782,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; fill_transfer_words((char *)p + 0x9D0, 0, 0x20); qcopy(&p->motion.momentum, &p->motion.displacement); - if (b) + if (animation_request_mode) set_hero_animation(0x64, 0, (float)scale_game_frames(0xF)); break; } @@ -804,7 +804,7 @@ int hero_set_state(int requested_state, int b) { } return 0; } - if (b) { + if (animation_request_mode) { struct Hero *q = &hero; float d = q->anim_frame; int id = 6; @@ -821,7 +821,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.momentum, v); - if (b) { + if (animation_request_mode) { int id = 6; float d = p->anim_frame; if (return_hero_animation_id_unchanged(MOBY(moby)->seq) == 4 && 3.0f < d && d < 16.0f) @@ -848,7 +848,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&q->motion.momentum, frame_time * 7.0f); if (frame_time * 3.5f < q->motion.forward_speed) allocate_hero_voice_for_entry(0xC, 0); - if (b) { + if (animation_request_mode) { if (q->moby->seq == get_hero_idle_animation_index(0)) { set_hero_animation(0xD, 2, (float)scale_game_frames(9)); } else { @@ -875,7 +875,7 @@ int hero_set_state(int requested_state, int b) { } p->motion.move_yaw = fast_arc_tan(p->grapple_target->pos.x - p->motion.pos.f[0], p->grapple_target->pos.y - p->motion.pos.f[1]); - if (b) { + if (animation_request_mode) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); hero_queue_sequence(0xA, 0xE); } @@ -888,7 +888,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->item_use_locked = 1; - if (b) + if (animation_request_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(0xA)); break; } @@ -900,7 +900,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->tether_radius = fast_vec_dist(&p->motion.pos, &p->grapple_target->pos); - if (b) + if (animation_request_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(5)); break; } @@ -956,7 +956,7 @@ int hero_set_state(int requested_state, int b) { } else if (q->state.prev_control_mode == 2) { q->swing_gravity = q->fall_state_gravity; } - if (b) { + if (animation_request_mode) { set_hero_animation(0x34, 0, (float)scale_game_frames(0xB)); { struct Hero *r = &hero; @@ -972,7 +972,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 7; clear_u64_value(&p->motion.rot_spring_vel); qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_request_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xF)); break; } @@ -984,7 +984,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->past_apex = 0; p->rise_fall_land_frames = 0; p->rise_fall_gravity = frame_time_sq * 100.0f; - if (b) + if (animation_request_mode) set_hero_animation(0x2A, 0, (float)scale_game_frames(6)); break; } @@ -999,7 +999,7 @@ int hero_set_state(int requested_state, int b) { p->unk4F0 = p->smoothed_ground_z; } p->item_select_blocked = 1; - if (b) { + if (animation_request_mode) { if (frame_time * 3.5f < p->motion.flat_speed) { set_hero_animation(0x20, 0, (float)scale_game_frames(9)); } else { @@ -1014,7 +1014,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0xD; p->item_select_blocked = 1; p->rand_timer.range = 0x68; - if (b) + if (animation_request_mode) set_hero_animation(0x21, 0, (float)scale_game_frames(6)); break; } @@ -1023,7 +1023,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (animation_request_mode) set_hero_animation(0x24, 0, (float)scale_game_frames(6)); break; } @@ -1032,7 +1032,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (animation_request_mode) set_hero_animation(0x25, 0, (float)scale_game_frames(6)); break; } @@ -1041,7 +1041,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_request_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xC)); break; } @@ -1065,7 +1065,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->state.step = 0; qcopy(&q->motion.velocity, &q->motion.resolved_velocity); - if (b) { + if (animation_request_mode) { if (q->vehicle_mode == 3) { set_hero_animation(6, 0, (float)scale_game_frames(8)); return 1; @@ -1091,7 +1091,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) { + if (animation_request_mode) { set_hero_animation(0x13, 0, (float)animation_timing_parameter); } break; @@ -1106,7 +1106,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.displacement); - if (b) { + if (animation_request_mode) { set_hero_animation(0x13, 0, (float)animation_timing_setting); } break; @@ -1472,7 +1472,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (q->fall_start_distance == 0.0f) q->fall_start_distance = q->unk430 * 1.5f; - if (b) { + if (animation_request_mode) { int s = q->state.current; if (s == 7) { set_hero_animation(7, 0, (float)scale_game_frames(5)); @@ -1566,7 +1566,7 @@ int hero_set_state(int requested_state, int b) { update_hero_target_heading(8.0f, 1.0471976f, -1.0f); *(int *)&q->slam_descending = 0; q->items[0].timer = 0xA; - if (b) { + if (animation_request_mode) { char *m; int n = scale_game_frames(0xB); if (q->state.prev == 0xB && scale_game_frames(0x2A) > q->state.prev_timer) @@ -1603,7 +1603,7 @@ int hero_set_state(int requested_state, int b) { q->saved_item[0] = 0; update_hero_target_heading(14.0f, 0.5235988f, -1.0f); q->unkA7C = q->unkA7C == 0; - if (b) { + if (animation_request_mode) { int n = scale_game_frames(0xA); if (q->moby->prev_seq == 0x1A) n = scale_game_frames(3); @@ -1618,7 +1618,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (((void *)q->items[0].moby) == 0) break; - if (b) { + if (animation_request_mode) { set_hero_animation(0x67, 4, -1.0f); blend_moby_animation(((void *)q->items[0].moby), 3, 4, -1); } @@ -1649,7 +1649,7 @@ int hero_set_state(int requested_state, int b) { r->attack_record = k; } update_hero_target_heading(5.0f, 0.7853982f, 0.7853982f); - if (b) { + if (animation_request_mode) { char *m; int j = 0; int n; @@ -1680,7 +1680,7 @@ int hero_set_state(int requested_state, int b) { } case HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL: { struct Hero *q; - if (b) + if (animation_request_mode) set_hero_animation(0x2C, 7, (float)scale_game_frames(9)); q = &hero; if (q->items[0].item_id == 0xA && ((char *)q->throw_target) != 0) { @@ -1699,7 +1699,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0xA; p->unk2284 = 0; p->ground_speed = frame_time * 9.0f; - if (b) { + if (animation_request_mode) { char *m; HeroTableRow2C *e = &D_L05_0017C088[p->attack_record]; int k = e->kind; @@ -1720,7 +1720,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->pushback_yaw = fast_add_rotations(p->motion.rot.f[2], 3.1415927f); p->ground_speed = frame_time * 9.0f; - if (b) + if (animation_request_mode) set_hero_animation(0x29, 5, (float)scale_game_frames(8)); break; } @@ -1742,7 +1742,7 @@ int hero_set_state(int requested_state, int b) { { struct Hero *q = &hero; q->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (animation_request_mode) { set_hero_animation(0x10, 3, -3.0f); q->moby->anim_time = level05_hero_animation_blend_curves[q->anim_blend_curve] [(q->anim_blend_step)++]; @@ -1767,7 +1767,7 @@ int hero_set_state(int requested_state, int b) { r->rand_timer.range = 0x68; r->target_speed = 0.0f; r->ground_speed = 0.0f; - if (b) + if (animation_request_mode) set_hero_animation(0x71, 0, (float)scale_game_frames(8)); } break; @@ -1781,7 +1781,7 @@ int hero_set_state(int requested_state, int b) { p->collision_off_frames = 0x2710; allocate_hero_voice_for_entry(9, 0); p->rand_timer.range = 0x68; - if (b) + if (animation_request_mode) set_hero_animation(0x71, 0, (float)scale_game_frames(8)); break; } @@ -1807,7 +1807,7 @@ int hero_set_state(int requested_state, int b) { p->collision_off_frames = 0x2710; p->sink_surface_z = p->ground_z.f; allocate_hero_voice_for_entry(9, 0); - if (b) + if (animation_request_mode) set_hero_animation(0x71, 0, (float)scale_game_frames(8)); } break; @@ -1816,7 +1816,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) + if (animation_request_mode) set_hero_animation(0, 0, (float)scale_game_frames(0xE)); break; } @@ -1824,7 +1824,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) { + if (animation_request_mode) { set_hero_animation(4, 0, (float)scale_game_frames(7)); hero_queue_sequence(0xE, 0x22); } @@ -1835,7 +1835,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_request_mode) set_hero_animation(6, 0, (float)scale_game_frames(0xC)); break; } @@ -1846,7 +1846,7 @@ int hero_set_state(int requested_state, int b) { p->fall_state_gravity = frame_time_sq * 24.0f; p->stickless_decel = frame_time_sq * 7.0f; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_request_mode) set_hero_animation(6, 0, (float)scale_game_frames(7)); break; } @@ -1863,7 +1863,7 @@ int hero_set_state(int requested_state, int b) { if (frame_time * 1.5f < planar_speed) hero_base->ground_speed = frame_time * 1.5f; hero_base->unk3B8 = 0; - if (b) + if (animation_request_mode) set_hero_animation(1, 0, (float)scale_game_frames(8)); } break; @@ -1873,7 +1873,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_request_mode) set_hero_animation(3, 0, (float)scale_game_frames(0xC)); break; } @@ -1886,7 +1886,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&p->motion.velocity, frame_time * 5.0f); hero_change_health(1); p->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (animation_request_mode) { set_hero_animation(2, 3, -3.0f); p->moby->anim_time = level05_hero_animation_blend_curves[p->anim_blend_curve][(p->anim_blend_step)++]; @@ -1907,7 +1907,7 @@ int hero_set_state(int requested_state, int b) { clear_u64_value(&p->motion.velocity); clear_u64_value(&p->motion.displacement); p->motion.velocity.f[2] = frame_time * 10.0f; - if (b) + if (animation_request_mode) set_hero_animation(0x10, 2, -3.0f); break; } @@ -1959,7 +1959,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->tilt_disabled = 1; p->item_use_locked = 1; - if (b) + if (animation_request_mode) set_hero_animation(get_hero_idle_animation_index(0), 0, -1.0f); break; } @@ -1970,7 +1970,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->item_use_locked = 1; clear_u64_value(&p->motion.velocity); - if (b) + if (animation_request_mode) set_hero_animation(0xB, 0, -1.0f); break; } @@ -1980,7 +1980,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x18; p->item_use_locked = 1; cancel_hero_item_animation(); - if (b) + if (animation_request_mode) set_hero_animation(get_hero_idle_animation_index(0), 0, -1.0f); break; } From 3d45b602e992c3ed08c18d7ad58eb93097c022f5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:24:30 +0000 Subject: [PATCH 037/758] overlay: name advance_spring_axis_toward_target --- src/overlays/l01/mobys/water_lily.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/overlays/l01/mobys/water_lily.c b/src/overlays/l01/mobys/water_lily.c index faaaccd92d..e209e210f8 100644 --- a/src/overlays/l01/mobys/water_lily.c +++ b/src/overlays/l01/mobys/water_lily.c @@ -18,7 +18,15 @@ void move_moby_xy_with_collision_constraints( extern f32 frame_time_macro __asm__("D_0015ED6C") MACRO_ADDR; -f32 FUN_L01_002f81c8(f32 *spring_axis_position, +f32 advance_spring_axis_toward_target(f32 *spring_axis_position, + f32 *spring_axis_velocity, + f32 target, + f32 velocity_adjustment_scale, + f32 damp, + + f32 range) __asm__("FUN_L01_002f81c8"); + +f32 advance_spring_axis_toward_target(f32 *spring_axis_position, f32 *spring_axis_velocity, f32 target, f32 velocity_adjustment_scale, From 9a1329f3f57420ca2937ce29cba0099c3b111a06 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:26:37 +0000 Subject: [PATCH 038/758] overlay: name compute_lift_camera_view --- src/overlays/l05/mobys/elevator_with_button.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/overlays/l05/mobys/elevator_with_button.c b/src/overlays/l05/mobys/elevator_with_button.c index 143e365aae..e1fb9afbf6 100644 --- a/src/overlays/l05/mobys/elevator_with_button.c +++ b/src/overlays/l05/mobys/elevator_with_button.c @@ -263,7 +263,9 @@ extern short lift_camera_height_offset_gp __asm__("D_L05_00161EC0") __attribute_ extern short lift_camera_pitch_degrees_gp __asm__("D_L05_00161EC4") __attribute__((sda)); extern short lift_camera_distance_along_facing_gp __asm__("D_L05_00161EC8") __attribute__((sda)); -void FUN_L05_00315ee0(char *lift_moby, char *camera_position, char *camera_rotation) { +void compute_lift_camera_view(char *lift_moby, char *camera_position, char *camera_rotation) __asm__("FUN_L05_00315ee0"); + +void compute_lift_camera_view(char *lift_moby, char *camera_position, char *camera_rotation) { float pitch_degrees; fast_vec_normalize( camera_position, lift_moby + 0xC0, *(float *)&lift_camera_distance_along_facing_gp); From 7aa7840add92f6d7e765f82217a77dd1dcd3854f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:26:52 +0000 Subject: [PATCH 039/758] decomp: clarify names in draw_walloper_arc_and_quad_effects D_L00_001DBBA0 -> l00_walloper_arcs: Retail 0x002bbb24 initializes s3 to 0x001dbba0; 0x002bbb70 passes s3 as a0 to draw_walloper_arc_two_pass_quads at 0x002bbb84 with point_count=5 at 0x002bbb88. Each iteration advances s3 by 0x50 (0x002bbb48/0x002bbb8c), matching SparkleArc[10], each containing five float[4] points. Authoritative walloper_update writes point[0] from arc_origin and points[1..4] from bent arc steps, proving this is the L00 walloper arc record array. D_L00_001DBEC0 -> l00_walloper_arc_update_countdowns: Retail 0x002bbb34 initializes s1 to 0x001dbec0; lh at 0x002bbb40 and zero branch at 0x002bbb44 gate drawing the corresponding arc, with a two-byte increment at 0x002bbb9c. Authoritative walloper_update initializes each short to zero, decrements it once per processed update and clamps negatives to zero; when zero and effects are enabled it resets it to 2 and regenerates that arc. This proves per-arc update countdowns, rather than a boolean activity array. D_L00_001DBED8 -> l00_walloper_arc_base_alphas: Retail 0x002bbb2c initializes s2 to 0x001dbed8, 0x002bbb50 loads its signed halfword, and 0x002bbb4c-0x002bbb60 convert and multiply it by the effect scalar at 0x001616d4. The converted result is copied into both a1 and a2 at 0x002bbb64/0x002bbb80 for the two-pass arc renderer, whose supplied source shifts these alpha arguments into vertex-color high bytes. Authoritative walloper_update writes 0x40 on arc regeneration, 0x20 on the remaining active update and zero otherwise; this proves the per-arc alpha values before effect scaling. --- src/overlays/shared/weapons/walloper.c | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/overlays/shared/weapons/walloper.c b/src/overlays/shared/weapons/walloper.c index 790769c148..029fda6a8c 100644 --- a/src/overlays/shared/weapons/walloper.c +++ b/src/overlays/shared/weapons/walloper.c @@ -104,7 +104,7 @@ extern unsigned int l00_walloper_quad_rare_base_vertex_color __asm__("D_L00_0016 __attribute__((sda)); extern V_2bc1a0 D_L00_001DBB60[] NOT_SDA; -SparkleArc D_L00_001DBBA0[10] = {0}; +SparkleArc l00_walloper_arcs[10] __asm__("D_L00_001DBBA0") = {0}; SparkleArc D_L01_001DC020[10] = {0}; @@ -142,7 +142,7 @@ SparkleArc D_L17_001D0D20[10] = {0}; SparkleArc D_L18_001D0A20[10] = {0}; -short D_L00_001DBED8[10] = {0}; +short l00_walloper_arc_base_alphas[10] __asm__("D_L00_001DBED8") = {0}; short D_L01_001DC358[10] = {0}; @@ -180,7 +180,7 @@ short D_L17_001D1058[10] = {0}; short D_L18_001D0D58[10] = {0}; -short D_L00_001DBEC0[10] = {0}; +short l00_walloper_arc_update_countdowns[10] __asm__("D_L00_001DBEC0") = {0}; short D_L01_001DC340[10] = {0}; @@ -750,7 +750,7 @@ void walloper_update(char *walloper_moby) { case WALLOPER_STATE_INITIALIZE: MOBY(walloper_moby)->state = WALLOPER_STATE_ANIMATION_DRIVEN_EFFECTS; for (arc_init_index = 0; arc_init_index < 10; arc_init_index++) { - D_L00_001DBEC0[arc_init_index] = 0; + l00_walloper_arc_update_countdowns[arc_init_index] = 0; D_L00_001DBEF0[arc_init_index] = 2; D_L00_001DBF08[arc_init_index] = 1; } @@ -792,7 +792,7 @@ void walloper_update(char *walloper_moby) { fast_vec_add(arc_origin, arc_origin, &MOBY(walloper_moby)->pos); any = 0; for (j = 0; j < 10; j++) { - if (D_L00_001DBEC0[j] != 0) { + if (l00_walloper_arc_update_countdowns[j] != 0) { any = 1; break; } @@ -800,19 +800,19 @@ void walloper_update(char *walloper_moby) { if (!flag && !any) return; for (i = 0; i < 10; i = next_arc_index) { - D_L00_001DBEC0[i]--; - if (D_L00_001DBEC0[i] < 0) - D_L00_001DBEC0[i] = 0; - if (D_L00_001DBEC0[i] == 0) { + l00_walloper_arc_update_countdowns[i]--; + if (l00_walloper_arc_update_countdowns[i] < 0) + l00_walloper_arc_update_countdowns[i] = 0; + if (l00_walloper_arc_update_countdowns[i] == 0) { if (flag) { float sign; int k; - D_L00_001DBEC0[i] = 2; - D_L00_001DBED8[i] = 0x40; + l00_walloper_arc_update_countdowns[i] = 2; + l00_walloper_arc_base_alphas[i] = 0x40; random_spherical_offset(arc_step, l00_walloper_arc_step_sample_bound, l00_walloper_arc_step_sample_bound); - qcopy(D_L00_001DBBA0[i].point[0], arc_origin); + qcopy(l00_walloper_arcs[i].point[0], arc_origin); next_arc_index = i + 1; sign = 1.0f; for (k = 1; k < 5; k++) { @@ -823,7 +823,7 @@ void walloper_update(char *walloper_moby) { bend_angle = random_float_between(0.17453292f, 0.7853982f) * sign; sign = -sign; build_look_at_matrix(arc_step, arc_step, arc_point_camera_offset, bend_angle); - fast_vec_add(D_L00_001DBBA0[i].point[k], + fast_vec_add(l00_walloper_arcs[i].point[k], l00_walloper_arc_predecessor_rows[i].point[k - 1], arc_step); } @@ -836,23 +836,23 @@ void walloper_update(char *walloper_moby) { for (k = 1; k < 5; k++) { float *point_offset = workspace[k]; fast_vec_sub(point_offset, - D_L00_001DBBA0[i].point[k], + l00_walloper_arcs[i].point[k], l00_walloper_arc_predecessor_rows[i].point[k - 1]); point_offset[0] += randf_sym(0.0f, 0.1f); point_offset[1] += randf_sym(0.0f, 0.1f); point_offset[2] += randf_sym(0.0f, 0.1f); } next_arc_index = i + 1; - qcopy(D_L00_001DBBA0[i].point[0], arc_origin); + qcopy(l00_walloper_arcs[i].point[0], arc_origin); for (k = 1; k < 5; k++) { - fast_vec_add(D_L00_001DBBA0[i].point[k], + fast_vec_add(l00_walloper_arcs[i].point[k], l00_walloper_arc_predecessor_rows[i].point[k - 1], workspace[k]); } - if (D_L00_001DBEC0[i] > 0) - D_L00_001DBED8[i] = 0x20; + if (l00_walloper_arc_update_countdowns[i] > 0) + l00_walloper_arc_base_alphas[i] = 0x20; else - D_L00_001DBED8[i] = 0; + l00_walloper_arc_base_alphas[i] = 0; } } add_draw_callback(FUN_L00_002bbb00_c, walloper_moby); @@ -864,10 +864,10 @@ void draw_walloper_arc_and_quad_effects(void *moby) { s32 i; s32 arc_alpha; for (i = 0; i < 10; i++) { - if (D_L00_001DBEC0[i] != 0) { - arc_alpha = truncate_float_to_s32(convert_integer_to_float(D_L00_001DBED8[i]) * + if (l00_walloper_arc_update_countdowns[i] != 0) { + arc_alpha = truncate_float_to_s32(convert_integer_to_float(l00_walloper_arc_base_alphas[i]) * D_L00_00161660_f[29]); - draw_walloper_arc_two_pass_quads(&D_L00_001DBBA0[i], + draw_walloper_arc_two_pass_quads(&l00_walloper_arcs[i], arc_alpha, arc_alpha, 5, From 5e8487750b5dab9e1be37cf18fefa235980ddc56 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:27:03 +0000 Subject: [PATCH 040/758] decomp: clarify names in reset_smoke_fire_spawner_particle D_L00_001D5740 -> l00_smoke_fire_particle_fade_in_timers: Owned declaration is s16[1200]. Retail reset 0x002d7ccc loads duration from 0x00161380; 0x002d7cd0 shifts the particle index by one and 0x002d7cdc-0x002d7cec stores it at 0x001d5740+i*2. Checked retail drawing caller 0x002d7824-0x002d7838 selects/tests this signed halfword, and 0x002d7840 passes its address to the timer decrement helper. At 0x002d7848-0x002d7870 the remaining count produces alpha=(1-remaining*D_L00_00161384)*D_L00_0016199C. This rising-alpha countdown is the per-particle fade-in timer, distinct from the following fade-out timer at 0x001d60a0. Source initialization clears it after reset to skip initial fade-in. --- .../shared/props/particle_spawner_smoke_fire.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/props/particle_spawner_smoke_fire.c b/src/overlays/shared/props/particle_spawner_smoke_fire.c index d84d709aeb..4cf75c98df 100644 --- a/src/overlays/shared/props/particle_spawner_smoke_fire.c +++ b/src/overlays/shared/props/particle_spawner_smoke_fire.c @@ -133,7 +133,7 @@ V D_L00_001CB7E0[1200] = {0}; u8 D_L00_001D2860[1200] = {0}; -s16 D_L00_001D5740[1200] = {0}; +s16 l00_smoke_fire_particle_fade_in_timers[1200] __asm__("D_L00_001D5740") = {0}; /* Particle pool of 1200 entries, one array per field (more fields below FUN_L00_002d73e8). */ @@ -177,7 +177,7 @@ void particle_spawner_smoke_fire_update(P *spawner) { D_L00_001CB7E0[i].w = 1.0f; D_L00_001D2860[i] = r; reset_smoke_fire_spawner_particle(spawner, i); - D_L00_001D5740[i] = 0; + l00_smoke_fire_particle_fade_in_timers[i] = 0; } j = particle_end_or_emission_index; particle_end_or_emission_index = particle_end_or_emission_index + q->extra; @@ -322,10 +322,10 @@ void draw_smoke_fire_spawner(P *spawner) { draw_geometry_quad(&quad, 0, 0); } } else { - if (D_L00_001D5740[i]) { - fast_dec_timer_s16(&D_L00_001D5740[i]); + if (l00_smoke_fire_particle_fade_in_timers[i]) { + fast_dec_timer_s16(&l00_smoke_fire_particle_fade_in_timers[i]); alpha = truncate_float_to_s32( - (1.0f - convert_integer_to_float(D_L00_001D5740[i]) * D_L00_00161384) * + (1.0f - convert_integer_to_float(l00_smoke_fire_particle_fade_in_timers[i]) * D_L00_00161384) * D_L00_0016199C); } else if (D_L00_001D60A0[i]) { if (fast_dec_timer_s16(&D_L00_001D60A0[i])) { @@ -413,7 +413,7 @@ void reset_smoke_fire_spawner_particle(P *spawner, int i) { D_L00_001D31C0[i] = 0.0f; D_L00_001D4480[i] = random_float_between(*(float *)(spawner_vars + 0x8), *(float *)(spawner_vars + 0xC)); - D_L00_001D5740[i] = D_L00_00161380_2d7bf0; + l00_smoke_fire_particle_fade_in_timers[i] = D_L00_00161380_2d7bf0; D_L00_001D60A0[i] = 0; emitter_particle_index = i - *(s16 *)spawner_vars; D_L00_001D6A00[i] = (emitter_particle_index + 1) * D_L00_0016137C; From acd75417199993d23197ac5e82ce501ca717139e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:27:16 +0000 Subject: [PATCH 041/758] decomp: clarify names in draw_water_reservoir D_L12_00161A0C -> l12_water_reservoir_alpha_a_selector: Source packs this zero-initialized int unshifted into quad.g[3]. Original Ghidra iGpffffae0c and retail lw v1,-0x51f4(gp) at 0x002ecb48, OR chain and sd at 0x002ecb88 prove it supplies the low ALPHA A selector. Checked draw_geometry_quad helper 0x0021fde8 retains the Quad pointer in s2 (0x0021fe94), loads g[3] at +0x88 (0x002201f8), pairs it with GS register address 0x42 (0x002201fc/0x00220208) and stores that packet at 0x00220214. Thus this is the reservoir ALPHA A blend selector, distinct from the globals shifted by 2, 4 and 6. D_L12_00161A14 -> l12_water_reservoir_alpha_c_selector: Source shifts this zero-initialized int left 4 into quad.g[3]. Original Ghidra iGpffffae14 agrees with retail lw a0,-0x51ec(gp) at 0x002ecb58, dsll a0,a0,4 at 0x002ecb68 and OR/store at 0x002ecb70/88. Checked draw_geometry_quad helper reads that word from Quad+0x88 at 0x002201f8, pairs it with GS ALPHA register address 0x42 at 0x002201fc/0x00220208 and emits it at 0x00220214. Bits starting at 4 are the ALPHA C blend-factor selector, proving this distinct level-12 reservoir binding. --- src/overlays/l12/mobys/water_reservoir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l12/mobys/water_reservoir.c b/src/overlays/l12/mobys/water_reservoir.c index 78af1fb49c..f7ec0774e1 100644 --- a/src/overlays/l12/mobys/water_reservoir.c +++ b/src/overlays/l12/mobys/water_reservoir.c @@ -152,8 +152,8 @@ extern float fast_cos(float); extern float fast_sin(float); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); int D_L12_00161A10 = 1; -int D_L12_00161A14 = 0; -int D_L12_00161A0C = 0; +int l12_water_reservoir_alpha_c_selector __asm__("D_L12_00161A14") = 0; +int l12_water_reservoir_alpha_a_selector __asm__("D_L12_00161A0C") = 0; int D_L12_00161A18 = 1; int D_L12_00161A1C = 0x40602020; int D_L12_00161A20 = 0x40681818; @@ -174,7 +174,7 @@ void draw_water_reservoir(struct Moby *moby) { quad.g[1] = get_effect_texture(0x10); quad.g[0] = 0; quad.g[2] = 0xFF9000000260UL; - quad.g[3] = (long)D_L12_00161A0C | ((long)D_L12_00161A10 << 2) | ((long)D_L12_00161A14 << 4) | + quad.g[3] = (long)l12_water_reservoir_alpha_a_selector | ((long)D_L12_00161A10 << 2) | ((long)l12_water_reservoir_alpha_c_selector << 4) | ((long)D_L12_00161A18 << 6) | (0x8000L << 24); col = fast_tween_color( D_L12_00161A1C, D_L12_00161A20, (fast_sin(*(float *)water_reservoir_vars) + 1.0f) * 0.5f); From 2ed6c33f6f251a5711bbe314e4fef73a12e03d9c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:29:28 +0000 Subject: [PATCH 042/758] decomp: clarify names in initialize_pause_menu D_L00_001B3518 -> l00_pause_menu_close_on_action_page_owner: Retail 0x002763C8..0x002763D8 selects Own descriptor 0x001B3518 for entry 10, writes current scene state 11, and 0x00276464 installs its pointer as owner. Checked descriptor bytes at +0x3C equal 11; caller 0x00276F6C..0x00276F70 restores this field as scene state after page transition. Checked update_pause_menu retail 0x002771D0..0x002771F0 converts a nonzero owner-object action to request 1 for scene state 11 (only states 15/16 select request 2); 0x00277278..0x00277288 invokes close_pause_menu. Request 1 follows the shared camera/moby-context restoration at 0x00276CA0..0x00276D1C and bypasses action dispatch 2..7 at 0x00276D18..0x00276E78. Thus close-on-action describes policy, without claiming a menu title. domain_0_value_11 -> PAUSE_MENU_STATE_CLOSE_ON_ACTION: Retail 0x002763C4/0x002763CC writes 11 to GameState.state after entry 10 and selects Own 0x001B3518. Checked update_pause_menu retail 0x002771D0..0x002771F0 converts a nonzero owner-object action to request 1 for scene state 11 (only states 15/16 select request 2); 0x00277278..0x00277288 invokes close_pause_menu. Request 1 follows the shared camera/moby-context restoration at 0x00276CA0..0x00276D1C and bypasses action dispatch 2..7 at 0x00276D18..0x00276E78. Thus close-on-action describes policy, without claiming a menu title. domain_1_value_11 -> PAUSE_MENU_STATE_CLOSE_ON_ACTION: Retail 0x00276480/0x00276498 loads pending_state at GameState+0xF4 and writes it to current scene state; 0x00276494 compares that same value with 11 before selecting small buffers. Checked update_pause_menu retail 0x002771D0..0x002771F0 converts a nonzero owner-object action to request 1 for scene state 11 (only states 15/16 select request 2); 0x00277278..0x00277288 invokes close_pause_menu. Request 1 follows the shared camera/moby-context restoration at 0x00276CA0..0x00276D1C and bypasses action dispatch 2..7 at 0x00276D18..0x00276E78. Thus close-on-action describes policy, without claiming a menu title. domain_2_value_11 -> PAUSE_MENU_STATE_CLOSE_ON_ACTION: Retail 0x00276698..0x002766B0 compares GameState.state with 11 before initialize_render_archive_transfer. Checked update_pause_menu retail 0x002771D0..0x002771F0 converts a nonzero owner-object action to request 1 for scene state 11 (only states 15/16 select request 2); 0x00277278..0x00277288 invokes close_pause_menu. Request 1 follows the shared camera/moby-context restoration at 0x00276CA0..0x00276D1C and bypasses action dispatch 2..7 at 0x00276D18..0x00276E78. Thus close-on-action describes policy, without claiming a menu title. domain_3_value_11 -> PAUSE_MENU_STATE_CLOSE_ON_ACTION: Retail 0x002766C0..0x002766E4 compares GameState.state with 11 before decompression mode 1. Checked update_pause_menu retail 0x002771D0..0x002771F0 converts a nonzero owner-object action to request 1 for scene state 11 (only states 15/16 select request 2); 0x00277278..0x00277288 invokes close_pause_menu. Request 1 follows the shared camera/moby-context restoration at 0x00276CA0..0x00276D1C and bypasses action dispatch 2..7 at 0x00276D18..0x00276E78. Thus close-on-action describes policy, without claiming a menu title. domain_5_value_11 -> PAUSE_MENU_STATE_CLOSE_ON_ACTION: Retail 0x00276720..0x00276758 compares GameState.state with 11 before reserving the texture region. Checked update_pause_menu retail 0x002771D0..0x002771F0 converts a nonzero owner-object action to request 1 for scene state 11 (only states 15/16 select request 2); 0x00277278..0x00277288 invokes close_pause_menu. Request 1 follows the shared camera/moby-context restoration at 0x00276CA0..0x00276D1C and bypasses action dispatch 2..7 at 0x00276D18..0x00276E78. Thus close-on-action describes policy, without claiming a menu title. --- .../shared/ui/menus/initialize_pause_menu.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/ui/menus/initialize_pause_menu.c b/src/overlays/shared/ui/menus/initialize_pause_menu.c index 49bb1ad501..f3d9c09100 100644 --- a/src/overlays/shared/ui/menus/initialize_pause_menu.c +++ b/src/overlays/shared/ui/menus/initialize_pause_menu.c @@ -181,7 +181,7 @@ extern void queue_language_zero_movie(void *) __asm__("FUN_L00_002994f8"); extern void queue_movie_with_game_language(void *) __asm__("FUN_L00_00299560"); extern void start_slideshow(void) __asm__("FUN_L00_00299a68"); extern Own l00_pause_menu_default_page_owner __asm__("D_L00_001B2588"); -extern Own D_L00_001B3518; +extern Own l00_pause_menu_close_on_action_page_owner __asm__("D_L00_001B3518"); extern Own l00_pause_menu_level_transition_on_action_page_owner __asm__("D_L00_001B6088"); extern Own l00_pause_menu_state_preserving_entry_page_owner __asm__("D_L00_001B6B38"); extern Own D_L00_001B86C8; @@ -213,6 +213,9 @@ void initialize_pause_menu(void) { enum { PAUSE_MENU_STATE_LEVEL_TRANSITION_ON_ACTION = 15 }; + enum { + PAUSE_MENU_STATE_CLOSE_ON_ACTION = 11 + }; struct GameState *state = &D_L00_001B9CF0; Own *page; s32 small_buffers = 0; @@ -224,8 +227,8 @@ void initialize_pause_menu(void) { state->unk124 = 0; state->unkD0 = 0; if (state_id == 10) { - D_L00_001B9CF0.state = 11; - page = &D_L00_001B3518; + D_L00_001B9CF0.state = PAUSE_MENU_STATE_CLOSE_ON_ACTION; + page = &l00_pause_menu_close_on_action_page_owner; state->owner = page; state->unk8 = page; small_buffers = 1; @@ -264,7 +267,7 @@ void initialize_pause_menu(void) { D_L00_001B9CF0.unk8 = D_L00_001B9CF0.pending_owner; pending_state = D_L00_001B9CF0.pending_state; D_L00_001B9CF0.state = pending_state; - if (pending_state == 11 || pending_state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ON_ACTION) { + if (pending_state == PAUSE_MENU_STATE_CLOSE_ON_ACTION || pending_state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ON_ACTION) { small_buffers = 1; D_L00_001841F0.w224 = (s32)D_L00_001B9CF0.unkE4; } @@ -334,12 +337,12 @@ void initialize_pause_menu(void) { D_L00_0015F578 = 0x2000; vu1_init_chain(); - if (D_L00_001B9CF0.state == 11 || + if (D_L00_001B9CF0.state == PAUSE_MENU_STATE_CLOSE_ON_ACTION || D_L00_001B9CF0.state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ON_ACTION) { initialize_render_archive_transfer(); } apply_group_entry_adjustment(0); - if (D_L00_001B9CF0.state == 11 || + if (D_L00_001B9CF0.state == PAUSE_MENU_STATE_CLOSE_ON_ACTION || D_L00_001B9CF0.state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ON_ACTION || D_L00_001B9CF0.state == 0x12) { decompress_and_relocate_selected_groups(1); @@ -349,7 +352,7 @@ void initialize_pause_menu(void) { transfer_draw_buffer_chunks(D_L00_001B9CF0.unk10, draw_buffer_address, frame_size << 11); texture_start = gs_texture_allocation_start; D_L00_001B9CF0.saved_texture_start = texture_start; - if (D_L00_001B9CF0.state == 11 || + if (D_L00_001B9CF0.state == PAUSE_MENU_STATE_CLOSE_ON_ACTION || D_L00_001B9CF0.state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ON_ACTION) { D_L00_001841F0.unk240 = texture_start; texture_region_end = texture_start + 0x40000; From 42b40ef8c2fe2154d50f56d73bf4b535a2ec17a4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:29:43 +0000 Subject: [PATCH 043/758] decomp: clarify names in draw_beam_barrier_segments D_L06_00161DD0 -> l06_beam_barrier_gs_alpha_a_selector: Retail 0x002f6e84 loads D_L06_00161DD0 (-0x4e30(gp)) without shifting; 0x002f6e98-0x002f6eb0 ORs it with selectors shifted by 2, 4 and 6, then writes GS register 0x42 through vu1_add_g_sregister. This is the ALPHA_1 A color-input selector (bits 0-1), rather than a color value. Supplied C defines the int as zero and shows the identical GS-register assembly. D_L06_00161DD8 -> l06_beam_barrier_gs_alpha_c_selector: Retail 0x002f6e8c loads D_L06_00161DD8 (-0x4e28(gp)); 0x002f6e9c shifts it left four bits and 0x002f6ea0 merges it into the value passed to GS register 0x42 at 0x002f6eac-0x002f6eb0. This supplies the ALPHA_1 C alpha-factor selector (bits 4-5). The supplied int definition is zero and its source use matches this register-field role. D_L06_00161DFC -> l06_beam_barrier_texture_u_phase: Retail 0x002f6f88 loads D_L06_00161DFC and 0x002f6fa4 stores it as draw params+0x20. Checked direct helper 0x00216bd0-0x00216be8 copies that float into X of both coordinate pairs, with Y=0 and Y=1; 0x00216c08-0x00216c0c then increments both X values by the established texture U step per point. Supplied animate_beam_barrier_strands advances this same float by beam_barrier_render_phase_speed_gp*frame_time and subtracts 1 above 1, proving an animated texture U phase. D_L06_001DB0F0 -> l06_beam_barrier_strand_local_points: Retail 0x002f6f64/0x002f6f70 forms 0x001db0f0 and 0x002f6fac stores it as params+0x18 beside point count 30 at params+0x14. Checked helper 0x00216b8c/0x00216bbc iterates four strands, 0x00216bf4-0x00216c10 selects strand*30*16 and loads Vec4 points, then 0x00216c14-0x00216c3c offsets XYZ and applies the segment matrix. Supplied companion C initializes each [strand][point].f[1] along the strand and updates interior points by drift, proving local strand geometry rather than transformed output. --- src/overlays/l06/mobys/beam_barrier.c | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/l06/mobys/beam_barrier.c b/src/overlays/l06/mobys/beam_barrier.c index 00ae458dbe..ff0d786d4e 100644 --- a/src/overlays/l06/mobys/beam_barrier.c +++ b/src/overlays/l06/mobys/beam_barrier.c @@ -346,11 +346,11 @@ extern int get_effect_texture(int) __asm__("FUN_001f44b8"); extern void vu1_add_g_sregister(int, long) __asm__("FUN_00233980"); extern void FUN_L06_00216b88(int *, float *); -int D_L06_00161DD0 = 0; +int l06_beam_barrier_gs_alpha_a_selector __asm__("D_L06_00161DD0") = 0; int D_L06_00161DD4 = 2; -int D_L06_00161DD8 = 0; +int l06_beam_barrier_gs_alpha_c_selector __asm__("D_L06_00161DD8") = 0; int D_L06_00161DDC = 1; @@ -360,9 +360,9 @@ int D_L06_00161DF4 = 0xff0000; float beam_barrier_texture_u_step_gp __asm__("D_L06_00161DF8") = 0.25f; -float D_L06_00161DFC = 0; +float l06_beam_barrier_texture_u_phase __asm__("D_L06_00161DFC") = 0; -Vec4 D_L06_001DB0F0[4][30] = {0}; +Vec4 l06_beam_barrier_strand_local_points[4][30] __asm__("D_L06_001DB0F0") = {0}; void draw_beam_barrier_segments(char *moby) { float base_matrix[16]; @@ -391,8 +391,8 @@ void draw_beam_barrier_segments(char *moby) { vu1_add_g_sregister(0x14, 0xFF9000000260L); vu1_add_g_sregister(8, 0); vu1_add_g_sregister(0x42, - (long)D_L06_00161DD0 | ((long)D_L06_00161DD4 << 2) | - ((long)D_L06_00161DD8 << 4) | ((long)D_L06_00161DDC << 6) | + (long)l06_beam_barrier_gs_alpha_a_selector | ((long)D_L06_00161DD4 << 2) | + ((long)l06_beam_barrier_gs_alpha_c_selector << 4) | ((long)D_L06_00161DDC << 6) | 0x8000000000L); font_queue_vu_state(); first_matrix = segment_matrix[0]; @@ -415,11 +415,11 @@ void draw_beam_barrier_segments(char *moby) { color = fast_tween_color( D_L06_00161DF0 & 0xFFFFFF, D_L06_00161DF0, *(float *)(beam_barrier_vars + 0x18)); strand_cycle_duration_frames = D_L06_00161E50; - points = (int *)D_L06_001DB0F0; + points = (int *)l06_beam_barrier_strand_local_points; strand_color_transition_threshold_frames = D_L06_00161E54; fourth = D_L06_00161DF4; seventh = beam_barrier_texture_u_step_gp; - eighth = D_L06_00161DFC; + eighth = l06_beam_barrier_texture_u_phase; sequence = D_L06_00161E40; beam_segment_draw_params[0] = strand_cycle_duration_frames; beam_segment_draw_params[2] = (int)sequence; @@ -460,19 +460,19 @@ void animate_beam_barrier_strands(struct Moby *moby) { moby->rot.x = fast_add_rotations( moby->rot.x, beam_barrier_rotation_x_speed_degrees_gp * DEG_TO_RAD * frame_time); - phase = D_L06_00161DFC + beam_barrier_render_phase_speed_gp * frame_time; + phase = l06_beam_barrier_texture_u_phase + beam_barrier_render_phase_speed_gp * frame_time; moby->scale = moby->pclass->scale * beam_barrier_class_scale_multiplier_gp; - D_L06_00161DFC = phase; + l06_beam_barrier_texture_u_phase = phase; if (phase > 1.0f) { - D_L06_00161DFC = phase - 1.0f; + l06_beam_barrier_texture_u_phase = phase - 1.0f; } step = l06_beam_barrier_strand_length / 30.0f; y = -(l06_beam_barrier_strand_length * 0.5f); for (i = 0; i < 4; i++) { if (D_L06_00161E40[i] == 0) { for (k = 0; k < 30; k++) { - FUN_L06_00217300(&D_L06_001DB0F0[i][k]); - D_L06_001DB0F0[i][k].f[1] = y; + FUN_L06_00217300(&l06_beam_barrier_strand_local_points[i][k]); + l06_beam_barrier_strand_local_points[i][k].f[1] = y; random_vector( &jitter[k], 0.0f, beam_barrier_strand_jitter_max_speed_gp * frame_time); y += step; @@ -485,7 +485,7 @@ void animate_beam_barrier_strands(struct Moby *moby) { D_L06_00161E40[i] = D_L06_00161E50; } else { for (j = 1; j < 29; j++) { - fast_vec_add(&D_L06_001DB0F0[i][j], &D_L06_001DB0F0[i][j], &D_L06_001DB870[i][j]); + fast_vec_add(&l06_beam_barrier_strand_local_points[i][j], &l06_beam_barrier_strand_local_points[i][j], &D_L06_001DB870[i][j]); } D_L06_00161E40[i]--; } From 9e33e7b33313039e7827f4bf9f852ccdd0d339f7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:29:54 +0000 Subject: [PATCH 044/758] decomp: clarify names in update_resort_owner_state_actions D_L11_001613F0 -> l11_resort_owner_gate_attachment_rotation: In RESORT_OWNER_WAIT_AT_GATE, retail 0x002d1254-0x002d128c selects the gate moby from pvars+0xF0 using the nonzero path leg. Retail 0x002d1274 forms a3=gp-0x5810, the original Ghidra rotation input &gp0xffffa7f0; authoritative C binds this argument to &D_L11_001613F0. At 0x002d1290-0x002d1294 transform_attachment_pose receives the owner, gate, local position input, this local rotation input, and owner position/rotation outputs. Supplied transform_attachment_pose source passes its fourth parameter rotation to euler_rotation_matrix and composes it with the reference object's rotation basis. This proves the gate attachment rotation-input role while preserving the int zero definition and exact assembler identity. --- src/overlays/l11/mobys/resort_owner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l11/mobys/resort_owner.c b/src/overlays/l11/mobys/resort_owner.c index 840939c00c..493c996aa4 100644 --- a/src/overlays/l11/mobys/resort_owner.c +++ b/src/overlays/l11/mobys/resort_owner.c @@ -148,7 +148,7 @@ extern void FUN_00212f90(void *, int, int, int); extern float D_0015ED70; extern float D_0015ED6C; float D_L11_001613E0 = 3.2f; -int D_L11_001613F0 = 0; +int l11_resort_owner_gate_attachment_rotation __asm__("D_L11_001613F0") = 0; extern int resort_owner_completion_rotation_trigger_state[] __asm__("D_L11_0016D260"); extern int D_L11_0015FFD8; @@ -231,7 +231,7 @@ void update_resort_owner_state_actions(void *mp) { transform_attachment_pose(moby, gate_moby, &D_L11_001613E0, - &D_L11_001613F0, + &l11_resort_owner_gate_attachment_rotation, (char *)moby + 0x10, (char *)moby + 0x40); if (try_activate_pokitaru_gate((struct Moby *)gate_moby) == 0) From b51fcc3e46f57ccb64944823b13e3b1ec3d0e9ab Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:32:09 +0000 Subject: [PATCH 045/758] decomp: clarify names in draw_point_table_quads D_L13_00161E88 -> l13_point_table_quad_blend_color_a_selector: Source regs starts with D_L13_00161E88, a zero-initialized s32, before combining selectors at shifts 2, 4, 6 and the fixed factor at 32. Retail 0x00309940 loads it from gp-0x4D78; 0x0030994C-0x0030996C combines the other fields, and 0x00309984/0x00309998 store the word at packet+0x88 in both packets. Checked draw_geometry_quad target 0x00208D10 preserves the packet pointer in s2 at 0x00208DBC; 0x00209120 loads packet+0x88 and 0x00209124-0x0020913C pairs it with GS register address 0x42 (ALPHA_1). Its unshifted bits are the A color selector of the blend equation (A-B)*C+D; this is a selector, not a color value. D_L13_00161E90 -> l13_point_table_quad_blend_alpha_selector: Source shifts the zero-initialized s32 D_L13_00161E90 left 4 into regs. Retail 0x00309948 loads gp-0x4D70, 0x00309954 shifts it four bits and 0x0030995C ORs it into the word stored in both packet+0x88 slots at 0x00309984/0x00309998. The actual retail draw helper 0x00208D10 loads that slot at 0x00209120 and pairs its contents with GS address 0x42 at 0x00209124-0x0020913C. ALPHA_1 bits 4-5 are the C alpha selector in (A-B)*C+D. This proves an alpha-source selector for point-table quad blending, rather than an alpha magnitude. --- src/overlays/l13/mobys/blarg_space_commando.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l13/mobys/blarg_space_commando.c b/src/overlays/l13/mobys/blarg_space_commando.c index debe8df182..678d09fa32 100644 --- a/src/overlays/l13/mobys/blarg_space_commando.c +++ b/src/overlays/l13/mobys/blarg_space_commando.c @@ -954,9 +954,9 @@ typedef struct { u64 tag[4]; } QuadPacket; -s32 D_L13_00161E88 = 0; +s32 l13_point_table_quad_blend_color_a_selector __asm__("D_L13_00161E88") = 0; s32 D_L13_00161E8C = 2; -s32 D_L13_00161E90 = 0; +s32 l13_point_table_quad_blend_alpha_selector __asm__("D_L13_00161E90") = 0; s32 D_L13_00161E94 = 1; s32 D_L13_00161E98 = 0x80; s32 D_L13_00161E9C = 0xb; @@ -996,9 +996,9 @@ void draw_point_table_quads(struct Moby *moby) { i = 0; pk[0].tag[1] = get_effect_texture(D_L13_00161E9C); pk[1].tag[1] = get_effect_texture(D_L13_00161E9C); - regs = D_L13_00161E88; + regs = l13_point_table_quad_blend_color_a_selector; regs |= (u64)D_L13_00161E8C << 2; - regs |= (u64)D_L13_00161E90 << 4; + regs |= (u64)l13_point_table_quad_blend_alpha_selector << 4; regs |= (u64)D_L13_00161E94 << 6; regs |= (u64)D_L13_00161E98 << 32; /* Store order is load-bearing: it sets which register keeps regs. */ From 094afeb0b0cb2dd05295d678f478e2e7df0fbbae Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:32:23 +0000 Subject: [PATCH 046/758] decomp: clarify names in draw_teleporter_ring D_L11_00161920 -> l11_teleporter_ring_blend_a_selector: Authoritative C initializes this int to zero and ORs it unshifted into quad.tag[3]. Original Ghidra iGpffffad20 has the same flow. Retail 0x002f2dd4 loads it, 0x002f2df0-0x002f2e0c combine the four selectors and fixed bit 39, and 0x002f2e14 stores the word at packet+0x88. Checked level-11 draw helper preserves packet pointer in s2 at 0x0022ec3c, loads packet+0x88 at 0x0022efa0 and pairs that word with register 0x42 at 0x0022efa4/0x0022efb0/0x0022efbc. This is GS ALPHA_1, whose low two bits select blend operand A. Thus this is the L11 teleporter ring blend A selector; retain its zero value and original assembler binding. D_L11_00161928 -> l11_teleporter_ring_blend_c_selector: Authoritative C initializes this int to zero and shifts it left four bits into quad.tag[3]; original Ghidra iGpffffad28 matches. Retail 0x002f2de4 loads it, 0x002f2df4 shifts by four and 0x002f2dfc ORs it into the word stored at packet+0x88 by 0x002f2e14. Checked level-11 draw helper 0x0022efa0 loads packet+0x88 and 0x0022efa4/0x0022efb0/0x0022efbc emit it paired with GS register 0x42 (ALPHA_1). Bits 4-5 select blend factor operand C, so this is the L11 teleporter ring blend C selector. Retain its zero value, int type and original assembler identity. --- src/overlays/l11/mobys/teleporter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l11/mobys/teleporter.c b/src/overlays/l11/mobys/teleporter.c index f64717a4e6..9aa6860431 100644 --- a/src/overlays/l11/mobys/teleporter.c +++ b/src/overlays/l11/mobys/teleporter.c @@ -264,9 +264,9 @@ extern void draw_geometry_quad(void *, void *, int) __asm__("FUN_0 extern float teleporter_ring_quad_uvs[] __asm__("D_L11_001D3530"); -int D_L11_00161920 = 0; +int l11_teleporter_ring_blend_a_selector __asm__("D_L11_00161920") = 0; int D_L11_00161924 = 2; -int D_L11_00161928 = 0; +int l11_teleporter_ring_blend_c_selector __asm__("D_L11_00161928") = 0; int D_L11_0016192C = 1; int D_L11_00161930 = 0x13; unsigned int l11_teleporter_ring_vertex_color __asm__("D_L11_00161934") = 0x60408080; @@ -285,8 +285,8 @@ void draw_teleporter_ring(struct Moby *moby) { copy_matrix_rotation(matrix, &moby->rot_row0); qcopy(matrix + 12, &moby->pos); quad.tag[1] = get_effect_texture(D_L11_00161930); - quad.tag[3] = (unsigned long long)D_L11_00161920 | (unsigned long long)D_L11_00161924 << 2 | - (unsigned long long)D_L11_00161928 << 4 | + quad.tag[3] = (unsigned long long)l11_teleporter_ring_blend_a_selector | (unsigned long long)D_L11_00161924 << 2 | + (unsigned long long)l11_teleporter_ring_blend_c_selector << 4 | (unsigned long long)D_L11_0016192C << 6 | 0x8000000000ULL; quad.tag[2] = 0xff9000000260ULL; quad.tag[0] = 0; From 985b030d26edaff47920bb64c89a7ba44feac382 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:32:29 +0000 Subject: [PATCH 047/758] overlay: name update_follow_camera_attach_mode --- src/overlays/shared/camera/follow_camera_springs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/camera/follow_camera_springs.c b/src/overlays/shared/camera/follow_camera_springs.c index 3d10abe798..a387483600 100644 --- a/src/overlays/shared/camera/follow_camera_springs.c +++ b/src/overlays/shared/camera/follow_camera_springs.c @@ -830,7 +830,9 @@ void compute_follow_camera_offset_target_up_projection(void *out_target_up_proje /* camera attach mode transitions: picks the next state from the player's state and arms its timers */ /* Migrated from rac1-decomp (src/overlays/shared/vendor_002E1660.c: func_L00_002E5DE0). */ -void FUN_L00_002e4930(char *camera) { +void update_follow_camera_attach_mode(char *camera) __asm__("FUN_L00_002e4930"); + +void update_follow_camera_attach_mode(char *camera) { char *camera_state = *(char **)(camera + 0x70); CamAttach *attach_state = (CamAttach *)(camera_state + 0x40); char *timer_camera_state; From 77318f6331e9635dc2ac64a6e07000342e2ef0ac Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:34:26 +0000 Subject: [PATCH 048/758] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE: Authoritative hero_set_state source binds this comparison to animation_request_mode, separate from requested_state and hero.vehicle_mode. Original Ghidra param_2 agrees. Retail 0x0024cf40 saves a1 in s5; 0x0024cf50-0x0024cf58 requires s5==2 to admit request 100 from death control mode, and 0x0024cf64-0x0024cf7c requires the identical value to bypass the game-mode refusal guard. Nonzero s5 also enables optional entry animations (0x0024d180 and 0x0024d2c0). Thus 2 is the animation-request admission override, without claiming unconditional success or a hero-state ID. domain_1_value_2 -> HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE: Authoritative hero_set_state source binds this comparison to animation_request_mode, separate from requested_state and hero.vehicle_mode. Original Ghidra param_2 agrees. Retail 0x0024cf40 saves a1 in s5; 0x0024cf50-0x0024cf58 requires s5==2 to admit request 100 from death control mode, and 0x0024cf64-0x0024cf7c requires the identical value to bypass the game-mode refusal guard. Nonzero s5 also enables optional entry animations (0x0024d180 and 0x0024d2c0). Thus 2 is the animation-request admission override, without claiming unconditional success or a hero-state ID. --- src/overlays/l05/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l05/hero/hero_set_state.c b/src/overlays/l05/hero/hero_set_state.c index 0bd9214217..03f6608ca9 100644 --- a/src/overlays/l05/hero/hero_set_state.c +++ b/src/overlays/l05/hero/hero_set_state.c @@ -82,16 +82,19 @@ extern int hero_set_state(int, int) __asm__("FUN_L05_0024cee8"); extern char level05_hero_water_surface_jump_velocity_keys[] __asm__("D_L05_0017C3C0"); int hero_set_state(int requested_state, int animation_request_mode) { + enum { + HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE = 2 + }; int saved_state_step; char *moby; int old20A7; { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_request_mode != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_request_mode != HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE)) return 0; } - if ((D_L05_0015F5C4 == 2 || D_L05_0015F5C4 == 6) && animation_request_mode != 2) + if ((D_L05_0015F5C4 == 2 || D_L05_0015F5C4 == 6) && animation_request_mode != HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE) return 0; { struct Hero *p = &hero; From ae9d5a580090a23125df8c555f8f05c28b68c803 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:34:38 +0000 Subject: [PATCH 049/758] decomp: clarify names in draw_group_scenery_ship_trails D_L05_001613F0 -> l05_scenery_ship_trail_callback_disabled: Retail 002d7924 loads this global through gp-0x5810; 002d795c branches directly to the epilogue at 002d7ca4 when nonzero. Original Ghidra iGpffffa7f0 == 0 encloses the whole function. Authoritative draw_group_scenery_ship_trails returns before packet setup, group traversal or drawing when D_L05_001613F0 != 0, proving this level-05 trail callback disable gate. D_L05_001613F4 -> l05_scenery_ship_trail_ribbon_draw_disabled: Retail 002d7c04 loads this global through gp-0x580c; 002d7c08 branches to ribbon-loop advancement at 002d7c74 when nonzero, bypassing all four vertex additions at 002d7c28..002d7c60 and quad draw at 002d7c64..002d7c70. Original Ghidra iGpffffa7f4 == 0 and authoritative C guard the same body of each of three ribbon iterations, proving suppression of trail ribbon assembly and drawing. --- src/overlays/l05/mobys/scenery_ship.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l05/mobys/scenery_ship.c b/src/overlays/l05/mobys/scenery_ship.c index b7995c116d..e8b21f70dc 100644 --- a/src/overlays/l05/mobys/scenery_ship.c +++ b/src/overlays/l05/mobys/scenery_ship.c @@ -387,8 +387,8 @@ typedef struct { u64 flags; } L05GlowPacket; -int D_L05_001613F0 = 0; -int D_L05_001613F4 = 0; +int l05_scenery_ship_trail_callback_disabled __asm__("D_L05_001613F0") = 0; +int l05_scenery_ship_trail_ribbon_draw_disabled __asm__("D_L05_001613F4") = 0; int D_L05_001613F8 = 0; int D_L05_001613FC = 2; int D_L05_00161400 = 0; @@ -426,7 +426,7 @@ void draw_group_scenery_ship_trails(struct Moby *moby) { u64 texture; L05GlowPacket *glow_packet; - if (D_L05_001613F0 != 0) + if (l05_scenery_ship_trail_callback_disabled != 0) return; if (l05_scenery_ship_extended_trail_selector != 0) D_L05_001613E0 = 16.0f; @@ -474,7 +474,7 @@ void draw_group_scenery_ship_trails(struct Moby *moby) { trail_segment_start_index = (*(short *)(scenery_ship_vars + 0x322) - frame + 15) & 15; for (ribbon = 0; ribbon < 3; ribbon++) { - if (D_L05_001613F4 == 0) { + if (l05_scenery_ship_trail_ribbon_draw_disabled == 0) { points = scenery_ship_vars + (ribbon * 0x100 + 0x20); for (k = 0; k < 4; k++) { index = (trail_segment_start_index + (k >> 1)) & 15; From 6bfbf258b0f36bbb012b05e5d5e3d240cdfb7437 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:34:51 +0000 Subject: [PATCH 050/758] decomp: clarify names in draw_elevator_rotating_rings D_L02_00161BF4 -> level02_elevator_ring_blend_color_a_selector: Bound C declares this int zero-initialized and ORs it unshifted into packet.mode. Retail 0x002dc3c4 loads gp-0x500c (D_L02_00161BF4), 0x002dc3e0-0x002dc3fc combines it with selectors shifted by 2, 4 and 6, and 0x002dc414 stores the mode at packet+0x88. Original Ghidra iGpffffaff4 agrees. Checked level-02 draw_geometry_quad at 0x0020e670 loads packet+0x88, 0x0020e674 selects GS register 0x42 (ALPHA_1), and 0x0020e680/0x0020e68c emits that value/register pair. Thus this global supplies the ALPHA A color operand selector at bits 0-1; preserve its zero value and assembler binding. D_L02_00161BFC -> level02_elevator_ring_blend_alpha_selector: Bound C declares this int zero-initialized and shifts it by four into packet.mode. Retail 0x002dc3d4 loads gp-0x5004 (D_L02_00161BFC), 0x002dc3e4 shifts it left 4, 0x002dc3ec combines it into the mode and 0x002dc414 stores packet+0x88. Original Ghidra iGpffffaffc agrees. Checked level-02 draw_geometry_quad 0x0020e670-0x0020e68c loads that mode and emits it paired with GS register 0x42 (ALPHA_1). Bits 4-5 are its C selector, choosing the alpha factor in the blend equation; therefore this is the ring blend alpha selector, not an alpha magnitude. Preserve its zero value and assembler binding. --- src/overlays/l02/mobys/elevator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l02/mobys/elevator.c b/src/overlays/l02/mobys/elevator.c index dff580b4af..b1caa2fca5 100644 --- a/src/overlays/l02/mobys/elevator.c +++ b/src/overlays/l02/mobys/elevator.c @@ -249,9 +249,9 @@ extern float level02_elevator_ring_segment_half_height_gp __asm__("D_L02_00161BF __attribute__((sda)); extern float level02_elevator_ring_segment_angle_degrees_gp __asm__("D_L02_00161C10") __attribute__((sda)); -int D_L02_00161BF4 = 0; +int level02_elevator_ring_blend_color_a_selector __asm__("D_L02_00161BF4") = 0; int D_L02_00161BF8 = 2; -int D_L02_00161BFC = 0; +int level02_elevator_ring_blend_alpha_selector __asm__("D_L02_00161BFC") = 0; int D_L02_00161C00 = 1; int D_L02_00161C04 = 0x206068; int D_L02_00161C08 = 0x40107020; @@ -296,7 +296,7 @@ void draw_elevator_rotating_rings(struct Moby *moby) { matrix.position[3] = 1.0f; packet.texture = get_effect_texture(14); packet.flags = 0xFF9000000260L; - packet.mode = (long)D_L02_00161BF4 | ((long)D_L02_00161BF8 << 2) | ((long)D_L02_00161BFC << 4) | + packet.mode = (long)level02_elevator_ring_blend_color_a_selector | ((long)D_L02_00161BF8 << 2) | ((long)level02_elevator_ring_blend_alpha_selector << 4) | ((long)D_L02_00161C00 << 6) | 0x8000000000L; packet.zero = 0; uv = level02_elevator_ring_segment_uvs; From 3cc9e0dcfa136e1bb0ec4013630f2f64bb3a6199 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:35:03 +0000 Subject: [PATCH 051/758] decomp: clarify names in draw_elevator_rotating_rings D_L16_00161ECC -> l16_elevator_ring_blend_color_a_selector: Authoritative elevator.c SHA-256 83729d2760d912723188f22c6a919a4f1fdcd02ce3b8b2624a2c83a948f2e388 defines this int as zero and ORs it unshifted into packet.mode. Original retail Ghidra identifies the same operand as iGpffffb2cc. Retail 0x002e85e8 loads it, 0x002e8604-0x002e8620 combines it with selectors shifted by 2, 4 and 6 plus 0x8000000000, and 0x002e8638 stores the word at packet +0x88. Checked level-16 draw helper 0x001fbeA0 loads packet +0x88, 0x001fbea4 sets register ID 0x42, and 0x001fbeb0/0x001fbebc emits their A+D pair. Thus it supplies the A color selector of the GS ALPHA blend equation; level prefix preserves overlay ownership. D_L16_00161ED4 -> l16_elevator_ring_blend_alpha_selector: Authoritative elevator.c defines this int as zero and shifts it left four bits in packet.mode; original retail Ghidra reports iGpffffb2d4 << 4 in the identical word. Retail 0x002e85f8 loads the global, 0x002e8608 shifts it by four, 0x002e8610 merges it, and 0x002e8638 stores packet +0x88. The checked level-16 helper reached by 0x002e884c loads that exact word at 0x001fbea0 and pairs it with GS ALPHA register ID 0x42 at 0x001fbea4-0x001fbebc. Bits 4-5 select the C alpha multiplier in the GS blend equation, proving its blend alpha selector role. The l16 prefix distinguishes this overlay-local binding. --- src/overlays/l16/mobys/elevator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l16/mobys/elevator.c b/src/overlays/l16/mobys/elevator.c index 5c22aa9c7a..ed02c231ec 100644 --- a/src/overlays/l16/mobys/elevator.c +++ b/src/overlays/l16/mobys/elevator.c @@ -250,9 +250,9 @@ extern float D_L16_00161EB8_gp __asm__("D_L16_00161EB8") __attribute__((sda)); extern float elevator_ring_outer_radius_gp __asm__("D_L16_00161EC4") __attribute__((sda)); extern float elevator_ring_half_height_gp __asm__("D_L16_00161EC8") __attribute__((sda)); extern float elevator_ring_segment_angle_degrees_gp __asm__("D_L16_00161EE8") __attribute__((sda)); -int D_L16_00161ECC = 0; +int l16_elevator_ring_blend_color_a_selector __asm__("D_L16_00161ECC") = 0; int D_L16_00161ED0 = 2; -int D_L16_00161ED4 = 0; +int l16_elevator_ring_blend_alpha_selector __asm__("D_L16_00161ED4") = 0; int D_L16_00161ED8 = 1; int D_L16_00161EDC = 0x408000; int D_L16_00161EE0 = 0x40c08030; @@ -289,7 +289,7 @@ void draw_elevator_rotating_rings(struct Moby *elevator_moby) { matrix.position[3] = 1.0f; packet.texture = get_effect_texture(14); packet.flags = 0xFF9000000260L; - packet.mode = (long)D_L16_00161ECC | ((long)D_L16_00161ED0 << 2) | ((long)D_L16_00161ED4 << 4) | + packet.mode = (long)l16_elevator_ring_blend_color_a_selector | ((long)D_L16_00161ED0 << 2) | ((long)l16_elevator_ring_blend_alpha_selector << 4) | ((long)D_L16_00161ED8 << 6) | 0x8000000000L; packet.zero = 0; uv = elevator_ring_quad_uvs; From 0eb32f2c9f1f8aa755b06969e0600ef61072fd2b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:37:09 +0000 Subject: [PATCH 052/758] overlay: name position_lift_marker_ring_points --- src/overlays/l05/mobys/elevator_with_button.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/overlays/l05/mobys/elevator_with_button.c b/src/overlays/l05/mobys/elevator_with_button.c index e1fb9afbf6..bd1f8076d6 100644 --- a/src/overlays/l05/mobys/elevator_with_button.c +++ b/src/overlays/l05/mobys/elevator_with_button.c @@ -279,7 +279,9 @@ void compute_lift_camera_view(char *lift_moby, char *camera_position, char *came } /* Ported from rac1-decomp (src/overlays/l05_rilgar/vendor_0030EB68.c: func_L05_00317438), where it is exact; names translated to the US level program. */ -void FUN_L05_00315f70(char *moby) { +void position_lift_marker_ring_points(char *moby) __asm__("FUN_L05_00315f70"); + +void position_lift_marker_ring_points(char *moby) { int i = 0; char *lift_vars = ((char *)MOBY(moby)->pvars); char *tab = ((char *)l05_paths[*(int *)(lift_vars + 0x68)]); From cafbc4be6c84f67edd820e177d0b53f2c576476e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:37:10 +0000 Subject: [PATCH 053/758] decomp: clarify names in ultramech_scientist_update domain_0_value_254 -> MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY: Retail 0x002ec914 loads 0xFE into s8; 0x002ec93c-0x002ec954 excludes this state from removal of mission-linked mobys. Checked level-15 removal helper 0x0023e168-0x0023e190 loads the address boundary from 0x0015FFDC, compares the moby pointer unsigned with sltu, chooses 0xFD below the boundary and 0xFE at or above it, and stores that marker to the same Moby state byte +0x20. The source binds this helper as mark_moby_for_removal. This proves removal-marker roles and address-side distinction without claiming dead/gone or static/dynamic lifecycle semantics. domain_1_value_253 -> MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY: Retail 0x002ec918 loads 0xFD into s7; 0x002ec93c-0x002ec954 excludes this state from removal of mission-linked mobys. Checked level-15 removal helper 0x0023e168-0x0023e190 loads the address boundary from 0x0015FFDC, compares the moby pointer unsigned with sltu, chooses 0xFD below the boundary and 0xFE at or above it, and stores that marker to the same Moby state byte +0x20. The source binds this helper as mark_moby_for_removal. This proves removal-marker roles and address-side distinction without claiming dead/gone or static/dynamic lifecycle semantics. domain_4_value_254 -> MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY: Retail 0x002ec9f0 loads 0xFE into s8; 0x002eca1c-0x002eca34 excludes this state from the second mission-linked moby removal traversal. Checked level-15 removal helper 0x0023e168-0x0023e190 loads the address boundary from 0x0015FFDC, compares the moby pointer unsigned with sltu, chooses 0xFD below the boundary and 0xFE at or above it, and stores that marker to the same Moby state byte +0x20. The source binds this helper as mark_moby_for_removal. This proves removal-marker roles and address-side distinction without claiming dead/gone or static/dynamic lifecycle semantics. domain_5_value_253 -> MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY: Retail 0x002ec9f4 loads 0xFD into s7; 0x002eca1c-0x002eca34 excludes this state from the second mission-linked moby removal traversal. Checked level-15 removal helper 0x0023e168-0x0023e190 loads the address boundary from 0x0015FFDC, compares the moby pointer unsigned with sltu, chooses 0xFD below the boundary and 0xFE at or above it, and stores that marker to the same Moby state byte +0x20. The source binds this helper as mark_moby_for_removal. This proves removal-marker roles and address-side distinction without claiming dead/gone or static/dynamic lifecycle semantics. domain_6_value_254 -> MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY: Retail 0x002ecafc-0x002ecb04 compares the indexed moby's state byte +0x20 against 0xFE before mark_moby_for_removal at 0x002ecb14. Checked level-15 removal helper 0x0023e168-0x0023e190 loads the address boundary from 0x0015FFDC, compares the moby pointer unsigned with sltu, chooses 0xFD below the boundary and 0xFE at or above it, and stores that marker to the same Moby state byte +0x20. The source binds this helper as mark_moby_for_removal. This proves removal-marker roles and address-side distinction without claiming dead/gone or static/dynamic lifecycle semantics. domain_7_value_253 -> MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY: Retail 0x002ecb08-0x002ecb0c compares the indexed moby's state byte +0x20 against 0xFD before mark_moby_for_removal at 0x002ecb14. Checked level-15 removal helper 0x0023e168-0x0023e190 loads the address boundary from 0x0015FFDC, compares the moby pointer unsigned with sltu, chooses 0xFD below the boundary and 0xFE at or above it, and stores that marker to the same Moby state byte +0x20. The source binds this helper as mark_moby_for_removal. This proves removal-marker roles and address-side distinction without claiming dead/gone or static/dynamic lifecycle semantics. --- src/overlays/l15/mobys/ultramech_scientist.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/overlays/l15/mobys/ultramech_scientist.c b/src/overlays/l15/mobys/ultramech_scientist.c index 544620bf7d..4f9ddb46af 100644 --- a/src/overlays/l15/mobys/ultramech_scientist.c +++ b/src/overlays/l15/mobys/ultramech_scientist.c @@ -118,6 +118,10 @@ void ultramech_scientist_update(struct Moby *moby) { enum { ULTRAMECH_SCIENTIST_DISABLED = 9 }; + enum { + MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY = 0xFD, + MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY = 0xFE + }; UltramechScientistVars *ultramech_scientist_private_data; char *hero_pos; struct Moby *moby_list_cursor; @@ -172,8 +176,8 @@ void ultramech_scientist_update(struct Moby *moby) { break; } { - int dead_state = 0xFE; - int gone_state = 0xFD; + int dead_state = MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY; + int gone_state = MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY; for (; moby_list_cursor != 0; moby_list_cursor = moby_list_cursor->next) { if (moby_list_cursor->mission != ultramech_scientist_private_data->unk280) { continue; @@ -215,8 +219,8 @@ void ultramech_scientist_update(struct Moby *moby) { break; } { - int dead_state = 0xFE; - int gone_state = 0xFD; + int dead_state = MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY; + int gone_state = MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY; for (; moby_list_cursor != 0; moby_list_cursor = moby_list_cursor->next) { if (moby_list_cursor->mission != ultramech_scientist_private_data->unk280) { continue; @@ -264,8 +268,8 @@ void ultramech_scientist_update(struct Moby *moby) { (char *)l15_moby_array + (ultramech_scientist_private_data->unk158 << 8); if (spawned != 0) { int state = *(unsigned char *)(spawned + 0x20); - if (state != 0xFE) { - if (state != 0xFD) { + if (state != MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY) { + if (state != MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY) { mark_moby_for_removal(spawned); ultramech_scientist_private_data->unk158 = -1; } From 5d2d33e1ae46f340c9ec0c55955a8752ba682691 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:37:23 +0000 Subject: [PATCH 054/758] decomp: clarify names in particle_spawner_smoke_fire_update D_L00_001D2860 -> l00_smoke_fire_particle_facing_flip_flags: Retail 002d7098 forms array base 001d2860; 002d70a8/002d70ac sample random_integer_below(2), and 002d70b0/002d70b8 store its byte at base+particle index. The extra-particle loop repeats this at 002d7114 and 002d7120-002d7130. Original Ghidra agrees with *(undefined1 *)(iVar11 + 0x1d2860) = uVar3 in both loops. Authoritative C declares u8[1200] and draw_smoke_fire_spawner reads D_L00_001D2860[i] ? flipped : front; front aliases facing, while flipped negates facing[0] and recomputes its basis. The draw reset path resamples the same binary flag. Thus these are per-particle facing-flip flags, qualified l00 for this exact binding. --- .../shared/props/particle_spawner_smoke_fire.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/props/particle_spawner_smoke_fire.c b/src/overlays/shared/props/particle_spawner_smoke_fire.c index 4cf75c98df..09d82aa724 100644 --- a/src/overlays/shared/props/particle_spawner_smoke_fire.c +++ b/src/overlays/shared/props/particle_spawner_smoke_fire.c @@ -131,7 +131,7 @@ extern u8 D_L00_001D2D10_lui[] __asm__("D_L00_001D2D10") NOT_SDA; V D_L00_001CB7E0[1200] = {0}; -u8 D_L00_001D2860[1200] = {0}; +u8 l00_smoke_fire_particle_facing_flip_flags[1200] __asm__("D_L00_001D2860") = {0}; s16 l00_smoke_fire_particle_fade_in_timers[1200] __asm__("D_L00_001D5740") = {0}; @@ -175,7 +175,7 @@ void particle_spawner_smoke_fire_update(P *spawner) { for (i = particle_start; i < particle_end_or_emission_index; i++) { r = random_integer_below(2); D_L00_001CB7E0[i].w = 1.0f; - D_L00_001D2860[i] = r; + l00_smoke_fire_particle_facing_flip_flags[i] = r; reset_smoke_fire_spawner_particle(spawner, i); l00_smoke_fire_particle_fade_in_timers[i] = 0; } @@ -184,7 +184,7 @@ void particle_spawner_smoke_fire_update(P *spawner) { for (i = j; i < particle_end_or_emission_index; i++) { r = random_integer_below(2); D_L00_001CB7E0[i].w = 1.0f; - D_L00_001D2860[i] = r; + l00_smoke_fire_particle_facing_flip_flags[i] = r; FUN_L00_002d7d58_c(spawner, i); } D_L00_001600EC[q->idx].w = 1.0f; @@ -291,7 +291,7 @@ void draw_smoke_fire_spawner(P *spawner) { for (i = q->start; i < end; i++) { phase = D_L00_001D31C0[i] - D_L00_001D4480[i] * frame_scale; D_L00_001D31C0[i] = phase; - transform = D_L00_001D2860[i] ? flipped : front; + transform = l00_smoke_fire_particle_facing_flip_flags[i] ? flipped : front; if (phase <= -8.0f) { D_L00_001D31C0[i] = phase + 8.0f; } @@ -331,7 +331,7 @@ void draw_smoke_fire_spawner(P *spawner) { if (fast_dec_timer_s16(&D_L00_001D60A0[i])) { reset_smoke_fire_spawner_particle(spawner, i); alpha = 0; - D_L00_001D2860[i] = random_integer_below(2); + l00_smoke_fire_particle_facing_flip_flags[i] = random_integer_below(2); } else { alpha = truncate_float_to_s32(convert_integer_to_float(D_L00_001D60A0[i]) * D_L00_0016138C * D_L00_0016199C); From f550682c6f30334bc6899109a7eae3f366261338 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:39:27 +0000 Subject: [PATCH 055/758] decomp: clarify names in animate_beam_barrier_strands D_L06_001DB870 -> l06_beam_barrier_strand_point_drifts: Authoritative src/overlays/l06/mobys/beam_barrier.c snapshot SHA-256 8248b8cf0a37408ea62c8a006fee2a347c7283e1844901a094c10727a234dc3c declares Vec4 D_L06_001DB870[4][30] = {0}. Retail 0x002f7158-0x002f7178 forms base 0x001db870 + strand*0x1e0 + 0x10. At 0x002f7180-0x002f71cc two vector additions sum jitter[k-1], jitter[k], jitter[k+1], then vector scaling by 0.333f stores the smoothed drift for inner points 1..28. Jitters are generated with a frame_time-scaled maximum at 0x002f7124-0x002f7148. On nonzero strand timers, 0x002f71e4-0x002f722c reads corresponding vectors from 0x001db880 + strand*0x1e0 and adds them in place to local points at 0x001db100 + strand*0x1e0, advancing both pointers by 16 bytes for 28 points. This proves per-strand, per-point drift increments; l06 identifies the owned overlay. --- src/overlays/l06/mobys/beam_barrier.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l06/mobys/beam_barrier.c b/src/overlays/l06/mobys/beam_barrier.c index ff0d786d4e..b380f3199a 100644 --- a/src/overlays/l06/mobys/beam_barrier.c +++ b/src/overlays/l06/mobys/beam_barrier.c @@ -443,7 +443,7 @@ f32 beam_barrier_class_scale_multiplier_gp __asm__("D_L06_00161E14") = 1. f32 beam_barrier_strand_jitter_max_speed_gp __asm__("D_L06_00161E04") = 0.4f; extern int D_L06_00161E40[4] MACRO_ADDR; -Vec4 D_L06_001DB870[4][30] = {0}; +Vec4 l06_beam_barrier_strand_point_drifts[4][30] __asm__("D_L06_001DB870") = {0}; extern void FUN_L06_00217300(void *); @@ -478,14 +478,14 @@ void animate_beam_barrier_strands(struct Moby *moby) { y += step; } for (k = 1; k < 29; k++) { - fast_vec_add(&D_L06_001DB870[i][k], &jitter[k - 1], &jitter[k]); - fast_vec_add(&D_L06_001DB870[i][k], &D_L06_001DB870[i][k], &jitter[k + 1]); - fast_vec_scale(&D_L06_001DB870[i][k], &D_L06_001DB870[i][k], 0.333f); + fast_vec_add(&l06_beam_barrier_strand_point_drifts[i][k], &jitter[k - 1], &jitter[k]); + fast_vec_add(&l06_beam_barrier_strand_point_drifts[i][k], &l06_beam_barrier_strand_point_drifts[i][k], &jitter[k + 1]); + fast_vec_scale(&l06_beam_barrier_strand_point_drifts[i][k], &l06_beam_barrier_strand_point_drifts[i][k], 0.333f); } D_L06_00161E40[i] = D_L06_00161E50; } else { for (j = 1; j < 29; j++) { - fast_vec_add(&l06_beam_barrier_strand_local_points[i][j], &l06_beam_barrier_strand_local_points[i][j], &D_L06_001DB870[i][j]); + fast_vec_add(&l06_beam_barrier_strand_local_points[i][j], &l06_beam_barrier_strand_local_points[i][j], &l06_beam_barrier_strand_point_drifts[i][j]); } D_L06_00161E40[i]--; } From 9d21ab3a5135c9cdfededcb119b58426fcae43ae Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:39:27 +0000 Subject: [PATCH 056/758] decomp: clarify names in update_blarg_paratrooper_damage_and_state domain_0_value_0 -> PARATROOPER_STATE_INITIALIZE: Retail 003024f8-00302500 loads the current moby state byte at moby+0x20 and returns for zero. The supplied blarg_paratrooper_update switches on that identical byte and names zero PARATROOPER_STATE_INITIALIZE, initializing health, paths and movement. domain_2_value_11 -> PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE: Retail 0030263c-00302644 compares moby+0x20 against 11 to suppress further damage processing. The supplied update function switches on this same moby state byte; its existing PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE branch steps death motion, spawns effects and removes the moby. domain_3_value_10 -> PARATROOPER_STATE_KNOCKBACK_RECOVERY: Retail 00302778 starts animation-8 knockback and 00302780-00302788 stores 10 into moby+0x20. The supplied update function consumes this exact current-state byte as PARATROOPER_STATE_KNOCKBACK_RECOVERY, stepping motion and resuming attacks on landing. domain_4_value_11 -> PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE: Retail 00302854 starts death knockback; 0030285c-00302864 writes 11 to moby+0x20 before bolt dropping. The supplied update function consumes this same field in existing PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE, producing death effects and removing the moby. domain_5_value_0 -> PARATROOPER_STATE_INITIALIZE: Source state = MOBY(moby)->state corresponds to retail 00302a08 loading moby+0x20; 00302a0c tests zero before the ground-height clamp. The supplied update function names zero of this identical current-state selector PARATROOPER_STATE_INITIALIZE and initializes the paratrooper. domain_6_value_5 -> PARATROOPER_STATE_FIRE_PROJECTILES: Retail 00302a08-00302a14 reads moby+0x20 and compares it to 5 for the height clamp. This is the same byte switched on in supplied blarg_paratrooper_update, whose PARATROOPER_STATE_FIRE_PROJECTILES branch emits projectiles from the attached moby on a timer. domain_7_value_7 -> PARATROOPER_STATE_MELEE_ATTACK: Retail 00302a08-00302a1c compares the current moby state byte at +0x20 to 7 for the height clamp. The supplied update function uses this identical selector and names 7 PARATROOPER_STATE_MELEE_ATTACK, generating a hit descriptor and applying melee damage during animation frames. domain_8_value_4 -> PARATROOPER_STATE_HOP_BETWEEN_WAYPOINTS: Retail 00302a08-00302a24 compares current moby state at +0x20 to 4 before probing ground height. The supplied update function switches on the identical byte and names 4 PARATROOPER_STATE_HOP_BETWEEN_WAYPOINTS, interpolating between path points with a vertical hop arc. --- .../shared/enemies/blarg_paratrooper.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_paratrooper.c b/src/overlays/shared/enemies/blarg_paratrooper.c index 5e0e96a37c..1caba00cd1 100644 --- a/src/overlays/shared/enemies/blarg_paratrooper.c +++ b/src/overlays/shared/enemies/blarg_paratrooper.c @@ -609,6 +609,14 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { PARATROOPER_HIT_REACTION_RECOVERY_KNOCKBACK = 3, PARATROOPER_HIT_REACTION_NONE = 11 }; + enum { + PARATROOPER_STATE_INITIALIZE = 0, + PARATROOPER_STATE_HOP_BETWEEN_WAYPOINTS = 4, + PARATROOPER_STATE_FIRE_PROJECTILES = 5, + PARATROOPER_STATE_MELEE_ATTACK = 7, + PARATROOPER_STATE_KNOCKBACK_RECOVERY = 10, + PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE = 11 + }; Paratrooper302618 *paratrooper_instance_state; char *target, *child, *attached, *chased; float pos[4] __attribute__((aligned(16))); @@ -618,7 +626,7 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { float angle, distance, height, dx, dy; paratrooper_instance_state = (Paratrooper302618 *)MOBY(moby)->pvars; - if (MOBY(moby)->state == 0) + if (MOBY(moby)->state == PARATROOPER_STATE_INITIALIZE) return; { float timer_scale = D_L08_001621B0 * frame_time; @@ -652,7 +660,7 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { target = find_moby_hit(moby, 0x330000, 0); reaction = resolve_moby_hit_response( moby, target, ¶trooper_instance_state->health, 0, &hit_state, &damage, 0, 4); - if (hit_state != 1 && MOBY(moby)->state != 11) { + if (hit_state != 1 && MOBY(moby)->state != PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE) { { float health = paratrooper_instance_state->health - damage; paratrooper_instance_state->health = health; @@ -708,7 +716,7 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { (float *)(¶trooper_instance_state->unk8C)); trooper_start_knockback( moby, ¶trooper_instance_state->unk70, knock_angle, 8, 1, 0); - MOBY(moby)->state = 10; + MOBY(moby)->state = PARATROOPER_STATE_KNOCKBACK_RECOVERY; paratrooper_instance_state->unk67 = 0x78; break; case PARATROOPER_HIT_REACTION_LETHAL: @@ -745,7 +753,7 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { (float *)(¶trooper_instance_state->unk8C)); trooper_start_knockback( moby, ¶trooper_instance_state->unk70, second_knock_angle, 12, 1, 0); - MOBY(moby)->state = 11; + MOBY(moby)->state = PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE; paratrooper_instance_state->unk67 = 0xf0; spawn_randomized_bolt_drop(moby, 2, 3, 0, -1); break; @@ -801,7 +809,7 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { paratrooper_instance_state->f160 = (char *)hero.moby; state = MOBY(moby)->state; - if (state == 0 || state == 5 || state == 7 || state == 4) { + if (state == PARATROOPER_STATE_INITIALIZE || state == PARATROOPER_STATE_FIRE_PROJECTILES || state == PARATROOPER_STATE_MELEE_ATTACK || state == PARATROOPER_STATE_HOP_BETWEEN_WAYPOINTS) { height = probe_ground_height(&MOBY(moby)->pos, 0, 0.5f); if (height < MOBY(moby)->pos.z) MOBY(moby)->pos.z = height; From ba401f9ed53622c9b02b3fe3a2a67bc54819ed84 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:39:28 +0000 Subject: [PATCH 057/758] decomp: clarify names in tresspasser_update domain_0_value_2 -> LEVEL_GAME_MODE_SCENE: Retail 0x002ea3e8 loads level_game_mode from 0x0015f5c4 and 0x002ea3ec..0x002ea3f0 compares it to 2 to defer item granting. The preceding proximity branch calls existing start_scene(4/2) at 0x002ea3c4/0x002ea3d4. Bounded checked level-02 helper 0x00297fb0 retains its scene argument in s2, stores it to scene block +0x30 at 0x002980c0, then loads 2 at 0x002980f0 and stores it to the identical 0x0015f5c4 at 0x00298108. This directly proves value 2 is the scene game mode, distinct from moby->state. --- src/overlays/shared/pickups/gadget_pickup.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/pickups/gadget_pickup.c b/src/overlays/shared/pickups/gadget_pickup.c index 22c2d49e36..3c4eb9ad34 100644 --- a/src/overlays/shared/pickups/gadget_pickup.c +++ b/src/overlays/shared/pickups/gadget_pickup.c @@ -72,6 +72,9 @@ void tresspasser_update(struct Moby *moby) { GADGET_PICKUP_STATE_CAMERA_SEQUENCE = 4, GADGET_PICKUP_STATE_SAVE_AND_REMOVE = 5 }; + enum { + LEVEL_GAME_MODE_SCENE = 2 + }; char *gadget_pickup_state; int which; int frames; @@ -115,7 +118,7 @@ void tresspasser_update(struct Moby *moby) { } return; case GADGET_PICKUP_STATE_GRANT_ITEM: - if (level_game_mode == 2) + if (level_game_mode == LEVEL_GAME_MODE_SCENE) return; if (D_001413F4 != 0) { if (which == 0x16) { From 554ab37fc33014eb7ee4f93af6ef164e9a8fcc0c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:41:47 +0000 Subject: [PATCH 058/758] decomp: clarify names in water_tile_update D_L11_00161F64 -> l11_water_tile_allocation_count: Authoritative C assigns this int to water_tile_vars[1], increments it, and checks >=0x80 against the explicit more-than-128-water-tiles diagnostic. Retail 0x0030e100 loads gp-0x4c9c, 0x0030e104 increments, 0x0030e108 stores the old value into pvars+4, and 0x0030e114 writes the incremented counter. That index selects the 0x1190-byte water-grid row and 16-byte binding record at 0x0030e2c4-0x0030e384. Original Ghidra iGpffffb364 has identical allocation data flow and is reset at 0x0030e39c during neighbor discovery; the C definition starts at zero. This proves a level-11 water-tile allocation count, without claiming a persistent active-tile total. --- src/overlays/l11/mobys/water_tile.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l11/mobys/water_tile.c b/src/overlays/l11/mobys/water_tile.c index 66e4e09138..65a139b7b5 100644 --- a/src/overlays/l11/mobys/water_tile.c +++ b/src/overlays/l11/mobys/water_tile.c @@ -45,7 +45,7 @@ typedef struct { } Light_e088; extern Light_e088 l11_water_tile_light __asm__("D_L11_001CB280"); -int D_L11_00161F64 = 0; +int l11_water_tile_allocation_count __asm__("D_L11_00161F64") = 0; char D_L11_0021B4C0[] = "I'm really sorry, but you can't have more than 128 water tiles in this level"; /* One fixed-point bounds record (pool_bind_tile: x, y, z, two scale shorts) per water grid; @@ -86,9 +86,9 @@ void water_tile_update(struct Moby *water_tile_moby) { switch (water_tile_moby->state) { case WATER_TILE_STATE_INITIALIZE: water_tile_moby->update_dist = 0xFF; - water_tile_vars[1] = D_L11_00161F64; - D_L11_00161F64 = D_L11_00161F64 + 1; - if (D_L11_00161F64 >= 0x80) { + water_tile_vars[1] = l11_water_tile_allocation_count; + l11_water_tile_allocation_count = l11_water_tile_allocation_count + 1; + if (l11_water_tile_allocation_count >= 0x80) { print_e088(D_L11_0021B4C0); } water_tile_moby->update_dist = 0xFF; @@ -141,7 +141,7 @@ void water_tile_update(struct Moby *water_tile_moby) { water_tile_moby->state = WATER_TILE_STATE_FIND_NEIGHBORS; break; case WATER_TILE_STATE_FIND_NEIGHBORS: - D_L11_00161F64 = 0; + l11_water_tile_allocation_count = 0; populate_water_tile_neighbor_indices(water_tile_vars[1]); water_tile_moby->state = WATER_TILE_STATE_APPROACH_UPPER_HEIGHT; break; From 4ce8e07ca8b5a7218f97e6e2653e63b1a199efd4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:41:57 +0000 Subject: [PATCH 059/758] decomp: clarify names in draw_joint_aligned_beam_effect D_L00_001DAA80 -> l00_beam_ribbon_world_positions: Authoritative source declares P3 D_L00_001DAA80[196] = {0}. Retail 0x002b3b54 initializes s0 to 0x001daa80; 0x002b3b60-0x002b3b80 scales each RIBBON_POINTS input by pvars+0x20 and transforms it through the child-joint-derived basis/origin at sp+0x90. This basis/origin is also stored to beam_moby rotation and position at 0x002b37a0-0x002b37cc. At 0x002b3b98/0x002b3ba0/0x002b3ba4, transformed XYZ are stored at s0+0/+4/+8; s0 advances 12 bytes for 196 iterations. Retail 0x002b3bd8-0x002b3c10 submits that position base and its +0x6d8 (146 P3 elements) alongside ribbon colors and UVs in two batches. Original Ghidra puVar6 follows the identical three-word store/stride and submission data flow, proving the Level-00 beam ribbon world-position array. --- src/overlays/shared/weapons/thruster_pack_flame.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/weapons/thruster_pack_flame.c b/src/overlays/shared/weapons/thruster_pack_flame.c index cedf69fd5d..ba8a283634 100644 --- a/src/overlays/shared/weapons/thruster_pack_flame.c +++ b/src/overlays/shared/weapons/thruster_pack_flame.c @@ -481,7 +481,7 @@ float D_L15_001CE370[196][4] = RIBBON_POINTS; float D_L16_001CDD70[196][4] = RIBBON_POINTS; float D_L17_001CE5F0[196][4] = RIBBON_POINTS; float D_L18_001CE2F0[196][4] = RIBBON_POINTS; -P3 D_L00_001DAA80[196] = {0}; +P3 l00_beam_ribbon_world_positions[196] __asm__("D_L00_001DAA80") = {0}; P3 D_L01_001DAF00[196] = {0}; @@ -712,17 +712,17 @@ void draw_joint_aligned_beam_effect(struct Moby *beam_moby) { for (i = 0; i < 0xC4; i++) { fast_vec_scale(&ribbon_vertex_position, D_L00_001D9470[i], beam_effect_vars->f20); transform_vector(&ribbon_vertex_position, &ribbon_vertex_position, mtx); - D_L00_001DAA80[i].x = ribbon_vertex_position.x; - D_L00_001DAA80[i].y = ribbon_vertex_position.y; - D_L00_001DAA80[i].z = ribbon_vertex_position.z; + l00_beam_ribbon_world_positions[i].x = ribbon_vertex_position.x; + l00_beam_ribbon_world_positions[i].y = ribbon_vertex_position.y; + l00_beam_ribbon_world_positions[i].z = ribbon_vertex_position.z; D_L00_001DA0B0[i].v -= 0.025f; if (D_L00_001DA0B0[i].v < -7.0f) { D_L00_001DA0B0[i].v += 7.0f; } } - func_L00_001FDE48_2b3628(0x94, D_L00_001DAA80, D_L00_001DA6D0, D_L00_001DA0B0, 1); + func_L00_001FDE48_2b3628(0x94, l00_beam_ribbon_world_positions, D_L00_001DA6D0, D_L00_001DA0B0, 1); func_L00_001FDE48_2b3628( - 0x32, &D_L00_001DAA80[0x92], &D_L00_001DA6D0[0x92], &D_L00_001DA0B0[0x92], 1); + 0x32, &l00_beam_ribbon_world_positions[0x92], &D_L00_001DA6D0[0x92], &D_L00_001DA0B0[0x92], 1); } void emit_beam_trail_particles(X *x) __asm__("FUN_L00_002b3c50"); From 1536b3813c949970dbde2765160963145d2b172c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:42:07 +0000 Subject: [PATCH 060/758] decomp: clarify names in draw_group_scenery_ship_trails D_L05_001613F8 -> l05_scenery_ship_trail_blend_a_selector: Authoritative scenery_ship.c SHA-256 6f6f90a06d129cd8c48fafda2fd818b4ece76fc7087e1415576cb8c30c3fd23b declares this zero-initialized int. Retail 002d79f8 loads gp-0x5808, ORs it unshifted into the command at 002d79fc..002d7a20 and stores packet+0x88 at 002d7a30; original Ghidra iGpffffa7f8 agrees. Direct draw helper 0022bee0 preserves the packet in s2 at 0022bf8c; 0022c2f0 loads +0x88, 0022c2f4 selects GS register 0x42 (ALPHA_1), and 0022c300/0022c30c emit that register/value pair. The unshifted selector occupies ALPHA A, the first color operand of (A-B)*C+D. Thus this is the trail blend A selector, not a general flag. Bounded helper report 92ea08880b001b43a40a36ba1b0dc1cd12df2518a3510318b01cfec3142d72ef. D_L05_00161400 -> l05_scenery_ship_trail_blend_c_selector: Authoritative scenery_ship.c declares this zero-initialized int and shifts it four bits into glow_packet->flags. Retail 002d79d0 loads gp-0x5800, 002d79dc shifts it by four, 002d7a08 ORs it into the command, and 002d7a30 stores packet+0x88; original Ghidra iGpffffa800 << 4 agrees. Direct draw helper 0022bee0 retains the packet in s2 at 0022bf8c; 0022c2f0 loads +0x88, 0022c2f4 sets register 0x42 (GS ALPHA_1), and 0022c300/0022c30c emit the pair. Bits 4..5 select ALPHA C, the multiplier in (A-B)*C+D, proving the trail blend C selector role. Bounded helper report 92ea08880b001b43a40a36ba1b0dc1cd12df2518a3510318b01cfec3142d72ef. --- src/overlays/l05/mobys/scenery_ship.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l05/mobys/scenery_ship.c b/src/overlays/l05/mobys/scenery_ship.c index e8b21f70dc..a7b0962edf 100644 --- a/src/overlays/l05/mobys/scenery_ship.c +++ b/src/overlays/l05/mobys/scenery_ship.c @@ -389,9 +389,9 @@ typedef struct { int l05_scenery_ship_trail_callback_disabled __asm__("D_L05_001613F0") = 0; int l05_scenery_ship_trail_ribbon_draw_disabled __asm__("D_L05_001613F4") = 0; -int D_L05_001613F8 = 0; +int l05_scenery_ship_trail_blend_a_selector __asm__("D_L05_001613F8") = 0; int D_L05_001613FC = 2; -int D_L05_00161400 = 0; +int l05_scenery_ship_trail_blend_c_selector __asm__("D_L05_00161400") = 0; int D_L05_00161404 = 1; int D_L05_00161408 = 0x40806060; int D_L05_0016140C = 0x802020; @@ -438,8 +438,8 @@ void draw_group_scenery_ship_trails(struct Moby *moby) { glow_packet->effect_texture = texture; glow_packet->texture = 0xff9000000260ULL; glow_packet->zero = 0; - glow_packet->flags = (u64)D_L05_001613F8 | ((u64)D_L05_001613FC << 2) | - ((u64)D_L05_00161400 << 4) | ((u64)D_L05_00161404 << 6) | + glow_packet->flags = (u64)l05_scenery_ship_trail_blend_a_selector | ((u64)D_L05_001613FC << 2) | + ((u64)l05_scenery_ship_trail_blend_c_selector << 4) | ((u64)D_L05_00161404 << 6) | 0x8000000000ULL; phase = convert_integer_to_float((frame_number + 3) & 3) / (D_L05_001613E0 * 4.0f); for (j = 0; j < 4; j++) { From 9cc657206d57cad9e6f72733b5d1be7af4866ab8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:42:21 +0000 Subject: [PATCH 061/758] decomp: clarify names in update_child_set_poses D_L11_00161EC4 -> l11_child_set_fold_rotation_x_progress: Authoritative source SHA-256 bedd6a1aa9e5efc7146fce7a8a3dc0aa1a45bdba805e82ea5236c581f6662900 declares this zero-initialized float. Retail 0x0030d254 loads gp-0x4d3c, 0x0030d270 subtracts it from 1, and 0x0030d290-0x0030d2b4 scales the fold-degree offset and subtracts it from the child angle stored in rot.x at 0x0030d300. The second child set repeats the same progress use at 0x0030d3e4-0x0030d4ac. Original Ghidra fGpffffb2c4 agrees. Source controller resets it to zero, advances it toward one, and sets it to one for completed poses. D_L11_00161ECC -> l11_even_source_child_rotation_x_progress: Retail 0x0030d430-0x0030d440 sets k=+1 for even second-loop indices and -1 for odd indices; 0x0030d580-0x0030d594 selects gp-0x4d34 (this float) for k=+1, scaling the rotation difference before adding 1.3962634 and writing source child rot.x at 0x0030d5c0. Original Ghidra fGpffffb2cc and authoritative source r * ((k == -1) ? D_L11_00161EC8 : D_L11_00161ECC) agree. These D_L11_00161F20 children supply the next set's source poses. Controller resets this progress to zero and advances it toward one after EC8 exceeds 0.5. D_L11_00161ED4 -> l11_even_attached_child_rotation_y_progress: Retail 0x0030d66c tests attached-child index parity; the even branch at 0x0030d674 reaches 0x0030d684, loading gp-0x4d2c (this float). At 0x0030d688-0x0030d6a0 it scales the negative attached-child rotation-y degree offset converted to radians, then 0x0030d6a8 stores attached child rot.y. Original Ghidra fGpffffb2d4 and source rotation_y_progress = (attached_child_index & 1) ? D_L11_00161ED0 : D_L11_00161ED4 agree. Source controller resets it and advances toward one after ECC reaches one. D_L11_00161ED8 -> l11_final_child_axis0_spacing_progress: Retail 0x0030d730 loads gp-0x4d28 (this float); 0x0030d738-0x0030d744 computes parity*7.5+3.75+(1-progress)*13.25, followed by the cap at 20 and half-set sign. At 0x0030d768-0x0030d76c this determines the length along saved parent rot_row0, and 0x0030d770-0x0030d788 adds parent position into final child position. Original Ghidra fGpffffb2d8 agrees. Source controller resets this float, advances it toward one after ED4 exceeds 0.9, and uses its completion to control fade. --- .../l11/mobys/child_sets_controller.c | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/overlays/l11/mobys/child_sets_controller.c b/src/overlays/l11/mobys/child_sets_controller.c index 5fd7163bdf..1bb19b1d4f 100644 --- a/src/overlays/l11/mobys/child_sets_controller.c +++ b/src/overlays/l11/mobys/child_sets_controller.c @@ -31,12 +31,12 @@ struct Moby *l11_three_per_side_child_mobys[6] __asm__("D_L11_001DA710") = {0}; extern struct Moby *D_L11_00161F10[] MACRO_ADDR; extern struct Moby *D_L11_00161F20[] MACRO_ADDR; extern struct Moby *D_L11_00161F30[] MACRO_ADDR; -float D_L11_00161EC4 = 0; +float l11_child_set_fold_rotation_x_progress __asm__("D_L11_00161EC4") = 0; float D_L11_00161EC8 = 0; -float D_L11_00161ECC = 0; +float l11_even_source_child_rotation_x_progress __asm__("D_L11_00161ECC") = 0; float D_L11_00161ED0 = 0; -float D_L11_00161ED4 = 0; -float D_L11_00161ED8 = 0; +float l11_even_attached_child_rotation_y_progress __asm__("D_L11_00161ED4") = 0; +float l11_final_child_axis0_spacing_progress __asm__("D_L11_00161ED8") = 0; float D_L11_00161EDC = 0; float D_L11_00161EE0 = 0; float D_L11_00161EE4 = 0; @@ -85,12 +85,12 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { child_sets_controller->visible = 0; child_sets_controller->collision = 0; child_sets_controller->flags |= 1; - D_L11_00161EC4 = 0.0f; + l11_child_set_fold_rotation_x_progress = 0.0f; D_L11_00161EC8 = 0.0f; - D_L11_00161ECC = 0.0f; + l11_even_source_child_rotation_x_progress = 0.0f; D_L11_00161ED0 = 0.0f; - D_L11_00161ED4 = 0.0f; - D_L11_00161ED8 = 0.0f; + l11_even_attached_child_rotation_y_progress = 0.0f; + l11_final_child_axis0_spacing_progress = 0.0f; D_L11_00161EDC = 0.0f; child_sets_controller->command = 0; for (i = 0; i < 6; i++) { @@ -197,14 +197,14 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { } break; case CHILD_SETS_STATE_UNFOLD_AND_BLEND_POSES: - if (D_L11_00161EC4 < 1.0f) { + if (l11_child_set_fold_rotation_x_progress < 1.0f) { advance_accelerated_scalar( - &D_L11_00161EC4, &D_L11_00161EE0, 1.0f, frame_time_sq, frame_time_sq, frame_time); + &l11_child_set_fold_rotation_x_progress, &D_L11_00161EE0, 1.0f, frame_time_sq, frame_time_sq, frame_time); } - if (0.9f < D_L11_00161EC4 && D_L11_00161EC8 == 0.0f) { + if (0.9f < l11_child_set_fold_rotation_x_progress && D_L11_00161EC8 == 0.0f) { allocate_voice_for_target_entry(1, 0, child_sets_controller); } - if (0.9f < D_L11_00161EC4 && D_L11_00161EC8 < 1.0f) { + if (0.9f < l11_child_set_fold_rotation_x_progress && D_L11_00161EC8 < 1.0f) { advance_accelerated_scalar(&D_L11_00161EC8, &D_L11_00161EE4, 1.0f, @@ -212,11 +212,11 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { frame_time_sq + frame_time_sq, frame_time + frame_time); } - if (0.5f < D_L11_00161EC8 && D_L11_00161ECC == 0.0f) { + if (0.5f < D_L11_00161EC8 && l11_even_source_child_rotation_x_progress == 0.0f) { allocate_voice_for_target_entry(1, 0, child_sets_controller); } - if (0.5f < D_L11_00161EC8 && D_L11_00161ECC < 1.0f) { - advance_accelerated_scalar(&D_L11_00161ECC, + if (0.5f < D_L11_00161EC8 && l11_even_source_child_rotation_x_progress < 1.0f) { + advance_accelerated_scalar(&l11_even_source_child_rotation_x_progress, &D_L11_00161EE8, 1.0f, frame_time_sq + frame_time_sq, @@ -231,16 +231,16 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { frame_time_sq + frame_time_sq, frame_time + frame_time); } - if (1.0f <= D_L11_00161ECC && D_L11_00161ED4 < 1.0f) { - advance_accelerated_scalar(&D_L11_00161ED4, + if (1.0f <= l11_even_source_child_rotation_x_progress && l11_even_attached_child_rotation_y_progress < 1.0f) { + advance_accelerated_scalar(&l11_even_attached_child_rotation_y_progress, &D_L11_00161EF0, 1.0f, frame_time_sq + frame_time_sq, frame_time_sq + frame_time_sq, frame_time + frame_time); } - if (0.9f < D_L11_00161ED4 && D_L11_00161ED8 < 1.0f) { - advance_accelerated_scalar(&D_L11_00161ED8, + if (0.9f < l11_even_attached_child_rotation_y_progress && l11_final_child_axis0_spacing_progress < 1.0f) { + advance_accelerated_scalar(&l11_final_child_axis0_spacing_progress, &D_L11_00161EF4, 1.0f, frame_time_sq + frame_time_sq, @@ -251,7 +251,7 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { if (alternate_item_available[0x56] != 0 && ((u32)pad_pressed_lui) != 0) { child_sets_controller->command = 1; } - if (D_L11_00161ED8 < 1.0f && child_sets_controller->command == 0) { + if (l11_final_child_axis0_spacing_progress < 1.0f && child_sets_controller->command == 0) { approach_value(&child_sets_controller_vars->fade, 0.0f, frame_time * 4.0f); } else { approach_value(&child_sets_controller_vars->fade, 1.0f, frame_time * 4.0f); @@ -274,12 +274,12 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { set_camera_position(&pos); set_camera_rotation(&rot); if (1.0f <= child_sets_controller_vars->fade) { - D_L11_00161EC4 = 1.0f; + l11_child_set_fold_rotation_x_progress = 1.0f; D_L11_00161EC8 = 1.0f; - D_L11_00161ECC = 1.0f; + l11_even_source_child_rotation_x_progress = 1.0f; D_L11_00161ED0 = 1.0f; - D_L11_00161ED4 = 1.0f; - D_L11_00161ED8 = 1.0f; + l11_even_attached_child_rotation_y_progress = 1.0f; + l11_final_child_axis0_spacing_progress = 1.0f; update_child_set_poses(child_sets_controller); child_sets_controller->state = CHILD_SETS_STATE_FADE_AFTER_HERO_HANDOFF; jet_end_mount(3); @@ -330,7 +330,7 @@ void update_child_set_poses(struct Moby *parent_moby) { int s = (i >= 3) ? 1 : -1; float ang = (float)(i % 3) * 0.5235988f - - (child_set_fold_rotation_x_degrees_gp * (1.0f - D_L11_00161EC4) + 30.0f) * 0.017453292f; + (child_set_fold_rotation_x_degrees_gp * (1.0f - l11_child_set_fold_rotation_x_progress) + 30.0f) * 0.017453292f; qcopy_nc(&l11_three_per_side_child_mobys[i]->rot, &parent_moby->rot); l11_three_per_side_child_mobys[i]->rot.z = fast_add_rotations(l11_three_per_side_child_mobys[i]->rot.z, (float)s * 1.5707964f); @@ -359,7 +359,7 @@ void update_child_set_poses(struct Moby *parent_moby) { int k = (j & 1) ? -1 : 1; float ang = (float)(j % 2) * 0.5235988f - - (child_set_fold_rotation_x_degrees_gp * (1.0f - D_L11_00161EC4) + 15.0f) * 0.017453292f; + (child_set_fold_rotation_x_degrees_gp * (1.0f - l11_child_set_fold_rotation_x_progress) + 15.0f) * 0.017453292f; float r; qcopy_nc(&D_L11_00161F20[j]->rot, &parent_moby->rot); D_L11_00161F20[j]->rot.z = @@ -381,7 +381,7 @@ void update_child_set_poses(struct Moby *parent_moby) { &child_position_scratch, &child_position_scratch, &child_placement_vector_scratch); qcopy(&D_L11_00161F20[j]->pos, &child_position_scratch); r = fast_subtract_rotations((float)k * 0.2617994f, 1.3962634f); - r = r * ((k == -1) ? D_L11_00161EC8 : D_L11_00161ECC); + r = r * ((k == -1) ? D_L11_00161EC8 : l11_even_source_child_rotation_x_progress); r = fast_add_rotations(r, 1.3962634f); D_L11_00161F20[j]->rot.x = fast_add_rotations(D_L11_00161F20[j]->rot.x, r); update_entity(D_L11_00161F20[j]); @@ -402,7 +402,7 @@ void update_child_set_poses(struct Moby *parent_moby) { &child_placement_vector_scratch); qcopy(&D_L11_00161F30[attached_child_index]->rot, &D_L11_00161F20[attached_child_index]->rot); - rotation_y_progress = (attached_child_index & 1) ? D_L11_00161ED0 : D_L11_00161ED4; + rotation_y_progress = (attached_child_index & 1) ? D_L11_00161ED0 : l11_even_attached_child_rotation_y_progress; D_L11_00161F30[attached_child_index]->rot.y = fast_add_rotations( D_L11_00161F30[attached_child_index]->rot.y, -(attached_child_rotation_y_degrees_gp * 0.017453292f) * rotation_y_progress); @@ -416,7 +416,7 @@ void update_child_set_poses(struct Moby *parent_moby) { sgn = 1.0f; } signed_axis0_offset = - (float)(final_child_index & 1) * 7.5f + 3.75f + (1.0f - D_L11_00161ED8) * 13.25f; + (float)(final_child_index & 1) * 7.5f + 3.75f + (1.0f - l11_final_child_axis0_spacing_progress) * 13.25f; if (20.0f < signed_axis0_offset) { signed_axis0_offset = 20.0f; } From 120fce51d1d23990151c9c6584da5e216b3f5854 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:44:14 +0000 Subject: [PATCH 062/758] decomp: clarify names in update_pause_menu domain_5_value_10 -> PAUSE_MENU_STATE_CLOSE_ON_ACTION_ENTRY: Assigned retail 0x00276eb8-0x00276ebc compares the pause-menu state loaded from 0x001b9cf0 with 10 and branches to initialize_pause_menu at 0x00276eec. Bounded original retail helper 0x00276368 confirms that state 10 installs state 11 and page owner 0x001b3518. The authoritative initializer C names that exact owner l00_pause_menu_close_on_action_page_owner and state 11 PAUSE_MENU_STATE_CLOSE_ON_ACTION. Thus 10 is its entry state, within the same pause-menu selector domain, rather than HERO_STATE_PACK_JUMP. --- src/overlays/shared/ui/menus/initialize_pause_menu.c | 5 ++++- 1 file changed, 4 insertions(+), 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 f3d9c09100..9e35f4b55c 100644 --- a/src/overlays/shared/ui/menus/initialize_pause_menu.c +++ b/src/overlays/shared/ui/menus/initialize_pause_menu.c @@ -504,6 +504,9 @@ void close_pause_menu(void) { void update_pause_menu(void) __asm__("FUN_L00_00276bd0"); void update_pause_menu(void) { + enum { + PAUSE_MENU_STATE_CLOSE_ON_ACTION_ENTRY = 0xA + }; Own *owner; Own *u8p; Mth *active_callback_object; @@ -600,7 +603,7 @@ void update_pause_menu(void) { return; } scene_state = D_L00_001B9CF0.state; - if (scene_state == 0 || scene_state == 0xA || + if (scene_state == 0 || scene_state == PAUSE_MENU_STATE_CLOSE_ON_ACTION_ENTRY || scene_state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ENTRY || scene_state == 0x11 || scene_state == PAUSE_MENU_STATE_EXIT_GUARDED_ENTRY || scene_state == 0x2D || scene_state == PAUSE_MENU_STATE_PRESERVE_STATE_ENTRY) { From 830bc73557362949487ce86d3fd503406131939a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:46:39 +0000 Subject: [PATCH 063/758] decomp: clarify names in update_player_ship_flight D_L11_001620BC -> l11_jet_fighter_rotation_x_spring_error_gain: Retail 0x00312b2c loads gp-0x4b44 into f13 before angular spring call 0x00312b3c, updating ship_vars+0x30 with velocity +0x98 toward horizontal steering times D_L11_0016207C. Source uses +0x30 as flight rotation x and adds it to ship_moby->rot.x at 0x00312ef8..0x00312f0c. Checked angular wrapper 0x00281b38 saves incoming f13/f14 in f23/f20 at 0x00281b60/0x00281b7c and restores them to f13/f14 for the velocity-pointer call 0x00281c0c -> 0x00281638. Checked vendor_spring wrapper 0x00281760 forwards unchanged f13/f14 to the identical kernel at 0x00281794, with target-current error in f12 and velocity pointer in a0. Supplied established vendor_spring source names these same kernel arguments error_gain and damping_coefficient. Thus the corresponding angular coefficient role is supported without inferring the kernel equation. D_L11_001620C0 -> l11_jet_fighter_rotation_x_spring_damping_coefficient: Retail 0x00312b38 loads gp-0x4b40 into f14 before angular spring call 0x00312b3c, updating ship_vars+0x30 with velocity +0x98 toward horizontal steering times D_L11_0016207C. Source uses +0x30 as flight rotation x and adds it to ship_moby->rot.x at 0x00312ef8..0x00312f0c. Checked angular wrapper 0x00281b38 saves incoming f13/f14 in f23/f20 at 0x00281b60/0x00281b7c and restores them to f13/f14 for the velocity-pointer call 0x00281c0c -> 0x00281638. Checked vendor_spring wrapper 0x00281760 forwards unchanged f13/f14 to the identical kernel at 0x00281794, with target-current error in f12 and velocity pointer in a0. Supplied established vendor_spring source names these same kernel arguments error_gain and damping_coefficient. Thus the corresponding angular coefficient role is supported without inferring the kernel equation. D_L11_001620E0 -> l11_jet_fighter_camera_rotation_x_spring_error_gain: Retail 0x00312df4 loads gp-0x4b20 into f13 for angular spring call 0x00312e08 on ship_vars+0x20/+0xa0. Source targets camera rotation component 0; output +0x20 is copied to sp+0x70 at 0x00312e50/0x00312e60 for camera rotation setter 0x00312e78. Checked angular wrapper 0x00281b38 saves incoming f13/f14 in f23/f20 at 0x00281b60/0x00281b7c and restores them to f13/f14 for the velocity-pointer call 0x00281c0c -> 0x00281638. Checked vendor_spring wrapper 0x00281760 forwards unchanged f13/f14 to the identical kernel at 0x00281794, with target-current error in f12 and velocity pointer in a0. Supplied established vendor_spring source names these same kernel arguments error_gain and damping_coefficient. Thus the corresponding angular coefficient role is supported without inferring the kernel equation. D_L11_001620E4 -> l11_jet_fighter_camera_rotation_x_spring_damping_coefficient: Retail 0x00312dfc loads gp-0x4b1c into f14 for angular spring call 0x00312e08 on ship_vars+0x20/+0xa0. Source targets camera rotation component 0; output +0x20 is copied to sp+0x70 at 0x00312e50/0x00312e60 for camera rotation setter 0x00312e78. Checked angular wrapper 0x00281b38 saves incoming f13/f14 in f23/f20 at 0x00281b60/0x00281b7c and restores them to f13/f14 for the velocity-pointer call 0x00281c0c -> 0x00281638. Checked vendor_spring wrapper 0x00281760 forwards unchanged f13/f14 to the identical kernel at 0x00281794, with target-current error in f12 and velocity pointer in a0. Supplied established vendor_spring source names these same kernel arguments error_gain and damping_coefficient. Thus the corresponding angular coefficient role is supported without inferring the kernel equation. D_L11_001620EC -> l11_jet_fighter_camera_rotation_y_spring_error_gain: Retail 0x00312e18 loads gp-0x4b14 into f13 for angular spring call 0x00312e28 on ship_vars+0x24/+0xa4, targeting the pitch-derived camera angle. Output +0x24 minus +0xd8 becomes camera_rotation[1] at 0x00312e64..0x00312e78. Checked angular wrapper 0x00281b38 saves incoming f13/f14 in f23/f20 at 0x00281b60/0x00281b7c and restores them to f13/f14 for the velocity-pointer call 0x00281c0c -> 0x00281638. Checked vendor_spring wrapper 0x00281760 forwards unchanged f13/f14 to the identical kernel at 0x00281794, with target-current error in f12 and velocity pointer in a0. Supplied established vendor_spring source names these same kernel arguments error_gain and damping_coefficient. Thus the corresponding angular coefficient role is supported without inferring the kernel equation. D_L11_001620F0 -> l11_jet_fighter_camera_rotation_y_spring_damping_coefficient: Retail 0x00312e20 loads gp-0x4b10 into f14 for angular spring call 0x00312e28 on ship_vars+0x24/+0xa4, targeting the pitch-derived camera angle. Output +0x24 minus +0xd8 becomes camera_rotation[1] at 0x00312e64..0x00312e78. Checked angular wrapper 0x00281b38 saves incoming f13/f14 in f23/f20 at 0x00281b60/0x00281b7c and restores them to f13/f14 for the velocity-pointer call 0x00281c0c -> 0x00281638. Checked vendor_spring wrapper 0x00281760 forwards unchanged f13/f14 to the identical kernel at 0x00281794, with target-current error in f12 and velocity pointer in a0. Supplied established vendor_spring source names these same kernel arguments error_gain and damping_coefficient. Thus the corresponding angular coefficient role is supported without inferring the kernel equation. D_L11_001620F8 -> l11_jet_fighter_camera_rotation_z_spring_error_gain: Retail 0x00312e4c loads gp-0x4b08 into f13 in the delay slot of angular spring call 0x00312e48 on ship_vars+0x28/+0xa8, targeting flight heading +0x38. Output +0x28 minus +0xd4 becomes camera_rotation[2] at 0x00312e54..0x00312e70 before setter 0x00312e78. Checked angular wrapper 0x00281b38 saves incoming f13/f14 in f23/f20 at 0x00281b60/0x00281b7c and restores them to f13/f14 for the velocity-pointer call 0x00281c0c -> 0x00281638. Checked vendor_spring wrapper 0x00281760 forwards unchanged f13/f14 to the identical kernel at 0x00281794, with target-current error in f12 and velocity pointer in a0. Supplied established vendor_spring source names these same kernel arguments error_gain and damping_coefficient. Thus the corresponding angular coefficient role is supported without inferring the kernel equation. D_L11_001620FC -> l11_jet_fighter_camera_rotation_z_spring_damping_coefficient: Retail 0x00312e38 loads gp-0x4b04 into f14 for angular spring call 0x00312e48 on ship_vars+0x28/+0xa8, targeting flight heading +0x38. Output +0x28 minus +0xd4 becomes camera_rotation[2] at 0x00312e54..0x00312e70 before setter 0x00312e78. Checked angular wrapper 0x00281b38 saves incoming f13/f14 in f23/f20 at 0x00281b60/0x00281b7c and restores them to f13/f14 for the velocity-pointer call 0x00281c0c -> 0x00281638. Checked vendor_spring wrapper 0x00281760 forwards unchanged f13/f14 to the identical kernel at 0x00281794, with target-current error in f12 and velocity pointer in a0. Supplied established vendor_spring source names these same kernel arguments error_gain and damping_coefficient. Thus the corresponding angular coefficient role is supported without inferring the kernel equation. --- src/overlays/l11/mobys/jet_fighter.c | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/l11/mobys/jet_fighter.c b/src/overlays/l11/mobys/jet_fighter.c index 6c50ddd2f2..0a2d5e6fac 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -797,23 +797,23 @@ extern float l11_jet_fighter_vertical_steering_spring_damping_coefficient __asm_ #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_9.h" -extern float D_L11_001620BC __attribute__((sda)); -extern float D_L11_001620C0 __attribute__((sda)); +extern float l11_jet_fighter_rotation_x_spring_error_gain __asm__("D_L11_001620BC") __attribute__((sda)); +extern float l11_jet_fighter_rotation_x_spring_damping_coefficient __asm__("D_L11_001620C0") __attribute__((sda)); #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_8.h" -extern float D_L11_001620E0 __attribute__((sda)); -extern float D_L11_001620E4 __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_x_spring_error_gain __asm__("D_L11_001620E0") __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_x_spring_damping_coefficient __asm__("D_L11_001620E4") __attribute__((sda)); #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_7.h" -extern float D_L11_001620EC __attribute__((sda)); -extern float D_L11_001620F0 __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_y_spring_error_gain __asm__("D_L11_001620EC") __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_y_spring_damping_coefficient __asm__("D_L11_001620F0") __attribute__((sda)); #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_6.h" -extern float D_L11_001620F8 __attribute__((sda)); -extern float D_L11_001620FC __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_z_spring_error_gain __asm__("D_L11_001620F8") __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_z_spring_damping_coefficient __asm__("D_L11_001620FC") __attribute__((sda)); #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_5.h" @@ -986,8 +986,8 @@ void update_player_ship_flight(struct Moby *ship_moby, ShipVars_2838 *ship_vars) &ship_vars->f98, 0, ship_vars->f6C * D_L11_0016207C, - D_L11_001620BC, - D_L11_001620C0, + l11_jet_fighter_rotation_x_spring_error_gain, + l11_jet_fighter_rotation_x_spring_damping_coefficient, jet_fighter_rotation_x_snap_threshold_scale_gp); ship_vars->f34 = fast_subtract_rotations(ship_vars->f34, ship_vars->f70 * D_L11_00162014); if (ship_vars->f34 > 1.3962634f) { @@ -1066,22 +1066,22 @@ void update_player_ship_flight(struct Moby *ship_moby, ShipVars_2838 *ship_vars) &ship_vars->fA0, 0, wr.e[1].v[0], - D_L11_001620E0, - D_L11_001620E4, + l11_jet_fighter_camera_rotation_x_spring_error_gain, + l11_jet_fighter_camera_rotation_x_spring_damping_coefficient, jet_fighter_camera_rotation_x_snap_threshold_scale_gp); spring_angle(&ship_vars->f24, &ship_vars->fA4, 0, wr.e[1].v[1], - D_L11_001620EC, - D_L11_001620F0, + l11_jet_fighter_camera_rotation_y_spring_error_gain, + l11_jet_fighter_camera_rotation_y_spring_damping_coefficient, jet_fighter_camera_rotation_y_snap_threshold_scale_gp); spring_angle(&ship_vars->f28, &ship_vars->fA8, 0, wr.e[1].v[2], - D_L11_001620F8, - D_L11_001620FC, + l11_jet_fighter_camera_rotation_z_spring_error_gain, + l11_jet_fighter_camera_rotation_z_spring_damping_coefficient, jet_fighter_camera_rotation_z_snap_threshold_scale_gp); } camera_rotation[0] = ship_vars->f20; From 4f13b8deac6b04911f8e3988f60ed423333c7044 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:48:25 +0000 Subject: [PATCH 064/758] decomp: clarify names in update_blarg_paratrooper_damage_and_state domain_0_value_1 -> PARATROOPER_HIT_STATUS_NO_HIT_OR_SUPPRESSED: Root 00302618 passes sp+0x50 as t0 to resolve_moby_hit_response at 00302624; 0030262c-00302634 loads that hit_state output and branches past health subtraction/reaction handling when it is 1. Checked level-08 resolver 002649b8 saves t0 in s3, independently of its reaction return in v0. The null descriptor path 00264ab8-00264af0 writes 1 through s3 at 00264adc, clears damage at 00264ae8 and returns reaction 11. The cooldown/flag suppression path 00264e74-00264e88 likewise writes 1 through s3 at 00264e80 and zeros descriptor damage before copying it to the damage output at 00264eb0-00264eb4. Thus this constant denotes no hit or a suppressed hit, not lethal reaction 1 or a 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 1caba00cd1..85f2a49178 100644 --- a/src/overlays/shared/enemies/blarg_paratrooper.c +++ b/src/overlays/shared/enemies/blarg_paratrooper.c @@ -617,6 +617,9 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { PARATROOPER_STATE_KNOCKBACK_RECOVERY = 10, PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE = 11 }; + enum { + PARATROOPER_HIT_STATUS_NO_HIT_OR_SUPPRESSED = 1 + }; Paratrooper302618 *paratrooper_instance_state; char *target, *child, *attached, *chased; float pos[4] __attribute__((aligned(16))); @@ -660,7 +663,7 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { target = find_moby_hit(moby, 0x330000, 0); reaction = resolve_moby_hit_response( moby, target, ¶trooper_instance_state->health, 0, &hit_state, &damage, 0, 4); - if (hit_state != 1 && MOBY(moby)->state != PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE) { + if (hit_state != PARATROOPER_HIT_STATUS_NO_HIT_OR_SUPPRESSED && MOBY(moby)->state != PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE) { { float health = paratrooper_instance_state->health - damage; paratrooper_instance_state->health = health; From 2403e695f467235cd817b0eee96ae54a77906024 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:50:48 +0000 Subject: [PATCH 065/758] decomp: clarify names in child_sets_controller_update D_L11_00161EDC -> l11_child_sets_camera_pose_blend_progress: Source snapshot d0e17c75916c45065f47ad197ac529066e060de3efd1c053498f4547cb9f4a34 declares this zero-initialized float and resets it in CREATE_CHILDREN (retail 0030c834). Retail 0030d028 passes gp-0x4d24 as current scalar targeting 1 at 0030d054; 0030d078/0030d0b0 load it as both lerp weights between from/to cuboid +0x30/+0x70 vectors. Outputs go to set_camera_position and set_camera_rotation at 0030d0c8/0030d0d0, proving shared camera pose blend progress. D_L11_00161EE0 -> l11_child_set_fold_rotation_x_progress_step: Retail 0030cd0c/0030cd18 pairs gp-0x4d3c (existing l11_child_set_fold_rotation_x_progress) with gp-0x4d20 as a0/a1 for 0030cd1c. Source update_child_set_poses and checked 0030d254..0030d300 consume the paired progress in the common child rotation X fold calculation. The checked level-11 helper preserves a1 in s0 (00281824), adjusts *s0 through approach_value (00281928/0028193c), then adds *s0 directly to *s1 (00281968..00281978 and 00281994..002819a0). Thus this persistent float is a progress step per update, not an angle or acceleration. D_L11_00161EE4 -> l11_odd_source_child_rotation_x_progress_step: Retail 0030cdac/0030cdb8 passes gp-0x4d38 and gp-0x4d1c to 0030cdc4. The source pose loop selects D_L11_00161EC8 when j&1 is nonzero (k=-1); checked 0030d430..0030d440 and 0030d580..0030d594 select this progress for odd source children. The scaled rotation is added and stored to source child +0x40 (rotation X) at 0030d5b4..0030d5c0. The checked level-11 helper preserves a1 in s0 (00281824), adjusts *s0 through approach_value (00281928/0028193c), then adds *s0 directly to *s1 (00281968..00281978 and 00281994..002819a0). Thus this persistent float is a progress step per update, not an angle or acceleration. D_L11_00161EE8 -> l11_even_source_child_rotation_x_progress_step: Retail 0030ce4c/0030ce58 pairs gp-0x4d34 (existing l11_even_source_child_rotation_x_progress) with gp-0x4d18 for 0030ce64. The source and checked pose consumer 0030d430..0030d440, 0030d580..0030d594 select this progress for even source indices, scaling the rotation X addition stored at 0030d5c0. The checked level-11 helper preserves a1 in s0 (00281824), adjusts *s0 through approach_value (00281928/0028193c), then adds *s0 directly to *s1 (00281968..00281978 and 00281994..002819a0). Thus this persistent float is a progress step per update, not an angle or acceleration. D_L11_00161EEC -> l11_odd_attached_child_rotation_y_progress_step: Retail 0030ce9c/0030cea8 pairs gp-0x4d30 with gp-0x4d14 at 0030ceb4. Source pose loop selects D_L11_00161ED0 for attached_child_index&1. Checked 0030d66c..0030d684 selects gp-0x4d30 for odd attached children; 0030d688..0030d6a8 scales the rotation Y offset and stores child +0x44. The checked level-11 helper preserves a1 in s0 (00281824), adjusts *s0 through approach_value (00281928/0028193c), then adds *s0 directly to *s1 (00281968..00281978 and 00281994..002819a0). Thus this persistent float is a progress step per update, not an angle or acceleration. D_L11_00161EF0 -> l11_even_attached_child_rotation_y_progress_step: Retail 0030ceec/0030cef8 pairs gp-0x4d2c (existing l11_even_attached_child_rotation_y_progress) with gp-0x4d10 at 0030cf04. Source pose loop and checked 0030d66c..0030d684 select that progress for even attached children; 0030d688..0030d6a8 multiplies it into the rotation Y offset stored at child +0x44. The checked level-11 helper preserves a1 in s0 (00281824), adjusts *s0 through approach_value (00281928/0028193c), then adds *s0 directly to *s1 (00281968..00281978 and 00281994..002819a0). Thus this persistent float is a progress step per update, not an angle or acceleration. D_L11_00161EF4 -> l11_final_child_axis0_spacing_progress_step: Retail 0030cf4c/0030cf58 pairs gp-0x4d28 (existing l11_final_child_axis0_spacing_progress) with gp-0x4d0c at 0030cf6c. Source final child loop and checked 0030d730..0030d76c use 1-progress in the clamped signed spacing along parent axis0 before writing final child positions. The checked level-11 helper preserves a1 in s0 (00281824), adjusts *s0 through approach_value (00281928/0028193c), then adds *s0 directly to *s1 (00281968..00281978 and 00281994..002819a0). Thus this persistent float is a progress step per update, not an angle or acceleration. D_L11_00161EF8 -> l11_child_sets_camera_pose_blend_progress_step: Retail 0030d01c supplies gp-0x4d08 as a1 while 0030d028 supplies gp-0x4d24 as a0 at 0030d054. The paired current scalar supplies both cuboid pose lerp weights at 0030d078/0030d0b0 and the resulting vectors reach the camera setters at 0030d0c8/0030d0d0. The checked level-11 helper preserves a1 in s0 (00281824), adjusts *s0 through approach_value (00281928/0028193c), then adds *s0 directly to *s1 (00281968..00281978 and 00281994..002819a0). Thus this persistent float is a progress step per update, not an angle or acceleration. --- .../l11/mobys/child_sets_controller.c | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/overlays/l11/mobys/child_sets_controller.c b/src/overlays/l11/mobys/child_sets_controller.c index 1bb19b1d4f..fac074eeb3 100644 --- a/src/overlays/l11/mobys/child_sets_controller.c +++ b/src/overlays/l11/mobys/child_sets_controller.c @@ -37,14 +37,14 @@ float l11_even_source_child_rotation_x_progress __asm__("D_L11_001 float D_L11_00161ED0 = 0; float l11_even_attached_child_rotation_y_progress __asm__("D_L11_00161ED4") = 0; float l11_final_child_axis0_spacing_progress __asm__("D_L11_00161ED8") = 0; -float D_L11_00161EDC = 0; -float D_L11_00161EE0 = 0; -float D_L11_00161EE4 = 0; -float D_L11_00161EE8 = 0; -float D_L11_00161EEC = 0; -float D_L11_00161EF0 = 0; -float D_L11_00161EF4 = 0; -float D_L11_00161EF8 = 0; +float l11_child_sets_camera_pose_blend_progress __asm__("D_L11_00161EDC") = 0; +float l11_child_set_fold_rotation_x_progress_step __asm__("D_L11_00161EE0") = 0; +float l11_odd_source_child_rotation_x_progress_step __asm__("D_L11_00161EE4") = 0; +float l11_even_source_child_rotation_x_progress_step __asm__("D_L11_00161EE8") = 0; +float l11_odd_attached_child_rotation_y_progress_step __asm__("D_L11_00161EEC") = 0; +float l11_even_attached_child_rotation_y_progress_step __asm__("D_L11_00161EF0") = 0; +float l11_final_child_axis0_spacing_progress_step __asm__("D_L11_00161EF4") = 0; +float l11_child_sets_camera_pose_blend_progress_step __asm__("D_L11_00161EF8") = 0; extern float D_L11_0015F3FC; extern int D_L11_0015FFD8_c788 __asm__("D_L11_0015FFD8"); @@ -91,7 +91,7 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { D_L11_00161ED0 = 0.0f; l11_even_attached_child_rotation_y_progress = 0.0f; l11_final_child_axis0_spacing_progress = 0.0f; - D_L11_00161EDC = 0.0f; + l11_child_sets_camera_pose_blend_progress = 0.0f; child_sets_controller->command = 0; for (i = 0; i < 6; i++) { l11_three_per_side_child_mobys[i] = create_moby(0x480); @@ -199,14 +199,14 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { case CHILD_SETS_STATE_UNFOLD_AND_BLEND_POSES: if (l11_child_set_fold_rotation_x_progress < 1.0f) { advance_accelerated_scalar( - &l11_child_set_fold_rotation_x_progress, &D_L11_00161EE0, 1.0f, frame_time_sq, frame_time_sq, frame_time); + &l11_child_set_fold_rotation_x_progress, &l11_child_set_fold_rotation_x_progress_step, 1.0f, frame_time_sq, frame_time_sq, frame_time); } if (0.9f < l11_child_set_fold_rotation_x_progress && D_L11_00161EC8 == 0.0f) { allocate_voice_for_target_entry(1, 0, child_sets_controller); } if (0.9f < l11_child_set_fold_rotation_x_progress && D_L11_00161EC8 < 1.0f) { advance_accelerated_scalar(&D_L11_00161EC8, - &D_L11_00161EE4, + &l11_odd_source_child_rotation_x_progress_step, 1.0f, frame_time_sq + frame_time_sq, frame_time_sq + frame_time_sq, @@ -217,7 +217,7 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { } if (0.5f < D_L11_00161EC8 && l11_even_source_child_rotation_x_progress < 1.0f) { advance_accelerated_scalar(&l11_even_source_child_rotation_x_progress, - &D_L11_00161EE8, + &l11_even_source_child_rotation_x_progress_step, 1.0f, frame_time_sq + frame_time_sq, frame_time_sq + frame_time_sq, @@ -225,7 +225,7 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { } if (1.0f <= D_L11_00161EC8 && D_L11_00161ED0 < 1.0f) { advance_accelerated_scalar(&D_L11_00161ED0, - &D_L11_00161EEC, + &l11_odd_attached_child_rotation_y_progress_step, 1.0f, frame_time_sq + frame_time_sq, frame_time_sq + frame_time_sq, @@ -233,7 +233,7 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { } if (1.0f <= l11_even_source_child_rotation_x_progress && l11_even_attached_child_rotation_y_progress < 1.0f) { advance_accelerated_scalar(&l11_even_attached_child_rotation_y_progress, - &D_L11_00161EF0, + &l11_even_attached_child_rotation_y_progress_step, 1.0f, frame_time_sq + frame_time_sq, frame_time_sq + frame_time_sq, @@ -241,7 +241,7 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { } if (0.9f < l11_even_attached_child_rotation_y_progress && l11_final_child_axis0_spacing_progress < 1.0f) { advance_accelerated_scalar(&l11_final_child_axis0_spacing_progress, - &D_L11_00161EF4, + &l11_final_child_axis0_spacing_progress_step, 1.0f, frame_time_sq + frame_time_sq, frame_time_sq * 4.0f, @@ -257,8 +257,8 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { approach_value(&child_sets_controller_vars->fade, 1.0f, frame_time * 4.0f); } D_L11_0015F3FC = child_sets_controller_vars->fade; - advance_accelerated_scalar(&D_L11_00161EDC, - &D_L11_00161EF8, + advance_accelerated_scalar(&l11_child_sets_camera_pose_blend_progress, + &l11_child_sets_camera_pose_blend_progress_step, 1.0f, frame_time_sq * 0.2f, frame_time_sq * 0.2f, @@ -266,11 +266,11 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { lerp_vector(&pos, (char *)((int)l11_cuboids + (child_sets_controller_vars->from << 7)) + 0x30, (char *)((int)l11_cuboids + (child_sets_controller_vars->to << 7)) + 0x30, - D_L11_00161EDC); + l11_child_sets_camera_pose_blend_progress); lerp_vector(&rot, (char *)((int)l11_cuboids + (child_sets_controller_vars->from << 7)) + 0x70, (char *)((int)l11_cuboids + (child_sets_controller_vars->to << 7)) + 0x70, - D_L11_00161EDC); + l11_child_sets_camera_pose_blend_progress); set_camera_position(&pos); set_camera_rotation(&rot); if (1.0f <= child_sets_controller_vars->fade) { From 19e64076e3090203f3b28e1c1207e394c1b827da Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:52:49 +0000 Subject: [PATCH 066/758] decomp: clarify names in frog_update domain_10_value_7 -> FROG_STATE_LANDING_ANIMATION: 0x002e8c84..0x002e8ccc tests motion contact bit 1 and stores 7 to the same Moby+0x20 dispatch byte, then selects animation 3 and snaps ground Z; existing case 7 waits for animation completion. domain_11_value_7 -> FROG_STATE_LANDING_ANIMATION: 0x002e8ca4..0x002e8ccc advances airborne motion and on contact bit 1 stores 7 to Moby+0x20, selects animation 3 and ground Z; the existing state-7 case waits for this landing animation. domain_12_value_8 -> FROG_STATE_WANDER: 0x002e8d34..0x002e8d50 tests animation completion then stores 8 to Moby+0x20 and blends animation 4; existing case 8 performs home-centered wandering. domain_13_value_9 -> FROG_STATE_APPROACH_TARGET: 0x002e8ea0..0x002e8f10 selects 9 when pursuit mode permits and the random test succeeds, storing a randomized turn angle; existing case 9 moves toward the target heading plus that angle. domain_14_value_10 -> FROG_STATE_BLINKING_APPROACH_TARGET: 0x002e8ee0..0x002e8f10 requires nonzero blink timer at pvars+0x1E8 then stores 10 to Moby+0x20; existing case 10 approaches the target while checking that same blink timer and path proximity. domain_15_value_12 -> FROG_STATE_ATTACK: 0x002e8fd8..0x002e900c stores 12 to Moby+0x20 when target XY distance is below 2 and starts animation 5; existing state 12 faces target and performs the attack-window sphere query. domain_16_value_13 -> FROG_STATE_RETURN_HOME: 0x002e9034..0x002e9048 branches to the state-13 store when target mode becomes 2; existing case 13 moves toward saved home at pvars+0x210. domain_17_value_13 -> FROG_STATE_RETURN_HOME: 0x002e9148..0x002e9158 stores 13 to Moby+0x20 when blink timer expires; existing case 13 computes its facing vector from saved home minus current position. domain_18_value_11 -> FROG_STATE_APPROACH_PAUSE: 0x002e915c..0x002e9170 stores 11 to Moby+0x20 after the successful nearby path query and blends animation 6; existing case 11 waits for animation completion before resuming blinking approach. domain_19_value_12 -> FROG_STATE_ATTACK: 0x002e918c..0x002e91c0 stores 12 to Moby+0x20 when target XY distance is below 2 and starts animation 5; existing state 12 implements the target-facing attack window. domain_20_value_10 -> FROG_STATE_BLINKING_APPROACH_TARGET: 0x002e91dc..0x002e91f8 stores 10 to Moby+0x20 when pause animation completes; existing case 10 resumes target approach under the blink timer. domain_21_value_9 -> FROG_STATE_APPROACH_TARGET: 0x002e9340..0x002e9378 requires attack animation completion and target distance above 2, then selects 9 for the Moby+0x20 store; existing state 9 approaches target. domain_22_value_8 -> FROG_STATE_WANDER: 0x002e93f0..0x002e9424 selects 8 for Moby+0x20 when home XY distance is below 2; existing case 8 wanders about that saved home. domain_23_value_9 -> FROG_STATE_APPROACH_TARGET: 0x002e9450..0x002e9464 stores 9 to Moby+0x20 if target mode no longer equals 2; existing state 9 follows the target heading. domain_24_value_10 -> FROG_STATE_BLINKING_APPROACH_TARGET: 0x002e9468..0x002e9478 requires nonzero blink timer then stores 10 to Moby+0x20; existing state 10 implements blinking target approach using that timer. domain_25_value_8 -> FROG_STATE_WANDER: 0x002e947c..0x002e9498 calls the held-motion helper and on success stores 8 to Moby+0x20; existing state 8 is wandering, also used on suction release by the same-file grab/storage helpers. domain_2_value_16 -> FROG_STATE_SUCK_CANNON_HELD: 0x002e8718..0x002e8720 compares the same Moby+0x20 state byte used by the dispatch at 0x002e87b0..0x002e87d4; state 16 is the existing suck-cannon-held case and bypasses the phase gate. domain_3_value_1 -> FROG_STATE_WAIT_WITH_CHILD: 0x002e88e8 stores 1 to Moby+0x20 immediately before creating class 500 and storing the child at pvars+0x20C; the existing state-1 case waits for target proximity then destroys that child. domain_4_value_15 -> FROG_STATE_RESPAWN: 0x002e895c..0x002e8980 stores 15 to Moby+0x20, clears collision and applies hidden flags when pvars+0x202 is nonzero. The same C file's health/respawn helper assigns its existing FROG_STATE_RESPAWN=15 to the same Moby state with identical collision/flag behavior after restoring health and spawn position. domain_5_value_3 -> FROG_STATE_WAIT_TO_FOLLOW_PATH: 0x002e8984..0x002e8998 selects state 3 for nonnegative path_index; the existing state-3 case faces the target and waits for its distance gate before entering FOLLOW_PATH. domain_6_value_8 -> FROG_STATE_WANDER: 0x002e89a8..0x002e89b8 stores 8 to Moby+0x20 when no path is assigned and selects animation 4; existing state 8 chooses random destinations around saved home. domain_7_value_8 -> FROG_STATE_WANDER: 0x002e8a0c..0x002e8a24 destroys the carried child and stores 8 to Moby+0x20; the existing state-8 dispatch wanders among random offsets about home. domain_8_value_4 -> FROG_STATE_FOLLOW_PATH: 0x002e8a70..0x002e8a90 passes the distance gate and stores 4 to Moby+0x20; existing case 4 loads the indexed path point and advances path_point. domain_9_value_5 -> FROG_STATE_JUMP_TO_HOME: 0x002e8ba8..0x002e8c64 copies the final path point to home, computes trajectory speed and height, initializes motion at pvars+0x120, then stores 5 to Moby+0x20; existing case 5 advances that homeward jump. --- src/overlays/shared/enemies/frog.c | 51 ++++++++++++++++-------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index 924567c4f7..dd8584bfb3 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -262,6 +262,9 @@ void frog_update(unsigned char *moby) __asm__("FUN_L06_002e8678"); /* Moby class 827 */ void frog_update(unsigned char *moby) { + enum { + FROG_STATE_RESPAWN = 0xF + }; float A[4] __attribute__((aligned(16))); float B[4] __attribute__((aligned(16))); float C[4] __attribute__((aligned(16))); @@ -282,7 +285,7 @@ void frog_update(unsigned char *moby) { frog_instance_vars->unk1EA = 0; MOBY(moby)->flags &= 0xFFBE; } - if (MOBY(moby)->state != 0x10) { + if (MOBY(moby)->state != FROG_STATE_SUCK_CANNON_HELD) { if (*(int *)&D_L06_0015FDF8 != 0) { if (frog_instance_vars->unk242 == 0) return; @@ -326,7 +329,7 @@ void frog_update(unsigned char *moby) { frog_instance_vars->unk29 = 1; if (frog_instance_vars->unk200 != 0) { char *child; - MOBY(moby)->state = 1; + MOBY(moby)->state = FROG_STATE_WAIT_WITH_CHILD; child = create_moby(0x1F4); frog_instance_vars->child = child; if (child == 0) { @@ -345,15 +348,15 @@ void frog_update(unsigned char *moby) { update_entity(frog_instance_vars->child); MOBY(moby)->flags |= 0x41; } else if (frog_instance_vars->unk202 != 0) { - MOBY(moby)->state = 0xF; + MOBY(moby)->state = FROG_STATE_RESPAWN; MOBY(moby)->collision = 0; MOBY(moby)->flags = (MOBY(moby)->flags | 0x41) & 0xEFFF; } else if (frog_instance_vars->path_index >= 0) { - MOBY(moby)->state = 3; + MOBY(moby)->state = FROG_STATE_WAIT_TO_FOLLOW_PATH; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, 0); } else { - MOBY(moby)->state = 8; + MOBY(moby)->state = FROG_STATE_WANDER; if (MOBY(moby)->prev_seq != 4) blend_moby_animation( moby, @@ -368,7 +371,7 @@ void frog_update(unsigned char *moby) { if (vector_distance_xy(&MOBY(moby)->pos, target + 0x10) < 4.0f) { MOBY(moby)->flags &= 0xFFBE; destroy_frog_child_moby(moby); - MOBY(moby)->state = 8; + MOBY(moby)->state = FROG_STATE_WANDER; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(5)); } @@ -379,7 +382,7 @@ void frog_update(unsigned char *moby) { blend_frog_rotation_to_facing_frame((char *)moby, (float *)D_L06_00174600, A); if (vector_distance_xy(((char *)&D_0013F3D0), &MOBY(moby)->pos) < frog_instance_vars->unk24C) { - MOBY(moby)->state = 4; + MOBY(moby)->state = FROG_STATE_FOLLOW_PATH; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(5)); } @@ -425,7 +428,7 @@ void frog_update(unsigned char *moby) { 0, fast_arc_tan(frog_instance_vars->unk210[0] - MOBY(moby)->pos.x, frog_instance_vars->unk210[1] - MOBY(moby)->pos.y)); - MOBY(moby)->state = 5; + MOBY(moby)->state = FROG_STATE_JUMP_TO_HOME; } break; } @@ -434,7 +437,7 @@ void frog_update(unsigned char *moby) { blend_frog_rotation_to_facing_frame( (char *)moby, A, (float *)(&frog_instance_vars->motion)); if (step_moby_motion(moby, &frog_instance_vars->motion) & 1) { - MOBY(moby)->state = 7; + MOBY(moby)->state = FROG_STATE_LANDING_ANIMATION; if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, 1); MOBY(moby)->anim_time = 1.0f; @@ -444,7 +447,7 @@ void frog_update(unsigned char *moby) { case FROG_STATE_AIRBORNE_MOTION: { int hit = step_moby_motion(moby, &frog_instance_vars->motion); if (hit & 1) { - MOBY(moby)->state = 7; + MOBY(moby)->state = FROG_STATE_LANDING_ANIMATION; if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, 1); MOBY(moby)->anim_time = 1.0f; @@ -458,7 +461,7 @@ void frog_update(unsigned char *moby) { } case FROG_STATE_LANDING_ANIMATION: if (MOBY(moby)->anim_flags & 2) { - MOBY(moby)->state = 8; + MOBY(moby)->state = FROG_STATE_WANDER; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(5)); } @@ -487,7 +490,7 @@ void frog_update(unsigned char *moby) { random_float_between(-frog_instance_vars->turn_range_degrees, frog_instance_vars->turn_range_degrees) * 0.017453292f; - MOBY(moby)->state = 9; + MOBY(moby)->state = FROG_STATE_APPROACH_TARGET; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, 0); } else if (frog_instance_vars->unk1E8 != 0) { @@ -495,7 +498,7 @@ void frog_update(unsigned char *moby) { random_float_between(-frog_instance_vars->turn_range_degrees, frog_instance_vars->turn_range_degrees) * 0.017453292f; - MOBY(moby)->state = 10; + MOBY(moby)->state = FROG_STATE_BLINKING_APPROACH_TARGET; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, 0); } @@ -513,11 +516,11 @@ void frog_update(unsigned char *moby) { fast_vec_normalize(A, moby + 0xC0, frog_instance_vars->unk1E4 * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, A, 1, 0.3f, 0.3f); if (vector_distance_xy(&MOBY(moby)->pos, target + 0x10) < 2.0f) { - MOBY(moby)->state = 0xC; + 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->unk1C4 == 2) { - MOBY(moby)->state = 0xD; + MOBY(moby)->state = FROG_STATE_RETURN_HOME; } break; } @@ -541,13 +544,13 @@ void frog_update(unsigned char *moby) { near = 1; } if (frog_instance_vars->unk1E8 == 0) { - MOBY(moby)->state = 0xD; + MOBY(moby)->state = FROG_STATE_RETURN_HOME; } else if (near) { - MOBY(moby)->state = 0xB; + MOBY(moby)->state = FROG_STATE_APPROACH_PAUSE; if (MOBY(moby)->prev_seq != 6) blend_moby_animation(moby, 6, 0, scale_game_frames(10)); } else if (vector_distance_xy(&MOBY(moby)->pos, target + 0x10) < 2.0f) { - MOBY(moby)->state = 0xC; + MOBY(moby)->state = FROG_STATE_ATTACK; if (MOBY(moby)->prev_seq != 5) blend_moby_animation(moby, 5, 0, scale_game_frames(10)); } @@ -555,7 +558,7 @@ void frog_update(unsigned char *moby) { } case FROG_STATE_APPROACH_PAUSE: if (MOBY(moby)->anim_flags & 2) { - MOBY(moby)->state = 0xA; + MOBY(moby)->state = FROG_STATE_BLINKING_APPROACH_TARGET; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(20)); } @@ -581,7 +584,7 @@ void frog_update(unsigned char *moby) { } if ((MOBY(moby)->anim_flags & 2) && vector_distance_xy(&MOBY(moby)->pos, target + 0x10) > 2.0f) { - MOBY(moby)->state = 9; + MOBY(moby)->state = FROG_STATE_APPROACH_TARGET; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(10)); } @@ -594,18 +597,18 @@ void frog_update(unsigned char *moby) { fast_vec_normalize(A, moby + 0xC0, frog_instance_vars->unk1E4 * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, A, 1, 0.3f, 0.3f); if (vector_distance_xy(&MOBY(moby)->pos, &frog_instance_vars->unk210) < 2.0f) { - MOBY(moby)->state = 8; + 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->unk1C4 != 2) { - MOBY(moby)->state = 9; + MOBY(moby)->state = FROG_STATE_APPROACH_TARGET; } else if (frog_instance_vars->unk1E8 != 0) { - MOBY(moby)->state = 0xA; + MOBY(moby)->state = FROG_STATE_BLINKING_APPROACH_TARGET; } break; case FROG_STATE_SUCK_CANNON_HELD: if (FUN_L00_002dc9f0(moby, &frog_instance_vars->motion) != 0) { - MOBY(moby)->state = 8; + MOBY(moby)->state = FROG_STATE_WANDER; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); frog_instance_vars->unkC8 = 0; From c9a98ccbe603292501cbed2bb185d497b80845ca Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:52:50 +0000 Subject: [PATCH 067/758] decomp: clarify names in large_amoeboid_update domain_0_value_12 -> LARGE_AMOEBOID_DORMANT: Bound C and original retail decompilation agree: 002edca4..002edce8 compares moby+0x20 with 12, sets flag bit 0 and returns; initialization 002edf78..002edfc0 selects 12 when activation-volume index is -1 and disables visibility/collision. Supplied activate_smaller_amoeboid explicitly names that same smaller moby's state 12 LARGE_AMOEBOID_DORMANT and reactivates it. domain_10_value_16 -> LARGE_AMOEBOID_WAIT_WHILE_BLOCKED: Bound C and original retail decompilation agree: 002ee360..002ee39c detects a route point within 1.5 and sets blocked; 002ee3b4..002ee3c4 writes 16 into moby+0x20. Existing case 16 at 002ee43c..002ee470 waits on animation completion and timer before returning. domain_11_value_6 -> LARGE_AMOEBOID_LUNGE_AT_TARGET: Bound C and original retail decompilation agree: 002ee3e0..002ee430 writes 6 into moby+0x20 when target XY distance is below 2, selecting animation 2. Existing case 6 at 002ee61c..002ee7e0 turns toward target, doubles forward movement and gates the nearby target effect. domain_12_value_5 -> LARGE_AMOEBOID_RETURN_TO_STORED_POSITION: Bound C and original retail decompilation agree: 002ee43c..002ee468 writes 5 into moby+0x20 when blocked waiting ends and pvars+0x22c is zero. That byte dispatches existing stored-position return case 5 at 002ee888..002ee9d8. domain_13_value_6 -> LARGE_AMOEBOID_LUNGE_AT_TARGET: Bound C and original retail decompilation agree: 002ee474..002ee4a0 computes target distance and writes 6 into moby+0x20 below the path lunge threshold, then doubles speed/selects animation 2. The same byte dispatches existing lunge case 6 at 002ee61c. domain_14_value_5 -> LARGE_AMOEBOID_RETURN_TO_STORED_POSITION: Bound C and original retail decompilation agree: 002ee5fc..002ee618 sets path status 2 on failed queries and writes 5 into moby+0x20 when status is 2. Existing case 5 at 002ee888..002ee9d8 follows a route to stored pvars+0x210. domain_15_value_7 -> LARGE_AMOEBOID_WAIT_FOR_ANIMATION_BEFORE_RESUMING_PATH: Bound C and original retail decompilation agree: 002ee7ec..002ee824 writes 7 into moby+0x20 after lunge animation bit 2 and selects animation 3. Existing combined cases 3/7 at 002ee840..002ee87c wait for completion before state 4. domain_16_value_4 -> LARGE_AMOEBOID_FOLLOW_PATH_TO_TARGET: Bound C and original retail decompilation agree: 002ee840..002ee85c writes 4 into moby+0x20 after animation completion in cases 3/7. The same dispatched byte selects existing case 4, which obtains path waypoints toward target and moves along them. domain_17_value_1 -> LARGE_AMOEBOID_TRY_ACQUIRE_TARGET_PATH: Bound C and original retail decompilation agree: 002ee888..002ee8c0 writes 1 into moby+0x20 when within 1.0 of stored position. Existing case 1 at 002edfc4..002ee10c attempts target-path acquisition using pvars+0x240. domain_18_value_9 -> LARGE_AMOEBOID_WAIT_FOR_ANIMATION_BEFORE_RESTARTING_PATH: Bound C and original retail decompilation agree: 002eea7c..002eead4 selects state 9 and animation 5 after knockback motion and a successful path query. Existing case 9 at 002eeb2c..002eeba8 waits for animation completion then restores path-follow state and movement settings. domain_19_value_4 -> LARGE_AMOEBOID_FOLLOW_PATH_TO_TARGET: Bound C and original retail decompilation agree: 002eeb2c..002eeb48 writes 4 into moby+0x20 on animation completion, then restores movement state. That same byte dispatches existing target-path-follow case 4 at 002ee474..002ee618. domain_1_value_1 -> LARGE_AMOEBOID_TRY_ACQUIRE_TARGET_PATH: Bound C and original retail decompilation agree: 002edf60..002edf74 stores 1 into moby+0x20 for active initialization. The same byte dispatches the named case 1 at 002edfc4..002ee10c, which attempts follow_path from self to target. domain_20_value_1 -> LARGE_AMOEBOID_TRY_ACQUIRE_TARGET_PATH: Bound C and original retail decompilation agree: 002eebc0..002eebf4 writes 1 into moby+0x20 after the activation-volume test succeeds; remaining code restores position/collision/visibility. Existing case 1 at 002edfc4 attempts target-path acquisition. domain_21_value_1 -> LARGE_AMOEBOID_TRY_ACQUIRE_TARGET_PATH: Bound C and original retail decompilation agree: 002eec20..002eec38 writes 1 into moby+0x20 after suck-cannon interaction helper reports completion and clears pvars+0x128. Existing case 1 at 002edfc4 attempts target-path acquisition. domain_2_value_12 -> LARGE_AMOEBOID_DORMANT: Bound C and original retail decompilation agree: 002edf78..002edf8c chooses 12 when pvars+0x25c is -1, then disables visibility/collision and lowers Z. Supplied activate_smaller_amoeboid identifies state 12 of the same amoeboid class family as LARGE_AMOEBOID_DORMANT before restoring the smaller instance. domain_3_value_13 -> LARGE_AMOEBOID_WAIT_FOR_ACTIVATION_VOLUME: Bound C and original retail decompilation agree: 002edf78..002edf8c selects 13 for a configured activation-volume index and writes moby+0x20. Dispatch case 13 at 002eebac..002eec1c tests that pvars+0x25c volume and restores activation on success, matching the existing state enum. domain_4_value_4 -> LARGE_AMOEBOID_FOLLOW_PATH_TO_TARGET: Bound C and original retail decompilation agree: 002ee014..002ee028 writes 4 into moby+0x20 after successful target-path acquisition. The same state byte dispatches established case 4 at 002ee474..002ee618, following path output toward target+0x10. domain_5_value_15 -> LARGE_AMOEBOID_MOVE_DIRECTLY_TOWARD_TARGET: Bound C and original retail decompilation agree: 002ee080..002ee0a4 writes 15 to moby+0x20 when targeting timer is nonzero and path status is 2. Established case 15 at 002ee2b0..002ee438 faces target-minus-self and moves directly toward it. domain_6_value_2 -> LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION: Bound C and original retail decompilation agree: 002ee104..002ee10c writes 2 into the dispatched moby+0x20 byte. Established case 2 at 002ee110..002ee1ac computes yaw from pvars+0x210 minus self position and moves toward that stored position. domain_7_value_3 -> LARGE_AMOEBOID_WAIT_FOR_PATH_ACQUISITION_ANIMATION_END: Bound C and original retail decompilation agree: 002ee1fc..002ee228 selects state 3 and animation 0 after successful target-path query. The same state byte enters combined cases 3/7 at 002ee840..002ee87c, waiting for animation bit 2 before resuming state 4. domain_8_value_15 -> LARGE_AMOEBOID_MOVE_DIRECTLY_TOWARD_TARGET: Bound C and original retail decompilation agree: 002ee278..002ee298 writes 15 to moby+0x20 after path status 2 with a nonzero targeting timer. That byte selects the existing direct-target movement case at 002ee2b0..002ee438. domain_9_value_5 -> LARGE_AMOEBOID_RETURN_TO_STORED_POSITION: Bound C and original retail decompilation agree: 002ee3a0..002ee3b0 selects moby state 5 when pvars+0x22c expires during direct pursuit. Established case 5 at 002ee888..002ee9d8 queries distance/path to stored pvars+0x210 and moves toward it. --- src/overlays/shared/enemies/large_amoeboid.c | 47 +++++++++++--------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index 4406aede43..2b59788dbc 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -245,6 +245,9 @@ void large_amoeboid_update(unsigned char *moby) { LARGE_AMOEBOID_MEDIUM_VARIANT = 0x361, LARGE_AMOEBOID_SMALL_VARIANT = 0x362 }; + enum { + LARGE_AMOEBOID_DORMANT = 12 + }; LargeAmoeboidVars *large_amoeboid_vars = (LargeAmoeboidVars *)MOBY(moby)->pvars; char *target; char *target_position; @@ -256,7 +259,7 @@ void large_amoeboid_update(unsigned char *moby) { int blocked; int result; - if (MOBY(moby)->state == 12) { + if (MOBY(moby)->state == LARGE_AMOEBOID_DORMANT) { MOBY(moby)->flags |= 1; return; } @@ -310,13 +313,13 @@ void large_amoeboid_update(unsigned char *moby) { large_amoeboid_vars->unk170 = result; large_amoeboid_vars->unk194 = angle; if (large_amoeboid_vars->unk230 != 0) { - MOBY(moby)->state = 1; + MOBY(moby)->state = LARGE_AMOEBOID_TRY_ACQUIRE_TARGET_PATH; MOBY(moby)->flags |= 0x1000; } else { if (large_amoeboid_vars->unk25C == -1) - MOBY(moby)->state = 12; + MOBY(moby)->state = LARGE_AMOEBOID_DORMANT; else - MOBY(moby)->state = 13; + MOBY(moby)->state = LARGE_AMOEBOID_WAIT_FOR_ACTIVATION_VOLUME; MOBY(moby)->collision = 0; *(int *)(moby + 0x58) = 0; MOBY(moby)->visible = 0; @@ -336,7 +339,7 @@ void large_amoeboid_update(unsigned char *moby) { target + 0x10, move); if (path_hit != 0) { - MOBY(moby)->state = 4; + MOBY(moby)->state = LARGE_AMOEBOID_FOLLOW_PATH_TO_TARGET; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); clear_u64_value(&large_amoeboid_vars->unk40); @@ -347,7 +350,7 @@ void large_amoeboid_update(unsigned char *moby) { } } if (large_amoeboid_vars->unk22C != 0 && large_amoeboid_vars->unk204 == 2) { - MOBY(moby)->state = 15; + MOBY(moby)->state = LARGE_AMOEBOID_MOVE_DIRECTLY_TOWARD_TARGET; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, 5); return; @@ -355,7 +358,7 @@ void large_amoeboid_update(unsigned char *moby) { large_amoeboid_vars->unk194 = large_amoeboid_vars->unk23C * 0.5f * frame_time_gp; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, 5); - MOBY(moby)->state = 2; + MOBY(moby)->state = LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION; break; case LARGE_AMOEBOID_MOVE_TOWARD_STORED_POSITION: angle = fast_arc_tan(large_amoeboid_vars->home_pos[0] - MOBY(moby)->pos.x, @@ -381,7 +384,7 @@ void large_amoeboid_update(unsigned char *moby) { target + 0x10, hit); if (path_hit != 0) { - MOBY(moby)->state = 3; + MOBY(moby)->state = LARGE_AMOEBOID_WAIT_FOR_PATH_ACQUISITION_ANIMATION_END; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); clear_u64_value(&large_amoeboid_vars->unk40); @@ -394,7 +397,7 @@ void large_amoeboid_update(unsigned char *moby) { } } if (large_amoeboid_vars->unk22C != 0 && large_amoeboid_vars->unk204 == 2) { - MOBY(moby)->state = 15; + MOBY(moby)->state = LARGE_AMOEBOID_MOVE_DIRECTLY_TOWARD_TARGET; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, 5); } @@ -419,13 +422,13 @@ void large_amoeboid_update(unsigned char *moby) { fast_vec_dist(&MOBY(moby)->pos, hit) < 1.5f) blocked = 1; if (large_amoeboid_vars->unk22C == 0) { - MOBY(moby)->state = 5; + MOBY(moby)->state = LARGE_AMOEBOID_RETURN_TO_STORED_POSITION; } else if (blocked) { - MOBY(moby)->state = 16; + MOBY(moby)->state = LARGE_AMOEBOID_WAIT_WHILE_BLOCKED; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); } else if (vector_distance_xy(&MOBY(moby)->pos, target + 0x10) < 2.0f) { - MOBY(moby)->state = 6; + MOBY(moby)->state = LARGE_AMOEBOID_LUNGE_AT_TARGET; if (MOBY(moby)->prev_seq != 2) blend_moby_animation(moby, 2, 5, scale_game_frames(10)); return; @@ -434,7 +437,7 @@ void large_amoeboid_update(unsigned char *moby) { case LARGE_AMOEBOID_WAIT_WHILE_BLOCKED: if (!(MOBY(moby)->anim_flags & 2) || large_amoeboid_vars->unk22C != 0) return; - MOBY(moby)->state = 5; + MOBY(moby)->state = LARGE_AMOEBOID_RETURN_TO_STORED_POSITION; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(20)); return; @@ -444,7 +447,7 @@ void large_amoeboid_update(unsigned char *moby) { target_position = target + 0x10; distance = vector_distance_xy(&MOBY(moby)->pos, target_position); if (distance < large_amoeboid_path_lunge_distance_threshold_gp) { - MOBY(moby)->state = 6; + MOBY(moby)->state = LARGE_AMOEBOID_LUNGE_AT_TARGET; large_amoeboid_vars->unk194 = (large_amoeboid_vars->unk23C + large_amoeboid_vars->unk23C) * frame_time_gp; if (MOBY(moby)->prev_seq != 2) @@ -487,7 +490,7 @@ void large_amoeboid_update(unsigned char *moby) { large_amoeboid_vars->unk204 = 2; } if (large_amoeboid_vars->unk204 == 2) - MOBY(moby)->state = 5; + MOBY(moby)->state = LARGE_AMOEBOID_RETURN_TO_STORED_POSITION; spawn_amoeboid_movement_particles(moby); return; } @@ -527,7 +530,7 @@ void large_amoeboid_update(unsigned char *moby) { return; } if (MOBY(moby)->anim_flags & 2) { - MOBY(moby)->state = 7; + MOBY(moby)->state = LARGE_AMOEBOID_WAIT_FOR_ANIMATION_BEFORE_RESUMING_PATH; if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, scale_game_frames(10)); large_amoeboid_vars->unk194 = large_amoeboid_vars->unk23C * frame_time_gp; @@ -538,7 +541,7 @@ void large_amoeboid_update(unsigned char *moby) { case LARGE_AMOEBOID_WAIT_FOR_ANIMATION_BEFORE_RESUMING_PATH: if (!(MOBY(moby)->anim_flags & 2)) return; - MOBY(moby)->state = 4; + MOBY(moby)->state = LARGE_AMOEBOID_FOLLOW_PATH_TO_TARGET; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); return; @@ -548,7 +551,7 @@ void large_amoeboid_update(unsigned char *moby) { distance = vector_distance_xy(&MOBY(moby)->pos, (target_position = &large_amoeboid_vars->home_pos)); if (distance < 1.0f) { - MOBY(moby)->state = 1; + MOBY(moby)->state = LARGE_AMOEBOID_TRY_ACQUIRE_TARGET_PATH; } else { if (follow_path((int *)(&large_amoeboid_vars->unk240), 1, @@ -602,7 +605,7 @@ void large_amoeboid_update(unsigned char *moby) { if (path_hit != 0) { FUN_0022da68(4, 0, (char *)moby); large_amoeboid_vars->unk194 = large_amoeboid_vars->unk23C * frame_time_gp; - MOBY(moby)->state = 9; + MOBY(moby)->state = LARGE_AMOEBOID_WAIT_FOR_ANIMATION_BEFORE_RESTARTING_PATH; if (MOBY(moby)->prev_seq != 5) blend_moby_animation(moby, 5, 4, scale_game_frames(10)); qcopy(&large_amoeboid_vars->home_pos, &MOBY(moby)->pos); @@ -617,7 +620,7 @@ void large_amoeboid_update(unsigned char *moby) { return; case LARGE_AMOEBOID_WAIT_FOR_ANIMATION_BEFORE_RESTARTING_PATH: if (MOBY(moby)->anim_flags & 2) { - MOBY(moby)->state = 4; + MOBY(moby)->state = LARGE_AMOEBOID_FOLLOW_PATH_TO_TARGET; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); clear_u64_value(&large_amoeboid_vars->unk40); @@ -635,7 +638,7 @@ void large_amoeboid_update(unsigned char *moby) { int result; distance = MOBY(moby)->pos.z + 20.0f; flags = MOBY(moby)->flags | 0x1000; - MOBY(moby)->state = 1; + MOBY(moby)->state = LARGE_AMOEBOID_TRY_ACQUIRE_TARGET_PATH; MOBY(moby)->flags = flags; MOBY(moby)->anim_speed = 1.0f; MOBY(moby)->pos.z = distance; @@ -647,7 +650,7 @@ void large_amoeboid_update(unsigned char *moby) { return; case LARGE_AMOEBOID_PROCESS_SUCK_CANNON_INTERACTION: if (FUN_L00_002dc9f0(moby, &large_amoeboid_vars->unk60)) { - MOBY(moby)->state = 1; + MOBY(moby)->state = LARGE_AMOEBOID_TRY_ACQUIRE_TARGET_PATH; large_amoeboid_vars->unk128 = 0; } break; From d7b738d89b39d611b3525a7edadd6db93e7d034d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:54:48 +0000 Subject: [PATCH 068/758] decomp: clarify names in update_pause_menu domain_4_value_0 -> PAUSE_MENU_STATE_DEFAULT_PAGE_ENTRY: Retail 0x00276eb4 branches on zero in v1 loaded from pause-menu state 0x001b9cf0 and calls initialize_pause_menu at 0x00276eec. The directly called original retail initializer 0x00276368 tests special entries 10/14/33/35/45; zero falls through to the default-owner path at 0x00276448-0x00276464, selects 0x001b2588, sets state 2, and installs current/pending owners. The authoritative source binds 0x001b2588 to l00_pause_menu_default_page_owner and state 2 to SCENE_STATE_DEFAULT. This proves a default-page entry state; the later saved pending-owner override is preserved. --- src/overlays/shared/ui/menus/initialize_pause_menu.c | 5 ++++- 1 file changed, 4 insertions(+), 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 9e35f4b55c..bd0a095e16 100644 --- a/src/overlays/shared/ui/menus/initialize_pause_menu.c +++ b/src/overlays/shared/ui/menus/initialize_pause_menu.c @@ -507,6 +507,9 @@ void update_pause_menu(void) { enum { PAUSE_MENU_STATE_CLOSE_ON_ACTION_ENTRY = 0xA }; + enum { + PAUSE_MENU_STATE_DEFAULT_PAGE_ENTRY = 0 + }; Own *owner; Own *u8p; Mth *active_callback_object; @@ -603,7 +606,7 @@ void update_pause_menu(void) { return; } scene_state = D_L00_001B9CF0.state; - if (scene_state == 0 || scene_state == PAUSE_MENU_STATE_CLOSE_ON_ACTION_ENTRY || + if (scene_state == PAUSE_MENU_STATE_DEFAULT_PAGE_ENTRY || scene_state == PAUSE_MENU_STATE_CLOSE_ON_ACTION_ENTRY || scene_state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ENTRY || scene_state == 0x11 || scene_state == PAUSE_MENU_STATE_EXIT_GUARDED_ENTRY || scene_state == 0x2D || scene_state == PAUSE_MENU_STATE_PRESERVE_STATE_ENTRY) { From ad897ad79a0fb9ee4d218d5a5914628936cda2cd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:56:45 +0000 Subject: [PATCH 069/758] decomp: clarify names in transport_pod_update domain_0_value_1 -> TRANSPORT_POD_WAIT_FOR_GEAR_MOVEMENT_TRIGGER: 002dde20 writes 1 to moby+0x20 during initialization; dispatcher 002ddda8-002dddd0 reads that same byte. Case 1 at 002ddf5c-002ddfa0 waits for the gear trigger and enters timed movement. domain_10_value_13 -> TRANSPORT_POD_WAIT_FOR_RIDER_TO_LEAVE: 002de698-002de6b8 expires ride timeout, ends mount and stores 13 to moby+0x20. The same selector's existing case 13 waits for the rider to leave. domain_11_value_8 -> TRANSPORT_POD_LOWER_AND_TRANSFER_TO_OTHER_STOP: 002de6f8-002de74c checks both departure rails reach z minus one then stores 8 to moby+0x20. Existing case 8 lowers the pod and transfers pod/hero to the other stop. domain_12_value_9 -> TRANSPORT_POD_ADVANCE_RIDE_CAMERA: 002de7f0-002de8f8 transfers to the opposite stop, reverses vertical speed and stores 9 to moby+0x20. Existing case 9 advances camera path progress and updates camera position/rotation. domain_13_value_10 -> TRANSPORT_POD_RAISE_FOR_DISEMBARKING: 002de930-002de97c compares camera progress to its goal and stores 10 to moby+0x20 on arrival. Existing case 10 raises pod z to stop height before disembarking rail positioning. domain_14_value_11 -> TRANSPORT_POD_POSITION_RAILS_FOR_DISEMBARKING: 002deaa4-002dead4 checks pod z reaches stop height and stores 11 to moby+0x20. The same-byte case 11 moves rails to +2/-4 then ends mount for disembarking. domain_15_value_13 -> TRANSPORT_POD_WAIT_FOR_RIDER_TO_LEAVE: 002debf4-002dec14 stores 13 to moby+0x20 after disembarking rail convergence, ends mount and changes hero state. Existing case 13 waits for hero.ground_moby to stop referencing the pod. domain_16_value_5 -> TRANSPORT_POD_WAIT_FOR_RIDER_OR_RECALL: 002dec20-002dec70 raises pod z and selects 5 once node_a stop height is reached; 002deef0 stores it to moby+0x20. Existing case 5 implements rider-or-recall waiting on that same selector. domain_17_value_5 -> TRANSPORT_POD_WAIT_FOR_RIDER_OR_RECALL: 002dec74-002dec8c compares hero.ground_moby with this pod and selects 5 after rider departure, stored to moby+0x20 at 002deef0. Existing case 5 waits for rider or recall. domain_18_value_15 -> TRANSPORT_POD_POSITION_RAILS_FROM_CONFIGURED_OFFSETS: 002dec90-002ded40 creates rail mobys 0x421/0x422 then stores 15 to moby+0x20. Existing same-selector case 15 copies configured rail offsets into pvars+0x94/+0x98 and advances rails. domain_19_value_16 -> TRANSPORT_POD_CYCLE_RAILS_TO_SPLIT_HEIGHTS: 002ded6c-002ded8c tests rail-cycle enable and selects 16, stored to moby+0x20 at 002deef0. Existing case 16 targets rail offsets +2/-4 and waits for convergence. domain_1_value_2 -> TRANSPORT_POD_TIMED_GEAR_MOVEMENT: 002ddf90-002ddfa0 starts the 30-frame-scaled timer and selects 2, stored to moby+0x20 at 002deef0. The same-byte switch case 2 moves the four gear mobys until timer expiry. domain_20_value_15 -> TRANSPORT_POD_POSITION_RAILS_FROM_CONFIGURED_OFFSETS: 002dedb0-002dedc8 selects 15 when rail cycling is disabled; 002dee74-002dee78 stores it to moby+0x20. Existing case 15 resumes configured rail offsets in the same state domain. domain_21_value_17 -> TRANSPORT_POD_CYCLE_RAILS_TO_SHARED_LOWER_HEIGHT: 002dedcc-002dee3c checks both rails converge to split offsets +2/-4 then stores 17 to moby+0x20. Existing case 17 targets shared offsets -1/-1 and advances both rails. domain_22_value_15 -> TRANSPORT_POD_POSITION_RAILS_FROM_CONFIGURED_OFFSETS: 002dee58-002dee78 detects disabled rail cycling and stores 15 to moby+0x20. Existing case 15 on this same selector applies configured rail offsets instead of cyclic targets. domain_23_value_16 -> TRANSPORT_POD_CYCLE_RAILS_TO_SPLIT_HEIGHTS: 002dee84-002deef0 checks both rail errors against shared offset -1 and selects/stores 16 to moby+0x20. Existing case 16 then targets split rail heights +2/-4 in the same state domain. domain_2_value_3 -> TRANSPORT_POD_RAISE_FOR_BOARDING: 002de148-002de15c stores 3 to moby+0x20 after the gear timer expires. That byte selects existing case 3, which raises pod z to node_a height before boarding rail positioning. domain_3_value_4 -> TRANSPORT_POD_POSITION_RAILS_FOR_BOARDING: 002de1e0-002de200 selects 4 when pod z reaches stop height, with the store at 002dead4 to moby+0x20. Existing case 4 sets rail offsets +2/-4 before entering rider wait. domain_4_value_5 -> TRANSPORT_POD_WAIT_FOR_RIDER_OR_RECALL: 002de238-002de294 checks both boarding rail target errors then stores 5 to moby+0x20. The same selector's existing case 5 waits for a grounded rider or recalls the pod near a stop. domain_5_value_3 -> TRANSPORT_POD_RAISE_FOR_BOARDING: 002de2e4-002de340 recalls the pod to node_b minus six height units, snaps rails and stores 3 to moby+0x20. Existing case 3 raises it to stop height for boarding. domain_6_value_3 -> TRANSPORT_POD_RAISE_FOR_BOARDING: 002de3a0-002de3fc recalls the pod to node_a minus six height units and stores 3 to moby+0x20. This is the same state byte as the dispatcher and existing raise-for-boarding case. domain_7_value_6 -> TRANSPORT_POD_WAIT_FOR_RIDER_READY_FOR_DEPARTURE: 002de424-002de440 verifies grounded on-foot rider; 002de5ac-002de5c0 stores 6 to moby+0x20 and starts ride timeout. Existing case 6 polls target-pose readiness before departure. domain_8_value_7 -> TRANSPORT_POD_POSITION_RAILS_FOR_DEPARTURE: 002de630-002de650 polls target-pose status and stores 7 to moby+0x20 on ready result 2. The same-byte case 7 positions both rails at pod z minus one for departure. domain_9_value_13 -> TRANSPORT_POD_WAIT_FOR_RIDER_TO_LEAVE: 002de680-002de694 ends mount on inactive target-pose status and selects 13, stored at 002deef0 to moby+0x20. Existing case 13 waits until hero.ground_moby differs from this pod. --- src/overlays/l02/mobys/transport_pod.c | 48 +++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/overlays/l02/mobys/transport_pod.c b/src/overlays/l02/mobys/transport_pod.c index 10b2edb08c..04c1e08b72 100644 --- a/src/overlays/l02/mobys/transport_pod.c +++ b/src/overlays/l02/mobys/transport_pod.c @@ -149,7 +149,7 @@ void transport_pod_update(unsigned char *moby) { MOBY(moby)->update_dist = 0xFF; MOBY(moby)->command = 1; qcopy(moby + 0x10, &l02_cuboids[transport_pod_vars->node_b].pos); - MOBY(moby)->state = 1; + MOBY(moby)->state = TRANSPORT_POD_WAIT_FOR_GEAR_MOVEMENT_TRIGGER; ((struct Moby *)moby)->pos.z -= 6.0f; transport_pod_vars->rail_a = create_moby(0x421); *(short *)(transport_pod_vars->rail_a + 0x32) = 0x40; @@ -176,7 +176,7 @@ void transport_pod_update(unsigned char *moby) { case TRANSPORT_POD_WAIT_FOR_GEAR_MOVEMENT_TRIGGER: if (visited52[MOBY(moby)->mission + current_level_index * 16] == 0xFF) { transport_pod_vars->timer = scale_game_frames(30); - MOBY(moby)->state = 2; + MOBY(moby)->state = TRANSPORT_POD_TIMED_GEAR_MOVEMENT; } break; case TRANSPORT_POD_TIMED_GEAR_MOVEMENT: @@ -210,7 +210,7 @@ void transport_pod_update(unsigned char *moby) { update_entity((char *)D_L02_0015FFD8 + (transport_pod_vars->gear[2] << 8)); update_entity((char *)D_L02_0015FFD8 + (transport_pod_vars->gear[3] << 8)); if (fast_dec_timer(&transport_pod_vars->timer)) { - MOBY(moby)->state = 3; + MOBY(moby)->state = TRANSPORT_POD_RAISE_FOR_BOARDING; allocate_voice_for_target_entry(1, 0, moby); } break; @@ -224,7 +224,7 @@ void transport_pod_update(unsigned char *moby) { snap_transport_pod_rails_to_offsets((struct Moby *)moby); if (l02_cuboids[transport_pod_vars->node_a].pos.z - 0.0001f <= ((struct Moby *)moby)->pos.z) { - MOBY(moby)->state = 4; + MOBY(moby)->state = TRANSPORT_POD_POSITION_RAILS_FOR_BOARDING; allocate_voice_for_target_entry(0, 0, moby); } break; @@ -236,7 +236,7 @@ void transport_pod_update(unsigned char *moby) { ((struct Moby *)moby)->pos.z - 2.0f) < 0.0001f && absolute_float(*(float *)(transport_pod_vars->rail_b + 0x18) - ((struct Moby *)moby)->pos.z + 4.0f) < 0.0001f) { - MOBY(moby)->state = 5; + MOBY(moby)->state = TRANSPORT_POD_WAIT_FOR_RIDER_OR_RECALL; } break; case TRANSPORT_POD_WAIT_FOR_RIDER_OR_RECALL: @@ -248,7 +248,7 @@ void transport_pod_update(unsigned char *moby) { transport_pod_vars->rail_a_off = -1.0f; transport_pod_vars->rail_b_off = -1.0f; snap_transport_pod_rails_to_offsets((struct Moby *)moby); - MOBY(moby)->state = 3; + MOBY(moby)->state = TRANSPORT_POD_RAISE_FOR_BOARDING; MOBY(moby)->command = 1; allocate_voice_for_target_entry(1, 0, moby); } else if (MOBY(moby)->command == 1 && @@ -260,7 +260,7 @@ void transport_pod_update(unsigned char *moby) { transport_pod_vars->rail_b_off = -1.0f; snap_transport_pod_rails_to_offsets((struct Moby *)moby); MOBY(moby)->command = 0; - MOBY(moby)->state = 3; + MOBY(moby)->state = TRANSPORT_POD_RAISE_FOR_BOARDING; allocate_voice_for_target_entry(1, 0, moby); } else if ((unsigned char *)hero.ground_moby == (struct Moby *)moby && hero.air_frames.s == 0 && hero.vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) { @@ -306,7 +306,7 @@ void transport_pod_update(unsigned char *moby) { camera_target_or_hero_position_or_rotation.f[2] - camera_position_or_stop_look.f[2]); } - MOBY(moby)->state = 6; + MOBY(moby)->state = TRANSPORT_POD_WAIT_FOR_RIDER_READY_FOR_DEPARTURE; transport_pod_vars->ride_timer = scale_game_frames(0xB4); request_hero_target_pose( moby + 0x10, @@ -326,15 +326,15 @@ void transport_pod_update(unsigned char *moby) { case TRANSPORT_POD_WAIT_FOR_RIDER_READY_FOR_DEPARTURE: { int rider_readiness_status = get_hero_target_pose_status(); if (rider_readiness_status == HERO_TARGET_POSE_STATUS_READY) { - MOBY(moby)->state = 7; + MOBY(moby)->state = TRANSPORT_POD_POSITION_RAILS_FOR_DEPARTURE; allocate_voice_for_target_entry(2, 0, moby); hero_set_state(0x72, 0); } else if (rider_readiness_status == HERO_TARGET_POSE_STATUS_INACTIVE) { jet_end_mount(2); - MOBY(moby)->state = 0xD; + MOBY(moby)->state = TRANSPORT_POD_WAIT_FOR_RIDER_TO_LEAVE; } else if (fast_dec_timer(&transport_pod_vars->ride_timer)) { jet_end_mount(2); - MOBY(moby)->state = 0xD; + MOBY(moby)->state = TRANSPORT_POD_WAIT_FOR_RIDER_TO_LEAVE; enter_hero_idle_or_stop(); } break; @@ -347,7 +347,7 @@ void transport_pod_update(unsigned char *moby) { ((struct Moby *)moby)->pos.z + 1.0f) < 0.01f && absolute_float(*(float *)(transport_pod_vars->rail_b + 0x18) - ((struct Moby *)moby)->pos.z + 1.0f) < 0.01f) { - MOBY(moby)->state = 8; + MOBY(moby)->state = TRANSPORT_POD_LOWER_AND_TRANSFER_TO_OTHER_STOP; } break; case TRANSPORT_POD_LOWER_AND_TRANSFER_TO_OTHER_STOP: @@ -387,7 +387,7 @@ void transport_pod_update(unsigned char *moby) { 0x72, 0); transport_pod_vars->speed = -transport_pod_vars->speed; - MOBY(moby)->state = 9; + MOBY(moby)->state = TRANSPORT_POD_ADVANCE_RIDE_CAMERA; set_active_camera_mode(2, scale_game_frames(0xB4)); } break; @@ -401,7 +401,7 @@ void transport_pod_update(unsigned char *moby) { if (transport_pod_vars->cam_goal != 0 ? (float)transport_pod_vars->cam_goal <= transport_pod_vars->cam_pos : transport_pod_vars->cam_pos <= (float)transport_pod_vars->cam_goal) { - MOBY(moby)->state = 10; + MOBY(moby)->state = TRANSPORT_POD_RAISE_FOR_DISEMBARKING; } sample_camera_path(D_L02_001B0AB0_dc88[transport_pod_vars->path], 0, @@ -436,7 +436,7 @@ void transport_pod_update(unsigned char *moby) { D_L02_00161C30_gp * D_0015ED6C); snap_transport_pod_rails_to_offsets((struct Moby *)moby); if (l02_cuboids[transport_pod_vars->node_a].pos.z <= ((struct Moby *)moby)->pos.z) { - MOBY(moby)->state = 0xB; + MOBY(moby)->state = TRANSPORT_POD_POSITION_RAILS_FOR_DISEMBARKING; allocate_voice_for_target_entry(0, 0, moby); } break; @@ -459,7 +459,7 @@ void transport_pod_update(unsigned char *moby) { help_request(0x7DD, 0x48); } } - MOBY(moby)->state = 0xD; + MOBY(moby)->state = TRANSPORT_POD_WAIT_FOR_RIDER_TO_LEAVE; jet_end_mount(2); hero_set_state(0, 1); } @@ -467,12 +467,12 @@ void transport_pod_update(unsigned char *moby) { case TRANSPORT_POD_RAISE_TO_STOP_HEIGHT: ((struct Moby *)moby)->pos.z += D_0015ED6C * 4.0f; if (l02_cuboids[transport_pod_vars->node_a].pos.z <= ((struct Moby *)moby)->pos.z) { - MOBY(moby)->state = 5; + MOBY(moby)->state = TRANSPORT_POD_WAIT_FOR_RIDER_OR_RECALL; } break; case TRANSPORT_POD_WAIT_FOR_RIDER_TO_LEAVE: if ((unsigned char *)hero.ground_moby != (struct Moby *)moby) { - MOBY(moby)->state = 5; + MOBY(moby)->state = TRANSPORT_POD_WAIT_FOR_RIDER_OR_RECALL; } break; case TRANSPORT_POD_CREATE_RAILS: @@ -490,14 +490,14 @@ void transport_pod_update(unsigned char *moby) { *(unsigned short *)(transport_pod_vars->rail_b + 0x34) = MOBY(moby)->flags; qcopy_nc(transport_pod_vars->rail_b + 0x10, moby + 0x10); qcopy_nc(transport_pod_vars->rail_b + 0x40, moby + 0x40); - MOBY(moby)->state = 0xF; + MOBY(moby)->state = TRANSPORT_POD_POSITION_RAILS_FROM_CONFIGURED_OFFSETS; break; case TRANSPORT_POD_POSITION_RAILS_FROM_CONFIGURED_OFFSETS: transport_pod_vars->rail_a_off = transport_pod_configured_rail_a_height_offset_gp; transport_pod_vars->rail_b_off = transport_pod_configured_rail_b_height_offset_gp; advance_transport_pod_rails_to_offsets((struct Moby *)moby); if (transport_pod_rail_cycle_enabled_gp != 0.0f) { - MOBY(moby)->state = 0x10; + MOBY(moby)->state = TRANSPORT_POD_CYCLE_RAILS_TO_SPLIT_HEIGHTS; } break; case TRANSPORT_POD_CYCLE_RAILS_TO_SPLIT_HEIGHTS: @@ -505,12 +505,12 @@ void transport_pod_update(unsigned char *moby) { transport_pod_vars->rail_b_off = -4.0f; advance_transport_pod_rails_to_offsets((struct Moby *)moby); if (transport_pod_rail_cycle_enabled_gp == 0.0f) { - MOBY(moby)->state = 0xF; + MOBY(moby)->state = TRANSPORT_POD_POSITION_RAILS_FROM_CONFIGURED_OFFSETS; } else if (absolute_float(*(float *)(transport_pod_vars->rail_a + 0x18) - ((struct Moby *)moby)->pos.z - 2.0f) < 0.01f && absolute_float(*(float *)(transport_pod_vars->rail_b + 0x18) - ((struct Moby *)moby)->pos.z + 4.0f) < 0.01f) { - MOBY(moby)->state = 0x11; + MOBY(moby)->state = TRANSPORT_POD_CYCLE_RAILS_TO_SHARED_LOWER_HEIGHT; } break; case TRANSPORT_POD_CYCLE_RAILS_TO_SHARED_LOWER_HEIGHT: @@ -518,12 +518,12 @@ void transport_pod_update(unsigned char *moby) { transport_pod_vars->rail_b_off = -1.0f; advance_transport_pod_rails_to_offsets((struct Moby *)moby); if (transport_pod_rail_cycle_enabled_gp == 0.0f) { - MOBY(moby)->state = 0xF; + MOBY(moby)->state = TRANSPORT_POD_POSITION_RAILS_FROM_CONFIGURED_OFFSETS; } else if (absolute_float(*(float *)(transport_pod_vars->rail_a + 0x18) - ((struct Moby *)moby)->pos.z + 1.0f) < 0.01f && absolute_float(*(float *)(transport_pod_vars->rail_b + 0x18) - ((struct Moby *)moby)->pos.z + 1.0f) < 0.01f) { - MOBY(moby)->state = 0x10; + MOBY(moby)->state = TRANSPORT_POD_CYCLE_RAILS_TO_SPLIT_HEIGHTS; } break; } From 10447b867d9634cd1cdb9a163c00313b95e98a29 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 22:58:43 +0000 Subject: [PATCH 070/758] decomp: clarify names in bomb_update domain_0_value_0 -> BOMB_STATE_HELD: The selector is this bomb's byte state at moby+0x20, not hero state: retail 0x002adb40 saves bomb_moby in s4 and 0x002adc0c-0x002adc60 tests that byte against zero for holder-dependent removal/visibility. The authoritative spawn_bomb initializes the identical moby state field with existing BOMB_STATE_HELD, and predict_throw_landing uses that member to construct the held throw origin. Reuse that exact domain member. domain_1_value_0 -> BOMB_STATE_HELD: The selector is this bomb's byte state at moby+0x20, not hero state: retail 0x002adb40 saves bomb_moby in s4 and 0x002adc0c-0x002adc60 tests that byte against zero for holder-dependent removal/visibility. The authoritative spawn_bomb initializes the identical moby state field with existing BOMB_STATE_HELD, and predict_throw_landing uses that member to construct the held throw origin. Reuse that exact domain member. domain_2_value_0 -> BOMB_STATE_HELD: The selector is this bomb's byte state at moby+0x20, not hero state: retail 0x002adb40 saves bomb_moby in s4 and 0x002adc0c-0x002adc60 tests that byte against zero for holder-dependent removal/visibility. The authoritative spawn_bomb initializes the identical moby state field with existing BOMB_STATE_HELD, and predict_throw_landing uses that member to construct the held throw origin. Reuse that exact domain member. domain_3_value_1 -> BOMB_STATE_THROWN: Retail 0x002add04-0x002add10 compares bomb moby+0x20 to 1. Its branch advances bomb position by the leading BombData velocity (0x002ae008-0x002ae020), applies gravity (0x002ae024-0x002ae07c), and tests collisions and fuse expiry. Authoritative launch_bomb sets moby[0x20]=1 while installing launch velocity and the fuse, proving the thrown bomb state; it includes both flight and post-splash motion. domain_5_value_2 -> BOMB_STATE_EXPANDING_BLAST: The selector remains bomb_moby->state at +0x20. Retail 0x002ae4e4-0x002ae53c sends initial sphere blast hits then assigns state 2. At 0x002af30c-0x002af3f8 this state interpolates an expanding query radius using bBC/scale_game_frames(15), collects mobies, sends blast hits and removes the bomb after that counter exceeds 15 scaled frames. Thus 2 is the expanding blast state, independently of unrelated hit-kind or hero enums. domain_6_value_2 -> BOMB_STATE_EXPANDING_BLAST: The selector remains bomb_moby->state at +0x20. Retail 0x002ae4e4-0x002ae53c sends initial sphere blast hits then assigns state 2. At 0x002af30c-0x002af3f8 this state interpolates an expanding query radius using bBC/scale_game_frames(15), collects mobies, sends blast hits and removes the bomb after that counter exceeds 15 scaled frames. Thus 2 is the expanding blast state, independently of unrelated hit-kind or hero enums. domain_7_value_2 -> BOMB_STATE_EXPANDING_BLAST: The selector remains bomb_moby->state at +0x20. Retail 0x002ae4e4-0x002ae53c sends initial sphere blast hits then assigns state 2. At 0x002af30c-0x002af3f8 this state interpolates an expanding query radius using bBC/scale_game_frames(15), collects mobies, sends blast hits and removes the bomb after that counter exceeds 15 scaled frames. Thus 2 is the expanding blast state, independently of unrelated hit-kind or hero enums. domain_8_value_2 -> BOMB_STATE_EXPANDING_BLAST: The selector remains bomb_moby->state at +0x20. Retail 0x002ae4e4-0x002ae53c sends initial sphere blast hits then assigns state 2. At 0x002af30c-0x002af3f8 this state interpolates an expanding query radius using bBC/scale_game_frames(15), collects mobies, sends blast hits and removes the bomb after that counter exceeds 15 scaled frames. Thus 2 is the expanding blast state, independently of unrelated hit-kind or hero enums. --- src/overlays/shared/weapons/bomb_glove_bomb.c | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/weapons/bomb_glove_bomb.c b/src/overlays/shared/weapons/bomb_glove_bomb.c index db446b3622..8ac31db1da 100644 --- a/src/overlays/shared/weapons/bomb_glove_bomb.c +++ b/src/overlays/shared/weapons/bomb_glove_bomb.c @@ -1104,6 +1104,10 @@ void bomb_update(BombMoby *m) __asm__("FUN_L00_002adb30"); /* Moby class 121 */ void bomb_update(BombMoby *bomb_moby) { + enum { + BOMB_STATE_THROWN = 1, + BOMB_STATE_EXPANDING_BLAST = 2 + }; B910 rec = l00_bomb_camera_blast_parameters; Vec_2adb30 delta; Vec_2adb30 bomb_pre_motion_position; @@ -1118,15 +1122,15 @@ void bomb_update(BombMoby *bomb_moby) { b.f[2] = 1.0f; d = bomb_moby->d; if ((((G910 *)&hero)->hero == 0 || ((G910 *)&hero)->hero->cls != 0xC0) && - bomb_moby->state == 0) { + bomb_moby->state == BOMB_STATE_HELD) { mark_moby_for_removal(bomb_moby); return; } - if (((G910 *)&hero)->b20A4 != 0 && bomb_moby->state == 0) { + if (((G910 *)&hero)->b20A4 != 0 && bomb_moby->state == BOMB_STATE_HELD) { mark_moby_for_removal(bomb_moby); return; } - if ((((G910 *)&hero)->b20A5 != 0 || ((G910 *)&hero)->b20AF != 0) && bomb_moby->state == 0) { + if ((((G910 *)&hero)->b20A5 != 0 || ((G910 *)&hero)->b20AF != 0) && bomb_moby->state == BOMB_STATE_HELD) { bomb_moby->flags |= 0x41; } else { bomb_moby->flags &= ~0x41; @@ -1138,7 +1142,7 @@ void bomb_update(BombMoby *bomb_moby) { FUN_L00_002ad410_2adb30(d, bomb_moby, 2); } } - if (bomb_moby->state == 1) { + if (bomb_moby->state == BOMB_STATE_THROWN) { Vec_2adb30 c; float t; int cr; @@ -1335,7 +1339,7 @@ void bomb_update(BombMoby *bomb_moby) { 2.0f, 1.0f, 1.0f); - bomb_moby->state = 2; + bomb_moby->state = BOMB_STATE_EXPANDING_BLAST; } { int k; @@ -1636,13 +1640,13 @@ void bomb_update(BombMoby *bomb_moby) { l00_camera.shake_frames = FUN_001f96f8_2adb30(0x19); fast_vec_dist(&bomb_moby->pos, ((G910 *)&hero)->pos); mine_camera_blast((char *)&rec, (char *)&bomb_moby->pos, 0, 0); - if (bomb_moby->state != 2) { + if (bomb_moby->state != BOMB_STATE_EXPANDING_BLAST) { mark_moby_for_removal(bomb_moby); return; } } } - } else if (bomb_moby->state != 2) { + } else if (bomb_moby->state != BOMB_STATE_EXPANDING_BLAST) { int v; d->h6a++; v = truncate_float_to_s32(FUN_001f9de0_2adb30(normalize_angle((float)d->h6a * 0.068f)) * @@ -1650,7 +1654,7 @@ void bomb_update(BombMoby *bomb_moby) { 0x9F; bomb_moby->color = (v << 16) | (0xFF << 24) | (v << 8) | v; } - if (bomb_moby->state == 2) { + if (bomb_moby->state == BOMB_STATE_EXPANDING_BLAST) { Vec_2adb30 p; float r; int n; From 0f1113782dd0c66a808c5959c1daa077fa12ebdf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:00:31 +0000 Subject: [PATCH 071/758] decomp: clarify names in sand_shark_update D_L02_001619A8 -> l02_sand_shark_update_disabled: Authoritative C declares this int as zero-initialized and returns immediately when it is nonzero. Original retail Ghidra iGpffffada8 agrees: 0x002d3e54 loads the word with lw v0,-0x5258(gp); 0x002d3e88 branches on nonzero directly to the epilogue at 0x002d561c, before timer setup, pvars load, damage/targeting helper and state dispatch. Thus a nonzero value disables this entire sand-shark update. The l02 qualifier identifies this overlay-owned binding; no writer or wider purpose is asserted. --- src/overlays/l02/mobys/sand_shark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 0e455dc978..db44b3178b 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -279,7 +279,7 @@ extern void FUN_L02_002d5a68_e50(void *) __asm__("FUN_L02_002d5a68"); extern void FUN_L02_002d5c88_e50(void *) __asm__("FUN_L02_002d5c88"); extern void FUN_L02_002d63c0_e50(void *) __asm__("FUN_L02_002d63c0"); -int D_L02_001619A8 = 0; +int l02_sand_shark_update_disabled __asm__("D_L02_001619A8") = 0; unsigned char D_L02_00161900 = 0xa; #include "rnc/overlay/l02/mobys/sand_shark_data/sand_shark_update.h" @@ -303,7 +303,7 @@ void sand_shark_update(struct Moby *moby) { OvlVec4 particle_position_or_forward_step; float f; - if (D_L02_001619A8 != 0) { + if (l02_sand_shark_update_disabled != 0) { return; } *(volatile unsigned int *)0x10000010 = 0x81; From 1ac9f8e190a9276456d4558e665555b9ef35f7b0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:00:42 +0000 Subject: [PATCH 072/758] decomp: clarify names in qwarks_starfighter_update D_L13_00161950 -> l13_starfighter_owner_unavailable_voice_line_index: Authoritative source initializes this int to zero. In STARFIGHTER_STATE_OWNER_UNAVAILABLE and its entry branch, it supplies queue_starfighter_voice_line's line_group_start_index as this global + 0x1D with line_count 1, then advances (index + 1) % 4 only on successful queuing. Original Ghidra uses iGpffffad50 identically. Retail 0x002ebfe4-0x002ebff8 loads gp-0x52B0 into a2 and adds 0x1D for call 0x002e86f8; 0x002ebffc-0x002ec028 conditionally increments, reduces modulo four and stores it. The owner-unavailable entry repeats this at 0x002ecb94-0x002ecbcc. Supplied queue helper indexes l13_starfighter_voice_line_ids[line_group_start_index + j], with j zero for line_count 1, proving the rotating voice-line index. --- src/overlays/l13/mobys/qwarks_starfighter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index cf5f5de99f..e2a9617c10 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -1561,7 +1561,7 @@ extern int D_0015ED84; extern int D_0015EEA4; -int D_L13_00161950 = 0; +int l13_starfighter_owner_unavailable_voice_line_index __asm__("D_L13_00161950") = 0; int D_L13_00161954 = -1; @@ -2001,8 +2001,8 @@ void qwarks_starfighter_update(Moby388 *moby) { int line = *(int *)(dialog + 0x1C); if (line == -1 && (short)starfighter_vars->h138 <= 0) { if (queue_starfighter_voice_line( - moby, starfighter_vars, D_L13_00161950 + 0x1D, 1) != 0) { - D_L13_00161950 = (D_L13_00161950 + 1) % 4; + moby, starfighter_vars, l13_starfighter_owner_unavailable_voice_line_index + 0x1D, 1) != 0) { + l13_starfighter_owner_unavailable_voice_line_index = (l13_starfighter_owner_unavailable_voice_line_index + 1) % 4; starfighter_vars->h138 += 1; } } @@ -2310,8 +2310,8 @@ void qwarks_starfighter_update(Moby388 *moby) { owner->state == MOBY_STATE_REMOVAL_BELOW_INSTANCE_END || owner->state == 7) { moby->state = STARFIGHTER_STATE_OWNER_UNAVAILABLE; if (queue_starfighter_voice_line( - moby, starfighter_vars, D_L13_00161950 + 0x1D, 1) != 0) { - D_L13_00161950 = (D_L13_00161950 + 1) % 4; + moby, starfighter_vars, l13_starfighter_owner_unavailable_voice_line_index + 0x1D, 1) != 0) { + l13_starfighter_owner_unavailable_voice_line_index = (l13_starfighter_owner_unavailable_voice_line_index + 1) % 4; starfighter_vars->h138 = 1; } else { starfighter_vars->h138 = 0; From 5ea14d61d37c7f1cc10a3d698587ca86dc3b798e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:02:43 +0000 Subject: [PATCH 073/758] decomp: clarify names in hero_set_state b -> entry_animation_mode: Authoritative hero_set_state(int requested_state,int b) uses b to gate optional entry animation setup throughout the state switch. Retail 0x2356f8 saves a1 into s4; 0x23593c branches past idle animation selection when s4 is zero, while 0x235944-0x235994 selects/blends the entry animation otherwise. The same s4 gate precedes dying animation at 0x235a7c-0x235a9c and jump entry animation dispatch at 0x237c24. Original Ghidra param_2 mirrors these gates. Retail 0x235708-0x23570c and 0x23571c-0x235734 additionally admit value 2 through dying/global restrictions, proving an integer mode rather than merely a boolean. Self-call 0x235fdc-0x235fe0 supplies zero, then explicitly sets animation at 0x235fec-0x236014. --- src/overlays/l06/hero/hero_set_state.c | 128 ++++++++++++------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/src/overlays/l06/hero/hero_set_state.c b/src/overlays/l06/hero/hero_set_state.c index b3c51a8d1e..f3cfc11972 100644 --- a/src/overlays/l06/hero/hero_set_state.c +++ b/src/overlays/l06/hero/hero_set_state.c @@ -69,7 +69,7 @@ extern void clear_moby_transform_history(char *o) __asm__("FUN_L00_00262840"); extern int hero_set_state(int, int) __asm__("FUN_L06_002356a0"); extern char level06_hero_transform_trail_jump_velocity_keys[] __asm__("D_L06_0017C6A0"); -int hero_set_state(int requested_state, int b) { +int hero_set_state(int requested_state, int entry_animation_mode) { int saved_state_step; char *moby; int old20A7; @@ -80,10 +80,10 @@ int hero_set_state(int requested_state, int b) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || b != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || entry_animation_mode != 2)) return 0; } - if ((D_L06_0015F5C4 == 2 || D_L06_0015F5C4 == 6) && b != 2) + if ((D_L06_0015F5C4 == 2 || D_L06_0015F5C4 == 6) && entry_animation_mode != 2) return 0; { struct Hero *p = &hero; @@ -155,7 +155,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; q->rand_timer.range = 0x68; } - if (b) { + if (entry_animation_mode) { if (get_hero_help_value(0) == 0x54) { set_hero_animation(get_hero_help_value(0), 0, (float)scale_game_frames(0x12)); } else { @@ -170,7 +170,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; clear_u64_value(&p->motion.momentum); p->rand_timer.range = 0x68; - if (b) { + if (entry_animation_mode) { if (get_hero_help_value(0) == 0x54) { set_hero_animation(get_hero_help_value(0), 0, (float)scale_game_frames(0x12)); } else { @@ -195,7 +195,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(0x45, 0, (float)scale_game_frames(0xC)); break; } @@ -206,7 +206,7 @@ int hero_set_state(int requested_state, int b) { p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); FUN_L00_0025f730(&p->motion.momentum, frame_time * 3.5f); - if (b) + if (entry_animation_mode) set_hero_animation(0x7C, 0, (float)scale_game_frames(0xC)); break; } @@ -222,7 +222,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->unk6A0 = 0; p->unk690 = p->motion.pos.f[2] - p->unk69C; - if (b) + if (entry_animation_mode) set_hero_animation(0x74, 0, (float)scale_game_frames(0xB)); break; } @@ -234,7 +234,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&D_L06_0015F688 = scale_game_frames(0x3C); if (p->unk20AA == 0) { t = get_hero_help_value(1); - if (p->moby->prev_seq != t && b) { + if (p->moby->prev_seq != t && entry_animation_mode) { set_hero_animation(t, 0, (float)scale_game_frames(0x12)); } } @@ -318,7 +318,7 @@ int hero_set_state(int requested_state, int b) { if (u->state.prev2_control_mode == 4 && scale_game_frames(5) < u->rail_land_frames) n = scale_game_frames(0xD); } - if (b) { + if (entry_animation_mode) { struct Hero *v = &hero; set_hero_animation(v->state.step + 3, D_L06_0015F6D8[v->state.step], (float)n); } @@ -333,7 +333,7 @@ int hero_set_state(int requested_state, int b) { p->item_use_locked = 1; if (p->vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) cancel_hero_item_animation(); - if (b) { + if (entry_animation_mode) { if (p->vehicle_mode == 3) { set_hero_animation(1, 0, (float)scale_game_frames(8)); } else if (p->vehicle_mode == HERO_VEHICLE_MODE_CLANK) { @@ -362,7 +362,7 @@ int hero_set_state(int requested_state, int b) { } return 0; } - if (b) { + if (entry_animation_mode) { struct Hero *q = &hero; float d = q->anim_frame; int id = 6; @@ -379,7 +379,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.momentum, v); - if (b) { + if (entry_animation_mode) { int id = 6; float d = p->anim_frame; if (return_hero_animation_id_unchanged(MOBY(moby)->seq) == 4 && 3.0f < d && d < 16.0f) @@ -406,7 +406,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&q->motion.momentum, frame_time * 7.0f); if (frame_time * 3.5f < q->motion.forward_speed) allocate_hero_voice_for_entry(0xC, 0); - if (b) { + if (entry_animation_mode) { if (q->moby->seq == get_hero_help_value(0)) { set_hero_animation(0xD, 2, (float)scale_game_frames(9)); } else { @@ -433,7 +433,7 @@ int hero_set_state(int requested_state, int b) { } p->motion.move_yaw = fast_arc_tan(p->grapple_target->pos.x - p->motion.pos.f[0], p->grapple_target->pos.y - p->motion.pos.f[1]); - if (b) { + if (entry_animation_mode) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); hero_queue_sequence(0xA, 0xE); } @@ -446,7 +446,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->item_use_locked = 1; - if (b) + if (entry_animation_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(0xA)); break; } @@ -458,7 +458,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->tether_radius = fast_vec_dist(&p->motion.pos, &p->grapple_target->pos); - if (b) + if (entry_animation_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(5)); break; } @@ -514,7 +514,7 @@ int hero_set_state(int requested_state, int b) { } else if (q->state.prev_control_mode == 2) { q->swing_gravity = q->fall_state_gravity; } - if (b) { + if (entry_animation_mode) { set_hero_animation(0x34, 0, (float)scale_game_frames(0xB)); { struct Hero *r = &hero; @@ -530,7 +530,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 7; clear_u64_value(&p->motion.rot_spring_vel); qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xF)); break; } @@ -542,7 +542,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->past_apex = 0; p->rise_fall_land_frames = 0; p->rise_fall_gravity = frame_time_sq * 100.0f; - if (b) + if (entry_animation_mode) set_hero_animation(0x2A, 0, (float)scale_game_frames(6)); break; } @@ -597,7 +597,7 @@ int hero_set_state(int requested_state, int b) { } } } - if (b) { + if (entry_animation_mode) { struct Hero *r = &hero; set_hero_animation(r->grind_anim_variant + 0x31, 0, (float)scale_game_frames(6)); } @@ -614,7 +614,7 @@ int hero_set_state(int requested_state, int b) { p->unk4F0 = p->smoothed_ground_z; } p->item_select_blocked = 1; - if (b) { + if (entry_animation_mode) { if (frame_time * 3.5f < p->motion.flat_speed) { set_hero_animation(0x20, 0, (float)scale_game_frames(9)); } else { @@ -629,7 +629,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0xD; p->item_select_blocked = 1; p->rand_timer.range = 0x68; - if (b) + if (entry_animation_mode) set_hero_animation(0x21, 0, (float)scale_game_frames(6)); break; } @@ -638,7 +638,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (entry_animation_mode) set_hero_animation(0x24, 0, (float)scale_game_frames(6)); break; } @@ -647,7 +647,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (entry_animation_mode) set_hero_animation(0x25, 0, (float)scale_game_frames(6)); break; } @@ -656,7 +656,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xC)); break; } @@ -680,7 +680,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->state.step = 0; qcopy(&q->motion.velocity, &q->motion.resolved_velocity); - if (b) { + if (entry_animation_mode) { if (q->vehicle_mode == HERO_VEHICLE_MODE_CLANK) { set_hero_animation(4, 0, (float)scale_game_frames(8)); return 1; @@ -710,7 +710,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) { + if (entry_animation_mode) { set_hero_animation(0x13, 0, (float)animation_blend_spec); } break; @@ -725,7 +725,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.displacement); - if (b) { + if (entry_animation_mode) { set_hero_animation(0x13, 0, (float)landing_animation_blend_spec); } break; @@ -1109,7 +1109,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (q->fall_start_distance == 0.0f) q->fall_start_distance = q->unk430 * 1.5f; - if (b) { + if (entry_animation_mode) { int s = q->state.current; if (s == 7) { set_hero_animation(7, 0, (float)scale_game_frames(5)); @@ -1214,7 +1214,7 @@ int hero_set_state(int requested_state, int b) { update_hero_target_heading(8.0f, 1.0471976f, -1.0f); *(int *)&q->slam_descending = 0; q->items[0].timer = 0xA; - if (b) { + if (entry_animation_mode) { char *m; int n = scale_game_frames(0xB); if (q->state.prev == 0xB && scale_game_frames(0x2A) > q->state.prev_timer) @@ -1251,7 +1251,7 @@ int hero_set_state(int requested_state, int b) { q->saved_item[0] = 0; update_hero_target_heading(14.0f, 0.5235988f, -1.0f); q->unkA7C = q->unkA7C == 0; - if (b) { + if (entry_animation_mode) { int n = scale_game_frames(0xA); if (q->moby->prev_seq == 0x1A) n = scale_game_frames(3); @@ -1266,7 +1266,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (((void *)q->items[0].moby) == 0) break; - if (b) { + if (entry_animation_mode) { set_hero_animation(0x67, 4, -1.0f); blend_moby_animation(((void *)q->items[0].moby), 3, 4, -1); } @@ -1297,7 +1297,7 @@ int hero_set_state(int requested_state, int b) { r->attack_record = k; } update_hero_target_heading(5.0f, 0.7853982f, 0.7853982f); - if (b) { + if (entry_animation_mode) { char *m; int j = 0; int n; @@ -1341,7 +1341,7 @@ int hero_set_state(int requested_state, int b) { r->attack_record = k + 7; } update_hero_target_heading(5.0f, 0.7853982f, 0.7853982f); - if (b) { + if (entry_animation_mode) { int n; if (k == 0) { n = scale_game_frames(5); @@ -1354,7 +1354,7 @@ int hero_set_state(int requested_state, int b) { } case HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL: { struct Hero *q; - if (b) + if (entry_animation_mode) set_hero_animation(0x2C, 7, (float)scale_game_frames(9)); q = &hero; if (q->items[0].item_id == 0xA && ((char *)q->throw_target) != 0) { @@ -1377,7 +1377,7 @@ int hero_set_state(int requested_state, int b) { } else { p->attack_record = 0; } - if (b) { + if (entry_animation_mode) { struct Hero *q = &hero; char *m; int n = scale_game_frames(4); @@ -1393,7 +1393,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0xA; p->unk2284 = 0; p->ground_speed = frame_time * 9.0f; - if (b) { + if (entry_animation_mode) { char *m; HeroTableRow2C *e = &D_L06_0017C3A8[p->attack_record]; int k = e->kind; @@ -1414,7 +1414,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->pushback_yaw = fast_add_rotations(p->motion.rot.f[2], 3.1415927f); p->ground_speed = frame_time * 9.0f; - if (b) + if (entry_animation_mode) set_hero_animation(0x29, 5, (float)scale_game_frames(8)); break; } @@ -1436,7 +1436,7 @@ int hero_set_state(int requested_state, int b) { { struct Hero *q = &hero; q->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (entry_animation_mode) { set_hero_animation(0x10, 3, -3.0f); q->moby->anim_time = level06_hero_animation_blend_curves[q->anim_blend_curve] [(q->anim_blend_step)++]; @@ -1466,7 +1466,7 @@ int hero_set_state(int requested_state, int b) { p->collision_off_frames = 0x2710; p->sink_surface_z = p->ground_z.f; allocate_hero_voice_for_entry(9, 0); - if (b) + if (entry_animation_mode) set_hero_animation(0x71, 0, (float)scale_game_frames(8)); } break; @@ -1482,7 +1482,7 @@ int hero_set_state(int requested_state, int b) { m = ((char *)p->unkA88); qcopy(m + 0x10, &p->motion.pos); allocate_voice_for_target_entry(9, 0, (int)m); - if (b) + if (entry_animation_mode) set_hero_animation(0x11, 0, (float)scale_game_frames(8)); break; } @@ -1494,7 +1494,7 @@ int hero_set_state(int requested_state, int b) { hero_set_state(0x52, 1); return 0; } - if (b) + if (entry_animation_mode) set_hero_animation(0, 0, (float)scale_game_frames(9)); break; } @@ -1506,7 +1506,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.displacement); - if (b) + if (entry_animation_mode) set_hero_animation(0xE, 0, (float)scale_game_frames(0xC)); break; } @@ -1516,7 +1516,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->stickless_decel = frame_time_sq * 7.0f; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(4, 0, (float)scale_game_frames(8)); break; } @@ -1525,7 +1525,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(4, 0, (float)scale_game_frames(0xC)); break; } @@ -1539,7 +1539,7 @@ int hero_set_state(int requested_state, int b) { hero_change_health(1); p->unk1EE = scale_game_frames(0x2D); p->invulnerable_frames = scale_game_frames(0x32); - if (b) { + if (entry_animation_mode) { set_hero_animation(6, 3, -3.0f); p->moby->anim_time = level06_hero_animation_blend_curves[p->anim_blend_curve][(p->anim_blend_step)++]; @@ -1562,7 +1562,7 @@ int hero_set_state(int requested_state, int b) { if (q->state.prev_control_mode == 0) q->ground_speed = vector_length_xy(&q->motion.momentum); q->unk3B8 = 0; - if (b) + if (entry_animation_mode) set_hero_animation(2, 0, (float)scale_game_frames(8)); } break; @@ -1573,7 +1573,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(5, 0, (float)scale_game_frames(0xC)); break; } @@ -1587,7 +1587,7 @@ int hero_set_state(int requested_state, int b) { p->unk4EC = p->jump_gravity; p->unk4F0 = p->smoothed_ground_z; } - if (b) + if (entry_animation_mode) set_hero_animation(8, 0x12, (float)(scale_game_frames(7) + 2)); break; } @@ -1595,7 +1595,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 3; p->unk2284 = 0xD; - if (b) + if (entry_animation_mode) set_hero_animation(0xA, 0, (float)scale_game_frames(6)); break; } @@ -1603,7 +1603,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 3; p->unk2284 = 0xD; - if (b) + if (entry_animation_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(6)); break; } @@ -1611,7 +1611,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 3; p->unk2284 = 0xD; - if (b) + if (entry_animation_mode) set_hero_animation(0xC, 0, (float)scale_game_frames(6)); break; } @@ -1619,7 +1619,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) + if (entry_animation_mode) set_hero_animation(0, 0, (float)scale_game_frames(0xE)); break; } @@ -1627,7 +1627,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) { + if (entry_animation_mode) { set_hero_animation(4, 0, (float)scale_game_frames(7)); hero_queue_sequence(0xE, 0x22); } @@ -1638,7 +1638,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(6, 0, (float)scale_game_frames(0xC)); break; } @@ -1649,7 +1649,7 @@ int hero_set_state(int requested_state, int b) { p->fall_state_gravity = frame_time_sq * 24.0f; p->stickless_decel = frame_time_sq * 7.0f; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(6, 0, (float)scale_game_frames(7)); break; } @@ -1666,7 +1666,7 @@ int hero_set_state(int requested_state, int b) { if (frame_time * 1.5f < planar_speed) hero_base->ground_speed = frame_time * 1.5f; hero_base->unk3B8 = 0; - if (b) + if (entry_animation_mode) set_hero_animation(1, 0, (float)scale_game_frames(8)); } break; @@ -1676,7 +1676,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(3, 0, (float)scale_game_frames(0xC)); break; } @@ -1689,7 +1689,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&p->motion.velocity, frame_time * 5.0f); hero_change_health(1); p->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (entry_animation_mode) { set_hero_animation(2, 3, -3.0f); p->moby->anim_time = level06_hero_animation_blend_curves[p->anim_blend_curve][(p->anim_blend_step)++]; @@ -1710,7 +1710,7 @@ int hero_set_state(int requested_state, int b) { clear_u64_value(&p->motion.velocity); clear_u64_value(&p->motion.displacement); p->motion.velocity.f[2] = frame_time * 10.0f; - if (b) + if (entry_animation_mode) set_hero_animation(0x10, 2, -3.0f); break; } @@ -1761,7 +1761,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->tilt_disabled = 1; p->item_use_locked = 1; - if (b) + if (entry_animation_mode) set_hero_animation(get_hero_help_value(0), 0, -1.0f); break; } @@ -1772,7 +1772,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->item_use_locked = 1; clear_u64_value(&p->motion.velocity); - if (b) + if (entry_animation_mode) set_hero_animation(0xB, 0, -1.0f); break; } @@ -1782,7 +1782,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x18; p->item_use_locked = 1; cancel_hero_item_animation(); - if (b) + if (entry_animation_mode) set_hero_animation(get_hero_help_value(0), 0, -1.0f); break; } From 5d59f284a3a38ba603d8d4d3500dadfd90b1b181 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:02:43 +0000 Subject: [PATCH 074/758] decomp: clarify names in hero_set_state b -> animation_update_mode: Incoming a1 is saved in s4 at retail 0x0024dba8. Zero tests of s4 at 0x0024dde0, 0x0024df20, 0x002503ec and throughout the entry branches skip optional set_hero_animation calls to 0x00258e28; authoritative C uses if (b) for these calls and associated animation setup. At 0x0024dbb8-0x0024dbc0 and 0x0024dbcc-0x0024dbe4, value 2 also admits otherwise guarded transitions. Original Ghidra param_2 shows both the !=2 admission checks and ==0 animation skips, proving an integer animation-update mode rather than a boolean type. --- src/overlays/l11/hero/hero_set_state.c | 118 ++++++++++++------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/overlays/l11/hero/hero_set_state.c b/src/overlays/l11/hero/hero_set_state.c index 81dc5552f8..b814303ba1 100644 --- a/src/overlays/l11/hero/hero_set_state.c +++ b/src/overlays/l11/hero/hero_set_state.c @@ -65,17 +65,17 @@ extern int hero_set_state(int, int) __asm__("FUN_L11_0024db50"); extern char level_11_water_surface_jump_velocity_keys[] __asm__("D_L11_0017C960"); extern char level_11_trail_jump_velocity_keys[] __asm__("D_L11_0017C920"); -int hero_set_state(int requested_state, int b) { +int hero_set_state(int requested_state, int animation_update_mode) { int previous_state_step; char *moby; int old20A7; { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || b != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_update_mode != 2)) return 0; } - if ((D_L11_0015F5C4 == 2 || D_L11_0015F5C4 == 6) && b != 2) + if ((D_L11_0015F5C4 == 2 || D_L11_0015F5C4 == 6) && animation_update_mode != 2) return 0; { struct Hero *p = &hero; @@ -147,7 +147,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; q->rand_timer.range = 0x68; } - if (b) { + if (animation_update_mode) { if (get_hero_idle_animation_index(0) == 0x54) { set_hero_animation( get_hero_idle_animation_index(0), 0, (float)scale_game_frames(0x12)); @@ -163,7 +163,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; clear_u64_value(&p->motion.momentum); p->rand_timer.range = 0x68; - if (b) { + if (animation_update_mode) { if (get_hero_idle_animation_index(0) == 0x54) { set_hero_animation( get_hero_idle_animation_index(0), 0, (float)scale_game_frames(0x12)); @@ -189,7 +189,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0x45, 0, (float)scale_game_frames(0xC)); break; } @@ -200,7 +200,7 @@ int hero_set_state(int requested_state, int b) { p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); FUN_L00_0025f730(&p->motion.momentum, frame_time * 3.5f); - if (b) + if (animation_update_mode) set_hero_animation(0x7C, 0, (float)scale_game_frames(0xC)); break; } @@ -216,7 +216,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->unk6A0 = 0; p->unk690 = p->motion.pos.f[2] - p->unk69C; - if (b) + if (animation_update_mode) set_hero_animation(0x74, 0, (float)scale_game_frames(0xB)); break; } @@ -238,7 +238,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->unk8E0 = 0; n = scale_game_frames(0xC); - if (b) + if (animation_update_mode) set_hero_animation(0x3B, 0, (float)n); } break; @@ -259,7 +259,7 @@ int hero_set_state(int requested_state, int b) { n = scale_game_frames(0xB); if (p->state.prev == 0x33) n = scale_game_frames(0xF); - if (b) + if (animation_update_mode) set_hero_animation(0x3D, 0, (float)n); break; } @@ -274,7 +274,7 @@ int hero_set_state(int requested_state, int b) { n = scale_game_frames(0x23); if (p->state.prev == 0x35) n = -2; - if (b) + if (animation_update_mode) set_hero_animation(0x3C, 0, (float)n); break; } @@ -342,7 +342,7 @@ int hero_set_state(int requested_state, int b) { s->motion.momentum.f[2] = 0.0f; FUN_L00_0025f730(&s->motion.momentum, frame_time * 5.5f); s->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x3A, 0, (float)scale_game_frames(0x16)); } break; @@ -366,7 +366,7 @@ int hero_set_state(int requested_state, int b) { int t = scale_game_frames(0x4D); struct Hero *q = &hero; q->invulnerable_frames = t; - if (b) { + if (animation_update_mode) { if (q->state.current == 0x75) { set_hero_animation(0x70, 3, -3.0f); } else { @@ -390,7 +390,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->drown_sink_speed = 0; p->unk698 = scale_game_frames(0x2D); p->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x65, 0, (float)scale_game_frames(0x11)); break; } @@ -432,7 +432,7 @@ int hero_set_state(int requested_state, int b) { char *v = (char *)&hero.motion.momentum; qcopy(v, v - 0x40); } - if (b) + if (animation_update_mode) set_hero_animation(0x5F, 0, (float)scale_game_frames(0xA)); break; } @@ -443,7 +443,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0x80, 0, (float)scale_game_frames(0xA)); break; } @@ -451,7 +451,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0x46, 0, (float)scale_game_frames(8)); break; } @@ -459,7 +459,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0x47, 0, (float)scale_game_frames(8)); break; } @@ -467,7 +467,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0x48, 0, (float)scale_game_frames(8)); break; } @@ -479,7 +479,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&D_L11_0015F688 = scale_game_frames(0x3C); if (p->unk20AA == 0) { t = get_hero_idle_animation_index(1); - if (p->moby->prev_seq != t && b) { + if (p->moby->prev_seq != t && animation_update_mode) { set_hero_animation(t, 0, (float)scale_game_frames(0x12)); } } @@ -568,7 +568,7 @@ int hero_set_state(int requested_state, int b) { scale_game_frames(5) < u->rail_land_frames) n = scale_game_frames(0xD); } - if (b) { + if (animation_update_mode) { struct Hero *v = &hero; set_hero_animation(v->state.step + 3, D_L11_0015F6D8[v->state.step], (float)n); } @@ -584,7 +584,7 @@ int hero_set_state(int requested_state, int b) { p->item_use_locked = 1; if (p->vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) cancel_hero_item_animation(); - if (b) { + if (animation_update_mode) { if (p->vehicle_mode == 3) { set_hero_animation(1, 0, (float)scale_game_frames(8)); } else if (p->vehicle_mode == HERO_VEHICLE_MODE_CLANK) { @@ -614,7 +614,7 @@ int hero_set_state(int requested_state, int b) { } return 0; } - if (b) { + if (animation_update_mode) { struct Hero *q = &hero; float d = q->anim_frame; int id = 6; @@ -631,7 +631,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.momentum, v); - if (b) { + if (animation_update_mode) { int id = 6; float d = p->anim_frame; if (return_hero_animation_id_unchanged(MOBY(moby)->seq) == 4 && 3.0f < d && d < 16.0f) @@ -658,7 +658,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&q->motion.momentum, frame_time * 7.0f); if (frame_time * 3.5f < q->motion.forward_speed) allocate_hero_voice_for_entry(0xC, 0); - if (b) { + if (animation_update_mode) { if (q->moby->seq == get_hero_idle_animation_index(0)) { set_hero_animation(0xD, 2, (float)scale_game_frames(9)); } else { @@ -685,7 +685,7 @@ int hero_set_state(int requested_state, int b) { } p->motion.move_yaw = fast_arc_tan(p->grapple_target->pos.x - p->motion.pos.f[0], p->grapple_target->pos.y - p->motion.pos.f[1]); - if (b) { + if (animation_update_mode) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); hero_queue_sequence(0xA, 0xE); } @@ -698,7 +698,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->item_use_locked = 1; - if (b) + if (animation_update_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(0xA)); break; } @@ -710,7 +710,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->tether_radius = fast_vec_dist(&p->motion.pos, &p->grapple_target->pos); - if (b) + if (animation_update_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(5)); break; } @@ -766,7 +766,7 @@ int hero_set_state(int requested_state, int b) { } else if (q->state.prev_control_mode == 2) { q->swing_gravity = q->fall_state_gravity; } - if (b) { + if (animation_update_mode) { set_hero_animation(0x34, 0, (float)scale_game_frames(0xB)); { struct Hero *r = &hero; @@ -782,7 +782,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 7; clear_u64_value(&p->motion.rot_spring_vel); qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xF)); break; } @@ -794,7 +794,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->past_apex = 0; p->rise_fall_land_frames = 0; p->rise_fall_gravity = frame_time_sq * 100.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x2A, 0, (float)scale_game_frames(6)); break; } @@ -809,7 +809,7 @@ int hero_set_state(int requested_state, int b) { p->unk4F0 = p->smoothed_ground_z; } p->item_select_blocked = 1; - if (b) { + if (animation_update_mode) { if (frame_time * 3.5f < p->motion.flat_speed) { set_hero_animation(0x20, 0, (float)scale_game_frames(9)); } else { @@ -824,7 +824,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0xD; p->item_select_blocked = 1; p->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x21, 0, (float)scale_game_frames(6)); break; } @@ -833,7 +833,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (animation_update_mode) set_hero_animation(0x24, 0, (float)scale_game_frames(6)); break; } @@ -842,7 +842,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (animation_update_mode) set_hero_animation(0x25, 0, (float)scale_game_frames(6)); break; } @@ -851,7 +851,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xC)); break; } @@ -875,7 +875,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->state.step = 0; qcopy(&q->motion.velocity, &q->motion.resolved_velocity); - if (b) { + if (animation_update_mode) { if (q->vehicle_mode == 3) { set_hero_animation(6, 0, (float)scale_game_frames(8)); return 1; @@ -901,7 +901,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) { + if (animation_update_mode) { set_hero_animation(0x13, 0, (float)state_81_animation_timing_override); } break; @@ -916,7 +916,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.displacement); - if (b) { + if (animation_update_mode) { set_hero_animation(0x13, 0, (float)animation_timing_override); } break; @@ -1225,7 +1225,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (q->fall_start_distance == 0.0f) q->fall_start_distance = q->unk430 * 1.5f; - if (b) { + if (animation_update_mode) { int s = q->state.current; if (s == 7) { set_hero_animation(7, 0, (float)scale_game_frames(5)); @@ -1315,7 +1315,7 @@ int hero_set_state(int requested_state, int b) { update_hero_target_heading(8.0f, 1.0471976f, -1.0f); *(int *)&q->slam_descending = 0; q->items[0].timer = 0xA; - if (b) { + if (animation_update_mode) { char *m; int n = scale_game_frames(0xB); if (q->state.prev == 0xB && scale_game_frames(0x2A) > q->state.prev_timer) @@ -1352,7 +1352,7 @@ int hero_set_state(int requested_state, int b) { q->saved_item[0] = 0; update_hero_target_heading(14.0f, 0.5235988f, -1.0f); q->unkA7C = q->unkA7C == 0; - if (b) { + if (animation_update_mode) { int n = scale_game_frames(0xA); if (q->moby->prev_seq == 0x1A) n = scale_game_frames(3); @@ -1367,7 +1367,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (((void *)q->items[0].moby) == 0) break; - if (b) { + if (animation_update_mode) { set_hero_animation(0x67, 4, -1.0f); blend_moby_animation(((void *)q->items[0].moby), 3, 4, -1); } @@ -1398,7 +1398,7 @@ int hero_set_state(int requested_state, int b) { r->attack_record = k; } update_hero_target_heading(5.0f, 0.7853982f, 0.7853982f); - if (b) { + if (animation_update_mode) { char *m; int j = 0; int n; @@ -1429,7 +1429,7 @@ int hero_set_state(int requested_state, int b) { } case HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL: { struct Hero *q; - if (b) + if (animation_update_mode) set_hero_animation(0x2C, 7, (float)scale_game_frames(9)); q = &hero; if (q->items[0].item_id == 0xA && ((char *)q->throw_target) != 0) { @@ -1448,7 +1448,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0xA; p->unk2284 = 0; p->ground_speed = frame_time * 9.0f; - if (b) { + if (animation_update_mode) { char *m; HeroTableRow2C *e = &D_L11_0017C628[p->attack_record]; int k = e->kind; @@ -1469,7 +1469,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->pushback_yaw = fast_add_rotations(p->motion.rot.f[2], 3.1415927f); p->ground_speed = frame_time * 9.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x29, 5, (float)scale_game_frames(8)); break; } @@ -1491,7 +1491,7 @@ int hero_set_state(int requested_state, int b) { { struct Hero *q = &hero; q->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (animation_update_mode) { set_hero_animation(0x10, 3, -3.0f); q->moby->anim_time = level_11_hero_animation_blend_curves[q->anim_blend_curve] [(q->anim_blend_step)++]; @@ -1503,7 +1503,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0, 0, (float)scale_game_frames(0xE)); break; } @@ -1511,7 +1511,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) { + if (animation_update_mode) { set_hero_animation(4, 0, (float)scale_game_frames(7)); hero_queue_sequence(0xE, 0x22); } @@ -1522,7 +1522,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(6, 0, (float)scale_game_frames(0xC)); break; } @@ -1533,7 +1533,7 @@ int hero_set_state(int requested_state, int b) { p->fall_state_gravity = frame_time_sq * 24.0f; p->stickless_decel = frame_time_sq * 7.0f; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(6, 0, (float)scale_game_frames(7)); break; } @@ -1550,7 +1550,7 @@ int hero_set_state(int requested_state, int b) { if (frame_time * 1.5f < planar_speed) hero_base->ground_speed = frame_time * 1.5f; hero_base->unk3B8 = 0; - if (b) + if (animation_update_mode) set_hero_animation(1, 0, (float)scale_game_frames(8)); } break; @@ -1560,7 +1560,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(3, 0, (float)scale_game_frames(0xC)); break; } @@ -1573,7 +1573,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&p->motion.velocity, frame_time * 5.0f); hero_change_health(1); p->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (animation_update_mode) { set_hero_animation(2, 3, -3.0f); p->moby->anim_time = level_11_hero_animation_blend_curves[p->anim_blend_curve][(p->anim_blend_step)++]; @@ -1594,7 +1594,7 @@ int hero_set_state(int requested_state, int b) { clear_u64_value(&p->motion.velocity); clear_u64_value(&p->motion.displacement); p->motion.velocity.f[2] = frame_time * 10.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x10, 2, -3.0f); break; } @@ -1646,7 +1646,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->tilt_disabled = 1; p->item_use_locked = 1; - if (b) + if (animation_update_mode) set_hero_animation(get_hero_idle_animation_index(0), 0, -1.0f); break; } @@ -1657,7 +1657,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->item_use_locked = 1; clear_u64_value(&p->motion.velocity); - if (b) + if (animation_update_mode) set_hero_animation(0xB, 0, -1.0f); break; } @@ -1667,7 +1667,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x18; p->item_use_locked = 1; cancel_hero_item_animation(); - if (b) + if (animation_update_mode) set_hero_animation(get_hero_idle_animation_index(0), 0, -1.0f); break; } From 276ccb65f3283891c31f0ce799940b75ce860ddd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:04:35 +0000 Subject: [PATCH 075/758] decomp: clarify names in snagglebeast_update domain_10_value_16 -> SNAGGLEBEAST_POST_DEATH_CLEANUP: Retail 0031488c..00314890 excludes moby+0x20 state 16 from health HUD updates. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_POST_DEATH_CLEANUP case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_11_value_1 -> SNAGGLEBEAST_IDLE: Retail 003148f8..003148fc stores 1 to moby+0x20 after entering initialization. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_12_value_4 -> SNAGGLEBEAST_SWEEP_BEAM_ATTACK: Retail 00314c60..00314c64 stores 4 to moby+0x20 after clearing sweep counters and selecting animation 5. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_SWEEP_BEAM_ATTACK case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_13_value_5 -> SNAGGLEBEAST_CHASE_TARGET: Retail 00314c70..00314c84 tests moby+0x20 against 5 before randomizing triple-spawn entry. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CHASE_TARGET case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_14_value_3 -> SNAGGLEBEAST_TRIPLE_SPAWN_ATTACK: Retail 00314cd4..00314cdc stores 3 to moby+0x20 after selecting animation 4. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_TRIPLE_SPAWN_ATTACK case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_15_value_8 -> SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO: Retail 00314d28..00314d4c stores 8 to moby+0x20 and clears capture length, latch and turn fields. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_16_value_2 -> SNAGGLEBEAST_ALTERNATING_JOINT_EMISSION_BURST: Retail 00314d94..00314d98 stores 2 to moby+0x20 after selecting emission animation 9. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_ALTERNATING_JOINT_EMISSION_BURST case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_17_value_8 -> SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO: Retail 00314da0..00314da8 compares moby+0x20 against 8 before allowing follow-target chase entry. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_18_value_5 -> SNAGGLEBEAST_CHASE_TARGET: Retail 00314df0..00314e00 stores 5 to moby+0x20 with animation speed 1.5 and cleared chase counter. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CHASE_TARGET case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_19_value_1 -> SNAGGLEBEAST_IDLE: Retail 00315068..00315084 reaches 00317800..00317808 storing idle 1 after emission distance exit. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_1_value_5 -> SNAGGLEBEAST_CHASE_TARGET: Retail 0031431c..00314354 compares moby+0x20 with 5 while choosing chase distance thresholds. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CHASE_TARGET case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_20_value_1 -> SNAGGLEBEAST_IDLE: Retail 00315318..00315378 reaches the common idle store after triple-spawn completion. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_21_value_1 -> SNAGGLEBEAST_IDLE: Retail 0031575c..00315770 resets sweep timers and reaches common idle store 00317800..00317808. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_22_value_7 -> SNAGGLEBEAST_TURN_TOWARD_TARGET: Retail 0031599c..00315a04 saves moby+0x20 then stores 7 after capturing waypoint and turn-resume animation. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_TURN_TOWARD_TARGET case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_23_value_1 -> SNAGGLEBEAST_IDLE: Retail 00315b14..00315b20 clears waypoint and stores 1 after navigation result 4 or no movement. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_24_value_4 -> SNAGGLEBEAST_SWEEP_BEAM_ATTACK: Retail 00315bb8..00315c08 clears sweep counters, selects animation 5 and stores 4 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_SWEEP_BEAM_ATTACK case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_25_value_3 -> SNAGGLEBEAST_TRIPLE_SPAWN_ATTACK: Retail 00315c14..00315c60 clears spawn counter, selects animation 4 and stores 3 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_TRIPLE_SPAWN_ATTACK case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_26_value_9 -> SNAGGLEBEAST_ROPE_ATTACK: Retail 00315c70..00315ca8 copies the elevated target into rope target and stores 9 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_ROPE_ATTACK case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_27_value_8 -> SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO: Retail 00315cfc..00315d24 clears capture fields, selects animation 6 and stores 8 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_28_value_1 -> SNAGGLEBEAST_IDLE: Retail 00315d30..00315d90 restores idle animation and stores 1 when follow_target is false. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_29_value_13 -> SNAGGLEBEAST_WAIT_BEFORE_TIMED_DAMAGE: Retail 00316214..00316220 stores 13 to moby+0x20 after timed-damage sequence entry. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_WAIT_BEFORE_TIMED_DAMAGE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_2_value_5 -> SNAGGLEBEAST_CHASE_TARGET: Retail 00314350..00314354 compares moby+0x20 with 5 in the six-unit chase-distance gate. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CHASE_TARGET case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_30_value_14 -> SNAGGLEBEAST_APPLY_TIMED_DAMAGE_AND_SELECT_PATH: Retail 003164c8..00316500 stores 14 to moby+0x20 and initializes timed health-decrement count. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_APPLY_TIMED_DAMAGE_AND_SELECT_PATH case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_31_value_10 -> SNAGGLEBEAST_DEATH_EXPLOSION: Retail 003166d4..00316770 handles zero health and stores 10 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_DEATH_EXPLOSION case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_32_value_15 -> SNAGGLEBEAST_RESTORE_TRANSFORM_AND_RESUME_CHASE: Retail 003168d4..00316910 maps selected path point, builds adjacency masks and stores 15 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_RESTORE_TRANSFORM_AND_RESUME_CHASE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_33_value_6 -> SNAGGLEBEAST_CHASE_AFTER_TRANSFORM_RESTORE: Retail 003169c4..00316a28 restores position and heading, advances encounter phase and stores 6 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CHASE_AFTER_TRANSFORM_RESTORE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_34_value_1 -> SNAGGLEBEAST_IDLE: Retail 00316cc8..00316d5c completes ammo-drain sequence, detaches rope and stores idle 1 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_35_value_1 -> SNAGGLEBEAST_IDLE: Retail 00317110..003171a4 cancels capture, releases owned voice and stores idle 1 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_36_value_2 -> SNAGGLEBEAST_ALTERNATING_JOINT_EMISSION_BURST: Retail 003171b4..00317278 detaches capture rope, selects animation 9 and stores 2 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_ALTERNATING_JOINT_EMISSION_BURST case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_37_value_1 -> SNAGGLEBEAST_IDLE: Retail 0031763c..003176a8 clears rope substate/timer and reaches common idle store 00317800..00317808. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_38_value_16 -> SNAGGLEBEAST_POST_DEATH_CLEANUP: Retail 00317764..003177a4 spawns death explosion, sets flags and stores 16 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_POST_DEATH_CLEANUP case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_39_value_9 -> SNAGGLEBEAST_ROPE_ATTACK: Retail 003177c0..003177fc captures elevated target position and stores 9 to moby+0x20. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_ROPE_ATTACK case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_3_value_5 -> SNAGGLEBEAST_CHASE_TARGET: Retail 00314448..0031444c compares moby+0x20 with 5 to choose the fourteen-unit target-close threshold. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CHASE_TARGET case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_40_value_1 -> SNAGGLEBEAST_IDLE: Retail 003177b8..00317808 chooses idle 1 when no elevated target is available. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_41_value_10 -> SNAGGLEBEAST_DEATH_EXPLOSION: Retail 0031789c..003178b8 compares moby+0x20 below 10 to gate jet_animate before death states. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_DEATH_EXPLOSION case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_4_value_5 -> SNAGGLEBEAST_CHASE_TARGET: Retail 00314490..00314498 excludes moby+0x20 state 5 from the ten-unit target-close threshold. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CHASE_TARGET case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_5_value_1 -> SNAGGLEBEAST_IDLE: Retail 00314598..003145ac tests moby+0x20 against 1 before suppressing the sweep timer flag. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_IDLE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_6_value_8 -> SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO: Retail 003146d0..003146d8 excludes moby+0x20 state 8 from the suck-beam draw enqueue. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_7_value_0 -> SNAGGLEBEAST_INITIALIZE: Retail 003146d8..003146e8 also excludes moby+0x20 state 0 from the suck-beam draw enqueue. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_INITIALIZE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_8_value_0 -> SNAGGLEBEAST_INITIALIZE: Retail 0031487c..00314880 excludes moby+0x20 state 0 from health HUD updates. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_INITIALIZE case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. domain_9_value_10 -> SNAGGLEBEAST_DEATH_EXPLOSION: Retail 00314884..00314888 excludes moby+0x20 state 10 from health HUD updates. The SHA-bound C dispatches this identical MOBY(moby)->state byte (retail 003148cc..003148ec, offset +0x20) through the existing SNAGGLEBEAST_DEATH_EXPLOSION case; reuse that canonical main-state member, separate from command phases, rope substates and HeroStateId. --- src/overlays/l07/mobys/snagglebeast.c | 76 +++++++++++++-------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index 4da29cc31a..689cf13a70 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -1043,9 +1043,9 @@ void snagglebeast_update(unsigned char *moby) { } if (FUN_L00_001fefc8(&snagglebeast_instance_state->timer_1F7)) { if ((vector_distance_xy(moby + 0x10, ((char *)&hero) + 0x80) > 8.0f && - MOBY(moby)->state != 5) || + MOBY(moby)->state != SNAGGLEBEAST_CHASE_TARGET) || (vector_distance_xy(moby + 0x10, ((char *)&hero) + 0x80) > 6.0f && - (MOBY(moby)->state == 5 || MOBY(moby)->command % 3U == 1))) { + (MOBY(moby)->state == SNAGGLEBEAST_CHASE_TARGET || MOBY(moby)->command % 3U == 1))) { follow_target = 1; } } @@ -1063,9 +1063,9 @@ void snagglebeast_update(unsigned char *moby) { } target_close = 0; if (fast_dec_timer_s16(&snagglebeast_instance_state->timer_198)) { - if (((MOBY(moby)->state == 5 || MOBY(moby)->command % 3U == 1) && + if (((MOBY(moby)->state == SNAGGLEBEAST_CHASE_TARGET || MOBY(moby)->command % 3U == 1) && target_distance < 14.0f) || - (MOBY(moby)->state != 5 && target_distance < 10.0f)) + (MOBY(moby)->state != SNAGGLEBEAST_CHASE_TARGET && target_distance < 10.0f)) target_close = 1; } { @@ -1110,7 +1110,7 @@ void snagglebeast_update(unsigned char *moby) { case SNAGGLEBEAST_PHASE_AFTER_THIRD_HEALTH_THRESHOLD: timer194 = 0; sight_ready = 0; - if (MOBY(moby)->state != 1) + if (MOBY(moby)->state != SNAGGLEBEAST_IDLE) timer19a = 0; break; case SNAGGLEBEAST_PHASE_FIRST_TIMED_DAMAGE_SEQUENCE: @@ -1143,7 +1143,7 @@ void snagglebeast_update(unsigned char *moby) { } if (MOBY(moby)->command % 3U == 2) snagglebeast_instance_state->health_display += 0xF; - if (MOBY(moby)->state != 8 && MOBY(moby)->state != 0) + if (MOBY(moby)->state != SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO && MOBY(moby)->state != SNAGGLEBEAST_INITIALIZE) suck_beam_queue_draw((int)moby); if ((int)snagglebeast_instance_state->sphere_fade_direction - 1 == 0) { if (snagglebeast_instance_state->voice == -1) @@ -1176,7 +1176,7 @@ void snagglebeast_update(unsigned char *moby) { add_draw_callback(draw_snagglebeast_sphere_effect, moby); update_snagglebeast_target_joint_animation( (char *)moby, snagglebeast_instance_state, hero.motion.pos.f); - if (MOBY(moby)->state != 0 && MOBY(moby)->state != 0xA && MOBY(moby)->state != 0x10) { + if (MOBY(moby)->state != SNAGGLEBEAST_INITIALIZE && MOBY(moby)->state != SNAGGLEBEAST_DEATH_EXPLOSION && MOBY(moby)->state != SNAGGLEBEAST_POST_DEATH_CLEANUP) { snagglebeast_instance_state->unk1B0 = queue_animation_update(0x16, 0xFFFF, @@ -1189,7 +1189,7 @@ void snagglebeast_update(unsigned char *moby) { switch (MOBY(moby)->state) { case SNAGGLEBEAST_INITIALIZE: *(int *)&D_L07_00161B64 = 0; - MOBY(moby)->state = 1; + MOBY(moby)->state = SNAGGLEBEAST_IDLE; MOBY(moby)->command = 0; snagglebeast_instance_state->point_light = -1; snagglebeast_instance_state->measured_path_length = 0.0f; @@ -1267,16 +1267,16 @@ void snagglebeast_update(unsigned char *moby) { int r = random_int_between(0, 2); FUN_00212f90(moby, 5, r, random_int_between(0x12, 0x14)); } - MOBY(moby)->state = 4; + MOBY(moby)->state = SNAGGLEBEAST_SWEEP_BEAM_ATTACK; } if (timer194) { - if (MOBY(moby)->state != 5 || FUN_00213260(4) == 0) { + if (MOBY(moby)->state != SNAGGLEBEAST_CHASE_TARGET || FUN_00213260(4) == 0) { snagglebeast_instance_state->unk164 = 0; if (MOBY(moby)->prev_seq != 4) { int r = random_int_between(0, 9); FUN_00212f90(moby, 4, r, random_int_between(0x14, 0x28)); } - MOBY(moby)->state = 3; + MOBY(moby)->state = SNAGGLEBEAST_TRIPLE_SPAWN_ATTACK; MOBY(moby)->anim_speed = 1.0f; } } @@ -1288,7 +1288,7 @@ void snagglebeast_update(unsigned char *moby) { snagglebeast_instance_state->unk164 = 0; snagglebeast_instance_state->unk16C = 0.0f; snagglebeast_instance_state->unk1C4 = 0; - MOBY(moby)->state = 8; + MOBY(moby)->state = SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO; snagglebeast_instance_state->unk294 = 0; snagglebeast_instance_state->voice = FUN_0022da68(9, 4, (int)moby); } @@ -1297,17 +1297,17 @@ void snagglebeast_update(unsigned char *moby) { int r = random_int_between(0, 2); FUN_00212f90(moby, 9, r, random_int_between(0x11, 0x19)); } - MOBY(moby)->state = 2; + MOBY(moby)->state = SNAGGLEBEAST_ALTERNATING_JOINT_EMISSION_BURST; } } - if (follow_target && MOBY(moby)->state != 8) { + if (follow_target && MOBY(moby)->state != SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO) { if (MOBY(moby)->prev_seq != 0xA) { int r = random_int_between(0, 4); FUN_00212f90(moby, 0xA, r, random_int_between(0x14, 0x1E)); } MOBY(moby)->anim_speed = 1.5f; snagglebeast_instance_state->unk298 = 0; - MOBY(moby)->state = 5; + MOBY(moby)->state = SNAGGLEBEAST_CHASE_TARGET; } break; case SNAGGLEBEAST_ALTERNATING_JOINT_EMISSION_BURST: { @@ -1344,7 +1344,7 @@ void snagglebeast_update(unsigned char *moby) { (MOBY(moby)->command % 3U == 1 && vector_distance_xy(&sight, moby + 0x10) > 20.0f)) { snagglebeast_instance_state->timer_198 = scale_game_frames(0x23); snagglebeast_instance_state->timer = scale_game_frames(0x1E); - MOBY(moby)->state = 1; + MOBY(moby)->state = SNAGGLEBEAST_IDLE; } break; } @@ -1403,7 +1403,7 @@ void snagglebeast_update(unsigned char *moby) { int r2 = random_int_between(0, 0xF); FUN_00212f90(moby, r1, r2, random_int_between(0x1E, 0x2A)); } - MOBY(moby)->state = 1; + MOBY(moby)->state = SNAGGLEBEAST_IDLE; } break; case SNAGGLEBEAST_SWEEP_BEAM_ATTACK: @@ -1483,7 +1483,7 @@ void snagglebeast_update(unsigned char *moby) { snagglebeast_instance_state->unk164 = 0; snagglebeast_instance_state->timer_19A = scale_game_frames(0xF0); snagglebeast_instance_state->timer = scale_game_frames(0xC8); - MOBY(moby)->state = 1; + MOBY(moby)->state = SNAGGLEBEAST_IDLE; } } } @@ -1551,7 +1551,7 @@ void snagglebeast_update(unsigned char *moby) { int r = random_int_between(0, 1); FUN_00212f90(moby, 3, r, random_int_between(0xF, 0x16)); } - MOBY(moby)->state = 7; + MOBY(moby)->state = SNAGGLEBEAST_TURN_TOWARD_TARGET; } else { int hit = update_snagglebeast_chase_movement((struct Moby *)moby, @@ -1589,7 +1589,7 @@ void snagglebeast_update(unsigned char *moby) { FUN_00212f90(moby, r1, r2, random_int_between(0x14, 0x28)); } snagglebeast_instance_state->unk1A8 = -1; - MOBY(moby)->state = 1; + MOBY(moby)->state = SNAGGLEBEAST_IDLE; break; } if (MOBY(moby)->prev_seq != 0xA) { @@ -1608,7 +1608,7 @@ void snagglebeast_update(unsigned char *moby) { int r = random_int_between(0, 2); FUN_00212f90(moby, 5, r, random_int_between(0x14, 0x19)); } - MOBY(moby)->state = 4; + MOBY(moby)->state = SNAGGLEBEAST_SWEEP_BEAM_ATTACK; } if (timer194) { snagglebeast_instance_state->unk164 = 0; @@ -1616,7 +1616,7 @@ void snagglebeast_update(unsigned char *moby) { int r = random_int_between(0, 5); FUN_00212f90(moby, 4, r, random_int_between(0x14, 0x28)); } - MOBY(moby)->state = 3; + MOBY(moby)->state = SNAGGLEBEAST_TRIPLE_SPAWN_ATTACK; MOBY(moby)->anim_speed = 1.0f; } if (target_above) { @@ -1626,7 +1626,7 @@ void snagglebeast_update(unsigned char *moby) { qcopy(snagglebeast_instance_state->unk150, *(char **)(g + 0x2FC) + 0x10); } snagglebeast_instance_state->unk150[2] += 3.0f; - MOBY(moby)->state = 9; + MOBY(moby)->state = SNAGGLEBEAST_ROPE_ATTACK; } if (sight_ready) { MOBY(moby)->anim_speed = 1.0f; @@ -1638,7 +1638,7 @@ void snagglebeast_update(unsigned char *moby) { snagglebeast_instance_state->unk16C = 0.0f; snagglebeast_instance_state->unk1C4 = 0; snagglebeast_instance_state->unk294 = 0; - MOBY(moby)->state = 8; + MOBY(moby)->state = SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO; snagglebeast_instance_state->voice = FUN_0022da68(9, 4, (int)moby); } } @@ -1649,7 +1649,7 @@ void snagglebeast_update(unsigned char *moby) { int r2 = random_int_between(0, 2); FUN_00212f90(moby, r1, r2, random_int_between(0x1C, 0x28)); } - MOBY(moby)->state = 1; + MOBY(moby)->state = SNAGGLEBEAST_IDLE; } if (MOBY(moby)->seq == 0xC) update_alternating_joint_emission_burst( @@ -1736,7 +1736,7 @@ void snagglebeast_update(unsigned char *moby) { if (MOBY(moby)->prev_seq != 0xB) FUN_00212f90(moby, 0xB, 0x3D, 1); } - MOBY(moby)->state = 0xD; + MOBY(moby)->state = SNAGGLEBEAST_WAIT_BEFORE_TIMED_DAMAGE; snagglebeast_instance_state->unk100[2] = 0.0f; if (MOBY(moby)->command % 3U < 2) MOBY(moby)->command += 1; @@ -1812,7 +1812,7 @@ void snagglebeast_update(unsigned char *moby) { if (done) { snagglebeast_instance_state->timer = scale_game_frames(0xA); snagglebeast_instance_state->sphere_fade_direction = 2; - MOBY(moby)->state = 0xE; + MOBY(moby)->state = SNAGGLEBEAST_APPLY_TIMED_DAMAGE_AND_SELECT_PATH; snagglebeast_instance_state->unk164 = snagglebeast_instance_state->max_health / 6; } break; @@ -1858,7 +1858,7 @@ void snagglebeast_update(unsigned char *moby) { (char *)l07_cuboids + (snagglebeast_instance_state->cuboid << 7) + 0x70); } - MOBY(moby)->state = 0xA; + MOBY(moby)->state = SNAGGLEBEAST_DEATH_EXPLOSION; } else { if (snagglebeast_instance_state->unk164 > 0) { snagglebeast_instance_state->timer = scale_game_frames(0xA); @@ -1904,7 +1904,7 @@ void snagglebeast_update(unsigned char *moby) { (int)collect_snagglebeast_navigation_ids( moby, snagglebeast_instance_state, &position), snagglebeast_instance_state->nav_path); - MOBY(moby)->state = 0xF; + MOBY(moby)->state = SNAGGLEBEAST_RESTORE_TRANSFORM_AND_RESUME_CHASE; } } break; @@ -1936,7 +1936,7 @@ void snagglebeast_update(unsigned char *moby) { MOBY(moby)->anim_speed = 1.5f; MOBY(moby)->command += 1; snagglebeast_instance_state->unk298 = 0; - MOBY(moby)->state = 6; + MOBY(moby)->state = SNAGGLEBEAST_CHASE_AFTER_TRANSFORM_RESTORE; snagglebeast_instance_state->timer = scale_game_frames(0x37); } break; @@ -2021,7 +2021,7 @@ void snagglebeast_update(unsigned char *moby) { } } snagglebeast_instance_state->voice = -1; - MOBY(moby)->state = 1; + MOBY(moby)->state = SNAGGLEBEAST_IDLE; } else { int ammo_transfer_count = (l07_ammo_transfer_records + slot)->count; int rem; @@ -2121,7 +2121,7 @@ void snagglebeast_update(unsigned char *moby) { } } snagglebeast_instance_state->voice = -1; - MOBY(moby)->state = 1; + MOBY(moby)->state = SNAGGLEBEAST_IDLE; } if (target_close) { snagglebeast_instance_state->timer_196 = scale_game_frames(0x1E); @@ -2143,7 +2143,7 @@ void snagglebeast_update(unsigned char *moby) { } } snagglebeast_instance_state->voice = -1; - MOBY(moby)->state = 2; + MOBY(moby)->state = SNAGGLEBEAST_ALTERNATING_JOINT_EMISSION_BURST; } break; } @@ -2244,7 +2244,7 @@ void snagglebeast_update(unsigned char *moby) { int r2 = random_int_between(0, 7); FUN_00212f90(moby, r1, r2, random_int_between(0x1B, 0x2D)); } - MOBY(moby)->state = 1; + MOBY(moby)->state = SNAGGLEBEAST_IDLE; break; } break; @@ -2281,7 +2281,7 @@ void snagglebeast_update(unsigned char *moby) { if (snagglebeast_instance_state->unk1CC != -1) initialize_moby_particle_effect_state(level_mobys + (snagglebeast_instance_state->unk1CC << 8)); - MOBY(moby)->state = 0x10; + MOBY(moby)->state = SNAGGLEBEAST_POST_DEATH_CLEANUP; MOBY(moby)->pos.z = 20.0f; } break; @@ -2294,9 +2294,9 @@ void snagglebeast_update(unsigned char *moby) { qcopy(snagglebeast_instance_state->unk150, *(char **)(g + 0x2FC) + 0x10); } snagglebeast_instance_state->unk150[2] += 3.0f; - MOBY(moby)->state = 9; + MOBY(moby)->state = SNAGGLEBEAST_ROPE_ATTACK; } else { - MOBY(moby)->state = 1; + MOBY(moby)->state = SNAGGLEBEAST_IDLE; } } break; @@ -2317,7 +2317,7 @@ void snagglebeast_update(unsigned char *moby) { break; } fast_vec_sub(snagglebeast_instance_state->unk100, moby + 0x10, &oldpos); - if (MOBY(moby)->state < 0xA) + if (MOBY(moby)->state < SNAGGLEBEAST_DEATH_EXPLOSION) jet_animate((struct Moby *)moby, 2.5f); update_timed_point_light_color((char *)snagglebeast_instance_state); } From 3e300df92371339b41a2dfbf3458a695beb61bd5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:04:35 +0000 Subject: [PATCH 076/758] decomp: clarify names in hero_set_state b -> entry_animation_mode: Authoritative hero_set_state source SHA-256 0890b2ef00bd21de205c7177a4a495d9275b610d4b9d1ec939318b522c9e02c8 and original retail Ghidra param_2 agree. Retail 0x00240128 saves a1 in s4. Checks 0x00240138..0x00240140 and 0x0024014c..0x00240164 require s4==2 to permit the dying-mode special request and global-mode exceptions. Nonzero s4 gates optional entry-animation setup: 0x002403a0 skips idle animation selection, 0x002404e0 skips dying animation, 0x00242ac4 skips jump animation selection, and 0x00243b94 skips the shared cancel-item idle animation. The recursive idle request at 0x002413e8 has a1=0 and then explicitly sets its animation at 0x0024141c; the slip request at 0x00241554 uses a1=1. Thus this integer selects optional entry-animation behavior with a special value-2 acceptance override, rather than identifying the requested hero state. --- src/overlays/l12/hero/hero_set_state.c | 122 ++++++++++++------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/src/overlays/l12/hero/hero_set_state.c b/src/overlays/l12/hero/hero_set_state.c index 154ecb7be9..5e817b4c22 100644 --- a/src/overlays/l12/hero/hero_set_state.c +++ b/src/overlays/l12/hero/hero_set_state.c @@ -66,17 +66,17 @@ extern int hero_set_state(int, int) __asm__("FUN_L12_002400d0"); extern char level12_transform_trail_jump_velocity_key_profile[] __asm__("D_L12_0017C3A0"); extern char level12_water_surface_jump_velocity_key_profile[] __asm__("D_L12_0017C3E0"); -int hero_set_state(int requested_state, int b) { +int hero_set_state(int requested_state, int entry_animation_mode) { int previous_state_step; char *moby; int old20A7; { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || b != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || entry_animation_mode != 2)) return 0; } - if ((D_L12_0015F5C4 == 2 || D_L12_0015F5C4 == 6) && b != 2) + if ((D_L12_0015F5C4 == 2 || D_L12_0015F5C4 == 6) && entry_animation_mode != 2) return 0; { struct Hero *p = &hero; @@ -155,7 +155,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; q->rand_timer.range = 0x68; } - if (b) { + if (entry_animation_mode) { if (hero_get_gadget_anim_id(0) == 0x54) { set_hero_animation(hero_get_gadget_anim_id(0), 0, (float)scale_game_frames(0x12)); } else { @@ -170,7 +170,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; clear_u64_value(&p->motion.momentum); p->rand_timer.range = 0x68; - if (b) { + if (entry_animation_mode) { if (hero_get_gadget_anim_id(0) == 0x54) { set_hero_animation(hero_get_gadget_anim_id(0), 0, (float)scale_game_frames(0x12)); } else { @@ -195,7 +195,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(0x45, 0, (float)scale_game_frames(0xC)); break; } @@ -206,7 +206,7 @@ int hero_set_state(int requested_state, int b) { p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); FUN_L00_0025f730(&p->motion.momentum, frame_time * 3.5f); - if (b) + if (entry_animation_mode) set_hero_animation(0x7C, 0, (float)scale_game_frames(0xC)); break; } @@ -222,7 +222,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->unk6A0 = 0; p->unk690 = p->motion.pos.f[2] - p->unk69C; - if (b) + if (entry_animation_mode) set_hero_animation(0x74, 0, (float)scale_game_frames(0xB)); break; } @@ -244,7 +244,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->unk8E0 = 0; n = scale_game_frames(0xC); - if (b) + if (entry_animation_mode) set_hero_animation(0x3B, 0, (float)n); } break; @@ -265,7 +265,7 @@ int hero_set_state(int requested_state, int b) { n = scale_game_frames(0xB); if (p->state.prev == 0x33) n = scale_game_frames(0xF); - if (b) + if (entry_animation_mode) set_hero_animation(0x3D, 0, (float)n); break; } @@ -280,7 +280,7 @@ int hero_set_state(int requested_state, int b) { n = scale_game_frames(0x23); if (p->state.prev == 0x35) n = -2; - if (b) + if (entry_animation_mode) set_hero_animation(0x3C, 0, (float)n); break; } @@ -348,7 +348,7 @@ int hero_set_state(int requested_state, int b) { s->motion.momentum.f[2] = 0.0f; FUN_L00_0025f730(&s->motion.momentum, frame_time * 5.5f); s->rand_timer.range = 0x68; - if (b) + if (entry_animation_mode) set_hero_animation(0x3A, 0, (float)scale_game_frames(0x16)); } break; @@ -372,7 +372,7 @@ int hero_set_state(int requested_state, int b) { int t = scale_game_frames(0x4D); struct Hero *q = &hero; q->invulnerable_frames = t; - if (b) { + if (entry_animation_mode) { if (q->state.current == 0x75) { set_hero_animation(0x70, 3, -3.0f); } else { @@ -396,7 +396,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->drown_sink_speed = 0; p->unk698 = scale_game_frames(0x2D); p->rand_timer.range = 0x68; - if (b) + if (entry_animation_mode) set_hero_animation(0x65, 0, (float)scale_game_frames(0x11)); break; } @@ -438,7 +438,7 @@ int hero_set_state(int requested_state, int b) { char *v = (char *)&hero.motion.momentum; qcopy(v, v - 0x40); } - if (b) + if (entry_animation_mode) set_hero_animation(0x5F, 0, (float)scale_game_frames(0xA)); break; } @@ -449,7 +449,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(0x80, 0, (float)scale_game_frames(0xA)); break; } @@ -457,7 +457,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (entry_animation_mode) set_hero_animation(0x46, 0, (float)scale_game_frames(8)); break; } @@ -465,7 +465,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (entry_animation_mode) set_hero_animation(0x47, 0, (float)scale_game_frames(8)); break; } @@ -473,7 +473,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (entry_animation_mode) set_hero_animation(0x48, 0, (float)scale_game_frames(8)); break; } @@ -485,7 +485,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&D_L12_0015F688 = scale_game_frames(0x3C); if (p->unk20AA == 0) { t = hero_get_gadget_anim_id(1); - if (p->moby->prev_seq != t && b) { + if (p->moby->prev_seq != t && entry_animation_mode) { set_hero_animation(t, 0, (float)scale_game_frames(0x12)); } } @@ -586,7 +586,7 @@ int hero_set_state(int requested_state, int b) { scale_game_frames(5) < u->rail_land_frames) n = scale_game_frames(0xD); } - if (b) { + if (entry_animation_mode) { struct Hero *v = &hero; set_hero_animation(v->state.step + 3, D_L12_0015F6D8[v->state.step], (float)n); } @@ -598,7 +598,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 1; p->unk2284 = 0; - if (b) { + if (entry_animation_mode) { if (p->state.prev == 4) { set_hero_animation(0x5E, 2, (float)scale_game_frames(5)); } else { @@ -615,7 +615,7 @@ int hero_set_state(int requested_state, int b) { p->item_use_locked = 1; if (p->vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) cancel_hero_item_animation(); - if (b) { + if (entry_animation_mode) { if (p->vehicle_mode == 3) { set_hero_animation(1, 0, (float)scale_game_frames(8)); } else if (p->vehicle_mode == HERO_VEHICLE_MODE_CLANK) { @@ -648,7 +648,7 @@ int hero_set_state(int requested_state, int b) { } return 0; } - if (b) { + if (entry_animation_mode) { struct Hero *q = &hero; float d = q->anim_frame; int id = 6; @@ -665,7 +665,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.momentum, v); - if (b) { + if (entry_animation_mode) { int id = 6; float d = p->anim_frame; if (return_hero_animation_id_unchanged(MOBY(moby)->seq) == 4 && 3.0f < d && d < 16.0f) @@ -692,7 +692,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&q->motion.momentum, frame_time * 7.0f); if (frame_time * 3.5f < q->motion.forward_speed) allocate_hero_voice_for_entry(0xC, 0); - if (b) { + if (entry_animation_mode) { if (q->moby->seq == hero_get_gadget_anim_id(0)) { set_hero_animation(0xD, 2, (float)scale_game_frames(9)); } else { @@ -719,7 +719,7 @@ int hero_set_state(int requested_state, int b) { } p->motion.move_yaw = fast_arc_tan(p->grapple_target->pos.x - p->motion.pos.f[0], p->grapple_target->pos.y - p->motion.pos.f[1]); - if (b) { + if (entry_animation_mode) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); hero_queue_sequence(0xA, 0xE); } @@ -732,7 +732,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->item_use_locked = 1; - if (b) + if (entry_animation_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(0xA)); break; } @@ -744,7 +744,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->tether_radius = fast_vec_dist(&p->motion.pos, &p->grapple_target->pos); - if (b) + if (entry_animation_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(5)); break; } @@ -800,7 +800,7 @@ int hero_set_state(int requested_state, int b) { } else if (q->state.prev_control_mode == 2) { q->swing_gravity = q->fall_state_gravity; } - if (b) { + if (entry_animation_mode) { set_hero_animation(0x34, 0, (float)scale_game_frames(0xB)); { struct Hero *r = &hero; @@ -816,7 +816,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 7; clear_u64_value(&p->motion.rot_spring_vel); qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xF)); break; } @@ -828,7 +828,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->past_apex = 0; p->rise_fall_land_frames = 0; p->rise_fall_gravity = frame_time_sq * 100.0f; - if (b) + if (entry_animation_mode) set_hero_animation(0x2A, 0, (float)scale_game_frames(6)); break; } @@ -843,7 +843,7 @@ int hero_set_state(int requested_state, int b) { p->unk4F0 = p->smoothed_ground_z; } p->item_select_blocked = 1; - if (b) { + if (entry_animation_mode) { if (frame_time * 3.5f < p->motion.flat_speed) { set_hero_animation(0x20, 0, (float)scale_game_frames(9)); } else { @@ -858,7 +858,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0xD; p->item_select_blocked = 1; p->rand_timer.range = 0x68; - if (b) + if (entry_animation_mode) set_hero_animation(0x21, 0, (float)scale_game_frames(6)); break; } @@ -867,7 +867,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (entry_animation_mode) set_hero_animation(0x24, 0, (float)scale_game_frames(6)); break; } @@ -876,7 +876,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (entry_animation_mode) set_hero_animation(0x25, 0, (float)scale_game_frames(6)); break; } @@ -885,7 +885,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xC)); break; } @@ -909,7 +909,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->state.step = 0; qcopy(&q->motion.velocity, &q->motion.resolved_velocity); - if (b) { + if (entry_animation_mode) { if (q->vehicle_mode == 3) { set_hero_animation(6, 0, (float)scale_game_frames(8)); return 1; @@ -935,7 +935,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) { + if (entry_animation_mode) { set_hero_animation(0x13, 0, (float)animation_blend_selector); } break; @@ -950,7 +950,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.displacement); - if (b) { + if (entry_animation_mode) { set_hero_animation(0x13, 0, (float)animation_blend_selector); } break; @@ -1259,7 +1259,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (q->fall_start_distance == 0.0f) q->fall_start_distance = q->unk430 * 1.5f; - if (b) { + if (entry_animation_mode) { int s = q->state.current; if (s == 7) { set_hero_animation(7, 0, (float)scale_game_frames(5)); @@ -1349,7 +1349,7 @@ int hero_set_state(int requested_state, int b) { update_hero_target_heading(8.0f, 1.0471976f, -1.0f); *(int *)&q->slam_descending = 0; q->items[0].timer = 0xA; - if (b) { + if (entry_animation_mode) { char *m; int n = scale_game_frames(0xB); if (q->state.prev == 0xB && scale_game_frames(0x2A) > q->state.prev_timer) @@ -1386,7 +1386,7 @@ int hero_set_state(int requested_state, int b) { q->saved_item[0] = 0; update_hero_target_heading(14.0f, 0.5235988f, -1.0f); q->unkA7C = q->unkA7C == 0; - if (b) { + if (entry_animation_mode) { int n = scale_game_frames(0xA); if (q->moby->prev_seq == 0x1A) n = scale_game_frames(3); @@ -1401,7 +1401,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (((void *)q->items[0].moby) == 0) break; - if (b) { + if (entry_animation_mode) { set_hero_animation(0x67, 4, -1.0f); blend_moby_animation(((void *)q->items[0].moby), 3, 4, -1); } @@ -1432,7 +1432,7 @@ int hero_set_state(int requested_state, int b) { r->attack_record = k; } update_hero_target_heading(5.0f, 0.7853982f, 0.7853982f); - if (b) { + if (entry_animation_mode) { char *m; int j = 0; int n; @@ -1463,7 +1463,7 @@ int hero_set_state(int requested_state, int b) { } case HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL: { struct Hero *q; - if (b) + if (entry_animation_mode) set_hero_animation(0x2C, 7, (float)scale_game_frames(9)); q = &hero; if (q->items[0].item_id == 0xA && ((char *)q->throw_target) != 0) { @@ -1492,7 +1492,7 @@ int hero_set_state(int requested_state, int b) { { struct Hero *q = &hero; int e = D_L12_0017C0A8[q->attack_record].kind; - if (b) { + if (entry_animation_mode) { char *m; int z = e == 0; int n = scale_game_frames(5); @@ -1509,7 +1509,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0xA; p->unk2284 = 0; p->ground_speed = frame_time * 9.0f; - if (b) { + if (entry_animation_mode) { char *m; HeroTableRow2C *e = &D_L12_0017C0A8[p->attack_record]; int k = e->kind; @@ -1530,7 +1530,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->pushback_yaw = fast_add_rotations(p->motion.rot.f[2], 3.1415927f); p->ground_speed = frame_time * 9.0f; - if (b) + if (entry_animation_mode) set_hero_animation(0x29, 5, (float)scale_game_frames(8)); break; } @@ -1552,7 +1552,7 @@ int hero_set_state(int requested_state, int b) { { struct Hero *q = &hero; q->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (entry_animation_mode) { set_hero_animation(0x10, 3, -3.0f); q->moby->anim_time = level12_hero_animation_blend_curves[q->anim_blend_curve] [(q->anim_blend_step)++]; @@ -1564,7 +1564,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) + if (entry_animation_mode) set_hero_animation(0, 0, (float)scale_game_frames(0xE)); break; } @@ -1572,7 +1572,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) { + if (entry_animation_mode) { set_hero_animation(4, 0, (float)scale_game_frames(7)); hero_queue_sequence(0xE, 0x22); } @@ -1583,7 +1583,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(6, 0, (float)scale_game_frames(0xC)); break; } @@ -1594,7 +1594,7 @@ int hero_set_state(int requested_state, int b) { p->fall_state_gravity = frame_time_sq * 24.0f; p->stickless_decel = frame_time_sq * 7.0f; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(6, 0, (float)scale_game_frames(7)); break; } @@ -1611,7 +1611,7 @@ int hero_set_state(int requested_state, int b) { if (frame_time * 1.5f < planar_speed) hero_base->ground_speed = frame_time * 1.5f; hero_base->unk3B8 = 0; - if (b) + if (entry_animation_mode) set_hero_animation(1, 0, (float)scale_game_frames(8)); } break; @@ -1621,7 +1621,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (entry_animation_mode) set_hero_animation(3, 0, (float)scale_game_frames(0xC)); break; } @@ -1634,7 +1634,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&p->motion.velocity, frame_time * 5.0f); hero_change_health(1); p->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (entry_animation_mode) { set_hero_animation(2, 3, -3.0f); p->moby->anim_time = level12_hero_animation_blend_curves[p->anim_blend_curve][(p->anim_blend_step)++]; @@ -1655,7 +1655,7 @@ int hero_set_state(int requested_state, int b) { clear_u64_value(&p->motion.velocity); clear_u64_value(&p->motion.displacement); p->motion.velocity.f[2] = frame_time * 10.0f; - if (b) + if (entry_animation_mode) set_hero_animation(0x10, 2, -3.0f); break; } @@ -1706,7 +1706,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->tilt_disabled = 1; p->item_use_locked = 1; - if (b) + if (entry_animation_mode) set_hero_animation(hero_get_gadget_anim_id(0), 0, -1.0f); break; } @@ -1717,7 +1717,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->item_use_locked = 1; clear_u64_value(&p->motion.velocity); - if (b) + if (entry_animation_mode) set_hero_animation(0xB, 0, -1.0f); break; } @@ -1727,7 +1727,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x18; p->item_use_locked = 1; cancel_hero_item_animation(); - if (b) + if (entry_animation_mode) set_hero_animation(hero_get_gadget_anim_id(0), 0, -1.0f); break; } From efe91790ff0770083f7119073804ecb592580163 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:04:36 +0000 Subject: [PATCH 077/758] decomp: clarify names in hero_set_state b -> animation_update_mode: Authoritative src/overlays/l18/hero/hero_set_state.c SHA-256 32377a0870bd752a6db6bc5ffbe5c0635b39116e6e8135a76dfe44259016f472 uses b to gate conditional set_hero_animation and paired item-animation setup. Retail 0x00227e28 preserves a1 in s4; 0x00228060 branches to common cleanup when s4 is zero, otherwise 0x00228068-0x002280b8 selects and applies the idle animation through 0x0022c20c. Original Ghidra param_2 has the same zero gate. 0x0022b354-0x0022b37c gates both hero and held-item animation calls. At 0x00227e38-0x00227e40 and 0x00227e4c-0x00227e64, value 2 additionally permits otherwise refused requests. Thus this int controls animation updates with a distinguished override mode; it is not the requested state or a frame count. --- src/overlays/l18/hero/hero_set_state.c | 144 ++++++++++++------------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/src/overlays/l18/hero/hero_set_state.c b/src/overlays/l18/hero/hero_set_state.c index 27c60c892c..d7c2e97059 100644 --- a/src/overlays/l18/hero/hero_set_state.c +++ b/src/overlays/l18/hero/hero_set_state.c @@ -69,7 +69,7 @@ extern int hero_set_state(int, int) __asm__("FUN_L18_00227dd0"); extern char hero_trail_jump_velocity_key_profile[] __asm__("D_L18_0017C920"); extern char hero_water_surface_jump_velocity_key_profile[] __asm__("D_L18_0017C960"); -int hero_set_state(int requested_state, int b) { +int hero_set_state(int requested_state, int animation_update_mode) { int previous_state_step; char *moby; int old20A7; @@ -77,10 +77,10 @@ int hero_set_state(int requested_state, int b) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || b != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_update_mode != 2)) return 0; } - if ((D_L18_0015F5C4 == 2 || D_L18_0015F5C4 == 6) && b != 2) + if ((D_L18_0015F5C4 == 2 || D_L18_0015F5C4 == 6) && animation_update_mode != 2) return 0; { struct Hero *p = &hero; @@ -152,7 +152,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; q->rand_timer.range = 0x68; } - if (b) { + if (animation_update_mode) { if (get_hero_help_value(0) == 0x54) { set_hero_animation(get_hero_help_value(0), 0, (float)scale_game_frames(0x12)); } else { @@ -167,7 +167,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; clear_u64_value(&p->motion.momentum); p->rand_timer.range = 0x68; - if (b) { + if (animation_update_mode) { if (get_hero_help_value(0) == 0x54) { set_hero_animation(get_hero_help_value(0), 0, (float)scale_game_frames(0x12)); } else { @@ -192,7 +192,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0x45, 0, (float)scale_game_frames(0xC)); break; } @@ -214,7 +214,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->unk8E0 = 0; n = scale_game_frames(0xC); - if (b) + if (animation_update_mode) set_hero_animation(0x3B, 0, (float)n); } break; @@ -235,7 +235,7 @@ int hero_set_state(int requested_state, int b) { n = scale_game_frames(0xB); if (p->state.prev == 0x33) n = scale_game_frames(0xF); - if (b) + if (animation_update_mode) set_hero_animation(0x3D, 0, (float)n); break; } @@ -252,7 +252,7 @@ int hero_set_state(int requested_state, int b) { t = -2; if (p->state.prev != 0x35) t = n; - if (b) + if (animation_update_mode) set_hero_animation(0x3C, 0, (float)t); break; } @@ -325,7 +325,7 @@ int hero_set_state(int requested_state, int b) { s->motion.momentum.f[2] = 0.0f; FUN_L00_0025f730(&s->motion.momentum, frame_time * 5.5f); s->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x3A, 0, (float)scale_game_frames(0x16)); } break; @@ -349,7 +349,7 @@ int hero_set_state(int requested_state, int b) { int t = scale_game_frames(0x4D); struct Hero *q = &hero; q->invulnerable_frames = t; - if (b) { + if (animation_update_mode) { if (q->state.current == 0x75) { set_hero_animation(0x70, 3, -3.0f); } else { @@ -372,7 +372,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->drown_sink_speed = 0; p->unk698 = scale_game_frames(0x2D); p->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x65, 0, (float)scale_game_frames(0x11)); break; } @@ -412,7 +412,7 @@ int hero_set_state(int requested_state, int b) { v = (char *)&hero.motion.momentum; qcopy(v, v - 0x40); } - if (b) + if (animation_update_mode) set_hero_animation(0x5F, 0, (float)scale_game_frames(0xA)); break; } @@ -423,7 +423,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0x80, 0, (float)scale_game_frames(0xA)); break; } @@ -431,7 +431,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0x46, 0, (float)scale_game_frames(8)); break; } @@ -439,7 +439,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0x47, 0, (float)scale_game_frames(8)); break; } @@ -447,7 +447,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0x13; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0x48, 0, (float)scale_game_frames(8)); break; } @@ -459,7 +459,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&D_L18_0015F688 = scale_game_frames(0x3C); if (p->unk20AA == 0) { t = get_hero_help_value(1); - if (p->moby->prev_seq != t && b) { + if (p->moby->prev_seq != t && animation_update_mode) { set_hero_animation(t, 0, (float)scale_game_frames(0x12)); } } @@ -551,7 +551,7 @@ int hero_set_state(int requested_state, int b) { scale_game_frames(5) < u->rail_land_frames) n = scale_game_frames(0xD); } - if (b) { + if (animation_update_mode) { struct Hero *v = &hero; set_hero_animation(v->state.step + 3, D_L18_0015F6D8[v->state.step], (float)n); } @@ -563,7 +563,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 1; p->unk2284 = 0; - if (b) { + if (animation_update_mode) { if (p->state.prev == 4) { set_hero_animation(0x5E, 2, (float)scale_game_frames(5)); } else { @@ -580,7 +580,7 @@ int hero_set_state(int requested_state, int b) { p->item_use_locked = 1; if (p->vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) cancel_hero_item_animation(); - if (b) { + if (animation_update_mode) { if (p->vehicle_mode == 3) { set_hero_animation(1, 0, (float)scale_game_frames(8)); } else if (p->vehicle_mode == HERO_VEHICLE_MODE_CLANK) { @@ -599,7 +599,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; fill_transfer_words((char *)p + 0x9D0, 0, 0x20); qcopy(&p->motion.momentum, &p->motion.displacement); - if (b) + if (animation_update_mode) set_hero_animation(0x64, 0, (float)scale_game_frames(0xF)); break; } @@ -620,7 +620,7 @@ int hero_set_state(int requested_state, int b) { } return 0; } - if (b) { + if (animation_update_mode) { struct Hero *q = &hero; float d = q->anim_frame; int id = 6; @@ -637,7 +637,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.momentum, v); - if (b) { + if (animation_update_mode) { int id = 6; float d = p->anim_frame; if (return_hero_animation_id_unchanged(MOBY(moby)->seq) == 4 && 3.0f < d && d < 16.0f) @@ -664,7 +664,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&q->motion.momentum, frame_time * 7.0f); if (frame_time * 3.5f < q->motion.forward_speed) allocate_hero_voice_for_entry(0xC, 0); - if (b) { + if (animation_update_mode) { if (q->moby->seq == get_hero_help_value(0)) { set_hero_animation(0xD, 2, (float)scale_game_frames(9)); } else { @@ -691,7 +691,7 @@ int hero_set_state(int requested_state, int b) { } p->motion.move_yaw = fast_arc_tan(p->grapple_target->pos.x - p->motion.pos.f[0], p->grapple_target->pos.y - p->motion.pos.f[1]); - if (b) { + if (animation_update_mode) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); hero_queue_sequence(0xA, 0xE); } @@ -704,7 +704,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->item_use_locked = 1; - if (b) + if (animation_update_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(0xA)); break; } @@ -716,7 +716,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->tether_radius = fast_vec_dist(&p->motion.pos, &p->grapple_target->pos); - if (b) + if (animation_update_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(5)); break; } @@ -772,7 +772,7 @@ int hero_set_state(int requested_state, int b) { } else if (q->state.prev_control_mode == 2) { q->swing_gravity = q->fall_state_gravity; } - if (b) { + if (animation_update_mode) { set_hero_animation(0x34, 0, (float)scale_game_frames(0xB)); { struct Hero *r = &hero; @@ -788,7 +788,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 7; clear_u64_value(&p->motion.rot_spring_vel); qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xF)); break; } @@ -800,7 +800,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->past_apex = 0; p->rise_fall_land_frames = 0; p->rise_fall_gravity = frame_time_sq * 100.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x2A, 0, (float)scale_game_frames(6)); break; } @@ -855,7 +855,7 @@ int hero_set_state(int requested_state, int b) { } } } - if (b) { + if (animation_update_mode) { struct Hero *r = &hero; set_hero_animation(r->grind_anim_variant + 0x31, 0, (float)scale_game_frames(6)); } @@ -872,7 +872,7 @@ int hero_set_state(int requested_state, int b) { p->unk4F0 = p->smoothed_ground_z; } p->item_select_blocked = 1; - if (b) { + if (animation_update_mode) { if (frame_time * 3.5f < p->motion.flat_speed) { set_hero_animation(0x20, 0, (float)scale_game_frames(9)); } else { @@ -887,7 +887,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0xD; p->item_select_blocked = 1; p->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x21, 0, (float)scale_game_frames(6)); break; } @@ -896,7 +896,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (animation_update_mode) set_hero_animation(0x24, 0, (float)scale_game_frames(6)); break; } @@ -905,7 +905,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (animation_update_mode) set_hero_animation(0x25, 0, (float)scale_game_frames(6)); break; } @@ -914,7 +914,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xC)); break; } @@ -938,7 +938,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->state.step = 0; qcopy(&q->motion.velocity, &q->motion.resolved_velocity); - if (b) { + if (animation_update_mode) { if (q->vehicle_mode == 3) { set_hero_animation(6, 0, (float)scale_game_frames(8)); return 1; @@ -964,7 +964,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) { + if (animation_update_mode) { set_hero_animation(0x13, 0, (float)animation_transition_code); } break; @@ -979,7 +979,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.displacement); - if (b) { + if (animation_update_mode) { set_hero_animation(0x13, 0, (float)animation_transition_code); } break; @@ -1369,7 +1369,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (q->fall_start_distance == 0.0f) q->fall_start_distance = q->unk430 * 1.5f; - if (b) { + if (animation_update_mode) { int s = q->state.current; if (s == 7) { set_hero_animation(7, 0, (float)scale_game_frames(5)); @@ -1474,7 +1474,7 @@ int hero_set_state(int requested_state, int b) { update_hero_target_heading(8.0f, 1.0471976f, -1.0f); *(int *)&q->slam_descending = 0; q->items[0].timer = 0xA; - if (b) { + if (animation_update_mode) { char *m; int n = scale_game_frames(0xB); if (q->state.prev == 0xB && scale_game_frames(0x2A) > q->state.prev_timer) @@ -1512,7 +1512,7 @@ int hero_set_state(int requested_state, int b) { q->saved_item[0] = 0; update_hero_target_heading(14.0f, 0.5235988f, -1.0f); q->unkA7C = q->unkA7C == 0; - if (b) { + if (animation_update_mode) { int n = scale_game_frames(0xA); if (q->moby->prev_seq == 0x1A) n = scale_game_frames(3); @@ -1527,7 +1527,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (((void *)q->items[0].moby) == 0) break; - if (b) { + if (animation_update_mode) { set_hero_animation(0x67, 4, -1.0f); blend_moby_animation(((void *)q->items[0].moby), 3, 4, -1); } @@ -1558,7 +1558,7 @@ int hero_set_state(int requested_state, int b) { r->attack_record = k; } update_hero_target_heading(5.0f, 0.7853982f, 0.7853982f); - if (b) { + if (animation_update_mode) { char *m; int j = 0; int n; @@ -1589,7 +1589,7 @@ int hero_set_state(int requested_state, int b) { } case HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL: { struct Hero *q; - if (b) + if (animation_update_mode) set_hero_animation(0x2C, 7, (float)scale_game_frames(9)); q = &hero; if (q->items[0].item_id == 0xA && ((char *)q->throw_target) != 0) { @@ -1618,7 +1618,7 @@ int hero_set_state(int requested_state, int b) { { struct Hero *q = &hero; int e = D_L18_0017C628[q->attack_record].kind; - if (b) { + if (animation_update_mode) { char *m; int z = e == 0; int n = scale_game_frames(5); @@ -1639,7 +1639,7 @@ int hero_set_state(int requested_state, int b) { } else { p->attack_record = 0; } - if (b) { + if (animation_update_mode) { struct Hero *q = &hero; char *m; int n = scale_game_frames(4); @@ -1655,7 +1655,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0xA; p->unk2284 = 0; p->ground_speed = frame_time * 9.0f; - if (b) { + if (animation_update_mode) { char *m; HeroTableRow2C *e = &D_L18_0017C628[p->attack_record]; int k = e->kind; @@ -1676,7 +1676,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->pushback_yaw = fast_add_rotations(p->motion.rot.f[2], 3.1415927f); p->ground_speed = frame_time * 9.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x29, 5, (float)scale_game_frames(8)); break; } @@ -1698,7 +1698,7 @@ int hero_set_state(int requested_state, int b) { { struct Hero *q = &hero; q->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (animation_update_mode) { set_hero_animation(0x10, 3, -3.0f); q->moby->anim_time = hero_hurt_animation_blend_curves[q->anim_blend_curve][(q->anim_blend_step)++]; @@ -1723,7 +1723,7 @@ int hero_set_state(int requested_state, int b) { r->rand_timer.range = 0x68; r->target_speed = 0.0f; r->ground_speed = 0.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x71, 0, (float)scale_game_frames(8)); } break; @@ -1737,7 +1737,7 @@ int hero_set_state(int requested_state, int b) { p->collision_off_frames = 0x2710; allocate_hero_voice_for_entry(9, 0); p->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x71, 0, (float)scale_game_frames(8)); break; } @@ -1745,7 +1745,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0, 0, (float)scale_game_frames(0xF)); break; } @@ -1765,7 +1765,7 @@ int hero_set_state(int requested_state, int b) { int n = scale_game_frames(7); if (r->state.prev == 0x60) n = scale_game_frames(0xD); - if (b) + if (animation_update_mode) set_hero_animation(r->attack_record + 9, 1, (float)n); } break; @@ -1774,7 +1774,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 6; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0xC, 0, (float)scale_game_frames(8)); break; } @@ -1782,7 +1782,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 6; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(8, 0, (float)scale_game_frames(8)); break; } @@ -1793,7 +1793,7 @@ int hero_set_state(int requested_state, int b) { p->fall_state_gravity = frame_time_sq * 24.0f; p->stickless_decel = frame_time_sq * 7.0f; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) { + if (animation_update_mode) { if (2.5f < p->ground_distance) { set_hero_animation(5, 0, (float)scale_game_frames(8)); } else { @@ -1808,7 +1808,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->ground_speed = vector_length_xy(&p->motion.resolved_velocity); p->unk3B8 = 0; - if (b) + if (animation_update_mode) set_hero_animation(3, 0x12, (float)scale_game_frames(8)); break; } @@ -1817,7 +1817,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(7, 0, (float)scale_game_frames(0xC)); break; } @@ -1829,7 +1829,7 @@ int hero_set_state(int requested_state, int b) { qcopy(&p->motion.velocity, &p->motion.resolved_velocity); FUN_L00_0025f730(&p->motion.velocity, frame_time * 7.0f); p->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (animation_update_mode) { set_hero_animation(6, 3, -3.0f); p->moby->anim_time = hero_hurt_animation_blend_curves[p->anim_blend_curve][(p->anim_blend_step)++]; @@ -1840,7 +1840,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0, 0, (float)scale_game_frames(0xE)); break; } @@ -1848,7 +1848,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) { + if (animation_update_mode) { set_hero_animation(4, 0, (float)scale_game_frames(7)); hero_queue_sequence(0xE, 0x22); } @@ -1859,7 +1859,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(6, 0, (float)scale_game_frames(0xC)); break; } @@ -1870,7 +1870,7 @@ int hero_set_state(int requested_state, int b) { p->fall_state_gravity = frame_time_sq * 24.0f; p->stickless_decel = frame_time_sq * 7.0f; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(6, 0, (float)scale_game_frames(7)); break; } @@ -1887,7 +1887,7 @@ int hero_set_state(int requested_state, int b) { if (frame_time * 1.5f < planar_speed) hero_base->ground_speed = frame_time * 1.5f; hero_base->unk3B8 = 0; - if (b) + if (animation_update_mode) set_hero_animation(1, 0, (float)scale_game_frames(8)); } break; @@ -1897,7 +1897,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(3, 0, (float)scale_game_frames(0xC)); break; } @@ -1910,7 +1910,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&p->motion.velocity, frame_time * 5.0f); hero_change_health(1); p->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (animation_update_mode) { set_hero_animation(2, 3, -3.0f); p->moby->anim_time = hero_hurt_animation_blend_curves[p->anim_blend_curve][(p->anim_blend_step)++]; @@ -1931,7 +1931,7 @@ int hero_set_state(int requested_state, int b) { clear_u64_value(&p->motion.velocity); clear_u64_value(&p->motion.displacement); p->motion.velocity.f[2] = frame_time * 10.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x10, 2, -3.0f); break; } @@ -1982,7 +1982,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->tilt_disabled = 1; p->item_use_locked = 1; - if (b) + if (animation_update_mode) set_hero_animation(get_hero_help_value(0), 0, -1.0f); break; } @@ -1993,7 +1993,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->item_use_locked = 1; clear_u64_value(&p->motion.velocity); - if (b) + if (animation_update_mode) set_hero_animation(0xB, 0, -1.0f); break; } @@ -2017,7 +2017,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x18; p->item_use_locked = 1; cancel_hero_item_animation(); - if (b) + if (animation_update_mode) set_hero_animation(get_hero_help_value(0), 0, -1.0f); break; } From e32822c714b374263ff1c838531849cc7edadffd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:06:40 +0000 Subject: [PATCH 078/758] decomp: clarify names in hero_set_state b -> animation_update_mode: Retail 0x0021e3f0 saves a1 into s5 (original Ghidra param_2). At 0x0021e628 and 0x0021e768, zero s5 skips the optional set_hero_animation paths while state/motion initialization still occurs. Original Ghidra cases 0 and 0x3d and authoritative C if(b) agree. At 0x0021e400-0x0021e428 the same parameter equals 2 to override dying/global admission guards. Self-call 0x0021fb30-0x0021fb68 passes zero then explicitly installs the idle animation. Thus this integer selects optional animation-update behavior, including the special admission mode; it is not a Boolean or requested state. --- src/overlays/l16/hero/hero_set_state.c | 132 ++++++++++++------------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/src/overlays/l16/hero/hero_set_state.c b/src/overlays/l16/hero/hero_set_state.c index e0852737de..243382b3de 100644 --- a/src/overlays/l16/hero/hero_set_state.c +++ b/src/overlays/l16/hero/hero_set_state.c @@ -82,7 +82,7 @@ extern int hero_set_state(int, int) __asm__("FUN_L16_0021e398"); extern char level16_hero_jump_velocity_keys[] __asm__("D_L16_0017C380"); extern char level16_hero_water_surface_jump_velocity_keys[] __asm__("D_L16_0017C3C0"); -int hero_set_state(int requested_state, int b) { +int hero_set_state(int requested_state, int animation_update_mode) { int saved_state_step; char *moby; int old20A7; @@ -90,10 +90,10 @@ int hero_set_state(int requested_state, int b) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || b != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_update_mode != 2)) return 0; } - if ((D_L16_0015F5C4 == 2 || D_L16_0015F5C4 == 6) && b != 2) + if ((D_L16_0015F5C4 == 2 || D_L16_0015F5C4 == 6) && animation_update_mode != 2) return 0; { struct Hero *p = &hero; @@ -165,7 +165,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; q->rand_timer.range = 0x68; } - if (b) { + if (animation_update_mode) { if (get_hero_idle_animation_index(0) == 0x54) { set_hero_animation( get_hero_idle_animation_index(0), 0, (float)scale_game_frames(0x12)); @@ -181,7 +181,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; clear_u64_value(&p->motion.momentum); p->rand_timer.range = 0x68; - if (b) { + if (animation_update_mode) { if (get_hero_idle_animation_index(0) == 0x54) { set_hero_animation( get_hero_idle_animation_index(0), 0, (float)scale_game_frames(0x12)); @@ -207,7 +207,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0x45, 0, (float)scale_game_frames(0xC)); break; } @@ -218,7 +218,7 @@ int hero_set_state(int requested_state, int b) { p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); FUN_L00_0025f730(&p->motion.momentum, frame_time * 3.5f); - if (b) + if (animation_update_mode) set_hero_animation(0x7C, 0, (float)scale_game_frames(0xC)); break; } @@ -234,7 +234,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->unk6A0 = 0; p->unk690 = p->motion.pos.f[2] - p->unk69C; - if (b) + if (animation_update_mode) set_hero_animation(0x74, 0, (float)scale_game_frames(0xB)); break; } @@ -256,7 +256,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->unk8E0 = 0; n = scale_game_frames(0xC); - if (b) + if (animation_update_mode) set_hero_animation(0x3B, 0, (float)n); } break; @@ -277,7 +277,7 @@ int hero_set_state(int requested_state, int b) { n = scale_game_frames(0xB); if (p->state.prev == 0x33) n = scale_game_frames(0xF); - if (b) + if (animation_update_mode) set_hero_animation(0x3D, 0, (float)n); break; } @@ -294,7 +294,7 @@ int hero_set_state(int requested_state, int b) { t = -2; if (p->state.prev != 0x35) t = n; - if (b) + if (animation_update_mode) set_hero_animation(0x3C, 0, (float)t); break; } @@ -367,7 +367,7 @@ int hero_set_state(int requested_state, int b) { s->motion.momentum.f[2] = 0.0f; FUN_L00_0025f730(&s->motion.momentum, frame_time * 5.5f); s->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x3A, 0, (float)scale_game_frames(0x16)); } break; @@ -391,7 +391,7 @@ int hero_set_state(int requested_state, int b) { int t = scale_game_frames(0x4D); struct Hero *q = &hero; q->invulnerable_frames = t; - if (b) { + if (animation_update_mode) { if (q->state.current == 0x75) { set_hero_animation(0x70, 3, -3.0f); } else { @@ -415,7 +415,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->drown_sink_speed = 0; p->unk698 = scale_game_frames(0x2D); p->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x65, 0, (float)scale_game_frames(0x11)); break; } @@ -455,7 +455,7 @@ int hero_set_state(int requested_state, int b) { v = (char *)&hero.motion.momentum; qcopy(v, v - 0x40); } - if (b) + if (animation_update_mode) set_hero_animation(0x5F, 0, (float)scale_game_frames(0xA)); break; } @@ -466,7 +466,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->health.hp = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0x80, 0, (float)scale_game_frames(0xA)); break; } @@ -477,7 +477,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; qcopy(&p->unk770, p->rot_matrix); p->board_gravity = frame_time_sq * 18.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x52, 0, (float)scale_game_frames(5)); break; } @@ -554,7 +554,7 @@ int hero_set_state(int requested_state, int b) { q->board_vertical_speed = -fast_vec_dot(&q->gravity_dir, &q->motion.displacement); } } - if (b) { + if (animation_update_mode) { struct Hero *t = &hero; if (t->race_ammo != 0) { set_hero_animation(0x7D, 0, (float)scale_game_frames(5)); @@ -570,7 +570,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 8; p->item_select_blocked = 1; p->unk870 = 0; - if (b) + if (animation_update_mode) set_hero_animation( select_hero_hoverboard_animation_variant(), 5, (float)scale_game_frames(8)); break; @@ -623,7 +623,7 @@ int hero_set_state(int requested_state, int b) { gravity_flatten((float *)w, (float *)w); FUN_L00_0025f730(w, frame_time * 9.5f); *(int *)(velocity_bytes + 0xF18) = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x3A, 0, (float)scale_game_frames(0x11)); } break; @@ -635,7 +635,7 @@ int hero_set_state(int requested_state, int b) { release_and_clear_hero_voice_slots(); p->boost_pad_timer = 0; p->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x62, 4, (float)scale_game_frames(4)); break; } @@ -647,7 +647,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&D_L16_0015F688 = scale_game_frames(0x3C); if (p->unk20AA == 0) { t = get_hero_idle_animation_index(1); - if (p->moby->prev_seq != t && b) { + if (p->moby->prev_seq != t && animation_update_mode) { set_hero_animation(t, 0, (float)scale_game_frames(0x12)); } } @@ -739,7 +739,7 @@ int hero_set_state(int requested_state, int b) { scale_game_frames(5) < u->rail_land_frames) n = scale_game_frames(0xD); } - if (b) { + if (animation_update_mode) { struct Hero *v = &hero; set_hero_animation(v->state.step + 3, D_L16_0015F6E8[v->state.step], (float)n); } @@ -751,7 +751,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 1; p->unk2284 = 0; - if (b) { + if (animation_update_mode) { if (p->state.prev == 4) { set_hero_animation(0x5E, 2, (float)scale_game_frames(5)); } else { @@ -768,7 +768,7 @@ int hero_set_state(int requested_state, int b) { p->item_use_locked = 1; if (p->vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) cancel_hero_item_animation(); - if (b) { + if (animation_update_mode) { if (p->vehicle_mode == 3) { set_hero_animation(1, 0, (float)scale_game_frames(8)); } else if (p->vehicle_mode == HERO_VEHICLE_MODE_CLANK) { @@ -787,7 +787,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; fill_transfer_words((char *)p + 0x9D0, 0, 0x20); qcopy(&p->motion.momentum, &p->motion.displacement); - if (b) + if (animation_update_mode) set_hero_animation(0x64, 0, (float)scale_game_frames(0xF)); break; } @@ -809,7 +809,7 @@ int hero_set_state(int requested_state, int b) { } return 0; } - if (b) { + if (animation_update_mode) { struct Hero *q = &hero; float d = q->anim_frame; int id = 6; @@ -826,7 +826,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.momentum, v); - if (b) { + if (animation_update_mode) { int id = 6; float d = p->anim_frame; if (return_hero_animation_id_unchanged(MOBY(moby)->seq) == 4 && 3.0f < d && d < 16.0f) @@ -853,7 +853,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&q->motion.momentum, frame_time * 7.0f); if (frame_time * 3.5f < q->motion.forward_speed) allocate_hero_voice_for_entry(0xC, 0); - if (b) { + if (animation_update_mode) { if (q->moby->seq == get_hero_idle_animation_index(0)) { set_hero_animation(0xD, 2, (float)scale_game_frames(9)); } else { @@ -880,7 +880,7 @@ int hero_set_state(int requested_state, int b) { } p->motion.move_yaw = fast_arc_tan(p->grapple_target->pos.x - p->motion.pos.f[0], p->grapple_target->pos.y - p->motion.pos.f[1]); - if (b) { + if (animation_update_mode) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); hero_queue_sequence(0xA, 0xE); } @@ -893,7 +893,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->item_use_locked = 1; - if (b) + if (animation_update_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(0xA)); break; } @@ -905,7 +905,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->grapple_pull_speed = 0; p->grapple_pull_ending = 0; p->tether_radius = fast_vec_dist(&p->motion.pos, &p->grapple_target->pos); - if (b) + if (animation_update_mode) set_hero_animation(0x30, 1, (float)scale_game_frames(5)); break; } @@ -961,7 +961,7 @@ int hero_set_state(int requested_state, int b) { } else if (q->state.prev_control_mode == 2) { q->swing_gravity = q->fall_state_gravity; } - if (b) { + if (animation_update_mode) { set_hero_animation(0x34, 0, (float)scale_game_frames(0xB)); { struct Hero *r = &hero; @@ -977,7 +977,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 7; clear_u64_value(&p->motion.rot_spring_vel); qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xF)); break; } @@ -989,7 +989,7 @@ int hero_set_state(int requested_state, int b) { *(int *)&p->past_apex = 0; p->rise_fall_land_frames = 0; p->rise_fall_gravity = frame_time_sq * 100.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x2A, 0, (float)scale_game_frames(6)); break; } @@ -1038,7 +1038,7 @@ int hero_set_state(int requested_state, int b) { } } } - if (b) { + if (animation_update_mode) { struct Hero *r = &hero; set_hero_animation(r->grind_anim_variant + 0x31, 0, (float)scale_game_frames(6)); } @@ -1055,7 +1055,7 @@ int hero_set_state(int requested_state, int b) { p->unk4F0 = p->smoothed_ground_z; } p->item_select_blocked = 1; - if (b) { + if (animation_update_mode) { if (frame_time * 3.5f < p->motion.flat_speed) { set_hero_animation(0x20, 0, (float)scale_game_frames(9)); } else { @@ -1070,7 +1070,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0xD; p->item_select_blocked = 1; p->rand_timer.range = 0x68; - if (b) + if (animation_update_mode) set_hero_animation(0x21, 0, (float)scale_game_frames(6)); break; } @@ -1079,7 +1079,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (animation_update_mode) set_hero_animation(0x24, 0, (float)scale_game_frames(6)); break; } @@ -1088,7 +1088,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 3; p->unk2284 = 0xD; p->item_select_blocked = 1; - if (b) + if (animation_update_mode) set_hero_animation(0x25, 0, (float)scale_game_frames(6)); break; } @@ -1097,7 +1097,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(0xB, 0, (float)scale_game_frames(0xC)); break; } @@ -1121,7 +1121,7 @@ int hero_set_state(int requested_state, int b) { q->rand_timer.range = 0x68; q->state.step = 0; qcopy(&q->motion.velocity, &q->motion.resolved_velocity); - if (b) { + if (animation_update_mode) { if (q->vehicle_mode == 3) { set_hero_animation(6, 0, (float)scale_game_frames(8)); return 1; @@ -1147,7 +1147,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) { + if (animation_update_mode) { set_hero_animation(0x13, 0, (float)animation_timing_value); } break; @@ -1162,7 +1162,7 @@ int hero_set_state(int requested_state, int b) { scale_hero_motion(frame_time * 4.5f / p->motion.speed_xy); } qcopy(&p->motion.velocity, &p->motion.displacement); - if (b) { + if (animation_update_mode) { set_hero_animation(0x13, 0, (float)animation_timing_arg); } break; @@ -1514,7 +1514,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (q->fall_start_distance == 0.0f) q->fall_start_distance = q->unk430 * 1.5f; - if (b) { + if (animation_update_mode) { int s = q->state.current; if (s == 7) { set_hero_animation(7, 0, (float)scale_game_frames(5)); @@ -1615,7 +1615,7 @@ int hero_set_state(int requested_state, int b) { update_hero_target_heading(8.0f, 1.0471976f, -1.0f); *(int *)&q->slam_descending = 0; q->items[0].timer = 0xA; - if (b) { + if (animation_update_mode) { char *m; int n = scale_game_frames(0xB); if (q->state.prev == 0xB && scale_game_frames(0x2A) > q->state.prev_timer) @@ -1653,7 +1653,7 @@ int hero_set_state(int requested_state, int b) { q->saved_item[0] = 0; update_hero_target_heading(14.0f, 0.5235988f, -1.0f); q->unkA7C = q->unkA7C == 0; - if (b) { + if (animation_update_mode) { int n = scale_game_frames(0xA); if (q->moby->prev_seq == 0x1A) n = scale_game_frames(3); @@ -1668,7 +1668,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *q = &hero; if (((void *)q->items[0].moby) == 0) break; - if (b) { + if (animation_update_mode) { set_hero_animation(0x67, 4, -1.0f); blend_moby_animation(((void *)q->items[0].moby), 3, 4, -1); } @@ -1699,7 +1699,7 @@ int hero_set_state(int requested_state, int b) { r->attack_record = k; } update_hero_target_heading(5.0f, 0.7853982f, 0.7853982f); - if (b) { + if (animation_update_mode) { char *m; int j = 0; int n; @@ -1730,7 +1730,7 @@ int hero_set_state(int requested_state, int b) { } case HERO_STATE_ANIMATION_RECOVERY_WITH_JUMP_CANCEL: { struct Hero *q; - if (b) + if (animation_update_mode) set_hero_animation(0x2C, 7, (float)scale_game_frames(9)); q = &hero; if (q->items[0].item_id == 0xA && ((char *)q->throw_target) != 0) { @@ -1759,7 +1759,7 @@ int hero_set_state(int requested_state, int b) { { struct Hero *q = &hero; int e = D_L16_0017C088[q->attack_record].kind; - if (b) { + if (animation_update_mode) { char *m; int z = e == 0; int n = scale_game_frames(5); @@ -1780,7 +1780,7 @@ int hero_set_state(int requested_state, int b) { } else { p->attack_record = 0; } - if (b) { + if (animation_update_mode) { struct Hero *q = &hero; char *m; int n = scale_game_frames(4); @@ -1796,7 +1796,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0xA; p->unk2284 = 0; p->ground_speed = frame_time * 9.0f; - if (b) { + if (animation_update_mode) { char *m; HeroTableRow2C *e = &D_L16_0017C088[p->attack_record]; int k = e->kind; @@ -1817,7 +1817,7 @@ int hero_set_state(int requested_state, int b) { p->unk2284 = 0; p->pushback_yaw = fast_add_rotations(p->motion.rot.f[2], 3.1415927f); p->ground_speed = frame_time * 9.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x29, 5, (float)scale_game_frames(8)); break; } @@ -1839,7 +1839,7 @@ int hero_set_state(int requested_state, int b) { { struct Hero *q = &hero; q->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (animation_update_mode) { set_hero_animation(0x10, 3, -3.0f); q->moby->anim_time = level16_hero_animation_blend_curves[q->anim_blend_curve] [(q->anim_blend_step)++]; @@ -1851,7 +1851,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) + if (animation_update_mode) set_hero_animation(0, 0, (float)scale_game_frames(0xE)); break; } @@ -1859,7 +1859,7 @@ int hero_set_state(int requested_state, int b) { struct Hero *p = &hero; p->state.control_mode = 0; p->unk2284 = 0; - if (b) { + if (animation_update_mode) { set_hero_animation(4, 0, (float)scale_game_frames(7)); hero_queue_sequence(0xE, 0x22); } @@ -1870,7 +1870,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 2; p->unk2284 = 0; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(6, 0, (float)scale_game_frames(0xC)); break; } @@ -1881,7 +1881,7 @@ int hero_set_state(int requested_state, int b) { p->fall_state_gravity = frame_time_sq * 24.0f; p->stickless_decel = frame_time_sq * 7.0f; qcopy(&p->motion.velocity, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(6, 0, (float)scale_game_frames(7)); break; } @@ -1898,7 +1898,7 @@ int hero_set_state(int requested_state, int b) { if (frame_time * 1.5f < planar_speed) hero_base->ground_speed = frame_time * 1.5f; hero_base->unk3B8 = 0; - if (b) + if (animation_update_mode) set_hero_animation(1, 0, (float)scale_game_frames(8)); } break; @@ -1908,7 +1908,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x14; p->unk2284 = 0; qcopy(&p->motion.momentum, &p->motion.resolved_velocity); - if (b) + if (animation_update_mode) set_hero_animation(3, 0, (float)scale_game_frames(0xC)); break; } @@ -1921,7 +1921,7 @@ int hero_set_state(int requested_state, int b) { FUN_L00_0025f730(&p->motion.velocity, frame_time * 5.0f); hero_change_health(1); p->invulnerable_frames = scale_game_frames(0x4D); - if (b) { + if (animation_update_mode) { set_hero_animation(2, 3, -3.0f); p->moby->anim_time = level16_hero_animation_blend_curves[p->anim_blend_curve][(p->anim_blend_step)++]; @@ -1942,7 +1942,7 @@ int hero_set_state(int requested_state, int b) { clear_u64_value(&p->motion.velocity); clear_u64_value(&p->motion.displacement); p->motion.velocity.f[2] = frame_time * 10.0f; - if (b) + if (animation_update_mode) set_hero_animation(0x10, 2, -3.0f); break; } @@ -1994,7 +1994,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->tilt_disabled = 1; p->item_use_locked = 1; - if (b) + if (animation_update_mode) set_hero_animation(get_hero_idle_animation_index(0), 0, -1.0f); break; } @@ -2005,7 +2005,7 @@ int hero_set_state(int requested_state, int b) { p->item_select_blocked = 1; p->item_use_locked = 1; clear_u64_value(&p->motion.velocity); - if (b) + if (animation_update_mode) set_hero_animation(0xB, 0, -1.0f); break; } @@ -2029,7 +2029,7 @@ int hero_set_state(int requested_state, int b) { p->state.control_mode = 0x18; p->item_use_locked = 1; cancel_hero_item_animation(); - if (b) + if (animation_update_mode) set_hero_animation(get_hero_idle_animation_index(0), 0, -1.0f); break; } From 40aa0ae0830f17daf59629742f2e1666d384ccd1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:06:51 +0000 Subject: [PATCH 079/758] decomp: clarify names in update_hero_state_motion D_L02_0015F68C -> l02_look_timer_expiration_count: Bound source declares this owned s32 counter initialized to zero and increments it only after fast_dec_timer on D_L02_0015F688 succeeds in HERO_STATE_LOOK / LOOK_RELEASE_WAIT with hero.unk20A5 enabled. Retail 0x00225cf4-0x00225d08 gates states 1/0x1E; 0x00225d68-0x00225d80 tests the positive timer and successful decrement. After updating usage_stats.stat[18], 0x00225e10 loads gp-0x7574, 0x00225e20 increments it and 0x00225e28 stores it, matching original Ghidra iGpffff8a8c=iGpffff8a8c+1 and source D_L02_0015F68C++. This proves a look timer expiration counter; l02 records overlay ownership. --- 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 c381521e81..a660f4e646 100644 --- a/src/overlays/l02/hero/update_hero_state_motion.c +++ b/src/overlays/l02/hero/update_hero_state_motion.c @@ -720,7 +720,7 @@ extern int FUN_L00_00227d40_cf(float, void *, void *) __asm__("FUN_L00_001ff600" extern int try_start_hero_item_idle_animation(void) __asm__("FUN_L00_00229a98"); extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); extern short D_L02_0015F688 __attribute__((sda)); -s32 D_L02_0015F68C = 0; +s32 l02_look_timer_expiration_count __asm__("D_L02_0015F68C") = 0; extern void FUN_001efa68_cf(float *dst, float *src, float dz) __asm__("FUN_L00_00233810"); extern void rotate_hero_about_fixed_local_pivot(float, float, float) __asm__("FUN_L00_002091d8"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -827,7 +827,7 @@ void update_hero_state_motion(void) { usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; *(int *)&D_L02_0015F688 = -1; - D_L02_0015F68C++; + l02_look_timer_expiration_count++; } } } From 905076a3a88b736b48e32c9d0a70dd7af10e2c27 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:09:41 +0000 Subject: [PATCH 080/758] decomp: clarify names in update_hero_motion_by_state D_L05_0015F68C -> l05_look_timer_expiry_count: D_L05_0015F68C -> l05_look_timer_expiry_count. In authoritative source src/overlays/l05/hero/update_hero_motion_by_state.c (SHA-256 3c0d259a0adc3293d41f6163c72fea9e8eed7f17d9fdefb0827467735bb470c8), this zero-initialized s32 is incremented only inside HERO_STATE_LOOK or LOOK_RELEASE_WAIT (0x1E), with hero.unk20A5 enabled, after positive D_L05_0015F688 returns nonzero from fast_dec_timer. The same block records usage_stats.stat[18] and sets that timer to -1. Original retail Ghidra shows iGpffff8a8c = iGpffff8a8c + 1 in precisely this path. Instructions 0x00244b58-0x00244b70 establish the look-state/flag gates, 0x00244bcc-0x00244be4 establish the positive timer and decrement-return gates, and 0x00244c74/0x00244c84/0x00244c8c load, increment and store gp-0x7574 while 0x00244c7c disables the timer. Thus the name records the counted event without asserting the timer's gameplay purpose; l05 preserves overlay ownership. --- src/overlays/l05/hero/update_hero_motion_by_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l05/hero/update_hero_motion_by_state.c b/src/overlays/l05/hero/update_hero_motion_by_state.c index 86f041fc7a..2dd2ef043a 100644 --- a/src/overlays/l05/hero/update_hero_motion_by_state.c +++ b/src/overlays/l05/hero/update_hero_motion_by_state.c @@ -120,7 +120,7 @@ struct PlayerJointTable { }; extern s32 D_L05_0015F688 __attribute__((sda)); -s32 D_L05_0015F68C = 0; +s32 l05_look_timer_expiry_count __asm__("D_L05_0015F68C") = 0; extern u8 D_L05_001671D8[]; extern void emit_hero_periodic_surface_effect(s32, s32) __asm__("FUN_L00_00209540"); @@ -325,7 +325,7 @@ void update_hero_motion_by_state(void) { D_L05_0015F688 = -1; usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; - D_L05_0015F68C++; + l05_look_timer_expiry_count++; } } } From 4af2562977283e829b680f8237dd7deddb97852c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:11:48 +0000 Subject: [PATCH 081/758] decomp: clarify names in update_hero_motion_by_state D_L11_0015F68C -> l11_look_timer_completion_count: Authoritative source SHA-256 a0ebb417bfddbca9b9a816481887b7915f9d28bc88cee2f866710f044b19d984 defines this s32 as zero and increments it only inside LOOK/LOOK_RELEASE_WAIT, unk20A5 enabled, positive D_L11_0015F688 and nonzero fast_dec_timer result. Retail 0x00246c58-0x00246ce4 proves these guards. At 0x00246d74 the counter is loaded from gp-0x7574, incremented at 0x00246d84 and stored at 0x00246d8c, while the timer is set to -1 at 0x00246d7c and usage_stats.stat[18] is recorded. Original Ghidra likewise shows iGpffff8a8c = iGpffff8a8c + 1 in this timer-completion branch. The level-qualified name describes that observed event count without asserting broader gameplay identity. --- src/overlays/l11/hero/update_hero_motion_by_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l11/hero/update_hero_motion_by_state.c b/src/overlays/l11/hero/update_hero_motion_by_state.c index 702458cec8..2530a5ceda 100644 --- a/src/overlays/l11/hero/update_hero_motion_by_state.c +++ b/src/overlays/l11/hero/update_hero_motion_by_state.c @@ -231,7 +231,7 @@ struct PlayerJointTable { }; extern s32 D_L11_0015F688 __attribute__((sda)); -s32 D_L11_0015F68C = 0; +s32 l11_look_timer_completion_count __asm__("D_L11_0015F68C") = 0; extern u8 D_L11_001677D8[]; extern void emit_hero_periodic_surface_effect(s32, s32) __asm__("FUN_L00_00209540"); @@ -422,7 +422,7 @@ void update_hero_motion_by_state(void) { D_L11_0015F688 = -1; usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; - D_L11_0015F68C++; + l11_look_timer_completion_count++; } } } From e23cec7b58b50bc0db27816fba78ffa9cb022ea4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:13:49 +0000 Subject: [PATCH 082/758] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS: Retail 0x2356f8 preserves a1 in s4, separate from requested state s1 and vehicle byte +0x20a4. Under dying control_mode 0x14, 0x2356fc-0x235710 requires state 100 and s4==2 to avoid return 0. The same s4==2 bypasses the global lock guard at 0x235714-0x235734. Original Ghidra param_2 comparisons and authoritative entry_animation_mode agree. Nonzero s4 gates optional entry animations at 0x23593c and 0x235a7c; name denotes this mode's two demonstrated guard bypasses only. domain_1_value_2 -> HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS: Retail 0x235714-0x235734 loads global 0x15f5c4, tests values 2/6, and returns 0 unless s4 (entry_animation_mode, preserved from a1 at 0x2356f8) equals 2. The identical mode bypasses the dying admission guard at 0x235708-0x235710. Original Ghidra and authoritative C show the same separate mode selector. Later zero-health restrictions at 0x23573c-0x2357bc remain active; this constant names only dying/global guard bypasses, not a hero state or vehicle mode. --- src/overlays/l06/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l06/hero/hero_set_state.c b/src/overlays/l06/hero/hero_set_state.c index f3cfc11972..e74970ad36 100644 --- a/src/overlays/l06/hero/hero_set_state.c +++ b/src/overlays/l06/hero/hero_set_state.c @@ -70,6 +70,9 @@ extern int hero_set_state(int, int) __asm__("FUN_L06_002356a0"); extern char level06_hero_transform_trail_jump_velocity_keys[] __asm__("D_L06_0017C6A0"); int hero_set_state(int requested_state, int entry_animation_mode) { + enum { + HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS = 2 + }; int saved_state_step; char *moby; int old20A7; @@ -80,10 +83,10 @@ int hero_set_state(int requested_state, int entry_animation_mode) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || entry_animation_mode != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || entry_animation_mode != HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS)) return 0; } - if ((D_L06_0015F5C4 == 2 || D_L06_0015F5C4 == 6) && entry_animation_mode != 2) + if ((D_L06_0015F5C4 == 2 || D_L06_0015F5C4 == 6) && entry_animation_mode != HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS) return 0; { struct Hero *p = &hero; From e00f521bd3f1e64c48d440ebd3066297d19f6102 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:13:58 +0000 Subject: [PATCH 083/758] decomp: clarify names in update_hero_motion_for_current_state D_L12_0015F68C -> l12_look_usage_event_count: D_L12_0015F68C -> l12_look_usage_event_count: The authoritative C declares a zero-initialized s32 and increments it in the HERO_STATE_LOOK/0x1E branch, after the unk20A5 and D_L12_0015F688 timer gates, alongside usage_stats.stat[18] count/time/level-mask updates. Retail 0x00238a18-0x00238aa4 proves those state and timer gates; 0x00238ab4-0x00238ac8 increments the usage count and 0x00238b24-0x00238b4c updates the mask and loads, increments, stores the separate scalar at gp-0x7574. Original Ghidra confirms iGpffff8a8c = iGpffff8a8c + 1 in the same branch. The name describes this local consumer's look-usage event counter, preserving its exact assembler binding and stored bytes. --- src/overlays/l12/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l12/hero/update_hero_motion_for_current_state.c b/src/overlays/l12/hero/update_hero_motion_for_current_state.c index 9c3c2633b5..27f5fadaa1 100644 --- a/src/overlays/l12/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l12/hero/update_hero_motion_for_current_state.c @@ -511,7 +511,7 @@ extern f32 D_0015ED6C_a __asm__("D_0015ED6C"); extern s32 D_0015EEA4; extern u8 D_0013D4DC[]; extern s32 D_L12_0015F688 __attribute__((sda)); -s32 D_L12_0015F68C = 0; +s32 l12_look_usage_event_count __asm__("D_L12_0015F68C") = 0; extern u8 D_L12_00167258[]; extern void emit_hero_periodic_surface_effect(s32, s32) __asm__("FUN_L00_00209540"); @@ -711,7 +711,7 @@ void update_hero_motion_for_current_state(void) { D_L12_0015F688 = -1; usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; - D_L12_0015F68C++; + l12_look_usage_event_count++; } } } From 1f95673ce84dcde96958e5c6f65631d7f3a31989 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:14:10 +0000 Subject: [PATCH 084/758] decomp: clarify names in update_hero_motion_for_current_state D_L15_0015F68C -> l15_hero_look_timer_completion_count: The authoritative source defines this s32 as zero and increments it only in the LOOK/0x1E handler when hero.unk20A5 is set, D_L15_0015F688 > 0 and fast_dec_timer returns nonzero. Original Ghidra increments iGpffff8a8c in that same branch. Retail 0x0020eeac-0x0020eec4 gates the timer call; 0x0020ef54 loads gp-0x7574, 0x0020ef64 increments by one and 0x0020ef6c stores it, alongside usage_stats.stat[18] count/time/level-mask updates and timer reset to -1. This proves a look-handler timer-completion event counter without claiming its broader gameplay identity. --- src/overlays/l15/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 82fcf915c6..b598af3ad7 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 @@ -442,7 +442,7 @@ struct PlayerJointTable { }; extern s32 D_L15_0015F688 __attribute__((sda)); -s32 D_L15_0015F68C = 0; +s32 l15_hero_look_timer_completion_count __asm__("D_L15_0015F68C") = 0; extern u8 D_L15_001673D8[]; extern void emit_hero_periodic_surface_effect(s32, s32) __asm__("FUN_L00_00209540"); @@ -645,7 +645,7 @@ void update_hero_motion_for_current_state(void) { D_L15_0015F688 = -1; usage_stats.stat[18].level_mask = usage_stats.stat[18].level_mask | (1 << current_level_index) | 0x80000000; - D_L15_0015F68C++; + l15_hero_look_timer_completion_count++; } } } From 06726c8a70a28e6d5bd5c31655cd0c1b4e8313fd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:14:10 +0000 Subject: [PATCH 085/758] decomp: clarify names in run_moby_helper_and_set_state_7 domain_0_value_7 -> GROUND_ENEMY_STATE_RECOVER_TO_IDLE: Retail 0x002f1dd8 saves incoming moby a0 in s0 across cancel_suck_cannon_suction at 0x002f1dd4; li v1,7 at 0x002f1ddc and sb v1,0x20(s0) at 0x002f1de4 assign that same moby's state byte. Original Ghidra likewise writes 7 at param_1+0x20. The authoritative ground_melee_enemy.c defines GROUND_ENEMY_STATE_RECOVER_TO_IDLE=0x7 and switches on this same Moby.state domain: that branch calls recover_2E39E0(moby, ground_enemy_vars->motion), then sets GROUND_ENEMY_STATE_IDLE, blends idle animation 2 and clears fC8 upon recovery completion. Neighboring moby_hold_state_if_grabbed already assigns and compares that canonical constant on the same state field around suction processing. Thus this assignment enters the existing ground-enemy recovery state, rather than the unrelated suction-record substate or hero jump domain. --- src/overlays/shared/enemies/ground_melee_enemy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/ground_melee_enemy.c b/src/overlays/shared/enemies/ground_melee_enemy.c index f2df75b822..fdf2644bac 100644 --- a/src/overlays/shared/enemies/ground_melee_enemy.c +++ b/src/overlays/shared/enemies/ground_melee_enemy.c @@ -190,7 +190,7 @@ int run_moby_helper_and_set_state_7(struct Moby *moby) __asm__("FUN_L01_002f1dc8 int run_moby_helper_and_set_state_7(struct Moby *moby) { int helper_result = cancel_suck_cannon_suction(moby); - moby->state = 0x7; + moby->state = GROUND_ENEMY_STATE_RECOVER_TO_IDLE; return helper_result; } From 2b4204d9abb8883343c50291b39eb81a25c245d8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:14:11 +0000 Subject: [PATCH 086/758] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ANIMATION_UPDATE_GUARD_OVERRIDE: The selector is animation_update_mode, not HeroStateId: retail 0x0021e3f0 saves a1 in s5, then 0x0021e400-0x0021e408 compares s5 against 2 and refuses the change otherwise under dying control_mode 0x14. Original Ghidra tests param_2 != 2 after param_1 == 100, exactly matching the authoritative C. Value 2 therefore overrides this animation-mode admission guard, while the requested-state condition remains required. Its nonzero value also enables the later optional animation updates. domain_1_value_2 -> HERO_ANIMATION_UPDATE_GUARD_OVERRIDE: Retail 0x0021e40c-0x0021e42c loads D_L16_0015F5C4, tests global values 2 or 6, and compares the saved second argument s5 against a0=2 before returning zero. Original Ghidra expresses the same global tests && param_2 != 2; authoritative C uses animation_update_mode. This is the same argument/domain as the preceding dying-mode admission test, so reuse HERO_ANIMATION_UPDATE_GUARD_OVERRIDE without assigning a meaning to the global states or mixing vehicle/current-state domains. --- src/overlays/l16/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l16/hero/hero_set_state.c b/src/overlays/l16/hero/hero_set_state.c index 243382b3de..9ff150cd5f 100644 --- a/src/overlays/l16/hero/hero_set_state.c +++ b/src/overlays/l16/hero/hero_set_state.c @@ -83,6 +83,9 @@ extern char level16_hero_jump_velocity_keys[] __asm__("D_L16_0017C380"); extern char level16_hero_water_surface_jump_velocity_keys[] __asm__("D_L16_0017C3C0"); int hero_set_state(int requested_state, int animation_update_mode) { + enum { + HERO_ANIMATION_UPDATE_GUARD_OVERRIDE = 2 + }; int saved_state_step; char *moby; int old20A7; @@ -90,10 +93,10 @@ int hero_set_state(int requested_state, int animation_update_mode) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_update_mode != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_update_mode != HERO_ANIMATION_UPDATE_GUARD_OVERRIDE)) return 0; } - if ((D_L16_0015F5C4 == 2 || D_L16_0015F5C4 == 6) && animation_update_mode != 2) + if ((D_L16_0015F5C4 == 2 || D_L16_0015F5C4 == 6) && animation_update_mode != HERO_ANIMATION_UPDATE_GUARD_OVERRIDE) return 0; { struct Hero *p = &hero; From 899038ba272aa0b49a32c6e0ebf41a6d42f3f682 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:16:01 +0000 Subject: [PATCH 087/758] decomp: clarify names in cancel_suck_cannon_suction_and_set_moby_state_5 domain_0_value_5 -> CHICKEN_STATE_EMIT_FEATHERS: Retail 0x002caf20 preserves the incoming Moby pointer in s0 across cancel_suck_cannon_suction at 0x002caf1c; 0x002caf24 loads 5 and 0x002caf2c stores that byte to s0+0x20, the authoritative moby->state field. This is the chicken Moby state domain in morphoray_chicken.c, not suction_record+0x68. The same source declares CHICKEN_STATE_EMIT_FEATHERS=5 and morphoray_chicken_update switches on chicken_moby->state: that member builds feather position/velocity and calls spawn_feather_moby. Adjacent chicken suction and launch wrappers also assign this existing member to their Moby state. Thus this state-entry wrapper should reuse the canonical chicken member. --- src/overlays/shared/weapons/morphoray_chicken.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/morphoray_chicken.c b/src/overlays/shared/weapons/morphoray_chicken.c index d19e853076..7d3b849676 100644 --- a/src/overlays/shared/weapons/morphoray_chicken.c +++ b/src/overlays/shared/weapons/morphoray_chicken.c @@ -870,7 +870,7 @@ int cancel_suck_cannon_suction_and_set_moby_state_5(struct Moby *moby) __asm__(" int cancel_suck_cannon_suction_and_set_moby_state_5(struct Moby *moby) { int helper_result = cancel_suck_cannon_suction(moby); - moby->state = 5; + moby->state = CHICKEN_STATE_EMIT_FEATHERS; return helper_result; } From 86ad1232f65dee6ea595ab180d509031d82281ee Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:18:39 +0000 Subject: [PATCH 088/758] decomp: clarify names in mark_elevator_collected domain_0_value_0 -> ELEVATOR_STATE_COLLECTED: Authoritative source src/overlays/l14/mobys/qwark_oltanis.c SHA-256 e67f57c3843f1b9c153b27ff7e37ea0a6a8f3c440193d89e0a96e9ee40336580 assigns vendor_moby->state=0 in established mark_elevator_collected. Original retail Ghidra and sb zero,0xbc(a0) at 0x002ef5b0 confirm this exact state store; 0x002ef5b8 clears its data+0x124 and 0x002ef5fc/0x002ef628 set its +0xB2 save-ID bits. Checked caller 0x002fba20 reaches 0x002fbcb4 after dialogue substates 3/4 and grant_inventory_item(0x20,1); 0x002fbca4..0x002fbcb8 passes the linked elevator at D_L14_0015FFD8+(pvars+0x44)*256. This same object is passed at 0x002fbbe8 to established enable_elevator_alternate_route; checked sibling 0x002ef578 writes 1 or 2 to +0xBC and 1 to data+0x124 at 0x002ef598/0x002ef5a4. Thus zero is the elevator state assigned by the collection transition, distinct from the active alternate-route states, with no proof of membership in any Hero enum. --- src/overlays/l14/mobys/qwark_oltanis.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l14/mobys/qwark_oltanis.c b/src/overlays/l14/mobys/qwark_oltanis.c index 64d4e9f20f..21c133e2c7 100644 --- a/src/overlays/l14/mobys/qwark_oltanis.c +++ b/src/overlays/l14/mobys/qwark_oltanis.c @@ -54,7 +54,10 @@ extern int D_L14_001BABD0[]; void mark_elevator_collected(Level14VendorMoby *vendor_moby) __asm__("FUN_L14_002ef5a8"); void mark_elevator_collected(Level14VendorMoby *vendor_moby) { - vendor_moby->state = 0; + enum { + ELEVATOR_STATE_COLLECTED = 0 + }; + vendor_moby->state = ELEVATOR_STATE_COLLECTED; vendor_moby->data->field124 = 0; D_0014C190_257218[current_level_index] [(short)*(unsigned short *)((char *)vendor_moby + 0xB2) >> 5] |= From 733ad749cbeb5509d941a23bfccaf3569fad46ae Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:20:24 +0000 Subject: [PATCH 089/758] decomp: clarify names in update_camera_mode_from_preset domain_0_value_3 -> CAMERA_PRESET_KIND_GRINDRAIL_PATH: Retail 0x00316038-0x0031605c obtains the preset pointer from D_L01_0015EF50[camera_user->slot at +0x84].preset at +0x1c. Instructions 0x00316090-0x00316098 load preset +0x30 (CameraPreset.kind) and compare it to 3. This is the identical CameraPreset.kind domain already tested against CAMERA_PRESET_KIND_GRINDRAIL_PATH in reset_camera_state_and_prepare_preset_paths and initialize_camera_transform_and_paths in the authoritative source. Those consumers configure the grindrail path camera and its path direction; reuse the existing member rather than introducing a mode or hero-state constant. --- src/overlays/shared/camera/grindrail_camera.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/camera/grindrail_camera.c b/src/overlays/shared/camera/grindrail_camera.c index 52ad041c74..eb480e9a95 100644 --- a/src/overlays/shared/camera/grindrail_camera.c +++ b/src/overlays/shared/camera/grindrail_camera.c @@ -620,7 +620,7 @@ void update_camera_mode_from_preset(CamUser *camera_user) { return; } } - if (camera_preset->kind == 3) { + if (camera_preset->kind == CAMERA_PRESET_KIND_GRINDRAIL_PATH) { camera_user->mode = 5; } else { camera_user->mode = 3; From 165ba98df034321a0a53dfd206f0aa1ef3850b7f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:24:40 +0000 Subject: [PATCH 090/758] decomp: clarify names in spawn_linked_moby_from_basis domain_0_value_0 -> TRAILING_FLAME_STATE_INITIAL: Authoritative trailing_flame.c SHA-256 d99adf712ffdd3ed2e996e9aad1c264a3a3444cdae9b1b068ee03fcc8d5dcbca identifies class 0xB3 as the following flame. In retail FUN_002bb360, 0x002bb374/378 creates class 0xB3, 0x002bb37c saves the new object in s0, and 0x002bb380 skips setup on allocation failure. Instruction 0x002bb3b4 (sb zero,0x20(s0)) assigns the new object's state during construction, before retaining the basis source at pvars+8 (0x002bb3bc), copying its basis, and calling update_entity at 0x002bb3e0. Original Ghidra likewise writes *(undefined1 *)(iVar6+0x20)=0 inside the allocation-success branch. Current C maps this exact store to MOBY(spawned_moby)->state=0. This proves the initial spawn state, without asserting an initialization handler or reusing unrelated hero state enums. Supplied pyrocitor_update context stores this helper's returned object in pyrocitor_vars->other. --- src/overlays/shared/weapons/trailing_flame.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/trailing_flame.c b/src/overlays/shared/weapons/trailing_flame.c index 097f4bc9aa..039add413e 100644 --- a/src/overlays/shared/weapons/trailing_flame.c +++ b/src/overlays/shared/weapons/trailing_flame.c @@ -32,6 +32,9 @@ extern float FUN_001fa580_2bb400(float, float) __asm__("FUN_001fa580"); u8 *spawn_linked_moby_from_basis(u8 *basis_source_moby) __asm__("FUN_L00_002bb360"); u8 *spawn_linked_moby_from_basis(u8 *basis_source_moby) { + enum { + TRAILING_FLAME_STATE_INITIAL = 0 + }; u8 *spawned_moby = create_moby(0xB3); if (spawned_moby) { u8 *spawned_moby_vars = ((u8 *)MOBY(spawned_moby)->pvars); @@ -40,7 +43,7 @@ u8 *spawn_linked_moby_from_basis(u8 *basis_source_moby) { MOBY(spawned_moby)->visible = 1; MOBY(spawned_moby)->flags = 0x204; MOBY(spawned_moby)->alpha = 0x50; - MOBY(spawned_moby)->state = 0; + MOBY(spawned_moby)->state = TRAILING_FLAME_STATE_INITIAL; *(u8 **)(spawned_moby_vars + 8) = basis_source_moby; clear_u64_value(spawned_moby + 0x40); *(OvlQuad *)&MOBY(spawned_moby)->rot_row0 = *(OvlQuad *)&MOBY(basis_source_moby)->rot_row0; From cf60083839fc142c86e81c3926a4d4e0e765093a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:26:30 +0000 Subject: [PATCH 091/758] decomp: clarify names in translation_delta_matrix_update domain_0_value_1 -> MOBY_TRANSLATION_DELTA_STATE_INITIALIZED: Authoritative translation_delta_matrix_update source (src/overlays/l04/mobys/translation_delta_matrix.c, SHA-256 fefedd9dbe49cf73a90354bddd2421cfd7eefc8d8b844a888a0cd30672cc35e4) assigns MOBY(moby)->state = 1 only after the existing MOBY_TRANSLATION_DELTA_STATE_INITIALIZE (0) branch. Original retail decompilation uses the same moby+0x20 byte for the zero test and final store. Retail 0x002d35d4 lbu v1,0x20(s3) and 0x002d35d8 bne v1,zero skip initialization on nonzero state. The zero path initializes pvars +0x20/+0x24/+0x28/+0x3e at 0x002d35e8-0x002d35fc and calls copy_hero_moby_field_38; 0x002d3600 li v0,1 and 0x002d3604 sb v0,0x20(s3) then mark initialization completed. Thus INITIALIZED is proven for this local moby state domain, without treating it as a control mode or shared enum. --- src/overlays/l04/mobys/translation_delta_matrix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l04/mobys/translation_delta_matrix.c b/src/overlays/l04/mobys/translation_delta_matrix.c index e60d8ea43a..52efc38c00 100644 --- a/src/overlays/l04/mobys/translation_delta_matrix.c +++ b/src/overlays/l04/mobys/translation_delta_matrix.c @@ -17,6 +17,9 @@ void translation_delta_matrix_update(char *moby) { enum { MOBY_TRANSLATION_DELTA_STATE_INITIALIZE = 0 }; + enum { + MOBY_TRANSLATION_DELTA_STATE_INITIALIZED = 1 + }; char *moby_vars = ((char *)MOBY(moby)->pvars); float position_delta[4]; fast_vec_sub(position_delta, moby + 0x10, moby_vars + 0xA0); @@ -28,6 +31,6 @@ void translation_delta_matrix_update(char *moby) { moby_vars[0x28] = 4; *(short *)(moby_vars + 0x3E) = 0xD; copy_hero_moby_field_38(moby); - MOBY(moby)->state = 1; + MOBY(moby)->state = MOBY_TRANSLATION_DELTA_STATE_INITIALIZED; } } From f7bdcc5b1c1eb705da8983d651577edce07a9623 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:26:30 +0000 Subject: [PATCH 092/758] decomp: clarify names in refresh_spawner_population_and_find_free_slot domain_0_value_254 -> MOBY_STATE_MARKED_FOR_REMOVAL: The assigned retail code loads slot_moby->state with lbu at 0x0030ab38 and excludes 0xFE at 0x0030ab3c. Checked spawner_update directly calls assigned 0x0030aae0 at 0x0030ad10 and the source-named mark_moby_for_removal at 0x0030ac08 and 0x0030b1d8. That checked sibling loads 0xFE at 0x0026e514 and stores it to the same moby +0x20 state byte at 0x0026e518. Thus this exact state marks a moby for removal, explaining exclusion from the population count. --- src/overlays/shared/enemies/spawner.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/spawner.c b/src/overlays/shared/enemies/spawner.c index 301333d7de..b93a0369dd 100644 --- a/src/overlays/shared/enemies/spawner.c +++ b/src/overlays/shared/enemies/spawner.c @@ -123,6 +123,9 @@ int refresh_spawner_population_and_find_free_slot(int unused, char *spawner_vars) __asm__("FUN_L09_0030aae0"); int refresh_spawner_population_and_find_free_slot(int unused, char *spawner_vars) { + enum { + MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE + }; int last = -1; int i; char **slot; @@ -130,7 +133,7 @@ int refresh_spawner_population_and_find_free_slot(int unused, char *spawner_vars for (i = 0, slot = (char **)(spawner_vars + 0xB0); i < 20; i++, slot++) { char *slot_moby = *slot; if (slot_moby != 0 && MOBY(slot_moby)->oclass == 0x75E && - (unsigned char)MOBY(slot_moby)->state != 0xFE && + (unsigned char)MOBY(slot_moby)->state != MOBY_STATE_MARKED_FOR_REMOVAL && (unsigned char)MOBY(slot_moby)->state != 0xFD) { spawner_vars[0x91]++; } else { From 040ad9997c030b2ab6af1a216a5853ce3549a09a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:26:30 +0000 Subject: [PATCH 093/758] decomp: clarify names in can_select_hero_item_31 domain_1_value_4 -> HERO_CONTROL_MODE_JUMP: Retail 0x0020fe58-0x0020fe5c forms &hero (0x0013f350); lw v1,0x208c(a0) at 0x0020fe6c loads state.control_mode, and 0x0020fe7c/0x0020fe80 compare that word with 4. The bound source snapshot (sha256 8fc99915dc0758b48fd37cb4829424b8f16d24c120de227f3cace2bc7dbb8468) already defines HERO_CONTROL_MODE_JUMP = 4 in find_grind_rail and compares the identical hero.state.control_mode field against it before testing past_jump_apex and rail_catch_grace. update_hero_collision_capsule_dimensions also tests control_mode == 4 with state_timer > takeoff_frame and past_jump_apex == 0. This proves the control-mode jump domain, independently of the distinct current-state ID 4 (HERO_STATE_CROUCH). --- 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 d8b15692db..6458c7348d 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -1901,6 +1901,9 @@ s32 get_hero_target_pose_status(void) __asm__("FUN_L00_00233f38"); s32 can_select_hero_item_31(void) __asm__("FUN_L00_0020fe30"); s32 can_select_hero_item_31(void) { + enum { + HERO_CONTROL_MODE_JUMP = 4 + }; struct Hero *hero_state; u32 control_mode; if (get_hero_target_pose_status()) @@ -1911,7 +1914,7 @@ s32 can_select_hero_item_31(void) { if (hero_state->vehicle_mode) return 0; control_mode = hero_state->state.control_mode; - if (control_mode < 3 || control_mode == 4) + if (control_mode < 3 || control_mode == HERO_CONTROL_MODE_JUMP) return hero_state->base_condition == 0; return 0; } From 7598c6038bc277843436cfafcbbf0a2edc9d98bc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:28:19 +0000 Subject: [PATCH 094/758] decomp: clarify names in reset_moby_from_class_defaults domain_0_value_0 -> MOBY_RESET_STATE: Retail 0030af5c preserves the incoming moby in s0, and 0030af60 stores zero at s0+0x20, the authoritative C's moby->state. This is the state selected by reset_moby_from_class_defaults while clearing command (0030af70), restoring class flags/scale (0030af68-0030af84), enabling visibility/distances (0030af80-0030af90), and restoring collision (0030afb0-0030afb8). Checked caller 0030b45c-0030b46c tests the group's child state for FE/FD; 0030b498-0030b4a4 restores its position and 0030b4a8-0030b4cc applies timer/segment guards then passes that child to this reset function. Thus MOBY_RESET_STATE names the reset target state without inferring the controller's INITIALIZE_PATH_CHILDREN domain or a child-specific lifecycle. --- src/overlays/l07/mobys/mine_group.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l07/mobys/mine_group.c b/src/overlays/l07/mobys/mine_group.c index 198040d60c..7b06fc4584 100644 --- a/src/overlays/l07/mobys/mine_group.c +++ b/src/overlays/l07/mobys/mine_group.c @@ -158,10 +158,13 @@ char D_L07_00211580[] = "Moby 871 short on mines at %d in group %d compared to mine count in pVar %d\n"; void reset_moby_from_class_defaults(struct Moby *moby) { + enum { + MOBY_RESET_STATE = 0 + }; struct SpawnClassView *class_defaults; struct AnimTimer *animation_timer; - moby->state = 0; + moby->state = MOBY_RESET_STATE; class_defaults = (struct SpawnClassView *)moby->pclass; moby->command = 0; moby->flags = class_defaults->flags; From 3becb616ad87e6c066a08943e4dbd2a5847aefad Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:28:19 +0000 Subject: [PATCH 095/758] decomp: clarify names in can_release_linked_robot_dog domain_0_value_253 -> MOBY_STATE_ALTERNATE_PENDING_REMOVAL: Assigned retail 0x002c6cbc loads Moby+0x20 into v1 and 0x002c6cc8..0x002c6ccc rejects 0xFD, exactly the source state comparison. Checked common caller robot_dog_update calls this predicate at 0x002c5fa8/0x002c63dc and mark_moby_for_removal at 0x002c699c. Checked level-03 removal helper 0x0023d6d8 reads the pointer at 0x0015ffdc, compares the Moby address unsigned at 0x0023d6e8, selects 0xFD at 0x0023d6f8 for addresses below that pointer or 0xFE at 0x0023d6fc otherwise, and writes either to Moby+0x20 at 0x0023d700. Both paths then store the same counter+2 deadline at Moby+0x38 at 0x0023d708..0x0023d720. Thus 0xFD is the alternate pending-removal state in this exact Moby state domain; no identity for the address domain is inferred. --- src/overlays/l03/mobys/robot_dog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l03/mobys/robot_dog.c b/src/overlays/l03/mobys/robot_dog.c index 2aa9163bb5..c14eee19d5 100644 --- a/src/overlays/l03/mobys/robot_dog.c +++ b/src/overlays/l03/mobys/robot_dog.c @@ -549,6 +549,9 @@ void update_robot_dog_hit_reaction(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l03_kerwan/vendor_00293720.c: func_L03_002C8068), where it is exact; names translated to the US level program. */ int can_release_linked_robot_dog(struct Moby *moby) { + enum { + MOBY_STATE_ALTERNATE_PENDING_REMOVAL = 0xFD + }; unsigned char state; char *partner_pvars; partner_pvars = (char *)moby->pvars; @@ -557,7 +560,7 @@ int can_release_linked_robot_dog(struct Moby *moby) { state = moby->state; if (state == MOBY_STATE_PENDING_REMOVAL) return 0; - if (state == 0xFD) + if (state == MOBY_STATE_ALTERNATE_PENDING_REMOVAL) return 0; if (moby->oclass != 0x23E) return 0; From c518a4b8f45b0047a9af4eb65220deb6b3ea0d4f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:31:37 +0000 Subject: [PATCH 096/758] decomp: clarify names in attach_cutscene_big_head_manipulator domain_0_value_2 -> CUTSCENE_MODE_ACTIVE: The bound source identifies the selector as cutscene_mode. Retail 0x002ff030 loads its word at 0x0015f5c4 and 0x002ff038/058 require value 2 before the big_head_cheat_enabled check and manipulator attachment/scale writes at 0x002ff0b0-0x002ff0d4. Checked caller the_plumber_update calls this function at 0x002ff154. After update_npc_dialogue returns true at 0x002ff248-250, it invokes begin_dialogue_camera_transition at 0x002ff264 and enters post-dialogue state; 0x002ff274-280 waits while the same global is 2, bypassing camera restoration at 0x002ff2b8-2d8. The level-eight post-dialogue path likewise waits at 0x002ff36c-378. Together these identify the active cutscene interval, separate from the caller's moby state and all hero enum domains. --- src/overlays/shared/cutscenes/the_plumber.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/cutscenes/the_plumber.c b/src/overlays/shared/cutscenes/the_plumber.c index 36476aa44f..1c137965dc 100644 --- a/src/overlays/shared/cutscenes/the_plumber.c +++ b/src/overlays/shared/cutscenes/the_plumber.c @@ -119,7 +119,10 @@ float D_L08_00161FB0 = 2.1f; void attach_cutscene_big_head_manipulator(struct Moby *class_reference_moby) __asm__("FUN_L01_002ff028"); void attach_cutscene_big_head_manipulator(struct Moby *class_reference_moby) { - if (cutscene_mode == 2 && big_head_cheat_enabled != 0) { + enum { + CUTSCENE_MODE_ACTIVE = 2 + }; + if (cutscene_mode == CUTSCENE_MODE_ACTIVE && big_head_cheat_enabled != 0) { int i; for (i = 0; i < D_L01_0016CCE0_q.n; i++) { char *moby = D_L01_0016CCE0_q.m[i]; From bf19e4571aeabb3bc0ba681d3969f7ee9938d563 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:40:44 +0000 Subject: [PATCH 097/758] decomp: clarify names in create_drone_flight_trail_record domain_0_value_0 -> DRONE_FLIGHT_TRAIL_MODE_EXTENDED_STEP_RANGE: The second parameter is retained in s1 at 0x0026fdec. Retail 0x0026fdf8-0x0026fe08 selects 15 for zero mode or 5 for nonzero mode, subtracts step in s2, and rejects a negative remainder. The comparison at 0x0026fe44 sends zero mode into 0x0026fe4c-0x0026fe7c, which stores 15-step at record +0xA; the nonzero branch at 0x0026feb0-0x0026fee0 stores 5-step. Original Ghidra shows the same param_2 == 0 split. The supplied fleet_turret_shot_update caller passes mode 0 at the next flight position and mode 1 at both next position and midpoint, establishing a trail-mode domain separate from moby states. Thus zero selects the extended accepted step range, independently of uncertain rendering semantics. --- src/overlays/l17/mobys/dreks_fleet_turret_shot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l17/mobys/dreks_fleet_turret_shot.c b/src/overlays/l17/mobys/dreks_fleet_turret_shot.c index b91db88e7c..4d0f453861 100644 --- a/src/overlays/l17/mobys/dreks_fleet_turret_shot.c +++ b/src/overlays/l17/mobys/dreks_fleet_turret_shot.c @@ -50,6 +50,9 @@ unsigned char *create_drone_flight_trail_record(char *position_source, int step) __asm__("FUN_L17_0026fdd0"); unsigned char *create_drone_flight_trail_record(char *position_source, int mode, int step) { + enum { + DRONE_FLIGHT_TRAIL_MODE_EXTENDED_STEP_RANGE = 0 + }; unsigned char *flight_trail_record; int remaining_steps; if (mode) @@ -62,7 +65,7 @@ unsigned char *create_drone_flight_trail_record(char *position_source, int mode, 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 == 0) { + if (mode == DRONE_FLIGHT_TRAIL_MODE_EXTENDED_STEP_RANGE) { int d = 0xF - step; *(int *)(flight_trail_record + 4) = 0x60FF3020; flight_trail_record[3] = 0x48; From a638906ab097c40503e7317b34cac4a80d87ba66 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:46:43 +0000 Subject: [PATCH 098/758] decomp: clarify names in emit_hero_randomized_motion_effects domain_0_value_1 -> HERO_MOTION_EFFECT_ALTERNATING_MOBY_POINTS_0_AND_14: Retail 00209a54 moves argument a1 to s3, the mode selector. At 00209b20 s3 is compared with 1; 00209b28-00209b40 tests iteration parity and sets a1 to point 0 for even iterations or 0xe (14) for odd iterations. 00209b30 loads hero.moby from hero+0x2080; 00209b5c-00209b60 calls moby_point_position with output sp. That position becomes a0 of the effect call at 00209c5c-00209c60. The bound C and original Ghidra agree; supplied movement callers pass 1 during animation windows. This names alternating emission origins by their proven point indices, not anatomical guesses or selector-number placeholders. It extends the function-local emission-position domain containing HERO_MOTION_EFFECT_RANDOMIZED_HERO_POSITION. domain_1_value_2 -> HERO_MOTION_EFFECT_ALTERNATING_MOBY_POINTS_23_AND_22: Retail 00209b24 loads comparison value 2 and 00209b44 compares it with argument-derived s3. 00209b4c-00209b58 tests loop parity, loads hero.moby from +0x2080, and chooses point 0x17 (23) for even iterations; 00209b6c selects 0x16 (22) for odd iterations. Calls at 00209b5c/00209b70 write moby_point_position to sp, which is passed as effect position at 00209c5c-00209c60. Bound C and original Ghidra show the same alternating pair. This is the same local emission-position selector domain as mode 0 and mode 1, not a shared hero-state, gravity or vehicle enum. The name states the proven alternating emission origins without assuming anatomy. --- src/overlays/shared/hero/hero_idle_sequence.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 53ba5ce23a..4d3c4da319 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -2561,6 +2561,10 @@ void emit_hero_randomized_motion_effects(int iteration_count, int mode) { enum { HERO_MOTION_EFFECT_RANDOMIZED_HERO_POSITION = 0 }; + enum { + HERO_MOTION_EFFECT_ALTERNATING_MOBY_POINTS_0_AND_14 = 1, + HERO_MOTION_EFFECT_ALTERNATING_MOBY_POINTS_23_AND_22 = 2 + }; float pos[4]; V_209a40 randomized_displacement; int i; @@ -2574,13 +2578,13 @@ void emit_hero_randomized_motion_effects(int iteration_count, int mode) { 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 == 1) { + } else if (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 == 2) { + } else if (mode == HERO_MOTION_EFFECT_ALTERNATING_MOBY_POINTS_23_AND_22) { if (!(i & 1)) { moby_point_position(hero_state->moby, 0x17, pos); } else { From bc911ae1e0ebd3c4110f6725588ac1070c3b6f54 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:49:10 +0000 Subject: [PATCH 099/758] decomp: clarify names in respawn_spawner_child domain_0_value_0 -> SPAWNER_CHILD_STATE_INITIAL: In source snapshot src/overlays/shared/enemies/spawner_egg.c SHA-256 74ca3a0df053286d0c4e0f73587adfada0d7d0de9b5ba09f2da1eb83337ba39a, respawn_spawner_child restores the retrieved child's position, state, command, class flags, scale and visibility. Retail 0x0030a7e0-0x0030a7f0 copies the requested position; 0x0030a800-0x0030a804 loads that same child output pointer and stores zero to its state byte +0x20. Subsequent stores through 0x0030a844 restore class defaults and visibility before the initialized child is returned at 0x0030a978/0x0030a9c4. This proves the initial state restored by respawning, without asserting its later behavior. Checked lookup-helper evidence cf79cc13d54f43efb10846403f4dfe7f at 0x00278dec-0x00278e00 confirms the output is a group moby whose +0x20 is the examined state byte; no fixed child class is established. The selector is spawned_moby->state, distinct from the egg caller's state. --- src/overlays/shared/enemies/spawner_egg.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/spawner_egg.c b/src/overlays/shared/enemies/spawner_egg.c index 2e878685e6..830b9f19f8 100644 --- a/src/overlays/shared/enemies/spawner_egg.c +++ b/src/overlays/shared/enemies/spawner_egg.c @@ -77,6 +77,9 @@ static inline void bubble_bounce(struct Moby *moby, BubbleVars *vars) { struct Moby *respawn_spawner_child(struct Moby *owner, Vec4 *pos) __asm__("FUN_L09_0030a778"); struct Moby *respawn_spawner_child(struct Moby *parent_spawner_moby, Vec4 *pos) { + enum { + SPAWNER_CHILD_STATE_INITIAL = 0 + }; struct Moby *spawned_moby; struct Moby *child_suck_cannon_record; u8 *owner_vars; @@ -98,7 +101,7 @@ struct Moby *respawn_spawner_child(struct Moby *parent_spawner_moby, Vec4 *pos) owner_vars[0x91] = owner_vars[0x91] + 1; qcopy_nc(&spawned_moby->pos, pos_ptr); spawned_moby->pos.w = 0.0f; - spawned_moby->state = 0; + spawned_moby->state = SPAWNER_CHILD_STATE_INITIAL; spawned_moby->command = 0; spawned_moby->flags = spawned_moby->pclass->flags; spawned_moby->scale = spawned_moby->pclass->scale; From 3b15943f6b75cb478a62099ca2e49ee0a5cb7c6c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:51:28 +0000 Subject: [PATCH 100/758] decomp: clarify names in update_hero_ground_material_flags domain_0_value_14 -> GROUND_MATERIAL_FIXED_WATER_DEPTH: The selector state is loaded from hero.ground_type: retail lh s3,+0x12e0 at 0x0022de60, before clearing the material region. Retail 0x0022def0 compares this saved material with 14; 0x0022def8-0x0022df18 loads 0.2f, sets base_condition at +0x12e4, writes the fixed 0.2f to water_depth at +0x22a4, and writes ground_z (+0x2d8) plus 0.2f to water_surface_z (+0x2f0). Original Ghidra sVar1==0xe reproduces these stores. This is a behavior-based ground-material name, not HERO_STATE_DOUBLE_JUMP; current hero state is separately loaded from +0x2084 at 0x0022e01c. --- src/overlays/l12/hero/update_hero_motion_for_current_state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l12/hero/update_hero_motion_for_current_state.c b/src/overlays/l12/hero/update_hero_motion_for_current_state.c index 27f5fadaa1..c6769bea79 100644 --- a/src/overlays/l12/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l12/hero/update_hero_motion_for_current_state.c @@ -38,6 +38,9 @@ float absolute_float(float input) __asm__("func_001F99C0"); void update_hero_ground_material_flags(void) __asm__("FUN_L12_0022de30"); void update_hero_ground_material_flags(void) { + enum { + GROUND_MATERIAL_FIXED_WATER_DEPTH = 0xE + }; struct Hero *hero_for_ground_flags_update = &hero; unsigned char saved; int state; @@ -61,7 +64,7 @@ void update_hero_ground_material_flags(void) { } } } - if (state == 0xE) { + if (state == GROUND_MATERIAL_FIXED_WATER_DEPTH) { struct Hero *hero_for_surface_update = &hero; hero_for_surface_update->base_condition = 1; hero_for_surface_update->water_depth = 0.2f; From 533bbaa8518652be085844db508f85ee93f12ae7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:51:28 +0000 Subject: [PATCH 101/758] decomp: clarify names in hero_falling_platform_update domain_0_value_1 -> LEAF_WAIT_FOR_HERO_CONTACT: Retail 00311c08 reads the switch selector from 0x20(s1); 00311cc4-00311cc8 writes 1 to that exact byte after initialization. The original decompilation case 1 at 00311cd8-00311d20 waits on is_hero_on_moby before timer setup and progression. Thus the assignment enters the same domain and member already declared locally as LEAF_WAIT_FOR_HERO_CONTACT = 1. domain_1_value_2 -> LEAF_TIMED_SWAY_AND_DESCENT: Retail 00311cd8-00311d20 gates on hero contact, initializes pvars+0xA0 with a scaled 30-frame timer, then writes 2 to 0x20(s1), the same state byte read at 00311c08. Original decompilation case 2 and retail 00311d24-00311dc8 compute timer-driven sine/cosine rotations, lower height and decrement the timer. Reuse the existing same-selector local member LEAF_TIMED_SWAY_AND_DESCENT = 2. domain_2_value_3 -> LEAF_ACCELERATED_FALL: Retail 00311da8-00311dc8 tests timer completion, initializes the downward accumulator at pvars+0xA4, then stores 3 to 0x20(s1), the switch state byte read at 00311c08. Original decompilation case 3 and retail 00311dcc-00311e54 add frame_time_sq*9.8 to that accumulator, subtract it from height and remove the moby below 2. Reuse existing same-domain LEAF_ACCELERATED_FALL = 3. --- src/overlays/l07/mobys/hero_falling_platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l07/mobys/hero_falling_platform.c b/src/overlays/l07/mobys/hero_falling_platform.c index 12c4d2a85d..5bf9303571 100644 --- a/src/overlays/l07/mobys/hero_falling_platform.c +++ b/src/overlays/l07/mobys/hero_falling_platform.c @@ -74,7 +74,7 @@ void hero_falling_platform_update(char *moby) { MOBY(moby)->rot.x += random_float_between(-0.034906585f, 0.034906585f); MOBY(moby)->rot.y += random_float_between(-0.034906585f, 0.034906585f); MOBY(moby)->pos.z += random_float_between(-0.02f, 0.02f); - MOBY(moby)->state = 1; + MOBY(moby)->state = LEAF_WAIT_FOR_HERO_CONTACT; break; case LEAF_WAIT_FOR_HERO_CONTACT: if (is_hero_on_moby(moby)) { @@ -83,7 +83,7 @@ void hero_falling_platform_update(char *moby) { moby_data->timer_A0 = scale_game_frames(0x1E); if (moby_data->unkA2 != -1) allocate_voice_for_target_entry(moby_data->unkA2, 0, (int)moby); - MOBY(moby)->state = 2; + MOBY(moby)->state = LEAF_TIMED_SWAY_AND_DESCENT; } break; case LEAF_TIMED_SWAY_AND_DESCENT: @@ -99,7 +99,7 @@ void hero_falling_platform_update(char *moby) { } if (fast_dec_timer_s16(&moby_data->timer_A0)) { moby_data->unkA4 = frame_scale * 0.002f; - MOBY(moby)->state = 3; + MOBY(moby)->state = LEAF_ACCELERATED_FALL; } break; case LEAF_ACCELERATED_FALL: From 45d349c597f61b5684ca2907ef2a1c46ed736cab Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Sun, 1 Nov 2026 23:58:18 +0000 Subject: [PATCH 102/758] decomp: clarify names in blarg_gun_update domain_0_value_2 -> BLARG_GUN_STATE_INACTIVE: The authoritative source assigns 2 to MOBY(moby)->state in BLARG_GUN_STATE_INITIALIZE. Retail 00318720 reads the same state byte at s3+0x20; 00318724 handles zero and 0031872c-00318738 admits only state 1 to moving updates, returning for state 2. At 00318740-00318764 initialization sets the persistent basis flag and stores 2 to that exact byte before exiting. Original Ghidra likewise has only state-zero initialization and state-one motion branches. Thus 2 is the initialized inactive state of this updater, with no rotation/collision/timer/gravity/position processing; no external lifecycle behavior is inferred. --- src/overlays/shared/enemies/blarg_gun.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/blarg_gun.c b/src/overlays/shared/enemies/blarg_gun.c index 65838efe7d..5b5942f159 100644 --- a/src/overlays/shared/enemies/blarg_gun.c +++ b/src/overlays/shared/enemies/blarg_gun.c @@ -22,6 +22,9 @@ void blarg_gun_update(char *moby) { BLARG_GUN_STATE_INITIALIZE = 0, BLARG_GUN_STATE_MOVING = 1 }; + enum { + BLARG_GUN_STATE_INACTIVE = 2 + }; char *launch_motion_vars = ((char *)MOBY(moby)->pvars); char rotation_workspace[0x70]; char *hs; @@ -32,7 +35,7 @@ void blarg_gun_update(char *moby) { case BLARG_GUN_STATE_INITIALIZE: if (((unsigned short)MOBY(moby)->draw_dist) & 1) MOBY(moby)->flags |= 0x8000; - MOBY(moby)->state = 2; + MOBY(moby)->state = BLARG_GUN_STATE_INACTIVE; break; case BLARG_GUN_STATE_MOVING: joint_index = *(int *)(launch_motion_vars + 4); From a309c234e4e2ac937cc06f8c9df117c0a37ec8ee Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:01:06 +0000 Subject: [PATCH 103/758] decomp: clarify names in hoverboard_update domain_0_value_1 -> HOVERBOARD_STATE_WAIT_FOR_CONTROL_MODE_EXIT: Source state is loaded from (u8)MOBY(moby)->state and switched using the existing local hoverboard enum. Retail 0x002f87d4 reads +0x20(s2); 0x002f87b4 sets s4=1, and 0x002f8878 stores s4 to that same +0x20 after the player-approach guards and hero_set_state call. On the next update 0x002f87d8 dispatches this value to 0x002f8884; 0x002f88f4-0x002f88f8 retains it while hero control_mode is 0x16. Thus this assignment enters the existing HOVERBOARD_STATE_WAIT_FOR_CONTROL_MODE_EXIT domain member. domain_1_value_0 -> HOVERBOARD_STATE_WAIT_FOR_PLAYER_APPROACH: Retail 0x002f88f4-0x002f88f8 tests hero control_mode against 0x16. When it has exited, 0x002f8900-0x002f891c adjusts update distance and conditionally restores the saved hoverboard position, then 0x002f8910 or 0x002f8920 stores zero into +0x20(s2). This is the exact moby state byte read at 0x002f87d4 and represented by source MOBY(moby)->state. Zero dispatches through 0x002f87e0-0x002f8804 to the player-distance test, already named HOVERBOARD_STATE_WAIT_FOR_PLAYER_APPROACH in this function's local enum. --- src/overlays/shared/vehicles/hoverboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/vehicles/hoverboard.c b/src/overlays/shared/vehicles/hoverboard.c index da6500cd21..9d9f2d1e11 100644 --- a/src/overlays/shared/vehicles/hoverboard.c +++ b/src/overlays/shared/vehicles/hoverboard.c @@ -51,7 +51,7 @@ void hoverboard_update(unsigned char *moby) { if (*(int *)(hoverboard_vars + 0x50) == 0) { qcopy(hoverboard_vars + 0x10, &MOBY(moby)->pos); } - MOBY(moby)->state = 1; + MOBY(moby)->state = HOVERBOARD_STATE_WAIT_FOR_CONTROL_MODE_EXIT; MOBY(moby)->update_dist = 0xff; } break; @@ -68,7 +68,7 @@ void hoverboard_update(unsigned char *moby) { if (*(int *)(hoverboard_vars + 0x50) == 0) { qcopy(&MOBY(moby)->pos, hoverboard_vars + 0x10); } - MOBY(moby)->state = 0; + MOBY(moby)->state = HOVERBOARD_STATE_WAIT_FOR_PLAYER_APPROACH; } break; case 2: From 2fcf6181e170ba5dce7bf3d8d9635f7e6066bc1f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:02:59 +0000 Subject: [PATCH 104/758] decomp: clarify names in process_horny_toad_hit_reaction domain_0_value_0 -> HORNY_TOAD_INITIALIZE: horny_toad_update passes its Moby unchanged to FUN_L00_002d5160_2d4610 before switching on moby->state; retail 0x002d516c retains a0 in s2 and all these accesses use byte s2+0x20, proving the same horny-toad state domain, not any HeroStateId. Retail 0x002d5188-0x002d5190 returns for state zero. The supplied caller names zero HORNY_TOAD_INITIALIZE and its case initializes scale, home, movement parameters and the next state, so hit processing is skipped during initialization. domain_1_value_12 -> HORNY_TOAD_DYING: horny_toad_update passes its Moby unchanged to FUN_L00_002d5160_2d4610 before switching on moby->state; retail 0x002d516c retains a0 in s2 and all these accesses use byte s2+0x20, proving the same horny-toad state domain, not any HeroStateId. Retail 0x002d5214-0x002d521c compares the state with 12 to skip repeated damage reaction. The caller's HORNY_TOAD_DYING=12 case steps knockback motion, then spawns the death burst and marks the moby for removal. domain_2_value_12 -> HORNY_TOAD_DYING: horny_toad_update passes its Moby unchanged to FUN_L00_002d5160_2d4610 before switching on moby->state; retail 0x002d516c retains a0 in s2 and all these accesses use byte s2+0x20, proving the same horny-toad state domain, not any HeroStateId. Retail 0x002d5320 stores 12 to s2+0x20 after starting knockback and initializing its animation frames, then invokes the killed-moby bookkeeping helper at 0x002d5334. The same caller dispatches state 12 as HORNY_TOAD_DYING, stepping motion before death effects and removal. domain_3_value_3 -> HORNY_TOAD_WAIT_TO_FOLLOW_PATH: horny_toad_update passes its Moby unchanged to FUN_L00_002d5160_2d4610 before switching on moby->state; retail 0x002d516c retains a0 in s2 and all these accesses use byte s2+0x20, proving the same horny-toad state domain, not any HeroStateId. Retail 0x002d5350-0x002d5360 compares state 3 and selects vars+0x1E4 for the 64.0 effect/path query. In the supplied caller, initialization with a path and nonnegative unk1E4 assigns HORNY_TOAD_WAIT_TO_FOLLOW_PATH=3; that case waits until unk1C4 differs from 2 before entering FOLLOW_PATH. domain_4_value_5 -> HORNY_TOAD_ROAM: horny_toad_update passes its Moby unchanged to FUN_L00_002d5160_2d4610 before switching on moby->state; retail 0x002d516c retains a0 in s2 and all these accesses use byte s2+0x20, proving the same horny-toad state domain, not any HeroStateId. Retail 0x002d544c-0x002d5464 tests state 5 before the nonzero timer transition. The caller names this same state HORNY_TOAD_ROAM=5 and executes update_object_wander_movement there, with animation 4 and target-approach transitions. domain_5_value_8 -> HORNY_TOAD_RETURN_HOME: horny_toad_update passes its Moby unchanged to FUN_L00_002d5160_2d4610 before switching on moby->state; retail 0x002d516c retains a0 in s2 and all these accesses use byte s2+0x20, proving the same horny-toad state domain, not any HeroStateId. Retail 0x002d5458-0x002d5464 also admits state 8 for the timer transition. The caller's HORNY_TOAD_RETURN_HOME=8 case moves toward horny_toad_vars->home and enters ROAM on arrival, proving this state name independently of the numeric coincidence with hero state 8. domain_6_value_10 -> HORNY_TOAD_MOVE_TO_POINT_OR_FACE_TARGET: horny_toad_update passes its Moby unchanged to FUN_L00_002d5160_2d4610 before switching on moby->state; retail 0x002d516c retains a0 in s2 and all these accesses use byte s2+0x20, proving the same horny-toad state domain, not any HeroStateId. Retail 0x002d5464-0x002d547c stores 10 to the state byte when states 5/8 have a nonzero vars+0x276 timer. The caller dispatches HORNY_TOAD_MOVE_TO_POINT_OR_FACE_TARGET=10: it tests the segment toward unk180, faces the target when crossing is blocked, otherwise moves toward unk180, and returns home when the timer expires. --- src/overlays/shared/enemies/horny_toad.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/enemies/horny_toad.c b/src/overlays/shared/enemies/horny_toad.c index 9a39e4bd89..dfcae03f8e 100644 --- a/src/overlays/shared/enemies/horny_toad.c +++ b/src/overlays/shared/enemies/horny_toad.c @@ -475,6 +475,14 @@ void process_horny_toad_hit_reaction(unsigned char *toad_moby) { enum { HIT_RESPONSE_NO_HIT = 1 }; + enum { + HORNY_TOAD_INITIALIZE = 0, + HORNY_TOAD_WAIT_TO_FOLLOW_PATH = 3, + HORNY_TOAD_ROAM = 5, + HORNY_TOAD_RETURN_HOME = 8, + HORNY_TOAD_MOVE_TO_POINT_OR_FACE_TARGET = 10, + HORNY_TOAD_DYING = 12 + }; unsigned char *toad_vars = *(unsigned char **)(toad_moby + 0x78); unsigned char *hit; s32 hit_response_status; @@ -487,7 +495,7 @@ void process_horny_toad_hit_reaction(unsigned char *toad_moby) { s32 index; unsigned char *effect; - if (MOBY(toad_moby)->state == 0) + if (MOBY(toad_moby)->state == HORNY_TOAD_INITIALIZE) return; if (D_L00_0015F5C4_2d5160 == 2) { MOBY(toad_moby)->visible = 0; @@ -499,7 +507,7 @@ void process_horny_toad_hit_reaction(unsigned char *toad_moby) { damage = 0.0f; hit = find_moby_hit(toad_moby, 0x330000, 0); hit_reaction(toad_moby, hit, toad_vars + 0x20, 0, &hit_response_status, &damage, 0, 4); - if (hit_response_status != HIT_RESPONSE_NO_HIT && MOBY(toad_moby)->state != 12 && + if (hit_response_status != HIT_RESPONSE_NO_HIT && MOBY(toad_moby)->state != HORNY_TOAD_DYING && damage != 0.0f) { /* Fakematch: register pins give retail's choices: 41 in $t0, the frame time and later 0.75 in $f4, the squared frame time first in $f0. */ @@ -533,14 +541,14 @@ void process_horny_toad_hit_reaction(unsigned char *toad_moby) { reactionC4 = l00_horny_toad_knockback_landing_animation_frame; *(f32 *)(toad_vars + 0xC0) = reactionC0; *(f32 *)(toad_vars + 0xC4) = reactionC4; - MOBY(toad_moby)->state = 12; + MOBY(toad_moby)->state = HORNY_TOAD_DYING; toad_vars[0x67] = 0x78; trooper_anim_update(toad_moby, toad_vars + 0x60); FUN_L00_00257470_2d5160(toad_moby, 0, -1); } MOBY(toad_moby)->hit_slot = 0xFF; trooper_anim_finish(toad_moby, toad_vars + 0x60); - if (MOBY(toad_moby)->state == 3) { + if (MOBY(toad_moby)->state == HORNY_TOAD_WAIT_TO_FOLLOW_PATH) { index = *(s32 *)(toad_vars + 0x1E4); effect = toad_vars + 0x180; activate_effect_l08(64.0f, @@ -572,9 +580,9 @@ void process_horny_toad_hit_reaction(unsigned char *toad_moby) { truncate_float_to_s32(scale_time(FUN_L00_00257be8_2d5160(180.0f, 240.0f))); } *(s32 *)(toad_vars + 0x38) = 0; - if ((MOBY(toad_moby)->state == 5 || MOBY(toad_moby)->state == 8) && + if ((MOBY(toad_moby)->state == HORNY_TOAD_ROAM || MOBY(toad_moby)->state == HORNY_TOAD_RETURN_HOME) && *(s16 *)(toad_vars + 0x276) != 0) { - MOBY(toad_moby)->state = 10; + MOBY(toad_moby)->state = HORNY_TOAD_MOVE_TO_POINT_OR_FACE_TARGET; if (MOBY(toad_moby)->prev_seq != 4) FUN_L00_00257880_2d5160(toad_moby, 4, 0, scale_game_frames(20)); } From fbe532c34065969d1a4f1217911dfb52cc9cfafd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:05:15 +0000 Subject: [PATCH 105/758] decomp: clarify names in taunter_update domain_0_value_2 -> TAUNTER_TYPE_ACTIVATION_DISABLED: Retail 0x002b6f70 loads the incoming taunter object's type byte at +0x53; 0x002b6f74-0x002b6f78 compares it with 2. Only equality executes li v0,3 and sb v0,0x20(s2) at 0x002b6f80-0x002b6f84, unconditionally forcing existing TAUNTER_STATE_ACTIVATION_DISABLED. The state dispatch at 0x002b6fe8 bypasses activation and voice processing for that state. Original Ghidra cVar8 == '\x02' and authoritative C taunter_moby->type == 2 agree. This is a separate type-domain constant named only for its proven activation-disabled behavior, not a reuse of the numeric state or hero enums. --- src/overlays/shared/weapons/taunter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/taunter.c b/src/overlays/shared/weapons/taunter.c index 3c0f101543..c7b548b085 100644 --- a/src/overlays/shared/weapons/taunter.c +++ b/src/overlays/shared/weapons/taunter.c @@ -465,6 +465,9 @@ void taunter_update(Moby *taunter_moby) { enum { TAUNTER_STATE_ACTIVATION_DISABLED = 3 }; + enum { + TAUNTER_TYPE_ACTIVATION_DISABLED = 2 + }; Vars *taunter_vars; s32 taunter_state; s32 voice_slot_index; @@ -482,7 +485,7 @@ void taunter_update(Moby *taunter_moby) { return; if (taunter_vars->radius == 0.0f) taunter_vars->radius = 30.0f; - if (taunter_moby->type == 2) + if (taunter_moby->type == TAUNTER_TYPE_ACTIVATION_DISABLED) taunter_moby->state = TAUNTER_STATE_ACTIVATION_DISABLED; taunter_effect_emission_disabled = 1; if (taunter_moby->state == TAUNTER_STATE_INITIALIZE) { From 8ca28d86e6ed425ca8ba04a101bb3d580e29aa09 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:10:05 +0000 Subject: [PATCH 106/758] decomp: clarify names in apply_hero_ground_material_effects domain_0_value_3 -> GROUND_MATERIAL_SINK_SURFACE_PROBE_THROUGH: Retail 0x00239ff4 loads hero.ground_type into s2; comparison 0x0023a114 and store 0x0023a124 set selector_3. Its consumer 0x0023a374-0x0023a42c checks descending crossing of hero.sink_surface_z. In the supplied same-file update_hero_ground_contact, hero.ground_type comes from collision_hit_material(), and existing GROUND_MATERIAL_SINK_SURFACE_PROBE_THROUGH=3 saves the collision surface to sink_surface_z then probes through from surface minus 0.01 with mask 4. Thus both selectors are the same collision-material domain, not hero state IDs. domain_1_value_11 -> GROUND_MATERIAL_SINK_SURFACE_CONTACT_BYPASS: Retail 0x0023a190-0x0023a1a0 compares the saved s16 ground material against 11 and sets selector_11; 0x0023a444-0x0023a4d8 consumes it for descending crossing of sink_surface_z. The supplied update_hero_ground_contact assigns hero.ground_type=collision_hit_material(); its existing GROUND_MATERIAL_SINK_SURFACE_CONTACT_BYPASS=0xB branch saves the collision surface height to hero.sink_surface_z and jumps to d1, bypassing normal ground contact processing. This proves the same material domain and established behavioral name. --- .../l05/hero/apply_hero_ground_material_effects.c | 8 ++++++-- 1 file changed, 6 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 ed7644f146..77e8dd9fc4 100644 --- a/src/overlays/l05/hero/apply_hero_ground_material_effects.c +++ b/src/overlays/l05/hero/apply_hero_ground_material_effects.c @@ -30,6 +30,10 @@ extern int hero_set_state(int, int) __asm__("FUN_L05_0024cee8"); void apply_hero_ground_material_effects(void) __asm__("FUN_L05_00239fc0"); void apply_hero_ground_material_effects(void) { + enum { + GROUND_MATERIAL_SINK_SURFACE_PROBE_THROUGH = 3, + GROUND_MATERIAL_SINK_SURFACE_CONTACT_BYPASS = 11 + }; u8 save = hero.ground_sound_class; s16 saved_ground_type = hero.ground_type; f32 water_depth; @@ -61,7 +65,7 @@ void apply_hero_ground_material_effects(void) { hero.wading = 1; hero.base_condition = 1; } - if (saved_ground_type == 3) + if (saved_ground_type == GROUND_MATERIAL_SINK_SURFACE_PROBE_THROUGH) hero.selector_3 = 1; if (current_level_index == 13 && hero.state.current != 0x7B && FUN_L00_001f0d60_239fc0( @@ -69,7 +73,7 @@ void apply_hero_ground_material_effects(void) { collision_hit_material() == 11) { goto s7B; } - if (saved_ground_type == 11) + if (saved_ground_type == GROUND_MATERIAL_SINK_SURFACE_CONTACT_BYPASS) hero.selector_11 = 1; if (saved_ground_type == 5) hero.selector_5 = 1; From 923529c4baed3ad4c24583a7d8c56658e6ffdfbf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:12:31 +0000 Subject: [PATCH 107/758] decomp: clarify names in taunter_update domain_0_value_3 -> TAUNTER_TYPE_CONTINUOUS_EFFECT_EMISSION: Retail 0x002b6ff0-0x002b7020 loads the taunter object's type byte at +0x53 and compares with 3 after the active-state gate. Only this type with hero.item_use_locked zero clears taunter_effect_emission_disabled and increments private +0x18 each update, independently of button input or voice status. The supplied update_taunter_effect_slots source confirms that clearing this flag permits recurring effect-slot spawning. Authoritative source SHA-256 91513572e4d68609a7bb8ea32337a289ce3a85b39ae13969242f44b66f94b24d and original Ghidra agree; this is a behavioral type name, not a state ID. domain_1_value_3 -> TAUNTER_TYPE_CONTINUOUS_EFFECT_EMISSION: Retail 0x002b7140-0x002b7164 reloads the same taunter type byte +0x53 and skips the activation sequence-3 blend when equal to 3. This is the identical selector/value proven at 0x002b6ff0-0x002b7020 to enable recurring effect emission each active unlocked update; the authoritative C expresses both as taunter_moby->type. Reuse the same type member rather than any equal-valued state or hero enum. Voice allocation and nearby-moby application still occur after the skipped blend. --- 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 c7b548b085..79dd397146 100644 --- a/src/overlays/shared/weapons/taunter.c +++ b/src/overlays/shared/weapons/taunter.c @@ -468,6 +468,9 @@ void taunter_update(Moby *taunter_moby) { enum { TAUNTER_TYPE_ACTIVATION_DISABLED = 2 }; + enum { + TAUNTER_TYPE_CONTINUOUS_EFFECT_EMISSION = 3 + }; Vars *taunter_vars; s32 taunter_state; s32 voice_slot_index; @@ -503,7 +506,7 @@ void taunter_update(Moby *taunter_moby) { } if ((u8)taunter_state != TAUNTER_STATE_ACTIVE) goto end; - if (taunter_moby->type == 3 && hero.item_use_locked == 0) { + if (taunter_moby->type == TAUNTER_TYPE_CONTINUOUS_EFFECT_EMISSION && hero.item_use_locked == 0) { taunter_effect_emission_disabled = 0; taunter_vars->cnt18++; } else { @@ -526,7 +529,7 @@ void taunter_update(Moby *taunter_moby) { } D_00141680.flags |= 1 << current_level_index; D_00141680.flags |= 0x80000000; - if (taunter_moby->type != 3) + if (taunter_moby->type != TAUNTER_TYPE_CONTINUOUS_EFFECT_EMISSION) blend_moby_animation(taunter_moby, 3, 0, scale_game_frames(3)); taunter_vars->anim = allocate_voice_for_target_entry(taunter_vars->idx, 1, taunter_moby); From 830acee73846feb889fe5464d6a5ad3e96d3bf4d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:14:19 +0000 Subject: [PATCH 108/758] decomp: clarify names in update_seeker_damage_and_target domain_0_value_254 -> MOBY_STATE_REMOVAL_MARKED_AT_OR_ABOVE_ADDRESS_THRESHOLD: Assigned retail 0x002c6734-0x002c6740 tests target Moby+0x20 and rejects 0xFE. Checked seeker_update calls mark_moby_for_removal (0x0026e4f0) at 0x002c6134/0x002c6204 after fatal collision/explosion. That helper compares its incoming Moby address unsigned against the pointer loaded from 0x0015ffdc (0x0026e4f0-0x0026e504), selects 0xFE for addresses at or above the threshold at 0x0026e514, and stores it into the same Moby.state offset +0x20 at 0x0026e518. This proves removal marking and the exact address-branch distinction, without asserting storage class. domain_1_value_253 -> MOBY_STATE_REMOVAL_MARKED_BELOW_ADDRESS_THRESHOLD: Assigned retail 0x002c673c-0x002c6740 rejects target Moby.state 0xFD before position copying. Checked caller seeker_update invokes the established mark_moby_for_removal helper 0x0026e4f0 at 0x002c6134/0x002c6204. Helper 0x0026e500 performs unsigned incoming Moby-address comparison against the pointer loaded from 0x0015ffdc; the below-threshold path selects 0xFD at 0x0026e510 and writes Moby+0x20 at 0x0026e518. This proves the removal-marked state and its below-threshold distinction; allocation class is unknown. --- src/overlays/shared/enemies/seeker.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/seeker.c b/src/overlays/shared/enemies/seeker.c index 2685ff7126..823701aaeb 100644 --- a/src/overlays/shared/enemies/seeker.c +++ b/src/overlays/shared/enemies/seeker.c @@ -440,6 +440,10 @@ void update_seeker_damage_and_target(Moby *moby) { enum { SEEKER_TARGET_STATUS_LOST = 2 }; + enum { + MOBY_STATE_REMOVAL_MARKED_BELOW_ADDRESS_THRESHOLD = 0xFD, + MOBY_STATE_REMOVAL_MARKED_AT_OR_ABOVE_ADDRESS_THRESHOLD = 0xFE + }; char hit_pos[16]; int hit; float damage; @@ -572,7 +576,7 @@ void update_seeker_damage_and_target(Moby *moby) { } } else { Moby *target = seeker_vars->f160; - if (target != 0 && target->state != 0xFE && target->state != 0xFD) { + if (target != 0 && target->state != MOBY_STATE_REMOVAL_MARKED_AT_OR_ABOVE_ADDRESS_THRESHOLD && target->state != MOBY_STATE_REMOVAL_MARKED_BELOW_ADDRESS_THRESHOLD) { qcopy(seeker_vars->target, &target->pos); } else { seeker_vars->f160 = 0; From 1c4463a2a1b10a4eb7376138e92f768d321cedda Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:14:19 +0000 Subject: [PATCH 109/758] decomp: clarify names in sentrybot_alarm_update domain_0_value_6 -> SENTRYBOT_ALARM_STATE_WAIT_FOR_GROUP_RELEASE_TRIGGER: At 002cb528-002cb538 initialization selects 6 for pvars mode 2 and stores it to moby+0x20; case 6 at 002cb838 waits for pvars+8 before group-release start. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_10_value_7 -> SENTRYBOT_ALARM_STATE_GROUP_RELEASE_START_TRANSITION: At 002cb838-002cb850 nonzero pvars+8 in group-release wait stores 7 to moby+0x20 and selects animation 5. Case 7 waits for the animation gate before release-group state 8. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_11_value_8 -> SENTRYBOT_ALARM_STATE_RELEASE_GROUP_MOBYS: At 002cb86c-002cb888 animation flag bit 2 stores 8 to moby+0x20. Its case at 002cb8a4-002cb948 checks hero distance and collision before calling group activation at 002cb934. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_12_value_9 -> SENTRYBOT_ALARM_STATE_GROUP_RELEASE_STOP_TRANSITION: At 002cb94c-002cb984 group-release duration expiry or control cancellation clears pvars+8 and stores 9 to moby+0x20, selecting animation 7. Case 9 gates return to group wait or alarm stop. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_13_value_6 -> SENTRYBOT_ALARM_STATE_WAIT_FOR_GROUP_RELEASE_TRIGGER: At 002cb9b0-002cb9dc group-release stop completion with pvars mode 2 stores 6 to moby+0x20 and selects animation 4. Case 6 waits on pvars+8 for another group release. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_14_value_10 -> SENTRYBOT_ALARM_STATE_ALARM_STOP_TRANSITION: At 002cb9c4-002cba04 the non-mode-2 group-stop branch retains v0=10 and stores it to moby+0x20 while selecting animation 8. Case 10 subsequently enters standby-return transition. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_15_value_2 -> SENTRYBOT_ALARM_STATE_STANDBY_RETURN_TRANSITION: At 002cba2c-002cba48 completion of alarm-stop animation stores 2 to moby+0x20 and selects animation 1. Case 2 at 002cb624-002cb640 gates return to alarm-trigger wait state 3. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_1_value_3 -> SENTRYBOT_ALARM_STATE_WAIT_FOR_ALARM_TRIGGER: At 002cb548-002cb554 initialization stores 3 to moby+0x20 for other modes; case 3 at 002cb65c waits for pvars+8 before starting the alarm transition. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_2_value_6 -> SENTRYBOT_ALARM_STATE_WAIT_FOR_GROUP_RELEASE_TRIGGER: At 002cb5ec-002cb608 standby pulse with pvars mode 1 stores 6 to moby+0x20; case 6 waits for pvars+8 and enters group-release start, matching the existing local member. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_3_value_5 -> SENTRYBOT_ALARM_STATE_ACTIVE_PULSE: The standby pulse else path loads 5 at 002cb5f4 and branches to the state store at 002cb724-002cb728. Case 5 at 002cb770-002cb7c8 pulses glow at twice standby frequency and ticks alarm duration. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_4_value_3 -> SENTRYBOT_ALARM_STATE_WAIT_FOR_ALARM_TRIGGER: At 002cb624-002cb640 animation flag bit 2 gates the state-2 return store of 3 to moby+0x20. Case 3 at 002cb65c waits for alarm pvars+8, matching the existing wait member. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_5_value_4 -> SENTRYBOT_ALARM_STATE_ALARM_START_TRANSITION: At 002cb65c-002cb680 a nonzero alarm trigger and permitted global control mode store 4 to moby+0x20 and select animation 3. Case 4 gates progression to active pulse or group-release start. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_6_value_7 -> SENTRYBOT_ALARM_STATE_GROUP_RELEASE_START_TRANSITION: At 002cb6c0-002cb6dc mode 1 after alarm-start completion stores 7 to moby+0x20 and selects animation 5. Case 7 at 002cb86c gates entry to release-group state 8. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_7_value_5 -> SENTRYBOT_ALARM_STATE_ACTIVE_PULSE: At 002cb6f8-002cb728 the non-group branch of completed alarm start blends animation 8 then stores 5 to moby+0x20. Case 5 implements the timed active glow pulse, using the existing local state member. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_8_value_10 -> SENTRYBOT_ALARM_STATE_ALARM_STOP_TRANSITION: The state-4 cancellation path at 002cb72c-002cb734 jumps to 002cb808, which selects animation 8 and stores 10 at 002cb834 without clearing pvars+8. Case 10 gates the return toward standby. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. domain_9_value_10 -> SENTRYBOT_ALARM_STATE_ALARM_STOP_TRANSITION: At 002cb7cc-002cb834 active-pulse duration expiry or control cancellation clears pvars+8, selects animation 8 and stores 10 to moby+0x20. Existing case 10 transitions toward standby return. Selector domain is the alarm moby's state byte: 002cb4d4 copies a0 to s0, 002cb4e4 reads +0x20 for switch dispatch, and these assignments store to that same +0x20. Reuse the existing function-local state enum, separate from pvars modes and Hero enums. --- src/overlays/shared/enemies/sentrybot_alarm.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot_alarm.c b/src/overlays/shared/enemies/sentrybot_alarm.c index bb1b2ac95d..254535ab92 100644 --- a/src/overlays/shared/enemies/sentrybot_alarm.c +++ b/src/overlays/shared/enemies/sentrybot_alarm.c @@ -124,11 +124,11 @@ void sentrybot_alarm_update(unsigned char *moby) { D_L15_00161AB8 = 0; *(int *)&D_L15_00161ABC_gp = 0; if (mode == SENTRYBOT_ALARM_MODE_GROUP_RELEASE_ONLY) { - MOBY(moby)->state = 6; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_WAIT_FOR_GROUP_RELEASE_TRIGGER; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, 0); } else { - MOBY(moby)->state = 3; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_WAIT_FOR_ALARM_TRIGGER; if (MOBY(moby)->prev_seq != 2) blend_moby_animation(moby, 2, 0, 0); } @@ -144,17 +144,17 @@ void sentrybot_alarm_update(unsigned char *moby) { goto update; if (D_L15_0015F5C4 != 2) { if (alarm_state[0] == 1) { - MOBY(moby)->state = 6; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_WAIT_FOR_GROUP_RELEASE_TRIGGER; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(30)); } else { - MOBY(moby)->state = 5; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_ACTIVE_PULSE; } } break; case SENTRYBOT_ALARM_STATE_STANDBY_RETURN_TRANSITION: if (MOBY(moby)->anim_flags & 2) { - MOBY(moby)->state = 3; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_WAIT_FOR_ALARM_TRIGGER; if (MOBY(moby)->prev_seq != 2) blend_moby_animation(moby, 2, 0, scale_game_frames(10)); } @@ -163,7 +163,7 @@ void sentrybot_alarm_update(unsigned char *moby) { if (alarm_state[2] == 0) goto update; if (D_L15_0015F5C4 != 2) { - MOBY(moby)->state = 4; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_ALARM_START_TRANSITION; if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, scale_game_frames(10)); } @@ -173,20 +173,20 @@ void sentrybot_alarm_update(unsigned char *moby) { if (alarm_state[2] == 0 || D_L15_0015F5C4 == 2) goto stop_animation; if (alarm_state[0] == 1) { - MOBY(moby)->state = 7; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_GROUP_RELEASE_START_TRANSITION; if (MOBY(moby)->prev_seq != 5) blend_moby_animation(moby, 5, 0, scale_game_frames(10)); } else { if (MOBY(moby)->prev_seq != 8) blend_moby_animation(moby, 8, 0, scale_game_frames(10)); - MOBY(moby)->state = 5; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_ACTIVE_PULSE; } } break; stop_animation: if (MOBY(moby)->prev_seq != 8) blend_moby_animation(moby, 8, 0, scale_game_frames(10)); - MOBY(moby)->state = 10; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_ALARM_STOP_TRANSITION; break; case SENTRYBOT_ALARM_STATE_ACTIVE_PULSE: if ((MOBY(moby)->anim_flags & 2) && MOBY(moby)->prev_seq != 0) @@ -202,19 +202,19 @@ void sentrybot_alarm_update(unsigned char *moby) { alarm_state[2] = 0; if (MOBY(moby)->prev_seq != 8) blend_moby_animation(moby, 8, 0, scale_game_frames(10)); - MOBY(moby)->state = 10; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_ALARM_STOP_TRANSITION; } break; case SENTRYBOT_ALARM_STATE_WAIT_FOR_GROUP_RELEASE_TRIGGER: if (alarm_state[2] == 0) goto update; - MOBY(moby)->state = 7; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_GROUP_RELEASE_START_TRANSITION; if (MOBY(moby)->prev_seq != 5) blend_moby_animation(moby, 5, 0, scale_game_frames(10)); break; case SENTRYBOT_ALARM_STATE_GROUP_RELEASE_START_TRANSITION: if (MOBY(moby)->anim_flags & 2) { - MOBY(moby)->state = 8; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_RELEASE_GROUP_MOBYS; if (MOBY(moby)->prev_seq != 6) blend_moby_animation(moby, 6, 0, scale_game_frames(10)); } @@ -233,7 +233,7 @@ void sentrybot_alarm_update(unsigned char *moby) { if (fast_dec_timer(alarm_state + 6) || D_L15_0015F5C4 == 2) { set_sentrybot_alarm_duration((char *)moby, 0); alarm_state[2] = 0; - MOBY(moby)->state = 9; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_GROUP_RELEASE_STOP_TRANSITION; if (MOBY(moby)->prev_seq != 7) blend_moby_animation(moby, 7, 0, scale_game_frames(10)); } @@ -242,11 +242,11 @@ void sentrybot_alarm_update(unsigned char *moby) { case SENTRYBOT_ALARM_STATE_GROUP_RELEASE_STOP_TRANSITION: if (MOBY(moby)->anim_flags & 2) { if (alarm_state[0] == 2) { - MOBY(moby)->state = 6; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_WAIT_FOR_GROUP_RELEASE_TRIGGER; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(10)); } else { - MOBY(moby)->state = 10; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_ALARM_STOP_TRANSITION; if (MOBY(moby)->prev_seq != 8) blend_moby_animation(moby, 8, 0, scale_game_frames(10)); } @@ -254,7 +254,7 @@ void sentrybot_alarm_update(unsigned char *moby) { break; case SENTRYBOT_ALARM_STATE_ALARM_STOP_TRANSITION: if (MOBY(moby)->anim_flags & 2) { - MOBY(moby)->state = 2; + MOBY(moby)->state = SENTRYBOT_ALARM_STATE_STANDBY_RETURN_TRANSITION; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } From af5a5455960fa8e8988b78a8a27e4b29fe2a835c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:16:32 +0000 Subject: [PATCH 110/758] decomp: clarify names in spawner_update domain_0_value_254 -> MOBY_STATE_MARKED_FOR_REMOVAL: Source src/overlays/shared/enemies/spawner.c SHA-256 555b976a15bd90d9ac324dbff181b2065b1757b0f0c0119a2930e273b51c330d already names 0xFE MOBY_STATE_MARKED_FOR_REMOVAL in the population helper's MOBY(slot_moby)->state comparison. Assigned retail 0x0030ac5c loads target_moby, 0x0030acc8 reads its +0x20 state, and 0x0030accc compares 0xFE before clearing the target at 0x0030acf4. Checked direct removal helper 0x0026e4f0, called by assigned initialization and explosion paths, selects 0xFE at 0x0026e514 and writes that same moby +0x20 byte at 0x0026e518 (evidence request 613a0e7b90d24d0f92550124dfd9502a). Thus the selector is a moby lifecycle state, and this existing semantic name applies. --- src/overlays/shared/enemies/spawner.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/spawner.c b/src/overlays/shared/enemies/spawner.c index b93a0369dd..3df15ef117 100644 --- a/src/overlays/shared/enemies/spawner.c +++ b/src/overlays/shared/enemies/spawner.c @@ -150,6 +150,9 @@ void spawner_update(char *moby) __asm__("FUN_L09_0030ab80"); /* Moby class 1885 */ void spawner_update(char *moby) { + enum { + MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE + }; SpawnerVars *spawner_vars = (SpawnerVars *)MOBY(moby)->pvars; float target[4]; float launch_velocity[4]; @@ -193,7 +196,7 @@ void spawner_update(char *moby) { region_count); } else { char *target_moby = *(char **)((char *)spawner_vars + 0x140); - if (target_moby != 0 && (unsigned char)MOBY(target_moby)->state != 0xFE && + if (target_moby != 0 && (unsigned char)MOBY(target_moby)->state != MOBY_STATE_MARKED_FOR_REMOVAL && (unsigned char)MOBY(target_moby)->state != 0xFD) { qcopy((char *)spawner_vars + 0x100, &MOBY(target_moby)->pos); } else { From c9d33059407ae8f917517468f8b3dc514b01793f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:19:25 +0000 Subject: [PATCH 111/758] decomp: clarify names in update_follow_camera_attach_mode domain_10_value_1 -> CAM_ATTACH_HERO_POSITION_BASE: This listed attach_state->state token corresponds to retail 002e4c0c-002e4c10. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. The supplied compute_follow_camera_target_position consumer selects hero_base_position for this canonical attach mode; entry here arms the ground-focus-exit or post-blend transition timer. Reuse the canonical CameraAttachMode member CAM_ATTACH_HERO_POSITION_BASE=1. domain_11_value_2 -> CAM_ATTACH_GROUND_AWARE_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4c0c-002e4c10. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e4b68 arms follow_camera_ground_aware_focus_transition_frames_gp; the supplied focus-velocity consumer handles this same byte with ground-aware targeting. Reuse the canonical CameraAttachMode member CAM_ATTACH_GROUND_AWARE_FOCUS_VELOCITY=2. domain_13_value_7 -> CAM_ATTACH_BLEND_BACK_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4c50-002e4c54. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. The supplied focus-velocity consumer moves mode 6 to canonical blend-back mode 7 and swaps blend vectors; this updater tests that same mode and returns to mode 6 before the hero passes the apex. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_BACK_FOCUS_VELOCITY=7. domain_14_value_6 -> CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4c6c/002e4d00. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e4d00 initializes the blend-out offset, movement timer and blend vectors; the supplied focus-velocity consumer names this same mode as blend-out focus velocity. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY=6. domain_15_value_1 -> CAM_ATTACH_HERO_POSITION_BASE: This listed attach_state->state token corresponds to retail 002e4c80-002e4c88. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. The supplied compute_follow_camera_target_position consumer selects hero_base_position for this canonical attach mode; entry here arms the ground-focus-exit or post-blend transition timer. Reuse the canonical CameraAttachMode member CAM_ATTACH_HERO_POSITION_BASE=1. domain_16_value_4 -> CAM_ATTACH_PROJECT_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4c94-002e4c98. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. The supplied focus-velocity switch handles this byte as project-hero focus; this updater leaves mode 4 when control mode ceases to be 4 at 002e4c94-002e4cd0. Reuse the canonical CameraAttachMode member CAM_ATTACH_PROJECT_HERO_FOCUS_VELOCITY=4. domain_17_value_1 -> CAM_ATTACH_HERO_POSITION_BASE: This listed attach_state->state token corresponds to retail 002e4cb8-002e4cbc. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. The supplied compute_follow_camera_target_position consumer selects hero_base_position for this canonical attach mode; entry here arms the ground-focus-exit or post-blend transition timer. Reuse the canonical CameraAttachMode member CAM_ATTACH_HERO_POSITION_BASE=1. domain_19_value_3 -> CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4cd8-002e4cdc. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e49c0 initializes moveTimer, invMove, projected-hero offset and focus blend vectors; the supplied focus-velocity switch names this same mode as blend-to-project-hero focus. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY=3. domain_1_value_1 -> CAM_ATTACH_HERO_POSITION_BASE: This listed attach_state->state token corresponds to retail 002e4980-002e4988. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. The supplied compute_follow_camera_target_position consumer selects hero_base_position for this canonical attach mode; entry here arms the ground-focus-exit or post-blend transition timer. Reuse the canonical CameraAttachMode member CAM_ATTACH_HERO_POSITION_BASE=1. domain_20_value_6 -> CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4cf8-002e4d00. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e4d00 initializes the blend-out offset, movement timer and blend vectors; the supplied focus-velocity consumer names this same mode as blend-out focus velocity. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY=6. domain_21_value_5 -> CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION: This listed attach_state->state token corresponds to retail 002e4d78-002e4d7c. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e4ad4 initializes the hold-focus blend timer and offset; 002e4d78-002e4da8 transitions mode 5 to hold mode 8 with its hold-focus transition timer. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION=5. domain_22_value_8 -> CAM_ATTACH_HOLD_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4d98-002e4da0. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. 002e4a54 and 002e4da0 enter mode 8 with the hold-focus transition timer; the supplied focus-velocity consumer holds attach+0x10 for this same named mode. Reuse the canonical CameraAttachMode member CAM_ATTACH_HOLD_FOCUS_VELOCITY=8. domain_23_value_8 -> CAM_ATTACH_HOLD_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4dac-002e4db0. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. 002e4a54 and 002e4da0 enter mode 8 with the hold-focus transition timer; the supplied focus-velocity consumer holds attach+0x10 for this same named mode. Reuse the canonical CameraAttachMode member CAM_ATTACH_HOLD_FOCUS_VELOCITY=8. domain_25_value_6 -> CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4dd0-002e4dd4. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e4d00 initializes the blend-out offset, movement timer and blend vectors; the supplied focus-velocity consumer names this same mode as blend-out focus velocity. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY=6. domain_27_value_3 -> CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4e00-002e4e04. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e49c0 initializes moveTimer, invMove, projected-hero offset and focus blend vectors; the supplied focus-velocity switch names this same mode as blend-to-project-hero focus. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY=3. domain_28_value_5 -> CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION: This listed attach_state->state token corresponds to retail 002e4e08-002e4e0c. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e4ad4 initializes the hold-focus blend timer and offset; 002e4d78-002e4da8 transitions mode 5 to hold mode 8 with its hold-focus transition timer. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION=5. domain_2_value_3 -> CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e49b8-002e49c0. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e49c0 initializes moveTimer, invMove, projected-hero offset and focus blend vectors; the supplied focus-velocity switch names this same mode as blend-to-project-hero focus. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY=3. domain_30_value_9 -> CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4e38-002e4e3c. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. 002e4b9c enters mode 9, initializing the projected-focus offset and blend vectors; the supplied focus-velocity consumer names the same byte as blend-projected-hero focus velocity. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY=9. domain_31_value_10 -> CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4e78-002e4e7c. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. 002e4f34 transitions mode 9 to 10 when secondary mode leaves 0x14, arms the continue-projected-focus timer, and 002e4f50-002e4f68 exits on movement-timer completion; the supplied consumer names the same mode. Reuse the canonical CameraAttachMode member CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY=10. domain_32_value_1 -> CAM_ATTACH_HERO_POSITION_BASE: This listed attach_state->state token corresponds to retail 002e4eb8-002e4ebc. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. The supplied compute_follow_camera_target_position consumer selects hero_base_position for this canonical attach mode; entry here arms the ground-focus-exit or post-blend transition timer. Reuse the canonical CameraAttachMode member CAM_ATTACH_HERO_POSITION_BASE=1. domain_33_value_9 -> CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4f10-002e4f14. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. 002e4b9c enters mode 9, initializing the projected-focus offset and blend vectors; the supplied focus-velocity consumer names the same byte as blend-projected-hero focus velocity. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY=9. domain_34_value_10 -> CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4f2c-002e4f34. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. 002e4f34 transitions mode 9 to 10 when secondary mode leaves 0x14, arms the continue-projected-focus timer, and 002e4f50-002e4f68 exits on movement-timer completion; the supplied consumer names the same mode. Reuse the canonical CameraAttachMode member CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY=10. domain_35_value_10 -> CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4f44-002e4f48. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. 002e4f34 transitions mode 9 to 10 when secondary mode leaves 0x14, arms the continue-projected-focus timer, and 002e4f50-002e4f68 exits on movement-timer completion; the supplied consumer names the same mode. Reuse the canonical CameraAttachMode member CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY=10. domain_37_value_5 -> CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION: This listed attach_state->state token corresponds to retail 002e4f74-002e4f78. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e4ad4 initializes the hold-focus blend timer and offset; 002e4d78-002e4da8 transitions mode 5 to hold mode 8 with its hold-focus transition timer. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION=5. domain_3_value_8 -> CAM_ATTACH_HOLD_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4a4c-002e4a54. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. 002e4a54 and 002e4da0 enter mode 8 with the hold-focus transition timer; the supplied focus-velocity consumer holds attach+0x10 for this same named mode. Reuse the canonical CameraAttachMode member CAM_ATTACH_HOLD_FOCUS_VELOCITY=8. domain_4_value_6 -> CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4a90-002e4a98. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e4d00 initializes the blend-out offset, movement timer and blend vectors; the supplied focus-velocity consumer names this same mode as blend-out focus velocity. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY=6. domain_5_value_5 -> CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION: This listed attach_state->state token corresponds to retail 002e4acc-002e4ad4. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e4ad4 initializes the hold-focus blend timer and offset; 002e4d78-002e4da8 transitions mode 5 to hold mode 8 with its hold-focus transition timer. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION=5. domain_6_value_2 -> CAM_ATTACH_GROUND_AWARE_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4b60-002e4b68. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. Entry at 002e4b68 arms follow_camera_ground_aware_focus_transition_frames_gp; the supplied focus-velocity consumer handles this same byte with ground-aware targeting. Reuse the canonical CameraAttachMode member CAM_ATTACH_GROUND_AWARE_FOCUS_VELOCITY=2. domain_7_value_9 -> CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4960/002e4b78. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. 002e4b9c enters mode 9, initializing the projected-focus offset and blend vectors; the supplied focus-velocity consumer names the same byte as blend-projected-hero focus velocity. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY=9. domain_8_value_1 -> CAM_ATTACH_HERO_POSITION_BASE: This listed attach_state->state token corresponds to retail 002e4b7c-002e4b80. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. The supplied compute_follow_camera_target_position consumer selects hero_base_position for this canonical attach mode; entry here arms the ground-focus-exit or post-blend transition timer. Reuse the canonical CameraAttachMode member CAM_ATTACH_HERO_POSITION_BASE=1. domain_9_value_9 -> CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY: This listed attach_state->state token corresponds to retail 002e4b98-002e4b9c. Retail 002e494c loads camera+0x70 and 002e4950 forms attach=camera_state+0x40; state accesses at attach+0xc4 are therefore saved camera state+0x104. The supplied compute_follow_camera_focus_velocity switch reads precisely this camera+0x70, +0x40, +0xc4 byte using CameraAttachMode members from include/rnc/camera/camera_modes.h, proving shared domain rather than numeric equivalence. 002e4b9c enters mode 9, initializing the projected-focus offset and blend vectors; the supplied focus-velocity consumer names the same byte as blend-projected-hero focus velocity. Reuse the canonical CameraAttachMode member CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY=9. --- .../shared/camera/follow_camera_springs.c | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_springs.c b/src/overlays/shared/camera/follow_camera_springs.c index a387483600..4e4730c165 100644 --- a/src/overlays/shared/camera/follow_camera_springs.c +++ b/src/overlays/shared/camera/follow_camera_springs.c @@ -843,14 +843,14 @@ void update_follow_camera_attach_mode(char *camera) { struct Hero *player = &hero; if (player->state.control_mode == 2) { attach_state->prev = attach_state->state; - attach_state->state = 1; + attach_state->state = CAM_ATTACH_HERO_POSITION_BASE; attach_state->timer = l00_follow_camera_ground_focus_exit_transition_frames_gp; attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); } else { struct Hero *current_player = &hero; if (current_player->state.current == 0xF && D_L00_00166EEC == 0.0f) { attach_state->prev = attach_state->state; - attach_state->state = 3; + attach_state->state = CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY; attach_state->moveTimer = scale_game_frames( *(int *)&follow_camera_project_hero_focus_blend_base_frames_gp); attach_state->invMove = 1.0f / convert_integer_to_float(attach_state->moveTimer); @@ -866,14 +866,14 @@ void update_follow_camera_attach_mode(char *camera) { struct Hero *state_check_player = &hero; if (state_check_player->state.current == 0xC && D_L00_00166EEC == 0.0f) { attach_state->prev = attach_state->state; - attach_state->state = 8; + attach_state->state = CAM_ATTACH_HOLD_FOCUS_VELOCITY; attach_state->timer = follow_camera_hold_focus_transition_frames_gp; attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); } else { struct Hero *hero_state_player = &hero; if (hero_state_player->state.current == 0xB && D_L00_00166EEC == 0.0f) { attach_state->prev = attach_state->state; - attach_state->state = 6; + attach_state->state = CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY; attach_state->moveTimer = scale_game_frames(*(int *)&D_L00_00161D40_gp); attach_state->invMove = 1.0f / convert_integer_to_float(attach_state->moveTimer); @@ -891,7 +891,7 @@ void update_follow_camera_attach_mode(char *camera) { state_transition_player->state.current == 0xE) && D_L00_00166EEC == 0.0f) { attach_state->prev = attach_state->state; - attach_state->state = 5; + attach_state->state = CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION; attach_state->moveTimer = scale_game_frames( *(int *)&follow_camera_hold_focus_blend_base_frames_gp); attach_state->invMove = @@ -910,7 +910,7 @@ void update_follow_camera_attach_mode(char *camera) { if (control_mode_player->state.control_mode == 4 && D_L00_00166EEC == 0.0f) { attach_state->prev = attach_state->state; - attach_state->state = 2; + attach_state->state = CAM_ATTACH_GROUND_AWARE_FOCUS_VELOCITY; attach_state->timer = follow_camera_ground_aware_focus_transition_frames_gp; attach_state->invTimer = @@ -923,10 +923,10 @@ void update_follow_camera_attach_mode(char *camera) { } return; } - if (attach_state->state != 9 && attach_state->state != 1 && camera_secondary_mode_lui == 0x14) { + if (attach_state->state != CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY && attach_state->state != CAM_ATTACH_HERO_POSITION_BASE && camera_secondary_mode_lui == 0x14) { float r; attach_state->prev = attach_state->state; - attach_state->state = 9; + attach_state->state = CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY; attach_state->moveTimer = scale_game_frames(*(int *)&D_L00_00161D6C_gp); r = 1.0f / convert_integer_to_float(attach_state->moveTimer); y = *(float *)&follow_camera_projected_focus_blend_offset_gp; @@ -940,18 +940,18 @@ void update_follow_camera_attach_mode(char *camera) { qcopy(attach_state->v20, attach_state->v10); return; } - if ((attach_state->state == 1 || attach_state->state == 2) && D_001413DC != 4 && + if ((attach_state->state == CAM_ATTACH_HERO_POSITION_BASE || attach_state->state == CAM_ATTACH_GROUND_AWARE_FOCUS_VELOCITY) && D_001413DC != 4 && D_001413DC != 2) { attach_state->timer = 0; attach_state->invTimer = 1.0f; attach_state->state = 0; return; } - if (attach_state->state == 7) { + if (attach_state->state == CAM_ATTACH_BLEND_BACK_FOCUS_VELOCITY) { struct Hero *p = &hero; if (p->past_jump_apex == 0) { attach_state->prev = attach_state->state; - attach_state->state = 6; + attach_state->state = CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY; attach_state->moveTimer = scale_game_frames(*(int *)&D_L00_00161D40_gp); attach_state->invMove = 1.0f / convert_integer_to_float(attach_state->moveTimer); attach_state->timer = follow_camera_focus_blend_transition_frames_gp; @@ -966,17 +966,17 @@ void update_follow_camera_attach_mode(char *camera) { } if (p->state.control_mode == 2) { attach_state->prev = attach_state->state; - attach_state->state = 1; + attach_state->state = CAM_ATTACH_HERO_POSITION_BASE; attach_state->timer = scale_game_frames(*(int *)&l00_follow_camera_post_blend_focus_transition_frames_gp); attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } } - if (attach_state->state == 4 && D_001413DC != 4) { + if (attach_state->state == CAM_ATTACH_PROJECT_HERO_FOCUS_VELOCITY && D_001413DC != 4) { if (D_001413DC == 2) { attach_state->prev = 4; - attach_state->state = 1; + attach_state->state = CAM_ATTACH_HERO_POSITION_BASE; attach_state->timer = scale_game_frames(*(int *)&l00_follow_camera_post_blend_focus_transition_frames_gp); attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); @@ -989,9 +989,9 @@ void update_follow_camera_attach_mode(char *camera) { } return; } - if (attach_state->state == 3 && camera_secondary_mode_lui == 0xB) { + if (attach_state->state == CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY && camera_secondary_mode_lui == 0xB) { attach_state->prev = attach_state->state; - attach_state->state = 6; + attach_state->state = CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY; attach_state->moveTimer = scale_game_frames(*(int *)&D_L00_00161D40_gp); attach_state->invMove = 1.0f / convert_integer_to_float(attach_state->moveTimer); attach_state->timer = follow_camera_focus_blend_transition_frames_gp; @@ -1004,14 +1004,14 @@ void update_follow_camera_attach_mode(char *camera) { qcopy(attach_state->v20, attach_state->v10); return; } - if (attach_state->state == 5 && camera_secondary_mode_lui == 0xC) { + if (attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION && camera_secondary_mode_lui == 0xC) { attach_state->prev = attach_state->state; - attach_state->state = 8; + attach_state->state = CAM_ATTACH_HOLD_FOCUS_VELOCITY; attach_state->timer = follow_camera_hold_focus_transition_frames_gp; attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } - if (attach_state->state == 8 && camera_secondary_mode_lui != 0xC) { + if (attach_state->state == CAM_ATTACH_HOLD_FOCUS_VELOCITY && camera_secondary_mode_lui != 0xC) { attach_state->prev = attach_state->state; attach_state->state = 0; attach_state->timer = @@ -1019,7 +1019,7 @@ void update_follow_camera_attach_mode(char *camera) { attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } - if (attach_state->state == 6 && camera_secondary_mode_lui != 0xB) { + if (attach_state->state == CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY && camera_secondary_mode_lui != 0xB) { attach_state->prev = attach_state->state; attach_state->state = 0; attach_state->timer = @@ -1027,7 +1027,7 @@ void update_follow_camera_attach_mode(char *camera) { attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } - if ((attach_state->state == 3 || attach_state->state == 5) && D_001413DC != 4) { + if ((attach_state->state == CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY || attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION) && D_001413DC != 4) { attach_state->prev = attach_state->state; attach_state->state = 0; attach_state->timer = @@ -1035,19 +1035,19 @@ void update_follow_camera_attach_mode(char *camera) { attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } - if (attach_state->state == 9) { + if (attach_state->state == CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY) { struct Hero *p = &hero; if (p->state.control_mode == 2 || p->frames_off_ground.s >= scale_game_frames(0x37)) { goto to_one; } } - if (attach_state->state == 0xA) { + if (attach_state->state == CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY) { struct Hero *p = &hero; if (p->state.control_mode == 2 || p->frames_off_ground.s >= scale_game_frames(0x37)) { float r; to_one: attach_state->prev = attach_state->state; - attach_state->state = 1; + attach_state->state = CAM_ATTACH_HERO_POSITION_BASE; attach_state->timer = scale_game_frames(*(int *)&l00_follow_camera_post_blend_focus_transition_frames_gp); r = 1.0f / convert_integer_to_float(attach_state->timer); @@ -1059,14 +1059,14 @@ void update_follow_camera_attach_mode(char *camera) { return; } } - if (attach_state->state == 9 && camera_secondary_mode_lui != 0x14) { + if (attach_state->state == CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY && camera_secondary_mode_lui != 0x14) { attach_state->prev = attach_state->state; - attach_state->state = 0xA; + attach_state->state = CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY; attach_state->timer = follow_camera_continue_projected_focus_transition_frames_gp; attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } - if (attach_state->state == 0xA && FUN_001f9770_c2(&attach_state->moveTimer)) { + if (attach_state->state == CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY && FUN_001f9770_c2(&attach_state->moveTimer)) { attach_state->prev = attach_state->state; attach_state->state = 0; attach_state->timer = @@ -1074,7 +1074,7 @@ void update_follow_camera_attach_mode(char *camera) { attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } - if (attach_state->state == 5 && camera_secondary_mode_lui == 0x10) { + if (attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION && camera_secondary_mode_lui == 0x10) { attach_state->prev = attach_state->state; attach_state->state = 0; attach_state->timer = From 60c821e56704526585f70058e6147de2ad85c0e9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:25:22 +0000 Subject: [PATCH 112/758] decomp: clarify names in update_follow_camera_attach_mode domain_0_value_0 -> CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY: The selector is CameraAttachMode: retail 002e494c loads camera+0x70, 002e4950 forms attach+0x40, and +0xc4 is saved-state +0x104. Supplied compute_follow_camera_focus_velocity and bounded retail sibling 002e4fe8 read that same byte; mode zero takes the default projection path at 002e555c-002e5588, dotting hero position with camera up, scaling that axis to output and subtracting output from hero position into the attach base. Thus zero is the default projected-hero-focus mode, separate from hero/control/activation enum zeros. 002e4954-002e495c tests the loaded mode against zero before selecting specialized modes 1/2/3/5/6/8. domain_1_value_0 -> CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY: The selector is CameraAttachMode: retail 002e494c loads camera+0x70, 002e4950 forms attach+0x40, and +0xc4 is saved-state +0x104. Supplied compute_follow_camera_focus_velocity and bounded retail sibling 002e4fe8 read that same byte; mode zero takes the default projection path at 002e555c-002e5588, dotting hero position with camera up, scaling that axis to output and subtracting output from hero position into the attach base. Thus zero is the default projected-hero-focus mode, separate from hero/control/activation enum zeros. 002e4c3c stores zero when modes 1/2 lose control modes 4 and 2; 002e4c40/002e4c48 reset reciprocal and timer. domain_2_value_0 -> CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY: The selector is CameraAttachMode: retail 002e494c loads camera+0x70, 002e4950 forms attach+0x40, and +0xc4 is saved-state +0x104. Supplied compute_follow_camera_focus_velocity and bounded retail sibling 002e4fe8 read that same byte; mode zero takes the default projection path at 002e555c-002e5588, dotting hero position with camera up, scaling that axis to output and subtracting output from hero position into the attach base. Thus zero is the default projected-hero-focus mode, separate from hero/control/activation enum zeros. 002e4cc8 stores zero when mode 4 loses control mode 4 and control mode is not 2; post-blend transition timer follows. domain_3_value_0 -> CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY: The selector is CameraAttachMode: retail 002e494c loads camera+0x70, 002e4950 forms attach+0x40, and +0xc4 is saved-state +0x104. Supplied compute_follow_camera_focus_velocity and bounded retail sibling 002e4fe8 read that same byte; mode zero takes the default projection path at 002e555c-002e5588, dotting hero position with camera up, scaling that axis to output and subtracting output from hero position into the attach base. Thus zero is the default projected-hero-focus mode, separate from hero/control/activation enum zeros. Mode 8 leaving secondary state 0xc branches at 002e4dc4 to the zero store at 002e4f98 with hold-exit timing. domain_4_value_0 -> CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY: The selector is CameraAttachMode: retail 002e494c loads camera+0x70, 002e4950 forms attach+0x40, and +0xc4 is saved-state +0x104. Supplied compute_follow_camera_focus_velocity and bounded retail sibling 002e4fe8 read that same byte; mode zero takes the default projection path at 002e555c-002e5588, dotting hero position with camera up, scaling that axis to output and subtracting output from hero position into the attach base. Thus zero is the default projected-hero-focus mode, separate from hero/control/activation enum zeros. 002e4df0 saves previous mode 6 and 002e4df4 stores zero when secondary state leaves 0xb, then arms post-blend timing. domain_5_value_0 -> CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY: The selector is CameraAttachMode: retail 002e494c loads camera+0x70, 002e4950 forms attach+0x40, and +0xc4 is saved-state +0x104. Supplied compute_follow_camera_focus_velocity and bounded retail sibling 002e4fe8 read that same byte; mode zero takes the default projection path at 002e555c-002e5588, dotting hero position with camera up, scaling that axis to output and subtracting output from hero position into the attach base. Thus zero is the default projected-hero-focus mode, separate from hero/control/activation enum zeros. 002e4e28-002e4e2c saves previous mode 3 or 5 and stores zero when control mode is no longer 4. domain_6_value_0 -> CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY: The selector is CameraAttachMode: retail 002e494c loads camera+0x70, 002e4950 forms attach+0x40, and +0xc4 is saved-state +0x104. Supplied compute_follow_camera_focus_velocity and bounded retail sibling 002e4fe8 read that same byte; mode zero takes the default projection path at 002e555c-002e5588, dotting hero position with camera up, scaling that axis to output and subtracting output from hero position into the attach base. Thus zero is the default projected-hero-focus mode, separate from hero/control/activation enum zeros. 002e4f50 tests moveTimer completion in mode 10; 002e4f64 stores zero and 002e4f68 saves the previous mode. domain_7_value_0 -> CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY: The selector is CameraAttachMode: retail 002e494c loads camera+0x70, 002e4950 forms attach+0x40, and +0xc4 is saved-state +0x104. Supplied compute_follow_camera_focus_velocity and bounded retail sibling 002e4fe8 read that same byte; mode zero takes the default projection path at 002e555c-002e5588, dotting hero position with camera up, scaling that axis to output and subtracting output from hero position into the attach base. Thus zero is the default projected-hero-focus mode, separate from hero/control/activation enum zeros. Mode 5 with secondary state 0x10 reaches 002e4f94-002e4f98, saving previous mode and storing zero with hold-exit timing. --- .../shared/camera/follow_camera_springs.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_springs.c b/src/overlays/shared/camera/follow_camera_springs.c index 4e4730c165..42b416f293 100644 --- a/src/overlays/shared/camera/follow_camera_springs.c +++ b/src/overlays/shared/camera/follow_camera_springs.c @@ -833,13 +833,16 @@ void compute_follow_camera_offset_target_up_projection(void *out_target_up_proje void update_follow_camera_attach_mode(char *camera) __asm__("FUN_L00_002e4930"); void update_follow_camera_attach_mode(char *camera) { + enum { + CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY = 0 + }; char *camera_state = *(char **)(camera + 0x70); CamAttach *attach_state = (CamAttach *)(camera_state + 0x40); char *timer_camera_state; float inv, x, y; int camera_timer_base_frames; - if (attach_state->state == 0) { + if (attach_state->state == CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY) { struct Hero *player = &hero; if (player->state.control_mode == 2) { attach_state->prev = attach_state->state; @@ -944,7 +947,7 @@ void update_follow_camera_attach_mode(char *camera) { D_001413DC != 2) { attach_state->timer = 0; attach_state->invTimer = 1.0f; - attach_state->state = 0; + attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; return; } if (attach_state->state == CAM_ATTACH_BLEND_BACK_FOCUS_VELOCITY) { @@ -982,7 +985,7 @@ void update_follow_camera_attach_mode(char *camera) { attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); } else { attach_state->prev = 4; - attach_state->state = 0; + attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; attach_state->timer = scale_game_frames(*(int *)&l00_follow_camera_post_blend_focus_transition_frames_gp); attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); @@ -1013,7 +1016,7 @@ void update_follow_camera_attach_mode(char *camera) { } if (attach_state->state == CAM_ATTACH_HOLD_FOCUS_VELOCITY && camera_secondary_mode_lui != 0xC) { attach_state->prev = attach_state->state; - attach_state->state = 0; + attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; attach_state->timer = scale_game_frames(*(int *)&follow_camera_hold_focus_exit_base_frames_gp); attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); @@ -1021,7 +1024,7 @@ void update_follow_camera_attach_mode(char *camera) { } if (attach_state->state == CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY && camera_secondary_mode_lui != 0xB) { attach_state->prev = attach_state->state; - attach_state->state = 0; + attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; attach_state->timer = scale_game_frames(*(int *)&l00_follow_camera_post_blend_focus_transition_frames_gp); attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); @@ -1029,7 +1032,7 @@ void update_follow_camera_attach_mode(char *camera) { } if ((attach_state->state == CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY || attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION) && D_001413DC != 4) { attach_state->prev = attach_state->state; - attach_state->state = 0; + attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; attach_state->timer = scale_game_frames(*(int *)&l00_follow_camera_post_blend_focus_transition_frames_gp); attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); @@ -1068,7 +1071,7 @@ void update_follow_camera_attach_mode(char *camera) { } if (attach_state->state == CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY && FUN_001f9770_c2(&attach_state->moveTimer)) { attach_state->prev = attach_state->state; - attach_state->state = 0; + attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; attach_state->timer = scale_game_frames(*(int *)&l00_follow_camera_post_blend_focus_transition_frames_gp); attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); @@ -1076,7 +1079,7 @@ void update_follow_camera_attach_mode(char *camera) { } if (attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION && camera_secondary_mode_lui == 0x10) { attach_state->prev = attach_state->state; - attach_state->state = 0; + attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; attach_state->timer = scale_game_frames(*(int *)&follow_camera_hold_focus_exit_base_frames_gp); attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); From 031114bd20f3ab1ffef31c5a14af709ad3673b1d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:27:57 +0000 Subject: [PATCH 113/758] decomp: clarify names in update_hero_ground_contact domain_0_value_1 -> GROUND_MATERIAL_STATE_DEPENDENT_CONTACT_BYPASS: Retail 0x002403e0-0x002403f0 stores collision_hit_material() into hero+0x12E0, proving hero.ground_type is a material selector. At 0x0024052c-0x0024054c the same field is loaded and compared with 1 in s2. 0x00240554-0x00240560 loads hero.state.current at +0x2084, subtracts 0x7C, and unsigned-tests below 2. Only for these two states does this material branch to 0x00240774, bypassing the hit-moby, ground-contact and grounded-counter processing at 0x0024056c-0x0024076c. Original Ghidra expresses the same conjunction and jump to LAB_00240774. Authoritative source SHA-256 e9526690ce208d09e6070fdf01f664ed7b5f3bbf2b50cc3ecb244395d8a94f02 likewise has hero.ground_type == 1 && (u32)(hero.state.current - 0x7C) < 2 followed by goto d1. This proves a state-dependent contact bypass without claiming the substance or state lifecycle. --- 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 77e8dd9fc4..6651ba8495 100644 --- a/src/overlays/l05/hero/apply_hero_ground_material_effects.c +++ b/src/overlays/l05/hero/apply_hero_ground_material_effects.c @@ -176,6 +176,9 @@ void update_hero_ground_contact(void) { GROUND_MATERIAL_SINK_SURFACE_PROBE_THROUGH = 3, GROUND_MATERIAL_SINK_SURFACE_CONTACT_BYPASS = 0xB }; + enum { + GROUND_MATERIAL_STATE_DEPENDENT_CONTACT_BYPASS = 1 + }; V shared_probe_endpoint, ground_probe_endpoint, ground_vector_scratch, side_probe_endpoint, unused_probe_vector, hit_normal_angles, normalized_hit_normal; f32 f; @@ -255,7 +258,7 @@ void update_hero_ground_contact(void) { hero.sink_surface_z = D_L05_00174268; goto d1; } - if (hero.ground_type == 1 && (u32)(hero.state.current - 0x7C) < 2) { + if (hero.ground_type == GROUND_MATERIAL_STATE_DEPENDENT_CONTACT_BYPASS && (u32)(hero.state.current - 0x7C) < 2) { goto d1; } if (HH.moby != 0) { From 47e2b95eea2b272ef06cc6a0420477ef0b481300 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:37:59 +0000 Subject: [PATCH 114/758] decomp: clarify names in gunship_update domain_0_value_0 -> PATH_CURSOR_STATE_NEEDS_POSITION_SETUP: Retail 002f5200 binds s2 to pvars+0x60 (PathCursor), and 002f5634..002f5638 tests its byte +5 against zero. Checked initialize_path_descriptor helper 0028b434 clears this exact byte. The zero branch 002f5640..002f56d8 selects a node when necessary and calculates moby-to-node distance and heading before changing the byte at 002f56e4. Thus zero marks pending cursor position setup, independently of moby state. domain_1_value_2 -> PATH_CURSOR_STATE_POSITION_SETUP_COMPLETE: Retail 002f56a4..002f56b4 stores moby-to-selected-node distance at cursor+0x0c, and 002f56c0..002f56e0 computes/stores heading at cursor+0x18. Then 002f56dc loads two and 002f56e4 stores it to cursor+5, clearing cursor+8 and +0x1c at 002f56e8..002f56ec. Original decompilation and SHA-bound C agree: this marks completion of the position-setup block guarded by cursor state zero, not GUNSHIP_PATH_STATE_WAIT_FOR_PATH. --- src/overlays/shared/vehicles/gunship.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/vehicles/gunship.c b/src/overlays/shared/vehicles/gunship.c index ecef6e1262..d2970fca80 100644 --- a/src/overlays/shared/vehicles/gunship.c +++ b/src/overlays/shared/vehicles/gunship.c @@ -200,6 +200,10 @@ void gunship_update(struct Moby *moby) { GUNSHIP_PATH_STATE_WAIT_FOR_PATH = 2, GUNSHIP_PATH_STATE_WAIT_FOR_RESUME_TIMER = 3 }; + enum { + PATH_CURSOR_STATE_NEEDS_POSITION_SETUP = 0, + PATH_CURSOR_STATE_POSITION_SETUP_COMPLETE = 2 + }; QVec path_displacement; QVec zero; QVec previous_rotation; @@ -307,7 +311,7 @@ void gunship_update(struct Moby *moby) { } v->unk121 = (moby - (struct Moby *)D_L01_0015FFD8) / 2 % 7; initialize_path_descriptor(path_cursor); - if (path_cursor->state == 0) { + if (path_cursor->state == PATH_CURSOR_STATE_NEEDS_POSITION_SETUP) { if (path_cursor->idx <= 0) { s32 selected_node_index = select_point_index_by_distance(&moby->pos, path_cursor->nodes, 0.0f); @@ -322,7 +326,7 @@ void gunship_update(struct Moby *moby) { path_cursor->heading = fast_arc_tan(path_cursor->nodes->node[path_cursor->idx].v.x - moby->pos.x, path_cursor->nodes->node[path_cursor->idx].v.y - moby->pos.y); - path_cursor->state = 2; + path_cursor->state = PATH_CURSOR_STATE_POSITION_SETUP_COMPLETE; path_cursor->unk8 = 0; path_cursor->unk1C = 0; } From 68770f7c2f96daf28c297f35fe78c9d2a85303aa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:40:53 +0000 Subject: [PATCH 115/758] decomp: clarify names in alien_snapper_update domain_0_value_15 -> ALIEN_SNAPPER_STATE_FACE_HERO: 0x002f7f74-0x002f7f84 initializes state 15 when pvars+0x1CC is set; its existing case turns toward hero position at 0x002f8e10-0x002f8e84. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_10_value_7 -> ALIEN_SNAPPER_STATE_WAIT_TO_APPROACH: 0x002f83c0-0x002f83f4 selects state 7 and a random timer; case 7 at 0x002f86a4 decrements that timer before entering approach. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_11_value_9 -> ALIEN_SNAPPER_STATE_REPOSITION_AROUND_TARGET: 0x002f83f8-0x002f8410 selects state 9 when pvars+0x1AC is active; case 9 constructs the target gap-angle goal and checks proximity to a path point. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_12_value_12 -> ALIEN_SNAPPER_STATE_RETURN_HOME: 0x002f85e8-0x002f85f0 branches to 0x002f88f8 when pvars+0x1AC expires, storing state 12; case 12 moves toward saved home at pvars+0x170. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_13_value_10 -> ALIEN_SNAPPER_STATE_WAIT_FOR_REPOSITION_ANIMATION: 0x002f85f4-0x002f8620 selects state 10 when the path point is near and requests animation 5; case 10 waits for completion bit 2 then resumes repositioning. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_14_value_11 -> ALIEN_SNAPPER_STATE_BITE_TARGET: 0x002f8624-0x002f8668 selects state 11 inside target bite radius and requests animation 4; case 11 faces target and issues the animation-window bite query. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_15_value_9 -> ALIEN_SNAPPER_STATE_REPOSITION_AROUND_TARGET: 0x002f866c-0x002f8688 selects state 9 after reposition animation completion; case 9 moves to its target-relative gap-angle goal and probes the path point. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_16_value_8 -> ALIEN_SNAPPER_STATE_APPROACH_TARGET: 0x002f86a4-0x002f86d4 selects state 8 after approach timer expiry and randomizes angle jitter; case 8 moves toward a target-relative goal. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_17_value_12 -> ALIEN_SNAPPER_STATE_RETURN_HOME: 0x002f88c4-0x002f88fc selects state 12 after exceeding home distance or pvars+0x164 becoming 2; case 12 steers and moves toward pvars+0x170 home. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_18_value_11 -> ALIEN_SNAPPER_STATE_BITE_TARGET: 0x002f8900-0x002f8964 selects state 11 after bite-radius, vertical-gap and hero timer checks; case 11 issues the target bite query during animation time 1..8. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_19_value_8 -> ALIEN_SNAPPER_STATE_APPROACH_TARGET: 0x002f8ab8-0x002f8ad0 selects state 8 when target bite animation completes; case 8 approaches the target while controlling speed by bite radius. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_1_value_3 -> ALIEN_SNAPPER_STATE_WAIT_FOR_CLIP_TRIGGER: 0x002f7fa4-0x002f7fb4 selects state 3 for a nonnegative clip_volume; its existing case tests hero inclusion in that clip at 0x002f81b8-0x002f81d0. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_20_value_11 -> ALIEN_SNAPPER_STATE_BITE_TARGET: 0x002f8c18-0x002f8c50 selects state 11 when retreat timer expires or retreat distance is exceeded; it sets bite speed and animation 4 for the existing bite case. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_21_value_6 -> ALIEN_SNAPPER_STATE_FACE_GOAL_AND_WAIT: 0x002f8dbc-0x002f8dd4 loads state 6 on reaching within 1.0 of home and stores through 0x002f9044; case 6 faces the stored goal and waits. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_22_value_8 -> ALIEN_SNAPPER_STATE_APPROACH_TARGET: 0x002f8dd8-0x002f8df4 selects state 8 during home return when pvars+0x164 differs from 2; existing case 8 computes and approaches the target-relative goal. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_23_value_16 -> ALIEN_SNAPPER_STATE_BITE_HERO: 0x002f8e7c-0x002f8eb0 selects state 16 within 4.0 XY units of hero; case 16 faces hero and performs bite query plus collision_line during its animation window. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_24_value_15 -> ALIEN_SNAPPER_STATE_FACE_HERO: 0x002f902c-0x002f9044 selects state 15 after hero bite animation completion; case 15 turns toward the hero and waits until hero enters bite range. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_25_value_13 -> ALIEN_SNAPPER_STATE_RETREAT_FROM_TARGET: 0x002f9078-0x002f90f4 selects state 13 after knockback flags and successful path containment, restores animation speed and seeds retreat timer; case 13 moves away from target. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_2_value_2 -> ALIEN_SNAPPER_STATE_ACTIVATION_SEQUENCE: 0x002f7fb8-0x002f7fcc selects state 2 and seeds the activation timer; case 2 at 0x002f8064-0x002f80d0 delays then requests activation animation. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_3_value_1 -> ALIEN_SNAPPER_STATE_WAIT_FOR_ACTIVATION: 0x002f7ff8-0x002f8020 selects state 1 with idle animation and targeting radius; case 1 waits for pvars+0x164 to differ from 2 before activation. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_4_value_2 -> ALIEN_SNAPPER_STATE_ACTIVATION_SEQUENCE: 0x002f8024-0x002f8040 leaves the activation wait by storing state 2 and setting its timer; case 2 consumes that timer before activation animation. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_5_value_8 -> ALIEN_SNAPPER_STATE_APPROACH_TARGET: 0x002f80e0-0x002f8120 selects state 8 inside targeting radius and randomizes angle jitter; case 8 constructs a target-relative goal and moves toward it. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_6_value_6 -> ALIEN_SNAPPER_STATE_FACE_GOAL_AND_WAIT: 0x002f814c-0x002f8168 selects state 6 after activation outside targeting radius; case 6 at 0x002f8364 faces pvars goal_x/goal_y and waits. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_7_value_4 -> ALIEN_SNAPPER_STATE_PREPARE_HOME_NODE_JUMP: 0x002f81c8-0x002f81e4 selects state 4 after clip inclusion; its case 0x002f8200-0x002f8240 advances activation animation to home-node jump windup. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_8_value_5 -> ALIEN_SNAPPER_STATE_JUMP_TO_HOME_NODE: 0x002f8244-0x002f82c8 selects state 5, copies the node position to home and computes ballistic velocities; case 5 updates motion until ground flag 1. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. domain_9_value_6 -> ALIEN_SNAPPER_STATE_FACE_GOAL_AND_WAIT: 0x002f8320-0x002f8344 selects state 6 when home-node jump motion returns supporting-ground flag 1; case 6 turns toward the stored XY goal and waits. Retail keeps the assigned Moby in s3 (0x002f7d84); these stores target +0x20, exactly the state byte loaded for dispatch at 0x002f7e20. Reuse the existing alien snapper enum member, separate from prev_seq +0x53 and HeroStateId. --- src/overlays/l06/mobys/alien_snapper.c | 52 +++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/overlays/l06/mobys/alien_snapper.c b/src/overlays/l06/mobys/alien_snapper.c index f60a3d7682..251b6f9eec 100644 --- a/src/overlays/l06/mobys/alien_snapper.c +++ b/src/overlays/l06/mobys/alien_snapper.c @@ -325,14 +325,14 @@ void alien_snapper_update(Moby *moby) { snapper_behavior->f94 = 9; snapper_behavior->f1C8 = random_angle_radians(); if (snapper_behavior->f1CC != 0) { - moby->state = 0xF; + moby->state = ALIEN_SNAPPER_STATE_FACE_HERO; if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, 0); } } else if (snapper_behavior->clip_volume >= 0) { - moby->state = 3; + moby->state = ALIEN_SNAPPER_STATE_WAIT_FOR_CLIP_TRIGGER; } else if (snapper_behavior->f1B4 != 0) { - moby->state = 2; + moby->state = ALIEN_SNAPPER_STATE_ACTIVATION_SEQUENCE; snapper_behavior->timer = scale_game_frames(1); if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, 0); @@ -341,7 +341,7 @@ void alien_snapper_update(Moby *moby) { func_L06_002FAAC8_91A8(moby); } } else { - moby->state = 1; + moby->state = ALIEN_SNAPPER_STATE_WAIT_FOR_ACTIVATION; if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, 0); } @@ -350,7 +350,7 @@ void alien_snapper_update(Moby *moby) { break; case ALIEN_SNAPPER_STATE_WAIT_FOR_ACTIVATION: if (snapper_behavior->f164 != 2) { - moby->state = 2; + moby->state = ALIEN_SNAPPER_STATE_ACTIVATION_SEQUENCE; snapper_behavior->timer = scale_game_frames(1); if (moby->group != 0xFF) { func_L06_002FAAC8_91A8(moby); @@ -370,7 +370,7 @@ void alien_snapper_update(Moby *moby) { } else if (moby->anim_flags & 2) { if (vector_distance_xy(&moby->pos, ((char *)&D_0013F3D0)) < l06_alien_snapper_base_targeting_radius) { - moby->state = 8; + moby->state = ALIEN_SNAPPER_STATE_APPROACH_TARGET; snapper_behavior->angle_jitter = random_float_between(snapper_behavior->jitter_degrees * 0.017453292f, -(snapper_behavior->jitter_degrees * 0.017453292f)); @@ -380,7 +380,7 @@ void alien_snapper_update(Moby *moby) { } else { int frames = *((u8 *)moby->pclass->seqs[2] + 0x10); - moby->state = 6; + moby->state = ALIEN_SNAPPER_STATE_FACE_GOAL_AND_WAIT; if (moby->prev_seq != 2) { start_frame = random_float_between(0.0f, (float)frames - 1.0f); blend_moby_animation(moby, 2, start_frame, scale_game_frames(30)); @@ -392,7 +392,7 @@ void alien_snapper_update(Moby *moby) { if (snapper_behavior->clip_volume >= 0) { if (is_point_inside_clip_volume(((char *)&D_0013F3D0), snapper_behavior->clip_volume) != 0) { - moby->state = 4; + moby->state = ALIEN_SNAPPER_STATE_PREPARE_HOME_NODE_JUMP; if (moby->prev_seq != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(5)); } @@ -406,7 +406,7 @@ void alien_snapper_update(Moby *moby) { blend_moby_animation(moby, 6, 0, scale_game_frames(5)); break; case ALIEN_SNAPPER_ANIM_HOME_NODE_JUMP_WINDUP: - moby->state = 5; + moby->state = ALIEN_SNAPPER_STATE_JUMP_TO_HOME_NODE; qcopy(&snapper_behavior->home, &l06_cuboids[snapper_behavior->node].pos); snapper_behavior->return_speed = vector_distance_xy(&moby->pos, &snapper_behavior->home) / @@ -434,7 +434,7 @@ void alien_snapper_update(Moby *moby) { break; case ALIEN_SNAPPER_STATE_JUMP_TO_HOME_NODE: if (func_L00_0025D6F0_91A8(moby, snapper_behavior->f70) & 1) { - moby->state = 6; + moby->state = ALIEN_SNAPPER_STATE_FACE_GOAL_AND_WAIT; if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, 5); } @@ -449,11 +449,11 @@ void alien_snapper_update(Moby *moby) { 0.3f, frame_time * 6.2831855f); if (snapper_behavior->f164 != 2) { - moby->state = 7; + moby->state = ALIEN_SNAPPER_STATE_WAIT_TO_APPROACH; snapper_behavior->timer = truncate_float_to_s32( random_float_between(0.0f, (float)snapper_behavior->timer_max)); } else if (snapper_behavior->f1AC != 0) { - moby->state = 9; + moby->state = ALIEN_SNAPPER_STATE_REPOSITION_AROUND_TARGET; if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } @@ -497,15 +497,15 @@ void alien_snapper_update(Moby *moby) { near = 1; } if (snapper_behavior->f1AC == 0) { - moby->state = 0xC; + moby->state = ALIEN_SNAPPER_STATE_RETURN_HOME; } else if (near) { - moby->state = 0xA; + moby->state = ALIEN_SNAPPER_STATE_WAIT_FOR_REPOSITION_ANIMATION; if (moby->prev_seq != 5) { blend_moby_animation(moby, 5, 0, scale_game_frames(10)); } } else if (vector_distance_xy(&moby->pos, &target->pos) < l06_alien_snapper_bite_approach_radius) { - moby->state = 0xB; + moby->state = ALIEN_SNAPPER_STATE_BITE_TARGET; if (moby->prev_seq != 4) { blend_moby_animation(moby, 4, 0, scale_game_frames(10)); } @@ -514,7 +514,7 @@ void alien_snapper_update(Moby *moby) { } case ALIEN_SNAPPER_STATE_WAIT_FOR_REPOSITION_ANIMATION: if (moby->anim_flags & 2) { - moby->state = 9; + moby->state = ALIEN_SNAPPER_STATE_REPOSITION_AROUND_TARGET; if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(20)); } @@ -522,7 +522,7 @@ void alien_snapper_update(Moby *moby) { break; case ALIEN_SNAPPER_STATE_WAIT_TO_APPROACH: if (fast_dec_timer(&snapper_behavior->timer) != 0) { - moby->state = 8; + moby->state = ALIEN_SNAPPER_STATE_APPROACH_TARGET; snapper_behavior->angle_jitter = random_float_between(snapper_behavior->jitter_degrees * 0.017453292f, -(snapper_behavior->jitter_degrees * 0.017453292f)); @@ -568,14 +568,14 @@ void alien_snapper_update(Moby *moby) { if (l06_alien_snapper_max_home_distance < fast_vec_dist(&moby->pos, &snapper_behavior->home) || snapper_behavior->f164 == 2) { - moby->state = 0xC; + moby->state = ALIEN_SNAPPER_STATE_RETURN_HOME; } else if (vector_distance_xy(&moby->pos, &target->pos) < l06_alien_snapper_bite_approach_radius) { if (absolute_float(target->pos.z - moby->pos.z) < 1.0f) { char *hero = ((char *)&D_0013F350); if (*(int *)(hero + 0x1C0) < scale_game_frames(10)) { - moby->state = 0xB; + moby->state = ALIEN_SNAPPER_STATE_BITE_TARGET; if (moby->prev_seq != 4) { blend_moby_animation(moby, 4, 0, scale_game_frames(10)); } @@ -607,7 +607,7 @@ void alien_snapper_update(Moby *moby) { scratch.bite.dir[2] = 0.0f; func_L00_001F2BE8_91A8(0.5f, bite_query_position, 0, moby, &scratch.bite); } else if (moby->anim_flags & 2) { - moby->state = 8; + moby->state = ALIEN_SNAPPER_STATE_APPROACH_TARGET; if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(20)); } @@ -636,7 +636,7 @@ void alien_snapper_update(Moby *moby) { func_L00_00262DF0_91A8(0.5f, snapper_behavior->path, &moby->pos, &moby->pos); if (fast_dec_timer(&snapper_behavior->timer) != 0 || l06_alien_snapper_retreat_distance_limit < fast_vec_dist(&moby->pos, &target->pos)) { - moby->state = 0xB; + moby->state = ALIEN_SNAPPER_STATE_BITE_TARGET; snapper_behavior->speed = frame_time * 5.0f; if (l06_alien_snapper_retreat_bite_override_enabled != 0) { if (moby->prev_seq != 4) { @@ -668,12 +668,12 @@ void alien_snapper_update(Moby *moby) { moby, &snapper_behavior->movement, scratch.m.dir, scratch.m.out, 1.0f); func_L00_00262DF0_b91A8(snapper_behavior->path, &moby->pos, &moby->pos, 0.5f); if (fast_vec_dist(&moby->pos, &snapper_behavior->home) < 1.0f) { - moby->state = 6; + moby->state = ALIEN_SNAPPER_STATE_FACE_GOAL_AND_WAIT; if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(20)); } } else if (snapper_behavior->f164 != 2) { - moby->state = 8; + moby->state = ALIEN_SNAPPER_STATE_APPROACH_TARGET; if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(20)); } @@ -691,7 +691,7 @@ void alien_snapper_update(Moby *moby) { D_0015ED70 * 6.2831855f, frame_time * 12.566371f); if (vector_distance_xy(&moby->pos, hero + 0x80) < 4.0f) { - moby->state = 0x10; + moby->state = ALIEN_SNAPPER_STATE_BITE_HERO; if (moby->prev_seq != 4) { blend_moby_animation(moby, 4, 0, scale_game_frames(20)); } @@ -724,7 +724,7 @@ void alien_snapper_update(Moby *moby) { func_L00_001F2BE8_91A8(0.5f, bite_query_position, 0, moby, &scratch.bite); collision_line(bite_query_position, &moby->pos, 0, moby, &scratch.bite); } else if (moby->anim_flags & 2) { - moby->state = 0xF; + moby->state = ALIEN_SNAPPER_STATE_FACE_HERO; if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(20)); } @@ -739,7 +739,7 @@ void alien_snapper_update(Moby *moby) { mark_moby_for_removal(moby); break; } - moby->state = 0xD; + moby->state = ALIEN_SNAPPER_STATE_RETREAT_FROM_TARGET; moby->anim_speed = 1.0f; if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(20)); From cdce7d349326138d61770741f65a588d5ff1cec3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:43:19 +0000 Subject: [PATCH 116/758] decomp: clarify names in l01_hero_set_state domain_0_value_2 -> HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS: The selector is animation_setup_mode, the second argument a1 saved in s4 at retail 0x0023cff0, separate from requested state a0/s1 and hero control_mode. At 0x0023cfe4-0x0023d008, control_mode 0x14 refuses entry unless requested state is 100 and s4 equals 2. Original Ghidra has param_2 != 2 returning zero. The same s4 value bypasses the cutscene refusal at 0x0023d028, while its nonzero value enables guarded animation setup (e.g. 0x0023d228). Thus 2 is the animation-setup transition-guard override, not HERO_STATE_RUN, gravity mode or vehicle mode. domain_3_value_2 -> HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS: Authoritative source tests animation_setup_mode != 2 after cutscene_mode equals 2 or 6. Retail 0x0023d00c-0x0023d020 loads cutscene_mode at 0x0015F5C4 and tests those two values; 0x0023d014 sets a0=2 and 0x0023d028 compares s4 (second argument saved at 0x0023cff0) to a0, returning zero on inequality. Original Ghidra expresses the identical param_2 gate. Equality permits the transition through this cutscene guard and also satisfies the dying-mode gate at 0x0023d000-0x0023d004. Reuse the same animation_setup_mode override member for both comparisons; no cutscene-state identity is inferred. --- src/overlays/l01/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/hero/hero_set_state.c b/src/overlays/l01/hero/hero_set_state.c index d4b383aeb7..927fcac2c8 100644 --- a/src/overlays/l01/hero/hero_set_state.c +++ b/src/overlays/l01/hero/hero_set_state.c @@ -69,6 +69,9 @@ extern char level_01_transform_trail_jump_velocity_keys[] __asm__("D_L01_0017C3A extern char level_01_water_surface_jump_velocity_keys[] __asm__("D_L01_0017C3E0"); int l01_hero_set_state(int requested_state, int animation_setup_mode) { + enum { + HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS = 2 + }; int saved_state_step; char *moby; int old20A7; @@ -76,10 +79,10 @@ int l01_hero_set_state(int requested_state, int animation_setup_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - animation_setup_mode != 2)) + animation_setup_mode != HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS)) return 0; } - if ((cutscene_mode == 2 || cutscene_mode == 6) && animation_setup_mode != 2) + if ((cutscene_mode == 2 || cutscene_mode == 6) && animation_setup_mode != HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS) return 0; { struct Hero *p = &hero; From 3df1b0ccf051cbda8aaa4592cdfa60439dae3533 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:43:19 +0000 Subject: [PATCH 117/758] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ENTRY_ANIMATION_GUARD_OVERRIDE: Source entry_animation_mode is a1, saved into s4 at retail 0x0022b780. With control_mode 0x14, retail 0x0022b784..0x0022b798 requires requested state 100 and s4==2 to pass instead of returning 0. Original Ghidra param_2!=2 agrees. Nonzero s4 also enables conditional entry animation at 0x0022b9b8 and 0x0022d754. This proves an entry-animation guard override mode, distinct from HeroStateId and vehicle/control modes; it does not override the later health or jump-lock rejection. domain_3_value_2 -> HERO_ENTRY_ANIMATION_GUARD_OVERRIDE: Source tests the same entry_animation_mode parameter after level_game_mode 2/6. Retail 0x0022b79c..0x0022b7bc loads level_game_mode at 0x0015f5c4 and requires s4==2 for these modes, otherwise returning 0; s4 holds a1 from 0x0022b780. Original Ghidra confirms ((iRam0015f5c4==2)||(iRam0015f5c4==6)) && param_2!=2. Thus this occurrence uses the same entry-animation guard override value as 0x0022b790..0x0022b798, without asserting the identities of the level game modes. --- src/overlays/l02/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l02/hero/hero_set_state.c b/src/overlays/l02/hero/hero_set_state.c index 164deeda39..60c5c4f506 100644 --- a/src/overlays/l02/hero/hero_set_state.c +++ b/src/overlays/l02/hero/hero_set_state.c @@ -70,6 +70,9 @@ extern int hero_set_state(int, int) __asm__("FUN_L02_0022b728"); extern char level02_hero_transform_trail_jump_velocity_keys[] __asm__("D_L02_0017C520"); int hero_set_state(int requested_state, int entry_animation_mode) { + enum { + HERO_ENTRY_ANIMATION_GUARD_OVERRIDE = 2 + }; int saved_state_step; char *moby; int old20A7; @@ -77,10 +80,10 @@ int hero_set_state(int requested_state, int entry_animation_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - entry_animation_mode != 2)) + entry_animation_mode != HERO_ENTRY_ANIMATION_GUARD_OVERRIDE)) return 0; } - if ((level_game_mode == 2 || level_game_mode == 6) && entry_animation_mode != 2) + if ((level_game_mode == 2 || level_game_mode == 6) && entry_animation_mode != HERO_ENTRY_ANIMATION_GUARD_OVERRIDE) return 0; { struct Hero *p = &hero; From 1bc93203357974b80123da68cdd65c2b51659d6c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:45:23 +0000 Subject: [PATCH 118/758] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE: Retail 0x0024dba8 saves incoming a1 as s4 (source animation_update_mode). Under control_mode 0x14, 0x0024dbac-0x0024dbc0 admits only requested state 100 with s4==2; otherwise it returns zero. Original Ghidra repeats param_2 != 2. Thus 2 is the guarded-entry override in this parameter domain, separate from HeroStateId and vehicle/control modes. Nonzero s4 also enables optional entry animations at 0x0024df20. domain_1_value_2 -> HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE: Retail 0x0024dbc4-0x0024dbe4 tests D_L11_0015F5C4 for 2 or 6 and returns zero unless s4, the saved animation_update_mode argument, equals 2. Original Ghidra shows the same param_2 != 2 guard. This reuses the same guarded-entry override as the preceding control_mode 0x14 admission check; it does not interpret D_L11_0015F5C4's separate domain or bypass the later health/jump guards. --- src/overlays/l11/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l11/hero/hero_set_state.c b/src/overlays/l11/hero/hero_set_state.c index b814303ba1..d7c0fd1c8d 100644 --- a/src/overlays/l11/hero/hero_set_state.c +++ b/src/overlays/l11/hero/hero_set_state.c @@ -66,16 +66,19 @@ extern char level_11_water_surface_jump_velocity_keys[] __asm__("D_L11_0017C960" extern char level_11_trail_jump_velocity_keys[] __asm__("D_L11_0017C920"); int hero_set_state(int requested_state, int animation_update_mode) { + enum { + HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE = 2 + }; int previous_state_step; char *moby; int old20A7; { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_update_mode != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_update_mode != HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE)) return 0; } - if ((D_L11_0015F5C4 == 2 || D_L11_0015F5C4 == 6) && animation_update_mode != 2) + if ((D_L11_0015F5C4 == 2 || D_L11_0015F5C4 == 6) && animation_update_mode != HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE) return 0; { struct Hero *p = &hero; From 4b41d8020a63f7071784c567455839c146020db8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:45:24 +0000 Subject: [PATCH 119/758] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS: Retail 0x002166a0 retains a1 (source entry_animation_mode) in s4. With control_mode 0x14, 0x002166a4-0x002166b8 first requires request 100, then compares s4 to 2 and returns zero on inequality. Original Ghidra param_2 != 2 and authoritative C agree. This value bypasses the entry-animation-mode lock restriction, while retaining the separate requested-state restriction; it is not HeroStateId, gravity or vehicle mode. domain_1_value_2 -> HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS: Retail 0x002166bc-0x002166dc reads D_L03_0015F5C4, tests values 2/6, and when either matches compares the preserved second argument s4 to a0=2, returning zero for inequality. Original Ghidra and authoritative C explicitly use entry_animation_mode != 2. Reuse the same mode member as the preceding death-entry guard: mode 2 bypasses these entry locks, without asserting further playback behavior. --- src/overlays/l03/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l03/hero/hero_set_state.c b/src/overlays/l03/hero/hero_set_state.c index 3c3faba792..22d5eeba88 100644 --- a/src/overlays/l03/hero/hero_set_state.c +++ b/src/overlays/l03/hero/hero_set_state.c @@ -69,6 +69,9 @@ extern char level03_hero_trail_jump_velocity_keys[] __asm__("D_L03_0017C020"); extern char level03_hero_water_surface_jump_velocity_keys[] __asm__("D_L03_0017C060"); int hero_set_state(int requested_state, int entry_animation_mode) { + enum { + HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS = 2 + }; int previous_state_step; char *moby; int old20A7; @@ -76,10 +79,10 @@ int hero_set_state(int requested_state, int entry_animation_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - entry_animation_mode != 2)) + entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS)) return 0; } - if ((D_L03_0015F5C4 == 2 || D_L03_0015F5C4 == 6) && entry_animation_mode != 2) + if ((D_L03_0015F5C4 == 2 || D_L03_0015F5C4 == 6) && entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS) return 0; { struct Hero *p = &hero; From 7d69da2bbef02a7fcc27dd4885a5663be09be090 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:47:44 +0000 Subject: [PATCH 120/758] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE: The authoritative source entry_animation_mode is retail a1 saved in s4 at 0x00240128. With control_mode 0x14, retail 0x0024012c..0x00240140 permits request 100 only when s4 equals 2. Original Ghidra param_2 != 2 agrees. This value overrides that mode guard while remaining nonzero for optional entry-animation setup; it is a separate entry-animation domain, not a HeroStateId or vehicle mode. domain_1_value_2 -> HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE: Retail 0x00240144..0x00240164 tests D_L12_0015F5C4 for modes 2 or 6 and rejects unless the same s4 entry_animation_mode equals 2. Original Ghidra and authoritative source agree. This is the same parameter and equal-valued mode-guard override used at 0x00240138..0x00240140, so both comparisons reuse one entry-animation-domain member; no identity for the global modes is inferred. --- src/overlays/l12/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l12/hero/hero_set_state.c b/src/overlays/l12/hero/hero_set_state.c index 5e817b4c22..aa13828457 100644 --- a/src/overlays/l12/hero/hero_set_state.c +++ b/src/overlays/l12/hero/hero_set_state.c @@ -67,16 +67,19 @@ extern char level12_transform_trail_jump_velocity_key_profile[] __asm__("D_L12_0 extern char level12_water_surface_jump_velocity_key_profile[] __asm__("D_L12_0017C3E0"); int hero_set_state(int requested_state, int entry_animation_mode) { + enum { + HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE = 2 + }; int previous_state_step; char *moby; int old20A7; { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || entry_animation_mode != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE)) return 0; } - if ((D_L12_0015F5C4 == 2 || D_L12_0015F5C4 == 6) && entry_animation_mode != 2) + if ((D_L12_0015F5C4 == 2 || D_L12_0015F5C4 == 6) && entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE) return 0; { struct Hero *p = &hero; From e8d1ec760d8ffe73f616a372305f97303161ce8b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:49:55 +0000 Subject: [PATCH 121/758] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS: Retail 0x00230b90 preserves second int a1 in s4 (animation_request_mode), separate from requested HeroStateId in s1. At 0x00230ba0..0x00230ba8, value 2 permits the requested idle-with-dying-override transition through the control_mode==0x14 guard. At 0x00230bb4..0x00230bcc, the same value 2 bypasses rejection while level_game_mode is 2 or 6. Original Ghidra param_2 comparisons and authoritative C agree. Zero skips optional animation calls at 0x00230dc8 and 0x00230f08, so the nonzero override value also requests entry animation. This names mode-guard override behavior, not a hero state or vehicle identity; it does not bypass the subsequent health/state guard. domain_3_value_2 -> HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS: Retail 0x00230b90 preserves second int a1 in s4 (animation_request_mode), separate from requested HeroStateId in s1. At 0x00230ba0..0x00230ba8, value 2 permits the requested idle-with-dying-override transition through the control_mode==0x14 guard. At 0x00230bb4..0x00230bcc, the same value 2 bypasses rejection while level_game_mode is 2 or 6. Original Ghidra param_2 comparisons and authoritative C agree. Zero skips optional animation calls at 0x00230dc8 and 0x00230f08, so the nonzero override value also requests entry animation. This names mode-guard override behavior, not a hero state or vehicle identity; it does not bypass the subsequent health/state guard. --- src/overlays/l08/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l08/hero/hero_set_state.c b/src/overlays/l08/hero/hero_set_state.c index 4c7f997d7a..5b950ebfcc 100644 --- a/src/overlays/l08/hero/hero_set_state.c +++ b/src/overlays/l08/hero/hero_set_state.c @@ -69,6 +69,9 @@ extern char hero_water_surface_jump_velocity_keys[] __asm__("D_L08_0017C760"); extern char hero_transform_trail_jump_velocity_keys[] __asm__("D_L08_0017C720"); int hero_set_state(int requested_state, int animation_request_mode) { + enum { + HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS = 2 + }; int previous_state_step; char *moby; int old20A7; @@ -77,10 +80,10 @@ int hero_set_state(int requested_state, int animation_request_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - animation_request_mode != 2)) + animation_request_mode != HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS)) return 0; } - if ((level_game_mode == 2 || level_game_mode == 6) && animation_request_mode != 2) + if ((level_game_mode == 2 || level_game_mode == 6) && animation_request_mode != HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS) return 0; { struct Hero *p = &hero; From 13601b2b599bef5738dde98d4ed211aa6f24e315 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:49:55 +0000 Subject: [PATCH 122/758] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE: Authoritative C compares entry_animation_mode, not requested_state or hero.vehicle_mode. Original Ghidra compares param_2 != 2. Retail 0x00216c90 saves a1 in s4; 0x00216ca0 loads 2 and 0x00216ca4 refuses the transition unless s4 equals it after the terminal-control-mode and requested-state-100 tests. Nonzero s4 also enables optional entry animations (0x00216ec8, 0x00217008, 0x00219558). Thus 2 is an entry-animation-mode transition override, separate from HeroStateId, HeroVehicleMode and HeroGravityMode. domain_1_value_2 -> HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE: Original Ghidra and authoritative C require entry_animation_mode == 2 when D_L15_0015F5C4 is 2 or 6. Retail 0x00216cb4 loads a0=2, 0x00216cb8/0x00216cc0 test that global against 2/6, and 0x00216cc8 refuses entry unless saved second argument s4 equals a0. This is the same entry-animation-mode override tested at 0x00216ca0..0x00216ca4, so both occurrences share HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE. It bypasses these gates only, not the later zero-health allowlist. --- src/overlays/l15/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l15/hero/hero_set_state.c b/src/overlays/l15/hero/hero_set_state.c index 5e0da8f815..cb2b9c8be9 100644 --- a/src/overlays/l15/hero/hero_set_state.c +++ b/src/overlays/l15/hero/hero_set_state.c @@ -69,6 +69,9 @@ extern char hero_trail_jump_velocity_keys[] __asm__("D_L15_0017C520"); extern char hero_deep_water_jump_velocity_keys[] __asm__("D_L15_0017C560"); int hero_set_state(int requested_state, int entry_animation_mode) { + enum { + HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE = 2 + }; int saved_state_step; char *moby; int old20A7; @@ -76,10 +79,10 @@ int hero_set_state(int requested_state, int entry_animation_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - entry_animation_mode != 2)) + entry_animation_mode != HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE)) return 0; } - if ((D_L15_0015F5C4 == 2 || D_L15_0015F5C4 == 6) && entry_animation_mode != 2) + if ((D_L15_0015F5C4 == 2 || D_L15_0015F5C4 == 6) && entry_animation_mode != HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE) return 0; { struct Hero *p = &hero; From d49d5baaf6bfef88bc21ee50b4b2ae4be574575c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:49:56 +0000 Subject: [PATCH 123/758] decomp: clarify names in hero_set_state domain_0_value_2 -> HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE: Retail 0x0022ffb0 preserves a1 as s4, the source animation_update_mode, independently of requested_state/s1. At 0x0022ffc0-0x0022ffc8, s4 must equal 2 to avoid refusal while control_mode is 0x14 and the request is HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE. Nonzero s4 subsequently enables animation updates, e.g. 0x0023356c-0x0023358c. Original Ghidra param_2 comparisons and authoritative C agree: 2 is the animation-update mode overriding this transition guard, not a HeroStateId or vehicle mode. domain_1_value_2 -> HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE: Retail 0x0022ffd0 loads D_L14_0015F5C4 and 0x0022ffd4-0x0022ffe0 tests its values 2 or 6. At 0x0022ffe8-0x0022ffec the separate saved second argument s4 must equal a0=2 or return 0. s4 originates from a1 at 0x0022ffb0 and gates animation updates at 0x00230228 and 0x0023356c. Authoritative animation_update_mode != 2 and original Ghidra param_2 != 2 agree. Reuse the same animation-update guard-override constant as the preceding dying transition guard. --- src/overlays/l14/hero/hero_set_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/hero/hero_set_state.c b/src/overlays/l14/hero/hero_set_state.c index 5c772c011d..910476ff36 100644 --- a/src/overlays/l14/hero/hero_set_state.c +++ b/src/overlays/l14/hero/hero_set_state.c @@ -65,6 +65,9 @@ extern int hero_set_state(int, int) __asm__("FUN_L14_0022ff58"); extern char level14_transform_trail_jump_velocity_keys[] __asm__("D_L14_0017C620"); int hero_set_state(int requested_state, int animation_update_mode) { + enum { + HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE = 2 + }; int saved_state_step; char *moby; int old20A7; @@ -73,10 +76,10 @@ int hero_set_state(int requested_state, int animation_update_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - animation_update_mode != 2)) + animation_update_mode != HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE)) return 0; } - if ((D_L14_0015F5C4 == 2 || D_L14_0015F5C4 == 6) && animation_update_mode != 2) + if ((D_L14_0015F5C4 == 2 || D_L14_0015F5C4 == 6) && animation_update_mode != HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE) return 0; { struct Hero *p = &hero; From 9ef97dcdcc35fd35ea4aa99a1603e1c82ad58d58 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 00:56:37 +0000 Subject: [PATCH 124/758] decomp: clarify names in apply_hero_ground_material_effects domain_4_value_8 -> GROUND_MATERIAL_SLIP: The authoritative source saves hero.ground_type as saved_ground_type; embedded update_hero_ground_contact assigns that field from collision_hit_material(). Retail 0x002097d4 loads this short into s2, and 0x002099f0 compares s2 with 8. The taken material branch at 0x002099f8-0x00209a00 writes 1 to hero+0x12ea, identified in the authoritative C as on_slip_ground. This proves a slip-flag-setting ground material, independently of equal-valued HeroStateId members. --- src/overlays/l16/hero/apply_hero_ground_material_effects.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 494a387a55..5b6926ddcf 100644 --- a/src/overlays/l16/hero/apply_hero_ground_material_effects.c +++ b/src/overlays/l16/hero/apply_hero_ground_material_effects.c @@ -36,6 +36,9 @@ extern int hero_set_state(int, int) __asm__("FUN_L16_0021e398"); void apply_hero_ground_material_effects(void) __asm__("FUN_L16_002097a0"); void apply_hero_ground_material_effects(void) { + enum { + GROUND_MATERIAL_SLIP = 0x8 + }; struct Hero *hero_data = &hero; int keep = hero_data->ground_sound_class; int saved_ground_type = hero_data->ground_type; @@ -112,7 +115,7 @@ void apply_hero_ground_material_effects(void) { struct Hero *q = &hero; q->selector_13 = 1; } - if (saved_ground_type == 0x8) { + if (saved_ground_type == GROUND_MATERIAL_SLIP) { struct Hero *q = &hero; q->on_slip_ground = 1; } From f036dea0d2e8e2007f6a23e3ec7230644f213c44 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:46:02 +0000 Subject: [PATCH 125/758] decomp: clarify names in update_path_camera rec -> path_camera_preset: Authoritative src/overlays/l14/path_camera.c SHA-256 eae61e45b3038047a4aa610d3f8927116d04fa48a392776bf2300c788efb97c3 declares rec as the pointer selected from l14_camera_preset_rows by path_camera->descriptor_index * 32 + 0x1C. Retail 0x003152d4-0x003152f0 loads the signed descriptor index, scales it by 32, and loads this pointer into s7; original Ghidra expresses the same binding as iVar2. Loads at 0x003152f4/0x003152fc select the movement/look paths from +0x20/+0x24; 0x0031533c-0x00315388 uses +0x28/+0x2C for the target moby and offset; 0x00315460-0x00315470 multiplies its +0x3C speed by frame_time, and 0x00315490 tests its +0x39 completion control. These camera configuration consumers prove a path-camera preset rather than an unspecified record. --- src/overlays/l14/path_camera.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/l14/path_camera.c b/src/overlays/l14/path_camera.c index 11d049505e..9d63db1bc9 100644 --- a/src/overlays/l14/path_camera.c +++ b/src/overlays/l14/path_camera.c @@ -167,7 +167,7 @@ void update_path_camera(struct UpdateCam *path_camera) { s32 seg2; f32 tt2; char *camera_saved_state = (char *)path_camera->saved_state; - char *rec = *(char **)(l14_camera_preset_rows + path_camera->descriptor_index * 32 + 0x1C); + char *path_camera_preset = *(char **)(l14_camera_preset_rows + path_camera->descriptor_index * 32 + 0x1C); VendorCamRun_5290 *camera_run = (VendorCamRun_5290 *)(camera_saved_state + 0x40); VendorCamStops_5290 *fov_stops = (VendorCamStops_5290 *)(camera_saved_state + 0x58); char *path; @@ -175,14 +175,14 @@ void update_path_camera(struct UpdateCam *path_camera) { int i; if (camera_run->started == 0) { - char *pa = ((char *)l14_paths[*(int *)(rec + 0x20)]); - char *pb = ((char *)l14_paths[*(int *)(rec + 0x24)]); + char *pa = ((char *)l14_paths[*(int *)(path_camera_preset + 0x20)]); + char *pb = ((char *)l14_paths[*(int *)(path_camera_preset + 0x24)]); path_camera_active = 1; camera_run->started = 1; qcopy(&path_camera->pos, pa + 0x10); - if (*(int *)(rec + 0x28) >= 0) { - struct Moby *o = (struct Moby *)(D_L14_0015FFD8_5290 + *(int *)(rec + 0x28) * 256); - float *ofs = (float *)(rec + 0x2C); + if (*(int *)(path_camera_preset + 0x28) >= 0) { + struct Moby *o = (struct Moby *)(D_L14_0015FFD8_5290 + *(int *)(path_camera_preset + 0x28) * 256); + float *ofs = (float *)(path_camera_preset + 0x2C); t[0] = ofs[0]; t[1] = ofs[1]; t[2] = ofs[2]; @@ -200,17 +200,17 @@ void update_path_camera(struct UpdateCam *path_camera) { fast_vec_cross(&path_camera->m2, &path_camera->m1, &path_camera->m0); return; } - path = ((char *)l14_paths[*(int *)(rec + 0x20)]); + path = ((char *)l14_paths[*(int *)(path_camera_preset + 0x20)]); qcopy(initial_look_direction_or_previous_position, &path_camera->pos); done = FUN_L00_0025d808(path, &path_camera->pos.x, &camera_run->seg, &camera_run->t, 0, - *(float *)(rec + 0x3C) * frame_time); + *(float *)(path_camera_preset + 0x3C) * frame_time); if (camera_run->timer != 0 && fast_dec_timer_s16(&camera_run->timer) != 0) done = 1; - if (*(u8 *)(rec + 0x39) != 0) + if (*(u8 *)(path_camera_preset + 0x39) != 0) done = 1; if (done) { float ang = fov_stops->fov_end * 0.5f; @@ -222,7 +222,7 @@ void update_path_camera(struct UpdateCam *path_camera) { path_camera->transition_state = PATH_CAMERA_TRANSITION_PATH_FINISHED; path_camera_active = 0; mb = D_L14_0015FFD8_5290; - reset_racer_group_to_hero_path_position((struct Moby *)(mb + *(int *)(rec + 0x50) * 256)); + reset_racer_group_to_hero_path_position((struct Moby *)(mb + *(int *)(path_camera_preset + 0x50) * 256)); hp = (char *)hero.rail_spline; seg = hero.rail_segment; tt = hero.rail_seg_frac; @@ -264,9 +264,9 @@ void update_path_camera(struct UpdateCam *path_camera) { } camera_run->dist += fast_vec_dist(initial_look_direction_or_previous_position, &path_camera->pos); - if (*(int *)(rec + 0x28) >= 0) { - struct Moby *o = (struct Moby *)(D_L14_0015FFD8_5290 + *(int *)(rec + 0x28) * 256); - float *ofs = (float *)(rec + 0x2C); + if (*(int *)(path_camera_preset + 0x28) >= 0) { + struct Moby *o = (struct Moby *)(D_L14_0015FFD8_5290 + *(int *)(path_camera_preset + 0x28) * 256); + float *ofs = (float *)(path_camera_preset + 0x2C); u[0] = ofs[0]; u[1] = ofs[1]; u[2] = ofs[2]; @@ -275,7 +275,7 @@ void update_path_camera(struct UpdateCam *path_camera) { fast_vec_add(v, &o->pos, u); fast_vec_sub(t, v, &path_camera->pos); } else { - char *look = ((char *)l14_paths[*(int *)(rec + 0x24)]); + char *look = ((char *)l14_paths[*(int *)(path_camera_preset + 0x24)]); seg2 = 0; tt2 = 0.0f; FUN_L00_0025d808( From 1752cb071ea62ce4e56fc9c32c1638509d27f4e1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:48:19 +0000 Subject: [PATCH 126/758] decomp: clarify names in FindSubstring sub -> target_substring: In the authoritative src/sdk/libc/string/find_substring.c snapshot (SHA-256 d40231c8fbd0b00c329c4de64223a256d930c41555e8ddb934f276394eb8e33f), sub[i] supplies the sequence compared against search_string[i], and sub[i] == 0 returns the current candidate search_string. Original retail param_2/a1 is loaded at 0x001169d0, indexed by a3 at 0x00116a00-0x00116a04, and its NUL at 0x00116a08 returns a0 via 0x001169e0-0x001169e4. Only a0 advances after mismatch at 0x001169f8/0x00116a1c. The process_menu_entry caller at 0x00216d9c passes help_text_integer_placeholder as this second argument, confirming it is the target substring sought within SCRATCH. --- src/sdk/libc/string/find_substring.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sdk/libc/string/find_substring.c b/src/sdk/libc/string/find_substring.c index 934034ed0f..93cc029df9 100644 --- a/src/sdk/libc/string/find_substring.c +++ b/src/sdk/libc/string/find_substring.c @@ -1,18 +1,18 @@ #include "types.h" -char *FindSubstring(char *search_string, char *sub) { +char *FindSubstring(char *search_string, char *target_substring) { s32 i; if (*search_string == 0) { - return *sub == 0 ? search_string : 0; + return *target_substring == 0 ? search_string : 0; } do { i = 0; while (1) { - if (sub[i] == 0) { + if (target_substring[i] == 0) { return search_string; } - if (sub[i] != search_string[i]) { + if (target_substring[i] != search_string[i]) { break; } i++; From 63b9fb74c44d99c87db476a6d93bddff8bb3912e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:48:19 +0000 Subject: [PATCH 127/758] decomp: clarify names in hud_screen_position rec -> hud_element: Retail 0x00235a70/74/84 load flags at +0x60, width at +0x58 and height at +0x5c from a0 (Ghidra param_1; source HudElem *rec). Instructions 0x00235a94-0x00235aa0 subtract half its height from *y; 0x00235ab8-0x00235acc subtract its width or half-width from *x according to those flags. Supplied draw_hud_stars and draw_uniform_size_hud_stars callers initialize the same HudElem dimensions and pass it with &x/&y before drawing, proving that rec is the HUD element being positioned. --- src/overlays/shared/ui/hud/hud_keep_visible.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/ui/hud/hud_keep_visible.c b/src/overlays/shared/ui/hud/hud_keep_visible.c index cb380c384e..73c0d799be 100644 --- a/src/overlays/shared/ui/hud/hud_keep_visible.c +++ b/src/overlays/shared/ui/hud/hud_keep_visible.c @@ -42,18 +42,18 @@ void reset_hud_animation_channels(void) { /* Offsets x/y for the element's anchor flags (centre or right/bottom alignment). */ int hud_screen_position(HudElem *rec, int *x, int *y) __asm__("FUN_L00_00235a70"); -int hud_screen_position(HudElem *rec, int *x, int *y) { - int w = rec->w; - int h = rec->h; - int flags = rec->flags; +int hud_screen_position(HudElem *hud_element, int *x, int *y) { + int w = hud_element->w; + int h = hud_element->h; + int flags = hud_element->flags; if ((flags ^ 1) & 1) { if (!(flags & 2)) { *y -= h >> 1; } } - if (!(rec->flags & 4)) { - if (rec->flags & 8) { + if (!(hud_element->flags & 4)) { + if (hud_element->flags & 8) { *x -= w; } else { *x -= w >> 1; From 93d36e263dab1bc65c098ae0cd3e4925441a6ef9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:48:19 +0000 Subject: [PATCH 128/758] decomp: clarify names in draw_hud_item_selector_panel rec -> selector_element: In the bound C, HudElem *rec supplies cnt, unk50/unk54, unk74 and w. Retail 0x002382ac preserves incoming a0 in s6; 0x002382b4/0x002382e8 and 0x0023833c read its +0x70/+0x71 fade counters, 0x00238430-0x00238448 load +0x50/+0x54 and pass the same pointer to hud_screen_position, 0x002385e4/0x00238718 read selected slot +0x74, and 0x002386ec passes it to the HUD icon renderer. Return at 0x00238ad0 reads element width +0x58. These uses prove the parameter is the selector's HUD element. --- .../ui/hud/draw_hud_item_selector_panel.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 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 ce43922d31..a629d5b983 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 @@ -429,7 +429,7 @@ extern void FUN_L00_0023b120(char *, int, int, int, int, int); int draw_hud_item_selector_panel(HudElem *rec) __asm__("FUN_L00_002382a0"); -int draw_hud_item_selector_panel(HudElem *rec) { +int draw_hud_item_selector_panel(HudElem *selector_element) { char *weapon_entry; int x, y, half_w, half_h, alpha; int marker_alpha; @@ -437,7 +437,7 @@ int draw_hud_item_selector_panel(HudElem *rec) { int color, shadow, text_y, id, item, prefix_length, text_length, j; float open, fade, angle; const char *text, *suffix; - unsigned char *counters = rec->cnt; + unsigned char *counters = selector_element->cnt; char formatted[80]; open = convert_integer_to_float(counters[0]) / @@ -464,9 +464,9 @@ int draw_hud_item_selector_panel(HudElem *rec) { angle += 0.875f; marker_alpha = truncate_float_to_s32(radius * angle); } - x = rec->unk50; - y = rec->unk54; - hud_screen_position(rec, &x, &y); + x = selector_element->unk50; + y = selector_element->unk54; + hud_screen_position(selector_element, &x, &y); half_w = D_L00_0015F718_gp / 2; half_h = D_L00_0015F71C_gp / 2; draw_hud_sprite(get_icon_frame(0xe934, 0), x, y, half_w, half_h, alpha); @@ -484,17 +484,17 @@ int draw_hud_item_selector_panel(HudElem *rec) { icon_x = x + D_L00_0015F720_gp + (int)(D_L00_0015F78C_gp * fast_cos(angle) * D_L00_0015F7C4_gp); icon_y = y + D_L00_0015F724_gp + (int)(D_L00_0015F78C_gp * fast_sin(angle)); - if (rec->unk74 == i && ((E_238C30 **)D_L00_0015FAC0)[D_L00_0015F72C_gp][i].id != 0) + if (selector_element->unk74 == i && ((E_238C30 **)D_L00_0015FAC0)[D_L00_0015F72C_gp][i].id != 0) draw_hud_sprite( get_icon_frame(0xe99c, 0), icon_x - 0x13, icon_y - 0x13, 0x26, 0x26, marker_alpha); if (((E_238C30 **)D_L00_0015FAC0)[D_L00_0015F72C_gp][i].id != 0) { int icon_alpha; - if (i != rec->unk74) + if (i != selector_element->unk74) icon_alpha = truncate_float_to_s32((float)alpha * D_L00_0015F7C0); else icon_alpha = alpha; FUN_L00_0023b120( - (char *)rec, + (char *)selector_element, get_icon_frame(((E_238C30 **)D_L00_0015FAC0)[D_L00_0015F72C_gp][i].id, ((unsigned char *)((unsigned char *)item_text_variant)) [((E_238C30 **)D_L00_0015FAC0)[D_L00_0015F72C_gp][i].item] @@ -506,7 +506,7 @@ int draw_hud_item_selector_panel(HudElem *rec) { icon_alpha); } } - selected = rec->unk74; + selected = selector_element->unk74; if (selected >= 0 && *(int *)(((char **)D_L00_0015FAC0)[D_L00_0015F72C_gp] + selected * 0x1C) != 0) { color = fast_tween_color(l00_hud_item_selector_text_shadow_color_from, @@ -548,9 +548,9 @@ int draw_hud_item_selector_panel(HudElem *rec) { text = get_help_message_text(id); } if (text == 0) - return rec->w; + return selector_element->w; if (strlen((char *)text) == 0) - return rec->w; + return selector_element->w; text_length = strlen((char *)text); suffix = text; for (j = 0; j < text_length; j++) { @@ -600,7 +600,7 @@ int draw_hud_item_selector_panel(HudElem *rec) { font_print_center(x + D_L00_0015F720_gp, text_y, shadow, (void *)text, -1); } } - return rec->w; + return selector_element->w; } extern int D_L00_0015F72C __attribute__((sda)); From 6a3ee73bee1c6814aa66d4a63eccdc7bfbc67c64 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:48:19 +0000 Subject: [PATCH 129/758] decomp: clarify names in register_pyrocitor_flame_effect val -> flame_effect: In the supplied pyrocitor_update caller (0x002b77f0), effect receives spawn_spinning_and_fading_effect_particle (0x0026b230) and is passed as argument 2 to FUN_L00_002b8798 when i == 2 && gate. Retail 0x002b8798 loads the slot backing pointer from a0+0x78; 0x002b87ac and 0x002b87d4 store argument a1 into the first zero tracked slot. This proves val carries the flame effect to register, while its existing s32 type is preserved. --- src/overlays/shared/weapons/pyrocitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/pyrocitor.c b/src/overlays/shared/weapons/pyrocitor.c index 6019a58bb8..977409751a 100644 --- a/src/overlays/shared/weapons/pyrocitor.c +++ b/src/overlays/shared/weapons/pyrocitor.c @@ -892,7 +892,7 @@ void update_pyrocitor_flame_effect_slots(char *moby) { /* Stores val in the first empty of 15 slots after the list head. */ void register_pyrocitor_flame_effect(ListSlots8 *list, s32 val) __asm__("FUN_L00_002b8798"); -void register_pyrocitor_flame_effect(ListSlots8 *list, s32 val) { +void register_pyrocitor_flame_effect(ListSlots8 *list, s32 flame_effect) { s32 *list_data = list->slots; s32 i = 0; s32 *first_slot; @@ -902,7 +902,7 @@ void register_pyrocitor_flame_effect(ListSlots8 *list, s32 val) { slot_byte_offset = i * 4; first_slot = (s32 *)((u8 *)list_data + 4); if (*(s32 *)((u8 *)first_slot + slot_byte_offset) == 0) { - *(s32 *)((u8 *)first_slot + slot_byte_offset) = val; + *(s32 *)((u8 *)first_slot + slot_byte_offset) = flame_effect; break; } i++; From 52786713c4997c0657aff6c13997ab44d6580a9e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:48:19 +0000 Subject: [PATCH 130/758] decomp: clarify names in initialize_moby_grounding val -> moby_z: The authoritative C initializes float val from MOBY(moby)->pos.z. Retail lwc1 f0,0x18(a0) at 0x0025c764 loads that position coordinate; add.S at 0x0025c768 and sub.S at 0x0025c76c apply 0.2, with stores to moby+0x88 and moby+0x84 at 0x0025c770 and 0x0025c778. Thus this local holds the moby's position Z before grounding offsets. --- src/overlays/shared/mobys/initialize_moby_grounding.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/mobys/initialize_moby_grounding.c b/src/overlays/shared/mobys/initialize_moby_grounding.c index ab83a81a17..0d2d5bd4cd 100644 --- a/src/overlays/shared/mobys/initialize_moby_grounding.c +++ b/src/overlays/shared/mobys/initialize_moby_grounding.c @@ -9,7 +9,7 @@ void initialize_moby_grounding(char *moby) __asm__("FUN_L02_0025c758"); void initialize_moby_grounding(char *moby) { float delta = 0.2f; - float val = MOBY(moby)->pos.z; - *(float *)(moby + 0x84) = val - delta; - *(float *)(moby + 0x88) = val + delta; + float moby_z = MOBY(moby)->pos.z; + *(float *)(moby + 0x84) = moby_z - delta; + *(float *)(moby + 0x88) = moby_z + delta; } From fea58febee4b6e030b880637d5aaf48f0429a324 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:48:20 +0000 Subject: [PATCH 131/758] decomp: clarify names in prepare_scaled_float_table_with_target_byte val -> target_byte: Authoritative C (SHA-256 73a20cabbaabfcc837e2000e777bc6be6813c4e74f3108661c4c0587886a7e8a) uses int val only in value_target[0x3F] = val. Retail 0x002a4058 is sb a1,0x3f(a0), storing the incoming second integer argument's low byte through the first pointer argument; original Ghidra agrees with *(undefined1 *)(param_2 + 0x3f) = param_3. The existing prepare_scaled_table_with_byte_128 wrapper supplies 0x80. This proves the target-byte role independently of the float scaling loop. --- src/overlays/shared/rendering/build_interpolated_dma_packet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/build_interpolated_dma_packet.c b/src/overlays/shared/rendering/build_interpolated_dma_packet.c index abdacb02d2..d41eef8210 100644 --- a/src/overlays/shared/rendering/build_interpolated_dma_packet.c +++ b/src/overlays/shared/rendering/build_interpolated_dma_packet.c @@ -83,12 +83,12 @@ void prepare_scaled_float_table_with_target_byte(char *value_target, int val, float scale) __asm__("FUN_L02_002a4058"); -void prepare_scaled_float_table_with_target_byte(char *value_target, int val, float scale) { +void prepare_scaled_float_table_with_target_byte(char *value_target, int target_byte, float scale) { int i; float *destination; float *source; float *source_table_start; - value_target[0x3F] = val; + value_target[0x3F] = target_byte; *(s32 *)(scaled_table_output + 0x0) = scaled_table_header_leading_word_gp; *(s32 *)(scaled_table_output + 0x4) = scaled_table_header_second_word; *(s32 *)(scaled_table_output + 0x8) = scaled_table_header_third_word; From 5678b97606fea9fc4940be3e5d228abd3354b3c0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:50:37 +0000 Subject: [PATCH 132/758] decomp: clarify names in update_camera_state_outside_clip_volume sub -> camera_config: Retail 0x002ebe00 loads the camera index from +0x84, 0x002ebe04 scales it by 32 and 0x002ebe08 adds D_L03_0015EF50. At 0x002ebe0c, lw a0,0x1c(v1) loads the pointer represented by char *sub; 0x002ebe10 reads its +0xC field into a1 as the clip-volume index, guarded at 0x002ebe14 and passed to the containment call at 0x002ebe20. The supplied initialize_hero_relative_camera uses this identical indexed +0x1C lookup as camera_config and reads configuration floats at +0x20/+0x24, supporting camera_config for this binding. --- src/overlays/l03/hero_relative_camera.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l03/hero_relative_camera.c b/src/overlays/l03/hero_relative_camera.c index 8a7d9e9d0a..f3cb0cfed1 100644 --- a/src/overlays/l03/hero_relative_camera.c +++ b/src/overlays/l03/hero_relative_camera.c @@ -208,8 +208,8 @@ void update_camera_state_outside_clip_volume(char *moby) __asm__("FUN_L03_002ebd void update_camera_state_outside_clip_volume(char *moby) { char *camera_table_entry = (char *)((*(short *)(moby + 0x84) << 5) + D_L03_0015EF50); - char *sub = *(char **)(camera_table_entry + 0x1C); - int clip_volume_index = *(int *)(sub + 0xC); + char *camera_config = *(char **)(camera_table_entry + 0x1C); + int clip_volume_index = *(int *)(camera_config + 0xC); if (clip_volume_index >= 0 && is_point_inside_clip_volume(D_0013E533 + 0xE9D, clip_volume_index) == 0) { *(short *)(moby + 0x7E) = 3; From c812e4b889711a02970481ff251947fe7c585ef7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:50:51 +0000 Subject: [PATCH 133/758] decomp: clarify names in emit_sand_shark_dust_burst D_L02_001619EC -> l02_sand_shark_dust_segment_2_3_puff_count: Retail 0x002d3df0 loads this int into a3; a1=2 at 0x002d3df8 and a2=3 at 0x002d3e00 accompany the call at 0x002d3dfc to emit_sand_shark_dust_segment. The authoritative source binds D_L02_001619EC (initialized to 10) to that fourth puff_count argument, forwarded to the along-segment puff emitter and used as its loop bound. D_L02_001619F0 -> l02_sand_shark_dust_segment_0_1_puff_count: Retail 0x002d3dd4 loads this int into a3; a1=0 at 0x002d3ddc and a2=1 at 0x002d3dec accompany the call at 0x002d3de8 to emit_sand_shark_dust_segment. The authoritative source binds D_L02_001619F0 (initialized to 10) to that fourth puff_count argument, forwarded to the along-segment puff emitter and used as its loop bound. D_L02_001619F4 -> l02_sand_shark_dust_segments_4_5_and_6_7_puff_count: Retail loads the same gp slot into a3 at 0x002d3e04 and 0x002d3e18 for calls at 0x002d3e10 and 0x002d3e24 with endpoint indices 4/5 and 6/7 respectively. The source identifies that shared int as D_L02_001619F4, initialized to 8; both uses supply emit_sand_shark_dust_segment's fourth puff_count argument, subsequently used as the along-segment emission loop bound. D_L02_001619F8 -> l02_sand_shark_dust_segment_8_9_puff_count: Retail 0x002d3e2c loads this int into a3; a1=8 at 0x002d3e34 and a2=9 at 0x002d3e3c accompany the call at 0x002d3e38 to emit_sand_shark_dust_segment. The authoritative source binds D_L02_001619F8 (initialized to 8) to that fourth puff_count argument, forwarded to the along-segment puff emitter and used as its loop bound. --- src/overlays/l02/mobys/sand_shark.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index db44b3178b..943b47457d 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -167,18 +167,18 @@ void emit_sand_shark_dust_segment(struct Moby *moby, extern void emit_sand_shark_dust_segment(struct Moby *moby, int a, int b, int d) __asm__("FUN_L02_002d3c98"); -int D_L02_001619EC = 0xa; -int D_L02_001619F0 = 0xa; -int D_L02_001619F4 = 8; -int D_L02_001619F8 = 8; +int l02_sand_shark_dust_segment_2_3_puff_count __asm__("D_L02_001619EC") = 0xa; +int l02_sand_shark_dust_segment_0_1_puff_count __asm__("D_L02_001619F0") = 0xa; +int l02_sand_shark_dust_segments_4_5_and_6_7_puff_count __asm__("D_L02_001619F4") = 8; +int l02_sand_shark_dust_segment_8_9_puff_count __asm__("D_L02_001619F8") = 8; void emit_sand_shark_dust_burst(void *moby) __asm__("FUN_L02_002d3dd0"); void emit_sand_shark_dust_burst(void *moby) { - emit_sand_shark_dust_segment(moby, 0, 1, D_L02_001619F0); - emit_sand_shark_dust_segment(moby, 2, 3, D_L02_001619EC); - emit_sand_shark_dust_segment(moby, 4, 5, D_L02_001619F4); - emit_sand_shark_dust_segment(moby, 6, 7, D_L02_001619F4); - emit_sand_shark_dust_segment(moby, 8, 9, D_L02_001619F8); + emit_sand_shark_dust_segment(moby, 0, 1, l02_sand_shark_dust_segment_0_1_puff_count); + emit_sand_shark_dust_segment(moby, 2, 3, l02_sand_shark_dust_segment_2_3_puff_count); + emit_sand_shark_dust_segment(moby, 4, 5, l02_sand_shark_dust_segments_4_5_and_6_7_puff_count); + emit_sand_shark_dust_segment(moby, 6, 7, l02_sand_shark_dust_segments_4_5_and_6_7_puff_count); + emit_sand_shark_dust_segment(moby, 8, 9, l02_sand_shark_dust_segment_8_9_puff_count); } /* pvars of the Aridia enemy sand_shark_update updates (it leaves its burrow, walks, jumps and digs back in). */ From f90176734a3d4cf92e45b472bcaab3b5175ff9e4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:50:51 +0000 Subject: [PATCH 134/758] decomp: clarify names in set_transform_state_three_when_outside_clip_volume sub -> clip_volume_subrecord: Retail 0x002e899c-0x002e89a8 selects the level-table entry at D_L03_0015EF50 using signed short moby+0x84 with stride 0x20. At 0x002e89b0, lw v0,0x1c(v1) loads the pointer represented by source local sub; at 0x002e89b8, lw a1,0xc(v0) passes that subrecord's clip-volume index to is_point_inside_clip_volume (jal 0x0024e3a8 at 0x002e89bc). Thus this is the clip-volume subrecord selected through level_table_entry, rather than the volume index itself. --- src/overlays/shared/camera/clip_volume_camera.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/camera/clip_volume_camera.c b/src/overlays/shared/camera/clip_volume_camera.c index 505c1d8c1a..1b636281ad 100644 --- a/src/overlays/shared/camera/clip_volume_camera.c +++ b/src/overlays/shared/camera/clip_volume_camera.c @@ -135,9 +135,9 @@ void set_transform_state_three_when_outside_clip_volume(char *moby) __asm__("FUN void set_transform_state_three_when_outside_clip_volume(char *moby) { char *level_table_entry = (char *)(D_L03_0015EF50 + (*(short *)(moby + 0x84) << 5)); - char *sub = *(char **)(level_table_entry + 0x1C); + char *clip_volume_subrecord = *(char **)(level_table_entry + 0x1C); if (*(int *)(moby + 0x74) == 4) { - if (is_point_inside_clip_volume(D_0013E533 + 0xE9D, *(int *)(sub + 0xC)) == 0) { + if (is_point_inside_clip_volume(D_0013E533 + 0xE9D, *(int *)(clip_volume_subrecord + 0xC)) == 0) { *(short *)(moby + 0x7E) = 3; } } From eb505857f8e777a525cdea74707396e2dc4f753f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:51:02 +0000 Subject: [PATCH 135/758] decomp: clarify names in puff_emitter_update D_L15_0016219C -> l15_puff_emission_random_range: The bound source declares int D_L15_0016219C = 3 and uses random_integer_below(D_L15_0016219C - 1) == 0 as the puff-emission gate. Retail 0x002eb92c loads the global from gp-0x4a64; 0x002eb940 subtracts one into a0; 0x002eb944 calls the random-integer helper; 0x002eb94c skips emission on a nonzero result. Only the zero path reaches the effect call at 0x002eb9c4. Thus this level-15 global controls the puff emission random range; no precise probability convention is asserted. --- src/overlays/l15/mobys/puff_emitter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l15/mobys/puff_emitter.c b/src/overlays/l15/mobys/puff_emitter.c index 37407f2af6..b038c56d35 100644 --- a/src/overlays/l15/mobys/puff_emitter.c +++ b/src/overlays/l15/mobys/puff_emitter.c @@ -11,7 +11,7 @@ extern void FUN_L00_0026f080(float, float, char *, float *); extern short vertical_effect_motion_scale_gp __asm__("D_L15_00162198") __attribute__((sda)); -int D_L15_0016219C = 3; +int l15_puff_emission_random_range __asm__("D_L15_0016219C") = 3; void puff_emitter_update(struct Moby *moby) __asm__("FUN_L15_002eb928"); @@ -19,7 +19,7 @@ void puff_emitter_update(struct Moby *moby) __asm__("FUN_L15_002eb928"); void puff_emitter_update(struct Moby *moby) { float vertical_motion_vector[4]; float *effect_height_setting = (float *)moby->pvars; - if (random_integer_below(D_L15_0016219C - 1) == 0) { + if (random_integer_below(l15_puff_emission_random_range - 1) == 0) { char *pos = &moby->pos; clear_u64_value(vertical_motion_vector); vertical_motion_vector[2] = random_float_between(0.75f, 1.5f) * From 22bd63f9cc46866b78c3a3f3fcbcd7cce6a4892a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 03:51:12 +0000 Subject: [PATCH 136/758] decomp: clarify names in update_racer_path_and_weapon D_L14_00161A3C -> l14_racer_weapon_aim_duration_frames: Bound src/overlays/l14/mobys/racer_path_and_weapon.c SHA-256 ce17cd856394c6f972fef6eb3e7c3261614df75731f73d06630d8610d425c6ea defines int D_L14_00161A3C = 0x8c. Retail 0x002d6a2c-0x002d6a34 loads this binding via gp-0x51c4, calls scale_game_frames and stores its result into pvars+0x1C0 (aim_timer) when command 1 starts command 2. At 0x002d6b0c-0x002d6b2c the same configured count is scaled and converted to float as the denominator of remaining aim_timer fraction, which interpolates sampled weapon aim path distance at 0x002d6b30-0x002d6b64. At 0x002d6e78-0x002d6e8c aim_timer is decremented and expiration selects command 4. Thus this scalar configures the aim duration in frames before frame scaling; preserve assembler identity D_L14_00161A3C and stored value 0x8c. --- src/overlays/l14/mobys/racer_path_and_weapon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l14/mobys/racer_path_and_weapon.c b/src/overlays/l14/mobys/racer_path_and_weapon.c index 4d832b245e..dd68f72340 100644 --- a/src/overlays/l14/mobys/racer_path_and_weapon.c +++ b/src/overlays/l14/mobys/racer_path_and_weapon.c @@ -268,7 +268,7 @@ typedef struct { int pad[3]; } Ray_67e8; -int D_L14_00161A3C = 0x8c; +int l14_racer_weapon_aim_duration_frames __asm__("D_L14_00161A3C") = 0x8c; #include "rnc/overlay/l14/mobys/racer_path_and_weapon_data/update_racer_path_and_weapon.h" @@ -343,7 +343,7 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { racer_moby->command = 1; } if (racer_moby->command == 1) { - moby_data->aim_timer = scale_game_frames(D_L14_00161A3C); + moby_data->aim_timer = scale_game_frames(l14_racer_weapon_aim_duration_frames); moby_data->unk1C4 = 0; racer_moby->command = 2; build_moby_bone_transform(racer_moby, 4, joint_transform_and_aim_vectors); @@ -365,7 +365,7 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { build_moby_bone_transform(racer_moby, 0, moby_data->bone_transform); blend = 1.0f; aim_timer_fraction = convert_integer_to_float(moby_data->aim_timer) / - convert_integer_to_float(scale_game_frames(D_L14_00161A3C)); + convert_integer_to_float(scale_game_frames(l14_racer_weapon_aim_duration_frames)); k = weapon_aim_final_path_step; ti = ((RacerSeg_67e8 *)moby_data)->seg; tf = ((RacerSeg_67e8 *)moby_data)->frac; From 88ab3557e386b3fbf84c395ed92f7cd3eb47afb8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:00:21 +0000 Subject: [PATCH 137/758] decomp: clarify names in apply_camera_shake val -> applied_shake_offset: In src/camera/apply_camera_shake.c (SHA-256 c150a3678b8fa186c3daab818013b35e5492ae35af1bc6da8aa4a4c068a37905), val is shake->unk0 * oscillation_cosine * remaining_frame_ratio squared. Retail 0x001ed3f8-0x001ed404 computes that signed scalar in f12; 0x001ed40c stores it at state offset 4 (Ghidra flApplied_offset). Calls at 0x001ed418/0x001ed430 use it with the selected camera basis to produce the stack vector added to camera_position at 0x001ed444. Thus applied_shake_offset identifies the scalar camera displacement rather than the existing shake_offset vector. --- src/camera/apply_camera_shake.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/camera/apply_camera_shake.c b/src/camera/apply_camera_shake.c index 17867fcf2e..93971aadbf 100644 --- a/src/camera/apply_camera_shake.c +++ b/src/camera/apply_camera_shake.c @@ -26,7 +26,7 @@ void apply_camera_shake(struct CameraShake *shake, s32 axis_index) { f32 total_frames_float; f32 remaining_frame_ratio; f32 oscillation_cosine; - f32 val; + f32 applied_shake_offset; s32 remaining_frames; if (cur_cam[0] != 0 && cur_cam[0]->unk86 == 6) { @@ -44,12 +44,12 @@ void apply_camera_shake(struct CameraShake *shake, s32 axis_index) { remaining_frame_ratio = remaining_frames_float / total_frames_float; oscillation_cosine = fast_cos(fast_normalize_angle(2.0f * convert_integer_to_float(shake->unk8))); - val = shake->unk0 * oscillation_cosine * remaining_frame_ratio * remaining_frame_ratio; - shake->unk4 = val; + applied_shake_offset = shake->unk0 * oscillation_cosine * remaining_frame_ratio * remaining_frame_ratio; + shake->unk4 = applied_shake_offset; if (axis_index == 0) { - fast_vec_normalize(shake_offset, D_001872B0, val); + fast_vec_normalize(shake_offset, D_001872B0, applied_shake_offset); } else { - fast_vec_normalize(shake_offset, camera_rows, val); + fast_vec_normalize(shake_offset, camera_rows, applied_shake_offset); } fast_vec_add(camera_position, camera_position, shake_offset); } else { From fac2a7ff08d0c6fba4f17e0525ad4a2cbcf879a2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:02:56 +0000 Subject: [PATCH 138/758] decomp: clarify names in request_grouped_voice rec -> allocated_voice_slot: In the authoritative C, rec is char * initialized only after voice_slot_index >= 0 as voice_pool + voice_slot_index * 0x70. Retail 0x0028def0-0x0028def4 checks the allocator return, 0x0028df00 multiplies that slot index by 0x70, and 0x0028defc/0x0028df04/0x0028df08 add voice_pool at 0x0013e550. Stores at 0x0028df0c and 0x0028df10 then write voice_definition_index and voice_moby at pointer offsets +0x7e and +0x88. Thus it addresses the successfully allocated voice slot. --- src/overlays/shared/audio/voices/play_voice.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/audio/voices/play_voice.c b/src/overlays/shared/audio/voices/play_voice.c index 6f2adca5ba..5a9a5349a3 100644 --- a/src/overlays/shared/audio/voices/play_voice.c +++ b/src/overlays/shared/audio/voices/play_voice.c @@ -61,9 +61,9 @@ int request_grouped_voice(int voice_group_index, voice_slot_index = allocate_voice_slot( D_L00_0015F5F4 + voice_definition_index * 32, voice_flags, voice_moby, 0, 0x400); if (voice_slot_index >= 0) { - char *rec = voice_pool + voice_slot_index * 0x70; - *(int *)(rec + 0x88) = voice_moby; - *(short *)(rec + 0x7E) = voice_definition_index; + char *allocated_voice_slot = voice_pool + voice_slot_index * 0x70; + *(int *)(allocated_voice_slot + 0x88) = voice_moby; + *(short *)(allocated_voice_slot + 0x7E) = voice_definition_index; } return voice_slot_index; } From cfc44709e6cbeacd2fc164b4d5b1ee94a47e9769 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:02:57 +0000 Subject: [PATCH 139/758] decomp: clarify names in build_pause_item_list rec -> menu_item_definition: Authoritative source binds MenuItemInfo *rec to &menu_item_info[id], reads rec->unk38 into pause_item_entry->a and selects rec->unk42 or rec->unk40 for pause_item_variant_values[item_count]. Retail 0x00221634/0x00221648 multiply the candidate item ID by 0x4c; 0x00221610/0x00221650 add definition base 0x001863d0 to form a3. Loads at 0x0022166c, 0x00221684 and 0x00221688 use this pointer at offsets 0x38, 0x42 and 0x40. Original Ghidra identifies the same indexed source as g_pVendorItemDefinitions, including its icon texture group field. --- src/ui/menus/pause/build_pause_item_list.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/menus/pause/build_pause_item_list.c b/src/ui/menus/pause/build_pause_item_list.c index 2b2881ba6c..51107d772e 100644 --- a/src/ui/menus/pause/build_pause_item_list.c +++ b/src/ui/menus/pause/build_pause_item_list.c @@ -29,15 +29,15 @@ int build_pause_item_list(void) { int id = pause_item_candidate_entries[i].id; if (item_available[id] != 0) { Item0A *pause_item_entry = &pause_item_list_entries[item_count]; - MenuItemInfo *rec = &menu_item_info[id]; + MenuItemInfo *menu_item_definition = &menu_item_info[id]; unsigned char b = item_text_variant[id]; int has_text_variant = b != 0; - pause_item_entry->a = rec->unk38; + pause_item_entry->a = menu_item_definition->unk38; pause_item_entry->b = has_text_variant << 2; pause_item_entry->c = 0; pause_item_entry->id = id; pause_item_entry->idx = i; - pause_item_variant_values[item_count] = b ? rec->unk42 : rec->unk40; + pause_item_variant_values[item_count] = b ? menu_item_definition->unk42 : menu_item_definition->unk40; item_count++; } } From 5df4fc48f419a001245fbcbfe9d8fa3f4a2cbc81 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:02:57 +0000 Subject: [PATCH 140/758] decomp: clarify names in volume_camera_aim_active rec -> current_follow_camera_record: In the bound source snapshot (SHA-256 36e05615d65930e9cf7b8f0f9c471c4bfcb49d36036002aceb186e94cf2db2fa), struct UpdateCam *rec is initialized from current_follow_cam and supplies FOLLOW_CAM_STATE(rec) and rec->unk86. Retail 0x002ed360 loads that global at 0x00166e00 into a1; 0x002ed370 loads its state pointer at +0x70 and 0x002ed37c reads its +0x86 gate. This is separate from incoming aim_camera_record, whose +0x84 descriptor index is read at 0x002ed364. Thus the binding is the current follow-camera record, not the incoming aim-camera record. --- 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 9ae168d050..f9be6deb8c 100644 --- a/src/overlays/shared/camera/aim_volume_camera.c +++ b/src/overlays/shared/camera/aim_volume_camera.c @@ -49,12 +49,12 @@ extern u8 D_001413F4 __asm__("D_001413F4") NOT_SDA; s32 volume_camera_aim_active(struct UpdateCam *cam) __asm__("FUN_L00_002ed348"); s32 volume_camera_aim_active(struct UpdateCam *aim_camera_record) { - struct UpdateCam *rec = current_follow_cam; + struct UpdateCam *current_follow_camera_record = current_follow_cam; AimCameraParams *params = camera_descriptors[aim_camera_record->descriptor_index].params; - FollowCamState *state = FOLLOW_CAM_STATE(rec); + FollowCamState *state = FOLLOW_CAM_STATE(current_follow_camera_record); FollowCamTail *tail = &state->tail; FollowCamFlags *ctl = &state->tail.ctl; - if (rec->unk86 != 0) + if (current_follow_camera_record->unk86 != 0) return 0; if (params->only_in_mode_1 != 0 && D_001413F4 != 1) return 0; From f67335362903b57b374f9ad81d4bc4835fb2c4c6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:03:10 +0000 Subject: [PATCH 141/758] decomp: clarify names in bombthrower_grass_update D_L10_00161BF0 -> l10_bombthrower_grass_launch_delay_min_frames: Authoritative bombthrower_grass.c snapshot SHA-256 4aab2ffff139f756bcb963c8f2ca29fad9eb579cb6113f20b1c74f0c56817c28 defines this int as 240 and supplies it as the first/lower argument of random_int_between. Retail 0x002d8c30 and 0x002d8cf0 load it from -0x5010(gp) into a0, paired with the upper bound in a1. At 0x002d8c3c-0x002d8c44 and 0x002d8cfc-0x002d8d04 the random frame count is passed through scale_game_frames and stored in the pvars launch_timer. fast_dec_timer at 0x002d8c50 gates projectile launch, proving this is the minimum launch delay in input game frames. Original Ghidra shows the same uGpffffaff0 bound and timer stores. D_L10_00161BF4 -> l10_bombthrower_grass_launch_delay_max_frames: Authoritative bombthrower_grass.c snapshot SHA-256 4aab2ffff139f756bcb963c8f2ca29fad9eb579cb6113f20b1c74f0c56817c28 defines this int as 600 and supplies it as the second/upper argument of random_int_between. Retail 0x002d8c38 and 0x002d8cf8 load it from -0x500c(gp) into a1 for the random calls at 0x002d8c34 and 0x002d8cf4. Their results are scaled by scale_game_frames and stored into the same launch countdown at 0x002d8c44 and 0x002d8d04, once during initialization and again after projectile spawn at 0x002d8cd8. Original Ghidra confirms uGpffffaff4 is the paired upper bound, proving the maximum launch delay in input game frames. --- src/overlays/l10/mobys/bombthrower_grass.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l10/mobys/bombthrower_grass.c b/src/overlays/l10/mobys/bombthrower_grass.c index 97781d1be4..1d0d286a8d 100644 --- a/src/overlays/l10/mobys/bombthrower_grass.c +++ b/src/overlays/l10/mobys/bombthrower_grass.c @@ -19,8 +19,8 @@ extern int spawn_bombthrower_grass_projectile() __asm__("FUN_L10_002d8058"); -int D_L10_00161BF0 = 240; -int D_L10_00161BF4 = 600; +int l10_bombthrower_grass_launch_delay_min_frames __asm__("D_L10_00161BF0") = 240; +int l10_bombthrower_grass_launch_delay_max_frames __asm__("D_L10_00161BF4") = 600; #include "rnc/overlay/l10/mobys/bombthrower_grass_globals.h" @@ -86,7 +86,7 @@ void bombthrower_grass_update(struct Moby *moby) { float launch_position[4]; if (moby->state == BOMBTHROWER_GRASS_STATE_LAUNCH_TIMER_UNINITIALIZED) { *(int *)launch_timer = - scale_game_frames(random_int_between(D_L10_00161BF0, D_L10_00161BF4)); + scale_game_frames(random_int_between(l10_bombthrower_grass_launch_delay_min_frames, l10_bombthrower_grass_launch_delay_max_frames)); moby->state = BOMBTHROWER_GRASS_STATE_LAUNCH_TIMER_INITIALIZED; } if (fast_dec_timer((int *)launch_timer)) { @@ -106,6 +106,6 @@ void bombthrower_grass_update(struct Moby *moby) { spawn_bombthrower_grass_projectile(moby, launch_position, launch_offset); allocate_voice_for_target_entry(0, 0, (int)moby); *(int *)launch_timer = - scale_game_frames(random_int_between(D_L10_00161BF0, D_L10_00161BF4)); + scale_game_frames(random_int_between(l10_bombthrower_grass_launch_delay_min_frames, l10_bombthrower_grass_launch_delay_max_frames)); } } From 344c9675d5787bcb90b3587626840a0bb5f71301 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:03:22 +0000 Subject: [PATCH 142/758] decomp: clarify names in try_fire_ship_projectile D_L11_00162068 -> l11_ship_projectile_cooldown_frames: Bound source src/overlays/l11/mobys/jet_fighter.c SHA-256 3547469b3cdafa8a086c90dd70cbc1e47b10b32c5e883bee73eb4173a7881e85 defines this int as 30 and assigns it to ship_vars+0x84 only when spawn_ship_rocket succeeds. Original retail 0x00312714..0x00312728 decrements/tests that timer before firing; 0x003127E0..0x003127E8 checks spawn success, then 0x00312800 loads the global at gp-0x4B98 and 0x0031280C stores it to +0x84. The flight update calls this routine each frame, establishing a projectile cooldown reload in frames. The l11 qualifier preserves overlay ownership context. --- 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 0a2d5e6fac..0e7cf6fdf4 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -659,7 +659,7 @@ void update_ship_shot_firing_and_reticle(struct Moby *moby, extern int spawn_ship_rocket(void *, void *, int, void *, float, int) __asm__("FUN_L11_00309378"); extern short ship_projectile_base_scale_gp __asm__("D_L11_00162064") __attribute__((sda)); -int D_L11_00162068 = 30; +int l11_ship_projectile_cooldown_frames __asm__("D_L11_00162068") = 30; void try_fire_ship_projectile(struct Moby *moby, char *ship_vars) __asm__("FUN_L11_003126f8"); void try_fire_ship_projectile(struct Moby *moby, char *ship_vars) { @@ -685,7 +685,7 @@ void try_fire_ship_projectile(struct Moby *moby, char *ship_vars) { scale_game_frames(300))) { allocate_voice_for_target_entry(2, 0, (int)moby); hero.ship_ammo -= 1; - *(int *)(ship_vars + 0x84) = D_L11_00162068; + *(int *)(ship_vars + 0x84) = l11_ship_projectile_cooldown_frames; } } } From f14b2bf532afaa5be7981e0f9fb2ef45a3993a00 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:03:33 +0000 Subject: [PATCH 143/758] decomp: clarify names in try_fire_fighter_jet_rocket D_L17_00162078 -> l17_fighter_jet_rocket_cooldown_reload: Authoritative fighter_jet.c defines this int as 30 and assigns it to *(int *)(ship_vars + 0x84) only inside the successful spawn_fighter_jet_rocket branch. Retail 0x002ec16c-0x002ec180 passes s2+0x84 to fast_dec_timer and exits when not ready; after the constructor call at 0x002ec21c succeeds (branch 0x002ec224), 0x002ec23c loads this binding from -0x4b88(gp), and 0x002ec248 stores it to 0x84(s2), alongside the one-ammo decrement. Original Ghidra likewise assigns uGpffffb478 to iVar4+0x84 on success, proving rocket cooldown reload. --- src/overlays/l17/mobys/fighter_jet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l17/mobys/fighter_jet.c b/src/overlays/l17/mobys/fighter_jet.c index 7c16fc8de5..d2d9378904 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -1018,7 +1018,7 @@ extern int spawn_fighter_jet_rocket(void *, void *, int, void *, float, int) __asm__("FUN_L13_002e6a58"); extern short fighter_jet_rocket_base_scale_gp __asm__("D_L17_00162074") __attribute__((sda)); -int D_L17_00162078 = 30; +int l17_fighter_jet_rocket_cooldown_reload __asm__("D_L17_00162078") = 30; void try_fire_fighter_jet_rocket(char *moby, char *ship_vars) __asm__("FUN_L17_002ec150"); void try_fire_fighter_jet_rocket(char *moby, char *ship_vars) { @@ -1046,7 +1046,7 @@ void try_fire_fighter_jet_rocket(char *moby, char *ship_vars) { scaled_frame_count)) { allocate_voice_for_target_entry(2, 0, (int)moby); hero.ship_ammo -= 1; - *(int *)(ship_vars + 0x84) = D_L17_00162078; + *(int *)(ship_vars + 0x84) = l17_fighter_jet_rocket_cooldown_reload; } } } From 195ffd387e3914438cbb1d8638bce652cfbccc4b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:03:33 +0000 Subject: [PATCH 144/758] decomp: clarify names in camera_activation_check_priority rec -> candidate_descriptor_entry: Source binds CamRec20 *rec to &D_0015EF90[candidate->descriptor_index]. Retail 0x001ec370 loads candidate +0x84, 0x001ec378 loads the descriptor-table base, and 0x001ec37c-0x001ec380 scales the index by 0x20 and forms the selected entry address. At 0x001ec384 the entry's +0x1C pointer is loaded, then 0x001ec388 reads descriptor +0x24 as secondary_descriptor_index. Original Ghidra uses g_pCameraDescriptorTable with candidate->nDescriptor_index * 0x20 + 0x1c, confirming this is the candidate descriptor entry, not the secondary entry or pointed descriptor bytes. --- src/camera/camera_activation_check_priority.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/camera/camera_activation_check_priority.c b/src/camera/camera_activation_check_priority.c index c957200651..6cfe86eaa1 100644 --- a/src/camera/camera_activation_check_priority.c +++ b/src/camera/camera_activation_check_priority.c @@ -101,8 +101,8 @@ int camera_activation_check_priority(struct UpdateCam *candidate, struct UpdateC return 1; } { - CamRec20 *rec = &D_0015EF90[candidate->descriptor_index]; - int secondary_descriptor_index = *(int *)((char *)rec->unk1C + 0x24); + CamRec20 *candidate_descriptor_entry = &D_0015EF90[candidate->descriptor_index]; + int secondary_descriptor_index = *(int *)((char *)candidate_descriptor_entry->unk1C + 0x24); if (secondary_descriptor_index < 0 || (hero_state->rail_spline == D_0015EF40[secondary_descriptor_index].unk10 && From 6b068d5b3568ad045268fb40d51ba3ef2c767128 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:05:55 +0000 Subject: [PATCH 145/758] decomp: clarify names in update_item_preview_moby rec -> selected_item_info: In the authoritative source rec = &menu_item_info[selected_item_id] and want = rec->preview_class. Retail 0x0021dfd0 loads the selected grid cell's signed ID; 0x0021dfe0-0x0021dff4 multiplies it by the 0x4c MenuItemInfo stride and adds table base 0x001863d0; 0x0021dff8 reads the short preview_class at entry+0x3a. Original Ghidra likewise indexes g_pVendorItemDefinitions by the selected group ID and reads aUnresolved_3a. Thus this pointer identifies the selected item's information entry supplying the preview class. --- src/ui/menus/item_preview/update_item_preview_moby.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/menus/item_preview/update_item_preview_moby.c b/src/ui/menus/item_preview/update_item_preview_moby.c index 07305e0d1e..bc5eb8944c 100644 --- a/src/ui/menus/item_preview/update_item_preview_moby.c +++ b/src/ui/menus/item_preview/update_item_preview_moby.c @@ -20,12 +20,12 @@ int update_item_preview_moby(struct MenuScreen *menu) { struct MenuScreen *grid = menu_system.current->focus; int selected_item_id = grid->data.grid.cells[grid->data.grid.selected_cell].id; short current_preview_class; - MenuItemInfo *rec; + MenuItemInfo *selected_item_info; short want; current_preview_class = menu->data.preview.moby != 0 ? menu->data.preview.moby->oclass : -1; - rec = &menu_item_info[selected_item_id]; - want = rec->preview_class; + selected_item_info = &menu_item_info[selected_item_id]; + want = selected_item_info->preview_class; if (want != -1 && current_preview_class == -1) { struct Moby *spawned_moby = create_menu_preview_moby(want); From 2617b3222148e9411ce10a0e74f75d13312a83b2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:06:06 +0000 Subject: [PATCH 146/758] decomp: clarify names in fire_blarg_turret_projectile D_L13_0016138C -> l13_blarg_turret_fire_interval_frames: Authoritative blarg_turret.c defines this int as 2 and gates all projectile creation on frame_count % D_L13_0016138C == 0. Original Ghidra uses iGpffffa78c as the divisor of iRam0015f5cc. Retail 0x002b47a4 loads the global; 0x002b47b4-0x002b47b8 load frame_count, 0x002b47c0 divides, 0x002b47d8 reads the remainder, and 0x002b47dc skips the firing body when nonzero. Thus this level-13 global specifies the firing interval in frames, preserving its int type, initial value 2 and original assembler identity. --- src/overlays/l13/mobys/blarg_turret.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l13/mobys/blarg_turret.c b/src/overlays/l13/mobys/blarg_turret.c index 13bdcc705c..b0db1480f3 100644 --- a/src/overlays/l13/mobys/blarg_turret.c +++ b/src/overlays/l13/mobys/blarg_turret.c @@ -267,7 +267,7 @@ void blarg_turret_update(Moby_2B5368 *turret_moby) { extern float blarg_turret_launch_displacement_scale_gp __asm__("D_L13_00161388") __attribute__((sda)); -int D_L13_0016138C = 2; +int l13_blarg_turret_fire_interval_frames __asm__("D_L13_0016138C") = 2; void fire_blarg_turret_projectile(struct Moby *moby) __asm__("FUN_L13_002b47a0"); @@ -277,7 +277,7 @@ void fire_blarg_turret_projectile(struct Moby *moby) { char *blarg_turret_vars; float target_distance, x, projectile_yaw; blarg_turret_vars = (char *)moby->pvars; - if (frame_count % D_L13_0016138C == 0) { + if (frame_count % l13_blarg_turret_fire_interval_frames == 0) { moby_point_position(moby, 0, projectile_spawn_position); target_distance = vector_distance_xy(&moby->pos, *(char **)(blarg_turret_vars + 0x40) + 0x10); From d997907805c27e11cbd34989a0e2eb94c59ac049 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:06:18 +0000 Subject: [PATCH 147/758] decomp: clarify names in initialize_gemlik_trail D_L13_00161E84 -> l13_gemlik_trail_lifetime_frames: The bound C defines this int as 150 and passes it to scale_game_frames before storing the result at moby->pvars+0x1FC. Retail 0x003094AC loads uGpffffb284 into a0 in the delay slot of the scale_game_frames call at 0x003094A8; 0x003094B0-0x003094C8 converts the returned integer to float and stores it at +0x1FC. Original Ghidra shows the same flow. Supplied update_gemlik_trail reads that location as anchor.w, converts it to timer, decrements it, writes it back, and returns when zero, proving this scalar configures trail lifetime in frames. --- src/overlays/l13/mobys/blarg_space_commando.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l13/mobys/blarg_space_commando.c b/src/overlays/l13/mobys/blarg_space_commando.c index 678d09fa32..aa822d10e9 100644 --- a/src/overlays/l13/mobys/blarg_space_commando.c +++ b/src/overlays/l13/mobys/blarg_space_commando.c @@ -802,7 +802,7 @@ extern char gemlik_trail_direction_source[] __asm__("D_L13_00174180"); extern float gemlik_trail_spread_degrees_gp __asm__("D_L13_00161E80") __attribute__((sda)); -int D_L13_00161E84 = 150; +int l13_gemlik_trail_lifetime_frames __asm__("D_L13_00161E84") = 150; void initialize_gemlik_trail(struct Moby *moby) __asm__("FUN_L13_00309370"); @@ -826,7 +826,7 @@ void initialize_gemlik_trail(struct Moby *moby) { *(float *)(moby_vars + 0x21C + i * 16) = 1.0f; } } - *(float *)(moby_vars + 0x1FC) = scale_game_frames(D_L13_00161E84); + *(float *)(moby_vars + 0x1FC) = scale_game_frames(l13_gemlik_trail_lifetime_frames); } extern float approach_value(float *, float, float) __asm__("FUN_00213ed8"); From 0b24bf3002b580813d524a54d8e7ae9b3ea10d34 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:06:31 +0000 Subject: [PATCH 148/758] decomp: clarify names in emit_path_walker_particle D_L16_00161E98 -> l16_path_walker_particle_initial_color: The source initializes this owned int to packed color 0x60d0d080. Retail 0x002e7b60 loads it into a2 for emitter 0x00268310; 0x00268334 preserves a2 in s3, 0x00268370 writes s3 to the newly allocated type-0x16 particle's +4 color field, and 0x002683c8 copies the same initial color to particle+0x30. This agrees with the supplied emitter annotation identifying color initialization; the name describes its initial color role without asserting channel order. --- src/overlays/l16/mobys/path_walker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l16/mobys/path_walker.c b/src/overlays/l16/mobys/path_walker.c index cf0064da82..6000bd4a8a 100644 --- a/src/overlays/l16/mobys/path_walker.c +++ b/src/overlays/l16/mobys/path_walker.c @@ -201,7 +201,7 @@ extern char D_L16_001671C0[]; extern void func_L00_0026DD70_emit(void *, void *, int, int, float, int) __asm__("FUN_L00_0026ced0"); -int D_L16_00161E98 = 0x60d0d080; +int l16_path_walker_particle_initial_color __asm__("D_L16_00161E98") = 0x60d0d080; int D_L16_00161E9C = 0x801000; extern float path_walker_particle_movement_velocity_scale_gp __asm__("D_L16_00161EA0") __attribute__((sda)); @@ -238,7 +238,7 @@ void emit_path_walker_particle(unsigned char *source_moby, void *previous_positi final_size = path_walker_particle_target_scalar_scale_gp; final_size *= 210000.0f; func_L00_0026DD70_emit( - offset, velocity, D_L16_00161E98, D_L16_00161E9C, final_size, scale_game_frames(0x23)); + offset, velocity, l16_path_walker_particle_initial_color, D_L16_00161E9C, final_size, scale_game_frames(0x23)); } /* Start of a walker group: lists the group's mobys and spaces them along the path in random order. */ From 97763d9ec428490e851a0b8d8833efe0ab674195 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:08:48 +0000 Subject: [PATCH 149/758] decomp: clarify names in evaluate_clip_volume_candidate sub -> candidate_clip_volume_subrecord: Retail 0x002e8890-0x002e889c uses candidate_object's signed +0x84 index shifted by 5 to select a level-table entry; 0x002e88a4 loads its +0x1C pointer into s0 (source sub). At 0x002e88d0 and 0x002e88e4, *(s0+0xC) supplies the volume argument to both is_point_inside_clip_volume calls. The supplied neighboring set_transform_state_three_when_outside_clip_volume source names the same entry+0x1C / subrecord+0xC chain clip_volume_subrecord. Thus this is the candidate-selected clip-volume subrecord, not the volume index itself. --- 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 1b636281ad..913f8b6567 100644 --- a/src/overlays/shared/camera/clip_volume_camera.c +++ b/src/overlays/shared/camera/clip_volume_camera.c @@ -107,7 +107,7 @@ int evaluate_clip_volume_candidate(char *candidate_object, int evaluate_clip_volume_candidate(char *candidate_object, char *comparison_object) { char *candidate_level_table_entry = (char *)(D_L03_0015EF50 + (*(short *)(candidate_object + 0x84) << 5)); - char *sub = *(char **)(candidate_level_table_entry + 0x1C); + char *candidate_clip_volume_subrecord = *(char **)(candidate_level_table_entry + 0x1C); char *global_state_base; int five; if (*(int *)(candidate_object + 0x74) != 4) @@ -116,8 +116,8 @@ int evaluate_clip_volume_candidate(char *candidate_object, char *comparison_obje !(*(unsigned char *)(candidate_object + 0x7C) > *(unsigned char *)(comparison_object + 0x7C))) return 0; - if (is_point_inside_clip_volume(D_0013E533 + 0xE9D, *(int *)(sub + 0xC)) != 0) { - if (is_point_inside_clip_volume(D_L03_00166EC0, *(int *)(sub + 0xC)) != 0) + if (is_point_inside_clip_volume(D_0013E533 + 0xE9D, *(int *)(candidate_clip_volume_subrecord + 0xC)) != 0) { + if (is_point_inside_clip_volume(D_L03_00166EC0, *(int *)(candidate_clip_volume_subrecord + 0xC)) != 0) return 1; global_state_base = D_L03_00166EC0 - 0x140; five = *(int *)(global_state_base + 0x180); From 866bd6e27f0ad65238463d6f3361f82f6d985c74 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:08:49 +0000 Subject: [PATCH 150/758] decomp: clarify names in draw_hud_cropped_gauge_panel rec -> cropped_gauge_element: In the SHA-256-bound source, rec is the char* parameter of draw_hud_cropped_gauge_panel. Retail 0x0023a65c preserves a0 in s1; 0x0023a664-0x0023a680 reads element position +0x50/+0x54 and writes dimensions 256x64 at +0x58/+0x5c before hud_screen_position. 0x0023a684-0x0023a698 passes the same element and its +0x6c slide state to apply_hud_slide_offset. Its +0x74/+0x08 ratio determines the cropped gauge sprite width at 0x0023a69c-0x0023a6e4, and 0x0023a744 returns its width. These uses prove the cropped gauge HUD element role without inferring the gameplay gauge identity. --- .../ui/hud/draw_hud_item_selector_panel.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 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 a629d5b983..8004f1c12b 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 @@ -1450,20 +1450,20 @@ s32 draw_hud_bolt_exclamation_panel(Hud *hud_element) { extern short D_00140986 NOT_SDA; int draw_hud_cropped_gauge_panel(char *rec) __asm__("FUN_L00_0023a640"); -int draw_hud_cropped_gauge_panel(char *rec) { +int draw_hud_cropped_gauge_panel(char *cropped_gauge_element) { int x, y; int sprite_width; - x = *(int *)(rec + 0x50); - y = *(int *)(rec + 0x54); - *(int *)(rec + 0x58) = 0x100; - *(int *)(rec + 0x5C) = 0x40; - hud_screen_position(rec, &x, &y); - apply_hud_slide_offset(rec, &x, &y, *(int *)(rec + 0x6C), 0); - sprite_width = *(int *)(rec + 0x74) * 0xDD / *(int *)(rec + 0x8) + 0x1B; + x = *(int *)(cropped_gauge_element + 0x50); + y = *(int *)(cropped_gauge_element + 0x54); + *(int *)(cropped_gauge_element + 0x58) = 0x100; + *(int *)(cropped_gauge_element + 0x5C) = 0x40; + hud_screen_position(cropped_gauge_element, &x, &y); + apply_hud_slide_offset(cropped_gauge_element, &x, &y, *(int *)(cropped_gauge_element + 0x6C), 0); + sprite_width = *(int *)(cropped_gauge_element + 0x74) * 0xDD / *(int *)(cropped_gauge_element + 0x8) + 0x1B; draw_cropped_hud_sprite(get_icon_frame(0x7558, 1), x, y, sprite_width, 0x40, 0x80); draw_hud_sprite(get_icon_frame(0x7558, 0), x, y, 0x100, 0x40, 0x80); draw_hud_sprite(get_icon_frame(0x7558, 2), x, y, 0x20, 0x20, D_00140986 ? 0x80 : 0); - return *(int *)(rec + 0x58); + return *(int *)(cropped_gauge_element + 0x58); } /* func_L00_00236750 without the offsets: a 32 x 32 element with a timer of 30 + func_001F9850(120). */ From 2c5753f874feef220fd07adc242c84cb23b8f390 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:08:49 +0000 Subject: [PATCH 151/758] decomp: clarify names in start_camera_blend sub -> requested_transition_kind: In the authoritative start_camera_blend source (SHA-256 adaafef553423d32a5162f20e56bb50b8e9cb8950f9760b2d1209f4e177f251d), both assignments to unsigned char sub read transition->requested_kind. Retail 0x001ec8dc and 0x001ec9d4 load that byte from +3(s4); comparisons at 0x001ec8e0/0x001ec90c and 0x001ec9dc/0x001ec9fc/0x001eca24 select the blend/orbit seeding or transfer paths for values 0, 2 and 1. The same requested byte is installed as the active kind at +2(s4) at 0x001eca4c. Prepared Ghidra decompilation likewise branches on g_bCameraTransitionMode before installing g_bCameraUseAlternateTransition. These uses prove that sub represents the requested transition kind. --- src/camera/start_camera_blend.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/camera/start_camera_blend.c b/src/camera/start_camera_blend.c index b361de0c31..5d32aa02bc 100644 --- a/src/camera/start_camera_blend.c +++ b/src/camera/start_camera_blend.c @@ -25,14 +25,14 @@ void start_camera_blend(struct UpdateCam *source) { char orbit_reference_direction[16]; char orbit_yaw_side_direction[16]; char orbit_axis[16]; - unsigned char sub; + unsigned char requested_transition_kind; if (transition->mode == CAMERA_TRANSITION_PHASE_SEED_FROM_SOURCE) { - sub = transition->requested_kind; - if (sub == 0) { + requested_transition_kind = transition->requested_kind; + if (requested_transition_kind == 0) { qcopy(transition->blend.position, &source->pos); extract_matrix_rotation_quaternion(transition->blend.rotation, source); - } else if (sub == 2) { + } else if (requested_transition_kind == 2) { qcopy(transition->orbit.saved_position, &source->pos); extract_matrix_rotation_quaternion(transition->orbit.saved_rotation, source); capture_camera_orientation(); @@ -55,14 +55,14 @@ void start_camera_blend(struct UpdateCam *source) { qcopy(transition->orbit.saved_rotation, transition->orbit.rotation); } } else { - sub = transition->requested_kind; - if (sub == 2) { + requested_transition_kind = transition->requested_kind; + if (requested_transition_kind == 2) { save_camera_vectors(); capture_camera_orientation(); - } else if (sub == 1) { + } else if (requested_transition_kind == 1) { save_camera_vectors(); qcopy(transition->orbit.rotation, transition->orbit.saved_rotation); - } else if (sub == 0) { + } else if (requested_transition_kind == 0) { restore_camera_vectors(); } } From 2387392cd389b6364f223fcbc907df75aa46b726 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:09:04 +0000 Subject: [PATCH 152/758] decomp: clarify names in sandshark_egg_update D_L02_00161C9C -> l02_sandshark_egg_effect_initial_color: Authoritative src/overlays/l02/mobys/sandshark_egg.c snapshot SHA-256 feb6764bfd50fbc0e440902ede897adbe2d1b22e7cd59231200b25fbf99b7393 defines this int as 0x6f707070 and passes it as spawn_effect argument 3. Retail 002e038c loads it into a2 before the call to 0026afd0 at 002e03a8; original Ghidra passes uGpffffb09c in this position. Supplied spawn_effect context names argument 3 initial_color and stores it to particle+4 and particle_data[4], proving the effect initial color role. Level qualification preserves ownership of this distinct L02 binding. D_L02_00161CA0 -> l02_sandshark_egg_effect_color_endpoint: Authoritative src/overlays/l02/mobys/sandshark_egg.c snapshot SHA-256 feb6764bfd50fbc0e440902ede897adbe2d1b22e7cd59231200b25fbf99b7393 defines this int as 0x707070 and passes it as spawn_effect argument 4. Retail 002e0394 loads it into a3 before the call to 0026afd0 at 002e03a8; original Ghidra passes uGpffffb0a0 in this position. Supplied spawn_effect context names argument 4 color_endpoint and stores it to particle_data[5], proving the effect color endpoint role. This name identifies the L02 binding without merging any other overlay data. --- src/overlays/l02/mobys/sandshark_egg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l02/mobys/sandshark_egg.c b/src/overlays/l02/mobys/sandshark_egg.c index e7bf3f32d3..68c6d0ec7a 100644 --- a/src/overlays/l02/mobys/sandshark_egg.c +++ b/src/overlays/l02/mobys/sandshark_egg.c @@ -17,8 +17,8 @@ extern int step_moby_motion(void *, void *) __asm__("FUN_L00_0025c698"); extern void spawn_effect(void *, void *, int, int, int, int, int, int) __asm__("FUN_L00_00269958"); -int D_L02_00161C9C = 0x6f707070; -int D_L02_00161CA0 = 0x707070; +int l02_sandshark_egg_effect_initial_color __asm__("D_L02_00161C9C") = 0x6f707070; +int l02_sandshark_egg_effect_color_endpoint __asm__("D_L02_00161CA0") = 0x707070; void sandshark_egg_update(struct Moby *moby) __asm__("FUN_L02_002e0280"); typedef struct SandsharkEggVars { @@ -57,8 +57,8 @@ void sandshark_egg_update(struct Moby *moby) { random_effect_value = random_int_between(0x14, 0x28); spawn_effect(vp, u, - D_L02_00161C9C, - D_L02_00161CA0, + l02_sandshark_egg_effect_initial_color, + l02_sandshark_egg_effect_color_endpoint, effect_frame_count, 0x28, random_effect_value, From 2ae2d7e92f17a6925cab447de3579fbbe8cf9c23 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:09:17 +0000 Subject: [PATCH 153/758] decomp: clarify names in emit_sand_shark_single_particle D_L02_0016199C -> l02_sand_shark_single_particle_initial_color: Authoritative C defines the packed word 0x40306058 and passes it as spawn_spark argument four. Retail 0x002d5c34 loads it into a3; checked level-02 callee 0x0026a75c retains it in s5, 0x0026a7b0 stores it to particle+4, and 0x0026a8b4 also stores it to particle extension+8 (particle+0x28). This is the initial packed color used for both the particle color and its saved color slot. D_L02_001619A0 -> l02_sand_shark_single_particle_secondary_color: Authoritative C defines 0x10306058, sharing the lower packed color bytes with initial color 0x40306058, and passes it as spawn_spark argument five. Retail 0x002d5c3c loads it into t0; checked level-02 0x0026a744 saves t0 in s8 and 0x0026a8b8 stores it to particle extension+0xc (particle+0x2c), adjacent to the saved initial color at +0x28. Name describes the separate secondary packed color without claiming its interpolation phase. --- src/overlays/l02/mobys/sand_shark.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 943b47457d..a5a2414405 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -1116,8 +1116,8 @@ extern s32 sand_shark_single_particle_third_frame_count_range_start_gp __asm__(" __attribute__((sda)); extern s32 sand_shark_single_particle_third_frame_count_range_end_gp __asm__("D_L02_00161998") __attribute__((sda)); -s32 D_L02_0016199C = 0x40306058; -s32 D_L02_001619A0 = 0x10306058; +s32 l02_sand_shark_single_particle_initial_color __asm__("D_L02_0016199C") = 0x40306058; +s32 l02_sand_shark_single_particle_secondary_color __asm__("D_L02_001619A0") = 0x10306058; s32 D_L02_001619A4 = -1; void emit_sand_shark_single_particle(Vec4 *from) __asm__("FUN_L02_002d5a68"); @@ -1175,8 +1175,8 @@ void emit_sand_shark_single_particle(Vec4 *from) { spawn_spark(&at, &vertical_motion, &radial_motion, - D_L02_0016199C, - D_L02_001619A0, + l02_sand_shark_single_particle_initial_color, + l02_sand_shark_single_particle_secondary_color, frame_count, second_frame_count, third_frame_count, From 4dab97eba1fd48e7faaa1df1a39ce178d0f427d8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:09:32 +0000 Subject: [PATCH 154/758] decomp: clarify names in emit_timed_spark_particle D_L10_00161FE8 -> l10_timed_spark_initial_color_from: Source binds this int (0x400080ff) to fast_tween_color's first input. Retail 0x002ea950 loads gp-0x4c18 into a0 for 0x002ea958. Checked helper 0x001f3900-0x001f3944 interpolates unpacked bytes as a0*(1-t)+a1*t. The result is retained in s0 at 0x002ea964, passed in a3 at 0x002ea984, and stored as the initial spark color at 0x0025bf18 and 0x0025c01c. D_L10_00161FEC -> l10_timed_spark_initial_color_to: Source binds this int (0x4010ffff) to fast_tween_color's second input. Retail 0x002ea95c loads gp-0x4c14 into a1 in the 0x002ea958 call delay slot. Checked helper 0x001f3900-0x001f3944 computes packed channel interpolation a0*(1-t)+a1*t. The result flows through s0 and a3 at 0x002ea964/0x002ea984 to the initial spark color stores at 0x0025bf18 and 0x0025c01c. D_L10_00161FF0 -> l10_timed_spark_second_color_from: Source binds this int (0x2000c0ff) to the first input of the second fast_tween_color call. Retail 0x002ea970 loads gp-0x4c10 into a0 for 0x002ea978. Checked helper 0x001f3900-0x001f3944 computes a0*(1-t)+a1*t per packed channel. Returned v0 moves to t0 at 0x002ea988, the fifth spawn_spark argument; callee preserves it in s8 at 0x0025beac and stores this separate second color at 0x0025c020, distinct from the initial color at 0x0025c01c. D_L10_00161FF4 -> l10_timed_spark_second_color_to: Source binds this int (0x200080ff) to the second input of the second fast_tween_color call. Retail 0x002ea97c loads gp-0x4c0c into a1 in the 0x002ea978 call delay slot. Checked helper 0x001f3900-0x001f3944 computes a0*(1-t)+a1*t per packed channel. The result flows through t0 at 0x002ea988 into spawn_spark's s8 at 0x0025beac and the separate second color store at 0x0025c020; its later rendering phase is not asserted. --- .../l10/mobys/configurable_particle_emitter.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l10/mobys/configurable_particle_emitter.c b/src/overlays/l10/mobys/configurable_particle_emitter.c index 84e20ca28f..7b7f419042 100644 --- a/src/overlays/l10/mobys/configurable_particle_emitter.c +++ b/src/overlays/l10/mobys/configurable_particle_emitter.c @@ -248,10 +248,10 @@ extern int timed_spark_base_third_frame_count_gp __asm__("D_L10_00161FE0") __a extern float timed_spark_frame_count_scale_spread_gp __asm__("D_L10_00161FE4") __attribute__((sda)); extern int timed_spark_timer_reset_min_gp __asm__("D_L10_00161FF8") __attribute__((sda)); extern int timed_spark_timer_reset_max_gp __asm__("D_L10_00161FFC") __attribute__((sda)); -int D_L10_00161FE8 = 0x400080ff; -int D_L10_00161FEC = 0x4010ffff; -int D_L10_00161FF0 = 0x2000c0ff; -int D_L10_00161FF4 = 0x200080ff; +int l10_timed_spark_initial_color_from __asm__("D_L10_00161FE8") = 0x400080ff; +int l10_timed_spark_initial_color_to __asm__("D_L10_00161FEC") = 0x4010ffff; +int l10_timed_spark_second_color_from __asm__("D_L10_00161FF0") = 0x2000c0ff; +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) { @@ -286,12 +286,12 @@ void emit_timed_spark_particle(void *emission_position, short *timer) { third_frame_count = truncate_float_to_s32((float)timed_spark_base_third_frame_count_gp * frame_count_scale); initial_spark_color = - fast_tween_color(D_L10_00161FE8, D_L10_00161FEC, random_float_between(0.0f, 1.0f)); + fast_tween_color(l10_timed_spark_initial_color_from, l10_timed_spark_initial_color_to, random_float_between(0.0f, 1.0f)); spawn_spark(emission_position, spark_vertical_vector, acc, initial_spark_color, - fast_tween_color(D_L10_00161FF0, D_L10_00161FF4, random_float_between(0.0f, 1.0f)), + fast_tween_color(l10_timed_spark_second_color_from, l10_timed_spark_second_color_to, random_float_between(0.0f, 1.0f)), frame_count, second_frame_count, third_frame_count, From 6b84e7a2254412c75943302c5e7bcd2985a7dd90 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:09:46 +0000 Subject: [PATCH 155/758] decomp: clarify names in grindrail_gate_update D_L16_00161DD8 -> l16_grindrail_gate_command_duration_frames: Source initializes this int to 600 and passes it to scale_game_frames when asserting gate_moby->command. Retail 0x002e51ec-0x002e51fc sets command at moby+0xbc, loads this global via gp-0x4e28 at 0x002e51f8, scales it and stores the returned countdown through pvars in s5. At 0x002e5218-0x002e522c countdown expiry clears command, proving command duration in input frames. D_L16_00161DDC -> l16_grindrail_gate_glow_bright_color: Source initializes this int to packed color 0x80808080 and supplies it to fast_tween_color with 0x80202020 and the sine-derived glow phase. Retail 0x002e50ac loads this binding via gp-0x4e24 into a0 for the color tween at 0x002e50b8; its returned packed color is stored to moby glow_color (+0x90) at 0x002e50c8. The three 0x80 color components exceed the companion's 0x20 components, proving the brighter glow endpoint. D_L16_00161DE0 -> l16_grindrail_gate_glow_dim_color: Source initializes this int to packed color 0x80202020 and supplies it alongside 0x80808080 to fast_tween_color for gate_moby->glow_color. Retail 0x002e50b4 loads this binding via gp-0x4e20 into a1 for the tween at 0x002e50b8, whose return is stored at moby+0x90 at 0x002e50c8. Its three 0x20 color components are below the companion's 0x80 components, proving the dim glow endpoint. --- src/overlays/l16/mobys/grindrail_gate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l16/mobys/grindrail_gate.c b/src/overlays/l16/mobys/grindrail_gate.c index e74af932f2..c6574a5561 100644 --- a/src/overlays/l16/mobys/grindrail_gate.c +++ b/src/overlays/l16/mobys/grindrail_gate.c @@ -15,9 +15,9 @@ extern int D_L16_0015F5CC; extern int fast_tween_color(float, int, int) __asm__("FUN_001fa6e0"); extern int func_0022ED80_6478(int, int, void *) __asm__("FUN_0022da68"); -int D_L16_00161DD8 = 600; -int D_L16_00161DDC = 0x80808080; -int D_L16_00161DE0 = 0x80202020; +int l16_grindrail_gate_command_duration_frames __asm__("D_L16_00161DD8") = 600; +int l16_grindrail_gate_glow_bright_color __asm__("D_L16_00161DDC") = 0x80808080; +int l16_grindrail_gate_glow_dim_color __asm__("D_L16_00161DE0") = 0x80202020; void grindrail_gate_update(struct Moby *gate_moby) __asm__("FUN_L16_002e5010"); /* Moby class 1439 */ @@ -37,8 +37,8 @@ void grindrail_gate_update(struct Moby *gate_moby) { convert_integer_to_float(D_L16_0015F5CC % period) / convert_integer_to_float(period); gate_moby->glow_color = fast_tween_color(fast_sin(glow_cycle_phase * 6.28318f - 3.14159f) * 0.5f + 0.5f, - D_L16_00161DDC, - D_L16_00161DE0); + l16_grindrail_gate_glow_bright_color, + l16_grindrail_gate_glow_dim_color); switch (gate_moby->state) { case GRINDRAIL_GATE_INITIALIZE: gate_moby->state = GRINDRAIL_GATE_CHECK_HERO_BOUNDS; @@ -58,7 +58,7 @@ void grindrail_gate_update(struct Moby *gate_moby) { hero_offset_from_gate[2] < grindrail_gate_local_trigger_bounds[5]) { gate_moby->command = 1; gate_moby->state = GRINDRAIL_GATE_WAIT_FOR_COMMAND_TIMEOUT; - *(int *)command_timer = scale_game_frames(D_L16_00161DD8); + *(int *)command_timer = scale_game_frames(l16_grindrail_gate_command_duration_frames); func_0022ED80_6478(1, 0, gate_moby); } } From 5a3e04807e88992935c5a58355c632be5997fe26 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:13:12 +0000 Subject: [PATCH 156/758] decomp: clarify names in spawn_spark_scatter D_L12_001618C4 -> l12_spark_scatter_start_color: Authoritative source defines int 0xa0f0e8e0 and supplies it as spawn_spark argument 4, matching start_color in spawn_hoven_anklebiter_death_sparks, where fast_tween_color constructs that argument. Retail 0x002e1b7c loads it into a3; original Ghidra shows uGpffffacc4 in this slot. Checked helper 0x002819bc retains a3 in s5, stores it at particle+4 (0x00281a10) and at particle+0x28 (0x00281b14), while argument 5 occupies the paired endpoint at +0x2c. These paths prove the scatter's start-color constant. D_L12_001618C8 -> l12_spark_scatter_end_color: Authoritative source defines int 0x20f0e8e0 and supplies it as spawn_spark argument 5, matching end_color in spawn_hoven_anklebiter_death_sparks, where fast_tween_color constructs that argument. Retail 0x002e1b84 loads it into t0; original Ghidra shows uGpffffacc8 in this slot. Checked helper retains t0 in s8 at 0x002819a4 and stores it to particle+0x2c at 0x00281b18, paired with start_color at +0x28. This proves the scatter's end-color constant without assuming channel order. --- src/overlays/l12/mobys/hoven_anklebiter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l12/mobys/hoven_anklebiter.c b/src/overlays/l12/mobys/hoven_anklebiter.c index 1e34a73d4b..8d76c64473 100644 --- a/src/overlays/l12/mobys/hoven_anklebiter.c +++ b/src/overlays/l12/mobys/hoven_anklebiter.c @@ -188,8 +188,8 @@ extern int spark_scatter_third_frame_count_range_start_gp __asm__("D_L12_001618B __attribute__((sda)); extern int spark_scatter_third_frame_count_range_end_gp __asm__("D_L12_001618C0") __attribute__((sda)); -int D_L12_001618C4 = 0xa0f0e8e0; -int D_L12_001618C8 = 0x20f0e8e0; +int l12_spark_scatter_start_color __asm__("D_L12_001618C4") = 0xa0f0e8e0; +int l12_spark_scatter_end_color __asm__("D_L12_001618C8") = 0x20f0e8e0; int D_L12_001618CC = 0x10017; void spawn_spark_scatter(void *spark_scatter_origin) __asm__("FUN_L12_002e19a8"); void spawn_spark_scatter(void *pos) __asm__("FUN_L12_002e19a8"); @@ -241,8 +241,8 @@ void spawn_spark_scatter(void *spark_scatter_origin) { spawn_spark(spark_position, vertical_spark_vector, radial_spark_vector, - D_L12_001618C4, - D_L12_001618C8, + l12_spark_scatter_start_color, + l12_spark_scatter_end_color, frame_count, second_frame_count, third_frame_count, From 371265b24b6ec5ed09adbb8f47e52c30a82a2c0c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:13:32 +0000 Subject: [PATCH 157/758] decomp: clarify names in local_bounds_command_trigger_update D_L16_00161DE4 -> l16_local_bounds_trigger_command_timeout_frames: The owned int definition is 600. Retail 0x002e5454 loads this global into a0 for scale_game_frames at 0x002e5450 after command +0xBC is asserted and state becomes 2 at 0x002e5448-0x002e544c. The scaled result is stored through pvars at 0x002e545c; fast_dec_timer tests that same pointer at 0x002e5460-0x002e5468 before command clears at 0x002e5474. Thus it is the input frame duration for the command timeout. D_L16_00161DE8 -> l16_local_bounds_trigger_dim_glow_color: The owned int definition is packed color 0x80202020, with RGB components 0x20, darker than the companion's 0x80 components with identical high byte. Retail 0x002e52f4 loads it into a0 and 0x002e52fc loads the companion into a1; the sine-derived factor in f12 feeds their call at 0x002e5300. The returned word is stored directly in trigger_moby->glow_color (+0x90) at 0x002e5310. The original decompilation shows the same two globals supplying this pulsing glow calculation. D_L16_00161DEC -> l16_local_bounds_trigger_bright_glow_color: The owned int definition is packed color 0x80808080, with RGB components 0x80, brighter than the companion's 0x20 components with identical high byte. Retail 0x002e52fc loads it into a1 alongside the dim color loaded at 0x002e52f4. The call at 0x002e5300 combines these color inputs with the sine-derived factor and returns the word stored in trigger_moby->glow_color (+0x90) at 0x002e5310, matching the original Ghidra and authoritative current C glow calculation. --- .../l16/mobys/local_bounds_command_trigger.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l16/mobys/local_bounds_command_trigger.c b/src/overlays/l16/mobys/local_bounds_command_trigger.c index bafba1c051..7dbeba894c 100644 --- a/src/overlays/l16/mobys/local_bounds_command_trigger.c +++ b/src/overlays/l16/mobys/local_bounds_command_trigger.c @@ -16,9 +16,9 @@ extern int D_L16_0015F5CC; extern int FUN_001fa6e0_q(float, int, int) __asm__("FUN_001fa6e0"); extern float D_L16_001D9768[] NOT_SDA; -int D_L16_00161DE4 = 600; -int D_L16_00161DE8 = 0x80202020; -int D_L16_00161DEC = 0x80808080; +int l16_local_bounds_trigger_command_timeout_frames __asm__("D_L16_00161DE4") = 600; +int l16_local_bounds_trigger_dim_glow_color __asm__("D_L16_00161DE8") = 0x80202020; +int l16_local_bounds_trigger_bright_glow_color __asm__("D_L16_00161DEC") = 0x80808080; extern char D_0013F3D0[] NOT_SDA; void local_bounds_command_trigger_update(struct Moby *trigger_moby) __asm__("FUN_L16_002e5258"); @@ -39,8 +39,8 @@ void local_bounds_command_trigger_update(struct Moby *trigger_moby) { convert_integer_to_float(D_L16_0015F5CC % period) / convert_integer_to_float(period); trigger_moby->glow_color = FUN_001fa6e0_q(fast_sin(glow_cycle_phase * 6.28318f - 3.14159f) * 0.5f + 0.5f, - D_L16_00161DE8, - D_L16_00161DEC); + l16_local_bounds_trigger_dim_glow_color, + l16_local_bounds_trigger_bright_glow_color); switch (trigger_moby->state) { case GRINDRAIL_TRIGGER_INITIALIZE: trigger_moby->state = GRINDRAIL_TRIGGER_CHECK_LOCAL_BOUNDS; @@ -64,7 +64,7 @@ void local_bounds_command_trigger_update(struct Moby *trigger_moby) { allocate_voice_for_target_entry(1, 0, trigger_moby); trigger_moby->command = 1; trigger_moby->state = GRINDRAIL_TRIGGER_WAIT_FOR_COMMAND_TIMEOUT; - *(int *)command_timer = scale_game_frames(D_L16_00161DE4); + *(int *)command_timer = scale_game_frames(l16_local_bounds_trigger_command_timeout_frames); } } break; From 9926d00320d9c7bfdeb6023e40cb35331599f845 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:13:53 +0000 Subject: [PATCH 158/758] decomp: clarify names in draw_quartu_cutscene_messages D_L15_00162180 -> l15_quartu_cutscene_message_x: Owned C int initialized to 150 supplies the x parameter of print_text_with_texture_3. Retail 0x002eb8cc loads gp-0x4a80 into a0 and 0x002eb8e0 adds one for the first draw; 0x002eb8ec reloads the same scalar unchanged into a0 for the foreground draw at 0x002eb8fc. This proves the unshifted message x coordinate. D_L15_00162184 -> l15_quartu_cutscene_message_y: Owned C int initialized to 150 supplies the y parameter of print_text_with_texture_3. Retail 0x002eb8d4 loads gp-0x4a7c into a1 and the 0x002eb8e8 delay slot adds one for the first draw; 0x002eb8f4 reloads the same scalar unchanged for the foreground draw. This proves the unshifted message y coordinate. D_L15_00162188 -> l15_quartu_cutscene_message_color: Owned C int initialized to 0x3800ffff is the color argument of the unshifted print_text_with_texture_3 call. Retail 0x002eb900 loads gp-0x4a78 into a2 in the delay slot of 0x002eb8fc, after x/y are loaded without offsets; a3 and t0 carry the same formatted message and character count as the offset draw. This proves the foreground message color without assuming channel packing. D_L15_0016218C -> l15_quartu_cutscene_message_shadow_color: Owned C int initialized to 0x38800000 supplies the first text draw's color. Retail 0x002eb8dc loads gp-0x4a74 into a2 before 0x002eb8e4, with x and y each incremented by one at 0x002eb8e0/e8. The same text and count are then drawn at unshifted x/y with the other color, proving this scalar colors the offset shadow pass. val -> message_reveal_count: Retail 0x002eb750..754, 0x002eb7b8..7bc and 0x002eb888..88c subtract the selected scaled message start frame from timing word +0x34 and arithmetic-shift by two into s2 (C val). At 0x002eb8a4..8c8 this count clamps strlen_alt(formatted_message_text), or controls the post-length final-character adjustment, before both draws. It represents timed message reveal progress rather than the final printed count. --- .../l15/mobys/quartu_cutscene_trigger.c | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/overlays/l15/mobys/quartu_cutscene_trigger.c b/src/overlays/l15/mobys/quartu_cutscene_trigger.c index d47619aaa6..446cc5947b 100644 --- a/src/overlays/l15/mobys/quartu_cutscene_trigger.c +++ b/src/overlays/l15/mobys/quartu_cutscene_trigger.c @@ -118,18 +118,18 @@ extern int strlen_alt(char *) __asm__("FUN_001166cc"); extern void print_text_with_texture_3(s32 x, s32 y, s32 color, s32 text, s32 len) __asm__("FUN_L00_001fb470"); -int D_L15_00162180 = 150; +int l15_quartu_cutscene_message_x __asm__("D_L15_00162180") = 150; -int D_L15_00162184 = 150; +int l15_quartu_cutscene_message_y __asm__("D_L15_00162184") = 150; -int D_L15_00162188 = 0x3800ffff; +int l15_quartu_cutscene_message_color __asm__("D_L15_00162188") = 0x3800ffff; -int D_L15_0016218C = 0x38800000; +int l15_quartu_cutscene_message_shadow_color __asm__("D_L15_0016218C") = 0x38800000; void draw_quartu_cutscene_messages(void) { char formatted_message_text[0x50]; int flag = 0; - int val = 0; + int message_reveal_count = 0; char *message_timing_state = D_L15_0016CE60; int print_character_count; char *second_message_timing_state; @@ -141,7 +141,7 @@ void draw_quartu_cutscene_messages(void) { sprintf(formatted_message_text, quartu_cutscene_message_format, get_help_message_text(0x526A)); - val = (*(int *)(message_timing_state + 0x34) - scale_game_frames(0xB5)) >> 2; + message_reveal_count = (*(int *)(message_timing_state + 0x34) - scale_game_frames(0xB5)) >> 2; } } second_message_timing_state = D_L15_0016CE60; @@ -151,7 +151,7 @@ void draw_quartu_cutscene_messages(void) { sprintf(formatted_message_text, quartu_cutscene_message_format, get_help_message_text(0x526B)); - val = + message_reveal_count = (*(int *)(second_message_timing_state + 0x34) - scale_game_frames(0x1C2)) >> 2; } } @@ -162,7 +162,7 @@ void draw_quartu_cutscene_messages(void) { sprintf(formatted_message_text, quartu_cutscene_message_format, get_help_message_text(0x526C)); - val = (*(int *)(third_message_timing_state + 0x34) - scale_game_frames(0x2EE)) >> 2; + message_reveal_count = (*(int *)(third_message_timing_state + 0x34) - scale_game_frames(0x2EE)) >> 2; } } } else if (*(int *)(message_timing_state + 0x30) == 4) { @@ -172,27 +172,27 @@ void draw_quartu_cutscene_messages(void) { sprintf(formatted_message_text, quartu_cutscene_message_format, get_help_message_text(0x526E)); - val = (*(int *)(message_timing_state + 0x34) - scale_game_frames(0x8FC)) >> 2; + message_reveal_count = (*(int *)(message_timing_state + 0x34) - scale_game_frames(0x8FC)) >> 2; } } } if (flag == 0) return; print_character_count = strlen_alt(formatted_message_text); - if (val < print_character_count) { - print_character_count = val; - } else if (print_character_count < val) { - if ((print_character_count - val) & 4) + if (message_reveal_count < print_character_count) { + print_character_count = message_reveal_count; + } else if (print_character_count < message_reveal_count) { + if ((print_character_count - message_reveal_count) & 4) print_character_count = print_character_count - 1; } - print_text_with_texture_3((void *)(D_L15_00162180 + 1), - (void *)(D_L15_00162184 + 1), - (void *)D_L15_0016218C, + print_text_with_texture_3((void *)(l15_quartu_cutscene_message_x + 1), + (void *)(l15_quartu_cutscene_message_y + 1), + (void *)l15_quartu_cutscene_message_shadow_color, formatted_message_text, (void *)print_character_count); - print_text_with_texture_3((void *)D_L15_00162180, - (void *)D_L15_00162184, - (void *)D_L15_00162188, + print_text_with_texture_3((void *)l15_quartu_cutscene_message_x, + (void *)l15_quartu_cutscene_message_y, + (void *)l15_quartu_cutscene_message_color, formatted_message_text, (void *)print_character_count); } From 5975bf67bb4325dffe5b584d609692c14dacbd5f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:14:07 +0000 Subject: [PATCH 159/758] decomp: clarify names in draw_pulsing_timer_hud D_L18_00161A3C -> l18_timer_frame_alpha: Authoritative source SHA-256 f86bab00d3107068d8407e02326f9fe50656c267d322c23737415998d7d66dc1 declares the int initialized to 96 and passes it as draw_ui_frame's fifth argument. Original retail Ghidra passes uGpffffae3c as that argument; retail 0x002d80cc loads it into t0 before jal 0x00203b40 at 0x002d80dc. Checked level-18 helper instructions at 0x00203b44 shift t0 left 24, 0x00203b50/0x00203b60 construct RGB 0x00040404, and 0x00203b68 ORs the shifted component into that packed frame color. The packed word is passed in t0 to all seven frame drawing calls (0x00203b98 through 0x00203c4c). Thus this scalar supplies the alpha byte of the timer frame color; l18 qualifies the overlay-local binding. --- src/overlays/l18/mobys/thruster_pack_lock_red.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l18/mobys/thruster_pack_lock_red.c b/src/overlays/l18/mobys/thruster_pack_lock_red.c index 280dbaa98d..5a458f4020 100644 --- a/src/overlays/l18/mobys/thruster_pack_lock_red.c +++ b/src/overlays/l18/mobys/thruster_pack_lock_red.c @@ -222,7 +222,7 @@ int timer_frame_top __asm__("D_L18_00161A2C") = -5; int timer_frame_bottom __asm__("D_L18_00161A30") = 20; int timer_frame_left __asm__("D_L18_00161A34") = -50; int timer_frame_right __asm__("D_L18_00161A38") = 52; -int D_L18_00161A3C = 96; +int l18_timer_frame_alpha __asm__("D_L18_00161A3C") = 96; extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern void font_print_center(int a, int b, int c, int d, int e) __asm__("FUN_001f6af0"); extern void font_print_center_large(int a, int b, int c, int d, int e) __asm__("FUN_001f6c20"); @@ -240,7 +240,7 @@ void draw_pulsing_timer_hud(struct Moby *moby) { timer_frame_bottom + timer_text_y, timer_frame_left + timer_text_x, timer_frame_right + timer_text_x, - D_L18_00161A3C); + l18_timer_frame_alpha); color_blend_factor = fast_sin(convert_integer_to_float(game_frame % 60) / 60.0f * 6.28318f) * 3.0f + 0.5f; if (color_blend_factor > 1.0f) { From 1cf283a177efe77664d0ce701054d1f1d35beaee Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:16:38 +0000 Subject: [PATCH 160/758] decomp: clarify names in rocket_launcher_projectile_update D_L02_00161F5C -> l02_rocket_projectile_particle_color_argb: Authoritative C declares s32 0x30704020 and passes its >>24 as spawn_particle initial_alpha and &0xFFFFFF as col. Retail 0x002ec050 loads the word, 0x002ec064 masks RGB, 0x002ec078 arithmetic-shifts alpha, and 0x002ec088/0x002ec0a4 pass them to the trail spawn at 0x002ec0b8. Retail 0x002ec13c/0x002ec15c reuses its low RGB for the position spawn at 0x002ec190. Original Ghidra shows the same uGpffffb35c splits; supplied particle helper combines (initial_alpha << 24) | col at particle+4, proving packed high-alpha/low-color layout. D_L02_00161F60 -> l02_rocket_projectile_position_particle_alpha_source: Authoritative C declares s32 0x50e0e0e0 and uses only D_L02_00161F60 >> 24 as initial_alpha for spawn_particle at moby->pos after the two trail emissions. Retail 0x002ec148/0x002ec14c loads signed byte 0x00161f63, the high byte of the little-endian word at 0x00161f60, into a3 for call 0x002ec190; 0x002ec170 supplies the saved moby position. Original Ghidra shows uRam00161f63 as that call's alpha argument. The supplied particle helper places initial_alpha in the packed particle color high byte; no role is claimed for the unused low 24 bits. --- src/overlays/l02/mobys/rocket_launcher_projectile.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l02/mobys/rocket_launcher_projectile.c b/src/overlays/l02/mobys/rocket_launcher_projectile.c index 6e85a32447..181f30e600 100644 --- a/src/overlays/l02/mobys/rocket_launcher_projectile.c +++ b/src/overlays/l02/mobys/rocket_launcher_projectile.c @@ -22,8 +22,8 @@ typedef struct { extern f32 rocket_launcher_projectile_vertical_velocity_approach_scale_gp __asm__("D_L02_00161F58") __attribute__((sda)); -s32 D_L02_00161F5C = 0x30704020; -s32 D_L02_00161F60 = 0x50e0e0e0; +s32 l02_rocket_projectile_particle_color_argb __asm__("D_L02_00161F5C") = 0x30704020; +s32 l02_rocket_projectile_position_particle_alpha_source __asm__("D_L02_00161F60") = 0x50e0e0e0; extern LevelFx l02_projectile_trail_particle_tint_source __asm__("D_L02_001B2680"); extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); @@ -69,8 +69,8 @@ void rocket_launcher_projectile_update(struct Moby *moby) { particle = spawn_particle(&trail_position, &back, particle_frame_count, - D_L02_00161F5C >> 24, - D_L02_00161F5C & 0xFFFFFF, + l02_rocket_projectile_particle_color_argb >> 24, + l02_rocket_projectile_particle_color_argb & 0xFFFFFF, 3, random_float_between(300000.0f, 500000.0f), 10000.0f, @@ -88,8 +88,8 @@ void rocket_launcher_projectile_update(struct Moby *moby) { particle = spawn_particle(&moby->pos, &back, scale_game_frames(6), - D_L02_00161F60 >> 24, - D_L02_00161F5C & 0xFFFFFF, + l02_rocket_projectile_position_particle_alpha_source >> 24, + l02_rocket_projectile_particle_color_argb & 0xFFFFFF, 3, 250000.0f, 5000.0f, From 4cf8147f722177dd120e8baa0cc5594e703d9880 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:16:39 +0000 Subject: [PATCH 161/758] decomp: clarify names in initialize_path_camera rec -> path_camera_descriptor: Retail 002f5ba0..002f5bac loads the camera descriptor index at +0x84, multiplies it by 32, and dereferences l10_descriptor_table entry +0x1C; this is iVar1 in the original decompilation and rec in the authoritative C. The selected descriptor receives activation byte +0x38 at 002f5bb4, supplies movement/look path indices +0x20/+0x24 at 002f5c60 and 002f5da4, and duration +0x3A at 002f5be0/002f5d68. Computed movement speed is stored at descriptor +0x3C at 002f5d9c, and +0x4C controls the final hero_set_state call at 002f5ec4..002f5ed8. These uses prove it is the path camera descriptor rather than saved traversal state. --- .../shared/camera/path_flythrough_camera.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/camera/path_flythrough_camera.c b/src/overlays/shared/camera/path_flythrough_camera.c index 863466ac94..0ab5833310 100644 --- a/src/overlays/shared/camera/path_flythrough_camera.c +++ b/src/overlays/shared/camera/path_flythrough_camera.c @@ -93,14 +93,14 @@ extern VendorView_5f18 l10_camera_view __asm__("D_L10_0016CEC0"); void initialize_path_camera(struct UpdateCam *path_camera) __asm__("FUN_L10_002f5b58"); void initialize_path_camera(struct UpdateCam *path_camera) { - char *rec = *(char **)(l10_descriptor_table + path_camera->descriptor_index * 32 + 0x1C); + char *path_camera_descriptor = *(char **)(l10_descriptor_table + path_camera->descriptor_index * 32 + 0x1C); VendorCamRun_5f18 *run; VendorCamStops_5f18 *stops; f32 *fov; Vec4f *m1, *m2, *pos; char *saved; - rec[0x38] = 1; + path_camera_descriptor[0x38] = 1; run = (VendorCamRun_5f18 *)((char *)path_camera->saved_state + 0x40); run->seg = 0; run->t = 0.0f; @@ -108,7 +108,7 @@ void initialize_path_camera(struct UpdateCam *path_camera) { run->look_path_length = 0.0f; run->dist = 0.0f; run->started = 0; - run->timer = scale_game_frames(*(s16 *)(rec + 0x3A)); + run->timer = scale_game_frames(*(s16 *)(path_camera_descriptor + 0x3A)); stops = (VendorCamStops_5f18 *)((char *)path_camera->saved_state + 0x58); fov = stops->fov; { @@ -122,8 +122,8 @@ void initialize_path_camera(struct UpdateCam *path_camera) { m1 = (Vec4f *)&path_camera->m1; m2 = (Vec4f *)&path_camera->m2; stops->fov_end = fast_arc_tan(1.0f, l10_camera_view.tan_half_fov) * 2.0f; - if (*(int *)(rec + 0x20) >= 0) { - char *path = ((char *)l10_paths[*(int *)(rec + 0x20)]); + if (*(int *)(path_camera_descriptor + 0x20) >= 0) { + char *path = ((char *)l10_paths[*(int *)(path_camera_descriptor + 0x20)]); int i = 0; if (i < *(int *)path) { f32 *stop_fov = fov; @@ -156,13 +156,13 @@ void initialize_path_camera(struct UpdateCam *path_camera) { } } { - s16 frames = *(s16 *)(rec + 0x3A); + s16 frames = *(s16 *)(path_camera_descriptor + 0x3A); if (frames > 0) - *(f32 *)(rec + 0x3C) = + *(f32 *)(path_camera_descriptor + 0x3C) = run->path_length / convert_integer_to_float(scale_game_frames(frames)) * 60.0f; } - if (*(int *)(rec + 0x24) >= 0) { - char *path = ((char *)l10_paths[*(int *)(rec + 0x24)]); + if (*(int *)(path_camera_descriptor + 0x24) >= 0) { + char *path = ((char *)l10_paths[*(int *)(path_camera_descriptor + 0x24)]); int i; for (i = 0; i < *(int *)path; i++) { int offset = i * 16; @@ -188,7 +188,7 @@ void initialize_path_camera(struct UpdateCam *path_camera) { qcopy(m1, source + 0x10); qcopy(m2, source + 0x20); } - if (*(int *)(rec + 0x4C) == 0) + if (*(int *)(path_camera_descriptor + 0x4C) == 0) hero_set_state(0x72, 1); } From 11d027095403cde654460ae98f7d2737d0b4f958 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:16:53 +0000 Subject: [PATCH 162/758] decomp: clarify names in rocket_launcher_update D_L02_00161C78 -> l02_rocket_launcher_glow_blend_start_color: The authoritative source defines this s32 as 0x800000ff and passes it as the first packed color to turret_lerp_colour during ROCKET_LAUNCHER_WAIT_FOR_POST_SHOT_ANIMATION. Retail 0x002df6ac loads gp-0x4f88 into a0; 0x002df6b0 calls checked level-02 helper 0x00211300. At 0x00211300-0x0021132c the helper expands a0's bytes into vf2 and weights vf2 by 1-f12; 0x00211330 adds the other color times f12. The packed result is stored to Moby+0x90 (glow_color) at 0x002df6c4. Thus this is the zero-blend glow color endpoint. D_L02_00161C7C -> l02_rocket_launcher_glow_blend_end_color: The authoritative source defines this s32 as 0x80329600 and passes it as the second packed color to turret_lerp_colour during the post-shot animation state. Retail 0x002df6b4 loads gp-0x4f84 into a1 in the call delay slot. Checked level-02 helper 0x0021130c-0x0021131c expands a1's bytes into vf3; 0x00211330 vmaddx combines vf3*f12 with the first color weighted by 1-f12. The caller derives f12 from animation record value / 10, caps it at 1 (0x002df698-0x002df6a8), and stores the packed result to glow_color at 0x002df6c4. Thus this is the full-blend glow color endpoint. --- src/overlays/l02/mobys/rocket_launcher.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l02/mobys/rocket_launcher.c b/src/overlays/l02/mobys/rocket_launcher.c index 717c94fa82..ed10203bc4 100644 --- a/src/overlays/l02/mobys/rocket_launcher.c +++ b/src/overlays/l02/mobys/rocket_launcher.c @@ -52,8 +52,8 @@ extern f32 rocket_launcher_projectile_speed_gp __asm__("D_L02_00161C6C") __attri #include "rnc/overlay/l02/mobys/rocket_launcher_data/rocket_launcher_update_2.h" -s32 D_L02_00161C78 = 0x800000ff; -s32 D_L02_00161C7C = 0x80329600; +s32 l02_rocket_launcher_glow_blend_start_color __asm__("D_L02_00161C78") = 0x800000ff; +s32 l02_rocket_launcher_glow_blend_end_color __asm__("D_L02_00161C7C") = 0x80329600; #include "rnc/overlay/l02/mobys/rocket_launcher_data/rocket_launcher_update.h" @@ -165,7 +165,7 @@ void rocket_launcher_update(struct Moby *moby) { glow_blend_fraction = compute_interpolated_record_value(moby) / 10.0f; if (glow_blend_fraction > 1.0f) glow_blend_fraction = 1.0f; - moby->glow_color = turret_lerp_colour(glow_blend_fraction, D_L02_00161C78, D_L02_00161C7C); + moby->glow_color = turret_lerp_colour(glow_blend_fraction, l02_rocket_launcher_glow_blend_start_color, l02_rocket_launcher_glow_blend_end_color); if (moby->anim_flags & 2) { if (moby->prev_seq != 0) blend_moby_animation(moby, 0, 0, 1); From 5c3ff8fd2af997a4a7426d75c107014d3e9714ab Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:17:06 +0000 Subject: [PATCH 163/758] decomp: clarify names in update_ship_shot_firing_and_reticle D_L11_00162060 -> l11_ship_shot_cooldown_frames: The authoritative C defines this int as 4 and copies it into ship_vars+0x80 immediately after spawn_fighter_jet_missile. Retail 0x003125f8-0x00312600 calls fast_dec_timer on s2+0x80 and skips firing until it is ready; 0x00312608-0x00312610 additionally gates firing on input mask 0x84. After the spawn call at 0x00312674, 0x00312684 loads this global (gp-0x4ba0, Ghidra uGpffffb460), and 0x00312694 stores it into the same +0x80 timer. The supplied per-frame flight caller invokes this routine, proving the global is the ship shot cooldown reload in frame-update timer units. This differs from the already named rocket/projectile cooldown at D_L11_00162068 and +0x84. --- 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 0e7cf6fdf4..da769fa941 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -614,7 +614,7 @@ extern f32 D_L11_00162090_gp __asm__("D_L11_00162090") __attribute__(( extern unsigned char D_0013A4E0[]; extern short ship_shot_direction_base_scale_gp __asm__("D_L11_0016205C") __attribute__((sda)); -int D_L11_00162060 = 4; +int l11_ship_shot_cooldown_frames __asm__("D_L11_00162060") = 4; void update_ship_shot_firing_and_reticle(struct Moby *moby, char *ship_vars, float aim_azimuth, @@ -642,7 +642,7 @@ void update_ship_shot_firing_and_reticle(struct Moby *moby, moby_point_position(moby, 3 + (ship_vars[0x61] & 1), projectile_spawn_position); fast_vec_add(projectile_spawn_position, projectile_spawn_position, muzzle_forward_offset); spawn_fighter_jet_missile(moby, shot_direction, projectile_spawn_position, 200.0f, -1.0f); - *(int *)(ship_vars + 0x80) = D_L11_00162060; + *(int *)(ship_vars + 0x80) = l11_ship_shot_cooldown_frames; ship_vars[0x61] ^= 1; allocate_voice_for_target_entry(3, 0, (int)moby); } From 5fc93b2b90032e57f23f577065d5803663a0b282 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:17:07 +0000 Subject: [PATCH 164/758] decomp: clarify names in setup_path_camera rec -> path_camera_setup_preset: Bound src/overlays/l14/path_camera.c SHA-256 dea292f3a3bffc9632c6b8144346e80a4dbeffc5659232bce938203499d1b98a loads rec from l14_camera_preset_rows + signed camera[0x84]*32 + 0x1C. Original Ghidra iVar1 and retail 0x00314f44-0x00314f54 select this pointer and write its +0x38 state. Reads at 0x00314ff4 and 0x003150f8 select position/look paths through +0x20/+0x24; 0x003150c4-0x003150f4 use +0x3A duration to set +0x3C speed; 0x00315218-0x0031524c use +0x54 to select the cuboid for set_race_camera. Supplied update_path_camera independently names the same descriptor-selected pointer path_camera_preset and consumes those fields, proving this is the path camera setup preset. --- src/overlays/l14/path_camera.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l14/path_camera.c b/src/overlays/l14/path_camera.c index 9d63db1bc9..84e6692b36 100644 --- a/src/overlays/l14/path_camera.c +++ b/src/overlays/l14/path_camera.c @@ -38,7 +38,7 @@ void setup_path_camera(char *camera) __asm__("FUN_L14_00314f00"); void setup_path_camera(char *camera) { u128 stand; - char *rec = *(char **)(l14_camera_preset_rows + *(short *)(camera + 0x84) * 32 + 0x1C); + char *path_camera_setup_preset = *(char **)(l14_camera_preset_rows + *(short *)(camera + 0x84) * 32 + 0x1C); char *camera_saved_state; char *fov_stops_state_base; char *path; @@ -53,7 +53,7 @@ void setup_path_camera(char *camera) { int i; int fov_stop_count; - (*&rec)[0x38] = 3; + (*&path_camera_setup_preset)[0x38] = 3; camera_saved_state = *(char **)(camera + 0x70); *(int *)(camera_saved_state + 0x40) = 0; camera_run = (int *)(camera_saved_state + 0x40); @@ -62,7 +62,7 @@ void setup_path_camera(char *camera) { camera_run[3] = 0; camera_run[4] = 0; *(short *)(camera_run + 5) = 0; - *((short *)(camera_run + 5) + 1) = scale_game_frames(*(short *)(rec + 0x3A)); + *((short *)(camera_run + 5) + 1) = scale_game_frames(*(short *)(path_camera_setup_preset + 0x3A)); fov_stops_state_base = *(char **)(camera + 0x70); fov_stops = (Stops_4f00 *)(fov_stops_state_base + 0x58); { @@ -73,8 +73,8 @@ void setup_path_camera(char *camera) { } } fov_stops->fov_end = fast_arc_tan(1.0f, l14_camera_projection_state.fB0) * 2.0f; - if (*(int *)(rec + 0x20) >= 0) { - path = ((char *)l14_paths[*(int *)(rec + 0x20)]); + if (*(int *)(path_camera_setup_preset + 0x20) >= 0) { + path = ((char *)l14_paths[*(int *)(path_camera_setup_preset + 0x20)]); fov_stop_count = 0; for (i = 0; i < *(int *)path; i++) { char *seg = path + i * 16; @@ -90,13 +90,13 @@ void setup_path_camera(char *camera) { *(float *)(camera_run + 2) += segment_length; } } - if (*(short *)(rec + 0x3A) > 0) { - *(float *)(rec + 0x3C) = + if (*(short *)(path_camera_setup_preset + 0x3A) > 0) { + *(float *)(path_camera_setup_preset + 0x3C) = *(float *)(camera_run + 2) / - convert_integer_to_float(scale_game_frames(*(short *)(rec + 0x3A))) * 60.0f; + convert_integer_to_float(scale_game_frames(*(short *)(path_camera_setup_preset + 0x3A))) * 60.0f; } - if (*(int *)(rec + 0x24) >= 0) { - path = ((char *)l14_paths[*(int *)(rec + 0x24)]); + if (*(int *)(path_camera_setup_preset + 0x24) >= 0) { + path = ((char *)l14_paths[*(int *)(path_camera_setup_preset + 0x24)]); for (i = 0; i < *(int *)path; i++) { char *seg; segment_length = fast_vec_dist(path + (i * 16 + 0x10), @@ -120,7 +120,7 @@ void setup_path_camera(char *camera) { qcopy(camera, initial_camera_transform); qcopy(camera + 0x10, initial_camera_transform + 0x10); qcopy(camera + 0x20, initial_camera_transform + 0x20); - path = (char *)l14_cuboids + *(int *)(rec + 0x54) * 128 + 0x30; + path = (char *)l14_cuboids + *(int *)(path_camera_setup_preset + 0x54) * 128 + 0x30; stand = 0; ((float *)&stand)[3] = 1.0f; set_race_camera(path, &stand, 0x72, 0); From 768c791e6191f315eb1e6127626f9bb650c7f065 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:17:20 +0000 Subject: [PATCH 165/758] decomp: clarify names in update_fighter_jet_aim_and_fire_projectile D_L17_00162070 -> l17_fighter_jet_projectile_cooldown_reload: In the SHA-256-bound fighter_jet.c source, the int initialized to 4 is assigned to ship_vars+0x80 immediately after spawn_fighter_jet_missile. Retail 002ec050/002ec054 passes that same +0x80 field to fast_dec_timer and 002ec058 gates firing on its return. After the projectile call at 002ec0dc, 002ec0e8 loads this global through gp-0x4b90 and 002ec0f0 stores it to +0x80(s2). Original Ghidra likewise assigns uGpffffb470 to iVar2+0x80 after the spawn. This proves a projectile firing cooldown reload, distinct from the +0x84 rocket countdown and its existing reload global. --- src/overlays/l17/mobys/fighter_jet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l17/mobys/fighter_jet.c b/src/overlays/l17/mobys/fighter_jet.c index d2d9378904..430c880af9 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -977,7 +977,7 @@ extern unsigned char D_0013A4E0_u[] __asm__("D_0013A4E0"); extern short fighter_jet_aim_direction_base_length_gp __asm__("D_L17_0016206C") __attribute__((sda)); -int D_L17_00162070 = 4; +int l17_fighter_jet_projectile_cooldown_reload __asm__("D_L17_00162070") = 4; void update_fighter_jet_aim_and_fire_projectile(char *moby, char *ship_vars, float aim_azimuth, @@ -1004,7 +1004,7 @@ void update_fighter_jet_aim_and_fire_projectile(char *moby, moby_point_position(moby, 3 + (ship_vars[0x61] & 1), projectile_spawn_position); fast_vec_add(projectile_spawn_position, projectile_spawn_position, projectile_spawn_offset); spawn_fighter_jet_missile(moby, aim_direction, projectile_spawn_position, 200.0f, -1.0f); - *(int *)(ship_vars + 0x80) = D_L17_00162070; + *(int *)(ship_vars + 0x80) = l17_fighter_jet_projectile_cooldown_reload; ship_vars[0x61] ^= 1; } fast_vec_normalize(aim_direction, aim_direction, 23.0f); From 146b9a2a659657a8ec95f0b2000d962f74e5e749 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:17:35 +0000 Subject: [PATCH 166/758] decomp: clarify names in spawn_point_table_sparks D_L13_00161EEC -> l13_point_spark_table_index_and_flags: Authoritative C passes D_L13_00161EEC (int initialized to 24) as spawn_spark's ninth argument. Retail 0x00309e0c loads gp-0x4d14 and 0x00309e24 stores it to the outgoing stack argument before 0x00309e30. Checked level-13 callee 0x00274ac0 loads that argument into s1 at 0x00274b1c. At 0x00274b78-0x00274b94, -1 selects a default pointer. Otherwise 0x00274b98 masks its low 16 bits, 0x00274ba0 shifts by 2, and 0x00274ba4-0x00274bac indexes the pointer table at 0x001b2380; the pointed first byte is stored into spawned object+2 at 0x00274bbc. At 0x00274ba8/0x00274bb0 its bit 16 is tested, and 0x00274bc0/0x00274bc4 changes object+3 from 0x44 to 0x48 when set. Thus the scalar combines a spark table index with a mode flag, without asserting the table's unknown resource identity. Preserve assembler label, int type and stored value. --- src/overlays/l13/mobys/blarg_space_commando.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l13/mobys/blarg_space_commando.c b/src/overlays/l13/mobys/blarg_space_commando.c index aa822d10e9..e85b68f796 100644 --- a/src/overlays/l13/mobys/blarg_space_commando.c +++ b/src/overlays/l13/mobys/blarg_space_commando.c @@ -1073,7 +1073,7 @@ extern short point_spark_xy_multiplier_range_end __asm__("D_L13_00161EDC") __att extern short point_spark_z_range_start __asm__("D_L13_00161EE0") __attribute__((sda)); extern short point_spark_z_range_end __asm__("D_L13_00161EE4") __attribute__((sda)); extern short point_spark_spawn_random_threshold __asm__("D_L13_00161EE8") __attribute__((sda)); -int D_L13_00161EEC = 24; +int l13_point_spark_table_index_and_flags __asm__("D_L13_00161EEC") = 24; void spawn_point_table_sparks(struct Moby *moby) __asm__("FUN_L13_00309bc8"); @@ -1141,6 +1141,6 @@ void spawn_point_table_sparks(struct Moby *moby) { frame_count, second_frame_count, third_frame_count, - D_L13_00161EEC); + l13_point_spark_table_index_and_flags); } } From abd2c10299a544fdf0e849cb5f776c981f18f2f4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:17:47 +0000 Subject: [PATCH 167/758] decomp: clarify names in water_reservoir_update D_L12_001619F8 -> l12_water_reservoir_spark_table_selector: Retail 0x002ec9e0 loads gp-0x5208 (D_L12_001619F8, initialized 0x10022) into v1 and 0x002eca00 stores it at sp+0 before spawn_spark at 0x002eca04. Bounded level-12 helper 0x00281990 saves this ninth argument in s1 at 0x002819ec. At 0x00281a68-0x00281a8c its low 16 bits index the pointer table at 0x001b2500 with stride 4, and the selected object's first byte populates spark +2. At 0x00281a80-0x00281a94 bit 16 additionally selects mode byte 0x48. Thus this is the reservoir spark table selector; the name does not assume the table's resource type. --- src/overlays/l12/mobys/water_reservoir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l12/mobys/water_reservoir.c b/src/overlays/l12/mobys/water_reservoir.c index f7ec0774e1..15e3302afb 100644 --- a/src/overlays/l12/mobys/water_reservoir.c +++ b/src/overlays/l12/mobys/water_reservoir.c @@ -35,7 +35,7 @@ int D_L12_001619E8 = 1; int D_L12_001619F0 = 1; int D_L12_001619F4 = 0x40404040; -int D_L12_001619F8 = 0x10022; +int l12_water_reservoir_spark_table_selector __asm__("D_L12_001619F8") = 0x10022; #include "rnc/overlay/l12/mobys/water_reservoir_data/water_reservoir_update.h" @@ -122,7 +122,7 @@ void water_reservoir_update(struct Moby *moby) { D_L12_001619E8, scale_game_frames(water_reservoir_effect_delta_scale_divisor_gp), D_L12_001619F0, - D_L12_001619F8); + l12_water_reservoir_spark_table_selector); } } if ((moby->command & 1) && *(int *)&reservoir_state[1] == 0) { From 05a08142a53ac02ce3422cb3d0dad8985c8a2ba1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:21:35 +0000 Subject: [PATCH 168/758] decomp: clarify names in volume_camera_aim rec -> current_follow_camera_record: In the SHA-256 ddcac52fd576c327e9e726678c6defe16d2728ff5184c9a702d1e31fee278768 source, rec is assigned current_follow_cam, supplies FOLLOW_CAM_STATE(rec), and supplies &rec->pos for initialization. Retail 0x002ed654 loads that current-camera global into s3, 0x002ed658 loads its +0x70 state, and 0x002ed65c advances to its +0x30 position; 0x002ed678-0x002ed67c copies descriptor position there. The original Ghidra decompilation likewise sets iVar5 = DAT_00166e00, loads state from +0x70, and sets puVar7 to +0x30, proving this is the current follow-camera record rather than the aim_camera_record parameter. --- src/overlays/shared/camera/aim_volume_camera.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/camera/aim_volume_camera.c b/src/overlays/shared/camera/aim_volume_camera.c index f9be6deb8c..bf6b23db39 100644 --- a/src/overlays/shared/camera/aim_volume_camera.c +++ b/src/overlays/shared/camera/aim_volume_camera.c @@ -90,7 +90,7 @@ void volume_camera_aim(struct UpdateCam *aim_camera_record) { CameraVec gravity_offset; CameraVec level; AimCameraParams *params; - struct UpdateCam *rec; + struct UpdateCam *current_follow_camera_record; Vec4f *rec_pos; FollowCamState *rig; FollowCamState *state; @@ -141,9 +141,9 @@ void volume_camera_aim(struct UpdateCam *aim_camera_record) { params->offset_scale = params->height - params->distance * (fast_sin(angle) / fast_cos(angle)); } - rec = current_follow_cam; - rig = FOLLOW_CAM_STATE(rec); - rec_pos = &rec->pos; + current_follow_camera_record = current_follow_cam; + rig = FOLLOW_CAM_STATE(current_follow_camera_record); + rec_pos = ¤t_follow_camera_record->pos; follow = &rig->follow; tail = &rig->tail; snap = &rig->tail.snap; From 8a2b6e68307da0ea425addb068225e95bc2df2e9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:21:53 +0000 Subject: [PATCH 169/758] decomp: clarify names in draw_hud_counter D_L02_0015F944 -> l02_hud_counter_left_anchor_x: Authoritative C initializes this s32 to 0x18 and assigns it to x when hud_screen_position yields x < 0x101. Retail 0x0023ce04-0x0023ce14 selects gp-0x72bc on that left branch and stores it as the drawing x; 0x0023d068 passes the anchor unchanged to the HUD icon, while bar and text positions derive from it. D_L02_0015F948 -> l02_hud_counter_right_anchor_x: Authoritative C initializes this s32 to 0x1e0 and assigns it to x on the right-side branch. Retail 0x0023ce04-0x0023ce14 loads gp-0x72b8 when the positioned x is at least 0x101 and stores the selected drawing anchor; the right icon uses anchor minus 0x16 at 0x0023d094, and right-side bar/text coordinates derive from the same x. D_L02_0015F950 -> l02_hud_counter_text_fade_start_color: Authoritative C passes this s32 initialized to 0x00e08080 as the first endpoint of fast_tween_color with shade as its ratio. Retail 0x0023d080/0x0023d0a0 loads gp-0x72b0 into a0, 0x0023d0a4 supplies the clamped text shade, and 0x0023d0a8 returns the color saved in s0 and passed to foreground font_print_right at 0x0023d100/0x0023d144. D_L02_0015F954 -> l02_hud_counter_text_fade_end_color: Authoritative C passes this s32 initialized to 0x80e08080 as the second endpoint of fast_tween_color with shade as its ratio. Retail 0x0023d0ac loads gp-0x72ac into a1 for the tween at 0x0023d0a8; its result is saved in s0 and becomes foreground text color at 0x0023d100/0x0023d144. The separate black tween supplies the offset shadow. D_L02_0015F958 -> l02_hud_counter_narrow_bar_width: Authoritative C initializes this s32 to 0x30 and selects it as full_bar_width when hud_element->unk08 < 10. Retail 0x0023cf28-0x0023cf3c selects gp-0x72a8 on that branch; 0x0023cf44-0x0023cf5c converts and multiplies it by clamped grow. The resulting animated width is the middle sprite width at 0x0023cfa8/0x0023d02c, making 48 the narrower full bar geometry. D_L02_0015F95C -> l02_hud_counter_wide_bar_width: Authoritative C initializes this s32 to 0x46 and selects it as full_bar_width when hud_element->unk08 >= 10. Retail 0x0023cf28-0x0023cf3c loads gp-0x72a4 on that branch; 0x0023cf44-0x0023cf5c scales it by clamped grow into s2. The middle sprite width at 0x0023cfa8/0x0023d02c uses s2, proving 70 is the wider full bar geometry without assuming the identity of +0x08. --- src/overlays/l02/hud_counter.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l02/hud_counter.c b/src/overlays/l02/hud_counter.c index 6ce389193f..b28ff6d8d6 100644 --- a/src/overlays/l02/hud_counter.c +++ b/src/overlays/l02/hud_counter.c @@ -47,12 +47,12 @@ extern char hud_counter_decimal_format[] __asm__("D_L02_0015F850"); extern s32 hud_counter_bar_growth_divisor_gp __asm__("D_L02_0015F91C") __attribute__((sda)); extern s32 hud_counter_text_shade_divisor_gp __asm__("D_L02_0015F920") __attribute__((sda)); -s32 D_L02_0015F944 = 0x18; -s32 D_L02_0015F948 = 0x1e0; -s32 D_L02_0015F950 = 0xe08080; -s32 D_L02_0015F954 = 0x80e08080; -s32 D_L02_0015F958 = 0x30; -s32 D_L02_0015F95C = 0x46; +s32 l02_hud_counter_left_anchor_x __asm__("D_L02_0015F944") = 0x18; +s32 l02_hud_counter_right_anchor_x __asm__("D_L02_0015F948") = 0x1e0; +s32 l02_hud_counter_text_fade_start_color __asm__("D_L02_0015F950") = 0xe08080; +s32 l02_hud_counter_text_fade_end_color __asm__("D_L02_0015F954") = 0x80e08080; +s32 l02_hud_counter_narrow_bar_width __asm__("D_L02_0015F958") = 0x30; +s32 l02_hud_counter_wide_bar_width __asm__("D_L02_0015F95C") = 0x46; /* Draws the counter: a stretched bar behind the icon and the count, on whichever side of the screen it sits. */ s32 draw_hud_counter(HudElem *hud_element) __asm__("FUN_L02_0023cda8"); @@ -83,9 +83,9 @@ s32 draw_hud_counter(HudElem *hud_element) { hud_screen_position(hud_element, &x, &y); left = x < 0x101; if (left) { - x = D_L02_0015F944; + x = l02_hud_counter_left_anchor_x; } else { - x = D_L02_0015F948; + x = l02_hud_counter_right_anchor_x; } bottom = frame_size[0]; y = pal_mode != FALSE ? bottom - 0x2A : bottom - 0x32; @@ -106,9 +106,9 @@ s32 draw_hud_counter(HudElem *hud_element) { sprintf(text, hud_counter_decimal_format, hud_element->unk74); alpha = truncate_float_to_s32((f32)truncate_float_to_s32(grow * 128.0f) * 0.7f); if (hud_element->unk08 < 10) { - full_bar_width = D_L02_0015F958; + full_bar_width = l02_hud_counter_narrow_bar_width; } else { - full_bar_width = D_L02_0015F95C; + full_bar_width = l02_hud_counter_wide_bar_width; } px = x; bar = px + 4; @@ -134,7 +134,7 @@ s32 draw_hud_counter(HudElem *hud_element) { } else { hud_frame(hud_element, hud_element->icon, x - 0x16, y, 0, 0x80); } - bright = fast_tween_color(D_L02_0015F950, D_L02_0015F954, shade); + bright = fast_tween_color(l02_hud_counter_text_fade_start_color, l02_hud_counter_text_fade_end_color, shade); dark = fast_tween_color(0, 0x80000000, shade); if (left) { font_print_right(x + 0x43, y + 9, dark, text, -1); From f8104611fbe69160b534401e88bc7d3eb4d0ac88 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:22:09 +0000 Subject: [PATCH 170/758] decomp: clarify names in update_alien_snapper_hit_response_and_targeting D_L06_00161EE8 -> l06_alien_snapper_glow_gray_color: Authoritative src/overlays/l06/mobys/alien_snapper.c SHA-256 792a48beae0a21dd98d07c5388963e83d2001731a5c45afdbd20f26da7826877 defines this int as 0x80808080, with equal packed color components. Retail 0x002f9560 loads gp-0x4d18 into a0; 0x002f9568 passes it with the other color to 0x00218338 and 0x002f9570 stores the returned packed word at moby+0x90, named glow_color in the authoritative C. Original Ghidra agrees through uGpffffb2e8. The factor at 0x002f9544-0x002f956c is (sin(glow phase)+1)*0.5, proving this gray color belongs to the alien snapper glow blend without requiring endpoint direction. D_L06_00161EEC -> l06_alien_snapper_glow_tinted_color: Authoritative src/overlays/l06/mobys/alien_snapper.c SHA-256 792a48beae0a21dd98d07c5388963e83d2001731a5c45afdbd20f26da7826877 defines this int as packed color 0x80604040, whose component bytes differ, unlike the paired gray 0x80808080. Retail 0x002f9564 loads gp-0x4d14 into a1 for the direct call at 0x002f9568; 0x002f9570 stores that helper's return at moby+0x90 (glow_color). Original Ghidra identifies the same input as uGpffffb2ec. Source assigns func_001FA8A8_2FA618(the gray global, this global, (fast_sin(snapper_vars->f1C8)+1)*0.5) to glow_color. This proves a tinted glow-blend color while leaving channel ordering and blend direction unspecified. --- src/overlays/l06/mobys/alien_snapper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l06/mobys/alien_snapper.c b/src/overlays/l06/mobys/alien_snapper.c index 251b6f9eec..ba085d7542 100644 --- a/src/overlays/l06/mobys/alien_snapper.c +++ b/src/overlays/l06/mobys/alien_snapper.c @@ -242,9 +242,9 @@ extern int D_001413D0[]; #include "rnc/overlay/l06/mobys/alien_snapper_data/update_alien_snapper_hit_response_and_targeting.h" -int D_L06_00161EE8 = 0x80808080; +int l06_alien_snapper_glow_gray_color __asm__("D_L06_00161EE8") = 0x80808080; -int D_L06_00161EEC = 0x80604040; +int l06_alien_snapper_glow_tinted_color __asm__("D_L06_00161EEC") = 0x80604040; extern int resolve_moby_hit_response() __asm__("FUN_00213928"); void trooper_anim_update(void *a, void *s) __asm__("FUN_L00_0025d458"); @@ -869,7 +869,7 @@ void update_alien_snapper_hit_response_and_targeting(Moby *moby) { snapper_vars->f1C8 = fast_add_rotations( snapper_vars->f1C8, alien_snapper_glow_phase_speed_degrees_gp * 0.017453292f * frame_time); moby->glow_color = func_001FA8A8_2FA618( - D_L06_00161EE8, D_L06_00161EEC, (fast_sin(snapper_vars->f1C8) + 1.0f) * 0.5f); + l06_alien_snapper_glow_gray_color, l06_alien_snapper_glow_tinted_color, (fast_sin(snapper_vars->f1C8) + 1.0f) * 0.5f); if (snapper_vars->f1AC != 0) { snapper_vars->f1A0 = l06_alien_snapper_base_targeting_radius + 6.0f; From 8dbc961776512612da8f55e7e3e6e3158a5c7f28 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:22:24 +0000 Subject: [PATCH 171/758] decomp: clarify names in update_alien_queen_hit_response_and_recovery D_L06_00161F10 -> l06_alien_queen_glow_tween_start_color: Authoritative alien_queen.c defines this int as 0x80808080 and passes it as the first color to fast_tween_color. Retail 0x002fb008 loads gp-0x4cf0 into a0, followed by the tween call at 0x002fb010; 0x002fb004/0x002fb014 supply (sin(pvars+0x128)+1)*0.5 as blend fraction, and 0x002fb018 stores the returned color at moby+0x90 (glow_color). Original Ghidra uGpffffb310 agrees. This proves the start endpoint of the queen glow tween. D_L06_00161F14 -> l06_alien_queen_glow_tween_end_color: Authoritative alien_queen.c defines this int as 0x80804080 and passes it as the second color to fast_tween_color. Retail 0x002fb00c loads gp-0x4cec into a1 for the tween call at 0x002fb010, with the sine-derived blend fraction in f12 at 0x002fb014; the result is stored to moby+0x90 glow_color at 0x002fb018. Original Ghidra uGpffffb314 agrees. This proves the end endpoint of the queen glow tween, distinct from the first color. --- src/overlays/l06/mobys/alien_queen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l06/mobys/alien_queen.c b/src/overlays/l06/mobys/alien_queen.c index cde0a1166c..d47f402d8e 100644 --- a/src/overlays/l06/mobys/alien_queen.c +++ b/src/overlays/l06/mobys/alien_queen.c @@ -197,9 +197,9 @@ extern int D_L06_001413D0 NOT_SDA; #include "rnc/overlay/l06/mobys/alien_queen_data/update_alien_queen_hit_response_and_recovery.h" -int D_L06_00161F10 = 0x80808080; +int l06_alien_queen_glow_tween_start_color __asm__("D_L06_00161F10") = 0x80808080; -int D_L06_00161F14 = 0x80804080; +int l06_alien_queen_glow_tween_end_color __asm__("D_L06_00161F14") = 0x80804080; /* Updates the object's health, hit response, recovery timer and path motion. */ void update_alien_queen_hit_response_and_recovery(char *moby) __asm__("FUN_L06_002fa9c0"); @@ -966,8 +966,8 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { fast_add_rotations(alien_queen_hit_recovery_vars->unk128, alien_queen_glow_phase_speed_degrees_gp * 0.017453292f * frame_time); MOBY(moby)->glow_color = - fast_tween_color(D_L06_00161F10, - D_L06_00161F14, + fast_tween_color(l06_alien_queen_glow_tween_start_color, + l06_alien_queen_glow_tween_end_color, (fast_sin(alien_queen_hit_recovery_vars->unk128) + 1.0f) * 0.5f); path = D_L06_001B0C30[alien_queen_hit_recovery_vars->path]; FUN_L00_0025ff38(moby, &alien_queen_hit_recovery_vars->unk70, 0, 0, path + 4, *path, 255.0f); From 4a0d41e5bdbc4ae7f9311d43510a0db445b848cb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:24:54 +0000 Subject: [PATCH 172/758] decomp: clarify names in spawn_fighter_jet_joint_particles D_L13_001613D8 -> l13_fighter_jet_first_spawn_particle_definition: Retail 0x002b8734 passes gp-0x5828 in a3 to the particle call at 0x002b874c, using first_particle_spawn_position (sp+0x20); 0x002b8860/0x002b8878 reuses the same definition for that buffer in the conditional block. Source binds this address to D_L13_001613D8. The checked level-13 helper 0x00281100 saves a3 in s4 at 0x0028111c, retains that definition address at particle+0x3c (0x00281224), copies its +0x0 word to particle+0x4 (0x00281230-34), and its +0xc halfword to particle+0xa (0x00281228-2c). The existing short declaration anchors that particle definition; no type or data bytes are changed. D_L13_001613E8 -> l13_fighter_jet_second_spawn_particle_definition: Retail 0x002b877c passes gp-0x5818 in a3 to the particle call at 0x002b8794, using second_particle_spawn_position (sp+0x30); 0x002b88a8/0x002b88c0 reuses it for that buffer in the conditional block. Source binds this address to D_L13_001613E8. The checked level-13 helper 0x00281100 saves a3 in s4 at 0x0028111c, retains that definition address at particle+0x3c (0x00281224), copies its +0x0 word to particle+0x4 (0x00281230-34), and its +0xc halfword to particle+0xa (0x00281228-2c). The existing short declaration anchors that particle definition; no type or data bytes are changed. D_L13_001613F8 -> l13_fighter_jet_third_spawn_particle_definition: Retail 0x002b87c4 passes gp-0x5808 in a3 to the particle call at 0x002b87dc, using third_particle_spawn_position (sp+0x40); 0x002b88f0/0x002b8908 reuses it for that buffer in the conditional block. Source binds this address to D_L13_001613F8. The checked level-13 helper 0x00281100 saves a3 in s4 at 0x0028111c, retains that definition address at particle+0x3c (0x00281224), copies its +0x0 word to particle+0x4 (0x00281230-34), and its +0xc halfword to particle+0xa (0x00281228-2c). The existing short declaration anchors that particle definition; no type or data bytes are changed. D_L13_00161408 -> l13_fighter_jet_extra_offset_particle_definition: Retail 0x002b8938 passes gp-0x57f8 in a3 to 0x002b8950, an additional emission using the randomly offset first_particle_spawn_position (s2/sp+0x20). It occurs only after the flight_data+0xc4 > 0.5 test at 0x002b87f4-0x002b87fc. Source binds this definition to D_L13_00161408. The checked level-13 helper 0x00281100 saves a3 in s4 at 0x0028111c, retains that definition address at particle+0x3c (0x00281224), copies its +0x0 word to particle+0x4 (0x00281230-34), and its +0xc halfword to particle+0xa (0x00281228-2c). The existing short declaration anchors that particle definition; no type or data bytes are changed. D_L13_00161418 -> l13_fighter_jet_extra_joint_particle_definition: Retail 0x002b8980 passes gp-0x57e8 in a3 to 0x002b8998, an additional emission using joint_world_position directly (s7/sp+0x10 at 0x002b8974), unlike the offset spawn buffers. It is gated by flight_data+0xc4 > 0.5. Source binds this definition to D_L13_00161418. The checked level-13 helper 0x00281100 saves a3 in s4 at 0x0028111c, retains that definition address at particle+0x3c (0x00281224), copies its +0x0 word to particle+0x4 (0x00281230-34), and its +0xc halfword to particle+0xa (0x00281228-2c). The existing short declaration anchors that particle definition; no type or data bytes are changed. --- src/overlays/l13/mobys/fighter_jet.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/l13/mobys/fighter_jet.c b/src/overlays/l13/mobys/fighter_jet.c index 853d0bb33b..bed7fc5f53 100644 --- a/src/overlays/l13/mobys/fighter_jet.c +++ b/src/overlays/l13/mobys/fighter_jet.c @@ -112,15 +112,15 @@ extern void add_random_offset_to_vector_xyz(float *v, float s) __asm__("FUN_L00_ extern void spawn_type_74_particle(void *, float *, float *, void *, int) __asm__("FUN_L01_0028a7a8"); -short D_L13_001613D8 = 0xff; +short l13_fighter_jet_first_spawn_particle_definition __asm__("D_L13_001613D8") = 0xff; -short D_L13_001613E8 = -1; +short l13_fighter_jet_second_spawn_particle_definition __asm__("D_L13_001613E8") = -1; -short D_L13_001613F8 = 0x7f4f; +short l13_fighter_jet_third_spawn_particle_definition __asm__("D_L13_001613F8") = 0x7f4f; -short D_L13_00161408 = -32513; +short l13_fighter_jet_extra_offset_particle_definition __asm__("D_L13_00161408") = -32513; -short D_L13_00161418 = 0x7f00; +short l13_fighter_jet_extra_joint_particle_definition __asm__("D_L13_00161418") = 0x7f00; /* Sets the state of every live moby of class id whose state is not negative. */ /* Ported from rac1-decomp (src/overlays/l13_gemlik/mobyutil_00266128.c: func_L13_00266128), where it is exact; names translated to the US level program. */ @@ -319,19 +319,19 @@ void spawn_fighter_jet_joint_particles(void *moby, char *flight_data) { frame_time) * particle_velocity_scale; spawn_type_74_particle( - moby, first_particle_spawn_position, initial_particle_velocity, &D_L13_001613D8, 1); + moby, first_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_first_spawn_particle_definition, 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 3.0f) * frame_time) * particle_velocity_scale; spawn_type_74_particle( - moby, second_particle_spawn_position, initial_particle_velocity, &D_L13_001613E8, 1); + moby, second_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_second_spawn_particle_definition, 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 4.0f) * frame_time) * particle_velocity_scale; spawn_type_74_particle( - moby, third_particle_spawn_position, initial_particle_velocity, &D_L13_001613F8, 1); + moby, third_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_third_spawn_particle_definition, 1); if (*(float *)(flight_data + 0xC4) > 0.5f) { add_random_offset_to_vector_xyz(first_particle_spawn_position, *(float *)(flight_data + 0xC4) * 0.02f + 0.01f); @@ -344,7 +344,7 @@ void spawn_fighter_jet_joint_particles(void *moby, char *flight_data) { frame_time) * particle_velocity_scale; spawn_type_74_particle( - moby, first_particle_spawn_position, initial_particle_velocity, &D_L13_001613D8, 1); + moby, first_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_first_spawn_particle_definition, 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 3.0f) * frame_time) * @@ -352,26 +352,26 @@ void spawn_fighter_jet_joint_particles(void *moby, char *flight_data) { spawn_type_74_particle(moby, second_particle_spawn_position, initial_particle_velocity, - &D_L13_001613E8, + &l13_fighter_jet_second_spawn_particle_definition, 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 4.0f) * frame_time) * particle_velocity_scale; spawn_type_74_particle( - moby, third_particle_spawn_position, initial_particle_velocity, &D_L13_001613F8, 1); + moby, third_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_third_spawn_particle_definition, 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 2.0f) * frame_time) * particle_velocity_scale; spawn_type_74_particle( - moby, first_particle_spawn_position, initial_particle_velocity, &D_L13_00161408, 1); + moby, first_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_extra_offset_particle_definition, 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 3.0f) * frame_time) * particle_velocity_scale; spawn_type_74_particle( - moby, joint_world_position, initial_particle_velocity, &D_L13_00161418, 1); + moby, joint_world_position, initial_particle_velocity, &l13_fighter_jet_extra_joint_particle_definition, 1); } } } From e3b3e2ee46eb7d8d1617144fd5171354b526a666 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:25:08 +0000 Subject: [PATCH 173/758] decomp: clarify names in scenery_ship_update D_L05_001613D8 -> l05_scenery_ship_glow_pulse_start_color: Authoritative source declares int initialized to 0x80000080 and passes it as the first color to func_001FA8A8_2D8388. Retail 0x002d7490 loads gp-0x5828 into a0, paired with a1 at 0x002d7494; 0x002d7498 interpolates with (wave+1)*0.5 and 0x002d74a0 stores the result to moby+0x90 (glow_color). Original Ghidra agrees via uGpffffa7d8. This is the start endpoint of the ship glow pulse color interpolation. D_L05_001613DC -> l05_scenery_ship_glow_pulse_end_color: Authoritative source declares int initialized to 0x80202020 and uses it as the second color in the wave-driven glow interpolation. Retail 0x002d7494 loads gp-0x5824 into a1, paired with the first color in a0; 0x002d7498 calls the color interpolation and 0x002d74a0 writes moby+0x90 (glow_color). Original Ghidra shows uGpffffa7dc in this same position. This proves the end endpoint of the ship glow pulse interpolation. D_L05_001613E0 -> l05_scenery_ship_trail_segment_limit: Authoritative source defines this float as 5.0f. Retail 0x002d7500 converts the short at instance+0x320 to float, 0x002d7514 loads gp-0x5820, and 0x002d7524-0x002d7538 increments that short only while below this limit; original Ghidra confirms comparison against fGpffffa7e0. The supplied draw_group_scenery_ship_trails source assigns this global 16.0f or 5.0f, uses it to normalize fading, and draws frame < short(instance+0x320) trail segments, proving its trail segment limit role. D_L05_001613E4 -> l05_scenery_ship_glow_update_enabled: Authoritative source defines this int as 1 and guards update_moby_glow_and_queue_draw(moby) with if(D_L05_001613E4). Retail 0x002d7848 loads gp-0x581c, 0x002d784c skips when zero, and 0x002d7854 calls 0x002d7020 otherwise. Original Ghidra confirms iGpffffa7e4 controls that call. The supplied 0x002d7020 source updates glow positions/color and queues its draw callback, proving the glow-update enable role. --- src/overlays/l05/mobys/scenery_ship.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l05/mobys/scenery_ship.c b/src/overlays/l05/mobys/scenery_ship.c index a7b0962edf..e8ff27679a 100644 --- a/src/overlays/l05/mobys/scenery_ship.c +++ b/src/overlays/l05/mobys/scenery_ship.c @@ -133,10 +133,10 @@ extern float D_0015ED70; #include "rnc/overlay/l05/mobys/scenery_ship_data/scenery_ship_update.h" -int D_L05_001613D8 = 0x80000080; -int D_L05_001613DC = 0x80202020; -float D_L05_001613E0 = 5.0f; -int D_L05_001613E4 = 1; +int l05_scenery_ship_glow_pulse_start_color __asm__("D_L05_001613D8") = 0x80000080; +int l05_scenery_ship_glow_pulse_end_color __asm__("D_L05_001613DC") = 0x80202020; +float l05_scenery_ship_trail_segment_limit __asm__("D_L05_001613E0") = 5.0f; +int l05_scenery_ship_glow_update_enabled __asm__("D_L05_001613E4") = 1; extern float scenery_ship_removal_effect_basis_scale_gp __asm__("D_L05_001613E8") __attribute__((sda)); extern float scenery_ship_removal_effect_z_addend_gp __asm__("D_L05_001613EC") __attribute__((sda)); @@ -254,14 +254,14 @@ void scenery_ship_update(char *moby) { scenery_ship_instance_vars->f1C = phase; wave = func_001F9FA8_2D8388(phase); MOBY(moby)->glow_color = - func_001FA8A8_2D8388(D_L05_001613D8, D_L05_001613DC, (wave + 1.0f) * 0.5f); + func_001FA8A8_2D8388(l05_scenery_ship_glow_pulse_start_color, l05_scenery_ship_glow_pulse_end_color, (wave + 1.0f) * 0.5f); advance_scenery_ship_along_path(moby, (int *)l05_paths[scenery_ship_instance_vars->path]); if (voice_is_playing(moby, scenery_ship_instance_vars->f328) == 0) { scenery_ship_instance_vars->f328 = allocate_voice_for_target_entry(1, 4, (int)moby); } if ((frame_number & 3) == 0) { scenery_ship_instance_vars->f322 = (scenery_ship_instance_vars->f322 + 1) & 0xF; - if ((float)scenery_ship_instance_vars->f320 < D_L05_001613E0) { + if ((float)scenery_ship_instance_vars->f320 < l05_scenery_ship_trail_segment_limit) { scenery_ship_instance_vars->f320++; } } @@ -356,7 +356,7 @@ void scenery_ship_update(char *moby) { return; } } - if (D_L05_001613E4) + if (l05_scenery_ship_glow_update_enabled) update_moby_glow_and_queue_draw(moby); } /* Ported from rac1-decomp (src/overlays/l05_rilgar/vendor_002D28D0.c: func_L05_002D8AD8), where it is exact; names translated to the US level program. */ @@ -429,9 +429,9 @@ void draw_group_scenery_ship_trails(struct Moby *moby) { if (l05_scenery_ship_trail_callback_disabled != 0) return; if (l05_scenery_ship_extended_trail_selector != 0) - D_L05_001613E0 = 16.0f; + l05_scenery_ship_trail_segment_limit = 16.0f; else - D_L05_001613E0 = 5.0f; + l05_scenery_ship_trail_segment_limit = 5.0f; for (i = 0; i < 16; i++) { texture = get_effect_texture(0x13); glow_packet = &packet[i]; @@ -441,11 +441,11 @@ void draw_group_scenery_ship_trails(struct Moby *moby) { glow_packet->flags = (u64)l05_scenery_ship_trail_blend_a_selector | ((u64)D_L05_001613FC << 2) | ((u64)l05_scenery_ship_trail_blend_c_selector << 4) | ((u64)D_L05_00161404 << 6) | 0x8000000000ULL; - phase = convert_integer_to_float((frame_number + 3) & 3) / (D_L05_001613E0 * 4.0f); + phase = convert_integer_to_float((frame_number + 3) & 3) / (l05_scenery_ship_trail_segment_limit * 4.0f); for (j = 0; j < 4; j++) { packet[i].uv[j][0] = D_L05_001CDD70[j][0]; packet[i].uv[j][1] = D_L05_001CDD70[j][1]; - ratio = convert_integer_to_float(i + 1 - (j >> 1)) / (D_L05_001613E0 + phase); + ratio = convert_integer_to_float(i + 1 - (j >> 1)) / (l05_scenery_ship_trail_segment_limit + phase); if (ratio > 1.0f) ratio = 1.0f; else if (ratio < 0.0f) From 217933bfdf1796b311d1899869cb3bf25d61bbf6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:25:18 +0000 Subject: [PATCH 174/758] decomp: clarify names in handle_extermitank_hits_and_sync_children D_L05_00161B74 -> l05_extermitank_removal_base_frames: The authoritative source declares this int initialized to 5 and passes it to scale_game_frames before storing the result in extermitank_hit_sync_vars->unk19E and assigning EXTERMITANK_REMOVE. Retail 00305500 loads a0 from gp-0x508c (D_L05_00161B74), the delay slot of the scale_game_frames call at 003054fc; 00305504 stores v0 as a halfword at s7+0x19e, and 0030550c..00305514 sets the same moby's state to 3. Original retail decompilation likewise scales uGpffffaf74, stores at private state +0x19e and then assigns state 3. This proves an unscaled removal-transition frame count, qualified for level 05. --- 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 3daef698ff..6126ebade9 100644 --- a/src/overlays/l05/mobys/extermitank.c +++ b/src/overlays/l05/mobys/extermitank.c @@ -530,7 +530,7 @@ extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa6 extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern void finish_motion_305178(void *, void *) __asm__("FUN_L00_0025d538"); -int D_L05_00161B74 = 5; +int l05_extermitank_removal_base_frames __asm__("D_L05_00161B74") = 5; extern float extermitank_child_animation_speed_divisor_gp __asm__("D_L05_00161AF0") __attribute__((sda)); extern float extermitank_child_animation_speed_offset_scale_gp __asm__("D_L05_00161AF4") @@ -650,7 +650,7 @@ void handle_extermitank_hits_and_sync_children(char *moby) { 1, -1, 0); - extermitank_hit_sync_vars->unk19E = scale_game_frames(D_L05_00161B74); + extermitank_hit_sync_vars->unk19E = scale_game_frames(l05_extermitank_removal_base_frames); MOBY(moby)->state = EXTERMITANK_REMOVE; clear_u64_value(effect_data); *(float *)(effect_data + 8) = extermitank_hit_sync_vars->unk194; From 95e77c3922f9e218901630a3fc77ee8dd54b0531 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:25:33 +0000 Subject: [PATCH 175/758] decomp: clarify names in emit_burst_spark_particle D_L10_00161F94 -> l10_burst_spark_initial_color_from: Retail 0x002ea6f4 loads gp-0x4c6c into a0, the first packed-color operand of fast_tween_color at 0x002ea6fc; 0x002ea700 loads its paired endpoint. The random factor is sampled in [0,1] at 0x002ea6ec. The result is retained in s0 at 0x002ea708 and passed in a3 at 0x002ea728 to spawn_spark, matching authoritative source initial_spark_color. The owned int definition is 0x4000ff80; this is the from endpoint for that initial color. D_L10_00161F98 -> l10_burst_spark_initial_color_to: Retail 0x002ea700 loads gp-0x4c68 into a1 in the delay slot of fast_tween_color at 0x002ea6fc, paired with the a0 endpoint loaded at 0x002ea6f4. The [0,1] random interpolation result is retained in s0 at 0x002ea708 and passed as spawn_spark argument four at 0x002ea728, matching source initial_spark_color. The owned int definition is 0x4010ffff; this is the to endpoint of the initial-color tween. D_L10_00161F9C -> l10_burst_spark_second_color_from: Retail 0x002ea714 loads gp-0x4c64 into a0, the first packed-color operand of the second fast_tween_color call at 0x002ea71c. Its factor comes from random_float_between(0,1) at 0x002ea70c. The result moves into t0 at 0x002ea72c and becomes spawn_spark argument five at 0x002ea744, immediately after initial_spark_color. Source uses this owned int initialized to 0x2000ff80 as the first endpoint for the second spark color. D_L10_00161FA0 -> l10_burst_spark_second_color_to: Retail 0x002ea720 loads gp-0x4c60 into a1 in the delay slot of the second fast_tween_color call at 0x002ea71c, paired with the endpoint loaded at 0x002ea714. The random [0,1] tween result passes via t0 at 0x002ea72c as spawn_spark argument five at 0x002ea744. Authoritative source uses this owned int initialized to 0x200080ff as the second endpoint of that second-color interpolation. --- .../l10/mobys/configurable_particle_emitter.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l10/mobys/configurable_particle_emitter.c b/src/overlays/l10/mobys/configurable_particle_emitter.c index 7b7f419042..760c687b93 100644 --- a/src/overlays/l10/mobys/configurable_particle_emitter.c +++ b/src/overlays/l10/mobys/configurable_particle_emitter.c @@ -160,10 +160,10 @@ extern int burst_spark_base_frame_count_gp __asm__("D_L10_00161F84") __attribu extern int burst_spark_base_second_frame_count_gp __asm__("D_L10_00161F88") __attribute__((sda)); extern int burst_spark_base_third_frame_count_gp __asm__("D_L10_00161F8C") __attribute__((sda)); extern float burst_spark_frame_count_scale_spread_gp __asm__("D_L10_00161F90") __attribute__((sda)); -int D_L10_00161F94 = 0x4000ff80; -int D_L10_00161F98 = 0x4010ffff; -int D_L10_00161F9C = 0x2000ff80; -int D_L10_00161FA0 = 0x200080ff; +int l10_burst_spark_initial_color_from __asm__("D_L10_00161F94") = 0x4000ff80; +int l10_burst_spark_initial_color_to __asm__("D_L10_00161F98") = 0x4010ffff; +int l10_burst_spark_second_color_from __asm__("D_L10_00161F9C") = 0x2000ff80; +int l10_burst_spark_second_color_to __asm__("D_L10_00161FA0") = 0x200080ff; extern int burst_spark_timer_reset_min_gp __asm__("D_L10_00161FA4") __attribute__((sda)); extern int burst_spark_timer_reset_max_gp __asm__("D_L10_00161FA8") __attribute__((sda)); extern int burst_spark_active_duration_min_gp __asm__("D_L10_00161FAC") __attribute__((sda)); @@ -212,12 +212,12 @@ void emit_burst_spark_particle(void *emission_position, short *timer, short *bur third_frame_count = truncate_float_to_s32((float)burst_spark_base_third_frame_count_gp * frame_count_scale); initial_spark_color = - fast_tween_color(D_L10_00161F94, D_L10_00161F98, random_float_between(0.0f, 1.0f)); + fast_tween_color(l10_burst_spark_initial_color_from, l10_burst_spark_initial_color_to, random_float_between(0.0f, 1.0f)); spawn_spark(emission_position, burst_spark_vertical_vector, acc, initial_spark_color, - fast_tween_color(D_L10_00161F9C, D_L10_00161FA0, random_float_between(0.0f, 1.0f)), + fast_tween_color(l10_burst_spark_second_color_from, l10_burst_spark_second_color_to, random_float_between(0.0f, 1.0f)), frame_count, second_frame_count, third_frame_count, From 75005e8ae04ff51a2d308c1a6316091153f8e7d9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:25:45 +0000 Subject: [PATCH 176/758] decomp: clarify names in emit_sand_shark_radial_particles D_L02_00161958 -> l02_sand_shark_radial_particle_initial_color: Authoritative C defines int 0x60306058 and passes it as spawn_spark argument 4. Retail 0x002d5a04 loads gp-0x52a8 into a3 for 0x002d5a20. Bounded level-02 helper 0x0026a75c saves a3 in s5; 0x0026a7b0 stores it at particle+4 and 0x0026a8b4 at payload+8 (particle+0x28). The established same-file single-particle emitter passes its initial_color binding in exactly this argument slot, supporting the initial packed color role independently of overlay ownership. D_L02_0016195C -> l02_sand_shark_radial_particle_secondary_color: Authoritative C defines int 0x20306058 and passes it as spawn_spark argument 5. Retail 0x002d5a0c loads gp-0x52a4 into t0 for 0x002d5a20. Bounded level-02 helper 0x0026a744 preserves t0 in s8 and 0x0026a8b8 stores it at payload+0xc (particle+0x2c), adjacent to the copied initial color at payload+8. The established same-file single-particle emitter names this same argument slot secondary_color; these distinct labels receive distinct radial-particle names. --- src/overlays/l02/mobys/sand_shark.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index a5a2414405..659cab8ef8 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -1021,8 +1021,8 @@ extern int sand_shark_particle_third_frame_count_range_start_gp __asm__("D_L02_0 __attribute__((sda)); extern int sand_shark_particle_third_frame_count_range_end_gp __asm__("D_L02_00161954") __attribute__((sda)); -int D_L02_00161958 = 0x60306058; -int D_L02_0016195C = 0x20306058; +int l02_sand_shark_radial_particle_initial_color __asm__("D_L02_00161958") = 0x60306058; +int l02_sand_shark_radial_particle_secondary_color __asm__("D_L02_0016195C") = 0x20306058; int D_L02_00161960 = -1; /* Same routine as FUN_L12_002e19a8: spawns n particles around pos, fewer when D_L02_00160178 is high. */ @@ -1078,8 +1078,8 @@ void emit_sand_shark_radial_particles(void *particle_origin, int particle_count) spawn_spark(particle_position, vertical_motion, radial_motion, - D_L02_00161958, - D_L02_0016195C, + l02_sand_shark_radial_particle_initial_color, + l02_sand_shark_radial_particle_secondary_color, frame_count, second_frame_count, third_frame_count, From 9517930758925b66f1171421b58323416b92ab82 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:25:56 +0000 Subject: [PATCH 177/758] decomp: clarify names in hero_relocation_trigger_update D_L10_00161388 -> l10_relocation_help_counter_reset_pending: The owned int definition is initialized to 1. Retail 0x00298b90 loads its gp-relative binding (-0x5878); 0x00298b94 skips the reset unless it equals 1, then 0x00298ba0 clears the flag and 0x00298ba4 clears the halfword at 0x00141948. Original Ghidra shows iGpffffa788 == 1 followed by both clears. Source identifies 0x00141948 as usage_stats.stat[32].count; retail 0x00298d24-0x00298d4c bounds and increments that same counter before try_set_help_message(1,0x53F1) at 0x00298dc8. Thus the flag means pending reset of the relocation help counter. --- src/overlays/l10/mobys/hero_relocation_trigger.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l10/mobys/hero_relocation_trigger.c b/src/overlays/l10/mobys/hero_relocation_trigger.c index 51619dba05..eb56884a56 100644 --- a/src/overlays/l10/mobys/hero_relocation_trigger.c +++ b/src/overlays/l10/mobys/hero_relocation_trigger.c @@ -45,7 +45,7 @@ typedef struct { int switch_b; } PickupVars; -int D_L10_00161388 = 1; +int l10_relocation_help_counter_reset_pending __asm__("D_L10_00161388") = 1; extern char *D_L10_0015FFD8_98b68 __asm__("D_L10_0015FFD8"); extern int D_L10_001BA950[]; extern u8 D_001413F4_98b68[] __asm__("D_001413F4"); @@ -65,8 +65,8 @@ void hero_relocation_trigger_update(struct Moby *moby) { struct Moby *target; moby->update_dist = 0xFF; relocation_trigger_vars = (PickupVars *)moby->pvars; - if (D_L10_00161388 == 1) { - D_L10_00161388 = 0; + if (l10_relocation_help_counter_reset_pending == 1) { + l10_relocation_help_counter_reset_pending = 0; D_00141948 = 0; } if (relocation_trigger_vars->switch_a != -1 && relocation_trigger_vars->switch_b != -1) { From bd0f54c34f8049bc3190b6d308c35cc619431cdb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:26:10 +0000 Subject: [PATCH 178/758] decomp: clarify names in handle_extermibot_hits_and_update_targeting D_L05_00161A74 -> l05_extermibot_glow_color_start: Source declares int D_L05_00161A74 = 0x80004000 and passes it as the first color to fast_tween_color. Original retail Ghidra agrees: uGpffffae74 is the first color operand. At 0x00303948 lw a0,-0x518c(gp) loads this endpoint before the tween call at 0x00303950; 0x0030395c stores its interpolated output to moby+0x90, identified by authoritative C as glow_color. Thus it is the start color endpoint, with level-05 ownership. D_L05_00161A78 -> l05_extermibot_glow_color_end: Source declares int D_L05_00161A78 = 0x80008000 and passes it as the second color to fast_tween_color. Original retail Ghidra agrees: uGpffffae78 is the second color operand. At 0x0030394c lw a1,-0x5188(gp) loads this endpoint before the tween call at 0x00303950; 0x00303954 supplies the oscillating blend factor and 0x0030395c stores the output to moby+0x90 (glow_color). Thus it is the end color endpoint, with level-05 ownership. --- src/overlays/l05/mobys/extermibot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l05/mobys/extermibot.c b/src/overlays/l05/mobys/extermibot.c index 5b394d52ba..8b18d4e85a 100644 --- a/src/overlays/l05/mobys/extermibot.c +++ b/src/overlays/l05/mobys/extermibot.c @@ -719,8 +719,8 @@ typedef struct Wing { float f2D8; } Wing; -int D_L05_00161A74 = 0x80004000; -int D_L05_00161A78 = 0x80008000; +int l05_extermibot_glow_color_start __asm__("D_L05_00161A74") = 0x80004000; +int l05_extermibot_glow_color_end __asm__("D_L05_00161A78") = 0x80008000; #include "rnc/overlay/l05/mobys/extermibot_data/handle_extermibot_hits_and_update_targeting_2.h" @@ -907,7 +907,7 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { } moby_data->f2D8 = fast_add_rotations(moby_data->f2D8, D_0015ED6C * 9.424778f); moby->glow_color = fast_tween_color( - D_L05_00161A74, D_L05_00161A78, (func_001F9FA8_3047E8(moby_data->f2D8) + 1.0f) * 0.5f); + l05_extermibot_glow_color_start, l05_extermibot_glow_color_end, (func_001F9FA8_3047E8(moby_data->f2D8) + 1.0f) * 0.5f); k = moby->state; if (k < 10) { if (k >= 4 && moby_data->target == (*(Moby **)D_001413D0_lui)) { From c7c486c47261584760bdb40ab7b1ba2db89d1071 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:29:57 +0000 Subject: [PATCH 179/758] decomp: clarify names in elevator_update D_L06_00161F6C -> l06_elevator_pulse_dim_color: In the authoritative C this int is initialized to 0x80202020 and is the first fast_tween_color endpoint. Retail 0x002fd028 loads gp-0x4c94 into a0, and 0x002fd02c calls the color tween with the clamped sine-derived blend in f12. The resulting color is stored at moby+0x90 at 0x002fd034; its RGB channels are the dim endpoint relative to 0x80808080. D_L06_00161F70 -> l06_elevator_pulse_bright_color: The authoritative int initializer is 0x80808080, the brighter RGB endpoint of fast_tween_color(D_L06_00161F6C,D_L06_00161F70,color_blend). Retail 0x002fd030 loads gp-0x4c90 into a1 in the tween call delay slot; 0x002fcfd0-0x002fd024 derives and clamps the sine pulse blend, and 0x002fd034 stores the tween output to moby+0x90. D_L06_00161F74 -> l06_elevator_move_and_clearance_color: Retail 0x002fcf90-0x002fcf98 tests unsigned moby state minus 5 < 4, selecting movement states 5/6 and clearance states 7/8. The load at 0x002fcfa0 reads gp-0x4c8c, bypasses the pulse tween, clears the pulse phase at 0x002fcfa8 and stores this value to moby+0x90 at 0x002fd034. The authoritative C identifies the corresponding int initializer as 0x80208020. D_L06_00161F78 -> l06_elevator_scene_3_latch: The int starts at -1. Retail 0x002fc6d8-0x002fc700 initializes gp-0x4c88 once from whether byte 0x0013d4d6 is nonzero. At 0x002fca4c-0x002fca60 that byte must be nonzero and the global zero before storing 1, immediately followed by start_scene(3) at 0x002fca64-0x002fca68. This proves a latched guard for this elevator's scene-3 trigger, not a counter or scene ID. --- src/overlays/l06/mobys/elevator.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l06/mobys/elevator.c b/src/overlays/l06/mobys/elevator.c index 573a218b9c..76bff40d84 100644 --- a/src/overlays/l06/mobys/elevator.c +++ b/src/overlays/l06/mobys/elevator.c @@ -129,13 +129,13 @@ extern float D_L06_00161F60 __attribute__((sda)); extern float height_cycle_max_speed_gp __asm__("D_L06_00161F64") __attribute__((sda)); extern float height_cycle_acceleration_gp __asm__("D_L06_00161F68") __attribute__((sda)); -int D_L06_00161F6C = 0x80202020; +int l06_elevator_pulse_dim_color __asm__("D_L06_00161F6C") = 0x80202020; -int D_L06_00161F70 = 0x80808080; +int l06_elevator_pulse_bright_color __asm__("D_L06_00161F70") = 0x80808080; -int D_L06_00161F74 = 0x80208020; +int l06_elevator_move_and_clearance_color __asm__("D_L06_00161F74") = 0x80208020; -int D_L06_00161F78 = -1; +int l06_elevator_scene_3_latch __asm__("D_L06_00161F78") = -1; extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void request_music_track(int, int) __asm__("FUN_L01_0027a248"); @@ -196,11 +196,11 @@ void elevator_update(Moby_2FDA70 *moby) { moby->f2C = moby->cls->f24 * D_L06_00161F60; switch (moby->state) { case INITIALIZE_POSITION_AND_LINKED_MOBYS: - if (D_L06_00161F78 == -1) { + if (l06_elevator_scene_3_latch == -1) { if (D_0013D5DD_2FDA70[0x10] != 0) { - D_L06_00161F78 = 1; + l06_elevator_scene_3_latch = 1; } else { - D_L06_00161F78 = 0; + l06_elevator_scene_3_latch = 0; } } moby_data->f94 = 0; @@ -275,8 +275,8 @@ void elevator_update(Moby_2FDA70 *moby) { request_music_track(0, 10); ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f34 |= 1; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f34 |= 2; - if (D_0013D5DD_2FDA70[0x10] != 0 && D_L06_00161F78 == 0) { - D_L06_00161F78 = 1; + if (D_0013D5DD_2FDA70[0x10] != 0 && l06_elevator_scene_3_latch == 0) { + l06_elevator_scene_3_latch = 1; start_scene(3); moby->state = WAIT_FOR_SCENE_GAME_MODE_CLEAR; break; @@ -407,7 +407,7 @@ void elevator_update(Moby_2FDA70 *moby) { if (moby->state >= MOVE_TO_NODE_BASE_HEIGHT && moby->state <= WAIT_FOR_HERO_CLEARANCE_AT_NODE_BASE_HEIGHT) { moby_data->f9C = 0.0f; - moby->f90 = D_L06_00161F74; + moby->f90 = l06_elevator_move_and_clearance_color; } else { float color_blend; moby_data->f9C = fast_add_rotations(moby_data->f9C, D_0015ED6C * 5.2359877f); @@ -417,7 +417,7 @@ void elevator_update(Moby_2FDA70 *moby) { } else if (color_blend < 0.0f) { color_blend = 0.0f; } - moby->f90 = fast_tween_color(D_L06_00161F6C, D_L06_00161F70, color_blend); + moby->f90 = fast_tween_color(l06_elevator_pulse_dim_color, l06_elevator_pulse_bright_color, color_blend); } fast_vec_add(&position_delta, &position_delta, &moby->pos); update_entity_matrix(moby_data->f20, &position_delta, &initial_rotation, &moby->rot); From 979b3efe0710e3e43ec8876d5ccfa36163b5a5a1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:30:29 +0000 Subject: [PATCH 180/758] decomp: clarify names in smoke_vent_update D_L02_00162078 -> l02_alternating_smoke_puff_first_color_tween_start: In authoritative smoke_vent.c, state 2 alternating_smoke_puff uses this s32 as the start endpoint (a0) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_a2_puff. Retail 0x002ef8c8 loads this exact binding; 0x002ef8d0 calls the color interpolation helper. 0x002ef990-0x002ef9a0 passes the interpolated first color as a3 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_0016207C -> l02_alternating_smoke_puff_first_color_tween_end: In authoritative smoke_vent.c, state 2 alternating_smoke_puff uses this s32 as the end endpoint (a1) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_a2_puff. Retail 0x002ef8d4 loads this exact binding; 0x002ef8d0 calls the color interpolation helper. 0x002ef990-0x002ef9a0 passes the interpolated first color as a3 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_00162080 -> l02_alternating_smoke_puff_second_color_tween_start: In authoritative smoke_vent.c, state 2 alternating_smoke_puff uses this s32 as the start endpoint (a0) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_b2_puff. Retail 0x002ef8e8 loads this exact binding; 0x002ef8f0 calls the color interpolation helper. 0x002ef990-0x002ef9a0 passes the interpolated second color as t0 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_00162084 -> l02_alternating_smoke_puff_second_color_tween_end: In authoritative smoke_vent.c, state 2 alternating_smoke_puff uses this s32 as the end endpoint (a1) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_b2_puff. Retail 0x002ef8f4 loads this exact binding; 0x002ef8f0 calls the color interpolation helper. 0x002ef990-0x002ef9a0 passes the interpolated second color as t0 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_001620B8 -> l02_view_gated_smoke_puff_first_color_tween_start: In authoritative smoke_vent.c, state 1 view_gated_smoke_puff uses this s32 as the start endpoint (a0) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_a1_puff. Retail 0x002ef41c loads this exact binding; 0x002ef424 calls the color interpolation helper. 0x002ef4e4-0x002ef4ec and 0x002ef9a0 passes the interpolated first color as a3 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_001620BC -> l02_view_gated_smoke_puff_first_color_tween_end: In authoritative smoke_vent.c, state 1 view_gated_smoke_puff uses this s32 as the end endpoint (a1) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_a1_puff. Retail 0x002ef428 loads this exact binding; 0x002ef424 calls the color interpolation helper. 0x002ef4e4-0x002ef4ec and 0x002ef9a0 passes the interpolated first color as a3 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_001620C0 -> l02_view_gated_smoke_puff_second_color_tween_start: In authoritative smoke_vent.c, state 1 view_gated_smoke_puff uses this s32 as the start endpoint (a0) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_b1_puff. Retail 0x002ef43c loads this exact binding; 0x002ef444 calls the color interpolation helper. 0x002ef4e4-0x002ef4ec and 0x002ef9a0 passes the interpolated second color as t0 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_001620C4 -> l02_view_gated_smoke_puff_second_color_tween_end: In authoritative smoke_vent.c, state 1 view_gated_smoke_puff uses this s32 as the end endpoint (a1) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_b1_puff. Retail 0x002ef448 loads this exact binding; 0x002ef444 calls the color interpolation helper. 0x002ef4e4-0x002ef4ec and 0x002ef9a0 passes the interpolated second color as t0 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_001620FC -> l02_view_gated_smoke_burst_first_color_tween_start: In authoritative smoke_vent.c, state 1 view_gated_smoke_burst uses this s32 as the start endpoint (a0) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_a1_burst. Retail 0x002ef24c loads this exact binding; 0x002ef254 calls the color interpolation helper. 0x002ef304-0x002ef328 passes the interpolated first color as a3 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_00162100 -> l02_view_gated_smoke_burst_first_color_tween_end: In authoritative smoke_vent.c, state 1 view_gated_smoke_burst uses this s32 as the end endpoint (a1) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_a1_burst. Retail 0x002ef258 loads this exact binding; 0x002ef254 calls the color interpolation helper. 0x002ef304-0x002ef328 passes the interpolated first color as a3 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_00162104 -> l02_view_gated_smoke_burst_second_color_tween_start: In authoritative smoke_vent.c, state 1 view_gated_smoke_burst uses this s32 as the start endpoint (a0) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_b1_burst. Retail 0x002ef26c loads this exact binding; 0x002ef274 calls the color interpolation helper. 0x002ef304-0x002ef328 passes the interpolated second color as t0 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_00162108 -> l02_view_gated_smoke_burst_second_color_tween_end: In authoritative smoke_vent.c, state 1 view_gated_smoke_burst uses this s32 as the end endpoint (a1) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_b1_burst. Retail 0x002ef278 loads this exact binding; 0x002ef274 calls the color interpolation helper. 0x002ef304-0x002ef328 passes the interpolated second color as t0 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_0016214C -> l02_alternating_smoke_burst_first_color_tween_start: In authoritative smoke_vent.c, state 2 alternating_smoke_burst uses this s32 as the start endpoint (a0) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_a2_burst. Retail 0x002ef714 loads this exact binding; 0x002ef71c calls the color interpolation helper. 0x002ef7cc-0x002ef7f0 passes the interpolated first color as a3 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_00162150 -> l02_alternating_smoke_burst_first_color_tween_end: In authoritative smoke_vent.c, state 2 alternating_smoke_burst uses this s32 as the end endpoint (a1) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_a2_burst. Retail 0x002ef720 loads this exact binding; 0x002ef71c calls the color interpolation helper. 0x002ef7cc-0x002ef7f0 passes the interpolated first color as a3 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_00162154 -> l02_alternating_smoke_burst_second_color_tween_start: In authoritative smoke_vent.c, state 2 alternating_smoke_burst uses this s32 as the start endpoint (a0) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_b2_burst. Retail 0x002ef734 loads this exact binding; 0x002ef73c calls the color interpolation helper. 0x002ef7cc-0x002ef7f0 passes the interpolated second color as t0 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. D_L02_00162158 -> l02_alternating_smoke_burst_second_color_tween_end: In authoritative smoke_vent.c, state 2 alternating_smoke_burst uses this s32 as the end endpoint (a1) of fast_tween_color with an independent random_float_between(0,1) fraction, producing color_b2_burst. Retail 0x002ef740 loads this exact binding; 0x002ef73c calls the color interpolation helper. 0x002ef7cc-0x002ef7f0 passes the interpolated second color as t0 to spawn_spark. Checked level-02 helper 0x0026a744/0x0026a75c preserves t0/a3; 0x0026a8b4-0x0026a8b8 stores the color pair at particle+0x28/+0x2c. Endpoint names express interpolation argument order, not numerical bounds or lifecycle phases. --- src/overlays/l02/mobys/smoke_vent.c | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/overlays/l02/mobys/smoke_vent.c b/src/overlays/l02/mobys/smoke_vent.c index 1f9ba392d2..7d61499642 100644 --- a/src/overlays/l02/mobys/smoke_vent.c +++ b/src/overlays/l02/mobys/smoke_vent.c @@ -34,10 +34,10 @@ extern f32 alternating_smoke_puff_acceleration_w_random_range_start_gp __asm__(" __attribute__((sda)); extern f32 alternating_smoke_puff_acceleration_w_random_range_end_gp __asm__("D_L02_00162074") __attribute__((sda)); -s32 D_L02_00162078 = 0x404080ff; -s32 D_L02_0016207C = 0x404080c0; -s32 D_L02_00162080 = 0x20804050; -s32 D_L02_00162084 = 0x20603038; +s32 l02_alternating_smoke_puff_first_color_tween_start __asm__("D_L02_00162078") = 0x404080ff; +s32 l02_alternating_smoke_puff_first_color_tween_end __asm__("D_L02_0016207C") = 0x404080c0; +s32 l02_alternating_smoke_puff_second_color_tween_start __asm__("D_L02_00162080") = 0x20804050; +s32 l02_alternating_smoke_puff_second_color_tween_end __asm__("D_L02_00162084") = 0x20603038; #include "rnc/overlay/l02/mobys/smoke_vent_data/update_smoke_vent_6.h" @@ -56,10 +56,10 @@ extern f32 view_gated_smoke_puff_acceleration_w_random_range_start_gp __asm__("D __attribute__((sda)); extern f32 view_gated_smoke_puff_acceleration_w_random_range_end_gp __asm__("D_L02_001620B4") __attribute__((sda)); -s32 D_L02_001620B8 = 0x6000ff80; -s32 D_L02_001620BC = 0x6020ff40; -s32 D_L02_001620C0 = 0x20408040; -s32 D_L02_001620C4 = 0x20206020; +s32 l02_view_gated_smoke_puff_first_color_tween_start __asm__("D_L02_001620B8") = 0x6000ff80; +s32 l02_view_gated_smoke_puff_first_color_tween_end __asm__("D_L02_001620BC") = 0x6020ff40; +s32 l02_view_gated_smoke_puff_second_color_tween_start __asm__("D_L02_001620C0") = 0x20408040; +s32 l02_view_gated_smoke_puff_second_color_tween_end __asm__("D_L02_001620C4") = 0x20206020; #include "rnc/overlay/l02/mobys/smoke_vent_data/update_smoke_vent_4.h" @@ -78,10 +78,10 @@ extern f32 view_gated_smoke_burst_acceleration_w_random_range_start_gp __asm__(" __attribute__((sda)); extern f32 view_gated_smoke_burst_acceleration_w_random_range_end_gp __asm__("D_L02_001620F8") __attribute__((sda)); -s32 D_L02_001620FC = 0x804080ff; -s32 D_L02_00162100 = 0x8040ffff; -s32 D_L02_00162104 = 0x80204040; -s32 D_L02_00162108 = 0x80204080; +s32 l02_view_gated_smoke_burst_first_color_tween_start __asm__("D_L02_001620FC") = 0x804080ff; +s32 l02_view_gated_smoke_burst_first_color_tween_end __asm__("D_L02_00162100") = 0x8040ffff; +s32 l02_view_gated_smoke_burst_second_color_tween_start __asm__("D_L02_00162104") = 0x80204040; +s32 l02_view_gated_smoke_burst_second_color_tween_end __asm__("D_L02_00162108") = 0x80204080; extern s32 view_gated_smoke_burst_interval_min_gp __asm__("D_L02_0016210C") __attribute__((sda)); extern s32 view_gated_smoke_burst_interval_max_gp __asm__("D_L02_00162110") __attribute__((sda)); s32 D_L02_00162114 = 0x10019; @@ -103,10 +103,10 @@ extern f32 alternating_smoke_burst_acceleration_w_random_range_start_gp __asm__( __attribute__((sda)); extern f32 alternating_smoke_burst_acceleration_w_random_range_end_gp __asm__("D_L02_00162148") __attribute__((sda)); -s32 D_L02_0016214C = 0x804080ff; -s32 D_L02_00162150 = 0x8040ffff; -s32 D_L02_00162154 = 0x80204040; -s32 D_L02_00162158 = 0x80204080; +s32 l02_alternating_smoke_burst_first_color_tween_start __asm__("D_L02_0016214C") = 0x804080ff; +s32 l02_alternating_smoke_burst_first_color_tween_end __asm__("D_L02_00162150") = 0x8040ffff; +s32 l02_alternating_smoke_burst_second_color_tween_start __asm__("D_L02_00162154") = 0x80204040; +s32 l02_alternating_smoke_burst_second_color_tween_end __asm__("D_L02_00162158") = 0x80204080; extern s32 alternating_smoke_burst_interval_min_gp __asm__("D_L02_0016215C") __attribute__((sda)); extern s32 alternating_smoke_burst_interval_max_gp __asm__("D_L02_00162160") __attribute__((sda)); s32 D_L02_00162164 = 0x10019; @@ -207,9 +207,9 @@ void smoke_vent_update(struct Moby *moby) { view_gated_smoke_burst_acceleration_w_random_range_start_gp, view_gated_smoke_burst_acceleration_w_random_range_end_gp); color_a1_burst = fast_tween_color( - D_L02_001620FC, D_L02_00162100, random_float_between(0.0f, 1.0f)); + l02_view_gated_smoke_burst_first_color_tween_start, l02_view_gated_smoke_burst_first_color_tween_end, random_float_between(0.0f, 1.0f)); color_b1_burst = fast_tween_color( - D_L02_00162104, D_L02_00162108, random_float_between(0.0f, 1.0f)); + l02_view_gated_smoke_burst_second_color_tween_start, l02_view_gated_smoke_burst_second_color_tween_end, random_float_between(0.0f, 1.0f)); time_a1_burst = truncate_float_to_s32( scale_time((f32)view_gated_smoke_burst_timing_random_span_gp * random_float_between(0.0f, 1.0f) + @@ -266,9 +266,9 @@ void smoke_vent_update(struct Moby *moby) { acc.f[3] = random_float_between(view_gated_smoke_puff_acceleration_w_random_range_start_gp, view_gated_smoke_puff_acceleration_w_random_range_end_gp); color_a1_puff = - fast_tween_color(D_L02_001620B8, D_L02_001620BC, random_float_between(0.0f, 1.0f)); + fast_tween_color(l02_view_gated_smoke_puff_first_color_tween_start, l02_view_gated_smoke_puff_first_color_tween_end, random_float_between(0.0f, 1.0f)); color_b1_puff = - fast_tween_color(D_L02_001620C0, D_L02_001620C4, random_float_between(0.0f, 1.0f)); + fast_tween_color(l02_view_gated_smoke_puff_second_color_tween_start, l02_view_gated_smoke_puff_second_color_tween_end, random_float_between(0.0f, 1.0f)); time_a1_puff = truncate_float_to_s32(scale_time( (f32)view_gated_smoke_puff_timing_random_span_gp * random_float_between(0.0f, 1.0f) + 1.0f)); @@ -344,9 +344,9 @@ void smoke_vent_update(struct Moby *moby) { alternating_smoke_burst_acceleration_w_random_range_start_gp, alternating_smoke_burst_acceleration_w_random_range_end_gp); color_a2_burst = fast_tween_color( - D_L02_0016214C, D_L02_00162150, random_float_between(0.0f, 1.0f)); + l02_alternating_smoke_burst_first_color_tween_start, l02_alternating_smoke_burst_first_color_tween_end, random_float_between(0.0f, 1.0f)); color_b2_burst = fast_tween_color( - D_L02_00162154, D_L02_00162158, random_float_between(0.0f, 1.0f)); + l02_alternating_smoke_burst_second_color_tween_start, l02_alternating_smoke_burst_second_color_tween_end, random_float_between(0.0f, 1.0f)); time_a2_burst = truncate_float_to_s32( scale_time((f32)alternating_smoke_burst_timing_random_span_gp * random_float_between(0.0f, 1.0f) + @@ -400,9 +400,9 @@ void smoke_vent_update(struct Moby *moby) { acc.f[3] = random_float_between(alternating_smoke_puff_acceleration_w_random_range_start_gp, alternating_smoke_puff_acceleration_w_random_range_end_gp); color_a2_puff = - fast_tween_color(D_L02_00162078, D_L02_0016207C, random_float_between(0.0f, 1.0f)); + fast_tween_color(l02_alternating_smoke_puff_first_color_tween_start, l02_alternating_smoke_puff_first_color_tween_end, random_float_between(0.0f, 1.0f)); color_b2_puff = - fast_tween_color(D_L02_00162080, D_L02_00162084, random_float_between(0.0f, 1.0f)); + fast_tween_color(l02_alternating_smoke_puff_second_color_tween_start, l02_alternating_smoke_puff_second_color_tween_end, random_float_between(0.0f, 1.0f)); time_a2_puff = truncate_float_to_s32( scale_time((f32) * &smoke_vent_vars->unkC8 * random_float_between(0.0f, 1.0f) + 1.0f)); time_b2_puff = truncate_float_to_s32( From 01e376ab696ca15b7910121cf4a79ba25fe53fdb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:30:51 +0000 Subject: [PATCH 181/758] decomp: clarify names in spawn_hoven_anklebiter_death_sparks D_L12_0016183C -> l12_anklebiter_spark_burst_count: The int initialized to 10 loads into s8 at retail 0x002e30e0, becomes count in the bound C, is multiplied by 1.5 for state 15 at 0x002e30f8-0x002e3114, and bounds the outer burst-origin/launch-velocity loop at 0x002e33cc-0x002e33d0. D_L12_00161840 -> l12_anklebiter_sparks_per_burst: The int initialized to 8 bounds j in the C inner loop containing exactly one spawn_spark call. Retail 0x002e3288-0x002e3294 checks it before emission; 0x002e33b8-0x002e33c0 compares the incremented inner counter against it for each outer burst. D_L12_0016186C -> l12_anklebiter_spark_start_color_range_start: The literal-initialized int 0x8000eeee is loaded as a0 at 0x002e3314 for fast_tween_color with the 0x00161874 endpoint and random fraction. The return is saved in s3 at 0x002e3328 and passed as spawn_spark start_color/a3 at 0x002e3390; helper 0x00281b14 stores this color. D_L12_00161870 -> l12_anklebiter_spark_end_color_range_start: The int 0xffee loads as a0 in the delay slot at 0x002e3340 for fast_tween_color paired with D_L12_00161878. The return becomes C end_color/s2 at 0x002e334c and spawn_spark t0 at 0x002e3398; checked helper 0x00281b18 stores this second color separately. D_L12_00161874 -> l12_anklebiter_spark_start_color_range_end: The int 0x8000ff90 loads as a1 at retail 0x002e3320 for fast_tween_color paired with D_L12_0016186C and a random 0..1 fraction. Its interpolated result is the C start_color and reaches a3 at 0x002e3390 and the helper color store at 0x00281b14. D_L12_00161878 -> l12_anklebiter_spark_end_color_range_end: The int 0xffee loads as a1 at retail 0x002e3334 for the second fast_tween_color call, paired with D_L12_00161870 and an independent random fraction. The resulting C end_color reaches t0 at 0x002e3398 and the second color store at helper 0x00281b18; this binding remains distinct from the equal literal at 0x00161870. D_L12_0016187C -> l12_anklebiter_spark_life_frames: The int initialized to 10 loads at retail 0x002e3344 and passes through scale_game_frames at 0x002e3348 into s1, matching life = scale_game_frames(...) in the bound C. It is spawn_spark's life argument/t1 at 0x002e339c; checked helper stores that frame count at 0x00281a98 and 0x00281b1c. D_L12_00161880 -> l12_anklebiter_spark_fade_frames: The int initialized to 30 is scale_game_frames input at 0x002e3350-0x002e3354, becomes C fade and spawn_spark t2 at 0x002e33a0, and is stored by helper 0x00281b24. It also scales the downward copied-velocity adjustment via 0x002e3254-0x002e3298, proving the same frame-count binding serves both calculations. --- src/overlays/l12/mobys/hoven_anklebiter.c | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/overlays/l12/mobys/hoven_anklebiter.c b/src/overlays/l12/mobys/hoven_anklebiter.c index 8d76c64473..37cc64754e 100644 --- a/src/overlays/l12/mobys/hoven_anklebiter.c +++ b/src/overlays/l12/mobys/hoven_anklebiter.c @@ -722,8 +722,8 @@ int move_hoven_anklebiter_toward_heading(struct Moby *moby, float speed) { return move_result; } -int D_L12_0016183C = 0xa; -int D_L12_00161840 = 8; +int l12_anklebiter_spark_burst_count __asm__("D_L12_0016183C") = 0xa; +int l12_anklebiter_sparks_per_burst __asm__("D_L12_00161840") = 8; extern float l12_anklebiter_spark_burst_origin_jitter __asm__("D_L12_00161844") __attribute__((sda)); extern float l12_anklebiter_spark_position_jitter __asm__("D_L12_00161848") __attribute__((sda)); @@ -741,12 +741,12 @@ extern float l12_anklebiter_spark_downward_velocity_scale __asm__("D_L12_0016186 __attribute__((sda)); extern float D_L12_00161864 __attribute__((sda)); extern float D_L12_00161868 __attribute__((sda)); -int D_L12_0016186C = 0x8000eeee; -int D_L12_00161870 = 0xffee; -int D_L12_00161874 = 0x8000ff90; -int D_L12_00161878 = 0xffee; -int D_L12_0016187C = 0xa; -int D_L12_00161880 = 0x1e; +int l12_anklebiter_spark_start_color_range_start __asm__("D_L12_0016186C") = 0x8000eeee; +int l12_anklebiter_spark_end_color_range_start __asm__("D_L12_00161870") = 0xffee; +int l12_anklebiter_spark_start_color_range_end __asm__("D_L12_00161874") = 0x8000ff90; +int l12_anklebiter_spark_end_color_range_end __asm__("D_L12_00161878") = 0xffee; +int l12_anklebiter_spark_life_frames __asm__("D_L12_0016187C") = 0xa; +int l12_anklebiter_spark_fade_frames __asm__("D_L12_00161880") = 0x1e; extern int l12_anklebiter_spark_random_time_base __asm__("D_L12_00161884") __attribute__((sda)); extern void add_random_offset_to_vector_xyz(void *, float) __asm__("FUN_L00_0025f8e0"); extern float scale_time(float) __asm__("FUN_001f96b0"); @@ -776,7 +776,7 @@ void spawn_hoven_anklebiter_death_sparks(struct Moby *moby) { int life; int fade; - count = D_L12_0016183C; + 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); @@ -804,8 +804,8 @@ void spawn_hoven_anklebiter_death_sparks(struct Moby *moby) { fast_vec_add(spark_launch_velocity, spark_launch_velocity, push); qcopy(gravity_adjusted_spark_velocity, spark_launch_velocity); gravity_adjusted_spark_velocity[2] -= l12_anklebiter_spark_downward_velocity_scale * - D_0015ED70 * (float)scale_game_frames(D_L12_00161880); - for (j = 0; j < D_L12_00161840; j++) { + 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; @@ -814,11 +814,11 @@ void spawn_hoven_anklebiter_death_sparks(struct Moby *moby) { l12_anklebiter_spark_velocity_jitter_scale * D_0015ED6C); start_color = - fast_tween_color(D_L12_0016186C, D_L12_00161874, random_float_between(0.0f, 1.0f)); + fast_tween_color(l12_anklebiter_spark_start_color_range_start, l12_anklebiter_spark_start_color_range_end, random_float_between(0.0f, 1.0f)); end_color = - fast_tween_color(D_L12_00161870, D_L12_00161878, random_float_between(0.0f, 1.0f)); - life = scale_game_frames(D_L12_0016187C); - fade = scale_game_frames(D_L12_00161880); + fast_tween_color(l12_anklebiter_spark_end_color_range_start, l12_anklebiter_spark_end_color_range_end, random_float_between(0.0f, 1.0f)); + life = scale_game_frames(l12_anklebiter_spark_life_frames); + fade = scale_game_frames(l12_anklebiter_spark_fade_frames); time_base = (float)l12_anklebiter_spark_random_time_base; spawn_spark(pos, spark_launch_velocity, From 6bce81555d14716fab40479632d5a3d1fa7a2889 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:30:51 +0000 Subject: [PATCH 182/758] decomp: clarify names in hud_keep_visible val -> minimum_visible_frames: In hud_keep_visible, s32 val supplies the lower bound for hud_element->unk7C via max(existing timer, val). Retail 0x00235e1c preserves argument a1 in a3; 0x00235e84 loads +0x7C, 0x00235e88-0x00235e8c selects the signed maximum with a3, and 0x00235e94 writes it back. Original Ghidra likewise stores max((&DAT_0017dccc)[iVar3 * 0x24], param_2). Supplied hero_update_transitions callers pass scale_game_frames(0xB4), and update_timed_hud_visibility passes 10. Nearby reset_numeric_hud_element initializes the same field with scale_game_frames(0xB4)+0x1E, and HUD slide/counter code uses it as the visibility timer. Thus this argument requests at least this many visible frames without shortening an existing timer. --- src/overlays/shared/ui/hud/hud_keep_visible.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/ui/hud/hud_keep_visible.c b/src/overlays/shared/ui/hud/hud_keep_visible.c index 73c0d799be..d8c73a2b44 100644 --- a/src/overlays/shared/ui/hud/hud_keep_visible.c +++ b/src/overlays/shared/ui/hud/hud_keep_visible.c @@ -186,7 +186,7 @@ void reset_numeric_hud_element_32x32_base(HudElem *hud_element) { s32 hud_keep_visible(s32 key, s32 val) __asm__("FUN_L00_00235e18"); -s32 hud_keep_visible(s32 key, s32 val) { +s32 hud_keep_visible(s32 key, s32 minimum_visible_frames) { s32 i; s32 r; HudElem *hud_element; @@ -197,7 +197,7 @@ s32 hud_keep_visible(s32 key, s32 val) { } if (i < 13 && hud_elements[i].unk68 == 0) { hud_element = hud_elements + i; - hud_element->unk7C = (val < hud_element->unk7C) ? hud_element->unk7C : val; + hud_element->unk7C = (minimum_visible_frames < hud_element->unk7C) ? hud_element->unk7C : minimum_visible_frames; return 0; } return 1; From 09fb5ee304ecb7e07e9f1e8fa53097f72702c33c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:33:13 +0000 Subject: [PATCH 183/758] decomp: clarify names in ultramech_unlimited_update D_L15_00161B1C -> l15_ultramech_projectile_duration_frames: Source defines int D_L15_00161B1C = 180 and passes scale_game_frames(D_L15_00161B1C) as the last argument of projectile creation in ULTRAMECH_FIRE_BURST. Original retail case 5 shows uGpffffaf1c following that same flow. Retail 0x002cfeb0-0x002cfeb4 loads gp-0x50e4 into a0 for scale_game_frames; 0x002cfec0 moves its return into t0 before the call at 0x002cfecc to 0x002dd600. Checked level-15 helper evidence 9b2b26e76cdf4415b96213de79e39edf shows 0x002dd62c retaining t0 in s3, 0x002dd644 creating class 0x333, 0x002dd67c loading the new moby's data, and 0x002dd694-0x002dd6b8 frame-scaling this argument and storing it at data+0x18. This proves a projectile initialization frame duration; its later expiry semantics remain unproved. Preserve int type, value 180 and assembler identity. --- src/overlays/l15/mobys/ultramech_unlimited.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l15/mobys/ultramech_unlimited.c b/src/overlays/l15/mobys/ultramech_unlimited.c index a4f1af65f6..01028d70bf 100644 --- a/src/overlays/l15/mobys/ultramech_unlimited.c +++ b/src/overlays/l15/mobys/ultramech_unlimited.c @@ -258,7 +258,7 @@ extern short ultramech_death_effect_basis_scale_gp __asm__("D_L15_00161B38") __a extern short ultramech_death_effect_vertical_offset_gp __asm__("D_L15_00161B3C") __attribute__((sda)); -int D_L15_00161B1C = 180; +int l15_ultramech_projectile_duration_frames __asm__("D_L15_00161B1C") = 180; extern void collect_mobies_in_sphere(void *, int, void *, void *, float) __asm__("FUN_L00_001f2868"); @@ -552,7 +552,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { &vector_or_hit_descriptor, (int)ultramech_moby, (int)combat_target, - scale_game_frames(D_L15_00161B1C)); + scale_game_frames(l15_ultramech_projectile_duration_frames)); normalize_vector_xyz(&position_or_motion_vector, &position_or_motion_vector, 3.0f); add_vectors(&vector_arithmetic_result, &vector_or_hit_descriptor, From 0574c0371ccfce785d070ae7a62ac381a32895c8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:33:26 +0000 Subject: [PATCH 184/758] decomp: clarify names in constructorbot_update D_L02_00161A90 -> l02_constructorbot_wake_spray_frame_count_min: Bound source src/overlays/l02/mobys/constructorbot.c SHA-256 0e8c8213efa65e03d06481c66b8110b2c376eb5afceb3e0d9342d45a3bd304a4 defines this int as 0x3c. In wake states 8/9, retail 0x002d7f40-0x002d7f60 loads it at gp-0x5170, passes it through scale_game_frames (0x0020ff58), and supplies the result as the first/lower bound of random_int_between (0x0025a200). The generated frame count is passed in t0 to spawn_burst at 0x002d7f78-0x002d7f88. Checked helper evidence 48263e7191ef4b5a8d2e9a549599e7de saves t0 in s1 at 0x0026e25c, rejects zero at 0x0026e268, and stores this count into halfwords at object+0xa and object+0x38 at 0x0026e2d4/0x0026e2dc. This proves the minimum configured frame-count bound for constructorbot wake spray. D_L02_00161A94 -> l02_constructorbot_wake_spray_frame_count_max: Bound source defines this int as 0x78 and uses it in scale_game_frames as the second/upper bound of random_int_between for spawn_burst in wake states 8/9. Original retail Ghidra agrees; retail 0x002d7f4c-0x002d7f60 loads gp-0x516c, calls scale_game_frames at 0x002d7f50 and puts its result in a1 for random_int_between at 0x002d7f5c. The resulting frame count is passed in t0 at 0x002d7f78-0x002d7f84. Checked helper evidence 48263e7191ef4b5a8d2e9a549599e7de follows t0 through s1 to two halfword count fields at 0x0026e2d4/0x0026e2dc. Thus this is the maximum configured frame-count bound for constructorbot wake spray, without asserting random endpoint inclusivity. --- src/overlays/l02/mobys/constructorbot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l02/mobys/constructorbot.c b/src/overlays/l02/mobys/constructorbot.c index d9daf6fffb..d1fef05bc2 100644 --- a/src/overlays/l02/mobys/constructorbot.c +++ b/src/overlays/l02/mobys/constructorbot.c @@ -80,8 +80,8 @@ extern int D_L02_0015F5CC_i __asm__("D_L02_0015F5CC"); #include "rnc/overlay/l02/mobys/constructorbot_data/constructorbot_update.h" int D_L02_00161A88 = 0x40808080; -int D_L02_00161A90 = 0x3c; -int D_L02_00161A94 = 0x78; +int l02_constructorbot_wake_spray_frame_count_min __asm__("D_L02_00161A90") = 0x3c; +int l02_constructorbot_wake_spray_frame_count_max __asm__("D_L02_00161A94") = 0x78; extern float constructorbot_wake_spray_planar_magnitude_max_gp __asm__("D_L02_00161A98") __attribute__((sda)); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); @@ -359,8 +359,8 @@ void constructorbot_update(struct Moby *moby) { direction, D_L02_00161A88, D_L02_00161A88, - random_int_between(scale_game_frames(D_L02_00161A90), - scale_game_frames(D_L02_00161A94)), + random_int_between(scale_game_frames(l02_constructorbot_wake_spray_frame_count_min), + scale_game_frames(l02_constructorbot_wake_spray_frame_count_max)), 1, 40000.0f); } From b138501080bbee92c5798ddc51fb74026f6865d2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:33:26 +0000 Subject: [PATCH 185/758] decomp: clarify names in check_path_camera_priority rec -> path_camera_priority_preset: Retail 0x00315938-0x00315944 loads camera+0x84 as a signed descriptor index, multiplies by 32 and loads the pointer at l14_camera_preset_rows+index*32+0x1C into s0 (original Ghidra iVar1, source rec). The same lookup selects path-camera presets in supplied setup_path_camera and update_path_camera source. Retail 0x00315948 reads this preset's +0x38 status byte; 0x00315988 and 0x003159a0 load its required control mode and hero state at +0x48/+0x44, comparing them with hero fields before priority acceptance. Thus it is the selected path-camera preset used by check_path_camera_priority. --- src/overlays/l14/path_camera.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l14/path_camera.c b/src/overlays/l14/path_camera.c index 84e6692b36..ec7da83da0 100644 --- a/src/overlays/l14/path_camera.c +++ b/src/overlays/l14/path_camera.c @@ -293,9 +293,9 @@ int check_path_camera_priority(char *camera, char *control_mode_gate_object) __asm__("FUN_L14_00315920"); int check_path_camera_priority(char *camera, char *control_mode_gate_object) { - char *rec = *(char **)(l14_camera_preset_rows + *(short *)(camera + 0x84) * 32 + 0x1C); + char *path_camera_priority_preset = *(char **)(l14_camera_preset_rows + *(short *)(camera + 0x84) * 32 + 0x1C); int required_control_mode, required_hero_state; - if (*(unsigned char *)(rec + 0x38) != 0) + if (*(unsigned char *)(path_camera_priority_preset + 0x38) != 0) return -1; if (control_mode_gate_object != 0 && *(short *)(control_mode_gate_object + 0x7E) == 0) { if (hero.state.control_mode != 15) @@ -303,10 +303,10 @@ int check_path_camera_priority(char *camera, char *control_mode_gate_object) { } if (check_descriptor_hero_trigger(camera) == 0) return 0; - required_control_mode = *(int *)(rec + 0x48); + required_control_mode = *(int *)(path_camera_priority_preset + 0x48); if (required_control_mode >= 0 && hero.state.control_mode != required_control_mode) return 0; - required_hero_state = *(int *)(rec + 0x44); + required_hero_state = *(int *)(path_camera_priority_preset + 0x44); if (required_hero_state >= HERO_STATE_IDLE && hero.state.current != required_hero_state) return 0; return 1; From 8e1017a249162d795bc5325de1a2517814a150fd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:33:37 +0000 Subject: [PATCH 186/758] decomp: clarify names in update_fighter_jet_target_lock D_L17_0016216C -> l17_fighter_jet_lock_timer_reload: The authoritative fighter_jet.c snapshot (SHA-256 ed076584a11ff969754444486e8991d769558dad6d197870397b4539e78a1267) defines this int as 600 and reads it into lock_timer_reload only when candidate_target is accepted into ship_vars+0x88. Retail 0x002eb8ec stores the accepted target, 0x002eb8f0 loads the corresponding gp-relative global (-0x4a94), and 0x002eb8f8 stores it into ship_vars+0x8C. Original Ghidra likewise assigns uGpffffb56c to +0x8C in the acceptance branch. Retail 0x002eb79c/0x002eb7a0 decrements that slot through fast_dec_timer, and 0x002eb7a4 tests its expiry. These reads and writes prove the target-lock timer reload role; l17 qualifies overlay ownership. --- src/overlays/l17/mobys/fighter_jet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l17/mobys/fighter_jet.c b/src/overlays/l17/mobys/fighter_jet.c index 430c880af9..908191e744 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -657,7 +657,7 @@ void draw_fighter_jet_lock_marker(float x, /* picks the moby to home in on, keeping or dropping the current target */ /* Ported from rac1-decomp (src/overlays/l17_fleet/vendor_002AA068.c: func_L17_002ED258), where it is exact; names translated to the US level program. */ -int D_L17_0016216C = 600; +int l17_fighter_jet_lock_timer_reload __asm__("D_L17_0016216C") = 600; extern int select_fighter_jet_target_and_draw_contacts( int, char *, char *, char *, float, float, float, char *, char *) __asm__("FUN_L17_002eace8"); #define W(p, o) (*(int *)((char *)(p) + (o))) @@ -722,7 +722,7 @@ void update_fighter_jet_target_lock(int ship_moby, char *ship_vars) { (H(P(ship_vars, 0x88), 0xA6) != 0x3EB && H(candidate_target, 0xA6) == 0x3EB)) && FLAG != 0) { P(ship_vars, 0x88) = candidate_target; - lock_timer_reload = D_L17_0016216C; + lock_timer_reload = l17_fighter_jet_lock_timer_reload; W(ship_vars, 0x128) = H(candidate_target, 0xA6); W(ship_vars, 0x8C) = lock_timer_reload; } From 669add6563f26bc47f25778f707b56d0578c799e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:35:56 +0000 Subject: [PATCH 187/758] decomp: clarify names in circular_saw_enemy_update D_L04_00161878 -> l04_circular_saw_suck_cannon_config_header: Authoritative source b389fe10876ba30dddb7da97c17939fcb7b7baee707af937b925d8bbbeb4bb74 defines this short as 0x101 and installs its address in data->f1F0 during initialization. Retail 002c29cc computes gp-0x5388 and 002c29dc stores it at pvars+0x1f0; original Ghidra independently shows that store. Supplied get_circular_saw_enemy_suck_cannon_record returns pvars+0x180, making the installed pointer record+0x70. Checked level-04 helper 002ded80 obtains this record at 002deddc/002dede4; 002df38c-002df3b4 loads record+0x70, reads configuration byte +4 and uses it as an animation ID; 002df918-002df940 similarly reads +6 for animation blending. This proves the short's address is the start/header of the circular saw's suck-cannon configuration, without assigning meanings to its two stored bytes or renaming adjacent data. --- src/overlays/l04/mobys/circular_saw_enemy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l04/mobys/circular_saw_enemy.c b/src/overlays/l04/mobys/circular_saw_enemy.c index 2fcfcc1892..0f41273e9c 100644 --- a/src/overlays/l04/mobys/circular_saw_enemy.c +++ b/src/overlays/l04/mobys/circular_saw_enemy.c @@ -482,7 +482,7 @@ extern int collect_mobies_in_sphere(void *, int, void *, void *, float) __asm__( extern int move_moby_xy_with_collision_constraints( void *, void *, void *, int, float, float, float, float) __asm__("FUN_L00_00258490"); extern int FUN_L00_002dc9f0(void *, void *); -short D_L04_00161878 = 0x101; +short l04_circular_saw_suck_cannon_config_header __asm__("D_L04_00161878") = 0x101; extern void FUN_L01_0026d930(char *p); extern void update_circular_saw_engine_sound(struct Moby *) __asm__("FUN_L04_002c1b80"); extern void transform_vector_by_basis(void *, void *, void *); @@ -696,7 +696,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { data->f258 = k * 2.9670596f; qcopy(data->f120, moby->pos); data->f146 = scale_game_frames(0x3C); - data->f1F0 = &D_L04_00161878; + data->f1F0 = &l04_circular_saw_suck_cannon_config_header; data->f136 = 0; data->f144 = 0; if (data->f150 == -1) { From a4a8e48d282021434d74884c8d22ca8fd7f358ba Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:36:07 +0000 Subject: [PATCH 188/758] decomp: clarify names in beehive_update D_L01_00161E90 -> l01_beehive_spawn_attempt_limit: The bound source declares s32 D_L01_00161E90 = 5 and gates beehive_vars->count against it. Original retail Ghidra compares piVar1[2] with iGpffffb290. Retail 0x00302220 loads beehive pvars +8 into v1, 0x00302224 loads the global into v0, and 0x00302228-0x0030222c exits unless count < limit. The increment at 0x00302230 is stored at 0x0030223c in the delay slot of the spawn-helper call 0x00302238, before the returned clone is null-checked at 0x00302244. Thus it caps counted spawn attempts, not simultaneous live clones or confirmed successes. l01 qualifies the listed level-local binding. --- src/overlays/l01/mobys/beehive.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/beehive.c b/src/overlays/l01/mobys/beehive.c index a2e9907c56..8d28eb6b3e 100644 --- a/src/overlays/l01/mobys/beehive.c +++ b/src/overlays/l01/mobys/beehive.c @@ -87,7 +87,7 @@ typedef struct { extern ClonedMoby *initialize_beehive_spawn_moby(ClonedMoby *) __asm__("FUN_L01_00302328"); extern void trooper_start_knockback(void *, void *, s32, s32, s32, f32) __asm__("FUN_L00_0025c558"); -s32 D_L01_00161E90 = 5; +s32 l01_beehive_spawn_attempt_limit __asm__("D_L01_00161E90") = 5; void beehive_update(SpawnerMoby *m) __asm__("FUN_L01_003021b8"); @@ -113,7 +113,7 @@ void beehive_update(SpawnerMoby *beehive_moby) { if (count_active_moby_group_members(beehive_vars->src_id, 0xC) != 0) { break; } - if (beehive_vars->count >= D_L01_00161E90) { + if (beehive_vars->count >= l01_beehive_spawn_attempt_limit) { break; } beehive_vars->count++; From 37b3380eb85155202e3e5e39c0712bef537819ec Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:38:36 +0000 Subject: [PATCH 189/758] decomp: clarify names in draw_water_reservoir D_L12_00161A10 -> l12_water_reservoir_alpha_b_selector: Source packs this int initialized to 1 into quad.g[3] shifted left 2. Original Ghidra iGpffffae10 agrees; retail 0x002ecb3c loads it, 0x002ecb5c shifts it by 2, and 0x002ecb64/88 combine/store the word at Quad+0x88. Checked helper request b2612fd04d8a4bb88b0a76e6ec1f2f1c traces Quad+0x88 at 0x002201f8 into the GS ALPHA 0x42 packet at 0x002201fc-0x00220214, proving the B selector bits 2-3. D_L12_00161A18 -> l12_water_reservoir_alpha_d_selector: Source packs this int initialized to 1 into quad.g[3] shifted left 6. Original Ghidra iGpffffae18 agrees; retail 0x002ecb60 loads it, 0x002ecb74 shifts it by 6, and 0x002ecb78/88 combine/store the word at Quad+0x88. Checked helper request b2612fd04d8a4bb88b0a76e6ec1f2f1c traces Quad+0x88 at 0x002201f8 into the GS ALPHA 0x42 packet at 0x002201fc-0x00220214, proving the D selector bits 6-7. D_L12_00161A1C -> l12_water_reservoir_tween_start_color: Authoritative source uses this int initialized to 0x40602020 as the first color argument of fast_tween_color. Retail 0x002ecb98 loads a0 from gp-0x51e4 before the tween call at 0x002ecba0, with sine-derived fraction in f12 at 0x002ecba4. Original Ghidra uGpffffae1c agrees. The returned color is saved in t1 at 0x002ecba8 and written to all four quad.c entries at 0x002ecbd0-0x002ecbf4, proving a starting endpoint color for the quad color tween. D_L12_00161A20 -> l12_water_reservoir_tween_end_color: Authoritative source uses this int initialized to 0x40681818 as the second color argument of fast_tween_color. Retail 0x002ecb9c loads a1 from gp-0x51e0 before the tween call at 0x002ecba0, with sine-derived fraction in f12 at 0x002ecba4. Original Ghidra uGpffffae20 agrees. The returned color is saved in t1 at 0x002ecba8 and written to all four quad.c entries at 0x002ecbd0-0x002ecbf4, proving an ending endpoint color for the quad color tween. --- src/overlays/l12/mobys/water_reservoir.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l12/mobys/water_reservoir.c b/src/overlays/l12/mobys/water_reservoir.c index 15e3302afb..9b47c702a2 100644 --- a/src/overlays/l12/mobys/water_reservoir.c +++ b/src/overlays/l12/mobys/water_reservoir.c @@ -151,12 +151,12 @@ extern char water_reservoir_quad_vertex_template[] __asm__("D_L12_001F5B20"); extern float fast_cos(float); extern float fast_sin(float); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); -int D_L12_00161A10 = 1; +int l12_water_reservoir_alpha_b_selector __asm__("D_L12_00161A10") = 1; int l12_water_reservoir_alpha_c_selector __asm__("D_L12_00161A14") = 0; int l12_water_reservoir_alpha_a_selector __asm__("D_L12_00161A0C") = 0; -int D_L12_00161A18 = 1; -int D_L12_00161A1C = 0x40602020; -int D_L12_00161A20 = 0x40681818; +int l12_water_reservoir_alpha_d_selector __asm__("D_L12_00161A18") = 1; +int l12_water_reservoir_tween_start_color __asm__("D_L12_00161A1C") = 0x40602020; +int l12_water_reservoir_tween_end_color __asm__("D_L12_00161A20") = 0x40681818; extern short water_reservoir_segment_cosine_scale_gp __asm__("D_L12_00161A24") __attribute__((sda)); extern void draw_geometry_quad(void *, void *, int); @@ -174,10 +174,10 @@ void draw_water_reservoir(struct Moby *moby) { quad.g[1] = get_effect_texture(0x10); quad.g[0] = 0; quad.g[2] = 0xFF9000000260UL; - quad.g[3] = (long)l12_water_reservoir_alpha_a_selector | ((long)D_L12_00161A10 << 2) | ((long)l12_water_reservoir_alpha_c_selector << 4) | - ((long)D_L12_00161A18 << 6) | (0x8000L << 24); + quad.g[3] = (long)l12_water_reservoir_alpha_a_selector | ((long)l12_water_reservoir_alpha_b_selector << 2) | ((long)l12_water_reservoir_alpha_c_selector << 4) | + ((long)l12_water_reservoir_alpha_d_selector << 6) | (0x8000L << 24); col = fast_tween_color( - D_L12_00161A1C, D_L12_00161A20, (fast_sin(*(float *)water_reservoir_vars) + 1.0f) * 0.5f); + l12_water_reservoir_tween_start_color, l12_water_reservoir_tween_end_color, (fast_sin(*(float *)water_reservoir_vars) + 1.0f) * 0.5f); for (i = 0; i < 4; i++) { quad.uv[i * 2] = 0.5f; *(&quad.uv[i * 2] + 1) = 0.5f; From 4732f232ba9ebdd61bdde2207ac1c1dc83975a21 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:41:43 +0000 Subject: [PATCH 190/758] decomp: clarify names in draw_beam_barrier_segments D_L06_00161DD4 -> l06_beam_barrier_gs_alpha_b_selector: Authoritative C declares int D_L06_00161DD4 = 2. Retail 0x002f6e78 loads this binding at gp-0x4e2c, 0x002f6e90 shifts it left two and 0x002f6e98 ORs it into the register value passed to GS ALPHA_1 register 0x42 at 0x002f6e88/0x002f6eac. It occupies B between the already named A and C selector fields; source expression corroborates exactly. D_L06_00161DDC -> l06_beam_barrier_gs_alpha_d_selector: Authoritative C declares int D_L06_00161DDC = 1. Retail 0x002f6e94 loads this binding at gp-0x4e24, 0x002f6ea4 shifts it left six and 0x002f6ea8 ORs it into GS ALPHA_1 register 0x42 for 0x002f6eac. This is the D selector following the established A, B and C fields; the source packs the same value at bit six. D_L06_00161DF4 -> l06_beam_barrier_strand_color_at_threshold: Source declares this int as 0xff0000 and passes it as beam_segment_draw_params[4]. Retail 0x002f6f74/0x002f6f9c loads and stores the binding into params+0x10. Checked helper 0x00216cec loads that field, 0x00216cf8-0x00216d10 expands its packed byte color into vf3, and 0x00216d14-0x00216d28 computes color0*(1-t)+this_color*t. The per-strand timer branches at 0x00216cb4-0x00216ce4 make t=1 at the threshold params[1] and t=0 at timer zero or cycle duration. The repacked color is emitted for strand vertices at 0x00216e30-0x00216e48. --- src/overlays/l06/mobys/beam_barrier.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l06/mobys/beam_barrier.c b/src/overlays/l06/mobys/beam_barrier.c index b380f3199a..aff4e5ff25 100644 --- a/src/overlays/l06/mobys/beam_barrier.c +++ b/src/overlays/l06/mobys/beam_barrier.c @@ -348,15 +348,15 @@ extern void FUN_L06_00216b88(int *, float *); int l06_beam_barrier_gs_alpha_a_selector __asm__("D_L06_00161DD0") = 0; -int D_L06_00161DD4 = 2; +int l06_beam_barrier_gs_alpha_b_selector __asm__("D_L06_00161DD4") = 2; int l06_beam_barrier_gs_alpha_c_selector __asm__("D_L06_00161DD8") = 0; -int D_L06_00161DDC = 1; +int l06_beam_barrier_gs_alpha_d_selector __asm__("D_L06_00161DDC") = 1; int D_L06_00161DF0 = 0x80c04070; -int D_L06_00161DF4 = 0xff0000; +int l06_beam_barrier_strand_color_at_threshold __asm__("D_L06_00161DF4") = 0xff0000; float beam_barrier_texture_u_step_gp __asm__("D_L06_00161DF8") = 0.25f; @@ -391,8 +391,8 @@ void draw_beam_barrier_segments(char *moby) { vu1_add_g_sregister(0x14, 0xFF9000000260L); vu1_add_g_sregister(8, 0); vu1_add_g_sregister(0x42, - (long)l06_beam_barrier_gs_alpha_a_selector | ((long)D_L06_00161DD4 << 2) | - ((long)l06_beam_barrier_gs_alpha_c_selector << 4) | ((long)D_L06_00161DDC << 6) | + (long)l06_beam_barrier_gs_alpha_a_selector | ((long)l06_beam_barrier_gs_alpha_b_selector << 2) | + ((long)l06_beam_barrier_gs_alpha_c_selector << 4) | ((long)l06_beam_barrier_gs_alpha_d_selector << 6) | 0x8000000000L); font_queue_vu_state(); first_matrix = segment_matrix[0]; @@ -417,7 +417,7 @@ void draw_beam_barrier_segments(char *moby) { strand_cycle_duration_frames = D_L06_00161E50; points = (int *)l06_beam_barrier_strand_local_points; strand_color_transition_threshold_frames = D_L06_00161E54; - fourth = D_L06_00161DF4; + fourth = l06_beam_barrier_strand_color_at_threshold; seventh = beam_barrier_texture_u_step_gp; eighth = l06_beam_barrier_texture_u_phase; sequence = D_L06_00161E40; From 03e6da068935c9884e2a3f67e4f8c310325f765e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:41:59 +0000 Subject: [PATCH 191/758] decomp: clarify names in emit_height_adjusted_burst_spark_particle D_L10_00162024 -> l10_height_adjusted_spark_initial_color_from: Authoritative C initializes this int to 0x80002040 and passes it as fast_tween_color endpoint one with D_L10_00162028 and a random 0..1 factor. Retail 0x002eac1c loads gp-0x4bdc into a0 before the color interpolator at 0x002eac24; its result is saved in s0 at 0x002eac30 and passed in a3 to spawn_spark at 0x002eac70. Helper 0x0025bf18 stores that initial color at particle+4. D_L10_00162028 -> l10_height_adjusted_spark_initial_color_to: Authoritative C initializes this int to 0x80104040 and uses it as fast_tween_color endpoint two for initial_spark_color. Retail 0x002eac28 loads gp-0x4bd8 into a1 in the delay slot of the color interpolator at 0x002eac24, with a random 0..1 factor. The result flows through s0 and a3 to spawn_spark at 0x002eac70, then to particle+4 at helper 0x0025bf18. D_L10_0016202C -> l10_height_adjusted_spark_second_color_from: Authoritative C initializes this int to 0x30002040 and uses it as endpoint one of the second fast_tween_color call, whose result is spawn_spark argument five. Retail 0x002eac3c loads gp-0x4bd4 into a0 for interpolation at 0x002eac44; 0x002eac4c moves its result to t0. Helper 0x0025beac preserves t0 in s8 and 0x0025c020 stores it in the spark substructure's second color word at +0xc. D_L10_00162030 -> l10_height_adjusted_spark_second_color_to: Authoritative C initializes this int to 0x30004020 and uses it as endpoint two of the second fast_tween_color call, sampled with a random 0..1 factor. Retail 0x002eac48 loads gp-0x4bd0 into a1 for interpolation at 0x002eac44. The result passes in t0 to spawn_spark at 0x002eac70; helper 0x0025beac and 0x0025c020 preserve and store it as the second color word. --- .../l10/mobys/configurable_particle_emitter.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l10/mobys/configurable_particle_emitter.c b/src/overlays/l10/mobys/configurable_particle_emitter.c index 760c687b93..86580eb24b 100644 --- a/src/overlays/l10/mobys/configurable_particle_emitter.c +++ b/src/overlays/l10/mobys/configurable_particle_emitter.c @@ -320,10 +320,10 @@ extern short height_adjusted_spark_base_third_frame_count_gp __asm__("D_L10_0016 __attribute__((sda)); extern short height_adjusted_spark_frame_count_scale_spread_gp __asm__("D_L10_00162020") __attribute__((sda)); -int D_L10_00162024 = 0x80002040; -int D_L10_00162028 = 0x80104040; -int D_L10_0016202C = 0x30002040; -int D_L10_00162030 = 0x30004020; +int l10_height_adjusted_spark_initial_color_from __asm__("D_L10_00162024") = 0x80002040; +int l10_height_adjusted_spark_initial_color_to __asm__("D_L10_00162028") = 0x80104040; +int l10_height_adjusted_spark_second_color_from __asm__("D_L10_0016202C") = 0x30002040; +int l10_height_adjusted_spark_second_color_to __asm__("D_L10_00162030") = 0x30004020; extern short height_adjusted_spark_timer_reset_max_gp __asm__("D_L10_00162038") __attribute__((sda)); extern short height_adjusted_spark_timer_reset_min_gp __asm__("D_L10_00162034") @@ -400,12 +400,12 @@ void emit_height_adjusted_burst_spark_particle(void *emission_position, *(float *)&height_adjusted_spark_random_vector_fourth_component_min_gp, *(float *)&height_adjusted_spark_random_vector_fourth_component_max_gp); initial_spark_color = - fast_tween_color(D_L10_00162024, D_L10_00162028, random_float_between(0.0f, 1.0f)); + fast_tween_color(l10_height_adjusted_spark_initial_color_from, l10_height_adjusted_spark_initial_color_to, random_float_between(0.0f, 1.0f)); spawn_spark(emission_position, spark_first_vector, acc, initial_spark_color, - fast_tween_color(D_L10_0016202C, D_L10_00162030, random_float_between(0.0f, 1.0f)), + fast_tween_color(l10_height_adjusted_spark_second_color_from, l10_height_adjusted_spark_second_color_to, random_float_between(0.0f, 1.0f)), frame_count, second_frame_count, third_frame_count, From 472aa97acc40df535a8aaac1bf291ab95f9514c4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:44:10 +0000 Subject: [PATCH 192/758] decomp: clarify names in spawn_spark_scatter D_L12_001618CC -> l12_spark_scatter_table_index_and_mode: Authoritative src/overlays/l12/mobys/hoven_anklebiter.c SHA-256 c4393a13f1d039a2192a3effca7e80e0827dff1bd9f997353cd2375fb244f221 declares this int as 0x10017 and passes it as spawn_spark argument 9. Retail 0x002e1b74 loads it into v1, 0x002e1b8c stores it at sp+0, and 0x002e1b98 calls checked level-12 helper 0x00281990. Helper 0x002819ec reads that argument into s1. At 0x00281a68-0x00281a7c, s1 & 0xffff indexes the pointer table at 0x001b2500 with four-byte stride; 0x00281a84/0x00281a8c copy the selected object's first byte to particle+2. At 0x00281a78/0x00281a80/0x00281a88, bit 16 selects replacement of initial particle+3 mode 0x44 (0x00281a1c/0x00281a38) by 0x48 at 0x00281a90-0x00281a94. Value -1 follows the default entry path 0x00281a48-0x00281a64. Thus 0x10017 encodes index 0x17 together with the mode bit, not a pure index. Original assigned Ghidra decompilation and instructions were reviewed; its missing ninth call argument is resolved by these authoritative stack loads/stores. --- src/overlays/l12/mobys/hoven_anklebiter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l12/mobys/hoven_anklebiter.c b/src/overlays/l12/mobys/hoven_anklebiter.c index 37cc64754e..e71dcdd2af 100644 --- a/src/overlays/l12/mobys/hoven_anklebiter.c +++ b/src/overlays/l12/mobys/hoven_anklebiter.c @@ -190,7 +190,7 @@ extern int spark_scatter_third_frame_count_range_end_gp __asm__("D_L12_001618C0" __attribute__((sda)); int l12_spark_scatter_start_color __asm__("D_L12_001618C4") = 0xa0f0e8e0; int l12_spark_scatter_end_color __asm__("D_L12_001618C8") = 0x20f0e8e0; -int D_L12_001618CC = 0x10017; +int l12_spark_scatter_table_index_and_mode __asm__("D_L12_001618CC") = 0x10017; void spawn_spark_scatter(void *spark_scatter_origin) __asm__("FUN_L12_002e19a8"); void spawn_spark_scatter(void *pos) __asm__("FUN_L12_002e19a8"); extern void spawn_spark_scatter(void *) __asm__("FUN_L12_002e19a8"); @@ -246,7 +246,7 @@ void spawn_spark_scatter(void *spark_scatter_origin) { frame_count, second_frame_count, third_frame_count, - D_L12_001618CC); + l12_spark_scatter_table_index_and_mode); } while (--i >= 0); } From a9dfeb5e0ffe0f1d4e7067b72c9066c1d83df193 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:44:21 +0000 Subject: [PATCH 193/758] decomp: clarify names in set_resort_owner_state D_L11_001613E0 -> l11_resort_owner_gate_attachment_local_x_offset: Source defines float D_L11_001613E0=3.2f and passes its address both to transform_attachment_pose with the selected gate in RESORT_OWNER_WAIT_AT_GATE and to transform_vector_by_basis in RESORT_OWNER_MOVE_TO_GATE_TARGET. Retail 0x002d2208..0x002d223c selects gates[leg!=0] and copies gate position to pvars+0x120; 0x002d2240..0x002d225c passes gate+0xC0 and gp-0x5820, transforms the offset and adds it to that target. Checked helper 0x00231038 loads the vector beginning at a1 into vf5, and 0x00231048 multiplies the first gate basis vector by vf5.x. Thus the scalar at the vector start is the gate attachment local X offset, also used for its approach target; no contents of the other lanes are inferred. D_L11_00161400 -> l11_resort_owner_gate_departure_target_local_x_offset: Source defines float D_L11_00161400=-3.0f and passes its address to transform_vector_by_basis only in RESORT_OWNER_MOVE_TO_GATE_DEPARTURE_TARGET. Retail 0x002d22cc..0x002d2300 resolves gates[leg!=0] and copies gate position into pvars+0x120; 0x002d2304..0x002d2320 passes gate+0xC0 and gp-0x5800, transforms this local offset and adds it to that position. Checked helper 0x00231038 loads a1 as vf5 and 0x00231048 uses vf5.x to scale the first basis vector, proving this scalar is the departure target local X component. Source transitions wait for this target before advancing the path leg. --- src/overlays/l11/mobys/resort_owner.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l11/mobys/resort_owner.c b/src/overlays/l11/mobys/resort_owner.c index 493c996aa4..b46f120bbe 100644 --- a/src/overlays/l11/mobys/resort_owner.c +++ b/src/overlays/l11/mobys/resort_owner.c @@ -147,7 +147,7 @@ extern void transform_attachment_pose(void *, void *, void *, void *, void *, v extern void FUN_00212f90(void *, int, int, int); extern float D_0015ED70; extern float D_0015ED6C; -float D_L11_001613E0 = 3.2f; +float l11_resort_owner_gate_attachment_local_x_offset __asm__("D_L11_001613E0") = 3.2f; int l11_resort_owner_gate_attachment_rotation __asm__("D_L11_001613F0") = 0; extern int resort_owner_completion_rotation_trigger_state[] __asm__("D_L11_0016D260"); extern int D_L11_0015FFD8; @@ -230,7 +230,7 @@ void update_resort_owner_state_actions(void *mp) { gate_moby += *gate_moby_index_ptr << 8; transform_attachment_pose(moby, gate_moby, - &D_L11_001613E0, + &l11_resort_owner_gate_attachment_local_x_offset, &l11_resort_owner_gate_attachment_rotation, (char *)moby + 0x10, (char *)moby + 0x40); @@ -595,7 +595,7 @@ void update_resort_owner_state_transitions(void *resort_owner_moby) { extern float resort_owner_follow_hero_speed_gp __asm__("D_L11_001613D0") __attribute__((sda)); extern float resort_owner_distant_follow_and_path_speed_gp __asm__("D_L11_001613D4") __attribute__((sda)); -float D_L11_00161400 = -3.0f; +float l11_resort_owner_gate_departure_target_local_x_offset __asm__("D_L11_00161400") = -3.0f; void set_resort_owner_state(struct Moby *moby, unsigned char state) __asm__("FUN_L11_002d2088"); @@ -647,7 +647,7 @@ void set_resort_owner_state(struct Moby *moby, unsigned char state) { o = (char *)D_L11_0015FFD8; o += p << 8; qcopy(moby_vars->unk120, o + 0x10); - transform_vector_by_basis(gate_target_offset, &D_L11_001613E0, o + 0xC0); + transform_vector_by_basis(gate_target_offset, &l11_resort_owner_gate_attachment_local_x_offset, o + 0xC0); fast_vec_add(moby_vars->unk120, moby_vars->unk120, gate_target_offset); } break; @@ -670,7 +670,7 @@ void set_resort_owner_state(struct Moby *moby, unsigned char state) { o = (char *)D_L11_0015FFD8; o += p << 8; qcopy(moby_vars->unk120, o + 0x10); - transform_vector_by_basis(gate_target_offset, &D_L11_00161400, o + 0xC0); + transform_vector_by_basis(gate_target_offset, &l11_resort_owner_gate_departure_target_local_x_offset, o + 0xC0); fast_vec_add(moby_vars->unk120, moby_vars->unk120, gate_target_offset); } break; From f611dc2529798a40512572b057f2793c038f9348 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:44:34 +0000 Subject: [PATCH 194/758] decomp: clarify names in draw_teleporter_ring D_L11_00161924 -> l11_teleporter_ring_blend_b_selector: Source int D_L11_00161924 = 2 supplies quad.tag[3] bits starting at 2. Original Ghidra iGpffffad24 is shifted left 2; retail lw a2,-0x52dc(gp) at 0x002f2dc8, dsll a2,a2,2 at 0x002f2de8, and OR at 0x002f2df0 feed the packet+0x88 store at 0x002f2e14. Supplied checked helper evidence loads packet+0x88 at 0x0022efa0 and emits it with GS register 0x42 (ALPHA_1) at 0x0022efa4/0x0022efb0/0x0022efbc. Bits 2-3 select blend B, matching existing A and C selector names; preserve binding D_L11_00161924 and initializer 2. D_L11_0016192C -> l11_teleporter_ring_blend_d_selector: Source int D_L11_0016192C = 1 supplies quad.tag[3] bits starting at 6. Original Ghidra iGpffffad2c is shifted left 6; retail lw a1,-0x52d4(gp) at 0x002f2dec, dsll a1,a1,6 at 0x002f2e00, and OR at 0x002f2e04 feed packet+0x88 at 0x002f2e14. Supplied checked helper evidence at 0x0022efa0-0x0022efbc sends packet+0x88 to GS ALPHA_1 register 0x42. Bits 6-7 select blend D, matching existing A and C selector naming; preserve binding D_L11_0016192C and initializer 1. D_L11_00161930 -> l11_teleporter_ring_effect_texture_index: Authoritative source int D_L11_00161930 = 0x13 is passed directly to get_effect_texture and its u64 return becomes quad.tag[1]. Original Ghidra uGpffffad30 feeds func_0x0022ab00; retail lw a0,-0x52d0(gp) at 0x002f2dbc, jal 0x0022ab00 at 0x002f2dc0 and sd v0,0x78(sp) at 0x002f2e08 confirm that flow. Supplied get_effect_texture(int index) C indexes effect_texture_definitions[index] to build/cache tex0, proving a texture definition index rather than a texture pointer or packed tex0 word. Preserve binding D_L11_00161930 and initializer 0x13. --- src/overlays/l11/mobys/teleporter.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l11/mobys/teleporter.c b/src/overlays/l11/mobys/teleporter.c index 9aa6860431..0a9eb90cef 100644 --- a/src/overlays/l11/mobys/teleporter.c +++ b/src/overlays/l11/mobys/teleporter.c @@ -265,10 +265,10 @@ extern void draw_geometry_quad(void *, void *, int) __asm__("FUN_0 extern float teleporter_ring_quad_uvs[] __asm__("D_L11_001D3530"); int l11_teleporter_ring_blend_a_selector __asm__("D_L11_00161920") = 0; -int D_L11_00161924 = 2; +int l11_teleporter_ring_blend_b_selector __asm__("D_L11_00161924") = 2; int l11_teleporter_ring_blend_c_selector __asm__("D_L11_00161928") = 0; -int D_L11_0016192C = 1; -int D_L11_00161930 = 0x13; +int l11_teleporter_ring_blend_d_selector __asm__("D_L11_0016192C") = 1; +int l11_teleporter_ring_effect_texture_index __asm__("D_L11_00161930") = 0x13; unsigned int l11_teleporter_ring_vertex_color __asm__("D_L11_00161934") = 0x60408080; float teleporter_ring_local_z_center_gp __asm__("D_L11_00161938") = 1.0f; /* Draws a ring of 32 textured quads around the moby; the band widens as the radius at pvars+0x3C shrinks below 1.15. */ @@ -284,10 +284,10 @@ void draw_teleporter_ring(struct Moby *moby) { copy_matrix_rotation(matrix, &moby->rot_row0); qcopy(matrix + 12, &moby->pos); - quad.tag[1] = get_effect_texture(D_L11_00161930); - quad.tag[3] = (unsigned long long)l11_teleporter_ring_blend_a_selector | (unsigned long long)D_L11_00161924 << 2 | + quad.tag[1] = get_effect_texture(l11_teleporter_ring_effect_texture_index); + quad.tag[3] = (unsigned long long)l11_teleporter_ring_blend_a_selector | (unsigned long long)l11_teleporter_ring_blend_b_selector << 2 | (unsigned long long)l11_teleporter_ring_blend_c_selector << 4 | - (unsigned long long)D_L11_0016192C << 6 | 0x8000000000ULL; + (unsigned long long)l11_teleporter_ring_blend_d_selector << 6 | 0x8000000000ULL; quad.tag[2] = 0xff9000000260ULL; quad.tag[0] = 0; { From 765c88ed70d2427ede01eebb8ac5f76bfeee81de Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:44:46 +0000 Subject: [PATCH 195/758] decomp: clarify names in spawn_rocket_exhaust_puffs D_L14_00161FA4 -> l14_rocket_initial_exhaust_puff_color: The source defines this int as 0x7f204080 and passes it only as the packed color argument of the initial two-puff loop. Retail 0x002fdfe8 loads it from gp-0x4c5c into a3 for spawn_puff at 0x002fdfe4. The same a3 slot receives 0x7fffffff at 0x002fe08c/0x002fe0b0 and the grayscale word built by copying a random 0x40..0x80 shade into bits 0..23 with 0x7f000000 at 0x002fe120-0x002fe14c, passed at 0x002fe180/0x002fe198. Checked helper 0x00274cac saves a3 in s2, writes it to puff+0x20 at 0x00274da0, and writes the word OR 0x20000000 to puff+4 at 0x00274d00-0x00274d08. This proves the initial exhaust puffs' packed color role, independently of channel ordering; l14 identifies its overlay ownership. --- src/overlays/l14/mobys/rocket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/rocket.c b/src/overlays/l14/mobys/rocket.c index db882d710b..e8f318e1e6 100644 --- a/src/overlays/l14/mobys/rocket.c +++ b/src/overlays/l14/mobys/rocket.c @@ -162,7 +162,7 @@ extern float rocket_puff_middle_right_offset_delta_gp __asm__("D_L14_00161F9C") extern float rocket_puff_final_right_offset_gp __asm__("D_L14_00161FA0") __attribute__((sda)); -int D_L14_00161FA4 = 0x7f204080; +int l14_rocket_initial_exhaust_puff_color __asm__("D_L14_00161FA4") = 0x7f204080; void spawn_rocket_exhaust_puffs(struct Moby *source_moby) __asm__("FUN_L14_002fded0"); @@ -184,7 +184,7 @@ void spawn_rocket_exhaust_puffs(struct Moby *source_moby) { for (i = 1; i >= 0; i--) { puff_signed_amount = random_integer_below(0x10); k = random_integer_below(2) == 0 ? puff_signed_amount : -puff_signed_amount; - puff = spawn_puff(B, 0.2f, 1.0f, 0.9f, k, &D_L14_0015F580, 200000.0f, D_L14_00161FA4); + puff = spawn_puff(B, 0.2f, 1.0f, 0.9f, k, &D_L14_0015F580, 200000.0f, l14_rocket_initial_exhaust_puff_color); if (puff != 0) { L14PuffTail *f = &puff->tail; From 61313ef823d8f171d431ffa0009865fac527b173 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:44:58 +0000 Subject: [PATCH 196/758] decomp: clarify names in update_fighter_jet_flight D_L17_00162000 -> l17_fighter_jet_startup_speed_ramp_count_limit: The int initialized to 120 is loaded at 0x002ec3fc (gp-0x4c00) and compared against signed vars+0x68 at 0x002ec3f8-0x002ec408. While count is at or below it, 0x002ec578-0x002ec594 increments count and adds fighter_jet_startup_speed_step_gp times the scale to speed. Above it, throttle voice handling and boost/cruise speed control run. The supplied fighter_jet_update resets this count (s68) to zero on boarding. This proves the startup speed-ramp count limit. D_L17_00162014 -> l17_fighter_jet_steering_startup_count_threshold: The int initialized to 5 is loaded at 0x002ec5b0 (gp-0x4bec), compared with signed vars+0x68 at 0x002ec5ac-0x002ec5b8, and skips to 0x002ec750 unless count exceeds it. The guarded block reads hero stick X/Y, adjusts steering for flight bounds, springs horizontal/vertical steering, and updates roll, pitch and heading at 0x002ec5c0-0x002ec74c. Source resets count on boarding and increments it during startup. This proves a startup-count threshold for steering. D_L17_0016215C -> l17_fighter_jet_collision_damage_cooldown_reload: The int initialized to 10 is loaded at 0x002ecec8 (gp-0x4aa4) and stored to vars+0xDC at 0x002eced0. Retail 0x002ecdbc-0x002ecdec checks that field for zero before subtracting fighter_jet_collision_damage_gp from hero.ship_hp for a damaging moby collision. Supplied fighter_jet_update maps the same field to timerDC and calls fast_dec_timer on it each update. Reloading that gate after damage proves a collision-damage cooldown reload. --- src/overlays/l17/mobys/fighter_jet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l17/mobys/fighter_jet.c b/src/overlays/l17/mobys/fighter_jet.c index 908191e744..e83ba05618 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -1118,11 +1118,11 @@ extern float vector_length_xy(void *); #include "rnc/overlay/l17/mobys/fighter_jet_data/update_fighter_jet_flight_8.h" -int D_L17_00162000 = 120; +int l17_fighter_jet_startup_speed_ramp_count_limit __asm__("D_L17_00162000") = 120; #include "rnc/overlay/l17/mobys/fighter_jet_data/update_fighter_jet_flight_7.h" -int D_L17_00162014 = 5; +int l17_fighter_jet_steering_startup_count_threshold __asm__("D_L17_00162014") = 5; #include "rnc/overlay/l17/mobys/fighter_jet_data/update_fighter_jet_flight_6.h" @@ -1159,7 +1159,7 @@ extern float D_L17_00162160 __attribute__((sda)); extern float D_L17_00162164 __attribute__((sda)); extern float D_L17_00162168 __attribute__((sda)); extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); -int D_L17_0016215C = 10; +int l17_fighter_jet_collision_damage_cooldown_reload __asm__("D_L17_0016215C") = 10; float D_L17_001621F0[2] = {512.0f, 512.0f}; unsigned short l17_fighter_jet_collision_death_respawn_delay __asm__("D_L17_0016217C") = 0x1e; @@ -1240,7 +1240,7 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v ship_moby->flags &= 0xFEFF; *(Q_c4 *)death_explosion_velocity = movement_delta.q; if (ship_moby->bc == 0) { - if (D_L17_00162000 < ship_vars->count) { + if (l17_fighter_jet_startup_speed_ramp_count_limit < ship_vars->count) { pad = &controller_state; if (pad->raw_pressed & 0x40) { voice_slot_index = ship_vars->i10C; @@ -1295,7 +1295,7 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v ship_vars->speed = 0.0001f; } - if (D_L17_00162014 < ship_vars->count) { + if (l17_fighter_jet_steering_startup_count_threshold < ship_vars->count) { steering_input_hero = &hero; x = steering_input_hero->stick_x; y = steering_input_hero->stick_y; @@ -1554,7 +1554,7 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v 0); ship_moby->state = FIGHTER_JET_STATE_DEATH_RESPAWN_DELAY; } - ship_vars->iDC = D_L17_0016215C; + ship_vars->iDC = l17_fighter_jet_collision_damage_cooldown_reload; } } else { *(int *)&hero.ship_hp = 0; From 5e74a6919e0ef1b787cfbef3be8b6122c34f2602 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:47:09 +0000 Subject: [PATCH 197/758] decomp: clarify names in volume_camera_swing rec -> current_follow_camera_record: In the type-5 first-frame snap block, source rec = current_follow_cam and rig = FOLLOW_CAM_STATE(rec); pos = &rec->pos is the destination of eye + tail offset. Retail 0x002ecb30-0x002ecb3c loads current_follow_cam (0x00166e00) into s6 and loads its state at +0x70; 0x002ecba4 advances that camera record pointer to its position at +0x30, and 0x002ecbc4-0x002ecbd0 writes the vector sum there. Original Ghidra iVar4 = DAT_00166e00 and puVar13 = iVar4 + 0x30 corroborate that rec is the current follow camera record, distinct from the input swing-volume record. --- src/overlays/shared/camera/swing_volume_camera.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/camera/swing_volume_camera.c b/src/overlays/shared/camera/swing_volume_camera.c index 7fb4235947..363f537b39 100644 --- a/src/overlays/shared/camera/swing_volume_camera.c +++ b/src/overlays/shared/camera/swing_volume_camera.c @@ -148,7 +148,7 @@ void volume_camera_swing(struct UpdateCam *swing_camera_record) { }; CameraVec gravity_offset_or_yaw_direction; SwingCameraParams *params; - struct UpdateCam *rec; + struct UpdateCam *current_follow_camera_record; Vec4f *pos; FollowCamState *rig; FollowCamState *state; @@ -206,8 +206,8 @@ void volume_camera_swing(struct UpdateCam *swing_camera_record) { /* One word over type and timer: type 5 on its first frame snaps the camera. */ if (*(s32 *)¶ms->type == SWING_CAMERA_TYPE_SNAP_ON_ENTRY) { *(s32 *)¶ms->swing = 0; - rec = current_follow_cam; - rig = FOLLOW_CAM_STATE(rec); + current_follow_camera_record = current_follow_cam; + rig = FOLLOW_CAM_STATE(current_follow_camera_record); follow = &rig->follow; tail = &rig->tail; snap = &rig->tail.snap; @@ -220,7 +220,7 @@ void volume_camera_swing(struct UpdateCam *swing_camera_record) { follow->look_height = params->offset_scale; qcopy(state->tail.unk140, tail->unk130); fast_vec_scale(gravity_offset_or_yaw_direction, &hero.gravity_dir, -tail->distance); - pos = &rec->pos; + pos = ¤t_follow_camera_record->pos; fast_vec_add(state->follow.eye, &hero.motion.pos, gravity_offset_or_yaw_direction); fast_vec_add(pos, state->follow.eye, tail->unk130); fast_vec_scale(gravity_offset_or_yaw_direction, &hero.gravity_dir, -follow->look_height); From 0b83ce59f7f555c23b7529f8c59bc0ac196db4ae Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:47:24 +0000 Subject: [PATCH 198/758] decomp: clarify names in draw_group_scenery_ship_trails D_L05_001613FC -> l05_scenery_ship_trail_blend_b_selector: Retail 002d79c8 loads gp-0x5804 (001613fc), 002d79d8 shifts it left two, and 002d79fc..002d7a30 ORs it into packet+0x88. Original Ghidra iGpffffa7fc and authoritative C agree. Checked direct draw helper 0022bf8c retains the packet in s2; 0022c2f0 loads +0x88 and 0022c2f4/0022c300/0022c30c emits it to GS ALPHA_1 (0x42). Bits 2..3 select blend operand B, consistent with already named A and C fields; supplied int initializer is 2. D_L05_00161404 -> l05_scenery_ship_trail_blend_d_selector: Retail 002d79d4 loads gp-0x57fc (00161404), 002d79e8 shifts it left six, and 002d7a0c..002d7a30 ORs it into packet+0x88. Original Ghidra iGpffffa804 and authoritative C agree. Checked draw helper 0022bf8c retains the packet in s2 and 0022c2f0..0022c30c emits +0x88 paired with GS ALPHA_1 register 0x42. Bits 6..7 select blend operand D in (A-B)*C+D; supplied int initializer is 1. D_L05_00161408 -> l05_scenery_ship_trail_fade_start_color: Retail 002d7aa0/002d7ac8 loads gp-0x57f8 (00161408) into a0, with saturated fade ratio in f12, before interpolation call 002d7ad8; 002d7ae0 stores the return into quad vertex color. Original Ghidra uGpffffa808 and source interpolate_color_7920(ratio,D_L05_00161408,D_L05_0016140C) agree. Checked helper 0022ef80..0022efb0 unpacks a0/a1 and calculates a0*(1-ratio)+a1*ratio per channel, proving this initialized 0x40806060 color is the ratio-zero start endpoint. D_L05_0016140C -> l05_scenery_ship_trail_fade_end_color: Retail 002d7acc loads gp-0x57f4 (0016140c) into a1 before 002d7ad8 interpolates using saturated trail ratio f12; 002d7ae0 stores the return into each packet vertex color. Original Ghidra uGpffffa80c and authoritative C agree. Checked helper 0022ef8c..0022efb0 unpacks a1 into vf3 and multiplies it by ratio, adding a0*(1-ratio); thus this initialized 0x802020 color is the ratio-one end endpoint of the trail fade. --- src/overlays/l05/mobys/scenery_ship.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l05/mobys/scenery_ship.c b/src/overlays/l05/mobys/scenery_ship.c index e8ff27679a..f755106001 100644 --- a/src/overlays/l05/mobys/scenery_ship.c +++ b/src/overlays/l05/mobys/scenery_ship.c @@ -390,11 +390,11 @@ typedef struct { int l05_scenery_ship_trail_callback_disabled __asm__("D_L05_001613F0") = 0; int l05_scenery_ship_trail_ribbon_draw_disabled __asm__("D_L05_001613F4") = 0; int l05_scenery_ship_trail_blend_a_selector __asm__("D_L05_001613F8") = 0; -int D_L05_001613FC = 2; +int l05_scenery_ship_trail_blend_b_selector __asm__("D_L05_001613FC") = 2; int l05_scenery_ship_trail_blend_c_selector __asm__("D_L05_00161400") = 0; -int D_L05_00161404 = 1; -int D_L05_00161408 = 0x40806060; -int D_L05_0016140C = 0x802020; +int l05_scenery_ship_trail_blend_d_selector __asm__("D_L05_00161404") = 1; +int l05_scenery_ship_trail_fade_start_color __asm__("D_L05_00161408") = 0x40806060; +int l05_scenery_ship_trail_fade_end_color __asm__("D_L05_0016140C") = 0x802020; extern unsigned char l05_scenery_ship_extended_trail_selector __asm__("D_L05_0015EDB2"); extern struct Moby *D_L05_0015FFD8 __asm__("D_L05_0015FFD8"); extern short *D_L05_001ABCC0_7920[] __asm__("D_L05_001ABCC0"); @@ -438,8 +438,8 @@ void draw_group_scenery_ship_trails(struct Moby *moby) { glow_packet->effect_texture = texture; glow_packet->texture = 0xff9000000260ULL; glow_packet->zero = 0; - glow_packet->flags = (u64)l05_scenery_ship_trail_blend_a_selector | ((u64)D_L05_001613FC << 2) | - ((u64)l05_scenery_ship_trail_blend_c_selector << 4) | ((u64)D_L05_00161404 << 6) | + glow_packet->flags = (u64)l05_scenery_ship_trail_blend_a_selector | ((u64)l05_scenery_ship_trail_blend_b_selector << 2) | + ((u64)l05_scenery_ship_trail_blend_c_selector << 4) | ((u64)l05_scenery_ship_trail_blend_d_selector << 6) | 0x8000000000ULL; phase = convert_integer_to_float((frame_number + 3) & 3) / (l05_scenery_ship_trail_segment_limit * 4.0f); for (j = 0; j < 4; j++) { @@ -450,7 +450,7 @@ void draw_group_scenery_ship_trails(struct Moby *moby) { ratio = 1.0f; else if (ratio < 0.0f) ratio = 0.0f; - packet[i].color[j] = interpolate_color_7920(ratio, D_L05_00161408, D_L05_0016140C); + packet[i].color[j] = interpolate_color_7920(ratio, l05_scenery_ship_trail_fade_start_color, l05_scenery_ship_trail_fade_end_color); } } memset(matrix, 0, 0x20); From 51ed2f0d83b57f9810c9382a54d48445a65c073b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:49:49 +0000 Subject: [PATCH 199/758] decomp: clarify names in emit_sand_shark_radial_particles D_L02_00161960 -> l02_sand_shark_radial_particle_header_selector: Authoritative C defines this int as -1 and passes it as ninth spawn_spark argument. Retail 0x002d59fc loads the global at gp-0x52a0 and 0x002d5a14 stores it at caller sp+0 before the call at 0x002d5a20. Checked level-02 helper 0x0026a730 loads that argument into s1 at 0x0026a78c. At 0x0026a7e8-0x0026a804, -1 selects the byte through pointer 0x001b26dc for particle header+2. Otherwise 0x0026a808-0x0026a82c uses its low 16 bits to index pointer table 0x001b2680 and copies the pointed-to byte to header+2; bit 0x10000 additionally changes header+3 from 0x44 to 0x48 at 0x0026a830-0x0026a834. This proves a particle header selector without assuming resource meaning. --- src/overlays/l02/mobys/sand_shark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 659cab8ef8..b0e75fce10 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -1023,7 +1023,7 @@ extern int sand_shark_particle_third_frame_count_range_end_gp __asm__("D_L02_001 __attribute__((sda)); int l02_sand_shark_radial_particle_initial_color __asm__("D_L02_00161958") = 0x60306058; int l02_sand_shark_radial_particle_secondary_color __asm__("D_L02_0016195C") = 0x20306058; -int D_L02_00161960 = -1; +int l02_sand_shark_radial_particle_header_selector __asm__("D_L02_00161960") = -1; /* Same routine as FUN_L12_002e19a8: spawns n particles around pos, fewer when D_L02_00160178 is high. */ void emit_sand_shark_radial_particles(void *particle_origin, int particle_count) { @@ -1083,7 +1083,7 @@ void emit_sand_shark_radial_particles(void *particle_origin, int particle_count) frame_count, second_frame_count, third_frame_count, - D_L02_00161960); + l02_sand_shark_radial_particle_header_selector); } } From e82fd6f50a932a2cb961f66fa7f4a4b0ad42901f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:49:49 +0000 Subject: [PATCH 200/758] decomp: clarify names in update_path_flythrough_camera rec -> flythrough_descriptor_record: Retail 0x002f5f54-0x002f5f7c loads l10_descriptor_table, scales cam->descriptor_index at +0x84 by 32, and loads the record pointer at entry+0x1c into s4 (Ghidra iVar3; source rec). That same record provides position/look path indices at +0x20/+0x24 (0x002f5fb0-0x002f5fd8), anchor index and offset at +0x28/+0x2c (0x002f6000-0x002f604c), traversal speed at +0x3c multiplied by frame_time (0x002f6234-0x002f6244), and completion flag +0x39 (0x002f6184 and 0x002f6298). Supplied initialize_path_camera uses the same descriptor lookup and fields, proving this is the flythrough camera descriptor record, rather than its saved runtime state. --- .../shared/camera/path_flythrough_camera.c | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/overlays/shared/camera/path_flythrough_camera.c b/src/overlays/shared/camera/path_flythrough_camera.c index 0ab5833310..a16ce8fb46 100644 --- a/src/overlays/shared/camera/path_flythrough_camera.c +++ b/src/overlays/shared/camera/path_flythrough_camera.c @@ -211,30 +211,30 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { f32 look_t; char *saved; VendorCamRun_5f18 *run; - char *rec; + char *flythrough_descriptor_record; VendorCamStops_5f18 *stops; char *path; int done; int i; saved = (char *)cam->saved_state; - rec = *(char **)(l10_descriptor_table + cam->descriptor_index * 32 + 0x1C); + flythrough_descriptor_record = *(char **)(l10_descriptor_table + cam->descriptor_index * 32 + 0x1C); run = (VendorCamRun_5f18 *)(saved + 0x40); stops = (VendorCamStops_5f18 *)(saved + 0x58); if (run->started == 0) { l10_path_camera_transition_amount += 0.05f; if (l10_path_camera_transition_amount >= 1.0f) { - char *start_path = ((char *)l10_paths[*(int *)(rec + 0x20)]); - char *look_path = ((char *)l10_paths[*(int *)(rec + 0x24)]); + char *start_path = ((char *)l10_paths[*(int *)(flythrough_descriptor_record + 0x20)]); + char *look_path = ((char *)l10_paths[*(int *)(flythrough_descriptor_record + 0x24)]); l10_path_camera_transition_amount = 1.0f; l10_path_flythrough_active = 1; run->started = 1; qcopy(&cam->pos, start_path + 0x10); - if (*(int *)(rec + 0x28) >= 0) { + if (*(int *)(flythrough_descriptor_record + 0x28) >= 0) { struct Moby *anchor = - (struct Moby *)(D_L10_0015FFD8_5f18 + *(int *)(rec + 0x28) * 256); - float *ofs = (float *)(rec + 0x2C); + (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]; @@ -262,14 +262,14 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { ang = stops->fov_end * 0.5f; l10_camera_view.tan_half_fov = fast_sin(ang) / fast_cos(ang); update_view_context(); - *(u8 *)(rec + 0x39) = 1; + *(u8 *)(flythrough_descriptor_record + 0x39) = 1; D_L10_00167358 = 0.05f; cam->transition_state = 4; l10_path_flythrough_active = 0; - if (*(int *)(rec + 0x4C) == 0) + if (*(int *)(flythrough_descriptor_record + 0x4C) == 0) hero_set_state(0, 1); } - if (*(int *)(rec + 0x40) == 0) + if (*(int *)(flythrough_descriptor_record + 0x40) == 0) return; } else if (run->started == 3) { return; @@ -278,22 +278,22 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { if (l10_path_camera_transition_amount < 0.0f) l10_path_camera_transition_amount = 0.0f; } - path = ((char *)l10_paths[*(int *)(rec + 0x20)]); + path = ((char *)l10_paths[*(int *)(flythrough_descriptor_record + 0x20)]); qcopy(initial_aim_or_previous_position, &cam->pos); done = FUN_L00_0025d808( - path, &cam->pos.x, &run->seg, &run->t, 0, *(float *)(rec + 0x3C) * frame_time); + path, &cam->pos.x, &run->seg, &run->t, 0, *(float *)(flythrough_descriptor_record + 0x3C) * frame_time); if (run->timer != 0) { if (fast_dec_timer_s16(&run->timer) != 0) done = 1; - else if (*(int *)(rec + 0x40) != 0 && + else if (*(int *)(flythrough_descriptor_record + 0x40) != 0 && run->timer < scale_game_frames(truncate_float_to_s32(20.0f))) done = 1; } - if (*(u8 *)(rec + 0x39) != 0) + if (*(u8 *)(flythrough_descriptor_record + 0x39) != 0) done = 1; if (done) { run->started = 2; - if (*(int *)(rec + 0x40) == 0) + if (*(int *)(flythrough_descriptor_record + 0x40) == 0) return; } for (i = 0; i < 7 && stops->seg[i] >= 0 && stops->seg[i + 1] >= 0; i++) { @@ -317,9 +317,9 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { } } run->dist += fast_vec_dist(initial_aim_or_previous_position, &cam->pos); - if (*(int *)(rec + 0x28) >= 0) { - struct Moby *anchor = (struct Moby *)(D_L10_0015FFD8_5f18 + *(int *)(rec + 0x28) * 256); - float *ofs = (float *)(rec + 0x2C); + if (*(int *)(flythrough_descriptor_record + 0x28) >= 0) { + struct Moby *anchor = (struct Moby *)(D_L10_0015FFD8_5f18 + *(int *)(flythrough_descriptor_record + 0x28) * 256); + float *ofs = (float *)(flythrough_descriptor_record + 0x2C); point[0] = ofs[0]; point[1] = ofs[1]; point[2] = ofs[2]; @@ -328,7 +328,7 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { fast_vec_add(look_point, &anchor->pos, point); fast_vec_sub(offset, look_point, &cam->pos); } else { - char *look = ((char *)l10_paths[*(int *)(rec + 0x24)]); + char *look = ((char *)l10_paths[*(int *)(flythrough_descriptor_record + 0x24)]); look_seg = 0; look_t = 0.0f; FUN_L00_0025d808(look, From 9df2d371b74cbd46533f896a6c94820bd97c28d5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:50:06 +0000 Subject: [PATCH 201/758] decomp: clarify names in draw_elevator_rotating_rings D_L02_00161BF8 -> level02_elevator_ring_blend_color_b_selector: Retail 0x002dc3b8 loads gp-0x5008, 0x002dc3d8 shifts it by 2, and 0x002dc3e0 ORs it into packet.mode, stored at sp+0x88 at 0x002dc414. Original Ghidra iGpffffaff8 and bound C agree. Checked level-02 draw_geometry_quad at 0x0020e670 loads packet+0x88 and 0x0020e674/0x0020e680/0x0020e68c emits it for GS ALPHA_1 (0x42). Bits 2-3 are the B color operand selector in (A-B)*C+D. Preserve its int initializer 2 and assembler identity. D_L02_00161C00 -> level02_elevator_ring_blend_color_d_selector: Retail 0x002dc3dc loads gp-0x5000, 0x002dc3f0 shifts it by 6, and 0x002dc3f4 ORs it into packet.mode, stored at sp+0x88 at 0x002dc414. Original Ghidra iGpffffb000 and bound C agree. Checked quad helper 0x0020e670-0x0020e68c pairs packet+0x88 with GS ALPHA_1 register 0x42. Bits 6-7 select the D additive color operand in (A-B)*C+D. Preserve its int initializer 1 and assembler identity. D_L02_00161C04 -> level02_elevator_ring_zero_speed_color: Retail 0x002dc354 loads gp-0x4ffc into a0 for 0x00211300; bound C passes D_L02_00161C04 as fast_tween_color first color. Retail 0x002dc324/0x002dc340 takes absolute elevator speed, and 0x002dc350-0x002dc364 divides by scaled maximum speed for f12. Checked helper 0x00211320 forms 1-t; 0x0021132c-0x00211330 computes a0*(1-t)+a1*t per unpacked channel, then repacks. Thus this is the t=0/zero-speed ring color; returned color is copied to all four vertices at 0x002dc620-0x002dc630. Preserve initializer 0x206068. D_L02_00161C08 -> level02_elevator_ring_max_speed_color: Retail 0x002dc35c loads gp-0x4ff8 into a1 for 0x00211300; bound C passes D_L02_00161C08 as fast_tween_color second color. Retail 0x002dc324-0x002dc364 computes t=absolute elevator speed/(maximum vertical speed*D_0015ED6C). Checked helper 0x00211320-0x00211330 computes a0*(1-t)+a1*t per channel before packing. This second endpoint is selected at t=1, when speed reaches that scaled maximum; return value supplies all ring quad vertex colors at 0x002dc620-0x002dc630. Preserve initializer 0x40107020. --- src/overlays/l02/mobys/elevator.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l02/mobys/elevator.c b/src/overlays/l02/mobys/elevator.c index b1caa2fca5..9834a636e1 100644 --- a/src/overlays/l02/mobys/elevator.c +++ b/src/overlays/l02/mobys/elevator.c @@ -250,11 +250,11 @@ extern float level02_elevator_ring_segment_half_height_gp __asm__("D_L02_00161BF extern float level02_elevator_ring_segment_angle_degrees_gp __asm__("D_L02_00161C10") __attribute__((sda)); int level02_elevator_ring_blend_color_a_selector __asm__("D_L02_00161BF4") = 0; -int D_L02_00161BF8 = 2; +int level02_elevator_ring_blend_color_b_selector __asm__("D_L02_00161BF8") = 2; int level02_elevator_ring_blend_alpha_selector __asm__("D_L02_00161BFC") = 0; -int D_L02_00161C00 = 1; -int D_L02_00161C04 = 0x206068; -int D_L02_00161C08 = 0x40107020; +int level02_elevator_ring_blend_color_d_selector __asm__("D_L02_00161C00") = 1; +int level02_elevator_ring_zero_speed_color __asm__("D_L02_00161C04") = 0x206068; +int level02_elevator_ring_max_speed_color __asm__("D_L02_00161C08") = 0x40107020; extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern void draw_geometry_quad(void *, void *, int); @@ -286,8 +286,8 @@ void draw_elevator_rotating_rings(struct Moby *moby) { int i, j, sign, period; lower = lower - half; lower += translation; - color = fast_tween_color(D_L02_00161C04, - D_L02_00161C08, + color = fast_tween_color(level02_elevator_ring_zero_speed_color, + level02_elevator_ring_max_speed_color, absolute_float((moby_vars->unkB0)) / (level02_elevator_max_vertical_speed_gp * D_0015ED6C)); copy_matrix_rotation(&matrix, &moby->rot_row0); @@ -296,8 +296,8 @@ void draw_elevator_rotating_rings(struct Moby *moby) { matrix.position[3] = 1.0f; packet.texture = get_effect_texture(14); packet.flags = 0xFF9000000260L; - packet.mode = (long)level02_elevator_ring_blend_color_a_selector | ((long)D_L02_00161BF8 << 2) | ((long)level02_elevator_ring_blend_alpha_selector << 4) | - ((long)D_L02_00161C00 << 6) | 0x8000000000L; + packet.mode = (long)level02_elevator_ring_blend_color_a_selector | ((long)level02_elevator_ring_blend_color_b_selector << 2) | ((long)level02_elevator_ring_blend_alpha_selector << 4) | + ((long)level02_elevator_ring_blend_color_d_selector << 6) | 0x8000000000L; packet.zero = 0; uv = level02_elevator_ring_segment_uvs; point = packet.position; From 2313e1597e9024712544f9fb3d15e6ba3c919baf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:52:06 +0000 Subject: [PATCH 202/758] decomp: clarify names in select_fighter_jet_target_and_draw_indicators D_L13_001613C8 -> l13_fighter_jet_offscreen_arrow_vertices: Authoritative C passes &D_L13_001613C8 only to emit_transformed_2d_vertex_packet with point_count 3 in the offscreen-arrow branch. Original retail Ghidra shows &gp0xffffa7c8 at that call; retail 0x002b9384 forms a0=gp-0x5838, 0x002b9388 sets a1=3 and 0x002b9390 calls 0x002b7d50. The branch uses candidate-relative direction transformed at 0x002b90a8-0x002b9108, screen position at sp+0x50/+0x54, rotation in f23 and inverse-distance scale at 0x002b9370-0x002b9394. Checked level-13 helper evidence bdcf8c3a69cf43fa8f02d876849f3652 confirms a0 saved to s2 at 0x002b7db8, signed-short XY reads at 0x002b7eb8/0x002b7ecc and four-byte coordinate-pair advance at 0x002b7ed8. Thus this file-owned short starts the offscreen arrow vertex input; keep its exact type, value and storage. --- 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 bed7fc5f53..cbb0d64796 100644 --- a/src/overlays/l13/mobys/fighter_jet.c +++ b/src/overlays/l13/mobys/fighter_jet.c @@ -464,7 +464,7 @@ extern float fighter_jet_target_selection_offset_vector[] __asm__("D_L13_001672E extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); -short D_L13_001613C8 = 2; +short l13_fighter_jet_offscreen_arrow_vertices __asm__("D_L13_001613C8") = 2; extern unsigned char D_0013E500[]; @@ -669,7 +669,7 @@ int select_fighter_jet_target_and_draw_indicators(int source_moby, tab, 0x1E, 0xFFFFF3, 0x500000FF, x, y, 1.3f, -ang); } } else { - emit_transformed_2d_vertex_packet(&D_L13_001613C8, + emit_transformed_2d_vertex_packet(&l13_fighter_jet_offscreen_arrow_vertices, 3, 0xFFFFF3, (arrow_alpha << 24) | 0x8000, From aea7837788e195399fbb036d6430c91f1c273c86 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:52:18 +0000 Subject: [PATCH 203/758] decomp: clarify names in smoke_vent_update D_L02_00162114 -> l02_view_gated_smoke_burst_spawn_options: Authoritative smoke_vent.c SHA-256 2aaeb8b7b7d50d1ff80488655970d10752535299678c0fd07576ad3043bb4981 declares this s32 initialized to 0x10019 and passes it as ninth spawn_spark argument in SMOKE_VENT_STATE_VIEW_GATED_EMISSION's burst loop. Retail 0x002ef300 loads -0x4aec(gp), 0x002ef314 stores it at outgoing sp+0, and 0x002ef324 calls 0x0026a730. Checked helper 0x0026a78c loads that ninth argument into s1; 0x0026a808-0x0026a82c uses its low 16 bits to select a pointer in table 0x001b2680 and copy its first byte to particle+2; 0x0026a820-0x0026a834 tests bit 0x10000 and changes particle+3 from 0x44 to 0x48. This proves packed burst particle spawn options, without asserting table identity or mode meaning. D_L02_00162164 -> l02_alternating_smoke_burst_spawn_options: Authoritative smoke_vent.c SHA-256 2aaeb8b7b7d50d1ff80488655970d10752535299678c0fd07576ad3043bb4981 declares this distinct s32 initialized to 0x10019 and passes it as ninth spawn_spark argument in SMOKE_VENT_STATE_ALTERNATING_PUFF_TIMING's burst loop. Retail 0x002ef7c8 loads -0x4a9c(gp), 0x002ef7dc stores it at outgoing sp+0, and 0x002ef7ec calls 0x0026a730. Checked helper 0x0026a78c loads that ninth argument into s1; 0x0026a808-0x0026a82c indexes table 0x001b2680 using its low 16 bits and copies the selected entry's first byte to particle+2. Bit 0x10000 controls replacing particle+3's default 0x44 with 0x48 at 0x0026a820-0x0026a834. Thus this is the alternating-mode burst's packed particle spawn options, distinct from the state-1 binding despite equal stored values. --- src/overlays/l02/mobys/smoke_vent.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l02/mobys/smoke_vent.c b/src/overlays/l02/mobys/smoke_vent.c index 7d61499642..196f25d416 100644 --- a/src/overlays/l02/mobys/smoke_vent.c +++ b/src/overlays/l02/mobys/smoke_vent.c @@ -84,7 +84,7 @@ s32 l02_view_gated_smoke_burst_second_color_tween_start __asm__("D_L02_00 s32 l02_view_gated_smoke_burst_second_color_tween_end __asm__("D_L02_00162108") = 0x80204080; extern s32 view_gated_smoke_burst_interval_min_gp __asm__("D_L02_0016210C") __attribute__((sda)); extern s32 view_gated_smoke_burst_interval_max_gp __asm__("D_L02_00162110") __attribute__((sda)); -s32 D_L02_00162114 = 0x10019; +s32 l02_view_gated_smoke_burst_spawn_options __asm__("D_L02_00162114") = 0x10019; #include "rnc/overlay/l02/mobys/smoke_vent_data/update_smoke_vent_2.h" @@ -109,7 +109,7 @@ s32 l02_alternating_smoke_burst_second_color_tween_start __asm__("D_L02_0 s32 l02_alternating_smoke_burst_second_color_tween_end __asm__("D_L02_00162158") = 0x80204080; extern s32 alternating_smoke_burst_interval_min_gp __asm__("D_L02_0016215C") __attribute__((sda)); extern s32 alternating_smoke_burst_interval_max_gp __asm__("D_L02_00162160") __attribute__((sda)); -s32 D_L02_00162164 = 0x10019; +s32 l02_alternating_smoke_burst_spawn_options __asm__("D_L02_00162164") = 0x10019; /* Smoke vent: once visible within 120 units it puffs bursts (D_L02_001620C8 / D_L02_00162118 parameter blocks) * on a timer plus occasional single puffs (D_L02_00162088 / D_L02_00162048); state 2 alternates its puff life. @@ -232,7 +232,7 @@ void smoke_vent_update(struct Moby *moby) { (random_float_between(-view_gated_smoke_burst_timing_variation_fraction_gp, view_gated_smoke_burst_timing_variation_fraction_gp) + 1.0f))), - D_L02_00162114); + l02_view_gated_smoke_burst_spawn_options); } } if (random_integer_below(4) != 0) { @@ -369,7 +369,7 @@ void smoke_vent_update(struct Moby *moby) { -alternating_smoke_burst_timing_variation_fraction_gp, alternating_smoke_burst_timing_variation_fraction_gp) + 1.0f))), - D_L02_00162164); + l02_alternating_smoke_burst_spawn_options); } } fast_vec_normalize_scale_first( From 7f114a7975691f8ec0ff408159dfc2444ad0f023 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:52:32 +0000 Subject: [PATCH 204/758] decomp: clarify names in draw_elevator_rotating_rings D_L16_00161ED0 -> l16_elevator_ring_blend_color_b_selector: Source defines this int as 2 and ORs it shifted by 2 into packet.mode. Retail 0x002e85dc loads it from gp-0x4d30; 0x002e85fc shifts by 2, 0x002e8604 ORs it into the word stored at sp+0x88 by 0x002e8638. Checked draw_geometry_quad helper evidence 3e97773c90ed42c1827112c9953b8a0f loads packet+0x88 at 0x001fbea0 and emits it with GS ALPHA register ID 0x42 at 0x001fbea4-0x001fbebc. Bits 2-3 select color B, matching the established neighboring A and alpha selector names. D_L16_00161ED8 -> l16_elevator_ring_blend_color_d_selector: Source defines this int as 1 and ORs it shifted by 6 into packet.mode. Retail 0x002e8600 loads gp-0x4d28; 0x002e8614 shifts by 6, 0x002e8618 ORs it into the word stored at sp+0x88 by 0x002e8638. Checked helper evidence 3e97773c90ed42c1827112c9953b8a0f proves packet+0x88 is emitted as GS ALPHA register 0x42 at 0x001fbea0-0x001fbebc. Bits 6-7 are its color D selector, completing the established neighboring blend-selector naming. D_L16_00161EDC -> l16_elevator_ring_tint_start_color: Source initializes this int to 0x408000 and passes it as the first packed color to fast_tween_color. Retail 0x002e8578 loads gp-0x4d24 into a0 before 0x002e8584 calls 0x001feb00. Checked helper evidence 43ea65538da94d0087c469f3e7d140db: 0x001feb00-0x001feb1c unpacks a0/a1 to vf2/vf3; 0x001feb20 computes 1-t and 0x001feb2c-0x001feb30 computes a0*(1-t)+a1*t. Thus this is the start endpoint. The packed result is retained in s5 at 0x002e8594 and copied to all four ring vertex colors at 0x002e8840-0x002e8850. D_L16_00161EE0 -> l16_elevator_ring_tint_end_color: Source initializes this int to 0x40c08030 and passes it as the second packed color to fast_tween_color. Retail 0x002e8580 loads gp-0x4d20 into a1 before the call at 0x002e8584. Checked helper evidence 43ea65538da94d0087c469f3e7d140db shows a1 unpacked into vf3 at 0x001feb0c-0x001feb1c and multiplied by t at 0x001feb30, added to a0*(1-t) from 0x001feb2c. It is therefore the end tint endpoint. The result is copied into all four ring vertex colors at 0x002e8840-0x002e8850 before draw_geometry_quad. --- src/overlays/l16/mobys/elevator.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l16/mobys/elevator.c b/src/overlays/l16/mobys/elevator.c index ed02c231ec..dcd511c09c 100644 --- a/src/overlays/l16/mobys/elevator.c +++ b/src/overlays/l16/mobys/elevator.c @@ -251,11 +251,11 @@ extern float elevator_ring_outer_radius_gp __asm__("D_L16_00161EC4") __attribute extern float elevator_ring_half_height_gp __asm__("D_L16_00161EC8") __attribute__((sda)); extern float elevator_ring_segment_angle_degrees_gp __asm__("D_L16_00161EE8") __attribute__((sda)); int l16_elevator_ring_blend_color_a_selector __asm__("D_L16_00161ECC") = 0; -int D_L16_00161ED0 = 2; +int l16_elevator_ring_blend_color_b_selector __asm__("D_L16_00161ED0") = 2; int l16_elevator_ring_blend_alpha_selector __asm__("D_L16_00161ED4") = 0; -int D_L16_00161ED8 = 1; -int D_L16_00161EDC = 0x408000; -int D_L16_00161EE0 = 0x40c08030; +int l16_elevator_ring_blend_color_d_selector __asm__("D_L16_00161ED8") = 1; +int l16_elevator_ring_tint_start_color __asm__("D_L16_00161EDC") = 0x408000; +int l16_elevator_ring_tint_end_color __asm__("D_L16_00161EE0") = 0x40c08030; extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern void draw_geometry_quad(void *, void *, int); @@ -279,8 +279,8 @@ void draw_elevator_rotating_rings(struct Moby *elevator_moby) { int i, j, sign, period; lower = lower - half; lower += translation; - color = fast_tween_color(D_L16_00161EDC, - D_L16_00161EE0, + color = fast_tween_color(l16_elevator_ring_tint_start_color, + l16_elevator_ring_tint_end_color, absolute_float((*(float *)((char *)elevator_data + 0xB0))) / (D_L16_00161EB8_gp * frame_time)); copy_matrix_rotation(&matrix, &elevator_moby->rot_row0); @@ -289,8 +289,8 @@ void draw_elevator_rotating_rings(struct Moby *elevator_moby) { matrix.position[3] = 1.0f; packet.texture = get_effect_texture(14); packet.flags = 0xFF9000000260L; - packet.mode = (long)l16_elevator_ring_blend_color_a_selector | ((long)D_L16_00161ED0 << 2) | ((long)l16_elevator_ring_blend_alpha_selector << 4) | - ((long)D_L16_00161ED8 << 6) | 0x8000000000L; + packet.mode = (long)l16_elevator_ring_blend_color_a_selector | ((long)l16_elevator_ring_blend_color_b_selector << 2) | ((long)l16_elevator_ring_blend_alpha_selector << 4) | + ((long)l16_elevator_ring_blend_color_d_selector << 6) | 0x8000000000L; packet.zero = 0; uv = elevator_ring_quad_uvs; point = packet.position; From be0785a6cb42fc717603ebf169b6dadf3b1b04a4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:54:47 +0000 Subject: [PATCH 205/758] decomp: clarify names in draw_point_table_quads D_L13_00161E8C -> l13_point_table_quad_blend_color_b_selector: Source s32 initialized to 2 feeds regs shifted by 2. Retail 0x00309938 loads gp-0x4D74, 0x00309944 shifts by 2 and 0x0030994C ORs it into the packet word stored at sp+0x88/0x118. The supplied checked draw-helper evidence maps packet+0x88 to GS ALPHA_1 (0x42); bits 2-3 select color B in (A-B)*C+D. D_L13_00161E94 -> l13_point_table_quad_blend_color_d_selector: Source s32 initialized to 1 feeds regs shifted by 6. Retail 0x00309950 loads gp-0x4D6C, 0x00309960 shifts by 6 and 0x00309968 ORs it into the packet word stored at sp+0x88/0x118. Supplied checked draw-helper evidence identifies GS ALPHA_1 (0x42); bits 6-7 select the additive color D in (A-B)*C+D. D_L13_00161E98 -> l13_point_table_quad_blend_fixed_alpha: Source s32 initialized to 0x80 is shifted into regs bits 32 upward. Retail 0x00309958 loads gp-0x4D68, 0x00309964 dsll32 shifts it by 32, and 0x0030996C packs it into both quad packets. Supplied checked draw-helper evidence maps this packet word to GS ALPHA_1 (0x42), whose FIX field at bits 32-39 is the fixed alpha coefficient. D_L13_00161E9C -> l13_point_table_quad_effect_texture_index: Source s32 initialized to 0xB is passed to get_effect_texture for both QuadPacket tag[1] fields. Retail 0x00309920 and 0x0030992C load gp-0x4D64 into a0 for the texture helper calls at 0x00309924/0x00309930; returned v0 values are stored at packet texture words sp+0x78 and sp+0x108. D_L13_00161EA0 -> l13_point_table_quad_even_corner_color_start: Source initialized packed color 0x40FF is the first color argument to fast_tween_color on even j. Retail 0x00309A5C/0x00309A60 tests corner parity; the even arm loads gp-0x4D60 into a0 at 0x00309ABC. Checked helper 0x0020BD80..0x0020BDC8 unpacks a0/a1, forms 1-t at 0x0020BDA0, multiplies a0 by 1-t at 0x0020BDAC and adds a1*t at 0x0020BDB0, proving a0 is the start color. D_L13_00161EA4 -> l13_point_table_quad_even_corner_color_end: Source initialized packed color 0x600040FF is the second color argument to fast_tween_color on even j. Retail 0x00309ABC/0x00309AC4 loads the even pair, with gp-0x4D5C in a1. Checked helper 0x0020BD80..0x0020BDC8 unpacks a1 into vf3, computes a0*(1-t) then adds vf3*t at 0x0020BDB0, establishing this as the even corner end color. D_L13_00161EA8 -> l13_point_table_quad_inset_corner_color_start: Source initialized packed color 0xCCCC is first color argument on odd j, whose position is inset by a length-0.5 vector at 0x00309A68..0x00309A98. Retail 0x00309AA8 loads gp-0x4D58 into a0 before color call 0x00309AC8. Checked helper 0x0020BDA0..0x0020BDB0 computes a0*(1-t)+a1*t, proving this is the inset corner start color. D_L13_00161EAC -> l13_point_table_quad_inset_corner_color_end: Source initialized packed color 0x6000CCCC is second color argument on odd j after the proven corner inset operations at 0x00309A68..0x00309A98. Retail 0x00309AAC loads gp-0x4D54 into a1 before 0x00309AC8. Checked helper unpacks a1 to vf3 at 0x0020BD8C..0x0020BD9C and adds vf3*t at 0x0020BDB0, establishing the inset corner end color. --- src/overlays/l13/mobys/blarg_space_commando.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/overlays/l13/mobys/blarg_space_commando.c b/src/overlays/l13/mobys/blarg_space_commando.c index e85b68f796..aff2594831 100644 --- a/src/overlays/l13/mobys/blarg_space_commando.c +++ b/src/overlays/l13/mobys/blarg_space_commando.c @@ -955,15 +955,15 @@ typedef struct { } QuadPacket; s32 l13_point_table_quad_blend_color_a_selector __asm__("D_L13_00161E88") = 0; -s32 D_L13_00161E8C = 2; +s32 l13_point_table_quad_blend_color_b_selector __asm__("D_L13_00161E8C") = 2; s32 l13_point_table_quad_blend_alpha_selector __asm__("D_L13_00161E90") = 0; -s32 D_L13_00161E94 = 1; -s32 D_L13_00161E98 = 0x80; -s32 D_L13_00161E9C = 0xb; -s32 D_L13_00161EA0 = 0x40ff; -s32 D_L13_00161EA4 = 0x600040ff; -s32 D_L13_00161EA8 = 0xcccc; -s32 D_L13_00161EAC = 0x6000cccc; +s32 l13_point_table_quad_blend_color_d_selector __asm__("D_L13_00161E94") = 1; +s32 l13_point_table_quad_blend_fixed_alpha __asm__("D_L13_00161E98") = 0x80; +s32 l13_point_table_quad_effect_texture_index __asm__("D_L13_00161E9C") = 0xb; +s32 l13_point_table_quad_even_corner_color_start __asm__("D_L13_00161EA0") = 0x40ff; +s32 l13_point_table_quad_even_corner_color_end __asm__("D_L13_00161EA4") = 0x600040ff; +s32 l13_point_table_quad_inset_corner_color_start __asm__("D_L13_00161EA8") = 0xcccc; +s32 l13_point_table_quad_inset_corner_color_end __asm__("D_L13_00161EAC") = 0x6000cccc; /* Scrolling texture coordinates of the four corners. */ f32 D_L13_001D9B70[4][2] = { @@ -994,13 +994,13 @@ void draw_point_table_quads(struct Moby *moby) { vu1_add_g_sregister(0x47, 0x5380B); i = 0; - pk[0].tag[1] = get_effect_texture(D_L13_00161E9C); - pk[1].tag[1] = get_effect_texture(D_L13_00161E9C); + pk[0].tag[1] = get_effect_texture(l13_point_table_quad_effect_texture_index); + pk[1].tag[1] = get_effect_texture(l13_point_table_quad_effect_texture_index); regs = l13_point_table_quad_blend_color_a_selector; - regs |= (u64)D_L13_00161E8C << 2; + regs |= (u64)l13_point_table_quad_blend_color_b_selector << 2; regs |= (u64)l13_point_table_quad_blend_alpha_selector << 4; - regs |= (u64)D_L13_00161E94 << 6; - regs |= (u64)D_L13_00161E98 << 32; + regs |= (u64)l13_point_table_quad_blend_color_d_selector << 6; + regs |= (u64)l13_point_table_quad_blend_fixed_alpha << 32; /* Store order is load-bearing: it sets which register keeps regs. */ pk[1].tag[2] = 0x0000FF9000000260ULL; pk[0].tag[2] = 0x0000FF9000000260ULL; @@ -1026,13 +1026,13 @@ void draw_point_table_quads(struct Moby *moby) { corner_position[2] -= 0.125f; pk[0].col[j] = fast_tween_color(*(f32 *)(point_table_pvars + source_point_byte_offset + 0x21C), - D_L13_00161EA8, - D_L13_00161EAC); + l13_point_table_quad_inset_corner_color_start, + l13_point_table_quad_inset_corner_color_end); } else { pk[0].col[j] = fast_tween_color(*(f32 *)(point_table_pvars + source_point_byte_offset + 0x21C), - D_L13_00161EA0, - D_L13_00161EA4); + l13_point_table_quad_even_corner_color_start, + l13_point_table_quad_even_corner_color_end); } pk[0].uv[j][0] = D_L13_001D9B70[j][0]; pk[0].uv[j][1] = D_L13_001D9B70[j][1]; From 1fee6dec731d0e420ee8f2b48d2c064f09b9faab Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:55:00 +0000 Subject: [PATCH 206/758] decomp: clarify names in update_player_ship_flight D_L11_00161FF0 -> l11_jet_fighter_startup_acceleration_frame_threshold: Authoritative C defines this int as 120. Retail 0x003128f4..0x00312904 loads signed ship_vars+0x68 and gp-0x4c10 (D_L11_00161FF0), branching to startup while count <= threshold. At 0x00312a40..0x00312a5c that branch increments the count once and adds the startup speed increment to speed +0x64; above the threshold, boost/cruise speed control runs instead. Supplied jet_fighter_update zeros count when boarding completes and invokes flight once per update. Thus it is the startup acceleration frame-count threshold; strict greater-than semantics are preserved. D_L11_00162004 -> l11_jet_fighter_steering_enable_frame_threshold: Authoritative C defines this int as 5. Retail 0x00312a60..0x00312a6c compares signed ship_vars+0x68 against gp-0x4bfc (D_L11_00162004), skipping to movement at 0x00312bb4 unless count > threshold. The guarded block reads hero stick inputs, calls bounded steering at 0x00312adc, updates horizontal/vertical springs and flight angles through 0x00312bb0. The supplied caller resets count to zero on boarding and the startup branch increments it once per flight update. This proves the frame-count threshold enabling steering, without claiming an exact elapsed-time duration. D_L11_0016214C -> l11_jet_fighter_collision_damage_cooldown_frames: Authoritative C defines this int as 10. Retail 0x003130b0/0x003130bc tests ship_vars+0xdc and bypasses collision damage when nonzero. When zero, 0x003130c8..0x003130e8 subtracts collision damage from hero.ship_hp; 0x003131c4..0x003131c8 loads gp-0x4ab4 (D_L11_0016214C) into +0xdc after the damage/death branch. Supplied jet_fighter_update calls fast_dec_timer(&ship_vars->iDC) each update before invoking flight. This establishes the collision-damage cooldown reset in timer frames, including fatal damage. --- src/overlays/l11/mobys/jet_fighter.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l11/mobys/jet_fighter.c b/src/overlays/l11/mobys/jet_fighter.c index da769fa941..9f86cb6edc 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -753,9 +753,9 @@ typedef struct { extern unsigned short D_00141C10 NOT_SDA; extern float D_L11_0016D4F0 NOT_SDA; extern char jet_fighter_collision_query_result[] __asm__("D_L11_00174840"); -int D_L11_00161FF0 = 120; -int D_L11_00162004 = 5; -int D_L11_0016214C = 10; +int l11_jet_fighter_startup_acceleration_frame_threshold __asm__("D_L11_00161FF0") = 120; +int l11_jet_fighter_steering_enable_frame_threshold __asm__("D_L11_00162004") = 5; +int l11_jet_fighter_collision_damage_cooldown_frames __asm__("D_L11_0016214C") = 10; #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_15.h" @@ -915,7 +915,7 @@ void update_player_ship_flight(struct Moby *ship_moby, ShipVars_2838 *ship_vars) ship_vars->sel = 0; } } - if (D_L11_00161FF0 < ship_vars->count) { + if (l11_jet_fighter_startup_acceleration_frame_threshold < ship_vars->count) { pad = &controller_state; if (pad->raw_held & 0x40) { float accelerated_speed; @@ -954,7 +954,7 @@ void update_player_ship_flight(struct Moby *ship_moby, ShipVars_2838 *ship_vars) ship_vars->count += 1; } - if (D_L11_00162004 < ship_vars->count) { + if (l11_jet_fighter_steering_enable_frame_threshold < ship_vars->count) { hero_input_source = &hero; x = hero_input_source->stick_x; y = hero_input_source->stick_y; @@ -1183,7 +1183,7 @@ void update_player_ship_flight(struct Moby *ship_moby, ShipVars_2838 *ship_vars) 0); ship_moby->state = JET_FIGHTER_STATE_WAIT_FOR_RESPAWN; } - ship_vars->iDC = D_L11_0016214C; + ship_vars->iDC = l11_jet_fighter_collision_damage_cooldown_frames; } } } From 0cd06745d00deb7a2f9ba217fb33bb915d2764ea Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:55:11 +0000 Subject: [PATCH 207/758] decomp: clarify names in emit_height_adjusted_burst_spark_particle D_L10_0016204C -> l10_height_adjusted_spark_lookup_index_and_flags: Authoritative C defines int D_L10_0016204C = 24 and supplies it as spawn_spark argument nine. Assigned retail 0x002eac54 loads gp-0x4bb4, and 0x002eac74 stores it at caller sp+0. Checked level-10 helper 0x0025bef4 loads that argument into s1. For non--1 values, 0x0025bf70 masks s1 with 0xffff, 0x0025bf78-84 indexes pointer table 0x001b2500 by four bytes, and 0x0025bf8c/94 copies the selected pointed byte into particle+2. At 0x0025bf80/88 bit 0x10000 is tested; when set, 0x0025bf98/9c changes particle+3 from 0x44 to 0x48. Thus the word contains a spark lookup index and a flag; initializer 24 selects entry 24 with the flag clear. Name qualifies level-10 ownership without guessing table semantics. --- src/overlays/l10/mobys/configurable_particle_emitter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l10/mobys/configurable_particle_emitter.c b/src/overlays/l10/mobys/configurable_particle_emitter.c index 86580eb24b..a7f5b79f50 100644 --- a/src/overlays/l10/mobys/configurable_particle_emitter.c +++ b/src/overlays/l10/mobys/configurable_particle_emitter.c @@ -336,7 +336,7 @@ extern short height_adjusted_spark_pause_duration_max_gp __asm__("D_L10_00162048 __attribute__((sda)); extern short height_adjusted_spark_pause_duration_min_gp __asm__("D_L10_00162044") __attribute__((sda)); -int D_L10_0016204C = 24; +int l10_height_adjusted_spark_lookup_index_and_flags __asm__("D_L10_0016204C") = 24; extern short height_adjusted_spark_height_derived_frame_count_scale_gp __asm__("D_L10_00162050") __attribute__((sda)); @@ -409,7 +409,7 @@ void emit_height_adjusted_burst_spark_particle(void *emission_position, frame_count, second_frame_count, third_frame_count, - D_L10_0016204C); + l10_height_adjusted_spark_lookup_index_and_flags); *timer = 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 007e15b81611dfe14f671cf4ea4486381fea56ba Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:58:04 +0000 Subject: [PATCH 208/758] decomp: clarify names in process_hero_equipped_item_input rec -> wrench_attack_record: In ITEM_WRENCH with control mode 6, source HeroTableRow2C *rec indexes attack_records by hero+0xA60 (the supplied Hero attack_record field). Retail 0x00228364-0x00228384 multiplies that index by 0x2C and adds table 0x0017BC28 into s1. Loads of s1+0x10 at 0x002283AC and 0x00228408 gate hero animation frame +0xAA8; s1+0xC at 0x0022842C is subtracted from its truncated frame to construct the pad-history window. Original Ghidra iVar3 indexes DAT_0017BC38/34 with the same 0x2C stride. This is the active wrench attack record used for combo timing. --- 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 d0175c98bb..c6b47e8888 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3424,7 +3424,7 @@ int process_hero_equipped_item_input(void) { } } if (D_0013F450_h228770.f208C == 6) { - HeroTableRow2C *rec = &attack_records[D_0013F450_h228770.fA60]; + HeroTableRow2C *wrench_attack_record = &attack_records[D_0013F450_h228770.fA60]; int t; if (D_0013F450_h228770.f2084 == 0x15) { @@ -3432,7 +3432,7 @@ int process_hero_equipped_item_input(void) { if (D_0013F450_h228770.fA9C != 0) { break; } - if (D_0013F450_h228770.fAA8 >= (float)rec->f10 && + if (D_0013F450_h228770.fAA8 >= (float)wrench_attack_record->f10 && (controller_state.held & 0xA) && pad_pressed_within(mask, scale_game_frames(0xF), 0)) { hero_set_state(0x15, 1); @@ -3443,10 +3443,10 @@ int process_hero_equipped_item_input(void) { if (D_0013F450_h228770.fA9C != 0) { break; } - if (!(D_0013F450_h228770.fAA8 >= (float)rec->f10)) { + if (!(D_0013F450_h228770.fAA8 >= (float)wrench_attack_record->f10)) { break; } - t = (truncate_float_to_s32(D_0013F450_h228770.fAA8) - rec->fC) * 2; + t = (truncate_float_to_s32(D_0013F450_h228770.fAA8) - wrench_attack_record->fC) * 2; if (t <= 0) { t = 1; } From ac8c48287ccf0006d70b6f72bb565612445a84d6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:58:04 +0000 Subject: [PATCH 209/758] decomp: clarify names in bomb_update rec -> camera_blast_parameters: Authoritative source initializes B910 rec from l00_bomb_camera_blast_parameters and passes &rec to mine_camera_blast. Retail 0x002adb48 and 0x002adb94-0x002adbd0 copy the 80-byte record at 0x001e98d0 into sp+0x10; 0x002af250-0x002af260 passes that local address in a0 with bomb position in a1 to mine_camera_blast (checked retail call 0x002d3838). Original Ghidra auStack_280[20] and FUN_002d3838(auStack_280,puVar23,0,0) corroborate the local parameter record role. --- src/overlays/shared/weapons/bomb_glove_bomb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/bomb_glove_bomb.c b/src/overlays/shared/weapons/bomb_glove_bomb.c index 8ac31db1da..e643f03fe7 100644 --- a/src/overlays/shared/weapons/bomb_glove_bomb.c +++ b/src/overlays/shared/weapons/bomb_glove_bomb.c @@ -1108,7 +1108,7 @@ void bomb_update(BombMoby *bomb_moby) { BOMB_STATE_THROWN = 1, BOMB_STATE_EXPANDING_BLAST = 2 }; - B910 rec = l00_bomb_camera_blast_parameters; + B910 camera_blast_parameters = l00_bomb_camera_blast_parameters; Vec_2adb30 delta; Vec_2adb30 bomb_pre_motion_position; Vec_2adb30 blast_velocity; @@ -1639,7 +1639,7 @@ void bomb_update(BombMoby *bomb_moby) { : 0.4f - 20.0f * 0.0175f; l00_camera.shake_frames = FUN_001f96f8_2adb30(0x19); fast_vec_dist(&bomb_moby->pos, ((G910 *)&hero)->pos); - mine_camera_blast((char *)&rec, (char *)&bomb_moby->pos, 0, 0); + mine_camera_blast((char *)&camera_blast_parameters, (char *)&bomb_moby->pos, 0, 0); if (bomb_moby->state != BOMB_STATE_EXPANDING_BLAST) { mark_moby_for_removal(bomb_moby); return; From bec37ca6f2d818c6f1ccee56ba073f0ddefe0d49 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 04:58:05 +0000 Subject: [PATCH 210/758] decomp: clarify names in process_hero_primary_item_input rec -> wrench_attack_timing_record: Within ITEM_WRENCH, source selects HeroTableRow2C rec = &D_L05_0017C088[hero.attack_record]. Retail 0x251fb8 loads hero+0xa60, 0x251fc8 multiplies by row stride 0x2c, and 0x251fd8 forms s1 from table base 0x17c088. Loads of row+0x10 at 0x252000 and 0x25205c gate hero anim_frame; row+0xc at 0x252080 is subtracted from truncated anim_frame and doubled at 0x252088-0x25208c to form the capped buffered wrench follow-up input window used at 0x2520c8. Original Ghidra independently shows the indexed table timing loads at 0x17c098 and 0x17c094. --- .../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 415e865cad..cc37a8b358 100644 --- a/src/overlays/shared/hero/process_hero_primary_item_input.c +++ b/src/overlays/shared/hero/process_hero_primary_item_input.c @@ -793,7 +793,7 @@ int process_hero_primary_item_input(void) { } } if ((*(Hero *)((char *)&hero)).state.control_mode == 6) { - HeroTableRow2C *rec = &D_L05_0017C088[(*(Hero *)((char *)&hero)).attack_record]; + HeroTableRow2C *wrench_attack_timing_record = &D_L05_0017C088[(*(Hero *)((char *)&hero)).attack_record]; int window; if ((*(Hero *)((char *)&hero)).state.current == 0x15) { @@ -801,7 +801,7 @@ int process_hero_primary_item_input(void) { if ((*(Hero *)((char *)&hero)).anim_changing != 0) { break; } - if ((*(Hero *)((char *)&hero)).anim_frame >= (float)rec->f10 && + if ((*(Hero *)((char *)&hero)).anim_frame >= (float)wrench_attack_timing_record->f10 && (controller_state.held & 0xA) && pad_pressed_within(mask, scale_game_frames(0xF), 0)) { hero_set_state(0x15, 1); @@ -812,10 +812,10 @@ int process_hero_primary_item_input(void) { if ((*(Hero *)((char *)&hero)).anim_changing != 0) { break; } - if (!((*(Hero *)((char *)&hero)).anim_frame >= (float)rec->f10)) { + if (!((*(Hero *)((char *)&hero)).anim_frame >= (float)wrench_attack_timing_record->f10)) { break; } - window = (truncate_float_to_s32((*(Hero *)((char *)&hero)).anim_frame) - rec->fC) * 2; + window = (truncate_float_to_s32((*(Hero *)((char *)&hero)).anim_frame) - wrench_attack_timing_record->fC) * 2; if (window <= 0) { window = 1; } From 250ed68f99d31a971a68af4447b5d2ad4e395d36 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:00:41 +0000 Subject: [PATCH 211/758] decomp: clarify names in hoven_anklebiter_update D_L12_001618E8 -> l12_anklebiter_tuning_preset: The bound source defines the int preset as 0x0a030303 and assigns its address to data->tuning in ANKLEBITER_INITIALIZE. Original retail 002e1e88 forms gp-0x5318 and 002e1e90 stores that address at s2+0xd0, with s2 loaded from moby+0x78 at 002e1c14. The original decompilation likewise installs &gp0xfffface8 at private data+0xd0. This proves the anklebiter initialization tuning preset role, without claiming meanings for its packed bytes. Level qualifier preserves overlay ownership. --- src/overlays/l12/mobys/hoven_anklebiter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l12/mobys/hoven_anklebiter.c b/src/overlays/l12/mobys/hoven_anklebiter.c index e71dcdd2af..c2e93c41f6 100644 --- a/src/overlays/l12/mobys/hoven_anklebiter.c +++ b/src/overlays/l12/mobys/hoven_anklebiter.c @@ -253,7 +253,7 @@ void spawn_spark_scatter(void *spark_scatter_origin) { #include "rnc/math/vector.h" extern unsigned char D_0013F3D0_r[] __asm__("D_0013F3D0"); -int D_L12_001618E8 = 0xa030303; +int l12_anklebiter_tuning_preset __asm__("D_L12_001618E8") = 0xa030303; extern float D_0015ED64; extern float D_0015ED6C; extern float D_0015ED70; @@ -363,7 +363,7 @@ void hoven_anklebiter_update(AnklebiterMoby *moby) { moby->pos[2] = probe_ground_height(target_report_or_vector_scratch.v0, 0, 0.5f); if (rand() & 1) moby->flags |= 0x8000; - data->tuning = &D_L12_001618E8; + data->tuning = &l12_anklebiter_tuning_preset; } break; case ANKLEBITER_IDLE: { From 3197c04ecb68e5cfb65d451657baeb30bd22a41f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:00:54 +0000 Subject: [PATCH 212/758] decomp: clarify names in qwarks_starfighter_update D_L13_00161954 -> l13_starfighter_boss_start_counter: Authoritative C declares this int with sentinel -1. In WAIT_FOR_HERO_SHIP, retail 0x002eb410-0x002eb438 loads gp-0x52AC, tests -1, and stores the current D_0015EEA4 counter only on the initial encounter. At 0x002eb444-0x002eb458 the same captured counter is printed through qwarks_starfighter_boss_start_time_format; supplied original Ghidra identifies it as iGpffffad54. Retail 0x002eb45c-0x002eb480 subtracts that saved counter from the current counter and divides by 360 before the elapsed-time adjustment thresholds, proving a saved boss-start counter. The l13 qualifier preserves overlay ownership; no time unit is inferred. --- 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 e2a9617c10..55c32d24a3 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -1563,7 +1563,7 @@ extern int D_0015EEA4; int l13_starfighter_owner_unavailable_voice_line_index __asm__("D_L13_00161950") = 0; -int D_L13_00161954 = -1; +int l13_starfighter_boss_start_counter __asm__("D_L13_00161954") = -1; extern int qwarks_starfighter_command_path_slots[] __asm__("D_L13_001D3448"); @@ -1709,14 +1709,14 @@ void qwarks_starfighter_update(Moby388 *moby) { if (*(Moby388 **)(hero + 0x15F0) != 0) { char *ship = (char *)(*(Moby388 **)(hero + 0x15F0))->d; int elapsed; - if (D_L13_00161954 == -1) { - D_L13_00161954 = D_0015EEA4; + if (l13_starfighter_boss_start_counter == -1) { + l13_starfighter_boss_start_counter = D_0015EEA4; DebugPrint_alt(qwarks_starfighter_boss_start_time_format, D_0015EEA4, D_0015EEA4 / 60, D_0015EEA4 / 360); } - elapsed = (unsigned int)(D_0015EEA4 - D_L13_00161954) / 360; + elapsed = (unsigned int)(D_0015EEA4 - l13_starfighter_boss_start_counter) / 360; if (elapsed >= 0x29) { DebugPrint_alt(qwarks_starfighter_high_elapsed_time_adjustment_message); starfighter_vars->s24 = 0x66; From bc793eff534a2165c4d3b3e5e4a3cdb03ef2620e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:01:05 +0000 Subject: [PATCH 213/758] decomp: clarify names in select_fighter_jet_target_and_draw_contacts D_L17_00162188 -> l17_fighter_jet_offscreen_arrow_vertices: Authoritative C passes &D_L17_00162188 to emit_transformed_2d_vertex_packet with point count 3 in the final nearest-target direction-arrow block. Retail 0x002eb4f0-0x002eb500 requires no visible class-0x15B member and a retained nearest member; 0x002eb538-0x002eb5c0 derives its arrow direction and angle. At 0x002eb708 a0=gp-0x4a78 (original Ghidra &gp0xffffb588, bound by exact C to this global), 0x002eb70c sets a1=3, and 0x002eb714 calls 0x002e9e48. Checked helper evidence request 354867528b714bbbbefce48984ff3802 shows a0 saved to s2 at 0x002e9eb0, signed short XY loads at 0x002e9fb0/0x002e9fc4, four-byte input advance at 0x002e9fd0, count-controlled iteration at 0x002ea058, rotation/scale at 0x002e9fe8/0x002e9ff8 and screen vertex output at 0x002ea054. Thus this binding anchors offscreen-arrow vertex coordinates; preserve its exact short declaration, initializer 2 and assembler identity. --- src/overlays/l17/mobys/fighter_jet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l17/mobys/fighter_jet.c b/src/overlays/l17/mobys/fighter_jet.c index e83ba05618..19e3e0957e 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -214,7 +214,7 @@ extern void emit_transformed_2d_vertex_packet( void draw_fighter_jet_radar_contact_icon( char *rot, char *from, char *moby, int icon, long color, int tex) __asm__("FUN_L17_002eaae0"); -short D_L17_00162188 = 2; +short l17_fighter_jet_offscreen_arrow_vertices __asm__("D_L17_00162188") = 2; int select_fighter_jet_target_and_draw_contacts(int ship_moby, char *ship_vars, char *radar_origin, @@ -544,7 +544,7 @@ int select_fighter_jet_target_and_draw_contacts(int ship_moby, 0.1f / (angular_error_magnitude / 3.1415927f)); *(float *)(ship_vars + 0x114) = arrow_pulse_phase; emit_transformed_2d_vertex_packet( - &D_L17_00162188, + &l17_fighter_jet_offscreen_arrow_vertices, 3, 0xFFFFF3, (truncate_float_to_s32((fast_sin(arrow_pulse_phase) + 1.4f) * 53.0f) << 24) | 0x8000, From 775c34f8042dc6315ddaf6096a3d6679a7e8640f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:03:22 +0000 Subject: [PATCH 214/758] decomp: clarify names in sand_shark_update D_L02_001619E4 -> l02_sand_shark_ballistic_particle_initial_color: Retail 0x002d534c loads this word into a2 for particle emitter 0x0026afd0 at 0x002d5368 in established BALLISTIC_FLIGHT_WITH_PARTICLES state. Checked helper request 6b3615b6b5df4c15851441d802d458fd (report 5165c0cea84a42dba65dcedfa8806dba6bc0c63e54eca06a260d2e1fe31a1d18) preserves a2 in s5 at 0x0026affc, stores it at particle header +4 at 0x0026b038 and retains it at extension +0x10 at 0x0026b0a4. Bound C identifies neighboring particle emitter arguments as initial/secondary colors; this packed 0x40306058 word initializes the active header color and its saved initial color. This is its own assembler binding, distinct from single-particle and radial-particle color globals. D_L02_001619E8 -> l02_sand_shark_ballistic_particle_secondary_color: Retail 0x002d5354 loads this word into a3 for particle emitter 0x0026afd0 at 0x002d5368 in established BALLISTIC_FLIGHT_WITH_PARTICLES state. Checked helper request 6b3615b6b5df4c15851441d802d458fd (report 5165c0cea84a42dba65dcedfa8806dba6bc0c63e54eca06a260d2e1fe31a1d18) saves a3 at 0x0026b020, reloads at 0x0026b0a8 and writes extension +0x14 at 0x0026b0b0, paired with initial color at extension +0x10 and header +4. Bound C's related particle emitters establish initial/secondary packed color arguments; this 0x00306058 word is the secondary color paired with the active 0x40306058 initial color, without claiming transition timing. --- src/overlays/l02/mobys/sand_shark.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index b0e75fce10..409d5889af 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -285,8 +285,8 @@ unsigned char D_L02_00161900 = 0xa; #include "rnc/overlay/l02/mobys/sand_shark_data/sand_shark_update.h" int D_L02_001619B0 = 0xa000000; -int D_L02_001619E4 = 0x40306058; -int D_L02_001619E8 = 0x306058; +int l02_sand_shark_ballistic_particle_initial_color __asm__("D_L02_001619E4") = 0x40306058; +int l02_sand_shark_ballistic_particle_secondary_color __asm__("D_L02_001619E8") = 0x306058; /* Aridia burrowing enemy: profiled with EE timer 0 around its state machine. */ void sand_shark_update(struct Moby *moby) __asm__("FUN_L02_002d3e50"); @@ -852,8 +852,8 @@ void sand_shark_update(struct Moby *moby) { life = scale_game_frames(random_int_between(0x14, 0x28)); spawn_effect(&moby->pos, &target_or_particle_vector, - D_L02_001619E4, - D_L02_001619E8, + l02_sand_shark_ballistic_particle_initial_color, + l02_sand_shark_ballistic_particle_secondary_color, life, 0x64, random_int_between(0x78, 0x96), From 695de5f52a619b838380ad4e83259b7385bad1f2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:03:23 +0000 Subject: [PATCH 215/758] decomp: clarify names in update_hero_motion_for_current_state sub -> initial_state_step: Source initializes this s32 once from hero.state.step before dispatch and compares it with hero.state.step at the tail to reset hero.step_frames. Retail 0x0022e07c loads hero+0x2088 and 0x0022e080 saves it at sp+0x118; 0x002345ac-0x002345b8 reloads that saved value, compares the current +0x2088 field and clears +0x1A0 on a change. Original retail Ghidra iStack_d8 = iRam001413d8 and the tail inequality corroborate the entry-snapshot role. --- src/overlays/l06/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 b5b127382b..2aae0a3505 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 @@ -1016,7 +1016,7 @@ void update_hero_motion_for_current_state(void) __asm__("FUN_L06_0022e020"); void update_hero_motion_for_current_state(void) { struct MobyView *moby = (struct MobyView *)hero.moby; - s32 sub = hero.state.step; + s32 initial_state_step = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 vector_or_hit_descriptor_scratch; @@ -3257,7 +3257,7 @@ void update_hero_motion_for_current_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (initial_state_step != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From be25a156ad2af3fba776e63c59d0768ff06d9bde Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:03:23 +0000 Subject: [PATCH 216/758] decomp: clarify names in update_hero_motion_by_state sub -> state_step_before_update: Authoritative C initializes sub from hero.state.step before the state switch, then compares it with hero.state.step at exit and clears hero.step_frames on change. Retail 0x00228d2c loads hero+0x2088 and 0x00228d30 saves it at sp+0x114; 0x0022ee94-0x0022eea0 reloads that saved value, compares against the current +0x2088 word, and clears +0x1A0 when unequal. Original Ghidra uses iStack_dc = iRam001413d8 and the same exit comparison, proving this is the state step before update. --- src/overlays/l14/hero/update_hero_motion_by_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 c98182accf..ed2b8070de 100644 --- a/src/overlays/l14/hero/update_hero_motion_by_state.c +++ b/src/overlays/l14/hero/update_hero_motion_by_state.c @@ -526,7 +526,7 @@ void update_hero_motion_by_state(void) __asm__("FUN_L14_00228cd0"); void update_hero_motion_by_state(void) { struct MobyView *moby = MV(hero.moby); - s32 sub = hero.state.step; + s32 state_step_before_update = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 vector_and_descriptor_scratch; @@ -2629,7 +2629,7 @@ void update_hero_motion_by_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (state_step_before_update != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From 08b3bdc9a28f72f888dd74513db9067add65c0e1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:03:24 +0000 Subject: [PATCH 217/758] decomp: clarify names in update_hero_motion_by_state sub -> initial_state_step: Authoritative C initializes s32 sub from hero.state.step before dispatch and uses it only in the final comparison that resets hero.step_frames. Retail 0x00246bc4 loads hero+0x2088 and 0x00246bcc saves it at sp+0x104; 0x0024ca94-0x0024caa0 reloads the snapshot, compares the current +0x2088, and clears +0x1A0 on change. Original Ghidra agrees: iStack_dc = iRam001413d8, then the common exit compares them and clears uRam0013f4f0. Thus it is the initial state-step snapshot, not a generic substate working variable. --- src/overlays/l11/hero/update_hero_motion_by_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l11/hero/update_hero_motion_by_state.c b/src/overlays/l11/hero/update_hero_motion_by_state.c index 2530a5ceda..9eb7a8745a 100644 --- a/src/overlays/l11/hero/update_hero_motion_by_state.c +++ b/src/overlays/l11/hero/update_hero_motion_by_state.c @@ -368,7 +368,7 @@ void update_hero_motion_by_state(void) __asm__("FUN_L11_00246b70"); void update_hero_motion_by_state(void) { struct MobyView *moby = MV(hero.moby); - s32 sub = hero.state.step; + s32 initial_state_step = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 vector_and_hit_descriptor_head_scratch; @@ -2388,7 +2388,7 @@ void update_hero_motion_by_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (initial_state_step != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From 4103d46220b396fbdc90dd41736d0859bbfaf96c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:07:14 +0000 Subject: [PATCH 218/758] decomp: clarify names in update_hero_motion_for_current_state sub -> initial_state_step: The authoritative C initializes s32 sub from hero.state.step before dispatch and only reads it after dispatch to detect a changed step and zero hero.step_frames. Retail 0x0020efb4 loads hero+0x2088, and 0x0020efbc saves it at sp+0x108. At 0x0021558c-0x00215598 the saved word is compared with the current hero+0x2088 and inequality stores zero to hero+0x1A0. Original Ghidra confirms iStack_d8 = iRam001413d8 and the final inequality resetting uRam0013f4f0, proving this is the initial state step. --- src/overlays/l03/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l03/hero/update_hero_motion_for_current_state.c b/src/overlays/l03/hero/update_hero_motion_for_current_state.c index 7cea70c686..8ac3e2d2ae 100644 --- a/src/overlays/l03/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l03/hero/update_hero_motion_for_current_state.c @@ -316,7 +316,7 @@ void update_hero_motion_for_current_state(void) __asm__("FUN_L03_0020ef60" void update_hero_motion_for_current_state(void) { struct MobyView *moby = MV(hero.moby); - s32 sub = hero.state.step; + s32 initial_state_step = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 spatial_scratch_or_hit_descriptor; @@ -2481,7 +2481,7 @@ void update_hero_motion_for_current_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (initial_state_step != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From 5bd20971e9dee58234c4d2ca6b12048fd3c1bd90 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:09:36 +0000 Subject: [PATCH 219/758] decomp: clarify names in update_hero_motion_by_state sub -> state_step_on_entry: Authoritative C initializes the sole s32 sub from hero.state.step before the switch and uses it only in the final comparison against hero.state.step to reset hero.step_frames. Retail 0x00244ac4 loads hero+0x2088 and 0x00244acc saves it at sp+0x10C; 0x0024bd58-0x0024bd64 reloads this saved entry step, compares it with current hero+0x2088 and clears hero+0x1A0 on change. Original retail Ghidra records iStack_e4=iRam001413d8 and the same epilogue comparison, proving an entry snapshot rather than the current or previous-state step. --- src/overlays/l05/hero/update_hero_motion_by_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l05/hero/update_hero_motion_by_state.c b/src/overlays/l05/hero/update_hero_motion_by_state.c index 2dd2ef043a..9b0828fcca 100644 --- a/src/overlays/l05/hero/update_hero_motion_by_state.c +++ b/src/overlays/l05/hero/update_hero_motion_by_state.c @@ -272,7 +272,7 @@ void update_hero_motion_by_state(void) __asm__("FUN_L05_00244a70"); void update_hero_motion_by_state(void) { struct MobyView *moby = (struct MobyView *)hero.moby; - s32 sub = hero.state.step; + s32 state_step_on_entry = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 vector_and_hit_scratch; @@ -3101,7 +3101,7 @@ void update_hero_motion_by_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (state_step_on_entry != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From 76d39b31ac3a72d6d6ab264c42f631804c45d845 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:09:47 +0000 Subject: [PATCH 220/758] decomp: clarify names in jet_fighter_update D_L11_00162168 -> l11_jet_fighter_exit_delay_frames: The authoritative C defines this int as 180 and copies it into ship_vars->iF8 when sE8 <= 0 before entering JET_FIGHTER_STATE_DELAYED_EXIT. Retail 00313a84 loads gp-0x4a98 (00162168), 00313a8c stores it to pvars+0xF8, and 00313a90 selects state 8. That state's 00313c38-00313c40 decrements/checks this timer and delays the fade-to-one and exit operations at 00313c48-00313d98 until it expires. Original Ghidra case 4/case 8 has the same load/store/countdown data flow, proving an exit delay measured in timer frames. --- 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 9f86cb6edc..e4466e2a84 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -1235,7 +1235,7 @@ unsigned char l11_jet_fighter_max_ammo __asm__("D_L11_00162058") = 0x14; #include "rnc/overlay/l11/mobys/jet_fighter_data/jet_fighter_update.h" extern float D_L11_00162078 __attribute__((sda)); -int D_L11_00162168 = 180; +int l11_jet_fighter_exit_delay_frames __asm__("D_L11_00162168") = 180; extern float D_L11_0016D4F0_a[] __asm__("D_L11_0016D4F0"); extern void print_3290(char *) __asm__("FUN_001e93b0"); extern void FUN_L11_0024db50(int, int); @@ -1462,7 +1462,7 @@ void jet_fighter_update(struct Moby *moby) { } } if (ship_vars->sE8 <= 0) { - ship_vars->iF8 = D_L11_00162168; + ship_vars->iF8 = l11_jet_fighter_exit_delay_frames; moby->state = JET_FIGHTER_STATE_DELAYED_EXIT; } if (hero.ship_flags & 1) { From e4fbb077fa76d348f05b268ae72f4f7bca12d9a1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:09:47 +0000 Subject: [PATCH 221/758] decomp: clarify names in update_hero_motion_for_current_state sub -> state_step_at_entry: C initializes sub from hero.state.step before dispatch and compares it with hero.state.step after all handlers, clearing hero.step_frames on change. Retail 0x0020eda4 loads hero+0x2088, 0x0020edac saves it at sp+0x104, and 0x00215b38-0x00215b44 reloads that snapshot, compares the current +0x2088 and clears +0x1A0. Original Ghidra iStack_dc = iRam001413d8 and the final inequality confirm the entry-step snapshot role. --- src/overlays/l15/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 b598af3ad7..f0ad82f37a 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 @@ -592,7 +592,7 @@ void update_hero_motion_for_current_state(void) { }; struct MobyView *moby = (struct MobyView *)hero.moby; - s32 sub = hero.state.step; + s32 state_step_at_entry = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 spatial_or_hit_descriptor_work; @@ -2954,7 +2954,7 @@ void update_hero_motion_for_current_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (state_step_at_entry != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From 47ffd71d18b8839fead5ddecffcd6ad2ddedc8e1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:09:48 +0000 Subject: [PATCH 222/758] decomp: clarify names in update_hero_motion_for_current_state sub -> saved_state_step: The C initializes sub from hero.state.step and only uses it after the switch to detect a change and clear hero.step_frames. Retail 0x0022853c loads hero+0x2088 and 0x00228540 saves it at sp+0x11c; 0x0022fa74-0x0022fa80 reloads that snapshot, compares it with the current +0x2088 word and clears hero+0x1A0 on inequality. Original Ghidra likewise uses iStack_e4=iRam001413d8 and resets uRam0013f4f0 when they differ, proving a saved state-step value. --- src/overlays/l08/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l08/hero/update_hero_motion_for_current_state.c b/src/overlays/l08/hero/update_hero_motion_for_current_state.c index a7f9a55d76..ac2f58bb1a 100644 --- a/src/overlays/l08/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l08/hero/update_hero_motion_for_current_state.c @@ -385,7 +385,7 @@ void update_hero_motion_for_current_state(void) __asm__("FUN_L08_002284e0"); void update_hero_motion_for_current_state(void) { struct MobyView *moby = MV(hero.moby); - s32 sub = hero.state.step; + s32 saved_state_step = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 vector_and_attack_descriptor_scratch; @@ -2919,7 +2919,7 @@ void update_hero_motion_for_current_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (saved_state_step != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From c74d18ac0b4a09ed59ada3807131b2342a6f27f2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:09:48 +0000 Subject: [PATCH 223/758] decomp: clarify names in update_hero_motion_for_current_state sub -> entry_state_step: Authoritative C initializes this s32 once from hero.state.step before dispatch and uses it only in the final comparison with hero.state.step to reset hero.step_frames. Retail 0x00238954 loads hero+0x2088 and 0x0023895c saves it at sp+0x104; 0x0023f014-0x0023f020 reloads the saved value, compares the current +0x2088 step and clears hero+0x1A0 on change. Original Ghidra expresses the same iStack_dc=iRam001413d8 capture and tail inequality. Thus it is the state step at function entry, not the current state ID or control mode. --- src/overlays/l12/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l12/hero/update_hero_motion_for_current_state.c b/src/overlays/l12/hero/update_hero_motion_for_current_state.c index c6769bea79..c552720a63 100644 --- a/src/overlays/l12/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l12/hero/update_hero_motion_for_current_state.c @@ -656,7 +656,7 @@ void update_hero_motion_for_current_state(void) __asm__("FUN_L12_00238900"); void update_hero_motion_for_current_state(void) { struct MobyView *moby = MV(hero.moby); - s32 sub = hero.state.step; + s32 entry_state_step = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 geometry_and_hit_descriptor_scratch; @@ -2854,7 +2854,7 @@ void update_hero_motion_for_current_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (entry_state_step != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From 56c2813889f65b3d44cdf64d64cf8a5e98152d3f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:12:27 +0000 Subject: [PATCH 224/758] decomp: clarify names in update_hero_motion_for_current_state sub -> initial_state_step: Authoritative C initializes this s32 once from hero.state.step before the switch and compares it with hero.state.step after all motion handling, resetting hero.step_frames on change. Retail 0x0021eb24-0x0021eb28 loads hero+0x2088 into sp+0x11c; 0x00226cd0-0x00226cdc reloads that saved word, compares the current hero+0x2088, and clears hero+0x1a0 on inequality. Original Ghidra names the snapshot iStack_e4 and compares it with iRam001413d8 at LAB_00226cd4. This proves an initial step snapshot, not a current-state ID. --- src/overlays/l18/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l18/hero/update_hero_motion_for_current_state.c b/src/overlays/l18/hero/update_hero_motion_for_current_state.c index 43c4b62905..04675e7b15 100644 --- a/src/overlays/l18/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l18/hero/update_hero_motion_for_current_state.c @@ -265,7 +265,7 @@ void update_hero_motion_for_current_state(void) { }; struct MobyView *moby = (struct MobyView *)hero.moby; - s32 sub = hero.state.step; + s32 initial_state_step = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 general_vector_or_hit_descriptor_scratch; @@ -3155,7 +3155,7 @@ void update_hero_motion_for_current_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (initial_state_step != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From a268aa8f444a2f02780ec6c262b02de47eb4effe Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:12:28 +0000 Subject: [PATCH 225/758] decomp: clarify names in update_hero_motion_for_current_state sub -> state_step_at_entry: Source initializes the sole s32 sub from hero.state.step before dispatch and only reads it in the final comparison that clears hero.step_frames. Retail 0x002145f4 loads hero+0x2088 and 0x002145f8 saves it at sp+0x124; 0x0021d204 reloads that snapshot, 0x0021d208 reads the current +0x2088, and 0x0021d20c-0x0021d210 clears hero+0x1a0 on change. Original Ghidra iStack_dc = iRam001413d8 and its final comparison corroborate the entry-state-step snapshot. --- src/overlays/l16/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l16/hero/update_hero_motion_for_current_state.c b/src/overlays/l16/hero/update_hero_motion_for_current_state.c index 419f9a6c77..0d94dde08b 100644 --- a/src/overlays/l16/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l16/hero/update_hero_motion_for_current_state.c @@ -274,7 +274,7 @@ void update_hero_motion_for_current_state(void) __asm__("FUN_L16_00214598"); void update_hero_motion_for_current_state(void) { struct MobyView *moby = (struct MobyView *)hero.moby; - s32 sub = hero.state.step; + s32 state_step_at_entry = hero.state.step; s32 anim = moby->b53; struct Hero *pl0; f32 speed; @@ -3215,7 +3215,7 @@ void update_hero_motion_for_current_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (state_step_at_entry != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From 4e27cfbf0019031a34c429f91819499c30942c73 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:12:28 +0000 Subject: [PATCH 226/758] decomp: clarify names in update_hero_motion_for_current_state sub -> initial_state_step: The authoritative C initializes s32 sub from hero.state.step before the switch and uses it only in the exit comparison that resets hero.step_frames. Retail 0x002147bc loads hero+0x2088 and 0x002147c0 saves it at sp+0x124; 0x0021d440 reloads that snapshot, 0x0021d444 reads the current +0x2088, and 0x0021d448-0x0021d44c clears +0x1a0 if changed. Original Ghidra iStack_dc=iRam001413d8 and its final comparison confirm this entry-state-step snapshot. --- src/overlays/l17/hero/update_hero_motion_for_current_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l17/hero/update_hero_motion_for_current_state.c b/src/overlays/l17/hero/update_hero_motion_for_current_state.c index 5c96257aa9..7ead070e20 100644 --- a/src/overlays/l17/hero/update_hero_motion_for_current_state.c +++ b/src/overlays/l17/hero/update_hero_motion_for_current_state.c @@ -261,7 +261,7 @@ void update_hero_motion_for_current_state(void) __asm__("FUN_L17_00214760"); void update_hero_motion_for_current_state(void) { struct MobyView *moby = (struct MobyView *)hero.moby; - s32 sub = hero.state.step; + s32 initial_state_step = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 scratch_vector; @@ -3196,7 +3196,7 @@ void update_hero_motion_for_current_state(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (initial_state_step != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From 7e6f4c64b4e3982542744f96e8bacdbaedf3ad58 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:14:57 +0000 Subject: [PATCH 227/758] decomp: clarify names in hero_update_movement sub -> state_step_before_update: The unique s32 sub snapshots hero.state.step before dispatch. Retail 0x002179cc loads hero+0x2088 and 0x002179d0 saves it at sp+0x124 (original Ghidra iStack_dc = iRam001413d8). At 0x002212a4-0x002212b0 the saved value is compared with the updated hero+0x2088 and a difference clears hero.step_frames at +0x1a0. Its sole use therefore detects a state-step change during this movement update. --- src/overlays/shared/hero/hero_update_movement.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_update_movement.c b/src/overlays/shared/hero/hero_update_movement.c index 0f69529e6b..3e02cf2322 100644 --- a/src/overlays/shared/hero/hero_update_movement.c +++ b/src/overlays/shared/hero/hero_update_movement.c @@ -232,7 +232,7 @@ void hero_update_movement(void) { }; struct MobyView *moby = (struct MobyView *)hero.moby; - s32 sub = hero.state.step; + s32 state_step_before_update = hero.state.step; s32 anim = moby->b53; f32 speed; Vec4 movement_and_hit_descriptor_scratch; @@ -3590,7 +3590,7 @@ void hero_update_movement(void) { clear_u64_value(&hero.motion.velocity); break; } - if (sub != hero.state.step) { + if (state_step_before_update != hero.state.step) { hero.step_frames = 0; } if (anim != moby->b53) { From dd6d29838d1bd688783bee671c606b9ba574a963 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:15:08 +0000 Subject: [PATCH 228/758] decomp: clarify names in fighter_jet_update D_L13_00161440 -> l13_fighter_jet_mount_flag_moby_classes: Authoritative source defines this short as 0x7f and passes its address to jet_group_switch. Retail 0x002bb5cc-0x002bb5d4, 0x002bbbe4-0x002bbbf4 and 0x002bbff0-0x002bbff8 pass gp-0x57c0 with a1=1,a2=-1,a3=-1 at initialize/exits; 0x002bb9a0-0x002bb9b0 passes the same address with a1=0 on mounting. Checked level-13 helper 0x002651c8 (request 991b756d1b4f486d96e1e2d675b6586e, report b2e42ec6b5dcd8e02c2514975c28ed5a22b7c7bcb7f4f2b357f243576fb923b1) reads halfword entries at 0x002651e4/0x00265210, compares them with moby class +0xA6 at 0x00265200/0x00265218, advances by two bytes, and sets mask 2 with a1=0 or clears it with a1!=0 at 0x00265234-0x00265248. Thus this binding starts the class sequence selecting mobys whose flag bit 1 is enabled on mount and cleared on initialization/exits; no class identity or list extent is inferred. --- src/overlays/l13/mobys/fighter_jet.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l13/mobys/fighter_jet.c b/src/overlays/l13/mobys/fighter_jet.c index cbb0d64796..c9d62a323e 100644 --- a/src/overlays/l13/mobys/fighter_jet.c +++ b/src/overlays/l13/mobys/fighter_jet.c @@ -1732,7 +1732,7 @@ int hp_bar_saved __asm__("D_L13_001613C4") = 0; extern short fighter_jet_hidden_moby_classes[] __asm__("D_L13_001CBDE8"); -short D_L13_00161440 = 0x7f; +short l13_fighter_jet_mount_flag_moby_classes __asm__("D_L13_00161440") = 0x7f; extern float D_L13_0015F3FC; @@ -1891,7 +1891,7 @@ void fighter_jet_update(Jet *jet_moby) { if (jet_data->group_b > 0) jet_group_state(jet_data->group_b, 0, 0, 0); jet_group_switch(fighter_jet_hidden_moby_classes, 1, 1, -1); - jet_group_switch(&D_L13_00161440, 1, -1, -1); + jet_group_switch(&l13_fighter_jet_mount_flag_moby_classes, 1, -1, -1); jet_group_flag(0x102, 0); jet_data->lock_index = -1; jet_data->start_timer = scale_game_frames(575); @@ -1993,7 +1993,7 @@ void fighter_jet_update(Jet *jet_moby) { if (jet_data->group_b > 0) jet_group_state(jet_data->group_b, 1, 1, 1); jet_group_switch(fighter_jet_hidden_moby_classes, 0, 0, -1); - jet_group_switch(&D_L13_00161440, 0, -1, -1); + jet_group_switch(&l13_fighter_jet_mount_flag_moby_classes, 0, -1, -1); jet_group_flag(0x102, 0); jet_moby->position[2] += 3.0f; jet_moby->scale = jet_moby->model->scale * 0.25f; @@ -2044,7 +2044,7 @@ void fighter_jet_update(Jet *jet_moby) { if (jet_data->group_b > 0) jet_group_state(jet_data->group_b, 0, 0, 0); jet_group_switch(fighter_jet_hidden_moby_classes, 1, 1, -1); - jet_group_switch(&D_L13_00161440, 1, -1, -1); + jet_group_switch(&l13_fighter_jet_mount_flag_moby_classes, 1, -1, -1); jet_group_flag(0x102, 0); if (jet_data->exit_path != -1) { LevelCuboid *path = &l13_cuboids[jet_data->exit_path]; @@ -2158,7 +2158,7 @@ void fighter_jet_update(Jet *jet_moby) { if (jet_data->group_b > 0) jet_group_state(jet_data->group_b, 0, 0, 0); jet_group_switch(fighter_jet_hidden_moby_classes, 1, 1, -1); - jet_group_switch(&D_L13_00161440, 1, -1, -1); + jet_group_switch(&l13_fighter_jet_mount_flag_moby_classes, 1, -1, -1); jet_group_flag(0x102, 0); path = &l13_cuboids[jet_data->destination_path]; set_race_camera(&path->pos, &path->rot, 0, 1); From 847e5ffde3d02cbb11bb2cd73850d24e1d2b7656 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:19:00 +0000 Subject: [PATCH 229/758] decomp: clarify names in fighter_jet_update D_L17_00162178 -> l17_fighter_jet_victory_fade_delay_reload: Retail 0x002ed86c-0x002ed884 tests ship vars+0xe8, loads the exact scalar D_L17_00162178 via lw v0,-0x4a88(gp) at 0x002ed878, stores it to vars+0xf8 at 0x002ed880 and enters fighter-jet state 8. In that proven VICTORY_EXIT branch, 0x002edb5c-0x002edb64 decrements vars+0xf8 through fast_dec_timer and gates 0x002edb6c-0x002edb90, which approaches fade vars+0x130 toward 1. Original Ghidra case 4 copies uGpffffb578 to vars+0xf8 and case 8 performs the same decrement/fade gate; authoritative C agrees and defines this int as 180. Thus this is the reload count delaying the victory fade, not the fade rate or respawn delay. --- src/overlays/l17/mobys/fighter_jet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l17/mobys/fighter_jet.c b/src/overlays/l17/mobys/fighter_jet.c index 19e3e0957e..c2ceb86cb6 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -1713,7 +1713,7 @@ unsigned char l17_fighter_jet_starting_ammo_gp __asm__("D_L17_00162064") = 0xa; unsigned char l17_fighter_jet_ammo_capacity_gp __asm__("D_L17_00162068") = 0x14; extern float fighter_jet_max_hp_gp __asm__("D_L17_00162084") __attribute__((sda)); extern float D_L17_00162088 __attribute__((sda)); -int D_L17_00162178 = 180; +int l17_fighter_jet_victory_fade_delay_reload __asm__("D_L17_00162178") = 180; char *hp_bar_clut __asm__("D_L17_00162180") = 0; int hp_bar_saved __asm__("D_L17_00162184") = 0; @@ -1967,7 +1967,7 @@ void fighter_jet_update(ShipMoby *moby) { } update_fighter_jet_flight((FighterJetMoby *)moby, (FighterJetVars *)ship_vars); if (ship_vars->iE8 <= 0) { - ship_vars->timerF8 = D_L17_00162178; + ship_vars->timerF8 = l17_fighter_jet_victory_fade_delay_reload; moby->state = FIGHTER_JET_STATE_VICTORY_EXIT; } if (ship_vars->fade != 0.0f) { From 2dcf4d3ead57f6c9af269c20d9e2f546d831de81 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:24:20 +0000 Subject: [PATCH 230/758] decomp: clarify names in update_hero_motion_for_current_state w -> missile_pitch: Source saves zero target speed in w and passes yaw,w and yaw,w pairs to spawn_giant_clank_missile. Retail 0x0021525c and 0x00215274 put this saved scalar in f13 and f16. Bounded helper request 29be606f9d824dcaad2eb5ce239104a2 shows f16 saved as f21 at 0x0029d42c, stored to spawned moby rotation +0x44 at 0x0029d490, and supplied as f14 at 0x0029d4b4 to 0x00252348, the same established build_spherical_offset callee whose arguments are length,yaw,pitch. Its paired f15 yaw becomes f20 and moby rotation +0x48. The other w path f13 is saved at sp+0x24 and copied into missile private +0x30 at 0x0029d594-0x0029d59c, paired with f12 yaw at private +0x2C. This proves missile pitch initialization without claiming later steering semantics. --- .../l15/hero/update_hero_motion_for_current_state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 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 f0ad82f37a..62cad161f0 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 @@ -2722,7 +2722,7 @@ void update_hero_motion_for_current_state(void) { reduce_and_apply_hero_planar_velocity_addend(frame_time_sq * 12.6f); if (test_hero_animation_frame_window(4.0f) != 0) { s32 i; - f32 w = z; + f32 missile_pitch = z; z = 1.0f; for (i = 0; i < 2; i++) { moby_point_position( @@ -2732,11 +2732,11 @@ void update_hero_motion_for_current_state(void) { spawn_giant_clank_missile((struct MobyView *)hero.moby, &spatial_or_hit_descriptor_work, hero.motion.rot.f[2], - w, + missile_pitch, 0, 0.5f, hero.motion.rot.f[2], - w); + missile_pitch); } } if (hero.air_frames.s != 0) { From f8afa404d139ab441d71a5f7e6e00a20fdbd8085 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:26:09 +0000 Subject: [PATCH 231/758] decomp: clarify names in start_camera_blend domain_0_value_0 -> CAMERA_TRANSITION_KIND_BLEND: Retail 0x001ec8dc loads requested_kind from cam_trans_state+3 and 0x001ec8e0 tests zero; its branch seeds CameraBlend.position at +0x50 and rotation at +0x60 from source (0x001ec8e8-0x001ec900). The same requested byte is copied directly into active kind at +2 by 0x001eca4c. Active kind zero already uses CAMERA_TRANSITION_KIND_BLEND in the authoritative C and initializes blend progress and rates at 0x001eca50-0x001eca88, proving the same camera-kind domain. domain_4_value_0 -> CAMERA_TRANSITION_KIND_BLEND: Retail 0x001ec9d4 loads the same requested_kind byte at cam_trans_state+3; after excluding 2 and 1, 0x001eca24 tests it against zero and calls restore_camera_vectors at 0x001eca2c. At 0x001eca34 it reloads that byte and 0x001eca4c copies it directly to active kind at +2. The zero active-kind branch initializes CameraBlend progress, starting transforms and rates at 0x001eca50-0x001eca88 and already bears CAMERA_TRANSITION_KIND_BLEND in the authoritative source. This is the identical selector domain, not the separate transition phase or any Hero enum. --- src/camera/start_camera_blend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/camera/start_camera_blend.c b/src/camera/start_camera_blend.c index 5d32aa02bc..092571f5ff 100644 --- a/src/camera/start_camera_blend.c +++ b/src/camera/start_camera_blend.c @@ -29,7 +29,7 @@ void start_camera_blend(struct UpdateCam *source) { if (transition->mode == CAMERA_TRANSITION_PHASE_SEED_FROM_SOURCE) { requested_transition_kind = transition->requested_kind; - if (requested_transition_kind == 0) { + if (requested_transition_kind == CAMERA_TRANSITION_KIND_BLEND) { qcopy(transition->blend.position, &source->pos); extract_matrix_rotation_quaternion(transition->blend.rotation, source); } else if (requested_transition_kind == 2) { @@ -62,7 +62,7 @@ void start_camera_blend(struct UpdateCam *source) { } else if (requested_transition_kind == 1) { save_camera_vectors(); qcopy(transition->orbit.rotation, transition->orbit.saved_rotation); - } else if (requested_transition_kind == 0) { + } else if (requested_transition_kind == CAMERA_TRANSITION_KIND_BLEND) { restore_camera_vectors(); } } From b387919894f6b65a5b482967355233383fa87a0f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 05:34:08 +0000 Subject: [PATCH 232/758] decomp: clarify names in start_camera_blend domain_0_value_2 -> CAMERA_TRANSITION_KIND_ORBIT_SHARED_TARGET: Retail 0x001ec8dc loads requested kind from cam_trans_state+3, and 0x001ec90c selects value 2. At 0x001ec914-0x001ec92c source position/rotation seed orbit saved transforms, then 0x001ec930 calls 0x001ec710. That checked helper passes position cam_trans_state+0xC0 and shared target 0x0013f3d0 to derive_camera_orbit_parameters at 0x001ec7a0-0x001ec7b8. The checked callee subtracts focus from position at 0x001ec574 and writes yaw, pitch and distance at 0x001ec63c/0x001ec6c4/0x001ec6d0. Thus value 2 selects orbit initialization around the shared target. The requested byte is copied to active kind at 0x001eca4c, establishing the camera-kind domain. domain_1_value_2 -> CAMERA_TRANSITION_KIND_ORBIT_SHARED_TARGET: Retail 0x001ec9d4 loads the same requested-kind byte at cam_trans_state+3; 0x001ec9d8-0x001ec9dc compares it with 2. Its path calls save_camera_vectors at 0x001ec9e4 and the same shared-target orbit helper 0x001ec710 at 0x001ec9ec. Checked helper instructions 0x001ec7a4-0x001ec7b8 supply cam_trans_state+0xC0 as position and 0x0013f3d0 (g_afCameraTargetPosition in the prepared decompilation) as focus to derive_camera_orbit_parameters. This is the same camera-kind value as the source-seeding comparison, independent of transition phase; reuse the same semantic member. domain_2_value_1 -> CAMERA_TRANSITION_KIND_ORBIT_ACTIVE_CAMERA: The selector is the requested-kind byte loaded at 0x001ec9d4, distinct from the halfword phase. Retail 0x001ec9fc compares it with 1; 0x001eca04 transfers blend vectors and 0x001eca0c-0x001eca18 copies saved orbit rotation into current orbit rotation. For this same kind during phase-one initialization, value 1 excludes both 0 and 2 at 0x001ec8e0/0x001ec90c and reaches 0x001ec994-0x001ec9b0: the active camera pointer at transition-0xF0 supplies +0x30 as focus, source+0x30 supplies position, and normalized hero basis rows supply axes to compute_camera_angles. The authoritative source identifies that pointer as PreviewCamera.current_camera. Checked callee 0x001ec530 subtracts position/focus and derives yaw, pitch and distance. Therefore kind 1 seeds orbit around the active camera position, unlike kind 2's shared target. --- src/camera/start_camera_blend.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/camera/start_camera_blend.c b/src/camera/start_camera_blend.c index 092571f5ff..5191c43842 100644 --- a/src/camera/start_camera_blend.c +++ b/src/camera/start_camera_blend.c @@ -21,6 +21,10 @@ void start_camera_blend(struct UpdateCam *source) { CAMERA_TRANSITION_KIND_BLEND = 0, CAMERA_TRANSITION_PHASE_SEED_FROM_SOURCE = 1 }; + enum { + CAMERA_TRANSITION_KIND_ORBIT_ACTIVE_CAMERA = 1, + CAMERA_TRANSITION_KIND_ORBIT_SHARED_TARGET = 2 + }; struct CameraTransition *transition = &cam_trans_state; char orbit_reference_direction[16]; char orbit_yaw_side_direction[16]; @@ -32,7 +36,7 @@ void start_camera_blend(struct UpdateCam *source) { if (requested_transition_kind == CAMERA_TRANSITION_KIND_BLEND) { qcopy(transition->blend.position, &source->pos); extract_matrix_rotation_quaternion(transition->blend.rotation, source); - } else if (requested_transition_kind == 2) { + } else if (requested_transition_kind == CAMERA_TRANSITION_KIND_ORBIT_SHARED_TARGET) { qcopy(transition->orbit.saved_position, &source->pos); extract_matrix_rotation_quaternion(transition->orbit.saved_rotation, source); capture_camera_orientation(); @@ -56,10 +60,10 @@ void start_camera_blend(struct UpdateCam *source) { } } else { requested_transition_kind = transition->requested_kind; - if (requested_transition_kind == 2) { + if (requested_transition_kind == CAMERA_TRANSITION_KIND_ORBIT_SHARED_TARGET) { save_camera_vectors(); capture_camera_orientation(); - } else if (requested_transition_kind == 1) { + } else if (requested_transition_kind == CAMERA_TRANSITION_KIND_ORBIT_ACTIVE_CAMERA) { save_camera_vectors(); qcopy(transition->orbit.rotation, transition->orbit.saved_rotation); } else if (requested_transition_kind == CAMERA_TRANSITION_KIND_BLEND) { From c857ac656f5370054862f79364c6f37b48271fd8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:23:41 +0000 Subject: [PATCH 233/758] decomp: clarify names in sync_hero_mapped_moby_animation_frames f54 -> animation_time: In the authoritative C, animation_sync_target->f54 is assigned hero_animation_sync_state->moby->anim_time. Retail 0x00232348 loads hero.moby from hero+0x2080, 0x00232354 loads its float at +0x54, and 0x00232360 stores that same float to the mapped target+0x54. The original decompilation explicitly copies *(iRam001413d0+0x54) to *(iVar4+0x54). This proves the target's synchronized animation time role, alongside the copied frame bytes and rebuilt frame-data pointers. f5C -> animation_frame_rate: In the authoritative C, animation_sync_target->f5C is assigned hero_animation_sync_state->anim_frame_rate. Retail 0x00232334 loads the float at hero+0xA94 and 0x0023233C stores it to target+0x5C; original decompilation assigns uRam0013fde4 to *(iRam001415c8+0x5c). The supplied advance_hero_animation context sets hero.anim_frame_rate before calling this synchronization function after frame changes, establishing this field as the mapped animation's synchronized frame-rate value. --- 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 78014982b8..5af90c24dc 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -347,9 +347,9 @@ typedef struct { char pad28[0x28]; unsigned char seq[2]; unsigned char bank[2]; - float f54; + float animation_time; float f58; - float f5C; + float animation_frame_rate; char pad60[8]; int id[2]; } AnimState; @@ -363,8 +363,8 @@ void sync_hero_mapped_moby_animation_frames(void) { if (animation_sync_target == 0) { return; } - animation_sync_target->f5C = hero_animation_sync_state->anim_frame_rate; - animation_sync_target->f54 = hero_animation_sync_state->moby->anim_time; + animation_sync_target->animation_frame_rate = hero_animation_sync_state->anim_frame_rate; + animation_sync_target->animation_time = hero_animation_sync_state->moby->anim_time; animation_sync_target->seq[0] = hero_animation_sync_state->moby->prev_frame; animation_sync_target->seq[1] = hero_animation_sync_state->moby->prev_frame; animation_sync_target->id[0] = From bd79bbe98e2e690f973050f05ab5fcfc5a05bf57 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:23:45 +0000 Subject: [PATCH 234/758] decomp: clarify names in find_listed_moby_by_data_id p78 -> data_id_record: In find_listed_moby_by_data_id, retail 0x0025f8a0-0x0025f8a8 resolves a listed index into candidate_moby. At 0x0025f8ac it loads that moby's +0x78 pointer, then 0x0025f8b0 loads the pointed record's +0x18 id and 0x0025f8b4 compares it to the lookup argument. Equality returns candidate_moby at 0x0025f8c0. Original Ghidra shows *(int *)(*(int *)(iVar1 + 0x78) + 0x18) == param_1; authoritative C expresses candidate_moby->p78->id == id with V25f878 *p78. Thus data_id_record names the pointed record by its proven lookup role, rather than its offset. --- src/overlays/shared/rendering/effects/spawn_explosion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/effects/spawn_explosion.c b/src/overlays/shared/rendering/effects/spawn_explosion.c index 7677eb0468..76c94b5c54 100644 --- a/src/overlays/shared/rendering/effects/spawn_explosion.c +++ b/src/overlays/shared/rendering/effects/spawn_explosion.c @@ -1149,7 +1149,7 @@ typedef struct { typedef struct { u8 pad[0x78]; - V25f878 *p78; + V25f878 *data_id_record; u8 pad7c[0x100 - 0x7C]; } M25f878; @@ -1161,7 +1161,7 @@ M25f878 *find_listed_moby_by_data_id(s32 id) { s32 i; for (i = 1; i <= D_L00_001B0770[0]; i++) { M25f878 *candidate_moby = (M25f878 *)(D_L00_001B0770[i] * 0x100 + (s32)moby_table); - if (candidate_moby->p78->id == id) + if (candidate_moby->data_id_record->id == id) return candidate_moby; } return 0; From bc9f54eacb8246419e78477367630211769cadd9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:26:04 +0000 Subject: [PATCH 235/758] decomp: clarify names in initialize_npc_dialogue f09 -> dialogue_initialized: Retail 0x002668dc loads 1 and 0x002668ec stores that byte to the second argument +9 only after the moby lookup and nonnull list checks succeed. Source update_npc_dialogue calls this same asm-bound initializer when trigger->initialised is zero; SceneTrigger +9 and Out002668a0.f09 are the same flag role. f36 -> current_dialogue_entry_index: Retail 0x0026690c initializes second-argument +0x36 to zero, optionally replaces it from list +6 at 0x00266930-34, then loads it signed at 0x00266938 and multiplies by 0x1c at 0x00266948 to select the dialogue entry whose flags are read at +0x10. Source SceneTrigger.entry is used in trigger->entries[trigger->entry] for this same initializer's output. f38 -> dialogue_start_frame: Retail 0x002668f8-0x002668fc loads word 0x0015f5cc and 0x00266908 stores it to second-argument +0x38 during successful initialization. The authoritative C binds game_frame with __asm__("D_L00_0015F5CC"), the same global read by this function, and identifies SceneTrigger.start_frame at +0x38 as the frame at setup. Thus f38 holds the dialogue setup frame. f3C -> dialogue_entry_list_address: Retail 0x00266910 loads the nonnull moby-indexed list pointer from 0x001b1678 and 0x00266914 stores it to second-argument +0x3c. At 0x00266940-0x00266950 this stored address is loaded and indexed by current entry times 0x1c to read flags +0x10. C stores (u32)dialogue_entries here and SceneTrigger.entries supplies the same entry list to update_npc_dialogue; the u32 storage type remains unchanged. --- .../shared/cutscenes/update_npc_dialogue.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/cutscenes/update_npc_dialogue.c b/src/overlays/shared/cutscenes/update_npc_dialogue.c index e5ef1b549a..fe7ff3da06 100644 --- a/src/overlays/shared/cutscenes/update_npc_dialogue.c +++ b/src/overlays/shared/cutscenes/update_npc_dialogue.c @@ -211,11 +211,11 @@ typedef struct { s16 f04; u8 pad6[2]; u8 f08; - u8 f09; + u8 dialogue_initialized; u8 padA[0x2C]; - s16 f36; - u32 f38; - u32 f3C; + s16 current_dialogue_entry_index; + u32 dialogue_start_frame; + u32 dialogue_entry_list_address; } Out002668a0; typedef struct { @@ -243,17 +243,17 @@ s32 initialize_npc_dialogue(void *moby, u8 *out_p) { if (l00_moby_dialogue_entry_lists[i] == 0) { return -1; } - dialogue_trigger->f09 = 1; - dialogue_trigger->f38 = D_L00_0015F5CC; + dialogue_trigger->dialogue_initialized = 1; + dialogue_trigger->dialogue_start_frame = D_L00_0015F5CC; dialogue_trigger->f04 = -1; - dialogue_trigger->f36 = 0; + dialogue_trigger->current_dialogue_entry_index = 0; dialogue_entries = l00_moby_dialogue_entry_lists[i]; - dialogue_trigger->f3C = (u32)dialogue_entries; + dialogue_trigger->dialogue_entry_list_address = (u32)dialogue_entries; if (level_object_states[i].state != 0 && dialogue_entries->f08 == 0) { - dialogue_trigger->f36 = dialogue_entries->f06; + dialogue_trigger->current_dialogue_entry_index = dialogue_entries->f06; } dialogue_trigger->f08 = - ((u8 *)dialogue_trigger->f3C)[dialogue_trigger->f36 * 0x1C + (k = 0x10)] & 1; + ((u8 *)dialogue_trigger->dialogue_entry_list_address)[dialogue_trigger->current_dialogue_entry_index * 0x1C + (k = 0x10)] & 1; return i; } From ee60e125d83aed0186e46e7d7abc1116d5b864e6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:26:07 +0000 Subject: [PATCH 236/758] decomp: clarify names in update_three_phase_motion_alpha_fade_particle i4 -> packed_particle_color: M_274e48.i4 receives the distance color tween at 0x00274fbc (sw v0,4(s2)). At 0x0027500c-0x00275024 and 0x002750e4-0x00275118 this same word is masked with 0x00FFFFFF and blended with its original value to fade only alpha. The authoritative C uses particle->i4 for these color operations, proving the packed particle color role rather than merely a word at offset 4. i8 -> far_distance_color: R_274e48.i8 is loaded into a0 from 8(s3) at 0x00274fac, beside iC in a1 at 0x00274fb8, for the color tween whose result is stored to particle+4. The factor computed at 0x00274f58-0x00274fa8 is clamp((3.0-distance)/2.5,0,1), making i8 the zero-factor endpoint at distances >=3.0. The same tween's final-phase use blends alpha-cleared first color toward original second color as the ratio increases (0x002750e4-0x00275118), corroborating endpoint direction in the bound C. p18 -> motion_target_position: R_274e48.p18 is loaded from 0x18(s3) at 0x00274ebc and its third float is tested positive at 0x00274ec4-0x00274ed0. It supplies the first source of target-minus-particle-position subtraction at 0x00274ed8-0x00274ee0. The resulting vector is normalized then added to particle position at 0x00274f18-0x00274f2c, or normalized and packed as final motion at 0x00274f44-0x00274f54, proving a motion target position without asserting its owner. --- .../shared/rendering/effects/particles.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index 11a2ea06b6..58a14210fd 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -1840,18 +1840,18 @@ typedef struct { typedef struct { u8 p0[8]; - s32 i8; + s32 far_distance_color; s32 iC; s16 h10; s16 h12; s16 h14; u8 p16[2]; - f32 *p18; + f32 *motion_target_position; } R_274e48; typedef struct { u8 p0[4]; - s32 i4; + s32 packed_particle_color; u8 b8; u8 p9; s16 hA; @@ -1873,8 +1873,8 @@ void update_three_phase_motion_alpha_fade_particle(M_274e48 *particle) { if (D_L00_0015F5CC & 1) particle->b8++; distance_or_blend_factor = fast_vec_dist(&particle->v10, &(*(V_274e48 *)D_0013F420)); - if (distance_or_blend_factor < 5.0f && 0.0f < r->p18[2]) { - fast_vec_sub(&motion_vector_scratch, r->p18, &particle->v10); + if (distance_or_blend_factor < 5.0f && 0.0f < r->motion_target_position[2]) { + fast_vec_sub(&motion_vector_scratch, r->motion_target_position, &particle->v10); if (0.5f < fast_vec_length(&motion_vector_scratch)) { fast_vec_normalize( &motion_vector_scratch, &motion_vector_scratch, 0.1f / distance_or_blend_factor); @@ -1889,15 +1889,15 @@ void update_three_phase_motion_alpha_fade_particle(M_274e48 *particle) { distance_or_blend_factor = 1.0f; else if (distance_or_blend_factor < 0.0f) distance_or_blend_factor = 0.0f; - particle->i4 = FUN_001fa6e0_274e48(r->i8, r->iC, distance_or_blend_factor); + particle->packed_particle_color = FUN_001fa6e0_274e48(r->far_distance_color, r->iC, distance_or_blend_factor); if (r->h10) { *(volatile s32 *)0x10000000 = 0; load_display_text_resource_entry(&applied_motion_delta, r); fast_vec_add(&particle->v10, &particle->v10, &applied_motion_delta); distance_or_blend_factor = convert_integer_to_float(particle->hA) / convert_integer_to_float(r->h10); - particle->i4 = FUN_001fa6e0_274e48( - particle->i4 & 0xFFFFFF, particle->i4, 1.0f - distance_or_blend_factor); + particle->packed_particle_color = FUN_001fa6e0_274e48( + particle->packed_particle_color & 0xFFFFFF, particle->packed_particle_color, 1.0f - distance_or_blend_factor); if (fast_dec_timer_s16(&particle->hA)) { r->h10 = 0; particle->hA = r->h12; @@ -1917,9 +1917,9 @@ void update_three_phase_motion_alpha_fade_particle(M_274e48 *particle) { } else { load_display_text_resource_entry(&applied_motion_delta, (u8 *)r + 4); fast_vec_add(&particle->v10, &particle->v10, &applied_motion_delta); - color_without_alpha = particle->i4 & 0xFFFFFF; - particle->i4 = FUN_001fa6e0_274e48(color_without_alpha, - particle->i4, + color_without_alpha = particle->packed_particle_color & 0xFFFFFF; + particle->packed_particle_color = FUN_001fa6e0_274e48(color_without_alpha, + particle->packed_particle_color, convert_integer_to_float(particle->hA) / convert_integer_to_float(r->h14)); if (fast_dec_timer_s16(&particle->hA)) From d6dd366f77c1483e691040c35cdc225a69b544ee Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:26:11 +0000 Subject: [PATCH 237/758] decomp: clarify names in try_select_follow_camera_volume f220 -> selected_volume_object: C842e83c0.f220 is read from the current camera's +0x70 state at retail 002e83e0. 002e83ec stores candidate_object when this slot is zero; 002e83f8 accepts identity; 002e843c replaces it only when the candidate wins the descriptor-byte comparison. The established try_select_follow_camera_volume name and supplied volume_camera_aim/volume_camera_swing callers establish that this retained object is the selected follow-camera volume. f84 -> camera_descriptor_index: O842e83c0.f84 is the signed short loaded from both the selected object and candidate_object at retail 002e83fc and 002e8408. 002e8414-002e8428 multiply each by 0x20, add the DAT_0015ef50 descriptor table base, and load entry +0x1c to obtain parameters for comparison. Supplied volume_camera_aim and volume_camera_swing pass their camera records to this function and access camera_descriptors[record->descriptor_index].params, confirming this field indexes the camera descriptor table. --- .../shared/camera/follow_camera_set_distance.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_set_distance.c b/src/overlays/shared/camera/follow_camera_set_distance.c index 13581822eb..abc54ee6e7 100644 --- a/src/overlays/shared/camera/follow_camera_set_distance.c +++ b/src/overlays/shared/camera/follow_camera_set_distance.c @@ -28,12 +28,12 @@ typedef struct { typedef struct { char pad00[0x220]; - u32 f220; + u32 selected_volume_object; } C842e83c0; typedef struct { char pad00[0x84]; - short f84; + short camera_descriptor_index; } O842e83c0; typedef struct { @@ -87,18 +87,18 @@ int try_select_follow_camera_volume(int candidate_object, int unused) { return -1; } camera_state = (C842e83c0 *)(u32)((B2842e83c0 *)current_camera)->f70; - if (camera_state->f220 == 0) { - camera_state->f220 = candidate_object; + if (camera_state->selected_volume_object == 0) { + camera_state->selected_volume_object = candidate_object; return 1; } - if (camera_state->f220 == candidate_object) { + if (camera_state->selected_volume_object == candidate_object) { return 1; } tab = (u32)D_L00_0015EF50; - x = *(u8 *)(*(u32 *)(tab + ((O842e83c0 *)(u32)camera_state->f220)->f84 * 0x20 + 0x1C) + 0x1C); - y = *(u8 *)(*(u32 *)(tab + ((O842e83c0 *)(u32)candidate_object)->f84 * 0x20 + 0x1C) + 0x1C); + x = *(u8 *)(*(u32 *)(tab + ((O842e83c0 *)(u32)camera_state->selected_volume_object)->camera_descriptor_index * 0x20 + 0x1C) + 0x1C); + y = *(u8 *)(*(u32 *)(tab + ((O842e83c0 *)(u32)candidate_object)->camera_descriptor_index * 0x20 + 0x1C) + 0x1C); if (x < y) { - camera_state->f220 = candidate_object; + camera_state->selected_volume_object = candidate_object; return 1; } return 0; From 8bb90bd08ab0ca18ed67e769b0007b3674ff744b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:26:14 +0000 Subject: [PATCH 238/758] decomp: clarify names in FUN_L01_002ffcd0 b30 -> update_distance: Retail 0x002ffcf8 retains create_moby(0x313)'s result in s1; 0x002ffd18 loads 0xFF and 0x002ffd28 stores that byte to s1+0x30, matching spawned_moby->b30 = 0xFF. The included include/rnc/mobys/moby.h defines the same Moby prefix (position, state/group/class_slot/alpha, class and next pointers, scale) with u8 update_dist immediately after scale at +0x30, documented as update distance with 0xFF always. In the authoritative same-file pool_tiles_and_effects_update, a struct Moby similarly sets update_dist = 0xFF during initialization. This established typed role plus matching retail object initialization proves update_distance, rather than an offset-derived name. --- src/overlays/l01/mobys/pool_tiles_and_effects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/pool_tiles_and_effects.c b/src/overlays/l01/mobys/pool_tiles_and_effects.c index 83c73a0ff5..2efb301614 100644 --- a/src/overlays/l01/mobys/pool_tiles_and_effects.c +++ b/src/overlays/l01/mobys/pool_tiles_and_effects.c @@ -456,7 +456,7 @@ typedef struct { u128 pos; u8 pad20[0xC]; f32 scale; - u8 b30; + u8 update_distance; u8 b31; s16 h32; u8 pad34[0xC]; @@ -479,7 +479,7 @@ OrbMoby *FUN_L01_002ffcd0(u128 *pos, f32 scale) { copy_hero_moby_field_38(spawned_moby); spawned_moby->w40 = 0; spawned_moby->h32 = 0x40; - spawned_moby->b30 = 0xFF; + spawned_moby->update_distance = 0xFF; spawned_moby->scale = spawned_moby->scale * scale; spawned_moby->rotz = random_angle_radians(); qcopy(&spawned_moby->pos, pos); From a607e62f243fddc3eef89bdd90efada8d33136d1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:26:18 +0000 Subject: [PATCH 239/758] decomp: clarify names in spawn_drek_boss_ring_projectile b20 -> projectile_state: Retail 0x002db998 stores zero to the allocated class-0x270 object's byte at +0x20, corresponding to spawned_moby->b20 = 0. The same class's supplied drek_boss_ring_projectile_update dispatches on moby->state with STATE_BALLISTIC_FLIGHT = 0 and transitions through impact delay, expanding ring and removal. This initialization selects the projectile state machine's ballistic-flight state. f48 -> movement_heading: Retail 0x002db9d0 and 0x002db9d8 load initial_movement_step[0] and [1] as fast_arc_tan arguments; 0x002db9dc stores its floating-point return at spawned object+0x48. Authoritative C spells this spawned_moby->f48 = fast_arc_tan(initial_movement_step[0], initial_movement_step[1]), proving this field holds the movement vector's XY heading. f90 -> projectile_glow_color: Retail 0x002db9ac loads the global at gp-0x5004 and 0x002db9c0 stores it into allocated object+0x90. Authoritative C routes that word through initial_glow_color into spawned_moby->f90. The supplied same-class update uses this same D_L18_00161BFC color endpoint with ballistic_ring_glow_color_end_gp in color interpolation and assigns it to moby->glow_color, establishing the object's glow-color field rather than an arbitrary scalar. --- src/overlays/l18/mobys/drek_boss_ring_projectile.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l18/mobys/drek_boss_ring_projectile.c b/src/overlays/l18/mobys/drek_boss_ring_projectile.c index dd7f3c91ea..40852c012f 100644 --- a/src/overlays/l18/mobys/drek_boss_ring_projectile.c +++ b/src/overlays/l18/mobys/drek_boss_ring_projectile.c @@ -199,7 +199,7 @@ extern void *create_moby() __asm__("FUN_0020c4f8"); typedef struct { char pad0[0x10]; char pos[0x10]; - unsigned char b20; + unsigned char projectile_state; char pad21[0xB]; float f2C; unsigned char b30; @@ -207,11 +207,11 @@ typedef struct { short s32; unsigned short h34; char pad36[0x12]; - float f48; + float movement_heading; char pad4C[0x2C]; Child *child; char pad7C[0x14]; - int f90; + int projectile_glow_color; } BallisticRingProjectileMoby; /* Allocate an object, init its fields and child record. */ @@ -235,15 +235,15 @@ void spawn_drek_boss_ring_projectile( int initial_glow_color; spawned_moby->b30 = 0xFF; spawned_moby->b31 = 1; - spawned_moby->b20 = 0; + spawned_moby->projectile_state = 0; initial_glow_color = *(int *)&D_L18_00161BFC_gp; spawned_moby->f2C = spawned_moby->f2C * D_L18_00161BF8; spawned_moby->s32 = 0xFF; spawned_moby->h34 |= 0x10; - spawned_moby->f90 = initial_glow_color; + spawned_moby->projectile_glow_color = initial_glow_color; moby_vars = spawned_moby->child; qcopy(spawned_moby->pos, pos); - spawned_moby->f48 = fast_arc_tan(initial_movement_step[0], initial_movement_step[1]); + spawned_moby->movement_heading = fast_arc_tan(initial_movement_step[0], initial_movement_step[1]); qcopy(moby_vars->v, initial_movement_step); moby_vars->f34 = collision_filter_moby; moby_vars->f28 = fa; From 3284382271069931265ba784dcbfa2331adbcbb9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:28:35 +0000 Subject: [PATCH 240/758] decomp: clarify names in update_source_bound_effect_particle b7 -> source_alpha: In update_source_bound_effect_particle, retail 0026d528 reloads the source pointer from particle+0x20 and 0026d538 loads its unsigned byte +7 (Src.b7). At 0026d53c it is converted to float; 0026d544-0026d56c multiply it by body.f10/256, add the bounded body.fC alpha offset, and multiply by 256 before integer conversion. 0026d570 shifts this result left 24 and 0026d574-0026d578 combine it with particle color masked to 0xFFFFFF. The SHA-bound C and original Ghidra decompilation show the same source-alpha-to-output-alpha flow, proving source_alpha beyond the field offset alone. --- .../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 37e7edea3c..76c47ec8cb 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 @@ -1914,7 +1914,7 @@ typedef struct { u8 b4; u8 b5; u8 b6; - u8 b7; + u8 source_alpha; u8 b8; u8 b9; s16 hA; @@ -1974,7 +1974,7 @@ void update_source_bound_effect_particle(Part_26d470 *particle) { particle_data->fC = 1.0f; packed_rgb = particle->w4 & 0xFFFFFF; particle->w4 = - packed_rgb | (truncate_float_to_s32((convert_integer_to_float(particle->body.e->b7) * + packed_rgb | (truncate_float_to_s32((convert_integer_to_float(particle->body.e->source_alpha) * (particle_data->f10 * 0.00390625f) + particle_data->fC) * 256.0f) From b5bb29715d440b46ae01de32b4d693d2a10527e8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:28:38 +0000 Subject: [PATCH 241/758] decomp: clarify names in glow_particle_update b23 -> particle_alpha: Retail 0x002acb98-0x002acbcc multiplies the remaining signed countdown at private +0x1c by initial alpha at private +0x1e, divides by half of total lifetime, then sb stores to moby +0x23. The supplied spawn_glow_particle assigns MOBY(moby)->alpha = alpha and private h1e = alpha. Thus the u8 b23 assignment is the particle's fading alpha. f2c -> particle_scale: Retail 0x002acb04-0x002acb40 converts total lifetime minus countdown, multiplies by private +0x18, divides by total lifetime and swc1 stores to moby +0x2c, matching f2c in glow_particle_update. The supplied spawn_glow_particle initializes private f18 from MOBY(moby)->scale * scale and assigns this same lifetime fraction to MOBY(moby)->scale, proving current particle scale. --- src/overlays/shared/rendering/effects/glow_particle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/rendering/effects/glow_particle.c b/src/overlays/shared/rendering/effects/glow_particle.c index 40cda6740b..aa6a4a0d87 100644 --- a/src/overlays/shared/rendering/effects/glow_particle.c +++ b/src/overlays/shared/rendering/effects/glow_particle.c @@ -34,9 +34,9 @@ typedef struct { typedef struct { char pad[0x23]; - u8 b23; + u8 particle_alpha; char pad2[0x2C - 0x24]; - float f2c; + float particle_scale; char pad3[0x40 - 0x30]; float r[3]; char pad4[0x78 - 0x4C]; @@ -130,7 +130,7 @@ void glow_particle_update(M_2acad8 *particle_moby) { int n; elapsed_lifetime_frames = convert_integer_to_float(v->n - v->h1c); total_lifetime_frames = convert_integer_to_float(v->n); - particle_moby->f2c = elapsed_lifetime_frames * v->f18 / total_lifetime_frames; + particle_moby->particle_scale = elapsed_lifetime_frames * v->f18 / total_lifetime_frames; particle_moby->r[0] = fast_add_rotations(particle_moby->r[0], frame_time * 3.1415927f); particle_moby->r[1] = fast_add_rotations(particle_moby->r[1], frame_time * 3.1415927f); particle_moby->r[2] = fast_add_rotations(particle_moby->r[2], frame_time * 3.1415927f); @@ -140,7 +140,7 @@ void glow_particle_update(M_2acad8 *particle_moby) { } n = v->n / 2; if (v->h1c < n) { - particle_moby->b23 = v->h1c * v->h1e / n; + particle_moby->particle_alpha = v->h1c * v->h1e / n; } } From f9b1ed52e2d567e36136a9fb9b2b254347d99690 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:28:41 +0000 Subject: [PATCH 242/758] decomp: clarify names in initialize_orbit_camera_state f2C -> orbit_pitch_spring_stiffness: Retail 0x002eb440 stores 1.0f at state+0x2C. In the supplied source, initialize_mode6_orbit_camera copies mode6_orbit_spring_stiffness_values to state+0x28; its second float at +0x2C drives rope_spring_turn for camera+0x54 in update_orbit_camera_pose. Camera+0x54 is the spherical pitch component, added to the pitch offset at +0x5C to form Euler rotation+0x44. f38 -> view_yaw_offset_spring_stiffness: Retail 0x002eb428 stores 0.07f at state+0x38. This is the fifth float of the stiffness block copied from mode6_orbit_spring_stiffness_values to +0x28. update_orbit_camera_pose uses it in rope_spring_turn for camera+0x60, which is added to pi plus the orbit bearing at camera+0x50 to form the view yaw at +0x48. f3C -> orbit_yaw_spring_damping: Retail 0x002eb430 stores 0.04f at state+0x3C. initialize_mode6_orbit_camera copies mode6_orbit_spring_damping_values to this block. update_orbit_camera_pose passes its first float to rope_spring_turn for camera+0x50, whose target is origin rotation+0x18 plus state+0x14 and whose value contributes pi plus bearing to view yaw+0x48. f44 -> orbit_distance_spring_damping: Retail 0x002eb438 stores 0.04f at state+0x44. It is the third float of the damping block copied from mode6_orbit_spring_damping_values to state+0x3C. update_orbit_camera_pose passes it to cam_interp_values for camera+0x58 targeting state+0x1C; initialization sets that target to 4.64f or 6.0f and the spherical-offset position helper consumes this third orbit component. f48 -> view_pitch_offset_spring_damping: Retail 0x002eb41c stores 0.99f at state+0x48. It is the fourth float of the damping block copied from mode6_orbit_spring_damping_values to +0x3C. update_orbit_camera_pose uses it in rope_spring_turn for camera+0x5C targeting state+0x20, then adds that angular offset to spherical pitch at camera+0x54 to form Euler rotation+0x44. f4C -> view_yaw_offset_spring_damping: Retail 0x002eb420 stores 0.04f at state+0x4C. It is the fifth float of the damping block copied from mode6_orbit_spring_damping_values to +0x3C. update_orbit_camera_pose uses it in rope_spring_turn for camera+0x60 targeting state+0x24; this component is added to pi plus orbit bearing to form view yaw at camera+0x48. f7E -> camera_selection_mode: Retail 0x002eb464 clears the s16 at camera_object+0x7E after pose initialization. The supplied select_camera_mode_by_hero_alignment_and_distance sets that same object field to 2 when the hero bearing difference and distance tests pass and to 4 otherwise. This proves a camera selection mode, without assigning meanings to its numeric values. f9C -> orbit_origin_snap_enabled: Retail 0x002eb408 clears the s32 at camera state+0x9C. In supplied update_orbit_camera_pose, zero selects three cam_interp_values calls that move orbit_origin toward state+0x80; nonzero instead qcopies state+0x80 directly to orbit_origin. initialize_mode6_orbit_camera sets it to 1, enabling direct orbit-origin snapping. --- src/overlays/shared/camera/orbit_camera.c | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/shared/camera/orbit_camera.c b/src/overlays/shared/camera/orbit_camera.c index bf3bceac29..daef4fc4df 100644 --- a/src/overlays/shared/camera/orbit_camera.c +++ b/src/overlays/shared/camera/orbit_camera.c @@ -15,17 +15,17 @@ typedef struct { u8 pad[0x28]; f32 f28; - f32 f2C; + f32 orbit_pitch_spring_stiffness; f32 f30; f32 f34; - f32 f38; - f32 f3C; + f32 view_yaw_offset_spring_stiffness; + f32 orbit_yaw_spring_damping; f32 f40; - f32 f44; - f32 f48; - f32 f4C; + f32 orbit_distance_spring_damping; + f32 view_pitch_offset_spring_damping; + f32 view_yaw_offset_spring_damping; u8 pad50[0x4C]; - s32 f9C; + s32 orbit_origin_snap_enabled; f32 fA0; f32 fA4; s32 fA8; @@ -38,7 +38,7 @@ typedef struct { u8 pad[0x70]; Moby002eb3b0 *m; u8 pad78[0xA]; - s16 f7E; + s16 camera_selection_mode; } S002eb3b0; typedef struct { @@ -135,26 +135,26 @@ void initialize_orbit_camera_state(S002eb3b0 *camera_object) { Moby002eb3b0 *m; camera_object->m->fF0 = 0; m = camera_object->m; - m->f9C = 0; + m->orbit_origin_snap_enabled = 0; m->fA8 = 0; m->fAC = 0; m->fA0 = 0.3f; m->fA4 = 0.3f; - m->f48 = 0.99f; - m->f3C = 0.04f; + m->view_pitch_offset_spring_damping = 0.99f; + m->orbit_yaw_spring_damping = 0.04f; m->f40 = 0.04f; - m->f44 = 0.04f; - m->f4C = 0.04f; + m->orbit_distance_spring_damping = 0.04f; + m->view_yaw_offset_spring_damping = 0.04f; m->f28 = 0.07f; - m->f2C = 1.0f; + m->orbit_pitch_spring_stiffness = 1.0f; m->f30 = 0.07f; m->f34 = 1.0f; - m->f38 = 0.07f; + m->view_yaw_offset_spring_stiffness = 0.07f; zero_five_words((u8 *)m + 0x50); zero_five_words(m); clear_twelve_bytes((u8 *)m + 0x90); initialize_orbit_camera_pose(camera_object); - camera_object->f7E = 0; + camera_object->camera_selection_mode = 0; } void update_orbit_camera_pose(char *camera_object) __asm__("FUN_L00_002eb480"); From bc00503a0e22219fafc30900f3f28fcb4e7b8d35 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:30:49 +0000 Subject: [PATCH 243/758] decomp: clarify names in tall_shroom_update f2c -> removal_trigger_value: In tall_shroom_update the find_moby_hit return v0 is checked nonnull at 0x0030d154, then its float +0x2c is loaded at 0x0030d15c and compared strictly greater than zero at 0x0030d168. A positive value sets s1=1 at 0x0030d174 and causes the state +0x20 store of 2 at 0x0030d184. State 2 dispatches effects, replacement spawn and removal at 0x0030d188-0x0030d1e4. The supplied C expresses this as hit->f2c > 0.0f followed by TALL_SHROOM_STATE_REMOVE_WITH_EFFECTS. Checked helper 0x0026f320 identifies an owner-matched 0x40-byte hit record with masked hit flags before returning it. Thus removal_trigger_value names the member's observed gating role without asserting damage or units. --- src/overlays/l01/mobys/tall_shroom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/tall_shroom.c b/src/overlays/l01/mobys/tall_shroom.c index 21352ec1a2..9f6732dcdf 100644 --- a/src/overlays/l01/mobys/tall_shroom.c +++ b/src/overlays/l01/mobys/tall_shroom.c @@ -6,7 +6,7 @@ typedef struct { u8 pad0[0x2C]; - f32 f2c; + f32 removal_trigger_value; } TriggerHit; typedef struct { @@ -41,7 +41,7 @@ void tall_shroom_update(TriggerMoby *shroom_moby) { shroom_moby->state = TALL_SHROOM_STATE_WAIT_FOR_HIT; break; case TALL_SHROOM_STATE_WAIT_FOR_HIT: - if (hit != 0 && hit->f2c > 0.0f) { + if (hit != 0 && hit->removal_trigger_value > 0.0f) { flag = 1; } if (flag) { From 0d21dcb395eb6ef8f66198136c4aa53a978ad275 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:32:50 +0000 Subject: [PATCH 244/758] decomp: clarify names in select_hero_slot3_animation_pair b2 -> primary_animation_id: In the authoritative C, selected animation_table[k].b2 is assigned to *out_primary_animation_id. Retail 0x002320e8 loads a matching entry index, 0x002320f0 multiplies it by four, and 0x002320f8/0x002320fc load byte +2 and store it through s3, the second argument saved at 0x0023200c. The supplied blend_hero_slot3_animation_pair and blend_hero_slot3_mapped_animation_pair callers pass this output as the animation sequence to blend_moby_animation for hero.items[3].moby, proving the primary animation ID role rather than merely a byte offset. b3 -> secondary_animation_id: In the authoritative C, selected animation_table[k].b3 is assigned to *out_secondary_animation_id. Retail 0x00232100 loads byte +3 of the selected four-byte record and 0x00232104 stores it through s4, the third argument saved at 0x00232004. Original Ghidra independently shows the byte +3 store to *param_3. Both supplied blend callers use this output as the sequence passed to blend_moby_animation for hero.items[3].moby2, proving that it is the secondary animation ID. --- 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 5af90c24dc..59b4f9c21f 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -165,8 +165,8 @@ void blend_hero_slot3_mapped_animation_pair(int id, int frame_index, float blend typedef struct { s16 h0; - u8 b2; - u8 b3; + u8 primary_animation_id; + u8 secondary_animation_id; } E_231ff8; extern E_231ff8 D_L00_0017BBF0_00231ff8[] __asm__("D_L00_0017BBF0") @@ -203,8 +203,8 @@ int select_hero_slot3_animation_pair(int input_animation_id, } if (match_count != 0) { int k = matching_animation_entry_indices[random_int_between(0, match_count - 1)]; - *out_primary_animation_id = animation_table[k].b2; - *out_secondary_animation_id = animation_table[k].b3; + *out_primary_animation_id = animation_table[k].primary_animation_id; + *out_secondary_animation_id = animation_table[k].secondary_animation_id; return 1; } else { *out_primary_animation_id = 1; From 9f2dcfe4c93ee771a52a533b68d2be1406f52b42 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:32:53 +0000 Subject: [PATCH 245/758] decomp: clarify names in trooper_start_knockback f8 -> vertical_motion_step: In trooper_start_knockback, B_25c558 *knockback_state is incoming a1 saved in s0 at 0x0025c590. Retail lwc1 f3,0x1c(s0) at 0x0025c5b0 and swc1 f3,0x8(s0) at 0x0025c5cc initialize f8 from the configured vertical launch component; original Ghidra agrees with param_3[2] = param_3[7]. Adjacent +0/+4 are cos/sin(angle) times +0x18, proving a motion vector. Supplied source step_moby_motion subtracts the gravity step at +0x10 from +8, adds the state vector to MOBY(moby)->pos, compares position[2]+state[+8] with ground height, and transitions from rising to falling when +8 becomes negative. Birdbot callers initialize the corresponding +0x88 component (state starts at +0x70) using sqrt(gravity*2*height) and pass it to trooper_knockback_arc. Thus this field is the per-update vertical motion step, not an offset-only guess. --- src/overlays/shared/mobys/step_moby_motion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/mobys/step_moby_motion.c b/src/overlays/shared/mobys/step_moby_motion.c index 8354e86250..1b6e9f8848 100644 --- a/src/overlays/shared/mobys/step_moby_motion.c +++ b/src/overlays/shared/mobys/step_moby_motion.c @@ -132,7 +132,7 @@ void spawn_particles_at_shape_points(void *source_object, typedef struct { f32 f0; f32 f4; - f32 f8; + f32 vertical_motion_step; f32 fC; u8 p10[8]; f32 f18; @@ -161,7 +161,7 @@ void trooper_start_knockback(u8 *moby, float *moby_vars_record; knockback_state->f0 = fast_cos(knockback_angle) * knockback_state->f18; knockback_state->f4 = fast_sin(knockback_angle) * knockback_state->f18; - knockback_state->f8 = knockback_state->f1C; + knockback_state->vertical_motion_step = knockback_state->f1C; knockback_state->fC = 1.0f; knockback_state->f40 = fast_add_rotations(knockback_angle, 3.1415927f); knockback_state->w44 = 0; From 91709b7df77fa2ccf46d38bc180ca661555314dc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:36:54 +0000 Subject: [PATCH 246/758] decomp: clarify names in prepare_target_level_transition i20 -> transition_mode: A_0028ed58.i20 is the shared transition selector at 0x0013E050: retail 0x0028edb0 initializes it to 0 and 0x0028ee90 selects 3 after saving and recording a different target level. The same underlying record's x20 is set from audio_selection_mode in initialize_level_transition_with_audio, and prepare_level_entry_transition initializes it to 0. These state-selection uses support transition_mode without assigning meanings to every numeric mode. i34 -> scaled_sequence_position: C_0028ed58.i34 receives scale_game_frames(transition_sequence_positions[shared_state_record->h26]); retail 0x0028ee10-0x0028ee34 indexes the position table and invokes 0x001fef20, then 0x0028ee3c stores its result at +0x34. That value is divided by the PAL-selected 80/96 to derive sequence index +0x3C and remainder +0x38 (0x0028ee38-0x0028ee70), proving scaled sequence-position storage. i38 -> sequence_position_remainder: C_0028ed58.i38 is assigned scaled_sequence_position % divisor in the supplied C. Retail 0x0028ee58 reloads shared result +0x34; 0x0028ee64 divides by PAL-selected 80/96 and 0x0028ee68/0x0028ee70 stores mfhi at +0x38. The corresponding quotient indexes sequence entries through checked helper 0x00245720, so this field stores the remaining sequence position after that division, without assuming time units. i3C -> sequence_entry_index: Retail 0x0028ee38/0x0028ee48 computes the quotient of scaled sequence position by PAL-selected 80/96; 0x0028ee54 stores it into C_0028ed58.i3C and the same value is passed to parse_space_scene_chunk at 0x0028ee50. Checked level-00 helper 0x00245720 shifts this argument by 2 at 0x00245724 and loads shared record +0x60 plus that displacement at 0x00245738-0x0024573c, proving an index into sequence entries. --- .../initialize_level_transition_with_audio.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 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 0465ed0b2a..e0c6230b55 100644 --- a/src/overlays/shared/game/initialize_level_transition_with_audio.c +++ b/src/overlays/shared/game/initialize_level_transition_with_audio.c @@ -217,7 +217,7 @@ void prepare_level_transition_with_help_cleanup(void) { typedef struct { u8 p[0x20]; - s32 i20; + s32 transition_mode; s16 h24; s16 h26; } A_0028ed58; @@ -235,9 +235,9 @@ extern B_0028ed58 D_L00_00173E00_0028ed58 __asm__("D_L00_00173E00") typedef struct { u8 p[0x34]; - s32 i34; - s32 i38; - s32 i3C; + s32 scaled_sequence_position; + s32 sequence_position_remainder; + s32 sequence_entry_index; u8 p2[0x18]; s32 i58; s32 i5C; @@ -257,7 +257,7 @@ void prepare_target_level_transition(s32 target_level_index) { D_L00_0015F5C4 = 6; fade_level = 1.0f; D_L00_0015F400 = 0; - shared_state_record->i20 = 0; + shared_state_record->transition_mode = 0; shared_state_record->h24 = -1; select_level_vu_chain(); shared_table_offset = D_L00_001611CC - 0x60000; @@ -269,15 +269,15 @@ void prepare_target_level_transition(s32 target_level_index) { s32 divisor; initialize_level_transition_with_audio(8); divisor = pal_mode ? 0x50 : 0x60; - shared_result_record->i34 = + shared_result_record->scaled_sequence_position = scale_game_frames(transition_sequence_positions[shared_state_record->h26]); - shared_result_record->i3C = shared_result_record->i34 / divisor; - parse_space_scene_chunk(shared_result_record->i3C); - shared_result_record->i38 = shared_result_record->i34 % divisor; + shared_result_record->sequence_entry_index = shared_result_record->scaled_sequence_position / divisor; + parse_space_scene_chunk(shared_result_record->sequence_entry_index); + shared_result_record->sequence_position_remainder = shared_result_record->scaled_sequence_position % divisor; } else { memcard_save_data(0, target_level_index); D_L00_0015F5C0 = target_level_index; - shared_state_record->i20 = 3; + shared_state_record->transition_mode = 3; shared_state_record->h24 = -1; } } From 0b51e5e118313abfea40a661779c816c555b2c1f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:36:57 +0000 Subject: [PATCH 247/758] decomp: clarify names in spawn_crate_debris i20 -> rotation_step_x: Retail 0x002af910 loads debris private data into s0, and 0x002af998 writes zero to +0x20; original Ghidra expresses this as piVar1[8] = 0, matching debris_data->i20 = 0. In the authoritative supplied update source, the corresponding PV.f20 is passed to fast_add_rotations(fragment_moby->f40, pv->f20), while neighboring f24/f28 advance f44/f48. Spawn writes initial_rotation to moby+0x40 at 0x002af95c-0x002af964, the same three components previously assigned rot.x/y/z. The update also resets f20 to 0.0f on bounce. These operations establish the X rotation step, beyond the shared offset alone. --- 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 d90f62217e..1d24c42f10 100644 --- a/src/overlays/shared/pickups/crate_fragment.c +++ b/src/overlays/shared/pickups/crate_fragment.c @@ -22,7 +22,7 @@ typedef struct { float f4, f8; short hc, he; unsigned char p10[0x10]; - int i20; + int rotation_step_x; float f24, f28; } V_2af8b0; @@ -168,7 +168,7 @@ unsigned char *spawn_crate_debris(unsigned char *debris_source_moby, debris_data->f4 = MOBY(debris_moby)->pos.z; { short t = FUN_001f96f8_2af8b0(0x14); - debris_data->i20 = 0; + debris_data->rotation_step_x = 0; debris_data->he = t; } debris_data->f24 = From 2fbd0e7124c13b97a7f47838917a389b0072128f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:37:01 +0000 Subject: [PATCH 248/758] decomp: clarify names in morphoray_target_effect_update b20 -> moby_state: In O_002d7f88 the byte belongs to the linked class-0xB9 moby: retail 0x002d8000-0x002d8010 loads the linked object and checks its class; 0x002d8018 loads its +0x20 byte, and 0x002d801c-0x002d8024 rejects states FE/FD by branching to follower removal at 0x002d802c. The SHA-bound C expresses the same o->b20 state comparisons, proving this is the linked moby's state selector. b23 -> fade_level: The SHA-bound C writes follower_moby->b23 only after moby_data->f4 exceeds D_L00_001616DC, calculating (1-(f4-limit)*10)*127. Original Ghidra writes the same truncated expression to self+0x23; retail 0x002d808c-0x002d80d4 performs the threshold, decreasing ramp, conversion and byte store. Thus this byte is the effect's computed fade level, without assuming a renderer channel. v8 -> removal_timer: In D_002d7f88, v8 is the four-byte storage passed to fast_dec_timer in the SHA-bound source. Retail 0x002d7fc4 passes s2+8 to the timer helper at 0x002d7fcc; 0x002d7fd4 branches on its nonzero return directly to mark_moby_for_removal at 0x002d802c. Original Ghidra likewise passes piVar1+2 and removes the follower on nonzero return, proving the timer controls removal. --- .../shared/weapons/morphoray_target_effect.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/weapons/morphoray_target_effect.c b/src/overlays/shared/weapons/morphoray_target_effect.c index b85f56a270..1c91f809ff 100644 --- a/src/overlays/shared/weapons/morphoray_target_effect.c +++ b/src/overlays/shared/weapons/morphoray_target_effect.c @@ -10,7 +10,7 @@ typedef struct { u8 pad[0x20]; - u8 b20; + u8 moby_state; u8 pad2[0x40 - 0x21]; OvlQuad q40; u8 pad3[0x78 - 0x50]; @@ -22,7 +22,7 @@ typedef struct { typedef struct { O_002d7f88 *o; f32 f4; - u8 v8[4]; + u8 removal_timer[4]; f32 fC; } D_002d7f88; @@ -31,7 +31,7 @@ typedef struct { u8 v10[4]; f32 f14; u8 pad2[0x23 - 0x18]; - u8 b23; + u8 fade_level; u8 pad3[0x2C - 0x24]; f32 f2C; u8 pad4[0x40 - 0x30]; @@ -69,10 +69,10 @@ void morphoray_target_effect_update(S_002d7f88 *follower_moby) { void *linked_moby_data; f32 scale_coefficient; moby_data->f4 += (D_L00_001616DC + D_L00_001616DC) * frame_time; - if (fast_dec_timer(moby_data->v8) != 0 || D_L00_001616DC * 1.1f <= moby_data->f4) + if (fast_dec_timer(moby_data->removal_timer) != 0 || D_L00_001616DC * 1.1f <= moby_data->f4) goto kill; o = moby_data->o; - if (o == 0 || o->hA6 != 0xB9 || o->b20 == 0xFE || o->b20 == 0xFD) { + if (o == 0 || o->hA6 != 0xB9 || o->moby_state == 0xFE || o->moby_state == 0xFD) { kill: mark_moby_for_removal(follower_moby); return; @@ -84,7 +84,7 @@ void morphoray_target_effect_update(S_002d7f88 *follower_moby) { fast_vec_add(follower_moby->v10, follower_moby->v10, linked_moby_data); qcopy(&follower_moby->q40, &moby_data->o->q40); if (moby_data->f4 > D_L00_001616DC) { - follower_moby->b23 = + follower_moby->fade_level = truncate_float_to_s32((1.0f - (moby_data->f4 - D_L00_001616DC) * 10.0f) * 127.0f); } scale_coefficient = moby_data->fC; From fa76e5d33e723087259e7ac37aca2251d9b665ee Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:39:09 +0000 Subject: [PATCH 249/758] decomp: clarify names in update_sound_emitter_playback_by_distance b74 -> is_active: E_2ed950 is the 0x70-stride voice-slot view. Retail 0x002ed9d0-0x002ed9e0 compares slot owner +0x8C to sound_emitter and returns on a nonzero byte at +0x74, suppressing duplicate playback. Retail 0x002eda94-0x002edab0 again requires matching ownership and nonzero +0x74 before release_voice_slot. Supplied C expresses both checks as e->o == sound_emitter && e->b74. Together these uses establish the byte as the slot activity predicate, supporting is_active without asserting any particular nonzero encoding. --- src/overlays/shared/audio/emitters/distance_emitter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/audio/emitters/distance_emitter.c b/src/overlays/shared/audio/emitters/distance_emitter.c index 51f9982980..7e1502ac84 100644 --- a/src/overlays/shared/audio/emitters/distance_emitter.c +++ b/src/overlays/shared/audio/emitters/distance_emitter.c @@ -19,7 +19,7 @@ typedef struct { typedef struct { u8 p[0x74]; - u8 b74; + u8 is_active; u8 p2[0x8C - 0x75]; void *o; } E_2ed950; @@ -67,7 +67,7 @@ void update_sound_emitter_playback_by_distance(u8 *sound_emitter) { s32 four = 4; if (D_L00_0015F5F4_2ed950[playback_state->id].b18) fl = four; - if (e->o == sound_emitter && e->b74) + if (e->o == sound_emitter && e->is_active) return; if (!fast_dec_timer(&playback_state->wC)) return; @@ -82,7 +82,7 @@ void update_sound_emitter_playback_by_distance(u8 *sound_emitter) { s32 voice_slot_index = playback_state->snd; if (voice_slot_index != -1) { E_2ed950 *e = ENT_2ed950(voice_slot_index); - if (e->o == sound_emitter && e->b74) + if (e->o == sound_emitter && e->is_active) release_voice_slot(voice_slot_index); } playback_state->snd = -1; From 3144ea492f6e37cbcd9f68144ce2e53cd42e98b4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:39:13 +0000 Subject: [PATCH 250/758] decomp: clarify names in update_randomized_moby_point_attached_particle b5 -> offset_length_jitter_percent: In S_274818, b5 is loaded unsigned at retail 0x002748CC from 0x5(s3), where s3=particle+0x30. The call at 0x002748C8 converts it to float; 0x002748D0-0x002748D8 use its negative and positive as random_float_between bounds. At 0x002748F0-0x00274900 the sample is divided by 100, reduced by 1, and multiplied by attachment_data->unkC to supply fast_vec_normalize's length for attachment_offset. At 0x00274904-0x00274910 that offset is added to attachment_position into particle+0x20. The bound C and original Ghidra fVar4 flow agree: b5 controls symmetric percentage jitter of the attachment offset length. --- 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 58a14210fd..36803e2630 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -1676,7 +1676,7 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { typedef struct { void *o; u8 b4; - u8 b5; + u8 offset_length_jitter_percent; s16 h6; float unk8; float unkC; @@ -1702,7 +1702,7 @@ void update_randomized_moby_point_attached_particle(struct EffectParticle *parti save = *(float *)(particle->data + 0xC); moby_point_position(attachment_data->o, attachment_data->b4, attachment_position); build_moby_bone_transform(attachment_data->o, attachment_data->b4, attachment_vector_scratch); - x = convert_integer_to_float(attachment_data->b5); + x = convert_integer_to_float(attachment_data->offset_length_jitter_percent); x = random_float_between(-x, x); fast_vec_normalize( &attachment_offset, attachment_vector_scratch, (x / 100.0f - one) * attachment_data->unkC); From 097770c69650c68bf2c62fe227cd4e17e717d9d3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:39:16 +0000 Subject: [PATCH 251/758] decomp: clarify names in draw_backdrop_mesh f38 -> translation_z: In draw_backdrop_mesh, set_identity_matrix initializes backdrop_draw_transform, then f38 receives moby_breakup_z_offset_gp before draw_geometry_quad consumes that transform. Retail 0x00300428/0x00300474 initializes the matrix at sp+0x90; 0x0030048c loads the Z offset and 0x003004a4 stores it at sp+0xc8 (matrix+0x38); 0x0030053c/0x00300540 passes the matrix to draw. Ghidra shows auStack_f0 initialized and uStack_b8 set from uGpffffb44c before that same draw. The supplied effect_quad_draw_single independently expresses the same identity-transform assignment as backdrop_quad_transform_matrix[3][2] = moby_breakup_z_offset_gp, proving translation Z rather than merely an offset-based name. --- src/overlays/l06/mobys/breakable_window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l06/mobys/breakable_window.c b/src/overlays/l06/mobys/breakable_window.c index 15a8192d0e..3db0ffd421 100644 --- a/src/overlays/l06/mobys/breakable_window.c +++ b/src/overlays/l06/mobys/breakable_window.c @@ -67,7 +67,7 @@ typedef struct { typedef struct { char pad[0x38]; - float f38; + float translation_z; int pad3c; } B3003f0; @@ -792,7 +792,7 @@ void draw_backdrop_mesh(void) { quad.unk70 = 0; set_identity_matrix(&backdrop_draw_transform); shared_quad_vertex_color = l06_backdrop_mesh_vertex_color; - backdrop_draw_transform.f38 = moby_breakup_z_offset_gp; + backdrop_draw_transform.translation_z = moby_breakup_z_offset_gp; quad.color[3] = shared_quad_vertex_color; quad.color[2] = shared_quad_vertex_color; quad.color[1] = shared_quad_vertex_color; From f50c389cc2c619319d92c6c087d497b971b7997b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:39:20 +0000 Subject: [PATCH 252/758] decomp: clarify names in apply_cutscene_camera_key i38 -> camera_key_index: Retail 0x00298e10 loads cutscene +0x38 (DAT_0016c898), 0x00298e18 shifts it left five, and 0x00298e14/0x00298e24 add that displacement to the +0x54 key-array pointer (DAT_0016c8b4). Original Ghidra expresses DAT_0016c8b4 + DAT_0016c898 * 0x20. Authoritative C uses H_298de8.i38 * 32 to select camera_key; the selected record's position is copied into l00_camera_lui.pos at 0x00298e5c..0x00298e60 and its +0x10/+0x14/+0x18 values drive camera rotation at 0x00298e6c..0x00298e98. These uses prove a camera-key index, beyond the member offset alone. Caller update_cutscene_playback increments the same +0x38 counter before applying the camera key. --- 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 fcc4644961..e75f8b4664 100644 --- a/src/overlays/shared/cutscenes/update_cutscene_playback.c +++ b/src/overlays/shared/cutscenes/update_cutscene_playback.c @@ -562,7 +562,7 @@ void finish_cutscene(void) { typedef struct { char pad[0x38]; - int i38; + int camera_key_index; char pad2[0x54 - 0x3C]; char *p54; } H_298de8; @@ -585,7 +585,7 @@ int apply_cutscene_camera_key(void) __asm__("FUN_L00_00298de8"); int apply_cutscene_camera_key(void) { float camera_key_rotation_matrix[16] __attribute__((aligned(16))); OvlQuad camera_offset[1]; - char *camera_key = D_L00_0016C860_298de8.p54 + D_L00_0016C860_298de8.i38 * 32; + char *camera_key = D_L00_0016C860_298de8.p54 + D_L00_0016C860_298de8.camera_key_index * 32; float *camera_key_values = (float *)(camera_key + 0x10); int camera_key_flag = *(unsigned char *)(camera_key + 0xC); char *x = D_L00_0016CA40_lui; From c572140ba1798e50324199e267bc5034e5a6fb56 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:41:12 +0000 Subject: [PATCH 253/758] decomp: clarify names in replenish_hero_drones b1FF5 -> pending_drone_replenishment: Retail 0x002cdcf0 clears hero+0x1FF5 on entry. The supplied caller at 0x002103f0 and hero_switch_item/apply_hero_item_slot_selection excerpts call replenish_hero_drones only when this byte is nonzero, then clear pending item selection. It is the pending request consumed by replenishment. b1FF6 -> active_drone_count: Retail 0x002cdd20-0x002cdd2c tests hero+0x1FF6 against six, and 0x002cde08-0x002cde48 seeds the loop that spawns the missing drones. Supplied spawn_hero_drone increments player->ammo_used after allocation; drone_update decrements the corresponding DroneSlots ammo_used byte at removal. This counts active drones. f98 -> drone_launch_yaw: Retail 0x002cdd04-0x002cdd30 loads hero+0x98 into the checked cosine and sine helpers, multiplies each by 0.25, and stores the horizontal components of initial_drone_velocity. At 0x002cde34-0x002cde3c that vector is copied into each spawned drone's movement pvars; the float supplies its launch yaw. p2080 -> hero_moby: Retail 0x002cddcc and 0x002cddf4 load hero+0x2080, then use pointee+0xE0 and pointee+0xC0 as vectors added to hero_position for the spawn location. The supplied drone_update uses the matching hero-relative orbit origin with (u8 *)hero.moby + 0xE0, identifying this pointer as the hero moby rather than a generic buffer. v80 -> hero_position: Retail 0x002cdde8 supplies hero+0x80 to vector addition at 0x002cddec, then 0x002cde00 adds the second moby offset to form drone_spawn_position passed at 0x002cde20. Supplied drone_update uses the parallel expression add_vector_xyz(&target_pos, &hero.motion, (u8 *)hero.moby + 0xE0), and spawn_hero_drone accesses player->motion.pos as the hero position. This four-float vector is the hero position. --- src/overlays/shared/weapons/drone.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/shared/weapons/drone.c b/src/overlays/shared/weapons/drone.c index 4d7128935a..967cfb1189 100644 --- a/src/overlays/shared/weapons/drone.c +++ b/src/overlays/shared/weapons/drone.c @@ -19,14 +19,14 @@ typedef unsigned int u128_2cdcc0 __attribute__((mode(TI), aligned(16))); typedef struct { unsigned char pad0[0x80]; - float v80[4]; + float hero_position[4]; unsigned char pad90[8]; - float f98; + float drone_launch_yaw; unsigned char pad9c[0x1FF5 - 0x9C]; - unsigned char b1FF5; - unsigned char b1FF6; + unsigned char pending_drone_replenishment; + unsigned char active_drone_count; unsigned char pad1ff7[0x2080 - 0x1FF7]; - unsigned char *p2080; + unsigned char *hero_moby; } P_2cdcc0; typedef struct { @@ -165,12 +165,12 @@ void replenish_hero_drones(void) { float drone_spawn_position[4] __attribute__((aligned(16))); struct Moby *spawned_moby; int i; - hero_state->b1FF5 = 0; + hero_state->pending_drone_replenishment = 0; if (get_ammo(0x18)) { - initial_drone_velocity[0] = FUN_001f9dc8_2cdcc0(hero_state->f98) * 0.25f; - initial_drone_velocity[1] = FUN_001f9de0_2cdcc0(hero_state->f98) * 0.25f; + initial_drone_velocity[0] = FUN_001f9dc8_2cdcc0(hero_state->drone_launch_yaw) * 0.25f; + initial_drone_velocity[1] = FUN_001f9de0_2cdcc0(hero_state->drone_launch_yaw) * 0.25f; initial_drone_velocity[2] = 0.25f; - if (hero_state->b1FF6 < 6) { + if (hero_state->active_drone_count < 6) { FUN_L00_00233db8_2cdcc0(0x18, 1); usage_stats = (S_2cdcc0 *)item_usage; if (usage_stats->hC0 < 0xFFFF) { @@ -181,10 +181,10 @@ void replenish_hero_drones(void) { } usage_stats->wC4 = usage_stats->wC4 | (1 << current_level_index) | 0x80000000; - FUN_001f9a10_2cdcc0(drone_spawn_position, hero_state->v80, hero_state->p2080 + 0xE0); + FUN_001f9a10_2cdcc0(drone_spawn_position, hero_state->hero_position, hero_state->hero_moby + 0xE0); FUN_001f9a10_2cdcc0( - drone_spawn_position, drone_spawn_position, hero_state->p2080 + 0xC0); - for (i = hero_state->b1FF6; i < 6; i++) { + drone_spawn_position, drone_spawn_position, hero_state->hero_moby + 0xC0); + for (i = hero_state->active_drone_count; i < 6; i++) { spawned_moby = FUN_L00_002ce1f0_2cdcc0(spawned_moby, drone_spawn_position); if (spawned_moby) { qcopy(((void *)spawned_moby->pvars), initial_drone_velocity); From 7d3c8d0bbac6a52e4eefa2b3d7cfc26249a97f81 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:44:05 +0000 Subject: [PATCH 254/758] decomp: clarify names in scatter_moby_from_hazards b20 -> pickup_moby_state: Retail 0x002df220 loads the pickup moby's byte at +0x20 with lbu v1,0x20(s0); 0x002df224-0x002df230 compare it with 0xFE and 0xFD and return before random/class/distance gates or collection. Original Ghidra shows the same -2/-3 byte checks. The authoritative C maps these accesses to O_2df1e0.b20; process_moby_suck_cannon_suction, store_moby_in_suck_cannon and cancel_suck_cannon_suction apply identical 0xFE/0xFD rejection to MOBY(moby)->state, and the supplied SuckMoby layout names its +0x20 member state. Thus this member is the pickup moby's state, not a class or collection flag. --- 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 579a8eb411..0cd280fd95 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -457,7 +457,7 @@ typedef struct { typedef struct { u8 pad[0x10]; u8 v10[0x10]; - u8 b20; + u8 pickup_moby_state; u8 pad2[3]; T_2df1e0 *p24; } O_2df1e0; @@ -3247,9 +3247,9 @@ void scatter_moby_from_hazards(O_2df1e0 *pickup_moby) { f32 beam_segment_collection_radius; if (pickup_moby == 0) return; - if (pickup_moby->b20 == 0xFE) + if (pickup_moby->pickup_moby_state == 0xFE) return; - if (pickup_moby->b20 == 0xFD) + if (pickup_moby->pickup_moby_state == 0xFD) return; if (random_integer_below(10)) return; From ab43d0c49f8ab125d7d8b3f431b2b03bd24de185 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:44:09 +0000 Subject: [PATCH 255/758] decomp: clarify names in update_falling_effect_particle unk0A -> ground_test_mode: In update_falling_effect_particle, the s16 FallingParticle member is used exclusively in particle->unk0A != 2 guarding changed-cell ground sampling and probe-height culling. Retail 0x00268e28 loads lh v1,0xa(s0), 0x00268e2c loads 2, and 0x00268e30 branches on equality to 0x00268ec0, bypassing cell comparisons, ground_height_at calls at 0x00268e68/0x00268e90, and the probe.z comparison/free path at 0x00268e9c-0x00268eb4. Original Ghidra likewise guards these operations with *(short *)(iVar2 + 10) != 2. This establishes a ground-test selector, not a boolean or a timer in this particle type. --- src/overlays/shared/rendering/effects/register_part_types.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/rendering/effects/register_part_types.c b/src/overlays/shared/rendering/effects/register_part_types.c index 5299be90b1..a52a348a13 100644 --- a/src/overlays/shared/rendering/effects/register_part_types.c +++ b/src/overlays/shared/rendering/effects/register_part_types.c @@ -120,7 +120,7 @@ void register_part_types(void) { */ typedef struct { u8 pad_00[0xA]; - s16 unk0A; /* 2 skips the ground test (a timer in sibling kinds) */ + s16 ground_test_mode; /* 2 skips the ground test (a timer in sibling kinds) */ u8 pad_0C[4]; Vec4 pos; /* 0x10: drawn position */ Vec4 probe; /* 0x20: point tested against the ground */ @@ -156,7 +156,7 @@ void update_falling_effect_particle(FallingParticle *particle) { fast_vec_add(&step, vel, &particle_drift); fast_vec_add(&particle->probe, &particle->probe, &step); fast_vec_add(&particle->pos, &particle->pos, &step); - if (particle->unk0A != 2) { + if (particle->ground_test_mode != 2) { if (cell_x != (s32)particle->probe.f[0] || cell_y != (s32)particle->probe.f[1]) { ground_test_probe.q = particle->probe.q; if (ground_height_at(&ground_test_probe) < particle_min_ground) { From 1f94923f7f2cd499209dbfacc5d0e6c3c359afde Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:46:40 +0000 Subject: [PATCH 256/758] decomp: clarify names in apply_hero_moby_scale b1 -> manipulator_attached: Assigned retail 0x00234b8c-0x00234ba4 tests scale_state byte +1 and calls established attach_manipulator only when zero. Checked helper 0x0024f590/594 repeats the guard, 0x0024f5a4/5ac sets this byte to 1, and 0x0024f5f4-0x0024f5fc links this same block into scale_owner_moby+0x64. Thus the byte marks the manipulator as attached and prevents duplicate insertion; it is not inferred from its offset alone. f24 -> scale_component: Authoritative apply_hero_moby_scale assigns scale_factor to scale_state->f20, ->f24 and ->f28 after attach_manipulator. Original Ghidra DAT_0017c364 = fVar7 and retail swc1 f20,0x24(s0) at 0x00234bb0 confirm this member receives the same scale_factor loaded at 0x00234b60 and capped to 1.33 at 0x00234b64-80. Checked helper 0x0024f59c-0x0024f5c0 initializes this float and its adjacent scale components to 1.0. Together the established scaling operation and equal component writes prove a scale component, without claiming an unverified axis. --- 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 59b4f9c21f..a8c4065fba 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1805,10 +1805,10 @@ extern f32 D_0015EE14 __asm__("D_0015EE14"); typedef struct { u8 b0; - u8 b1; + u8 manipulator_attached; u8 p[0x1E]; f32 f20; - f32 f24; + f32 scale_component; f32 f28; } A_00234b38; @@ -1833,10 +1833,10 @@ void apply_hero_moby_scale(void *scale_owner_moby) { if (D_L00_0015F5C4_00234b38[0] == 6 && 1.33f < scale_factor) scale_factor = 1.33f; scale_state = &D_L00_0017C340_00234b38; - if (scale_state->b1 == 0) { + if (scale_state->manipulator_attached == 0) { attach_manipulator(scale_owner_moby, 0x18, scale_state); scale_state->f20 = scale_factor; - scale_state->f24 = scale_factor; + scale_state->scale_component = scale_factor; scale_state->f28 = scale_factor; } level_index = current_level_index; From 6e54f0facf41ce0ce87d8b754c81984df5e83c05 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:46:44 +0000 Subject: [PATCH 257/758] decomp: clarify names in camera_object_update f98 -> hero_yaw: Source sets pos = &hero.motion.pos and P = (G_2a4e48 *)(pos - 0x80), establishing hero ownership. Retail 002a4e98 forms hero position 0x0013f3d0 and 002a4ea8 derives s1 by subtracting 0x80. At 002a4f38 lwc1 f12,0x98(s1) supplies this field to fast_difference_between_rotations (jal 002001f0 at 002a4f34), while 002a4f30 supplies camera yaw from 0x158(s5). The source explicitly expresses fast_difference_between_rotations(P->f98, C->yaw), followed by comparison with 2.3561945 radians at 002a4f4c, supporting hero_yaw rather than an offset-only name. --- src/overlays/shared/mobys/camera_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/mobys/camera_object.c b/src/overlays/shared/mobys/camera_object.c index 7bc072a24d..715de57e6d 100644 --- a/src/overlays/shared/mobys/camera_object.c +++ b/src/overlays/shared/mobys/camera_object.c @@ -12,7 +12,7 @@ typedef struct { char p0[0x98]; - float f98; + float hero_yaw; char p1[0x164 - 0x9C]; float f164; char p2[0x2080 - 0x168]; @@ -69,7 +69,7 @@ void camera_object_update(char *camera_object) { if (absolute_float(dot_product_or_threshold) < 2.5f) { dot_product_or_threshold = 0.1f; if (fast_vec_length(difference_vector) < dot_product_or_threshold || - fast_difference_between_rotations(P->f98, C->yaw) < 2.3561945f || + fast_difference_between_rotations(P->hero_yaw, C->yaw) < 2.3561945f || P->f164 < frame_time * dot_product_or_threshold) { *(float *)(camera_object + 0x18) = 15.0f; *(float *)(camera_object + 0x14) = 15.0f; From 3c4515862a1411c8fd603e7ae0ed110064ae14de Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:46:48 +0000 Subject: [PATCH 258/758] decomp: clarify names in select_camera_mode_by_hero_vector_alignment s7E -> selected_camera_mode: In the authoritative source select_camera_mode_by_hero_vector_alignment, A_2ea810 *camera_object supplies the camera vector and receives s7E=4 only when pi/2 minus the residual normalized-dot asin reaches 1.3962634 radians; otherwise s7E=2. Retail preserves the argument in s2 at 0x002ea850, compares the alignment angle at 0x002ea968-974, and stores mode 4 to 0x7E(s2) at 0x002ea984. The zero-global and fallback branches store mode 2 to the same member at 0x002ea884 and 0x002ea99c. These alternative stores in the established camera-mode selector prove this short is the selected camera mode, rather than deriving semantics from its offset alone. --- src/overlays/shared/camera/hero_aligned_camera.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/camera/hero_aligned_camera.c b/src/overlays/shared/camera/hero_aligned_camera.c index 044d019663..5b9fb01f8f 100644 --- a/src/overlays/shared/camera/hero_aligned_camera.c +++ b/src/overlays/shared/camera/hero_aligned_camera.c @@ -93,7 +93,7 @@ typedef struct { typedef struct { unsigned char pad0[0x7E]; - short s7E; + short selected_camera_mode; } A_2ea810; extern void FUN_001f9bf8_002e9cc0(void *, void *, float) __asm__("FUN_001f9bf8"); @@ -551,7 +551,7 @@ void select_camera_mode_by_hero_vector_alignment(A_2ea810 *camera_object) { } if (Q.unk270 == 0) { Q.unk273 = 0; - camera_object->s7E = 2; + camera_object->selected_camera_mode = 2; Q.unk294 = 0.018f; Q.unk288 = 0.018f; return; @@ -572,13 +572,13 @@ void select_camera_mode_by_hero_vector_alignment(A_2ea810 *camera_object) { residual_length_product); if (1.5707964f - dot_product_or_asin_result >= 1.3962634f) { Q.unk270 = 0; - camera_object->s7E = 4; + camera_object->selected_camera_mode = 4; return; } } } Q.unk273 = 0; - camera_object->s7E = 2; + camera_object->selected_camera_mode = 2; Q.unk294 = 0.018f; Q.unk288 = 0.018f; } From 2a30c4f29cccca3ebb16ee9cbe52ea02ab95d86b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:46:51 +0000 Subject: [PATCH 259/758] decomp: clarify names in draw_moby_offset_textured_quad unk64 -> corner_2_texture_t: Bound C SHA-256 e969abe78cd8a329ab08f2163c6d79ca1211012c81b498ebafd9c7e370dffe1e assigns local.quad.unk64=0; original Ghidra uStack_12c=0 and retail 0030c054 sw zero,0x64(sp) agree. The adjacent eight words at +0x50..+0x6c encode (0,0),(0,1),(1,0),(1,1). Assigned 0030c168 passes this quad to checked level-01 consumer 0021ee28. That consumer retains a0 in s2 at 0021eed4, loads +0x60..+0x6c into vf15 at 0021f1e8, and multiplies vf15.xy by Q at 0021f1f4, with Q computed from third corner vf12.w at 0021f19c. Thus +0x64 is the second component (T) of corner 2's S,T pair. 0021f2ac/0021f2b0 writes the low pair to packet +0x88, alongside corner 2 projected position at +0x98/+0x9c and color/Q at +0x90; the GIF register sequence built at 0021f160-0021f188 includes ST/RGBAQ/XYZF2 per vertex. This consumer data flow proves texture T rather than merely assigning an offset-derived name. Evidence request 9e5ff53b47c04d60ab8e92750a53bdd4, report SHA-256 99e76a9fc9196f62bc96c4cd28e6436c17947e9cfd5c45540b8097a11a6185da. --- src/overlays/shared/enemies/plasmabot_death_debris.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot_death_debris.c b/src/overlays/shared/enemies/plasmabot_death_debris.c index d7de1045ce..cb2e4c5a1b 100644 --- a/src/overlays/shared/enemies/plasmabot_death_debris.c +++ b/src/overlays/shared/enemies/plasmabot_death_debris.c @@ -214,7 +214,7 @@ typedef struct { u32 color[4]; s32 unk50, unk54, unk58; f32 unk5C, unk60; - s32 unk64; + s32 corner_2_texture_t; f32 unk68, unk6C; s64 unk70, tex, unk80, unk88; } GlowQuad_bfa8; @@ -264,7 +264,7 @@ void draw_moby_offset_textured_quad(char *moby) { local.quad.unk58 = 0; local.quad.unk5C = one; local.quad.unk60 = one; - local.quad.unk64 = 0; + local.quad.corner_2_texture_t = 0; local.quad.unk68 = one; local.quad.unk6C = one; From 370a10e85193f7b420f9aba99c5aab159f7f8593 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:46:55 +0000 Subject: [PATCH 260/758] decomp: clarify names in initialize_wind_spark f440 -> spark_step_distance: Retail 0x002eb4c8-0x002eb4f8 samples the established wind spark speed range, multiplies by frame_time, and stores the float at pvars+0x440+i*4. Retail 0x002eb4fc-0x002eb508 divides twice the longitudinal extent by this same distance for lifetime. The supplied update_wind_sparks scales spark_travel_direction by f440[i] and adds the resulting spark_position_delta directly to pos, proving this 48-element array holds each spark's travel distance per update. i504 -> spark_area_cuboid_index: Retail 0x002eb3fc loads pvars+0x504, 0x002eb410 shifts it by 7 to index 0x80-byte cuboids, and 0x002eb414-0x002eb420 copies the selected cuboid center at +0x30 into pos[i]. The authoritative C expresses this as l14_cuboids[spark_vars->i504].pos. Supplied update_wind_sparks also passes i504 to is_point_inside_clip_volume for the hero position, then uses that containment result to control spark respawn and lifetime limiting. It therefore identifies the spark area cuboid, rather than a per-spark index or pointer. --- src/overlays/l14/mobys/wind_control.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l14/mobys/wind_control.c b/src/overlays/l14/mobys/wind_control.c index 714e76faf6..c7673a463b 100644 --- a/src/overlays/l14/mobys/wind_control.c +++ b/src/overlays/l14/mobys/wind_control.c @@ -182,9 +182,9 @@ typedef struct { short n320[48]; short n380[48]; short n3E0[48]; - float f440[48]; + float spark_step_distance[48]; int pad500; - int i504; + int spark_area_cuboid_index; } Spk_k; int wind_spark_speed_range_start_gp __asm__("D_L14_00161C30") = 15; @@ -210,7 +210,7 @@ void initialize_wind_spark(struct Moby *wind_control_moby, int i, void *spark_tr up[1] = 0.0f; up[3] = 0.0f; fast_vec_cross(side, fwd, up); - qcopy(spark_vars->pos[i], &l14_cuboids[spark_vars->i504].pos); + qcopy(spark_vars->pos[i], &l14_cuboids[spark_vars->spark_area_cuboid_index].pos); x = -spark_vars->f14; y = randf_sym(0.0f, spark_vars->f18); z = randf_sym(0.0f, spark_vars->f1C); @@ -223,10 +223,10 @@ void initialize_wind_spark(struct Moby *wind_control_moby, int i, void *spark_tr fast_vec_add(spark_position, spark_position, position_offset); spark_vars->pos[i][3] = random_float_between(wind_spark_size_range_start_gp, wind_spark_size_range_end_gp); - spark_vars->f440[i] = + spark_vars->spark_step_distance[i] = random_float_between(wind_spark_speed_range_start_gp, wind_spark_speed_range_end_gp) * frame_time; - lifetime_frames = scale_game_frames(ftoi_k(spark_vars->f14 * 2.0f / spark_vars->f440[i])); + 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; @@ -257,7 +257,7 @@ void update_wind_sparks(struct Moby *wind_control_moby) { spark_travel_direction[2] = 0.0f; qcopy(clip, &hero.motion.pos); clip[2] += 1.0f; - in_clip = is_point_inside_clip_volume(clip, spark_vars->i504); + 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; @@ -289,7 +289,7 @@ void update_wind_sparks(struct Moby *wind_control_moby) { *shade = spark_alpha; } } - fast_vec_scale(spark_position_delta, spark_travel_direction, spark_vars->f440[i]); + fast_vec_scale(spark_position_delta, spark_travel_direction, spark_vars->spark_step_distance[i]); fast_vec_add(pos, pos, spark_position_delta); if (in_clip != 0 && absolute_float(pos[0] - l14_camera.pos.f[0]) < 8.0f && absolute_float(pos[1] - l14_camera.pos.f[1]) < 8.0f && From 7b5b2fdf10ba07a1a89e23de9b369e8ed26d60be Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:49:07 +0000 Subject: [PATCH 261/758] decomp: clarify names in apply_hero_reference_tilt b20B3 -> reference_tilt_mode: Retail 0x00216484-0x002164a4 tests this byte for 2 to select a negated alternate reference; 0x002164a8-0x002164b0 tests it for 1, and 0x0021653c-0x00216550 gates orientation-related position correction on mode 1. Supplied update_hero_tilt dispatches apply_hero_reference_tilt for reference orientation modes 1 and 2. This proves a reference-tilt mode selector. v270 -> primary_tilt_reference_vector: Retail 0x0021647c-0x00216490 copies this 16-byte member into sp+0x40, the supplied C reference_vector. It is reloaded at 0x002164cc/0x002164e4-0x002164e8 and passed at 0x00216524-0x00216534 to compute_hero_reference_tilt_rotation. It is the primary reference vector used for the tilt calculation; its physical origin is not claimed. v290 -> alternate_tilt_reference_vector: When the selector equals 2, retail 0x00216494-0x002164a4 supplies -1.0 and the address of this member to the vector scale helper, replacing the primary reference at sp+0x40. The resulting negated vector feeds compute_hero_reference_tilt_rotation at 0x00216524-0x00216534. This proves the alternate tilt reference role without asserting a surface or gravity meaning. v80 -> hero_position: Retail 0x00216568-0x00216588 updates this member in place by subtracting transformed_position_offset and adding original_position_offset. Both start as local z=0.8 vectors, transformed using the new and original hero orientation matrices. Original Ghidra identifies the destination as 0x13f3d0; supplied set_race_camera copies hero_world_position to that same destination and uses it as hero position. This is the hero position corrected by reference tilt. --- .../shared/hero/hero_move_state_velocity.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/shared/hero/hero_move_state_velocity.c b/src/overlays/shared/hero/hero_move_state_velocity.c index d4d09c1ae7..521b98b4d5 100644 --- a/src/overlays/shared/hero/hero_move_state_velocity.c +++ b/src/overlays/shared/hero/hero_move_state_velocity.c @@ -570,19 +570,19 @@ typedef union { typedef struct { unsigned char pad0[0x80]; - V_2163f0 v80; + V_2163f0 hero_position; unsigned char pad90[0x1F8 - 0x90]; short s1F8; unsigned char pad1FA[0x270 - 0x1FA]; - V_2163f0 v270; + V_2163f0 primary_tilt_reference_vector; unsigned char pad280[0x10]; - V_2163f0 v290; + V_2163f0 alternate_tilt_reference_vector; unsigned char pad2A0[0x2DC - 0x2A0]; float f2DC; unsigned char pad2E0[0x30E - 0x2E0]; short s30E; unsigned char pad310[0x20B3 - 0x310]; - unsigned char b20B3; + unsigned char reference_tilt_mode; } P_2163f0; extern P_2163f0 D_0013F350_2163f0 __asm__("D_0013F350"); @@ -611,13 +611,13 @@ void apply_hero_reference_tilt(void) { transformed_position_offset.f[2] = 0.8f; pitch_smoothing_parameter = frame_scale_sq * 0.3f; FUN_001f9d20_2163f0(&original_position_offset, &original_position_offset, &P); - reference_vector.q = P.v270.q; - if (P.b20B3 == 2) { - FUN_001f9a68_2163f0(&reference_vector, &P.v290, -1.0f); + reference_vector.q = P.primary_tilt_reference_vector.q; + if (P.reference_tilt_mode == 2) { + FUN_001f9a68_2163f0(&reference_vector, &P.alternate_tilt_reference_vector, -1.0f); } - if (P.b20B3 == 1) { + if (P.reference_tilt_mode == 1) { if (P.s30E < FUN_001f96f8_2163f0(10) || P.f2DC < 1.0f) { - reference_vector.q = P.v270.q; + reference_vector.q = P.primary_tilt_reference_vector.q; } } if (P.s30E != 0 && P.s1F8 != 0) { @@ -629,11 +629,11 @@ void apply_hero_reference_tilt(void) { pitch_smoothing_parameter, 0.0f, 0); - if (P.b20B3 == 1 && P.s30E != 0) { + if (P.reference_tilt_mode == 1 && P.s30E != 0) { FUN_001f9d20_2163f0( &transformed_position_offset, &transformed_position_offset, working_matrix); - fast_vec_sub(&P.v80, &P.v80, &transformed_position_offset); - FUN_001f9a10_2163f0(&P.v80, &P.v80, &original_position_offset); + fast_vec_sub(&P.hero_position, &P.hero_position, &transformed_position_offset); + FUN_001f9a10_2163f0(&P.hero_position, &P.hero_position, &original_position_offset); } } From 68258cdf673f5b95fcd396350352519857fac84c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:49:11 +0000 Subject: [PATCH 262/758] decomp: clarify names in create_spark_particle b2 -> texture_id: Source assigns *spark_texture_table[texture_table_index] to Spark.b2. Retail 0x0027ea14-0x0027ea18 forms table base 0x001b2500 plus selector*4; 0x0027ea28 loads the selected pointer, 0x0027ea30 reads its first byte, and 0x0027ea34 stores it at Spark+2. Original Ghidra shows the same double dereference, the supplied emitter caller passes emitter_vars->tex, and the supplied prior annotation identifies adjacent Particle offset 2 as tex. Thus this member holds the resolved texture identifier rather than the table index. b3 -> particle_mode: Source stores mode directly in Spark.b3 unless mode == SPARK_MODE_FROM_KIND, in which case kind bit 0 selects 0x48 or 0x44. Retail masks mode into s4 at 0x0027e928, compares it against 255 at 0x0027e9b8-0x0027e9bc, stores s4 at Spark+3 at 0x0027ea04, or tests kind bit 0 and stores 0x48/0x44 at 0x0027e9d8-0x0027ea00. Original Ghidra param_14 follows the same branches. This proves the member stores the particle mode, including the mode derived from kind. --- src/overlays/l01/mobys/create_spark_particle.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l01/mobys/create_spark_particle.c b/src/overlays/l01/mobys/create_spark_particle.c index 37ac745365..ee81c1085b 100644 --- a/src/overlays/l01/mobys/create_spark_particle.c +++ b/src/overlays/l01/mobys/create_spark_particle.c @@ -25,8 +25,8 @@ typedef struct { typedef struct { u8 b0; u8 b1; - u8 b2; - u8 b3; + u8 texture_id; + u8 particle_mode; s32 w4; u8 b8; u8 b9; @@ -91,16 +91,16 @@ void create_spark_particle(s32 id, if (mode == SPARK_MODE_FROM_KIND) { spark->b9 = (kind >> 5) * 16 + truncate_float_to_s32(4.0f); if (kind & 1) { - spark->b3 = 0x48; + spark->particle_mode = 0x48; } else { - spark->b3 = 0x44; + spark->particle_mode = 0x44; } } else { spark->b9 = kind; - spark->b3 = mode; + spark->particle_mode = mode; } spark->b1 = 0; - spark->b2 = *spark_texture_table[texture_table_index]; + spark->texture_id = *spark_texture_table[texture_table_index]; spark_body->x = x; spark_body->y = y; spark_body->z = z; From 51041ad28694b1f32d1262e6662157dd3e241a42 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:49:14 +0000 Subject: [PATCH 263/758] decomp: clarify names in follow_camera_read_stick f24 -> fallback_pitch_angle: Retail 0x002e89c8-0x002e89cc forms camera data +0x1A8. At 0x002e8b1c-0x002e8b40, flags bit 2 selects loading its float +0x24; otherwise 0x002e8b60-0x002e8b7c loads the same field only when the stick-derived pitch output is zero. At 0x002e8b90-0x002e8b94 it is divided by 0.6981317 and stored through the third float output. The original decompilation confirms camera data +0x1CC supplies param_3 / this scale. Authoritative C maps these accesses to S_2e89b0.f24 and pitch_input_out. The supplied update_follow_camera_pose forwards this output to follow_camera_turn_and_pitch, whose C multiplies the processed pitch input by 0.69813168f to obtain target_pitch_angle. Thus the field supplies a fallback pitch angle, rather than a raw stick sample. --- src/overlays/shared/camera/follow_camera_turn_and_pitch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_turn_and_pitch.c b/src/overlays/shared/camera/follow_camera_turn_and_pitch.c index 5aff84a313..ae5b70834b 100644 --- a/src/overlays/shared/camera/follow_camera_turn_and_pitch.c +++ b/src/overlays/shared/camera/follow_camera_turn_and_pitch.c @@ -18,7 +18,7 @@ typedef struct { unsigned char pad18[4]; float f1C; unsigned char pad20[4]; - float f24; + float fallback_pitch_angle; } S_2e89b0; extern float D_0013CA40_lui[] __asm__("D_0013CA40") NOT_SDA; @@ -65,7 +65,7 @@ void follow_camera_read_stick(char *camera_object, float *turn_input_out, float } if (turn_pitch_state->flags & 2) { *pitch_input_out = 0.0f; - *pitch_input_out = turn_pitch_state->f24 / 0.6981317f; + *pitch_input_out = turn_pitch_state->fallback_pitch_angle / 0.6981317f; } else { float raw_pitch_input = D_0013CA40_lui[1]; *pitch_input_out = -raw_pitch_input; @@ -73,7 +73,7 @@ void follow_camera_read_stick(char *camera_object, float *turn_input_out, float *pitch_input_out = raw_pitch_input; } if (*pitch_input_out == 0.0f) { - *pitch_input_out = turn_pitch_state->f24 / 0.6981317f; + *pitch_input_out = turn_pitch_state->fallback_pitch_angle / 0.6981317f; } } } From 01886afd1fbd1ffb3e81765fc622780b71c01479 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:51:37 +0000 Subject: [PATCH 264/758] decomp: clarify names in update_timed_sphere_probed_particle i0 -> particle_path_reference: Retail 0x00272458 establishes s1=particle+0x20, and 0x00272490 loads a0 from particle+0x20 for jal 0x00262360 at 0x0027248c. Exact C passes particle_data->i0 as the first argument to path_sample_at_distance with updated distance unk4, spacing fc and particle_position output. The supplied path_sample_at_distance body treats that first argument as PointPath*, reads path->count and path->points, and samples the position along that path. Thus this int stores the particle's path reference; its type remains unchanged. p14 -> blast_source_moby: Retail 0x0027257c loads a0 from 0x14(s1), where s1=particle+0x20, for send_blast_hits at 0x002725a8; original Ghidra likewise forwards particle+0x34 as this argument. Exact C passes particle_data->p14 as send_blast_hits self. The supplied consumer writes self into each hit message's l.m.self and reads the source moby's short at self+0xA6 into l.m.h2A before delivering hits to list[i]. This establishes the field as the blast hit source moby, rather than a generic pointer. Its earlier forwarding to collect_mobies_in_sphere is retained without inferring collector semantics. --- 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 36803e2630..5d856a5dfc 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -539,10 +539,10 @@ void send_blast_hits(void *, float) __asm__("FUN_L00_0025a9f8"); typedef struct { - int i0; + int particle_path_reference; float unk4, unk8, fc; int i10; - void *p14; + void *blast_source_moby; } Q_272438; void update_timed_sphere_probed_particle(struct EffectParticle *) __asm__("FUN_L00_00272438"); @@ -557,7 +557,7 @@ void update_timed_sphere_probed_particle(struct EffectParticle *particle) { previous_particle_position = *particle_position; particle_data->unk4 += particle_data->unk8; path_sample_at_distance( - particle_data->i0, &x, &y, particle_position, particle_data->unk4, particle_data->fc); + particle_data->particle_path_reference, &x, &y, particle_position, particle_data->unk4, particle_data->fc); if (fast_dec_timer_s16(&particle->life)) { free_effect_particle(particle); return; @@ -571,9 +571,9 @@ void update_timed_sphere_probed_particle(struct EffectParticle *particle) { ((float)scale_game_frames(0x1E) * 0.25f)); } sphere_probe_result = - collect_mobies_in_sphere(0.15f, particle_position, 0x10, particle_data->p14, 0); + collect_mobies_in_sphere(0.15f, particle_position, 0x10, particle_data->blast_source_moby, 0); position_copy = *particle_position; - send_blast_hits(particle_data->p14, + send_blast_hits(particle_data->blast_source_moby, (void *)&position_copy, D_L00_00177F00_272438, sphere_probe_result, From 9c02040c080b84f6aa543bdb1d7e859cb8621d52 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:51:40 +0000 Subject: [PATCH 265/758] decomp: clarify names in pterodactyl_update f74 -> path_progress_increment: In authoritative pterodactyl.c SHA-256 283a9bf2334aef3358cc638a15f660de61f42c24a9576fff56b6223456266506, f74 is initialized as pterodactyl_path_speed_gp * frame_time / first_segment_length and then added to f6C after f6C is passed as sample_camera_path progress. Retail 002e3b24-002e3b3c computes/stores that quotient at pvars+0x74; 002e3b9c supplies +0x6c as sampling progress, and 002e3be0-002e3bec adds +0x74 to it before count-based wrapping at 002e3bf0-002e3c0c. This proves a per-update path progress increment. i70 -> path_loop_enabled: In authoritative pterodactyl.c, i70 stores the boolean absolute_float(first_segment_length - first_to_last_distance) < 0.1f and is passed as the loop argument to sample_camera_path. Retail 002e3b20 and 002e3b38-002e3b64 form the absolute difference, compare against 0.1 and store 0 or 1 at pvars+0x70; 002e3ba4 loads this into a1 for the path sampler at 002e3bb4. Supplied sample_camera_path context identifies this integer argument as loop and clamps the final segment only when loop == 0, proving a path-loop enable flag independently of whether the distance test proves geometric closure. --- src/overlays/shared/props/pterodactyl.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/props/pterodactyl.c b/src/overlays/shared/props/pterodactyl.c index a38cada8b2..86e42626c0 100644 --- a/src/overlays/shared/props/pterodactyl.c +++ b/src/overlays/shared/props/pterodactyl.c @@ -14,8 +14,8 @@ typedef struct { char p0[0x60]; int path; float f64, f68, f6C; - int i70; - float f74; + int path_loop_enabled; + float path_progress_increment; } D_2e3a88; void sample_camera_path(void *, float, int, void *, void *, int) __asm__("FUN_00214e58"); @@ -51,8 +51,8 @@ void pterodactyl_update(unsigned char *moby) { { float first_segment_length = fast_vec_dist(path + 4, path + 8); float first_to_last_distance = fast_vec_dist(path + 4, path + *path * 4); - moby_data->f74 = pterodactyl_path_speed_gp * frame_time / first_segment_length; - moby_data->i70 = absolute_float(first_segment_length - first_to_last_distance) < 0.1f; + moby_data->path_progress_increment = pterodactyl_path_speed_gp * frame_time / first_segment_length; + moby_data->path_loop_enabled = absolute_float(first_segment_length - first_to_last_distance) < 0.1f; } moby_data->f6C = moby_data->f68 * (float)*path; MOBY(moby)->state = PTERODACTYL_FOLLOW_PATH; @@ -60,10 +60,10 @@ void pterodactyl_update(unsigned char *moby) { MOBY(moby)->update_dist = 0xFF; case PTERODACTYL_FOLLOW_PATH: y = MOBY(moby)->pos.z; - sample_camera_path(path, moby_data->f6C, moby_data->i70, &MOBY(moby)->pos, moby + 0x40, 0); + sample_camera_path(path, moby_data->f6C, moby_data->path_loop_enabled, &MOBY(moby)->pos, moby + 0x40, 0); MOBY(moby)->rot.y *= 0.5f; MOBY(moby)->pos.z += moby_data->f64; - moby_data->f6C += moby_data->f74; + moby_data->f6C += moby_data->path_progress_increment; if ((float)*path < moby_data->f6C) moby_data->f6C -= (float)*path; if (MOBY(moby)->anim_flags & 2) { From 30ef0a54fb0f1e5993c1bec8ef1e50bf3d36461f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:53:38 +0000 Subject: [PATCH 266/758] decomp: clarify names in follow_camera_pull_back v80 -> pull_back_alignment_vector: In the supplied C, C_2e9518.v80 is float[4] and its sole use is fast_vec_dot(C->v80, camera_object) <= -0.3f in follow_camera_pull_back. Retail 0x002e953c sets s2 to 0x00166e10; 0x002e95e0 passes camera_object (s1) as a1 and 0x002e95e4-0x002e95e8 calls the dot helper with a0=s2+0x80 (0x00166e90), matching the original Ghidra dot call. The comparison at 0x002e95fc and branch at 0x002e9604 enter the active pull-back path at 0x002e960c when the dot is <= -0.3, provided the scalar activity gate passes. That path refreshes the pull-back timer, updates retained pull-back distance and calls follow_camera_set_distance at 0x002e9694. The embedded follow_camera_build_view constructs the first vector at camera_object as its view direction. Thus the field is the alignment-test vector for triggering pull-back, without asserting its origin or normalization. --- src/overlays/shared/camera/follow_camera_update.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_update.c b/src/overlays/shared/camera/follow_camera_update.c index eb001a9f19..0b8369356b 100644 --- a/src/overlays/shared/camera/follow_camera_update.c +++ b/src/overlays/shared/camera/follow_camera_update.c @@ -10,7 +10,7 @@ typedef struct { char p0[0x80]; - float v80[4]; + float pull_back_alignment_vector[4]; char p1[0xA4 - 0x90]; float fA4; } C_2e9518; @@ -456,7 +456,7 @@ void follow_camera_pull_back(char *camera_object, float *x, float *y) { fast_vec_dot(D_001413D0_lui + 0xC0, camera_object) <= -0.3f) { goto on; } - if (0.0001f < absolute_float(C->fA4) && fast_vec_dot(C->v80, camera_object) <= -0.3f) { + if (0.0001f < absolute_float(C->fA4) && fast_vec_dot(C->pull_back_alignment_vector, camera_object) <= -0.3f) { on: pull_back_state->h4 = scale_game_frames(0x78); k = C->fA4 * 14.2857f; From 665f8378baf73a385b26c6cec189efd33d00e8d0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:53:42 +0000 Subject: [PATCH 267/758] decomp: clarify names in draw_walloper_camera_facing_quad unk64 -> corner_2_texture_v: Source initializes the eight consecutive texture components at +0x50..+0x6C as (0,0),(0,1),(1,0),(1,1); unk64 is the second component of corner 2. Assigned retail 0x002bc240 stores zero at sp+0x64 before descriptor submission at 0x002bc380. Checked level-00 draw helper 0x001fd228 preserves descriptor in s2 at 0x001fd2d4; 0x001fd5e8 loads +0x60..+0x6C into vf15, and 0x001fd5f4 multiplies its xy by the reciprocal w of corner 2 (vf12; division at 0x001fd59c), while 0x001fd66c scales zw for corner 3. 0x001fd6ac-0x001fd6b8 then stores the low/high texture pairs beside those vertices. This proves unk64 is corner 2's V texture component, not merely an offset-based guess. Source's adjacent arc renderer supplies identical four texture pairs in render_attributes.f[0..7]. --- src/overlays/shared/weapons/walloper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/walloper.c b/src/overlays/shared/weapons/walloper.c index 029fda6a8c..9412354919 100644 --- a/src/overlays/shared/weapons/walloper.c +++ b/src/overlays/shared/weapons/walloper.c @@ -44,7 +44,7 @@ typedef struct { unsigned int color[4]; int unk50, unk54, unk58; float unk5C, unk60; - int unk64; + int corner_2_texture_v; float unk68, unk6C; long unk70, tex, unk80, unk88; } Q_2bc1a0; @@ -1055,7 +1055,7 @@ void draw_walloper_camera_facing_quad(void *mv) { quad.unk58 = 0; quad.unk5C = 1.0f; quad.unk60 = 1.0f; - quad.unk64 = 0; + quad.corner_2_texture_v = 0; quad.unk68 = 1.0f; quad.unk6C = 1.0f; if (!random_integer_below(4)) From 88609524ff849b6d512fb8fc1473d2fb7d1ba42a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:53:45 +0000 Subject: [PATCH 268/758] decomp: clarify names in draw_beam_origin_camera_facing_quads unk64 -> corner_2_texture_v: Retail 0x002be92c writes zero to quad+0x64 (Ghidra uStack_10c); adjacent stores initialize the eight texture components to (0,0),(0,1),(1,0),(1,1), matching the supplied GeometryQuad texture_coordinates assignments in draw_beam_pulse_quads and Quad.uv uses. Both draws at 0x002bea14/0x002bea80 consume this unchanged quad. Checked level-00 draw helper 0x001fd228 saves its quad pointer in s2 at 0x001fd2d4 and loads quad+0x60 into vf15 at 0x001fd5e8, pairing +0x60 U with +0x64 V. At 0x001fd5f4 vmulq.xy vf15 scales that pair by the perspective reciprocal for vf12 (corner 2, loaded from quad+0x20 at 0x001fd23c), then emits the pair at 0x001fd6ac/0x001fd6b0. This proves corner index 2 texture V rather than a generic zero field. --- src/overlays/shared/weapons/morphoray.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/morphoray.c b/src/overlays/shared/weapons/morphoray.c index 758d178ef8..5ab307b6ab 100644 --- a/src/overlays/shared/weapons/morphoray.c +++ b/src/overlays/shared/weapons/morphoray.c @@ -131,7 +131,7 @@ typedef struct { int color[4]; int unk50, unk54, unk58; float unk5C, unk60; - int unk64; + int corner_2_texture_v; float unk68, unk6C; long unk70, tex, unk80, unk88; } Q_2be890; @@ -2362,7 +2362,7 @@ void draw_beam_origin_camera_facing_quads(void *mv) { quad.unk58 = 0; quad.unk5C = 1.0f; quad.unk60 = 1.0f; - quad.unk64 = 0; + quad.corner_2_texture_v = 0; quad.unk68 = 1.0f; quad.unk6C = 1.0f; FUN_001f9bf8_2be890(&offset_vector, moby_bytes + 0xD0, beam_origin_quad_basis_offset_length_gp); From b63ca3cb4df27562c21637b720ebc06836b038bf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:53:49 +0000 Subject: [PATCH 269/758] decomp: clarify names in nanotech_crate_fragment_update f2c -> fragment_scale: In the SHA-256-bound crate_fragment.c snapshot, the fading case multiplies fragment_moby->f2c by crate_fragment_shrink_factor_gp, initialized to 0.9f. Retail 0x002afc0c loads the float from moby+0x2c, 0x002afc10 loads that shrink factor, 0x002afc18 multiplies them, and 0x002afc28 stores the product back. This occurs alongside opacity decrement/removal at 0x002afc1c-0x002afc44. The prepared Ghidra decompilation shows the same floating-point self-multiplication in state 1, and its supplied annotation identifies the operation as scale multiplication. The source spawn path likewise multiplies MOBY(debris_moby)->scale by a scale_multiplier, supporting the fragment's multiplicative size property rather than an offset-only interpretation. --- 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 1d24c42f10..9ff3bc9187 100644 --- a/src/overlays/shared/pickups/crate_fragment.c +++ b/src/overlays/shared/pickups/crate_fragment.c @@ -41,7 +41,7 @@ typedef struct { f32 pos[4] __attribute__((aligned(16))); u8 b20, b21, b22, b23; u8 pad24[8]; - f32 f2c; + f32 fragment_scale; u8 pad30[0x10]; f32 f40, f44, f48; u8 pad4c[0x2C]; @@ -222,7 +222,7 @@ void nanotech_crate_fragment_update(M_2afa48 *fragment_moby) { } break; case NANOTECH_CRATE_FRAGMENT_FADING: - fragment_moby->f2c *= crate_fragment_shrink_factor_gp; + fragment_moby->fragment_scale *= crate_fragment_shrink_factor_gp; if (fragment_moby->b23 < crate_fragment_fade_step_gp) { mark_moby_for_removal(fragment_moby); } else { From 14eb506073e1e116ab362d7c88426d91d081757d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:55:58 +0000 Subject: [PATCH 270/758] decomp: clarify names in electric_beam_update f624 -> culling_sphere_radius: Retail 0x00301688-0x003016a4 selects the beam's cuboid using pvars+0, passes its axis[1] at cuboid+0x10 to fast_vec_length, and stores f0 at pvars+0x624. At 0x003015f4-0x00301614, the moby position is copied to a stack sphere, pvars+0x624 replaces its fourth float, and fast_bsphere_check consumes that sphere before the negative-result early return at 0x00301618. The authoritative C expresses the same initialization and beam_culling_sphere[3] assignment, proving this member caches the culling sphere radius. --- src/overlays/shared/props/electric_beam.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/props/electric_beam.c b/src/overlays/shared/props/electric_beam.c index b8f8ae710d..b4a94b945d 100644 --- a/src/overlays/shared/props/electric_beam.c +++ b/src/overlays/shared/props/electric_beam.c @@ -25,7 +25,7 @@ typedef struct { char pad14[8]; float radius; /* 0x1C: beam half width */ char pad20[0x604]; - float f624; + float culling_sphere_radius; char pad628[8]; Vec4 end_a; /* 0x630: end of the line along +axis 1 */ Vec4 end_b; /* 0x640: end of the line along -axis 1 */ @@ -66,7 +66,7 @@ void electric_beam_update(unsigned char *moby) { int phase_duration_frames; if (MOBY(moby)->state != BEAM_STATE_INITIALIZE) { qcopy(beam_culling_sphere, &MOBY(moby)->pos); - beam_culling_sphere[3] = beam_vars->f624; + beam_culling_sphere[3] = beam_vars->culling_sphere_radius; if (fast_bsphere_check(beam_culling_sphere, 52.0f) < 0) { return; } @@ -80,7 +80,7 @@ void electric_beam_update(unsigned char *moby) { start_electric_beam_pulse((char *)moby); beam_vars->s10 = scale_game_frames(beam_vars->wC); MOBY(moby)->state = BEAM_STATE_WAIT_FOR_TIMED_PULSE; - beam_vars->f624 = fast_vec_length(&l14_cuboids[beam_vars->w0].axes[1]); + beam_vars->culling_sphere_radius = fast_vec_length(&l14_cuboids[beam_vars->w0].axes[1]); beam_vars->s8 = 1; beam_vars->sA = 1; break; From d0be3243a5ac4cd6d4782e3e6b6a0e885f26f6ae Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:56:01 +0000 Subject: [PATCH 271/758] decomp: clarify names in woodcut_bot_debris_update f2c -> uniform_scale: Assigned source multiplies entity->f2c by 0.9f in decay state, matching retail 0x002e533c-0x002e535c loading entity +0x2c, multiplying by 0.9 and storing back. Checked direct collision helper 0x001e36c8 provides semantic corroboration for the same entity layout: 0x001e3ed8-0x001e3ee8 loads position +0x10, three basis vectors +0xc0/+0xd0/+0xe0 and scalar +0x2c; 0x001e3efc transfers the scalar to vf13, then 0x001e3f0c/0x001e3f14/0x001e3f1c multiply all three basis vectors by that one scalar. Primitive dimensions are likewise scaled at 0x001e40e0-0x001e40ec and 0x001e4160-0x001e4164. Thus +0x2c is uniform geometric scale, which this debris update shrinks during decay. f8 -> collision_radius: Authoritative C passes pv->f8 as the float argument of coll_sphere(entity->pos, 2, 0, pv->f8). Retail 0x002e5274 loads private +8 into f12 before 0x002e527c calls 0x001e36c8. Checked level-04 helper instructions 0x001e36e4 load the center into vf31, 0x001e36ec-0x001e36fc transfer f12 to vf30, and 0x001e3710/0x001e3718 form center minus/plus that scalar on xyz. At 0x001e3760 it squares that radius; the distance-squared tests (including 0x001e3c80-0x001e3c98) use it for sphere overlap. These operations prove collision radius, beyond offset alone. --- src/overlays/l04/mobys/woodcut_bot_debris.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l04/mobys/woodcut_bot_debris.c b/src/overlays/l04/mobys/woodcut_bot_debris.c index e8ee88e2b9..93ee1db6f3 100644 --- a/src/overlays/l04/mobys/woodcut_bot_debris.c +++ b/src/overlays/l04/mobys/woodcut_bot_debris.c @@ -15,7 +15,7 @@ typedef struct { u8 pad0[4]; f32 f4; - f32 f8; + f32 collision_radius; s16 hC; s16 hE; f32 vel[4] __attribute__((aligned(16))); @@ -27,7 +27,7 @@ typedef struct { f32 pos[4] __attribute__((aligned(16))); u8 b20, b21, b22, b23; u8 pad24[8]; - f32 f2c; + f32 uniform_scale; u8 pad30[0x10]; f32 f40, f44, f48; u8 pad4c[0x2C]; @@ -60,7 +60,7 @@ void woodcut_bot_debris_update(M2e5178 *entity) { if (entity->pos[2] < pv->f4 - 3.0f) { entity->b20 = 1; } else if (fast_dec_timer_s16(&pv->hE) && pv->hC != 0 && - coll_sphere(entity->pos, 2, 0, pv->f8)) { + coll_sphere(entity->pos, 2, 0, pv->collision_radius)) { collision_normal = coll_hit_normal_lui; if (fast_vec_dot(pv->vel, collision_normal) < 0.0f) { qcopy(entity->pos, collision_normal - 1); @@ -78,7 +78,7 @@ void woodcut_bot_debris_update(M2e5178 *entity) { } break; case ENTITY_MOTION_STATE_DECAY_AND_REMOVE: - entity->f2c *= 0.9f; + entity->uniform_scale *= 0.9f; if (entity->b23 < 4) { mark_moby_for_removal(entity); } else { From be550e98ab00559ca915ef3ba20357015053aa9f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 06:58:04 +0000 Subject: [PATCH 272/758] decomp: clarify names in update_hero_water_height_and_bobbing f2F0 -> water_surface_height_target: Retail 0x00227f24 loads hero+0x2F0 into f12 as the default target of vendor_spring at 0x00227f5c. The supplied retail plate identifies this as water_surface_z, and C water-surface-entry setup initializes the height being smoothed from p->water_surface_z; its output contributes to hero Z. f690 -> water_bob_offset: Retail 0x00227e40-0x00227e58 applies restoring force proportional to +0x690, 0x00227ea8-0x00227ebc integrates +0x694 into it, and 0x00227f78-0x00227f94 adds it to smoothed water height minus 0.12 for hero Z. C water entry initializes unk690 from position Z minus water height, proving the vertical bob offset. f69C -> smoothed_water_height: Retail 0x00227f24-0x00227f60 springs hero+0x69C toward the selected water height using +0x6A0 as velocity. 0x00227f74-0x00227f94 adds -0.12 and the bob offset before writing position Z. C entry setup initializes unk69C to water_surface_z and SINK to water_surface_z-0.37. f6A0 -> water_height_spring_velocity: Retail 0x00227f34 passes hero+0x6A0 as a1 to vendor_spring while a0 is hero+0x69C at 0x00227f44 and f12 is the selected height target. The supplied vendor_spring implementation explicitly uses its second pointer as velocity; C water entry zeros unk6A0 when initializing water height. f88 -> water_adjusted_position_z: Retail 0x00227f74-0x00227f94 writes +0x88 with smoothed water height -0.12 plus bob offset. Supplied C water-surface-entry setup initializes the same bob offset from motion.pos.f[2] minus unk69C minus -0.12, proving that this is the resulting hero position Z. f8A0 -> alternate_water_height_target: Retail 0x00227f1c-0x00227f28 replaces the default +0x2F0 height target with hero+0x8A0 when control mode equals 0x16. The selected scalar is passed in f12 to vendor_spring at 0x00227f5c for smoothed water height +0x69C; no more specific origin for this alternate target is claimed. f8FC -> water_bob_spring_velocity: Retail 0x00227dc4 sets a0 to bob offset hero+0x690 and 0x00227dd0 sets a1 to hero+0x8FC before vendor_spring at 0x00227e04 with target zero. The supplied vendor_spring implementation establishes that its second pointer stores spring velocity, proving the bob spring velocity role. i208C -> water_height_control_mode: Retail 0x00227f1c-0x00227f28 checks hero+0x208C against 0x16 to select the alternate water-height target. The supplied original retail plate explicitly identifies this selector as control mode, corroborated by the C grapple selection checks of +0x208C for control modes 0xD and 0xF and hero_set_state assigning those modes. --- src/overlays/shared/hero/hero_set_state.c | 42 +++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index c6b47e8888..c75af9ce2e 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3161,25 +3161,25 @@ int try_enter_hero_water_state(void) { typedef struct { u8 p0[0x88]; - f32 f88; + f32 water_adjusted_position_z; u8 p1[0x198 - 0x8C]; s32 i198; u8 p2[0x2F0 - 0x19C]; - f32 f2F0; + f32 water_surface_height_target; u8 p3[0x690 - 0x2F4]; - f32 f690; + f32 water_bob_offset; f32 f694; u8 p4[0x69C - 0x698]; - f32 f69C; - f32 f6A0; + f32 smoothed_water_height; + f32 water_height_spring_velocity; u8 p5[0x8A0 - 0x6A4]; - f32 f8A0; + f32 alternate_water_height_target; u8 p6[0x8FC - 0x8A4]; - f32 f8FC; + f32 water_bob_spring_velocity; u8 p7[0x2084 - 0x900]; s32 i2084; u8 p8[4]; - s32 i208C; + s32 water_height_control_mode; u8 p9[4]; s32 i2094; u8 pa[0x20A0 - 0x2098]; @@ -3192,35 +3192,35 @@ void approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); void update_hero_water_height_and_bobbing(void) __asm__("FUN_L00_00227d40"); void update_hero_water_height_and_bobbing(void) { - if (G.i198 > scale_game_frames(10) || G.f690 < 0.0f || G.i2094 == 0x11 || G.i20A0 == 0x11) { + if (G.i198 > scale_game_frames(10) || G.water_bob_offset < 0.0f || G.i2094 == 0x11 || G.i20A0 == 0x11) { if (G.i2084 == 0x36) { - vendor_spring(&G.f690, - &G.f8FC, + vendor_spring(&G.water_bob_offset, + &G.water_bob_spring_velocity, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 1.5f); G.f694 = 0.0f; } else { - G.f694 -= frame_scale_sq * 0.005f * G.f690 + frame_scale * 0.045f * G.f694; - if (absolute_float(G.f690) < 0.001f && G.f694 < 0.0001f) + G.f694 -= frame_scale_sq * 0.005f * G.water_bob_offset + frame_scale * 0.045f * G.f694; + if (absolute_float(G.water_bob_offset) < 0.001f && G.f694 < 0.0001f) G.f694 = 0.0f; } } - G.f690 += G.f694; - if (G.i2084 == 0x36 && 0.0f < G.f690) { + G.water_bob_offset += G.f694; + if (G.i2084 == 0x36 && 0.0f < G.water_bob_offset) { if (0.0f < G.f694) G.f694 = 0.0f; - approach_value(&G.f690, 0.0f, frame_time * 0.7f); + approach_value(&G.water_bob_offset, 0.0f, frame_time * 0.7f); } if (G.i2084 != 0x7F) { - f32 target_height = G.f2F0; - if (G.i208C == 0x16) - target_height = G.f8A0; + f32 target_height = G.water_surface_height_target; + if (G.water_height_control_mode == 0x16) + target_height = G.alternate_water_height_target; vendor_spring( - &G.f69C, &G.f6A0, target_height, frame_scale_sq * 0.027f, frame_scale_sq * 0.3f, 0.0f); + &G.smoothed_water_height, &G.water_height_spring_velocity, target_height, frame_scale_sq * 0.027f, frame_scale_sq * 0.3f, 0.0f); } - G.f88 = G.f69C + -0.12f + G.f690; + G.water_adjusted_position_z = G.smoothed_water_height + -0.12f + G.water_bob_offset; } /* Ported from rac1-decomp (src/overlays/shared/help_00221A98.c: func_L00_00228770), where it is exact; names translated to the US level program. */ From 093fe0da97729643d347f4763424d85f3ff244d0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:00:03 +0000 Subject: [PATCH 273/758] decomp: clarify names in init_moby_instance unkA6 -> original_class_id: In init_moby_instance the short member unkA6 is assigned the unmodified oClass argument. Retail 0x0020c604 saves incoming a1 in s0; 0x0020c624 uses s0 to index resident_class_slot_by_id at 0x001B3AC0, and 0x0020c62c/0x0020c648 load/store that mapped byte at instance +0x22. Separately 0x0020c678 sh s0,0xA6(s1) stores the original input ID, not the resident class slot. Original Ghidra likewise assigns state->wClass_id = (ushort)class_id. This proves original_class_id while preserving the existing short type. --- src/mobys/init_moby_instance.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mobys/init_moby_instance.c b/src/mobys/init_moby_instance.c index c5e000302a..53ceabfb99 100644 --- a/src/mobys/init_moby_instance.c +++ b/src/mobys/init_moby_instance.c @@ -65,7 +65,7 @@ typedef struct { unsigned char unkA3; /* 0xA3 */ unsigned char unkA4; /* 0xA4 */ char padA5; - short unkA6; /* 0xA6 */ + short original_class_id; /* 0xA6 */ int unkA8; /* 0xA8 */ int unkAC; /* 0xAC */ char padB0[0xD]; @@ -102,7 +102,7 @@ void init_moby_instance(void *moby_mem, int oClass) { moby_instance->unk21 = 0xFF; moby_instance->unk71 = 0xFF; moby_instance->unk72 = 0xFF; - moby_instance->unkA6 = oClass; + moby_instance->original_class_id = oClass; moby_instance->unk38 = 0x40404000000000L; moby_instance->unk36 = 0x7F80; resident_pool_slot_index = ((char *)moby_instance - (char *)resident_object_pool) >> 8; From e4be9d02d2a34b98ac036431f7faf1169dd32545 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:00:07 +0000 Subject: [PATCH 274/758] decomp: clarify names in update_decoy_proximity_motion f88 -> hero_position_z: P_2c40a0 *P is explicitly cast from &hero in the authoritative C. Retail 0x002c4108 loads hero+0x88 (Ghidra fRam0013f3d8), and 0x002c410c-0x002c4114 subtract decoy+0x18, the decoy Z coordinate subsequently integrated and clamped to ground at 0x002c42b0-0x002c4300. Its absolute difference is tested against 1.3, proving the hero Z component. p78 -> decoy_motion_vars: Source initializes O_2c40a0 *moby_vars from decoy_moby->p78. Retail 0x002c40cc loads decoy+0x78 into s0 (original Ghidra iVar1); this pointer owns the spring response step at +0x60, gravity-integrated vertical displacement at +0x64 (0x002c42d8-0x002c42ec), and proximity activation state at +0x68 (0x002c40d0-0x002c4138). The checked decoy_update caller passes its decoy in settled/pre-removal movement states, proving this is the decoy motion-variable block. v80 -> hero_position_xy: The authoritative C casts &hero to P_2c40a0 and declares v80 as eight bytes immediately followed by f88. Retail 0x002c40e0-0x002c40e8 passes hero+0x80 and decoy position +0x10 to the proximity distance helper. At 0x002c413c-0x002c415c, hero+0x80 is subtracted from decoy position and the resulting Z component is cleared before horizontal separation is measured. Together with the separate hero+0x88 Z comparison at 0x002c4108-0x002c4114, this proves these eight bytes hold the hero XY position components. --- src/overlays/shared/weapons/decoy.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/weapons/decoy.c b/src/overlays/shared/weapons/decoy.c index b4bc9f1778..05d5d56eac 100644 --- a/src/overlays/shared/weapons/decoy.c +++ b/src/overlays/shared/weapons/decoy.c @@ -69,13 +69,13 @@ typedef struct { u8 v10[8]; f32 f18; u8 pad2[0x78 - 0x1C]; - O_2c40a0 *p78; + O_2c40a0 *decoy_motion_vars; } S_2c40a0; typedef struct { u8 pad[0x80]; - u8 v80[8]; - f32 f88; + u8 hero_position_xy[8]; + f32 hero_position_z; u8 pad2[0x1E2 - 0x8C]; s16 h1E2; } P_2c40a0; @@ -476,7 +476,7 @@ s32 predict_thrown_moby_landing(ThrowVars *throw_vars, struct Moby *thrown_moby, void update_decoy_proximity_motion(S_2c40a0 *self) __asm__("FUN_L00_002c40a0"); void update_decoy_proximity_motion(S_2c40a0 *decoy_moby) { - O_2c40a0 *moby_vars = decoy_moby->p78; + O_2c40a0 *moby_vars = decoy_moby->decoy_motion_vars; P_2c40a0 *P = (P_2c40a0 *)&hero; s16 proximity_response_gate = P->h1E2; f32 horizontal_displacement[4]; @@ -484,13 +484,13 @@ void update_decoy_proximity_motion(S_2c40a0 *decoy_moby) { if (moby_vars->i68 == 0) { if (proximity_response_gate == 0) return; - if (!(FUN_001f9b80_2c40a0(P->v80, decoy_moby->v10) < 1.0f)) + if (!(FUN_001f9b80_2c40a0(P->hero_position_xy, decoy_moby->v10) < 1.0f)) return; - if (!(FUN_001f99c0_2c40a0(P->f88 - decoy_moby->f18) < 1.3f)) + if (!(FUN_001f99c0_2c40a0(P->hero_position_z - decoy_moby->f18) < 1.3f)) return; moby_vars->i68 = 1; } - FUN_001f9a28_2c40a0(horizontal_displacement, decoy_moby->v10, P->v80); + FUN_001f9a28_2c40a0(horizontal_displacement, decoy_moby->v10, P->hero_position_xy); horizontal_displacement[2] = 0.0f; horizontal_separation_error = FUN_001f9b20_2c40a0(horizontal_displacement) - 1.4f; if (horizontal_separation_error > 0.0f) From 8a516a529345b65179f663ca06cf5063052d5e39 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:00:12 +0000 Subject: [PATCH 275/758] decomp: clarify names in update_arc_motion b2D -> arc_motion_animation: Retail 0x25b4d4 loads state+0x2d into a1 for blend_moby_animation at 0x25b4dc, with object in a0, zero in a2 and 10 in a3. The following store at 0x25b4e4 selects INTEGRATE_ARC_MOTION. Authoritative C uses this byte as the animation selection when entering that phase. f24 -> arc_entry_record_value_threshold: Retail 0x25b4a8 calls the helper identified in the authoritative C as compute_interpolated_record_value(moving_object); 0x25b4b0 loads state+0x24 and 0x25b4b4-0x25b4c0 exits when the helper result is <= this float. It is the record-value threshold that must be exceeded to pass CHECK_ARC_ENTRY_GATES. f38 -> turn_damping_factor: Retail 0x25b4f0 loads state+0x38 into f14 for spring-turn helper 0x258278. Bounded helper request 27add9206e9d440cb013e4b8b92d323a shows f14 preserved in f22 at 0x25829c, multiplied by the current turn step at 0x258310 and subtracted from the spring term at 0x258318 before updating that step. Supplied spring_turn C calls this parameter damping_factor. f3C -> turn_step_limit: Retail 0x25b4f8 loads state+0x3c into f15 for helper 0x258278. Bounded helper request 27add9206e9d440cb013e4b8b92d323a shows f15 saved in f20 at 0x2582a8; when nonzero, 0x258328-0x25834c clamps the updated turn step to this value or its negation. Supplied spring_turn C identifies the parameter as limit. f8 -> descent_transition_height: Retail 0x25b590 loads state+8 while 0x25b594-0x25b5a4 computes vertical_increment*prediction_time - 0.5*vertical_decrement*prediction_time*prediction_time. At 0x25b5a8-0x25b5ac the current object Z is compared against this field minus that displacement, equivalently predicted Z <= this height. Success blends the descent animation and stores DESCEND_TO_GROUND at 0x25b5bc-0x25b5d0. This proves a descent-transition height without asserting ground or target identity. --- src/overlays/shared/mobys/find_moby_hit.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/mobys/find_moby_hit.c b/src/overlays/shared/mobys/find_moby_hit.c index 5cbaa33e23..dbf35b78cd 100644 --- a/src/overlays/shared/mobys/find_moby_hit.c +++ b/src/overlays/shared/mobys/find_moby_hit.c @@ -789,23 +789,23 @@ int generate_random_points_from_shape_entries( typedef struct { unsigned char pad0[8]; - float f8; + float descent_transition_height; unsigned char padC[4]; float f10; float f14; float f18; float f1C; unsigned char pad20[4]; - float f24; + float arc_entry_record_value_threshold; float f28; unsigned char b2C; - unsigned char b2D; + unsigned char arc_motion_animation; unsigned char b2E; unsigned char state; float f30; float f34; - float f38; - float f3C; + float turn_damping_factor; + float turn_step_limit; } S_25b440; typedef struct { @@ -846,11 +846,11 @@ int update_arc_motion(O_25b440 *moving_object, S_25b440 *arc_motion_state) { if (moving_object->b52 != arc_motion_state->b2C) { break; } - if (compute_interpolated_record_value(moving_object) <= arc_motion_state->f24) { + if (compute_interpolated_record_value(moving_object) <= arc_motion_state->arc_entry_record_value_threshold) { break; } if (moving_object->b70 & 2) { - blend_moby_animation(moving_object, arc_motion_state->b2D, 0, 10); + blend_moby_animation(moving_object, arc_motion_state->arc_motion_animation, 0, 10); arc_motion_state->state = INTEGRATE_ARC_MOTION; } case INTEGRATE_ARC_MOTION: @@ -858,8 +858,8 @@ int update_arc_motion(O_25b440 *moving_object, S_25b440 *arc_motion_state) { &arc_motion_state->f30, arc_motion_state->f18, arc_motion_state->f34, - arc_motion_state->f38, - arc_motion_state->f3C); + arc_motion_state->turn_damping_factor, + arc_motion_state->turn_step_limit); motion_displacement[0] = FUN_001f9dc8_25b440(arc_motion_state->f18) * arc_motion_state->f14; motion_displacement[1] = FUN_001f9de0_25b440(arc_motion_state->f18) * arc_motion_state->f14; motion_displacement[2] = arc_motion_state->f10; @@ -868,7 +868,7 @@ int update_arc_motion(O_25b440 *moving_object, S_25b440 *arc_motion_state) { if (arc_motion_state->f10 < 0.0f) { prediction_time = scale_time(arc_motion_state->f28 + arc_motion_state->f28 + 10.0f); if (moving_object->z <= - arc_motion_state->f8 - + arc_motion_state->descent_transition_height - (arc_motion_state->f10 * prediction_time - arc_motion_state->f1C * 0.5f * prediction_time * prediction_time)) { blend_moby_animation(moving_object, arc_motion_state->b2E, 0, 10); From c886ada8b7f12ad7f352c6d666b9a2705293b3d6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:02:52 +0000 Subject: [PATCH 276/758] decomp: clarify names in smoke_trail_projectile_update f8 -> direction_z: Hit_2eedd8 begins with float v[2] followed by float f8. Retail 002edbe8 constructs the descriptor at sp+0x20; 002edbf8 applies set_vector_length_xy to its leading vector, then 002edc1c stores 1.0f at sp+0x28, its third float. The supplied record_moby_hit C qcopies the descriptor's leading v vector into hit_record->direction. Together these uses prove f8 is the Z component of the hit direction, rather than an unrelated scalar. s1A -> source_moby_class: Retail 002edc00 loads the updated projectile moby's unsigned halfword at +0xa6, identified by the authoritative C as MOBY(moby)->oclass. Retail 002edc28 writes that halfword to sp+0x3a, hit_descriptor+0x1a, before delivery to the collided moby at 002edc2c. The source explicitly assigns hit_descriptor.s1A = (unsigned short)MOBY(moby)->oclass, and record_moby_hit copies descriptor.s into the hit record. This proves the field carries the source projectile moby class. --- src/overlays/shared/enemies/smoke_trail_projectile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/enemies/smoke_trail_projectile.c b/src/overlays/shared/enemies/smoke_trail_projectile.c index 6e11719393..62610de8fc 100644 --- a/src/overlays/shared/enemies/smoke_trail_projectile.c +++ b/src/overlays/shared/enemies/smoke_trail_projectile.c @@ -14,12 +14,12 @@ typedef struct { float v[2]; - float f8; + float direction_z; float fC; char pad10[8]; char b18; char b19; - short s1A; + short source_moby_class; char pad1C[0x14]; } Hit_2eedd8; @@ -82,10 +82,10 @@ void smoke_trail_projectile_update(char *moby) { if (*(int *)(collision_result + 0x18) != 0) { make_hit_descriptor(&hit_descriptor, moby, 0x10001, 1.0f, moby_vars); set_vector_length_xy(&hit_descriptor, &hit_descriptor, 1.0f); - hit_descriptor.f8 = 1.0f; + hit_descriptor.direction_z = 1.0f; hit_descriptor.fC = 5627.9248f; hit_descriptor.b19 = 1; - hit_descriptor.s1A = ((unsigned short)MOBY(moby)->oclass); + hit_descriptor.source_moby_class = ((unsigned short)MOBY(moby)->oclass); hit_descriptor.b18 = 0; record_moby_hit(*(void **)(collision_result + 0x18), &hit_descriptor); } From bce01b98bed3ec7d65d6c6803c626f8ce0307a73 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:02:56 +0000 Subject: [PATCH 277/758] decomp: clarify names in reset_racer_group_to_hero_path_position f48 -> group_anchor_to_hero_heading: In the bound source src/overlays/l14/mobys/racer_path_and_weapon.c (SHA-256 693f197a6e22c26432c07af9098fa3644b7cb3012dade1d6e32b650a52189745), M_6570.f48 receives fast_arc_tan(hero.motion.pos.f[0] - group_anchor_moby->pos.x, hero.motion.pos.f[1] - group_anchor_moby->pos.y). Retail 0x002d6728-0x002d6740 loads hero x/y and argument +0x10/+0x14, subtracts anchor coordinates from hero coordinates, and calls the angle helper 0x00212ec0; 0x002d6744 stores f0 to +0x48 of each list-selected racer (s0). Original Ghidra likewise stores func_0x00212ec0(hero_x-anchor_x, hero_y-anchor_y) to iVar2+0x48. This establishes the group-anchor-to-hero planar heading by computation and ownership, not offset alone. --- src/overlays/l14/mobys/racer_path_and_weapon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/racer_path_and_weapon.c b/src/overlays/l14/mobys/racer_path_and_weapon.c index dd68f72340..f379327b8c 100644 --- a/src/overlays/l14/mobys/racer_path_and_weapon.c +++ b/src/overlays/l14/mobys/racer_path_and_weapon.c @@ -151,7 +151,7 @@ extern char *D_L14_0015FFD8_6570 __asm__("D_L14_0015FFD8"); typedef struct { char p[0x48]; - float f48; + float group_anchor_to_hero_heading; } M_6570; typedef struct { @@ -221,7 +221,7 @@ void reset_racer_group_to_hero_path_position(struct Moby *group_anchor_moby) { char *od = *(char **)(o + 0x78); char *path = (char *)l14_splines[*(int *)(od + 0x60)].path; o[0x20] = 6; - ((M_6570 *)o)->f48 = fast_arc_tan(hero.motion.pos.f[0] - group_anchor_moby->pos.x, + ((M_6570 *)o)->group_anchor_to_hero_heading = fast_arc_tan(hero.motion.pos.f[0] - group_anchor_moby->pos.x, hero.motion.pos.f[1] - group_anchor_moby->pos.y); path_step_distance = -racer_path_lead_distance_gp; *(int *)(od + 0x64) = hero.rail_segment; From 57d4a5ddabc0a21e8c473f613e37f8577d7a76e7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:02:59 +0000 Subject: [PATCH 278/758] decomp: clarify names in cutscene_set_camera_target b2B -> initial_frame_count: In the SHA-256-bound source, both successful spawn branches assign effect->hA = scale_game_frames(6 or 2), then tail->b2B = effect->hA. Retail 0x00263968 calls the frame scaler, 0x00263970 stores its halfword to effect+0x0A, and 0x0026397c-0x00263980 loads its low byte and stores it into tail+0x0B (effect+0x2B). The second branch repeats this at 0x00263a58-0x00263a60 and 0x00263a78-0x00263a7c. Thus this u8 member records the initial scaled frame count for each newly spawned effect, truncated to a byte; the meaning follows the frame-scaling data flow rather than the offset alone. --- src/overlays/shared/mobys/select_auto_aim_target_moby.c | 6 +++--- 1 file changed, 3 insertions(+), 3 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 1bb79b2e6f..034cf13fbd 100644 --- a/src/overlays/shared/mobys/select_auto_aim_target_moby.c +++ b/src/overlays/shared/mobys/select_auto_aim_target_moby.c @@ -241,7 +241,7 @@ typedef struct { s32 w24; u8 pad28[2]; u8 b2A; - u8 b2B; + u8 initial_frame_count; } EffectTail; typedef struct { @@ -298,7 +298,7 @@ void cutscene_set_camera_target(u8 *moby) { effect->hA = scale_game_frames(6); tail->w24 = w24; tail->b2A = b2A; - tail->b2B = effect->hA; + tail->initial_frame_count = effect->hA; } count--; } while (count >= 0); @@ -328,7 +328,7 @@ void cutscene_set_camera_target(u8 *moby) { effect->b8 = random_integer_below(0xff); tail->w24 = w24; tail->b2A = b2A; - tail->b2B = effect->hA; + tail->initial_frame_count = effect->hA; } count--; } while (count >= 0); From e07d5554f5ce91bc64db425324fcbdac07c9ceb7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:03:03 +0000 Subject: [PATCH 279/758] decomp: clarify names in render_drek_boss_joint_glows p3A0 -> attached_joint_glow_moby: Retail 0x002f78b4 loads boss pvars into s3; 0x002f792c and 0x002f7954 load pvars+0x3A0 as a0 for moby_point_position at 0x002f7938/0x002f795c with joint indices 1 and 2. The returned positions immediately feed glow quad draws at 0x002f794c/0x002f7970. Supplied C additionally creates class 0x58F at boss_data+0x3A0 and attaches its transform/position to boss joint 4, proving this void pointer is the attached moby supplying joint glow positions. p3B8 -> joint_glow_color: The authoritative C declares L18Q.p3B8 as int and uses it as the color argument of draw_offset_textured_effect_quad for joints 11+i. Retail 0x002f7a40..0x002f7a78 iterates eight joints 11..18; 0x002f7a54 loads pvars+0x3B8 into a1 immediately before the draw at 0x002f7a6c. Supplied helper copies col to all four quad vertex colors. Boss update C constructs this same stored word from tweened RGBA channels with red and blue divided by three, corroborating its packed glow-color role. --- src/overlays/l18/mobys/drek_final_boss_robot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l18/mobys/drek_final_boss_robot.c b/src/overlays/l18/mobys/drek_final_boss_robot.c index 8ff5e7b2ac..ef56425998 100644 --- a/src/overlays/l18/mobys/drek_final_boss_robot.c +++ b/src/overlays/l18/mobys/drek_final_boss_robot.c @@ -2775,9 +2775,9 @@ extern void draw_offset_textured_effect_quad(void *, int, float, float) __asm__( typedef struct { char pad0[0x3A0]; - void *p3A0; + void *attached_joint_glow_moby; char pad3A4[0x14]; - int p3B8; + int joint_glow_color; } L18Q; extern f32 D_L18_00162450_gp __asm__("D_L18_00162450") __attribute__((sda)); @@ -2812,12 +2812,12 @@ void render_drek_boss_joint_glows(struct Moby *moby) { attached_glow_color = fast_tween_color(*(int *)&D_L18_00162458_gp, *(int *)&D_L18_0016245C_gp, attached_glow_cycle_value * 0.5f + 0.5f); - moby_point_position(boss_vars->p3A0, 1, joint_world_position); + moby_point_position(boss_vars->attached_joint_glow_moby, 1, joint_world_position); draw_offset_textured_effect_quad(joint_world_position, attached_glow_color, *(float *)&D_L18_00162450_gp, *(float *)&D_L18_00162454_gp); - moby_point_position(boss_vars->p3A0, 2, joint_world_position); + moby_point_position(boss_vars->attached_joint_glow_moby, 2, joint_world_position); draw_offset_textured_effect_quad(joint_world_position, attached_glow_color, *(float *)&D_L18_00162450_gp, @@ -2851,7 +2851,7 @@ void render_drek_boss_joint_glows(struct Moby *moby) { } for (i = 0; i < 8; i++) { moby_point_position(moby, 11 + i, joint_world_position); - draw_offset_textured_effect_quad(joint_world_position, boss_vars->p3B8, 0.7f, 0.5f); + draw_offset_textured_effect_quad(joint_world_position, boss_vars->joint_glow_color, 0.7f, 0.5f); } } From 2abd4210db9a9a11c89b35e7fd9a66a33b498053 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:03:06 +0000 Subject: [PATCH 280/758] decomp: clarify names in update_animated_source_attached_fade_in_out_effect_particle b20 -> attachment_source_status: Retail 0x0026e3d8 loads the attachment source pointer from particle+0x20, 0x0026e3dc rejects null, and 0x0026e3e4 loads its signed byte at +0x20; bltz at 0x0026e3e8 reaches particle free at 0x0026e584. C expresses this as e->m->b20 < 0. The same source e->m is passed to moby_point_position at 0x0026e614-0x0026e61c to obtain the attachment position, proving this byte is attachment-source status used to reject invalid sources, rather than a particle color or animation byte. --- .../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 76c47ec8cb..77051f1a41 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 @@ -2419,7 +2419,7 @@ void update_moving_fade_in_out_effect_particle(M_26e150 *particle) { typedef struct { u8 pad0[0x20]; - s8 b20; + s8 attachment_source_status; } T_26e3a8; typedef struct { @@ -2456,7 +2456,7 @@ void update_animated_source_attached_fade_in_out_effect_particle(P_26e3a8 *parti return; } e = &particle->e; - if (fast_dec_timer_s16(&particle->hA) || e->m == 0 || e->m->b20 < 0) { + if (fast_dec_timer_s16(&particle->hA) || e->m == 0 || e->m->attachment_source_status < 0) { goto kill; } e->hC = (e->hC + 1) & 0xF; From f59333c69116b1854ec9559b1319b8b49fb6a9fa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:03:10 +0000 Subject: [PATCH 281/758] decomp: clarify names in update_moby_point_attached_alpha_pulse_particle b20 -> attachment_owner_status: Retail 0x00273478 loads the attachment owner from particle+0x20; 0x00273484 loads its signed byte at owner+0x20 and 0x00273488 branches on negative to free_effect_particle at 0x00273624. The same owner is loaded at 0x002736a4 and passed to moby_point_position at 0x002736b0. In the authoritative C, T_273448::b20 is s8 and e->m->b20 < 0 rejects the attachment owner, proving its owner status role rather than merely its offset. --- 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 5d856a5dfc..f9007a0da6 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -1084,7 +1084,7 @@ void update_moving_hero_relative_alpha_fade_particle(Part_273298 *particle) { typedef struct { u8 pad0[0x20]; - s8 b20; + s8 attachment_owner_status; } T_273448; typedef struct { @@ -1120,7 +1120,7 @@ void update_moby_point_attached_alpha_pulse_particle(P_273448 *particle) { return; } e = &particle->e; - if (fast_dec_timer_s16(&particle->hA) || e->m == 0 || e->m->b20 < 0) { + if (fast_dec_timer_s16(&particle->hA) || e->m == 0 || e->m->attachment_owner_status < 0) { goto kill; } e->hC = (e->hC + 1) & 0xF; From 3dbc7a21c4e0033979868197cd709f941f7224d6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:05:11 +0000 Subject: [PATCH 282/758] decomp: clarify names in select_hero_grapple_swing_target i0 -> swing_target_enabled: In select_hero_grapple_swing_target, retail 0x00221f38..0x00221f44 restricts candidates to class 0x323, then 0x00221f4c loads candidate_moby+0x78 into s2 and 0x00221f50 loads its first s32. At 0x00221f54 a zero value branches to candidate advance (next at +0x28), excluding it before height/range/angular scoring. Original Ghidra likewise tests *piVar2 == 0 and skips. The bound C represents this as q=candidate_moby->q; if(q->i0==0) continue, proving a nonzero swing-target eligibility enable gate. --- 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 c75af9ce2e..2bd6d468d3 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -404,7 +404,7 @@ typedef struct { } G_221ee0; typedef struct { - s32 i0; + s32 swing_target_enabled; u8 p0[0x18]; s32 i1C; f32 f20; @@ -452,7 +452,7 @@ void select_hero_grapple_swing_target(void) { if (candidate_moby->hA6 != 0x323) continue; q = candidate_moby->q; - if (q->i0 == 0) + if (q->swing_target_enabled == 0) continue; if (candidate_moby->h34 & 1) continue; From 54a2a7d579458e6fca8ee0026d460a4ac2482287 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:06:48 +0000 Subject: [PATCH 283/758] decomp: clarify names in update_chomper_hit_reaction_and_target i1C0 -> target_moby: Current L16PursuitData declares int i1C0. Assigned retail 0x002e635c passes pursuit_data+0x180 as target output to checked helper 0x0025b830. The helper keeps that output in s5 (0x0025b848), selects a moby in s8 (hero load 0x0025b890, candidate selections 0x0025ba94/0x0025bba4), then stores s8 at output+0x40 (0x0025bbc8) and copies that moby's position from +0x10 into output (0x0025bbcc-0x0025bbd0); when none is selected it zeros output+0x40 (0x0025bc58). Thus the member at pvars+0x1C0 is the selected target moby. Assigned 0x002e63e0-0x002e6404 tests it for zero and stores hero.moby alongside hero.motion.pos fallback, exactly as current C and original Ghidra show. Preserve its int storage type. i1C4 -> target_selection_status: Current L16PursuitData declares int i1C4. Assigned retail 0x002e635c supplies target output at pvars+0x180. Checked target helper 0x0025b830 initializes a status at sp+0x10 to 0 (0x0025b898), assigns 2 when hero is excluded (0x0025b8ac-0x0025b8c0 and 0x0025b978-0x0025b980), and assigns 1 upon alternate moby selection (0x0025ba90-0x0025ba98 and 0x0025bba0-0x0025bba8). Its epilogue stores this status to output+0x44 at 0x0025bc80 and returns the same status at 0x0025bc88. This proves the pvars+0x1C4 member records target-selection status. Assigned 0x002e63ac/0x002e63dc overrides it with 2 when target exceeds 16-unit home XY distance or 3-unit vertical separation; chomper_update checks the same offset through unk1C4 to gate approach/return states. Original Ghidra and authoritative C agree. --- src/overlays/l16/mobys/chomper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l16/mobys/chomper.c b/src/overlays/l16/mobys/chomper.c index a18891a639..3a7a655fe3 100644 --- a/src/overlays/l16/mobys/chomper.c +++ b/src/overlays/l16/mobys/chomper.c @@ -221,8 +221,8 @@ typedef struct { char pad178[8]; float target[4]; /* 0x180 */ char pad190[0x30]; - int i1C0; - int i1C4; + int target_moby; + int target_selection_status; char pad1C8[8]; float home[4]; /* 0x1D0 */ char pad1E0[0x10]; @@ -308,12 +308,12 @@ void update_chomper_hit_reaction_and_target(void *chomper_instance) { *(int *)reaction_kind_or_path_address) != 2) { if (vector_distance_xy(pursuit_data->home, pursuit_data->target) > 16.0f || absolute_float(chomper_moby->position[2] - pursuit_data->target[2]) > 3.0f) { - pursuit_data->i1C4 = 2; + pursuit_data->target_selection_status = 2; } } - if (pursuit_data->i1C0 == 0) { + if (pursuit_data->target_moby == 0) { struct Hero *player = &hero; - pursuit_data->i1C0 = (int)player->moby; + pursuit_data->target_moby = (int)player->moby; qcopy(pursuit_data->target, &player->motion.pos); } } From 9590fa47b1f11db886ccf28e7889cf481429db34 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:16:04 +0000 Subject: [PATCH 284/758] decomp: clarify names in rocket_moby_update f24 -> configured_movement_rotation_z: In authoritative src/overlays/l18/mobys/rocket.c (SHA-256 99ff7a8e9cbfcb2497b910e67427173164f029e85b7996048141453453b78397), create_rocket_moby stores its movement_rotation_z argument into rocket private vars +0x24. Assigned retail 0x002d5164-0x002d5188 clears the Euler input, loads float +0x24 from s4=moby->pvars at 0x002d516c, stores it into sp+0x28 (rotation_angles[2]) at 0x002d517c, and builds configured_rotation_basis at 0x002d5184. Retail 0x002d518c-0x002d51b8 applies inverse target heading, this configured basis, then forward target heading to target_movement_step. The resulting step feeds movement blending at 0x002d51bc-0x002d51d0 and position advance at 0x002d51e0-0x002d51ec. Thus f24 is the configured movement Z rotation, not merely an unknown float at an offset. --- src/overlays/l18/mobys/rocket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l18/mobys/rocket.c b/src/overlays/l18/mobys/rocket.c index ed68e25168..dce0f0ce94 100644 --- a/src/overlays/l18/mobys/rocket.c +++ b/src/overlays/l18/mobys/rocket.c @@ -29,7 +29,7 @@ extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001e typedef struct { char pad0[0x24]; - float f24; + float configured_movement_rotation_z; float f28; int c; int lim; @@ -79,7 +79,7 @@ void rocket_moby_update(struct Moby *moby) { euler_rotation_basis(target_heading_basis, rotation_angles); transpose_rotation_matrix(aA0, target_heading_basis); clear_u64_value(rotation_angles); - rotation_angles[2] = moby_vars->f24; + rotation_angles[2] = moby_vars->configured_movement_rotation_z; rotation_angles[1] = moby_vars->f28; euler_rotation_basis(configured_rotation_basis, rotation_angles); transform_vector_by_basis(target_movement_step, target_movement_step, aA0); From 765bef2a779a0b6920961b878c92ec064203b24c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:18:04 +0000 Subject: [PATCH 285/758] decomp: clarify names in launch_hero_wrench unk76 -> near_wall_launch_flag: The source writes this s16 to 1 only when hero.wall_probe_distance < 1.2f, hero.wall_normal_pitch > 0.6632251f and hero.wall_probe_moby_in_class_range is zero while launching the class-checked wrench. Retail 0x002177b4-0x002177f0 performs those three tests, followed by li v0,1 at 0x002177f8 and sh v0,0x76(s3) at 0x002177fc, with s3 loaded from wrench->pvars at 0x002177c4. Original Ghidra agrees. This proves a flag recording the near-wall launch condition, without inferring its later effect. unk7E -> has_aim_target_position: In authoritative source SHA-256 6d021c1d3806db1b5ec2b6911a09365bc4bf3234d643866a826ab6dc2e5f8545, this s16 gates using tpv->unk50 as an aim target position. Retail 0x002176dc loads wrench pvars, 0x002176e0-0x002176e4 tests its +0x7E halfword, then 0x00217708-0x00217714 subtracts the hero-transformed world aim origin from pvars+0x50. 0x00217718-0x0021773c computes hero aim yaw/pitch from that delta; a zero flag selects camera fallback. Original Ghidra shows the same nonzero short gate and position subtraction. --- src/overlays/shared/hero/hero_move_state_velocity.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/hero_move_state_velocity.c b/src/overlays/shared/hero/hero_move_state_velocity.c index 521b98b4d5..e91343394d 100644 --- a/src/overlays/shared/hero/hero_move_state_velocity.c +++ b/src/overlays/shared/hero/hero_move_state_velocity.c @@ -1224,9 +1224,9 @@ typedef struct { f32 unk60; /* 0x60: speed */ s32 unk64; u8 pad68[0xE]; - s16 unk76; + s16 near_wall_launch_flag; u8 pad78[6]; - s16 unk7E; + s16 has_aim_target_position; } ThrowPvars; #include "rnc/overlay/shared/camera/level_camera.h" @@ -1272,7 +1272,7 @@ void launch_hero_wrench(void) { has_target = 0; if (target != NULL && is_wrench_moby(target)) { tpv = (ThrowPvars *)target->pvars; - if (tpv->unk7E) { + if (tpv->has_aim_target_position) { has_target = 1; transform_hero_local_offset_to_world(aim_origin_or_euler_angles, 0.5f, 0.0f, 0.5f); fast_vec_sub(delta, tpv->unk50, aim_origin_or_euler_angles); @@ -1297,7 +1297,7 @@ void launch_hero_wrench(void) { launched_item_vars = (ThrowPvars *)equipped_wrench_moby->pvars; if (hero.wall_probe_distance < 1.2f && 0.6632251f < hero.wall_normal_pitch && !hero.wall_probe_moby_in_class_range) { - launched_item_vars->unk76 = 1; + launched_item_vars->near_wall_launch_flag = 1; } clear_u64_value(launched_item_vars->unk40); if (!aimed) { From 13ac521fea8af11c6c19cc0b533f64f52d79b40f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:18:07 +0000 Subject: [PATCH 286/758] decomp: clarify names in spawn_bolt_by_value unk6E -> glint_delay_frames: Retail 002a751c loads spawned bolt pvars into s2; 002a75f4-002a760c scales 600 game frames, draws random_int_between(0, scaled_frames), and stores its halfword at pvars+0x6E, next to slot=-1 at +0x6C (002a7610). Original Ghidra confirms the same random halfword initialization. Authoritative C's BoltVars view names these same members slot_timer and slot: in bolt_update BOLT_IDLE, when slot is negative, --slot_timer > 0 defers allocate_glint_slot; expiration allocates a glint and resets slot_timer to random scaled 300..600 frames. This semantic use proves BoltVars_u.unk6E is the delay countdown before glint allocation, supporting glint_delay_frames rather than an offset-only name. --- src/overlays/shared/pickups/bolt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/pickups/bolt.c b/src/overlays/shared/pickups/bolt.c index b4ef3aa11e..cdb8b63d83 100644 --- a/src/overlays/shared/pickups/bolt.c +++ b/src/overlays/shared/pickups/bolt.c @@ -117,7 +117,7 @@ typedef struct { u8 pad_5C[0xC]; f32 start_z; /* 0x68 */ s16 unk6C; - s16 unk6E; /* random 0 .. 600 frames */ + s16 glint_delay_frames; /* random 0 .. 600 frames */ } BoltVars_u; extern float D_0015ED6C; @@ -787,7 +787,7 @@ struct Moby *spawn_bolt_by_value( set_moby_color(spawned_bolt, color[4], color[5], color[6]); else spawned_bolt->spawn_frame = bolt_source->spawn_frame; - bolt_vars->unk6E = random_int_between(0, scale_game_frames(600)); + bolt_vars->glint_delay_frames = random_int_between(0, scale_game_frames(600)); bolt_vars->unk6C = -1; qcopy(&spawned_bolt->pos, pos); qcopy(bolt_vars->vel, vel); From 599eeac469aa1c1967ea4755fe907e61c512f732 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:18:11 +0000 Subject: [PATCH 287/758] decomp: clarify names in enemy_fighter_update f74 -> position_y_spring_state: Assigned retail 0x002fc374 clears pvars+0x74 on respawn. Checked level-14 helper 0x002fca38-0x002fca50 supplies target position Y from sp+4, &moby->pos.y (moby+0x14) as a0, and pvars+0x74 as a1 to 0x00263c40 with the flight spring strength/damping. Authoritative C pairs this address with pos.y in FUN_L00_0025b8c0, proving Y position spring state. f78 -> position_z_spring_state: Assigned retail 0x002fc370 clears pvars+0x78 on respawn. Checked helper 0x002fca54-0x002fca6c supplies target position Z from sp+8, &moby->pos.z (moby+0x18) as a0, and pvars+0x78 as a1 to 0x00263c40 with flight spring strength/damping. Matching C passes this field alongside pos.z, proving Z position spring state. f80 -> bank_spring_state: Assigned retail 0x002fc36c clears pvars+0x80 on respawn. Checked helper 0x002fcb1c-0x002fcb7c divides yaw error by the established bank yaw-error scale, clamps it to [-1,1], multiplies by bank angle scale, and passes &moby->rot.x (moby+0x40) plus pvars+0x80 to 0x00263c40. The authoritative C confirms this is the spring state for banking rotation. f84 -> pitch_spring_state: Assigned retail 0x002fc380 clears pvars+0x84 on respawn. Checked helper 0x002fcaec-0x002fcb18 computes the path vertical angle from XY length and Z delta, negates that angle, and supplies &moby->rot.y (moby+0x44) with pvars+0x84 to 0x00263c40 using flight spring strength/damping. The matching C proves this field is the pitch spring state. f88 -> yaw_spring_state: Assigned retail 0x002fc37c clears pvars+0x88 on respawn. Checked helper 0x002fcab4 computes target yaw from path XY delta; 0x002fcac0 loads current yaw at moby+0x48, and 0x002fcad0-0x002fcae8 passes pvars+0x88 and target yaw to 0x00260778 with flight spring strength/damping. Authoritative C supplies the same field to FUN_L00_00258278 for target_yaw, proving yaw spring state. --- 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 ae1ff5974c..cd6f618025 100644 --- a/src/overlays/l14/mobys/enemy_fighter.c +++ b/src/overlays/l14/mobys/enemy_fighter.c @@ -56,12 +56,12 @@ typedef struct { s32 path; /* 0x68 */ s32 sound; /* 0x6C */ f32 f70; /* 0x70 */ - f32 f74; /* 0x74 */ - f32 f78; /* 0x78 */ + f32 position_y_spring_state; /* 0x74 */ + f32 position_z_spring_state; /* 0x78 */ s32 timer; /* 0x7C */ - f32 f80; /* 0x80 */ - f32 f84; /* 0x84 */ - f32 f88; /* 0x88 */ + f32 bank_spring_state; /* 0x80 */ + f32 pitch_spring_state; /* 0x84 */ + f32 yaw_spring_state; /* 0x88 */ } EnemyFighterVars; void enemy_fighter_update(struct Moby *moby) __asm__("FUN_L14_002fc0f0"); @@ -131,8 +131,8 @@ void enemy_fighter_update(struct Moby *moby) { qcopy(&moby->pos, path + 0x10); moby->rot.z = fast_arc_tan(*(float *)(path + 0x20) - *(float *)(path + 0x10), *(float *)(path + 0x24) - *(float *)(path + 0x14)); - enemy_fighter_vars->f80 = enemy_fighter_vars->f84 = enemy_fighter_vars->f88 = - enemy_fighter_vars->f70 = enemy_fighter_vars->f74 = enemy_fighter_vars->f78 = 0.0f; + enemy_fighter_vars->bank_spring_state = enemy_fighter_vars->pitch_spring_state = enemy_fighter_vars->yaw_spring_state = + enemy_fighter_vars->f70 = enemy_fighter_vars->position_y_spring_state = enemy_fighter_vars->position_z_spring_state = 0.0f; } break; } From b0d52b643292bde519879fee0282260317f59d9c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:20:33 +0000 Subject: [PATCH 288/758] decomp: clarify names in handle_constructorbot_damage_and_retargeting f80 -> knockback_gravity_step: Authoritative C assigns constructorbot_gravity_gp * frame_time_sq in both damage branches. Retail 0x002d86e4/0x002d86f0/0x002d8708 and 0x002d87a0/0x002d87b4/0x002d87d4 confirm the coefficient multiply and stores to pvars+0x80. The supplied retail annotation records checked mine_fall 0x0025ecfc..0x0025ed10 subtracting this state+0x10 field from Z velocity at state+8, proving a per-step gravity decrement, not merely an offset-based name. f84 -> knockback_horizontal_speed_approach_step: C assigns the established hit/death knockback_horizontal_speed_approach_rate_gp coefficients times frame_time_sq. Retail 0x002d86e8/0x002d86f8/0x002d8710 and 0x002d87a8/0x002d87bc/0x002d87d8 confirm the stores. Supplied checked mine_fall evidence 0x0025ed28..0x0025ed60 uses state+0x14 as the bounded approach step toward horizontal target speed and rescales XY velocity; this is not necessarily unconditional deceleration. f88 -> knockback_initial_horizontal_speed: C stores established hit/death horizontal speed coefficients times D_0015ED6C. Retail 0x002d86ec/0x002d8700/0x002d8720 and 0x002d87b0/0x002d87c4/0x002d87dc confirm pvars+0x88 stores before trooper_start_knockback. Checked helper 0x0025eb80 (request fe09b9cad935497eaa8ad1a3645e94c1, report SHA-256 57672c0c0f6ab7eba1cb2915edaf0ec33df262aa12ed3aeb16f96d654ab4b596) loads state+0x18 at 0x0025ebbc/0x0025ebd0, multiplies heading cosine/sine, and stores initial X/Y velocities at state+0/+4. f8C -> knockback_initial_vertical_speed: C assigns the established hit/death vertical speed coefficients times D_0015ED6C. Retail 0x002d86f4/0x002d8704/0x002d8718 and 0x002d87b8/0x002d87c8/0x002d87e0 confirm pvars+0x8c initialization. Checked trooper_start_knockback 0x0025ebd8 loads this state+0x1c field and 0x0025ebf4 copies it into Z velocity at state+8, proving the initial vertical speed role. --- src/overlays/l02/mobys/constructorbot.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/l02/mobys/constructorbot.c b/src/overlays/l02/mobys/constructorbot.c index d1fef05bc2..2d4dfa57f3 100644 --- a/src/overlays/l02/mobys/constructorbot.c +++ b/src/overlays/l02/mobys/constructorbot.c @@ -568,10 +568,10 @@ typedef struct { unsigned char flash; /* 0x67 */ char pad68[8]; char knock[0x10]; /* 0x70: passed to trooper_start_knockback */ - float f80; /* 0x80 */ - float f84; - float f88; - float f8C; + float knockback_gravity_step; /* 0x80 */ + float knockback_horizontal_speed_approach_step; + float knockback_initial_horizontal_speed; + float knockback_initial_vertical_speed; int i90; /* 0x90 */ int i94; float f98; @@ -613,11 +613,11 @@ void handle_constructorbot_damage_and_retargeting(void *owner_moby) { } else { void *k = moby_vars->knock; moby_vars->flash = 0x78; - moby_vars->f80 = constructorbot_gravity_gp * frame_time_sq; - moby_vars->f84 = + moby_vars->knockback_gravity_step = constructorbot_gravity_gp * frame_time_sq; + moby_vars->knockback_horizontal_speed_approach_step = constructorbot_hit_knockback_horizontal_speed_approach_rate_gp * frame_time_sq; - moby_vars->f88 = constructorbot_hit_knockback_horizontal_speed_gp * D_0015ED6C; - moby_vars->f8C = constructorbot_hit_knockback_vertical_speed_gp * D_0015ED6C; + moby_vars->knockback_initial_horizontal_speed = constructorbot_hit_knockback_horizontal_speed_gp * D_0015ED6C; + moby_vars->knockback_initial_vertical_speed = constructorbot_hit_knockback_vertical_speed_gp * D_0015ED6C; moby_vars->fBC = constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C; moby_vars->fA0 = 0.5f; moby_vars->i94 = 25; @@ -635,11 +635,11 @@ void handle_constructorbot_damage_and_retargeting(void *owner_moby) { } } else { void *k2 = moby_vars->knock; - moby_vars->f80 = constructorbot_gravity_gp * frame_time_sq; - moby_vars->f84 = + moby_vars->knockback_gravity_step = constructorbot_gravity_gp * frame_time_sq; + moby_vars->knockback_horizontal_speed_approach_step = constructorbot_death_knockback_horizontal_speed_approach_rate_gp * frame_time_sq; - moby_vars->f88 = constructorbot_death_knockback_horizontal_speed_gp * D_0015ED6C; - moby_vars->f8C = constructorbot_death_knockback_vertical_speed_gp * D_0015ED6C; + moby_vars->knockback_initial_horizontal_speed = constructorbot_death_knockback_horizontal_speed_gp * D_0015ED6C; + moby_vars->knockback_initial_vertical_speed = constructorbot_death_knockback_vertical_speed_gp * D_0015ED6C; moby_vars->fBC = constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C; moby_vars->i94 = 9; moby_vars->bAD = 0; From 1a64b21012f55d6adfca8e7d2f4d2dbd50992f22 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:20:37 +0000 Subject: [PATCH 289/758] decomp: clarify names in clip_hero_velocity_against_probed_surfaces i18 -> hit_moby: In authoritative hero_switch_item.c SHA-256 eb143887a5ddf8b4a4c99ef76b72f42599efcbf96549f04140b66661f87d5136, X_212318 aliases the collision result D_L00_00173E40, also declared as CollisionHit coll_hit and HH. The typed HH.moby is tested as a moby, passed to is_moby_in_class_range_500_to_540/get_moby_target_info and assigned to hero.ground_moby in the contact consumer. The supplied retail annotation identifies 0x00212628-0x0021268c as recording the hit owner; original decompilation copies DAT_00173e58 to uRam0013f590, and instructions 0x00212628 (lw v0,0x18(s0)) and 0x00212638 (sw v0,0x240(s2)) prove i18 is that reference after the two collision probes. Thus hit_moby describes the collision record's moby reference rather than inventing an offset-only name; retain its existing s32 storage. --- 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 6458c7348d..06999b7f7f 100644 --- a/src/overlays/shared/hero/hero_switch_item.c +++ b/src/overlays/shared/hero/hero_switch_item.c @@ -3190,7 +3190,7 @@ typedef struct { typedef struct { u8 p0[0x18]; - s32 i18; + s32 hit_moby; s32 i1C; u8 p1[0x40 - 0x20]; V_212318 v40; @@ -3266,7 +3266,7 @@ void clip_hero_velocity_against_probed_surfaces(int force) { X.i1C > 0) primary_hit_normal_angle = fast_arc_tan(X.v40.f[2], vector_length_xy(&X.v40)); if (0.8726646304130554f <= primary_hit_normal_angle || r == 8 || r == 12) { - hero.unk240 = X.i18; + hero.unk240 = X.hit_moby; *(s32 *)&X.v40.f[2] = 0; FUN_00125180_212318(&X.v40, &X.v40); inward_velocity_component = From 8f98e525d9a91af2eb1d4c76bf985981fe2d7199 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:20:41 +0000 Subject: [PATCH 290/758] decomp: clarify names in adjust_hero_velocity_from_collision_probes b20A4 -> hero_vehicle_mode: Retail 0x00229280-0x002292a4 reads hero+0x20A4 and selects the mode-1 probe height and length. The authoritative same-file update and restore routines use that same hero+0x20A4 byte for the 1/3 vehicle branches and named hero.vehicle_mode, including HERO_VEHICLE_MODE_CLANK and HERO_VEHICLE_MODE_ON_FOOT. Thus this private byte is the hero vehicle mode. f98 -> probe_heading_angle: Retail 0x0022932c-0x00229384 loads hero+0x98 into fast_cos and fast_sin to construct both probes' horizontal X/Y directions, with Z explicitly zero. The source uses g->f98 only in these trigonometric direction constructions when forced or velocity is too small, proving the heading angle used for the probes without claiming an exact angle range. i18 -> probe_collision_hit_moby: Retail 0x002294c0-0x002294d0 transfers X+0x18 from the shared collision result to hero+0x240 after the angle/material gate. In the authoritative source, coll_hit_pos is explicitly bound to D_L06_001745F0, which is X base 0x001745C0 plus 0x30; resolve_hero_position_collisions assigns hero.coll_hit_moby from ((s32 *)collision_result_position)[-6], exactly X+0x18. This independent semantic use establishes the hit-moby role rather than relying on its offset alone. i240 -> velocity_probe_hit_moby: At retail 0x002294b8-0x002294d0, the collision-probe response copies the shared collision result X+0x18 into P+0x240 before projecting velocity away from the horizontal collision vector. Same-file resolve_hero_position_collisions identifies the source X+0x18 as a collision hit moby via coll_hit_pos (0x001745F0)[-6] assigned to hero.coll_hit_moby. Therefore P.i240 records the hit moby selected by this velocity probe response. --- ...ate_hero_vehicle_attachments_and_effects.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 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 bb1f61f0c8..b473df05cb 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 @@ -417,11 +417,11 @@ typedef struct { typedef struct { u8 p0[0x98]; - f32 f98; + f32 probe_heading_angle; u8 p1[0xE0 - 0x9C]; V_2291d0 vE0; u8 p2[0x240 - 0xF0]; - s32 i240; + s32 velocity_probe_hit_moby; u8 p3[0x308 - 0x244]; s16 h308; u8 p4[0x2080 - 0x30A]; @@ -429,12 +429,12 @@ typedef struct { u8 p5[0x208C - 0x2084]; s32 i208C; u8 p6[0x20A4 - 0x2090]; - u8 b20A4; + u8 hero_vehicle_mode; } P_2291d0; typedef struct { u8 p0[0x18]; - s32 i18; + s32 probe_collision_hit_moby; s32 i1C; u8 p1[0x40 - 0x20]; V_2291d0 v40; @@ -467,7 +467,7 @@ void adjust_hero_velocity_from_collision_probes(int force) { if ((u32)(P.i208C - 0x11) < 2) { primary_origin_z_offset = 0.0f; k = 0.7f; - } else if (P.b20A4 == 1) { + } else if (P.hero_vehicle_mode == 1) { primary_origin_z_offset = 0.35f; k = 0.27000001072883606f; } @@ -479,11 +479,11 @@ void adjust_hero_velocity_from_collision_probes(int force) { if (force || vector_length_xy(vector_origin_base + 0x60) < 0.01f) { g = (P_2291d0 *)(vector_origin_base - 0x80); secondary_vector_scale = 1.4f; - primary_vector_endpoint.f[0] = fast_cos(g->f98) * k; - primary_vector_endpoint.f[1] = fast_sin(g->f98) * k; + primary_vector_endpoint.f[0] = fast_cos(g->probe_heading_angle) * k; + primary_vector_endpoint.f[1] = fast_sin(g->probe_heading_angle) * k; *(s32 *)&primary_vector_endpoint.f[2] = 0; - secondary_vector_endpoint.f[0] = fast_cos(g->f98) * k * secondary_vector_scale; - secondary_vector_endpoint.f[1] = fast_sin(g->f98) * k * secondary_vector_scale; + secondary_vector_endpoint.f[0] = fast_cos(g->probe_heading_angle) * k * secondary_vector_scale; + secondary_vector_endpoint.f[1] = fast_sin(g->probe_heading_angle) * k * secondary_vector_scale; *(s32 *)&secondary_vector_endpoint.f[2] = 0; } else { qcopy(&primary_vector_endpoint, vector_origin_base + 0x60); @@ -504,7 +504,7 @@ void adjust_hero_velocity_from_collision_probes(int force) { X.i1C > 0) primary_probe_result_angle = fast_arc_tan(X.v40.f[2], vector_length_xy(&X.v40)); if (0.8726646304130554f <= primary_probe_result_angle || r == 8 || r == 12) { - P.i240 = X.i18; + P.velocity_probe_hit_moby = X.probe_collision_hit_moby; *(s32 *)&X.v40.f[2] = 0; sceVu0Normalize(&X.v40, &X.v40); negative_horizontal_dot = -P.vE0.f[0] * X.v40.f[0] - P.vE0.f[1] * X.v40.f[1]; From 5003c4e99b5e72be12673a6c2faf700ef63b079c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:20:44 +0000 Subject: [PATCH 291/758] decomp: clarify names in update_robot_dog_hit_reaction_and_target_detection f48 -> facing_yaw: Retail 0x002efc98-0x002efcb0 computes fast_arc_tan(target x/y at vars+0x180/+0x184 minus moby x/y). At 0x002efcb4 it loads the float from moby+0x48 into f12, passes that and the target heading to fast_difference_between_rotations at 0x002efcb8-0x002efcbc, and compares the angular difference against 1.0471976 at 0x002efd0c to select the facing-cone detection mode. Original Ghidra confirms the same +0x48 angular operand. In the authoritative C this is moby->f48; the adjacent movement and aim helpers use moby->rot.z for planar facing comparisons, proving facing_yaw rather than an offset-only interpretation. --- src/overlays/l17/mobys/robot_dog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l17/mobys/robot_dog.c b/src/overlays/l17/mobys/robot_dog.c index 0da5e116c7..c4bbac2128 100644 --- a/src/overlays/l17/mobys/robot_dog.c +++ b/src/overlays/l17/mobys/robot_dog.c @@ -582,7 +582,7 @@ typedef struct { float pos[4]; unsigned char state; char pad21[0x27]; - float f48; + float facing_yaw; char pad4C[0x2C]; Data *data; char pad7C[0x28]; @@ -664,7 +664,7 @@ void update_robot_dog_hit_reaction_and_target_detection(void *moby_v, int clip_v if (fast_vec_dist(moby->pos, moby_vars->v1B0) < 64.0f) { target_heading = fast_arc_tan(moby_vars->v180[0] - moby->pos[0], moby_vars->v180[1] - moby->pos[1]); - yaw = fast_difference_between_rotations(moby->f48, target_heading); + yaw = fast_difference_between_rotations(moby->facing_yaw, target_heading); qcopy(position_buffer, moby->pos); position_buffer[2] += 1.0f; line_query_clear = From b1e69910fb06064902aa9a45c857bc1d209c9f1f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:20:48 +0000 Subject: [PATCH 292/758] decomp: clarify names in glove_of_doom_update unkA2 -> max_delivery_frame_bucket: In GLOVE_RELEASE_HELD_MOBY with held != 0, retail 0x002c7cb4-0x002c7ccc calls the frame-scaling helper and divides its result by 600; 0x002c7cc8-0x002c7cd4 loads DeliveryStats+0xA2 unsigned and skips the write unless this quotient is larger. 0x002c7cdc-0x002c7cf8 recomputes and stores the quotient as u16. This occurs alongside deliveries++ and level-bit recording, immediately before held release at 0x002c7d28. Authoritative C expresses the same conditional maximum of scale_game_frames(D_0015EEA4)/600, proving a maximum delivery frame bucket rather than an offset-only role. --- src/overlays/shared/weapons/glove_of_doom.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/glove_of_doom.c b/src/overlays/shared/weapons/glove_of_doom.c index 526c2e4ff1..a67211eefe 100644 --- a/src/overlays/shared/weapons/glove_of_doom.c +++ b/src/overlays/shared/weapons/glove_of_doom.c @@ -55,7 +55,7 @@ typedef float Mat3_2c7548[3][4] __attribute__((aligned(16))); typedef struct { u8 pad0[0xA0]; u16 deliveries; /* 0xA0: counts up to 0xFFFF */ - u16 unkA2; /* 0xA2: raised to scale_game_frames(D_0015EEA4) / 600 */ + u16 max_delivery_frame_bucket; /* 0xA2: raised to scale_game_frames(D_0015EEA4) / 600 */ u32 levels; /* 0xA4: bit per level index, plus 0x80000000 */ } DeliveryStats; @@ -345,8 +345,8 @@ void glove_of_doom_update(struct Moby *moby) { if (D_00141680.deliveries < 0xFFFF) { D_00141680.deliveries++; } - if (scale_game_frames(D_0015EEA4) / 600 > D_00141680.unkA2) { - D_00141680.unkA2 = scale_game_frames(D_0015EEA4) / 600; + if (scale_game_frames(D_0015EEA4) / 600 > D_00141680.max_delivery_frame_bucket) { + D_00141680.max_delivery_frame_bucket = scale_game_frames(D_0015EEA4) / 600; } D_00141680.levels = D_00141680.levels | (1 << current_level_index) | 0x80000000; release_glove_of_doom_held_moby((void *)&glove_carrier_vars->grip, From 9268697eb6fdb6867b5ff445b4238d1dcb699359 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:20:52 +0000 Subject: [PATCH 293/758] decomp: clarify names in adjust_hero_planar_velocity_from_probes b20A4 -> hero_vehicle_mode: Retail 0x0020a3d8-0x0020a3f4 tests the byte at hero+0x20A4 against 2 and selects the enlarged 1.5 height and 5.0 probe reach; original Ghidra agrees through cRam001413f4. In authoritative same-file code, that byte dispatches modes 2 and 3 for hero/moby effects, while restore_saved_hero_moby_and_clear_vehicle_mode and update_hero_smoothing_parameters identify the corresponding hero vehicle-mode dispatch, including giant Clank and mode 3. This establishes the vehicle-mode selector rather than an arbitrary flag. f98 -> probe_heading_angle: Authoritative C uses g->f98 as the input to fast_cos and fast_sin for both planar probe displacements. Original retail uRam0013f3e8 and 0x0020a47c-0x0020a4d4 load hero+0x98 into f12 for the cosine/sine calls, storing cos(angle)*k as X and sin(angle)*k as Y, clearing Z, and scaling the secondary by 1.4. This proves the angle defining probe heading when force is set or XY velocity is below 0.01. p2080 -> current_hero_moby: Retail 0x0020a54c and 0x0020a588 load hero+0x2080 as the fourth argument to both collision_line calls; original Ghidra agrees through uRam001413d0. The authoritative C elsewhere in this same file explicitly reads hero+0x2080 into hero_moby, accesses MOBY(hero_moby)->flags and color, and passes it to moby_point_position. These object uses establish a hero moby pointer rather than merely a collision argument. --- .../update_hero_and_vehicle_mode_effects.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c b/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c index f143527cae..c5efc09fb2 100644 --- a/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c +++ b/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c @@ -333,7 +333,7 @@ typedef struct { typedef struct { u8 p0[0x98]; - f32 f98; + f32 probe_heading_angle; u8 p1[0xE0 - 0x9C]; V_20a328 vE0; u8 p2[0x240 - 0xF0]; @@ -341,11 +341,11 @@ typedef struct { u8 p3[0x308 - 0x244]; s16 h308; u8 p4[0x2080 - 0x30A]; - void *p2080; + void *current_hero_moby; u8 p5[0x208C - 0x2084]; s32 i208C; u8 p6[0x20A4 - 0x2090]; - u8 b20A4; + u8 hero_vehicle_mode; } P_20a328; typedef struct { @@ -386,7 +386,7 @@ void adjust_hero_planar_velocity_from_probes(int force) { if ((u32)(P.i208C - 0x11) < 2) { position_z_offset = 0.0f; k = 0.7f; - } else if (P.b20A4 == 2) { + } else if (P.hero_vehicle_mode == 2) { position_z_offset = 1.5f; k = 5.0f; } @@ -398,11 +398,11 @@ void adjust_hero_planar_velocity_from_probes(int force) { if (force || vector_length_xy(hero_position + 0x60) < 0.01f) { g = (P_20a328 *)(hero_position - 0x80); secondary_offset_scale = 1.4f; - primary_endpoint.f[0] = fast_cos(g->f98) * k; - primary_endpoint.f[1] = fast_sin(g->f98) * k; + primary_endpoint.f[0] = fast_cos(g->probe_heading_angle) * k; + primary_endpoint.f[1] = fast_sin(g->probe_heading_angle) * k; *(s32 *)&primary_endpoint.f[2] = 0; - secondary_endpoint.f[0] = fast_cos(g->f98) * k * secondary_offset_scale; - secondary_endpoint.f[1] = fast_sin(g->f98) * k * secondary_offset_scale; + secondary_endpoint.f[0] = fast_cos(g->probe_heading_angle) * k * secondary_offset_scale; + secondary_endpoint.f[1] = fast_sin(g->probe_heading_angle) * k * secondary_offset_scale; *(s32 *)&secondary_endpoint.f[2] = 0; } else { qcopy(&primary_endpoint, hero_position + 0x60); @@ -415,10 +415,10 @@ void adjust_hero_planar_velocity_from_probes(int force) { FUN_001f9a10_20a328(&primary_endpoint, &primary_endpoint, &offset_position); FUN_001f9a10_20a328(&secondary_endpoint, &secondary_endpoint, &b); r = -1; - if (collision_line(&b, &secondary_endpoint, 4, P.p2080, 0) && D_L15_0017445C > 0) + if (collision_line(&b, &secondary_endpoint, 4, P.current_hero_moby, 0) && D_L15_0017445C > 0) r = collision_hit_material(); primary_probe_result_angle = 0.0f; - if (collision_line(&offset_position, &primary_endpoint, 4, P.p2080, 0) && X.i1C > 0) + if (collision_line(&offset_position, &primary_endpoint, 4, P.current_hero_moby, 0) && X.i1C > 0) primary_probe_result_angle = fast_arc_tan(X.v40.f[2], vector_length_xy(&X.v40)); if (0.8726646304130554f <= primary_probe_result_angle || r == 8 || r == 12) { P.i240 = X.i18; From db6695eb73f1d6fcce1616ec2298f4508dd6c7a4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:23:25 +0000 Subject: [PATCH 294/758] decomp: clarify names in update_hero_moby_probed_height_bounds f84 -> probed_height_lower_bound: In the supplied C, lo starts at probe_reference_z and is reduced by min_float(lo, u->hit_z) after successful collision_line calls. Retail 0x00208e4c-0x00208e64 accumulates that minimum in f21; 0x00208e8c subtracts 0.12 and 0x00208ea8 stores it at moby+0x84. At 0x00208eb8-0x00208ed0 this same field plus 3.0 caps the upper bound at +0x88. The no-reference path clears both fields (0x00208d50/0x00208d5c). Thus f84 is the padded lower bound of the probed height interval, not merely an offset-labelled float. m2080 -> height_probe_moby: The supplied C binds G to D_0013F350, the same hero object whose readable caller/helper uses identify +0x2080 as hero.moby. Original Ghidra uses iRam001413d0 throughout. Retail loads that pointer at 0x00208c98 for get_moby_light_direction, at 0x00208da0 for the vector-scale initialization of each collision probe and the +0xC scale load, and at 0x00208e88-0x00208eb4 for stores of the resulting lower/upper height bounds. Its +0x34 flags and +0xBD are also updated before probing. These accesses establish the hero moby serving the height probes and receiving their bounds. --- src/overlays/shared/hero/hero_idle_sequence.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 4d3c4da319..a64b86b902 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -2028,7 +2028,7 @@ typedef struct { u8 p10[0x34 - 0x10]; u16 h34; u8 p36[0x84 - 0x36]; - f32 f84; + f32 probed_height_lower_bound; f32 f88; u8 p8C[0xBD - 0x8C]; u8 bBD; @@ -2045,7 +2045,7 @@ typedef struct { u8 p310[0xD20 - 0x310]; f32 fD20; u8 pD24[0x2080 - 0xD24]; - M_208b60 *m2080; + M_208b60 *height_probe_moby; s32 i2084; u8 p2088[4]; s32 i208C; @@ -2074,11 +2074,11 @@ void update_hero_moby_probed_height_bounds(void) { V_208b60 *pw, *px; s32 i; if (G.i208C == 0x12 || G.i208C == 0x15 || G.i2084 == 0x7D || G.i208C == 0x16) { - G.m2080->h34 &= 0xFBFF; + G.height_probe_moby->h34 &= 0xFBFF; return; } - G.m2080->h34 |= 0x400; - G.m2080->bBD = 1; + G.height_probe_moby->h34 |= 0x400; + G.height_probe_moby->bBD = 1; k = 0.97f; if (G.h30E != 0 || G.i208C == 4) k = 1.5f; @@ -2088,7 +2088,7 @@ void update_hero_moby_probed_height_bounds(void) { else if (rotation_step < -0.052f) rotation_step = -0.052f; G.fD20 = fast_add_rotations(G.fD20, rotation_step); - get_moby_light_direction(G.m2080, &v); + get_moby_light_direction(G.height_probe_moby, &v); planar_angle = fast_arc_tan(v.f[0], v.f[1]); planar_cosine = fast_cos(planar_angle); planar_sine = fast_sin(planar_angle); @@ -2109,8 +2109,8 @@ void update_hero_moby_probed_height_bounds(void) { if (1.0f < t) probe_reference_z = t; else { - G.m2080->f84 = 0.0f; - G.m2080->f88 = 0.0f; + G.height_probe_moby->probed_height_lower_bound = 0.0f; + G.height_probe_moby->f88 = 0.0f; return; } } @@ -2123,7 +2123,7 @@ void update_hero_moby_probed_height_bounds(void) { for (i = 3; i >= 0; i--, t++) { M_208b60 *m; U_208b60 *u = &(*(U_208b60 *)D_L00_00173E40); - m = G.m2080; + m = G.height_probe_moby; sc = m->fC * 0.0009765625f; fast_vec_scale(pw, m, 0.0009765625f); collision_probe_start.f[0] += planar_cosine * t->x * sc; @@ -2137,11 +2137,11 @@ void update_hero_moby_probed_height_bounds(void) { hi = max_float(hi, u->hit_z); } } - G.m2080->f84 = lo - 0.12f; - G.m2080->f88 = hi + 0.24f; + G.height_probe_moby->probed_height_lower_bound = lo - 0.12f; + G.height_probe_moby->f88 = hi + 0.24f; { - M_208b60 *m = G.m2080; - f32 z = m->f84 + 3.0f; + M_208b60 *m = G.height_probe_moby; + f32 z = m->probed_height_lower_bound + 3.0f; if (z < m->f88) m->f88 = z; } From dbe85df3f08c7416876e25214339f000eede5986 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:23:28 +0000 Subject: [PATCH 295/758] decomp: clarify names in update_mode_controlled_orbiting_trail_particle b7 -> particle_alpha: In the assigned retail instructions, 0x00274554 and 0x002745dc pass particle+4 to decrement_packed_countdown, whose supplied C subtracts/clamps bits 24..31 while preserving the low 24 bits. M_274518.b7 is that word's top byte. Retail 0x00274624 and 0x00274674 load this byte with lb t0,0x7(s1), then 0x0027463c/0x00274690 pass it to spawn_mode_controlled_orbiting_trail_particle as col. The supplied spawn C stores col | 0x409B9B00 at particle+4, retaining this passed alpha in the emitted trail's packed color. Thus particle_alpha is established by both fade and spawn data flow, not offset alone. --- 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 f9007a0da6..db5a0de951 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -1588,7 +1588,7 @@ typedef struct { typedef struct { u8 p0[4]; u8 b4[3]; - s8 b7; + s8 particle_alpha; u8 p8[2]; s16 hA; u8 pC[4]; @@ -1631,7 +1631,7 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { } if (r->h1C == 1) { z = 0.0f; - FUN_L00_002743a8_274518(0, particle->v10, scale_game_frames(10), z, z, 0, particle->b7, 0); + FUN_L00_002743a8_274518(0, particle->v10, scale_game_frames(10), z, z, 0, particle->particle_alpha, 0); } else { position_offset_scratch.x = r->unk0; position_offset_scratch.y = r->unk4; @@ -1643,7 +1643,7 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { z, z, 0, - particle->b7, + particle->particle_alpha, &position_offset_scratch); if (spawned_particle) *(s16 *)(spawned_particle + 0x38) = r->h18; From dd77ffb7844c4d57750d78660c7188c0438d8d3c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:23:32 +0000 Subject: [PATCH 296/758] decomp: clarify names in initialize_level_map_archive unk154 -> map_parameter_pair_second_values: Authoritative source src/overlays/shared/game/run_level_main_loop.c (SHA-256 c557b4ccff663ae60646ee5fe60823be56159e16d4cf479b9a82ac6fe3dcbeda) declares s32 unk154[20] and assigns unk154[i] = map_parameter_pair_defaults[i * 2 + 1]. Retail 0x002464d4 sets a1 to state+0x154 and 0x002464dc establishes source 0x00183ef0. At 0x00246508 lw v1,4(a0) reads the second 32-bit component; 0x00246514 sw v1,0(a1) writes this array, while 0x00246510 advances source eight bytes and 0x00246520 advances destination four bytes for 20 iterations. Original Ghidra agrees: uVar5=puVar10[1]; *puVar12=uVar5, with the first component stored separately at puVar12[-0x14]. Thus this field holds second values of the map parameter pairs, without inferring their units. --- src/overlays/shared/game/run_level_main_loop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/game/run_level_main_loop.c b/src/overlays/shared/game/run_level_main_loop.c index d3413c8032..2b1a7eb07c 100644 --- a/src/overlays/shared/game/run_level_main_loop.c +++ b/src/overlays/shared/game/run_level_main_loop.c @@ -347,7 +347,7 @@ typedef struct { u8 padB0[4]; f32 unkB4[20]; s32 unk104[20]; - s32 unk154[20]; + s32 map_parameter_pair_second_values[20]; u8 pad1a4[0x80]; s32 archive_index; s32 load_state; @@ -411,7 +411,7 @@ void initialize_level_map_archive(void) { for (i = 0; i < 20; i++) { D_L00_001841F0.unk104[i] = map_parameter_pair_defaults[i * 2]; D_L00_001841F0.unkB4[i] = 0.65f; - D_L00_001841F0.unk154[i] = map_parameter_pair_defaults[i * 2 + 1]; + D_L00_001841F0.map_parameter_pair_second_values[i] = map_parameter_pair_defaults[i * 2 + 1]; } } level = current_level_index; From 56a5eaf492ed83be1a9659c04f88068b46179163 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:23:36 +0000 Subject: [PATCH 297/758] decomp: clarify names in update_spiraling_fade_in_out_effect_particle p18 -> spiral_target_moby: R_26c860.p18 is u8 * at particle+0x38. Retail 0x0026c948 loads it from 0x18(s4) and 0x0026c950 passes it with selector 0 to moby_point_position (FUN_0024f7c8), producing reference_position at sp. At 0x0026c960-0x0026c984 reference_position minus particle position is scaled and added to particle position, proving this moby supplies the spiral movement target. At 0x0026ca2c-0x0026ca40 the same pointer plus 0xC0 supplies the rotation matrix to compute_transformed_delta_component(reference_position, matrix, particle position, 1); a positive component triggers free_effect_particle. Both C member uses and original Ghidra particle+0x38 accesses agree. --- .../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 77051f1a41..c0db14a84a 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 @@ -1569,7 +1569,7 @@ typedef struct { f32 fC; f32 f10; f32 f14; - u8 *p18; + u8 *spiral_target_moby; f32 f1C; } R_26c860; @@ -1606,7 +1606,7 @@ void update_spiraling_fade_in_out_effect_particle(M_26c860 *particle) { &transformed_position_offset, &position_offset_scratch, &position_offset_matrix); fast_vec_sub(&particle->v10, &particle->v10, &transformed_position_offset); r->f1C += frame_scale * 0.06001f; - moby_point_position(r->p18, 0, &reference_position); + moby_point_position(r->spiral_target_moby, 0, &reference_position); fast_vec_sub(&position_offset_scratch, &reference_position, &particle->v10); FUN_L00_001ff500_26c860(&position_offset_scratch, &position_offset_scratch, r->f1C); fast_vec_add(&particle->v10, &particle->v10, &position_offset_scratch); @@ -1620,7 +1620,7 @@ void update_spiraling_fade_in_out_effect_particle(M_26c860 *particle) { &transformed_position_offset, &position_offset_scratch, &position_offset_matrix); fast_vec_add(&particle->v10, &particle->v10, &transformed_position_offset); if (zero < compute_transformed_delta_component( - &reference_position, r->p18 + 0xC0, &particle->v10, 1)) { + &reference_position, r->spiral_target_moby + 0xC0, &particle->v10, 1)) { FUN_L00_00267a08_26c860(particle); return; } From a004959883802d9847298137e3c9bcd096fd80bf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:25:42 +0000 Subject: [PATCH 298/758] decomp: clarify names in visibomb_update b53 -> animation_index: At 0x002b32e8-0x002b3304 and 0x002b3400-0x002b3418, byte moby+0x53 is compared with 3 or 1 before blend_moby_animation selects that same index. Checked helper 0x00257880 stores its animation argument s3 into moby+0x53 at 0x00257964 and indexes animation data with it at 0x002578a8-0x002578c8. i0 -> launch_cooldown_frames: The vars pointer from moby+0x78 is passed to fast_dec_timer at 0x002b3088-0x002b3090. Its first s32 gates launch while nonzero at 0x002b30bc-0x002b30c0, and is reloaded with scale_game_frames(0x3c) at 0x002b33b8-0x002b33cc after the launch path, proving a frame-based launch cooldown. i1A4 -> input_button_mask: Retail 0x002b30a8-0x002b30b4 loads controller_state+0x1a4 and ANDs it with hero.items[0].button_mask to gate weapon activation; 0x002b33d0-0x002b33e8 repeats that mask check before the no-ammo voice call. This proves input button bits without assuming held or pressed-edge semantics. i4 -> active_missile_moby: At 0x002b30c8-0x002b30cc this vars+4 s32 blocks another launch when nonzero; 0x002b331c-0x002b3324 stores spawn_visibomb_missile's return there. Checked helper allocates class 0xac at 0x002b5904-0x002b591c, initializes its moby position at 0x002b5978-0x002b597c, and returns that allocated moby in v0 at 0x002b5ae8. i6C -> visibomb_usage_flags: Only on the ammo-success launch path, retail 0x002b33a4-0x002b33c4 reads item_usage+0x6c, ORs in 1 shifted by current_level_index and 0x80000000, then stores it back. The C confirms this is the Visibomb usage bitset recording level use with an additional high flag; the high flag's separate meaning is unresolved. u34 -> moby_flags: Retail 0x002b341c-0x002b3424 preserves the moby's halfword at +0x34 while ORing flag 4. The same assigned function reads hero.moby+0x34 at 0x002b31cc-0x002b31d4 as hero.moby->flags & 1 in authoritative C, identifying this common moby field as flags rather than an offset-only scalar; bit 4's specific behavior is unproven. u68 -> visibomb_use_count: At 0x002b3330-0x002b3348 the item_usage+0x68 u16 increments by one unless already 0xffff. This occurs once after the Visibomb spawn call on the ammo-success path, so it counts Visibomb uses with saturation, without claiming allocation succeeded. u6A -> visibomb_max_use_time: Retail 0x002b3354-0x002b3398 divides scale_game_frames(D_0015EEA4) by 600, compares that quotient to item_usage+0x6a as unsigned u16, and stores only when the quotient is greater. Authoritative C performs this on each ammo-success Visibomb launch, proving a maximum recorded use time in 600-scaled-frame units; epoch and wall-clock units remain unresolved. --- src/overlays/shared/weapons/visibomb.c | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/overlays/shared/weapons/visibomb.c b/src/overlays/shared/weapons/visibomb.c index d3e517eefd..d8428f2dad 100644 --- a/src/overlays/shared/weapons/visibomb.c +++ b/src/overlays/shared/weapons/visibomb.c @@ -18,7 +18,7 @@ typedef struct { u8 pad0[0x1A4]; - s32 i1A4; + s32 input_button_mask; } C_b3058; typedef struct { @@ -36,23 +36,23 @@ typedef struct { typedef struct { u8 pad0[0x68]; - u16 u68; - u16 u6A; - s32 i6C; + u16 visibomb_use_count; + u16 visibomb_max_use_time; + s32 visibomb_usage_flags; } R_b3058; typedef struct { - s32 i0; - s32 i4; + s32 launch_cooldown_frames; + s32 active_missile_moby; } V_b3058; typedef struct { u8 pad0[0x10]; f32 v10[4]; u8 pad20[0x34 - 0x20]; - u16 u34; + u16 moby_flags; u8 pad36[0x53 - 0x36]; - u8 b53; + u8 animation_index; u8 pad54[0x70 - 0x54]; u8 b70; u8 pad71[0x78 - 0x71]; @@ -86,11 +86,11 @@ void visibomb_update(O_b3058 *visibomb_moby) { fast_dec_timer(v); controller = (C_b3058 *)&controller_state; g = &hero; - if (!(controller->i1A4 & g->items[0].button_mask)) + if (!(controller->input_button_mask & g->items[0].button_mask)) goto tail; - if (v->i0 != 0) + if (v->launch_cooldown_frames != 0) goto tail; - if (v->i4 != 0) + if (v->active_missile_moby != 0) goto tail; if (g->item_use_locked != 0) goto tail; @@ -126,26 +126,26 @@ void visibomb_update(O_b3058 *visibomb_moby) { build_spherical_offset(launch_position, 0.6f, launch_yaw, -b); fast_vec_add(launch_position, launch_position, visibomb_moby->v10); } - if (visibomb_moby->b53 != 3) { + if (visibomb_moby->animation_index != 3) { blend_moby_animation(visibomb_moby, 3, 0, 0); } jet_camera_mode(); - v->i4 = spawn_visibomb_missile(visibomb_moby, launch_position, launch_yaw, b); + v->active_missile_moby = spawn_visibomb_missile(visibomb_moby, launch_position, launch_yaw, b); r = (R_b3058 *)item_usage; - if (r->u68 < 0xFFFF) { - r->u68++; + if (r->visibomb_use_count < 0xFFFF) { + r->visibomb_use_count++; } - if (scale_game_frames(D_0015EEA4) / 600 > r->u6A) { - r->u6A = scale_game_frames(D_0015EEA4) / 600; + if (scale_game_frames(D_0015EEA4) / 600 > r->visibomb_max_use_time) { + r->visibomb_max_use_time = scale_game_frames(D_0015EEA4) / 600; } - r->i6C = r->i6C | (1 << current_level_index) | 0x80000000; - v->i0 = scale_game_frames(0x3C); - } else if (controller->i1A4 & g->items[0].button_mask) { + r->visibomb_usage_flags = r->visibomb_usage_flags | (1 << current_level_index) | 0x80000000; + v->launch_cooldown_frames = scale_game_frames(0x3C); + } else if (controller->input_button_mask & g->items[0].button_mask) { allocate_voice_for_target_entry(0, 0, visibomb_moby); } tail: - if ((visibomb_moby->b70 & 2) && visibomb_moby->b53 != 1) { + if ((visibomb_moby->b70 & 2) && visibomb_moby->animation_index != 1) { blend_moby_animation(visibomb_moby, 1, 0, 0); } - visibomb_moby->u34 |= 4; + visibomb_moby->moby_flags |= 4; } From 606f16c34e08a4c7de2cd23bdca7dd7187f7bd7f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:25:46 +0000 Subject: [PATCH 299/758] decomp: clarify names in update_infobot_slot_path_motion v60 -> slot_path_speed: Retail 0x002d5a50 loads private-state+0x60 for speed-squared stopping distance; 0x002d5a74-0x002d5abc subtracts/adds frame_time_sq*16 and clamps the stored speed. At 0x002d5c60-0x002d5c88 it caps target-minus-position vector length before normalization and position addition. Source st->v60 has these same operations and parallels Infobot.speed in INFOBOT_FOLLOW_PATH, proving slot-path movement speed. v64 -> rotation_x_turn_step: Retail 0x002d5d68 passes private-state+0x64 as the mutable state pointer to spring_turn at 0x002d5da0, with moby+0x40 current rotation and movement-derived sine tilt target; its return is stored to moby+0x40 at 0x002d5da8. Source turn_f(&st->v64,moby->f40,xb,...) parallels Infobot.spin[0] and moby->rot.x. Supplied spring_turn updates *turn_step then adds it to current_angle, proving X rotation turn-step state. v68 -> rotation_y_turn_step: Retail 0x002d5d00 passes private-state+0x68 as mutable spring_turn state; 0x002d5d48 loads moby+0x44 current angle, 0x002d5d50 supplies the cosine-derived tilt target, and 0x002d5d58 returns the rotation stored at moby+0x44 by 0x002d5da4. Source turn_f(&st->v68,moby->f44,xa,...) parallels Infobot.spin[1] for rot.y; supplied spring_turn proves this is the persistent Y rotation turn step. v6C -> rotation_z_turn_step: Retail 0x002d5c08 derives an XY bearing toward the next path point or terminal look target. 0x002d5c10 loads moby+0x48 current heading; 0x002d5c3c-0x002d5c40 calls spring_turn with private-state+0x6c, and 0x002d5c44 stores its returned heading to moby+0x48. Source turn_f(&st->v6C,moby->f48,target_yaw_or_movement_yaw_offset,...) and parallel Infobot.spin[2]/rot.z establish persistent Z rotation turn-step state, not the heading itself. --- src/overlays/shared/pickups/infobot.c | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/overlays/shared/pickups/infobot.c b/src/overlays/shared/pickups/infobot.c index 6d6d6816fd..5d420da797 100644 --- a/src/overlays/shared/pickups/infobot.c +++ b/src/overlays/shared/pickups/infobot.c @@ -35,10 +35,10 @@ typedef union { typedef struct { u8 p0[0x60]; - float v60; - float v64; - float v68; - float v6C; + float slot_path_speed; + float rotation_x_turn_step; + float rotation_y_turn_step; + float rotation_z_turn_step; } St; typedef struct { @@ -213,20 +213,20 @@ void update_infobot_slot_path_motion(Obj *moby, Path_2d5988 *path, s32 arrival_s endpoint_distance_or_step_length = fast_vec_dist(&moby->v[0], (void *)((char *)path + path->n * 16)); speed_increment = frame_time_sq * 16.0f; - current_speed = st->v60; + current_speed = st->slot_path_speed; if (endpoint_distance_or_step_length <= (current_speed * current_speed) / (speed_increment + speed_increment)) { f32 low = current_speed - speed_increment; f32 minimum_path_speed = infobot_slot_path_minimum_speed_gp * frame_time; - st->v60 = low; + st->slot_path_speed = low; if (low < minimum_path_speed) - st->v60 = minimum_path_speed; + st->slot_path_speed = minimum_path_speed; } else { f32 high = current_speed + speed_increment; f32 maximum_path_speed = frame_time * 16.0f; - st->v60 = high; + st->slot_path_speed = high; if (maximum_path_speed < high) - st->v60 = maximum_path_speed; + st->slot_path_speed = maximum_path_speed; } path_segment_index = truncate_float_to_s32(w_ / path->a[0].f[3]); segment_offset_or_fraction = @@ -241,7 +241,7 @@ void update_infobot_slot_path_motion(Obj *moby, Path_2d5988 *path, s32 arrival_s endpoint_distance_or_step_length = vector_distance_xy((void *)((char *)path + path->n * 16), &moby->v[0]); if (endpoint_distance_or_step_length < 1.0f) { - if (st->v60 <= infobot_slot_path_minimum_speed_gp * frame_time) { + if (st->slot_path_speed <= infobot_slot_path_minimum_speed_gp * frame_time) { moby->flag = arrival_state; } } @@ -250,30 +250,30 @@ void update_infobot_slot_path_motion(Obj *moby, Path_2d5988 *path, s32 arrival_s fast_arc_tan(path->a[path_segment_index + 1].f[0] - moby->v[0], path->a[path_segment_index + 1].f[1] - moby->v[1]); moby->f48 = - turn_f(&st->v6C, moby->f48, target_yaw_or_movement_yaw_offset, 0.01f, 0.3f, 0.1f); + turn_f(&st->rotation_z_turn_step, moby->f48, target_yaw_or_movement_yaw_offset, 0.01f, 0.3f, 0.1f); } else { target_yaw_or_movement_yaw_offset = fast_arc_tan(hero.motion.pos.f[0] - moby->v[0], hero.motion.pos.f[1] - moby->v[1]); moby->f48 = - turn_f(&st->v6C, moby->f48, target_yaw_or_movement_yaw_offset, 0.01f, 0.3f, 0.1f); + turn_f(&st->rotation_z_turn_step, moby->f48, target_yaw_or_movement_yaw_offset, 0.01f, 0.3f, 0.1f); } fast_vec_sub(&v, &path_target_point, &moby->v[0]); endpoint_distance_or_step_length = FUN_001f9af0_2d5988(&v); - if (st->v60 < endpoint_distance_or_step_length) - endpoint_distance_or_step_length = st->v60; + if (st->slot_path_speed < endpoint_distance_or_step_length) + endpoint_distance_or_step_length = st->slot_path_speed; FUN_001f9bf8_2d5988(&v, &v, endpoint_distance_or_step_length); fast_vec_add(&moby->v[0], &moby->v[0], &v); target_yaw_or_movement_yaw_offset = fast_subtract_rotations(fast_arc_tan(v.f[0], v.f[1]), moby->f48); { f32 xa, xb; - xa = st->v60 * 0.34906584f * FUN_001f9dc8_2d5988(target_yaw_or_movement_yaw_offset) / + xa = st->slot_path_speed * 0.34906584f * FUN_001f9dc8_2d5988(target_yaw_or_movement_yaw_offset) / (frame_time * 16.0f); - xb = st->v60 * -0.34906584f * FUN_001f9de0_2d5988(target_yaw_or_movement_yaw_offset) / + xb = st->slot_path_speed * -0.34906584f * FUN_001f9de0_2d5988(target_yaw_or_movement_yaw_offset) / (frame_time * 16.0f); { f32 updated_rotation_y, k70; - updated_rotation_y = turn_f(&st->v68, + updated_rotation_y = turn_f(&st->rotation_y_turn_step, moby->f44, xa, frame_time_sq * 0.52359879f, @@ -281,7 +281,7 @@ void update_infobot_slot_path_motion(Obj *moby, Path_2d5988 *path, s32 arrival_s frame_time * 0.785398185f); k70 = frame_time_sq; moby->f44 = updated_rotation_y; - moby->f40 = turn_f(&st->v64, + moby->f40 = turn_f(&st->rotation_x_turn_step, moby->f40, xb, k70 * 1.04719758f, From 0c5b9594a6efd26791242475986aa7ff52fb76fb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:25:49 +0000 Subject: [PATCH 300/758] decomp: clarify names in update_gadgebot_damage_target_and_glow unk84 -> death_fall_horizontal_speed_approach_step: Authoritative source initializes this float from gadgebot_death_fall_horizontal_speed_approach_rate_gp * frame_time_sq during lethal-hit death-fall setup; retail 0x002fc340/354/38c performs that load, multiplication and store to pvars+0x84. With fall=pvars+0x70, checked fall updater 0x0025ea44 obtains horizontal velocity magnitude, 0x0025ea50-68 supplies fall+0x14 as the scalar approach step toward fall+0x4c or zero, and 0x0025ea6c-78 rescales velocity XY to the approached magnitude. This proves a horizontal speed approach step rather than an unspecified acceleration. unk8C -> death_fall_initial_vertical_speed: Source initializes this float from gadgebot_death_fall_base_vertical_speed_gp * frame_time at assigned retail 0x002fc350/360/384, then passes its address as the Z speed argument to trooper_knockback_arc at 0x002fc37c/3b0. Checked trooper_start_knockback receives fall=pvars+0x70 at 0x002fc3c0/3cc and copies fall+0x1c (this member) into velocity Z fall+8 at 0x0025e8f0/0x0025e90c. Checked updater 0x0025ea7c-90 also caps vertical velocity at this value. Thus it supplies the initial death-fall vertical speed after optional hit-vector scaling. --- src/overlays/l18/mobys/gadgebot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l18/mobys/gadgebot.c b/src/overlays/l18/mobys/gadgebot.c index 3cfba0d785..586797cae2 100644 --- a/src/overlays/l18/mobys/gadgebot.c +++ b/src/overlays/l18/mobys/gadgebot.c @@ -266,9 +266,9 @@ typedef struct { char pad68[8]; char fall[0x10]; /* 0x70 */ float unk80; - float unk84; + float death_fall_horizontal_speed_approach_step; float unk88; - float unk8C; + float death_fall_initial_vertical_speed; int unk90; int unk94; float unk98; @@ -359,17 +359,17 @@ void update_gadgebot_damage_target_and_glow(struct Moby *moby) { sentry_vars->unk90 = fall_setup_value_or_path_slot_address; sentry_vars->unk98 = 0.5f; sentry_vars->unk80 = gadgebot_death_fall_gravity_gp * frame_time_sq; - sentry_vars->unk84 = + sentry_vars->death_fall_horizontal_speed_approach_step = gadgebot_death_fall_horizontal_speed_approach_rate_gp * frame_time_sq; sentry_vars->unk88 = gadgebot_death_fall_base_horizontal_speed_gp * frame_time; - sentry_vars->unk8C = gadgebot_death_fall_base_vertical_speed_gp * frame_time; + sentry_vars->death_fall_initial_vertical_speed = gadgebot_death_fall_base_vertical_speed_gp * frame_time; reaction_value_or_path_address = 0x29; sentry_vars->unk94 = reaction_value_or_path_address; sentry_vars->unkAD = 0; sentry_vars->unkBC = frame_time + frame_time; moby->flags &= ~0x1000; v.q = *(u128 *)(coll + 0x10); - trooper_knockback_arc(&v, &angle, &sentry_vars->unk88, &sentry_vars->unk8C); + trooper_knockback_arc(&v, &angle, &sentry_vars->unk88, &sentry_vars->death_fall_initial_vertical_speed); trooper_start_knockback(moby, sentry_vars->fall, 3, 1, 0, angle); sentry_vars->unkC0 = 7.5f; sentry_vars->unkC4 = 15.0f; From c28a0e33688fbdbe57d46198ab52df1b66b9e654 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:25:52 +0000 Subject: [PATCH 301/758] decomp: clarify names in process_hoven_anklebiter_damage_and_alerts unk117 -> damage_blend_target: Authoritative C writes 0x78 for lethal damage and 0xFA for surviving damage before anim_reset_e3528. Retail 0x002e3834/0x002e389c writes pvars+0x117 and passes pvars+0x110 to reset/update. Checked level-12 update 0x002764b4..0x00276508 interpolates from saved byte +4 toward byte +7 during phase zero; 0x00276580..0x002765d0 interpolates back from +7 to +4 during phase one. Thus this byte is the damage blend target; no color-channel meaning is assumed. unk170 -> knockback_ascent_animation_target: Assigned C sets pvars+0x170 to 11.0 after lethal start_fall and to -1.0 for surviving knockback (retail 0x002e3820/0x002e3890). Checked step_moby_motion 0x00275588 receives fall=pvars+0x120. At 0x002758a0..0x00275944 motion+0x50 is enabled unless -1, selected in phase zero, subtracts the current moby animation scalar returned at 0x00275918, and divides by abs(vertical_step/gravity) computed at 0x002758ec..0x002758f8. The resulting rate approaches moby+0x58 at 0x00275a40..0x00275a54. This proves an animation target for the ascent interval; no frame units are asserted. unk174 -> knockback_descent_animation_target: Assigned C sets pvars+0x174 to 18.0 after lethal start_fall and -1.0 for surviving knockback (retail 0x002e3828/0x002e388c). Checked step_moby_motion uses fall=pvars+0x120; 0x00275880..0x00275898 disables target handling when motion+0x54 is -1. In phase one, 0x00275948..0x00275968 compares this target to the current moby animation scalar and clears moby+0x58 on reaching it. 0x0027596c..0x00275a54 estimates remaining ground-impact time from gravity, vertical step and height above ground, divides target-minus-current by that time, clamps the rate and approaches moby+0x58. Thus this is the descent animation target; no frame units are asserted. --- 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 c2e93c41f6..b33aa83628 100644 --- a/src/overlays/l12/mobys/hoven_anklebiter.c +++ b/src/overlays/l12/mobys/hoven_anklebiter.c @@ -844,7 +844,7 @@ typedef struct { s32 reset_alert; /* 0x38 */ u8 pad3C[0xD4]; u8 anim[7]; /* 0x110: animation blend state */ - u8 unk117; /* 0x117 */ + u8 damage_blend_target; /* 0x117 */ u8 pad118[8]; u8 fall[0x10]; /* 0x120 */ f32 unk130; /* 0x130 */ @@ -860,8 +860,8 @@ typedef struct { u8 pad15C; u8 unk15D; /* 0x15D */ u8 pad15E[0x12]; - f32 unk170; /* 0x170 */ - f32 unk174; /* 0x174 */ + f32 knockback_ascent_animation_target; /* 0x170 */ + f32 knockback_descent_animation_target; /* 0x174 */ u8 pad178[0x134]; f32 speed; /* 0x2AC */ u8 pad2B0[0x14]; @@ -959,10 +959,10 @@ void process_hoven_anklebiter_damage_and_alerts(struct Moby *moby) { &anklebiter_vars->unk138, &anklebiter_vars->unk13C); start_fall_e3528(moby, anklebiter_vars->fall, 6, 1, 0, angle); - anklebiter_vars->unk170 = 11.0f; - anklebiter_vars->unk174 = 18.0f; + anklebiter_vars->knockback_ascent_animation_target = 11.0f; + anklebiter_vars->knockback_descent_animation_target = 18.0f; moby->state = ANKLEBITER_DEATH_FALL; - anklebiter_vars->unk117 = 0x78; + anklebiter_vars->damage_blend_target = 0x78; anim_reset_e3528(moby, anklebiter_vars->anim); } else { help_direction_or_hit_position.q = coll->pos.q; @@ -971,9 +971,9 @@ void process_hoven_anklebiter_damage_and_alerts(struct Moby *moby) { &anklebiter_vars->unk138, &anklebiter_vars->unk13C); start_fall_e3528(moby, anklebiter_vars->fall, 0xE, 1, 0, unused); - anklebiter_vars->unk174 = anklebiter_vars->unk170 = -1.0f; + anklebiter_vars->knockback_descent_animation_target = anklebiter_vars->knockback_ascent_animation_target = -1.0f; moby->state = ANKLEBITER_KNOCKBACK_FALL; - anklebiter_vars->unk117 = 0xFA; + anklebiter_vars->damage_blend_target = 0xFA; anklebiter_vars->stun_timer = scale_game_frames(0x3C); anim_reset_e3528(moby, anklebiter_vars->anim); } From c1e11528a8ab3ff90298af8bdd60b115437068aa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:27:56 +0000 Subject: [PATCH 302/758] decomp: clarify names in rocket_tank_update b53 -> current_animation_index: M1454 byte +0x53 is loaded at retail 0x002f7de8, 0x002f7e24 and 0x002f8000. Comparing it with animation 1 or 2 skips the corresponding blend_moby_animation call; otherwise 0x002f8024 receives a1=1 or 2. Bound C performs the same checks before selecting patrol/firing animations, proving the current animation index role. f110 -> firing_yaw: D1454 float +0x110 is loaded at retail 0x002f7f20/0x002f7f48 for cosine/sine, generating firing_vector x=cos(yaw)*cos(pitch)*scale and y=sin(yaw)*cos(pitch)*scale. Checked helper 0x002f850c..0x002f8534 approaches this field toward target XY atan plus oscillation, and 0x002f85f0..0x002f8608 subtracts body yaw for a Z-axis quaternion. These operations establish the firing yaw angle. f118 -> firing_pitch: D1454 float +0x118 supplies cosine at retail 0x002f7f2c/0x002f7f4c and sine at 0x002f7f6c; firing_vector z is -sin(this field)*scale at 0x002f7f70..0x002f7f88. Checked helper 0x002f8490..0x002f84f0 derives and clamps negative atan(horizontal length,z), then approaches +0x118 at 0x002f8540..0x002f8560 and builds its axis-1 rotation at 0x002f85dc..0x002f85e8. This is the firing pitch angle. f130 -> aim_vector_length_limit: Retail 0x002f7e14..0x002f7e20 initializes D1454 +0x130 to 10.0, and 0x002f7e58..0x002f7e70 approaches it toward 30.0 by frame_time*6 during firing. Checked helper forms target-minus-moby aim vector at 0x002f8418..0x002f8440, compares vector length with +0x130 at 0x002f8444..0x002f8450, and passes the field to the in-place set_vector_length_xy call at 0x002f8458 when exceeded. Bound C confirms this aim-vector length limit role. f134 -> aim_yaw_oscillation_phase: Retail 0x002f7e1c clears D1454 +0x134 on entering firing; 0x002f7e78..0x002f7ea4 advances it using fast_add_rotations with frame_time*2pi and stores the wrapped angle. Checked helper 0x002f8460..0x002f8478 takes its sine and multiplies by 0.08726646, then 0x002f847c..0x002f848c adds that term to target XY atan. Bound C agrees: the field is the phase of the sinusoidal aim-yaw oscillation. --- src/overlays/l18/mobys/rocket_tank.c | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/overlays/l18/mobys/rocket_tank.c b/src/overlays/l18/mobys/rocket_tank.c index 7fcb94f99c..805097fa22 100644 --- a/src/overlays/l18/mobys/rocket_tank.c +++ b/src/overlays/l18/mobys/rocket_tank.c @@ -50,15 +50,15 @@ extern char *create_moby(int) __asm__("FUN_0020c4f8"); typedef struct { char pad0[0xC0]; char buf[0x50]; - float f110; + float firing_yaw; float pad114; - float f118; + float firing_pitch; char pad11C[4]; int w120; int w124; char pad128[8]; - float f130; - float f134; + float aim_vector_length_limit; + float aim_yaw_oscillation_phase; char *c138; char *c13c; } D1454; @@ -67,7 +67,7 @@ typedef struct { char pad0[0x20]; unsigned char state; char pad21[0x32]; - unsigned char b53; + unsigned char current_animation_index; char pad54[0x24]; D1454 *data; } M1454; @@ -143,7 +143,7 @@ void rocket_tank_update(M1454 *moby) { blend_moby_animation(tank_data->c13c, 0, 0, 0); update_entity(tank_data->c13c); } - if (moby->b53 != 1) { + if (moby->current_animation_index != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } moby->state = ROCKET_TANK_PATROLLING; @@ -151,9 +151,9 @@ void rocket_tank_update(M1454 *moby) { case ROCKET_TANK_PATROLLING: func_L18_002F9AB8_v(moby); if (*(int *)((char *)tank_data + 0xB4) != 2) { - tank_data->f134 = 0; - tank_data->f130 = 10.0f; - if (moby->b53 != 2) { + tank_data->aim_yaw_oscillation_phase = 0; + tank_data->aim_vector_length_limit = 10.0f; + if (moby->current_animation_index != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(20)); } moby->state = ROCKET_TANK_FIRING; @@ -161,8 +161,8 @@ void rocket_tank_update(M1454 *moby) { break; case ROCKET_TANK_FIRING: func_L18_002F9AB8_v(moby); - approach_value(&tank_data->f130, 30.0f, frame_time * 6.0f); - tank_data->f134 = fast_add_rotations(tank_data->f134, frame_time * 6.2831855f); + approach_value(&tank_data->aim_vector_length_limit, 30.0f, frame_time * 6.0f); + tank_data->aim_yaw_oscillation_phase = fast_add_rotations(tank_data->aim_yaw_oscillation_phase, frame_time * 6.2831855f); if (is_value_within_interpolated_window((char *)moby, 4.0f) || is_value_within_interpolated_window((char *)moby, 10.0f)) { float firing_vector[4]; @@ -177,11 +177,11 @@ void rocket_tank_update(M1454 *moby) { } firing_vector_scale *= frame_time; firing_vector[0] = - fast_cos(tank_data->f110) * (fast_cos(tank_data->f118) * firing_vector_scale); + fast_cos(tank_data->firing_yaw) * (fast_cos(tank_data->firing_pitch) * firing_vector_scale); firing_vector[1] = - fast_sin(tank_data->f110) * (fast_cos(tank_data->f118) * firing_vector_scale); + fast_sin(tank_data->firing_yaw) * (fast_cos(tank_data->firing_pitch) * firing_vector_scale); firing_vector[2] = 0; - firing_vector[2] = -fast_sin(tank_data->f118) * firing_vector_scale; + firing_vector[2] = -fast_sin(tank_data->firing_pitch) * firing_vector_scale; allocate_voice_for_target_entry(0, 0, (int)moby); emit_radial_particle_burst(moby, projectile_spawn_position, 0); if (vector_distance_xy((char *)moby + 0x10, &hero.motion.pos) > 10.0f) { @@ -191,7 +191,7 @@ void rocket_tank_update(M1454 *moby) { } } if (*(int *)((char *)tank_data + 0xB4) == 2) { - if (moby->b53 != 1) { + if (moby->current_animation_index != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(20)); } moby->state = ROCKET_TANK_PATROLLING; From aacff6d4cc3369b2370166b5d6313aa0a8cd03c2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:30:20 +0000 Subject: [PATCH 303/758] decomp: clarify names in handle_sand_shark_damage_and_targeting b117 -> hit_flash_target_red: Assigned retail 0x002d6020 stores 0x78 at pvars+0x117 before animation update. Checked finish helper 0x0025fbf0-0x0025fc40 reads animation+7, interpolates from saved red at +4 toward it, then passes that result as the first color component at 0x0025fd98-0x0025fda4. The supplied update helper context identifies saved +4/+5/+6 as RGB. b2E -> relaunch_request_state: Retail 0x002d5cc4-0x002d5cdc tests pvars+0x2e against 2 and consumes it by writing 1. The ensuing flow decrements the spawning moby's count, selects a group class-29c moby, and either removes this shark or sets inactive-wait-for-relaunch state 0x1a at home minus 10 (0x002d5d00-0x002d5d4c). f130 -> knockback_gravity_per_update: Retail 0x002d5e9c-0x002d5eb4 scales the established sand_shark_death_knockback_gravity_gp by frame_time_sq and stores it at pvars+0x130 at 0x002d5ee0. This is knockback-block+0x10; the supplied checked retail annotation records the motion update subtracting block+0x10 from vertical velocity at 0x0025ecfc-0x0025ed10. f134 -> knockback_horizontal_speed_approach_step: Retail 0x002d5ea4-0x002d5eb4 scales the established death-knockback horizontal-speed approach-rate global by frame_time_sq and stores it at pvars+0x134 at 0x002d5ee4. Supplied retail annotation identifies knockback-block+0x14 as the scalar approach step for motion magnitude at 0x0025ed2c-0x0025ed60. f138 -> knockback_horizontal_speed: Retail 0x002d5ebc and 0x002d5ee8 scale/store the established horizontal-speed global into pvars+0x138; its address goes to trooper_knockback_arc at 0x002d5f90. Checked start helper 0x0025ebbc-0x0025ec00 reads this block+0x18 and multiplies it by heading trigonometric components to initialize X/Y velocity. f13C -> knockback_initial_vertical_speed: Retail 0x002d5ec0 and 0x002d5eec scale/store the established vertical-speed global into pvars+0x13c; its address goes to the arc helper at 0x002d5f98. Checked start helper 0x0025ebd8-0x0025ebf4 copies this block+0x1c into the active velocity's Z component at block+8. f24C -> base_target_selection_range: Retail 0x002d5dd4-0x002d5df0 reads pvars+0x24c and writes either that float or that float plus 5 into +0x250 according to the timer. The supplied sand_shark_update also compares target-to-home distance against the same +0x24c field when deciding whether to approach the target; it supplies the unextended range. f250 -> effective_target_selection_range: Retail 0x002d5dd8-0x002d5df0 derives pvars+0x250 from +0x24c with a timer-dependent 5-unit extension. It is passed as f12 to target helper 0x00261f00 at 0x002d6050-0x002d6070; checked helper 0x002620e0-0x002620f8 rejects candidates whose XY distance is at least that range. Assigned 0x002d6080-0x002d6098 also applies it to target-home distance. i144 -> knockback_flags: Retail 0x002d5ef0 sets pvars+0x144 to 9 and 0x002d5f84-0x002d5f9c ORs in 0x20 before starting knockback with block at +0x120. Checked start helper reads that block+0x24 at 0x0025ec30-0x0025ec64, ORs 0x20 when disabling collision, and tests bit 2 to select its animation setup path. i14C -> spawner_active_shark_count: Retail 0x002d5ce8-0x002d5cfc and 0x002d5f48-0x002d5f5c load the pvars of the indexed spawning moby and decrement its +0x14c integer on relaunch request or lethal damage. Supplied sand_shark_update increments this same spawner field on initialization, and suck-cannon storage decrements it when the shark leaves active use. i210 -> selected_target_moby: Assigned 0x002d60d0-0x002d60e8 defaults pvars+0x210 to hero.moby when zero, paired with copying the hero position into tgt. Checked target-selection helper 0x00262290-0x002622a0 stores the selected candidate moby at tgt+0x40 (pvars+0x210) and its position at tgt; 0x00262328 clears it if no candidate exists. i214 -> target_selection_status: Checked target helper 0x00262350 stores its returned selection status at tgt+0x44, pvars+0x214. It sets status 1 when selecting an alternative candidate (0x0026215c-0x00262168), and 2 on exclusion paths (0x00261f7c-0x00261f90, 0x00262048-0x00262050). Assigned 0x002d6098/0x002d60c8 also sets 2 when range/height checks fail; supplied update uses it to gate target pursuit. i27C -> selected_relaunch_moby: Retail 0x002d5d00-0x002d5d0c stores the return of select_group_class_29c_moby at pvars+0x27c; zero leads to removal and nonzero to inactive relaunch state. Supplied selector returns the address of a group moby whose class is 0x29c; supplied death, fade, and inactive cases use this same field to retain a relaunch candidate. i280 -> entry_moby_state: Retail 0x002d5cb0-0x002d5cb4 loads the moby's state byte at moby+0x20 and stores it as an integer at pvars+0x280 before the zero-state early return or any relaunch/death state changes. This field therefore captures the state on entry to this damage-and-targeting helper. i288 -> spawning_moby_index: Retail 0x002d5cd4-0x002d5cf0 checks pvars+0x288 for a negative sentinel, otherwise shifts it left 8 and adds the moby-array base to obtain a moby whose pvars count is decremented. Supplied initialization increments the same linked moby's count and suck-cannon storage explicitly uses this offset as its spawner moby index. i290 -> configured_path_index: Retail 0x002d603c-0x002d605c loads pvars+0x290, scales it by four and indexes D_L02_001B0AB0. The resulting path's vertex count and vertices at +0x10 are passed to target selection. Supplied sand_shark_update validates this same field against -1 and an empty path, and begin_sand_shark_return_home_if_outside_path uses it for point-in-path testing. i29C -> death_landing_particles_emitted: Assigned retail 0x002d5e54-0x002d5e5c resets pvars+0x29c when processing a hit. Supplied sand_shark_update's DEATH_KNOCKBACK case tests the same +0x29c field with landed motion bit 1, sets it to 1, and emits 0x1b radial particles only while it was zero, proving a one-shot death-landing particle latch. i38 -> target_range_timer_refresh_request: Retail 0x002d5d50-0x002d5d54 reads pvars+0x38; nonzero jumps directly to the randomized scaled 180-240 duration stored into +0x25e at 0x002d5d98-0x002d5dc0, bypassing proximity/timer checks. It is then cleared at 0x002d5dc4. That timer controls the effective target-selection range at 0x002d5dc8-0x002d5df0. --- src/overlays/l02/mobys/sand_shark.c | 90 ++++++++++++++--------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 409d5889af..c693fa65e7 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -1188,23 +1188,23 @@ typedef struct { char pad0[0x20]; float hp; /* 0x20 */ char pad24[0xA]; - unsigned char b2E; /* 0x2E: 2 = respawn requested */ + unsigned char relaunch_request_state; /* 0x2E: 2 = respawn requested */ char pad2F[9]; - int i38; /* 0x38 */ + int target_range_timer_refresh_request; /* 0x38 */ char pad3C[0xD4]; short anim[3]; /* 0x110: passed to trooper_anim_update / trooper_anim_finish */ char pad116; - unsigned char b117; /* 0x117 */ + unsigned char hit_flash_target_red; /* 0x117 */ char pad118[8]; char knock[0x10]; /* 0x120: passed to trooper_start_knockback */ - float f130; /* 0x130 */ - float f134; - float f138; - float f13C; + float knockback_gravity_per_update; /* 0x130 */ + float knockback_horizontal_speed_approach_step; + float knockback_horizontal_speed; + float knockback_initial_vertical_speed; int i140; /* 0x140 */ - int i144; + int knockback_flags; float f148; - int i14C; /* 0x14C: count kept by the spawner moby */ + int spawner_active_shark_count; /* 0x14C: count kept by the spawner moby */ char pad150[0xD]; unsigned char b15D; /* 0x15D */ char pad15E[0xE]; @@ -1214,25 +1214,25 @@ typedef struct { char pad178[0x58]; float tgt[4]; /* 0x1D0: point followed along the path */ char pad1E0[0x30]; - int i210; /* 0x210 */ - int i214; + int selected_target_moby; /* 0x210 */ + int target_selection_status; char pad218[8]; float home[4]; /* 0x220 */ char pad230[0x1C]; - float f24C; /* 0x24C */ - float f250; + float base_target_selection_range; /* 0x24C */ + float effective_target_selection_range; char pad254[8]; short t25C; /* 0x25C */ short t25E; char pad260[0x1C]; - int i27C; /* 0x27C */ - int i280; + int selected_relaunch_moby; /* 0x27C */ + int entry_moby_state; char pad284[4]; - int i288; /* 0x288: spawner moby index, -1 if none */ + int spawning_moby_index; /* 0x288: spawner moby index, -1 if none */ char pad28C[4]; - int i290; /* 0x290: path index */ + int configured_path_index; /* 0x290: path index */ char pad294[8]; - int i29C; /* 0x29C */ + int death_landing_particles_emitted; /* 0x29C */ } Vars5c88; #include "rnc/overlay/l02/mobys/sand_shark_data/handle_sand_shark_damage_and_targeting.h" @@ -1264,16 +1264,16 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { OvlVec4 ground_probe_position; OvlVec4 hit_knockback_vector; - moby_vars->i280 = moby[0x20]; + moby_vars->entry_moby_state = moby[0x20]; if (moby[0x20] == 0) { return; } - if (moby_vars->b2E == 2) { - moby_vars->b2E = 1; - if (moby_vars->i288 >= 0) { - (*(Vars5c88 **)((moby_vars->i288 << 8) + D_L02_0015FFD8 + 0x78))->i14C -= 1; + if (moby_vars->relaunch_request_state == 2) { + moby_vars->relaunch_request_state = 1; + if (moby_vars->spawning_moby_index >= 0) { + (*(Vars5c88 **)((moby_vars->spawning_moby_index << 8) + D_L02_0015FFD8 + 0x78))->spawner_active_shark_count -= 1; } - if ((moby_vars->i27C = select_group_class_29c_moby(moby)) == 0) { + if ((moby_vars->selected_relaunch_moby = select_group_class_29c_moby(moby)) == 0) { mark_moby_for_removal(moby); return; } @@ -1282,33 +1282,33 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { MOBY(moby)->collision = 0; MOBY(moby)->pos.z -= 10.0f; } - if (moby_vars->i38 != 0 || (!fast_dec_timer_s16(&moby_vars->t25C) && + if (moby_vars->target_range_timer_refresh_request != 0 || (!fast_dec_timer_s16(&moby_vars->t25C) && vector_distance_xy(moby + 0x10, &hero.motion.pos) < 10.0f)) { moby_vars->t25E = truncate_float_to_s32(scale_time(random_float_between(180.0f, 240.0f))); } - moby_vars->i38 = 0; + moby_vars->target_range_timer_refresh_request = 0; if (fast_dec_timer_s16(&moby_vars->t25E)) { - moby_vars->f250 = moby_vars->f24C; + moby_vars->effective_target_selection_range = moby_vars->base_target_selection_range; } else { - moby_vars->f250 = moby_vars->f24C + 5.0f; + moby_vars->effective_target_selection_range = moby_vars->base_target_selection_range + 5.0f; } dmg = 0.0f; hit_record = find_moby_hit(moby, 0x330000, 0); resolve_moby_hit_response(moby, hit_record, &moby_vars->hp, 0, &hit, &dmg, 0, 4); if (hit != 1 && moby[0x20] != 0x18) { extend_group_sand_shark_timers((char *)moby); - moby_vars->i29C = 0; + moby_vars->death_landing_particles_emitted = 0; moby_vars->hp -= dmg; if (moby_vars->hp <= 0.0f) { moby_vars->hp -= dmg; moby_vars->i140 = 0x200; - moby_vars->f130 = sand_shark_death_knockback_gravity_gp * frame_time_sq; - moby_vars->f134 = + moby_vars->knockback_gravity_per_update = sand_shark_death_knockback_gravity_gp * frame_time_sq; + moby_vars->knockback_horizontal_speed_approach_step = sand_shark_death_knockback_horizontal_speed_approach_rate_gp * frame_time_sq; - moby_vars->f138 = sand_shark_death_knockback_horizontal_speed_gp * D_0015ED6C; - moby_vars->f13C = sand_shark_death_knockback_vertical_speed_gp * D_0015ED6C; + moby_vars->knockback_horizontal_speed = sand_shark_death_knockback_horizontal_speed_gp * D_0015ED6C; + moby_vars->knockback_initial_vertical_speed = sand_shark_death_knockback_vertical_speed_gp * D_0015ED6C; moby_vars->b15D = 0; - moby_vars->i144 = 9; + moby_vars->knockback_flags = 9; moby_vars->f16C = 2.0f * D_0015ED6C; moby_vars->f148 = 0.5f; qcopy(&ground_probe_position, moby + 0x10); @@ -1317,37 +1317,37 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { if (MOBY(moby)->pos.z < ground_height) { MOBY(moby)->pos.z = ground_height; } - if (moby_vars->i288 >= 0) { + if (moby_vars->spawning_moby_index >= 0) { extern int D_L02_0015FFD8_s __asm__("D_L02_0015FFD8") __attribute__((sda)); - (*(Vars5c88 **)((moby_vars->i288 << 8) + D_L02_0015FFD8_s + 0x78))->i14C -= 1; + (*(Vars5c88 **)((moby_vars->spawning_moby_index << 8) + D_L02_0015FFD8_s + 0x78))->spawner_active_shark_count -= 1; moby_vars->b15D = 0; } else { ground_probe_position.f[2] += 0.01f; } - moby_vars->i144 |= 0x20; + moby_vars->knockback_flags |= 0x20; MOBY(moby)->flags &= 0xEFFF; hit_knockback_vector.q = *(OvlQuad *)(hit_record + 0x10); - trooper_knockback_arc(&hit_knockback_vector, &k, &moby_vars->f138, &moby_vars->f13C); + trooper_knockback_arc(&hit_knockback_vector, &k, &moby_vars->knockback_horizontal_speed, &moby_vars->knockback_initial_vertical_speed); trooper_start_knockback(k, moby, moby_vars->knock, 6, 1, 0); moby_vars->f148 = 0.85f; moby_vars->f170 = 7.0f; moby_vars->f174 = 14.0f; moby[0x20] = 0x18; MOBY(moby)->collision = 0; - moby_vars->b117 = 0x78; + moby_vars->hit_flash_target_red = 0x78; trooper_anim_update(moby, moby_vars->anim); } } moby[0xA4] = 0xFF; trooper_anim_finish(moby, moby_vars->anim); - path = D_L02_001B0AB0_5c88[moby_vars->i290]; - if (FUN_L00_0025ff38(moby_vars->f250, moby, moby_vars->tgt, 0, 0, path + 4, *path) != 2 && - (moby_vars->f250 < vector_distance_xy(moby_vars->home, moby_vars->tgt) || + path = D_L02_001B0AB0_5c88[moby_vars->configured_path_index]; + if (FUN_L00_0025ff38(moby_vars->effective_target_selection_range, moby, moby_vars->tgt, 0, 0, path + 4, *path) != 2 && + (moby_vars->effective_target_selection_range < vector_distance_xy(moby_vars->home, moby_vars->tgt) || absolute_float(MOBY(moby)->pos.z - moby_vars->tgt[2]) > 3.0f)) { - moby_vars->i214 = 2; + moby_vars->target_selection_status = 2; } - if (moby_vars->i210 == 0) { - moby_vars->i210 = (int)hero.moby; + if (moby_vars->selected_target_moby == 0) { + moby_vars->selected_target_moby = (int)hero.moby; qcopy(moby_vars->tgt, &hero.motion.pos); } } From ad032d164f609a77250de1a24f15a229613b4d7f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:30:24 +0000 Subject: [PATCH 304/758] decomp: clarify names in draw_wrench_swing_effect f48 -> progress_per_frame: E_2a7780.f48 is loaded at retail 0x002a7990 from config+0x48. Instructions 0x002a7994-0x002a79b4 subtract last_frame from game_frame, clamp elapsed frames to at least one, multiply that count by this float, and add it to effect progress at r+0x70. Original Ghidra uses *(float *)(iVar5+0x1d9330) in exactly that increment, matching source elapsed_frames * effect_config->f48. f5C -> uv_v_progress_scale: E_2a7780.f5C is loaded at retail 0x002a7bb4 from config+0x5C, multiplied by r+0x70 progress at 0x002a7bc8 and subtracted from 1 at 0x002a7bd4. The result is added only to the V texture coordinate at 0x002a7bf8-0x002a7bfc. Original Ghidra fVar20 and source uv_v_offset = 1.0f - r->f70 * effect_config->f5C prove this is the progress-to-V-offset scale. m30 -> hero_position: R_2a7780.m30 receives the 16-byte hero moby position at retail 0x002a7a28-0x002a7a60: load hero moby from hero+0x2080, add 0x10, lq, then sq into r+0x30. Source qcopy(&r->m30, P_2a7780_G.p2080 + 0x10) agrees with the supplied WrenchMoby.position at +0x10. Original Ghidra copies that position into puVar2[0xc..0xf]; r is then passed with the quad to the draw helper at 0x002a7c10-0x002a7c1c. --- src/overlays/shared/weapons/wrench.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/weapons/wrench.c b/src/overlays/shared/weapons/wrench.c index c7b6adabf2..835164c0a9 100644 --- a/src/overlays/shared/weapons/wrench.c +++ b/src/overlays/shared/weapons/wrench.c @@ -33,17 +33,17 @@ typedef int q_2a7780 __attribute__((mode(TI))); typedef struct { s16 sel[4]; u32 col[4][4]; - f32 f48; + f32 progress_per_frame; q_2a7780 *verts; s16 (*idx)[4][2]; f32 *uv; s16 n; - f32 f5C; + f32 uv_v_progress_scale; } E_2a7780; typedef struct { q_2a7780 m[3]; - q_2a7780 m30; + q_2a7780 hero_position; u8 pad[0x30]; f32 f70; u8 pad2[4]; @@ -352,7 +352,7 @@ void draw_wrench_swing_effect(O_2a7780 *effect_owner) { elapsed_frames = current_frame - last_frame; if (elapsed_frames <= 0) elapsed_frames = 1; - r->f70 = effect_progress + (f32)elapsed_frames * effect_config->f48; + r->f70 = effect_progress + (f32)elapsed_frames * effect_config->progress_per_frame; last_frame = current_frame; if ((f32)(effect_config->n * 2) <= r->f70) { s32 k2 = P_2a7780_G.p2080[0x52]; @@ -366,7 +366,7 @@ void draw_wrench_swing_effect(O_2a7780 *effect_owner) { quad.tag[2] = 0xFF9000000260LL; quad.tag[0] = 5; quad.tag[3] = (nv << 2) | 0x8000000040LL; - qcopy(&r->m30, P_2a7780_G.p2080 + 0x10); + qcopy(&r->hero_position, P_2a7780_G.p2080 + 0x10); for (i = 0; i < effect_config->n; i++) { for (j = 0; j < 4; j++) { s32 vi = effect_config->idx[i][j][0]; @@ -384,7 +384,7 @@ void draw_wrench_swing_effect(O_2a7780 *effect_owner) { quad.col[j] = (truncate_float_to_s32(((s32)quad.col[j] >> 24) * alpha) << 24) | color; fast_vec_scale(&quad.pos[j], &effect_config->verts[vi], scale); uv = (f32 *)(effect_config->idx[i][j][1] * 8 + (s32)effect_config->uv); - uv_v_offset = 1.0f - r->f70 * effect_config->f5C; + uv_v_offset = 1.0f - r->f70 * effect_config->uv_v_progress_scale; quad.uv[j][0] = (uv[0] - 0.5f) * uv_scale + 0.5f; quad.uv[j][1] = (uv[1] - 0.5f) * uv_scale + 0.5f + uv_v_offset; } From 01b569753ccd3851fb0a6e062278b305a9907935 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:32:40 +0000 Subject: [PATCH 305/758] decomp: clarify names in thruster_pack_flame_update f3C -> beam_quad_scale_step: Retail 002b4450 stores 0.025/scale_game_frames(2) at private +0x3c; 002b45e8 stores 0.025/scale_game_frames(8). At 002b4484-002b44a0 this float is added to private +0x2c, and 002b4650-002b466c subtracts it during shrink. Supplied draw_joint_aligned_beam_effect uses private +0x2c (Data_2b3628.f2C) to scale both beam quad vertex arrays, proving this is the per-frame beam quad scale step. i0 -> beam_transition_timer: Retail 002b4394-002b43a4 stores scale_game_frames(2) at private +0, and 002b4538-002b4548 stores scale_game_frames(8) there. Source passes v to fast_dec_timer; retail 002b44b0-002b44b8 and 002b4608-002b461c test completion to end growth or shrink. Thus this s32 counts the remaining beam transition frames. i8 -> thruster_pack_moby: Source assigns hero.items[3].moby to v->i8 in grow, active and shrink. Retail 002b44a4-002b44ac, 002b4514-002b4524 and 002b4670-002b4678 copy hero+0x1180 into private +8 immediately when queuing callback 002b3628. Supplied draw_joint_aligned_beam_effect reads the same private +8 as its child and obtains its joint positions; item slot 3 is the established thruster pack. u30 -> update_distance: Retail initialization 002b4340 and 002b4354 writes 0xff to the input moby's byte +0x30, represented by O_4198.u30. In the supplied source, spawn_thruster_pack_flame initializes the same class 0xA7 object and explicitly writes MOBY(spawned_moby)->update_dist = 0xFF, adjacent to draw_dist and visible initialization. This identifies the byte as the moby's update distance. --- .../shared/weapons/thruster_pack_flame.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/shared/weapons/thruster_pack_flame.c b/src/overlays/shared/weapons/thruster_pack_flame.c index ba8a283634..d76131e001 100644 --- a/src/overlays/shared/weapons/thruster_pack_flame.c +++ b/src/overlays/shared/weapons/thruster_pack_flame.c @@ -343,9 +343,9 @@ typedef struct X { 0x30..0x3C are f32 rates (the case-1/3 bodies divide five constants by scale_game_frames(2) / scale_game_frames(8) and store the results there). */ typedef struct { - s32 i0; + s32 beam_transition_timer; char pad4[4]; - s32 i8; + s32 thruster_pack_moby; s32 iC; char pad10[0x10]; f32 f20; @@ -355,7 +355,7 @@ typedef struct { f32 f30; f32 f34; f32 f38; - f32 f3C; + f32 beam_quad_scale_step; } V_4198; typedef struct { @@ -364,7 +364,7 @@ typedef struct { char pad1C[4]; u8 state; char pad21[0xF]; - u8 u30; + u8 update_distance; char pad31[3]; u16 u34; char pad36[0x42]; @@ -910,7 +910,7 @@ void thruster_pack_flame_update(void *moby) { case STATE_INITIALIZE: beam_moby->f18 += 0.5f; beam_moby->state = STATE_WAIT_FOR_BEAM; - beam_moby->u30 = 0xFF; + beam_moby->update_distance = 0xFF; beam_moby->u34 |= 1; break; case STATE_WAIT_FOR_BEAM: @@ -918,11 +918,11 @@ void thruster_pack_flame_update(void *moby) { mark_moby_for_removal(beam_moby); } else if (flag != 0) { beam_moby->state = STATE_BEAM_GROW; - v->i0 = scale_game_frames(2); + v->beam_transition_timer = scale_game_frames(2); v->f30 = 0.0125f / scale_game_frames(2); v->f34 = 0.2f / scale_game_frames(2); v->f38 = 0.05f / scale_game_frames(2); - v->f3C = 0.025f / scale_game_frames(2); + v->beam_quad_scale_step = 0.025f / scale_game_frames(2); v->f20 = 0.0f; v->f24 = 0.0f; v->f28 = 0.0f; @@ -933,8 +933,8 @@ void thruster_pack_flame_update(void *moby) { v->f20 += v->f30; v->f24 += v->f34; v->f28 += v->f38; - v->f2C += v->f3C; - v->i8 = ((s32)hero.items[3].moby); + v->f2C += v->beam_quad_scale_step; + v->thruster_pack_moby = ((s32)hero.items[3].moby); add_draw_callback(FUN_L00_002b3628_4198, beam_moby); if (fast_dec_timer(v) != 0) { beam_moby->state = STATE_BEAM_ACTIVE; @@ -946,15 +946,15 @@ void thruster_pack_flame_update(void *moby) { } break; case STATE_BEAM_ACTIVE: - v->i8 = ((s32)hero.items[3].moby); + v->thruster_pack_moby = ((s32)hero.items[3].moby); add_draw_callback(FUN_L00_002b3628_4198, beam_moby); if (flag == 0) { beam_moby->state = STATE_BEAM_SHRINK; - v->i0 = scale_game_frames(8); + v->beam_transition_timer = scale_game_frames(8); v->f30 = 0.0125f / scale_game_frames(8); v->f34 = 0.2f / scale_game_frames(8); v->f38 = 0.05f / scale_game_frames(8); - v->f3C = 0.025f / scale_game_frames(8); + v->beam_quad_scale_step = 0.025f / scale_game_frames(8); } else { v->f20 = 0.0125f; FUN_L00_002b3c50_4198(beam_moby); @@ -967,8 +967,8 @@ void thruster_pack_flame_update(void *moby) { v->f20 -= v->f30; v->f24 -= v->f34; v->f28 -= v->f38; - v->f2C -= v->f3C; - v->i8 = ((s32)hero.items[3].moby); + v->f2C -= v->beam_quad_scale_step; + v->thruster_pack_moby = ((s32)hero.items[3].moby); add_draw_callback(FUN_L00_002b3628_4198, beam_moby); } break; From 1cc758b962b9bc4c908097e866792c70c0651289 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:32:43 +0000 Subject: [PATCH 306/758] decomp: clarify names in platform_update f90 -> rotation_amplitude_phase_angle: Retail 0x002f8ac4 passes s4+0x90 as a1 to rotation oscillation helper 0x00281e18 at 0x002f8ae8; the assigned C passes &platform_vars->f90 as first_phase_angle. Supplied update_moby_rotation_oscillation computes amplitude*sin(*first_phase_angle) as the common factor for both rotation components, then advances this phase by the first increment (frame_time*0.3141592741). Thus this float is the phase modulating rotation amplitude. f94 -> rotation_orientation_phase_angle: Retail 0x002f8ad4 passes s4+0x94 as a2 to rotation oscillation helper 0x00281e18 at 0x002f8ae8; assigned C passes &platform_vars->f94 as second_phase_angle. Supplied helper uses sin(*second_phase_angle) for rotation component 0x10 and cos(*second_phase_angle) for component 0x11, with a common amplitude*sin(first phase) factor, then advances this phase by frame_time*0.4886921942. It controls the orientation of the two-component oscillation. f98 -> vertical_oscillation_phase_angle: Retail 0x002f8a90 forms a1=s4+0x98 for helper 0x00281d98 called at 0x002f8aa4. Assigned C passes &platform_vars->f98 as phase_angle to update_moby_vertical_oscillation with amplitude 0.14 and increment frame_time*0.5235987902. Supplied helper advances *phase_angle using fast_add_rotations and computes fast_sin(*phase_angle)*amplitude to update moby->pos.z, proving this persistent float stores the vertical oscillation phase. f9C -> previous_vertical_oscillation_offset: Retail 0x002f8aa0 forms a2=s4+0x9c for helper 0x00281d98 called at 0x002f8aa4. Assigned C passes &platform_vars->f9C as previous_sine_offset to update_moby_vertical_oscillation. Supplied helper subtracts *previous_sine_offset from moby->pos.z, replaces it with fast_sin(updated phase)*amplitude, then adds the new offset to pos.z. This float retains the prior vertical oscillation displacement for removal on the next update. --- src/overlays/l09/mobys/platform.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l09/mobys/platform.c b/src/overlays/l09/mobys/platform.c index fd8734f850..495a094368 100644 --- a/src/overlays/l09/mobys/platform.c +++ b/src/overlays/l09/mobys/platform.c @@ -36,10 +36,10 @@ typedef struct { float baseZ; /* 0x84 */ int timer; /* 0x88 */ int pad8C; - float f90; /* 0x90 */ - float f94; /* 0x94 */ - float f98; /* 0x98 */ - float f9C; /* 0x9C */ + float rotation_amplitude_phase_angle; /* 0x90 */ + float rotation_orientation_phase_angle; /* 0x94 */ + float vertical_oscillation_phase_angle; /* 0x98 */ + float previous_vertical_oscillation_offset; /* 0x9C */ } PlatVars; extern float D_0015ED70; @@ -154,10 +154,10 @@ void platform_update(Moby *moby) { } } update_moby_vertical_oscillation( - 0.14f, frame_time * 0.5235987901687622f, moby, &platform_vars->f98, &platform_vars->f9C); + 0.14f, frame_time * 0.5235987901687622f, moby, &platform_vars->vertical_oscillation_phase_angle, &platform_vars->previous_vertical_oscillation_offset); update_moby_rotation_oscillation(moby, - &platform_vars->f90, - &platform_vars->f94, + &platform_vars->rotation_amplitude_phase_angle, + &platform_vars->rotation_orientation_phase_angle, 0.0872664600610733f, frame_time * 0.3141592741012573f, frame_time * 0.48869219422340393f); From 2174ab3afaeefea6f231089872b5d03c98f09c6c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:32:46 +0000 Subject: [PATCH 307/758] decomp: clarify names in linked_switch_group_update unk76 -> opened_color_flash_timer: SwitchVars short unk76 is cleared on initialization at 0x002e4548. In UPDATE_OPENED_STATE, 0x002e48b4-0x002e48d4 passes its address to fast_dec_timer_s16 and reloads it with scale_game_frames(0x14) on expiry; 0x002e48d8-0x002e490c then alternates the current moby's green/blue color. This proves the opened-state color-flash countdown role. unk79 -> is_group_follower: Retail 0x002e44c0-0x002e4518 tests this SwitchVars byte before group enumeration and, for each non-self class-0xE7 peer, sets that peer's byte to 1 together with its +0x80 link to the current moby. The peer thus follows the enumerating group owner. At 0x002e47a8-0x002e47b8 the same flag excludes followers from opened-state group countdown/closure processing; zero selects the enumerating owner path. unk7A -> reported_hit_count: Retail 0x002e4590-0x002e45dc follows +0x80 to the linked owner's SwitchVars and increments its +0x7A byte for a qualifying process_linked_switch_damage result. The current member is then latched at +0x74, preventing repeat reporting. At 0x002e460c-0x002e4618 this byte is compared with the enumeration total to decide group completion. Initialization, failure, reset and closure clear it, proving the reported-hit counter role. unk7B -> enumerated_group_entry_count: Retail 0x002e44cc clears this SwitchVars byte before get_first_moby_in_group. The loop at 0x002e44f8-0x002e4540 increments it once for every non-null enumeration result before get_next_moby_in_group, including self and entries that fail the class-0xE7 test. At 0x002e460c-0x002e4618 it supplies the total compared against reported hits for completion. The name deliberately counts enumerated group entries rather than only switch peers. unk84 -> opened_state_duration: On group completion, retail 0x002e463c-0x002e4668 copies this SwitchVars short into the +0x70 countdown, prints the opened diagnostic, and enters UPDATE_OPENED_STATE. Retail 0x002e47a8-0x002e4810 skips countdown for -1; otherwise fast_dec_timer_s16 on +0x70 eventually broadcasts RESET_HIT_STATE and prints the closed diagnostic. Thus +0x84 supplies the opened-state duration, including the indefinite sentinel; it is not itself the live countdown. --- src/overlays/l13/mobys/linked_switch_group.c | 42 ++++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/overlays/l13/mobys/linked_switch_group.c b/src/overlays/l13/mobys/linked_switch_group.c index 599bfa5a92..fe68f3afba 100644 --- a/src/overlays/l13/mobys/linked_switch_group.c +++ b/src/overlays/l13/mobys/linked_switch_group.c @@ -109,14 +109,14 @@ typedef struct { short unk70; short unk72; short unk74; - short unk76; + short opened_color_flash_timer; u8 unk78; - u8 unk79; - u8 unk7A; - u8 unk7B; + u8 is_group_follower; + u8 reported_hit_count; + u8 enumerated_group_entry_count; int unk7C; char *unk80; - short unk84; + short opened_state_duration; } SwitchVars; #define MIN(a, b) ((a) < (b) ? (a) : (b)) @@ -140,11 +140,11 @@ void linked_switch_group_update(char *moby) { } switch ((unsigned char)MOBY(moby)->state) { case INITIALIZE_LINKED_GROUP: - if (switch_vars->unk79 == 0) { + if (switch_vars->is_group_follower == 0) { char *iter[4]; char *linked; - switch_vars->unk7B = 0; + switch_vars->enumerated_group_entry_count = 0; switch_vars->unk80 = moby; get_first_moby_in_group(iter, (unsigned char)MOBY(moby)->group, 0, 0); while ((linked = *iter) != 0) { @@ -153,17 +153,17 @@ void linked_switch_group_update(char *moby) { SwitchVars *other_data = *(SwitchVars **)(linked + 0x78); other_data->unk80 = moby; - other_data->unk79 = 1; + other_data->is_group_follower = 1; } - switch_vars->unk7B++; + switch_vars->enumerated_group_entry_count++; get_next_moby_in_group(iter, iter[0], 0, 0); } } switch_vars->unk70 = 0; switch_vars->unk72 = 0; - switch_vars->unk7A = 0; + switch_vars->reported_hit_count = 0; switch_vars->unk74 = 0; - switch_vars->unk76 = 0; + switch_vars->opened_color_flash_timer = 0; set_moby_color(moby, 0x80, 0x80, 0x80); MOBY(moby)->state = MONITOR_LINKED_GROUP_HITS; @@ -176,29 +176,29 @@ void linked_switch_group_update(char *moby) { linked = switch_vars->unk80; linked_data = *(SwitchVars **)(linked + 0x78); if ((unsigned char)linked[0x20] == 1) { - switch_vars->unk7A = 0; + switch_vars->reported_hit_count = 0; linked[0x20] = 2; if (linked_data->unk7C > 0) { linked_data->unk70 = scale_game_frames(switch_vars->unk7C); } } - linked_data->unk7A++; + linked_data->reported_hit_count++; allocate_voice_for_target_entry(3, 0, moby); set_moby_color(moby, 0, 0xFF, 0); switch_vars->unk74 = 1; } if ((unsigned char)MOBY(moby)->state == WAIT_FOR_LINKED_GROUP_COMPLETION) { - if (switch_vars->unk7A >= switch_vars->unk7B) { + if (switch_vars->reported_hit_count >= switch_vars->enumerated_group_entry_count) { set_moby_list_state((unsigned char)MOBY(moby)->group, 4); allocate_voice_for_target_entry(1, 0, moby); - switch_vars->unk70 = switch_vars->unk84; + switch_vars->unk70 = switch_vars->opened_state_duration; debug_print( D_L13_001F4D90, ((short)MOBY(moby)->save_id), MOBY(moby)->oclass, frame_count); MOBY(moby)->state = UPDATE_OPENED_STATE; } else { if (switch_vars->unk7C >= 0) { if (fast_dec_timer_s16(&switch_vars->unk70) != 0) { - switch_vars->unk7A = 0; + switch_vars->reported_hit_count = 0; switch_vars->unk74 = 0; allocate_voice_for_target_entry(2, 0, moby); @@ -221,16 +221,16 @@ void linked_switch_group_update(char *moby) { case RESET_HIT_STATE: set_moby_color(moby, 0x80, 0x80, 0x80); - switch_vars->unk7A = 0; + switch_vars->reported_hit_count = 0; switch_vars->unk74 = 0; switch_vars->unk20 = (float)switch_vars->unk24; MOBY(moby)->state = MONITOR_LINKED_GROUP_HITS; break; case UPDATE_OPENED_STATE: - if (switch_vars->unk79 == 0 && switch_vars->unk70 != -1) { + if (switch_vars->is_group_follower == 0 && switch_vars->unk70 != -1) { if (fast_dec_timer_s16(&switch_vars->unk70) != 0) { - switch_vars->unk7A = 0; + switch_vars->reported_hit_count = 0; switch_vars->unk74 = 0; allocate_voice_for_target_entry(2, 0, moby); @@ -247,8 +247,8 @@ void linked_switch_group_update(char *moby) { scale_game_frames(5) + switch_vars->unk70 / scale_game_frames(0x28)); } } - if (fast_dec_timer_s16(&switch_vars->unk76) != 0) { - switch_vars->unk76 = scale_game_frames(0x14); + if (fast_dec_timer_s16(&switch_vars->opened_color_flash_timer) != 0) { + switch_vars->opened_color_flash_timer = scale_game_frames(0x14); if (switch_vars->unk78 != 0) { set_moby_color(moby, 0, 0xFF, 0); switch_vars->unk78 = 0; From f2ca8b5034e9a99ae63bc93e7a314d256094dbe1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:32:49 +0000 Subject: [PATCH 308/758] decomp: clarify names in sand_shark_nest_update b2E -> removal_request_state: Varscb38.b2E is initialized to 1 by sb at 0x002dcc30. Checked level-02 helper 0x002dcfe0 reads the same nest pvars+0x2E at 0x002dd00c, compares with 2 at 0x002dd010, resets it to 1 at 0x002dd024, decrements spawner membership at 0x002dd03c-0x002dd044 and calls mark_moby_for_removal at 0x002dd048, then exits. Supplied handle_sand_shark_nest_damage C confirms this is a removal request state, not a boolean. i14C -> launched_sand_shark_count: In SAND_SHARK_NEST_LAUNCH_SAND_SHARK, the selected shark returned by FUN_L02_002dd2a8 is checked nonnull at 0x002dcd48-0x002dcd4c. With a valid nest_vars->spawner, retail 0x002dcd54-0x002dcd7c resolves that spawner moby's pvars and increments its +0x14C field immediately before preparing launch position/velocity and calling launch_sand_shark at 0x002dcde8. Source Spawnercb38.i14C therefore accounts for launched sand sharks. i150 -> active_nest_count: Source Spawnercb38.i150 increments when this nest initializes and registers with its valid spawner: retail 0x002dcc34-0x002dcc60 resolves spawner pvars and adds 1 at +0x150. On completed death knockback it subtracts 1 at 0x002dce60-0x002dce80 before explosion/removal. The checked damage helper also subtracts 1 from that spawner field at 0x002dd03c-0x002dd044 before direct removal at 0x002dd048. The balanced nest registration/removal data flow establishes active nest accounting. --- src/overlays/l02/mobys/sand_shark_nest.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark_nest.c b/src/overlays/l02/mobys/sand_shark_nest.c index 2654bfd9ce..b310ee403e 100644 --- a/src/overlays/l02/mobys/sand_shark_nest.c +++ b/src/overlays/l02/mobys/sand_shark_nest.c @@ -101,7 +101,7 @@ typedef struct { float f20; /* 0x20 */ short s24; /* 0x24 */ char pad26[8]; - unsigned char b2E; /* 0x2E */ + unsigned char removal_request_state; /* 0x2E */ char pad2F[0x11]; float vel[4]; /* 0x40: passed to spawn_explosion */ char pad50[0x20]; @@ -115,8 +115,8 @@ typedef struct { /* Counters kept in the spawner moby's pvars. */ typedef struct { char pad0[0x14C]; - int i14C; - int i150; + int launched_sand_shark_count; + int active_nest_count; } Spawnercb38; extern BoltSourceStats bolt_source_stats_lui[][64] __asm__("D_0014D590") NOT_SDA; @@ -175,10 +175,10 @@ void sand_shark_nest_update(unsigned char *moby) { MOBY(moby)->state = SAND_SHARK_NEST_WAIT_FOR_SPAWN; nest_vars->f20 = 3.0f; nest_vars->s24 = 3; - nest_vars->b2E = 1; + nest_vars->removal_request_state = 1; nest_vars->timer = scale_game_frames(nest_vars->delay); if (nest_vars->spawner >= 0) { - (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8 + 0x78))->i150 += 1; + (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8 + 0x78))->active_nest_count += 1; } break; case SAND_SHARK_NEST_WAIT_FOR_SPAWN: @@ -210,7 +210,7 @@ void sand_shark_nest_update(unsigned char *moby) { if (launched_shark) { char *od = *(char **)(launched_shark + 0x78); if (nest_vars->spawner >= 0) { - (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8 + 0x78))->i14C += + (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8 + 0x78))->launched_sand_shark_count += 1; } qcopy(&launch_position, moby + 0x10); @@ -239,7 +239,7 @@ void sand_shark_nest_update(unsigned char *moby) { if (step_moby_motion(moby, nest_vars->anim) & 0x40) { if (nest_vars->spawner >= 0) { extern int D_L02_0015FFD8_s __asm__("D_L02_0015FFD8") __attribute__((sda)); - (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8_s + 0x78))->i150 -= 1; + (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8_s + 0x78))->active_nest_count -= 1; } qcopy(&launch_velocity_or_explosion_position, moby + 0x10); spawn_explosion(moby, From 5c6addc09155a0ff531ba808fe77658a351e150f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:35:03 +0000 Subject: [PATCH 309/758] decomp: clarify names in thruster_pack_lock_green_update f2C -> target_reset_timer: In the authoritative C, fast_dec_timer receives (int *)&moby_vars->f2C only while f24 is nonzero and i30 is zero. Retail 0x002d688c-0x002d6898 passes private +0x2C to the timer helper and tests return 2; that path plays voice entry 0 and clears the scalar target at +0x24 (0x002d68c0-0x002d68d0). This proves a timer for resetting that target, without claiming units or initial duration. i30 -> target_reset_timer_disabled: Retail 0x002d6880-0x002d6898 loads private +0x30 and branches around the +0x2C timer call when nonzero. The C expresses i30 == 0 && fast_dec_timer(...) == 2 before clearing f24. Thus nonzero disables the timer-based target reset; the separate external-mode and hero reset conditions remain possible. The supplied same-file list helper writes +0x30 = 1 together with +0x24 = 1.5f. i38 -> conditional_removal_enabled: Retail 0x002d6698-0x002d66a8 sets private +0x38 to 1 when D_L18_00174858 is nonzero. At 0x002d6804-0x002d6818 its nonzero test enables the external-mode-2/submode-3 path; 0x002d6820-0x002d6860 removes all three stored components and the parent. The authoritative C identifies these calls as mark_moby_for_removal, proving this conditional removal gate without assigning meanings to the external modes. p14 -> aligned_lock_component: Retail 0x002d670c-0x002d6714 stores a create_moby(0x6F0) result at private +0x14. At 0x002d6744-0x002d6758 it copies parent rotation +0x40 without an additional turn, unlike the +0x18 component. At 0x002d6a38-0x002d6aa8 its position is reconstructed from the animated scalar and origin and update_entity is called. The C and retail removal path both retain it as a lock component aligned to parent rotation at initialization. p18 -> opposed_lock_component: Retail 0x002d675c-0x002d6764 stores the second create_moby(0x6F0) result at private +0x18. After copying parent rotation (0x002d6798-0x002d67a4), 0x002d67a8-0x002d67c0 adds 3.1415901 to rotation +0x48 through fast_add_rotations. The C and 0x002d6aac-0x002d6b1c reconstruct this component's animated position and update it. Opposed describes the proven half-turn relative to the aligned component, without asserting a visual side. p1C -> origin_lock_component: Retail 0x002d66ac-0x002d6708 creates class 0x6EB, copies the saved parent origin at private +0 into the new moby's position, copies parent rotation, updates the entity, then stores its pointer at private +0x1C. Unlike the +0x14 and +0x18 pointers, it is not used in subsequent animated position reconstruction; its other assigned-function use is conditional removal at 0x002d6848-0x002d6858. The name records the origin placement rather than an unproven visual identity. --- .../l18/mobys/thruster_pack_lock_green.c | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/overlays/l18/mobys/thruster_pack_lock_green.c b/src/overlays/l18/mobys/thruster_pack_lock_green.c index 284f775660..0550f86a08 100644 --- a/src/overlays/l18/mobys/thruster_pack_lock_green.c +++ b/src/overlays/l18/mobys/thruster_pack_lock_green.c @@ -34,16 +34,16 @@ typedef struct { typedef struct { char pad0[0x10]; float f10; - char *p14; - char *p18; - char *p1C; + char *aligned_lock_component; + char *opposed_lock_component; + char *origin_lock_component; float f20; float f24; float f28; - float f2C; - int i30; + float target_reset_timer; + int target_reset_timer_disabled; float f34; - int i38; + int conditional_removal_enabled; } L18E_q; extern char *D_L18_00174858_lui __asm__("D_L18_00174858") NOT_SDA; @@ -79,7 +79,7 @@ void thruster_pack_lock_green_update(char *moby) { MOBY(moby)->pos.z = probe_ground_height(moby + 0x10, 0, 0.5f); qcopy(moby_vars, moby + 0x10); if (D_L18_00174858_lui != 0) { - moby_vars->i38 = 1; + moby_vars->conditional_removal_enabled = 1; } { char *spawned_moby = create_moby(0x6EB); @@ -92,31 +92,31 @@ void thruster_pack_lock_green_update(char *moby) { qcopy(spawned_moby + 0x10, moby_vars); qcopy(spawned_moby + 0x40, moby + 0x40); update_entity(spawned_moby); - moby_vars->p1C = spawned_moby; + moby_vars->origin_lock_component = spawned_moby; } - moby_vars->p14 = create_moby(0x6F0); - moby_vars->p14[0x30] = 0x40; - *(short *)(moby_vars->p14 + 0x32) = 0x56; - moby_vars->p14[0x31] = 1; - *(float *)(moby_vars->p14 + 0x2C) = - (*(L18Cls_q **)(moby_vars->p14 + 0x24))->f24 * D_L18_00161998; + moby_vars->aligned_lock_component = create_moby(0x6F0); + moby_vars->aligned_lock_component[0x30] = 0x40; + *(short *)(moby_vars->aligned_lock_component + 0x32) = 0x56; + moby_vars->aligned_lock_component[0x31] = 1; + *(float *)(moby_vars->aligned_lock_component + 0x2C) = + (*(L18Cls_q **)(moby_vars->aligned_lock_component + 0x24))->f24 * D_L18_00161998; { - char *q = moby_vars->p14; + char *q = moby_vars->aligned_lock_component; qcopy(q + 0x40, moby + 0x40); update_entity(q); } - moby_vars->p18 = create_moby(0x6F0); - moby_vars->p18[0x30] = 0x40; - *(short *)(moby_vars->p18 + 0x32) = 0x40; - moby_vars->p18[0x31] = 1; - *(float *)(moby_vars->p18 + 0x2C) = - (*(L18Cls_q **)(moby_vars->p18 + 0x24))->f24 * D_L18_00161998; + moby_vars->opposed_lock_component = create_moby(0x6F0); + moby_vars->opposed_lock_component[0x30] = 0x40; + *(short *)(moby_vars->opposed_lock_component + 0x32) = 0x40; + moby_vars->opposed_lock_component[0x31] = 1; + *(float *)(moby_vars->opposed_lock_component + 0x2C) = + (*(L18Cls_q **)(moby_vars->opposed_lock_component + 0x24))->f24 * D_L18_00161998; { - char *q = moby_vars->p18; + char *q = moby_vars->opposed_lock_component; qcopy(q + 0x40, moby + 0x40); - *(float *)(moby_vars->p18 + 0x48) = + *(float *)(moby_vars->opposed_lock_component + 0x48) = fast_add_rotations(*(float *)(q + 0x48), 3.1415901f); - update_entity(moby_vars->p18); + update_entity(moby_vars->opposed_lock_component); } ((unsigned char *)moby)[0x20] = 1; { @@ -131,20 +131,20 @@ void thruster_pack_lock_green_update(char *moby) { case STATE_UPDATE_LOCK_COMPONENTS: { float v[4]; if (D_L18_0015F5C4_d == 2) { - if (moby_vars->i38 != 0) { + if (moby_vars->conditional_removal_enabled != 0) { if (D_L18_0016D290_lui == 3) { - if (moby_vars->p14 != 0) - mark_moby_for_removal(moby_vars->p14); - if (moby_vars->p18 != 0) - mark_moby_for_removal(moby_vars->p18); - if (moby_vars->p1C != 0) - mark_moby_for_removal(moby_vars->p1C); + if (moby_vars->aligned_lock_component != 0) + mark_moby_for_removal(moby_vars->aligned_lock_component); + if (moby_vars->opposed_lock_component != 0) + mark_moby_for_removal(moby_vars->opposed_lock_component); + if (moby_vars->origin_lock_component != 0) + mark_moby_for_removal(moby_vars->origin_lock_component); mark_moby_for_removal(moby); } } } if (moby_vars->f24 != 0.0f) { - if ((moby_vars->i30 == 0 && fast_dec_timer((int *)&moby_vars->f2C) == 2) || + if ((moby_vars->target_reset_timer_disabled == 0 && fast_dec_timer((int *)&moby_vars->target_reset_timer) == 2) || (D_L18_0015F5C4_d == 2 && D_L18_0016D290_lui >= 4)) { allocate_voice_for_target_entry(0, 0, (int)moby); moby_vars->f24 = 0; @@ -190,19 +190,19 @@ void thruster_pack_lock_green_update(char *moby) { frame_time_sq * 4.0f, frame_time * 4.0f); } - if (moby_vars->p14 != 0) { - FUN_001f9bf8_q(moby_vars->p14 + 0x10, moby_vars->p14 + 0xD0, -moby_vars->f20); - FUN_001f9bf8_q(v, moby_vars->p14 + 0xE0, -moby_vars->f20 * 0.2f); - fast_vec_add(moby_vars->p14 + 0x10, moby_vars->p14 + 0x10, v); - fast_vec_add(moby_vars->p14 + 0x10, moby_vars->p14 + 0x10, moby_vars); - update_entity(moby_vars->p14); + if (moby_vars->aligned_lock_component != 0) { + FUN_001f9bf8_q(moby_vars->aligned_lock_component + 0x10, moby_vars->aligned_lock_component + 0xD0, -moby_vars->f20); + FUN_001f9bf8_q(v, moby_vars->aligned_lock_component + 0xE0, -moby_vars->f20 * 0.2f); + fast_vec_add(moby_vars->aligned_lock_component + 0x10, moby_vars->aligned_lock_component + 0x10, v); + fast_vec_add(moby_vars->aligned_lock_component + 0x10, moby_vars->aligned_lock_component + 0x10, moby_vars); + update_entity(moby_vars->aligned_lock_component); } - if (moby_vars->p18 != 0) { - FUN_001f9bf8_q(moby_vars->p18 + 0x10, moby_vars->p18 + 0xD0, -moby_vars->f20); - FUN_001f9bf8_q(v, moby_vars->p18 + 0xE0, -moby_vars->f20 * 0.2f); - fast_vec_add(moby_vars->p18 + 0x10, moby_vars->p18 + 0x10, v); - fast_vec_add(moby_vars->p18 + 0x10, moby_vars->p18 + 0x10, moby_vars); - update_entity(moby_vars->p18); + if (moby_vars->opposed_lock_component != 0) { + FUN_001f9bf8_q(moby_vars->opposed_lock_component + 0x10, moby_vars->opposed_lock_component + 0xD0, -moby_vars->f20); + FUN_001f9bf8_q(v, moby_vars->opposed_lock_component + 0xE0, -moby_vars->f20 * 0.2f); + fast_vec_add(moby_vars->opposed_lock_component + 0x10, moby_vars->opposed_lock_component + 0x10, v); + fast_vec_add(moby_vars->opposed_lock_component + 0x10, moby_vars->opposed_lock_component + 0x10, moby_vars); + update_entity(moby_vars->opposed_lock_component); } MOBY(moby)->pos.z = moby_vars->f10 + moby_vars->f34; } From 2669f36ed8e512aeeaf37264d96f715636ee27e2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:35:06 +0000 Subject: [PATCH 310/758] decomp: clarify names in falling_moby_group_update f330 -> transform_progress: Retail 0x002f1878-0x002f18a4 passes pvars+0x330 as the scalar advanced toward 1.5 then 2.0. At 0x002f1a94-0x002f1ae8 this same float times 0.5 drives both position and rotation lerp from saved transforms to the indexed target, proving transform progress rather than an arbitrary scalar. f334 -> transform_progress_step: Retail 0x002f188c/0x002f18a4 supplies pvars+0x334 as a1 alongside transform progress +0x330 as a0 to advance_accelerated_scalar. Checked level-18 helper 0x0025dcbc/0x0025dcc4 saves these in s1/s0; 0x0025de08-0x0025de18 and 0x0025de34-0x0025de40 add *s0 into *s1. Thus +0x334 is the per-update step applied to transform progress, with acceleration/braking controlled by the helper. f340 -> fall_vertical_step: In MOBY_FALL_AND_REMOVE, retail 0x002f1784 loads pvars+0x340; 0x002f19e8-0x002f1a04 adds it to moby position z at +0x18. Retail 0x002f1a08-0x002f1a10 then subtracts frame_time_sq*5.0 and stores it back. The C confirms this is the vertical displacement step used during falling. f344 -> debris_spawn_random_bound: Retail 0x002f18c0-0x002f18e4 seeds pvars+0x344 from the integer debris initial random bound after the progress threshold. Retail 0x002f1b00-0x002f1b44 tests it for nonzero, adds 0.25, truncates it and supplies the integer to random_integer_below; only a zero random result reaches spawn_debris_chunk at 0x002f1c0c. This proves its random-bound role. f348 -> hero_has_stood_on_group: Retail 0x002f1820 initializes pvars+0x348 to zero. The ground-moby comparisons at 0x002f1934-0x002f1980 resolve saved group indices and branch on equality with hero.ground_moby; 0x002f1990 latches +0x348 to one. Retail 0x002f19b0-0x002f19d4 requires that latch before decrementing the fall countdown after the hero leaves group support. It records historical hero support by the group. f34C -> fall_countdown_frames: Retail 0x002f1824-0x002f1834 initializes pvars+0x34C with scale_game_frames(30). At 0x002f19d0-0x002f19e4 fast_dec_timer receives its address after the hero-support latch and grounded-away checks; a nonzero completion return writes state 4, MOBY_FALL_AND_REMOVE. The field is the frame-scaled countdown that triggers falling. i4 -> target_transform_record_index: Retail 0x002f1a90-0x002f1abc loads pvars+4, shifts it left seven, adds D_L18_001600EC and +0x30 to select the target position for lerp. Retail 0x002f1ac0-0x002f1ae8 repeats the same record selection with +0x70 for target rotation. The C confirms it indexes the target transform record shared by both interpolations. i8 -> fall_at_progress_threshold_enabled: Retail 0x002f18ec-0x002f190c compares transform progress +0x330 with group_transform_fall_progress_threshold_gp, then loads the integer at pvars+8 and writes MOBY_FALL_AND_REMOVE only when it is nonzero. The C has the same conjunction. This field enables the progress-threshold route to falling; it does not gate the separate hero-departure countdown route. --- src/overlays/l18/mobys/falling_moby_group.c | 64 ++++++++++----------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/src/overlays/l18/mobys/falling_moby_group.c b/src/overlays/l18/mobys/falling_moby_group.c index bbce54df35..9697482a9f 100644 --- a/src/overlays/l18/mobys/falling_moby_group.c +++ b/src/overlays/l18/mobys/falling_moby_group.c @@ -60,22 +60,22 @@ typedef struct { typedef struct { int pad0; - int i4; - int i8; + int target_transform_record_index; + int fall_at_progress_threshold_enabled; char padC[4]; char v10[0x10]; char v20[0x10]; char pad30[0x20]; VEnt ent[15]; char pad320[0x10]; - float f330; - float f334; + float transform_progress; + float transform_progress_step; int cnt; char pad33C[4]; - float f340; - float f344; - int f348; - int f34C; + float fall_vertical_step; + float debris_spawn_random_bound; + int hero_has_stood_on_group; + int fall_countdown_frames; int f350; } VData; @@ -133,8 +133,8 @@ void falling_moby_group_update(struct Moby *moby) { if (*t++ < 0) break; } - moby_vars->f348 = 0; - moby_vars->f34C = scale_game_frames(30); + moby_vars->hero_has_stood_on_group = 0; + moby_vars->fall_countdown_frames = scale_game_frames(30); moby_vars->cnt = j; capture_linked_moby_relative_transforms(moby, (char *)moby_vars + 0x30, j); moby->state = FALLING_MOBY_GROUP_AWAIT_ACTIVATION; @@ -145,35 +145,35 @@ void falling_moby_group_update(struct Moby *moby) { int i; unsigned char *hero_ground_moby; if (group_transform_advance_enabled_gp != 0) { - if (moby_vars->f330 < 1.5f) { + if (moby_vars->transform_progress < 1.5f) { advance_accelerated_scalar(1.5f, initial_acceleration_step, initial_braking_step, initial_maximum_speed, - &moby_vars->f330, - &moby_vars->f334); + &moby_vars->transform_progress, + &moby_vars->transform_progress_step); } else { advance_accelerated_scalar(2.0f, later_acceleration_step, later_braking_step, later_maximum_speed, - &moby_vars->f330, - &moby_vars->f334); + &moby_vars->transform_progress, + &moby_vars->transform_progress_step); } } - if (moby_vars->f330 > group_transform_debris_start_progress_threshold_gp && - moby_vars->f344 == 0.0f) { - moby_vars->f344 = *(int *)&group_transform_debris_initial_random_bound_gp; + if (moby_vars->transform_progress > group_transform_debris_start_progress_threshold_gp && + moby_vars->debris_spawn_random_bound == 0.0f) { + moby_vars->debris_spawn_random_bound = *(int *)&group_transform_debris_initial_random_bound_gp; } - if (moby_vars->f330 > group_transform_fall_progress_threshold_gp && - moby_vars->i8 != 0) { + if (moby_vars->transform_progress > group_transform_fall_progress_threshold_gp && + moby_vars->fall_at_progress_threshold_enabled != 0) { moby->state = MOBY_FALL_AND_REMOVE; } hero_on_group_or_class_764_moby = 0; for (i = 0; i < moby_vars->cnt; i++) { unsigned char *group_moby = D_L18_0015FFD8 + (moby_vars->ent[i].idx << 8); if (hero.ground_moby == group_moby) { - moby_vars->f348 = 1; + moby_vars->hero_has_stood_on_group = 1; hero_on_group_or_class_764_moby = 1; break; } @@ -184,17 +184,17 @@ void falling_moby_group_update(struct Moby *moby) { if (s == 0x764) hero_on_group_or_class_764_moby = 1; } - if (moby_vars->f348 != 0 && hero_on_group_or_class_764_moby == 0 && + if (moby_vars->hero_has_stood_on_group != 0 && hero_on_group_or_class_764_moby == 0 && hero.air_frames.s == 0) { - if (fast_dec_timer(&moby_vars->f34C)) + if (fast_dec_timer(&moby_vars->fall_countdown_frames)) moby->state = MOBY_FALL_AND_REMOVE; } break; } case MOBY_FALL_AND_REMOVE: { float t = frame_time_sq * 5.0f; - moby->pos.z += moby_vars->f340; - moby_vars->f340 = moby_vars->f340 - t; + moby->pos.z += moby_vars->fall_vertical_step; + moby_vars->fall_vertical_step = moby_vars->fall_vertical_step - t; if (moby->pos.z < 20.0f) { int i; for (i = 0; i < moby_vars->cnt; i++) { @@ -209,21 +209,21 @@ void falling_moby_group_update(struct Moby *moby) { if ((unsigned char)(moby->state - 1) < 2) { lerp_vector(&moby->pos, moby_vars->v10, - D_L18_001600EC + (moby_vars->i4 << 7) + 0x30, - moby_vars->f330 * 0.5f); + D_L18_001600EC + (moby_vars->target_transform_record_index << 7) + 0x30, + moby_vars->transform_progress * 0.5f); lerp_vector(&moby->rot, moby_vars->v20, - D_L18_001600EC + (moby_vars->i4 << 7) + 0x70, - moby_vars->f330 * 0.5f); + D_L18_001600EC + (moby_vars->target_transform_record_index << 7) + 0x70, + moby_vars->transform_progress * 0.5f); } apply_linked_moby_relative_transforms(moby, (char *)moby_vars + 0x30, moby_vars->cnt); - if (moby_vars->f344 != 0.0f) { + if (moby_vars->debris_spawn_random_bound != 0.0f) { if (moby->state != MOBY_FALL_AND_REMOVE) { float debris_spawn_position[4]; float s, z, debris_spawn_angle; int debris_spawn_frames; - moby_vars->f344 = moby_vars->f344 + 0.25f; - if (random_integer_below(truncate_float_to_s32(moby_vars->f344)) == 0) { + moby_vars->debris_spawn_random_bound = moby_vars->debris_spawn_random_bound + 0.25f; + if (random_integer_below(truncate_float_to_s32(moby_vars->debris_spawn_random_bound)) == 0) { s = random_float_between(-1.0471976f, 1.0471976f); debris_spawn_angle = fast_add_rotations(s, D_L18_001677D8); z = random_float_between(0.0f, 20.0f); From 373eaf0f3b7315684e3bcdd3feb223ba9dba6a26 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:35:10 +0000 Subject: [PATCH 311/758] decomp: clarify names in update_hero_easing_targets_and_point_effects i12A8 -> point_effect_emission_updates_remaining: P_20b1d8.i12A8 is s32. Retail 0020b4a4-0020b4a8 loads hero+12A8 and returns when nonpositive; 0020b4b0-0020b4b4 also requires a nonzero per-point emission count. 0020b4d4-0020b4dc subtracts one and stores it before moby_point_position calls for points 0x16 and 0x17 and the two particle-emission loops at 0020b4e0-0020b584. Flag 0x80 clears it at 0020b3f8-0020b404. Original Ghidra iRam001405f8 and authoritative C P.i12A8 agree: it is the remaining count of point-effect emission updates, not the particle count per point. --- 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 a64b86b902..9a759cd52a 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -3151,7 +3151,7 @@ typedef struct { s32 i10E0; u8 p10E4[0x12A0 - 0x10E4]; f32 f12A0, f12A4; - s32 i12A8; + s32 point_effect_emission_updates_remaining; s16 h12AC; u16 h12AE; u8 p12B0[0x2080 - 0x12B0]; @@ -3210,14 +3210,14 @@ void update_hero_easing_targets_and_point_effects(void) { configure_hero_point_effect_emission(1, 2, 1, 0, 0.021f, 0.002f); if (P.i208C == 4 && P.i418 > 0 && P.i418 < scale_game_frames(12)) configure_hero_point_effect_emission(1, 2, 0, 1, 0.016f, 0.002f); - if (P.i12A8 <= 0) + if (P.point_effect_emission_updates_remaining <= 0) return; if (P.h12AC == 0) return; optional_moby_basis = 0; if (P.h12AE & 1) optional_moby_basis = P.p2080 + 0xC0; - P.i12A8--; + P.point_effect_emission_updates_remaining--; moby_point_position(P.p2080, 0x16, emission_point_world_position); for (i = 0; i < P.h12AC; i++) spawn_jittered_effect_particle_with_optional_basis( @@ -3231,7 +3231,7 @@ void update_hero_easing_targets_and_point_effects(void) { optional_moby_basis, P.f12A0 + random_float_between(-P.f12A4, P.f12A4)); } else - P.i12A8 = 0; + P.point_effect_emission_updates_remaining = 0; } typedef unsigned int u128_20b5b8 __attribute__((mode(TI))); From 25ea93dc3b40a33ad1e00bc1dc4ff2a60a663218 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:35:14 +0000 Subject: [PATCH 312/758] decomp: clarify names in update_color_tween_emitter_particle i2080 -> hit_recipient_moby: Retail 0x00272da0 derives the reference-position owner as reference_position-0x80; 0x00272de0 loads its +0x2080 field into a0, and 0x00272df8 calls 0x00259bc8 (spawn_nearby_effect). Original Ghidra represents this argument as uRam001413d0. The authoritative C passes reference_position_owner->i2080 as that function's first argument. The supplied spawn_nearby_effect C names this argument owner_moby, reads/writes MOBY(owner_moby)->hit_slot, tests existing_hit->owner against it, and assigns hit_record->owner = owner_moby, proving a hit-recipient moby reference rather than an arbitrary integer or an offset-only role. --- 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 db5a0de951..b1e194dc8e 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -805,7 +805,7 @@ typedef struct { char p0[0x88]; float unk88; char p1[0x2080 - 0x8C]; - int i2080; + int hit_recipient_moby; } P_272bc0; extern char D_0013F3D0[] NOT_SDA; @@ -881,7 +881,7 @@ void update_color_tween_emitter_particle(struct EffectParticle *particle) { fast_vec_sub(particle_vector_scratch, reference_position, particle->pos.f); fast_vec_normalize(particle_vector_scratch, particle_vector_scratch, 1.0f); particle_vector_scratch[2] = 1.0f; - spawn_nearby_effect(reference_position_owner->i2080, + spawn_nearby_effect(reference_position_owner->hit_recipient_moby, *(int *)(particle_data + 0x18), 1, particle->pos.f, From 94e5f8725ae90146fdeac7a52e181ddf93646b42 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:35:17 +0000 Subject: [PATCH 313/758] decomp: clarify names in vendor_update b20 -> vendor_state: P_2a57a8::b20 is read by lbu at 0x002a5838 and dispatches states 0/1/2/3 at 0x002a5850-0x002a587c. Source switch uses VENDOR_INITIALIZE, VENDOR_WAIT_FOR_HERO, VENDOR_HERO_NEARBY and VENDOR_ZERO_AUXILIARY_SCALE. Stores at 0x002a588c, 0x002a5a00, 0x002a5b6c and 0x002a5d74 implement vendor state transitions. f2C -> auxiliary_scale: M_2a57a8::f2C belongs to q->mC, the auxiliary moby created as class 0x477 at 0x002a58a0-0x002a58a8. Retail 0x002a5a84-0x002a5aa8 and 0x002a5bf0-0x002a5c14 store q->f90 * q->mC->p24->f24 * 2.5 into this field before update_entity. The established VENDOR_ZERO_AUXILIARY_SCALE case at 0x002a5d84-0x002a5da8 zeros the factor, recomputes this field and updates the auxiliary moby, supporting auxiliary_scale. f90 -> effect_scale_factor: Q_2a57a8::f90 is zeroed at 0x002a5904, decreased by 0.1 while waiting at 0x002a5930-0x002a5960, and increased toward 1 while the hero is nearby at 0x002a5abc-0x002a5af0. At 0x002a5a88-0x002a5aa8 and 0x002a5bf4-0x002a5c14 it multiplies the auxiliary scale. Supplied draw_vendor_effects also multiplies sparkle/glow XY extents by private data +0x90, proving a shared effect scale factor. i90 -> pulse_color: P_2a57a8::i90 receives the vendor color pulse at 0x002a5854. Retail 0x002a5814-0x002a584c computes sin(vendor_color_pulse_phase)*48, converts to integer, adds 0x60, multiplies by 0x10101 to replicate equal RGB bytes, then ORs 0x80000000. The source draw_vendor_effects also uses this vendor+0x90 packed color for sparkle drawing. --- src/overlays/shared/vendor/vendor.c | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/overlays/shared/vendor/vendor.c b/src/overlays/shared/vendor/vendor.c index 6668001293..a8fe6dc8d5 100644 --- a/src/overlays/shared/vendor/vendor.c +++ b/src/overlays/shared/vendor/vendor.c @@ -46,7 +46,7 @@ typedef struct { u8 p1C[0x24 - 0x1C]; N_2a57a8 *p24; u8 p28[4]; - f32 f2C; + f32 auxiliary_scale; u8 p30[2]; u16 h32; u16 h34; @@ -59,20 +59,20 @@ typedef struct { u8 p8[4]; M_2a57a8 *mC; u8 p10[0x90 - 0x10]; - f32 f90; + f32 effect_scale_factor; } Q_2a57a8; typedef struct { u8 p0[0x10]; f32 f10, f14, f18; u8 p1C[4]; - u8 b20; + u8 vendor_state; u8 p21[0x52 - 0x21]; u8 b52, b53; u8 p54[0x78 - 0x54]; Q_2a57a8 *q; u8 p7C[0x90 - 0x7C]; - s32 i90; + s32 pulse_color; } P_2a57a8; typedef struct { @@ -310,11 +310,11 @@ void vendor_update(P_2a57a8 *vendor_moby) { vendor_color_pulse_phase += 0.05f; if (vendor_color_pulse_phase > 3.14f) vendor_color_pulse_phase = -3.14f; - vendor_moby->i90 = + vendor_moby->pulse_color = (((s32)(fast_sin(vendor_color_pulse_phase) * 48.0f) + 0x60) * 0x10101) | 0x80000000; - switch (vendor_moby->b20) { + switch (vendor_moby->vendor_state) { case VENDOR_INITIALIZE: - vendor_moby->b20 = 1; + vendor_moby->vendor_state = 1; q->i0 = 0; q->i4 = 0; q->mC = create_moby(0x477); @@ -324,21 +324,21 @@ void vendor_update(P_2a57a8 *vendor_moby) { q->mC->f14 = vendor_moby->f14; q->mC->f18 = vendor_moby->f18 + 2.95f; q->mC->b73 = 0x20; - q->f90 = 0.0f; + q->effect_scale_factor = 0.0f; for (i = 0; i < 2; i++) { attach_manipulator(q->mC, i, (u8 *)q + 0x10 + i * 0x40); } update_entity(q->mC); break; case VENDOR_WAIT_FOR_HERO: - if (q->f90 > 0.0f) - q->f90 -= 0.1f; - if (q->f90 <= 0.0f) + if (q->effect_scale_factor > 0.0f) + q->effect_scale_factor -= 0.1f; + if (q->effect_scale_factor <= 0.0f) q->mC->h34 |= 1; if (!(D_L00_0015F5CC_2a57a8 & 7) && vector_distance_xy(&vendor_moby->f10, &hero_pos) <= 16.0f && absolute_float(vendor_moby->f18 - hero_pos.f[2]) <= 8.0f) { - vendor_moby->b20 = 2; + vendor_moby->vendor_state = 2; if (vendor_moby->b53 != 1) blend_moby_animation(vendor_moby, 1, 0, 10); q->mC->h34 &= 0xFFFE; @@ -351,16 +351,16 @@ void vendor_update(P_2a57a8 *vendor_moby) { fast_add_rotations(vendor_manipulator_rotation_phase, 0.01f); vendor_manipulator_counter_rotation_phase = fast_add_rotations(vendor_manipulator_counter_rotation_phase, -0.02f); - q->mC->f2C = q->f90 * q->mC->p24->f24 * 2.5f; + q->mC->auxiliary_scale = q->effect_scale_factor * q->mC->p24->f24 * 2.5f; update_entity(q->mC); break; case VENDOR_HERO_NEARBY: - if (q->f90 < 1.0f) - q->f90 += 0.1f; + if (q->effect_scale_factor < 1.0f) + q->effect_scale_factor += 0.1f; hero_distance = vector_distance_xy(&vendor_moby->f10, &hero_pos); z = absolute_float(vendor_moby->f18 - hero_pos.f[2]); if (!(D_L00_0015F5CC_2a57a8 & 7) && (hero_distance > 18.0f || z > 10.0f)) { - vendor_moby->b20 = 1; + vendor_moby->vendor_state = 1; if (vendor_moby->b53) blend_moby_animation(vendor_moby, 0, 0, 10); break; @@ -375,7 +375,7 @@ void vendor_update(P_2a57a8 *vendor_moby) { fast_add_rotations(vendor_manipulator_rotation_phase, 0.01f); vendor_manipulator_counter_rotation_phase = fast_add_rotations(vendor_manipulator_counter_rotation_phase, -0.02f); - q->mC->f2C = q->f90 * q->mC->p24->f24 * 2.5f; + q->mC->auxiliary_scale = q->effect_scale_factor * q->mC->p24->f24 * 2.5f; update_entity(q->mC); if (hero.state.control_mode != 0 && hero.state.current != 3 && hero.state.control_mode != 1) { @@ -408,13 +408,13 @@ void vendor_update(P_2a57a8 *vendor_moby) { help_message_succeeded = try_set_help_message(1, 0x53E3) != 0; if ((pad_pressed_lui & 0x10) && interaction_allowed && help_message_succeeded) { open_vendor_menu(vendor_moby); - vendor_moby->b20 = 3; + vendor_moby->vendor_state = 3; } break; case VENDOR_ZERO_AUXILIARY_SCALE: if (q->mC) { - q->f90 = 0.0f; - q->mC->f2C = q->mC->p24->f24 * q->f90 * 2.5f; + q->effect_scale_factor = 0.0f; + q->mC->auxiliary_scale = q->mC->p24->f24 * q->effect_scale_factor * 2.5f; update_entity(q->mC); } break; From 9141399e430e0bee0801b384c1f0399d7590fc61 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:37:59 +0000 Subject: [PATCH 314/758] decomp: clarify names in follow_camera_avoid_mobies p18 -> collision_hit_moby: After collision_line at 0x002e8200 succeeds, retail 0x002e8224/0x002e8228 loads D_L00_00173E40+0x18. It is checked as a moby class at 0x002e8234, its position +0x10 forms the hit direction at 0x002e8244-0x002e8258, and it is passed as record_moby_hit's target at 0x002e82bc/0x002e82c0. Bounded helper 0x00259a88 confirms that argument supplies moby +0xA4 and is stored as the hit-record target at 0x00259b90. These uses prove the collision-hit moby role. p2080 -> hero_moby: GS_2e7d20 is bound to D_0013F350, the supplied source's hero symbol. Retail 0x002e7de8 loads its +0x2080 pointer as the sphere-query exclusion; 0x002e8204 passes the same pointer to collision_line. At 0x002e8284 it is make_hit_descriptor's source_moby; 0x002e82a4/0x002e82b8 dereference its +0xA6 moby class into the hit descriptor. Supplied follow_camera_setup likewise assigns this hero pointer to the target moby, proving hero_moby rather than a generic pointer. --- .../shared/camera/follow_camera_setup.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 1d78481a9c..81c866975c 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -1375,7 +1375,7 @@ typedef struct { typedef struct { u8 pad0[0x80]; u8 pad80[0x2080 - 0x80]; - u8 *p2080; + u8 *hero_moby; s32 i2084; u8 pad2088[0x20A4 - 0x2088]; u8 b20A4; @@ -1391,7 +1391,7 @@ extern f32 follow_camera_minimum_retracted_orbit_distance_gp __asm__("D_L0 typedef struct { u8 pad[0x18]; - s32 p18; + s32 collision_hit_moby; s32 p1C; u8 v20[0x10]; } E40_2e7d20_t; @@ -1451,7 +1451,7 @@ void follow_camera_avoid_mobies(u8 *camera_moby) { } lerp_vector(&probe_center, x + 0x90, camera_tracking_state - 0x50, 0.5f); nearby_moby_count = - probe_world_sphere(&probe_center, 1, D_0013F350_lui.p2080, 0, probe_diameter * 0.5f); + probe_world_sphere(&probe_center, 1, D_0013F350_lui.hero_moby, 0, probe_diameter * 0.5f); if (nearby_moby_count > 0) { i = nearby_moby_count; j = 0; @@ -1558,25 +1558,25 @@ void follow_camera_avoid_mobies(u8 *camera_moby) { if (!collision_line((x + 0x90), &moby_offset_or_camera_endpoint, camera_collision_mask, - D_0013F350_lui.p2080, + D_0013F350_lui.hero_moby, 0)) { goto clear; } if (test_follow_camera_point_in_collision_volume((*(E40_2e7d20_t *)&D_L00_00173E40_lui).v20)) { goto clear; } - if ((*(E40_2e7d20_t *)&D_L00_00173E40_lui).p18 != 0 && - is_moby_in_class_range_500_to_540((*(E40_2e7d20_t *)&D_L00_00173E40_lui).p18)) { + if ((*(E40_2e7d20_t *)&D_L00_00173E40_lui).collision_hit_moby != 0 && + is_moby_in_class_range_500_to_540((*(E40_2e7d20_t *)&D_L00_00173E40_lui).collision_hit_moby)) { fast_vec_sub( - &v20, (u8 *)(*(E40_2e7d20_t *)&D_L00_00173E40_lui).p18 + 0x10, g_debug_camera_lui); + &v20, (u8 *)(*(E40_2e7d20_t *)&D_L00_00173E40_lui).collision_hit_moby + 0x10, g_debug_camera_lui); v20.i[2] = 0; fast_vec_normalize(&v20, &v20, 1.0f); v20.f[3] = 5627.9248046875f; - make_hit_descriptor(&hit_descriptor, D_0013F350_lui.p2080, 0x800000, &v20, 20.0f); + make_hit_descriptor(&hit_descriptor, D_0013F350_lui.hero_moby, 0x800000, &v20, 20.0f); hit_descriptor.b18 = 3; hit_descriptor.b19 = 3; - hit_descriptor.h1A = *(u16 *)(D_0013F350_lui.p2080 + 0xA6); - record_moby_hit((*(E40_2e7d20_t *)&D_L00_00173E40_lui).p18, &hit_descriptor); + hit_descriptor.h1A = *(u16 *)(D_0013F350_lui.hero_moby + 0xA6); + record_moby_hit((*(E40_2e7d20_t *)&D_L00_00173E40_lui).collision_hit_moby, &hit_descriptor); } BI_2e7d20(0x4C)++; if (BI_2e7d20(0x4C) >= scale_game_frames(0x1E)) { From c6fa2383f8ff4deb29b7c7812fd3a7ec2fba4ac7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:38:02 +0000 Subject: [PATCH 315/758] decomp: clarify names in flying_car_update b74 -> voice_state: Snd_6ee0.b74 is the voice-entry state byte: retail 0x00306fa8-0x00306fc4 selects voice_pool + sound*0x70, verifies its owner at +0x88 equals flying_car_moby, and tests +0x74 for nonzero before release_voice_slot at 0x00306fcc. The bound C's update_flying_car_path_motion uses VoicePoolWindow.voice.state for the identical owner/state/release flow, confirmed again at 0x00307740-0x00307758. This establishes voice state without assigning meanings to individual nonzero values. f80 -> position_x_spring_state: Data_6ee0.f80 is reset with motion state at assigned retail 0x003073f0. The bound source passes private +0x80 as vendor_spring's persistent state pointer while updating moby->pos.x toward sampled pos[0]. Checked helper 0x00307884-0x003078ac pairs a0=moby+0x10, a1=private+0x80 and f12=sampled X before the spring call at 0x003078a8, proving the X-position spring-state role rather than an offset-only name. f84 -> position_y_spring_state: Data_6ee0.f84 is cleared on the assigned path reset at 0x003073ec. The bound source passes private +0x84 as vendor_spring's persistent state pointer for moby->pos.y toward sampled pos[1]. Checked helper 0x003078b0-0x003078c8 pairs a0=moby+0x14, a1=private+0x84 and f12=sampled Y before the spring call at 0x003078c4, proving the Y-position spring-state role. f90 -> bank_spring_state: Data_6ee0.f90 is cleared at assigned retail 0x003073e4 when the first path pose is restored. The bound C passes +0x90 to vendor_spring alongside &moby->rot.x and the clamped yaw-error-derived bank target. Checked helper 0x00307994-0x003079f4 divides yaw error, clamps it to [-1,1], scales the bank target, pairs a0=moby+0x40 with a1=private+0x90, and calls the same spring helper. Thus this is persistent bank spring state, without claiming physical units. f94 -> pitch_spring_state: Data_6ee0.f94 is cleared at assigned retail 0x003073fc. The bound C uses +0x94 as vendor_spring's state pointer for moby->rot.y with pitch=-fast_arc_tan(vector_length_xy(delta),delta[2]). Checked helper 0x00307964-0x00307990 computes that target, negates it, and supplies a0=moby+0x44 and a1=private+0x94 to the spring call, proving persistent pitch spring state. f98 -> yaw_spring_state: Data_6ee0.f98 is cleared at assigned retail 0x003073f4 on restoring the initial path yaw. The bound C passes +0x98 to its yaw-tracking helper with the target fast_arc_tan(delta[0],delta[1]) and the same tracking spring gain/damping as the position and pitch springs. Checked helper 0x0030792c-0x00307960 computes target yaw, compares current moby rotation +0x48, and supplies private+0x98 in a1 to the yaw update at 0x0030795c. This proves yaw spring state; no exact integration or velocity units are asserted. --- src/overlays/l14/mobys/flying_car.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l14/mobys/flying_car.c b/src/overlays/l14/mobys/flying_car.c index 2bb0155620..f1cf705fac 100644 --- a/src/overlays/l14/mobys/flying_car.c +++ b/src/overlays/l14/mobys/flying_car.c @@ -47,14 +47,14 @@ typedef struct { int f74; int path; /* 0x78 */ int sound; /* 0x7C */ - float f80; - float f84; + float position_x_spring_state; + float position_y_spring_state; float f88; short timer; /* 0x8C */ char pad8E[2]; - float f90; - float f94; - float f98; + float bank_spring_state; + float pitch_spring_state; + float yaw_spring_state; char pad9C[4]; int part; /* 0xA0 */ float fA4; @@ -81,7 +81,7 @@ typedef struct { typedef struct { char pad0[0x74]; - unsigned char b74; + unsigned char voice_state; char pad75[0x13]; struct Moby *f88; } Snd_6ee0; @@ -140,7 +140,7 @@ void flying_car_update(struct Moby *flying_car_moby) { } if (flying_car_data->sound != -1) { Snd_6ee0 *voice_entry = (Snd_6ee0 *)((u8 *)&voice_pool + flying_car_data->sound * 0x70); - if (voice_entry->f88 == flying_car_moby && voice_entry->b74 != 0) { + if (voice_entry->f88 == flying_car_moby && voice_entry->voice_state != 0) { release_voice_slot(flying_car_data->sound); } } @@ -262,8 +262,8 @@ void flying_car_update(struct Moby *flying_car_moby) { flying_car_data->f74 = 0; qcopy(&flying_car_moby->pos, &path->a); flying_car_moby->rot.z = fast_arc_tan(path->b.x - path->a.x, path->b.y - path->a.y); - flying_car_data->f80 = flying_car_data->f84 = flying_car_data->f88 = 0.0f; - flying_car_data->f90 = flying_car_data->f94 = flying_car_data->f98 = 0.0f; + flying_car_data->position_x_spring_state = flying_car_data->position_y_spring_state = flying_car_data->f88 = 0.0f; + flying_car_data->bank_spring_state = flying_car_data->pitch_spring_state = flying_car_data->yaw_spring_state = 0.0f; if (flying_car_data->part >= 0) { struct Moby *o = (struct Moby *)(D_L14_0015FFD8_macro + (flying_car_data->part << 8)); From 6405681c8c15cb6a3e496e5baf56d8c35b4956f2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:39:55 +0000 Subject: [PATCH 316/758] decomp: clarify names in update_hero_attachment i3C -> attachment_behavior_flags: In update_hero_attachment, the attached object at hero+0x360 is resolved by 0x002340e0 and its returned pointer retained in s8 at 0x002340e8. Retail 0x00234284..0x0023428c loads this int member and tests mask 4: set selects direct conversion of hero.pos into the saved position anchor (0x00234294..0x002342a8); clear probes first and converts the probed pose (0x002342b4..0x002342ec). Retail 0x002343ec..0x002343fc tests mask 2 on the same member: set copies saved attachment motion hero+0x350 unchanged (0x00234460..0x00234464); clear approaches its Z and XY magnitude toward zero before reconstructing motion (0x00234404..0x0023445c). The supplied C matches both plat->i3C uses, proving a bitmask controlling attachment behavior rather than an offset-only interpretation. --- src/overlays/shared/hero/set_hero_animation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index a8c4065fba..ee5f894699 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1431,7 +1431,7 @@ typedef struct Hero_234800 { typedef struct { char p0[0x3C]; - int i3C; + int attachment_behavior_flags; } Plat; extern char hero_233f80[] __asm__("D_0013F350"); @@ -1542,7 +1542,7 @@ void update_hero_attachment(void) { &((Hero_234800 *)hero_233f80)->v90, &((Hero_234800 *)hero_233f80)->v330, &probe_transform_scratch); - } else if (plat->i3C & 4) { + } else if (plat->attachment_behavior_flags & 4) { convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->pos, @@ -1590,7 +1590,7 @@ void update_hero_attachment(void) { if (amt != 0.0f) { sB4 = vector_length_xy(&((Hero_234800 *)hero_233f80)->v350); sB0 = ((Hero_234800 *)hero_233f80)->v350.z; - if (!(plat->i3C & 2)) { + if (!(plat->attachment_behavior_flags & 2)) { approach_value(&sB0, 0.0f, frame_time_sq_macro * 25.0f * amt); approach_value(&sB4, 0.0f, (frame_time_sq_macro + frame_time_sq_macro) * amt); set_vector_length_xy( From b231ebcbbab78ae6ce2bb48e44015e0e9e35eba7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:39:59 +0000 Subject: [PATCH 317/758] decomp: clarify names in select_moby_heading_by_collision_probes f48 -> current_heading: In select_moby_heading_by_collision_probes, retail 0x002bf75c loads moby+0x48 into f13 and 0x002bf760 compares it with selected heading f22 using the rotation-difference helper. When the difference exceeds 2.5132742 radians, 0x002bf788-0x002bf7a4 subtracts this stored angle from the selected heading and adds half that angular delta back to the stored angle. The authoritative C expresses the same rotation operations on moby->f48, proving this f32 member is the moby's current heading reference. --- src/overlays/shared/weapons/doom_bot_movement.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/doom_bot_movement.c b/src/overlays/shared/weapons/doom_bot_movement.c index acaeeb67dc..b24f794941 100644 --- a/src/overlays/shared/weapons/doom_bot_movement.c +++ b/src/overlays/shared/weapons/doom_bot_movement.c @@ -57,7 +57,7 @@ typedef struct { f32 f10; f32 f14; u8 pad18[0x30]; - f32 f48; + f32 current_heading; u8 pad4C[0x2C]; Ext *p78; } Mob; @@ -500,8 +500,8 @@ f32 select_moby_heading_by_collision_probes(Mob *moby, (horizontal_probe_distance * 3.0f)); } } - if (2.5132742f < fast_difference_between_rotations(best, moby->f48)) { - best = fast_add_rotations(moby->f48, fast_subtract_rotations(best, moby->f48) * 0.5f); + if (2.5132742f < fast_difference_between_rotations(best, moby->current_heading)) { + best = fast_add_rotations(moby->current_heading, fast_subtract_rotations(best, moby->current_heading) * 0.5f); } return best; } From cd3a61fd5e3377336c6893a6c8b72c5481033bc1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:42:11 +0000 Subject: [PATCH 318/758] decomp: clarify names in level01_cutscene_effects_update unkB -> initial_frame_count: In level01_cutscene_effects_update scene 4, retail 0030c57c-0030c598 compares the cutscene frame to scale_game_frames(1100), selects 6 or 30, and calls scale_game_frames. At 0030c5ac its result is stored in spark+0xA. Retail 0030c580 establishes spark_tail=spark+0x20; 0030c5c0 loads the low byte of that freshly assigned count and 0030c5c4 saves it at tail+0xB. The original decompilation explicitly shows *(undefined1 *)(iVar4+0x2b)=*(undefined1 *)(iVar4+10); authoritative C shows spark_tail->unkB=spark->unkA immediately after the frame-scaled assignments. Thus this u8 holds the initial frame count snapshot. Checked spawn helper 00282158-00282168 similarly initializes spark+0xA through scale_game_frames(10), corroborating frame-count origin without assuming downstream consumption. --- src/overlays/l01/mobys/cutscene_effects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/cutscene_effects.c b/src/overlays/l01/mobys/cutscene_effects.c index d44103eaa3..2ca141201f 100644 --- a/src/overlays/l01/mobys/cutscene_effects.c +++ b/src/overlays/l01/mobys/cutscene_effects.c @@ -32,7 +32,7 @@ typedef struct { s32 unk4; u8 pad8[2]; u8 unkA; - u8 unkB; + u8 initial_frame_count; } FxSparkTail; typedef struct { @@ -192,7 +192,7 @@ void level01_cutscene_effects_update(struct Moby *moby) { spark->unk9 = truncate_float_to_s32(4.0f) + 0x40; spark_tail->unk4 = 2; spark_tail->unkA = color >> 24; - spark_tail->unkB = spark->unkA; + spark_tail->initial_frame_count = spark->unkA; } } } From 57d46e045a41252658072a1335e2bae25228ff85 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:42:14 +0000 Subject: [PATCH 319/758] decomp: clarify names in agnogg_ship_front_update f52 -> animation_sequence: Assigned retail 002fb114-002fb11c reads moby+0x52 and requires sequence 1 after set_moby_animation(moby,1,0) at 002fb0e0-002fb0ec. Checked level-01 blend helper 0026c718-0026c728 reads this byte, saves its non-0xFF sequence to +0xA5, then writes 0xFF to mark blending; this matches the supplied blend_moby_animation C seq data flow. Thus f52 represents the current animation sequence, including its blend sentinel, rather than an offset-only field. f53 -> requested_animation_sequence: Assigned retail 002fae34-002fae5c and 002fb134-002fb158 compare moby+0x53 with 2 before calling blend_moby_animation(moby,2,0,frames). Checked level-01 helper 0026c680 preserves new_seq argument a1 in s3, uses it to select class sequence data at 0026c688-0026c6b0, and stores it to moby+0x53 at 0026c744. This proves f53 tracks the requested animation sequence; assigned 002fb0bc also tests it for sequence 0 before starting animation 1. --- src/overlays/l01/mobys/agnogg_ship_front.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l01/mobys/agnogg_ship_front.c b/src/overlays/l01/mobys/agnogg_ship_front.c index 2bd5ab29d2..b93ef31d54 100644 --- a/src/overlays/l01/mobys/agnogg_ship_front.c +++ b/src/overlays/l01/mobys/agnogg_ship_front.c @@ -93,8 +93,8 @@ typedef struct { /* 0x32 */ unsigned short f32; /* 0x34 */ unsigned short flags; /* 0x36 */ char pad36[0x1C]; - /* 0x52 */ unsigned char f52; - /* 0x53 */ unsigned char f53; + /* 0x52 */ unsigned char animation_sequence; + /* 0x53 */ unsigned char requested_animation_sequence; /* 0x54 */ char pad54[0x1C]; /* 0x70 */ unsigned char f70; /* 0x71 */ char pad71[7]; @@ -194,7 +194,7 @@ void agnogg_ship_front_update(Moby_2FC140 *moby) { level_table_byte = *(unsigned char *)(moby->fB0 + (current_level_index_macro << 4) + visited52); if (level_table_byte == 0xFF) { - if (moby->f53 != 2) { + if (moby->requested_animation_sequence != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(0x14)); } moby->state = AGNOGG_SHIP_HOLD_TARGET_HEIGHT; @@ -242,7 +242,7 @@ void agnogg_ship_front_update(Moby_2FC140 *moby) { fast_arc_tan(moby->pos.x - l01_cuboids_macro[linked_moby_data->rec].pos.x, moby->pos.y - l01_cuboids_macro[linked_moby_data->rec].pos.y); } - if (moby->f53 == 0) { + if (moby->requested_animation_sequence == 0) { if (moby->pos.z - data->fC <= 0.0f) { set_moby_animation(moby, 1, 0); } @@ -253,13 +253,13 @@ void agnogg_ship_front_update(Moby_2FC140 *moby) { } break; case AGNOGG_SHIP_WAIT_FOR_ANIMATION_1_GATE: - if (moby->f52 != 1) { + if (moby->animation_sequence != 1) { break; } if ((moby->f70 & 2) == 0) { break; } - if (moby->f53 != 2) { + if (moby->requested_animation_sequence != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(0x14)); } if (moby->oclass == 0x2DA) { From 25654dcd3bb63d5451dc198ea7a96150f1e610fe Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:42:18 +0000 Subject: [PATCH 320/758] decomp: clarify names in elevator_update i138 -> idle_glow_phase: Bound source src/overlays/l14/mobys/elevator.c SHA-256 584ba2854d3eb30a19bfa76e99774627a35f998dbf6661c476d2c26cc16aa3a9 declares L14VendorVars.i138 and clears it during initialization; original retail decompilation and 0x002eeac8 confirm sw zero,0x138(s1). The assigned update calls update_elevator_idle_glow at 0x002eeacc, 0x002eee28 and 0x002eeec4. Checked level-14 helper instructions 0x002ef788-0x002ef79c load that same pvars+0x138 as float, combine it with frame_time*6.2831855f via the source's fast_add_rotations, store the advanced angle back and pass it to the source's fast_sin. At 0x002ef7a0-0x002ef81c its sine output is scaled, converted, clamped, packed into RGB and tweened into moby glow_color. Thus the member stores the idle glow's angular phase, rather than brightness or a counter. --- src/overlays/l14/mobys/elevator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/elevator.c b/src/overlays/l14/mobys/elevator.c index 8173775862..9454b579b6 100644 --- a/src/overlays/l14/mobys/elevator.c +++ b/src/overlays/l14/mobys/elevator.c @@ -73,7 +73,7 @@ typedef struct { s32 motor; /* 0x12C */ s32 motor_volume; /* 0x130 */ s32 hum_volume; /* 0x134 */ - s32 i138; /* 0x138 */ + s32 idle_glow_phase; /* 0x138 */ } L14VendorVars; void elevator_update(struct Moby *m) __asm__("FUN_L14_002ee8d8"); @@ -123,7 +123,7 @@ void elevator_update(struct Moby *elevator_moby) { elevator_vars->motor = -1; elevator_vars->motor_volume = -1; elevator_vars->hum_volume = -1; - elevator_vars->i138 = 0; + elevator_vars->idle_glow_phase = 0; break; } case ELEVATOR_STATE_WAIT_FOR_RIDER: From f545398042bfb5fbf51f7a7d71c7537daf37af97 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:44:17 +0000 Subject: [PATCH 321/758] decomp: clarify names in update_kerwan_path_enemy_hit_reaction f4C -> target_horizontal_speed: Jump2C8398 q begins at moby_data+0x70. Original retail death branch stores 2*frame_time to data+0xbc at 0x002c9bd0-0x002c9c04, matching q.f4C in authoritative C. Initialization sets q.f4C=0. In owner ENEMY_FALL_UNDER_GRAVITY, vector_length_xy(q) supplies current speed, q.f4C supplies want unless s3E==2, approach_value(&speed,want,q.f14) approaches that target, and set_vector_length_xy(q,q,speed) applies it. Thus it is target horizontal speed, not a position or vertical launch speed. i24 -> knockback_flags: Assigned retail stores 9 to data+0x94 (q+0x24) at 0x002c9800, 0x002c9964, 0x002c9a74 and 0x002c9b90 before trooper_start_knockback with q=data+0x70. Checked level-03 helper 0x0024afa0 keeps q in s0; 0x0024b050/0x0024b06c load q+0x24, 0x0024b070-0x0024b074 OR in flag 0x20, and 0x0024b080 masks bit 0x2 to select alternate animation calls at 0x0024b098 versus 0x0024b0b0. These bitwise operations establish a knockback flag mask rather than an integer count or selector. --- src/overlays/l03/mobys/kerwan_path_enemy.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l03/mobys/kerwan_path_enemy.c b/src/overlays/l03/mobys/kerwan_path_enemy.c index 2a8d411c3c..2f6b3d3390 100644 --- a/src/overlays/l03/mobys/kerwan_path_enemy.c +++ b/src/overlays/l03/mobys/kerwan_path_enemy.c @@ -134,13 +134,13 @@ typedef struct { float f18; float f1C; int i20; - int i24; + int knockback_flags; float f28; char p2C[0x11]; unsigned char b3D; short s3E; char p40[0xC]; - float f4C; + float target_horizontal_speed; float f50; float f54; char p58[8]; @@ -469,7 +469,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { moby_data->f30 = 1.75f; moby_data->q.f28 = 0.7f; moby_data->q.i20 = truncate_float_to_s32(716.8f); - moby_data->q.f4C = 0.0f; + moby_data->q.target_horizontal_speed = 0.0f; moby_data->b58 = 0xA; moby_data->b5A = 0xC; clear_u64_value(moby_data->v40); @@ -1047,7 +1047,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { speed = vector_length_xy(q); want = 0.0f; if (q->s3E != 2) { - want = q->f4C; + want = q->target_horizontal_speed; } approach_value(&speed, want, q->f14); set_vector_length_xy(q, q, speed); @@ -1550,7 +1550,7 @@ void update_kerwan_path_enemy_hit_reaction(Moby2C8398 *moby) { (2.0f * JUMP_SPEED(D_L03_001618E0, 80.0f) / (frame_time_sq * 80.0f))) * 0.5f; moby_data->q.f1C = JUMP_SPEED(D_L03_001618E0, 80.0f); - moby_data->q.i24 = 9; + moby_data->q.knockback_flags = 9; moby_data->q.b3D = 0; *(OvlQuad *)hit_knockback_vector = *(OvlQuad *)(hit + 0x10); trooper_knockback_arc( @@ -1578,7 +1578,7 @@ void update_kerwan_path_enemy_hit_reaction(Moby2C8398 *moby) { kerwan_path_enemy_knockback_horizontal_deceleration * frame_time_sq * 0.5f * (2.0f * JUMP_SPEED(D_L03_001618E0, 80.0f) / (frame_time_sq * 80.0f)); moby_data->q.f1C = JUMP_SPEED(D_L03_001618E0, 80.0f); - moby_data->q.i24 = 9; + moby_data->q.knockback_flags = 9; moby_data->q.b3D = 0; *(OvlQuad *)hit_knockback_vector = *(OvlQuad *)(hit + 0x10); trooper_knockback_arc( @@ -1601,7 +1601,7 @@ void update_kerwan_path_enemy_hit_reaction(Moby2C8398 *moby) { kerwan_path_enemy_knockback_horizontal_deceleration * frame_time_sq * 0.5f * (2.0f * JUMP_SPEED(D_L03_001618E0, 80.0f) / (frame_time_sq * 80.0f)); moby_data->q.f1C = JUMP_SPEED(D_L03_001618E0, 80.0f); - moby_data->q.i24 = 9; + moby_data->q.knockback_flags = 9; moby_data->q.b3D = 0; *(OvlQuad *)hit_knockback_vector = *(OvlQuad *)(hit + 0x10); trooper_knockback_arc( @@ -1621,7 +1621,7 @@ void update_kerwan_path_enemy_hit_reaction(Moby2C8398 *moby) { kerwan_path_enemy_knockback_horizontal_deceleration * frame_time_sq * 0.5f * (2.0f * JUMP_SPEED(2.0f, 40.0f) / (frame_time_sq * 40.0f)); moby_data->q.f1C = JUMP_SPEED(2.0f, 40.0f); - moby_data->q.i24 = 9; + moby_data->q.knockback_flags = 9; moby_data->q.b3D = 0; *(OvlQuad *)hit_knockback_vector = *(OvlQuad *)(hit + 0x10); trooper_knockback_arc( @@ -1629,7 +1629,7 @@ void update_kerwan_path_enemy_hit_reaction(Moby2C8398 *moby) { trooper_start_knockback(angle, moby, (char *)moby_data + 0x70, 7, 5, 2); moby_data->q.f50 = 10.0f; moby_data->q.f54 = 20.0f; - moby_data->q.f4C = 2.0f * frame_time; + moby_data->q.target_horizontal_speed = 2.0f * frame_time; moby_data->b255 = 0; moby->flags &= 0xEFFF; moby_data->b67 = 0xFA; From ff10c81df2fc4deb9aa46dea09b1bb65ebd3cb39 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:44:20 +0000 Subject: [PATCH 322/758] decomp: clarify names in rocket_strike_fighter_update f74 -> position_y_spring_velocity: Authoritative source SHA-256 0a3d745d610e90fedffcdbe7b318b956a487172312e2e4fc6986976ff7de0689 passes pvars+0x74 as float *v to FUN_L00_0025b8c0 with &moby->pos.y, path_target_position[1], and flight spring strength/damping. Checked retail helper 0x002fda40-0x002fda58 pairs a0=moby+0x14 with a1=pvars+0x74 and target stack+4. Assigned update 0x002fd284 zeroes this velocity on respawn, agreeing with original retail decompilation. f78 -> position_z_spring_velocity: Authoritative C passes pvars+0x78 as float *v to FUN_L00_0025b8c0 alongside &moby->pos.z and path_target_position[2], with flight spring strength/damping. Checked retail 0x002fda5c-0x002fda74 pairs a0=moby+0x18 with a1=pvars+0x78 and target stack+8. Assigned update 0x002fd280 resets it to zero at respawn; original retail decompilation confirms the reset. f80 -> rotation_x_spring_velocity: Authoritative C passes pvars+0x80 as float *v to FUN_L00_0025b8c0 for &moby->rot.x, targeting clamped yaw_error_factor times rocket_strike_fighter_bank_angle_scale_gp. Checked retail 0x002fdb24-0x002fdb84 clamps the yaw error, multiplies the bank scale, then pairs a0=moby+0x40 with a1=pvars+0x80 in the spring call. Assigned retail 0x002fd27c zeroes it on respawn, as the original decompilation shows. f84 -> rotation_y_spring_velocity: Authoritative C passes pvars+0x84 as float *v to FUN_L00_0025b8c0 for &moby->rot.y, targeting negative atan of horizontal path delta length and vertical delta with flight spring strength/damping. Checked retail 0x002fdaf4-0x002fdb20 computes that target and pairs a0=moby+0x44 with a1=pvars+0x84. Assigned update 0x002fd290 clears this spring velocity on respawn, matching original retail decompilation. f88 -> rotation_z_spring_velocity: Authoritative C passes pvars+0x88 as float *vel to FUN_L00_00258278 with the updated moby, target yaw derived from path_position_delta X/Y, and flight spring strength/damping. Checked retail 0x002fdabc-0x002fdaf0 derives yaw, reads current moby rotation Z at +0x48, and calls the rotation spring with a1=pvars+0x88. Assigned update 0x002fd28c zeroes it on respawn, agreeing with the original decompilation. --- src/overlays/l14/mobys/rocket_strike_fighter.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l14/mobys/rocket_strike_fighter.c b/src/overlays/l14/mobys/rocket_strike_fighter.c index 71339c7035..160fb3a13f 100644 --- a/src/overlays/l14/mobys/rocket_strike_fighter.c +++ b/src/overlays/l14/mobys/rocket_strike_fighter.c @@ -74,12 +74,12 @@ typedef struct { s32 path; /* 0x68 */ s32 sound; /* 0x6C */ f32 f70; /* 0x70 */ - f32 f74; /* 0x74 */ - f32 f78; /* 0x78 */ + f32 position_y_spring_velocity; /* 0x74 */ + f32 position_z_spring_velocity; /* 0x78 */ s32 timer; /* 0x7C */ - f32 f80; /* 0x80 */ - f32 f84; /* 0x84 */ - f32 f88; /* 0x88 */ + f32 rotation_x_spring_velocity; /* 0x80 */ + f32 rotation_y_spring_velocity; /* 0x84 */ + f32 rotation_z_spring_velocity; /* 0x88 */ s32 rocket; /* 0x8C: its class 922 rocket */ s32 flythrough; /* 0x90: the flythrough camera descriptor it starts */ s32 stage; /* 0x94 */ @@ -245,8 +245,8 @@ void rocket_strike_fighter_update(struct Moby *moby) { qcopy(&moby->pos, path + 0x10); moby->rot.z = fast_arc_tan(*(float *)(path + 0x20) - *(float *)(path + 0x10), *(float *)(path + 0x24) - *(float *)(path + 0x14)); - moby_vars->f80 = moby_vars->f84 = moby_vars->f88 = moby_vars->f70 = moby_vars->f74 = - moby_vars->f78 = 0.0f; + moby_vars->rotation_x_spring_velocity = moby_vars->rotation_y_spring_velocity = moby_vars->rotation_z_spring_velocity = moby_vars->f70 = moby_vars->position_y_spring_velocity = + moby_vars->position_z_spring_velocity = 0.0f; } break; } From df4f824fca350a973a9e740a3b412201d96072de Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:44:23 +0000 Subject: [PATCH 323/758] decomp: clarify names in update_slot_panes_and_effects f16 -> beam_endpoint_tag: In authoritative C, PartSub belongs to the spark returned by spawn_mode_controlled_rotating_alpha_fade_particle. Retail 0x002e27ec creates the origin-offset spark; 0x002e2810 selects its +0x20 subrecord, and 0x002e2850-0x002e2858 stores tag 1 at subrecord+0x16 only when beam_endpoint_spark_tag_mode[beam] (0x00161c68 + beam*4) equals 1. Retail 0x002e28cc creates the spark at tip; 0x002e28ec selects its subrecord and 0x002e2934-0x002e2940 applies the same gate and stores tag 2. Original Ghidra likewise shows particle+0x36 receiving 1 versus 2 in these respective endpoint paths. These paired position-dependent writes prove a beam endpoint tag rather than semantics inferred from offset alone. --- src/overlays/shared/rendering/effects/beam_slots.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/rendering/effects/beam_slots.c b/src/overlays/shared/rendering/effects/beam_slots.c index fba72101cb..b66d1cd580 100644 --- a/src/overlays/shared/rendering/effects/beam_slots.c +++ b/src/overlays/shared/rendering/effects/beam_slots.c @@ -111,7 +111,7 @@ typedef struct { char pad0[0x10]; float f10; short f14; - short f16; + short beam_endpoint_tag; int f18; } PartSub; @@ -445,7 +445,7 @@ void update_slot_panes_and_effects(int unused, int beam) { sub->f10 = one / func_001FA888_2E3700(spark->fA); sub->f18 = 0x7F7F7F; if (beam_endpoint_spark_tag_mode[beam] == 1) - sub->f16 = 1; + sub->beam_endpoint_tag = 1; } } random_float_between(0.01f, 0.05f); @@ -464,7 +464,7 @@ void update_slot_panes_and_effects(int unused, int beam) { sub->f10 = 1.0f / func_001FA888_2E3700(spark->fA); sub->f18 = 0x7F7F7F; if (beam_endpoint_spark_tag_mode[beam] == 1) - sub->f16 = 2; + sub->beam_endpoint_tag = 2; } } } From 5e1a835602dc857a1df5519714a6a48721c5ac10 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:44:27 +0000 Subject: [PATCH 324/758] decomp: clarify names in process_moby_attachment_damage f100 -> tractor_beam_timer_frames: Retail 002ea210-002ea218 stores scale_game_frames(0x78) at data+0x100 on the damage-stage transition. The authoritative update_qwarks_starfighter_attack_commands decrements +0x100 with fast_dec_timer, requires zero before entering state 5 (tractor beam), sets scaled 0x258 on entry, and leaves that state when it expires. The tractor-beam update clears the same timer on obstructed, offscreen or excessive-distance aborts, proving its frame timer role. f15F0 -> piloted_ship_moby: Retail 002ea014-002ea024 and 002ea0f4-002ea10c load hero+0x15F0, then its moby vars at +0x78 to clear ship state on damage-stage transitions. The authoritative source corroborates identity through calculate_hero_aim_angles using hero->ship_moby, and predict_hero_ship_projectile_lead_position using hero+0x15F0 for ship position, rotation and movement variables. This is the hero's piloted ship moby pointer. f2C -> damage_amount: Retail 002e9c08-002e9c60 and 002e9f68-002e9fbc load hit+0x2C, compare it with shared health at data+0x20 for lethal response, otherwise subtract it from that health. Original Ghidra and C agree. Retail 002e9f14-002e9f38 replaces or halves this float for the two child-hit selectors, proving an applied damage amount. i11C -> tractor_beam_voice_slot_index: Retail 002e9d40-002e9d80 and 002ea0a8-002ea0e8 read data+0x11C, reject -1, index 0x70-byte voice entries, verify owner at +0x88 and activity at +0x74, release the voice and reset to -1. In the authoritative qwarks_starfighter_update tractor-beam state, the same +0x11C storage (snd11C) receives allocate_voice_for_target_entry(4,4,moby), proving the tractor-beam voice-slot index. --- src/overlays/l13/mobys/qwarks_starfighter.c | 56 ++++++++++----------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index 55c32d24a3..5e87ae1405 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -680,9 +680,9 @@ typedef struct { Moby_2EAE80 *list[11]; Moby_2EAE80 *first; char padF4[0xC]; - int f100; + int tractor_beam_timer_frames; char pad104[0x18]; - int i11C; + int tractor_beam_voice_slot_index; char pad120[0x18]; unsigned short h138; char pad13A[0xE]; @@ -694,7 +694,7 @@ typedef struct { Moby_2EAE80 *target; char pad24[6]; unsigned short h2A; - float f2C; + float damage_amount; } Hit_2EAE80; typedef struct { @@ -706,7 +706,7 @@ typedef struct { typedef struct { char pad0[0x15F0]; - Moby_2EAE80 *f15F0; + Moby_2EAE80 *piloted_ship_moby; } Hero_2EAE80; extern void begin_starfighter_death_sequence(); @@ -771,18 +771,18 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { r->target->oclass == 0xD4)) { moby_data->first->bA4 = 0xFF; } else if (hit >= 2) { - if (0.0f < r->f2C && r->h2A == 0x3F1) { - r->f2C = 0.3f; + if (0.0f < r->damage_amount && r->h2A == 0x3F1) { + r->damage_amount = 0.3f; } if (r != 0 && moby->bBC == 7) { - r->f2C = r->f2C * 1.5f; + r->damage_amount = r->damage_amount * 1.5f; } - if (dd->health <= r->f2C) { + if (dd->health <= r->damage_amount) { func_L13_002EAC18_2EAE80(moby, moby_data, dd, r); mode = ATTACHMENT_DAMAGE_LETHAL; moby_data->first->bA4 = 0xFF; } else { - dd->health = dd->health - r->f2C; + dd->health = dd->health - r->damage_amount; moby_data->b67 = 0xFA; mode = ATTACHMENT_DAMAGE_APPLIED; moby_data->sub.h6 = scale_game_frames(0); @@ -811,12 +811,12 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { moby->state = STARFIGHTER_STATE_FOLLOW_COMMAND_PATH_WITH_TIMED_VOLLEY; } moby->bBC++; - if (moby_data->i11C != -1) { - if (((Voice *)(D_0013E550 + moby_data->i11C * 0x70))->f88 == moby && - ((Voice *)(D_0013E550 + moby_data->i11C * 0x70))->b74 != 0) { - release_voice_slot(moby_data->i11C); + if (moby_data->tractor_beam_voice_slot_index != -1) { + if (((Voice *)(D_0013E550 + moby_data->tractor_beam_voice_slot_index * 0x70))->f88 == moby && + ((Voice *)(D_0013E550 + moby_data->tractor_beam_voice_slot_index * 0x70))->b74 != 0) { + release_voice_slot(moby_data->tractor_beam_voice_slot_index); } - moby_data->i11C = -1; + moby_data->tractor_beam_voice_slot_index = -1; } rf = 1; { @@ -859,25 +859,25 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { if (hit < 2) { continue; } - if (0.0f < r->f2C) { + if (0.0f < r->damage_amount) { switch (r->h2A) { case CHILD_HIT_FIXED_DAMAGE: - r->f2C = 0.1f; + r->damage_amount = 0.1f; break; case CHILD_HIT_HALF_DAMAGE: - r->f2C = r->f2C * 0.5f; + r->damage_amount = r->damage_amount * 0.5f; break; } } if (r != 0 && moby->bBC == 7) { - r->f2C = r->f2C * 1.5f; + r->damage_amount = r->damage_amount * 1.5f; } - if (dd->health <= r->f2C) { + if (dd->health <= r->damage_amount) { func_L13_002EAC18_2EAE80(moby, moby_data, dd, r); mode = ATTACHMENT_DAMAGE_LETHAL; moby_data->list[i]->bA4 = 0xFF; } else { - dd->health = dd->health - r->f2C; + dd->health = dd->health - r->damage_amount; moby_data->b67 = 0xFA; mode = ATTACHMENT_DAMAGE_APPLIED; moby_data->sub.h6 = scale_game_frames(0); @@ -888,7 +888,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { moby->bBC++; rf = 1; { - Vars_2EAE80 *v = ((Hero_2EAE80 *)&hero)->f15F0->vars; + Vars_2EAE80 *v = ((Hero_2EAE80 *)&hero)->piloted_ship_moby->vars; v->f88 = 0; v->fEC = 0; @@ -906,16 +906,16 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { moby->state = STARFIGHTER_STATE_FOLLOW_COMMAND_PATH_WITH_TIMED_VOLLEY; } moby->bBC++; - if (moby_data->i11C != -1) { - if (((Voice *)(D_0013E550 + moby_data->i11C * 0x70))->f88 == moby && - ((Voice *)(D_0013E550 + moby_data->i11C * 0x70))->b74 != 0) { - release_voice_slot(moby_data->i11C); + if (moby_data->tractor_beam_voice_slot_index != -1) { + if (((Voice *)(D_0013E550 + moby_data->tractor_beam_voice_slot_index * 0x70))->f88 == moby && + ((Voice *)(D_0013E550 + moby_data->tractor_beam_voice_slot_index * 0x70))->b74 != 0) { + release_voice_slot(moby_data->tractor_beam_voice_slot_index); } - moby_data->i11C = -1; + moby_data->tractor_beam_voice_slot_index = -1; } rf = 1; { - Vars_2EAE80 *v = ((Hero_2EAE80 *)&hero)->f15F0->vars; + Vars_2EAE80 *v = ((Hero_2EAE80 *)&hero)->piloted_ship_moby->vars; v->f88 = 0; v->fEC = 0; @@ -945,7 +945,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { func_L13_002E9B30_2EAE80(moby, moby_data, 0xC, 4); break; case DAMAGE_STAGE_START_TIMER_AND_QUEUE_LINE: - moby_data->f100 = scale_game_frames(0x78); + moby_data->tractor_beam_timer_frames = scale_game_frames(0x78); func_L13_002E9B30_2EAE80(moby, moby_data, 0x10, 1); break; case DAMAGE_STAGE_QUEUE_SINGLE_LINE: From 941e25e968cee3c94335543a7b488b6f6a45068d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:46:49 +0000 Subject: [PATCH 325/758] decomp: clarify names in mine_layer_update unk110 -> patrol_turn_damping_factor: Assigned initialization 0x002c9fd8/0x002ca00c stores frame_time_sq * 18.849556 at pvars+0x110, matching authoritative C. Assigned patrol call 0x002ca1bc-0x002ca1d4 passes pvars+0xd0 to 0x00247c10. Checked helper retains that walk pointer in s0 (0x00247c34) and loads +0x40 into f14 at 0x00247c8c before spring-turn call 0x00247ca0. Checked spring helper 0x00246de8 retains f14 in f22 (0x00246e0c), multiplies it by existing turn step f3 at 0x00246e80, subtracts that product from spring input at 0x00246e88, then adds the previous step at 0x00246e8c. Thus this field damps the patrol turning step; it is not inferred from its offset or constant alone. unk114 -> patrol_turn_step_limit: Assigned initialization 0x002c9fd4/0x002ca004 stores frame_time * 6.2831855 at pvars+0x114, matching authoritative C. Patrol passes walk=pvars+0xd0 to checked helper 0x00247c10 at 0x002ca1bc-0x002ca1d4; helper loads walk+0x44 into f15 at 0x00247c90 before spring-turn call 0x00247ca0. Checked spring helper retains f15 in f20 (0x00246e18); if nonzero, 0x00246e98-0x00246ebc clamps the newly calculated turn step to positive f20 or negative f20. The resulting step is added to moby heading and stored at 0x00246f20-0x00246f28, establishing a patrol turn-step magnitude limit. --- src/overlays/l03/mobys/mine_layer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l03/mobys/mine_layer.c b/src/overlays/l03/mobys/mine_layer.c index e099e9f6ff..6e97f5e5c7 100644 --- a/src/overlays/l03/mobys/mine_layer.c +++ b/src/overlays/l03/mobys/mine_layer.c @@ -71,8 +71,8 @@ typedef struct { f32 unkF4; u8 padF8[0x14]; f32 unk10C; - f32 unk110; - f32 unk114; + f32 patrol_turn_damping_factor; + f32 patrol_turn_step_limit; u8 pad118[8]; TrooperPatrol patrol; /* 0x120 */ u8 pad138[0x18]; @@ -161,8 +161,8 @@ void mine_layer_update(struct Moby *mine_layer_moby) { case MINE_LAYER_INITIALIZE: FUN_L01_0026d930(mine_layer_vars->walk); mine_layer_vars->unk10C = frame_time_sq * 6.2831855f; - mine_layer_vars->unk114 = frame_time * 6.2831855f; - mine_layer_vars->unk110 = frame_time_sq * 18.849556f; + mine_layer_vars->patrol_turn_step_limit = frame_time * 6.2831855f; + mine_layer_vars->patrol_turn_damping_factor = frame_time_sq * 18.849556f; mine_layer_vars->unkF4 = frame_time * 5.0f; mine_layer_vars->unk58 = 8; mine_layer_vars->unk5A = 8; From 6b11ab55819288ef61451267e8a297d44424d50c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:50:20 +0000 Subject: [PATCH 326/758] decomp: clarify names in follow_camera_apply_overrides i2000 -> hero_moby: Retail 0x002e63d8-0x002e63f4 sets a0=0x0013F3D0 and loads a2 from +0x2000 (0x001413D0) for collect_mobies_in_sphere. The authoritative C declares hero at 0x0013F350, and its supplied Hero_2E8210/G_2e7d20 views identify +0x2080, the same address, as the hero moby; follow_camera_setup copies that value into the followed-moby slot, while follow_camera_avoid_mobies passes the explicitly named hero_moby to the same sphere helper. This member is the hero-moby reference used by the scan, despite preserved s32 storage. i260 -> angle_blend_ramp_frames: Retail 0x002e6328-0x002e6358 clears camera-state +0x260 when either absolute analog input is at least 0.3. At 0x002e6368-0x002e6390 this s32 increments once per invocation and saturates at scale_game_frames(400); 0x002e6394-0x002e63d0 converts it to float, divides by that scaled frame duration, and multiplies by 0.20943952 for set_follow_camera_angle_blend_from_position. Authoritative x->i260 operations agree, proving a frame ramp for this target angle blend. p25C -> angle_blend_target: Retail 0x002e62e8-0x002e6314 checks camera-state +0x25C for null and clears it if its pointed-to signed byte +0x20 is negative. At 0x002e63c0-0x002e63cc the pointer is reloaded, advanced by 0x10 and supplied as the position input to set_follow_camera_angle_blend_from_position with the frame-ramped blend amount. Authoritative player_camera_state->p25C and x->p25C uses agree, proving this is the target supplying the camera angle-blend position. --- .../shared/camera/follow_camera_setup.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 81c866975c..29431252ff 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -209,14 +209,14 @@ typedef struct { u8 pad0[0x10]; void (*fn)(void); u8 pad1[0x25C - 0x14]; - u8 *p25C; - s32 i260; + u8 *angle_blend_target; + s32 angle_blend_ramp_frames; u8 pad2[0x380 - 0x264]; } A_2e6000; typedef struct { u8 pad[0x2000]; - s32 i2000; + s32 hero_moby; } L_2e6000; #include "rnc/overlay/shared/camera/level_camera.h" @@ -327,27 +327,27 @@ void follow_camera_apply_overrides(O_2e6000 *camera_moby) { if (x->fn != 0) x->fn(); player_camera_state = (A_2e6000 *)&l00_camera; - if (player_camera_state->p25C != 0 && camera_override_state->i10 < 2) { - if ((s8)player_camera_state->p25C[0x20] < 0) { - player_camera_state->p25C = 0; + if (player_camera_state->angle_blend_target != 0 && camera_override_state->i10 < 2) { + if ((s8)player_camera_state->angle_blend_target[0x20] < 0) { + player_camera_state->angle_blend_target = 0; } else { if (0.3f <= absolute_float(controller_state.analog[0]) || 0.3f <= absolute_float(controller_state.analog[1])) { - player_camera_state->i260 = 0; + player_camera_state->angle_blend_ramp_frames = 0; } x = (A_2e6000 *)&l00_camera; - x->i260++; - if (scale_game_frames(400) < x->i260) - x->i260 = scale_game_frames(400); - rotation_or_blend_value = convert_integer_to_float(x->i260) / + x->angle_blend_ramp_frames++; + if (scale_game_frames(400) < x->angle_blend_ramp_frames) + x->angle_blend_ramp_frames = scale_game_frames(400); + rotation_or_blend_value = convert_integer_to_float(x->angle_blend_ramp_frames) / convert_integer_to_float(scale_game_frames(400)); set_follow_camera_angle_blend_from_position( - x->p25C + 0x10, rotation_or_blend_value * 0.20943952f, 0.0f); + x->angle_blend_target + 0x10, rotation_or_blend_value * 0.20943952f, 0.0f); } } camera_override_state->i10 = 0; nearby_moby_count = - collect_mobies_in_sphere(&D_0013F3D0_2e6000, 1, D_0013F3D0_2e6000.i2000, 0, 15.0f); + collect_mobies_in_sphere(&D_0013F3D0_2e6000, 1, D_0013F3D0_2e6000.hero_moby, 0, 15.0f); if (nearby_moby_count > 0) { lp = D_L00_00177F00; for (i = 0; i < nearby_moby_count; lp++, i++) { From 2e74f9cb3c8246641a89fc38f101974fc89a2ac1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:52:24 +0000 Subject: [PATCH 327/758] decomp: clarify names in update_hero_pitch_and_yaw_easing_targets f1004 -> idle_pitch_target_radians: Retail 0x0020a7c8-0x0020a7f0 stores a negated random angular sample at hero +0x1004; 0x0020a910-0x0020a93c clamps it to 0..0.2617994 for sequences 1/2. At 0x0020a974/0x0020a984 it becomes hero_eases[3].rot_target.f[1], the same pitch component written by atan2-derived pitch in checked sibling 0x0020ac98 (0x0020b170). f1008 -> idle_yaw_target_radians: Retail 0x0020a7ec-0x0020a804 stores the signed random angular sample at hero +0x1008, later clamped to +/-0.34906584 at 0x0020a8b8-0x0020a8fc. Loads/stores 0x0020a97c/0x0020a98c copy it to hero_eases[3].rot_target.f[2]; checked tracking sibling 0x0020afe4-0x0020b17c uses this component for relative yaw. f1014 -> idle_rotation_easing_acceleration: Retail 0x0020a824/0x0020a84c stores the interpolation of 0.015 and 0.007 at hero +0x1014; 0x0020a948/0x0020a94c loads it as f12 for set_fourth_hero_easing_parameters. Checked helper 0x0020a228 stores f12 at hero_eases+0x2b4, record 3's accel member, consumed as acceleration by update_hero_easing_record in the authoritative C. f1018 -> idle_rotation_easing_max_speed: Retail 0x0020a848-0x0020a850 stores the interpolation of 0.29 and 0.3 at hero +0x1018; 0x0020a950 loads it into f13 for set_fourth_hero_easing_parameters at 0x0020a94c. Checked helper 0x0020a230 stores f13 at hero_eases+0x2b8, record 3's max_speed member, used by the spring update in the authoritative C. i1010 -> idle_rotation_target_delay_frames: Retail 0x0020a77c-0x0020a79c stores a random scaled 40..70 frame countdown at hero +0x1010; 0x0020a7a0/0x0020a7a4 passes its address to fast_dec_timer, whose nonzero return gates refreshing pitch/yaw samples. 0x0020a854-0x0020a89c reloads the countdown with scaled 90..200 frames plus up to scaled 80 frames. i1184 -> slot_three_secondary_moby: Retail 0x0020a574-0x0020a588 tests hero +0x1184, absolute 0x001404d4, before scaling hero_eases[18]. The authoritative C explicitly binds that same absolute symbol D_001404D4 to hero_slot_three_secondary_moby; get_hero_easing_moby_by_kind returns its first word for HERO_EASE_KIND_SLOT_THREE_SECONDARY_MOBY. This semantic symbol/use establishes the slot and secondary-moby role beyond the offset. p2274 -> tracked_target_moby: Assigned retail 0x0020a750-0x0020a764 skips random rotation when hero +0x2274 is nonzero. Checked sibling update_hero_target_tracking scans active_mobies at 0x0020ad58-0x0020aed8, retains the selected moby in s6 and stores it to +0x2274 at 0x0020aee0; 0x0020af10-0x0020af20 reads its position at +0x10 for visibility/aim calculations, matching the supplied C selected target flow. --- src/overlays/shared/hero/hero_idle_sequence.c | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 9a759cd52a..1131db2893 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -2855,19 +2855,19 @@ typedef struct { f32 f25c; s32 i260; char p264[0x1004 - 0x264]; - f32 f1004; - f32 f1008; + f32 idle_pitch_target_radians; + f32 idle_yaw_target_radians; char p100c[4]; - s32 i1010; - f32 f1014; - f32 f1018; + s32 idle_rotation_target_delay_frames; + f32 idle_rotation_easing_acceleration; + f32 idle_rotation_easing_max_speed; char p101c[0x1184 - 0x101C]; - s32 i1184; + s32 slot_three_secondary_moby; char p1188[0x2080 - 0x1188]; void *p2080; s32 i2084; char p2088[0x2274 - 0x2088]; - void *p2274; + void *tracked_target_moby; } G_a540; extern G_a540 D_0013F350_a540 __asm__("D_0013F350"); @@ -2887,7 +2887,7 @@ void update_hero_pitch_and_yaw_easing_targets(void) { s32 hero_animation_sequence_index; s32 min_delay_frames; - if (D_0015EDB3 != 0 && G.i1184 != 0) { + if (D_0015EDB3 != 0 && G.slot_three_secondary_moby != 0) { hero_eases[18].scale = D_0015EE18; } hero_eases[17].scale = D_0015EE14; @@ -2913,35 +2913,35 @@ void update_hero_pitch_and_yaw_easing_targets(void) { hero_animation_sequence_index = *(u8 *)((char *)G.p2080 + 0x53); if ((u8)hero_animation_sequence_index >= 3 && (u8)hero_animation_sequence_index != 0x3A) return; - if (G.p2274 != 0) + if (G.tracked_target_moby != 0) return; if ((u32)(hero_animation_sequence_index - 1) < 2) { min_delay_frames = scale_game_frames(40); - G.i1010 = random_int_between(min_delay_frames, scale_game_frames(70)); + G.idle_rotation_target_delay_frames = random_int_between(min_delay_frames, scale_game_frames(70)); } - if (fast_dec_timer(&G.i1010) != 0) { - G.f1004 = -random_float_between(-0.15707964f, 0.43633232f); - G.f1008 = randf_sym(0.34906584f, 0.99483764f); + if (fast_dec_timer(&G.idle_rotation_target_delay_frames) != 0) { + G.idle_pitch_target_radians = -random_float_between(-0.15707964f, 0.43633232f); + G.idle_yaw_target_radians = randf_sym(0.34906584f, 0.99483764f); random_blend_factor = random_float_between(0.0f, 1.0f); - G.f1014 = interpolate_scalar_linear(0.015f, 0.007f, random_blend_factor); - G.f1018 = interpolate_scalar_linear(0.29f, 0.3f, random_blend_factor); + G.idle_rotation_easing_acceleration = interpolate_scalar_linear(0.015f, 0.007f, random_blend_factor); + G.idle_rotation_easing_max_speed = interpolate_scalar_linear(0.29f, 0.3f, random_blend_factor); min_delay_frames = scale_game_frames(90); - G.i1010 = random_int_between(min_delay_frames, scale_game_frames(200)); - G.i1010 += truncate_float_to_s32((f32)scale_game_frames(80) * random_blend_factor); + G.idle_rotation_target_delay_frames = random_int_between(min_delay_frames, scale_game_frames(200)); + G.idle_rotation_target_delay_frames += truncate_float_to_s32((f32)scale_game_frames(80) * random_blend_factor); } if ((u32) * (u8 *)((char *)G.p2080 + 0x53) - 1 < 2) { - if (0.34906584f < G.f1008) - G.f1008 = 0.34906584f; - else if (G.f1008 < -0.34906584f) - G.f1008 = -0.34906584f; - if (0.2617994f < G.f1004) - G.f1004 = 0.2617994f; - if (G.f1004 < 0.0f) - G.f1004 = 0.0f; - } - set_fourth_hero_easing_parameters(G.f1014, G.f1018); - hero_eases[3].rot_target.f[2] = G.f1008; - hero_eases[3].rot_target.f[1] = G.f1004; + if (0.34906584f < G.idle_yaw_target_radians) + G.idle_yaw_target_radians = 0.34906584f; + else if (G.idle_yaw_target_radians < -0.34906584f) + G.idle_yaw_target_radians = -0.34906584f; + if (0.2617994f < G.idle_pitch_target_radians) + G.idle_pitch_target_radians = 0.2617994f; + if (G.idle_pitch_target_radians < 0.0f) + G.idle_pitch_target_radians = 0.0f; + } + set_fourth_hero_easing_parameters(G.idle_rotation_easing_acceleration, G.idle_rotation_easing_max_speed); + hero_eases[3].rot_target.f[2] = G.idle_yaw_target_radians; + hero_eases[3].rot_target.f[1] = G.idle_pitch_target_radians; set_second_hero_easing_parameters(frame_scale_sq * 0.008f, frame_scale_sq * 0.3f); hero_eases[1].rot_target.f[2] = hero_eases[3].rot_target.f[2] * 0.52f; hero_eases[1].rot_target.f[1] = hero_eases[3].rot_target.f[1] * 0.55f; From 25d277ca5f10e1491cb95b1e3b1cc846ba275991 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:52:27 +0000 Subject: [PATCH 328/758] decomp: clarify names in mine_glove_update unkA2 -> max_release_frame_bucket: In authoritative mine_glove.c SHA-256 da5d6c79a294322c8b32383361c2a5f49347d09224a67dcf56b7d963ecb955a4, MINE_GLOVE_RELEASE_HELD_MOBY first releases the held mine through initialize_moby_motion_at_position, then compares this u16 statistic with scale_game_frames(D_0015EEA4_macro)/600 and replaces it only when the sampled bucket is greater. Retail 002c22c4 calls the release helper; 002c22f8 calls scale_game_frames, 002c22fc loads divisor 0x258, 002c2300 divides, 002c230c loads the unsigned halfword at item_usage+0x8a, 002c2310..002c2318 compare and skip a non-greater sample, and 002c2320..002c233c recompute the quotient and store its halfword. Thus this is the maximum release frame bucket statistic, distinct from adjacent deliveries and level flags; no time unit or global lifetime is inferred. --- src/overlays/shared/weapons/mine_glove.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/mine_glove.c b/src/overlays/shared/weapons/mine_glove.c index 673046b156..0a3970e7a7 100644 --- a/src/overlays/shared/weapons/mine_glove.c +++ b/src/overlays/shared/weapons/mine_glove.c @@ -30,7 +30,7 @@ typedef struct { typedef struct { u8 pad0[0x88]; u16 deliveries; - u16 unkA2; + u16 max_release_frame_bucket; u32 levels; } DeliveryStats_2c1ad0; @@ -293,8 +293,8 @@ void mine_glove_update(struct Moby *moby) { { s32 frames = scale_game_frames(D_0015EEA4_macro); frames /= 600; - if (((DeliveryStats_2c1ad0 *)item_usage)->unkA2 < frames) - ((DeliveryStats_2c1ad0 *)item_usage)->unkA2 = + if (((DeliveryStats_2c1ad0 *)item_usage)->max_release_frame_bucket < frames) + ((DeliveryStats_2c1ad0 *)item_usage)->max_release_frame_bucket = scale_game_frames(D_0015EEA4_macro) / 600; } ((DeliveryStats_2c1ad0 *)item_usage)->levels = From 2f00124e2b96c3c9564af9aa797beebf20d8c3f7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:52:31 +0000 Subject: [PATCH 329/758] decomp: clarify names in skid_mcmarx_update f68 -> target_rotation_z: At retail 0030811c-00308158, racer yaw_speed is clamped and optionally sign-reversed. 00308194-003081c8 scales it by 30, 20 and 50 and stores at pvars+0x1e8, +0x68 and +0x168, matching m[3].f68, m[0].f68 and m[2].f68 in the SHA-bound C. These manipulators are passed to helper 0028cde8 at 003081cc, 003081ec and 0030820c. Checked helper instructions 0028cf78-0028cf94 load member +0x68 into f12 as the target for the same spring_angle routine used by this update's yaw, with current rotation at manipulator+0x48 and angular velocity at +0x58. Parallel calls handle +0x60/+0x40 and +0x64/+0x44. Thus f68 is the Z rotation target, not angular velocity or current rotation; 0028cfc4-0028cfd4 subsequently clear the target vector. --- src/overlays/l05/mobys/skid_mcmarx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l05/mobys/skid_mcmarx.c b/src/overlays/l05/mobys/skid_mcmarx.c index 61287c3b4d..d22aa4bce7 100644 --- a/src/overlays/l05/mobys/skid_mcmarx.c +++ b/src/overlays/l05/mobys/skid_mcmarx.c @@ -359,7 +359,7 @@ typedef struct { typedef struct { char p00[0x64]; float f64; - float f68; + float target_rotation_z; char p6C[0x14]; } Manip_308D68; @@ -629,9 +629,9 @@ void skid_mcmarx_update(Moby *moby) { if (moby->flags & 0x8000) { turn = -turn; } - racer_instance_vars->m[3].f68 = turn * 30.0f; - racer_instance_vars->m[0].f68 = turn * 20.0f; - racer_instance_vars->m[2].f68 = turn * 50.0f; + racer_instance_vars->m[3].target_rotation_z = turn * 30.0f; + racer_instance_vars->m[0].target_rotation_z = turn * 20.0f; + racer_instance_vars->m[2].target_rotation_z = turn * 50.0f; racer_instance_vars->m[1].f64 = turn * 40.0f; FUN_L00_002628d8((char *)moby, (char *)&racer_instance_vars->m[3], From 04141294388143e6e2fe628c04039a4f673742f2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:52:35 +0000 Subject: [PATCH 330/758] decomp: clarify names in update_drek_boss_damage_and_phase_transitions f228 -> phase_transition_ground_node_indices: Retail 0x002f660c-0x002f6630 loads phase +0x34C minus one, reads the int at boss+0x228+4*index, scales that value by 0x80 into D_L18_001600EC, and copies node position +0x30 to sp+0x90 (C V90). At 0x002f6634-0x002f6654 it raises Z by 20 and replaces Z with probe_ground_height. This ground point seeds V60, which is offset 15 units away from the previous arena node and raised 15 units (0x002f6658-0x002f66e8); V90 receives the corresponding yaw at 0x002f66f8. Both vectors feed start_camera_transition at 0x002f6794. Current C expresses the same flow using VendorStage_5e80.f228[phase-1], proving a two-element array of phase-transition ground-node indices rather than arbitrary offset data. --- src/overlays/l18/mobys/drek_final_boss_robot.c | 4 ++-- 1 file changed, 2 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 ef56425998..c6a9bc7e6c 100644 --- a/src/overlays/l18/mobys/drek_final_boss_robot.c +++ b/src/overlays/l18/mobys/drek_final_boss_robot.c @@ -1781,7 +1781,7 @@ typedef struct { char pad0[0x204]; int f204[3]; char pad210[0x18]; - int f228[2]; + int phase_transition_ground_node_indices[2]; int f230[4]; char pad240[0x10]; int f250[4]; @@ -2034,7 +2034,7 @@ void update_drek_boss_damage_and_phase_transitions(char *moby) { qcopy( V90, ((VendorNode_5e80 *)D_L18_001600EC)[((VendorStage_5e80 *)boss_data) - ->f228[*(int *)(boss_data + 0x34C) - 1]] + ->phase_transition_ground_node_indices[*(int *)(boss_data + 0x34C) - 1]] .pos); V90[2] += health_floor_or_transition_offset; V90[2] = probe_ground_height(V90, 0, 0.5f); From 387169cbe98fa09bfd1beefba9d90a8d3d57b5dc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:55:20 +0000 Subject: [PATCH 331/758] decomp: clarify names in crate_update unkC9 -> respawn_delay_timer: Retail 0x002cf7ec enters WAIT_RESPAWN and 0x002cf810..0x002cf81c stores the delay helper result into pvars+0xC9. At 0x002cf884..0x002cf88c its address is passed to FUN_001fefc8 and zero return defers restoration. Helper evidence fd542dd574fa4774a2eb82626e8c122d at 0x001fefc8..0x001feff4 proves a nonzero byte decrements once, returns zero while positive and nonzero on expiration/already zero. Subsequent flow restores state, visibility and collision, matching authoritative C uses of unkC9. unkCA -> burst_frame: In BROKEN state for class 0x1F9, retail 0x002cf6dc..0x002cf6ec reads pvars+0xCA and compares against scale_game_frames(20). At 0x002cf738..0x002cf750 that byte converts to float and divides by scale_time(20.0f), feeding twice and three times the quotient as sphere radii at 0x002cf76c..0x002cf798. It increments once at 0x002cf7a0..0x002cf7ac. Authoritative C agrees and break_crate initializes this same byte to 1 or scaled 5, proving an advancing burst phase frame counter. --- src/overlays/shared/pickups/crate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/pickups/crate.c b/src/overlays/shared/pickups/crate.c index 2d7beb167f..4c28ead997 100644 --- a/src/overlays/shared/pickups/crate.c +++ b/src/overlays/shared/pickups/crate.c @@ -77,8 +77,8 @@ typedef struct { u8 padC0[0xC6 - 0xC0]; s16 unkC6; u8 unkC8; - u8 unkC9; - u8 unkCA; + u8 respawn_delay_timer; + u8 burst_frame; u8 padCB[0xFC - 0xCB]; s32 frameFC; } CrateVars; @@ -405,7 +405,7 @@ void crate_update(struct Moby *moby) { break; case CRATE_STATE_BROKEN: - if (moby->oclass == 0x1F9 && crate_vars->unkCA <= scale_game_frames(20)) { + if (moby->oclass == 0x1F9 && crate_vars->burst_frame <= scale_game_frames(20)) { f32 burst_radius_scale; burst.moby = moby; @@ -414,13 +414,13 @@ void crate_update(struct Moby *moby) { burst.unk20 = 0; fast_vec_normalize(&at, &moby->rot_row2, 0.5f); add_vector_xyz(&at, &at, &moby->pos); - burst_radius_scale = convert_integer_to_float(crate_vars->unkCA) / scale_time(20.0f); + burst_radius_scale = convert_integer_to_float(crate_vars->burst_frame) / scale_time(20.0f); burst.unk14 = 1; collect_mobies_in_sphere( burst_radius_scale + burst_radius_scale, &at, 0x10, moby, &burst); burst.unk14 = 0x30000; collect_mobies_in_sphere(burst_radius_scale * 3.0f, &at, 0x10, D_001413D0_lui, &burst); - crate_vars->unkCA++; + crate_vars->burst_frame++; break; } if (crate_vars->unkC8 != 0) { @@ -433,9 +433,9 @@ void crate_update(struct Moby *moby) { } moby->state = CRATE_STATE_WAIT_RESPAWN; if (D_0015ED84 == 0x12) { - crate_vars->unkC9 = FUN_L00_00257b90(300, 720); + crate_vars->respawn_delay_timer = FUN_L00_00257b90(300, 720); } else { - crate_vars->unkC9 = FUN_L00_00257b90(30, 60); + crate_vars->respawn_delay_timer = FUN_L00_00257b90(30, 60); } break; } @@ -449,7 +449,7 @@ void crate_update(struct Moby *moby) { if (fast_bsphere_check(&burst.pos, moby->draw_dist) != -1) { break; } - if (!FUN_L00_001fefc8(&crate_vars->unkC9)) { + if (!FUN_L00_001fefc8(&crate_vars->respawn_delay_timer)) { break; } if (moby->group == 0xFF) { From 06e4eb1c47878e73dc16d6acf28e5e44dbd30da8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:55:24 +0000 Subject: [PATCH 332/758] decomp: clarify names in bomb_spawner_update f2C -> hit_damage: Retail 0x002bf198 obtains the hit record and 0x002bf1a0 saves it in s0; 0x002bf1b0 passes it to resolve_moby_hit_response. After status >=2 at 0x002bf1c8-0x002bf1d0, lwc1 f0,0x2c(s0) at 0x002bf1d8 reads this float, sub.S at 0x002bf1e4 subtracts it from spawner hp at pvars+0x20, and 0x002bf1f4 stores remaining hp before the nonpositive-health destruction path. Authoritative C expresses remaining_health = spawner_data->hp - r->f2C. Supplied response-helper context also assigns this field from hit_damage_override_table, supporting hit_damage rather than an offset-only name. --- src/overlays/shared/enemies/bomb_spawner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/enemies/bomb_spawner.c b/src/overlays/shared/enemies/bomb_spawner.c index ad69885be6..9674b18fe0 100644 --- a/src/overlays/shared/enemies/bomb_spawner.c +++ b/src/overlays/shared/enemies/bomb_spawner.c @@ -58,7 +58,7 @@ typedef struct Data_2C0330 { typedef struct { char pad0[0x2C]; - float f2C; + float hit_damage; } Hit_2C0330; void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); @@ -265,7 +265,7 @@ void bomb_spawner_update(struct Moby *moby) { r = (Hit_2C0330 *)find_moby_hit(moby, 0xC30000, 0); resolve_moby_hit_response(moby, r, &spawner_data->hp, 0, &damage_query_status, 0, 0, 4); if (damage_query_status >= HIT_STATUS_DAMAGE_PROCESSING_THRESHOLD) { - float remaining_health = spawner_data->hp - r->f2C; + float remaining_health = spawner_data->hp - r->hit_damage; spawner_data->hp = remaining_health; if (remaining_health > 0.0f) { spawner_data->b67 = 0x5A; From 6eb0c74ab0e91ba4d185aac9e79a9405b35ff2aa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:55:28 +0000 Subject: [PATCH 333/758] decomp: clarify names in veldin_robot_enemy_update unk114 -> target_selection_status: Retail update 0x002e0df0-0x002e0e08 and 0x002e10c0-0x002e10d4 read vars+0x114 and suppress path-follow or beam-slot activation when it equals 2. Direct targeting helper 0x002e1678 (bounded request 56173a5f980a47a787a1c825cb0fbce3) writes 2 at 0x002e19cc after combat target selection fails its special return-2 check and targetPos XY distance exceeds the selection range; 0x002e1a6c-0x002e1a7c updates target and targetPos to a closer candidate and writes 1. Bound C confirms these target-selection writes and consumers, proving a target selection status rather than a boolean. unk1B4 -> targeting_path_index: Assigned retail 0x002e0d04-0x002e0d08 checks vars+0x1b4 against -1 before allowing path setup. Direct targeting helper retail 0x002e1938-0x002e1970 loads that field, shifts it by two to index toad_paths at 0x001b04b0, loads the selected path count and points, and passes them with output vars+0xd0 (targetPos) to 0x0025ff38. Authoritative C explicitly uses path = toad_paths[vars->unk1B4] to supply path->pts/count and &vars->targetPos in WAIT_TO_FOLLOW_PATH. Existing pathIdx at +0x1b8 instead selects movement waypoints, so this field is specifically the targeting path index. --- src/overlays/l00/mobys/veldin_robot_enemy.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l00/mobys/veldin_robot_enemy.c b/src/overlays/l00/mobys/veldin_robot_enemy.c index 7c3ae43a65..4013132845 100644 --- a/src/overlays/l00/mobys/veldin_robot_enemy.c +++ b/src/overlays/l00/mobys/veldin_robot_enemy.c @@ -85,12 +85,12 @@ typedef struct { ElectroidVec targetPos; u8 padE0[0x110 - 0xE0]; ElectroidMoby *target; - s32 unk114; + s32 target_selection_status; u8 pad118[0x120 - 0x118]; u8 unk120[0x1A0 - 0x120]; u128 spawnPos; u8 pad1B0[4]; - s32 unk1B4; + s32 targeting_path_index; s32 pathIdx; s32 unk1BC; u8 pad1C0[0x1D0 - 0x1C0]; @@ -219,7 +219,7 @@ void veldin_robot_enemy_update(ElectroidMoby *moby) { moby->flags |= 0x8000; } if (vars->pathIdx >= 0) { - if (vars->unk1B4 == -1) { + if (vars->targeting_path_index == -1) { mark_moby_for_removal(moby); return; } @@ -239,7 +239,7 @@ void veldin_robot_enemy_update(ElectroidMoby *moby) { ELECTROID_ANIM(moby, 1, scale_game_frames_s32(20)); } } - if (vars->unk114 != 2) { + if (vars->target_selection_status != 2) { moby->state = VELDIN_ROBOT_STATE_FOLLOW_PATH; ELECTROID_ANIM(moby, 9, scale_game_frames_s32(10)); } @@ -280,7 +280,7 @@ void veldin_robot_enemy_update(ElectroidMoby *moby) { } else if (moby->unk70 & 2) { ELECTROID_ANIM(moby, random_integer_below(2) + 1, scale_game_frames_s32(20)); } - if (vars->unk114 != 2 && register_beam_slot(moby, 0, 0) != 0) { + if (vars->target_selection_status != 2 && register_beam_slot(moby, 0, 0) != 0) { moby->state = VELDIN_ROBOT_STATE_WAIT_TO_START_COLLISION_PROBES; ELECTROID_ANIM(moby, 5, scale_game_frames_s32(10)); } @@ -505,7 +505,7 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { moby->unkA4 = 0xFF; trooper_anim_finish(moby, anim); if (moby->state == VELDIN_ROBOT_STATE_WAIT_TO_FOLLOW_PATH) { - path = toad_paths[vars->unk1B4]; + path = toad_paths[vars->targeting_path_index]; FUN_L00_0025ff38(moby, &vars->targetPos, 0, 0, path->pts, path->count, 64.0f); } else if (moby->state != VELDIN_ROBOT_STATE_PROCESS_COLLISION_PROBES) { range = veldin_robot_default_target_range_gp; @@ -514,7 +514,7 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { } if (select_moby_combat_target(moby, range, &vars->targetPos) != 2 && range < vector_distance_xy(&moby->pos, &vars->targetPos)) { - vars->unk114 = 2; + vars->target_selection_status = 2; } } if (vars->target == 0) { @@ -532,7 +532,7 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { if (range < vector_distance_xy(&moby->pos, &vars->target->pos)) { vars->target = candidate_target; qcopy(&vars->targetPos, &candidate_target->pos); - vars->unk114 = 1; + vars->target_selection_status = 1; } } } From 84f1c4c2e1949771bbfd6d9cfd7339aac12cbd9f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:57:38 +0000 Subject: [PATCH 334/758] decomp: clarify names in update_vendor_menu f8 -> item_local_position_offset_z: Authoritative vendor_menu.c SHA-256 773040bac75b4c18f0a54bfe10790e55259bdb99d2b9a7c681ebffacc4778e3f assigns VendorItemSlot30.f8 to position_contribution_scratch.f[2]. Retail 0029cf4c-0029cf78 selects CUR_ITEM.item*0x30 at 0x001C9930; 0029cf7c loads +8 into f2 and 0029cf94 stores it to sp+0x18, beside X/Y at sp+0x10/+0x14. Original Ghidra likewise loads 0x1c9938 into fStack_108. At 0029cf90 the item's rot at menu_mobys+0x340 builds its basis at +0x3C0; 0029cf98-0029cfac transforms that XYZ vector through the item basis, and 0029cfb0-0029cfc0 adds it to menu_mobys[3].pos (+0x310). This proves an item-local position-offset Z component, rather than a world Z coordinate or rotation. --- src/overlays/shared/vendor/vendor_menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/vendor/vendor_menu.c b/src/overlays/shared/vendor/vendor_menu.c index 1c02e303bd..50adf24bfd 100644 --- a/src/overlays/shared/vendor/vendor_menu.c +++ b/src/overlays/shared/vendor/vendor_menu.c @@ -855,7 +855,7 @@ typedef struct { typedef struct { f32 f0; f32 f4; - f32 f8; + f32 item_local_position_offset_z; char padC[4]; f32 f10; f32 f14; @@ -1353,7 +1353,7 @@ void update_vendor_menu(void) { position_contribution_scratch.f[1] = l00_vendor_item_display_transform_parameters[CUR_ITEM.item].f4; position_contribution_scratch.f[2] = - l00_vendor_item_display_transform_parameters[CUR_ITEM.item].f8; + l00_vendor_item_display_transform_parameters[CUR_ITEM.item].item_local_position_offset_z; euler_rotation_basis(vendor_menu.menu_mobys[3].mtx, &vendor_menu.menu_mobys[3].rot); transform_vector_by_basis(&position_contribution_scratch, &position_contribution_scratch, From 6b94e72f7ef910d933dee38da15d09a7e4fcac13 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:57:42 +0000 Subject: [PATCH 335/758] decomp: clarify names in big_axebot_update f2C -> damage_amount: Retail hit pointer s3 is passed as a1 at 002ba754 to hit_reaction 0024d4a8. Checked helper binds a1 to s4 at 0024d4d0 and t1 to sp+0x20 at 0024d4f4; 0024d9a4..0024d9b4 copies float hit+0x2c to that output. Assigned caller supplies &dmg in t1 at 002ba764, loads it at 002ba864 and subtracts it from data->hp at 002ba86c..002ba87c. The same field is compared to 1.0 at 002ba950..002ba968 to gate conditional hit recovery, matching source hit->f2C > 1.0f. This proves a damage amount rather than an offset-only role. --- 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 70d201589b..7ca55fd3e5 100644 --- a/src/overlays/l04/mobys/big_axebot.c +++ b/src/overlays/l04/mobys/big_axebot.c @@ -226,7 +226,7 @@ typedef struct { V4_B7B0 pos; M_B7B0 *att; char pad24[8]; - float f2C; + float damage_amount; } Hit_B7B0; typedef struct { @@ -416,7 +416,7 @@ void big_axebot_update(M_B7B0 *moby) { data->f408 = -0.5235988f; } data->f448 = scale_game_frames(0x1E); - if ((hit->att->cls == 0 || hit->f2C > 1.0f) && + if ((hit->att->cls == 0 || hit->damage_amount > 1.0f) && (moby->f52 != 4 || hd < 17.0f || hd > 20.0f)) { moby->fBC |= 5; blend_big_axebot_and_axe_animation( From bf9ede3dc250f0bca93d8ae405423e3ce3b69512 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:59:40 +0000 Subject: [PATCH 336/758] decomp: clarify names in FUN_L00_002dc9f0 domain_2_value_2 -> SUCK_RECORD_STATE_RISING_FOR_SUCTION: Retail 0x002dcb58-0x002dcb64 assigns raw record+0x68=2 after the yaw alignment tolerance test, resetting progress. At 0x002dca60-0x002dca74 the switch subtracts one from this same record state; raw 2 therefore enters existing SUCK_UPDATE_RISING_FOR_SUCTION=1, whose branch 0x002dcb68-0x002dcbe8 raises moby Z with clamped progress. This is the raw record domain, not SUCK_UPDATE_BEING_PULLED_IN=2. domain_3_value_6 -> SUCK_RECORD_STATE_ROLLING_PROJECTILE: 0x002dd418-0x002dd428 compares the same record+0x68 state with raw 6. The true branch 0x002dd430-0x002dd544 rotates the moby basis around negative velocity cross up through speed/radius, proving rolling. Raw 6 maps through state-1 to existing SUCK_UPDATE_ROLLING_PROJECTILE=5; supplied launch_suck_cannon_projectile also selects raw 6 for the rolling launch path. domain_4_value_6 -> SUCK_RECORD_STATE_ROLLING_PROJECTILE: The collision branch at 0x002dd588-0x002dd5d0 selects anims[6], updates collision_disable and writes raw record+0x68=6. The same raw-6 comparison at 0x002dd418-0x002dd428 enables the rolling basis update using speed/radius and a velocity-cross-up axis. Thus this assignment must reuse the raw rolling-projectile member used by that comparison, not offset SUCK_UPDATE_FALLING_AFTER_CANCEL=6. domain_5_value_4 -> SUCK_RECORD_STATE_STORED: Retail 0x002dd844-0x002dd848 compares signed record+0x68 with raw 4 to restrict the suction-cancel timer to pre-storage states. The state-1 switch at 0x002dca60-0x002dca74 maps raw 4 to existing SUCK_UPDATE_STORED=3, whose 0x002dcfd8-0x002dd04c branch hides the moby and disables collision. Supplied store_moby_in_suck_cannon writes raw 4 after moving the moby into storage, confirming this threshold names stored state. f98 -> suction_step_distance: Retail 0x002dcd64-0x002dcd7c increases record+0x98 by frame_scale_sq*0.11 and caps it at frame_scale*0.75. 0x002dcde8-0x002dce20 compares owner-attachment XY distance against it to finish storage; 0x002dcfa8-0x002dcfc4 passes it as the length for the toward-destination vector then adds that vector to moby position. The source uses f98 for all these operations, proving a per-update suction movement distance. --- src/overlays/shared/weapons/suckcannon.c | 29 ++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 0cd280fd95..443e0de4e5 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -339,7 +339,7 @@ typedef struct { int i84, i88; float f8C, f90; int i94; - float f98; + float suction_step_distance; short h9C, h9E; } R_2DDEA0; @@ -2320,6 +2320,11 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { SUCK_UPDATE_FALLING_AFTER_CANCEL = 6, SUCK_UPDATE_DEATH = 7 }; + enum { + SUCK_RECORD_STATE_RISING_FOR_SUCTION = 2, + SUCK_RECORD_STATE_STORED = 4, + SUCK_RECORD_STATE_ROLLING_PROJECTILE = 6 + }; Frame_2DDEA0 suction_and_projectile_scratch; R_2DDEA0 *suction_and_projectile_record; @@ -2343,7 +2348,7 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { frame_scale * 0.3927f); if (fast_subtract_rotations(yaw, tolerance) < moby->rot.z && moby->rot.z < fast_add_rotations(yaw, tolerance)) { - suction_and_projectile_record->state = 2; + suction_and_projectile_record->state = SUCK_RECORD_STATE_RISING_FOR_SUCTION; suction_and_projectile_record->f6C = 0.0f; } clear_u64_value(&suction_and_projectile_record->vel); @@ -2401,11 +2406,11 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { ((Cls *)moby->pclass)->f24 * (distance / (suction_and_projectile_record->f64 + suction_and_projectile_record->f64) + half); - suction_and_projectile_record->f98 = - suction_and_projectile_record->f98 + frame_scale_sq_macro * 0.11f; - if (frame_scale * 0.75f < suction_and_projectile_record->f98) - suction_and_projectile_record->f98 = frame_scale * 0.75f; - if (distance < suction_and_projectile_record->f98 * 70.0f) { + suction_and_projectile_record->suction_step_distance = + suction_and_projectile_record->suction_step_distance + frame_scale_sq_macro * 0.11f; + if (frame_scale * 0.75f < suction_and_projectile_record->suction_step_distance) + suction_and_projectile_record->suction_step_distance = frame_scale * 0.75f; + if (distance < suction_and_projectile_record->suction_step_distance * 70.0f) { blend_moby_animation( suction_and_projectile_record->owner, 4, 0, func_001F9850_2DDEA0(2)); } @@ -2413,7 +2418,7 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { D_001404FC_2DDEA0[0] = 2; moby->collision = 0; } - if (distance < suction_and_projectile_record->f98) { + if (distance < suction_and_projectile_record->suction_step_distance) { hero.suck_cannon_incoming--; hero.sucked_moby_count++; func_L00_002DB6C8_2DDEA0(moby, &suction_and_projectile_scratch.v[0]); @@ -2470,7 +2475,7 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { &moby->pos); func_L00_001FF4B0_2DDEA0(&suction_and_projectile_scratch.v[1], &suction_and_projectile_scratch.v[1], - suction_and_projectile_record->f98); + suction_and_projectile_record->suction_step_distance); func_001F9BD8_2DDEA0(&moby->pos, &moby->pos, &suction_and_projectile_scratch.v[1]); func_0020EEE8_2DDEA0(moby); } @@ -2606,7 +2611,7 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { if (((Coll *)D_L00_00173E40_lui)->hit != 0 && ((Coll *)D_L00_00173E40_lui)->hit->oclass == 0) hit_wall = 0; - if (suction_and_projectile_record->state == 6) { + if (suction_and_projectile_record->state == SUCK_RECORD_STATE_ROLLING_PROJECTILE) { moby->flags &= 0x7FFF; moby->collision = ((Cls *)moby->pclass)->i10; moby->flags |= 4; @@ -2658,7 +2663,7 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { blend_moby_animation(moby, anim, 0, func_001F9850_2DDEA0(0x14)); } moby->collision_disable = suction_and_projectile_record->i88; - suction_and_projectile_record->state = 6; + suction_and_projectile_record->state = SUCK_RECORD_STATE_ROLLING_PROJECTILE; if (0.87266463f < fast_arc_tan(((Coll *)D_L00_00173E40_lui)->v40.z, vector_length_xy(&((Coll *)D_L00_00173E40_lui)->v40))) { @@ -2734,7 +2739,7 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { } if (moby->flags & 4) func_0020EEE8_2DDEA0(moby); - if (suction_and_projectile_record->state < 4) { + if (suction_and_projectile_record->state < SUCK_RECORD_STATE_STORED) { if (suction_and_projectile_record->timer <= 0.0f) { if (((Cls *)moby->pclass)->f2C->fC != 0) ((Cls *)moby->pclass)->f2C->fC(moby); From 45ed8792b93c687c3582c45dad5340296a9110a5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:59:44 +0000 Subject: [PATCH 337/758] decomp: clarify names in update_planetbuster_maximus_guns b92 -> firing_voice_window_timer: After successful projectile creation (00305adc..00305ae4), retail 00305af0..00305b04 stores scale_game_frames(20) into Gun+0x92. At 00305910..00305924, its byte-countdown helper result must be zero before the voice repeat countdown at +0x93 is updated and allocate_voice_for_target_entry(0,0,gun_moby) can run at 00305934. Bounded helper 00221e98..00221ec4 (request e2c85e9b639843afad6baccb922aa87c) loads/decrements/stores a nonzero byte, returns 0 while still positive, 2 on expiration and 1 when already zero. Thus b92 defines the recent-successful-shot countdown window permitting firing voice updates; it does not gate projectile creation. b93 -> firing_voice_repeat_timer: Retail 00305920..00305944 passes Gun+0x93 to byte-countdown helper 00221e98; a nonzero return triggers allocate_voice_for_target_entry(0,0,gun_moby) at 00305934 and resets +0x93 to scale_game_frames(9). Original Ghidra and authoritative C agree with this branch nested under the active +0x92 post-shot window. Bounded helper request e2c85e9b639843afad6baccb922aa87c confirms return 0 while decrement remains positive, 2 on expiration and 1 when already zero, proving a repeat timer for the firing voice allocation. f8C -> yaw_sweep_direction: Gun.f8C is initialized to +1 at retail 003056b8..003056cc and to -1 for odd gun indices at 003056c4..003056dc. 003056e0..003056f8 multiplies it by 0.55850536 and adds that signed offset to hero-relative yaw before spring_angle; 00305780..00305798 negates it when the sweep target is reached. Original Ghidra accesses iVar7+0x8c and authoritative C uses md->f8C identically, proving alternating yaw sweep direction. --- .../l12/mobys/planetbuster_maximus_part.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l12/mobys/planetbuster_maximus_part.c b/src/overlays/l12/mobys/planetbuster_maximus_part.c index 09a8430e07..6da13f6c02 100644 --- a/src/overlays/l12/mobys/planetbuster_maximus_part.c +++ b/src/overlays/l12/mobys/planetbuster_maximus_part.c @@ -51,10 +51,10 @@ typedef struct { float f80; int w84; char pad88[4]; - float f8C; + float yaw_sweep_direction; short h90; - char b92; - char b93; + char firing_voice_window_timer; + char firing_voice_repeat_timer; char pad94[4]; short h98; short h9A; @@ -143,13 +143,13 @@ void update_planetbuster_maximus_guns(char *moby) { D_0015ED6C_gp * 0.17453292f * (float)i) < 0.08726646f) { md->h90 = 1; - md->f8C = 1.0f; + md->yaw_sweep_direction = 1.0f; if (i & 1) { - md->f8C = -1.0f; + md->yaw_sweep_direction = -1.0f; } } } else { - float sweep_target_yaw = fast_add_rotations(yaw, md->f8C * 0.55850536f); + float sweep_target_yaw = fast_add_rotations(yaw, md->yaw_sweep_direction * 0.55850536f); if (absolute_float(spring_angle(ent + 0x18, sweep_target_yaw, (char *)md + 0x94, @@ -159,7 +159,7 @@ void update_planetbuster_maximus_guns(char *moby) { D_0015ED6C_gp * 0.2617994f + (float)i * (D_0015ED6C_gp * 0.05235988f))) < 0.017453292f) { - md->f8C = -md->f8C; + md->yaw_sweep_direction = -md->yaw_sweep_direction; } } flag = 0; @@ -184,10 +184,10 @@ void update_planetbuster_maximus_guns(char *moby) { md->h9E = scale_game_frames(0x14); } if (fast_dec_timer_s16(&md->h9E) == 0) { - if (FUN_L00_001fefc8(&md->b92) == 0) { - if (FUN_L00_001fefc8(&md->b93) != 0) { + if (FUN_L00_001fefc8(&md->firing_voice_window_timer) == 0) { + if (FUN_L00_001fefc8(&md->firing_voice_repeat_timer) != 0) { allocate_voice_for_target_entry(0, 0, gun_moby); - md->b93 = scale_game_frames(9); + md->firing_voice_repeat_timer = scale_game_frames(9); } } if (fast_dec_timer_s16(&md->h9C) != 0) { @@ -224,7 +224,7 @@ void update_planetbuster_maximus_guns(char *moby) { scratch_vector, scale_game_frames(0x96)) != 0) { int j; - md->b92 = scale_game_frames(0x14); + md->firing_voice_window_timer = scale_game_frames(0x14); for (j = 0; j < 9; j++) { int firing_particle_color_low_byte; int firing_particle_color; From 1fbdd96a3d7797f00df161400015849dcba45485 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:59:47 +0000 Subject: [PATCH 338/758] decomp: clarify names in turret_update unk168 -> longer_shot_response_frame_count: Authoritative src/overlays/l09/mobys/turret.c SHA-256 44046afac8a737c2d38f5f41bb53561df14dc64657bfd9af48d3efdf5fdfefe1 assigns this s32 member scale_game_frames(10) immediately after spawn_turret_shot and its voice call in both firing branches. Retail 003054c4/003054cc constructs 00166e00, 003054c8 passes 10 to scale_game_frames at 003054d0, and 003054d8 stores its return at +0x168 (00166f68). The second barrel repeats at 003056fc/00305704/0030570c. Original Ghidra uRam00166f68 agrees. Its companion +0x178 receives scale_game_frames(7), so this is the longer of the paired shot-response frame counts; no downstream countdown or axis is inferred. unk178 -> shorter_shot_response_frame_count: The authoritative C assigns this s32 member scale_game_frames(7) after either barrel's projectile and voice calls, together with the scale_game_frames(10) write to unk168. Retail 003054dc passes 7 to 0021ebd0 at 003054e0 and 003054e8 stores the result at +0x178 of base 00166e00, namely 00166f78. The second barrel repeats at 00305710/00305714/0030571c. Original Ghidra uRam00166f78 confirms the same return-value flow. The explicit scaled-frame producer proves a shot-response frame count and distinguishes it as the shorter paired count, without claiming countdown behavior or response axis. --- src/overlays/l09/mobys/turret.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l09/mobys/turret.c b/src/overlays/l09/mobys/turret.c index 78f6ea2e53..501d53a75e 100644 --- a/src/overlays/l09/mobys/turret.c +++ b/src/overlays/l09/mobys/turret.c @@ -58,11 +58,11 @@ typedef struct { u8 pad0[0x160]; f32 unk160; u8 pad164[4]; - s32 unk168; + s32 longer_shot_response_frame_count; u8 pad16C[4]; f32 unk170; u8 pad174[4]; - s32 unk178; + s32 shorter_shot_response_frame_count; } TurretShake; /* moby the sound collision probe ignores (clamp_voice_position_to_collision) */ @@ -263,9 +263,9 @@ void turret_update(struct Moby *moby) { spawn_turret_shot(moby, &muzzle, &shot, scale_game_frames(90)); allocate_voice_for_target_entry(0, 0, moby); l09_turret_shot_response_state.unk160 = 0.03f; - l09_turret_shot_response_state.unk168 = scale_game_frames(10); + l09_turret_shot_response_state.longer_shot_response_frame_count = scale_game_frames(10); l09_turret_shot_response_state.unk170 = 0.03f; - l09_turret_shot_response_state.unk178 = scale_game_frames(7); + l09_turret_shot_response_state.shorter_shot_response_frame_count = scale_game_frames(7); turret_vars->barrel = 0; for (i = 0; i < 5; i++) { rnd.q = 0; @@ -310,9 +310,9 @@ void turret_update(struct Moby *moby) { spawn_turret_shot(moby, &muzzle, &shot, scale_game_frames(90)); allocate_voice_for_target_entry(0, 0, moby); l09_turret_shot_response_state.unk160 = 0.03f; - l09_turret_shot_response_state.unk168 = scale_game_frames(10); + l09_turret_shot_response_state.longer_shot_response_frame_count = scale_game_frames(10); l09_turret_shot_response_state.unk170 = 0.03f; - l09_turret_shot_response_state.unk178 = scale_game_frames(7); + l09_turret_shot_response_state.shorter_shot_response_frame_count = scale_game_frames(7); turret_vars->barrel = 1; for (i = 0; i < 5; i++) { rnd.q = 0; From 55b81f5f350bbc25e5ed0301350bf828b0f6d677 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 07:59:51 +0000 Subject: [PATCH 339/758] decomp: clarify names in blarg_space_commando_update unk1A8 -> approach_heading_offset: In authoritative blarg_space_commando_update state BLARG_SPACE_COMMANDO_APPROACH_TARGET_WITH_TURN_OFFSET, retail 003085a8..003085c0 computes atan(target.pos.xy - moby.pos.xy); 003085c4 loads f32 pvars+0x1a8 and 003085c8 adds it through fast_add_rotations before the steering call at 00308608. After ground/collision movement, 00308650 tests result bit 2: 00308658 clears this field otherwise, while 00308664..00308684 stores convert_integer_to_float(-1)*1.0995574 when set. The C uses agree: this member is a persistent heading offset for approaching the target, distinct from the existing turn interpolation member. --- src/overlays/l13/mobys/blarg_space_commando.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l13/mobys/blarg_space_commando.c b/src/overlays/l13/mobys/blarg_space_commando.c index aff2594831..e4e1c7957e 100644 --- a/src/overlays/l13/mobys/blarg_space_commando.c +++ b/src/overlays/l13/mobys/blarg_space_commando.c @@ -124,7 +124,7 @@ typedef struct { s32 timer; /* 0x194 */ s32 path; /* 0x198 */ u8 pad19C[0xC]; - f32 unk1A8; + f32 approach_heading_offset; u8 pad1AC[0x34]; Vec4 unk1E0; u8 pad1F0[0x210]; @@ -366,7 +366,7 @@ void blarg_space_commando_update(struct Moby *moby) { func_L00_002592B0_309330(moby, fast_add_rotations(fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), - blarg_space_commando_vars->unk1A8), + blarg_space_commando_vars->approach_heading_offset), &blarg_space_commando_vars->turn, 0.05f, 0.3f, @@ -378,9 +378,9 @@ void blarg_space_commando_update(struct Moby *moby) { moby, &blarg_space_commando_vars->ctl, &point, &origin, 1.0f) & 2) { rand(); - blarg_space_commando_vars->unk1A8 = convert_integer_to_float(-1) * 1.0995574f; + blarg_space_commando_vars->approach_heading_offset = convert_integer_to_float(-1) * 1.0995574f; } else { - blarg_space_commando_vars->unk1A8 = 0.0f; + blarg_space_commando_vars->approach_heading_offset = 0.0f; } resolve_point_path_segment_xy_clearance( blarg_space_commando_vars->path, &moby->pos, &moby->pos, 0.75f); From 9463e12ea273f628d8ede025b2eb68ecdaa6b9d0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:01:59 +0000 Subject: [PATCH 340/758] decomp: clarify names in spawn_drek_boss_ring_projectile domain_0_value_0 -> STATE_BALLISTIC_FLIGHT: Retail 0x002db96c allocates class 0x270; 0x002db998 stores zero into its object+0x20 state byte, matching original Ghidra *(undefined1 *)(iVar6 + 0x20) = 0 and the supplied C spawned_moby->projectile_state = 0. The same class-0x270 update switches on moby->state with the established STATE_BALLISTIC_FLIGHT = 0 member; that branch adds the initialized pvars movement vector to position, applies gravity to Z, and transitions to STATE_GROUND_IMPACT_DELAY on ground contact. Thus the assignment initializes ballistic flight, rather than any unrelated zero-valued enum domain. --- src/overlays/l18/mobys/drek_boss_ring_projectile.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l18/mobys/drek_boss_ring_projectile.c b/src/overlays/l18/mobys/drek_boss_ring_projectile.c index 40852c012f..c40e5f3388 100644 --- a/src/overlays/l18/mobys/drek_boss_ring_projectile.c +++ b/src/overlays/l18/mobys/drek_boss_ring_projectile.c @@ -229,13 +229,16 @@ void spawn_drek_boss_ring_projectile(char *pos, void spawn_drek_boss_ring_projectile( char *pos, float *initial_movement_step, int collision_filter_moby, float fa, float fb) { + enum { + STATE_BALLISTIC_FLIGHT = 0 + }; BallisticRingProjectileMoby *spawned_moby = (BallisticRingProjectileMoby *)create_moby(0x270); if (spawned_moby != 0) { Child *moby_vars; int initial_glow_color; spawned_moby->b30 = 0xFF; spawned_moby->b31 = 1; - spawned_moby->projectile_state = 0; + spawned_moby->projectile_state = STATE_BALLISTIC_FLIGHT; initial_glow_color = *(int *)&D_L18_00161BFC_gp; spawned_moby->f2C = spawned_moby->f2C * D_L18_00161BF8; spawned_moby->s32 = 0xFF; From c08a37b9eacedf32a4726bc926d08bd06404f844 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:04:36 +0000 Subject: [PATCH 341/758] decomp: clarify names in apply_hero_selected_flags_and_state_transitions b12E3 -> idle_exit_transition_selected: Retail 0x0020bb60-0x0020bb70 sets this byte for saved selector 4; 0x0020bbf4-0x0020bc24 tests it with contact and control-mode gates before selecting a0=0x31. The authoritative C identifies that destination as HERO_STATE_VOICE_SLOT_CLEANUP_IDLE_EXIT and passes it to hero_set_state. This names its transition-selection role, without assigning a surface material. b12E5 -> death_descent_transition_selected: Retail 0x0020bba4-0x0020bbb0 sets this byte for selector 1. Loads at 0x0020bc2c and 0x0020bc60 gate paths choosing 0x7D or 0x7C, with an alternative 0x3C at 0x0020bc98-0x0020bca8. C names the primary destinations HERO_STATE_VEHICLE_MODE_1_DEATH_DESCENT and HERO_STATE_DEATH_DESCENT; it is the selected death-descent transition flag, subject to the existing alternate branch. b12E6 -> jump_or_respawn_wait_transition_selected: Retail 0x0020bab4-0x0020bac4 sets this byte for selector 3. Its test at 0x0020bd48 gates height-above-position and downward-motion checks, followed by 0x0020bdf4-0x0020be00 selecting state 0x68 or 0x7B. C identifies these as HERO_STATE_WAIT_FOR_JUMP_OR_RESPAWN and HERO_STATE_HEIGHT_OR_TIMEOUT_RESPAWN_WAIT, proving the transition-selection role. b12EB -> respawn_wait_transition_selected: Retail 0x0020bb30-0x0020bb40 sets this byte for selector 11. The test at 0x0020be18 gates the final height and downward-motion branch, which exits vehicle mode and calls hero_set_state(0x7B,1) at 0x0020bea4-0x0020beac. C's existing 0x7B destination elsewhere is HERO_STATE_HEIGHT_OR_TIMEOUT_RESPAWN_WAIT; the byte selects that respawn-wait transition. b12EC -> sink_transition_selected: Retail 0x0020bb8c-0x0020bb9c sets this byte for selector 13. Its load at 0x0020bcb0 gates the surface-height and negative-motion checks at 0x0020bcc8-0x0020bd2c, then 0x0020bd40 selects state 0x7F for hero_set_state. Authoritative C names 0x7F HERO_STATE_SINK, proving this byte selects the sink transition. f22A4 -> selected_height_difference: Retail 0x0020ba68-0x0020ba80 subtracts hero+0x2D8 from hero+0x2F0 and stores that height difference at +0x22A4. C expresses the same through height_difference. Selector 14 instead writes 0.2f to this field and sets +0x2F0 to +0x2D8 plus 0.2f (0x0020ba38-0x0020ba4c), proving it stores the selected height difference without needing specific probe identities. p10E0 -> slot_one_item_moby: Retail 0x0020b9fc-0x0020ba10 null-checks this pointer and reads its signed oclass at +0xA6 for 0xAD. Supplied C emit_hero_animation_voice_and_ground_particle performs the identical null/oclass-0xAD test on hero.items[1].moby. The supplied item iteration uses 0x50-byte slots starting at hero+0x1090, making slot one +0x10E0; this corroborates the semantic moby access rather than relying on offset alone. --- src/overlays/shared/hero/hero_idle_sequence.c | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 1131db2893..c43ff9d610 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -3399,19 +3399,19 @@ typedef struct { u8 pad30E[0x110]; s16 h41E; u8 pad420[0xCC0]; - u8 *p10E0; + u8 *slot_one_item_moby; u8 pad10E4[0x1FC]; s16 h12E0; u8 b12E2; - u8 b12E3; + u8 idle_exit_transition_selected; u8 b12E4; - u8 b12E5; - u8 b12E6; + u8 death_descent_transition_selected; + u8 jump_or_respawn_wait_transition_selected; u8 b12E7; u8 pad12E8[0x2]; u8 b12EA; - u8 b12EB; - u8 b12EC; + u8 respawn_wait_transition_selected; + u8 sink_transition_selected; u8 b12ED; u8 b12EE; u8 pad12EF[0xD95]; @@ -3423,7 +3423,7 @@ typedef struct { u8 pad20A5[0x4]; u8 b20A9; u8 pad20AA[0x1FA]; - f32 f22A4; + f32 selected_height_difference; s32 i22A8; } P20b960; @@ -3446,68 +3446,68 @@ void apply_hero_selected_flags_and_state_transitions(void) { if (saved_flag_selector == 2) { if (P.h30C == 0 || P.f2DC < 0.3f) { P.b12E7 = 1; - if (P.b20A4 == 0 && P.p10E0 != 0 && *(s16 *)(P.p10E0 + 0xA6) == 0xAD) + if (P.b20A4 == 0 && P.slot_one_item_moby != 0 && *(s16 *)(P.slot_one_item_moby + 0xA6) == 0xAD) P.h308 = 1; } } if (saved_flag_selector == 14) { P.b12E4 = 1; - P.f22A4 = 0.2f; + P.selected_height_difference = 0.2f; P.f2F0 = P.f2D8 + 0.2f; } if (saved_flag_selector == 0) { height_difference = P.f2F0 - P.f2D8; - P.f22A4 = height_difference; + P.selected_height_difference = height_difference; if (height_difference < 0.85f && 0.25f < height_difference) P.b20A9 = 1; P.b12E4 = 1; } if (saved_flag_selector == 3) - P.b12E6 = 1; + P.jump_or_respawn_wait_transition_selected = 1; if (current_level_index == 13 && P.i2084 != 0x7B && coll_sphere((u8 *)&P + 0xD0, 2, 0, P.f234 + 0.03f) && FUN_001f0b58_20b960() == 11) { goto s7B; } if (saved_flag_selector == 11) - P.b12EB = 1; + P.respawn_wait_transition_selected = 1; if (saved_flag_selector == 2) P.b12E7 = 1; if (saved_flag_selector == 4) - P.b12E3 = 1; + P.idle_exit_transition_selected = 1; if (saved_flag_selector == 7) P.b12E2 = 1; if (saved_flag_selector == 13) - P.b12EC = 1; + P.sink_transition_selected = 1; if (saved_flag_selector == 1) - P.b12E5 = 1; + P.death_descent_transition_selected = 1; if (saved_flag_selector == 8) P.b12EA = 1; if (saved_flag_selector == 9) P.b12EE = 1; if (saved_flag_selector == 12) P.b12EA = 1; - if (P.b12E3 && P.i300 && P.i208C != 0x10 && P.i208C != 0x14 && P.i208C != 7) { + if (P.idle_exit_transition_selected && P.i300 && P.i208C != 0x10 && P.i208C != 0x14 && P.i208C != 7) { target_state = HERO_STATE_VOICE_SLOT_CLEANUP_IDLE_EXIT; goto call; } - if (P.b12E5 && P.i300 && P.b20A4 == 1 && P.i2084 != 0x7D) { + if (P.death_descent_transition_selected && P.i300 && P.b20A4 == 1 && P.i2084 != 0x7D) { target_state = HERO_STATE_VEHICLE_MODE_1_DEATH_DESCENT; goto call; } - if (P.b12E5 && P.i300 && (P.i2084 != 0x3C || P.h41E != 0)) { + if (P.death_descent_transition_selected && P.i300 && (P.i2084 != 0x3C || P.h41E != 0)) { exit_hero_vehicle_mode_if_mode_three(); if (P.i22A8) goto call3c; target_state = HERO_STATE_DEATH_DESCENT; goto call; } - if (P.b12EC && P.i2084 != 0x7F && absolute_float(P.f2F0 - (P.f88 + 0.25f)) < 1.0f && + if (P.sink_transition_selected && P.i2084 != 0x7F && absolute_float(P.f2F0 - (P.f88 + 0.25f)) < 1.0f && 0.0f < P.f2F0 - P.f88 && P.f108 < 0.0f) { exit_hero_vehicle_mode_if_mode_three(); target_state = HERO_STATE_SINK; goto call; } - if (P.b12E6 && P.i2084 != 0x68 && P.i2084 != 0x7B && + if (P.jump_or_respawn_wait_transition_selected && P.i2084 != 0x68 && P.i2084 != 0x7B && absolute_float(P.f2F4 - (P.f88 + 0.25f)) < 1.0f && 0.0f < P.f2F4 - P.f88 && (P.i2084 != 0x69 || P.h41E != 0) && P.f108 < 0.0f) { exit_hero_vehicle_mode_if_mode_three(); @@ -3524,7 +3524,7 @@ void apply_hero_selected_flags_and_state_transitions(void) { target_state = HERO_STATE_JUMP_WITH_HEALTH_DAMAGE; goto call; } - if (P.b12EB && P.i2084 != 0x7B && absolute_float(P.f2F4 - (P.f88 + 0.25f)) < 1.0f && + if (P.respawn_wait_transition_selected && P.i2084 != 0x7B && absolute_float(P.f2F4 - (P.f88 + 0.25f)) < 1.0f && 0.0f < P.f2F4 - P.f88 && P.f108 < 0.0f) { exit_hero_vehicle_mode_if_mode_three(); hero_set_state(0x7B, 1); From 5b494098abb6ff3156be8595395e38dc127d5137 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:06:40 +0000 Subject: [PATCH 342/758] decomp: clarify names in apply_hero_reference_tilt domain_0_value_2 -> HERO_GRAVITY_TOWARD_REFERENCE_POINT: The supplied update_hero_tilt C loads hero_state->gravity_mode; checked retail caller 0x002165CC-0x002165DC loads that selector from hero base 0x13F350 +0x20B3 and 0x002166DC-0x002166EC dispatches values 1/2 to this function. Assigned retail 0x00216480-0x002164A4 compares that identical byte to 2 and negates hero+0x290 for the reference input. Thus P.reference_tilt_mode is the shared HeroGravityMode selector, whose supplied canonical member for 2 is HERO_GRAVITY_TOWARD_REFERENCE_POINT. domain_1_value_1 -> HERO_GRAVITY_OPPOSITE_GROUND_NORMAL: Checked caller 0x002165DC loads hero+0x20B3, identified as hero_state->gravity_mode in supplied source, before dispatch to apply_hero_reference_tilt at 0x002166EC. Assigned 0x002164A8-0x002164B0 reloads the same byte and compares it to 1; 0x002164B8-0x002164E8 gates a copy of the primary reference vector by s30E and f2DC. This proves the selector belongs to supplied shared HeroGravityMode, so reuse canonical value-1 HERO_GRAVITY_OPPOSITE_GROUND_NORMAL rather than a state or vehicle constant. domain_2_value_1 -> HERO_GRAVITY_OPPOSITE_GROUND_NORMAL: Assigned retail 0x00216538-0x00216544 reloads hero base 0x13F350 +0x20B3 and compares it to 1, then 0x0021654C-0x00216588 gates the position-offset correction on nonzero hero+0x30E. The checked caller 0x002165CC-0x002165E4 and supplied update_hero_tilt C identify this same stored selector as hero.gravity_mode (before a separate effective-mode override). Therefore this comparison shares the proven HeroGravityMode domain and canonical value-1 HERO_GRAVITY_OPPOSITE_GROUND_NORMAL. --- 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 e91343394d..e62557c907 100644 --- a/src/overlays/shared/hero/hero_move_state_velocity.c +++ b/src/overlays/shared/hero/hero_move_state_velocity.c @@ -612,10 +612,10 @@ void apply_hero_reference_tilt(void) { pitch_smoothing_parameter = frame_scale_sq * 0.3f; FUN_001f9d20_2163f0(&original_position_offset, &original_position_offset, &P); reference_vector.q = P.primary_tilt_reference_vector.q; - if (P.reference_tilt_mode == 2) { + if (P.reference_tilt_mode == HERO_GRAVITY_TOWARD_REFERENCE_POINT) { FUN_001f9a68_2163f0(&reference_vector, &P.alternate_tilt_reference_vector, -1.0f); } - if (P.reference_tilt_mode == 1) { + if (P.reference_tilt_mode == HERO_GRAVITY_OPPOSITE_GROUND_NORMAL) { if (P.s30E < FUN_001f96f8_2163f0(10) || P.f2DC < 1.0f) { reference_vector.q = P.primary_tilt_reference_vector.q; } @@ -629,7 +629,7 @@ void apply_hero_reference_tilt(void) { pitch_smoothing_parameter, 0.0f, 0); - if (P.reference_tilt_mode == 1 && P.s30E != 0) { + if (P.reference_tilt_mode == HERO_GRAVITY_OPPOSITE_GROUND_NORMAL && P.s30E != 0) { FUN_001f9d20_2163f0( &transformed_position_offset, &transformed_position_offset, working_matrix); fast_vec_sub(&P.hero_position, &P.hero_position, &transformed_position_offset); From be01c86f13f48b2f56d4abb92bbb64a9ad3c975a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:06:44 +0000 Subject: [PATCH 343/758] decomp: clarify names in prepare_target_level_transition domain_1_value_3 -> TRANSITION_MODE_CHANGE_LEVEL: Retail 0x0028edfc branches here only when current_level_index differs from incoming target_level_index. At 0x0028ee74-0x0028ee7c it calls memcard_save_data(0,target_level_index); 0x0028ee8c stores that destination at D_L00_0015F5C0 and 0x0028ee84/0x0028ee90 selects 3 in the shared transition_mode at 0x0013e030+0x20. The same-level branch instead initializes audio and sequence position. Thus 3 selects a change to another level in this transition-control domain, independent of equal-valued hero state IDs. i8 -> default_scene_chunk_offset: In the authoritative C, B_0028ed58.i8 is added to shared_table_offset and stored in shared_result_record->i5C. Retail 0x0028edd4 loads 0x00173e08, 0x0028edec adds the relocation adjustment, and 0x0028edf4 stores the sum at 0x0016c8bc. Checked direct helper parse_space_scene_chunk at 0x00245724-0x00245744 temporarily replaces that same +0x5c slot with the selected sequence entry from +0x60 before parsing. Its 0x00245750-0x00245760 then reloads 0x00173e08, adds D_L00_001611CC, and restores +0x5c. This proves i8 is the offset used to restore the default scene-chunk cursor, rather than an arbitrary numbered field. --- .../shared/game/initialize_level_transition_with_audio.c | 9 ++++++--- 1 file changed, 6 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 e0c6230b55..c45d07bf5f 100644 --- a/src/overlays/shared/game/initialize_level_transition_with_audio.c +++ b/src/overlays/shared/game/initialize_level_transition_with_audio.c @@ -227,7 +227,7 @@ extern A_0028ed58 level_render_state_lui __asm__("D_0013E030") NOT_SDA; typedef struct { s32 i0; s32 i4; - s32 i8; + s32 default_scene_chunk_offset; } B_0028ed58; extern B_0028ed58 D_L00_00173E00_0028ed58 __asm__("D_L00_00173E00") @@ -250,6 +250,9 @@ extern s32 transition_sequence_positions[1] __asm__("D_L00_00160570") __attribut void prepare_target_level_transition(s32 target_level_index) __asm__("FUN_L00_0028ed58"); void prepare_target_level_transition(s32 target_level_index) { + enum { + TRANSITION_MODE_CHANGE_LEVEL = 3 + }; A_0028ed58 *shared_state_record = &level_render_state_lui; C_0028ed58 *shared_result_record; s32 shared_table_offset; @@ -263,7 +266,7 @@ void prepare_target_level_transition(s32 target_level_index) { shared_table_offset = D_L00_001611CC - 0x60000; shared_result_record = &D_L00_0016C860_0028ed58; shared_result_record->i58 = D_L00_00173E00_0028ed58.i4 + shared_table_offset; - shared_result_record->i5C = D_L00_00173E00_0028ed58.i8 + shared_table_offset; + shared_result_record->i5C = D_L00_00173E00_0028ed58.default_scene_chunk_offset + shared_table_offset; D_L00_001611CC = shared_table_offset; if (current_level_index == target_level_index) { s32 divisor; @@ -277,7 +280,7 @@ void prepare_target_level_transition(s32 target_level_index) { } else { memcard_save_data(0, target_level_index); D_L00_0015F5C0 = target_level_index; - shared_state_record->transition_mode = 3; + shared_state_record->transition_mode = TRANSITION_MODE_CHANGE_LEVEL; shared_state_record->h24 = -1; } } From 93cb1c6ca1666f9c485ed4c18cc25b8174dbea82 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:09:02 +0000 Subject: [PATCH 344/758] decomp: clarify names in follow_camera_approach unkDA -> target_height_override_pending: Retail 0x002e5f08 loads the short at target+0xDA and 0x002e5f0c branches on zero: nonzero loads interpolation destination from target+0xB4 at 0x002e5f1c, while zero loads default_target+0xB0 at 0x002e5f20. The call at 0x002e5f38 updates target+0xB0 at 0x002e5f40; 0x002e5f70 clears the selector afterward. The authoritative rebuild_follow_camera_pose source scales the followed object's up vector by target+0xB0 to construct the eye, and follow_camera_setup seeds this scalar to 1.5f. These uses prove a pending target eye-height override selector, rather than an inferred meaning from offset alone. --- src/overlays/shared/camera/follow_camera_setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 29431252ff..2f6a77ca83 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -49,7 +49,7 @@ typedef struct { char padB8[0x1E]; unsigned char unkD6; char padD7[3]; - short unkDA; + short target_height_override_pending; float unkDC; float unkE0; float unkE4; @@ -154,7 +154,7 @@ void follow_camera_approach(unsigned char *moby) { ((CamOrbit *)orbit)->unk40 = 0; ((CamOrbit *)orbit)->unk4C = 0; ((CamOrbit *)orbit)->unk58 = ((CamOrbit *)default_orbit)->unk2C; - ((CamTarget *)target)->unkDA = 0; + ((CamTarget *)target)->target_height_override_pending = 0; ((CamTarget *)target)->unkB4 = 0; (*(Cam_2e5e38 **)(moby + 0x70))->unk10 = 1; (*(Cam_2e5e38 **)(moby + 0x70))->unk22 = 0; From ce486e798fe8c5e8aff67a83b89cc7066ea7581b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:09:05 +0000 Subject: [PATCH 345/758] decomp: clarify names in update_sound_emitter_playback_by_distance b18 -> use_voice_flag_4: In the SHA-256-bound distance_emitter.c source, T_2ed950 is the 0x20-stride voice-definition record indexed by playback_state->id. Retail 0x002ed9a0-0x002ed9c4 indexes that same definition and loads byte +0x18. At 0x002ed9c0/0x002ed9c8/0x002ed9d8, s2 starts at zero and becomes 4 exactly when this byte is nonzero. Retail 0x002ed9f4 moves s2 to a1 for play_voice at 0x002eda00. Checked play_voice 0x0028de08-0x0028de24 forwards a1 unchanged to allocate_voice_slot; supplied named play_voice context identifies it as voice_flags. Thus this field selects use of voice flag 4, without claiming the unresolved behavior of that flag. --- src/overlays/shared/audio/emitters/distance_emitter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/audio/emitters/distance_emitter.c b/src/overlays/shared/audio/emitters/distance_emitter.c index 7e1502ac84..17e8dc175c 100644 --- a/src/overlays/shared/audio/emitters/distance_emitter.c +++ b/src/overlays/shared/audio/emitters/distance_emitter.c @@ -26,7 +26,7 @@ typedef struct { typedef struct { u8 p[0x18]; - u8 b18; + u8 use_voice_flag_4; u8 p2[7]; } T_2ed950; @@ -65,7 +65,7 @@ void update_sound_emitter_playback_by_distance(u8 *sound_emitter) { E_2ed950 *e = ENT_2ed950(playback_state->snd); s32 fl = 0; s32 four = 4; - if (D_L00_0015F5F4_2ed950[playback_state->id].b18) + if (D_L00_0015F5F4_2ed950[playback_state->id].use_voice_flag_4) fl = four; if (e->o == sound_emitter && e->is_active) return; From d4f69d310d476ae4f869e8cf0467079d96b87238 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:11:20 +0000 Subject: [PATCH 346/758] decomp: clarify names in link_triggered_moby_motion_update f57 -> motion_triggered: In authoritative C and original retail 0030eac8-0030eae4, the linked class/state or command checks select the activation branch. Retail 0030eaec-0030eaf4 changes moving_moby->state to 2, whose dispatch at 0030e9c0 enters local-axis movement at 0030eb24-0030eb6c. In the same activation branch, 0030eaf0-0030eb18 forms base 0013d388 plus private_data+0x14, then stores byte 1 at +0x57 (Rec57.f57), immediately before the voice call returns. Thus this field marks that linked motion was triggered; the name does not assert subsequent reads or persistence. --- src/overlays/l11/mobys/link_triggered_moby_motion.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l11/mobys/link_triggered_moby_motion.c b/src/overlays/l11/mobys/link_triggered_moby_motion.c index 83de84ea61..b98e684504 100644 --- a/src/overlays/l11/mobys/link_triggered_moby_motion.c +++ b/src/overlays/l11/mobys/link_triggered_moby_motion.c @@ -18,7 +18,7 @@ typedef struct { char pad[0x57]; - char f57; + char motion_triggered; } Rec57; extern float fast_add_rotations(float, float); @@ -79,7 +79,7 @@ void link_triggered_moby_motion_update(struct Moby *moving_moby) { if (linked_moby->oclass == 0x33E && linked_moby->command != 0) { go: moving_moby->state = LINKED_MOTION_STATE_MOVE_ALONG_LOCAL_AXIS; - ((Rec57 *)(private_data->unk14 + (int)(alternate_item_available)))->f57 = 1; + ((Rec57 *)(private_data->unk14 + (int)(alternate_item_available)))->motion_triggered = 1; allocate_voice_for_target_entry(0, 0, moving_moby); } break; From 36fd3a5676a7d65829523c583a78f7b4caae8188 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:14:01 +0000 Subject: [PATCH 347/758] decomp: clarify names in check_ledge_grab m18 -> hit_moby: After the ledge surface collision and slope/material tests at 0x0020c24c-0x0020c2b0, retail 0x0020c2d8 loads collision record D_L00_00173E40+0x18 into a0 and null-checks it. The same pointer is passed to object helpers at 0x0020c2e4 and 0x0020c2f0 to test grabbability. Retail 0x0020c348/0x0020c358 copies it to hero+0x4f8, named ledge_moby in the bound C. All corresponding C uses are Hit_20C568.m18, proving this is the collision-hit moby rather than a material or metadata pointer. --- src/overlays/shared/hero/hero_idle_sequence.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index c43ff9d610..49b206243f 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -3540,7 +3540,7 @@ typedef struct Hero Hero; typedef struct { char p0[0x18]; - char *m18; + char *hit_moby; char p1C[4]; float v20[4]; char p30[0x10]; @@ -3658,10 +3658,10 @@ void check_ledge_grab(void) { if (!found) return; - if (((Hit_20C568 *)((char *)D_L00_00173E40))->m18 != 0) { + if (((Hit_20C568 *)((char *)D_L00_00173E40))->hit_moby != 0) { grabbable = 0; - moby_info = get_moby_target_info(((Hit_20C568 *)((char *)D_L00_00173E40))->m18); - moby_props = FUN_L00_002603d0(((Hit_20C568 *)((char *)D_L00_00173E40))->m18); + moby_info = get_moby_target_info(((Hit_20C568 *)((char *)D_L00_00173E40))->hit_moby); + moby_props = FUN_L00_002603d0(((Hit_20C568 *)((char *)D_L00_00173E40))->hit_moby); if (moby_info != 0 && (moby_info->h1E & 1)) { grabbable = 1; } else if (moby_props != 0) { @@ -3670,7 +3670,7 @@ void check_ledge_grab(void) { if (!grabbable) return; } - ((Hero *)D_0013F450_20C568)->ledge_moby = (s32)(((Hit_20C568 *)((char *)D_L00_00173E40))->m18); + ((Hero *)D_0013F450_20C568)->ledge_moby = (s32)(((Hit_20C568 *)((char *)D_L00_00173E40))->hit_moby); if (((Hero *)D_0013F450_20C568)->motion.pos.f[2] + up < ((Hit_20C568 *)((char *)D_L00_00173E40))->v20[2]) return; From 2fc2839fb1ffa96ab3d2ee5bc3e48e3a0268e31f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:16:24 +0000 Subject: [PATCH 348/758] decomp: clarify names in update_hero_water_height_and_bobbing domain_0_value_22 -> WATER_HEIGHT_CONTROL_ALTERNATE_TARGET: Retail 0x00227f18 loads 0x16, 0x00227f1c loads hero+0x208C (source G.water_height_control_mode), and 0x00227f20 branches on inequality. Its delay slot 0x00227f24 loads normal water_surface_height_target (+0x2F0) into f12; equality executes 0x00227f28 and replaces f12 with alternate_water_height_target (+0x8A0). At 0x00227f34-0x00227f60 f12 is the vendor_spring target for smoothed_water_height (+0x69C), velocity +0x6A0. Thus this control mode selects the alternate height target. It is not HeroStateId/HERO_STATE_HURT despite equal numeric value. --- src/overlays/shared/hero/hero_set_state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index 2bd6d468d3..ffe8743ff8 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3192,6 +3192,9 @@ void approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); void update_hero_water_height_and_bobbing(void) __asm__("FUN_L00_00227d40"); 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 || G.i20A0 == 0x11) { if (G.i2084 == 0x36) { vendor_spring(&G.water_bob_offset, @@ -3215,7 +3218,7 @@ void update_hero_water_height_and_bobbing(void) { } if (G.i2084 != 0x7F) { f32 target_height = G.water_surface_height_target; - if (G.water_height_control_mode == 0x16) + if (G.water_height_control_mode == WATER_HEIGHT_CONTROL_ALTERNATE_TARGET) target_height = G.alternate_water_height_target; vendor_spring( &G.smoothed_water_height, &G.water_height_spring_velocity, target_height, frame_scale_sq * 0.027f, frame_scale_sq * 0.3f, 0.0f); From d15cc842f4418358f03e1237cb3c79d2988575e3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:16:28 +0000 Subject: [PATCH 349/758] decomp: clarify names in phase_effect_controller_update unkB -> initial_duration_frames: In authoritative cutscene_effects.c, part->unkA = scale_game_frames_s32(60) immediately precedes tail->unkB = part->unkA at successful puff creation. Retail 0x002e3a34-0x002e3a3c calls the frame scaler with 0x3c and stores the duration halfword at puff+0xa; 0x002e3a4c-0x002e3a50 loads its low byte and copies it to tail+0xb (puff+0x2b). Thus this byte snapshots the initial scaled duration in frames, without claiming how a later consumer uses it. Checked spawn_puff helper 0x0026d0f8-0x0026d108 independently initializes that same source halfword from scale_game_frames_s32(10), supporting the frame-duration interpretation. --- src/overlays/l00/mobys/cutscene_effects.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l00/mobys/cutscene_effects.c b/src/overlays/l00/mobys/cutscene_effects.c index 75ac6e6b5f..b687a96f78 100644 --- a/src/overlays/l00/mobys/cutscene_effects.c +++ b/src/overlays/l00/mobys/cutscene_effects.c @@ -28,7 +28,7 @@ typedef struct { s32 unk4; u8 pad8[2]; u8 unkA; - u8 unkB; + u8 initial_duration_frames; } FlockTail; typedef struct { @@ -114,7 +114,7 @@ void phase_effect_controller_update(FlockMoby *moby) { part->unkA = scale_game_frames_s32(60); tail->unk4 = 2; tail->unkA = color >> 24; - tail->unkB = part->unkA; + tail->initial_duration_frames = part->unkA; } } } From eb4862e16cc3abe6fd3e454955f3d318f2bd3deb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:16:31 +0000 Subject: [PATCH 350/758] decomp: clarify names in apply_hero_reference_tilt s1F8 -> reference_tilt_override: Checked caller update_hero_tilt at 0x002165DC loads hero+0x20B3 into a0; 0x002165E0 loads signed short hero+0x1F8 and 0x002165E4 movn replaces a0 with 1 when that short is nonzero. Dispatch at 0x002166DC-0x002166EC then calls apply_hero_reference_tilt, bypassing return-to-zero tilt. Supplied C independently expresses this as if (hero_state->unk1F8) effective_tilt_mode = HERO_TILT_APPLY_REFERENCE_ORIENTATION. The assigned P_2163f0.s1F8 is that same short, loaded at 0x002164FC and tested at 0x00216500; together with nonzero s30E it selects frame_scale_sq * 0.001f pitch smoothing at 0x00216518 instead of *0.3f. These operations prove the reference-tilt override role without assuming the gameplay cause. --- src/overlays/shared/hero/hero_move_state_velocity.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/hero/hero_move_state_velocity.c b/src/overlays/shared/hero/hero_move_state_velocity.c index e62557c907..8023f15877 100644 --- a/src/overlays/shared/hero/hero_move_state_velocity.c +++ b/src/overlays/shared/hero/hero_move_state_velocity.c @@ -572,7 +572,7 @@ typedef struct { unsigned char pad0[0x80]; V_2163f0 hero_position; unsigned char pad90[0x1F8 - 0x90]; - short s1F8; + short reference_tilt_override; unsigned char pad1FA[0x270 - 0x1FA]; V_2163f0 primary_tilt_reference_vector; unsigned char pad280[0x10]; @@ -620,7 +620,7 @@ void apply_hero_reference_tilt(void) { reference_vector.q = P.primary_tilt_reference_vector.q; } } - if (P.s30E != 0 && P.s1F8 != 0) { + if (P.s30E != 0 && P.reference_tilt_override != 0) { pitch_smoothing_parameter = frame_scale_sq * 0.001f; } FUN_L00_00216130_2163f0(&reference_vector, From 520a9e6f0bb77e37c1e588ee61846664b7621f97 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:16:34 +0000 Subject: [PATCH 351/758] decomp: clarify names in update_arc_motion b2C -> arc_entry_animation: Rename the sole eligible private field S_25b440.b2C to arc_entry_animation. Authoritative C src/overlays/shared/mobys/find_moby_hit.c SHA-256 0e25a0e2dfea45b6b0bd10c92351b7ca61f66af196a3dd850fb7d5af0fd1d53f, original retail decompilation and R5900 instructions agree: CHECK_ARC_ENTRY_GATES loads object+0x52 at 0x25b478 and state+0x2c at 0x25b49c; mismatch at 0x25b4a0 returns without integration. Supplied doom_bot_update context blends hp->config.anim2C before DOOM_BOT_EXECUTE_JUMP calls update_arc_motion with that config. Bounded retail helper 0x257880 (request 9d8ef44e865245f5a1122a114f2d9d4c) retains the animation argument in s3, indexes the animation table using it at 0x2578a8-0x2578c8, and stores it to object+0x53 at 0x257964; +0x52 is preserved to +0xa5 or invalidated during blending at 0x257938-0x257948. Bounded compute_interpolated_record_value (request bf75570ba0b5431ab7f6914ca405ed48) compares +0x52 with +0x53 at 0x24ee0c/0x24ee28-0x24ee2c and uses +0x52 validity to select the current record at 0x24ede4-0x24edf0. Together these establish an animation identity required by the entry gate, distinct from existing arc_motion_animation used for the subsequent blend. --- src/overlays/shared/mobys/find_moby_hit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/mobys/find_moby_hit.c b/src/overlays/shared/mobys/find_moby_hit.c index dbf35b78cd..ba778ad781 100644 --- a/src/overlays/shared/mobys/find_moby_hit.c +++ b/src/overlays/shared/mobys/find_moby_hit.c @@ -798,7 +798,7 @@ typedef struct { unsigned char pad20[4]; float arc_entry_record_value_threshold; float f28; - unsigned char b2C; + unsigned char arc_entry_animation; unsigned char arc_motion_animation; unsigned char b2E; unsigned char state; @@ -843,7 +843,7 @@ int update_arc_motion(O_25b440 *moving_object, S_25b440 *arc_motion_state) { switch (arc_motion_state->state) { case CHECK_ARC_ENTRY_GATES: - if (moving_object->b52 != arc_motion_state->b2C) { + if (moving_object->b52 != arc_motion_state->arc_entry_animation) { break; } if (compute_interpolated_record_value(moving_object) <= arc_motion_state->arc_entry_record_value_threshold) { From 33bc62441cb854f9635fae9a05ea547e0b6e1809 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:16:34 +0000 Subject: [PATCH 352/758] decomp: clarify names in update_chomper_hit_reaction_and_target domain_0_value_2 -> CHOMPER_TARGET_SELECTION_REJECTED: Retail 0x002e6384 loads status 2 into s2; after target selection, 0x002e6398-0x002e63ac stores it to pvars+0x1c4 when target XY distance from home exceeds 16, and 0x002e63b0-0x002e63dc stores it when absolute target height separation exceeds 3. Original Ghidra confirms both stores. Authoritative C identifies +0x1c4 as target_selection_status; chomper_update tests that same field (ChomperVars.unk1C4), withholding approach in CHOMPER_WAIT_TO_APPROACH_TARGET and selecting CHOMPER_RETURN_HOME from CHOMPER_APPROACH_TARGET when it equals 2. Thus this is rejected target selection in the chomper pursuit-status domain, not a Hero state or mode. --- src/overlays/l16/mobys/chomper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l16/mobys/chomper.c b/src/overlays/l16/mobys/chomper.c index 3a7a655fe3..f660e23f11 100644 --- a/src/overlays/l16/mobys/chomper.c +++ b/src/overlays/l16/mobys/chomper.c @@ -255,6 +255,9 @@ extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); void update_chomper_hit_reaction_and_target(void *chomper_instance) { + enum { + CHOMPER_TARGET_SELECTION_REJECTED = 2 + }; L16PursuitMoby *chomper_moby = chomper_instance; L16PursuitData *pursuit_data = chomper_moby->data; char *hit; @@ -308,7 +311,7 @@ void update_chomper_hit_reaction_and_target(void *chomper_instance) { *(int *)reaction_kind_or_path_address) != 2) { if (vector_distance_xy(pursuit_data->home, pursuit_data->target) > 16.0f || absolute_float(chomper_moby->position[2] - pursuit_data->target[2]) > 3.0f) { - pursuit_data->target_selection_status = 2; + pursuit_data->target_selection_status = CHOMPER_TARGET_SELECTION_REJECTED; } } if (pursuit_data->target_moby == 0) { From f6cc2044a1581bca057d844a0e74e944046d8a35 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:18:43 +0000 Subject: [PATCH 353/758] decomp: clarify names in update_nanotech_ball_collection_effects p78 -> collection_effect_state: In authoritative nanotech_ball.c SHA-256 09f9c1e62b3a83929afd18a1c2ebf13a7ff0b8069e52703f7c9e341ddd4a0704, M_2d8510.p78 is assigned to effect_data. Retail 0x002d8560 loads this pointer into s8 (Ghidra iVar2 = *(int *)(param_1 + 0x78)); 0x002d8578 and 0x002d85d0 select/decrement its four s16 timers at +0x58. The +0x60 floats are advanced by particle_rotation_steps and wrapped at 255 (0x002d85f8-0x002d8668), then truncated as initial_rotation for paired particle calls at 0x002d8730-0x002d8760 and 0x002d8784-0x002d87c0. Timers also drive color/alpha and size. These uses prove collection-effect state rather than deriving meaning from offset alone; nanotech_ball_update initializes the same h58/f60 arrays in moby->pvars and invokes this function in collecting state. --- 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 82f86b1d7b..877586c454 100644 --- a/src/overlays/shared/pickups/nanotech_ball.c +++ b/src/overlays/shared/pickups/nanotech_ball.c @@ -104,7 +104,7 @@ typedef struct { u8 p0[0x10]; V_2d8510 v10; u8 p20[0x58]; - O_2d8510 *p78; + O_2d8510 *collection_effect_state; } M_2d8510; typedef struct { @@ -1144,7 +1144,7 @@ s32 update_nanotech_ball_collection_effects(M_2d8510 *moby) { s32 i, any_effect_timer_above_threshold, c, hi, al; f32 z, color_progress_or_size_factor, unwrapped_effect_value; u8 *effect_record; - effect_data = moby->p78; + effect_data = moby->collection_effect_state; fast_vec_sub(&effect_position, &(*(V_2d8510 *)g_debug_camera), &moby->v10); any_effect_timer_above_threshold = 0; fast_vec_normalize(&effect_position, &effect_position, -0.3f); From 61569ecb8517ea25e9facf13c11479eb9fc9638b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:18:46 +0000 Subject: [PATCH 354/758] decomp: clarify names in camera_transition_update f98 -> transition_heading_angle: Retail 0x002ea5cc and 0x002ea5d0 load float +0x98 from base 0x0013f350 for cosine and sine; 0x002ea5d8/0x002ea5f8 store these as X/Y, with Z zero at 0x002ea5dc, and 0x002ea5f4 passes that direction to set_follow_camera_angle_blend_from_direction. The same heading construction repeats at 0x002ea738-0x002ea768 during the timed transition tail. Bound C identifies these loads as P.f98, proving its transition-heading angle role. i2284 -> camera_mode_request: Retail 0x002ea4cc loads word +0x2284 from 0x0013f350 into a2, corresponding to g->i2284 and existing requested_camera_mode in bound C. At 0x002ea4d4-0x002ea4dc it is compared to transition_camera_record's signed +0x86 mode; 0x002ea4e4-0x002ea4e8 also permits CAMERA_REQUEST_BYPASS_MODE_MATCH (0x51). This proves the field is the camera-mode request consumed by transition steering, without assuming its entire domain. i24 -> transition_angle_blend_timer: Retail 0x002ea580 clears descriptor +0x24 on entering the matched transition; 0x002ea718-0x002ea720 stores the converted duration from FUN_001f96f8(30). At 0x002ea724-0x002ea730 a nonzero field causes fast_dec_timer(&q->i24); only that nonzero path builds the heading direction and calls set_follow_camera_angle_blend_from_direction at 0x002ea764 with 0.1396263391. Thus this s32 field counts down the transition angle-blend interval. p2080 -> hero_moby: Retail 0x002ea65c/0x002ea67c loads the pointer at hero base 0x0013f350 +0x2080, then adds 0xC0 at 0x002ea668/0x002ea690 to project its direction against the comparison axis and subtract that projection into transition_hero_vector_residual. Bound C's select_camera_mode_by_hero_vector_alignment performs the identical axis/dot/scale/subtract operation with ((char *)hero.moby)+0xC0 and hero_vector_residual; the adjacent hero-aligned pose routines likewise use hero.moby as the hero's basis object. This ties g->p2080 to the hero moby, beyond its storage offset. --- .../shared/camera/hero_aligned_camera.c | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/overlays/shared/camera/hero_aligned_camera.c b/src/overlays/shared/camera/hero_aligned_camera.c index 5b9fb01f8f..2359aa659c 100644 --- a/src/overlays/shared/camera/hero_aligned_camera.c +++ b/src/overlays/shared/camera/hero_aligned_camera.c @@ -42,7 +42,7 @@ typedef struct { u8 p0[0x20]; s16 h20; s16 h22; - s32 i24; + s32 transition_angle_blend_timer; } Q_2ea488; typedef struct { @@ -52,11 +52,11 @@ typedef struct { typedef struct { u8 p0[0x98]; - f32 f98; + f32 transition_heading_angle; u8 p1[0x2080 - 0x9C]; - char *p2080; + char *hero_moby; u8 p2[0x2284 - 0x2084]; - s32 i2284; + s32 camera_mode_request; } P_2ea488; typedef struct { @@ -435,7 +435,7 @@ int camera_transition_update(u8 *transition_camera_record, char *mode_check_obje q = D_L00_0015EF50_2ea488[*(s16 *)(transition_camera_record + 0x84)].q; g = &P; - requested_camera_mode = g->i2284; + requested_camera_mode = g->camera_mode_request; if (requested_camera_mode == *(s16 *)(transition_camera_record + 0x86) || requested_camera_mode == CAMERA_REQUEST_BYPASS_MODE_MATCH) { active_transition_camera_record = D_L00_00166E00_lui; @@ -451,7 +451,7 @@ int camera_transition_update(u8 *transition_camera_record, char *mode_check_obje r = find_camera_collision_volume_for_point(&transition_vector_scratch, 0.25f); if (r && (*(s32 *)(r + 0x18) & 1)) return 0; - q->i24 = 0; + q->transition_angle_blend_timer = 0; q->h22 = 1; q->h20++; if (q->h20 >= FUN_001f96f8_2ea488(7)) { @@ -459,8 +459,8 @@ int camera_transition_update(u8 *transition_camera_record, char *mode_check_obje transition_camera_record[0x7C] = 5; return 1; } - transition_vector_scratch.f[0] = fast_cos(P.f98); - transition_vector_scratch.f[1] = fast_sin(P.f98); + transition_vector_scratch.f[0] = fast_cos(P.transition_heading_angle); + transition_vector_scratch.f[1] = fast_sin(P.transition_heading_angle); *(s32 *)&transition_vector_scratch.f[2] = 0; set_follow_camera_angle_blend_from_direction( &transition_vector_scratch, 0.06981316953897476f, transition_vector_scratch.f[2]); @@ -486,9 +486,9 @@ int camera_transition_update(u8 *transition_camera_record, char *mode_check_obje &transition_vector_scratch); FUN_001f9a68_2ea488(&transition_vector_scratch, alignment_comparison_axis, - FUN_001f9ab0_2ea488(alignment_comparison_axis, g->p2080 + 0xC0)); + FUN_001f9ab0_2ea488(alignment_comparison_axis, g->hero_moby + 0xC0)); FUN_001f9a28_2ea488( - &transition_hero_vector_residual, g->p2080 + 0xC0, &transition_vector_scratch); + &transition_hero_vector_residual, g->hero_moby + 0xC0, &transition_vector_scratch); transition_residual_length_product = FUN_001f9af0_2ea488(&transition_hero_vector_residual); if (transition_residual_length_product != 0.0f) { transition_residual_length_product *= @@ -503,12 +503,12 @@ int camera_transition_update(u8 *transition_camera_record, char *mode_check_obje return 0; } } - q->i24 = FUN_001f96f8_2ea488(30); + q->transition_angle_blend_timer = FUN_001f96f8_2ea488(30); tail: - if (q->i24) { - fast_dec_timer(&q->i24); - transition_vector_scratch.f[0] = fast_cos(P.f98); - transition_vector_scratch.f[1] = fast_sin(P.f98); + if (q->transition_angle_blend_timer) { + fast_dec_timer(&q->transition_angle_blend_timer); + transition_vector_scratch.f[0] = fast_cos(P.transition_heading_angle); + transition_vector_scratch.f[1] = fast_sin(P.transition_heading_angle); *(s32 *)&transition_vector_scratch.f[2] = 0; set_follow_camera_angle_blend_from_direction( &transition_vector_scratch, 0.13962633907794952f, transition_vector_scratch.f[2]); From 5f0fbc6206ff2dd51b0568b6f22dac1f3b5c7ab3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:18:46 +0000 Subject: [PATCH 355/758] decomp: clarify names in prepare_target_level_transition domain_0_value_0 -> AUDIO_SELECTION_MODE_ALWAYS_FADE: Root 0x0028ed5c/0x0028ed68 binds s2 to 0x0013e030 and 0x0028edb0 stores zero to +0x20 (0x0013e050), the exact transition_mode word. Checked helper initialize_level_transition_with_audio at 0x0028ea04/0x0028ea14 stores incoming audio_selection_mode to that same word. Its 0x0028eb30 zero test selects the path 0x0028eba0-0x0028ebb0 that always passes scale_game_frames(6) to load_chunks_with_optional_fade; the nonzero path at 0x0028ec48-0x0028ec64 can instead pass zero depending on +0x2c. Supplied C already names that selector's zero AUDIO_SELECTION_MODE_ALWAYS_FADE. This is identical storage and selector data flow, not a match to unrelated zero-valued Hero enums. --- .../shared/game/initialize_level_transition_with_audio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 c45d07bf5f..b2ac21c4d8 100644 --- a/src/overlays/shared/game/initialize_level_transition_with_audio.c +++ b/src/overlays/shared/game/initialize_level_transition_with_audio.c @@ -253,6 +253,9 @@ void prepare_target_level_transition(s32 target_level_index) { enum { TRANSITION_MODE_CHANGE_LEVEL = 3 }; + enum { + AUDIO_SELECTION_MODE_ALWAYS_FADE = 0 + }; A_0028ed58 *shared_state_record = &level_render_state_lui; C_0028ed58 *shared_result_record; s32 shared_table_offset; @@ -260,7 +263,7 @@ void prepare_target_level_transition(s32 target_level_index) { D_L00_0015F5C4 = 6; fade_level = 1.0f; D_L00_0015F400 = 0; - shared_state_record->transition_mode = 0; + shared_state_record->transition_mode = AUDIO_SELECTION_MODE_ALWAYS_FADE; shared_state_record->h24 = -1; select_level_vu_chain(); shared_table_offset = D_L00_001611CC - 0x60000; From 0bb404c7b4f30707557601c377e44265cbbfe902 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:21:00 +0000 Subject: [PATCH 356/758] decomp: clarify names in draw_hero_glow_quads f162C -> clank_glow_quad_scale: Retail 0x00207FE8-0x00207FF4 passes hero+0x162C to the scalar easing helper with the mode-1 target scale (0.07 or 0.1015, optionally multiplied by 1.7). At 0x00208008 it loads that field into f12 for draw_offset_textured_effect_quad, whose supplied implementation scales quad vertices by quad_scale. The typed dispatch identifies this path as HERO_VEHICLE_MODE_CLANK. f1E70 -> queued_glow_quad_scales: Retail 0x00207DA4 and 0x00207ED4 load hero+0x1E70 plus the four-byte queue index into f12 before calls to 0x00263618. Supplied draw_offset_textured_effect_quad uses this argument to scale its quad vertices. enqueue_hero_glow_quad stores each submitted scale in this parallel eight-element queue array. f1E90 -> queued_glow_position_offset_scales: Retail s0 starts at hero+0x1E90 (0x00207D90/0x00207EC4); 0x00207DAC/0x00207EDC load each element into f13 for 0x00263618. Its supplied implementation multiplies the camera-facing direction by position_offset_scale and adds it to the quad base position. This is the queued per-quad position offset scale. i1E50 -> queued_glow_colors: Retail 0x00207D98/0x00207ECC load hero+0x1E50 queue elements into a1 for 0x00263618, advancing four bytes per queued quad. The supplied drawing helper copies this packed color into all four vertex colors, and enqueue_hero_glow_quad stores the submitted color alongside its position and scale. i22E4 -> three_point_glow_color: Retail 0x00207DE8 loads hero+0x22E4 into s2 and 0x00207E10 passes it as a1 for all three calls at 0x00207E18. Supplied update_hero_in_vehicle_mode packs alpha, blue, green and red into this field, while the drawing helper copies a1 to every quad vertex color. It colors the three-point glow array. i2300 -> clank_glow_color: Retail 0x00208014 loads hero+0x2300 into a1 for the quad drawn in the proven HERO_VEHICLE_MODE_CLANK branch. The supplied producer initializes this field to 0x301432d7 and interpolates it toward a packed tint; draw_offset_textured_effect_quad copies that argument to all vertex colors. v1D50 -> three_point_glow_positions: Retail 0x00207DEC initializes the draw cursor to hero+0x1D50; 0x00207DF4 passes it as a0 and 0x00207E14 advances it by 16 bytes for exactly three calls. Supplied update_hero_in_vehicle_mode fills these three vectors from hero.moby points 0, 1 and 2, proving this is the three-point glow position array without identifying vehicle mode 3. v1D80 -> single_point_glow_position: Retail 0x00207E78, 0x00207F20 and 0x0020800C pass hero+0x1D80 as the base position for one glow quad in the on-foot, Giant Clank and Clank branches. Operations on hero+0x1D88 adjust its z component before drawing. Supplied producer copies a moby point into this vector, proving the shared single-point glow position role. v1DD0 -> queued_glow_positions: Retail 0x00207D94/0x00207EC8 initialize s2 to hero+0x1DD0, pass it as a0, and advance it by 16 bytes per draw while bounded by hero+0x1EB0. Supplied enqueue_hero_glow_quad copies each incoming glow_position into the matching eight-vector array; the drawing helper copies this argument into its quad base translation. --- src/overlays/shared/hero/hero_idle_sequence.c | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 49b206243f..dcb9f156d4 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -1616,26 +1616,26 @@ typedef struct { typedef struct { u8 p0[0x162C]; - f32 f162C; + f32 clank_glow_quad_scale; u8 p1[0x1D50 - 0x1630]; - V_207d40 v1D50[3]; - V_207d40 v1D80; + V_207d40 three_point_glow_positions[3]; + V_207d40 single_point_glow_position; V_207d40 v1D90[4]; - V_207d40 v1DD0[8]; - s32 i1E50[8]; - f32 f1E70[8]; - f32 f1E90[8]; + V_207d40 queued_glow_positions[8]; + s32 queued_glow_colors[8]; + f32 queued_glow_quad_scales[8]; + f32 queued_glow_position_offset_scales[8]; s16 h1EB0; u8 p2[0x20A4 - 0x1EB2]; u8 b20A4; u8 p3[0x22D8 - 0x20A5]; s16 h22D8; u8 p4[0x22E4 - 0x22DA]; - s32 i22E4; + s32 three_point_glow_color; u8 p5[0x22FC - 0x22E8]; s16 h22FC; u8 p6[2]; - s32 i2300; + s32 clank_glow_color; } P_207d40; extern P_207d40 D_0013F350_lui __asm__("D_0013F350") NOT_SDA; @@ -1653,14 +1653,14 @@ void draw_hero_glow_quads(void) { mode = D_L00_0015F5C4; if (mode == 2 || mode == 6) { for (i = 0; i < P.h1EB0; i++) - draw_offset_textured_effect_quad(&P.v1DD0[i], P.i1E50[i], P.f1E70[i], P.f1E90[i]); + draw_offset_textured_effect_quad(&P.queued_glow_positions[i], P.queued_glow_colors[i], P.queued_glow_quad_scales[i], P.queued_glow_position_offset_scales[i]); return; } vehicle_mode = P.b20A4; if (vehicle_mode == 3) { int j; - glow_color = P.i22E4; - glow_position_cursor = P.v1D50; + glow_color = P.three_point_glow_color; + glow_position_cursor = P.three_point_glow_positions; for (j = 2; j >= 0; j--) { draw_offset_textured_effect_quad(glow_position_cursor, glow_color, 0.2f, 0.08f); glow_position_cursor++; @@ -1669,18 +1669,18 @@ void draw_hero_glow_quads(void) { } if (vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) { if ((hero_slot_item_id(3) == 3 || hero_slot_item_id(3) == 2) && P.h22D8 == 0) { - P.v1D80.f[2] += 0.015f; - draw_offset_textured_effect_quad(&P.v1D80, 0x280000C0, 0.057f, 0.08f); - P.v1D80.f[2] -= 0.015f; + P.single_point_glow_position.f[2] += 0.015f; + draw_offset_textured_effect_quad(&P.single_point_glow_position, 0x280000C0, 0.057f, 0.08f); + P.single_point_glow_position.f[2] -= 0.015f; } for (i = 0; i < P.h1EB0; i++) - draw_offset_textured_effect_quad(&P.v1DD0[i], P.i1E50[i], P.f1E70[i], P.f1E90[i]); + draw_offset_textured_effect_quad(&P.queued_glow_positions[i], P.queued_glow_colors[i], P.queued_glow_quad_scales[i], P.queued_glow_position_offset_scales[i]); return; } if (vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK) { - P.v1D80.f[2] -= 0.07f; - draw_offset_textured_effect_quad(&P.v1D80, 0x300000C0, 0.25f, 0.08f); - P.v1D80.f[2] += 0.07f; + P.single_point_glow_position.f[2] -= 0.07f; + draw_offset_textured_effect_quad(&P.single_point_glow_position, 0x300000C0, 0.25f, 0.08f); + P.single_point_glow_position.f[2] += 0.07f; return; } if (vehicle_mode == HERO_VEHICLE_MODE_CLANK) { @@ -1688,13 +1688,13 @@ void draw_hero_glow_quads(void) { if (P.h22FC) k = 0.101500004529953f; if (*(u8 *)0x15EDB3) { - P.v1D80.f[2] -= 0.01f; + P.single_point_glow_position.f[2] -= 0.01f; k *= 1.7f; } else { - P.v1D80.f[2] -= 0.02f; + P.single_point_glow_position.f[2] -= 0.02f; } - approach_value(&P.f162C, k, frame_scale * 0.003f); - draw_offset_textured_effect_quad(&P.v1D80, P.i2300, P.f162C, 0.08f); + approach_value(&P.clank_glow_quad_scale, k, frame_scale * 0.003f); + draw_offset_textured_effect_quad(&P.single_point_glow_position, P.clank_glow_color, P.clank_glow_quad_scale, 0.08f); } } From 174c0675e3d044633c2bb77c7dcd49e47043a978 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:21:04 +0000 Subject: [PATCH 357/758] decomp: clarify names in apply_level_specific_cutscene_moby_effects unk17C -> particle_pair_source_moby: Bound C declares unk17C as VeldinMoby* and assigns it to the existing particle_source_moby local before emit_moby_particle_pairs. Retail 0x0023e50c loads cutscene record +0x17c into s0; 0x0023e510 tests null; 0x0023e52c/0x0023e530 pass s0 in a0 to 0x0023e008. Checked helper evidence request 492eaa8e6b404b0689cb30641cb7b9c6 shows a1=0 and a2=sp+0x20 at 0x0023e00c..0x0023e014, then calls moby_point_position (0x0024f7c8) at 0x0023e04c with the incoming moby. Its sampled position, with XYZ jitter at 0x0023e108..0x0023e148, feeds both particle creation calls at 0x0023e184 and 0x0023e200. This proves a particle-pair position-source moby role independently of object identity. The same pointer also goes to the glow_quads_draw callback at 0x0023e538..0x0023e540. --- src/overlays/l00/mobys/clank_cutscene_trigger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l00/mobys/clank_cutscene_trigger.c b/src/overlays/l00/mobys/clank_cutscene_trigger.c index 50ca1dd7f1..7d5308dc9f 100644 --- a/src/overlays/l00/mobys/clank_cutscene_trigger.c +++ b/src/overlays/l00/mobys/clank_cutscene_trigger.c @@ -146,7 +146,7 @@ typedef struct { s16 count; u8 pad46[0x132]; VeldinMoby *mobys[1]; - VeldinMoby *unk17C; + VeldinMoby *particle_pair_source_moby; u8 pad180[4]; VeldinMoby *unk184; VeldinMoby *unk188; @@ -226,7 +226,7 @@ void apply_level_specific_cutscene_moby_effects(void) { add_draw_callback((s32)FUN_L00_002935b8, (s32)D_L00_0016C860.unk188); } if (current_level_index == 14 && D_L00_0016C860.state == 0) { - particle_source_moby = D_L00_0016C860.unk17C; + particle_source_moby = D_L00_0016C860.particle_pair_source_moby; if (particle_source_moby != 0 && (u32)(D_L00_0016C860.timer - 0x1C) < 6) { emit_moby_particle_pairs(particle_source_moby); add_draw_callback((s32)glow_quads_draw, (s32)particle_source_moby); From e47bf54168fe5cfa05dbc48c678e43f1c5f5969a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:25:01 +0000 Subject: [PATCH 358/758] decomp: clarify names in adjust_hero_velocity_from_collision_probes domain_0_value_1 -> HERO_VEHICLE_MODE_CLANK: Retail 0x00229280 loads the hero byte at base 0x0013f350 + 0x20a4, and 0x00229284-0x00229288 compares it with 1; the taken configuration sets origin height 0.35 and probe length 0.27 at 0x00229290-0x002292a4. Authoritative source SHA-256 6875ebdf14877c83e9651334046fb968d0aec5cee4732d71f8427345ef1b95e3 identifies this exact byte as P.hero_vehicle_mode. Same-file update_hero_vehicle_attachments_and_effects accesses that byte as vehicle mode, while restore_hero_from_vehicle_mode and update_hero_timers_and_spatial_state use named hero.vehicle_mode with HERO_VEHICLE_MODE_CLANK. Thus the selector belongs to the supplied HeroVehicleMode domain in include/rnc/hero/hero_state.h, whose canonical member HERO_VEHICLE_MODE_CLANK equals 1; this is vehicle-mode storage identity and named use, not numeric equivalence to a state or gravity mode. --- .../shared/hero/update_hero_vehicle_attachments_and_effects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 b473df05cb..c79bb127e5 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 @@ -467,7 +467,7 @@ void adjust_hero_velocity_from_collision_probes(int force) { if ((u32)(P.i208C - 0x11) < 2) { primary_origin_z_offset = 0.0f; k = 0.7f; - } else if (P.hero_vehicle_mode == 1) { + } else if (P.hero_vehicle_mode == HERO_VEHICLE_MODE_CLANK) { primary_origin_z_offset = 0.35f; k = 0.27000001072883606f; } From 1c85dfb4bd26f512acbb507cae5b11c880a48eb0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:25:01 +0000 Subject: [PATCH 359/758] decomp: clarify names in adjust_hero_planar_velocity_from_probes domain_0_value_2 -> HERO_VEHICLE_MODE_GIANT_CLANK: Retail 0x0020a344 establishes the hero base D_0013F350; 0x0020a3d8 loads its byte +0x20A4, and 0x0020a3dc-0x0020a3f4 compares it with 2 to select position Z offset 1.5 and planar probe scale 5.0. Authoritative C names this same byte P.hero_vehicle_mode. Its vehicle domain is corroborated by same-file update_hero_and_vehicle_mode_effects dispatch on hero0[0x20A4], and restore_saved_hero_moby_and_clear_vehicle_mode tests hero.vehicle_mode against HERO_VEHICLE_MODE_GIANT_CLANK before clearing it to HERO_VEHICLE_MODE_ON_FOOT and restoring the saved hero moby. Same-file update_hero_smoothing_parameters uses the canonical Giant Clank member to select enlarged capsule dimensions (5.25, 4.45, 3.75), consistent with the enlarged probes here. Thus the selector is HeroVehicleMode, whose supplied shared header declares HERO_VEHICLE_MODE_GIANT_CLANK=2; neither the equal-valued HeroStateId nor HeroGravityMode member belongs to this selector. --- src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c b/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c index c5efc09fb2..8f5064668a 100644 --- a/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c +++ b/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c @@ -386,7 +386,7 @@ void adjust_hero_planar_velocity_from_probes(int force) { if ((u32)(P.i208C - 0x11) < 2) { position_z_offset = 0.0f; k = 0.7f; - } else if (P.hero_vehicle_mode == 2) { + } else if (P.hero_vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK) { position_z_offset = 1.5f; k = 5.0f; } From 0a7fd197ee5e7f3f2125dadb6fc888ef6ae674cb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:27:04 +0000 Subject: [PATCH 360/758] decomp: clarify names in handle_constructorbot_damage_and_retargeting f98 -> knockback_collision_center_z_offset: Assigned source stores 0.6f in Vars85b8.f98; retail 0x002d8688 stores it at pvars+0x98. Caller constructorbot_update passes pvars+0x70 to step_moby_motion in knockback states 16/17. Checked sibling 0x0025ecc0 (request 33a37d47e2274d33b280f523cdef66f3, SHA-256 7a614a29eb73b127756fef72979679b9db7caebfe2020312deed6d73d6367514) loads state+0x28 at 0x0025ed94 and adds it to copied owner position Z at 0x0025eda8. It similarly adds this field to collision-query positions at 0x0025f204..0x0025f244, then subtracts it from returned collision-center Z at 0x0025f36c..0x0025f398 to restore owner position. This proves a collision center Z offset, rather than a bounce coefficient. i90 -> knockback_collision_radius_fixed: Assigned source sets Vars85b8.i90 to truncate_float_to_s32(614.4f); retail 0x002d8664/0x002d8680 confirms conversion and pvars+0x90 store. Checked sibling step_moby_motion 0x0025ecc0 receives pvars+0x70 and loads state+0x20 at 0x0025f2f8, converts signed integer to float and scales by 1/1024 at 0x0025f2fc..0x0025f300. It passes the same scaled field as f12 to collision query 0x00201c48 at 0x0025f338..0x0025f350. Checked query request f846afae48054aa0a8b36fd7690af75d, report SHA-256 9b422888f9153d1f6d7acb9d53ed4bef06e5832fcd271f6da0335579692692c3, transfers f12 into vf30 at 0x00201c6c/0x00201c7c, forms center-minus-radius and center-plus-radius XYZ bounds at 0x00201c90/0x00201c98, scales by 1024 at 0x00201ca8 and squares radius at 0x00201ce0 for distance tests. Nearby-moby query 0x00203750 similarly uses f12 as radius (0x00203790/0x00203798 bounds, 0x00203810 square); step_moby_motion supplies a slightly enlarged scaled i90 there at 0x0025f248..0x0025f26c. These consuming operations prove a fixed-point collision radius. --- src/overlays/l02/mobys/constructorbot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l02/mobys/constructorbot.c b/src/overlays/l02/mobys/constructorbot.c index 2d4dfa57f3..9fd5ca24c1 100644 --- a/src/overlays/l02/mobys/constructorbot.c +++ b/src/overlays/l02/mobys/constructorbot.c @@ -572,9 +572,9 @@ typedef struct { float knockback_horizontal_speed_approach_step; float knockback_initial_horizontal_speed; float knockback_initial_vertical_speed; - int i90; /* 0x90 */ + int knockback_collision_radius_fixed; /* 0x90 */ int i94; - float f98; + float knockback_collision_center_z_offset; char pad9C[4]; float fA0; /* 0xA0 */ char padA4[9]; @@ -605,8 +605,8 @@ void handle_constructorbot_damage_and_retargeting(void *owner_moby) { resolve_moby_hit_response(moby, hit_record, &moby_vars->hp, 0, &hit, &dmg, 0, 4); if (hit != 1 && ((unsigned char *)moby)[0x20] != 0x11) { moby_vars->hp -= dmg; - moby_vars->i90 = truncate_float_to_s32(614.4f); - moby_vars->f98 = 0.6f; + moby_vars->knockback_collision_radius_fixed = truncate_float_to_s32(614.4f); + moby_vars->knockback_collision_center_z_offset = 0.6f; if (0.0f < moby_vars->hp) { if (dmg < 1.0f) { moby_vars->flash = 100; From e1f92da4e7a506a1f009b26f2108665c9288ed57 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:29:21 +0000 Subject: [PATCH 361/758] decomp: clarify names in update_gadgebot_damage_target_and_glow unk90 -> death_fall_collision_radius_fixed_point: Assigned source sets SentryVars_c100.unk90 to 0x200 in lethal-hit death-fall setup; retail 0x002fc334/0x002fc39c agrees. fall=pvars+0x70 is passed at 0x002fc3c0/0x002fc3cc and by gadgebot_update to checked sibling step_moby_motion 0x0025e9d8. That updater loads fall+0x20 at 0x0025f010, converts the signed integer to float at 0x0025f014 and multiplies by 1/1024 at 0x0025f018; 0x0025f050-0x0025f068 passes the same scaled field as f12 to 0x001f9a48. Checked receiving instructions load position to vf31 (0x001f9a64), radius from f12 to vf30 (0x001f9a6c/0x001f9a7c), build position minus/plus radius XYZ bounds (0x001f9a90/0x001f9a98), scale both by 1024 (0x001f9aa0/0x001f9aa8), square radius (0x001f9ae0), and compare radius squared against squared distance to triangle closest points (0x001fa000-0x001fa018). These geometric uses prove a fixed-point collision sphere radius, initialized for death fall, rather than a flag word. --- src/overlays/l18/mobys/gadgebot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l18/mobys/gadgebot.c b/src/overlays/l18/mobys/gadgebot.c index 586797cae2..391cc0a164 100644 --- a/src/overlays/l18/mobys/gadgebot.c +++ b/src/overlays/l18/mobys/gadgebot.c @@ -269,7 +269,7 @@ typedef struct { float death_fall_horizontal_speed_approach_step; float unk88; float death_fall_initial_vertical_speed; - int unk90; + int death_fall_collision_radius_fixed_point; int unk94; float unk98; char pad9C[0x11]; @@ -356,7 +356,7 @@ void update_gadgebot_damage_target_and_glow(struct Moby *moby) { moby->state = GADGEBOT_EXPLODE; } else { fall_setup_value_or_path_slot_address = 0x200; - sentry_vars->unk90 = fall_setup_value_or_path_slot_address; + sentry_vars->death_fall_collision_radius_fixed_point = fall_setup_value_or_path_slot_address; sentry_vars->unk98 = 0.5f; sentry_vars->unk80 = gadgebot_death_fall_gravity_gp * frame_time_sq; sentry_vars->death_fall_horizontal_speed_approach_step = From 07e2af4927ba001442daf9851e69e22811083624 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:31:32 +0000 Subject: [PATCH 362/758] decomp: clarify names in update_veldin_robot_damage_and_targeting domain_0_value_2 -> VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE: This selector is vars->target_selection_status at vars+0x114, not moby state +0x20: assigned 0x002e19a4 passes vars+0xd0 to select_moby_combat_target. Checked helper e71233960ab1454582c060248bd5bff7 preserves that output base in s2 and writes status s5 at +0x44 (vars+0x114), returning it at 0x0025ff00. 0x0025fd20-0x0025fd24 clears the hero candidate and sets status 2; alternate-candidate selection can replace it. Assigned 0x002e19ac-0x002e19cc also sets 2 when selected position is beyond target range. Caller C permits path following and beam-slot registration only when status !=2. Thus 2 denotes target selection unavailable, covering both suppression and out-of-range rather than a robot state or a specific lifecycle. domain_3_value_1 -> VELDIN_ROBOT_TARGET_SELECTION_ALTERNATE_MOBY: Assigned 0x002e1a38-0x002e1a7c compares the configured candidate moby's XY distance with the current target, installs a nearer valid candidate in vars+0x110, copies its position to vars+0xd0 and sets vars+0x114 to 1. Checked select_moby_combat_target evidence e71233960ab1454582c060248bd5bff7 establishes the same selector: its s2 is vars+0xd0, output +0x44 is target_selection_status. At 0x0025fdc0-0x0025fdc8 and 0x0025fe44-0x0025fe4c it replaces the initial hero candidate with a nearer eligible alternate moby and sets s5=1, stored at +0x44 and returned. This proves alternate-moby target selection, separate from moby-state IDs. unk1BC -> candidate_target_moby_index: Bound source fc1dc7af6b69642e8596ae78dabb17f6dc8f028da0767defa9c14b25b7afd456: this signed field is tested >=0, multiplied by the 0x100-byte moby stride and added to moby_table. Retail 0x002e19fc-0x002e1a0c performs that lookup; 0x002e1a18-0x002e1a34 rejects invalid candidate states and resets the index to -1. At 0x002e1a38-0x002e1a7c the candidate position is compared with the current target and the nearer candidate is installed as target. This proves a candidate target moby index, without claiming its configuration origin. unk67 -> damage_secondary_red: Assigned retail 0x002e1844 and 0x002e18f8 write 0x78/0xFA here for lethal/nonlethal damage, then trooper_anim_update receives vars+0x60, also passed to trooper_anim_finish at 0x002e1920. Checked helper evidence 07b0270ffb4d47868de884ac735f3949: 0x0025d5c8/0x0025d5e4-0x0025d610 reads animation_state+7 as the secondary endpoint interpolated from original red at +4; 0x0025d694-0x0025d6d8 interpolates back. 0x0025d770-0x0025d77c passes this channel as a1 to the established set_moby_color helper, matching supplied trooper_anim_finish C r1/r0 logic. Hence vars+0x67 is the secondary red component of the damage color effect. unk84 -> knockback_xy_speed_step: Retail 0x002e1758/0x002e1768/0x002e17a8 loads the established veldin_robot_knockback_xy_speed_step_gp coefficient, multiplies by frame_time_sq, and stores this f32 at vars+0x84, relative +0x14 in knockback state vars+0x70. Supplied original Ghidra plate records checked mine_fall 0x0025c704 and 0x0025c720-0x0025c728 using that relative +0x14 as the bounded XY magnitude step, with 0x0025b870-0x0025b8ac approaching the desired scalar by +/-step. Current C passes this state to step_moby_motion in both damage and death knockback cases. Do not assume unconditional deceleration. --- src/overlays/l00/mobys/veldin_robot_enemy.c | 26 ++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/overlays/l00/mobys/veldin_robot_enemy.c b/src/overlays/l00/mobys/veldin_robot_enemy.c index 4013132845..8feca7bb90 100644 --- a/src/overlays/l00/mobys/veldin_robot_enemy.c +++ b/src/overlays/l00/mobys/veldin_robot_enemy.c @@ -65,11 +65,11 @@ typedef struct { u8 unk5A; u8 pad5B[0x60 - 0x5B]; u8 unk60[7]; - u8 unk67; + u8 damage_secondary_red; u8 pad68[8]; u8 unk70[0x10]; f32 unk80; - f32 unk84; + f32 knockback_xy_speed_step; f32 unk88; f32 unk8C; s32 unk90; @@ -92,7 +92,7 @@ typedef struct { u8 pad1B0[4]; s32 targeting_path_index; s32 pathIdx; - s32 unk1BC; + s32 candidate_target_moby_index; u8 pad1C0[0x1D0 - 0x1C0]; f32 turnVel; f32 speed; @@ -437,6 +437,10 @@ f32 veldin_robot_knockback_xy_scale_gp __asm__("D_L00_00161BDC") = 1e+01 f32 veldin_robot_knockback_z_scale_gp __asm__("D_L00_00161BE0") = 9.5f; void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { + enum { + VELDIN_ROBOT_TARGET_SELECTION_ALTERNATE_MOBY = 1, + VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE = 2 + }; ElectroidVars *vars; void *anim; ElectroidHit *coll; @@ -467,7 +471,7 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { vars->health -= dmg; vars->unk90 = 0x200; vars->unk80 = veldin_robot_knockback_gravity_gp * frame_time_sq; - vars->unk84 = veldin_robot_knockback_xy_speed_step_gp * frame_time_sq; + vars->knockback_xy_speed_step = veldin_robot_knockback_xy_speed_step_gp * frame_time_sq; vars->unk88 = veldin_robot_knockback_xy_scale_gp * frame_time; vars->unk8C = veldin_robot_knockback_z_scale_gp * frame_time; vars->unkAD = 0; @@ -484,7 +488,7 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { vars->unkC4 = 16.0f; moby->state = VELDIN_ROBOT_STATE_DEATH_KNOCKBACK; moby->unk94 = 0; - vars->unk67 = 0x78; + vars->damage_secondary_red = 0x78; trooper_anim_update(moby, anim); FUN_L00_00257470(moby, 0, -1); } else { @@ -496,7 +500,7 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { moby, vars->unk70, 8, 1, 0, fast_arc_tan(coll->pos.f[0], coll->pos.f[1])); vars->unkC4 = vars->unkC0 = -1.0f; moby->state = VELDIN_ROBOT_STATE_DAMAGE_KNOCKBACK; - vars->unk67 = 0xFA; + vars->damage_secondary_red = 0xFA; vars->unk26 = scale_game_frames(0x3C); trooper_anim_update(moby, anim); } @@ -514,7 +518,7 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { } if (select_moby_combat_target(moby, range, &vars->targetPos) != 2 && range < vector_distance_xy(&moby->pos, &vars->targetPos)) { - vars->target_selection_status = 2; + vars->target_selection_status = VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE; } } if (vars->target == 0) { @@ -522,17 +526,17 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { vars->target = ((ElectroidMoby *)hero_ptr->moby); qcopy(&vars->targetPos, &hero_ptr->motion.pos); } - if (vars->unk1BC >= 0) { - candidate_target = (ElectroidMoby *)(moby_table + (vars->unk1BC << 8)); + 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 == 0xFE || candidate_target->state == 0xFD) { - vars->unk1BC = -1; + vars->candidate_target_moby_index = -1; } else { range = vector_distance_xy(&moby->pos, &candidate_target->pos); if (range < vector_distance_xy(&moby->pos, &vars->target->pos)) { vars->target = candidate_target; qcopy(&vars->targetPos, &candidate_target->pos); - vars->target_selection_status = 1; + vars->target_selection_status = VELDIN_ROBOT_TARGET_SELECTION_ALTERNATE_MOBY; } } } From 871676c9b6061a8ae8883e455d067724b33247ee Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:33:37 +0000 Subject: [PATCH 363/758] decomp: clarify names in update_hero_easing_targets_and_point_effects i10E0 -> slot_one_primary_item_moby: Assigned retail 0020b3d4-0020b3f4 loads hero+0x10E0 (original Ghidra iRam00140430) and, when nonzero, sets hero_eases[4].scale and [5].scale to 0.01f. Supplied authoritative C copy_hero_color_to_item_mobys reads primary item mobys from hero+0x1090+i*0x50 (secondary at +0x1094), establishing slot 1 primary at +0x10E0. Supplied apply_hero_selected_flags_and_state_transitions already identifies the same storage as slot_one_item_moby; checked sibling retail 0020b9fc-0020ba10 loads this pointer, null-checks it and dereferences its +0xA6 moby class against 0xAD. These object uses and item-array data flow prove slot-one primary item moby identity rather than merely an offset. Preserve its existing s32 type. --- 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 dcb9f156d4..95756820b5 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -3148,7 +3148,7 @@ typedef struct { u8 p30A[0x418 - 0x30A]; s32 i418; u8 p41C[0x10E0 - 0x41C]; - s32 i10E0; + s32 slot_one_primary_item_moby; u8 p10E4[0x12A0 - 0x10E4]; f32 f12A0, f12A4; s32 point_effect_emission_updates_remaining; @@ -3201,7 +3201,7 @@ void update_hero_easing_targets_and_point_effects(void) { -fast_subtract_rotations(P.f2D4, -secondary_clamped_rotation_angle); } } - if (P.i10E0) { + if (P.slot_one_primary_item_moby) { hero_eases[4].scale = 0.01f; hero_eases[5].scale = 0.01f; } From 7c508128146f1be022ea5ba7766452745006f119 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:35:39 +0000 Subject: [PATCH 364/758] decomp: clarify names in spawn_morphoray_chicken f5 -> green: In authoritative C, u8 Opt.f5 is passed as the middle color channel to set_moby_color(spawned_moby, f4, f5, f6). Original retail 0x002c93a4-0x002c93c0 follows source +0x78 then +0xC and loads byte +5 into a2 in the call delay slot. Checked level-00 set_moby_color at 0x002502f8 shifts a2 by 40 bits and 0x0025030c ORs it into the moby +0x38 packed RGB word, between the a1 red and a3 blue bytes. This proves the green channel role. f6 -> blue: In authoritative C, u8 Opt.f6 is the last color argument to set_moby_color(spawned_moby, f4, f5, f6). Original retail 0x002c93b4 loads byte +6 of the optional source color record into a3 before jal 0x002502f0 at 0x002c93bc. Checked level-00 helper 0x002502fc shifts a3 by 48 bits, 0x00250310 ORs it into the packed color, and 0x0025031c stores moby +0x38. Together with the established color function and RGB argument order this proves the blue channel role. --- src/overlays/shared/weapons/morphoray_chicken.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/morphoray_chicken.c b/src/overlays/shared/weapons/morphoray_chicken.c index 7d3b849676..9bdb5572ce 100644 --- a/src/overlays/shared/weapons/morphoray_chicken.c +++ b/src/overlays/shared/weapons/morphoray_chicken.c @@ -68,8 +68,8 @@ typedef struct { typedef struct { u8 pad00[4]; u8 f4; - u8 f5; - u8 f6; + u8 green; + u8 blue; } Opt; typedef struct { @@ -267,7 +267,7 @@ struct Moby *spawn_morphoray_chicken(State *source_state) { color_options = source_state->unk78->unk0C; if (color_options != NULL) { set_moby_color( - spawned_moby, color_options->f4, color_options->f5, color_options->f6); + spawned_moby, color_options->f4, color_options->green, color_options->blue); } else { spawned_moby->spawn_frame = source_state->unk38; } From 3f4da9fbf30c636ae3129b2eae60a4fdd45a8004 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:35:39 +0000 Subject: [PATCH 365/758] decomp: clarify names in sand_shark_nest_update domain_0_value_1 -> SAND_SHARK_NEST_REMOVAL_REQUEST_IDLE: Retail 0x002dcb5c loads nest pvars from moby+0x78, and 0x002dcc0c/0x002dcc30 initialize its request byte +0x2E to 1. Checked damage helper 0x002dd004 loads that same pvars pointer; 0x002dd00c-0x002dd010 tests +0x2E for 2. Only that request branch resets the byte to 1 at 0x002dd018-0x002dd024, decrements spawner active_nest_count at 0x002dd03c-0x002dd044 and calls mark_moby_for_removal at 0x002dd048. Initialization and consumption-reset thus establish 1 as the idle removal-request state, distinct from the moby+0x20 current-state domain. --- src/overlays/l02/mobys/sand_shark_nest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l02/mobys/sand_shark_nest.c b/src/overlays/l02/mobys/sand_shark_nest.c index b310ee403e..2f47053418 100644 --- a/src/overlays/l02/mobys/sand_shark_nest.c +++ b/src/overlays/l02/mobys/sand_shark_nest.c @@ -152,6 +152,9 @@ void sand_shark_nest_update(unsigned char *moby) __asm__("FUN_L02_002dcb38"); /* Moby class 668 */ void sand_shark_nest_update(unsigned char *moby) { + enum { + SAND_SHARK_NEST_REMOVAL_REQUEST_IDLE = 1 + }; Varscb38 *nest_vars = ((Varscb38 *)MOBY(moby)->pvars); char *launched_shark; int spawn_delay_factor; @@ -175,7 +178,7 @@ void sand_shark_nest_update(unsigned char *moby) { MOBY(moby)->state = SAND_SHARK_NEST_WAIT_FOR_SPAWN; nest_vars->f20 = 3.0f; nest_vars->s24 = 3; - nest_vars->removal_request_state = 1; + nest_vars->removal_request_state = SAND_SHARK_NEST_REMOVAL_REQUEST_IDLE; nest_vars->timer = scale_game_frames(nest_vars->delay); if (nest_vars->spawner >= 0) { (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8 + 0x78))->active_nest_count += 1; From fe478c5b432eaf465ae0fe0803a1e20a93ed7045 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:35:42 +0000 Subject: [PATCH 366/758] decomp: clarify names in adjust_hero_velocity_from_collision_probes p2080 -> collision_probe_moby: Authoritative source src/overlays/shared/hero/update_hero_vehicle_attachments_and_effects.c SHA-256 7ae1214a4aefb98e0990d86ac8cf9a117dcf16dfab204ee61660272d8ed6908e supplies semantic evidence beyond the offset: update_hero_vehicle_attachments_and_effects loads moby = *(char **)(g + 0x2080), then reads its RGB channels at moby+0x90/+0x91/+0x92. In assigned retail 0x002293fc and 0x00229438, the same hero+0x2080 pointer is loaded into a3 for collision_line calls at 0x00229408 and 0x00229448. Original Ghidra likewise passes uRam001413d0 to both queries. Thus this private member holds the moby pointer supplied to the paired collision probes; exact filtering semantics are not claimed. --- .../hero/update_hero_vehicle_attachments_and_effects.c | 6 +++--- 1 file changed, 3 insertions(+), 3 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 c79bb127e5..c854ef0083 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 @@ -425,7 +425,7 @@ typedef struct { u8 p3[0x308 - 0x244]; s16 h308; u8 p4[0x2080 - 0x30A]; - void *p2080; + void *collision_probe_moby; u8 p5[0x208C - 0x2084]; s32 i208C; u8 p6[0x20A4 - 0x2090]; @@ -497,10 +497,10 @@ void adjust_hero_velocity_from_collision_probes(int force) { fast_vec_add(&primary_vector_endpoint, &primary_vector_endpoint, &primary_vector_origin); fast_vec_add(&secondary_vector_endpoint, &secondary_vector_endpoint, &b); r = -1; - if (collision_line(&b, &secondary_vector_endpoint, 4, P.p2080, 0) && D_L06_001745DC > 0) + if (collision_line(&b, &secondary_vector_endpoint, 4, P.collision_probe_moby, 0) && D_L06_001745DC > 0) r = collision_hit_material(); primary_probe_result_angle = 0.0f; - if (collision_line(&primary_vector_origin, &primary_vector_endpoint, 4, P.p2080, 0) && + if (collision_line(&primary_vector_origin, &primary_vector_endpoint, 4, P.collision_probe_moby, 0) && X.i1C > 0) primary_probe_result_angle = fast_arc_tan(X.v40.f[2], vector_length_xy(&X.v40)); if (0.8726646304130554f <= primary_probe_result_angle || r == 8 || r == 12) { From 21715ce051460d4475700807604bd76b8cb52336 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:37:57 +0000 Subject: [PATCH 367/758] decomp: clarify names in handle_sand_shark_damage_and_targeting domain_0_value_2 -> SAND_SHARK_RELAUNCH_REQUEST_PENDING: The selector is the private relaunch_request_state byte at pvars+0x2e, not moby state or any hero enum. Assigned retail 0x002d5cc0-0x002d5cc8 compares it with 2; only this branch consumes the request, decrements the spawner count, selects a class-29c relaunch moby, and removes the shark or moves it to inactive relaunch state 0x1a at home minus 10 (0x002d5cd0-0x002d5d4c). The authoritative field comment also identifies 2 as respawn requested. domain_1_value_1 -> SAND_SHARK_RELAUNCH_REQUEST_CONSUMED: Assigned retail 0x002d5cd0 loads 1 and 0x002d5cdc stores it into the same pvars+0x2e request byte immediately after the comparison with pending value 2. The store precedes the spawner-count decrement and relaunch selection/removal flow through 0x002d5d4c, preventing that pending-request branch from repeating next update. This names the observed consumed request marker without claiming a moby lifecycle state. domain_2_value_2 -> SAND_SHARK_TARGET_SELECTION_EXCLUDED: Assigned retail 0x002d6038 loads 2, then 0x002d6098/0x002d60c8 stores it at pvars+0x214 when selected target-home XY distance exceeds effective range or target-to-moby absolute height difference exceeds 3. Supplied checked target-helper annotation independently records this same status field at tgt+0x44 and status 2 on exclusion paths 0x00261f7c-0x00261f90 and 0x00262048-0x00262050. Supplied sand_shark_update gates target pursuit on this field !=2. This is the target-selection exclusion domain, separate from relaunch requests and moby states. f148 -> knockback_collision_z_offset: Assigned retail 0x002d5ef8 and 0x002d6004 initialize pvars+0x148 (knockback block+0x28) to 0.5 then 0.85. Checked step_moby_motion loads block+0x28 at 0x0025ed94 and adds it to copied moby Z before ground probe 0x0025edac; 0x0025f204-0x0025f244 adds the same offset to collision sweep endpoints, and 0x0025f36c-0x0025f398 subtracts it from the resolved contact position before storing moby Z. This proves a collision/ground probe Z offset, not a restitution coefficient. f16C -> knockback_target_horizontal_speed: Assigned retail 0x002d5ed0-0x002d5ef4 stores twice frame_time at pvars+0x16c, block+0x4c relative to knock at +0x120. Checked motion update 0x0025ed2c computes XY velocity length using 0x00210470 (squares xyz but vaddy.x sums only X and Y, then sqrt); 0x0025ed34-0x0025ed60 approaches that length toward block+0x4c using established horizontal-speed approach step block+0x14, choosing zero after landed substate 2, then rescales the velocity. Thus this is the target horizontal speed. --- src/overlays/l02/mobys/sand_shark.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index c693fa65e7..12109ce2d0 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -1203,12 +1203,12 @@ typedef struct { float knockback_initial_vertical_speed; int i140; /* 0x140 */ int knockback_flags; - float f148; + float knockback_collision_z_offset; int spawner_active_shark_count; /* 0x14C: count kept by the spawner moby */ char pad150[0xD]; unsigned char b15D; /* 0x15D */ char pad15E[0xE]; - float f16C; /* 0x16C */ + float knockback_target_horizontal_speed; /* 0x16C */ float f170; float f174; char pad178[0x58]; @@ -1254,6 +1254,11 @@ extern void trooper_anim_finish(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; @@ -1268,8 +1273,8 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { if (moby[0x20] == 0) { return; } - if (moby_vars->relaunch_request_state == 2) { - moby_vars->relaunch_request_state = 1; + if (moby_vars->relaunch_request_state == SAND_SHARK_RELAUNCH_REQUEST_PENDING) { + moby_vars->relaunch_request_state = SAND_SHARK_RELAUNCH_REQUEST_CONSUMED; if (moby_vars->spawning_moby_index >= 0) { (*(Vars5c88 **)((moby_vars->spawning_moby_index << 8) + D_L02_0015FFD8 + 0x78))->spawner_active_shark_count -= 1; } @@ -1309,8 +1314,8 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { moby_vars->knockback_initial_vertical_speed = sand_shark_death_knockback_vertical_speed_gp * D_0015ED6C; moby_vars->b15D = 0; moby_vars->knockback_flags = 9; - moby_vars->f16C = 2.0f * D_0015ED6C; - moby_vars->f148 = 0.5f; + moby_vars->knockback_target_horizontal_speed = 2.0f * D_0015ED6C; + moby_vars->knockback_collision_z_offset = 0.5f; qcopy(&ground_probe_position, moby + 0x10); ground_probe_position.f[2] += 2.0f; ground_height = probe_ground_height(&ground_probe_position, 0, 0.5f); @@ -1329,7 +1334,7 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { hit_knockback_vector.q = *(OvlQuad *)(hit_record + 0x10); trooper_knockback_arc(&hit_knockback_vector, &k, &moby_vars->knockback_horizontal_speed, &moby_vars->knockback_initial_vertical_speed); trooper_start_knockback(k, moby, moby_vars->knock, 6, 1, 0); - moby_vars->f148 = 0.85f; + moby_vars->knockback_collision_z_offset = 0.85f; moby_vars->f170 = 7.0f; moby_vars->f174 = 14.0f; moby[0x20] = 0x18; @@ -1344,7 +1349,7 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { if (FUN_L00_0025ff38(moby_vars->effective_target_selection_range, moby, moby_vars->tgt, 0, 0, path + 4, *path) != 2 && (moby_vars->effective_target_selection_range < vector_distance_xy(moby_vars->home, moby_vars->tgt) || absolute_float(MOBY(moby)->pos.z - moby_vars->tgt[2]) > 3.0f)) { - moby_vars->target_selection_status = 2; + moby_vars->target_selection_status = SAND_SHARK_TARGET_SELECTION_EXCLUDED; } if (moby_vars->selected_target_moby == 0) { moby_vars->selected_target_moby = (int)hero.moby; From a8a0d594f8c9218397f85e72f44d619003d017cd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:38:01 +0000 Subject: [PATCH 368/758] decomp: clarify names in update_chomper_hit_reaction_and_target f170 -> knockback_ascent_animation_target: Authoritative source SHA-256 94784c7ab59f70b3062c89c96089c8f946048baf93ea3a42a2a6a1ec04996524 and original retail Ghidra show f170 initialized to 8.0 at 0x002e6314, immediately after starting knockback with pvars+0x120. Thus it is motion-record+0x50. Checked initializer 0x00257ee8 sets motion phase +0x3e to zero and 0x00257ec4 initializes vertical velocity +8. Checked motion sibling 0x002582bc-0x00258334 selects +0x50 in phase zero, subtracts the animation-position getter 0x0024a4a0 result, and divides by abs(vertical_velocity/gravity); 0x00258348-0x0025845c uses that target rate to approach moby+0x58. Phase zero becomes phase one when vertical velocity is negative at 0x00258794-0x002587b0. This proves an ascent animation target, without claiming exact animation-position units. f174 -> knockback_descent_animation_target: Original retail Ghidra and authoritative C initialize f174 to 16.0 at 0x002e631c after knockback setup; it is motion-record+0x54. Checked initializer 0x00257ee8 starts phase +0x3e at zero; checked motion consumer changes it to one when vertical velocity +8 is negative (0x00258794-0x002587b0). Phase one selects +0x54 at 0x00258350-0x00258370, stopping moby+0x58 when animation position reaches this target. At 0x002583f4-0x0025845c it subtracts current animation position from +0x54, divides by the computed remaining flight interval, clamps the target rate to 0..2, and approaches moby+0x58. Getter 0x0024a4a0 interpolates the moby's animation-position records using its blend state. This proves a descent animation target; exact position units remain unspecified. --- src/overlays/l16/mobys/chomper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l16/mobys/chomper.c b/src/overlays/l16/mobys/chomper.c index f660e23f11..4b560bc9f1 100644 --- a/src/overlays/l16/mobys/chomper.c +++ b/src/overlays/l16/mobys/chomper.c @@ -216,8 +216,8 @@ typedef struct { unsigned char pending; /* 0x15D */ char pad15E[0xE]; float timer; /* 0x16C */ - float f170; - float f174; + float knockback_ascent_animation_target; + float knockback_descent_animation_target; char pad178[8]; float target[4]; /* 0x180 */ char pad190[0x30]; @@ -291,8 +291,8 @@ void update_chomper_hit_reaction_and_target(void *chomper_instance) { &pursuit_data->turn_speed); trooper_start_knockback( chomper_moby, pursuit_data->knock, 5, 1, 0, knockback_vector_and_heading[4]); - pursuit_data->f170 = 8.0f; - pursuit_data->f174 = 16.0f; + pursuit_data->knockback_ascent_animation_target = 8.0f; + pursuit_data->knockback_descent_animation_target = 16.0f; chomper_moby->state = CHOMPER_KNOCKBACK; chomper_moby->i94 = 0; pursuit_data->reaction_time = 0x78; From 9080bf17f458a20934ca41beb5626ff6adc6213f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:39:57 +0000 Subject: [PATCH 369/758] decomp: clarify names in particle_spawner_smoke_fire_update b0A -> emitted_particle_alpha: Authoritative C assigns sub->b0A = col >> 24 after particle creation. Retail 002d72e0-002d7304 samples Q+0x2c/+0x2e, shifts the sample by 24 and ORs it with the emitted-particle base color into s2; 002d7328 passes this packed color to 0026d000. Retail 002d733c forms sub = particle+0x20, 002d7358 extracts s2's high byte, and 002d7360 stores it to sub+0x0a. Original Ghidra likewise writes (char)(uVar2 >> 0x18) at particle+0x2a. Thus this u8 stores the emitted particle color alpha, not an offset-only inferred role. --- src/overlays/shared/props/particle_spawner_smoke_fire.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/props/particle_spawner_smoke_fire.c b/src/overlays/shared/props/particle_spawner_smoke_fire.c index 09d82aa724..7bc601406b 100644 --- a/src/overlays/shared/props/particle_spawner_smoke_fire.c +++ b/src/overlays/shared/props/particle_spawner_smoke_fire.c @@ -48,7 +48,7 @@ typedef struct { u8 pad0[4]; int x04; u8 pad08[2]; - u8 b0A; + u8 emitted_particle_alpha; u8 b0B; } E2; @@ -227,7 +227,7 @@ void particle_spawner_smoke_fire_update(P *spawner) { sub = &ent->sub; ent->h0A = FUN_001f96f8_c(random_int_between(q->x30, q->x34)); sub->x04 = 3; - sub->b0A = col >> 24; + sub->emitted_particle_alpha = col >> 24; sub->b0B = ent->h0A; if (random_integer_below(2)) ent->b03 = 0x44; From 18936f21943e10c71712b317460f8dab1c550394 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:42:09 +0000 Subject: [PATCH 370/758] decomp: clarify names in bob_update f0C -> dialogue_activation_threshold: Retail bob_update loads the private block from moby+0x78 into s1 at 0x002d0744, passes it as a1 to initialize_npc_dialogue at 0x002d079c and stores 3.7f to +0x0c at 0x002d07a4-0x002d07b4. The same block is passed to update_npc_dialogue at 0x002d07d0/0x002d07d4. Checked level-11 helper 0x0028b818 retains a1 in s1 at 0x0028b84c. At 0x0028b8a0-0x0028b8bc it tests a positional measure between NPC +0x10 and hero 0x0013f3d0 against twice float +0x0c, returning zero when exceeded. At 0x0028b8e0-0x0028b914 it computes NPC-to-hero bearing, compares its difference from NPC yaw +0x48 against the same +0x0c, and returns zero when exceeded. These are eligibility gates before dialogue activation, proving dialogue_activation_threshold rather than an offset-only or radius-specific name. --- src/overlays/l11/mobys/bob.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l11/mobys/bob.c b/src/overlays/l11/mobys/bob.c index 7451524f82..26bd478658 100644 --- a/src/overlays/l11/mobys/bob.c +++ b/src/overlays/l11/mobys/bob.c @@ -25,7 +25,7 @@ typedef struct { char pad00[4]; short h04; char pad06[6]; - float f0C; + float dialogue_activation_threshold; char pad10[0x30]; int region; char pad44[0x2C]; @@ -77,7 +77,7 @@ void bob_update(WatcherMoby *moby) { moby->state = BOB_CHECK_DIALOGUE; } initialize_npc_dialogue(moby, moby_vars); - moby_vars->f0C = 3.7f; + moby_vars->dialogue_activation_threshold = 3.7f; break; case BOB_CHECK_DIALOGUE: if (is_point_inside_clip_volume(hero.motion.pos.f, moby_vars->region)) { From b7e63f10edb717cd0bd70718b0ebdfd9506bf8c1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:44:56 +0000 Subject: [PATCH 371/758] decomp: clarify names in vendor_update domain_0_value_1 -> VENDOR_WAIT_FOR_HERO: Initialization stores 1 to vendor_moby->vendor_state at 0x002a588c (sb s3,0x20(s2)); this is the same incoming vendor byte loaded at 0x002a5838 and dispatched at 0x002a5850 to 0x002a5930. That branch fades the effect and waits for XY distance <=16 and height difference <=8. It is the existing local VENDOR_WAIT_FOR_HERO case, not a hero-state or control-mode domain. domain_1_value_2 -> VENDOR_HERO_NEARBY: After the hero proximity tests at 0x002a59bc and 0x002a59e8, retail loads 2 at 0x002a59f4 and stores it to the vendor byte +0x20 at 0x002a5a00. Dispatch of that same byte at 0x002a5874 reaches 0x002a5abc, the existing VENDOR_HERO_NEARBY branch that grows effect_scale_factor and gates close-range help and interaction. domain_2_value_1 -> VENDOR_WAIT_FOR_HERO: In the VENDOR_HERO_NEARBY branch, XY distance >18 or height difference >10 reaches 0x002a5b68-0x002a5b6c, storing s3=1 to the same vendor +0x20 state byte. Dispatch at 0x002a5850 maps that value back to 0x002a5930, the existing VENDOR_WAIT_FOR_HERO branch that fades effects and waits for hero proximity. domain_3_value_3 -> VENDOR_ZERO_AUXILIARY_SCALE: After the gated open_vendor_menu call at 0x002a5d64, retail loads 3 at 0x002a5d6c and stores it to vendor+0x20 at 0x002a5d74. The same-byte dispatch at 0x002a587c reaches 0x002a5d78: if the auxiliary moby exists, it zeros effect_scale_factor at 0x002a5d84 and stores its zero-scaled product to auxiliary_scale at 0x002a5da4 before update_entity. This is the existing local VENDOR_ZERO_AUXILIARY_SCALE case. --- src/overlays/shared/vendor/vendor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/vendor/vendor.c b/src/overlays/shared/vendor/vendor.c index a8fe6dc8d5..79e0006d8c 100644 --- a/src/overlays/shared/vendor/vendor.c +++ b/src/overlays/shared/vendor/vendor.c @@ -314,7 +314,7 @@ void vendor_update(P_2a57a8 *vendor_moby) { (((s32)(fast_sin(vendor_color_pulse_phase) * 48.0f) + 0x60) * 0x10101) | 0x80000000; switch (vendor_moby->vendor_state) { case VENDOR_INITIALIZE: - vendor_moby->vendor_state = 1; + vendor_moby->vendor_state = VENDOR_WAIT_FOR_HERO; q->i0 = 0; q->i4 = 0; q->mC = create_moby(0x477); @@ -338,7 +338,7 @@ void vendor_update(P_2a57a8 *vendor_moby) { if (!(D_L00_0015F5CC_2a57a8 & 7) && vector_distance_xy(&vendor_moby->f10, &hero_pos) <= 16.0f && absolute_float(vendor_moby->f18 - hero_pos.f[2]) <= 8.0f) { - vendor_moby->vendor_state = 2; + vendor_moby->vendor_state = VENDOR_HERO_NEARBY; if (vendor_moby->b53 != 1) blend_moby_animation(vendor_moby, 1, 0, 10); q->mC->h34 &= 0xFFFE; @@ -360,7 +360,7 @@ void vendor_update(P_2a57a8 *vendor_moby) { hero_distance = vector_distance_xy(&vendor_moby->f10, &hero_pos); z = absolute_float(vendor_moby->f18 - hero_pos.f[2]); if (!(D_L00_0015F5CC_2a57a8 & 7) && (hero_distance > 18.0f || z > 10.0f)) { - vendor_moby->vendor_state = 1; + vendor_moby->vendor_state = VENDOR_WAIT_FOR_HERO; if (vendor_moby->b53) blend_moby_animation(vendor_moby, 0, 0, 10); break; @@ -408,7 +408,7 @@ void vendor_update(P_2a57a8 *vendor_moby) { help_message_succeeded = try_set_help_message(1, 0x53E3) != 0; if ((pad_pressed_lui & 0x10) && interaction_allowed && help_message_succeeded) { open_vendor_menu(vendor_moby); - vendor_moby->vendor_state = 3; + vendor_moby->vendor_state = VENDOR_ZERO_AUXILIARY_SCALE; } break; case VENDOR_ZERO_AUXILIARY_SCALE: From 9fc14480a1b56e87bc56979675c375557481694f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:47:07 +0000 Subject: [PATCH 372/758] decomp: clarify names in update_veldin_robot_damage_and_targeting domain_0_value_254 -> MOBY_STATE_MARKED_FOR_REMOVAL: Assigned retail 0x002e1a08-0x002e1a24 forms candidate_target from moby_table with stride 0x100, reads its state byte +0x20, and rejects 0xFE. Checked caller 0x002e0b88 calls assigned root at 0x002e0bb8, and calls established mark_moby_for_removal (0x0024eb68) at 0x002e1630 after death-knockback effects. Checked removal instructions 0x0024eb8c load 0xFE and 0x0024eb90 store it to the same input moby's state +0x20; 0x0024eb9c-0x0024ebb0 schedule a global counter plus two at +0x38. This proves a marked-for-removal state without assuming a specific pool class. The alternate 0xFD removal marker remains unnamed. --- src/overlays/l00/mobys/veldin_robot_enemy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l00/mobys/veldin_robot_enemy.c b/src/overlays/l00/mobys/veldin_robot_enemy.c index 8feca7bb90..51ea4f19d6 100644 --- a/src/overlays/l00/mobys/veldin_robot_enemy.c +++ b/src/overlays/l00/mobys/veldin_robot_enemy.c @@ -441,6 +441,9 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { VELDIN_ROBOT_TARGET_SELECTION_ALTERNATE_MOBY = 1, VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE = 2 }; + enum { + MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE + }; ElectroidVars *vars; void *anim; ElectroidHit *coll; @@ -528,7 +531,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 == 0xFE || + if (candidate_target == 0 || candidate_target->state == MOBY_STATE_MARKED_FOR_REMOVAL || candidate_target->state == 0xFD) { vars->candidate_target_moby_index = -1; } else { From eee82e8e49b8f6886eaf1733f50177d18f06686a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:49:22 +0000 Subject: [PATCH 373/758] decomp: clarify names in flying_car_update domain_0_value_0 -> VOICE_SLOT_FREE: Retail 0x00306f94-0x00306fb0 indexes voice_pool (0x0013E550) by flying_car_data->sound*0x70; 0x00306fb4-0x00306fb8 verifies entry+0x88 owns flying_car_moby, and 0x00306fc0-0x00306fc4 tests the entry state byte at +0x74 against zero before release_voice_slot at 0x00306fcc. The bound C's path-motion helper performs the identical operation using VoicePoolWindow.voice.owner and VoicePoolWindow.voice.state; checked helper 0x00307730-0x00307758 confirms the same pool, stride, owner and state accesses. Thus the selector is the voice-slot state domain, and the supplied existing VOICE_SLOT_FREE=0 is its canonical free state, rather than a Hero or flying-car state. --- src/overlays/l14/mobys/flying_car.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l14/mobys/flying_car.c b/src/overlays/l14/mobys/flying_car.c index f1cf705fac..bfc3014dd2 100644 --- a/src/overlays/l14/mobys/flying_car.c +++ b/src/overlays/l14/mobys/flying_car.c @@ -140,7 +140,7 @@ void flying_car_update(struct Moby *flying_car_moby) { } if (flying_car_data->sound != -1) { Snd_6ee0 *voice_entry = (Snd_6ee0 *)((u8 *)&voice_pool + flying_car_data->sound * 0x70); - if (voice_entry->f88 == flying_car_moby && voice_entry->voice_state != 0) { + if (voice_entry->f88 == flying_car_moby && voice_entry->voice_state != VOICE_SLOT_FREE) { release_voice_slot(flying_car_data->sound); } } From ed271ef6af45f1b26a6a238cced9a0cec6036a71 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:49:26 +0000 Subject: [PATCH 374/758] decomp: clarify names in the_plumber_update i4C -> camera_cuboid_index: The bound C checks this int against -1, indexes l01_cuboids with it, and passes camera_record->pos and camera_record->rot to jet_reset_camera. Retail 0x002ff2b8 loads pvars+0x4c, 0x002ff2bc-0x002ff2c0 skips -1, and 0x002ff2c4-0x002ff2cc computes the cuboid table base plus this index times 0x80. At 0x002ff2d0-0x002ff2d8 the indexed record's +0x30 and +0x70 feed the camera-reset call. It is an optional camera cuboid index, not a byte offset or pointer. p20 -> dialogue_data: The bound C assigns plumber_level_one_dialogue_data, plumber_level_eight_dialogue_data or plumber_fallback_dialogue_data to this void pointer, then calls initialize_npc_dialogue with the same plumber_vars. Retail 0x002ff1f8-0x002ff1fc and 0x002ff214-0x002ff228 select 0x0020b600, 0x00161d38 or 0x00161d48 and store the selected address at s2+0x20; 0x002ff230-0x002ff238 passes s2 as the dialogue initializer's second argument. This proves the selected dialogue-data pointer role without assigning a record format. --- src/overlays/shared/cutscenes/the_plumber.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/cutscenes/the_plumber.c b/src/overlays/shared/cutscenes/the_plumber.c index 1c137965dc..8dacd1f11c 100644 --- a/src/overlays/shared/cutscenes/the_plumber.c +++ b/src/overlays/shared/cutscenes/the_plumber.c @@ -64,11 +64,11 @@ typedef struct { short h6; unsigned char b8; char pad09[0x17]; - void *p20; + void *dialogue_data; char pad24[0x20]; int i44; char pad48[4]; - int i4C; + int camera_cuboid_index; char body[0x64]; float pitch; float yaw; @@ -180,13 +180,13 @@ void the_plumber_update(L01WatchMoby *plumber_moby) { mark_moby_for_removal(plumber_moby); return; } - plumber_vars->p20 = (void *)plumber_level_one_dialogue_data; + plumber_vars->dialogue_data = (void *)plumber_level_one_dialogue_data; plumber_moby->state = PLUMBER_LEVEL_ONE_DIALOGUE; } else if (current_level_index == 8) { - plumber_vars->p20 = (void *)plumber_level_eight_dialogue_data; + plumber_vars->dialogue_data = (void *)plumber_level_eight_dialogue_data; plumber_moby->state = PLUMBER_LEVEL_EIGHT_DIALOGUE; } else { - plumber_vars->p20 = (void *)plumber_fallback_dialogue_data; + plumber_vars->dialogue_data = (void *)plumber_fallback_dialogue_data; plumber_moby->state = PLUMBER_FALLBACK_DIALOGUE_INITIALIZED; } initialize_npc_dialogue(plumber_moby, plumber_vars); @@ -202,8 +202,8 @@ void the_plumber_update(L01WatchMoby *plumber_moby) { break; if (visited52[plumber_moby->bB0 + current_level_index * 16] != 0xFF) { jet_clear_persistent(plumber_moby->bB0); - if (plumber_vars->i4C != -1) { - LevelCuboid *camera_record = &l01_cuboids[plumber_vars->i4C]; + if (plumber_vars->camera_cuboid_index != -1) { + LevelCuboid *camera_record = &l01_cuboids[plumber_vars->camera_cuboid_index]; jet_reset_camera(&camera_record->pos, &camera_record->rot); } } From c289811ef23830219c9ecfba8a9bf8b442a798f4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:49:30 +0000 Subject: [PATCH 375/758] decomp: clarify names in initialize_pause_menu unk218 -> fog_start_distance: Assigned retail 0027653C forms ViewSettings base 0016CA40; 00276570 clears +0x218 (0016CC58), while 00276568/6C/78 set +0x21C=524288, +0x228=255 and +0x22C=0 before update_view_context. Checked helper 001F7B38..001F7BE8 reads start at +0x218 and end at +0x21C, computes their difference and derives interpolation slope (output_end-output_start)/((end-start)/1024), then intercept output_start-start/1024*slope. Domain is established by source-named update_fog: checked common caller 00276CF0 calls 001F7170, while 00276EEC calls assigned initializer. update_fog writes this exact field at 001F71D8 or 001F7244 from the first float of its selected fog settings, alongside three RGB bytes expanded into +0x230/+0x234/+0x238 and the other fog endpoints, then calls 001F7980 at 001F7258. This identifies the field as the first fog-distance endpoint; all types and operations remain unchanged. --- src/overlays/shared/ui/menus/initialize_pause_menu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/ui/menus/initialize_pause_menu.c b/src/overlays/shared/ui/menus/initialize_pause_menu.c index bd0a095e16..bf8afcb3bf 100644 --- a/src/overlays/shared/ui/menus/initialize_pause_menu.c +++ b/src/overlays/shared/ui/menus/initialize_pause_menu.c @@ -127,7 +127,7 @@ typedef struct { u8 pad0[0xB0]; f32 tan_half_fov; u8 padB4[0x164]; - s32 unk218; + s32 fog_start_distance; f32 unk21C; u8 pad220[8]; f32 unk228; @@ -294,7 +294,7 @@ void initialize_pause_menu(void) { ((ViewSettings *)D_L00_0016CA40)->unk21C = unk21C; ((ViewSettings *)D_L00_0016CA40)->unk228 = unk228; ((ViewSettings *)D_L00_0016CA40)->unk22C = 0; - ((ViewSettings *)D_L00_0016CA40)->unk218 = 0; + ((ViewSettings *)D_L00_0016CA40)->fog_start_distance = 0; } update_view_context(); reset_active_camera_position_and_basis(); From a2d19778d9e45dc6df47d9446e814d5db2b1eb89 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:54:44 +0000 Subject: [PATCH 376/758] decomp: clarify names in handle_sand_shark_damage_and_targeting f170 -> knockback_ascent_animation_target: Assigned retail 0x002d600c stores 7.0 at pvars+0x170 after starting lethal-hit knockback. This is block+0x50. Checked step_moby_motion starts substate 0 via start helper 0x0025ec18, and changes it to 1 when vertical velocity becomes negative at 0x0025f4c4-0x0025f4e0. In substate 0, 0x0025f024-0x0025f078 computes absolute vertical_velocity/gravity, subtracts the animation scalar returned by 0x002511b0 from block+0x50, divides the difference by that ascent time, and approaches moby animation speed +0x58 toward it at 0x0025f17c-0x0025f18c. Checked scalar helper 0x002511cc-0x00251288 derives its result from moby animation entries +0x68/+0x6c and interpolation +0x54. Thus f170 is the ascent animation target; exact animation units are not asserted. f174 -> knockback_descent_animation_target: Assigned retail 0x002d6010 stores 14.0 at pvars+0x174, knockback block+0x54. In checked step_moby_motion, substate 1 begins when Z velocity becomes negative at 0x0025f4c4-0x0025f4e0. Its branch 0x0025f080-0x0025f0a0 compares the animation scalar from 0x002511b0 with block+0x54 and zeros animation speed when the target is reached. Otherwise 0x0025f0a4-0x0025f13c estimates remaining ground-arrival time from gravity, Z velocity and height, then divides target-minus-current animation scalar by that time and approaches the resulting animation speed at 0x0025f170-0x0025f18c. The scalar helper reads animation entries/interpolation at 0x002511cc-0x00251288. This establishes the descent animation target without asserting exact frame units. i140 -> knockback_collision_radius: Assigned retail 0x002d5e80/0x002d5edc initializes pvars+0x140 to 0x200, block+0x20 relative to knock at +0x120. Checked step_moby_motion 0x0025f338-0x0025f34c converts that integer and multiplies by 1/1024 before passing it as f12 to 0x00201c48. That helper transfers f12 to vf30 at 0x00201c6c-0x00201c7c, computes query-center minus/plus this scalar on XYZ at 0x00201c90/98, squares it at 0x00201ce0, and compares with squared point-to-triangle distance at 0x00202130-0x00202158. These geometric uses establish a collision radius, stored in integer units of 1/1024. --- src/overlays/l02/mobys/sand_shark.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 12109ce2d0..087e2f5306 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -1201,7 +1201,7 @@ typedef struct { float knockback_horizontal_speed_approach_step; float knockback_horizontal_speed; float knockback_initial_vertical_speed; - int i140; /* 0x140 */ + int knockback_collision_radius; /* 0x140 */ int knockback_flags; float knockback_collision_z_offset; int spawner_active_shark_count; /* 0x14C: count kept by the spawner moby */ @@ -1209,8 +1209,8 @@ typedef struct { unsigned char b15D; /* 0x15D */ char pad15E[0xE]; float knockback_target_horizontal_speed; /* 0x16C */ - float f170; - float f174; + float knockback_ascent_animation_target; + float knockback_descent_animation_target; char pad178[0x58]; float tgt[4]; /* 0x1D0: point followed along the path */ char pad1E0[0x30]; @@ -1306,7 +1306,7 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { moby_vars->hp -= dmg; if (moby_vars->hp <= 0.0f) { moby_vars->hp -= dmg; - moby_vars->i140 = 0x200; + moby_vars->knockback_collision_radius = 0x200; moby_vars->knockback_gravity_per_update = sand_shark_death_knockback_gravity_gp * frame_time_sq; moby_vars->knockback_horizontal_speed_approach_step = sand_shark_death_knockback_horizontal_speed_approach_rate_gp * frame_time_sq; @@ -1335,8 +1335,8 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { trooper_knockback_arc(&hit_knockback_vector, &k, &moby_vars->knockback_horizontal_speed, &moby_vars->knockback_initial_vertical_speed); trooper_start_knockback(k, moby, moby_vars->knock, 6, 1, 0); moby_vars->knockback_collision_z_offset = 0.85f; - moby_vars->f170 = 7.0f; - moby_vars->f174 = 14.0f; + moby_vars->knockback_ascent_animation_target = 7.0f; + moby_vars->knockback_descent_animation_target = 14.0f; moby[0x20] = 0x18; MOBY(moby)->collision = 0; moby_vars->hit_flash_target_red = 0x78; From 11aae835d99b8e6acb6bdfd29ec1fd0521233f0c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:56:42 +0000 Subject: [PATCH 377/758] decomp: clarify names in vendor_update f24 -> auxiliary_scale_multiplier: In the source, N_2a57a8::f24 is loaded through q->mC->p24 and multiplied by effect_scale_factor and 2.5f to produce q->mC->auxiliary_scale in both fade states and the zero-scale state. Retail 0x002a5a8c loads auxiliary moby+0x24; 0x002a5a98 loads its f32 +0x24; 0x002a5aa0-0x002a5aa8 multiplies that value by effect_scale_factor and 2.5 then stores auxiliary_scale at moby+0x2c before update_entity. The same flow repeats at 0x002a5bf8-0x002a5c18 and 0x002a5d90-0x002a5da8. This proves an auxiliary-scale multiplier without inferring its underlying model/class meaning. --- src/overlays/shared/vendor/vendor.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/vendor/vendor.c b/src/overlays/shared/vendor/vendor.c index 79e0006d8c..57c493c347 100644 --- a/src/overlays/shared/vendor/vendor.c +++ b/src/overlays/shared/vendor/vendor.c @@ -37,7 +37,7 @@ typedef struct { typedef struct { u8 p0[0x24]; - f32 f24; + f32 auxiliary_scale_multiplier; } N_2a57a8; typedef struct { @@ -351,7 +351,7 @@ void vendor_update(P_2a57a8 *vendor_moby) { fast_add_rotations(vendor_manipulator_rotation_phase, 0.01f); vendor_manipulator_counter_rotation_phase = fast_add_rotations(vendor_manipulator_counter_rotation_phase, -0.02f); - q->mC->auxiliary_scale = q->effect_scale_factor * q->mC->p24->f24 * 2.5f; + q->mC->auxiliary_scale = q->effect_scale_factor * q->mC->p24->auxiliary_scale_multiplier * 2.5f; update_entity(q->mC); break; case VENDOR_HERO_NEARBY: @@ -375,7 +375,7 @@ void vendor_update(P_2a57a8 *vendor_moby) { fast_add_rotations(vendor_manipulator_rotation_phase, 0.01f); vendor_manipulator_counter_rotation_phase = fast_add_rotations(vendor_manipulator_counter_rotation_phase, -0.02f); - q->mC->auxiliary_scale = q->effect_scale_factor * q->mC->p24->f24 * 2.5f; + q->mC->auxiliary_scale = q->effect_scale_factor * q->mC->p24->auxiliary_scale_multiplier * 2.5f; update_entity(q->mC); if (hero.state.control_mode != 0 && hero.state.current != 3 && hero.state.control_mode != 1) { @@ -414,7 +414,7 @@ void vendor_update(P_2a57a8 *vendor_moby) { case VENDOR_ZERO_AUXILIARY_SCALE: if (q->mC) { q->effect_scale_factor = 0.0f; - q->mC->auxiliary_scale = q->mC->p24->f24 * q->effect_scale_factor * 2.5f; + q->mC->auxiliary_scale = q->mC->p24->auxiliary_scale_multiplier * q->effect_scale_factor * 2.5f; update_entity(q->mC); } break; From a2f40e5af512eebd7866c7d86d47b6b6186fd159 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:58:49 +0000 Subject: [PATCH 378/758] decomp: clarify names in scenery_ship_update f320 -> trail_segment_count: Retail 0x002d7500-0x002d7538 loads instance+0x320 as a signed short, compares it with l05_scenery_ship_trail_segment_limit and increments it on every fourth frame until the limit. Original Ghidra shows the same short piVar2[200] comparison/increment. Supplied draw_group_scenery_ship_trails C uses +0x320 as the upper bound of the frame loop drawing history segments, proving this is the trail segment count. f322 -> trail_write_index: Retail 0x002d7504-0x002d7530 increments instance+0x322 modulo 16. Loads at 0x002d7594, 0x002d75f8 and 0x002d7658 multiply this index by 16 and address the three trail histories at +0x20, +0x120 and +0x220 for current transformed position writes. Original Ghidra and authoritative trail[3][16] C agree. Supplied drawing C reads this same index to traverse the history backwards, proving the current trail write index. f324 -> trail_last_queued_frame_ptr: Retail 0x002d768c loads the int pointer at instance+0x324; 0x002d7690-0x002d769c compares its pointee with frame_number and stores the current frame only when different. 0x002d76a0-0x002d76a8 then queues callback 0x002d7920, identified by supplied C as draw_group_scenery_ship_trails. Original Ghidra piVar2[0xc9] and authoritative C show the same dereferenced frame guard, proving a pointer to the last queued trail-draw frame. f328 -> voice_slot_index: Initialization stores -1 to instance+0x328 at retail 0x002d7210. Retail 0x002d74c4-0x002d74e8 passes that member to voice_is_playing and replaces it with allocate_voice_for_target_entry(1,4,moby) when playback is absent. Original Ghidra piVar2[0xca] shows the same flow. Supplied allocator C returns slot_index from allocate_voice_slot and uses it to index voice_pool, proving that this member stores a voice slot index. f368 -> glow_quad_pulse_phase: Retail 0x002d720c/0x002d721c initializes instance+0x368 from random_angle_radians, corresponding to original Ghidra piVar2[0xda]. The authoritative update_moby_glow_and_queue_draw helper C advances this same member with fast_add_rotations(frame_time * 1.9198622f), feeds its sine into the two-color interpolation, and stores the resulting color for the glow quads at +0x360. The assigned retail calls that helper at 0x002d7854, proving a glow quad color pulse phase rather than an arbitrary float. f8 -> path_sample_position: Retail 0x002d7438-0x002d744c converts the selected path's node count to float, multiplies by instance+0x4 and stores instance+0x8; original Ghidra expresses this as piVar2[2] = (float)*piVar3 * (float)piVar2[1]. Follow-path calls advance_scenery_ship_along_path at 0x002d74bc. In the supplied authoritative helper C, moby_data[2] is incremented, wrapped by path[0], and passed as the final sample_camera_path parameter that produces the moby's position and rotation. This proves the stored path sample position, without assuming physical distance units. --- src/overlays/l05/mobys/scenery_ship.c | 44 +++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/overlays/l05/mobys/scenery_ship.c b/src/overlays/l05/mobys/scenery_ship.c index f755106001..98bb215e2a 100644 --- a/src/overlays/l05/mobys/scenery_ship.c +++ b/src/overlays/l05/mobys/scenery_ship.c @@ -115,17 +115,17 @@ typedef union { typedef struct { /* 0x000 */ int path; /* 0x004 */ float f4; - /* 0x008 */ float f8; + /* 0x008 */ float path_sample_position; /* 0x00C */ float fC; /* 0x010 */ int pad10[3]; /* 0x01C */ float f1C; /* 0x020 */ Vec4f_2d7140 trail[3][16]; - /* 0x320 */ short f320; - /* 0x322 */ unsigned short f322; - /* 0x324 */ int *f324; - /* 0x328 */ int f328; + /* 0x320 */ short trail_segment_count; + /* 0x322 */ unsigned short trail_write_index; + /* 0x324 */ int *trail_last_queued_frame_ptr; + /* 0x328 */ int voice_slot_index; /* 0x32C */ int pad32C[15]; - /* 0x368 */ float f368; + /* 0x368 */ float glow_quad_pulse_phase; } Data_2D8388; extern float D_0015ED6C; @@ -199,8 +199,8 @@ void scenery_ship_update(char *moby) { MOBY(moby)->scale = MOBY(moby)->pclass->scale * scenery_ship_initialization_scale_multiplier_gp; scenery_ship_instance_vars->f1C = random_angle_radians(); - scenery_ship_instance_vars->f328 = -1; - scenery_ship_instance_vars->f368 = random_angle_radians(); + scenery_ship_instance_vars->voice_slot_index = -1; + scenery_ship_instance_vars->glow_quad_pulse_phase = random_angle_radians(); path = ((char *)l05_paths[scenery_ship_instance_vars->path]); if (*(float *)(path + 0x1C) == -1.0f) { max_turn = 0.0f; @@ -244,7 +244,7 @@ void scenery_ship_update(char *moby) { scenery_ship_instance_vars->fC = fast_vec_dist((float *)(path + 0x10), (float *)(path + 0x20)); MOBY(moby)->state = SCENERY_SHIP_FOLLOW_PATH; - scenery_ship_instance_vars->f8 = (float)*(int *)path * scenery_ship_instance_vars->f4; + scenery_ship_instance_vars->path_sample_position = (float)*(int *)path * scenery_ship_instance_vars->f4; break; } case SCENERY_SHIP_FOLLOW_PATH: { @@ -256,13 +256,13 @@ void scenery_ship_update(char *moby) { MOBY(moby)->glow_color = func_001FA8A8_2D8388(l05_scenery_ship_glow_pulse_start_color, l05_scenery_ship_glow_pulse_end_color, (wave + 1.0f) * 0.5f); advance_scenery_ship_along_path(moby, (int *)l05_paths[scenery_ship_instance_vars->path]); - if (voice_is_playing(moby, scenery_ship_instance_vars->f328) == 0) { - scenery_ship_instance_vars->f328 = allocate_voice_for_target_entry(1, 4, (int)moby); + if (voice_is_playing(moby, scenery_ship_instance_vars->voice_slot_index) == 0) { + scenery_ship_instance_vars->voice_slot_index = allocate_voice_for_target_entry(1, 4, (int)moby); } if ((frame_number & 3) == 0) { - scenery_ship_instance_vars->f322 = (scenery_ship_instance_vars->f322 + 1) & 0xF; - if ((float)scenery_ship_instance_vars->f320 < l05_scenery_ship_trail_segment_limit) { - scenery_ship_instance_vars->f320++; + scenery_ship_instance_vars->trail_write_index = (scenery_ship_instance_vars->trail_write_index + 1) & 0xF; + if ((float)scenery_ship_instance_vars->trail_segment_count < l05_scenery_ship_trail_segment_limit) { + scenery_ship_instance_vars->trail_segment_count++; } } left_offset.q = 0; @@ -271,31 +271,31 @@ void scenery_ship_update(char *moby) { left_offset.f[2] = 0.45f; transform_vector_by_basis(&left_offset, &left_offset, moby + 0xC0); func_001F9BD8_2D8388( - (float *)&scenery_ship_instance_vars->trail[0][(short)scenery_ship_instance_vars->f322], + (float *)&scenery_ship_instance_vars->trail[0][(short)scenery_ship_instance_vars->trail_write_index], left_offset.f, (float *)&MOBY(moby)->pos); - scenery_ship_instance_vars->trail[0][(short)scenery_ship_instance_vars->f322].w = 1.0f; + scenery_ship_instance_vars->trail[0][(short)scenery_ship_instance_vars->trail_write_index].w = 1.0f; tail_offset.q = 0; tail_offset.f[0] = -1.5f; tail_offset.f[2] = -0.3f; transform_vector_by_basis(&tail_offset, &tail_offset, moby + 0xC0); func_001F9BD8_2D8388( - (float *)&scenery_ship_instance_vars->trail[1][(short)scenery_ship_instance_vars->f322], + (float *)&scenery_ship_instance_vars->trail[1][(short)scenery_ship_instance_vars->trail_write_index], tail_offset.f, (float *)&MOBY(moby)->pos); - scenery_ship_instance_vars->trail[1][(short)scenery_ship_instance_vars->f322].w = 1.0f; + scenery_ship_instance_vars->trail[1][(short)scenery_ship_instance_vars->trail_write_index].w = 1.0f; right_offset.q = 0; right_offset.f[0] = -1.2f; right_offset.f[1] = -0.4f; right_offset.f[2] = 0.45f; transform_vector_by_basis(&right_offset, &right_offset, moby + 0xC0); func_001F9BD8_2D8388( - (float *)&scenery_ship_instance_vars->trail[2][(short)scenery_ship_instance_vars->f322], + (float *)&scenery_ship_instance_vars->trail[2][(short)scenery_ship_instance_vars->trail_write_index], right_offset.f, (float *)&MOBY(moby)->pos); - scenery_ship_instance_vars->trail[2][(short)scenery_ship_instance_vars->f322].w = 1.0f; - if (frame_number != *scenery_ship_instance_vars->f324) { - *scenery_ship_instance_vars->f324 = frame_number; + scenery_ship_instance_vars->trail[2][(short)scenery_ship_instance_vars->trail_write_index].w = 1.0f; + if (frame_number != *scenery_ship_instance_vars->trail_last_queued_frame_ptr) { + *scenery_ship_instance_vars->trail_last_queued_frame_ptr = frame_number; add_draw_callback(func_L05_002D8B68_2D8388, moby); } if (MOBY(moby)->pos.x < 8.0f) { From 71bab9deff14e1d75584670330f1bef6954bf715 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 08:58:53 +0000 Subject: [PATCH 379/758] decomp: clarify names in update_hero_pitch_and_yaw_easing_targets f248 -> forward_collision_distance_xy: Producer retail 0x00221390-0x002213b0 initializes hero+0x248 to 4.0 then passes its address to assigned-source probe_hero_forward_collision (0x0020a240) with z=0.7 and range=4.0. That supplied C writes vector_distance_xy(hero position, collision_hit_point) through hit_distance_xy_out. Assigned retail 0x0020a630-0x0020a648 requires this distance >1.0 before the pitch override. f258 -> forward_drop_probe_distance: Checked sibling child 0x00221310, called from common-caller sibling hero_update at 0x0021180c, clears hero+0x258 at 0x0022142c. Retail 0x00221430-0x002214ac constructs a downward collision ray at local forward 1.1, from z=1 to z=-20 (end world z clamped to 0.5). On a distant hit, 0x002214bc-0x002214dc obtains the start-to-hit distance and requires >3; 0x00221544-0x00221554 stores that distance or the no-hit sentinel 20 at +0x258. Assigned 0x0020a60c-0x0020a628 tests >1.4 and 0x0020a674-0x0020a6ac uses it to derive pitch. f25c -> forward_drop_probe_clearance_offset: Producer 0x002214e4-0x00221540 tries collision spheres of hero capsule radius (+0x234) at local forward 1.1+offset, with offset beginning -0.4 and increasing by 0.1 until a clear sphere is found. Retail 0x00221558-0x00221578 stores max(0, capsule_radius+successful offset) at hero+0x25c. Assigned retail 0x0020a6c0-0x0020a6e4 computes (1-this clearance offset)*35*DEG_TO_RAD as the upper pitch limit. This proves a clearance offset associated with the forward drop probe, rather than a world coordinate. i260 -> forward_drop_detected: Checked producer retail 0x0022141c-0x0022142c resets hero+0x260 to zero. A downward probe at forward 1.1 must miss or hit more than 3 units away (0x00221490-0x002214dc); the subsequent capsule-radius sphere probes must find a clear position (0x00221518-0x00221540). Only this path stores 1 at +0x260 (0x00221544-0x00221548). Assigned 0x0020a600-0x0020a648 gates the distance-driven pitch override on this detection flag and the two probe-distance thresholds. --- 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 95756820b5..504d81e894 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -2849,11 +2849,11 @@ void clear_hero_idle_rotation_targets(void) { typedef struct { char p000[0x248]; - f32 f248; + f32 forward_collision_distance_xy; char p24c[0x258 - 0x24C]; - f32 f258; - f32 f25c; - s32 i260; + f32 forward_drop_probe_distance; + f32 forward_drop_probe_clearance_offset; + s32 forward_drop_detected; char p264[0x1004 - 0x264]; f32 idle_pitch_target_radians; f32 idle_yaw_target_radians; @@ -2896,13 +2896,13 @@ void update_hero_pitch_and_yaw_easing_targets(void) { } else { approach_value(&D_0015EE14, 0.92f, 0.05f); } - if (G.i260 != 0 && 1.4f < G.f258 && 1.0f < G.f248) { + if (G.forward_drop_detected != 0 && 1.4f < G.forward_drop_probe_distance && 1.0f < G.forward_collision_distance_xy) { set_fourth_hero_easing_parameters(frame_scale_sq * 0.015f, frame_scale_sq * 0.3f); - pitch_target_radians = G.f258 * 1.5f * DEG_TO_RAD + 0.19198622f; + pitch_target_radians = G.forward_drop_probe_distance * 1.5f * DEG_TO_RAD + 0.19198622f; if (0.47123888f < pitch_target_radians) pitch_target_radians = 0.47123888f; - if ((1.0f - G.f25c) * 35.0f * DEG_TO_RAD < pitch_target_radians) - pitch_target_radians = (1.0f - G.f25c) * 35.0f * DEG_TO_RAD; + if ((1.0f - G.forward_drop_probe_clearance_offset) * 35.0f * DEG_TO_RAD < pitch_target_radians) + pitch_target_radians = (1.0f - G.forward_drop_probe_clearance_offset) * 35.0f * DEG_TO_RAD; hero_eases[3].rot_target.f[1] = pitch_target_radians; set_second_hero_easing_parameters(frame_scale_sq * 0.008f, frame_scale_sq * 0.3f); hero_eases[1].rot_target.f[1] = hero_eases[3].rot_target.f[1] * 0.7f; From 07eafbe3262163a3ac1c037fdc719189027fafb1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:02:32 +0000 Subject: [PATCH 380/758] decomp: clarify names in the_plumber_update domain_0_value_2 -> CUTSCENE_MODE_ACTIVE: The bound C's attach_cutscene_big_head_manipulator already names cutscene_mode value 2 CUTSCENE_MODE_ACTIVE. Bounded retail helper 0x002ff030/0x002ff038/0x002ff058 loads global 0x0015f5c4 and gates the cutscene participant manipulator loop on equality to 2, proving the identical selector domain rather than numeric coincidence. Assigned retail 0x002ff274-0x002ff280 loads that same global and defers level-one post-dialogue cleanup while it equals 2, after update_npc_dialogue and begin_dialogue_camera_transition at 0x002ff248-0x002ff270. domain_1_value_2 -> CUTSCENE_MODE_ACTIVE: The bound C's attach_cutscene_big_head_manipulator already names cutscene_mode value 2 CUTSCENE_MODE_ACTIVE. Bounded retail helper 0x002ff030/0x002ff038/0x002ff058 loads global 0x0015f5c4 and gates the cutscene participant manipulator loop on equality to 2, proving the identical selector domain rather than numeric coincidence. Assigned retail 0x002ff36c-0x002ff378 loads that same global and defers level-eight post-dialogue processing while it equals 2; dialogue completion entered this handler at 0x002ff350-0x002ff368. --- src/overlays/shared/cutscenes/the_plumber.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/cutscenes/the_plumber.c b/src/overlays/shared/cutscenes/the_plumber.c index 8dacd1f11c..48ed412803 100644 --- a/src/overlays/shared/cutscenes/the_plumber.c +++ b/src/overlays/shared/cutscenes/the_plumber.c @@ -157,6 +157,9 @@ void the_plumber_update(L01WatchMoby *plumber_moby) { enum { PLUMBER_FALLBACK_DIALOGUE_INITIALIZED = 7 }; + enum { + CUTSCENE_MODE_ACTIVE = 2 + }; L01WatchScratch look_tracking_vectors; L01WatchData *plumber_vars = (L01WatchData *)plumber_moby->data; float rate; @@ -198,7 +201,7 @@ void the_plumber_update(L01WatchMoby *plumber_moby) { } break; case PLUMBER_LEVEL_ONE_POST_DIALOGUE: - if (cutscene_mode == 2) + if (cutscene_mode == CUTSCENE_MODE_ACTIVE) break; if (visited52[plumber_moby->bB0 + current_level_index * 16] != 0xFF) { jet_clear_persistent(plumber_moby->bB0); @@ -227,7 +230,7 @@ void the_plumber_update(L01WatchMoby *plumber_moby) { } break; case PLUMBER_LEVEL_EIGHT_POST_DIALOGUE: - if (cutscene_mode == 2) + if (cutscene_mode == CUTSCENE_MODE_ACTIVE) break; if (plumber_vars->h6 == 2) { D_0013F350_w.f80 = 130.5f; From ba9b93275e6b7493708f6f015a562e38c81e8517 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:04:39 +0000 Subject: [PATCH 381/758] decomp: clarify names in flying_car_update f74 -> path_sampling_state: Data_6ee0.f74 is cleared at assigned retail 0x003073b0 alongside +0x70 when the first path pose and heading are restored (0x003073a4-0x003073d8). The bound C also initializes private +0x74 to zero in initialize_flying_car_path, then passes its address as sample_path's fourth argument on each update_flying_car_path_motion call. Checked level-14 helper report 5d643489fa87754809372d1a1fd66273fea79d47791d91533c1e01bc9dcb7273 confirms private data loaded at 0x0030765c, +0x74 supplied in a3 at 0x0030766c, selected path in a0 and sampled position output in a1 at 0x00307648/0x00307684, and sampler call at 0x00307680. This proves persistent path-sampling state without claiming a fraction, distance or segment index. --- src/overlays/l14/mobys/flying_car.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/flying_car.c b/src/overlays/l14/mobys/flying_car.c index bfc3014dd2..db8b85469c 100644 --- a/src/overlays/l14/mobys/flying_car.c +++ b/src/overlays/l14/mobys/flying_car.c @@ -44,7 +44,7 @@ typedef struct { char pad0[0x60]; unsigned char effect[0x10]; /* 0x60 */ int f70; - int f74; + int path_sampling_state; int path; /* 0x78 */ int sound; /* 0x7C */ float position_x_spring_state; @@ -259,7 +259,7 @@ void flying_car_update(struct Moby *flying_car_moby) { flying_car_data->timer = scale_game_frames(flying_car_path_reset_delay_frames_gp); flying_car_moby->state = FLYING_CAR_FOLLOW_PATH; flying_car_data->f70 = 0; - flying_car_data->f74 = 0; + flying_car_data->path_sampling_state = 0; qcopy(&flying_car_moby->pos, &path->a); flying_car_moby->rot.z = fast_arc_tan(path->b.x - path->a.x, path->b.y - path->a.y); flying_car_data->position_x_spring_state = flying_car_data->position_y_spring_state = flying_car_data->f88 = 0.0f; From 64e1a1d313908d31a65531771c63cdd79509267b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:04:43 +0000 Subject: [PATCH 382/758] decomp: clarify names in bomber_tank_update unk16C -> path_target_speed: Assigned retail 002d4518/002d4524/002d4530 initializes pvars+0x16C to twice frame_time. Checked direct path helper 002d55c8 loads the same moby->pvars at 002d55fc; 002d5694 passes pvars+0x180 as the mutable current speed and 002d5698 loads pvars+0x16C as the target argument to the approach-value call at 002d569c. Subsequent 002d56ac-002d56dc multiplies the resulting +0x180 speed by heading cosine/sine and adds that vector to moby position. Supplied PathMoverVars source independently names this same +0x16C member target_speed. Thus this field is the target speed for path movement, not a timer or turn rate. unk2E -> removal_control: Assigned retail 002d4310 loads moby->pvars; 002d432c reads its byte +0x2E and 002d4330-002d4334 compares it with 2. On equality 002d433c-002d4368 calls mark_moby_for_removal for each nonnull linked part at +0x160/+0x164 and then the owner, returning before damage/aim or state dispatch. Initialization stores 1 to that same byte at 002d4704. The authoritative BomberTankVars C uses unk2E in precisely this removal gate, proving removal_control without asserting meanings for other byte values. --- src/overlays/l08/mobys/bomber_tank.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l08/mobys/bomber_tank.c b/src/overlays/l08/mobys/bomber_tank.c index 60878eb424..5ad3803303 100644 --- a/src/overlays/l08/mobys/bomber_tank.c +++ b/src/overlays/l08/mobys/bomber_tank.c @@ -105,7 +105,7 @@ typedef struct { u8 unk29; u8 unk2A; u8 pad2B[3]; - u8 unk2E; /* 0x2E: 2 removes the tank and its parts */ + u8 removal_control; /* 0x2E: 2 removes the tank and its parts */ u8 pad2F; f32 unk30; u8 pad34[0xA]; @@ -130,7 +130,7 @@ typedef struct { Moby *part_a; /* 0x160 */ Moby *part_b; /* 0x164 */ u8 pad168[4]; - f32 unk16C; + f32 path_target_speed; f32 yaw; /* 0x170: added to rot.z for shots */ u8 pad174[4]; f32 pitch; /* 0x178 */ @@ -151,7 +151,7 @@ void bomber_tank_update(Moby *moby) { qcopy(old_pos, &moby->pos); qcopy(old_rot, &moby->rot); - if (bomber_tank_update_vars->unk2E == 2) { + if (bomber_tank_update_vars->removal_control == 2) { if (bomber_tank_update_vars->part_a != 0) mark_moby_for_removal(bomber_tank_update_vars->part_a); if (bomber_tank_update_vars->part_b != 0) @@ -193,7 +193,7 @@ void bomber_tank_update(Moby *moby) { } attach_manipulator(moby, 0, bomber_tank_update_vars->manipulator); moby->flags |= 0x1000; - bomber_tank_update_vars->unk16C = frame_time + frame_time; + bomber_tank_update_vars->path_target_speed = frame_time + frame_time; if (bomber_tank_update_vars->trigger_moby > 0) { moby->state = BOMBER_TANK_STATE_WAIT_FOR_TRIGGER; moby->flags = (moby->flags & 0xEFFF) | 0x41; @@ -234,7 +234,7 @@ void bomber_tank_update(Moby *moby) { bomber_tank_update_vars->unk30 = 3.0f; bomber_tank_update_vars->health = 9.0f; bomber_tank_update_vars->unk2A = 12; - bomber_tank_update_vars->unk2E = 1; + bomber_tank_update_vars->removal_control = 1; bomber_tank_update_vars->flags |= 2; clear_u64_value(&bomber_tank_update_vars->unk40); bomber_tank_update_vars->pitch = 0.0f; @@ -336,7 +336,7 @@ void bomber_tank_update(Moby *moby) { case 12: /* Fakematch: a never-true test keeps case 12 a block of its own until gcse, which then puts the default path's copies where retail has them. */ if (never) - bomber_tank_update_vars->unk2E = 0; + bomber_tank_update_vars->removal_control = 0; break; case BOMBER_TANK_STATE_DAMAGED_FOLLOW_PATH: { float frame; From 9c07011480317db0074a1c408d41b04de919c1d1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:04:46 +0000 Subject: [PATCH 383/758] decomp: clarify names in process_moby_attachment_damage b67 -> damage_flash_red: Assigned retail 002e9c48-002e9c78 and 002e9fac-002e9fd4 subtract nonlethal damage, store 0xFA to data+0x67, then start the color animation with data+0x60. Checked level-13 helper 00269580 reads animation-state+7 at 00269610/00269630, interpolates from saved channel +4 at 0026962c-00269660, and passes that result in a1 at 002697b8-002697c4. The supplied trooper_anim_finish source identifies this as r1 blended against r0 and passed as red to set_moby_color; reverse-phase retail 002696dc-00269728 blends back to saved red. Therefore b67 is the damage-flash red target, not a timer or phase. --- 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 5e87ae1405..a4dfc190ca 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -675,7 +675,7 @@ typedef struct { Sub sub; char pad28[0x38]; char q60[7]; - unsigned char b67; + unsigned char damage_flash_red; char pad68[0x5C]; Moby_2EAE80 *list[11]; Moby_2EAE80 *first; @@ -783,7 +783,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { moby_data->first->bA4 = 0xFF; } else { dd->health = dd->health - r->damage_amount; - moby_data->b67 = 0xFA; + moby_data->damage_flash_red = 0xFA; mode = ATTACHMENT_DAMAGE_APPLIED; moby_data->sub.h6 = scale_game_frames(0); func_L00_0025E4B0_2EAE80(moby, moby_data->q60); @@ -878,7 +878,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { moby_data->list[i]->bA4 = 0xFF; } else { dd->health = dd->health - r->damage_amount; - moby_data->b67 = 0xFA; + moby_data->damage_flash_red = 0xFA; mode = ATTACHMENT_DAMAGE_APPLIED; moby_data->sub.h6 = scale_game_frames(0); func_L00_0025E4B0_2EAE80(moby, moby_data->q60); From 33433b6f4924a749dc2425bd4ddadf9187973c54 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:04:50 +0000 Subject: [PATCH 384/758] decomp: clarify names in update_path_key_camera m24 -> first_linked_moby_index: Retail 0x00315f28 loads record+0x24, 0x00315f38 shifts it by 8, and 0x00315f44 adds the moby-array base into s2. Source binds this result to first_linked_moby; retail reads its pvars at +0x78 and writes command +0xBC at 0x00315f7c, proving an index selecting that linked moby. m28 -> second_linked_moby_index: Retail 0x00315f48 loads record+0x28, 0x00315f54 shifts it by 8, and 0x00315f78 adds the moby-array base. Source binds this result to second_linked_moby; its command byte and pvars are accessed at 0x00315f8c-0x00315f90 and 0x00315fc0-0x00315fdc, proving the second linked-moby index. m2C -> third_linked_moby_index: Retail 0x00315f50 loads record+0x2C, 0x00315f5c shifts it by 8, and 0x00315f68 adds the moby-array base into s0. Source binds this result to third_linked_moby; retail writes command +0xBC at 0x00315fb4 and reads pvars +0x78 at 0x00315fbc for timer dispatch, proving the third linked-moby index. p34 -> side_zero_rail_spline_index: Retail 0x00315dc8 loads record+0x34, shifts by the 0x20 spline-record stride at 0x00315dd0, and reads the selected spline path at +0x10 at 0x00315de0. Equality with hero.rail_spline selects side 0 at 0x00315dec-0x00315df8. Source initialization also uses rec+0x34 to fill rail-distance row 0, proving the side-zero rail-spline index. --- src/overlays/l14/path_key_camera.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l14/path_key_camera.c b/src/overlays/l14/path_key_camera.c index 01f5a91d56..5aa61e3034 100644 --- a/src/overlays/l14/path_key_camera.c +++ b/src/overlays/l14/path_key_camera.c @@ -130,12 +130,12 @@ void initialize_path_key_camera(struct UpdateCam *path_key_camera_object) { typedef struct { char pad0[0x24]; - int m24; - int m28; - int m2C; + int first_linked_moby_index; + int second_linked_moby_index; + int third_linked_moby_index; short n30; short n32; - int p34; + int side_zero_rail_spline_index; int p38; } CamRec5d48; @@ -260,7 +260,7 @@ void update_path_key_camera(char *path_key_camera) { D_L14_001624B4 = data->st.count; D_L14_001624B8 = st->idx; - if (hero.rail_spline == (s32)l14_splines_macro[rec->p34].path) { + if (hero.rail_spline == (s32)l14_splines_macro[rec->side_zero_rail_spline_index].path) { side = 0; } else if (hero.rail_spline == (s32)l14_splines_macro[rec->p38].path) { side = 1; @@ -280,9 +280,9 @@ void update_path_key_camera(char *path_key_camera) { } if (rec->n30 < 3 && path_key_camera_linked_moby_event_progress_thresholds[rec->n30][side] <= D_L14_001624C0) { - struct Moby *first_linked_moby = (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->m24 << 8)); - struct Moby *second_linked_moby = (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->m28 << 8)); - struct Moby *third_linked_moby = (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->m2C << 8)); + struct Moby *first_linked_moby = (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->first_linked_moby_index << 8)); + struct Moby *second_linked_moby = (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->second_linked_moby_index << 8)); + struct Moby *third_linked_moby = (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->third_linked_moby_index << 8)); if (hero.rail_spline == (s32)l14_splines_macro[MOBYDATA_5d48(first_linked_moby)->zone].path) { From 92bb7995a9bd08e5b85e2cf7520a02422270b4f5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:04:54 +0000 Subject: [PATCH 385/758] decomp: clarify names in water_update b3C -> grid_alpha_2_fix: Cab +0x3c is initialized to 0x40 at 0030c6e0, then loaded at 0030cb70 and stored at 0030cb84 into the selected WaterGrid +0x1c. The authoritative C identifies that destination as alpha_2_fix, proving this parameter supplies the grid alpha_2 fixed factor. b3D -> grid_alpha_1_fix: Cab +0x3d is initialized to 0x40 at 0030c694, then loaded at 0030cb78 and stored at 0030cb94 into the selected WaterGrid +0x1d. The authoritative C identifies the destination as alpha_1_fix, proving this parameter supplies the grid alpha_1 fixed factor. f21 -> moby_list_id: The unsigned byte at water_moby +0x21 is loaded as a0 at 0030c874, 0030c910 and 0030ca5c for calls to set_moby_list_state with states 1, 2 and 4. It is also passed to the list helper at 0030c8c4/0030c960 and as a1 at 0030c870/0030c90c. Source and original Ghidra show it consistently identifies the moby list whose state is controlled. f38 -> water_direction_z: Retail 0030c63c obtains the XY direction angle; 0030c648-0030c660 computes cosine and sine scaled by 0.57735 and stores them at Cab +0x30/+0x34. At 0030c664-0030c6a4 the matching -0.57735 is stored at Cab +0x38. The authoritative source and original Ghidra show this third component of the initialized water direction vector; no lighting or flow interpretation is claimed. --- src/overlays/l07/mobys/water.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/l07/mobys/water.c b/src/overlays/l07/mobys/water.c index b8ce1e9bd3..a2ce4f078e 100644 --- a/src/overlays/l07/mobys/water.c +++ b/src/overlays/l07/mobys/water.c @@ -33,9 +33,9 @@ typedef struct { int i2C; float f30; /* 0x30 */ float f34; - float f38; - unsigned char b3C; /* 0x3C */ - unsigned char b3D; + float water_direction_z; + unsigned char grid_alpha_2_fix; /* 0x3C */ + unsigned char grid_alpha_1_fix; } Cab; typedef struct { @@ -59,7 +59,7 @@ typedef struct { char pad0[0x10]; float pos[4]; /* 0x10 */ unsigned char state; /* 0x20 */ - unsigned char f21; /* 0x21 */ + unsigned char moby_list_id; /* 0x21 */ char pad22[0x12]; unsigned short flags; /* 0x34 */ char pad36[0x42]; @@ -190,7 +190,7 @@ void water_update(Moby_30D8E8 *water_moby) { fast_arc_tan(water_direction_source->f10, water_direction_source->f14); cab->f30 = fast_cos(water_direction_xy_angle) * 0.57735f; cab->f34 = fast_sin(water_direction_xy_angle) * 0.57735f; - cab->f38 = -0.57735f; + cab->water_direction_z = -0.57735f; cab->i28 = 0x28; cab->i2C = 0x29; p = water_grid_geometry_descriptors; @@ -198,8 +198,8 @@ void water_update(Moby_30D8E8 *water_moby) { D_L07_0016120C = 32768.0f; D_L07_00161210 = 255.0f; D_L07_00161214 = 48.0f; - cab->b3C = 0x40; - cab->b3D = 0x40; + cab->grid_alpha_2_fix = 0x40; + cab->grid_alpha_1_fix = 0x40; D_L07_001612D0 = l07_water_grids; l07_water_grid_geometry_descriptor_base = p; D_L07_00161208 = 0; @@ -235,11 +235,11 @@ void water_update(Moby_30D8E8 *water_moby) { break; case WATER_APPROACH_LOW_HEIGHT: if (water_moby->sub & 4) { - set_moby_list_state(water_moby->f21, 1); - } else if (FUN_L07_00281ef8_2cd2b0(water_moby, water_moby->f21, 1, 0) && + set_moby_list_state(water_moby->moby_list_id, 1); + } else if (FUN_L07_00281ef8_2cd2b0(water_moby, water_moby->moby_list_id, 1, 0) && water_moby->sub != 1) { approach_value(&water_moby->pos[2], water_data->lo, D_0015ED6C * 4.0f); - FUN_L01_0026e090_2cd2b0(water_moby->f21, 1); + FUN_L01_0026e090_2cd2b0(water_moby->moby_list_id, 1); } else if (water_moby->sub == 1) { approach_value(&water_moby->pos[2], water_data->lo, D_0015ED6C * 4.0f); } @@ -252,11 +252,11 @@ void water_update(Moby_30D8E8 *water_moby) { break; case WATER_APPROACH_HIGH_HEIGHT: if (water_moby->sub & 8) { - set_moby_list_state(water_moby->f21, 2); - } else if (FUN_L07_00281ef8_2cd2b0(water_moby, water_moby->f21, 1, 0) && + set_moby_list_state(water_moby->moby_list_id, 2); + } else if (FUN_L07_00281ef8_2cd2b0(water_moby, water_moby->moby_list_id, 1, 0) && water_moby->sub != 2) { approach_value(&water_moby->pos[2], water_data->hi, D_0015ED6C * 4.0f); - FUN_L01_0026e090_2cd2b0(water_moby->f21, 2); + FUN_L01_0026e090_2cd2b0(water_moby->moby_list_id, 2); } else if (water_moby->sub == 2) { approach_value(&water_moby->pos[2], water_data->hi, D_0015ED6C * 4.0f); } @@ -271,7 +271,7 @@ void water_update(Moby_30D8E8 *water_moby) { if (water_data->volume >= 0 && is_point_inside_clip_volume(&hero.motion.pos, water_data->volume)) { water_data->f1C = 0; - set_moby_list_state(water_moby->f21, 4); + set_moby_list_state(water_moby->moby_list_id, 4); } break; case WATER_WAIT_BEFORE_RISING: @@ -305,8 +305,8 @@ void water_update(Moby_30D8E8 *water_moby) { } { Cab *cab = &l07_water_grid_parameters; - l07_water_grids[water_data->idx].alpha_2_fix = cab->b3C; - l07_water_grids[water_data->idx].alpha_1_fix = cab->b3D; + l07_water_grids[water_data->idx].alpha_2_fix = cab->grid_alpha_2_fix; + l07_water_grids[water_data->idx].alpha_1_fix = cab->grid_alpha_1_fix; } l07_water_grids[water_data->idx].z = water_moby->pos[2]; on = 0.0f; From 0ff1c708e4dec3eb32d3ee49bfa1e5ce10222536 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:09:31 +0000 Subject: [PATCH 386/758] decomp: clarify names in apply_hero_selected_flags_and_state_transitions b12E4 -> height_difference_selected: b12E4 -> height_difference_selected. In the authoritative C, the 16-byte selector/flag block is cleared and this byte is asserted in exactly the selector-14 and selector-0 branches that assign selected_height_difference. Retail 0x0020ba38-0x0020ba4c sets +0x12E4 to 1, stores 0.2f at +0x22A4 and sets +0x2F0 to +0x2D8+0.2f; 0x0020ba68-0x0020ba80 computes and stores +0x2F0 minus +0x2D8, then 0x0020baa8-0x0020baac asserts the same byte. Original Ghidra corroborates uRam00140634=1 alongside fRam001415f4 assignments. This names the selected height-difference marker, without asserting a surface identity or consumer behavior. --- 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 504d81e894..66311d819a 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -3404,7 +3404,7 @@ typedef struct { s16 h12E0; u8 b12E2; u8 idle_exit_transition_selected; - u8 b12E4; + u8 height_difference_selected; u8 death_descent_transition_selected; u8 jump_or_respawn_wait_transition_selected; u8 b12E7; @@ -3451,7 +3451,7 @@ void apply_hero_selected_flags_and_state_transitions(void) { } } if (saved_flag_selector == 14) { - P.b12E4 = 1; + P.height_difference_selected = 1; P.selected_height_difference = 0.2f; P.f2F0 = P.f2D8 + 0.2f; } @@ -3460,7 +3460,7 @@ void apply_hero_selected_flags_and_state_transitions(void) { P.selected_height_difference = height_difference; if (height_difference < 0.85f && 0.25f < height_difference) P.b20A9 = 1; - P.b12E4 = 1; + P.height_difference_selected = 1; } if (saved_flag_selector == 3) P.jump_or_respawn_wait_transition_selected = 1; From 87072a9a1627529dc4bdd3c233fee0fa9623350f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:12:46 +0000 Subject: [PATCH 387/758] decomp: clarify names in bomb_glove_update unkA2 -> max_delivery_frame_bucket: In BOMB_GLOVE_RELEASE_HELD_MOBY, after launch_bomb at retail 0x002c3024 and delivery-counter accounting, 0x002c3058 calls the established scale_game_frames, 0x002c305c-0x002c3070 divides its signed frame count by 600. Retail 0x002c306c loads unsigned item_usage+0x52 (0x001416d2), 0x002c3074-0x002c3078 updates only when the saved field is less than that quotient, and 0x002c3080-0x002c309c recomputes and stores the quotient as u16. The authoritative C identifies precisely this field as DeliveryStats_2c26c8.unkA2, comparing against scale_game_frames(D_0015EEA4)/600 and assigning the greater observed quotient. Thus it records the maximum delivery frame bucket; no real-time unit or reset lifetime is claimed. --- src/overlays/shared/weapons/bomb_glove.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/bomb_glove.c b/src/overlays/shared/weapons/bomb_glove.c index 30045edcfd..449509769c 100644 --- a/src/overlays/shared/weapons/bomb_glove.c +++ b/src/overlays/shared/weapons/bomb_glove.c @@ -38,7 +38,7 @@ typedef struct { typedef struct { u8 pad0[0x50]; u16 deliveries; /* D_001416D0: saturates at 0xFFFF */ - u16 unkA2; + u16 max_delivery_frame_bucket; u32 levels; } DeliveryStats_2c26c8; @@ -359,8 +359,8 @@ void bomb_glove_update(struct Moby *moby) { { s32 frames = scale_game_frames(D_0015EEA4); frames /= 600; - if (((DeliveryStats_2c26c8 *)item_usage)->unkA2 < frames) - ((DeliveryStats_2c26c8 *)item_usage)->unkA2 = + if (((DeliveryStats_2c26c8 *)item_usage)->max_delivery_frame_bucket < frames) + ((DeliveryStats_2c26c8 *)item_usage)->max_delivery_frame_bucket = scale_game_frames(D_0015EEA4) / 600; } ((DeliveryStats_2c26c8 *)item_usage)->levels = From 09f916ea33f5e6da9b5233a02626e3b235e43187 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:12:49 +0000 Subject: [PATCH 388/758] decomp: clarify names in elevator_update f20A4 -> vehicle_mode: Retail 0x002fc958-0x002fc9d8 tests hero+0x20A4 == 1 before restore_hero_from_vehicle_mode. The opposite branch calls enter_hero_vehicle_mode_and_set_moby(1,0x43,moby) at 0x002fcb3c-0x002fcb58. Bounded helper evidence b1bed2c494bc48ecba284d496e9af626 proves a0 is saved in s1 and stored to hero+0x20A4 at 0x00227c60, while a2 replaces hero's moby at 0x00227c5c. Thus this byte stores the vehicle mode argument, not merely an inferred offset flag. f68 -> base_height_linked_moby_index: Retail 0x002fce24-0x002fce38 loads data+0x68, shifts it by 8 and adds the moby array before set_moby_and_links_to_states_8_and_9 when departing the base height for state 6. On state-5 arrival at base height, 0x002fcee0-0x002fcee4 and 0x002fcf10-0x002fcf28 use that same index for set_moby_and_links_to_states_4_and_5. Authoritative C agrees, proving this is the linked moby index associated with base-height arrival/departure. f78 -> height_cuboid_index: Retail 0x002fc728-0x002fc754 loads data+0x78, multiplies by LevelCuboid stride 0x80, adds l06_cuboids_macro and initializes elevator z from cuboid pos.z plus axes[2].z. At 0x002fce4c-0x002fce74 the same cuboid determines both movement target heights; the C uses l06_cuboids_macro[moby_data->f78] in those expressions. This establishes the height-defining cuboid index. f7C -> vehicle_exit_placement_cuboid_index: After restore_hero_from_vehicle_mode at retail 0x002fc9d4, 0x002fc9dc-0x002fca00 loads data+0x7C, shifts by 7, adds the cuboid array and passes cuboid position and rotation to set_race_camera. Supplied set_race_camera context proves these vectors set hero world position and rotation. The same placement is reused at 0x002fcc60-0x002fcc8c when clearing data+0x84; vehicle-exit placement describes its proven use without claiming exclusivity. f80 -> vehicle_entry_placement_cuboid_index: Retail 0x002fcb24-0x002fcb38 loads data+0x80 as an index scaled by cuboid stride 0x80 and passes cuboid position/rotation to set_race_camera, immediately before enter_hero_vehicle_mode_and_set_moby(1,0x43,...) at 0x002fcb3c-0x002fcb58. Supplied helper context proves the vectors place and rotate the hero. 0x002fcbd0-0x002fcbfc also reuses this placement in a non-entry branch; the name records the established vehicle-entry use. f8C -> height_velocity: Retail 0x002fce88-0x002fceac passes moby+0x18 (position z) as a0 and data+0x8C as a1 to advance_accelerated_scalar, with cuboid target height in f12, repeated acceleration steps in f13/f14 and frame-scaled maximum speed in f15. The authoritative C explicitly passes &moby->pos.z and &moby_data->f8C to that established scalar motion helper, proving this float is the persistent height velocity. f9C -> color_pulse_phase: Retail 0x002fcfac-0x002fcfd4 loads data+0x9C, advances it with fast_add_rotations by frame_time * 5.2359877, stores it back and passes it to fast_sin. 0x002fcfd8-0x002fd034 scales and clamps the sine-derived blend, tweens the two established elevator pulse colors and stores moby color. States 5-8 reset data+0x9C at 0x002fcfa8, proving it is color-pulse angular phase. --- src/overlays/l06/mobys/elevator.c | 60 +++++++++++++++---------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/overlays/l06/mobys/elevator.c b/src/overlays/l06/mobys/elevator.c index 76bff40d84..80281d81d6 100644 --- a/src/overlays/l06/mobys/elevator.c +++ b/src/overlays/l06/mobys/elevator.c @@ -55,20 +55,20 @@ typedef struct { char f20[0x40]; int f60; int f64; - int f68; + int base_height_linked_moby_index; int f6C; int f70; int f74; - int f78; - int f7C; - int f80; + int height_cuboid_index; + int vehicle_exit_placement_cuboid_index; + int vehicle_entry_placement_cuboid_index; int f84; int f88; - float f8C; + float height_velocity; int f90; int f94; int f98; - float f9C; + float color_pulse_phase; } Data_2FDA70; typedef struct Moby_2FDA70 { @@ -106,7 +106,7 @@ typedef struct { Moby_2FDA70 *moby; int f2084; char pad2088[0x1C]; - unsigned char f20A4; + unsigned char vehicle_mode; char pad20A5[0x226]; unsigned char f22CB; } Hero_2FDA70; @@ -211,16 +211,16 @@ void elevator_update(Moby_2FDA70 *moby) { moby->state = WAIT_FOR_HERO_TRIGGER_AT_NODE_OFFSET_HEIGHT; } moby->pos.z = - l06_cuboids_macro[moby_data->f78].pos.z + l06_cuboids_macro[moby_data->f78].axes[2].z; - if (((Hero_2FDA70 *)(D_0013F350))->f20A4 == 0) { + l06_cuboids_macro[moby_data->height_cuboid_index].pos.z + l06_cuboids_macro[moby_data->height_cuboid_index].axes[2].z; + if (((Hero_2FDA70 *)(D_0013F350))->vehicle_mode == 0) { ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f34 |= 1; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f34 |= 2; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f94 = 0; - } else if (((Hero_2FDA70 *)(D_0013F350))->f20A4 == 1) { + } else if (((Hero_2FDA70 *)(D_0013F350))->vehicle_mode == 1) { set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); } set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); - set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->f68 << 8)); + set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); break; case WAIT_FOR_INITIAL_HERO_ACTIVATION: if (is_point_inside_clip_volume(&((Hero_2FDA70 *)(D_0013F350))->pos, moby_data->f70) != 0) { @@ -244,7 +244,7 @@ void elevator_update(Moby_2FDA70 *moby) { if (fast_dec_timer(&moby_data->f90) != 0 && is_point_inside_clip_volume(&((Hero_2FDA70 *)(D_0013F350))->pos, moby_data->f70) != 0) { int ok; - if (((Hero_2FDA70 *)(D_0013F350))->f20A4 == 1) { + if (((Hero_2FDA70 *)(D_0013F350))->vehicle_mode == 1) { ok = try_set_help_message(9, 0x1781) != 0; } else if (D_0013D5CA_2FDA70[0] == 0) { ok = try_set_help_message(9, 0x177E) != 0; @@ -257,19 +257,19 @@ void elevator_update(Moby_2FDA70 *moby) { ok) { ((Hero_2FDA70 *)(D_0013F350))->f1F2 = scale_game_frames(0x3C); moby_data->f90 = scale_game_frames(0x78); - if (((Hero_2FDA70 *)(D_0013F350))->f20A4 == 1) { + if (((Hero_2FDA70 *)(D_0013F350))->vehicle_mode == 1) { fade_to_black(scale_game_frames(0x10)); set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + - (moby_data->f68 << 8)); + (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); moby_data->f84 = 0; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f94 = 0; restore_hero_from_vehicle_mode(); { - LevelCuboid *b = &l06_cuboids_macro[moby_data->f7C]; + LevelCuboid *b = &l06_cuboids_macro[moby_data->vehicle_exit_placement_cuboid_index]; set_race_camera(&b->pos, &b->rot, 0, 1); } request_music_track(0, 10); @@ -286,7 +286,7 @@ void elevator_update(Moby_2FDA70 *moby) { set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + - (moby_data->f68 << 8)); + (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); moby_data->f84 = 1; @@ -294,7 +294,7 @@ void elevator_update(Moby_2FDA70 *moby) { ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].cls->f10; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f34 &= 0xFFFE; { - LevelCuboid *b = &l06_cuboids_macro[moby_data->f80]; + LevelCuboid *b = &l06_cuboids_macro[moby_data->vehicle_entry_placement_cuboid_index]; set_race_camera(&b->pos, &b->rot, 0, 1); } enter_hero_vehicle_mode_and_set_moby( @@ -305,13 +305,13 @@ void elevator_update(Moby_2FDA70 *moby) { set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + - (moby_data->f68 << 8)); + (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); moby_data->f84 = 1; moby_data->f94 = 1; { - LevelCuboid *b = &l06_cuboids_macro[moby_data->f80]; + LevelCuboid *b = &l06_cuboids_macro[moby_data->vehicle_entry_placement_cuboid_index]; set_race_camera(&b->pos, &b->rot, 0, 1); } } else { @@ -319,13 +319,13 @@ void elevator_update(Moby_2FDA70 *moby) { set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + - (moby_data->f68 << 8)); + (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); moby_data->f84 = 0; moby_data->f94 = 0; { - LevelCuboid *b = &l06_cuboids_macro[moby_data->f7C]; + LevelCuboid *b = &l06_cuboids_macro[moby_data->vehicle_exit_placement_cuboid_index]; set_race_camera(&b->pos, &b->rot, 0, 1); } } @@ -342,7 +342,7 @@ void elevator_update(Moby_2FDA70 *moby) { moby_data->f90 = scale_game_frames(0x78); } else { moby->state = MOVE_TO_NODE_OFFSET_HEIGHT; - set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->f68 << 8)); + set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); moby_data->f90 = scale_game_frames(0x78); } } else if (vector_distance_xy(&moby->pos, &((Hero_2FDA70 *)(D_0013F350))->pos) < 24.0f && @@ -358,7 +358,7 @@ void elevator_update(Moby_2FDA70 *moby) { moby->state == WAIT_FOR_HERO_TRIGGER_AT_NODE_BASE_HEIGHT && moby->pos.z < ((Hero_2FDA70 *)(D_0013F350))->pos.z - 5.0f) { moby->state = MOVE_TO_NODE_OFFSET_HEIGHT; - set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->f68 << 8)); + set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); moby_data->f90 = scale_game_frames(0x78); } break; @@ -366,13 +366,13 @@ void elevator_update(Moby_2FDA70 *moby) { case MOVE_TO_NODE_OFFSET_HEIGHT: { float target; float height_acceleration_step; - target = l06_cuboids_macro[moby_data->f78].pos.z; + target = l06_cuboids_macro[moby_data->height_cuboid_index].pos.z; if (moby->state == MOVE_TO_NODE_OFFSET_HEIGHT) { - target += l06_cuboids_macro[moby_data->f78].axes[2].z; + target += l06_cuboids_macro[moby_data->height_cuboid_index].axes[2].z; } height_acceleration_step = height_cycle_acceleration_gp * frame_time_sq_macro; advance_accelerated_scalar(&moby->pos.z, - &moby_data->f8C, + &moby_data->height_velocity, target, height_acceleration_step, height_acceleration_step, @@ -382,7 +382,7 @@ void elevator_update(Moby_2FDA70 *moby) { moby->state = WAIT_FOR_HERO_CLEARANCE_AT_NODE_OFFSET_HEIGHT; set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); } else { - set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f68 << 8)); + set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); moby->state = WAIT_FOR_HERO_CLEARANCE_AT_NODE_BASE_HEIGHT; } } @@ -406,12 +406,12 @@ void elevator_update(Moby_2FDA70 *moby) { } if (moby->state >= MOVE_TO_NODE_BASE_HEIGHT && moby->state <= WAIT_FOR_HERO_CLEARANCE_AT_NODE_BASE_HEIGHT) { - moby_data->f9C = 0.0f; + moby_data->color_pulse_phase = 0.0f; moby->f90 = l06_elevator_move_and_clearance_color; } else { float color_blend; - moby_data->f9C = fast_add_rotations(moby_data->f9C, D_0015ED6C * 5.2359877f); - color_blend = fast_sin(moby_data->f9C) * 4.0f - 3.0f; + moby_data->color_pulse_phase = fast_add_rotations(moby_data->color_pulse_phase, D_0015ED6C * 5.2359877f); + color_blend = fast_sin(moby_data->color_pulse_phase) * 4.0f - 3.0f; if (color_blend > 1.0f) { color_blend = 1.0f; } else if (color_blend < 0.0f) { From b4450e69a2a35a4bc0a1bf0e5bb66dcda57ebdb1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:14:46 +0000 Subject: [PATCH 389/758] decomp: clarify names in bomber_jet_update f8 -> clip_volume_index: GunshipGuardVars.f8 is s32 and is used as the second argument to is_point_inside_clip_volume for hero.motion.pos and camera_pos. Retail 0x002f80d4-0x002f80e0 checks class 0x2BC and loads its vars into s1; 0x002f8110 loads a1 from 0x8(s1), and 0x002f8114 calls the containment helper with hero position 0x0013f3d0. 0x002f8124 reloads that same field into a1 and 0x002f8128 calls the same helper with camera position 0x00167240. Both tests must succeed before the guard index is copied at 0x002f8138-0x002f8140. Original Ghidra expresses the same field as piVar16[2]. This establishes a clip-volume index, without inferring its broader lifecycle. --- src/overlays/l01/mobys/bomber_jet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l01/mobys/bomber_jet.c b/src/overlays/l01/mobys/bomber_jet.c index bbde8b4c74..02ecbfa2fb 100644 --- a/src/overlays/l01/mobys/bomber_jet.c +++ b/src/overlays/l01/mobys/bomber_jet.c @@ -199,7 +199,7 @@ typedef struct { s32 f0; s16 f4; s16 pad6; - s32 f8; + s32 clip_volume_index; } GunshipGuardVars; typedef struct { @@ -526,8 +526,8 @@ void bomber_jet_update(GunshipMoby *bomber_jet_moby) { if (guard_vars->f4 == 0 && guard_vars->f0 == 0 && random_integer_below(0x64) < 0x64 && is_point_inside_clip_volume(&hero.motion.pos, - guard_vars->f8) && - is_point_inside_clip_volume(camera_pos, guard_vars->f8)) { + guard_vars->clip_volume_index) && + is_point_inside_clip_volume(camera_pos, guard_vars->clip_volume_index)) { beam_guard_moby_indices[k] = gunship_vars->guards[i]; k++; } From 34ef9bedd5763112f396ac51debdd708264834f6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:14:50 +0000 Subject: [PATCH 390/758] decomp: clarify names in drain_cover_update f2080 -> nearby_effect_owner: Retail 0x0030f124 loads hero+0x2080 as a0 for spawn_nearby_effect at 0x0030f134. Checked helper request 3044c8b875644d98b65942f1450e94f4 preserves a0 in s2 at 0x00283e90, uses its +0xa4 byte to locate a cached effect record (0x00283ea4-0x00283ec0), checks record+0x34 against this identity (0x00283ec4-0x00283ec8), stores that identity into record+0x34 (0x00283f00), and writes the effect slot back to owner+0xa4 (0x00283f5c). These accesses prove ownership of the nearby effect, without claiming a specific shared entity type. f80 -> rise_height: DrainCoverData float f80 is clamped above f84+1 at retail 0x0030e9bc-0x0030e9f8. At 0x0030ea74-0x0030ea94 it supplies sqrt(2 * height * gravity * frame_time_sq) for initial upward vel[2]; rise integration and gravity subtraction at 0x0030ed90-0x0030edcc prove this is the rise-height parameter. f84 -> hover_height_above_home: Retail 0x0030edd8-0x0030ede8 forms f84 minus 0.5 as home[3]. At 0x0030ee34-0x0030ee5c the target is saved home Z plus home[3]; 0x0030ee7c-0x0030eeb4 alternates home[3] between f84 minus and plus 0.5. Thus this float is the hover center height relative to home, also bounding minimum rise height at initialization. f88 -> hover_duration: At the rise-to-hover transition, retail 0x0030edd0-0x0030edf8 reads float data+0x88, passes it through scale_time (0x0022dbc8) and truncate_float_to_s32 (0x0022ef38), and stores the result in data->timer at +0x8c. During HOVER 0x0030eeb8-0x0030eee0 decrements that timer and enters FALL_TO_HOME on expiration, proving hover duration. f98 -> tilt_x_phase: Retail 0x0030e954-0x0030e96c initializes data+0x98 with random_angle_radians, repeated at landing 0x0030efe0-0x0030effc. Checked tilt helper request 432e8bc3d1d04a079dcb933850fa7371 shows 0x0030f498-0x0030f4c4 advancing it by data+0xa0 with fast_add_rotations and taking sine. The resulting target is retained in f21 and applied to moby rot.x (+0x40) at 0x0030f50c-0x0030f548, agreeing with supplied source update_drain_cover_tilt. f9C -> tilt_y_phase: Retail 0x0030e970-0x0030e990 initializes data+0x9c with random_angle_radians, repeated at 0x0030eff8-0x0030f018. Checked tilt helper request 432e8bc3d1d04a079dcb933850fa7371 shows 0x0030f4b0-0x0030f4c8 advancing it by data+0xa4 and storing it back, then sine at 0x0030f4e0-0x0030f4e4. Its target enters f22 and drives moby rot.y (+0x44) at 0x0030f550-0x0030f594, agreeing with supplied tilt source. --- src/overlays/l05/mobys/drain_cover.c | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/overlays/l05/mobys/drain_cover.c b/src/overlays/l05/mobys/drain_cover.c index 1fedc2de87..1aa67638c1 100644 --- a/src/overlays/l05/mobys/drain_cover.c +++ b/src/overlays/l05/mobys/drain_cover.c @@ -151,13 +151,13 @@ typedef struct { char f20[0x40]; float vel[4]; float home[4]; - float f80; - float f84; - float f88; + float rise_height; + float hover_height_above_home; + float hover_duration; int timer; char pad90[8]; - float f98; - float f9C; + float tilt_x_phase; + float tilt_y_phase; float fA0; float fA4; int sound; @@ -178,7 +178,7 @@ typedef struct { char pad00[0x80]; float pos[4]; char pad90[0x1FF0]; - int f2080; + int nearby_effect_owner; } DrainCoverHero; void drain_cover_update(DrainCoverMoby *moby) __asm__("FUN_L05_0030e7f8"); @@ -232,13 +232,13 @@ void drain_cover_update(DrainCoverMoby *moby) { drain_cover_data->timer = scale_game_frames(0x78); drain_cover_data->sound = 0xFF; qcopy(drain_cover_data->home, moby->pos); - drain_cover_data->f98 = random_angle_radians(); - drain_cover_data->f9C = random_angle_radians(); + drain_cover_data->tilt_x_phase = random_angle_radians(); + drain_cover_data->tilt_y_phase = random_angle_radians(); drain_cover_data->fA0 = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; drain_cover_data->fA4 = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; - minimum_rise_height = drain_cover_data->f84 + 1.0f; - if (drain_cover_data->f80 <= minimum_rise_height) { - drain_cover_data->f80 = minimum_rise_height; + minimum_rise_height = drain_cover_data->hover_height_above_home + 1.0f; + if (drain_cover_data->rise_height <= minimum_rise_height) { + drain_cover_data->rise_height = minimum_rise_height; } break; case DRAIN_COVER_WAIT_TO_RISE: @@ -247,7 +247,7 @@ void drain_cover_update(DrainCoverMoby *moby) { fast_dec_timer(&drain_cover_data->timer) != 0) { moby->state = DRAIN_COVER_RISE; clear_u64_value(drain_cover_data->vel); - drain_cover_data->vel[2] = square_root(drain_cover_data->f80 * 2.0f * + drain_cover_data->vel[2] = square_root(drain_cover_data->rise_height * 2.0f * (l05_drain_cover_gravity * frame_time_sq)); } else if ((float)drain_cover_data->timer < (float)scale_game_frames(*(int *)&D_L05_00161DB8) * 0.5f) { @@ -315,8 +315,8 @@ void drain_cover_update(DrainCoverMoby *moby) { drain_cover_data->vel[2] - l05_drain_cover_gravity * frame_time_sq; if (drain_cover_data->vel[2] <= 0.0f) { moby->state = DRAIN_COVER_HOVER; - drain_cover_data->home[3] = drain_cover_data->f84 - 0.5f; - drain_cover_data->timer = truncate_float_to_s32(scale_time(drain_cover_data->f88)); + drain_cover_data->home[3] = drain_cover_data->hover_height_above_home - 0.5f; + drain_cover_data->timer = truncate_float_to_s32(scale_time(drain_cover_data->hover_duration)); } break; case DRAIN_COVER_HOVER: @@ -329,10 +329,10 @@ void drain_cover_update(DrainCoverMoby *moby) { &moby->pos[2], &drain_cover_data->vel[2]); if (drain_cover_data->vel[2] == 0.0f) { - if (drain_cover_data->home[3] > drain_cover_data->f84) { - drain_cover_data->home[3] = drain_cover_data->f84 - 0.5f; + if (drain_cover_data->home[3] > drain_cover_data->hover_height_above_home) { + drain_cover_data->home[3] = drain_cover_data->hover_height_above_home - 0.5f; } else { - drain_cover_data->home[3] = drain_cover_data->f84 + 0.5f; + drain_cover_data->home[3] = drain_cover_data->hover_height_above_home + 0.5f; } } if (fast_dec_timer(&drain_cover_data->timer) != 0) { @@ -357,8 +357,8 @@ void drain_cover_update(DrainCoverMoby *moby) { moby->state = DRAIN_COVER_WAIT_TO_RISE; drain_cover_data->timer = scale_game_frames(0x78); qcopy(moby->pos, drain_cover_data->home); - drain_cover_data->f98 = random_angle_radians(); - drain_cover_data->f9C = random_angle_radians(); + drain_cover_data->tilt_x_phase = random_angle_radians(); + drain_cover_data->tilt_y_phase = random_angle_radians(); drain_cover_data->fA0 = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; drain_cover_data->fA4 = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; } @@ -374,7 +374,7 @@ void drain_cover_update(DrainCoverMoby *moby) { effect_velocity[2] = 0.0f; qcopy(effect_position, hero->pos); effect_position[2] += 0.75f; - spawn_nearby_effect((void *)hero->f2080, + spawn_nearby_effect((void *)hero->nearby_effect_owner, (int)moby, 1, effect_position, From d9eb69822c7cbc3b0b42979194fd67c0c2a60e25 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:14:50 +0000 Subject: [PATCH 391/758] decomp: clarify names in veldin_robot_enemy_update domain_0_value_2 -> VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE: Retail 0x002e0df0 loads vars+0x114, then 0x002e0df4-0x002e0df8 compares it to 2 and skips the FOLLOW_PATH transition when equal. Bound C identifies this exact field as target_selection_status. The direct helper update_veldin_robot_damage_and_targeting, called at 0x002e0bb8, assigns VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE = 2 to this same member when targetPos exceeds range (checked retail write 0x002e19cc recorded in supplied annotation). Thus this is the existing target-selection status domain, not moby state or any Hero selector. domain_1_value_2 -> VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE: Retail 0x002e10c0 loads vars+0x114; 0x002e10c4-0x002e10c8 compares against 2 and skips beam-slot registration at 0x002e10d4 on equality. This is the same target_selection_status member set to VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE = 2 by the supplied direct damage/targeting helper when the selected position is beyond range (retail 0x002e19cc per supplied checked annotation). Reuse that established status member; the equal-valued FOLLOW_PATH and Hero constants belong to different fields/domains. --- src/overlays/l00/mobys/veldin_robot_enemy.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/l00/mobys/veldin_robot_enemy.c b/src/overlays/l00/mobys/veldin_robot_enemy.c index 51ea4f19d6..c95ab35ebe 100644 --- a/src/overlays/l00/mobys/veldin_robot_enemy.c +++ b/src/overlays/l00/mobys/veldin_robot_enemy.c @@ -182,6 +182,9 @@ void veldin_robot_enemy_update(ElectroidMoby *moby) __asm__("FUN_L00_002e0 /* Moby class 1440 */ void veldin_robot_enemy_update(ElectroidMoby *moby) { + enum { + VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE = 2 + }; ElectroidVars *vars; ElectroidMoby *target; Path *path; @@ -239,7 +242,7 @@ void veldin_robot_enemy_update(ElectroidMoby *moby) { ELECTROID_ANIM(moby, 1, scale_game_frames_s32(20)); } } - if (vars->target_selection_status != 2) { + if (vars->target_selection_status != VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE) { moby->state = VELDIN_ROBOT_STATE_FOLLOW_PATH; ELECTROID_ANIM(moby, 9, scale_game_frames_s32(10)); } @@ -280,7 +283,7 @@ void veldin_robot_enemy_update(ElectroidMoby *moby) { } else if (moby->unk70 & 2) { ELECTROID_ANIM(moby, random_integer_below(2) + 1, scale_game_frames_s32(20)); } - if (vars->target_selection_status != 2 && register_beam_slot(moby, 0, 0) != 0) { + if (vars->target_selection_status != VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE && register_beam_slot(moby, 0, 0) != 0) { moby->state = VELDIN_ROBOT_STATE_WAIT_TO_START_COLLISION_PROBES; ELECTROID_ANIM(moby, 5, scale_game_frames_s32(10)); } From 45bd2657fc8e59e86d073112a0d9bd427aab267d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:14:54 +0000 Subject: [PATCH 392/758] decomp: clarify names in giant_clank_charged_blast_update f98 -> blast_heading_angle: Hero29FF90.f98 is the float loaded from hero+0x98 at retail 0x0029f270 and 0x0029f28c. Calls at 0x0029f26c and 0x0029f288 correspond to established fast_cos and fast_sin in authoritative C. Their results are multiplied by the identical D_0015ED6C*40.0f magnitude and stored into moby_data->vel[0] at 0x0029f284 and vel[1] at 0x0029f2a8; vel[2] is zeroed at 0x0029f29c before entering EXPANDING_BLAST at 0x0029f2ac. Original Ghidra shows the same hero scalar uRam0013f3e8 feeding both trigonometric calls and the two velocity stores. This proves the angle determines the blast heading in the XY plane. --- src/overlays/shared/vehicles/giant_clank_charged_blast.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/vehicles/giant_clank_charged_blast.c b/src/overlays/shared/vehicles/giant_clank_charged_blast.c index c2b41fc355..0091488b2d 100644 --- a/src/overlays/shared/vehicles/giant_clank_charged_blast.c +++ b/src/overlays/shared/vehicles/giant_clank_charged_blast.c @@ -168,7 +168,7 @@ typedef struct { typedef struct { char pad0[0x98]; - float f98; + float blast_heading_angle; char pad9C[0x2008]; unsigned char f20A4; } Hero29FF90; @@ -361,8 +361,8 @@ void giant_clank_charged_blast_update(Moby29FF90 *moby) { D_L15_0015F320.on = 0; D_L15_0015F330.on = 0; moby_data->f10 = 0; - moby_data->vel[0] = fast_cos(((Hero29FF90 *)&hero)->f98) * (D_0015ED6C * 40.0f); - moby_data->vel[1] = fast_sin(((Hero29FF90 *)&hero)->f98) * (D_0015ED6C * 40.0f); + moby_data->vel[0] = fast_cos(((Hero29FF90 *)&hero)->blast_heading_angle) * (D_0015ED6C * 40.0f); + moby_data->vel[1] = fast_sin(((Hero29FF90 *)&hero)->blast_heading_angle) * (D_0015ED6C * 40.0f); moby_data->vel[2] = 0.0f; moby->state = EXPANDING_BLAST; moby_data->f14 = 0; From 3b17e10193702382e309ce506d12aafedebcd6c6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:21:42 +0000 Subject: [PATCH 393/758] decomp: clarify names in test_dummy_update b2E -> respawn_request_state: Assigned 002cde48-002cde54 stores 1 at pvars+0x2E. Checked helper request 5e7fe6feaa724ee8be490c00558f0773 reads the same pvars through moby+0x78 at 002cea20, compares byte +0x2E to 2 at 002cea24-002cea28, resets it to 1 at 002cea3c, resets health/timer, decrements lives at 002cea6c-002cea78 and selects respawn state 11 plus spawn position restoration at 002cea7c-002cea90, or removal when exhausted. Supplied L16HitData substate source agrees: value 2 requests the respawn/removal path. This is a request state, separate from moby current state. f10C -> hit_reaction_heading: In assigned state 9, 002ce748-002ce768 copies indexed path position and loads pvars+0x10C into f12 for move_test_dummy_toward_position_and_heading before restoring saved state/animation. Checked helper request 5e7fe6feaa724ee8be490c00558f0773 shows the surviving-hit branch saves state/animation at 002ceb70-002ceb78, subtracts moby XY from hero XY at 002ceb80-002ceb9c, calls established fast_arc_tan at 002ceb98 and stores that heading at +0x10C at 002ceba0 before selecting reaction state 9 at 002ceba8. Supplied source hit_data->heading matches this data flow. f11C -> glow_pulse_phase: Assigned original Ghidra case 0 and retail 002cdeb8/002cdecc store random_angle_radians output into pvars+0x11C. Authoritative same-file update_test_dummy_group_glow_phases reads and advances this exact member through fast_add_rotations using test_dummy_glow_phase_rate_degrees * DEG_TO_RAD * D_0015ED6C. draw_test_dummy_group_glows reads the same per-group-moby pvars+0x11C, computes (fast_sin(phase)+1)*0.5 and uses it to interpolate test_dummy_glow_pulse_color_start_gp/end_gp into all four glow quad colors. Initialization plus increment and sine/color consumption prove glow pulse phase rather than body heading. --- src/overlays/l16/mobys/test_dummy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l16/mobys/test_dummy.c b/src/overlays/l16/mobys/test_dummy.c index 55fead4bc3..5471837977 100644 --- a/src/overlays/l16/mobys/test_dummy.c +++ b/src/overlays/l16/mobys/test_dummy.c @@ -66,7 +66,7 @@ typedef struct { char pad26[2]; unsigned char b28; char pad29[5]; - unsigned char b2E; + unsigned char respawn_request_state; char pad2F[0x41]; float target[4]; char pad80[0x34]; @@ -87,12 +87,12 @@ typedef struct { char pad100[4]; char *child; int step; - float f10C; + float hit_reaction_heading; unsigned char next_state; char pad111[3]; int next_anim; char pad118[4]; - float f11C; + float glow_pulse_phase; char slots[0x20]; char block140[1]; } L16DummyData; @@ -163,7 +163,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->b2E = 1; + dummy_data->respawn_request_state = 1; if (dummy_data->lives > 0) { MOBY(moby)->unkB4 /= dummy_data->lives; } @@ -176,7 +176,7 @@ void test_dummy_update(unsigned char *moby) { dummy_data->b28 = 1; dummy_data->h24 = 2; dummy_data->f20 = 2.0f; - dummy_data->f11C = random_angle_radians(); + dummy_data->glow_pulse_phase = random_angle_radians(); dummy_data->route = find_nearest_test_dummy_door(dummy_data->iCC, moby + 0x10); qcopy(dummy_data->spawn, moby + 0x10); switch (dummy_data->kind) { @@ -400,7 +400,7 @@ void test_dummy_update(unsigned char *moby) { break; case TEST_DUMMY_STATE_TURN_AND_RESUME_SAVED_STATE: /* turn back to the node, then resume the saved state and animation */ position_or_delta.quad = *(u128 *)(path + dummy_data->node * 16 + 16); - move_test_dummy_toward_position_and_heading(moby, position_or_delta.f, dummy_data->f10C); + move_test_dummy_toward_position_and_heading(moby, position_or_delta.f, dummy_data->hit_reaction_heading); if (moby[0x70] & 2) { moby[0x20] = dummy_data->next_state; if (moby[0x53] != dummy_data->next_anim) { From 6f42d8a72bdc571473f42a4439bcea87c204dfcf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:21:45 +0000 Subject: [PATCH 394/758] decomp: clarify names in update_fighter_jet_flight i10C -> boost_voice_slot_index: Retail 0x002ec428-0x002ec480 loads vars+0x10C, checks the indexed 0x70-stride voice_pool slot's ship owner (+0x88) and active byte (+0x74), releases it, then stores allocate_voice_for_target_entry(1,4,ship_moby)'s return. 0x002ec494-0x002ec4D4 releases/clears it on raw_released bit 0x40. The same bit held at 0x002ec4DC-0x002ec518 selects boost acceleration and its speed limit in the supplied C, proving this is the boost voice slot index. i110 -> flight_target_record_index: Retail 0x002ec748-0x002ec798 tests vars+0x110 against -1, shifts it left seven and indexes D_L17_001600EC to copy record+0x30 as target and measure record+0x20. 0x002ec79C-0x002ec7CC reuses the index to sum record vectors for a second length. Target XY/Z differences then feed heading and pitch interpolation at 0x002ec80C-0x002ec938; supplied C explicitly uses i110 in those target-record accesses, proving a flight target record index. s62 -> death_respawn_countdown: Retail 0x002ecF24 zeroes ship HP on the fatal no-moby/class-0x15B collision path; after the explosion, 0x002ecF44-0x002ecF50 loads l17_fighter_jet_collision_death_respawn_delay and stores the short at vars+0x62 immediately before death state 7. Supplied C maps this storage to FighterJetVars.s62 and, in fighter_jet_update through ShipVars.hit_timer, decrements it with fast_dec_timer_s16 in FIGHTER_JET_STATE_DEATH_RESPAWN_DELAY before hero_respawn and ship reset, proving a death respawn countdown. --- 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 c2ceb86cb6..059436f23c 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -1077,7 +1077,7 @@ typedef struct { char pad40[0x20]; unsigned char sel; unsigned char flip; - short s62; + short death_respawn_countdown; float speed; short count; short s6A; @@ -1091,8 +1091,8 @@ typedef struct { float fD0, fD4, fD8; int iDC; char padE0[0x2C]; - int i10C; - int i110; + int boost_voice_slot_index; + int flight_target_record_index; } FighterJetVars; typedef unsigned int Q_c4 __attribute__((mode(TI), aligned(16))); @@ -1243,7 +1243,7 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v if (l17_fighter_jet_startup_speed_ramp_count_limit < ship_vars->count) { pad = &controller_state; if (pad->raw_pressed & 0x40) { - voice_slot_index = ship_vars->i10C; + voice_slot_index = ship_vars->boost_voice_slot_index; if (voice_slot_index != -1) { e = (char *)&voice_pool + voice_slot_index * 0x70; if (*(char **)(e + 0x88) == (char *)ship_moby && @@ -1251,10 +1251,10 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v release_voice_slot(voice_slot_index); } } - ship_vars->i10C = -1; - ship_vars->i10C = allocate_voice_for_target_entry(1, 4, (int)ship_moby); + ship_vars->boost_voice_slot_index = -1; + ship_vars->boost_voice_slot_index = allocate_voice_for_target_entry(1, 4, (int)ship_moby); } else if (pad->raw_released & 0x40) { - voice_slot_index = ship_vars->i10C; + voice_slot_index = ship_vars->boost_voice_slot_index; if (voice_slot_index != -1) { e = (char *)&voice_pool + voice_slot_index * 0x70; if (*(char **)(e + 0x88) == (char *)ship_moby && @@ -1262,7 +1262,7 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v release_voice_slot(voice_slot_index); } } - ship_vars->i10C = -1; + ship_vars->boost_voice_slot_index = -1; } pad = &controller_state; if (pad->raw_held & 0x40) { @@ -1346,14 +1346,14 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v lenA = 310.0f; lenB = 500.0f; - if (ship_vars->i110 != -1) { - int target_record_byte_offset = ship_vars->i110 << 7; + if (ship_vars->flight_target_record_index != -1) { + int target_record_byte_offset = ship_vars->flight_target_record_index << 7; char *target_record_array = D_L17_001600EC; - qcopy(target, ((char(*)[128])target_record_array)[ship_vars->i110] + 0x30); + qcopy(target, ((char(*)[128])target_record_array)[ship_vars->flight_target_record_index] + 0x30); lenA = fast_vec_length(target_record_array + target_record_byte_offset + 0x20); fast_vec_add(target_record_sum_or_camera_local_offset, - (ship_vars->i110 << 7) + D_L17_001600EC, - (ship_vars->i110 << 7) + D_L17_001600EC + 0x10); + (ship_vars->flight_target_record_index << 7) + D_L17_001600EC, + (ship_vars->flight_target_record_index << 7) + D_L17_001600EC + 0x10); lenB = fast_vec_length(target_record_sum_or_camera_local_offset); } else { qcopy(target, D_L17_001621F0); @@ -1576,7 +1576,7 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v 1, -1, 0); - ship_vars->s62 = l17_fighter_jet_collision_death_respawn_delay; + ship_vars->death_respawn_countdown = l17_fighter_jet_collision_death_respawn_delay; ship_moby->state = FIGHTER_JET_STATE_DEATH_RESPAWN_DELAY; ship_moby->flags |= 0x41; } From 8ce537e73ca3dc207bfd9db95ba387e25e0fe82b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:24:22 +0000 Subject: [PATCH 395/758] decomp: clarify names in sand_mouse_update p2080 -> hero_moby: Authoritative sand_mouse.c Hero_2e3f20.p2080 is compared with collision-line hit object D_L01_001742D8 after collision_line(va,vb,0,moby,0); retail 0x002e4484-0x002e449c loads hero+0x2080 at 0x002e4494 and accepts that object as blocker. Checked helper request 589332f220f94d17b65c88ef26e9963c for level-01 0x002e30b8 establishes the same hero base 0x0013f350 at 0x002e30d0/30d8, loads +0x2080 at 0x002e30e0, and uses pointer+0xD0 as normalization input at 0x002e30e4/30e8, then adds hero position +0x80 at 0x002e30f0/30f4. Supplied compute_sand_mouse_approach_target C explicitly identifies this orientation pointer as hero_state_bytes->moby and resulting position as hero_state_bytes->motion.pos. Thus this is the hero's moby pointer, independently of field offset alone. Original assigned retail Ghidra iRam001413d0 collision-hit comparison agrees. --- src/overlays/shared/enemies/sand_mouse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/enemies/sand_mouse.c b/src/overlays/shared/enemies/sand_mouse.c index 426b2459ad..e31a976df9 100644 --- a/src/overlays/shared/enemies/sand_mouse.c +++ b/src/overlays/shared/enemies/sand_mouse.c @@ -85,7 +85,7 @@ typedef struct { char pad1134[0x24]; int i1158; char pad115C[0xF24]; - void *p2080; + void *hero_moby; char pad2084[8]; int i208C; char pad2090[0x14]; @@ -612,7 +612,7 @@ void sand_mouse_update(struct Moby *moby) { vb[2] = vb[2] + 0.2f; if (is_point_inside_clip_volume(hero_2e3f20->pos, sand_mouse_vars->vol)) { if (!collision_line(va, vb, 0, moby, 0) || - D_L01_001742D8 == hero_2e3f20->p2080) { + D_L01_001742D8 == hero_2e3f20->hero_moby) { compute_sand_mouse_approach_target((int)moby, sand_mouse_vars); if (hero_2e3f20->helper != 0 && hero_2e3f20->helper->oclass == 0x1B1 && hero_2e3f20->helper->state != 0xFE && From eeaf5c2e18dade068b96ab682302e5cf2708022d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:24:26 +0000 Subject: [PATCH 396/758] decomp: clarify names in apply_hero_selected_flags_and_state_transitions b20A9 -> selected_height_difference_in_band: Authoritative C src/overlays/shared/hero/hero_idle_sequence.c SHA-256 ccca68bcc09e617d19639b595c1bfae05e4bb381f0eaec532b7994480caa87f4 clears this byte on entry, then asserts it only in saved selector 0 when 0.25f < height_difference && height_difference < 0.85f. Retail 0x0020b9a8 clears hero+0x20A9; 0x0020ba68-0x0020ba80 computes hero+0x2F0 minus +0x2D8 and stores selected_height_difference at +0x22A4; 0x0020ba74 compares against 0.85f, 0x0020ba90 compares against 0.25f, and 0x0020baa0 stores 1 to +0x20A9 only after both strict tests. Original Ghidra likewise sets uRam001413f9=1 for this same fRam001415f4 band. Thus this u8 records the selected height-difference band predicate; the name asserts no step, surface, or downstream transition identity. --- 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 66311d819a..3655579037 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -3421,7 +3421,7 @@ typedef struct { u8 pad2090[0x14]; u8 b20A4; u8 pad20A5[0x4]; - u8 b20A9; + u8 selected_height_difference_in_band; u8 pad20AA[0x1FA]; f32 selected_height_difference; s32 i22A8; @@ -3439,7 +3439,7 @@ void apply_hero_selected_flags_and_state_transitions(void) { fast_mem_zero16(&P.h12E0, 0x10); P.b12ED = save; P.h12E0 = -1; - P.b20A9 = 0; + P.selected_height_difference_in_band = 0; P.h308 = 0; if (saved_flag_selector == -1) return; @@ -3459,7 +3459,7 @@ void apply_hero_selected_flags_and_state_transitions(void) { height_difference = P.f2F0 - P.f2D8; P.selected_height_difference = height_difference; if (height_difference < 0.85f && 0.25f < height_difference) - P.b20A9 = 1; + P.selected_height_difference_in_band = 1; P.height_difference_selected = 1; } if (saved_flag_selector == 3) From c636eecc34237cccf44a95242f40cb08c456d385 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:24:30 +0000 Subject: [PATCH 397/758] decomp: clarify names in process_hero_equipped_item_input f1090 -> slot0_item_moby: Retail 0x002280C0 loads hero+0x1090, passes that pointer to is_wrench_moby at 0x002280CC, and tests its state byte +0x20 at 0x002280DC. Case 15 dereferences its pvars at 0x0022871C and uses the same object for voice allocation. Supplied state-entry C identifies the held object as hero.items[0].moby. f10A0 -> equipped_item_input_mask: Retail 0x00228048 loads hero+0x10A0 into s3. 0x002280A8 passes s3 as pad_pressed_within's requested button mask; 0x00228534 and 0x002289F4 AND held/pressed controller words with it. This is the equipped item's input button mask. f10B4 -> equipped_slot_state: Checked hero_slot_item_id listing 0x0020D498-0x0020D4C8 multiplies the slot by 0x50, reads +0x10B4 and returns +0x10B8 only when it equals 2. Supplied helper C explicitly tests items[0].state against HERO_ITEM_SLOT_STATE_READY. Assigned retail 0x00228028-2C checks the same slot-zero field. f10B8 -> equipped_slot_item_id: Checked hero_slot_item_id at 0x0020D4C0 returns the +0x10B8 word for the selected 0x50-byte slot; supplied C calls it items[0].item_id. Assigned 0x00228034-60 switches that word after the slot-ready guard, including established ITEM_WRENCH and ITEM_GRAPPLE branches. f198 -> current_state_elapsed_frames: Retail 0x00228038 snapshots hero+0x198 and 0x0022811C/0x00228260 compare it with scale_game_frames thresholds. 0x00228A0C-10 detects changes and 0x00228B40-44 returns whether it decreased after hero_set_state calls. Supplied timer/state-entry C increments hero.state_timer per update and resets it to zero on state changes, proving the current-state elapsed-frame counter. f1E6 -> grapple_entry_lockout: Retail 0x0022859C-A0 tests hero+0x1E6 before requesting swing entry 0x2C, and 0x002285C8-CC tests it before grapple entry 0x24. Both nonzero tests suppress entry. Supplied HERO_STATE_GRAPPLE_SWING_ENTRY initializes grapple_lockout_timer and the timer update decrements it. The name is limited to its demonstrated shared grapple-entry lockout role. f2084 -> hero_current_state: Assigned retail 0x0022818C loads +0x2084 for the jump/fall state tests; 0x00228370/80 tests the established crouch-swing state 0x15 before requesting another 0x15 through hero_set_state. Supplied hero_set_state C writes requested_state into state.current, and target-selection C reads +0x2084 as the same state selector. It is distinct from equipment ID +0x10B8 and control mode +0x208C. f208C -> hero_control_mode: Assigned retail 0x0022806C reads +0x208C for ground/jump eligibility, and 0x00228358-5C requires mode 6 for melee continuation. Checked animation helper 0x0020E52C/540 reads this field to select the mode-12 animation, matching supplied start_equipped_item_animation C's state.control_mode. Supplied target-selection C also treats +0x208C as control mode. f20A4 -> equipped_item_input_locked: Retail 0x00228000-10 returns zero when the byte at hero+0x20A4 is nonzero, preventing all equipped-item input handling; 0x002285E0 repeats the same guard before the vehicle-toggle item. The proposed functional name denotes this demonstrated input lock, without asserting who sets it or all other consumers. f20A8 -> equipped_item_animation_active: Checked start_equipped_item_animation writes byte 1 to hero+0x20A8 at 0x0020E550-55C while loading item animation definitions and starting hero/slot animations. Supplied helper C calls this item_anim_active. Assigned 0x0022876C-70 and 0x00228864-68 test the same byte to prevent starting another equipped-item animation. f22DE -> mode3_toggle_delay_frames: Assigned retail 0x00228640-44 refuses a second toggle while short +0x22DE is nonzero, then stores 0x12 at 0x00228668. Supplied update_hero_timers_and_reach_state consumes the corresponding vehicle_toggle_timer by decrementing it and, on expiry, exits mode 3 or spawns the mode-3 object and enters mode 3/state 0x53. The supplied retail annotation explicitly binds that timer consumer to +0x22DE. f968 -> grapple_target_valid: Checked select_hero_grapple_target clears +0x968 at 0x002221BC, selects a class-0x2F6 target, and sets +0x968 to 1 at 0x002223B8 only after its target line test succeeds. Assigned 0x00228564-88 compares competing target scores and may clear this flag; 0x002285BC-D8 uses it to permit grapple entry state 0x24. f984 -> grapple_target_score: Checked select_hero_grapple_target calls score_hero_target_candidate at 0x002222AC, adds a visibility penalty at 0x00222304, minimizes that score at 0x00222320-34, then stores the winning f22 to hero+0x984 at 0x002223A0. Assigned 0x00228570-88 compares it with the swing target score to choose which target-valid flag to clear; it is a score rather than an unweighted distance. f99E -> swing_target_valid: Checked select_hero_grapple_swing_target clears short +0x99E at 0x00221F30, selects a class-0x323 anchor, and sets it to 1 at 0x00222124 only after the line test at 0x0022210C succeeds. Assigned 0x00228558-5C tests this flag and 0x00228590-B4 uses it to request swing entry 0x2C after resolving target-score competition. --- src/overlays/shared/hero/hero_set_state.c | 184 +++++++++++----------- 1 file changed, 92 insertions(+), 92 deletions(-) diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index ffe8743ff8..fbef8abd46 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3244,9 +3244,9 @@ typedef struct { typedef struct { char p0[0x80] __attribute__((aligned(16))); char p80[0x118]; - int f198; + int current_state_elapsed_frames; char p19C[0x4A]; - short f1E6; + short grapple_entry_lockout; char p1E8[0xF4]; float f2DC; char p2E0[0x20]; @@ -3267,13 +3267,13 @@ typedef struct { char p4AE[0x14E]; int f5FC; char p600[0x368]; - int f968; + int grapple_target_valid; char p96C[0x18]; - float f984; + float grapple_target_score; char p988[0x10]; float f998; short f99C; - short f99E; + short swing_target_valid; char p9A0[0xC0]; int fA60; char pA64[0x38]; @@ -3281,23 +3281,23 @@ typedef struct { char pAA0[0x8]; float fAA8; char pAAC[0x5E4]; - Moby_227fa0 *f1090; + Moby_227fa0 *slot0_item_moby; char p1094[0xC]; - int f10A0; + int equipped_item_input_mask; char p10A4[0xC]; int f10B0; - int f10B4; - int f10B8; + int equipped_slot_state; + int equipped_slot_item_id; char p10BC[0x22E]; unsigned char f12EA; char p12EB[0xD99]; - int f2084; + int hero_current_state; int f2088; - int f208C; + int hero_control_mode; char p2090[0x14]; - unsigned char f20A4; + unsigned char equipped_item_input_locked; char p20A5[0x3]; - unsigned char f20A8; + unsigned char equipped_item_animation_active; char p20A9[0x3]; unsigned char f20AC; char p20AD[0x1EF]; @@ -3308,7 +3308,7 @@ typedef struct { short f22D8; char p22DA[0x2]; short f22DC; - short f22DE; + short mode3_toggle_delay_frames; } Hero_228770; extern Hero_228770 D_0013F450_h228770 __asm__("D_0013F350"); @@ -3339,24 +3339,24 @@ int process_hero_equipped_item_input(void) { int mask; if (D_0013F450_h228770.f20AC != 0 && - (D_0013F450_h228770.f10B8 != 8 || D_0013F450_h228770.f308 != 1)) { + (D_0013F450_h228770.equipped_slot_item_id != 8 || D_0013F450_h228770.f308 != 1)) { return 0; } - if (D_0013F450_h228770.f20A4 != 0) { + if (D_0013F450_h228770.equipped_item_input_locked != 0) { return 0; } - if (D_0013F450_h228770.f1090 == 0) { + if (D_0013F450_h228770.slot0_item_moby == 0) { return 0; } - if (D_0013F450_h228770.f10B4 != 2) { + if (D_0013F450_h228770.equipped_slot_state != 2) { return 0; } - start = D_0013F450_h228770.f198; - mask = D_0013F450_h228770.f10A0; - switch (D_0013F450_h228770.f10B8) { + start = D_0013F450_h228770.current_state_elapsed_frames; + mask = D_0013F450_h228770.equipped_item_input_mask; + switch (D_0013F450_h228770.equipped_slot_item_id) { case ITEM_WRENCH: - if (D_0013F450_h228770.f208C < 2U || - (D_0013F450_h228770.f208C == 4 && D_0013F450_h228770.f418 != 0)) { + if (D_0013F450_h228770.hero_control_mode < 2U || + (D_0013F450_h228770.hero_control_mode == 4 && D_0013F450_h228770.f418 != 0)) { Moby_227fa0 *equipped_item_moby; if (D_0013F450_h228770.f12EA != 0) { @@ -3365,7 +3365,7 @@ int process_hero_equipped_item_input(void) { if (!pad_pressed_within(mask, scale_game_frames(7), &item_press_age_frames[0])) { break; } - equipped_item_moby = D_0013F450_h228770.f1090; + equipped_item_moby = D_0013F450_h228770.slot0_item_moby; if (equipped_item_moby == 0) { break; } @@ -3376,10 +3376,10 @@ int process_hero_equipped_item_input(void) { break; } if ((controller_state.held & 0xA) || - ((D_0013F450_h228770.f2084 == 1 || D_0013F450_h228770.f2084 == 0x1E) && - D_0013F450_h228770.f198 > scale_game_frames(0x14))) { - if ((D_0013F450_h228770.f2084 == 1 || D_0013F450_h228770.f2084 == 0x1E) && - D_0013F450_h228770.f198 > scale_game_frames(0x14)) { + ((D_0013F450_h228770.hero_current_state == 1 || D_0013F450_h228770.hero_current_state == 0x1E) && + 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) && + D_0013F450_h228770.current_state_elapsed_frames > scale_game_frames(0x14)) { launch_hero_wrench(); break; } @@ -3393,18 +3393,18 @@ int process_hero_equipped_item_input(void) { } break; } - if (D_0013F450_h228770.f2084 == 7 || D_0013F450_h228770.f2084 == 9 || - D_0013F450_h228770.f2084 == 8 || D_0013F450_h228770.f2084 == 6 || - (D_0013F450_h228770.f2084 == 0xE && D_0013F450_h228770.fAA8 > 32.0f) || - (D_0013F450_h228770.f2084 == 0xB && D_0013F450_h228770.f450 != 3 && + 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.f2084 == 0xB && D_0013F450_h228770.f450 == 3 && + (D_0013F450_h228770.hero_current_state == 0xB && D_0013F450_h228770.f450 == 3 && D_0013F450_h228770.fAA8 > 20.0f) || - D_0013F450_h228770.f2084 == 0x2D || D_0013F450_h228770.f2084 == 0x11) { - if (D_0013F450_h228770.f198 > scale_game_frames(0xA)) { + D_0013F450_h228770.hero_current_state == 0x2D || D_0013F450_h228770.hero_current_state == 0x11) { + if (D_0013F450_h228770.current_state_elapsed_frames > scale_game_frames(0xA)) { int t = scale_game_frames(0xA); - if (D_0013F450_h228770.f2084 == 0xB || D_0013F450_h228770.f2084 == 0xE) { + if (D_0013F450_h228770.hero_current_state == 0xB || D_0013F450_h228770.hero_current_state == 0xE) { t = scale_game_frames(0x12); } if (!pad_pressed_within(mask, t, 0)) { @@ -3412,7 +3412,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.f2084 == 8 && D_0013F450_h228770.f2DC > 0.57f)) { + (D_0013F450_h228770.hero_current_state == 8 && D_0013F450_h228770.f2DC > 0.57f)) { if (D_0013F450_h228770.f5FC != 0) { break; } @@ -3426,12 +3426,12 @@ int process_hero_equipped_item_input(void) { break; } } - if (D_0013F450_h228770.f208C == 6) { + if (D_0013F450_h228770.hero_control_mode == 6) { HeroTableRow2C *wrench_attack_record = &attack_records[D_0013F450_h228770.fA60]; int t; - if (D_0013F450_h228770.f2084 == 0x15) { - if (D_0013F450_h228770.f198 > scale_game_frames(0x1E)) { + if (D_0013F450_h228770.hero_current_state == 0x15) { + if (D_0013F450_h228770.current_state_elapsed_frames > scale_game_frames(0x1E)) { if (D_0013F450_h228770.fA9C != 0) { break; } @@ -3482,34 +3482,34 @@ int process_hero_equipped_item_input(void) { if (D_0013F450_h228770.f30E != 0) { t = scale_game_frames(8); } - if (D_0013F450_h228770.f208C < 2U || D_0013F450_h228770.f208C == 4 || - D_0013F450_h228770.f208C == 2 || D_0013F450_h228770.f208C == 0xF || - D_0013F450_h228770.f208C == 5 || D_0013F450_h228770.f2084 == 0x1E) { + 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) { if (pad_pressed_within(mask, t, 0) || ((controller_state.held & mask) && D_0013F450_h228770.f10B0 > scale_game_frames(0xF))) { - if (D_0013F450_h228770.f99E != 0) { - if (D_0013F450_h228770.f968 != 0) { - if (D_0013F450_h228770.f998 < D_0013F450_h228770.f984) { - D_0013F450_h228770.f968 = 0; + if (D_0013F450_h228770.swing_target_valid != 0) { + if (D_0013F450_h228770.grapple_target_valid != 0) { + if (D_0013F450_h228770.f998 < D_0013F450_h228770.grapple_target_score) { + D_0013F450_h228770.grapple_target_valid = 0; } else { - D_0013F450_h228770.f99E = 0; + D_0013F450_h228770.swing_target_valid = 0; } } - if (D_0013F450_h228770.f99E != 0 && D_0013F450_h228770.f1E6 == 0 && - D_0013F450_h228770.f2084 != 0x2C) { + if (D_0013F450_h228770.swing_target_valid != 0 && D_0013F450_h228770.grapple_entry_lockout == 0 && + D_0013F450_h228770.hero_current_state != 0x2C) { hero_set_state(0x2C, 1); break; } } - if (D_0013F450_h228770.f968 != 0 && D_0013F450_h228770.f1E6 == 0) { + if (D_0013F450_h228770.grapple_target_valid != 0 && D_0013F450_h228770.grapple_entry_lockout == 0) { hero_set_state(0x24, 1); } } } } break; case ITEM_VEHICLE_MODE_TOGGLE: - if (D_0013F450_h228770.f20A4 != 0) { + if (D_0013F450_h228770.equipped_item_input_locked != 0) { break; } if (!can_select_hero_item_31()) { @@ -3521,40 +3521,40 @@ int process_hero_equipped_item_input(void) { if (D_00141660 != 0x1F) { break; } - if (D_0013F450_h228770.f1090->oclass != 0x1E3) { + if (D_0013F450_h228770.slot0_item_moby->oclass != 0x1E3) { break; } - if (D_0013F450_h228770.f22DE != 0) { + if (D_0013F450_h228770.mode3_toggle_delay_frames != 0) { break; } allocate_hero_voice_for_entry(0x18, 0); - D_0013F450_h228770.f22DE = 0x12; + D_0013F450_h228770.mode3_toggle_delay_frames = 0x12; D_0013F450_h228770.f22DC = 1; break; case ITEM_REMOTE_VENDOR: - if (D_0013F450_h228770.f208C < 3U || D_0013F450_h228770.f208C == 4 || - D_0013F450_h228770.f208C == 5) { + if (D_0013F450_h228770.hero_control_mode < 3U || D_0013F450_h228770.hero_control_mode == 4 || + D_0013F450_h228770.hero_control_mode == 5) { if (pad_pressed_within(mask, scale_game_frames(8), 0)) { open_vendor_menu(0); } } break; case 15: - if (D_0013F450_h228770.f208C < 2U || D_0013F450_h228770.f208C == 0xC || - D_0013F450_h228770.f208C == 2 || D_0013F450_h228770.f208C == 4 || - D_0013F450_h228770.f208C == 5 || D_0013F450_h228770.f208C == 0xF || - D_0013F450_h228770.f2084 == 0x1E) { + 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) { PVar *equipped_item_vars; - if (D_0013F450_h228770.f1090 == 0) { + if (D_0013F450_h228770.slot0_item_moby == 0) { break; } - equipped_item_vars = *(PVar **)&D_0013F450_h228770.f1090->pvars; + equipped_item_vars = *(PVar **)&D_0013F450_h228770.slot0_item_moby->pvars; if (((controller_state.held & mask) && D_0013F450_h228770.f10B0 > scale_game_frames(5)) || (controller_state.pressed & mask)) { if (get_ammo(-1)) { - if (D_0013F450_h228770.f20A8 == 0) { + if (D_0013F450_h228770.equipped_item_animation_active == 0) { start_equipped_item_animation(); } break; @@ -3562,9 +3562,9 @@ int process_hero_equipped_item_input(void) { } if (controller_state.held & mask) { if (!get_ammo(-1)) { - if (!voice_is_playing(D_0013F450_h228770.f1090, equipped_item_vars->fC)) { + if (!voice_is_playing(D_0013F450_h228770.slot0_item_moby, equipped_item_vars->fC)) { equipped_item_vars->fC = - allocate_voice_for_target_entry(0, 0, (int)D_0013F450_h228770.f1090); + allocate_voice_for_target_entry(0, 0, (int)D_0013F450_h228770.slot0_item_moby); } } } @@ -3575,15 +3575,15 @@ int process_hero_equipped_item_input(void) { case 20: case 24: case 25: - if ((D_0013F450_h228770.f208C == 0 && D_0013F450_h228770.f2084 != 0x1E) || - D_0013F450_h228770.f208C == 1 || D_0013F450_h228770.f208C == 0xC || - D_0013F450_h228770.f208C == 5 || D_0013F450_h228770.f208C == 0xF || - (D_0013F450_h228770.f208C == 4 && D_0013F450_h228770.f4AC != 0) || - (D_0013F450_h228770.f2084 == 0x23 && D_0013F450_h228770.fAA8 > 25.0f)) { + 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)) { int t; int n; - if (D_0013F450_h228770.f20A8 != 0) { + if (D_0013F450_h228770.equipped_item_animation_active != 0) { break; } t = scale_game_frames(7); @@ -3592,33 +3592,33 @@ 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.f208C == 0xC || D_0013F450_h228770.f208C == 0 || - D_0013F450_h228770.f2084 == 3 || - (D_0013F450_h228770.f208C == 1 && D_0013F450_h228770.f229C < 0.7f)) { + 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 && D_0013F450_h228770.f229C < 0.7f)) { hero_set_state(0x23, 1); } else { start_equipped_item_animation(); } break; } - if (D_0013F450_h228770.f1090 != 0) { - allocate_voice_for_target_entry(0, 0, (int)D_0013F450_h228770.f1090); + if (D_0013F450_h228770.slot0_item_moby != 0) { + allocate_voice_for_target_entry(0, 0, (int)D_0013F450_h228770.slot0_item_moby); } } } break; case 18: - if (D_0013F450_h228770.f208C < 2U || - (D_0013F450_h228770.f208C == 4 && D_0013F450_h228770.f418 != 0)) { - if (D_0013F450_h228770.f2084 != 1) { + 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) { int t = scale_game_frames(0xA); int n = D_0013F450_h228770.f10B0; if (pad_pressed_within(mask, t <= n ? t : n, &item_press_age_frames[2])) { - if (D_0013F450_h228770.f1090 != 0) { + if (D_0013F450_h228770.slot0_item_moby != 0) { hero_set_state(0x20, 1); - if (D_0013F450_h228770.f1090 != 0) { - allocate_voice_for_target_entry(0, 0, (int)D_0013F450_h228770.f1090); + if (D_0013F450_h228770.slot0_item_moby != 0) { + allocate_voice_for_target_entry(0, 0, (int)D_0013F450_h228770.slot0_item_moby); } } } @@ -3626,36 +3626,36 @@ int process_hero_equipped_item_input(void) { } break; case 21: - if (D_0013F450_h228770.f1090 != 0) { + if (D_0013F450_h228770.slot0_item_moby != 0) { if (controller_state.pressed & mask) { start_equipped_item_animation(); } } break; } - if (D_0013F450_h228770.f198 == start) { - if (hero_slot_item_id(3) == 3 && D_0013F450_h228770.f2084 != 0x81 && + if (D_0013F450_h228770.current_state_elapsed_frames == start) { + if (hero_slot_item_id(3) == 3 && D_0013F450_h228770.hero_current_state != 0x81 && (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.f208C < 2U || D_0013F450_h228770.f208C == 0xC || - ((D_0013F450_h228770.f208C == 2 || D_0013F450_h228770.f208C == 4) && + 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.f300 != 0)) { if ((controller_state.held & 8) && (controller_state.pressed & 8)) { hero_set_state(0x81, 1); } } } - if ((controller_state.pressed & 8) && D_0013F450_h228770.f2084 != 0x81) { + if ((controller_state.pressed & 8) && D_0013F450_h228770.hero_current_state != 0x81) { hero_repeat_press_window_frames = scale_game_frames(0x1E); } - } else if (D_0013F450_h228770.f2084 != 0x13 && D_0013F450_h228770.f2084 != 0x81 && - D_0013F450_h228770.f2084 != 0x15 && D_0013F450_h228770.f2084 != 0x16) { + } 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) { D_0013F450_h228770.f22CA = 0; } } - return D_0013F450_h228770.f198 < start; + return D_0013F450_h228770.current_state_elapsed_frames < start; } /* Ported from rac1-decomp (src/overlays/shared/help_00221A98.c: func_L00_00229348), where it is exact; names translated to the US level program. */ From 90ae4e357c725c657f30ee2cbe5745fc1b5b3396 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:24:34 +0000 Subject: [PATCH 398/758] decomp: clarify names in horny_toad_update unk1E4 -> wait_path_point_set_index: Retail 002d47d4-002d4818 tests pvars+1E4 nonnegative before entering WAIT_TO_FOLLOW_PATH. Checked helper 002d5160, request 704732543c0c468994b6cecf627526d3, at 002d5350-002d539c selects +1E4 specifically in that waiting state, indexes the 001b04b0 pointer table by four bytes, and passes the selected object's count at +0 and point array at +10 to 0025ff38. This is the waiting state's counted point-set index, distinct from movement path +1E8. unk1FC -> movement_yaw_offset: Root retail 002d4b2c-002d4b5c stores random_float_between(-20,20) times 0.017453292 at pvars+1FC. Checked movement helper request fea4d09739c64f0490cb7fa1e18cfee6 at 002d550c-002d5514 computes target yaw; 002d553c-002d5558 adds +1FC through fast_add_rotations only when target distance exceeds 2, then 002d5574-002d55ac approaches that yaw. Supplied C aliases this location as HornyToadVars.unk1F4[2], proving an angular movement offset. unk258 -> wander_turn_step: Root 002d4724-002d4760 initializes +258 to frame_time*2.9670596 and 002d4b10-002d4b18 passes pvars+240 to the wander helper. Checked request f6b54ec53c6a40c0b8437ede601f9036 at 002616b0-002616c0 loads relative +24 as desired heading and relative +18 (absolute pvars+258) as the step argument to 0025bc00, with destination moby+48 yaw. The time-scaled angular quantity controls turning during wander; no acceleration semantics are asserted. unk25C -> wander_radius: Root 002d4754 initializes +25C to 1.5, with 002d4774-002d47a4 reducing it to 0.75 near the reference point. Root passes pvars+240 saved initial position to wander helper at 002d4b10-002d4b18. Checked request f6b54ec53c6a40c0b8437ede601f9036 at 00261760-00261780 compares XY distance from moby to that saved center against relative +1C (absolute +25C); when exceeded, 00261788-002617a4 sets desired heading back toward the center. Thus this is the wander radius, distinct from home. unk276 -> move_to_point_or_face_target_timer: Checked helper request 704732543c0c468994b6cecf627526d3 at 002d5408-002d5444 decrements pvars+276 with fast_dec_timer_s16 and refreshes it from scaled random 180..240 when +38 is nonzero. At 002d544c-002d547c a nonzero timer moves ROAM or RETURN_HOME to established state 10, MOVE_TO_POINT_OR_FACE_TARGET. Assigned retail 002d4f94-002d4fb0 allows state 10 to return home once this s16 timer reaches zero, subject to the other status/animation conditions. Trigger gameplay meaning is not asserted. --- src/overlays/shared/enemies/horny_toad.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/shared/enemies/horny_toad.c b/src/overlays/shared/enemies/horny_toad.c index dfcae03f8e..8f786be286 100644 --- a/src/overlays/shared/enemies/horny_toad.c +++ b/src/overlays/shared/enemies/horny_toad.c @@ -67,22 +67,22 @@ typedef struct { u8 pad1C8[8]; ToadVec home; int unk1E0; - int unk1E4; + int wait_path_point_set_index; int path; int follow_moby; int pickup_moby; float turn_speed; float unk1F8; - float unk1FC; + float movement_yaw_offset; u8 unk200[0x40]; ToadVec unk240; float unk250; float unk254; - float unk258; - float unk25C; + float wander_turn_step; + float wander_radius; u8 pad260[0x14]; s16 path_point; - s16 unk276; + s16 move_to_point_or_face_target_timer; } ToadVars; typedef struct { @@ -224,22 +224,22 @@ void horny_toad_update(Moby *moby) { horny_toad_vars->unk140 = &D_L00_00161960; qcopy(horny_toad_vars->unk240, (*(ToadVec *)&moby->pos)); k = frame_time; - horny_toad_vars->unk25C = 1.5f; + horny_toad_vars->wander_radius = 1.5f; horny_toad_vars->unk254 = k * 2.0f; - horny_toad_vars->unk258 = k * 2.9670596f; + horny_toad_vars->wander_turn_step = k * 2.9670596f; { *(u128 *)reference_point_or_movement_endpoint = 0; reference_point_or_movement_endpoint[0] = 150.0f; reference_point_or_movement_endpoint[1] = 127.0f; if (vector_distance_xy((*(ToadVec *)&moby->pos), reference_point_or_movement_endpoint) < 5.0f) { - horny_toad_vars->unk25C = 0.75f; + horny_toad_vars->wander_radius = 0.75f; } } horny_toad_vars->unk58 = truncate_float_to_s32(12.0f); horny_toad_vars->unk5A = truncate_float_to_s32(2.0f); if (horny_toad_vars->path >= 0) { - if (horny_toad_vars->unk1E4 >= 0) { + if (horny_toad_vars->wait_path_point_set_index >= 0) { ToadPath *path = toad_paths[horny_toad_vars->path]; qcopy(horny_toad_vars->home, path->pts[path->count - 1]); qcopy((*(ToadVec *)&moby->pos), path->pts[0]); @@ -327,7 +327,7 @@ void horny_toad_update(Moby *moby) { } update_object_wander_movement((char *)moby, (char *)horny_toad_vars->unk240, 0.5f, 0.5f); if (horny_toad_vars->unk1C4 != 2) { - horny_toad_vars->unk1FC = random_float_between(-20.0f, 20.0f) * 0.017453292f; + horny_toad_vars->movement_yaw_offset = random_float_between(-20.0f, 20.0f) * 0.017453292f; moby->state = HORNY_TOAD_APPROACH_AND_FACE_TARGET; if (moby->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(10)); @@ -423,7 +423,7 @@ void horny_toad_update(Moby *moby) { moby->state = HORNY_TOAD_APPROACH_AND_FACE_TARGET; if (moby->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(10)); - } else if (horny_toad_vars->unk276 == 0) { + } else if (horny_toad_vars->move_to_point_or_face_target_timer == 0) { moby->state = HORNY_TOAD_RETURN_HOME; if (moby->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(20)); From 1e698ff0222f5ce43b05912a7db32c668c84e3aa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:24:38 +0000 Subject: [PATCH 399/758] decomp: clarify names in metropolis_train_locomotive_update i100 -> boarding_turret_moby_index: Engine pvars +0x100 is rejected when -1 at retail 0x0029317c-0x00293180, then shifted by 8 and added to the moby pool at 0x002931d4-0x002931f8 to enable that moby's command when boarding starts. Its pvars are loaded at 0x00293200-0x0029322c and yaw/pitch aimed from level camera toward hero at 0x00293214-0x00293260; the same indexed moby's command gates the first-path exit at 0x00293500-0x00293518. Authoritative C identifies this as the td Turret292e98 binding. i10C -> fall_check_airborne_frames: Retail 0x00293334-0x00293348 tests hero.air_frames nonzero and control_mode !=3; 0x0029337c-0x00293394 increments Engine +0x10C once per update and compares it against scale_game_frames(60). When this count exceeds the threshold and hero Z is more than 10 below the nearest path point, 0x002933a8-0x00293420 fades out and sets hero.fall_fade_pending. The complementary branch clears this count at 0x00293434. Source and original decompilation agree that this is the airborne-frame counter for the fall check. i28 -> cuboid_index: In the second-path setup retail 0x002936a8-0x002936c8 loads Turret pvars +0x28, multiplies by 0x80, adds cuboid array base 0x001600ec, and writes position X at +0x30. 0x00293704-0x00293734 similarly writes Y/Z, 0x00293738-0x0029378c translates the cuboid to the path start and raises Z by 2.7, and 0x00293790-0x002937ec clears rotation and installs path heading. Authoritative C expresses every access as l03_cuboids[tdb->i28].pos/rot, proving this integer selects a cuboid. i60 -> path_node_index: Assigned retail 0x00293148 and 0x00293860 initialize coupling pvars +0x60 to 1 when installing a path; 0x00293928-0x00293934 compares it to the saved marked second-path node index to begin braking. Bounded checked level-03 helper 0x00293c78 (evidence f04ecc1d83f142d2be9f1ffeed32b8e4) loads pvars at 0x00293cd4 and forms s2=pvars+0x60 at 0x00293d10. At 0x002941a0-0x002941b8 and 0x00294240-0x00294254 it loads s2[0], shifts by 4 and indexes the path at s2+0x10 with node records starting at +0x10. This proves +0x60 is the path node cursor index rather than a state selector. --- .../l03/mobys/metropolis_train_locomotive.c | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/overlays/l03/mobys/metropolis_train_locomotive.c b/src/overlays/l03/mobys/metropolis_train_locomotive.c index 20cc1d1ed6..8414fc1d7b 100644 --- a/src/overlays/l03/mobys/metropolis_train_locomotive.c +++ b/src/overlays/l03/mobys/metropolis_train_locomotive.c @@ -324,15 +324,15 @@ typedef struct { int iD8; float fDC; int ids[8]; - int i100; + int boarding_turret_moby_index; int i104; int i108; - int i10C; + int fall_check_airborne_frames; } Engine292e98; typedef struct { char p00[0x60]; - int i60; + int path_node_index; char p64[0xC]; char *path; int i74; @@ -347,7 +347,7 @@ typedef struct { float f14; float f18; char p1C[0xC]; - int i28; + int cuboid_index; int i2C; } Turret292e98; @@ -508,7 +508,7 @@ void metropolis_train_locomotive_update(char *moby) { MOBY(moby)->command = 3; cdata->i74 = train_engine_pvars->iA4; cdata->path = ((char *)l03_paths[cdata->i74]); - cdata->i60 = 1; + cdata->path_node_index = 1; train_engine_pvars->fC8 = 0.0f; break; case TRAIN_WAIT_FOR_BOARDING: @@ -516,7 +516,7 @@ void metropolis_train_locomotive_update(char *moby) { if (!is_point_inside_clip_volume(&hero.motion, train_engine_pvars->iB4)) { break; } - if (train_engine_pvars->i100 == -1) { + if (train_engine_pvars->boarding_turret_moby_index == -1) { break; } mode = hero.state.control_mode; @@ -525,8 +525,8 @@ void metropolis_train_locomotive_update(char *moby) { D_L03_0015FDFC = 1; request_music_track(4, 7); set_moby_dialogue_record_value(moby, 1); - ((char *)&D_L03_0015FFD8_m292[train_engine_pvars->i100])[0xBC] = 1; - td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->i100] + 0x78); + ((char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index])[0xBC] = 1; + td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index] + 0x78); AIM_AT_HERO(td); td->i2C = scale_game_frames(860); train_engine_pvars->i104 = scale_game_frames(30); @@ -544,8 +544,8 @@ void metropolis_train_locomotive_update(char *moby) { if (hero.air_frames.s != 0 && hero.state.control_mode != 3) { FUN_L00_0025df68( cdata->path, hero.motion.pos.f, start, &seg, &frac, 0, 999.0f, 5.0f, 0.0f); - train_engine_pvars->i10C += 1; - if (scale_game_frames(60) < train_engine_pvars->i10C && + train_engine_pvars->fall_check_airborne_frames += 1; + if (scale_game_frames(60) < train_engine_pvars->fall_check_airborne_frames && hero.motion.pos.f[2] < start[2] - 10.0f) { RELEASE_VOICE(train_engine_pvars->i108); train_engine_pvars->i108 = -1; @@ -554,10 +554,10 @@ void metropolis_train_locomotive_update(char *moby) { break; } } else { - train_engine_pvars->i10C = 0; + train_engine_pvars->fall_check_airborne_frames = 0; } - if (((unsigned char *)(char *)&D_L03_0015FFD8_m292[train_engine_pvars->i100])[0xBC] != 0) { - td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->i100] + 0x78); + if (((unsigned char *)(char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index])[0xBC] != 0) { + td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index] + 0x78); AIM_AT_HERO(td); } if (hero.ground_moby != 0 && @@ -573,7 +573,7 @@ void metropolis_train_locomotive_update(char *moby) { if (train_engine_pvars->iD8 == -1) { break; } - if (((unsigned char *)(char *)&D_L03_0015FFD8_m292[train_engine_pvars->i100])[0xBC] != 0) { + if (((unsigned char *)(char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index])[0xBC] != 0) { break; } for (i = 0; i < 8; i++) { @@ -598,25 +598,25 @@ void metropolis_train_locomotive_update(char *moby) { vector_distance_xy(l03_camera.pos.f, ((char *)l03_paths[train_engine_pvars->iAC]) + 0x10), *(float *)(((char *)l03_paths[train_engine_pvars->iAC]) + 0x18) - l03_camera.pos.f[2]); - l03_cuboids[tdb->i28].pos.x = + l03_cuboids[tdb->cuboid_index].pos.x = fast_cos(PATH_HEADING(((char *)l03_paths[train_engine_pvars->iAC]))) * -(train_engine_pvars->fDC + 4.0f); - l03_cuboids[tdb->i28].pos.y = + l03_cuboids[tdb->cuboid_index].pos.y = fast_sin(PATH_HEADING(((char *)l03_paths[train_engine_pvars->iAC]))) * -(train_engine_pvars->fDC + 4.0f); - l03_cuboids[tdb->i28].pos.z = 0.0f; - fast_vec_add(&l03_cuboids[tdb->i28].pos, - &l03_cuboids[tdb->i28].pos, + l03_cuboids[tdb->cuboid_index].pos.z = 0.0f; + fast_vec_add(&l03_cuboids[tdb->cuboid_index].pos, + &l03_cuboids[tdb->cuboid_index].pos, ((char *)l03_paths[train_engine_pvars->iAC]) + 0x10); - l03_cuboids[tdb->i28].pos.z += 2.7f; - clear_u64_value(&l03_cuboids[tdb->i28].rot); - l03_cuboids[tdb->i28].rot.z = PATH_HEADING(((char *)l03_paths[train_engine_pvars->iAC])); + l03_cuboids[tdb->cuboid_index].pos.z += 2.7f; + clear_u64_value(&l03_cuboids[tdb->cuboid_index].rot); + l03_cuboids[tdb->cuboid_index].rot.z = PATH_HEADING(((char *)l03_paths[train_engine_pvars->iAC])); tdb->i2C = scale_game_frames(10000); *(OvlQuad *)start = *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->iAC]) + 0x10); place_metropolis_train( moby, start, PATH_HEADING(((char *)l03_paths[train_engine_pvars->iAC]))); cdata->i74 = train_engine_pvars->iAC; - cdata->i60 = 1; + cdata->path_node_index = 1; cdata->fF0 = 1.0f; train_engine_pvars->fC0 = 2.0f * train_engine_pvars->fC0; cdata->fFC = train_engine_pvars->fC0; @@ -629,7 +629,7 @@ void metropolis_train_locomotive_update(char *moby) { update_metropolis_train_motion(moby); D_L03_0015FDFC = 1; ENGINE_SOUND(); - if (cdata->i60 >= train_engine_pvars->iD4) { + if (cdata->path_node_index >= train_engine_pvars->iD4) { train_engine_pvars->fDC = 0.0f; braking_speed_floor = train_engine_pvars->fDC; train_engine_pvars->fC8 -= train_engine_pvars->fC0 / 1.9f * frame_time; From f160be325941df575944f274f50d4c9c405325aa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:24:43 +0000 Subject: [PATCH 400/758] decomp: clarify names in elevator_update f2084 -> hero_state: Hero_2FDA70.f2084 is loaded from hero+0x2084 and compared against 100 at retail 0x002fc924-0x002fc92c to gate elevator interactions. Bounded restore_hero_from_vehicle_mode evidence d10568228c9345c8ab93c147754254c7 loads that same field at 0x00227dc8, compares it with 100, and conditionally preserves it for scene game modes 2/6; otherwise 0x00227df4 calls 0x002356a0 with (0,1). Checked start_scene evidence e372c8566c8b4ced8651b67dd2942fef calls that same 0x002356a0 with (100,2) at 0x002a5a7c-0x002a5a98, corresponding to the supplied established C hero_set_state(100,2). The field therefore holds the current hero state, with 100 preserved during scene playback, rather than an elevator state. f84 -> vehicle_entry_configuration_active: Data_2FDA70.f84 records the entry/exit placement and linked-moby configuration. Retail 0x002fcaec stores 1 before selecting vehicle_entry_placement_cuboid_index at 0x002fcb24-0x002fcb38 and entering hero vehicle mode at 0x002fcb54. Vehicle exit clears it at 0x002fc9cc before restore_hero_from_vehicle_mode and vehicle_exit_placement_cuboid_index placement at 0x002fc9d4-0x002fca00. When the alternative-item flag is set, 0x002fcb70 tests this field: zero takes the entry configuration, storing 1 and using the entry placement at 0x002fcb88-0x002fcbfc; nonzero takes the exit configuration, clearing it and using the exit placement at 0x002fcc18-0x002fcc8c. The authoritative C agrees. This names the elevator's persistent entry configuration, which also operates without actual vehicle mode, rather than claiming this field is hero.vehicle_mode. --- src/overlays/l06/mobys/elevator.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l06/mobys/elevator.c b/src/overlays/l06/mobys/elevator.c index 80281d81d6..4e17075858 100644 --- a/src/overlays/l06/mobys/elevator.c +++ b/src/overlays/l06/mobys/elevator.c @@ -62,7 +62,7 @@ typedef struct { int height_cuboid_index; int vehicle_exit_placement_cuboid_index; int vehicle_entry_placement_cuboid_index; - int f84; + int vehicle_entry_configuration_active; int f88; float height_velocity; int f90; @@ -104,7 +104,7 @@ typedef struct { short f30E; char pad310[0x1D70]; Moby_2FDA70 *moby; - int f2084; + int hero_state; char pad2088[0x1C]; unsigned char vehicle_mode; char pad20A5[0x226]; @@ -231,7 +231,7 @@ void elevator_update(Moby_2FDA70 *moby) { moby_data->f90 = 0; } else if (((Hero_2FDA70 *)(D_0013F350))->moby->fA6 == 0x57) { moby->state = WAIT_FOR_HERO_TRIGGER_AT_NODE_OFFSET_HEIGHT; - moby_data->f84 = 1; + moby_data->vehicle_entry_configuration_active = 1; } break; case WAIT_FOR_SCENE_GAME_MODE_CLEAR: @@ -248,12 +248,12 @@ void elevator_update(Moby_2FDA70 *moby) { ok = try_set_help_message(9, 0x1781) != 0; } else if (D_0013D5CA_2FDA70[0] == 0) { ok = try_set_help_message(9, 0x177E) != 0; - } else if (moby_data->f84 != 0) { + } else if (moby_data->vehicle_entry_configuration_active != 0) { ok = try_set_help_message(9, 0x1785) != 0; } else { ok = try_set_help_message(9, 0x1789) != 0; } - if ((pad_pressed_words[0] & 0x10) && ((Hero_2FDA70 *)(D_0013F350))->f2084 != 100 && + if ((pad_pressed_words[0] & 0x10) && ((Hero_2FDA70 *)(D_0013F350))->hero_state != 100 && ok) { ((Hero_2FDA70 *)(D_0013F350))->f1F2 = scale_game_frames(0x3C); moby_data->f90 = scale_game_frames(0x78); @@ -265,7 +265,7 @@ void elevator_update(Moby_2FDA70 *moby) { (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); - moby_data->f84 = 0; + moby_data->vehicle_entry_configuration_active = 0; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f94 = 0; restore_hero_from_vehicle_mode(); { @@ -289,7 +289,7 @@ void elevator_update(Moby_2FDA70 *moby) { (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); - moby_data->f84 = 1; + moby_data->vehicle_entry_configuration_active = 1; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f94 = ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].cls->f10; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f34 &= 0xFFFE; @@ -300,7 +300,7 @@ void elevator_update(Moby_2FDA70 *moby) { enter_hero_vehicle_mode_and_set_moby( 1, 0x43, (int)(D_L06_0015FFD8_macro + (moby_data->f6C << 8))); request_music_track(2, 7); - } else if (moby_data->f84 == 0) { + } else if (moby_data->vehicle_entry_configuration_active == 0) { fade_to_black(scale_game_frames(0x10)); set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); @@ -308,7 +308,7 @@ void elevator_update(Moby_2FDA70 *moby) { (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); - moby_data->f84 = 1; + moby_data->vehicle_entry_configuration_active = 1; moby_data->f94 = 1; { LevelCuboid *b = &l06_cuboids_macro[moby_data->vehicle_entry_placement_cuboid_index]; @@ -322,7 +322,7 @@ void elevator_update(Moby_2FDA70 *moby) { (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); - moby_data->f84 = 0; + moby_data->vehicle_entry_configuration_active = 0; moby_data->f94 = 0; { LevelCuboid *b = &l06_cuboids_macro[moby_data->vehicle_exit_placement_cuboid_index]; @@ -348,7 +348,7 @@ void elevator_update(Moby_2FDA70 *moby) { } else if (vector_distance_xy(&moby->pos, &((Hero_2FDA70 *)(D_0013F350))->pos) < 24.0f && moby->state == WAIT_FOR_HERO_TRIGGER_AT_NODE_OFFSET_HEIGHT && ((Hero_2FDA70 *)(D_0013F350))->pos.z + 5.0f < moby->pos.z) { - moby_data->f84 = 1; + moby_data->vehicle_entry_configuration_active = 1; moby_data->f94 = 1; moby->state = MOVE_TO_NODE_BASE_HEIGHT; set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); From 258d3e46b1437f5abac49124c61cb2dd9d80bf57 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:26:55 +0000 Subject: [PATCH 401/758] decomp: clarify names in hoven_turret_update b1 -> manipulator_attached: Source attaches the manipulator using hoven_turret_state at retail 00303600-00303604, and tests state+1 before detach_manipulator at 003039f8-00303a08. Checked level-12 attach helper 002682d0-002682ec skips an already-set byte and sets it to 1, then 00268334-0026833c links this state into moby+0x64. This establishes the manipulator attachment flag, not merely a byte offset. f2C -> damage_amount: Original retail case 4 obtains a non-null hit record from 00273310 at 003038fc-00303908. Instructions 0030391c-00303928 load turret health at state+0x8c, load hit+0x2c, subtract the latter and store the reduced health. Source mirrors health -= hit->f2C; health depletion triggers destruction at 0030398c-003039bc, and the supplied HUD renders this same health quantity. f78 -> pitch_step: Original retail case 4 and source derive target_pitch_step from adjusted vertical stick input at 00303be8-00303c08. Calls 00303c5c/00303c88 approach that target through state+0x78, then 00303c94-00303cac add the stored step into state+0x74. That accumulated pitch is clamped and applied to the manipulator at 00303ccc-00303cdc and passed as firing pitch at 00303d78-00303d80. Thus this is an angular increment per update, without a per-second units claim. f7C -> yaw_step: Source and original retail case 4 derive target_yaw_step from horizontal stick input at 00303b04-00303b34. Calls at 00303b88/00303bb4 approach that target through state+0x7c. Retail 00303bc0-00303be4 adds the stored quantity to moby rot.z, proving the persistent yaw increment per update rather than an absolute angle or a per-second speed. f80 -> muzzle_alternation_state: Source firing branch and retail 00303d28-00303d48 use state+0x80 to select firing animation 4 versus 3. Retail 00303d88-00303dcc tests the same value: value 1 selects moby point 2 and stores 0; the other branch selects point 1 and stores 1. That extracted position receives the firing offset and is passed to spawn_turret_rocket at 00303e30. This proves a state toggling between the two muzzle points; no left/right identity is asserted. f90 -> damage_cooldown_frames: Original retail 003038e8-003038f0 calls fast_dec_timer on state+0x90 and gates hit processing on its result. After a non-null hit, 00303910-00303918 stores scale_game_frames(4) into that field, then 0030391c-00303928 applies hit damage to health. The matching source decrements this timer before processing damage, proving a frame-scaled cooldown between damage checks. f94 -> completion_trigger_moby_index: Source and original retail case 4 compare state+0x94 with -1 at 003039c0-003039c8, then 003039d0-003039d8 multiply it by 0x100, add the moby pool base, and read the selected moby's signed state byte. A negative state enters the completion branch: 00303a40-00303ac4 clears mission persistence, queues a movie, unlocks planet 0xD, sets the camera and enters START_SCENE; mode 2 instead resets the turret. This proves the index and its completion-trigger role without identifying the referenced moby class. --- src/overlays/l12/mobys/hoven_turret.c | 58 +++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/overlays/l12/mobys/hoven_turret.c b/src/overlays/l12/mobys/hoven_turret.c index 169a8b9ccc..e26a99995c 100644 --- a/src/overlays/l12/mobys/hoven_turret.c +++ b/src/overlays/l12/mobys/hoven_turret.c @@ -109,20 +109,20 @@ typedef float Vec_304920[4] __attribute__((aligned(16))); typedef struct { char pad0; - unsigned char b1; + unsigned char manipulator_attached; char pad2[0xE]; char f10[0x60]; short f70; short f72; float f74; - float f78; - float f7C; - int f80; + float pitch_step; + float yaw_step; + int muzzle_alternation_state; int f84; int f88; float f8C; - int f90; - int f94; + int damage_cooldown_frames; + int completion_trigger_moby_index; int f98; int f9C; float fA0; @@ -139,7 +139,7 @@ typedef struct { typedef struct { char pad0[0x2C]; - float f2C; + float damage_amount; } Hit_304920; extern char *FUN_L00_0025a420(void *, int, int); @@ -230,8 +230,8 @@ void hoven_turret_update(struct Moby *moby) { moby->rot.y = 0.0f; hoven_turret_state->f70 = scale_game_frames(0x1E); hoven_turret_state->f72 = 0; - hoven_turret_state->f78 = 0.0f; - hoven_turret_state->f7C = 0.0f; + hoven_turret_state->pitch_step = 0.0f; + hoven_turret_state->yaw_step = 0.0f; hoven_turret_state->fA0 = moby->pos.z; hoven_turret_state->f98 = -1; moby->rot.z = 3.1415927f; @@ -298,11 +298,11 @@ void hoven_turret_update(struct Moby *moby) { add_draw_callback(draw_hoven_turret_hud, moby); } update_hoven_turret_target_alignment_timer(moby); - if (fast_dec_timer(&hoven_turret_state->f90)) { + if (fast_dec_timer(&hoven_turret_state->damage_cooldown_frames)) { Hit_304920 *hit = (Hit_304920 *)FUN_L00_0025a420(moby, 0x10000, 0); if (hit != 0) { - hoven_turret_state->f90 = scale_game_frames(4); - hoven_turret_state->f8C = hoven_turret_state->f8C - hit->f2C; + hoven_turret_state->damage_cooldown_frames = scale_game_frames(4); + hoven_turret_state->f8C = hoven_turret_state->f8C - hit->damage_amount; } moby->hit_slot = 0xFF; } @@ -321,12 +321,12 @@ void hoven_turret_update(struct Moby *moby) { break; } } - if (hoven_turret_state->f94 != -1 && - (signed char)((struct Moby *)((hoven_turret_state->f94 << 8) + + if (hoven_turret_state->completion_trigger_moby_index != -1 && + (signed char)((struct Moby *)((hoven_turret_state->completion_trigger_moby_index << 8) + (*(int *)&D_L12_0015FFD8_gp))) ->state < 0) { if (D_L12_0015F5C4_macro == 2) { - if (hoven_turret_state->b1 != 0) { + if (hoven_turret_state->manipulator_attached != 0) { detach_manipulator(moby, hoven_turret_state); } if (moby->prev_seq != 0) { @@ -372,34 +372,34 @@ void hoven_turret_update(struct Moby *moby) { } joy[1] = y; target_yaw_step = hoven_turret_yaw_input_rate * 0.017453292f * D_0015ED6C_gp * -joy[0]; - if ((hoven_turret_state->f7C >= 0.0f && hoven_turret_state->f7C < target_yaw_step) || - (hoven_turret_state->f7C <= 0.0f && target_yaw_step < hoven_turret_state->f7C)) { - approach_value(&hoven_turret_state->f7C, + if ((hoven_turret_state->yaw_step >= 0.0f && hoven_turret_state->yaw_step < target_yaw_step) || + (hoven_turret_state->yaw_step <= 0.0f && target_yaw_step < hoven_turret_state->yaw_step)) { + approach_value(&hoven_turret_state->yaw_step, target_yaw_step, hoven_turret_yaw_acceleration_rate * 0.017453292f * frame_time_sq_macro); } else { - approach_value(&hoven_turret_state->f7C, + approach_value(&hoven_turret_state->yaw_step, target_yaw_step, hoven_turret_yaw_braking_rate * 0.017453292f * frame_time_sq_macro); } - moby->rot.z = fast_add_rotations(moby->rot.z, hoven_turret_state->f7C); + moby->rot.z = fast_add_rotations(moby->rot.z, hoven_turret_state->yaw_step); target_pitch_step = -(hoven_turret_pitch_input_rate * 0.017453292f * D_0015ED6C_gp) * -joy[1]; - if ((hoven_turret_state->f78 >= 0.0f && hoven_turret_state->f78 < target_pitch_step) || - (hoven_turret_state->f78 <= 0.0f && target_pitch_step < hoven_turret_state->f78)) { - approach_value(&hoven_turret_state->f78, + if ((hoven_turret_state->pitch_step >= 0.0f && hoven_turret_state->pitch_step < target_pitch_step) || + (hoven_turret_state->pitch_step <= 0.0f && target_pitch_step < hoven_turret_state->pitch_step)) { + approach_value(&hoven_turret_state->pitch_step, target_pitch_step, hoven_turret_pitch_acceleration_rate * 0.017453292f * frame_time_sq_macro); } else { - approach_value(&hoven_turret_state->f78, + approach_value(&hoven_turret_state->pitch_step, target_pitch_step, hoven_turret_pitch_braking_rate * 0.017453292f * frame_time_sq_macro); } hoven_turret_state->f74 = - fast_add_rotations(hoven_turret_state->f74, hoven_turret_state->f78); + fast_add_rotations(hoven_turret_state->f74, hoven_turret_state->pitch_step); if (hoven_turret_state->f74 > hoven_turret_pitch_max) { hoven_turret_state->f74 = hoven_turret_pitch_max; } @@ -417,18 +417,18 @@ void hoven_turret_update(struct Moby *moby) { float yaw; int i; - blend_moby_animation(moby, hoven_turret_state->f80 == 1 ? 4 : 3, 0, 1); + blend_moby_animation(moby, hoven_turret_state->muzzle_alternation_state == 1 ? 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->f80 == 1) { - hoven_turret_state->f80 = 0; + if (hoven_turret_state->muzzle_alternation_state == 1) { + hoven_turret_state->muzzle_alternation_state = 0; moby_point_position(moby, 2, muz); } else { moby_point_position(moby, 1, muz); - hoven_turret_state->f80 = 1; + hoven_turret_state->muzzle_alternation_state = 1; } fast_vec_add(muz, muz, firing_offset); fast_vec_add(muz, muz, firing_offset); From f3c1e54d6e8b36667fe3f2e73b7f41d8c8b2e6a7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:26:58 +0000 Subject: [PATCH 402/758] decomp: clarify names in jet_fighter_update i10C -> blarg_ship_list_index: Retail 00313a20-00313a24 passes pvars+0x10C to count_listed_blarg_ships_in_state_5; 00313a5c-00313a60 passes the same member to activate_listed_blarg_ship. Checked helper evidence request 3873b93710564bfbaa07326b96367f58, report SHA-256 77a835f0e9ed3f865a3297056d681775446e94a34049927b6379e0fd1c11aeab, proves it is an index: 0031a75c shifts the argument by 2, 0031a760-0031a774 adds D_L11_001AC240 and loads a halfword-list pointer. 0031a790-0031a7ac resolves list entries through the level moby array and filters oclass 0x527/state 5 before counting. Thus this is the moby-list index used for Blarg ship counting/activation, not a pointer or live count. i114 -> blarg_ship_activation_timer_frames: Retail 00313894-003138a4 initializes pvars+0x114 from scale_game_frames(0x708) on boarding. In flight, 00313a20-00313a44 checks the listed Blarg ship count against 5 minus +0xE8; 00313a4c-00313a54 decrements/tests +0x114 with fast_dec_timer before calling activate_listed_blarg_ship at 00313a5c. A successful activation resets the same member from scale_game_frames(0xF0) at 00313a6c-00313a74. The authoritative C agrees, proving an activation delay/repeat timer in frames. i80 -> shot_cooldown_frames: ShipVars_2838 member +0x80 is cleared on boarding by retail sw zero,0x80(s3) at 00313970 (s3=moby->pvars from 003132c0). In the authoritative C, update_ship_shot_firing_and_reticle decrements ship_vars+0x80 with fast_dec_timer, gates spawn_fighter_jet_missile on its expiry and firing input, and resets that same slot to l11_ship_shot_cooldown_frames after firing. These matching pvars accesses prove the shot cooldown role. i84 -> rocket_cooldown_frames: ShipVars_2838 member +0x84 is cleared on boarding by retail sw zero,0x84(s3) at 0031396c. Authoritative C try_fire_ship_projectile decrements ship_vars+0x84 with fast_dec_timer and gates firing on expiry/input; only a successful spawn_ship_rocket decrements hero.ship_ammo and resets +0x84 to l11_ship_projectile_cooldown_frames. This distinguishes the rocket cooldown from the +0x80 shot cooldown. --- src/overlays/l11/mobys/jet_fighter.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l11/mobys/jet_fighter.c b/src/overlays/l11/mobys/jet_fighter.c index e4466e2a84..b4d9a5690e 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -721,8 +721,8 @@ typedef struct { float f6C; float f70; char pad74[0xC]; - int i80; - int i84; + int shot_cooldown_frames; + int rocket_cooldown_frames; char pad88[8]; float f90, f94, f98, f9C; float fA0, fA4, fA8, fAC; @@ -740,9 +740,9 @@ typedef struct { int exit_path; int exit_path2; char pad104[8]; - int i10C; + int blarg_ship_list_index; char pad110[4]; - int i114; + int blarg_ship_activation_timer_frames; int i118; char pad11C[0x10]; short voice; @@ -1406,7 +1406,7 @@ void jet_fighter_update(struct Moby *moby) { clear_u64_value(&ship_vars->f30); clear_u64_value(&ship_vars->f20); ship_vars->f38 = ship_vars->f28 = moby->rot.z; - ship_vars->i114 = scale_game_frames(0x708); + ship_vars->blarg_ship_activation_timer_frames = scale_game_frames(0x708); if (help_records[0x55].count == 0) { help_request(0x2AFC, 0x55); } @@ -1432,8 +1432,8 @@ void jet_fighter_update(struct Moby *moby) { ship_vars->speed = jet_fighter_initial_flight_speed_gp; ship_vars->f6C = 0.0f; ship_vars->f70 = 0.0f; - ship_vars->i84 = 0; - ship_vars->i80 = 0; + ship_vars->rocket_cooldown_frames = 0; + ship_vars->shot_cooldown_frames = 0; ship_vars->fD4 = 0.0f; ship_vars->fD8 = 0.0f; moby->draw_dist = 0xFF; @@ -1454,11 +1454,11 @@ void jet_fighter_update(struct Moby *moby) { D_L11_0015F608 = 2; update_player_ship_flight(moby, ship_vars); { - int alive = count_listed_blarg_ships_in_state_5(ship_vars->i10C); + int alive = count_listed_blarg_ships_in_state_5(ship_vars->blarg_ship_list_index); if (ship_vars->sEA != 0 && alive < 5 - ship_vars->sE8 && - fast_dec_timer(&ship_vars->i114) && - activate_listed_blarg_ship(ship_vars->i10C)) { - ship_vars->i114 = scale_game_frames(0xF0); + fast_dec_timer(&ship_vars->blarg_ship_activation_timer_frames) && + activate_listed_blarg_ship(ship_vars->blarg_ship_list_index)) { + ship_vars->blarg_ship_activation_timer_frames = scale_game_frames(0xF0); } } if (ship_vars->sE8 <= 0) { From 117a1f3d2c4c1efec83d7f5ebcdd74cec9361bea Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:29:09 +0000 Subject: [PATCH 403/758] decomp: clarify names in FUN_L00_002dc9f0 domain_0_value_254 -> MOBY_STATE_MARKED_FOR_REMOVAL: Retail 0x002dca34-0x002dca44 reads this function's Moby state byte at +0x20 and rejects 0xFE/0xFD. Checked finalizer 0x002dc938 passes the same moby to fallback removal helper 0x0024eb68 at 0x002dc9d4. That helper selects 0xFE at 0x0024eb8c and stores it to moby+0x20 at 0x0024eb90, with removal deadline frame+2 at +0x38. Supplied finalize_suck_cannon_moby source names this fallback mark_moby_for_removal, and supplied horny_toad_update uses established MOBY_STATE_MARKED_FOR_REMOVAL alongside 0xFD in the same Moby validity guard. Thus reuse the established Moby lifecycle name for 254; this is unrelated to suction record +0x68 state. --- src/overlays/shared/weapons/suckcannon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 443e0de4e5..45a47a7618 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -2325,10 +2325,13 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { SUCK_RECORD_STATE_STORED = 4, SUCK_RECORD_STATE_ROLLING_PROJECTILE = 6 }; + enum { + MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE + }; Frame_2DDEA0 suction_and_projectile_scratch; R_2DDEA0 *suction_and_projectile_record; - if (moby == 0 || moby->state == 0xFE || moby->state == 0xFD) + if (moby == 0 || moby->state == MOBY_STATE_MARKED_FOR_REMOVAL || moby->state == 0xFD) return 0; suction_and_projectile_record = func_L00_002DCD40_2DDEA0(moby); if (suction_and_projectile_record != 0) { From 5a27b6035d8b6e423b8529004026da1d851157b7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:31:12 +0000 Subject: [PATCH 404/758] decomp: clarify names in robot_dog_update f230 -> target_engagement_radius: Retail 002c5bec passes private float +0x230 to target selection. 002c5edc-002c5ef4 activates on target distance from home below it, while 002c6220-002c6238 exits chase when that distance exceeds it. This proves the target engagement radius. f274 -> path_activation_distance: Retail 002c5e60-002c5e78 compares fast_vec_dist(selected_target,moby position) against private float +0x274; the subsequent height gate and state=5 store at 002c5eb0 prove this is the proximity threshold for path activation. i23C -> chase_timer: Retail 002c5fb8-002c5fe0 and 002c6064-002c608c initialize private +0x23C with a scaled random 30..90 frame count upon chase entry. Chase decrements and refreshes it at 002c6140-002c6178; no further gameplay effect is claimed. i240 -> extended_engagement_radius_timer: Retail initialization 002c5c88 clears private +0x240. Checked hit helper 002c6a70-002c6a98 stores scale_game_frames(240), decrements that timer, and selects +0x230 as either base radius +0x22C or twice that radius. Request 993c46a6a4d14c89b7f4365bdf157d92 confirms the timer controls the engagement-radius extension; no timer return polarity is inferred. i244 -> melee_cooldown_timer: Retail 002c5c14-002c5c18 decrements private +0x244 every update. Melee completion stores scale_game_frames(120) there at 002c668c-002c6698; return-home tests it at 002c6778 before allowing the range-gated melee reentry at 002c6784-002c6804. i248 -> linked_partner_index: Retail 002c5f74-002c5fb0 and 002c63a8-002c63e4 load private +0x248, test -1, multiply by 0x100 and add the moby base to resolve partner_moby; FD/FE and can_release_linked_robot_dog checks gate chase entry. i270 -> activation_path_index: Retail 002c5de4-002c5e28 indexes l03_paths with private +0x270, copies the first node into the moby position and establishes yaw from the next node. 002c6274-002c62a0 selects the same path for following; completion clears it to -1 at 002c6328. i278 -> path_target_node_index: Retail 002c62c0-002c62f0 raises private +0x278 to the path helper's segment output, then computes path + 0x10 + index*0x10 as the movement target. 002c6300-002c631c bounds it by path node count minus one and advances it. i27C -> activation_clip_volume_id: Retail 002c5e4c-002c5e58 loads private +0x27C as a1 with selected_target at a0 for is_point_inside_clip_volume; nonzero activates ROBOT_DOG_FOLLOW_PATH. Bound source confirms this field is the clip-volume selector, not a position. m110 -> animation_state: Retail 002c69e8-002c69f0 passes private +0x110 to established trooper_anim_finish. The bound source hit-reaction function also passes the same +0x110 region to trooper_anim_update after selecting death fall, proving animation-state storage. Checked hit helper 002c6c00-002c6c08 also passes +0x110 to trooper_anim_update, confirming the same storage binding. m120 -> knockback_motion_state: Retail 002c6828-002c6834 and 002c6898-002c68ac pass private +0x120 to step_moby_motion in fall recovery and death fall. Bound source update_robot_dog_hit_reaction also passes this same region to trooper_set_knockback and trooper_start_knockback. Checked helper 002c6b1c, 002c6b6c-002c6b9c and 002c6bdc-002c6bec resolves this same region and supplies it to knockback configuration/start, confirming the motion role. --- src/overlays/l03/mobys/robot_dog.c | 90 +++++++++++++++--------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/overlays/l03/mobys/robot_dog.c b/src/overlays/l03/mobys/robot_dog.c index c14eee19d5..1a43b5a0a7 100644 --- a/src/overlays/l03/mobys/robot_dog.c +++ b/src/overlays/l03/mobys/robot_dog.c @@ -78,8 +78,8 @@ typedef struct { char pCA[6]; void *pD0; char pD4[0x3C]; - char m110[0x10]; - char m120[0x60]; + char animation_state[0x10]; + char knockback_motion_state[0x60]; int i180; char p184[4]; float f188; @@ -97,22 +97,22 @@ typedef struct { float home[4]; char p210[0x10]; float v220[4]; - float f230; + float target_engagement_radius; float f234; char p238[4]; - int i23C; - int i240; - int i244; - int i248; + int chase_timer; + int extended_engagement_radius_timer; + int melee_cooldown_timer; + int linked_partner_index; char p24C[0x14]; int i260; float f264; char p268[4]; int i26C; - int i270; - float f274; - int i278; - int i27C; + int activation_path_index; + float path_activation_distance; + int path_target_node_index; + int activation_clip_volume_id; char m280[0x10]; } Data2c5bb8; @@ -169,10 +169,10 @@ void robot_dog_update(char *moby) { float initialization_multiplier_or_desired_heading; robot_dog_state = ((Data2c5bb8 *)MOBY(moby)->pvars); - select_moby_target_with_hero_fallback(moby, (char *)&selected_target, robot_dog_state->f230); + select_moby_target_with_hero_fallback(moby, (char *)&selected_target, robot_dog_state->target_engagement_radius); FUN_L00_00263ac8_c5bb8(moby, 0, robot_dog_state->m280, 2.1f); update_robot_dog_hit_reaction((struct Moby *)moby); - fast_dec_timer(&robot_dog_state->i244); + fast_dec_timer(&robot_dog_state->melee_cooldown_timer); switch (((unsigned char *)moby)[0x20]) { case ROBOT_DOG_INITIALIZE: MOBY(moby)->flags |= 0x1000; @@ -181,7 +181,7 @@ void robot_dog_update(char *moby) { MOBY(moby)->shadow_range = 0x18; robot_dog_state->f20 = 1.0f; robot_dog_state->b29 = 0; - robot_dog_state->i240 = 0; + robot_dog_state->extended_engagement_radius_timer = 0; robot_dog_state->s24 = 1; FUN_L01_0026d930((char *)&robot_dog_state->i180, robot_dog_state->home); robot_dog_state->f1BC = frame_time_sq * 6.2831855f; @@ -194,7 +194,7 @@ void robot_dog_update(char *moby) { robot_dog_state->f1A8 = 2.0954423f; initialization_multiplier_or_desired_heading = FUN_L04_001f1978(6.0f); robot_dog_state->f264 = 1.0f; - robot_dog_state->i244 = 0; + robot_dog_state->melee_cooldown_timer = 0; robot_dog_state->i26C = 0; robot_dog_state->i260 = 0; robot_dog_state->f1AC = @@ -205,7 +205,7 @@ void robot_dog_update(char *moby) { MOBY(moby)->flags |= 0x8000; } robot_dog_state->pD0 = &D_L03_001618D0; - if (robot_dog_state->i248 != -1 && robot_dog_state->i270 == -1) { + if (robot_dog_state->linked_partner_index != -1 && robot_dog_state->activation_path_index == -1) { if (((unsigned char *)moby)[0x53] != 0) { blend_moby_animation(moby, 0, 0, 0); } @@ -215,25 +215,25 @@ void robot_dog_update(char *moby) { } break; case ROBOT_DOG_WAIT_FOR_ACTIVATION: - if (robot_dog_state->i270 != -1) { - activation_path = ((char *)l03_paths[robot_dog_state->i270]); + if (robot_dog_state->activation_path_index != -1) { + activation_path = ((char *)l03_paths[robot_dog_state->activation_path_index]); *(OvlQuad *)&MOBY(moby)->pos = *(OvlQuad *)(activation_path + 0x10); MOBY(moby)->rot.z = fast_arc_tan( *(float *)(activation_path + 0x20) - *(float *)(activation_path + 0x10), *(float *)(activation_path + 0x24) - *(float *)(activation_path + 0x14)); if ((random_integer_below(14) == 0 && is_point_inside_clip_volume_cf(((unsigned char *)moby)[0x21])) || - is_point_inside_clip_volume(&selected_target, robot_dog_state->i27C) || - (fast_vec_dist(&selected_target, moby + 0x10) < robot_dog_state->f274 && + is_point_inside_clip_volume(&selected_target, robot_dog_state->activation_clip_volume_id) || + (fast_vec_dist(&selected_target, moby + 0x10) < robot_dog_state->path_activation_distance && absolute_float(selected_target.pos[2] - MOBY(moby)->pos.z) < 4.0f)) { - robot_dog_state->i278 = 0; + robot_dog_state->path_target_node_index = 0; MOBY(moby)->state = ROBOT_DOG_FOLLOW_PATH; if (((unsigned char *)moby)[0x53] != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(10)); } } } else if (random_integer_below(14) == 0 && - fast_vec_dist(&selected_target, robot_dog_state->home) < robot_dog_state->f230 && + fast_vec_dist(&selected_target, robot_dog_state->home) < robot_dog_state->target_engagement_radius && absolute_float(selected_target.pos[2] - MOBY(moby)->pos.z) < 3.0f) { MOBY(moby)->state = ROBOT_DOG_TURN_TO_TARGET; if (((unsigned char *)moby)[0x53] != 2) { @@ -244,13 +244,13 @@ void robot_dog_update(char *moby) { break; case ROBOT_DOG_WAIT_FOR_PARTNER_RELEASE: if (random_integer_below(14) == 0) { - partner_moby_index = robot_dog_state->i248; + partner_moby_index = robot_dog_state->linked_partner_index; if (partner_moby_index == -1 || (partner_moby = D_L03_0015FFD8_c5bb8 + (partner_moby_index << 8)) == 0 || ((unsigned char *)partner_moby)[0x20] == 0xFE || ((unsigned char *)partner_moby)[0x20] == 0xFD || can_release_linked_robot_dog((struct Moby *)partner_moby)) { - robot_dog_state->i23C = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robot_dog_state->chase_timer = scale_game_frames((int)random_float_between(30.0f, 90.0f)); MOBY(moby)->state = ROBOT_DOG_CHASE_TARGET; if (((unsigned char *)moby)[0x53] != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(10)); @@ -268,7 +268,7 @@ void robot_dog_update(char *moby) { 0.3f, 0.1f); if (((unsigned char *)moby)[0x70] & 2) { - robot_dog_state->i23C = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robot_dog_state->chase_timer = scale_game_frames((int)random_float_between(30.0f, 90.0f)); MOBY(moby)->state = ROBOT_DOG_CHASE_TARGET; if (((unsigned char *)moby)[0x53] != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(10)); @@ -289,8 +289,8 @@ void robot_dog_update(char *moby) { forward_vector_or_path_point[2] = 0.0f; move_moby_with_ground_and_collision_checks( moby, &robot_dog_state->i180, forward_vector_or_path_point, push, 1.0f); - if (fast_dec_timer(&robot_dog_state->i23C)) { - robot_dog_state->i23C = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + if (fast_dec_timer(&robot_dog_state->chase_timer)) { + robot_dog_state->chase_timer = scale_game_frames((int)random_float_between(30.0f, 90.0f)); } target_distance = vector_distance_xy(moby + 0x10, &selected_target); if (target_distance < robot_dog_state->f234 * frame_time * 0.5f * FUN_L04_001f1978(40.0f) + @@ -300,32 +300,32 @@ void robot_dog_update(char *moby) { if (((unsigned char *)moby)[0x53] != 5) { blend_moby_animation(moby, 5, 0, truncate_float_to_s32(FUN_L04_001f1978(10.0f))); } - } else if (robot_dog_state->f230 < fast_vec_dist(&selected_target, robot_dog_state->home) || + } else if (robot_dog_state->target_engagement_radius < fast_vec_dist(&selected_target, robot_dog_state->home) || absolute_float(selected_target.pos[2] - MOBY(moby)->pos.z) > 3.0f) { MOBY(moby)->state = ROBOT_DOG_RETURN_HOME; } break; case ROBOT_DOG_FOLLOW_PATH: - path = (int *)l03_paths[robot_dog_state->i270]; + path = (int *)l03_paths[robot_dog_state->activation_path_index]; FUN_L00_0025df68( path, moby + 0x10, forward_vector_or_path_point, &seg, &frac, 0, 999.0f, 5.0f, 0.0f); - if (robot_dog_state->i278 < seg) { - robot_dog_state->i278 = seg; + if (robot_dog_state->path_target_node_index < seg) { + robot_dog_state->path_target_node_index = seg; } if (step_mover_2e3f20(moby, (char *)&robot_dog_state->i180, - (char *)path + (robot_dog_state->i278 * 0x10 + 0x10), + (char *)path + (robot_dog_state->path_target_node_index * 0x10 + 0x10), (char *)robot_dog_state->v40) & 0x14) { - if (robot_dog_state->i278 < *path - 1) { - robot_dog_state->i278++; + if (robot_dog_state->path_target_node_index < *path - 1) { + robot_dog_state->path_target_node_index++; } else { - robot_dog_state->i270 = -1; + robot_dog_state->activation_path_index = -1; MOBY(moby)->state = ROBOT_DOG_WAIT_FOR_ACTIVATION; if (((unsigned char *)moby)[0x53] != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } - if (robot_dog_state->i248 != -1) { + if (robot_dog_state->linked_partner_index != -1) { if (((unsigned char *)moby)[0x53] != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(10)); } @@ -334,14 +334,14 @@ void robot_dog_update(char *moby) { } } if (random_integer_below(14) == 0) { - partner_moby_index = robot_dog_state->i248; + partner_moby_index = robot_dog_state->linked_partner_index; if (partner_moby_index == -1 || (partner_moby = D_L03_0015FFD8_c5bb8 + (partner_moby_index << 8)) == 0 || ((unsigned char *)partner_moby)[0x20] == 0xFE || ((unsigned char *)partner_moby)[0x20] == 0xFD || can_release_linked_robot_dog((struct Moby *)partner_moby)) { - robot_dog_state->i270 = -1; - robot_dog_state->i23C = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robot_dog_state->activation_path_index = -1; + robot_dog_state->chase_timer = scale_game_frames((int)random_float_between(30.0f, 90.0f)); MOBY(moby)->state = ROBOT_DOG_CHASE_TARGET; if (((unsigned char *)moby)[0x53] != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(10)); @@ -387,7 +387,7 @@ void robot_dog_update(char *moby) { if (((unsigned char *)moby)[0x53] != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(3)); } - robot_dog_state->i244 = scale_game_frames(120); + robot_dog_state->melee_cooldown_timer = scale_game_frames(120); } break; case ROBOT_DOG_RETURN_HOME: @@ -410,7 +410,7 @@ void robot_dog_update(char *moby) { if (((unsigned char *)moby)[0x53] != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(3)); } - } else if (robot_dog_state->i244 == 0) { + } else if (robot_dog_state->melee_cooldown_timer == 0) { target_distance = vector_distance_xy(moby + 0x10, &selected_target); if (target_distance < robot_dog_state->f234 * frame_time * 0.5f * FUN_L04_001f1978(40.0f) + @@ -424,7 +424,7 @@ void robot_dog_update(char *moby) { } break; case ROBOT_DOG_FALL_RECOVERY: - if (step_moby_motion(moby, robot_dog_state->m120) & 0x60) { + if (step_moby_motion(moby, robot_dog_state->knockback_motion_state) & 0x60) { MOBY(moby)->state = ROBOT_DOG_CHASE_TARGET; if (((unsigned char *)moby)[0x53] != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(10)); @@ -433,14 +433,14 @@ void robot_dog_update(char *moby) { } goto low; case ROBOT_DOG_WAIT_TO_REINITIALIZE: - if (FUN_L00_002dc9f0(moby, robot_dog_state->m120)) { + if (FUN_L00_002dc9f0(moby, robot_dog_state->knockback_motion_state)) { MOBY(moby)->state = ROBOT_DOG_INITIALIZE; robot_dog_state->sC8 = 0; } break; case ROBOT_DOG_DEATH_FALL: MOBY(moby)->flags &= 0xEFFF; - if (step_moby_motion(moby, robot_dog_state->m120) & 0x60) { + if (step_moby_motion(moby, robot_dog_state->knockback_motion_state) & 0x60) { clear_u64_value(forward_vector_or_path_point); cart_burst(moby, moby + 0x10, -1, 0.5f, 13.0f); spawn_debris_c5bb8(moby, @@ -479,7 +479,7 @@ void robot_dog_update(char *moby) { if (((unsigned char *)moby)[0x31] != 0 && fast_vec_dist(moby + 0x10, D_L03_00166EC0) < 32.0f) { FUN_L00_0025a120(moby); } - trooper_anim_finish(moby, robot_dog_state->m110); + trooper_anim_finish(moby, robot_dog_state->animation_state); ((unsigned char *)moby)[0xBC] = 0; } /* Applies damage reaction, knockback parameters and animation state. */ From a606cecd234b787c26bc7e15f9c01ac67c4b2eb3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:31:16 +0000 Subject: [PATCH 405/758] decomp: clarify names in blarg_bombthrower_update i128 -> throw_delay_timer: Retail initializes pvars+0x128 from scale_game_frames(180) at 0x002db064..0x002db070, resets it to scaled 120 on entry to WAIT_TO_THROW at 0x002db2bc..0x002db2c4, and to scaled 180 after successful bomb creation at 0x002db7d0..0x002db7dc. WAIT_TO_THROW passes its address to fast_dec_timer at 0x002db368..0x002db370; completion permits the camera-gated transition toward throwing. This int is the conditional throw-delay countdown. i134 -> waypoint_reselection_timer: APPROACH_WAYPOINT passes pvars+0x134 to fast_dec_timer at 0x002db1b8..0x002db1c0; expiration calls select_blarg_bombthrower_waypoint at 0x002db1cc, preserves the old waypoint on null, and transfers command ownership. 0x002db818..0x002db824 resets this int to scale_game_frames(240). It is also reset on other waypoint reselection and return-to-approach paths at 0x002db180..0x002db194 and 0x002db8c8..0x002db8d4, proving a waypoint-reselection countdown. p124 -> thrown_bomb: In THROW_BOMB, retail 0x002db77c calls spawn_bomb_with_velocity (0x002d22e0), whose supplied C creates class 0xF8 using the launch point and velocity. Its returned Moby pointer is stored at pvars+0x124 in 0x002db788; 0x002db7bc..0x002db7d4 reload that same field to set the bomb state and command. Thus this struct Moby* field holds the thrown bomb. --- src/overlays/l08/mobys/blarg_bombthrower.c | 34 +++++++++++----------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/overlays/l08/mobys/blarg_bombthrower.c b/src/overlays/l08/mobys/blarg_bombthrower.c index f3d4fd4395..7789941e02 100644 --- a/src/overlays/l08/mobys/blarg_bombthrower.c +++ b/src/overlays/l08/mobys/blarg_bombthrower.c @@ -81,11 +81,11 @@ typedef struct { float f10C, f110, f114; char pad118[8]; struct Moby *waypoint; - struct Moby *p124; - int i128; + struct Moby *thrown_bomb; + int throw_delay_timer; char blk12C[4]; short s130, s132; - int i134; + int waypoint_reselection_timer; char pad138[0x28]; char blk160[0x10]; } Data_DBF68; @@ -323,12 +323,12 @@ void blarg_bombthrower_update(struct Moby *moby) { clear_u64_value(bombthrower_vars->v40); bombthrower_vars->waypoint = (struct Moby *)FUN_L08_002daa10_c((char *)moby); bombthrower_vars->waypoint->command = 1; - bombthrower_vars->i128 = scale_game_frames(0xB4); + bombthrower_vars->throw_delay_timer = scale_game_frames(0xB4); if (moby->prev_seq != 4) { FUN_00212f90(moby, 4, 0, 0); } moby->state = BOMBTHROWER_STATE_APPROACH_WAYPOINT; - bombthrower_vars->i134 = scale_game_frames(0xF0); + bombthrower_vars->waypoint_reselection_timer = scale_game_frames(0xF0); break; case BOMBTHROWER_STATE_APPROACH_WAYPOINT: step_mover_2e3f20((char *)moby, @@ -347,7 +347,7 @@ void blarg_bombthrower_update(struct Moby *moby) { moby->state = BOMBTHROWER_STATE_MOVE_ONTO_WAYPOINT; break; } - bombthrower_vars->i134 = scale_game_frames(0xF0); + bombthrower_vars->waypoint_reselection_timer = scale_game_frames(0xF0); { struct Moby *old_waypoint = bombthrower_vars->waypoint; struct Moby *next_waypoint = (struct Moby *)FUN_L08_002daa10_c((char *)moby); @@ -361,7 +361,7 @@ void blarg_bombthrower_update(struct Moby *moby) { break; } } - if (fast_dec_timer(&bombthrower_vars->i134) != 0) { + if (fast_dec_timer(&bombthrower_vars->waypoint_reselection_timer) != 0) { old_waypoint = bombthrower_vars->waypoint; if ((bombthrower_vars->waypoint = (struct Moby *)FUN_L08_002daa10_c((char *)moby)) == 0) { @@ -369,7 +369,7 @@ void blarg_bombthrower_update(struct Moby *moby) { } old_waypoint->command = 0; bombthrower_vars->waypoint->command = 1; - bombthrower_vars->i134 = scale_game_frames(0xF0); + bombthrower_vars->waypoint_reselection_timer = scale_game_frames(0xF0); } break; case BOMBTHROWER_STATE_MOVE_ONTO_WAYPOINT: @@ -387,7 +387,7 @@ void blarg_bombthrower_update(struct Moby *moby) { moby->state = BOMBTHROWER_STATE_WAIT_TO_THROW; moby->flags &= 0xEFFF; moby->rot.z = fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y); - bombthrower_vars->i128 = scale_game_frames(0x78); + bombthrower_vars->throw_delay_timer = scale_game_frames(0x78); moby->collision = 0; } break; @@ -400,7 +400,7 @@ void blarg_bombthrower_update(struct Moby *moby) { 0.3f, 0.2f); if (target_distance_xy < 20.0f && 8.0f < target_distance_xy && - fast_dec_timer(&bombthrower_vars->i128) != 0) { + fast_dec_timer(&bombthrower_vars->throw_delay_timer) != 0) { LevelCamera *cam = &l08_camera; if (fast_difference_between_rotations( cam->yaw, @@ -450,7 +450,7 @@ void blarg_bombthrower_update(struct Moby *moby) { FUN_00212f90(moby, 4, 0, scale_game_frames(7)); } moby->state = BOMBTHROWER_STATE_APPROACH_WAYPOINT; - bombthrower_vars->i134 = scale_game_frames(0xF0); + bombthrower_vars->waypoint_reselection_timer = scale_game_frames(0xF0); } else { if (moby->prev_seq != 3) { FUN_00212f90(moby, 3, 0, scale_game_frames(6)); @@ -488,15 +488,15 @@ void blarg_bombthrower_update(struct Moby *moby) { FUN_L00_0025abf0(point, aim, &bomb_flight_time, time, -(frame_time_sq * 15.0f)); spawned_bomb_moby = spawn_bomb_with_velocity((int)moby, (char *)point, (char *)velocity); - bombthrower_vars->p124 = (struct Moby *)spawned_bomb_moby; + bombthrower_vars->thrown_bomb = (struct Moby *)spawned_bomb_moby; if (spawned_bomb_moby != 0) { char *next_vars = *(char **)(spawned_bomb_moby + 0x78); *(int *)(next_vars + 0x20) = scale_game_frames(0xB4); *(short *)(next_vars + 0xC) = scale_game_frames(10); *(short *)(next_vars + 0xE) = scale_game_frames(10); - bombthrower_vars->p124->state = 1; - bombthrower_vars->p124->command |= 3; - bombthrower_vars->i128 = scale_game_frames(0xB4); + bombthrower_vars->thrown_bomb->state = 1; + bombthrower_vars->thrown_bomb->command |= 3; + bombthrower_vars->throw_delay_timer = scale_game_frames(0xB4); } break; } @@ -505,7 +505,7 @@ void blarg_bombthrower_update(struct Moby *moby) { if (moby->prev_seq != 4) { FUN_00212f90(moby, 4, 0, 3); } - bombthrower_vars->i134 = scale_game_frames(0xF0); + bombthrower_vars->waypoint_reselection_timer = scale_game_frames(0xF0); } break; case BOMBTHROWER_STATE_WAIT_FOR_FALL_RECOVERY: @@ -532,7 +532,7 @@ void blarg_bombthrower_update(struct Moby *moby) { FUN_00212f90(moby, 4, 0, 10); } moby->state = BOMBTHROWER_STATE_APPROACH_WAYPOINT; - bombthrower_vars->i134 = scale_game_frames(0xF0); + bombthrower_vars->waypoint_reselection_timer = scale_game_frames(0xF0); } if (moby->pos.z < 5.0f) { mark_moby_for_removal(moby); From 287540792fe117e2147de847911b76814f746104 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:33:19 +0000 Subject: [PATCH 406/758] decomp: clarify names in robot_dog_update f1EC -> approach_movement_speed: Vars1382 float f1EC receives random_float_between(frame_time*7.2f,frame_time*8.7f): retail 002eed50-002eed68. In APPROACH_TARGET, 002ef43c-002ef448 passes target position pvars+0x180 and float pvars+0x1ec to move_robot_dog_toward_position. Prepared checked helper evidence cf77e87384c04855982d4d3c691b793c: 002efd68 preserves that float in f20, 002efde0-002efdf4 passes it as approach_value target for current speed pvars+0x1d8, and 002efe00-002efe48 multiplies that speed by yaw cosine/sine to construct XY displacement. This proves requested approach movement speed, distinct from current speed. i1E8 -> saved_path_index: Vars1382 int i1E8 is tested against -1 in initialization; original retail Ghidra and 002eed94-002eedac show it retains its value unless unset, in which case it saves pvars+0x1d0 (source path). The copied source is proven a path-table index by 002ef228-002ef24c: load pvars+0x1d0, shift left two, index D_L17_001B0DB0, and pass that path's vertices/count to point_in_path_xy. Thus this field conditionally saves the path index; no restoration behavior is claimed. --- src/overlays/l17/mobys/robot_dog.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l17/mobys/robot_dog.c b/src/overlays/l17/mobys/robot_dog.c index c4bbac2128..0c181c6e77 100644 --- a/src/overlays/l17/mobys/robot_dog.c +++ b/src/overlays/l17/mobys/robot_dog.c @@ -100,8 +100,8 @@ typedef struct { unsigned char mode; unsigned char b1E5; char pad1E6[2]; - int i1E8; - float f1EC; + int saved_path_index; + float approach_movement_speed; OvlQuad home; char pad200[0x230 - 0x200]; char a230[0x2B0 - 0x230]; @@ -207,7 +207,7 @@ void robot_dog_update(unsigned char *robot_dog_moby) { robot_dog_vars->s24 = 1; robot_dog_vars->f20 = 1.0f; robot_dog_vars->pD0 = &D_L17_00162200; - robot_dog_vars->f1EC = random_float_between(frame_time * 7.2f, frame_time * 8.7f); + robot_dog_vars->approach_movement_speed = random_float_between(frame_time * 7.2f, frame_time * 8.7f); robot_dog_moby[0x20] = 1; blend_moby_animation( robot_dog_moby, @@ -215,8 +215,8 @@ void robot_dog_update(unsigned char *robot_dog_moby) { random_integer_below( *(unsigned char *)(*(char **)(MOBY(robot_dog_moby)->pclass->seqs) + 0x10)), 0); - if (robot_dog_vars->i1E8 == -1) { - robot_dog_vars->i1E8 = robot_dog_vars->path; + if (robot_dog_vars->saved_path_index == -1) { + robot_dog_vars->saved_path_index = robot_dog_vars->path; } break; case ROBOT_DOG_STATE_RECOVER_THEN_REINITIALIZE: @@ -411,7 +411,7 @@ void robot_dog_update(unsigned char *robot_dog_moby) { break; } case ROBOT_DOG_STATE_APPROACH_TARGET: - FUN_L17_002efd48_c((char *)robot_dog_moby, robot_dog_vars->v180, robot_dog_vars->f1EC); + FUN_L17_002efd48_c((char *)robot_dog_moby, robot_dog_vars->v180, robot_dog_vars->approach_movement_speed); MOBY(robot_dog_moby)->anim_speed = 1.8f; if (point_in_path_xy((&hero.motion.pos), ((int **)D_L17_001B0DB0)[robot_dog_vars->path] + 4, From eaaba733b39d9db4230eea374c34928543c495a1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:39:48 +0000 Subject: [PATCH 407/758] decomp: clarify names in giant_clank_missile_update f38 -> target_leading_enabled: Retail 0x0029d910 loads missile data+0x38 and 0x0029d914 skips the target-motion quadratic when zero. Nonzero computes current target point minus saved target point at 0x0029d91c-0x0029d924, updates the saved point at 0x0029d938-0x0029d93c, solves interception at 0x0029d940-0x0029da30 and scales target displacement by the accepted time for predicted aim at 0x0029da68-0x0029da84. With zero, intercept_time remains zero and direct target offset supplies aim. Original Ghidra puVar3[0xe] and bound C f38 agree; spawn C initializes this enable to 1 and clears it for target_aim_bounds[0xB]. f3C -> velocity_inheritance_timer: Retail 0x0029d794 passes missile data+0x3c to fast_dec_timer_s16 at 0x0029d7cc, then 0x0029d7d4-0x0029d7d8 loads/converts this signed short. Its remaining count becomes the numerator of the +0x3c/+0x3e ratio at 0x0029d7e8, passed to fast_vec_scale with D_0013F490 at 0x0029d7ec-0x0029d7f8. Original Ghidra puVar3+0xf and bound C agree. Supplied spawn C initializes both shorts to the same scale_game_frames(60) or scale_game_frames(1) inheritance count. f3E -> velocity_inheritance_duration_frames: Retail 0x0029d7dc loads the signed short at missile data+0x3e, converts it at 0x0029d7e0, and 0x0029d7e8 uses it as the denominator under the decremented +0x3c count. The resulting fraction scales D_0013F490 at 0x0029d7ec-0x0029d7f8. Original Ghidra explicit +0x3e load and bound C agree. Supplied spawn C initializes +0x3e and +0x3c together to the frame-scaled inheritance duration; update decrements only +0x3c, leaving +0x3e as the total frame duration. --- src/overlays/shared/vehicles/giant_clank_missile.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/vehicles/giant_clank_missile.c b/src/overlays/shared/vehicles/giant_clank_missile.c index 853cac0df2..bd6cc6cf3f 100644 --- a/src/overlays/shared/vehicles/giant_clank_missile.c +++ b/src/overlays/shared/vehicles/giant_clank_missile.c @@ -218,9 +218,9 @@ typedef struct { float yaw0; float pitch0; float speed_end; - int f38; - short f3C; - short f3E; + int target_leading_enabled; + short velocity_inheritance_timer; + short velocity_inheritance_duration_frames; } D_29E8A0; typedef struct M_29E8A0 { @@ -323,10 +323,10 @@ void giant_clank_missile_update(M_29E8A0 *missile_moby) { target_moby = missile_data->target; missile_data->speed = missile_data->speed + (missile_data->speed_end - missile_data->speed) / 10.0f * D_0015ED64; - fast_dec_timer_s16(&missile_data->f3C); + fast_dec_timer_s16(&missile_data->velocity_inheritance_timer); { - float velocity_inheritance_frames_remaining = convert_integer_to_float(missile_data->f3C); - float velocity_inheritance_frames_total = convert_integer_to_float(missile_data->f3E); + float velocity_inheritance_frames_remaining = convert_integer_to_float(missile_data->velocity_inheritance_timer); + float velocity_inheritance_frames_total = convert_integer_to_float(missile_data->velocity_inheritance_duration_frames); fast_vec_scale(up, ((char *)&D_0013F490), velocity_inheritance_frames_remaining / velocity_inheritance_frames_total); @@ -357,7 +357,7 @@ void giant_clank_missile_update(M_29E8A0 *missile_moby) { qcopy(tp, target_moby->pos); tp[2] = tp[2] + missile_data->zoff; fast_vec_sub(delta, tp, missile_moby->pos); - if (missile_data->f38 != 0) { + if (missile_data->target_leading_enabled != 0) { float intercept_quadratic_coefficient, intercept_linear_coefficient, c, intercept_time_plus_root, intercept_time_minus_root, discriminant_sqrt; fast_vec_sub(dv, tp, missile_data->v); From 37c6b6ed4bc5da649c2250f08006237eeb5d2674 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:41:50 +0000 Subject: [PATCH 408/758] decomp: clarify names in alien_snapper_update f1B4 -> activate_on_initialize: Retail 0x002f7fac loads pvars+0x1B4 and 0x002f7fb8 tests it: nonzero stores state 2 (ACTIVATION_SEQUENCE) at 0x002f7fc8, starts timer 1, and notifies the group; zero instead stores state 1 (WAIT_FOR_ACTIVATION) at 0x002f8000. The supplied C shows this conditional in INITIALIZE after hero/clip overrides, proving this activation-on-initialization flag. f80 -> gravity_step: Root 0x002f7f24-0x002f7f58 multiplies l06_alien_snapper_gravity by D_0015ED70 and stores float pvars+0x80. Root 0x002f8320 passes pvars+0x70 to checked helper 0x0026b4a8; helper 0x0026b4e4-0x0026b4f8 subtracts block+0x10 (this field) from block+8, the vertical component of the displacement added to Moby.pos at 0x0026b9dc-0x0026ba00. Root 0x002f829c-0x002f82b8 also passes its negation to ballistic setup. It is the per-motion-update gravity decrement. f84 -> motion_speed_adjustment_step: Root 0x002f7f40-0x002f7f5c initializes pvars+0x84 to 0.0005f. Checked helper receives pvars+0x70 at 0x002f8320; 0x0026b510-0x0026b548 obtains the motion-vector length, selects target speed zero or block+0x4C, then passes block+0x14 (pvars+0x84) as f13 to the established approach_value placement 0x0026a678. It rescales the motion vector to the adjusted length. This is the speed adjustment step, without assuming the target speed is always zero. f90 -> collision_radius_fixed: Root 0x002f7f0c-0x002f7f50 converts 768.0f to integer pvars+0x90. Motion helper receives block=pvars+0x70; 0x0026ba30-0x0026ba58 converts block+0x20 to float and scales it for the 0x0020a450 collision query. At 0x0026bb20-0x0026bb38 it converts the same integer, multiplies by f20=0x3A800000 (1/1024), and passes it as the scalar extent to collision helper 0x00208948 alongside the candidate position. Its scaled length also gates a collision_line sweep at 0x0026bad8-0x0026bb0c, proving a fixed-point collision radius. f94 -> motion_flags: Root initializes pvars+0x94 to 9 at 0x002f7f64 and changes it to 5 for the home-node jump at 0x002f82c8. The checked motion helper's block is pvars+0x70, so block+0x24 is this member: 0x0026b620 masks 0x10 to select motion-position ground probing, 0x0026b998-0x0026b9a4 masks 4 to bypass yaw steering, and 0x0026ba88-0x0026ba90 masks 0x20 in collision handling. Independent bit tests establish motion-control flags, not a single enum state. f98 -> collision_height_offset: Root 0x002f7f34-0x002f7f54 initializes pvars+0x98 to 0.75f. With helper block=pvars+0x70, 0x0026b574-0x0026b598 adds block+0x28 to copied Moby.pos.z before ground probing. At 0x0026b9e4-0x0026ba2c it adds the same offset to the start and candidate z coordinates used for collision queries; after collision position is copied back, 0x0026bb54-0x0026bb80 subtracts it from Moby.pos.z. This paired translation proves the collision height offset. --- src/overlays/l06/mobys/alien_snapper.c | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/l06/mobys/alien_snapper.c b/src/overlays/l06/mobys/alien_snapper.c index ba085d7542..a96c279245 100644 --- a/src/overlays/l06/mobys/alien_snapper.c +++ b/src/overlays/l06/mobys/alien_snapper.c @@ -93,13 +93,13 @@ typedef struct { u8 f5A; /* 0x5A */ u8 pad5B[0x15]; u8 f70[0x10]; /* 0x70 */ - f32 f80; /* 0x80 */ - f32 f84; /* 0x84 */ + f32 gravity_step; /* 0x80 */ + f32 motion_speed_adjustment_step; /* 0x84 */ f32 return_speed; /* 0x88 */ f32 f8C; /* 0x8C */ - s32 f90; /* 0x90 */ - s32 f94; /* 0x94 */ - f32 f98; /* 0x98 */ + s32 collision_radius_fixed; /* 0x90 */ + s32 motion_flags; /* 0x94 */ + f32 collision_height_offset; /* 0x98 */ u8 pad9C[0x11]; u8 fAD; /* 0xAD */ u8 padAE[0x22]; @@ -127,7 +127,7 @@ typedef struct { s32 timer; /* 0x1A8 */ s32 f1AC; /* 0x1AC */ s32 path; /* 0x1B0 */ - s32 f1B4; /* 0x1B4 */ + s32 activate_on_initialize; /* 0x1B4 */ s32 timer_max; /* 0x1B8 */ s32 node; /* 0x1BC */ s32 clip_volume; /* 0x1C0 */ @@ -317,12 +317,12 @@ void alien_snapper_update(Moby *moby) { snapper_behavior->movement = truncate_float_to_s32(D_L06_00161EB0 * 1024.0f); snapper_behavior->fD4 = D_L06_00161EB0; snapper_behavior->speed = snapper_behavior->base_speed * frame_time; - snapper_behavior->f90 = truncate_float_to_s32(768.0f); - snapper_behavior->f98 = 0.75f; - snapper_behavior->f80 = l06_alien_snapper_gravity * D_0015ED70; + snapper_behavior->collision_radius_fixed = truncate_float_to_s32(768.0f); + snapper_behavior->collision_height_offset = 0.75f; + snapper_behavior->gravity_step = l06_alien_snapper_gravity * D_0015ED70; snapper_behavior->fAD = 0; - snapper_behavior->f84 = 0.0005f; - snapper_behavior->f94 = 9; + snapper_behavior->motion_speed_adjustment_step = 0.0005f; + snapper_behavior->motion_flags = 9; snapper_behavior->f1C8 = random_angle_radians(); if (snapper_behavior->f1CC != 0) { moby->state = ALIEN_SNAPPER_STATE_FACE_HERO; @@ -331,7 +331,7 @@ void alien_snapper_update(Moby *moby) { } } else if (snapper_behavior->clip_volume >= 0) { moby->state = ALIEN_SNAPPER_STATE_WAIT_FOR_CLIP_TRIGGER; - } else if (snapper_behavior->f1B4 != 0) { + } else if (snapper_behavior->activate_on_initialize != 0) { moby->state = ALIEN_SNAPPER_STATE_ACTIVATION_SEQUENCE; snapper_behavior->timer = scale_game_frames(1); if (moby->prev_seq != 0) { @@ -415,8 +415,8 @@ void alien_snapper_update(Moby *moby) { &snapper_behavior->home, 0, snapper_behavior->return_speed, - -snapper_behavior->f80); - snapper_behavior->f94 = 5; + -snapper_behavior->gravity_step); + snapper_behavior->motion_flags = 5; snapper_behavior->fAD = 3; func_L00_0025D5B0_91A8(moby, snapper_behavior->f70, From 931e7b34a6f4340322f54926016537b1cde4852e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:44:51 +0000 Subject: [PATCH 409/758] decomp: clarify names in build_beam_and_arc_points unk46 -> second_target_hit_cooldown: WalloperBeam is loaded from beam_owner_moby->pvars into retail s6 at 002b954c. With second_target (+0x38) present, 002ba2a4..002ba2bc masks the halfwords +0x42 and +0x46 from the doubleword at +0x40 and skips the second-target hit when either is nonzero. After record_moby_hit(second_target) at 002ba344..002ba348, 002ba34c..002ba364 obtains second-target aim metadata and selects a delay of 5, or 1 when its short +4 equals 1. 002ba368..002ba370 calls scale_game_frames and stores the returned halfword at +0x46, exactly the C beam_state->unk46 assignment. This is the reloadable cooldown gating second-target hit recording, distinct from second_timer at +0x42. --- src/overlays/shared/weapons/tesla_claw_beam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/tesla_claw_beam.c b/src/overlays/shared/weapons/tesla_claw_beam.c index 5590931a28..a59ab2a278 100644 --- a/src/overlays/shared/weapons/tesla_claw_beam.c +++ b/src/overlays/shared/weapons/tesla_claw_beam.c @@ -37,7 +37,7 @@ typedef struct { short target_timer; short second_timer; short unk44; - short unk46; + short second_target_hit_cooldown; } WalloperBeam; typedef struct { @@ -1247,7 +1247,7 @@ void build_beam_and_arc_points(struct Moby *beam_owner_moby) { aim = (char *)get_moby_target_info(beam_state->second_target); if (aim && *(short *)(aim + 4) == 1) frames = 1; - beam_state->unk46 = scale_game_frames(frames); + beam_state->second_target_hit_cooldown = scale_game_frames(frames); } } for (i = 0; i < 4; i++) { From a345966e3e38427f22a85399276cf2f1bb8503a2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:47:00 +0000 Subject: [PATCH 410/758] decomp: clarify names in blarg_bombthrower_update i38 -> alternate_throw_trigger: Data_DBF68.i38 is the int at bombthrower pvars+0x38, with pvars retained in s3 from 0x002dac20. In WAIT_TO_THROW, retail 0x002db348/0x002db364/0x002db3c4 loads it when the normal distance/timer/camera gate does not reach the attack path. 0x002db3c8 rejects zero; 0x002db3d0..0x002db3e4 additionally requires target XY distance >0.5. A nonzero value then reaches 0x002db3ec..0x002db454, requesting waypoint/actor animations and entering MOVE_TO_THROW_POSITION/state 4. 0x002db958 clears this int at the normal update end. This proves a transient alternate trigger for the throw sequence without identifying its producer. --- src/overlays/l08/mobys/blarg_bombthrower.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l08/mobys/blarg_bombthrower.c b/src/overlays/l08/mobys/blarg_bombthrower.c index 7789941e02..2c7cacdbd9 100644 --- a/src/overlays/l08/mobys/blarg_bombthrower.c +++ b/src/overlays/l08/mobys/blarg_bombthrower.c @@ -52,7 +52,7 @@ typedef struct { char pad24[5]; unsigned char b29; char pad2A[0xE]; - int i38; + int alternate_throw_trigger; char pad3C[4]; float v40[4]; char pad50[8]; @@ -409,7 +409,7 @@ void blarg_bombthrower_update(struct Moby *moby) { goto attack; } } - if (bombthrower_vars->i38 == 0 || !(0.5f < target_distance_xy)) { + if (bombthrower_vars->alternate_throw_trigger == 0 || !(0.5f < target_distance_xy)) { break; } attack: @@ -553,5 +553,5 @@ void blarg_bombthrower_update(struct Moby *moby) { break; } trooper_anim_finish(moby, bombthrower_vars->anim); - bombthrower_vars->i38 = 0; + bombthrower_vars->alternate_throw_trigger = 0; } From fa37b479d7be43cb393aaea3bb4d7fab4b6df9d5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:47:03 +0000 Subject: [PATCH 411/758] decomp: clarify names in ground_melee_enemy_update f190 -> horizontal_movement_step: Retail 002e3204-002e3208 passes pvars+0x180 to move_w (source asm FUN_L00_00258b50); f190 is its control+0x10. Supplied move_moby_with_ground_and_collision_checks source increments f10, damps/clamps it, then multiplies cos/sin heading by f10 to form horizontal displacement. Assigned retail 002e32ec-002e32f8 reads pvars+0x190 after movement and compares it to frame_time before returning home. This proves the persistent current horizontal movement step. f1A4 -> horizontal_step_limit: Assigned retail 002e2d18-002e2d40 multiplies speed at pvars+0x204 by frame_time and stores pvars+0x1a4. Calls at 002e3204-002e3208 pass control base pvars+0x180 to move_w, source-bound to FUN_L00_00258b50; f1A4 is control+0x24. Supplied move_moby_with_ground_and_collision_checks source computes f24*f and clamps current horizontal step f10 to its positive/negative value before forming displacement. Thus this field supplies the horizontal step limit; possible additional probe-threshold use is not excluded. --- src/overlays/shared/enemies/ground_melee_enemy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/enemies/ground_melee_enemy.c b/src/overlays/shared/enemies/ground_melee_enemy.c index fdf2644bac..1bcb93fee2 100644 --- a/src/overlays/shared/enemies/ground_melee_enemy.c +++ b/src/overlays/shared/enemies/ground_melee_enemy.c @@ -84,11 +84,11 @@ typedef struct { char pad184[4]; float f188; float f18C; - float f190; + float horizontal_movement_step; char pad194[4]; float fall; char pad19C[8]; - float f1A4; + float horizontal_step_limit; char pad1A8[0x28]; V_2E39E0 home; char pad1E0[0x10]; @@ -346,7 +346,7 @@ void ground_melee_enemy_update(Moby *moby) { steer_init_2E39E0(&ground_enemy_vars->steer); ground_enemy_vars->steer = 0x38D; ground_enemy_vars->f188 = ground_enemy_vars->f18C = 2.0f; - ground_enemy_vars->f1A4 = ground_enemy_vars->speed * frame_time; + ground_enemy_vars->horizontal_step_limit = ground_enemy_vars->speed * frame_time; if (rand_2E39E0() & 1) moby->flags |= 0x8000; ground_enemy_vars->settings = &settings_2E39E0; @@ -442,7 +442,7 @@ void ground_melee_enemy_update(Moby *moby) { moby->state = GROUND_ENEMY_STATE_MELEE_ATTACK; if (moby->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(random_int_between(10, 13))); - } else if (ground_enemy_vars->f190 < frame_time || 1.0f < steep || (flags & 2)) { + } else if (ground_enemy_vars->horizontal_movement_step < frame_time || 1.0f < steep || (flags & 2)) { ground_enemy_vars->home_timer = scale_game_frames(50); moby->state = GROUND_ENEMY_STATE_RETURN_HOME; } else if (fast_vec_length(&away) < ground_enemy_vars->range + 4.0f && From 8b94e7777c4bbf82be2956a556504d869570c862 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:49:15 +0000 Subject: [PATCH 412/758] decomp: clarify names in robot_dog_update f1A4 -> max_movement_step: Root 002c5d14 initializes pvars+0x1A4 from f234*frame_time, restores it at 002c6650-002c665c and approaches zero during melee at 002c64f0-002c6510. Movement receives pvars+0x180; helper 0024779c loads relative +0x24, scales it, and 0024780c-00247834 clamps the horizontal step scalar to its positive/negative bounds before cosine/sine expansion at 0024785c-00247880. f1A8 -> movement_heading_error_limit: Root 002c5d1c initializes pvars+0x1A8 to 2.0954423. Path mover receives pvars+0x180, computes bearing to the path node at 00247c6c-00247c84 and heading difference at 00247ca8-00247cb0. Relative +0x28 is compared with that error at 00247cb8-00247cc8 and scales movement by (limit-error)/limit at 00247d18-00247d30. f1AC -> movement_arrival_distance: Root 002c5d2c-002c5d4c initializes pvars+0x1AC from max movement step times the initialization multiplier. Path mover's state is pvars+0x180; 00247c4c-00247c68 computes distance from moby position to target node and sets arrival result bit 4 when below relative +0x2C. Root 002c62f4-002c631c uses that bit to advance path nodes. Movement helper also compares target distance with +0x2C at 00247ba8-00247bb8. f1BC -> path_turn_spring_strength: Root 002c5cd4 and 002c5d28 set pvars+0x1BC to frame_time_sq*6.2831855. Path mover 00247c98 loads relative +0x3C from its pvars+0x180 movement state into f13 before calling 00246de8 at 00247ca0. Supplied spring_turn context identifies this argument as spring_strength in the damped heading update. f1C0 -> path_turn_damping_factor: Root 002c5cd8 and 002c5d04 set pvars+0x1C0 to frame_time_sq*12.566371. Path mover 00247c8c loads relative +0x40 from the pvars+0x180 movement state into f14 and calls 00246de8 at 00247ca0. Supplied spring_turn context proves f14 is damping_factor, subtracting damping_factor times the persistent turn step. f1C4 -> path_turn_step_limit: Root 002c5ce0 and 002c5d08 set pvars+0x1C4 to frame_time*pi. Path mover 00247c90 loads relative +0x44 from the pvars+0x180 movement state into f15 before 00247ca0 calls 00246de8. Supplied spring_turn context proves this argument clamps the persistent turn step to plus/minus limit before updating moby yaw. f234 -> movement_speed: Root 002c5ca8-002c5d14 multiplies pvars+0x234 by frame_time into the proven maximum horizontal movement step at +0x1A4. The same conversion restores that cap at 002c6650-002c665c and controls its melee slowdown at 002c64f4-002c6510; 002c61ac-002c61dc uses speed*time intervals to compute melee-entry travel distance. i1B8 -> movement_control_flags: Root 002c5cdc-002c5d18 ORs 0x20 into pvars+0x1B8. Movement helper holds pvars+0x180 in s1; relative +0x38 is read and masked at 00247838-00247840 to choose heading source, at 00247884-00247898 to gate vertical motion, and at 002478f8-00247910 and 00247a48-00247a58 to control collision-query behavior. These independent bit tests prove a movement control flag word without assigning individual bit meanings. --- src/overlays/l03/mobys/robot_dog.c | 46 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/overlays/l03/mobys/robot_dog.c b/src/overlays/l03/mobys/robot_dog.c index 1a43b5a0a7..8f70af0597 100644 --- a/src/overlays/l03/mobys/robot_dog.c +++ b/src/overlays/l03/mobys/robot_dog.c @@ -85,20 +85,20 @@ typedef struct { float f188; float f18C; char p190[0x14]; - float f1A4; - float f1A8; - float f1AC; + float max_movement_step; + float movement_heading_error_limit; + float movement_arrival_distance; char p1B0[8]; - int i1B8; - float f1BC; - float f1C0; - float f1C4; + int movement_control_flags; + float path_turn_spring_strength; + float path_turn_damping_factor; + float path_turn_step_limit; char p1C8[0x38]; float home[4]; char p210[0x10]; float v220[4]; float target_engagement_radius; - float f234; + float movement_speed; char p238[4]; int chase_timer; int extended_engagement_radius_timer; @@ -184,21 +184,21 @@ void robot_dog_update(char *moby) { robot_dog_state->extended_engagement_radius_timer = 0; robot_dog_state->s24 = 1; FUN_L01_0026d930((char *)&robot_dog_state->i180, robot_dog_state->home); - robot_dog_state->f1BC = frame_time_sq * 6.2831855f; - robot_dog_state->f1C0 = frame_time_sq * 12.566371f; - robot_dog_state->f1C4 = frame_time * 3.1415927f; + robot_dog_state->path_turn_spring_strength = frame_time_sq * 6.2831855f; + robot_dog_state->path_turn_damping_factor = frame_time_sq * 12.566371f; + robot_dog_state->path_turn_step_limit = frame_time * 3.1415927f; robot_dog_state->f188 = robot_dog_state->f18C = 2.0f; robot_dog_state->i180 = 0x38D; - robot_dog_state->f1A4 = robot_dog_state->f234 * frame_time; - robot_dog_state->i1B8 |= 0x20; - robot_dog_state->f1A8 = 2.0954423f; + robot_dog_state->max_movement_step = robot_dog_state->movement_speed * frame_time; + robot_dog_state->movement_control_flags |= 0x20; + robot_dog_state->movement_heading_error_limit = 2.0954423f; initialization_multiplier_or_desired_heading = FUN_L04_001f1978(6.0f); robot_dog_state->f264 = 1.0f; robot_dog_state->melee_cooldown_timer = 0; robot_dog_state->i26C = 0; robot_dog_state->i260 = 0; - robot_dog_state->f1AC = - robot_dog_state->f1A4 * initialization_multiplier_or_desired_heading; + robot_dog_state->movement_arrival_distance = + robot_dog_state->max_movement_step * initialization_multiplier_or_desired_heading; robot_dog_state->b58 = 8; robot_dog_state->b5A = 7; if (rand() & 1) { @@ -293,8 +293,8 @@ void robot_dog_update(char *moby) { robot_dog_state->chase_timer = scale_game_frames((int)random_float_between(30.0f, 90.0f)); } target_distance = vector_distance_xy(moby + 0x10, &selected_target); - if (target_distance < robot_dog_state->f234 * frame_time * 0.5f * FUN_L04_001f1978(40.0f) + - robot_dog_state->f234 * frame_time * FUN_L04_001f1978(10.0f) + + if (target_distance < robot_dog_state->movement_speed * frame_time * 0.5f * FUN_L04_001f1978(40.0f) + + robot_dog_state->movement_speed * frame_time * FUN_L04_001f1978(10.0f) + 1.5f) { MOBY(moby)->state = ROBOT_DOG_MELEE_ATTACK; if (((unsigned char *)moby)[0x53] != 5) { @@ -364,9 +364,9 @@ void robot_dog_update(char *moby) { move_moby_with_ground_and_collision_checks( moby, &robot_dog_state->i180, forward_vector_or_path_point, robot_dog_state->v40, 1.0f); if (((unsigned char *)moby)[0x52] == 5) { - approach_value(&robot_dog_state->f1A4, + approach_value(&robot_dog_state->max_movement_step, 0.0f, - robot_dog_state->f234 * frame_time / FUN_L04_001f1978(40.0f)); + robot_dog_state->movement_speed * frame_time / FUN_L04_001f1978(40.0f)); } if (absolute_float(compute_interpolated_record_value(moby) - 25.0f) <= 0.25f && absolute_float(selected_target.pos[2] - MOBY(moby)->pos.z) < 1.0f && @@ -382,7 +382,7 @@ void robot_dog_update(char *moby) { at[2] += 0.75f; spawn_nearby_effect(selected_target.obj, moby, 1, at, push, 1.0f); } else if (((unsigned char *)moby)[0x70] & 2) { - robot_dog_state->f1A4 = robot_dog_state->f234 * frame_time; + robot_dog_state->max_movement_step = robot_dog_state->movement_speed * frame_time; MOBY(moby)->state = ROBOT_DOG_RETURN_HOME; if (((unsigned char *)moby)[0x53] != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(3)); @@ -413,8 +413,8 @@ void robot_dog_update(char *moby) { } else if (robot_dog_state->melee_cooldown_timer == 0) { target_distance = vector_distance_xy(moby + 0x10, &selected_target); if (target_distance < - robot_dog_state->f234 * frame_time * 0.5f * FUN_L04_001f1978(40.0f) + - robot_dog_state->f234 * frame_time * FUN_L04_001f1978(10.0f) + 1.5f) { + robot_dog_state->movement_speed * frame_time * 0.5f * FUN_L04_001f1978(40.0f) + + robot_dog_state->movement_speed * frame_time * FUN_L04_001f1978(10.0f) + 1.5f) { MOBY(moby)->state = ROBOT_DOG_MELEE_ATTACK; if (((unsigned char *)moby)[0x53] != 5) { blend_moby_animation( From a002da45d90594565e52d7f1f2e9c055260225b5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:49:18 +0000 Subject: [PATCH 413/758] decomp: clarify names in sand_shark_update unk214 -> target_selection_status: Retail 0x002d4344, 0x002d4458 and 0x002d4ab4 read pvars+0x214 to gate pursuit when equal to 2. Checked helper 0x002d5c88 writes 2 at 0x002d6098/0x002d60c8 after target home-distance or vertical-distance exclusion; supplied Vars5c88 names the same pvars field target_selection_status. unk24C -> base_target_selection_range: Retail 0x002d4fc4 computes target minus home; its length is compared against float pvars+0x24c at 0x002d5004-0x002d5018 to resume pursuit. Checked helper 0x002d5dd4-0x002d5df0 copies this float or adds 5 to form effective targeting range +0x250, matching supplied base_target_selection_range. unk258 -> initialization_gate_moby_index: Retail 0x002d4110-0x002d4134 selects linked-moby waiting for nonnegative +0x258. At 0x002d4160-0x002d417c its index is shifted by 8 into the moby array and the linked state is tested; 0x002d41bc clears the index to -1 before initialization resumes. unk25C -> target_range_refresh_timer: Retail 0x002d41b8-0x002d41c0 stores scale_game_frames(0x1518) into short +0x25c when the linked initialization gate opens. Checked targeting helper 0x002d5d5c-0x002d5dc0 decrements this short and combines its result with hero distance below 10 to control refresh of the range-extension timer +0x25e. unk25E -> target_range_extension_timer: Retail 0x002d4000 initializes short +0x25e to zero and pursuit branches at 0x002d45a8 and 0x002d46c0 test it. Checked helper 0x002d5d98-0x002d5dc0 refreshes it with a scaled random 180..240 duration; 0x002d5dc8-0x002d5df0 decrements it and selects base range or base range plus 5. unk26C -> primary_hero_launch_trigger_volume_index: Retail 0x002d4064-0x002d4098 selects wait-for-hero-launch-trigger when +0x26c is nonnegative. In that state 0x002d5198-0x002d51a4 passes this index with hero position to the clip-volume test, before the alternate +0x270 test; success begins ballistic launch setup. unk274 -> wander_target_volume_index: In wander-around-home, retail 0x002d4350-0x002d4360 passes nonnegative +0x274 as the clip-volume index with target point +0x1d0. Failure or an active range timer can clear this field to -1 at 0x002d50bc-0x002d50c4; the name asserts only its target-volume role during wandering. unk278 -> target_activation_volume_index: Retail 0x002d40c8-0x002d40e8 selects wait-for-target-in-volume for nonnegative +0x278. At 0x002d4468-0x002d4484 target +0x1d0 enters pursuit when inside this volume; 0x002d4ac4-0x002d4bcc returns home when outside, and 0x002d4fcc-0x002d4fe8 reactivates pursuit on entry. unk27C -> selected_relaunch_moby: Retail 0x002d54e0-0x002d54ec, 0x002d5590-0x002d559c and 0x002d55f4-0x002d5600 store the return of select_group_class_29c_moby to +0x27c. A nonzero selected group moby permits inactive waiting for relaunch; zero removes the shark. Supplied helper Vars5c88 names this same field selected_relaunch_moby. unk284 -> turn_offset_multiplier: Retail 0x002d43a0-0x002d43bc converts turn_range degrees into turn_offset radians and loads int +0x284. A nonzero integer is converted to float at 0x002d43c0-0x002d43c8 and multiplies that offset at 0x002d43d0; zero instead selects random sign. unk28C -> launch_origin_moby_index: Retail 0x002d4070-0x002d4074 rejects missing index -1 before entering launch-trigger wait. At 0x002d51c8-0x002d51f8 +0x28c indexes the moby array with stride 0x100; its position supplies height and distance for velocity toward home, then is copied to the shark position at 0x002d5288-0x002d528c, proving launch origin. unk298 -> outside_path_return_active: Supplied begin_sand_shark_return_home_if_outside_path sets pvars+0x298 to 1 after the moby fails point_in_path_xy and enters return-home alignment. Retail 0x002d4ec0 clears it on home arrival; 0x002d4f9c-0x002d4fa0 gates target reacquisition and 0x002d50c8-0x002d50f0 adds forward movement while this flag is nonzero. unk29C -> death_landing_particles_emitted: Retail death-knockback branch 0x002d5494-0x002d54c4 tests landing bit 1 and int +0x29c == 0, writes 1, then emits radial particles with count 0x1b. Checked targeting helper clears +0x29c at 0x002d5e5c before death handling; supplied Vars5c88 names this same one-shot field death_landing_particles_emitted. unk2E -> relaunch_request_state: Retail initialization 0x002d3ff8 writes byte +0x2e = 1. Checked helper 0x002d5cc4-0x002d5cdc tests 2 and consumes it by writing 1, then selects a relaunch moby and enters inactive state 26 at 0x002d5d00-0x002d5d4c. Supplied Vars5c88 and request enum identify pending/consumed relaunch states. --- src/overlays/l02/mobys/sand_shark.c | 124 ++++++++++++++-------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 087e2f5306..5b6cc1a6df 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -189,7 +189,7 @@ typedef struct { /* 0x026 */ char pad26[3]; /* 0x029 */ unsigned char unk29; /* 0x02A */ char pad2A[4]; - /* 0x02E */ unsigned char unk2E; + /* 0x02E */ unsigned char relaunch_request_state; /* 0x02F */ char pad2F[0x11]; /* 0x040 */ OvlVec4 vel; /* 0x050 */ char pad50[8]; @@ -213,34 +213,34 @@ typedef struct { /* 0x1A8 */ char pad1A8[0x28]; /* 0x1D0 */ OvlVec4 target; /* 0x1E0 */ char pad1E0[0x34]; - /* 0x214 */ int unk214; + /* 0x214 */ int target_selection_status; /* 0x218 */ char pad218[8]; /* 0x220 */ OvlVec4 home; /* 0x230 */ OvlVec4 unk230; /* 0x240 */ float turn_vel; /* 0x244 */ float turn_offset; /* 0x248 */ float turn_range; - /* 0x24C */ float unk24C; + /* 0x24C */ float base_target_selection_range; /* 0x250 */ char pad250[4]; /* 0x254 */ float unk254; - /* 0x258 */ int unk258; - /* 0x25C */ short unk25C; - /* 0x25E */ short unk25E; + /* 0x258 */ int initialization_gate_moby_index; + /* 0x25C */ short target_range_refresh_timer; + /* 0x25E */ short target_range_extension_timer; /* 0x260 */ int turn_timer; /* 0x264 */ char pad264[8]; - /* 0x26C */ int unk26C; + /* 0x26C */ int primary_hero_launch_trigger_volume_index; /* 0x270 */ int unk270; - /* 0x274 */ int unk274; - /* 0x278 */ int unk278; - /* 0x27C */ int unk27C; + /* 0x274 */ int wander_target_volume_index; + /* 0x278 */ int target_activation_volume_index; + /* 0x27C */ int selected_relaunch_moby; /* 0x280 */ char pad280[4]; - /* 0x284 */ int unk284; + /* 0x284 */ int turn_offset_multiplier; /* 0x288 */ int unk288; - /* 0x28C */ int unk28C; + /* 0x28C */ int launch_origin_moby_index; /* 0x290 */ int path; /* 0x294 */ float unk294; - /* 0x298 */ int unk298; - /* 0x29C */ int unk29C; + /* 0x298 */ int outside_path_return_active; + /* 0x29C */ int death_landing_particles_emitted; /* 0x2A0 */ char unk2A0[0x10]; } Varsd3e50; @@ -338,9 +338,9 @@ void sand_shark_update(struct Moby *moby) { sand_shark_behavior_vars->unk20 = 1.0f; sand_shark_behavior_vars->unk58 = D_L02_00161900; sand_shark_behavior_vars->unk5C = 1; - sand_shark_behavior_vars->unk2E = 1; + sand_shark_behavior_vars->relaunch_request_state = 1; sand_shark_behavior_vars->unk29 = 1; - sand_shark_behavior_vars->unk25E = 0; + sand_shark_behavior_vars->target_range_extension_timer = 0; FUN_L01_0026d930_e50(&sand_shark_behavior_vars->walk_mode); sand_shark_behavior_vars->walk_188 = sand_shark_behavior_vars->walk_18C = 2.0f; sand_shark_behavior_vars->walk_mode = 0x200; @@ -350,8 +350,8 @@ void sand_shark_update(struct Moby *moby) { moby->flags |= 0x8000; } sand_shark_behavior_vars->unkD0 = &D_L02_001619B0; - if (sand_shark_behavior_vars->unk26C >= 0) { - if (sand_shark_behavior_vars->unk28C == -1) { + if (sand_shark_behavior_vars->primary_hero_launch_trigger_volume_index >= 0) { + if (sand_shark_behavior_vars->launch_origin_moby_index == -1) { mark_moby_for_removal(moby); return; } @@ -362,13 +362,13 @@ void sand_shark_update(struct Moby *moby) { if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(3)); } - } else if (sand_shark_behavior_vars->unk278 >= 0) { + } else if (sand_shark_behavior_vars->target_activation_volume_index >= 0) { sand_shark_behavior_vars->walk_18C = 0.2f; moby->state = SAND_SHARK_WAIT_FOR_TARGET_IN_VOLUME; if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(3)); } - } else if (sand_shark_behavior_vars->unk258 >= 0) { + } else if (sand_shark_behavior_vars->initialization_gate_moby_index >= 0) { moby->state = SAND_SHARK_WAIT_FOR_LINKED_MOBY_BEFORE_INITIALIZE; moby->collision = 0; moby->flags = (moby->flags | 0x41) & ~0x1000; @@ -381,13 +381,13 @@ void sand_shark_update(struct Moby *moby) { break; case SAND_SHARK_WAIT_FOR_LINKED_MOBY_BEFORE_INITIALIZE: if (((struct Moby *)((char *)D_L02_0015FFD8_macro + - (sand_shark_behavior_vars->unk258 << 8))) + (sand_shark_behavior_vars->initialization_gate_moby_index << 8))) ->state >= 5 && camera_secondary_mode != 0x72) { moby->flags = (moby->flags & 0xFFBE) | 0x1000; moby->collision = moby->pclass->collision; - sand_shark_behavior_vars->unk258 = -1; - sand_shark_behavior_vars->unk25C = scale_game_frames(0x1518); + sand_shark_behavior_vars->initialization_gate_moby_index = -1; + sand_shark_behavior_vars->target_range_refresh_timer = scale_game_frames(0x1518); moby->state = SAND_SHARK_INITIALIZE; moby->pos.z -= sand_shark_height_offset_gp; } @@ -423,20 +423,20 @@ 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->unk214 != 2) { - if (sand_shark_behavior_vars->unk274 >= 0) { + if (sand_shark_behavior_vars->target_selection_status != 2) { + if (sand_shark_behavior_vars->wander_target_volume_index >= 0) { if ((!is_point_inside_clip_volume(&sand_shark_behavior_vars->target, - sand_shark_behavior_vars->unk274) || - sand_shark_behavior_vars->unk25E != 0) && + sand_shark_behavior_vars->wander_target_volume_index) || + sand_shark_behavior_vars->target_range_extension_timer != 0) && random_integer_below(9) == 0) { - sand_shark_behavior_vars->unk274 = -1; + sand_shark_behavior_vars->wander_target_volume_index = -1; } } else if (random_integer_below(4) == 0) { sand_shark_behavior_vars->turn_offset = sand_shark_behavior_vars->turn_range * 0.017453292f; - if (sand_shark_behavior_vars->unk284 != 0) { + if (sand_shark_behavior_vars->turn_offset_multiplier != 0) { sand_shark_behavior_vars->turn_offset = sand_shark_behavior_vars->turn_offset * - (float)sand_shark_behavior_vars->unk284; + (float)sand_shark_behavior_vars->turn_offset_multiplier; } else if (random_integer_below(0x100) & 1) { sand_shark_behavior_vars->turn_offset = -sand_shark_behavior_vars->turn_offset; } @@ -448,20 +448,20 @@ void sand_shark_update(struct Moby *moby) { blend_moby_animation(moby, 0xC, 0, scale_game_frames(3)); } } - } else if (sand_shark_behavior_vars->unk25E != 0 && random_integer_below(0x13) == 0) { + } else if (sand_shark_behavior_vars->target_range_extension_timer != 0 && random_integer_below(0x13) == 0) { moby->state = SAND_SHARK_ALIGN_TO_GROUND_BEFORE_APPROACH_TARGET_WITH_PATH_PROXIMITY_CHECK; allocate_voice_for_target_entry(4, 0, moby); if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, 0); } - sand_shark_behavior_vars->unk274 = -1; + sand_shark_behavior_vars->wander_target_volume_index = -1; } break; case SAND_SHARK_WAIT_FOR_TARGET_IN_VOLUME: - if (sand_shark_behavior_vars->unk214 != 2 && + if (sand_shark_behavior_vars->target_selection_status != 2 && is_point_inside_clip_volume(&sand_shark_behavior_vars->target, - sand_shark_behavior_vars->unk278)) { + sand_shark_behavior_vars->target_activation_volume_index)) { moby->state = SAND_SHARK_APPROACH_TARGET; if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(3)); @@ -497,7 +497,7 @@ void sand_shark_update(struct Moby *moby) { fast_vec_dist(&moby->pos, &navigation_point) < sand_shark_behavior_vars->unk294) { hit14 = 1; } - if (sand_shark_behavior_vars->unk25E != 0) { + if (sand_shark_behavior_vars->target_range_extension_timer != 0) { if (hit14) { moby->state = SAND_SHARK_FACE_TARGET; if (moby->prev_seq != 5) { @@ -508,7 +508,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->unk214 != 2) { + } else if (sand_shark_behavior_vars->target_selection_status != 2) { moby->state = SAND_SHARK_APPROACH_TARGET; if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0xF)); @@ -527,13 +527,13 @@ void sand_shark_update(struct Moby *moby) { frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, D_0015ED6C * 6.2831855f); - if (sand_shark_behavior_vars->unk25E != 0) { + if (sand_shark_behavior_vars->target_range_extension_timer != 0) { if (vector_distance_xy(&moby->pos, &sand_shark_behavior_vars->target) < 1.5f) { moby->state = SAND_SHARK_CLOSE_RANGE_ATTACK; if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(0xA)); } - } else if (sand_shark_behavior_vars->unk214 != 2) { + } else if (sand_shark_behavior_vars->target_selection_status != 2) { moby->state = SAND_SHARK_APPROACH_TARGET; if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0xF)); @@ -635,10 +635,10 @@ 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->unk214 != 2) { - if (sand_shark_behavior_vars->unk278 >= 0 && + if (sand_shark_behavior_vars->target_selection_status != 2) { + if (sand_shark_behavior_vars->target_activation_volume_index >= 0 && !is_point_inside_clip_volume(&sand_shark_behavior_vars->target, - sand_shark_behavior_vars->unk278)) { + sand_shark_behavior_vars->target_activation_volume_index)) { moby->state = SAND_SHARK_RETURN_HOME; } else { fast_vec_sub(&target_home_delta, @@ -659,9 +659,9 @@ void sand_shark_update(struct Moby *moby) { } } } - } else if (sand_shark_behavior_vars->unk278 >= 0) { + } else if (sand_shark_behavior_vars->target_activation_volume_index >= 0) { moby->state = SAND_SHARK_RETURN_HOME; - } else if (sand_shark_behavior_vars->unk25E != 0) { + } else if (sand_shark_behavior_vars->target_range_extension_timer != 0) { moby->state = SAND_SHARK_APPROACH_TARGET_WITH_PATH_PROXIMITY_CHECK; } else { moby->state = SAND_SHARK_ALIGN_TO_GROUND_BEFORE_RETURN_HOME_WITH_HEIGHT_OFFSET; @@ -728,9 +728,9 @@ void sand_shark_update(struct Moby *moby) { moby->pos.z -= sand_shark_height_offset_gp; } if (vector_distance_xy(&moby->pos, &sand_shark_behavior_vars->home) < 0.5f) { - sand_shark_behavior_vars->unk298 = 0; + sand_shark_behavior_vars->outside_path_return_active = 0; if (moby->state == SAND_SHARK_RETURN_HOME) { - if (sand_shark_behavior_vars->unk278 >= 0) { + if (sand_shark_behavior_vars->target_activation_volume_index >= 0) { moby->state = SAND_SHARK_WAIT_FOR_TARGET_IN_VOLUME; if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(3)); @@ -750,19 +750,19 @@ void sand_shark_update(struct Moby *moby) { } } } - if (sand_shark_behavior_vars->unk298 == 0) { - if (sand_shark_behavior_vars->unk214 != 2) { + if (sand_shark_behavior_vars->outside_path_return_active == 0) { + if (sand_shark_behavior_vars->target_selection_status != 2) { fast_vec_sub(&target_home_delta, &sand_shark_behavior_vars->target, &sand_shark_behavior_vars->home); - if (sand_shark_behavior_vars->unk278 >= 0) { + if (sand_shark_behavior_vars->target_activation_volume_index >= 0) { if (is_point_inside_clip_volume(&sand_shark_behavior_vars->target, - sand_shark_behavior_vars->unk278)) { + sand_shark_behavior_vars->target_activation_volume_index)) { moby->state = SAND_SHARK_APPROACH_TARGET; sand_shark_behavior_vars->walk_step = sand_shark_behavior_vars->unk254 * D_0015ED6C; } - } else if (fast_vec_length(&target_home_delta) < sand_shark_behavior_vars->unk24C) { + } else if (fast_vec_length(&target_home_delta) < sand_shark_behavior_vars->base_target_selection_range) { if (moby->state == SAND_SHARK_RETURN_HOME) { moby->state = SAND_SHARK_APPROACH_TARGET; } else { @@ -774,14 +774,14 @@ void sand_shark_update(struct Moby *moby) { blend_moby_animation(moby, 0, 0, scale_game_frames(3)); } } - } else if (sand_shark_behavior_vars->unk25E != 0 && random_integer_below(0x13) == 0) { + } else if (sand_shark_behavior_vars->target_range_extension_timer != 0 && random_integer_below(0x13) == 0) { moby->state = SAND_SHARK_ALIGN_TO_GROUND_BEFORE_APPROACH_TARGET_WITH_PATH_PROXIMITY_CHECK; allocate_voice_for_target_entry(4, 0, moby); if (moby->prev_seq != 0) { blend_moby_animation(moby, 0, 0, 0); } - sand_shark_behavior_vars->unk274 = -1; + sand_shark_behavior_vars->wander_target_volume_index = -1; } } else { extern float frame_time __asm__("D_0015ED6C") __attribute__((sda)); @@ -812,14 +812,14 @@ void sand_shark_update(struct Moby *moby) { break; case SAND_SHARK_WAIT_FOR_HERO_LAUNCH_TRIGGER: { int in; - if (is_point_inside_clip_volume(&hero.motion.pos, sand_shark_behavior_vars->unk26C)) { + if (is_point_inside_clip_volume(&hero.motion.pos, sand_shark_behavior_vars->primary_hero_launch_trigger_volume_index)) { in = 1; } else { in = is_point_inside_clip_volume(&hero.motion.pos, sand_shark_behavior_vars->unk270) != 0; } if (in) { - struct Moby *dest = &D_L02_0015FFD8_macro[sand_shark_behavior_vars->unk28C]; + struct Moby *dest = &D_L02_0015FFD8_macro[sand_shark_behavior_vars->launch_origin_moby_index]; float dz = dest->pos.z - sand_shark_behavior_vars->home.f[2]; float up = random_float_between(6.0f, 10.0f) * D_0015ED6C; float flight_duration = (square_root(2.0f * (frame_time_sq * 10.8f) * dz) + 2.0f * up) / @@ -883,15 +883,15 @@ void sand_shark_update(struct Moby *moby) { } case SAND_SHARK_DEATH_KNOCKBACK: { int knockback_status_flags = step_moby_motion(moby, sand_shark_behavior_vars->unk120); - if ((knockback_status_flags & 1) && sand_shark_behavior_vars->unk29C == 0) { - sand_shark_behavior_vars->unk29C = 1; + if ((knockback_status_flags & 1) && sand_shark_behavior_vars->death_landing_particles_emitted == 0) { + sand_shark_behavior_vars->death_landing_particles_emitted = 1; position_or_offset_scratch.q = *(OvlQuad *)&moby->pos; emit_sand_shark_radial_particles(&position_or_offset_scratch, 0x1B); } if (knockback_status_flags & 0x140) { FUN_L00_00257470_e50(moby, 0, -1); - sand_shark_behavior_vars->unk27C = select_group_class_29c_moby(moby); - if (sand_shark_behavior_vars->unk27C != 0) { + sand_shark_behavior_vars->selected_relaunch_moby = select_group_class_29c_moby(moby); + if (sand_shark_behavior_vars->selected_relaunch_moby != 0) { emit_sand_shark_dust_burst(moby); moby->state = SAND_SHARK_INACTIVE_WAIT_FOR_RELAUNCH; moby->anim_speed = 0.0f; @@ -915,8 +915,8 @@ void sand_shark_update(struct Moby *moby) { if (moby->alpha >= 8) { moby->alpha -= 8; } else { - sand_shark_behavior_vars->unk27C = select_group_class_29c_moby(moby); - if (sand_shark_behavior_vars->unk27C != 0) { + sand_shark_behavior_vars->selected_relaunch_moby = select_group_class_29c_moby(moby); + if (sand_shark_behavior_vars->selected_relaunch_moby != 0) { emit_sand_shark_dust_burst(moby); moby->alpha = 0x80; moby->state = SAND_SHARK_INACTIVE_WAIT_FOR_RELAUNCH; @@ -931,8 +931,8 @@ void sand_shark_update(struct Moby *moby) { } break; case SAND_SHARK_INACTIVE_WAIT_FOR_RELAUNCH: - sand_shark_behavior_vars->unk27C = select_group_class_29c_moby(moby); - if (sand_shark_behavior_vars->unk27C == 0) { + sand_shark_behavior_vars->selected_relaunch_moby = select_group_class_29c_moby(moby); + if (sand_shark_behavior_vars->selected_relaunch_moby == 0) { mark_moby_for_removal(moby); return; } From 800eb30d4f9bbbd9c023b0ffad2add78c4dde64d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:49:22 +0000 Subject: [PATCH 414/758] decomp: clarify names in puffoid_update unk24C -> chase_heading_offset_radians: Retail 0031480c-00314834 samples +/-puffoid_chase_heading_offset_limit_degrees_gp, multiplies by 0.017453292 and stores f32 at pvars+0x24C on entry to chase. Repeated at 0031494c-00314974, 00314ca4-00314ccc and carrier chase 003150dc-00315104. Authoritative C helper update_moby_target_heading_and_conditional_movement adds this field to atan(target XY - moby XY) via fast_add_rotations before yaw approach, proving a chase heading offset in radians. unk250 -> yaw_turn_velocity: Retail 0031464c-00314674 passes moby yaw +0x48 as a0 and pvars+0x250 as a1 to approach_angle; target/path yaw approaches repeat at 00314b04-00314b14 and 003154fc-00315518. Checked helper level-11 00281ca0-00281e78 retains a1 in s0, reads its signed float at 00281cf0, uses its square divided by braking acceleration at 00281d1c-00281d30, adjusts it toward signed speed limits, then reads it at 00281e34 and combines it with the current yaw, storing yaw at 00281e40. This is the maintained signed yaw turn velocity, consistent with the source turn-speed comment. unk258 -> carrier_jump_local_x_threshold: Retail 00314588-003145a0 stores random_float_between(-3,3) at pvars+0x258 for carrier jump waiting. At 00314e40-00314e64 the moby-minus-carrier displacement is transformed by the transposed carrier rotation basis; 00314e68-00314e98 permits launch only when its local X is less than this field and greater than -3.1. The following branch constructs the carrier jump destination and state 13 at 00314ef4-00314f2c. Original Ghidra case 0xc and authoritative C agree, proving a carrier-local X launch threshold. unk260 -> wander_destination: Retail 003148b0-00314904 forms cos/sin(random angle)*random radius 1..3 in pvars+0x260/+0x264, sets Z displacement zero at +0x268, and adds home at +0x220. 00314908-00314918 enters WANDER_NEAR_HOME; 00314934-0031493c passes this array to update_moby_target_heading_and_conditional_movement as target position. Original Ghidra cases 2/3 and authoritative C prove this four-float array stores the home-relative wander destination in world coordinates. --- src/overlays/l11/mobys/puffoid.c | 36 ++++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/overlays/l11/mobys/puffoid.c b/src/overlays/l11/mobys/puffoid.c index 9130c2b193..557ce514f1 100644 --- a/src/overlays/l11/mobys/puffoid.c +++ b/src/overlays/l11/mobys/puffoid.c @@ -87,12 +87,12 @@ typedef struct { u8 pad23C[8]; s32 unk244; /* 0x244 */ u8 pad248[4]; - f32 unk24C; /* 0x24C: heading offset for FUN_L11_00315f58 */ - f32 unk250; /* 0x250: turn speed */ + f32 chase_heading_offset_radians; /* 0x24C: heading offset for FUN_L11_00315f58 */ + f32 yaw_turn_velocity; /* 0x250: turn speed */ s32 carrier; /* 0x254: moby index of the carrier, or < 0 */ - f32 unk258; /* 0x258 */ + f32 carrier_jump_local_x_threshold; /* 0x258 */ s32 point; /* 0x25C: current path point */ - f32 unk260[4]; /* 0x260 */ + f32 wander_destination[4]; /* 0x260 */ u8 pad270[0x10]; u8 unk280[0x10]; /* 0x280 */ } CreatureVars_4318; @@ -190,7 +190,7 @@ void puffoid_update(struct Moby *moby) { qcopy(puffoid_vars->home, (char *)l11_paths[puffoid_vars->path] + 0x20); } else if (puffoid_vars->carrier >= 0) { moby->state = PUFFOID_STATE_WAIT_FOR_CARRIER_JUMP; - puffoid_vars->unk258 = random_float_between(-3.0f, 3.0f); + puffoid_vars->carrier_jump_local_x_threshold = random_float_between(-3.0f, 3.0f); moby->visible = 0; moby->collision = 0; moby->flags |= 1; @@ -208,7 +208,7 @@ void puffoid_update(struct Moby *moby) { float home_jump_heading = fast_arc_tan(*(float *)(path + 0x20) - moby->pos.x, *(float *)(path + 0x24) - moby->pos.y); approach_angle(&moby->rot.z, - &puffoid_vars->unk250, + &puffoid_vars->yaw_turn_velocity, home_jump_heading, frame_time_sq * 8.726646f, frame_time_sq * 8.726646f, @@ -253,7 +253,7 @@ void puffoid_update(struct Moby *moby) { break; case PUFFOID_STATE_IDLE: if (puffoid_vars->unk214 != 2) { - puffoid_vars->unk24C = + puffoid_vars->chase_heading_offset_radians = random_float_between(-puffoid_chase_heading_offset_limit_degrees_gp, puffoid_chase_heading_offset_limit_degrees_gp) * 0.017453292f; @@ -265,10 +265,10 @@ void puffoid_update(struct Moby *moby) { fast_vec_dist(&moby->pos, D_L11_001677C0_4318) < 32.0f) { float a = random_angle_radians(); float wander_radius = random_float_between(1.0f, 3.0f); - puffoid_vars->unk260[0] = fast_cos(a) * wander_radius; - puffoid_vars->unk260[1] = fast_sin(a) * wander_radius; - puffoid_vars->unk260[2] = 0.0f; - fast_vec_add(puffoid_vars->unk260, puffoid_vars->unk260, puffoid_vars->home); + puffoid_vars->wander_destination[0] = fast_cos(a) * wander_radius; + puffoid_vars->wander_destination[1] = fast_sin(a) * wander_radius; + puffoid_vars->wander_destination[2] = 0.0f; + fast_vec_add(puffoid_vars->wander_destination, puffoid_vars->wander_destination, puffoid_vars->home); moby->state = PUFFOID_STATE_WANDER_NEAR_HOME; if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(10)); @@ -276,9 +276,9 @@ void puffoid_update(struct Moby *moby) { } break; case PUFFOID_STATE_WANDER_NEAR_HOME: - update_moby_target_heading_and_conditional_movement((char *)moby, puffoid_vars->unk260); + update_moby_target_heading_and_conditional_movement((char *)moby, puffoid_vars->wander_destination); if (puffoid_vars->unk214 != 2) { - puffoid_vars->unk24C = + puffoid_vars->chase_heading_offset_radians = random_float_between(-puffoid_chase_heading_offset_limit_degrees_gp, puffoid_chase_heading_offset_limit_degrees_gp) * 0.017453292f; @@ -318,7 +318,7 @@ void puffoid_update(struct Moby *moby) { float target_facing_heading = fast_arc_tan(puffoid_vars->target->pos.x - moby->pos.x, puffoid_vars->target->pos.y - moby->pos.y); approach_angle(rz, - &puffoid_vars->unk250, + &puffoid_vars->yaw_turn_velocity, target_facing_heading, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, @@ -356,7 +356,7 @@ void puffoid_update(struct Moby *moby) { blend_moby_animation(moby, 0, 0, scale_game_frames(10)); } } else if (puffoid_vars->unk214 != 2) { - puffoid_vars->unk24C = + puffoid_vars->chase_heading_offset_radians = random_float_between(-puffoid_chase_heading_offset_limit_degrees_gp, puffoid_chase_heading_offset_limit_degrees_gp) * 0.017453292f; @@ -413,7 +413,7 @@ void puffoid_update(struct Moby *moby) { transpose_rotation_matrix(basis, &carrier_moby->rot_row0); fast_vec_sub(pos, &moby->pos, &carrier_moby->pos); transform_vector(pos, pos, basis); - if (pos[0] < puffoid_vars->unk258 && pos[0] > -3.1f) { + if (pos[0] < puffoid_vars->carrier_jump_local_x_threshold && pos[0] > -3.1f) { float lo; float hi; int scaled_animation_frames; @@ -473,7 +473,7 @@ void puffoid_update(struct Moby *moby) { &moby->pos, &moby->rot); if (puffoid_vars->unk214 != 2) { - puffoid_vars->unk24C = + puffoid_vars->chase_heading_offset_radians = random_float_between(-puffoid_chase_heading_offset_limit_degrees_gp, puffoid_chase_heading_offset_limit_degrees_gp) * 0.017453292f; @@ -584,7 +584,7 @@ void puffoid_update(struct Moby *moby) { float *rz = &moby->rot.z; float path_point_heading = fast_arc_tan(pos[0] - moby->pos.x, pos[1] - moby->pos.y); approach_angle(rz, - &puffoid_vars->unk250, + &puffoid_vars->yaw_turn_velocity, path_point_heading, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, From d63fdadeb3f8d0d77693d49dec9d6ebfff0c96fe Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:49:25 +0000 Subject: [PATCH 415/758] decomp: clarify names in bomb_update p2FC -> ground_support_moby: G910.p2FC -> ground_support_moby. Authoritative src/overlays/shared/weapons/bomb_glove_bomb.c SHA-256 13f5619f67c0607e5e3682f03adb67e28a839a429dfbc44010698b87ea2d0986 uses p2FC to choose landing-prediction modes. Retail 0x002adcac-0x002adcc4 loads hero base 0x0013f350 +0x2fc and passes the non-null pointer to 0x002603d0. Bounded checked predict_throw_landing evidence ed3d88dc7cf04c699f0f44ff580f4e80 (report SHA-256 4be25bc18ee6cb3bf34b3a957370c3d8b3c48dab5cd4ba4a886da7148dd2de62) establishes the same base in s0 at 0x002ad440, loads +0x2fc at 0x002ad558, calls 0x002603d0 at 0x002ad564, then conditionally adds hero displacement at +0x100 to predicted velocity at 0x002ad574-0x002ad584. This exactly corresponds to the supplied predict_throw_landing source's hero.ground_moby condition and displacement addition, proving the ground-support moby identity rather than merely an offset or helper argument. --- src/overlays/shared/weapons/bomb_glove_bomb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/bomb_glove_bomb.c b/src/overlays/shared/weapons/bomb_glove_bomb.c index e643f03fe7..02cd26685b 100644 --- a/src/overlays/shared/weapons/bomb_glove_bomb.c +++ b/src/overlays/shared/weapons/bomb_glove_bomb.c @@ -33,7 +33,7 @@ typedef struct { char p0[0x80]; float pos[4]; char p90[0x2FC - 0x90]; - unsigned char *p2FC; + unsigned char *ground_support_moby; char p300[0x1090 - 0x300]; M910 *hero; char p1094[0x2080 - 0x1094]; @@ -1136,7 +1136,7 @@ void bomb_update(BombMoby *bomb_moby) { bomb_moby->flags &= ~0x41; } if (d->owner->cls == 0xC0 && d->h56 == 0 && FUN_001f9af0_2adb30(d) > 0.0f) { - if (((G910 *)&hero)->p2FC == 0 || FUN_L00_002603d0_2adb30(((G910 *)&hero)->p2FC) == 0) { + if (((G910 *)&hero)->ground_support_moby == 0 || FUN_L00_002603d0_2adb30(((G910 *)&hero)->ground_support_moby) == 0) { FUN_L00_002ad410_2adb30(d, bomb_moby, 1); } else if (FUN_L00_002ad410_2adb30(d, bomb_moby, 0) == 0) { FUN_L00_002ad410_2adb30(d, bomb_moby, 2); From 5ab85de80e0f34809329a5a5d8a6bda052b98f15 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:49:28 +0000 Subject: [PATCH 416/758] decomp: clarify names in circular_saw_enemy_update f2C -> damage_amount: Hit_35F0 declares float f2C and assigned source forces hit->f2C and dmg to 1.0f for attacker classes 0xB0/0xB1, then subtracts dmg from data->hp. Original retail Ghidra agrees. Retail 002c2468/002c2478 passes hit and &dmg to hit_reaction at 002c2480; checked level-04 helper 0024d4d0 saves hit in s4, 0024d4f4 saves the sixth-argument damage output pointer, and 0024d9a4-0024d9b4 copies float hit+0x2c directly to that output. Assigned 002c2588-002c258c overrides both to 1.0f, and 002c2594-002c25ac subtracts the output from HP. This establishes damage amount rather than an offset-only role. --- src/overlays/l04/mobys/circular_saw_enemy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l04/mobys/circular_saw_enemy.c b/src/overlays/l04/mobys/circular_saw_enemy.c index 0f41273e9c..837edac348 100644 --- a/src/overlays/l04/mobys/circular_saw_enemy.c +++ b/src/overlays/l04/mobys/circular_saw_enemy.c @@ -453,7 +453,7 @@ typedef struct { char pad00[0x20]; M_35F0 *att; char pad24[8]; - float f2C; + float damage_amount; } Hit_35F0; typedef struct { @@ -582,7 +582,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { data->fE4 = 9; data->fFD = 0; if ((unsigned int)(hit->att->cls.u - 0xB0) < 2) { - hit->f2C = 1.0f; + hit->damage_amount = 1.0f; dmg = 1.0f; } data->hp -= dmg; From 664e854d147b6c56b14cf82bc2c6cbf2a5a0bb7c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:54:19 +0000 Subject: [PATCH 417/758] decomp: clarify names in load_level_gameplay f16 -> shrub_instance_count: ShrubClass.f16 is reset on a shrub class change at retail 0x00242328-0x00242350 while +0x18 receives the first ShrubInst pointer. Retail 0x00242354-0x0024237c indexes the class table using shrub_class_index, loads unsigned short +0x16, adds one and stores it back for every loaded shrub. Original Ghidra and bound C prove a per-class shrub instance count. f2080 -> hero_moby: Assigned retail 0x00243c20 calls initialize_hero, and 0x00243c84-0x00243c90 loads HeroSpawn +0x2080 then copies that moby's +0x38 doubleword to level_render_state.player. Bounded level-00 helper 0x00204c60 confirms the referent: 0x00204d40 tests moby class +0xA6 for zero, 0x00204d58 stores the selected moby at D_0013F350+0x2080, and 0x00204d74-0x00204da8 uses it for ground height, flags, hero position and rotation. Original helper Ghidra uRam001413d0 agrees with the source comment that class zero marks the hero start. f23C -> background_red: LevelState16CB40.f23C receives the first hdr->f0 word at retail 0x00241b04-0x00241b0c, then is loaded into a0 at 0x00241be8 for set_background_color at 0x00241c0c. The supplied set_background_color(red, green, blue) source packs this first argument into the low RGB byte, proving the background red channel. f240 -> background_green: LevelState16CB40.f240 receives the second hdr->f0 word at retail 0x00241b10-0x00241b18, then is loaded into a1 at 0x00241be4 for set_background_color at 0x00241c0c. The supplied helper source shifts its green argument by eight bits in the clear-packet color, proving the background green channel. f244 -> background_blue: LevelState16CB40.f244 receives the third hdr->f0 word at retail 0x00241b1c-0x00241b24, then is loaded into a2 at 0x00241be0 for set_background_color at 0x00241c0c. The supplied helper source shifts its blue argument by sixteen bits in the clear-packet color, proving the background blue channel. f26 -> tie_instance_count: TieClass.f26 is zeroed when the loaded tie class changes at retail 0x00241f98-0x00241fc8, alongside saving that class's first TieInst pointer at +0x28. Retail 0x00241fd4-0x00241ffc indexes the class by inst->f1A and increments its unsigned short +0x26 once for each initialized tie instance. Original Ghidra and current C agree, proving a per-class tie instance count. --- .../shared/world/load_level_gameplay.c | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/overlays/shared/world/load_level_gameplay.c b/src/overlays/shared/world/load_level_gameplay.c index b00b56f2c6..2f1957652d 100644 --- a/src/overlays/shared/world/load_level_gameplay.c +++ b/src/overlays/shared/world/load_level_gameplay.c @@ -191,9 +191,9 @@ typedef struct { typedef struct { char pad0[0x23C]; - int f23C; - int f240; - int f244; + int background_red; + int background_green; + int background_blue; } LevelState16CB40; typedef struct { @@ -230,7 +230,7 @@ typedef struct TieInst { typedef struct { char pad0[0x26]; - unsigned short f26; + unsigned short tie_instance_count; TieInst *f28; char pad2C[4]; float f30[3]; @@ -266,7 +266,7 @@ typedef struct { char pad0[0xC]; float fC; char pad10[6]; - unsigned short f16; + unsigned short shrub_instance_count; ShrubInst *f18; float *f1C; float f20; @@ -357,7 +357,7 @@ typedef struct { typedef struct { char pad0[0x2080]; - MobyInst *f2080; + MobyInst *hero_moby; char pad2084[0x28C]; } HeroSpawn; @@ -553,9 +553,9 @@ char *load_level_gameplay(int skip_gameplay_read) { int *p = (int *)((char *)hdr + hdr->f0); int *ship_spawn_settings; - D_L00_0016CA40.f23C = *p++; - D_L00_0016CA40.f240 = *p++; - D_L00_0016CA40.f244 = *p++; + D_L00_0016CA40.background_red = *p++; + D_L00_0016CA40.background_green = *p++; + D_L00_0016CA40.background_blue = *p++; *(unsigned char *)&D_L00_0015F444 = *p++; *(unsigned char *)&D_L00_0015F445 = *p++; *(unsigned char *)&D_L00_0015F446 = *p++; @@ -577,7 +577,7 @@ char *load_level_gameplay(int skip_gameplay_read) { D_L00_001604A4 = 500.0f; D_L00_0015FFF0 = 500; D_L00_0016017C = 0x1F4000; - set_background_color(D_L00_0016CA40.f23C, D_L00_0016CA40.f240, D_L00_0016CA40.f244); + set_background_color(D_L00_0016CA40.background_red, D_L00_0016CA40.background_green, D_L00_0016CA40.background_blue); vu0_load_micro_program(D_00100AE0); fast_mem_zero16(point_lights, 0x100); fast_mem_zero16(D_L00_001804C0, 0x180); @@ -695,10 +695,10 @@ char *load_level_gameplay(int skip_gameplay_read) { inst->f1A = D_L00_001C5B00[*(int *)p]; if (inst->f1A != last) { D_L00_001C5800[inst->f1A]->f28 = inst; - D_L00_001C5800[inst->f1A]->f26 = 0; + D_L00_001C5800[inst->f1A]->tie_instance_count = 0; last = inst->f1A; } - D_L00_001C5800[inst->f1A]->f26++; + D_L00_001C5800[inst->f1A]->tie_instance_count++; inst->f10 = mtx; inst->f14 = (float)*(int *)(p + 4); inst->f1E = 0xFFFF; @@ -775,9 +775,9 @@ char *load_level_gameplay(int skip_gameplay_read) { if (shrub_class_index != last) { last = shrub_class_index; D_L00_001BC030[shrub_class_index]->f18 = inst; - D_L00_001BC030[shrub_class_index]->f16 = 0; + D_L00_001BC030[shrub_class_index]->shrub_instance_count = 0; } - D_L00_001BC030[shrub_class_index]->f16++; + D_L00_001BC030[shrub_class_index]->shrub_instance_count++; inst->f18 = i; inst->f10 = *(float *)(p + 4); if (inst->f10 < 16.0f) { @@ -1653,7 +1653,7 @@ char *load_level_gameplay(int skip_gameplay_read) { D_L00_0015F5CC = 0; D_L00_0015F63C = 0; if (level_render_state.player != 0) { - *(long *)&((MobyInst *)level_render_state.player)->f38 = *(long *)&D_0013F350.f2080->f38; + *(long *)&((MobyInst *)level_render_state.player)->f38 = *(long *)&D_0013F350.hero_moby->f38; } switch (D_0015ED84) { case 2: From 53871bfa6744562be61fcd3170f7a637603a535b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:54:22 +0000 Subject: [PATCH 418/758] decomp: clarify names in peckbot_update p40 -> combat_target_moby: Mob577Target is filled by established select_moby_combat_target: retail 0x002efcd8 sets its output base to sp+0x20 and 0x002efd04 calls target selection with that record. Retail 0x002efd0c loads sp+0x60, exactly output+0x40, into s5; source assigns target.p40 to the existing target_moby local. In ATTACK_TARGET, 0x002f1170 null-checks s5 and 0x002f1180 passes it as a0 to the target-associated effect at 0x002f118c, alongside the peckbot and selected target position. Original Ghidra iStack_100 follows the same output-to-effect flow. Thus this private pointer member identifies the selected combat target moby, without asserting its class. --- 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 5d8af93714..147519e438 100644 --- a/src/overlays/l01/mobys/peckbot.c +++ b/src/overlays/l01/mobys/peckbot.c @@ -158,7 +158,7 @@ typedef struct { typedef struct { Vec577 pos; u8 pad10[0x30]; - void *p40; + void *combat_target_moby; u8 pad44[0xC]; } Mob577Target; @@ -265,7 +265,7 @@ void peckbot_update(Mob577 *peckbot_moby) { peckbot_moby->id = peckbot_moby->ref->id; peckbot_moby->flags &= ~0x41; select_moby_combat_target(peckbot_moby, &target, peckbot_vars->range + 4.0f); - target_moby = target.p40; + target_moby = target.combat_target_moby; qcopy(&oldpos, &peckbot_moby->pos); if (peckbot_vars->x38 != 0) { peckbot_vars->x214 = scale_game_frames(0xF0); From d75c27a54b951e8934d94dbcef0db72144a7cf55 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:54:26 +0000 Subject: [PATCH 419/758] decomp: clarify names in qwarks_starfighter_update b10C -> path_traversal_direction: Assigned retail 0x002eb354 and 0x002ec7b4 initialize +0x10C to 1. Checked path helper 0x002e9228-0x002e9240 sign-extends this byte, copies target +0x9C to previous +0x9E, and adds the byte to the next target index. Supplied away-from-hero helper chooses +1/-1 here when reversing path traversal. b13A -> queued_voice_line_pending: Assigned retail 0x002ecbdc-0x002ecc1c tests private +0x13A, waits for dialogue_playback_phase 3, continues the audio stream, reloads voice cooldowns and clears the byte. Checked voice helper 0x002e8870-0x002e8894 and 0x002e88cc-0x002e88e4 sets it to 1 exactly when writing a queued secondary voice track. Supplied queue source agrees. b13B -> selected_path_slot: Retail 0x002eb5c8-0x002eb618 maps moby command through qwarks_starfighter_command_path_slots into private +0x13B, then indexes paths at +0xB0 with that byte before walker_paths. 0x002eb710-0x002eb720 passes it as the path slot to the path-following helper. Original Ghidra and authoritative C agree. f74 -> flight_velocity_y: Retail 0x002eb2fc-0x002eb320 initializes float +0x74 to sin(moby yaw)*private speed +0xAC, alongside cos(yaw)*speed at +0x70 and zero Z at +0x78. Checked path helper 0x002e92c0-0x002e933c blends and normalizes the vector at +0x70 and adds it to moby position. +0x74 is its Y displacement/velocity component. i100 -> tractor_beam_cycle_timer_frames: Assigned retail 0x002ebbd0-0x002ebc68 clears +0x100 on beam collision/offscreen/length abort. Checked attack helper 0x002ead0c decrements this field; 0x002ead90-0x002eae10 requires zero then loads scale_game_frames(600) when entering tractor state 5. 0x002eaed0-0x002eaf0c waits for expiry and reloads it when leaving tractor state, proving the beam cycle timer. i108 -> health_hud_packed_value: Assigned retail 0x002eb0e8-0x002eb19c packs current health from +0x20 into +0x108 using a four-bit shift, masks and a within-stage segment nibble. Retail 0x002eb510-0x002eb540 passes its address as animation context to the numeric HUD callbacks with maximum health (+0x24 <<4)|15. Original Ghidra and source agree on both producer and HUD consumer. i124 -> attack_cooldown_frames: Assigned retail 0x002ec7fc clears +0x124 on reset. Checked attack helper 0x002ead04-0x002ead08 decrements it; 0x002eade0 and 0x002eae58 gate beam entry/attack changes on zero. Mine firing 0x002eaeb4 loads scaled 240 into it, rocket firing 0x002eaf4c loads scaled 120, stored at 0x002eaf70. Supplied command source confirms this shared attack cooldown. i12C -> vendor_item_id: Assigned retail 0x002ec5e8-0x002ec5ec loads private +0x12C directly as the sole argument to established flag_vendor_item after explosion timer expiry and before removing the starfighter. Original Ghidra case 8 uses private+300 for that call. Supplied begin_starfighter_death_sequence also passes the same stored identifier to activate_descriptor; no item subtype or reward is inferred. i134 -> linked_ship_moby_index: Assigned retail 0x002ec5ac-0x002ec5c8 reads private +0x134, shifts it eight bits and adds moby_base to write the linked Moby state. 0x002ecb30-0x002ecb78 resolves the same index, validates ship class 0x45 and checks removal/unavailable states. Original Ghidra and C show an instance index, not a pointer or a hero-state enum selector. i13C -> voice_line_history_mask: Assigned retail 0x002eb3a4 initializes private +0x13C to zero and death-flight branches 0x002ec42c-0x002ec4ac test/clear voice gating bits. Checked queue helper 0x002e8804-0x002e8810 shifts this field by the selected voice-line ID to suppress repetition; 0x002e8878-0x002e8894 ORs that ID's bit when queued, with controlled bit clearing at 0x002e8830-0x002e8840. s24 -> starfighter_max_health: Authoritative C overlays private +0x20/+0x24 with Sub.health/max_health in process_moby_attachment_damage; max_health determines six health-stage thresholds. Assigned retail 0x002eb36c-0x002eb390 initializes current float health from this short, and 0x002eb4a4-0x002eb4d8 adjusts maximum/current health together. 0x002eb510-0x002eb540 supplies maximum shifted four bits to the health HUD. s9C -> path_target_node_index: Retail 0x002eb614-0x002eb674 initializes private +0x9C from select_point_index_by_distance, offsets it and reduces it modulo the selected path point count. Checked helper 0x002e92d4-0x002e92ec indexes that path point and subtracts moby position to steer toward it; 0x002e9238-0x002e9240 advances it after reaching a segment end. s9E -> path_previous_node_index: Assigned retail 0x002eb670-0x002eb6ac sets +0x9E to target +0x9C minus one, wrapping at the path count. Checked helper 0x002e91ac-0x002e91f4 measures distance from that node and the segment to target +0x9C; 0x002e9238 copies the reached target into +0x9E. This proves previous traversal node rather than a second unrelated index. v80 -> tractor_beam_endpoint: Original Ghidra case 5 and assigned retail 0x002eb8a0, 0x002eb9ac-0x002eb9e0 move private vector +0x80 toward hero position. 0x002ebdec-0x002ebdf0 copies it into the captured hero ship position; collision_line uses it as the beam end at 0x002ebbac-0x002ebbbc. Supplied draw_starfighter_tractor_beam subtracts joint 0x13 position from this same vector. --- src/overlays/l13/mobys/qwarks_starfighter.c | 216 ++++++++++---------- 1 file changed, 108 insertions(+), 108 deletions(-) diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index a4dfc190ca..580124a783 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -1446,16 +1446,16 @@ void update_qwarks_starfighter_attack_commands(void *mobyp, void *pp) { typedef struct { char pad0[0x20]; float f20; - short s24; + short starfighter_max_health; char pad26[0x4A]; float f70; - float f74; + float flight_velocity_y; int i78; int pad7C; - float v80[4]; + float tractor_beam_endpoint[4]; char pad90[0xC]; - short s9C; - short s9E; + short path_target_node_index; + short path_previous_node_index; int iA0; float fA4; float fA8; @@ -1470,10 +1470,10 @@ typedef struct { unsigned char bFD; unsigned char bFE; unsigned char bFF; - int i100; + int tractor_beam_cycle_timer_frames; int hud104; - int i108; - unsigned char b10C; + int health_hud_packed_value; + unsigned char path_traversal_direction; unsigned char b10D; unsigned char b10E; unsigned char b10F; @@ -1482,15 +1482,15 @@ typedef struct { int snd118; int snd11C; int light120; - int i124; + int attack_cooldown_frames; int pad128; - int i12C; + int vendor_item_id; int pad130; - int i134; + int linked_ship_moby_index; unsigned short h138; - unsigned char b13A; - unsigned char b13B; - int i13C; + unsigned char queued_voice_line_pending; + unsigned char selected_path_slot; + int voice_line_history_mask; int pad140; short h144; short h146; @@ -1634,20 +1634,20 @@ void qwarks_starfighter_update(Moby388 *moby) { float probe[4]; int i; - starfighter_vars->i108 = truncate_float_to_s32(starfighter_vars->f20 * 16.0f) & 0xFFF0; - if (starfighter_vars->i108 >= - truncate_float_to_s32(((float)starfighter_vars->s24 - 0.5f) * 16.0f)) { - starfighter_vars->i108 |= 0xF; + starfighter_vars->health_hud_packed_value = truncate_float_to_s32(starfighter_vars->f20 * 16.0f) & 0xFFF0; + if (starfighter_vars->health_hud_packed_value >= + truncate_float_to_s32(((float)starfighter_vars->starfighter_max_health - 0.5f) * 16.0f)) { + starfighter_vars->health_hud_packed_value |= 0xF; } if (0.5f < starfighter_vars->f20) { int segment = - ((truncate_float_to_s32(starfighter_vars->f20) % (starfighter_vars->s24 / 6)) * 16) / - (starfighter_vars->s24 / 6); + ((truncate_float_to_s32(starfighter_vars->f20) % (starfighter_vars->starfighter_max_health / 6)) * 16) / + (starfighter_vars->starfighter_max_health / 6); if (segment < 0) segment = 0; - starfighter_vars->i108 += segment & 0xF; + starfighter_vars->health_hud_packed_value += segment & 0xF; } else { - starfighter_vars->i108 = 0; + starfighter_vars->health_hud_packed_value = 0; } switch (moby->state) { @@ -1671,14 +1671,14 @@ void qwarks_starfighter_update(Moby388 *moby) { } starfighter_vars->fAC = frame_time * 42.0f * 0.1f; starfighter_vars->f70 = fast_cos(moby->rot[2]) * starfighter_vars->fAC; - starfighter_vars->f74 = fast_sin(moby->rot[2]) * starfighter_vars->fAC; + starfighter_vars->flight_velocity_y = fast_sin(moby->rot[2]) * starfighter_vars->fAC; starfighter_vars->i78 = 0; qcopy(moby->pos, walker_paths[starfighter_vars->paths[0]] + 0x10); - starfighter_vars->s9E = 0; - starfighter_vars->s9C = 1; + starfighter_vars->path_previous_node_index = 0; + starfighter_vars->path_target_node_index = 1; moby->b30 = 0xFF; moby->s32 = 0xFF; - starfighter_vars->b10C = 1; + starfighter_vars->path_traversal_direction = 1; starfighter_vars->bFE = 0; starfighter_vars->bFC = 0; moby->state = STARFIGHTER_STATE_WAIT_FOR_HERO_SHIP; @@ -1687,11 +1687,11 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->snd114 = -1; starfighter_vars->snd118 = -1; starfighter_vars->snd11C = -1; - starfighter_vars->f20 = starfighter_vars->s24; + starfighter_vars->f20 = starfighter_vars->starfighter_max_health; starfighter_vars->light120 = -1; starfighter_vars->h138 = 0; starfighter_vars->b148 = 0; - starfighter_vars->i13C = 0; + starfighter_vars->voice_line_history_mask = 0; if (starfighter_vars->hud104 != -1) { set_animation_parameter(starfighter_vars->hud104, 0); starfighter_vars->hud104 = -1; @@ -1719,12 +1719,12 @@ void qwarks_starfighter_update(Moby388 *moby) { elapsed = (unsigned int)(D_0015EEA4 - l13_starfighter_boss_start_counter) / 360; if (elapsed >= 0x29) { DebugPrint_alt(qwarks_starfighter_high_elapsed_time_adjustment_message); - starfighter_vars->s24 = 0x66; + starfighter_vars->starfighter_max_health = 0x66; starfighter_vars->f20 = 102.0f; *(int *)(ship + 0x138) = 0x221; } else if (elapsed >= 0x1A) { DebugPrint_alt(qwarks_starfighter_mid_elapsed_time_adjustment_message); - starfighter_vars->s24 = 0x78; + starfighter_vars->starfighter_max_health = 0x78; starfighter_vars->f20 = 120.0f; *(int *)(ship + 0x138) = 0x234; } @@ -1746,8 +1746,8 @@ void qwarks_starfighter_update(Moby388 *moby) { (int)reset_numeric_hud_element, (int)hud_update_counter, (int)FUN_L06_00249738, - (int)&starfighter_vars->i108, - (starfighter_vars->s24 << 4) | 0xF); + (int)&starfighter_vars->health_hud_packed_value, + (starfighter_vars->starfighter_max_health << 4) | 0xF); starfighter_vars->fAC += (frame_time * 42.0f - starfighter_vars->fAC) * 0.1f; if (advance_moby_along_selected_path(moby, starfighter_vars, 0, 1) != 0) { char *hero = ((char *)&D_0013F350); @@ -1758,21 +1758,21 @@ void qwarks_starfighter_update(Moby388 *moby) { *(int *)(ship + 0xEC) = 0; *(int *)(ship + 0x8C) = 0; *(int *)(ship + 0x118) = 0; - starfighter_vars->b13B = qwarks_starfighter_command_path_slots[moby->bBC]; + starfighter_vars->selected_path_slot = qwarks_starfighter_command_path_slots[moby->bBC]; starfighter_vars->iF8 = scale_game_frames(0x14); moby->state = STARFIGHTER_STATE_FOLLOW_COMMAND_PATH; - starfighter_vars->s9C = select_point_index_by_distance( - moby->pos, walker_paths[starfighter_vars->paths[starfighter_vars->b13B]], 0.0f); - starfighter_vars->s9C = + starfighter_vars->path_target_node_index = select_point_index_by_distance( + moby->pos, walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]], 0.0f); + starfighter_vars->path_target_node_index = *(unsigned short *)((char *)starfighter_vars + 0x9C) + random_int_between(3, 7); - starfighter_vars->s9C = - starfighter_vars->s9C % - *(int *)walker_paths[starfighter_vars->paths[starfighter_vars->b13B]]; - starfighter_vars->s9E = starfighter_vars->s9C - 1; - if (starfighter_vars->s9E < 0) { - starfighter_vars->s9E = + starfighter_vars->path_target_node_index = + starfighter_vars->path_target_node_index % + *(int *)walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; + starfighter_vars->path_previous_node_index = starfighter_vars->path_target_node_index - 1; + if (starfighter_vars->path_previous_node_index < 0) { + starfighter_vars->path_previous_node_index = *(unsigned short *) - walker_paths[starfighter_vars->paths[starfighter_vars->b13B]] - + walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]] - 1; } } @@ -1785,33 +1785,33 @@ void qwarks_starfighter_update(Moby388 *moby) { (int)reset_numeric_hud_element, (int)hud_update_counter, (int)FUN_L06_00249738, - (int)&starfighter_vars->i108, - (starfighter_vars->s24 << 4) | 0xF); + (int)&starfighter_vars->health_hud_packed_value, + (starfighter_vars->starfighter_max_health << 4) | 0xF); if (*(Moby388 **)(((char *)&D_00140940)) != 0 && (*(Moby388 **)(((char *)&D_00140940)))->cls_id == 0x45) { (*(Moby388 **)(((char *)&D_00140940)))->bBC = 0; } update_qwarks_starfighter_attack_commands(moby, starfighter_vars); if (update_moby_path_following_away_from_hero( - moby, starfighter_vars, starfighter_vars->b13B, 1) & + moby, starfighter_vars, starfighter_vars->selected_path_slot, 1) & 2) { - if (starfighter_vars->b13B != qwarks_starfighter_command_path_slots[moby->bBC]) { - starfighter_vars->b13B = qwarks_starfighter_command_path_slots[moby->bBC]; - starfighter_vars->s9C = select_point_index_by_distance( + if (starfighter_vars->selected_path_slot != qwarks_starfighter_command_path_slots[moby->bBC]) { + starfighter_vars->selected_path_slot = qwarks_starfighter_command_path_slots[moby->bBC]; + starfighter_vars->path_target_node_index = select_point_index_by_distance( moby->pos, walker_paths[starfighter_vars ->paths[qwarks_starfighter_command_path_slots[moby->bBC]]], 0.0f); - starfighter_vars->s9C = + starfighter_vars->path_target_node_index = *(unsigned short *)((char *)starfighter_vars + 0x9C) + random_int_between(3, 7); - starfighter_vars->s9C = - starfighter_vars->s9C % + starfighter_vars->path_target_node_index = + starfighter_vars->path_target_node_index % *(int *) walker_paths[starfighter_vars ->paths[qwarks_starfighter_command_path_slots[moby->bBC]]]; - starfighter_vars->s9E = starfighter_vars->s9C - 1; - if (starfighter_vars->s9E < 0) { - starfighter_vars->s9E = + starfighter_vars->path_previous_node_index = starfighter_vars->path_target_node_index - 1; + if (starfighter_vars->path_previous_node_index < 0) { + starfighter_vars->path_previous_node_index = *(unsigned short *) walker_paths[starfighter_vars->paths [qwarks_starfighter_command_path_slots[moby->bBC]]] - @@ -1832,11 +1832,11 @@ void qwarks_starfighter_update(Moby388 *moby) { (int)reset_numeric_hud_element, (int)hud_update_counter, (int)FUN_L06_00249738, - (int)&starfighter_vars->i108, - (starfighter_vars->s24 << 4) | 0xF); + (int)&starfighter_vars->health_hud_packed_value, + (starfighter_vars->starfighter_max_health << 4) | 0xF); update_qwarks_starfighter_attack_commands(moby, starfighter_vars); FUN_L00_0024f7c8(moby, 0x13, joint); - hero_distance = fast_vec_dist(starfighter_vars->v80, ((char *)&D_0013F3D0)); + hero_distance = fast_vec_dist(starfighter_vars->tractor_beam_endpoint, ((char *)&D_0013F3D0)); if (starfighter_vars->snd11C != -1) { char *voice = D_0013E633_snd + 0x1D + starfighter_vars->snd11C * 0x70; if (*(Moby388 **)(voice + 0x88) == moby && *(unsigned char *)(voice + 0x74) != 0) @@ -1855,9 +1855,9 @@ void qwarks_starfighter_update(Moby388 *moby) { } starfighter_vars->fAC += (frame_time * 30.0f - starfighter_vars->fAC) * 0.1f; if (frame_time * 40.0f < hero_distance) { - fast_vec_sub(offset, ((char *)&D_0013F3D0), starfighter_vars->v80); + fast_vec_sub(offset, ((char *)&D_0013F3D0), starfighter_vars->tractor_beam_endpoint); fast_vec_normalize(offset, offset, frame_time * 40.0f); - fast_vec_add(starfighter_vars->v80, starfighter_vars->v80, offset); + fast_vec_add(starfighter_vars->tractor_beam_endpoint, starfighter_vars->tractor_beam_endpoint, offset); } else { qcopy(offset, ((char *)&D_0013F3D0)); starfighter_vars->iF8 = scale_game_frames(0x78); @@ -1869,25 +1869,25 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->bFF = 1; } if (advance_moby_along_selected_path( - moby, starfighter_vars, starfighter_vars->b13B, 1) & + moby, starfighter_vars, starfighter_vars->selected_path_slot, 1) & 2) { - if (starfighter_vars->b13B != qwarks_starfighter_command_path_slots[moby->bBC]) { - starfighter_vars->b13B = qwarks_starfighter_command_path_slots[moby->bBC]; - starfighter_vars->s9C = select_point_index_by_distance( + if (starfighter_vars->selected_path_slot != qwarks_starfighter_command_path_slots[moby->bBC]) { + starfighter_vars->selected_path_slot = qwarks_starfighter_command_path_slots[moby->bBC]; + starfighter_vars->path_target_node_index = select_point_index_by_distance( moby->pos, walker_paths[starfighter_vars ->paths[qwarks_starfighter_command_path_slots[moby->bBC]]], 0.0f); - starfighter_vars->s9C = *(unsigned short *)((char *)starfighter_vars + 0x9C) + + starfighter_vars->path_target_node_index = *(unsigned short *)((char *)starfighter_vars + 0x9C) + random_int_between(3, 7); - starfighter_vars->s9C = - starfighter_vars->s9C % + starfighter_vars->path_target_node_index = + starfighter_vars->path_target_node_index % *(int *) walker_paths[starfighter_vars->paths [qwarks_starfighter_command_path_slots[moby->bBC]]]; - starfighter_vars->s9E = starfighter_vars->s9C - 1; - if (starfighter_vars->s9E < 0) { - starfighter_vars->s9E = + starfighter_vars->path_previous_node_index = starfighter_vars->path_target_node_index - 1; + if (starfighter_vars->path_previous_node_index < 0) { + starfighter_vars->path_previous_node_index = *(unsigned short *)walker_paths [starfighter_vars ->paths[qwarks_starfighter_command_path_slots[moby->bBC]]] - @@ -1895,23 +1895,23 @@ void qwarks_starfighter_update(Moby388 *moby) { } } } - fast_vec_sub(ray_start, starfighter_vars->v80, joint); + fast_vec_sub(ray_start, starfighter_vars->tractor_beam_endpoint, joint); fast_vec_normalize(ray_start, ray_start, 8.0f); fast_vec_add(ray_start, ray_start, joint); - if (collision_line(ray_start, starfighter_vars->v80, 0, moby, 0) != 0) { + if (collision_line(ray_start, starfighter_vars->tractor_beam_endpoint, 0, moby, 0) != 0) { if (D_L13_00174158[0] == 0 || D_L13_00174158[0]->cls_id == 0xD4) { - starfighter_vars->i100 = 0; + starfighter_vars->tractor_beam_cycle_timer_frames = 0; } } - qcopy(probe, starfighter_vars->v80); + qcopy(probe, starfighter_vars->tractor_beam_endpoint); probe[3] = 1.0f; if (fast_bsphere_check(probe, 100.0f) <= 0 && moby->b31 == 0) { DebugPrint_alt(qwarks_starfighter_tractor_offscreen_abort_message); - starfighter_vars->i100 = 0; + starfighter_vars->tractor_beam_cycle_timer_frames = 0; } if (fast_vec_dist(ray_start, ((char *)&D_0013F3D0)) > 100.0f) { DebugPrint_alt(D_L13_001F4F38); - starfighter_vars->i100 = 0; + starfighter_vars->tractor_beam_cycle_timer_frames = 0; } } else { char *hero = ((char *)&D_0013F350); @@ -1928,16 +1928,16 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->fAC *= 0.8f; fast_vec_dist(moby->pos, ((char *)&D_0013F3D0)); FUN_L00_0024f7c8(moby, 0x13, probe); - fast_vec_sub(ray_start, starfighter_vars->v80, probe); + 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->v80); + fast_vec_sub(offset, 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, (frame_time * 15.0f < distance) ? frame_time * 15.0f : distance); - fast_vec_add(starfighter_vars->v80, starfighter_vars->v80, offset); + fast_vec_add(starfighter_vars->tractor_beam_endpoint, starfighter_vars->tractor_beam_endpoint, offset); } { char *hero = ((char *)&D_0013F350); @@ -1945,7 +1945,7 @@ void qwarks_starfighter_update(Moby388 *moby) { Moby388 *ship_moby = *(Moby388 **)(hero + 0x15F0); char *ship; float yaw_error, abs_yaw_error, pitch_error, abs_pitch_error; - qcopy(ship_moby->pos, starfighter_vars->v80); + qcopy(ship_moby->pos, starfighter_vars->tractor_beam_endpoint); ship = (char *)ship_moby->d; yaw_error = fast_subtract_rotations(fast_arc_tan(moby->pos[0] - ship_moby->pos[0], @@ -1995,7 +1995,7 @@ void qwarks_starfighter_update(Moby388 *moby) { (*(Moby388 **)(((char *)&D_00140940)))->cls_id == 0x45) { (*(Moby388 **)(((char *)&D_00140940)))->bBC = 0; } - advance_moby_along_selected_path(moby, starfighter_vars, starfighter_vars->b13B, 1); + advance_moby_along_selected_path(moby, starfighter_vars, starfighter_vars->selected_path_slot, 1); dialog = (char *)&music_stream_state; if (*(int *)(dialog + 0x50) == 0) { int line = *(int *)(dialog + 0x1C); @@ -2020,32 +2020,32 @@ void qwarks_starfighter_update(Moby388 *moby) { allocate_voice_for_target_entry(7, 0, (int)moby); } fast_dec_timer(&starfighter_vars->iF8); - if (advance_moby_along_selected_path(moby, starfighter_vars, starfighter_vars->b13B, 0) != + if (advance_moby_along_selected_path(moby, starfighter_vars, starfighter_vars->selected_path_slot, 0) != 0 || - starfighter_vars->s9C >= - *(int *)walker_paths[starfighter_vars->paths[starfighter_vars->b13B]] - 1) { + starfighter_vars->path_target_node_index >= + *(int *)walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]] - 1) { starfighter_vars->iF8 = scale_game_frames(0xB4); moby->state = STARFIGHTER_STATE_EXPLODE_AND_REMOVE; } moby->rot[0] = fast_add_rotations(moby->rot[0], frame_time * 4.1887903f); { Path388 *path = - (Path388 *)walker_paths[starfighter_vars->paths[starfighter_vars->b13B]]; - int i = starfighter_vars->s9C; + (Path388 *)walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; + int i = starfighter_vars->path_target_node_index; int n = path->n; target_yaw = fast_arc_tan(path->pts[(i + 3 >= n - 1) ? n - 1 : i + 3][0] - path->pts[i][0], path->pts[(i + 3 < n - 1) ? i + 3 : n - 1][1] - path->pts[i][1]); } { - char *path = walker_paths[starfighter_vars->paths[starfighter_vars->b13B]]; - int i = starfighter_vars->s9C; + char *path = walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; + int i = starfighter_vars->path_target_node_index; int n = *(int *)path; float flat_distance = vector_distance_xy( path + (i * 16 + 0x10), path + (((i + 3 >= n - 1) ? n - 1 : i + 3) * 16 + 0x10)); Path388 *path2 = - (Path388 *)walker_paths[starfighter_vars->paths[starfighter_vars->b13B]]; - int i2 = starfighter_vars->s9C; + (Path388 *)walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; + int i2 = starfighter_vars->path_target_node_index; int path_point_count = path2->n; target_pitch = -fast_arc_tan( flat_distance, @@ -2081,14 +2081,14 @@ void qwarks_starfighter_update(Moby388 *moby) { char *dialog = (char *)&music_stream_state; if (*(int *)(dialog + 0x50) == 0 && *(int *)(dialog + 0x1C) == -1) { if (starfighter_vars->iF8 < scale_game_frames(0x1A4) && - starfighter_vars->i13C < 0) { + starfighter_vars->voice_line_history_mask < 0) { if (queue_starfighter_voice_line(moby, starfighter_vars, 0x23, 1) != 0) { - starfighter_vars->i13C &= 0x7FFFFFFF; + starfighter_vars->voice_line_history_mask &= 0x7FFFFFFF; } } else if (starfighter_vars->iF8 < scale_game_frames(0xB4) && - (starfighter_vars->i13C & 0x40000000) && + (starfighter_vars->voice_line_history_mask & 0x40000000) && queue_starfighter_voice_line(moby, starfighter_vars, 0x24, 1) != 0) { - starfighter_vars->i13C &= 0xBFFFFFFF; + starfighter_vars->voice_line_history_mask &= 0xBFFFFFFF; } } } @@ -2127,13 +2127,13 @@ void qwarks_starfighter_update(Moby388 *moby) { } func_L13_002E9F90_2(moby, starfighter_vars); if (fast_dec_timer(&starfighter_vars->iF8) != 0) { - Moby388 *owner = (Moby388 *)((char *)moby_base + (starfighter_vars->i134 << 8)); + Moby388 *owner = (Moby388 *)((char *)moby_base + (starfighter_vars->linked_ship_moby_index << 8)); owner->state = 8; owner->flags |= 2; if (starfighter_vars->light120 != -1) { release_point_light_slot(starfighter_vars->light120); } - flag_vendor_item(starfighter_vars->i12C); + flag_vendor_item(starfighter_vars->vendor_item_id); mark_moby_for_removal(moby); return; } @@ -2189,9 +2189,9 @@ void qwarks_starfighter_update(Moby388 *moby) { qcopy(moby->pos, path + 0x10); moby->rot[2] = fast_arc_tan(*(float *)(path + 0x20) - moby->pos[0], *(float *)(path + 0x24) - moby->pos[1]); - starfighter_vars->b10C = 1; - starfighter_vars->s9C = 0; - starfighter_vars->s9E = 0; + starfighter_vars->path_traversal_direction = 1; + starfighter_vars->path_target_node_index = 0; + starfighter_vars->path_previous_node_index = 0; starfighter_vars->iA0 = 0; starfighter_vars->fA4 = 0; starfighter_vars->fA8 = 0; @@ -2202,21 +2202,21 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->bFD = 0; starfighter_vars->bFE = 0; starfighter_vars->bFF = 0; - starfighter_vars->i100 = 0; + starfighter_vars->tractor_beam_cycle_timer_frames = 0; starfighter_vars->b10D = 0; starfighter_vars->b10E = 0; starfighter_vars->b10F = 0; - starfighter_vars->i124 = 0; + starfighter_vars->attack_cooldown_frames = 0; starfighter_vars->h138 = 0; - starfighter_vars->b13A = 0; - starfighter_vars->b13B = 0; - starfighter_vars->i13C = 0; + starfighter_vars->queued_voice_line_pending = 0; + starfighter_vars->selected_path_slot = 0; + starfighter_vars->voice_line_history_mask = 0; starfighter_vars->h144 = 0; starfighter_vars->h146 = 0; starfighter_vars->b148 = 0; moby->bBC = 0; qzero(&starfighter_vars->f70); - qzero(starfighter_vars->v80); + qzero(starfighter_vars->tractor_beam_endpoint); moby->state = STARFIGHTER_STATE_INITIALIZE; return; } @@ -2303,7 +2303,7 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->b10F = 0; { - Moby388 *owner = (Moby388 *)((char *)moby_base + (starfighter_vars->i134 << 8)); + Moby388 *owner = (Moby388 *)((char *)moby_base + (starfighter_vars->linked_ship_moby_index << 8)); if (moby->state != STARFIGHTER_STATE_OWNER_UNAVAILABLE) { if (owner == 0 || owner->cls_id != 0x45 || owner->state == MOBY_STATE_REMOVAL_AT_OR_ABOVE_INSTANCE_END || @@ -2320,12 +2320,12 @@ void qwarks_starfighter_update(Moby388 *moby) { } } - if (starfighter_vars->b13A != 0) { + if (starfighter_vars->queued_voice_line_pending != 0) { if (dialogue_playback_phase[0] == 3) { continue_audio_stream_if_ready(); starfighter_vars->h144 = scale_game_frames(0x168); starfighter_vars->h146 = scale_game_frames(0x3C); - starfighter_vars->b13A = 0; + starfighter_vars->queued_voice_line_pending = 0; } } else { if (moby->state != STARFIGHTER_STATE_OWNER_UNAVAILABLE) { From 01b98b79f006d77ede5d13bebdfe0e325fb005aa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:56:47 +0000 Subject: [PATCH 420/758] decomp: clarify names in birdbot_update f194 -> yaw_turn_step: Retail 0x002e7398-0x002e73ac passes vars+0x194 to the facing helper with the target XY heading. Checked helper request dc52b2838e37420aa1967811996215e1 proves 0x0026d0e4-0x0026d104 updates this float as a damped spring step and 0x0026d18c-0x0026d198 adds it to moby+0x48, the yaw coordinate. f198 -> projectile_aim_distance: Exact C sets this float to 4.0 on burst entry (retail 0x002e74d8-0x002e74e8 and 0x002e801c-0x002e802c). Retail 0x002e7ba0-0x002e7be8 multiplies it by heading cosine/sine to offset the muzzle-copy aim point, then subtracts muzzle position to form projectile direction. f1A0 -> combat_target_radius: Retail 0x002e6cb8-0x002e6cd4 loads vars+0x1a0, optionally doubles it, and passes it to select_moby_combat_target. Original Ghidra and exact C also use this same base radius for XY firing gates and burst range termination at 0x002e73cc-0x002e73f8 and 0x002e7ce0-0x002e7d00. f1A8 -> deployment_trigger_radius: In WAIT_FOR_TRIGGER, retail 0x002e766c-0x002e7684 compares target XY distance with vars+0x1a8. Distance below it joins the activation branch, which restores moby collision state, selects deployment animation and writes state 3 at 0x002e7708-0x002e7750; exact C and original Ghidra show the other clip-volume/external triggers separately. f1B8 -> path_movement_step_length: Retail 0x002e80bc clears vars+0x1b8 on path entry. At 0x002e8254-0x002e8280 it is accelerated toward a time-scaled path-speed threshold; 0x002e82b0-0x002e82c8 uses it as spherical offset magnitude and adds that offset to position. Braking subtracts from it and multiplies yaw cosine/sine by it at 0x002e83a4-0x002e8400. Thus it is the per-update movement length, not a time-normalized speed. f1BC -> pitch_turn_step: Retail 0x002e80c0 clears vars+0x1bc. At 0x002e82d4-0x002e8320 its address is passed to spring_turn while current moby rotation+0x44 and a movement-derived pitch target are supplied, with the returned angle stored back to +0x44. The supplied spring_turn source proves its pointer argument holds the persistent damped angular step; braking reuses the same field. f1CC -> previous_animation_frame: Retail 0x002e6c40-0x002e6c50 saves compute_interpolated_record_value's current frame in f23. The firing branch reads vars+0x1cc at 0x002e7aec and requires stored frame<14 and current frame>=14 before projectile spawn. Common update 0x002e89b4 stores f23 to this field, proving it retains the previous update's animation frame for crossing detection. f80 -> knockback_gravity_step: Assigned lethal setup writes frame_time_sq*40 to vars+0x80 at 0x002e6e38; recoverable setups write 0.008. Calls 0x002e8608/0x002e87c8 pass vars+0x70 to step_moby_motion. Checked request b601151b1086421e8f8236100d7171f5 shows helper 0x00271594-0x002715a8 subtracts motion+0x10 (this field) from motion vector Z each update, then adds the vector to position at 0x00271a98-0x00271ab0. It supplies the downward knockback acceleration step. f88 -> knockback_horizontal_launch_step: Assigned hit branches initialize vars+0x88, allow trooper_knockback_arc to adjust it, then pass vars+0x70 to the start helper (0x002e6e6c-0x002e6ebc and corresponding nonfatal branches). Checked request 6772e320ad7c4e858be4799f620849f8 proves 0x00271454-0x00271474 multiplies motion+0x18 (vars+0x88) by heading cosine/sine to initialize motion X/Y, proving horizontal launch magnitude. f8C -> knockback_vertical_launch_step: Assigned hit branches initialize vars+0x8c to frame_time times 15, 8.5 or 5, pass its address to the arc helper, then call the knockback-start helper with vars+0x70. Checked request 6772e320ad7c4e858be4799f620849f8 shows 0x00271470 loads motion+0x1c (vars+0x8c) and 0x0027148c copies it into motion vector Z (+8); step_moby_motion subsequently adds that vector to position. f98 -> knockback_collision_height_offset: Assigned hit setups write 0.3 or 0.5 to vars+0x98 (0x002e6e2c/0x002e6f38) and pass vars+0x70 to step_moby_motion. Checked request b601151b1086421e8f8236100d7171f5 proves helper motion+0x28 (vars+0x98) is added to position Z for ground probing at 0x00271624-0x00271648 and collision paths at 0x00271a94-0x00271adc, then subtracted from collision position Z at 0x00271c04-0x00271c30. This proves a collision/ground height offset. v180 -> projectile_aim_point: Retail 0x002e7b20-0x002e7b38 obtains muzzle position and copies it into vars+0x180. At 0x002e7ba0-0x002e7be8 heading cosine/sine offsets its XY coordinates, then subtracts muzzle position from it to form the normalized vector passed to spawn_birdbot_projectile at 0x002e7c84-0x002e7c9c. Original Ghidra and exact C agree this is the constructed projectile aim point. v1D0 -> deployment_motion_delta: During cuboid-directed deployment, retail 0x002e7894 sets s0=vars+0x1d0. At 0x002e78ec-0x002e7968 its magnitude is measured and its direction blended toward the destination; subsequent branches adjust magnitude. Retail 0x002e7a0c-0x002e7a18 adds this vector directly to moby position, proving a per-update deployment motion delta rather than a destination position. --- src/overlays/l01/mobys/birdbot.c | 150 +++++++++++++++---------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/src/overlays/l01/mobys/birdbot.c b/src/overlays/l01/mobys/birdbot.c index d1ba587343..689bdf5d77 100644 --- a/src/overlays/l01/mobys/birdbot.c +++ b/src/overlays/l01/mobys/birdbot.c @@ -315,13 +315,13 @@ typedef struct { unsigned char b67; char pad68[8]; char x70[0x10]; - float f80; + float knockback_gravity_step; float f84; - float f88; - float f8C; + float knockback_horizontal_launch_step; + float knockback_vertical_launch_step; int w90; int w94; - float f98; + float knockback_collision_height_offset; char pad9C[0x11]; unsigned char bAD; char padAE[0x12]; @@ -345,26 +345,26 @@ typedef struct { char pad138[0x18]; PeCursor main; char pad168[0x18]; - Vec4 v180; + Vec4 projectile_aim_point; int w190; - float f194; - float f198; + float yaw_turn_step; + float projectile_aim_distance; char pad19C[4]; - float f1A0; + float combat_target_radius; short h1A4; short h1A6; - float f1A8; + float deployment_trigger_radius; short h1AC; short h1AE; char pad1B0[4]; int w1B4; - float f1B8; - float f1BC; + float path_movement_step_length; + float pitch_turn_step; int w1C0; int w1C4; int w1C8; - float f1CC; - Vec4 v1D0; + float previous_animation_frame; + Vec4 deployment_motion_delta; unsigned short h1E0; short h1E2; int w1E4; @@ -549,7 +549,7 @@ void birdbot_update(PeMoby *birdbot_moby) { if (birdbot_moby->state != BIRDBOT_STATE_INITIALIZE) { path_reposition_requested = select_birdbot_path_node(birdbot_moby, &idx); } - target_search_radius = flag ? birdbot_vars->f1A0 * 2.0f : birdbot_vars->f1A0; + target_search_radius = flag ? birdbot_vars->combat_target_radius * 2.0f : birdbot_vars->combat_target_radius; select_moby_combat_target(birdbot_moby, &selected_combat_target, target_search_radius); hit = find_moby_hit(birdbot_moby, 0x210000, 0); kind = FUN_L00_0025a478_u(birdbot_moby, hit, &birdbot_vars->f20, 0, &hits, &dmg, 0, 4); @@ -586,17 +586,17 @@ void birdbot_update(PeMoby *birdbot_moby) { break; case BIRDBOT_HIT_REACTION_FATAL_KNOCKBACK: case BIRDBOT_HIT_REACTION_FORCE_FATAL_KNOCKBACK: - birdbot_vars->f98 = 0.3f; + birdbot_vars->knockback_collision_height_offset = 0.3f; birdbot_vars->f84 = frame_time_sq * 10.0f; - birdbot_vars->f80 = frame_time_sq * 40.0f; - birdbot_vars->f88 = square_root(birdbot_vars->f84 * 2.0f * 10.0f); - birdbot_vars->f8C = frame_time * 15.0f; + birdbot_vars->knockback_gravity_step = frame_time_sq * 40.0f; + birdbot_vars->knockback_horizontal_launch_step = square_root(birdbot_vars->f84 * 2.0f * 10.0f); + birdbot_vars->knockback_vertical_launch_step = frame_time * 15.0f; birdbot_vars->fC0 = 5.0f; birdbot_vars->fC4 = 10.0f; birdbot_vars->w94 = 1; birdbot_vars->bAD = 0; *(u128 *)&va = *(u128 *)&hit->pos; - trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->f88, &birdbot_vars->f8C); + trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->knockback_horizontal_launch_step, &birdbot_vars->knockback_vertical_launch_step); FUN_L00_0025c558_u( knockback_heading, birdbot_moby, birdbot_vars->x70, 9, scale_game_frames(2), 0); birdbot_vars->b67 = 0xB4; @@ -609,16 +609,16 @@ void birdbot_update(PeMoby *birdbot_moby) { case BIRDBOT_HIT_REACTION_ANIMATED_NONFATAL_KNOCKBACK: birdbot_vars->w90 = 0x200; birdbot_vars->b67 = 0x78; - birdbot_vars->f98 = 0.5f; - birdbot_vars->f80 = 0.008f; - birdbot_vars->f88 = square_root(birdbot_vars->f84 * 2.0f * 1.5f); + birdbot_vars->knockback_collision_height_offset = 0.5f; + birdbot_vars->knockback_gravity_step = 0.008f; + birdbot_vars->knockback_horizontal_launch_step = square_root(birdbot_vars->f84 * 2.0f * 1.5f); birdbot_vars->w94 = 1; birdbot_vars->fC0 = 5.0f; - birdbot_vars->f8C = frame_time * 8.5f; + birdbot_vars->knockback_vertical_launch_step = frame_time * 8.5f; birdbot_vars->fC4 = 10.0f; birdbot_vars->bAD = 0; *(u128 *)&va = *(u128 *)&hit->pos; - trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->f88, &birdbot_vars->f8C); + trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->knockback_horizontal_launch_step, &birdbot_vars->knockback_vertical_launch_step); FUN_L00_0025c558_u(knockback_heading, birdbot_moby, birdbot_vars->x70, 0xC, 6, 0); if (birdbot_moby->b53 != 0xB) { blend_moby_animation(birdbot_moby, 0xB, 0, scale_game_frames(6)); @@ -630,15 +630,15 @@ void birdbot_update(PeMoby *birdbot_moby) { case BIRDBOT_HIT_REACTION_LOW_SPEED_NONFATAL_KNOCKBACK_NO_BLEND: birdbot_vars->w90 = 0x200; birdbot_vars->b67 = 0xFA; - birdbot_vars->f80 = 0.008f; - birdbot_vars->f88 = square_root(birdbot_vars->f84 * 2.0f * 1.5f); + birdbot_vars->knockback_gravity_step = 0.008f; + birdbot_vars->knockback_horizontal_launch_step = square_root(birdbot_vars->f84 * 2.0f * 1.5f); birdbot_vars->w94 = 1; - birdbot_vars->f8C = frame_time * 5.0f; + birdbot_vars->knockback_vertical_launch_step = frame_time * 5.0f; birdbot_vars->fC0 = 7.0f; birdbot_vars->fC4 = 13.5f; birdbot_vars->bAD = 0; *(u128 *)&va = *(u128 *)&hit->pos; - trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->f88, &birdbot_vars->f8C); + trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->knockback_horizontal_launch_step, &birdbot_vars->knockback_vertical_launch_step); FUN_L00_0025c558_u(knockback_heading, birdbot_moby, birdbot_vars->x70, 0xE, 6, 0); birdbot_moby->state = BIRDBOT_STATE_NONFATAL_KNOCKBACK; trooper_anim_update(birdbot_moby, (short *)birdbot_vars->x60); @@ -723,10 +723,10 @@ void birdbot_update(PeMoby *birdbot_moby) { c = &birdbot_vars->main; a = fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1]); - FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->f194, a, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); fast_dec_timer(&birdbot_vars->w190); d = vector_distance_xy(&birdbot_moby->pos, &selected_combat_target); - if ((flag ? d < birdbot_vars->f1A0 * 2.0f : d < birdbot_vars->f1A0) && + if ((flag ? d < birdbot_vars->combat_target_radius * 2.0f : d < birdbot_vars->combat_target_radius) && absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) < 2.0f && birdbot_moby->b31 != 0 && (!flag || path_reposition_requested == 0) && birdbot_vars->w190 == 0 && @@ -740,7 +740,7 @@ void birdbot_update(PeMoby *birdbot_moby) { vb.f[2] = va.f[2]; if (collision_line(&vb, &va, 0, birdbot_moby, 0) == 0) { birdbot_vars->h1A4 = 0; - birdbot_vars->f198 = 4.0f; + birdbot_vars->projectile_aim_distance = 4.0f; birdbot_moby->state = BIRDBOT_STATE_FIRE_BURST; if (birdbot_moby->b53 != 4) { blend_moby_animation(birdbot_moby, 4, 0, scale_game_frames(6)); @@ -779,7 +779,7 @@ void birdbot_update(PeMoby *birdbot_moby) { break; } case BIRDBOT_STATE_WAIT_FOR_TRIGGER: - if (vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) < birdbot_vars->f1A8 || + if (vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) < birdbot_vars->deployment_trigger_radius || is_point_inside_clip_volume(&hero.motion.pos, birdbot_vars->w1C0) != 0 || birdbot_vars->w1E8 != 0) { if (birdbot_vars->w1C4 != -1) { @@ -814,7 +814,7 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_moby->pos.f[0], side_path_cursor->path->points[side_path_next_node_index].f[1] - birdbot_moby->pos.f[1]); - FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->f194, a, 0.01f, 0.3f, 0.1f); + FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.01f, 0.3f, 0.1f); path = side_path_cursor->path; qcopy(&vb, &path->points[side_path_next_node_index]); if (side_path_cursor->idx == path->count - 1) { @@ -838,25 +838,25 @@ void birdbot_update(PeMoby *birdbot_moby) { p = (LevelCuboid *)((birdbot_vars->w1E4 << 7) + (int)l01_cuboids); a = fast_arc_tan(p->pos.x - birdbot_moby->pos.f[0], p->pos.y - birdbot_moby->pos.f[1]); - FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->f194, a, 0.01f, 0.3f, 0.1f); - deployment_step_length = fast_vec_length(&birdbot_vars->v1D0); - z = birdbot_vars->v1D0.f[2]; + FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.01f, 0.3f, 0.1f); + deployment_step_length = fast_vec_length(&birdbot_vars->deployment_motion_delta); + z = birdbot_vars->deployment_motion_delta.f[2]; fast_vec_normalize( - &birdbot_vars->v1D0, &birdbot_vars->v1D0, deployment_step_length * 0.95f); + &birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, deployment_step_length * 0.95f); fast_vec_sub(&vb, &l01_cuboids[birdbot_vars->w1E4].pos, &birdbot_moby->pos); fast_vec_normalize(&vb, &vb, deployment_step_length * 0.05f); - fast_vec_add(&birdbot_vars->v1D0, &birdbot_vars->v1D0, &vb); + fast_vec_add(&birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, &vb); if (frame_time * 10.0f < deployment_step_length) { - fast_vec_normalize(&vb, &birdbot_vars->v1D0, -(frame_time_sq * 10.0f)); - fast_vec_add(&birdbot_vars->v1D0, &birdbot_vars->v1D0, &vb); + fast_vec_normalize(&vb, &birdbot_vars->deployment_motion_delta, -(frame_time_sq * 10.0f)); + fast_vec_add(&birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, &vb); } else if (deployment_step_length < frame_time * 5.0f) { - fast_vec_normalize(&vb, &birdbot_vars->v1D0, frame_time_sq * 5.0f); - fast_vec_add(&birdbot_vars->v1D0, &birdbot_vars->v1D0, &vb); + fast_vec_normalize(&vb, &birdbot_vars->deployment_motion_delta, frame_time_sq * 5.0f); + fast_vec_add(&birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, &vb); } if (fast_dec_timer_s16(&birdbot_vars->h1EC) == 0) { - birdbot_vars->v1D0.f[2] = z; + birdbot_vars->deployment_motion_delta.f[2] = z; } - fast_vec_add(&birdbot_moby->pos, &birdbot_moby->pos, &birdbot_vars->v1D0); + fast_vec_add(&birdbot_moby->pos, &birdbot_moby->pos, &birdbot_vars->deployment_motion_delta); if (fast_vec_dist(&birdbot_moby->pos, &l01_cuboids[birdbot_vars->w1E4].pos) < frame_time * 10.0f) { if (birdbot_moby->b53 != 0) { @@ -882,14 +882,14 @@ void birdbot_update(PeMoby *birdbot_moby) { (u128 *)&birdbot_position_before_update); break; case BIRDBOT_STATE_FIRE_BURST: - if (birdbot_vars->f1CC < 14.0f && frame >= 14.0f) { + if (birdbot_vars->previous_animation_frame < 14.0f && frame >= 14.0f) { float a; float yaw; float pitch; a = birdbot_moby->rot.f[2]; moby_point_position(birdbot_moby, 0, &va); - qcopy(&birdbot_vars->v180, &va); + qcopy(&birdbot_vars->projectile_aim_point, &va); if (fast_difference_between_rotations( fast_arc_tan(selected_combat_target.pos.f[0] - va.f[0], selected_combat_target.pos.f[1] - va.f[1]), @@ -897,9 +897,9 @@ void birdbot_update(PeMoby *birdbot_moby) { a = fast_arc_tan(selected_combat_target.pos.f[0] - va.f[0], selected_combat_target.pos.f[1] - va.f[1]); } - birdbot_vars->v180.f[0] += fast_cos(a) * birdbot_vars->f198; - birdbot_vars->v180.f[1] += fast_sin(a) * birdbot_vars->f198; - fast_vec_sub(&vb, &birdbot_vars->v180, &va); + birdbot_vars->projectile_aim_point.f[0] += fast_cos(a) * birdbot_vars->projectile_aim_distance; + birdbot_vars->projectile_aim_point.f[1] += fast_sin(a) * birdbot_vars->projectile_aim_distance; + fast_vec_sub(&vb, &birdbot_vars->projectile_aim_point, &va); fast_vec_normalize(&vb, &vb, *(float *)&birdbot_projectile_speed_gp * frame_time); vb.f[2] += 0.0f; *(u128 *)&vc = *(u128 *)&birdbot_moby->pos; @@ -925,7 +925,7 @@ void birdbot_update(PeMoby *birdbot_moby) { if (frame < 2.0f) { if (birdbot_vars->h1A4 >= 4 || vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) > - (flag ? birdbot_vars->f1A0 * 2.0f : birdbot_vars->f1A0) || + (flag ? birdbot_vars->combat_target_radius * 2.0f : birdbot_vars->combat_target_radius) || absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) > 6.0f) { if (birdbot_moby->b53 != 5) { blend_moby_animation(birdbot_moby, 5, 5, scale_game_frames(10)); @@ -940,7 +940,7 @@ void birdbot_update(PeMoby *birdbot_moby) { a = fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1]); - FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->f194, a, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); if (birdbot_moby->b53 == 0) { if (fast_dec_timer(&birdbot_vars->w190) != 0) { if (birdbot_moby->b53 != 5) { @@ -965,7 +965,7 @@ void birdbot_update(PeMoby *birdbot_moby) { float d; d = vector_distance_xy(&birdbot_moby->pos, &selected_combat_target); - if ((flag ? d < birdbot_vars->f1A0 * 2.0f : d < birdbot_vars->f1A0) && + if ((flag ? d < birdbot_vars->combat_target_radius * 2.0f : d < birdbot_vars->combat_target_radius) && absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) < 2.0f && birdbot_moby->b31 != 0 && (!flag || path_reposition_requested == 0) && @@ -980,7 +980,7 @@ void birdbot_update(PeMoby *birdbot_moby) { vb.f[2] = va.f[2]; if (collision_line(&vb, &va, 0, birdbot_moby, 0) == 0) { birdbot_vars->h1A4 = 0; - birdbot_vars->f198 = 4.0f; + birdbot_vars->projectile_aim_distance = 4.0f; birdbot_moby->state = BIRDBOT_STATE_FIRE_BURST; if (birdbot_moby->b53 != 4) { blend_moby_animation(birdbot_moby, 4, 0, scale_game_frames(6)); @@ -1000,8 +1000,8 @@ void birdbot_update(PeMoby *birdbot_moby) { } case BIRDBOT_STATE_BEGIN_PATH_MOVEMENT: birdbot_moby->f58 = 1.0f; - birdbot_vars->f1B8 = 0.0f; - birdbot_vars->f1BC = 0.0f; + birdbot_vars->path_movement_step_length = 0.0f; + birdbot_vars->pitch_turn_step = 0.0f; birdbot_moby->state = BIRDBOT_STATE_MOVE_TO_PATH_NODE; spawn_birdbot_movement_particles((SplashMoby *)birdbot_moby, (u128 *)&birdbot_position_before_update); @@ -1036,7 +1036,7 @@ void birdbot_update(PeMoby *birdbot_moby) { va.f[2] += path_node_height_offset; FUN_L00_00258278_cf( (char *)birdbot_moby, - &birdbot_vars->f194, + &birdbot_vars->yaw_turn_step, fast_arc_tan(va.f[0] - birdbot_moby->pos.f[0], va.f[1] - birdbot_moby->pos.f[1]), frame_time_sq * 6.2831855f, frame_time_sq * 3.1415927f, @@ -1045,20 +1045,20 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_moby->rot.f[2], fast_arc_tan(va.f[0] - birdbot_moby->pos.f[0], va.f[1] - birdbot_moby->pos.f[1])) < 0.7853982f) { - if (birdbot_vars->f1B8 < *(float *)&birdbot_path_speed_scale_gp * frame_time) { - birdbot_vars->f1B8 = - birdbot_vars->f1B8 + *(float *)&birdbot_path_speed_scale_gp * frame_time_sq; + if (birdbot_vars->path_movement_step_length < *(float *)&birdbot_path_speed_scale_gp * frame_time) { + birdbot_vars->path_movement_step_length = + birdbot_vars->path_movement_step_length + *(float *)&birdbot_path_speed_scale_gp * frame_time_sq; } build_spherical_offset(&vb, - birdbot_vars->f1B8, + birdbot_vars->path_movement_step_length, birdbot_moby->rot.f[2], fast_arc_tan(vector_distance_xy(&birdbot_moby->pos, &va), va.f[2] - birdbot_moby->pos.f[2])); fast_vec_add(&birdbot_moby->pos, &birdbot_moby->pos, &vb); birdbot_moby->rot.f[1] = - spring_turn(&birdbot_vars->f1BC, + spring_turn(&birdbot_vars->pitch_turn_step, birdbot_moby->rot.f[1], - birdbot_vars->f1B8 / + birdbot_vars->path_movement_step_length / (*(float *)&birdbot_path_speed_scale_gp * frame_time) * 0.5235988f, frame_time_sq * 6.2831855f, frame_time_sq * 3.1415927f, @@ -1074,16 +1074,16 @@ void birdbot_update(PeMoby *birdbot_moby) { break; } case BIRDBOT_STATE_BRAKE_AND_FACE_TARGET: - if (birdbot_vars->f1B8 > 0.0f && birdbot_vars->h1EE == 0) { - birdbot_vars->f1B8 -= *(float *)&birdbot_path_speed_scale_gp * 3.0f * frame_time_sq; - va.f[0] = fast_cos(birdbot_moby->rot.f[2]) * birdbot_vars->f1B8; - va.f[1] = fast_sin(birdbot_moby->rot.f[2]) * birdbot_vars->f1B8; + if (birdbot_vars->path_movement_step_length > 0.0f && birdbot_vars->h1EE == 0) { + birdbot_vars->path_movement_step_length -= *(float *)&birdbot_path_speed_scale_gp * 3.0f * frame_time_sq; + va.f[0] = fast_cos(birdbot_moby->rot.f[2]) * birdbot_vars->path_movement_step_length; + va.f[1] = fast_sin(birdbot_moby->rot.f[2]) * birdbot_vars->path_movement_step_length; va.f[2] = 0.0f; fast_vec_add(&birdbot_moby->pos, &birdbot_moby->pos, &va); birdbot_moby->rot.f[1] = - spring_turn(&birdbot_vars->f1BC, + spring_turn(&birdbot_vars->pitch_turn_step, birdbot_moby->rot.f[1], - birdbot_vars->f1B8 / + birdbot_vars->path_movement_step_length / (*(float *)&birdbot_path_speed_scale_gp * frame_time) * 0.5235988f, frame_time_sq * 6.2831855f, frame_time_sq * 3.1415927f, @@ -1094,23 +1094,23 @@ void birdbot_update(PeMoby *birdbot_moby) { a = fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1]); - FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->f194, a, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); k = *(float *)&birdbot_path_speed_scale_gp * frame_time; - birdbot_vars->f1B8 = 0.0f; - birdbot_moby->rot.f[1] = spring_turn(&birdbot_vars->f1BC, + birdbot_vars->path_movement_step_length = 0.0f; + birdbot_moby->rot.f[1] = spring_turn(&birdbot_vars->pitch_turn_step, birdbot_moby->rot.f[1], - birdbot_vars->f1B8 / k * 0.5235988f, + birdbot_vars->path_movement_step_length / k * 0.5235988f, frame_time_sq * 6.2831855f, frame_time_sq * 3.1415927f, frame_time * 6.2831855f); } - if (birdbot_moby->b53 != 0xA && birdbot_vars->f1B8 <= 0.0f && + if (birdbot_moby->b53 != 0xA && birdbot_vars->path_movement_step_length <= 0.0f && fast_difference_between_rotations( birdbot_moby->rot.f[2], fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1])) < 0.034906585f) { - birdbot_vars->f1B8 = 0.0f; + birdbot_vars->path_movement_step_length = 0.0f; if (birdbot_moby->b53 != 0xA) { blend_moby_animation(birdbot_moby, 0xA, 0, scale_game_frames(3)); } @@ -1242,7 +1242,7 @@ void birdbot_update(PeMoby *birdbot_moby) { break; } trooper_anim_finish(birdbot_moby, birdbot_vars->x60); - birdbot_vars->f1CC = frame; + birdbot_vars->previous_animation_frame = frame; if (birdbot_moby->state == BIRDBOT_STATE_TRACK_TARGET_AND_SELECT_ACTION || birdbot_moby->state == 5 || birdbot_moby->state == BIRDBOT_STATE_FIRE_BURST || birdbot_moby->state == BIRDBOT_STATE_RECOVER_FROM_BURST || From 1aa4ac202882a7e88c7734a59cc8dd7f11ddd6f6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:58:53 +0000 Subject: [PATCH 421/758] decomp: clarify names in gadgebot_update i00 -> collision_radius_1024ths: GbCtl integer is set to 300/375 at retail 0x002f0428 and 0x002f0554-0x002f0588. At 0x002f1d58-0x002f1d6c it is converted to float, multiplied by 0.0009765625 (1/1024), and supplied as coll_sphere radius. This proves its collision-radius role and stored units. i38 -> movement_option_flags: Retail 0x002f045c-0x002f0470 ORs bit 1 into vars+0x68, which is GbCtl+0x38. Checked movement-helper evidence 7f515a554b014dbca14a01eacfb534d3 reads that same control word at 0x00267988 to choose an alternate heading (bit 4), at 0x002679d4 to suppress integrated Z motion (bit 1), and at 0x00267a48 to select probe behavior (bit 0x20). Thus this is an input movement-option bitfield. unk101 -> scale_manipulator_attached: Retail 0x002f0204-0x002f021c tests vars+0x101 before attaching the manipulator at vars+0x100; 0x002f0290-0x002f029c detaches it when the cheat flag is clear. Supplied attach_manipulator source sets manip->unk1=1 on attachment. This is that manipulator's attached flag; its +0x20/+0x24/+0x28 scales receive vars+0x308 at 0x002f0280-0x002f028c. unk170 -> spawn_container_moby: At 0x002f0338-0x002f0340 the return of the source-named spawn_gadgebot_spawn_container call is stored to this GbMoby pointer. 0x002f04bc-0x002f04e0 reads its state to release spawn waiting, while 0x002f05cc-0x002f0644 updates this same container's visibility flags and class-dependent field. unk17C -> approach_heading_offset: Retail 0x002f0890-0x002f0898 and 0x002f0fb8-0x002f0fc8 initialize vars+0x17C from randf_sym. 0x002f09cc-0x002f09d4 and 0x002f1180-0x002f1188 add it to the hero/attack-target bearing before turning. 0x002f11f8-0x002f1214 approaches it toward zero at a path crossing. Supplied GbSlots spread_angle aliases this field during target distribution. unk18C -> attack_target_search_frame: Retail 0x002f0fc0-0x002f0fcc stores level_frame_count to vars+0x18C on attack initialization. 0x002f1014-0x002f1028 and 0x002f1530-0x002f1544 compare it with the current frame to gate assign_gadgebot_attack_targets. Supplied helper source aliases the same slot as GbSlots.search_frame and writes level_frame_count after distributing targets. unk194 -> attack_substate_timer: Retail 0x002f13bc-0x002f13c4 and 0x002f1504-0x002f150c store scaled 60-frame waits, while 0x002f14a8-0x002f14b0 stores scaled 30-frame strike recovery. Calls at 0x002f1518-0x002f151c and 0x002f1574-0x002f1578 decrement this word and gate attack-substate transitions. It is shared by attack recovery and waiting. unk19C -> collision_contact_moby: Retail 0x002f1fd8-0x002f1ff4 copies the collision record's GbMoby pointer at +0x18 to vars+0x19C only when nonnull and its accompanying +0x1C integer is positive; otherwise it clears this field. Source identifies the record as D_L06_001745C0, also consumed after collision probes. Name claims the recorded collision contact only. unk27C -> selected_path_slot: At retail 0x002f04a8 this integer is initialized to -1. 0x002f0500-0x002f0534 stores the accepted configured path slot; 0x002f0710-0x002f0760 and 0x002f0f20-0x002f0f70 select a slot whose path contains both hero and moby. 0x002f08d0-0x002f0910 uses it to index paths.id and paths.node for follow_path. It is a slot in those arrays, not the global path ID. unk284 -> collision_correction_speed: Retail 0x002f1bec-0x002f1c94 computes the collision displacement and passes this field as vendor_spring velocity while the negative displacement length approaches zero. 0x002f1ca4-0x002f1cd0 caps this scalar at displacement length and uses it as the correction-vector magnitude before position addition; 0x002f1cec clears it when no correction exists. unk28C -> glow_pulse_angle: Retail 0x002f0498-0x002f04a4 initializes vars+0x28C with random_angle_radians. The supplied update_gadgebot_glow_effects source advances that exact field using fast_add_rotations(frame_time*2.9670596), then computes 0.5*fast_sin(angle)+1 to scale glow RGB channels. Thus it is the glow pulse's angular phase. unk2A0 -> follow_gate_moby_indices: Retail 0x002f0774-0x002f081c iterates this eight-element array paired with clip-volume IDs at vars+0x2C0, ending on -1. 0x002f079c-0x002f07ac shifts each index by 8 and adds the moby-instance base; class/state and paired clip-volume tests can stop following and restore position at 0x002f06b8-0x002f06c4. These are referenced moby indices for the follow gate; exact class gameplay identity is unclaimed. unk2E0 -> position_history_latest: Retail 0x002f02fc-0x002f0318 initializes both history vectors from moby position. At 0x002f20f8-0x002f2104 this vector is first copied to vars+0x2F0 and then replaced by the current moby position. It therefore holds the latest position saved by this update history, with early-return cadence preserved. unk2F0 -> position_history_previous: Retail 0x002f0310-0x002f0318 initializes both history vectors from moby position. At 0x002f20f8-0x002f2104 vars+0x2F0 receives the old vars+0x2E0 before +0x2E0 receives current position. It is the older of the two saved positions; supplied relocation code resets both together. unk300 -> ground_height_change_limit: Retail 0x002f03f0, 0x002f0430 and 0x002f0450 copies this configured float into GbCtl+0x0C and +0x08. Checked movement helper 7f515a554b014dbca14a01eacfb534d3 at 0x00267c74-0x00267cb8 probes ground, rejects oldZ-groundZ above control+8 or groundZ-oldZ above control+C, and restores position. Assigned 0x002f1dec-0x002f1e04 also rejects absolute ground-height change at control+C. This shared source configures both height-change bounds. unk304 -> absorption_owner_moby: In GADGEBOT_ABSORB_INTO_OWNER, retail 0x002f172c-0x002f1790 reads this GbMoby pointer's position and rotation to compute the shrinking orbit; 0x002f17c0-0x002f1808 decrements its vars+0x14 count on arrival. Supplied interaction-candidate source sets vars+0x304 to the absorption trigger/target when entering state 8. It is the owner/recipient of this absorption. unk310 -> configured_path_count: Retail 0x002f0460-0x002f0494 scans all sixteen paths.id entries and increments vars+0x310 once for each nonnegative configured ID. 0x002f04e8-0x002f04ec gates path initialization on count>0 and 0x002f06ec-0x002f06f8 gates shared-path selection on count>=2. This is the number of configured valid path slots. --- src/overlays/shared/enemies/gadgebot.c | 186 ++++++++++++------------- 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/src/overlays/shared/enemies/gadgebot.c b/src/overlays/shared/enemies/gadgebot.c index da93d6832f..ffbb78e362 100644 --- a/src/overlays/shared/enemies/gadgebot.c +++ b/src/overlays/shared/enemies/gadgebot.c @@ -100,7 +100,7 @@ typedef struct GbMoby { } GbMoby; typedef struct { - int i00; + int collision_radius_1024ths; float unk04; float unk08; float unk0C; @@ -114,7 +114,7 @@ typedef struct { float unk2C; float unk30; float unk34; - int i38; + int movement_option_flags; float unk3C; float unk40; float unk44; @@ -138,44 +138,44 @@ typedef struct { float unkE0[4] __attribute__((aligned(16))); float unkF0[4] __attribute__((aligned(16))); unsigned char unk100; - unsigned char unk101; + unsigned char scale_manipulator_attached; char p102[0x1E]; float unk120; float unk124; float unk128; char p12C[0x44]; - GbMoby *unk170; + GbMoby *spawn_container_moby; GbMoby *target; /* nearest mine/box moby found by FUN_L06_002f2910 (0: none) */ char p178[4]; - float unk17C; + float approach_heading_offset; char p180[4]; int unk184; float unk188; - int unk18C; + int attack_target_search_frame; short unk190; char p192[2]; - int unk194; + int attack_substate_timer; short unk198; short target_searched; /* set once FUN_L06_002f2910 has run the search */ - GbMoby *unk19C; + GbMoby *collision_contact_moby; char p1A0[0x40]; GbPaths paths; char p260[0x1C]; - int unk27C; + int selected_path_slot; char p280[4]; - float unk284; + float collision_correction_speed; float unk288; - float unk28C; + float glow_pulse_angle; char p290[0x10]; - int unk2A0[8]; + int follow_gate_moby_indices[8]; int unk2C0[8]; - GbVec unk2E0; - GbVec unk2F0; - float unk300; - GbMoby *unk304; + GbVec position_history_latest; + GbVec position_history_previous; + float ground_height_change_limit; + GbMoby *absorption_owner_moby; float unk308; int target_group; /* moby group searched for targets (-1: whole level list) */ - int unk310; + int configured_path_count; } GbVars; typedef struct { @@ -396,7 +396,7 @@ void gadgebot_update(GbMoby *moby) { } } if (GB_FLAG != 0) { - if (gadgebot_vars->unk101 == 0) { + if (gadgebot_vars->scale_manipulator_attached == 0) { attach_manipulator((char *)moby, 0, &gadgebot_vars->unk100); } if (moby->state != GADGEBOT_WAIT_FOR_SPAWN_PAD) { @@ -407,7 +407,7 @@ void gadgebot_update(GbMoby *moby) { gadgebot_vars->unk120 = gadgebot_vars->unk308; gadgebot_vars->unk124 = gadgebot_vars->unk308; gadgebot_vars->unk128 = gadgebot_vars->unk308; - } else if (gadgebot_vars->unk101 != 0) { + } else if (gadgebot_vars->scale_manipulator_attached != 0) { detach_manipulator(moby, &gadgebot_vars->unk100); } switch (moby->state) { @@ -417,21 +417,21 @@ void gadgebot_update(GbMoby *moby) { gadgebot_vars->unk308 = 1.0f; moby->pos[2] = probe_ground_height(moby->pos, 0, 0.5f); spawn_gadgebot_pad((char *)moby); - gadgebot_vars->unk2F0.q = gadgebot_vars->unk2E0.q = *(OvlQuad *)moby->pos; + gadgebot_vars->position_history_previous.q = gadgebot_vars->position_history_latest.q = *(OvlQuad *)moby->pos; if (visited52[moby->unkB0 + current_level_index * 16] == 0xFF) { mark_moby_for_removal(moby); return; } - gadgebot_vars->unk170 = (GbMoby *)spawn_gadgebot_spawn_container((char *)moby); + gadgebot_vars->spawn_container_moby = (GbMoby *)spawn_gadgebot_spawn_container((char *)moby); moby->pos[2] = probe_ground_height(moby->pos, 0, 0.5f); qcopy(gadgebot_vars->unk0, moby->pos); qcopy(gadgebot_vars->unkE0, moby->pos); gadgebot_vars->unk14 = frame_time * 2.0f; gadgebot_vars->unk18 = frame_time * 2.6179938f; - gadgebot_vars->ctl.i00 = 0x12C; + gadgebot_vars->ctl.collision_radius_1024ths = 0x12C; gadgebot_vars->ctl.unk04 = 0.51f; - gadgebot_vars->ctl.unk08 = gadgebot_vars->unk300; - gadgebot_vars->ctl.unk0C = gadgebot_vars->unk300; + gadgebot_vars->ctl.unk08 = gadgebot_vars->ground_height_change_limit; + gadgebot_vars->ctl.unk0C = gadgebot_vars->ground_height_change_limit; gadgebot_vars->ctl.unk24 = frame_time * 3.0f + frame_time * 0.1f; gadgebot_vars->ctl.unk1C = frame_scale_sq * 0.02f; gadgebot_vars->ctl.unk20 = frame_scale_sq * 0.3f; @@ -441,22 +441,22 @@ void gadgebot_update(GbMoby *moby) { gadgebot_vars->ctl.unk40 = frame_scale_sq * 0.3f; gadgebot_vars->ctl.unk44 = frame_time * 3.1415927f; gadgebot_vars->ctl.i48 = scale_game_frames(4); - gadgebot_vars->ctl.i38 |= 1; + gadgebot_vars->ctl.movement_option_flags |= 1; for (i = 0; i < 16; i++) { if (gadgebot_vars->paths.id[i] >= 0) { - gadgebot_vars->unk310++; + gadgebot_vars->configured_path_count++; } } - gadgebot_vars->unk28C = random_angle_radians(); - gadgebot_vars->unk27C = -1; + gadgebot_vars->glow_pulse_angle = random_angle_radians(); + gadgebot_vars->selected_path_slot = -1; moby->state = GADGEBOT_WAIT_FOR_SPAWN_PAD; moby->unk94 = 0; break; } case GADGEBOT_WAIT_FOR_SPAWN_PAD: - if (gadgebot_vars->unk170 == 0 || gadgebot_vars->unk170->state == 0xFE || - gadgebot_vars->unk170->state == 0xFD || gadgebot_vars->unk170->state >= 2) { - if (gadgebot_vars->unk310 > 0) { + if (gadgebot_vars->spawn_container_moby == 0 || gadgebot_vars->spawn_container_moby->state == 0xFE || + gadgebot_vars->spawn_container_moby->state == 0xFD || gadgebot_vars->spawn_container_moby->state >= 2) { + if (gadgebot_vars->configured_path_count > 0) { int i; for (i = 0; i < 16; i++) { @@ -468,16 +468,16 @@ void gadgebot_update(GbMoby *moby) { 1, gadgebot_vars->paths.node[i], moby->pos) != 0) { - gadgebot_vars->unk27C = i; + gadgebot_vars->selected_path_slot = i; } } } } if (GB_FLAG != 0) { gadgebot_position_snapshot_z_offset_gp = 0.35f; - gadgebot_vars->ctl.i00 = 0x177; + gadgebot_vars->ctl.collision_radius_1024ths = 0x177; } else { - gadgebot_vars->ctl.i00 = 0x12C; + gadgebot_vars->ctl.collision_radius_1024ths = 0x12C; gadgebot_position_snapshot_z_offset_gp = 0.27f; } moby->flags = (moby->flags & 0xFFBE) | 0x1000; @@ -486,16 +486,16 @@ void gadgebot_update(GbMoby *moby) { } else { if (hero.vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) { moby->flags |= 0x41; - gadgebot_vars->unk170->flags |= 0x41; + gadgebot_vars->spawn_container_moby->flags |= 0x41; moby->flags &= 0xEFFF; - gadgebot_vars->unk170->flags &= 0xEFFF; - gadgebot_vars->unk170->unk94 = 0; + gadgebot_vars->spawn_container_moby->flags &= 0xEFFF; + gadgebot_vars->spawn_container_moby->unk94 = 0; } else { moby->flags &= 0xFFBE; - gadgebot_vars->unk170->flags &= 0xFFBE; + gadgebot_vars->spawn_container_moby->flags &= 0xFFBE; moby->flags |= 0x1000; - gadgebot_vars->unk170->flags |= 0x1000; - gadgebot_vars->unk170->unk94 = gadgebot_vars->unk170->cls->unk10; + gadgebot_vars->spawn_container_moby->flags |= 0x1000; + gadgebot_vars->spawn_container_moby->unk94 = gadgebot_vars->spawn_container_moby->cls->unk10; } if (moby->unk31 != 0) { update_gadgebot_glow_effects((char *)moby); @@ -514,8 +514,8 @@ void gadgebot_update(GbMoby *moby) { qcopy(vector_and_hit_scratch, moby->pos); if (current_level_index != 6) { - gadgebot_vars->unk27C = -1; - if (gadgebot_vars->unk310 >= 2) { + gadgebot_vars->selected_path_slot = -1; + if (gadgebot_vars->configured_path_count >= 2) { int i; for (i = 0; i < 16; i++) { @@ -526,7 +526,7 @@ void gadgebot_update(GbMoby *moby) { int *q = D_L06_001B0C30[gadgebot_vars->paths.id[i]]; if (point_in_path_xy(moby->pos, q + 4, *q) != 0) { - gadgebot_vars->unk27C = i; + gadgebot_vars->selected_path_slot = i; } } } @@ -539,14 +539,14 @@ void gadgebot_update(GbMoby *moby) { int *tb; { - int *ca = &gadgebot_vars->unk2A0[j]; + int *ca = &gadgebot_vars->follow_gate_moby_indices[j]; int *cb = &gadgebot_vars->unk2C0[j]; if (*ca == -1 || *cb == -1) { break; } } - ta = &gadgebot_vars->unk2A0[j]; + ta = &gadgebot_vars->follow_gate_moby_indices[j]; tb = &gadgebot_vars->unk2C0[j]; referenced_moby = &(*(GbMoby **)&D_L06_0015FFD8)[*ta]; if (referenced_moby->cls_id == 0x3F7 && referenced_moby->state != 4 && @@ -564,7 +564,7 @@ void gadgebot_update(GbMoby *moby) { gadgebot_vars->unk184 = 0; gadgebot_vars->unk190 = 0; qcopy(gadgebot_vars->unkF0, moby->pos); - gadgebot_vars->unk17C = randf_sym(0.13962634f, 0.34906584f); + gadgebot_vars->approach_heading_offset = randf_sym(0.13962634f, 0.34906584f); case GADGEBOT_FOLLOW_MOVE_TOWARD_HERO: { int hit; @@ -572,12 +572,12 @@ void gadgebot_update(GbMoby *moby) { blend_moby_animation(moby, 1, 0, scale_game_frames(7)); } *(OvlQuad *)temporary_position = *(OvlQuad *)moby->pos; - if (gadgebot_vars->unk27C >= 0) { + if (gadgebot_vars->selected_path_slot >= 0) { int *p; - if (follow_path(&gadgebot_vars->paths.id[gadgebot_vars->unk27C], + if (follow_path(&gadgebot_vars->paths.id[gadgebot_vars->selected_path_slot], 1, - gadgebot_vars->paths.node[gadgebot_vars->unk27C], + gadgebot_vars->paths.node[gadgebot_vars->selected_path_slot], moby->pos, hero.motion.pos.f, position_and_displacement_scratch, @@ -587,10 +587,10 @@ void gadgebot_update(GbMoby *moby) { *(OvlQuad *)path_and_attack_vector = *(OvlQuad *)moby->pos; resolve_point_path_segment_xy_clearance( 0.17f, - gadgebot_vars->paths.id[gadgebot_vars->unk27C], + gadgebot_vars->paths.id[gadgebot_vars->selected_path_slot], moby->pos, path_and_attack_vector); - p = D_L06_001B0C30[gadgebot_vars->paths.id[gadgebot_vars->unk27C]]; + p = D_L06_001B0C30[gadgebot_vars->paths.id[gadgebot_vars->selected_path_slot]]; if (point_in_path_xy(path_and_attack_vector, p + 4, *p) != 0) { *(OvlQuad *)moby->pos = *(OvlQuad *)path_and_attack_vector; } @@ -602,7 +602,7 @@ void gadgebot_update(GbMoby *moby) { fast_add_rotations( fast_arc_tan(position_and_displacement_scratch[0] - moby->pos[0], position_and_displacement_scratch[1] - moby->pos[1]), - gadgebot_vars->unk17C), + gadgebot_vars->approach_heading_offset), &gadgebot_vars->ctl.unk14, frame_scale_sq * 0.07f, frame_scale_sq * 0.3f, @@ -705,7 +705,7 @@ void gadgebot_update(GbMoby *moby) { if (current_level_index != 6) { int i; - gadgebot_vars->unk27C = -1; + gadgebot_vars->selected_path_slot = -1; for (i = 0; i < 16; i++) { if (gadgebot_vars->paths.id[i] >= 0) { int *p = D_L06_001B0C30[gadgebot_vars->paths.id[i]]; @@ -714,7 +714,7 @@ void gadgebot_update(GbMoby *moby) { int *q = D_L06_001B0C30[gadgebot_vars->paths.id[i]]; if (point_in_path_xy(moby->pos, q + 4, *q) != 0) { - gadgebot_vars->unk27C = i; + gadgebot_vars->selected_path_slot = i; } } } @@ -725,12 +725,12 @@ void gadgebot_update(GbMoby *moby) { gadgebot_vars->target = 0; gadgebot_vars->unk198 = 0; gadgebot_vars->target_searched = 0; - gadgebot_vars->unk17C = randf_sym(0.13962634f, 0.34906584f); - gadgebot_vars->unk18C = level_frame_count; + gadgebot_vars->approach_heading_offset = randf_sym(0.13962634f, 0.34906584f); + gadgebot_vars->attack_target_search_frame = level_frame_count; } switch (moby->sub) { case GADGEBOT_ATTACK_SEEK_AND_APPROACH_TARGET: - if (gadgebot_vars->unk18C < level_frame_count) { + if (gadgebot_vars->attack_target_search_frame < level_frame_count) { assign_gadgebot_attack_targets(); } if (gadgebot_vars->target != 0) { @@ -739,12 +739,12 @@ void gadgebot_update(GbMoby *moby) { if (moby->anim != 5) { blend_moby_animation(moby, 5, 0, scale_game_frames(7)); } - if (gadgebot_vars->unk27C >= 0) { + if (gadgebot_vars->selected_path_slot >= 0) { int *p; - if (follow_path(&gadgebot_vars->paths.id[gadgebot_vars->unk27C], + if (follow_path(&gadgebot_vars->paths.id[gadgebot_vars->selected_path_slot], 1, - gadgebot_vars->paths.node[gadgebot_vars->unk27C], + gadgebot_vars->paths.node[gadgebot_vars->selected_path_slot], moby->pos, gadgebot_vars->target->pos, vector_and_hit_scratch, @@ -754,10 +754,10 @@ void gadgebot_update(GbMoby *moby) { *(OvlQuad *)temporary_position = *(OvlQuad *)moby->pos; resolve_point_path_segment_xy_clearance( 0.17f, - gadgebot_vars->paths.id[gadgebot_vars->unk27C], + gadgebot_vars->paths.id[gadgebot_vars->selected_path_slot], moby->pos, temporary_position); - p = D_L06_001B0C30[gadgebot_vars->paths.id[gadgebot_vars->unk27C]]; + p = D_L06_001B0C30[gadgebot_vars->paths.id[gadgebot_vars->selected_path_slot]]; if (point_in_path_xy(temporary_position, p + 4, *p) != 0) { *(OvlQuad *)moby->pos = *(OvlQuad *)temporary_position; } @@ -767,20 +767,20 @@ void gadgebot_update(GbMoby *moby) { approach_heading = fast_add_rotations(fast_arc_tan(vector_and_hit_scratch[0] - moby->pos[0], vector_and_hit_scratch[1] - moby->pos[1]), - gadgebot_vars->unk17C); + gadgebot_vars->approach_heading_offset); position_and_displacement_scratch[0] = fast_cos(approach_heading) * 3.0f; position_and_displacement_scratch[1] = fast_sin(approach_heading) * 3.0f; position_and_displacement_scratch[2] = 0.0f; fast_vec_add(position_and_displacement_scratch, position_and_displacement_scratch, moby->pos); - if (gadgebot_vars->unk27C != -1 && + if (gadgebot_vars->selected_path_slot != -1 && test_path_segment_strict_crossing( - gadgebot_vars->paths.id[gadgebot_vars->unk27C], + gadgebot_vars->paths.id[gadgebot_vars->selected_path_slot], moby->pos, position_and_displacement_scratch) != 0) { step_angle_toward_target( - &gadgebot_vars->unk17C, 0, 0.0f, frame_time * 1.5707964f); + &gadgebot_vars->approach_heading_offset, 0, 0.0f, frame_time * 1.5707964f); } FUN_L00_00258278((char *)moby, approach_heading, @@ -815,7 +815,7 @@ void gadgebot_update(GbMoby *moby) { } } else if (gadgebot_vars->target_searched != 0) { gadgebot_vars->target_searched = 0; - gadgebot_vars->unk194 = scale_game_frames(0x3C); + gadgebot_vars->attack_substate_timer = scale_game_frames(0x3C); moby->sub = 4; } break; @@ -837,7 +837,7 @@ void gadgebot_update(GbMoby *moby) { } if (moby->unk70 & 2) { gadgebot_vars->target_searched = 0; - gadgebot_vars->unk194 = scale_game_frames(0x1E); + gadgebot_vars->attack_substate_timer = scale_game_frames(0x1E); moby->sub = 3; } break; @@ -847,23 +847,23 @@ void gadgebot_update(GbMoby *moby) { } if (gadgebot_vars->target_searched != 0 && gadgebot_vars->target == 0) { gadgebot_vars->target_searched = 0; - gadgebot_vars->unk194 = scale_game_frames(0x3C); + gadgebot_vars->attack_substate_timer = scale_game_frames(0x3C); moby->sub = 4; } - if (fast_dec_timer(&gadgebot_vars->unk194) != 0) { + if (fast_dec_timer(&gadgebot_vars->attack_substate_timer) != 0) { if (gadgebot_vars->target != 0) { moby->sub = 1; } } break; case GADGEBOT_ATTACK_WAIT_FOR_TARGET: - if (gadgebot_vars->unk18C < level_frame_count) { + if (gadgebot_vars->attack_target_search_frame < level_frame_count) { assign_gadgebot_attack_targets(); } if (moby->anim != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(7)); } - if (fast_dec_timer(&gadgebot_vars->unk194) != 0 && + if (fast_dec_timer(&gadgebot_vars->attack_substate_timer) != 0 && gadgebot_vars->target_searched != 0 && gadgebot_vars->target == 0) { moby->state = GADGEBOT_FOLLOW_HERO; moby->sub = 0; @@ -923,22 +923,22 @@ void gadgebot_update(GbMoby *moby) { case GADGEBOT_ABSORB_INTO_OWNER: { float rr; - owner_radial_angle = fast_arc_tan(moby->pos[0] - gadgebot_vars->unk304->pos[0], - moby->pos[1] - gadgebot_vars->unk304->pos[1]); - rr = vector_distance_xy(gadgebot_vars->unk304->pos, moby->pos); + owner_radial_angle = fast_arc_tan(moby->pos[0] - gadgebot_vars->absorption_owner_moby->pos[0], + moby->pos[1] - gadgebot_vars->absorption_owner_moby->pos[1]); + rr = vector_distance_xy(gadgebot_vars->absorption_owner_moby->pos, moby->pos); step_angle_toward_target( - &owner_radial_angle, 0, gadgebot_vars->unk304->rot, frame_time * 6.2831855f); + &owner_radial_angle, 0, gadgebot_vars->absorption_owner_moby->rot, frame_time * 6.2831855f); rr -= frame_time * 4.0f; if (rr <= 0.0f) { - GbOwnerVars *ov = gadgebot_vars->unk304->vars; + GbOwnerVars *ov = gadgebot_vars->absorption_owner_moby->vars; if (ov->unk14 > 0) { ov->unk14--; } if (ov->unk14 == 0) { - trooper_play_sound(1, 0, (int)gadgebot_vars->unk304, 0x516); + trooper_play_sound(1, 0, (int)gadgebot_vars->absorption_owner_moby, 0x516); } else { - trooper_play_sound(0, 0, (int)gadgebot_vars->unk304, 0x516); + trooper_play_sound(0, 0, (int)gadgebot_vars->absorption_owner_moby, 0x516); } mark_moby_for_removal(moby); return; @@ -946,8 +946,8 @@ void gadgebot_update(GbMoby *moby) { vector_and_hit_scratch[0] = fast_cos(owner_radial_angle) * rr; vector_and_hit_scratch[1] = fast_sin(owner_radial_angle) * rr; vector_and_hit_scratch[2] = 0.0f; - moby->pos[0] = vector_and_hit_scratch[0] + gadgebot_vars->unk304->pos[0]; - moby->pos[1] = vector_and_hit_scratch[1] + gadgebot_vars->unk304->pos[1]; + moby->pos[0] = vector_and_hit_scratch[0] + gadgebot_vars->absorption_owner_moby->pos[0]; + moby->pos[1] = vector_and_hit_scratch[1] + gadgebot_vars->absorption_owner_moby->pos[1]; if (rr < 1.0f) { moby->scale = moby->cls->unk24 * rr; spawn_source_attached_fading_effect_particle( @@ -1040,23 +1040,23 @@ void gadgebot_update(GbMoby *moby) { max = frame_time * 3.0f; step = -fast_vec_length(position_and_displacement_scratch); vendor_spring(&step, - &gadgebot_vars->unk284, + &gadgebot_vars->collision_correction_speed, 0.0f, frame_scale_sq * 0.025f, frame_scale_sq * 0.3f, max); collision_displacement_length = fast_vec_length(position_and_displacement_scratch); - if (collision_displacement_length < gadgebot_vars->unk284) { - gadgebot_vars->unk284 = collision_displacement_length; + if (collision_displacement_length < gadgebot_vars->collision_correction_speed) { + gadgebot_vars->collision_correction_speed = collision_displacement_length; } - if (gadgebot_vars->unk284 < collision_displacement_length) { + if (gadgebot_vars->collision_correction_speed < collision_displacement_length) { fast_vec_normalize(position_and_displacement_scratch, position_and_displacement_scratch, - gadgebot_vars->unk284); + gadgebot_vars->collision_correction_speed); } fast_vec_add(moby->pos, moby->pos, position_and_displacement_scratch); } else { - gadgebot_vars->unk284 = 0.0f; + gadgebot_vars->collision_correction_speed = 0.0f; qcopy(moby->pos, vector_and_hit_scratch); } if (moby->state != GADGEBOT_UPDATE_KNOCKBACK) { @@ -1072,7 +1072,7 @@ void gadgebot_update(GbMoby *moby) { qcopy(position_and_displacement_scratch, moby->pos); position_and_displacement_scratch[2] += gadgebot_vars->ctl.unk04; if (coll_sphere(position_and_displacement_scratch, - convert_integer_to_float(gadgebot_vars->ctl.i00) * + convert_integer_to_float(gadgebot_vars->ctl.collision_radius_1024ths) * 0.0009765625f, 6, moby) == 0) { @@ -1089,7 +1089,7 @@ void gadgebot_update(GbMoby *moby) { if (absolute_float(save1[2] - probe_ground_height(moby->pos, 0, 0.5f)) >= gadgebot_vars->ctl.unk0C) { *(OvlQuad *)moby->pos = *(OvlQuad *)save1; - gadgebot_vars->unk284 = 0.0f; + gadgebot_vars->collision_correction_speed = 0.0f; } } movement_control->unk18 -= frame_time_sq * 7.0f; @@ -1123,9 +1123,9 @@ void gadgebot_update(GbMoby *moby) { } } if (D_L06_001745C0.unk18 != 0 && D_L06_001745C0.unk1C > 0) { - gadgebot_vars->unk19C = D_L06_001745C0.unk18; + gadgebot_vars->collision_contact_moby = D_L06_001745C0.unk18; } else { - gadgebot_vars->unk19C = 0; + gadgebot_vars->collision_contact_moby = 0; } *(OvlQuad *)vector_and_hit_scratch = *(OvlQuad *)moby->pos; vector_and_hit_scratch[2] -= 2.0f; @@ -1150,8 +1150,8 @@ void gadgebot_update(GbMoby *moby) { update_gadgebot_glow_effects((char *)moby); } } - gadgebot_vars->unk2F0.q = gadgebot_vars->unk2E0.q; - gadgebot_vars->unk2E0.q = *(OvlQuad *)moby->pos; + gadgebot_vars->position_history_previous.q = gadgebot_vars->position_history_latest.q; + gadgebot_vars->position_history_latest.q = *(OvlQuad *)moby->pos; } /* scores a target moby by distance, heading differences and flags */ From 1f7d93be058b7144f70b93351870ec3adbd1eeaa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:58:56 +0000 Subject: [PATCH 422/758] decomp: clarify names in kerwan_path_enemy_update f2C -> path_node_proximity_distance: Mover2C8398 member initialized at 0x002c73d0-0x002c73ec from mv.f24 times scaled 15 frames. Assigned 0x002c8244-0x002c8264 passes mv and the selected path node to mover helper 0x00247c10. Checked request 44e1e251bb324d41805ed6aee4299515, 0x00247c4c-0x00247c68, computes moby-to-node distance, compares against mover+0x2c and sets return bit 4 when nearer. This proves node-proximity distance threshold, without assuming exact arrival. f3C -> turn_acceleration: Mover2C8398 member initialized at data+0x10c by frame_time_sq*2pi (0x002c7390, 0x002c73cc). Checked mover request 44e1e251bb324d41805ed6aee4299515 at 0x00247c98-0x00247ca4 loads mover+0x3c as f13 to heading helper. Checked request 59e7a7f23c844c778c0fb38f858df0d2 at 0x00246e04, 0x00246e40-0x00246e94 multiplies this by clamped normalized signed heading error and adds it minus velocity damping to the angular step. 0x00246f20-0x00246f28 adds that step to moby yaw, proving turn acceleration. f44 -> max_turn_speed: Mover2C8398 member initialized at data+0x114 to frame_time*pi (0x002c7384, 0x002c73b4). Checked mover request 44e1e251bb324d41805ed6aee4299515 loads mover+0x44 as f15 at 0x00247c90 before heading call. Checked heading request 59e7a7f23c844c778c0fb38f858df0d2 preserves f15 as f20 at 0x00246e18 and clamps angular step to +/-f20 when nonzero at 0x00246e84-0x00246ebc; step is then added to moby yaw at 0x00246f20-0x00246f28. This proves maximum turning speed per update. f68 -> target_yaw_offset: Look2C8398 member: original Ghidra and retail 0x002c7198-0x002c7210 compute saved heading or target XY heading minus moby yaw, split across look0/look1, and store at data+0x1b8/+0x238 (each look+0x68). 0x002c7218-0x002c72a0 clamps these signed offsets to +/-pi/4 before joint animation updates at 0x002c72d4/0x002c72f4. This proves the requested joint-relative yaw offset. i20 -> collision_radius_fixed: Jump2C8398 member at data+0x90: retail initialization 0x002c7408-0x002c743c converts 716.8 to integer. Original Ghidra and retail 0x002c89b4-0x002c89d4 convert this integer to float and multiply by 1/1024 for coll_sphere's radius. Checked motion helper request e8cfb95877594365ac724a706ac268e6 also uses jump+0x20 times 1/1024 for the sphere query at 0x0024b758-0x0024b770, proving fixed-point collision radius rather than a generic integer. s3E -> jump_phase: Jump2C8398 member at data+0xae: assigned original Ghidra and retail 0x002c85ac-0x002c85e0 bypass motion integration for phase 2, waiting for animation completion; 0x002c88e8-0x002c8900 makes horizontal target speed zero for phase 2. Checked motion request e8cfb95877594365ac724a706ac268e6 dispatches jump+0x3e at 0x0024b40c-0x0024b444, changes 0 to 1 after vertical velocity becomes negative at 0x0024b8d8-0x0024b900, and writes 2 on downward contact with an upward-facing surface at 0x0024b7bc-0x0024b820. This proves a jump ascent/descent/landing phase field. --- src/overlays/l03/mobys/kerwan_path_enemy.c | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/overlays/l03/mobys/kerwan_path_enemy.c b/src/overlays/l03/mobys/kerwan_path_enemy.c index 2f6b3d3390..db5fab1a7b 100644 --- a/src/overlays/l03/mobys/kerwan_path_enemy.c +++ b/src/overlays/l03/mobys/kerwan_path_enemy.c @@ -133,12 +133,12 @@ typedef struct { float f14; float f18; float f1C; - int i20; + int collision_radius_fixed; int knockback_flags; float f28; char p2C[0x11]; unsigned char b3D; - short s3E; + short jump_phase; char p40[0xC]; float target_horizontal_speed; float f50; @@ -155,12 +155,12 @@ typedef struct { char p1C[8]; float f24; float f28; - float f2C; + float path_node_proximity_distance; char p30[8]; int i38; - float f3C; + float turn_acceleration; float f40; - float f44; + float max_turn_speed; char p48[8]; } Mover2C8398; @@ -174,7 +174,7 @@ typedef struct { typedef struct { char p0[0x68]; - float f68; + float target_yaw_offset; char p6C[0x14]; } Look2C8398; @@ -424,23 +424,23 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { fast_subtract_rotations_cf(&moby_data->b263); if (m->b31 != 0 || target_distance < 24.0f) { if (m->state == ENEMY_TURN_TO_HEADING) { - moby_data->look0.f68 = fast_subtract_rotations(moby_data->f28C, m->rot[2]) * 0.25f; - moby_data->look1.f68 = fast_subtract_rotations(moby_data->f28C, m->rot[2]) * 0.75f; + moby_data->look0.target_yaw_offset = fast_subtract_rotations(moby_data->f28C, m->rot[2]) * 0.25f; + moby_data->look1.target_yaw_offset = fast_subtract_rotations(moby_data->f28C, m->rot[2]) * 0.75f; } else if (m->state < ENEMY_MOVE_TO_PATH_NODE && target_distance < moby_data->f270) { - moby_data->look1.f68 = + moby_data->look1.target_yaw_offset = fast_subtract_rotations(fast_arc_tan(selected_target.pos[0] - m->pos[0], selected_target.pos[1] - m->pos[1]), m->rot[2]); } - if (moby_data->look0.f68 > 0.7853982f) { - moby_data->look0.f68 = 0.7853982f; - } else if (moby_data->look0.f68 < -0.7853982f) { - moby_data->look0.f68 = -0.7853982f; + if (moby_data->look0.target_yaw_offset > 0.7853982f) { + moby_data->look0.target_yaw_offset = 0.7853982f; + } else if (moby_data->look0.target_yaw_offset < -0.7853982f) { + moby_data->look0.target_yaw_offset = -0.7853982f; } - if (moby_data->look1.f68 > 0.7853982f) { - moby_data->look1.f68 = 0.7853982f; - } else if (moby_data->look1.f68 < -0.7853982f) { - moby_data->look1.f68 = -0.7853982f; + if (moby_data->look1.target_yaw_offset > 0.7853982f) { + moby_data->look1.target_yaw_offset = 0.7853982f; + } else if (moby_data->look1.target_yaw_offset < -0.7853982f) { + moby_data->look1.target_yaw_offset = -0.7853982f; } update_joint_animation( (char *)m, (char *)&moby_data->look0, 2, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f); @@ -454,13 +454,13 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { FUN_001f96b0_cf((char *)&moby_data->mv); moby_data->mv.fC = 3.0f; moby_data->mv.f18 = 0.0f; - moby_data->mv.f3C = frame_time_sq * 6.2831855f; + moby_data->mv.turn_acceleration = frame_time_sq * 6.2831855f; moby_data->mv.f40 = frame_time_sq * 12.566371f; - moby_data->mv.f44 = frame_time * 3.1415927f; + moby_data->mv.max_turn_speed = frame_time * 3.1415927f; moby_data->mv.f24 = frame_time * 6.0f; moby_data->mv.f8 = 2.0f; moby_data->mv.f28 = 3.1415927f; - moby_data->mv.f2C = moby_data->mv.f24 * truncate_float_to_s32_cf(15.0f); + moby_data->mv.path_node_proximity_distance = moby_data->mv.f24 * truncate_float_to_s32_cf(15.0f); moby_data->mv.i38 = 9; moby_data->f20 = 3.0f; moby_data->s24 = truncate_float_to_s32(3.0f); @@ -468,7 +468,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { moby_data->b28 = 2; moby_data->f30 = 1.75f; moby_data->q.f28 = 0.7f; - moby_data->q.i20 = truncate_float_to_s32(716.8f); + moby_data->q.collision_radius_fixed = truncate_float_to_s32(716.8f); moby_data->q.target_horizontal_speed = 0.0f; moby_data->b58 = 0xA; moby_data->b5A = 0xC; @@ -925,7 +925,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { case ENEMY_KNOCKBACK_RECOVERY: { int fl; float g; - if (moby_data->q.s3E != 2) { + if (moby_data->q.jump_phase != 2) { fl = step_moby_motion(m, &moby_data->q); } else { m->f58 = 1.0f; @@ -1046,7 +1046,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { q->f8 = q->f8 - q->f10; speed = vector_length_xy(q); want = 0.0f; - if (q->s3E != 2) { + if (q->jump_phase != 2) { want = q->target_horizontal_speed; } approach_value(&speed, want, q->f14); @@ -1056,11 +1056,11 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { fast_vec_add(m->pos, m->pos, q); qcopy(b, m->pos); b[2] += q->f28; - if (fast_vec_length(q) > (float)q->i20) { + if (fast_vec_length(q) > (float)q->collision_radius_fixed) { collision_line(a, b, 0x24, m, 0); qcopy(b, &D_L03_00173F40.point); } - if (coll_sphere(convert_integer_to_float(q->i20) * 0.0009765625f, b, 0x24, m)) { + if (coll_sphere(convert_integer_to_float(q->collision_radius_fixed) * 0.0009765625f, b, 0x24, m)) { qcopy(m->pos, sphere_collision_resolved_position); m->pos[2] = a[2] + q->f8 - q->f28; } From c81da35d007ec8dc93af7f1889bdcc694a7870f2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 09:58:59 +0000 Subject: [PATCH 423/758] decomp: clarify names in robosquawker_update b53 -> animation_index: Retail 002b5580-002b55a0 compares moby+0x53 with animation 3 before blend_moby_animation(moby,3,0,0); the same check/select relationship holds for flight 0, chase 5 and peck 6 throughout the original decompilation. f130 -> motion_gravity_step: Retail 002b6730-002b6744 stores home-hop gravity in vars+0x130. Checked motion helper 0026871c-00268730 subtracts this field (motion+0x10) from vertical displacement motion+8 every update before position integration at 00268c20-00268c38. f134 -> motion_horizontal_speed_change_limit: Retail 002b53b4 initializes vars+0x134 to 0.0011 and 002b672c clears it for home hop. Checked helper 0026874c measures XY motion magnitude, 00268764-00268770 supplies motion+0x14 as approach_value step toward motion+0x4c, then 00268774-00268780 rescales XY motion. f138 -> motion_horizontal_launch_step: Retail 002b53b8 and 002b6744 write frame-scaled horizontal launch speed at vars+0x138. Checked startup 002685dc-002685fc multiplies this motion+0x18 scalar by yaw cosine/sine and stores motion X/Y at 002685ec and 00268620. f13C -> motion_vertical_launch_step: Retail 002b53bc and 002b6750 write vars+0x13c from vertical speed or home-hop ballistic solver. Checked startup 002685f8 loads motion+0x1c and 00268614 copies it to motion Z+8, which is integrated into position by the motion helper. f148 -> motion_bounce_restitution: Retail 002b5368 initializes vars+0x148 to 0.5 before knockback. Checked motion helper 00268eac-00268ed4 loads motion+0x30, adds 1, negates and multiplies incoming normal dot product, then adds that normal component to motion, implementing collision restitution. f170 -> motion_ascent_end_animation_frame: Retail 002b5464/002b5500 and 002b6794 set vars+0x170 for death/damage/home hop. Checked helper 00268a44-00268a98 uses abs(vertical_step/gravity) as remaining ascent updates and (motion+0x50 minus current animation frame) divided by that count as playback speed. f174 -> motion_descent_end_animation_frame: Retail 002b5468/002b5504 and 002b679c set vars+0x174. Checked helper 00268aa0-00268abc stops playback at motion+0x54; 00268ac4-00268b58 estimates time to ground and divides this frame target minus current animation frame by that time during descent. f198 -> ground_vertical_step: Retail 002b6fd0-002b6ffc and 002b7808-002b7834 subtract frame_time_sq*9.8 from vars+0x198, add it directly to moby Z, then zero it when clamping to sampled ground. This proves per-update vertical displacement for ground motion. f1A4 -> ground_movement_step_length: Retail 002b5628-002b5648 stores vars+0x204 multiplied by frame_time into vars+0x1a4 in the initialized ground movement record. The identical speed-times-frame product generates forward XY displacement at 002b7670-002b76c0. f1F0 -> yaw_turn_step: Retail 002b5a80-002b5a94 and other steering calls pass vars+0x1f0 by address with desired atan yaw. Checked helper 00264054-0026409c updates and clamps that scalar; 002640fc-00264108 adds it to moby yaw at +0x48 and stores the rotation. f1F4 -> chase_yaw_offset_radians: Retail 002b5814-002b5824 converts vars+0x1f8 by 0.017453292 into vars+0x1f4. Chase 002b6b04-002b6b38 adds it to target-bearing atan before steering; 002b6bb8-002b6bc4 negates it on timer expiration. f1F8 -> chase_yaw_offset_degrees: Retail 002b57f0-002b5824 conditionally negates vars+0x1f8 and multiplies by pi/180 to produce vars+0x1f4. That converted value offsets chase target yaw at 002b6b04-002b6b38, proving the source offset is measured in degrees. f1FC -> target_engagement_radius: Retail 002b51c8-002b51d0 passes vars+0x1fc+4 to target selection. Ground proximity at 002b6374-002b6388, home-relative chase/return checks at 002b7174-002b7178 and wait-close at 002b6544-002b6558 use this field as their radius. f200 -> default_target_engagement_radius: Retail 002b5254-002b5268 selects vars+0x200 when the alert timer vars+0x214 expires, otherwise choosing the saved initial radius at vars+0x1dc, and copies the selected scalar to the active engagement radius vars+0x1fc. f204 -> walking_speed: Retail 002b7670-002b7684 and 002b7690-002b76c0 multiply vars+0x204 by frame_time and yaw cosine/sine, building XY displacement in WALK_FORWARD_AVOID_MOBYS. Initialization also converts it to the ground movement step at 002b5628-002b5648. f2C -> damage_amount: Retail 002b52f8-002b5300 clears hit+0x2c to suppress repeated hits from classes 0xb0/0xb1; 002b531c-002b5330 skips damage handling when zero, and 002b5370-002b5380 subtracts it from robosquawker health. Supplied hit-response context likewise identifies hit_record->f2C as damage. f58 -> animation_playback_speed: Retail 002b5ab4-002b5ac4 sets moby+0x58 proportional to flight step length. Checked motion helper 00268a70-00268a98 derives (target animation frame-current frame)/remaining ascent updates; 00268b44-00268bac approaches the analogous descent frame rate at moby+0x58. p218 -> walk_range_anchor: Retail 002b7838-002b7858 reads vars+0x218, measures XY distance from moby position to pointed object+0x10 and compares against vars+0x216. Null or exceeding that bound causes RETURN_HOME at 002b7868-002b7878, proving the pointer is the walk-range anchor. v1D0 -> home_position: Retail 002b5560-002b5578 copies initial moby position to vars+0x1d0. RETURN_HOME uses it as path-selection destination at 002b7034-002b7048 and tests arrival at 002b7104-002b7138; home hop also targets it. Fourth lane stores initial engagement radius, not a coordinate. v1E0 -> flight_destination: Retail 002b5908-002b590c copies a flight path waypoint to vars+0x1e0, while 002b59b8-002b59c4 generates a random destination by adding an offset to home. Flight states subtract current position from this vector and compare remaining distance against their step length. --- src/overlays/l13/mobys/robosquawker.c | 322 +++++++++++++------------- 1 file changed, 161 insertions(+), 161 deletions(-) diff --git a/src/overlays/l13/mobys/robosquawker.c b/src/overlays/l13/mobys/robosquawker.c index e2cb266f24..13a98dfe30 100644 --- a/src/overlays/l13/mobys/robosquawker.c +++ b/src/overlays/l13/mobys/robosquawker.c @@ -281,45 +281,45 @@ typedef struct { char padD4[0x3C]; char x110[0x10]; char x120[0x10]; - float f130; - float f134; - float f138; - float f13C; + float motion_gravity_step; + float motion_horizontal_speed_change_limit; + float motion_horizontal_launch_step; + float motion_vertical_launch_step; int w140; int w144; - float f148; + float motion_bounce_restitution; char pad14C[0x11]; unsigned char b15D; char pad15E[0x12]; - float f170; - float f174; + float motion_ascent_end_animation_frame; + float motion_descent_end_animation_frame; char pad178[8]; int w180; int w184; float f188; float f18C; char pad190[8]; - float f198; + float ground_vertical_step; char pad19C[8]; - float f1A4; + float ground_movement_step_length; char pad1A8[0x10]; int w1B8; char pad1BC[0x14]; - RsVec v1D0; - RsVec v1E0; - float f1F0; - float f1F4; - float f1F8; - float f1FC; - float f200; - float f204; + RsVec home_position; + RsVec flight_destination; + float yaw_turn_step; + float chase_yaw_offset_radians; + float chase_yaw_offset_degrees; + float target_engagement_radius; + float default_target_engagement_radius; + float walking_speed; short h208; short h20A; int w20C; int w210; short h214; short h216; - char *p218; + char *walk_range_anchor; int w21C; int w220; int w224; @@ -343,9 +343,9 @@ typedef struct { RsVec rot; char pad50[2]; unsigned char b52; - unsigned char b53; + unsigned char animation_index; char pad54[4]; - float f58; + float animation_playback_speed; char pad5C[0x14]; unsigned char b70; char pad71[7]; @@ -377,7 +377,7 @@ typedef struct { RsVec pos; RsMoby *src; char pad24[8]; - float f2C; + float damage_amount; } RsHit; extern char *level13_moby_list_head __asm__("D_L13_0015FFE4"); @@ -499,7 +499,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_moby->w94 = *(int *)(robosquawker_moby->w24 + 0x10); robosquawker_moby->h34 &= 0xFFBE; select_robosquawker_target( - (char *)robosquawker_moby, (char *)&selected_target_record, robosquawker_vars->f1FC + 4.0f); + (char *)robosquawker_moby, (char *)&selected_target_record, robosquawker_vars->target_engagement_radius + 4.0f); tm = selected_target_record.moby; if (tm == 0 || (robosquawker_vars->h214 == 0 && robosquawker_vars->w22C != -1 && @@ -516,9 +516,9 @@ void robosquawker_update(RsMoby *robosquawker_moby) { fast_dec_timer_s16(&robosquawker_vars->h208); if (robosquawker_moby->state != ROBOSQUAWKER_STATE_INITIALIZE) { if (fast_dec_timer_s16(&robosquawker_vars->h214) != 0) { - robosquawker_vars->f1FC = robosquawker_vars->v1D0.f[3]; + robosquawker_vars->target_engagement_radius = robosquawker_vars->home_position.f[3]; } else { - robosquawker_vars->f1FC = robosquawker_vars->f200; + robosquawker_vars->target_engagement_radius = robosquawker_vars->default_target_engagement_radius; } } dmg = 0.0f; @@ -529,40 +529,40 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (robosquawker_vars->h26 < scale_game_frames(0x2D) && hit != 0 && robosquawker_moby->state != ROBOSQUAWKER_STATE_DEATH_KNOCKBACK) { if (hit->src->hA6 >= 0xB0 && hit->src->hA6 <= 0xB1 && robosquawker_vars->h26 != 0) { - hit->f2C = 0.0f; + hit->damage_amount = 0.0f; } if (robosquawker_moby->b21 != 0xFF) { FUN_L01_0026e090(robosquawker_moby->b21, 1); } - if (hit->f2C != 0.0f) { + if (hit->damage_amount != 0.0f) { knockback_yaw = fast_arc_tan(robosquawker_moby->pos.f[0] - selected_target_record.pos.f[0], robosquawker_moby->pos.f[1] - selected_target_record.pos.f[1]); - robosquawker_vars->f148 = 0.5f; + robosquawker_vars->motion_bounce_restitution = 0.5f; robosquawker_vars->w140 = 0x202; - robosquawker_vars->f20 -= hit->f2C; - robosquawker_vars->f130 = 0.0055f; - robosquawker_vars->f134 = 0.0011f; - robosquawker_vars->f138 = + robosquawker_vars->f20 -= hit->damage_amount; + robosquawker_vars->motion_gravity_step = 0.0055f; + robosquawker_vars->motion_horizontal_speed_change_limit = 0.0011f; + robosquawker_vars->motion_horizontal_launch_step = robosquawker_damage_knockback_horizontal_speed_gp * frame_time; - robosquawker_vars->f13C = robosquawker_damage_knockback_vertical_speed_gp * frame_time; + robosquawker_vars->motion_vertical_launch_step = robosquawker_damage_knockback_vertical_speed_gp * frame_time; robosquawker_vars->w144 = 9; robosquawker_vars->b15D = 0; if (robosquawker_vars->f20 <= 0.0f) { robosquawker_moby->h34 &= 0xEFFF; - robosquawker_vars->f138 = frame_time * 10.0f; - robosquawker_vars->f13C = frame_time * 5.5f; + robosquawker_vars->motion_horizontal_launch_step = frame_time * 10.0f; + robosquawker_vars->motion_vertical_launch_step = frame_time * 5.5f; *(u128 *)&va = *(u128 *)&hit->pos; trooper_knockback_arc( - &va, &knockback_yaw, &robosquawker_vars->f138, &robosquawker_vars->f13C); + &va, &knockback_yaw, &robosquawker_vars->motion_horizontal_launch_step, &robosquawker_vars->motion_vertical_launch_step); trooper_start_knockback(robosquawker_moby, robosquawker_vars->x120, knockback_yaw, (rand() & 1) + 9, 1, 0); - robosquawker_vars->f170 = 11.0f; - robosquawker_vars->f174 = 18.0f; + robosquawker_vars->motion_ascent_end_animation_frame = 11.0f; + robosquawker_vars->motion_descent_end_animation_frame = 18.0f; robosquawker_moby->state = ROBOSQUAWKER_STATE_DEATH_KNOCKBACK; release_robosquawker_particle((Level13VendorMoby *)robosquawker_vars); robosquawker_vars->x110[7] = 0x78; @@ -571,15 +571,15 @@ void robosquawker_update(RsMoby *robosquawker_moby) { } else { *(u128 *)&va = *(u128 *)&hit->pos; trooper_knockback_arc( - &va, &knockback_yaw, &robosquawker_vars->f138, &robosquawker_vars->f13C); + &va, &knockback_yaw, &robosquawker_vars->motion_horizontal_launch_step, &robosquawker_vars->motion_vertical_launch_step); trooper_start_knockback(robosquawker_moby, robosquawker_vars->x120, knockback_yaw, (rand() & 1) + 9, 1, 0); - robosquawker_vars->f170 = 5.0f; - robosquawker_vars->f174 = 10.0f; + robosquawker_vars->motion_ascent_end_animation_frame = 5.0f; + robosquawker_vars->motion_descent_end_animation_frame = 10.0f; robosquawker_moby->state = ROBOSQUAWKER_STATE_DAMAGE_KNOCKBACK; release_robosquawker_particle((Level13VendorMoby *)robosquawker_vars); *(unsigned char *)&robosquawker_vars->x110[7] = 0xFA; @@ -591,17 +591,17 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_moby->bA4 = 0xFF; switch (robosquawker_moby->state) { case ROBOSQUAWKER_STATE_INITIALIZE: - qcopy(&robosquawker_vars->v1D0, &robosquawker_moby->pos); - robosquawker_vars->v1D0.f[3] = robosquawker_vars->f1FC; + qcopy(&robosquawker_vars->home_position, &robosquawker_moby->pos); + robosquawker_vars->home_position.f[3] = robosquawker_vars->target_engagement_radius; if (robosquawker_vars->h20A != 0) { robosquawker_moby->state = ROBOSQUAWKER_STATE_GROUND_IDLE; - if (robosquawker_moby->b53 != 3) { + if (robosquawker_moby->animation_index != 3) { blend_moby_animation(robosquawker_moby, 3, 0, 0); } } else { robosquawker_moby->state = ROBOSQUAWKER_STATE_FLIGHT_IDLE; robosquawker_moby->pos.f[2] += 6.0f; - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, 0); } } @@ -616,7 +616,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->w180 = 0x38D; robosquawker_vars->f18C = 2.0f; robosquawker_vars->f188 = 2.0f; - robosquawker_vars->f1A4 = robosquawker_vars->f204 * frame_time; + robosquawker_vars->ground_movement_step_length = robosquawker_vars->walking_speed * frame_time; robosquawker_vars->w1B8 |= 0x30; if (rand() & 1) { robosquawker_moby->h34 |= 0x8000; @@ -633,21 +633,21 @@ void robosquawker_update(RsMoby *robosquawker_moby) { update_robosquawker_particle((unsigned char *)robosquawker_moby, (char *)robosquawker_vars); fast_vec_sub(&va, &selected_target_record, &robosquawker_moby->pos); d = probe_ground_height(&robosquawker_moby->pos, 0x120, 0.5f); - if (d > 1.0f && vector_length_xy(&va) < robosquawker_vars->f1FC + 4.0f && + if (d > 1.0f && vector_length_xy(&va) < robosquawker_vars->target_engagement_radius + 4.0f && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 10.0f && random_integer_below(0x13) == 0) { - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } robosquawker_moby->state = ROBOSQUAWKER_STATE_LAND; release_robosquawker_particle((Level13VendorMoby *)robosquawker_vars); } else if (d > 1.0f && robosquawker_moby->bBC == 1 && random_integer_below(4) == 0) { if (random_integer_below(0x100) & 1) { - robosquawker_vars->f1F8 = -robosquawker_vars->f1F8; + robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->f1F4 = robosquawker_vars->f1F8 * 0.017453292f; + robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } release_robosquawker_particle((Level13VendorMoby *)robosquawker_vars); @@ -665,7 +665,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->w224 = 0; } } - qcopy(&robosquawker_vars->v1E0, path + robosquawker_vars->w224 * 16 + 16); + qcopy(&robosquawker_vars->flight_destination, path + robosquawker_vars->w224 * 16 + 16); robosquawker_moby->state = ROBOSQUAWKER_STATE_FOLLOW_FLIGHT_PATH; } else if (fast_dec_timer(&robosquawker_vars->w20C) != 0) { int i; @@ -681,12 +681,12 @@ void robosquawker_update(RsMoby *robosquawker_moby) { vb.f[1] = fast_sin(a) * r; vb.f[2] = 0.0f; vb.f[2] = random_float_between(5.0f, 7.0f); - fast_vec_add(&robosquawker_vars->v1E0, &vb, &robosquawker_vars->v1D0); - if (probe_ground_height(&robosquawker_vars->v1E0, 0x120, 0.5f) > 1.0f) { + fast_vec_add(&robosquawker_vars->flight_destination, &vb, &robosquawker_vars->home_position); + if (probe_ground_height(&robosquawker_vars->flight_destination, 0x120, 0.5f) > 1.0f) { break; } } - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } robosquawker_moby->state = ROBOSQUAWKER_STATE_FLY_TO_RANDOM_POINT; @@ -696,13 +696,13 @@ void robosquawker_update(RsMoby *robosquawker_moby) { case ROBOSQUAWKER_STATE_FLY_TO_RANDOM_POINT: { float a; - a = fast_arc_tan(robosquawker_vars->v1E0.f[0] - robosquawker_moby->pos.f[0], - robosquawker_vars->v1E0.f[1] - robosquawker_moby->pos.f[1]); + a = fast_arc_tan(robosquawker_vars->flight_destination.f[0] - robosquawker_moby->pos.f[0], + robosquawker_vars->flight_destination.f[1] - robosquawker_moby->pos.f[1]); FUN_L00_00258278( - (char *)robosquawker_moby, &robosquawker_vars->f1F0, a, 0.03f, 0.6f, 0.09f); + (char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.03f, 0.6f, 0.09f); flight_step_length = fast_vec_length(&robosquawker_vars->v40); - robosquawker_moby->f58 = flight_step_length * 20.0f + 1.0f; - fast_vec_sub(&robosquawker_vars->v40, &robosquawker_vars->v1E0, &robosquawker_moby->pos); + robosquawker_moby->animation_playback_speed = flight_step_length * 20.0f + 1.0f; + fast_vec_sub(&robosquawker_vars->v40, &robosquawker_vars->flight_destination, &robosquawker_moby->pos); if (fast_vec_length(&robosquawker_vars->v40) > 1.0f) { approach_value(&flight_step_length, frame_time * 4.0f, frame_time_sq * 6.0f); } else { @@ -712,16 +712,16 @@ void robosquawker_update(RsMoby *robosquawker_moby) { fast_vec_add(&va, &robosquawker_vars->v40, &robosquawker_moby->pos); if (coll_sphere(1.2f, &va, 0, robosquawker_moby) != 0) { clear_u64_value(&robosquawker_vars->v40); - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } robosquawker_moby->state = ROBOSQUAWKER_STATE_FLIGHT_IDLE; } else { qcopy(&robosquawker_moby->pos, &va); } - if (fast_vec_dist(&robosquawker_moby->pos, &robosquawker_vars->v1E0) < flight_step_length || + if (fast_vec_dist(&robosquawker_moby->pos, &robosquawker_vars->flight_destination) < flight_step_length || flight_step_length == 0.0f) { - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } robosquawker_moby->state = ROBOSQUAWKER_STATE_FLIGHT_IDLE; @@ -735,14 +735,14 @@ void robosquawker_update(RsMoby *robosquawker_moby) { float d; path = walker_paths[robosquawker_vars->w220]; - a = fast_arc_tan(robosquawker_vars->v1E0.f[0] - robosquawker_moby->pos.f[0], - robosquawker_vars->v1E0.f[1] - robosquawker_moby->pos.f[1]); + a = fast_arc_tan(robosquawker_vars->flight_destination.f[0] - robosquawker_moby->pos.f[0], + robosquawker_vars->flight_destination.f[1] - robosquawker_moby->pos.f[1]); FUN_L00_00258278( - (char *)robosquawker_moby, &robosquawker_vars->f1F0, a, 0.018f, 0.8f, 0.09f); - fast_vec_sub(&robosquawker_vars->v40, &robosquawker_vars->v1E0, &robosquawker_moby->pos); + (char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.018f, 0.8f, 0.09f); + fast_vec_sub(&robosquawker_vars->v40, &robosquawker_vars->flight_destination, &robosquawker_moby->pos); FUN_L00_0025f730(&robosquawker_vars->v40, frame_time * 4.0f); fast_vec_add(&va, &robosquawker_vars->v40, &robosquawker_moby->pos); - robosquawker_moby->f58 = fast_vec_length(&robosquawker_vars->v40) * 20.0f + 1.0f; + robosquawker_moby->animation_playback_speed = fast_vec_length(&robosquawker_vars->v40) * 20.0f + 1.0f; if (coll_sphere(1.2f, &va, 0, robosquawker_moby) != 0) { int i; @@ -757,19 +757,19 @@ void robosquawker_update(RsMoby *robosquawker_moby) { vb.f[1] = fast_sin(an) * r; vb.f[2] = 0.0f; vb.f[2] = random_float_between(5.0f, 7.0f); - fast_vec_add(&robosquawker_vars->v1E0, &vb, &robosquawker_vars->v1D0); - if (probe_ground_height(&robosquawker_vars->v1E0, 0x120, 0.5f) > 1.0f) { + fast_vec_add(&robosquawker_vars->flight_destination, &vb, &robosquawker_vars->home_position); + if (probe_ground_height(&robosquawker_vars->flight_destination, 0x120, 0.5f) > 1.0f) { break; } } - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } robosquawker_moby->state = ROBOSQUAWKER_STATE_FLY_TO_RANDOM_POINT; } else { qcopy(&robosquawker_moby->pos, &va); } - d = fast_vec_dist(&robosquawker_moby->pos, &robosquawker_vars->v1E0); + d = fast_vec_dist(&robosquawker_moby->pos, &robosquawker_vars->flight_destination); if (d < fast_vec_length(&robosquawker_vars->v40)) { float g; @@ -777,15 +777,15 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (robosquawker_vars->w224 >= *(int *)path) { robosquawker_vars->w224 = 0; } - qcopy(&robosquawker_vars->v1E0, path + robosquawker_vars->w224 * 16 + 16); - robosquawker_vars->v1E0.f[2] = - robosquawker_vars->v1E0.f[2] + random_float_between(-0.2f, 0.2f); + qcopy(&robosquawker_vars->flight_destination, path + robosquawker_vars->w224 * 16 + 16); + robosquawker_vars->flight_destination.f[2] = + robosquawker_vars->flight_destination.f[2] + random_float_between(-0.2f, 0.2f); g = probe_ground_height(&robosquawker_moby->pos, 0x120, 0.5f); - if (g > 1.0f && vector_length_xy(&vb) < robosquawker_vars->f1FC + 4.0f && + if (g > 1.0f && vector_length_xy(&vb) < robosquawker_vars->target_engagement_radius + 4.0f && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 10.0f && random_integer_below(0x13) == 0) { - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } qzero(&robosquawker_vars->v40); @@ -793,12 +793,12 @@ void robosquawker_update(RsMoby *robosquawker_moby) { release_robosquawker_particle((Level13VendorMoby *)robosquawker_vars); } else if (g > 1.0f && robosquawker_moby->bBC == 1 && random_integer_below(4) == 0) { if (random_integer_below(0x100) & 1) { - robosquawker_vars->f1F8 = -robosquawker_vars->f1F8; + robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->f1F4 = robosquawker_vars->f1F8 * 0.017453292f; + robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } release_robosquawker_particle((Level13VendorMoby *)robosquawker_vars); @@ -817,21 +817,21 @@ void robosquawker_update(RsMoby *robosquawker_moby) { g = probe_ground_height(&robosquawker_moby->pos, 0x120, 0.5f); approach_value(&robosquawker_vars->v40.f[2], -(frame_time * 8.0f), frame_time_sq * 10.8f); FUN_L00_00258830(robosquawker_moby, &robosquawker_vars->v40, 0.6f, 0.5f, 0.0f, 0); - if (robosquawker_moby->b53 != 2 && + if (robosquawker_moby->animation_index != 2 && robosquawker_moby->pos.f[2] - g <= frame_time * 8.0f * FUN_L04_001f1978(45.0f) && - robosquawker_moby->b53 != 2) { + robosquawker_moby->animation_index != 2) { blend_moby_animation(robosquawker_moby, 2, 0, scale_game_frames(5)); } if (robosquawker_moby->pos.f[2] <= g) { robosquawker_moby->pos.f[2] = g; if (random_integer_below(0x100) & 1) { - robosquawker_vars->f1F8 = -robosquawker_vars->f1F8; + robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->f1F4 = robosquawker_vars->f1F8 * 0.017453292f; + robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; clear_u64_value(&robosquawker_vars->v40); - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } } @@ -847,10 +847,10 @@ void robosquawker_update(RsMoby *robosquawker_moby) { approach_value(&robosquawker_vars->v40.f[2], frame_time, frame_time_sq * 10.8f); } FUN_L00_00258830(robosquawker_moby, &robosquawker_vars->v40, 0.6f, 0.5f, 0.0f, 0); - robosquawker_moby->f58 = 6.0f - (robosquawker_moby->pos.f[2] - g) / 6.0f * 5.0f; + robosquawker_moby->animation_playback_speed = 6.0f - (robosquawker_moby->pos.f[2] - g) / 6.0f * 5.0f; if (g + 6.0f <= robosquawker_moby->pos.f[2]) { robosquawker_moby->pos.f[2] = g + 6.0f; - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } robosquawker_moby->state = ROBOSQUAWKER_STATE_FLIGHT_IDLE; @@ -861,29 +861,29 @@ void robosquawker_update(RsMoby *robosquawker_moby) { } case ROBOSQUAWKER_STATE_GROUND_IDLE: fast_vec_sub(&va, &selected_target_record, &robosquawker_moby->pos); - if (fast_vec_length(&va) < robosquawker_vars->f1FC + 4.0f && + if (fast_vec_length(&va) < robosquawker_vars->target_engagement_radius + 4.0f && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 8.0f && random_integer_below(0x13) == 0) { robosquawker_moby->state = ROBOSQUAWKER_STATE_FACE_AWAY_WAIT_FOR_CHASE; - if (robosquawker_moby->b53 != 4) { + if (robosquawker_moby->animation_index != 4) { blend_moby_animation(robosquawker_moby, 4, 0, scale_game_frames(3)); } } else if (robosquawker_moby->bBC == 1 && random_integer_below(0x13) == 0) { if (random_integer_below(0x100) & 1) { - robosquawker_vars->f1F8 = -robosquawker_vars->f1F8; + robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->f1F4 = robosquawker_vars->f1F8 * 0.017453292f; + robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } robosquawker_moby->bBC = 0; - } else if (fast_vec_length(&va) > robosquawker_vars->f1FC + 6.0f && + } else if (fast_vec_length(&va) > robosquawker_vars->target_engagement_radius + 6.0f && robosquawker_vars->h20A == 0) { qzero(&robosquawker_vars->v40); robosquawker_moby->state = ROBOSQUAWKER_STATE_TAKEOFF; - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } } @@ -891,12 +891,12 @@ void robosquawker_update(RsMoby *robosquawker_moby) { break; case ROBOSQUAWKER_STATE_WAIT_FOR_CLOSE_TARGET: fast_vec_sub(&va, &selected_target_record, &robosquawker_moby->pos); - if (fast_vec_length(&va) < robosquawker_vars->f1FC - 4.0f && + if (fast_vec_length(&va) < robosquawker_vars->target_engagement_radius - 4.0f && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 8.0f && random_integer_below(0x13) == 0) { robosquawker_moby->state = ROBOSQUAWKER_STATE_FACE_AWAY_WAIT_FOR_CHASE; robosquawker_moby->pos.f[2] += 1.0f; - if (robosquawker_moby->b53 != 4) { + if (robosquawker_moby->animation_index != 4) { blend_moby_animation(robosquawker_moby, 4, 0, scale_game_frames(3)); } } @@ -904,26 +904,26 @@ void robosquawker_update(RsMoby *robosquawker_moby) { case ROBOSQUAWKER_STATE_PREPARE_HOME_HOP: { float a; - a = fast_arc_tan(robosquawker_vars->v1D0.f[0] - robosquawker_moby->pos.f[0], - robosquawker_vars->v1D0.f[1] - robosquawker_moby->pos.f[1]); - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->f1F0, a, 0.05f, 0.3f, 0.2f); - fast_vec_sub(&va, &selected_target_record, &robosquawker_vars->v1D0); - if ((fast_vec_length(&va) < robosquawker_vars->f1FC && - absolute_float(robosquawker_vars->v1D0.f[2] - selected_target_record.pos.f[2]) < + a = fast_arc_tan(robosquawker_vars->home_position.f[0] - robosquawker_moby->pos.f[0], + robosquawker_vars->home_position.f[1] - robosquawker_moby->pos.f[1]); + FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); + fast_vec_sub(&va, &selected_target_record, &robosquawker_vars->home_position); + if ((fast_vec_length(&va) < robosquawker_vars->target_engagement_radius && + absolute_float(robosquawker_vars->home_position.f[2] - selected_target_record.pos.f[2]) < 8.0f) || robosquawker_moby->bBC == 2) { if (robosquawker_moby->b21 != 0xFF) { FUN_L01_0026e090(robosquawker_moby->b21, 2); } - if (robosquawker_moby->b53 != (rand() & 1) + 9) { + if (robosquawker_moby->animation_index != (rand() & 1) + 9) { blend_moby_animation(robosquawker_moby, (rand() & 1) + 9, 0, scale_game_frames(3)); } - robosquawker_vars->f134 = 0.0f; - robosquawker_vars->f130 = robosquawker_home_hop_gravity_gp; - robosquawker_vars->f138 = robosquawker_home_hop_horizontal_speed_gp * frame_time; - robosquawker_vars->f13C = + robosquawker_vars->motion_horizontal_speed_change_limit = 0.0f; + robosquawker_vars->motion_gravity_step = robosquawker_home_hop_gravity_gp; + robosquawker_vars->motion_horizontal_launch_step = robosquawker_home_hop_horizontal_speed_gp * frame_time; + robosquawker_vars->motion_vertical_launch_step = FUN_L00_0025abf0(&robosquawker_moby->pos, - &robosquawker_vars->v1D0, + &robosquawker_vars->home_position, &home_hop_travel_duration, robosquawker_home_hop_horizontal_speed_gp * frame_time, -robosquawker_home_hop_gravity_gp); @@ -935,8 +935,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { (rand() & 1) + 9, 1, 0); - robosquawker_vars->f170 = 5.0f; - robosquawker_vars->f174 = 10.0f; + robosquawker_vars->motion_ascent_end_animation_frame = 5.0f; + robosquawker_vars->motion_descent_end_animation_frame = 10.0f; update_robosquawker_particle((unsigned char *)robosquawker_moby, (char *)robosquawker_vars); robosquawker_moby->state = ROBOSQUAWKER_STATE_HOME_HOP; @@ -949,11 +949,11 @@ void robosquawker_update(RsMoby *robosquawker_moby) { qzero(robosquawker_vars->x120); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; if (random_integer_below(0x100) & 1) { - robosquawker_vars->f1F8 = -robosquawker_vars->f1F8; + robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->f1F4 = robosquawker_vars->f1F8 * 0.017453292f; + robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 8, scale_game_frames(3)); } return; @@ -968,37 +968,37 @@ void robosquawker_update(RsMoby *robosquawker_moby) { a = fast_arc_tan(robosquawker_moby->pos.f[0] - selected_target_record.pos.f[0], robosquawker_moby->pos.f[1] - selected_target_record.pos.f[1]); - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->f1F0, a, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); fast_vec_sub(&va, &selected_target_record, &robosquawker_moby->pos); - if (fast_vec_length(&va) < robosquawker_vars->f1FC && + if (fast_vec_length(&va) < robosquawker_vars->target_engagement_radius && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 8.0f && random_integer_below(0x13) == 0) { if (robosquawker_moby->b21 != 0xFF) { FUN_L01_0026e090(robosquawker_moby->b21, 1); } if (random_integer_below(0x100) & 1) { - robosquawker_vars->f1F8 = -robosquawker_vars->f1F8; + robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->f1F4 = robosquawker_vars->f1F8 * 0.017453292f; + robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } robosquawker_moby->bBC = 0; } else if (robosquawker_moby->bBC == 1 && random_integer_below(0x13) == 0) { if (random_integer_below(0x100) & 1) { - robosquawker_vars->f1F8 = -robosquawker_vars->f1F8; + robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->f1F4 = robosquawker_vars->f1F8 * 0.017453292f; + robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } robosquawker_moby->bBC = 0; } - if (robosquawker_moby->b53 == 4 && (robosquawker_moby->b70 & 2)) { + if (robosquawker_moby->animation_index == 4 && (robosquawker_moby->b70 & 2)) { blend_moby_animation(robosquawker_moby, 3, 0, scale_game_frames(3)); } update_robosquawker_ground_height((char *)robosquawker_moby, (char *)robosquawker_vars); @@ -1022,8 +1022,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { } a = fast_arc_tan(vb.f[0] - robosquawker_moby->pos.f[0], vb.f[1] - robosquawker_moby->pos.f[1]) + - robosquawker_vars->f1F4; - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->f1F0, a, 0.05f, 0.3f, 0.2f); + robosquawker_vars->chase_yaw_offset_radians; + FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * 2.0f; va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * 2.0f; va.f[2] = 0.0f; @@ -1031,9 +1031,9 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); if (fast_dec_timer(&robosquawker_vars->w210) != 0) { robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); - robosquawker_vars->f1F4 = -robosquawker_vars->f1F4; + robosquawker_vars->chase_yaw_offset_radians = -robosquawker_vars->chase_yaw_offset_radians; } - fast_vec_sub(&vc, &selected_target_record, &robosquawker_vars->v1D0); + fast_vec_sub(&vc, &selected_target_record, &robosquawker_vars->home_position); d = vector_distance_xy(&robosquawker_moby->pos, &selected_target_record); if ((d < 1.5f || (selected_target_record.moby != 0 && selected_target_record.moby->hA6 == 0x10E && @@ -1041,7 +1041,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { selected_target_record.moby->state != 0xFD && d < 2.3f)) && !(res & 2)) { robosquawker_moby->state = ROBOSQUAWKER_STATE_PECK_ATTACK; - if (robosquawker_moby->b53 != 6) { + if (robosquawker_moby->animation_index != 6) { blend_moby_animation(robosquawker_moby, 6, 0, scale_game_frames(3)); } } else { @@ -1049,7 +1049,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_moby->pos.f[0] = previous_position.f[0]; robosquawker_moby->pos.f[1] = previous_position.f[1]; } - if (fast_vec_length(&vc) < robosquawker_vars->f1FC + 4.0f && + if (fast_vec_length(&vc) < robosquawker_vars->target_engagement_radius + 4.0f && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 8.0f) { if (robosquawker_moby->b21 != 0xFF) { @@ -1074,8 +1074,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { a = fast_arc_tan(selected_target_record.pos.f[0] - robosquawker_moby->pos.f[0], selected_target_record.pos.f[1] - robosquawker_moby->pos.f[1]); - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->f1F0, a, 0.05f, 0.3f, 0.2f); - same = robosquawker_moby->b52 == robosquawker_moby->b53; + FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); + same = robosquawker_moby->b52 == robosquawker_moby->animation_index; hh = compute_interpolated_record_value(robosquawker_moby); dz = absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]); d = vector_distance_xy(&robosquawker_moby->pos, &selected_target_record); @@ -1101,15 +1101,15 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if ((robosquawker_moby->b70 & 2) && vector_distance_xy(&robosquawker_moby->pos, &selected_target_record) > 1.5f) { robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } } g = probe_ground_height(&robosquawker_moby->pos, 0x120, 0.5f); - robosquawker_vars->f198 -= frame_time_sq * 9.8f; - robosquawker_moby->pos.f[2] += robosquawker_vars->f198; + robosquawker_vars->ground_vertical_step -= frame_time_sq * 9.8f; + robosquawker_moby->pos.f[2] += robosquawker_vars->ground_vertical_step; if (robosquawker_moby->pos.f[2] < g) { - robosquawker_vars->f198 = 0.0f; + robosquawker_vars->ground_vertical_step = 0.0f; robosquawker_moby->pos.f[2] = g; } update_robosquawker_ground_height((char *)robosquawker_moby, (char *)robosquawker_vars); @@ -1122,44 +1122,44 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (robosquawker_vars->w21C != -1) { select_list_point_toward_target(robosquawker_moby, walker_paths[robosquawker_vars->w21C], - &robosquawker_vars->v1D0, + &robosquawker_vars->home_position, &vb); } else { - qcopy(&vb, &robosquawker_vars->v1D0); + qcopy(&vb, &robosquawker_vars->home_position); } a = fast_arc_tan(vb.f[0] - robosquawker_moby->pos.f[0], vb.f[1] - robosquawker_moby->pos.f[1]); - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->f1F0, a, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * 2.0f; va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * 2.0f; va.f[2] = 0.0f; res = move_moby_with_ground_and_collision_checks( robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); - if (vector_distance_xy(&robosquawker_moby->pos, &robosquawker_vars->v1D0) < 2.0f) { + if (vector_distance_xy(&robosquawker_moby->pos, &robosquawker_vars->home_position) < 2.0f) { robosquawker_moby->state = ROBOSQUAWKER_STATE_GROUND_IDLE; - if (robosquawker_moby->b53 != 3) { + if (robosquawker_moby->animation_index != 3) { blend_moby_animation(robosquawker_moby, 3, 0, scale_game_frames(3)); } } - fast_vec_sub(&vc, &selected_target_record, &robosquawker_vars->v1D0); - if (fast_vec_length(&vc) < robosquawker_vars->f1FC) { + fast_vec_sub(&vc, &selected_target_record, &robosquawker_vars->home_position); + if (fast_vec_length(&vc) < robosquawker_vars->target_engagement_radius) { if (robosquawker_moby->b21 != 0xFF) { FUN_L01_0026e090(robosquawker_moby->b21, 1); } robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } } else if (robosquawker_moby->bBC == 1) { robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } } else if (res & 2) { robosquawker_moby->pos.f[0] = previous_position.f[0]; robosquawker_moby->pos.f[1] = previous_position.f[1]; robosquawker_moby->state = ROBOSQUAWKER_STATE_BLOCKED_RETURN_HOME; - if (robosquawker_moby->b53 != 4) { + if (robosquawker_moby->animation_index != 4) { blend_moby_animation(robosquawker_moby, 4, 0, scale_game_frames(3)); } } @@ -1171,7 +1171,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (step_moby_motion(robosquawker_moby, robosquawker_vars->x120) & 1) { qzero(robosquawker_vars->x120); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } return; @@ -1185,7 +1185,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { release_robosquawker_particle((Level13VendorMoby *)robosquawker_vars); if (FUN_L00_002dc9f0(robosquawker_moby, robosquawker_vars->x120) != 0) { robosquawker_moby->state = ROBOSQUAWKER_STATE_FLIGHT_IDLE; - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, 0); } robosquawker_vars->hC8 = 0; @@ -1219,29 +1219,29 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (robosquawker_vars->w21C != -1) { select_list_point_toward_target(robosquawker_moby, walker_paths[robosquawker_vars->w21C], - &robosquawker_vars->v1D0, + &robosquawker_vars->home_position, &vb); } else { - qcopy(&vb, &robosquawker_vars->v1D0); + qcopy(&vb, &robosquawker_vars->home_position); } a = fast_arc_tan(vb.f[0] - robosquawker_moby->pos.f[0], vb.f[1] - robosquawker_moby->pos.f[1]); - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->f1F0, a, 0.05f, 0.3f, 0.2f); + FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * 2.0f; va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * 2.0f; va.f[2] = 0.0f; res = move_moby_with_ground_and_collision_checks( robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); - fast_vec_sub(&vc, &selected_target_record, &robosquawker_vars->v1D0); + fast_vec_sub(&vc, &selected_target_record, &robosquawker_vars->home_position); if (vector_distance_xy(&robosquawker_moby->pos, &selected_target_record) < 1.5f && r <= 1.0f) { robosquawker_moby->state = ROBOSQUAWKER_STATE_PECK_ATTACK; - if (robosquawker_moby->b53 != 6) { + if (robosquawker_moby->animation_index != 6) { blend_moby_animation(robosquawker_moby, 6, 0, scale_game_frames(3)); } } else if (r <= 1.0f && !(res & 2)) { robosquawker_moby->state = ROBOSQUAWKER_STATE_RETURN_HOME; - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } } else { @@ -1258,7 +1258,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (random_integer_below(0x63) == 0) { qzero(&robosquawker_vars->v40); robosquawker_moby->state = ROBOSQUAWKER_STATE_TAKEOFF; - if (robosquawker_moby->b53 != 0) { + if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } } @@ -1270,11 +1270,11 @@ void robosquawker_update(RsMoby *robosquawker_moby) { RsOther *candidate_moby; float g; - if (robosquawker_moby->b52 != 5 && robosquawker_moby->b53 != 5) { + if (robosquawker_moby->b52 != 5 && robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } - va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * (robosquawker_vars->f204 * frame_time); - va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * (robosquawker_vars->f204 * frame_time); + va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * (robosquawker_vars->walking_speed * frame_time); + va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * (robosquawker_vars->walking_speed * frame_time); va.f[2] = 0.0f; fast_vec_add(&vb, &robosquawker_moby->pos, &va); for (candidate_moby = (RsOther *)level13_moby_list_head; candidate_moby != 0; @@ -1310,17 +1310,17 @@ void robosquawker_update(RsMoby *robosquawker_moby) { } qcopy(&robosquawker_moby->pos, &vb); g = probe_ground_height(&robosquawker_moby->pos, 0x120, 0.5f); - robosquawker_vars->f198 -= frame_time_sq * 9.8f; - robosquawker_moby->pos.f[2] += robosquawker_vars->f198; + robosquawker_vars->ground_vertical_step -= frame_time_sq * 9.8f; + robosquawker_moby->pos.f[2] += robosquawker_vars->ground_vertical_step; if (robosquawker_moby->pos.f[2] < g) { - robosquawker_vars->f198 = 0.0f; + robosquawker_vars->ground_vertical_step = 0.0f; robosquawker_moby->pos.f[2] = g; } - if (robosquawker_vars->p218 == 0 || - vector_distance_xy(&robosquawker_moby->pos, robosquawker_vars->p218 + 0x10) > + if (robosquawker_vars->walk_range_anchor == 0 || + vector_distance_xy(&robosquawker_moby->pos, robosquawker_vars->walk_range_anchor + 0x10) > convert_integer_to_float(robosquawker_vars->h216)) { robosquawker_moby->state = ROBOSQUAWKER_STATE_RETURN_HOME; - if (robosquawker_moby->b53 != 5) { + if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } } From 8f4f61c41b6ba523cff0e8ef9392358416549ea9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:04:32 +0000 Subject: [PATCH 424/758] decomp: clarify names in emit_sand_shark_single_particle D_L02_001619A4 -> l02_sand_shark_single_particle_header_selector: Authoritative C defines s32 D_L02_001619A4 = -1 and passes it as spawn_spark's ninth argument. Original retail 0x002d5c2c loads it, 0x002d5c44 stores it at caller sp+0, and 0x002d5c50 calls level-02 0x0026a730. Checked helper request c15db0eff13b45a292e455dfc5fea4c6 shows 0x0026a78c loading that argument into s1. At 0x0026a7e8-0x0026a804, -1 selects the pointer at 0x001b26dc and copies its first byte into particle+2; otherwise 0x0026a808-0x0026a82c uses the low 16 bits to select a pointer from 0x001b2680 and writes its first byte to particle+2. Bit 16 changes particle+3 from 0x44 to 0x48 at 0x0026a820-0x0026a834. This proves a particle header selector independently of resource identity and agrees with the current analogous radial emitter header_selector name, with a distinct single_particle qualifier for this assembler binding. --- src/overlays/l02/mobys/sand_shark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 5b6cc1a6df..756aa42345 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -1118,7 +1118,7 @@ extern s32 sand_shark_single_particle_third_frame_count_range_end_gp __asm__("D_ __attribute__((sda)); s32 l02_sand_shark_single_particle_initial_color __asm__("D_L02_0016199C") = 0x40306058; s32 l02_sand_shark_single_particle_secondary_color __asm__("D_L02_001619A0") = 0x10306058; -s32 D_L02_001619A4 = -1; +s32 l02_sand_shark_single_particle_header_selector __asm__("D_L02_001619A4") = -1; void emit_sand_shark_single_particle(Vec4 *from) __asm__("FUN_L02_002d5a68"); @@ -1180,7 +1180,7 @@ void emit_sand_shark_single_particle(Vec4 *from) { frame_count, second_frame_count, third_frame_count, - D_L02_001619A4); + l02_sand_shark_single_particle_header_selector); } /* pvars of the class FUN_L02_002d5c88 updates (only the fields it touches). */ From a5b9459cb102dd01a8600f46055cf1eff8fe77a1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:06:52 +0000 Subject: [PATCH 425/758] decomp: clarify names in qwarks_starfighter_update b30 -> update_distance: Assigned original Ghidra case 0 stores 0xFF to param_1+0x30; assigned retail 0x002eb340-0x002eb34c loads 0xFF and stores it at moby+0x30, matching Moby388 b30. The authoritative supplied spawn_moby_joint_attachment source names the corresponding created-Moby assignment MOBY(moby)->update_dist = 0xFF, alongside draw_dist = 0xFF and explicit byte +0x31 = 1. Checked direct-child retail 0x002ecd38 keeps the created Moby in s1, 0x002ecd40 loads v1=0xFF and 0x002ecd70 stores v1 at +0x30(s1); separate stores at 0x002ecd7c and 0x002ecd80 write +0x32 and +0x31. This source/instruction correspondence identifies b30 as the existing Moby update-distance field, rather than inferring meaning from an offset alone. --- 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 580124a783..d36fe1e116 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -1505,7 +1505,7 @@ typedef struct { char *cls; int pad28; float scale; - unsigned char b30; + unsigned char update_distance; unsigned char b31; short s32; unsigned short flags; @@ -1676,7 +1676,7 @@ void qwarks_starfighter_update(Moby388 *moby) { qcopy(moby->pos, walker_paths[starfighter_vars->paths[0]] + 0x10); starfighter_vars->path_previous_node_index = 0; starfighter_vars->path_target_node_index = 1; - moby->b30 = 0xFF; + moby->update_distance = 0xFF; moby->s32 = 0xFF; starfighter_vars->path_traversal_direction = 1; starfighter_vars->bFE = 0; From 9b26fe31edc51bcd66543778a749bd8c147e71bf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:06:55 +0000 Subject: [PATCH 426/758] decomp: clarify names in robot_dog_update f188 -> movement_drop_limit: Root 002c5d0c initializes pvars+0x188 to 2.0; 002c612c/002c6138 passes pvars+0x180 as movement state. Checked helper 00247738 saves original moby position at 002477bc-002477d0. At 00247b24 it obtains a float reference using the moby position; 00247b2c-00247b44 compares saved Z minus that reference against relative +0x08 (pvars+0x188). Exceeding this limit branches to 00247b64-00247b68, sets rejection flags and restores the saved position. This proves the downward height tolerance in movement acceptance without assigning helper internals or collision-bit meanings. f18C -> movement_rise_limit: Root 002c5d20 initializes pvars+0x18C to 2.0; movement receives pvars+0x180 at 002c612c-002c6138. Checked movement helper saves original moby position at 002477bc-002477d0. After the float-reference call at 00247b24, 00247b4c subtracts saved Z from the returned reference, 00247b50 loads relative +0x0C (pvars+0x18C), and 00247b54-00247b5c rejects when the upward difference exceeds it. Rejection at 00247b64-00247b68 restores the saved position. This establishes the upward height tolerance paired with f188's opposite-direction test. --- 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 8f70af0597..9fd3f54668 100644 --- a/src/overlays/l03/mobys/robot_dog.c +++ b/src/overlays/l03/mobys/robot_dog.c @@ -82,8 +82,8 @@ typedef struct { char knockback_motion_state[0x60]; int i180; char p184[4]; - float f188; - float f18C; + float movement_drop_limit; + float movement_rise_limit; char p190[0x14]; float max_movement_step; float movement_heading_error_limit; @@ -187,7 +187,7 @@ void robot_dog_update(char *moby) { robot_dog_state->path_turn_spring_strength = frame_time_sq * 6.2831855f; robot_dog_state->path_turn_damping_factor = frame_time_sq * 12.566371f; robot_dog_state->path_turn_step_limit = frame_time * 3.1415927f; - robot_dog_state->f188 = robot_dog_state->f18C = 2.0f; + robot_dog_state->movement_drop_limit = robot_dog_state->movement_rise_limit = 2.0f; robot_dog_state->i180 = 0x38D; robot_dog_state->max_movement_step = robot_dog_state->movement_speed * frame_time; robot_dog_state->movement_control_flags |= 0x20; From 5f8e3be118012397284489338163079ba51cc7d0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:09:19 +0000 Subject: [PATCH 427/758] decomp: clarify names in birdbot_update b28 -> hit_response_profile_index: b28 -> hit_response_profile_index. In bound C initialization b28 is set to 1; retail 0x002e72d4 stores 1 at vars+0x28. The assigned call at 0x002e6cf4-0x002e6d08 passes vars+0x20 to the hit evaluator. Checked helper request 090f0504cdce4d35bfa9911ce0b6ef58 proves s2 is that record (0x0026f3a8); record+8 is used to select the damage scalar table entry at 0x0026f414-0x0026f428, replaces default profile argument 4 at 0x0026f480-0x0026f484, and selects a byte column within the hit-category response table at 0x0026f750-0x0026f770. That selected byte is returned as the reaction at 0x0026f8c0. Thus this byte selects a hit response profile, rather than representing health, a boolean, or the current moby state. --- src/overlays/l01/mobys/birdbot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/birdbot.c b/src/overlays/l01/mobys/birdbot.c index 689bdf5d77..05f4703277 100644 --- a/src/overlays/l01/mobys/birdbot.c +++ b/src/overlays/l01/mobys/birdbot.c @@ -300,7 +300,7 @@ typedef struct { float f20; short h24; short h26; - unsigned char b28; + unsigned char hit_response_profile_index; unsigned char b29; char pad2A[0xE]; int w38; @@ -701,7 +701,7 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->f20 = 2.0f; birdbot_vars->h24 = truncate_float_to_s32(birdbot_vars->f20); birdbot_vars->b29 = 0; - birdbot_vars->b28 = 1; + birdbot_vars->hit_response_profile_index = 1; clear_u64_value(&birdbot_vars->v40); birdbot_vars->w1C8 = -1; if (birdbot_moby->b53 != 0) { From cefeca7c984118f1646010b63c6e5001b31ff5fd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:21:43 +0000 Subject: [PATCH 428/758] decomp: clarify names in robosquawker_update b21 -> command_recipient_list_index: Assigned retail 002b5304-002b5318 reads moby+0x21, skips 0xff and passes it as a0 with command 1 to 00265000; 002b66b0-002b66c4 passes the same field with command 2 for home hop. Checked helper report 2216cb7829094bdcbe757df9f4ec4fab shows 00265000-00265010 scales a0 by four and loads a list pointer from 001abb40. At 00265020-00265044 it reads each packed 16-bit recipient index, masks 0x7fff, scales by 0x100, adds moby base loaded from 0015ffd8 and stores a1 into recipient moby+0xbc. The signed list entry terminates traversal. Source branches consume byte+0xbc as chase/home-hop requests, proving this field indexes the command recipient list. f188 -> ground_max_drop_height: Authoritative robosquawker.c SHA-256 764a4750cd8a4348ab66b606d5fea93cf908c723a61ffb9142f6d29cd422b9f4 sets vars+0x188 to 2.0 at retail 002b5644. Calls at 002b6b6c-002b6b78 pass vars+0x180 as movement record. Checked level-13 helper 00264918 (request dbd85fe3dcb84bd1bee5bf30a1a3eb4c) keeps that record in s1; after ground probe 00264d04 it subtracts ground height f3 from saved starting Z f2 at 00264d18, compares the positive drop to record+8 at 00264d14-00264d24, and restores saved position/sets rejection bits at 00264d44-00264d48 if exceeded. This proves maximum permitted ground drop height. f18C -> ground_max_rise_height: Authoritative robosquawker.c SHA-256 764a4750cd8a4348ab66b606d5fea93cf908c723a61ffb9142f6d29cd422b9f4 sets vars+0x18C to 2.0 at retail 002b5654. The vars+0x180 movement record is passed at 002b6b6c-002b6b78. Checked level-13 helper 00264918 (request dbd85fe3dcb84bd1bee5bf30a1a3eb4c) uses s1 for that record, probes ground at 00264d04, computes ground height f3 minus saved starting Z f2 at 00264d2c, and compares this rise to record+0xC at 00264d30-00264d3c. Exceeding the limit falls into 00264d44-00264d48, setting rejection bits and restoring the prior position. This proves maximum permitted ground rise height. --- src/overlays/l13/mobys/robosquawker.c | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/overlays/l13/mobys/robosquawker.c b/src/overlays/l13/mobys/robosquawker.c index 13a98dfe30..10008f65a8 100644 --- a/src/overlays/l13/mobys/robosquawker.c +++ b/src/overlays/l13/mobys/robosquawker.c @@ -296,8 +296,8 @@ typedef struct { char pad178[8]; int w180; int w184; - float f188; - float f18C; + float ground_max_drop_height; + float ground_max_rise_height; char pad190[8]; float ground_vertical_step; char pad19C[8]; @@ -332,7 +332,7 @@ typedef struct { char pad0[0x10]; RsVec pos; unsigned char state; - unsigned char b21; + unsigned char command_recipient_list_index; char pad22[2]; char *w24; char pad28[9]; @@ -531,8 +531,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (hit->src->hA6 >= 0xB0 && hit->src->hA6 <= 0xB1 && robosquawker_vars->h26 != 0) { hit->damage_amount = 0.0f; } - if (robosquawker_moby->b21 != 0xFF) { - FUN_L01_0026e090(robosquawker_moby->b21, 1); + if (robosquawker_moby->command_recipient_list_index != 0xFF) { + FUN_L01_0026e090(robosquawker_moby->command_recipient_list_index, 1); } if (hit->damage_amount != 0.0f) { knockback_yaw = @@ -614,8 +614,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->b5A = 4; FUN_L01_0026d930((char *)&robosquawker_vars->w180); robosquawker_vars->w180 = 0x38D; - robosquawker_vars->f18C = 2.0f; - robosquawker_vars->f188 = 2.0f; + robosquawker_vars->ground_max_rise_height = 2.0f; + robosquawker_vars->ground_max_drop_height = 2.0f; robosquawker_vars->ground_movement_step_length = robosquawker_vars->walking_speed * frame_time; robosquawker_vars->w1B8 |= 0x30; if (rand() & 1) { @@ -912,8 +912,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { absolute_float(robosquawker_vars->home_position.f[2] - selected_target_record.pos.f[2]) < 8.0f) || robosquawker_moby->bBC == 2) { - if (robosquawker_moby->b21 != 0xFF) { - FUN_L01_0026e090(robosquawker_moby->b21, 2); + if (robosquawker_moby->command_recipient_list_index != 0xFF) { + FUN_L01_0026e090(robosquawker_moby->command_recipient_list_index, 2); } if (robosquawker_moby->animation_index != (rand() & 1) + 9) { blend_moby_animation(robosquawker_moby, (rand() & 1) + 9, 0, scale_game_frames(3)); @@ -973,8 +973,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (fast_vec_length(&va) < robosquawker_vars->target_engagement_radius && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 8.0f && random_integer_below(0x13) == 0) { - if (robosquawker_moby->b21 != 0xFF) { - FUN_L01_0026e090(robosquawker_moby->b21, 1); + if (robosquawker_moby->command_recipient_list_index != 0xFF) { + FUN_L01_0026e090(robosquawker_moby->command_recipient_list_index, 1); } if (random_integer_below(0x100) & 1) { robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; @@ -1052,8 +1052,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (fast_vec_length(&vc) < robosquawker_vars->target_engagement_radius + 4.0f && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 8.0f) { - if (robosquawker_moby->b21 != 0xFF) { - FUN_L01_0026e090(robosquawker_moby->b21, 1); + if (robosquawker_moby->command_recipient_list_index != 0xFF) { + FUN_L01_0026e090(robosquawker_moby->command_recipient_list_index, 1); } } else if (robosquawker_moby->bBC != 1) { robosquawker_moby->state = ROBOSQUAWKER_STATE_RETURN_HOME; @@ -1143,8 +1143,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { } fast_vec_sub(&vc, &selected_target_record, &robosquawker_vars->home_position); if (fast_vec_length(&vc) < robosquawker_vars->target_engagement_radius) { - if (robosquawker_moby->b21 != 0xFF) { - FUN_L01_0026e090(robosquawker_moby->b21, 1); + if (robosquawker_moby->command_recipient_list_index != 0xFF) { + FUN_L01_0026e090(robosquawker_moby->command_recipient_list_index, 1); } robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; if (robosquawker_moby->animation_index != 5) { From f572ae654aa918f905dcbfea14688f80aa58b3cf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:23:42 +0000 Subject: [PATCH 429/758] decomp: clarify names in update_falling_effect_particle domain_0_value_2 -> FALLING_PARTICLE_GROUND_TEST_SKIP_PROBE: The authoritative C compares FallingParticle.ground_test_mode at offset +0x0a against 2. Retail 0x00268e28 loads this signed halfword, 0x00268e2c loads 2, and beq at 0x00268e30 targets 0x00268ec0 (gravity/cache update), bypassing changed-cell comparisons at 0x00268e38-0x00268e58, ground_height_at calls at 0x00268e68/0x00268e90, and probe.z culling at 0x00268e9c-0x00268eb4. Original Ghidra has the same *(short *)(iVar2 + 10) != 2 guard. Thus this value skips the probe ground test, while earlier pos/cached-ground tests at 0x00268d6c-0x00268dd8 still run. No existing constants or shared enum domains were supplied. --- src/overlays/shared/rendering/effects/register_part_types.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/rendering/effects/register_part_types.c b/src/overlays/shared/rendering/effects/register_part_types.c index a52a348a13..550a340079 100644 --- a/src/overlays/shared/rendering/effects/register_part_types.c +++ b/src/overlays/shared/rendering/effects/register_part_types.c @@ -139,6 +139,9 @@ extern ParticleClearance particle_clearance __asm__("D_L00_00160258"); extern f32 particle_min_ground __asm__("D_L00_00160260"); void update_falling_effect_particle(FallingParticle *particle) { + enum { + FALLING_PARTICLE_GROUND_TEST_SKIP_PROBE = 2 + }; Vec4 step; Vec4 ground_test_probe; Vec4 ground_sample_probe; @@ -156,7 +159,7 @@ void update_falling_effect_particle(FallingParticle *particle) { fast_vec_add(&step, vel, &particle_drift); fast_vec_add(&particle->probe, &particle->probe, &step); fast_vec_add(&particle->pos, &particle->pos, &step); - if (particle->ground_test_mode != 2) { + if (particle->ground_test_mode != FALLING_PARTICLE_GROUND_TEST_SKIP_PROBE) { if (cell_x != (s32)particle->probe.f[0] || cell_y != (s32)particle->probe.f[1]) { ground_test_probe.q = particle->probe.q; if (ground_height_at(&ground_test_probe) < particle_min_ground) { From 6e34e856fa04e8f7c96555abc135159a6c96011d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:23:42 +0000 Subject: [PATCH 430/758] decomp: clarify names in scatter_moby_from_hazards domain_0_value_254 -> MOBY_STATE_MARKED_FOR_REMOVAL: Retail 0x002df1ec preserves the candidate moby in s0; 0x002df220 loads its +0x20 state byte and 0x002df224-0x002df228 compare 0xFE and return before collection. The caller update_suck_cannon_suction passes candidate_moby, and the same pointer reaches begin_bolt_attraction or try_collect_ammo_pickup at 0x002df35c/0x002df36c, proving the selector is the moby state rather than the suction record state. In this authoritative source, FUN_L00_002dc9f0 declares MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE and applies it to moby->state with the same adjacent 0xFD exclusion. Reuse that established name for this identical moby-state sentinel. --- src/overlays/shared/weapons/suckcannon.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 45a47a7618..90fe9fcbd1 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -3251,11 +3251,14 @@ void stop_suck_cannon_suction_effect(int callback_context) { void scatter_moby_from_hazards(O_2df1e0 *p) __asm__("FUN_L00_002df1e0"); void scatter_moby_from_hazards(O_2df1e0 *pickup_moby) { + enum { + MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE + }; s32 i; f32 beam_segment_collection_radius; if (pickup_moby == 0) return; - if (pickup_moby->pickup_moby_state == 0xFE) + if (pickup_moby->pickup_moby_state == MOBY_STATE_MARKED_FOR_REMOVAL) return; if (pickup_moby->pickup_moby_state == 0xFD) return; From 08948f31127f7bf89d5f9b8f2393af9a2c80c85a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:26:43 +0000 Subject: [PATCH 431/758] decomp: clarify names in link_triggered_moby_motion_update domain_0_value_1 -> LINKED_MOTION_STATE_WAIT_FOR_LINK_TRIGGER: Authoritative source labels link_triggered_moby_motion_update as Moby class 1159 (=0x487). Retail 0030e9d4 loads a0=0x487 and 0030e9f0 calls create_moby; 0030e9f8 retains that result in s0. Thus the spawned moby belongs to the assigned updater's class, rather than an unrelated state domain. Retail 0030ea58-0030ea70 copies the same pvars offsets +8,+0x10,+0x14 into the spawned moby; 0030ea90 writes s3=1 to its +0x20 state, while 0030eaa0 writes the same state to the input. This updater's 0030e998-0030e99c dispatches state 1 to 0030eaa4-0030eb18, which waits for linked class 0x267/state 4 or class 0x33e/nonzero command before entering motion state 2. Reuse its established LINKED_MOTION_STATE_WAIT_FOR_LINK_TRIGGER member for this same-class spawned instance. --- src/overlays/l11/mobys/link_triggered_moby_motion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/l11/mobys/link_triggered_moby_motion.c b/src/overlays/l11/mobys/link_triggered_moby_motion.c index b98e684504..974dfaa0c3 100644 --- a/src/overlays/l11/mobys/link_triggered_moby_motion.c +++ b/src/overlays/l11/mobys/link_triggered_moby_motion.c @@ -68,7 +68,7 @@ void link_triggered_moby_motion_update(struct Moby *moving_moby) { source_moby_class = moving_moby->pclass; moving_moby->scale = source_moby_class->scale * private_data->unkC; spawned_moby->scale = source_moby_class->scale * private_data->unkC; - spawned_moby->state = 1; + spawned_moby->state = LINKED_MOTION_STATE_WAIT_FOR_LINK_TRIGGER; moving_moby->state = LINKED_MOTION_STATE_WAIT_FOR_LINK_TRIGGER; break; case LINKED_MOTION_STATE_WAIT_FOR_LINK_TRIGGER: From c4873337a1d2d4df62eb8dcf5c85ee4593875db1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:30:44 +0000 Subject: [PATCH 432/758] decomp: clarify names in rocket_tank_update domain_0_value_0 -> ROCKET_TANK_AIM_YAW_OSCILLATION_INITIAL_PHASE: Retail 0x002f7c68 loads the tank private-data pointer into s1. When patrolling transitions to firing, 0x002f7e1c stores zero to s1+0x134, corresponding exactly to tank_data->aim_yaw_oscillation_phase = 0 in the bound source. Firing loads this same field at 0x002f7e88, adds frame_time*6.2831855 through fast_add_rotations at 0x002f7e8c, and stores the advanced phase at 0x002f7ea4. Checked direct helper 0x002f8050 loads the same private data at 0x002f808c; 0x002f8460/0x002f8464 passes +0x134 to fast_sin, 0x002f8478 scales by 0.08726646, and 0x002f8484..0x002f848c adds that offset to target yaw. Thus zero initializes the aim-yaw oscillation phase on firing entry, separate from all state/mode enum domains. --- src/overlays/l18/mobys/rocket_tank.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l18/mobys/rocket_tank.c b/src/overlays/l18/mobys/rocket_tank.c index 805097fa22..09a13b5174 100644 --- a/src/overlays/l18/mobys/rocket_tank.c +++ b/src/overlays/l18/mobys/rocket_tank.c @@ -93,6 +93,9 @@ void rocket_tank_update(M1454 *moby) { ROCKET_TANK_PATROLLING = 1, ROCKET_TANK_FIRING = 2 }; + enum { + ROCKET_TANK_AIM_YAW_OSCILLATION_INITIAL_PHASE = 0 + }; D1454 *tank_data = moby->data; update_rocket_tank_damage_and_aim(moby); switch (moby->state) { @@ -151,7 +154,7 @@ void rocket_tank_update(M1454 *moby) { case ROCKET_TANK_PATROLLING: func_L18_002F9AB8_v(moby); if (*(int *)((char *)tank_data + 0xB4) != 2) { - tank_data->aim_yaw_oscillation_phase = 0; + tank_data->aim_yaw_oscillation_phase = ROCKET_TANK_AIM_YAW_OSCILLATION_INITIAL_PHASE; tank_data->aim_vector_length_limit = 10.0f; if (moby->current_animation_index != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(20)); From 40f5ad790801a34c5d944bbafff36c78269bd229 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:39:51 +0000 Subject: [PATCH 433/758] decomp: clarify names in elevator_update domain_0_value_0 -> ELEVATOR_IDLE_GLOW_INITIAL_PHASE: Bound elevator.c SHA-256 ff1980d091afe2bbde909200e8c272958913cb44e686e3520e5ca6106f1dc75c initializes elevator_vars->idle_glow_phase to 0 in ELEVATOR_STATE_INITIALIZE. Original retail decompilation writes pvars+0x138=0, confirmed by sw zero,0x138(s1) at 0x002eeac8 (s1 loaded from moby+0x78 at 0x002ee904). Calls at 0x002eeacc, 0x002eee28 and 0x002eeec4 reach update_elevator_idle_glow. Checked helper 0x002ef788-0x002ef79c reads that same storage as float, advances it by frame_time*6.2831855f through fast_add_rotations, stores it and feeds fast_sin; 0x002ef7a0-0x002ef81c scales/clamps intensity, packs RGB and updates glow_color. Thus this assignment establishes the initial angular phase for idle glow, separate from state/control domains; none of the existing zero-valued constants describes this domain. --- src/overlays/l14/mobys/elevator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l14/mobys/elevator.c b/src/overlays/l14/mobys/elevator.c index 9454b579b6..fd78873605 100644 --- a/src/overlays/l14/mobys/elevator.c +++ b/src/overlays/l14/mobys/elevator.c @@ -87,6 +87,9 @@ void elevator_update(struct Moby *elevator_moby) { ELEVATOR_STATE_SETTLE_AT_ENDPOINT = 3, ELEVATOR_STATE_WAIT_FOR_RIDER_EXIT = 4 }; + enum { + ELEVATOR_IDLE_GLOW_INITIAL_PHASE = 0 + }; L14VendorVars *elevator_vars = (L14VendorVars *)elevator_moby->pvars; Vec4 previous_elevator_position; Vec4 rot; @@ -123,7 +126,7 @@ void elevator_update(struct Moby *elevator_moby) { elevator_vars->motor = -1; elevator_vars->motor_volume = -1; elevator_vars->hum_volume = -1; - elevator_vars->idle_glow_phase = 0; + elevator_vars->idle_glow_phase = ELEVATOR_IDLE_GLOW_INITIAL_PHASE; break; } case ELEVATOR_STATE_WAIT_FOR_RIDER: From 76d73092a92e909ddd0a1ea547109aec4f4892e7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 10:58:10 +0000 Subject: [PATCH 434/758] decomp: clarify names in attach_manipulator unk64 -> manipulator_head: The authoritative src/mobys/attach_manipulator.c snapshot (SHA-256 7d4a3b479e43c19277c17dbb0ea75f95358deec8883f058d8e7ec180265c9d02) declares MobyAttachOwner.unk64 as Manipulator*. Retail 0x0020cb74 loads the source moby's +0x64 pointer, 0x0020cb78 saves it at the incoming manipulator's +8, and 0x0020cb7c stores that incoming manipulator into source_moby+0x64. Original Ghidra likewise copies *(param_1+100) to param_3+8 before replacing *(param_1+100) with param_3. Together with attach_manipulator and the callers passing class_pose_manipulator, this proves that the field is the manipulator list head, updated by prepending. --- src/mobys/attach_manipulator.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mobys/attach_manipulator.c b/src/mobys/attach_manipulator.c index faaf45c459..5e75fe783e 100644 --- a/src/mobys/attach_manipulator.c +++ b/src/mobys/attach_manipulator.c @@ -6,7 +6,7 @@ typedef struct MobyAttachOwner { u8 pad0[0x24]; void *unk24; u8 pad28[0x3C]; - Manipulator *unk64; + Manipulator *manipulator_head; } MobyAttachOwner; struct Manipulator { @@ -43,8 +43,8 @@ void attach_manipulator(MobyAttachOwner *source_moby, s32 slot_index, Manipulato u8 record_byte_offset = *slot_record; manip->unk4 = (void *)((slot_record[record_byte_offset + 4] << 6) + 0x70000000); } - manip->unk8 = source_moby->unk64; - source_moby->unk64 = manip; + manip->unk8 = source_moby->manipulator_head; + source_moby->manipulator_head = manip; } } From b501d0eed551ae4999b3be48ffc7f18a8aab7a2f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:00:38 +0000 Subject: [PATCH 435/758] decomp: clarify names in emit_beam_trail_particles f0C -> has_previous_position: In emit_beam_trail_particles, trail_state=x->f78 binds to s7 loaded at 0x002b3c8c. Retail loads its +0x0c word at 0x002b3dbc (also branch-delay paths 0x002b3d40/0x002b3d80) and 0x002b3ff4; zero branches at 0x002b3dcc and 0x002b3ff8 skip interpolation using the saved endpoint at s7+0x10. When nonzero, distance/subtraction from that endpoint produces intermediate spawn positions. At 0x002b40ec..0x002b40f0, lq/sq saves emission_position to s7+0x10; li v1,1 at 0x002b40f4 and sw v1,0xc(s7) at 0x002b40fc then mark it available. The authoritative C's two if(trail_state->f0C) blocks, qcopy(&trail_state->v10,&emission_position), and final assignment agree with original Ghidra puVar1[3]/puVar7 data flow, proving has_previous_position rather than an offset-only name. --- src/overlays/shared/weapons/thruster_pack_flame.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/weapons/thruster_pack_flame.c b/src/overlays/shared/weapons/thruster_pack_flame.c index d76131e001..8d35f2ecc7 100644 --- a/src/overlays/shared/weapons/thruster_pack_flame.c +++ b/src/overlays/shared/weapons/thruster_pack_flame.c @@ -324,7 +324,7 @@ typedef struct { typedef struct N { s32 f00; u8 p04[8]; - s32 f0C; + s32 has_previous_position; V4 v10; } N; @@ -768,7 +768,7 @@ void emit_beam_trail_particles(X *x) { 1, 10000.0f); } - if (trail_state->f0C) { + if (trail_state->has_previous_position) { trail_sample_spacing = fast_vec_dist(&trail_state->v10, &emission_position) * 0.5f; fast_vec_sub(&previous_position_delta, &trail_state->v10, &emission_position); for (i = 1; i < 2; i++) { @@ -821,7 +821,7 @@ void emit_beam_trail_particles(X *x) { col); if (spawned_effect) spawned_effect[3] = 0x44; - if (trail_state->f0C) { + if (trail_state->has_previous_position) { trail_sample_spacing = fast_vec_dist(&trail_state->v10, &emission_position) * 0.16667f; fast_vec_sub(&previous_position_delta, &trail_state->v10, &emission_position); hero_state = hero.state.current; @@ -847,7 +847,7 @@ void emit_beam_trail_particles(X *x) { } } qcopy(&trail_state->v10, &emission_position); - trail_state->f0C = 1; + trail_state->has_previous_position = 1; } /* Creates a class 0xA7 moby carrying a in its data; sets bytes 0x30/0x31, 0x32 and state 0. */ From c79de294c0af8df1ab59a66851dc9a952ce3b632 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:00:41 +0000 Subject: [PATCH 436/758] decomp: clarify names in bolt_update unk31 -> is_visible: Retail 002a5df0 preserves the updated bolt pointer in s5. At 002a5e2c and 002a5e40, byte stores to +0x31 set 0 for global mode 2 and 1 otherwise, paired with flags bit 0 set/clear at 002a5e34/002a5e44. Idle reads at 002a65d8 and 002a6610 use this byte to gate distant-bolt removal and grounded pose/glint work (002a65f8-002a662c). The supplied spawn_bolt_by_value uses the shared Moby visible member for spawned bolts, and include/rnc/mobys/moby.h places u8 visible immediately after update_dist at this same +0x31, documented as drawn last frame. These matching typed object uses and behavioral gates corroborate a bolt visibility byte; is_visible names that member without asserting the unknown global mode's meaning. unk32 -> draw_distance: In bolt initialization retail 002a5e88 loads a2=0x20 and 002a5ea4 stores that halfword at +0x32(s5), alongside the update-distance byte 0x20 written at +0x30 by 002a5e9c. Prepared Ghidra independently shows *(undefined2 *)(param_1+0x32)=0x20. The supplied spawn_bolt_by_value C initializes spawned_bolt->update_dist and spawned_bolt->draw_dist together to 0x40, followed by visible=1. include/rnc/mobys/moby.h corroborates the same member sequence update_dist, u8 visible, s16 draw_dist, u16 flags at +0x30,+0x31,+0x32,+0x34. The paired bolt distance initialization and shared object role establish draw distance, rather than an offset-only guess; the assigned private u16 type is preserved. --- src/overlays/shared/pickups/bolt.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/pickups/bolt.c b/src/overlays/shared/pickups/bolt.c index cdb8b63d83..719d7beca8 100644 --- a/src/overlays/shared/pickups/bolt.c +++ b/src/overlays/shared/pickups/bolt.c @@ -65,8 +65,8 @@ typedef struct Bolt { u8 pad28[4]; f32 scale; /* 0x2C */ u8 unk30; /* 0x30 */ - u8 unk31; /* 0x31 */ - u16 unk32; /* 0x32 */ + u8 is_visible; /* 0x31 */ + u16 draw_distance; /* 0x32 */ u16 flags; /* 0x34 */ u8 pad36[0x3D]; u8 unk73; /* 0x73 */ @@ -204,10 +204,10 @@ void bolt_update(Bolt *bolt_moby) { u8 i; if (D_L00_0015F5C4 == 2) { - bolt_moby->unk31 = 0; + bolt_moby->is_visible = 0; bolt_moby->flags |= 1; } else { - bolt_moby->unk31 = 1; + bolt_moby->is_visible = 1; bolt_moby->flags &= 0xFFFE; } switch (bolt_moby->state) { @@ -216,7 +216,7 @@ void bolt_update(Bolt *bolt_moby) { bolt_moby->unk73 = 0x14; bolt_moby->flags |= 0x100; bolt_moby->unk30 = 0x20; - bolt_moby->unk32 = 0x20; + bolt_moby->draw_distance = 0x20; if (random_integer_below(2) == 0) { v->unk55 |= 1; } @@ -354,11 +354,11 @@ void bolt_update(Bolt *bolt_moby) { return; } if ((u8 *)bolt_moby > D_L00_0015FFDC && D_L00_0015FFBC < 200 && 48.0f < hero_distance && - bolt_moby->unk31 == 0) { + bolt_moby->is_visible == 0) { mark_moby_for_removal(bolt_moby); return; } - if (bolt_moby->unk31 != 0 || v->ground_moby != 0) { + if (bolt_moby->is_visible != 0 || v->ground_moby != 0) { FUN_L00_002a6de8_c(bolt_moby, 0, 0); if (v->hop_left != 0) { u = convert_integer_to_float(v->hop_left) / convert_integer_to_float(v->hop_frames); From 09df7f08bf96bba7433def55651044c41b32f36c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:00:44 +0000 Subject: [PATCH 437/758] decomp: clarify names in blend_big_axebot_and_axe_animation unk424 -> axe_moby: Retail 0x002ba40c loads the big axebot pvars from moby+0x78, 0x002ba410 loads its +0x424 pointer into a0, 0x002ba414 tests null, and 0x002ba420 blends the pointed-to moby with unchanged sequence/frame/blend arguments. Original Ghidra shows the same dereference and conditional call. In the authoritative C, BigAxebotVars.unk424 feeds linked_axe_moby; big_axebot_update's corresponding data->f424 is assigned spawn_big_axebot_axe(moby,p), whose implementation creates class 0x23A, and is positioned from axe bone 0xD and animated. set_big_axebot_and_axe_animation_speed also writes this pointed-to moby's animation speed at +0x58. These uses prove the field is the optional axe moby, beyond its offset. --- src/overlays/l04/mobys/big_axebot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l04/mobys/big_axebot.c b/src/overlays/l04/mobys/big_axebot.c index 7ca55fd3e5..4add152128 100644 --- a/src/overlays/l04/mobys/big_axebot.c +++ b/src/overlays/l04/mobys/big_axebot.c @@ -27,7 +27,7 @@ void blend_big_axebot_and_axe_animation(char *moby, typedef struct BigAxebotVars { u8 pad_0[0x424]; - char *unk424; + char *axe_moby; } BigAxebotVars; void blend_big_axebot_and_axe_animation(char *moby, @@ -38,7 +38,7 @@ void blend_big_axebot_and_axe_animation(char *moby, BigAxebotVars *axebot_pvars = (BigAxebotVars *)MOBY(moby)->pvars; void *linked_axe_moby; blend_moby_animation(moby, new_seq, frame_index, blend_frames); - linked_axe_moby = (void *)axebot_pvars->unk424; + linked_axe_moby = (void *)axebot_pvars->axe_moby; if (linked_axe_moby != 0) { blend_moby_animation(linked_axe_moby, new_seq, frame_index, blend_frames); } @@ -52,8 +52,8 @@ void set_big_axebot_and_axe_animation_speed(struct Moby *moby, void set_big_axebot_and_axe_animation_speed(struct Moby *moby, float animation_speed) { BigAxebotVars *big_axebot_pvars = (BigAxebotVars *)moby->pvars; moby->anim_speed = animation_speed; - if (big_axebot_pvars->unk424 != 0) { - *(float *)(big_axebot_pvars->unk424 + 0x58) = animation_speed; + if (big_axebot_pvars->axe_moby != 0) { + *(float *)(big_axebot_pvars->axe_moby + 0x58) = animation_speed; } } /* Spawns an effect on the moby at its marker vector. */ From 61d66e4d22b8cac3ea9d01cefd74ad2ce4045929 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:00:46 +0000 Subject: [PATCH 438/758] decomp: clarify names in remove_flying_debris unk12 -> point_light_slot_index: Retail 0x002bb4f4 loads the moby private block; 0x002bb4f8 loads its signed +0x12 field into a0, 0x002bb4fc skips -1, 0x002bb504 passes the index to release_point_light_slot (overlay 0x002463c8), and 0x002bb50c resets it to -1. In the bound C snapshot, flying_debris_update stores allocate_colored_effect_slot's return in this field and uses it as D_L14_001809C0 + index * 32 to update position, range and RGB. Spawn initializes the same +0x12 field to -1. These uses prove an optional point-light slot index, beyond its offset. --- src/overlays/l14/mobys/flying_debris.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l14/mobys/flying_debris.c b/src/overlays/l14/mobys/flying_debris.c index 7714ce3c8a..7c301c89f0 100644 --- a/src/overlays/l14/mobys/flying_debris.c +++ b/src/overlays/l14/mobys/flying_debris.c @@ -75,7 +75,7 @@ typedef struct FlyingDebrisVars { u8 pad_C[0x4]; u8 timer_10; u8 pad_11[0x1]; - s16 unk12; + s16 point_light_slot_index; f32 unk14; f32 unk18; f32 unk1C; @@ -206,10 +206,10 @@ void flying_debris_update(struct Moby *moby) { else qcopy(push, (char *)moby + 0xE0); fast_vec_add(at, at, push); - if (debris_vars->unk12 == -1) { - debris_vars->unk12 = allocate_colored_effect_slot(at, range, 0.0f, bright, green, blue); + if (debris_vars->point_light_slot_index == -1) { + debris_vars->point_light_slot_index = allocate_colored_effect_slot(at, range, 0.0f, bright, green, blue); } else { - light_record = (float *)(D_L14_001809C0 + debris_vars->unk12 * 32); + light_record = (float *)(D_L14_001809C0 + debris_vars->point_light_slot_index * 32); qcopy(light_record + 4, at); light_record[7] = range; light_record[0] = bright; @@ -265,11 +265,11 @@ unsigned char *spawn_flying_debris(struct Moby *debris_source_moby, float angle, void remove_flying_debris(u8 *debris_moby) { FlyingDebrisVars *debris_vars = *(u8 **)(debris_moby + 0x78); - s16 light_index = debris_vars->unk12; + s16 light_index = debris_vars->point_light_slot_index; if (light_index != -1) { release_point_light_slot(light_index); - debris_vars->unk12 = -1; + debris_vars->point_light_slot_index = -1; } mark_moby_for_removal(debris_moby); } From 156b1139ea8be5779ed197c09ecfe3e8600cb5ba Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:02:49 +0000 Subject: [PATCH 439/758] decomp: clarify names in update_crate_stack_motion v60 -> pose_delta: Authoritative crate.c SHA-256 10450b092331bc1579dabd2a79cb222db263a991440a46719e9d24b13bb9be73 declares O2d1428.v60 as u8[0x40]. Retail 0x002d173c-0x002d1754 saves current moby position and rotation before transform_attachment_pose. At 0x002d17a4-0x002d17c8 new minus previous position is copied to vars->vel. At 0x002d17cc-0x002d17d8 a0=vars+0x60, a1=vars+0x40, a2=previous rotation and a3=current rotation are passed to checked assembler label FUN_L00_00260738 (update_entity_matrix). Original Ghidra likewise calls func_0x00260738(iVar2+0x60,iVar2+0x40,&uStack_e0,puVar10). Supplied update_entity_matrix source computes relative rotation from transposed previous rotation and current rotation, writes Euler rotation to pose_delta_output, then copies position_delta to output+0x10. Thus this member stores the pose delta output, rather than an offset-only opaque buffer. --- src/overlays/shared/pickups/crate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/pickups/crate.c b/src/overlays/shared/pickups/crate.c index 4c28ead997..5b7db716c6 100644 --- a/src/overlays/shared/pickups/crate.c +++ b/src/overlays/shared/pickups/crate.c @@ -175,7 +175,7 @@ typedef struct O2d1428 { u8 p0[0x40]; V2d1428 vel; u8 p50[0x10]; - u8 v60[0x40]; + u8 pose_delta[0x40]; struct M2d1428 *next; struct M2d1428 *parent; u8 pa8[4]; @@ -1323,7 +1323,7 @@ void update_crate_stack_motion(M2d1428 *moby) { fast_vec_sub(&position_delta, &moby->pos, &previous_position); position_delta.w = vars->vel.w; qcopy(&vars->vel, &position_delta); - update_entity_matrix(vars->v60, &vars->vel, &previous_rotation, &moby->v40); + update_entity_matrix(vars->pose_delta, &vars->vel, &previous_rotation, &moby->v40); continue; } if (vars->parent == 0) { From 6bfc7d2e9b9df4c66895001e2fd0dbcca3aa8b6b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:02:52 +0000 Subject: [PATCH 440/758] decomp: clarify names in level_13_homing_rocket_update f90 -> lead_yaw_offset: Veh_2C27B0 is obtained from hero_state->veh->data. Retail 0x002c1944 loads that data into s0; 0x002c1948 and 0x002c1950 load vehicle rot.z (+0x48) and float data+0x90 into f12/f13 for the bound fast_add_rotations call at 0x002c194c. The sum is saved as f21 at 0x002c1958 and passed as yaw f13 at 0x002c198c to build_spherical_offset_c (assembler FUN_00214DB0, checked retail placement 0x0026e8d8) at 0x002c19a0. The offset is added to vehicle position at 0x002c19b4, proving f90 is the yaw offset used to construct the lead position. f94 -> lead_pitch_offset: In the same vehicle lead branch, retail 0x002c195c loads float vehicle-data+0x94 into f13 and 0x002c1964 loads vehicle rot.y (+0x44) into f12 for bound fast_add_rotations at 0x002c1960. The sum is saved in f20 at 0x002c196c, negated into f14 at 0x002c1984, and supplied as the pitch argument to build_spherical_offset_c at 0x002c19a0. Authoritative C spells this fast_add_rotations(hero_state->veh->rot.y, vd->f94), then -vehicle_lead_pitch. The parallel rocket movement call at 0x002c1bc0 likewise uses negative rot.y as spherical pitch, proving f94 is the pitch offset used for the vehicle lead position. --- src/overlays/l13/mobys/homing_rocket.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l13/mobys/homing_rocket.c b/src/overlays/l13/mobys/homing_rocket.c index 6dcd83e3de..1729b0741b 100644 --- a/src/overlays/l13/mobys/homing_rocket.c +++ b/src/overlays/l13/mobys/homing_rocket.c @@ -102,8 +102,8 @@ typedef struct Veh_2C27B0 { char pad0[0x64]; float f64; char pad68[0x28]; - float f90; - float f94; + float lead_yaw_offset; + float lead_pitch_offset; } Veh_2C27B0; typedef struct Tex { @@ -286,8 +286,8 @@ void level_13_homing_rocket_update(ProjectileMoby *rocket_moby) { if (hero_state->veh != 0 && hero_state->veh->cls_id == 0x45 && rocket_data->owner->state != 5) { Veh_2C27B0 *vd = hero_state->veh->data; - float vehicle_lead_yaw = fast_add_rotations(hero_state->veh->rot.z, vd->f90); - float vehicle_lead_pitch = fast_add_rotations(hero_state->veh->rot.y, vd->f94); + float vehicle_lead_yaw = fast_add_rotations(hero_state->veh->rot.z, vd->lead_yaw_offset); + float vehicle_lead_pitch = fast_add_rotations(hero_state->veh->rot.y, vd->lead_pitch_offset); build_spherical_offset_c(&scratch_vector, fast_vec_dist(&rocket_moby->pos, &hero_state->veh->pos) / (rocket_data->speed + 24.0f) * vd->f64, From 19d205b2ea82d6e69ba4277a832073fb947a37ed Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:02:55 +0000 Subject: [PATCH 441/758] decomp: clarify names in extermibot_update unk298 -> path_heading_offset_degrees: Retail 00302288-003022bc optionally negates pvars+298 and multiplies it by 0.017453292 into +294, converting signed degrees to radians. Assigned C passes +294 as side to the path walker at 00302940-00302950; supplied move_extermibot_along_path adds side to the goal heading when offset clearance applies. Thus this float holds the signed path heading offset in degrees. unk2B0 -> target_pursuit_timer: Assigned retail 003020c4 clears this s32; 00302320-00302338 enables direct target approach when nonzero, 00302728-0030272c and 00302790-003027a4 return toward start when zero. Checked direct helper 00303390 (request 872d865aca034ec48866a77677b4c701) stores a scaled random 180..240 frame count at 0030379c-003037c4 and decrements +2B0 at 003037cc-003037d0. Nonzero also expands targeting range by 20 at 003037d4-003037f0. This is a pursuit countdown, not a boolean. unk2B4 -> hide_below_start_on_init: In EXTERMIBOT_INITIALIZE, retail 0030215c-00302198 tests this s32 for nonzero, selects HIDDEN_BELOW_START, subtracts 20 from moby Z, clears draw distance, visibility and collision and clears flag 1000. Assigned C saves initial position just before this branch. The field selects hidden placement below that start during initialization; later activation behavior is not asserted. unk2B8 -> activation_moby_index: Retail state 15 at 0030282c-00302848 loads this s32, skips -1, shifts the index by 8, adds the moby-array base and reads that moby's command byte +BC. Nonzero command activates this extermibot at 00302870-00302888. Assigned C uses D_L05_0015FFD8 and index*256+BC; initialization retains the original 64-bit comparison spanning this and the next field. unk2BC -> activation_clip_volume_index: Retail 00302850 loads this s32 into a1, skips sentinel -1, and 0030285c-00302860 calls the clip-volume point test with point 0013F3D0 in a0. A nonzero return enters the shared activation path 00302870-00302888. Assigned C binds this operation to is_point_inside_clip_volume(point, volume_index), proving the configured activation volume index. unk2D2 -> wander_elapsed_frames: Retail 003023b0 initializes this s16 to zero on ordinary wander entry; activation-wait wander instead seeds it with scale_game_frames(90) at 003028dc-003028e4. WANDER_NEAR_START increments it once per update at 00302504-00302518 and compares against scaled 60/180-frame thresholds at 00302534-00302558 before restoring the saved state. It is an elapsed-frame wander counter, with an intentional seeded head start. unk2D8 -> glow_phase_angle: Assigned retail 00302130-00302138 initializes this f32 from random_angle_radians. Checked direct helper request 872d865aca034ec48866a77677b4c701 shows 00303910-00303930 advancing +2D8 with fast_add_rotations(frame_time*9.424778) and taking sine. 00303934-0030395c maps sine to [0,1], interpolates the two glow colors and writes moby glow_color. Supplied same-file C corroborates angle phase controlling glow. unk2DC -> temporary_flags_applied: Retail 00301f98-00301fcc sets this s32 latch to 1 when the external selector equals 2 and moby flag bit 1 is clear, then ORs moby flags with 0x41. At 00301fd0-00301ff0, a nonzero latch and zero selector cause the latch to clear and those same flag bits to be removed with 0xFFBE. Assigned C corroborates that this field remembers temporary flag application; no broader selector or flag-bit gameplay identity is assumed. --- src/overlays/l05/mobys/extermibot.c | 60 ++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/overlays/l05/mobys/extermibot.c b/src/overlays/l05/mobys/extermibot.c index 8b18d4e85a..ed56d15076 100644 --- a/src/overlays/l05/mobys/extermibot.c +++ b/src/overlays/l05/mobys/extermibot.c @@ -130,21 +130,21 @@ typedef struct ExtermibotVars { f32 goal[4]; f32 yaw_vel; f32 unk294; - f32 unk298; + f32 path_heading_offset_degrees; u8 pad_29C[0x10]; s32 unk2AC; - s32 unk2B0; - s32 unk2B4; - s32 unk2B8; - s32 unk2BC; + s32 target_pursuit_timer; + s32 hide_below_start_on_init; + s32 activation_moby_index; + s32 activation_clip_volume_index; s32 path; s32 path_pos; u8 pad_2C8[0x8]; s16 unk2D0; - s16 unk2D2; + s16 wander_elapsed_frames; u8 pad_2D4[0x4]; - f32 unk2D8; - s32 unk2DC; + f32 glow_phase_angle; + s32 temporary_flags_applied; } ExtermibotVars; /* Moby class 623 */ @@ -164,10 +164,10 @@ void extermibot_update(unsigned char *moby) { manipulator_set_scale(&moby_data->manipulator, 2.5f); if (D_L05_0015F5C4 == 2 && ((MOBY(moby)->flags ^ 1) & 1)) { - moby_data->unk2DC = 1; + moby_data->temporary_flags_applied = 1; MOBY(moby)->flags |= 0x41; - } else if (moby_data->unk2DC != 0 && D_L05_0015F5C4 == 0) { - moby_data->unk2DC = 0; + } else if (moby_data->temporary_flags_applied != 0 && D_L05_0015F5C4 == 0) { + moby_data->temporary_flags_applied = 0; MOBY(moby)->flags &= 0xFFBE; } if (MOBY(moby)->visible != 0 && @@ -184,7 +184,7 @@ void extermibot_update(unsigned char *moby) { qcopy(&moby_data->unk270, moby + 0x10); moby_data->health = 2.0f; moby_data->unk29 = 0; - moby_data->unk2B0 = 0; + moby_data->target_pursuit_timer = 0; moby_data->unk28 = 1; moby_data->unk30 = 1.0f; moby_data->max_health = 2; @@ -202,20 +202,20 @@ void extermibot_update(unsigned char *moby) { moby_data->speed = initial_movement_speed; } } - moby_data->unk2D8 = random_angle_radians(); + moby_data->glow_phase_angle = random_angle_radians(); if (random_integer_below(2) != 0) { MOBY(moby)->flags |= 0x8000; } else { MOBY(moby)->flags &= 0x7FFF; } - if (moby_data->unk2B4 != 0) { + if (moby_data->hide_below_start_on_init != 0) { MOBY(moby)->state = EXTERMIBOT_HIDDEN_BELOW_START; MOBY(moby)->visible = 0; MOBY(moby)->collision = 0; MOBY(moby)->flags &= 0xEFFF; MOBY(moby)->pos.z -= 20.0f; MOBY(moby)->draw_dist = 0; - } else if (*(long *)&moby_data->unk2B8 != -1) { + } else if (*(long *)&moby_data->activation_moby_index != -1) { MOBY(moby)->flags &= 0xEFFF; MOBY(moby)->state = EXTERMIBOT_WAIT_FOR_ACTIVATION_TRIGGER; if (MOBY(moby)->prev_seq != 0) @@ -237,9 +237,9 @@ void extermibot_update(unsigned char *moby) { path_goal_or_facing_vector, (D_L05_00161A98) * 0.4f) != 0) { if (random_integer_below(0x100) & 1) { - moby_data->unk298 = -moby_data->unk298; + moby_data->path_heading_offset_degrees = -moby_data->path_heading_offset_degrees; } - moby_data->unk294 = moby_data->unk298 * 0.017453292f; + moby_data->unk294 = moby_data->path_heading_offset_degrees * 0.017453292f; moby_data->unk2AC = scale_game_frames((int)random_float_between(30.0f, 90.0f)); MOBY(moby)->state = EXTERMIBOT_FOLLOW_TARGET; if (MOBY(moby)->prev_seq != 1) @@ -248,7 +248,7 @@ void extermibot_update(unsigned char *moby) { moby_data->mode = EXTERMIBOT_TARGET_PATH_UNAVAILABLE; } } - if (moby_data->mode == EXTERMIBOT_TARGET_PATH_UNAVAILABLE && moby_data->unk2B0 != 0) { + if (moby_data->mode == EXTERMIBOT_TARGET_PATH_UNAVAILABLE && moby_data->target_pursuit_timer != 0) { MOBY(moby)->state = EXTERMIBOT_APPROACH_TARGET_DIRECTLY; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); @@ -257,7 +257,7 @@ void extermibot_update(unsigned char *moby) { FUN_L00_00257d78(moby_data->goal, 0.0f, 4.0f); moby_data->goal[2] = 0.0f; fast_vec_add(moby_data->goal, moby_data->goal, &moby_data->unk270); - moby_data->unk2D2 = 0; + moby_data->wander_elapsed_frames = 0; MOBY(moby)->command = MOBY(moby)->state; MOBY(moby)->state = EXTERMIBOT_WANDER_NEAR_START; if (MOBY(moby)->prev_seq != 1) @@ -294,10 +294,10 @@ void extermibot_update(unsigned char *moby) { resolve_point_path_segment_xy_clearance( moby_data->path, moby_position, moby_position, (D_L05_00161A98) * 0.4f); } - (moby_data->unk2D2)++; + (moby_data->wander_elapsed_frames)++; if ((vector_distance_xy(moby_position, moby_data->goal) < 1.0f && - moby_data->unk2D2 > scale_game_frames(0x3C)) || - moby_data->unk2D2 > scale_game_frames(0xB4)) { + moby_data->wander_elapsed_frames > scale_game_frames(0x3C)) || + moby_data->wander_elapsed_frames > scale_game_frames(0xB4)) { MOBY(moby)->state = MOBY(moby)->command; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(20)); @@ -341,7 +341,7 @@ void extermibot_update(unsigned char *moby) { MOBY(moby)->state = EXTERMIBOT_WAIT_FOR_TARGET_IN_STRIKE_RANGE; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(20)); - } else if (moby_data->unk2B0 != 0) { + } else if (moby_data->target_pursuit_timer != 0) { if (vector_distance_xy(moby_position, target_moby + 0x10) < 3.0f) { MOBY(moby)->state = EXTERMIBOT_AIM_BEFORE_STRIKE; moby_data->unk2D0 = scale_game_frames(extermibot_pre_strike_delay_frames_gp); @@ -354,7 +354,7 @@ void extermibot_update(unsigned char *moby) { break; } case EXTERMIBOT_WAIT_FOR_TARGET_IN_STRIKE_RANGE: - if (moby_data->unk2B0 == 0) { + if (moby_data->target_pursuit_timer == 0) { moby_data->speed = 0.0f; MOBY(moby)->state = EXTERMIBOT_RETURN_TO_START; if (MOBY(moby)->prev_seq != 1) @@ -367,10 +367,10 @@ void extermibot_update(unsigned char *moby) { } break; case EXTERMIBOT_WAIT_FOR_ACTIVATION_TRIGGER: - if ((moby_data->unk2B8 != -1 && - ((unsigned char *)*(int *)&D_L05_0015FFD8)[moby_data->unk2B8 * 256 + 0xBC] != 0) || - (moby_data->unk2BC != -1 && - is_point_inside_clip_volume(((char *)D_0013F3D0), moby_data->unk2BC) != 0)) { + if ((moby_data->activation_moby_index != -1 && + ((unsigned char *)*(int *)&D_L05_0015FFD8)[moby_data->activation_moby_index * 256 + 0xBC] != 0) || + (moby_data->activation_clip_volume_index != -1 && + is_point_inside_clip_volume(((char *)D_0013F3D0), moby_data->activation_clip_volume_index) != 0)) { MOBY(moby)->draw_dist = 0x40; MOBY(moby)->flags |= 0x1000; MOBY(moby)->state = EXTERMIBOT_IDLE_AND_CHECK_TARGET_PATH; @@ -379,7 +379,7 @@ void extermibot_update(unsigned char *moby) { FUN_L00_00257d78(moby_data->goal, 0.0f, 4.0f); moby_data->goal[2] = 0.0f; fast_vec_add(moby_data->goal, moby_data->goal, &moby_data->unk270); - moby_data->unk2D2 = scale_game_frames(0x5A); + moby_data->wander_elapsed_frames = scale_game_frames(0x5A); MOBY(moby)->command = MOBY(moby)->state; MOBY(moby)->state = EXTERMIBOT_WANDER_NEAR_START; if (MOBY(moby)->prev_seq != 1) @@ -564,7 +564,7 @@ void extermibot_update(unsigned char *moby) { MOBY(moby)->state = EXTERMIBOT_FOLLOW_TARGET; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(3)); - } else if (moby_data->unk2B0 != 0) { + } else if (moby_data->target_pursuit_timer != 0) { MOBY(moby)->state = EXTERMIBOT_APPROACH_TARGET_DIRECTLY; } break; From f062bff4f8dabcfb0e8daeb5ac9b6317304c8a27 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:02:58 +0000 Subject: [PATCH 442/758] decomp: clarify names in follow_plasmabot_path unk23C -> heading_angular_velocity: Retail 0x002b3520/0x002b352c passes moby+0x48 (rot.z) in a0 and pvars+0x23c in a1 to 0x00264180. Checked helper 0x00264194 retains a1 in s0, loads its float at 0x002641d0, uses its square for braking at 0x002641fc-0x00264210, updates it via 0x00264250/0x002642b0/0x002642c8, and adds it to the current angle at 0x00264314-0x00264320. This agrees with supplied approach_angle angular_velocity flow and C aiming uses of the same field. unk24C -> path_segment_index: Retail 0x002b3474 passes pvars+0x24c in a2 to the path helper 0x00265b88. Checked helper retains this pointer in a1 at 0x00265bac, loads the index at 0x00265d0c, multiplies by 16 to select a path point at 0x00265d24-0x00265d34, advances by traversal direction at 0x00265c18, and stores it at 0x00265cdc. Supplied FUN_L00_0025d808 names this parameter segment_index; C backward traversal decrements this field before loading that segment's length. unk250 -> path_offset_and_spring_velocities: Retail 0x002b3464 passes pvars+0x250 in a3 to 0x00265b88, which retains it in s0 (0x00265bb0), adds/subtracts traversal amount to its first float (0x00265ce0-0x00265cf0), resets it at segment crossings, and uses it to scale the segment delta at 0x00265db4-0x00265dc0. This matches the supplied segment_offset parameter. The same assigned function passes +0x254/+0x258, array elements [1]/[2], as vendor_spring velocity pointers at 0x002b34a8/0x002b34e8 for moby x/y. Authoritative scale_and_apply_plasmabot_planar_velocity scales those elements and adds them to x/y. Element [3] has only reset/initialization uses here; no z-velocity meaning is asserted. unk27C -> path_traversal_direction: Retail 0x002b346c loads pvars+0x27c and 0x002b347c multiplies it into traversal speed times frame_time before the path-helper call. C plasmabot_update sets it to +1.0f when starting/forward traversal and -1.0f when switching to PLASMABOT_FOLLOW_PATH_BACKWARD. Checked helper 0x00265b98-0x00265bc4 derives +1/-1 direction from the signed amount, advances the segment index by that sign at 0x00265c18 and adds/subtracts within-segment offset at 0x00265ce0-0x00265cf0. Thus this field controls signed path cursor traversal, not actual eased movement speed. --- src/overlays/shared/enemies/plasmabot.c | 86 ++++++++++++------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index 8ac217a5d3..aaeac8bedf 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -95,13 +95,13 @@ typedef struct PlasmabotVars { u8 unk220[0x14]; f32 target_range; u8 pad238[0x4]; - s32 unk23C; + s32 heading_angular_velocity; s32 path_index; /* 0x240: into l14_paths, -1: none */ s32 target_path_index; s16 unk248; u8 pad24A[0x2]; - s32 unk24C; - f32 unk250[4]; + s32 path_segment_index; + f32 path_offset_and_spring_velocities[4]; s16 unk260; s16 unk262; s32 unk264; @@ -110,7 +110,7 @@ typedef struct PlasmabotVars { s32 unk270; s32 unk274; f32 unk278; - f32 unk27C; + f32 path_traversal_direction; s32 unk280; s32 unk284; s32 unk288; @@ -176,11 +176,11 @@ void initialize_plasmabot_path_state(char *moby) { PlasmabotVars *moby_vars = (PlasmabotVars *)MOBY(moby)->pvars; char *path; int i; - *(int *)&moby_vars->unk250 = 0; - moby_vars->unk24C = 0; - moby_vars->unk250[3] = moby_vars->unk250[0]; - moby_vars->unk250[2] = moby_vars->unk250[0]; - moby_vars->unk250[1] = moby_vars->unk250[0]; + *(int *)&moby_vars->path_offset_and_spring_velocities = 0; + moby_vars->path_segment_index = 0; + moby_vars->path_offset_and_spring_velocities[3] = moby_vars->path_offset_and_spring_velocities[0]; + moby_vars->path_offset_and_spring_velocities[2] = moby_vars->path_offset_and_spring_velocities[0]; + moby_vars->path_offset_and_spring_velocities[1] = moby_vars->path_offset_and_spring_velocities[0]; if (moby_vars->path_index == -1) return; path = (char *)l14_paths[moby_vars->path_index]; @@ -201,10 +201,10 @@ void scale_and_apply_plasmabot_planar_velocity(char *moby) { float planar_velocity_scale = (plasmabot_planar_velocity_base_scale_gp - 1.0f) * frame_scale + 1.0f; PlasmabotVars *moby_vars = (PlasmabotVars *)MOBY(moby)->pvars; - moby_vars->unk250[1] = moby_vars->unk250[1] * planar_velocity_scale; - moby_vars->unk250[2] = moby_vars->unk250[2] * planar_velocity_scale; - MOBY(moby)->pos.x = MOBY(moby)->pos.x + moby_vars->unk250[1]; - MOBY(moby)->pos.y = MOBY(moby)->pos.y + moby_vars->unk250[2]; + moby_vars->path_offset_and_spring_velocities[1] = moby_vars->path_offset_and_spring_velocities[1] * planar_velocity_scale; + moby_vars->path_offset_and_spring_velocities[2] = moby_vars->path_offset_and_spring_velocities[2] * planar_velocity_scale; + MOBY(moby)->pos.x = MOBY(moby)->pos.x + moby_vars->path_offset_and_spring_velocities[1]; + MOBY(moby)->pos.y = MOBY(moby)->pos.y + moby_vars->path_offset_and_spring_velocities[2]; } /* steers the pitch angle of a moby toward a target and updates the joint */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002B2A28.c: func_L14_002B4A00), where it is exact; names translated to the US level program. */ @@ -458,9 +458,9 @@ void plasmabot_update(char *moby) { plasmabot_update_private_vars->unk24 = 2; plasmabot_update_private_vars->unk58 = truncate_float_to_s32(15.0f); plasmabot_update_private_vars->unk5A = truncate_float_to_s32(16.0f); - plasmabot_update_private_vars->unk27C = 1.0f; + plasmabot_update_private_vars->path_traversal_direction = 1.0f; plasmabot_update_private_vars->unk248 = 0; - plasmabot_update_private_vars->unk23C = 0; + plasmabot_update_private_vars->heading_angular_velocity = 0; plasmabot_update_private_vars->unk260 = 0; *(int *)&plasmabot_update_private_vars->unk268 = 0; plasmabot_update_private_vars->unk26C = 0; @@ -505,15 +505,15 @@ void plasmabot_update(char *moby) { path = (float *)l14_paths[plasmabot_update_private_vars->path_index]; MOBY(moby)->rot.z = fast_arc_tan(path[8] - path[4], path[9] - path[5]); *(int *)&plasmabot_update_private_vars->unk268 = 0; - plasmabot_update_private_vars->unk27C = 1.0f; + plasmabot_update_private_vars->path_traversal_direction = 1.0f; plasmabot_update_private_vars->unk26C = 0; plasmabot_update_private_vars->unk270 = 0; plasmabot_update_private_vars->unk274 = 0; - plasmabot_update_private_vars->unk24C = 0; - *(int *)&plasmabot_update_private_vars->unk250 = 0; - plasmabot_update_private_vars->unk250[3] = plasmabot_update_private_vars->unk268; - plasmabot_update_private_vars->unk250[2] = plasmabot_update_private_vars->unk268; - plasmabot_update_private_vars->unk250[1] = plasmabot_update_private_vars->unk268; + plasmabot_update_private_vars->path_segment_index = 0; + *(int *)&plasmabot_update_private_vars->path_offset_and_spring_velocities = 0; + plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = plasmabot_update_private_vars->unk268; + plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = plasmabot_update_private_vars->unk268; + plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = plasmabot_update_private_vars->unk268; return; } case PLASMABOT_START_PATH_TRAVERSAL: @@ -530,13 +530,13 @@ void plasmabot_update(char *moby) { case PLASMABOT_RETURN_TO_PATH_START: { float *path = (float *)l14_paths[plasmabot_update_private_vars->path_index]; vendor_spring((float *)&MOBY(moby)->pos, - (float *)(&plasmabot_update_private_vars->unk250[1]), + (float *)(&plasmabot_update_private_vars->path_offset_and_spring_velocities[1]), path[4], 0.01f, 0.2f, 0.0f); vendor_spring((float *)&MOBY(moby)->pos.y, - (float *)(&plasmabot_update_private_vars->unk250[2]), + (float *)(&plasmabot_update_private_vars->path_offset_and_spring_velocities[2]), path[5], 0.01f, 0.2f, @@ -559,7 +559,7 @@ void plasmabot_update(char *moby) { k = frame_time_sq * 12.566371f; call_CE58((float *)&MOBY(moby)->rot.z, ang, - (float *)(&plasmabot_update_private_vars->unk23C), + (float *)(&plasmabot_update_private_vars->heading_angular_velocity), k, k, frame_time * 6.2831855f); @@ -570,12 +570,12 @@ void plasmabot_update(char *moby) { ((unsigned char *)moby)[0x20] = 3; blend_moby_animation(moby, 3, 0, scale_game_frames(10)); MOBY(moby)->anim_speed = 1.0f; - *(int *)&plasmabot_update_private_vars->unk250 = 0; - plasmabot_update_private_vars->unk27C = 1.0f; - plasmabot_update_private_vars->unk24C = 0; - plasmabot_update_private_vars->unk250[3] = plasmabot_update_private_vars->unk250[0]; - plasmabot_update_private_vars->unk250[2] = plasmabot_update_private_vars->unk250[0]; - plasmabot_update_private_vars->unk250[1] = plasmabot_update_private_vars->unk250[0]; + *(int *)&plasmabot_update_private_vars->path_offset_and_spring_velocities = 0; + plasmabot_update_private_vars->path_traversal_direction = 1.0f; + plasmabot_update_private_vars->path_segment_index = 0; + plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = plasmabot_update_private_vars->path_offset_and_spring_velocities[0]; + plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = plasmabot_update_private_vars->path_offset_and_spring_velocities[0]; + plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = plasmabot_update_private_vars->path_offset_and_spring_velocities[0]; break; } case PLASMABOT_FOLLOW_PATH_FORWARD: @@ -609,7 +609,7 @@ void plasmabot_update(char *moby) { k = frame_time_sq * 12.566371f; call_CE58((float *)&MOBY(moby)->rot.z, ang, - (float *)(&plasmabot_update_private_vars->unk23C), + (float *)(&plasmabot_update_private_vars->heading_angular_velocity), k, k, frame_time * 6.2831855f); @@ -623,15 +623,15 @@ void plasmabot_update(char *moby) { blend_moby_animation(moby, 3, 0, scale_game_frames(0x14)); } { - int index = plasmabot_update_private_vars->unk24C - 1; + int index = plasmabot_update_private_vars->path_segment_index - 1; char *path; - plasmabot_update_private_vars->unk24C = index; + plasmabot_update_private_vars->path_segment_index = index; path = (char *)l14_paths[plasmabot_update_private_vars->path_index]; - plasmabot_update_private_vars->unk250[0] = *(float *)(path + (index << 4) + 0x1C); + plasmabot_update_private_vars->path_offset_and_spring_velocities[0] = *(float *)(path + (index << 4) + 0x1C); } - plasmabot_update_private_vars->unk27C = -1.0f; - plasmabot_update_private_vars->unk250[1] = plasmabot_update_private_vars->unk250[2] = - plasmabot_update_private_vars->unk250[3] = 0.0f; + plasmabot_update_private_vars->path_traversal_direction = -1.0f; + plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = + plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = 0.0f; release_beam_slot_by_id(moby); break; } @@ -1206,23 +1206,23 @@ int follow_plasmabot_path(char *moby) { PlasmabotVars *plasmabot_private_state = (PlasmabotVars *)MOBY(moby)->pvars; int reached = FUN_L00_0025d808(((int *)l14_paths[plasmabot_private_state->path_index]), path_target_position, - &plasmabot_private_state->unk24C, - &plasmabot_private_state->unk250, + &plasmabot_private_state->path_segment_index, + &plasmabot_private_state->path_offset_and_spring_velocities, 0, plasmabot_path_traversal_speed_gp * frame_time * - plasmabot_private_state->unk27C); + plasmabot_private_state->path_traversal_direction); float path_target_heading; float k; float turn_step_limit; qcopy(pre_spring_position, &MOBY(moby)->pos); vendor_spring((float *)&MOBY(moby)->pos, - (float *)(&plasmabot_private_state->unk250[1]), + (float *)(&plasmabot_private_state->path_offset_and_spring_velocities[1]), path_target_position[0], 0.01f, 0.2f, 0.0f); vendor_spring((float *)&MOBY(moby)->pos.y, - (float *)(&plasmabot_private_state->unk250[2]), + (float *)(&plasmabot_private_state->path_offset_and_spring_velocities[2]), path_target_position[1], 0.01f, 0.2f, @@ -1233,7 +1233,7 @@ int follow_plasmabot_path(char *moby) { turn_step_limit = frame_time * 6.2831855f; func_L00_0025CE58_2B4668((float *)&MOBY(moby)->rot.z, path_target_heading, - (float *)(&plasmabot_private_state->unk23C), + (float *)(&plasmabot_private_state->heading_angular_velocity), k, k, turn_step_limit); From 98e3bf8f57d6e87434fc482047cf7907bce07dbf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:03:01 +0000 Subject: [PATCH 443/758] decomp: clarify names in set_blarg_elite_commando_parent_transform unk2CC -> parent_heading_offset: Retail 0x002d3dc0 loads commando pvars from moby+0x78; 0x002d3dd4 loads float a3+8 and the delay-slot swc1 at 0x002d3ddc stores it to pvars+0x2CC, overriding the fourth word of the position copy. The original Ghidra decompilation confirms that overwrite. In the supplied blarg_elite_commando_update COMMANDO_STATE_FOLLOW_PARENT_TRANSFORM, fast_add_rotations(parent+0x48, commando_data->unk2CC) becomes MOBY(commando_moby)->rot.z, proving a parent-relative heading offset. The armed_transport_update caller passes a vector with component 2 set to 3.14159f while attaching passenger commandos. --- 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 5e6337434a..34390fbe94 100644 --- a/src/overlays/shared/enemies/blarg_elite_commando.c +++ b/src/overlays/shared/enemies/blarg_elite_commando.c @@ -98,7 +98,7 @@ typedef struct L16DamageData { f32 unk2C0; f32 unk2C4; f32 unk2C8; - f32 unk2CC; + f32 parent_heading_offset; char *unk2D0; f32 unk2D4; u8 unk2D8[0x4]; @@ -293,7 +293,7 @@ void blarg_elite_commando_update(char *commando_moby) { movement, &commando_data->unk2C0, commando_data->unk2D0 + 0xC0); fast_vec_add(&MOBY(commando_moby)->pos, movement, commando_data->unk2D0 + 0x10); MOBY(commando_moby)->rot.z = - fast_add_rotations(*(float *)(commando_data->unk2D0 + 0x48), commando_data->unk2CC); + fast_add_rotations(*(float *)(commando_data->unk2D0 + 0x48), commando_data->parent_heading_offset); } break; case COMMANDO_STATE_RETURN_TO_INITIAL_POSITION: @@ -676,7 +676,7 @@ void set_blarg_elite_commando_parent_transform(char *moby, L16DamageData *commando_data = (L16DamageData *)MOBY(moby)->pvars; commando_data->unk2D0 = parent_moby; qcopy(&commando_data->unk2C0, position); - commando_data->unk2CC = *(float *)(vector + 8); + commando_data->parent_heading_offset = *(float *)(vector + 8); } /* Ported from rac1-decomp (src/overlays/shared/vendor_002A1B58.c: func_L16_002D51A8), where it is exact; names translated to the US level program. */ From 23cbe3235c50fdf9d5a19d0577ee1681f44e4c96 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:03:04 +0000 Subject: [PATCH 444/758] decomp: clarify names in advance_moby_along_path unk64 -> current_path_segment_index: Retail 0x002d71b4 loads moby->pvars and 0x002d71cc supplies pvars+0x64 in a2 to the path traversal call at 0x002d71d8 (level-14 0x00265b88). The helper preserves this pointer in a1 at 0x00265bac, loads the index at 0x00265d0c, advances it by traversal direction at 0x00265c18, bounds/wraps against the path point count at 0x00265c1c..0x00265c48, and writes it back at 0x00265cdc. At 0x00265d24..0x00265d34 it selects the corresponding 16-byte path point for position output. Supplied current C agrees: update_racer_path_and_weapon passes &unk64 as segment_index, sums segment lengths up to unk64, and uses it to select current and lookahead path records. Thus this s32 is the current path segment index, distinct from the spline selector and nearest_segment. --- src/overlays/l14/mobys/racer_path_and_weapon.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l14/mobys/racer_path_and_weapon.c b/src/overlays/l14/mobys/racer_path_and_weapon.c index f379327b8c..795343a577 100644 --- a/src/overlays/l14/mobys/racer_path_and_weapon.c +++ b/src/overlays/l14/mobys/racer_path_and_weapon.c @@ -46,7 +46,7 @@ float racer_path_lead_distance_gp __asm__("D_L14_00161A38") = 9.0f; typedef struct RacerVars { u8 pad_0[0x60]; s32 spline; - s32 unk64; + s32 current_path_segment_index; f32 unk68; s32 timer; f32 unk70[4]; @@ -93,7 +93,7 @@ void initialize_racer_path_tracking(struct Moby *racer_moby) { unsigned short second_point_segment; moby_data->unk70[1] = racer_path_lead_distance_gp; *(int *)&moby_data->unk68 = 0; - moby_data->unk64 = 0; + moby_data->current_path_segment_index = 0; z = moby_data->unk68; tg = (char *)l14_paths[moby_data->unk88] + 0x30; nearest_path_position.t = z; @@ -306,10 +306,10 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { float blend; float target_yaw_offset; - if (moby_data->unk64 >= moby_data->unk8E) { + if (moby_data->current_path_segment_index >= moby_data->unk8E) { float sum = 0.0f; int k; - for (k = moby_data->unk8E; k < moby_data->unk64; k++) { + for (k = moby_data->unk8E; k < moby_data->current_path_segment_index; k++) { sum += *(float *)(path + k * 16 + 0x1C); } sum += moby_data->unk68; @@ -321,18 +321,18 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { racer_path_lead_distance_gp + (-3.0f - racer_path_lead_distance_gp) * sum; } *(int *)&moby_data->unk68 = 0; - moby_data->unk64 = 0; + moby_data->current_path_segment_index = 0; z = moby_data->unk68; FUN_L00_0025df68( - path, &D_0013F3D0_67e8, &near.x, &moby_data->unk64, &moby_data->unk68, 0, 20.0f, 5.0f, z); - FUN_L00_0025d808(path, &near, &moby_data->unk64, &moby_data->unk68, 0, -moby_data->unk70[1]); + path, &D_0013F3D0_67e8, &near.x, &moby_data->current_path_segment_index, &moby_data->unk68, 0, 20.0f, 5.0f, z); + FUN_L00_0025d808(path, &near, &moby_data->current_path_segment_index, &moby_data->unk68, 0, -moby_data->unk70[1]); vendor_spring(&racer_moby->pos.x, moby_data->position_spring_velocity, near.x, 0.01f, 0.2f, z); vendor_spring( &racer_moby->pos.y, &moby_data->position_spring_velocity[1], near.y, 0.01f, 0.2f, z); vendor_spring( &racer_moby->pos.z, &moby_data->position_spring_velocity[2], near.z, 0.01f, 0.2f, z); { - int i = moby_data->unk64; + int i = moby_data->current_path_segment_index; char *current_path_record = path + i * 16; char *lookahead_path_record = path + (i + 5) * 16; racer_moby->rot.z = fast_arc_tan( @@ -534,7 +534,7 @@ void advance_moby_along_path(struct Moby *moby) { int path_index = path_tracking_state->spline; FUN_L00_0025d808((int)l14_splines[path_index].path, &moby->pos, - &path_tracking_state->unk64, + &path_tracking_state->current_path_segment_index, &path_tracking_state->unk68, 0, l14_racer_path_follow_speed * frame_time); From 566e1cd80d950e63b17b46d11e8789f4fa2433d9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:05:09 +0000 Subject: [PATCH 445/758] decomp: clarify names in update_armed_transport_joint_animation unk170 -> path_and_pose_state: In the authoritative armed_transport.c snapshot (SHA-256 8625333c26cdc0996a90158f0af019238006aaf9acb92882a9a64e4a1dbb1ebd), f32 unk170[4] combines path and pose state: [0] is initialized to speed*frame_time and divided by [1], the distance between initial path points, to advance path progress; [0] is also passed as the scalar state output of the distance-easing helper. [2] is passed alongside moby rot.z to advance_accelerated_scalar when aligning a path heading or tracking a target bearing. [3] is advanced toward 1.5707964 or 0 in path/target states. In the assigned retail wrapper, 0x002e3070 loads pvars from moby+0x78, 0x002e3084 loads pvars+0x17c (array element [3]), and 0x002e3094 copies it to pvars+0x144 before update_joint_animation; 0x002e3060 selects joint 2 and 0x002e3088 supplies state pvars+0xe0. This proves an aggregate of path-travel and pose-control state, supporting path_and_pose_state rather than a single-purpose speed or joint name. --- src/overlays/shared/enemies/armed_transport.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/shared/enemies/armed_transport.c b/src/overlays/shared/enemies/armed_transport.c index 913403455a..e56acd3be9 100644 --- a/src/overlays/shared/enemies/armed_transport.c +++ b/src/overlays/shared/enemies/armed_transport.c @@ -56,7 +56,7 @@ typedef struct ArmedTransportVars { s32 unk164; s32 path_point; s32 unk16C; - f32 unk170[4]; + f32 path_and_pose_state[4]; u8 unk180[0x4]; s32 unk184; f32 unk188; @@ -193,14 +193,14 @@ void armed_transport_update(char *transport_moby) { speed = *(float *)&D_L16_00161D80 * frame_time; transport_data->unk16C = 0; transport_data->path_point = 0; - transport_data->unk170[0] = speed; + transport_data->path_and_pose_state[0] = speed; transport_data->unk194 = MOBY(transport_moby)->pos.z; if (transport_data->path_index == -1) { MOBY(transport_moby)->state = ARMED_TRANSPORT_STATE_TRACK_TARGET; break; } path = D_L16_001B0930[transport_data->path_index]; - transport_data->unk170[1] = fast_vec_dist(path + 0x10, path + 0x20); + transport_data->path_and_pose_state[1] = fast_vec_dist(path + 0x10, path + 0x20); qcopy(&MOBY(transport_moby)->pos, path + 0x10); MOBY(transport_moby)->state = ARMED_TRANSPORT_STATE_WAIT_FOR_ACTIVATION; MOBY(transport_moby)->visible = 0; @@ -246,9 +246,9 @@ void armed_transport_update(char *transport_moby) { } path = D_L16_001B0930[transport_data->path_index]; if (loaded && - (float)(*(int *)path - transport_data->path_point) * transport_data->unk170[1] < + (float)(*(int *)path - transport_data->path_point) * transport_data->path_and_pose_state[1] < 16.0f) { - advance_accelerated_scalar((float *)(&transport_data->unk170[3]), + advance_accelerated_scalar((float *)(&transport_data->path_and_pose_state[3]), (float *)(&transport_data->unk180), 1.5707964f, frame_time_sq * 12.566371f, @@ -301,7 +301,7 @@ void armed_transport_update(char *transport_moby) { float heading = *(float *)(D_L16_001B0930[transport_data->unkDC] + 0x1C); advance_accelerated_scalar((float *)&MOBY(transport_moby)->rot.z, - (float *)(&transport_data->unk170[2]), + (float *)(&transport_data->path_and_pose_state[2]), heading, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, @@ -314,7 +314,7 @@ void armed_transport_update(char *transport_moby) { break; } case ARMED_TRANSPORT_STATE_FOLLOW_SECOND_PATH: - advance_accelerated_scalar((float *)(&transport_data->unk170[3]), + advance_accelerated_scalar((float *)(&transport_data->path_and_pose_state[3]), (float *)(&transport_data->unk180), 0.0f, frame_time_sq * 12.566371f, @@ -333,7 +333,7 @@ void armed_transport_update(char *transport_moby) { float *yaw = (float *)&MOBY(transport_moby)->rot.z; float bearing; - advance_accelerated_scalar((float *)(&transport_data->unk170[3]), + advance_accelerated_scalar((float *)(&transport_data->path_and_pose_state[3]), (float *)(&transport_data->unk180), 0.0f, frame_time_sq * 12.566371f, @@ -342,7 +342,7 @@ void armed_transport_update(char *transport_moby) { bearing = fast_arc_tan(transport_data->unk70[0] - MOBY(transport_moby)->pos.x, transport_data->unk70[1] - MOBY(transport_moby)->pos.y); advance_accelerated_scalar(yaw, - (float *)(&transport_data->unk170[2]), + (float *)(&transport_data->path_and_pose_state[2]), bearing, frame_time_sq * 3.1415927f, frame_time_sq * 3.1415927f, @@ -525,7 +525,7 @@ void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) { int advance_armed_transport_along_path(char *transport_moby, char *path) { ArmedTransportVars *transport_data = (ArmedTransportVars *)MOBY(transport_moby)->pvars; float progress = (float)transport_data->path_point + *(float *)&transport_data->unk16C + - transport_data->unk170[0] / transport_data->unk170[1]; + transport_data->path_and_pose_state[0] / transport_data->path_and_pose_state[1]; int index = truncate_float_to_s32(progress); float speed; float distance, rate; @@ -544,7 +544,7 @@ int advance_armed_transport_along_path(char *transport_moby, char *path) { rate, *(float *)&D_L16_00161D80_gp * frame_time, &speed, - (float *)(&transport_data->unk170)); + (float *)(&transport_data->path_and_pose_state)); return 0; } return 1; @@ -576,7 +576,7 @@ void update_armed_transport_joint_animation(char *moby) { float joint_animation_smoothing_factor = ticks * 0.03f; float joint_animation_secondary_control = ticks * 0.3f; ArmedTransportVars *transport_private_data = (ArmedTransportVars *)MOBY(moby)->pvars; - transport_private_data->unk144 = transport_private_data->unk170[3]; + transport_private_data->unk144 = transport_private_data->path_and_pose_state[3]; update_joint_animation(moby, &transport_private_data->unkE0, 2, From aa8bafa85c1c69e02a0a8da401c426d2e1076d58 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:05:13 +0000 Subject: [PATCH 446/758] decomp: clarify names in _flushBuf unk818 -> ipu_command_class: Retail 0x001288c0 ORs the bit count with FDEC opcode 0x40000000 and 0x001288c8 writes IPU_CMD. Instructions 0x001288cc-0x001288e0 index IpuCommandTable by the complete command's high nibble and load its classification, then 0x001288e8 stores it at decoder_state+0x818. The source assigns table_value to unk818, and the supplied original Ghidra decompilation identifies this same destination as dwIpuCommandClass. unk838 -> bit_window: After submitting the FDEC bit-advance command at 0x001288c8, retail 0x001288e4 calls the IPU completion reader _waitIpuIdle64. Instructions 0x001288ec-0x001288f0 retain/sign-extend its low 32 bits and 0x001288fc stores that word at decoder_state+0x838. Source assigns (s32)idle_result to unk838; original Ghidra identifies this as dwBitWindow, the refreshed resident bitstream window, alongside 32 available bits. unk83C -> available_bit_count: Retail 0x001288f4 loads 0x20 and 0x001288f8 stores it at decoder_state+0x83c immediately after reading the FDEC completion result, whose low word is saved as the bit window at +0x838. Source sets unk83C = 0x20. The supplied original Ghidra decompilation explicitly calls this destination dwAvailableBitCount and describes refreshing the resident 32-bit window, proving that this is the available-bit count. --- src/sdk/mpeg/bitstream/_flushBuf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sdk/mpeg/bitstream/_flushBuf.c b/src/sdk/mpeg/bitstream/_flushBuf.c index 06b6814a9b..1b68889276 100644 --- a/src/sdk/mpeg/bitstream/_flushBuf.c +++ b/src/sdk/mpeg/bitstream/_flushBuf.c @@ -24,10 +24,10 @@ typedef struct FlushBufContext { u8 pad_0[0x818]; - s32 unk818; + s32 ipu_command_class; u8 pad_81C[0x1C]; - s32 unk838; - s32 unk83C; + s32 bit_window; + s32 available_bit_count; u8 pad_840[0x18]; s32 unk858; } FlushBufContext; @@ -58,8 +58,8 @@ void _flushBuf(FlushBufContext *decoder_state, s32 bit_count) { *(volatile u32 *)0x10002000 = command; index = command >> 0x1C; table_value = IpuCommandTable[index]; - decoder_state->unk818 = table_value; + decoder_state->ipu_command_class = table_value; idle_result = _waitIpuIdle64(decoder_state, &IpuCommandTable[index]); - decoder_state->unk838 = (s32)idle_result; - decoder_state->unk83C = 0x20; + decoder_state->bit_window = (s32)idle_result; + decoder_state->available_bit_count = 0x20; } From 25554ee1b5647b256c87435f868d74d3a500826e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:07:41 +0000 Subject: [PATCH 447/758] decomp: clarify names in probe_hero_forward_collision v80 -> hero_position_storage: Current C initializes hero_state from &hero and passes hero_state->v80 as the first input to vector_distance_xy, with D_L00_00173E60 as the collision hit point. Retail 0x0020a244/0x0020a250 forms s2=0x0013F350; 0x0020a2dc supplies s2+0x80=0x0013F3D0 as a0, 0x0020a2e4 supplies hit point 0x00173E60 as a1, and 0x0020a2e8 stores the distance through the optional output. Original Ghidra independently shows FUN_001ff488(0x13f3d0,0x173e60). Supplied source update_hero_collision_ease_target identifies the same hero+0x80 address as hero_position and measures its distance to collision_hit_point. Thus this private byte-array member begins with the hero position used as the distance reference; its remaining extent is not semantically classified. --- 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 3655579037..cb64156acc 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -2740,7 +2740,7 @@ typedef struct V0020a240 { typedef struct G0020a240 { u8 pad[0x80]; - u8 v80[0x1b4]; + u8 hero_position_storage[0x1b4]; f32 f234; } G0020a240; @@ -2764,7 +2764,7 @@ s32 probe_hero_forward_collision(f32 *hit_distance_xy_out, transform_hero_polar_offset_to_world(&probe_end, probe_end_radius, 0.0f, probe_z_offset); if (collision_line(&probe_start, &probe_end, 2, 0, 0)) { if (hit_distance_xy_out != 0) - *hit_distance_xy_out = vector_distance_xy(hero_state->v80, D_L00_00173E60); + *hit_distance_xy_out = vector_distance_xy(hero_state->hero_position_storage, D_L00_00173E60); return 1; } return 0; From 8058b194fc2ec4fb73750e2bd01a9a72c5b1f4ac Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:07:44 +0000 Subject: [PATCH 448/758] decomp: clarify names in update_snagglebeast_target_joint_animation unk1FC -> damage_reaction_amount: In the authoritative snagglebeast.c snapshot (SHA-256 3d4d92111fe852d28286af5453f30d18aba7ea79c3bea6410686498cb85f690b), process_snagglebeast_damage assigns this f32 the negative of twice accepted nonfatal damage, capped at magnitude 2, then adds 0.3 each update and clamps it at zero. Retail 0x0031402c loads vars +0x1FC and 0x0031403c copies it into vars +0x264 immediately before update_joint_animation, proving a decaying damage-reaction amount feeding joint animation. unk264 -> joint_damage_reaction_target: Retail 0x00314018 passes vars +0x200 as joint-animation state, 0x00314028 selects joint slot 0xB, and 0x0031402c/0x0031403c copy the decaying damage-reaction amount from vars +0x1FC into this f32 at +0x264. The checked level-07 helper at 0x0028b270 loads state +0x64 as f12, then at 0x0028b274-0x0028b288 passes it with state +0x44/+0x54 to the same update helper used for neighboring target components. This proves the damage-reaction target role without assigning anatomy or axis. --- src/overlays/l07/mobys/snagglebeast.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index 689cf13a70..fd783735af 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -139,9 +139,9 @@ typedef struct SnagglebeastVars { u8 turn_resume_animation; u8 timer_1F7; s32 voice; - f32 unk1FC; + f32 damage_reaction_amount; u8 joint_animation[0x64]; - f32 unk264; + f32 joint_damage_reaction_target; f32 target_yaw_offset; u8 pad_26C[0x14]; s16 point_light; @@ -531,7 +531,7 @@ void process_snagglebeast_damage(char *moby, remaining = -2.0f; if (!(2.0f < damage + damage)) remaining = -(damage + damage); - snagglebeast_instance_vars->unk1FC = remaining; + snagglebeast_instance_vars->damage_reaction_amount = remaining; FUN_L00_00200228(original_health / frame, (void *)((unsigned)&scratch | 4)); if ((float)snagglebeast_instance_vars->max_health - 1.0f < original_health) scratch.threshold = 5.0f; @@ -580,10 +580,10 @@ void process_snagglebeast_damage(char *moby, MOBY(moby)->hit_slot = 0xff; } trooper_anim_finish(moby, &snagglebeast_instance_vars->unk60); - output = snagglebeast_instance_vars->unk1FC + 0.3f; - snagglebeast_instance_vars->unk1FC = output; + output = snagglebeast_instance_vars->damage_reaction_amount + 0.3f; + snagglebeast_instance_vars->damage_reaction_amount = output; if (output > 0.0f) - snagglebeast_instance_vars->unk1FC = 0.0f; + snagglebeast_instance_vars->damage_reaction_amount = 0.0f; } extern float random_float_between(float, float) __asm__("FUN_002132a8"); @@ -838,7 +838,7 @@ void update_snagglebeast_target_joint_animation(char *moby, moby_vars->target_yaw_offset = -1.3962634f; } k = frame_scale_sq; - moby_vars->unk264 = moby_vars->unk1FC; + moby_vars->joint_damage_reaction_target = moby_vars->damage_reaction_amount; update_joint_animation(moby, moby_vars->joint_animation, 0xB, k * 0.030f, k * 0.3f); } From d138f10e88badf5bb2894add3606f5c8f1025ec1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:09:47 +0000 Subject: [PATCH 449/758] decomp: clarify names in launch_attached_rocket unk26 -> attachment_joint_index: Retail 003059B4 loads moby pvars into s1; 003059EC sign-loads the s16 at pvars+0x26 into a1, and 003059F0/003059F4 calls moby_point_position (0x0025b450) with source moby from pvars+0x20 and output moby position at +0x10. Original Ghidra likewise passes *(undefined2 *)((int)puVar1+0x26) as the second argument. Authoritative C create_attached_rocket stores its joint_index parameter at moby_vars+0x26 and passes that same parameter to moby_point_position; attached_rocket_update repeatedly passes this member with the stored source to position the attached rocket. Thus this member stores the attachment joint index, not an offset-only unknown. --- src/overlays/l13/mobys/attached_rocket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l13/mobys/attached_rocket.c b/src/overlays/l13/mobys/attached_rocket.c index 85a31c5df0..ae00f50141 100644 --- a/src/overlays/l13/mobys/attached_rocket.c +++ b/src/overlays/l13/mobys/attached_rocket.c @@ -54,7 +54,7 @@ typedef struct AttachedRocketVars { u8 pad_11[0xF]; struct Moby *unk20; s16 unk24; - s16 unk26; + s16 attachment_joint_index; f32 unk28; s32 unk2C; } AttachedRocketVars; @@ -76,7 +76,7 @@ void launch_attached_rocket(struct Moby *moby, *(OvlQuad *)&moby->rot_row0 = *(OvlQuad *)&MOBY(source_moby)->rot_row0; *(OvlQuad *)&moby->rot_row1 = *(OvlQuad *)&MOBY(source_moby)->rot_row1; *(OvlQuad *)&moby->rot_row2 = *(OvlQuad *)&MOBY(source_moby)->rot_row2; - moby_point_position((void *)moby_vars->unk20, moby_vars->unk26, mp); + moby_point_position((void *)moby_vars->unk20, moby_vars->attachment_joint_index, mp); qcopy(&moby_vars->unk10, mp); qcopy(moby_vars, pos); moby_vars->unk2C = distance_reference_moby; @@ -150,7 +150,7 @@ void attached_rocket_update(struct Moby *moby) { *(OvlQuad *)&moby->rot_row0 = *(OvlQuad *)&source->rot_row0; *(OvlQuad *)&moby->rot_row1 = *(OvlQuad *)&source->rot_row1; *(OvlQuad *)&moby->rot_row2 = *(OvlQuad *)&source->rot_row2; - moby_point_position(attached_rocket_vars->unk20, attached_rocket_vars->unk26, &moby->pos); + moby_point_position(attached_rocket_vars->unk20, attached_rocket_vars->attachment_joint_index, &moby->pos); qcopy(&attached_rocket_vars->unk10, &moby->pos); { struct Moby *source = attached_rocket_vars->unk20; From 5503735c2edb100838419756efbce741abea517e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:09:51 +0000 Subject: [PATCH 450/758] decomp: clarify names in update_blarg_heavy_interceptor_oscillation_and_patrol_heading unk1A0 -> oscillation_state: In the SHA-256-bound C, BlargHeavyInterceptorVars::unk1A0 is f32[4], zeroed during initialization and passed only to the established oscillation helpers. Retail 0x002aea24 loads Moby pvars into s0; 0x002aea2c/34 pass pvars+0x1A0/+0x1A4 to update_moby_vertical_oscillation (call 0x002aea30), while 0x002aea44/50 pass +0x1A8/+0x1AC to update_moby_rotation_oscillation (call 0x002aea4c). These persistent per-instance helper state arguments prove oscillation_state for the aggregate, distinct from heading target/timer/velocity at +0x1B0 onward. --- .../l14/mobys/blarg_heavy_interceptor.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 7b96578c7e..5c6b659fb8 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -238,7 +238,7 @@ typedef struct BlargHeavyInterceptorVars { f32 unk170[4]; f32 unk180[4]; f32 unk190[4]; - f32 unk1A0[4]; + f32 oscillation_state[4]; f32 unk1B0[4]; f32 unk1C0[4]; f32 unk1D0[4]; @@ -336,10 +336,10 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { moby_vars->unk160[0] = 0.0f; moby_vars->flags = 0; moby_vars->unk160[1] = 0.0f; - moby_vars->unk1A0[0] = 0.0f; - moby_vars->unk1A0[1] = 0.0f; - moby_vars->unk1A0[2] = 0.0f; - moby_vars->unk1A0[3] = 0.0f; + moby_vars->oscillation_state[0] = 0.0f; + moby_vars->oscillation_state[1] = 0.0f; + moby_vars->oscillation_state[2] = 0.0f; + moby_vars->oscillation_state[3] = 0.0f; moby_vars->unk1B0[0] = moby->rot.z; *(s16 *)&moby_vars->unk1B0[1] = 0; moby_vars->unk1B0[2] = 0.0f; @@ -1720,12 +1720,12 @@ void update_blarg_heavy_interceptor_oscillation_and_patrol_heading(struct Moby * blarg_heavy_interceptor_vertical_oscillation_amplitude_gp, blarg_heavy_interceptor_vertical_oscillation_phase_increment_gp, moby, - interceptor_private_vars->unk1A0, - &interceptor_private_vars->unk1A0[1]); + interceptor_private_vars->oscillation_state, + &interceptor_private_vars->oscillation_state[1]); update_moby_rotation_oscillation( moby, - &interceptor_private_vars->unk1A0[2], - &interceptor_private_vars->unk1A0[3], + &interceptor_private_vars->oscillation_state[2], + &interceptor_private_vars->oscillation_state[3], blarg_heavy_interceptor_rotation_oscillation_amplitude_gp, blarg_heavy_interceptor_rotation_oscillation_first_phase_increment_gp, blarg_heavy_interceptor_rotation_oscillation_second_phase_increment_gp); From c7857cbdbeda921f55113e7007420e3c298edf48 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:09:55 +0000 Subject: [PATCH 451/758] decomp: clarify names in _peepBit unk818 -> ipu_command_class: Retail 0x00128738-0x0012873c tests this field for zero to permit reuse of the bit window. After issuing IPU command 0x40000000 at 0x001287dc, 0x001287e4 loads IpuCommandTable[4] and 0x001287ec stores that command class here. The prepared Ghidra decompilation identifies the same data flow as dwIpuCommandClass, supporting ipu_command_class rather than a boolean validity name. unk838 -> bit_window: Retail 0x001287e8 calls _waitIpuIdle64 after submitting command 0x40000000; 0x001287f0-0x001287fc retains its low 32-bit result in this field. Both the reuse load at 0x00128750 and refreshed load at 0x00128804 feed the logical right shift at 0x00128814 to return the requested leading bits. The C return casts ctx->unk838 to u32 and shifts by 32-count, proving this is the cached bit_window. unk83C -> available_bit_count: Retail 0x00128744-0x0012874c compares this signed field against the requested bit width in s2 and refreshes the peek window when fewer bits are available. After the new 32-bit window is obtained, 0x001287f8 and 0x00128800 store 0x20 here. The authoritative C likewise checks ctx->unk83C < count and resets it to 32, establishing available_bit_count. --- src/sdk/mpeg/bitstream/_peepBit.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/sdk/mpeg/bitstream/_peepBit.c b/src/sdk/mpeg/bitstream/_peepBit.c index 823c5f825c..e3e8ed2ce1 100644 --- a/src/sdk/mpeg/bitstream/_peepBit.c +++ b/src/sdk/mpeg/bitstream/_peepBit.c @@ -5,10 +5,10 @@ typedef struct PeepBitContext { u8 pad_0[0x818]; - s32 unk818; + s32 ipu_command_class; u8 pad_81C[0x1C]; - s32 unk838; - s32 unk83C; + s32 bit_window; + s32 available_bit_count; u8 pad_840[0x18]; s32 unk858; } PeepBitContext; @@ -16,7 +16,7 @@ typedef struct PeepBitContext { s32 _peepBit(PeepBitContext *ctx, s32 count) { s32 counter; - if (ctx->unk818 != 0 || ctx->unk83C < count) { + if (ctx->ipu_command_class != 0 || ctx->available_bit_count < count) { counter = 0; if ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000) { do { @@ -27,9 +27,9 @@ s32 _peepBit(PeepBitContext *ctx, s32 count) { } while ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000); } *(volatile u32 *)0x10002000 = 0x40000000; - ctx->unk818 = IpuCommandTable[4]; - ctx->unk838 = (s32)_waitIpuIdle64(ctx); - ctx->unk83C = 0x20; + ctx->ipu_command_class = IpuCommandTable[4]; + ctx->bit_window = (s32)_waitIpuIdle64(ctx); + ctx->available_bit_count = 0x20; } - return (u32)ctx->unk838 >> (0x20 - count); + return (u32)ctx->bit_window >> (0x20 - count); } From 0b64791c3d609064c7952377c6d20fdeadf77226 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:09:58 +0000 Subject: [PATCH 452/758] decomp: clarify names in prepare_hoverboard_dummy_path_jump unk2E4 -> jump_timer: Retail 0x002d0014-0x002d0018 writes 1 to pvars+0x2E4 after selecting and copying the marked jump target. The authoritative test_dummy_on_hoverboard_update increments this field once per racing update, compares it with scale_game_frames(17) to bound jump velocity adjustment, and resets it to 0 at ground contact. The corresponding L16LeapData timer at +0x2E4 gates jump animation and pitch logic. unk2F0 -> jump_landing_node_index: Retail 0x002cffc8-0x002cffec advances wrapped path indices until the node fourth float is 2.0, then 0x002d0000 stores that index as a short at pvars+0x2F0. Retail 0x002cfff4-0x002d0010 uses the same index to copy the target node vector to +0x270. In the supplied update, this field terminates the path distance accumulation and selects the final height for the jump ballistic rise/duration calculation. --- .../l16/mobys/test_dummy_on_hoverboard.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c index 8251369793..1382fa9b5d 100644 --- a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c +++ b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c @@ -179,10 +179,10 @@ typedef struct HoverboardDummyVars { u8 pad_2D0[0xC]; s32 timer_2DC; u8 pad_2E0[0x4]; - s32 unk2E4; + s32 jump_timer; f32 unk2E8; u8 pad_2EC[0x4]; - s16 unk2F0; + s16 jump_landing_node_index; s16 unk2F2; s16 unk2F4; u16 unk2F6; @@ -278,10 +278,10 @@ void prepare_hoverboard_dummy_path_jump(struct Moby *moby) { tab = hoverboard_dummy_path_jump_data->unk2C0; path_node_byte_offset = path_node_index * 16; } - hoverboard_dummy_path_jump_data->unk2F0 = path_node_index; + hoverboard_dummy_path_jump_data->jump_landing_node_index = path_node_index; qcopy(hoverboard_dummy_path_jump_data->unk270, hoverboard_dummy_path_jump_data->unk2C0 + (short)path_node_index * 16 + 0x10); - hoverboard_dummy_path_jump_data->unk2E4 = 1; + hoverboard_dummy_path_jump_data->jump_timer = 1; } } } @@ -621,7 +621,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { *(short *)&hoverboard_dummy_data->unk2F6 = scale_game_frames(180); *(int *)&hoverboard_dummy_data->unk2C8 = 0; hoverboard_dummy_data->unk2C4 = 0; - hoverboard_dummy_data->unk2E4 = 0; + hoverboard_dummy_data->jump_timer = 0; hoverboard_dummy_data->timer_2DC = 0; *(int *)&hoverboard_dummy_data->unk2BC = 0; if (hoverboard_dummy_data->unk2CC % 2 == 1) { @@ -694,12 +694,12 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { advance_hoverboard_dummy_path_node((char *)moby); collect_hoverboard_dummy_boosts((struct Moby *)moby); prepare_hoverboard_dummy_path_jump((char *)moby); - if (hoverboard_dummy_data->unk2E4 != 0) { - (hoverboard_dummy_data->unk2E4)++; - if (hoverboard_dummy_data->unk2E4 < scale_game_frames(17)) { + if (hoverboard_dummy_data->jump_timer != 0) { + (hoverboard_dummy_data->jump_timer)++; + if (hoverboard_dummy_data->jump_timer < scale_game_frames(17)) { i = hoverboard_dummy_data->unk2F4; distance = 0.0f; - while (i < hoverboard_dummy_data->unk2F0) { + while (i < hoverboard_dummy_data->jump_landing_node_index) { char *path; next_jump_path_node_index = @@ -710,7 +710,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { i = next_jump_path_node_index; } { - short last = hoverboard_dummy_data->unk2F0; + short last = hoverboard_dummy_data->jump_landing_node_index; short first = hoverboard_dummy_data->unk2F4; char *path = hoverboard_dummy_data->unk2C0; float rise = *(float *)(path - (-(last * 16)) + 0x18) - @@ -769,7 +769,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { } else if (absolute_float(gap) < 0.5f) { hoverboard_dummy_data->unk2C8 = 0.0f; hoverboard_dummy_data->unk260[2] = z; - hoverboard_dummy_data->unk2E4 = 0; + hoverboard_dummy_data->jump_timer = 0; } hoverboard_dummy_data->unk260[2] += hoverboard_dummy_data->unk2C8; if (fast_dec_timer_s16(&hoverboard_dummy_data->unk2F6)) { @@ -799,7 +799,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { } if (gap < 0.2f && hoverboard_dummy_data->unk2C8 < 0.0f) { hoverboard_dummy_data->unk260[2] = z; - hoverboard_dummy_data->unk2E4 = 0; + hoverboard_dummy_data->jump_timer = 0; } rate = *(float *)&hoverboard_dummy_data->unk2C4; limit = D_0015ED6C * 2.6179938f; From f405d7442cf80aff493b8e4ef31736b54424293f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:11:53 +0000 Subject: [PATCH 453/758] decomp: clarify names in enter_scoutbot_return_home_state unk208 -> vertical_bob_amplitude: Retail 0x002d4070 loads moby->pvars into s1; 0x002d4080/84 loads 0.5f into f1 and 0x002d4094 stores it at s1+0x208 during return-home entry. In authoritative scoutbot.c (SHA-256 fee90ea708d871baa91739ca060c1ba7d5241715f699f26b95f5bfb85f9221e6), ScoutbotVars.unk208 is f32 and update_scoutbot_movement computes target_height = unk1C0[2] + unk208 * fast_sin(unk204), after advancing unk204 with fast_add_rotations. target_height minus moby->pos.z determines the clamped vertical step stored in unk40[2]. Thus this member scales sinusoidal vertical bobbing about home height. --- src/overlays/shared/enemies/scoutbot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index 0e2c8b0f8f..685f83572f 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -51,7 +51,7 @@ typedef struct ScoutbotVars { u8 pad1F0[0x10]; f32 unk200; f32 unk204; - f32 unk208; + f32 vertical_bob_amplitude; f32 unk20C; u8 pad210[0x6]; s16 unk216; @@ -609,7 +609,7 @@ void update_scoutbot_movement(struct Moby *moby) { scoutbot_instance_state->unk204 = fast_add_rotations(scoutbot_instance_state->unk204, scoutbot_instance_state->unk20C); target_height = scoutbot_instance_state->unk1C0[2] + - scoutbot_instance_state->unk208 * fast_sin(scoutbot_instance_state->unk204); + scoutbot_instance_state->vertical_bob_amplitude * fast_sin(scoutbot_instance_state->unk204); if (scoutbot_instance_state->unk216) target_height += scoutbot_instance_state->unk200; vertical_step = target_height - moby->pos.z; @@ -650,7 +650,7 @@ void *enter_scoutbot_return_home_state(struct Moby *moby) { ScoutbotVars *scoutbot_data = (ScoutbotVars *)moby->pvars; moby->state = SCOUTBOT_STATE_RETURN_HOME; scoutbot_data->unk200 = 4.0f; - scoutbot_data->unk208 = 0.5f; + scoutbot_data->vertical_bob_amplitude = 0.5f; if ((unsigned char)((char)moby->prev_seq) != 2) { blend_moby_animation(moby, 2, 0, 3); } From 75c4d634caf4f053af47ef13ec032f4e6382662b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:11:56 +0000 Subject: [PATCH 454/758] decomp: clarify names in start_camera_transition unk64 -> transition_progress_rate: Retail 0x002dfac0 loads moby->pvars and 0x002dfacc clears pvars+0x64; original Ghidra puVar1[0x19] = 0 agrees with start_camera_transition setting unk64 to zero alongside progress unk60 at +0x60. In both supplied boss_camera_transition_update interpolation states, advance_accelerated_scalar receives &unk60, (float *)&unk64, target 1.0f, acceleration unk68 twice and rate limit unk70. unk60 then drives position lerp and rotation interpolation and is compared with 1.0f for completion. Thus unk64 is the mutable rate state for camera transition progress, rather than a position, angle, delay or mode. Its declared s32 storage and existing float-pointer cast are preserved. --- src/overlays/l18/mobys/camera_transition.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l18/mobys/camera_transition.c b/src/overlays/l18/mobys/camera_transition.c index 5b640a2a81..7134c02583 100644 --- a/src/overlays/l18/mobys/camera_transition.c +++ b/src/overlays/l18/mobys/camera_transition.c @@ -60,7 +60,7 @@ typedef struct BossCameraTransitionVars { f32 unk4C; u8 pad_50[0x10]; f32 unk60; - s32 unk64; + s32 transition_progress_rate; f32 unk68; f32 unk6C; f32 unk70; @@ -116,7 +116,7 @@ void boss_camera_transition_update(struct Moby *moby) { D_L18_0017EF08 = 1; if (fast_dec_timer(&transition_private_vars->timer_74)) { advance_accelerated_scalar(&transition_private_vars->unk60, - (float *)&transition_private_vars->unk64, + (float *)&transition_private_vars->transition_progress_rate, 1.0f, transition_private_vars->unk68, transition_private_vars->unk68, @@ -163,7 +163,7 @@ void boss_camera_transition_update(struct Moby *moby) { case STATE_INTERPOLATE_TRANSITION_WITH_RAMP_UP: if (fast_dec_timer(&transition_private_vars->timer_74)) { advance_accelerated_scalar(&transition_private_vars->unk60, - (float *)&transition_private_vars->unk64, + (float *)&transition_private_vars->transition_progress_rate, 1.0f, transition_private_vars->unk68, transition_private_vars->unk68, @@ -254,7 +254,7 @@ void start_camera_transition(struct Moby *moby, BossCameraTransitionVars *position_rotation_transition_vars = (BossCameraTransitionVars *)moby->pvars; *(int *)&position_rotation_transition_vars->unk60 = 0; - position_rotation_transition_vars->unk64 = 0; + position_rotation_transition_vars->transition_progress_rate = 0; qcopy(position_rotation_transition_vars, transition_start_position); qcopy(&position_rotation_transition_vars->unk10, transition_target_position); qcopy(&position_rotation_transition_vars->unk20, transition_start_rotation); From d00364fc12bd391d42e8338fb5a15bcaa4e739bc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:11:59 +0000 Subject: [PATCH 455/758] decomp: clarify names in activate_smaller_amoeboid unk224 -> base_target_search_radius: Assigned retail 0x002ef3f0/0x002ef400 loads child/source pvars into t1/a3; 0x002ef458 and delay-slot 0x002ef460 copy float +0x224 from source to smaller amoeboid, matching other_vars->unk224 = self_vars->unk224 in the authoritative source (SHA-256 1d0bb74fe67d036158d532be166cc74c75b52b8aa25e7a5c7a1734042ae4a8ae). Checked caller 0x002eec68, evidence request 1975c36c59cd4441aaae96fe4ffeb6d0, loads +0x224 at 0x002ef160 and writes +0x228 either unchanged at 0x002ef168 or plus 20.0 at 0x002ef16c-0x002ef17c. That effective radius feeds path search at 0x002ef1b4/0x002ef1d8, bounds home-to-search-position XY distance at 0x002ef1e8-0x002ef200, and gates candidate XY distance at 0x002ef258-0x002ef270 before storing the selected target at +0x200 (0x002ef2a4). Authoritative C identifies these distance operations and defaults unk224 to 15.0f when zero. Thus +0x224 is the base target search radius inherited by smaller amoeboids, rather than the adjusted radius at +0x228. --- src/overlays/shared/enemies/large_amoeboid.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index 2b59788dbc..ac15287c7d 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -82,7 +82,7 @@ typedef struct LargeAmoeboidVars { u8 pad208[0x8]; f32 home_pos[4]; /* 0x210: position at spawn */ u8 unk220[0x4]; - f32 unk224; + f32 base_target_search_radius; f32 unk228; s32 unk22C; s32 unk230; @@ -303,8 +303,8 @@ void large_amoeboid_update(unsigned char *moby) { } else { large_amoeboid_vars->health = 3.0f; } - if (large_amoeboid_vars->unk224 == 0.0f) - large_amoeboid_vars->unk224 = 15.0f; + if (large_amoeboid_vars->base_target_search_radius == 0.0f) + large_amoeboid_vars->base_target_search_radius = 15.0f; FUN_L01_0026d930(&large_amoeboid_vars->unk170); large_amoeboid_vars->unk17C = 2.0f; large_amoeboid_vars->unk178 = 2.0f; @@ -815,9 +815,9 @@ void process_amoeboid_hits_and_update_targeting(char *moby) { moby_vars->unk38 = 0; } if (fast_dec_timer(&moby_vars->unk22C) != 0) { - moby_vars->unk228 = moby_vars->unk224; + moby_vars->unk228 = moby_vars->base_target_search_radius; } else { - moby_vars->unk228 = moby_vars->unk224 + 20.0f; + moby_vars->unk228 = moby_vars->base_target_search_radius + 20.0f; } path_search_gate_moby_index = moby_vars->unk260; if (path_search_gate_moby_index <= 0 || @@ -921,7 +921,7 @@ char *activate_smaller_amoeboid(void *source_moby) { qcopy(&smaller_amoeboid->pos, &source_amoeboid->pos); qcopy(&smaller_amoeboid->rot, &source_amoeboid->rot); other_vars->health = self_vars->health; - other_vars->unk224 = self_vars->unk224; + other_vars->base_target_search_radius = self_vars->base_target_search_radius; update_entity(smaller_amoeboid); return (char *)smaller_amoeboid; } From 827628d22fdf6c249e03dcf72900e59092cf4e10 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:12:02 +0000 Subject: [PATCH 456/758] decomp: clarify names in start_racer_branch_jump unk210 -> jump_target_node: Retail 0x00307430-0x00307448 copies all 16 bytes from active path + 0x10 + selected index*16 into pvars+0x210 after finding mark 2.0. The source qcopy preserves that complete node; update_racer_jump_animations reads its z component at +0x218 as targetHeight for the remaining jump trajectory. unk24C -> racer_vertical_speed: Retail 0x00307394-0x003073a8 loads pvars+0x24c and requires it <= 0 before starting a branch jump. The source's same-layout Data.vertical_speed is approached toward computed jump_speed, reduced by frame_time_sq_macro*21.0f, and added to pos[2]; LeapVars.verticalSpeed also uses it in the jump quadratic. unk258 -> current_path_node_index: Retail lh at 0x003073b0 reads pvars+0x258, then 0x003073bc-0x003073c4 multiplies it by 16 to read the current active path node's w mark. advance_racer_path_node uses this same signed-short field as node and advances it modulo path count; skid_mcmarx_update uses it as point_index at the start of the jump-distance loop. unk26C -> jump_elapsed_frames: Retail 0x0030744c-0x00307450 writes 1 to pvars+0x26c after selecting the jump target. The corresponding source Data.jump_frames is incremented each FOLLOW_PATH update, compared with scale_game_frames(0x11) for jump acceleration, and reset to zero on landing; LeapVars.timer uses the same field to time leap animation. unk27C -> jump_landing_node_index: Retail 0x00307404-0x00307428 advances the wrapping path index until node w equals 2.0, then 0x00307438 stores that index at pvars+0x27c and copies that node to the jump target. The same-layout source Data.jump_point bounds the path-length loop and indexes the destination z when calculating jump_speed. --- src/overlays/l05/mobys/skid_mcmarx.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/l05/mobys/skid_mcmarx.c b/src/overlays/l05/mobys/skid_mcmarx.c index d22aa4bce7..4b0aa88517 100644 --- a/src/overlays/l05/mobys/skid_mcmarx.c +++ b/src/overlays/l05/mobys/skid_mcmarx.c @@ -145,18 +145,18 @@ void start_racer_branch_jump(char *moby) __asm__("FUN_L05_00307358"); typedef struct SkidMcmarxVars { u8 pad_0[0x210]; - f32 unk210[4]; + f32 jump_target_node[4]; s32 path_220; u8 pad_224[0x20]; char *unk244; u8 pad_248[0x4]; - f32 unk24C; + f32 racer_vertical_speed; u8 pad_250[0x8]; - s16 unk258; + s16 current_path_node_index; u8 pad_25A[0x12]; - s32 unk26C; + s32 jump_elapsed_frames; u8 pad_270[0xC]; - s32 unk27C; + s32 jump_landing_node_index; } SkidMcmarxVars; void start_racer_branch_jump(char *moby) { @@ -165,8 +165,8 @@ void start_racer_branch_jump(char *moby) { int path_node_index; int path_node_byte_offset; if (active_path != ((char *)l05_paths[moby_data->path_220])) { - if (moby_data->unk24C <= 0.0f) { - path_node_index = moby_data->unk258; + if (moby_data->racer_vertical_speed <= 0.0f) { + path_node_index = moby_data->current_path_node_index; path_node_byte_offset = path_node_index * 16; if (*(float *)(active_path + path_node_byte_offset + 0x1C) == 1.0f) { while (*(float *)(active_path + path_node_byte_offset + 0x1C) != 2.0f) { @@ -174,9 +174,9 @@ void start_racer_branch_jump(char *moby) { active_path = moby_data->unk244; path_node_byte_offset = path_node_index * 16; } - moby_data->unk27C = path_node_index; - qcopy(moby_data->unk210, moby_data->unk244 + path_node_index * 16 + 0x10); - moby_data->unk26C = 1; + moby_data->jump_landing_node_index = path_node_index; + qcopy(moby_data->jump_target_node, moby_data->unk244 + path_node_index * 16 + 0x10); + moby_data->jump_elapsed_frames = 1; } } } From e6c2e8d9cd28477867a5f5bba7d17cf9a3fcd582 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:13:57 +0000 Subject: [PATCH 457/758] decomp: clarify names in update_racer_path_and_weapon unk110 -> target_facing_yaw_quaternion: Retail 0x002d70d8-0x002d70f0 subtracts racer position from the target point and computes its XY heading. 0x002d70f4-0x002d7140 subtracts the current yaw and clamps the offset to +/-1.2217305. At 0x002d7144-0x002d7150 pvars+0x110 is the output address for the checked build_axis_rotation_quaternion call with axis 2 and that offset. Bound C agrees: build_axis_rotation_quaternion(&moby_data->unk110, 2, target_yaw_offset). The field denotes the start of that target-facing yaw quaternion storage; its existing u8 declaration and following padding remain unchanged. unk1C4 -> weapon_aim_blend_elapsed_frames: Retail 0x002d6a40 zeros pvars+0x1C4 when entering command 2; 0x002d6bf0-0x002d6c44 increments it once per update and caps it at scale_game_frames(30), switching commands on completion. 0x002d6c60-0x002d6cac divides this elapsed count by that scaled duration, reverses the blend in command 4 and scales aim turn; 0x002d6e08-0x002d6e18 uses the same blend for quaternion_nlerp. 0x002d6e8c resets it on entry to command 4. This proves an elapsed weapon aim-blend frame count, distinct from remaining aim_timer. unk8E -> lead_distance_blend_start_segment: Retail 0x002d683c loads signed pvars+0x8E, 0x002d684c-0x002d686c compares it with current_path_segment_index, and 0x002d6874-0x002d68a0 sums path segment lengths from that index. 0x002d68a4-0x002d68dc adds segment offset, normalizes/clamps progress and interpolates the lead distance at pvars+0x74. Bound C uses unk8E as this loop's lower bound; initialize_racer_path_tracking assigns a nearest-path segment from the second target point. --- .../l14/mobys/racer_path_and_weapon.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/l14/mobys/racer_path_and_weapon.c b/src/overlays/l14/mobys/racer_path_and_weapon.c index 795343a577..fe8762575e 100644 --- a/src/overlays/l14/mobys/racer_path_and_weapon.c +++ b/src/overlays/l14/mobys/racer_path_and_weapon.c @@ -54,14 +54,14 @@ typedef struct RacerVars { s32 unk84; s32 unk88; s16 nearest_segment; - s16 unk8E; + s16 lead_distance_blend_start_segment; f32 position_spring_velocity[3]; u8 pad_9C[0x4]; f32 bone_transform[16]; f32 unkE0[4]; s32 unkF0; u8 pad_F4[0x1C]; - u8 unk110; + u8 target_facing_yaw_quaternion; u8 pad_111[0x3F]; u8 unk150; u8 pad_151[0x32]; @@ -72,7 +72,7 @@ typedef struct RacerVars { f32 unk1A0[4]; f32 unk1B0[4]; s32 aim_timer; - s32 unk1C4; + s32 weapon_aim_blend_elapsed_frames; s32 timer_1C8; u8 pad_1CC[0x4]; f32 target_rotation[4]; @@ -120,7 +120,7 @@ void initialize_racer_path_tracking(struct Moby *racer_moby) { 5.0f, z); second_point_segment = nearest_path_position.i; - moby_data->unk8E = second_point_segment; + moby_data->lead_distance_blend_start_segment = second_point_segment; moby_data->unk70[2] = z; for (k = (short)second_point_segment; k < moby_data->nearest_segment; k++) { moby_data->unk70[2] += *(float *)(path + k * 16 + 0x1C); @@ -306,10 +306,10 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { float blend; float target_yaw_offset; - if (moby_data->current_path_segment_index >= moby_data->unk8E) { + if (moby_data->current_path_segment_index >= moby_data->lead_distance_blend_start_segment) { float sum = 0.0f; int k; - for (k = moby_data->unk8E; k < moby_data->current_path_segment_index; k++) { + for (k = moby_data->lead_distance_blend_start_segment; k < moby_data->current_path_segment_index; k++) { sum += *(float *)(path + k * 16 + 0x1C); } sum += moby_data->unk68; @@ -344,7 +344,7 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { } if (racer_moby->command == 1) { moby_data->aim_timer = scale_game_frames(l14_racer_weapon_aim_duration_frames); - moby_data->unk1C4 = 0; + moby_data->weapon_aim_blend_elapsed_frames = 0; racer_moby->command = 2; build_moby_bone_transform(racer_moby, 4, joint_transform_and_aim_vectors); build_moby_bone_transform(racer_moby, 5, ma); @@ -387,8 +387,8 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { } else if (turn < -1.2217305f) { turn = -1.2217305f; } - (moby_data->unk1C4)++; - if (scale_game_frames(30) < moby_data->unk1C4) { + (moby_data->weapon_aim_blend_elapsed_frames)++; + if (scale_game_frames(30) < moby_data->weapon_aim_blend_elapsed_frames) { if (racer_moby->command == 4) { racer_moby->command = 0; } else { @@ -396,10 +396,10 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { register_beam_slot(racer_moby, firing_command, 1); racer_moby->command = firing_command; } - moby_data->unk1C4 = scale_game_frames(30); + moby_data->weapon_aim_blend_elapsed_frames = scale_game_frames(30); } if (racer_moby->command == 2 || racer_moby->command == 4) { - blend = convert_integer_to_float(moby_data->unk1C4) / + blend = convert_integer_to_float(moby_data->weapon_aim_blend_elapsed_frames) / convert_integer_to_float(scale_game_frames(30)); if (racer_moby->command == 4) { blend = 1.0f - blend; @@ -445,7 +445,7 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { qcopy(moby_data->unk1B0, &scl); if (fast_dec_timer(&moby_data->aim_timer) != 0) { racer_moby->command = 4; - moby_data->unk1C4 = 0; + moby_data->weapon_aim_blend_elapsed_frames = 0; } if (racer_moby->command == 3) { if (set_beam_origin_transform_and_endpoint( @@ -522,7 +522,7 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { } else if (target_yaw_offset < -1.2217305f) { target_yaw_offset = -1.2217305f; } - build_axis_rotation_quaternion(&moby_data->unk110, 2, target_yaw_offset); + build_axis_rotation_quaternion(&moby_data->target_facing_yaw_quaternion, 2, target_yaw_offset); } /* Ported from rac1-decomp (src/overlays/l14_oltanis/vendor_002ACCC0.c: func_L14_002D84A8), where it is exact; names translated to the US level program. */ From cafcc53328d7f4e425d7366436eab4eb64752920 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:16:08 +0000 Subject: [PATCH 458/758] decomp: clarify names in _nextBit unk818 -> ipu_command_class: Retail 0x001289ac-0x001289b0 tests this field for nonzero to require a window refresh. At 0x001289dc-0x001289e4 it receives IpuCommandTable[4] after command 0x40000000; at 0x00128a10-0x00128a38 it receives the table entry indexed by the issued command's top nibble. The C uses match these accesses, proving the stored IPU command classification rather than a raw command or bit count. unk838 -> cached_bit_window: Retail 0x001289e0-0x001289f0 stores the low 32 bits returned by _waitIpuIdle64 after the refresh command. At 0x00128a0c it loads this field into s0, 0x00128a20-0x00128a28 shifts it right by 32-count, and 0x00128a4c returns those leading bits. At 0x00128a34-0x00128a48 the completed advancing command replaces the field. C likewise extracts consumed_bits from it before refreshing it, proving a cached MPEG bit window. unk83C -> available_bit_count: Retail 0x001289b8-0x001289c0 compares this signed field with the requested bit count in s2 and refreshes the bit window when it is smaller. Retail 0x001289f4 and 0x00128a04 publish 32 to the field alongside the 32-bit cached window. The authoritative C uses ctx->unk83C < count to require refresh and assigns 0x20, proving the count of available cached bits. --- src/sdk/mpeg/bitstream/nextbit.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/sdk/mpeg/bitstream/nextbit.c b/src/sdk/mpeg/bitstream/nextbit.c index db3e49630a..447f0f637e 100644 --- a/src/sdk/mpeg/bitstream/nextbit.c +++ b/src/sdk/mpeg/bitstream/nextbit.c @@ -5,10 +5,10 @@ typedef struct NextBitContext { u8 pad_0[0x818]; - s32 unk818; + s32 ipu_command_class; u8 pad_81C[0x1C]; - s32 unk838; - s32 unk83C; + s32 cached_bit_window; + s32 available_bit_count; u8 pad_840[0x18]; s32 unk858; } NextBitContext; @@ -26,16 +26,16 @@ s32 _nextBit(NextBitContext *ctx, s32 count) { } } while ((*(volatile u32 *)0x10002010 & 0x80004000) == 0x80000000); } - if (ctx->unk818 != 0 || ctx->unk83C < count) { + if (ctx->ipu_command_class != 0 || ctx->available_bit_count < count) { *(volatile u32 *)0x10002000 = 0x40000000; - ctx->unk818 = IpuCommandTable[4]; - ctx->unk838 = (s32)(s64)_waitIpuIdle64(ctx); + ctx->ipu_command_class = IpuCommandTable[4]; + ctx->cached_bit_window = (s32)(s64)_waitIpuIdle64(ctx); } - consumed_bits = ((u32)ctx->unk838) >> (0x20 - count); - ctx->unk83C = 0x20; + consumed_bits = ((u32)ctx->cached_bit_window) >> (0x20 - count); + ctx->available_bit_count = 0x20; word = count | 0x40000000; *(volatile u32 *)0x10002000 = word; - ctx->unk818 = IpuCommandTable[word >> 28]; - ctx->unk838 = (s32)(s64)_waitIpuIdle64(ctx); + ctx->ipu_command_class = IpuCommandTable[word >> 28]; + ctx->cached_bit_window = (s32)(s64)_waitIpuIdle64(ctx); return consumed_bits; } From 7ada6e493a093076291c0a04deec97e24c706f84 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:16:11 +0000 Subject: [PATCH 459/758] decomp: clarify names in start_alien_queen_intro unk118 -> camera_blend_fraction: Retail 0x002fb170 loads queen pvars from moby+0x78; 0x002fb180 stores zero at pvars+0x118, matching original Ghidra *(undefined4 *)(iVar1 + 0x118) = 0 and current start_alien_queen_intro. The listed member is f32. In supplied exact C update_alien_queen_intro_camera, advance_accelerated_scalar takes &unk118 with target 1.0f, lerp_vector uses unk118 to interpolate moby_offset_position toward hero_offset_position, pitch subtracts (1.0f - unk118) * 30.0f * DEG_TO_RAD, and completion requires unk118 >= 1.0f. These operations establish a camera blend fraction rather than merely an offset or arbitrary scalar. --- src/overlays/l06/mobys/alien_queen.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l06/mobys/alien_queen.c b/src/overlays/l06/mobys/alien_queen.c index d47f402d8e..ae978fbb73 100644 --- a/src/overlays/l06/mobys/alien_queen.c +++ b/src/overlays/l06/mobys/alien_queen.c @@ -396,7 +396,7 @@ typedef struct AlienQueenVars { s32 animation_update; s32 unk110; s32 unk114; - f32 unk118; + f32 camera_blend_fraction; u8 unk11C; u8 pad_11D[0x3]; s32 timer_120; @@ -996,7 +996,7 @@ void start_alien_queen_intro(char *moby) { float output_position[4], output_rotation[4], moby_offset_vector[4]; AlienQueenVars *alien_queen_vars = (AlienQueenVars *)MOBY(moby)->pvars; LevelCuboid *hero_placement_node = &l06_cuboids[alien_queen_vars->cuboid]; - *(int *)&alien_queen_vars->unk118 = 0; + *(int *)&alien_queen_vars->camera_blend_fraction = 0; set_race_camera(&hero_placement_node->pos, &hero_placement_node->rot, 0x72, 0); qcopy(output_position, moby + 0x10); output_position[2] = hero.motion.pos.f[2] + 2.0f; @@ -1027,7 +1027,7 @@ int update_alien_queen_intro_camera(char *moby) { pos = moby + 0x10; } else { blend_acceleration_step = *(float *)&frame_time_sq * 3.0f; - advance_accelerated_scalar(&alien_queen_state->unk118, + advance_accelerated_scalar(&alien_queen_state->camera_blend_fraction, (float *)&alien_queen_state->unk11C, 1.0f, blend_acceleration_step, @@ -1042,16 +1042,16 @@ int update_alien_queen_intro_camera(char *moby) { hero_offset_position[2] += 4.0f; pos = moby + 0x10; lerp_vector( - output_position, moby_offset_position, hero_offset_position, alien_queen_state->unk118); + output_position, moby_offset_position, hero_offset_position, alien_queen_state->camera_blend_fraction); } output_rotation[2] = fast_arc_tan(MOBY(moby)->pos.x - output_position[0], MOBY(moby)->pos.y - output_position[1]); output_rotation[1] = -fast_arc_tan(vector_distance_xy(output_position, pos), MOBY(moby)->pos.z - output_position[2]) - - (1.0f - alien_queen_state->unk118) * 30.0f * DEG_TO_RAD; + (1.0f - alien_queen_state->camera_blend_fraction) * 30.0f * DEG_TO_RAD; set_camera_position(output_position); set_camera_rotation(output_rotation); - if (alien_queen_state->unk118 >= 1.0f && MOBY(moby)->prev_seq == 1) + if (alien_queen_state->camera_blend_fraction >= 1.0f && MOBY(moby)->prev_seq == 1) return 1; return 0; } From 85618de4e6795088a79f4467085e4dfef0df6a6d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:16:15 +0000 Subject: [PATCH 460/758] decomp: clarify names in start_snagglebeast_turn_toward_target unk168 -> turn_controller_state: Original retail decompilation writes zero to param_2+0x168 when the heading error exceeds the threshold; instruction 0x00313e54 is sw zero,0x168(s0), before saving the turn target and entering state 7. In the SHA-256-bound supplied C, this same SnagglebeastVars member is passed by address as argument 3 to FUN_L00_00258278 with moby, desired target heading, and frame-scaled turning parameters in SNAGGLEBEAST_TURN_TOWARD_TARGET and attack states 2,3,8,9. This proves persistent heading/turn controller state, without asserting that its preserved s32 storage is an integer counter or recovering its exact scalar interpretation. --- src/overlays/l07/mobys/snagglebeast.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index fd783735af..580f08f685 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -103,7 +103,7 @@ typedef struct SnagglebeastVars { f32 unk150[4]; s32 timer; s32 unk164; - s32 unk168; + s32 turn_controller_state; f32 unk16C; s32 navigation_ids[6]; s32 nav_path; @@ -790,7 +790,7 @@ int start_snagglebeast_turn_toward_target(unsigned char *moby, target_position[1] - MOBY(moby)->pos.y); if (moby_vars->turn_start_angle < fast_difference_between_rotations(MOBY(moby)->rot.z, target_heading)) { - moby_vars->unk168 = 0; + moby_vars->turn_controller_state = 0; MOBY(moby)->anim_speed = 1.0f; moby_vars->turn_saved_state = MOBY(moby)->state; moby_vars->turn_resume_animation = resume_animation; @@ -1322,7 +1322,7 @@ void snagglebeast_update(unsigned char *moby) { break; FUN_L00_00258278((struct Moby *)moby, target_angle, - (float *)&snagglebeast_instance_state->unk168, + (float *)&snagglebeast_instance_state->turn_controller_state, frame_time_sq * 2.0943952f, frame_time_sq * 0.6981317f, frame_time * 2.0943952f); @@ -1351,7 +1351,7 @@ void snagglebeast_update(unsigned char *moby) { case SNAGGLEBEAST_TRIPLE_SPAWN_ATTACK: FUN_L00_00258278((struct Moby *)moby, target_angle, - (float *)&snagglebeast_instance_state->unk168, + (float *)&snagglebeast_instance_state->turn_controller_state, frame_time_sq * 1.5707964f, frame_time_sq * 0.6981317f, frame_time * 1.0471976f); @@ -1362,7 +1362,7 @@ void snagglebeast_update(unsigned char *moby) { snagglebeast_instance_state->unk164 += 1; qcopy(&position, moby + 0x10); speed = frame_time * 8.0f; - snagglebeast_instance_state->unk168 = 0; + snagglebeast_instance_state->turn_controller_state = 0; spawn_fading_ring_effect((int)moby, &position, 0x3A, 1.0f, 25.0f, 2.0f, speed, 1.0f); FUN_L00_0024f7c8(moby, (snagglebeast_instance_state->unk164 & 1) + 5, &position); configure_timed_point_light(moby, @@ -1687,7 +1687,7 @@ void snagglebeast_update(unsigned char *moby) { (struct Moby *)moby, fast_arc_tan(snagglebeast_instance_state->turn_target[0] - MOBY(moby)->pos.x, snagglebeast_instance_state->turn_target[1] - MOBY(moby)->pos.y), - (float *)&snagglebeast_instance_state->unk168, + (float *)&snagglebeast_instance_state->turn_controller_state, frame_time_sq * 2.0943952f, frame_time_sq * 0.6981317f, frame_time * 2.0943952f); @@ -1951,7 +1951,7 @@ void snagglebeast_update(unsigned char *moby) { ((int *)snagglebeast_instance_state)[0xA5] = 1; FUN_L00_00258278((struct Moby *)moby, hero_angle, - (float *)&snagglebeast_instance_state->unk168, + (float *)&snagglebeast_instance_state->turn_controller_state, frame_time_sq * 2.0943952f, frame_time_sq * 0.6981317f, frame_time * 2.0943952f); @@ -2156,7 +2156,7 @@ void snagglebeast_update(unsigned char *moby) { FUN_L00_00258278((struct Moby *)moby, fast_arc_tan(snagglebeast_instance_state->unk150[0] - MOBY(moby)->pos.x, snagglebeast_instance_state->unk150[1] - MOBY(moby)->pos.y), - (float *)&snagglebeast_instance_state->unk168, + (float *)&snagglebeast_instance_state->turn_controller_state, frame_time_sq * 2.0943952f, frame_time_sq * 0.6981317f, frame_time * 2.0943952f); From 0bcbc6654914c0275d6334a39cb407324da5d87a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:16:18 +0000 Subject: [PATCH 461/758] decomp: clarify names in apply_resort_owner_movement unk158 -> current_path_leg: Retail 0x002d13d4-0x002d13f0 loads pvars+0x158, multiplies it by four and selects the path at pvars+0x60 for resolve_point_path_segment_xy_clearance. 0x002d13f4-0x002d1404 compares the same selector to legs 2 and 3. The authoritative C uses RESORT_OWNER_PENULTIMATE_PATH_LEG and RESORT_OWNER_FINAL_PATH_LEG; its PokKeeperVars view names this same storage leg, indexes points[leg], and increments it after gate departure and before the final leg. Thus this is current path progression, separate from Moby.state. unk84 -> supplemental_clearance_path: Retail 0x002d1428-0x002d1438 loads pvars+0x84 into a0 and passes the owner's position as both a1 and a2 to the checked resolve_point_path_segment_xy_clearance helper with radius 0.3; 0x002d1470-0x002d147c repeats this for final leg 3. Authoritative apply_resort_owner_movement uses unk84 for this additional position correction after the leg-selected path. The same pvars storage appears as c[1] in the supplied try_update_resort_owner_path_target, appended to path_ids for both penultimate and final legs before follow_path. This establishes a supplemental path used for clearance, without claiming its world identity. --- src/overlays/l11/mobys/resort_owner.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/l11/mobys/resort_owner.c b/src/overlays/l11/mobys/resort_owner.c index b46f120bbe..b7e9ef71ff 100644 --- a/src/overlays/l11/mobys/resort_owner.c +++ b/src/overlays/l11/mobys/resort_owner.c @@ -73,7 +73,7 @@ typedef struct ResortOwnerVars { s16 unk56; u8 pad_58[0x28]; void *unk80; - void *unk84; + void *supplemental_clearance_path; void *unk88; u8 pad_8C[0x64]; s32 unkF0; @@ -87,7 +87,7 @@ typedef struct ResortOwnerVars { f32 unk140[4]; f32 unk150; f32 unk154; - u32 unk158; + u32 current_path_leg; s32 unk15C; } ResortOwnerVars; @@ -223,7 +223,7 @@ void update_resort_owner_state_actions(void *mp) { break; case RESORT_OWNER_WAIT_AT_GATE: { int *gate_moby_index_ptr = &pvars->unkF0; - unsigned int gate_slot_index = 0U < pvars->unk158; + unsigned int gate_slot_index = 0U < pvars->current_path_leg; char *gate_moby; gate_moby_index_ptr += gate_slot_index; gate_moby = (char *)D_L11_0015FFD8; @@ -272,15 +272,15 @@ void apply_resort_owner_movement(void *mp) { (MOBY(moby)->state == RESORT_OWNER_JUMP_TO_TARGET && moby_vars->unk15C == 3)) { resolve_point_path_segment_xy_clearance( 0.3f, - *(void **)((u8 *)moby_vars + 0x60 - -(*(int *)&moby_vars->unk158 * 4)), + *(void **)((u8 *)moby_vars + 0x60 - -(*(int *)&moby_vars->current_path_leg * 4)), moby + 0x10, moby + 0x10); - switch (*(int *)&moby_vars->unk158) { + switch (*(int *)&moby_vars->current_path_leg) { case RESORT_OWNER_PENULTIMATE_PATH_LEG: resolve_point_path_segment_xy_clearance( 0.3f, moby_vars->unk80, moby + 0x10, moby + 0x10); resolve_point_path_segment_xy_clearance( - 0.3f, moby_vars->unk84, moby + 0x10, moby + 0x10); + 0.3f, moby_vars->supplemental_clearance_path, moby + 0x10, moby + 0x10); resolve_point_path_segment_xy_clearance( 0.3f, moby_vars->unk88, moby + 0x10, moby + 0x10); break; @@ -288,7 +288,7 @@ void apply_resort_owner_movement(void *mp) { resolve_point_path_segment_xy_clearance( 0.3f, moby_vars->unk80, moby + 0x10, moby + 0x10); resolve_point_path_segment_xy_clearance( - 0.3f, moby_vars->unk84, moby + 0x10, moby + 0x10); + 0.3f, moby_vars->supplemental_clearance_path, moby + 0x10, moby + 0x10); break; } } @@ -639,7 +639,7 @@ void set_resort_owner_state(struct Moby *moby, unsigned char state) { FUN_00212f90(moby, 3, 0, scale_game_frames(0x14)); { int *tbl = &moby_vars->unkF0; - unsigned int idx = 0U < moby_vars->unk158; + unsigned int idx = 0U < moby_vars->current_path_leg; int p; char *o; tbl += idx; @@ -662,7 +662,7 @@ void set_resort_owner_state(struct Moby *moby, unsigned char state) { FUN_00212f90(moby, 3, 0, scale_game_frames(0x14)); { int *tbl = &moby_vars->unkF0; - unsigned int idx = 0U < moby_vars->unk158; + unsigned int idx = 0U < moby_vars->current_path_leg; int p; char *o; tbl += idx; @@ -807,7 +807,7 @@ int try_find_resort_owner_jump_target(struct Moby *moby, float *jump_target_posi fast_vec_add(candidate_position, candidate_position, pos); { int *path_entry = - (int *)l11_paths[*(int *)((u8 *)pvars - (-(*(int *)&pvars->unk158 * 4)) + 0x60)]; + (int *)l11_paths[*(int *)((u8 *)pvars - (-(*(int *)&pvars->current_path_leg * 4)) + 0x60)]; if (point_in_path_xy(candidate_position, path_entry + 4, *path_entry)) { candidate_position[2] += 5.0f; landing_ground_height = func_L00_0025A748_f(candidate_position); From f06ee68d32626223e9895c411b9a8670abc82908 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:18:26 +0000 Subject: [PATCH 462/758] decomp: clarify names in reset_listed_plasmabot_beam_cooldowns unk260 -> beam_cooldown_timer: Retail 0x002b38c8-0x002b38dc resolves each packed list entry to a moby; 0x002b38e0 tests class 0x1C and 0x002b38e8 loads its pvars from moby+0x78. The call at 0x002b38ec scales plasmabot_beam_cooldown_frames, and sh v0,0x260(s1) at 0x002b38f4 stores that duration in the listed PlasmabotVars s16 unk260. In the SHA-256-bound source, plasmabot_update initializes the field to zero and passes its address to fast_dec_timer_s16 in PLASMABOT_AIM_AT_TARGET, breaking while the timer has not expired before beam eligibility checks. On successful eligibility it invokes reset_listed_plasmabot_beam_cooldowns before state 5 beam preparation. These reset/decrement/gating operations prove beam_cooldown_timer. --- src/overlays/shared/enemies/plasmabot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index aaeac8bedf..a0b51aa87c 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -102,7 +102,7 @@ typedef struct PlasmabotVars { u8 pad24A[0x2]; s32 path_segment_index; f32 path_offset_and_spring_velocities[4]; - s16 unk260; + s16 beam_cooldown_timer; s16 unk262; s32 unk264; f32 unk268; @@ -252,7 +252,7 @@ void reset_listed_plasmabot_beam_cooldowns(int selected_moby_list_index) { ((*(unsigned short *)listed_moby_entry_cursor & 0x7FFF) << 8); PlasmabotVars *listed_moby_private_vars = (PlasmabotVars *)MOBY(moby)->pvars; if (MOBY(moby)->oclass == 0x1C) { - listed_moby_private_vars->unk260 = + listed_moby_private_vars->beam_cooldown_timer = scale_game_frames(plasmabot_beam_cooldown_frames); } } while (*listed_moby_entry_cursor++ >= 0); @@ -461,7 +461,7 @@ void plasmabot_update(char *moby) { plasmabot_update_private_vars->path_traversal_direction = 1.0f; plasmabot_update_private_vars->unk248 = 0; plasmabot_update_private_vars->heading_angular_velocity = 0; - plasmabot_update_private_vars->unk260 = 0; + plasmabot_update_private_vars->beam_cooldown_timer = 0; *(int *)&plasmabot_update_private_vars->unk268 = 0; plasmabot_update_private_vars->unk26C = 0; plasmabot_update_private_vars->unk280 = 0; @@ -635,7 +635,7 @@ void plasmabot_update(char *moby) { release_beam_slot_by_id(moby); break; } - if (fast_dec_timer_s16(&plasmabot_update_private_vars->unk260) == 0) + if (fast_dec_timer_s16(&plasmabot_update_private_vars->beam_cooldown_timer) == 0) break; if (count_listed_plasmabots_preparing_or_sweeping_beam(((unsigned char *)moby)[0x21]) >= 2) break; From c7214603cadc0f3354180f7badda2db3f00dd3a1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:18:30 +0000 Subject: [PATCH 463/758] decomp: clarify names in advance_blarg_elite_commando_base_position unk2D4 -> movement_step_length: Retail 0x002d3f18 passes pvars+0x2D4 to the scalar updater at 0x002d3f20; 0x002d3f38 loads that same float into f12 for normalization at 0x002d3f40. The source and original Ghidra show target minus base_position normalized in place using this scalar, then added to base_position at 0x002d3f48-0x002d3f54, proving it sets the applied movement step length. Return initialization sets the field to frame_time * 5.0f, while patrol/attack callers compare it with 2.0f * frame_time when near arrival. --- src/overlays/shared/enemies/blarg_elite_commando.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_elite_commando.c b/src/overlays/shared/enemies/blarg_elite_commando.c index 34390fbe94..743a8a307f 100644 --- a/src/overlays/shared/enemies/blarg_elite_commando.c +++ b/src/overlays/shared/enemies/blarg_elite_commando.c @@ -100,7 +100,7 @@ typedef struct L16DamageData { f32 unk2C8; f32 parent_heading_offset; char *unk2D0; - f32 unk2D4; + f32 movement_step_length; u8 unk2D8[0x4]; s16 unk2DC; u16 unk2DE; @@ -362,7 +362,7 @@ void blarg_elite_commando_update(char *commando_moby) { commando_data->unk302 = truncate_float_to_s32(scale_time(random_float_between(180.0f, 360.0f))); } - if (commando_data->unk2D4 < 2.0f * frame_time && path_distance < 0.5f) { + if (commando_data->movement_step_length < 2.0f * frame_time && path_distance < 0.5f) { if (((unsigned char *)commando_moby)[0x53] != 0) { ticks = 30; goto animate_idle; @@ -427,7 +427,7 @@ void blarg_elite_commando_update(char *commando_moby) { if (((unsigned char *)commando_moby)[0x53] != 2) blend_moby_animation(commando_moby, 2, 0, scale_game_frames(30)); } - if (distance < 0.5f && commando_data->unk2D4 < 2.0f * frame_time) { + if (distance < 0.5f && commando_data->movement_step_length < 2.0f * frame_time) { if (((unsigned char *)commando_moby)[0x53] != 2) { blend_moby_animation(commando_moby, 2, 0, scale_game_frames(30)); } @@ -699,7 +699,7 @@ void start_blarg_elite_commando_return_to_initial_position(struct Moby *moby, commando_data->unk2DC = return_countdown_ticks; commando_data->unk2BC = moby->pos.z; qcopy(&commando_data->unk2C0, &moby->pos); - commando_data->unk2D4 = frame_time * 5.0f; + commando_data->movement_step_length = frame_time * 5.0f; } } @@ -717,13 +717,13 @@ float advance_blarg_elite_commando_base_position(char *moby, float *target) { float movement_step[4]; zero[0] = 0; advance_accelerated_scalar((float *)zero, - (float *)(&commando_motion_data->unk2D4), + (float *)(&commando_motion_data->movement_step_length), distance, acceleration_braking_step, acceleration_braking_step, frame_time * 5.0f); fast_vec_sub(movement_step, target, base_position); - fast_vec_normalize(movement_step, movement_step, commando_motion_data->unk2D4); + fast_vec_normalize(movement_step, movement_step, commando_motion_data->movement_step_length); fast_vec_add(base_position, base_position, movement_step); return distance; } From a10592ddf8b42fa8537f4955c3b215320c231f00 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:18:33 +0000 Subject: [PATCH 464/758] decomp: clarify names in advance_armed_transport_along_path unk16C -> path_segment_fraction: Retail 0x002e2ec0 loads private-data +0x16c as float and adds it to integer path_point (+0x168) and speed/segment length at 0x002e2ec4-0x002e2ecc. After truncation, 0x002e2ee4 stores the integer path point and 0x002e2ee8-0x002e2eec stores progress minus that integer at +0x16c. Original Ghidra shows the same recurrence. C initializes and resets unk16C to zero when starting each path, proving retained fractional progress within the path segment. unk194 -> base_height: After path sampling, retail 0x002e2f28 loads transport_moby+0x18 (Moby pos.z), and 0x002e2f30 stores it to private-data+0x194; original Ghidra agrees. The authoritative C initializes unk194 from pos.z, refreshes it from sampled pos.z here, subtracts dt+dt from it in DYING, and finally sets pos.z = unk194 + armed_transport_bob_amplitude * fast_sin(unk18C). These uses establish the underlying height before the bob offset is added. --- src/overlays/shared/enemies/armed_transport.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/enemies/armed_transport.c b/src/overlays/shared/enemies/armed_transport.c index e56acd3be9..46c0d0a105 100644 --- a/src/overlays/shared/enemies/armed_transport.c +++ b/src/overlays/shared/enemies/armed_transport.c @@ -55,14 +55,14 @@ typedef struct ArmedTransportVars { s32 unk160; s32 unk164; s32 path_point; - s32 unk16C; + s32 path_segment_fraction; f32 path_and_pose_state[4]; u8 unk180[0x4]; s32 unk184; f32 unk188; f32 unk18C; s32 voice; - f32 unk194; + f32 base_height; } ArmedTransportVars; typedef union { @@ -191,10 +191,10 @@ void armed_transport_update(char *transport_moby) { if (transport_data->unkDC != -1) compute_armed_transport_path_headings(D_L16_001B0930[transport_data->unkDC]); speed = *(float *)&D_L16_00161D80 * frame_time; - transport_data->unk16C = 0; + transport_data->path_segment_fraction = 0; transport_data->path_point = 0; transport_data->path_and_pose_state[0] = speed; - transport_data->unk194 = MOBY(transport_moby)->pos.z; + transport_data->base_height = MOBY(transport_moby)->pos.z; if (transport_data->path_index == -1) { MOBY(transport_moby)->state = ARMED_TRANSPORT_STATE_TRACK_TARGET; break; @@ -309,7 +309,7 @@ void armed_transport_update(char *transport_moby) { if (fast_difference_between_rotations(MOBY(transport_moby)->rot.z, heading) < 0.01f) { MOBY(transport_moby)->state = ARMED_TRANSPORT_STATE_FOLLOW_SECOND_PATH; transport_data->path_point = 0; - transport_data->unk16C = 0; + transport_data->path_segment_fraction = 0; } break; } @@ -374,7 +374,7 @@ void armed_transport_update(char *transport_moby) { case ARMED_TRANSPORT_STATE_DYING: { float dt = frame_time; - transport_data->unk194 -= dt + dt; + transport_data->base_height -= dt + dt; MOBY(transport_moby)->rot.x += dt * 0.2617994f; if (fast_dec_timer((int *)(&transport_data->unk160)) || hero.vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK) { @@ -437,7 +437,7 @@ void armed_transport_update(char *transport_moby) { *(float *)&armed_transport_bob_phase_speed_degrees * DEG_TO_RAD * frame_time); MOBY(transport_moby)->pos.z = - transport_data->unk194 + + transport_data->base_height + *(float *)&armed_transport_bob_amplitude * fast_sin(transport_data->unk18C); update_armed_transport_joint_animation(transport_moby); } @@ -524,18 +524,18 @@ void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) { int advance_armed_transport_along_path(char *transport_moby, char *path) { ArmedTransportVars *transport_data = (ArmedTransportVars *)MOBY(transport_moby)->pvars; - float progress = (float)transport_data->path_point + *(float *)&transport_data->unk16C + + float progress = (float)transport_data->path_point + *(float *)&transport_data->path_segment_fraction + transport_data->path_and_pose_state[0] / transport_data->path_and_pose_state[1]; int index = truncate_float_to_s32(progress); float speed; float distance, rate; char *position; transport_data->path_point = index; - *(float *)&transport_data->unk16C = progress - (float)index; + *(float *)&transport_data->path_segment_fraction = progress - (float)index; if (index < *(int *)path - 1) { position = &MOBY(transport_moby)->pos; func_00215CA8_path42_q(progress, path, 0, position, transport_moby + 0x40, 0); - transport_data->unk194 = MOBY(transport_moby)->pos.z; + transport_data->base_height = MOBY(transport_moby)->pos.z; speed = 0.0f; distance = fast_vec_dist(position, path + (*(int *)path << 4)); rate = armed_transport_path_acceleration_coefficient_gp * *(float *)&frame_time_sq; From 0166aac9099f200056663c551c86dc464b623e92 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:18:37 +0000 Subject: [PATCH 465/758] decomp: clarify names in child_carrier_update unk84 -> carried_child_moby: In the authoritative child_carrier.c snapshot (SHA-256 3d72befe95792cb22153b2f524d2fbdbfc7918269101a33a882f01fda23fe168), ChildCarrierVars.unk84 receives new_child from create_moby(0x764). Original retail 0x002fa7d0-0x002fa7e8 tests pvars+0x84 for null and stores the creation return there. Retail 0x002fa83c reloads that pointer; 0x002fa848-0x002fa858 copies the carrier position (+0x10) and rotation (+0x40) to the pointed-to moby, and 0x002fa85c-0x002fa860 passes it to update_entity. These uses prove a stored carried child moby, beyond the field offset alone. --- src/overlays/l18/mobys/child_carrier.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l18/mobys/child_carrier.c b/src/overlays/l18/mobys/child_carrier.c index 9e20eb8bfe..c61e982f4b 100644 --- a/src/overlays/l18/mobys/child_carrier.c +++ b/src/overlays/l18/mobys/child_carrier.c @@ -22,7 +22,7 @@ typedef struct ChildCarrierVars { u8 unk70; u8 pad_71[0xF]; s32 unk80; - char *unk84; + char *carried_child_moby; } ChildCarrierVars; /* Moby class 1584 */ @@ -47,20 +47,20 @@ void child_carrier_update(char *moby) { break; } if (MOBY(moby)->command != 0 && transform_and_child_vars->unk80 != 0 && - *(int *)&transform_and_child_vars->unk84 == 0) { + *(int *)&transform_and_child_vars->carried_child_moby == 0) { char *new_child = create_moby(0x764); - transform_and_child_vars->unk84 = new_child; + transform_and_child_vars->carried_child_moby = new_child; if (new_child != 0) { *(unsigned short *)(new_child + 0x32) = ((unsigned short)MOBY(moby)->draw_dist); - (transform_and_child_vars->unk84)[0x31] = 1; - *(long *)(transform_and_child_vars->unk84 + 0x38) = ((long)MOBY(moby)->spawn_frame); - *(float *)(transform_and_child_vars->unk84 + 0x2C) *= + (transform_and_child_vars->carried_child_moby)[0x31] = 1; + *(long *)(transform_and_child_vars->carried_child_moby + 0x38) = ((long)MOBY(moby)->spawn_frame); + *(float *)(transform_and_child_vars->carried_child_moby + 0x2C) *= MOBY(moby)->scale / MOBY(moby)->pclass->scale; } } qcopy(transform_and_child_vars->unk60, moby + 0x10); qcopy(&transform_and_child_vars->unk70, moby + 0x40); - child = transform_and_child_vars->unk84; + child = transform_and_child_vars->carried_child_moby; if (child != 0) { qcopy(child + 0x10, moby + 0x10); qcopy(child + 0x40, moby + 0x40); From 91c48b49325a4f7fc1b6cc9ebf1956909faf2e14 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:20:38 +0000 Subject: [PATCH 466/758] decomp: clarify names in update_blarg_heavy_interceptor_light_ring_alpha unk160 -> beam_rotation_blink_and_aim_path_state: Retail 002aed64 loads Moby pvars, and 002aed68-002aed9c advances pvars+0x164 (unk160[1]) by 0.5, converts it to the fade step and resets it at >=1.0. Retail 002aedd0-002aee00 uses that step to cycle light-ring fade entries and replace color alpha. In the SHA-bound C, draw_blarg_heavy_interceptor_spinning_beam feeds unk160[0] to fast_cos/fast_sin and advances it with fast_add_rotations. update_blarg_heavy_interceptor_patrol_aim_point supplies unk160[2] as the path traversal amount and reverses its sign at a non-looping endpoint. initialize_blarg_heavy_interceptor_paths accumulates non-closing segment lengths of l14_paths[unk78] in unk160[3]; patrol/rejoin updates divide source_path_distance by that total to map progress onto the spawn path. Thus the entire f32[4] stores beam rotation, blink phase and aim-path state, not only blink phase. --- .../l14/mobys/blarg_heavy_interceptor.c | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 5c6b659fb8..80b3265c61 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -234,7 +234,7 @@ typedef struct BlargHeavyInterceptorVars { f32 unk130[4]; f32 unk140[4]; u8 pad_150[0x10]; - f32 unk160[4]; + f32 beam_rotation_blink_and_aim_path_state[4]; f32 unk170[4]; f32 unk180[4]; f32 unk190[4]; @@ -333,9 +333,9 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { moby_vars->unk21C = -1.0f; moby_vars->unk180[0] = moby_vars->unk180[1] = moby_vars->unk180[2] = 0.0f; moby_vars->unk190[1] = moby_vars->unk190[2] = moby_vars->unk190[3] = 0.0f; - moby_vars->unk160[0] = 0.0f; + moby_vars->beam_rotation_blink_and_aim_path_state[0] = 0.0f; moby_vars->flags = 0; - moby_vars->unk160[1] = 0.0f; + moby_vars->beam_rotation_blink_and_aim_path_state[1] = 0.0f; moby_vars->oscillation_state[0] = 0.0f; moby_vars->oscillation_state[1] = 0.0f; moby_vars->oscillation_state[2] = 0.0f; @@ -540,7 +540,7 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { } source_path_distance += moby_vars->unk1C0[3]; tab = ((int *)l14_paths[moby_vars->spawn_path]); - t = source_path_distance / moby_vars->unk160[3] * moby_vars->unk190[0]; + t = source_path_distance / moby_vars->beam_rotation_blink_and_aim_path_state[3] * moby_vars->unk190[0]; rejoin_path_loop_enabled = moby_vars->rejoin_path_loop; path_seg = 0; path_t = 0.0f; @@ -1236,10 +1236,10 @@ void draw_blarg_heavy_interceptor_spinning_beam(struct Moby *moby) { beam_placement_scratch[3][1] = beam_origin[1]; beam_placement_scratch[3][2] = beam_origin[2] + 0.125f; beam_placement_scratch[3][3] = 1.0f; - beam_placement_scratch[0][0] = fast_cos(d->unk160[0]); - beam_placement_scratch[0][1] = fast_sin(d->unk160[0]); + beam_placement_scratch[0][0] = fast_cos(d->beam_rotation_blink_and_aim_path_state[0]); + beam_placement_scratch[0][1] = fast_sin(d->beam_rotation_blink_and_aim_path_state[0]); beam_placement_scratch[0][2] = 0.0f; - d->unk160[0] = fast_add_rotations(d->unk160[0], -0.06981317f); + d->beam_rotation_blink_and_aim_path_state[0] = fast_add_rotations(d->beam_rotation_blink_and_aim_path_state[0], -0.06981317f); pk.b = tex_b(0xB); pk.c = 0x0000FF9000000260ULL; pk.d = 0x8000000048ULL; @@ -1480,13 +1480,13 @@ void initialize_blarg_heavy_interceptor_paths(struct Moby *moby) { int i; float segment_length; path = ((int *)l14_paths[moby_vars->unk78]); - *(int *)&moby_vars->unk160[3] = 0; + *(int *)&moby_vars->beam_rotation_blink_and_aim_path_state[3] = 0; for (i = 0; i < path[0]; i++) { segment_length = fast_vec_dist((char *)path + (i * 16 + 0x10), (char *)path + (((i + 1) % path[0]) * 16 + 0x10)); *(float *)((char *)path + (i << 4) + 0x1C) = segment_length; if (i != path[0] - 1) { - moby_vars->unk160[3] += segment_length; + moby_vars->beam_rotation_blink_and_aim_path_state[3] += segment_length; } } path = ((int *)l14_paths[moby_vars->spawn_path]); @@ -1513,7 +1513,7 @@ void initialize_blarg_heavy_interceptor_paths(struct Moby *moby) { &moby_vars->path_segment, &moby_vars->unk1C0[3], moby_vars->rejoin_path_loop, - moby_vars->unk210 * moby_vars->unk160[3]); + moby_vars->unk210 * moby_vars->beam_rotation_blink_and_aim_path_state[3]); moby_vars->unk8C = 0.0f; moby_vars->path_point = 0; FUN_L00_0025d808_2af688(sampling_path, @@ -1544,7 +1544,7 @@ void update_blarg_heavy_interceptor_patrol_aim_point(struct Moby *moby) { &interceptor_instance_vars->path_segment, &interceptor_instance_vars->unk1C0[3], interceptor_instance_vars->rejoin_path_loop, - interceptor_instance_vars->unk160[2]); + interceptor_instance_vars->beam_rotation_blink_and_aim_path_state[2]); FUN_L00_0025b8c0_c(interceptor_instance_vars->unk170, interceptor_instance_vars->unk180, path_target_position[0], @@ -1567,7 +1567,7 @@ void update_blarg_heavy_interceptor_patrol_aim_point(struct Moby *moby) { if (r != 0) { interceptor_instance_vars->unk1C0[3] = save; interceptor_instance_vars->path_segment = save2; - interceptor_instance_vars->unk160[2] = -interceptor_instance_vars->unk160[2]; + interceptor_instance_vars->beam_rotation_blink_and_aim_path_state[2] = -interceptor_instance_vars->beam_rotation_blink_and_aim_path_state[2]; } } } @@ -1590,7 +1590,7 @@ void update_blarg_heavy_interceptor_patrol_path_position(struct Moby *moby) { } source_path_distance += heavy_interceptor_vars->unk1C0[3]; tab = ((int *)l14_paths[heavy_interceptor_vars->spawn_path]); - destination_path_distance = source_path_distance / heavy_interceptor_vars->unk160[3] * + destination_path_distance = source_path_distance / heavy_interceptor_vars->beam_rotation_blink_and_aim_path_state[3] * heavy_interceptor_vars->unk190[0]; destination_path_loop_enabled = heavy_interceptor_vars->rejoin_path_loop; destination_segment_index = 0; @@ -1829,11 +1829,11 @@ void update_blarg_heavy_interceptor_light_ring_alpha(struct Moby *moby) { BlargHeavyInterceptorVars *moby_private_vars = (BlargHeavyInterceptorVars *)moby->pvars; s32 step; s32 i; - f32 advanced_blink_phase = moby_private_vars->unk160[1] + 0.5f; - moby_private_vars->unk160[1] = advanced_blink_phase; + f32 advanced_blink_phase = moby_private_vars->beam_rotation_blink_and_aim_path_state[1] + 0.5f; + moby_private_vars->beam_rotation_blink_and_aim_path_state[1] = advanced_blink_phase; step = truncate_float_to_s32(advanced_blink_phase); - if (1.0f <= moby_private_vars->unk160[1]) - *(s32 *)&moby_private_vars->unk160[1] = 0; + if (1.0f <= moby_private_vars->beam_rotation_blink_and_aim_path_state[1]) + *(s32 *)&moby_private_vars->beam_rotation_blink_and_aim_path_state[1] = 0; for (i = 0; i < blarg_heavy_interceptor_light_ring_vertex_count_gp; i++) { s32 light_fade_value = blarg_heavy_interceptor_light_ring_fade_values[i]; if (light_fade_value != 0) { From 2b325c3dc2d393608702a94939e0a184974f22ea Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:20:41 +0000 Subject: [PATCH 467/758] decomp: clarify names in alert_visible_group_sentrybots unk15B -> alert_engagement_suppressed: In assigned retail 0x0029a1d0-1d8, the raised-position collision-line result must be zero; 0x0029a1ec-1f4 then loads the qualifying class-0x2C recipient's pvars (+0x78), 0x0029a1f8 clears byte +0x15B, and 0x0029a200 refreshes alert_timer (+0x156) before attention propagation. Original Ghidra confirms these stores. In the SHA-256-bound supplied C, update_sentrybot_hit_response_and_target_visibility sets this u8 when has_line_of_sight is zero or the path-target query fails, and clears it for permitted visible target modes. sentrybot_update requires this field == 0 for alert_timer-driven patrol engagement, fast-patrol emission initiation, return-home target turns, and alert-idle emission turns. Thus nonzero suppresses those alert engagement transitions, while group notification clears that suppression. --- src/overlays/shared/enemies/sentrybot.c | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index ddcc79da98..4146dd9818 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -120,7 +120,7 @@ typedef struct SentrybotVars { s16 alert_timer; /* 0x156: set by alert_visible_group_sentrybots */ s16 unk158; u8 has_line_of_sight; /* 0x15A: to the hero */ - u8 unk15B; + u8 alert_engagement_suppressed; u8 unk15C; u8 unk15D; u8 unk15E; @@ -406,7 +406,7 @@ void sentrybot_update(unsigned char *moby) { blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } } else if (sentrybot_instance_data->alert_timer != 0 && - sentrybot_instance_data->unk15B == 0) { + sentrybot_instance_data->alert_engagement_suppressed == 0) { if (sentrybot_instance_data->has_line_of_sight != 0 || sentrybot_instance_data->unk124 == -1) { begin_sentrybot_turn_toward_point((char *)moby, @@ -627,7 +627,7 @@ void sentrybot_update(unsigned char *moby) { blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } } else if (sentrybot_instance_data->alert_timer != 0 && - sentrybot_instance_data->unk15B == 0) { + sentrybot_instance_data->alert_engagement_suppressed == 0) { if (sentrybot_instance_data->has_line_of_sight != 0) { begin_sentrybot_turn_toward_point((char *)moby, sentrybot_instance_data, @@ -691,7 +691,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk144 = 1; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); - } else if (sentrybot_instance_data->unk114 != 2 && sentrybot_instance_data->unk15B == 0) { + } else if (sentrybot_instance_data->unk114 != 2 && sentrybot_instance_data->alert_engagement_suppressed == 0) { MOBY(moby)->command = 1; if (sentrybot_instance_data->unk15F != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; @@ -765,7 +765,7 @@ void sentrybot_update(unsigned char *moby) { fast_arc_tan(sentrybot_instance_data->unkD0[0] - MOBY(moby)->pos.x, sentrybot_instance_data->unkD0[1] - MOBY(moby)->pos.y)) > 0.7853982f && - sentrybot_instance_data->unk15B == 0) { + sentrybot_instance_data->alert_engagement_suppressed == 0) { begin_sentrybot_turn_toward_point((char *)moby, sentrybot_instance_data, (float *)(&sentrybot_instance_data->unkD0), @@ -1040,7 +1040,7 @@ void sentrybot_update(unsigned char *moby) { } else { int mode = sentrybot_instance_data->unk114; if (mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && - sentrybot_instance_data->unk15B == 0) { + sentrybot_instance_data->alert_engagement_suppressed == 0) { begin_sentrybot_turn_toward_point((char *)moby, sentrybot_instance_data, (float *)(&sentrybot_instance_data->unkD0), @@ -1059,7 +1059,7 @@ void sentrybot_update(unsigned char *moby) { } } else if (sentrybot_instance_data->has_line_of_sight != 0) { if (mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && - sentrybot_instance_data->unk15B == 0) { + sentrybot_instance_data->alert_engagement_suppressed == 0) { begin_sentrybot_turn_toward_point((char *)moby, sentrybot_instance_data, (float *)(target + 0x10), @@ -1461,7 +1461,7 @@ void alert_visible_group_sentrybots(void *mp) { *(SentrybotVars **)((char *)(listed_moby_byte_offset + (int)l15_moby_array) + 0x78); moby_data->alert_timer = scale_game_frames(300); - moby_data->unk15B = 0; + moby_data->alert_engagement_suppressed = 0; set_sentrybot_attention_target( (char *)source_moby, (char *)((int)l15_moby_array + listed_moby_byte_offset)); } @@ -1737,31 +1737,31 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i seen = sentrybot_data->has_line_of_sight; } if (sentrybot_data->unk114 == 1) - sentrybot_data->unk15E = sentrybot_data->unk15B + 1; + sentrybot_data->unk15E = sentrybot_data->alert_engagement_suppressed + 1; else if ((unsigned char)D_001413F4[0] != 3) sentrybot_data->unk15E = 0; else if (sentrybot_data->unk15E >= 2) - sentrybot_data->unk15B = 1; + sentrybot_data->alert_engagement_suppressed = 1; sentrybot_data->unk19F = 1; if (seen == 0) { if (sentrybot_data->has_line_of_sight == 0) - sentrybot_data->unk15B = 1; + sentrybot_data->alert_engagement_suppressed = 1; sentrybot_data->unk19F = 0; sentrybot_data->unk114 = 2; sentrybot_data->unk158 = 0; - } else if (((sentrybot_data->alert_timer == 0 || sentrybot_data->unk15B != 0) && + } else if (((sentrybot_data->alert_timer == 0 || sentrybot_data->alert_engagement_suppressed != 0) && (unsigned char)D_001413F4[0] == 3) || (sentrybot_data->unk15E != 0 && sentrybot_data->unk114 != 1)) { sentrybot_data->unk114 = 2; sentrybot_data->unk158 = 1; } else if ((unsigned char)D_001413F4[0] != 3 && sentrybot_data->unk114 != 2) { - sentrybot_data->unk15B = 0; + sentrybot_data->alert_engagement_suppressed = 0; } if (D_L15_0015F5C4 == 2) sentrybot_data->unk114 = 2; } else { sentrybot_data->unk19F = 0; - sentrybot_data->unk15B = 1; + sentrybot_data->alert_engagement_suppressed = 1; sentrybot_data->unk158 = 0; } if (*(int *)&sentrybot_data->target == 0) From 0a3b7d6a42288bb80790d29b8c0ab419045b7b4e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:20:45 +0000 Subject: [PATCH 468/758] decomp: clarify names in update_scoutbot_health_and_target unk170 -> tracked_target_position: Retail 0x002d37c8 forms pvars+0x170 and 0x002d37d8 passes it as the target helper's position argument; 0x002d3800-0x002d3824 compare its XY distance and Z against home at +0x1c0. In authoritative C the matching Data_3DF8 storage is target_pos, copied by scoutbot_update immediately after this function and used to turn toward and approach the target. Thus this four-float field is the tracked target position. unk1B4 -> target_selection_status: Retail 0x002d37f8 tests the target helper return against 2; when the refreshed target position exceeds home distance 14 or height difference 3, 0x002d3814 and 0x002d3844 store 2 into pvars+0x1b4. The authoritative scoutbot_update views the same storage as f1B4 and leaves idle to approach the target when it is not 2, otherwise choosing a wander goal. This proves a target selection status, without claiming all code meanings. unk21C -> target_path_index: Retail 0x002d37b4 loads pvars+0x21c, 0x002d37c4 scales it by four, and 0x002d37cc-0x002d37d4 indexes table 0x001b0cb0. The selected record's first word and points at +0x10 are passed to the target selection helper at 0x002d37f0. Authoritative C identifies that table as l08_paths and indexes it with this field; scoutbot_update also rejects the matching f21C value -1 at initialization. This is the path index used for target selection. --- src/overlays/shared/enemies/scoutbot.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index 685f83572f..d3c2920be2 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -40,10 +40,10 @@ typedef struct ScoutbotVars { u8 pad50[0x78]; s16 unkC8; u8 padCA[0xa6]; - f32 unk170[4]; + f32 tracked_target_position[4]; u8 pad180[0x30]; s32 unk1B0; - s32 unk1B4; + s32 target_selection_status; u8 pad1B8[0x8]; f32 unk1C0[4]; f32 unk1D0[4]; @@ -56,7 +56,7 @@ typedef struct ScoutbotVars { u8 pad210[0x6]; s16 unk216; char *unk218; - s32 unk21C; + s32 target_path_index; u8 unk220[0x4]; } ScoutbotVars; @@ -437,14 +437,14 @@ void update_scoutbot_health_and_target(struct Moby *moby) { } ((unsigned char *)moby)[0xA4] = 0xFF; if (((unsigned char *)moby)[0x20] != 0 && ((unsigned char *)moby)[0x20] != 4) { - char *path = ((char *)l08_paths[scoutbot_pvars->unk21C]); + char *path = ((char *)l08_paths[scoutbot_pvars->target_path_index]); if (func_L00_00260FB0_f( - moby, &scoutbot_pvars->unk170, 14.0f, 0, 0, path + 0x10, *(int *)path) != 2) { - if (14.0f < vector_distance_xy(&scoutbot_pvars->unk1C0, &scoutbot_pvars->unk170)) { - scoutbot_pvars->unk1B4 = 2; + moby, &scoutbot_pvars->tracked_target_position, 14.0f, 0, 0, path + 0x10, *(int *)path) != 2) { + if (14.0f < vector_distance_xy(&scoutbot_pvars->unk1C0, &scoutbot_pvars->tracked_target_position)) { + scoutbot_pvars->target_selection_status = 2; } else if (3.0f < - absolute_float(scoutbot_pvars->unk1C0[2] - scoutbot_pvars->unk170[2])) { - scoutbot_pvars->unk1B4 = 2; + absolute_float(scoutbot_pvars->unk1C0[2] - scoutbot_pvars->tracked_target_position[2])) { + scoutbot_pvars->target_selection_status = 2; } } } From 3b3b2c9ce6ae5a1f572768d8bdfc3df4ce544817 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:20:48 +0000 Subject: [PATCH 469/758] decomp: clarify names in move_chomper_toward_position unk204 -> travel_distance_velocity: Retail 0x002e64e8 and 0x002e6500 pass the zero-initialized travel-distance value at sp+0x10 and persistent ChomperVars+0x204 respectively to 0x00257268. Checked helper instructions 0x00257274/0x0025727c retain these as s1/s0; 0x002572ac-0x002572b4 computes target distance minus value, while 0x002573c0-0x002573d0 and 0x002573ec-0x002573f8 add the s0 scalar into the s1 value. This proves the field is the travel-distance interpolation velocity. Retail 0x002e6524-0x002e6530 then uses this field as fast_vec_normalize magnitude for movement_delta, agreeing with the supplied C. unk208 -> previous_height_drop: Retail 0x002e64a0 saves moby position Z (+0x18) in f21 before movement; 0x002e6590 loads final Z, 0x002e659c subtracts final Z from saved Z, and 0x002e65ac stores that signed height drop into ChomperVars+0x208. On the next invocation 0x002e654c-0x002e6570 loads this field, subtracts frame_time_sq*10, and supplies it as movement_delta[2]. The authoritative C explicitly stores oldz - MOBY(moby)->pos.z, proving previous_height_drop without assuming a conventional vertical velocity sign. --- src/overlays/l16/mobys/chomper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l16/mobys/chomper.c b/src/overlays/l16/mobys/chomper.c index 4b560bc9f1..ce78df8a61 100644 --- a/src/overlays/l16/mobys/chomper.c +++ b/src/overlays/l16/mobys/chomper.c @@ -92,8 +92,8 @@ typedef struct ChomperVars { u8 pad_1E0[0x10]; f32 unk1F0[4]; u8 pad_200[0x4]; - f32 unk204; - f32 unk208; + f32 travel_distance_velocity; + f32 previous_height_drop; u8 pad_20C[0x14]; u8 unk220; } ChomperVars; @@ -354,12 +354,12 @@ float move_chomper_toward_position(void *m_v, void *t_v) { frame_time_sq * 8.0f, frame_time_sq * 12.0f, frame_time * 4.0f, - &moby_data->unk204); - fast_vec_normalize(movement_delta, moby + 0xC0, moby_data->unk204); - movement_delta[2] = moby_data->unk208 - frame_time_sq * 10.0f; + &moby_data->travel_distance_velocity); + fast_vec_normalize(movement_delta, moby + 0xC0, moby_data->travel_distance_velocity); + movement_delta[2] = moby_data->previous_height_drop - frame_time_sq * 10.0f; FUN_L00_00258830(moby, movement_delta, 0.5f, 0.5f, 0.0f, 0x10); resolve_point_path_segment_xy_clearance( 0.333f, *(void **)&moby_data->unk1F0[0], moby + 0x10, moby + 0x10); - moby_data->unk208 = oldz - MOBY(moby)->pos.z; + moby_data->previous_height_drop = oldz - MOBY(moby)->pos.z; return distance_to_target; } From 0954c68e14cb7febc582442e3e7efd09459c0908 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:22:46 +0000 Subject: [PATCH 470/758] decomp: clarify names in try_start_kerwan_path_enemy_heading_turn unk263 -> heading_turn_cooldown_frames: Retail 0x002c6ebc-0x002c6ecc loads pvars+0x263 and requires zero for the >= pi/4 turn-entry path; 0x002c6ed4-0x002c6ef4 permits the > pi/2 override. Original Ghidra confirms this byte gate. In the supplied authoritative update source, the same pvars byte b263 is initialized to zero, passed by address to the per-update helper, and set to scale_game_frames(0x3C) in both ENEMY_TURN_TO_HEADING completion branches. These uses establish a frame-scaled cooldown on moderate heading turns. unk264 -> turn_gate_moby_index: Retail 0x002c6e4c reads pvars+0x264, checks -1 at 0x002c6e50-0x002c6e54, shifts the index eight bits and adds the moby array base at 0x002c6e58-0x002c6e64. The selected moby's class at +0xA6 is tested for 0x336, then its +0xBC byte must equal 4 or turn entry returns zero (0x002c6e68-0x002c6e80). Original Ghidra and current linked_moby_index/linked_moby source data flow agree: this is the optional moby index controlling the heading-turn gate, without proving its gameplay relationship. unk28C -> turn_destination_heading: Retail preserves desired_heading from f12 in f21 at 0x002c6e34 and stores f21 to pvars+0x28C at 0x002c6f90 immediately before entering state 12 at 0x002c6fa0; original Ghidra likewise stores param_1 there. Authoritative C assigns enemy_pvars->unk28C = desired_heading. The supplied ENEMY_TURN_TO_HEADING update consumes the corresponding f28C as the yaw destination in both rotation-approach calls and tests convergence against m->rot[2], proving this field is the saved turn destination heading. --- src/overlays/l03/mobys/kerwan_path_enemy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l03/mobys/kerwan_path_enemy.c b/src/overlays/l03/mobys/kerwan_path_enemy.c index db5fab1a7b..0d0eb279fc 100644 --- a/src/overlays/l03/mobys/kerwan_path_enemy.c +++ b/src/overlays/l03/mobys/kerwan_path_enemy.c @@ -51,10 +51,10 @@ int try_start_kerwan_path_enemy_heading_turn(float desired_heading, typedef struct KerwanPathEnemyVars { u8 pad_0[0x263]; - u8 unk263; - s32 unk264; + u8 heading_turn_cooldown_frames; + s32 turn_gate_moby_index; u8 pad_268[0x24]; - f32 unk28C; + f32 turn_destination_heading; } KerwanPathEnemyVars; int try_start_kerwan_path_enemy_heading_turn(float desired_heading, @@ -66,7 +66,7 @@ int try_start_kerwan_path_enemy_heading_turn(float desired_heading, float heading_delta; unsigned char previous_state; if (*(int *)&target->rot != 0) { - linked_moby_index = enemy_pvars->unk264; + linked_moby_index = enemy_pvars->turn_gate_moby_index; if (linked_moby_index != -1) { char *linked_moby = (char *)(linked_moby_index << 8) + (int)*(char **)&D_L03_0015FFD8_u; if (MOBY(linked_moby)->oclass == 0x336) { @@ -75,7 +75,7 @@ int try_start_kerwan_path_enemy_heading_turn(float desired_heading, } } heading_delta = fast_subtract_rotations(desired_heading, moby->rot.z); - if (absolute_float(heading_delta) >= 0.7853982f && enemy_pvars->unk263 == 0 && + if (absolute_float(heading_delta) >= 0.7853982f && enemy_pvars->heading_turn_cooldown_frames == 0 && moby->prev_seq != 1) { goto go; } @@ -88,7 +88,7 @@ int try_start_kerwan_path_enemy_heading_turn(float desired_heading, } else { blend_moby_animation(moby, 9, 0, scale_game_frames(10)); } - enemy_pvars->unk28C = desired_heading; + enemy_pvars->turn_destination_heading = desired_heading; previous_state = moby->state; moby->state = ENEMY_TURN_TO_HEADING; moby->command = previous_state; From 8ed4cda2f57af2daaefb783cb694559fdcd0be81 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:24:52 +0000 Subject: [PATCH 471/758] decomp: clarify names in resolve_follow_camera_endpoint_collisions i114 -> sphere_collision_excluded_moby: G002e7318.i114 is the actual source member at camera-view +0xc4 (DAT_00166ed4), loaded into a2 at retail 0x002e747c and passed to sphere helper 0x001f0d60 at 0x002e7490. Bounded checked level-00 helper saves a2 in s2 at 0x001f0db4. Its spatial-cell loop constructs a moby address t8 from an index times 0x100 plus object-pool base at 0x001f1460-0x001f1474, and skips that candidate on equality with s2 at 0x001f1480, before collision-data access +0x94 at 0x001f1490. Thus the member selects the moby excluded from sphere collision testing; no particular moby identity is inferred. p70 -> follow_camera_rig_state: O002e7318.p70 is loaded from camera_moby at retail 0x002e7374; its +0x90 vector is added to its +0x130 orbit at 0x002e7390-0x002e7398. The same pointer supplies target +0x40 and collision +0x1d0 blocks at 0x002e7380-0x002e7388. The active camera's identical member load at 0x002e73bc supplies probe settings. Source reset/setup and established orbit updater confirm these are camera rig state blocks, not a generic object payload. s38 -> endpoint_collision_direction_class: X002e7318.s38 is initialized to sentinel 2 at 0x002e73a8, then after each endpoint collision the retail subtracts D_L00_00173E60 minus candidate at 0x002e73ec-0x002e73f8 and normalizes it. Dot product against camera tracking vector 0x00166e40 at 0x002e7410-0x002e7418 classifies it as 1 above +0.75, -1 below -0.75, otherwise 0 at 0x002e741c-0x002e744c. Zero stops further classification; unused sentinel becomes zero at 0x002e74cc-0x002e74d8. This proves a direction class for endpoint collision response, without assuming physical axis labels. --- .../shared/camera/follow_camera_setup.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 2f6a77ca83..39e7b700b5 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -978,7 +978,7 @@ typedef struct X002e7318 { u8 pad[0x20]; V002e7318 m; u8 pad30[8]; - s16 s38; + s16 endpoint_collision_direction_class; u8 pad3a[0xe]; s32 i48; } X002e7318; @@ -992,14 +992,14 @@ typedef struct P002e7318 { typedef struct O002e7318 { u8 pad[0x70]; - u8 *p70; + u8 *follow_camera_rig_state; } O002e7318; typedef struct G002e7318 { u8 pad[0x30]; V002e7318 v40; u8 pad50[0x84]; - s32 i114; + s32 sphere_collision_excluded_moby; } G002e7318; extern G002e7318 D_L00_00166E10_c __asm__("D_L00_00166E10"); @@ -1012,7 +1012,7 @@ s32 resolve_follow_camera_endpoint_collisions(O002e7318 *camera_moby) __asm__("F s32 resolve_follow_camera_endpoint_collisions(O002e7318 *camera_moby) { V002e7318 candidate_camera_position; V002e7318 normalized_position_delta; - u8 *b = camera_moby->p70; + u8 *b = camera_moby->follow_camera_rig_state; X002e7318 *x = (X002e7318 *)(b + 0x1D0); u8 *camera_target_state = b + 0x40; u8 *camera_orbit_state = b + 0x130; @@ -1027,8 +1027,8 @@ s32 resolve_follow_camera_endpoint_collisions(O002e7318 *camera_moby) { G002e7318 *g = &D_L00_00166E10_c; fast_vec_add(&candidate_camera_position, b + 0x90, camera_orbit_state); - x->s38 = 2; - active_camera_state = (P002e7318 *)((O002e7318 **)g)[-4]->p70; + x->endpoint_collision_direction_class = 2; + active_camera_state = (P002e7318 *)((O002e7318 **)g)[-4]->follow_camera_rig_state; sphere_collision_flags = x->i48; collision_probe_radius = follow_cam_min_distance_gp + active_camera_state->c * active_camera_state->a * @@ -1042,30 +1042,30 @@ s32 resolve_follow_camera_endpoint_collisions(O002e7318 *camera_moby) { if (!coll_sphere(&candidate_camera_position, collision_probe_radius, sphere_collision_flags, - g->i114)) + g->sphere_collision_excluded_moby)) break; hb = 1; } - if (x->s38 != 0) { + if (x->endpoint_collision_direction_class != 0) { fast_vec_sub(&normalized_position_delta, &(*(V002e7318 *)&D_L00_00173E60), &candidate_camera_position); fast_vec_normalize(&normalized_position_delta, &normalized_position_delta, 1.0f); direction_alignment = fast_vec_dot(&g->v40, &normalized_position_delta); if (direction_alignment > 0.75f) - x->s38 = 1; + x->endpoint_collision_direction_class = 1; else if (direction_alignment < -0.75f) - x->s38 = -1; + x->endpoint_collision_direction_class = -1; else - x->s38 = 0; + x->endpoint_collision_direction_class = 0; } qcopy(&candidate_camera_position, &coll_hit_position); i++; } r = update_follow_camera_orbit_after_collision(camera_moby, &candidate_camera_position, ha, hb); fast_vec_add(&x->m, camera_target_state + 0x50, camera_orbit_state); - if (x->s38 == 2) - x->s38 = 0; + if (x->endpoint_collision_direction_class == 2) + x->endpoint_collision_direction_class = 0; return r; } From 3effc84caf84391dc3785920f8cd3b9f38ff966d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:24:55 +0000 Subject: [PATCH 472/758] decomp: clarify names in update_drain_cover_tilt unk90 -> tilt_x_velocity: Retail 0x0030f448 loads s0 from moby+0x78 (pvars). At 0x0030f534 a0 is moby+0x40 (rot.x), and 0x0030f53c makes a1=pvars+0x90 before the approach_angle call at 0x0030f548. Authoritative C passes &MOBY(moby)->rot.x, target0, &drain_cover_vars->unk90 with tilt acceleration, deceleration and maximum speed. Original retail decompilation identifies data+0x90/+0x94 as velocities, paired respectively with rotations+0x40/+0x44; this proves unk90 stores X-axis tilt velocity rather than an angle or target. --- 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 1aa67638c1..96f78b6662 100644 --- a/src/overlays/l05/mobys/drain_cover.c +++ b/src/overlays/l05/mobys/drain_cover.c @@ -469,7 +469,7 @@ extern float fast_add_rotations(float, float); typedef struct DrainCoverVars { u8 pad_0[0x90]; - f32 unk90; + f32 tilt_x_velocity; f32 unk94; f32 unk98; f32 unk9C; @@ -514,7 +514,7 @@ void update_drain_cover_tilt(char *moby, float turn_scale, float speed_scale) { rate0 = drain_cover_tilt_acceleration_gp * speed_scale * 0.017453292f * frame_time_sq; rate1 = drain_cover_tilt_deceleration_gp * speed_scale * 0.017453292f * frame_time_sq; limit = drain_cover_tilt_max_speed_gp * 0.017453292f * frame_time; - approach_angle(&MOBY(moby)->rot.x, target0, &drain_cover_vars->unk90, rate0, rate1, limit); + approach_angle(&MOBY(moby)->rot.x, target0, &drain_cover_vars->tilt_x_velocity, rate0, rate1, limit); approach_angle(&MOBY(moby)->rot.y, target1, &drain_cover_vars->unk94, From 1775af1e4979466ed3a9df081f865d91516497b7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:26:51 +0000 Subject: [PATCH 473/758] decomp: clarify names in draw_and_probe_snagglebeast_rope_attack unk110 -> rope_start_position: Retail 0x003131f4 forms s1=pvars+0x110. At 0x00313214 and 0x00313234, vector additions use s1 as the common starting position for offsets of length unk16C*0.8 and unk16C, producing +0x140 and +0x120. At 0x003132b4 it is subtracted from +0x120 to obtain rope_direction; at 0x00313300 it is the first collision_line endpoint. The supplied C initializes it to the midpoint of moby points 0 and 1 in SNAGGLEBEAST_ROPE_WAIT_FOR_ORIGIN_FRAME and advances it toward +0x120 during retraction. Thus rope_start_position describes its positional role; it is not claimed to remain fixed across states. unk16C -> rope_extension_length: Retail 0x003131dc loads the float at pvars+0x16C; 0x00313204/0x00313208 normalize the +0x130 direction to that value times 0.8, then 0x00313214 adds the offset to +0x110. Retail 0x0031321c reloads the same float and 0x00313224 normalizes the offset to that full length before 0x00313234 constructs the +0x120 endpoint. The supplied C resets it to zero before SNAGGLEBEAST_ROPE_EXTEND, increments it by frame_scale, and compares it to target distance. It therefore represents rope extension length, also reused as capture reach in the capture state. --- src/overlays/l07/mobys/snagglebeast.c | 62 +++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index 580f08f685..ba946908d3 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -96,7 +96,7 @@ typedef struct SnagglebeastVars { f32 turn_target[4]; u8 pad_D0[0x30]; f32 unk100[4]; - f32 unk110[4]; + f32 rope_start_position[4]; f32 unk120[4]; f32 unk130[4]; f32 unk140[4]; @@ -104,7 +104,7 @@ typedef struct SnagglebeastVars { s32 timer; s32 unk164; s32 turn_controller_state; - f32 unk16C; + f32 rope_extension_length; s32 navigation_ids[6]; s32 nav_path; s32 measured_path; @@ -330,7 +330,7 @@ void draw_snagglebeast_rope_attack_layer( quad.texture_coordinates[2][1] = half; quad.texture_coordinates[3][1] = half; } - qcopy(&quad.positions[1], rope_layer_moby_vars->unk110); + qcopy(&quad.positions[1], rope_layer_moby_vars->rope_start_position); qcopy(&quad.positions[3], rope_layer_moby_vars->unk140); inner = quad; qcopy(&inner.positions[0], rope_layer_moby_vars->unk120); @@ -381,18 +381,18 @@ void draw_and_probe_snagglebeast_rope_attack(char *moby) { qzero(&rope_offset); one = 1.0f; fast_vec_normalize( - &rope_offset, rope_attack_moby_vars->unk130, rope_attack_moby_vars->unk16C * 0.8f); - fast_vec_add(rope_attack_moby_vars->unk140, &rope_offset, rope_attack_moby_vars->unk110); - fast_vec_normalize(&rope_offset, &rope_offset, rope_attack_moby_vars->unk16C); - fast_vec_add(rope_attack_moby_vars->unk120, &rope_offset, rope_attack_moby_vars->unk110); + &rope_offset, rope_attack_moby_vars->unk130, rope_attack_moby_vars->rope_extension_length * 0.8f); + fast_vec_add(rope_attack_moby_vars->unk140, &rope_offset, rope_attack_moby_vars->rope_start_position); + fast_vec_normalize(&rope_offset, &rope_offset, rope_attack_moby_vars->rope_extension_length); + fast_vec_add(rope_attack_moby_vars->unk120, &rope_offset, rope_attack_moby_vars->rope_start_position); draw_snagglebeast_rope_attack_layer(moby, one, 0, one, 0x20000080); draw_snagglebeast_rope_attack_layer(moby, 0.7f, 10, 2.0f, 0x28008080); draw_snagglebeast_rope_attack_layer(moby, 0.4f, 20, 3.0f, 0x30B0FFFF); - fast_vec_sub(rope_direction, rope_attack_moby_vars->unk120, rope_attack_moby_vars->unk110); + fast_vec_sub(rope_direction, rope_attack_moby_vars->unk120, rope_attack_moby_vars->rope_start_position); fast_vec_normalize(rope_direction, rope_direction, one); make_hit_descriptor(blk, moby, 0x30000, 1.00012302f, rope_direction); if (collision_line( - rope_attack_moby_vars->unk110, rope_attack_moby_vars->unk120, 0, moby, blk) == 0) { + rope_attack_moby_vars->rope_start_position, rope_attack_moby_vars->unk120, 0, moby, blk) == 0) { collect_mobies_in_sphere(0.5f, rope_attack_moby_vars->unk120, 0, moby, blk); } } @@ -1286,7 +1286,7 @@ void snagglebeast_update(unsigned char *moby) { FUN_00212f90(moby, 6, r, random_int_between(0xF, 0x19)); } snagglebeast_instance_state->unk164 = 0; - snagglebeast_instance_state->unk16C = 0.0f; + snagglebeast_instance_state->rope_extension_length = 0.0f; snagglebeast_instance_state->unk1C4 = 0; MOBY(moby)->state = SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO; snagglebeast_instance_state->unk294 = 0; @@ -1462,7 +1462,7 @@ void snagglebeast_update(unsigned char *moby) { fast_vec_sub(&velocity, &offset, &velocity); fast_vec_add(&start, &start, &velocity); fast_vec_add(&direction, &direction, &velocity); - qcopy(snagglebeast_instance_state->unk110, &start); + qcopy(snagglebeast_instance_state->rope_start_position, &start); qcopy(snagglebeast_instance_state->unk120, &direction); qcopy(snagglebeast_instance_state->unk140, &start); fast_vec_sub(snagglebeast_instance_state->unk130, &direction, &start); @@ -1635,7 +1635,7 @@ void snagglebeast_update(unsigned char *moby) { FUN_00212f90(moby, 6, r, random_int_between(0x14, 0x19)); } snagglebeast_instance_state->unk164 = 0; - snagglebeast_instance_state->unk16C = 0.0f; + snagglebeast_instance_state->rope_extension_length = 0.0f; snagglebeast_instance_state->unk1C4 = 0; snagglebeast_instance_state->unk294 = 0; MOBY(moby)->state = SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO; @@ -1961,10 +1961,10 @@ void snagglebeast_update(unsigned char *moby) { break; qcopy(snagglebeast_instance_state->unk140, ((char *)&hero) + 0x80); snagglebeast_instance_state->unk140[2] += 0.6f; - if (snagglebeast_instance_state->unk16C < hero_distance) { + if (snagglebeast_instance_state->rope_extension_length < hero_distance) { float step_time = frame_time * 15.0f; snagglebeast_instance_state->timer = 0; - snagglebeast_instance_state->unk16C += step_time; + snagglebeast_instance_state->rope_extension_length += step_time; } else { if (snagglebeast_instance_state->unk1C4 != 0 || (fast_dec_timer(&snagglebeast_instance_state->timer) && fr < 0.6f)) { @@ -1972,7 +1972,7 @@ void snagglebeast_update(unsigned char *moby) { char *g = ((char *)&hero); snagglebeast_instance_state->unk1C4 = 1; if (*(int *)(g + 0x2084) != 0x78) { - qcopy(snagglebeast_instance_state->unk110, ((char *)&hero) + 0x80); + qcopy(snagglebeast_instance_state->rope_start_position, ((char *)&hero) + 0x80); qcopy(snagglebeast_instance_state->unk120, ((char *)&hero) + 0x80); if (MOBY(moby)->pos.z < *(float *)(g + 0x88)) { snagglebeast_instance_state->unk120[2] = *(float *)(g + 0x88) + 2.0f; @@ -1986,13 +1986,13 @@ void snagglebeast_update(unsigned char *moby) { } fast_vec_sub(&velocity, snagglebeast_instance_state->unk120, - snagglebeast_instance_state->unk110); + snagglebeast_instance_state->rope_start_position); fast_vec_scale(&velocity, &velocity, frame_scale * 0.1f); - fast_vec_add(snagglebeast_instance_state->unk110, - snagglebeast_instance_state->unk110, + fast_vec_add(snagglebeast_instance_state->rope_start_position, + snagglebeast_instance_state->rope_start_position, &velocity); - qcopy(((char *)&hero) + 0x1D30, snagglebeast_instance_state->unk110); - qcopy(((char *)&hero) + 0x80, snagglebeast_instance_state->unk110); + qcopy(((char *)&hero) + 0x1D30, snagglebeast_instance_state->rope_start_position); + qcopy(((char *)&hero) + 0x80, snagglebeast_instance_state->rope_start_position); { char *captured_hero = ((char *)&hero); *(float *)(captured_hero + 0x1D48) = fast_add_rotations( @@ -2000,7 +2000,7 @@ void snagglebeast_update(unsigned char *moby) { *(float *)(captured_hero + 0x98) = fast_add_rotations( *(float *)(captured_hero + 0x1D48), frame_time * 25.132742f); } - snagglebeast_instance_state->unk16C = hero_distance; + snagglebeast_instance_state->rope_extension_length = hero_distance; slot = snagglebeast_ammo_drain_entries[snagglebeast_instance_state->unk164][0]; if (slot == -1) { snagglebeast_instance_state->unk164 = 0; @@ -2177,10 +2177,10 @@ void snagglebeast_update(unsigned char *moby) { FUN_L00_0024f7c8(moby, 1, &direction); fast_vec_add(&position, &velocity, &direction); fast_vec_scale(&position, &position, 0.5f); - qcopy(snagglebeast_instance_state->unk110, &position); + qcopy(snagglebeast_instance_state->rope_start_position, &position); fast_vec_sub(snagglebeast_instance_state->unk130, snagglebeast_instance_state->unk150, - snagglebeast_instance_state->unk110); + snagglebeast_instance_state->rope_start_position); fast_vec_normalize(snagglebeast_instance_state->unk130, snagglebeast_instance_state->unk130, frame_scale); @@ -2198,15 +2198,15 @@ void snagglebeast_update(unsigned char *moby) { spawn_moby_point_offset_particle((char *)moby, 1, 800000.0f, 5.0f); } if (compute_interpolated_record_value(moby) >= 31.5f) { - snagglebeast_instance_state->unk16C = 0.0f; + snagglebeast_instance_state->rope_extension_length = 0.0f; snagglebeast_instance_state->unk164 = 3; - *(int *)&snagglebeast_instance_state->unk110[3] = 0; + *(int *)&snagglebeast_instance_state->rope_start_position[3] = 0; } break; case SNAGGLEBEAST_ROPE_EXTEND: { float r = vector_distance_xy(moby + 0x10, &sight.position30); - snagglebeast_instance_state->unk16C += frame_scale; - if (r <= snagglebeast_instance_state->unk16C) + snagglebeast_instance_state->rope_extension_length += frame_scale; + if (r <= snagglebeast_instance_state->rope_extension_length) snagglebeast_instance_state->unk164 = 4; if (fast_dec_timer(&snagglebeast_instance_state->timer)) snagglebeast_instance_state->timer = scale_game_frames(0x14); @@ -2216,15 +2216,15 @@ void snagglebeast_update(unsigned char *moby) { case SNAGGLEBEAST_ROPE_RETRACT: fast_vec_sub(&position, snagglebeast_instance_state->unk120, - snagglebeast_instance_state->unk110); + snagglebeast_instance_state->rope_start_position); fast_vec_normalize(&position, &position, frame_scale); - fast_vec_add(snagglebeast_instance_state->unk110, - snagglebeast_instance_state->unk110, + fast_vec_add(snagglebeast_instance_state->rope_start_position, + snagglebeast_instance_state->rope_start_position, &position); configure_timed_point_light(moby, snagglebeast_instance_state, 3, - snagglebeast_instance_state->unk110, + snagglebeast_instance_state->rope_start_position, scale_game_frames(0x1E), 0x800060FF, 0, From fdbf1bfd0db7131f6ba67b93e0f25ad01b1bcc9c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:26:54 +0000 Subject: [PATCH 474/758] decomp: clarify names in spawn_asteroid_fragment unk4E -> splits_remaining: Retail 0x002e1154 preserves incoming a3 (C remaining_split_count) in s5; 0x002e1198 loads spawned moby pvars into s2 and 0x002e11e4 stores s5 as a halfword at s2+0x4E. Original Ghidra expresses the same store as *(undefined2 *)((int)puVar1 + 0x4e) = param_5. Authoritative spawn_asteroid_fragment assigns moby_data->unk4E = remaining_split_count. Its process_asteroid_hit caller tests the signed halfword at blob_data+0x4E > 0 before splitting, passes that count minus one to each child, and decrements the parent's field, stopping at zero. These operations prove a remaining split allowance, rather than an offset-derived meaning. --- src/overlays/l13/mobys/asteroid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l13/mobys/asteroid.c b/src/overlays/l13/mobys/asteroid.c index e545a2317e..e65df333d0 100644 --- a/src/overlays/l13/mobys/asteroid.c +++ b/src/overlays/l13/mobys/asteroid.c @@ -59,7 +59,7 @@ typedef struct AsteroidVars { u8 pad_44[0x4]; char *unk48; s16 unk4C; - s16 unk4E; + s16 splits_remaining; } AsteroidVars; char *spawn_asteroid_fragment(char *parent_asteroid, @@ -85,7 +85,7 @@ char *spawn_asteroid_fragment(char *parent_asteroid, moby_data->unk48 = parent_asteroid; moby_data->unk40 = 1; moby_data->unk4C = scale_game_frames(0x1E); - moby_data->unk4E = remaining_split_count; + moby_data->splits_remaining = remaining_split_count; MOBY(moby)->collision = 0; spin_increment = random_float_between(-30.0f, 30.0f) * DEG_TO_RAD * frame_time; switch (RandomNext() % 3) { From 245816ba55535adeaa157b174184184064199f50 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:26:58 +0000 Subject: [PATCH 475/758] decomp: clarify names in initialize_moby_motion_at_position b20 -> moby_state: Retail 0x002aa088/0x002aa098 writes byte 1 to the initialized moby's +0x20; 0x002aa160-0x002aa174 reads the same member on scanned mobies and excludes states 0xFE and 0xFD. The supplied mine.c mine_update uses state with exactly those excluded values and MINE_STATE_FREE_MOTION=1, and the checked mine_glove_update caller releases its held moby through this initializer. These operations establish the moby state role, rather than merely an offset. p78 -> moby_private_vars: Retail 0x002aa050 loads initialized_moby+0x78 into s2, which receives base motion plus random_offset at 0x002aa0ec-0x002aa0f8, a timer at +0x34 at 0x002aa144, and reflection/damping at 0x002aa254-0x002aa278. Scanned mobies' same pointer is dereferenced for private+0x5C at 0x002aa194-0x002aa1d0. The supplied checked mine_glove_update caller passes held->pvars as base_motion_vector, matching this function's destination private motion storage. These uses prove a pointer to the moby's private variables, not a pointer solely to a vector. --- src/overlays/shared/weapons/mine.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/weapons/mine.c b/src/overlays/shared/weapons/mine.c index ba3374f1f9..ff2ba5a137 100644 --- a/src/overlays/shared/weapons/mine.c +++ b/src/overlays/shared/weapons/mine.c @@ -384,12 +384,12 @@ typedef struct { typedef struct N_2aa008 { u8 pad[0x10]; V_2aa008 v10; - u8 b20; + u8 moby_state; u8 pad2[0x28 - 0x21]; struct N_2aa008 *p28; f32 f2C; u8 pad3[0x78 - 0x30]; - void *p78; + void *moby_private_vars; u8 pad4[0xA6 - 0x7C]; s16 hA6; } N_2aa008; @@ -469,11 +469,11 @@ void initialize_moby_motion_at_position(V_2aa008 *requested_position, s32 bestv; V_2aa008 *k; vector_scratch.q = 0; - moby_vars = initialized_moby->p78; + moby_vars = initialized_moby->moby_private_vars; vector_scratch.f[0] = random_float_between(-1.0f, 1.0f); vector_scratch.f[1] = random_float_between(-1.0f, 1.0f); vector_scratch.f[2] = random_float_between(-1.0f, 1.0f); - initialized_moby->b20 = 1; + initialized_moby->moby_state = 1; initialized_moby->f2C = initialized_moby->f2C / 0.65f; random_offset.q = vector_scratch.q; fast_vec_normalize(&random_offset, @@ -489,19 +489,19 @@ void initialize_moby_motion_at_position(V_2aa008 *requested_position, best = 0; bestv = 0; for (scanned_moby = D_L00_0015FFE4_2aa008; scanned_moby; scanned_moby = scanned_moby->p28) { - if (scanned_moby->b20 != 0xFE) - if (scanned_moby->b20 != 0xFD) + if (scanned_moby->moby_state != 0xFE) + if (scanned_moby->moby_state != 0xFD) if (scanned_moby->hA6 == initialized_moby->hA6) if (scanned_moby != initialized_moby) { - if (best == 0 || ((D_2aa008 *)scanned_moby->p78)->i5C < bestv) { - bestv = ((D_2aa008 *)scanned_moby->p78)->i5C; + if (best == 0 || ((D_2aa008 *)scanned_moby->moby_private_vars)->i5C < bestv) { + bestv = ((D_2aa008 *)scanned_moby->moby_private_vars)->i5C; best = scanned_moby; } count++; } } if (count >= 8) - ((D_2aa008 *)best->p78)->i5C = -1; + ((D_2aa008 *)best->moby_private_vars)->i5C = -1; qcopy(&initialized_moby->v10, requested_position); vector_scratch.q = ((Q_2aa008 *)hero.moby)->v10.q; vector_scratch.f[2] = requested_position->f[2]; From ef14cac8d072d1b55902fbb9fa4c9157e68cf008 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:28:42 +0000 Subject: [PATCH 476/758] decomp: clarify names in process_blarg_helicopter_hits unk67 -> hit_flash_target_red: Assigned retail 0x002eb31c-0x002eb32c writes 0xB4 to pvars+0x67 for a surviving hit, then passes pvars+0x60 to trooper_anim_update; 0x002eb464-0x002eb468 passes that same animation state to trooper_anim_finish. Checked level-12 helper 0x00276428 retains the animation pointer in s0. At 0x002764b8 and 0x002764d4-0x00276508 it reads byte +7, interpolates from original byte +4 toward +7, and retains the computed red channel in s2. At 0x00276584-0x002765d0 it interpolates back from +7 to +4. 0x00276660 passes s2 as a1 to the color setter, matching the supplied trooper_anim_finish C's r1/r0 calculations and set_moby_color(id,r,g,b). Thus helicopter pvars+0x67 is the hit flash target red component, not a timer or arbitrary offset. unk8E -> knockback_timer_frames: Assigned retail 0x002eb41c loads 0x3C for scale_game_frames at 0x002eb430 and stores its return as a halfword at pvars+0x8E at 0x002eb438. The same entry sequence saves the previous state in moby->command and sets state 5/BLARG_HELICOPTER_KNOCKBACK at 0x002eb448-0x002eb454, after setting backward speed at pvars+0x94. Authoritative blarg_helicopter_update's BLARG_HELICOPTER_KNOCKBACK branch calls fast_dec_timer_s16(&blarg_helicopter_vars->unk8E), restores moby->command when it expires, and otherwise applies decelerating backward XY movement. This proves a knockback countdown stored in scaled game frames. --- src/overlays/l12/mobys/blarg_helicopter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l12/mobys/blarg_helicopter.c b/src/overlays/l12/mobys/blarg_helicopter.c index ed649869ab..0b35f25993 100644 --- a/src/overlays/l12/mobys/blarg_helicopter.c +++ b/src/overlays/l12/mobys/blarg_helicopter.c @@ -141,14 +141,14 @@ typedef struct BlargHelicopterVars { u8 pad_5B[0x5]; u8 anim_state; u8 pad_61[0x6]; - u8 unk67; + u8 hit_flash_target_red; u8 pad_68[0x8]; f32 unk70[4]; s32 unk80; u8 pad_84[0x4]; f32 yaw_turn_velocity; s16 unk8C; - s16 unk8E; + s16 knockback_timer_frames; f32 bob_angle; f32 unk94; f32 unk98; @@ -449,7 +449,7 @@ void blarg_helicopter_update(struct Moby *moby) { update_blarg_helicopter_motion_tilt(moby); break; case BLARG_HELICOPTER_KNOCKBACK: - if (fast_dec_timer_s16(&blarg_helicopter_vars->unk8E)) { + if (fast_dec_timer_s16(&blarg_helicopter_vars->knockback_timer_frames)) { moby->state = moby->command; } else { value = blarg_helicopter_vars->unk94 - frame_time_sq * 4.0f; @@ -662,7 +662,7 @@ void process_blarg_helicopter_hits(struct Moby *moby) { allocate_voice_for_target_entry(2, 0, moby); moby->state = BLARG_HELICOPTER_EXPLODE_AND_REMOVE_OR_RESET; } else if (hit_reaction_code != 0xB) { - blarg_helicopter_hit_vars->unk67 = 0xB4; + blarg_helicopter_hit_vars->hit_flash_target_red = 0xB4; trooper_anim_update(moby, (short *)&blarg_helicopter_hit_vars->anim_state); if (*(float *)(hit_record + 0x1C) == 5627.925f && moby->state != BLARG_HELICOPTER_KNOCKBACK) { @@ -680,7 +680,7 @@ void process_blarg_helicopter_hits(struct Moby *moby) { blarg_helicopter_hit_vars->unk9C = 0.0f; } blarg_helicopter_hit_vars->unk94 = frame_time * 4.0f; - blarg_helicopter_hit_vars->unk8E = scale_game_frames(0x3C); + blarg_helicopter_hit_vars->knockback_timer_frames = scale_game_frames(0x3C); moby->command = moby->state; moby->state = BLARG_HELICOPTER_KNOCKBACK; allocate_voice_for_target_entry(1, 0, moby); From aeb5aa1424569a32732fa6878f257de7b61cee9c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:28:45 +0000 Subject: [PATCH 477/758] decomp: clarify names in update_plasmabot_target unk114 -> target_selection_status: At 0x002b32a0/0x002b32a8 the target output passed to helper 0x002682b8 is pvars+0xD0. Checked helper 0x002682d0 preserves this output in s5; status starts at 0 (0x00268320), becomes 2 on hero exclusion/filter rejection (0x00268334..48 and 0x00268400..08), or 1 on alternate target selection (0x00268518..20, 0x00268628..30). At 0x00268708 it writes that status to output+0x44, hence pvars+0x114, and returns the same status at 0x00268710. Assigned retail 0x002b32c4 skips the distance test for status 2; 0x002b32cc..e4 sets this field to 2 when target_range is less than target XY distance. Supplied plasmabot_update tests unk114==2 to inhibit WAIT_TO_START_PATH_TRAVERSAL and FACE_TARGET_AND_WAIT transitions and to return along the path from AIM_AT_TARGET. These operations prove target_selection_status, rather than a boolean distance flag. --- src/overlays/shared/enemies/plasmabot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index a0b51aa87c..3efb0329fa 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -82,7 +82,7 @@ typedef struct PlasmabotVars { u8 unkC0[0x10]; u8 unkD0[0x40]; s32 target; /* 0x110: target moby */ - s32 unk114; + s32 target_selection_status; u8 pad118[0x8]; u8 unk120[0x10]; u8 unk130[0x30]; @@ -133,7 +133,7 @@ void update_plasmabot_target(char *moby) { *target_filter_record) != 2) { if (plasmabot_private_vars->target_range < vector_distance_xy(&MOBY(moby)->pos, &plasmabot_private_vars->unkD0)) { - plasmabot_private_vars->unk114 = 2; + plasmabot_private_vars->target_selection_status = 2; } } if (plasmabot_private_vars->target == 0) { @@ -489,7 +489,7 @@ void plasmabot_update(char *moby) { } case PLASMABOT_WAIT_TO_START_PATH_TRAVERSAL: { float *path; - if (plasmabot_update_private_vars->unk114 == 2) + if (plasmabot_update_private_vars->target_selection_status == 2) return; if (fast_dec_timer_s16(&plasmabot_update_private_vars->unk248) == 0) return; @@ -563,7 +563,7 @@ void plasmabot_update(char *moby) { k, k, frame_time * 6.2831855f); - if (plasmabot_update_private_vars->unk114 == 2) + if (plasmabot_update_private_vars->target_selection_status == 2) break; if (fast_dec_timer_s16(&plasmabot_update_private_vars->unk248) == 0) break; @@ -615,7 +615,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->unk114 == 2) { + if (plasmabot_update_private_vars->target_selection_status == 2) { if (plasmabot_update_private_vars->path_index == -1) break; ((unsigned char *)moby)[0x20] = 8; From 526f5549d840f3b5f0d32d5f9dce0a27ba9ae049 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:28:48 +0000 Subject: [PATCH 478/758] decomp: clarify names in update_rocket_tank_path_movement unk12C -> path_movement_step_length: Retail 0x002f8718-0x002f8768 frame-scales the path target speed, reduces the target on a sharp heading difference, and approaches that target into the float at pvars+0x12C. At 0x002f8774-0x002f8780 this same float scales the moby's forward basis into movement_step, passed to collision-aware movement at 0x002f8794-0x002f87a4. At 0x002f8828-0x002f883c it is divided by a frame-scaled speed reference to drive attached animation speeds. The authoritative C expresses these uses as approach_value(&moby_vars->unk12C, target_movement_step, frame_time_sq), fast_vec_normalize(movement_step, &moby->rot_row0, moby_vars->unk12C), and the animation ratio, proving a smoothed path movement step length rather than an offset-only role. --- src/overlays/l18/mobys/rocket_tank.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l18/mobys/rocket_tank.c b/src/overlays/l18/mobys/rocket_tank.c index 09a13b5174..862675ee5e 100644 --- a/src/overlays/l18/mobys/rocket_tank.c +++ b/src/overlays/l18/mobys/rocket_tank.c @@ -420,7 +420,7 @@ typedef struct RocketTankVars { s32 unk120; u8 pad_124[0x4]; f32 unk128; - f32 unk12C; + f32 path_movement_step_length; u8 pad_130[0x8]; char *unk138; char *unk13C; @@ -446,15 +446,15 @@ void update_rocket_tank_path_movement(struct Moby *moby) { if (fast_difference_between_rotations(path_target_yaw, moby->rot.z) > 0.2617994f) { target_movement_step = frame_time; } - approach_value(&moby_vars->unk12C, target_movement_step, frame_time_sq); + approach_value(&moby_vars->path_movement_step_length, target_movement_step, frame_time_sq); z = 0.0f; - fast_vec_normalize(movement_step, &moby->rot_row0, moby_vars->unk12C); + fast_vec_normalize(movement_step, &moby->rot_row0, moby_vars->path_movement_step_length); FUN_L00_00258830((int)moby, (int)movement_step, 0.5f, 0.5f, z, 0); if (fast_vec_dist(&moby->pos, path_target_position) < 1.0f) { int k = random_integer_below(*D_L18_001B0EB0[moby_vars->unk100] - 1) + 1; moby_vars->unk120 = (moby_vars->unk120 + k) % *D_L18_001B0EB0[moby_vars->unk100]; } - sc = moby_vars->unk12C / (*(float *)&rocket_tank_attached_moby_speed_reference_gp * frame_time); + sc = moby_vars->path_movement_step_length / (*(float *)&rocket_tank_attached_moby_speed_reference_gp * frame_time); if (sc > 2.0f) sc = 2.0f; else if (sc < z) From 0118a5171ecf950ea33b087fa5d775ab3ebe1002 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:28:51 +0000 Subject: [PATCH 479/758] decomp: clarify names in initialize_woodcut_bot_movement_data unk214 -> auxiliary_joint_a: Retail 0x002d15ec stores joint 7 at vars+0x214 (rig+0xb4). The checked initializer loads it at 0x00292574 into joints[4] for transform_scaled_vertex_batch at 0x002925a0, matching supplied initialize_leg_rig rig->jointB4. Walker update repeats this six-joint transform at 0x00295900..0x00295920. This is the first auxiliary joint beyond the two leg joint pairs; no anatomy is claimed. unk215 -> auxiliary_joint_b: Retail 0x002d15c4 stores joint 7 at vars+0x215 (rig+0xb5). Checked initializer 0x0029257c loads it into joints[5] passed to transform_scaled_vertex_batch at 0x002925a0, matching supplied rig->jointB5. Walker update 0x00295904..0x00295920 repeats its use as the second auxiliary joint beyond the two leg pairs. unk224 -> movement_acceleration_step_limit: Retail 0x002d1560 multiplies frame_time_sq by 10.0 and 0x002d15b8 stores it at vars+0x224 (rig+0xc4). Checked walker update 0x00295a40..0x00295a60 clamps requested acceleration f22 to this field, then 0x00295a64..0x00295aa8 adds or subtracts that bounded step from rig+0xc0 toward requested speed f21, clamping overshoot. This proves a movement acceleration step limit. unk23C -> movement_gravity_step: Retail 0x002d1544 computes frame_time_sq*9.8 and 0x002d15a8 stores it at vars+0x23c (rig+0xdc). Checked vertical-motion helper 0x00292828 loads rig+0xdc at 0x00292c28 and subtracts it from rig+0xd8 at 0x00292c2c..30. The resulting displacement is added to six point Z components at 0x00292c40..58 and moby Z at 0x00292c5c..78, proving the gravity step rather than relying on the constant alone. unk250 -> leg_a_joint: Retail 0x002d15c8 initializes vars+0x250 to 10, rig+0xf0. Checked initializer 0x00292554 places this in joints[0]; 0x002925a8..0x002925b4 passes it to build_moby_bone_transform to compute the leg yaw. The loop advances 0xb0 at 0x00292604, matching supplied rig->legs[k].joint for the first leg. unk251 -> leg_a_secondary_joint: Retail 0x002d15cc initializes vars+0x251 to 8, rig+0xf1. Checked initializer 0x0029255c and 0x0029258c place this in joints[1], immediately after the first leg joint, for the six-point transform. Supplied initialize_leg_rig identifies this paired input as rig->legs[0].joint2; second leg begins at rig+0x1a0. unk252 -> leg_a_manipulator_slot_a: Retail 0x002d15d4 stores 14 at vars+0x252 (rig+0xf2). Checked initializer 0x002925e8 tests the first leg manip_a.attached at rig+0x121, then loads this byte into a1 at 0x002925f4 and passes the rig+0x120 manipulator to attach_manipulator at 0x002925fc. Supplied C confirms the slot_a/manip_a binding. unk253 -> leg_a_manipulator_slot_b: Retail 0x002d15d0 stores 12 at vars+0x253 (rig+0xf3). Checked initializer tests manip_b.attached at rig+0x161 at 0x002925cc, then loads this byte as a1 at 0x002925d8 and passes rig+0x160 to attach_manipulator at 0x002925e0. Supplied C confirms the first leg slot_b/manip_b binding. unk300 -> leg_b_joint: Retail 0x002d15d8 initializes vars+0x300 to 11, rig+0x1a0. Checked initializer 0x00292564 places this in joints[2], and its per-leg loop advances s0 by 0xb0 at 0x00292604 so 0x002925a8 loads it for build_moby_bone_transform on the second iteration. Supplied C identifies rig->legs[1].joint. unk301 -> leg_b_secondary_joint: Retail 0x002d15dc initializes vars+0x301 to 9, rig+0x1a1. Checked initializer 0x0029256c and 0x00292598 place it in joints[3] for transform_scaled_vertex_batch, paired with rig+0x1a0. This matches supplied rig->legs[1].joint2; walker update 0x002958ec..0x00295920 uses the same ordered pair. unk302 -> leg_b_manipulator_slot_a: Retail 0x002d15e4 stores 15 at vars+0x302 (rig+0x1a2). Checked initializer's second iteration advances s0 and s3 by 0xb0 at 0x00292604/08; its 0x002925f4 load of s0+0xf2 therefore reads this byte as a1 for attach_manipulator at 0x002925fc with the second leg manip_a. Supplied C confirms slot_a. unk303 -> leg_b_manipulator_slot_b: Retail 0x002d15e0 stores 13 at vars+0x303 (rig+0x1a3). Checked initializer's second iteration advances s0 and s1 by 0xb0 at 0x00292604/14; its 0x002925d8 load of s0+0xf3 reads this byte as a1 for attach_manipulator at 0x002925e0 with second leg manip_b. Supplied C confirms slot_b. --- src/overlays/l04/mobys/woodcut_bot.c | 48 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index 61aa14586b..36f2a5f080 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -45,27 +45,27 @@ typedef struct WoodcutBotVars { u8 unk211; u8 unk212; u8 unk213; - u8 unk214; - u8 unk215; + u8 auxiliary_joint_a; + u8 auxiliary_joint_b; u8 pad_216[0xE]; - f32 unk224; + f32 movement_acceleration_step_limit; u8 pad_228[0x4]; f32 unk22C; f32 unk230; f32 unk234; u8 pad_238[0x4]; - f32 unk23C; + f32 movement_gravity_step; f32 unk240; u8 pad_244[0xC]; - u8 unk250; - u8 unk251; - u8 unk252; - u8 unk253; + u8 leg_a_joint; + u8 leg_a_secondary_joint; + u8 leg_a_manipulator_slot_a; + u8 leg_a_manipulator_slot_b; u8 pad_254[0xAC]; - u8 unk300; - u8 unk301; - u8 unk302; - u8 unk303; + u8 leg_b_joint; + u8 leg_b_secondary_joint; + u8 leg_b_manipulator_slot_a; + u8 leg_b_manipulator_slot_b; } WoodcutBotVars; void initialize_woodcut_bot_movement_data(void *moby) { @@ -99,25 +99,25 @@ void initialize_woodcut_bot_movement_data(void *moby) { speed = frameScale * 9.8f; angleHalf = frameScale * 3.1415927f; amount = frameScale * 10.0f; - moby_vars->unk214 = 7; + moby_vars->auxiliary_joint_a = 7; moby_vars->unk210 = 0; moby_vars->unk211 = 0; - moby_vars->unk23C = speed; + moby_vars->movement_gravity_step = speed; moby_vars->unk22C = angleHalf; moby_vars->unk230 = angleFull; moby_vars->unk234 = angleOther; - moby_vars->unk224 = amount; + moby_vars->movement_acceleration_step_limit = amount; moby_vars->unk212 = 0xff; moby_vars->unk213 = 0x10; - moby_vars->unk215 = 7; - moby_vars->unk250 = 10; - moby_vars->unk251 = 8; - moby_vars->unk253 = 12; - moby_vars->unk252 = 14; - moby_vars->unk300 = 11; - moby_vars->unk301 = 9; - moby_vars->unk303 = 13; - moby_vars->unk302 = 15; + moby_vars->auxiliary_joint_b = 7; + moby_vars->leg_a_joint = 10; + moby_vars->leg_a_secondary_joint = 8; + moby_vars->leg_a_manipulator_slot_b = 12; + moby_vars->leg_a_manipulator_slot_a = 14; + moby_vars->leg_b_joint = 11; + moby_vars->leg_b_secondary_joint = 9; + moby_vars->leg_b_manipulator_slot_b = 13; + moby_vars->leg_b_manipulator_slot_a = 15; moby_vars->unk240 = 0.5f; initialize_leg_rig(moby, movement_data); } From 7e94ec50e518f017b8ba04885a54027295c7286f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:28:54 +0000 Subject: [PATCH 480/758] decomp: clarify names in start_blarg_elite_commando_return_to_initial_position unk2BC -> cached_position_z: Retail 0x002d3e0c loads pvars into s1; 0x002d3e70 loads the Moby position Z at s0+0x18 and 0x002d3e74 stores that float at s1+0x2BC. Original Ghidra likewise copies Moby+0x18 to pvars+700. In the authoritative blarg_elite_commando_update, this member is refreshed from pos.z immediately before sinusoidal bobbing overwrites pos.z. Thus it caches a position Z sample; no downstream reader or persistent initial-height role is claimed. unk2DC -> state_countdown_ticks: Retail 0x002d3df0 preserves the second argument in s3 and 0x002d3e6c stores its low halfword to pvars+0x2DC during state 10 -> 1; original Ghidra records param_2 at iVar1+0x2dc. The authoritative C names this argument return_countdown_ticks. Its update decrements the same s16 via fast_dec_timer_s16 in RETURN_TO_INITIAL_POSITION, IDLE and MOVE_TO_ATTACK_NODE; zero gates state progress. Other assignments use scaled 30..90 or 60 frame durations, proving a reused state countdown in ticks rather than a return-only timer. --- .../shared/enemies/blarg_elite_commando.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_elite_commando.c b/src/overlays/shared/enemies/blarg_elite_commando.c index 743a8a307f..ae1081e99d 100644 --- a/src/overlays/shared/enemies/blarg_elite_commando.c +++ b/src/overlays/shared/enemies/blarg_elite_commando.c @@ -94,7 +94,7 @@ typedef struct L16DamageData { f32 unk2B0; f32 unk2B4; u8 pad2B8[0x4]; - f32 unk2BC; + f32 cached_position_z; f32 unk2C0; f32 unk2C4; f32 unk2C8; @@ -102,7 +102,7 @@ typedef struct L16DamageData { char *unk2D0; f32 movement_step_length; u8 unk2D8[0x4]; - s16 unk2DC; + s16 state_countdown_ticks; u16 unk2DE; int pursuit_timer; f32 unk2E4; @@ -297,8 +297,8 @@ void blarg_elite_commando_update(char *commando_moby) { } break; case COMMANDO_STATE_RETURN_TO_INITIAL_POSITION: - if (!fast_dec_timer_s16(&commando_data->unk2DC)) { - fast_vec_normalize(scratch_vector, commando_moby + 0xC0, commando_data->unk2DC * 0.1f); + if (!fast_dec_timer_s16(&commando_data->state_countdown_ticks)) { + fast_vec_normalize(scratch_vector, commando_moby + 0xC0, commando_data->state_countdown_ticks * 0.1f); fast_vec_add(scratch_vector, scratch_vector, &MOBY(commando_moby)->pos); func_L16_002D5280_update(commando_moby, scratch_vector, 1); } else { @@ -319,12 +319,12 @@ void blarg_elite_commando_update(char *commando_moby) { } break; case COMMANDO_STATE_IDLE: - fast_dec_timer_s16(&commando_data->unk2DC); + fast_dec_timer_s16(&commando_data->state_countdown_ticks); if (commando_data->pursuit_mode != COMMANDO_PURSUIT_MODE_DISABLED) { - if (commando_data->unk2DC == 0) { + if (commando_data->state_countdown_ticks == 0) { if (commando_data->unk120 >= 0) { MOBY(commando_moby)->state = COMMANDO_STATE_MOVE_TO_ATTACK_NODE; - commando_data->unk2DC = + commando_data->state_countdown_ticks = truncate_float_to_s32(scale_time(random_float_between(30.0f, 90.0f))); commando_data->unk300 = (commando_data->unk300 + 1) % 2; select_blarg_elite_commando_movement_animation(commando_moby); @@ -411,7 +411,7 @@ void blarg_elite_commando_update(char *commando_moby) { 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)); - commando_data->unk2DC = scale_game_frames(60); + commando_data->state_countdown_ticks = scale_game_frames(60); commando_data->unk2DE = 0; } } @@ -421,8 +421,8 @@ void blarg_elite_commando_update(char *commando_moby) { D_L16_001B0930[commando_data->unk120] + (commando_data->unk300 * 16 + 0x10), 1); - fast_dec_timer_s16(&commando_data->unk2DC); - if (distance < 0.01f || commando_data->unk2DC == 0) { + fast_dec_timer_s16(&commando_data->state_countdown_ticks); + if (distance < 0.01f || commando_data->state_countdown_ticks == 0) { MOBY(commando_moby)->state = COMMANDO_STATE_PREPARE_ROCKET_FIRE; if (((unsigned char *)commando_moby)[0x53] != 2) blend_moby_animation(commando_moby, 2, 0, scale_game_frames(30)); @@ -466,7 +466,7 @@ void blarg_elite_commando_update(char *commando_moby) { break; } if (blarg_elite_commando_bobbing_and_voice_enabled_gp) { - commando_data->unk2BC = MOBY(commando_moby)->pos.z; + commando_data->cached_position_z = MOBY(commando_moby)->pos.z; if (((unsigned char *)commando_moby)[0x20] != 0 && ((unsigned char *)commando_moby)[0x20] != 10) { approach_value((float *)(&commando_data->unk2EC), 0.25f, frame_time * 0.25f); @@ -696,8 +696,8 @@ void start_blarg_elite_commando_return_to_initial_position(struct Moby *moby, moby->flags &= 0xFFFE; moby->collision = moby->pclass->collision; moby->flags |= 0x1000; - commando_data->unk2DC = return_countdown_ticks; - commando_data->unk2BC = moby->pos.z; + commando_data->state_countdown_ticks = return_countdown_ticks; + commando_data->cached_position_z = moby->pos.z; qcopy(&commando_data->unk2C0, &moby->pos); commando_data->movement_step_length = frame_time * 5.0f; } From f3c880dccbc83e939670f75250825094addfbd9a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:30:55 +0000 Subject: [PATCH 481/758] decomp: clarify names in draw_scoutbot_glow_quad unk220 -> glow_quad_anchor_position: In authoritative scoutbot.c, scoutbot_update calls moby_point_position(moby, 3, scoutbot_instance_vars->f220) immediately before registering draw_scoutbot_glow_quad with the same moby; Data_3DF8 places f220 at the same private-data location as ScoutbotVars::unk220. Retail 0x002d4144 loads moby+0x78, 0x002d4178 selects private-data+0x220, and 0x002d41a8/0x002d41ac copy its 16-byte position into M[3] at sp+0xd0. Original Ghidra likewise reads iVar4+0x220 and +0x228 into uStack_a0 through uStack_94. Source fast_vec_sub uses M[3] as the position endpoint, then retail 0x002d4230 adds position_offset to that row before 0x002d4290 transforms the four quad vertices. These uses establish the cached glow quad anchor position, independently of its offset. --- src/overlays/shared/enemies/scoutbot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index d3c2920be2..37b64a1110 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -57,7 +57,7 @@ typedef struct ScoutbotVars { s16 unk216; char *unk218; s32 target_path_index; - u8 unk220[0x4]; + u8 glow_quad_anchor_position[0x4]; } ScoutbotVars; typedef struct Moby Moby; @@ -683,7 +683,7 @@ void draw_scoutbot_glow_quad(struct Moby *moby) { pk.uv[5] = 0.0f; pk.uv[6] = 1.0f; pk.uv[7] = 1.0f; - qcopy(M[3], (float *)(&scoutbot_private_state->unk220)); + qcopy(M[3], (float *)(&scoutbot_private_state->glow_quad_anchor_position)); fast_vec_sub(M[0], D_L08_001675C0_lui, M[3]); fast_vec_normalize(M[0], M[0], 1.0f); fast_vec_cross(M[1], M[0], up); From 7dcc3eabeb41ae6a20aa40e15244746db64b811f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:30:58 +0000 Subject: [PATCH 482/758] decomp: clarify names in refueling_station_update unk76 -> removal_check_index: In refueling_station_update INITIALIZE, the s16 field is loaded by lh v1,0x76(s0) at 00303d78 and compared with the disabled sentinel -1 at 00303d80. At 00303d88-00303d90 it indexes D_0013D388 without scaling and selects the byte at indexed base+0x39. Nonzero reaches mark_moby_for_removal(moby) at 00303d9c and returns. The authoritative C expresses this through removal_check_base = D_0013D388 + station_vars->unk76 and removal_check_base[0x39]; original Ghidra agrees with the signed index+0x13d3c1 byte test. Thus removal_check_index describes its observed selection role without asserting table identity. --- src/overlays/l09/mobys/refueling_station.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l09/mobys/refueling_station.c b/src/overlays/l09/mobys/refueling_station.c index 3690245b70..b0cd80ba79 100644 --- a/src/overlays/l09/mobys/refueling_station.c +++ b/src/overlays/l09/mobys/refueling_station.c @@ -168,7 +168,7 @@ typedef struct RefuelingStationVars { u8 pad_21[0x4F]; s32 unk70; s16 timer_74; - s16 unk76; + s16 removal_check_index; s32 unk78; s32 voice; } RefuelingStationVars; @@ -181,8 +181,8 @@ void refueling_station_update(struct Moby *moby) { handle_refueling_station_damage(moby, station_vars, &station_vars->unk20); switch (moby->state) { case REFUELING_STATION_STATE_INITIALIZE: - if (station_vars->unk76 != -1 && - (removal_check_base = (unsigned char *)D_0013D388 + station_vars->unk76)[0x39] != 0) { + if (station_vars->removal_check_index != -1 && + (removal_check_base = (unsigned char *)D_0013D388 + station_vars->removal_check_index)[0x39] != 0) { mark_moby_for_removal(moby); return; } From 7bfcf802b97e10470b7364dad13c44f96ae9fcb5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:31:01 +0000 Subject: [PATCH 483/758] decomp: clarify names in update_oscillating_target_link_strips unk2324 -> link_length: Retail 0x00302d48 loads the float at pvars+0x2324; 0x00302d68 divides it by the point count, and 0x00302d80..0x00302d88 multiplies by the point index and writes the strip point's x coordinate. The supplied caller oscillating_target_link_update stores fast_vec_dist(moby position, target position) into the same +0x2324 field (dist), proving the length of the link used to space its strip points. unk232C -> strip_point_count: Retail 0x00302cf8..0x00302d14 loads pvars+0x232c and allocates count*16 bytes for temporary vectors. 0x00302d40..0x00302d98 uses it as the divisor for point spacing and the bound for initializing each 16-byte strip point. 0x00302d9c..0x00302e28 and 0x00302e4c..0x00302ea8 restrict smoothing and motion to indices 1 through count-2; supplied draw C reads the same +0x232c count and draws count-1 segments joining adjacent points. --- .../l12/mobys/oscillating_target_link.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/l12/mobys/oscillating_target_link.c b/src/overlays/l12/mobys/oscillating_target_link.c index 0869768f61..d989a5c1a8 100644 --- a/src/overlays/l12/mobys/oscillating_target_link.c +++ b/src/overlays/l12/mobys/oscillating_target_link.c @@ -151,9 +151,9 @@ typedef struct OscillatingTargetLinkVars { u8 pad_0[0x2300]; u8 timer_2300; u8 pad_2301[0x23]; - f32 unk2324; + f32 link_length; u8 pad_2328[0x4]; - s32 unk232C; + s32 strip_point_count; } OscillatingTargetLinkVars; void update_oscillating_target_link_strips(struct Moby *moby) { @@ -171,12 +171,12 @@ void update_oscillating_target_link_strips(struct Moby *moby) { float *points; float *intermediate; if (fast_dec_timer((int *)((char *)oscillating_link_strip_state + 0x2300 + strip * 4))) { - int vector_count = oscillating_link_strip_state->unk232C; + int vector_count = oscillating_link_strip_state->strip_point_count; float intermediate_storage[vector_count][4]; char *timers = &oscillating_link_strip_state->timer_2300; intermediate = &intermediate_storage[0][0]; i = 0; - if (0 < oscillating_link_strip_state->unk232C) { + if (0 < oscillating_link_strip_state->strip_point_count) { points = (float *)((char *)oscillating_link_strip_state + strip * 0x460); do { float vector_count_float; @@ -184,8 +184,8 @@ void update_oscillating_target_link_strips(struct Moby *moby) { float index; float rate; clear_u64_value(points); - vector_count_float = (float)oscillating_link_strip_state->unk232C; - length = oscillating_link_strip_state->unk2324; + vector_count_float = (float)oscillating_link_strip_state->strip_point_count; + length = oscillating_link_strip_state->link_length; index = (float)i; rate = oscillating_link_strip_random_delta_magnitude_rate_gp * frame_time; points[3] = 1.0f; @@ -193,10 +193,10 @@ void update_oscillating_target_link_strips(struct Moby *moby) { random_vector(intermediate + i * 4, 0.0f, rate); points += 4; i++; - } while (i < oscillating_link_strip_state->unk232C); + } while (i < oscillating_link_strip_state->strip_point_count); } count = 1; - if (count < oscillating_link_strip_state->unk232C - 1) { + if (count < oscillating_link_strip_state->strip_point_count - 1) { points = (float *)((char *)oscillating_link_strip_state + strip * 0x460 + 0x1190); do { fast_vec_add( @@ -205,11 +205,11 @@ void update_oscillating_target_link_strips(struct Moby *moby) { fast_vec_scale(points, points, 0.333f); count++; points += 4; - } while (count < oscillating_link_strip_state->unk232C - 1); + } while (count < oscillating_link_strip_state->strip_point_count - 1); } *(int *)(timers + (strip << 2)) = oscillating_link_strip_reset_ticks; } else { - for (i = 1; i < oscillating_link_strip_state->unk232C - 1; i++) { + for (i = 1; i < oscillating_link_strip_state->strip_point_count - 1; i++) { float *point = (float *)((char *)oscillating_link_strip_state + strip * 0x460 + i * 16); float *delta = (float *)((char *)oscillating_link_strip_state + strip * 0x460 + From d028b43c708b908d2ac2d3ca5f0852721264ccf8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:31:04 +0000 Subject: [PATCH 484/758] decomp: clarify names in path_following_rocket_update unk16 -> proximity_voice_requested: In the SHA-256-bound C snapshot, s16 unk16 is cleared when the trigger enters FOLLOW_PATH and when reset restores WAIT_FOR_TRIGGER. Retail 0x002c3e40 and 0x002c3fcc store zero to pvars+0x16. Retail 0x002c3ed4-0x002c3ed8 loads that halfword and skips the proximity branch if nonzero; 0x002c3ee0-0x002c3f04 computes vector_distance_xy from moby position to hero position and requires distance < 7.0f. At 0x002c3f10 the halfword becomes 1 immediately before 0x002c3f14-0x002c3f1c requests allocate_voice_for_target_entry_u(1, 0, moby). Original Ghidra shows the same zero check, proximity comparison, latch store and voice call. Thus it records that the proximity voice request has occurred for the current activation, rather than a voice handle or confirmed playback. --- src/overlays/l16/mobys/path_following_rocket.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l16/mobys/path_following_rocket.c b/src/overlays/l16/mobys/path_following_rocket.c index a2fea6089c..d10a82bb96 100644 --- a/src/overlays/l16/mobys/path_following_rocket.c +++ b/src/overlays/l16/mobys/path_following_rocket.c @@ -39,7 +39,7 @@ typedef struct PathFollowingRocketVars { f32 unkC; f32 unk10; s16 voice; - s16 unk16; + s16 proximity_voice_requested; } PathFollowingRocketVars; /* Moby class 257 */ @@ -70,7 +70,7 @@ void path_following_rocket_update(struct Moby *moby) { break; if (is_point_inside_clip_volume(&player->motion.body_center, *(int *)rocket_path_data)) { moby->state = ROCKET_STATE_FOLLOW_PATH; - rocket_path_data->unk16 = 0; + rocket_path_data->proximity_voice_requested = 0; } break; } @@ -88,9 +88,9 @@ void path_following_rocket_update(struct Moby *moby) { if (!voice_is_playing(moby, rocket_path_data->voice)) { rocket_path_data->voice = allocate_voice_for_target_entry(0, 4, moby); } - if (rocket_path_data->unk16 == 0 && + if (rocket_path_data->proximity_voice_requested == 0 && vector_distance_xy(&moby->pos, (char *)(&hero.motion.pos)) < 7.0f) { - rocket_path_data->unk16 = 1; + rocket_path_data->proximity_voice_requested = 1; allocate_voice_for_target_entry_u(1, 0, moby); } break; @@ -112,7 +112,7 @@ void path_following_rocket_update(struct Moby *moby) { moby->visible = 1; moby->flags &= ~1; moby->collision = moby->pclass->collision; - rocket_path_data->unk16 = 0; + rocket_path_data->proximity_voice_requested = 0; moby->state = ROCKET_STATE_WAIT_FOR_TRIGGER; } } From 41ceddfe22a029079178f7ccd5c2c185465eec76 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:33:10 +0000 Subject: [PATCH 485/758] decomp: clarify names in update_blarg_heavy_interceptor_patrol_aim_point unk170 -> aim_point_position: Retail 0x002ae734/0x002ae754/0x002ae770 load the sampled path XYZ from the stack; 0x002ae740/0x002ae758/0x002ae77c pass pvars+0x170/+0x174/+0x178 as current-position destinations to the three easing calls at 0x002ae74c/0x002ae768/0x002ae784, paired with velocities at +0x180/+0x184/+0x188. Original retail Ghidra confirms these same destinations. The authoritative C maps those destinations to f32 unk170[4]. Its initialization copies a path point into it; tracking eases it toward the locked target position. update_blarg_heavy_interceptor_aim_transforms subtracts unkD0 from this vector and derives yaw/pitch and aiming quaternions from that span, proving aim_point_position rather than a generic position or merely an offset-based name. --- .../l14/mobys/blarg_heavy_interceptor.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 80b3265c61..8afe6c8114 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -235,7 +235,7 @@ typedef struct BlargHeavyInterceptorVars { f32 unk140[4]; u8 pad_150[0x10]; f32 beam_rotation_blink_and_aim_path_state[4]; - f32 unk170[4]; + f32 aim_point_position[4]; f32 unk180[4]; f32 unk190[4]; f32 oscillation_state[4]; @@ -327,7 +327,7 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { moby_vars->max_health = 4; moby_vars->unk28 = 3; qcopy(&moby->pos, (char *)l14_paths[moby_vars->spawn_path] + 0x10); - qcopy(moby_vars->unk170, (char *)l14_paths[moby_vars->unk78] + 0x10); + qcopy(moby_vars->aim_point_position, (char *)l14_paths[moby_vars->unk78] + 0x10); initialize_blarg_heavy_interceptor_paths(moby); moby_vars->unk88 = 1; moby_vars->unk21C = -1.0f; @@ -427,14 +427,14 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { } else { vector_scratch[2] -= 0.5f; } - ease_c618(moby_vars->unk170, vector_scratch[0], moby_vars->unk180, 0.003f, 0.2f, 0.0f); - ease_c618(&moby_vars->unk170[1], + ease_c618(moby_vars->aim_point_position, vector_scratch[0], moby_vars->unk180, 0.003f, 0.2f, 0.0f); + ease_c618(&moby_vars->aim_point_position[1], vector_scratch[1], &moby_vars->unk180[1], 0.003f, 0.2f, 0.0f); - ease_c618(&moby_vars->unk170[2], + ease_c618(&moby_vars->aim_point_position[2], vector_scratch[2], &moby_vars->unk180[2], 0.003f, @@ -573,19 +573,19 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { &moby_vars->unk1C0[3], moby_vars->rejoin_path_loop, 0.0f); - ease_c618(moby_vars->unk170, + ease_c618(moby_vars->aim_point_position, vector_scratch[0], moby_vars->unk180, l14_blarg_heavy_interceptor_path_easing_error_gain, l14_blarg_heavy_interceptor_path_easing_damping_coefficient, 0.0f); - ease_c618(&moby_vars->unk170[1], + ease_c618(&moby_vars->aim_point_position[1], vector_scratch[1], &moby_vars->unk180[1], l14_blarg_heavy_interceptor_path_easing_error_gain, l14_blarg_heavy_interceptor_path_easing_damping_coefficient, 0.0f); - ease_c618(&moby_vars->unk170[2], + ease_c618(&moby_vars->aim_point_position[2], vector_scratch[2], &moby_vars->unk180[2], l14_blarg_heavy_interceptor_path_easing_error_gain, @@ -1545,19 +1545,19 @@ void update_blarg_heavy_interceptor_patrol_aim_point(struct Moby *moby) { &interceptor_instance_vars->unk1C0[3], interceptor_instance_vars->rejoin_path_loop, interceptor_instance_vars->beam_rotation_blink_and_aim_path_state[2]); - FUN_L00_0025b8c0_c(interceptor_instance_vars->unk170, + FUN_L00_0025b8c0_c(interceptor_instance_vars->aim_point_position, interceptor_instance_vars->unk180, path_target_position[0], *(float *)&l14_blarg_heavy_interceptor_path_easing_error_gain, *(float *)&l14_blarg_heavy_interceptor_path_easing_damping_coefficient, 0.0f); - FUN_L00_0025b8c0_c(&interceptor_instance_vars->unk170[1], + FUN_L00_0025b8c0_c(&interceptor_instance_vars->aim_point_position[1], &interceptor_instance_vars->unk180[1], path_target_position[1], *(float *)&l14_blarg_heavy_interceptor_path_easing_error_gain, *(float *)&l14_blarg_heavy_interceptor_path_easing_damping_coefficient, 0.0f); - FUN_L00_0025b8c0_c(&interceptor_instance_vars->unk170[2], + FUN_L00_0025b8c0_c(&interceptor_instance_vars->aim_point_position[2], &interceptor_instance_vars->unk180[2], path_target_position[2], *(float *)&l14_blarg_heavy_interceptor_path_easing_error_gain, @@ -1778,7 +1778,7 @@ int update_blarg_heavy_interceptor_aim_transforms(struct Moby *moby, int flag) { float half_span_vector[4]; float rotation_angle; fast_vec_sub(half_span_vector, - blarg_heavy_interceptor_private_vars->unk170, + blarg_heavy_interceptor_private_vars->aim_point_position, blarg_heavy_interceptor_private_vars->unkD0); fast_vec_scale(half_span_vector, half_span_vector, 0.5f); fast_vec_add(bounding_sphere, blarg_heavy_interceptor_private_vars->unkD0, half_span_vector); @@ -1806,7 +1806,7 @@ int update_blarg_heavy_interceptor_aim_transforms(struct Moby *moby, int flag) { blarg_heavy_interceptor_private_vars->unk130, 1, rotation_angle); blarg_heavy_interceptor_private_vars->unk1C0[0] = rotation_angle; qcopy(blarg_heavy_interceptor_private_vars->unk90, - blarg_heavy_interceptor_private_vars->unk170); + blarg_heavy_interceptor_private_vars->aim_point_position); if (flag != 0) { add_draw_callback(FUN_L14_002ae260_u, moby); blarg_heavy_interceptor_private_vars->flags |= 2; From de058677f4455273ab73ffb943229cc0cb065a4c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:33:14 +0000 Subject: [PATCH 486/758] decomp: clarify names in begin_sentrybot_turn_toward_heading unk15D -> pending_animation: Retail 0x0029989C copies animation argument a3 into s2 and 0x002998F4 stores its byte at SentrybotVars+0x15D. The same s2 is compared with moby prev_seq at 0x00299A18 and passed to animation helper a1 at 0x00299A2C when no turn is needed. In the bound C sentrybot_update turn-completion handler, unk15D is compared to prev_seq and passed to blend_moby_animation after anim_flags & 2; the transition-completion handler likewise applies it unless 0xFF. Thus this member holds the pending animation sequence to apply after a turn or transition. --- src/overlays/shared/enemies/sentrybot.c | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index 4146dd9818..0abf866985 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -122,7 +122,7 @@ typedef struct SentrybotVars { u8 has_line_of_sight; /* 0x15A: to the hero */ u8 alert_engagement_suppressed; u8 unk15C; - u8 unk15D; + u8 pending_animation; u8 unk15E; u8 unk15F; f32 home_pos[3]; /* 0x160: position at spawn */ @@ -401,7 +401,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk15F = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; - sentrybot_instance_data->unk15D = 3; + sentrybot_instance_data->pending_animation = 3; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } @@ -430,7 +430,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk15F = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0xD; - sentrybot_instance_data->unk15D = 0xE; + sentrybot_instance_data->pending_animation = 0xE; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } @@ -465,7 +465,7 @@ void sentrybot_update(unsigned char *moby) { if (sentrybot_instance_data->unk150 != -1 || sentrybot_instance_data->unk12C != -1 || (sentrybot_instance_data->unk154 == 0 && random_integer_below(0x78) == 0)) { - sentrybot_instance_data->unk15D = 0; + sentrybot_instance_data->pending_animation = 0; sentrybot_instance_data->unk15C = 2; MOBY(moby)->state = SENTRYBOT_DEACTIVATE_LINKED_MOBYS_AFTER_ANIMATION; if (MOBY(moby)->prev_seq != 2) @@ -504,7 +504,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk15F = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; - sentrybot_instance_data->unk15D = 3; + sentrybot_instance_data->pending_animation = 3; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } @@ -559,7 +559,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk15F = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; - sentrybot_instance_data->unk15D = 3; + sentrybot_instance_data->pending_animation = 3; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } @@ -585,9 +585,9 @@ void sentrybot_update(unsigned char *moby) { turn_heading_offsets_degrees[k] * DEG_TO_RAD); } MOBY(moby)->state = sentrybot_instance_data->unk15C; - if (MOBY(moby)->prev_seq != sentrybot_instance_data->unk15D) + if (MOBY(moby)->prev_seq != sentrybot_instance_data->pending_animation) blend_moby_animation( - moby, sentrybot_instance_data->unk15D, 0, scale_game_frames(10)); + moby, sentrybot_instance_data->pending_animation, 0, scale_game_frames(10)); } else if (MOBY(moby)->seq == MOBY(moby)->prev_seq && turn_heading_offsets_degrees != 0) { float t = compute_interpolated_record_value(moby); @@ -622,7 +622,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk15F = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; - sentrybot_instance_data->unk15D = 3; + sentrybot_instance_data->pending_animation = 3; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } @@ -645,7 +645,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk15F = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0xD; - sentrybot_instance_data->unk15D = 0xE; + sentrybot_instance_data->pending_animation = 0xE; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } @@ -661,7 +661,7 @@ void sentrybot_update(unsigned char *moby) { if (sentrybot_instance_data->unk150 != -1 || sentrybot_instance_data->unk12C != -1 || sentrybot_instance_data->unk154 == 0) { sentrybot_instance_data->unk15C = MOBY(moby)->state; - sentrybot_instance_data->unk15D = 0xD; + sentrybot_instance_data->pending_animation = 0xD; MOBY(moby)->state = SENTRYBOT_DEACTIVATE_LINKED_MOBYS_AFTER_ANIMATION; if (MOBY(moby)->prev_seq != 2) blend_moby_animation(moby, 2, 0, scale_game_frames(10)); @@ -701,7 +701,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk15F = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; - sentrybot_instance_data->unk15D = 3; + sentrybot_instance_data->pending_animation = 3; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } @@ -809,10 +809,10 @@ void sentrybot_update(unsigned char *moby) { } else { if (sentrybot_instance_data->unk15C != 0xFF) MOBY(moby)->state = sentrybot_instance_data->unk15C; - if (sentrybot_instance_data->unk15D != 0xFF && - MOBY(moby)->prev_seq != sentrybot_instance_data->unk15D) + if (sentrybot_instance_data->pending_animation != 0xFF && + MOBY(moby)->prev_seq != sentrybot_instance_data->pending_animation) blend_moby_animation( - moby, sentrybot_instance_data->unk15D, 0, scale_game_frames(10)); + moby, sentrybot_instance_data->pending_animation, 0, scale_game_frames(10)); } } } @@ -1089,7 +1089,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk15F = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0xD; - sentrybot_instance_data->unk15D = 0xE; + sentrybot_instance_data->pending_animation = 0xE; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } @@ -1117,7 +1117,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk15F = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; - sentrybot_instance_data->unk15D = 3; + sentrybot_instance_data->pending_animation = 3; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } @@ -1236,7 +1236,7 @@ int begin_sentrybot_turn_toward_heading( moby_data->turn_target_yaw = angle; moby_data->turn_delta = heading_delta; moby_data->unk15C = next_state; - moby_data->unk15D = next_animation; + moby_data->pending_animation = next_animation; if (heading_delta > 2.0943952f || heading_delta < -2.0943952f) { MOBY(moby)->state = SENTRYBOT_TURN_AROUND; stored_heading_delta = moby_data->turn_delta; From 26082f73c07820b8cfbc1243f60d9c2edacf4ff6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:33:18 +0000 Subject: [PATCH 487/758] decomp: clarify names in interpolate_racer_to_path_start unk84 -> initial_position_path_index: In the authoritative C, RacerVars.unk84 indexes l14_paths and record+0x10 is the third vector argument to lerp_vector in interpolate_racer_to_path_start. Retail 0x002d651c loads private +0x84, 0x002d652c scales it by four, and 0x002d6534-0x002d6548 fetch the table pointer at 0x001b0bb0 and pass its first point (+0x10). Checked caller 0x002d612c-0x002d6154 uses the same index/table/point and copies that vector directly into Moby position (+0x10) after initializing the countdown and reciprocal duration (0x002d610c-0x002d6144). This proves the path index selects the initial position used before interpolation to the spline's first point. --- src/overlays/l14/mobys/racer_path_and_weapon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/racer_path_and_weapon.c b/src/overlays/l14/mobys/racer_path_and_weapon.c index fe8762575e..8d617b6aba 100644 --- a/src/overlays/l14/mobys/racer_path_and_weapon.c +++ b/src/overlays/l14/mobys/racer_path_and_weapon.c @@ -51,7 +51,7 @@ typedef struct RacerVars { s32 timer; f32 unk70[4]; u8 pad_80[0x4]; - s32 unk84; + s32 initial_position_path_index; s32 unk88; s16 nearest_segment; s16 lead_distance_blend_start_segment; @@ -140,7 +140,7 @@ int interpolate_racer_to_path_start(struct Moby *racer_moby) { remaining_frames = convert_integer_to_float(moby_data->timer); lerp_vector(&racer_moby->pos, ent + 0x10, - ((char *)l14_paths[moby_data->unk84]) + 0x10, + ((char *)l14_paths[moby_data->initial_position_path_index]) + 0x10, remaining_frames * moby_data->unk70[0]); return ok; } From d0babf5768db3a3c56aa32948edca48a38395700 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:33:21 +0000 Subject: [PATCH 488/758] decomp: clarify names in amoeboid_update unk84 -> movement_speed_cap: Authoritative amoeboid.c SHA-256 79c54145a99fbad4eb49ad30d010af7b71183c7f1e740b7d15c217d90f8de5b2 and original retail Ghidra agree: 0x002dad6c-0x002dad84 multiply frame_time by 4.0f and store the float at pvars+0x84. Retail 0x002dae30-0x002dae44 passes pvars+0x60 as movement_control with scale 1.0f to move_moby_with_ground_and_collision_checks. The supplied helper context reads movement_control->f24 (this same field, +0x84 = +0x60 +0x24), multiplies it by the scale, and clamps movement_control->f10 to its positive and negative bounds before constructing movement displacement. Thus this member is the movement speed cap, not merely an unidentified offset. The distinct field spelling preserves the existing local movement_speed_limit. --- src/overlays/l05/mobys/amoeboid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l05/mobys/amoeboid.c b/src/overlays/l05/mobys/amoeboid.c index c072bb7914..a594557d0c 100644 --- a/src/overlays/l05/mobys/amoeboid.c +++ b/src/overlays/l05/mobys/amoeboid.c @@ -35,7 +35,7 @@ typedef struct AmoeboidVars { f32 unk68; f32 unk6C; u8 pad_70[0x14]; - f32 unk84; + f32 movement_speed_cap; u8 pad_88[0x28]; s32 path_B0; s32 unkB4; @@ -70,7 +70,7 @@ void amoeboid_update(struct Moby *moby) { int r = truncate_float_to_s32(409.6f); float movement_speed_limit = frame_time * 4.0f; moby_data->unk60 = r; - moby_data->unk84 = movement_speed_limit; + moby_data->movement_speed_cap = movement_speed_limit; } break; case AMOEBOID_FOLLOW_PATH: { From f14e6df4459b8a65aba0c4a9496e25c2b388262a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:33:25 +0000 Subject: [PATCH 489/758] decomp: clarify names in update_platform_tilt_basis unk64 -> up_vector_y_velocity: Retail 0x002de304 loads moby->pvars into s4. At 0x002de5a4 target_up_vector[1] (sp+4) enters f12, 0x002de5a8 passes moby+0xE4 (rot_row2.y) in a0, and 0x002de5ac passes s4+0x64 in a1 to the spring call at 0x002de5b8. The authoritative C names this f32 field unk64 and supplies its address as vendor_spring's velocity argument. Supplied vendor_spring updates that persistent velocity from target-current error and adds it to current_value. The surrounding X/Z calls and subsequent normalization of rot_row2 at 0x002de5e8 establish that this is the up vector's Y-component spring velocity, not an angle. --- src/overlays/l14/mobys/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/platform.c b/src/overlays/l14/mobys/platform.c index e7276e73d4..c5de30ed35 100644 --- a/src/overlays/l14/mobys/platform.c +++ b/src/overlays/l14/mobys/platform.c @@ -46,7 +46,7 @@ typedef struct TiltingPlatformVars { u8 pad_30[0x2C]; s32 unk5C; f32 unk60; - f32 unk64; + f32 up_vector_y_velocity; f32 unk68; u8 pad_6C[0x4]; s32 timer_70; @@ -162,7 +162,7 @@ void update_platform_tilt_basis(char *moby, f32 unused_arg1, f32 unused_arg2) { 0.2f, 0.0f); vendor_spring((float *)&MOBY(moby)->rot_row2.y, - &platform_tilt_state->unk64, + &platform_tilt_state->up_vector_y_velocity, target_up_vector[1], 0.005f, 0.2f, From 4874890e78e0f4a33a98dd14b96835db84c3336a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:35:26 +0000 Subject: [PATCH 490/758] decomp: clarify names in collect_hoverboard_dummy_boosts unk260 -> movement_position: Retail 0x002cfc2c loads the input Moby pvars; 0x002cfc90 and 0x002cfcb0-0x002cfcdc copy pvars+0x260 into the adjusted position for candidate-position subtraction, while 0x002cfe14-0x002cfe18 subtract directly against that field. Original Ghidra iVar1+0x260/+0x268 matches the f32[4] source member. The authoritative C initializes it from Moby position, integrates yaw-directed delta and vertical speed into it, probes ground using it, then copies it to Moby position before adding 0.25 and sinusoidal bob offsets. These uses establish the dummy's movement position independently of the displayed offsets. unk2F6 -> boost_timer_frames: Retail 0x002cfd88-0x002cfda0 and 0x002cfedc-0x002cfef4 call scale_game_frames(120), load pvars+0x2F6 with lhu, add those frames and store with sh following the successful candidate-local spatial tests. Original Ghidra explicitly adds sVar3 to *(short *)(iVar1+0x2f6). In the authoritative C the u16 member is initialized to scale_game_frames(180), passed to fast_dec_timer_s16, and its active countdown selects the boost-speed target unk2B8 rather than ordinary speed, with nonzero also selecting boost effects. This proves a boost countdown measured in scaled game frames. --- .../l16/mobys/test_dummy_on_hoverboard.c | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c index 1382fa9b5d..af012fb4fb 100644 --- a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c +++ b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c @@ -164,7 +164,7 @@ typedef struct HoverboardDummyVars { u8 pad_1E1[0x67]; f32 unk248; u8 pad_24C[0x14]; - f32 unk260[4]; + f32 movement_position[4]; f32 unk270[4]; f32 unk280[4]; u8 pad_290[0x20]; @@ -185,7 +185,7 @@ typedef struct HoverboardDummyVars { s16 jump_landing_node_index; s16 unk2F2; s16 unk2F4; - u16 unk2F6; + u16 boost_timer_frames; } HoverboardDummyVars; /* Once the race has run for 180 frames, adds boost time when the dummy passes through a hoverboard_ring (0x473) @@ -220,7 +220,7 @@ void collect_hoverboard_dummy_boosts(struct Moby *moby) { float adjusted_position[4]; float m[16]; char *candidate_moby = enumerated_moby; - qcopy(adjusted_position, moby_pvars->unk260); + qcopy(adjusted_position, moby_pvars->movement_position); adjusted_position[2] += 0.8f; fast_vec_sub(displacement_vector, candidate_moby + 0x10, adjusted_position); if (!(8.0f < fast_vec_length(displacement_vector))) { @@ -230,7 +230,7 @@ void collect_hoverboard_dummy_boosts(struct Moby *moby) { if (absolute_float(displacement_vector[0]) < 0.5f && absolute_float(displacement_vector[1]) < 2.5f && absolute_float(displacement_vector[2]) < 2.5f) { - moby_pvars->unk2F6 += scale_game_frames(0x78); + moby_pvars->boost_timer_frames += scale_game_frames(0x78); moby_pvars->timer_2DC = scale_game_frames(0x3C); } } @@ -243,7 +243,7 @@ void collect_hoverboard_dummy_boosts(struct Moby *moby) { while (group_candidate_moby) { if (MOBY(group_candidate_moby)->oclass == 0x474) { float m[16]; - fast_vec_sub(displacement_vector, group_candidate_moby + 0x10, moby_pvars->unk260); + fast_vec_sub(displacement_vector, group_candidate_moby + 0x10, moby_pvars->movement_position); if (!(8.0f < fast_vec_length(displacement_vector))) { set_identity_matrix(m); transpose_rotation_matrix(m, group_candidate_moby + 0xC0); @@ -251,7 +251,7 @@ void collect_hoverboard_dummy_boosts(struct Moby *moby) { if (absolute_float(displacement_vector[0]) < 2.8f && absolute_float(displacement_vector[1]) < 1.4f && absolute_float(displacement_vector[2]) < 0.5f) { - moby_pvars->unk2F6 += scale_game_frames(0x78); + moby_pvars->boost_timer_frames += scale_game_frames(0x78); moby_pvars->timer_2DC = scale_game_frames(0x3C); } } @@ -585,7 +585,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { hoverboard_dummy_data->unk2C0 = path; FUN_L16_002cf9d0_c((Level16VendorVectorMoby *)moby, 0, path_node_or_explosion_position); qcopy(moby + 0x10, path_node_or_explosion_position); - qcopy(hoverboard_dummy_data->unk260, moby + 0x10); + qcopy(hoverboard_dummy_data->movement_position, moby + 0x10); *(int *)(moby + 0x40) = 0; *(int *)(moby + 0x44) = 0; MOBY(moby)->rot.z = fast_arc_tan(*(float *)(path + 0x20) - *(float *)(path + 0x10), @@ -618,7 +618,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { MOBY(moby)->collision = MOBY(moby)->pclass->collision; MOBY(moby)->flags &= ~0x41; hoverboard_dummy_data->unk2F4 = 0; - *(short *)&hoverboard_dummy_data->unk2F6 = scale_game_frames(180); + *(short *)&hoverboard_dummy_data->boost_timer_frames = scale_game_frames(180); *(int *)&hoverboard_dummy_data->unk2C8 = 0; hoverboard_dummy_data->unk2C4 = 0; hoverboard_dummy_data->jump_timer = 0; @@ -738,15 +738,15 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { frame_scale_sq * 0.035f, frame_scale_sq * 0.3f, D_0015ED6C * 6.981317f); - if (hoverboard_dummy_data->unk260[2] < path_node_or_explosion_position[2] - 5.0f) { - hoverboard_dummy_data->unk260[2] = path_node_or_explosion_position[2]; + if (hoverboard_dummy_data->movement_position[2] < path_node_or_explosion_position[2] - 5.0f) { + hoverboard_dummy_data->movement_position[2] = path_node_or_explosion_position[2]; } delta[0] = fast_cos(MOBY(moby)->rot.z) * hoverboard_dummy_data->unk2BC; delta[1] = fast_sin(MOBY(moby)->rot.z) * hoverboard_dummy_data->unk2BC; delta[2] = 0.0f; - fast_vec_add(hoverboard_dummy_data->unk260, hoverboard_dummy_data->unk260, delta); + fast_vec_add(hoverboard_dummy_data->movement_position, hoverboard_dummy_data->movement_position, delta); fast_vec_scale(ahead, delta, 3.0f); - fast_vec_add(ahead, ahead, hoverboard_dummy_data->unk260); + fast_vec_add(ahead, ahead, hoverboard_dummy_data->movement_position); ahead[2] += 0.7f; nearby_moby_count = collect_mobies_in_sphere(0.7f, ahead, 0, moby, 0); if (nearby_moby_count) { @@ -756,25 +756,25 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { spawn_nearby_effect(D_L16_00178300[i], (int)moby, mask, - hoverboard_dummy_data->unk260, + hoverboard_dummy_data->movement_position, impact, 1.0f); } } } - z = probe_ground_height(hoverboard_dummy_data->unk260, 0, 0.5f); - gap = hoverboard_dummy_data->unk260[2] - z; + z = probe_ground_height(hoverboard_dummy_data->movement_position, 0, 0.5f); + gap = hoverboard_dummy_data->movement_position[2] - z; if (gap > 0.0f || hoverboard_dummy_data->unk2C8 > 0.0f) { hoverboard_dummy_data->unk2C8 -= frame_time_sq * 21.0f; } else if (absolute_float(gap) < 0.5f) { hoverboard_dummy_data->unk2C8 = 0.0f; - hoverboard_dummy_data->unk260[2] = z; + hoverboard_dummy_data->movement_position[2] = z; hoverboard_dummy_data->jump_timer = 0; } - hoverboard_dummy_data->unk260[2] += hoverboard_dummy_data->unk2C8; - if (fast_dec_timer_s16(&hoverboard_dummy_data->unk2F6)) { + hoverboard_dummy_data->movement_position[2] += hoverboard_dummy_data->unk2C8; + if (fast_dec_timer_s16(&hoverboard_dummy_data->boost_timer_frames)) { speed = hoverboard_dummy_data->unk2B4; - if (z < hoverboard_dummy_data->unk260[2]) { + if (z < hoverboard_dummy_data->movement_position[2]) { speed = D_0015ED6C * 19.0f; } hero_base = ((char *)&hero); @@ -798,7 +798,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { frame_time_sq * 20.0f); } if (gap < 0.2f && hoverboard_dummy_data->unk2C8 < 0.0f) { - hoverboard_dummy_data->unk260[2] = z; + hoverboard_dummy_data->movement_position[2] = z; hoverboard_dummy_data->jump_timer = 0; } rate = *(float *)&hoverboard_dummy_data->unk2C4; @@ -839,7 +839,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { moby, &hoverboard_dummy_data->manipulator2, 2); - qcopy(moby + 0x10, hoverboard_dummy_data->unk260); + qcopy(moby + 0x10, hoverboard_dummy_data->movement_position); { float bob_time = D_0015ED6C; @@ -859,7 +859,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { fast_vec_add(spray, spray, lateral); qcopy(spray, ahead); spray[3] = 120000.0f; - if (*(short *)&hoverboard_dummy_data->unk2F6 == 0) { + if (*(short *)&hoverboard_dummy_data->boost_timer_frames == 0) { int ticks = random_int_between(scale_game_frames(10), scale_game_frames(13)); spawn_effect(impact, From 5f2e3a95be220b3a220c9071e2743bdc757d6367 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:37:38 +0000 Subject: [PATCH 491/758] decomp: clarify names in update_armed_transport_damage_and_targeting unk160 -> death_timer_frames: Retail 0x002e2d94-0x002e2da8 enters state 8 (ARMED_TRANSPORT_STATE_DYING), calls scale_game_frames with 90 at 0x002e2d9c, and stores its result to pvars+0x160. The authoritative armed_transport_update DYING branch decrements this same s32 with fast_dec_timer and on expiry spawns the death explosion/debris and marks the transport for removal, proving a death countdown measured in scaled frames. unk67 -> hit_animation_secondary_red: Retail 0x002e2d14 and 0x002e2dac store 120 to pvars+0x67 on hit/death responses; 0x002e2dc0-0x002e2dcc passes pvars+0x60 to trooper_anim_finish. Checked level-16 consumer 0x00258ec0-0x00258f10 reads relative byte +7 and interpolates from saved byte +4 toward it; 0x00258f8c-0x00258fd8 interpolates back. The computed channel is moved to a1 at 0x00259068 for the color setter. Supplied named trooper_anim_finish C identifies this channel as r1, the secondary red channel, and byte +4 as r0. Thus this byte controls the hit animation secondary red, rather than a duration. --- src/overlays/shared/enemies/armed_transport.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/enemies/armed_transport.c b/src/overlays/shared/enemies/armed_transport.c index 46c0d0a105..03400f5f07 100644 --- a/src/overlays/shared/enemies/armed_transport.c +++ b/src/overlays/shared/enemies/armed_transport.c @@ -37,7 +37,7 @@ typedef struct ArmedTransportVars { s8 unk28; u8 pad29[0x37]; u8 unk60[0x7]; - u8 unk67; + u8 hit_animation_secondary_red; u8 pad68[0x8]; f32 unk70[4]; u8 pad80[0x30]; @@ -52,7 +52,7 @@ typedef struct ArmedTransportVars { u8 unkE0[0x64]; f32 unk144; u8 pad148[0x18]; - s32 unk160; + s32 death_timer_frames; s32 unk164; s32 path_point; s32 path_segment_fraction; @@ -376,7 +376,7 @@ void armed_transport_update(char *transport_moby) { transport_data->base_height -= dt + dt; MOBY(transport_moby)->rot.x += dt * 0.2617994f; - if (fast_dec_timer((int *)(&transport_data->unk160)) || + if (fast_dec_timer((int *)(&transport_data->death_timer_frames)) || hero.vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK) { spawn_explosion(transport_moby, D_L16_0015F580, @@ -481,7 +481,7 @@ void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) { if (response >= 3) { if (response < 9) { FUN_0022da68_i(3, 0, transport_moby); - transport_data->unk67 = 120; + transport_data->hit_animation_secondary_red = 120; transport_data->unk188 = randf_sym(30.0f, 50.0f) * DEG_TO_RAD * frame_time; } } else { @@ -498,8 +498,8 @@ void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) { } while (--count >= 0); } transport_moby->state = ARMED_TRANSPORT_STATE_DYING; - transport_data->unk160 = scale_game_frames(90); - transport_data->unk67 = 120; + transport_data->death_timer_frames = scale_game_frames(90); + transport_data->hit_animation_secondary_red = 120; } } trooper_anim_update(transport_moby, &transport_data->unk60); From 1bb309dee82cb1b1101fcd1d09afe3cc6f19d02d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:37:41 +0000 Subject: [PATCH 492/758] decomp: clarify names in triggered_motion_update unk64 -> manipulator_angular_velocity: Authoritative C src/overlays/l05/mobys/triggered_motion.c SHA-256 137bd0c4af375220204c17f1467d8f82154c65da2d9921955807f5c83585e3c7 passes &unk60 (angle) and &unk64 together to approach_angle. Retail 00316434-00316468 passes pvars+0x60 and pvars+0x64 with frame-scaled acceleration and speed limits. After clamping the angle to 0..0.5934119, 003164f8-00316504 loads pvars+0x64, multiplies by -0.33, and stores it back, reversing and damping angular motion. 0031652c-00316538 applies the paired angle to the attached manipulator's axis-rotation quaternion; original Ghidra shows the same float update and bounce. --- src/overlays/l05/mobys/triggered_motion.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l05/mobys/triggered_motion.c b/src/overlays/l05/mobys/triggered_motion.c index 26fe86299b..f08b392ce0 100644 --- a/src/overlays/l05/mobys/triggered_motion.c +++ b/src/overlays/l05/mobys/triggered_motion.c @@ -31,7 +31,7 @@ typedef struct TriggeredMotionVars { s32 unk58; f32 unk5C; f32 unk60; - f32 unk64; + f32 manipulator_angular_velocity; } TriggeredMotionVars; /* Moby class 893 */ @@ -104,7 +104,7 @@ void triggered_motion_update(char *moby) { approach = -0.5934119f; } approach_angle(&motion_and_manipulator_vars->unk60, - &motion_and_manipulator_vars->unk64, + &motion_and_manipulator_vars->manipulator_angular_velocity, approach, frame_time_sq * 4.1887903f, frame_time_sq * 4.1887903f, @@ -117,7 +117,7 @@ void triggered_motion_update(char *moby) { motion_and_manipulator_vars->unk60 = 0.0f; if (MOBY(moby)->command == 0) { MOBY(moby)->command = 1; - motion_and_manipulator_vars->unk64 *= -0.33f; + motion_and_manipulator_vars->manipulator_angular_velocity *= -0.33f; } else if (motion_and_manipulator_vars->unk60 == end) { if (MOBY(moby)->state == MOBY_SETTLE_AT_UPPER_MANIPULATOR_ANGLE) MOBY(moby)->state = MOBY_MOTION_SEQUENCE_COMPLETE; From f7e79b3dae020b94a6817a681fff9bc9342f2615 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:37:45 +0000 Subject: [PATCH 493/758] decomp: clarify names in try_start_moby_hop f2C -> spatial_scale: Retail 0x002bfa60..0x002bfa78 loads moby+0x2c, multiplies by 5.2 and divides by class+0x24 to cap the target displacement's XY length. Checked helper 0x001ff600..0x001ff654 computes sqrt(x*x+y*y) and scales XY by limit/length only when length exceeds that limit. Retail 0x002bfb10..0x002bfb34 uses the same field times 3.0/class+0x24 as the accepted landing rise limit; 0x002bfb90..0x002bfbec uses times 0.025/class+0x24 for the landing occupancy offset; 0x002bfbf8..0x002bfc48 uses times 0.2/class+0x24 to raise both path endpoints. The assigned C expresses every use as moby->f2C. These independent spatial extents establish a shared spatial_scale, rather than an offset-only name. --- src/overlays/shared/weapons/doom_bot_movement.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/weapons/doom_bot_movement.c b/src/overlays/shared/weapons/doom_bot_movement.c index b24f794941..3d9bf10f0a 100644 --- a/src/overlays/shared/weapons/doom_bot_movement.c +++ b/src/overlays/shared/weapons/doom_bot_movement.c @@ -78,7 +78,7 @@ typedef struct Mob_2C0CF8 { char pad20[4]; Cls_2C0CF8 *p24; /* 0x24 */ char pad28[4]; - float f2C; /* 0x2C */ + float spatial_scale; /* 0x2C */ char pad30[0x8C]; unsigned char bBC; /* 0xBC */ } Mob_2C0CF8; @@ -584,7 +584,7 @@ int try_start_moby_hop(Mob_2C0CF8 *moby, Blk *block, void *target, int check_lin can_halve = 1; func_001F9BF0_2C0CF8(jump, target, moby->pos); - func_L00_001FF5B0_2C0CF8(moby->f2C * 5.2f / moby->p24->unk24, jump, jump); + func_L00_001FF5B0_2C0CF8(moby->spatial_scale * 5.2f / moby->p24->unk24, jump, jump); func_001F9BD8_2C0CF8(land, moby->pos, jump); func_001F9C30_2C0CF8(half, jump, 0.5f); half_length = func_001F9CE8_2C0CF8(half); @@ -600,7 +600,7 @@ int try_start_moby_hop(Mob_2C0CF8 *moby, Blk *block, void *target, int check_lin } return 0; } - if (moby->f2C * 3.0f / moby->p24->unk24 < jump[2]) { + if (moby->spatial_scale * 3.0f / moby->p24->unk24 < jump[2]) { if (can_halve) { return try_start_moby_hop(moby, block, half, 1); } @@ -616,18 +616,18 @@ int try_start_moby_hop(Mob_2C0CF8 *moby, Blk *block, void *target, int check_lin } return 0; } - land[2] = land[2] + moby->f2C * 0.025f / moby->p24->unk24; + land[2] = land[2] + moby->spatial_scale * 0.025f / moby->p24->unk24; if (probe_moby_raised_sphere_collision(moby, 6, land)) { if (can_halve) { return try_start_moby_hop(moby, block, half, 1); } return 0; } - land[2] = land[2] - moby->f2C * 0.025f / moby->p24->unk24; + land[2] = land[2] - moby->spatial_scale * 0.025f / moby->p24->unk24; qcopy_nc(from, moby->pos); - from[2] = from[2] + moby->f2C * 0.2f / moby->p24->unk24; + from[2] = from[2] + moby->spatial_scale * 0.2f / moby->p24->unk24; qcopy_nc(to, land); - to[2] = to[2] + moby->f2C * 0.2f / moby->p24->unk24; + to[2] = to[2] + moby->spatial_scale * 0.2f / moby->p24->unk24; if (check_line) { if (func_L00_001EFFF0_2C0CF8(from, to, 6, moby, 0) == 0) { if (can_halve) { From 6e2ffd4fe86c2107b8344088ddb76a339ed28f20 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:39:33 +0000 Subject: [PATCH 494/758] decomp: clarify names in unfolding_column_update f44 -> rotation_angle_radians: In the authoritative C, current_piece->f44 receives interpolate_angle(1.5707964f, 0.0f, remaining countdown * rate). Retail 0x00305f2c-0x00305f44 constructs 0x3fc90fdb (pi/2), calls the angle interpolation and stores f0 at selected piece+0x44. In the pivot branch, 0x00306028-0x00306048 multiplies unfolding_column_pivot_final_angle_degrees by 0.017453292 (degrees to radians), interpolates against zero with the remaining timer fraction and stores f0 at pivot+0x44. Both writes prove a rotation angle expressed in radians rather than an offset-only field role. --- src/overlays/l14/mobys/unfolding_column.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l14/mobys/unfolding_column.c b/src/overlays/l14/mobys/unfolding_column.c index fb5da5cf4f..ab8f0ed86e 100644 --- a/src/overlays/l14/mobys/unfolding_column.c +++ b/src/overlays/l14/mobys/unfolding_column.c @@ -18,7 +18,7 @@ typedef struct UnfoldingColumnMoby { float pos[4]; /* 0x10 */ unsigned char state; /* 0x20 */ char pad21[0x23]; - float f44; /* 0x44 */ + float rotation_angle_radians; /* 0x44 */ char pad48[0x30]; struct UnfoldingColumnVars *data; /* 0x78 */ char pad7C[0x44]; @@ -123,7 +123,7 @@ void unfolding_column_update(UnfoldingColumnMoby *moby) { UnfoldingColumnPieces *pieces = &data->pieces; UnfoldingColumnMoby *current_piece = pieces->m[data->cur]; fast_dec_timer_s16(&data->timer); - current_piece->f44 = + current_piece->rotation_angle_radians = interpolate_angle(1.5707964f, 0.0f, convert_integer_to_float(data->timer) * data->rate); if (data->timer == 0) { data->timer = scale_game_frames(unfolding_column_piece_unfold_frames); @@ -149,7 +149,7 @@ void unfolding_column_update(UnfoldingColumnMoby *moby) { fast_dec_timer_s16(&data->timer); pieces = data->pieces.m; remaining_timer_fraction = convert_integer_to_float(data->timer) * data->rate; - pivot->f44 = + pivot->rotation_angle_radians = interpolate_scalar_linear(unfolding_column_pivot_final_angle_degrees * 0.017453292f, 0.0f, remaining_timer_fraction); From 27cc944e3c1e8523c8762cd6c87c123ebb4d3874 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:39:37 +0000 Subject: [PATCH 495/758] decomp: clarify names in moby_volume_trigger_update unk25 -> second_moby_entry_state: On volume entry (clip test nonzero and latch +0x38 zero), retail 0x002b0f4c..0x002b0f8c resolves the second configured moby from pvars+0x08 using moby_base+(uid<<8), skips states 0xFE/0xFD, and copies signed byte +0x25 to its state byte +0x20 unless -1. The assigned C implements precisely this second target entry-state assignment. unk26 -> third_moby_entry_state: Retail entry path 0x002b0fb4..0x002b0ff4 resolves the third configured moby from pvars+0x0C, excludes moby states 0xFE/0xFD, tests signed pvars+0x26 against -1, then stores that byte to target+0x20. The assigned C confirms this is the third target moby's configured state on entry. unk27 -> fourth_moby_entry_state: Retail 0x002b101c..0x002b105c resolves the fourth target using pvars+0x10 and moby_base+(uid<<8); after target/state validity checks it copies pvars+0x27 to target+0x20 unless -1. This lies in the once-per-entry branch and matches the fourth target state assignment in the supplied C. unk2B -> fourth_moby_exit_state: Retail exit branch is gated by a zero clip test and prior latch +0x38 equal to 1. At 0x002b11f4..0x002b1234 the fourth target from pvars+0x10 receives pvars+0x2B at state byte +0x20 unless -1, with 0xFE/0xFD states excluded. The C confirms fourth moby state on exit. unk2D -> second_list_entry_state: In the entry branch, retail 0x002b0f90 loads the second configured list from pvars+0x18 into a0; 0x002b0fa0 loads signed +0x2D into a1, checks -1, and 0x002b0fac calls the list helper. Assigned C identifies that call as set_moby_list_state(unk18, unk2D); the supplied helper writes its state argument to each list member's +0x20. unk2E -> third_list_entry_state: Retail 0x002b0ff8 loads the third list selector from pvars+0x1C; 0x002b1008 loads signed +0x2E as a1 and 0x002b1014 calls the helper after -1 checks, within the entry branch. Supplied C calls set_moby_list_state(unk1C, unk2E), whose checked context writes the supplied state to member mobys. unk2F -> fourth_list_entry_state: Retail entry path 0x002b1060..0x002b107c passes pvars+0x20 as a0 and signed pvars+0x2F as a1 to the list helper when neither is -1. The C identifies set_moby_list_state(unk20, unk2F), and the supplied helper context establishes the second argument as member moby state; this is the fourth configured list. unk31 -> second_list_exit_state: Retail exit path 0x002b1168..0x002b1184 passes the second list selector pvars+0x18 and signed state byte +0x31 to the helper after -1 checks. C calls set_moby_list_state(unk18, unk31); helper context proves the state argument is written to the list's moby members. The latch equals 1 before this outside-volume path runs. unk32 -> third_list_exit_state: Retail 0x002b11d0 loads pvars+0x1C (third list) into a0, 0x002b11e0 loads signed +0x32 into a1, and 0x002b11ec calls the helper after sentinel checks on the exit path. Assigned C identifies set_moby_list_state(unk1C, unk32), with supplied helper context proving member-state assignment. unk33 -> fourth_list_exit_state: Retail exit path 0x002b1238..0x002b1254 passes the fourth list selector at pvars+0x20 and signed byte +0x33 to the helper unless either is -1. Assigned C calls set_moby_list_state(unk20, unk33); supplied helper context writes this state to list members. The branch ends by clearing the inside latch. unk35 -> trigger_exit_state: Retail 0x002b125c..0x002b126c tests signed pvars+0x35 against -1 and copies it to the original trigger moby's +0x20, not a resolved target. Assigned C names this destination MOBY(moby)->state. This executes on exit immediately before clearing latch +0x38 at 0x002b1280. unk37 -> trigger_exit_command: Retail 0x002b1270..0x002b127c tests signed pvars+0x37 against -1 and copies it to the original trigger moby's +0xBC in the exit branch. Assigned C explicitly names the destination MOBY(moby)->command. This proves a configured trigger command on exit without claiming the command's downstream behavior. --- src/overlays/l13/mobys/moby_volume_trigger.c | 72 ++++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/overlays/l13/mobys/moby_volume_trigger.c b/src/overlays/l13/mobys/moby_volume_trigger.c index 19d7aa4cf8..649878a836 100644 --- a/src/overlays/l13/mobys/moby_volume_trigger.c +++ b/src/overlays/l13/mobys/moby_volume_trigger.c @@ -32,25 +32,25 @@ typedef struct MobyVolumeTriggerVars { s32 unk1C; s32 unk20; s8 unk24; - s8 unk25; - s8 unk26; - s8 unk27; + s8 second_moby_entry_state; + s8 third_moby_entry_state; + s8 fourth_moby_entry_state; s8 unk28; s8 unk29; s8 unk2A; - s8 unk2B; + s8 fourth_moby_exit_state; s8 unk2C; - s8 unk2D; - s8 unk2E; - s8 unk2F; + s8 second_list_entry_state; + s8 third_list_entry_state; + s8 fourth_list_entry_state; s8 unk30; - s8 unk31; - s8 unk32; - s8 unk33; + s8 second_list_exit_state; + s8 third_list_exit_state; + s8 fourth_list_exit_state; s8 unk34; - s8 unk35; + s8 trigger_exit_state; s8 unk36; - s8 unk37; + s8 trigger_exit_command; s8 unk38; } MobyVolumeTriggerVars; @@ -89,15 +89,15 @@ void moby_volume_trigger_update(char *moby) { unsigned char st = m[0x20]; if (st != 0xFE) { if (st != 0xFD) { - if (volume_trigger_vars->unk25 != -1) - m[0x20] = volume_trigger_vars->unk25; + if (volume_trigger_vars->second_moby_entry_state != -1) + m[0x20] = volume_trigger_vars->second_moby_entry_state; } } } } } - if (volume_trigger_vars->unk18 != -1 && volume_trigger_vars->unk2D != -1) - set_moby_list_state(volume_trigger_vars->unk18, volume_trigger_vars->unk2D); + if (volume_trigger_vars->unk18 != -1 && volume_trigger_vars->second_list_entry_state != -1) + set_moby_list_state(volume_trigger_vars->unk18, volume_trigger_vars->second_list_entry_state); { int uid = volume_trigger_vars->unkC; if (uid != -1) { @@ -106,15 +106,15 @@ void moby_volume_trigger_update(char *moby) { unsigned char st = m[0x20]; if (st != 0xFE) { if (st != 0xFD) { - if (volume_trigger_vars->unk26 != -1) - m[0x20] = volume_trigger_vars->unk26; + if (volume_trigger_vars->third_moby_entry_state != -1) + m[0x20] = volume_trigger_vars->third_moby_entry_state; } } } } } - if (volume_trigger_vars->unk1C != -1 && volume_trigger_vars->unk2E != -1) - set_moby_list_state(volume_trigger_vars->unk1C, volume_trigger_vars->unk2E); + if (volume_trigger_vars->unk1C != -1 && volume_trigger_vars->third_list_entry_state != -1) + set_moby_list_state(volume_trigger_vars->unk1C, volume_trigger_vars->third_list_entry_state); { int uid = volume_trigger_vars->unk10; if (uid != -1) { @@ -123,15 +123,15 @@ void moby_volume_trigger_update(char *moby) { unsigned char st = m[0x20]; if (st != 0xFE) { if (st != 0xFD) { - if (volume_trigger_vars->unk27 != -1) - m[0x20] = volume_trigger_vars->unk27; + if (volume_trigger_vars->fourth_moby_entry_state != -1) + m[0x20] = volume_trigger_vars->fourth_moby_entry_state; } } } } } - if (volume_trigger_vars->unk20 != -1 && volume_trigger_vars->unk2F != -1) - set_moby_list_state(volume_trigger_vars->unk20, volume_trigger_vars->unk2F); + if (volume_trigger_vars->unk20 != -1 && volume_trigger_vars->fourth_list_entry_state != -1) + set_moby_list_state(volume_trigger_vars->unk20, volume_trigger_vars->fourth_list_entry_state); if (volume_trigger_vars->unk34 != -1) MOBY(moby)->state = volume_trigger_vars->unk34; if (volume_trigger_vars->unk36 != -1) @@ -172,8 +172,8 @@ void moby_volume_trigger_update(char *moby) { } } } - if (volume_trigger_vars->unk18 != -1 && volume_trigger_vars->unk31 != -1) - set_moby_list_state(volume_trigger_vars->unk18, volume_trigger_vars->unk31); + if (volume_trigger_vars->unk18 != -1 && volume_trigger_vars->second_list_exit_state != -1) + set_moby_list_state(volume_trigger_vars->unk18, volume_trigger_vars->second_list_exit_state); { int uid = volume_trigger_vars->unkC; if (uid != -1) { @@ -189,8 +189,8 @@ void moby_volume_trigger_update(char *moby) { } } } - if (volume_trigger_vars->unk1C != -1 && volume_trigger_vars->unk32 != -1) - set_moby_list_state(volume_trigger_vars->unk1C, volume_trigger_vars->unk32); + if (volume_trigger_vars->unk1C != -1 && volume_trigger_vars->third_list_exit_state != -1) + set_moby_list_state(volume_trigger_vars->unk1C, volume_trigger_vars->third_list_exit_state); { int uid = volume_trigger_vars->unk10; if (uid != -1) { @@ -199,19 +199,19 @@ void moby_volume_trigger_update(char *moby) { unsigned char st = m[0x20]; if (st != 0xFE) { if (st != 0xFD) { - if (volume_trigger_vars->unk2B != -1) - m[0x20] = volume_trigger_vars->unk2B; + if (volume_trigger_vars->fourth_moby_exit_state != -1) + m[0x20] = volume_trigger_vars->fourth_moby_exit_state; } } } } } - if (volume_trigger_vars->unk20 != -1 && volume_trigger_vars->unk33 != -1) - set_moby_list_state(volume_trigger_vars->unk20, volume_trigger_vars->unk33); - if (volume_trigger_vars->unk35 != -1) - MOBY(moby)->state = volume_trigger_vars->unk35; - if (volume_trigger_vars->unk37 != -1) - MOBY(moby)->command = volume_trigger_vars->unk37; + if (volume_trigger_vars->unk20 != -1 && volume_trigger_vars->fourth_list_exit_state != -1) + set_moby_list_state(volume_trigger_vars->unk20, volume_trigger_vars->fourth_list_exit_state); + if (volume_trigger_vars->trigger_exit_state != -1) + MOBY(moby)->state = volume_trigger_vars->trigger_exit_state; + if (volume_trigger_vars->trigger_exit_command != -1) + MOBY(moby)->command = volume_trigger_vars->trigger_exit_command; volume_trigger_vars->unk38 = 0; } } From 2393695962d76fc58b99032d2c036db40739b127 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:39:40 +0000 Subject: [PATCH 496/758] decomp: clarify names in update_plasmabot_aim_joint_rotation unk268 -> aim_yaw_offset: Retail 0x002b37c8 loads vars+0x268 and 0x002b37d0 negates it before combining it with negative wrapped target-heading minus body heading at 0x002b37cc-0x002b37dc. In the authoritative C, update_plasmabot_aim_quaternion approaches this f32 toward fast_subtract_rotations(target_angle, MOBY(moby)->rot.z), clamped to +/-1.22173047, then passes it to build_axis_rotation_quaternion(&state->unk170, 2, state->unk268). This proves the smoothed body-relative aim yaw offset, rather than a target or a velocity. unk274 -> aim_joint_angular_velocity: Retail 0x002b3840/0x002b384c pass vars+0x270 and vars+0x274 as the current-angle and companion float pointers to approach_angle at 0x002b3864; 0x002b386c-0x002b3878 apply the resulting +0x270 angle to the joint quaternion. Bounded checked helper 0x00264180 saves the second pointer in s0 (0x00264194), reads it as float (0x002641d0), uses its square divided by the deceleration coefficient in the stopping-distance calculation (0x002641fc-0x00264210), adjusts it toward signed step limits, and adds its current value to the angle through fast_add_rotations at 0x00264314-0x00264320. This proves the joint angular velocity/step state despite its preserved s32 storage declaration. --- src/overlays/shared/enemies/plasmabot.c | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index 3efb0329fa..02239b91d7 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -105,10 +105,10 @@ typedef struct PlasmabotVars { s16 beam_cooldown_timer; s16 unk262; s32 unk264; - f32 unk268; + f32 aim_yaw_offset; s32 unk26C; s32 unk270; - s32 unk274; + s32 aim_joint_angular_velocity; f32 unk278; f32 path_traversal_direction; s32 unk280; @@ -215,7 +215,7 @@ void update_plasmabot_aim_joint_rotation(char *moby, float x) __asm__("FUN_L14_0 void update_plasmabot_aim_joint_rotation(char *moby, float x) { PlasmabotVars *moby_vars = (PlasmabotVars *)MOBY(moby)->pvars; - float target_joint_angle = -moby_vars->unk268; + float target_joint_angle = -moby_vars->aim_yaw_offset; float heading_angle_delta = fast_subtract_rotations(x, MOBY(moby)->rot.z); target_joint_angle = fast_add_rotations(target_joint_angle, -heading_angle_delta); if (target_joint_angle > 1.2217304706573486f) @@ -225,7 +225,7 @@ void update_plasmabot_aim_joint_rotation(char *moby, float x) { { float k = frame_time_sq * 12.566370964050293f; approach_angle((float *)(&moby_vars->unk270), - (float *)(&moby_vars->unk274), + (float *)(&moby_vars->aim_joint_angular_velocity), target_joint_angle, k, k, @@ -462,12 +462,12 @@ void plasmabot_update(char *moby) { plasmabot_update_private_vars->unk248 = 0; plasmabot_update_private_vars->heading_angular_velocity = 0; plasmabot_update_private_vars->beam_cooldown_timer = 0; - *(int *)&plasmabot_update_private_vars->unk268 = 0; + *(int *)&plasmabot_update_private_vars->aim_yaw_offset = 0; plasmabot_update_private_vars->unk26C = 0; plasmabot_update_private_vars->unk280 = 0; plasmabot_update_private_vars->unk284 = 0; plasmabot_update_private_vars->unk270 = 0; - plasmabot_update_private_vars->unk274 = 0; + plasmabot_update_private_vars->aim_joint_angular_velocity = 0; if (((unsigned char *)plasmabot_update_private_vars)[0x121] == 0) { attach_manipulator(moby, 2, &plasmabot_update_private_vars->unk120); } @@ -504,16 +504,16 @@ void plasmabot_update(char *moby) { set_moby_animation(moby, 1, 0); path = (float *)l14_paths[plasmabot_update_private_vars->path_index]; MOBY(moby)->rot.z = fast_arc_tan(path[8] - path[4], path[9] - path[5]); - *(int *)&plasmabot_update_private_vars->unk268 = 0; + *(int *)&plasmabot_update_private_vars->aim_yaw_offset = 0; plasmabot_update_private_vars->path_traversal_direction = 1.0f; plasmabot_update_private_vars->unk26C = 0; plasmabot_update_private_vars->unk270 = 0; - plasmabot_update_private_vars->unk274 = 0; + plasmabot_update_private_vars->aim_joint_angular_velocity = 0; plasmabot_update_private_vars->path_segment_index = 0; *(int *)&plasmabot_update_private_vars->path_offset_and_spring_velocities = 0; - plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = plasmabot_update_private_vars->unk268; - plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = plasmabot_update_private_vars->unk268; - plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = plasmabot_update_private_vars->unk268; + plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = plasmabot_update_private_vars->aim_yaw_offset; + plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = plasmabot_update_private_vars->aim_yaw_offset; + plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = plasmabot_update_private_vars->aim_yaw_offset; return; } case PLASMABOT_START_PATH_TRAVERSAL: @@ -1256,14 +1256,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->unk268), + func_L00_0025CE58_2B4828((float *)(&state->aim_yaw_offset), turn, (float *)(&state->unk26C), yaw_easing_coefficient, yaw_easing_coefficient, frame_time * 6.2831854820251465f); } - build_axis_rotation_quaternion(&state->unk170, 2, state->unk268); + build_axis_rotation_quaternion(&state->unk170, 2, state->aim_yaw_offset); if (flag) { float owner_aim_position[4]; float owner_aim_offset[4]; @@ -1290,7 +1290,7 @@ float update_plasmabot_aim_quaternion(char *moby, int flag, float target_angle) build_axis_rotation_quaternion(cp, 1, *(float *)&state->unk280); multiply_quaternions(&state->unk170, &state->unk170, cp); } - return fast_difference_between_rotations(turn, state->unk268); + return fast_difference_between_rotations(turn, state->aim_yaw_offset); } extern short *D_L14_001ABF40_3920[] __asm__("D_L14_001ABF40"); From 7ab41a07f37a1ebebe1d7a84e4abec9b39dac621 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:39:43 +0000 Subject: [PATCH 497/758] decomp: clarify names in select_blarg_elite_commando_movement_animation unk300 -> selected_path_node_index: Retail 0x002d4088 loads pvars; 0x002d4094 loads signed short pvars+0x300, and 0x002d40a4 shifts it by four. At 0x002d40a8-0x002d40c0 this selects the 16-byte node in the path table indexed by pvars+0x120, whose XY coordinates supply the bearing to the node. In the authoritative source, initialization stores random node into unk300 and copies that node's position; IDLE advances unk300 modulo two before patrol/attack movement, and both movement states pass path+0x10+unk300*16 as their destination. These uses prove selected_path_node_index rather than a path-table index. --- src/overlays/shared/enemies/blarg_elite_commando.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_elite_commando.c b/src/overlays/shared/enemies/blarg_elite_commando.c index ae1081e99d..6c1f641595 100644 --- a/src/overlays/shared/enemies/blarg_elite_commando.c +++ b/src/overlays/shared/enemies/blarg_elite_commando.c @@ -112,7 +112,7 @@ typedef struct L16DamageData { f32 unk2F4; f32 unk2F8; f32 unk2FC; - s16 unk300; + s16 selected_path_node_index; s16 unk302; s32 unk304; int reward_hits; @@ -266,7 +266,7 @@ void blarg_elite_commando_update(char *commando_moby) { if (commando_data->unk120 >= 0) { int node = truncate_float_to_s32(random_float_between( 0.0f, (float)(*(int *)D_L16_001B0930[commando_data->unk120] - 1))); - commando_data->unk300 = node; + commando_data->selected_path_node_index = node; qcopy(position, D_L16_001B0930[commando_data->unk120] + (short)node * 16 + 0x10); } commando_data->reward_hits = 1; @@ -326,7 +326,7 @@ void blarg_elite_commando_update(char *commando_moby) { MOBY(commando_moby)->state = COMMANDO_STATE_MOVE_TO_ATTACK_NODE; commando_data->state_countdown_ticks = truncate_float_to_s32(scale_time(random_float_between(30.0f, 90.0f))); - commando_data->unk300 = (commando_data->unk300 + 1) % 2; + commando_data->selected_path_node_index = (commando_data->selected_path_node_index + 1) % 2; select_blarg_elite_commando_movement_animation(commando_moby); } else if (!random_integer_below(20)) { MOBY(commando_moby)->state = COMMANDO_STATE_PREPARE_ROCKET_FIRE; @@ -337,7 +337,7 @@ void blarg_elite_commando_update(char *commando_moby) { } } else if (fast_dec_timer_s16(&commando_data->unk302)) { if (commando_data->unk120 >= 0) { - commando_data->unk300 = (commando_data->unk300 + 1) % 2; + commando_data->selected_path_node_index = (commando_data->selected_path_node_index + 1) % 2; MOBY(commando_moby)->state = COMMANDO_STATE_MOVE_TO_PATROL_NODE; commando_data->unk302 = scale_game_frames(180); select_blarg_elite_commando_movement_animation(commando_moby); @@ -347,7 +347,7 @@ void blarg_elite_commando_update(char *commando_moby) { case COMMANDO_STATE_MOVE_TO_PATROL_NODE: { float path_distance = func_L16_002D5280_update(commando_moby, D_L16_001B0930[commando_data->unk120] + - (commando_data->unk300 * 16 + 0x10), + (commando_data->selected_path_node_index * 16 + 0x10), 1); if (path_distance < 0.01f) { MOBY(commando_moby)->state = COMMANDO_STATE_IDLE; @@ -419,7 +419,7 @@ void blarg_elite_commando_update(char *commando_moby) { case COMMANDO_STATE_MOVE_TO_ATTACK_NODE: distance = func_L16_002D5280_update(commando_moby, D_L16_001B0930[commando_data->unk120] + - (commando_data->unk300 * 16 + 0x10), + (commando_data->selected_path_node_index * 16 + 0x10), 1); fast_dec_timer_s16(&commando_data->state_countdown_ticks); if (distance < 0.01f || commando_data->state_countdown_ticks == 0) { @@ -760,7 +760,7 @@ void randomize_blarg_elite_commando_group_pursuit_timers(void *group_source_moby /* Ported from rac1-decomp (src/overlays/shared/vendor_002A1B58.c: func_L16_002D5438), where it is exact; names translated to the US level program. */ void select_blarg_elite_commando_movement_animation(char *moby) { L16DamageData *commando_path_state = (L16DamageData *)MOBY(moby)->pvars; - char *target = D_L16_001B0930[commando_path_state->unk120] + (commando_path_state->unk300 << 4); + char *target = D_L16_001B0930[commando_path_state->unk120] + (commando_path_state->selected_path_node_index << 4); float angle = fast_arc_tan(*(float *)(target + 0x10) - MOBY(moby)->pos.x, *(float *)(target + 0x14) - MOBY(moby)->pos.y); float delta = fast_subtract_rotations(angle, MOBY(moby)->rot.z); From 768fa8207535c6b16d2ad24dfe332fc3d54c2a8f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:41:43 +0000 Subject: [PATCH 498/758] decomp: clarify names in drek_fight_missile_update unk110 -> wander_destination_position: Retail 0x002efcf0-0x002efcf8 passes pvars+0x110 to select_drek_fight_missile_wander_target; 0x002efd1c-0x002efd38 passes the same storage to wander movement and target reselection. Bounded helper 0x002f013c-0x002f015c retains that argument and subtracts moby position to calculate target yaw; supplied selector C writes the randomized world destination vector there. The member names the start of existing destination storage without changing its u8 declaration. unk14C -> dive_motion_blend_factor: Retail 0x002efd98 zeros pvars+0x14C on entering dive. 0x002efde4-0x002efdf4 approaches that storage as a float toward 1.0 by frame_time; 0x002efdf8-0x002efe08 loads it into the interpolation factor for lerp_vector between captured wander motion at pvars+0x130 and the normalized ground-directed dive step. Thus it controls the dive motion blend, while its existing s32 storage type is preserved. unk168 -> effect_color_phase: Retail 0x002efca4-0x002efcac initializes pvars+0x168 from random_angle_radians. Supplied render_drek_fight_missile_group_effects C applies fast_sin to this field, scales it by 0.5 and adds 0.5 as the color interpolation factor between effect start/end colors; it advances the same angle using moving or wait-to-explode phase steps. These uses establish an effect color phase rather than a motion heading. unk16C -> activating_moby: Supplied activate_drek_fight_missiles_in_group C stores its caller moby argument at missile pvars+0x16C when enabling a waiting missile. Bounded retail wander helper 0x002f0238-0x002f024c reads that pointer and subtracts its +0x10 position, then 0x002f02a0-0x002f02b0 adds that position to redirect the destination away from it. Assigned retail 0x002eff68-0x002eff9c passes the same stored pointer as spawn_explosion's first argument. The name records the proven activation relationship without asserting damage attribution. --- src/overlays/l18/mobys/drek_fight_missile.c | 22 ++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l18/mobys/drek_fight_missile.c b/src/overlays/l18/mobys/drek_fight_missile.c index bc852819aa..93b3997dfe 100644 --- a/src/overlays/l18/mobys/drek_fight_missile.c +++ b/src/overlays/l18/mobys/drek_fight_missile.c @@ -99,7 +99,7 @@ void drek_fight_missile_update(struct Moby *moby) __asm__("FUN_L18_002efb88"); typedef struct DrekFightMissileVars { u8 pad_0[0x110]; - u8 unk110; + u8 wander_destination_position; u8 pad_111[0xF]; u8 unk120; u8 pad_121[0x7]; @@ -109,7 +109,7 @@ typedef struct DrekFightMissileVars { u8 pad_140[0x4]; f32 unk144; u8 pad_148[0x4]; - s32 unk14C; + s32 dive_motion_blend_factor; f32 unk150; f32 unk154; f32 unk158; @@ -117,8 +117,8 @@ typedef struct DrekFightMissileVars { s32 timer_160; s16 unk164; u8 pad_166[0x2]; - f32 unk168; - void *unk16C; + f32 effect_color_phase; + void *activating_moby; } DrekFightMissileVars; /* Moby class 1355 */ @@ -144,12 +144,12 @@ void drek_fight_missile_update(struct Moby *moby) { missile_vars->unk154 = initialization_frame_time * 12.566371f; missile_vars->unk150 = wander_acceleration_scale * 3.1415927f; missile_vars->unk15C = initialization_frame_time * 10.0f; - missile_vars->unk168 = random_angle_radians(); + missile_vars->effect_color_phase = random_angle_radians(); moby->draw_dist = 0xFF; qcopy(&missile_vars->unk120, &moby->pos); missile_vars->unk128 += 5.0f; missile_vars->unk128 = probe_ground_height(&missile_vars->unk120, 0, 0.5f); - select_drek_fight_missile_wander_target(moby, &missile_vars->unk110); + select_drek_fight_missile_wander_target(moby, &missile_vars->wander_destination_position); moby->state = DREK_MISSILE_WAIT_FOR_ACTIVATION; moby->flags |= 1; moby->visible = 0; @@ -157,7 +157,7 @@ void drek_fight_missile_update(struct Moby *moby) { break; } case DREK_MISSILE_WANDER: { - char *wander_target_position = &missile_vars->unk110; + char *wander_target_position = &missile_vars->wander_destination_position; if (update_drek_fight_missile_wander_movement(moby, (float *)wander_target_position)) { select_drek_fight_missile_wander_target(moby, wander_target_position); } @@ -173,7 +173,7 @@ void drek_fight_missile_update(struct Moby *moby) { fast_sin(moby->rot.z) * (*(float *)&l18_drek_missile_wander_horizontal_speed_gp * frame_time); missile_vars->unk130[2] = missile_vars->unk144; - missile_vars->unk14C = 0; + missile_vars->dive_motion_blend_factor = 0; break; } case DREK_MISSILE_DIVE: { @@ -183,11 +183,11 @@ void drek_fight_missile_update(struct Moby *moby) { fast_vec_normalize(dive_movement_step, dive_movement_step, *(float *)&l18_drek_missile_dive_speed_gp * frame_time); - approach_value((float *)&missile_vars->unk14C, 1.0f, frame_time); + approach_value((float *)&missile_vars->dive_motion_blend_factor, 1.0f, frame_time); lerp_vector(dive_movement_step, missile_vars->unk130, dive_movement_step, - *(float *)&missile_vars->unk14C); + *(float *)&missile_vars->dive_motion_blend_factor); fast_vec_add(&moby->pos, &moby->pos, dive_movement_step); moby->rot.z = fast_arc_tan(dive_movement_step[0], dive_movement_step[1]); moby->rot.y = -fast_arc_tan(vector_length_xy(dive_movement_step), dive_movement_step[2]); @@ -217,7 +217,7 @@ void drek_fight_missile_update(struct Moby *moby) { char *pos = &moby->pos; moby->state = DREK_MISSILE_WANDER; missile_vars->unk164 = 0; - spawn_explosion(missile_vars->unk16C, + spawn_explosion(missile_vars->activating_moby, D_L18_0015F580, pos, 1.0f, From f33499f8c67e4c2bb2ee6302f757908d9ecc51ab Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:41:46 +0000 Subject: [PATCH 499/758] decomp: clarify names in update_scoutbot_movement unk204 -> vertical_bob_phase: Retail 0x002d3e24-0x002d3e38 loads pvars+0x204 and +0x20c into fast_add_rotations and stores the returned angle back at +0x204. At 0x002d3e34-0x002d3e50 its sine is multiplied by vertical_bob_amplitude (+0x208) and added to home Z (+0x1c8). The assigned C expresses this exact flow, proving this field is the advancing phase of vertical bobbing; scoutbot_update's same-layout f204 initialization uses random_angle_radians(). unk20C -> vertical_bob_phase_increment: Retail 0x002d3e24 loads pvars+0x20c into f13; 0x002d3e28-0x002d3e38 adds it to the +0x204 phase through fast_add_rotations and stores the new phase. The following sine/amplitude/home-Z calculation proves its vertical bob role. In the assigned source, scoutbot_update initializes the same-layout f20C to frame_time * 2.0943952f, corroborating a per-update phase increment rather than an amplitude or absolute angle. unk216 -> ground_hover_offset_enabled: Retail 0x002d3e48 loads the signed halfword at pvars+0x216; 0x002d3e4c skips the +0x200 height addition when it is zero, while 0x002d3e54-0x002d3e58 adds that offset to home Z plus the sine bob when nonzero. The assigned source's same-layout Data_3DF8.near_ground is initialized to 1 when a ground probe supplies home[2], otherwise 0 with home[2] equal to moby Z. This proves the flag enables the ground-related hover height offset. --- src/overlays/shared/enemies/scoutbot.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index 37b64a1110..ddf44e9f56 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -50,11 +50,11 @@ typedef struct ScoutbotVars { f32 unk1E0[4]; u8 pad1F0[0x10]; f32 unk200; - f32 unk204; + f32 vertical_bob_phase; f32 vertical_bob_amplitude; - f32 unk20C; + f32 vertical_bob_phase_increment; u8 pad210[0x6]; - s16 unk216; + s16 ground_hover_offset_enabled; char *unk218; s32 target_path_index; u8 glow_quad_anchor_position[0x4]; @@ -606,11 +606,11 @@ void update_scoutbot_movement(struct Moby *moby) { velocity_ptr = (float *)(&scoutbot_instance_state->unk40); fast_vec_normalize(velocity_ptr, velocity_ptr, movement_length); fast_vec_add((float *)&moby->pos, (float *)&moby->pos, velocity_ptr); - scoutbot_instance_state->unk204 = - fast_add_rotations(scoutbot_instance_state->unk204, scoutbot_instance_state->unk20C); + scoutbot_instance_state->vertical_bob_phase = + fast_add_rotations(scoutbot_instance_state->vertical_bob_phase, scoutbot_instance_state->vertical_bob_phase_increment); target_height = scoutbot_instance_state->unk1C0[2] + - scoutbot_instance_state->vertical_bob_amplitude * fast_sin(scoutbot_instance_state->unk204); - if (scoutbot_instance_state->unk216) + scoutbot_instance_state->vertical_bob_amplitude * fast_sin(scoutbot_instance_state->vertical_bob_phase); + if (scoutbot_instance_state->ground_hover_offset_enabled) target_height += scoutbot_instance_state->unk200; vertical_step = target_height - moby->pos.z; { From 49766c33bdcc066d2a2d67773b3d6dc88e90e238 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:41:49 +0000 Subject: [PATCH 500/758] decomp: clarify names in update_blarg_heavy_interceptor_return_path_position unk208 -> return_path_complete: Retail 0x002ae930/0x002ae93c tests the s16 at pvars+0x208 before path sampling; 0x002ae988-0x002ae990 latches it to 1 when the sampler returns nonzero. Subsequent calls copy the last path node at 0x002ae944-0x002ae954 instead of advancing sampling. Bound C resets this field when entering the return-path phases and tests it in INTERCEPTOR_STATE_FOLLOW_RETURN_PATH to begin INTERCEPTOR_STATE_REJOIN_PATROL. This proves a return-path sampling-completion latch, independently of eased position arrival. unk8C -> path_point_segment_distance: Retail 0x002ae970 and 0x002ae978 pass mutable pvars+0x80 (source path_point) and pvars+0x8C together to the path sampler at 0x002ae980, with speed*frame_time*direction as the distance increment. Bound C initializes unk8C to zero with path_point=0; on reverse traversal it sets path_point=p->count-2 and unk8C=p->points[path_point].f[3]. initialize_blarg_heavy_interceptor_paths fills that fourth point component with fast_vec_dist between adjacent points, proving this float stores distance within the segment selected by path_point rather than a normalized interpolation fraction. --- .../l14/mobys/blarg_heavy_interceptor.c | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 8afe6c8114..0163f4cef8 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -221,7 +221,7 @@ typedef struct BlargHeavyInterceptorVars { s32 path_segment; s16 unk88; s16 rejoin_path_loop; - f32 unk8C; + f32 path_point_segment_distance; f32 unk90[4]; f32 unkA0[4]; f32 unkB0[4]; @@ -251,7 +251,7 @@ typedef struct BlargHeavyInterceptorVars { s16 unk200; s16 unk202; s32 patrol_path; - s16 unk208; + s16 return_path_complete; s16 group_member_count; s32 flags; f32 unk210; @@ -443,15 +443,15 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { update_blarg_heavy_interceptor_patrol_path_position(moby); if ((s8)(*(struct Moby **)(&moby_vars->unk180[3]))->state < 0 || fast_dec_timer_s16(&moby_vars->timer_1F2)) { - moby_vars->unk8C = 0.0f; + moby_vars->path_point_segment_distance = 0.0f; moby_vars->path_point = 0; - moby_vars->unk208 = 0; + moby_vars->return_path_complete = 0; moby->state = INTERCEPTOR_STATE_WAIT_FOR_GROUP_READY; } } else { moby_vars->path_point = 0; - moby_vars->unk8C = 0.0f; - moby_vars->unk208 = 0; + moby_vars->path_point_segment_distance = 0.0f; + moby_vars->return_path_complete = 0; moby->state = INTERCEPTOR_STATE_WAIT_FOR_GROUP_READY; } case INTERCEPTOR_STATE_WAIT_FOR_GROUP_READY: @@ -499,8 +499,8 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { moby->state = INTERCEPTOR_STATE_FOLLOW_RETURN_PATH; moby_vars->path_point = p->count - 2; - moby_vars->unk8C = p->points[moby_vars->path_point].f[3]; - moby_vars->unk208 = 0; + moby_vars->path_point_segment_distance = p->points[moby_vars->path_point].f[3]; + moby_vars->return_path_complete = 0; update_blarg_heavy_interceptor_return_path_position(moby, 0.01f, 5.0f, -1.0f); blend_moby_animation_c618(moby, 0, 0, scale_game_frames(10)); } @@ -509,7 +509,7 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { case INTERCEPTOR_STATE_FOLLOW_RETURN_PATH: FUN_L14_002aea08_c618(moby); update_blarg_heavy_interceptor_return_path_position(moby, 0.01f, 5.0f, -1.0f); - if (moby_vars->unk208 != 0) { + if (moby_vars->return_path_complete != 0) { int *tab = ((int *)l14_paths[moby_vars->unk78]); near_seg = 0; @@ -1514,18 +1514,18 @@ void initialize_blarg_heavy_interceptor_paths(struct Moby *moby) { &moby_vars->unk1C0[3], moby_vars->rejoin_path_loop, moby_vars->unk210 * moby_vars->beam_rotation_blink_and_aim_path_state[3]); - moby_vars->unk8C = 0.0f; + moby_vars->path_point_segment_distance = 0.0f; moby_vars->path_point = 0; FUN_L00_0025d808_2af688(sampling_path, &moby->pos, &moby_vars->path_point, - &moby_vars->unk8C, + &moby_vars->path_point_segment_distance, moby_vars->rejoin_path_loop, moby_vars->unk210 * moby_vars->unk190[0]); } else { moby_vars->path_point = 0; moby_vars->path_segment = 0; - moby_vars->unk8C = 0.0f; + moby_vars->path_point_segment_distance = 0.0f; moby_vars->unk1C0[3] = 0.0f; } } @@ -1636,17 +1636,17 @@ void update_blarg_heavy_interceptor_return_path_position(struct Moby *moby, BlargHeavyInterceptorVars *return_path_moby_vars = (BlargHeavyInterceptorVars *)moby->pvars; int *list = ((int *)l14_paths[return_path_moby_vars->patrol_path]); float target_position[4]; - if (return_path_moby_vars->unk208 != 0) { + if (return_path_moby_vars->return_path_complete != 0) { qcopy(target_position, (char *)list + list[0] * 16); } else { if (FUN_L00_0025d808_2afb40(list, target_position, &return_path_moby_vars->path_point, - &return_path_moby_vars->unk8C, + &return_path_moby_vars->path_point_segment_distance, 0, path_traversal_speed * frame_time * path_direction_multiplier) != 0) { - return_path_moby_vars->unk208 = 1; + return_path_moby_vars->return_path_complete = 1; } } FUN_L00_0025b8c0_c( From eabc3f1e6cffe453ca300662b30cfc1371df4652 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:43:31 +0000 Subject: [PATCH 501/758] decomp: clarify names in oscillating_target_link_update f2300 -> first_strip_reset_countdown: Retail 0x00302fbc initializes this int member to 0. Direct call 0x00303248 invokes strip helper 0x00302c58 on the same Moby. Its 0x00302ca4 loads pvars; 0x00302cd0 sets strip index 0, 0x00302cdc..0x00302cec passes pvars+0x2300+4*strip to the countdown operation identified as fast_dec_timer in the authoritative C, and 0x00302eac..0x00302eb8 loops through four strips. This member is strip index 0. On expiry the helper regenerates strip points/random deltas at 0x00302d20..0x00302e28 and reloads the same timer from oscillating_link_strip_reset_ticks (45) at 0x00302e2c..0x00302e48. Thus this is that strip's reset countdown, not an offset-only inferred field. f2304 -> second_strip_reset_countdown: Retail 0x00302fac initializes this int member to 11. Direct call 0x00303248 invokes strip helper 0x00302c58 on the same Moby. Its 0x00302ca4 loads pvars; 0x00302cd0 sets strip index 0, 0x00302cdc..0x00302cec passes pvars+0x2300+4*strip to the countdown operation identified as fast_dec_timer in the authoritative C, and 0x00302eac..0x00302eb8 loops through four strips. This member is strip index 1. On expiry the helper regenerates strip points/random deltas at 0x00302d20..0x00302e28 and reloads the same timer from oscillating_link_strip_reset_ticks (45) at 0x00302e2c..0x00302e48. Thus this is that strip's reset countdown, not an offset-only inferred field. f2308 -> third_strip_reset_countdown: Retail 0x00302fb4 initializes this int member to 23. Direct call 0x00303248 invokes strip helper 0x00302c58 on the same Moby. Its 0x00302ca4 loads pvars; 0x00302cd0 sets strip index 0, 0x00302cdc..0x00302cec passes pvars+0x2300+4*strip to the countdown operation identified as fast_dec_timer in the authoritative C, and 0x00302eac..0x00302eb8 loops through four strips. This member is strip index 2. On expiry the helper regenerates strip points/random deltas at 0x00302d20..0x00302e28 and reloads the same timer from oscillating_link_strip_reset_ticks (45) at 0x00302e2c..0x00302e48. Thus this is that strip's reset countdown, not an offset-only inferred field. f230C -> fourth_strip_reset_countdown: Retail 0x00302fb8 initializes this int member to 34. Direct call 0x00303248 invokes strip helper 0x00302c58 on the same Moby. Its 0x00302ca4 loads pvars; 0x00302cd0 sets strip index 0, 0x00302cdc..0x00302cec passes pvars+0x2300+4*strip to the countdown operation identified as fast_dec_timer in the authoritative C, and 0x00302eac..0x00302eb8 loops through four strips. This member is strip index 3. On expiry the helper regenerates strip points/random deltas at 0x00302d20..0x00302e28 and reloads the same timer from oscillating_link_strip_reset_ticks (45) at 0x00302e2c..0x00302e48. Thus this is that strip's reset countdown, not an offset-only inferred field. --- src/overlays/l12/mobys/oscillating_target_link.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l12/mobys/oscillating_target_link.c b/src/overlays/l12/mobys/oscillating_target_link.c index d989a5c1a8..757bc79f9c 100644 --- a/src/overlays/l12/mobys/oscillating_target_link.c +++ b/src/overlays/l12/mobys/oscillating_target_link.c @@ -227,10 +227,10 @@ void update_oscillating_target_link_strips(struct Moby *moby) { typedef struct Data_304310 { char pad0[0x2300]; - int f2300; - int f2304; - int f2308; - int f230C; + int first_strip_reset_countdown; + int second_strip_reset_countdown; + int third_strip_reset_countdown; + int fourth_strip_reset_countdown; int row; /* 0x2310 */ int target; /* 0x2314 */ float angle; /* 0x2318 */ @@ -285,10 +285,10 @@ void oscillating_target_link_update(Moby *moby) { oscillating_link_strip_fade_pivot_ticks = 0x16; oscillating_link_strip_reset_ticks = 0x2D; oscillating_target_link_state->f231C = -1; - oscillating_target_link_state->f2304 = 0xB; - oscillating_target_link_state->f2308 = 0x17; - oscillating_target_link_state->f230C = 0x22; - oscillating_target_link_state->f2300 = 0; + oscillating_target_link_state->second_strip_reset_countdown = 0xB; + oscillating_target_link_state->third_strip_reset_countdown = 0x17; + oscillating_target_link_state->fourth_strip_reset_countdown = 0x22; + oscillating_target_link_state->first_strip_reset_countdown = 0; moby->state = TARGET_TRACKING_STATE_ACTIVE; break; case TARGET_TRACKING_STATE_ACTIVE: From cea2181f729042705dcc23a0a66f3d8564ea296c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:43:35 +0000 Subject: [PATCH 502/758] decomp: clarify names in update_screamer_hit_reactions_and_targeting f110 -> color_reaction_state_header: Assigned retail 0x002dfe40-0x002dfe54 and 0x002dfeb0 pass pvars+0x110 to trooper_anim_update/finish. Checked helper 0x0024ff80-0x0025002c uses this base for timer at +0, control at +2 and saved original RGB at +4/+5/+6; finish 0x00250068-0x002500b4 decrements that timer and changes phase. Thus this seven-byte array is the color-reaction state header, not arbitrary padding. f117 -> secondary_color_red: Retail stores 0x78 or 0xfa at pvars+0x117 at 0x002dfe54/0x002dfe88 before color animation update. With the passed state base pvars+0x110, checked finish 0x002500d8-0x00250128 reads byte +7, interpolates it against saved red at +4, and sends the interpolated value in a1 to set_moby_color at 0x00250280-0x00250288. This proves the secondary color's red component. f178 -> default_target_range: Retail 0x002dfee0-0x002dfef0 loads pvars+0x178 and adds 6 during the +0x184 timer; 0x002dfefc/0x002dff04 otherwise copies it to +0x180 outside activation wait. The C passes +0x180 to both target selectors and compares it to vector_distance_xy at 0x002e00d0-0x002e00e4, proving +0x178 is the default targeting distance range. f17C -> active_target_path_index: Retail 0x002e0008-0x002e0010 chooses pvars+0x17C when moby state is not WAIT_FOR_ACTIVATION. At 0x002e0060-0x002e0098 a nonnegative value indexes l10_paths (shift by 2), whose points (+0x10) and count (+0) are passed to the target selection helper. Thus it is the target constraint path index used outside activation wait. f180 -> current_target_range: Retail 0x002dfeb8-0x002dff04 selects 42, default range plus 6, activation-wait range or default range into pvars+0x180. The selected scalar is passed in f12 to targeting helpers at 0x002dff1c, 0x002e0030, 0x002e0078 and 0x002e00ac, then compared with XY target distance at 0x002e00d8-0x002e00e4. This proves the current target range. f184 -> target_range_boost_timer: Retail 0x002dfc7c-0x002dfc94 scales/truncates a random 180..240 duration into pvars+0x184, and 0x002dfca0 decrements it every update. Nonzero +0x184 selects default range +6 at 0x002dfed8-0x002dfef0; zero selects ordinary ranges. This proves a countdown controlling the temporary target-range boost. f188 -> activation_wait_target_range: Retail 0x002dfef4-0x002dff04 chooses pvars+0x188 for +0x180 specifically when moby state equals SCREAMER_STATE_WAIT_FOR_ACTIVATION and the range-boost timer is zero. +0x180 is consumed as selector range and XY distance threshold at 0x002e00ac-0x002e00e4. Thus this is the targeting range for activation wait. f18C -> activation_wait_target_path_index: Retail 0x002e0008-0x002e0018 reads pvars+0x18C in state SCREAMER_STATE_WAIT_FOR_ACTIVATION and falls back when negative. 0x002e0020-0x002e0050 uses it to index l10_paths and passes that path's points and count to the target selector. The C shows the same state-specific path constraint data flow. f194 -> target_bounds_cuboid_index: Retail 0x002dff38-0x002dff6c multiplies pvars+0x194 by 0x80 to select the cuboid, subtracts its position (+0x30) and transforms by its local basis (+0x40). Component bounds checks then set targeting status +0x104 to 2. Authoritative C identifies the indexed table as l10_cuboids, proving the cuboid index used for target bounds. f2C -> damage: Assigned retail 0x002dfcf8-0x002dfd04 compares hit_record+0x2C with remaining health at pvars+0x20 to select death; 0x002dfe7c-0x002dfe90 subtracts the same scalar from health on a nonlethal hit. Checked hit updater 0x0024d454-0x0024d474 zeros that member when damage is suppressed. This proves hit damage, beyond its offset or type. f38 -> target_range_boost_requested: Retail 0x002dfc60-0x002dfc98 tests pvars+0x38, initializes the range-boost timer +0x184 from a random scaled duration when nonzero, then clears +0x38. The timer controls the +6 targeting-range increase at 0x002dfed8-0x002dfef0. This proves a consumed request for the temporary targeting-range boost without assuming its writers. f84 -> knockback_flags: Assigned retail 0x002dfddc writes 9 at pvars+0x84 before trooper_start_knockback receives pvars+0x60. In checked helper 0x0024f134-0x0024f14c, that same relative +0x24 word is loaded, ORed with 0x20 and masked with 2 to select animation handling. Those bit operations prove flags belonging to the knockback state. --- src/overlays/l10/mobys/screamer.c | 78 +++++++++++++++---------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/overlays/l10/mobys/screamer.c b/src/overlays/l10/mobys/screamer.c index 986ff05b07..c6efe28b96 100644 --- a/src/overlays/l10/mobys/screamer.c +++ b/src/overlays/l10/mobys/screamer.c @@ -325,7 +325,7 @@ typedef struct Hit_2DFC38 { float f10[4]; struct Moby *moby; char pad24[8]; - float f2C; + float damage; int f30; } Hit_2DFC38; @@ -335,31 +335,31 @@ typedef struct MobyData_2DFC38 { char pad24[2]; short f26; char pad28[0x10]; - int f38; + int target_range_boost_requested; char pad3C[0x24]; char f60[0x10]; float f70, f74, f78, f7C; char pad80[4]; - int f84; + int knockback_flags; char pad88[0x15]; unsigned char f9D; char pad9E[0x22]; char fC0[0x40]; int f100, f104; char pad108[8]; - char f110[7]; - unsigned char f117; + char color_reaction_state_header[7]; + unsigned char secondary_color_red; char pad118[0x18]; char f130[0x44]; int f174; - float f178; - int f17C; - float f180; - int f184; - float f188; - int f18C; + float default_target_range; + int active_target_path_index; + float current_target_range; + int target_range_boost_timer; + float activation_wait_target_range; + int activation_wait_target_path_index; char pad190[4]; - int f194; + int target_bounds_cuboid_index; } MobyData_2DFC38; extern char D_0013F3D0[]; @@ -397,18 +397,18 @@ void update_screamer_hit_reactions_and_targeting(struct Moby *moby) { int target_selection_status; float knockback_angle; - if (screamer_vars->f38 != 0) { - screamer_vars->f184 = + if (screamer_vars->target_range_boost_requested != 0) { + screamer_vars->target_range_boost_timer = truncate_float_to_s32(scale_time(random_float_between(180.0f, 240.0f))); - screamer_vars->f38 = 0; + screamer_vars->target_range_boost_requested = 0; } - fast_dec_timer(&screamer_vars->f184); + fast_dec_timer(&screamer_vars->target_range_boost_timer); if (moby->state != SCREAMER_STATE_DEATH_KNOCKBACK) { hit_record = (Hit_2DFC38 *)find_moby_hit(moby, 0x330000, 0); hit_update_2DFC38( moby, hit_record, &screamer_vars->f20, 5, &hit_processing_status, 0, 0, 4); if (hit_record != 0) { - if (screamer_vars->f20 <= hit_record->f2C) { + if (screamer_vars->f20 <= hit_record->damage) { if (screamer_death_message_gate != 0 && item_unlocked[0x10] == 0) { item_unlocked[0x10] = 1; allocate_voice_for_bank_entry_2DFC38(1, 0, 0); @@ -422,7 +422,7 @@ void update_screamer_hit_reactions_and_targeting(struct Moby *moby) { screamer_vars->f70 = D_0015ED70 * 26.0f; screamer_vars->f9D = 3; screamer_vars->f74 = 0.0005f; - screamer_vars->f84 = 9; + screamer_vars->knockback_flags = 9; screamer_vars->f78 = D_0015ED6C * 7.0f; screamer_vars->f7C = D_0015ED6C * 10.0f; if (hit_record->f30 & 1) @@ -431,32 +431,32 @@ void update_screamer_hit_reactions_and_targeting(struct Moby *moby) { knockback_angle = fast_arc_tan(moby->pos.x - hit_record->x, moby->pos.y - hit_record->y); trooper_start_knockback(moby, screamer_vars->f60, knockback_angle, 5, 1, 0); - screamer_vars->f117 = 0x78; - trooper_anim_update(moby, screamer_vars->f110); + screamer_vars->secondary_color_red = 0x78; + trooper_anim_update(moby, screamer_vars->color_reaction_state_header); func_L00_00261B00_2E2B80(moby, 1, 3, 0, -1); } else { - screamer_vars->f20 = screamer_vars->f20 - hit_record->f2C; - screamer_vars->f117 = 0xfa; + screamer_vars->f20 = screamer_vars->f20 - hit_record->damage; + screamer_vars->secondary_color_red = 0xfa; screamer_vars->f26 = scale_game_frames(60); - trooper_anim_update(moby, screamer_vars->f110); + trooper_anim_update(moby, screamer_vars->color_reaction_state_header); } moby->hit_slot = 0xff; } } - trooper_anim_finish(moby, screamer_vars->f110); + trooper_anim_finish(moby, screamer_vars->color_reaction_state_header); if (screamer_vars->f174 == 2) - screamer_vars->f180 = 42.0f; - else if (screamer_vars->f184 != 0) - screamer_vars->f180 = screamer_vars->f178 + 6.0f; + screamer_vars->current_target_range = 42.0f; + else if (screamer_vars->target_range_boost_timer != 0) + screamer_vars->current_target_range = screamer_vars->default_target_range + 6.0f; else if (moby->state == SCREAMER_STATE_WAIT_FOR_ACTIVATION) - screamer_vars->f180 = screamer_vars->f188; + screamer_vars->current_target_range = screamer_vars->activation_wait_target_range; else - screamer_vars->f180 = screamer_vars->f178; + screamer_vars->current_target_range = screamer_vars->default_target_range; if (screamer_vars->f174 == 2) { - target_selection_status = ahead_f(screamer_vars->f180, moby, screamer_vars->fC0); + target_selection_status = ahead_f(screamer_vars->current_target_range, moby, screamer_vars->fC0); if (target_selection_status != TARGET_SELECTION_DEFAULT_TARGET_EXCLUDED) { - LevelCuboid *bp = &l10_cuboids[screamer_vars->f194]; + LevelCuboid *bp = &l10_cuboids[screamer_vars->target_bounds_cuboid_index]; fast_vec_sub(relative_offset, D_0013F3D0, &bp->pos); relative_offset[3] = 0.0f; transform_vector_by_basis(transformed_offset, relative_offset, bp->to_local); @@ -465,19 +465,19 @@ void update_screamer_hit_reactions_and_targeting(struct Moby *moby) { transformed_offset[2] <= -1.0f || 1.0f <= transformed_offset[2]) screamer_vars->f104 = 2; } - } else if (moby->state == SCREAMER_STATE_WAIT_FOR_ACTIVATION && screamer_vars->f18C >= 0) { - LevelPath *path = l10_paths[screamer_vars->f18C]; + } else if (moby->state == SCREAMER_STATE_WAIT_FOR_ACTIVATION && screamer_vars->activation_wait_target_path_index >= 0) { + LevelPath *path = l10_paths[screamer_vars->activation_wait_target_path_index]; target_selection_status = activate_effect_l08( - screamer_vars->f180, moby, screamer_vars->fC0, 0, 0, path->points, path->count); - } else if (moby->state != SCREAMER_STATE_WAIT_FOR_ACTIVATION && screamer_vars->f17C >= 0) { - LevelPath *path = l10_paths[screamer_vars->f17C]; + screamer_vars->current_target_range, moby, screamer_vars->fC0, 0, 0, path->points, path->count); + } else if (moby->state != SCREAMER_STATE_WAIT_FOR_ACTIVATION && screamer_vars->active_target_path_index >= 0) { + LevelPath *path = l10_paths[screamer_vars->active_target_path_index]; target_selection_status = activate_effect_l08( - screamer_vars->f180, moby, screamer_vars->fC0, 0, 0, path->points, path->count); + screamer_vars->current_target_range, moby, screamer_vars->fC0, 0, 0, path->points, path->count); } else { - target_selection_status = ahead_f(screamer_vars->f180, moby, screamer_vars->fC0); + target_selection_status = ahead_f(screamer_vars->current_target_range, moby, screamer_vars->fC0); } if (target_selection_status != TARGET_SELECTION_DEFAULT_TARGET_EXCLUDED) { - if (screamer_vars->f180 < vector_distance_xy(screamer_vars->f130, screamer_vars->fC0)) + if (screamer_vars->current_target_range < vector_distance_xy(screamer_vars->f130, screamer_vars->fC0)) screamer_vars->f104 = 2; else if (moby->visible == 0) screamer_vars->f104 = 2; From ab636bbf51b9bd623043a1d048fc9bd1a349b837 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:45:21 +0000 Subject: [PATCH 503/758] decomp: clarify names in draw_collision_clipped_moby_beam f140 -> beam_reference_position: In the authoritative C SHA-256 e49ae3f8f422ea042ae57fe7345925d268a6bdd53bea97877e11510127b48d66, EffData.f140 supplies oscillating_reference_position. Retail 0x00312474-0x00312480 copies pvars+0x140 to sp+0x50; 0x003124c8-0x003124e4 adds a frame-derived sine to its first component. At 0x003124e8-0x0031251c this reference minus attachment position is normalized to length 30 and added to the reference to form the beam line endpoint. Thus it is the stored beam reference position before local oscillation. f150 -> previous_hit_position: Retail 0x003125cc-0x003125d4 saves pvars+0x150 as the history pointer. When +0x15C is nonzero, 0x0031265c-0x00312698 subtracts this saved position from the current clipped endpoint, normalizes the sample step to 0.2 and copies the saved position to initialize effect_sample_position. After hit processing, 0x00312804-0x0031280c copies the current line endpoint into +0x150. The initial collision at 0x00312530-0x00312548 replaces that endpoint with the hit position; the no-hit branch skips the history write. This proves a saved previous hit position. f15C -> previous_hit_valid: Retail 0x00312628-0x00312654 reads the float at pvars+0x15C and compares it to zero, skipping interpolation from the saved +0x150 position when zero. After storing the current hit endpoint, 0x00312810-0x00312820 writes float 1.0 to +0x15C; the no-hit branch writes zero at 0x00312824-0x0031282c. The authoritative C similarly gates the four-sample history loop with f15C != 0.0f. It is the validity flag for the previous hit position, retaining its existing float type. --- src/overlays/l07/mobys/snagglebeast_effects.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/l07/mobys/snagglebeast_effects.c b/src/overlays/l07/mobys/snagglebeast_effects.c index 1e14191330..6d421db5fa 100644 --- a/src/overlays/l07/mobys/snagglebeast_effects.c +++ b/src/overlays/l07/mobys/snagglebeast_effects.c @@ -45,9 +45,9 @@ allocate_packed_color_point_light_slot(float *, float, float, int) __asm__("FUN_ typedef struct EffData { char pad0[0x140]; - float f140[4]; - float f150[3]; - float f15C; + float beam_reference_position[4]; + float previous_hit_position[3]; + float previous_hit_valid; } EffData; typedef struct Packet { @@ -235,7 +235,7 @@ void draw_collision_clipped_moby_beam(struct Moby *effect_owner_moby) { Packet pkt; frame_phase_work_value = convert_integer_to_float(D_L07_0015F5CC_lui); - qcopy(oscillating_reference_position, moby_effect_data->f140); + qcopy(oscillating_reference_position, moby_effect_data->beam_reference_position); oscillation_work_value = fast_cos(normalize_angle(frame_phase_work_value / 11.0f)); frame_phase_work_value = frame_phase_work_value / 10.0f; oscillation_work_value = @@ -265,10 +265,10 @@ void draw_collision_clipped_moby_beam(struct Moby *effect_owner_moby) { effect_owner_moby, 1.0f, 1.0f); - if (moby_effect_data->f15C != 0.0f) { - fast_vec_sub(effect_sample_step, line_endpoint, moby_effect_data->f150); + if (moby_effect_data->previous_hit_valid != 0.0f) { + fast_vec_sub(effect_sample_step, line_endpoint, moby_effect_data->previous_hit_position); fast_vec_normalize(effect_sample_step, effect_sample_step, 0.2f); - qcopy(effect_sample_position, moby_effect_data->f150); + qcopy(effect_sample_position, moby_effect_data->previous_hit_position); for (k = 0; k < 4; k++) { fast_vec_add(effect_sample_position, effect_sample_position, effect_sample_step); fast_vec_sub(sample_probe_offset, effect_sample_position, attachment_position); @@ -301,10 +301,10 @@ void draw_collision_clipped_moby_beam(struct Moby *effect_owner_moby) { } } } - qcopy(moby_effect_data->f150, line_endpoint); - moby_effect_data->f15C = 1.0f; + qcopy(moby_effect_data->previous_hit_position, line_endpoint); + moby_effect_data->previous_hit_valid = 1.0f; } else { - moby_effect_data->f15C = 0.0f; + moby_effect_data->previous_hit_valid = 0.0f; } pkt.x128 = get_effect_texture(0x3B); pkt.col[0] = pkt.col[1] = pkt.col[2] = pkt.col[3] = 0x80808080; From d670dee407e41c439e1ca5eaa50b78c21de15c21 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:45:25 +0000 Subject: [PATCH 504/758] decomp: clarify names in process_snagglebeast_damage unk1C7 -> hero_capture_attack_enabled: Retail 0x00313660-0x003136ac derives thresholds max_health/6*1.75 and max_health/6*1.25; 0x00313834-0x00313880 compares original and post-damage health across those thresholds and stores 1 at instance+0x1c7. Original Ghidra confirms the same store. In authoritative snagglebeast_update, this u8 gates sight_ready, requiring the hero moby within 30 units and 1.3962634 radians; sight_ready triggers SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO from idle or chase. Initialization and capture completion or lost sight clear the field. These producer and consumer uses prove it is the hero capture attack enable flag. --- 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 ba946908d3..51b3c0101c 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -128,7 +128,7 @@ typedef struct SnagglebeastVars { u8 unk1C4; u8 sphere_fade_direction; u8 sphere_shade; - u8 unk1C7; + u8 hero_capture_attack_enabled; f32 sphere_fade; s32 unk1CC; s32 unk1D0; @@ -565,7 +565,7 @@ void process_snagglebeast_damage(char *moby, } if ((wide < original_health && *health <= wide) || (narrow < original_health && *health <= narrow)) - snagglebeast_instance_vars->unk1C7 = 1; + snagglebeast_instance_vars->hero_capture_attack_enabled = 1; } } goto decay_hit; @@ -1054,7 +1054,7 @@ void snagglebeast_update(unsigned char *moby) { if (fast_dec_timer_s16(&snagglebeast_instance_state->timer_19A) && target_distance > 9.0f) timer19a = 1; sight_ready = 0; - if (snagglebeast_instance_state->unk1C7 != 0) { + if (snagglebeast_instance_state->hero_capture_attack_enabled != 0) { char *g = ((char *)&hero); if (sight.moby == *(void **)(g + 0x2080) && target_distance < 30.0f && absolute_float(fast_subtract_rotations(target_angle, MOBY(moby)->rot.z)) < 1.3962634f) { @@ -1245,7 +1245,7 @@ void snagglebeast_update(unsigned char *moby) { moby + 0x10, D_L07_001B0530[snagglebeast_instance_state->nav_path], 0.0f); suck_reset(moby); MOBY(moby)->scale *= 1.75f; - snagglebeast_instance_state->unk1C7 = 0; + snagglebeast_instance_state->hero_capture_attack_enabled = 0; snagglebeast_instance_state->turn_start_angle = 1.7453293f; snagglebeast_instance_state->unk29 = 1; snagglebeast_instance_state->unk58 = truncate_float_to_s32(30.0f); @@ -2012,7 +2012,7 @@ void snagglebeast_update(unsigned char *moby) { if (*(int *)(g3 + 0x2084) == 0x78) hero_set_state(0, 1); } - snagglebeast_instance_state->unk1C7 = 0; + snagglebeast_instance_state->hero_capture_attack_enabled = 0; if (snagglebeast_instance_state->voice != -1) { char *sl = (voice_slot_state_base - 0x74) + snagglebeast_instance_state->voice * 0x70; @@ -2112,7 +2112,7 @@ void snagglebeast_update(unsigned char *moby) { hero_set_state(0, 1); } snagglebeast_instance_state->timer = scale_game_frames(0x46); - snagglebeast_instance_state->unk1C7 = 0; + snagglebeast_instance_state->hero_capture_attack_enabled = 0; if (snagglebeast_instance_state->voice != -1) { char *sl = (voice_slot_state_base - 0x74) + snagglebeast_instance_state->voice * 0x70; From fc5aa18f31c2e20710df521d56d0d9e5a44821bf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:47:20 +0000 Subject: [PATCH 505/758] decomp: clarify names in bolt_pickup_update f2288 -> collection_radius_xy: Retail 0x002b8640-0x002b8654 computes vector_distance_xy between moby position and hero position +0x80, loads the hero float at +0x2288, and requires distance < this float before the vertical collection test. Exact C then sets hit and credits bolt counters/removes the pickup. This is the horizontal radius threshold for hero collection. f228C -> collection_height_tolerance: Retail 0x002b865c-0x002b867c subtracts hero Z at +0x88 from pickup Z at +0x18, takes absolute_float, loads hero +0x228C and sets the collection hit only when the absolute height difference is below this float. Exact C uses that hit to credit bolts and remove the pickup, proving a collection height tolerance. f48 -> spin_angle: In bolt_pickup_update the float moby->f48 is passed to fast_add_rotations with moby_data->fC and the result is stored back. Retail 0x002b85b8 loads +0x48(s2), 0x002b85c4 loads the increment at +0xC(s4), and 0x002b85c0/0x002b85cc call the angle addition and store the updated angle. initialize_bolt_pickup assigns a random spin increment at pvars+0xC, proving this member is the pickup spin angle without asserting its axis. --- src/overlays/l08/mobys/bolt_pickup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l08/mobys/bolt_pickup.c b/src/overlays/l08/mobys/bolt_pickup.c index 0cba1d707f..2140b19e61 100644 --- a/src/overlays/l08/mobys/bolt_pickup.c +++ b/src/overlays/l08/mobys/bolt_pickup.c @@ -43,7 +43,7 @@ typedef struct Moby_2B94B0 { float pos[4]; unsigned char state; char pad21[0x27]; - float f48; + float spin_angle; char pad4C[0x2C]; MobyData *data; } Moby_2B94B0; @@ -58,8 +58,8 @@ typedef struct Hero_2B94B0 { char pad540[0x1B4C]; int f208C; char pad2090[0x1F8]; - float f2288; - float f228C; + float collection_radius_xy; + float collection_height_tolerance; } Hero_2B94B0; extern float D_0015ED70; @@ -182,7 +182,7 @@ void bolt_pickup_update(Moby_2B94B0 *moby) { qcopy(moby->pos, P); case MOBY_STATE_CHECK_COLLECTION: hit = 0; - moby->f48 = fast_add_rotations(moby->f48, moby_data->fC); + moby->spin_angle = fast_add_rotations(moby->spin_angle, moby_data->fC); if (((Hero_2B94B0 *)((char *)&hero))->f208C == 15) { if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->v510, moby->pos) < 0.5f) hit = 1; @@ -191,9 +191,9 @@ void bolt_pickup_update(Moby_2B94B0 *moby) { if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->v530, moby->pos) < 0.5f) hit = 1; } else if (vector_distance_xy(moby->pos, ((Hero_2B94B0 *)((char *)&hero))->pos) < - ((Hero_2B94B0 *)((char *)&hero))->f2288) { + ((Hero_2B94B0 *)((char *)&hero))->collection_radius_xy) { if (absolute_float(moby->pos[2] - ((Hero_2B94B0 *)((char *)&hero))->pos[2]) < - ((Hero_2B94B0 *)((char *)&hero))->f228C) + ((Hero_2B94B0 *)((char *)&hero))->collection_height_tolerance) hit = 1; } if (hit == 0) From 32a4cfaf19b232ff6c2b947cd8267d7e7cf28c43 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:47:24 +0000 Subject: [PATCH 506/758] decomp: clarify names in barrier_update f43 -> barrier_cleared: In authoritative barrier.c (SHA-256 5f07135a4e7d4d2e14d28e153d7d2d75972766a37d0cd1e80fb95c3cb9a12a1f), Flags_309688.f43 is selected by barrier_vars->idx in alternate_item_available. Retail 0x00308334-0x00308350 writes 0 on first initialization. Retail 0x0030838c-0x003083ac writes 1 immediately before mission-driven mark_moby_for_removal; 0x0030877c-0x003087a4 writes 1 after destruction effects only for final class 0x508. Original Ghidra shows the same writes to idx+0x13d3cb. Thus barrier_cleared describes the proven flag lifecycle rather than merely its offset. --- src/overlays/l09/mobys/barrier.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l09/mobys/barrier.c b/src/overlays/l09/mobys/barrier.c index 66d4266a5e..054ce7ae58 100644 --- a/src/overlays/l09/mobys/barrier.c +++ b/src/overlays/l09/mobys/barrier.c @@ -40,7 +40,7 @@ typedef struct Hit_309688 { typedef struct Flags_309688 { char pad0[0x43]; - unsigned char f43; + unsigned char barrier_cleared; } Flags_309688; #include "rnc/overlay/l09/mobys/barrier_data/barrier_update.h" @@ -111,14 +111,14 @@ void barrier_update(Moby *moby) { if (moby->state == BARRIER_STATE_UNINITIALIZED) { if (barrier_vars->idx != -1) - ((Flags_309688 *)(alternate_item_available + barrier_vars->idx))->f43 = 0; + ((Flags_309688 *)(alternate_item_available + barrier_vars->idx))->barrier_cleared = 0; moby->state = BARRIER_STATE_INITIALIZED; } if (moby->mission != 0xFF) { int row = current_level_index * 16; if (visited52[moby->mission + row] == 0xFF) { if (barrier_vars->idx != -1) - ((Flags_309688 *)(alternate_item_available + barrier_vars->idx))->f43 = 1; + ((Flags_309688 *)(alternate_item_available + barrier_vars->idx))->barrier_cleared = 1; mark_moby_for_removal(moby); return; } @@ -195,7 +195,7 @@ void barrier_update(Moby *moby) { 0); if (moby->oclass == 0x508) { if (barrier_vars->idx != -1) - ((Flags_309688 *)(alternate_item_available + barrier_vars->idx))->f43 = 1; + ((Flags_309688 *)(alternate_item_available + barrier_vars->idx))->barrier_cleared = 1; } if (moby->oclass == 0x508 || has_next) mark_moby_for_removal(moby); From 80618a3cabbe7df9ee98afaf133303b703cead7a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:47:27 +0000 Subject: [PATCH 507/758] decomp: clarify names in mine_group_update unk90 -> child_reset_segment_index: In authoritative src/overlays/l07/mobys/mine_group.c (SHA-256 4d5c9585eaca8e150a26d146aff437f49d767047ab4c089064ffddabf24a4089), unk90 receives select_point_index_by_distance(&moby->pos, path, 0.0f). Retail 0030b280..0030b2a0 passes the parent position/path, stores the returned point index into pvars+0x90 and seeds the child placement segment. Retail 0030b4b8..0030b4cc loads child pvars+0x90 (the sample_path segment), compares it with parent pvars+0x90, and calls reset_moby_from_class_defaults only when equal after fast_dec_timer succeeds. Original Ghidra likewise compares these two segment values before func_0x0030af40. Thus the field is the path segment index required for child reset, rather than a generic counter or pointer. --- src/overlays/l07/mobys/mine_group.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l07/mobys/mine_group.c b/src/overlays/l07/mobys/mine_group.c index 7b06fc4584..1c4ef5846a 100644 --- a/src/overlays/l07/mobys/mine_group.c +++ b/src/overlays/l07/mobys/mine_group.c @@ -202,7 +202,7 @@ typedef struct MineGroupVars { f32 unk80; s32 unk84; u8 pad_88[0x8]; - s32 unk90; + s32 child_reset_segment_index; u8 unk94; u8 unk95; } MineGroupVars; @@ -321,7 +321,7 @@ void mine_group_update(struct Moby *moby) { debug_print(mine_group_not_found_message, boltcrate_pvars->unk74); return; } - child_placement_segment_index = boltcrate_pvars->unk90 = + child_placement_segment_index = boltcrate_pvars->child_reset_segment_index = select_point_index_by_distance(&moby->pos, path, 0.0f); placed = 0; if (0 < ((MineGroupView *)boltcrate_pvars)->child_count) @@ -382,7 +382,7 @@ void mine_group_update(struct Moby *moby) { fast_vec_sub((char *)child + 0x60, (char *)child + 0x80, (char *)cursor + 0x10); qcopy((void *)(cursor + 0x10), (void *)(child + 0x80)); if (fast_dec_timer((int *)(child + 0x98)) && - *(int *)(child + 0x90) == boltcrate_pvars->unk90) + *(int *)(child + 0x90) == boltcrate_pvars->child_reset_segment_index) reset_moby_from_class_defaults((struct Moby *)cursor); } } From 530e7d81362f4d00ed67718030e5273060684172 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:47:31 +0000 Subject: [PATCH 508/758] decomp: clarify names in update_sentrybot_joint_aim unk194 -> priority_attention_active: In supplied retail instructions 0x0029a2dc-0x0029a2fc, lh from pvars+0x194 gates loading attention_target at +0x190; a nonzero flag and pointer select that moby's position (+0x10), ahead of timed attention_source and the stored point. The original retail Ghidra decompilation independently shows the same priority. In authoritative sentrybot.c (SHA-256 100c2db84419fe86b8898971b0aca3127ab1f3f012aa122e5b1ee5bc88d6c4eb), find_sentrybot_attention_target sets this s16 to 1 for class 0x27B candidates in states 7 or 0xF; nonzero bypasses the 1.2217305 angle gate and the final 8.0 distance rejection. sentrybot_update also lets it bypass the random attention-turn gate and clears it on return to patrol idle and during emission states. These uses prove a latched active priority-attention mode rather than a timer or target pointer. --- src/overlays/shared/enemies/sentrybot.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index 0abf866985..8015641e1c 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -133,7 +133,7 @@ typedef struct SentrybotVars { s32 group_index; s32 linked_moby[4]; /* 0x180: moby indexes, -1: none */ char *attention_target; /* 0x190 */ - s16 unk194; + s16 priority_attention_active; s16 unk196; char *attention_source; /* 0x198: set_sentrybot_attention_target */ s16 attention_timer; /* 0x19C */ @@ -445,7 +445,7 @@ void sentrybot_update(unsigned char *moby) { } else if (fast_dec_timer_s16(&sentrybot_instance_data->unk196) != 0 && (*(int *)&sentrybot_instance_data->attention_target = find_sentrybot_attention_target((char *)moby)) != 0 && - (sentrybot_instance_data->unk194 != 0 || + (sentrybot_instance_data->priority_attention_active != 0 || random_integer_below(scale_game_frames(0x96)) == 0)) { begin_sentrybot_turn_toward_point( (char *)moby, @@ -513,7 +513,7 @@ void sentrybot_update(unsigned char *moby) { if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); sentrybot_instance_data->unk196 = scale_game_frames(0x168); - sentrybot_instance_data->unk194 = 0; + sentrybot_instance_data->priority_attention_active = 0; } break; case SENTRYBOT_DEACTIVATE_LINKED_MOBYS_AFTER_ANIMATION: @@ -669,7 +669,7 @@ void sentrybot_update(unsigned char *moby) { } else if (fast_dec_timer_s16(&sentrybot_instance_data->unk196) != 0 && (*(int *)&sentrybot_instance_data->attention_target = find_sentrybot_attention_target((char *)moby)) != 0 && - (sentrybot_instance_data->unk194 != 0 || + (sentrybot_instance_data->priority_attention_active != 0 || random_integer_below(scale_game_frames(0x96)) == 0)) { begin_sentrybot_turn_toward_point( (char *)moby, @@ -853,7 +853,7 @@ void sentrybot_update(unsigned char *moby) { break; case SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_POSITIVE_JOINT_AIM: sentrybot_instance_data->attention_timer = 0; - sentrybot_instance_data->unk194 = 0; + sentrybot_instance_data->priority_attention_active = 0; alert_visible_group_sentrybots(moby); if (MOBY(moby)->anim_flags & 2) { if (hero.state.current == 0x65) { @@ -870,7 +870,7 @@ void sentrybot_update(unsigned char *moby) { break; case SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM: sentrybot_instance_data->attention_timer = 0; - sentrybot_instance_data->unk194 = 0; + sentrybot_instance_data->priority_attention_active = 0; alert_visible_group_sentrybots(moby); if (MOBY(moby)->anim_flags & 2) { if (hero.state.current == 0x65) { @@ -887,7 +887,7 @@ void sentrybot_update(unsigned char *moby) { break; case SENTRYBOT_EMIT_WITH_POSITIVE_JOINT_AIM: sentrybot_instance_data->attention_timer = 0; - sentrybot_instance_data->unk194 = 0; + sentrybot_instance_data->priority_attention_active = 0; alert_visible_group_sentrybots(moby); if (sentrybot_instance_data->unk19E == 0) { float t = compute_interpolated_record_value(moby); @@ -957,7 +957,7 @@ void sentrybot_update(unsigned char *moby) { break; case SENTRYBOT_EMIT_WITH_NEGATIVE_JOINT_AIM: sentrybot_instance_data->attention_timer = 0; - sentrybot_instance_data->unk194 = 0; + sentrybot_instance_data->priority_attention_active = 0; alert_visible_group_sentrybots(moby); if (sentrybot_instance_data->unk19E == 0) { float t = compute_interpolated_record_value(moby); @@ -1378,8 +1378,8 @@ int find_sentrybot_attention_target(char *moby) { MOBY(candidate_moby)->pos.y - MOBY(moby)->pos.y)); unsigned char candidate_state = ((char *)((id << 8) + (int)l15_moby_array))[0x20]; if (candidate_state == 7 || candidate_state == 0xF) - moby_data->unk194 = 1; - if (moby_data->unk194 != 0 || f < 1.2217305f) { + 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); line_start[2] += 1.0f; if (collision_line(line_start, candidate_line_endpoint, 2, 0, 0) == 0) { @@ -1393,7 +1393,7 @@ int find_sentrybot_attention_target(char *moby) { } } } while (*group_moby_entry++ >= 0); - if (moby_data->unk194 == 0) { + if (moby_data->priority_attention_active == 0) { if (bd > 8.0f) best = 0; } @@ -1495,7 +1495,7 @@ void update_sentrybot_joint_aim(void *mv) { float k2 = 0.3f; float yaw, pitch; int have = 0; - if (moby_data->unk194 != 0 && moby_data->attention_target != 0) { + if (moby_data->priority_attention_active != 0 && moby_data->attention_target != 0) { qcopy(target_position, moby_data->attention_target + 0x10); have = 1; } else if (moby_data->attention_timer != 0 && moby_data->attention_source != 0) { From de1d405ecdbd30a2a5039f4b7e618a3bc5284ebf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:47:34 +0000 Subject: [PATCH 509/758] decomp: clarify names in background_ship_1_update unk64 -> path_progress: BackgroundShip1Vars f32 unk64 is initialized from unk74 times the path's first integer at retail 0x002ec608-0x002ec61c. In FOLLOW_PATH, 0x002ec664-0x002ec678 adds travel speed times frame_time divided by first_path_segment_length to this field; 0x002ec67c-0x002ec698 wraps it by the path count. 0x002ec6ac loads it into f12 for sample_camera_path at 0x002ec6c0/0x002ec6e0, which writes moby position and rotation. These operations prove it stores path sampling progress. --- src/overlays/shared/vehicles/background_ship_1.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/vehicles/background_ship_1.c b/src/overlays/shared/vehicles/background_ship_1.c index 0ae78b7a4f..28691217d0 100644 --- a/src/overlays/shared/vehicles/background_ship_1.c +++ b/src/overlays/shared/vehicles/background_ship_1.c @@ -26,7 +26,7 @@ typedef struct BackgroundShip1Vars { u8 unk2C; u8 pad2D[0x33]; s32 unk60; - f32 unk64; + f32 path_progress; f32 unk68; s32 unk6C; f32 unk70; @@ -229,7 +229,7 @@ void background_ship_1_update(char *moby) { moby_data->unk6C = invalid_index; MOBY(moby)->state = BACKGROUND_SHIP_1_FOLLOW_PATH; MOBY(moby)->flags |= 0x10; - moby_data->unk64 = moby_data->unk74 * (float)*(int *)path; + moby_data->path_progress = moby_data->unk74 * (float)*(int *)path; break; } case BACKGROUND_SHIP_1_FOLLOW_PATH: @@ -238,16 +238,16 @@ void background_ship_1_update(char *moby) { moby_data->unk6C = func_0022ED80_r(1, 4, (int)moby); } path_travel_distance = *(float *)&background_ship_1_path_travel_speed_gp * frame_time; - moby_data->unk64 = moby_data->unk64 + path_travel_distance / moby_data->unk70; - if ((float)*(int *)path < moby_data->unk64) { - moby_data->unk64 = moby_data->unk64 - (float)*(int *)path; + moby_data->path_progress = moby_data->path_progress + path_travel_distance / moby_data->unk70; + if ((float)*(int *)path < moby_data->path_progress) { + moby_data->path_progress = moby_data->path_progress - (float)*(int *)path; } if (current_level_index == 9) { sample_camera_path( - (int *)path, 1, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->unk64); + (int *)path, 1, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->path_progress); } else { sample_camera_path( - (int *)path, 0, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->unk64); + (int *)path, 0, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->path_progress); } if (MOBY(moby)->pos.x < 8.0f) { MOBY(moby)->collision = 0; From 243ad7f13f80b58bb044921be53d81600d4d2a45 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:49:35 +0000 Subject: [PATCH 510/758] decomp: clarify names in moving_platform_small_update unk110 -> path_endpoint_distance: Retail 0x00294d44-0x00294d5c loads the path pointer, selects first node at path+0x10 and last node at path+count*0x10, calls fast_vec_dist, and stores f0 at pvars+0x110, matching source unk110. 0x00294d7c-0x00294d9c derives glide_speed from this endpoint distance. 0x00294e34 and 0x00294e60-0x00294e64 use the stored full distance to offset the second easing half and reflect traveled distance; 0x00294e68-0x00294ec4 scales the last-minus-first vector and adds the first endpoint to produce moby position. --- src/overlays/l03/mobys/moving_platform_small.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l03/mobys/moving_platform_small.c b/src/overlays/l03/mobys/moving_platform_small.c index db5139eeac..86d8d7cd76 100644 --- a/src/overlays/l03/mobys/moving_platform_small.c +++ b/src/overlays/l03/mobys/moving_platform_small.c @@ -38,7 +38,7 @@ typedef struct MovingPlatformSmallVars { s32 voice; s32 unk108; s32 easing_frames; - f32 unk110; + f32 path_endpoint_distance; f32 glide_speed; } MovingPlatformSmallVars; @@ -103,11 +103,11 @@ void moving_platform_small_update(char *moby) { MOBY(moby)->scale = MOBY(moby)->pclass->scale * platform_pvars->unkFC; platform_pvars->voice = -1; if (fast_dec_timer(&platform_pvars->timer_100)) { - platform_pvars->unk110 = fast_vec_dist( + platform_pvars->path_endpoint_distance = fast_vec_dist( *(char **)(pa + 0x10) + 0x10, *(char **)(pa + 0x10) + **(int **)(pa + 0x10) * 0x10); easing_frame_count = scale_game_frames(240); platform_pvars->glide_speed = - platform_pvars->unk110 * 4.0f / + platform_pvars->path_endpoint_distance * 4.0f / convert_integer_to_float(easing_frame_count * scale_game_frames(240)); platform_pvars->easing_frames = 0; MOBY(moby)->state = PLATFORM_EASED_ENDPOINT_TRAVEL; @@ -125,12 +125,12 @@ void moving_platform_small_update(char *moby) { if (scale_game_frames(240) / 2 < platform_pvars->easing_frames) { speed = -speed; easing_frame_count = scale_game_frames(240) - platform_pvars->easing_frames; - eased_endpoint_distance = platform_pvars->unk110; + eased_endpoint_distance = platform_pvars->path_endpoint_distance; } eased_endpoint_distance += speed * 0.5f * convert_integer_to_float(easing_frame_count * easing_frame_count); if (pb[4] < 0) { - eased_endpoint_distance = platform_pvars->unk110 - eased_endpoint_distance; + eased_endpoint_distance = platform_pvars->path_endpoint_distance - eased_endpoint_distance; } fast_vec_sub(endpoint_delta_or_position, *(char **)(pb + 0x10) + **(int **)(pb + 0x10) * 0x10, From 6b3fa92884eae3ca157de4d4ea4eb2bf5b9bdfad Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:49:39 +0000 Subject: [PATCH 511/758] decomp: clarify names in update_plasmabot_aim_quaternion unk170 -> aim_quaternion_storage: Retail 0x002b3698 forms pvars+0x170; 0x002b36a8-0x002b36b4 builds an axis-2 quaternion there from aim_yaw_offset. 0x002b3768-0x002b3774 uses that same address as destination and first input to multiply_quaternions with the optional axis-1 pitch quaternion. Authoritative C passes &state->unk170 in exactly those operations, proving storage beginning with the composed aim quaternion, without assigning roles to its trailing bytes. unk26C -> aim_yaw_angular_velocity: Retail 0x002b3668/0x002b3684 passes pvars+0x268 and +0x26c to the same easing helper at 0x002b36a0. Authoritative C identifies +0x268 as aim_yaw_offset, with clamped heading-relative turn as target and &unk26C as the helper's float velocity argument. The same FUN_L00_0025be00 signature is used with heading_angular_velocity in follow_plasmabot_path and aim_joint_angular_velocity in approach_angle; initialization clears this persistent yaw velocity. unk280 -> aim_pitch_angle: Retail 0x002b36ec-0x002b3724 derives horizontal range and adjusted vertical displacement from target position minus plasmabot position. The negative arctangent becomes the target passed with pvars+0x280 at 0x002b3730-0x002b3750. 0x002b3758 loads that eased field as the angle for an axis-1 quaternion, then 0x002b3770 composes it into the aim quaternion. Authoritative C's target_pitch_angle and float reinterpretation of unk280 confirm persistent aim pitch angle storage. unk284 -> aim_pitch_angular_velocity: Retail 0x002b373c-0x002b3750 passes pvars+0x280 and +0x284 as the persistent angle and velocity pointers to the same easing helper used for yaw at 0x002b36a0, with negative target-displacement arctangent as pitch target. Authoritative C supplies &unk284 in the velocity position paired with &unk280, whose eased value builds the axis-1 pitch quaternion at 0x002b3758-0x002b3764. This matches the established heading_angular_velocity helper role, and initialization clears the persistent field. --- src/overlays/shared/enemies/plasmabot.c | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index 02239b91d7..f81c8ccb4f 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -87,7 +87,7 @@ typedef struct PlasmabotVars { u8 unk120[0x10]; u8 unk130[0x30]; u8 unk160[0x10]; - u8 unk170[0x70]; + u8 aim_quaternion_storage[0x70]; u8 unk1E0[0x10]; u8 unk1F0[0x10]; u8 unk200[0x10]; @@ -106,13 +106,13 @@ typedef struct PlasmabotVars { s16 unk262; s32 unk264; f32 aim_yaw_offset; - s32 unk26C; + s32 aim_yaw_angular_velocity; s32 unk270; s32 aim_joint_angular_velocity; f32 unk278; f32 path_traversal_direction; - s32 unk280; - s32 unk284; + s32 aim_pitch_angle; + s32 aim_pitch_angular_velocity; s32 unk288; } PlasmabotVars; @@ -463,9 +463,9 @@ void plasmabot_update(char *moby) { plasmabot_update_private_vars->heading_angular_velocity = 0; plasmabot_update_private_vars->beam_cooldown_timer = 0; *(int *)&plasmabot_update_private_vars->aim_yaw_offset = 0; - plasmabot_update_private_vars->unk26C = 0; - plasmabot_update_private_vars->unk280 = 0; - plasmabot_update_private_vars->unk284 = 0; + plasmabot_update_private_vars->aim_yaw_angular_velocity = 0; + plasmabot_update_private_vars->aim_pitch_angle = 0; + plasmabot_update_private_vars->aim_pitch_angular_velocity = 0; plasmabot_update_private_vars->unk270 = 0; plasmabot_update_private_vars->aim_joint_angular_velocity = 0; if (((unsigned char *)plasmabot_update_private_vars)[0x121] == 0) { @@ -506,7 +506,7 @@ void plasmabot_update(char *moby) { MOBY(moby)->rot.z = fast_arc_tan(path[8] - path[4], path[9] - path[5]); *(int *)&plasmabot_update_private_vars->aim_yaw_offset = 0; plasmabot_update_private_vars->path_traversal_direction = 1.0f; - plasmabot_update_private_vars->unk26C = 0; + plasmabot_update_private_vars->aim_yaw_angular_velocity = 0; plasmabot_update_private_vars->unk270 = 0; plasmabot_update_private_vars->aim_joint_angular_velocity = 0; plasmabot_update_private_vars->path_segment_index = 0; @@ -1258,12 +1258,12 @@ float update_plasmabot_aim_quaternion(char *moby, int flag, float target_angle) float yaw_easing_coefficient = frame_time_sq * 12.566370964050293f; func_L00_0025CE58_2B4828((float *)(&state->aim_yaw_offset), turn, - (float *)(&state->unk26C), + (float *)(&state->aim_yaw_angular_velocity), yaw_easing_coefficient, yaw_easing_coefficient, frame_time * 6.2831854820251465f); } - build_axis_rotation_quaternion(&state->unk170, 2, state->aim_yaw_offset); + build_axis_rotation_quaternion(&state->aim_quaternion_storage, 2, state->aim_yaw_offset); if (flag) { float owner_aim_position[4]; float owner_aim_offset[4]; @@ -1280,15 +1280,15 @@ 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->unk280), + func_L00_0025CE58_2B4828((float *)(&state->aim_pitch_angle), target_pitch_angle, - (float *)(&state->unk284), + (float *)(&state->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->unk280); - multiply_quaternions(&state->unk170, &state->unk170, cp); + build_axis_rotation_quaternion(cp, 1, *(float *)&state->aim_pitch_angle); + multiply_quaternions(&state->aim_quaternion_storage, &state->aim_quaternion_storage, cp); } return fast_difference_between_rotations(turn, state->aim_yaw_offset); } From e1400afe24c576113082763a9d7fa8d003c4f840 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:49:43 +0000 Subject: [PATCH 512/758] decomp: clarify names in spark_emitter_update f24 -> burst_timer: SparkData.f24 is passed to fast_dec_timer in SPARK_EMITTER_TIMED_BURSTS. Retail 0x00308da0/0x00308da4 checks pvars+0x24 (original Ghidra piVar2+9); completion selects five sparks at 0x00308dc4. Instructions 0x00308db0-0x00308dd8 sample 60.0..120.0, scale/truncate, and store the reset to pvars+0x24 (Ghidra piVar2[9]). The count drives spawn_spark calls at 0x00308fb0, proving this member schedules bursts rather than individual spark attributes. --- src/overlays/l06/mobys/spark_emitter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l06/mobys/spark_emitter.c b/src/overlays/l06/mobys/spark_emitter.c index d70ae28234..ed079242b7 100644 --- a/src/overlays/l06/mobys/spark_emitter.c +++ b/src/overlays/l06/mobys/spark_emitter.c @@ -24,7 +24,7 @@ typedef struct SparkData { int f4; char pad8[0x18]; int f20; - int f24; + int burst_timer; int f28; } SparkData; @@ -106,9 +106,9 @@ void spark_emitter_update(struct Moby *emitter) { case SPARK_EMITTER_TIMED_BURSTS: { int spark_count = 1; int k; - if (fast_dec_timer(&emitter_data->f24)) { + if (fast_dec_timer(&emitter_data->burst_timer)) { spark_count = 5; - emitter_data->f24 = + emitter_data->burst_timer = truncate_float_to_s32(scale_time(random_float_between(60.0f, 120.0f))); } if (random_integer_below(4) != 0 && spark_count < 2) { From 1fee094063ec7cd346ed4f3eb686bce378fdbd40 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:49:46 +0000 Subject: [PATCH 513/758] decomp: clarify names in update_blarg_elite_commando_joint_aim unk194 -> joint_1_target_pitch: Retail 0x002d4678-0x002d4704 computes negative atan of local delta XY length and Z, then clamps pitch to +/-pi/4. 0x002d4718 halves it and 0x002d4728 stores it to pvars+0x194. This is +0x64 within the +0x130 animation block passed with joint index 1 at 0x002d4874/0x002d4884/0x002d488c. Supplied update_joint_animation consumes block+0x64 as a spring_angle target; source assigns halfPitch. unk198 -> joint_1_target_yaw: Retail 0x002d465c-0x002d4668 obtains yaw from local delta X/Y; 0x002d4690-0x002d46c4 clamps it to +/-pi/4. 0x002d4714 halves yaw and 0x002d4724 stores it to pvars+0x198, +0x68 within block +0x130. That block is passed with joint index 1 at 0x002d4874/0x002d4884/0x002d488c, and supplied update_joint_animation uses block+0x68 as its rotation spring target. Source assigns halfYaw. unk214 -> joint_2_target_pitch: Retail negative atan of local delta XY length and Z at 0x002d4678/0x002d469c produces pitch, clamped through 0x002d4704 and halved at 0x002d4718. Store 0x002d4720 writes pvars+0x214, the +0x64 rotation target within animation block +0x1B0. Retail 0x002d48a0/0x002d48a4/0x002d48ac passes this block with joint index 2. Supplied update_joint_animation springs toward block+0x64; source assigns halfPitch. unk218 -> joint_2_target_yaw: Retail 0x002d4660 computes atan of local delta X/Y, clamps yaw through 0x002d46c4, halves it at 0x002d4714 and stores it at pvars+0x218 at 0x002d471c. This is the +0x68 rotation target of block +0x1B0, passed to update_joint_animation with joint index 2 at 0x002d48a0/0x002d48a4/0x002d48ac. Supplied helper springs toward block+0x68; source assigns halfYaw. unk298 -> joint_3_target_yaw: For states 4/5, retail 0x002d4790-0x002d47a4 forms the adjusted aim delta in local coordinates; 0x002d47c4/0x002d47e8 computes and negates its X/Y atan. 0x002d4810-0x002d4850 clamps this yaw to +/-0.34906584 and 0x002d4858 stores it at pvars+0x298. This is +0x68 in block +0x230, passed with joint index 3 at 0x002d48c0/0x002d48c4/0x002d48cc. Supplied helper consumes +0x68 as a spring rotation target; source assigns yaw2. --- .../shared/enemies/blarg_elite_commando.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_elite_commando.c b/src/overlays/shared/enemies/blarg_elite_commando.c index 6c1f641595..4ae4982d42 100644 --- a/src/overlays/shared/enemies/blarg_elite_commando.c +++ b/src/overlays/shared/enemies/blarg_elite_commando.c @@ -80,16 +80,16 @@ typedef struct L16DamageData { s32 unk128; int path_index; u8 unk130[0x64]; - f32 unk194; - f32 unk198; + f32 joint_1_target_pitch; + f32 joint_1_target_yaw; u8 pad19C[0x14]; u8 unk1B0[0x64]; - f32 unk214; - f32 unk218; + f32 joint_2_target_pitch; + f32 joint_2_target_yaw; u8 pad21C[0x14]; u8 unk230[0x64]; f32 unk294; - f32 unk298; + f32 joint_3_target_yaw; u8 pad29C[0x14]; f32 unk2B0; f32 unk2B4; @@ -881,10 +881,10 @@ void update_blarg_elite_commando_joint_aim(char *commando_moby) { pitch = -0.7853982f; { float halfYaw = yaw * 0.5f, halfPitch = pitch * 0.5f; - commando_data->unk198 = halfYaw; - commando_data->unk194 = halfPitch; - commando_data->unk218 = halfYaw; - commando_data->unk214 = halfPitch; + commando_data->joint_1_target_yaw = halfYaw; + commando_data->joint_1_target_pitch = halfPitch; + commando_data->joint_2_target_yaw = halfYaw; + commando_data->joint_2_target_pitch = halfPitch; } if ((unsigned int)(MOBY(commando_moby)->state - 4) < 2) { float yaw2, pitch2, bound; @@ -905,7 +905,7 @@ void update_blarg_elite_commando_joint_aim(char *commando_moby) { else if (yaw2 < -0.34906584f) yaw2 = -0.34906584f; commando_data->unk294 = pitch2; - commando_data->unk298 = yaw2; + commando_data->joint_3_target_yaw = yaw2; } } update_joint_animation( From 319424a16d54e30abc8c5958f644010662964442 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:49:50 +0000 Subject: [PATCH 514/758] decomp: clarify names in draw_target_beam unk218 -> beam_target_moby: In the supplied source, ScoutbotVars.unk218 is the char * field at +0x218, corresponding to Data_3DF8.current_target, which scoutbot_update assigns from its target. Retail 0x002d3950 loads this pointer from 0x218(s5); 0x002d3964 adds 0x10 and fast_vec_sub subtracts the moby point-2 beam origin. Retail 0x002d3978/0x002d3984 reload the pointer and its +0x18 position Z, then 0x002d398c-0x002d3998 compute (target Z + 0.25) - origin Z. The resulting delta determines length and pitch/yaw at 0x002d3994-0x002d39e4 for the beam geometry. Thus the field points to the moby whose position aims the beam, rather than storing a vector or packet. --- src/overlays/shared/enemies/scoutbot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index ddf44e9f56..3a49e99861 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -55,7 +55,7 @@ typedef struct ScoutbotVars { f32 vertical_bob_phase_increment; u8 pad210[0x6]; s16 ground_hover_offset_enabled; - char *unk218; + char *beam_target_moby; s32 target_path_index; u8 glow_quad_anchor_position[0x4]; } ScoutbotVars; @@ -482,10 +482,10 @@ void draw_target_beam(struct Moby *moby) { pk.uv[6] = 1.0f; pk.uv[7] = 1.0f; moby_point_position(moby, 2, &beam_origin_position); - fast_vec_sub(&delta, scoutbot_private_vars->unk218 + 0x10, &beam_origin_position); + fast_vec_sub(&delta, scoutbot_private_vars->beam_target_moby + 0x10, &beam_origin_position); scale_vector_002d3878(3.0f, &delta); delta.v[2] = - (*(float *)(scoutbot_private_vars->unk218 + 0x18) + 0.25f) - beam_origin_position.v[2]; + (*(float *)(scoutbot_private_vars->beam_target_moby + 0x18) + 0.25f) - beam_origin_position.v[2]; delta.v[3] = 1.0f; length = fast_vec_length(&delta); clear_u64_value(&angles); From 73cb1b2e78796f8a4e25e24fb79bdf4b84539af3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:51:41 +0000 Subject: [PATCH 515/758] decomp: clarify names in build_interpolated_dma_packet f218 -> fog_near_distance: Retail 0x002a4124/0x002a4138 loads camera +0x218 and saves it to 0x001612f8, named textured_grid_saved_fog_near_distance in authoritative C. At 0x002a4154/0x002a4158 caller +0x20 replaces this camera field outside camera fog-source mode; restore_view_after_textured_grid writes the named saved near distance back to +0x218. f21C -> fog_far_distance: Retail 0x002a4128/0x002a4140 loads camera +0x21c and saves it to 0x001612fc, named textured_grid_saved_fog_far_distance in authoritative C. At 0x002a415c/0x002a4160 caller +0x24 replaces it outside camera fog-source mode; the supplied restore function writes the saved far distance back to this field. f228 -> fog_near_intensity: Retail 0x002a412c/0x002a4148 saves camera +0x228 to 0x00161300, named textured_grid_saved_fog_near_intensity in authoritative C. Caller +0x28 overrides it at 0x002a4164/0x002a4168. Retail 0x002a42ac/0x002a42bc emits it beside far intensity in the view packet; the supplied restore function restores the named saved near intensity to this field. f22C -> fog_far_intensity: Retail 0x002a4130/0x002a4150 saves camera +0x22c to the GP-backed textured_grid_saved_fog_far_intensity in authoritative C. Caller +0x2c overrides it at 0x002a416c/0x002a4170. Retail 0x002a428c/0x002a429c emits it beside near intensity in the view packet; the supplied restore function restores the saved far intensity to this field. --- .../rendering/build_interpolated_dma_packet.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/shared/rendering/build_interpolated_dma_packet.c b/src/overlays/shared/rendering/build_interpolated_dma_packet.c index d41eef8210..3e6fcce6e9 100644 --- a/src/overlays/shared/rendering/build_interpolated_dma_packet.c +++ b/src/overlays/shared/rendering/build_interpolated_dma_packet.c @@ -32,11 +32,11 @@ typedef struct QuadCamera { char pad1B0[0x60]; float f210; char pad214[4]; - float f218; - float f21C; + float fog_near_distance; + float fog_far_distance; char pad220[8]; - float f228; - float f22C; + float fog_near_intensity; + float fog_far_intensity; int c230, c234, c238; } QuadCamera; @@ -139,15 +139,15 @@ void build_interpolated_dma_packet(QuadDrawArgs *draw_parameters) { long blend_mode; unsigned int alpha_limit; - textured_grid_saved_fog_near_distance = ((QuadCamera *)level02_camera_view_state)->f218; - textured_grid_saved_fog_far_distance = ((QuadCamera *)level02_camera_view_state)->f21C; - textured_grid_saved_fog_near_intensity = ((QuadCamera *)level02_camera_view_state)->f228; - textured_grid_saved_fog_far_intensity = ((QuadCamera *)level02_camera_view_state)->f22C; + textured_grid_saved_fog_near_distance = ((QuadCamera *)level02_camera_view_state)->fog_near_distance; + textured_grid_saved_fog_far_distance = ((QuadCamera *)level02_camera_view_state)->fog_far_distance; + textured_grid_saved_fog_near_intensity = ((QuadCamera *)level02_camera_view_state)->fog_near_intensity; + textured_grid_saved_fog_far_intensity = ((QuadCamera *)level02_camera_view_state)->fog_far_intensity; if (textured_grid_fog_source_mode != TEXTURED_GRID_FOG_SOURCE_CAMERA) { - ((QuadCamera *)level02_camera_view_state)->f218 = draw_parameters->f20; - ((QuadCamera *)level02_camera_view_state)->f21C = draw_parameters->f24; - ((QuadCamera *)level02_camera_view_state)->f228 = draw_parameters->f28; - ((QuadCamera *)level02_camera_view_state)->f22C = draw_parameters->f2C; + ((QuadCamera *)level02_camera_view_state)->fog_near_distance = draw_parameters->f20; + ((QuadCamera *)level02_camera_view_state)->fog_far_distance = draw_parameters->f24; + ((QuadCamera *)level02_camera_view_state)->fog_near_intensity = draw_parameters->f28; + ((QuadCamera *)level02_camera_view_state)->fog_far_intensity = draw_parameters->f2C; } update_view_context(); update_camera_view_matrices(); @@ -176,8 +176,8 @@ void build_interpolated_dma_packet(QuadDrawArgs *draw_parameters) { qcopy(cursor, ((QuadCamera *)level02_camera_view_state)->v190); cursor = view_setup_dma_packet + 0x30; qcopy(cursor, ((QuadCamera *)level02_camera_view_state)->v1A0); - *(float *)(view_setup_dma_packet + 0x34) = ((QuadCamera *)level02_camera_view_state)->f22C; - *(float *)(view_setup_dma_packet + 0x35) = ((QuadCamera *)level02_camera_view_state)->f228; + *(float *)(view_setup_dma_packet + 0x34) = ((QuadCamera *)level02_camera_view_state)->fog_far_intensity; + *(float *)(view_setup_dma_packet + 0x35) = ((QuadCamera *)level02_camera_view_state)->fog_near_intensity; view_setup_dma_packet[0x36] = 0; view_setup_dma_packet[0x37] = 0; view_setup_dma_packet[0x38] = 0x03000000; From e02065d231bc2dff1b066d4b89e66f7dd0a9cba9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:51:44 +0000 Subject: [PATCH 516/758] decomp: clarify names in update_hovering_rocket_attacker_common unk110 -> voice_handle: Retail 0x002c2d60 loads pvars+0x110 into a1, compares it to -1 at 0x002c2d64-68, and passes it with the moby to playback check 0x00297c78 at 0x002c2d70 (current C voice_is_playing). If absent or inactive, 0x002c2d84-94 calls allocator 0x00297fa0 with (1,4,moby) and stores its returned token at +0x110. Original Ghidra and current C agree; caller initialization sets this s32 to -1. This is the moby's maintained voice handle, without asserting a sound identity. unk67 -> hit_reaction_interpolation_target: Original retail Ghidra and C assign pvars+0x67 from hit_reaction_code: retail 0x002c3144-4c stores 250, 0x002c3150-58 stores 120, and 0x002c3170-78 stores 240 for removal reactions. At 0x002c318c-98 pvars+0x60 is passed to trooper_anim_finish (level-13 0x00269580). Checked evidence request 33f48f2386ea486d91c5dd63ab3831e1 shows relative +7 loaded at 0x00269610/30 and used in saved component +4 plus (target minus component) times progress at 0x0026962c-58. Reverse phase 0x002696dc-0x00269720 interpolates from this target back to saved +4. Thus this u8 is the hit-reaction interpolation target, without asserting the component's physical meaning. --- .../l13/mobys/hovering_rocket_attacker.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l13/mobys/hovering_rocket_attacker.c b/src/overlays/l13/mobys/hovering_rocket_attacker.c index c1fd5f9dea..ea787c35e3 100644 --- a/src/overlays/l13/mobys/hovering_rocket_attacker.c +++ b/src/overlays/l13/mobys/hovering_rocket_attacker.c @@ -87,7 +87,7 @@ typedef struct HoveringRocketAttackerVars { u8 pad_5B[0x5]; u8 anim_state; u8 pad_61[0x6]; - u8 unk67; + u8 hit_reaction_interpolation_target; u8 pad_68[0x8]; f32 unk70[4]; u8 pad_80[0x30]; @@ -107,7 +107,7 @@ typedef struct HoveringRocketAttackerVars { u8 *rocket1; u8 *rocket0; f32 unk100[4]; - s32 unk110; + s32 voice_handle; } HoveringRocketAttackerVars; /* Moby class 101 */ @@ -154,7 +154,7 @@ void hovering_rocket_attacker_update(unsigned char *moby) { moby_data->unk100[0] = random_angle_radians(); moby_data->unk100[2] = random_angle_radians(); moby_data->unk100[3] = random_angle_radians(); - moby_data->unk110 = -1; + moby_data->voice_handle = -1; break; case WAIT_TO_MOVE_TO_TABLE_POINT: if (moby_data->unkB4 == 2) @@ -403,9 +403,9 @@ void update_hovering_rocket_attacker_common(unsigned char *moby) { moby_data = ((unsigned char *)MOBY(moby)->pvars); if (MOBY(moby)->state == UPDATE_INITIALIZE) return; - if (moby_data->unk110 == -1 || voice_is_playing(moby, moby_data->unk110) == 0) { - moby_data->unk110 = -1; - moby_data->unk110 = FUN_L13_002c2d30_allocate(1, 4, moby); + if (moby_data->voice_handle == -1 || voice_is_playing(moby, moby_data->voice_handle) == 0) { + moby_data->voice_handle = -1; + moby_data->voice_handle = FUN_L13_002c2d30_allocate(1, 4, moby); } update_moby_vertical_oscillation( 0.5f, frame_time * 1.39626336f, moby, moby_data->unk100, &moby_data->unk100[1]); @@ -505,7 +505,7 @@ void update_hovering_rocket_attacker_common(unsigned char *moby) { switch (hit_reaction_code) { case HIT_REACTION_HIGH_INTERPOLATION_TARGET: case HIT_REACTION_HIGH_INTERPOLATION_TARGET_ALTERNATE: - moby_data->unk67 = 0xFA; + moby_data->hit_reaction_interpolation_target = 0xFA; break; case HIT_REACTION_LOW_INTERPOLATION_TARGET: case HIT_REACTION_LOW_INTERPOLATION_TARGET_ALTERNATE: @@ -513,13 +513,13 @@ void update_hovering_rocket_attacker_common(unsigned char *moby) { case HIT_REACTION_LOW_INTERPOLATION_TARGET_THIRD_ALTERNATE: case HIT_REACTION_LOW_INTERPOLATION_TARGET_FOURTH_ALTERNATE: case HIT_REACTION_LOW_INTERPOLATION_TARGET_FIFTH_ALTERNATE: - moby_data->unk67 = 0x78; + moby_data->hit_reaction_interpolation_target = 0x78; break; case HIT_REACTION_LETHAL: case HIT_REACTION_REMOVE: FUN_L00_00257470(moby, 0, -1); MOBY(moby)->state = EMIT_EFFECT_AND_REMOVE; - moby_data->unk67 = 0xF0; + moby_data->hit_reaction_interpolation_target = 0xF0; break; case HIT_REACTION_NONE: case HIT_REACTION_NO_HIT: From f57f65b7aae34b3122bc080610c7423cef1eb4e2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:51:47 +0000 Subject: [PATCH 517/758] decomp: clarify names in process_blarg_heavy_interceptor_hit_reactions unk67 -> hit_flash_target_red: Original retail 0x002ad990-0x002ad9a0 selects 100 for reactions 9/10 or 200 for 3-8 and stores that byte at pvars+0x67 before blending hit sequence 1. The same pvars+0x60 state is passed to trooper_anim_finish at 0x002ad9f8-0x002ad9fc. Checked level-14 helper 0x002658c8 retains that state pointer; 0x00265948-0x00265998 interpolates byte +7 from saved color byte +4 into s2, and 0x00265af0 passes s2 as the red channel a1 to the color setter, agreeing with supplied trooper_anim_finish r1/r0 source. Its return phase at 0x00265a14-0x00265a60 interpolates back from that same target. This proves a hit-flash red target rather than an offset-only role. --- src/overlays/l14/mobys/blarg_heavy_interceptor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 0163f4cef8..01a2fdef54 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -211,7 +211,7 @@ typedef struct BlargHeavyInterceptorVars { u8 pad_5B[0x5]; s16 anim_state; u8 pad_62[0x5]; - u8 unk67; + u8 hit_flash_target_red; u8 pad_68[0x8]; s32 turret_group; s32 spawn_path; @@ -831,7 +831,7 @@ void process_blarg_heavy_interceptor_hit_reactions(struct Moby *moby) { switch (hit_reaction_result) { case HIT_REACTION_ANIMATE_WITH_LOW_RED_FLASH: case HIT_REACTION_LOW_RED_FLASH_AND_HIT_ANIMATION: - blarg_heavy_interceptor_vars->unk67 = 0x64; + blarg_heavy_interceptor_vars->hit_flash_target_red = 0x64; blend_moby_animation(moby, 1, 0, 5); break; case HIT_REACTION_PLAY_HIT_ANIMATION: From 602914f5a0675e00dc8bacd07535415616107a93 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:51:50 +0000 Subject: [PATCH 518/758] decomp: clarify names in sharkigator_update unk64 -> start_in_leap_wait: In sharkigator_update, retail 0x002d16bc loads SharkigatorVars from moby+0x78; 0x002d16f4 loads its s32 +0x64 and 0x002d16f8 branches on zero. Nonzero stores state 2 at 0x002d1710 (SHARKIGATOR_WAIT_TO_LEAP), sets flags/update distance, saves moby Z at vars+0x74 and initializes the 30-frame leap timer via 0x002d1718/0x002d1b58. Zero instead reaches path initialization at 0x002d1728 and eventually stores state 1 at 0x002d17c0. The supplied C tests unk64 only in SHARKIGATOR_INITIALIZE, proving that it selects starting in leap wait. --- src/overlays/l05/mobys/sharkigator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l05/mobys/sharkigator.c b/src/overlays/l05/mobys/sharkigator.c index 91195cf707..50fb823f48 100644 --- a/src/overlays/l05/mobys/sharkigator.c +++ b/src/overlays/l05/mobys/sharkigator.c @@ -41,7 +41,7 @@ typedef struct Hero Hero; typedef struct SharkigatorVars { u8 pad_0[0x60]; s32 path_60; - s32 unk64; + s32 start_in_leap_wait; s32 unk68; s32 timer_6C; f32 unk70; @@ -86,7 +86,7 @@ void sharkigator_update(char *moby) { } state_zero: { float height; - if (sharkigator_instance_vars->unk64 != 0) { + if (sharkigator_instance_vars->start_in_leap_wait != 0) { MOBY(moby)->state = SHARKIGATOR_WAIT_TO_LEAP; MOBY(moby)->flags |= 1; MOBY(moby)->update_dist = 0xff; From b0da91ec8349d291b1705282bef6045216848950 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:53:45 +0000 Subject: [PATCH 519/758] decomp: clarify names in armed_transport_update unk18C -> bob_phase_radians: Authoritative src/overlays/shared/enemies/armed_transport.c SHA-256 1c072ceb541f2545a8586a6dc3c929b2dacd700b0a82a7f3a9173f8a23ad392e declares this f32 in ArmedTransportVars. Retail 0x002e2ae8-0x002e2b0c multiplies armed_transport_bob_phase_speed_degrees by 0.017453292 (DEG_TO_RAD) and frame_time and loads private+0x18C as the other argument to fast_add_rotations (0x001fe950). At 0x002e2b10-0x002e2b18 the returned wrapped angle is stored back to +0x18C and passed to fast_sin (0x001fe068). At 0x002e2b1c-0x002e2b34 its sine is multiplied by armed_transport_bob_amplitude, added to private+0x194/base_height and stored to Moby pos.z (+0x18). This data flow proves the stored scalar is the vertical bob phase in radians. --- src/overlays/shared/enemies/armed_transport.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/armed_transport.c b/src/overlays/shared/enemies/armed_transport.c index 03400f5f07..9226c6538a 100644 --- a/src/overlays/shared/enemies/armed_transport.c +++ b/src/overlays/shared/enemies/armed_transport.c @@ -60,7 +60,7 @@ typedef struct ArmedTransportVars { u8 unk180[0x4]; s32 unk184; f32 unk188; - f32 unk18C; + f32 bob_phase_radians; s32 voice; f32 base_height; } ArmedTransportVars; @@ -433,12 +433,12 @@ void armed_transport_update(char *transport_moby) { break; } } - transport_data->unk18C = fast_add_rotations(transport_data->unk18C, + transport_data->bob_phase_radians = fast_add_rotations(transport_data->bob_phase_radians, *(float *)&armed_transport_bob_phase_speed_degrees * DEG_TO_RAD * frame_time); MOBY(transport_moby)->pos.z = transport_data->base_height + - *(float *)&armed_transport_bob_amplitude * fast_sin(transport_data->unk18C); + *(float *)&armed_transport_bob_amplitude * fast_sin(transport_data->bob_phase_radians); update_armed_transport_joint_animation(transport_moby); } From 9a99fd84b5ae130dd07533a1d25b04158c9b5591 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:53:48 +0000 Subject: [PATCH 520/758] decomp: clarify names in red_ship_1_update unk114 -> roll_spring_velocity: The assigned retail update clears pvars+0x114 at 0x0029E068 while setting initial rotation. Supplied C update_spline_moby_orientation passes this float's address as spring_turn's vel parameter for moby->rot.x. Bounded retail helper evidence f8a1340498cc4330a29ecc953605ed7a confirms +0x114 passed in a0 at 0x0029D158, current rot.x loaded from moby+0x40 at 0x0029D16C, spring call 0x0029D184 and result stored to that same rotation at 0x0029D18C. This is persistent roll spring velocity, not merely an offset-based guess. unk14A -> respawn_timer: Assigned retail 0x0029E134 clears the s16 at pvars+0x14A before entering spline movement. Supplied C update_spline_moby_destruction_and_respawn sets this field to scale_game_frames(600) after a qualifying hit and decrements it with fast_dec_timer_s16. Bounded retail helper confirms scale call with 600 at 0x0029D404-0x0029D408, store +0x14A at 0x0029D40C, nonzero test and timer-pointer call at 0x0029DAD8-0x0029DAE8. Expiration together with the existing flag restores collision and flags at 0x0029DAEC-0x0029DB14; otherwise the moby is hidden and collision disabled. The field therefore holds the respawn countdown. unk90 -> segment_start_tangent: At segment advancement the assigned retail 0x0029E1F0 loads the previous path tangent from pvars+0xA0 and 0x0029E208 stores the full quad at +0x90 before 0x0029E20C recomputes the next tangent into +0xA0. At 0x0029E28C-0x0029E2A0 evaluate_cubic_hermite_segment receives endpoints +0xB0/+0xC0 and tangent inputs +0x90/+0xA0. Authoritative C and original retail Ghidra agree on this copy-before-recompute flow, proving +0x90 is the current segment's starting tangent, paired with its ending tangent at +0xA0. --- src/overlays/l03/mobys/red_ship_1.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l03/mobys/red_ship_1.c b/src/overlays/l03/mobys/red_ship_1.c index b2cb1933f4..43914f75bb 100644 --- a/src/overlays/l03/mobys/red_ship_1.c +++ b/src/overlays/l03/mobys/red_ship_1.c @@ -510,7 +510,7 @@ typedef struct RedShip1Vars { u8 pad_2D[0x33]; u8 unk60; u8 pad_61[0x2F]; - f32 unk90[4]; + f32 segment_start_tangent[4]; f32 unkA0; f32 unkA4; f32 unkA8; @@ -525,7 +525,7 @@ typedef struct RedShip1Vars { f32 unk108; f32 unk10C; u8 pad_110[0x4]; - f32 unk114; + f32 roll_spring_velocity; u8 pad_118[0x4]; f32 unk11C; u8 pad_120[0xC]; @@ -539,7 +539,7 @@ typedef struct RedShip1Vars { f32 unk140; f32 unk144; u8 pad_148[0x2]; - s16 unk14A; + s16 respawn_timer; u8 pad_14C[0x4]; s32 unk150; } RedShip1Vars; @@ -685,7 +685,7 @@ void red_ship_1_update(char *moby) { -fast_arc_tan(vector_length_xy(initial_path_tangent), spline_moby_pvars->unkA8); MOBY(moby)->rot.z = fast_arc_tan(spline_moby_pvars->unkA0 - zero[0], spline_moby_pvars->unkA4 - zero[1]); - spline_moby_pvars->unk114 = 0.0f; + spline_moby_pvars->roll_spring_velocity = 0.0f; spline_moby_pvars->unk11C = 0.0f; *(OvlQuad *)&MOBY(moby)->pos = *(OvlQuad *)&spline_moby_pvars->unkE0[0]; add_moby_rotation_based_offsets(moby, moby_position); @@ -702,7 +702,7 @@ void red_ship_1_update(char *moby) { if (spline_moby_pvars->timer_12C > 0) { MOBY(moby)->state = RED_SHIP_WAIT_FOR_MOVEMENT_TIMER; } else { - spline_moby_pvars->unk14A = 0; + spline_moby_pvars->respawn_timer = 0; MOBY(moby)->state = RED_SHIP_FOLLOW_PATH_SPLINE; } break; @@ -731,7 +731,7 @@ void red_ship_1_update(char *moby) { if (spline_moby_pvars->unk100 >= 1.0f) { spline_moby_pvars->unk100 -= 1.0f; advanced_path_node_index = advance_path_node_index(pm); - *(OvlQuad *)&spline_moby_pvars->unk90[0] = *(OvlQuad *)&spline_moby_pvars->unkA0; + *(OvlQuad *)&spline_moby_pvars->segment_start_tangent[0] = *(OvlQuad *)&spline_moby_pvars->unkA0; compute_path_node_tangent(path_tangent_or_moby_position, (int *)pm, 1, @@ -752,7 +752,7 @@ void red_ship_1_update(char *moby) { spline_moby_pvars->unkD0, spline_moby_pvars->unkB0, spline_moby_pvars->unkC0, - spline_moby_pvars->unk90, + spline_moby_pvars->segment_start_tangent, path_tangent_or_moby_position); if (!flag) { update_spline_moby_orientation(moby); From 2b3b2785d814bbf63aa6db3502cac6a5b9b9e7b3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:53:51 +0000 Subject: [PATCH 521/758] decomp: clarify names in bombomatic_update unkBA -> launch_burst_index: Authoritative C resets unkBA to zero on BOMBOMATIC_WAIT_TO_LAUNCH -> BOMBOMATIC_LAUNCH_BURST, passes it as spawn_bombomatic_projectile's existing short burst_index argument, then increments it once after each launch. Original retail decompilation agrees. Retail 0x0030d844 stores zero at pvars+0xBA; 0x0030dae0 loads that signed halfword into a3 for the 0x0030daec projectile-spawn call; 0x0030daf4..0x0030dafc loads, adds one and stores it back. The same-file spawn helper copies burst_index into the spawned projectile data+0x14. This proves a per-burst launch index, preserving s16 and all operations. --- src/overlays/l07/mobys/bombomatic.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l07/mobys/bombomatic.c b/src/overlays/l07/mobys/bombomatic.c index b8347e9382..a75a7c6eee 100644 --- a/src/overlays/l07/mobys/bombomatic.c +++ b/src/overlays/l07/mobys/bombomatic.c @@ -173,7 +173,7 @@ typedef struct BombomaticVars { s32 unkB0; s32 unkB4; s16 timer_B8; - s16 unkBA; + s16 launch_burst_index; f32 unkBC; f32 unkC0; s32 unkC4; @@ -354,7 +354,7 @@ void bombomatic_update(char *moby) { moby_data->unkB4 = D_L07_0015F5CC + r9; moby_data->timer_B8 = 0; moby_data->unkBC = random_angle_radians(); - moby_data->unkBA = 0; + moby_data->launch_burst_index = 0; MOBY(moby)->state = BOMBOMATIC_LAUNCH_BURST; } break; @@ -407,8 +407,8 @@ void bombomatic_update(char *moby) { debris_velocity[2] = FUN_L00_0025abf0( vA0, launch_work_vector, 0, D_0015ED6C_gp * 7.0f, -(D_0015ED70 * 9.8f)); fast_vec_add(vA0, vA0, debris_velocity); - spawn_bombomatic_projectile(vA0, debris_velocity, (int)moby, moby_data->unkBA); - moby_data->unkBA = moby_data->unkBA + 1; + spawn_bombomatic_projectile(vA0, debris_velocity, (int)moby, moby_data->launch_burst_index); + moby_data->launch_burst_index = moby_data->launch_burst_index + 1; } eeE4: if (moby_data->unkB4 <= D_L07_0015F5CC) { From ed8b3fd11a87722b5d4285fc1504b94f3fbccf3e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:56:25 +0000 Subject: [PATCH 522/758] decomp: clarify names in decoy_update unk6E -> hit_cooldown_latched: Authoritative DecoyVars declares this s8 at +0x6e. Original retail Ghidra case 0 and sb zero at 0x002c4608 initialize it clear. In shared settled/pre-removal hit processing, 0x002c4cc8..0x002c4ccc first require short cooldown +0x6c zero. The hit-record type comparison at 0x002c4cd4..0x002c4cdc requires 0x101; ld/mask at 0x002c4ce4..0x002c4cfc tests bytes +0x6c,+0x6d,+0x6e, thereby also requiring this flag clear. 0x002c4d04..0x002c4d14 then stores scaled 100 to the short cooldown and 1 to this byte. Other processed hit conditions clear the byte at 0x002c4ce0/0x002c4d00. C uses agree: the flag survives timer expiry to inhibit immediate rearming, proving a hit-cooldown latch without identifying type 0x101. unk6F -> collision_voice_cooldown: Authoritative DecoyVars declares this s8 at +0x6f. Original retail Ghidra case 2 and instructions 0x002c4ba0..0x002c4bc8 pass its address to FUN_001fefc8 after collision response; a nonzero return calls the established allocate_voice_for_target_entry(0,0,moby), then reloads the byte with scale_game_frames(20). Bounded helper evidence request 78c41797b4fb497fbe305347214b218d confirms 0x001fefc8 loads the byte unsigned, returns 1 when already zero, otherwise decrements/stores it at 0x001fefd8..0x001fefe4 and returns 2 upon expiry or 0 while still positive. The zero-return branch instead perturbs velocity. This proves a collision-branch voice-allocation cooldown, without claiming unconditional frame ticking or a particular sound. --- src/overlays/shared/weapons/decoy.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/weapons/decoy.c b/src/overlays/shared/weapons/decoy.c index 05d5d56eac..d32e23189a 100644 --- a/src/overlays/shared/weapons/decoy.c +++ b/src/overlays/shared/weapons/decoy.c @@ -53,8 +53,8 @@ typedef struct DecoyVars { s32 unk5C; u8 pad60[0xc]; s16 unk6C; - s8 unk6E; - s8 unk6F; + s8 hit_cooldown_latched; + s8 collision_voice_cooldown; } DecoyVars; typedef struct { @@ -602,7 +602,7 @@ void decoy_update(char *moby) { decoy_instance_vars->unk44 = 0; MOBY(moby)->collision_disable = -1; decoy_instance_vars->unk6C = 0; - decoy_instance_vars->unk6E = 0; + decoy_instance_vars->hit_cooldown_latched = 0; break; case DECOY_HELD: { char *target; @@ -710,9 +710,9 @@ void decoy_update(char *moby) { } } destroy_decoy_on_selected_materials(moby); - if (fast_subtract_rotations_cf(&decoy_instance_vars->unk6F)) + if (fast_subtract_rotations_cf(&decoy_instance_vars->collision_voice_cooldown)) allocate_voice_for_target_entry(0, 0, moby), - decoy_instance_vars->unk6F = FUN_001fef20_2c4380(20); + decoy_instance_vars->collision_voice_cooldown = FUN_001fef20_2c4380(20); else add_random_offset_to_vector_xyz(frame_time, &decoy_instance_vars->unk10); } @@ -750,9 +750,9 @@ void decoy_update(char *moby) { ((*(u64 *)((char *)decoy_instance_vars + 0x68) & 0xffffff00000000ULL) == 0)) { decoy_instance_vars->unk6C = FUN_001fef20_2c4380(100); - decoy_instance_vars->unk6E = 1; + decoy_instance_vars->hit_cooldown_latched = 1; } else - decoy_instance_vars->unk6E = 0; + decoy_instance_vars->hit_cooldown_latched = 0; allocate_voice_for_target_entry(0, 0, moby); { float len = *(float *)(target + 0x2c); From 91224fbe4aa17b115ac9c35416c642b628b7f464 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:58:49 +0000 Subject: [PATCH 523/758] decomp: clarify names in command_falling_platform_update unkBD -> pre_fall_delay: In the authoritative C, command 2 enters PLATFORM_TIMED_SWAY_BEFORE_FALL and copies this u8 into unkAC. Retail 0x0031137c-0x00311380 loads pvars+0xBD unsigned and stores it at +0xAC; 0x003115a8-0x003115d8 decrements that timer and only on expiry enters PLATFORM_TILT_AND_FALL. This establishes the configured delay before falling. unkBE -> fall_signaling_enabled: Retail 0x003114ac-0x003114c0 tests pvars+0xBE before passing moby+0x21 and command 2 to 0x00281be0. Checked level-07 helper 0x00281be0-0x00281c2c iterates a selected list of moby indices and writes that command to each moby+0xBC. At 0x003115b8-0x003115cc the same nonzero flag gates the parent pvars signal write and parent state 12 immediately before the platform enters falling state 3. The C uses agree: this flag enables fall-related group and parent signaling. unkBF -> parent_fall_signal: The authoritative C copies this u8 to parent_data[0x19D] when timed sway expires, then sets parent state 12 and platform state PLATFORM_TILT_AND_FALL. Retail 0x00311354-0x0031135c resolves parent and parent pvars; 0x003115c4 loads pvars+0xBF, 0x003115c8 stores the byte into parent pvars+0x19D, and 0x003115cc-0x003115d8 sets the parent and platform states. This is the configured byte signaled to the parent as falling begins; its enum interpretation is unknown. --- src/overlays/l07/mobys/command_falling_platform.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l07/mobys/command_falling_platform.c b/src/overlays/l07/mobys/command_falling_platform.c index 7136f98264..8ca22a5788 100644 --- a/src/overlays/l07/mobys/command_falling_platform.c +++ b/src/overlays/l07/mobys/command_falling_platform.c @@ -47,9 +47,9 @@ typedef struct CommandFallingPlatformVars { f32 unkB4; f32 unkB8; u8 unkBC; - u8 unkBD; - u8 unkBE; - u8 unkBF; + u8 pre_fall_delay; + u8 fall_signaling_enabled; + u8 parent_fall_signal; f32 unkC0; f32 unkC4; s32 unkC8; @@ -94,7 +94,7 @@ void command_falling_platform_update(char *moby) { if (((unsigned char *)moby)[0xBC] == 2) { MOBY(moby)->state = PLATFORM_TIMED_SWAY_BEFORE_FALL; MOBY(moby)->command = 3; - falling_platform_vars->unkAC = falling_platform_vars->unkBD; + falling_platform_vars->unkAC = falling_platform_vars->pre_fall_delay; } switch (((unsigned char *)moby)[0x20]) { case PLATFORM_INITIALIZE: @@ -126,7 +126,7 @@ void command_falling_platform_update(char *moby) { break; if (falling_platform_vars->unkAC == 0) falling_platform_vars->unkAC = rand() % 10; - if (falling_platform_vars->unkBE != 0) + if (falling_platform_vars->fall_signaling_enabled != 0) FUN_L01_0026e090(((unsigned char *)moby)[0x21], 2); MOBY(moby)->rot.x = fast_add_rotations( falling_platform_vars->saved_rot_x, @@ -152,8 +152,8 @@ void command_falling_platform_update(char *moby) { 0.017453292f); if (!fast_dec_timer(&falling_platform_vars->unkAC)) break; - if (falling_platform_vars->unkBE != 0) { - parent_data[0x19D] = falling_platform_vars->unkBF; + if (falling_platform_vars->fall_signaling_enabled != 0) { + parent_data[0x19D] = falling_platform_vars->parent_fall_signal; parent[0x20] = 12; } MOBY(moby)->state = PLATFORM_TILT_AND_FALL; From ebb6fd9e1df47e98064f834e676c7d8cfb583912 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:58:53 +0000 Subject: [PATCH 524/758] decomp: clarify names in update_toxic_crab_hit_reactions_and_targeting f160 -> selected_target_moby: Retail root 0x002e4794-0x002e47a8 defaults pvars+0x160 to hero.moby. Bounded helper 0x002527c8 receives pvars+0x120; 0x00252974 writes the selected moby at output+0x40 (=pvars+0x160), alongside its position. The supplied toxic_crab_update reads the same field as tgt and uses its position for pursuit and melee. f164 -> target_selection_status: Root 0x002e4620/0x002e468c writes 2 at pvars+0x164 when tracked position exceeds home range or vertical tolerance. Bounded helper 0x002527c8 receives pvars+0x120 and stores selection status s5 at output+0x44 at 0x002529bc/0x002529f0/0x00252a0c: 0 for hero fallback, 1 for selected candidate, 2 when no target is available. Caller tests i164 to activate, pursue or return home. f1AC -> target_range_boost_timer_frames: Retail 0x002e3f80-0x002e3fa8 initializes pvars+0x1AC from scaled random 180..240 and 0x002e3fb0-0x002e3fb4 decrements it with fast_dec_timer. At 0x002e4534-0x002e4548 its nonzero state increases targeting range f1A0 by 6; 0x002e45b4-0x002e45c8 selects direct target refresh while active. This proves a timed target-range boost without assuming its gameplay trigger. f1B0 -> target_path_index: Retail 0x002e4670 loads pvars+0x1B0; 0x002e4690-0x002e46ac multiplies it by four and indexes the level path table at 0x001b0930. 0x002e46b8-0x002e46c0 passes that path's count and points to the targeting helper. Current C expresses exactly l10_paths[moby_data->f1B0]->points/count. f1D4 -> target_loss_frames: Retail 0x002e46c4-0x002e46f8 increments pvars+0x1D4 once per update only outside WAIT_FOR_ACTIVATION with target selection status 2, and compares it with scale_game_frames(300). 0x002e4704-0x002e4784 then returns home or waits. 0x002e4530/0x002e4790 and the non-2 branch reset it. Status 2 is the helper's no-target status and is also forced for out-of-range targets. f38 -> target_range_boost_pending: At retail 0x002e3f6c-0x002e3f78 nonzero pvars+0x38 triggers the reaction helper; 0x002e3f80-0x002e3fa8 initializes the scaled 180..240 timer at pvars+0x1AC, and 0x002e3fac clears pvars+0x38. That timer's nonzero state boosts targeting range by 6 at 0x002e4534-0x002e4548. The field is thus a consumed pending request for that boost; its producer and original trigger are not inferred. f88 -> knockback_xy_scale: Retail 0x002e43f0/0x002e4494 passes pvars+0x88 as the third pointer to the source-bound trooper_knockback_arc call at 0x002e4400/0x002e44a4. Supplied helper source multiplies that pointed scalar by vector_length_xy(input_vector_copy) when the hit vector uses the 5627.9248046875 sentinel. Current C passes &moby_data->f88 in both hit-knockback branches. f8C -> knockback_z_scale: Retail 0x002e43f8/0x002e449c passes pvars+0x8C as the fourth pointer to trooper_knockback_arc at 0x002e4400/0x002e44a4. Supplied helper source multiplies that pointed scalar by the hit vector z component in its sentinel branch. Current C passes &moby_data->f8C while configuring state HIT_KNOCKBACK, proving the vertical knockback scale role. --- src/overlays/l10/mobys/toxic_crab.c | 56 ++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index 870c490da0..a98f61fee3 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -974,7 +974,7 @@ typedef struct D_2E52B0 { char p24[2]; short h26; char p28[0x10]; - int f38; + int target_range_boost_pending; char p3C[0x24]; char a60[7]; unsigned char b67; @@ -982,8 +982,8 @@ typedef struct D_2E52B0 { float a70[4]; float f80; char p84[4]; - float f88; - float f8C; + float knockback_xy_scale; + float knockback_z_scale; int f90; int f94; float f98; @@ -995,17 +995,17 @@ typedef struct D_2E52B0 { char pC8[0x58]; AlignedVec4f a120; char p130[0x30]; - struct Moby *f160; - int f164; + struct Moby *selected_target_moby; + int target_selection_status; char p168[8]; AlignedVec4f a170; char p180[0x20]; float f1A0; char p1A4[8]; - int f1AC; - int f1B0; + int target_range_boost_timer_frames; + int target_path_index; char p1B4[0x20]; - int f1D4; + int target_loss_frames; } D_2E52B0; typedef struct Hit_2E52B0 { @@ -1064,13 +1064,13 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { moby->state = TOXIC_CRAB_STATE_ACTIVATE; } } - if (moby_data->f38 != 0) { + if (moby_data->target_range_boost_pending != 0) { func_L10_002E14F8_2E52B0(moby); - moby_data->f1AC = + moby_data->target_range_boost_timer_frames = truncate_float_to_s32(func_001F9878_2E52B0(random_float_between(180.0f, 240.0f))); - moby_data->f38 = 0; + moby_data->target_range_boost_pending = 0; } - fast_dec_timer(&moby_data->f1AC); + fast_dec_timer(&moby_data->target_range_boost_timer_frames); A = 1; B = 0.0f; hit_record = find_moby_hit(moby, 0xB30000, 0); @@ -1081,7 +1081,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { moby->state != TOXIC_CRAB_STATE_FALL_TO_DEATH) { if (current_level_index == 10 && hit_record != 0 && hit_record->f20 != 0 && hit_record->f20->oclass == 0x31A) { - if (moby_data->f1AC != 0 && item_unlocked[0x11] == 0) { + if (moby_data->target_range_boost_timer_frames != 0 && item_unlocked[0x11] == 0) { item_unlocked[0x11] = 1; allocate_voice_for_bank_entry(1, 0, 0); queue_dialogue_message(0x53D6, -1); @@ -1158,7 +1158,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { moby_data->fC0 = 8.0f; moby_data->fC4 = 10.0f; *(u128_2E52B0 *)&vA = *(u128_2E52B0 *)&hit_record->pos; - trooper_knockback_arc(&vA, &fx, &moby_data->f88, &moby_data->f8C); + trooper_knockback_arc(&vA, &fx, &moby_data->knockback_xy_scale, &moby_data->knockback_z_scale); func_L00_0025D5B0_2E52B0(moby, moby_data->a70, 9, 1, 0, fx); moby_data->b67 = 0xFA; trooper_anim_update(moby, moby_data->a60); @@ -1174,7 +1174,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { moby_data->fC0 = 3.5f; moby_data->fC4 = 7.0f; *(u128_2E52B0 *)&vA = *(u128_2E52B0 *)&hit_record->pos; - trooper_knockback_arc(&vA, &fx, &moby_data->f88, &moby_data->f8C); + trooper_knockback_arc(&vA, &fx, &moby_data->knockback_xy_scale, &moby_data->knockback_z_scale); func_L00_0025D5B0_2E52B0( moby, moby_data->a70, 9, 1, 0, fast_arc_tan(hit_record->pos.x, hit_record->pos.y)); moby_data->b67 = 0xFA; @@ -1194,10 +1194,10 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { moby->hit_slot = 0xFF; trooper_anim_finish(moby, moby_data->a60); if ((unsigned char)(moby->state - 10) < 3) { - moby_data->f1D4 = 0; + moby_data->target_loss_frames = 0; return; } - if (moby_data->f1AC != 0) { + if (moby_data->target_range_boost_timer_frames != 0) { moby_data->f1A0 = D_L10_00161E40_gp + 6.0f; } else if (moby->state == TOXIC_CRAB_STATE_WAIT_FOR_ACTIVATION) { if (moby == ((Moby *)((Hero *)(((char *)&hero)))->unk240) || @@ -1211,28 +1211,28 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { } else { moby_data->f1A0 = D_L10_00161E40_gp; } - if (moby_data->f1AC != 0) { + if (moby_data->target_range_boost_timer_frames != 0) { func_L00_00260D30_2E52B0(moby, &moby_data->a120, moby_data->f1A0); if (moby_data->f1A0 < vector_distance_xy(&moby_data->a170, &moby_data->a120) || 3.0f < absolute_float(moby->pos.z - moby_data->a120.z)) { - moby_data->f164 = 2; + moby_data->target_selection_status = 2; } } else if (moby_data->f1A0 < vector_distance_xy(&moby_data->a170, &moby_data->a120) || 3.0f < absolute_float(moby->pos.z - moby_data->a120.z)) { func_L00_00260D30_2E52B0(moby, &moby_data->a120, moby_data->f1A0); - moby_data->f164 = 2; + moby_data->target_selection_status = 2; } else { activate_effect_l08(moby_data->f1A0, moby, &moby_data->a120, 0, 0, - l10_paths[moby_data->f1B0]->points, - l10_paths[moby_data->f1B0]->count); + l10_paths[moby_data->target_path_index]->points, + l10_paths[moby_data->target_path_index]->count); } - if (moby->state != TOXIC_CRAB_STATE_WAIT_FOR_ACTIVATION && moby_data->f164 == 2) { - moby_data->f1D4++; - if (scale_game_frames(300) < moby_data->f1D4) { + if (moby->state != TOXIC_CRAB_STATE_WAIT_FOR_ACTIVATION && moby_data->target_selection_status == 2) { + moby_data->target_loss_frames++; + if (scale_game_frames(300) < moby_data->target_loss_frames) { if (1.0f < fast_vec_dist(&moby->pos, &moby_data->a170)) { moby->state = TOXIC_CRAB_STATE_RETURN_HOME; if (moby->prev_seq != 4) @@ -1244,10 +1244,10 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { } } } else { - moby_data->f1D4 = 0; + moby_data->target_loss_frames = 0; } - if (moby_data->f160 == 0) - moby_data->f160 = ((Hero *)(((char *)&hero)))->moby; + if (moby_data->selected_target_moby == 0) + moby_data->selected_target_moby = ((Hero *)(((char *)&hero)))->moby; } extern float toxic_crab_group_approach_angle_limit_degrees_gp __asm__("D_L10_00161E48") From 3b16b317571487d3bd7b3a25f2e9a6303fdc4b1a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 11:58:56 +0000 Subject: [PATCH 525/758] decomp: clarify names in blarg_ship_update b53 -> requested_animation_sequence: Retail blend helper 0024a318 saves sequence argument a1 in s3, uses it to index animation records at model+0x48, and 0024a3dc stores s3 to moby+0x53 while +0x52 is separately cleared to 0xff at 0024a3c0. Assigned 002e51dc-002e5200 compares +0x53 with sequence 3 before requesting that same sequence; this is the requested sequence, distinct from current +0x52. f160 -> firing_duration_seconds: At 002e4fd8 state becomes FIRE_AT_TARGET and 002e4fe8 loads private +0x160. The shared chain 002e57dc-002e57f4 multiplies by 60, frame-scales, truncates and stores +0x168. The same field reloads on cooldown expiry 002e55bc and hit recovery 002e5774, proving configured firing-phase duration in seconds. f164 -> cooldown_duration_seconds: At 002e53bc state becomes FIRE_COOLDOWN, then 002e53c4 loads private +0x164. 002e55c0-002e55d0 frame-scales its product with 60, truncates and stores countdown +0x168. Hit recovery into cooldown repeats this at 002e57d4-002e57f4; the field supplies cooldown duration in seconds. f198 -> heading_turn_velocity: Assigned 002e4d0c computes target-minus-ship XY atan, and 002e4d24-002e4d34 passes that desired heading and private +0x198 to FUN_L00_00258278. Its supplied declaration identifies the pointer argument as vel; the same heading spring chain repeats at 002e4ee4, 002e5138 and 002e551c. f19C -> pitch_turn_velocity: Private +0x19c is zeroed at 002e4b6c, then passed by address to spring_turn at 002e4d74-002e4d78 with current ship+0x44 and negative aim elevation. The supplied spring_turn declaration identifies this pointer as vel; pitch smoothing repeats at 002e4f34, 002e5188 and 002e556c. f44 -> pitch: 002e4d50 computes atan(horizontal distance,target Z minus ship Z); 002e4d60 negates elevation and spring_turn reads ship+0x44 at 002e4d64 and writes it at 002e4d88. 002e527c-002e5290 negates this same field as the elevation input to build_spherical_offset, proving the stored pitch angle. f48 -> heading: 002e5194-002e51ac computes atan(target XY minus ship XY), then 002e51b0-002e51b8 compares it with ship+0x48 via fast_difference_between_rotations. 002e5284 passes +0x48 as the heading input to build_spherical_offset with unit radius and negative pitch, proving the ship heading angle. f58 -> animation_speed: Assigned 002e5204-002e5208 writes blarg_ship_firing_animation_speed_gp to ship+0x58 after requesting firing sequence 3; 002e55b0 and 002e5768 repeat this on firing entry. Checked blend_moby_animation resets +0x58 to 1.0 at 0024a3e0, separately setting reciprocal blend duration at +0x5c, consistent with the supplied animation-window context unk58*unk5C. i114 -> targeting_status: Assigned 002e521c-002e5224 tests private +0x114 against 2 to suppress rocket emission. Supplied directly called update_blarg_ship_hit_reactions_and_targeting maps the same +0x114 to unk114, setting 2 when target selection fails or the target is outside its allowed path, and 0 when the selected target is inside. This proves a targeting status without inventing all status meanings. i140 -> entry_path_index: 002e4ad8-002e4af4 checks private +0x140 against -1 and prints the missing-path error before removal. 002e4b7c-002e4b94 uses it to index l10_paths and copies the first point to ship position; 002e4e4c-002e4e7c follows its points in FOLLOW_ENTRY_PATH until state 4 is entered. i144 -> firing_path_index: 002e55d4-002e5600 loads private +0x144, indexes l10_paths, and fetches the point selected by +0x158. Assigned states FIRE_AT_TARGET and FIRE_COOLDOWN share this motion chain; 002e5660-002e568c bounds point advancement using that path's count, proving the path used during firing and cooldown. i148 -> activation_volume_index: 002e4c10 loads private +0x148 as the clip-volume argument, while 002e4c18 passes target position to is_point_inside_clip_volume. Its true result changes state from WAIT_FOR_TARGET_IN_VOLUME to RISE_TO_ENTRY_PATH at 002e4c1c-002e4c30, proving the target activation volume index. i158 -> path_point_index: 002e4e58-002e4e78 shifts private +0x158 by four to select an aligned point from the entry path. 002e4fac-002e4fcc increments it only below path count and 002e4fd4 resets it when entry completes. 002e55e0-002e5600 and 002e5664-002e568c reuse it to select and advance firing-path points. i168 -> firing_phase_timer: 002e5378-002e5380 passes private +0x168 to fast_dec_timer and on expiry enters cooldown at 002e53bc. 002e5578-002e55ac decrements the same timer in cooldown and returns to firing on expiry. 002e55c0-002e55d0 reloads the frame-scaled duration, proving a countdown shared by both firing phases. i1B0 -> departure_volume_index: 002e4ff0-002e5000 supplies private +0x1b0 and hero position to is_point_inside_clip_volume. A true result branches to 002e53e4-002e53e8 and writes FLY_AWAY state 6. Cooldown repeats the test at 002e53cc-002e53dc, proving the volume index that triggers departure. --- src/overlays/l10/mobys/blarg_ship.c | 134 ++++++++++++++-------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/src/overlays/l10/mobys/blarg_ship.c b/src/overlays/l10/mobys/blarg_ship.c index 9175d17f69..24870e6b20 100644 --- a/src/overlays/l10/mobys/blarg_ship.c +++ b/src/overlays/l10/mobys/blarg_ship.c @@ -77,13 +77,13 @@ typedef struct Ship_5E48 { short s32; unsigned short s34; char p36[0xE]; - float f44; - float f48; + float pitch; + float heading; char p4C[6]; unsigned char b52; - unsigned char b53; + unsigned char requested_animation_sequence; char p54[4]; - float f58; + float animation_speed; char p5C[0x14]; unsigned char b70; char p71[7]; @@ -113,25 +113,25 @@ typedef struct ShipD_5E48 { AlignedVec4f vF0; char p100[0x10]; Ship_5E48 *tgt; - int i114; + int targeting_status; char p118[8]; AlignedVec4f a120; char p130[0x10]; - int i140; - int i144; - int i148; + int entry_path_index; + int firing_path_index; + int activation_volume_index; char p14C[0xC]; - int i158; + int path_point_index; char p15C[4]; - float f160; - float f164; - int i168; + float firing_duration_seconds; + float cooldown_duration_seconds; + int firing_phase_timer; char p16C[0x2A]; short s196; - float f198; - float f19C; + float heading_turn_velocity; + float pitch_turn_velocity; char p1A0[0x10]; - int i1B0; + int departure_volume_index; char p1B4[0x1C]; unsigned char a1D0[4]; } ShipD_5E48; @@ -205,7 +205,7 @@ void blarg_ship_update(Ship_5E48 *ship) { float aim_elevation; FUN_L00_00263ac8(2.5f, (int)ship, 2, d->a1D0); - if (d->i140 == -1) { + if (d->entry_path_index == -1) { DebugPrint(blarg_ship_missing_path_error_format, ship->sA6, ship->hA8); goto del; } @@ -218,23 +218,23 @@ void blarg_ship_update(Ship_5E48 *ship) { d->s24 = truncate_float_to_s32(9.0f); d->b28 = 3; d->b29 = 0; - d->f19C = 0.0f; + d->pitch_turn_velocity = 0.0f; ship->s32 = 0x7F; - qcopy(&ship->pos, &l10_paths[d->i140]->points[0]); + qcopy(&ship->pos, &l10_paths[d->entry_path_index]->points[0]); d->s196 = scale_game_frames(D_L10_00161EE4); ship->i94 = 0; ship->s34 |= 0x41; - if (ship->b53 != 0) + if (ship->requested_animation_sequence != 0) blend_moby_animation(ship, 0, 0, 0); ship->state = BLARG_SHIP_STATE_WAIT_FOR_TARGET_IN_VOLUME; if (visited52[ship->bB0 + (D_0015ED84 << 4)] != 0xFF) break; goto del; case BLARG_SHIP_STATE_WAIT_FOR_TARGET_IN_VOLUME: - if (!is_point_inside_clip_volume(&tgt->pos, d->i148)) + if (!is_point_inside_clip_volume(&tgt->pos, d->activation_volume_index)) break; ship->state = BLARG_SHIP_STATE_RISE_TO_ENTRY_PATH; - if (ship->b53 != 1) + if (ship->requested_animation_sequence != 1) blend_moby_animation(ship, 1, 0, scale_game_frames(20)); ship->s34 &= 0xFFBE; ship->i94 = *(int *)(ship->p24 + 0x10); @@ -246,45 +246,45 @@ void blarg_ship_update(Ship_5E48 *ship) { case BLARG_SHIP_STATE_RISE_TO_ENTRY_PATH: desired_heading = fast_arc_tan(tgt->pos.x - ship->pos.x, tgt->pos.y - ship->pos.y); FUN_L00_00258278( - (char *)ship, &d->f198, desired_heading, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); + (char *)ship, &d->heading_turn_velocity, desired_heading, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); aim_elevation = fast_arc_tan(vector_distance_xy(&ship->pos, &tgt->pos), tgt->pos.z - ship->pos.z); - ship->f44 = - spring_turn(&d->f19C, ship->f44, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); - if ((ship->b70 & 2) && ship->b53 == 1) + ship->pitch = + spring_turn(&d->pitch_turn_velocity, ship->pitch, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); + if ((ship->b70 & 2) && ship->requested_animation_sequence == 1) blend_moby_animation(ship, 2, 0, scale_game_frames(20)); ship->pos.z += D_0015ED6C * 4.0f; - if (fast_vec_dist(&ship->pos, &l10_paths[d->i140]->points[0]) < 0.5f) { + if (fast_vec_dist(&ship->pos, &l10_paths[d->entry_path_index]->points[0]) < 0.5f) { ship->state = BLARG_SHIP_STATE_FOLLOW_ENTRY_PATH; - if (ship->b53 != 2) + if (ship->requested_animation_sequence != 2) blend_moby_animation(ship, 2, 0, scale_game_frames(10)); } break; case BLARG_SHIP_STATE_FOLLOW_ENTRY_PATH: - qcopy(&A, &l10_paths[d->i140]->points[d->i158]); + qcopy(&A, &l10_paths[d->entry_path_index]->points[d->path_point_index]); desired_heading = fast_arc_tan(A.x - ship->pos.x, A.y - ship->pos.y); FUN_L00_00258278( - (char *)ship, &d->f198, desired_heading, 0.02f, 0.3f, D_0015ED6C * 12.566371f); + (char *)ship, &d->heading_turn_velocity, desired_heading, 0.02f, 0.3f, D_0015ED6C * 12.566371f); aim_elevation = fast_arc_tan(vector_distance_xy(&ship->pos, &tgt->pos), tgt->pos.z - ship->pos.z); - ship->f44 = - spring_turn(&d->f19C, ship->f44, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); + ship->pitch = + spring_turn(&d->pitch_turn_velocity, ship->pitch, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); fast_vec_sub(&B, &A, &ship->pos); fast_vec_normalize(&d->a120, &B, D_0015ED6C * 8.0f); fast_vec_add(&ship->pos, &ship->pos, &d->a120); if (fast_vec_length(&B) < 0.5f) { - int n = d->i158 + 1; - if (n < l10_paths[d->i140]->count) { - d->i158 = n; + int n = d->path_point_index + 1; + if (n < l10_paths[d->entry_path_index]->count) { + d->path_point_index = n; } else { - d->i158 = 0; + d->path_point_index = 0; ship->state = BLARG_SHIP_STATE_FIRE_AT_TARGET; - d->i168 = truncate_float_to_s32(FUN_L04_001f1978(d->f160 * 60.0f)); + d->firing_phase_timer = truncate_float_to_s32(FUN_L04_001f1978(d->firing_duration_seconds * 60.0f)); } } break; case BLARG_SHIP_STATE_FIRE_AT_TARGET: - if (is_point_inside_clip_volume(&(&hero)->motion.pos, d->i1B0)) { + if (is_point_inside_clip_volume(&(&hero)->motion.pos, d->departure_volume_index)) { ship->state = BLARG_SHIP_STATE_FLY_AWAY; break; } @@ -304,23 +304,23 @@ void blarg_ship_update(Ship_5E48 *ship) { } desired_heading = fast_arc_tan(tgt->pos.x - ship->pos.x, tgt->pos.y - ship->pos.y); FUN_L00_00258278( - (char *)ship, &d->f198, desired_heading, 0.02f, 0.3f, D_0015ED6C * 12.566371f); + (char *)ship, &d->heading_turn_velocity, desired_heading, 0.02f, 0.3f, D_0015ED6C * 12.566371f); aim_elevation = fast_arc_tan(vector_distance_xy(&ship->pos, &A), A.z - ship->pos.z); - ship->f44 = - spring_turn(&d->f19C, ship->f44, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); + ship->pitch = + spring_turn(&d->pitch_turn_velocity, ship->pitch, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); if (fast_difference_between_rotations( - ship->f48, fast_arc_tan(tgt->pos.x - ship->pos.x, tgt->pos.y - ship->pos.y)) < + ship->heading, fast_arc_tan(tgt->pos.x - ship->pos.x, tgt->pos.y - ship->pos.y)) < 0.17453292f) { - if (ship->b53 != 3) + if (ship->requested_animation_sequence != 3) blend_moby_animation(ship, 3, 0, scale_game_frames(6)); - ship->f58 = blarg_ship_firing_animation_speed_gp; + ship->animation_speed = blarg_ship_firing_animation_speed_gp; } - if (ship->b52 == 3 && d->i114 != 2 && D_L10_001742D8 == tgt) { + if (ship->b52 == 3 && d->targeting_status != 2 && D_L10_001742D8 == tgt) { int near = is_value_within_interpolated_window((char *)ship, 1.0f); int far = is_value_within_interpolated_window((char *)ship, 16.0f); if (near || far) { FUN_L00_0024f7c8(ship, far == 0, &C); - build_spherical_offset(&B, 1.0f, ship->f48, -ship->f44); + build_spherical_offset(&B, 1.0f, ship->heading, -ship->pitch); add_vectors(&D, &C, &B); fast_vec_sub(&B, &A, &C); fast_vec_normalize(&B, &B, blarg_ship_rocket_speed_gp * D_0015ED6C); @@ -329,27 +329,27 @@ void blarg_ship_update(Ship_5E48 *ship) { emit_radial_particle_burst(ship, &E, 0); spawn_blarg_ship_rocket(&B, &C, (int)ship, (int)tgt, scale_game_frames(300), 1.0f); } - } else if (ship->b52 == 3 && ship->b53 != 2) { + } else if (ship->b52 == 3 && ship->requested_animation_sequence != 2) { blend_moby_animation(ship, 2, 0, scale_game_frames(10)); } - if (fast_dec_timer(&d->i168)) { - if (ship->b53 != 2) + if (fast_dec_timer(&d->firing_phase_timer)) { + if (ship->requested_animation_sequence != 2) blend_moby_animation(ship, 2, 0, scale_game_frames(10)); ship->state = BLARG_SHIP_STATE_FIRE_COOLDOWN; - d->i168 = truncate_float_to_s32(FUN_L04_001f1978(d->f164 * 60.0f)); + d->firing_phase_timer = truncate_float_to_s32(FUN_L04_001f1978(d->cooldown_duration_seconds * 60.0f)); } - qcopy(&B, &l10_paths[d->i144]->points[d->i158]); + qcopy(&B, &l10_paths[d->firing_path_index]->points[d->path_point_index]); fast_vec_sub(&C, &B, &ship->pos); FUN_L00_0025f730_c(&C, D_0015ED6C * 8.0f); fast_vec_add(&ship->pos, &ship->pos, &C); if (fast_vec_length(&C) < D_0015ED6C) { - int n = d->i158 + 1; - if (n < l10_paths[d->i144]->count) - d->i158 = n; + int n = d->path_point_index + 1; + if (n < l10_paths[d->firing_path_index]->count) + d->path_point_index = n; } break; case BLARG_SHIP_STATE_FIRE_COOLDOWN: - if (is_point_inside_clip_volume(&(&hero)->motion.pos, d->i1B0)) { + if (is_point_inside_clip_volume(&(&hero)->motion.pos, d->departure_volume_index)) { ship->state = BLARG_SHIP_STATE_FLY_AWAY; break; } @@ -369,24 +369,24 @@ void blarg_ship_update(Ship_5E48 *ship) { } desired_heading = fast_arc_tan(tgt->pos.x - ship->pos.x, tgt->pos.y - ship->pos.y); FUN_L00_00258278( - (char *)ship, &d->f198, desired_heading, 0.02f, 0.3f, D_0015ED6C * 12.566371f); + (char *)ship, &d->heading_turn_velocity, desired_heading, 0.02f, 0.3f, D_0015ED6C * 12.566371f); aim_elevation = fast_arc_tan(vector_distance_xy(&ship->pos, &A), A.z - ship->pos.z); - ship->f44 = - spring_turn(&d->f19C, ship->f44, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); - if (fast_dec_timer(&d->i168)) { + ship->pitch = + spring_turn(&d->pitch_turn_velocity, ship->pitch, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); + if (fast_dec_timer(&d->firing_phase_timer)) { blend_moby_animation(ship, 3, 0, scale_game_frames(10)); - ship->f58 = blarg_ship_firing_animation_speed_gp; + ship->animation_speed = blarg_ship_firing_animation_speed_gp; ship->state = BLARG_SHIP_STATE_FIRE_AT_TARGET; - d->i168 = truncate_float_to_s32(FUN_L04_001f1978(d->f160 * 60.0f)); + d->firing_phase_timer = truncate_float_to_s32(FUN_L04_001f1978(d->firing_duration_seconds * 60.0f)); } - qcopy(&B, &l10_paths[d->i144]->points[d->i158]); + qcopy(&B, &l10_paths[d->firing_path_index]->points[d->path_point_index]); fast_vec_sub(&C, &B, &ship->pos); FUN_L00_0025f730_c(&C, D_0015ED6C * 8.0f); fast_vec_add(&ship->pos, &ship->pos, &C); if (fast_vec_length(&C) < D_0015ED6C) { - int n = d->i158 + 1; - if (n < l10_paths[d->i144]->count) - d->i158 = n; + int n = d->path_point_index + 1; + if (n < l10_paths[d->firing_path_index]->count) + d->path_point_index = n; } break; case BLARG_SHIP_STATE_FLY_AWAY: @@ -406,16 +406,16 @@ void blarg_ship_update(Ship_5E48 *ship) { pre_hit_state = ship->bBC; if (pre_hit_state == BLARG_SHIP_STATE_FIRE_AT_TARGET) { blend_moby_animation(ship, 3, 0, scale_game_frames(10)); - ship->f58 = blarg_ship_firing_animation_speed_gp; + ship->animation_speed = blarg_ship_firing_animation_speed_gp; ship->state = pre_hit_state; - d->i168 = truncate_float_to_s32(FUN_L04_001f1978(d->f160 * 60.0f)); + d->firing_phase_timer = truncate_float_to_s32(FUN_L04_001f1978(d->firing_duration_seconds * 60.0f)); } else if (pre_hit_state == BLARG_SHIP_STATE_FLY_AWAY) { blend_moby_animation(ship, 2, 0, scale_game_frames(10)); ship->state = pre_hit_state; } else { blend_moby_animation(ship, 2, 0, scale_game_frames(10)); ship->state = BLARG_SHIP_STATE_FIRE_COOLDOWN; - d->i168 = truncate_float_to_s32(FUN_L04_001f1978(d->f164 * 60.0f)); + d->firing_phase_timer = truncate_float_to_s32(FUN_L04_001f1978(d->cooldown_duration_seconds * 60.0f)); } break; } From 2b2ea9d780926a186a17a0a0f25926dd8449782b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:00:52 +0000 Subject: [PATCH 526/758] decomp: clarify names in snow_plow_update unk148 -> selected_clip_volume_index: Retail 0x002ca8b4-0x002ca8c4 copies the acquired clip-volume candidate byte into pvars+0x148. At 0x002ca63c-0x002ca68c and 0x002ca720-0x002ca744 it indexes l04_cuboids with stride 0x80 to read the selected volume heading and position, matching the authoritative C. unk149 -> clip_volume_movement_state: Retail 0x002ca564-0x002ca594 dispatches pvars+0x149 among four movement cases. Acquisition writes 1 at 0x002ca8bc, arrival writes 2 at 0x002ca718, timer expiry writes 3 at 0x002ca794, and return completion writes 0 at 0x002ca838. These correspond to the four established clip-volume movement enum labels in C. unk14A -> clip_volume_movement_timer: Retail 0x002ca55c-0x002ca560 decrements the signed halfword at pvars+0x14a. Zero gates clip-volume acquisition at 0x002ca5f8-0x002ca604 and transition from waiting to return at 0x002ca780-0x002ca794. Arrival stores scaled 300 frames at 0x002ca710-0x002ca71c; return completion stores scaled 600 frames at 0x002ca83c-0x002ca844, proving the shared movement wait/cooldown timer. unk14C -> saved_return_heading: Retail 0x002ca8cc-0x002ca8d4 saves moby->rot.z from owner+0x48 into pvars+0x14c upon clip-volume acquisition. Return movement loads it as the spring-turn target at 0x002ca7cc and compares it against current heading at 0x002ca80c-0x002ca814. The authoritative C uses it only to restore and test the saved heading. unk160 -> saved_return_position: Retail 0x002ca8a8-0x002ca8b0 copies the full 16-byte owner position to pvars+0x160 upon clip-volume acquisition. Return movement uses that saved vector for distance at 0x002ca7d4-0x002ca7ec and subtracts current moby position from it at 0x002ca858-0x002ca864 before stepping toward it, exactly as the C return case shows. unk170 -> hit_recovery_timer: In the hit branches retail 0x002cad64-0x002cad78 and 0x002caef4-0x002caf00 store scaled 600 frames into pvars+0x170 and set the recovery flag. At 0x002cb668-0x002cb670 fast_dec_timer consumes this field; only its completion enables the camera-angle check before restoring class collision. The C shows the same hit-triggered recovery delay. unk174 -> hit_recovery_active: Retail hit branches write 1 to pvars+0x174 at 0x002cad78 and 0x002caf00. At 0x002cb65c-0x002cb660 zero bypasses the recovery block; while active the block disables collision and sets flags 0x41. After timer completion and the camera-angle test, 0x002cb6c4-0x002cb6dc restores class collision, clears those flags and resets this field to zero, proving a hit-recovery active flag. unk178 -> saved_draw_distance: Initialization sets owner draw_dist to 0x7f at retail 0x002ca528, then loads that signed halfword from owner+0x32 at 0x002ca538 and stores it into pvars+0x178 at 0x002ca53c. The authoritative C explicitly assigns this field from moby->draw_dist, proving a saved draw distance without claiming a later use. unk17C -> linked_moby_index: Retail 0x002caa88-0x002caaa4 tests pvars+0x17c against -1 and forms a Moby pointer by shifting the field left eight bits and adding the Moby array base. The linked object receives transformed position/rotation at 0x002caac8-0x002cab78 and shares recovery flag changes at 0x002cb6e0-0x002cb700 and 0x002cb724-0x002cb740. C independently computes the same linked Moby pointer in these blocks. --- src/overlays/l04/mobys/snow_plow.c | 88 +++++++++++++++--------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/overlays/l04/mobys/snow_plow.c b/src/overlays/l04/mobys/snow_plow.c index 44acbebc33..9c50c14b4f 100644 --- a/src/overlays/l04/mobys/snow_plow.c +++ b/src/overlays/l04/mobys/snow_plow.c @@ -70,17 +70,17 @@ typedef struct SnowPlowVars { u8 pad_13C[0x4]; f32 unk140; f32 unk144; - u8 unk148; - u8 unk149; - s16 unk14A; - f32 unk14C; + u8 selected_clip_volume_index; + u8 clip_volume_movement_state; + s16 clip_volume_movement_timer; + f32 saved_return_heading; s32 unk150; u8 pad_154[0xC]; - f32 unk160[4]; - s32 unk170; - s32 unk174; - s32 unk178; - s32 unk17C; + f32 saved_return_position[4]; + s32 hit_recovery_timer; + s32 hit_recovery_active; + s32 saved_draw_distance; + s32 linked_moby_index; u8 manipulator; u8 pad_181[0xF]; u8 unk190; @@ -164,13 +164,13 @@ void snow_plow_update(struct Moby *moby) { moby->draw_dist = 0x7f; moby->update_dist = 0xff; snow_plow_vars->unk138 = snow_plow_vars->unkFC; - snow_plow_vars->unk178 = moby->draw_dist; + snow_plow_vars->saved_draw_distance = moby->draw_dist; } amount = 0.0f; gunship_update(moby); if (moby->oclass != 0x1e4) { - fast_dec_timer_s16(&snow_plow_vars->unk14A); - switch (snow_plow_vars->unk149) { + fast_dec_timer_s16(&snow_plow_vars->clip_volume_movement_timer); + switch (snow_plow_vars->clip_volume_movement_state) { case SNOW_PLOW_SCAN_CLIP_VOLUMES: { float length = snow_plow_vars->unkFC; float target = snow_plow_vars->unk138; @@ -182,12 +182,12 @@ void snow_plow_update(struct Moby *moby) { p = &snow_plow_vars->unk150; i = 0; do { - if (snow_plow_vars->unk14A == 0 && p[i] != -1 && + if (snow_plow_vars->clip_volume_movement_timer == 0 && p[i] != -1 && is_point_inside_clip_volume(&moby->pos, p[i])) { - qcopy(snow_plow_vars->unk160, &moby->pos); - snow_plow_vars->unk148 = *(unsigned char *)&p[i]; - snow_plow_vars->unk149 = 1; - snow_plow_vars->unk14C = moby->rot.z; + qcopy(snow_plow_vars->saved_return_position, &moby->pos); + snow_plow_vars->selected_clip_volume_index = *(unsigned char *)&p[i]; + snow_plow_vars->clip_volume_movement_state = 1; + snow_plow_vars->saved_return_heading = moby->rot.z; *(int *)&snow_plow_vars->unk7C = 0; moby->state = SNOW_PLOW_WAIT_TO_RESUME_PATH; snow_plow_vars->unk11C = scale_game_frames(36000); @@ -199,44 +199,44 @@ void snow_plow_update(struct Moby *moby) { } case SNOW_PLOW_MOVE_TO_CLIP_VOLUME: FUN_L00_00258278(moby, - l04_cuboids[snow_plow_vars->unk148].rot.z, + l04_cuboids[snow_plow_vars->selected_clip_volume_index].rot.z, &snow_plow_vars->unk7C, frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); - if (vector_distance_xy(&moby->pos, &l04_cuboids[snow_plow_vars->unk148].pos) < 1.0f && + if (vector_distance_xy(&moby->pos, &l04_cuboids[snow_plow_vars->selected_clip_volume_index].pos) < 1.0f && fast_difference_between_rotations( - moby->rot.z, l04_cuboids[snow_plow_vars->unk148].rot.z) < 0.17453292f) { - snow_plow_vars->unk149 = 2; - snow_plow_vars->unk14A = scale_game_frames(300); + moby->rot.z, l04_cuboids[snow_plow_vars->selected_clip_volume_index].rot.z) < 0.17453292f) { + snow_plow_vars->clip_volume_movement_state = 2; + snow_plow_vars->clip_volume_movement_timer = scale_game_frames(300); } - fast_vec_sub(&delta, &l04_cuboids[snow_plow_vars->unk148].pos, &moby->pos); + fast_vec_sub(&delta, &l04_cuboids[snow_plow_vars->selected_clip_volume_index].pos, &moby->pos); fast_vec_normalize(&delta, &delta, frame_time * 3.0f); fast_vec_add(&moby->pos, &moby->pos, &delta); break; case SNOW_PLOW_WAIT_BEFORE_RETURN: - if (snow_plow_vars->unk14A == 0) { + if (snow_plow_vars->clip_volume_movement_timer == 0) { snow_plow_vars->unk7C = amount; - snow_plow_vars->unk149 = 3; + snow_plow_vars->clip_volume_movement_state = 3; } break; case SNOW_PLOW_RETURN_TO_SAVED_TRANSFORM: FUN_L00_00258278(moby, - snow_plow_vars->unk14C, + snow_plow_vars->saved_return_heading, &snow_plow_vars->unk7C, frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); - if (vector_distance_xy(&moby->pos, snow_plow_vars->unk160) < 1.0f && - fast_difference_between_rotations(moby->rot.z, snow_plow_vars->unk14C) < + if (vector_distance_xy(&moby->pos, snow_plow_vars->saved_return_position) < 1.0f && + fast_difference_between_rotations(moby->rot.z, snow_plow_vars->saved_return_heading) < 0.034906585f) { - snow_plow_vars->unk149 = 0; - snow_plow_vars->unk14A = scale_game_frames(600); + snow_plow_vars->clip_volume_movement_state = 0; + snow_plow_vars->clip_volume_movement_timer = scale_game_frames(600); snow_plow_vars->unkFC = amount; snow_plow_vars->unk7C = amount; snow_plow_vars->unk11C = 0; } - fast_vec_sub(&delta, snow_plow_vars->unk160, &moby->pos); + fast_vec_sub(&delta, snow_plow_vars->saved_return_position, &moby->pos); length = fast_vec_length(&delta); step = frame_time * 3.0f; return_delta_ptr = δ @@ -301,8 +301,8 @@ void snow_plow_update(struct Moby *moby) { break; } } - if (snow_plow_vars->unk17C != -1) { - struct Moby *other = (struct Moby *)(D_L04_0015FFD8 + (snow_plow_vars->unk17C << 8)); + if (snow_plow_vars->linked_moby_index != -1) { + struct Moby *other = (struct Moby *)(D_L04_0015FFD8 + (snow_plow_vars->linked_moby_index << 8)); other->draw_dist = 0x7f; switch (moby->oclass) { case SNOW_PLOW_CLASS_WITH_QUARTER_TURN_LINKED_MOBY: @@ -382,8 +382,8 @@ void snow_plow_update(struct Moby *moby) { allocate_voice_for_target_entry(0, 0, moby); else if (moby->oclass != 0x1e6) allocate_voice_for_target_entry(1, 0, moby); - snow_plow_vars->unk170 = scale_game_frames(600); - snow_plow_vars->unk174 = 1; + snow_plow_vars->hit_recovery_timer = scale_game_frames(600); + snow_plow_vars->hit_recovery_active = 1; break; case SNOW_PLOW_CLASS_OFFSET_WITH_TWO_POINT_CART_BURST: sphere_pos.q = 0; @@ -421,8 +421,8 @@ void snow_plow_update(struct Moby *moby) { clear_u64_value(&sphere2.vector); sphere2.zero = 0; collect_mobies_in_sphere(&moby->pos, 6.0f, 0x10, moby, &sphere2); - snow_plow_vars->unk170 = scale_game_frames(600); - snow_plow_vars->unk174 = 1; + snow_plow_vars->hit_recovery_timer = scale_game_frames(600); + snow_plow_vars->hit_recovery_active = 1; break; } fast_vec_scale(&delta, &moby->rot_row0, frame_scale * 0.075f); @@ -719,19 +719,19 @@ void snow_plow_update(struct Moby *moby) { } } moby->hit_slot = 0xff; - if (snow_plow_vars->unk174 == 0) + if (snow_plow_vars->hit_recovery_active == 0) return; - if (fast_dec_timer(&snow_plow_vars->unk170)) { + if (fast_dec_timer(&snow_plow_vars->hit_recovery_timer)) { char *camera = D_L04_00166E00; amount = fast_arc_tan(moby->pos.x - *(float *)(camera + 0x140), moby->pos.y - *(float *)(camera + 0x144)); if (1.5707964f < fast_difference_between_rotations(*(float *)(camera + 0x158), amount)) { moby->collision = moby->pclass->collision; moby->flags &= 0xffbe; - snow_plow_vars->unk174 = 0; - if (snow_plow_vars->unk17C != -1) { + snow_plow_vars->hit_recovery_active = 0; + if (snow_plow_vars->linked_moby_index != -1) { struct Moby *other = - (struct Moby *)(D_L04_0015FFD8 + (snow_plow_vars->unk17C << 8)); + (struct Moby *)(D_L04_0015FFD8 + (snow_plow_vars->linked_moby_index << 8)); other->flags &= 0xffbe; } moby->flags |= 0x1000; @@ -740,8 +740,8 @@ void snow_plow_update(struct Moby *moby) { } moby->collision = 0; moby->flags |= 0x41; - if (snow_plow_vars->unk17C != -1) { - struct Moby *other = (struct Moby *)(D_L04_0015FFD8 + (snow_plow_vars->unk17C << 8)); + if (snow_plow_vars->linked_moby_index != -1) { + struct Moby *other = (struct Moby *)(D_L04_0015FFD8 + (snow_plow_vars->linked_moby_index << 8)); other->flags |= 0x41; } moby->flags &= 0xefff; From e6e92e8c9c26aab88816161012e9efb825d24997 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:00:55 +0000 Subject: [PATCH 527/758] decomp: clarify names in minibomber_update f94 -> active_collision: Retail 0x002b49e8-0x002b4a04 clears hidden flags 0x41, loads moby class at +0x24, loads class+0x10 and stores that word at moby+0x94 on transition from WAIT_TO_FOLLOW_PATH to FOLLOW_INTRO_OR_EXIT_PATH. Authoritative C expresses this as moby->f94 = moby->cls->f10. The supplied hide_minibomber_and_release_voice definition (FUN_L14_002b5c98, called by initialization and completed retracing) sets moby->flags |= 0x41 and moby->collision = 0; the supplied checked prior retail annotation explicitly identifies the reverse transition as restoring class collision. Together these establish f94 as the active collision member restored for visible path following, rather than an arbitrary class word. --- src/overlays/l14/mobys/minibomber.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/minibomber.c b/src/overlays/l14/mobys/minibomber.c index 8702ea9e87..5372df7be6 100644 --- a/src/overlays/l14/mobys/minibomber.c +++ b/src/overlays/l14/mobys/minibomber.c @@ -85,7 +85,7 @@ typedef struct Moby_2B5938 { char pad7C[3]; unsigned char f7F; /* 0x7F */ char pad80[0x14]; - int f94; /* 0x94 */ + int active_collision; /* 0x94 */ char pad98[0x1A]; short fB2; /* 0xB2 */ } Moby_2B5938; @@ -383,7 +383,7 @@ void minibomber_update(Moby_2B5938 *moby) { if (d->fB4 != 2) { moby->state = MINIBOMBER_STATE_FOLLOW_INTRO_OR_EXIT_PATH; moby->f34 &= 0xFFBE; - moby->f94 = moby->cls->f10; + moby->active_collision = moby->cls->f10; FUN_L14_002b5d18_c((char *)moby); } break; From 8cf4640f9d5d67a30fbc34e357f6e9671e3fb7cb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:02:44 +0000 Subject: [PATCH 528/758] decomp: clarify names in draw_plasmabot_effect_quads unk210 -> beam_start_position_storage: Retail 0x002b295c loads moby pvars; 0x002b2af0 retains pvars+0x210 in s5 and 0x002b2c98..0x002b2c9c copies its 16-byte vector into the fourth quad translation. Original Ghidra reads +0x210..+0x21c there. In the authoritative C this member supplies beam_start_position. The same pvars storage is ShipVars.beam_start in update_plasmabot_visual_effects, computed by adding bone-2 translation and scaled x/y/z basis offsets before queuing this renderer. Thus this is beam start position storage, not merely an offset-derived name. unk220 -> beam_end_position_storage: Retail 0x002b2ac0..0x002b2ac8 saves pvars+0x220 at sp+0xe0; 0x002b2da0..0x002b2da8 reloads it and copies its leading 16-byte vector into the fifth quad translation. Original Ghidra's puStack_c0 has the same +0x220 source and final vector copy. In authoritative C, pp points to this member. update_plasmabot_visual_effects writes the same pvars location as ShipVars.beam_end by adding -2 times the scaled bone-2 y offset to beam_start, then queues this renderer. Only the leading position vector is semantically established; the trailing four bytes of this 0x14-byte storage remain unresolved. --- src/overlays/shared/enemies/plasmabot.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index f81c8ccb4f..2a215cfb64 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -91,8 +91,8 @@ typedef struct PlasmabotVars { u8 unk1E0[0x10]; u8 unk1F0[0x10]; u8 unk200[0x10]; - u8 unk210[0x10]; - u8 unk220[0x14]; + u8 beam_start_position_storage[0x10]; + u8 beam_end_position_storage[0x14]; f32 target_range; u8 pad238[0x4]; s32 heading_angular_velocity; @@ -972,9 +972,9 @@ void draw_plasmabot_effect_quads(struct Moby *moby) { fast_draw_quad_real(&pk, 0, 0); qcopy(&quad_transform[3], &plasmabot_effect_private_vars->unk200); - pp = &plasmabot_effect_private_vars->unk220; + pp = &plasmabot_effect_private_vars->beam_end_position_storage; fast_vec_sub(&quad_transform[0], ((char *)&D_L14_001674C0), &quad_transform[3]); - beam_start_position = &plasmabot_effect_private_vars->unk210; + beam_start_position = &plasmabot_effect_private_vars->beam_start_position_storage; nozzle_position = &plasmabot_effect_private_vars->unk1F0; fast_vec_normalize(&quad_transform[0], &quad_transform[0], 1.0f); fast_vec_cross(&quad_transform[1], &quad_transform[0], D_0013F5E0); From 0f7b954491389a2bae4195767a618ab439145b5b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:02:47 +0000 Subject: [PATCH 529/758] decomp: clarify names in planetbuster_maximus_part_update unk5C8 -> vertical_oscillation_previous_offset: Retail 00306c4c and 00306df8 pass pvars+0x5C8 as the final pointer to 0027b120, repeated at 00306f04 and 0030721c. Authoritative C calls update_moby_vertical_oscillation; supplied helper C subtracts the previous sine offset from pos.z, replaces it with amplitude*sin(phase), and adds it back. unk5E4 -> rotation_common_factor_phase: Retail 00306c50/00306e20 supplies pvars+0x5E4 as the first phase pointer to 0027b1a0, repeated at 00306f24 and 0030723c. Source update_moby_rotation_oscillation uses its first phase sine as a common multiplier for both rotation components, and advances it with the established common_factor_phase_rate_degrees. unk5E8 -> rotation_component_mix_phase: Retail 00306c54/00306e28 supplies pvars+0x5E8 as the second phase pointer to 0027b1a0, repeated at 00306f2c and 00307244. Supplied rotation-oscillation helper C uses sin/cos of this second phase to mix the two rotation components, then advances it by the established component_mix_phase_rate_degrees. unk5EC -> path_start_clip_volume: Retail 00306e64..00306e80 tests this stored clip-volume argument against point 0013f3d0; a nonzero test or the alternate global trigger reaches the state=2 store at 00306ed8. Source identifies this transition as WAIT_FOR_PATH_TRIGGER to FOLLOW_PATH. unk5F0 -> path_movement_step: Retail 00306f88..00306fe4 approaches this float toward zero or frame-scaled 8.0. At 00307028..00307044 it becomes the normalization magnitude of the waypoint difference vector that is added to moby position. Authoritative C fast_vec_normalize(v,v,unk5F0) and fast_vec_add prove per-update path displacement length. unk5F4 -> yaw_turn_step: Retail 003070a0 passes pvars+0x5F4 to the yaw steering helper 00270fb8, with target heading computed from waypoint XY; 003071a0 passes the same storage to spring_angle for moby+0x48. Supplied FUN_L00_00258278 helper C updates this persistent turn step and adds it to moby->rot.z. unk5FA -> detached_parts_update_count: Retail 00307588..003075cc checks this signed-short field for zero before transferring linked slots; 003075dc..00307600 initializes motion for all 18 slots only on that zero case. At 00307604..00307614 the field increments once before the detached-parts update. Source state 4 mirrors this one-time initialization guard and update counter. unk5FC -> remaining_gun_health: Retail 00306c00/00306c0c initializes this s16 to 100. Checked gun helper request 2d8bbc57b6ed4bf2843fde3b27e315cc shows 00305d18..00305d48 subtracting 20 and clamping this owner field at zero when a gun's float health reaches zero; 003062d8..00306308 enters DROP_PARTS_AND_TRANSITION when depleted. Same-file C agrees. unk604 -> voice_slot: Retail 00307634..00307654 stores allocate_voice_for_target_entry's returned index in this field. At 00307658..00307690 that index selects a voice-pool record with stride 0x70, checks owner and active status, and is passed to release_voice_slot. Initialization and release reset it to -1. unk60C -> transition_target_camera_point: Retail 00307378..003073a8 multiplies this record index by 128 and uses record+0x30 as the second lerp endpoint, with camera_point as first endpoint. 003073b8..003074bc uses its +0x70/+0x74/+0x78 rotation components as angular targets. Source feeds the interpolated outputs to set_camera_position and set_camera_rotation. unk610 -> camera_transition_fraction: Retail 00307320..00307374 compares this float with 1.0 and advances it toward 1.0. Retail 00307394 passes it as the lerp factor and 003073e4/00307440/00307498 scales angular differences by it. Authoritative C applies these interpolated vectors to the camera and finishes interpolation once it reaches 1.0. unk614 -> camera_transition_step: Retail 00307340..00307374 passes pvars+0x614 as the second pointer of advance_accelerated_scalar, with the transition fraction as first pointer. Checked helper request 653d47b40dff4ede86c06b3d4645fcb2 shows second-pointer storage retained in s0 at 00274874, adjusted via approach_value, and added to first-pointer scalar at 002749b8..002749c8 and 002749e4..002749f0. This is the persistent interpolation step. unk61C -> height_timer_refresh_clip_volume: Retail 00306d54..00306d78 passes this stored volume to the point-inside-clip test and, on success, stores scale_game_frames(90) in pvars+0x620. Retail 00306d7c..00306d90 tests that timer to select the 19.0 height offset; authoritative C uses this volume specifically to refresh the height-control timer. unk624 -> linked_parts_flags_clip_volume: Retail 00306c1c..00306c28 tests point 00167240 against this clip-volume argument. Retail 00306c30..00306cf4 sets or clears mask 0x41 on the owner and all 17 present linked mobys according to the test. Authoritative C confirms it gates the linked group's flags; no particular meaning of either flag bit is assumed. unk628 -> height_raise_clip_volume: Retail 00306cfc..00306d28 tests point 0013f3d0 against this volume and combines the result with the point's Z>52 test to choose simple baseline-height approach versus spring handling. Retail 00306d48..00306d5c selects a 10.0 raised-height offset when inside, otherwise 3.0 before timer override; source matches this height-control role. unk62C -> height_spring_velocity: Retail 00306d94..00306ddc passes moby+0x18 as current scalar and pvars+0x62C as the second pointer to 002747b0, targeting saved height plus the selected offset. Authoritative C identifies vendor_spring; supplied helper C names the second pointer velocity, updates it using target-current error, and adds it to the current scalar. --- .../l12/mobys/planetbuster_maximus_part.c | 112 +++++++++--------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/src/overlays/l12/mobys/planetbuster_maximus_part.c b/src/overlays/l12/mobys/planetbuster_maximus_part.c index 6da13f6c02..fe52c5be2a 100644 --- a/src/overlays/l12/mobys/planetbuster_maximus_part.c +++ b/src/overlays/l12/mobys/planetbuster_maximus_part.c @@ -660,31 +660,31 @@ typedef struct PlanetbusterMaximusVars { u8 pad_0[0x5C0]; s32 path; u8 pad_5C4[0x4]; - f32 unk5C8; + f32 vertical_oscillation_previous_offset; f32 unk5CC; u8 pad_5D0[0x14]; - u8 unk5E4; + u8 rotation_common_factor_phase; u8 pad_5E5[0x3]; - u8 unk5E8; + u8 rotation_component_mix_phase; u8 pad_5E9[0x3]; - s32 unk5EC; - f32 unk5F0; - f32 unk5F4; + s32 path_start_clip_volume; + f32 path_movement_step; + f32 yaw_turn_step; s16 path_node; - s16 unk5FA; - s16 unk5FC; + s16 detached_parts_update_count; + s16 remaining_gun_health; u8 pad_5FE[0x6]; - s32 unk604; + s32 voice_slot; s32 camera_point; - s32 unk60C; - f32 unk610; - f32 unk614; + s32 transition_target_camera_point; + f32 camera_transition_fraction; + f32 camera_transition_step; f32 unk618; - s32 unk61C; + s32 height_timer_refresh_clip_volume; s32 timer; - s32 unk624; - s32 unk628; - f32 unk62C; + s32 linked_parts_flags_clip_volume; + s32 height_raise_clip_volume; + f32 height_spring_velocity; } PlanetbusterMaximusVars; /* Moby class 1274 */ @@ -736,15 +736,15 @@ void planetbuster_maximus_part_update(char *moby) { D_L12_00161F40_gp = -1.0f; for (j = 17; j >= 0; j--) D_L12_001FB688[j] = 0; - moby_data->unk604 = -1; - moby_data->unk5FC = 100; + moby_data->voice_slot = -1; + moby_data->remaining_gun_health = 100; MOBY(moby)->state = PLANETBUSTER_WAIT_FOR_PATH_TRIGGER; } break; case PLANETBUSTER_WAIT_FOR_PATH_TRIGGER: { char *clip_test_position; int r; - if (is_point_inside_clip_volume(D_L12_00167240, moby_data->unk624)) { + if (is_point_inside_clip_volume(D_L12_00167240, moby_data->linked_parts_flags_clip_volume)) { int i; char *base = (char *)D_L12_0015FFD8_gp; MOBY(moby)->flags |= 0x41; @@ -764,7 +764,7 @@ void planetbuster_maximus_part_update(char *moby) { } } clip_test_position = D_0013F3D0; - r = is_point_inside_clip_volume(clip_test_position, moby_data->unk628); + r = is_point_inside_clip_volume(clip_test_position, moby_data->height_raise_clip_volume); if (*(float *)(clip_test_position + 8) > 52.0f && r == 0) { approach_value( (float *)&MOBY(moby)->pos.z, moby_data->unk618, D_0015ED6C_gp + D_0015ED6C_gp); @@ -772,31 +772,31 @@ void planetbuster_maximus_part_update(char *moby) { float add = 3.0f; if (r) add = 10.0f; - if (is_point_inside_clip_volume(D_0013F3D0, moby_data->unk61C)) { + if (is_point_inside_clip_volume(D_0013F3D0, moby_data->height_timer_refresh_clip_volume)) { moby_data->timer = scale_game_frames(0x5A); } if (!fast_dec_timer(&moby_data->timer)) add = 19.0f; vendor_spring((float *)&MOBY(moby)->pos.z, - &moby_data->unk62C, + &moby_data->height_spring_velocity, moby_data->unk618 + add, frame_scale_sq_macro * 0.03f, frame_scale_sq_macro * 0.3f, D_0015ED6C_gp * 2.7f); } update_moby_vertical_oscillation( - 0.7f, D_0015ED6C_gp * 1.2217305f, moby, &moby_data->unk5CC, &moby_data->unk5C8); + 0.7f, D_0015ED6C_gp * 1.2217305f, moby, &moby_data->unk5CC, &moby_data->vertical_oscillation_previous_offset); update_moby_rotation_oscillation( moby, - &moby_data->unk5E4, - &moby_data->unk5E8, + &moby_data->rotation_common_factor_phase, + &moby_data->rotation_component_mix_phase, planetbuster_maximus_rotation_oscillation_amplitude_gp, planetbuster_maximus_rotation_oscillation_common_factor_phase_rate_degrees * 0.017453292f * D_0015ED6C_gp, planetbuster_maximus_rotation_oscillation_component_mix_phase_rate_degrees * 0.017453292f * D_0015ED6C_gp); apply_linked_moby_relative_transforms(moby, moby_data, 0x11); - if (is_point_inside_clip_volume(D_0013F3D0, moby_data->unk5EC) || D_L12_00161F00_gp) { + if (is_point_inside_clip_volume(D_0013F3D0, moby_data->path_start_clip_volume) || D_L12_00161F00_gp) { int i; D_L12_001619B4 = 1; for (i = 0; i < 5; i++) { @@ -813,11 +813,11 @@ void planetbuster_maximus_part_update(char *moby) { int nx; float target_yaw; update_moby_vertical_oscillation( - 0.7f, D_0015ED6C_gp * 1.2217305f, moby, &moby_data->unk5CC, &moby_data->unk5C8); + 0.7f, D_0015ED6C_gp * 1.2217305f, moby, &moby_data->unk5CC, &moby_data->vertical_oscillation_previous_offset); update_moby_rotation_oscillation( moby, - &moby_data->unk5E4, - &moby_data->unk5E8, + &moby_data->rotation_common_factor_phase, + &moby_data->rotation_component_mix_phase, planetbuster_maximus_rotation_oscillation_amplitude_gp, planetbuster_maximus_rotation_oscillation_common_factor_phase_rate_degrees * 0.017453292f * D_0015ED6C_gp, @@ -825,17 +825,17 @@ void planetbuster_maximus_part_update(char *moby) { 0.017453292f * D_0015ED6C_gp); path = ((P_7DB0 **)&(*(int *)l12_paths))[moby_data->path]; if (moby_data->path_node < *(int *)path - 11) { - approach_value(&moby_data->unk5F0, D_0015ED6C_gp * 8.0f, frame_time_sq_macro * 10.0f); + approach_value(&moby_data->path_movement_step, D_0015ED6C_gp * 8.0f, frame_time_sq_macro * 10.0f); } else { - approach_value(&moby_data->unk5F0, 0.0f, frame_time_sq_macro * 8.0f); - if (moby_data->unk5F0 == 0.0f) { + approach_value(&moby_data->path_movement_step, 0.0f, frame_time_sq_macro * 8.0f); + if (moby_data->path_movement_step == 0.0f) { MOBY(moby)->state = PLANETBUSTER_POST_PATH_GUN_UPDATE; break; } } nx = (moby_data->path_node + 1) % *(int *)path; fast_vec_sub(v, &path[nx + 1], &path[moby_data->path_node + 1]); - fast_vec_normalize(v, v, moby_data->unk5F0); + fast_vec_normalize(v, v, moby_data->path_movement_step); fast_vec_add(moby + 0x10, moby + 0x10, v); target_yaw = fast_arc_tan(*(float *)((char *)path + (nx << 4) + 0x10) - @@ -846,7 +846,7 @@ void planetbuster_maximus_part_update(char *moby) { target_yaw = 3.0543261f; FUN_L00_00258278(moby, target_yaw, - &moby_data->unk5F4, + &moby_data->yaw_turn_step, frame_scale_sq_macro * 0.0015f, frame_scale_sq_macro * 0.3f, D_0015ED6C_gp * 0.17453292f); @@ -867,17 +867,17 @@ void planetbuster_maximus_part_update(char *moby) { l12_planetbuster_maximus_proximity_fire_counter++; spring_angle(moby + 0x48, 3.0543261f, - &moby_data->unk5F4, + &moby_data->yaw_turn_step, -1, frame_scale_sq_macro * 0.0015f, frame_scale_sq_macro * 0.3f, D_0015ED6C_gp * 0.17453292f); update_moby_vertical_oscillation( - 0.7f, D_0015ED6C_gp * 1.2217305f, moby, &moby_data->unk5CC, &moby_data->unk5C8); + 0.7f, D_0015ED6C_gp * 1.2217305f, moby, &moby_data->unk5CC, &moby_data->vertical_oscillation_previous_offset); update_moby_rotation_oscillation( moby, - &moby_data->unk5E4, - &moby_data->unk5E8, + &moby_data->rotation_common_factor_phase, + &moby_data->rotation_component_mix_phase, planetbuster_maximus_rotation_oscillation_amplitude_gp, planetbuster_maximus_rotation_oscillation_common_factor_phase_rate_degrees * 0.017453292f * D_0015ED6C_gp, @@ -887,7 +887,7 @@ void planetbuster_maximus_part_update(char *moby) { update_planetbuster_maximus_guns(moby); break; case PLANETBUSTER_DROP_PARTS_AND_TRANSITION: - if (moby_data->camera_point != -1 && moby_data->unk60C != -1) { + if (moby_data->camera_point != -1 && moby_data->transition_target_camera_point != -1) { switch ((unsigned char)MOBY(moby)->command) { case PLANETBUSTER_TRANSITION_SETUP: MOBY(moby)->command = 1; @@ -897,39 +897,39 @@ void planetbuster_maximus_part_update(char *moby) { D_L12_001619A0 = 1; break; case PLANETBUSTER_TRANSITION_INTERPOLATE: - if (moby_data->unk610 < 1.0f) { - advance_accelerated_scalar(&moby_data->unk610, - &moby_data->unk614, + if (moby_data->camera_transition_fraction < 1.0f) { + advance_accelerated_scalar(&moby_data->camera_transition_fraction, + &moby_data->camera_transition_step, 1.0f, frame_time_sq_macro * 0.666f, frame_time_sq_macro * 0.666f, D_0015ED6C_gp * 0.4f); lerp_vector(v, D_L12_001600EC + moby_data->camera_point * 128 + 0x30, - D_L12_001600EC + moby_data->unk60C * 128 + 0x30, - moby_data->unk610); + D_L12_001600EC + moby_data->transition_target_camera_point * 128 + 0x30, + moby_data->camera_transition_fraction); clear_u64_value(transition_rotation); transition_rotation[0] = fast_subtract_rotations( - *(float *)(D_L12_001600EC + moby_data->unk60C * 128 + 0x70), + *(float *)(D_L12_001600EC + moby_data->transition_target_camera_point * 128 + 0x70), *(float *)(D_L12_001600EC + moby_data->camera_point * 128 + 0x70)) * - moby_data->unk610; + moby_data->camera_transition_fraction; transition_rotation[0] = fast_add_rotations( *(float *)(D_L12_001600EC + moby_data->camera_point * 128 + 0x70), transition_rotation[1]); transition_rotation[1] = fast_subtract_rotations( - *(float *)(D_L12_001600EC + moby_data->unk60C * 128 + 0x74), + *(float *)(D_L12_001600EC + moby_data->transition_target_camera_point * 128 + 0x74), *(float *)(D_L12_001600EC + moby_data->camera_point * 128 + 0x74)) * - moby_data->unk610; + moby_data->camera_transition_fraction; transition_rotation[1] = fast_add_rotations( *(float *)(D_L12_001600EC + moby_data->camera_point * 128 + 0x74), transition_rotation[1]); transition_rotation[2] = fast_subtract_rotations( - *(float *)(D_L12_001600EC + moby_data->unk60C * 128 + 0x78), + *(float *)(D_L12_001600EC + moby_data->transition_target_camera_point * 128 + 0x78), *(float *)(D_L12_001600EC + moby_data->camera_point * 128 + 0x78)) * - moby_data->unk610; + moby_data->camera_transition_fraction; transition_rotation[2] = fast_add_rotations( *(float *)(D_L12_001600EC + moby_data->camera_point * 128 + 0x78), transition_rotation[2]); @@ -963,7 +963,7 @@ void planetbuster_maximus_part_update(char *moby) { } } } - if (moby_data->unk5FA == 0) { + if (moby_data->detached_parts_update_count == 0) { int i; for (i = 0; i < 17; i++) { if (D_L12_001FB688[i] == 0) @@ -974,23 +974,23 @@ void planetbuster_maximus_part_update(char *moby) { for (i = 0; i < 18; i++) initialize_planetbuster_maximus_detached_part_motion((struct Moby *)moby, i); } - moby_data->unk5FA = moby_data->unk5FA + 1; + moby_data->detached_parts_update_count = moby_data->detached_parts_update_count + 1; update_planetbuster_maximus_detached_parts(moby); break; } update_planetbuster_maximus_glow_color(moby); if ((unsigned char)MOBY(moby)->state >= PLANETBUSTER_WAIT_FOR_PATH_TRIGGER && (unsigned char)MOBY(moby)->state <= PLANETBUSTER_POST_PATH_GUN_UPDATE) { - if (moby_data->unk604 == -1) - moby_data->unk604 = allocate_voice_for_target_entry(0, 4, moby); + if (moby_data->voice_slot == -1) + moby_data->voice_slot = allocate_voice_for_target_entry(0, 4, moby); } else { - int s = moby_data->unk604; + int s = moby_data->voice_slot; if (s != -1) { Voice_7DB0 *voice_pool_entry = (Voice_7DB0 *)(((unsigned char *)D_0013E550) + s * 0x70); if (voice_pool_entry->owner == moby && voice_pool_entry->active != 0) release_voice_slot(s); } - moby_data->unk604 = -1; + moby_data->voice_slot = -1; } } From b1e3eede94fc206f47aa1cbdabe1a07a70ff38d2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:02:51 +0000 Subject: [PATCH 530/758] decomp: clarify names in update_blarg_heavy_interceptor_aim_transforms unk90 -> cached_aim_point_position: Retail 0x002aebe4 sets s4=pvars+0x170, corresponding to aim_point_position. After the visibility gate at 0x002aec44, 0x002aecf4-0x002aecfc copies all 16 bytes from s4 to pvars+0x90 (lq/sq), matching qcopy(unk90, aim_point_position) in the authoritative C. The patrol caller updates aim_point_position after this function, then uses unk90 and the midpoint to unkD0 for positional scan queries. draw_blarg_heavy_interceptor_camera_pulled_glow copies unk90 to glow_quad_position before applying its small Z offset and camera pull. Thus this f32[4] caches the aim-point position, rather than holding a direction, transform, or final camera-adjusted position. --- src/overlays/l14/mobys/blarg_heavy_interceptor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 01a2fdef54..7560534317 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -222,7 +222,7 @@ typedef struct BlargHeavyInterceptorVars { s16 unk88; s16 rejoin_path_loop; f32 path_point_segment_distance; - f32 unk90[4]; + f32 cached_aim_point_position[4]; f32 unkA0[4]; f32 unkB0[4]; f32 unkC0[4]; @@ -372,8 +372,8 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { update_blarg_heavy_interceptor_patrol_path_position(moby); FUN_L14_002aea08_c618(moby); if (hit) { - lerp_vector(vector_scratch, moby_vars->unk90, moby_vars->unkD0, 0.5f); - qcopy(secondary_vector_scratch, moby_vars->unk90); + lerp_vector(vector_scratch, moby_vars->cached_aim_point_position, moby_vars->unkD0, 0.5f); + qcopy(secondary_vector_scratch, moby_vars->cached_aim_point_position); noop_main_callback(secondary_vector_scratch, moby_vars->unk214 * 0.8f); noop_main_callback(vector_scratch, moby_vars->unk214 * 0.48f); if (FUN_L00_001f2868_c618(moby_vars->unk214 * 0.48f, vector_scratch, 0, 0, 0) || @@ -1419,7 +1419,7 @@ void draw_blarg_heavy_interceptor_camera_pulled_glow(struct Moby *m) { float glow_to_camera_distance; u32 col; int j; - qcopy(glow_quad_position, d->unk90); + qcopy(glow_quad_position, d->cached_aim_point_position); glow_quad_position[2] += 0.01f; glow_quad_position[3] = 1.0f; pk.b = get_effect_texture_alt(0xB); @@ -1805,7 +1805,7 @@ int update_blarg_heavy_interceptor_aim_transforms(struct Moby *moby, int flag) { build_axis_rotation_quaternion( blarg_heavy_interceptor_private_vars->unk130, 1, rotation_angle); blarg_heavy_interceptor_private_vars->unk1C0[0] = rotation_angle; - qcopy(blarg_heavy_interceptor_private_vars->unk90, + qcopy(blarg_heavy_interceptor_private_vars->cached_aim_point_position, blarg_heavy_interceptor_private_vars->aim_point_position); if (flag != 0) { add_draw_callback(FUN_L14_002ae260_u, moby); From b9280afb82ed1fd7807a256257279e564c3eff89 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:02:54 +0000 Subject: [PATCH 531/758] decomp: clarify names in update_sentrybot_hit_response_and_target_visibility unk114 -> target_mode: SentrybotVars s32 field is loaded at retail 0x0029aa5c and compared with mode 1 at 0x0029aa64; target visibility failures write mode 2 at 0x0029aac0 and passive detection writes 2 at 0x0029ab10. Authoritative sentrybot_update already reads this member into local mode and compares it with SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION before entering projectile emission states. This proves a target behavior mode, without assigning meanings to every value. unk12C -> sight_line_ignored_moby_index: Retail 0x0029a940 loads this SentrybotVars s32, checks -1 at 0x0029a944, shifts the valid index by 8 at 0x0029a94c and adds l15_moby_array at 0x0029a950. The resulting moby pointer is collision_line argument a3 at 0x0029a960 for the sight test whose result becomes has_line_of_sight. Source explicitly identifies it as the moby index the sight line ignores; its other uses remove that same indexed moby and reset the index to -1. unk158 -> target_detected_without_engagement: Retail 0x0029aaa4 branches on accepted visibility. No visibility clears this s16 at 0x0029aac8; failed target-point query clears it at 0x0029ab64. With accepted visibility but the alert/suppression conditions at 0x0029aacc..0x0029ab08, 0x0029ab10 forces target mode 2 (source's SUPPRESS_DIRECT_EMISSION) and 0x0029ab18 sets this member to 1. Source sentrybot_update uses its nonzero value as glow alert level 1 when neither alert_timer nor an emitting target mode supplies level 2. Name describes this detected but nonengaging condition, not a timer. unk19F -> target_in_view: Retail 0x0029a9c0..0x0029aa58 establishes accepted visibility from target heading/height and has_line_of_sight, with explicit attack-state bypasses. 0x0029aaa8 sets this u8 to 1, 0x0029aabc clears it when that accepted visibility is zero, and 0x0029ab5c clears it when the target-point query fails. Source update_sentrybot_joint_aim tests the matching raw byte +0x19F to select remembered target coordinates for aiming. It records accepted target visibility, distinct from the existing unrestricted has_line_of_sight member. unk67 -> first_channel_blend_target: Root retail 0x0029a6c8 and 0x0029a868 write this u8, then 0x0029a86c..0x0029a888 passes data+0x60 to reaction animation helpers. Checked helper request 3e21e68b29674a5f8b2c3b16ed20d01c shows 0x0024ce8c..0x0024ceb8 interpolating helper offset 4 toward offset 7, and 0x0024cf58..0x0024cf80 interpolating back. The computed first channel is passed in a1 at 0x0024d018. Since data+0x67 is helper record+7, this is the first channel blend target; no physical color/channel identity is assumed. --- src/overlays/shared/enemies/sentrybot.c | 90 ++++++++++++------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index 8015641e1c..e6447d6ab9 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -90,7 +90,7 @@ typedef struct SentrybotVars { s32 unk38; /* 0x38: set: restart target_countdown */ u8 pad3C[0x24]; u8 trooper_anim[7]; /* 0x60: trooper_anim_update / trooper_anim_finish */ - u8 unk67; + u8 first_channel_blend_target; u8 pad68[8]; SentrybotKnockback knockback; /* 0x70 */ u8 padB0[0x10]; @@ -101,12 +101,12 @@ typedef struct SentrybotVars { u8 padE0[0x20]; f32 unk100[4]; char *target; /* 0x110 */ - s32 unk114; + s32 target_mode; u8 pad118[8]; s32 path_index; /* 0x120: into D_L15_001B0AB0 */ s32 unk124; s32 alarm_moby_index; /* 0x128: moby the alarm is set on */ - s32 unk12C; /* moby index the sight line ignores */ + s32 sight_line_ignored_moby_index; /* moby index the sight line ignores */ f32 target_countdown; /* 0x130 */ f32 forward_speed; /* 0x134 */ f32 unk138[1]; @@ -118,7 +118,7 @@ typedef struct SentrybotVars { s32 unk150; s16 unk154; s16 alert_timer; /* 0x156: set by alert_visible_group_sentrybots */ - s16 unk158; + s16 target_detected_without_engagement; u8 has_line_of_sight; /* 0x15A: to the hero */ u8 alert_engagement_suppressed; u8 unk15C; @@ -138,7 +138,7 @@ typedef struct SentrybotVars { char *attention_source; /* 0x198: set_sentrybot_attention_target */ s16 attention_timer; /* 0x19C */ u8 unk19E; - u8 unk19F; + u8 target_in_view; SentrybotJoint joints[2]; /* 0x1A0 */ f32 effect_quad_pos[3][4]; /* 0x2A0: draw_sentrybot_effect_quads */ s32 clip_volume[4]; /* 0x2D0: -1: none */ @@ -391,7 +391,7 @@ void sentrybot_update(unsigned char *moby) { } case SENTRYBOT_PATROL_IDLE: case SENTRYBOT_PATROL_PAUSE: - if (sentrybot_instance_data->unk114 != 2) { + if (sentrybot_instance_data->target_mode != 2) { MOBY(moby)->command = 1; if (sentrybot_instance_data->unk15F != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; @@ -461,9 +461,9 @@ void sentrybot_update(unsigned char *moby) { scale_game_frames(sentrybot_instance_data->unk148); MOBY(moby)->state = SENTRYBOT_PATROL_PAUSE; } - } else if (sentrybot_instance_data->unk158 != 0 && hero.state.current == 0x59) { + } else if (sentrybot_instance_data->target_detected_without_engagement != 0 && hero.state.current == 0x59) { if (sentrybot_instance_data->unk150 != -1 || - sentrybot_instance_data->unk12C != -1 || + sentrybot_instance_data->sight_line_ignored_moby_index != -1 || (sentrybot_instance_data->unk154 == 0 && random_integer_below(0x78) == 0)) { sentrybot_instance_data->pending_animation = 0; sentrybot_instance_data->unk15C = 2; @@ -494,7 +494,7 @@ void sentrybot_update(unsigned char *moby) { } break; case SENTRYBOT_WAIT_FOR_ANIMATION_THEN_PATROL_IDLE: - if (sentrybot_instance_data->unk114 != 2) { + if (sentrybot_instance_data->target_mode != 2) { MOBY(moby)->command = 1; if (sentrybot_instance_data->unk15F != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; @@ -524,10 +524,10 @@ void sentrybot_update(unsigned char *moby) { (sentrybot_instance_data->unk150 << 8)); sentrybot_instance_data->unk150 = -1; } - if (sentrybot_instance_data->unk12C != -1) { + if (sentrybot_instance_data->sight_line_ignored_moby_index != -1) { mark_moby_killed_and_release_owned_voice((int)l15_moby_array + - (sentrybot_instance_data->unk12C << 8)); - sentrybot_instance_data->unk12C = -1; + (sentrybot_instance_data->sight_line_ignored_moby_index << 8)); + sentrybot_instance_data->sight_line_ignored_moby_index = -1; } MOBY(moby)->state = sentrybot_instance_data->unk15C; switch (MOBY(moby)->state) { @@ -545,7 +545,7 @@ void sentrybot_update(unsigned char *moby) { case SENTRYBOT_TURN_NEGATIVE_HEADING_DELTA: case SENTRYBOT_TURN_POSITIVE_HEADING_DELTA: case SENTRYBOT_TURN_AROUND: - if (sentrybot_instance_data->unk114 != 2 && + if (sentrybot_instance_data->target_mode != 2 && fast_difference_between_rotations( MOBY(moby)->rot.z, fast_arc_tan(sentrybot_instance_data->unkD0[0] - MOBY(moby)->pos.x, @@ -612,7 +612,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk144 = 1; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); - } else if (sentrybot_instance_data->unk114 != 2) { + } else if (sentrybot_instance_data->target_mode != 2) { MOBY(moby)->command = 1; if (sentrybot_instance_data->unk15F != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; @@ -657,8 +657,8 @@ void sentrybot_update(unsigned char *moby) { (float *)(sentrybot_instance_data->attention_source + 0x10), (void *)0xA, (void *)0xF); - } else if (sentrybot_instance_data->unk158 != 0 && hero.state.current == 0x59) { - if (sentrybot_instance_data->unk150 != -1 || sentrybot_instance_data->unk12C != -1 || + } else if (sentrybot_instance_data->target_detected_without_engagement != 0 && hero.state.current == 0x59) { + if (sentrybot_instance_data->unk150 != -1 || sentrybot_instance_data->sight_line_ignored_moby_index != -1 || sentrybot_instance_data->unk154 == 0) { sentrybot_instance_data->unk15C = MOBY(moby)->state; sentrybot_instance_data->pending_animation = 0xD; @@ -691,7 +691,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk144 = 1; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); - } else if (sentrybot_instance_data->unk114 != 2 && sentrybot_instance_data->alert_engagement_suppressed == 0) { + } else if (sentrybot_instance_data->target_mode != 2 && sentrybot_instance_data->alert_engagement_suppressed == 0) { MOBY(moby)->command = 1; if (sentrybot_instance_data->unk15F != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; @@ -943,7 +943,7 @@ void sentrybot_update(unsigned char *moby) { (float *)(&sentrybot_instance_data->unkD0), (void *)0x10, (void *)3); - } else if (sentrybot_instance_data->unk114 == 2) { + } else if (sentrybot_instance_data->target_mode == 2) { MOBY(moby)->state = SENTRYBOT_ALERT_IDLE; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); @@ -1013,7 +1013,7 @@ void sentrybot_update(unsigned char *moby) { (float *)(&sentrybot_instance_data->unkD0), (void *)0x12, (void *)5); - } else if (sentrybot_instance_data->unk114 == 2) { + } else if (sentrybot_instance_data->target_mode == 2) { MOBY(moby)->state = SENTRYBOT_ALERT_IDLE; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); @@ -1038,7 +1038,7 @@ void sentrybot_update(unsigned char *moby) { set_sentrybot_alarm_duration(linked_alarm_moby, -1); } } else { - int mode = sentrybot_instance_data->unk114; + int mode = sentrybot_instance_data->target_mode; if (mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && sentrybot_instance_data->alert_engagement_suppressed == 0) { begin_sentrybot_turn_toward_point((char *)moby, @@ -1124,10 +1124,10 @@ void sentrybot_update(unsigned char *moby) { } return; } - if (sentrybot_instance_data->unk12C != -1) { + if (sentrybot_instance_data->sight_line_ignored_moby_index != -1) { mark_moby_killed_and_release_owned_voice((int)l15_moby_array + - (sentrybot_instance_data->unk12C << 8)); - sentrybot_instance_data->unk12C = -1; + (sentrybot_instance_data->sight_line_ignored_moby_index << 8)); + sentrybot_instance_data->sight_line_ignored_moby_index = -1; } if (sentrybot_instance_data->unk150 != -1) { mark_moby_killed_and_release_owned_voice((int)l15_moby_array + @@ -1147,10 +1147,10 @@ void sentrybot_update(unsigned char *moby) { } case SENTRYBOT_DEATH_KNOCKBACK: if (step_moby_motion(moby, &sentrybot_instance_data->knockback) & 0x160) { - if (sentrybot_instance_data->unk12C != -1) { + if (sentrybot_instance_data->sight_line_ignored_moby_index != -1) { mark_moby_killed_and_release_owned_voice((int)l15_moby_array + - (sentrybot_instance_data->unk12C << 8)); - sentrybot_instance_data->unk12C = -1; + (sentrybot_instance_data->sight_line_ignored_moby_index << 8)); + sentrybot_instance_data->sight_line_ignored_moby_index = -1; } if (sentrybot_instance_data->unk150 != -1) { mark_moby_killed_and_release_owned_voice((int)l15_moby_array + @@ -1168,10 +1168,10 @@ void sentrybot_update(unsigned char *moby) { update_sentrybot_joint_aim(moby); if (sentrybot_instance_data->alert_timer != 0) { lvl = 2; - } else if (sentrybot_instance_data->unk114 != 2) { + } else if (sentrybot_instance_data->target_mode != 2) { lvl = 2; } else { - lvl = sentrybot_instance_data->unk158 != 0; + lvl = sentrybot_instance_data->target_detected_without_engagement != 0; } tick = D_L15_0015F5CC; if (tick != sentrybot_alert_level_frame_stamp_gp || hero.glow_pulse_level < lvl) { @@ -1613,7 +1613,7 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i break; case SENTRYBOT_FIRST_CHANNEL_BLEND_HIT_RESPONSE: case SENTRYBOT_FIRST_CHANNEL_BLEND_TARGET_HIT_RESPONSE: - sentrybot_data->unk67 = 0xFA; + sentrybot_data->first_channel_blend_target = 0xFA; break; case NONLETHAL_KNOCKBACK_HIT_RESPONSE: case NONLETHAL_ARC_HIT_RESPONSE: @@ -1655,7 +1655,7 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i trooper_start_knockback(moby, &sentrybot_data->knockback, 7, 1, 0, angle); MOBY(moby)->state = SENTRYBOT_RECOVERABLE_KNOCKBACK; MOBY(moby)->command = 2; - sentrybot_data->unk67 = 0x78; + sentrybot_data->first_channel_blend_target = 0x78; break; case LETHAL_HIT_RESPONSE: case DEATH_KNOCKBACK_HIT_RESPONSE: { @@ -1694,7 +1694,7 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i trooper_start_knockback(moby, &sentrybot_data->knockback, 8, 1, 0, fall_angle); MOBY(moby)->state = SENTRYBOT_DEATH_KNOCKBACK; MOBY(moby)->command = 2; - sentrybot_data->unk67 = 0xF0; + sentrybot_data->first_channel_blend_target = 0xF0; break; } trooper_anim_update(moby, &sentrybot_data->trooper_anim); @@ -1716,8 +1716,8 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i group = 0; qcopy(hit_vector_or_sight_line_origin, &MOBY(moby)->pos); hit_vector_or_sight_line_origin[2] += 1.0f; - if (sentrybot_data->unk12C != -1) - group = (int)l15_moby_array + (sentrybot_data->unk12C << 8); + if (sentrybot_data->sight_line_ignored_moby_index != -1) + group = (int)l15_moby_array + (sentrybot_data->sight_line_ignored_moby_index << 8); sentrybot_data->has_line_of_sight = collision_line(hit_vector_or_sight_line_origin, D_0013F420, 2, (void *)group, 0) == 0; } else { @@ -1736,33 +1736,33 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i MOBY(moby)->state == SENTRYBOT_EMIT_WITH_NEGATIVE_JOINT_AIM) { seen = sentrybot_data->has_line_of_sight; } - if (sentrybot_data->unk114 == 1) + if (sentrybot_data->target_mode == 1) sentrybot_data->unk15E = sentrybot_data->alert_engagement_suppressed + 1; else if ((unsigned char)D_001413F4[0] != 3) sentrybot_data->unk15E = 0; else if (sentrybot_data->unk15E >= 2) sentrybot_data->alert_engagement_suppressed = 1; - sentrybot_data->unk19F = 1; + sentrybot_data->target_in_view = 1; if (seen == 0) { if (sentrybot_data->has_line_of_sight == 0) sentrybot_data->alert_engagement_suppressed = 1; - sentrybot_data->unk19F = 0; - sentrybot_data->unk114 = 2; - sentrybot_data->unk158 = 0; + sentrybot_data->target_in_view = 0; + sentrybot_data->target_mode = 2; + sentrybot_data->target_detected_without_engagement = 0; } else if (((sentrybot_data->alert_timer == 0 || sentrybot_data->alert_engagement_suppressed != 0) && (unsigned char)D_001413F4[0] == 3) || - (sentrybot_data->unk15E != 0 && sentrybot_data->unk114 != 1)) { - sentrybot_data->unk114 = 2; - sentrybot_data->unk158 = 1; - } else if ((unsigned char)D_001413F4[0] != 3 && sentrybot_data->unk114 != 2) { + (sentrybot_data->unk15E != 0 && sentrybot_data->target_mode != 1)) { + sentrybot_data->target_mode = 2; + sentrybot_data->target_detected_without_engagement = 1; + } else if ((unsigned char)D_001413F4[0] != 3 && sentrybot_data->target_mode != 2) { sentrybot_data->alert_engagement_suppressed = 0; } if (D_L15_0015F5C4 == 2) - sentrybot_data->unk114 = 2; + sentrybot_data->target_mode = 2; } else { - sentrybot_data->unk19F = 0; + sentrybot_data->target_in_view = 0; sentrybot_data->alert_engagement_suppressed = 1; - sentrybot_data->unk158 = 0; + sentrybot_data->target_detected_without_engagement = 0; } if (*(int *)&sentrybot_data->target == 0) *(int *)&sentrybot_data->target = (*(int *)&D_001413D0_lui); From 9560d90eeef01896cbf71a7383b4d2d80ff24d70 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:06:09 +0000 Subject: [PATCH 532/758] decomp: clarify names in select_kerwan_path_enemy_next_node f270 -> target_selection_range: At 0x002c9cd4 retail loads moby->data into s0; 0x002c9cdc loads its float +0x270 into f12 for select_moby_target_with_hero_fallback at 0x002c9ce4. Bounded level-03 helper 0x0024e830 preserves f12 in f20 at 0x0024e858, compares source/candidate XY distance against it at 0x0024e928 and 0x0024e9ac, and replaces the selected moby and threshold only for a nearer candidate at 0x0024e938-0x0024e93c and 0x0024e9bc-0x0024e9c0. Supplied authoritative C also passes f270 to select_moby_combat_target and compares target_distance against it for facing/projectile behavior. update_kerwan_path_enemy_hit_reaction refreshes it from f26C or f26C+5.0f according to s252, proving an adjustable target-selection range rather than an offset-only field name. --- src/overlays/l03/mobys/kerwan_path_enemy.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/l03/mobys/kerwan_path_enemy.c b/src/overlays/l03/mobys/kerwan_path_enemy.c index 0d0eb279fc..74f7916359 100644 --- a/src/overlays/l03/mobys/kerwan_path_enemy.c +++ b/src/overlays/l03/mobys/kerwan_path_enemy.c @@ -216,7 +216,7 @@ typedef struct Data2C8398 { int i264; char p268[4]; float f26C; - float f270; + float target_selection_range; int i274; float f278; float f27C; @@ -399,7 +399,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { Data2C8398 *moby_data = m->data; float target_distance; - select_moby_combat_target(m, &selected_target, moby_data->f270); + select_moby_combat_target(m, &selected_target, moby_data->target_selection_range); target_distance = vector_distance_xy(m->pos, &selected_target); manipulator_set_scale(&moby_data->look0, 2.5f); if (moby_data->b262 == 1) { @@ -426,7 +426,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { if (m->state == ENEMY_TURN_TO_HEADING) { moby_data->look0.target_yaw_offset = fast_subtract_rotations(moby_data->f28C, m->rot[2]) * 0.25f; moby_data->look1.target_yaw_offset = fast_subtract_rotations(moby_data->f28C, m->rot[2]) * 0.75f; - } else if (m->state < ENEMY_MOVE_TO_PATH_NODE && target_distance < moby_data->f270) { + } else if (m->state < ENEMY_MOVE_TO_PATH_NODE && target_distance < moby_data->target_selection_range) { moby_data->look1.target_yaw_offset = fast_subtract_rotations(fast_arc_tan(selected_target.pos[0] - m->pos[0], selected_target.pos[1] - m->pos[1]), @@ -525,7 +525,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = ENEMY_WAIT_FOR_LINKED_MOBY; } else { - if (target_distance < moby_data->f270 || target_distance < moby_data->f27C) { + if (target_distance < moby_data->target_selection_range || target_distance < moby_data->f27C) { 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]), @@ -549,7 +549,7 @@ 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->f270 && + } 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)) { if (fast_difference_between_rotations( @@ -567,7 +567,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { } break; case ENEMY_WAIT_FOR_LINKED_MOBY: - if (target_distance < moby_data->f270 && + if (target_distance < moby_data->target_selection_range && absolute_float(selected_target.pos[2] - m->pos[2]) < 4.0f && m->anim != 0xA) { blend_moby_animation(m, 0xA, 0, scale_game_frames(10)); break; @@ -672,7 +672,7 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { (char *)&selected_target)) { break; } - if (target_distance < moby_data->f270 && + 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_difference_between_rotations( @@ -1509,9 +1509,9 @@ void update_kerwan_path_enemy_hit_reaction(Moby2C8398 *moby) { moby_data->s252 = scale_game_frames(240); } if (fast_dec_timer_s16(&moby_data->s252)) { - moby_data->f270 = moby_data->f26C; + moby_data->target_selection_range = moby_data->f26C; } else { - moby_data->f270 = moby_data->f26C + 5.0f; + moby_data->target_selection_range = moby_data->f26C + 5.0f; } hit = find_moby_hit(moby, 0x330000, 0); hit_response_code = @@ -1671,7 +1671,7 @@ void select_kerwan_path_enemy_next_node(Moby2C8398 *moby) { best_ang = 0.0f; pf = &moby_data->pf; best_dist = best_ang; - select_moby_target_with_hero_fallback((char *)moby, (char *)&target, moby_data->f270); + select_moby_target_with_hero_fallback((char *)moby, (char *)&target, moby_data->target_selection_range); seg = pf->idx; FUN_L00_0025df68(pf->path, moby->pos, From 52a928e25fcc090c6ab593178e37b119cb56759f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:08:09 +0000 Subject: [PATCH 533/758] decomp: clarify names in walker_update_gait b50 -> animation_entry_index: WalkMoby byte +0x50 is converted to float at 0x002a3930-0x002a3950 and added to the interpolation fraction to form the current entry position used for landing playback correction. Checked helper 0x0024edc8 compares +0x50 with next entry byte +0x51 when choosing record interpolation at 0x0024ee28-0x0024ee40; this is an animation entry index, not a sequence id (+0x52). f0C -> animation_position_origin: WalkAnim +0x0C is subtracted from phase marker positions before wrapping by cycle length and looking up an animation entry, e.g. 0x002a1b14-0x002a1b74 and 0x002a19ec-0x002a1a34. Conversely it is added to the cycle length before comparison with current interpolated animation position at 0x002a35d8-0x002a35e8, proving the origin translating relative cycle positions to animation positions. f54 -> animation_interpolation_fraction: Checked helper 0x0024edc8, request e39c867287824854b6af76cf0034d010, loads moby +0x54 and weights two animation record positions with (1-fraction) and fraction at 0x0024ee68-0x0024eea0. Assigned landing synchronization adds this same float to the converted entry index at 0x002a3940-0x002a3950 and 0x002a39d0-0x002a3a00. f58 -> animation_playback_rate: In landing synchronization, 0x002a39dc-0x002a3a40 computes a target animation position from landing time, clamps it above current entry index plus interpolation fraction, and stores frame_scale_inv*(target-current) to moby +0x58. The same float is subtracted from animation end position for takeoff completion at 0x002a35d4-0x002a35e8 and tested for slow playback at 0x002a1870-0x002a1888. i14 -> initial_animation_position: On idle departure the selected WalkAnim +0x14 integer is converted to float and passed to find_nearest_animation_sequence_entry at 0x002a1734-0x002a1748 or 0x002a17f4-0x002a1808; the resulting entry starts the blend. The same integer position initializes the gait mask at 0x002a1834-0x002a1844, proving the initial animation position shared by playback and gait phase bookkeeping. v60 -> jump_target_position: In takeoff cases, retail 0x002a354c-0x002a359c passes walker position and gait_data+0x60 to the checked ballistic velocity helper FUN_L00_0025abf0 as start and target positions. 0x002a35a4-0x002a35c4 subtracts walker XY from its XY to calculate jump heading. Supplied compute_walker_time_to_landing also subtracts its Z from walker Z, proving a three-coordinate jump target position. --- .../shared/enemies/walker_update_gait.c | 148 +++++++++--------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/src/overlays/shared/enemies/walker_update_gait.c b/src/overlays/shared/enemies/walker_update_gait.c index cea7984e92..5537a825c6 100644 --- a/src/overlays/shared/enemies/walker_update_gait.c +++ b/src/overlays/shared/enemies/walker_update_gait.c @@ -106,21 +106,21 @@ typedef struct WalkMoby { char pad28[0x20]; float f48; /* 0x48 */ char pad4C[4]; - unsigned char b50; /* 0x50 */ + unsigned char animation_entry_index; /* 0x50 */ unsigned char b51; unsigned char b52; /* 0x52 */ unsigned char b53; - float f54; /* 0x54 */ - float f58; /* 0x58 */ + float animation_interpolation_fraction; /* 0x54 */ + float animation_playback_rate; /* 0x58 */ } WalkMoby; typedef struct WalkAnim { int id; /* 0x00 */ float f04; float f08; - float f0C; + float animation_position_origin; float f10; - int i14; + int initial_animation_position; char pad18[0x20]; float f38; float f3C; @@ -135,7 +135,7 @@ typedef struct WalkData { float m10[8]; /* 0x10 */ float m30[8]; /* 0x30 */ char pad50[0x10]; - float v60[3]; /* 0x60 */ + float jump_target_position[3]; /* 0x60 */ float f6C; WalkAnim *anim[13]; /* 0x70 */ char padA4[0xC]; @@ -212,12 +212,12 @@ void walker_update_gait(WalkMoby *walker_moby, { WalkAnim *a = gait_data->anim[7]; int f = find_nearest_animation_sequence_entry(walker_moby->pClass->seqs[a->id], - (float)a->i14); + (float)a->initial_animation_position); blend_moby_animation(walker_moby, a->id, f, 10); reset_walker_gait_helpers((char *)gait_data); } gait_data->bB7 = 0xD; - gait_data->bB6 = walker_gait_mask(gait_data->anim[7], (float)gait_data->anim[7]->i14); + gait_data->bB6 = walker_gait_mask(gait_data->anim[7], (float)gait_data->anim[7]->initial_animation_position); gait_data->sEC = 0; } else if (speed > frame_time * 0.21f || fast_difference_between_rotations(walker_moby->f48, movement_heading) > @@ -227,13 +227,13 @@ void walker_update_gait(WalkMoby *walker_moby, { WalkAnim *a = gait_data->anim[0]; int f = find_nearest_animation_sequence_entry(walker_moby->pClass->seqs[a->id], - (float)a->i14); + (float)a->initial_animation_position); blend_moby_animation(walker_moby, a->id, f, 10); reset_walker_gait_helpers((char *)gait_data); } gait_data->bB7 = 1; gait_data->bB6 = - walker_gait_mask(gait_data->anim[0], (float)gait_data->anim[0]->i14); + walker_gait_mask(gait_data->anim[0], (float)gait_data->anim[0]->initial_animation_position); gait_data->sEC = 0; } } @@ -253,7 +253,7 @@ void walker_update_gait(WalkMoby *walker_moby, case WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK: case WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK: { int gait_animation_index = walker_gait_animation_index_by_state[gait_data->bB7]; - if (walker_moby->f58 < 0.25f && + if (walker_moby->animation_playback_rate < 0.25f && fast_difference_between_rotations(walker_moby->f48, movement_heading) < 0.09239978f && speed < frame_time * 0.19f) { blend_moby_animation(walker_moby, gait_data->bB0, 0, 10); @@ -274,9 +274,9 @@ void walker_update_gait(WalkMoby *walker_moby, int x; int bl; if (r1 < r2) { - x = truncate_float_to_s32(gait_data->anim[7]->f48 - gait_data->anim[7]->f0C); + x = truncate_float_to_s32(gait_data->anim[7]->f48 - gait_data->anim[7]->animation_position_origin); } else { - x = truncate_float_to_s32(gait_data->anim[7]->f4C - gait_data->anim[7]->f0C); + x = truncate_float_to_s32(gait_data->anim[7]->f4C - gait_data->anim[7]->animation_position_origin); } x = (x + truncate_float_to_s32(gait_data->anim[7]->f10)) % truncate_float_to_s32(gait_data->anim[7]->f10); @@ -299,7 +299,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[11]->f08)); int fr = truncate_float_to_s32(gait_data->anim[11]->f40 + gait_data->anim[11]->f38 * 0.125f - - gait_data->anim[11]->f0C) % + gait_data->anim[11]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[11]->f10); WalkAnim *a = gait_data->anim[11]; int f = find_nearest_animation_sequence_entry( @@ -312,7 +312,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[9]->f08)); int fr = truncate_float_to_s32(gait_data->anim[9]->f44 + gait_data->anim[9]->f3C * 0.125f - - gait_data->anim[9]->f0C) % + gait_data->anim[9]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[9]->f10); WalkAnim *a = gait_data->anim[9]; int f = find_nearest_animation_sequence_entry( @@ -346,7 +346,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + gait_data->anim[2]->f38 * 0.125f - - gait_data->anim[2]->f0C) % + gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; int f = find_nearest_animation_sequence_entry( @@ -359,7 +359,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[1]->f08)); int fr = truncate_float_to_s32(gait_data->anim[1]->f44 + gait_data->anim[1]->f3C * 0.125f - - gait_data->anim[1]->f0C) % + gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; int f = find_nearest_animation_sequence_entry( @@ -378,7 +378,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[5]->f08)); int fr = truncate_float_to_s32(gait_data->anim[5]->f40 + gait_data->anim[5]->f38 * 0.125f - - gait_data->anim[5]->f0C) % + gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); WalkAnim *a = gait_data->anim[5]; int f = find_nearest_animation_sequence_entry( @@ -391,7 +391,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[4]->f08)); int fr = truncate_float_to_s32(gait_data->anim[4]->f44 + gait_data->anim[4]->f3C * 0.125f - - gait_data->anim[4]->f0C) % + gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); WalkAnim *a = gait_data->anim[4]; int f = find_nearest_animation_sequence_entry( @@ -416,7 +416,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[5]->f08)); fr = truncate_float_to_s32(gait_data->anim[5]->f40 + gait_data->anim[5]->f38 * 0.125f - - gait_data->anim[5]->f0C) % + gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); a = gait_data->anim[5]; f = find_nearest_animation_sequence_entry( @@ -434,7 +434,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[3]->f08)); int fr = truncate_float_to_s32(gait_data->anim[3]->f40 + gait_data->anim[3]->f38 * 0.125f - - gait_data->anim[3]->f0C) % + gait_data->anim[3]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[3]->f10); WalkAnim *a = gait_data->anim[3]; int f = find_nearest_animation_sequence_entry( @@ -458,7 +458,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[4]->f08)); fr = truncate_float_to_s32(gait_data->anim[4]->f44 + gait_data->anim[4]->f3C * 0.125f - - gait_data->anim[4]->f0C) % + gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); a = gait_data->anim[4]; f = find_nearest_animation_sequence_entry( @@ -476,7 +476,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[3]->f08)); int fr = truncate_float_to_s32(gait_data->anim[3]->f44 + gait_data->anim[3]->f3C * 0.125f - - gait_data->anim[3]->f0C) % + gait_data->anim[3]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[3]->f10); WalkAnim *a = gait_data->anim[3]; int f = find_nearest_animation_sequence_entry( @@ -497,7 +497,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[5]->f08)); int fr = truncate_float_to_s32(gait_data->anim[5]->f40 + gait_data->anim[5]->f38 * 0.125f - - gait_data->anim[5]->f0C) % + gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); WalkAnim *a = gait_data->anim[5]; int f = find_nearest_animation_sequence_entry( @@ -510,7 +510,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[4]->f08)); int fr = truncate_float_to_s32(gait_data->anim[4]->f44 + gait_data->anim[4]->f3C * 0.125f - - gait_data->anim[4]->f0C) % + gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); WalkAnim *a = gait_data->anim[4]; int f = find_nearest_animation_sequence_entry( @@ -528,7 +528,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[1]->f08)); int fr = truncate_float_to_s32(gait_data->anim[1]->f40 + gait_data->anim[1]->f38 * 0.125f - - gait_data->anim[1]->f0C) % + gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; int f = find_nearest_animation_sequence_entry( @@ -541,7 +541,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f44 + gait_data->anim[2]->f3C * 0.125f - - gait_data->anim[2]->f0C) % + gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; int f = find_nearest_animation_sequence_entry( @@ -566,7 +566,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[4]->f08)); fr = truncate_float_to_s32(gait_data->anim[4]->f44 + gait_data->anim[4]->f3C * 0.125f - - gait_data->anim[4]->f0C) % + gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); a = gait_data->anim[4]; f = find_nearest_animation_sequence_entry( @@ -584,7 +584,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[0]->f08)); int fr = truncate_float_to_s32(gait_data->anim[0]->f44 + gait_data->anim[0]->f3C * 0.125f - - gait_data->anim[0]->f0C) % + gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; int f = find_nearest_animation_sequence_entry( @@ -608,7 +608,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[5]->f08)); fr = truncate_float_to_s32(gait_data->anim[5]->f40 + gait_data->anim[5]->f38 * 0.125f - - gait_data->anim[5]->f0C) % + gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); a = gait_data->anim[5]; f = find_nearest_animation_sequence_entry( @@ -626,7 +626,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[0]->f08)); int fr = truncate_float_to_s32(gait_data->anim[0]->f40 + gait_data->anim[0]->f38 * 0.125f - - gait_data->anim[0]->f0C) % + gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; int f = find_nearest_animation_sequence_entry( @@ -645,7 +645,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + gait_data->anim[2]->f38 * 0.125f - - gait_data->anim[2]->f0C) % + gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; int f = find_nearest_animation_sequence_entry( @@ -663,7 +663,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[6]->f08)); int fr = truncate_float_to_s32(gait_data->anim[6]->f40 + gait_data->anim[6]->f38 * 0.125f - - gait_data->anim[6]->f0C) % + gait_data->anim[6]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[6]->f10); WalkAnim *a = gait_data->anim[6]; int f = find_nearest_animation_sequence_entry( @@ -682,7 +682,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[1]->f08)); int fr = truncate_float_to_s32(gait_data->anim[1]->f44 + gait_data->anim[1]->f3C * 0.125f - - gait_data->anim[1]->f0C) % + gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; int f = find_nearest_animation_sequence_entry( @@ -700,7 +700,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[6]->f08)); int fr = truncate_float_to_s32(gait_data->anim[6]->f44 + gait_data->anim[6]->f3C * 0.125f - - gait_data->anim[6]->f0C) % + gait_data->anim[6]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[6]->f10); WalkAnim *a = gait_data->anim[6]; int f = find_nearest_animation_sequence_entry( @@ -720,7 +720,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + gait_data->anim[2]->f38 * 0.125f - - gait_data->anim[2]->f0C) % + gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; int f = find_nearest_animation_sequence_entry( @@ -733,7 +733,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[1]->f08)); int fr = truncate_float_to_s32(gait_data->anim[1]->f44 + gait_data->anim[1]->f3C * 0.125f - - gait_data->anim[1]->f0C) % + gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; int f = find_nearest_animation_sequence_entry( @@ -751,7 +751,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[4]->f08)); int fr = truncate_float_to_s32(gait_data->anim[4]->f40 + gait_data->anim[4]->f38 * 0.125f - - gait_data->anim[4]->f0C) % + gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); WalkAnim *a = gait_data->anim[4]; int f = find_nearest_animation_sequence_entry( @@ -764,7 +764,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[5]->f08)); int fr = truncate_float_to_s32(gait_data->anim[5]->f44 + gait_data->anim[5]->f3C * 0.125f - - gait_data->anim[5]->f0C) % + gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); WalkAnim *a = gait_data->anim[5]; int f = find_nearest_animation_sequence_entry( @@ -784,7 +784,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[1]->f08)); int fr = truncate_float_to_s32(gait_data->anim[1]->f44 + gait_data->anim[1]->f3C * 0.125f - - gait_data->anim[1]->f0C) % + gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; int f = find_nearest_animation_sequence_entry( @@ -802,7 +802,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[0]->f08)); int fr = truncate_float_to_s32(gait_data->anim[0]->f44 + gait_data->anim[0]->f3C * 0.5f - - gait_data->anim[0]->f0C) % + gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; int f = find_nearest_animation_sequence_entry( @@ -821,7 +821,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + gait_data->anim[2]->f38 * 0.125f - - gait_data->anim[2]->f0C) % + gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; int f = find_nearest_animation_sequence_entry( @@ -839,7 +839,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[0]->f08)); int fr = truncate_float_to_s32(gait_data->anim[0]->f40 + gait_data->anim[0]->f38 * 0.5f - - gait_data->anim[0]->f0C) % + gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; int f = find_nearest_animation_sequence_entry( @@ -862,11 +862,11 @@ void walker_update_gait(WalkMoby *walker_moby, int fr; if (gait_data->bB6 & 3) { fr = truncate_float_to_s32(gait_data->anim[0]->f38 * 2.0f / 3.0f + - gait_data->anim[0]->f40 - gait_data->anim[0]->f0C) % + gait_data->anim[0]->f40 - gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); } else { fr = truncate_float_to_s32(gait_data->anim[0]->f3C * 2.0f / 3.0f + - gait_data->anim[0]->f44 - gait_data->anim[0]->f0C) % + gait_data->anim[0]->f44 - gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); } { @@ -887,7 +887,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[11]->f08)); int fr = truncate_float_to_s32(gait_data->anim[11]->f40 + gait_data->anim[11]->f38 * 0.125f - - gait_data->anim[11]->f0C) % + gait_data->anim[11]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[11]->f10); WalkAnim *a = gait_data->anim[11]; int f = find_nearest_animation_sequence_entry( @@ -900,7 +900,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[9]->f08)); int fr = truncate_float_to_s32(gait_data->anim[9]->f44 + gait_data->anim[9]->f3C * 0.125f - - gait_data->anim[9]->f0C) % + gait_data->anim[9]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[9]->f10); WalkAnim *a = gait_data->anim[9]; int f = find_nearest_animation_sequence_entry( @@ -937,22 +937,22 @@ void walker_update_gait(WalkMoby *walker_moby, break; case WALKER_GAIT_TAKEOFF_ANIMATION: if (flags & 0x30) { - float dist = vector_distance_xy(walker_moby->pos, gait_data->v60); + float dist = vector_distance_xy(walker_moby->pos, gait_data->jump_target_position); debug_print(walker_jump_distance_debug_format, dist); gait_data->fD8 = FUN_L00_0025abf0( - walker_moby->pos, gait_data->v60, 0, gait_data->fC0, -gait_data->fDC); + walker_moby->pos, gait_data->jump_target_position, 0, gait_data->fC0, -gait_data->fDC); gait_data->uEE |= 4; - gait_data->f6C = fast_arc_tan(gait_data->v60[0] - walker_moby->pos[0], - gait_data->v60[1] - walker_moby->pos[1]); + gait_data->f6C = fast_arc_tan(gait_data->jump_target_position[0] - walker_moby->pos[0], + gait_data->jump_target_position[1] - walker_moby->pos[1]); } if (compute_interpolated_record_value(walker_moby) >= - gait_data->anim[11]->f0C + gait_data->anim[11]->f10 - walker_moby->f58) { + gait_data->anim[11]->animation_position_origin + gait_data->anim[11]->f10 - walker_moby->animation_playback_rate) { blend_moby_animation(walker_moby, gait_data->bB3, 0, 10); reset_walker_gait_helpers((char *)gait_data); gait_data->bB7 = 0x10; } else if ((gait_data->uEE & 4) && gait_data->fD8 < 0.0f) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); - float len = (gait_data->anim[12]->f44 - gait_data->anim[12]->f0C) * 2.0f; + float len = (gait_data->anim[12]->f44 - gait_data->anim[12]->animation_position_origin) * 2.0f; if (t < len + 15.0f) { int bl = truncate_float_to_s32(t - len) >> 1; WalkAnim *a; @@ -970,22 +970,22 @@ void walker_update_gait(WalkMoby *walker_moby, break; case WALKER_GAIT_ALTERNATE_TAKEOFF_ANIMATION: if (flags & 0x30) { - float dist = fast_vec_dist(walker_moby->pos, gait_data->v60); + float dist = fast_vec_dist(walker_moby->pos, gait_data->jump_target_position); debug_print(walker_jump_distance_debug_format, dist); gait_data->fD8 = FUN_L00_0025abf0( - walker_moby->pos, gait_data->v60, 0, gait_data->fC0, -gait_data->fDC); + walker_moby->pos, gait_data->jump_target_position, 0, gait_data->fC0, -gait_data->fDC); gait_data->uEE |= 4; - gait_data->f6C = fast_arc_tan(gait_data->v60[0] - walker_moby->pos[0], - gait_data->v60[1] - walker_moby->pos[1]); + gait_data->f6C = fast_arc_tan(gait_data->jump_target_position[0] - walker_moby->pos[0], + gait_data->jump_target_position[1] - walker_moby->pos[1]); } if (compute_interpolated_record_value(walker_moby) >= - gait_data->anim[9]->f0C + gait_data->anim[9]->f10 - walker_moby->f58) { + gait_data->anim[9]->animation_position_origin + gait_data->anim[9]->f10 - walker_moby->animation_playback_rate) { blend_moby_animation(walker_moby, gait_data->bB3, 0, 10); reset_walker_gait_helpers((char *)gait_data); gait_data->bB7 = 0x10; } else if ((gait_data->uEE & 4) && gait_data->fD8 < 0.0f) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); - float len = (gait_data->anim[10]->f44 - gait_data->anim[10]->f0C) * 2.0f; + float len = (gait_data->anim[10]->f44 - gait_data->anim[10]->animation_position_origin) * 2.0f; if (t < len + 15.0f) { int bl = truncate_float_to_s32(t - len) >> 1; WalkAnim *a; @@ -1004,7 +1004,7 @@ void walker_update_gait(WalkMoby *walker_moby, case WALKER_GAIT_WAIT_FOR_LANDING: if (walker_moby->b52 == gait_data->bB3) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); - float len = (gait_data->anim[12]->f44 - gait_data->anim[12]->f0C) * 2.0f; + float len = (gait_data->anim[12]->f44 - gait_data->anim[12]->animation_position_origin) * 2.0f; if (t < len + 15.0f) { int bl = truncate_float_to_s32(t - len) >> 1; WalkAnim *a = gait_data->anim[12]; @@ -1020,19 +1020,19 @@ void walker_update_gait(WalkMoby *walker_moby, if (walker_moby->b52 == gait_data->anim[12]->id) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); if (t > 1.0f) { - float base = convert_integer_to_float(walker_moby->b50) + walker_moby->f54; - t = gait_data->anim[12]->f44 + 2.0f - t * 0.5f - gait_data->anim[12]->f0C; + float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; + t = gait_data->anim[12]->f44 + 2.0f - t * 0.5f - gait_data->anim[12]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } - walker_moby->f58 = frame_scale_inv * (t - base); + walker_moby->animation_playback_rate = frame_scale_inv * (t - base); } else { - float base = convert_integer_to_float(walker_moby->b50) + walker_moby->f54; - t = gait_data->anim[12]->f44 - gait_data->anim[12]->f0C; + float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; + t = gait_data->anim[12]->f44 - gait_data->anim[12]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } - walker_moby->f58 = frame_scale_inv * (t - base); + walker_moby->animation_playback_rate = frame_scale_inv * (t - base); { int ns = 0x14; int fl = 4; @@ -1047,19 +1047,19 @@ void walker_update_gait(WalkMoby *walker_moby, if (walker_moby->b52 == gait_data->anim[10]->id) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); if (t > 1.0f) { - float base = convert_integer_to_float(walker_moby->b50) + walker_moby->f54; - t = gait_data->anim[10]->f44 + 2.0f - t * 0.5f - gait_data->anim[10]->f0C; + float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; + t = gait_data->anim[10]->f44 + 2.0f - t * 0.5f - gait_data->anim[10]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } - walker_moby->f58 = frame_scale_inv * (t - base); + walker_moby->animation_playback_rate = frame_scale_inv * (t - base); } else { - float base = convert_integer_to_float(walker_moby->b50) + walker_moby->f54; - t = gait_data->anim[10]->f44 - gait_data->anim[10]->f0C; + float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; + t = gait_data->anim[10]->f44 - gait_data->anim[10]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } - walker_moby->f58 = frame_scale_inv * (t - base); + walker_moby->animation_playback_rate = frame_scale_inv * (t - base); { int ns = 0x13; int fl = 4; @@ -1076,7 +1076,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[7]->f08)); int fr = truncate_float_to_s32(gait_data->anim[7]->f40 + 1.0f + - gait_data->anim[7]->f38 * 0.125f - gait_data->anim[7]->f0C) % + gait_data->anim[7]->f38 * 0.125f - gait_data->anim[7]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[7]->f10); WalkAnim *a = gait_data->anim[7]; int f = @@ -1101,7 +1101,7 @@ void walker_update_gait(WalkMoby *walker_moby, (speed / gait_data->anim[7]->f08)); int fr = truncate_float_to_s32(gait_data->anim[7]->f44 + 1.0f + - gait_data->anim[7]->f38 * 0.125f - gait_data->anim[7]->f0C) % + gait_data->anim[7]->f38 * 0.125f - gait_data->anim[7]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[7]->f10); WalkAnim *a = gait_data->anim[7]; int f = From 6b545cf8c8c5aed6c2c841c87227e21ce03d412b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:08:13 +0000 Subject: [PATCH 534/758] decomp: clarify names in reposition_moby_with_collision_check unk66 -> reposition_timer: In reposition_moby_with_collision_check, the zero-collision branch initializes moby_data->unk66 = scale_game_frames(0xB4) after restoring animation, flags and class collision and assigning state 4. Retail 0x002c467c loads s0 from the repositioned moby's pvars at s1+0x78; 0x002c46bc passes 180 in a0, 0x002c46d4 calls scale_game_frames (0x001fd788), and 0x002c46dc stores its returned v0 as a halfword at s0+0x66. Original Ghidra independently shows uVar1=func_0x001fd788(0xb4) followed by the private +0x66 store. This proves a frame-scaled reposition timer initialization, without asserting the timer's later expiry behavior. --- src/overlays/l16/mobys/chicken_relocator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l16/mobys/chicken_relocator.c b/src/overlays/l16/mobys/chicken_relocator.c index 702464443f..0bebec367a 100644 --- a/src/overlays/l16/mobys/chicken_relocator.c +++ b/src/overlays/l16/mobys/chicken_relocator.c @@ -82,7 +82,7 @@ typedef struct ChickenRelocatorVars { s32 unk8; s32 timer_C; u8 pad_10[0x56]; - s16 unk66; + s16 reposition_timer; u8 pad_68[0x10]; f32 unk78; } ChickenRelocatorVars; @@ -136,7 +136,7 @@ void reposition_moby_with_collision_check(struct Moby *moby, void *new_position) moby->flags = (moby->flags | 0x1000) & 0xFFBE; moby->collision = moby->pclass->collision; moby->state = 4; - moby_data->unk66 = scale_game_frames(0xB4); + moby_data->reposition_timer = scale_game_frames(0xB4); } } From b4b890f26a95b5d9befb929f281527ec2f5ee37c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:08:13 +0000 Subject: [PATCH 535/758] decomp: clarify names in initialize_moby_motion_at_position domain_0_value_1 -> MINE_STATE_FREE_MOTION: Retail 0x002aa024 preserves the initialized moby argument in s1; 0x002aa088/0x002aa098 stores 1 into its state byte at +0x20. The checked mine_glove_update release branch passes mine_glove_vars->held and held->pvars to this function, proving this is the released mine's moby-state domain. At 0x002aa050 and 0x002aa0ec-0x002aa128 its private motion receives base motion, random offset and optional hero displacement, and 0x002aa1d4-0x002aa278 initializes collision-adjusted position and reflected motion. The authoritative same-file mine_update uses the existing MINE_STATE_FREE_MOTION member when releasing a mine from an attached collision surface or invalid homing target, resetting velocity and the same private+0x34 timer. This establishes the existing mine moby-state member, rather than the unrelated equal-valued homing phase or hero enum members. --- src/overlays/shared/weapons/mine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/shared/weapons/mine.c b/src/overlays/shared/weapons/mine.c index ff2ba5a137..b2e819b39f 100644 --- a/src/overlays/shared/weapons/mine.c +++ b/src/overlays/shared/weapons/mine.c @@ -473,7 +473,7 @@ void initialize_moby_motion_at_position(V_2aa008 *requested_position, vector_scratch.f[0] = random_float_between(-1.0f, 1.0f); vector_scratch.f[1] = random_float_between(-1.0f, 1.0f); vector_scratch.f[2] = random_float_between(-1.0f, 1.0f); - initialized_moby->moby_state = 1; + initialized_moby->moby_state = MINE_STATE_FREE_MOTION; initialized_moby->f2C = initialized_moby->f2C / 0.65f; random_offset.q = vector_scratch.q; fast_vec_normalize(&random_offset, From 5c4e417a8e5fe55a62323eab7ec661baf3a6d066 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:10:27 +0000 Subject: [PATCH 536/758] decomp: clarify names in drek_final_boss_robot_update f128 -> lateral_launch_aim_angle: Retail 0x002f4b44-0x002f4b54 stores atan(1, lateral coefficient +0x3BC) into +0x128 during forward/lateral launch; C matches the angle calculation. f140 -> joint_19_animation_state: Retail 0x002f450c-0x002f451c passes +0x140 to relative-aim setup, and 0x002f5d18-0x002f5d28 passes the same storage to update_joint_animation with joint 0x13. f1C0 -> big_head_manipulator_state: Retail 0x002f2c3c-0x002f2c5c passes this +0x1C0 buffer together with the attached manipulator owner and big-head scale to the manipulator helper; bound C agrees. f200 -> class_247_group_index: C passes this integer to find_nearest_class_247_moby_in_list and find_class_247_moby_with_largest_xy_angle_in_list; retail loads +0x200 at 0x002f3d1c and 0x002f3d74. f210 -> gadgebot_group_index: Retail 0x002f5130-0x002f513c and 0x002f5160-0x002f5164 pass +0x210 to the established group launch and count_group_gadgebots_not_in_state_8 helpers. f214 -> missile_group_index: Retail 0x002f40d8-0x002f40dc loads +0x214 as the group argument to activate_drek_fight_missiles_in_group; C supplies the raised boss position separately. f21C -> thruster_lock_moby_index: Retail 0x002f3f54-0x002f3f74 scales +0x21C by 0x100 into the moby table and calls request_thruster_pack_lock_red_wait; 0x002f5920-0x002f5934 uses it for ending that wait. f220 -> paired_transition_moby_index: Retail 0x002f2d50-0x002f2d90 scales +0x220 by 0x100 into the moby table and stores its pointer at +0x334, used by start_camera_transition and progress polling. f240 -> alternate_platform_activation_moby_indices: Retail 0x002f38b4-0x002f38e4 iterates four +0x240 indices when phase is not 1, scales each by 0x100 and calls activate_drek_boss_class_0565_moby; phase 1 uses +0x230. f270 -> encounter_trigger_path_index: Retail 0x002f2f7c-0x002f2fa4 indexes the path table with +0x270 then passes path count and +0x10 points to point_in_path_xy on the hero position. f274 -> encounter_trigger_clip_volume_index: Retail 0x002f2ef8-0x002f2f04 passes +0x274 with hero position to is_point_inside_clip_volume, gating the giant-Clank encounter trigger in bound C. f280 -> aim_candidate_node_indices: Retail 0x002f4344-0x002f43d8 iterates three integers at +0x280, indexes 0x80-byte nodes, compares XY angles and saves the winning node to +0x3A8. f294 -> scene_camera_node_index: Retail 0x002f2ed0-0x002f2ee4 uses +0x294 to select node position/rotation for jet_reset_camera; 0x002f5990-0x002f59b8 copies that node transform into scene state. f298 -> paired_transition_node_index: Retail 0x002f3ef0-0x002f3f20 indexes a node using +0x298, copies position and yaw into the fifth vector passed to start_camera_transition. f29C -> class_238_launch_group_index: Retail 0x002f4f74-0x002f4f88 loads +0x29C as the list/group argument to launch_class_238_moby_from_list, with separate launch and ground target vectors. f2A0 -> race_camera_node_index: Retail 0x002f3374-0x002f3398 indexes 0x80-byte nodes with +0x2A0 and supplies node position +0x30 and rotation +0x70 to set_race_camera. f310 -> saved_transition_rotation: Retail 0x002f3fa0-0x002f3fac copies this four-float +0x310 vector into moby rotation +0x40 after the paired transition state check; bound C qcopy agrees. f320 -> stored_aim_target_position: Retail 0x002f5518-0x002f5524 copies aim-target position to +0x320; 0x002f4498-0x002f4520 aims toward it and 0x002f4604-0x002f4608 subtracts launch origin from it. f330 -> selected_class_247_moby: Retail 0x002f3d18-0x002f3d24 stores the class-247 selection helper return at +0x330; 0x002f5530-0x002f55b4 turns and advances toward that moby's position. f334 -> paired_transition_moby: Retail 0x002f2d90 stores a resolved moby pointer here; 0x002f3f30-0x002f3f34 initializes its transition and 0x002f403c-0x002f4040 polls its transition progress. f338 -> hero_follow_ring_effect_moby: Retail 0x002f4488-0x002f4494 stores create_class_274_ring_effect return at +0x338; 0x002f528c-0x002f52a0 refreshes it at boss position during FOLLOW_HERO. f33C -> pending_electric_ball_moby: Retail 0x002f4020-0x002f402c and 0x002f45a0-0x002f45ac store spawn_drek_boss_electric_ball return here; release calls refresh_moby_position_and_activate then clears the pointer. f340 -> active_movement_path: Retail 0x002f2fd0-0x002f2fe4 resolves the path table into +0x340; 0x002f39f8-0x002f3a14 indexes its points and 0x002f3bb8-0x002f3bc4 compares its count. f344 -> arena_center_node_index: Retail 0x002f30d0-0x002f30d8 stores configured arena node here; 0x002f4884-0x002f48ec uses that node as the center for ground-target radius clamping; supplied circling source agrees. f348 -> path_point_index: Retail 0x002f39f8-0x002f3a14 scales +0x348 by 16 and selects active path point +0x10; 0x002f3a34-0x002f3a40 increments it upon reaching the point. f34C -> encounter_phase: Retail 0x002f3140 and 0x002f3270 store arena phases 1 and 2; 0x002f55c0 dispatches phase timers and 0x002f5664-0x002f5674 increments the same phase selector. f350 -> previous_action_state: Retail 0x002f4fb0 stores the completed attack state before returning to action selection; supplied select_drek_boss_next_action reads +0x350 and excludes repeating that state. f354 -> action_event_timer_frames: Retail 0x002f4090-0x002f40a8 decrements and reloads +0x354 with scaled frames for missile events; 0x002f45b0-0x002f45e4 similarly gates timed electric-ball release. f358 -> action_frame_counter: Retail 0x002f41c8-0x002f41d0 initializes +0x358 from scaled frames and 0x002f4a6c decrements it to end an action; death state 0x002f56f4-0x002f571c instead increments it for timed explosions. f35C -> secondary_action_timer_frames: Retail 0x002f4240-0x002f4268 initializes +0x35C with phase-scaled frames; 0x002f4d64-0x002f4d7c decrements it after +0x358 before ending forward-launch action. f360 -> ring_launch_cooldown_frames: Retail 0x002f4c14-0x002f4c1c stores scaled 300 frames here on ring launch; supplied scalar-update source decrements +0x360 and requires zero for gated follow behavior. f364 -> hero_follow_action_blocked: Retail 0x002f5668-0x002f566c sets +0x364 after selected-moby arrival; supplied action selector rejects FOLLOW_HERO when it is nonzero and damage-transition source clears it upon rearm. f368 -> health_hud_animation_handle: Retail 0x002f2d88 initializes +0x368 to -1; supplied scalar-update source assigns queue_animation_update for the health counter and cancels it through set_animation_parameter(handle,0). f370 -> yaw_approach_state: Retail 0x002f32d0-0x002f3318 passes moby yaw +0x48 and +0x370 as mutable state to approach_angle with target hero yaw and frame-scaled acceleration/speed limits. f374 -> movement_step_distance: Retail 0x002f39ac-0x002f39d8 approaches +0x374 toward frame_time*12; 0x002f3a18-0x002f3a58 compares remaining path distance to it and uses it to scale the displacement. f38C -> boss_health: Retail 0x002f2d8c initializes +0x38C to 350; supplied damage helper subtracts damage, clamps phase health floors and enters death-explosion state when this float reaches zero. f390 -> rail_mode_damage_accumulated: Retail 0x002f4a7c-0x002f4abc tests +0x390 against 25 to end the ground-target action; supplied damage helper adds damage to this field specifically when hero control_mode is 0xF. f398 -> platform_target_group_index: Retail 0x002f2d64-0x002f2d80 saves initial moby group here and 0x002f3fe0 uses it to show the group; supplied platform-target helper indexes its group-entry table using +0x398. f39C -> post_scene_resume_state: Retail 0x002f3d6c saves state 5 at +0x39C before starting scene 2; 0x002f2df0-0x002f2dfc restores its low byte into moby state when scene mode ends. f3A0 -> boss_joint_glow_attachment_moby: Retail 0x002f5b88-0x002f5b8c removes this attachment on cleanup; supplied damage source creates class 0x58F here and attaches it to joint 4; glow renderer uses its joints 1 and 2. f3A4 -> big_head_attachment_moby: Retail 0x002f2c3c-0x002f2c5c passes this moby to the big-head manipulator helper; supplied damage source creates class 0x4E1 here and attaches it to the joint-glow attachment. f3A8 -> selected_aim_node_index: Retail 0x002f43c8-0x002f43d0 stores the winning candidate node here; 0x002f54b0-0x002f54e0 scales it by 0x80 and supplies its position as movement target. f3AC -> ending_scene_4_delay_counter: Retail 0x002f5a14-0x002f5a24 starts +0x3AC at 1 after grounded class-247 hero condition; 0x002f5a44-0x002f5a60 increments it until scaled 40 frames elapse, then starts scene 4. f3B0 -> hero_follow_voice_slot: Retail 0x002f52a4-0x002f52c8 checks and allocates a voice for this moby into +0x3B0; 0x002f53d8-0x002f541c validates ownership, releases the slot and stores -1. f3B4 -> tint_cycle_angle: Retail 0x002f5d30-0x002f5d7c advances +0x3B4 by frame_time*3.4906585, takes sine and remaps it to 0..1 for fast_tween_color; bound C agrees. f3B8 -> green_biased_joint_glow_color: Retail 0x002f5d84-0x002f5dcc preserves alpha/green and divides red/blue by three into +0x3B8; supplied glow renderer consumes this field as color for eight joint quads. f3BC -> ring_launch_lateral_coefficient: Retail 0x002f4264-0x002f4270 initializes +0x3BC randomly; 0x002f4c40-0x002f4c64 scales moby lateral vector by it and adds that to forward direction for ring launch. f3C0 -> unbobbed_boss_position: Retail 0x002f2ccc-0x002f2cd8 initializes +0x3C0 from moby position; movement updates it, then 0x002f5c4c-0x002f5d04 copies it to moby position and adds bob displacement only to moby Z. f3D0 -> bob_amplitude: Retail 0x002f2d94 initializes +0x3D0 to 0.75; 0x002f5c9c-0x002f5ccc multiplies it by sine of bob phase to produce the vertical interpolation target. f3D4 -> bob_cycle_angle: Retail 0x002f5c6c-0x002f5c98 advances +0x3D4 by frame_time*pi, stores the wrapped angle, and takes its sine for the vertical bob target. f3D8 -> bob_target_height_offset: Retail 0x002f4530 sets +0x3D8 to -3 during aimed action; 0x002f5cbc-0x002f5ccc adds it to sinusoidal bob target and 0x002f5d0c clears it each update. f3DC -> bob_height_displacement: Retail 0x002f5ca0-0x002f5cd8 passes +0x3DC as interpolated bob output; 0x002f5cdc-0x002f5d04 adds that float to moby position Z after copying unbobbed position. f3E0 -> bob_interpolation_state: Retail 0x002f5cac-0x002f5cd8 passes +0x3E0 as the second mutable state beside bob output +0x3DC to aas_c, with the sinusoidal height target and scaled limits. f53 -> animation_sequence_index: Retail 0x002f4198-0x002f41c0 compares moby+0x53 to sequence 10 before blend_moby_animation(moby,10,...); repeated sequence checks and requests throughout the assigned function prove this animation-sequence index. f78 -> boss_private_data: Retail 0x002f2c24 loads moby+0x78 into s4, used for all boss phase/path/position fields; bound C casts this pointer to the file-private BossData type. f90 -> animated_tint_color: Retail 0x002f5d78-0x002f5da0 stores fast_tween_color's packed color directly into moby+0x90 after the sinusoidal blend between two packed colors. f94 -> collision_data: Retail 0x002f2de8-0x002f2dec restores this member from class+0x10 when enabling the boss and clears it at 0x002f5944; supplied group helpers identify the same moby member as collision. --- .../l18/mobys/drek_final_boss_robot.c | 728 +++++++++--------- 1 file changed, 364 insertions(+), 364 deletions(-) diff --git a/src/overlays/l18/mobys/drek_final_boss_robot.c b/src/overlays/l18/mobys/drek_final_boss_robot.c index c6a9bc7e6c..a2f9d0038f 100644 --- a/src/overlays/l18/mobys/drek_final_boss_robot.c +++ b/src/overlays/l18/mobys/drek_final_boss_robot.c @@ -176,16 +176,16 @@ typedef struct BossMoby { unsigned char f50; char p51; unsigned char f52; - unsigned char f53; + unsigned char animation_sequence_index; char p54[0x1C]; unsigned char f70; char p71[7]; - char *f78; + char *boss_private_data; char p7C[3]; unsigned char f7F; char p80[0x10]; - int f90; - int f94; + int animated_tint_color; + int collision_data; char p98[0xE]; short fA6; char pA8[0x18]; @@ -208,75 +208,75 @@ typedef struct BossData { int fB4; char pB8[8]; char fC0[0x68]; - float f128; + float lateral_launch_aim_angle; char p12C[0x14]; - char f140[0x80]; - unsigned char f1C0[0x40]; - int f200; + char joint_19_animation_state[0x80]; + unsigned char big_head_manipulator_state[0x40]; + int class_247_group_index; int f204[3]; - int f210; - int f214; + int gadgebot_group_index; + int missile_group_index; char p218[4]; - int f21C; - int f220; + int thruster_lock_moby_index; + int paired_transition_moby_index; char p224[0xC]; int f230[4]; - int f240[4]; + int alternate_platform_activation_moby_indices[4]; int f250[4]; int f260[4]; - int f270; - int f274; + int encounter_trigger_path_index; + int encounter_trigger_clip_volume_index; char p278[8]; - int f280[3]; + int aim_candidate_node_indices[3]; char p28C[8]; - int f294; - int f298; - int f29C; - int f2A0; + int scene_camera_node_index; + int paired_transition_node_index; + int class_238_launch_group_index; + int race_camera_node_index; char p2A4[0xC]; int f2B0; char p2B4[0x4C]; float f300[4]; - float f310[4]; - float f320[4]; - BossMoby *f330; - unsigned char *f334; - char *f338; - unsigned char *f33C; - int *f340; - int f344; - int f348; - int f34C; - int f350; - int f354; - int f358; - int f35C; - int f360; - int f364; - int f368; + float saved_transition_rotation[4]; + float stored_aim_target_position[4]; + BossMoby *selected_class_247_moby; + unsigned char *paired_transition_moby; + char *hero_follow_ring_effect_moby; + unsigned char *pending_electric_ball_moby; + int *active_movement_path; + int arena_center_node_index; + int path_point_index; + int encounter_phase; + int previous_action_state; + int action_event_timer_frames; + int action_frame_counter; + int secondary_action_timer_frames; + int ring_launch_cooldown_frames; + int hero_follow_action_blocked; + int health_hud_animation_handle; char p36C[4]; - float f370; - float f374; + float yaw_approach_state; + float movement_step_distance; char p378[0x14]; - float f38C; - float f390; + float boss_health; + float rail_mode_damage_accumulated; char p394[4]; - int f398; - int f39C; - void *f3A0; - char *f3A4; - int f3A8; - int f3AC; - int f3B0; - float f3B4; - int f3B8; - float f3BC; - float f3C0[4]; - float f3D0; - float f3D4; - float f3D8; - float f3DC; - float f3E0; + int platform_target_group_index; + int post_scene_resume_state; + void *boss_joint_glow_attachment_moby; + char *big_head_attachment_moby; + int selected_aim_node_index; + int ending_scene_4_delay_counter; + int hero_follow_voice_slot; + float tint_cycle_angle; + int green_biased_joint_glow_color; + float ring_launch_lateral_coefficient; + float unbobbed_boss_position[4]; + float bob_amplitude; + float bob_cycle_angle; + float bob_target_height_offset; + float bob_height_displacement; + float bob_interpolation_state; } BossData; typedef struct BossShared { @@ -437,7 +437,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { DREK_BOSS_PHASE_BEFORE_MISSILE_GROUP = 4, DREK_BOSS_PHASE_AFTER_MISSILE_GROUP_START = 5 }; - BossData *boss_data = (BossData *)moby->f78; + BossData *boss_data = (BossData *)moby->boss_private_data; BossMoby *aim_target_moby; float position_and_displacement_scratch[4]; float position_displacement_direction_and_rotation_scratch[4]; @@ -455,12 +455,12 @@ void drek_final_boss_robot_update(BossMoby *moby) { /* The file defines this one without parameters; retail passes the moby. */ attach_drek_boss_big_head_manipulator((char *)moby); { - char *manipulator_owner_moby = boss_data->f3A4; + char *manipulator_owner_moby = boss_data->big_head_attachment_moby; if (manipulator_owner_moby != 0 && manipulator_owner_moby[0x20] >= 0) { FUN_L00_00263ac8(*(float *)&drek_boss_big_head_manipulator_scale_gp, (int)manipulator_owner_moby, 0, - boss_data->f1C0); + boss_data->big_head_manipulator_state); } } if (moby->f31 != 0 && fast_vec_dist(moby->f10, D_L18_001677C0) < 32.0f) { @@ -471,24 +471,24 @@ void drek_final_boss_robot_update(BossMoby *moby) { case DREK_BOSS_INITIALIZE: { int i; - qcopy(boss_data->f3C0, moby->f10); + qcopy(boss_data->unbobbed_boss_position, moby->f10); moby->f20 = 1; moby->f30 = 0xFF; moby->f32 = 0x200; moby->f34 |= 0x41; - moby->f94 = 0; + moby->collision_data = 0; boss_data->f28 = 3; boss_data->f20 = 500.0f; boss_data->f30 = 4.0f; boss_data->f24 = 500; - boss_data->f340 = D_L18_001B0EB0[boss_data->f260[3]]; - boss_data->f398 = boss_data->f204[0]; - boss_data->f348 = 1; - boss_data->f368 = -1; - boss_data->f38C = 350.0f; - boss_data->f334 = D_L18_0015FFD8 + boss_data->f220 * 0x100; - boss_data->f3D0 = 0.75f; - boss_data->f374 = 0.0f; + boss_data->active_movement_path = D_L18_001B0EB0[boss_data->f260[3]]; + boss_data->platform_target_group_index = boss_data->f204[0]; + boss_data->path_point_index = 1; + boss_data->health_hud_animation_handle = -1; + boss_data->boss_health = 350.0f; + boss_data->paired_transition_moby = D_L18_0015FFD8 + boss_data->paired_transition_moby_index * 0x100; + boss_data->bob_amplitude = 0.75f; + boss_data->movement_step_distance = 0.0f; for (i = 0; i < 3; i++) { hide_drek_boss_moby_group((int)moby, boss_data->f204[i]); } @@ -497,8 +497,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { case DREK_BOSS_WAIT_FOR_SCENE: if (D_L18_0015F5C4 != 2) { moby->f34 &= 0xFFBE; - moby->f94 = moby->f24[4]; - moby->f20 = *(unsigned char *)&boss_data->f39C; + moby->collision_data = moby->f24[4]; + moby->f20 = *(unsigned char *)&boss_data->post_scene_resume_state; if (moby->f20 == 5) { D_L18_0015F3FC = 1.0f; } @@ -510,79 +510,79 @@ void drek_final_boss_robot_update(BossMoby *moby) { if (((BossShared *)&D_L18_0016D260_c)->f30 == 2) { if (scale_game_frames(0xA28) <= ((BossShared *)&D_L18_0016D260_c)->f34 && ((BossShared *)&D_L18_0016D260_c)->f34 <= scale_game_frames(0xB36)) { - moby_init_action_mode(boss_data->f330); + moby_init_action_mode(boss_data->selected_class_247_moby); } } else if (((BossShared *)&D_L18_0016D260_c)->f30 == 3) { if (scale_game_frames(0x3B6) < ((BossShared *)&D_L18_0016D260_c)->f34 && ((BossShared *)&D_L18_0016D260_c)->f34 < scale_game_frames(0x3C0)) { - set_thruster_pack_lock_green_list_fields(boss_data->f200); + set_thruster_pack_lock_green_list_fields(boss_data->class_247_group_index); } if (*(int *)&D_L18_001623A0 == 0) { - char *b = D_L18_001600EC + boss_data->f294 * 0x80; + char *b = D_L18_001600EC + boss_data->scene_camera_node_index * 0x80; jet_reset_camera(b + 0x30, b + 0x70); *(int *)&D_L18_001623A0 = 1; } } break; case DREK_BOSS_WAIT_FOR_ENCOUNTER_TRIGGER: - if (is_point_inside_clip_volume(hero.motion.pos.f, boss_data->f274) != 0 && + if (is_point_inside_clip_volume(hero.motion.pos.f, boss_data->encounter_trigger_clip_volume_index) != 0 && hero.vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK) { moby->f20 = 7; moby->f34 |= 0x41; start_scene(0); - boss_data->f39C = 2; - boss_data->f358 = scale_game_frames(600); - boss_data->f344 = boss_data->f250[3]; - if (moby->f53 != 10) { + boss_data->post_scene_resume_state = 2; + boss_data->action_frame_counter = scale_game_frames(600); + boss_data->arena_center_node_index = boss_data->f250[3]; + if (moby->animation_sequence_index != 10) { blend_moby_animation(moby, 10, 0, scale_game_frames(10)); } } else { - int *encounter_trigger_path = D_L18_001B0EB0[boss_data->f270]; + int *encounter_trigger_path = D_L18_001B0EB0[boss_data->encounter_trigger_path_index]; if (point_in_path_xy( hero.motion.pos.f, encounter_trigger_path + 4, *encounter_trigger_path) != 0) { moby->f34 &= 0xFFBE; - moby->f94 = moby->f24[4]; + moby->collision_data = moby->f24[4]; moby->f20 = 10; { int *b = D_L18_001B0EB0[boss_data->f260[0]]; - boss_data->f340 = b; - qcopy(boss_data->f3C0, b + 4); + boss_data->active_movement_path = b; + qcopy(boss_data->unbobbed_boss_position, b + 4); } - moby->f40[2] = fast_arc_tan(hero.motion.pos.f[0] - boss_data->f3C0[0], - hero.motion.pos.f[1] - boss_data->f3C0[1]); + moby->f40[2] = fast_arc_tan(hero.motion.pos.f[0] - boss_data->unbobbed_boss_position[0], + hero.motion.pos.f[1] - boss_data->unbobbed_boss_position[1]); show_drek_boss_moby_group((int)moby, boss_data->f204[0]); - boss_data->f38C = boss_data->f38C * 0.85714287f; + boss_data->boss_health = boss_data->boss_health * 0.85714287f; } else if (fast_vec_dist(hero.motion.pos.f, D_L18_001600EC + (boss_data->f250[0] << 7) + 0x30) < 50.0f) { moby->f34 &= 0xFFBE; - moby->f94 = moby->f24[4]; + moby->collision_data = moby->f24[4]; moby->f20 = 0xC; { int *p = D_L18_001B0EB0[boss_data->f260[0]]; - boss_data->f340 = p; - qcopy(boss_data->f3C0, (char *)p + *p * 16); + boss_data->active_movement_path = p; + qcopy(boss_data->unbobbed_boss_position, (char *)p + *p * 16); } - boss_data->f344 = boss_data->f250[0]; - boss_data->f38C = boss_data->f38C * 0.85714287f; + boss_data->arena_center_node_index = boss_data->f250[0]; + boss_data->boss_health = boss_data->boss_health * 0.85714287f; } else if (fast_vec_dist(hero.motion.pos.f, D_L18_001600EC + (boss_data->f250[1] << 7) + 0x30) < 50.0f) { moby->f34 &= 0xFFBE; - moby->f94 = moby->f24[4]; - boss_data->f34C = 1; - boss_data->f38C = boss_data->f38C * 0.71428573f; + moby->collision_data = moby->f24[4]; + boss_data->encounter_phase = 1; + boss_data->boss_health = boss_data->boss_health * 0.71428573f; moby->f20 = 0xC; { int *p = D_L18_001B0EB0[boss_data->f260[1]]; - boss_data->f340 = p; - qcopy(boss_data->f3C0, (char *)p + *p * 16); + boss_data->active_movement_path = p; + qcopy(boss_data->unbobbed_boss_position, (char *)p + *p * 16); } - boss_data->f344 = boss_data->f250[1]; + boss_data->arena_center_node_index = boss_data->f250[1]; } else if (fast_vec_dist(hero.motion.pos.f, D_L18_001600EC + (boss_data->f250[2] << 7) + 0x30) < 50.0f) { if (*(int *)&D_L18_001623A0 != 0) { - set_thruster_pack_lock_green_list_fields(boss_data->f200); - if (voice_is_playing(moby, boss_data->f3B0) != 0) { - int i = boss_data->f3B0; + set_thruster_pack_lock_green_list_fields(boss_data->class_247_group_index); + if (voice_is_playing(moby, boss_data->hero_follow_voice_slot) != 0) { + int i = boss_data->hero_follow_voice_slot; if (i != -1) { char *e = ((char *)&voice_pool) + i * 0x70; if (*(BossMoby **)(e + 0x88) == moby && @@ -590,25 +590,25 @@ void drek_final_boss_robot_update(BossMoby *moby) { release_voice_slot(i); } } - boss_data->f3B0 = -1; + boss_data->hero_follow_voice_slot = -1; } moby->f20 = 0x1B; - moby->f94 = 0; + moby->collision_data = 0; moby->f34 |= 0x41; - boss_data->f34C = 7; + boss_data->encounter_phase = 7; } else { moby->f34 &= 0xFFBE; - moby->f94 = moby->f24[4]; - boss_data->f34C = 2; - boss_data->f38C = boss_data->f38C * 0.5714286f; + moby->collision_data = moby->f24[4]; + boss_data->encounter_phase = 2; + boss_data->boss_health = boss_data->boss_health * 0.5714286f; moby->f20 = 0xC; { int *p = D_L18_001B0EB0[boss_data->f260[2]]; - boss_data->f340 = p; - qcopy(boss_data->f3C0, (char *)p + *p * 16); + boss_data->active_movement_path = p; + qcopy(boss_data->unbobbed_boss_position, (char *)p + *p * 16); } - boss_data->f344 = boss_data->f250[2]; - boss_data->f358 = scale_game_frames(0x168); + boss_data->arena_center_node_index = boss_data->f250[2]; + boss_data->action_frame_counter = scale_game_frames(0x168); } } } @@ -618,20 +618,20 @@ void drek_final_boss_robot_update(BossMoby *moby) { desired_yaw = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); update_drek_boss_arena_circling_movement((struct Moby *)moby); - if (boss_data->f38C <= 301.0f) { + if (boss_data->boss_health <= 301.0f) { if (hero.vehicle_mode != HERO_VEHICLE_MODE_ON_FOOT) { - ((BossMoby *)hero.moby)->f94 = 0; + ((BossMoby *)hero.moby)->collision_data = 0; ((BossMoby *)hero.moby)->f34 |= 0x41; } restore_saved_hero_moby_and_clear_vehicle_mode(); { - char *b = D_L18_001600EC + boss_data->f2A0 * 0x80; + char *b = D_L18_001600EC + boss_data->race_camera_node_index * 0x80; set_race_camera(b + 0x30, b + 0x70, 0, 1); } jet_clear_persistent(boss_data->f2B0); @@ -640,26 +640,26 @@ void drek_final_boss_robot_update(BossMoby *moby) { start_scene(1); moby->f20 = 7; moby->f34 |= 0x41; - if (moby->f53 != 10) { + if (moby->animation_sequence_index != 10) { blend_moby_animation(moby, 10, 0, scale_game_frames(0x14)); } - boss_data->f39C = 10; - boss_data->f348 = 0; - boss_data->f374 = 0.0f; + boss_data->post_scene_resume_state = 10; + boss_data->path_point_index = 0; + boss_data->movement_step_distance = 0.0f; { int *b = D_L18_001B0EB0[boss_data->f260[0]]; - boss_data->f340 = b; - qcopy(boss_data->f3C0, b + 4); + boss_data->active_movement_path = b; + qcopy(boss_data->unbobbed_boss_position, b + 4); } - moby->f40[2] = fast_arc_tan(hero.motion.pos.f[0] - boss_data->f3C0[0], - hero.motion.pos.f[1] - boss_data->f3C0[1]); - boss_data->f368 = -1; + moby->f40[2] = fast_arc_tan(hero.motion.pos.f[0] - boss_data->unbobbed_boss_position[0], + hero.motion.pos.f[1] - boss_data->unbobbed_boss_position[1]); + boss_data->health_hud_animation_handle = -1; break; } - if (moby->f53 == 10 && (is_value_within_interpolated_window((char *)moby, 1.0f) != 0 || + if (moby->animation_sequence_index == 10 && (is_value_within_interpolated_window((char *)moby, 1.0f) != 0 || is_value_within_interpolated_window((char *)moby, 16.0f) != 0)) { qcopy(position_and_displacement_scratch, hero.motion.near_ground_point.f); - if (absolute_float(position_and_displacement_scratch[2] - boss_data->f3C0[2]) < 5.0f) { + if (absolute_float(position_and_displacement_scratch[2] - boss_data->unbobbed_boss_position[2]) < 5.0f) { if ((float)moby->f50 < 15.0f) { moby_point_position( moby, 2, position_displacement_direction_and_rotation_scratch); @@ -688,7 +688,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { } } } - if ((moby->f70 & 2) != 0 && moby->f53 != 10) { + if ((moby->f70 & 2) != 0 && moby->animation_sequence_index != 10) { blend_moby_animation(moby, 10, 0, scale_game_frames(0x14)); } break; @@ -700,66 +700,66 @@ void drek_final_boss_robot_update(BossMoby *moby) { desired_yaw = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); - qcopy(position_and_displacement_scratch, boss_data->f340 + 4); + qcopy(position_and_displacement_scratch, boss_data->active_movement_path + 4); hit = advance_drek_boss_planar_position_toward_target( (char *)moby, 20.0f, position_and_displacement_scratch); - lvl = get_camera_transition_progress(boss_data->f334); - if (moby->f53 == 7) { + lvl = get_camera_transition_progress(boss_data->paired_transition_moby); + if (moby->animation_sequence_index == 7) { if ((moby->f70 & 2) != 0) { blend_moby_animation(moby, 8, 0, scale_game_frames(10)); } } else { fast_vec_sub(position_displacement_direction_and_rotation_scratch, - boss_data->f340 + 4, - boss_data->f3C0); + boss_data->active_movement_path + 4, + boss_data->unbobbed_boss_position); fast_vec_normalize(position_displacement_direction_and_rotation_scratch, position_displacement_direction_and_rotation_scratch, frame_time * 5.0f); - fast_vec_add(boss_data->f3C0, - boss_data->f3C0, + fast_vec_add(boss_data->unbobbed_boss_position, + boss_data->unbobbed_boss_position, position_displacement_direction_and_rotation_scratch); } if (lvl > 0.5f && lvl < 0.7f) { - if (moby->f53 != 9) { + if (moby->animation_sequence_index != 9) { blend_moby_animation(moby, 9, 0, 0); } - if (boss_data->f33C == 0) { + if (boss_data->pending_electric_ball_moby == 0) { break; } moby_point_position(moby, 1, position_displacement_direction_and_rotation_scratch); qcopy(position_direction_and_rotation_scratch, - D_L18_001600EC + boss_data->f344 * 0x80 + 0x30); + D_L18_001600EC + boss_data->arena_center_node_index * 0x80 + 0x30); position_direction_and_rotation_scratch[2] = position_direction_and_rotation_scratch[2] + 10.0f; position_direction_and_rotation_scratch[2] = probe_ground_height(position_direction_and_rotation_scratch, 0, 0.5f); - refresh_moby_position_and_activate(boss_data->f33C, + refresh_moby_position_and_activate(boss_data->pending_electric_ball_moby, position_displacement_direction_and_rotation_scratch, - D_L18_001600EC + boss_data->f344 * 0x80 + 0x30, + D_L18_001600EC + boss_data->arena_center_node_index * 0x80 + 0x30, 1, 1.0f); - boss_data->f33C = 0; + boss_data->pending_electric_ball_moby = 0; } else if (lvl >= 0.729f) { int i; - if (moby->f53 != 0) { + if (moby->animation_sequence_index != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0x14)); } if (hit != 0) { moby->f20 = 10; } for (i = 0; i < 4; i++) { - int k = boss_data->f34C == 1 ? boss_data->f230[i] : boss_data->f240[i]; + int k = boss_data->encounter_phase == 1 ? boss_data->f230[i] : boss_data->alternate_platform_activation_moby_indices[i]; activate_drek_boss_class_0565_moby(D_L18_0015FFD8 + k * 0x100); } } - if (boss_data->f33C != 0) { + if (boss_data->pending_electric_ball_moby != 0) { float f; moby_point_position(moby, 1, position_displacement_direction_and_rotation_scratch); @@ -767,7 +767,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { if (f > 1.0f) { f = 1.0f; } - refresh_moby_position_and_activate(boss_data->f33C, + refresh_moby_position_and_activate(boss_data->pending_electric_ball_moby, position_displacement_direction_and_rotation_scratch, D_L18_0015F580, 0, @@ -782,31 +782,31 @@ void drek_final_boss_robot_update(BossMoby *moby) { desired_yaw = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); - approach_value(&boss_data->f374, frame_time * 12.0f, frame_time_sq * 20.0f); - if (boss_data->f374 != 0.0f) { + approach_value(&boss_data->movement_step_distance, frame_time * 12.0f, frame_time_sq * 20.0f); + if (boss_data->movement_step_distance != 0.0f) { fast_vec_sub(position_and_displacement_scratch, - (char *)boss_data->f340 + (boss_data->f348 * 0x10 + 0x10), - boss_data->f3C0); - if (fast_vec_length(position_and_displacement_scratch) <= boss_data->f374) { - boss_data->f348 = boss_data->f348 + 1; + (char *)boss_data->active_movement_path + (boss_data->path_point_index * 0x10 + 0x10), + boss_data->unbobbed_boss_position); + if (fast_vec_length(position_and_displacement_scratch) <= boss_data->movement_step_distance) { + boss_data->path_point_index = boss_data->path_point_index + 1; } else { fast_vec_normalize(position_and_displacement_scratch, position_and_displacement_scratch, - boss_data->f374); + boss_data->movement_step_distance); } - fast_vec_add(boss_data->f3C0, boss_data->f3C0, position_and_displacement_scratch); + fast_vec_add(boss_data->unbobbed_boss_position, boss_data->unbobbed_boss_position, position_and_displacement_scratch); } firing_target_moby = select_drek_boss_platform_firing_target((char *)moby); if (firing_target_moby != 0 && (is_value_within_interpolated_window((char *)moby, 1.0f) != 0 || is_value_within_interpolated_window((char *)moby, 16.0f) != 0)) { qcopy(position_direction_and_rotation_scratch, firing_target_moby + 0x10); - qcopy(position_and_displacement_scratch, boss_data->f3C0); + qcopy(position_and_displacement_scratch, boss_data->unbobbed_boss_position); fast_vec_add( position_and_displacement_scratch, position_and_displacement_scratch, moby->fC0); position_and_displacement_scratch[2] = position_and_displacement_scratch[2] + 6.0f; @@ -825,8 +825,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { 5); } } - if (boss_data->f348 == *boss_data->f340 - 2) { - if (moby->f53 != 0) { + if (boss_data->path_point_index == *boss_data->active_movement_path - 2) { + if (moby->animation_sequence_index != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0x14)); } moby->f20 = 0xB; @@ -834,35 +834,35 @@ void drek_final_boss_robot_update(BossMoby *moby) { break; } case DREK_BOSS_FINISH_PATH_AND_WAIT_FOR_HERO: - if (boss_data->f348 != *boss_data->f340) { - approach_value(&boss_data->f374, frame_time * 10.0f, frame_time_sq * 20.0f); + if (boss_data->path_point_index != *boss_data->active_movement_path) { + approach_value(&boss_data->movement_step_distance, frame_time * 10.0f, frame_time_sq * 20.0f); fast_vec_sub(position_and_displacement_scratch, - (char *)boss_data->f340 + (boss_data->f348 * 0x10 + 0x10), - boss_data->f3C0); - if (fast_vec_length(position_and_displacement_scratch) <= boss_data->f374) { - boss_data->f348 = boss_data->f348 + 1; + (char *)boss_data->active_movement_path + (boss_data->path_point_index * 0x10 + 0x10), + boss_data->unbobbed_boss_position); + if (fast_vec_length(position_and_displacement_scratch) <= boss_data->movement_step_distance) { + boss_data->path_point_index = boss_data->path_point_index + 1; } else { fast_vec_normalize(position_and_displacement_scratch, position_and_displacement_scratch, - boss_data->f374); + boss_data->movement_step_distance); } - fast_vec_add(boss_data->f3C0, boss_data->f3C0, position_and_displacement_scratch); + fast_vec_add(boss_data->unbobbed_boss_position, boss_data->unbobbed_boss_position, position_and_displacement_scratch); break; } if (vector_distance_xy(moby->f10, hero.motion.pos.f) < 50.0f && hero.air_frames.s == 0 && (((BossMoby *)hero.ground_moby) == 0 || ((BossMoby *)hero.ground_moby)->fA6 != 0x24B)) { - int *p = boss_data->f340; + int *p = boss_data->active_movement_path; - boss_data->f374 = 0.0f; - qcopy(boss_data->f3C0, (char *)p + *p * 16); - boss_data->f344 = boss_data->f250[boss_data->f34C]; - if (boss_data->f34C == 2) { + boss_data->movement_step_distance = 0.0f; + qcopy(boss_data->unbobbed_boss_position, (char *)p + *p * 16); + boss_data->arena_center_node_index = boss_data->f250[boss_data->encounter_phase]; + if (boss_data->encounter_phase == 2) { if (*(int *)&l18_drek_boss_scene_2_started_gp == 0) { moby->f20 = 4; } else { moby->f20 = 0x15; - boss_data->f330 = find_class_247_moby_with_largest_xy_angle_in_list( - boss_data->f3C0, hero.motion.pos.f, boss_data->f200); + boss_data->selected_class_247_moby = find_class_247_moby_with_largest_xy_angle_in_list( + boss_data->unbobbed_boss_position, hero.motion.pos.f, boss_data->class_247_group_index); } break; } @@ -876,9 +876,9 @@ void drek_final_boss_robot_update(BossMoby *moby) { *(int *)&l18_drek_boss_scene_2_started_gp = 1; moby->f20 = 7; - boss_data->f39C = 5; - boss_data->f330 = - (BossMoby *)find_nearest_class_247_moby_in_list(hero.motion.pos.f, boss_data->f200); + boss_data->post_scene_resume_state = 5; + boss_data->selected_class_247_moby = + (BossMoby *)find_nearest_class_247_moby_in_list(hero.motion.pos.f, boss_data->class_247_group_index); moby->f34 |= 0x41; start_scene(2); for (i = 0; i < 3; i++) { @@ -887,7 +887,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { } break; case DREK_BOSS_INITIALIZE_PAIRED_TRANSFORM_TRANSITION: { - unsigned char *b = D_L18_0015FFD8 + boss_data->f21C * 0x100; + unsigned char *b = D_L18_0015FFD8 + boss_data->thruster_lock_moby_index * 0x100; b += 0x10; *(int *)&D_L18_00162390 = 0; @@ -913,12 +913,12 @@ void drek_final_boss_robot_update(BossMoby *moby) { { /* In locals: retail does not load them again after the copy. */ char *recs = D_L18_001600EC; - int idx = boss_data->f298; + int idx = boss_data->paired_transition_node_index; qcopy(node_position_and_yaw, recs + idx * 0x80 + 0x30); node_position_and_yaw[3] = *(float *)(recs + idx * 0x80 + 0x78); } - start_camera_transition((char *)boss_data->f334, + start_camera_transition((char *)boss_data->paired_transition_moby, position_and_displacement_scratch, position_displacement_direction_and_rotation_scratch, position_direction_and_rotation_scratch, @@ -929,42 +929,42 @@ void drek_final_boss_robot_update(BossMoby *moby) { 1); hero.pending_item[3] = 3; moby->f20 = 8; - request_thruster_pack_lock_red_wait(D_L18_0015FFD8 + boss_data->f21C * 0x100, + request_thruster_pack_lock_red_wait(D_L18_0015FFD8 + boss_data->thruster_lock_moby_index * 0x100, scale_game_frames(0x708)); break; } case DREK_BOSS_WAIT_TO_RESTORE_SAVED_TRANSFORM: - if (classify_moby_state_two_or_three(boss_data->f334) == 2) { - qcopy(boss_data->f3C0, boss_data->f300); - qcopy(moby->f40, boss_data->f310); + if (classify_moby_state_two_or_three(boss_data->paired_transition_moby) == 2) { + qcopy(boss_data->unbobbed_boss_position, boss_data->f300); + qcopy(moby->f40, boss_data->saved_transition_rotation); moby->f20 = 9; - if (moby->f53 != 7) { + if (moby->animation_sequence_index != 7) { blend_moby_animation(moby, 7, 0, scale_game_frames(0x14)); } - show_drek_boss_moby_group((int)moby, boss_data->f398); - hide_drek_boss_moby_group((int)moby, boss_data->f204[boss_data->f34C - 1]); + show_drek_boss_moby_group((int)moby, boss_data->platform_target_group_index); + hide_drek_boss_moby_group((int)moby, boss_data->f204[boss_data->encounter_phase - 1]); moby_point_position(moby, 1, position_and_displacement_scratch); - boss_data->f33C = (unsigned char *)spawn_drek_boss_electric_ball( + boss_data->pending_electric_ball_moby = (unsigned char *)spawn_drek_boss_electric_ball( moby, position_and_displacement_scratch, 300); } break; case DREK_BOSS_WAIT_FOR_PAIRED_TRANSFORM_TRANSITION: moby->f34 |= 0x41; - if (get_camera_transition_progress(boss_data->f334) >= 1.0f) { + if (get_camera_transition_progress(boss_data->paired_transition_moby) >= 1.0f) { moby->f20 = 0xC; moby->f34 &= 0xFFBE; - if (moby->f53 != 0) { + if (moby->animation_sequence_index != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(10)); } } break; case DREK_BOSS_ACTIVATE_MISSILE_GROUP: - if (fast_dec_timer(&boss_data->f354) != 0) { - boss_data->f354 = scale_game_frames(0x14); - qcopy(position_and_displacement_scratch, boss_data->f3C0); + if (fast_dec_timer(&boss_data->action_event_timer_frames) != 0) { + boss_data->action_event_timer_frames = scale_game_frames(0x14); + qcopy(position_and_displacement_scratch, boss_data->unbobbed_boss_position); position_and_displacement_scratch[2] = position_and_displacement_scratch[2] + 4.0f; if (activate_drek_fight_missiles_in_group( - (char *)moby, boss_data->f214, position_and_displacement_scratch) != 0) { + (char *)moby, boss_data->missile_group_index, position_and_displacement_scratch) != 0) { moby->f20 = 0xC; } } @@ -974,7 +974,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { desired_yaw = fast_arc_tan(aim_target_moby->f10[0] - moby->f10[0], aim_target_moby->f10[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, @@ -986,42 +986,42 @@ void drek_final_boss_robot_update(BossMoby *moby) { switch (select_drek_boss_next_action((char *)moby)) { case DREK_BOSS_TARGET_GROUND_POINTS: moby->f20 = 0xF; - if (moby->f53 != 10) { + if (moby->animation_sequence_index != 10) { blend_moby_animation(moby, 10, 0, scale_game_frames(0x14)); } - boss_data->f354 = 0; - boss_data->f358 = scale_game_frames(600); - boss_data->f35C = scale_game_frames(0x168); + boss_data->action_event_timer_frames = 0; + boss_data->action_frame_counter = scale_game_frames(600); + boss_data->secondary_action_timer_frames = scale_game_frames(0x168); break; case DREK_BOSS_LAUNCH_FORWARD_WITH_LATERAL_OFFSET: moby->f20 = 0xD; - if (moby->f53 != 2) { + if (moby->animation_sequence_index != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(0x14)); } - boss_data->f354 = 0; - boss_data->f358 = scale_game_frames(random_integer_below(3) * 0x5A + 0x14A); - boss_data->f35C = scale_game_frames((6 - boss_data->f34C) * 0x1E); - boss_data->f3BC = random_float_between(-0.333f, 0.333f); + boss_data->action_event_timer_frames = 0; + boss_data->action_frame_counter = scale_game_frames(random_integer_below(3) * 0x5A + 0x14A); + boss_data->secondary_action_timer_frames = scale_game_frames((6 - boss_data->encounter_phase) * 0x1E); + boss_data->ring_launch_lateral_coefficient = random_float_between(-0.333f, 0.333f); break; case DREK_BOSS_TARGET_SIDE_GROUND_POINTS: moby->f20 = 0x11; - if (moby->f53 != 11) { + if (moby->animation_sequence_index != 11) { blend_moby_animation(moby, 0xB, 0, scale_game_frames(0x14)); } - boss_data->f354 = scale_game_frames(10); - boss_data->f358 = scale_game_frames(600); + boss_data->action_event_timer_frames = scale_game_frames(10); + boss_data->action_frame_counter = scale_game_frames(600); break; default: moby->f20 = 0x10; - if (moby->f53 != 6) { + if (moby->animation_sequence_index != 6) { blend_moby_animation(moby, 6, 0, scale_game_frames(0x14)); } - boss_data->f354 = scale_game_frames(0xF); - boss_data->f358 = scale_game_frames(0x168); + boss_data->action_event_timer_frames = scale_game_frames(0xF); + boss_data->action_frame_counter = scale_game_frames(0x168); break; case DREK_BOSS_ACTION_REPOSITION_AND_AIM: moby->f20 = 0x12; - if (moby->f53 != 0) { + if (moby->animation_sequence_index != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0x14)); } { @@ -1032,73 +1032,73 @@ void drek_final_boss_robot_update(BossMoby *moby) { float w; qcopy(position_and_displacement_scratch, - D_L18_001600EC + boss_data->f280[i] * 0x80 + 0x30); + D_L18_001600EC + boss_data->aim_candidate_node_indices[i] * 0x80 + 0x30); w = fast_difference_between_rotations( - fast_arc_tan(boss_data->f3C0[0] - hero.motion.pos.f[0], - boss_data->f3C0[1] - hero.motion.pos.f[1]), - fast_arc_tan(boss_data->f3C0[0] - position_and_displacement_scratch[0], - boss_data->f3C0[1] - position_and_displacement_scratch[1])); + fast_arc_tan(boss_data->unbobbed_boss_position[0] - hero.motion.pos.f[0], + boss_data->unbobbed_boss_position[1] - hero.motion.pos.f[1]), + fast_arc_tan(boss_data->unbobbed_boss_position[0] - position_and_displacement_scratch[0], + boss_data->unbobbed_boss_position[1] - position_and_displacement_scratch[1])); if (best < w) { - boss_data->f3A8 = boss_data->f280[i]; + boss_data->selected_aim_node_index = boss_data->aim_candidate_node_indices[i]; best = w; } } } - boss_data->f358 = scale_game_frames(900); - boss_data->f354 = scale_game_frames(0xB4); + boss_data->action_frame_counter = scale_game_frames(900); + boss_data->action_event_timer_frames = scale_game_frames(0xB4); break; case DREK_BOSS_FOLLOW_HERO: moby->f20 = 0x13; - if (moby->f53 != 1) { + if (moby->animation_sequence_index != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(0x14)); } if (vector_distance_xy(moby->f10, hero.motion.pos.f) < 16.0f) { - boss_data->f354 = scale_game_frames(0x5A); + boss_data->action_event_timer_frames = scale_game_frames(0x5A); } else { - boss_data->f354 = 0; + boss_data->action_event_timer_frames = 0; } - boss_data->f358 = scale_game_frames(600); - boss_data->f35C = scale_game_frames(600); - boss_data->f338 = create_class_274_ring_effect(moby, boss_data->f3C0, 5.8f); + boss_data->action_frame_counter = scale_game_frames(600); + boss_data->secondary_action_timer_frames = scale_game_frames(600); + boss_data->hero_follow_ring_effect_moby = create_class_274_ring_effect(moby, boss_data->unbobbed_boss_position, 5.8f); break; } break; case DREK_BOSS_ACTION_REPOSITION_AND_AIM: aim = &moby->f40[2]; desired_yaw = - fast_arc_tan(boss_data->f320[0] - moby->f10[0], boss_data->f320[1] - moby->f10[1]); + fast_arc_tan(boss_data->stored_aim_target_position[0] - moby->f10[0], boss_data->stored_aim_target_position[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); moby_point_position(moby, 0x13, position_and_displacement_scratch); *(BossTI *)position_displacement_direction_and_rotation_scratch = - *(BossTI *)boss_data->f320; + *(BossTI *)boss_data->stored_aim_target_position; set_drek_boss_relative_aim_yaw((char *)moby, - boss_data->f140, + boss_data->joint_19_animation_state, position_and_displacement_scratch, position_displacement_direction_and_rotation_scratch); - boss_data->f3D8 = -3.0f; - if ((moby->f70 & 2) != 0 && moby->f53 != 8) { + boss_data->bob_target_height_offset = -3.0f; + if ((moby->f70 & 2) != 0 && moby->animation_sequence_index != 8) { blend_moby_animation(moby, 8, 0, scale_game_frames(0x14)); } - if (boss_data->f354 != 0) { - if (boss_data->f33C == 0) { + if (boss_data->action_event_timer_frames != 0) { + if (boss_data->pending_electric_ball_moby == 0) { moby_point_position(moby, 1, position_displacement_direction_and_rotation_scratch); - boss_data->f33C = (unsigned char *)spawn_drek_boss_electric_ball( + boss_data->pending_electric_ball_moby = (unsigned char *)spawn_drek_boss_electric_ball( moby, position_displacement_direction_and_rotation_scratch, scale_game_frames(*(int *)&l18_drek_boss_aimed_class_3d7_spawn_frame_count_gp)); - } else if (fast_dec_timer(&boss_data->f354) != 0) { - if (moby->f53 != 9) { + } else if (fast_dec_timer(&boss_data->action_event_timer_frames) != 0) { + if (moby->animation_sequence_index != 9) { blend_moby_animation(moby, 9, 0, 0); } - boss_data->f354 = scale_game_frames(0x78); + boss_data->action_event_timer_frames = scale_game_frames(0x78); moby_point_position(moby, 1, position_displacement_direction_and_rotation_scratch); fast_vec_sub(position_direction_and_rotation_scratch, - boss_data->f320, + boss_data->stored_aim_target_position, position_displacement_direction_and_rotation_scratch); position_direction_and_rotation_scratch[2] = 2.0f; set_vector_length_xy(position_direction_and_rotation_scratch, @@ -1108,18 +1108,18 @@ void drek_final_boss_robot_update(BossMoby *moby) { position_direction_and_rotation_scratch, position_displacement_direction_and_rotation_scratch); refresh_moby_position_and_activate( - boss_data->f33C, + boss_data->pending_electric_ball_moby, position_displacement_direction_and_rotation_scratch, position_direction_and_rotation_scratch, 1, 1.0f); - boss_data->f33C = 0; - if (boss_data->f358 == 0) { - boss_data->f350 = 0xE; + boss_data->pending_electric_ball_moby = 0; + if (boss_data->action_frame_counter == 0) { + boss_data->previous_action_state = 0xE; moby->f20 = 0xC; } } else { - float f = 1.0f - convert_integer_to_float(boss_data->f354) / scale_time(90.0f); + float f = 1.0f - convert_integer_to_float(boss_data->action_event_timer_frames) / scale_time(90.0f); if (f > 1.0f) { f = 1.0f; @@ -1128,24 +1128,24 @@ void drek_final_boss_robot_update(BossMoby *moby) { } moby_point_position(moby, 1, position_displacement_direction_and_rotation_scratch); refresh_moby_position_and_activate( - boss_data->f33C, + boss_data->pending_electric_ball_moby, position_displacement_direction_and_rotation_scratch, - boss_data->f320, + boss_data->stored_aim_target_position, 0, f); - if (scale_game_frames(0xF) < boss_data->f354) { - qcopy(boss_data->f320, aim_target_moby->f10); + if (scale_game_frames(0xF) < boss_data->action_event_timer_frames) { + qcopy(boss_data->stored_aim_target_position, aim_target_moby->f10); } } } - fast_dec_timer(&boss_data->f358); + fast_dec_timer(&boss_data->action_frame_counter); break; case DREK_BOSS_TARGET_GROUND_POINTS: aim = &moby->f40[2]; desired_yaw = fast_arc_tan(aim_target_moby->f10[0] - moby->f10[0], aim_target_moby->f10[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, @@ -1175,7 +1175,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { } if (hero.state.control_mode == 0xF) { qcopy(position_displacement_direction_and_rotation_scratch, - D_L18_001600EC + boss_data->f344 * 0x80 + 0x30); + D_L18_001600EC + boss_data->arena_center_node_index * 0x80 + 0x30); fast_vec_sub(position_and_displacement_scratch, position_and_displacement_scratch, position_displacement_direction_and_rotation_scratch); @@ -1190,7 +1190,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { } position_and_displacement_scratch[2] = probe_ground_height(position_and_displacement_scratch, 0, 0.5f); - if (absolute_float(position_and_displacement_scratch[2] - boss_data->f3C0[2]) < 5.0f) { + if (absolute_float(position_and_displacement_scratch[2] - boss_data->unbobbed_boss_position[2]) < 5.0f) { float a; float c; float e; @@ -1223,9 +1223,9 @@ void drek_final_boss_robot_update(BossMoby *moby) { (char *)moby, position_displacement_direction_and_rotation_scratch); } } - if (fast_dec_timer(&boss_data->f358) != 0 || - (boss_data->f390 > 25.0f && (float)boss_data->f34C < 4.0f)) { - boss_data->f350 = 0xF; + if (fast_dec_timer(&boss_data->action_frame_counter) != 0 || + (boss_data->rail_mode_damage_accumulated > 25.0f && (float)boss_data->encounter_phase < 4.0f)) { + boss_data->previous_action_state = 0xF; moby->f20 = 0xC; } break; @@ -1234,33 +1234,33 @@ void drek_final_boss_robot_update(BossMoby *moby) { desired_yaw = fast_arc_tan(aim_target_moby->f10[0] - moby->f10[0], aim_target_moby->f10[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); update_drek_boss_arena_circling_movement((struct Moby *)moby); - if (boss_data->f354 < boss_data->f358 + boss_data->f35C) { - boss_data->f128 = fast_arc_tan(1.0f, boss_data->f3BC); + if (boss_data->action_event_timer_frames < boss_data->action_frame_counter + boss_data->secondary_action_timer_frames) { + boss_data->lateral_launch_aim_angle = fast_arc_tan(1.0f, boss_data->ring_launch_lateral_coefficient); } - if (moby->f53 == 2) { + if (moby->animation_sequence_index == 2) { if ((moby->f70 & 2) != 0) { blend_moby_animation(moby, 4, 0, scale_game_frames(0x14)); } - } else if (fast_dec_timer(&boss_data->f354) != 0 && boss_data->f358 != 0 && - moby->f53 != 4) { + } else if (fast_dec_timer(&boss_data->action_event_timer_frames) != 0 && boss_data->action_frame_counter != 0 && + moby->animation_sequence_index != 4) { blend_moby_animation(moby, 4, 0, scale_game_frames(0x14)); } - if (moby->f53 == 4) { + if (moby->animation_sequence_index == 4) { if (is_value_within_interpolated_window((char *)moby, 1.0f) != 0) { float f; - boss_data->f354 = scale_game_frames(0x5A); - boss_data->f360 = scale_game_frames(300); + boss_data->action_event_timer_frames = scale_game_frames(0x5A); + boss_data->ring_launch_cooldown_frames = scale_game_frames(300); moby_point_position(moby, 0, position_and_displacement_scratch); qcopy(position_displacement_direction_and_rotation_scratch, moby->fC0); fast_vec_normalize( - position_direction_and_rotation_scratch, moby->fD0, boss_data->f3BC); + position_direction_and_rotation_scratch, moby->fD0, boss_data->ring_launch_lateral_coefficient); fast_vec_add(position_displacement_direction_and_rotation_scratch, position_displacement_direction_and_rotation_scratch, position_direction_and_rotation_scratch); @@ -1281,15 +1281,15 @@ void drek_final_boss_robot_update(BossMoby *moby) { 64.0f, frame_time * 18.0f); spawn_drek_boss_firing_effects((char *)moby, position_and_displacement_scratch); - boss_data->f3BC = randf_sym(0.133f, 0.333f); - } else if ((moby->f70 & 2) != 0 && moby->f53 != 3) { + boss_data->ring_launch_lateral_coefficient = randf_sym(0.133f, 0.333f); + } else if ((moby->f70 & 2) != 0 && moby->animation_sequence_index != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(0x14)); } } - if (fast_dec_timer(&boss_data->f358) != 0 && fast_dec_timer(&boss_data->f35C) != 0) { - boss_data->f350 = 0xD; + if (fast_dec_timer(&boss_data->action_frame_counter) != 0 && fast_dec_timer(&boss_data->secondary_action_timer_frames) != 0) { + boss_data->previous_action_state = 0xD; moby->f20 = 0xC; - if (moby->f53 != 5) { + if (moby->animation_sequence_index != 5) { blend_moby_animation(moby, 5, 0, scale_game_frames(0x14)); } } @@ -1299,18 +1299,18 @@ void drek_final_boss_robot_update(BossMoby *moby) { desired_yaw = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); update_drek_boss_arena_circling_movement((struct Moby *)moby); - if (fast_dec_timer(&boss_data->f354) != 0) { + if (fast_dec_timer(&boss_data->action_event_timer_frames) != 0) { float a; float r; qcopy(position_and_displacement_scratch, - D_L18_001600EC + boss_data->f344 * 0x80 + 0x30); + D_L18_001600EC + boss_data->arena_center_node_index * 0x80 + 0x30); fast_vec_normalize( position_displacement_direction_and_rotation_scratch, moby->fC0, 3.0f); fast_vec_add(position_displacement_direction_and_rotation_scratch, @@ -1330,7 +1330,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { position_direction_and_rotation_scratch[2] + 5.0f; position_direction_and_rotation_scratch[2] = probe_ground_height(position_direction_and_rotation_scratch, 0, 0.5f); - if (absolute_float(position_direction_and_rotation_scratch[2] - boss_data->f3C0[2]) < + if (absolute_float(position_direction_and_rotation_scratch[2] - boss_data->unbobbed_boss_position[2]) < 5.0f) { float speed = vector_distance_xy(position_direction_and_rotation_scratch, @@ -1340,16 +1340,16 @@ void drek_final_boss_robot_update(BossMoby *moby) { launch_class_238_moby_from_list( (int)moby, - boss_data->f29C, + boss_data->class_238_launch_group_index, position_displacement_direction_and_rotation_scratch, position_direction_and_rotation_scratch, speed, truncate_float_to_s32(scale_time(w * 60.0f))); } - boss_data->f354 = scale_game_frames(0xF); + boss_data->action_event_timer_frames = scale_game_frames(0xF); } - if (fast_dec_timer(&boss_data->f358) != 0) { - boss_data->f350 = 0x10; + if (fast_dec_timer(&boss_data->action_frame_counter) != 0) { + boss_data->previous_action_state = 0x10; moby->f20 = 0xC; } break; @@ -1360,51 +1360,51 @@ void drek_final_boss_robot_update(BossMoby *moby) { desired_yaw = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); update_drek_boss_arena_circling_movement((struct Moby *)moby); - if ((moby->f70 & 2) != 0 && moby->f53 != 12) { + if ((moby->f70 & 2) != 0 && moby->animation_sequence_index != 12) { blend_moby_animation(moby, 0xC, 0, scale_game_frames(0x14)); } - if ((moby->f53 == 12 && fast_dec_timer(&boss_data->f354) != 0) || - boss_data->f354 == scale_game_frames(0x1E)) { - float f = boss_data->f354 != 0 ? 4.3f : -4.3f; + if ((moby->animation_sequence_index == 12 && fast_dec_timer(&boss_data->action_event_timer_frames) != 0) || + boss_data->action_event_timer_frames == scale_game_frames(0x1E)) { + float f = boss_data->action_event_timer_frames != 0 ? 4.3f : -4.3f; fast_vec_normalize(position_and_displacement_scratch, moby->fD0, f); fast_vec_add(position_and_displacement_scratch, position_and_displacement_scratch, - boss_data->f3C0); + boss_data->unbobbed_boss_position); position_and_displacement_scratch[2] = probe_ground_height(position_and_displacement_scratch, 0, 0.5f); - if (absolute_float(position_and_displacement_scratch[2] - boss_data->f3C0[2]) < 1.0f) { + if (absolute_float(position_and_displacement_scratch[2] - boss_data->unbobbed_boss_position[2]) < 1.0f) { /* v1 is not written in this state; retail passes it all the same. */ float speed = vector_distance_xy(position_and_displacement_scratch, position_displacement_direction_and_rotation_scratch) / (float)scale_game_frames(0x3C); - if (launch_first_idle_group_class_0772_moby(boss_data->f210, + if (launch_first_idle_group_class_0772_moby(boss_data->gadgebot_group_index, position_and_displacement_scratch, position_and_displacement_scratch, speed) != 0 && - boss_data->f354 == 0) { - boss_data->f354 = scale_game_frames(0x3C); + boss_data->action_event_timer_frames == 0) { + boss_data->action_event_timer_frames = scale_game_frames(0x3C); } } } - n = count_group_gadgebots_not_in_state_8(boss_data->f210); - if (n >= 11 && scale_game_frames(0x3C) > boss_data->f354) { - boss_data->f354 = scale_game_frames(1000); - } else if (n < 3 && scale_game_frames(0x3C) < boss_data->f354) { - boss_data->f358 = 0; + n = count_group_gadgebots_not_in_state_8(boss_data->gadgebot_group_index); + if (n >= 11 && scale_game_frames(0x3C) > boss_data->action_event_timer_frames) { + boss_data->action_event_timer_frames = scale_game_frames(1000); + } else if (n < 3 && scale_game_frames(0x3C) < boss_data->action_event_timer_frames) { + boss_data->action_frame_counter = 0; } - if (fast_dec_timer(&boss_data->f358) != 0) { - boss_data->f350 = 0x11; + if (fast_dec_timer(&boss_data->action_frame_counter) != 0) { + boss_data->previous_action_state = 0x11; moby->f20 = 0xC; - if (moby->f53 != 13) { + if (moby->animation_sequence_index != 13) { blend_moby_animation(moby, 0xD, 0, scale_game_frames(0x14)); } } @@ -1417,21 +1417,21 @@ void drek_final_boss_robot_update(BossMoby *moby) { desired_yaw = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); - if (fast_dec_timer(&boss_data->f354) != 0) { + if (fast_dec_timer(&boss_data->action_event_timer_frames) != 0) { update_drek_boss_hero_follow_movement((char *)moby); } - refresh_ring_effect(boss_data->f338, boss_data->f3C0, 5.8f); - if (voice_is_playing(moby, boss_data->f3B0) == 0) { - boss_data->f3B0 = allocate_voice_for_target_entry(0xE, 4, (int)moby); + refresh_ring_effect(boss_data->hero_follow_ring_effect_moby, boss_data->unbobbed_boss_position, 5.8f); + if (voice_is_playing(moby, boss_data->hero_follow_voice_slot) == 0) { + boss_data->hero_follow_voice_slot = allocate_voice_for_target_entry(0xE, 4, (int)moby); } fire = 0; - if (fast_dec_timer(&boss_data->f358) != 0 && - (hero.state.control_mode != 0xF || fast_dec_timer(&boss_data->f35C) != 0)) { + if (fast_dec_timer(&boss_data->action_frame_counter) != 0 && + (hero.state.control_mode != 0xF || fast_dec_timer(&boss_data->secondary_action_timer_frames) != 0)) { fire = 1; } if (hero.state.control_mode == 0xF) { @@ -1451,7 +1451,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { fire = 1; } if (fire) { - int i = boss_data->f3B0; + int i = boss_data->hero_follow_voice_slot; if (i != -1) { char *e = ((char *)&voice_pool) + i * 0x70; @@ -1459,12 +1459,12 @@ void drek_final_boss_robot_update(BossMoby *moby) { release_voice_slot(i); } } - boss_data->f3B0 = -1; + boss_data->hero_follow_voice_slot = -1; moby->f20 = 0xC; - if (moby->f53 != 0) { + if (moby->animation_sequence_index != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0x14)); } - boss_data->f350 = 0x13; + boss_data->previous_action_state = 0x13; } break; } @@ -1473,43 +1473,43 @@ void drek_final_boss_robot_update(BossMoby *moby) { desired_yaw = fast_arc_tan(boss_data->f70[0] - moby->f10[0], boss_data->f70[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); { /* Retail scales the index before it sets up the call. */ - int aim_node_byte_offset = boss_data->f3A8 * 0x80; + int aim_node_byte_offset = boss_data->selected_aim_node_index * 0x80; if (advance_drek_boss_planar_position_toward_target( (char *)moby, frame_time * 12.0f, D_L18_001600EC + aim_node_byte_offset + 0x30) != 0) { moby->f20 = 0xE; - if (moby->f53 != 7) { + if (moby->animation_sequence_index != 7) { blend_moby_animation(moby, 7, 0, scale_game_frames(0x14)); } - qcopy(boss_data->f320, aim_target_moby->f10); + qcopy(boss_data->stored_aim_target_position, aim_target_moby->f10); } } break; case DREK_BOSS_APPROACH_SELECTED_MOBY: aim = &moby->f40[2]; - desired_yaw = fast_arc_tan(boss_data->f330->f10[0] - moby->f10[0], - boss_data->f330->f10[1] - moby->f10[1]); + desired_yaw = fast_arc_tan(boss_data->selected_class_247_moby->f10[0] - moby->f10[0], + boss_data->selected_class_247_moby->f10[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); - moby_init_action_mode(boss_data->f330); + moby_init_action_mode(boss_data->selected_class_247_moby); if (advance_drek_boss_planar_position_toward_target( - (char *)moby, frame_time * 12.0f, boss_data->f330->f10) != 0) { + (char *)moby, frame_time * 12.0f, boss_data->selected_class_247_moby->f10) != 0) { int ticks; - switch (boss_data->f34C) { + switch (boss_data->encounter_phase) { case DREK_BOSS_PHASE_FIRST_ARENA_PATH: ticks = scale_game_frames(0xE10); break; @@ -1530,16 +1530,16 @@ void drek_final_boss_robot_update(BossMoby *moby) { ticks = scale_game_frames(600); break; } - request_thruster_pack_lock_red_wait(D_L18_0015FFD8 + boss_data->f21C * 0x100, + request_thruster_pack_lock_red_wait(D_L18_0015FFD8 + boss_data->thruster_lock_moby_index * 0x100, scale_game_frames(ticks)); - boss_data->f354 = 0; - if (boss_data->f34C == 4) { + boss_data->action_event_timer_frames = 0; + if (boss_data->encounter_phase == 4) { moby->f20 = 0x14; } else { moby->f20 = 0xC; } - boss_data->f364 = 1; - boss_data->f34C = boss_data->f34C + 1; + boss_data->hero_follow_action_blocked = 1; + boss_data->encounter_phase = boss_data->encounter_phase + 1; } if (*(int *)&D_L18_00162390 != 0) { moby->f20 = 5; @@ -1552,15 +1552,15 @@ void drek_final_boss_robot_update(BossMoby *moby) { desired_yaw = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); approach_angle(aim, - &boss_data->f370, + &boss_data->yaw_approach_state, desired_yaw, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); update_drek_boss_arena_circling_movement((struct Moby *)moby); - boss_data->f358 = boss_data->f358 + 1; + boss_data->action_frame_counter = boss_data->action_frame_counter + 1; n = scale_game_frames(0x14); - if (boss_data->f358 % n == 0) { + if (boss_data->action_frame_counter % n == 0) { float a = fast_add_rotations(moby->f40[2], random_float_between(-30.0f, 30.0f) * DEG_TO_RAD); @@ -1570,7 +1570,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { position_and_displacement_scratch[2] = random_float_between(3.0f, 8.0f); fast_vec_add(position_and_displacement_scratch, position_and_displacement_scratch, - boss_data->f3C0); + boss_data->unbobbed_boss_position); func_L00_0025F4A8_alt(moby, D_L18_0015F580, position_and_displacement_scratch, @@ -1590,8 +1590,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { -1, 0); } - if (boss_data->f358 == scale_game_frames(0x78)) { - if (moby->f53 != 14) { + if (boss_data->action_frame_counter == scale_game_frames(0x78)) { + if (moby->animation_sequence_index != 14) { blend_moby_animation(moby, 0xE, 5, 1); } position_and_displacement_scratch[0] = fast_cos(moby->f40[2]) * 3.0f; @@ -1599,7 +1599,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { position_and_displacement_scratch[2] = 6.0f; fast_vec_add(position_and_displacement_scratch, position_and_displacement_scratch, - boss_data->f3C0); + boss_data->unbobbed_boss_position); func_L00_0025F4A8_alt(moby, D_L18_0015F580, position_and_displacement_scratch, @@ -1619,51 +1619,51 @@ void drek_final_boss_robot_update(BossMoby *moby) { -1, 0); } - if (moby->f52 == moby->f53 && moby->f52 == 14 && + if (moby->f52 == moby->animation_sequence_index && moby->f52 == 14 && is_value_within_interpolated_window((char *)moby, 30.0f) != 0) { moby->f20 = 0x1B; - end_thruster_pack_lock_red_wait(D_L18_0015FFD8 + boss_data->f21C * 0x100); + end_thruster_pack_lock_red_wait(D_L18_0015FFD8 + boss_data->thruster_lock_moby_index * 0x100); } break; } case DREK_BOSS_RUN_ENDING_SEQUENCE: - moby->f94 = 0; + moby->collision_data = 0; moby->f34 |= 0x41; moby->f34 &= 0xEFFF; - if (boss_data->f34C < 7) { + if (boss_data->encounter_phase < 7) { start_scene(3); - boss_data->f34C = 7; + boss_data->encounter_phase = 7; ((BossShared *)&D_L18_0016D260_c)->f46 = 1; { /* In locals: retail does not load them again after the first copy. */ char *recs = D_L18_001600EC; - int idx = boss_data->f294; + int idx = boss_data->scene_camera_node_index; qcopy(((BossShared *)&D_L18_0016D260_c)->f10, recs + idx * 0x80 + 0x30); qcopy(((BossShared *)&D_L18_0016D260_c)->f20, recs + idx * 0x80 + 0x70); } moby->f20 = 7; - boss_data->f39C = 0x1B; - } else if (boss_data->f34C == 7) { + boss_data->post_scene_resume_state = 0x1B; + } else if (boss_data->encounter_phase == 7) { if (((BossMoby *)hero.ground_moby) != 0 && hero.air_frames.s == 0 && ((BossMoby *)hero.ground_moby)->fA6 == 0x247 && hero.state.current == 0x22) { - if (boss_data->f3AC == 0) { - boss_data->f3AC = 1; + if (boss_data->ending_scene_4_delay_counter == 0) { + boss_data->ending_scene_4_delay_counter = 1; } - } else if (boss_data->f3AC == 0) { - set_thruster_pack_lock_green_list_fields(boss_data->f200); + } else if (boss_data->ending_scene_4_delay_counter == 0) { + set_thruster_pack_lock_green_list_fields(boss_data->class_247_group_index); } - if (boss_data->f3AC != 0) { - int n = boss_data->f3AC++; + if (boss_data->ending_scene_4_delay_counter != 0) { + int n = boss_data->ending_scene_4_delay_counter++; if (scale_game_frames(0x28) < n) { start_scene(4); - boss_data->f34C = 8; + boss_data->encounter_phase = 8; moby->f20 = 7; - boss_data->f39C = 0x1B; + boss_data->post_scene_resume_state = 0x1B; } } - } else if (boss_data->f34C == 8) { + } else if (boss_data->encounter_phase == 8) { *(OvlQuad *)position_and_displacement_scratch = 0; *(OvlQuad *)position_displacement_direction_and_rotation_scratch = 0; position_and_displacement_scratch[0] = 660.6f; @@ -1677,23 +1677,23 @@ void drek_final_boss_robot_update(BossMoby *moby) { 0, 0); start_scene(5); - boss_data->f34C = 9; - } else if (boss_data->f34C == 9 && D_L18_0015F5C4 == 0) { + boss_data->encounter_phase = 9; + } else if (boss_data->encounter_phase == 9 && D_L18_0015F5C4 == 0) { start_slideshow(); - boss_data->f34C = 10; + boss_data->encounter_phase = 10; } else { - int k = boss_data->f34C; + int k = boss_data->encounter_phase; if (k == 10 && D_L18_0015F5C4 == 0) { queue_movie_with_game_language(0xB); - boss_data->f34C = 0xB; + boss_data->encounter_phase = 0xB; } else if (k == 0xB && D_L18_0015F5C4 == 0) { *(int *)&l18_drek_boss_scene_2_started_gp = 0; *(int *)&D_L18_001623A0 = 0; pause_all_sounds(0x21); - mark_moby_for_removal(boss_data->f3A0); - if (boss_data->f3A4 != 0) { - mark_moby_for_removal(boss_data->f3A4); + mark_moby_for_removal(boss_data->boss_joint_glow_attachment_moby); + if (boss_data->big_head_attachment_moby != 0) { + mark_moby_for_removal(boss_data->big_head_attachment_moby); } mark_moby_for_removal(moby); return; @@ -1716,35 +1716,35 @@ void drek_final_boss_robot_update(BossMoby *moby) { 600000.0f, 0.0f); } - if (boss_data->f34C > 1) { + if (boss_data->encounter_phase > 1) { hero.grind_look_moby = (struct Moby *)moby; } - qcopy(moby->f10, boss_data->f3C0); + qcopy(moby->f10, boss_data->unbobbed_boss_position); slow = 0.3f; fast = 0.03f; - boss_data->f3D4 = fast_add_rotations(boss_data->f3D4, frame_time * 3.1415927f); - aas_c(boss_data->f3D0 * fast_sin(boss_data->f3D4) + boss_data->f3D8, + boss_data->bob_cycle_angle = fast_add_rotations(boss_data->bob_cycle_angle, frame_time * 3.1415927f); + aas_c(boss_data->bob_amplitude * fast_sin(boss_data->bob_cycle_angle) + boss_data->bob_target_height_offset, frame_time_sq * 4.0f, frame_time_sq * 4.0f, frame_time * 4.0f, - &boss_data->f3DC, - &boss_data->f3E0); - moby->f10[2] = moby->f10[2] + boss_data->f3DC; - boss_data->f3D8 = 0.0f; + &boss_data->bob_height_displacement, + &boss_data->bob_interpolation_state); + moby->f10[2] = moby->f10[2] + boss_data->bob_height_displacement; + boss_data->bob_target_height_offset = 0.0f; update_joint_animation( (char *)moby, boss_data->fC0, 7, frame_scale_sq * fast, frame_scale_sq * slow); update_joint_animation( - (char *)moby, boss_data->f140, 0x13, frame_scale_sq * fast, frame_scale_sq * slow); - boss_data->f3B4 = fast_add_rotations(boss_data->f3B4, frame_time * 3.4906585f); + (char *)moby, boss_data->joint_19_animation_state, 0x13, frame_scale_sq * fast, frame_scale_sq * slow); + boss_data->tint_cycle_angle = fast_add_rotations(boss_data->tint_cycle_angle, frame_time * 3.4906585f); { - int c = fast_tween_color(0x30C8C8C8, 0x1C393939, fast_sin(boss_data->f3B4) * 0.5f + 0.5f); + int c = fast_tween_color(0x30C8C8C8, 0x1C393939, fast_sin(boss_data->tint_cycle_angle) * 0.5f + 0.5f); int r = c & 0xFF; int g = (c >> 8) & 0xFF; int b = (c >> 16) & 0xFF; int a = (unsigned int)c >> 24; - moby->f90 = c; - boss_data->f3B8 = (a << 24) | ((b / 3) << 16) | (g << 8) | (r / 3); + moby->animated_tint_color = c; + boss_data->green_biased_joint_glow_color = (a << 24) | ((b / 3) << 16) | (g << 8) | (r / 3); } if (moby->f31 != 0) { add_draw_callback((void (*)(void))render_drek_boss_joint_glows, moby); From f4a2db942cd3340e2c901f368950a12772234f46 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:10:30 +0000 Subject: [PATCH 537/758] decomp: clarify names in hero_falling_platform_update unkA2 -> contact_sound_entry_index: Retail 00311bf0 loads pvars into s2. In the hero-contact branch 00311cd8-00311ce0, 00311cfc loads signed halfword pvars+0xA2 into a0; 00311d00-00311d04 skips the call for -1, and 00311d0c-00311d14 passes that index, zero flags and the moby to the checked allocate_voice_for_target_entry call. Authoritative C binds these reads to HeroFallingPlatformVars.unkA2. Supplied allocator source uses entry_index to bounds-check pclass->sound_def_count, select sound_defs+(entry_index<<5), allocate a voice and record slot->entry_index, proving this is the optional sound-definition entry index triggered by hero contact. --- src/overlays/l07/mobys/hero_falling_platform.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l07/mobys/hero_falling_platform.c b/src/overlays/l07/mobys/hero_falling_platform.c index 5bf9303571..be66f4579b 100644 --- a/src/overlays/l07/mobys/hero_falling_platform.c +++ b/src/overlays/l07/mobys/hero_falling_platform.c @@ -39,7 +39,7 @@ typedef struct HeroFallingPlatformVars { f32 unk60[4]; u8 pad_70[0x30]; s16 timer_A0; - s16 unkA2; + s16 contact_sound_entry_index; f32 unkA4; f32 unkA8; f32 unkAC; @@ -81,8 +81,8 @@ void hero_falling_platform_update(char *moby) { moby_data->unkA8 = MOBY(moby)->rot.x; moby_data->unkAC = MOBY(moby)->rot.y; moby_data->timer_A0 = scale_game_frames(0x1E); - if (moby_data->unkA2 != -1) - allocate_voice_for_target_entry(moby_data->unkA2, 0, (int)moby); + if (moby_data->contact_sound_entry_index != -1) + allocate_voice_for_target_entry(moby_data->contact_sound_entry_index, 0, (int)moby); MOBY(moby)->state = LEAF_TIMED_SWAY_AND_DESCENT; } break; From 6b12cf3e6a94092295f139c52708028e9353f61d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:10:33 +0000 Subject: [PATCH 538/758] decomp: clarify names in toxic_gas_vent_update unk64 -> oscillation_amplitude_degrees: Retail 0x002f3c28-0x002f3c50 takes sin of pvars +0x7c, loads the float at +0x64, multiplies it by 0.017453292 (DEG_TO_RAD) and by that sine. 0x002f3c54-0x002f3c68 adds this heading offset to saved heading +0x84 and writes moby rot.z at +0x48. Thus +0x64 is the sine oscillation's heading amplitude in degrees, matching source unk64 * DEG_TO_RAD * fast_sin(unk7C). unk84 -> initial_heading_radians: In oscillating initialization, retail 0x002f3bb8 loads the moby's rot.z at +0x48 and 0x002f3bc0 stores it to pvars +0x84. During oscillation 0x002f3c54 loads that saved float and 0x002f3c5c-0x002f3c68 uses fast_add_rotations to add the sine offset already converted to radians and writes rot.z. Source likewise initializes unk84 from MOBY(vent_moby)->rot.z and uses it as the fixed heading around which the vent oscillates. --- 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 59b435d02b..2c487945f9 100644 --- a/src/overlays/l06/mobys/toxic_gas_vent.c +++ b/src/overlays/l06/mobys/toxic_gas_vent.c @@ -87,7 +87,7 @@ typedef struct ToxicGasVentVars { f32 unk54; u8 pad_58[0x8]; s32 unk60; - f32 unk64; + f32 oscillation_amplitude_degrees; f32 unk68; f32 unk6C; f32 unk70; @@ -95,7 +95,7 @@ typedef struct ToxicGasVentVars { f32 unk78; f32 unk7C; f32 unk80; - f32 unk84; + f32 initial_heading_radians; s32 timer_88; u8 pad_8C[0x4]; s32 clip_volume_90; @@ -129,7 +129,7 @@ void toxic_gas_vent_update(char *vent_moby) { vent_moby[0x20] = 1; vent_data->unk80 = 360.0f / vent_data->unk68 * DEG_TO_RAD * frame_time; vent_data->unk7C = vent_data->unk6C * DEG_TO_RAD; - vent_data->unk84 = MOBY(vent_moby)->rot.z; + vent_data->initial_heading_radians = MOBY(vent_moby)->rot.z; } else { vent_moby[0x20] = 3; vent_data->timer_88 = scale_game_frames( @@ -143,9 +143,9 @@ void toxic_gas_vent_update(char *vent_moby) { } emit_toxic_gas_vent_sparks(vent_moby); check_oscillating_toxic_gas_vent_collisions(vent_moby); - heading_offset_radians = vent_data->unk64 * DEG_TO_RAD * fast_sin(vent_data->unk7C); + heading_offset_radians = vent_data->oscillation_amplitude_degrees * DEG_TO_RAD * fast_sin(vent_data->unk7C); vent_data->unk7C = fast_add_rotations(vent_data->unk7C, vent_data->unk80); - MOBY(vent_moby)->rot.z = fast_add_rotations(vent_data->unk84, heading_offset_radians); + MOBY(vent_moby)->rot.z = fast_add_rotations(vent_data->initial_heading_radians, heading_offset_radians); break; case VENT_TIMED_ACTIVE: if (voice_is_playing(vent_moby, vent_data->voice) == 0) { From 7319f8fe9c0405b99a94a1aa5824796dca0b8a9f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:10:36 +0000 Subject: [PATCH 539/758] decomp: clarify names in follow_camera_setup f2C -> target_orbit_distance: Retail 0x002e6e54 initializes CamB+0x2C to 4.64; 0x002e70c4-0x002e70e4 subtracts the measured orbit remainder length from it. Supplied rebuild_follow_camera_pose uses orbit+0x2C for the behind-target displacement, and collision code normalizes the orbit to this distance minus retraction. This is the target orbit distance. f50 -> orbit_origin_position: Retail 0x002e7050-0x002e7060 subtracts target block s4+0x50 (camera state+0x90) from camera moby position to form the orbit vector. Supplied reset_follow_camera_state_from_position writes state+0x90 as target position plus up-scaled orbit height; endpoint collision code adds the orbit vector to that position. This proves the orbit origin position role. f58 -> default_orbit_distance: Retail 0x002e6e50 seeds CamB+0x58 to 4.64, matching the target distance at +0x2C. Supplied follow_camera_approach explicitly assigns orbit+0x58 from default_orbit+0x2C each reset; rebuild_follow_camera_pose and the collision routines establish +0x2C as orbit distance. This field holds the default orbit distance. i2080 -> followed_hero_moby: Retail 0x002e6db8/0x002e6dbc forms hero address 0x0013F350; 0x002e6de4 loads its +0x2080 and 0x002e6df0 stores it at target+0xC0. Supplied same-label hero declarations identify +0x2080 as hero_moby and use it as the excluded moby in collision queries; rebuild_follow_camera_pose uses target+0xC0 as the followed moby's basis. The field is the followed hero moby. i44 -> orbit_distance_interpolation_state: Retail 0x002e6e78 clears CamB+0x44. In the authoritative follow_camera_approach source, both branches pass camera_state+0x174, exactly orbit+0x44, as the state address to cam_interp_values while storing its returned distance into orbit+0x2C. This proves distance interpolation state without assuming its internal scalar representation. i4C -> consecutive_camera_obstruction_frames: Retail 0x002e6f78 forms the +0x1D0 collision block and 0x002e6f9c clears its +0x4C. In supplied follow_camera_avoid_mobies the identical block's +0x4C increments after a blocking camera line collision survives the volume and hero-state exemptions, triggers init_camera_system at scale_game_frames(0x1E), and resets to zero on clear. This proves the consecutive camera obstruction frame counter. i50 -> orbit_height_interpolation_state: Retail 0x002e6e7c clears CamB+0x50. Both height branches in supplied follow_camera_approach pass orbit+0x50 as the state address to cam_interp_values and store the returned height into orbit+0x30. Retail 0x002e70f0-0x002e70f8 copies that height into camera_height_state+8. This proves orbit height interpolation state. --- .../shared/camera/follow_camera_setup.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 39e7b700b5..9b27b01746 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -608,7 +608,7 @@ typedef struct CamE { typedef struct CamA { float pos[4]; /* 0x00 */ char pad10[0x40]; - float f50[4]; /* 0x50 */ + float orbit_origin_position[4]; /* 0x50 */ char pad60[0x50]; float fB0; /* 0xB0 */ int iB4; /* 0xB4 */ @@ -636,19 +636,19 @@ typedef struct CamB { int i20; /* 0x20 */ int i24; /* 0x24 */ int i28; /* 0x28 */ - float f2C; /* 0x2C */ + float target_orbit_distance; /* 0x2C */ float f30; /* 0x30 */ int i34; /* 0x34 */ int i38; /* 0x38 */ short h3C; /* 0x3C */ short h3E; /* 0x3E */ char pad40[4]; - int i44; /* 0x44 */ + int orbit_distance_interpolation_state; /* 0x44 */ float f48; /* 0x48 */ char pad4C[4]; - int i50; /* 0x50 */ + int orbit_height_interpolation_state; /* 0x50 */ float f54; /* 0x54 */ - float f58; /* 0x58 */ + float default_orbit_distance; /* 0x58 */ char pad5C[4]; } CamB; @@ -687,7 +687,7 @@ typedef struct CamG { float f40; /* 0x40 */ float f44; /* 0x44 */ int i48; /* 0x48 */ - int i4C; /* 0x4C */ + int consecutive_camera_obstruction_frames; /* 0x4C */ } CamG; typedef struct Cam220 { @@ -741,7 +741,7 @@ typedef struct Hero_2E8210 { char pad0[0x30C]; short h30C; /* 0x30C */ char pad30E[0x1D72]; - int i2080; /* 0x2080 */ + int followed_hero_moby; /* 0x2080 */ } Hero_2E8210; extern int D_L00_00161D90 __attribute__((sda)); @@ -781,7 +781,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.i2080; + a->iC0 = D_0013F450_2E8210.followed_hero_moby; a->bC4 = 0; a->bD6 = 0; a->fE0 = 0.2f; @@ -796,11 +796,11 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { a->iBC = 0; b = &camera_moby->cam->b; - b->f2C = 4.64f; + b->target_orbit_distance = 4.64f; b->f48 = 0.003f; b->f54 = 0.003f; b->f30 = 2.0f; - b->f58 = 4.64f; + b->default_orbit_distance = 4.64f; b->i34 = 0; b->i38 = 0; b->i28 = 0; @@ -808,8 +808,8 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { b->i24 = 0; b->h3C = 0; b->h3E = 0; - b->i44 = 0; - b->i50 = 0; + b->orbit_distance_interpolation_state = 0; + b->orbit_height_interpolation_state = 0; camera_state = camera_moby->cam; camera_state->h10 = 1; @@ -855,7 +855,7 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { ((Cam220 *)camera_override_state)->i10 = 0; ((Cam220 *)camera_override_state)->h4 = 0; ((Cam220 *)camera_override_state)->h6 = 0; - ((Cam220 *)camera_override_state)->f8 = b->f2C; + ((Cam220 *)camera_override_state)->f8 = b->target_orbit_distance; ((Cam220 *)camera_override_state)->fC = D_L00_00161D1C_gp; camera_state_base = camera_moby->cam; @@ -865,7 +865,7 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { g->h3A = 0; g->h36 = 0; g->h38 = 0; - g->i4C = 0; + g->consecutive_camera_obstruction_frames = 0; g->h34 = r; g->f44 = l00_follow_camera_collision_probe_step_growth_factor; g->f3C = l00_follow_camera_collision_probe_scale; @@ -891,13 +891,13 @@ void follow_camera_setup(Moby_2E8210 *camera_moby) { follow_camera_reset(camera_moby); rebuild_follow_camera_pose(1); } - fast_vec_sub(b->v0, camera_moby->v30, a->f50); + fast_vec_sub(b->v0, camera_moby->v30, a->orbit_origin_position); qcopy(b->v10, b->v0); qcopy(camera_state->pos, camera_moby->v30); qcopy(g->v20, camera_moby->v30); fast_vec_scale(v0, D_0013F6E0_2E8210, fast_vec_dot(b->v0, D_0013F6E0_2E8210)); fast_vec_sub(orbit_offset_remainder, b->v0, v0); - orbit_distance_shortfall = b->f2C - fast_vec_length(orbit_offset_remainder); + 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; From d2a36a5326d7421e5f67cb799497f35563d88451 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:10:39 +0000 Subject: [PATCH 540/758] decomp: clarify names in set_resort_owner_state unk154 -> horizontal_step_distance: Retail 0x002d20b4 loads moby->pvars into s1. FOLLOW_HERO loads its established speed at 0x002d2148/0x002d216c; FOLLOW_DISTANT_HERO and MOVE_TO_PATH_POINT load their speed at 0x002d217c/0x002d219c. Shared 0x002d21a4..0x002d21b0 multiplies by frame_time and stores the float at pvars+0x154. In the authoritative update_resort_owner_state_actions, this exact ResortOwnerVars member multiplies fast_cos(yaw) and fast_sin(yaw) to form unk130[0] and unk130[1]; apply_resort_owner_movement copies that vector for movement application. Thus this is the horizontal displacement magnitude for a movement step, not an unscaled speed or vertical-motion field. --- src/overlays/l11/mobys/resort_owner.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l11/mobys/resort_owner.c b/src/overlays/l11/mobys/resort_owner.c index b7e9ef71ff..0462b60d4e 100644 --- a/src/overlays/l11/mobys/resort_owner.c +++ b/src/overlays/l11/mobys/resort_owner.c @@ -86,7 +86,7 @@ typedef struct ResortOwnerVars { f32 unk130[4]; f32 unk140[4]; f32 unk150; - f32 unk154; + f32 horizontal_step_distance; u32 current_path_leg; s32 unk15C; } ResortOwnerVars; @@ -185,11 +185,11 @@ void update_resort_owner_state_actions(void *mp) { D_0015ED70 * 12.566371f, D_0015ED70 * 25.132742f, D_0015ED6C * 12.566371f); - pvars->unk130[0] = fast_cos(*(float *)(yaw_ptr)) * pvars->unk154; + pvars->unk130[0] = fast_cos(*(float *)(yaw_ptr)) * pvars->horizontal_step_distance; motion_scalar = fast_sin(*(float *)(yaw_ptr)); vertical_motion = pvars->unk140[2]; vertical_motion_decrement = D_0015ED70 * 20.0f; - horizontal_speed = pvars->unk154; + horizontal_speed = pvars->horizontal_step_distance; pvars->unk130[1] = motion_scalar * horizontal_speed; vertical_motion = vertical_motion - vertical_motion_decrement; pvars->unk130[2] = vertical_motion; @@ -199,7 +199,7 @@ void update_resort_owner_state_actions(void *mp) { * deletes, but it keeps f3 live into this branch, so the * first scheduling pass hoists the 0x154 load and the * allocator gives it $f4 as in retail. */ - pvars->unk154 = horizontal_speed; + pvars->horizontal_step_distance = horizontal_speed; } break; } @@ -621,13 +621,13 @@ void set_resort_owner_state(struct Moby *moby, unsigned char state) { case RESORT_OWNER_FOLLOW_HERO: if (moby->prev_seq != 2) FUN_00212f90(moby, 2, 0, scale_game_frames(0x14)); - moby_vars->unk154 = resort_owner_follow_hero_speed_gp * frame_time; + moby_vars->horizontal_step_distance = resort_owner_follow_hero_speed_gp * frame_time; break; case RESORT_OWNER_FOLLOW_DISTANT_HERO: case RESORT_OWNER_MOVE_TO_PATH_POINT: if (moby->prev_seq != 3) FUN_00212f90(moby, 3, 0, scale_game_frames(0x14)); - moby_vars->unk154 = resort_owner_distant_follow_and_path_speed_gp * frame_time; + moby_vars->horizontal_step_distance = resort_owner_distant_follow_and_path_speed_gp * frame_time; break; case RESORT_OWNER_JUMP_TO_TARGET: if (moby->prev_seq != 4) From b436487832bcc179acb8c6f6f71208995437e0b5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:12:24 +0000 Subject: [PATCH 541/758] decomp: clarify names in linked_moby_hitbox_update unk16 -> target_state_on_activation: Retail 0x002c9ca8 loads s2 from owner pvars and 0x002c9cac-0x002c9cc4 resolves target s0 from pvars+0x10 through the moby array. In WAIT_FOR_LINKED_MOBIES, 0x002c9f48 requires zero unmet linked conditions; 0x002c9f50-0x002c9f64 checks target exists, loads signed pvars+0x16, skips sentinel -1, then copies its byte to target+0x20 (Moby.state). The source unk16 thus configures the target state assigned on hitbox activation, immediately before timer initialization and owner transition to WAIT_FOR_TARGET_STATE_OR_TIMER. unk17 -> target_state_for_hitbox_removal: Retail 0x002c9fbc-0x002c9fec checks flag 4 is clear and target s0 exists, loads signed pvars+0x17, rejects sentinel -1, and compares it with the target Moby.state byte at s0+0x20. Equality stores 3 to owner s3+0x20, the established LINKED_HITBOX_STATE_REMOVE branch at 0x002ca028-0x002ca04c. Source unk17 is therefore the configured target-state condition for hitbox removal, distinct from the target state assigned from unk16. --- 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 de6a64904a..ae004dff78 100644 --- a/src/overlays/l10/mobys/linked_moby_hitbox.c +++ b/src/overlays/l10/mobys/linked_moby_hitbox.c @@ -136,8 +136,8 @@ typedef struct LinkedMobyHitboxVars { s32 unkC; s32 unk10; s16 unk14; - s8 unk16; - s8 unk17; + s8 target_state_on_activation; + s8 target_state_for_hitbox_removal; s32 unk18; u8 pad_1C[0x24]; s32 unk40; @@ -238,8 +238,8 @@ void linked_moby_hitbox_update(struct Moby *moby) { break; case LINKED_HITBOX_STATE_WAIT_FOR_LINKED_MOBIES: if (differences == 0) { - if (target != 0 && linked_hitbox_vars->unk16 != -1) - target->state = *(unsigned char *)&linked_hitbox_vars->unk16; + if (target != 0 && linked_hitbox_vars->target_state_on_activation != -1) + target->state = *(unsigned char *)&linked_hitbox_vars->target_state_on_activation; linked_hitbox_vars->unk40 = linked_hitbox_vars->unkC; moby->state = LINKED_HITBOX_STATE_WAIT_FOR_TARGET_STATE_OR_TIMER; } @@ -253,8 +253,8 @@ void linked_moby_hitbox_update(struct Moby *moby) { target->alpha = FUN_001fa6d0_2c9c70(linked_hitbox_vars->unk44 * now / initial); } } - if ((linked_hitbox_vars->unk8 & 4) == 0 && target != 0 && linked_hitbox_vars->unk17 != -1 && - target->state == linked_hitbox_vars->unk17) + if ((linked_hitbox_vars->unk8 & 4) == 0 && target != 0 && linked_hitbox_vars->target_state_for_hitbox_removal != -1 && + target->state == linked_hitbox_vars->target_state_for_hitbox_removal) moby->state = LINKED_HITBOX_STATE_REMOVE; if ((linked_hitbox_vars->unk8 & 8) == 0 && FUN_001f9740_2c9c70(&linked_hitbox_vars->unk40) != 0) From 90df4f5ed5ce4300da43789fd28893e5c24aa413 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:14:13 +0000 Subject: [PATCH 542/758] decomp: clarify names in height_adjusted_projectile_update unk12 -> height_adjustment_mode: Retail 002d7bb8 loads the projectile private-variable block from moby+0x78 into s3; 002d7be4 reads signed halfword s3+0x12, and 002d7be8..002d7c08 dispatches on it. The original decompilation switches on puVar2+0x12. Branch 1 at 002d7c10..002d7c18 passes pvars+0x1c as target height to approach_moby_height; branch 2 at 002d7c24..002d7cb4 derives a collision-relative height or current z-0.1; branch 3 at 002d7cc0..002d7cdc uses selected-position z plus the offset. The authoritative C directly switches on projectile_vars->unk12 with established HEIGHT_MODE_* members. These uses prove that this s16 selects the projectile's height adjustment mode, without requiring a distinct meaning for case 4. --- src/overlays/l10/mobys/height_adjusted_projectile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l10/mobys/height_adjusted_projectile.c b/src/overlays/l10/mobys/height_adjusted_projectile.c index 101c57879e..4719c0280f 100644 --- a/src/overlays/l10/mobys/height_adjusted_projectile.c +++ b/src/overlays/l10/mobys/height_adjusted_projectile.c @@ -47,7 +47,7 @@ typedef struct HeightAdjustedProjectileVars { u8 pad_0[0x10]; u8 timer_10; u8 pad_11[0x1]; - s16 unk12; + s16 height_adjustment_mode; char *unk14; f32 unk18; f32 unk1C; @@ -74,7 +74,7 @@ void height_adjusted_projectile_update(struct Moby *moby) { qcopy(movement_start_position, &moby->pos); fast_vec_add(&moby->pos, &moby->pos, projectile_vars); find_point_ahead(20.0f, moby, found); - switch (projectile_vars->unk12) { + switch (projectile_vars->height_adjustment_mode) { case HEIGHT_MODE_SKIP_ADJUSTMENT: break; case HEIGHT_MODE_APPROACH_FIXED_HEIGHT: From c85235134ec013b9da00ea3b95ec227e0847f02c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:14:16 +0000 Subject: [PATCH 543/758] decomp: clarify names in draw_blarg_heavy_interceptor_camera_facing_glow unk202 -> red_light_tint_enabled: Retail 0x002ae1bc loads the signed halfword at pvars+0x202; 0x002ae1c0-0x002ae1d4 selects 0x7F40407F when nonzero versus 0x7F7F7F7F when zero, and 0x002ae1d8-0x002ae1e4 copies that tint to all four glow vertices. Original Ghidra shows the same short test and colors. The authoritative C light-ring draw uses this same member to select vertex colors masked with 0xFF0000FF, retaining alpha/red and clearing green/blue; the camera-pulled glow also chooses 0x7F40407F when nonzero. Source channel packing explicitly places red in the low byte. These uses prove red_light_tint_enabled rather than merely an offset-based role. --- src/overlays/l14/mobys/blarg_heavy_interceptor.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 7560534317..7b396893c6 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -249,7 +249,7 @@ typedef struct BlargHeavyInterceptorVars { f32 unk1F8; f32 yaw_drift; s16 unk200; - s16 unk202; + s16 red_light_tint_enabled; s32 patrol_path; s16 return_path_complete; s16 group_member_count; @@ -364,7 +364,7 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { moby_vars->timer_1F2 = scale_game_frames(blarg_heavy_interceptor_target_tracking_duration_frames_gp); } - moby_vars->unk202 = 0; + moby_vars->red_light_tint_enabled = 0; moby_vars->unk200 = 1; found = 0; hit = update_blarg_heavy_interceptor_aim_transforms(moby, 1); @@ -416,7 +416,7 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { blarg_heavy_interceptor_tracking_and_group_wait_glow_red_gp; if (*(struct Moby **)(&moby_vars->unk180[3]) != 0) { moby_vars->unk200 = 1; - moby_vars->unk202 = 1; + moby_vars->red_light_tint_enabled = 1; update_blarg_heavy_interceptor_aim_transforms(moby, 1); qcopy(vector_scratch, &(*(struct Moby **)(&moby_vars->unk180[3]))->pos); vector_scratch[2] += 0.5f; @@ -1105,11 +1105,11 @@ void draw_blarg_heavy_interceptor_light_ring(char *moby) { o[0] = ring_vertex_scratch[0]; o[1] = ring_vertex_scratch[1]; o[2] = ring_vertex_scratch[2]; - if (moby_vars->unk202 != 0) { + if (moby_vars->red_light_tint_enabled != 0) { cols[i] = blarg_heavy_interceptor_light_ring_vertex_colors[i] & 0xFF0000FF; } } - if (moby_vars->unk202 != 0) { + if (moby_vars->red_light_tint_enabled != 0) { FUN_L00_001fde98(blarg_heavy_interceptor_light_ring_vertex_count_gp, f.verts, cols, @@ -1136,7 +1136,7 @@ void draw_blarg_heavy_interceptor_light_ring(char *moby) { o[1] = ring_vertex_scratch[1]; o[2] = ring_vertex_scratch[2]; } - if (moby_vars->unk202 != 0) { + if (moby_vars->red_light_tint_enabled != 0) { FUN_L00_001fde98(blarg_heavy_interceptor_light_ring_vertex_count_gp, f.verts, cols, @@ -1360,7 +1360,7 @@ void draw_blarg_heavy_interceptor_camera_facing_glow(struct Moby *m) { pk.uv[5] = 0.0f; pk.uv[6] = 0.0f; pk.uv[7] = 0.0f; - if (d->unk202 != 0) { + if (d->red_light_tint_enabled != 0) { col = 0x7F40407F; pk.col[3] = col; pk.col[2] = col; @@ -1451,7 +1451,7 @@ void draw_blarg_heavy_interceptor_camera_pulled_glow(struct Moby *m) { pk.uv[5] = 0.0f; pk.uv[6] = 0.0f; pk.uv[7] = 0.0f; - if (d->unk202 != 0) { + if (d->red_light_tint_enabled != 0) { col = 0x7F40407F; pk.col[3] = col; pk.col[2] = col; From 17bf4aba4c1060d9f8bad128f603aee92e84f5ea Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:16:43 +0000 Subject: [PATCH 544/758] decomp: clarify names in process_plasmabot_hit_reaction unk26 -> stagger_reaction_duration_frames: Authoritative plasmabot.c SHA-256 720fba1f479460e6652f8932ef6ad8d52db8a76cd0d9a2daa338d0b162daf5d6 declares PlasmabotVars.unk26 as s16 and assigns it stagger_duration_frames = scale_game_frames(0x3C) in the nonterminal stagger branch. Retail 0x002b2f88 loads pvars into s1; 0x002b30a4 loads 60, 0x002b30a8 calls the frame-scaling helper, and 0x002b30dc stores its return with sh v0,0x26(s1). Original Ghidra confirms uVar5=func_0x002124c0(0x3c) followed by the halfword store to pvars+0x26. The same branch sets moby state 10 at 0x002b30ac and selects reaction animation 7 at 0x002b3108; supplied plasmabot_update resumes aim after that reaction. This proves the field stores the stagger reaction duration in scaled frames, without asserting its downstream consumption. --- src/overlays/shared/enemies/plasmabot.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index 2a215cfb64..930e5cb077 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -58,7 +58,7 @@ typedef struct PlasmabotVars { u8 pad0[0x20]; f32 health; s16 unk24; - s16 unk26; + s16 stagger_reaction_duration_frames; s8 unk28; s8 unk29; u8 pad2A[0x6]; @@ -1136,7 +1136,7 @@ void process_plasmabot_hit_reaction(struct Moby *moby) { frame_duration = frame_time; stagger_motion_z = plasmabot_stagger_motion_z_scale_gp * frame_duration; k = frame_duration * 8.0f; - state->unk26 = stagger_duration_frames; + state->stagger_reaction_duration_frames = stagger_duration_frames; state->unk78 = k; state->unk7C = stagger_motion_z; state->unkB0 = 11.0f; From 7bf79257c14bbc0a034d6c22a8d3183c0c643ee4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:18:42 +0000 Subject: [PATCH 545/758] decomp: clarify names in sentrybot_update domain_0_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: 0x00297d30-0x00297d8c: inequality initiates command-driven emission wait or the first alert transition; equality allows patrol/attention behavior. The selector is the s32 target_mode at pvars+0x114 loaded through s3, whose pvars origin is established at 0x00297a1c, distinct from moby current-state byte +0x20 and hero selector domains. Authoritative C already names this exact target_mode value in the alert-idle branch SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION. Original retail Ghidra and instructions agree; reuse that canonical local member, without claiming that alert-timer paths cannot emit. domain_1_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: 0x0029801c-0x002980c4: inequality redirects attention-animation completion toward emission, while equality permits patrol idle. The selector is the s32 target_mode at pvars+0x114 loaded through s3, whose pvars origin is established at 0x00297a1c, distinct from moby current-state byte +0x20 and hero selector domains. Authoritative C already names this exact target_mode value in the alert-idle branch SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION. Original retail Ghidra and instructions agree; reuse that canonical local member, without claiming that alert-timer paths cannot emit. domain_2_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: 0x00298190-0x00298234: inequality permits interrupting a turn with emission when the remembered target heading is close. The selector is the s32 target_mode at pvars+0x114 loaded through s3, whose pvars origin is established at 0x00297a1c, distinct from moby current-state byte +0x20 and hero selector domains. Authoritative C already names this exact target_mode value in the alert-idle branch SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION. Original retail Ghidra and instructions agree; reuse that canonical local member, without claiming that alert-timer paths cannot emit. domain_3_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: 0x002983ec-0x00298448: inequality interrupts patrol movement toward emission or its preceding transition. The selector is the s32 target_mode at pvars+0x114 loaded through s3, whose pvars origin is established at 0x00297a1c, distinct from moby current-state byte +0x20 and hero selector domains. Authoritative C already names this exact target_mode value in the alert-idle branch SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION. Original retail Ghidra and instructions agree; reuse that canonical local member, without claiming that alert-timer paths cannot emit. domain_4_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: 0x00298628-0x00298694: inequality, additionally gated by engagement suppression, redirects fast patrol toward emission. The selector is the s32 target_mode at pvars+0x114 loaded through s3, whose pvars origin is established at 0x00297a1c, distinct from moby current-state byte +0x20 and hero selector domains. Authoritative C already names this exact target_mode value in the alert-idle branch SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION. Original retail Ghidra and instructions agree; reuse that canonical local member, without claiming that alert-timer paths cannot emit. domain_5_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: 0x00298e90-0x00298eac: equality ends positive-joint emission in alert idle instead of requesting negative-joint emission. The selector is the s32 target_mode at pvars+0x114 loaded through s3, whose pvars origin is established at 0x00297a1c, distinct from moby current-state byte +0x20 and hero selector domains. Authoritative C already names this exact target_mode value in the alert-idle branch SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION. Original retail Ghidra and instructions agree; reuse that canonical local member, without claiming that alert-timer paths cannot emit. domain_6_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: 0x00299150-0x002991a0: equality ends negative-joint emission in alert idle instead of requesting positive-joint emission. The selector is the s32 target_mode at pvars+0x114 loaded through s3, whose pvars origin is established at 0x00297a1c, distinct from moby current-state byte +0x20 and hero selector domains. Authoritative C already names this exact target_mode value in the alert-idle branch SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION. Original retail Ghidra and instructions agree; reuse that canonical local member, without claiming that alert-timer paths cannot emit. domain_7_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: 0x00299674-0x00299698: with no alert timer, inequality produces alert level 2; equality uses the detected-without-engagement flag. The selector is the s32 target_mode at pvars+0x114 loaded through s3, whose pvars origin is established at 0x00297a1c, distinct from moby current-state byte +0x20 and hero selector domains. Authoritative C already names this exact target_mode value in the alert-idle branch SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION. Original retail Ghidra and instructions agree; reuse that canonical local member, without claiming that alert-timer paths cannot emit. unk148 -> patrol_pause_duration_frames: Retail 0x00297c54-0x00297c68 clamps the signed field at pvars+0x148 to at least 5. At 0x00297ed0-0x00297ee4 it is passed to scale_game_frames, stored in pvars+0x14c, and state becomes SENTRYBOT_PATROL_PAUSE. Source and original Ghidra agree: this is the configured patrol pause duration before frame scaling. unk14C -> patrol_pause_timer: Retail 0x00297ed0-0x00297ee4 stores the scaled pause duration at pvars+0x14c and enters patrol-pause state 3. At 0x00297f88-0x00298010 fast_dec_timer consumes this same field and gates selecting the next patrol point and moving state 4. Other branches rearm it with scaled 60 at 0x00298470-0x00298478, 0x002986a0-0x002986ac and 0x00299390-0x00299398; source and original Ghidra agree. unk154 -> linked_moby_deactivation_cooldown: Retail 0x00297b74-0x00297b78 decrements the s16 field at pvars+0x154 each update. State 5 completion stores scale_game_frames(240) there at 0x002980d4-0x002980e8 while deactivating linked mobys. When linked indices are absent, zero tests at 0x00297f18-0x00297f2c and 0x002984f8-0x0029851c gate reentering that animation/deactivation state. Thus this is its cooldown; source and original Ghidra agree. unk15F -> command_alert_transition_started: Retail 0x00297bc4-0x00297bcc clears pvars+0x15f when moby command is zero. At 0x00297d40-0x00297d8c a command-driven response tests the byte: zero sets it to one and enters transition state 11 with animation 1, whereas nonzero enters emission-wait state 16 directly. Fast-patrol response 0x0029939c-0x0029941c uses the same latch to skip repeating that transition. Source and original Ghidra prove a transition-start latch retained during the command, not proof that the animation completed. unk196 -> attention_scan_timer: Retail 0x002980b4-0x002980bc stores scale_game_frames(360) in s16 pvars+0x196 after attention-facing animation completion returns to patrol idle. At 0x00297e50-0x00297e6c and 0x00298544-0x00298560 the timer helper consumes this field and its return gates find_sentrybot_attention_target and storing attention_target. This proves the attention scan timer role without asserting the helper's exact expiry convention; source and original Ghidra agree. unk19E -> projectile_emitted_this_animation: Retail 0x00298b54-0x00298b5c and 0x00298bdc-0x00298be4 clear pvars+0x19e when entering emission states 19/17. Zero tests at 0x00298c1c-0x00298c28 and 0x00298ed8-0x00298ee4 gate frame-window projectile spawning; the branches call spawn_sentrybot_projectile then set the byte to one at 0x00298dac and 0x0029906c. Animation completion clears it again. Source and original Ghidra prove the per-animation emission latch. --- src/overlays/shared/enemies/sentrybot.c | 112 ++++++++++++------------ 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index e6447d6ab9..fc9a113051 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -113,10 +113,10 @@ typedef struct SentrybotVars { s32 patrol_point; /* 0x13C */ u8 pad140[4]; s32 unk144; - s32 unk148; - s32 unk14C; + s32 patrol_pause_duration_frames; + s32 patrol_pause_timer; s32 unk150; - s16 unk154; + s16 linked_moby_deactivation_cooldown; s16 alert_timer; /* 0x156: set by alert_visible_group_sentrybots */ s16 target_detected_without_engagement; u8 has_line_of_sight; /* 0x15A: to the hero */ @@ -124,7 +124,7 @@ typedef struct SentrybotVars { u8 unk15C; u8 pending_animation; u8 unk15E; - u8 unk15F; + u8 command_alert_transition_started; f32 home_pos[3]; /* 0x160: position at spawn */ f32 home_yaw; /* 0x16C */ f32 turn_start_yaw; @@ -134,10 +134,10 @@ typedef struct SentrybotVars { s32 linked_moby[4]; /* 0x180: moby indexes, -1: none */ char *attention_target; /* 0x190 */ s16 priority_attention_active; - s16 unk196; + s16 attention_scan_timer; char *attention_source; /* 0x198: set_sentrybot_attention_target */ s16 attention_timer; /* 0x19C */ - u8 unk19E; + u8 projectile_emitted_this_animation; u8 target_in_view; SentrybotJoint joints[2]; /* 0x1A0 */ f32 effect_quad_pos[3][4]; /* 0x2A0: draw_sentrybot_effect_quads */ @@ -337,7 +337,7 @@ void sentrybot_update(unsigned char *moby) { } if (hero.state.current == 0x65) sentrybot_instance_data->alert_timer = 0; - fast_dec_timer_s16(&sentrybot_instance_data->unk154); + fast_dec_timer_s16(&sentrybot_instance_data->linked_moby_deactivation_cooldown); fast_dec_timer_s16(&sentrybot_instance_data->alert_timer); fast_dec_timer_s16(&sentrybot_instance_data->attention_timer); if (sentrybot_instance_data->alert_timer != 0 && @@ -348,7 +348,7 @@ void sentrybot_update(unsigned char *moby) { set_sentrybot_alarm_duration(linked_alarm_moby, 0xB4); } if (MOBY(moby)->command == 0) - sentrybot_instance_data->unk15F = 0; + sentrybot_instance_data->command_alert_transition_started = 0; switch (MOBY(moby)->state) { case SENTRYBOT_INITIALIZE: if (sentrybot_instance_data->path_index == -1 || @@ -362,8 +362,8 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk29 = 0; qcopy(&sentrybot_instance_data->home_pos, &MOBY(moby)->pos); sentrybot_instance_data->home_yaw = MOBY(moby)->rot.z; - if (sentrybot_instance_data->unk148 < 5) - sentrybot_instance_data->unk148 = 5; + if (sentrybot_instance_data->patrol_pause_duration_frames < 5) + sentrybot_instance_data->patrol_pause_duration_frames = 5; sentrybot_instance_data->unk144 = 1; MOBY(moby)->state = SENTRYBOT_PATROL_IDLE; MOBY(moby)->flags |= 0x1000; @@ -391,14 +391,14 @@ void sentrybot_update(unsigned char *moby) { } case SENTRYBOT_PATROL_IDLE: case SENTRYBOT_PATROL_PAUSE: - if (sentrybot_instance_data->target_mode != 2) { + if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { MOBY(moby)->command = 1; - if (sentrybot_instance_data->unk15F != 0) { + if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, scale_game_frames(10)); } else { - sentrybot_instance_data->unk15F = 1; + sentrybot_instance_data->command_alert_transition_started = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; sentrybot_instance_data->pending_animation = 3; @@ -422,12 +422,12 @@ void sentrybot_update(unsigned char *moby) { } sentrybot_instance_data->unk144 = 0; MOBY(moby)->command = 1; - if (sentrybot_instance_data->unk15F != 0) { + if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_PATROL_MOVE_FAST; if (MOBY(moby)->prev_seq != 0xE) blend_moby_animation(moby, 0xE, 0, scale_game_frames(10)); } else { - sentrybot_instance_data->unk15F = 1; + sentrybot_instance_data->command_alert_transition_started = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0xD; sentrybot_instance_data->pending_animation = 0xE; @@ -442,7 +442,7 @@ void sentrybot_update(unsigned char *moby) { (float *)(sentrybot_instance_data->attention_source + 0x10), (void *)0xA, (void *)0xF); - } else if (fast_dec_timer_s16(&sentrybot_instance_data->unk196) != 0 && + } else if (fast_dec_timer_s16(&sentrybot_instance_data->attention_scan_timer) != 0 && (*(int *)&sentrybot_instance_data->attention_target = find_sentrybot_attention_target((char *)moby)) != 0 && (sentrybot_instance_data->priority_attention_active != 0 || @@ -457,14 +457,14 @@ void sentrybot_update(unsigned char *moby) { if (sentrybot_instance_data->unk124 != -1) { if (sentrybot_instance_data->unk144 == 0 || can_sentrybot_advance_patrol(moby) != 0) { - sentrybot_instance_data->unk14C = - scale_game_frames(sentrybot_instance_data->unk148); + sentrybot_instance_data->patrol_pause_timer = + scale_game_frames(sentrybot_instance_data->patrol_pause_duration_frames); MOBY(moby)->state = SENTRYBOT_PATROL_PAUSE; } } else if (sentrybot_instance_data->target_detected_without_engagement != 0 && hero.state.current == 0x59) { if (sentrybot_instance_data->unk150 != -1 || sentrybot_instance_data->sight_line_ignored_moby_index != -1 || - (sentrybot_instance_data->unk154 == 0 && random_integer_below(0x78) == 0)) { + (sentrybot_instance_data->linked_moby_deactivation_cooldown == 0 && random_integer_below(0x78) == 0)) { sentrybot_instance_data->pending_animation = 0; sentrybot_instance_data->unk15C = 2; MOBY(moby)->state = SENTRYBOT_DEACTIVATE_LINKED_MOBYS_AFTER_ANIMATION; @@ -476,7 +476,7 @@ void sentrybot_update(unsigned char *moby) { moby, sentrybot_instance_data, 2, 0, sentrybot_instance_data->home_yaw); } } else if (MOBY(moby)->state == SENTRYBOT_PATROL_PAUSE) { - if (fast_dec_timer(&sentrybot_instance_data->unk14C) != 0) { + if (fast_dec_timer(&sentrybot_instance_data->patrol_pause_timer) != 0) { if (sentrybot_instance_data->unk144 != 0) { sentrybot_instance_data->patrol_point = (sentrybot_instance_data->patrol_point + 1) % @@ -494,14 +494,14 @@ void sentrybot_update(unsigned char *moby) { } break; case SENTRYBOT_WAIT_FOR_ANIMATION_THEN_PATROL_IDLE: - if (sentrybot_instance_data->target_mode != 2) { + if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { MOBY(moby)->command = 1; - if (sentrybot_instance_data->unk15F != 0) { + if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, scale_game_frames(10)); } else { - sentrybot_instance_data->unk15F = 1; + sentrybot_instance_data->command_alert_transition_started = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; sentrybot_instance_data->pending_animation = 3; @@ -512,13 +512,13 @@ void sentrybot_update(unsigned char *moby) { MOBY(moby)->state = SENTRYBOT_PATROL_IDLE; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); - sentrybot_instance_data->unk196 = scale_game_frames(0x168); + sentrybot_instance_data->attention_scan_timer = scale_game_frames(0x168); sentrybot_instance_data->priority_attention_active = 0; } break; case SENTRYBOT_DEACTIVATE_LINKED_MOBYS_AFTER_ANIMATION: if (MOBY(moby)->anim_flags & 2) { - sentrybot_instance_data->unk154 = scale_game_frames(0xF0); + sentrybot_instance_data->linked_moby_deactivation_cooldown = scale_game_frames(0xF0); if (sentrybot_instance_data->unk150 != -1) { mark_moby_killed_and_release_owned_voice((int)l15_moby_array + (sentrybot_instance_data->unk150 << 8)); @@ -545,18 +545,18 @@ void sentrybot_update(unsigned char *moby) { case SENTRYBOT_TURN_NEGATIVE_HEADING_DELTA: case SENTRYBOT_TURN_POSITIVE_HEADING_DELTA: case SENTRYBOT_TURN_AROUND: - if (sentrybot_instance_data->target_mode != 2 && + if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && fast_difference_between_rotations( MOBY(moby)->rot.z, fast_arc_tan(sentrybot_instance_data->unkD0[0] - MOBY(moby)->pos.x, sentrybot_instance_data->unkD0[1] - MOBY(moby)->pos.y)) < 0.5235988f) { MOBY(moby)->command = 1; - if (sentrybot_instance_data->unk15F != 0) { + if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, scale_game_frames(10)); } else { - sentrybot_instance_data->unk15F = 1; + sentrybot_instance_data->command_alert_transition_started = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; sentrybot_instance_data->pending_animation = 3; @@ -612,14 +612,14 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk144 = 1; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); - } else if (sentrybot_instance_data->target_mode != 2) { + } else if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { MOBY(moby)->command = 1; - if (sentrybot_instance_data->unk15F != 0) { + if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, scale_game_frames(10)); } else { - sentrybot_instance_data->unk15F = 1; + sentrybot_instance_data->command_alert_transition_started = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; sentrybot_instance_data->pending_animation = 3; @@ -635,14 +635,14 @@ void sentrybot_update(unsigned char *moby) { (void *)0x10, (void *)3); } else { - sentrybot_instance_data->unk14C = scale_game_frames(0x3C); + sentrybot_instance_data->patrol_pause_timer = scale_game_frames(0x3C); MOBY(moby)->command = 1; - if (sentrybot_instance_data->unk15F != 0) { + if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_PATROL_MOVE_FAST; if (MOBY(moby)->prev_seq != 0xE) blend_moby_animation(moby, 0xE, 0, scale_game_frames(10)); } else { - sentrybot_instance_data->unk15F = 1; + sentrybot_instance_data->command_alert_transition_started = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0xD; sentrybot_instance_data->pending_animation = 0xE; @@ -659,14 +659,14 @@ void sentrybot_update(unsigned char *moby) { (void *)0xF); } else if (sentrybot_instance_data->target_detected_without_engagement != 0 && hero.state.current == 0x59) { if (sentrybot_instance_data->unk150 != -1 || sentrybot_instance_data->sight_line_ignored_moby_index != -1 || - sentrybot_instance_data->unk154 == 0) { + sentrybot_instance_data->linked_moby_deactivation_cooldown == 0) { sentrybot_instance_data->unk15C = MOBY(moby)->state; sentrybot_instance_data->pending_animation = 0xD; MOBY(moby)->state = SENTRYBOT_DEACTIVATE_LINKED_MOBYS_AFTER_ANIMATION; if (MOBY(moby)->prev_seq != 2) blend_moby_animation(moby, 2, 0, scale_game_frames(10)); } - } else if (fast_dec_timer_s16(&sentrybot_instance_data->unk196) != 0 && + } else if (fast_dec_timer_s16(&sentrybot_instance_data->attention_scan_timer) != 0 && (*(int *)&sentrybot_instance_data->attention_target = find_sentrybot_attention_target((char *)moby)) != 0 && (sentrybot_instance_data->priority_attention_active != 0 || @@ -691,14 +691,14 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk144 = 1; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); - } else if (sentrybot_instance_data->target_mode != 2 && sentrybot_instance_data->alert_engagement_suppressed == 0) { + } else if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && sentrybot_instance_data->alert_engagement_suppressed == 0) { MOBY(moby)->command = 1; - if (sentrybot_instance_data->unk15F != 0) { + if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, scale_game_frames(10)); } else { - sentrybot_instance_data->unk15F = 1; + sentrybot_instance_data->command_alert_transition_started = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; sentrybot_instance_data->pending_animation = 3; @@ -706,7 +706,7 @@ void sentrybot_update(unsigned char *moby) { blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } } else if (sentrybot_instance_data->alert_timer != 0) { - sentrybot_instance_data->unk14C = scale_game_frames(0x3C); + sentrybot_instance_data->patrol_pause_timer = scale_game_frames(0x3C); } else { MOBY(moby)->state = SENTRYBOT_RETURN_HOME; if (MOBY(moby)->prev_seq != 0xD) @@ -862,7 +862,7 @@ void sentrybot_update(unsigned char *moby) { blend_moby_animation(moby, 0, 0, scale_game_frames(10)); } else { MOBY(moby)->state = SENTRYBOT_EMIT_WITH_POSITIVE_JOINT_AIM; - sentrybot_instance_data->unk19E = 0; + sentrybot_instance_data->projectile_emitted_this_animation = 0; if (MOBY(moby)->prev_seq != 6) blend_moby_animation(moby, 6, 0, scale_game_frames(10)); } @@ -879,7 +879,7 @@ void sentrybot_update(unsigned char *moby) { blend_moby_animation(moby, 0, 0, scale_game_frames(10)); } else { MOBY(moby)->state = SENTRYBOT_EMIT_WITH_NEGATIVE_JOINT_AIM; - sentrybot_instance_data->unk19E = 0; + sentrybot_instance_data->projectile_emitted_this_animation = 0; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(10)); } @@ -889,7 +889,7 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->attention_timer = 0; sentrybot_instance_data->priority_attention_active = 0; alert_visible_group_sentrybots(moby); - if (sentrybot_instance_data->unk19E == 0) { + if (sentrybot_instance_data->projectile_emitted_this_animation == 0) { float t = compute_interpolated_record_value(moby); if (t >= 0.85f && t < 3.0f) { j2 = 2; @@ -915,7 +915,7 @@ void sentrybot_update(unsigned char *moby) { (char *)emission_origin, (char *)(&sentrybot_instance_data->unk100)); } - sentrybot_instance_data->unk19E = 1; + sentrybot_instance_data->projectile_emitted_this_animation = 1; } } if (MOBY(moby)->anim_flags & 2) { @@ -943,7 +943,7 @@ void sentrybot_update(unsigned char *moby) { (float *)(&sentrybot_instance_data->unkD0), (void *)0x10, (void *)3); - } else if (sentrybot_instance_data->target_mode == 2) { + } else if (sentrybot_instance_data->target_mode == SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { MOBY(moby)->state = SENTRYBOT_ALERT_IDLE; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); @@ -952,14 +952,14 @@ void sentrybot_update(unsigned char *moby) { if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, scale_game_frames(10)); } - sentrybot_instance_data->unk19E = 0; + sentrybot_instance_data->projectile_emitted_this_animation = 0; } break; case SENTRYBOT_EMIT_WITH_NEGATIVE_JOINT_AIM: sentrybot_instance_data->attention_timer = 0; sentrybot_instance_data->priority_attention_active = 0; alert_visible_group_sentrybots(moby); - if (sentrybot_instance_data->unk19E == 0) { + if (sentrybot_instance_data->projectile_emitted_this_animation == 0) { float t = compute_interpolated_record_value(moby); if (t >= 0.85f && t < 3.0f) { j3 = 3; @@ -985,7 +985,7 @@ void sentrybot_update(unsigned char *moby) { (char *)emission_origin, (char *)(&sentrybot_instance_data->unk100)); } - sentrybot_instance_data->unk19E = 1; + sentrybot_instance_data->projectile_emitted_this_animation = 1; } } if (MOBY(moby)->anim_flags & 2) { @@ -1013,7 +1013,7 @@ void sentrybot_update(unsigned char *moby) { (float *)(&sentrybot_instance_data->unkD0), (void *)0x12, (void *)5); - } else if (sentrybot_instance_data->target_mode == 2) { + } else if (sentrybot_instance_data->target_mode == SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { MOBY(moby)->state = SENTRYBOT_ALERT_IDLE; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); @@ -1022,7 +1022,7 @@ void sentrybot_update(unsigned char *moby) { if (MOBY(moby)->prev_seq != 5) blend_moby_animation(moby, 5, 0, scale_game_frames(10)); } - sentrybot_instance_data->unk19E = 0; + sentrybot_instance_data->projectile_emitted_this_animation = 0; } break; case SENTRYBOT_ALERT_IDLE: @@ -1079,14 +1079,14 @@ void sentrybot_update(unsigned char *moby) { *D_L15_001B0AB0[sentrybot_instance_data->unk124]; } sentrybot_instance_data->unk144 = 0; - sentrybot_instance_data->unk14C = scale_game_frames(0x3C); + sentrybot_instance_data->patrol_pause_timer = scale_game_frames(0x3C); MOBY(moby)->command = 1; - if (sentrybot_instance_data->unk15F != 0) { + if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_PATROL_MOVE_FAST; if (MOBY(moby)->prev_seq != 0xE) blend_moby_animation(moby, 0xE, 0, scale_game_frames(10)); } else { - sentrybot_instance_data->unk15F = 1; + sentrybot_instance_data->command_alert_transition_started = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0xD; sentrybot_instance_data->pending_animation = 0xE; @@ -1108,13 +1108,13 @@ void sentrybot_update(unsigned char *moby) { blend_moby_animation(moby, 0, 0, scale_game_frames(10)); } else { MOBY(moby)->command = 1; - if (sentrybot_instance_data->unk15F != 0) { + if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; if (MOBY(moby)->prev_seq != 3) blend_moby_animation(moby, 3, 0, scale_game_frames(10)); } else { - sentrybot_instance_data->unk15F = 1; + sentrybot_instance_data->command_alert_transition_started = 1; MOBY(moby)->state = SENTRYBOT_WAIT_FOR_TRANSITION_ANIMATION; sentrybot_instance_data->unk15C = 0x10; sentrybot_instance_data->pending_animation = 3; @@ -1168,7 +1168,7 @@ void sentrybot_update(unsigned char *moby) { update_sentrybot_joint_aim(moby); if (sentrybot_instance_data->alert_timer != 0) { lvl = 2; - } else if (sentrybot_instance_data->target_mode != 2) { + } else if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { lvl = 2; } else { lvl = sentrybot_instance_data->target_detected_without_engagement != 0; From fed47fc56e4f201181a93010f9370498b7b971fc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:20:37 +0000 Subject: [PATCH 546/758] decomp: clarify names in chomper_update unk1C4 -> pursuit_target_selection_status: Retail 002e5e24 loads the chomper's pvars; 002e5f6c/002e5f74, 002e5ff0-002e6008 and 002e6168-002e617c test its +0x1C4 word against 2 to hold approach, return home or resume pursuit. Checked helper report 8d029861392b0ab3747ee291d86aa4c37e758f05a342ff8a62d69df292ed22cf loads that same pvars at 002e6230, supplies target vector +0x180 to selection at 002e635c-002e638c, then stores 2 into +0x1C4 at 002e63ac when home-to-target XY distance exceeds 16, or at 002e63dc when absolute target height difference exceeds 3. Authoritative same-file L16PursuitData and update_chomper_hit_reaction_and_target identify the corresponding member as target_selection_status and the value as CHOMPER_TARGET_SELECTION_REJECTED. These producer/consumer flows prove a pursuit target-selection status, not a moby current-state ID. --- src/overlays/l16/mobys/chomper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l16/mobys/chomper.c b/src/overlays/l16/mobys/chomper.c index ce78df8a61..eb91936bb2 100644 --- a/src/overlays/l16/mobys/chomper.c +++ b/src/overlays/l16/mobys/chomper.c @@ -86,7 +86,7 @@ typedef struct ChomperVars { u8 pad_121[0x5F]; f32 unk180[4]; u8 pad_190[0x34]; - s32 unk1C4; + s32 pursuit_target_selection_status; u8 pad_1C8[0x8]; f32 unk1D0[4]; u8 pad_1E0[0x10]; @@ -127,7 +127,7 @@ void chomper_update(struct Moby *chomper_moby) { chomper_data->unk5A = truncate_float_to_s32(3.2f); break; case CHOMPER_WAIT_TO_APPROACH_TARGET: - if (chomper_data->unk1C4 != 2) { + if (chomper_data->pursuit_target_selection_status != 2) { chomper_moby->state = CHOMPER_APPROACH_TARGET; if (chomper_moby->prev_seq != 0) blend_moby_animation(chomper_moby, 0, 0, scale_game_frames(20)); @@ -141,7 +141,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->unk1C4 == 2) + } else if (chomper_data->pursuit_target_selection_status == 2) chomper_moby->state = CHOMPER_RETURN_HOME; break; case CHOMPER_FACE_TARGET: { @@ -169,7 +169,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->unk1C4 != 2) + } else if (chomper_data->pursuit_target_selection_status != 2) chomper_moby->state = CHOMPER_APPROACH_TARGET; break; case 7: From 24ffadfba3058897ea09c6a7af4702e9be60f586 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:20:40 +0000 Subject: [PATCH 547/758] decomp: clarify names in update_darter_hit_reactions_and_targeting f2C -> damage: Hit_2E2B80 is the file-private hit-record type returned by find_moby_hit (retail 0x002e1844, saved in s0 at 0x002e184c). At 0x002e1890..0x002e1898, remaining health at owner pvars+0x20 is compared against the float at hit_record+0x2c. Health <= this amount clears health at 0x002e18a8 and sets DARTER_STATE_DYING at 0x002e18dc. Otherwise 0x002e1a00 subtracts this amount from health and 0x002e1a14 stores the reduced health. Original Ghidra pfVar6[0xb] supplies the same comparison and subtraction; C uses hit_record->f2C identically. Supplied resolve_moby_hit_response context also assigns hit_damage_override_table[q->b8] to the corresponding hit-record f2C. These uses prove damage rather than an offset-only role. --- src/overlays/l10/mobys/darter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l10/mobys/darter.c b/src/overlays/l10/mobys/darter.c index ea32ffa7dc..6698dee932 100644 --- a/src/overlays/l10/mobys/darter.c +++ b/src/overlays/l10/mobys/darter.c @@ -619,7 +619,7 @@ typedef struct Hit_2E2B80 { float f10[4]; struct Moby *moby; char pad24[8]; - float f2C; + float damage; int f30; } Hit_2E2B80; @@ -690,7 +690,7 @@ void update_darter_hit_reactions_and_targeting(struct Moby *moby) { resolve_moby_hit_response( moby, hit_record, &class_1199_vars->f20, 5, &hit_processing_status, 0, 0, 4); if (hit_record != 0 && hit_record->moby->oclass != moby->oclass) { - if (class_1199_vars->f20 <= hit_record->f2C) { + if (class_1199_vars->f20 <= hit_record->damage) { class_1199_vars->f20 = 0.0f; moby->flags &= 0xEFFF; if (moby->prev_seq != 4) @@ -717,7 +717,7 @@ void update_darter_hit_reactions_and_targeting(struct Moby *moby) { trooper_anim_update(moby, class_1199_vars->f110); func_L00_00261B00_2E2B80(moby, 1, 3, 0, -1); } else { - class_1199_vars->f20 = class_1199_vars->f20 - hit_record->f2C; + class_1199_vars->f20 = class_1199_vars->f20 - hit_record->damage; class_1199_vars->f117 = 0xFA; class_1199_vars->f26 = scale_game_frames(60); trooper_anim_update(moby, class_1199_vars->f110); From 2388fb62c294430ead73f7b382ab8563dbfd9f6e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:20:43 +0000 Subject: [PATCH 548/758] decomp: clarify names in help_hints_update f358 -> help_2718_condition_seen: After the hero-volume, configured class-0x3f7 and non-state-4 checks, retail 0x002e894c-0x002e8950 tests the unsigned halfword at 0x00141968+0x358. Its zero path increments zero to one and stores it at 0x002e8a14-0x002e8a18, then records frame bucket and level flags. Its nonzero path instead evaluates elapsed frames before help_request(0x2718,0x6b) at 0x002e89b4-0x002e89b8. It records that this help condition has been seen, rather than proving a playback count. f35A -> help_2718_last_frame_bucket: Retail 0x002e8960-0x002e8970 loads the +0x35a unsigned halfword, multiplies it by 600 and subtracts it from scale_game_frames(game frame counter) for the elapsed test gating help_request(0x2718,0x6b). At 0x002e89c4-0x002e8a10 and 0x002e8a1c-0x002e8a60 it compares against current scaled frames / 600 and stores that quotient only when larger. This is the last recorded 600-frame bucket for this help condition, not an exact frame timestamp. f35C -> help_2718_level_flags: On the first-seen condition path associated with help_request(0x2718,0x6b), retail 0x002e8a70 loads the +0x35c word, 0x002e8a78 shifts 1 by the selected level index, and 0x002e8a7c-0x002e8a84 ORs that bit and 0x80000000 into the stored word. Authoritative C expresses this as the existing word | (1 << current_level_index) | 0x80000000. The member therefore holds per-level condition flags plus a high flag whose separate meaning remains unknown. f8 -> help_2715_volume_index: EvData is loaded from moby->pvars at retail 0x002e85e8. At 0x002e87b4 its +8 word feeds a1 of is_point_inside_clip_volume (0x002e87b8), with hero position in a0. A false result skips the branch; a true result permits the remaining gates and help_request(0x2715,0x5c) at 0x002e8820-0x002e8828. Thus this configuration member selects that help condition's clip volume. --- src/overlays/l10/mobys/help_hints.c | 30 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/overlays/l10/mobys/help_hints.c b/src/overlays/l10/mobys/help_hints.c index 1e72838a53..13d3d6dbbb 100644 --- a/src/overlays/l10/mobys/help_hints.c +++ b/src/overlays/l10/mobys/help_hints.c @@ -24,7 +24,7 @@ extern unsigned char D_00141C48[]; typedef struct EvData { int f0; int f4; - int f8; + int help_2715_volume_index; int fC; int f10; int f14; @@ -46,9 +46,9 @@ typedef struct Msg { typedef struct Save_2E9978 { char pad0[0x358]; - unsigned short f358; - unsigned short f35A; - int f35C; + unsigned short help_2718_condition_seen; + unsigned short help_2718_last_frame_bucket; + int help_2718_level_flags; } Save_2E9978; typedef struct Flags_2E9978 { @@ -121,7 +121,7 @@ void help_hints_update(Moby *moby) { *(unsigned short *)(l10_help_message_2711_gate) == 0) { help_request(0x2711, 0x36); } - if (is_point_inside_clip_volume(D_0013F3D0_r, conditional_help_config->f8) != 0 && + if (is_point_inside_clip_volume(D_0013F3D0_r, conditional_help_config->help_2715_volume_index) != 0 && (((HeroPos *)(D_0013F3D0_r))->f200C < 2 || ((HeroPos *)(D_0013F3D0_r))->f200C == 9) && D_0013D4CB[0] == 0 && ((Msg *)D_L10_00179890)->f0 == 0 && ((Msg *)D_L10_00179890)->f24 == -1 && *(unsigned short *)(D_00141C48) == 0) { @@ -156,25 +156,25 @@ void help_hints_update(Moby *moby) { break; if (D_L10_0015FFD8_c2[conditional_help_config->f20].state == 4) break; - if (((Save_2E9978 *)(D_00141968_r))->f358 != 0) { + if (((Save_2E9978 *)(D_00141968_r))->help_2718_condition_seen != 0) { elapsed = - scale_game_frames(D_0015EEA4_gp) - ((Save_2E9978 *)(D_00141968_r))->f35A * 600; + scale_game_frames(D_0015EEA4_gp) - ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket * 600; if ((int)((float)scale_game_frames(0x12) * 60.0f) < elapsed || - ((Save_2E9978 *)(D_00141968_r))->f35A * 600 == 0) { + ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket * 600 == 0) { help_request(0x2718, 0x6B); break; } - if (scale_game_frames(D_0015EEA4_gp) / 600 > ((Save_2E9978 *)(D_00141968_r))->f35A) { - ((Save_2E9978 *)(D_00141968_r))->f35A = scale_game_frames(D_0015EEA4_gp) / 600; + if (scale_game_frames(D_0015EEA4_gp) / 600 > ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket) { + ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket = scale_game_frames(D_0015EEA4_gp) / 600; } break; } - ((Save_2E9978 *)(D_00141968_r))->f358++; - if (scale_game_frames(D_0015EEA4_gp) / 600 > ((Save_2E9978 *)(D_00141968_r))->f35A) { - ((Save_2E9978 *)(D_00141968_r))->f35A = scale_game_frames(D_0015EEA4_gp) / 600; + ((Save_2E9978 *)(D_00141968_r))->help_2718_condition_seen++; + if (scale_game_frames(D_0015EEA4_gp) / 600 > ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket) { + ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket = scale_game_frames(D_0015EEA4_gp) / 600; } - ((Save_2E9978 *)(D_00141968_r))->f35C = - ((Save_2E9978 *)(D_00141968_r))->f35C | (1 << current_level_index) | 0x80000000; + ((Save_2E9978 *)(D_00141968_r))->help_2718_level_flags = + ((Save_2E9978 *)(D_00141968_r))->help_2718_level_flags | (1 << current_level_index) | 0x80000000; break; } } From bc92549a8f1d856742e7101729dca3d3defe6a5d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:22:37 +0000 Subject: [PATCH 549/758] decomp: clarify names in update_alien_snapper_hit_response_and_targeting f120 -> selected_target_xy: Assigned retail 0x002f95e0-0x002f9610 passes pvars+0x120 as the selection output; checked helper 0x0026eae0 saves that pointer in s5 and 0x0026ee5c-0x0026ee68 copies selected moby+0x10 position to it. At 0x002f961c-0x002f9628 vector_distance_xy compares these coordinates with home. This char[8] member holds the selected target XY components; preserve its extent. f128 -> selected_target_z: Checked selection helper 0x0026ee5c-0x0026ee68 copies selected moby+0x10 position to the output at pvars+0x120, making pvars+0x128 its Z component. Assigned retail 0x002f9638-0x002f9654 subtracts this float from moby position Z at +0x18, takes absolute_float and compares with 3.0, confirming selected target height. f160 -> selected_target_moby: Assigned retail 0x002f95e0-0x002f9610 passes pvars+0x120 to checked target selection helper; 0x0026ee60 stores the selected moby pointer at output+0x40, exactly this member. Assigned 0x002f9668-0x002f967c defaults it when null. Supplied alien_snapper_update reads the same pvars offset through SnapperVars_91A8.target and uses its position for turning and approach. f170 -> home_position: Assigned retail 0x002f961c-0x002f9628 passes pvars+0x170 and selected target XY to vector_distance_xy for the targeting-radius limit. Supplied authoritative alien_snapper_update shares this pvars storage, copies initial moby position into SnapperVars_91A8.home at +0x170, can replace it with home-node position, and state RETURN_HOME steers toward it. The existing char[0x30] storage extent remains unchanged. f1B0 -> movement_path_index: Assigned retail 0x002f95d4-0x002f95f4 loads this int, scales it by four and indexes D_L06_001B0C30; 0x002f9604-0x002f9610 passes the selected record's count and points to the target-selection helper. Supplied authoritative alien_snapper_update names this same pvars offset path, uses it for movement path constraints and selects the same table for point_in_path_xy after knockback. f38 -> targeting_boost_refresh_pending: Assigned retail 0x002f9208-0x002f9240 tests this flag, refreshes pvars+0x1AC with a scaled random 180-240-frame countdown and clears the flag. 0x002f9244 decrements that countdown; 0x002f9574-0x002f958c uses its nonzero state to increase the targeting radius by 6.0. The name claims the proven pending refresh of this targeting boost, not an unproven triggering event. f88 -> horizontal_motion_speed: Assigned retail 0x002f938c and 0x002f9418 set this float to frame_time*2 or frame_time*8 before motion setup with pvars+0x70. Checked setup helper 0x0026b39c-0x0026b3e8 loads block+0x18 (pvars+0x88), multiplies it by cosine/sine of heading and stores the X/Y motion components; block+0x1C supplies Z separately. Supplied caller also sets this offset from XY home distance divided by travel frames. --- src/overlays/l06/mobys/alien_snapper.c | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/overlays/l06/mobys/alien_snapper.c b/src/overlays/l06/mobys/alien_snapper.c index a96c279245..d2c86b8112 100644 --- a/src/overlays/l06/mobys/alien_snapper.c +++ b/src/overlays/l06/mobys/alien_snapper.c @@ -207,29 +207,29 @@ typedef struct BlargVars { char pad00[0x20]; float health; /* 0x20 */ char pad24[0x14]; - int f38; /* 0x38 */ + int targeting_boost_refresh_pending; /* 0x38 */ char pad3C[0x24]; char f60[0x7]; /* 0x60 */ unsigned char f67; /* 0x67 */ char pad68[0x8]; char f70[0x18]; /* 0x70 */ - float f88; /* 0x88 */ + float horizontal_motion_speed; /* 0x88 */ float f8C; /* 0x8C */ char pad90[0x30]; float fC0; /* 0xC0 */ float fC4; /* 0xC4 */ char padC8[0x58]; - char f120[0x8]; /* 0x120 */ - float f128; /* 0x128 */ + char selected_target_xy[0x8]; /* 0x120 */ + float selected_target_z; /* 0x128 */ char pad12C[0x34]; - int f160; /* 0x160 */ + int selected_target_moby; /* 0x160 */ int f164; /* 0x164 */ char pad168[0x8]; - char f170[0x30]; /* 0x170 */ + char home_position[0x30]; /* 0x170 */ float f1A0; /* 0x1A0 */ char pad1A4[0x8]; int f1AC; /* 0x1AC */ - int f1B0; /* 0x1B0 */ + int movement_path_index; /* 0x1B0 */ char pad1B4[0x14]; float f1C8; /* 0x1C8 */ int f1CC; /* 0x1CC */ @@ -788,10 +788,10 @@ void update_alien_snapper_hit_response_and_targeting(Moby *moby) { Target *target; int reaction; - if (snapper_vars->f38 != 0) { + if (snapper_vars->targeting_boost_refresh_pending != 0) { snapper_vars->f1AC = truncate_float_to_s32(func_001F9878_2FA618(random_float_between(180.0f, 240.0f))); - snapper_vars->f38 = 0; + snapper_vars->targeting_boost_refresh_pending = 0; } fast_dec_timer(&snapper_vars->f1AC); damage = 0.0f; @@ -827,7 +827,7 @@ void update_alien_snapper_hit_response_and_targeting(Moby *moby) { case HIT_RESPONSE_NONLETHAL_ANIMATION_FEEDBACK: case HIT_RESPONSE_NONLETHAL_KNOCKBACK: moby->state = ALIEN_SNAPPER_STATE_HIT_KNOCKBACK; - snapper_vars->f88 = frame_time + frame_time; + snapper_vars->horizontal_motion_speed = frame_time + frame_time; snapper_vars->f8C = frame_time; snapper_vars->fC0 = 5.0f; snapper_vars->fC4 = 8.5f; @@ -839,7 +839,7 @@ void update_alien_snapper_hit_response_and_targeting(Moby *moby) { case HIT_RESPONSE_DEATH_SEQUENCE: moby->state = ALIEN_SNAPPER_STATE_DEATH_MOTION; moby->flags &= 0xEFFF; - snapper_vars->f88 = frame_time * 8.0f; + snapper_vars->horizontal_motion_speed = frame_time * 8.0f; snapper_vars->f8C = frame_time * 5.0f; snapper_vars->fC0 = 7.5f; snapper_vars->fC4 = 14.5f; @@ -885,18 +885,18 @@ void update_alien_snapper_hit_response_and_targeting(Moby *moby) { if (activate_effect_l08(snapper_vars->f1A0, moby, - snapper_vars->f120, + snapper_vars->selected_target_xy, 0, 0, - D_L06_001B0FB0_2FA618[snapper_vars->f1B0] + 4, - *D_L06_001B0FB0_2FA618[snapper_vars->f1B0]) != 2) { - if (snapper_vars->f1A0 < vector_distance_xy(snapper_vars->f170, snapper_vars->f120) || - 3.0f < absolute_float(moby->pos.z - snapper_vars->f128)) { + D_L06_001B0FB0_2FA618[snapper_vars->movement_path_index] + 4, + *D_L06_001B0FB0_2FA618[snapper_vars->movement_path_index]) != 2) { + if (snapper_vars->f1A0 < vector_distance_xy(snapper_vars->home_position, snapper_vars->selected_target_xy) || + 3.0f < absolute_float(moby->pos.z - snapper_vars->selected_target_z)) { snapper_vars->f164 = 2; } } - if (snapper_vars->f160 == 0) { - snapper_vars->f160 = D_001413D0[0]; + if (snapper_vars->selected_target_moby == 0) { + snapper_vars->selected_target_moby = D_001413D0[0]; } } From e74fef14b8da52ab3ab296c6bd6152f2cd83464f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:22:41 +0000 Subject: [PATCH 550/758] decomp: clarify names in drek_fight_missile_update unk154 -> wander_yaw_approach_scale: Retail initialization 0x002efc64/0x002efc90/0x002efca0 multiplies frame_time by 12.566371 and stores the float at pvars+0x154. Checked wander helper 0x002f0170-0x002f0184 loads this same field into f15 for approach_angle with moby->rot.z (+0x48), angular state +0x140, and destination-derived yaw. This proves a wander yaw-approach tuning scale, without assuming the deeper interpolation formula. unk158 -> wander_vertical_approach_scale: Retail initialization 0x002efc5c/0x002efc94/0x002efca8 multiplies frame_time_macro[1] by 10 and stores pvars+0x158. Checked wander helper 0x002f01c0-0x002f01f0 passes moby position Z (+0x18), vertical motion state +0x144, destination Z, and this field copied into both f13 and f14 to FUN_00213f38_c. Its demonstrated role is the paired vertical wander-approach tuning scale; this is semantic data flow, not an offset-derived name. --- src/overlays/l18/mobys/drek_fight_missile.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l18/mobys/drek_fight_missile.c b/src/overlays/l18/mobys/drek_fight_missile.c index 93b3997dfe..81f1811b05 100644 --- a/src/overlays/l18/mobys/drek_fight_missile.c +++ b/src/overlays/l18/mobys/drek_fight_missile.c @@ -111,8 +111,8 @@ typedef struct DrekFightMissileVars { u8 pad_148[0x4]; s32 dive_motion_blend_factor; f32 unk150; - f32 unk154; - f32 unk158; + f32 wander_yaw_approach_scale; + f32 wander_vertical_approach_scale; f32 unk15C; s32 timer_160; s16 unk164; @@ -140,8 +140,8 @@ void drek_fight_missile_update(struct Moby *moby) { case DREK_MISSILE_INITIALIZE: { float wander_acceleration_scale = frame_time_macro[1]; float initialization_frame_time = frame_time; - missile_vars->unk158 = wander_acceleration_scale * 10.0f; - missile_vars->unk154 = initialization_frame_time * 12.566371f; + missile_vars->wander_vertical_approach_scale = wander_acceleration_scale * 10.0f; + missile_vars->wander_yaw_approach_scale = initialization_frame_time * 12.566371f; missile_vars->unk150 = wander_acceleration_scale * 3.1415927f; missile_vars->unk15C = initialization_frame_time * 10.0f; missile_vars->effect_color_phase = random_angle_radians(); From 4ee290ff0a3c7a1e8fbee08cf5b05a9c2e08e36b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:24:35 +0000 Subject: [PATCH 551/758] decomp: clarify names in bolt_pickup_update v510 -> bolt_collection_probe_a: In bolt_pickup_update, retail 002b85e8 supplies hero+0x510 to vector_distance_xy at 002b85f4 with the pickup position as the other input. The comparison at 002b85fc accepts distance < 0.5 and sets collection hit at 002b8608. The hit gates bolt credits and pickup removal at 002b8680-002b872c. Exact C declares this as float v510[4]. Thus it is the first alternate bolt-collection probe position, without proving an anatomical identity. v520 -> bolt_collection_probe_b: Retail 002b860c supplies hero+0x520 to vector_distance_xy at 002b8610, with the same pickup position. Distance < 0.5 at 002b8618 sets collection hit at 002b8624, which gates bolt-counter increments and removal at 002b8680-002b872c. Authoritative C declares float v520[4] and tests it independently after v510. This proves a second alternate bolt-collection probe position, not its anatomical identity. v530 -> bolt_collection_probe_c: Retail 002b8628 supplies hero+0x530 to vector_distance_xy at 002b862c against the pickup position. The < 0.5 comparison at 002b8634 branches through 002b8674 to set collection hit at 002b867c, enabling bolt credits and pickup removal at 002b8680-002b872c. Authoritative C declares float v530[4]. It is the third alternate bolt-collection probe position; no physical body-part identity is asserted. --- src/overlays/l08/mobys/bolt_pickup.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l08/mobys/bolt_pickup.c b/src/overlays/l08/mobys/bolt_pickup.c index 2140b19e61..239d2b7f9b 100644 --- a/src/overlays/l08/mobys/bolt_pickup.c +++ b/src/overlays/l08/mobys/bolt_pickup.c @@ -52,9 +52,9 @@ typedef struct Hero_2B94B0 { char pad0[0x80]; float pos[4]; char pad90[0x480]; - float v510[4]; - float v520[4]; - float v530[4]; + float bolt_collection_probe_a[4]; + float bolt_collection_probe_b[4]; + float bolt_collection_probe_c[4]; char pad540[0x1B4C]; int f208C; char pad2090[0x1F8]; @@ -184,11 +184,11 @@ void bolt_pickup_update(Moby_2B94B0 *moby) { hit = 0; moby->spin_angle = fast_add_rotations(moby->spin_angle, moby_data->fC); if (((Hero_2B94B0 *)((char *)&hero))->f208C == 15) { - if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->v510, moby->pos) < 0.5f) + if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->bolt_collection_probe_a, moby->pos) < 0.5f) hit = 1; - if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->v520, moby->pos) < 0.5f) + if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->bolt_collection_probe_b, moby->pos) < 0.5f) hit = 1; - if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->v530, moby->pos) < 0.5f) + if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->bolt_collection_probe_c, moby->pos) < 0.5f) hit = 1; } else if (vector_distance_xy(moby->pos, ((Hero_2B94B0 *)((char *)&hero))->pos) < ((Hero_2B94B0 *)((char *)&hero))->collection_radius_xy) { From 8cbf8eed2bc01204b0dbcacf7cfd510b5a296463 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:26:30 +0000 Subject: [PATCH 552/758] decomp: clarify names in mine_group_update unk84 -> child_reset_gate: In source src/overlays/l07/mobys/mine_group.c SHA-256 5782514fe5f8ffa69cb7d75d3e08c5a2bec87140ef65bf0333c27ec933f74d27, unk84 is the s32 condition guarding child repositioning and reset. Original retail 0030b450..0030b474 selects null/removal-state (0xFE/0xFD) children; 0030b458/0030b474 loads parent pvars+84 and 0030b478..0030b47c compares it with -1, skipping the guarded block when equal. Otherwise 0030b484..0030b4a4 computes child displacement and copies its sampled path position to the moby, then 0030b4a8..0030b4cc checks the child timer and reset-segment equality before calling reset_moby_from_class_defaults. Supplied mark_moby_for_removal establishes the two removal state values. This proves a child-reset gate without inferring meanings for its other values. --- src/overlays/l07/mobys/mine_group.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l07/mobys/mine_group.c b/src/overlays/l07/mobys/mine_group.c index 1c4ef5846a..b9acd09847 100644 --- a/src/overlays/l07/mobys/mine_group.c +++ b/src/overlays/l07/mobys/mine_group.c @@ -200,7 +200,7 @@ typedef struct MineGroupVars { s32 unk78; f32 unk7C; f32 unk80; - s32 unk84; + s32 child_reset_gate; u8 pad_88[0x8]; s32 child_reset_segment_index; u8 unk94; @@ -378,7 +378,7 @@ void mine_group_update(struct Moby *moby) { *(int *)(child + 0x94) = *(int *)(child + 0x90) + 1; if (cursor == 0 || *(unsigned char *)(cursor + 0x20) == 0xfe || *(unsigned char *)(cursor + 0x20) == 0xfd) { - if (boltcrate_pvars->unk84 != -1) { + if (boltcrate_pvars->child_reset_gate != -1) { fast_vec_sub((char *)child + 0x60, (char *)child + 0x80, (char *)cursor + 0x10); qcopy((void *)(cursor + 0x10), (void *)(child + 0x80)); if (fast_dec_timer((int *)(child + 0x98)) && From f6d1c6f23a3ddea1e7a8cea98bd0b8f6cd135fcc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:26:33 +0000 Subject: [PATCH 553/758] decomp: clarify names in draw_blarg_heavy_interceptor_camera_pulled_glow unk214 -> aim_point_glow_quad_scale: Retail 0x002ae3e4 and 0x002ae414 load pvars+0x214 into f12 for the four vector-scale calls at 0x002ae3f0. Original Ghidra uVar7 scales successive 0x001d8640 vertices. Authoritative C fast_vec_scale(pk.m[j], D_L14_001D8640[j], d->unk214) scales the four (+/-1,+/-1,0,1) quad corners before adding glow_quad_position and drawing at 0x002ae420. This proves the aim-point glow quad scale; the other C uses multiply it by 0.48, 0.8 or 0.9 for scan radii. unk218 -> glow_camera_pull_distance_limit: Retail 0x002ae338 loads float pvars+0x218 into f12; 0x002ae33c-0x002ae360 caps it by camera-to-glow distance minus minimum separation and clamps the substituted margin to zero. Original Ghidra fVar6 follows this flow. At 0x002ae368 it sets the length of the normalized camera-minus-glow vector, which is added to the glow center at 0x002ae378. Authoritative C initializes camera_pull_distance from d->unk218 before precisely those operations, proving a limit on camera pull distance. --- src/overlays/l14/mobys/blarg_heavy_interceptor.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 7b396893c6..b536b43f89 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -255,8 +255,8 @@ typedef struct BlargHeavyInterceptorVars { s16 group_member_count; s32 flags; f32 unk210; - f32 unk214; - f32 unk218; + f32 aim_point_glow_quad_scale; + f32 glow_camera_pull_distance_limit; f32 unk21C; } BlargHeavyInterceptorVars; @@ -374,11 +374,11 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { if (hit) { lerp_vector(vector_scratch, moby_vars->cached_aim_point_position, moby_vars->unkD0, 0.5f); qcopy(secondary_vector_scratch, moby_vars->cached_aim_point_position); - noop_main_callback(secondary_vector_scratch, moby_vars->unk214 * 0.8f); - noop_main_callback(vector_scratch, moby_vars->unk214 * 0.48f); - if (FUN_L00_001f2868_c618(moby_vars->unk214 * 0.48f, vector_scratch, 0, 0, 0) || + noop_main_callback(secondary_vector_scratch, moby_vars->aim_point_glow_quad_scale * 0.8f); + noop_main_callback(vector_scratch, moby_vars->aim_point_glow_quad_scale * 0.48f); + if (FUN_L00_001f2868_c618(moby_vars->aim_point_glow_quad_scale * 0.48f, vector_scratch, 0, 0, 0) || FUN_L00_001f2868_c618( - moby_vars->unk214 * 0.9f, secondary_vector_scratch, 0, 0, 0)) { + moby_vars->aim_point_glow_quad_scale * 0.9f, secondary_vector_scratch, 0, 0, 0)) { struct Moby *t = D_L14_00174540.target; if ((char *)t == D_001413D0_lui || @@ -1431,7 +1431,7 @@ void draw_blarg_heavy_interceptor_camera_pulled_glow(struct Moby *m) { fast_vec_sub(glow_to_camera_vector, D_L14_001674C0_lui, glow_quad_position); glow_to_camera_distance = fast_vec_length(glow_to_camera_vector); if (0.0f < glow_to_camera_distance) { - float camera_pull_distance = d->unk218; + float camera_pull_distance = d->glow_camera_pull_distance_limit; float camera_distance_margin = glow_to_camera_distance - *(float *)&blarg_heavy_interceptor_glow_minimum_camera_separation_gp; @@ -1465,7 +1465,7 @@ void draw_blarg_heavy_interceptor_camera_pulled_glow(struct Moby *m) { pk.col[0] = col; } for (j = 0; j < 4; j++) { - fast_vec_scale(pk.m[j], D_L14_001D8640[j], d->unk214); + fast_vec_scale(pk.m[j], D_L14_001D8640[j], d->aim_point_glow_quad_scale); fast_vec_add(pk.m[j], pk.m[j], glow_quad_position); } draw_geometry_quad(&pk, 0, 0); From 0cae1fd04dfb4cb16dcaec33cbd262a0365e0e80 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:26:36 +0000 Subject: [PATCH 554/758] decomp: clarify names in background_ship_2_update unk64 -> path_progress: BackgroundShip2Vars is the file-owned pvars view loaded from moby+0x78 at 0x002ece5c. Its float +0x64 is initialized from +0x74 times the selected path's point count at 0x002ecf90-0x002ecfa4. Retail 0x002ed030-0x002ed040 advances this same field by frame travel divided by the first path segment length; 0x002ed044-0x002ed060 wraps it by subtracting the path count. Both sampling branches load +0x64 into f12 at 0x002ed07c/0x002ed09c and pass it with that path to sample_camera_path, writing moby position and rotation. Authoritative C uses match these operations, proving path_progress rather than a distance or unrelated state. --- src/overlays/shared/vehicles/background_ship_2.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/vehicles/background_ship_2.c b/src/overlays/shared/vehicles/background_ship_2.c index 2db701114b..ff1f327cc6 100644 --- a/src/overlays/shared/vehicles/background_ship_2.c +++ b/src/overlays/shared/vehicles/background_ship_2.c @@ -26,7 +26,7 @@ typedef struct BackgroundShip2Vars { u8 unk2C; u8 pad2D[0x33]; s32 unk60; - f32 unk64; + f32 path_progress; f32 unk68; s32 unk6C; f32 unk70; @@ -255,7 +255,7 @@ void background_ship_2_update(char *moby) { moby_data->unk6C = invalid_index; MOBY(moby)->state = BACKGROUND_SHIP_2_FOLLOW_PATH; MOBY(moby)->flags |= 0x10; - moby_data->unk64 = moby_data->unk74 * (float)*(int *)path; + moby_data->path_progress = moby_data->unk74 * (float)*(int *)path; break; } case BACKGROUND_SHIP_2_FOLLOW_PATH: @@ -271,16 +271,16 @@ void background_ship_2_update(char *moby) { if (current_level_index == 10) { path_travel_distance = path_travel_distance * 0.25f; } - moby_data->unk64 = moby_data->unk64 + path_travel_distance / moby_data->unk70; - if ((float)*(int *)path < moby_data->unk64) { - moby_data->unk64 = moby_data->unk64 - (float)*(int *)path; + moby_data->path_progress = moby_data->path_progress + path_travel_distance / moby_data->unk70; + if ((float)*(int *)path < moby_data->path_progress) { + moby_data->path_progress = moby_data->path_progress - (float)*(int *)path; } if ((unsigned int)(current_level_index - 9) < 2) { sample_camera_path( - (int *)path, 1, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->unk64); + (int *)path, 1, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->path_progress); } else { sample_camera_path( - (int *)path, 0, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->unk64); + (int *)path, 0, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->path_progress); } if (MOBY(moby)->pos.x < 8.0f) { MOBY(moby)->collision = 0; From f233f5168ba3941f31f67c884fae57365ab04bdc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:28:33 +0000 Subject: [PATCH 555/758] decomp: clarify names in build_interpolated_dma_packet f210 -> fog_depth_coefficient: Checked update_view_context retail 0x00208a20..0x00208aa8 computes camera+0x210 = camera[0xa0] * (fog_far_intensity - fog_near_intensity) / (fog_far_distance - fog_near_distance): f3 holds camera+0xa0 from 0x002089b0, f5 is the intensity difference at 0x00208a4c, f4 the distance difference at 0x00208a3c, and mul/div at 0x00208a64/0x00208a7c feed the store. It is also used in projection matrix construction at 0x00208b44/0x00208b90/0x00208bbc. Assigned retail 0x002a426c/0x002a4270 copies it into the view-setup packet; authoritative C's float f210 is that same field. v190 -> projection_and_fog_scale: Checked update_view_context 0x00208c04..0x00208cdc constructs camera+0x190 as the four-component scale bundle: camera+0x208, camera+0x20c, the fixed depth projection factor held in f23, and the computed fog coefficient camera+0x210. The same first three factors divide projection matrix components at 0x00208c1c/0x00208c38/0x00208c40/0x00208c48, with reciprocals stored at +0x180..+0x18c. The fourth comes from the proven fog-range calculation at 0x00208a20..0x00208aa8. Assigned retail 0x002a4264/0x002a4274/0x002a4278 copies the complete quadword into packet+0xb0, corresponding to qcopy of float v190[4] in authoritative C. v1A0 -> projection_and_fog_offset: Checked update_view_context builds camera+0x1a0 with X/Y = 2048 at 0x00208c74..0x00208c78 and 0x00208cc0/0x00208ce0, fixed depth offset at 0x00208c80..0x00208cc4, and fog intercept from camera+0x214 at 0x00208c70/0x00208cc8. That intercept is explicitly (near_intensity*far_distance - far_intensity*near_distance)/(far_distance-near_distance) at 0x00208a20..0x00208ab4. Checked update_camera_view_matrices 0x00207ea0..0x00207f80 loads this vector's XYZ and multiplies each by matrix W components before adding them to projected XYZ, establishing its offset role. Assigned retail 0x002a4280/0x002a4284/0x002a4288 copies this quadword into packet+0xc0, matching authoritative C float v1A0[4]. --- .../shared/rendering/build_interpolated_dma_packet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/rendering/build_interpolated_dma_packet.c b/src/overlays/shared/rendering/build_interpolated_dma_packet.c index 3e6fcce6e9..9defaac1c2 100644 --- a/src/overlays/shared/rendering/build_interpolated_dma_packet.c +++ b/src/overlays/shared/rendering/build_interpolated_dma_packet.c @@ -27,10 +27,10 @@ typedef struct QuadDrawArgs { typedef struct QuadCamera { char pad0[0x190]; - float v190[4]; - float v1A0[4]; + float projection_and_fog_scale[4]; + float projection_and_fog_offset[4]; char pad1B0[0x60]; - float f210; + float fog_depth_coefficient; char pad214[4]; float fog_near_distance; float fog_far_distance; @@ -171,11 +171,11 @@ void build_interpolated_dma_packet(QuadDrawArgs *draw_parameters) { view_setup_dma_packet[0x28] = 0x8000; view_setup_dma_packet[0x29] = 0x303EC000; view_setup_dma_packet[0x2A] = 0x412; - *(float *)(view_setup_dma_packet + 0x2B) = ((QuadCamera *)level02_camera_view_state)->f210; + *(float *)(view_setup_dma_packet + 0x2B) = ((QuadCamera *)level02_camera_view_state)->fog_depth_coefficient; cursor = view_setup_dma_packet + 0x2C; - qcopy(cursor, ((QuadCamera *)level02_camera_view_state)->v190); + qcopy(cursor, ((QuadCamera *)level02_camera_view_state)->projection_and_fog_scale); cursor = view_setup_dma_packet + 0x30; - qcopy(cursor, ((QuadCamera *)level02_camera_view_state)->v1A0); + qcopy(cursor, ((QuadCamera *)level02_camera_view_state)->projection_and_fog_offset); *(float *)(view_setup_dma_packet + 0x34) = ((QuadCamera *)level02_camera_view_state)->fog_far_intensity; *(float *)(view_setup_dma_packet + 0x35) = ((QuadCamera *)level02_camera_view_state)->fog_near_intensity; view_setup_dma_packet[0x36] = 0; From f057099df047c23ef41c77f780be20307dcb2a5e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:28:37 +0000 Subject: [PATCH 556/758] decomp: clarify names in update_screamer_hit_reactions_and_targeting f130 -> navigation_state: The authoritative C's two private pvars views overlap: MobyData_2DFC38 f130[0x44] spans D_2E0630 home (+0x130), wander_goal (+0x140), path (+0x150), node_index (+0x158), linked[4] (+0x160) and yaw_speed (+0x170). Assigned retail 0x002e00d0-0x002e00d4 uses its leading home vector as the targeting-distance origin. Checked caller 0x002df2a0/0x002df2a4 calls this function on the same moby and loads the same pvars; 0x002df350-0x002df388 initializes home and wander goal from position, 0x002df4ac-0x002df4cc indexes path points, 0x002df64c-0x002df65c advances the node, 0x002df7d0-0x002df7ec resolves linked entities, 0x002dfaa4-0x002dfaac adds a random offset to home for wandering, and 0x002dfb10-0x002dfb24 steers toward that goal using +0x170. These operations prove navigation state for the entire aggregate, rather than only a position vector. f26 -> nonlethal_hit_duration_frames: Assigned retail 0x002dfcf4-0x002dfd04 branches on remaining health versus hit damage. Its nonlethal branch 0x002dfe7c-0x002dfe94 subtracts damage, calls scale_game_frames with 60 at 0x002dfe84/0x002dfe8c, and stores the scaled return as a short at pvars+0x26. The authoritative C explicitly expresses f26 = scale_game_frames(60) only in this surviving-hit branch. This proves a duration in scaled frames associated with a nonlethal hit; the name deliberately does not claim an invulnerability, cooldown or color-animation consumer. --- src/overlays/l10/mobys/screamer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l10/mobys/screamer.c b/src/overlays/l10/mobys/screamer.c index c6efe28b96..facf499d84 100644 --- a/src/overlays/l10/mobys/screamer.c +++ b/src/overlays/l10/mobys/screamer.c @@ -333,7 +333,7 @@ typedef struct MobyData_2DFC38 { char pad0[0x20]; float f20; char pad24[2]; - short f26; + short nonlethal_hit_duration_frames; char pad28[0x10]; int target_range_boost_requested; char pad3C[0x24]; @@ -350,7 +350,7 @@ typedef struct MobyData_2DFC38 { char color_reaction_state_header[7]; unsigned char secondary_color_red; char pad118[0x18]; - char f130[0x44]; + char navigation_state[0x44]; int f174; float default_target_range; int active_target_path_index; @@ -437,7 +437,7 @@ void update_screamer_hit_reactions_and_targeting(struct Moby *moby) { } else { screamer_vars->f20 = screamer_vars->f20 - hit_record->damage; screamer_vars->secondary_color_red = 0xfa; - screamer_vars->f26 = scale_game_frames(60); + screamer_vars->nonlethal_hit_duration_frames = scale_game_frames(60); trooper_anim_update(moby, screamer_vars->color_reaction_state_header); } moby->hit_slot = 0xff; @@ -477,7 +477,7 @@ void update_screamer_hit_reactions_and_targeting(struct Moby *moby) { target_selection_status = ahead_f(screamer_vars->current_target_range, moby, screamer_vars->fC0); } if (target_selection_status != TARGET_SELECTION_DEFAULT_TARGET_EXCLUDED) { - if (screamer_vars->current_target_range < vector_distance_xy(screamer_vars->f130, screamer_vars->fC0)) + if (screamer_vars->current_target_range < vector_distance_xy(screamer_vars->navigation_state, screamer_vars->fC0)) screamer_vars->f104 = 2; else if (moby->visible == 0) screamer_vars->f104 = 2; From de28f16fd7de841746222bf46f8853ac7217bfb4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:28:40 +0000 Subject: [PATCH 557/758] decomp: clarify names in butterfly_swarm_update unk5E -> repulsion_class_count: Assigned retail 0029f108/0029f154 stores 2 to child pvars+0x5e before update_entity. The same child pvars is passed as a3 to steer_child_moby at 0029f200..0029f254. Bounded level-04 helper 001f30e8 retains a3 in s2; 001f3610..001f3648 compares candidate moby oclass (+0xa6) with the halfword class table at s2+0x60 and bounds its search/match acceptance by the signed count loaded from s2+0x5e. Source Steer.count and classes/class_index repulsion loop confirm this is the repulsion class count. unk62 -> secondary_repulsion_class: Assigned retail 0029f120/0029f158 initializes first class at child pvars+0x60 to spawned child class 0x55; 0029f124/0029f164 initializes +0x62 to 0x1ee while +0x5e is set to 2. Child pvars reaches helper s2 through 0029f200..0029f254 and 001f30e8. Helper 001f3610..001f3638 compares candidate oclass with halfwords starting at +0x60 and advances by two bytes until the two-entry count is exhausted. Thus +0x62 is the second configured class selected for repulsion, not an inferred identity for class 0x1ee. Source steer->classes[class_index] gates the repulsion force. unk90 -> same_class_repulsion_distance_scale: Assigned retail 0029f110..0029f15c initializes child pvars+0x90 to 1.0f; first class table member +0x60 is 0x55, matching create_moby(0x55) at 0029efc8..0029efcc. In the direct helper, candidate class matching at 001f3610..001f3648 leaves class index in s3. 001f3660..001f3670 loads pvars+0x90+4*class_index and divides candidate distance f20 by it; 001f3684..001f3690 squares that scaled distance and divides the matching +0x70 weight by it before the away-vector force is accumulated at 001f369c..001f36c4. Source steer->scale[class_index] confirms +0x90 is the distance scale for first-entry, same-class repulsion. --- src/overlays/l04/mobys/butterfly_swarm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l04/mobys/butterfly_swarm.c b/src/overlays/l04/mobys/butterfly_swarm.c index 4f7003aead..72bf8cf389 100644 --- a/src/overlays/l04/mobys/butterfly_swarm.c +++ b/src/overlays/l04/mobys/butterfly_swarm.c @@ -524,14 +524,14 @@ typedef struct SwarmPartVars { Vec4f *leader_pos; s32 unk58; s16 unk5C; - s16 unk5E; + s16 repulsion_class_count; s16 oclass; - s16 unk62; + s16 secondary_repulsion_class; u8 pad64[0xC]; f32 unk70; f32 unk74; u8 pad78[0x18]; - f32 unk90; + f32 same_class_repulsion_distance_scale; f32 unk94; } SwarmPartVars; @@ -646,10 +646,10 @@ void butterfly_swarm_update(struct Moby *moby) { part->unk48 = 1.056f; part->unk5C = -1; part->unk40 = 0.003f; - part->unk5E = 2; + part->repulsion_class_count = 2; part->oclass = 0x55; - part->unk90 = 1.0f; - part->unk62 = 0x1ee; + part->same_class_repulsion_distance_scale = 1.0f; + part->secondary_repulsion_class = 0x1ee; part->unk94 = 5.0f; update_entity(child); } From 76485d35ebe8c91542cff5ad3dc711d6cafe8956 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:30:44 +0000 Subject: [PATCH 558/758] decomp: clarify names in blarg_turret_update b53 -> animation_sequence_index: Assigned retail 0x002b426c-0x002b4284 reads turret+0x53 and requests animation sequence 0 only when it differs; 0x002b4328-0x002b435c compares against 1 before requesting sequence 1. Original Ghidra and authoritative C corroborate these checks. Checked level-13 helper request efdc0ea6f89f4569be0801d33c91e397 at 0x00263528 saves a1 in s3, 0x00263530-0x00263550 indexes the class animation descriptor table by s3*4, and 0x002635ec stores that same requested sequence to moby+0x53. Thus the private unsigned byte records the current animation sequence index, rather than a boolean animation flag. --- src/overlays/l13/mobys/blarg_turret.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l13/mobys/blarg_turret.c b/src/overlays/l13/mobys/blarg_turret.c index b0db1480f3..b9f22aa59f 100644 --- a/src/overlays/l13/mobys/blarg_turret.c +++ b/src/overlays/l13/mobys/blarg_turret.c @@ -53,7 +53,7 @@ typedef struct Moby_2B5368 { char pad30[0x10]; V4_2B5368 rot; char pad50[3]; - unsigned char b53; + unsigned char animation_sequence_index; char pad54[0x24]; void *data; char pad7C[0x2A]; @@ -131,7 +131,7 @@ void blarg_turret_update(Moby_2B5368 *turret_moby) { turret_moby->scale = turret_moby->cls->scale * 1.5f; data->gun = FUN_L13_002b4958_2b0e80(turret_moby); data->f54 = turret_moby->rot.z; - if (turret_moby->b53 != 0) { + if (turret_moby->animation_sequence_index != 0) { blend_moby_animation(turret_moby, 0, 0, 10); } turret_moby->state = BLARG_TURRET_STATE_WAIT_FOR_TARGET; @@ -146,7 +146,7 @@ void blarg_turret_update(Moby_2B5368 *turret_moby) { (data->volume == -1 || is_point_inside_clip_volume(D_0013F420_2b0e80, data->volume) != 0)) { data->f68 = 8.0f; - if (turret_moby->b53 != 1) { + if (turret_moby->animation_sequence_index != 1) { int animation_start_frame = random_int_between(0, 3); blend_moby_animation( turret_moby, 1, animation_start_frame, random_int_between(7, 13)); @@ -162,7 +162,7 @@ void blarg_turret_update(Moby_2B5368 *turret_moby) { if (data->gun == 0 || data->gun->cls_id != 0x24 || (unsigned char)data->gun->state == 0xFE || (unsigned char)data->gun->state == 0xFD || (unsigned char)data->gun->state == 2) { - if (turret_moby->b53 != 0) { + if (turret_moby->animation_sequence_index != 0) { blend_moby_animation(turret_moby, 0, 0, random_int_between(7, 13)); } data->f64 = 1.0f; @@ -178,7 +178,7 @@ void blarg_turret_update(Moby_2B5368 *turret_moby) { vector_distance_xy(&turret_moby->pos, &target_moby->pos) > 22.0f || (data->volume != -1 && is_point_inside_clip_volume(D_0013F420_2b0e80, data->volume) == 0)) { - if (turret_moby->b53 != 0) { + if (turret_moby->animation_sequence_index != 0) { blend_moby_animation(turret_moby, 0, 0, random_int_between(7, 13)); } turret_moby->state = BLARG_TURRET_STATE_WAIT_FOR_TARGET; @@ -206,7 +206,7 @@ void blarg_turret_update(Moby_2B5368 *turret_moby) { if (data->gun == 0 || data->gun->cls_id != 0x24 || (unsigned char)data->gun->state == 0xFE || (unsigned char)data->gun->state == 0xFD || (unsigned char)data->gun->state == 2) { - if (turret_moby->b53 != 0) { + if (turret_moby->animation_sequence_index != 0) { blend_moby_animation(turret_moby, 0, 0, random_int_between(7, 13)); } data->f64 = 1.0f; From 322fca89fab7b728aac3f836c7303648d1dabd6e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:30:47 +0000 Subject: [PATCH 559/758] decomp: clarify names in process_amoeboid_hits_and_update_targeting unk204 -> target_selection_status: Retail 0x002ef1fc-0x002ef230 writes 2 to pvars+0x204 when the selected position exceeds the home-distance or vertical bounds. At 0x002ef278-0x002ef2a8 that status permits replacing target (+0x200), and selecting the alternate candidate stores 1. Supplied large_amoeboid_update also sets 2 on failed target-path acquisition and tests it before following the target; this is target selection status, not Moby.state. unk228 -> effective_target_search_radius: Retail 0x002ef154-0x002ef17c stores base_target_search_radius (+0x224), or that radius plus 20, into float pvars+0x228 according to the timer. The value becomes f12 for target search at 0x002ef1b4-0x002ef1d8, bounds the home-to-selected-position distance at 0x002ef1e8-0x002ef1fc, and bounds candidate distance at 0x002ef264-0x002ef270. Thus it is the effective target search radius. unk248 -> alternate_target_list_index: Retail 0x002ef234-0x002ef244 loads pvars+0x248 into a1, skips negative indices, and passes it with the incoming moby to find_nearest_class_26f_moby_in_list. Supplied exact helper C indexes l01_moby_index_lists_by_group with that argument and finds a live class-0x26F moby; 0x002ef2a4 stores the returned candidate as target. The field selects the alternate-target candidate list. unk24C -> target_region_path_index: Retail 0x002ef1a0-0x002ef1dc loads pvars+0x24C, multiplies by four, indexes the path-pointer table at 0x001b0930, and passes that path's count and points (+0x10) to the target-selection helper. Authoritative C spells the table l01_paths; supplied FUN_L00_0025ff38 context identifies the points/count as target_region_vertices/nv and uses them for point_in_path_xy. Thus this field indexes the target-region path. unk258 -> removal_height_table_index: Retail 0x002ef0d4-0x002ef104 loads pvars+0x258, checks nonzero, multiplies the index by 0x1190, adds table base D_L01_001612D0 and reads entry+8 as float. For a non-initial moby state, position Z below that height reaches burst sparks and removal at 0x002ef114-0x002ef12c. This proves the removal-height table index role without assigning a broader table identity; supplied initialization also uses nonzero to select one health and immediate activation. unk260 -> target_search_gate_moby_index: Retail 0x002ef180-0x002ef198 loads pvars+0x260, permits searching for nonpositive indices, otherwise shifts the value by eight, adds the moby-table base from gp-0x6c28 and tests the indexed moby's +0xBC command byte. Zero command skips target-region search to 0x002ef238; nonzero permits the path/helper block. Authoritative C's path_search_gate_moby_index local receives this field, proving a moby index used to gate target searching. --- src/overlays/shared/enemies/large_amoeboid.c | 56 ++++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index ac15287c7d..197add84a6 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -78,12 +78,12 @@ typedef struct LargeAmoeboidVars { f32 unk1C0[4]; u8 pad1D0[0x30]; char *target; - s32 unk204; + s32 target_selection_status; u8 pad208[0x8]; f32 home_pos[4]; /* 0x210: position at spawn */ u8 unk220[0x4]; f32 base_target_search_radius; - f32 unk228; + f32 effective_target_search_radius; s32 unk22C; s32 unk230; f32 unk234; @@ -91,13 +91,13 @@ typedef struct LargeAmoeboidVars { f32 unk23C; s32 unk240; s32 unk244; - s32 unk248; - s32 unk24C; + s32 alternate_target_list_index; + s32 target_region_path_index; f32 size_scale; /* 0x250: 1, 0.7 or 0.49 by amoeboid size */ f32 unk254; - s32 unk258; + s32 removal_height_table_index; s32 unk25C; - s32 unk260; + s32 target_search_gate_moby_index; u8 pad264[0xc]; u8 unk270[0x4]; } LargeAmoeboidVars; @@ -297,7 +297,7 @@ void large_amoeboid_update(unsigned char *moby) { else large_amoeboid_vars->unk130 = &D_L01_00161A40; large_amoeboid_vars->unk29 = 1; - if (large_amoeboid_vars->unk258 != 0) { + if (large_amoeboid_vars->removal_height_table_index != 0) { large_amoeboid_vars->health = 1.0f; large_amoeboid_vars->unk230 = 1; } else { @@ -329,7 +329,7 @@ void large_amoeboid_update(unsigned char *moby) { } break; case LARGE_AMOEBOID_TRY_ACQUIRE_TARGET_PATH: - if (large_amoeboid_vars->unk204 != 2) { + if (large_amoeboid_vars->target_selection_status != 2) { if (FUN_00213260(4) == 0) { path_hit = follow_path((int *)(&large_amoeboid_vars->unk240), 1, @@ -345,11 +345,11 @@ void large_amoeboid_update(unsigned char *moby) { clear_u64_value(&large_amoeboid_vars->unk40); large_amoeboid_vars->unk234 = random_float_between(-0.34906584f, 0.34906584f); } else { - large_amoeboid_vars->unk204 = 2; + large_amoeboid_vars->target_selection_status = 2; } } } - if (large_amoeboid_vars->unk22C != 0 && large_amoeboid_vars->unk204 == 2) { + if (large_amoeboid_vars->unk22C != 0 && large_amoeboid_vars->target_selection_status == 2) { MOBY(moby)->state = LARGE_AMOEBOID_MOVE_DIRECTLY_TOWARD_TARGET; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, 5); @@ -374,7 +374,7 @@ void large_amoeboid_update(unsigned char *moby) { move[2] = 0.0f; move_moby_with_ground_and_collision_checks( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); - result = large_amoeboid_vars->unk204; + result = large_amoeboid_vars->target_selection_status; if (result != 2 && FUN_00213260(4) == 0) { path_hit = follow_path((int *)(&large_amoeboid_vars->unk240), 1, @@ -393,10 +393,10 @@ void large_amoeboid_update(unsigned char *moby) { large_amoeboid_vars->unk234 = angle; large_amoeboid_vars->unk194 = distance; } else { - large_amoeboid_vars->unk204 = 2; + large_amoeboid_vars->target_selection_status = 2; } } - if (large_amoeboid_vars->unk22C != 0 && large_amoeboid_vars->unk204 == 2) { + if (large_amoeboid_vars->unk22C != 0 && large_amoeboid_vars->target_selection_status == 2) { MOBY(moby)->state = LARGE_AMOEBOID_MOVE_DIRECTLY_TOWARD_TARGET; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, 5); @@ -487,9 +487,9 @@ void large_amoeboid_update(unsigned char *moby) { move_moby_with_ground_and_collision_checks( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); } else { - large_amoeboid_vars->unk204 = 2; + large_amoeboid_vars->target_selection_status = 2; } - if (large_amoeboid_vars->unk204 == 2) + if (large_amoeboid_vars->target_selection_status == 2) MOBY(moby)->state = LARGE_AMOEBOID_RETURN_TO_STORED_POSITION; spawn_amoeboid_movement_particles(moby); return; @@ -587,7 +587,7 @@ void large_amoeboid_update(unsigned char *moby) { move_moby_with_ground_and_collision_checks( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); } - if (large_amoeboid_vars->unk204 != 2 && (MOBY(moby)->state = 4, MOBY(moby)->prev_seq != 1)) + if (large_amoeboid_vars->target_selection_status != 2 && (MOBY(moby)->state = 4, MOBY(moby)->prev_seq != 1)) blend_moby_animation(moby, 1, 0, scale_game_frames(3)); spawn_amoeboid_movement_particles(moby); return; @@ -802,7 +802,7 @@ void process_amoeboid_hits_and_update_targeting(char *moby) { return; } MOBY(moby)->hit_slot = 0xFF; - removal_height_entry_index = moby_vars->unk258; + removal_height_entry_index = moby_vars->removal_height_table_index; if (removal_height_entry_index != 0 && MOBY(moby)->state != LARGE_AMOEBOID_INITIALIZE && MOBY(moby)->pos.z < *(float *)(removal_height_entry_index * 0x1190 + pool_draw_tiles + 8)) { clear_u64_value(&scratch_vector); @@ -815,41 +815,41 @@ void process_amoeboid_hits_and_update_targeting(char *moby) { moby_vars->unk38 = 0; } if (fast_dec_timer(&moby_vars->unk22C) != 0) { - moby_vars->unk228 = moby_vars->base_target_search_radius; + moby_vars->effective_target_search_radius = moby_vars->base_target_search_radius; } else { - moby_vars->unk228 = moby_vars->base_target_search_radius + 20.0f; + moby_vars->effective_target_search_radius = moby_vars->base_target_search_radius + 20.0f; } - path_search_gate_moby_index = moby_vars->unk260; + path_search_gate_moby_index = moby_vars->target_search_gate_moby_index; if (path_search_gate_moby_index <= 0 || *(unsigned char *)((path_search_gate_moby_index << 8) + (*(int *)&D_L01_0015FFD8) + 0xBC) != 0) { - search_path = ((char *)l01_paths[moby_vars->unk24C]); + search_path = ((char *)l01_paths[moby_vars->target_region_path_index]); path_search_position = &moby_vars->unk1C0; - if (FUN_L00_0025ff38(moby_vars->unk228, + if (FUN_L00_0025ff38(moby_vars->effective_target_search_radius, moby, path_search_position, 0, 0, search_path + 0x10, *(int *)search_path) != 2) { - if (moby_vars->unk228 < + if (moby_vars->effective_target_search_radius < vector_distance_xy(&moby_vars->home_pos, path_search_position) || 3.0f < absolute_float(MOBY(moby)->pos.z - moby_vars->unk1C0[2])) { - moby_vars->unk204 = 2; + moby_vars->target_selection_status = 2; } } } - candidate_list_index = moby_vars->unk248; + candidate_list_index = moby_vars->alternate_target_list_index; if (candidate_list_index >= 0) { cand = find_nearest_class_26f_moby_in_list(moby, candidate_list_index); if (cand != 0) { candidate_distance = vector_distance_xy(&MOBY(moby)->pos, cand + 0x10); - if (candidate_distance < moby_vars->unk228) { - if (moby_vars->unk204 == 2 || + if (candidate_distance < moby_vars->effective_target_search_radius) { + if (moby_vars->target_selection_status == 2 || candidate_distance < vector_distance_xy(&MOBY(moby)->pos, moby_vars->target + 0x10)) { moby_vars->target = cand; - moby_vars->unk204 = 1; + moby_vars->target_selection_status = 1; } } } From cec00b1213c67e095694ae927569319d5cf9e9b8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:32:53 +0000 Subject: [PATCH 560/758] decomp: clarify names in update_blarg_paratrooper_damage_and_state f160 -> target_moby: Retail 00302914/003029b4 loads instance+0x160, validates that moby's state, and copies its position into target tracking at +0x120 (003029cc-003029d8); null falls back to hero.moby at 003029fc-00302a04. Supplied caller reads this same field as target for facing, melee and projectile aiming. f164 -> target_selection_status: Checked target selector 0026a650 receives instance+0x120 in a1, saved as s5 (0026a668); it stores its selection status at +0x44(s5), hence instance+0x164, at 0026aaa0. Status defaults to zero at 0026a6b8, becomes one on selecting an alternate moby at 0026a8b4-0026a8b8, or two for rejected selection at 0026a798-0026a7a0. Root likewise writes two for target range/height failure and invalid target (0030297c,003029b0,003029ec); caller gates target engagement on this field !=2. f1D0 -> wake_path_index: Retail 0030291c-0030293c loads instance+0x1d0 and indexes the l08_paths pointer table using a four-byte stride, then passes the path's point array and count to target selection (0030294c-00302958). Supplied caller initialization checks this field against -1 and reports paratrooper_invalid_wake_path_format, establishing the wake path rather than the separate jump or patrol path. f1F8 -> bone_attachment_moby: Retail 00302528-00302540 tests instance+0x1f8, creates class 0x401 and saves the moby pointer there. At 003025a0-003025e4 it computes owner bone 4 position and transform, copies the transform to attachment+0xc0 and position to attachment+0x10, then updates that moby. Caller removes it with its owner and uses its point zero as the projectile origin. unk1D8 -> target_range_boost_timer: Retail 003028b4-003028dc initializes signed short instance+0x1d8 from scaled random 180..240, then 003028e4-003028e8 decrements it with fast_dec_timer_s16. Nonzero adds 6.0 to the target-selection range (003028ec-00302908); zero uses the base range. This proves both a countdown timer and its temporary range-boost purpose. unk1E4 -> base_target_range: Retail 003028f4 reads float instance+0x1e4, adds 6.0 only while +0x1d8 is nonzero, and stores the effective range at +0x1dc. That range is passed in f12 to target selector at 00302930-00302954 and compared against XY target distance at 00302964-0030297c. Checked selector saves f12 in f21 (0026a670) and bounds candidate distance with it at 0026a83c-0026a844. unk67 -> hit_flash_red: Root writes instance+0x67=250,120,240 for hit reactions at 003026e4,00302790,0030286c and passes instance+0x60 as the color animation state at 00302884-003028a0. Checked trooper_anim_finish loads state+7 at 00267ab8 and 00267ad8, interpolates it against original first color channel at state+4 (00267ad4-00267b08). Supplied trooper_anim_finish identifies this first channel as r1, the secondary red value used by set_moby_color, proving the hit-flash red component. unk8C -> knockback_z_speed: Retail recovery stores frame_time*3 at instance+0x8c (00302708-00302720), and death stores l08_paratrooper_death_knockback_z_speed*frame_time there (003027b0-003027fc). Both pass its address as trooper_knockback_arc's z_scaled_value. Checked trooper_start_knockback takes motion base instance+0x70; 00266aa0 loads motion+0x1c (instance+0x8c) and 00266abc stores it as velocity vector Z at motion+8, proving vertical knockback speed. --- .../shared/enemies/blarg_paratrooper.c | 88 +++++++++---------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_paratrooper.c b/src/overlays/shared/enemies/blarg_paratrooper.c index 85f2a49178..9feeb86708 100644 --- a/src/overlays/shared/enemies/blarg_paratrooper.c +++ b/src/overlays/shared/enemies/blarg_paratrooper.c @@ -52,13 +52,13 @@ typedef struct Paratrooper302618 { unsigned char f5A; u8 pad5B[0x5]; u8 unk60[0x7]; - u8 unk67; + u8 hit_flash_red; u8 pad68[0x8]; u8 unk70[0x10]; f32 unk80; u8 pad84[0x4]; f32 unk88; - f32 unk8C; + f32 knockback_z_speed; s32 unk90; s32 unk94; f32 unk98; @@ -85,21 +85,21 @@ typedef struct Paratrooper302618 { u8 unk120[0x8]; f32 unk128; u8 pad12C[0x34]; - char *f160; - int f164; + char *target_moby; + int target_selection_status; u8 pad168[0x68]; - int f1D0; + int wake_path_index; int f1D4; - s16 unk1D8; + s16 target_range_boost_timer; short f1DA; f32 unk1DC; u8 pad1E0[0x4]; - f32 unk1E4; + f32 base_target_range; float f1E8; int f1EC; int f1F0; int f1F4; - char *f1F8; + char *bone_attachment_moby; int f1FC; u8 pad200[0xc]; short f20C; @@ -207,7 +207,7 @@ void blarg_paratrooper_update(char *moby) { return; path = 0; update_blarg_paratrooper_damage_and_state(moby); - target = paratrooper_private_state->f160; + target = paratrooper_private_state->target_moby; if (paratrooper_private_state->f1FC != -1) path = ((char *)l08_paths[paratrooper_private_state->f1FC]); hero = (Hero302618 *)(((char *)&D_0013F350)); @@ -223,8 +223,8 @@ void blarg_paratrooper_update(char *moby) { } if ((*(unsigned char *)((char *)(moby) + 0x20)) != 0 && paratrooper_private_state->f2E == 2) { mark_moby_for_removal(moby); - if (paratrooper_private_state->f1F8) - mark_moby_for_removal(paratrooper_private_state->f1F8); + if (paratrooper_private_state->bone_attachment_moby) + mark_moby_for_removal(paratrooper_private_state->bone_attachment_moby); return; } switch ((*(unsigned char *)((char *)(moby) + 0x20))) { @@ -237,7 +237,7 @@ void blarg_paratrooper_update(char *moby) { paratrooper_private_state->f24 = 2; paratrooper_private_state->f58 = truncate_float_to_s32(15.0f); paratrooper_private_state->f5A = truncate_float_to_s32(12.0f); - if (paratrooper_private_state->f1D0 == -1) { + if (paratrooper_private_state->wake_path_index == -1) { debug_print(paratrooper_invalid_wake_path_format, (*(short *)((char *)(moby) + 0xB2))); goto delete_moby; } @@ -294,7 +294,7 @@ void blarg_paratrooper_update(char *moby) { (char *)paratrooper_private_state + 0xD0, path + 0x10 + paratrooper_private_state->f1F4 * 16, pos); - if (target && paratrooper_private_state->f164 != 2 && + if (target && paratrooper_private_state->target_selection_status != 2 && fast_dec_timer((char *)paratrooper_private_state + 0x1F0)) { paratrooper_private_state->f1F4 = select_point_index_by_distance( &MOBY(moby)->pos, ((char *)l08_paths[paratrooper_private_state->f1D4]), 0.0f); @@ -352,7 +352,7 @@ void blarg_paratrooper_update(char *moby) { } (*(unsigned char *)((char *)(moby) + 0x20)) = 9; } else if (target) { - if (paratrooper_private_state->f164 != 2 && + if (paratrooper_private_state->target_selection_status != 2 && fast_dec_timer((char *)paratrooper_private_state + 0x1F0)) { qcopy((char *)paratrooper_private_state + 0x1C0, &MOBY(moby)->pos); paratrooper_private_state->f1F4 = (paratrooper_private_state->f1F4 + 1) & 1; @@ -450,7 +450,7 @@ void blarg_paratrooper_update(char *moby) { if ((D_L08_0015F5D4 < 0.8f && D_L08_0015F5D0 < 0.8f) || !((*(unsigned short *)¶trooper_private_state->f20E) & 1)) { char *shot; - moby_point_position(paratrooper_private_state->f1F8, 0, pos); + moby_point_position(paratrooper_private_state->bone_attachment_moby, 0, pos); attack_vector_or_ray_endpoint[0] = fast_cos((*(float *)((char *)(moby) + 0x48))) * (speed302618 * D_0015ED6C); attack_vector_or_ray_endpoint[1] = @@ -593,8 +593,8 @@ void blarg_paratrooper_update(char *moby) { FUN_L00_00263fd8_c( moby, 0x69E, &MOBY(moby)->pos, rotation, 0, 0, 0.0f, color, color, color); mark_moby_for_removal(moby); - if (paratrooper_private_state->f1F8) - mark_moby_for_removal(paratrooper_private_state->f1F8); + if (paratrooper_private_state->bone_attachment_moby) + mark_moby_for_removal(paratrooper_private_state->bone_attachment_moby); } break; } @@ -638,23 +638,23 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { paratrooper_instance_state->unkF4 = timer_scale; } - if (paratrooper_instance_state->f1F8 == 0) { + if (paratrooper_instance_state->bone_attachment_moby == 0) { child = create_moby(0x401); - paratrooper_instance_state->f1F8 = child; + paratrooper_instance_state->bone_attachment_moby = child; if (child != 0) { *(short *)(child + 0x32) = 0x40; - *(unsigned char *)(paratrooper_instance_state->f1F8 + 0x30) = 0x40; - *(unsigned char *)(paratrooper_instance_state->f1F8 + 0x31) = 1; - *(unsigned short *)(paratrooper_instance_state->f1F8 + 0x34) |= 0x100; + *(unsigned char *)(paratrooper_instance_state->bone_attachment_moby + 0x30) = 0x40; + *(unsigned char *)(paratrooper_instance_state->bone_attachment_moby + 0x31) = 1; + *(unsigned short *)(paratrooper_instance_state->bone_attachment_moby + 0x34) |= 0x100; moby_point_position(moby, 4, pos); - qcopy(paratrooper_instance_state->f1F8 + 0x10, pos); + qcopy(paratrooper_instance_state->bone_attachment_moby + 0x10, pos); } MOBY(moby)->flags |= 0x1000; } else { moby_point_position(moby, 4, pos); build_moby_bone_transform(moby, 4, matrix); - copy_matrix3x4(paratrooper_instance_state->f1F8 + 0xc0, matrix); - attached = paratrooper_instance_state->f1F8; + copy_matrix3x4(paratrooper_instance_state->bone_attachment_moby + 0xc0, matrix); + attached = paratrooper_instance_state->bone_attachment_moby; qcopy(attached + 0x10, pos); update_entity(attached); } @@ -690,7 +690,7 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { break; case 9: case 10: - paratrooper_instance_state->unk67 = 0xfa; + paratrooper_instance_state->hit_flash_red = 0xfa; break; case PARATROOPER_HIT_REACTION_RECOVERY_KNOCKBACK: case 4: @@ -701,7 +701,7 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { float pose_scale = l08_paratrooper_recovery_knockback_xy_speed * frame_time; float timer_scale = frame_time * 3.0f; paratrooper_instance_state->unk88 = pose_scale; - paratrooper_instance_state->unk8C = timer_scale; + paratrooper_instance_state->knockback_z_speed = timer_scale; paratrooper_instance_state->unkC0 = 5.0f; paratrooper_instance_state->unkC4 = 10.0f; } @@ -716,11 +716,11 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { trooper_knockback_arc(pos, &knock_angle, (float *)(¶trooper_instance_state->unk88), - (float *)(¶trooper_instance_state->unk8C)); + (float *)(¶trooper_instance_state->knockback_z_speed)); trooper_start_knockback( moby, ¶trooper_instance_state->unk70, knock_angle, 8, 1, 0); MOBY(moby)->state = PARATROOPER_STATE_KNOCKBACK_RECOVERY; - paratrooper_instance_state->unk67 = 0x78; + paratrooper_instance_state->hit_flash_red = 0x78; break; case PARATROOPER_HIT_REACTION_LETHAL: case PARATROOPER_HIT_REACTION_DEATH_KNOCKBACK: { @@ -735,7 +735,7 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { timer_scale = timer_rate * step; angle_scale = angle_rate * step; paratrooper_instance_state->unk98 = 0.25f; - paratrooper_instance_state->unk8C = angle_scale; + paratrooper_instance_state->knockback_z_speed = angle_scale; paratrooper_instance_state->unk80 = pose_scale; paratrooper_instance_state->unk88 = timer_scale; paratrooper_instance_state->unkC0 = 11.0f; @@ -753,11 +753,11 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { trooper_knockback_arc(pos, &second_knock_angle, (float *)(¶trooper_instance_state->unk88), - (float *)(¶trooper_instance_state->unk8C)); + (float *)(¶trooper_instance_state->knockback_z_speed)); trooper_start_knockback( moby, ¶trooper_instance_state->unk70, second_knock_angle, 12, 1, 0); MOBY(moby)->state = PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE; - paratrooper_instance_state->unk67 = 0xf0; + paratrooper_instance_state->hit_flash_red = 0xf0; spawn_randomized_bolt_drop(moby, 2, 3, 0, -1); break; default: @@ -772,18 +772,18 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { if (paratrooper_instance_state->unk38 != 0) { angle = random_float_between(180.0f, 240.0f); angle = scale_time(angle); - paratrooper_instance_state->unk1D8 = (short)truncate_float_to_s32(angle); + paratrooper_instance_state->target_range_boost_timer = (short)truncate_float_to_s32(angle); paratrooper_instance_state->unk38 = 0; } - fast_dec_timer_s16((short *)(¶trooper_instance_state->unk1D8)); - if (paratrooper_instance_state->unk1D8 != 0) - paratrooper_instance_state->unk1DC = paratrooper_instance_state->unk1E4 + 6.0f; + fast_dec_timer_s16((short *)(¶trooper_instance_state->target_range_boost_timer)); + if (paratrooper_instance_state->target_range_boost_timer != 0) + paratrooper_instance_state->unk1DC = paratrooper_instance_state->base_target_range + 6.0f; else - paratrooper_instance_state->unk1DC = paratrooper_instance_state->unk1E4; + paratrooper_instance_state->unk1DC = paratrooper_instance_state->base_target_range; if (random_integer_below(4) == 0) { { - char *path = ((char *)l08_paths[paratrooper_instance_state->f1D0]); + char *path = ((char *)l08_paths[paratrooper_instance_state->wake_path_index]); reaction = activate_effect_l08(moby, ¶trooper_instance_state->unk120, paratrooper_instance_state->unk1DC, @@ -796,20 +796,20 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { distance = vector_distance_xy(&MOBY(moby)->pos, ¶trooper_instance_state->unk120); if (paratrooper_instance_state->unk1DC < distance || 3.0f < absolute_float(MOBY(moby)->pos.z - paratrooper_instance_state->unk128)) - paratrooper_instance_state->f164 = 2; + paratrooper_instance_state->target_selection_status = 2; } } else { - chased = paratrooper_instance_state->f160; + chased = paratrooper_instance_state->target_moby; if (chased != 0 && *(unsigned char *)(chased + 0x20) != 0xfe && *(unsigned char *)(chased + 0x20) != 0xfd) { qcopy(¶trooper_instance_state->unk120, chased + 0x10); } else { - paratrooper_instance_state->f160 = 0; - paratrooper_instance_state->f164 = 2; + paratrooper_instance_state->target_moby = 0; + paratrooper_instance_state->target_selection_status = 2; } } - if (*(int *)¶trooper_instance_state->f160 == 0) - paratrooper_instance_state->f160 = (char *)hero.moby; + if (*(int *)¶trooper_instance_state->target_moby == 0) + paratrooper_instance_state->target_moby = (char *)hero.moby; state = MOBY(moby)->state; if (state == PARATROOPER_STATE_INITIALIZE || state == PARATROOPER_STATE_FIRE_PROJECTILES || state == PARATROOPER_STATE_MELEE_ATTACK || state == PARATROOPER_STATE_HOP_BETWEEN_WAYPOINTS) { From 233d341056bc26324dc7026f614f4ce4c10fb068 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:34:51 +0000 Subject: [PATCH 561/758] decomp: clarify names in update_alien_queen_hit_response_and_recovery unk110 -> health_sixteenths: At 0x002faa10-0x002faa20 retail loads queen health from pvars+0x20, multiplies it by 16.0f, and calls truncate_float_to_s32; 0x002faa2c stores that integer to pvars+0x110. Authoritative C agrees. Caller 0x002f9af8 passes this field's address to queue_animation_update, and death handling clears it at 0x002fa768. This names the proven health scale without asserting a UI format. unk170 -> intro_or_recovery_delay_active: Retail 0x002fab20-0x002fab28 tests pvars+0x170 before threshold recovery; 0x002fabc8 sets it to 1 alongside recovery_health and the 30-frame timer. 0x002fad80-0x002fad94 gates countdown on it; 0x002fae34/0x002faed0 clear it on recovery transition. Checked caller 0x002f9ca4-0x002f9cc4 also sets it to start the state-1 ten-frame intro delay, and 0x002f9d08 clears it when entering intro. Thus it marks the shared intro/recovery delay, not recovery exclusively. unk178 -> suppress_death_dialogue: Retail 0x002fad40-0x002fad74 latches pvars+0x178 to 1 when queen state is >=2, D_L06_00140408 is not 8 and pad_held_lui has bit 0x20. Checked caller initializes it to zero at 0x002f9b90. During death processing 0x002fa8b8-0x002fa8bc returns when this field is nonzero, bypassing voice allocation and queue_dialogue_message(0x53D6,-1) at 0x002fa8d8-0x002fa8f4. Supplied C confirms the dialogue-suppression role; no button identity is inferred. --- src/overlays/l06/mobys/alien_queen.c | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/overlays/l06/mobys/alien_queen.c b/src/overlays/l06/mobys/alien_queen.c index ae978fbb73..894b6d138d 100644 --- a/src/overlays/l06/mobys/alien_queen.c +++ b/src/overlays/l06/mobys/alien_queen.c @@ -394,7 +394,7 @@ typedef struct AlienQueenVars { s32 slider_list; s32 unk108; s32 animation_update; - s32 unk110; + s32 health_sixteenths; s32 unk114; f32 camera_blend_fraction; u8 unk11C; @@ -405,9 +405,9 @@ typedef struct AlienQueenVars { s32 timer_12C; u8 unk130; u8 pad_131[0x3F]; - s32 unk170; + s32 intro_or_recovery_delay_active; f32 recovery_health; - s32 unk178; + s32 suppress_death_dialogue; } AlienQueenVars; /* Moby class 1051 */ @@ -430,7 +430,7 @@ void alien_queen_update(unsigned char *moby) { func_L00_00236710_q, func_L00_00236830_q, func_L06_0024A080_q, - &alien_queen_update_vars->unk110, + &alien_queen_update_vars->health_sixteenths, 0x1EF); } switch ((unsigned char)moby[0x20]) { @@ -444,7 +444,7 @@ void alien_queen_update(unsigned char *moby) { alien_queen_update_vars->unk58 = truncate_float_to_s32(14.0f); alien_queen_update_vars->unk5A = truncate_float_to_s32(18.4f); alien_queen_update_vars->timer_120 = scale_game_frames(0x4B0); - alien_queen_update_vars->unk178 = 0; + alien_queen_update_vars->suppress_death_dialogue = 0; qcopy(alien_queen_update_vars->unkC0, moby + 0x10); alien_queen_update_vars->animation_update = -1; alien_queen_update_vars->unk114 = *D_L06_001B0C30_q[alien_queen_update_vars->path]; @@ -473,8 +473,8 @@ void alien_queen_update(unsigned char *moby) { return; if (*(short *)(target + 0xA6) != 0) return; - if (alien_queen_update_vars->unk170 == 0) { - alien_queen_update_vars->unk170 = 1; + if (alien_queen_update_vars->intro_or_recovery_delay_active == 0) { + alien_queen_update_vars->intro_or_recovery_delay_active = 1; alien_queen_update_vars->timer_12C = scale_game_frames(10); break; } @@ -484,7 +484,7 @@ void alien_queen_update(unsigned char *moby) { func_L06_002F6818_q(level_mobys_q + (alien_queen_update_vars->unk100 << 8)); set_listed_alien_queen_sliders_state_2_and_data_28_to_one( alien_queen_update_vars->slider_list); - alien_queen_update_vars->unk170 = 0; + alien_queen_update_vars->intro_or_recovery_delay_active = 0; moby[0x20] = 2; MOBY(moby)->collision = MOBY(moby)->pclass->collision; MOBY(moby)->flags = (MOBY(moby)->flags | 0x1000) & 0xFFFE; @@ -727,7 +727,7 @@ void alien_queen_update(unsigned char *moby) { case ALIEN_QUEEN_STATE_DEATH: { unsigned char *flag; menu_item_enabled_19_lui[4] = 1; - alien_queen_update_vars->unk110 = 0; + alien_queen_update_vars->health_sixteenths = 0; moby[0x30] = 0xFF; if (alien_queen_update_vars->unk2E == 2) { func_L06_002F6790_q(level_mobys_q + (alien_queen_update_vars->unk100 << 8)); @@ -759,7 +759,7 @@ void alien_queen_update(unsigned char *moby) { MOBY(moby)->collision = 0; moby[0x31] = 0; MOBY(moby)->flags |= 1; - if (alien_queen_update_vars->unk178 != 0) + if (alien_queen_update_vars->suppress_death_dialogue != 0) return; flag = D_0013D407_q + 1; if (flag[0xA] != 0) @@ -825,7 +825,7 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { return; if ((unsigned int)(MOBY(moby)->state - 4) < 10 && alien_queen_hit_recovery_vars->unk108 != -1) D_L06_0014162A = *(short *)&alien_queen_hit_recovery_vars->unk108; - alien_queen_hit_recovery_vars->unk110 = + alien_queen_hit_recovery_vars->health_sixteenths = truncate_float_to_s32(alien_queen_hit_recovery_vars->health * 16.0f); dmg = 0.0f; hit = FUN_L00_0025a420(moby, 0x330000, 0); @@ -847,7 +847,7 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { } } alien_queen_hit_recovery_vars->health -= dmg; - if (alien_queen_hit_recovery_vars->unk170 == 0) { + if (alien_queen_hit_recovery_vars->intro_or_recovery_delay_active == 0) { if (scale_game_frames(10) <= alien_queen_hit_recovery_vars->timer_12C) { hp = alien_queen_hit_recovery_vars->health; recovery_hp = 20.0f; @@ -860,7 +860,7 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { if (hp <= recovery_hp && hp + dmg > recovery_hp) { start_recovery: alien_queen_hit_recovery_vars->health = recovery_hp; - alien_queen_hit_recovery_vars->unk170 = 1; + alien_queen_hit_recovery_vars->intro_or_recovery_delay_active = 1; alien_queen_hit_recovery_vars->recovery_health = recovery_hp; alien_queen_hit_recovery_vars->timer_12C = scale_game_frames(30); } @@ -920,9 +920,9 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { return; } if ((unsigned char)moby[0x20] >= 2 && D_L06_00140408 != 8 && (pad_held_lui & 0x20)) - alien_queen_hit_recovery_vars->unk178 = 1; + 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->unk170 != 0) { + if (timer != 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 = @@ -932,7 +932,7 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { if (alien_queen_hit_recovery_vars->health > 10.0f) { alien_queen_hit_recovery_vars->health = 19.9f; moby[0x20] = 3; - alien_queen_hit_recovery_vars->unk170 = 0; + alien_queen_hit_recovery_vars->intro_or_recovery_delay_active = 0; qcopy(moby + 0x10, alien_queen_hit_recovery_vars->unkC0); MOBY(moby)->rot.z = fast_arc_tan(hero.motion.pos.f[0] - MOBY(moby)->pos.x, hero.motion.pos.f[1] - MOBY(moby)->pos.y); @@ -944,7 +944,7 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { LevelCuboid *base; alien_queen_hit_recovery_vars->health = 9.9f; moby[0x20] = 5; - alien_queen_hit_recovery_vars->unk170 = 0; + alien_queen_hit_recovery_vars->intro_or_recovery_delay_active = 0; base = &l06_cuboids[alien_queen_hit_recovery_vars->cuboid]; set_race_camera(&base->pos, &base->rot, 0x72, 1); qcopy(moby + 0x10, alien_queen_hit_recovery_vars->unkC0); @@ -956,7 +956,7 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { FUN_L06_002fb148_recovery_low(moby); } } - } else if (alien_queen_hit_recovery_vars->unk170 == 0) { + } else if (alien_queen_hit_recovery_vars->intro_or_recovery_delay_active == 0) { if (alien_queen_hit_recovery_vars->timer_12C < scale_game_frames(10)) { D_L06_0015F3FC = 1.0f - convert_integer_to_float(++alien_queen_hit_recovery_vars->timer_12C) / 10.0f; From 74ecc1d25dd8929584edb83234747bfbc29bd309 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:34:54 +0000 Subject: [PATCH 562/758] decomp: clarify names in bombomatic_update unk67 -> hit_transition_target: Retail 0x0030d714..0x0030d728 subtracts surviving hit damage and sets pvars+0x67 to 250; 0x0030d734 and 0x0030d748 pass pvars+0x60 to the established transition helpers. Checked 0x00285e78 captures three starting components into record+4/+5/+6 at 0x00285f14..0x00285f3c. Checked 0x00285f58 uses record+7 (the exact unk67 binding) as interpolation target: 0x00285fe8..0x00286038 computes start+(target-start)*elapsed_fraction into s2, and 0x002860b4..0x00286100 computes the reverse transition toward record+4. 0x00286190 passes s2 as a1 to the component output sink. Thus this byte is a hit-triggered transition endpoint, independent of the unresolved output-channel identity. --- src/overlays/l07/mobys/bombomatic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l07/mobys/bombomatic.c b/src/overlays/l07/mobys/bombomatic.c index a75a7c6eee..a6c70240e2 100644 --- a/src/overlays/l07/mobys/bombomatic.c +++ b/src/overlays/l07/mobys/bombomatic.c @@ -164,7 +164,7 @@ typedef struct BombomaticVars { u8 pad_28[0x38]; s16 anim_state; u8 pad_62[0x5]; - u8 unk67; + u8 hit_transition_target; u8 pad_68[0x8]; u8 manipulator_70; u8 pad_71[0xF]; @@ -325,7 +325,7 @@ void bombomatic_update(char *moby) { } tv -= hit_damage; *(float *)health_ptr = tv; - moby_data->unk67 = 0xFA; + moby_data->hit_transition_target = 0xFA; moby_data->unk26 = scale_game_frames(60); trooper_anim_update(moby, &moby_data->anim_state); } From 962eff34d0a7d81667bd08446e46f18cc6f1b22f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:34:57 +0000 Subject: [PATCH 563/758] decomp: clarify names in help_hints_update f24 -> requested_help_message_id: Assigned retail 0x002e867c-0x002e8684 (also 0x002e86ec-0x002e86f4, 0x002e8784-0x002e878c and 0x002e8800-0x002e8808) reads Msg+0x24 at 0x001798b4 and requires -1 before help_request calls with message IDs 0x2710..0x2715 in a0. Checked level-10 helper 0x001f6f70, evidence request bacdaaab22094411b354263e5253a0d9, preserves incoming a0 in t0 at 0x001f6f7c; forms Msg base 0x00179890 in a2 at 0x001f6f84; requires +0x24 == -1 at 0x001f6f90-0x001f6f98; then stores that original first argument t0 at +0x24 at 0x001f6fe8, while storing separate record index a3 at +0x28 at 0x001f6fe0. Thus this member holds the requested help message ID, rather than the per-message record index. --- src/overlays/l10/mobys/help_hints.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l10/mobys/help_hints.c b/src/overlays/l10/mobys/help_hints.c index 13d3d6dbbb..55af1496bd 100644 --- a/src/overlays/l10/mobys/help_hints.c +++ b/src/overlays/l10/mobys/help_hints.c @@ -41,7 +41,7 @@ typedef struct HeroPos { typedef struct Msg { int f0; char pad4[0x20]; - int f24; + int requested_help_message_id; } Msg; typedef struct Save_2E9978 { @@ -99,13 +99,13 @@ void help_hints_update(Moby *moby) { case HELP_MESSAGE_STATE_CHECK_CONDITIONS: if (is_point_inside_clip_volume(D_0013F3D0_r, conditional_help_config->f0) != 0 && (((HeroPos *)(D_0013F3D0_r))->f200C < 2 || ((HeroPos *)(D_0013F3D0_r))->f200C == 9) && - ((Msg *)D_L10_00179890)->f0 == 0 && ((Msg *)D_L10_00179890)->f24 == -1 && + ((Msg *)D_L10_00179890)->f0 == 0 && ((Msg *)D_L10_00179890)->requested_help_message_id == -1 && *(unsigned short *)(l10_help_message_2710_gate) == 0) { help_request(0x2710, 0x35); } if (is_point_inside_clip_volume(D_0013F3D0_r, conditional_help_config->f4) != 0 && (((HeroPos *)(D_0013F3D0_r))->f200C < 2 || ((HeroPos *)(D_0013F3D0_r))->f200C == 9) && - ((Msg *)D_L10_00179890)->f0 == 0 && ((Msg *)D_L10_00179890)->f24 == -1) { + ((Msg *)D_L10_00179890)->f0 == 0 && ((Msg *)D_L10_00179890)->requested_help_message_id == -1) { if (((Flags_2E9978 *)(alternate_item_available))->f4 == 0) { if (*(unsigned short *)(D_00141B20_r) == 0) { help_request(0x2712, 0x37); @@ -117,14 +117,14 @@ void help_hints_update(Moby *moby) { } } if (D_L10_0015F5C4_vendor == 0 && D_0013D504_r[0] != 0 && - ((Msg *)D_L10_00179890)->f0 == 0 && ((Msg *)D_L10_00179890)->f24 == -1 && + ((Msg *)D_L10_00179890)->f0 == 0 && ((Msg *)D_L10_00179890)->requested_help_message_id == -1 && *(unsigned short *)(l10_help_message_2711_gate) == 0) { help_request(0x2711, 0x36); } if (is_point_inside_clip_volume(D_0013F3D0_r, conditional_help_config->help_2715_volume_index) != 0 && (((HeroPos *)(D_0013F3D0_r))->f200C < 2 || ((HeroPos *)(D_0013F3D0_r))->f200C == 9) && D_0013D4CB[0] == 0 && ((Msg *)D_L10_00179890)->f0 == 0 && - ((Msg *)D_L10_00179890)->f24 == -1 && *(unsigned short *)(D_00141C48) == 0) { + ((Msg *)D_L10_00179890)->requested_help_message_id == -1 && *(unsigned short *)(D_00141C48) == 0) { help_request(0x2715, 0x5C); } any_active = 0; From 36433f5e4182faf938b1b4a7856e215955cc2e02 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:35:01 +0000 Subject: [PATCH 564/758] decomp: clarify names in initialize_blarg_heavy_interceptor_paths unk210 -> initial_path_distance_fraction: Retail 002ae610-002ae624 loads pvars+0x210 and tests against zero. The nonzero branch multiplies it by the nonclosing path-length sum at +0x16c (002ae634/002ae648) and passes that distance to the path sampler at 002ae664 after zeroing segment state +0x84/+0x1cc. It reloads the same scalar at 002ae66c, multiplies it by the second path-length sum +0x190 at 002ae674/002ae684, and seeds +0x80/+0x8c via 002ae690. The bound C shows these sums accumulated from adjacent-point distances and the zero branch clearing initial traversal state. Thus this field is the initial path distance fraction, with no claim that its range is restricted. --- 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 b536b43f89..a349ab4bca 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -254,7 +254,7 @@ typedef struct BlargHeavyInterceptorVars { s16 return_path_complete; s16 group_member_count; s32 flags; - f32 unk210; + f32 initial_path_distance_fraction; f32 aim_point_glow_quad_scale; f32 glow_camera_pull_distance_limit; f32 unk21C; @@ -1504,7 +1504,7 @@ void initialize_blarg_heavy_interceptor_paths(struct Moby *moby) { *(float *)((char *)path + (i << 4) + 0x1C) = fast_vec_dist( (char *)path + (i * 16 + 0x10), (char *)path + (((i + 1) % path[0]) * 16 + 0x10)); } - if (moby_vars->unk210 != 0.0f) { + if (moby_vars->initial_path_distance_fraction != 0.0f) { int *sampling_path = ((int *)l14_paths[moby_vars->unk78]); moby_vars->path_segment = 0; moby_vars->unk1C0[3] = 0.0f; @@ -1513,7 +1513,7 @@ void initialize_blarg_heavy_interceptor_paths(struct Moby *moby) { &moby_vars->path_segment, &moby_vars->unk1C0[3], moby_vars->rejoin_path_loop, - moby_vars->unk210 * moby_vars->beam_rotation_blink_and_aim_path_state[3]); + moby_vars->initial_path_distance_fraction * moby_vars->beam_rotation_blink_and_aim_path_state[3]); moby_vars->path_point_segment_distance = 0.0f; moby_vars->path_point = 0; FUN_L00_0025d808_2af688(sampling_path, @@ -1521,7 +1521,7 @@ void initialize_blarg_heavy_interceptor_paths(struct Moby *moby) { &moby_vars->path_point, &moby_vars->path_point_segment_distance, moby_vars->rejoin_path_loop, - moby_vars->unk210 * moby_vars->unk190[0]); + moby_vars->initial_path_distance_fraction * moby_vars->unk190[0]); } else { moby_vars->path_point = 0; moby_vars->path_segment = 0; From 7aba648b05dba0b750e1d539512328f7185279cf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:36:52 +0000 Subject: [PATCH 565/758] decomp: clarify names in mine_group_update unk26 -> surviving_hit_frame_count: In src/overlays/l07/mobys/mine_group.c (SHA-256 ba5e589748e0da95640fe11c84bc1dee85381789539ffa16ccd4fd2f94f31636), unk26 is an s16 assigned scale_game_frames(0x3c) only after damage is subtracted without depleting health. Original Ghidra shows the same func_0x00226d58(0x3c) return stored at pvars+26. Retail 0030b0c4..0030b0cc sends health > damage to 0030b160; 0030b160..0030b16c subtracts damage, 0030b168 sets a0=60, 0030b170 calls the frame-scaling helper, and 0030b178 stores its return with sh at 0x26(s2). Thus this field holds the scaled frame count recorded for a surviving hit; its later consumer is not inferred. --- src/overlays/l07/mobys/mine_group.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l07/mobys/mine_group.c b/src/overlays/l07/mobys/mine_group.c index b9acd09847..59bf2821f5 100644 --- a/src/overlays/l07/mobys/mine_group.c +++ b/src/overlays/l07/mobys/mine_group.c @@ -189,7 +189,7 @@ typedef struct MineGroupVars { u8 pad_0[0x20]; f32 unk20; u8 pad_24[0x2]; - s16 unk26; + s16 surviving_hit_frame_count; u8 pad_28[0x38]; s16 anim_state; u8 pad_62[0x5]; @@ -296,7 +296,7 @@ void mine_group_update(struct Moby *moby) { } *remaining -= step; boltcrate_pvars->unk67 = 0xfa; - boltcrate_pvars->unk26 = scale_game_frames(0x3c); + boltcrate_pvars->surviving_hit_frame_count = scale_game_frames(0x3c); trooper_anim_update(moby, &boltcrate_pvars->anim_state); } moby->hit_slot = 0xff; From 80552ad8204e2a4b97679fd35e8fea5bef7f8727 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:36:55 +0000 Subject: [PATCH 566/758] decomp: clarify names in update_sentrybot_hit_response_and_target_visibility domain_1_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: Retail loads/stores s1+0x114, the SentrybotVars target_mode field, rather than moby+0x20 state. Assigned 0x0029aac0 writes 2 when accepted visibility fails; 0x0029ab10 writes 2 for detected-but-suppressed engagement; 0x0029ab34 compares it with 2 and 0x0029ab4c forces it to 2. Authoritative sentrybot_update reads this exact field and already calls value 2 SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION, gating direct entry into projectile emission. Reuse that same-domain member; hero and moby state values are unrelated. domain_3_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: Retail loads/stores s1+0x114, the SentrybotVars target_mode field, rather than moby+0x20 state. Assigned 0x0029aac0 writes 2 when accepted visibility fails; 0x0029ab10 writes 2 for detected-but-suppressed engagement; 0x0029ab34 compares it with 2 and 0x0029ab4c forces it to 2. Authoritative sentrybot_update reads this exact field and already calls value 2 SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION, gating direct entry into projectile emission. Reuse that same-domain member; hero and moby state values are unrelated. domain_4_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: Retail loads/stores s1+0x114, the SentrybotVars target_mode field, rather than moby+0x20 state. Assigned 0x0029aac0 writes 2 when accepted visibility fails; 0x0029ab10 writes 2 for detected-but-suppressed engagement; 0x0029ab34 compares it with 2 and 0x0029ab4c forces it to 2. Authoritative sentrybot_update reads this exact field and already calls value 2 SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION, gating direct entry into projectile emission. Reuse that same-domain member; hero and moby state values are unrelated. domain_5_value_2 -> SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION: Retail loads/stores s1+0x114, the SentrybotVars target_mode field, rather than moby+0x20 state. Assigned 0x0029aac0 writes 2 when accepted visibility fails; 0x0029ab10 writes 2 for detected-but-suppressed engagement; 0x0029ab34 compares it with 2 and 0x0029ab4c forces it to 2. Authoritative sentrybot_update reads this exact field and already calls value 2 SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION, gating direct entry into projectile emission. Reuse that same-domain member; hero and moby state values are unrelated. unk15E -> saved_alert_engagement_suppression_plus_one: Retail 0x0029aa6c..0x0029aa78 loads alert_engagement_suppressed at s1+0x15b, adds 1, and saves it to this byte at s1+0x15e when target_mode is 1. 0x0029aa80..0x0029aa9c retains that encoded snapshot in global mode 3, restoring suppression when it is >=2; outside that mode 0x0029aa90 clears it. 0x0029aaf4..0x0029ab18 tests the nonzero saved encoding after target_mode leaves 1 and forces suppressed direct emission/detection. Name describes the saved suppression encoding only, without identifying global mode 3 or the broader meaning of target_mode 1. --- src/overlays/shared/enemies/sentrybot.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index fc9a113051..349d75c444 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -123,7 +123,7 @@ typedef struct SentrybotVars { u8 alert_engagement_suppressed; u8 unk15C; u8 pending_animation; - u8 unk15E; + u8 saved_alert_engagement_suppression_plus_one; u8 command_alert_transition_started; f32 home_pos[3]; /* 0x160: position at spawn */ f32 home_yaw; /* 0x16C */ @@ -1570,6 +1570,9 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i enum { HIT_STATUS_SKIP_REACTION = 1 }; + enum { + SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION = 2 + }; unsigned char *moby = sentrybot_moby; SentrybotVars *sentrybot_data = (SentrybotVars *)MOBY(moby)->pvars; char *hit; @@ -1737,28 +1740,28 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i seen = sentrybot_data->has_line_of_sight; } if (sentrybot_data->target_mode == 1) - sentrybot_data->unk15E = sentrybot_data->alert_engagement_suppressed + 1; + sentrybot_data->saved_alert_engagement_suppression_plus_one = sentrybot_data->alert_engagement_suppressed + 1; else if ((unsigned char)D_001413F4[0] != 3) - sentrybot_data->unk15E = 0; - else if (sentrybot_data->unk15E >= 2) + sentrybot_data->saved_alert_engagement_suppression_plus_one = 0; + else if (sentrybot_data->saved_alert_engagement_suppression_plus_one >= 2) sentrybot_data->alert_engagement_suppressed = 1; sentrybot_data->target_in_view = 1; if (seen == 0) { if (sentrybot_data->has_line_of_sight == 0) sentrybot_data->alert_engagement_suppressed = 1; sentrybot_data->target_in_view = 0; - sentrybot_data->target_mode = 2; + sentrybot_data->target_mode = SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION; sentrybot_data->target_detected_without_engagement = 0; } else if (((sentrybot_data->alert_timer == 0 || sentrybot_data->alert_engagement_suppressed != 0) && (unsigned char)D_001413F4[0] == 3) || - (sentrybot_data->unk15E != 0 && sentrybot_data->target_mode != 1)) { - sentrybot_data->target_mode = 2; + (sentrybot_data->saved_alert_engagement_suppression_plus_one != 0 && sentrybot_data->target_mode != 1)) { + sentrybot_data->target_mode = SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION; sentrybot_data->target_detected_without_engagement = 1; - } else if ((unsigned char)D_001413F4[0] != 3 && sentrybot_data->target_mode != 2) { + } else if ((unsigned char)D_001413F4[0] != 3 && sentrybot_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { sentrybot_data->alert_engagement_suppressed = 0; } if (D_L15_0015F5C4 == 2) - sentrybot_data->target_mode = 2; + sentrybot_data->target_mode = SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION; } else { sentrybot_data->target_in_view = 0; sentrybot_data->alert_engagement_suppressed = 1; From 8c223f27fbde19c106ed4d1142bd4847a6c4c467 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:38:36 +0000 Subject: [PATCH 567/758] decomp: clarify names in update_kerwan_path_enemy_hit_reaction f26C -> base_target_selection_range: Data2C8398 float f26C is loaded from data+0x26c at retail 002c9600. Timer-expired branch 002c9604-002c9608 copies it unchanged into target_selection_range (+0x270); active-timer branch 002c960c-002c961c adds exactly 5.0 before writing that same range. Source owner kerwan_path_enemy_update passes target_selection_range to select_moby_combat_target and compares target_distance against it, proving this field is the base target-selection range. s252 -> target_range_boost_timer: Data2C8398 short s252 receives scale_game_frames(240) at retail 002c95e8-002c95f0 when data.i38 is consumed. Its address data+0x252 is passed to fast_dec_timer_s16 at 002c95f4-002c95f8. The returned test at 002c95fc selects base f26C on expiration (002c9604-002c9608), or f26C+5.0 while active (002c960c-002c961c), writing target_selection_range (+0x270). This proves a countdown controlling the temporary target-range boost. --- src/overlays/l03/mobys/kerwan_path_enemy.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l03/mobys/kerwan_path_enemy.c b/src/overlays/l03/mobys/kerwan_path_enemy.c index 74f7916359..8250a69c2f 100644 --- a/src/overlays/l03/mobys/kerwan_path_enemy.c +++ b/src/overlays/l03/mobys/kerwan_path_enemy.c @@ -205,7 +205,7 @@ typedef struct Data2C8398 { Look2C8398 look0; Look2C8398 look1; short s250; - short s252; + short target_range_boost_timer; unsigned char b254; unsigned char b255; short s256; @@ -215,7 +215,7 @@ typedef struct Data2C8398 { unsigned char b263; int i264; char p268[4]; - float f26C; + float base_target_selection_range; float target_selection_range; int i274; float f278; @@ -1506,12 +1506,12 @@ void update_kerwan_path_enemy_hit_reaction(Moby2C8398 *moby) { moby_data = moby->data; if (moby_data->i38 != 0) { moby_data->i38 = 0; - moby_data->s252 = scale_game_frames(240); + moby_data->target_range_boost_timer = scale_game_frames(240); } - if (fast_dec_timer_s16(&moby_data->s252)) { - moby_data->target_selection_range = moby_data->f26C; + if (fast_dec_timer_s16(&moby_data->target_range_boost_timer)) { + moby_data->target_selection_range = moby_data->base_target_selection_range; } else { - moby_data->target_selection_range = moby_data->f26C + 5.0f; + moby_data->target_selection_range = moby_data->base_target_selection_range + 5.0f; } hit = find_moby_hit(moby, 0x330000, 0); hit_response_code = From 0671355863d644a5c7a65e70e7a475c75c0694d6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:38:39 +0000 Subject: [PATCH 568/758] decomp: clarify names in moby_248_update unk7 -> fuse_flash_target_red: In stationary fuse state, retail 0x002d28fc..0x002d2938 compares timer_20 with scaled 60/40/20 frames; 0x002d2940 stores 0xfa at pvars+7 and 0x002d2944/0x002d2950 pass that same pvars block to the established trooper_anim_update/finish color helpers. Checked level-08 helper 0x00267a28 (request 2381f1ab5b0b4e59af1ca7ea92bfcbed) reads byte +7 at 0x00267ab8/0x00267ad8, computes original_red(+4) + (target(+7)-original_red)*phase_progress at 0x00267ad4..0x00267b08, and passes the computed red via a1 at 0x00267c60 to the established set_moby_color operation at 0x00267c68. The return phase 0x00267b84..0x00267bd0 reverses this interpolation back to original red. Parallel +8/+9 computations supply green/blue, agreeing with supplied trooper_anim_finish source r1/g1/b1. Checked update helper request 4b5afac9caa44ceb8ad6ef3fe3bd13f1 captures original RGB at +4/+5/+6 (0x002679e4..0x00267a0c). Thus +7 is the fuse flash's target red channel, not merely an unknown byte at an offset. --- src/overlays/l08/mobys/bomb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l08/mobys/bomb.c b/src/overlays/l08/mobys/bomb.c index 7259628a57..cb5938b404 100644 --- a/src/overlays/l08/mobys/bomb.c +++ b/src/overlays/l08/mobys/bomb.c @@ -87,7 +87,7 @@ blk16 l08_bomb_moving_particle_initial_colors __asm__("D_L08_00161868") = { typedef struct Moby248Vars { u8 pad_0[0x7]; - u8 unk7; + u8 fuse_flash_target_red; u8 pad_8[0x8]; u8 unk10; u8 pad_11[0x7]; @@ -242,7 +242,7 @@ void moby_248_update(char *moby) { } else if (bomb_vars->timer_20 == scale_game_frames(0x3C) || bomb_vars->timer_20 == scale_game_frames(0x28) || bomb_vars->timer_20 == scale_game_frames(0x14)) { - bomb_vars->unk7 = 0xFA; + bomb_vars->fuse_flash_target_red = 0xFA; trooper_anim_update(moby, (short *)bomb_vars); } trooper_anim_finish(moby, bomb_vars); From 8f4e4710780e104736bd317e9a3825edc634f388 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:40:43 +0000 Subject: [PATCH 569/758] decomp: clarify names in update_hero_attachment f4E4 -> ledge_attachment_heading: Retail 0x0023419c..0x002341e0 uses hero+0x4E4 with sine/cosine and a PI shift to construct the second ledge attachment point. 0x002345a0..0x002345d4 uses its sine/cosine to reconstruct the ledge-grab position. 0x0023460c..0x0023462c updates this angle with atan of the primary-minus-secondary attachment XY vector, proving its heading role. i2080 -> hero_moby: The source elsewhere in this same supplied file identifies hero+0x2080 as hero.moby (sync_hero_mapped_moby_animation_frames and set_hero_animation). Retail 0x00234204/0x00234244/0x00234484 load this field as the first object argument to the pose/probe helpers, while +0x360 supplies the distinct attachment reference object. i364 -> attachment_anchor_flags: Retail 0x002342f4..0x00234300 sets bit 1 after saving primary/secondary local position anchors. 0x00234380..0x00234394 sets bit 2 after saving local rotation. Bits are tested at 0x002343bc to choose anchored mode, at 0x00234558 for anchored yaw, and at 0x00234574 for anchored position movement; these are attachment anchor validity/selection flags. p360 -> attachment_reference_object: Retail 0x00234004..0x0023400c selects this pointer from hero+0x2FC, and 0x00234048/0x00234070 alternatively select +0x4F8. It is resolved by 0x002603d0 at 0x002340e0 and passed as reference_object to convert_pose_to_reference_local at 0x0023424c..0x00234258 and to reconstruction at 0x002344f0..0x00234500. v310 -> primary_attachment_local_position: Retail 0x00234254..0x00234258 writes hero+0x310 as fifth output of convert_pose_to_reference_local, whose supplied implementation transforms the input position into the reference object's local frame. At 0x002344fc..0x00234500 it is the position input reconstructed into primary_attachment_position. v320 -> attachment_local_rotation: Retail 0x00234378..0x00234384 passes hero rotation +0x90 as fourth input and hero+0x320 as sixth output of convert_pose_to_reference_local. The supplied helper converts input rotation into reference-local Euler rotation. 0x002344e4..0x00234524 reuses this saved rotation for both attachment pose reconstructions. v330 -> secondary_attachment_local_position: Retail 0x0023426c..0x00234278 supplies hero+0x330 as fifth output of convert_pose_to_reference_local for the offset second point. 0x0023451c..0x00234524 later reconstructs it into secondary_attachment_position, used with the primary position to derive heading at 0x0023460c..0x00234624. v350 -> saved_attachment_displacement: Retail 0x002344ac computes probed position minus hero position into attachment_motion_scratch. 0x00234748..0x0023474c saves that attachment-derived displacement at hero+0x350, and 0x00234754..0x00234764 adds it to hero motion. The residual branch reads +0x350 at 0x002343e0..0x00234464 and decays its XY magnitude and Z toward zero. v4D0 -> ledge_grab_position: In the ledge branch for states 0x18/0x19, retail 0x00234180..0x00234224 copies hero+0x4D0 and offsets it by heading-dependent 0.45 XY and 1.43 Z to initialize attachment points. 0x002345a0..0x00234608 reconstructs the inverse offset from secondary_attachment_position and writes it back to +0x4D0; the supplied function description identifies this carried point as the ledge-grab point. --- src/overlays/shared/hero/set_hero_animation.c | 160 +++++++++--------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index ee5f894699..3475ecba99 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1407,21 +1407,21 @@ typedef struct Hero_234800 { void *p2FC; char p300[0xE]; short h30E; - Vec_234800 v310; - Vec_234800 v320; - Vec_234800 v330; + Vec_234800 primary_attachment_local_position; + Vec_234800 attachment_local_rotation; + Vec_234800 secondary_attachment_local_position; char p340[0x10]; - Vec_234800 v350; - void *p360; - int i364; + Vec_234800 saved_attachment_displacement; + void *attachment_reference_object; + int attachment_anchor_flags; char p368[0x168]; - Vec_234800 v4D0; + Vec_234800 ledge_grab_position; char p4E0[0x4]; - float f4E4; + float ledge_attachment_heading; char p4E8[0x10]; void *p4F8; char p4FC[0x1B84]; - int i2080; + int hero_moby; int i2084; char p2088[0x4]; int i208C; @@ -1470,37 +1470,37 @@ void update_hero_attachment(void) { if (((Hero_234800 *)hero_233f80)->h30E == 0) { if (((Hero_234800 *)hero_233f80)->p2FC != 0) { mode = HERO_ATTACHMENT_MODE_PROBE; - if (((Hero_234800 *)hero_233f80)->p360 != ((Hero_234800 *)hero_233f80)->p2FC) { - ((Hero_234800 *)hero_233f80)->i364 &= ~1; + if (((Hero_234800 *)hero_233f80)->attachment_reference_object != ((Hero_234800 *)hero_233f80)->p2FC) { + ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; } - ((Hero_234800 *)hero_233f80)->p360 = ((Hero_234800 *)hero_233f80)->p2FC; + ((Hero_234800 *)hero_233f80)->attachment_reference_object = ((Hero_234800 *)hero_233f80)->p2FC; } else { - ((Hero_234800 *)hero_233f80)->p360 = 0; - ((Hero_234800 *)hero_233f80)->i364 &= ~1; - ((Hero_234800 *)hero_233f80)->i364 &= ~2; + ((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)->p360 = ((Hero_234800 *)hero_233f80)->p4F8; + ((Hero_234800 *)hero_233f80)->attachment_reference_object = ((Hero_234800 *)hero_233f80)->p4F8; mode = HERO_ATTACHMENT_MODE_PROBE; } else if (((Hero_234800 *)hero_233f80)->i208C == 3 && ((Hero_234800 *)hero_233f80)->p4F8 != 0) { - ((Hero_234800 *)hero_233f80)->p360 = ((Hero_234800 *)hero_233f80)->p4F8; + ((Hero_234800 *)hero_233f80)->attachment_reference_object = ((Hero_234800 *)hero_233f80)->p4F8; mode = HERO_ATTACHMENT_MODE_PROBE; - } else if (((Hero_234800 *)hero_233f80)->p360 != 0) { + } else if (((Hero_234800 *)hero_233f80)->attachment_reference_object != 0) { mode = HERO_ATTACHMENT_MODE_PROBE; convert_integer_to_float(scale_game_frames(120) - ((Hero_234800 *)hero_233f80)->h30E); scale_game_frames_v_233f80(120); amt = ((Hero_234800 *)hero_233f80)->h30E; } else { - ((Hero_234800 *)hero_233f80)->p360 = 0; - ((Hero_234800 *)hero_233f80)->i364 &= ~1; - ((Hero_234800 *)hero_233f80)->i364 &= ~2; + ((Hero_234800 *)hero_233f80)->attachment_reference_object = 0; + ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; + ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~2; } if (!mode) { return; } - plat = f_L00_002603d0(((Hero_234800 *)hero_233f80)->p360); + plat = f_L00_002603d0(((Hero_234800 *)hero_233f80)->attachment_reference_object); if (plat == 0) { return; } @@ -1508,101 +1508,101 @@ void update_hero_attachment(void) { fast_vec_length(&((Hero_234800 *)hero_233f80)->v150) == 0.0f && ((Hero_234800 *)hero_233f80)->h30E == 0 && ((Hero_234800 *)hero_233f80)->h1F6 == 0) || (unsigned int)(((Hero_234800 *)hero_233f80)->i2084 - 0x18) < 2) { - if ((((Hero_234800 *)hero_233f80)->i364 ^ 1) & 1) { + if ((((Hero_234800 *)hero_233f80)->attachment_anchor_flags ^ 1) & 1) { if ((unsigned int)(((Hero_234800 *)hero_233f80)->i2084 - 0x18) < 2) { - qcopy(&attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->v4D0); + qcopy(&attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->ledge_grab_position); attachment_motion_scratch.x += - fast_cos(fast_add_rotations(((Hero_234800 *)hero_233f80)->f4E4, 3.1415925f)) * + fast_cos(fast_add_rotations(((Hero_234800 *)hero_233f80)->ledge_attachment_heading, 3.1415925f)) * 0.45f; attachment_motion_scratch.y += - fast_sin(fast_add_rotations(((Hero_234800 *)hero_233f80)->f4E4, 3.1415925f)) * + fast_sin(fast_add_rotations(((Hero_234800 *)hero_233f80)->ledge_attachment_heading, 3.1415925f)) * 0.45f; attachment_motion_scratch.z -= -1.43f; - probe_ground_height_cf(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, - &((Hero_234800 *)hero_233f80)->v4D0, + probe_ground_height_cf(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, + &((Hero_234800 *)hero_233f80)->ledge_grab_position, &((Hero_234800 *)hero_233f80)->v90, &attachment_position_motion_scratch, &probe_transform_scratch); - probe_ground_height_cf(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, + probe_ground_height_cf(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, &attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->v90, &attachment_motion_scratch, &probe_transform_scratch); - convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, - &((Hero_234800 *)hero_233f80)->v4D0, + convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, + &((Hero_234800 *)hero_233f80)->ledge_grab_position, &((Hero_234800 *)hero_233f80)->v90, - &((Hero_234800 *)hero_233f80)->v310, + &((Hero_234800 *)hero_233f80)->primary_attachment_local_position, &probe_transform_scratch); - convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, + convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, &attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->v90, - &((Hero_234800 *)hero_233f80)->v330, + &((Hero_234800 *)hero_233f80)->secondary_attachment_local_position, &probe_transform_scratch); } else if (plat->attachment_behavior_flags & 4) { - convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, + convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, - &((Hero_234800 *)hero_233f80)->v310, + &((Hero_234800 *)hero_233f80)->primary_attachment_local_position, &attachment_motion_scratch); } else { - probe_ground_height_cf(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, + probe_ground_height_cf(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, &attachment_position_motion_scratch, &probe_transform_scratch); - convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, + convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, &attachment_position_motion_scratch, &probe_transform_scratch, - &((Hero_234800 *)hero_233f80)->v310, + &((Hero_234800 *)hero_233f80)->primary_attachment_local_position, &attachment_motion_scratch); } - ((Hero_234800 *)hero_233f80)->i364 |= 1; + ((Hero_234800 *)hero_233f80)->attachment_anchor_flags |= 1; } } else { - ((Hero_234800 *)hero_233f80)->i364 &= ~1; + ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; } if ((((Hero_234800 *)hero_233f80)->i208C == 0 || ((Hero_234800 *)hero_233f80)->i208C == 12) && ((Hero_234800 *)hero_233f80)->f184 == 0.0f && ((Hero_234800 *)hero_233f80)->h30E == 0) { - if (!(((Hero_234800 *)hero_233f80)->i364 & 2)) { - convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, + if (!(((Hero_234800 *)hero_233f80)->attachment_anchor_flags & 2)) { + convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, &attachment_motion_scratch, - &((Hero_234800 *)hero_233f80)->v320); - ((Hero_234800 *)hero_233f80)->i364 |= 2; + &((Hero_234800 *)hero_233f80)->attachment_local_rotation); + ((Hero_234800 *)hero_233f80)->attachment_anchor_flags |= 2; } } else { - ((Hero_234800 *)hero_233f80)->i364 &= ~2; + ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~2; } - if (((Hero_234800 *)hero_233f80)->i364 & 3) { + if (((Hero_234800 *)hero_233f80)->attachment_anchor_flags & 3) { mode = HERO_ATTACHMENT_MODE_ANCHORED; } clear_u64_value(&attachment_motion_scratch); clear_u64_value(&attachment_position_motion_scratch); if (amt != 0.0f) { - sB4 = vector_length_xy(&((Hero_234800 *)hero_233f80)->v350); - sB0 = ((Hero_234800 *)hero_233f80)->v350.z; + sB4 = vector_length_xy(&((Hero_234800 *)hero_233f80)->saved_attachment_displacement); + sB0 = ((Hero_234800 *)hero_233f80)->saved_attachment_displacement.z; if (!(plat->attachment_behavior_flags & 2)) { approach_value(&sB0, 0.0f, frame_time_sq_macro * 25.0f * amt); approach_value(&sB4, 0.0f, (frame_time_sq_macro + frame_time_sq_macro) * amt); set_vector_length_xy( - &attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->v350, sB4); + &attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->saved_attachment_displacement, sB4); attachment_motion_scratch.z = sB0; } else { - qcopy(&attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->v350); + qcopy(&attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->saved_attachment_displacement); } qcopy(&attachment_position_motion_scratch, &attachment_motion_scratch); } else if (mode == HERO_ATTACHMENT_MODE_PROBE) { - probe_ground_height_cf(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, + probe_ground_height_cf(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, &probed_position, @@ -1612,45 +1612,45 @@ void update_hero_attachment(void) { &attachment_motion_scratch, &probed_position, &((Hero_234800 *)hero_233f80)->pos); qcopy((Vec_234800 *)(hero_233f80 + 0x350), &attachment_motion_scratch); } else if (mode == HERO_ATTACHMENT_MODE_ANCHORED) { - probe_ground_height_cf(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, + probe_ground_height_cf(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, &probe_transform_scratch, &anchored_probe_rotation); - transform_attachment_pose(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, - &((Hero_234800 *)hero_233f80)->v310, - &((Hero_234800 *)hero_233f80)->v320, + transform_attachment_pose(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, + &((Hero_234800 *)hero_233f80)->primary_attachment_local_position, + &((Hero_234800 *)hero_233f80)->attachment_local_rotation, &primary_attachment_position, &primary_attachment_rotation); - transform_attachment_pose(((Hero_234800 *)hero_233f80)->i2080, - ((Hero_234800 *)hero_233f80)->p360, - &((Hero_234800 *)hero_233f80)->v330, - &((Hero_234800 *)hero_233f80)->v320, + transform_attachment_pose(((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, + &((Hero_234800 *)hero_233f80)->secondary_attachment_local_position, + &((Hero_234800 *)hero_233f80)->attachment_local_rotation, &secondary_attachment_position, &v90); if ((((Hero_234800 *)hero_233f80)->i2084 == 1 || ((Hero_234800 *)hero_233f80)->i2084 == 0x1E) && ((Hero_234800 *)hero_233f80)->b20A5 != 0) { ((Hero_234800 *)hero_233f80)->v90.z = anchored_probe_rotation.z; - } else if (((Hero_234800 *)hero_233f80)->i364 & 2) { + } else if (((Hero_234800 *)hero_233f80)->attachment_anchor_flags & 2) { ((Hero_234800 *)hero_233f80)->v90.z = primary_attachment_rotation.z; } else { ((Hero_234800 *)hero_233f80)->v90.z = anchored_probe_rotation.z; } - if (((Hero_234800 *)hero_233f80)->i364 & 1) { + if (((Hero_234800 *)hero_233f80)->attachment_anchor_flags & 1) { if ((unsigned int)(((Hero_234800 *)hero_233f80)->i2084 - 0x18) < 2) { - vA0.x = fast_cos(((Hero_234800 *)hero_233f80)->f4E4) * 0.45f; - vA0.y = fast_sin(((Hero_234800 *)hero_233f80)->f4E4) * 0.45f; + vA0.x = fast_cos(((Hero_234800 *)hero_233f80)->ledge_attachment_heading) * 0.45f; + vA0.y = fast_sin(((Hero_234800 *)hero_233f80)->ledge_attachment_heading) * 0.45f; vA0.z = 0.0f; fast_vec_add(&vA0, &vA0, &secondary_attachment_position); vA0.z += -1.43f; fast_vec_sub(&attachment_motion_scratch, &probe_transform_scratch, &((Hero_234800 *)hero_233f80)->pos); - qcopy(&((Hero_234800 *)hero_233f80)->v4D0, &vA0); - ((Hero_234800 *)hero_233f80)->f4E4 = + qcopy(&((Hero_234800 *)hero_233f80)->ledge_grab_position, &vA0); + ((Hero_234800 *)hero_233f80)->ledge_attachment_heading = fast_arc_tan(primary_attachment_position.x - secondary_attachment_position.x, primary_attachment_position.y - secondary_attachment_position.y); } else { @@ -1665,13 +1665,13 @@ void update_hero_attachment(void) { qcopy(&((Hero_234800 *)hero_233f80)->pos, &primary_attachment_position); } else if (2.0f < attachment_distance) { clear_u64_value(&attachment_motion_scratch); - ((Hero_234800 *)hero_233f80)->i364 &= ~2; - ((Hero_234800 *)hero_233f80)->i364 &= ~1; + ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~2; + ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; } fast_vec_add(hero_233f80 + 0x4D0, hero_233f80 + 0x4D0, &attachment_motion_scratch); fast_vec_sub(&vA0, &attachment_motion_scratch, hero_233f80 + 0x140); if (0.1f < fast_vec_length(&vA0)) { - ((Hero_234800 *)hero_233f80)->i364 &= ~1; + ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; } } } else { From b2460e0744eb72a0d333dcf3e937205d39956a38 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:42:24 +0000 Subject: [PATCH 570/758] decomp: clarify names in update_splitting_effect_particle_with_collision_response_and_fade b02 -> animated_texture_id: Retail 00270184 loads the effect_texture_ids pointer (001b20b0); 0027018c reads particle byte +2, 00270194 reads table[0], and 002701a0-002701b4 combine the relative texture slot with timer +0xA and counter +0x36, mask by 7, and select a table entry. 002701b8 loads that texture ID byte and 002701c0 stores it back to particle +2. Original Ghidra has the identical pbRam001b20b0[...] assignment. Authoritative C names this table effect_texture_ids, and the supplied constructor initializes the same byte from that table. This proves an animated texture ID, rather than an animation index or offset-only field. --- .../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 c0db14a84a..a975fa060d 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 @@ -3296,7 +3296,7 @@ typedef struct PV { typedef struct Moby_26ff10 { u8 b00_26ff10; char pad01; - u8 b02; + u8 animated_texture_id; char pad03; u32 f04; u8 f08; @@ -3377,7 +3377,7 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff particle->posv.f[2] = particle->posv.f[2] + random_float_between(nsp, sp); } tab = effect_texture_ids; - particle->b02 = tab[(particle->h0A + pv->f16 + (particle->b02 - tab[0])) & 7]; + particle->animated_texture_id = tab[(particle->h0A + pv->f16 + (particle->animated_texture_id - tab[0])) & 7]; fast_vec_add(v0u.f, particle->posv.f, pv); k = pv->f14; if (scale_game_frames(3) < k) { From afb4928b46482fb13456d0d5fce3019a1e5e07b2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:44:14 +0000 Subject: [PATCH 571/758] decomp: clarify names in handle_extermitank_hits_and_sync_children unk174 -> firing_range_xy: Retail 00305738..0030575c writes 14.0f or 20.0f to pvars+0x174 according to the +0x178 timer result. In the authoritative extermitank_update C, vector_distance_xy(parent position, hero position) is compared with this field to enter EXTERMITANK_FIRE_PARTICLES, and exceeding the same range exits firing. This proves the horizontal firing-range threshold, not movement speed. unk178 -> firing_range_timer: Retail 003056c0..003056d8 tests pvars+0x178 for zero, stores scale_game_frames(0xf0) there when +0x38 is set, then clears +0x38. At 00305738..0030575c its address is passed to fast_dec_timer and the return selects pvars+0x174 as 14.0f or 20.0f. The supplied C uses +0x174 as the XY firing threshold, proving a countdown controlling firing range without assigning a specific meaning to the trigger. unk194 -> turret_yaw: Retail 00305518..00305528 copies pvars+0x194 into the Z component of the cleared effect rotation data. The authoritative extermitank_update initializes it from parent rot.z, steps it toward atan2(hero XY minus parent XY), uses its cosine/sine for firing particle directions, and subtracts parent rot.z before building the axis-2 manipulator quaternion. Together these uses prove the turret's world yaw angle. unk19E -> removal_scaled_frames: Retail 003054fc..00305504 calls scale_game_frames with l05_extermitank_removal_base_frames and stores the return as a halfword at pvars+0x19e. Immediately afterward 0030550c..00305514 assigns EXTERMITANK_REMOVE to the parent state. The C agrees exactly, proving a scaled removal frame count; no countdown or later consumer is asserted. unk84 -> child_animation_speed_bias: Retail 00305798..003057ac loads pvars+0x84, multiplies it by extermitank_child_animation_speed_offset_scale_gp and adds the product to child +0x184's animation speed at +0x58. Retail 00305808..0030581c subtracts the same scaled field from child +0x188's speed. The C agrees: this is the input bias producing opposite child animation-speed adjustments; physical units and child anatomy are not assumed. --- src/overlays/l05/mobys/extermitank.c | 60 ++++++++++++++-------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/overlays/l05/mobys/extermitank.c b/src/overlays/l05/mobys/extermitank.c index 6126ebade9..de136728d8 100644 --- a/src/overlays/l05/mobys/extermitank.c +++ b/src/overlays/l05/mobys/extermitank.c @@ -121,7 +121,7 @@ typedef struct ExtermitankVars { f32 unk78; f32 unk7C; u8 pad_80[0x4]; - f32 unk84; + f32 child_animation_speed_bias; u8 pad_88[0xC]; f32 unk94; u8 pad_98[0x14]; @@ -142,18 +142,18 @@ typedef struct ExtermitankVars { u8 pad_131[0xF]; f32 unk140[4]; u8 pad_150[0x24]; - f32 unk174; - s32 unk178; + f32 firing_range_xy; + s32 firing_range_timer; u8 pad_17C[0x4]; s32 unk180; char *unk184; char *unk188; u8 pad_18C[0x4]; s32 path_190; - f32 unk194; + f32 turret_yaw; f32 unk198; u8 pad_19C[0x2]; - s16 unk19E; + s16 removal_scaled_frames; f32 particle_slots[4]; } ExtermitankVars; @@ -247,7 +247,7 @@ void extermitank_update(unsigned char *moby) { *(int *)&extermitank_vars->unk198 = 0; { float t = *(volatile float *)&D_L05_00161B78; - extermitank_vars->unk194 = *(volatile float *)(moby + 0x48); + extermitank_vars->turret_yaw = *(volatile float *)(moby + 0x48); extermitank_vars->unk58 = truncate_float_to_s32(t); } extermitank_vars->unk5A = truncate_float_to_s32(D_L05_00161B7C * 8.0f); @@ -279,7 +279,7 @@ void extermitank_update(unsigned char *moby) { *(int *)pp = idx; } h = ((char *)&D_0013F350 + 0x80); - if (vector_distance_xy(moby + 0x10, h) < extermitank_vars->unk174) { + if (vector_distance_xy(moby + 0x10, h) < extermitank_vars->firing_range_xy) { if (absolute_float(MOBY(moby)->pos.z - *(float *)(h + 8)) < 4.0f) { if (extermitank_vars->path_190 == -1 || FUN_L00_00259740(h, @@ -299,12 +299,12 @@ void extermitank_update(unsigned char *moby) { char *g = ((char *)&D_0013F350); float a = fast_arc_tan(*(float *)(g + 0x80) - MOBY(moby)->pos.x, *(float *)(g + 0x84) - MOBY(moby)->pos.y); - step_angle_toward_target(&extermitank_vars->unk194, 0, a, D_0015ED6C_gp * 1.5707964f); + step_angle_toward_target(&extermitank_vars->turret_yaw, 0, a, D_0015ED6C_gp * 1.5707964f); step_angle_toward_target( &extermitank_vars->unk198, 0, 0.08726646f, D_0015ED6C_gp * 1.5707964f); } else { step_angle_toward_target( - &extermitank_vars->unk194, 0, MOBY(moby)->rot.z, D_0015ED6C_gp * 1.5707964f); + &extermitank_vars->turret_yaw, 0, MOBY(moby)->rot.z, D_0015ED6C_gp * 1.5707964f); step_angle_toward_target( &extermitank_vars->unk198, 0, 0.0f, D_0015ED6C_gp * 1.5707964f); } @@ -312,7 +312,7 @@ void extermitank_update(unsigned char *moby) { build_axis_rotation_quaternion( extermitank_vars->unk100, 2, - fast_subtract_rotations(extermitank_vars->unk194, MOBY(moby)->rot.z)); + fast_subtract_rotations(extermitank_vars->turret_yaw, MOBY(moby)->rot.z)); break; } case EXTERMITANK_FIRE_PARTICLES: { @@ -354,10 +354,10 @@ void extermitank_update(unsigned char *moby) { working_position[1] += random_float_between(-0.065f, 0.065f); working_position[2] += random_float_between(-0.065f, 0.065f); particle_vector_a[0] = - fast_cos(extermitank_vars->unk194) * + fast_cos(extermitank_vars->turret_yaw) * (extermitank_tracked_particle_vector_a_xy_scale_gp * D_0015ED6C_gp); particle_vector_a[1] = - fast_sin(extermitank_vars->unk194) * + fast_sin(extermitank_vars->turret_yaw) * (extermitank_tracked_particle_vector_a_xy_scale_gp * D_0015ED6C_gp); particle_vector_a[2] = 0.0f; particle_vector_a[2] = random_float_between( @@ -367,10 +367,10 @@ void extermitank_update(unsigned char *moby) { extermitank_tracked_particle_vector_b_spread_degrees_gp) * 0.017453292f; particle_vector_b[0] = - fast_cos(fast_add_rotations(extermitank_vars->unk194, ang)) * + fast_cos(fast_add_rotations(extermitank_vars->turret_yaw, ang)) * (extermitank_tracked_particle_vector_b_xy_scale_gp * D_0015ED6C_gp); particle_vector_b[1] = - fast_sin(fast_add_rotations(extermitank_vars->unk194, ang)) * + fast_sin(fast_add_rotations(extermitank_vars->turret_yaw, ang)) * (extermitank_tracked_particle_vector_b_xy_scale_gp * D_0015ED6C_gp); particle_vector_b[2] = 0.0f; particle_vector_b[2] = random_float_between( @@ -419,10 +419,10 @@ void extermitank_update(unsigned char *moby) { extermitank_secondary_particle_vector_a_spread_degrees_gp) * 0.017453292f; particle_vector_a[0] = - fast_cos(fast_add_rotations(extermitank_vars->unk194, ang)) * + fast_cos(fast_add_rotations(extermitank_vars->turret_yaw, ang)) * (extermitank_secondary_particle_vector_a_xy_scale_gp * D_0015ED6C_gp); particle_vector_a[1] = - fast_sin(fast_add_rotations(extermitank_vars->unk194, ang)) * + fast_sin(fast_add_rotations(extermitank_vars->turret_yaw, ang)) * (extermitank_secondary_particle_vector_a_xy_scale_gp * D_0015ED6C_gp); particle_vector_a[2] = 0.0f; particle_vector_a[2] = random_float_between( @@ -432,10 +432,10 @@ void extermitank_update(unsigned char *moby) { extermitank_secondary_particle_vector_b_spread_degrees_gp) * 0.017453292f; particle_vector_b[0] = - fast_cos(fast_add_rotations(extermitank_vars->unk194, ang)) * + fast_cos(fast_add_rotations(extermitank_vars->turret_yaw, ang)) * (extermitank_secondary_particle_vector_b_xy_scale_gp * D_0015ED6C_gp); particle_vector_b[1] = - fast_sin(fast_add_rotations(extermitank_vars->unk194, ang)) * + fast_sin(fast_add_rotations(extermitank_vars->turret_yaw, ang)) * (extermitank_secondary_particle_vector_b_xy_scale_gp * D_0015ED6C_gp); particle_vector_b[2] = 0.0f; particle_vector_b[2] = random_float_between( @@ -463,7 +463,7 @@ void extermitank_update(unsigned char *moby) { qcopy(working_position, moby + 0x10); working_position[2] = working_position[2] + 3.0f; h = ((char *)&D_0013F350 + 0x80); - if (extermitank_vars->unk174 < vector_distance_xy(moby + 0x10, h) || + if (extermitank_vars->firing_range_xy < vector_distance_xy(moby + 0x10, h) || 4.0f <= absolute_float(MOBY(moby)->pos.z - *(float *)(h + 8)) || (extermitank_vars->path_190 != -1 && FUN_L00_00259740(h, @@ -478,7 +478,7 @@ void extermitank_update(unsigned char *moby) { char *g = ((char *)&D_0013F350); float a = fast_arc_tan(*(float *)(g + 0x80) - MOBY(moby)->pos.x, *(float *)(g + 0x84) - MOBY(moby)->pos.y); - step_angle_toward_target(&extermitank_vars->unk194, 0, a, D_0015ED6C_gp * 1.5707964f); + step_angle_toward_target(&extermitank_vars->turret_yaw, 0, a, D_0015ED6C_gp * 1.5707964f); step_angle_toward_target( &extermitank_vars->unk198, 0, 0.08726646f, D_0015ED6C_gp * 1.5707964f); } @@ -486,7 +486,7 @@ void extermitank_update(unsigned char *moby) { build_axis_rotation_quaternion( extermitank_vars->unk100, 2, - fast_subtract_rotations(extermitank_vars->unk194, MOBY(moby)->rot.z)); + fast_subtract_rotations(extermitank_vars->turret_yaw, MOBY(moby)->rot.z)); break; } case EXTERMITANK_REMOVE: @@ -650,10 +650,10 @@ void handle_extermitank_hits_and_sync_children(char *moby) { 1, -1, 0); - extermitank_hit_sync_vars->unk19E = scale_game_frames(l05_extermitank_removal_base_frames); + extermitank_hit_sync_vars->removal_scaled_frames = scale_game_frames(l05_extermitank_removal_base_frames); MOBY(moby)->state = EXTERMITANK_REMOVE; clear_u64_value(effect_data); - *(float *)(effect_data + 8) = extermitank_hit_sync_vars->unk194; + *(float *)(effect_data + 8) = extermitank_hit_sync_vars->turret_yaw; spawn_particle_305178(moby, 0x6dd, moby + 0x10, @@ -745,8 +745,8 @@ void handle_extermitank_hits_and_sync_children(char *moby) { ((unsigned char *)extermitank_hit_sync_vars->unk184)[0xa4] = 0xff; if (extermitank_hit_sync_vars->unk188 != 0) ((unsigned char *)extermitank_hit_sync_vars->unk188)[0xa4] = 0xff; - if (extermitank_hit_sync_vars->unk38 != 0 && extermitank_hit_sync_vars->unk178 == 0) { - extermitank_hit_sync_vars->unk178 = scale_game_frames(0xf0); + if (extermitank_hit_sync_vars->unk38 != 0 && extermitank_hit_sync_vars->firing_range_timer == 0) { + extermitank_hit_sync_vars->firing_range_timer = scale_game_frames(0xf0); extermitank_hit_sync_vars->unk38 = 0; hero_turn_reference = &hero; angle = fast_arc_tan(hero_turn_reference->motion.pos.f[0] - MOBY(moby)->pos.x, @@ -754,10 +754,10 @@ void handle_extermitank_hits_and_sync_children(char *moby) { if (fast_difference_between_rotations(MOBY(moby)->rot.z, angle) > 1.5707964f) ((signed char *)extermitank_hit_sync_vars)[0xc4] *= -1; } - if (fast_dec_timer(&extermitank_hit_sync_vars->unk178) != 0) - extermitank_hit_sync_vars->unk174 = 20.0f; + if (fast_dec_timer(&extermitank_hit_sync_vars->firing_range_timer) != 0) + extermitank_hit_sync_vars->firing_range_xy = 20.0f; else - extermitank_hit_sync_vars->unk174 = 14.0f; + extermitank_hit_sync_vars->firing_range_xy = 14.0f; if (extermitank_hit_sync_vars->unk184 != 0) { char *first; float offset_scale; @@ -766,7 +766,7 @@ void handle_extermitank_hits_and_sync_children(char *moby) { offset_scale = extermitank_child_animation_speed_offset_scale_gp; *(float *)(extermitank_hit_sync_vars->unk184 + 0x58) = speed; *(float *)(extermitank_hit_sync_vars->unk184 + 0x58) += - extermitank_hit_sync_vars->unk84 * offset_scale; + extermitank_hit_sync_vars->child_animation_speed_bias * offset_scale; first = extermitank_hit_sync_vars->unk184; qcopy(first + 0x40, moby + 0x40); qcopy(first + 0x10, moby + 0x10); @@ -779,7 +779,7 @@ void handle_extermitank_hits_and_sync_children(char *moby) { offset_scale = extermitank_child_animation_speed_offset_scale_gp; *(float *)(extermitank_hit_sync_vars->unk188 + 0x58) = speed; *(float *)(extermitank_hit_sync_vars->unk188 + 0x58) -= - extermitank_hit_sync_vars->unk84 * offset_scale; + extermitank_hit_sync_vars->child_animation_speed_bias * offset_scale; second = extermitank_hit_sync_vars->unk188; qcopy(second + 0x40, moby + 0x40); qcopy(second + 0x10, moby + 0x10); From fc43e1e2f5cb5b47b96cb9121a6e5a00db6fd21f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:46:10 +0000 Subject: [PATCH 572/758] decomp: clarify names in help_hints_update f6E -> hint_clip_volume_visited: In the SHA-bound C, this byte of Items at alternate_item_available is tested for zero before testing hero.motion.pos against hint_dialogue_data->vol2C, and set to 1 only when inside. Retail 0x002edac0-0x002edac8 loads/tests byte +0x6E at base 0x0013D388; 0x002edad4 loads pvars +0x2C as the clip volume, 0x002edad8 calls the existing is_point_inside_clip_volume binding with hero position, and 0x002edae0-0x002edae8 writes 1 on success. Thus it records visitation of this hint clip volume, without claiming its unknown gameplay identity. f6F -> giant_clank_zone_hint_suppressed: Authoritative C sets this Items byte when hero.moby->seq == 0xC and hero.vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK; it requires the same byte to be zero before zone vol1C can request hint 0x3A9C/0x80. Retail 0x002ed8cc-0x002ed8f4 checks moby sequence +0x52 and vehicle mode 2 then stores 1 at alternate_item_available +0x6F. Retail 0x002ed8fc-0x002ed928 checks the hero clip volume, same Giant Clank mode and byte +0x6F, branching past the request when nonzero; 0x002ed960 issues the gated request. This proves its Giant Clank zone-hint suppression role without naming the unknown action represented by sequence 0xC. --- src/overlays/l15/mobys/help_hints.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l15/mobys/help_hints.c b/src/overlays/l15/mobys/help_hints.c index e870de59cc..272000aafc 100644 --- a/src/overlays/l15/mobys/help_hints.c +++ b/src/overlays/l15/mobys/help_hints.c @@ -42,8 +42,8 @@ typedef struct Stats { typedef struct Items { char p0[0x6E]; - unsigned char f6E; - unsigned char f6F; + unsigned char hint_clip_volume_visited; + unsigned char giant_clank_zone_hint_suppressed; } Items; extern unsigned char D_0013D4DF_2ed398[] __asm__("D_0013D4DF"); @@ -181,11 +181,11 @@ void help_hints_update(struct Moby *moby) { } } if (hero.moby->seq == 0xC && hero.vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK) { - ((Items *)alternate_item_available)->f6F = 1; + ((Items *)alternate_item_available)->giant_clank_zone_hint_suppressed = 1; } if (is_point_inside_clip_volume(&hero.motion.pos, hint_dialogue_data->vol1C) != 0 && hero.vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK && - ((Items *)alternate_item_available)->f6F == 0 && + ((Items *)alternate_item_available)->giant_clank_zone_hint_suppressed == 0 && ((Help *)quartu_help_message_state)->busy == 0 && ((Help *)quartu_help_message_state)->cur == -1 && *(int *)(item_usage + 0x6EC) >= 0) { help_request(0x3A9C, 0x80); @@ -224,9 +224,9 @@ void help_hints_update(struct Moby *moby) { hint_dialogue_data->last = pick; hint_dialogue_data->hold38 = 0; } - if (((Items *)alternate_item_available)->f6E == 0 && + if (((Items *)alternate_item_available)->hint_clip_volume_visited == 0 && is_point_inside_clip_volume(&hero.motion.pos, hint_dialogue_data->vol2C) != 0) { - ((Items *)alternate_item_available)->f6E = 1; + ((Items *)alternate_item_available)->hint_clip_volume_visited = 1; } break; } From 3d0ff8abb5d8fd54a9d29684d14e7124df5ba575 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:46:13 +0000 Subject: [PATCH 573/758] decomp: clarify names in handle_extermibot_hits_and_update_targeting b67 -> hit_flash_target: Retail 0x003035b4, 0x0030365c and 0x00303720 set this byte to 250/120/240 for flash responses. Supplied checked helper findings show pvars+0x60 channel +4 interpolated toward +7 (this member) and back by animation finish. It is the flash target channel value, not a proven duration. f120 -> selected_target_position_xy: Retail 0x00303800/0x00303818 passes this address as output state to 0x00289fc0. Checked helper 0x0028a350-0x0028a360 copies selected moby position (+0x10) to output+0; caller 0x0030383c compares its XY distance to the start position. Preserve char[8] storage. f128 -> selected_target_position_z: Checked helper 0x0028a35c-0x0028a360 copies selected moby position into the state starting at pvars+0x120, making +0x128 its Z component. Assigned 0x00303858-0x00303874 subtracts it from moby Z and tests absolute vertical separation against 3. f164 -> target_selection_status: Assigned 0x00303854/0x00303884 writes 2 on range/height rejection, 0x003038a8 tests 2 before replacement, and 0x003038ec writes 1 when installing a candidate. Checked selection helper 0x0028a410 writes its return status to output+0x44, this same field. f170 -> first_joint_animation: Retail 0x00303aa0-0x00303ab8 passes this state address to established update_joint_animation with joint index 1. Checked helper 0x0028ce04 retains the state, and 0x0028cfa4-0x0028cfb0 passes it with the retained joint index to the animation attachment operation. This names the actual joint-index association. f1D4 -> first_joint_target_pitch: Retail 0x003039b4-0x003039d4 derives negative target elevation angle, clamps it to +/-0.5235988 and stores at 0x00303a78. Relative to first joint state +0x170 this is +0x64; checked helper 0x0028cf58-0x0028cf70 loads +0x64 as angle target while updating current angle +0x44. f1D8 -> first_joint_target_yaw: Assigned 0x00303998-0x003039ac computes target bearing minus moby yaw, clamps/mirrors it and stores 70 percent at 0x00303a80. Checked joint helper 0x0028cf78-0x0028cf90 consumes state+0x68, this member relative to +0x170, as target for current angle +0x48. f1F0 -> second_joint_animation: Assigned 0x00303acc-0x00303ad8 passes this address to update_joint_animation with joint index 2. Checked helper retains a2 as the joint index at 0x0028cdf4 and uses the supplied state with that index at 0x0028cfa4-0x0028cfb0. Preserve char[16] declaration and underlying layout. f258 -> second_joint_target_yaw: Retail 0x00303a7c/0x00303a84 stores 30 percent of clamped target-relative yaw here. It is +0x68 relative to the second joint state passed at 0x00303acc; checked helper 0x0028cf78-0x0028cf90 consumes +0x68 as angle target for current angle +0x48. f270 -> start_position: Authoritative extermibot_update initializes the same pvars+0x270 with moby position, uses it as the wander origin and return-to-start destination. Assigned retail 0x0030383c-0x00303854 measures XY separation from this vector to selected-target position to reject targets beyond the permitted range. f29C -> base_targeting_range: Retail 0x003037dc loads this float, adds 20 only while the boost timer is nonzero, then stores the effective range at +0x2a0. Checked selection helper retains that effective scalar in f21 and compares candidate XY distance to it at 0x0028a1ac and 0x0028a2b8. f2A0 -> effective_targeting_range: Retail 0x003037d4-0x003037f0 computes this as base range plus optional 20. It is passed in f12 at 0x00303808 to selection helper, whose 0x0028a1ac/0x0028a2b8 use it to bound candidate distance; 0x00303844-0x00303854 also bounds start-to-target XY separation with it. f2B0 -> targeting_range_boost_timer: Retail 0x0030379c-0x003037c4 initializes this integer from scaled random 180..240 frames, decrements it at 0x003037cc, and 0x003037d4-0x003037f0 adds 20 to targeting range while nonzero. This proves the temporary targeting-range boost timer role. f2C8 -> target_group_index: Retail 0x00303888 loads this integer into a1, skips negative indices at 0x0030388c and calls 0x00303f80 at 0x00303894. Supplied established find_nearest_extermibot_group_target C uses its second argument to index the target-group list and returns its nearest eligible moby. f2CC -> targeting_path_index: Retail 0x003037f4-0x00303814 scales this integer by four to select l05_paths; 0x00303824-0x00303830 passes that path's count and points to target selection. Checked helper uses those points/count for candidate eligibility tests at 0x0028a1f8-0x0028a218 and 0x0028a308-0x0028a328. f2D4 -> path_stuck_timer: Assigned retail 0x003033b8-0x003033bc decrements this timer each update. Supplied same-file move_extermibot_along_path uses pvars+0x2d4 as its stuck_timer, setting five scaled frames when path wall distance exceeds 2 and the timer is zero. This names the shared storage by its demonstrated producer. f2D8 -> glow_pulse_phase: Retail 0x0030391c-0x00303930 advances and stores this angle using fast_add_rotations and frame time times 9.424778. Its oscillating function result is mapped to 0..1 at 0x00303934-0x00303954 for fast_tween_color, whose result becomes moby glow_color at 0x0030395c. f38 -> targeting_range_boost_pending: Assigned retail 0x00303790 checks this integer; when nonzero, 0x0030379c-0x003037c4 refreshes the timed 20-unit targeting-range boost, then 0x003037c8 clears the integer. The name states the demonstrated consumed request role without claiming which event sets it. f80 -> knockback_gravity: Assigned 0x00303554-0x00303584 sets this from extermibot_knockback_gravity_gp times frame_time_sq and 0x00303670-0x003036a4 applies death gravity. Supplied checked motion-helper findings at 0x0028694c-0x00286960 subtract this pvars+0x80 scalar from vertical motion, establishing gravitational acceleration. f88 -> knockback_xy_magnitude: Retail 0x003035c0-0x003035e8 and 0x00303674-0x003036b0 initialize this from established nonlethal/death XY knockback globals times frame time. 0x00303624 and 0x003036ec pass its address to knockback arc; supplied checked arc evidence scales this first output by hit-vector XY length. f8C -> knockback_z_magnitude: Retail 0x003035c4-0x003035ec and 0x00303678-0x003036b4 initialize this from established nonlethal/death Z knockback globals times frame time. 0x0030362c and 0x003036f4 pass its address as the fourth arc argument; supplied checked arc evidence scales this output by hit-vector Z. --- src/overlays/l05/mobys/extermibot.c | 116 ++++++++++++++-------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/src/overlays/l05/mobys/extermibot.c b/src/overlays/l05/mobys/extermibot.c index ed56d15076..be0fe9be7b 100644 --- a/src/overlays/l05/mobys/extermibot.c +++ b/src/overlays/l05/mobys/extermibot.c @@ -670,17 +670,17 @@ typedef struct Wing { char pad0[0x20]; float hp; char pad1[0x14]; - int f38; + int targeting_range_boost_pending; char pad2[0x24]; short f60[3]; char pad3[0x1]; - unsigned char b67; + unsigned char hit_flash_target; char pad4[0x8]; char f70[16]; - float f80; + float knockback_gravity; char pad5[0x4]; - float f88; - float f8C; + float knockback_xy_magnitude; + float knockback_z_magnitude; int f90; int f94; float f98; @@ -690,33 +690,33 @@ typedef struct Wing { float fC0; float fC4; char pad8[0x58]; - char f120[8]; - float f128; + char selected_target_position_xy[8]; + float selected_target_position_z; char pad9[0x34]; struct Moby *target; - int f164; + int target_selection_status; char pad10[0x8]; - char f170[16]; + char first_joint_animation[16]; char pad11[0x54]; - float f1D4; - float f1D8; + float first_joint_target_pitch; + float first_joint_target_yaw; char pad12[0x14]; - char f1F0[16]; + char second_joint_animation[16]; char pad13[0x58]; - float f258; + float second_joint_target_yaw; char pad14[0x14]; - char f270[16]; + char start_position[16]; char pad15[0x1C]; - float f29C; - float f2A0; + float base_targeting_range; + float effective_targeting_range; char pad16[0xC]; - int f2B0; + int targeting_range_boost_timer; char pad17[0x14]; - int f2C8; - int f2CC; + int target_group_index; + int targeting_path_index; char pad18[0x4]; - int f2D4; - float f2D8; + int path_stuck_timer; + float glow_pulse_phase; } Wing; int l05_extermibot_glow_color_start __asm__("D_L05_00161A74") = 0x80004000; @@ -776,7 +776,7 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { int k; moby_data = *(struct Wing **)&moby->pvars; - fast_dec_timer(&moby_data->f2D4); + fast_dec_timer(&moby_data->path_stuck_timer); dmg = 0.0f; hit_record = func_L00_0025B478_3047E8(moby, 0x330000, 0); if (hit_record != 0) { @@ -810,7 +810,7 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { } k = truncate_float_to_s32(D_L05_00161A98_gp * 409.6f); moby_data->f98 = D_L05_00161A98_gp * 0.4f; - moby_data->f80 = extermibot_knockback_gravity_gp * D_0015ED70; + moby_data->knockback_gravity = extermibot_knockback_gravity_gp * D_0015ED70; moby_data->f90 = k; moby_data->f94 = 9; moby_data->bAD = 0; @@ -820,7 +820,7 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { break; case EXTERMIBOT_HIT_FLASH: case EXTERMIBOT_HIT_FLASH_ONLY: - moby_data->b67 = 0xFA; + moby_data->hit_flash_target = 0xFA; break; case EXTERMIBOT_HIT_NONLETHAL_KNOCKBACK: case EXTERMIBOT_HIT_KNOCKBACK_AND_FLASH: @@ -829,34 +829,34 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { case EXTERMIBOT_HIT_START_NONLETHAL_KNOCKBACK_AND_FLASH: case EXTERMIBOT_HIT_START_KNOCKBACK_WITH_FLASH: moby_data->fC0 = 5.0f; - moby_data->f88 = extermibot_nonlethal_knockback_xy_scale_gp * D_0015ED6C; - moby_data->f8C = extermibot_nonlethal_knockback_z_scale_gp * D_0015ED6C; + moby_data->knockback_xy_magnitude = extermibot_nonlethal_knockback_xy_scale_gp * D_0015ED6C; + moby_data->knockback_z_magnitude = extermibot_nonlethal_knockback_z_scale_gp * D_0015ED6C; moby_data->fC4 = 10.0f; nonlethal_knockback_heading = fast_arc_tan(moby->pos.x - hit_record->who->pos.x, moby->pos.y - hit_record->who->pos.y); *(u128_3047E8 *)working_vector = hit_record->dir; trooper_knockback_arc( - working_vector, &nonlethal_knockback_heading, &moby_data->f88, &moby_data->f8C); + working_vector, &nonlethal_knockback_heading, &moby_data->knockback_xy_magnitude, &moby_data->knockback_z_magnitude); trooper_start_knockback(moby, moby_data->f70, nonlethal_knockback_heading, 5, 1, 0); moby->state = EXTERMIBOT_NONLETHAL_KNOCKBACK; - moby_data->b67 = 0x78; + moby_data->hit_flash_target = 0x78; break; case EXTERMIBOT_HIT_LETHAL: case EXTERMIBOT_HIT_DEATH_KNOCKBACK: moby->flags &= 0xEFFF; - moby_data->f80 = extermibot_death_knockback_gravity_gp * D_0015ED70; - moby_data->f88 = extermibot_death_knockback_xy_scale_gp * D_0015ED6C; - moby_data->f8C = extermibot_death_knockback_z_scale_gp * D_0015ED6C; + moby_data->knockback_gravity = extermibot_death_knockback_gravity_gp * D_0015ED70; + moby_data->knockback_xy_magnitude = extermibot_death_knockback_xy_scale_gp * D_0015ED6C; + moby_data->knockback_z_magnitude = extermibot_death_knockback_z_scale_gp * D_0015ED6C; moby_data->fC0 = 5.5f; moby_data->fC4 = 11.0f; death_knockback_heading = fast_arc_tan(moby->pos.x - hit_record->who->pos.x, moby->pos.y - hit_record->who->pos.y); *(u128_3047E8 *)working_vector = hit_record->dir; trooper_knockback_arc( - working_vector, &death_knockback_heading, &moby_data->f88, &moby_data->f8C); + working_vector, &death_knockback_heading, &moby_data->knockback_xy_magnitude, &moby_data->knockback_z_magnitude); trooper_start_knockback(moby, moby_data->f70, death_knockback_heading, 6, 1, 0); moby->state = EXTERMIBOT_DEATH_KNOCKBACK; - moby_data->b67 = 0xF0; + moby_data->hit_flash_target = 0xF0; if (hit_record->who != 0 && *(struct Moby **)&hit_record->who->pclass != 0 && *(short *)((u8 *)((struct Moby *)hit_record->who->pclass) + 0x46) == 5) { stop_animation_l08(moby, 0x800, -1); @@ -869,45 +869,45 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { } moby->hit_slot = 0xFF; trooper_anim_finish(moby, moby_data->f60); - if (moby_data->f38 != 0) { - moby_data->f2B0 = truncate_float_to_s32(scale_time(random_float_between(180.0f, 240.0f))); - moby_data->f38 = 0; + if (moby_data->targeting_range_boost_pending != 0) { + moby_data->targeting_range_boost_timer = truncate_float_to_s32(scale_time(random_float_between(180.0f, 240.0f))); + moby_data->targeting_range_boost_pending = 0; } - fast_dec_timer(&moby_data->f2B0); - if (moby_data->f2B0 != 0) { - moby_data->f2A0 = moby_data->f29C + 20.0f; + fast_dec_timer(&moby_data->targeting_range_boost_timer); + if (moby_data->targeting_range_boost_timer != 0) { + moby_data->effective_targeting_range = moby_data->base_targeting_range + 20.0f; } else { - moby_data->f2A0 = moby_data->f29C; + moby_data->effective_targeting_range = moby_data->base_targeting_range; } - if (activate_effect_l08(moby_data->f2A0, + if (activate_effect_l08(moby_data->effective_targeting_range, moby, - moby_data->f120, + moby_data->selected_target_position_xy, 0, 0, - ((Path_3047E8 *)l05_paths[moby_data->f2CC])->pts, - ((Path_3047E8 *)l05_paths[moby_data->f2CC])->n) != 2) { - if (moby_data->f2A0 < vector_distance_xy(moby_data->f270, moby_data->f120) || - 3.0f < func_001F9B88_3047E8(moby->pos.z - moby_data->f128)) { - moby_data->f164 = 2; + ((Path_3047E8 *)l05_paths[moby_data->targeting_path_index])->pts, + ((Path_3047E8 *)l05_paths[moby_data->targeting_path_index])->n) != 2) { + if (moby_data->effective_targeting_range < vector_distance_xy(moby_data->start_position, moby_data->selected_target_position_xy) || + 3.0f < func_001F9B88_3047E8(moby->pos.z - moby_data->selected_target_position_z)) { + moby_data->target_selection_status = 2; } } - if (moby_data->f2C8 >= 0) { - Moby *candidate_target = func_L05_003053D8_3047E8(moby, moby_data->f2C8); + if (moby_data->target_group_index >= 0) { + Moby *candidate_target = func_L05_003053D8_3047E8(moby, moby_data->target_group_index); if (candidate_target != 0) { - if (moby_data->f164 == 2 || + if (moby_data->target_selection_status == 2 || vector_distance_xy(((float *)&moby->pos), ((float *)&candidate_target->pos)) < vector_distance_xy(((float *)&moby->pos), ((float *)&moby_data->target->pos))) { moby_data->target = candidate_target; - moby_data->f164 = 1; + moby_data->target_selection_status = 1; } } } if (moby_data->target == 0) { moby_data->target = (*(Moby **)D_001413D0_lui); } - moby_data->f2D8 = fast_add_rotations(moby_data->f2D8, D_0015ED6C * 9.424778f); + moby_data->glow_pulse_phase = fast_add_rotations(moby_data->glow_pulse_phase, D_0015ED6C * 9.424778f); moby->glow_color = fast_tween_color( - l05_extermibot_glow_color_start, l05_extermibot_glow_color_end, (func_001F9FA8_3047E8(moby_data->f2D8) + 1.0f) * 0.5f); + l05_extermibot_glow_color_start, l05_extermibot_glow_color_end, (func_001F9FA8_3047E8(moby_data->glow_pulse_phase) + 1.0f) * 0.5f); k = moby->state; if (k < 10) { if (k >= 4 && moby_data->target == (*(Moby **)D_001413D0_lui)) { @@ -930,13 +930,13 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { } else if (pitch < -0.5235988f) { pitch = -0.5235988f; } - moby_data->f1D4 = pitch; - moby_data->f1D8 = yaw * 0.7f; - moby_data->f258 = yaw * 0.3f; + moby_data->first_joint_target_pitch = pitch; + moby_data->first_joint_target_yaw = yaw * 0.7f; + moby_data->second_joint_target_yaw = yaw * 0.3f; } } - update_joint_animation(moby, moby_data->f170, 1, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f); - update_joint_animation(moby, moby_data->f1F0, 2, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f); + update_joint_animation(moby, moby_data->first_joint_animation, 1, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f); + update_joint_animation(moby, moby_data->second_joint_animation, 2, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f); } extern int frame_number __asm__("D_L05_0015F5CC"); From 5ad1ba144c89522b0199d4ae058514ba9bf02632 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:46:14 +0000 Subject: [PATCH 574/758] decomp: clarify names in update_toxic_crab_hit_reactions_and_targeting domain_0_value_2 -> POINT_AHEAD_NO_TARGET: Retail 0x002e45b8-0x002e45c8 passes pvars+0x120 as helper output; helper 0x002527e8 retains that output in s2 and 0x00252a0c stores selection status at output+0x44, exactly pvars+0x164. Helper 0x00252830-0x00252834 clears selected moby and sets status 2; candidate selection sets status 1 at 0x002528d8/0x0025295c. Supplied find_point_ahead names the same result POINT_AHEAD_NO_TARGET. Root 0x002e45dc-0x002e4620 forces this status when home range or vertical tolerance fails after refresh. domain_1_value_2 -> POINT_AHEAD_NO_TARGET: Retail 0x002e4624-0x002e466c rejects tracked position beyond home range or height tolerance; 0x002e4678-0x002e468c calls selection helper with pvars+0x120 then stores 2 to pvars+0x164. Bounded helper 0x00252830-0x00252834 sets status 2 with null selection, and 0x002529f4-0x00252a0c clears output target and stores status at output+0x44. This is the same selection-result domain named POINT_AHEAD_NO_TARGET in supplied find_point_ahead, not moby or Hero state. domain_2_value_2 -> POINT_AHEAD_NO_TARGET: Retail 0x002e46d0-0x002e46d8 compares pvars+0x164 against 2; 0x002e46e0-0x002e46f8 increments target-loss frames and compares scaled 300 before return-home/wait transitions. This field is selection helper output+0x44 because root passes pvars+0x120 at 0x002e45b8-0x002e45c8. Helper 0x00252830-0x00252834 sets status 2 when selection is null, stored at 0x00252a0c, matching supplied POINT_AHEAD_NO_TARGET. Both root range-rejection assignments use this same status. --- src/overlays/l10/mobys/toxic_crab.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index a98f61fee3..eb76c9a832 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -1043,6 +1043,9 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { ARC_ADJUSTED_KNOCKBACK_HIT_RESPONSE = 10, SUPPRESSED_HIT_RESPONSE = 11 }; + enum { + POINT_AHEAD_NO_TARGET = 2 + }; Moby *moby = mv; AlignedVec4f vA; AlignedVec4f vB; @@ -1215,12 +1218,12 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { func_L00_00260D30_2E52B0(moby, &moby_data->a120, moby_data->f1A0); if (moby_data->f1A0 < vector_distance_xy(&moby_data->a170, &moby_data->a120) || 3.0f < absolute_float(moby->pos.z - moby_data->a120.z)) { - moby_data->target_selection_status = 2; + moby_data->target_selection_status = POINT_AHEAD_NO_TARGET; } } else if (moby_data->f1A0 < vector_distance_xy(&moby_data->a170, &moby_data->a120) || 3.0f < absolute_float(moby->pos.z - moby_data->a120.z)) { func_L00_00260D30_2E52B0(moby, &moby_data->a120, moby_data->f1A0); - moby_data->target_selection_status = 2; + moby_data->target_selection_status = POINT_AHEAD_NO_TARGET; } else { activate_effect_l08(moby_data->f1A0, moby, @@ -1230,7 +1233,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { l10_paths[moby_data->target_path_index]->points, l10_paths[moby_data->target_path_index]->count); } - if (moby->state != TOXIC_CRAB_STATE_WAIT_FOR_ACTIVATION && moby_data->target_selection_status == 2) { + if (moby->state != TOXIC_CRAB_STATE_WAIT_FOR_ACTIVATION && moby_data->target_selection_status == POINT_AHEAD_NO_TARGET) { moby_data->target_loss_frames++; if (scale_game_frames(300) < moby_data->target_loss_frames) { if (1.0f < fast_vec_dist(&moby->pos, &moby_data->a170)) { From 44d85efb37c0b229ab0ada89137d732fed6b218f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:46:17 +0000 Subject: [PATCH 575/758] decomp: clarify names in fleet_camera_box_watcher_update unk64 -> first_followup_clip_volume_index: Retail 0x002f2700 loads moby+0x78 as pvars; in pvars+0x6C phase 1, 0x002f2784 loads the s32 at pvars+0x64 into a1, and 0x002f2788/0x002f278c calls the point-in-clip-volume helper with hero position in a0. A true return branches at 0x002f2790 directly to the one-time flag/dialogue path; a false return tests the second volume from pvars+0x68 at 0x002f279c-0x002f27a8. Authoritative C expresses is_point_inside_clip_volume(&h->motion.pos, pvars->unk64) || is_point_inside_clip_volume(&h->motion.pos, pvars->unk68) in CLIP_VOLUME_SEQUENCE_MONITOR_FOLLOWUP. This proves unk64 stores the first tested followup clip-volume index, rather than a pointer or state. --- src/overlays/l17/mobys/camera_box_watcher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l17/mobys/camera_box_watcher.c b/src/overlays/l17/mobys/camera_box_watcher.c index 39a313fe9a..94d4fef110 100644 --- a/src/overlays/l17/mobys/camera_box_watcher.c +++ b/src/overlays/l17/mobys/camera_box_watcher.c @@ -64,7 +64,7 @@ typedef struct CameraBoxWatcherVars { s32 unk58; s32 unk5C; s32 unk60; - s32 unk64; + s32 first_followup_clip_volume_index; s32 unk68; s32 unk6C; s32 unk70; @@ -118,7 +118,7 @@ void fleet_camera_box_watcher_update(struct Moby *moby) { if (hero_current_state == HERO_STATE_HURT_WITH_DISPLACEMENT_VELOCITY || hero_current_state == HERO_STATE_OPTIONAL_IDLE_ANIMATION) { pvars->unk6C = 0; - } else if (is_point_inside_clip_volume(&h->motion.pos, pvars->unk64) || + } else if (is_point_inside_clip_volume(&h->motion.pos, pvars->first_followup_clip_volume_index) || is_point_inside_clip_volume(&h->motion.pos, pvars->unk68)) { if (D_0013D408[0x1C] == 0) { D_0013D408[0x1C] = 1; From 24687eb6fb7d75ef05fc0b50955775bf77a9a830 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:48:14 +0000 Subject: [PATCH 576/758] decomp: clarify names in blarg_heavy_interceptor_update unk2E -> removal_status: In authoritative source SHA-256 d04ff085388c20310836ec8fdec35b93d20740616fbcbc74794e9bc02ffc9a46, this u8 private member is tested against 2 before the state switch; equality clears flags, invokes removal and returns. Original Ghidra agrees. Retail 0x002ac65c loads pvars into s3; 0x002ac660..0x002ac670 loads byte +0x2E, compares with 2, and branches to 0x002ad670, which calls 0x00257068 with the Moby. Checked helper 0x00257068..0x002570b0 writes removal state 0xFD/0xFE at Moby+0x20, schedules frame+2 and updates grids with 0x80807F7F, matching supplied mark_moby_for_removal context. Thus removal_status names the proven status role without asserting meanings for other values. --- src/overlays/l14/mobys/blarg_heavy_interceptor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index a349ab4bca..9b8cf713fe 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -201,7 +201,7 @@ typedef struct BlargHeavyInterceptorVars { u8 pad_26[0x2]; u8 unk28; u8 pad_29[0x5]; - u8 unk2E; + u8 removal_status; u8 pad_2F[0x11]; f32 unk40[4]; u8 pad_50[0x8]; @@ -273,7 +273,7 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { int path_seg; float path_t; - if ((u8)moby_vars->unk2E == 2) { + if ((u8)moby_vars->removal_status == 2) { moby_vars->flags = 0; FUN_0020c828(moby); return; From c404639538988e122f71684f97593e8cede11bf6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:50:00 +0000 Subject: [PATCH 577/758] decomp: clarify names in update_sentrybot_hit_response_and_target_visibility domain_0_value_1 -> SENTRYBOT_TARGET_MODE_SNAPSHOT_ENGAGEMENT_SUPPRESSION: Retail 0x0029aa5c loads s1+0x114, the authoritative SentrybotVars.target_mode, and 0x0029aa60..0x0029aa64 compares it with 1. Its equal branch at 0x0029aa6c..0x0029aa78 reads alert_engagement_suppressed at +0x15b, adds one and stores saved_alert_engagement_suppression_plus_one at +0x15e. This proves the target mode's suppression-snapshot role, distinct from moby state +0x20 and all listed unrelated equal-valued constants. domain_1_value_1 -> SENTRYBOT_TARGET_MODE_SNAPSHOT_ENGAGEMENT_SUPPRESSION: Retail 0x0029aaf4..0x0029ab04 tests nonzero saved suppression at s1+0x15e and reloads the same target_mode field +0x114, comparing it with 1. Equal mode skips the forced suppression path; after leaving mode 1, a retained snapshot routes to 0x0029ab0c..0x0029ab18, setting mode 2 and detected-without-engagement. Reuse the name proven by 0x0029aa6c..0x0029aa78, which snapshots alert_engagement_suppressed+1 specifically in mode 1. --- src/overlays/shared/enemies/sentrybot.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index 349d75c444..71f0c086fe 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -1573,6 +1573,9 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i enum { SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION = 2 }; + enum { + SENTRYBOT_TARGET_MODE_SNAPSHOT_ENGAGEMENT_SUPPRESSION = 1 + }; unsigned char *moby = sentrybot_moby; SentrybotVars *sentrybot_data = (SentrybotVars *)MOBY(moby)->pvars; char *hit; @@ -1739,7 +1742,7 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i MOBY(moby)->state == SENTRYBOT_EMIT_WITH_NEGATIVE_JOINT_AIM) { seen = sentrybot_data->has_line_of_sight; } - if (sentrybot_data->target_mode == 1) + if (sentrybot_data->target_mode == SENTRYBOT_TARGET_MODE_SNAPSHOT_ENGAGEMENT_SUPPRESSION) sentrybot_data->saved_alert_engagement_suppression_plus_one = sentrybot_data->alert_engagement_suppressed + 1; else if ((unsigned char)D_001413F4[0] != 3) sentrybot_data->saved_alert_engagement_suppression_plus_one = 0; @@ -1754,7 +1757,7 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i sentrybot_data->target_detected_without_engagement = 0; } else if (((sentrybot_data->alert_timer == 0 || sentrybot_data->alert_engagement_suppressed != 0) && (unsigned char)D_001413F4[0] == 3) || - (sentrybot_data->saved_alert_engagement_suppression_plus_one != 0 && sentrybot_data->target_mode != 1)) { + (sentrybot_data->saved_alert_engagement_suppression_plus_one != 0 && sentrybot_data->target_mode != SENTRYBOT_TARGET_MODE_SNAPSHOT_ENGAGEMENT_SUPPRESSION)) { sentrybot_data->target_mode = SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION; sentrybot_data->target_detected_without_engagement = 1; } else if ((unsigned char)D_001413F4[0] != 3 && sentrybot_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { From 0d60e4288453d6a911f9917835f7967b049b5e9e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:50:04 +0000 Subject: [PATCH 578/758] decomp: clarify names in update_alien_queen_hit_response_and_recovery unk67 -> hit_reaction_tween_target: Retail 0x002fac44-0x002fac48 selects 200 for nonlethal hit responses; 0x002facd4 selects 250 for death, and 0x002facd8 stores this byte at queen pvars+0x67. Source and prepared original decompilation agree. Calls 0x002face4/0x002facf8 pass pvars+0x60 as the animation reaction record. Checked helper 0x0026c268 saves the current three parameters at record+4/+5/+6 (0x0026c310-0x0026c32c). Checked finish helper reads record+7, which is this field, at 0x0026c3d8/0x0026c3f8 and computes saved_first+(target-saved_first)*fraction at 0x0026c3f4-0x0026c420. Its second phase computes target+(saved_first-target)*fraction at 0x0026c4a4-0x0026c4e8, passing the interpolated parameter via a1 to 0x0025efb0 at 0x0026c580-0x0026c58c. Thus the field is the hit-reaction tween target endpoint, not the timer or live interpolated output; no specific visual property is inferred. --- 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 894b6d138d..a3e3643517 100644 --- a/src/overlays/l06/mobys/alien_queen.c +++ b/src/overlays/l06/mobys/alien_queen.c @@ -373,7 +373,7 @@ typedef struct AlienQueenVars { u8 pad_5B[0x5]; u8 anim_state; u8 pad_61[0x6]; - u8 unk67; + u8 hit_reaction_tween_target; u8 pad_68[0x8]; u8 unk70; u8 pad_71[0x3F]; @@ -886,7 +886,7 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { case HIT_RESPONSE_NONLETHAL_ANIMATION_MAINTENANCE: case HIT_RESPONSE_NONLETHAL_ANIMATION_FEEDBACK: case HIT_RESPONSE_NONLETHAL_ANIMATION_RESPONSE: - alien_queen_hit_recovery_vars->unk67 = 200; + alien_queen_hit_recovery_vars->hit_reaction_tween_target = 200; break; case HIT_RESPONSE_DEATH: case HIT_RESPONSE_DEATH_SEQUENCE: { @@ -902,7 +902,7 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { MOBY(moby)->flags &= 0xEFFF; if ((unsigned char)moby[0x53] != 10) FUN_00212f90(moby, 10, 0, scale_game_frames(10)); - alien_queen_hit_recovery_vars->unk67 = 0xFA; + alien_queen_hit_recovery_vars->hit_reaction_tween_target = 0xFA; break; } } From 0f6b5260c36cc3ea1b5151e5ceaf0473df669ed7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:51:56 +0000 Subject: [PATCH 579/758] decomp: clarify names in update_hero_attachment b20A5 -> probe_yaw_override_enabled: Retail 0x00234528..0x00234540 checks hero+0x2084 against 1 and 0x1E, then loads the unsigned byte hero+0x20A5 and tests it for zero. On nonzero, 0x00234544..0x0023454c copies sp+0x58 (anchored_probe_rotation.z from the sixth probe output at 0x002344d0..0x002344e0) to hero yaw +0x98 and skips the attachment_anchor_flags & 2 selection at 0x00234554..0x00234568. The supplied C expresses precisely this override before the primary_attachment_rotation.z alternative; thus probe_yaw_override_enabled names the byte's proven selection role without asserting its wider lifecycle. --- 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 3475ecba99..8a543fa7ff 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1426,7 +1426,7 @@ typedef struct Hero_234800 { char p2088[0x4]; int i208C; char p2090[0x15]; - unsigned char b20A5; + unsigned char probe_yaw_override_enabled; } Hero_234800; typedef struct { @@ -1632,7 +1632,7 @@ void update_hero_attachment(void) { &v90); if ((((Hero_234800 *)hero_233f80)->i2084 == 1 || ((Hero_234800 *)hero_233f80)->i2084 == 0x1E) && - ((Hero_234800 *)hero_233f80)->b20A5 != 0) { + ((Hero_234800 *)hero_233f80)->probe_yaw_override_enabled != 0) { ((Hero_234800 *)hero_233f80)->v90.z = anchored_probe_rotation.z; } else if (((Hero_234800 *)hero_233f80)->attachment_anchor_flags & 2) { ((Hero_234800 *)hero_233f80)->v90.z = primary_attachment_rotation.z; From a0d951dbc6b2da098042c3b7edccdd87f5b625a7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:51:59 +0000 Subject: [PATCH 580/758] decomp: clarify names in visibomb_missile_update f24 -> steering_manipulator: The authoritative spawn_visibomb_missile stores hero.unk1F60 at vars+0x24, clears that object and passes it to attach_manipulator(spawned_moby,0,...). In the assigned retail update, 0x002b66cc loads this pointer and 0x002b66e0 selects its +0x10 quaternion; 0x002b670c..0x002b673c builds an axis-1 rotation from smoothed stick inputs and their difference from missile rot.x. The original retail decompilation agrees. This proves a manipulator driven by missile steering without assigning left/right anatomy. f2C -> engine_voice_slot: Authoritative spawn_visibomb_missile initializes vars+0x2c from allocate_voice_for_target_entry(0,4,spawned_moby). Retail 0x002b63a0 loads it as a0 for the speed-derived engine_voice_set_pitch call at 0x002b63a4. Retail 0x002b68dc..0x002b6924 and 0x002b698c..0x002b69cc reject -1, multiply the slot by 0x70 to check voice_pool owner and active state, call release_voice_slot, and store -1. Original retail decompilation shows the same allocation-index consumer and release path. f44 -> launch_ground_clearance: Authoritative spawn_visibomb_missile initializes vars+0x44 to 0.4f. In the assigned retail update, 0x002b654c..0x002b656c gates correction to the initial scale_game_frames(60) interval of its scale_game_frames(3000) lifetime. After probe_ground_height at 0x002b657c, 0x002b6584 loads vars+0x44 and 0x002b658c adds it to probed ground height. Retail 0x002b6590 tests missile pos.z against that sum and 0x002b65d0..0x002b6628 approaches that height and adjusts pitch. Original retail decompilation confirms this launch-phase ground-height offset. f48 -> smoothed_speed_target: Retail 0x002b62fc..0x002b6320 selects default or held-button maximum speed and scales it by frame_time. Retail 0x002b6324..0x002b634c loads vars+0x48, blends it toward that selected goal using visibomb_missile_speed_target_blend_factor_gp and stores it back. Retail 0x002b6348..0x002b6364 then blends vars+4 toward this intermediate target using a second factor; vars+4 supplies spherical displacement length at 0x002b6514..0x002b6524. The authoritative C and original retail decompilation agree; spawn initializes +0x48 to default speed times frame_time. Thus this is the smoothed target for actual movement speed. --- .../shared/weapons/visibomb_missile.c | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/overlays/shared/weapons/visibomb_missile.c b/src/overlays/shared/weapons/visibomb_missile.c index bbc3d846cf..f4241e25dd 100644 --- a/src/overlays/shared/weapons/visibomb_missile.c +++ b/src/overlays/shared/weapons/visibomb_missile.c @@ -89,12 +89,12 @@ typedef struct D_2b6140 { float f18; float f1C; char p20[4]; - Part *f24; + Part *steering_manipulator; Part *f28; - int f2C; + int engine_voice_slot; char p30[0x14]; - float f44; - float f48; + float launch_ground_clearance; + float smoothed_speed_target; } D_2b6140; typedef struct Hit_2b6140 { @@ -870,17 +870,17 @@ void visibomb_missile_update(struct Moby *missile_moby) { float t = visibomb_missile_default_speed_gp * frame_time_macro; if (controller_state.held & 0x40) t = visibomb_missile_max_speed_gp * frame_time_macro; - missile_vars->f48 += - (t - missile_vars->f48) * visibomb_missile_speed_target_blend_factor_gp; + missile_vars->smoothed_speed_target += + (t - missile_vars->smoothed_speed_target) * visibomb_missile_speed_target_blend_factor_gp; missile_vars->f4 += - (missile_vars->f48 - missile_vars->f4) * visibomb_missile_speed_blend_factor_gp; + (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) missile_vars->f4 = visibomb_missile_max_speed_gp * frame_time_macro; } engine_voice_set_pitch( - missile_vars->f2C, + missile_vars->engine_voice_slot, truncate_float_to_s32( - (missile_vars->f48 - visibomb_missile_default_speed_gp * frame_time_macro / + (missile_vars->smoothed_speed_target - visibomb_missile_default_speed_gp * frame_time_macro / (visibomb_missile_max_speed_gp * frame_time_macro - visibomb_missile_default_speed_gp * frame_time_macro)) * visibomb_missile_speed_voice_control_scale_gp)); @@ -911,7 +911,7 @@ 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) + missile_vars->f44; + float t = probe_ground_height(&missile_moby->pos, 0, 0.5f) + missile_vars->launch_ground_clearance; if (missile_moby->pos.z < t) { if (coll_hit_moby == 0 || (coll_hit_moby->pclass != 0 && coll_hit_moby->pclass->type == 5)) { @@ -933,7 +933,7 @@ void visibomb_missile_update(struct Moby *missile_moby) { func_L00_002B6E90_2b6140(missile_moby, missile_vars); { struct Moby *skip = missile_moby; - build_axis_rotation_quaternion(&missile_vars->f24->pos, + build_axis_rotation_quaternion(&missile_vars->steering_manipulator->pos, 1, -(missile_vars->f1C * 0.5f + absolute_float(missile_vars->f18 / 3.0f) + @@ -972,14 +972,14 @@ void visibomb_missile_update(struct Moby *missile_moby) { reflect_vector(&k30, &v50, &((Hit_2b6140 *)D_L00_00173E40_2b6140)->v40); fast_vec_normalize(&k30, &k30, frame_time_macro + frame_time_macro); fast_vec_normalize(&k40, &((Hit_2b6140 *)D_L00_00173E40_2b6140)->v40, 1.0f); - if (missile_vars->f2C != -1) { - u8 *e = (u8 *)&voice_pool + missile_vars->f2C * 0x70; + if (missile_vars->engine_voice_slot != -1) { + u8 *e = (u8 *)&voice_pool + missile_vars->engine_voice_slot * 0x70; if (*(struct Moby **)(e + 0x88) == missile_moby) { if (e[0x74] != 0) - release_voice_slot(missile_vars->f2C); + release_voice_slot(missile_vars->engine_voice_slot); } } - missile_vars->f2C = -1; + missile_vars->engine_voice_slot = -1; } else if (((Hit_2b6140 *)D_L00_00173E40_2b6140)->f1C > 0) { missile_moby->command = 1; qcopy(&missile_moby->pos, &((Hit_2b6140 *)D_L00_00173E40_2b6140)->v20); @@ -990,14 +990,14 @@ void visibomb_missile_update(struct Moby *missile_moby) { reflect_vector(&k30, &v50, &((Hit_2b6140 *)D_L00_00173E40_2b6140)->v40); fast_vec_normalize(&k30, &k30, frame_time_macro + frame_time_macro); fast_vec_normalize(&k40, &((Hit_2b6140 *)D_L00_00173E40_2b6140)->v40, 1.0f); - if (missile_vars->f2C != -1) { - u8 *e = (u8 *)&voice_pool + missile_vars->f2C * 0x70; + if (missile_vars->engine_voice_slot != -1) { + u8 *e = (u8 *)&voice_pool + missile_vars->engine_voice_slot * 0x70; if (*(struct Moby **)(e + 0x88) == missile_moby) { if (e[0x74] != 0) - release_voice_slot(missile_vars->f2C); + release_voice_slot(missile_vars->engine_voice_slot); } } - missile_vars->f2C = -1; + missile_vars->engine_voice_slot = -1; } } else if (missile_vars->f10 == 0) { func_L00_002B6E10_2b6140(missile_moby, missile_vars); @@ -1007,14 +1007,14 @@ void visibomb_missile_update(struct Moby *missile_moby) { if (missile_vars->f10 < scale_game_frames(0xBB8) - scale_game_frames(0x3C)) { if (controller_state.pressed & 0x20) { missile_moby->command = 1; - if (missile_vars->f2C != -1) { - u8 *e = (u8 *)&voice_pool + missile_vars->f2C * 0x70; + if (missile_vars->engine_voice_slot != -1) { + u8 *e = (u8 *)&voice_pool + missile_vars->engine_voice_slot * 0x70; if (*(struct Moby **)(e + 0x88) == missile_moby) { if (e[0x74] != 0) - release_voice_slot(missile_vars->f2C); + release_voice_slot(missile_vars->engine_voice_slot); } } - missile_vars->f2C = -1; + missile_vars->engine_voice_slot = -1; } } if (missile_moby->command != 0) { From 437507b8147c6aad5d25f4e302bdb1bdc3065979 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:54:40 +0000 Subject: [PATCH 581/758] decomp: clarify names in skids_agent_update unk158 -> camera_start_cuboid_index: Retail 0x002e12d4-0x002e12f4 loads pvars+0x158, shifts it by seven and uses l02_cuboids record+0x30 as the first/source position of lerp_vector. Retail 0x002e12f8-0x002e1318 copies that record's +0x70 rotation; 0x002e1338-0x002e1394 adds scaled destination-minus-source angles back to these starting angles. Source then calls set_camera_position and set_camera_rotation at 0x002e1398/0x002e13a0. Thus this s32 selects the camera interpolation's starting cuboid. unk160 -> idle_look_target_position: Retail 0x002e15c4-0x002e15d0 copies hero.motion.body_center into the 16-byte storage beginning at pvars+0x160 when the hero tracking timer is cleared. Retail 0x002e1604-0x002e1674 periodically writes a spherical offset there and adds moby->pos, forming a world position. When timer_174 is zero, 0x002e16b0-0x002e16b8 copies this position into target; 0x002e16c4-0x002e1720 computes target minus the elevated moby position for head yaw/pitch. This is the stored idle look target position; retain the declared u8 and padding unchanged. unk178 -> carried_prop: Retail 0x002e0e54-0x002e0e5c stores create_moby(0x38)'s returned Moby pointer at pvars+0x178, then configures visibility, draw distance and spawn frame. Retail 0x002e1468-0x002e1490 attaches its position and basis to owner bone 2; 0x002e1494-0x002e14bc transforms skids_agent_prop_local_offset through that basis and adds it to its position before update_entity. Retail 0x002e1438-0x002e1444 removes this optional actor. This proves the carried prop pointer without guessing the physical object's identity. unk17C -> fade_amount: Retail 0x002e13bc-0x002e13dc passes pvars+0x17C to approach_value targeting zero while camera interpolation is incomplete and one once complete. Retail 0x002e13dc-0x002e1404 tests completion at one and publishes the scalar to D_L02_0015F3FC. In the fade-to-zero state, 0x002e140c-0x002e1434 approaches the same field to zero, publishes it, and gates prop/owner removal on reaching zero. Authoritative source explicitly reads this f32 into the existing local fade, establishing fade amount without assigning color or renderer ownership. --- src/overlays/l02/mobys/skids_agent.c | 62 ++++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/overlays/l02/mobys/skids_agent.c b/src/overlays/l02/mobys/skids_agent.c index 3676db3c50..c5da809362 100644 --- a/src/overlays/l02/mobys/skids_agent.c +++ b/src/overlays/l02/mobys/skids_agent.c @@ -86,15 +86,15 @@ typedef struct SkidsAgentVars { u8 pad_12C[0x24]; s32 unk150; s32 clip_volume_154; - s32 unk158; + s32 camera_start_cuboid_index; s32 unk15C; - u8 unk160; + u8 idle_look_target_position; u8 pad_161[0x11]; s16 timer_172; s16 timer_174; s16 timer_176; - struct Moby *unk178; - f32 unk17C; + struct Moby *carried_prop; + f32 fade_amount; f32 unk180; f32 unk184; } SkidsAgentVars; @@ -125,11 +125,11 @@ void skids_agent_update(struct Moby *moby) { initialize_npc_dialogue(moby, skids_agent_vars); initialize_moby_grounding(moby); prop = create_moby(0x38); - skids_agent_vars->unk178 = prop; + skids_agent_vars->carried_prop = prop; prop->draw_dist = 0x40; - skids_agent_vars->unk178->visible = 1; - skids_agent_vars->unk178->spawn_frame = moby->spawn_frame; - skids_agent_vars->unk178->flags |= 0x100; + skids_agent_vars->carried_prop->visible = 1; + skids_agent_vars->carried_prop->spawn_frame = moby->spawn_frame; + skids_agent_vars->carried_prop->flags |= 0x100; break; case SKIDS_AGENT_IDLE_AND_TALK: if (skids_agent_vars->unk8 == 1 && @@ -189,9 +189,9 @@ void skids_agent_update(struct Moby *moby) { moby->visible = 0; moby->collision = 0; moby->flags |= 1; - if (skids_agent_vars->unk178 != 0) { - skids_agent_vars->unk178->flags |= 1; - skids_agent_vars->unk178->visible = 0; + if (skids_agent_vars->carried_prop != 0) { + skids_agent_vars->carried_prop->flags |= 1; + skids_agent_vars->carried_prop->visible = 0; } start_indexed_disc_stream(2); moby->state = SKIDS_AGENT_END_CONVERSATION; @@ -221,10 +221,10 @@ void skids_agent_update(struct Moby *moby) { frame_time_sq * 0.25f, frame_time * 0.5f); lerp_vector(&pos, - (char *)l02_cuboids + (skids_agent_vars->unk158 << 7) + 0x30, + (char *)l02_cuboids + (skids_agent_vars->camera_start_cuboid_index << 7) + 0x30, (char *)l02_cuboids + (skids_agent_vars->unk15C << 7) + 0x30, skids_agent_vars->unk180); - qcopy_nc(&from, (char *)((skids_agent_vars->unk158 << 7) + (s32)l02_cuboids) + 0x70); + qcopy_nc(&from, (char *)((skids_agent_vars->camera_start_cuboid_index << 7) + (s32)l02_cuboids) + 0x70); qcopy_nc(&to, (char *)((skids_agent_vars->unk15C << 7) + (s32)l02_cuboids) + 0x70); rot.f[2] = fast_add_rotations( fast_subtract_rotations(to.f[2], from.f[2]) * skids_agent_vars->unk180, from.f[2]); @@ -235,24 +235,24 @@ void skids_agent_update(struct Moby *moby) { set_camera_position(&pos); set_camera_rotation(&rot); if (skids_agent_vars->unk180 < 1.0f) { - approach_value(&skids_agent_vars->unk17C, 0.0f, 0.1f); + approach_value(&skids_agent_vars->fade_amount, 0.0f, 0.1f); } else { - approach_value(&skids_agent_vars->unk17C, 1.0f, 0.1f); - if (skids_agent_vars->unk17C == 1.0f) { + approach_value(&skids_agent_vars->fade_amount, 1.0f, 0.1f); + if (skids_agent_vars->fade_amount == 1.0f) { moby->state = SKIDS_AGENT_FADE_TO_ZERO_AND_DELETE; jet_end_mount(0); } } - D_L02_0015F3FC = skids_agent_vars->unk17C; + D_L02_0015F3FC = skids_agent_vars->fade_amount; break; } case SKIDS_AGENT_FADE_TO_ZERO_AND_DELETE: { - approach_value(&skids_agent_vars->unk17C, 0.0f, 0.1f); - fade = skids_agent_vars->unk17C; + approach_value(&skids_agent_vars->fade_amount, 0.0f, 0.1f); + fade = skids_agent_vars->fade_amount; D_L02_0015F3FC = fade; if (fade == 0.0f) { - if (skids_agent_vars->unk178 != 0) { - mark_moby_for_removal(skids_agent_vars->unk178); + if (skids_agent_vars->carried_prop != 0) { + mark_moby_for_removal(skids_agent_vars->carried_prop); } kill: mark_moby_for_removal(moby); @@ -266,14 +266,14 @@ void skids_agent_update(struct Moby *moby) { ({ float mtx[16]; Vec4 offset; - if (skids_agent_vars->unk178 != 0) { - moby_point_position(moby, 2, &skids_agent_vars->unk178->pos); + 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->unk178->rot_row0, mtx); + copy_matrix3x4(&skids_agent_vars->carried_prop->rot_row0, mtx); transform_vector_by_basis( - &offset, skids_agent_prop_local_offset, &skids_agent_vars->unk178->rot_row0); - fast_vec_add(&skids_agent_vars->unk178->pos, &skids_agent_vars->unk178->pos, &offset); - update_entity(skids_agent_vars->unk178); + &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); + update_entity(skids_agent_vars->carried_prop); } }); @@ -306,7 +306,7 @@ void skids_agent_update(struct Moby *moby) { } } else if (skids_agent_vars->timer_174 != 0) { skids_agent_vars->timer_174 = 0; - qcopy(&skids_agent_vars->unk160, &hero.motion.body_center); + qcopy(&skids_agent_vars->idle_look_target_position, &hero.motion.body_center); } if (fast_dec_timer_s16(&skids_agent_vars->timer_176)) { skids_agent_vars->timer_176 = @@ -314,15 +314,15 @@ void skids_agent_update(struct Moby *moby) { heading = fast_add_rotations(moby->rot.z, random_float_between(-90.0f, 90.0f) * 0.017453292f); pitch = random_float_between(0.0f, 30.0f) * 0.017453292f; - build_spherical_offset(&skids_agent_vars->unk160, 6.0f, heading, pitch); - fast_vec_add(&skids_agent_vars->unk160, &skids_agent_vars->unk160, &moby->pos); + build_spherical_offset(&skids_agent_vars->idle_look_target_position, 6.0f, heading, pitch); + fast_vec_add(&skids_agent_vars->idle_look_target_position, &skids_agent_vars->idle_look_target_position, &moby->pos); } if (skids_agent_vars->timer_174 != 0) { qcopy(&target, &hero.motion.body_center); rotation_step = 0.04f; rotation_limit = 0.3f; } else { - qcopy(&target, &skids_agent_vars->unk160); + qcopy(&target, &skids_agent_vars->idle_look_target_position); } } if (look_enabled) { From 83a41618e8b7231bd8d01ef6d27ef5a8190617bd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:57:41 +0000 Subject: [PATCH 582/758] decomp: clarify names in update_toxic_crab_hit_reactions_and_targeting f94 -> knockback_motion_flags: Authoritative src/overlays/l10/mobys/toxic_crab.c SHA-256 3ebd7f6bef33ced9abe69c30bd38e14c352a77563eff00ca89253b42c251978d and original retail decompilation store 9 in D_2E52B0.f94 at pvars+0x94 (0x002e4344/0x002e4350). Root passes pvars+0x70 to the source-bound knockback-start helper at 0x002e44b8-0x002e44d0. Bounded level-10 helper evidence 2f2c5bd4804d477589f9ad046cfce584 shows a1 retained as s0 at 0x0024f0a0, so motion+0x24 is exactly this field. Instructions 0x0024f134-0x0024f13c load it, OR 0x20, and store it; 0x0024f144-0x0024f14c load it and mask bit 0x2. That bit selects calls to 0x0024a440 versus 0x0024a2f8 at 0x0024f154-0x0024f17c, with the latter bound to blend_moby_animation in the supplied root C. These actual bit operations on the knockback motion block prove a flag field rather than a scalar or animation ID. --- src/overlays/l10/mobys/toxic_crab.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index eb76c9a832..7316f471ba 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -985,7 +985,7 @@ typedef struct D_2E52B0 { float knockback_xy_scale; float knockback_z_scale; int f90; - int f94; + int knockback_motion_flags; float f98; char p9C[0x11]; unsigned char bAD; @@ -1144,7 +1144,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { func_L10_002E14F8_2E52B0(moby); moby_data->f90 = truncate_float_to_s32(768.0f); moby_data->f98 = 0.75f; - moby_data->f94 = 9; + moby_data->knockback_motion_flags = 9; moby_data->bAD = 0; fx = fast_arc_tan(hit_record->pos.x, hit_record->pos.y); switch (hit_response_code) { From 6e249bbc37990d39a5ef45298af4dd801a688cc5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:57:44 +0000 Subject: [PATCH 583/758] decomp: clarify names in handle_extermibot_hits_and_update_targeting domain_0_value_2 -> EXTERMIBOT_TARGET_PATH_UNAVAILABLE: The selector is Wing.target_selection_status at pvars+0x164, as retail 0x00303854 and 0x00303884 demonstrate when selected target fails range or vertical separation checks. The supplied same-file ExtermibotVars.mode occupies that identical pvars+0x164; extermibot_update and move_extermibot_along_path use existing EXTERMIBOT_TARGET_PATH_UNAVAILABLE for that field when target path following fails. These are the same per-moby target/path availability domain, not the moby state byte at +0x20. Reuse the established constant for this rejection assignment. domain_1_value_2 -> EXTERMIBOT_TARGET_PATH_UNAVAILABLE: Retail 0x003038a8-0x003038ac reads pvars+0x164 and compares it with 2, allowing a nonnull group candidate to replace the current target without the nearer-distance condition. This is the same Wing.target_selection_status field set by range/height rejection at 0x00303854/0x00303884 and the same pvars+0x164 storage named ExtermibotVars.mode in the supplied caller. Existing EXTERMIBOT_TARGET_PATH_UNAVAILABLE is already used for that exact target/path availability field in this file; reuse it for the comparison. domain_2_value_1 -> EXTERMIBOT_GROUP_TARGET_SELECTED: Retail 0x00303888-0x0030389c loads target_group_index and obtains the candidate from established find_nearest_extermibot_group_target (0x00303f80). After its null check and unavailable/nearer tests, 0x003038e4-0x003038ec stores the candidate in pvars+0x160 and writes 1 to target_selection_status at +0x164. The supplied original decompilation and authoritative C agree. This names the proven status stored when a group target is installed, independently of moby states and hit responses. f90 -> knockback_collision_radius_fixed_point: Assigned retail 0x00303534-0x00303574 stores truncate(scale*409.6) at pvars+0x90. Knockback state begins at pvars+0x70 (0x00303638/0x00303700). Checked motion consumer 0x00286910 retains that state in s2; 0x00286f48-0x00286f54 converts state+0x20 to float and scales by 1/1024 before comparing movement length, and 0x00286f88-0x00286fa0 passes the same scaled length with position and collision mask 0x24 to collision query 0x0021f9c8. This proves its fixed-point collision-radius role, rather than merely a scale initializer. f94 -> knockback_motion_flags: Assigned retail 0x0030357c sets pvars+0x94 to 9. State pointer pvars+0x70 is passed to knockback starter. Checked starter 0x00286880-0x002868b4 reads state+0x24, ORs bit 0x20 and tests bit 2 to choose animation handling. Checked motion consumer 0x00286a88 tests bit 0x10, 0x00286e00-0x00286e0c tests bit 4 to gate turning, and 0x00286ef0-0x00286f0c tests bit 0x20 during collision handling. Thus this int is the knockback motion behavior flags. f98 -> knockback_collision_z_offset: Assigned 0x0030354c-0x0030358c initializes pvars+0x98 to scale*0.4. Relative to the pvars+0x70 knockback state it is +0x28. Checked motion consumer 0x002869e4-0x00286a00 adds state+0x28 to copied moby Z before a position query; 0x00286e54-0x00286e94 likewise raises old/predicted collision positions by this scalar. After collision query 0x00286f9c, 0x00286fb4-0x00286fe8 installs the corrected position and subtracts this same scalar from moby Z. This proves the collision-position vertical offset. --- src/overlays/l05/mobys/extermibot.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/overlays/l05/mobys/extermibot.c b/src/overlays/l05/mobys/extermibot.c index be0fe9be7b..dda1b0f434 100644 --- a/src/overlays/l05/mobys/extermibot.c +++ b/src/overlays/l05/mobys/extermibot.c @@ -681,9 +681,9 @@ typedef struct Wing { char pad5[0x4]; float knockback_xy_magnitude; float knockback_z_magnitude; - int f90; - int f94; - float f98; + int knockback_collision_radius_fixed_point; + int knockback_motion_flags; + float knockback_collision_z_offset; char pad6[0x11]; unsigned char bAD; char pad7[0x12]; @@ -764,6 +764,9 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { EXTERMIBOT_HIT_FLASH_ONLY = 10, EXTERMIBOT_HIT_NO_REACTION = 11 }; + enum { + EXTERMIBOT_GROUP_TARGET_SELECTED = 1 + }; Vec_3047E8 working_vector; Vec_3047E8 hit_test_endpoint; int collision_hit_status; @@ -809,10 +812,10 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { hit_response = 1; } k = truncate_float_to_s32(D_L05_00161A98_gp * 409.6f); - moby_data->f98 = D_L05_00161A98_gp * 0.4f; + moby_data->knockback_collision_z_offset = D_L05_00161A98_gp * 0.4f; moby_data->knockback_gravity = extermibot_knockback_gravity_gp * D_0015ED70; - moby_data->f90 = k; - moby_data->f94 = 9; + moby_data->knockback_collision_radius_fixed_point = k; + moby_data->knockback_motion_flags = 9; moby_data->bAD = 0; switch (hit_response) { case EXTERMIBOT_HIT_NO_RESPONSE: @@ -888,17 +891,17 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { ((Path_3047E8 *)l05_paths[moby_data->targeting_path_index])->n) != 2) { if (moby_data->effective_targeting_range < vector_distance_xy(moby_data->start_position, moby_data->selected_target_position_xy) || 3.0f < func_001F9B88_3047E8(moby->pos.z - moby_data->selected_target_position_z)) { - moby_data->target_selection_status = 2; + moby_data->target_selection_status = EXTERMIBOT_TARGET_PATH_UNAVAILABLE; } } if (moby_data->target_group_index >= 0) { Moby *candidate_target = func_L05_003053D8_3047E8(moby, moby_data->target_group_index); if (candidate_target != 0) { - if (moby_data->target_selection_status == 2 || + if (moby_data->target_selection_status == EXTERMIBOT_TARGET_PATH_UNAVAILABLE || vector_distance_xy(((float *)&moby->pos), ((float *)&candidate_target->pos)) < vector_distance_xy(((float *)&moby->pos), ((float *)&moby_data->target->pos))) { moby_data->target = candidate_target; - moby_data->target_selection_status = 1; + moby_data->target_selection_status = EXTERMIBOT_GROUP_TARGET_SELECTED; } } } From 031fbfbd8ee1c506fcddc228d2d1b77843b1bfa6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 12:57:48 +0000 Subject: [PATCH 584/758] decomp: clarify names in ultramech_scientist_update unk148 -> pre_scene_moby_group_index: Retail 0x002ecb40-0x002ecb4c passes pvars+0x148 to count_active_moby_group_members and waits while its count is nonzero before starting the pre-scene delay. Checked helper 0x002489f4-0x00248a00 scales this argument by four to select a moby-index-list pointer; 0x00248a28-0x00248a70 counts eligible list members. This is the group index for a pre-scene completion gate. unk14C -> scene_animation_moby_index: Retail 0x002ec7a8-0x002ec7b0 treats -1 as absent. At 0x002ec7d0-0x002ec7f0 it scales this field by 0x100 into the moby array and clears that moby's collision and sets flags. At 0x002ecb90-0x002ecbac the same index selects the moby passed to set_moby_animation with sequence/frame zero during pre-scene setup. Name asserts this proven scene-animation use without identifying the character. unk154 -> pre_scene_camera_transform_index: Retail 0x002ecbe0-0x002ecc08 checks pvars+0x154 against -1, scales it by 0x80 and passes the selected record's +0x30 position and +0x70 Euler rotation to set_race_camera(positions, rotations, 0, 1). Source context for set_race_camera proves those input roles. 0x002ecc0c-0x002ecc28 reuses the same record for the next helper before entering scene-start state. unk158 -> moby_to_remove_index: Retail 0x002ecae0-0x002ecaf4 checks pvars+0x158 against -1 and scales it by 0x100 into the moby array. After excluding removal-marker states at 0x002ecb00-0x002ecb0c, 0x002ecb14 calls mark_moby_for_removal on that selected moby and 0x002ecb1c sets this field to -1. This proves the indexed moby is designated for removal, without proving a spawned identity. unk160 -> primary_gaze_joint_animation: Retail 0x002ec860 sets the first joint-animation record pointer to pvars+0x160; 0x002ecff0-0x002ed004 passes it to update_joint_animation with joint selector 1 and the gaze easing parameters. Its +0x64/+0x68 fields receive gaze pitch/yaw at 0x002ecfc0-0x002ecfc4. Checked helper 0x00252004-0x002521cc consumes the record, eases its angle targets and applies its transform. Primary distinguishes this first gaze record from the following selector-0 record; no anatomical identity is claimed. unk1C4 -> primary_gaze_pitch_target: Retail 0x002ecf14-0x002ecfa0 computes negative eye-to-target elevation and clamps it to +/-0.5235988. 0x002ecfb8 and 0x002ecfc0 multiply it by 1.25 and store it at pvars+0x1C4. This is +0x64 within the pvars+0x160 gaze joint record; checked helper 0x00252140-0x00252158 loads record+0x64 as an easing target for its rotation component. unk248 -> secondary_gaze_yaw_target: Retail 0x002ecef0-0x002ecf60 derives eye-to-target bearing relative to moby yaw and clamps it to +/-1.5707964. 0x002ecfb4-0x002ecfbc stores half this yaw at pvars+0x248, which is +0x68 in the second gaze record based at +0x1E0. 0x002ed010-0x002ed024 passes that record to update_joint_animation with selector 0; checked helper 0x00252160-0x00252178 consumes record+0x68 as a rotation easing target. unk260 -> idle_gaze_target_position: Retail 0x002ecdc0-0x002ecdd0 copies the tracked hero target position into pvars+0x260 when tracking ends. 0x002ece00-0x002ece74 periodically constructs a random radius-6 spherical offset there and adds moby position. When tracking timer +0x274 is zero, 0x002eceb0-0x002eceb8 copies this stored world position into the target used by eye-to-target yaw/pitch calculations. It is the stored idle gaze target, rather than a generic byte. unk280 -> dialogue_mission_id: Retail 0x002ec8cc-0x002ec8e4 uses pvars+0x280 as the within-level visited52 index; 0x002ec91c-0x002ec924 and 0x002ec9f8-0x002eca04 compare it directly with each linked Moby's mission byte +0xB0. Successful dialogue passes it to jet_clear_persistent at 0x002ec9d0-0x002ec9d4. Thus the field is the mission ID associated with this dialogue and its mission cleanup. unk284 -> pre_scene_persistent_mission_id: Retail 0x002ecbcc-0x002ecbd0 passes pvars+0x284 to jet_clear_persistent during pre-scene setup. Checked helper 0x0023f908-0x0023f928 ignores ID 0xFF, otherwise stores 0xFF at visited52[current_level_index*16+argument]. The identical helper consumes +0x280, independently proved to be a mission ID by Moby mission comparisons. This field selects the persistent mission entry cleared before scenes; the mission's narrative identity is unknown. --- src/overlays/l15/mobys/ultramech_scientist.c | 72 ++++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/overlays/l15/mobys/ultramech_scientist.c b/src/overlays/l15/mobys/ultramech_scientist.c index 4f9ddb46af..4d171e8436 100644 --- a/src/overlays/l15/mobys/ultramech_scientist.c +++ b/src/overlays/l15/mobys/ultramech_scientist.c @@ -76,30 +76,30 @@ typedef struct UltramechScientistVars { u8 pad_38[0x108]; s32 unk140; s32 unk144; - s32 unk148; - s32 unk14C; + s32 pre_scene_moby_group_index; + s32 scene_animation_moby_index; s32 unk150; - s32 unk154; - s32 unk158; + s32 pre_scene_camera_transform_index; + s32 moby_to_remove_index; s32 timer_15C; - u8 unk160; + u8 primary_gaze_joint_animation; u8 pad_161[0x63]; - f32 unk1C4; + f32 primary_gaze_pitch_target; f32 unk1C8; u8 pad_1CC[0x4]; f32 unk1D0; u8 pad_1D4[0xC]; u8 unk1E0; u8 pad_1E1[0x67]; - f32 unk248; + f32 secondary_gaze_yaw_target; u8 pad_24C[0x14]; - u8 unk260; + u8 idle_gaze_target_position; u8 pad_261[0x13]; s32 timer_274; s32 timer_278; s32 clip_volume_27C; - s32 unk280; - s32 unk284; + s32 dialogue_mission_id; + s32 pre_scene_persistent_mission_id; } UltramechScientistVars; /* Moby class 1446 */ @@ -129,15 +129,15 @@ void ultramech_scientist_update(struct Moby *moby) { ultramech_scientist_private_data = (UltramechScientistVars *)moby->pvars; apply_npc_big_head_cheat(moby); - if (ultramech_scientist_private_data->unk14C == -1) { + if (ultramech_scientist_private_data->scene_animation_moby_index == -1) { return; } { char *player = D_0013E533 + 0xE1D; if (*(unsigned char *)(player + 0x20A4) != 2) { int mobys = (int)l15_moby_array; - *(int *)((ultramech_scientist_private_data->unk14C << 8) + mobys + 0x94) = 0; - *(unsigned short *)((ultramech_scientist_private_data->unk14C << 8) + mobys + 0x34) |= + *(int *)((ultramech_scientist_private_data->scene_animation_moby_index << 8) + mobys + 0x94) = 0; + *(unsigned short *)((ultramech_scientist_private_data->scene_animation_moby_index << 8) + mobys + 0x34) |= 0x41; } } @@ -162,7 +162,7 @@ void ultramech_scientist_update(struct Moby *moby) { moby->update_dist = 0xFF; ultramech_scientist_private_data->unkC = 20.0f; initialize_npc_dialogue(moby, ultramech_scientist_private_data); - if (visited52[ultramech_scientist_private_data->unk280 + (current_level_index_gp << 4)] != + if (visited52[ultramech_scientist_private_data->dialogue_mission_id + (current_level_index_gp << 4)] != 0xFF) { break; } @@ -179,7 +179,7 @@ void ultramech_scientist_update(struct Moby *moby) { int dead_state = MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY; int gone_state = MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY; for (; moby_list_cursor != 0; moby_list_cursor = moby_list_cursor->next) { - if (moby_list_cursor->mission != ultramech_scientist_private_data->unk280) { + if (moby_list_cursor->mission != ultramech_scientist_private_data->dialogue_mission_id) { continue; } if (moby_list_cursor == moby) { @@ -211,7 +211,7 @@ void ultramech_scientist_update(struct Moby *moby) { if (update_npc_dialogue(moby, ultramech_scientist_private_data) == 0) { break; } - jet_clear_persistent(ultramech_scientist_private_data->unk280); + jet_clear_persistent(ultramech_scientist_private_data->dialogue_mission_id); moby->anim_speed = 0.0f; moby->state = ULTRAMECH_SCIENTIST_RESUME_AFTER_DIALOGUE; moby_list_cursor = (struct Moby *)D_L15_0015FFE4; @@ -222,7 +222,7 @@ void ultramech_scientist_update(struct Moby *moby) { int dead_state = MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY; int gone_state = MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY; for (; moby_list_cursor != 0; moby_list_cursor = moby_list_cursor->next) { - if (moby_list_cursor->mission != ultramech_scientist_private_data->unk280) { + if (moby_list_cursor->mission != ultramech_scientist_private_data->dialogue_mission_id) { continue; } if (moby_list_cursor == moby) { @@ -263,15 +263,15 @@ void ultramech_scientist_update(struct Moby *moby) { break; } } - if (ultramech_scientist_private_data->unk158 != -1) { + if (ultramech_scientist_private_data->moby_to_remove_index != -1) { char *spawned = - (char *)l15_moby_array + (ultramech_scientist_private_data->unk158 << 8); + (char *)l15_moby_array + (ultramech_scientist_private_data->moby_to_remove_index << 8); if (spawned != 0) { int state = *(unsigned char *)(spawned + 0x20); if (state != MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY) { if (state != MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY) { mark_moby_for_removal(spawned); - ultramech_scientist_private_data->unk158 = -1; + ultramech_scientist_private_data->moby_to_remove_index = -1; } } } @@ -279,7 +279,7 @@ void ultramech_scientist_update(struct Moby *moby) { if (count_active_moby_group_members(ultramech_scientist_private_data->unk144, 0x40) != 0) { break; } - if (count_active_moby_group_members(ultramech_scientist_private_data->unk148, 0x40) != 0) { + if (count_active_moby_group_members(ultramech_scientist_private_data->pre_scene_moby_group_index, 0x40) != 0) { break; } moby->state = ULTRAMECH_SCIENTIST_WAIT_FOR_PRE_SCENE_DELAY; @@ -291,23 +291,23 @@ void ultramech_scientist_update(struct Moby *moby) { } restore_saved_hero_moby_and_clear_vehicle_mode(); set_moby_animation( - (char *)l15_moby_array + (ultramech_scientist_private_data->unk14C << 8), 0, 0); + (char *)l15_moby_array + (ultramech_scientist_private_data->scene_animation_moby_index << 8), 0, 0); ultramech_scientist_private_data->unk140 = 1; ultramech_scientist_private_data->unk36 = 1; ultramech_scientist_private_data->unk8 = 1; unlock_planet(0x10); - jet_clear_persistent(ultramech_scientist_private_data->unk284); + jet_clear_persistent(ultramech_scientist_private_data->pre_scene_persistent_mission_id); request_music_track(0, 5); - if (ultramech_scientist_private_data->unk154 != -1) { + if (ultramech_scientist_private_data->pre_scene_camera_transform_index != -1) { char *paths = D_L15_001600EC; char *paths_again; - set_race_camera(paths + (ultramech_scientist_private_data->unk154 << 7) + 0x30, - paths + (ultramech_scientist_private_data->unk154 << 7) + 0x70, + set_race_camera(paths + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + 0x30, + paths + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + 0x70, 0, 1); paths_again = D_L15_001600EC; - FUN_L00_00284e50(paths_again + (ultramech_scientist_private_data->unk154 << 7) + 0x30, - paths_again + (ultramech_scientist_private_data->unk154 << 7) + 0x70); + FUN_L00_00284e50(paths_again + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + 0x30, + paths_again + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + 0x70); } moby->state = ULTRAMECH_SCIENTIST_START_FIRST_SCENE; break; @@ -374,7 +374,7 @@ void ultramech_scientist_update(struct Moby *moby) { } if (ultramech_scientist_private_data->timer_274 != 0) { ultramech_scientist_private_data->timer_274 = 0; - qcopy(&ultramech_scientist_private_data->unk260, D_0013E533 + 0xE1D + 0xD0); + qcopy(&ultramech_scientist_private_data->idle_gaze_target_position, D_0013E533 + 0xE1D + 0xD0); } wander: if (fast_dec_timer(&ultramech_scientist_private_data->timer_278) == 0) { @@ -388,9 +388,9 @@ void ultramech_scientist_update(struct Moby *moby) { heading = fast_add_rotations(moby->rot.z, value * deg_to_rad); value = random_float_between(0.0f, 30.0f); build_spherical_offset( - &ultramech_scientist_private_data->unk260, 6.0f, heading, value * deg_to_rad); - fast_vec_add(&ultramech_scientist_private_data->unk260, - &ultramech_scientist_private_data->unk260, + &ultramech_scientist_private_data->idle_gaze_target_position, 6.0f, heading, value * deg_to_rad); + fast_vec_add(&ultramech_scientist_private_data->idle_gaze_target_position, + &ultramech_scientist_private_data->idle_gaze_target_position, &moby->pos); aim_head: if (ultramech_scientist_private_data->timer_274 != 0) { @@ -398,7 +398,7 @@ void ultramech_scientist_update(struct Moby *moby) { ease_rate = 0.04f; ease_limit = 0.3f; } else { - qcopy(target, &ultramech_scientist_private_data->unk260); + qcopy(target, &ultramech_scientist_private_data->idle_gaze_target_position); } if (aim != 0) { qcopy(eye, &moby->pos); @@ -420,14 +420,14 @@ void ultramech_scientist_update(struct Moby *moby) { pitch = -0.5235988f; } ultramech_scientist_private_data->unk1C8 = yaw * 0.5f; - ultramech_scientist_private_data->unk1C4 = pitch * 1.25f; - ultramech_scientist_private_data->unk248 = yaw * 0.5f; + ultramech_scientist_private_data->primary_gaze_pitch_target = pitch * 1.25f; + ultramech_scientist_private_data->secondary_gaze_yaw_target = yaw * 0.5f; } if (big_head_cheat_enabled_macro[0] != 0) { ultramech_scientist_private_data->unk1D0 = 2.75f; } update_joint_animation(moby, - &ultramech_scientist_private_data->unk160, + &ultramech_scientist_private_data->primary_gaze_joint_animation, 1, ease_rate * frame_scale_sq_gp, ease_limit * frame_scale_sq_gp); From 1296a996bc689cd9f902b8d52d85529e05719978 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:00:23 +0000 Subject: [PATCH 585/758] decomp: clarify names in blarg_space_fighter_update b10F -> firing_fighter_update_count: Boss data is obtained from the checked linked moby's +0x78 at 0x002c479c. In the source FIGHTER_ATTACK_FIRE branch, bossd->b10F is incremented on each fighter firing-state update; retail 0x002c48e8-0x002c48f0 loads, adds one and stores the byte at linked data+0x10F. 0x002c48f4-0x002c48fc permits the firing/timer work only while the updated count is below four, and 0x002c48ac-0x002c48b4 requires it below three to enter FIGHTER_ATTACK_FIRE from WAIT_TO_FIRE. The name records this update-count role without claiming the unknown reset period. v90 -> path_join_position: In SHA-256 d7cbb1d3f1218dadb19099a143b54b9a0ee52639bca672993b1bc90a4b059492, Data_2C56B0.v90 receives path+0x20 during initialization and the selected path node during FIGHTER_WAIT_TO_JOIN_PATH, then is copied to moby->pos. Retail s6 is fighter data from moby+0x78 (0x002c4470); 0x002c4530-0x002c4558 copies path+0x20 into data+0x90 and then moby+0x10. After point selection at 0x002c461c, 0x002c4628-0x002c4650 copies path+0x10+node*16 through the same data+0x90 position before activation at 0x002c4680. This proves the stored path join position. --- src/overlays/l13/mobys/blarg_space_fighter.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l13/mobys/blarg_space_fighter.c b/src/overlays/l13/mobys/blarg_space_fighter.c index e22358b057..4fd79cb29a 100644 --- a/src/overlays/l13/mobys/blarg_space_fighter.c +++ b/src/overlays/l13/mobys/blarg_space_fighter.c @@ -452,7 +452,7 @@ typedef struct Veh { typedef struct Boss { char pad0[0x10E]; unsigned char b10E; - unsigned char b10F; + unsigned char firing_fighter_update_count; } Boss; typedef struct Moby_2C56B0 { @@ -485,7 +485,7 @@ typedef struct Data_2C56B0 { char pad26[0x4A]; V4_2C56B0 vel; char pad80[0x10]; - V4_2C56B0 v90; + V4_2C56B0 path_join_position; int fA0; int fA4; int fA8; @@ -589,8 +589,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { fighter_data->hB4 = 1; fighter_data->hB6 = *(unsigned short *)D_L13_001B07B0[path_table_index] - 1; } - qcopy(&fighter_data->v90, path + 0x20); - qcopy(&moby->pos, &fighter_data->v90); + qcopy(&fighter_data->path_join_position, path + 0x20); + qcopy(&moby->pos, &fighter_data->path_join_position); fighter_data->fA8 = scale_game_frames(0x14) + 5; moby->b30 = 0xFF; moby->h32 = 0xFF; @@ -611,8 +611,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { fast_vec_sub(scratch_vector, D_L13_001670C0, scratch_vector); fighter_data->hB6 = fighter_data->hB4 = select_point_index_by_distance(scratch_vector, path, 0.0f); - qcopy(&fighter_data->v90, path + (fighter_data->hB6 * 16 + 0x10)); - qcopy(&moby->pos, &fighter_data->v90); + qcopy(&fighter_data->path_join_position, path + (fighter_data->hB6 * 16 + 0x10)); + qcopy(&moby->pos, &fighter_data->path_join_position); moby->f94 = moby->cls->f10; moby->b31 = 1; moby->flags = (moby->flags & 0xFFFE) | 0x1000; @@ -677,7 +677,7 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { switch (moby->bBC) { case FIGHTER_ATTACK_WAIT_TO_FIRE: if (vehd != 0 && veh->state == 4 && moby->b31 != 0 && close != 0 && boss != 0 && - bossd->b10F < 3) { + bossd->firing_fighter_update_count < 3) { fighter_data->fB8 = scale_game_frames(0x258); fighter_data->fAC = 1.0f; fighter_data->fA8 = 0; @@ -686,9 +686,9 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { break; case FIGHTER_ATTACK_FIRE: if (boss != 0) { - bossd->b10F++; + bossd->firing_fighter_update_count++; } - if (bossd->b10F < 4) { + if (bossd->firing_fighter_update_count < 4) { if (moby->b31 == 0) { fighter_data->fA8++; } From 5cfeaa4f2f96d926f42c72b7d3b85eb21b4bdf5b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:02:47 +0000 Subject: [PATCH 586/758] decomp: clarify names in fred_update f128 -> look_yaw_target: Retail 0x00301a18-0x00301a8c derives target-relative yaw from target-minus-eye XY and subtracts Fred's heading, clamping to +/-pi/2. At 0x00301af0-0x00301af8 it stores 0.4 times that yaw at pvars+0x128. The call at 0x00301b44-0x00301b58 passes pvars+0xc0 to update_joint_animation for joint 2. Checked helper 0x00271cc8-0x00271ce4 reads record+0x68 (exactly pvars+0x128) as the target for its record+0x48 angular component, before applying the rotation and clearing target components at 0x00271d08-0x00271d24. This proves a joint-animation look yaw target, without asserting anatomical identity. f140 -> idle_look_target_position: Retail 0x003018e8-0x003018f4 stores the hero body-center position into pvars+0x140 when active tracking is lost. At 0x00301924-0x00301998 it builds a radius-6 spherical offset using random heading/elevation and adds Fred's position into that same vector. When tracking timer pvars+0x158 is zero, 0x003019d4-0x003019dc copies it as the look target; 0x003019e8-0x00301a48 subtracts Fred's raised eye position and derives look yaw/pitch. Thus this is the stored idle look target position. f8 -> dialogue_activation_mode: Retail fred_update 0x0030120c-0x00301248 reads pvars+8 and mode 1 plus the hero's clip-volume test selects dialogue range 16 instead of 3.7. Checked update_npc_dialogue range 0x002752b0-0x002752b4 rejects mode 255; 0x002752ec-0x00275378 applies facing checks only for mode zero, and 0x002753a0-0x002753bc requires button bit 0x10 only for zero. These independent activation branches prove this byte selects dialogue activation mode. --- src/overlays/l06/mobys/fred.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l06/mobys/fred.c b/src/overlays/l06/mobys/fred.c index 8c1b10edca..793f247636 100644 --- a/src/overlays/l06/mobys/fred.c +++ b/src/overlays/l06/mobys/fred.c @@ -40,7 +40,7 @@ typedef struct Data_301070 { char pad00[4]; short f4; char pad06[2]; - unsigned char f8; + unsigned char dialogue_activation_mode; char pad09[3]; float fC; char pad10[0x10]; @@ -53,9 +53,9 @@ typedef struct Data_301070 { float fB0; char padB4[0xC]; char fC0[0x68]; - float f128; + float look_yaw_target; char pad12C[0x14]; - float f140[4]; + float idle_look_target_position[4]; char pad150[8]; int f158, f15C; int f160, f164, f168, f16C, f170; @@ -149,7 +149,7 @@ void fred_update(struct Moby *moby) { initialize_npc_dialogue(moby, fred_vars); break; case UPDATE_FRED_DIALOGUE: - if (fred_vars->f8 == 1 && + if (fred_vars->dialogue_activation_mode == 1 && is_point_inside_clip_volume(&hero.motion.pos, fred_vars->f168) != 0) { fred_vars->fC = 16.0f; } else { @@ -316,7 +316,7 @@ void fred_update(struct Moby *moby) { fast_dec_timer(&fred_vars->f158); } else if (fred_vars->f158) { fred_vars->f158 = 0; - qcopy(fred_vars->f140, &hero.motion.body_center); + qcopy(fred_vars->idle_look_target_position, &hero.motion.body_center); } if (fast_dec_timer(&fred_vars->f15C)) { float heading; @@ -324,18 +324,18 @@ void fred_update(struct Moby *moby) { truncate_float_to_s32(scale_time(random_float_between(180.0f, 300.0f))); heading = fast_add_rotations(moby->rot.z, random_float_between(-90.0f, 90.0f) * 0.017453292f); - build_spherical_offset(fred_vars->f140, + build_spherical_offset(fred_vars->idle_look_target_position, 6.0f, heading, random_float_between(0.0f, 30.0f) * 0.017453292f); - fast_vec_add(fred_vars->f140, fred_vars->f140, ((float *)&moby->pos)); + fast_vec_add(fred_vars->idle_look_target_position, fred_vars->idle_look_target_position, ((float *)&moby->pos)); } if (fred_vars->f158) { qcopy(target, &hero.motion.body_center); rate = 0.04f; head_rate = 0.3f; } else { - qcopy(target, fred_vars->f140); + qcopy(target, fred_vars->idle_look_target_position); } } if (tracking) { @@ -356,7 +356,7 @@ void fred_update(struct Moby *moby) { pitch = -0.5235988f; fred_vars->fA4 = pitch; fred_vars->fA8 = yaw * 0.6f; - fred_vars->f128 = yaw * 0.4f; + fred_vars->look_yaw_target = yaw * 0.4f; } } if (big_head_cheat_enabled[0]) From 6100a0beba444727e69fad30a70a34c27889ca78 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:02:50 +0000 Subject: [PATCH 587/758] decomp: clarify names in initialize_level_render_state m3 -> translation_and_position_scale: In the authoritative C, ShrubData.m3 is an FRow (XYZ floats plus W). Retail 0x001ea3f8-0x001ea404 copies gameplay shrub_record+0x40 to this fourth row at shrub_data+0x30, retaining its XYZ. Retail 0x001ea424-0x001ea42c replaces W at +0x3c with the shrub class scalar. After transform_vector_by_basis computes the instance position, 0x001ea530-0x001ea534 passes that W to scale_vector(shrub, shrub, m3.w); 0x001ea538-0x001ea544 passes the fourth row (s4) to fast_vec_add, adding its XYZ to the scaled position. Original Ghidra agrees: scale by vector_01[0xf], then add vector_01+0xc. Thus XYZ supplies translation and W supplies position scaling. --- src/rendering/frame/initialize_level_render_state.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rendering/frame/initialize_level_render_state.c b/src/rendering/frame/initialize_level_render_state.c index 1c11581255..6eaf562224 100644 --- a/src/rendering/frame/initialize_level_render_state.c +++ b/src/rendering/frame/initialize_level_render_state.c @@ -42,7 +42,7 @@ typedef struct TieData { typedef struct ShrubData { IRow m[3]; - FRow m3; + FRow translation_and_position_scale; } ShrubData; typedef struct LevelHeader { @@ -373,9 +373,9 @@ u8 *initialize_level_render_state(LevelHeader *header) { qcopy(&shrub_data->m[0], shrub_record + 0x10); qcopy(&shrub_data->m[1], shrub_record + 0x20); qcopy(&shrub_data->m[2], shrub_record + 0x30); - qcopy(&shrub_data->m3, shrub_record + 0x40); + qcopy(&shrub_data->translation_and_position_scale, shrub_record + 0x40); shrub_record += 0x50; - shrub_data->m3.w = shrub_render_classes[shrub_class]->unk20; + shrub_data->translation_and_position_scale.w = shrub_render_classes[shrub_class]->unk20; horizontal_scale = (fast_vec_length(&shrub_data->m[0]) + fast_vec_length(&shrub_data->m[1])) * 0.5f; vertical_scale = fast_vec_length(&shrub_data->m[2]); @@ -403,8 +403,8 @@ u8 *initialize_level_render_state(LevelHeader *header) { max_axis_length = max_float(max_axis_length, fast_vec_length(&shrub_data->m[1])); max_axis_length = max_float(max_axis_length, fast_vec_length(&shrub_data->m[2])); shrub->scale = shrub_render_classes[shrub_class]->bounding_sphere[3] * max_axis_length; - scale_vector(shrub, shrub, shrub_data->m3.w); - fast_vec_add(shrub, shrub, &shrub_data->m3); + scale_vector(shrub, shrub, shrub_data->translation_and_position_scale.w); + fast_vec_add(shrub, shrub, &shrub_data->translation_and_position_scale); } shrub_list = (u16 *)0x70000000; for (shrub_light_index = 0; shrub_light_index < shrub_count; shrub_light_index++) { From 867e5449796bb7496af75907aa5f9640429f392c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:02:53 +0000 Subject: [PATCH 588/758] decomp: clarify names in minibomber_update f52 -> source_animation_id: Authoritative Moby_2B5938 f52 is compared with f53 at retail 0x002b4724-0x002b473c before returning a finished nonzero animation to animation 0. Checked level-14 immediate setter 0x0025fcc8 indexes class animation table +0x48 using a1 and stores that animation ID to both +0x52 (0x0025fcf4) and +0x53 (0x0025fd30). Checked blend_moby_animation 0x0025fd80 preserves old +0x52 at +0xA5 and writes 0xFF to +0x52 after capturing the existing pose (0x0025fe28-0x0025fe48), while storing the newly requested animation ID only to +0x53 at 0x0025fe64. This distinguishes +0x52 as the source animation ID, including the captured-pose sentinel. f53 -> target_animation_id: Authoritative Moby_2B5938 f53 is the animation-2 gate at retail 0x002b4d20-0x002b4d24 and 0x002b4f40-0x002b4f48. In checked blend_moby_animation 0x0025fd80, s3 receives requested animation a1 at 0x0025fda0, selects its class animation table entry at 0x0025fda8-0x0025fdc8, and is stored to moby+0x53 at 0x0025fe64 while the source +0x52 can become the captured-pose sentinel 0xFF. The immediate setter stores the same requested ID to both bytes at 0x0025fcf4 and 0x0025fd30. Thus f53 selects the target animation, distinct from the source side during blending. --- src/overlays/l14/mobys/minibomber.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l14/mobys/minibomber.c b/src/overlays/l14/mobys/minibomber.c index 5372df7be6..638daea10c 100644 --- a/src/overlays/l14/mobys/minibomber.c +++ b/src/overlays/l14/mobys/minibomber.c @@ -76,8 +76,8 @@ typedef struct Moby_2B5938 { char pad36[0x12]; float rot; /* 0x48 */ char pad4C[6]; - unsigned char f52; /* 0x52 */ - unsigned char f53; /* 0x53 */ + unsigned char source_animation_id; /* 0x52 */ + unsigned char target_animation_id; /* 0x53 */ char pad54[0x1C]; unsigned char f70; /* 0x70 */ char pad71[7]; @@ -287,8 +287,8 @@ void minibomber_update(Moby_2B5938 *moby) { float spd; if (moby->f70 & 2) { - if (moby->f52 == moby->f53 && moby->f52 != 0) { - if (moby->f52 == 2) { + if (moby->source_animation_id == moby->target_animation_id && moby->source_animation_id != 0) { + if (moby->source_animation_id == 2) { blend_moby_animation(moby, 0, 0, 10); } else { set_moby_animation_c(moby, 0, 0); @@ -487,7 +487,7 @@ void minibomber_update(Moby_2B5938 *moby) { moby->state = MINIBOMBER_STATE_RETRACE_INTRO_OR_EXIT_PATH; FUN_L14_002b5c30_c((char *)moby); } else if (fast_dec_timer_s16(&d->f102) != 0) { - if (moby->f53 != 2) { + if (moby->target_animation_id != 2) { moby->state = MINIBOMBER_STATE_AIM_AT_BOMB_POINT; d->f102 = scale_game_frames(minibomber_bomb_aim_duration_frames); d->f104 = 0.0f; @@ -549,7 +549,7 @@ void minibomber_update(Moby_2B5938 *moby) { (float)d->f102 / convert_integer_to_float(scale_game_frames(minibomber_bomb_aim_duration_frames))); build_axis_rotation_quaternion(d->f120, 2, blended_aim_angle); - if (moby->f53 == 2) { + if (moby->target_animation_id == 2) { moby->state = MINIBOMBER_STATE_HOLD_AT_PATH_END; d->f102 = scale_game_frames(minibomber_aim_return_duration_frames); } else if (fast_dec_timer_s16(&d->f102) != 0) { From 4494a61685d7f3622266f6a0f49652a44efe9f04 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:05:07 +0000 Subject: [PATCH 589/758] decomp: clarify names in bomb_spawner_update b82 -> spawn_trigger_mode: Retail 0x002bf158 loads pvars+0x82; 0x002bf160-0x002bf17c selects distance-only, volume-only, or volume OR distance into s7, which gates spawning at 0x002bf530. Authoritative C switches this byte over the established SPAWNER_TRIGGER_* cases. b83 -> bomb_spawn_options: Retail 0x002bf5fc-0x002bf618, 0x002bf6cc-0x002bf6f8 and 0x002bf984-0x002bf9b0 test bit 8 of pvars+0x83 to randomize launch displacement length. At 0x002bfa68 the complete byte is constructor argument t0; supplied spawn_class_221_moby source names that argument spawn_options and stores it in the new bomb's pvars+0x1c. This is the options byte for bomb spawning, with other bits unresolved. b84 -> proximity_activation_mode: Retail 0x002bf314 requires the proximity predicate before loading pvars+0x84 at 0x002bf31c and dispatching at 0x002bf33c. Paths 0x002bf344-0x002bf3c0 assign moby states 2,3,7,2,5,5 or 1. Authoritative C uses established SPAWNER_ACTIVATION_* cases for this selector in SPAWNER_WAIT_FOR_PROXIMITY. b85 -> spawn_target_mode: Retail 0x002bf56c loads pvars+0x85 and 0x002bf57c-0x002bf59c dispatches six target-setup paths after obtaining launch_origin. Authoritative C switches this byte over angular spread, reference offset, unused/helper/count-indexed point and skip-setup cases; resulting target_position feeds the trajectory solver at 0x002bfa48. f90 -> spawn_distance_limit: Retail 0x002bf104-0x002bf118 compares reference XY distance with float pvars+0x90 for the volume-or-distance spawn predicate. 0x002bf674 and 0x002bf728 also pass it in f12 to vector helper 0x001f8f30. Checked helper request 9941c4f674754a54aa17b6525069b227 shows XYZ length via square root, then limit/length scaling and output store at 0x001f8f78-0x001f8f84 when length reaches/exceeds the limit. Thus it bounds both the distance predicate and target displacement in modes 0/1, matching clamp_vector_length in authoritative C. f9C -> activation_distance_threshold: Retail 0x002bf0e4-0x002bf100 compares reference XY distance against float pvars+0x9c to produce s2. 0x002bf314 uses s2 to gate activation out of proximity wait, and 0x002bf170 selects it as the distance-only spawn predicate. Authoritative C expresses these uses as near1 = reference_distance_xy < spawner_data->f9C and the established proximity-wait/trigger cases. --- src/overlays/shared/enemies/bomb_spawner.c | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/overlays/shared/enemies/bomb_spawner.c b/src/overlays/shared/enemies/bomb_spawner.c index 9674b18fe0..11bcce81ce 100644 --- a/src/overlays/shared/enemies/bomb_spawner.c +++ b/src/overlays/shared/enemies/bomb_spawner.c @@ -33,19 +33,19 @@ typedef struct Data_2C0330 { unsigned char b67; char pad68[8]; char f70[0x12]; - unsigned char b82; - unsigned char b83; - unsigned char b84; - unsigned char b85; + unsigned char spawn_trigger_mode; + unsigned char bomb_spawn_options; + unsigned char proximity_activation_mode; + unsigned char spawn_target_mode; unsigned char count; unsigned char max; short timer; short h8A; short h8C; char pad8E[2]; - float f90; + float spawn_distance_limit; char pad94[8]; - float f9C; + float activation_distance_threshold; int pts[4]; char padB0[0x20]; int fD0; @@ -239,8 +239,8 @@ void bomb_spawner_update(struct Moby *moby) { } } reference_distance_xy = vector_distance_xy(&moby->pos, D_0013E533_2bef68 + 0xE9D); - near1 = reference_distance_xy < spawner_data->f9C; - near2 = reference_distance_xy < spawner_data->f90; + near1 = reference_distance_xy < spawner_data->activation_distance_threshold; + near2 = reference_distance_xy < spawner_data->spawn_distance_limit; spawn = 0; timerDone = fast_dec_timer_s16(&spawner_data->timer) != 0; inVol = 0; @@ -249,7 +249,7 @@ void bomb_spawner_update(struct Moby *moby) { inVol = is_point_inside_clip_volume(D_0013E533_2bef68 + 0xE9D, spawner_data->fD0) != 0; } cond = inVol | near2; - switch (spawner_data->b82) { + switch (spawner_data->spawn_trigger_mode) { case SPAWNER_TRIGGER_DISTANCE_ONLY: cond = near1; break; @@ -301,7 +301,7 @@ void bomb_spawner_update(struct Moby *moby) { } case SPAWNER_WAIT_FOR_PROXIMITY: if (near1) { - switch (spawner_data->b84) { + switch (spawner_data->proximity_activation_mode) { case SPAWNER_ACTIVATION_ENTER_SPAWN_ENABLED: moby->state = SPAWNER_SPAWN_ENABLED; break; @@ -387,7 +387,7 @@ void bomb_spawner_update(struct Moby *moby) { while (spawner_data->h8A == 0 ? spawner_data->count < spawner_data->max : spawner_data->timer == 0) { moby_point_position(moby, 0, &launch_origin); - switch (spawner_data->b85) { + switch (spawner_data->spawn_target_mode) { case SPAWNER_TARGET_COUNT_ANGULAR_SPREAD: { float target_spread_angle; float rad; @@ -396,7 +396,7 @@ void bomb_spawner_update(struct Moby *moby) { convert_integer_to_float(spawner_data->max + 1) - 3.1415927f); rad = vector_distance_xy(&moby->pos, D_0013E533_2bef68 + 0xE9D) * 0.5f; - if (spawner_data->b83 & 8) { + if (spawner_data->bomb_spawn_options & 8) { rad = random_float_between(rad, 3.0f); } if (rad < 3.0f) { @@ -405,7 +405,7 @@ void bomb_spawner_update(struct Moby *moby) { launch_velocity.x = fast_cos(target_spread_angle) * rad; launch_velocity.y = fast_sin(target_spread_angle) * rad; launch_velocity.z = 0.0f; - clamp_vector_length(&launch_velocity, &launch_velocity, spawner_data->f90); + clamp_vector_length(&launch_velocity, &launch_velocity, spawner_data->spawn_distance_limit); fast_vec_add(&target_position, &launch_origin, &launch_velocity); target_ground_height = probe_ground_height(&target_position, 0, 0.5f); if (target_ground_height != 0.0f) { @@ -419,14 +419,14 @@ void bomb_spawner_update(struct Moby *moby) { launch_velocity.z = 0.0f; fast_vec_scale(&launch_velocity, &launch_velocity, 0.5f); len = fast_vec_length(&launch_velocity); - if (spawner_data->b83 & 8) { + if (spawner_data->bomb_spawn_options & 8) { fast_vec_normalize( &launch_velocity, &launch_velocity, random_float_between(len, 3.0f)); } if (fast_vec_length(&launch_velocity) < 3.0f) { fast_vec_normalize(&launch_velocity, &launch_velocity, 3.0f); } - clamp_vector_length(&launch_velocity, &launch_velocity, spawner_data->f90); + clamp_vector_length(&launch_velocity, &launch_velocity, spawner_data->spawn_distance_limit); fast_vec_add(&target_position, &launch_origin, &launch_velocity); target_ground_height = probe_ground_height(&target_position, 0, 0.5f); if (target_ground_height != 0.0f) { @@ -458,7 +458,7 @@ void bomb_spawner_update(struct Moby *moby) { } fast_vec_sub(&launch_velocity, &spawn_position, &launch_origin); len = fast_vec_length(&launch_velocity); - if (spawner_data->b83 & 8) { + if (spawner_data->bomb_spawn_options & 8) { fast_vec_normalize( &launch_velocity, &launch_velocity, random_float_between(len, 3.0f)); } @@ -488,7 +488,7 @@ void bomb_spawner_update(struct Moby *moby) { } fast_vec_sub(&launch_velocity, &spawn_position, &launch_origin); len = fast_vec_length(&launch_velocity); - if (spawner_data->b83 & 8) { + if (spawner_data->bomb_spawn_options & 8) { fast_vec_normalize( &launch_velocity, &launch_velocity, random_float_between(len, 3.0f)); } @@ -519,7 +519,7 @@ void bomb_spawner_update(struct Moby *moby) { } fast_vec_sub(&launch_velocity, &spawn_position, &launch_origin); len = fast_vec_length(&launch_velocity); - if (spawner_data->b83 & 8) { + if (spawner_data->bomb_spawn_options & 8) { fast_vec_normalize( &launch_velocity, &launch_velocity, random_float_between(len, 3.0f)); } @@ -548,7 +548,7 @@ void bomb_spawner_update(struct Moby *moby) { (float *)&spawn_position, (float *)&launch_velocity, spawner_data->h8C, - spawner_data->b83); + spawner_data->bomb_spawn_options); if (spawned_moby != 0) { MOBY(spawned_moby)->update_dist = 0xFF; } From 29fbd2acd9b3b0fbdd58fef949933b75b83a110b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:07:22 +0000 Subject: [PATCH 590/758] decomp: clarify names in scoutbot_update f1B4 -> path_target_selection_status: Root 002d2d4c-002d2d88 reads int pvars+0x1B4: value 2 leaves the scoutbot idle/wandering; other values start approach. Checked health/target helper 002d37f0-002d3844 follows the selected path into +0x170 and sets +0x1B4 to 2 when the tracked position exceeds home-distance or height limits. The matching ScoutbotVars view names this target_selection_status; path_target_selection_status identifies the same role without colliding with that existing member. f200 -> ground_hover_height_offset: Retail initialization 002d2c54 writes 4.0 and approach entry 002d2d68 writes zero. Checked movement 002d3e48-002d3e58 reads pvars+0x216 and conditionally adds float +0x200 to home.z plus sinusoidal bob before subtracting moby.pos.z at 002d3e70. Thus this is the ground-enabled hover height offset. f204 -> hover_bob_phase: Retail 002d2c50-002d2c64 initializes pvars+0x204 with random_angle_radians. Checked movement 002d3e24-002d3e38 adds +0x20C through fast_add_rotations, stores the updated angle back to +0x204, and passes it to fast_sin for the vertical height calculation. This proves the hover bob phase. f208 -> hover_bob_amplitude: Retail 002d2c58 initializes float pvars+0x208 to 0.5 and 002d2d6c reduces it to 0.1 on approach. Checked movement 002d3e34-002d3e50 multiplies sin(updated +0x204 phase) by +0x208 and adds home.z, proving the vertical hover bob amplitude. f20C -> hover_bob_phase_increment: Retail 002d2c68-002d2c8c stores frame_time * 2.0943952 at pvars+0x20C. Checked movement 002d3e24-002d3e38 loads that field as the second input of fast_add_rotations with phase +0x204, then saves the new phase and evaluates its sine. Thus it is the per-update hover bob phase increment. f21C -> tracked_target_path_index: Root 002d2bcc and 002d2c20-002d2c24 tests int pvars+0x21C for -1 and removes an invalid instance. Checked helper 002d37b4-002d37ec loads this field, shifts it left by two, indexes the l08_paths pointer table at 0x001b0cb0, and passes path+0x10 and its count to the target-following call. This proves the tracked target path index, also corroborated by the existing ScoutbotVars target_path_index view. f220 -> glow_point_position: Retail 002d368c-002d369c calls moby_point_position with moby, point index 3 and destination pvars+0x220, then 002d36a0-002d36ac registers draw_scoutbot_glow_quad. Supplied C for that callback copies the corresponding ScoutbotVars glow_quad_anchor_position into M[3] and uses it as the billboard translation. Thus Data_3DF8's char[0x10] +0x220 holds the glow point position; its array type and dimensions remain unchanged. --- src/overlays/shared/enemies/scoutbot.c | 48 +++++++++++++------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index 3a49e99861..64242e8e6d 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -80,22 +80,22 @@ typedef struct Data_3DF8 { float target_pos[4]; char pad180[0x30]; Moby *target; - int f1B4; + int path_target_selection_status; char pad1B8[8]; float home[4]; float glow_a[4]; float glow_b[4]; float wander_goal[4]; - float f200; - float f204; - float f208; - float f20C; + float ground_hover_height_offset; + float hover_bob_phase; + float hover_bob_amplitude; + float hover_bob_phase_increment; float yaw_speed; short voice; short near_ground; Moby *current_target; - int f21C; - char f220[0x10]; + int tracked_target_path_index; + char glow_point_position[0x10]; char sound_state[0x10]; } Data_3DF8; @@ -202,17 +202,17 @@ void scoutbot_update(Moby *moby) { qcopy(target_pos, scoutbot_instance_vars->target_pos); switch (moby->state) { case SCOUTBOT_STATE_INITIALIZE: - if (scoutbot_instance_vars->f21C == -1) { + if (scoutbot_instance_vars->tracked_target_path_index == -1) { mark_moby_for_removal(moby); return; } moby->flags |= 0x1000; moby->rot.z = random_angle_radians(); - scoutbot_instance_vars->f200 = 4.0f; - scoutbot_instance_vars->f204 = random_angle_radians(); - scoutbot_instance_vars->f208 = 0.5f; + scoutbot_instance_vars->ground_hover_height_offset = 4.0f; + scoutbot_instance_vars->hover_bob_phase = random_angle_radians(); + scoutbot_instance_vars->hover_bob_amplitude = 0.5f; clear_u64_value(scoutbot_instance_vars->vel); - scoutbot_instance_vars->f20C = frame_time * 2.0943952f; + scoutbot_instance_vars->hover_bob_phase_increment = frame_time * 2.0943952f; scoutbot_instance_vars->b58 = truncate_float_to_s32(15.0f); scoutbot_instance_vars->b5A = truncate_float_to_s32(9.6f); scoutbot_instance_vars->pD0 = &D_L08_00161888; @@ -232,9 +232,9 @@ void scoutbot_update(Moby *moby) { scoutbot_instance_vars->b29 = 0; break; case SCOUTBOT_STATE_IDLE: - if (scoutbot_instance_vars->f1B4 != 2) { - scoutbot_instance_vars->f200 = 0.0f; - scoutbot_instance_vars->f208 = 0.1f; + if (scoutbot_instance_vars->path_target_selection_status != 2) { + scoutbot_instance_vars->ground_hover_height_offset = 0.0f; + scoutbot_instance_vars->hover_bob_amplitude = 0.1f; if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, 6); } @@ -284,8 +284,8 @@ void scoutbot_update(Moby *moby) { moby->state = SCOUTBOT_STATE_WAIT_FOR_VOICE; } else if (vector_distance_xy(target_pos, scoutbot_instance_vars->home) > 15.0f || absolute_float(scoutbot_instance_vars->home[2] - target_pos[2]) > 4.0f) { - scoutbot_instance_vars->f200 = 4.0f; - scoutbot_instance_vars->f208 = 0.5f; + scoutbot_instance_vars->ground_hover_height_offset = 4.0f; + scoutbot_instance_vars->hover_bob_amplitude = 0.5f; if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, 6); } @@ -297,8 +297,8 @@ void scoutbot_update(Moby *moby) { float heading = fast_arc_tan(scoutbot_instance_vars->home[0] - moby->pos.x, scoutbot_instance_vars->home[1] - moby->pos.y); - scoutbot_instance_vars->f200 = 4.0f; - scoutbot_instance_vars->f208 = 0.5f; + scoutbot_instance_vars->ground_hover_height_offset = 4.0f; + scoutbot_instance_vars->hover_bob_amplitude = 0.5f; turn_3DF8(moby, heading, &scoutbot_instance_vars->yaw_speed, 0.01f, 0.3f, 0.05f); if (fast_difference_between_rotations(moby->rot.z, heading) < 0.7853982f) { scoutbot_instance_vars->vel[0] += fast_cos(moby->rot.z) * (frame_time_sq * 12.0f); @@ -344,8 +344,8 @@ void scoutbot_update(Moby *moby) { spawn_nearby_effect( scoutbot_instance_vars->current_target, moby, 1, shot_pos, offset, 1.0f); } - scoutbot_instance_vars->f200 = 4.0f; - scoutbot_instance_vars->f208 = 0.5f; + scoutbot_instance_vars->ground_hover_height_offset = 4.0f; + scoutbot_instance_vars->hover_bob_amplitude = 0.5f; if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, 3); } @@ -367,8 +367,8 @@ void scoutbot_update(Moby *moby) { } case 5: if (FUN_L00_002dc9f0(moby, scoutbot_instance_vars->react)) { - scoutbot_instance_vars->f200 = 4.0f; - scoutbot_instance_vars->f208 = 0.5f; + scoutbot_instance_vars->ground_hover_height_offset = 4.0f; + scoutbot_instance_vars->hover_bob_amplitude = 0.5f; if (moby->prev_seq != 2) { blend_moby_animation(moby, 2, 0, 3); } @@ -408,7 +408,7 @@ void scoutbot_update(Moby *moby) { col = 0x7F2828A0; } moby->glow_color = colorlerp_3DF8(moby->glow_color, col, 0.1f); - moby_point_position(moby, 3, scoutbot_instance_vars->f220); + moby_point_position(moby, 3, scoutbot_instance_vars->glow_point_position); add_draw_callback(draw_scoutbot_glow_quad, moby); } } From a816239d6682bc9bf377317c64d249c4376dfe13 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:07:26 +0000 Subject: [PATCH 591/758] decomp: clarify names in test_dummy_on_hoverboard_update unk248 -> manipulator3_target_rotation_z: Root 0x002d0e4c-0x002d0ef0 clamps yaw spring velocity, optionally mirrors it, multiplies by 30 and stores to pvars+0x248. The update_joint_animation call at 0x002d0efc receives pvars+0x1E0 (manipulator3). Checked helper request 27642afbb9af4978bf8d8ec1349b7a2a shows 0x0025df60 loading manipulator+0x68 as spring_angle target f12, with current angle at +0x48 and velocity at +0x58 (0x0025df70-0x0025df78), the third of three rotation components. Thus this member is manipulator3's target Z rotation, without inferring a bone identity. unk280 -> previous_render_position: Retail 0x002d0fd8-0x002d0fe8 subtracts pvars+0x280 from moby+0x10 after movement position, height offset and sine bob have been applied (0x002d0f70-0x002d0fe0). At 0x002d0fec-0x002d0ff8 the same current moby position is copied into pvars+0x280 for the next update. Source fast_vec_sub(ahead, moby+0x10, field) followed by qcopy(field,moby+0x10) proves the saved previous render position role. unk2B4 -> normal_speed_target: Initialization 0x002d05d4-0x002d0610 computes frame time*17 plus the competitor-dependent offset and stores it at pvars+0x2B4; 0x002d0688 optionally scales it. In the nonboost speed branch 0x002d0d1c loads this field as the base speed, applies airborne/race adjustments, then 0x002d0dcc approaches that target into forward speed pvars+0x2BC. Source's boost_timer_frames branch distinguishes this normal speed target from +0x2B8. unk2B8 -> boost_speed_target: Retail 0x002d05fc-0x002d060c initializes pvars+0x2B8 to frame time*24 plus competitor offset; optional scaling writes it at 0x002d0684. When the boost timer remains active, 0x002d0ddc-0x002d0df0 loads this field as approach_value's target and passes the address of current forward speed +0x2BC with frame_time_sq*20 as step. Source pairs this branch with boost_timer_frames and uses +0x2B4 in the expired-timer branch. unk2BC -> forward_speed: Retail 0x002d0b6c-0x002d0ba4 multiplies cos(yaw) and sin(yaw) by pvars+0x2BC to form XY displacement with zero Z, then adds it to movement_position. At 0x002d0a44-0x002d0a54 path distance is divided by the same member to obtain jump duration. Approach calls 0x002d0dcc/0x002d0dec adjust this member toward normal or boost speed targets. This proves the per-update forward motion speed role. unk2C4 -> yaw_spring_velocity: Root 0x002d0930-0x002d0944 caches moby+0x48 (yaw) and pvars+0x2C4, then passes both to spring_angle at 0x002d0b38-0x002d0b44 to steer toward path heading. Checked helper request 7cbb7dcc51f1460da6557b911a8477db shows a1 saved to s2 at 0x002575a0, updated by its spring step at 0x00257660-0x00257664, read as the angle increment at 0x00257674, and added to current angle at 0x00257670. Root reads it as float at 0x002d0e4c to drive turning pose; declared s32 storage is preserved. unk2CC -> race_competitor_index: In this race competitor update, retail 0x002d0d6c-0x002d0d7c loads pvars+0x2CC, doubles it and indexes the hero race table at hero+0x7C0; the selected s16 is compared to hero+0x8C0 to adjust this competitor's speed. Initialization 0x002d05d4-0x002d0608 also uses this index to vary both speed targets by index*frame_time*1.55, and 0x002d06e8-0x002d0724 uses its parity for mirrored pose flags. These uses establish a competitor selector, without assigning semantics to the race table's scalar entries. unk2F2 -> reactivation_timer_frames: The hit branch clears pvars+0x2F2 at 0x002d08dc and switches to WAIT_FOR_REACTIVATION at 0x002d08f0, disabling collision. In that state 0x002d074c-0x002d075c increments the member once per update; 0x002d0760-0x002d076c compares it to scale_game_frames(240). Only after this delay and the camera angle test can 0x002d07d0-0x002d07e0 restore racing/collision. This is elapsed reactivation delay in frames. --- .../l16/mobys/test_dummy_on_hoverboard.c | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c index af012fb4fb..7372909d86 100644 --- a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c +++ b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c @@ -162,20 +162,20 @@ typedef struct HoverboardDummyVars { u8 pad_1CC[0x14]; u8 manipulator3; u8 pad_1E1[0x67]; - f32 unk248; + f32 manipulator3_target_rotation_z; u8 pad_24C[0x14]; f32 movement_position[4]; f32 unk270[4]; - f32 unk280[4]; + f32 previous_render_position[4]; u8 pad_290[0x20]; s32 path; - f32 unk2B4; - f32 unk2B8; - f32 unk2BC; + f32 normal_speed_target; + f32 boost_speed_target; + f32 forward_speed; char *unk2C0; - s32 unk2C4; + s32 yaw_spring_velocity; f32 unk2C8; - s32 unk2CC; + s32 race_competitor_index; u8 pad_2D0[0xC]; s32 timer_2DC; u8 pad_2E0[0x4]; @@ -183,7 +183,7 @@ typedef struct HoverboardDummyVars { f32 unk2E8; u8 pad_2EC[0x4]; s16 jump_landing_node_index; - s16 unk2F2; + s16 reactivation_timer_frames; s16 unk2F4; u16 boost_timer_frames; } HoverboardDummyVars; @@ -592,9 +592,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->unk2CC * (time * 1.55f); - hoverboard_dummy_data->unk2B4 = time * 17.0f + offset; - hoverboard_dummy_data->unk2B8 = time * 24.0f + offset; + 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; if (D_0013D4DF == 0) { slow = (float)(D_0015EE3C_gp - 5); if (slow < 0.0f) { @@ -604,8 +604,8 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { if (slow < 0.8f) { slow = 0.8f; } - hoverboard_dummy_data->unk2B4 *= slow; - hoverboard_dummy_data->unk2B8 *= slow; + hoverboard_dummy_data->normal_speed_target *= slow; + hoverboard_dummy_data->boost_speed_target *= slow; } hoverboard_dummy_data->unk2E8 = random_angle_radians(); hoverboard_dummy_data->unk29 = 0; @@ -620,11 +620,11 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { hoverboard_dummy_data->unk2F4 = 0; *(short *)&hoverboard_dummy_data->boost_timer_frames = scale_game_frames(180); *(int *)&hoverboard_dummy_data->unk2C8 = 0; - hoverboard_dummy_data->unk2C4 = 0; + hoverboard_dummy_data->yaw_spring_velocity = 0; hoverboard_dummy_data->jump_timer = 0; hoverboard_dummy_data->timer_2DC = 0; - *(int *)&hoverboard_dummy_data->unk2BC = 0; - if (hoverboard_dummy_data->unk2CC % 2 == 1) { + *(int *)&hoverboard_dummy_data->forward_speed = 0; + if (hoverboard_dummy_data->race_competitor_index % 2 == 1) { MOBY(moby)->flags |= 0x8000; } MOBY(moby)->hit_slot = 255; @@ -635,10 +635,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->unk2F2 + 1; + int count = *(unsigned short *)&hoverboard_dummy_data->reactivation_timer_frames + 1; short timer = count; - hoverboard_dummy_data->unk2F2 = count; + hoverboard_dummy_data->reactivation_timer_frames = count; if (scale_game_frames(240) < timer) { LevelCamera *player = &l16_camera; @@ -683,7 +683,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { 0); spawn_moby_break_fragments(moby, 0x655, 1, 0x656, 2, 2, 0); spawn_moby_break_fragments(moby, 0x6FA, 1, 0x6FB, 1, 1, 0); - hoverboard_dummy_data->unk2F2 = 0; + hoverboard_dummy_data->reactivation_timer_frames = 0; *(int *)(hero_base + 0x8A8) += 250; MOBY(moby)->state = HOVERBOARD_DUMMY_STATE_WAIT_FOR_REACTIVATION; MOBY(moby)->collision = 0; @@ -716,7 +716,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { float rise = *(float *)(path - (-(last * 16)) + 0x18) - *(float *)(path - (-(first * 16)) + 0x18); - duration = distance / hoverboard_dummy_data->unk2BC; + duration = distance / hoverboard_dummy_data->forward_speed; target = rise / duration + frame_time_sq * 21.0f * duration * 0.5f; } if (hoverboard_dummy_data->unk2C8 < 0.0f) { @@ -732,7 +732,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { angle = fast_arc_tan(path_node_or_explosion_position[0] - MOBY(moby)->pos.x, path_node_or_explosion_position[1] - MOBY(moby)->pos.y); spring_angle(moby + 0x48, - &hoverboard_dummy_data->unk2C4, + &hoverboard_dummy_data->yaw_spring_velocity, 0, angle, frame_scale_sq * 0.035f, @@ -741,8 +741,8 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { if (hoverboard_dummy_data->movement_position[2] < path_node_or_explosion_position[2] - 5.0f) { hoverboard_dummy_data->movement_position[2] = path_node_or_explosion_position[2]; } - delta[0] = fast_cos(MOBY(moby)->rot.z) * hoverboard_dummy_data->unk2BC; - delta[1] = fast_sin(MOBY(moby)->rot.z) * hoverboard_dummy_data->unk2BC; + delta[0] = fast_cos(MOBY(moby)->rot.z) * hoverboard_dummy_data->forward_speed; + delta[1] = fast_sin(MOBY(moby)->rot.z) * hoverboard_dummy_data->forward_speed; delta[2] = 0.0f; fast_vec_add(hoverboard_dummy_data->movement_position, hoverboard_dummy_data->movement_position, delta); fast_vec_scale(ahead, delta, 3.0f); @@ -773,7 +773,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { } hoverboard_dummy_data->movement_position[2] += hoverboard_dummy_data->unk2C8; if (fast_dec_timer_s16(&hoverboard_dummy_data->boost_timer_frames)) { - speed = hoverboard_dummy_data->unk2B4; + speed = hoverboard_dummy_data->normal_speed_target; if (z < hoverboard_dummy_data->movement_position[2]) { speed = D_0015ED6C * 19.0f; } @@ -781,27 +781,27 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { if (*(int *)(hero_base + 0x894) < scale_game_frames(700)) { speed += D_0015ED6C * 3.0f; } - if (*(short *)(hero_base - (-(hoverboard_dummy_data->unk2CC * 2)) + 0x7C0) < + if (*(short *)(hero_base - (-(hoverboard_dummy_data->race_competitor_index * 2)) + 0x7C0) < *(int *)(hero_base + 0x8C0)) { speed -= D_0015ED6C; } else { speed += D_0015ED6C; } - if (speed < hoverboard_dummy_data->unk2BC) { - approach_value(&hoverboard_dummy_data->unk2BC, speed, frame_time_sq * 7.0f); + if (speed < hoverboard_dummy_data->forward_speed) { + approach_value(&hoverboard_dummy_data->forward_speed, speed, frame_time_sq * 7.0f); } else { - approach_value(&hoverboard_dummy_data->unk2BC, speed, frame_time_sq * 15.0f); + approach_value(&hoverboard_dummy_data->forward_speed, speed, frame_time_sq * 15.0f); } } else { - approach_value(&hoverboard_dummy_data->unk2BC, - hoverboard_dummy_data->unk2B8, + approach_value(&hoverboard_dummy_data->forward_speed, + hoverboard_dummy_data->boost_speed_target, frame_time_sq * 20.0f); } if (gap < 0.2f && hoverboard_dummy_data->unk2C8 < 0.0f) { hoverboard_dummy_data->movement_position[2] = z; hoverboard_dummy_data->jump_timer = 0; } - rate = *(float *)&hoverboard_dummy_data->unk2C4; + rate = *(float *)&hoverboard_dummy_data->yaw_spring_velocity; limit = D_0015ED6C * 2.6179938f; if (limit < rate) { rate = limit; @@ -814,7 +814,7 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { { float coefficient = frame_scale_sq; - hoverboard_dummy_data->unk248 = rate * 30.0f; + hoverboard_dummy_data->manipulator3_target_rotation_z = rate * 30.0f; hoverboard_dummy_data->unkC8 = rate * 20.0f; hoverboard_dummy_data->unk1C8 = rate * 50.0f; hoverboard_dummy_data->unk144 = rate * 40.0f; @@ -848,8 +848,8 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { fast_add_rotations(hoverboard_dummy_data->unk2E8, bob_time * 6.108652f); } MOBY(moby)->pos.z += fast_sin(hoverboard_dummy_data->unk2E8) * 0.08f; - fast_vec_sub(ahead, moby + 0x10, hoverboard_dummy_data->unk280); - qcopy(hoverboard_dummy_data->unk280, moby + 0x10); + fast_vec_sub(ahead, moby + 0x10, hoverboard_dummy_data->previous_render_position); + qcopy(hoverboard_dummy_data->previous_render_position, moby + 0x10); moby_point_position(moby, (D_L16_0015F5CC & 1) | 4, impact); angle = random_angle_radians(); scale = D_0015ED6C * 0.25f; From c65c3f168d60260fc0e6b4b63f09aab868149581 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:07:29 +0000 Subject: [PATCH 592/758] decomp: clarify names in blarg_elite_commando_update unk2B0 -> initial_position_x: Retail 0x002d2f28-0x002d2f30 copies the initial Moby position to pvars+0x2B0. In RETURN_TO_INITIAL_POSITION, 0x002d2fe8/0x002d3054 subtract current pos.x from this coordinate to calculate heading; 0x002d309c passes this saved position to movement. unk2B4 -> initial_position_y: Retail initialization 0x002d2f28-0x002d2f30 saves Moby position at pvars+0x2B0. Return-state instructions 0x002d304c-0x002d305c load +0x2B4 and subtract Moby pos.y (+0x14), proving the saved initial Y coordinate. unk2C4 -> base_position_y: Retail 0x002d3784-0x002d3794 adds amplitude times sine to pvars+0x2C4 and writes Moby pos.y, proving Y of the position before bobbing. Initialization copies position to +0x2C0 at 0x002d2f18-0x002d2f24; supplied advance_blarg_elite_commando_base_position moves that vector, and parent-follow transforms it. unk2D8 -> heading_angular_step: Retail 0x002d3084/0x002d3090, 0x002d3364/0x002d3370 and 0x002d33f4/0x002d3400 pass pvars+0x2D8 beside Moby rot.z to approach_angle. Checked helper request c01eb260519341f9bfcbb013bbed0b63: 0x0025770c preserves second pointer in s0; 0x0025788c-0x00257898 loads its float and adds it through fast_add_rotations to the first pointer's angle. Braking at 0x00257774-0x00257788 uses its square over deceleration; it is the persistent heading angular step, with original u8[4] storage preserved. unk2DE -> rocket_fire_cycle_count: In established FIRE_ROCKETS state, retail 0x002d34ac-0x002d34dc detects animation window 10 and increments this u16. At 0x002d34d4 it compares the signed count with 3; completion enters idle, sets cooldown and clears +0x2DE at 0x002d351c. It counts firing animation cycles, not individual rocket spawns at windows 2,17,32. unk2E4 -> bobbing_z_phase_step: Retail 0x002d2e44-0x002d2e64 initializes +0x2E4 to random 90..180 degrees times DEG_TO_RAD and frame_time. At 0x002d374c-0x002d3764 it advances phase +0x2E8 through fast_add_rotations; 0x002d3798-0x002d37b0 uses that phase's sine for the Moby Z bobbing offset. unk2EC -> bobbing_amplitude: Retail 0x002d2dac zeroes +0x2EC; 0x002d3714-0x002d372c approaches 0.25 with a frame_time-scaled step. At 0x002d3768-0x002d37b0 this float multiplies all three phase sines before addition to base-position coordinates, proving shared bobbing amplitude. unk2F0 -> bobbing_x_phase_step: Retail 0x002d2e04-0x002d2e20 initializes +0x2F0 to random 90..180 degrees converted to radians and scaled by frame_time. 0x002d3730-0x002d3748 adds it to phase +0x2F4; 0x002d375c-0x002d3778 uses that sine to offset Moby pos.x. unk2FC -> bobbing_y_phase: Retail 0x002d2dd0-0x002d2de4 initializes +0x2FC from random_angle_radians. 0x002d373c-0x002d3758 advances it by +0x2F8 with fast_add_rotations; 0x002d377c-0x002d3794 takes its sine and applies amplitude to base Y to generate Moby pos.y. unk302 -> patrol_countdown_ticks: Retail 0x002d2e60-0x002d2e78 initializes signed timer +0x302 from scaled random 180..360 frames. Pursuit-disabled idle decrements it at 0x002d31b8-0x002d31bc, then starts MOVE_TO_PATROL_NODE and resets 180 frames at 0x002d31f8-0x002d3200. Patrol movement tests the same timer at 0x002d326c-0x002d3274 and resets random 180..360 on arrival/timeout at 0x002d32a4-0x002d32cc, proving both patrol waiting and travel countdown. unk304 -> voice_playback_handle: Retail 0x002d37e0-0x002d37e8 loads +0x304 as the voice_is_playing argument for this Moby. If no voice is playing and distance is below 32, 0x002d37f4-0x002d3804 calls voice playback with 7,4,Moby and stores its returned identifier back to +0x304; it retains the voice playback handle. --- .../shared/enemies/blarg_elite_commando.c | 82 +++++++++---------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_elite_commando.c b/src/overlays/shared/enemies/blarg_elite_commando.c index 4ae4982d42..ba2ed966e3 100644 --- a/src/overlays/shared/enemies/blarg_elite_commando.c +++ b/src/overlays/shared/enemies/blarg_elite_commando.c @@ -91,30 +91,30 @@ typedef struct L16DamageData { f32 unk294; f32 joint_3_target_yaw; u8 pad29C[0x14]; - f32 unk2B0; - f32 unk2B4; + f32 initial_position_x; + f32 initial_position_y; u8 pad2B8[0x4]; f32 cached_position_z; f32 unk2C0; - f32 unk2C4; + f32 base_position_y; f32 unk2C8; f32 parent_heading_offset; char *unk2D0; f32 movement_step_length; - u8 unk2D8[0x4]; + u8 heading_angular_step[0x4]; s16 state_countdown_ticks; - u16 unk2DE; + u16 rocket_fire_cycle_count; int pursuit_timer; - f32 unk2E4; + f32 bobbing_z_phase_step; f32 unk2E8; - f32 unk2EC; - f32 unk2F0; + f32 bobbing_amplitude; + f32 bobbing_x_phase_step; f32 unk2F4; f32 unk2F8; - f32 unk2FC; + f32 bobbing_y_phase; s16 selected_path_node_index; - s16 unk302; - s32 unk304; + s16 patrol_countdown_ticks; + s32 voice_playback_handle; int reward_hits; } L16DamageData; @@ -243,19 +243,19 @@ void blarg_elite_commando_update(char *commando_moby) { manipulator_set_scale(&commando_data->unk130, 2.5f); switch (((unsigned char *)commando_moby)[0x20]) { case COMMANDO_STATE_INITIALIZE: - *(int *)&commando_data->unk2EC = 0; + *(int *)&commando_data->bobbing_amplitude = 0; commando_data->unk29 = 1; commando_data->unk24 = 3; commando_data->unk28 = 2; commando_data->unk30 = 1.5f; commando_data->health = 3.0f; commando_data->unk2F4 = random_angle_radians(); - commando_data->unk2FC = random_angle_radians(); + commando_data->bobbing_y_phase = random_angle_radians(); commando_data->unk2E8 = random_angle_radians(); - commando_data->unk2F0 = random_float_between(90.0f, 180.0f) * DEG_TO_RAD * frame_time; + commando_data->bobbing_x_phase_step = random_float_between(90.0f, 180.0f) * DEG_TO_RAD * frame_time; commando_data->unk2F8 = random_float_between(90.0f, 180.0f) * DEG_TO_RAD * frame_time; - commando_data->unk2E4 = random_float_between(90.0f, 180.0f) * DEG_TO_RAD * frame_time; - commando_data->unk302 = + commando_data->bobbing_z_phase_step = random_float_between(90.0f, 180.0f) * DEG_TO_RAD * frame_time; + commando_data->patrol_countdown_ticks = truncate_float_to_s32(scale_time(random_float_between(180.0f, 360.0f))); if (random_integer_below(2)) MOBY(commando_moby)->flags |= 0x8000; @@ -271,7 +271,7 @@ void blarg_elite_commando_update(char *commando_moby) { } commando_data->reward_hits = 1; qcopy(&commando_data->unk2C0, position); - qcopy(&commando_data->unk2B0, position); + qcopy(&commando_data->initial_position_x, position); } if (commando_data->unk128) { MOBY(commando_moby)->state = COMMANDO_STATE_FOLLOW_PARENT_TRANSFORM; @@ -303,15 +303,15 @@ void blarg_elite_commando_update(char *commando_moby) { func_L16_002D5280_update(commando_moby, scratch_vector, 1); } else { heading = (float *)&MOBY(commando_moby)->rot.z; - angle = fast_arc_tan(commando_data->unk2B0 - MOBY(commando_moby)->pos.x, - commando_data->unk2B4 - MOBY(commando_moby)->pos.y); + angle = fast_arc_tan(commando_data->initial_position_x - MOBY(commando_moby)->pos.x, + commando_data->initial_position_y - MOBY(commando_moby)->pos.y); approach_angle(heading, - (float *)(&commando_data->unk2D8), + (float *)(&commando_data->heading_angular_step), angle, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 12.566371f); - distance = func_L16_002D5280_update(commando_moby, &commando_data->unk2B0, 1); + distance = func_L16_002D5280_update(commando_moby, &commando_data->initial_position_x, 1); if (((unsigned char *)commando_moby)[0x53] != 0) blend_moby_animation(commando_moby, 0, 0, scale_game_frames(10)); if (distance < 1.0f) @@ -335,11 +335,11 @@ void blarg_elite_commando_update(char *commando_moby) { } } } - } else if (fast_dec_timer_s16(&commando_data->unk302)) { + } else if (fast_dec_timer_s16(&commando_data->patrol_countdown_ticks)) { if (commando_data->unk120 >= 0) { commando_data->selected_path_node_index = (commando_data->selected_path_node_index + 1) % 2; MOBY(commando_moby)->state = COMMANDO_STATE_MOVE_TO_PATROL_NODE; - commando_data->unk302 = scale_game_frames(180); + commando_data->patrol_countdown_ticks = scale_game_frames(180); select_blarg_elite_commando_movement_animation(commando_moby); } } @@ -353,13 +353,13 @@ void blarg_elite_commando_update(char *commando_moby) { 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)); - commando_data->unk302 = + commando_data->patrol_countdown_ticks = truncate_float_to_s32(scale_time(random_float_between(180.0f, 360.0f))); - } else if (fast_dec_timer_s16(&commando_data->unk302)) { + } else if (fast_dec_timer_s16(&commando_data->patrol_countdown_ticks)) { 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)); - commando_data->unk302 = + commando_data->patrol_countdown_ticks = truncate_float_to_s32(scale_time(random_float_between(180.0f, 360.0f))); } if (commando_data->movement_step_length < 2.0f * frame_time && path_distance < 0.5f) { @@ -375,7 +375,7 @@ void blarg_elite_commando_update(char *commando_moby) { angle = fast_arc_tan(target[0] - MOBY(commando_moby)->pos.x, target[1] - MOBY(commando_moby)->pos.y); approach_angle(heading, - (float *)(&commando_data->unk2D8), + (float *)(&commando_data->heading_angular_step), angle, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, @@ -392,7 +392,7 @@ void blarg_elite_commando_update(char *commando_moby) { angle = fast_arc_tan(target[0] - MOBY(commando_moby)->pos.x, target[1] - MOBY(commando_moby)->pos.y); approach_angle(heading, - (float *)(&commando_data->unk2D8), + (float *)(&commando_data->heading_angular_step), angle, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, @@ -405,14 +405,14 @@ 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->unk2DE + 1; - commando_data->unk2DE = count; + int count = commando_data->rocket_fire_cycle_count + 1; + commando_data->rocket_fire_cycle_count = count; if ((short)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)); commando_data->state_countdown_ticks = scale_game_frames(60); - commando_data->unk2DE = 0; + commando_data->rocket_fire_cycle_count = 0; } } break; @@ -469,23 +469,23 @@ void blarg_elite_commando_update(char *commando_moby) { commando_data->cached_position_z = MOBY(commando_moby)->pos.z; if (((unsigned char *)commando_moby)[0x20] != 0 && ((unsigned char *)commando_moby)[0x20] != 10) { - approach_value((float *)(&commando_data->unk2EC), 0.25f, frame_time * 0.25f); + approach_value((float *)(&commando_data->bobbing_amplitude), 0.25f, frame_time * 0.25f); commando_data->unk2F4 = - fast_add_rotations(commando_data->unk2F4, commando_data->unk2F0); - commando_data->unk2FC = - fast_add_rotations(commando_data->unk2FC, commando_data->unk2F8); + fast_add_rotations(commando_data->unk2F4, commando_data->bobbing_x_phase_step); + commando_data->bobbing_y_phase = + fast_add_rotations(commando_data->bobbing_y_phase, commando_data->unk2F8); commando_data->unk2E8 = - fast_add_rotations(commando_data->unk2E8, commando_data->unk2E4); + fast_add_rotations(commando_data->unk2E8, commando_data->bobbing_z_phase_step); MOBY(commando_moby)->pos.x = - commando_data->unk2C0 + commando_data->unk2EC * fast_sin(commando_data->unk2F4); + commando_data->unk2C0 + commando_data->bobbing_amplitude * fast_sin(commando_data->unk2F4); MOBY(commando_moby)->pos.y = - commando_data->unk2C4 + commando_data->unk2EC * fast_sin(commando_data->unk2FC); + commando_data->base_position_y + commando_data->bobbing_amplitude * fast_sin(commando_data->bobbing_y_phase); MOBY(commando_moby)->pos.z = - commando_data->unk2C8 + commando_data->unk2EC * fast_sin(commando_data->unk2E8); + commando_data->unk2C8 + commando_data->bobbing_amplitude * fast_sin(commando_data->unk2E8); } if (fast_vec_dist(&MOBY(commando_moby)->pos, D_L16_001671C0) < 32.0f && - !voice_is_playing(commando_moby, commando_data->unk304)) - commando_data->unk304 = func_0022ED80_update(7, 4, commando_moby); + !voice_is_playing(commando_moby, commando_data->voice_playback_handle)) + commando_data->voice_playback_handle = func_0022ED80_update(7, 4, commando_moby); } if (blarg_elite_commando_joint_aim_enabled_gp) update_blarg_elite_commando_joint_aim(commando_moby); From a1e95d64660a98836150efd675d9378e572905b2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:09:31 +0000 Subject: [PATCH 593/758] decomp: clarify names in nanotech_ball_update f7C -> pending_collection_count: D_2D9EA0 int member +0x7C is zeroed only when establishing shared leader D_L00_0015F63C at 0x002d8ba4-0x002d8bd0. Retail 0x002d8ed8-0x002d8ef8 loads that leader's pvars, adds its +0x7C count to hero health and compares against max health to reserve capacity. Successful transition into NANOTECH_BALL_STATE_COLLECTING at 0x002d8f5c increments this shared count at 0x002d8f60-0x002d8f74. On the first expired slot timer, the h56==0 guard at 0x002d950c-0x002d9510 permits the one-time health increment/clamp at 0x002d9534-0x002d9548, then decrements leader +0x7C and clamps it to zero at 0x002d954c-0x002d9568, setting h56 at 0x002d9584 to prevent repeated awards/decrements. This proves a count of pending pickup collections, rather than a particle-slot count. --- src/overlays/shared/pickups/nanotech_ball.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/pickups/nanotech_ball.c b/src/overlays/shared/pickups/nanotech_ball.c index 877586c454..2f122e35cc 100644 --- a/src/overlays/shared/pickups/nanotech_ball.c +++ b/src/overlays/shared/pickups/nanotech_ball.c @@ -178,7 +178,7 @@ typedef struct D_2D9EA0 { short h58[4]; float f60[4]; char p70[0xC]; - int f7C; + int pending_collection_count; } D_2D9EA0; /* Ported from rac1-decomp (nonmatching/shared/func_L00_002DACC0.c: func_L00_002DACC0), a near miss there; names translated to the US level program. */ @@ -1288,7 +1288,7 @@ void nanotech_ball_update(Moby *moby) { euler_rotation_basis(&moby->rot_row0, &moby->rot); D_L00_0015F63C = moby; moby->update_dist = 0xFF; - nanotech_ball_state->f7C = 0; + nanotech_ball_state->pending_collection_count = 0; func_L00_001FF4B0_2D9EA0(&D_L00_001E3CA0[0], &moby->rot_row0, D_L00_00161A14_gp); qcopy(&D_L00_001E4070_2D9EA0[0], &moby->rot_row2); func_L00_001FF4B0_2D9EA0(&D_L00_001E3CA0[1], &moby->rot_row1, D_L00_00161A14_gp); @@ -1353,14 +1353,14 @@ void nanotech_ball_update(Moby *moby) { max_hp = 4; if (moby->state != NANOTECH_BALL_STATE_FOLLOW_OWNER && D_L00_0015F63C != 0 && ((D_2D9EA0 *)D_L00_0015F63C->pvars) != 0 && player->health.hp != 0 && - (player->health.hp + ((D_2D9EA0 *)D_L00_0015F63C->pvars)->f7C < max_hp || + (player->health.hp + ((D_2D9EA0 *)D_L00_0015F63C->pvars)->pending_collection_count < max_hp || (nanotech_ball_invulnerability_pickup_enabled != 0 && player->invulnerable_frames == 0)) && fast_vec_dist(&moby->pos, &player->motion.pos) < 10.0f && func_L00_002D9E30_2D9EA0(moby)) { int i; moby->state = NANOTECH_BALL_STATE_COLLECTING; - ((D_2D9EA0 *)D_L00_0015F63C->pvars)->f7C++; + ((D_2D9EA0 *)D_L00_0015F63C->pvars)->pending_collection_count++; if (nanotech_ball_invulnerability_pickup_enabled != 0) player->invulnerable_frames = func_001F9850_2D9EA0(0x258); nanotech_ball_state->h54 = @@ -1537,9 +1537,9 @@ void nanotech_ball_update(Moby *moby) { } { D_2D9EA0 *leader_data = (D_2D9EA0 *)D_L00_0015F63C->pvars; - leader_data->f7C--; - if (leader_data->f7C < 0) - leader_data->f7C = 0; + leader_data->pending_collection_count--; + if (leader_data->pending_collection_count < 0) + leader_data->pending_collection_count = 0; } func_L00_0028EF68_2D9EA0(1, 0, moby, 0x1F5); nanotech_ball_state->h56 = 1; From 03e35d41c612b681e4ad7b856fcf6c86c48036f4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:09:34 +0000 Subject: [PATCH 594/758] decomp: clarify names in extermitank_update unk198 -> turret_pitch: Rename ExtermitankVars.unk198 to turret_pitch. Retail 00304668 initializes this f32 to zero. At 003048d8-003048f0, while the hero is within 16 XY units, step_angle_toward_target approaches 0.08726646 radians (five degrees); 0030492c-0030493c instead approaches zero at distance. The firing state repeats the five-degree target at 003050b0-003050c4. Retail 00304940-0030494c and 003050c8-003050d4 pass the stored angle to build_axis_rotation_quaternion with axis selector 1 and the second attached manipulator's rotation at private +0x140. Checked helper 0022eca0-0022eccc routes selector 1 to the quaternion Y component at 0022ecc0, whereas selector 2 routes to Z. Together with the adjacent established turret_yaw field, its hero-directed yaw update and separate axis-2 rotation, this establishes the turret's pitch angle rather than a timer or angular speed. --- src/overlays/l05/mobys/extermitank.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/l05/mobys/extermitank.c b/src/overlays/l05/mobys/extermitank.c index de136728d8..f91804efea 100644 --- a/src/overlays/l05/mobys/extermitank.c +++ b/src/overlays/l05/mobys/extermitank.c @@ -151,7 +151,7 @@ typedef struct ExtermitankVars { u8 pad_18C[0x4]; s32 path_190; f32 turret_yaw; - f32 unk198; + f32 turret_pitch; u8 pad_19C[0x2]; s16 removal_scaled_frames; f32 particle_slots[4]; @@ -244,7 +244,7 @@ void extermitank_update(unsigned char *moby) { extermitank_vars->unk28 = 3; extermitank_vars->health = 6.0f; extermitank_vars->unk180 = scale_game_frames(0x3C); - *(int *)&extermitank_vars->unk198 = 0; + *(int *)&extermitank_vars->turret_pitch = 0; { float t = *(volatile float *)&D_L05_00161B78; extermitank_vars->turret_yaw = *(volatile float *)(moby + 0x48); @@ -301,14 +301,14 @@ void extermitank_update(unsigned char *moby) { *(float *)(g + 0x84) - MOBY(moby)->pos.y); step_angle_toward_target(&extermitank_vars->turret_yaw, 0, a, D_0015ED6C_gp * 1.5707964f); step_angle_toward_target( - &extermitank_vars->unk198, 0, 0.08726646f, D_0015ED6C_gp * 1.5707964f); + &extermitank_vars->turret_pitch, 0, 0.08726646f, D_0015ED6C_gp * 1.5707964f); } else { step_angle_toward_target( &extermitank_vars->turret_yaw, 0, MOBY(moby)->rot.z, D_0015ED6C_gp * 1.5707964f); step_angle_toward_target( - &extermitank_vars->unk198, 0, 0.0f, D_0015ED6C_gp * 1.5707964f); + &extermitank_vars->turret_pitch, 0, 0.0f, D_0015ED6C_gp * 1.5707964f); } - build_axis_rotation_quaternion(extermitank_vars->unk140, 1, extermitank_vars->unk198); + build_axis_rotation_quaternion(extermitank_vars->unk140, 1, extermitank_vars->turret_pitch); build_axis_rotation_quaternion( extermitank_vars->unk100, 2, @@ -480,9 +480,9 @@ void extermitank_update(unsigned char *moby) { *(float *)(g + 0x84) - MOBY(moby)->pos.y); step_angle_toward_target(&extermitank_vars->turret_yaw, 0, a, D_0015ED6C_gp * 1.5707964f); step_angle_toward_target( - &extermitank_vars->unk198, 0, 0.08726646f, D_0015ED6C_gp * 1.5707964f); + &extermitank_vars->turret_pitch, 0, 0.08726646f, D_0015ED6C_gp * 1.5707964f); } - build_axis_rotation_quaternion(extermitank_vars->unk140, 1, extermitank_vars->unk198); + build_axis_rotation_quaternion(extermitank_vars->unk140, 1, extermitank_vars->turret_pitch); build_axis_rotation_quaternion( extermitank_vars->unk100, 2, From d41550d94a9ddd9c0bc574617bd3aceaed0262f5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:11:27 +0000 Subject: [PATCH 595/758] decomp: clarify names in blarg_helicopter_update unk8C -> rocket_fire_timer_frames: Retail s2 is moby->pvars (002e9fb4). The s16 at s2+0x8c is passed to fast_dec_timer_s16 at 002ea65c-002ea660; a zero return skips the entire firing block at 002ea664. On expiry the block obtains a muzzle point and calls spawn_rocket at 002ea7bc. Continued firing reloads this same field with scale_game_frames(40) at 002ea918-002ea924; stopping endpoint movement reloads scale_game_frames(50) at 002eaa50-002eaa60. Initial-path code also enforces a frame-scaled minimum delay at 002ea41c-002ea458. Thus this is the frame countdown gating rocket firing, including the initial/post-movement delays. unkBE -> target_first_path_endpoint: Retail 002ea990 loads the alternate path index from s2+0xa4 and 002ea994 reads the s16 selector at s2+0xbe. Nonzero selects path+0x10 (the first point) for destination-minus-moby-position at 002ea9a8-002ea9bc; zero selects path+point_count*16 (the last point) at 002ea9cc-002ea9e8. This displacement drives movement at 002eaaa0-002eaabc. When near the endpoint and fully stopped, 002eaa58-002eaa68 writes (selector==0), alternating the next movement destination. Hence it flags whether the selected target is the first path endpoint, rather than storing an index. --- src/overlays/l12/mobys/blarg_helicopter.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l12/mobys/blarg_helicopter.c b/src/overlays/l12/mobys/blarg_helicopter.c index 0b35f25993..f1cdbd91d5 100644 --- a/src/overlays/l12/mobys/blarg_helicopter.c +++ b/src/overlays/l12/mobys/blarg_helicopter.c @@ -147,7 +147,7 @@ typedef struct BlargHelicopterVars { s32 unk80; u8 pad_84[0x4]; f32 yaw_turn_velocity; - s16 unk8C; + s16 rocket_fire_timer_frames; s16 knockback_timer_frames; f32 bob_angle; f32 unk94; @@ -162,7 +162,7 @@ typedef struct BlargHelicopterVars { s32 unkB4; s32 unkB8; s16 unkBC; - s16 unkBE; + s16 target_first_path_endpoint; s32 unkC0; s32 unkC4; u8 pad_C8[0x8]; @@ -322,14 +322,14 @@ void blarg_helicopter_update(struct Moby *moby) { l12_camera.focus_time = 0; } if (blarg_helicopter_vars->unkC0) { - count = blarg_helicopter_vars->unk8C; + count = blarg_helicopter_vars->rocket_fire_timer_frames; limit = D_L12_00161F20 - 3; if (limit > 5) limit = 5; if (limit < 0) limit = 0; if (count < limit * scale_game_frames(15)) - blarg_helicopter_vars->unk8C = limit * scale_game_frames(15); + blarg_helicopter_vars->rocket_fire_timer_frames = limit * scale_game_frames(15); } if (follow_blarg_helicopter_path(moby, blarg_helicopter_vars->unkA0)) moby->state = BLARG_HELICOPTER_AIM_AND_FIRE; @@ -368,7 +368,7 @@ void blarg_helicopter_update(struct Moby *moby) { frame_time * 0.7853982f); clear_u64_value(blarg_helicopter_vars->unk70); update_blarg_helicopter_motion_tilt(moby); - if (fast_dec_timer_s16(&blarg_helicopter_vars->unk8C)) { + if (fast_dec_timer_s16(&blarg_helicopter_vars->rocket_fire_timer_frames)) { ++blarg_helicopter_vars->unkBC; moby_point_position(moby, blarg_helicopter_vars->unkB8, &position); blarg_helicopter_vars->unkB8 = blarg_helicopter_vars->unkB8 == 0; @@ -413,7 +413,7 @@ void blarg_helicopter_update(struct Moby *moby) { blarg_helicopter_vars->unkBC = 0; moby->state = BLARG_HELICOPTER_MOVE_BETWEEN_PATH_ENDPOINTS; } else - blarg_helicopter_vars->unk8C = scale_game_frames(40); + blarg_helicopter_vars->rocket_fire_timer_frames = scale_game_frames(40); } } break; @@ -428,7 +428,7 @@ void blarg_helicopter_update(struct Moby *moby) { frame_time * 0.7853982f); { char *path = ((char *)l12_paths[blarg_helicopter_vars->unkA4]); - if (blarg_helicopter_vars->unkBE != 0) + if (blarg_helicopter_vars->target_first_path_endpoint != 0) fast_vec_sub(&position, path + 16, &moby->pos); else fast_vec_sub(&position, path + *(int *)path * 16, &moby->pos); @@ -437,8 +437,8 @@ void blarg_helicopter_update(struct Moby *moby) { if (!(distance > 5.5f)) { approach_value(&blarg_helicopter_vars->unk94, 0.0f, frame_time_sq * 9.0f); if (blarg_helicopter_vars->unk94 == 0.0f) { - blarg_helicopter_vars->unk8C = scale_game_frames(50); - blarg_helicopter_vars->unkBE = blarg_helicopter_vars->unkBE == 0; + blarg_helicopter_vars->rocket_fire_timer_frames = scale_game_frames(50); + blarg_helicopter_vars->target_first_path_endpoint = blarg_helicopter_vars->target_first_path_endpoint == 0; moby->state = BLARG_HELICOPTER_AIM_AND_FIRE; break; } From bd9b4fed80280a0317c92a991e561d2e0b243fcc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:13:15 +0000 Subject: [PATCH 596/758] decomp: clarify names in frog_update unk148 -> motion_collision_height_offset: Retail root 0x002e88b4 zeros pvars+0x148. Calls at 0x002e8c88 and 0x002e8ca8 pass pvars+0x120 to step_moby_motion. Thus this field is motion+0x28: checked helper 0x0026b57c..0x0026b598 adds it to position Z for ground probing, 0x0026b9e4..0x0026ba2c adds it to collision-query positions, and 0x0026bb54..0x0026bb80 subtracts it from corrected Z. It is the motion collision height offset; preserve the existing s32 declaration despite float loads. unk1C4 -> pursuit_target_mode: At 0x002e8ea0..0x002e8eb4 pvars+0x1C4 equal to 2 suppresses ordinary approach selection; 0x002e9034..0x002e9048 redirects approach to RETURN_HOME. Checked health/target helper 0x002e97dc writes 1 for an explicit target, 0x002e9854..0x002e985c and 0x002e98c4..0x002e98d0 write 2 for absent/rejected targets, and 0x002e9894..0x002e9898 writes 0 for accepted automatic targets. This matches RespawnVars.target_mode and its named FROG_TARGET_MODE members in the supplied source. unk1E4 -> movement_speed: Retail 0x002e8b00..0x002e8b1c loads pvars+0x1E4 and multiplies it by D_0015ED6C, then fast_vec_normalize scales the facing vector to that magnitude for move_frog_with_collision_resolution at 0x002e8b38. The same displacement calculation serves wandering, approach and return home; 0x002e92c8..0x002e92e0 doubles it during the attack window. This proves the movement speed scalar. unk1E8 -> blink_countdown: Retail 0x002e8ee0 and 0x002e9148..0x002e9158 test this signed short to permit blinking approach and stop it on expiry. Checked helper 0x002e9764..0x002e978c initializes pvars+0x1E8 from a scaled random 180..240 duration; 0x002e9794..0x002e97b8 decrements it and extends target range while nonzero. Supplied overlapping RespawnVars calls this same field blink_timer. unk1FC -> wander_destination_timer: In WANDER, 0x002e8d9c..0x002e8da4 passes pvars+0x1FC to fast_dec_timer and branches to generate a new destination on expiry. The new destination is home plus a random XY radius at 0x002e8df0..0x002e8e00; 0x002e8e04..0x002e8e2c resets this timer to scaled random 45..75 frames. This is the wander destination refresh timer. unk202 -> initialize_in_respawn: Retail 0x002e895c loads pvars+0x202 during INITIALIZE. When nonzero, 0x002e8964..0x002e8980 selects FROG_STATE_RESPAWN (15), clears moby collision and sets hidden flags 0x41 while clearing 0x1000. The zero branch proceeds to normal path/wander initialization. The name describes only this proven initialization gate, without claiming its producer or a timer role. unk20A -> target_selection_frame_slot: Retail 0x002e87dc..0x002e880c assigns the incrementing frog initialization counter modulo eight to signed short pvars+0x20A. Checked target helper 0x002e980c..0x002e9834 compares this field with level_frame_count modulo eight and calls select_hero_or_gadgebot_target at 0x002e9840 only for the matching slot. This is the staggered target-selection frame slot. unk210 -> home_position: Retail 0x002e885c..0x002e8864 initially copies moby position into pvars+0x210. FOLLOW_PATH replaces it with the final path position at 0x002e8ba8..0x002e8bb8, and 0x002e8bcc..0x002e8c5c uses it as the jump destination. RETURN_HOME 0x002e9380..0x002e9390 subtracts current position from it and 0x002e93f0..0x002e9410 tests arrival. WANDER also adds its random offset to this position at 0x002e8df4..0x002e8dfc. These uses prove home position. unk248 -> glow_animation_phase: Retail 0x002e88c8..0x002e88d8 seeds pvars+0x248 with random_angle_radians. Checked helper 0x002e9708..0x002e972c advances that same field using an angular rate times frame time and fast_add_rotations, then 0x002e9728..0x002e9754 uses its sine, shifted/scaled to 0..1, to tween the moby glow color. The supplied overlapping RespawnVars names it glow_phase; this field is its glow animation phase. unk24C -> path_activation_distance_xy: In WAIT_TO_FOLLOW_PATH, retail 0x002e8a60..0x002e8a74 computes vector_distance_xy between D_0013F3D0 and the frog position and compares the result with pvars+0x24C. Only distance below this field reaches 0x002e8a80..0x002e8a90 to select FOLLOW_PATH and walking animation. This proves an XY distance threshold for activating path following without assuming the identity of D_0013F3D0. --- src/overlays/shared/enemies/frog.c | 78 +++++++++++++++--------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index dd8584bfb3..9b3c8800ee 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -57,37 +57,37 @@ typedef struct FrogVars { f32 unk13C; s32 unk140; s32 unk144; - s32 unk148; + s32 motion_collision_height_offset; u8 pad14C[0x11]; s8 unk15D; u8 pad15E[0x62]; unsigned char *unk1C0; - s32 unk1C4; + s32 pursuit_target_mode; u8 pad1C8[0xc]; f32 turn_angle; f32 turn_range_degrees; u8 pad1DC[0x8]; - f32 unk1E4; - s16 unk1E8; + f32 movement_speed; + s16 blink_countdown; s16 unk1EA; s32 unk1EC; u8 pad1F0[0x8]; s32 path_index; - s32 unk1FC; + s32 wander_destination_timer; s16 unk200; - s16 unk202; + s16 initialize_in_respawn; u8 pad204[0x4]; s16 path_point; - s16 unk20A; + s16 target_selection_frame_slot; char *child; - f32 unk210[4]; + f32 home_position[4]; u8 unk220[0x10]; u8 unk230[0x10]; s16 unk240; s16 unk242; f32 unk244; - f32 unk248; - f32 unk24C; + f32 glow_animation_phase; + f32 path_activation_distance_xy; u8 unk250[0x4]; } FrogVars; @@ -306,7 +306,7 @@ void frog_update(unsigned char *moby) { float wait; int spawn_count = l06_frog_frame_slot_assignment_count; int divisor = frog_instance_vars->unk240; - frog_instance_vars->unk20A = spawn_count % 8; + frog_instance_vars->target_selection_frame_slot = spawn_count % 8; l06_frog_frame_slot_assignment_count = spawn_count + 1; if (divisor != 0) { MOBY(moby)->unkB4 = MOBY(moby)->unkB4 / divisor; @@ -314,17 +314,17 @@ void frog_update(unsigned char *moby) { MOBY(moby)->flags |= 0x100; frog_instance_vars->unk58 = truncate_float_to_s32(8.0f); frog_instance_vars->unk5A = truncate_float_to_s32(3.2f); - qcopy(&frog_instance_vars->unk210, &MOBY(moby)->pos); + qcopy(&frog_instance_vars->home_position, &MOBY(moby)->pos); qcopy(&frog_instance_vars->unk230, &MOBY(moby)->pos); qcopy(&frog_instance_vars->unk220, moby + 0x40); frog_instance_vars->path_point = 0; wait = random_float_between(0.5f, 3.0f); frog_instance_vars->unk130 = D_0015ED70 * 20.0f; - frog_instance_vars->unk148 = 0; + frog_instance_vars->motion_collision_height_offset = 0; frog_instance_vars->unk134 = 0; frog_instance_vars->unk140 = 0x200; frog_instance_vars->unk244 = wait; - frog_instance_vars->unk248 = random_angle_radians(); + frog_instance_vars->glow_animation_phase = random_angle_radians(); frog_instance_vars->unkD0 = D_L06_00161BF0; frog_instance_vars->unk29 = 1; if (frog_instance_vars->unk200 != 0) { @@ -347,7 +347,7 @@ void frog_update(unsigned char *moby) { (frog_instance_vars->child)[0x31] = 1; update_entity(frog_instance_vars->child); MOBY(moby)->flags |= 0x41; - } else if (frog_instance_vars->unk202 != 0) { + } else if (frog_instance_vars->initialize_in_respawn != 0) { MOBY(moby)->state = FROG_STATE_RESPAWN; MOBY(moby)->collision = 0; MOBY(moby)->flags = (MOBY(moby)->flags | 0x41) & 0xEFFF; @@ -381,7 +381,7 @@ void frog_update(unsigned char *moby) { probe_frog_local_z_collision((char *)moby); blend_frog_rotation_to_facing_frame((char *)moby, (float *)D_L06_00174600, A); if (vector_distance_xy(((char *)&D_0013F3D0), &MOBY(moby)->pos) < - frog_instance_vars->unk24C) { + frog_instance_vars->path_activation_distance_xy) { MOBY(moby)->state = FROG_STATE_FOLLOW_PATH; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(5)); @@ -396,7 +396,7 @@ void frog_update(unsigned char *moby) { fast_vec_sub(A, B, &MOBY(moby)->pos); probe_frog_local_z_collision((char *)moby); blend_frog_rotation_to_facing_frame((char *)moby, (float *)D_L06_00174600, A); - fast_vec_normalize(C, moby + 0xC0, frog_instance_vars->unk1E4 * D_0015ED6C_gp); + fast_vec_normalize(C, moby + 0xC0, frog_instance_vars->movement_speed * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, C, 0, 0.3f, 0.3f); transform_vector_by_basis(A, A, moby + 0xC0); if (vector_length_xy(A) < 0.5f) { @@ -408,13 +408,13 @@ void frog_update(unsigned char *moby) { frog_instance_vars->path_point = frog_instance_vars->path_point + 1; return; } - qcopy(&frog_instance_vars->unk210, (char *)path + point_count * 16); - qcopy(&frog_instance_vars->unk230, &frog_instance_vars->unk210); - home_distance_xy = vector_distance_xy(&MOBY(moby)->pos, &frog_instance_vars->unk210); + qcopy(&frog_instance_vars->home_position, (char *)path + point_count * 16); + qcopy(&frog_instance_vars->unk230, &frog_instance_vars->home_position); + home_distance_xy = vector_distance_xy(&MOBY(moby)->pos, &frog_instance_vars->home_position); return_speed = home_distance_xy / (float)scale_game_frames(30); frog_instance_vars->unk138 = return_speed; frog_instance_vars->unk13C = FUN_L00_0025abf0(&MOBY(moby)->pos, - &frog_instance_vars->unk210, + &frog_instance_vars->home_position, 0, return_speed, -frog_instance_vars->unk130); @@ -426,8 +426,8 @@ void frog_update(unsigned char *moby) { 2, 1, 0, - fast_arc_tan(frog_instance_vars->unk210[0] - MOBY(moby)->pos.x, - frog_instance_vars->unk210[1] - MOBY(moby)->pos.y)); + fast_arc_tan(frog_instance_vars->home_position[0] - MOBY(moby)->pos.x, + frog_instance_vars->home_position[1] - MOBY(moby)->pos.y)); MOBY(moby)->state = FROG_STATE_JUMP_TO_HOME; } break; @@ -469,23 +469,23 @@ void frog_update(unsigned char *moby) { case FROG_STATE_WANDER: if (MOBY(moby)->visible != 0) { if (fast_vec_dist(&MOBY(moby)->pos, &frog_instance_vars->unk230) < 0.05f || - fast_dec_timer((int *)(&frog_instance_vars->unk1FC)) != 0) { + fast_dec_timer((int *)(&frog_instance_vars->wander_destination_timer)) != 0) { float angle = random_angle_radians(); float radius = random_float_between(0.5f, 2.0f); A[0] = fast_cos(angle) * radius; A[1] = fast_sin(angle) * radius; A[2] = 0.0f; - fast_vec_add(&frog_instance_vars->unk230, &frog_instance_vars->unk210, A); - frog_instance_vars->unk1FC = + fast_vec_add(&frog_instance_vars->unk230, &frog_instance_vars->home_position, A); + frog_instance_vars->wander_destination_timer = scale_game_frames(truncate_float_to_s32(random_float_between(45.0f, 75.0f))); } fast_vec_sub(C, &frog_instance_vars->unk230, &MOBY(moby)->pos); probe_frog_local_z_collision((char *)moby); blend_frog_rotation_to_facing_frame((char *)moby, (float *)D_L06_00174600, C); - fast_vec_normalize(B, moby + 0xC0, frog_instance_vars->unk1E4 * D_0015ED6C_gp); + 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->unk1C4 != 2 && random_integer_below(9) == 0) { + if (frog_instance_vars->pursuit_target_mode != 2 && 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) * @@ -493,7 +493,7 @@ void frog_update(unsigned char *moby) { MOBY(moby)->state = FROG_STATE_APPROACH_TARGET; if (MOBY(moby)->prev_seq != 4) blend_moby_animation(moby, 4, 0, 0); - } else if (frog_instance_vars->unk1E8 != 0) { + } else if (frog_instance_vars->blink_countdown != 0) { frog_instance_vars->turn_angle = random_float_between(-frog_instance_vars->turn_range_degrees, frog_instance_vars->turn_range_degrees) * @@ -513,13 +513,13 @@ void frog_update(unsigned char *moby) { B[2] = 0.0f; probe_frog_local_z_collision((char *)moby); blend_frog_rotation_to_facing_frame((char *)moby, (float *)D_L06_00174600, B); - fast_vec_normalize(A, moby + 0xC0, frog_instance_vars->unk1E4 * D_0015ED6C_gp); + fast_vec_normalize(A, moby + 0xC0, frog_instance_vars->movement_speed * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, A, 1, 0.3f, 0.3f); if (vector_distance_xy(&MOBY(moby)->pos, target + 0x10) < 2.0f) { 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->unk1C4 == 2) { + } else if (frog_instance_vars->pursuit_target_mode == 2) { MOBY(moby)->state = FROG_STATE_RETURN_HOME; } break; @@ -537,13 +537,13 @@ void frog_update(unsigned char *moby) { near = 0; probe_frog_local_z_collision((char *)moby); blend_frog_rotation_to_facing_frame((char *)moby, (float *)D_L06_00174600, B); - fast_vec_normalize(A, moby + 0xC0, frog_instance_vars->unk1E4 * D_0015ED6C_gp); + fast_vec_normalize(A, moby + 0xC0, frog_instance_vars->movement_speed * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, A, 1, 0.3f, 0.3f); if (path_8808(frog_instance_vars->unk1EC, &MOBY(moby)->pos, target + 0x10, D) != 0 && fast_vec_dist(&MOBY(moby)->pos, D) < frog_instance_vars->unk244) { near = 1; } - if (frog_instance_vars->unk1E8 == 0) { + if (frog_instance_vars->blink_countdown == 0) { MOBY(moby)->state = FROG_STATE_RETURN_HOME; } else if (near) { MOBY(moby)->state = FROG_STATE_APPROACH_PAUSE; @@ -576,7 +576,7 @@ void frog_update(unsigned char *moby) { *(int *)(((char *)&camera_secondary_mode)) != 0x51) { fast_vec_normalize(A, moby + 0xC0, - (frog_instance_vars->unk1E4 + frog_instance_vars->unk1E4) * + (frog_instance_vars->movement_speed + frog_instance_vars->movement_speed) * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, A, 1, 0.3f, 0.3f); collect_mobies_in_sphere_at_moby_point(moby, 0, 1, 0.333f, 1.0f, 1.0f, 0, 1, 0); @@ -591,18 +591,18 @@ void frog_update(unsigned char *moby) { break; } case FROG_STATE_RETURN_HOME: - fast_vec_sub(B, &frog_instance_vars->unk210, &MOBY(moby)->pos); + fast_vec_sub(B, &frog_instance_vars->home_position, &MOBY(moby)->pos); probe_frog_local_z_collision((char *)moby); blend_frog_rotation_to_facing_frame((char *)moby, (float *)D_L06_00174600, B); - fast_vec_normalize(A, moby + 0xC0, frog_instance_vars->unk1E4 * D_0015ED6C_gp); + fast_vec_normalize(A, moby + 0xC0, frog_instance_vars->movement_speed * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, A, 1, 0.3f, 0.3f); - if (vector_distance_xy(&MOBY(moby)->pos, &frog_instance_vars->unk210) < 2.0f) { + if (vector_distance_xy(&MOBY(moby)->pos, &frog_instance_vars->home_position) < 2.0f) { 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->unk1C4 != 2) { + } else if (frog_instance_vars->pursuit_target_mode != 2) { MOBY(moby)->state = FROG_STATE_APPROACH_TARGET; - } else if (frog_instance_vars->unk1E8 != 0) { + } else if (frog_instance_vars->blink_countdown != 0) { MOBY(moby)->state = FROG_STATE_BLINKING_APPROACH_TARGET; } break; From dc5e3bde40ccd487cd54044509f21cf655235668 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:13:19 +0000 Subject: [PATCH 597/758] decomp: clarify names in plasmabot_update unk160 -> manipulator_attachment_header: Authoritative plasmabot.c declares this 16-byte array at pvars+0x160. Retail 0x002b1b24..0x002b1b3c checks its byte +1 and passes its address as a2 to the established attach_manipulator binding with a1=3. Checked helper 0x00257a90..0x00257afc stores the selector and attached flag at +0/+1, the resolved pointer at +4, the previous moby manipulator-list head at +8, then installs this record at moby+0x64. These operations prove attachment-header storage, without asserting joint identity or changing its array dimensions. unk248 -> path_traversal_delay_timer: Retail 0x002b1bd0..0x002b1bd8 scales plasmabot_path_traversal_delay_frames and stores the result in this signed halfword at pvars+0x248. Backward-path completion repeats that initialization at 0x002b1f08..0x002b1f1c before state 13. State 13 decrements the halfword at 0x002b1e24..0x002b1e3c and permits forward traversal state 3 only on expiry; state 1 likewise waits at 0x002b1ba0..0x002b1ba8 before starting traversal. Original retail decompilation agrees with the source timer uses. unk262 -> aim_sweep_timer: Retail 0x002b211c..0x002b2128 scales l14_plasmabot_aim_sweep_duration_frames into this signed halfword at pvars+0x262. State 6 loads it signed at 0x002b21dc, converts and divides by the scaled duration at 0x002b21e0..0x002b21fc to derive angular sweep progress. The same halfword is decremented at 0x002b237c..0x002b2384; expiry ends the sweep, enters state 7 and releases the beam slot at 0x002b238c..0x002b23b4. unk264 -> hatch_index: Retail 0x002b1a24..0x002b1a38 rejects a negative signed word at pvars+0x264 and prints the established plasmabot_missing_hatch_index_format; supplied checked string evidence explicitly diagnoses no hatch index. Root 0x002b1bb0..0x002b1bb4 and 0x002b1ebc..0x002b1ec0 pass that word to refresh_plasmabot_hatch_reset_delay. Checked helper 0x002d9874..0x002d989c shifts its argument by 8 and adds the moby-array base before reading the indexed moby's state and pvars; 0x002d98c8..0x002d98d0 refreshes its reset delay. Thus it is a hatch moby index, not a pointer or path index. unk278 -> aim_sweep_center_angle: Retail 0x002b1f28..0x002b1f44 computes atan2 of target-minus-plasmabot X/Y into f20. After aiming-error and path-crossing gates, 0x002b20f4 stores that bearing in the float at pvars+0x278 before entering the sweep preparation state. State 6 reloads it at 0x002b2200 and subtracts -half_angle+2*half_angle*(timer/duration) at 0x002b2204..0x002b2218 before passing the result to update_plasmabot_aim_quaternion at 0x002b2258..0x002b2260. This proves the stored bearing is the sweep center angle. --- src/overlays/shared/enemies/plasmabot.c | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index 930e5cb077..ca8adafe78 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -86,7 +86,7 @@ typedef struct PlasmabotVars { u8 pad118[0x8]; u8 unk120[0x10]; u8 unk130[0x30]; - u8 unk160[0x10]; + u8 manipulator_attachment_header[0x10]; u8 aim_quaternion_storage[0x70]; u8 unk1E0[0x10]; u8 unk1F0[0x10]; @@ -98,18 +98,18 @@ typedef struct PlasmabotVars { s32 heading_angular_velocity; s32 path_index; /* 0x240: into l14_paths, -1: none */ s32 target_path_index; - s16 unk248; + s16 path_traversal_delay_timer; u8 pad24A[0x2]; s32 path_segment_index; f32 path_offset_and_spring_velocities[4]; s16 beam_cooldown_timer; - s16 unk262; - s32 unk264; + s16 aim_sweep_timer; + s32 hatch_index; f32 aim_yaw_offset; s32 aim_yaw_angular_velocity; s32 unk270; s32 aim_joint_angular_velocity; - f32 unk278; + f32 aim_sweep_center_angle; f32 path_traversal_direction; s32 aim_pitch_angle; s32 aim_pitch_angular_velocity; @@ -436,7 +436,7 @@ void plasmabot_update(char *moby) { } } if (((unsigned char *)plasmabot_update_private_vars)[0x24A] != 0 && - plasmabot_update_private_vars->unk264 < 0) { + plasmabot_update_private_vars->hatch_index < 0) { DebugPrint(plasmabot_missing_hatch_index_format, ((short)MOBY(moby)->save_id)); { call_D678(moby); @@ -459,7 +459,7 @@ void plasmabot_update(char *moby) { plasmabot_update_private_vars->unk58 = truncate_float_to_s32(15.0f); plasmabot_update_private_vars->unk5A = truncate_float_to_s32(16.0f); plasmabot_update_private_vars->path_traversal_direction = 1.0f; - plasmabot_update_private_vars->unk248 = 0; + plasmabot_update_private_vars->path_traversal_delay_timer = 0; plasmabot_update_private_vars->heading_angular_velocity = 0; plasmabot_update_private_vars->beam_cooldown_timer = 0; *(int *)&plasmabot_update_private_vars->aim_yaw_offset = 0; @@ -472,7 +472,7 @@ void plasmabot_update(char *moby) { attach_manipulator(moby, 2, &plasmabot_update_private_vars->unk120); } if (((unsigned char *)plasmabot_update_private_vars)[0x161] == 0) { - attach_manipulator(moby, 3, &plasmabot_update_private_vars->unk160); + attach_manipulator(moby, 3, &plasmabot_update_private_vars->manipulator_attachment_header); } if (((unsigned char *)plasmabot_update_private_vars)[0x24A] != 0) { deactivate_plasmabot(moby); @@ -491,13 +491,13 @@ void plasmabot_update(char *moby) { float *path; if (plasmabot_update_private_vars->target_selection_status == 2) return; - if (fast_dec_timer_s16(&plasmabot_update_private_vars->unk248) == 0) + if (fast_dec_timer_s16(&plasmabot_update_private_vars->path_traversal_delay_timer) == 0) return; - if (refresh_plasmabot_hatch_reset_delay(plasmabot_update_private_vars->unk264) == 0) + if (refresh_plasmabot_hatch_reset_delay(plasmabot_update_private_vars->hatch_index) == 0) return; if (call_4BF0(moby) == 0) return; - plasmabot_update_private_vars->unk248 = + plasmabot_update_private_vars->path_traversal_delay_timer = scale_game_frames(plasmabot_path_traversal_delay_frames); activate_plasmabot(moby); ((unsigned char *)moby)[0x20] = 2; @@ -565,7 +565,7 @@ void plasmabot_update(char *moby) { frame_time * 6.2831855f); if (plasmabot_update_private_vars->target_selection_status == 2) break; - if (fast_dec_timer_s16(&plasmabot_update_private_vars->unk248) == 0) + if (fast_dec_timer_s16(&plasmabot_update_private_vars->path_traversal_delay_timer) == 0) break; ((unsigned char *)moby)[0x20] = 3; blend_moby_animation(moby, 3, 0, scale_game_frames(10)); @@ -586,14 +586,14 @@ void plasmabot_update(char *moby) { break; case PLASMABOT_FOLLOW_PATH_BACKWARD: if (((unsigned char *)plasmabot_update_private_vars)[0x24A] != 0) { - refresh_plasmabot_hatch_reset_delay(plasmabot_update_private_vars->unk264); + refresh_plasmabot_hatch_reset_delay(plasmabot_update_private_vars->hatch_index); } if (follow_plasmabot_path(moby) != 0) { if (((unsigned char *)plasmabot_update_private_vars)[0x24A] != 0) { blend_moby_animation(moby, 2, 0, scale_game_frames(10)); ((unsigned char *)moby)[0x20] = 9; } else { - plasmabot_update_private_vars->unk248 = + plasmabot_update_private_vars->path_traversal_delay_timer = scale_game_frames(plasmabot_path_traversal_delay_frames); ((unsigned char *)moby)[0x20] = 0xD; } @@ -652,10 +652,10 @@ void plasmabot_update(char *moby) { &MOBY(plasmabot_aim_target_moby)->pos) != 0) break; reset_listed_plasmabot_beam_cooldowns(((unsigned char *)moby)[0x21]); - plasmabot_update_private_vars->unk278 = ang; + plasmabot_update_private_vars->aim_sweep_center_angle = ang; ((unsigned char *)moby)[0x20] = 5; blend_moby_animation(moby, 4, 0, scale_game_frames(5)); - plasmabot_update_private_vars->unk262 = + plasmabot_update_private_vars->aim_sweep_timer = scale_game_frames(l14_plasmabot_aim_sweep_duration_frames); break; } @@ -682,11 +682,11 @@ void plasmabot_update(char *moby) { flag = 0; ang = fast_arc_tan(MOBY(plasmabot_aim_target_moby)->pos.x - MOBY(moby)->pos.x, MOBY(plasmabot_aim_target_moby)->pos.y - MOBY(moby)->pos.y); - progress = convert_integer_to_float(plasmabot_update_private_vars->unk262); + progress = convert_integer_to_float(plasmabot_update_private_vars->aim_sweep_timer); progress = progress / convert_integer_to_float( scale_game_frames(l14_plasmabot_aim_sweep_duration_frames)); sweep = l14_plasmabot_aim_sweep_half_angle; - angle = fast_subtract_rotations(plasmabot_update_private_vars->unk278, + angle = fast_subtract_rotations(plasmabot_update_private_vars->aim_sweep_center_angle, -sweep + (sweep + sweep) * progress); if (((unsigned char *)plasmabot_update_private_vars)[0x24B] != 0) { if (MOBY(plasmabot_aim_target_moby)->pos.z + 0.1f - MOBY(moby)->pos.z < 0.0f) { @@ -720,7 +720,7 @@ void plasmabot_update(char *moby) { qcopy(end, D_L14_00174560); } set_beam_origin_transform_and_endpoint(moby, bone_transform_scratch, end); - if (fast_dec_timer_s16(&plasmabot_update_private_vars->unk262) != 0) { + if (fast_dec_timer_s16(&plasmabot_update_private_vars->aim_sweep_timer) != 0) { blend_moby_animation(moby, 6, 0, scale_game_frames(10)); ((unsigned char *)moby)[0x20] = 7; release_beam_slot_by_id(moby); From c962bd3bb46452a2d1a815b1ffc50f6e8e2747bb Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:16:53 +0000 Subject: [PATCH 598/758] decomp: clarify names in alien_queen_update unk114 -> saved_path_point_count: Retail 002f9bc0..002f9bd0 loads the selected path from D_L06_001B0C30[path], copies its first s32 to AlienQueenVars+0x114, and 002f9bd8..002f9bf8 divides that same header count by two with 16-byte point stride to choose the midpoint point. Source start_alien_queen_intro temporarily clears the path count. Checked retail finish_alien_queen_intro at 002fb4cc..002fb4f0 reloads the same path index, reads saved +0x114 and restores it to path offset 0. This is the saved path point count, not an index or pointer. unk2E -> death_control_flags: Root retail 002f9b58 initializes this u8 to 1. Checked direct helper update_alien_queen_hit_response_and_recovery at 002fad00..002fad3c loads AlienQueenVars+0x2E, tests mask 2, cancels the animation update and sets queen state 14 unless already post-death state 15. Root 002fa774..002fa7c4 tests this same field for exact value 2 and immediately disables collision and enters state 15; the other branch 002fa7ec..002fa8b4 waits for animation completion and spawns break fragments. These reads prove flags controlling entry to and execution of the death sequence; no meanings for other bits are asserted. --- src/overlays/l06/mobys/alien_queen.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l06/mobys/alien_queen.c b/src/overlays/l06/mobys/alien_queen.c index a3e3643517..0269cc28f1 100644 --- a/src/overlays/l06/mobys/alien_queen.c +++ b/src/overlays/l06/mobys/alien_queen.c @@ -363,7 +363,7 @@ typedef struct AlienQueenVars { u8 unk28; u8 unk29; u8 pad_2A[0x4]; - u8 unk2E; + u8 death_control_flags; u8 pad_2F[0x19]; f32 z_velocity; u8 pad_4C[0xC]; @@ -395,7 +395,7 @@ typedef struct AlienQueenVars { s32 unk108; s32 animation_update; s32 health_sixteenths; - s32 unk114; + s32 saved_path_point_count; f32 camera_blend_fraction; u8 unk11C; u8 pad_11D[0x3]; @@ -440,14 +440,14 @@ void alien_queen_update(unsigned char *moby) { alien_queen_update_vars->max_health = 0x1E; alien_queen_update_vars->unk29 = 1; alien_queen_update_vars->unk28 = 3; - alien_queen_update_vars->unk2E = 1; + alien_queen_update_vars->death_control_flags = 1; alien_queen_update_vars->unk58 = truncate_float_to_s32(14.0f); alien_queen_update_vars->unk5A = truncate_float_to_s32(18.4f); alien_queen_update_vars->timer_120 = scale_game_frames(0x4B0); alien_queen_update_vars->suppress_death_dialogue = 0; qcopy(alien_queen_update_vars->unkC0, moby + 0x10); alien_queen_update_vars->animation_update = -1; - alien_queen_update_vars->unk114 = *D_L06_001B0C30_q[alien_queen_update_vars->path]; + alien_queen_update_vars->saved_path_point_count = *D_L06_001B0C30_q[alien_queen_update_vars->path]; path = D_L06_001B0C30_q[alien_queen_update_vars->path]; lerp_vector(alien_queen_update_vars->path_midpoint, path + 4, @@ -729,7 +729,7 @@ void alien_queen_update(unsigned char *moby) { menu_item_enabled_19_lui[4] = 1; alien_queen_update_vars->health_sixteenths = 0; moby[0x30] = 0xFF; - if (alien_queen_update_vars->unk2E == 2) { + if (alien_queen_update_vars->death_control_flags == 2) { func_L06_002F6790_q(level_mobys_q + (alien_queen_update_vars->unk100 << 8)); set_listed_alien_queen_sliders_state_2_and_clear_data_28( alien_queen_update_vars->slider_list); @@ -911,7 +911,7 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { } MOBY(moby)->hit_slot = 0xFF; trooper_anim_finish(moby, &alien_queen_hit_recovery_vars->anim_state); - if ((alien_queen_hit_recovery_vars->unk2E & 2) && (unsigned char)moby[0x20] != 15) { + if ((alien_queen_hit_recovery_vars->death_control_flags & 2) && (unsigned char)moby[0x20] != 15) { if (alien_queen_hit_recovery_vars->animation_update != -1) { set_animation_parameter(alien_queen_hit_recovery_vars->animation_update, 0); alien_queen_hit_recovery_vars->animation_update = -1; From 0d6c277d224cdcfb869bf9e3d3c6fc561110bf2e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:19:17 +0000 Subject: [PATCH 599/758] decomp: clarify names in blarg_ship_update domain_0_value_2 -> BLARG_SHIP_TARGETING_FIRE_BLOCKED: Retail 0x002e521c loads d->targeting_status from private +0x114; 0x002e5220-0x002e5224 compares it with 2 and branches away from animation-window rocket emission to 0x002e5340, which requests non-firing sequence 2. The directly called targeting helper loads the same private base from moby+0x78 (0x002e5990), stores 2 to +0x114 when target selection returns no target (0x002e5b08-0x002e5b1c), or when point_in_path_xy rejects the selected target (0x002e5b3c-0x002e5b58), and stores zero on acceptance (0x002e5b44-0x002e5b48). Another helper-result/visibility failure stores 2 at 0x002e5b94-0x002e5ba8. Thus this is the targeting domain's fire-blocked status, distinct from ship state +0x20 and all Hero selectors. --- src/overlays/l10/mobys/blarg_ship.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l10/mobys/blarg_ship.c b/src/overlays/l10/mobys/blarg_ship.c index 24870e6b20..c2275809a6 100644 --- a/src/overlays/l10/mobys/blarg_ship.c +++ b/src/overlays/l10/mobys/blarg_ship.c @@ -194,6 +194,9 @@ void blarg_ship_update(Ship_5E48 *m) __asm__("FUN_L10_002e4a88"); /* Moby class 1229 */ void blarg_ship_update(Ship_5E48 *ship) { + enum { + BLARG_SHIP_TARGETING_FIRE_BLOCKED = 2 + }; ShipD_5E48 *d = ship->d; Ship_5E48 *tgt; AlignedVec4f A; @@ -315,7 +318,7 @@ void blarg_ship_update(Ship_5E48 *ship) { blend_moby_animation(ship, 3, 0, scale_game_frames(6)); ship->animation_speed = blarg_ship_firing_animation_speed_gp; } - if (ship->b52 == 3 && d->targeting_status != 2 && D_L10_001742D8 == tgt) { + if (ship->b52 == 3 && d->targeting_status != BLARG_SHIP_TARGETING_FIRE_BLOCKED && D_L10_001742D8 == tgt) { int near = is_value_within_interpolated_window((char *)ship, 1.0f); int far = is_value_within_interpolated_window((char *)ship, 16.0f); if (near || far) { From 648ef634ba914aa80b7565565db26e3a0548ba9b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:21:25 +0000 Subject: [PATCH 600/758] decomp: clarify names in suckcannon_update unk20A7 -> item_select_blocked: Supplied hero_set_state source explicitly saves p->item_select_blocked in old20A7 and clears that flag for on-foot transitions. The assigned SuckHero overlay aliases the same &hero object; retail 0x002da984 establishes hero base 0x0013F350 and 0x002da9d8 loads byte +0x20A7, rejecting suction startup when nonzero. Retail 0x002dab24-0x002dab28 and 0x002dacc8-0x002daccc cancel/prevent suction continuation for that same flag, and 0x002db0e0-0x002db0e4 inhibits loaded firing. Original Ghidra cRam001413f7 is exactly that hero byte and corroborates these branches. This reuses the supplied established hero-field meaning, rather than deriving semantics from offset alone. --- src/overlays/shared/weapons/suckcannon.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 90fe9fcbd1..473e7c1b17 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -209,7 +209,7 @@ typedef struct SuckHero { u8 pad2088[0x4]; s32 control_mode; u8 pad2090[0x17]; - u8 unk20A7; + u8 item_select_blocked; u8 pad20A8[0x4]; u8 unk20AC; } SuckHero; @@ -1471,7 +1471,7 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { break; } if ((controller_state.held & ((SuckHero *)&hero)->fire_buttons) && cannon->cooldown == 0 && - ((SuckHero *)&hero)->unk20A7 == 0 && ((SuckHero *)&hero)->unk20AC == 0 && + ((SuckHero *)&hero)->item_select_blocked == 0 && ((SuckHero *)&hero)->unk20AC == 0 && scale_game_frames(15) < ((SuckHero *)&hero)->ready_frames && is_suck_cannon_suction_blocked_by_hero_state() == 0) { start_equipped_item_animation(); @@ -1490,7 +1490,7 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { if (suck_cannon_moby->anim_flags & 2) blend_moby_animation(suck_cannon_moby, 3, 0, scale_game_frames(5)); if (is_suck_cannon_suction_blocked_by_hero_state() != 0 || ((SuckHero *)&hero)->unk20AC || - ((SuckHero *)&hero)->unk20A7) { + ((SuckHero *)&hero)->item_select_blocked) { sound = cannon->sound; if (sound != -1) { SuckVoice *s = (SuckVoice *)(((char *)&voice_pool)) + sound; @@ -1525,7 +1525,7 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { (((SuckHero *)&hero)->count < (item_text_variant[9] == 0 ? 5 : 10) && is_suck_cannon_suction_blocked_by_hero_state() == 0 && ((controller_state.held & ((SuckHero *)&hero)->fire_buttons) || cannon->cooldown) && - !((SuckHero *)&hero)->unk20AC && !((SuckHero *)&hero)->unk20A7))) { + !((SuckHero *)&hero)->unk20AC && !((SuckHero *)&hero)->item_select_blocked))) { cancel_hero_item_animation(); sound = cannon->sound; if (sound != -1) { @@ -1612,7 +1612,7 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { (controller_state.held & ((SuckHero *)&hero)->fire_buttons) && ((SuckHero *)&hero)->control_mode != 7 && ((SuckHero *)&hero)->control_mode != 3 && ((SuckHero *)&hero)->control_mode != 18 && ((SuckHero *)&hero)->control_mode != 17 && - !((SuckHero *)&hero)->unk20AC && !((SuckHero *)&hero)->unk20A7 && + !((SuckHero *)&hero)->unk20AC && !((SuckHero *)&hero)->item_select_blocked && scale_game_frames(22) < ((SuckHero *)&hero)->ready_frames) { start_equipped_item_animation(); blend_moby_animation(suck_cannon_moby, 5, 0, scale_game_frames(2)); From c022da517680cf8510cd7d7a52201b58cc5b775d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:21:28 +0000 Subject: [PATCH 601/758] decomp: clarify names in extermitank_update unk2E -> lifecycle_state: Rename ExtermitankVars.unk2E to lifecycle_state. Retail 00304370 loads the owner's pvars into s2. Initialization stores 1 to byte s2+0x2e at 00304644, alongside health and motion initialization, after placing the owner in EXTERMITANK_FOLLOW_PATH. On every update, after the two hit/particle helpers, 0030437c-00304384 tests this separate private byte against 2. Equality routes through 0030438c-003043b8 to remove each non-null child at private +0x184/+0x188 and then the owner, returning before the behavior-state dispatch at 00304404. Thus this byte records the extermitank instance's lifecycle status, independently of its path/firing behavior state; the name does not claim a complete enumeration or the producer of value 2. --- src/overlays/l05/mobys/extermitank.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l05/mobys/extermitank.c b/src/overlays/l05/mobys/extermitank.c index f91804efea..cc8e4b2d0a 100644 --- a/src/overlays/l05/mobys/extermitank.c +++ b/src/overlays/l05/mobys/extermitank.c @@ -104,7 +104,7 @@ typedef struct ExtermitankVars { u8 unk28; u8 unk29; u8 pad_2A[0x4]; - u8 unk2E; + u8 lifecycle_state; u8 pad_2F[0x9]; s32 unk38; u8 pad_3C[0x2]; @@ -167,7 +167,7 @@ void extermitank_update(unsigned char *moby) { handle_extermitank_hits_and_sync_children((char *)moby); process_extermitank_particle_hits((char *)moby); - if (extermitank_vars->unk2E == 2) { + if (extermitank_vars->lifecycle_state == 2) { if (extermitank_vars->unk184 != 0) mark_moby_for_removal_c3(extermitank_vars->unk184); if (extermitank_vars->unk188 != 0) @@ -238,7 +238,7 @@ void extermitank_update(unsigned char *moby) { extermitank_vars->unk94 = D_L05_00161AF8 * D_0015ED6C_gp; clear_u64_value(extermitank_vars->unk40); extermitank_vars->unk3E |= 2; - extermitank_vars->unk2E = 1; + extermitank_vars->lifecycle_state = 1; extermitank_vars->unk29 = 0; extermitank_vars->max_health = 6; extermitank_vars->unk28 = 3; From dd28d8c09b7853eb18343493def9f90acf056084 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:23:27 +0000 Subject: [PATCH 602/758] decomp: clarify names in bomb_spawner_update b67 -> hit_effect_blend_target: Assigned retail 0x002bf1f8-0x002bf208 writes 0x5A to pvars+0x67 after surviving damage; 0x002bf22c-0x002bf240 writes 0x78 after lethal damage. At 0x002bfac4-0x002bfac8, pvars+0x60 is passed as a1 to trooper_anim_finish. Checked level-03 consumer request e285023d3e494d09bbd6bf2aa6ee3369 (0x0024bf80..0x0024c1e8) retains that pointer in s0. 0x0024c010-0x0024c058 reads argument+7 and computes baseline(+4)+(target(+7)-baseline(+4))*progress; 0x0024c0dc-0x0024c120 computes the reverse target(+7)+(baseline(+4)-target(+7))*progress. Both paths forward the interpolated scalar in a1 at 0x0024c1b8-0x0024c1c0. Thus b67 is the hit-effect blend target, not an inferred timer or animation number. --- src/overlays/shared/enemies/bomb_spawner.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/bomb_spawner.c b/src/overlays/shared/enemies/bomb_spawner.c index 11bcce81ce..7b4550904e 100644 --- a/src/overlays/shared/enemies/bomb_spawner.c +++ b/src/overlays/shared/enemies/bomb_spawner.c @@ -30,7 +30,7 @@ typedef struct Data_2C0330 { char pad5B[5]; short f60[3]; char b66; - unsigned char b67; + unsigned char hit_effect_blend_target; char pad68[8]; char f70[0x12]; unsigned char spawn_trigger_mode; @@ -268,12 +268,12 @@ void bomb_spawner_update(struct Moby *moby) { float remaining_health = spawner_data->hp - r->hit_damage; spawner_data->hp = remaining_health; if (remaining_health > 0.0f) { - spawner_data->b67 = 0x5A; + spawner_data->hit_effect_blend_target = 0x5A; trooper_anim_update(moby, spawner_data->f60); } else { mark_moby_for_removal_cf(moby, 0, -1); moby->state = SPAWNER_DESTROY; - spawner_data->b67 = 0x78; + spawner_data->hit_effect_blend_target = 0x78; trooper_anim_update(moby, spawner_data->f60); } } From f503c72d01863caebd42916a1b7a0db663a92122 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:23:27 +0000 Subject: [PATCH 603/758] decomp: clarify names in blarg_heavy_interceptor_update domain_0_value_2 -> INTERCEPTOR_REMOVAL_STATUS_MARK_FOR_REMOVAL: Authoritative source SHA-256 1ffdd13444c646c8d101e00e4dd7a624fcdd82df1e4ff6f367afcc0e138e1ad9 compares (u8)moby_vars->removal_status with 2, clears flags and immediately invokes removal and returns. Original retail Ghidra loads pvars+0x2E and branches to LAB_002ad670 on 2. Retail 0x002ac65c..0x002ac670 loads s3 from Moby+0x78, compares lbu 0x2E(s3) against 2, clears 0x20C(s3), then reaches jal 0x00257068 at 0x002ad670. Supplied checked-helper annotation for 0x00257068..0x002570c0 and mark_moby_for_removal C establish state 0xFD/0xFE, frame+2 scheduling and grid update. Thus this value selects marking the interceptor for removal; its selector is the private removal_status byte, not moby->state or any supplied hero enum. --- src/overlays/l14/mobys/blarg_heavy_interceptor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 9b8cf713fe..80499512df 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -265,6 +265,9 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { enum { INTERCEPTOR_STATE_GROUP_EFFECTS_CONTROLLER = 8 }; + enum { + INTERCEPTOR_REMOVAL_STATUS_MARK_FOR_REMOVAL = 2 + }; BlargHeavyInterceptorVars *moby_vars = (BlargHeavyInterceptorVars *)moby->pvars; float vector_scratch[4]; float secondary_vector_scratch[4]; @@ -273,7 +276,7 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { int path_seg; float path_t; - if ((u8)moby_vars->removal_status == 2) { + if ((u8)moby_vars->removal_status == INTERCEPTOR_REMOVAL_STATUS_MARK_FOR_REMOVAL) { moby_vars->flags = 0; FUN_0020c828(moby); return; From 221f28972d792f5750931244dfe412355a84408b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:25:56 +0000 Subject: [PATCH 604/758] decomp: clarify names in blarg_paratrooper_update domain_2_value_2 -> PARATROOPER_TARGET_UNAVAILABLE: Assigned retail 0x00301624-0x00301628 compares private +0x164, target_selection_status, to 2 and prevents a target-driven waypoint transition. Checked helper 0x003024D8, evidence request a87d327d9cae4ffe8261b243fb8a28d5, writes 2 to the same field at 0x0030297C/0x003029B0 when horizontal range or vertical separation rejects the target, and at 0x003029E4-0x003029EC when the target is absent or in removed states. This is the target-availability domain, independent of the moby behavior and hero state domains. domain_3_value_2 -> PARATROOPER_TARGET_UNAVAILABLE: Assigned retail 0x003018AC-0x003018B0 compares private +0x164, target_selection_status, to 2 and prevents a target-driven waypoint transition. Checked helper 0x003024D8, evidence request a87d327d9cae4ffe8261b243fb8a28d5, writes 2 to the same field at 0x0030297C/0x003029B0 when horizontal range or vertical separation rejects the target, and at 0x003029E4-0x003029EC when the target is absent or in removed states. This is the target-availability domain, independent of the moby behavior and hero state domains. f1D4 -> jump_path_index: Retail 0x003013D8-0x003013EC tests private +0x1D4 against -1 and logs paratrooper_invalid_jump_path_format; 0x00301498-0x003014BC indexes l08_paths with it and copies its first waypoint to moby position. Later hop interpolation at 0x00301AE0-0x00301B14 uses this same path. f1DA -> hop_count: Retail 0x00301580 clears short +0x1DA. At 0x00301ED4-0x00301EFC it increments when firing transitions into HOP_BETWEEN_WAYPOINTS. 0x0030184C-0x00301860 and 0x00301BC4-0x00301BD8 compare it to hops302618 and reset it before the hop-limit pause. f1E8 -> projectile_pitch_divisor: Retail 0x00301CB8 and 0x0030232C-0x0030233C initialize float +0x1E8 to 1. It increases on firing opportunities at 0x00301D70-0x00301DA0. 0x00301E30-0x00301E40 divides -1 by it and multiplies by the horizontal projectile speed scale to form the projectile Z component. Exceeding 20 at 0x00301EA4-0x00301EFC ends the firing phase and initiates a hop. f1EC -> projectile_fire_timer: Retail 0x00301D34-0x00301D3C decrements private +0x1EC and exits while it has not elapsed. 0x00301D44-0x00301D90 resets it to a scaled delay before projectile creation at 0x00301E58; 0x00301D1C clears it on the close-range melee transition. f1F0 -> waypoint_transition_timer: Retail 0x00301C88-0x00301CB4 and 0x003020CC-0x003020F4 set private +0x1F0 from a scaled random 45..90 duration. Its expiry at 0x00301630-0x00301668 gates patrol-to-waypoint approach and at 0x003018B8-0x003018F4 gates departure from waiting into the next waypoint hop. f1F4 -> destination_waypoint_index: Retail 0x003014E8-0x00301528 stores a selected point plus signed traversal step in +0x1F4; 0x00301584-0x00301618 scales it by 16 and adds path+0x10 for the steering destination. 0x00301AEC-0x00301B14 uses it for the hop interpolation destination, and 0x003018D4-0x003018F0 alternates it between 0 and 1. f1FC -> patrol_path_index: Retail 0x00301230-0x00301250 uses private +0x1FC, unless -1, to index the l08_paths table into s1. That path drives state PATROL_PATH at 0x00301584-0x00301618, including waypoint distance tests, boundary reversal and steering. f20C -> patrol_waypoint_step: Retail 0x003014C8-0x003014EC initializes signed short +0x20C to either -1 or +1. At 0x003015B8-0x003015F8 it advances the patrol destination waypoint and is negated at path boundaries before correcting the index back into range. f20E -> projectile_pattern_index: Retail 0x00301CC8 and 0x00302344 reset short +0x20E on entering firing. 0x00301DBC-0x00301DC4 tests its parity to skip selected firing opportunities, 0x00301E44-0x00301E58 passes it to spawn_paratrooper_projectile, and 0x00301E84-0x00301EA0 increments and wraps it after index 4. f2E -> removal_status: Retail 0x00301388-0x00301390 initializes private byte +0x2E to 1. Outside initialization, 0x00301310-0x00301338 compares this byte to 2 and immediately marks the paratrooper and its bone attachment for removal. The proposed name describes this proven removal gate without claiming the producer or other status meanings. --- .../shared/enemies/blarg_paratrooper.c | 145 +++++++++--------- 1 file changed, 74 insertions(+), 71 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_paratrooper.c b/src/overlays/shared/enemies/blarg_paratrooper.c index 9feeb86708..537c73e0d4 100644 --- a/src/overlays/shared/enemies/blarg_paratrooper.c +++ b/src/overlays/shared/enemies/blarg_paratrooper.c @@ -43,7 +43,7 @@ typedef struct Paratrooper302618 { unsigned char f28; unsigned char f29; u8 pad2A[0x4]; - unsigned char f2E; + unsigned char removal_status; u8 pad2F[0x9]; s32 unk38; u8 pad3C[0x1c]; @@ -89,21 +89,21 @@ typedef struct Paratrooper302618 { int target_selection_status; u8 pad168[0x68]; int wake_path_index; - int f1D4; + int jump_path_index; s16 target_range_boost_timer; - short f1DA; + short hop_count; f32 unk1DC; u8 pad1E0[0x4]; f32 base_target_range; - float f1E8; - int f1EC; - int f1F0; - int f1F4; + float projectile_pitch_divisor; + int projectile_fire_timer; + int waypoint_transition_timer; + int destination_waypoint_index; char *bone_attachment_moby; - int f1FC; + int patrol_path_index; u8 pad200[0xc]; - short f20C; - short f20E; + short patrol_waypoint_step; + short projectile_pattern_index; } Paratrooper302618; extern float D_0015ED6C; @@ -186,6 +186,9 @@ void blarg_paratrooper_update(char *moby) { PARATROOPER_STATE_KNOCKBACK_RECOVERY = 10, PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE = 11 }; + enum { + PARATROOPER_TARGET_UNAVAILABLE = 2 + }; Paratrooper302618 *paratrooper_private_state = (Paratrooper302618 *)(*(char **)((char *)(moby) + 0x78)); char *path; @@ -208,8 +211,8 @@ void blarg_paratrooper_update(char *moby) { path = 0; update_blarg_paratrooper_damage_and_state(moby); target = paratrooper_private_state->target_moby; - if (paratrooper_private_state->f1FC != -1) - path = ((char *)l08_paths[paratrooper_private_state->f1FC]); + if (paratrooper_private_state->patrol_path_index != -1) + path = ((char *)l08_paths[paratrooper_private_state->patrol_path_index]); hero = (Hero302618 *)(((char *)&D_0013F350)); if (hero->mode == 61 && hero->timer < scale_game_frames(30) && (*(unsigned char *)((char *)(moby) + 0x20)) != 8 && @@ -221,7 +224,7 @@ void blarg_paratrooper_update(char *moby) { blend_moby_animation(moby, 14, 0, scale_game_frames(11)); (*(unsigned char *)((char *)(moby) + 0x20)) = 8; } - if ((*(unsigned char *)((char *)(moby) + 0x20)) != 0 && paratrooper_private_state->f2E == 2) { + if ((*(unsigned char *)((char *)(moby) + 0x20)) != 0 && paratrooper_private_state->removal_status == 2) { mark_moby_for_removal(moby); if (paratrooper_private_state->bone_attachment_moby) mark_moby_for_removal(paratrooper_private_state->bone_attachment_moby); @@ -232,7 +235,7 @@ void blarg_paratrooper_update(char *moby) { float turn_rate; paratrooper_private_state->f29 = 0; paratrooper_private_state->f28 = 1; - paratrooper_private_state->f2E = 1; + paratrooper_private_state->removal_status = 1; paratrooper_private_state->health = 2.0f; paratrooper_private_state->f24 = 2; paratrooper_private_state->f58 = truncate_float_to_s32(15.0f); @@ -241,7 +244,7 @@ void blarg_paratrooper_update(char *moby) { debug_print(paratrooper_invalid_wake_path_format, (*(short *)((char *)(moby) + 0xB2))); goto delete_moby; } - if (paratrooper_private_state->f1D4 == -1) { + if (paratrooper_private_state->jump_path_index == -1) { debug_print(paratrooper_invalid_jump_path_format, (*(short *)((char *)(moby) + 0xB2))); goto delete_moby; } @@ -256,66 +259,66 @@ void blarg_paratrooper_update(char *moby) { paratrooper_private_state->fFC = 0.2f; if (random302618() & 1) (*(unsigned short *)((char *)(moby) + 0x34)) |= 0x8000; - qcopy(&MOBY(moby)->pos, ((char *)l08_paths[paratrooper_private_state->f1D4]) + 0x10); + qcopy(&MOBY(moby)->pos, ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10); if (path) { int index; short direction; - paratrooper_private_state->f20C = 2 * (random302618() & 1) - 1; + paratrooper_private_state->patrol_waypoint_step = 2 * (random302618() & 1) - 1; index = select_point_index_by_distance(&MOBY(moby)->pos, path, 0.0f) + - paratrooper_private_state->f20C; - direction = paratrooper_private_state->f20C; - paratrooper_private_state->f1F4 = index; + paratrooper_private_state->patrol_waypoint_step; + direction = paratrooper_private_state->patrol_waypoint_step; + paratrooper_private_state->destination_waypoint_index = index; if (index >= (*(int *)((char *)(path) + 0)) || index < 0) { - paratrooper_private_state->f20C = -direction; - paratrooper_private_state->f1F4 = index + 2 * paratrooper_private_state->f20C; + paratrooper_private_state->patrol_waypoint_step = -direction; + paratrooper_private_state->destination_waypoint_index = index + 2 * paratrooper_private_state->patrol_waypoint_step; } if ((*(unsigned char *)((char *)(moby) + 0x53)) != 2) blend_moby_animation(moby, 2, 0, random302618() % 4 + 7); (*(unsigned char *)((char *)(moby) + 0x20)) = 1; } else (*(unsigned char *)((char *)(moby) + 0x20)) = 3; - paratrooper_private_state->f1DA = 0; + paratrooper_private_state->hop_count = 0; break; } case PARATROOPER_STATE_PATROL_PATH: if (vector_distance_xy(&MOBY(moby)->pos, - path + 0x10 + paratrooper_private_state->f1F4 * 16) < + path + 0x10 + paratrooper_private_state->destination_waypoint_index * 16) < paratrooper_private_state->fE0) { - short direction = paratrooper_private_state->f20C; - int index = paratrooper_private_state->f1F4 + direction; - paratrooper_private_state->f1F4 = index; + short direction = paratrooper_private_state->patrol_waypoint_step; + int index = paratrooper_private_state->destination_waypoint_index + direction; + paratrooper_private_state->destination_waypoint_index = index; if (index >= (*(int *)((char *)(path) + 0)) || index < 0) { paratrooper_private_state->fE0 = 0.0f; - paratrooper_private_state->f20C = -direction; - paratrooper_private_state->f1F4 = index + 2 * paratrooper_private_state->f20C; + paratrooper_private_state->patrol_waypoint_step = -direction; + paratrooper_private_state->destination_waypoint_index = index + 2 * paratrooper_private_state->patrol_waypoint_step; } } step_mover_2e3f20(moby, (char *)paratrooper_private_state + 0xD0, - path + 0x10 + paratrooper_private_state->f1F4 * 16, + path + 0x10 + paratrooper_private_state->destination_waypoint_index * 16, pos); - if (target && paratrooper_private_state->target_selection_status != 2 && + if (target && paratrooper_private_state->target_selection_status != PARATROOPER_TARGET_UNAVAILABLE && fast_dec_timer((char *)paratrooper_private_state + 0x1F0)) { - paratrooper_private_state->f1F4 = select_point_index_by_distance( - &MOBY(moby)->pos, ((char *)l08_paths[paratrooper_private_state->f1D4]), 0.0f); + paratrooper_private_state->destination_waypoint_index = select_point_index_by_distance( + &MOBY(moby)->pos, ((char *)l08_paths[paratrooper_private_state->jump_path_index]), 0.0f); (*(unsigned char *)((char *)(moby) + 0x20)) = 2; } break; case PARATROOPER_STATE_APPROACH_WAYPOINT: { float distance; - paratrooper_private_state->f1F4 = select_point_index_by_distance( - &MOBY(moby)->pos, ((char *)l08_paths[paratrooper_private_state->f1D4]), 0.0f); + paratrooper_private_state->destination_waypoint_index = select_point_index_by_distance( + &MOBY(moby)->pos, ((char *)l08_paths[paratrooper_private_state->jump_path_index]), 0.0f); distance = vector_distance_xy(&MOBY(moby)->pos, - ((char *)l08_paths[paratrooper_private_state->f1D4]) + 0x10 + - paratrooper_private_state->f1F4 * 16); + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10 + + paratrooper_private_state->destination_waypoint_index * 16); if (distance < 1.0f || distance < paratrooper_private_state->fE0) { paratrooper_private_state->fE0 = 0.0f; (*(unsigned char *)((char *)(moby) + 0x20)) = 3; } else { step_mover_2e3f20(moby, (char *)paratrooper_private_state + 0xD0, - ((char *)l08_paths[paratrooper_private_state->f1D4]) + 0x10 + - paratrooper_private_state->f1F4 * 16, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10 + + paratrooper_private_state->destination_waypoint_index * 16, pos); if ((*(unsigned char *)((char *)(moby) + 0x53)) != 2) blend_moby_animation(moby, 2, 0, random302618() % 4 + 7); @@ -343,8 +346,8 @@ void blarg_paratrooper_update(char *moby) { blend_moby_animation(moby, newanim, 0, ticks + random302618() % 7); } } - if (hops302618 < paratrooper_private_state->f1DA) { - paratrooper_private_state->f1DA = 0; + if (hops302618 < paratrooper_private_state->hop_count) { + paratrooper_private_state->hop_count = 0; if ((*(unsigned char *)((char *)(moby) + 0x53)) != 10) { int ticks = scale_game_frames(7); blend_moby_animation( @@ -352,14 +355,14 @@ void blarg_paratrooper_update(char *moby) { } (*(unsigned char *)((char *)(moby) + 0x20)) = 9; } else if (target) { - if (paratrooper_private_state->target_selection_status != 2 && + if (paratrooper_private_state->target_selection_status != PARATROOPER_TARGET_UNAVAILABLE && fast_dec_timer((char *)paratrooper_private_state + 0x1F0)) { qcopy((char *)paratrooper_private_state + 0x1C0, &MOBY(moby)->pos); - paratrooper_private_state->f1F4 = (paratrooper_private_state->f1F4 + 1) & 1; + paratrooper_private_state->destination_waypoint_index = (paratrooper_private_state->destination_waypoint_index + 1) & 1; (*(unsigned char *)((char *)(moby) + 0x20)) = 4; fast_vec_sub(pos, - ((char *)l08_paths[paratrooper_private_state->f1D4]) + 0x10 + - paratrooper_private_state->f1F4 * 16, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10 + + paratrooper_private_state->destination_waypoint_index * 16, &MOBY(moby)->pos); if (fast_vec_dot(moby + 0xD0, pos) < 0.0f) { if ((*(unsigned char *)((char *)(moby) + 0x53)) != 18) @@ -400,8 +403,8 @@ void blarg_paratrooper_update(char *moby) { progress = 0.0f; lerp_vector(pos, (char *)paratrooper_private_state + 0x1C0, - ((char *)l08_paths[paratrooper_private_state->f1D4]) + 0x10 + - paratrooper_private_state->f1F4 * 16, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10 + + paratrooper_private_state->destination_waypoint_index * 16, progress); arc = 2.0f * (progress - 0.5f); pos[2] += height302618 * (1.0f - arc * arc); @@ -412,8 +415,8 @@ void blarg_paratrooper_update(char *moby) { pos[2] += 1.0f; attack_vector_or_ray_endpoint[2] += 0.75f; collision_line(pos, attack_vector_or_ray_endpoint, 0, moby, 0); - if (hops302618 < paratrooper_private_state->f1DA) { - paratrooper_private_state->f1DA = 0; + if (hops302618 < paratrooper_private_state->hop_count) { + paratrooper_private_state->hop_count = 0; if ((*(unsigned char *)((char *)(moby) + 0x53)) != 10) { blend_moby_animation(moby, 10, 2, random302618() % 4 + 5); } @@ -424,12 +427,12 @@ void blarg_paratrooper_update(char *moby) { (*(unsigned char *)((char *)(moby) + 0x20)) = 3; if ((*(unsigned char *)((char *)(moby) + 0x53)) != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(5)); - paratrooper_private_state->f1F0 = + paratrooper_private_state->waypoint_transition_timer = truncate_float_to_s32(scale_time(random_float_between(45.0f, 90.0f))); } else { - paratrooper_private_state->f1E8 = 1.0f; + paratrooper_private_state->projectile_pitch_divisor = 1.0f; (*(unsigned char *)((char *)(moby) + 0x20)) = 5; - paratrooper_private_state->f20E = 0; + paratrooper_private_state->projectile_pattern_index = 0; if ((*(unsigned char *)((char *)(moby) + 0x53)) != 6) blend_moby_animation(moby, 6, 0, scale_game_frames(10)); } @@ -439,16 +442,16 @@ void blarg_paratrooper_update(char *moby) { case PARATROOPER_STATE_FIRE_PROJECTILES: if (vector_distance_xy(&MOBY(moby)->pos, target + 0x10) < melee302618) { (*(unsigned char *)((char *)(moby) + 0x20)) = 7; - paratrooper_private_state->f1EC = 0; + paratrooper_private_state->projectile_fire_timer = 0; if ((*(unsigned char *)((char *)(moby) + 0x53)) == 13) break; goto animate_melee; } else if (fast_dec_timer((char *)paratrooper_private_state + 0x1EC)) { - paratrooper_private_state->f1EC = scale_game_frames( + paratrooper_private_state->projectile_fire_timer = scale_game_frames( delay302618 + truncate_float_to_s32(D_L08_0015F5D4 * 1.3f + D_L08_0015F5D0)); - paratrooper_private_state->f1E8 += accel302618; + paratrooper_private_state->projectile_pitch_divisor += accel302618; if ((D_L08_0015F5D4 < 0.8f && D_L08_0015F5D0 < 0.8f) || - !((*(unsigned short *)¶trooper_private_state->f20E) & 1)) { + !((*(unsigned short *)¶trooper_private_state->projectile_pattern_index) & 1)) { char *shot; moby_point_position(paratrooper_private_state->bone_attachment_moby, 0, pos); attack_vector_or_ray_endpoint[0] = @@ -457,28 +460,28 @@ void blarg_paratrooper_update(char *moby) { fast_sin((*(float *)((char *)(moby) + 0x48))) * (speed302618 * D_0015ED6C); attack_vector_or_ray_endpoint[2] = 0.0f; attack_vector_or_ray_endpoint[2] = - (-1.0f / paratrooper_private_state->f1E8) * (speed302618 * D_0015ED6C); + (-1.0f / paratrooper_private_state->projectile_pitch_divisor) * (speed302618 * D_0015ED6C); shot = spawn_paratrooper_projectile(attack_vector_or_ray_endpoint, pos, moby, target, scale_game_frames(180), - paratrooper_private_state->f20E); + paratrooper_private_state->projectile_pattern_index); if (shot) (*(float *)((char *)(shot) + 0x2C)) *= 1.7f; } - paratrooper_private_state->f20E = - (*(unsigned short *)¶trooper_private_state->f20E) + 1; - if (paratrooper_private_state->f20E >= 5) - paratrooper_private_state->f20E = 0; - if (paratrooper_private_state->f1E8 > 20.0f) { + paratrooper_private_state->projectile_pattern_index = + (*(unsigned short *)¶trooper_private_state->projectile_pattern_index) + 1; + if (paratrooper_private_state->projectile_pattern_index >= 5) + paratrooper_private_state->projectile_pattern_index = 0; + if (paratrooper_private_state->projectile_pitch_divisor > 20.0f) { qcopy((char *)paratrooper_private_state + 0x1C0, &MOBY(moby)->pos); - (*(unsigned short *)¶trooper_private_state->f1DA)++; - paratrooper_private_state->f1F4 = (paratrooper_private_state->f1F4 + 1) & 1; + (*(unsigned short *)¶trooper_private_state->hop_count)++; + paratrooper_private_state->destination_waypoint_index = (paratrooper_private_state->destination_waypoint_index + 1) & 1; (*(unsigned char *)((char *)(moby) + 0x20)) = 4; fast_vec_sub(pos, - ((char *)l08_paths[paratrooper_private_state->f1D4]) + 0x10 + - paratrooper_private_state->f1F4 * 16, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10 + + paratrooper_private_state->destination_waypoint_index * 16, &MOBY(moby)->pos); if (fast_vec_dot(moby + 0xD0, pos) < 0.0f) { if ((*(unsigned char *)((char *)(moby) + 0x53)) != 18) @@ -504,11 +507,11 @@ void blarg_paratrooper_update(char *moby) { frame = compute_interpolated_record_value(moby); if (frame > 12.0f && frame < 23.0f && (*(float *)((char *)(moby) + 0x54)) == 0.0f) { fast_vec_sub( - pos, ((char *)l08_paths[paratrooper_private_state->f1D4]) + 0x10, &MOBY(moby)->pos); + pos, ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10, &MOBY(moby)->pos); FUN_L00_0025f730(pos, D_0015ED6C * 24.0f); FUN_L00_00258830_c(moby, pos, shove302618, shove_rate302618, 0.0f, 0); } else if ((*(unsigned char *)((char *)(moby) + 0x70)) & 2) { - paratrooper_private_state->f1F0 = + paratrooper_private_state->waypoint_transition_timer = truncate_float_to_s32(scale_time(random_float_between(45.0f, 90.0f))); (*(unsigned char *)((char *)(moby) + 0x20)) = 3; if ((*(unsigned char *)((char *)(moby) + 0x53)) != 0) @@ -563,9 +566,9 @@ void blarg_paratrooper_update(char *moby) { blend_moby_animation(moby, 13, 0, random302618() % 4 + 8); } } else { - paratrooper_private_state->f1E8 = 1.0f; + paratrooper_private_state->projectile_pitch_divisor = 1.0f; (*(unsigned char *)((char *)(moby) + 0x20)) = 5; - paratrooper_private_state->f20E = 0; + paratrooper_private_state->projectile_pattern_index = 0; if ((*(unsigned char *)((char *)(moby) + 0x53)) != 6) { int ticks = scale_game_frames(10); blend_moby_animation( From 7a6ac11ff402b8667a8b6320637e422ae78f3cfe Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:26:00 +0000 Subject: [PATCH 605/758] decomp: clarify names in birdbot_update b53 -> target_animation_sequence: Retail root 0x002e6fb4-0x002e6fdc compares moby+0x53 against sequence 11 before calling blend_moby_animation with new_seq=11; analogous gates select 0,4,5,8,10. Checked helper request 646157cd6d0342b0b971d178a9e39c4a at 0x0026c680 saves a1 (new_seq) in s3, uses it to index class sequence records at 0x0026c688-0x0026c6b0, and stores s3 to moby+0x53 at 0x0026c744. Supplied blend source calls this prevSeq and assigns new_seq to it, while retail 0x0026c718-0x0026c728 may replace current sequence at +0x52 with 0xFF. Thus b53 retains the target animation sequence used by birdbot's blend guards. f58 -> animation_playback_speed: Root retail 0x002e7d60-0x002e7ef4 writes 0.5 to moby+0x58 during burst recovery, restores 1.0 at 0x002e7e18-0x002e7e24, and writes the established birdbot_path_entry_animation_speed_gp at 0x002e761c-0x002e7624 and 0x002e8680-0x002e8690; path entry resets it to 1.0 at 0x002e80a4-0x002e80b8. Checked blend helper request 646157cd6d0342b0b971d178a9e39c4a loads 1.0 at 0x0026c738-0x0026c73c and stores it at moby+0x58 at 0x0026c748, matching supplied blend_moby_animation source moby->anim_speed = 1.0f. Root original Ghidra confirms the same assignments, proving animation playback speed. --- src/overlays/l01/mobys/birdbot.c | 56 ++++++++++++++++---------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/overlays/l01/mobys/birdbot.c b/src/overlays/l01/mobys/birdbot.c index 05f4703277..a5fd9cc89c 100644 --- a/src/overlays/l01/mobys/birdbot.c +++ b/src/overlays/l01/mobys/birdbot.c @@ -390,9 +390,9 @@ typedef struct PeMoby { Vec4 rot; char pad50[2]; unsigned char b52; - unsigned char b53; + unsigned char target_animation_sequence; char pad54[4]; - float f58; + float animation_playback_speed; char pad5C[0x14]; unsigned char b70; char pad71[7]; @@ -620,7 +620,7 @@ void birdbot_update(PeMoby *birdbot_moby) { *(u128 *)&va = *(u128 *)&hit->pos; trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->knockback_horizontal_launch_step, &birdbot_vars->knockback_vertical_launch_step); FUN_L00_0025c558_u(knockback_heading, birdbot_moby, birdbot_vars->x70, 0xC, 6, 0); - if (birdbot_moby->b53 != 0xB) { + if (birdbot_moby->target_animation_sequence != 0xB) { blend_moby_animation(birdbot_moby, 0xB, 0, scale_game_frames(6)); } birdbot_moby->state = BIRDBOT_STATE_NONFATAL_KNOCKBACK; @@ -704,7 +704,7 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->hit_response_profile_index = 1; clear_u64_value(&birdbot_vars->v40); birdbot_vars->w1C8 = -1; - if (birdbot_moby->b53 != 0) { + if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); } birdbot_vars->h1E0 = birdbot_moby->h32; @@ -742,7 +742,7 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->h1A4 = 0; birdbot_vars->projectile_aim_distance = 4.0f; birdbot_moby->state = BIRDBOT_STATE_FIRE_BURST; - if (birdbot_moby->b53 != 4) { + if (birdbot_moby->target_animation_sequence != 4) { blend_moby_animation(birdbot_moby, 4, 0, scale_game_frames(6)); } birdbot_vars->w190 = 0; @@ -759,13 +759,13 @@ void birdbot_update(PeMoby *birdbot_moby) { int i; float f; - if (birdbot_moby->b53 != 8) { + if (birdbot_moby->target_animation_sequence != 8) { blend_moby_animation(birdbot_moby, 8, 0, scale_game_frames(10)); } i = idx; f = *(float *)&birdbot_path_entry_animation_speed_gp; c->idx = i; - birdbot_moby->f58 = f; + birdbot_moby->animation_playback_speed = f; birdbot_moby->state = BIRDBOT_STATE_BEGIN_PATH_MOVEMENT; } } @@ -793,7 +793,7 @@ void birdbot_update(PeMoby *birdbot_moby) { } birdbot_moby->w94 = *(int *)(birdbot_moby->w24 + 0x10); birdbot_moby->h34 &= 0xFFBE; - if (birdbot_moby->b53 != 8) { + if (birdbot_moby->target_animation_sequence != 8) { blend_moby_animation(birdbot_moby, 8, 0, scale_game_frames(10)); } birdbot_moby->state = BIRDBOT_STATE_DEPLOY; @@ -818,7 +818,7 @@ void birdbot_update(PeMoby *birdbot_moby) { path = side_path_cursor->path; qcopy(&vb, &path->points[side_path_next_node_index]); if (side_path_cursor->idx == path->count - 1) { - if (birdbot_moby->b53 != 0) { + if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); } birdbot_moby->state = BIRDBOT_STATE_TRACK_TARGET_AND_SELECT_ACTION; @@ -859,7 +859,7 @@ void birdbot_update(PeMoby *birdbot_moby) { fast_vec_add(&birdbot_moby->pos, &birdbot_moby->pos, &birdbot_vars->deployment_motion_delta); if (fast_vec_dist(&birdbot_moby->pos, &l01_cuboids[birdbot_vars->w1E4].pos) < frame_time * 10.0f) { - if (birdbot_moby->b53 != 0) { + if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); } birdbot_moby->state = BIRDBOT_STATE_TRACK_TARGET_AND_SELECT_ACTION; @@ -872,7 +872,7 @@ void birdbot_update(PeMoby *birdbot_moby) { } fast_vec_add(&birdbot_moby->pos, &birdbot_moby->pos, &va); if (fast_vec_length(&va) < frame_time) { - if (birdbot_moby->b53 != 0) { + if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); } birdbot_moby->state = BIRDBOT_STATE_TRACK_TARGET_AND_SELECT_ACTION; @@ -915,7 +915,7 @@ void birdbot_update(PeMoby *birdbot_moby) { truncate_float_to_s32(FUN_L04_001f1978(10.0f))); birdbot_vars->h1A4++; } else { - if (birdbot_moby->b53 != 0) { + if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); } birdbot_moby->state = BIRDBOT_STATE_TRACK_TARGET_AND_SELECT_ACTION; @@ -927,10 +927,10 @@ void birdbot_update(PeMoby *birdbot_moby) { vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) > (flag ? birdbot_vars->combat_target_radius * 2.0f : birdbot_vars->combat_target_radius) || absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) > 6.0f) { - if (birdbot_moby->b53 != 5) { + if (birdbot_moby->target_animation_sequence != 5) { blend_moby_animation(birdbot_moby, 5, 5, scale_game_frames(10)); } - birdbot_moby->f58 = 0.5f; + birdbot_moby->animation_playback_speed = 0.5f; birdbot_moby->state = BIRDBOT_STATE_RECOVER_FROM_BURST; } } @@ -941,14 +941,14 @@ void birdbot_update(PeMoby *birdbot_moby) { a = fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1]); FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); - if (birdbot_moby->b53 == 0) { + if (birdbot_moby->target_animation_sequence == 0) { if (fast_dec_timer(&birdbot_vars->w190) != 0) { - if (birdbot_moby->b53 != 5) { + if (birdbot_moby->target_animation_sequence != 5) { blend_moby_animation(birdbot_moby, 5, 0, scale_game_frames(0xF)); } } } else if (birdbot_moby->b70 & 2) { - birdbot_moby->f58 = 1.0f; + birdbot_moby->animation_playback_speed = 1.0f; if ((flag || (vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) < 8.0f && absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) < 6.0f)) && @@ -956,10 +956,10 @@ void birdbot_update(PeMoby *birdbot_moby) { fast_vec_dist(&birdbot_moby->pos, (Vec4 *)birdbot_vars->main.path + (idx + 1)) > 0.25f) { birdbot_vars->main.idx = idx; - if (birdbot_moby->b53 != 8) { + if (birdbot_moby->target_animation_sequence != 8) { blend_moby_animation(birdbot_moby, 8, 0, scale_game_frames(10)); } - birdbot_moby->f58 = *(float *)&birdbot_path_entry_animation_speed_gp; + birdbot_moby->animation_playback_speed = *(float *)&birdbot_path_entry_animation_speed_gp; birdbot_moby->state = BIRDBOT_STATE_BEGIN_PATH_MOVEMENT; } else { float d; @@ -982,7 +982,7 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->h1A4 = 0; birdbot_vars->projectile_aim_distance = 4.0f; birdbot_moby->state = BIRDBOT_STATE_FIRE_BURST; - if (birdbot_moby->b53 != 4) { + if (birdbot_moby->target_animation_sequence != 4) { blend_moby_animation(birdbot_moby, 4, 0, scale_game_frames(6)); } birdbot_vars->w190 = 0; @@ -990,7 +990,7 @@ void birdbot_update(PeMoby *birdbot_moby) { } birdbot_vars->w190 = scale_game_frames(0x3C); } - if (birdbot_moby->b53 != 0) { + if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); } birdbot_moby->state = BIRDBOT_STATE_TRACK_TARGET_AND_SELECT_ACTION; @@ -999,7 +999,7 @@ void birdbot_update(PeMoby *birdbot_moby) { break; } case BIRDBOT_STATE_BEGIN_PATH_MOVEMENT: - birdbot_moby->f58 = 1.0f; + birdbot_moby->animation_playback_speed = 1.0f; birdbot_vars->path_movement_step_length = 0.0f; birdbot_vars->pitch_turn_step = 0.0f; birdbot_moby->state = BIRDBOT_STATE_MOVE_TO_PATH_NODE; @@ -1104,18 +1104,18 @@ void birdbot_update(PeMoby *birdbot_moby) { frame_time_sq * 3.1415927f, frame_time * 6.2831855f); } - if (birdbot_moby->b53 != 0xA && birdbot_vars->path_movement_step_length <= 0.0f && + if (birdbot_moby->target_animation_sequence != 0xA && birdbot_vars->path_movement_step_length <= 0.0f && fast_difference_between_rotations( birdbot_moby->rot.f[2], fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1])) < 0.034906585f) { birdbot_vars->path_movement_step_length = 0.0f; - if (birdbot_moby->b53 != 0xA) { + if (birdbot_moby->target_animation_sequence != 0xA) { blend_moby_animation(birdbot_moby, 0xA, 0, scale_game_frames(3)); } } else if (birdbot_moby->b52 == 0xA && (birdbot_moby->b70 & 2)) { - if (birdbot_moby->b53 != 0) { + if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(6)); } birdbot_moby->state = BIRDBOT_STATE_TRACK_TARGET_AND_SELECT_ACTION; @@ -1130,17 +1130,17 @@ void birdbot_update(PeMoby *birdbot_moby) { int i; float f; - if (birdbot_moby->b53 != 8) { + if (birdbot_moby->target_animation_sequence != 8) { blend_moby_animation(birdbot_moby, 8, 0, scale_game_frames(10)); } i = idx; f = *(float *)&birdbot_path_entry_animation_speed_gp; birdbot_vars->main.idx = i; - birdbot_moby->f58 = f; + birdbot_moby->animation_playback_speed = f; birdbot_moby->state = BIRDBOT_STATE_BEGIN_PATH_MOVEMENT; return; } - if (birdbot_moby->b53 != 0) { + if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(6)); } birdbot_moby->state = BIRDBOT_STATE_TRACK_TARGET_AND_SELECT_ACTION; From b963ceb44577f6ac185cf219d10605a8bbc187d6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:28:01 +0000 Subject: [PATCH 606/758] decomp: clarify names in big_axebot_update f1A0 -> leg_rig_state: Retail 002bb324..002bb338 and 002bb520..002bb534 pass data+0x1a0 to reset_leg_rig_from_animation; 002bb3a0..002bb3c4 and 002bb5ac..002bb5dc pass the same storage to leg_walker_update in chase and return-home states. f38 -> extended_detection_request: Retail 002ba568..002ba580 tests data+0x38 to enable the doubled data+0x43c target-selection range. At 002bac40..002bac58 a nonzero request reloads data+0x406 with scaled 240 frames and is then cleared. f400 -> start_waiting_for_target: Retail 002bad30..002bad64 tests this byte only during initialization: nonzero selects established WAIT_FOR_TARGET state 3 and animation 10; zero selects IDLE state 1. Name describes the initialization choice, without asserting its authored cause. f401 -> last_non_hit_recovery_state: Retail 002bbe34..002bbe40 copies moby+0x20 into data+0x401 only when the current state differs from established HIT_RECOVERY state 8. Thus this byte records the latest state outside hit recovery. f402 -> idle_action_delay_timer: Retail 002bac7c..002bac80 decrements this signed-short timer. Idle and wait-for-target gate melee/alert decisions on zero at 002baf38..002baf40 and 002baffc..002bb004. Recovery sets 40 frames at 002bab20..002bab28, and melee completion sets 90 at 002bb894..002bb8a0. f404 -> hit_response_cooldown_timer: Retail 002ba718..002ba71c decrements this timer; 002ba884..002ba8dc suppresses the additional nonfatal response switch while it is nonzero, retaining pose recoil. Successful hit-response branches reload it to scaled 70 frames at 002bab6c..002bab74. f406 -> extended_detection_timer: Retail 002ba574..002ba5f4 enables doubled detection range while this byte is nonzero. Hits reload scaled 240 frames at 002bab78..002bab84; the request field also refreshes it at 002bac4c..002bac54, then 002bac5c..002bac60 decrements it. f407 -> alert_voice_cooldown_timer: Retail initialization clears this byte at 002bacf0. In idle animation 13, 002baf10..002baf34 decrements/tests the timer, calls allocate_voice_for_target_entry with voice 10 when due, and reloads scaled 180 frames. f408 -> recoil_pitch_angle: Retail nonfatal-hit paths set data+0x408 to -0.5235988 at 002ba8a4..002ba8b4, 002ba920..002ba930 and 002baa54..002baa64. It decays by 0.96 at 002bbddc..002bbe00, then becomes an axis-1 quaternion multiplied into the bone-0 manipulator at 002bbe04..002bbe30. f410 -> yaw_turn_velocity: Retail 002bb248..002bb280 passes data+0x410 by address as spring_turn's vel argument while turning owner yaw toward a waypoint. Chase, home and turn branches reuse the same velocity storage; boundary turns clear it at 002bb47c and 002bb684. f414 -> movement_yaw: Retail 002bb384..002bb3c4 and 002bb59c..002bb5dc store spring_turn's yaw result here and pass it to leg_walker_update. Hit recovery later supplies the same field as build_spherical_offset's azimuth at 002bba08..002bba18. f418 -> hit_recovery_displacement: Retail HIT_RECOVERY branch 002bb9bc..002bb9fc increases/bounds this scalar, then 002bba08..002bba28 uses it as spherical-offset scale and adds the vector to owner position. 002bba34..002bba84 decays it and returns to idle once nonpositive. f41C -> movement_boundary_path_index: Retail 002bb44c..002bb470 indexes l04_paths with data+0x41c and tests a point ahead of the owner against its polygon. 002bb4a4..002bb4d4 tests target position against the same path and selects RETURN_HOME outside it; -1 disables these boundary checks. f420 -> fall_displacement: Retail 002bbe60..002bbe90 adds frame_time_sq*29.8 to data+0x420 and subtracts its value from owner Z through the two probe-offset adjustments. Ground clamping clears it at 002bbeb0..002bbeb4; initialization also clears it at 002bace8. f424 -> attached_axe_moby: Retail 002bbff0..002bc008 stores spawn_big_axebot_axe's return here. 002bbf88..002bbfa4 places that moby at bone 13's translation, then updates its animation/basis/bounds. Death/removal paths also remove this linked axe. f428 -> tracked_aim_yaw: Retail 002bad24..002bad34 initializes this field from owner yaw. 002bbf10..002bbf2c adds owner yaw change; 002bbf4c..002bbf78 computes target_yaw minus that tracked yaw, rotates the bone-12 manipulator, and stores target_yaw for the next update. f42C -> recoil_displacement: Retail 002baa24..002baa34 and 002bab5c..002bab68 initialize this scalar after hits. 002bbcd4..002bbd4c scales a hero-away XY vector with it, and 002bbda4..002bbdd8 moves toward that destination under collision constraints; grounded updates decay it. f430 -> path_trigger_volume_index: Retail 002baea0..002baee0 requires this field not be -1 and uses it as is_point_inside_clip_volume's volume_index for hero position, as confirmed by the authoritative C and supplied helper context. Passing the test starts FOLLOW_PATH at 002baeec. f434 -> approach_path_index: Retail 002bb0c4..002bb0e4 indexes l04_paths using data+0x434 in FOLLOW_PATH. That selected path supplies successive waypoint positions and its point count at 002bb144..002bb230; the idle entry guard requires this index not be -1. f438 -> path_waypoint_index: Retail 002bb144..002bb158 uses this short times 16 to address the selected path's waypoint. 002bb178..002bb190 increments it upon arrival and compares it with path->count; 002bb208..002bb230 then computes the bearing to its indexed waypoint. f43A -> path_follow_started: Retail 002baebc..002baf00 allows the idle-to-FOLLOW_PATH transition only when this short is zero, then sets it to one when starting the path. No reset or other use appears in the assigned function; name describes the one-time start latch. f43C -> detection_range: Retail 002ba5e8..002ba600 passes this float, optionally doubled, to select_moby_combat_target. Idle/wait/alert and path-completion logic compare target_distance against the same range to select alert or target-facing idle animations. f448 -> recoil_pose_cooldown_timer: Retail 002ba898..002ba8c4 and 002ba914..002ba93c set the recoil pitch impulse only when this timer is nonpositive, then reload scaled 30 frames. 002bbde8..002bbe00 decrements it each update before constructing the recoil quaternion. m120 -> recoil_manipulator: Retail 002bacfc..002bad10 attaches data+0x120 to bone 0 if inactive. At 002bbe04..002bbe30 the quaternion at its +0x10 is reset and multiplied by the decaying hit-induced axis-1 rotation, proving its recoil-pose role. m160 -> aim_manipulator: Retail 002bad18..002bad20 attaches data+0x160 to bone 12. At 002bbf4c..002bbf78 target-yaw error becomes an axis-2 quaternion multiplied into this manipulator's quaternion at data+0x170, proving its yaw-aim role. --- src/overlays/l04/mobys/big_axebot.c | 308 ++++++++++++++-------------- 1 file changed, 154 insertions(+), 154 deletions(-) diff --git a/src/overlays/l04/mobys/big_axebot.c b/src/overlays/l04/mobys/big_axebot.c index 4add152128..0a27b3d290 100644 --- a/src/overlays/l04/mobys/big_axebot.c +++ b/src/overlays/l04/mobys/big_axebot.c @@ -131,7 +131,7 @@ typedef struct D_B7B0 { char pad2F; float f30; char pad34[4]; - int f38; + int extended_detection_request; char pad3C[0x1C]; unsigned char f58; char pad59; @@ -154,33 +154,33 @@ typedef struct D_B7B0 { float f110; float f114; char pad118[8]; - Manip_B7B0 m120; - Manip_B7B0 m160; - char f1A0[0x250]; + Manip_B7B0 recoil_manipulator; + Manip_B7B0 aim_manipulator; + char leg_rig_state[0x250]; V4_B7B0 home; - unsigned char f400; - unsigned char f401; - short f402; - short f404; - unsigned char f406; - unsigned char f407; - float f408; + unsigned char start_waiting_for_target; + unsigned char last_non_hit_recovery_state; + short idle_action_delay_timer; + short hit_response_cooldown_timer; + unsigned char extended_detection_timer; + unsigned char alert_voice_cooldown_timer; + float recoil_pitch_angle; char pad40C[4]; - float f410; - float f414; - float f418; - int f41C; - float f420; - struct M_B7B0 *f424; - float f428; - float f42C; - int f430; - int f434; - short f438; - short f43A; - float f43C; + float yaw_turn_velocity; + float movement_yaw; + float hit_recovery_displacement; + int movement_boundary_path_index; + float fall_displacement; + struct M_B7B0 *attached_axe_moby; + float tracked_aim_yaw; + float recoil_displacement; + int path_trigger_volume_index; + int approach_path_index; + short path_waypoint_index; + short path_follow_started; + float detection_range; char pad440[8]; - int f448; + int recoil_pose_cooldown_timer; } D_B7B0; typedef struct M_B7B0 { @@ -325,17 +325,17 @@ void big_axebot_update(M_B7B0 *moby) { float target_yaw; float hd; - if (data->f38 != 0 || data->f406 != 0) { + if (data->extended_detection_request != 0 || data->extended_detection_timer != 0) { flag = 1; } - FUN_L00_00263ac8(2.5f, (int)moby, 0, (unsigned char *)&data->m120); + FUN_L00_00263ac8(2.5f, (int)moby, 0, (unsigned char *)&data->recoil_manipulator); if (moby->f31 != 0) { if (fast_vec_dist(moby->pos, D_L04_00166F40) < 27.0f) { FUN_L00_0025a120(moby); moby->f7F = 0x15; } } - select_moby_combat_target((char *)moby, (float *)&tg, flag ? data->f43C * 2.0f : data->f43C); + select_moby_combat_target((char *)moby, (float *)&tg, flag ? data->detection_range * 2.0f : data->detection_range); target_moby = tg.f40; rot = moby->rot[2]; target_distance = vector_distance_xy(moby->pos, (float *)&tg); @@ -343,13 +343,13 @@ void big_axebot_update(M_B7B0 *moby) { hd = compute_interpolated_record_value(moby); if (D_L04_0015F5C4 == 2) { moby->f34 |= 0x41; - if (data->f424 != 0) { - data->f424->f34 |= 0x41; + if (data->attached_axe_moby != 0) { + data->attached_axe_moby->f34 |= 0x41; } } else if (moby->f34 & 1) { moby->f34 &= ~0x41; - if (data->f424 != 0) { - data->f424->f34 &= ~0x41; + if (data->attached_axe_moby != 0) { + data->attached_axe_moby->f34 &= ~0x41; } } qcopy(initial_position_snapshot, moby->pos); @@ -361,7 +361,7 @@ void big_axebot_update(M_B7B0 *moby) { moby->f7F = 0x1A; } } - fast_dec_timer_s16(&data->f404); + fast_dec_timer_s16(&data->hit_response_cooldown_timer); if (moby->state != BIG_AXEBOT_STATE_DYING && moby->state != BIG_AXEBOT_STATE_INITIALIZE) { int unused_hit_reaction_output; float dmg; @@ -397,11 +397,11 @@ void big_axebot_update(M_B7B0 *moby) { if (data->hp <= 0.0f) { hit_reaction_result = 1; } - if (data->f404 != 0 && hit_reaction_result != 1) { - if (data->f448 <= 0) { - data->f408 = -0.5235988f; + if (data->hit_response_cooldown_timer != 0 && hit_reaction_result != 1) { + if (data->recoil_pose_cooldown_timer <= 0) { + data->recoil_pitch_angle = -0.5235988f; } - data->f448 = scale_game_frames(0x1E); + data->recoil_pose_cooldown_timer = scale_game_frames(0x1E); data->fB7 = 0x78; trooper_anim_update(moby, (short *)data->fB0); } else { @@ -412,10 +412,10 @@ void big_axebot_update(M_B7B0 *moby) { case BIG_AXEBOT_HIT_REACTION_CONDITIONAL_RECOIL_RECOVERY: case BIG_AXEBOT_HIT_REACTION_CONDITIONAL_RECOVERY: allocate_voice_for_target_entry(0xB, 0, (char *)moby); - if (data->f448 <= 0) { - data->f408 = -0.5235988f; + if (data->recoil_pose_cooldown_timer <= 0) { + data->recoil_pitch_angle = -0.5235988f; } - data->f448 = scale_game_frames(0x1E); + data->recoil_pose_cooldown_timer = scale_game_frames(0x1E); if ((hit->att->cls == 0 || hit->damage_amount > 1.0f) && (moby->f52 != 4 || hd < 17.0f || hd > 20.0f)) { moby->fBC |= 5; @@ -424,18 +424,18 @@ void big_axebot_update(M_B7B0 *moby) { set_big_axebot_and_axe_animation_speed(moby, 2.0f); moby->state = BIG_AXEBOT_STATE_HIT_RECOVERY; } - data->f42C = 3.4f / scale_time(7.0f) * 0.5f; + data->recoil_displacement = 3.4f / scale_time(7.0f) * 0.5f; data->fB7 = 0x78; trooper_anim_update(moby, (short *)data->fB0); - data->f404 = scale_game_frames(0x46); - data->f406 = scale_game_frames(0xF0); + data->hit_response_cooldown_timer = scale_game_frames(0x46); + data->extended_detection_timer = scale_game_frames(0xF0); break; case BIG_AXEBOT_HIT_REACTION_KNOCKBACK: allocate_voice_for_target_entry(0xB, 0, (char *)moby); - if (data->f448 <= 0) { - data->f408 = -0.5235988f; + if (data->recoil_pose_cooldown_timer <= 0) { + data->recoil_pitch_angle = -0.5235988f; } - data->f448 = scale_game_frames(0x1E); + data->recoil_pose_cooldown_timer = scale_game_frames(0x1E); moby->fBC |= 5; blend_big_axebot_and_axe_animation( (char *)moby, (void *)5, 0, (void *)scale_game_frames(6)); @@ -444,24 +444,24 @@ void big_axebot_update(M_B7B0 *moby) { trooper_start_knockback(knockback_yaw, moby, data->fC0, 5, 1, 0); data->f110 = 5.0f; data->f114 = 10.0f; - data->f42C = 3.4f / scale_time(7.0f); + data->recoil_displacement = 3.4f / scale_time(7.0f); data->fB7 = 0x78; trooper_anim_update(moby, (short *)data->fB0); - data->f404 = scale_game_frames(0x46); - data->f406 = scale_game_frames(0xF0); + data->hit_response_cooldown_timer = scale_game_frames(0x46); + data->extended_detection_timer = scale_game_frames(0xF0); break; case BIG_AXEBOT_HIT_REACTION_RETURN_TO_IDLE: case BIG_AXEBOT_HIT_REACTION_IDLE_RECOVERY: allocate_voice_for_target_entry(0xB, 0, (char *)moby); blend_big_axebot_and_axe_animation( (char *)moby, (void *)6, (void *)2, (void *)scale_game_frames(4)); - data->f402 = scale_game_frames(0x28); + data->idle_action_delay_timer = scale_game_frames(0x28); moby->state = BIG_AXEBOT_STATE_IDLE; - data->f42C = 3.4f / scale_time(7.0f); + data->recoil_displacement = 3.4f / scale_time(7.0f); data->fB7 = 0x78; trooper_anim_update(moby, (short *)data->fB0); - data->f404 = scale_game_frames(0x46); - data->f406 = scale_game_frames(0xF0); + data->hit_response_cooldown_timer = scale_game_frames(0x46); + data->extended_detection_timer = scale_game_frames(0xF0); break; case BIG_AXEBOT_HIT_REACTION_FATAL: data->fE8 = 1.0f; @@ -488,19 +488,19 @@ void big_axebot_update(M_B7B0 *moby) { } } moby->fA4 = 0xFF; - if (data->f38 != 0) { - data->f406 = scale_game_frames(0xF0); + if (data->extended_detection_request != 0) { + data->extended_detection_timer = scale_game_frames(0xF0); } - data->f38 = 0; - FUN_L00_001fefc8(&data->f406); + data->extended_detection_request = 0; + FUN_L00_001fefc8(&data->extended_detection_timer); if (moby->state != BIG_AXEBOT_STATE_INITIALIZE && data->f2E != 1) { - if (data->f424 != 0) { - mark_moby_for_removal(data->f424); + if (data->attached_axe_moby != 0) { + mark_moby_for_removal(data->attached_axe_moby); } mark_moby_for_removal(moby); return; } - fast_dec_timer_s16(&data->f402); + fast_dec_timer_s16(&data->idle_action_delay_timer); switch (moby->state) { case BIG_AXEBOT_STATE_INITIALIZE: data->hp = 3.0f; @@ -510,18 +510,18 @@ void big_axebot_update(M_B7B0 *moby) { data->f29 = 0; data->f30 = 1.5f; moby->fBC = 0; - data->f420 = 0.0f; - data->f424 = 0; - data->f407 = 0; + data->fall_displacement = 0.0f; + data->attached_axe_moby = 0; + data->alert_voice_cooldown_timer = 0; qcopy(data->home, moby->pos); - if (data->m120.on == 0) { - attach_manipulator((char *)moby, 0, &data->m120); + if (data->recoil_manipulator.on == 0) { + attach_manipulator((char *)moby, 0, &data->recoil_manipulator); } - attach_manipulator((char *)moby, 0xC, &data->m160); - data->f428 = moby->rot[2]; + attach_manipulator((char *)moby, 0xC, &data->aim_manipulator); + data->tracked_aim_yaw = moby->rot[2]; data->f58 = 0xA; data->f5A = 0xC; - if (data->f400 != 0) { + if (data->start_waiting_for_target != 0) { moby->state = BIG_AXEBOT_STATE_WAIT_FOR_TARGET; blend_big_axebot_and_axe_animation( (char *)moby, (void *)0xA, 0, (void *)scale_game_frames(0xC)); @@ -530,11 +530,11 @@ void big_axebot_update(M_B7B0 *moby) { } break; case BIG_AXEBOT_STATE_IDLE: { - if (moby->f53 == 6 && data->f402 == scale_game_frames(0x25)) { + if (moby->f53 == 6 && data->idle_action_delay_timer == scale_game_frames(0x25)) { allocate_voice_for_target_entry(2, 0, (char *)moby); } if ((moby->f70 & 2) && - (flag ? data->f43C * 2.0f < target_distance : data->f43C < target_distance)) { + (flag ? data->detection_range * 2.0f < target_distance : data->detection_range < target_distance)) { int arr[6]; random_integer_below_cf(arr, 0, 0x18); @@ -544,28 +544,28 @@ void big_axebot_update(M_B7B0 *moby) { 0, (void *)scale_game_frames(0x18)); } else if (moby->f53 != 0xD && (moby->f53 != 6 || (moby->f70 & 2))) { - if (flag ? target_distance < data->f43C * 2.0f : target_distance < data->f43C) { + if (flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)0xD, 0, (void *)scale_game_frames(0x18)); } } - if (data->f430 != -1 && data->f434 != -1 && data->f43A == 0 && - (flag || is_point_inside_clip_volume(&hero.motion.pos, data->f430) != 0)) { + if (data->path_trigger_volume_index != -1 && data->approach_path_index != -1 && data->path_follow_started == 0 && + (flag || is_point_inside_clip_volume(&hero.motion.pos, data->path_trigger_volume_index) != 0)) { moby->state = BIG_AXEBOT_STATE_FOLLOW_PATH; moby->fBC |= 1; - data->f43A = 1; + data->path_follow_started = 1; } else { - if (moby->f52 == 0xD && FUN_L00_001fefc8(&data->f407) != 0) { + if (moby->f52 == 0xD && FUN_L00_001fefc8(&data->alert_voice_cooldown_timer) != 0) { allocate_voice_for_target_entry(0xA, 0, (char *)moby); - data->f407 = scale_game_frames(0xB4); + data->alert_voice_cooldown_timer = scale_game_frames(0xB4); } - if (data->f402 == 0) { + if (data->idle_action_delay_timer == 0) { if (target_distance < 4.5f) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_MELEE_ATTACK; - } else if (flag ? target_distance < data->f43C * 2.0f - : target_distance < data->f43C) { + } else if (flag ? target_distance < data->detection_range * 2.0f + : target_distance < data->detection_range) { int nf = (moby->fBC & 1) == 0; if (nf) { blend_big_axebot_and_axe_animation( @@ -582,7 +582,7 @@ void big_axebot_update(M_B7B0 *moby) { if (moby->f52 == 2 && (moby->f70 & 2)) { blend_big_axebot_and_axe_animation( (char *)moby, - (void *)((flag ? target_distance < data->f43C * 2.0f : target_distance < data->f43C) + (void *)((flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) ? 0xD : 0), 0, @@ -595,12 +595,12 @@ void big_axebot_update(M_B7B0 *moby) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)0xB, 0, (void *)scale_game_frames(0xC)); } - if (data->f402 == 0) { + if (data->idle_action_delay_timer == 0) { if (target_distance < 4.5f) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_MELEE_ATTACK; - } else if (flag ? target_distance < data->f43C * 2.0f : target_distance < data->f43C) { + } else if (flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) { int nf = (moby->fBC & 1) == 0; if (nf) { blend_big_axebot_and_axe_animation( @@ -612,7 +612,7 @@ void big_axebot_update(M_B7B0 *moby) { } break; case BIG_AXEBOT_STATE_FOLLOW_PATH: { - P_B7B0 *path = ((P_B7B0 *)l04_paths[data->f434]); + P_B7B0 *path = ((P_B7B0 *)l04_paths[data->approach_path_index]); float a; if (moby->f53 != 3) { @@ -624,10 +624,10 @@ void big_axebot_update(M_B7B0 *moby) { (char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_MELEE_ATTACK; } - if (vector_distance_xy(path->pts[data->f438], moby->pos) < 1.0f) { - data->f438++; - if (data->f438 == path->count) { - if (flag ? data->f43C * 2.0f < target_distance : data->f43C < target_distance) { + if (vector_distance_xy(path->pts[data->path_waypoint_index], moby->pos) < 1.0f) { + data->path_waypoint_index++; + if (data->path_waypoint_index == path->count) { + if (flag ? data->detection_range * 2.0f < target_distance : data->detection_range < target_distance) { blend_big_axebot_and_axe_animation( (char *)moby, 0, 0, (void *)scale_game_frames(0x18)); } else { @@ -638,11 +638,11 @@ void big_axebot_update(M_B7B0 *moby) { break; } } - a = fast_arc_tan(path->pts[data->f438][0] - moby->pos[0], - path->pts[data->f438][1] - moby->pos[1]); + a = fast_arc_tan(path->pts[data->path_waypoint_index][0] - moby->pos[0], + path->pts[data->path_waypoint_index][1] - moby->pos[1]); moby->rot[2] = spring_turn(moby->rot[2], a, - &data->f410, + &data->yaw_turn_velocity, frame_time_sq * 12.566371f, frame_time_sq * 6.2831855f, frame_time * 3.1415927f); @@ -657,35 +657,35 @@ void big_axebot_update(M_B7B0 *moby) { case BIG_AXEBOT_STATE_CHASE_TARGET: if (moby->fBC & 8) { moby->fBC &= ~8; - reset_leg_rig_from_animation(moby, data->f1A0); + reset_leg_rig_from_animation(moby, data->leg_rig_state); } - data->f414 = spring_turn(moby->rot[2], + data->movement_yaw = spring_turn(moby->rot[2], target_yaw, - &data->f410, + &data->yaw_turn_velocity, frame_time_sq * 6.2831855f, frame_time_sq * 125.663704f, frame_time * 12.566371f); - leg_walker_update(moby, data->f1A0, frame_time * 4.0f, data->f414, frame_time_sq * 20.0f); + leg_walker_update(moby, data->leg_rig_state, frame_time * 4.0f, data->movement_yaw, frame_time_sq * 20.0f); if (target_distance < 4.5f) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_MELEE_ATTACK; - } else if (data->f41C != -1) { + } else if (data->movement_boundary_path_index != -1) { vector_quaternion_scratch[0] = fast_cos(moby->rot[2]) * 2.0f; vector_quaternion_scratch[1] = fast_sin(moby->rot[2]) * 2.0f; vector_quaternion_scratch[2] = 0.0f; fast_vec_add(vector_quaternion_scratch, vector_quaternion_scratch, moby->pos); if (point_in_path_xy(vector_quaternion_scratch, - ((P_B7B0 *)l04_paths[data->f41C])->pts, - ((P_B7B0 *)l04_paths[data->f41C])->count) == 0) { - data->f410 = 0.0f; + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { + data->yaw_turn_velocity = 0.0f; blend_big_axebot_and_axe_animation( (char *)moby, (void *)8, 0, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_TURN; } if (point_in_path_xy(tpos, - ((P_B7B0 *)l04_paths[data->f41C])->pts, - ((P_B7B0 *)l04_paths[data->f41C])->count) == 0) { + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { moby->state = BIG_AXEBOT_STATE_RETURN_HOME; } } @@ -700,37 +700,37 @@ void big_axebot_update(M_B7B0 *moby) { if (moby->fBC & 8) { moby->fBC &= ~8; - reset_leg_rig_from_animation(moby, data->f1A0); + reset_leg_rig_from_animation(moby, data->leg_rig_state); } a = fast_arc_tan(data->home[0] - moby->pos[0], data->home[1] - moby->pos[1]); - data->f414 = spring_turn(moby->rot[2], + data->movement_yaw = spring_turn(moby->rot[2], a, - &data->f410, + &data->yaw_turn_velocity, frame_time_sq * 6.2831855f, frame_time_sq * 125.663704f, frame_time * 12.566371f); leg_walker_update( - moby, data->f1A0, frame_time * 4.0f, data->f414, frame_time_sq * 20.0f); + moby, data->leg_rig_state, frame_time * 4.0f, data->movement_yaw, frame_time_sq * 20.0f); if (vector_distance_xy(moby->pos, data->home) < 2.0f) { moby->state = BIG_AXEBOT_STATE_IDLE; } - if (data->f41C != -1) { + if (data->movement_boundary_path_index != -1) { vector_quaternion_scratch[0] = fast_cos(moby->rot[2]) * 2.0f; vector_quaternion_scratch[1] = fast_sin(moby->rot[2]) * 2.0f; vector_quaternion_scratch[2] = 0.0f; fast_vec_add(vector_quaternion_scratch, vector_quaternion_scratch, moby->pos); if (point_in_path_xy(vector_quaternion_scratch, - ((P_B7B0 *)l04_paths[data->f41C])->pts, - ((P_B7B0 *)l04_paths[data->f41C])->count) == 0) { - data->f410 = 0.0f; + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { + data->yaw_turn_velocity = 0.0f; blend_big_axebot_and_axe_animation( (char *)moby, (void *)8, 0, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_TURN; moby->fBC |= 0x10; } if (point_in_path_xy(tpos, - ((P_B7B0 *)l04_paths[data->f41C])->pts, - ((P_B7B0 *)l04_paths[data->f41C])->count) != 0) { + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { moby->state = BIG_AXEBOT_STATE_IDLE; } } @@ -763,10 +763,10 @@ void big_axebot_update(M_B7B0 *moby) { } } if (moby->f52 == 4 && (moby->f70 & 2)) { - data->f402 = scale_game_frames(0x5A); + data->idle_action_delay_timer = scale_game_frames(0x5A); blend_big_axebot_and_axe_animation( (char *)moby, - (void *)((flag ? target_distance < data->f43C * 2.0f : target_distance < data->f43C) + (void *)((flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) ? 0xD : 0), 0, @@ -785,34 +785,34 @@ void big_axebot_update(M_B7B0 *moby) { } else if (moby->f53 == 8 && (hd < 28.0f || moby->f52 != moby->f53)) { float hit_recovery_displacement_limit = frame_scale * 0.11111111f; - if (data->f418 < hit_recovery_displacement_limit) { - data->f418 += frame_time_sq * 20.0f; + if (data->hit_recovery_displacement < hit_recovery_displacement_limit) { + data->hit_recovery_displacement += frame_time_sq * 20.0f; } else { - data->f418 = hit_recovery_displacement_limit; + data->hit_recovery_displacement = hit_recovery_displacement_limit; } build_spherical_offset( - vector_quaternion_scratch, data->f418, data->f414, moby->rot[1]); + vector_quaternion_scratch, data->hit_recovery_displacement, data->movement_yaw, moby->rot[1]); fast_vec_add(moby->pos, moby->pos, vector_quaternion_scratch); moby->rot[2] = spring_turn(moby->rot[2], target_yaw, - &data->f410, + &data->yaw_turn_velocity, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 4.1887903f); - } else if (data->f418 > 0.0f) { - data->f418 -= frame_time_sq * 200.0f; + } else if (data->hit_recovery_displacement > 0.0f) { + data->hit_recovery_displacement -= frame_time_sq * 200.0f; build_spherical_offset( - vector_quaternion_scratch, data->f418, data->f414, moby->rot[1]); + vector_quaternion_scratch, data->hit_recovery_displacement, data->movement_yaw, moby->rot[1]); fast_vec_add(moby->pos, moby->pos, vector_quaternion_scratch); moby->rot[2] = spring_turn(moby->rot[2], target_yaw, - &data->f410, + &data->yaw_turn_velocity, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 4.1887903f); } else { moby->state = BIG_AXEBOT_STATE_IDLE; - data->f402 = 0; + data->idle_action_delay_timer = 0; } } break; @@ -827,14 +827,14 @@ void big_axebot_update(M_B7B0 *moby) { moby->rot[2] = spring_turn(moby->rot[2], a, - &data->f410, + &data->yaw_turn_velocity, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 4.1887903f); } else { moby->rot[2] = spring_turn(moby->rot[2], target_yaw, - &data->f410, + &data->yaw_turn_velocity, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 4.1887903f); @@ -843,8 +843,8 @@ void big_axebot_update(M_B7B0 *moby) { case BIG_AXEBOT_STATE_DYING: if ((step_moby_motion(moby, data->fC0) & 0x40) || moby->pos[2] < 1.0f) { mark_moby_for_removal_cf((char *)moby); - if (data->f424 != 0) { - mark_moby_for_removal(data->f424); + if (data->attached_axe_moby != 0) { + mark_moby_for_removal(data->attached_axe_moby); } FUN_L00_00257470(moby, 0, -1); FUN_L00_00263fd8((char *)moby, @@ -883,46 +883,46 @@ void big_axebot_update(M_B7B0 *moby) { break; } trooper_anim_finish(moby, data->fB0); - if (data->f42C > 0.0f) { + if (data->recoil_displacement > 0.0f) { struct Hero *h = &hero; vector_quaternion_scratch[0] = fast_cos(fast_arc_tan(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1])) * - data->f42C; + data->recoil_displacement; vector_quaternion_scratch[1] = fast_sin(fast_arc_tan(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1])) * - data->f42C; + data->recoil_displacement; vector_quaternion_scratch[2] = 0.0f; fast_vec_add(vector_quaternion_scratch, vector_quaternion_scratch, moby->pos); - if (data->f420 == 0.0f) { - data->f42C += -3.4f / (scale_time(7.0f) * scale_time(7.0f)); + if (data->fall_displacement == 0.0f) { + data->recoil_displacement += -3.4f / (scale_time(7.0f) * scale_time(7.0f)); } move_moby_xy_with_collision_constraints( moby, moby->pos, vector_quaternion_scratch, 1, 0.25f, 1.5f, 0.75f, 0.87266463f); } - data->f408 *= 0.96f; - fast_dec_timer(&data->f448); - build_axis_rotation_quaternion(vector_quaternion_scratch, 1, data->f408); - build_axis_rotation_quaternion(data->m120.q, 2, 0.0f); - multiply_quaternions(data->m120.q, data->m120.q, vector_quaternion_scratch); + data->recoil_pitch_angle *= 0.96f; + fast_dec_timer(&data->recoil_pose_cooldown_timer); + build_axis_rotation_quaternion(vector_quaternion_scratch, 1, data->recoil_pitch_angle); + build_axis_rotation_quaternion(data->recoil_manipulator.q, 2, 0.0f); + multiply_quaternions(data->recoil_manipulator.q, data->recoil_manipulator.q, vector_quaternion_scratch); if (moby->state != BIG_AXEBOT_STATE_HIT_RECOVERY) { - data->f401 = moby->state; + data->last_non_hit_recovery_state = moby->state; } - data->f420 += frame_time_sq * 29.8f; - moby->pos[2] -= data->f420 - 2.0f; + data->fall_displacement += frame_time_sq * 29.8f; + moby->pos[2] -= data->fall_displacement - 2.0f; { float ground_height = probe_ground_height(moby->pos, 0, 0.5f); moby->pos[2] -= 2.0f; if (moby->pos[2] < ground_height) { moby->pos[2] = ground_height; - data->f420 = 0.0f; + data->fall_displacement = 0.0f; } } if (moby->pos[2] < data->home[2] - 8.0f) { mark_moby_for_removal_cf((char *)moby); - if (data->f424 != 0) { - mark_moby_for_removal(data->f424); + if (data->attached_axe_moby != 0) { + mark_moby_for_removal(data->attached_axe_moby); } mark_moby_for_removal(moby); return; @@ -932,34 +932,34 @@ void big_axebot_update(M_B7B0 *moby) { float bone_transform[4][4]; float bone_euler_angles[4]; { - data->f428 = fast_add_rotations(data->f428, fast_subtract_rotations(moby->rot[2], rot)); + data->tracked_aim_yaw = fast_add_rotations(data->tracked_aim_yaw, fast_subtract_rotations(moby->rot[2], rot)); build_moby_bone_transform((char *)moby, 0xC, (char *)bone_transform); matrix_to_euler(bone_transform, bone_euler_angles); - build_axis_rotation_quaternion(q, 2, fast_subtract_rotations(target_yaw, data->f428)); - data->f428 = target_yaw; - multiply_quaternions(data->m160.q, data->m160.q, q); + build_axis_rotation_quaternion(q, 2, fast_subtract_rotations(target_yaw, data->tracked_aim_yaw)); + data->tracked_aim_yaw = target_yaw; + multiply_quaternions(data->aim_manipulator.q, data->aim_manipulator.q, q); } } - if (data->f424 != 0) { + if (data->attached_axe_moby != 0) { float axe_bone_transform[4][4]; { M_B7B0 *axe; build_moby_bone_transform((char *)moby, 0xD, (char *)axe_bone_transform); - axe = data->f424; + axe = data->attached_axe_moby; qcopy(axe->pos, axe_bone_transform[3]); advance_moby_animation(axe); - update_entity(data->f424); - copy_matrix3x4(data->f424->fC0, axe_bone_transform); - normalize_vector_triplet(data->f424->fC0); - refresh_moby_spatial_bounds_from_basis(data->f424); - data->f424->f34 |= 6; + update_entity(data->attached_axe_moby); + copy_matrix3x4(data->attached_axe_moby->fC0, axe_bone_transform); + normalize_vector_triplet(data->attached_axe_moby->fC0); + refresh_moby_spatial_bounds_from_basis(data->attached_axe_moby); + data->attached_axe_moby->f34 |= 6; } } else { float p[4]; moby_point_position(moby, 0xB, p); - data->f424 = spawn_big_axebot_axe(moby, p); + data->attached_axe_moby = spawn_big_axebot_axe(moby, p); } } From 64e960676d9a1ab105a52e4705f640f5659e4785 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:29:53 +0000 Subject: [PATCH 607/758] decomp: clarify names in walker_update_gait f4C -> alternate_run_transition_position: In walker_update_gait, retail 0x002a19a4-0x002a19dc loads active WalkAnim+0x4C, subtracts current_animation_position, adds the cycle length and takes the remainder, alongside the +0x48 marker. The comparison at 0x002a19e0 selects the nearer marker. On the second path, 0x002a19f8-0x002a1a04 loads run anim[7]+0x4C and subtracts animation_position_origin; 0x002a1a0c-0x002a1a34 wraps that position by cycle length, and 0x002a1a5c-0x002a1aac finds its animation entry, blends anim[7], and enters established RUN/13. Authoritative C reproduces this with r2 and the else assignment to x. Thus this member is the alternate run-transition animation-position marker, without claiming foot side or timing units. --- src/overlays/shared/enemies/walker_update_gait.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/enemies/walker_update_gait.c b/src/overlays/shared/enemies/walker_update_gait.c index 5537a825c6..af69c8640a 100644 --- a/src/overlays/shared/enemies/walker_update_gait.c +++ b/src/overlays/shared/enemies/walker_update_gait.c @@ -127,7 +127,7 @@ typedef struct WalkAnim { float f40; float f44; float f48; - float f4C; + float alternate_run_transition_position; } WalkAnim; typedef struct WalkData { @@ -267,7 +267,7 @@ void walker_update_gait(WalkMoby *walker_moby, current_animation_position + gait_data->anim[gait_animation_index]->f10) % truncate_float_to_s32(gait_data->anim[gait_animation_index]->f10); - int r2 = truncate_float_to_s32(gait_data->anim[gait_animation_index]->f4C - + int r2 = truncate_float_to_s32(gait_data->anim[gait_animation_index]->alternate_run_transition_position - current_animation_position + gait_data->anim[gait_animation_index]->f10) % truncate_float_to_s32(gait_data->anim[gait_animation_index]->f10); @@ -276,7 +276,7 @@ void walker_update_gait(WalkMoby *walker_moby, if (r1 < r2) { x = truncate_float_to_s32(gait_data->anim[7]->f48 - gait_data->anim[7]->animation_position_origin); } else { - x = truncate_float_to_s32(gait_data->anim[7]->f4C - gait_data->anim[7]->animation_position_origin); + x = truncate_float_to_s32(gait_data->anim[7]->alternate_run_transition_position - gait_data->anim[7]->animation_position_origin); } x = (x + truncate_float_to_s32(gait_data->anim[7]->f10)) % truncate_float_to_s32(gait_data->anim[7]->f10); From 31ad55cf5d3f884d94638bb3c5371cc6ead50be0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:29:57 +0000 Subject: [PATCH 608/758] decomp: clarify names in load_level_gameplay f140 -> packed_colors: TieMatrix.f140 receives the 0x80 bytes at gameplay tie record +0x50: retail 0x0024207c advances the file cursor by 0x50 and 0x00242178-0x00242188 copies to matrix +0x140. The authoritative source documents these as 64 two-byte colors with five bits per channel; original Ghidra copies piVar34 to puVar36+0x50. Bounded light_ties retail 0x002979b4-0x002979cc locates this tie matrix, 0x00297a6c-0x00297a78 forms matrix+0x140, and 0x00297a7c-0x00297a98 reads halfwords and applies pext5, proving packed input colors. f17 -> class_lower_bound_base: ShrubInst.f17 stores the truncated first float from the selected ShrubClass.f1C pointer. Retail 0x002423ac-0x002423c4 loads that class pointer, truncates its float and stores the byte at shrub +0x17. Retail 0x002423c8-0x002423ec converts the unsigned byte back to float, adds 24.0, and raises shrub +0x10 to that lower bound when necessary. Original Ghidra uVar10/fVar43 and authoritative C shrub_class_lower_bound agree. The name describes its proven arithmetic role without asserting units or a rendering-distance interpretation. --- 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 2f1957652d..a49892a9d2 100644 --- a/src/overlays/shared/world/load_level_gameplay.c +++ b/src/overlays/shared/world/load_level_gameplay.c @@ -213,7 +213,7 @@ typedef struct TieMatrix { float m3[3]; float f3C; char pad40[0x100]; - char f140[0x80]; + char packed_colors[0x80]; } TieMatrix; typedef struct TieInst { @@ -254,7 +254,7 @@ typedef struct ShrubInst { float fC; float f10; char pad14[3]; - unsigned char f17; + unsigned char class_lower_bound_base; short f18; unsigned char f1A; unsigned char f1B; @@ -721,7 +721,7 @@ char *load_level_gameplay(int skip_gameplay_read) { D_L00_00160FC8[i].fC = 1.0f / fast_vec_length(&D_L00_00160FC8[i]); D_L00_00160FC8[i].f1C = 1.0f / fast_vec_length(D_L00_00160FC8[i].m1); D_L00_00160FC8[i].f2C = 1.0f / fast_vec_length(D_L00_00160FC8[i].m2); - copy_memory_aligned(mtx->f140, p, 0x80); + copy_memory_aligned(mtx->packed_colors, p, 0x80); p += 0x80; inst->f1C = *(unsigned short *)p; p += 0x10; @@ -788,8 +788,8 @@ char *load_level_gameplay(int skip_gameplay_read) { if (D_L00_001BC030[shrub_class_index]->f1C != 0) { float shrub_class_lower_bound; - inst->f17 = truncate_float_to_s32(*D_L00_001BC030[shrub_class_index]->f1C); - shrub_class_lower_bound = convert_integer_to_float(inst->f17) + 24.0f; + inst->class_lower_bound_base = truncate_float_to_s32(*D_L00_001BC030[shrub_class_index]->f1C); + shrub_class_lower_bound = convert_integer_to_float(inst->class_lower_bound_base) + 24.0f; if (inst->f10 < shrub_class_lower_bound) { inst->f10 = shrub_class_lower_bound; } From 74a26edad412de33e07d281486db9ea08d7d83be Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:30:01 +0000 Subject: [PATCH 609/758] decomp: clarify names in toxic_crab_update b21 -> group_index: Retail 0x002e21ec-0x002e21fc and 0x002e2230-0x002e2240 test moby+0x21 against 0xFF before activate_waiting_moby_group_members. Supplied same-file group approach code tests toxic_crab->group against 0xFF and indexes moby_group_member_lists with it, proving the group-index role. f120 -> tracked_position_x: Retail 0x002e23ac-0x002e23c4 subtracts moby position x at +0x10 from data+0x120 as the first fast_arc_tan argument. The resulting bearing drives spring turning in FACE_TRACKED_POSITION; supplied targeting code also treats data+0x120 as a position vector. f124 -> tracked_position_y: Retail 0x002e23b4-0x002e23c4 subtracts moby position y at +0x14 from data+0x124 as the second fast_arc_tan argument paired with data+0x120. This proves the tracked position's y coordinate used for facing. f190 -> heading_turn_step: Retail 0x002e2138-0x002e215c and 0x002e2704-0x002e2718 pass data+0x190 by address to the spring-turn helper. Supplied FUN_L00_00258278 reads/updates its turn_step and adds it to moby rot.z; 0x002e2a9c-0x002e2ac0 compares its magnitude with a frame-scaled angular threshold. f1A4 -> movement_speed: Retail 0x002e2038-0x002e2054 multiplies data+0x1A4 by frame_time to initialize movement step +0xF4. Pursuit 0x002e2520-0x002e2598 approaches speed*frame_time or 0.3 times it, and back-away 0x002e3204-0x002e3238 uses three times that speed. f2C -> scaled_class_size: Retail 0x002e1d7c-0x002e1da8 loads the class-derived scalar through moby+0x24 then +0x24, multiplies it by established l10_toxic_crab_size_scale, and stores moby+0x2C. The name describes this proven scaled class-size quantity without asserting collision geometry. f48 -> heading_radians: Retail 0x002e2638-0x002e2660 compares target atan bearing with moby+0x48. At 0x002e32ac-0x002e3314 it saves this heading, temporarily writes target bearing plus pi for backward movement, derives cosine/sine direction, and restores the heading. f78 -> vertical_motion_step: Retail 0x002e3970-0x002e39b8 subtracts acceleration data+0x80 from data+0x78, clamps against frame_time*-7, and adds the result to moby z at +0x18. Fall-to-death 0x002e35e0-0x002e3614 divides and updates this same vertical movement component. i164 -> tracked_target_selection_status: Retail 0x002e2408-0x002e241c holds FACE_TRACKED_POSITION while data+0x164 equals 2, and 0x002e2b80-0x002e2b9c returns home for that status. Supplied same-file targeting helper labels this same +0x164 field target_selection_status and assigns POINT_AHEAD_NO_TARGET=2 when target position fails range/height tests. i1A8 -> behavior_timer_frames: Retail 0x002e21dc-0x002e21e4 stores scale_game_frames(1) at data+0x1A8; 0x002e2440-0x002e2448 decrements it before pursuit. Obstruction pause stores scale_game_frames(60) at 0x002e28a8-0x002e28b4, and pause/back-away checks decrement the same countdown. i1B4 -> activation_override_enabled: Retail 0x002e2200-0x002e2228 enters ACTIVATE when target status is 2 if data+0x1B4 is nonzero, bypassing the ordinary no-target wait. In ACTIVATE, 0x002e2298-0x002e22ec selects animation 1 when nonzero versus animation 2 when zero. The name describes the proven activation override test without claiming its external trigger. i1B8 -> pursuit_delay_upper_bound_frames: Retail 0x002e2418-0x002e243c converts integer data+0x1B8 to float as the upper bound of random_float_between(0,bound), truncates the sampled delay, and stores behavior countdown +0x1A8. Countdown expiry at 0x002e2440-0x002e2454 enters pursuit. i1BC -> activation_dependency_moby_index: Retail 0x002e2044-0x002e20ec treats data+0x1BC as an index with -1 sentinel, shifts it by eight to resolve a moby, and clears invalid dependencies. WAIT_FOR_ACTIVATION 0x002e2160-0x002e21e4 repeats the lookup and enters ACTIVATE when that moby is removed or its saved killed bit is set. i1D8 -> pursuit_movement_blocked: Retail 0x002e2908-0x002e2940 sets data+0x1D8 when post-movement XY travel is below one quarter of requested step +0xF4, otherwise clears it; 0x002e2a3c also clears it when collision flags are absent. 0x002e2614-0x002e2634 uses the flag to decelerate pursuit toward zero. i1DC -> remove_in_clank_mode: Retail 0x002e1f70-0x002e1f84 tests data+0x1DC nonzero and hero vehicle mode at 0x001413F4 equal to 1, then branches to mark_moby_for_removal at 0x002e390c. The supplied source establishes HERO_VEHICLE_MODE_CLANK for that same selector and value. i90 -> knockback_probe_radius_fixed: Retail 0x002e3674-0x002e3684 truncates 768.0 and 0x002e36c0 stores it at data+0x90 in the knockback record passed at data+0x70. Supplied checked-helper findings record 0x0024f7e0-0x0024f7e8 converting motion+0x20 to float and scaling by 1/1024, then using it for collision queries at 0x0024f820-0x0024f838 and 0x0024f730-0x0024f754. s34 -> moby_flags: Retail 0x002e1fe4-0x002e1fec reads/modifies moby+0x34 with mask 0x5000; 0x002e367c-0x002e3688 clears bit 0x1000 on entering death effects. Supplied same-file hit reaction code performs the identical lethal transition operation as moby->flags &= 0xEFFF, proving this is the moby flags field. v170 -> home_position_and_heading: Retail 0x002e1fdc-0x002e2004 copies initial moby position into data+0x170 and replaces element 3 with moby heading +0x48. WAIT_FOR_ACTIVATION uses that saved heading at 0x002e213c; RETURN_HOME subtracts saved x/y at 0x002e337c-0x002e3394 and tests distance to the saved position. v1C0 -> pursuit_progress_sample_position: Retail 0x002e2320-0x002e2330 and 0x002e2450-0x002e2464 save moby position at data+0x1C0 on entering pursuit. 0x002e2974-0x002e2988 measures XY travel from this sample during periodic progress checking, and 0x002e2a2c-0x002e2a30 refreshes the sample after the check. v70 -> knockback_motion_xy: Retail 0x002e3510-0x002e3514 passes data+0x70 as the motion record to step_moby_motion in HIT_KNOCKBACK; 0x002e36cc initializes the same record via trooper_set_knockback. The supplied C declares these first two components float[2], immediately followed by vertical step f78; 0x002e3610 adds the motion vector at +0x70 to moby position. --- src/overlays/l10/mobys/toxic_crab.c | 246 ++++++++++++++-------------- 1 file changed, 123 insertions(+), 123 deletions(-) diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index 7316f471ba..90da4dc730 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -100,12 +100,12 @@ typedef struct Crab2E30F8 { char q60[7]; unsigned char b67; char p68[8]; - float v70[2]; - float f78; + float knockback_motion_xy[2]; + float vertical_motion_step; char p7C[4]; float f80; char p84[0xC]; - int i90; + int knockback_probe_radius_fixed; int i94; float f98; char p9C[0x11]; @@ -121,29 +121,29 @@ typedef struct Crab2E30F8 { char pE0[0x14]; float fF4; char pF8[0x28]; - float f120; - float f124; + float tracked_position_x; + float tracked_position_y; char p128[0x38]; char *tgt; - int i164; + int tracked_target_selection_status; char p168[8]; - float v170[4]; + float home_position_and_heading[4]; char p180[0x10]; - float f190; + float heading_turn_step; float f194; float f198; char p19C[4]; float f1A0; - float f1A4; - int i1A8; + float movement_speed; + int behavior_timer_frames; char p1AC[8]; - int i1B4; - int i1B8; - int i1BC; - float v1C0[4]; + int activation_override_enabled; + int pursuit_delay_upper_bound_frames; + int activation_dependency_moby_index; + float pursuit_progress_sample_position[4]; char p1D0[8]; - int i1D8; - int i1DC; + int pursuit_movement_blocked; + int remove_in_clank_mode; char p1E0[0xD0]; unsigned char q2B0[4]; } Crab2E30F8; @@ -152,17 +152,17 @@ typedef struct Moby2E30F8 { char p00[0x10]; float pos[4]; unsigned char state; - unsigned char b21; + unsigned char group_index; char p22[2]; char *p24; char p28[4]; - float f2C; + float scaled_class_size; char p30; unsigned char b31; char p32[2]; - unsigned short s34; + unsigned short moby_flags; char p36[0x12]; - float f48; + float heading_radians; char p4C[7]; unsigned char anim; char p54[4]; @@ -249,7 +249,7 @@ void toxic_crab_update(Moby2E30F8 *m) { update_toxic_crab_hit_reactions_and_targeting(m); target_moby = crab_data->tgt; - m->f2C = *(float *)(m->p24 + 0x24) * l10_toxic_crab_size_scale; + m->scaled_class_size = *(float *)(m->p24 + 0x24) * l10_toxic_crab_size_scale; FUN_L00_00263ac8(2.5f, (int)m, 2, crab_data->q2B0); *(OvlQuad *)from = *(OvlQuad *)m->pos; from[2] += 1.0f; @@ -268,7 +268,7 @@ void toxic_crab_update(Moby2E30F8 *m) { } switch (m->state) { case TOXIC_CRAB_STATE_INITIALIZE: - if (crab_data->i1DC != 0 && ((unsigned char *)&D_0013E533)[0x2EC1] == 1) { + if (crab_data->remove_in_clank_mode != 0 && ((unsigned char *)&D_0013E533)[0x2EC1] == 1) { mark_moby_for_removal(m); return; } @@ -279,9 +279,9 @@ void toxic_crab_update(Moby2E30F8 *m) { crab_data->b28 = 3; crab_data->b58 = truncate_float_to_s32(10.0f); crab_data->b5A = truncate_float_to_s32(16.0f); - m->s34 |= 0x5000; - qcopy(crab_data->v170, m->pos); - crab_data->v170[3] = m->f48; + m->moby_flags |= 0x5000; + qcopy(crab_data->home_position_and_heading, m->pos); + crab_data->home_position_and_heading[3] = m->heading_radians; FUN_L01_0026d930((char *)&crab_data->iD0); { float k = l10_toxic_crab_size_scale * 1024.0f; @@ -291,14 +291,14 @@ void toxic_crab_update(Moby2E30F8 *m) { crab_data->fDC = 0.5f; crab_data->fD8 = 2.0f; r = truncate_float_to_s32(k); - initial_movement_step = crab_data->f1A4 * frame_time; + initial_movement_step = crab_data->movement_speed * frame_time; initial_movement_size_scale = l10_toxic_crab_size_scale; crab_data->iD0 = r; crab_data->fD4 = initial_movement_size_scale; crab_data->fF4 = initial_movement_step; } { - int k = crab_data->i1BC; + int k = crab_data->activation_dependency_moby_index; if (k != -1) { Moby2E30F8 *p = (Moby2E30F8 *)((char *)D_L10_0015FFD0_macro[2] + (k << 8)); if (p == 0 || p->state == MOBY_STATE_MARKED_FOR_REMOVAL || @@ -308,7 +308,7 @@ void toxic_crab_update(Moby2E30F8 *m) { (p->id & 0x1F)) & 1) && visited52[p->bB0 + (current_level_index << 4)] == 0xFF)) { - crab_data->i1BC = -1; + crab_data->activation_dependency_moby_index = -1; } } } @@ -320,10 +320,10 @@ void toxic_crab_update(Moby2E30F8 *m) { break; case TOXIC_CRAB_STATE_WAIT_FOR_ACTIVATION: FUN_L00_00258278( - (char *)m, &crab_data->f190, crab_data->v170[3], 0.02f, 0.3f, frame_time * 6.2831855f); - if (crab_data->i1BC != -1) { + (char *)m, &crab_data->heading_turn_step, crab_data->home_position_and_heading[3], 0.02f, 0.3f, frame_time * 6.2831855f); + if (crab_data->activation_dependency_moby_index != -1) { char *moby_instance_array_base = D_L10_0015FFD8; - Moby2E30F8 *p = (Moby2E30F8 *)(moby_instance_array_base + (crab_data->i1BC << 8)); + Moby2E30F8 *p = (Moby2E30F8 *)(moby_instance_array_base + (crab_data->activation_dependency_moby_index << 8)); if (p == 0 || p->state == MOBY_STATE_MARKED_FOR_REMOVAL || p->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER || ((*(int *)(((char *)&D_0014C190) + @@ -331,27 +331,27 @@ void toxic_crab_update(Moby2E30F8 *m) { (p->id & 0x1F)) & 1)) { m->state = TOXIC_CRAB_STATE_ACTIVATE; - crab_data->i1A8 = scale_game_frames(1); - if (m->b21 != 0xFF) { + crab_data->behavior_timer_frames = scale_game_frames(1); + if (m->group_index != 0xFF) { activate_waiting_moby_group_members((struct Moby *)m); } } } - if (crab_data->i164 != 2 || crab_data->i1B4 != 0) { + if (crab_data->tracked_target_selection_status != 2 || crab_data->activation_override_enabled != 0) { m->state = TOXIC_CRAB_STATE_ACTIVATE; - crab_data->i1A8 = scale_game_frames(1); - if (m->b21 != 0xFF) { + crab_data->behavior_timer_frames = scale_game_frames(1); + if (m->group_index != 0xFF) { activate_waiting_moby_group_members((struct Moby *)m); } } break; case TOXIC_CRAB_STATE_ACTIVATE: if (m->anim == 0) { - if (crab_data->i1A8 == 0) { - crab_data->i1A8 = + if (crab_data->behavior_timer_frames == 0) { + crab_data->behavior_timer_frames = truncate_float_to_s32(FUN_L04_001f1978(random_float_between(0.0f, 20.0f))); - } else if (fast_dec_timer(&crab_data->i1A8)) { - if (crab_data->i1B4 != 0) { + } else if (fast_dec_timer(&crab_data->behavior_timer_frames)) { + if (crab_data->activation_override_enabled != 0) { if (m->anim != 1) { blend_moby_animation(m, 1, 0, scale_game_frames(10)); } @@ -365,8 +365,8 @@ void toxic_crab_update(Moby2E30F8 *m) { if (vector_distance_xy(m->pos, &hero.motion.pos) < *(float *)&D_L10_00161E40_gp) { float x; m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; - crab_data->i1D8 = 0; - qcopy(crab_data->v1C0, m->pos); + crab_data->pursuit_movement_blocked = 0; + qcopy(crab_data->pursuit_progress_sample_position, m->pos); crab_data->fF4 = 0.0f; x = crab_data->f198 * DEG_TO_RAD; crab_data->f194 = random_float_between(x, -x); @@ -382,21 +382,21 @@ void toxic_crab_update(Moby2E30F8 *m) { } break; case TOXIC_CRAB_STATE_FACE_TRACKED_POSITION: { - float ang = fast_arc_tan(crab_data->f120 - m->pos[0], crab_data->f124 - m->pos[1]); - FUN_L00_00258278((char *)m, &crab_data->f190, ang, 0.02f, 0.3f, frame_time * 6.2831855f); - if (crab_data->i164 != 2) { + float ang = fast_arc_tan(crab_data->tracked_position_x - m->pos[0], crab_data->tracked_position_y - m->pos[1]); + FUN_L00_00258278((char *)m, &crab_data->heading_turn_step, ang, 0.02f, 0.3f, frame_time * 6.2831855f); + if (crab_data->tracked_target_selection_status != 2) { m->state = TOXIC_CRAB_STATE_WAIT_TO_PURSUE; - crab_data->i1A8 = - truncate_float_to_s32(random_float_between(0.0f, (float)crab_data->i1B8)); + crab_data->behavior_timer_frames = + truncate_float_to_s32(random_float_between(0.0f, (float)crab_data->pursuit_delay_upper_bound_frames)); } break; } case TOXIC_CRAB_STATE_WAIT_TO_PURSUE: - if (fast_dec_timer(&crab_data->i1A8)) { + if (fast_dec_timer(&crab_data->behavior_timer_frames)) { float x; m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; - crab_data->i1D8 = 0; - qcopy(crab_data->v1C0, m->pos); + crab_data->pursuit_movement_blocked = 0; + qcopy(crab_data->pursuit_progress_sample_position, m->pos); crab_data->fF4 = 0.0f; x = crab_data->f198 * DEG_TO_RAD; crab_data->f194 = random_float_between(x, -x); @@ -418,32 +418,32 @@ void toxic_crab_update(Moby2E30F8 *m) { target_distance = fast_vec_dist(m->pos, target_moby + 0x10); if (target_distance > (MOBY(target_moby)->oclass == 0x359 ? 2.0f : 3.57f)) { - approach_value(&crab_data->fF4, crab_data->f1A4 * frame_time, frame_time_sq * 8.0f); + approach_value(&crab_data->fF4, crab_data->movement_speed * frame_time, frame_time_sq * 8.0f); } else { approach_value( - &crab_data->fF4, crab_data->f1A4 * frame_time * 0.3f, frame_time_sq * 20.0f); + &crab_data->fF4, crab_data->movement_speed * frame_time * 0.3f, frame_time_sq * 20.0f); } *(OvlQuad *)pre_movement_position = *(OvlQuad *)m->pos; if (see && absolute_float(target_distance - (MOBY(target_moby)->oclass == 0x359 ? 2.0f : 3.57f)) < 0.35f) { approach_value(&crab_data->fF4, 0.0f, frame_time_sq * 30.0f); - } else if (crab_data->i1D8 != 0) { + } else if (crab_data->pursuit_movement_blocked != 0) { approach_value(&crab_data->fF4, 0.0f, frame_time_sq * 10.0f); } ang = fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], MOBY(target_moby)->pos.y - m->pos[1]); - diff = fast_difference_between_rotations(ang, m->f48); + diff = fast_difference_between_rotations(ang, m->heading_radians); if (0.87266463f < diff) { - float lim = crab_data->f1A4 * frame_time * 0.25f; + float lim = crab_data->movement_speed * frame_time * 0.25f; if (lim < crab_data->fF4) { crab_data->fF4 = lim; } } if (toxic_crab_pursuit_heading_threshold_degrees_gp * DEG_TO_RAD < diff || - crab_data->i1D8 == 0) { + crab_data->pursuit_movement_blocked == 0) { FUN_L00_00258278( - (char *)m, &crab_data->f190, ang, 0.02f, 0.3f, frame_time * 6.2831855f); + (char *)m, &crab_data->heading_turn_step, ang, 0.02f, 0.3f, frame_time * 6.2831855f); } aim = compute_toxic_crab_group_approach_angle((struct Moby *)m); v[0] = fast_cos(aim) * (MOBY(target_moby)->oclass == 0x359 ? 2.0f : 3.57f); @@ -451,11 +451,11 @@ void toxic_crab_update(Moby2E30F8 *m) { v[2] = 0.0f; fast_vec_add(v, v, target_moby + 0x10); if (hero.vehicle_mode != HERO_VEHICLE_MODE_CLANK) { - float rot = m->f48; + float rot = m->heading_radians; int r; - m->f48 = fast_arc_tan(v[0] - m->pos[0], v[1] - m->pos[1]); - dir[0] = fast_cos(m->f48) * 2.0f; - dir[1] = fast_sin(m->f48) * 2.0f; + m->heading_radians = fast_arc_tan(v[0] - m->pos[0], v[1] - m->pos[1]); + dir[0] = fast_cos(m->heading_radians) * 2.0f; + dir[1] = fast_sin(m->heading_radians) * 2.0f; dir[2] = 0.0f; clear_u64_value(out); { @@ -472,7 +472,7 @@ void toxic_crab_update(Moby2E30F8 *m) { fast_vec_dist(from2, h + 0x20) < toxic_crab_obstacle_pause_distance_gp) { m->state = TOXIC_CRAB_STATE_PAUSE_PURSUIT; - crab_data->i1A8 = scale_game_frames(0x3C); + crab_data->behavior_timer_frames = scale_game_frames(0x3C); if (m->anim != 1) { blend_moby_animation(m, 1, 0, scale_game_frames(7)); } @@ -480,37 +480,37 @@ void toxic_crab_update(Moby2E30F8 *m) { } } r = move_moby_with_ground_and_collision_checks(m, &crab_data->iD0, dir, out, 1.0f); - m->f48 = rot; + m->heading_radians = rot; if (r & 3) { if (vector_distance_xy(m->pos, pre_movement_position) < crab_data->fF4 * 0.25f) { - crab_data->i1D8 = 1; + crab_data->pursuit_movement_blocked = 1; } else { - crab_data->i1D8 = 0; + crab_data->pursuit_movement_blocked = 0; } - if (D_L10_0015F5CC % 7 == 0 && crab_data->i1A8 == 0) { - if (vector_distance_xy(crab_data->v1C0, m->pos) < crab_data->fF4 && + if (D_L10_0015F5CC % 7 == 0 && crab_data->behavior_timer_frames == 0) { + if (vector_distance_xy(crab_data->pursuit_progress_sample_position, m->pos) < crab_data->fF4 && diff <= toxic_crab_pursuit_heading_threshold_degrees_gp * DEG_TO_RAD) { m->state = TOXIC_CRAB_STATE_PAUSE_PURSUIT; - crab_data->i1A8 = scale_game_frames(0x3C); + crab_data->behavior_timer_frames = scale_game_frames(0x3C); if (m->anim != 1) { blend_moby_animation(m, 1, 0, scale_game_frames(7)); } } else if (m->anim == 1) { blend_moby_animation(m, 3, 0, scale_game_frames(7)); } - qcopy(crab_data->v1C0, m->pos); + qcopy(crab_data->pursuit_progress_sample_position, m->pos); } } else { - crab_data->i1D8 = 0; + crab_data->pursuit_movement_blocked = 0; } if (m->state == TOXIC_CRAB_STATE_PURSUE_TARGET && - fast_dec_timer(&crab_data->i1A8) && 0.0f < crab_data->fF4 && - crab_data->i1D8 == 0 && m->anim == 1) { + fast_dec_timer(&crab_data->behavior_timer_frames) && 0.0f < crab_data->fF4 && + crab_data->pursuit_movement_blocked == 0 && m->anim == 1) { blend_moby_animation(m, 3, 0, scale_game_frames(7)); } } else { - if (absolute_float(crab_data->f190) > frame_time * 0.08726646f) { + if (absolute_float(crab_data->heading_turn_step) > frame_time * 0.08726646f) { if (m->anim != 3) { blend_moby_animation(m, 3, 0, scale_game_frames(7)); } @@ -522,9 +522,9 @@ void toxic_crab_update(Moby2E30F8 *m) { } m->f58 = 1.2f; { - float home = fast_vec_dist(m->pos, crab_data->v170); + float home = fast_vec_dist(m->pos, crab_data->home_position_and_heading); if ((hero.vehicle_mode == HERO_VEHICLE_MODE_CLANK ? 1.0f : 30.0f) < home || - crab_data->i164 == 2) { + crab_data->tracked_target_selection_status == 2) { m->state = TOXIC_CRAB_STATE_RETURN_HOME; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); } else if (vector_distance_xy(m->pos, target_moby + 0x10) < @@ -548,14 +548,14 @@ void toxic_crab_update(Moby2E30F8 *m) { diff = fast_difference_between_rotations(fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], MOBY(target_moby)->pos.y - m->pos[1]), - m->f48); + m->heading_radians); if (0.87266463f < diff) { - float lim = crab_data->f1A4 * frame_time * 0.25f; + float lim = crab_data->movement_speed * frame_time * 0.25f; if (lim < crab_data->fF4) { crab_data->fF4 = lim; } } - if (fast_dec_timer(&crab_data->i1A8) || + if (fast_dec_timer(&crab_data->behavior_timer_frames) || toxic_crab_pursuit_heading_threshold_degrees_gp * DEG_TO_RAD < diff) { float from2[4]; float to2[4]; @@ -574,16 +574,16 @@ void toxic_crab_update(Moby2E30F8 *m) { } if (ok) { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; - crab_data->i1D8 = 0; - qcopy(crab_data->v1C0, m->pos); + crab_data->pursuit_movement_blocked = 0; + qcopy(crab_data->pursuit_progress_sample_position, m->pos); crab_data->fF4 = 0.0f; - crab_data->i1A8 = scale_game_frames(0xF); + crab_data->behavior_timer_frames = scale_game_frames(0xF); } } { - float home = fast_vec_dist(m->pos, crab_data->v170); + float home = fast_vec_dist(m->pos, crab_data->home_position_and_heading); if ((hero.vehicle_mode == HERO_VEHICLE_MODE_CLANK ? 1.0f : 30.0f) < home || - crab_data->i164 == 2) { + crab_data->tracked_target_selection_status == 2) { m->state = TOXIC_CRAB_STATE_RETURN_HOME; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); } else if (vector_distance_xy(m->pos, target_moby + 0x10) < @@ -607,7 +607,7 @@ void toxic_crab_update(Moby2E30F8 *m) { fr = compute_interpolated_record_value(m); ang = fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], MOBY(target_moby)->pos.y - m->pos[1]); - FUN_L00_00258278((char *)m, &crab_data->f190, ang, 0.03f, 0.3f, frame_time * 6.2831855f); + FUN_L00_00258278((char *)m, &crab_data->heading_turn_step, ang, 0.03f, 0.3f, frame_time * 6.2831855f); if (m->anim >= 6 && m->anim <= 7 && 4.0f <= fr && fr <= 7.0f) { Hit2E30F8 hit; float v[4]; @@ -618,8 +618,8 @@ void toxic_crab_update(Moby2E30F8 *m) { hit.flags = 0x10001; hit.f = 3.1f; hit.n = 1; - hit.v[0] = fast_cos(m->f48); - hit.v[1] = fast_sin(m->f48); + hit.v[0] = fast_cos(m->heading_radians); + hit.v[1] = fast_sin(m->heading_radians); hit.v[2] = 1.0f; hit.v[3] = 5627.925f; hit.b0 = 0; @@ -639,15 +639,15 @@ void toxic_crab_update(Moby2E30F8 *m) { collision_line(pos, v, 9, m, &hit); } } else if (m->anim >= 6 && m->anim <= 7 && (m->b70 & 2)) { - float home = fast_vec_dist(m->pos, crab_data->v170); + float home = fast_vec_dist(m->pos, crab_data->home_position_and_heading); if ((((unsigned char *)&D_0013E533)[0x2EC1] == 1 ? 1.0f : 30.0f) < home || - crab_data->i164 == 2) { + crab_data->tracked_target_selection_status == 2) { m->state = TOXIC_CRAB_STATE_RETURN_HOME; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); } else { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; - crab_data->i1D8 = 0; - qcopy(crab_data->v1C0, m->pos); + crab_data->pursuit_movement_blocked = 0; + qcopy(crab_data->pursuit_progress_sample_position, m->pos); crab_data->fF4 = 0.0f; if (m->anim != 3) { blend_moby_animation(m, 3, 0, scale_game_frames(7)); @@ -664,22 +664,22 @@ void toxic_crab_update(Moby2E30F8 *m) { float ang; approach_value( - &crab_data->fF4, crab_data->f1A4 * 3.0f * frame_time, frame_time_sq * 20.0f); + &crab_data->fF4, crab_data->movement_speed * 3.0f * frame_time, frame_time_sq * 20.0f); ang = fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], MOBY(target_moby)->pos.y - m->pos[1]); FUN_L00_00258278( - (char *)m, &crab_data->f190, ang, 0.02f, 0.3f, frame_time * 6.2831855f); - rot = m->f48; - m->f48 = fast_add_rotations(fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], + (char *)m, &crab_data->heading_turn_step, ang, 0.02f, 0.3f, frame_time * 6.2831855f); + rot = m->heading_radians; + m->heading_radians = fast_add_rotations(fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], MOBY(target_moby)->pos.y - m->pos[1]), 3.14159f); - dir[0] = fast_cos(m->f48) * 2.0f; - dir[1] = fast_sin(m->f48) * 2.0f; + dir[0] = fast_cos(m->heading_radians) * 2.0f; + dir[1] = fast_sin(m->heading_radians) * 2.0f; dir[2] = 0.0f; move_moby_with_ground_and_collision_checks(m, &crab_data->iD0, dir, out, 1.0f); - m->f48 = rot; + m->heading_radians = rot; if (see) { - if (fast_dec_timer(&crab_data->i1A8) || + if (fast_dec_timer(&crab_data->behavior_timer_frames) || toxic_crab_back_away_distance_limit_gp < fast_vec_dist(m->pos, target_moby + 0x10)) { int anim; @@ -701,29 +701,29 @@ void toxic_crab_update(Moby2E30F8 *m) { float out[4]; float ang; - approach_value(&crab_data->fF4, crab_data->f1A4 * frame_time, frame_time_sq * 5.0f); - ang = fast_arc_tan(crab_data->v170[0] - m->pos[0], crab_data->v170[1] - m->pos[1]); + approach_value(&crab_data->fF4, crab_data->movement_speed * frame_time, frame_time_sq * 5.0f); + ang = fast_arc_tan(crab_data->home_position_and_heading[0] - m->pos[0], crab_data->home_position_and_heading[1] - m->pos[1]); func_L00_002592B0_b( - (char *)m, ang, 0.02f, 0.3f, frame_time * 6.2831855f, &crab_data->f190); - if (0.87266463f < fast_difference_between_rotations(ang, m->f48)) { - float lim = crab_data->f1A4 * frame_time * 0.25f; + (char *)m, ang, 0.02f, 0.3f, frame_time * 6.2831855f, &crab_data->heading_turn_step); + if (0.87266463f < fast_difference_between_rotations(ang, m->heading_radians)) { + float lim = crab_data->movement_speed * frame_time * 0.25f; if (lim < crab_data->fF4) { crab_data->fF4 = lim; } } - dir[0] = fast_cos(m->f48) * 2.0f; - dir[1] = fast_sin(m->f48) * 2.0f; + dir[0] = fast_cos(m->heading_radians) * 2.0f; + dir[1] = fast_sin(m->heading_radians) * 2.0f; dir[2] = 0.0f; move_moby_with_ground_and_collision_checks(m, &crab_data->iD0, dir, out, 1.0f); - if (fast_vec_dist(m->pos, crab_data->v170) < 1.0f) { + if (fast_vec_dist(m->pos, crab_data->home_position_and_heading) < 1.0f) { m->state = TOXIC_CRAB_STATE_FACE_TRACKED_POSITION; if (m->anim != 1) { blend_moby_animation(m, 1, 0, scale_game_frames(0x14)); } - } else if (crab_data->i164 != 2) { + } else if (crab_data->tracked_target_selection_status != 2) { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; - crab_data->i1D8 = 0; - qcopy(crab_data->v1C0, m->pos); + crab_data->pursuit_movement_blocked = 0; + qcopy(crab_data->pursuit_progress_sample_position, m->pos); crab_data->fF4 = 0.0f; if (m->anim != 3) { blend_moby_animation(m, 3, 0, scale_game_frames(7)); @@ -733,7 +733,7 @@ void toxic_crab_update(Moby2E30F8 *m) { break; } case TOXIC_CRAB_STATE_HIT_KNOCKBACK: - if (step_moby_motion(m, crab_data->v70) & 0x41) { + if (step_moby_motion(m, crab_data->knockback_motion_xy) & 0x41) { int anim; m->state = TOXIC_CRAB_STATE_MELEE_ATTACK; crab_data->fF4 = frame_time * 5.0f; @@ -742,12 +742,12 @@ void toxic_crab_update(Moby2E30F8 *m) { anim = 6; } blend_moby_animation(m, anim, 0, scale_game_frames(6)); - } else if (m->pos[2] < crab_data->v170[2] - 0.2f) { + } else if (m->pos[2] < crab_data->home_position_and_heading[2] - 0.2f) { if (m->anim != 0xE) { blend_moby_animation(m, 0xE, 0, scale_game_frames(6)); } m->state = TOXIC_CRAB_STATE_FALL_TO_DEATH; - crab_data->f78 = crab_data->f78 / 3.0f; + crab_data->vertical_motion_step = crab_data->vertical_motion_step / 3.0f; } break; case TOXIC_CRAB_STATE_FALL_TO_DEATH: { @@ -755,8 +755,8 @@ void toxic_crab_update(Moby2E30F8 *m) { float fall_motion_scratch[4]; int r; - crab_data->f78 = crab_data->f78 - crab_data->f80; - add_vectors(fall_motion_scratch, m->pos, crab_data->v70); + crab_data->vertical_motion_step = crab_data->vertical_motion_step - crab_data->f80; + add_vectors(fall_motion_scratch, m->pos, crab_data->knockback_motion_xy); if (m->pos[2] < probe_ground_height(m->pos, 0, 0.5f)) { int knockback_collision_radius_fixed; float x; @@ -766,20 +766,20 @@ void toxic_crab_update(Moby2E30F8 *m) { mark_moby_for_removal(m); return; } - m->s34 &= 0xEFFF; + m->moby_flags &= 0xEFFF; m->state = TOXIC_CRAB_STATE_DEATH_EFFECTS; knockback_collision_radius_fixed = truncate_float_to_s32(768.0f); x = toxic_crab_death_knockback_gravity_gp * frame_time_sq; crab_data->bAD = 0; - crab_data->i90 = knockback_collision_radius_fixed; + crab_data->knockback_probe_radius_fixed = knockback_collision_radius_fixed; crab_data->f98 = 0.75f; crab_data->i94 = 9; crab_data->f80 = x; - trooper_set_knockback(crab_data->v70, 2.0f, 1.5f); + trooper_set_knockback(crab_data->knockback_motion_xy, 2.0f, 1.5f); crab_data->fC0 = 7.0f; crab_data->fC4 = 13.0f; func_L00_0025D5B0_b( - m, crab_data->v70, 0xD, 1, 0, fast_add_rotations(m->f48, 3.1415927f)); + m, crab_data->knockback_motion_xy, 0xD, 1, 0, fast_add_rotations(m->heading_radians, 3.1415927f)); crab_data->b67 = 0xFA; FUN_L00_0025d458(m, (short *)crab_data->q60); FUN_L00_00257470(m, 0, -1); @@ -824,15 +824,15 @@ void toxic_crab_update(Moby2E30F8 *m) { m->state == TOXIC_CRAB_STATE_RETURN_HOME) { float ground_height = probe_ground_height(m->pos, 0, 0.5f); if (ground_height < m->pos[2]) { - crab_data->f78 = crab_data->f78 - crab_data->f80; - if (crab_data->f78 < frame_time * -7.0f) { - crab_data->f78 = frame_time * -7.0f; + crab_data->vertical_motion_step = crab_data->vertical_motion_step - crab_data->f80; + if (crab_data->vertical_motion_step < frame_time * -7.0f) { + crab_data->vertical_motion_step = frame_time * -7.0f; } - m->pos[2] = m->pos[2] + crab_data->f78; + m->pos[2] = m->pos[2] + crab_data->vertical_motion_step; if (m->pos[2] < ground_height) { m->pos[2] = ground_height; } - if (ground_height < crab_data->v170[2] - 2.0f) { + if (ground_height < crab_data->home_position_and_heading[2] - 2.0f) { if (m->anim != 0xE) { blend_moby_animation(m, 0xE, 0, scale_game_frames(6)); } From 8ed1d826d0b9dff6e4bb461f3a18a74766579a9b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:30:04 +0000 Subject: [PATCH 610/758] decomp: clarify names in woodcut_bot_update f110 -> knockback_ascent_target_frame: Retail 0x002d1a74 stores 14.0 at d+0x110 after starting death knockback. Checked helper request f71d6c5f1c154c459b29bf3efba1900e receives d+0xC0 in s2 (0x0024f6e8); in ascent mode, 0x0024fa2c-0x0024fa84 computes remaining ascent time from vertical step/gravity and divides record+0x50 minus compute_interpolated_record_value(m) by that time to adjust animation speed. Thus this float is the knockback ascent animation target frame. f114 -> knockback_descent_target_frame: Retail 0x002d1a6c stores 24.0 at d+0x114 after death knockback setup. Checked helper f71d6c5f1c154c459b29bf3efba1900e binds d+0xC0 to s2. In descending mode, 0x0024fa88-0x0024faa8 compares interpolated animation frame to record+0x54 and stops playback on reaching it; 0x0024fb2c-0x0024fb94 divides the remaining frame difference by predicted fall time to adjust animation speed. This proves a descent animation target frame. f120 -> manipulator_slot_index: Retail 0x002d174c-0x002d1768 forms d+0x120 as the manipulator record and 0x002d1f28-0x002d1f3c passes it to attach_manipulator(m,6,record). Supplied attach_manipulator C writes slot_index to manip->unk0, the first byte of this record. WBData f120 is precisely that first byte, establishing the manipulator slot index. f121 -> manipulator_attached: Retail 0x002d1f28-0x002d1f3c tests d+0x121 and calls attach_manipulator only when zero, with record d+0x120. Supplied attach_manipulator tests manip->unk1, sets it to 1 and links the record into source_moby->manipulator_head. This establishes f121 as the attached flag of this manipulator record. f130 -> recoil_rotation: Retail 0x002d3394-0x002d33c4 forms d+0x130, initializes its axis-2 rotation with zero angle, and multiplies it by the axis-1 rotation built from damped recoil angle d+0x3C8. The authoritative C uses build_axis_rotation_quaternion and multiply_quaternions on this array. Its proven content is the composed recoil rotation; dimensions and storage remain unchanged. f160 -> leg_rig_movement_data: Authoritative initialization aliases moby_vars+0x160 as movement_data and passes it to initialize_leg_rig_angle_defaults and initialize_leg_rig. Assigned retail 0x002d26a8-0x002d2704 passes the same d+0x160 record to reset_leg_rig_from_animation and leg_walker_update. Checked helper b1264b95f3b44b7a9bd4b94cb41d541c keeps that argument in s2 and updates joint positions, movement and animation using it. Thus this array is leg-rig movement data. f38 -> pending_excitement: Retail 0x002d1710-0x002d1728 treats nonzero d+0x38 as excited. At 0x002d1cbc-0x002d1cd4 a nonzero value reloads the excitement timer d+0x3C6 and is then cleared. Authoritative C follows that exact flow, proving a pending excitement indicator consumed each update without claiming its originating event. f3B0 -> initial_position: Retail 0x002d1ef8 and 0x002d1f1c-0x002d1f24 copy the moby's position into d+0x3B0 during initialization. 0x002d2960-0x002d29e0 measures distance to that vector and derives a bearing toward it in RETURN_TO_SAVED_POSITION. Authoritative C qcopy and return-state movement establish that it is the saved initial position. f3C0 -> initial_debris_animation_enabled: Retail 0x002d1f48-0x002d1f70 tests d+0x3C0 during initialization: nonzero selects state 3 and animation 0xB; zero selects idle. Existing WOODCUT_BOT_PLAY_ANIMATION_AND_EMIT_DEBRIS state 3 tests the animation window and emits twenty debris pieces at 0x002d22c4-0x002d2460. This byte enables that initial animation/debris state; no narrative purpose is asserted. f3C1 -> saved_non_recovery_state: Retail 0x002d33c8-0x002d33d4 loads the current moby state and copies it to d+0x3C1 only when it differs from 9. The established local enum names state 9 WOODCUT_BOT_HIT_RECOVERY_AND_REPOSITION. Authoritative C has the same guarded assignment, proving this byte saves the most recently observed state outside hit recovery. f3C8 -> recoil_tilt_angle: Retail 0x002d1ac4-0x002d1ad4 sets d+0x3C8 to -0.5235988 on recovery reactions. 0x002d337c-0x002d33a4 multiplies it by 0.96 and passes it as angle to build_axis_rotation_quaternion with axis 1, then composes that rotation at d+0x130. This float is the damped recoil tilt angle. f3D0 -> yaw_turn_spring_state: Retail 0x002d2138 clears d+0x3D0 when entering turn-before-movement. 0x002d2ee0-0x002d2f18 and 0x002d3154-0x002d3184 pass its address to spring_turn together with current yaw, desired target or initial-position bearing, and turn limits; the return replaces moby yaw. Authoritative C establishes this float as persistent state for the yaw-turn spring, without asserting a particular derivative or physical unit. f3D4 -> reposition_bearing: Retail 0x002d2cf0-0x002d2d58 computes candidate_reposition_bearing, builds a six-unit candidate offset and tests path inclusion. Success stores that bearing at d+0x3D4 (0x002d2c38). 0x002d2e88-0x002d2eac and 0x002d2f48-0x002d2f70 read it as bearing for spherical offsets added to moby position. Thus this float stores the selected reposition bearing. f3D8 -> reposition_step: Retail 0x002d2c40 initializes d+0x3D8 to zero after selecting a reposition bearing. 0x002d2e50-0x002d2e84 accelerates/clamps it and 0x002d2f1c-0x002d2f58 decelerates it. Both paths use it as the spherical offset magnitude and add the resulting vector directly to position. This proves per-update reposition displacement magnitude, rather than a distance-to-go or timer. f3DC -> movement_path_index: Retail 0x002d20ec-0x002d2118 compares d+0x3DC with -1, multiplies it by four and indexes the l04_paths table at 0x001b0630. The selected path count and point array are passed to point_in_path_xy for movement eligibility. Repeated forward-position and reposition candidate tests use that same indexed path. This int selects the path bounding movement. f3E0 -> vertical_fall_step: Retail 0x002d1f10 clears d+0x3E0 at initialization. 0x002d3404-0x002d3438 adds frame_time_sq*9.8 to it and subtracts it, with the temporary two-unit probe adjustment, from moby Z. Ground contact clamps Z and clears the field at 0x002d3458-0x002d345c. The authoritative C proves an accumulated downward position step used for falling. f3E4 -> recoil_horizontal_step: Retail reaction setup 0x002d1bbc and 0x002d1c54 initializes d+0x3E4 and passes its address to trooper_knockback_arc. At 0x002d327c-0x002d3310 positive values scale cosine/sine of the bearing away from hero; Z displacement is zero and current position is added. 0x002d3314-0x002d3378 decays it and applies the candidate via move_moby_xy_with_collision_constraints. This is horizontal recoil displacement per update. f3E8 -> target_engagement_range: Retail 0x002d1730-0x002d1748 supplies d+0x3E8, doubled while excited, to select_moby_combat_target. 0x002d20a0-0x002d20cc compares target_distance with the same normal/doubled field before pursuit; 0x002d21a8-0x002d21b4 uses its normal range when deciding to return. Authoritative C proves the base target-selection and engagement distance range. --- src/overlays/l04/mobys/woodcut_bot.c | 248 +++++++++++++-------------- 1 file changed, 124 insertions(+), 124 deletions(-) diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index 36f2a5f080..da32f4fa4e 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -197,7 +197,7 @@ typedef struct WBData { /* 0x02A */ char pad02A[6]; /* 0x030 */ float f30; /* 0x034 */ char pad034[4]; - /* 0x038 */ int f38; + /* 0x038 */ int pending_excitement; /* 0x03C */ char pad03C[0x1C]; /* 0x058 */ unsigned char f58; /* 0x059 */ char pad059; @@ -217,31 +217,31 @@ typedef struct WBData { /* 0x0EC */ char pad0EC[0x11]; /* 0x0FD */ unsigned char fFD; /* 0x0FE */ char pad0FE[0x12]; - /* 0x110 */ float f110; - /* 0x114 */ float f114; + /* 0x110 */ float knockback_ascent_target_frame; + /* 0x114 */ float knockback_descent_target_frame; /* 0x118 */ char pad118[8]; - /* 0x120 */ unsigned char f120; - /* 0x121 */ unsigned char f121; + /* 0x120 */ unsigned char manipulator_slot_index; + /* 0x121 */ unsigned char manipulator_attached; /* 0x122 */ char pad122[0xE]; - /* 0x130 */ char f130[0x30]; - /* 0x160 */ char f160[0xB7]; + /* 0x130 */ char recoil_rotation[0x30]; + /* 0x160 */ char leg_rig_movement_data[0xB7]; /* 0x217 */ unsigned char f217; /* 0x218 */ char pad218[0x198]; - /* 0x3B0 */ float f3B0[4]; - /* 0x3C0 */ unsigned char f3C0; - /* 0x3C1 */ unsigned char f3C1; + /* 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; - /* 0x3C8 */ float f3C8; + /* 0x3C8 */ float recoil_tilt_angle; /* 0x3CC */ char pad3CC[4]; - /* 0x3D0 */ float f3D0; - /* 0x3D4 */ float f3D4; - /* 0x3D8 */ float f3D8; - /* 0x3DC */ int f3DC; - /* 0x3E0 */ float f3E0; - /* 0x3E4 */ float f3E4; - /* 0x3E8 */ float f3E8; + /* 0x3D0 */ float yaw_turn_spring_state; + /* 0x3D4 */ float reposition_bearing; + /* 0x3D8 */ float reposition_step; + /* 0x3DC */ int movement_path_index; + /* 0x3E0 */ float vertical_fall_step; + /* 0x3E4 */ float recoil_horizontal_step; + /* 0x3E8 */ float target_engagement_range; } WBData; typedef struct WBMoby { @@ -361,10 +361,10 @@ void woodcut_bot_update(WBMoby *m) { float target_distance; float hd; - if (d->f38 != 0 || d->t3C6 != 0) + if (d->pending_excitement != 0 || d->t3C6 != 0) excited = 1; - select_moby_combat_target(m, selected_target_position, excited ? d->f3E8 * 2.0f : d->f3E8); - p = &d->f120; + select_moby_combat_target(m, selected_target_position, excited ? d->target_engagement_range * 2.0f : d->target_engagement_range); + p = &d->manipulator_slot_index; FUN_L00_00263ac8(2.5f, m, 6, p); manipulator = p; pos = m->pos; @@ -439,32 +439,32 @@ void woodcut_bot_update(WBMoby *m) { *(OvlQuad *)v = *(OvlQuad *)(p + 0x10); trooper_knockback_arc(v, &angle, &d->fD8, &d->fDC); trooper_start_knockback(angle, m, d->fC0, 8, 1, 0); - d->f110 = 14.0f; - d->f114 = 24.0f; + d->knockback_ascent_target_frame = 14.0f; + d->knockback_descent_target_frame = 24.0f; m->state = WOODCUT_BOT_DEATH_KNOCKBACK; FUN_L00_00257470(m, 0, -1); d->fB7 = 0x78; trooper_anim_update(m, d->fB0); - d->f3E4 = (2.0f / scale_time(15.0f)) * 2.0f; + d->recoil_horizontal_step = (2.0f / scale_time(15.0f)) * 2.0f; break; case WOODCUT_BOT_REACTION_HIT_RECOVERY_AND_REPOSITION: case WOODCUT_BOT_REACTION_HIT_RECOVERY_WITH_MELEE_WINDOW_GUARD: - d->f3C8 = -0.5235988f; + d->recoil_tilt_angle = -0.5235988f; if (m->anim != 4 || hd < 16.0f || hd > 27.0f) { short hit_source_moby_class; m->fBC |= 5; blend_moby_animation(m, 5, 0, scale_game_frames(3)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_HIT_RECOVERY_AND_REPOSITION; hit_source_moby_class = *(short *)(*(char **)(p + 0x20) + 0xA6); if (hit_source_moby_class == 0x131 || hit_source_moby_class == 0xB0) { - d->f3E4 = (2.0f / scale_time(15.0f)) * 0.5f; + d->recoil_horizontal_step = (2.0f / scale_time(15.0f)) * 0.5f; } else { - d->f3E4 = 2.0f / scale_time(15.0f); + d->recoil_horizontal_step = 2.0f / scale_time(15.0f); } *(OvlQuad *)v = *(OvlQuad *)(p + 0x10); - trooper_knockback_arc(v, &angle, &d->f3E4, &one); + trooper_knockback_arc(v, &angle, &d->recoil_horizontal_step, &one); d->fB7 = 0x78; trooper_anim_update(m, d->fB0); d->t3C4 = scale_game_frames(0xF); @@ -474,11 +474,11 @@ void woodcut_bot_update(WBMoby *m) { case WOODCUT_BOT_REACTION_RECOIL_TO_IDLE: case WOODCUT_BOT_REACTION_RECOIL_TO_IDLE_WITH_COOLDOWNS: blend_moby_animation(m, 6, 0, scale_game_frames(10)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_IDLE; - d->f3E4 = 2.0f / scale_time(15.0f); + d->recoil_horizontal_step = 2.0f / scale_time(15.0f); *(OvlQuad *)v = *(OvlQuad *)(p + 0x10); - trooper_knockback_arc(v, &angle, &d->f3E4, &one); + trooper_knockback_arc(v, &angle, &d->recoil_horizontal_step, &one); m->rot[2] = fast_add_rotations(3.1415927f, angle); d->fB7 = 0x78; trooper_anim_update(m, d->fB0); @@ -496,10 +496,10 @@ void woodcut_bot_update(WBMoby *m) { } } m->fA4 = 0xFF; - if (d->f38 != 0) + if (d->pending_excitement != 0) d->t3C6 = scale_game_frames(0xF0); tm = &d->t3C2; - d->f38 = 0; + d->pending_excitement = 0; fast_dec_timer_s16(&d->t3C6); if (m->state == WOODCUT_BOT_MELEE_ATTACK) { @@ -537,15 +537,15 @@ void woodcut_bot_update(WBMoby *m) { d->f28 = 1; d->f29 = 0; m->fBC = 0; - d->f3E0 = 0.0f; + d->vertical_fall_step = 0.0f; d->t3C6 = 0; d->f58 = 8; d->f5A = 8; - qcopy(d->f3B0, pos); - if (d->f121 == 0) + qcopy(d->initial_position, pos); + if (d->manipulator_attached == 0) attach_manipulator(m, 6, manipulator); initialize_woodcut_bot_movement_data(m); - if (d->f3C0 != 0) { + if (d->initial_debris_animation_enabled != 0) { m->state = WOODCUT_BOT_PLAY_ANIMATION_AND_EMIT_DEBRIS; blend_moby_animation(m, 0xB, 0, scale_game_frames(10)); } else { @@ -554,7 +554,7 @@ void woodcut_bot_update(WBMoby *m) { break; case WOODCUT_BOT_IDLE: if (m->f70 & 2) { - if (excited ? (d->f3E8 * 2.0f < target_distance) : (d->f3E8 < target_distance)) { + if (excited ? (d->target_engagement_range * 2.0f < target_distance) : (d->target_engagement_range < target_distance)) { int anims[6]; memset(anims, 0, 0x18); @@ -568,29 +568,29 @@ void woodcut_bot_update(WBMoby *m) { if (target_distance < 3.0f && adiff < 1.5707964f) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_MELEE_ATTACK; - } else if (excited ? (target_distance < d->f3E8 * 2.0f) : (target_distance < d->f3E8)) { + } else if (excited ? (target_distance < d->target_engagement_range * 2.0f) : (target_distance < d->target_engagement_range)) { if (m->fBC & 1) { - if (excited || d->f3DC == -1 || + if (excited || d->movement_path_index == -1 || point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) != 0) { + ((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; } } else { - d->f3D0 = 0.0f; + d->yaw_turn_spring_state = 0.0f; blend_moby_animation(m, 0x10, 0, scale_game_frames(10)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_TURN_BEFORE_MOVEMENT; m->fBC |= 1; } } if (!excited) { - if (vector_distance_xy(pos, d->f3B0) > 2.0f) { - if (d->f3E8 < target_distance || - (d->f3DC != -1 && point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) == 0)) { + if (vector_distance_xy(pos, d->initial_position) > 2.0f) { + if (d->target_engagement_range < target_distance || + (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_RETURN_TO_SAVED_POSITION; m->fBC |= 8; } @@ -600,10 +600,10 @@ void woodcut_bot_update(WBMoby *m) { break; case WOODCUT_BOT_WAIT_FOR_ANIMATION_BEFORE_PURSUIT: if (m->anim == 2 && (m->f70 & 2)) { - if (excited || d->f3DC == -1 || + if (excited || d->movement_path_index == -1 || point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) != 0) { + ((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; } else { @@ -653,19 +653,19 @@ void woodcut_bot_update(WBMoby *m) { if (target_distance < 3.0f && adiff < 1.5707964f) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_MELEE_ATTACK; - } else if (excited ? (target_distance < d->f3E8 * 2.0f) : (target_distance < d->f3E8)) { + } else if (excited ? (target_distance < d->target_engagement_range * 2.0f) : (target_distance < d->target_engagement_range)) { if (m->fBC & 1) { - if (excited || d->f3DC == -1 || + if (excited || d->movement_path_index == -1 || point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) != 0) { + ((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; } } else { - d->f3D0 = 0.0f; + d->yaw_turn_spring_state = 0.0f; blend_moby_animation(m, 0x10, 0, scale_game_frames(10)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_TURN_BEFORE_MOVEMENT; m->fBC |= 1; } @@ -677,17 +677,17 @@ void woodcut_bot_update(WBMoby *m) { if (excited) { if (target_distance < 3.0f && adiff < 1.5707964f) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_MELEE_ATTACK; - } else if (d->f3DC == -1 || point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) != 0) { + } else if (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; } else if (adiff > 1.5707964f) { - d->f3D0 = 0.0f; + d->yaw_turn_spring_state = 0.0f; blend_moby_animation(m, 0x10, 0, scale_game_frames(10)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_TURN_BEFORE_MOVEMENT; } } else { @@ -697,19 +697,19 @@ void woodcut_bot_update(WBMoby *m) { case WOODCUT_BOT_MOVE_TOWARD_TARGET: { if (m->fBC & 8) { m->fBC &= ~8; - reset_leg_rig_from_animation(m, d->f160); + reset_leg_rig_from_animation(m, d->leg_rig_movement_data); } leg_walker_update(m, - d->f160, + d->leg_rig_movement_data, frame_time * 4.0f, fast_arc_tan(selected_target_position[0] - m->pos[0], selected_target_position[1] - m->pos[1]), frame_time_sq * 20.0f); if (target_distance < 3.0f && adiff < 1.5707964f) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_MELEE_ATTACK; - } else if (d->f3DC != -1) { + } else if (d->movement_path_index != -1) { float v[4]; v[0] = fast_cos(m->rot[2]) * 2.0f; @@ -718,24 +718,24 @@ void woodcut_bot_update(WBMoby *m) { p = (unsigned char *)v; fast_vec_add(p, p, pos); if (point_in_path_xy( - p, ((int *)l04_paths[d->f3DC]) + 4, *((int *)l04_paths[d->f3DC])) == 0) { + p, ((int *)l04_paths[d->movement_path_index]) + 4, *((int *)l04_paths[d->movement_path_index])) == 0) { if (excited && point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) == 0) { + ((int *)l04_paths[d->movement_path_index]) + 4, + *((int *)l04_paths[d->movement_path_index])) == 0) { m->state = WOODCUT_BOT_STOP_MOVEMENT; } else if (point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) != 0) { - d->f3D0 = 0.0f; + ((int *)l04_paths[d->movement_path_index]) + 4, + *((int *)l04_paths[d->movement_path_index])) != 0) { + d->yaw_turn_spring_state = 0.0f; blend_moby_animation(m, 0x10, 0, scale_game_frames(10)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_TURN_BEFORE_MOVEMENT; } } if (!excited) { if (point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) == 0) { + ((int *)l04_paths[d->movement_path_index]) + 4, + *((int *)l04_paths[d->movement_path_index])) == 0) { m->state = WOODCUT_BOT_RETURN_TO_SAVED_POSITION; } } @@ -745,26 +745,26 @@ void woodcut_bot_update(WBMoby *m) { case WOODCUT_BOT_RETURN_TO_SAVED_POSITION: if (m->fBC & 8) { m->fBC &= ~8; - reset_leg_rig_from_animation(m, d->f160); + reset_leg_rig_from_animation(m, d->leg_rig_movement_data); } if (target_distance < 3.0f && adiff < 1.5707964f) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_MELEE_ATTACK; } else { if (m->fBC & 8) { m->fBC &= ~8; - reset_leg_rig_from_animation(m, d->f160); + reset_leg_rig_from_animation(m, d->leg_rig_movement_data); } - if (vector_distance_xy(pos, d->f3B0) < 2.0f) { + if (vector_distance_xy(pos, d->initial_position) < 2.0f) { m->state = WOODCUT_BOT_STOP_MOVEMENT; } else { leg_walker_update(m, - d->f160, + d->leg_rig_movement_data, frame_time * 4.0f, - fast_arc_tan(d->f3B0[0] - m->pos[0], d->f3B0[1] - m->pos[1]), + fast_arc_tan(d->initial_position[0] - m->pos[0], d->initial_position[1] - m->pos[1]), frame_time_sq * 20.0f); - if (d->f3DC != -1) { + if (d->movement_path_index != -1) { float v[4]; v[0] = fast_cos(m->rot[2]) * 2.0f; @@ -772,16 +772,16 @@ void woodcut_bot_update(WBMoby *m) { v[2] = 0.0f; fast_vec_add(v, v, pos); if (point_in_path_xy(v, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) == 0) { - d->f3D0 = 0.0f; + ((int *)l04_paths[d->movement_path_index]) + 4, + *((int *)l04_paths[d->movement_path_index])) == 0) { + d->yaw_turn_spring_state = 0.0f; blend_moby_animation(m, 0x10, 0, scale_game_frames(10)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_TURN_BEFORE_MOVEMENT; m->fBC |= 0x10; } else if (point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) != 0) { + ((int *)l04_paths[d->movement_path_index]) + 4, + *((int *)l04_paths[d->movement_path_index])) != 0) { m->state = WOODCUT_BOT_STOP_MOVEMENT; } } @@ -791,10 +791,10 @@ void woodcut_bot_update(WBMoby *m) { case WOODCUT_BOT_STOP_MOVEMENT: if (target_distance < 3.0f && adiff < 1.5707964f) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); - reset_walker_gait_helpers(d->f160); + reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_MELEE_ATTACK; } else { - leg_walker_update(m, d->f160, frame_time * 0.0f, m->rot[2], frame_time_sq * 20.0f); + leg_walker_update(m, d->leg_rig_movement_data, frame_time * 0.0f, m->rot[2], frame_time_sq * 20.0f); if (d->f217 == 0) { if (excited) { m->state = WOODCUT_BOT_SELECT_ACTION_WHILE_EXCITED; @@ -815,7 +815,7 @@ void woodcut_bot_update(WBMoby *m) { if (m->anim2 != 5 || (m->anim == 5 && (m->f70 & 2))) { if (m->fBC & 4) { m->fBC &= ~4; - if (d->f3DC == -1) { + if (d->movement_path_index == -1) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_IDLE; d->t3C2 = 0; @@ -844,12 +844,12 @@ void woodcut_bot_update(WBMoby *m) { build_spherical_offset(v, 6.0f, candidate_reposition_bearing, m->rot[1]); fast_vec_add(v, v, pos); if (point_in_path_xy(v, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) != 0) { + ((int *)l04_paths[d->movement_path_index]) + 4, + *((int *)l04_paths[d->movement_path_index])) != 0) { found = 1; blend_moby_animation(m, 0x10, 0, scale_game_frames(10)); - d->f3D4 = candidate_reposition_bearing; - d->f3D8 = 0.0f; + d->reposition_bearing = candidate_reposition_bearing; + d->reposition_step = 0.0f; break; } } @@ -875,28 +875,28 @@ void woodcut_bot_update(WBMoby *m) { if (hd < 28.0f && m->anim == 0x10) { float reposition_step_limit = frame_scale * 0.11111111f; - if (d->f3D8 < reposition_step_limit) { - d->f3D8 = d->f3D8 + frame_time_sq * 20.0f; + if (d->reposition_step < reposition_step_limit) { + d->reposition_step = d->reposition_step + frame_time_sq * 20.0f; } else { - d->f3D8 = reposition_step_limit; + d->reposition_step = reposition_step_limit; } - build_spherical_offset(v, d->f3D8, d->f3D4, m->rot[1]); + build_spherical_offset(v, d->reposition_step, d->reposition_bearing, m->rot[1]); fast_vec_add(pos, pos, v); m->rot[2] = spring_turn(m->rot[2], fast_arc_tan(selected_target_position[0] - m->pos[0], selected_target_position[1] - m->pos[1]), - &d->f3D0, + &d->yaw_turn_spring_state, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 4.1887903f); - } else if (d->f3D8 > 0.0f) { - d->f3D8 -= frame_time_sq * 200.0f; - build_spherical_offset(v, d->f3D8, d->f3D4, m->rot[1]); + } else if (d->reposition_step > 0.0f) { + d->reposition_step -= frame_time_sq * 200.0f; + build_spherical_offset(v, d->reposition_step, d->reposition_bearing, m->rot[1]); fast_vec_add(pos, pos, v); m->rot[2] = spring_turn(m->rot[2], fast_arc_tan(selected_target_position[0] - m->pos[0], selected_target_position[1] - m->pos[1]), - &d->f3D0, + &d->yaw_turn_spring_state, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 4.1887903f); @@ -910,8 +910,8 @@ void woodcut_bot_update(WBMoby *m) { case WOODCUT_BOT_TURN_BEFORE_MOVEMENT: if (m->anim == 0x10 && (m->f70 & 2)) { if ((m->fBC & 0x10) || point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->f3DC]) + 4, - *((int *)l04_paths[d->f3DC])) == 0) { + ((int *)l04_paths[d->movement_path_index]) + 4, + *((int *)l04_paths[d->movement_path_index])) == 0) { m->state = WOODCUT_BOT_RETURN_TO_SAVED_POSITION; blend_moby_animation(m, 0, 0, scale_game_frames(10)); } else { @@ -921,8 +921,8 @@ void woodcut_bot_update(WBMoby *m) { m->fBC = (m->fBC | 8) & ~0x10; } else if (m->fBC & 0x10) { m->rot[2] = spring_turn(m->rot[2], - fast_arc_tan(d->f3B0[0] - m->pos[0], d->f3B0[1] - m->pos[1]), - &d->f3D0, + fast_arc_tan(d->initial_position[0] - m->pos[0], d->initial_position[1] - m->pos[1]), + &d->yaw_turn_spring_state, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 4.1887903f); @@ -930,7 +930,7 @@ void woodcut_bot_update(WBMoby *m) { m->rot[2] = spring_turn(m->rot[2], fast_arc_tan(selected_target_position[0] - m->pos[0], selected_target_position[1] - m->pos[1]), - &d->f3D0, + &d->yaw_turn_spring_state, 0.03f, 0.3f, frame_time * 6.4577184f); @@ -955,37 +955,37 @@ void woodcut_bot_update(WBMoby *m) { float recoil_scratch[16]; trooper_anim_finish(m, d->fB0); - if (d->f3E4 > 0.0f) { + if (d->recoil_horizontal_step > 0.0f) { struct Hero *h = &hero; recoil_scratch[0] = fast_cos(fast_arc_tan(m->pos[0] - h->motion.pos.f[0], m->pos[1] - h->motion.pos.f[1])) * - d->f3E4; + d->recoil_horizontal_step; recoil_scratch[1] = fast_sin(fast_arc_tan(m->pos[0] - h->motion.pos.f[0], m->pos[1] - h->motion.pos.f[1])) * - d->f3E4; + d->recoil_horizontal_step; recoil_scratch[2] = 0.0f; fast_vec_add(recoil_scratch, recoil_scratch, pos); - d->f3E4 += -2.0f / (scale_time(15.0f) * scale_time(15.0f)); + d->recoil_horizontal_step += -2.0f / (scale_time(15.0f) * scale_time(15.0f)); move_moby_xy_with_collision_constraints( m, pos, recoil_scratch, 1, 0.25f, 1.0f, 0.75f, 0.87266463f); } - d->f3C8 *= 0.96f; - build_axis_rotation_quaternion(recoil_scratch, 1, d->f3C8); - build_axis_rotation_quaternion(d->f130, 2, 0.0f); - multiply_quaternions(d->f130, d->f130, recoil_scratch); + d->recoil_tilt_angle *= 0.96f; + build_axis_rotation_quaternion(recoil_scratch, 1, d->recoil_tilt_angle); + build_axis_rotation_quaternion(d->recoil_rotation, 2, 0.0f); + multiply_quaternions(d->recoil_rotation, d->recoil_rotation, recoil_scratch); if (m->state != WOODCUT_BOT_HIT_RECOVERY_AND_REPOSITION) - d->f3C1 = m->state; + d->saved_non_recovery_state = m->state; if (m->state != WOODCUT_BOT_MOVE_TOWARD_TARGET && m->fBC != 6) { float g; - d->f3E0 += frame_time_sq * 9.8f; - m->pos[2] -= d->f3E0 - 2.0f; + d->vertical_fall_step += frame_time_sq * 9.8f; + m->pos[2] -= d->vertical_fall_step - 2.0f; g = probe_ground_height(pos, 0, 0.5f); m->pos[2] -= 2.0f; if (m->pos[2] < g) { m->pos[2] = g; - d->f3E0 = 0.0f; + d->vertical_fall_step = 0.0f; } if (m->pos[2] < 2.0f) { FUN_L00_00257470(m, 0, -1); From 171addc6803c07ece912c502a5a3708598d18d47 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:30:08 +0000 Subject: [PATCH 611/758] decomp: clarify names in blarg_ship_update f2C -> scale: Assigned retail 0x002e56cc loads ship+0x2c, 0x002e56dc multiplies it by a frame-scaled shrinking factor, 0x002e56ec writes it back, and 0x002e5700 compares it with 0.01 before removal. Checked directly called joint-position helper 0x00242240 loads the same ship+0x2c at 0x00242268, multiplies by 0.0009765625 at 0x00242274, then passes it as the scalar to fast_vec_scale at 0x00242288, scaling the joint matrix translation at sp+0x30. It transforms that scaled coordinate by ship+0xc0 at 0x00242298 and adds ship+0x10 position at 0x002422a8. This matches supplied moby_point_position context's moby->scale data flow and proves object scale rather than merely a departure timer. --- src/overlays/l10/mobys/blarg_ship.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l10/mobys/blarg_ship.c b/src/overlays/l10/mobys/blarg_ship.c index c2275809a6..5807ad2180 100644 --- a/src/overlays/l10/mobys/blarg_ship.c +++ b/src/overlays/l10/mobys/blarg_ship.c @@ -71,7 +71,7 @@ typedef struct Ship_5E48 { char p21[3]; char *p24; char p28[4]; - float f2C; + float scale; char p30; unsigned char b31; short s32; @@ -394,10 +394,10 @@ void blarg_ship_update(Ship_5E48 *ship) { break; case BLARG_SHIP_STATE_FLY_AWAY: ship->pos.z += D_0015ED6C * 10.0f; - ship->f2C *= frame_scale * -0.015299976f + 1.0f; + ship->scale *= frame_scale * -0.015299976f + 1.0f; if (250.0f < ship->pos.z) goto del; - if (!(ship->f2C < 0.01f)) + if (!(ship->scale < 0.01f)) break; goto del; case BLARG_SHIP_STATE_HIT_REACTION: { From 47b2812630661cab5eff349eb8751c6cb56bbcb6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:30:11 +0000 Subject: [PATCH 612/758] decomp: clarify names in suckcannon_update unk20AC -> suck_cannon_use_blocked: Assigned retail establishes hero base 0x0013F350 at 0x002da984. Its byte +0x20AC is loaded at 0x002da9e4 and a nonzero value skips empty-cannon suction startup; 0x002dab18-0x002dab1c cancels suction startup on nonzero, and 0x002dacbc-0x002dacc0 exits active suction. At 0x002daec4-0x002daec8 it suppresses first-person targeting/reticle updates, and 0x002db0d4-0x002db0d8 prevents loaded-cannon firing before start_equipped_item_animation. Authoritative SuckHero.unk20AC uses and original Ghidra cRam001413fc agree, proving a Suck Cannon use-blocking gate without assuming its broader hero identity. --- src/overlays/shared/weapons/suckcannon.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 473e7c1b17..c8ef85ec28 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -211,7 +211,7 @@ typedef struct SuckHero { u8 pad2090[0x17]; u8 item_select_blocked; u8 pad20A8[0x4]; - u8 unk20AC; + u8 suck_cannon_use_blocked; } SuckHero; typedef struct SuckInput { @@ -1471,7 +1471,7 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { break; } if ((controller_state.held & ((SuckHero *)&hero)->fire_buttons) && cannon->cooldown == 0 && - ((SuckHero *)&hero)->item_select_blocked == 0 && ((SuckHero *)&hero)->unk20AC == 0 && + ((SuckHero *)&hero)->item_select_blocked == 0 && ((SuckHero *)&hero)->suck_cannon_use_blocked == 0 && scale_game_frames(15) < ((SuckHero *)&hero)->ready_frames && is_suck_cannon_suction_blocked_by_hero_state() == 0) { start_equipped_item_animation(); @@ -1489,7 +1489,7 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { case SUCKCANNON_STATE_SUCTION_STARTUP: if (suck_cannon_moby->anim_flags & 2) blend_moby_animation(suck_cannon_moby, 3, 0, scale_game_frames(5)); - if (is_suck_cannon_suction_blocked_by_hero_state() != 0 || ((SuckHero *)&hero)->unk20AC || + if (is_suck_cannon_suction_blocked_by_hero_state() != 0 || ((SuckHero *)&hero)->suck_cannon_use_blocked || ((SuckHero *)&hero)->item_select_blocked) { sound = cannon->sound; if (sound != -1) { @@ -1525,7 +1525,7 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { (((SuckHero *)&hero)->count < (item_text_variant[9] == 0 ? 5 : 10) && is_suck_cannon_suction_blocked_by_hero_state() == 0 && ((controller_state.held & ((SuckHero *)&hero)->fire_buttons) || cannon->cooldown) && - !((SuckHero *)&hero)->unk20AC && !((SuckHero *)&hero)->item_select_blocked))) { + !((SuckHero *)&hero)->suck_cannon_use_blocked && !((SuckHero *)&hero)->item_select_blocked))) { cancel_hero_item_animation(); sound = cannon->sound; if (sound != -1) { @@ -1570,7 +1570,7 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { if (((SuckHero *)&hero)->state == 1) hero_set_state(30, 1); if (((SuckHero *)&hero)->state == 30 && (((SuckHero *)&hero)->moby->flags & 1) && - !((SuckHero *)&hero)->unk20AC) { + !((SuckHero *)&hero)->suck_cannon_use_blocked) { LevelCamera *camera = &l00_camera; SuckVec *eye; SuckHit *hit; @@ -1612,7 +1612,7 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { (controller_state.held & ((SuckHero *)&hero)->fire_buttons) && ((SuckHero *)&hero)->control_mode != 7 && ((SuckHero *)&hero)->control_mode != 3 && ((SuckHero *)&hero)->control_mode != 18 && ((SuckHero *)&hero)->control_mode != 17 && - !((SuckHero *)&hero)->unk20AC && !((SuckHero *)&hero)->item_select_blocked && + !((SuckHero *)&hero)->suck_cannon_use_blocked && !((SuckHero *)&hero)->item_select_blocked && scale_game_frames(22) < ((SuckHero *)&hero)->ready_frames) { start_equipped_item_animation(); blend_moby_animation(suck_cannon_moby, 5, 0, scale_game_frames(2)); From f58df853eb67557bccf6a2aa084987573d364fab Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:32:03 +0000 Subject: [PATCH 613/758] decomp: clarify names in circular_saw_enemy_update f120 -> home_position: Retail 002c29a8-002c29c0 copies moby position into this aligned vector. Source and original Ghidra 002c2de0-002c2e30 use it as the chase return destination, and 002c3e24-002c3e40 compare its Z against the fall-removal threshold. f130 -> yaw_turn_step: Source passes this float by address to the spring-turn helper for chase, path and point alignment; retail 002c30b8/002c3154, 002c33b0-002c33cc and 002c36a4-002c36b8 agree. Supplied spring_turn context updates the pointed angular increment and adds it to moby yaw; 002c34e8 clears it after attack. f136 -> alert_range_timer: Retail 002c25b4-002c25bc loads this short with scaled 240 frames after a hit; 002c26d4-002c26f4 refreshes and decrements it. At 002c22cc-002c22dc its nonzero state enables doubled target range and boundary bypass, matching source alert flag consumers. f138 -> movement_boundary_path_index: Source and original Ghidra index l04_paths with this int, with -1 disabling containment. Retail 002c2a28-002c2a64 rejects wander movement outside its XY polygon; 002c3b60-002c3b9c similarly gates committed chase movement and target acquisition checks use the same polygon. f13C -> knockback_move_step: Retail 002c2668 stores positive recoil magnitude after a hit. At 002c3794-002c37f0 cosine/sine of facing plus pi multiply this float to form backward displacement, and 002c3808-002c385c decay it before collision-constrained movement, matching authoritative C. f140 -> target_detection_range: Retail 002c2348-002c235c passes this float, doubled while alerted, to select_moby_combat_target. Source and original Ghidra repeatedly compare selected target distance against the same range for idle/path-to-chase acquisition at 002c2aa4-002c2ad0 and related gates. f144 -> movement_animation_change_timer: Source and original Ghidra use this short only to throttle chase movement animation changes. Retail 002c3ba4-002c3be8 decrements it, checks the chosen animation differs, blends that animation, and resets the timer to scaled 15 frames; initialization clears it. f146 -> action_timer: Retail 002c28c8-002c28cc decrements this short each update. Source and original Ghidra use zero to gate chase/melee/point attacks, load scaled 60 frames on attack or alert, 120 on melee completion (002c365c-002c3664), and 240 on point-attack completion (002c35d4-002c35e4); this is a shared action timer. f14C -> movement_direction_index: Retail 002c3a64-002c3a80 quantizes relative yaw into this byte and indexes the {1,4,2,3} movement-animation table. 002c3a84-002c3ad0 converts it into quarter-turn yaw for XY movement. Source and original Ghidra agree that it selects movement direction relative to facing. f14D -> hit_reaction_cooldown_timer: Retail 002c2430-002c2434 decrements this byte through the byte-timer helper; 002c249c-002c24a0 suppresses further hit response while nonzero. Recovery setup stores scaled 20 frames at 002c26b4 and 002c26c8, matching the source hit-processing cooldown gate. f14E -> combat_history_flags: Retail 002c2b18-002c2b54 tests/sets bit 0 to play alert animation only once; 002c3670-002c3678 sets bit 1 after melee completion. Source and original Ghidra show a ushort preserving these combat-event flags rather than an index or timer; meanings of additional bits are not asserted. f150 -> patrol_path_index: Retail 002c29d4-002c29f8 selects idle for -1 and FOLLOW_PATH otherwise. 002c2e3c-002c2e50 and 002c316c-002c318c index l04_paths by this int; source then traverses that path's points and uses the same path to resume after point attack. f15A -> point_attack_phase: Retail 002c2fcc initializes this short to 0 on entering POINT_ATTACK. 002c3334-002c3360 dispatches it; 002c3458 advances to 1 after position/yaw alignment, 002c34f0 advances to 2 on attack completion, and phase 2 turns toward the patrol path before restoring FOLLOW_PATH, matching source enums. f160 -> point_attack_cuboid_indices: Retail 002c30b0-002c30fc scans four ints, skips -1, and tests moby position against each clip volume. 002c2fb8-002c2fcc copies the selected index to f158 and enters POINT_ATTACK; 002c3374-002c33cc uses that selected cuboid's position and yaw. Source identifies the records as l04_cuboids. f1E8 -> suck_cannon_phase: Assigned retail 002c3768 clears this short after the suck-cannon helper completes. Source record getter returns pvars+0x180, placing this at record+0x68. Checked helper evidence e644a3ea32dc4b7eb79ff24a677300fd at 002dedf0-002dee24 dispatches that short and 002deef4/002df960 changes phases; individual phase meanings remain unasserted. f1F0 -> suck_cannon_config: Retail 002c29cc-002c29dc installs the supplied suck-cannon configuration header pointer. The source record getter maps this to record+0x70; checked helper e644a3ea32dc4b7eb79ff24a677300fd loads that pointer at 002df38c and 002df918 and reads configuration bytes +4/+6 to select animations at 002df3b4/002df940. f238 -> engine_sound_voice_handle: Retail 002c2874-002c28bc reads this int, skips -1, indexes the voice pool by 0x70, checks ownership and active state, releases the voice, and stores -1. Supplied engine-sound C identifies pvars+0x238 as its allocated engine voice; original retail Ghidra agrees. f254 -> wander_move_step: Assigned retail 002c29b4 stores frame_time*2 here and 002c2a24 passes pvars+0x240 to wander movement. Checked helper b1e51dd16a8348ebabba383fcc93e060 at 00254400-00254458 multiplies record+0x14 (this member) by facing cosine/sine, adds position, and passes the proposed position to collision-constrained movement. f258 -> wander_turn_step: Assigned retail 002c29b8 stores frame_time*2.9670596 here; 002c2a24 passes the containing wander record at pvars+0x240. Checked helper b1e51dd16a8348ebabba383fcc93e060 at 002543c8-002543d8 supplies record+0x18 with target heading record+0x24 and the address of moby yaw to the rotation update helper. f25C -> wander_radius: Assigned retail 002c29b0 initializes this float to 2.0 in the wander record passed at 002c2a24. Checked helper b1e51dd16a8348ebabba383fcc93e060 computes distance from moby to the record's anchor at 00254478-00254480, compares it with record+0x1c at 0025448c-00254498, and selects a heading back toward the anchor when exceeded. f38 -> alert_range_refresh_trigger: Retail 002c22c0-002c22dc uses this int as a boolean enabling expanded target range; 002c26d4-002c26ec refreshes the alert-range timer to scaled 240 frames when it is nonzero and then clears it. Source and original Ghidra prove a consumed alert-range refresh trigger; producer identity is not asserted. f78 -> downward_move_step: Retail 002c2c78-002c2c9c initializes this float negatively for a jump. 002c3dcc-002c3dfc adds frame_time_sq*9.8 then subtracts the accumulated step from Z (with temporary ground-probe offset); 002c3e1c-002c3e20 clamps to ground and clears it. Source and original Ghidra agree; physical velocity units are not asserted. --- src/overlays/l04/mobys/circular_saw_enemy.c | 296 ++++++++++---------- 1 file changed, 148 insertions(+), 148 deletions(-) diff --git a/src/overlays/l04/mobys/circular_saw_enemy.c b/src/overlays/l04/mobys/circular_saw_enemy.c index 837edac348..eb5250b3fe 100644 --- a/src/overlays/l04/mobys/circular_saw_enemy.c +++ b/src/overlays/l04/mobys/circular_saw_enemy.c @@ -330,7 +330,7 @@ typedef struct D_35F0 { char pad2F; float f30; char pad34[4]; - int f38; + int alert_range_refresh_trigger; char pad3C[0x1C]; unsigned char f58; char pad59; @@ -341,7 +341,7 @@ typedef struct D_35F0 { float f68; float f6C; char pad70[8]; - float f78; + float downward_move_step; char pad7C[8]; float f84; char pad88[0x10]; @@ -359,37 +359,37 @@ typedef struct D_35F0 { char padE8[0x15]; unsigned char fFD; char padFE[0x22]; - V4_35F0 f120; - float f130; + V4_35F0 home_position; + float yaw_turn_step; char pad134[2]; - short f136; - int f138; - float f13C; - float f140; - short f144; - short f146; + short alert_range_timer; + int movement_boundary_path_index; + float knockback_move_step; + float target_detection_range; + short movement_animation_change_timer; + short action_timer; char pad148[4]; - unsigned char f14C; - unsigned char f14D; - unsigned short f14E; - int f150; + unsigned char movement_direction_index; + unsigned char hit_reaction_cooldown_timer; + unsigned short combat_history_flags; + int patrol_path_index; int f154; short f158; - short f15A; + short point_attack_phase; char pad15C[4]; - int f160[4]; + int point_attack_cuboid_indices[4]; char pad170[0x78]; - short f1E8; + short suck_cannon_phase; char pad1EA[6]; - short *f1F0; + short *suck_cannon_config; char pad1F4[0x44]; - int f238; + int engine_sound_voice_handle; char pad23C[4]; V4_35F0 f240; char pad250[4]; - float f254; - float f258; - float f25C; + float wander_move_step; + float wander_turn_step; + float wander_radius; char pad260[0x10]; unsigned char f270[4]; } D_35F0; @@ -524,7 +524,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { float target_distance; float ta; - if (data->f38 != 0 || data->f136 != 0) { + if (data->alert_range_refresh_trigger != 0 || data->alert_range_timer != 0) { flag = 1; } FUN_L00_00263ac8(2.9f, (int)moby, 7, data->f270); @@ -534,7 +534,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { moby->f7F = 0x15; } } - select_moby_combat_target((char *)moby, (float *)&tg, flag ? data->f140 * 2.0f : data->f140); + select_moby_combat_target((char *)moby, (float *)&tg, flag ? data->target_detection_range * 2.0f : data->target_detection_range); target_moby = tg.f40; hd = compute_interpolated_record_value(moby); target_distance = vector_distance_xy(moby->pos, (float *)&tg); @@ -546,11 +546,11 @@ void circular_saw_enemy_update(M_35F0 *moby) { H_35F0 *h = (H_35F0 *)(((char *)((char *)&hero))); if (h->f240 == moby || fast_vec_dist(moby->pos, h->pos) < 1.5f) { blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10)); - data->f146 = scale_game_frames(0x3C); + data->action_timer = scale_game_frames(0x3C); moby->state = CIRCULAR_SAW_STATE_MELEE_ATTACK; } } - FUN_L00_001fefc8(&data->f14D); + FUN_L00_001fefc8(&data->hit_reaction_cooldown_timer); if (moby->state != CIRCULAR_SAW_STATE_DYING && moby->state != CIRCULAR_SAW_STATE_INITIALIZE) { int unused_hit_reaction_output; float dmg; @@ -561,7 +561,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { dmg = 0.0f; hit = find_moby_hit(moby, 0x210000, 0); r = hit_reaction(moby, hit, &data->hp, 0, &unused_hit_reaction_output, &dmg, 0, 4); - if (hit != 0 && moby->state != CIRCULAR_SAW_STATE_INITIALIZE && data->f14D == 0) { + if (hit != 0 && moby->state != CIRCULAR_SAW_STATE_INITIALIZE && data->hit_reaction_cooldown_timer == 0) { if (hit->att != 0) { struct Hero *h = &hero; if (hit->att != h->items[0].moby) { @@ -589,7 +589,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { if (data->hp <= 0.0f) { r = 1; } - data->f136 = scale_game_frames(0xF0); + data->alert_range_timer = scale_game_frames(0xF0); switch (r) { case CIRCULAR_SAW_HIT_REACTION_NONE: break; @@ -604,18 +604,18 @@ void circular_saw_enemy_update(M_35F0 *moby) { case CIRCULAR_SAW_HIT_REACTION_RECOIL_RECOVERY: blend_moby_animation(moby, (void *)8, 0, (void *)scale_game_frames(5)); if (hit->att->cls.s == 0x131 || hit->att->cls.s == 0xB0) { - data->f13C = 10.0f / scale_time(15.0f) * 0.5f; + data->knockback_move_step = 10.0f / scale_time(15.0f) * 0.5f; } else { - data->f13C = 10.0f / scale_time(15.0f); + data->knockback_move_step = 10.0f / scale_time(15.0f); } moby->state = CIRCULAR_SAW_STATE_HIT_RECOVERY; moby->rot = fast_add_rotations(3.1415927f, ang); data->fB7 = 0x78; trooper_anim_update(moby, (short *)data->fB0); - data->f14D = scale_game_frames(0x14); + data->hit_reaction_cooldown_timer = scale_game_frames(0x14); data->fB7 = 0x78; trooper_anim_update(moby, (short *)data->fB0); - data->f14D = scale_game_frames(0x14); + data->hit_reaction_cooldown_timer = scale_game_frames(0x14); break; case CIRCULAR_SAW_HIT_REACTION_IGNORED: case CIRCULAR_SAW_HIT_REACTION_NO_ADDITIONAL_REACTION: @@ -627,11 +627,11 @@ void circular_saw_enemy_update(M_35F0 *moby) { } } moby->fA4 = 0xFF; - if (data->f38 != 0) { - data->f136 = scale_game_frames(0xF0); + if (data->alert_range_refresh_trigger != 0) { + data->alert_range_timer = scale_game_frames(0xF0); } - data->f38 = 0; - fast_dec_timer_s16(&data->f136); + data->alert_range_refresh_trigger = 0; + fast_dec_timer_s16(&data->alert_range_timer); if (moby->state == CIRCULAR_SAW_STATE_MELEE_ATTACK && moby->f52 == 7 && hd > 15.0f && hd < 44.0f) { int i; @@ -650,14 +650,14 @@ void circular_saw_enemy_update(M_35F0 *moby) { melee_hit_parameters.f20 = 1; collect_mobies_in_sphere(jp, 0x10, moby, &melee_hit_parameters, 0.5f); if (coll_hit.moby == target_moby) { - data->f146 = - data->f146 < scale_game_frames(0x3C) ? data->f146 : scale_game_frames(0x3C); + data->action_timer = + data->action_timer < scale_game_frames(0x3C) ? data->action_timer : scale_game_frames(0x3C); } } } } if (moby->state != CIRCULAR_SAW_STATE_INITIALIZE && data->f2E != 1) { - int engine_voice_index = data->f238; + int engine_voice_index = data->engine_sound_voice_handle; if (engine_voice_index != -1) { char *e = (char *)((char *)&D_0013E550) + engine_voice_index * 0x70; if (*(M_35F0 **)(e + 0x88) == moby) { @@ -666,11 +666,11 @@ void circular_saw_enemy_update(M_35F0 *moby) { } } } - data->f238 = -1; + data->engine_sound_voice_handle = -1; mark_moby_for_removal(moby); return; } - fast_dec_timer_s16(&data->f146); + fast_dec_timer_s16(&data->action_timer); switch (moby->state) { case CIRCULAR_SAW_STATE_INITIALIZE: { float k; @@ -691,15 +691,15 @@ void circular_saw_enemy_update(M_35F0 *moby) { data->f64 = 1.0f; data->f98 = 4; qcopy(data->f240, moby->pos); - data->f25C = 2.0f; - data->f254 = k * 2.0f; - data->f258 = k * 2.9670596f; - qcopy(data->f120, moby->pos); - data->f146 = scale_game_frames(0x3C); - data->f1F0 = &l04_circular_saw_suck_cannon_config_header; - data->f136 = 0; - data->f144 = 0; - if (data->f150 == -1) { + data->wander_radius = 2.0f; + data->wander_move_step = k * 2.0f; + data->wander_turn_step = k * 2.9670596f; + qcopy(data->home_position, moby->pos); + data->action_timer = scale_game_frames(0x3C); + data->suck_cannon_config = &l04_circular_saw_suck_cannon_config_header; + data->alert_range_timer = 0; + data->movement_animation_change_timer = 0; + if (data->patrol_path_index == -1) { moby->state = CIRCULAR_SAW_STATE_IDLE; } else { moby->state = CIRCULAR_SAW_STATE_FOLLOW_PATH; @@ -711,38 +711,38 @@ void circular_saw_enemy_update(M_35F0 *moby) { { qcopy(save, moby->pos); update_object_wander_movement((char *)moby, (char *)data->f240, 0.35f, 0.25f); - if (data->f138 != -1) { + if (data->movement_boundary_path_index != -1) { if (point_in_path_xy(moby->pos, - ((P_35F0 *)l04_paths[data->f138])->pts, - ((P_35F0 *)l04_paths[data->f138])->count) == 0) { + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { qcopy(moby->pos, save); } } if (moby->f52 != 0 && (moby->f70 & 2)) { blend_moby_animation(moby, 0, 0, (void *)scale_game_frames(5)); } - if (flag ? target_distance < data->f140 * 2.0f : target_distance < data->f140) { - if (flag || data->f138 == -1 || + if (flag ? target_distance < data->target_detection_range * 2.0f : target_distance < data->target_detection_range) { + if (flag || data->movement_boundary_path_index == -1 || point_in_path_xy(&tg, - ((P_35F0 *)l04_paths[data->f138])->pts, - ((P_35F0 *)l04_paths[data->f138])->count) != 0) { - int nf = (data->f14E & 1) == 0; + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { + int nf = (data->combat_history_flags & 1) == 0; if (nf) { - data->f14E |= 1; + data->combat_history_flags |= 1; blend_moby_animation(moby, (void *)6, 0, (void *)scale_game_frames(10)); - data->f146 = scale_game_frames(0x3C); + data->action_timer = scale_game_frames(0x3C); } ta = fast_arc_tan(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); - if (target_distance < 2.0f && data->f146 == 0 && + if (target_distance < 2.0f && data->action_timer == 0 && check_circular_saw_melee_attack_spacing((char *)moby) != 0) { blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10)); - data->f146 = scale_game_frames(0x3C); + data->action_timer = scale_game_frames(0x3C); moby->state = CIRCULAR_SAW_STATE_MELEE_ATTACK; - } else if (flag ? target_distance < data->f140 * 2.0f - : target_distance < data->f140) { - if (data->f146 == 0) { + } else if (flag ? target_distance < data->target_detection_range * 2.0f + : target_distance < data->target_detection_range) { + if (data->action_timer == 0) { blend_moby_animation(moby, (void *)1, 0, (void *)scale_game_frames(10)); - data->f14C = 0; + data->movement_direction_index = 0; moby->state = CIRCULAR_SAW_STATE_CHASE_TARGET; } } @@ -754,67 +754,67 @@ void circular_saw_enemy_update(M_35F0 *moby) { case CIRCULAR_SAW_STATE_JUMP: if (moby->f53 != 5) { blend_moby_animation(moby, (void *)5, 0, (void *)scale_game_frames(5)); - data->f78 = -(frame_time * 7.668f); + data->downward_move_step = -(frame_time * 7.668f); } else if (moby->f70 & 2) { blend_moby_animation(moby, 0, 0, (void *)scale_game_frames(10)); moby->state = CIRCULAR_SAW_STATE_IDLE; } break; case CIRCULAR_SAW_STATE_CHASE_TARGET: - if ((flag ? target_distance < data->f140 * 2.0f : target_distance < data->f140) && - (flag || data->f138 == -1 || + if ((flag ? target_distance < data->target_detection_range * 2.0f : target_distance < data->target_detection_range) && + (flag || data->movement_boundary_path_index == -1 || point_in_path_xy(&tg, - ((P_35F0 *)l04_paths[data->f138])->pts, - ((P_35F0 *)l04_paths[data->f138])->count) != 0)) { + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0)) { rot = compute_circular_saw_flock_steering( - moby, dest, flag ? data->f140 * 2.0f : data->f140); - if (target_distance < 2.0f && data->f146 == 0 && + moby, dest, flag ? data->target_detection_range * 2.0f : data->target_detection_range); + if (target_distance < 2.0f && data->action_timer == 0 && check_circular_saw_melee_attack_spacing((char *)moby) != 0) { blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10)); - data->f146 = scale_game_frames(0x3C); + data->action_timer = scale_game_frames(0x3C); moby->state = CIRCULAR_SAW_STATE_MELEE_ATTACK; } } else if (flag == 0) { - qcopy(dest, data->f120); - if (vector_distance_xy(moby->pos, data->f120) < 1.0f) { + qcopy(dest, data->home_position); + if (vector_distance_xy(moby->pos, data->home_position) < 1.0f) { blend_moby_animation(moby, 0, 0, (void *)scale_game_frames(10)); moby->state = CIRCULAR_SAW_STATE_IDLE; } } func_L00_002592B0_b((char *)moby, rot, - &data->f130, + &data->yaw_turn_step, frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); break; case CIRCULAR_SAW_STATE_FOLLOW_PATH: { - P_35F0 *path = ((P_35F0 *)l04_paths[data->f150]); + P_35F0 *path = ((P_35F0 *)l04_paths[data->patrol_path_index]); int i; float *yaw_velocity; - if (flag ? target_distance < data->f140 * 2.0f : target_distance < data->f140) { - if (flag || data->f138 == -1 || + if (flag ? target_distance < data->target_detection_range * 2.0f : target_distance < data->target_detection_range) { + if (flag || data->movement_boundary_path_index == -1 || point_in_path_xy(&tg, - ((P_35F0 *)l04_paths[data->f138])->pts, - ((P_35F0 *)l04_paths[data->f138])->count) != 0) { - int nf = (data->f14E & 1) == 0; + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { + int nf = (data->combat_history_flags & 1) == 0; if (nf) { - data->f14E |= 1; + data->combat_history_flags |= 1; blend_moby_animation(moby, (void *)6, 0, (void *)scale_game_frames(10)); - data->f146 = scale_game_frames(0x3C); + data->action_timer = scale_game_frames(0x3C); } ta = fast_arc_tan(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); - if (target_distance < 2.0f && data->f146 == 0 && + if (target_distance < 2.0f && data->action_timer == 0 && check_circular_saw_melee_attack_spacing((char *)moby) != 0) { blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10)); - data->f146 = scale_game_frames(0x3C); + data->action_timer = scale_game_frames(0x3C); moby->state = CIRCULAR_SAW_STATE_MELEE_ATTACK; - } else if (flag ? target_distance < data->f140 * 2.0f - : target_distance < data->f140) { - if (data->f146 == 0) { + } else if (flag ? target_distance < data->target_detection_range * 2.0f + : target_distance < data->target_detection_range) { + if (data->action_timer == 0) { blend_moby_animation(moby, (void *)1, 0, (void *)scale_game_frames(10)); - data->f14C = 0; + data->movement_direction_index = 0; moby->state = CIRCULAR_SAW_STATE_CHASE_TARGET; } } @@ -831,13 +831,13 @@ void circular_saw_enemy_update(M_35F0 *moby) { } } i = 0; - yaw_velocity = &data->f130; + yaw_velocity = &data->yaw_turn_step; for (; i < 4; i++) { - if (data->f146 == 0 && data->f160[i] != -1 && - is_point_inside_clip_volume(moby->pos, data->f160[i]) != 0) { - data->f158 = data->f160[i]; + if (data->action_timer == 0 && data->point_attack_cuboid_indices[i] != -1 && + 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->f15A = 0; + data->point_attack_phase = 0; break; } } @@ -855,44 +855,44 @@ void circular_saw_enemy_update(M_35F0 *moby) { break; } case CIRCULAR_SAW_STATE_POINT_ATTACK: { - P_35F0 *path = ((P_35F0 *)l04_paths[data->f150]); + P_35F0 *path = ((P_35F0 *)l04_paths[data->patrol_path_index]); - if (flag ? target_distance < data->f140 * 2.0f : target_distance < data->f140) { - if (flag || data->f138 == -1 || + if (flag ? target_distance < data->target_detection_range * 2.0f : target_distance < data->target_detection_range) { + if (flag || data->movement_boundary_path_index == -1 || point_in_path_xy(&tg, - ((P_35F0 *)l04_paths[data->f138])->pts, - ((P_35F0 *)l04_paths[data->f138])->count) != 0) { - int nf = (data->f14E & 1) == 0; + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { + int nf = (data->combat_history_flags & 1) == 0; if (nf) { - data->f14E |= 1; + data->combat_history_flags |= 1; blend_moby_animation(moby, (void *)6, 0, (void *)scale_game_frames(10)); - data->f146 = scale_game_frames(0x3C); + data->action_timer = scale_game_frames(0x3C); } ta = fast_arc_tan(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); - if (target_distance < 2.0f && data->f146 == 0 && + if (target_distance < 2.0f && data->action_timer == 0 && check_circular_saw_melee_attack_spacing((char *)moby) != 0) { blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10)); - data->f146 = scale_game_frames(0x3C); + data->action_timer = scale_game_frames(0x3C); moby->state = CIRCULAR_SAW_STATE_MELEE_ATTACK; - data->f130 = 0.0f; - } else if (flag ? target_distance < data->f140 * 2.0f - : target_distance < data->f140) { - if (data->f146 == 0) { + data->yaw_turn_step = 0.0f; + } else if (flag ? target_distance < data->target_detection_range * 2.0f + : target_distance < data->target_detection_range) { + if (data->action_timer == 0) { blend_moby_animation(moby, (void *)1, 0, (void *)scale_game_frames(10)); - data->f14C = 0; + data->movement_direction_index = 0; moby->state = CIRCULAR_SAW_STATE_CHASE_TARGET; } } } } - switch (data->f15A) { + switch (data->point_attack_phase) { case CIRCULAR_SAW_POINT_ATTACK_APPROACH_AND_ALIGN: { LevelCuboid *e = l04_cuboids; int n = data->f158; qcopy(dest, &e[n].pos); func_L00_002592B0_b((char *)moby, e[n].rot.z, - &data->f130, + &data->yaw_turn_step, frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); @@ -902,7 +902,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->f15A = 1; + data->point_attack_phase = 1; } } break; @@ -913,8 +913,8 @@ void circular_saw_enemy_update(M_35F0 *moby) { blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10)); } else if (moby->f70 & 2) { blend_moby_animation(moby, 0, 0, (void *)scale_game_frames(10)); - data->f130 = 0.0f; - data->f15A = 2; + data->yaw_turn_step = 0.0f; + data->point_attack_phase = 2; } break; case CIRCULAR_SAW_POINT_ATTACK_TURN_TO_PATH: { @@ -923,7 +923,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { path->pts[data->f154][1] - moby->pos[1]); func_L00_002592B0_b((char *)moby, ta, - &data->f130, + &data->yaw_turn_step, frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); @@ -932,7 +932,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { fast_arc_tan(path->pts[data->f154][0] - moby->pos[0], path->pts[data->f154][1] - moby->pos[1])) < 0.17453292f) { moby->state = CIRCULAR_SAW_STATE_FOLLOW_PATH; - data->f146 = scale_game_frames(0xF0); + data->action_timer = scale_game_frames(0xF0); } break; } @@ -941,16 +941,16 @@ void circular_saw_enemy_update(M_35F0 *moby) { } case CIRCULAR_SAW_STATE_MELEE_ATTACK: rot = - compute_circular_saw_flock_steering(moby, dest, flag ? data->f140 * 2.0f : data->f140); - if (data->f146 == 0 && (hd > 44.0f || (moby->f70 & 2))) { + compute_circular_saw_flock_steering(moby, dest, flag ? data->target_detection_range * 2.0f : data->target_detection_range); + if (data->action_timer == 0 && (hd > 44.0f || (moby->f70 & 2))) { blend_moby_animation(moby, 0, 0, (void *)scale_game_frames(5)); - data->f146 = scale_game_frames(0x78); + data->action_timer = scale_game_frames(0x78); moby->state = CIRCULAR_SAW_STATE_IDLE; - data->f14E |= 2; + data->combat_history_flags |= 2; } func_L00_002592B0_b((char *)moby, rot, - &data->f130, + &data->yaw_turn_step, frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); @@ -960,7 +960,7 @@ void circular_saw_enemy_update(M_35F0 *moby) { (moby->f70 & 2)) { blend_moby_animation(moby, 0, 0, (void *)scale_game_frames(10)); moby->state = CIRCULAR_SAW_STATE_IDLE; - data->f146 = 0; + data->action_timer = 0; } break; case CIRCULAR_SAW_STATE_DYING: @@ -973,18 +973,18 @@ void circular_saw_enemy_update(M_35F0 *moby) { case CIRCULAR_SAW_STATE_SUCK_CANNON_CONTROLLED: if (FUN_L00_002dc9f0(moby, data->fC0) != 0) { moby->state = CIRCULAR_SAW_STATE_INITIALIZE; - data->f1E8 = 0; + data->suck_cannon_phase = 0; } break; } - if (data->f13C > 0.0f) { + if (data->knockback_move_step > 0.0f) { V4_35F0 v; { - v[0] = fast_cos(fast_add_rotations(moby->rot, 3.1415927f)) * data->f13C; - v[1] = fast_sin(fast_add_rotations(moby->rot, 3.1415927f)) * data->f13C; + v[0] = fast_cos(fast_add_rotations(moby->rot, 3.1415927f)) * data->knockback_move_step; + v[1] = fast_sin(fast_add_rotations(moby->rot, 3.1415927f)) * data->knockback_move_step; v[2] = 0.0f; fast_vec_add(v, v, moby->pos); - data->f13C += -10.0f / (scale_time(15.0f) * scale_time(15.0f)); + data->knockback_move_step += -10.0f / (scale_time(15.0f) * scale_time(15.0f)); move_moby_xy_with_collision_constraints( moby, moby->pos, v, 1, 0.25f, 0.57f, 0.5f, 0.5235988f); } @@ -1005,10 +1005,10 @@ void circular_saw_enemy_update(M_35F0 *moby) { fast_vec_add(v, v, moby->pos); qcopy(np, moby->pos); move_moby_xy_with_collision_constraints(moby, np, v, 0, 0.25f, 0.57f, 0.5f, 0.5235988f); - if (data->f138 == -1 || + if (data->movement_boundary_path_index == -1 || point_in_path_xy(np, - ((P_35F0 *)l04_paths[data->f138])->pts, - ((P_35F0 *)l04_paths[data->f138])->count) != 0) { + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { qcopy(moby->pos, np); } } @@ -1029,13 +1029,13 @@ void circular_saw_enemy_update(M_35F0 *moby) { } if (fast_difference_between_rotations( fast_normalize_angle(fast_normalize_angle( - convert_integer_to_float(data->f14C) * 1.5707964f)), + convert_integer_to_float(data->movement_direction_index) * 1.5707964f)), rel) > 1.7453293f) { - data->f14C = truncate_float_to_s32(biased_relative_yaw * 1.999f / 3.1415927f); - anim = movement_animation_by_direction.v[data->f14C]; + data->movement_direction_index = truncate_float_to_s32(biased_relative_yaw * 1.999f / 3.1415927f); + anim = movement_animation_by_direction.v[data->movement_direction_index]; } movement_relative_yaw = - fast_normalize_angle(convert_integer_to_float(data->f14C) * 1.5707964f); + fast_normalize_angle(convert_integer_to_float(data->movement_direction_index) * 1.5707964f); v[0] = fast_cos(fast_add_rotations(moby->rot, movement_relative_yaw)) * (frame_time * 3.0f); v[1] = fast_sin(fast_add_rotations(moby->rot, movement_relative_yaw)) * @@ -1049,10 +1049,10 @@ void circular_saw_enemy_update(M_35F0 *moby) { qcopy(np, moby->pos); moved = move_moby_xy_with_collision_constraints( moby, np, v, 0, 0.25f, 0.57f, 0.5f, 0.5235988f); - if (data->f138 == -1 || + if (data->movement_boundary_path_index == -1 || point_in_path_xy(np, - ((P_35F0 *)l04_paths[data->f138])->pts, - ((P_35F0 *)l04_paths[data->f138])->count) != 0) { + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { qcopy(moby->pos, np); if (moved == 0) { anim = 0; @@ -1060,9 +1060,9 @@ void circular_saw_enemy_update(M_35F0 *moby) { } else { anim = 0; } - if (fast_dec_timer_s16(&data->f144) != 0 && anim != moby->f53) { + if (fast_dec_timer_s16(&data->movement_animation_change_timer) != 0 && anim != moby->f53) { blend_moby_animation(moby, (void *)anim, 0, (void *)scale_game_frames(10)); - data->f144 = scale_game_frames(0xF); + data->movement_animation_change_timer = scale_game_frames(0xF); } } } else if (moby->state == CIRCULAR_SAW_STATE_POINT_ATTACK || @@ -1080,10 +1080,10 @@ void circular_saw_enemy_update(M_35F0 *moby) { qcopy(np, moby->pos); move_moby_xy_with_collision_constraints( moby, np, v, 0, 0.25f, 1.25f, 0.5f, 0.5235988f); - if (data->f138 == -1 || + if (data->movement_boundary_path_index == -1 || point_in_path_xy(np, - ((P_35F0 *)l04_paths[data->f138])->pts, - ((P_35F0 *)l04_paths[data->f138])->count) != 0) { + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { qcopy(moby->pos, np); } } @@ -1097,17 +1097,17 @@ void circular_saw_enemy_update(M_35F0 *moby) { moby, moby->pos, v, 0, 0.25f, 0.57f, 0.5f, 0.5235988f); } } - data->f78 += frame_time_sq * 9.8f; - moby->pos[2] -= data->f78 - 2.0f; + data->downward_move_step += frame_time_sq * 9.8f; + moby->pos[2] -= data->downward_move_step - 2.0f; { float g = probe_ground_height(moby->pos, 0, 0.5f); moby->pos[2] -= 2.0f; if (moby->pos[2] < g) { moby->pos[2] = g; - data->f78 = 0.0f; + data->downward_move_step = 0.0f; } } - if (moby->pos[2] < data->f120[2] - 5.0f) { + if (moby->pos[2] < data->home_position[2] - 5.0f) { spawn_circular_saw_destruction_effects((char *)moby); mark_moby_for_removal(moby); return; From b90ba533bb1463737aa9f514852d9195657ffcb4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:32:04 +0000 Subject: [PATCH 614/758] decomp: clarify names in drek_final_boss_robot_update domain_0_value_2 -> DREK_BOSS_CIRCLE_AND_FIRE_AT_HERO: Retail 0x002f2f3c saves 2 to pvars+0x39C after scene 0; 0x002f2df0-0x002f2dfc loads that byte into moby+0x20. Thus post_scene_resume_state belongs to the boss-state domain; established outer case 2 circles and fires at the hero. domain_10_value_13 -> DREK_BOSS_LAUNCH_FORWARD_WITH_LATERAL_OFFSET: Retail 0x002f4d80-0x002f4d90 stores completed outer state 13 to +0x350 before selecting again. Supplied selector reads +0x350 and rejects repeated candidate boss states. The enclosing state constructs forward plus lateral launch direction at 0x002f4c30-0x002f4c64. domain_11_value_16 -> DREK_BOSS_TARGET_RANDOM_ARENA_POINTS: Retail 0x002f4fa4-0x002f4fb8 stores completed outer state 16 into previous-action +0x350 before state 12. Supplied selector uses this field to exclude the same candidate boss state; established outer state 16 generates random arena targets. domain_12_value_17 -> DREK_BOSS_TARGET_SIDE_GROUND_POINTS: Retail 0x002f51cc-0x002f51dc stores 17 into previous-action +0x350 on completion of side-ground targeting and returns to state 12. Supplied selector reads the same field and excludes repeated boss-state candidates. domain_13_value_19 -> DREK_BOSS_FOLLOW_HERO: Retail 0x002f5418-0x002f5454 exits hero-follow state, releases its voice, enters selection and records 19 at +0x350. Supplied action selector reads +0x350 to reject repeated boss states, proving established FOLLOW_HERO. domain_14_value_4 -> DREK_BOSS_PHASE_BEFORE_MISSILE_GROUP: Retail 0x002f5644-0x002f5660 compares encounter phase +0x34C to 4 and uniquely enters missile activation state 20, then increments the phase. This is the same selector and behavior as existing local BEFORE_MISSILE_GROUP case 4. domain_15_value_7 -> DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM: Retail 0x002f5954-0x002f5980 compares encounter phase +0x34C below 7, starts scene 3 and assigns 7. Phase 7 at 0x002f59cc-0x002f5a60 waits on the ending grounded-platform condition and delay before scene 4. domain_16_value_7 -> DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM: Retail 0x002f5964-0x002f5980 starts scene 3 then stores phase 7. After scene wait resumes ending state 27, the phase-7 handler at 0x002f59cc-0x002f5a60 waits for the ending platform condition before scene 4. domain_17_value_27 -> DREK_BOSS_RUN_ENDING_SEQUENCE: Retail 0x002f59bc-0x002f59c8 enters scene-wait state 7 and saves 27 at +0x39C. Retail 0x002f2df0-0x002f2dfc restores +0x39C into boss state +0x20, so this resumes established RUN_ENDING_SEQUENCE after scene 3. domain_18_value_7 -> DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM: Retail 0x002f59cc selects encounter phase 7; 0x002f59dc-0x002f5a24 checks grounded hero on class 0x247 in hero state 0x22, and 0x002f5a44-0x002f5a60 delays then starts scene 4. It is an encounter stage, not hero state 7. domain_19_value_8 -> DREK_BOSS_PHASE_MOUNT_JET_AND_START_SCENE_5: Retail 0x002f5a5c-0x002f5a7c starts scene 4, stores phase 8 and saves ending-state resume. Phase 8 at 0x002f5a80-0x002f5b0c mounts the jet using explicit position/rotation, starts scene 5 and advances phase. domain_1_value_1 -> DREK_BOSS_PHASE_SECOND_ARENA_PATH: Retail 0x002f3140 stores 1 to phase +0x34C while 0x002f3154-0x002f3184 selects f260[1] path and f250[1] arena node. This is the same encounter_phase dispatched by the existing local phase enum, proving SECOND_ARENA_PATH. domain_20_value_27 -> DREK_BOSS_RUN_ENDING_SEQUENCE: Retail 0x002f5a68-0x002f5a7c enters scene-wait state 7 and saves 27 at +0x39C after scene 4. Retail 0x002f2df0-0x002f2dfc copies this resume field into moby state, returning to established RUN_ENDING_SEQUENCE. domain_21_value_8 -> DREK_BOSS_PHASE_MOUNT_JET_AND_START_SCENE_5: Retail 0x002f5a80 dispatches phase 8, 0x002f5ad8-0x002f5af8 builds jet mount position/rotation and calls jet_mount, then 0x002f5afc-0x002f5b0c starts scene 5 and advances phase to 9. Bound C and original Ghidra agree. domain_22_value_9 -> DREK_BOSS_PHASE_WAIT_TO_START_SLIDESHOW: Retail 0x002f5afc-0x002f5b0c stores phase 9 after starting scene 5. Retail 0x002f5b10-0x002f5b38 waits for scene mode zero in phase 9, calls established start_slideshow, then stores phase 10. domain_23_value_9 -> DREK_BOSS_PHASE_WAIT_TO_START_SLIDESHOW: Retail 0x002f5b10-0x002f5b38 tests phase 9 and scene mode zero, calls start_slideshow and advances to 10. This proves a slideshow-start wait stage in encounter_phase, separate from all moby/hero-state domains. domain_24_value_10 -> DREK_BOSS_PHASE_WAIT_TO_QUEUE_ENDING_MOVIE: Retail 0x002f5b28-0x002f5b38 stores phase 10 after start_slideshow. Retail 0x002f5b3c-0x002f5b68 tests that phase with scene mode zero, queues movie 11 through queue_movie_with_game_language and advances phase. domain_25_value_11 -> DREK_BOSS_PHASE_WAIT_FOR_ENDING_CLEANUP: Retail 0x002f5b58-0x002f5b68 queues movie 11 and stores encounter phase 11. Retail 0x002f5b6c-0x002f5ba8 gates on this phase and a zero global, clears encounter latches, pauses sounds and removes boss attachments and boss. No meaning for the gating global is asserted. domain_26_value_1 -> DREK_BOSS_PHASE_SECOND_ARENA_PATH: Retail 0x002f5c34-0x002f5c48 gates hero.grind_look_moby assignment on encounter phase +0x34C greater than 1. The exact same selector's value 1 is proved by path f260[1] and node f250[1] setup at 0x002f3140-0x002f3184, matching the existing phase constant. domain_2_value_7 -> DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM: Retail 0x002f3224-0x002f3240 enters ending state 27 and phase 7. The same phase 7 branch at 0x002f59cc-0x002f5a60 waits for grounded hero on class 0x247 with state 0x22, then a scaled delay before scene 4. This names the ending platform wait stage without claiming scene 3 ran. domain_3_value_2 -> DREK_BOSS_PHASE_THIRD_ARENA_PATH: Retail 0x002f3270 stores phase 2; 0x002f3284-0x002f32b8 selects f260[2] path and f250[2] node. The same +0x34C selector uses the existing local THIRD_ARENA_PATH member. domain_4_value_10 -> DREK_BOSS_FOLLOW_PATH_AND_FIRE_AT_MOBYS: Retail 0x002f3408 saves 10 to resume field +0x39C after scene 1. Retail 0x002f2df0-0x002f2dfc copies it into boss state +0x20; established outer case 10 follows the path and fires at selected mobys. domain_5_value_1 -> DREK_BOSS_PHASE_SECOND_ARENA_PATH: Retail 0x002f38bc-0x002f38c8 compares the same +0x34C phase to 1 to choose the first platform-index array. The phase-1 assignment at 0x002f3140 associates this selector with second arena path f260[1], matching the existing local phase enum. domain_6_value_2 -> DREK_BOSS_PHASE_THIRD_ARENA_PATH: Retail 0x002f3cd8-0x002f3cf0 compares +0x34C with 2 after path completion to choose scene/selected-moby handling. This is the identical phase selector assigned alongside f260[2]/f250[2] at 0x002f3270-0x002f32b8, matching THIRD_ARENA_PATH. domain_7_value_5 -> DREK_BOSS_INITIALIZE_PAIRED_TRANSFORM_TRANSITION: Retail 0x002f3d60-0x002f3d6c saves 5 to +0x39C before scene 2. Resume at 0x002f2df0-0x002f2dfc copies this field into boss state. Established outer case 5 builds paired transition vectors and initializes the transition. domain_8_value_14 -> DREK_BOSS_ACTION_REPOSITION_AND_AIM: Retail 0x002f4664-0x002f4674 records completed state 14 at +0x350 before entering selection state 12. Supplied select_drek_boss_next_action reads this same field and rejects an equal candidate boss state; enclosing outer case is established REPOSITION_AND_AIM. domain_9_value_15 -> DREK_BOSS_TARGET_GROUND_POINTS: Retail 0x002f4a6c-0x002f4ac4 routes completion of outer state 15 to 0x002f4fb0, storing 15 at previous-action +0x350. Supplied selector compares its candidate boss states to +0x350, proving reuse of established TARGET_GROUND_POINTS. --- .../l18/mobys/drek_final_boss_robot.c | 61 +++++++++++-------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/src/overlays/l18/mobys/drek_final_boss_robot.c b/src/overlays/l18/mobys/drek_final_boss_robot.c index a2f9d0038f..306357325c 100644 --- a/src/overlays/l18/mobys/drek_final_boss_robot.c +++ b/src/overlays/l18/mobys/drek_final_boss_robot.c @@ -437,6 +437,13 @@ void drek_final_boss_robot_update(BossMoby *moby) { DREK_BOSS_PHASE_BEFORE_MISSILE_GROUP = 4, DREK_BOSS_PHASE_AFTER_MISSILE_GROUP_START = 5 }; + enum { + DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM = 7, + DREK_BOSS_PHASE_MOUNT_JET_AND_START_SCENE_5 = 8, + DREK_BOSS_PHASE_WAIT_TO_START_SLIDESHOW = 9, + DREK_BOSS_PHASE_WAIT_TO_QUEUE_ENDING_MOVIE = 10, + DREK_BOSS_PHASE_WAIT_FOR_ENDING_CLEANUP = 0xB + }; BossData *boss_data = (BossData *)moby->boss_private_data; BossMoby *aim_target_moby; float position_and_displacement_scratch[4]; @@ -530,7 +537,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { moby->f20 = 7; moby->f34 |= 0x41; start_scene(0); - boss_data->post_scene_resume_state = 2; + boss_data->post_scene_resume_state = DREK_BOSS_CIRCLE_AND_FIRE_AT_HERO; boss_data->action_frame_counter = scale_game_frames(600); boss_data->arena_center_node_index = boss_data->f250[3]; if (moby->animation_sequence_index != 10) { @@ -568,7 +575,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { D_L18_001600EC + (boss_data->f250[1] << 7) + 0x30) < 50.0f) { moby->f34 &= 0xFFBE; moby->collision_data = moby->f24[4]; - boss_data->encounter_phase = 1; + boss_data->encounter_phase = DREK_BOSS_PHASE_SECOND_ARENA_PATH; boss_data->boss_health = boss_data->boss_health * 0.71428573f; moby->f20 = 0xC; { @@ -595,11 +602,11 @@ void drek_final_boss_robot_update(BossMoby *moby) { moby->f20 = 0x1B; moby->collision_data = 0; moby->f34 |= 0x41; - boss_data->encounter_phase = 7; + boss_data->encounter_phase = DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM; } else { moby->f34 &= 0xFFBE; moby->collision_data = moby->f24[4]; - boss_data->encounter_phase = 2; + boss_data->encounter_phase = DREK_BOSS_PHASE_THIRD_ARENA_PATH; boss_data->boss_health = boss_data->boss_health * 0.5714286f; moby->f20 = 0xC; { @@ -643,7 +650,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { if (moby->animation_sequence_index != 10) { blend_moby_animation(moby, 10, 0, scale_game_frames(0x14)); } - boss_data->post_scene_resume_state = 10; + boss_data->post_scene_resume_state = DREK_BOSS_FOLLOW_PATH_AND_FIRE_AT_MOBYS; boss_data->path_point_index = 0; boss_data->movement_step_distance = 0.0f; { @@ -754,7 +761,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { moby->f20 = 10; } for (i = 0; i < 4; i++) { - int k = boss_data->encounter_phase == 1 ? boss_data->f230[i] : boss_data->alternate_platform_activation_moby_indices[i]; + int k = boss_data->encounter_phase == DREK_BOSS_PHASE_SECOND_ARENA_PATH ? boss_data->f230[i] : boss_data->alternate_platform_activation_moby_indices[i]; activate_drek_boss_class_0565_moby(D_L18_0015FFD8 + k * 0x100); } @@ -856,7 +863,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->movement_step_distance = 0.0f; qcopy(boss_data->unbobbed_boss_position, (char *)p + *p * 16); boss_data->arena_center_node_index = boss_data->f250[boss_data->encounter_phase]; - if (boss_data->encounter_phase == 2) { + if (boss_data->encounter_phase == DREK_BOSS_PHASE_THIRD_ARENA_PATH) { if (*(int *)&l18_drek_boss_scene_2_started_gp == 0) { moby->f20 = 4; } else { @@ -876,7 +883,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { *(int *)&l18_drek_boss_scene_2_started_gp = 1; moby->f20 = 7; - boss_data->post_scene_resume_state = 5; + boss_data->post_scene_resume_state = DREK_BOSS_INITIALIZE_PAIRED_TRANSFORM_TRANSITION; boss_data->selected_class_247_moby = (BossMoby *)find_nearest_class_247_moby_in_list(hero.motion.pos.f, boss_data->class_247_group_index); moby->f34 |= 0x41; @@ -1115,7 +1122,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { 1.0f); boss_data->pending_electric_ball_moby = 0; if (boss_data->action_frame_counter == 0) { - boss_data->previous_action_state = 0xE; + boss_data->previous_action_state = DREK_BOSS_ACTION_REPOSITION_AND_AIM; moby->f20 = 0xC; } } else { @@ -1225,7 +1232,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { } if (fast_dec_timer(&boss_data->action_frame_counter) != 0 || (boss_data->rail_mode_damage_accumulated > 25.0f && (float)boss_data->encounter_phase < 4.0f)) { - boss_data->previous_action_state = 0xF; + boss_data->previous_action_state = DREK_BOSS_TARGET_GROUND_POINTS; moby->f20 = 0xC; } break; @@ -1287,7 +1294,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { } } if (fast_dec_timer(&boss_data->action_frame_counter) != 0 && fast_dec_timer(&boss_data->secondary_action_timer_frames) != 0) { - boss_data->previous_action_state = 0xD; + boss_data->previous_action_state = DREK_BOSS_LAUNCH_FORWARD_WITH_LATERAL_OFFSET; moby->f20 = 0xC; if (moby->animation_sequence_index != 5) { blend_moby_animation(moby, 5, 0, scale_game_frames(0x14)); @@ -1349,7 +1356,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->action_event_timer_frames = scale_game_frames(0xF); } if (fast_dec_timer(&boss_data->action_frame_counter) != 0) { - boss_data->previous_action_state = 0x10; + boss_data->previous_action_state = DREK_BOSS_TARGET_RANDOM_ARENA_POINTS; moby->f20 = 0xC; } break; @@ -1402,7 +1409,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->action_frame_counter = 0; } if (fast_dec_timer(&boss_data->action_frame_counter) != 0) { - boss_data->previous_action_state = 0x11; + boss_data->previous_action_state = DREK_BOSS_TARGET_SIDE_GROUND_POINTS; moby->f20 = 0xC; if (moby->animation_sequence_index != 13) { blend_moby_animation(moby, 0xD, 0, scale_game_frames(0x14)); @@ -1464,7 +1471,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { if (moby->animation_sequence_index != 0) { blend_moby_animation(moby, 0, 0, scale_game_frames(0x14)); } - boss_data->previous_action_state = 0x13; + boss_data->previous_action_state = DREK_BOSS_FOLLOW_HERO; } break; } @@ -1533,7 +1540,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { request_thruster_pack_lock_red_wait(D_L18_0015FFD8 + boss_data->thruster_lock_moby_index * 0x100, scale_game_frames(ticks)); boss_data->action_event_timer_frames = 0; - if (boss_data->encounter_phase == 4) { + if (boss_data->encounter_phase == DREK_BOSS_PHASE_BEFORE_MISSILE_GROUP) { moby->f20 = 0x14; } else { moby->f20 = 0xC; @@ -1630,9 +1637,9 @@ void drek_final_boss_robot_update(BossMoby *moby) { moby->collision_data = 0; moby->f34 |= 0x41; moby->f34 &= 0xEFFF; - if (boss_data->encounter_phase < 7) { + if (boss_data->encounter_phase < DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM) { start_scene(3); - boss_data->encounter_phase = 7; + boss_data->encounter_phase = DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM; ((BossShared *)&D_L18_0016D260_c)->f46 = 1; { /* In locals: retail does not load them again after the first copy. */ @@ -1643,8 +1650,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { qcopy(((BossShared *)&D_L18_0016D260_c)->f20, recs + idx * 0x80 + 0x70); } moby->f20 = 7; - boss_data->post_scene_resume_state = 0x1B; - } else if (boss_data->encounter_phase == 7) { + boss_data->post_scene_resume_state = DREK_BOSS_RUN_ENDING_SEQUENCE; + } else if (boss_data->encounter_phase == DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM) { if (((BossMoby *)hero.ground_moby) != 0 && hero.air_frames.s == 0 && ((BossMoby *)hero.ground_moby)->fA6 == 0x247 && hero.state.current == 0x22) { if (boss_data->ending_scene_4_delay_counter == 0) { @@ -1658,12 +1665,12 @@ void drek_final_boss_robot_update(BossMoby *moby) { if (scale_game_frames(0x28) < n) { start_scene(4); - boss_data->encounter_phase = 8; + boss_data->encounter_phase = DREK_BOSS_PHASE_MOUNT_JET_AND_START_SCENE_5; moby->f20 = 7; - boss_data->post_scene_resume_state = 0x1B; + boss_data->post_scene_resume_state = DREK_BOSS_RUN_ENDING_SEQUENCE; } } - } else if (boss_data->encounter_phase == 8) { + } else if (boss_data->encounter_phase == DREK_BOSS_PHASE_MOUNT_JET_AND_START_SCENE_5) { *(OvlQuad *)position_and_displacement_scratch = 0; *(OvlQuad *)position_displacement_direction_and_rotation_scratch = 0; position_and_displacement_scratch[0] = 660.6f; @@ -1677,16 +1684,16 @@ void drek_final_boss_robot_update(BossMoby *moby) { 0, 0); start_scene(5); - boss_data->encounter_phase = 9; - } else if (boss_data->encounter_phase == 9 && D_L18_0015F5C4 == 0) { + boss_data->encounter_phase = DREK_BOSS_PHASE_WAIT_TO_START_SLIDESHOW; + } else if (boss_data->encounter_phase == DREK_BOSS_PHASE_WAIT_TO_START_SLIDESHOW && D_L18_0015F5C4 == 0) { start_slideshow(); - boss_data->encounter_phase = 10; + boss_data->encounter_phase = DREK_BOSS_PHASE_WAIT_TO_QUEUE_ENDING_MOVIE; } else { int k = boss_data->encounter_phase; if (k == 10 && D_L18_0015F5C4 == 0) { queue_movie_with_game_language(0xB); - boss_data->encounter_phase = 0xB; + boss_data->encounter_phase = DREK_BOSS_PHASE_WAIT_FOR_ENDING_CLEANUP; } else if (k == 0xB && D_L18_0015F5C4 == 0) { *(int *)&l18_drek_boss_scene_2_started_gp = 0; *(int *)&D_L18_001623A0 = 0; @@ -1716,7 +1723,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { 600000.0f, 0.0f); } - if (boss_data->encounter_phase > 1) { + if (boss_data->encounter_phase > DREK_BOSS_PHASE_SECOND_ARENA_PATH) { hero.grind_look_moby = (struct Moby *)moby; } qcopy(moby->f10, boss_data->unbobbed_boss_position); From ed97be7e6b757e32820bb48c13d4c4f96db8b389 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:41:32 +0000 Subject: [PATCH 615/758] decomp: clarify names in start_snagglebeast_turn_toward_target domain_0_value_0 -> SNAGGLEBEAST_TURN_CONTROLLER_RESET: Retail 0x00313e14 retains argument 2 in s0; 0x00313e54 performs sw zero,0x168(s0) only after the heading difference exceeds vars+0x98. It then saves the prior moby state, resume animation and target at 0x00313e60-0x00313e78 and enters turn state 7 at 0x00313f38. The authoritative C identifies +0x168 as turn_controller_state, whose address the supplied SNAGGLEBEAST_TURN_TOWARD_TARGET handler passes to FUN_L00_00258278 with target heading and frame-scaled turning parameters. This proves the assignment clears persistent heading-controller storage for turn entry: a controller reset value, separate from MOBY(moby)->state and unrelated equal-valued existing constants. --- 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 51b3c0101c..22283c7c70 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -786,11 +786,14 @@ int start_snagglebeast_turn_toward_target(unsigned char *moby, int resume_animation, int use_fixed_target_position) { + enum { + SNAGGLEBEAST_TURN_CONTROLLER_RESET = 0 + }; float target_heading = fast_arc_tan(target_position[0] - MOBY(moby)->pos.x, target_position[1] - MOBY(moby)->pos.y); if (moby_vars->turn_start_angle < fast_difference_between_rotations(MOBY(moby)->rot.z, target_heading)) { - moby_vars->turn_controller_state = 0; + moby_vars->turn_controller_state = SNAGGLEBEAST_TURN_CONTROLLER_RESET; MOBY(moby)->anim_speed = 1.0f; moby_vars->turn_saved_state = MOBY(moby)->state; moby_vars->turn_resume_animation = resume_animation; From 3867902644af23bb852256b4fdb58b9fb8743f6a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:43:40 +0000 Subject: [PATCH 616/758] decomp: clarify names in update_plasmabot_target domain_0_value_2 -> PLASMABOT_TARGET_STATUS_REJECTED: Retail 0x002b3294 loads moby pvars; 0x002b32a0/a8 passes pvars+0xD0 as helper output. Checked helper 0x002682d0 retains it in s5; 0x00268334..0x00268348 and 0x00268400..0x00268408 set status 2 while clearing the excluded selection. Accepted alternates set status 1 at 0x0026851c..0x00268520 or 0x0026862c..0x00268630. Helper 0x00268708 stores this status to s5+0x44, exactly pvars+0x114, and 0x00268710 returns it. Assigned 0x002b32c4 preserves returned status 2; 0x002b32cc..0x002b32e4 writes 2 to the same field when XY distance exceeds target_range. Supplied plasmabot_update gates activation and returns along its path on this status, proving rejected target status rather than a moby/hero state. --- src/overlays/shared/enemies/plasmabot.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index ca8adafe78..cab09b4379 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -122,6 +122,9 @@ extern int FUN_L00_0025ff38(char *, char *, float, int, int, int *, int); void update_plasmabot_target(char *moby) __asm__("FUN_L14_002b3268"); void update_plasmabot_target(char *moby) { + enum { + PLASMABOT_TARGET_STATUS_REJECTED = 2 + }; PlasmabotVars *plasmabot_private_vars = (PlasmabotVars *)MOBY(moby)->pvars; int *target_filter_record = ((int *)l14_paths[plasmabot_private_vars->target_path_index]); if (FUN_L00_0025ff38(moby, @@ -133,7 +136,7 @@ void update_plasmabot_target(char *moby) { *target_filter_record) != 2) { if (plasmabot_private_vars->target_range < vector_distance_xy(&MOBY(moby)->pos, &plasmabot_private_vars->unkD0)) { - plasmabot_private_vars->target_selection_status = 2; + plasmabot_private_vars->target_selection_status = PLASMABOT_TARGET_STATUS_REJECTED; } } if (plasmabot_private_vars->target == 0) { From afb0db773fd2f2b6d05326fae47ff7f273cec11a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:45:21 +0000 Subject: [PATCH 617/758] decomp: clarify names in update_scoutbot_health_and_target domain_0_value_2 -> SCOUTBOT_TARGET_SELECTION_UNAVAILABLE: Retail 0x002d3708 loads s1 from moby+0x78. 0x002d37c8 passes pvars+0x170 (tracked target position) to selection; 0x002d3800-0x002d3814 compares it with home at pvars+0x1c0 and stores 2 to pvars+0x1b4 when XY distance exceeds 14. Source ScoutbotVars maps +0x1b4 to target_selection_status, and caller Data_3DF8 maps the same offset to path_target_selection_status. In scoutbot_update's IDLE branch, status !=2 enters APPROACH_TARGET; status 2 instead permits idle wandering. Thus 2 means target selection is unavailable for approach, separate from moby state at +0x20. domain_1_value_2 -> SCOUTBOT_TARGET_SELECTION_UNAVAILABLE: Retail 0x002d3818-0x002d3824 subtracts tracked target Z at pvars+0x178 from home Z at +0x1c8 and takes the absolute value. 0x002d3828-0x002d3844 compares against 3 and stores the same 2 to pvars+0x1b4 when exceeded. The authoritative source identifies this field as target_selection_status; caller Data_3DF8 uses the same +0x1b4 as path_target_selection_status, whose value 2 suppresses IDLE-to-APPROACH_TARGET transition and allows wandering. Reuse the same unavailable-selection member as the XY rejection, not SCOUTBOT_STATE_APPROACH_TARGET, which belongs to the separate moby+0x20 domain. --- src/overlays/shared/enemies/scoutbot.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index 64242e8e6d..253f892e2c 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -417,6 +417,9 @@ void scoutbot_update(Moby *moby) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002D3DF8.c: func_L08_002D49E8), where it is exact; names translated to the US level program. */ void update_scoutbot_health_and_target(struct Moby *moby) { + enum { + SCOUTBOT_TARGET_SELECTION_UNAVAILABLE = 2 + }; ScoutbotVars *scoutbot_pvars = (ScoutbotVars *)moby->pvars; int hit; float dmg; @@ -441,10 +444,10 @@ void update_scoutbot_health_and_target(struct Moby *moby) { if (func_L00_00260FB0_f( moby, &scoutbot_pvars->tracked_target_position, 14.0f, 0, 0, path + 0x10, *(int *)path) != 2) { if (14.0f < vector_distance_xy(&scoutbot_pvars->unk1C0, &scoutbot_pvars->tracked_target_position)) { - scoutbot_pvars->target_selection_status = 2; + scoutbot_pvars->target_selection_status = SCOUTBOT_TARGET_SELECTION_UNAVAILABLE; } else if (3.0f < absolute_float(scoutbot_pvars->unk1C0[2] - scoutbot_pvars->tracked_target_position[2])) { - scoutbot_pvars->target_selection_status = 2; + scoutbot_pvars->target_selection_status = SCOUTBOT_TARGET_SELECTION_UNAVAILABLE; } } } From 2afa78ef28bdcc4814e59fdfe57924c7c70c6000 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:46:56 +0000 Subject: [PATCH 618/758] decomp: clarify names in big_axebot_update f110 -> knockback_ascent_target_frame: Assigned retail 002baaec..002baaf0 sets data+0x110=5 after knockback, and fatal 002bac0c sets 12. Checked step_moby_motion request a37a7a5470ef4b4d89af176665c39ba7 binds a1=data+0xc0 to s2 at 0024f6e8. Its rising motion phase 0 at 0024fa2c..0024fa84 loads s2+0x50 (data+0x110), subtracts compute_interpolated_record_value at 0024fa58..0024fa68 and divides by remaining ascent time abs(vertical displacement/gravity) to control moby+0x58 animation speed. Negative vertical displacement switches phase 0 to 1 at 0024fecc..0024fee8. Thus this float is the ascent target animation frame. f114 -> knockback_descent_target_frame: Assigned retail 002baae8 sets data+0x114=10 after knockback and 002bac14 sets 25 for fatal knockback. Checked step_moby_motion request a37a7a5470ef4b4d89af176665c39ba7 receives data+0xc0 in s2. In falling phase 1, 0024fa88..0024faa8 compares interpolated animation frame with s2+0x54 (data+0x114) and stops animation speed at the target; 0024fb2c..0024fb94 divides remaining frame difference by predicted ground-contact time and adjusts moby+0x58. It is the descent target animation frame, not a physical knockback distance. f52 -> animation_source_sequence: Assigned melee code 002bb6e8..002bb6f0 requires moby+0x52 equal +0x53 before contact-frame checks. Checked advance_moby_animation request cb426ae435754569828317145342bae4 loads +0x52 into t2 (002431c8) and +0x53 into t3 (002431d0). When sequences differ it advances the transition separately at 00243270; at transition completion 00243328..00243338 copies target t3 to source t2, then stores t2 into +0x52 at 002432ec while shifting record pointers +0x6c to +0x68. This proves +0x52 is the source sequence for interpolation, which becomes the target after transition. f53 -> animation_target_sequence: Assigned FOLLOW_PATH 002bb0d0..002bb100 compares moby+0x53 with desired sequence 3 and calls blend_big_axebot_and_axe_animation with 3 if different. Checked advance_moby_animation request cb426ae435754569828317145342bae4 loads +0x53 into t3 at 002431d0 and indexes the animation sequence table by t3 at 00243234..00243254. On transition completion, 00243328..00243338 copies t3 into t2, later stored at +0x52 by 002432ec. Thus +0x53 identifies the target animation sequence, distinct from the interpolation source +0x52. --- src/overlays/l04/mobys/big_axebot.c | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/overlays/l04/mobys/big_axebot.c b/src/overlays/l04/mobys/big_axebot.c index 0a27b3d290..cec273a37f 100644 --- a/src/overlays/l04/mobys/big_axebot.c +++ b/src/overlays/l04/mobys/big_axebot.c @@ -151,8 +151,8 @@ typedef struct D_B7B0 { char padEC[0x11]; unsigned char fFD; char padFE[0x12]; - float f110; - float f114; + float knockback_ascent_target_frame; + float knockback_descent_target_frame; char pad118[8]; Manip_B7B0 recoil_manipulator; Manip_B7B0 aim_manipulator; @@ -194,8 +194,8 @@ typedef struct M_B7B0 { char pad36[0xA]; V4_B7B0 rot; char pad50[2]; - unsigned char f52; - unsigned char f53; + unsigned char animation_source_sequence; + unsigned char animation_target_sequence; char pad54[4]; float f58; char pad5C[0x14]; @@ -417,7 +417,7 @@ void big_axebot_update(M_B7B0 *moby) { } data->recoil_pose_cooldown_timer = scale_game_frames(0x1E); if ((hit->att->cls == 0 || hit->damage_amount > 1.0f) && - (moby->f52 != 4 || hd < 17.0f || hd > 20.0f)) { + (moby->animation_source_sequence != 4 || hd < 17.0f || hd > 20.0f)) { moby->fBC |= 5; blend_big_axebot_and_axe_animation( (char *)moby, (void *)5, 0, (void *)scale_game_frames(6)); @@ -442,8 +442,8 @@ void big_axebot_update(M_B7B0 *moby) { set_big_axebot_and_axe_animation_speed(moby, 2.0f); moby->state = BIG_AXEBOT_STATE_HIT_RECOVERY; trooper_start_knockback(knockback_yaw, moby, data->fC0, 5, 1, 0); - data->f110 = 5.0f; - data->f114 = 10.0f; + data->knockback_ascent_target_frame = 5.0f; + data->knockback_descent_target_frame = 10.0f; data->recoil_displacement = 3.4f / scale_time(7.0f); data->fB7 = 0x78; trooper_anim_update(moby, (short *)data->fB0); @@ -471,8 +471,8 @@ void big_axebot_update(M_B7B0 *moby) { trooper_knockback_arc( vector_quaternion_scratch, &knockback_yaw, &data->fD8, &data->fDC); trooper_start_knockback(knockback_yaw, moby, data->fC0, 7, 1, 0); - data->f110 = 12.0f; - data->f114 = 25.0f; + data->knockback_ascent_target_frame = 12.0f; + data->knockback_descent_target_frame = 25.0f; moby->state = BIG_AXEBOT_STATE_DYING; data->fB7 = 0x78; trooper_anim_update(moby, (short *)data->fB0); @@ -530,7 +530,7 @@ void big_axebot_update(M_B7B0 *moby) { } break; case BIG_AXEBOT_STATE_IDLE: { - if (moby->f53 == 6 && data->idle_action_delay_timer == scale_game_frames(0x25)) { + if (moby->animation_target_sequence == 6 && data->idle_action_delay_timer == scale_game_frames(0x25)) { allocate_voice_for_target_entry(2, 0, (char *)moby); } if ((moby->f70 & 2) && @@ -543,7 +543,7 @@ void big_axebot_update(M_B7B0 *moby) { (void *)arr[random_integer_below(6)], 0, (void *)scale_game_frames(0x18)); - } else if (moby->f53 != 0xD && (moby->f53 != 6 || (moby->f70 & 2))) { + } else if (moby->animation_target_sequence != 0xD && (moby->animation_target_sequence != 6 || (moby->f70 & 2))) { if (flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)0xD, 0, (void *)scale_game_frames(0x18)); @@ -555,7 +555,7 @@ void big_axebot_update(M_B7B0 *moby) { moby->fBC |= 1; data->path_follow_started = 1; } else { - if (moby->f52 == 0xD && FUN_L00_001fefc8(&data->alert_voice_cooldown_timer) != 0) { + if (moby->animation_source_sequence == 0xD && FUN_L00_001fefc8(&data->alert_voice_cooldown_timer) != 0) { allocate_voice_for_target_entry(0xA, 0, (char *)moby); data->alert_voice_cooldown_timer = scale_game_frames(0xB4); } @@ -579,7 +579,7 @@ void big_axebot_update(M_B7B0 *moby) { break; } case BIG_AXEBOT_STATE_ALERT: - if (moby->f52 == 2 && (moby->f70 & 2)) { + if (moby->animation_source_sequence == 2 && (moby->f70 & 2)) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)((flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) @@ -591,7 +591,7 @@ void big_axebot_update(M_B7B0 *moby) { } break; case BIG_AXEBOT_STATE_WAIT_FOR_TARGET: - if (moby->f52 != 0 && (moby->f70 & 2)) { + if (moby->animation_source_sequence != 0 && (moby->f70 & 2)) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)0xB, 0, (void *)scale_game_frames(0xC)); } @@ -615,7 +615,7 @@ void big_axebot_update(M_B7B0 *moby) { P_B7B0 *path = ((P_B7B0 *)l04_paths[data->approach_path_index]); float a; - if (moby->f53 != 3) { + if (moby->animation_target_sequence != 3) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)3, 0, (void *)scale_game_frames(0xC)); } @@ -737,7 +737,7 @@ void big_axebot_update(M_B7B0 *moby) { } break; case BIG_AXEBOT_STATE_MELEE_ATTACK: - if (moby->f52 == moby->f53 && compute_interpolated_record_value(moby) >= 17.0f && + if (moby->animation_source_sequence == moby->animation_target_sequence && compute_interpolated_record_value(moby) >= 17.0f && compute_interpolated_record_value(moby) < 20.0f && absolute_float(moby->pos[2] - tg.pos[2]) < 2.0f && vector_distance_xy(moby->pos, (float *)&tg) < 4.5f) { @@ -762,7 +762,7 @@ void big_axebot_update(M_B7B0 *moby) { set_big_axebot_and_axe_animation_speed(moby, animation_speed); } } - if (moby->f52 == 4 && (moby->f70 & 2)) { + if (moby->animation_source_sequence == 4 && (moby->f70 & 2)) { data->idle_action_delay_timer = scale_game_frames(0x5A); blend_big_axebot_and_axe_animation( (char *)moby, @@ -775,14 +775,14 @@ void big_axebot_update(M_B7B0 *moby) { } break; case BIG_AXEBOT_STATE_HIT_RECOVERY: - if (!(moby->f53 == 5 && (moby->f52 != moby->f53 || hd <= 13.0f))) { + if (!(moby->animation_target_sequence == 5 && (moby->animation_source_sequence != moby->animation_target_sequence || hd <= 13.0f))) { if (moby->fBC & 4) { moby->fBC &= ~4; blend_big_axebot_and_axe_animation( (char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(6)); set_big_axebot_and_axe_animation_speed(moby, 1.5f); moby->state = BIG_AXEBOT_STATE_MELEE_ATTACK; - } else if (moby->f53 == 8 && (hd < 28.0f || moby->f52 != moby->f53)) { + } else if (moby->animation_target_sequence == 8 && (hd < 28.0f || moby->animation_source_sequence != moby->animation_target_sequence)) { float hit_recovery_displacement_limit = frame_scale * 0.11111111f; if (data->hit_recovery_displacement < hit_recovery_displacement_limit) { @@ -817,7 +817,7 @@ void big_axebot_update(M_B7B0 *moby) { } break; case BIG_AXEBOT_STATE_TURN: - if (moby->f52 == 8 && (moby->f70 & 2)) { + if (moby->animation_source_sequence == 8 && (moby->f70 & 2)) { moby->state = BIG_AXEBOT_STATE_CHASE_TARGET; moby->fBC = (moby->fBC | 8) & ~0x10; blend_big_axebot_and_axe_animation( From d50fe34f1348e7b46c15287bc39e3376d110a6e6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:49:37 +0000 Subject: [PATCH 619/758] decomp: clarify names in walker_update_gait f38 -> transition_position_span: WalkAnim +0x38 is an animation-position span: retail 0x002a1af0-0x002a1b2c scales it by 0.25/(speed/anim+8) for blend duration and adds 0.125 of it to the +0x40 phase anchor before subtracting animation_position_origin and wrapping by +0x10. At 0x002a30ec-0x002a3124 the full span controls blend duration and half the span offsets the anchor when returning to WALK. RUN-to-WALK also selects two-thirds of this span at 0x002a3204-0x002a323c. This proves a position span used in gait transitions without assigning a foot or event. f3C -> alternate_transition_position_span: WalkAnim +0x3C is the paired alternative to +0x38: retail 0x002a1bb0-0x002a1bec scales it by 0.25/(speed/anim+8) for the blend duration and adds 0.125 of it to +0x44 before origin subtraction and cycle wrapping. At 0x002a2f68-0x002a2f90 and shared 0x002a3114-0x002a3124 the full span controls blend duration and half the span offsets the anchor. 0x002a31fc-0x002a323c chooses +0x38/+0x40 or +0x3C/+0x44 by the gait mask for RUN-to-WALK. Alternate describes this paired calculation only. f44 -> alternate_phase_anchor_position: WalkAnim +0x44 anchors the +0x3C transition span: retail 0x002a1bd4-0x002a1bec adds one-eighth of +0x3C to it, subtracts animation_position_origin and wraps by cycle length before selecting the animation entry. RUN-to-WALK pairs +0x44 with +0x3C versus +0x40 with +0x38 at 0x002a31fc-0x002a323c. Landing paths also use this position as their synchronization anchor: 0x002a363c-0x002a3648 converts its origin-relative offset to time, and 0x002a3960-0x002a3980 targets that offset at landing. The name identifies a phase anchor without asserting a common anatomical event. --- .../shared/enemies/walker_update_gait.c | 196 +++++++++--------- 1 file changed, 98 insertions(+), 98 deletions(-) diff --git a/src/overlays/shared/enemies/walker_update_gait.c b/src/overlays/shared/enemies/walker_update_gait.c index af69c8640a..360cc7321c 100644 --- a/src/overlays/shared/enemies/walker_update_gait.c +++ b/src/overlays/shared/enemies/walker_update_gait.c @@ -122,10 +122,10 @@ typedef struct WalkAnim { float f10; int initial_animation_position; char pad18[0x20]; - float f38; - float f3C; + float transition_position_span; + float alternate_transition_position_span; float f40; - float f44; + float alternate_phase_anchor_position; float f48; float alternate_run_transition_position; } WalkAnim; @@ -295,10 +295,10 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->uEE = (gait_data->uEE & 0xFFFE) | 2; gait_data->fE4 = walker_moby->pos[2]; if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[11]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[11]->transition_position_span * 0.25f / (speed / gait_data->anim[11]->f08)); int fr = truncate_float_to_s32(gait_data->anim[11]->f40 + - gait_data->anim[11]->f38 * 0.125f - + gait_data->anim[11]->transition_position_span * 0.125f - gait_data->anim[11]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[11]->f10); WalkAnim *a = gait_data->anim[11]; @@ -308,10 +308,10 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->bB7 = 0xF; } else { - int bl = truncate_float_to_s32(gait_data->anim[9]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[9]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[9]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[9]->f44 + - gait_data->anim[9]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[9]->alternate_phase_anchor_position + + gait_data->anim[9]->alternate_transition_position_span * 0.125f - gait_data->anim[9]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[9]->f10); WalkAnim *a = gait_data->anim[9]; @@ -342,10 +342,10 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(gait_data->fB8) > gait_data->fE0 * 0.75f) { if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[2]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + - gait_data->anim[2]->f38 * 0.125f - + gait_data->anim[2]->transition_position_span * 0.125f - gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; @@ -355,10 +355,10 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->bB7 = 3; } else { - int bl = truncate_float_to_s32(gait_data->anim[1]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[1]->f44 + - gait_data->anim[1]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[1]->alternate_phase_anchor_position + + gait_data->anim[1]->alternate_transition_position_span * 0.125f - gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; @@ -374,10 +374,10 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->fE0 * 0.75f) { gait_data->uEE |= 8; if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[5]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); int fr = truncate_float_to_s32(gait_data->anim[5]->f40 + - gait_data->anim[5]->f38 * 0.125f - + gait_data->anim[5]->transition_position_span * 0.125f - gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); WalkAnim *a = gait_data->anim[5]; @@ -387,10 +387,10 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->bB7 = 8; } else { - int bl = truncate_float_to_s32(gait_data->anim[4]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[4]->f44 + - gait_data->anim[4]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[4]->alternate_phase_anchor_position + + gait_data->anim[4]->alternate_transition_position_span * 0.125f - gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); WalkAnim *a = gait_data->anim[4]; @@ -412,10 +412,10 @@ void walker_update_gait(WalkMoby *walker_moby, WalkAnim *a; int f; gait_data->uEE |= 8; - bl = truncate_float_to_s32(gait_data->anim[5]->f38 * 0.25f / + bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); fr = truncate_float_to_s32(gait_data->anim[5]->f40 + - gait_data->anim[5]->f38 * 0.125f - + gait_data->anim[5]->transition_position_span * 0.125f - gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); a = gait_data->anim[5]; @@ -430,10 +430,10 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->fE0 * 0.75f) { gait_data->bB7 = 5; } else { - int bl = truncate_float_to_s32(gait_data->anim[3]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[3]->transition_position_span * 0.25f / (speed / gait_data->anim[3]->f08)); int fr = truncate_float_to_s32(gait_data->anim[3]->f40 + - gait_data->anim[3]->f38 * 0.125f - + gait_data->anim[3]->transition_position_span * 0.125f - gait_data->anim[3]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[3]->f10); WalkAnim *a = gait_data->anim[3]; @@ -454,10 +454,10 @@ void walker_update_gait(WalkMoby *walker_moby, WalkAnim *a; int f; gait_data->uEE |= 8; - bl = truncate_float_to_s32(gait_data->anim[4]->f3C * 0.25f / + bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); - fr = truncate_float_to_s32(gait_data->anim[4]->f44 + - gait_data->anim[4]->f3C * 0.125f - + fr = truncate_float_to_s32(gait_data->anim[4]->alternate_phase_anchor_position + + gait_data->anim[4]->alternate_transition_position_span * 0.125f - gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); a = gait_data->anim[4]; @@ -472,10 +472,10 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->fE0 * 0.75f) { gait_data->bB7 = 6; } else { - int bl = truncate_float_to_s32(gait_data->anim[3]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[3]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[3]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[3]->f44 + - gait_data->anim[3]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[3]->alternate_phase_anchor_position + + gait_data->anim[3]->alternate_transition_position_span * 0.125f - gait_data->anim[3]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[3]->f10); WalkAnim *a = gait_data->anim[3]; @@ -493,10 +493,10 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->fE0 * 0.75f) { gait_data->uEE |= 8; if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[5]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); int fr = truncate_float_to_s32(gait_data->anim[5]->f40 + - gait_data->anim[5]->f38 * 0.125f - + gait_data->anim[5]->transition_position_span * 0.125f - gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); WalkAnim *a = gait_data->anim[5]; @@ -506,10 +506,10 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->bB7 = 8; } else { - int bl = truncate_float_to_s32(gait_data->anim[4]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[4]->f44 + - gait_data->anim[4]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[4]->alternate_phase_anchor_position + + gait_data->anim[4]->alternate_transition_position_span * 0.125f - gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); WalkAnim *a = gait_data->anim[4]; @@ -524,10 +524,10 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(gait_data->fB8) < gait_data->fE0 * 0.75f) { if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[1]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[1]->transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); int fr = truncate_float_to_s32(gait_data->anim[1]->f40 + - gait_data->anim[1]->f38 * 0.125f - + gait_data->anim[1]->transition_position_span * 0.125f - gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; @@ -537,10 +537,10 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->bB7 = 5; } else { - int bl = truncate_float_to_s32(gait_data->anim[2]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[2]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[2]->f44 + - gait_data->anim[2]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[2]->alternate_phase_anchor_position + + gait_data->anim[2]->alternate_transition_position_span * 0.125f - gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; @@ -562,10 +562,10 @@ void walker_update_gait(WalkMoby *walker_moby, WalkAnim *a; int f; gait_data->uEE |= 8; - bl = truncate_float_to_s32(gait_data->anim[4]->f3C * 0.25f / + bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); - fr = truncate_float_to_s32(gait_data->anim[4]->f44 + - gait_data->anim[4]->f3C * 0.125f - + fr = truncate_float_to_s32(gait_data->anim[4]->alternate_phase_anchor_position + + gait_data->anim[4]->alternate_transition_position_span * 0.125f - gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); a = gait_data->anim[4]; @@ -580,10 +580,10 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->fE0 * 0.75f) { gait_data->bB7 = 2; } else { - int bl = truncate_float_to_s32(gait_data->anim[0]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[0]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[0]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[0]->f44 + - gait_data->anim[0]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[0]->alternate_phase_anchor_position + + gait_data->anim[0]->alternate_transition_position_span * 0.125f - gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; @@ -604,10 +604,10 @@ void walker_update_gait(WalkMoby *walker_moby, WalkAnim *a; int f; gait_data->uEE |= 8; - bl = truncate_float_to_s32(gait_data->anim[5]->f38 * 0.25f / + bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); fr = truncate_float_to_s32(gait_data->anim[5]->f40 + - gait_data->anim[5]->f38 * 0.125f - + gait_data->anim[5]->transition_position_span * 0.125f - gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); a = gait_data->anim[5]; @@ -622,10 +622,10 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->fE0 * 0.75f) { gait_data->bB7 = 3; } else { - int bl = truncate_float_to_s32(gait_data->anim[0]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[0]->transition_position_span * 0.25f / (speed / gait_data->anim[0]->f08)); int fr = truncate_float_to_s32(gait_data->anim[0]->f40 + - gait_data->anim[0]->f38 * 0.125f - + gait_data->anim[0]->transition_position_span * 0.125f - gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; @@ -641,10 +641,10 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->fB8) > gait_data->fE0 * 0.75f) { - int bl = truncate_float_to_s32(gait_data->anim[2]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + - gait_data->anim[2]->f38 * 0.125f - + gait_data->anim[2]->transition_position_span * 0.125f - gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; @@ -659,10 +659,10 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->fE0 * 0.75f) { gait_data->bB7 = 10; } else { - int bl = truncate_float_to_s32(gait_data->anim[6]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[6]->transition_position_span * 0.25f / (speed / gait_data->anim[6]->f08)); int fr = truncate_float_to_s32(gait_data->anim[6]->f40 + - gait_data->anim[6]->f38 * 0.125f - + gait_data->anim[6]->transition_position_span * 0.125f - gait_data->anim[6]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[6]->f10); WalkAnim *a = gait_data->anim[6]; @@ -678,10 +678,10 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->fB8) > gait_data->fE0 * 0.75f) { - int bl = truncate_float_to_s32(gait_data->anim[1]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[1]->f44 + - gait_data->anim[1]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[1]->alternate_phase_anchor_position + + gait_data->anim[1]->alternate_transition_position_span * 0.125f - gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; @@ -696,10 +696,10 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->fE0 * 0.75f) { gait_data->bB7 = 11; } else { - int bl = truncate_float_to_s32(gait_data->anim[6]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[6]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[6]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[6]->f44 + - gait_data->anim[6]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[6]->alternate_phase_anchor_position + + gait_data->anim[6]->alternate_transition_position_span * 0.125f - gait_data->anim[6]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[6]->f10); WalkAnim *a = gait_data->anim[6]; @@ -716,10 +716,10 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(gait_data->fB8) > gait_data->fE0 * 0.75f) { if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[2]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + - gait_data->anim[2]->f38 * 0.125f - + gait_data->anim[2]->transition_position_span * 0.125f - gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; @@ -729,10 +729,10 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->bB7 = 3; } else { - int bl = truncate_float_to_s32(gait_data->anim[1]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[1]->f44 + - gait_data->anim[1]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[1]->alternate_phase_anchor_position + + gait_data->anim[1]->alternate_transition_position_span * 0.125f - gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; @@ -747,10 +747,10 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(gait_data->fB8) > -gait_data->fE0 * 0.75f) { if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[4]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[4]->transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); int fr = truncate_float_to_s32(gait_data->anim[4]->f40 + - gait_data->anim[4]->f38 * 0.125f - + gait_data->anim[4]->transition_position_span * 0.125f - gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); WalkAnim *a = gait_data->anim[4]; @@ -760,10 +760,10 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->bB7 = 10; } else { - int bl = truncate_float_to_s32(gait_data->anim[5]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[5]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[5]->f44 + - gait_data->anim[5]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[5]->alternate_phase_anchor_position + + gait_data->anim[5]->alternate_transition_position_span * 0.125f - gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); WalkAnim *a = gait_data->anim[5]; @@ -780,10 +780,10 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->fB8) > gait_data->fE0 * 0.75f) { - int bl = truncate_float_to_s32(gait_data->anim[1]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[1]->f44 + - gait_data->anim[1]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[1]->alternate_phase_anchor_position + + gait_data->anim[1]->alternate_transition_position_span * 0.125f - gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; @@ -798,10 +798,10 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->fE0 * 0.75f) { gait_data->bB7 = 7; } else { - int bl = truncate_float_to_s32(gait_data->anim[0]->f3C / + int bl = truncate_float_to_s32(gait_data->anim[0]->alternate_transition_position_span / (speed / gait_data->anim[0]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[0]->f44 + - gait_data->anim[0]->f3C * 0.5f - + int fr = truncate_float_to_s32(gait_data->anim[0]->alternate_phase_anchor_position + + gait_data->anim[0]->alternate_transition_position_span * 0.5f - gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; @@ -817,10 +817,10 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f * fast_sin(gait_data->fB8) > gait_data->fE0 * 0.75f) { - int bl = truncate_float_to_s32(gait_data->anim[2]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + - gait_data->anim[2]->f38 * 0.125f - + gait_data->anim[2]->transition_position_span * 0.125f - gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; @@ -835,10 +835,10 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->fE0 * 0.75f) { gait_data->bB7 = 8; } else { - int bl = truncate_float_to_s32(gait_data->anim[0]->f38 / + int bl = truncate_float_to_s32(gait_data->anim[0]->transition_position_span / (speed / gait_data->anim[0]->f08)); int fr = truncate_float_to_s32(gait_data->anim[0]->f40 + - gait_data->anim[0]->f38 * 0.5f - + gait_data->anim[0]->transition_position_span * 0.5f - gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; @@ -861,12 +861,12 @@ void walker_update_gait(WalkMoby *walker_moby, if (speed < t && gait_data->fC0 <= t) { int fr; if (gait_data->bB6 & 3) { - fr = truncate_float_to_s32(gait_data->anim[0]->f38 * 2.0f / 3.0f + + fr = truncate_float_to_s32(gait_data->anim[0]->transition_position_span * 2.0f / 3.0f + gait_data->anim[0]->f40 - gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); } else { - fr = truncate_float_to_s32(gait_data->anim[0]->f3C * 2.0f / 3.0f + - gait_data->anim[0]->f44 - gait_data->anim[0]->animation_position_origin) % + fr = truncate_float_to_s32(gait_data->anim[0]->alternate_transition_position_span * 2.0f / 3.0f + + gait_data->anim[0]->alternate_phase_anchor_position - gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); } { @@ -883,10 +883,10 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->uEE = (gait_data->uEE & 0xFFFE) | 2; gait_data->fE4 = walker_moby->pos[2]; if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[11]->f38 * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[11]->transition_position_span * 0.25f / (speed / gait_data->anim[11]->f08)); int fr = truncate_float_to_s32(gait_data->anim[11]->f40 + - gait_data->anim[11]->f38 * 0.125f - + gait_data->anim[11]->transition_position_span * 0.125f - gait_data->anim[11]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[11]->f10); WalkAnim *a = gait_data->anim[11]; @@ -896,10 +896,10 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->bB7 = 0xF; } else { - int bl = truncate_float_to_s32(gait_data->anim[9]->f3C * 0.25f / + int bl = truncate_float_to_s32(gait_data->anim[9]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[9]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[9]->f44 + - gait_data->anim[9]->f3C * 0.125f - + int fr = truncate_float_to_s32(gait_data->anim[9]->alternate_phase_anchor_position + + gait_data->anim[9]->alternate_transition_position_span * 0.125f - gait_data->anim[9]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[9]->f10); WalkAnim *a = gait_data->anim[9]; @@ -952,7 +952,7 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->bB7 = 0x10; } else if ((gait_data->uEE & 4) && gait_data->fD8 < 0.0f) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); - float len = (gait_data->anim[12]->f44 - gait_data->anim[12]->animation_position_origin) * 2.0f; + float len = (gait_data->anim[12]->alternate_phase_anchor_position - gait_data->anim[12]->animation_position_origin) * 2.0f; if (t < len + 15.0f) { int bl = truncate_float_to_s32(t - len) >> 1; WalkAnim *a; @@ -985,7 +985,7 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->bB7 = 0x10; } else if ((gait_data->uEE & 4) && gait_data->fD8 < 0.0f) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); - float len = (gait_data->anim[10]->f44 - gait_data->anim[10]->animation_position_origin) * 2.0f; + float len = (gait_data->anim[10]->alternate_phase_anchor_position - gait_data->anim[10]->animation_position_origin) * 2.0f; if (t < len + 15.0f) { int bl = truncate_float_to_s32(t - len) >> 1; WalkAnim *a; @@ -1004,7 +1004,7 @@ void walker_update_gait(WalkMoby *walker_moby, case WALKER_GAIT_WAIT_FOR_LANDING: if (walker_moby->b52 == gait_data->bB3) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); - float len = (gait_data->anim[12]->f44 - gait_data->anim[12]->animation_position_origin) * 2.0f; + float len = (gait_data->anim[12]->alternate_phase_anchor_position - gait_data->anim[12]->animation_position_origin) * 2.0f; if (t < len + 15.0f) { int bl = truncate_float_to_s32(t - len) >> 1; WalkAnim *a = gait_data->anim[12]; @@ -1021,14 +1021,14 @@ void walker_update_gait(WalkMoby *walker_moby, float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); if (t > 1.0f) { float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; - t = gait_data->anim[12]->f44 + 2.0f - t * 0.5f - gait_data->anim[12]->animation_position_origin; + t = gait_data->anim[12]->alternate_phase_anchor_position + 2.0f - t * 0.5f - gait_data->anim[12]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } walker_moby->animation_playback_rate = frame_scale_inv * (t - base); } else { float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; - t = gait_data->anim[12]->f44 - gait_data->anim[12]->animation_position_origin; + t = gait_data->anim[12]->alternate_phase_anchor_position - gait_data->anim[12]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } @@ -1048,14 +1048,14 @@ void walker_update_gait(WalkMoby *walker_moby, float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); if (t > 1.0f) { float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; - t = gait_data->anim[10]->f44 + 2.0f - t * 0.5f - gait_data->anim[10]->animation_position_origin; + t = gait_data->anim[10]->alternate_phase_anchor_position + 2.0f - t * 0.5f - gait_data->anim[10]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } walker_moby->animation_playback_rate = frame_scale_inv * (t - base); } else { float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; - t = gait_data->anim[10]->f44 - gait_data->anim[10]->animation_position_origin; + t = gait_data->anim[10]->alternate_phase_anchor_position - gait_data->anim[10]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } @@ -1072,11 +1072,11 @@ void walker_update_gait(WalkMoby *walker_moby, break; case WALKER_GAIT_RESUME_RUN_AFTER_LANDING: if (flags & 1) { - int bl = truncate_float_to_s32((gait_data->anim[7]->f38 * 0.25f + 2.0f) / + int bl = truncate_float_to_s32((gait_data->anim[7]->transition_position_span * 0.25f + 2.0f) / (speed / gait_data->anim[7]->f08)); int fr = truncate_float_to_s32(gait_data->anim[7]->f40 + 1.0f + - gait_data->anim[7]->f38 * 0.125f - gait_data->anim[7]->animation_position_origin) % + gait_data->anim[7]->transition_position_span * 0.125f - gait_data->anim[7]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[7]->f10); WalkAnim *a = gait_data->anim[7]; int f = @@ -1097,11 +1097,11 @@ void walker_update_gait(WalkMoby *walker_moby, break; case WALKER_GAIT_RESUME_RUN_AFTER_ALTERNATE_LANDING: if (flags & 1) { - int bl = truncate_float_to_s32((gait_data->anim[7]->f3C * 0.25f + 2.0f) / + int bl = truncate_float_to_s32((gait_data->anim[7]->alternate_transition_position_span * 0.25f + 2.0f) / (speed / gait_data->anim[7]->f08)); int fr = - truncate_float_to_s32(gait_data->anim[7]->f44 + 1.0f + - gait_data->anim[7]->f38 * 0.125f - gait_data->anim[7]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[7]->alternate_phase_anchor_position + 1.0f + + gait_data->anim[7]->transition_position_span * 0.125f - gait_data->anim[7]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[7]->f10); WalkAnim *a = gait_data->anim[7]; int f = From 83cc42c8c40a1411dd6c76853481194be45704e3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:51:38 +0000 Subject: [PATCH 620/758] decomp: clarify names in toxic_crab_update domain_0_value_0 -> FALSE: Retail 0x002e1f70-0x002e1f84 reads crab_data->remove_in_clank_mode and branches past the Clank-mode removal check when it is zero. Nonzero enables that check. Existing FALSE=0 therefore denotes the disabled value of this boolean flag, independent of hero vehicle-mode and moby-state domains. domain_1_value_2 -> TOXIC_CRAB_POINT_AHEAD_NO_TARGET: Retail 0x002e2200-0x002e2214 compares crab data+0x164, the same target-selection status produced by checked direct helper 0x002e3ef0 (called at 0x002e1d74). Helper 0x002e45cc-0x002e4620 and 0x002e4624-0x002e468c store 2 when tracked position fails home-range or vertical-separation checks; 0x002e46d4-0x002e46f0 counts target loss for this status. Supplied same-file C names that member POINT_AHEAD_NO_TARGET in the helper's function-local enum. Use the equivalent function-local TOXIC_CRAB_POINT_AHEAD_NO_TARGET here because that existing binding is outside this function's scope; this is not moby state 2 or a hero mode. domain_2_value_2 -> TOXIC_CRAB_POINT_AHEAD_NO_TARGET: Retail 0x002e2408-0x002e241c compares crab data+0x164, the same target-selection status produced by checked direct helper 0x002e3ef0 (called at 0x002e1d74). Helper 0x002e45cc-0x002e4620 and 0x002e4624-0x002e468c store 2 when tracked position fails home-range or vertical-separation checks; 0x002e46d4-0x002e46f0 counts target loss for this status. Supplied same-file C names that member POINT_AHEAD_NO_TARGET in the helper's function-local enum. Use the equivalent function-local TOXIC_CRAB_POINT_AHEAD_NO_TARGET here because that existing binding is outside this function's scope; this is not moby state 2 or a hero mode. domain_3_value_2 -> TOXIC_CRAB_POINT_AHEAD_NO_TARGET: Retail 0x002e2b80-0x002e2b9c compares crab data+0x164, the same target-selection status produced by checked direct helper 0x002e3ef0 (called at 0x002e1d74). Helper 0x002e45cc-0x002e4620 and 0x002e4624-0x002e468c store 2 when tracked position fails home-range or vertical-separation checks; 0x002e46d4-0x002e46f0 counts target loss for this status. Supplied same-file C names that member POINT_AHEAD_NO_TARGET in the helper's function-local enum. Use the equivalent function-local TOXIC_CRAB_POINT_AHEAD_NO_TARGET here because that existing binding is outside this function's scope; this is not moby state 2 or a hero mode. domain_4_value_2 -> TOXIC_CRAB_POINT_AHEAD_NO_TARGET: Retail 0x002e2e34-0x002e2e50 compares crab data+0x164, the same target-selection status produced by checked direct helper 0x002e3ef0 (called at 0x002e1d74). Helper 0x002e45cc-0x002e4620 and 0x002e4624-0x002e468c store 2 when tracked position fails home-range or vertical-separation checks; 0x002e46d4-0x002e46f0 counts target loss for this status. Supplied same-file C names that member POINT_AHEAD_NO_TARGET in the helper's function-local enum. Use the equivalent function-local TOXIC_CRAB_POINT_AHEAD_NO_TARGET here because that existing binding is outside this function's scope; this is not moby state 2 or a hero mode. domain_5_value_2 -> TOXIC_CRAB_POINT_AHEAD_NO_TARGET: Retail 0x002e3194-0x002e31b0 compares crab data+0x164, the same target-selection status produced by checked direct helper 0x002e3ef0 (called at 0x002e1d74). Helper 0x002e45cc-0x002e4620 and 0x002e4624-0x002e468c store 2 when tracked position fails home-range or vertical-separation checks; 0x002e46d4-0x002e46f0 counts target loss for this status. Supplied same-file C names that member POINT_AHEAD_NO_TARGET in the helper's function-local enum. Use the equivalent function-local TOXIC_CRAB_POINT_AHEAD_NO_TARGET here because that existing binding is outside this function's scope; this is not moby state 2 or a hero mode. domain_6_value_2 -> TOXIC_CRAB_POINT_AHEAD_NO_TARGET: Retail 0x002e34bc-0x002e34d0 compares crab data+0x164, the same target-selection status produced by checked direct helper 0x002e3ef0 (called at 0x002e1d74). Helper 0x002e45cc-0x002e4620 and 0x002e4624-0x002e468c store 2 when tracked position fails home-range or vertical-separation checks; 0x002e46d4-0x002e46f0 counts target loss for this status. Supplied same-file C names that member POINT_AHEAD_NO_TARGET in the helper's function-local enum. Use the equivalent function-local TOXIC_CRAB_POINT_AHEAD_NO_TARGET here because that existing binding is outside this function's scope; this is not moby state 2 or a hero mode. f194 -> pursuit_entry_angle_sample_radians: Retail 0x002e2348-0x002e2354 samples random_float_between(data+0x198 * DEG_TO_RAD, its negation) and stores the returned float at data+0x194 immediately after entering pursuit. The repeated entry at 0x002e247c-0x002e2488 performs the identical store. Thus this is the pursuit-entry random angle sample in radians; no downstream steering effect is claimed. f198 -> pursuit_entry_angle_bound_degrees: Retail 0x002e2334-0x002e2350 loads crab data+0x198, multiplies by 0.017453292 (DEG_TO_RAD), and passes the converted value and its negation to random_float_between. The same sequence at 0x002e2468-0x002e2484 occurs on the other pursuit entry. This proves a degree-based bound for the pursuit-entry angle sample, without asserting its eventual behavioral effect. --- src/overlays/l10/mobys/toxic_crab.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index 90da4dc730..9b39b41b81 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -130,8 +130,8 @@ typedef struct Crab2E30F8 { float home_position_and_heading[4]; char p180[0x10]; float heading_turn_step; - float f194; - float f198; + float pursuit_entry_angle_sample_radians; + float pursuit_entry_angle_bound_degrees; char p19C[4]; float f1A0; float movement_speed; @@ -241,6 +241,9 @@ void toxic_crab_update(Moby2E30F8 *m) { enum { MOBY_STATE_ALTERNATE_REMOVAL_MARKER = 0xFD }; + enum { + TOXIC_CRAB_POINT_AHEAD_NO_TARGET = 2 + }; int see = 0; Crab2E30F8 *crab_data = m->data; char *target_moby; @@ -268,7 +271,7 @@ void toxic_crab_update(Moby2E30F8 *m) { } switch (m->state) { case TOXIC_CRAB_STATE_INITIALIZE: - if (crab_data->remove_in_clank_mode != 0 && ((unsigned char *)&D_0013E533)[0x2EC1] == 1) { + if (crab_data->remove_in_clank_mode != FALSE && ((unsigned char *)&D_0013E533)[0x2EC1] == 1) { mark_moby_for_removal(m); return; } @@ -337,7 +340,7 @@ void toxic_crab_update(Moby2E30F8 *m) { } } } - if (crab_data->tracked_target_selection_status != 2 || crab_data->activation_override_enabled != 0) { + if (crab_data->tracked_target_selection_status != TOXIC_CRAB_POINT_AHEAD_NO_TARGET || crab_data->activation_override_enabled != 0) { m->state = TOXIC_CRAB_STATE_ACTIVATE; crab_data->behavior_timer_frames = scale_game_frames(1); if (m->group_index != 0xFF) { @@ -368,8 +371,8 @@ void toxic_crab_update(Moby2E30F8 *m) { crab_data->pursuit_movement_blocked = 0; qcopy(crab_data->pursuit_progress_sample_position, m->pos); crab_data->fF4 = 0.0f; - x = crab_data->f198 * DEG_TO_RAD; - crab_data->f194 = random_float_between(x, -x); + x = crab_data->pursuit_entry_angle_bound_degrees * DEG_TO_RAD; + crab_data->pursuit_entry_angle_sample_radians = random_float_between(x, -x); if (m->anim != 3) { blend_moby_animation(m, 3, 0, scale_game_frames(5)); } @@ -384,7 +387,7 @@ void toxic_crab_update(Moby2E30F8 *m) { case TOXIC_CRAB_STATE_FACE_TRACKED_POSITION: { float ang = fast_arc_tan(crab_data->tracked_position_x - m->pos[0], crab_data->tracked_position_y - m->pos[1]); FUN_L00_00258278((char *)m, &crab_data->heading_turn_step, ang, 0.02f, 0.3f, frame_time * 6.2831855f); - if (crab_data->tracked_target_selection_status != 2) { + if (crab_data->tracked_target_selection_status != TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { m->state = TOXIC_CRAB_STATE_WAIT_TO_PURSUE; crab_data->behavior_timer_frames = truncate_float_to_s32(random_float_between(0.0f, (float)crab_data->pursuit_delay_upper_bound_frames)); @@ -398,8 +401,8 @@ void toxic_crab_update(Moby2E30F8 *m) { crab_data->pursuit_movement_blocked = 0; qcopy(crab_data->pursuit_progress_sample_position, m->pos); crab_data->fF4 = 0.0f; - x = crab_data->f198 * DEG_TO_RAD; - crab_data->f194 = random_float_between(x, -x); + x = crab_data->pursuit_entry_angle_bound_degrees * DEG_TO_RAD; + crab_data->pursuit_entry_angle_sample_radians = random_float_between(x, -x); if (m->anim != 3) { blend_moby_animation(m, 3, 0, scale_game_frames(5)); } @@ -524,7 +527,7 @@ void toxic_crab_update(Moby2E30F8 *m) { { float home = fast_vec_dist(m->pos, crab_data->home_position_and_heading); if ((hero.vehicle_mode == HERO_VEHICLE_MODE_CLANK ? 1.0f : 30.0f) < home || - crab_data->tracked_target_selection_status == 2) { + crab_data->tracked_target_selection_status == TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { m->state = TOXIC_CRAB_STATE_RETURN_HOME; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); } else if (vector_distance_xy(m->pos, target_moby + 0x10) < @@ -583,7 +586,7 @@ void toxic_crab_update(Moby2E30F8 *m) { { float home = fast_vec_dist(m->pos, crab_data->home_position_and_heading); if ((hero.vehicle_mode == HERO_VEHICLE_MODE_CLANK ? 1.0f : 30.0f) < home || - crab_data->tracked_target_selection_status == 2) { + crab_data->tracked_target_selection_status == TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { m->state = TOXIC_CRAB_STATE_RETURN_HOME; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); } else if (vector_distance_xy(m->pos, target_moby + 0x10) < @@ -641,7 +644,7 @@ void toxic_crab_update(Moby2E30F8 *m) { } else if (m->anim >= 6 && m->anim <= 7 && (m->b70 & 2)) { float home = fast_vec_dist(m->pos, crab_data->home_position_and_heading); if ((((unsigned char *)&D_0013E533)[0x2EC1] == 1 ? 1.0f : 30.0f) < home || - crab_data->tracked_target_selection_status == 2) { + crab_data->tracked_target_selection_status == TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { m->state = TOXIC_CRAB_STATE_RETURN_HOME; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); } else { @@ -720,7 +723,7 @@ void toxic_crab_update(Moby2E30F8 *m) { if (m->anim != 1) { blend_moby_animation(m, 1, 0, scale_game_frames(0x14)); } - } else if (crab_data->tracked_target_selection_status != 2) { + } else if (crab_data->tracked_target_selection_status != TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; crab_data->pursuit_movement_blocked = 0; qcopy(crab_data->pursuit_progress_sample_position, m->pos); From 86c5cc39e3b64ed6124d13a097645e5f420dc82b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:55:52 +0000 Subject: [PATCH 621/758] decomp: clarify names in drek_final_boss_robot_update f2B0 -> persistent_jet_slot_index: Bound C passes BossData int f2B0 to established jet_clear_persistent after restoring the hero and setting race camera. Root retail 0x002f339c-0x002f33a0 loads pvars+0x2B0 into a0 for helper 0x00252588. Checked level-18 helper 0x00252588-0x002525a8 treats a0==0xFF as a sentinel; otherwise it computes 0x0014C050 + (gp[-0x7E7C] << 4) + a0 and stores byte 0xFF. This proves a persistent jet slot index, rather than a moby pointer, node index or scalar setting. --- src/overlays/l18/mobys/drek_final_boss_robot.c | 4 ++-- 1 file changed, 2 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 306357325c..316b6ba403 100644 --- a/src/overlays/l18/mobys/drek_final_boss_robot.c +++ b/src/overlays/l18/mobys/drek_final_boss_robot.c @@ -234,7 +234,7 @@ typedef struct BossData { int class_238_launch_group_index; int race_camera_node_index; char p2A4[0xC]; - int f2B0; + int persistent_jet_slot_index; char p2B4[0x4C]; float f300[4]; float saved_transition_rotation[4]; @@ -641,7 +641,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { char *b = D_L18_001600EC + boss_data->race_camera_node_index * 0x80; set_race_camera(b + 0x30, b + 0x70, 0, 1); } - jet_clear_persistent(boss_data->f2B0); + jet_clear_persistent(boss_data->persistent_jet_slot_index); jet_reset_camera(hero.motion.pos.f, hero.motion.rot.f); show_drek_boss_moby_group((int)moby, boss_data->f204[0]); start_scene(1); From 34d8588d36764ed661ae3558e27eaf681004099c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:58:51 +0000 Subject: [PATCH 622/758] decomp: clarify names in walker_update_gait m10 -> ground_probe_anchor_record: WalkData.m10 is float[8]. Retail 0x002a1c60-0x002a1cac constructs a planar heading offset with zero Z; when flags&1 is set, 0x002a1cb0-0x002a1cbc passes gait_data+0x10 as the third fast_vec_add operand. The translated position is passed to probe_ground_height at 0x002a1ce0-0x002a1ce8 and its Z participates in terrain-height comparison at 0x002a1d40-0x002a1d60. Run repeats that translation at 0x002a34b0-0x002a34bc; landing recovery always uses it at 0x002a3c44-0x002a3c64. The supplied C and original Ghidra agree. Thus this record supplies the ground-probe anchor position; no meaning is asserted for its other five floats. m30 -> alternate_ground_probe_anchor_record: WalkData.m30 is float[8]. When flags&1 is clear, retail 0x002a1ca8 branches to 0x002a1cc8-0x002a1cd4, passing gait_data+0x30 to fast_vec_add with the heading-derived offset. The translated XYZ is immediately ground-probed at 0x002a1ce0-0x002a1ce8, and returned height minus probe Z selects terrain gait transitions. The RUN path repeats the same alternative anchor selection at 0x002a34a8 and 0x002a34c8-0x002a34d4 before raising probe Z by one and probing. Original Ghidra and C agree that it is paired with m10. Alternate identifies this flags&1-clear choice only; the remaining five floats are not interpreted. --- src/overlays/shared/enemies/walker_update_gait.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/enemies/walker_update_gait.c b/src/overlays/shared/enemies/walker_update_gait.c index 360cc7321c..15d5c40d1f 100644 --- a/src/overlays/shared/enemies/walker_update_gait.c +++ b/src/overlays/shared/enemies/walker_update_gait.c @@ -132,8 +132,8 @@ typedef struct WalkAnim { typedef struct WalkData { char pad00[0x10]; - float m10[8]; /* 0x10 */ - float m30[8]; /* 0x30 */ + float ground_probe_anchor_record[8]; /* 0x10 */ + float alternate_ground_probe_anchor_record[8]; /* 0x30 */ char pad50[0x10]; float jump_target_position[3]; /* 0x60 */ float f6C; @@ -329,9 +329,9 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f; ground_probe_position[2] = 0.0f; if (flags & 1) { - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->m10); + fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); } else { - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->m30); + fast_vec_add(ground_probe_position, ground_probe_position, gait_data->alternate_ground_probe_anchor_record); } ground_height = probe_ground_height(ground_probe_position, 0, 0.5f); gait_data->fE4 = ground_height; @@ -916,9 +916,9 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(movement_heading) * gait_data->anim[0]->f04 * 0.5f; ground_probe_position[2] = 0.0f; if (flags & 1) { - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->m10); + fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); } else { - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->m30); + fast_vec_add(ground_probe_position, ground_probe_position, gait_data->alternate_ground_probe_anchor_record); } ground_probe_position[2] += 1.0f; gait_data->fE4 = probe_ground_height(ground_probe_position, 0, 0.5f); @@ -1090,7 +1090,7 @@ void walker_update_gait(WalkMoby *walker_moby, ground_probe_position[0] = fast_cos(movement_heading) * gait_data->anim[7]->f04 * 0.5f; ground_probe_position[1] = fast_sin(movement_heading) * gait_data->anim[7]->f04 * 0.5f; ground_probe_position[2] = 0.0f; - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->m10); + fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); ground_probe_position[2] += 1.0f; gait_data->fE4 = probe_ground_height(ground_probe_position, 0, 0.5f); } @@ -1115,7 +1115,7 @@ void walker_update_gait(WalkMoby *walker_moby, ground_probe_position[0] = fast_cos(movement_heading) * gait_data->anim[7]->f04 * 0.5f; ground_probe_position[1] = fast_sin(movement_heading) * gait_data->anim[7]->f04 * 0.5f; ground_probe_position[2] = 0.0f; - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->m10); + fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); ground_probe_position[2] += 1.0f; gait_data->fE4 = probe_ground_height(ground_probe_position, 0, 0.5f); } From 5ad40b871bbffd0c69de3920aef94445bc2f2bb9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:03:10 +0000 Subject: [PATCH 623/758] decomp: clarify names in big_axebot_update f31 -> proximity_ground_probe_enabled: M_B7B0.f31 -> proximity_ground_probe_enabled: Assigned retail 002ba5a4..002ba5d8 and 002ba6d0..002ba708 test moby+0x31 for nonzero before distance checks against D_L04_00166F40 (27 and 32) and calls to 0024d150. Checked helper request e6f70ef4fa4b4f9f90d29ba32d6fae62 shows 0024d160..0024d1c0 copying owner position into endpoints, lowering one endpoint Z by 16 with a 0.5 floor, raising the other Z by 0.5, and calling the collision query with mask 0x22. On a hit, 0024d1dc..0024d1f4 writes queried height minus/plus 0.2 into owner+0x84/+0x88; on a miss both are cleared. Thus the eligible byte enables nearby vertical ground probing in this update. The supplied axe spawn also initializes its +0x31 byte to 1. This is an observed consumer-role name, not an assertion of all engine uses. --- src/overlays/l04/mobys/big_axebot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l04/mobys/big_axebot.c b/src/overlays/l04/mobys/big_axebot.c index cec273a37f..873b19ed54 100644 --- a/src/overlays/l04/mobys/big_axebot.c +++ b/src/overlays/l04/mobys/big_axebot.c @@ -188,7 +188,7 @@ typedef struct M_B7B0 { V4_B7B0 pos; unsigned char state; char pad21[0x10]; - unsigned char f31; + unsigned char proximity_ground_probe_enabled; char pad32[2]; unsigned short f34; char pad36[0xA]; @@ -329,7 +329,7 @@ void big_axebot_update(M_B7B0 *moby) { flag = 1; } FUN_L00_00263ac8(2.5f, (int)moby, 0, (unsigned char *)&data->recoil_manipulator); - if (moby->f31 != 0) { + if (moby->proximity_ground_probe_enabled != 0) { if (fast_vec_dist(moby->pos, D_L04_00166F40) < 27.0f) { FUN_L00_0025a120(moby); moby->f7F = 0x15; @@ -355,7 +355,7 @@ void big_axebot_update(M_B7B0 *moby) { qcopy(initial_position_snapshot, moby->pos); qcopy(dest, moby->pos); qcopy(tpos, tg.pos); - if (moby->f31 != 0) { + if (moby->proximity_ground_probe_enabled != 0) { if (fast_vec_dist(moby->pos, D_L04_00166F40) < 32.0f) { FUN_L00_0025a120(moby); moby->f7F = 0x1A; From 4c9266d0891a547100bd636e72b28a16b8fea1d3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:05:02 +0000 Subject: [PATCH 624/758] decomp: clarify names in woodcut_bot_update f217 -> leg_rig_animation_mode: f217 -> leg_rig_animation_mode: authoritative src/overlays/l04/mobys/woodcut_bot.c SHA-256 0b8703c05b0b53949f1dc181fb7277ddb01437ee8ccd9c0094c60f997acb281b passes d+0x160 to leg_walker_update. Assigned retail 0x002d2b30-0x002d2b78 requests zero movement and waits for d+0x217 to become zero before leaving STOP_MOVEMENT. Checked level-04 walker evidence request 435a2418a5744fbb9459d661d480e9c6 binds this record to s2 at 0x00295790, so its +0xB7 is f217. At 0x00295c9c-0x00295cbc the byte is compared with 0x12 to conditionally bypass animation handling when current animation matches record+0xA0. At 0x00295ccc-0x00295d98 zero bypasses animation-record scanning; nonzero scans thirteen animation records, matches current animation at moby+0x52, and sets playback scale at moby+0x58 using movement step/record stride. This proves a leg-rig animation control mode rather than a boolean moving flag; individual mode meanings remain unknown. --- 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 da32f4fa4e..3a1dc98dc3 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -225,7 +225,7 @@ typedef struct WBData { /* 0x122 */ char pad122[0xE]; /* 0x130 */ char recoil_rotation[0x30]; /* 0x160 */ char leg_rig_movement_data[0xB7]; - /* 0x217 */ unsigned char f217; + /* 0x217 */ unsigned char leg_rig_animation_mode; /* 0x218 */ char pad218[0x198]; /* 0x3B0 */ float initial_position[4]; /* 0x3C0 */ unsigned char initial_debris_animation_enabled; @@ -795,7 +795,7 @@ void woodcut_bot_update(WBMoby *m) { m->state = WOODCUT_BOT_MELEE_ATTACK; } else { leg_walker_update(m, d->leg_rig_movement_data, frame_time * 0.0f, m->rot[2], frame_time_sq * 20.0f); - if (d->f217 == 0) { + if (d->leg_rig_animation_mode == 0) { if (excited) { m->state = WOODCUT_BOT_SELECT_ACTION_WHILE_EXCITED; } else { From 551abfc732ad98f432067bcfbb58229d950ea851 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:19:52 +0000 Subject: [PATCH 625/758] decomp: clarify names in snow_plow_update domain_0_value_1 -> SNOW_PLOW_MOVE_TO_CLIP_VOLUME: Retail 0x002ca8a8-0x002ca8d4 saves owner position/heading, selects the containing clip-volume index and writes 1 to pvars+0x149 at 0x002ca8bc. The identical byte is dispatched at 0x002ca564-0x002ca56c to 0x002ca63c, which turns toward and moves toward the selected l04_cuboids position/heading. Authoritative C switches on snow_plow_vars->clip_volume_movement_state using existing SNOW_PLOW_MOVE_TO_CLIP_VOLUME=1, proving reuse in this assignment. domain_1_value_2 -> SNOW_PLOW_WAIT_BEFORE_RETURN: Retail 0x002ca69c-0x002ca71c tests selected-volume XY distance below 1 and heading difference below 0.17453292, then writes 2 to pvars+0x149 at 0x002ca718 and starts scaled 300 frames at +0x14a. Dispatch of that same byte routes 2 to 0x002ca780, waiting for timer zero before entering return movement. This is the existing C selector member SNOW_PLOW_WAIT_BEFORE_RETURN=2. domain_2_value_3 -> SNOW_PLOW_RETURN_TO_SAVED_TRANSFORM: Retail 0x002ca780-0x002ca794 waits for pvars+0x14a zero, clears turn step and writes 3 to pvars+0x149. The same byte dispatch at 0x002ca594 sends 3 to 0x002ca798, turning toward saved heading +0x14c and stepping toward saved position +0x160 through 0x002ca904. Authoritative C already labels this exact selector branch SNOW_PLOW_RETURN_TO_SAVED_TRANSFORM=3; it is separate from owner Moby state +0x20. domain_3_value_0 -> SNOW_PLOW_SCAN_CLIP_VOLUMES: Retail 0x002ca7e4-0x002ca838 tests distance and heading to saved transform, then writes zero to pvars+0x149 and starts scaled 600-frame cooldown. Dispatch of that same byte at 0x002ca564-0x002ca580 routes zero to the four-candidate clip-volume scan at 0x002ca5ec-0x002ca630, gated by cooldown. Authoritative C already names this exact selector case SNOW_PLOW_SCAN_CLIP_VOLUMES=0, proving canonical reuse. --- src/overlays/l04/mobys/snow_plow.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l04/mobys/snow_plow.c b/src/overlays/l04/mobys/snow_plow.c index 9c50c14b4f..60c95d6754 100644 --- a/src/overlays/l04/mobys/snow_plow.c +++ b/src/overlays/l04/mobys/snow_plow.c @@ -186,7 +186,7 @@ void snow_plow_update(struct Moby *moby) { is_point_inside_clip_volume(&moby->pos, p[i])) { qcopy(snow_plow_vars->saved_return_position, &moby->pos); snow_plow_vars->selected_clip_volume_index = *(unsigned char *)&p[i]; - snow_plow_vars->clip_volume_movement_state = 1; + snow_plow_vars->clip_volume_movement_state = SNOW_PLOW_MOVE_TO_CLIP_VOLUME; snow_plow_vars->saved_return_heading = moby->rot.z; *(int *)&snow_plow_vars->unk7C = 0; moby->state = SNOW_PLOW_WAIT_TO_RESUME_PATH; @@ -207,7 +207,7 @@ void snow_plow_update(struct Moby *moby) { if (vector_distance_xy(&moby->pos, &l04_cuboids[snow_plow_vars->selected_clip_volume_index].pos) < 1.0f && fast_difference_between_rotations( moby->rot.z, l04_cuboids[snow_plow_vars->selected_clip_volume_index].rot.z) < 0.17453292f) { - snow_plow_vars->clip_volume_movement_state = 2; + snow_plow_vars->clip_volume_movement_state = SNOW_PLOW_WAIT_BEFORE_RETURN; snow_plow_vars->clip_volume_movement_timer = scale_game_frames(300); } fast_vec_sub(&delta, &l04_cuboids[snow_plow_vars->selected_clip_volume_index].pos, &moby->pos); @@ -217,7 +217,7 @@ void snow_plow_update(struct Moby *moby) { case SNOW_PLOW_WAIT_BEFORE_RETURN: if (snow_plow_vars->clip_volume_movement_timer == 0) { snow_plow_vars->unk7C = amount; - snow_plow_vars->clip_volume_movement_state = 3; + snow_plow_vars->clip_volume_movement_state = SNOW_PLOW_RETURN_TO_SAVED_TRANSFORM; } break; case SNOW_PLOW_RETURN_TO_SAVED_TRANSFORM: @@ -230,7 +230,7 @@ void snow_plow_update(struct Moby *moby) { if (vector_distance_xy(&moby->pos, snow_plow_vars->saved_return_position) < 1.0f && fast_difference_between_rotations(moby->rot.z, snow_plow_vars->saved_return_heading) < 0.034906585f) { - snow_plow_vars->clip_volume_movement_state = 0; + snow_plow_vars->clip_volume_movement_state = SNOW_PLOW_SCAN_CLIP_VOLUMES; snow_plow_vars->clip_volume_movement_timer = scale_game_frames(600); snow_plow_vars->unkFC = amount; snow_plow_vars->unk7C = amount; From 153a1ebd0f91ee186a3a7fa4d45d3d076673f6f9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:54:13 +0000 Subject: [PATCH 626/758] decomp: clarify names in update_spinning_fade_in_out_effect_particle w14 -> packed_rgb_color: The supplied creator spawn_spinning_fade_in_out_effect_particle stores color & 0xFFFFFF at particle_data+0x14 (particle+0x34), proving the stored u32 contains packed RGB without alpha. In assigned retail, s2=particle+0x20 at 0026b924; lw from 0x14(s2) at 0026b990, 0026b9dc and 0026ba40 supplies the same unchanged color channels. At 0026b988-0026b990 it is ORed with 0x7F000000, and at 0026ba44-0026ba4c it is ORed with a calculated alpha shifted left 24 and stored to particle+4. Exact C uses Body.w14 in these three color assignments, establishing packed_rgb_color rather than an offset-only interpretation. --- .../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 a975fa060d..c8d2299e14 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 @@ -1069,7 +1069,7 @@ typedef struct { u8 p9[3]; f32 fC; f32 f10; - u32 w14; + u32 packed_rgb_color; } Body; typedef struct { @@ -1098,14 +1098,14 @@ void update_spinning_fade_in_out_effect_particle(Part_26b910 *particle) { if (fast_dec_timer_s16(&particle->hA)) { particle_data->w4 = 1; particle->hA = FUN_001f96f8_0026b910(30); - particle->w4 = particle_data->w14 | 0x7F000000; + particle->w4 = particle_data->packed_rgb_color | 0x7F000000; } else { int fade_in_duration = FUN_001f96f8_0026b910(10); float k = 96.0f / (float)FUN_001f96f8_0026b910(10); particle->w4 = ((truncate_float_to_s32((float)(fade_in_duration - particle->hA) * k) + 0x20) << 24) | - particle_data->w14; + particle_data->packed_rgb_color; } } else { if (fast_dec_timer_s16(&particle->hA)) { @@ -1115,7 +1115,7 @@ void update_spinning_fade_in_out_effect_particle(Part_26b910 *particle) { particle->w4 = (truncate_float_to_s32((float)particle->hA * (127.0f / (float)FUN_001f96f8_0026b910(30))) << 24) | - particle_data->w14; + particle_data->packed_rgb_color; } } From 09fb80eef3049e465a84fed9465486b788f10eb1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:57:14 +0000 Subject: [PATCH 627/758] decomp: clarify names in update_three_phase_motion_alpha_fade_particle h14 -> final_phase_duration_frames: R_274e48 begins at particle+0x20 (s3 set at 0x00274e64). At 0x002750b8-0x002750c4, lhu v0,0x14(s3) loads h14, clears the middle phase marker at r+0x12, and stores h14 into the particle countdown at +0xA. Once r->h10 and r->h12 are zero, the final branch applies the final motion vector; 0x002750f0-0x00275108 converts the remaining particle timer and signed h14 to floats and divides remaining time by h14 for the alpha tween against color & 0x00FFFFFF. 0x0027511c-0x00275130 decrements that timer and frees the particle on expiry. The authoritative C and original decompilation both show the same reload and fade denominator, proving h14 stores final phase duration in countdown frames rather than a live countdown. --- 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 b1e194dc8e..2533c2bc18 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -1844,7 +1844,7 @@ typedef struct { s32 iC; s16 h10; s16 h12; - s16 h14; + s16 final_phase_duration_frames; u8 p16[2]; f32 *motion_target_position; } R_274e48; @@ -1912,7 +1912,7 @@ void update_three_phase_motion_alpha_fade_particle(M_274e48 *particle) { fast_vec_add(&particle->v10, &particle->v10, &applied_motion_delta); if (fast_dec_timer_s16(&particle->hA)) { r->h12 = 0; - particle->hA = r->h14; + particle->hA = r->final_phase_duration_frames; } } else { load_display_text_resource_entry(&applied_motion_delta, (u8 *)r + 4); @@ -1921,7 +1921,7 @@ void update_three_phase_motion_alpha_fade_particle(M_274e48 *particle) { particle->packed_particle_color = FUN_001fa6e0_274e48(color_without_alpha, particle->packed_particle_color, convert_integer_to_float(particle->hA) / - convert_integer_to_float(r->h14)); + convert_integer_to_float(r->final_phase_duration_frames)); if (fast_dec_timer_s16(&particle->hA)) free_effect_particle(particle); } From 2dab1ee54fa78f99cb4b5a8e4ab1d97f589f09ff Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:57:16 +0000 Subject: [PATCH 628/758] decomp: clarify names in linked_moby_states_update w4 -> linked_moby_selection_timer: The private int is initialized from linked_moby_selection_delay_gp at retail 0x002b34c0/0x002b34dc. When one of four linked mobys has state 0x50, 0x002b35c0-0x002b35c8 passes its address to fast_dec_timer and gates selection on the return. 0x002b35cc-0x002b35dc reloads it before the four-pointer scan that selects a moby, sets state 0x51 and copies source position. Authoritative C w4 and original Ghidra private+4 accesses agree, proving the linked-moby selection timer role. w8 -> remaining_owned_record_events: Retail 0x002b3494/0x002b34e0 initializes this private int to three. After find_moby_hit(source_moby,0x10000,0) returns nonzero and private+0xC is zero (0x002b34fc-0x002b351c), 0x002b352c-0x002b3540 decrements and stores this count; a nonpositive count calls mark_moby_for_removal at 0x002b3544-0x002b3548. Authoritative C --w8 and original Ghidra private+8 agree. Thus it counts remaining accepted matching-owned-record events before removal, without asserting damage semantics. wC -> owned_record_cooldown_timer: Retail 0x002b3508-0x002b350c passes private+0xC to fast_dec_timer each active update. 0x002b3510-0x002b351c requires both a matching owned-record return and this int equal to zero before clearing the hit slot and decrementing the removal count. 0x002b3530/0x002b3538 reloads this int from owned_record_cooldown_gp after accepting that event. Authoritative C wC and original Ghidra private+0xC accesses agree, proving a timer that limits acceptance of matching owned records. --- .../weapons/linked_moby_states_update.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/shared/weapons/linked_moby_states_update.c b/src/overlays/shared/weapons/linked_moby_states_update.c index 578eb6afaf..28def6fe34 100644 --- a/src/overlays/shared/weapons/linked_moby_states_update.c +++ b/src/overlays/shared/weapons/linked_moby_states_update.c @@ -9,9 +9,9 @@ typedef struct { int w0; - int w4; - int w8; - int wC; + int linked_moby_selection_timer; + int remaining_owned_record_events; + int owned_record_cooldown_timer; int idx[4]; unsigned char *p[4]; } V_2b3458; @@ -71,8 +71,8 @@ void linked_moby_states_update(unsigned char *source_moby) { switch (MOBY(source_moby)->state) { case STATE_INITIALIZE: MOBY(source_moby)->state = STATE_ACTIVE; - moby_vars->w4 = linked_moby_selection_delay_gp; - moby_vars->w8 = 3; + moby_vars->linked_moby_selection_timer = linked_moby_selection_delay_gp; + moby_vars->remaining_owned_record_events = 3; moby_vars->p[0] = moby_table + (moby_vars->idx[0] << 8); moby_vars->p[1] = moby_table + (moby_vars->idx[1] << 8); moby_vars->p[2] = moby_table + (moby_vars->idx[2] << 8); @@ -80,11 +80,11 @@ void linked_moby_states_update(unsigned char *source_moby) { break; case STATE_ACTIVE: matching_owned_record = find_moby_hit(source_moby, 0x10000, 0); - fast_dec_timer(&moby_vars->wC); - if (matching_owned_record && moby_vars->wC == 0) { + fast_dec_timer(&moby_vars->owned_record_cooldown_timer); + if (matching_owned_record && moby_vars->owned_record_cooldown_timer == 0) { MOBY(source_moby)->hit_slot = 0xFF; - moby_vars->wC = owned_record_cooldown_gp; - if (--moby_vars->w8 <= 0) { + moby_vars->owned_record_cooldown_timer = owned_record_cooldown_gp; + if (--moby_vars->remaining_owned_record_events <= 0) { mark_moby_for_removal(source_moby); return; } @@ -101,8 +101,8 @@ void linked_moby_states_update(unsigned char *source_moby) { test: if (moby_vars->p[0][0x20] == 0x50 || moby_vars->p[1][0x20] == 0x50 || moby_vars->p[2][0x20] == 0x50 || moby_vars->p[3][0x20] == 0x50) { - if (fast_dec_timer(&moby_vars->w4)) { - moby_vars->w4 = linked_moby_selection_delay_gp; + if (fast_dec_timer(&moby_vars->linked_moby_selection_timer)) { + moby_vars->linked_moby_selection_timer = linked_moby_selection_delay_gp; for (i = 0; i < 4; i++) { if (moby_vars->p[i][0x20] == 0x50) goto found; From af3e929bc0067f0246889085f31ea9dbe0fccd3b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:57:19 +0000 Subject: [PATCH 629/758] decomp: clarify names in update_crate_stack_motion fB0 -> crate_height: Retail 0x002d1804-0x002d1834 loads vars+0xB0, multiplies by 0.75 and adds it to the copied crate position Z to raise collision_start for the downward line query at 0x002d1840. Current source uses vars->fB0 in precisely that expression. The supplied same-file ground_attached_update view identifies the same pvars+0xB0 as height, initializes it to 1.0f, and raises its stack-base probe by height*0.5f. Together the geometry and same-layout use establish crate height, rather than an offset-only interpretation. fF4 -> attachment_stack_z_offset: Retail 0x002d1674-0x002d170c passes vars+0xF4 by address to approach_value, targeting zero for the bottom crate or parent pvars+0xF4 plus 1.0 for a stacked crate. At 0x002d1714-0x002d1730 it adds this scalar to the Z of the copied attachment position, then 0x002d1794-0x002d17a0 subtracts it when saving the attachment position back. Current C vars->fF4 follows the same flow, establishing a stack Z offset applied before attachment pose transformation. iB4 -> last_motion_update_frame: Retail 0x002d142c-0x002d1470 compares pvars+0xB4 against the current frame counter at 0x0015F5CC and immediately exits if equal; 0x002d1514-0x002d1518 stores that frame into each visited crate's pvars+0xB4. Current C vars->iB4 has these exact read/write uses. Supplied crate_update additionally calls this function only when the corresponding frameB4 differs from the current frame, proving this records the last stack-motion update frame. vD0 -> attachment_position: Retail 0x002d1714-0x002d1730 copies the 16-byte vector at vars+0xD0, adds the stack Z offset, and 0x002d1764-0x002d1770 passes it as the position argument to transform_attachment_pose/FUN_L00_002604f0 with vars+0xE0 as rotation and moby+0x10/+0x40 as output pose. 0x002d178c-0x002d17a0 conditionally saves the position back after removing the stack offset. Current vars->vD0 and supplied helper C confirm position input semantics; ground_attached_update stores converted reference-local link_pos at this same pvars location. vE0 -> attachment_rotation: Retail 0x002d1758-0x002d1770 passes vars+0xE0 in a3 as transform_attachment_pose's rotation input, alongside adjusted vars+0xD0 position and moby position/rotation outputs. Current source passes vars->vE0 in precisely that argument. The supplied helper feeds that input to euler_rotation_matrix before composing with the reference basis, and ground_attached_update saves converted reference-local link_rot at the corresponding pvars+0xE0. This proves an attachment rotation, preserving the existing u8[0x10] storage. --- src/overlays/shared/pickups/crate.c | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/overlays/shared/pickups/crate.c b/src/overlays/shared/pickups/crate.c index 5b7db716c6..e6eebecc94 100644 --- a/src/overlays/shared/pickups/crate.c +++ b/src/overlays/shared/pickups/crate.c @@ -180,13 +180,13 @@ typedef struct O2d1428 { struct M2d1428 *parent; u8 pa8[4]; s32 flags; - f32 fB0; - s32 iB4; + f32 crate_height; + s32 last_motion_update_frame; u8 pb8[0x18]; - V2d1428 vD0; - u8 vE0[0x10]; + V2d1428 attachment_position; + u8 attachment_rotation[0x10]; void *path; - f32 fF4; + f32 attachment_stack_z_offset; } O2d1428; struct M2d1428 { @@ -1257,7 +1257,7 @@ void update_crate_stack_motion(M2d1428 *moby) { s32 hit; vars = moby->vars; - if (vars->iB4 == D_L00_0015F5CC) + if (vars->last_motion_update_frame == D_L00_0015F5CC) return; chain_cursor = moby; do { @@ -1276,7 +1276,7 @@ void update_crate_stack_motion(M2d1428 *moby) { return; if (vars->flags & 2) return; - vars->iB4 = D_L00_0015F5CC; + vars->last_motion_update_frame = D_L00_0015F5CC; if (moby->state == CRATE_STATE_INITIALIZE) continue; fast_vec_sub(&hero_local_offset, &hero.motion.pos, &moby->pos); @@ -1299,26 +1299,26 @@ void update_crate_stack_motion(M2d1428 *moby) { if (vars->path) { if (vars->parent == 0) { vars->vel.w -= acceleration_scale_or_speed * 10.0f; - if (approach_value(&vars->fF4, 0.0f, absolute_float(vars->vel.w)) == 0.0f) + if (approach_value(&vars->attachment_stack_z_offset, 0.0f, absolute_float(vars->vel.w)) == 0.0f) vars->vel.w = 0.0f; } else { vars->vel.w -= acceleration_scale_or_speed * 10.0f; - if (approach_value(&vars->fF4, - vars->parent->vars->fF4 + 1.0f, + if (approach_value(&vars->attachment_stack_z_offset, + vars->parent->vars->attachment_stack_z_offset + 1.0f, absolute_float(vars->vel.w)) == 0.0f) *(s32 *)&vars->vel.w = 0; } - qcopy(&adjusted_link_position, &vars->vD0); - adjusted_link_position.z += vars->fF4; + qcopy(&adjusted_link_position, &vars->attachment_position); + adjusted_link_position.z += vars->attachment_stack_z_offset; if (moby) moby->h36 = 0x7F80; qcopy(&previous_position, &moby->pos); qcopy(&previous_rotation, &moby->v40); transform_attachment_pose( - moby, vars->path, &adjusted_link_position, vars->vE0, &moby->pos, &moby->v40); + moby, vars->path, &adjusted_link_position, vars->attachment_rotation, &moby->pos, &moby->v40); if (FUN_L00_002603d0(vars->path)->flags & 4) { - qcopy(&vars->vD0, &adjusted_link_position); - vars->vD0.z -= vars->fF4; + qcopy(&vars->attachment_position, &adjusted_link_position); + vars->attachment_position.z -= vars->attachment_stack_z_offset; } fast_vec_sub(&position_delta, &moby->pos, &previous_position); position_delta.w = vars->vel.w; @@ -1329,7 +1329,7 @@ void update_crate_stack_motion(M2d1428 *moby) { if (vars->parent == 0) { qcopy(&collision_start, &moby->pos); qcopy(&collision_end, &moby->pos); - collision_start.z += vars->fB0 * 0.75f; + collision_start.z += vars->crate_height * 0.75f; collision_end.z += vars->vel.z; hit = collision_line(&collision_start, &collision_end, 2, 0, 0); qcopy(&landing_position, &collision_hit_point); From 2ae32da4cd5328229fee60d6c79edf5ab8b94c86 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:57:22 +0000 Subject: [PATCH 630/758] decomp: clarify names in birdbot_projectile_update hA6 -> collision_probe_id: In birdbot_projectile_update, retail 0x002fa5ec loads the projectile's u16 at +0xa6 and 0x002fa60c stores it at sp+0x2a, the id member of the DropProbe beginning at sp+0x10. Original Ghidra agrees: uStack_a6 = *(undefined2 *)(iVar5 + 0xa6). The authoritative C expresses this as probe.id = projectile->hA6. Retail 0x002fa650/0x002fa654 passes that probe to collision_line, and 0x002fa6b4/0x002fa6bc passes the same probe to probe_world_sphere. Thus the member supplies the collision probe identifier, without asserting its deeper identifier domain. --- src/overlays/l01/mobys/birdbot_projectile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/birdbot_projectile.c b/src/overlays/l01/mobys/birdbot_projectile.c index f1c3d21086..ce53419f4e 100644 --- a/src/overlays/l01/mobys/birdbot_projectile.c +++ b/src/overlays/l01/mobys/birdbot_projectile.c @@ -208,7 +208,7 @@ typedef struct { u8 pad20[0x58]; DropVars *vars; u8 pad7C[0x2A]; - u16 hA6; + u16 collision_probe_id; } DropMoby; typedef struct { @@ -269,7 +269,7 @@ void birdbot_projectile_update(DropMoby *projectile) { ((f32 *)&probe.dir)[3] = 5627.9248f; probe.b28 = 1; probe.b29 = 1; - probe.id = projectile->hA6; + probe.id = projectile->collision_probe_id; if (fast_dec_timer(projectile_vars->sound) != 0) { burst_position = projectile->pos.q; spawn_explosion_effects(projectile, &burst_position, 0, 0.5f, zero); From b8dc629c4cf2d4659dedd2592d851dbb5ebcda54 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:59:23 +0000 Subject: [PATCH 631/758] decomp: clarify names in spawn_bomber_jet_beam w40 -> rotation_vector_x_bits: Authoritative bomber_jet.c SHA-256 5e6ed4697649844da847cfb163f2bc857fc58bfc2d17dc921988d562ae614fe9 declares s32 w40 preceding rot_x and rot_z. Retail 0x002f691c clears moby+0x40; 0x002f6938-0x002f6960 derives two angles from the direction and stores them at +0x44/+0x48. Checked direct update helper 0x00265bd8 loads the entire +0x40 rotation vector into vf1 at 0x00265c08, so this word occupies vf1.x; vcallms 0x1a3 at 0x00265c0c produces vf20/vf21/vf22, stored at +0xc0/+0xd0/+0xe0 and used as transform basis vectors at 0x00265c64-0x00265c6c. The name describes the raw first rotation-vector lane, preserving the existing s32 storage. --- src/overlays/l01/mobys/bomber_jet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/bomber_jet.c b/src/overlays/l01/mobys/bomber_jet.c index 02ecbfa2fb..4cd14642ff 100644 --- a/src/overlays/l01/mobys/bomber_jet.c +++ b/src/overlays/l01/mobys/bomber_jet.c @@ -71,7 +71,7 @@ typedef struct { u8 b31; s16 h32; u8 pad34[0xC]; - s32 w40; + s32 rotation_vector_x_bits; f32 rot_x; f32 rot_z; u8 pad4c[0x2C]; @@ -103,7 +103,7 @@ BeamMoby *spawn_bomber_jet_beam(void *owner, u128 *pos, u128 *dir, u128 *color, if (created_moby != NULL) { beam_vars = created_moby->vars; beam_vars->owner = owner; - created_moby->w40 = 0; + created_moby->rotation_vector_x_bits = 0; created_moby->b30 = 0xFF; created_moby->h32 = 0xFF; created_moby->b31 = 1; From 89bd448b2ed27b0fbc64001edd243c5a839bfca4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:59:26 +0000 Subject: [PATCH 632/758] decomp: clarify names in FUN_L01_002ffcd0 h32 -> draw_distance: Retail create call at 0x002ffcf0 saves the Moby result in s1 at 0x002ffcf8. li v1,0x40 at 0x002ffd14 and sh v1,0x32(s1) at 0x002ffd24 exactly bind OrbMoby.h32 = 0x40. The established include/rnc/mobys/moby.h names this signed halfword draw_dist, following scale and the update_dist/visible bytes. This function also scales the same Moby at +0x2c and initializes update_distance at +0x30, corroborating the instance-prefix binding and draw-distance initialization rather than an arbitrary private halfword. w40 -> rotation_x_bits: Retail sw zero,0x40(s1) at 0x002ffd1c binds OrbMoby.w40 = 0 on the create_moby result saved at 0x002ffcf8. The established struct Moby has Vec4f rot at this location after u64 spawn_frame; its first component is X. The same assigned function obtains random_angle_radians at 0x002ffd2c and stores the returned float at +0x48 at 0x002ffd34, matching the existing OrbMoby.rotz and independently identifying this block as the rotation vector. Thus the word clear initializes the X rotation representation to zero. rotation_x_bits preserves the existing s32 storage rather than claiming an integer angle or altering its type. --- src/overlays/l01/mobys/pool_tiles_and_effects.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l01/mobys/pool_tiles_and_effects.c b/src/overlays/l01/mobys/pool_tiles_and_effects.c index 2efb301614..456c0cf874 100644 --- a/src/overlays/l01/mobys/pool_tiles_and_effects.c +++ b/src/overlays/l01/mobys/pool_tiles_and_effects.c @@ -458,9 +458,9 @@ typedef struct { f32 scale; u8 update_distance; u8 b31; - s16 h32; + s16 draw_distance; u8 pad34[0xC]; - s32 w40; + s32 rotation_x_bits; u8 pad44[4]; f32 rotz; u8 pad4C[0x2C]; @@ -477,8 +477,8 @@ OrbMoby *FUN_L01_002ffcd0(u128 *pos, f32 scale) { if (spawned_moby != 0) { spawned_moby_vars = spawned_moby->pvars; copy_hero_moby_field_38(spawned_moby); - spawned_moby->w40 = 0; - spawned_moby->h32 = 0x40; + spawned_moby->rotation_x_bits = 0; + spawned_moby->draw_distance = 0x40; spawned_moby->update_distance = 0xFF; spawned_moby->scale = spawned_moby->scale * scale; spawned_moby->rotz = random_angle_radians(); From 3c53c20fd9415416612c971faf6b1d0566b7e13d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:59:29 +0000 Subject: [PATCH 633/758] decomp: clarify names in check_oscillating_toxic_gas_vent_collisions h1A -> vent_moby_class: At retail 0x002f416c s4 receives the vent moby argument. 0x002f4230 loads its unsigned halfword at +0xA6 and 0x002f425c stores it in the collision record at sp+0x1A; the original decompilation likewise assigns uStack_f6 = *(undefined2 *)(iVar3 + 0xa6). This record is passed fifth to collision_line at 0x002f4338/0x002f433c. The authoritative C's companion check_timed_toxic_gas_vent_collisions explicitly populates the corresponding collision-record slot with (unsigned short)MOBY(vent_moby)->oclass. This typed use identifies the copied value as the vent moby's object class, beyond the offset alone. --- src/overlays/l06/mobys/toxic_gas_vent.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l06/mobys/toxic_gas_vent.c b/src/overlays/l06/mobys/toxic_gas_vent.c index 2c487945f9..1640e76b97 100644 --- a/src/overlays/l06/mobys/toxic_gas_vent.c +++ b/src/overlays/l06/mobys/toxic_gas_vent.c @@ -65,7 +65,7 @@ typedef struct { int flags; char b18; char b19; - unsigned short h1A; + unsigned short vent_moby_class; float f1C; int i20; } Sx; @@ -281,7 +281,7 @@ void check_oscillating_toxic_gas_vent_collisions(char *m) { collision_params.fC = 5627.9248f; collision_params.b18 = 3; collision_params.b19 = one; - collision_params.h1A = *(unsigned short *)(m + 0xA6); + collision_params.vent_moby_class = *(unsigned short *)(m + 0xA6); for (i = 3; i >= 0; i--) { segment_start_radius = remaining_radius; ra = fast_add_rotations(*(float *)(moby_data + 0x84), From b96cfd9980f251de3a1426ae5f52adf3254b9f2b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:59:32 +0000 Subject: [PATCH 634/758] decomp: clarify names in update_path_camera fB0 -> tan_half_fov: Authoritative src/overlays/l14/path_camera.c SHA-256 eb8d8fc6329d41b594d41037839ed8c018124138fe1967fa69a742f6b1139971 declares VendorView_5290.fB0 and binds l14_camera_projection_state to D_L14_0016D140. Retail 0x003154a4-0x003154dc halves the end FOV, calls the source-bound fast_sin and fast_cos, divides sine by cosine and stores to 0x0016d1f0. Retail 0x00315728-0x00315768 converts interpolated stop FOV from degrees to radians, halves it, computes the same sine/cosine quotient, and stores at +0xb0 of 0x0016d140 before update_view_context. Original Ghidra fRam0016d1f0 and current C agree on both writes. Setup also recovers full end FOV through fast_arc_tan(1.0f, this field) * 2.0f. Thus the field holds tan(half FOV), not an offset-derived guess. --- src/overlays/l14/path_camera.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l14/path_camera.c b/src/overlays/l14/path_camera.c index ec7da83da0..1d217fd5ee 100644 --- a/src/overlays/l14/path_camera.c +++ b/src/overlays/l14/path_camera.c @@ -17,7 +17,7 @@ typedef struct { char pad0[0xB0]; - float fB0; /* tan of half the field of view */ + float tan_half_fov; /* tan of half the field of view */ } VendorView_5290; extern VendorView_5290 l14_camera_projection_state __asm__("D_L14_0016D140"); @@ -72,7 +72,7 @@ void setup_path_camera(char *camera) { fov_stops->seg[k] = -1; } } - fov_stops->fov_end = fast_arc_tan(1.0f, l14_camera_projection_state.fB0) * 2.0f; + fov_stops->fov_end = fast_arc_tan(1.0f, l14_camera_projection_state.tan_half_fov) * 2.0f; if (*(int *)(path_camera_setup_preset + 0x20) >= 0) { path = ((char *)l14_paths[*(int *)(path_camera_setup_preset + 0x20)]); fov_stop_count = 0; @@ -216,7 +216,7 @@ void update_path_camera(struct UpdateCam *path_camera) { float ang = fov_stops->fov_end * 0.5f; char *hp; char *mb; - l14_camera_projection_state.fB0 = fast_sin(ang) / fast_cos(ang); + l14_camera_projection_state.tan_half_fov = fast_sin(ang) / fast_cos(ang); update_view_context(); D_L14_001675D8 = 0.25f; path_camera->transition_state = PATH_CAMERA_TRANSITION_PATH_FINISHED; @@ -258,7 +258,7 @@ void update_path_camera(struct UpdateCam *path_camera) { total += *(float *)(path + (remaining_segment_index * 16 + 0x1C)); ang = cosine_interpolate(fov_stops->fov[i], fov_stops->fov[i + 1], sum / total) * 0.017453292f * 0.5f; - l14_camera_projection_state.fB0 = fast_sin(ang) / fast_cos(ang); + l14_camera_projection_state.tan_half_fov = fast_sin(ang) / fast_cos(ang); update_view_context(); } } From 5275010245ed786bb08e3e95897a6dfe8ee6a6ea Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:59:35 +0000 Subject: [PATCH 635/758] decomp: clarify names in select_ryno_target h32 -> draw_distance: Assigned retail 0x002cc3d0-0x002cc3dc loads signed halfword candidate_moby+0x32 and skips candidates when zero, matching candidate_moby->h32 in select_ryno_target. Checked common caller ryno_update calls selector at 0x002cc704/0x002ccdf0 and spawn_ryno_rocket at 0x002ccce4. In that checked sibling, retail 0x002ccf38 loads v1=0xFF and 0x002ccf48 stores it with sh v1,0x32(s2), where s2 is the newly created moby. The authoritative supplied sibling C identifies this exact assignment as MOBY(spawned_moby)->draw_dist = 0xFF, distinct from update_dist at +0x30 and visible at +0x31. This semantic C use plus retail store and selector read proves h32 is the moby's draw-distance property, rather than its class identity (the sibling reads oclass at +0xA6 at 0x002ccfa4). --- src/overlays/shared/weapons/ryno.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/ryno.c b/src/overlays/shared/weapons/ryno.c index ed9f13de08..363b32d0b9 100644 --- a/src/overlays/shared/weapons/ryno.c +++ b/src/overlays/shared/weapons/ryno.c @@ -42,7 +42,7 @@ typedef struct M_2cc360 { struct M_2cc360 *next; char p2c[5]; unsigned char b31; - short h32; + short draw_distance; unsigned short h34; } M_2cc360; @@ -146,7 +146,7 @@ M_2cc360 *select_ryno_target( int i, found; for (candidate_moby = D_L00_0015FFE4_2cc360; candidate_moby; candidate_moby = candidate_moby->next) { - if (candidate_moby->h32 == 0) + if (candidate_moby->draw_distance == 0) continue; if (excl) { found = 0; From 348ea4cc46896e7f763301c4b61cf59aa83c8b91 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:01:36 +0000 Subject: [PATCH 636/758] decomp: clarify names in update_metropolis_train_motion fC4 -> hitch_offset_distance: Retail 0x00292B70-0x00292BAC computes hitch minus car position, obtains that vector's length, subtracts Car292890.fC4 loaded at 0x00292B8C, rescales the adjustment to that difference, and adds it to car position. Thus this float is the distance offset retained between the car origin and computed hitch target, rather than the separate inter-car spacing. fCC -> yaw_turn_step: Retail 0x00292A20 passes locomotive pvars+0xCC as the writable spring_turn state; current angle comes from moby+0x48 and the result is stored back there at 0x00292A6C. The target is atan of coupling XY displacement plus pi. Supplied spring_turn updates *turn_step and adds it to current_angle, proving this float is the locomotive yaw turn step. fD0 -> pitch_turn_step: Retail 0x00292A94 passes locomotive pvars+0xD0 as spring_turn's writable turn_step, using current rotation at moby+0x44 and a target from horizontal distance and coupling-minus-engine Z at 0x00292A68-0x00292A84. The result is stored to rotation+0x44 at 0x00292AD8, proving this float is the locomotive pitch turn step. iA0 -> first_car_moby_index: Retail 0x00292918 loads locomotive pvars+0xA0 and tests against -1; absent cars trigger the no-cars warning and removal at 0x00292CA0-0x00292CB4. Otherwise it initializes s4, which is shifted by eight and added to the moby array at 0x00292B08-0x00292B14 for the first carriage iteration. This int is the first carriage's moby index. iC0 -> next_car_moby_index: Retail 0x00292C64 loads Car292890 pvars+0xC0 into s4 after updating the current carriage. At 0x00292C68-0x00292C70, -1 ends traversal; otherwise 0x00292B08-0x00292B14 shifts that index by eight and adds the moby array base to select the next carriage. This int links the next carriage by moby index. --- .../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 8414fc1d7b..c21ef355d9 100644 --- a/src/overlays/l03/mobys/metropolis_train_locomotive.c +++ b/src/overlays/l03/mobys/metropolis_train_locomotive.c @@ -109,15 +109,15 @@ extern void gunship_update(char *) __asm__("FUN_L01_002f5168"); typedef struct { char p00[0x60]; char motion[0x40]; - int iA0; + int first_car_moby_index; char pA4[0x14]; int iB8; char pBC[4]; float fC0; int iC4; float fC8; - float fCC; - float fD0; + float yaw_turn_step; + float pitch_turn_step; char pD4[8]; float fDC; } Train292890; @@ -127,8 +127,8 @@ typedef struct { char motion[0x80]; float prev_pos[4]; float prev_rot[4]; - int iC0; - float fC4; + int next_car_moby_index; + float hitch_offset_distance; } Car292890; void update_metropolis_train_motion(char *moby) __asm__("FUN_L03_00292890"); @@ -157,7 +157,7 @@ void update_metropolis_train_motion(char *moby) { ((unsigned char *)moby)[0x72] = 0xFF; qcopy(old_pos, moby + 0x10); qcopy(old_rot, moby + 0x40); - next_id = locomotive_state->iA0; + next_id = locomotive_state->first_car_moby_index; if (next_id != -1) { /* Fakematch: writing the unchanged next car id back is a no-op, but the * test-and-store survives until after register allocation (reload's cse @@ -165,7 +165,7 @@ void update_metropolis_train_motion(char *moby) { * then the branch's label stops reload from reusing the $4 copy of * `coupling` below, which gives retail's reload of it from the stack. */ if (next_id != 0) { - locomotive_state->iA0 = next_id; + locomotive_state->first_car_moby_index = next_id; } id = next_id; target = coupling + 0x10; @@ -187,7 +187,7 @@ void update_metropolis_train_motion(char *moby) { *(float *)(coupling + 0x14) - MOBY(moby)->pos.y), 3.1415927f); MOBY(moby)->rot.z = - spring_turn(&locomotive_state->fCC, + spring_turn(&locomotive_state->yaw_turn_step, MOBY(moby)->rot.z, distance_margin_or_target_angle, (locomotive_state->fC8 * 60.0f / locomotive_state->fC0) * 0.25f * @@ -199,7 +199,7 @@ void update_metropolis_train_motion(char *moby) { fast_arc_tan(vector_distance_xy(moby + 0x10, target), *(float *)(coupling + 0x18) - MOBY(moby)->pos.z); MOBY(moby)->rot.y = - spring_turn(&locomotive_state->fD0, + spring_turn(&locomotive_state->pitch_turn_step, MOBY(moby)->rot.y, distance_margin_or_target_angle, (locomotive_state->fC8 * 60.0f / locomotive_state->fC0) * 0.25f * @@ -220,7 +220,7 @@ void update_metropolis_train_motion(char *moby) { fast_vec_sub(car_position_adjustment, hitch, car + 0x10); fast_vec_normalize(car_position_adjustment, car_position_adjustment, - fast_vec_length(car_position_adjustment) - car_data->fC4); + fast_vec_length(car_position_adjustment) - car_data->hitch_offset_distance); fast_vec_add(car + 0x10, car_position_adjustment, car + 0x10); *(float *)(car + 0x48) = fast_add_rotations( fast_arc_tan(hitch[0] - *(float *)(car + 0x10), hitch[1] - *(float *)(car + 0x14)), @@ -235,7 +235,7 @@ 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->iC0; + id = car_data->next_car_moby_index; } while (id != -1); fast_vec_sub(delta, moby + 0x10, old_pos); update_entity_matrix(locomotive_state->motion, delta, old_rot, moby + 0x40); From 763e5a7e1ff028826ef93fde68ae0d63b990366e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:01:40 +0000 Subject: [PATCH 637/758] decomp: clarify names in thruster_pack_lock_update bB0 -> activation_group: In thruster_pack_lock_update, retail 0030ef54-0030ef74 loads the unsigned byte at moby+0xB0, excludes 0xFF, adds 2 and stores it in the activation-state byte indexed by signed moby UID. Retail 0030ef78-0030efa8 reloads the same byte and uses it as the index into D_L11_0015FC88 and the level-11 visited table; 0030efb0-0030efc4 conditionally encodes group+2 into restore state. The C mirrors this via group and group_index. The sentinel also gates restoration at 0030ee64-0030ee6c and usage tracking at 0030eff4-0030effc. Thus this is the lock's activation group selector, not a generic byte or offset-only field. --- src/overlays/shared/props/thruster_pack_lock.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/props/thruster_pack_lock.c b/src/overlays/shared/props/thruster_pack_lock.c index cbc813cba9..ee0300fe93 100644 --- a/src/overlays/shared/props/thruster_pack_lock.c +++ b/src/overlays/shared/props/thruster_pack_lock.c @@ -73,7 +73,7 @@ typedef struct { char pad21[0x57]; char *vars; /* 0x78 */ char pad7C[0x34]; - unsigned char bB0; /* 0xB0 */ + unsigned char activation_group; /* 0xB0 */ char padB1; unsigned short uid; /* 0xB2 */ } Lock; @@ -111,7 +111,7 @@ void thruster_pack_lock_update(Lock *moby) { ((Stats *)(D_00141968_r))->count = 0; ((Stats *)(D_00141968_r))->best = 0; *(unsigned short *)(vars + 0x3E) |= 8; - if (level == 0xB && moby->bB0 != 0xFF) { + if (level == 0xB && moby->activation_group != 0xFF) { if (l11_thruster_pack_lock_restore_state.collected[(short)moby->uid] != 0 || ((*(int *)(D_0014C190_r + (((short)moby->uid >> 5) * 4 + (level << 8))) >> (moby->uid & 0x1F)) & @@ -129,11 +129,11 @@ void thruster_pack_lock_update(Lock *moby) { if (((void *)((Hero *)(D_0013F350_r))->ground_moby) == moby && item_available[3] != 0 && ((Hero *)(D_0013F350_r))->air_frames.s == 0 && ((Hero *)(D_0013F350_r))->state.current == 0x22) { - if (current_level_index == 0xB && moby->bB0 != 0xFF) { + if (current_level_index == 0xB && moby->activation_group != 0xFF) { int group; int group_index; - l11_thruster_pack_lock_activation_state.collected[(short)moby->uid] = moby->bB0 + 2; - group = moby->bB0; + l11_thruster_pack_lock_activation_state.collected[(short)moby->uid] = moby->activation_group + 2; + group = moby->activation_group; group_index = group & 0xFF; if (group == 0xFF || (D_L11_0015FD08_3102C8[group_index] != 0xFF && @@ -145,7 +145,7 @@ void thruster_pack_lock_update(Lock *moby) { moby->z = moby->z - 1.5f; allocate_voice_for_target_entry(0, 0, moby); } - if (moby->bB0 == 0xFF) { + if (moby->activation_group == 0xFF) { return; } if (!(vector_distance_xy(moby->pos, D_0013F3D0_r) < 4.0f)) { From 11286445f49c56fd4b5fa4231259f8253cd1c6ce Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:03:35 +0000 Subject: [PATCH 638/758] decomp: clarify names in spawn_splitting_effect_particle_with_collision_response_and_fade w1c -> particle_collision_context: Bound source SHA-256 e44670bd11935bd0b8bc64eef9acb8fa3a870b86b1bf472e366df7d6ae21bd96 declares E_26fd28.w1c as s32 and assigns e->w1c = collision_context. Retail 0x0026fd3c saves the fourth argument a3 in s5; 0x0026fd68 sets s1 to particle+0x20, and 0x0026fee0 stores s5 at 0x1c(s1). Original Ghidra likewise stores param_4 at particle+0x3c. Supplied existing update_splitting_effect_particle_with_collision_response_and_fade reads the corresponding PV.f1C, passes it unchanged to child spawning, copies it into collision_parameters.f10, and forwards it as the fourth argument of FUN_001efa68_26ff10 in both flag branches. These uses prove the stored particle collision context, beyond its offset. --- .../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 c8d2299e14..0eb2caa50d 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 @@ -3212,7 +3212,7 @@ typedef struct { s16 h16; u8 b18; u8 pad19[3]; - s32 w1c; + s32 particle_collision_context; } E_26fd28; typedef struct { @@ -3271,7 +3271,7 @@ P_26fd28 *spawn_splitting_effect_particle_with_collision_response_and_fade(u128 particle->fC = 10000.0f; particle->hA = (s32)(8.0f / (D_0015ED60 * 0.443f)); } - e->w1c = collision_context; + e->particle_collision_context = collision_context; } return particle; } From 8448a6be68056a25258b762a11d846f56a115ab4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:05:22 +0000 Subject: [PATCH 639/758] decomp: clarify names in initialize_orbit_camera_state fA0 -> orbit_origin_spring_stiffness: Retail 0x002eb3f8 loads the orbit state from camera_object+0x70 and 0x002eb42c stores 0.3f at state+0xA0. In supplied update_orbit_camera_pose, +0xA0 is the common fourth argument of cam_interp_values for all three orbit-origin coordinates (+0xB0/+0xB4/+0xB8), interpolating toward +0x80/+0x84/+0x88. The same helper's distance interpolation uses +0x30 in that slot; initialize_mode6_orbit_camera copies the established spring-stiffness block to +0x28, including +0x30. This proves the shared orbit-origin spring stiffness role. fA4 -> orbit_origin_spring_damping: Retail 0x002eb418 stores 0.3f to orbit state+0xA4 after loading state through camera_object+0x70. Supplied update_orbit_camera_pose passes +0xA4 as the fifth argument to cam_interp_values for each orbit-origin XYZ coordinate. Its distance interpolation passes the established orbit_distance_spring_damping at +0x44 in the identical argument slot; initialize_mode6_orbit_camera copies the damping block to +0x3C. Thus +0xA4 is shared damping for the orbit-origin spring. fAC -> view_roll_offset: Retail 0x002eb414 clears orbit state+0xAC. Supplied update_orbit_camera_pose copies the floating-point contents of +0xAC into camera_object+0x40 before passing camera_object+0x40 to euler_rotation_matrix; the following +0x44/+0x48 components are constructed from the established pitch/yaw and their view offsets. initialize_orbit_camera_pose initially clears this first Euler component. Supplied update_orbit_camera_from_target_moby accumulates angular changes into +0xAC with fast_add_rotations, or assigns half target_moby->rot.x to it. This proves the view roll angle offset, without changing its existing s32 storage type. --- src/overlays/shared/camera/orbit_camera.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/camera/orbit_camera.c b/src/overlays/shared/camera/orbit_camera.c index daef4fc4df..1ce53fa84a 100644 --- a/src/overlays/shared/camera/orbit_camera.c +++ b/src/overlays/shared/camera/orbit_camera.c @@ -26,10 +26,10 @@ typedef struct { f32 view_yaw_offset_spring_damping; u8 pad50[0x4C]; s32 orbit_origin_snap_enabled; - f32 fA0; - f32 fA4; + f32 orbit_origin_spring_stiffness; + f32 orbit_origin_spring_damping; s32 fA8; - s32 fAC; + s32 view_roll_offset; u8 padB0[0x40]; s32 fF0; } Moby002eb3b0; @@ -137,9 +137,9 @@ void initialize_orbit_camera_state(S002eb3b0 *camera_object) { m = camera_object->m; m->orbit_origin_snap_enabled = 0; m->fA8 = 0; - m->fAC = 0; - m->fA0 = 0.3f; - m->fA4 = 0.3f; + m->view_roll_offset = 0; + m->orbit_origin_spring_stiffness = 0.3f; + m->orbit_origin_spring_damping = 0.3f; m->view_pitch_offset_spring_damping = 0.99f; m->orbit_yaw_spring_damping = 0.04f; m->f40 = 0.04f; From cb18f85c8a587be438c02f5d65b84246708a6ca3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:05:25 +0000 Subject: [PATCH 640/758] decomp: clarify names in shuttle_update w88 -> travel_turn_angle: Authoritative shuttle.c SHA-256 ed57a836533926b35dff74d851f0d84782da48b1b19bee0eb4ac21a500878f07 clears w88 when activation starts travel; original assigned retail decompilation stores zero to iVar2+0x88 and instruction 0x002f1c2c confirms that store. Checked helper 0x002f2460-0x002f2484 reads this same field as float, multiplies path pitch by its cosine and adds it to path yaw. At 0x002f2608-0x002f265c, after travel progress exceeds 0.8, its address is passed to the angle approach operation with target pi, matching supplied helper f88 use. Thus it is the travel turn angle, not merely an unknown word. wA4 -> travel_progress: Authoritative shuttle.c and original retail decompilation reset wA4 at travel-helper completion; assigned instruction 0x002f1ee0 stores zero to pvars+0xa4. Checked helper 0x002f21e4 and 0x002f2234-0x002f2240 pass its address to approach_value toward 1.0 with step 1/scale_game_frames(900). Reads at 0x002f2248-0x002f225c, 0x002f2278-0x002f22f0 scale camera-position, aim and shuttle path lengths to select/interpolate path points. 0x002f25dc-0x002f2604 uses it to interpolate shuttle scale; 0x002f2660-0x002f2680 returns completion when it equals 1.0. These operations prove normalized travel progress. --- src/overlays/l17/mobys/shuttle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l17/mobys/shuttle.c b/src/overlays/l17/mobys/shuttle.c index 3726490b18..fe2bb96f15 100644 --- a/src/overlays/l17/mobys/shuttle.c +++ b/src/overlays/l17/mobys/shuttle.c @@ -77,13 +77,13 @@ typedef struct { int cam[2]; int dir; int cut; - int w88; + int travel_turn_angle; char pad8C[8]; int sel; int side; float f9C; float fA0; - int wA4; + int travel_progress; int go; int sfx; int timer; @@ -202,7 +202,7 @@ void shuttle_update(struct Moby *shuttle_moby) { blend_moby_animation(shuttle_moby, 0, 0, 0); } fade_to_black(scale_game_frames(10)); - shuttle_vars->w88 = 0; + shuttle_vars->travel_turn_angle = 0; route_index = shuttle_vars->side; qcopy(a, ((char **)D_L17_001B0DB0)[shuttle_vars->a[route_index]] + 0x10); qcopy(b, ((char **)D_L17_001B0DB0)[shuttle_vars->b[route_index]] + 0x10); @@ -248,7 +248,7 @@ void shuttle_update(struct Moby *shuttle_moby) { int ofs; int base; shuttle_moby->state = SHUTTLE_STATE_RESET_AFTER_TRAVEL; - shuttle_vars->wA4 = 0; + shuttle_vars->travel_progress = 0; ofs = shuttle_vars->cam[shuttle_vars->sel] << 7; base = (int)D_L17_001600EC; qcopy(&shuttle_moby->pos, (char *)(ofs + base + 0x30)); From bc8f9f70e4c1f84cabf3c1c49bda7f2535e93e30 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:05:28 +0000 Subject: [PATCH 641/758] decomp: clarify names in initialize_beehive_spawn_moby w94 -> spatial_cell_update_gate: Assigned retail 0x00302394-0x0030239c loads destination moby class +0x10 and stores it in destination +0x94 (ClonedMoby.w94). Checked level-01 update_entity helper 0x00265bd8..0x00265d78 (report a43c14d50ca3ed49cdebabff46adc434e7cac9ac68fabb98ee5db4a38559b501) transforms class bounds using scale and position, then loads +0x94 at 0x00265c7c and exits if zero at 0x00265c90. Its nonzero path packs bounds from vector center plus/minus extent using paddw/psubw, shifts by 14 and packs bytes (0x00265c98-0x00265cbc), compares with moby +0xa0, rejects invalid 0xc0c0 bits, and tail-dispatches at 0x00265cd0 only for changed valid spatial cell bounds. This proves the stored class value gates spatial cell update processing without asserting its underlying payload type. --- src/overlays/l01/mobys/beehive.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/beehive.c b/src/overlays/l01/mobys/beehive.c index 8d28eb6b3e..136063e138 100644 --- a/src/overlays/l01/mobys/beehive.c +++ b/src/overlays/l01/mobys/beehive.c @@ -43,7 +43,7 @@ typedef struct { u8 pad50[0x28]; void *pvars; u8 pad7C[0x18]; - s32 w94; + s32 spatial_cell_update_gate; } ClonedMoby; extern void get_first_moby_in_group(ClonedMoby **, s32, s32, s32) __asm__("FUN_L00_002591d0"); @@ -157,7 +157,7 @@ ClonedMoby *initialize_beehive_spawn_moby(ClonedMoby *clone_spawner_moby) { destination_moby->h32 = 0x80; destination_moby->d38 = clone_spawner_moby->d38; destination_moby->b31 = 1; - destination_moby->w94 = destination_moby->mclass->w10; + destination_moby->spatial_cell_update_gate = destination_moby->mclass->w10; destination_moby->flags |= 0x1020; destination_moby->scale = destination_moby->mclass->f24; { From 39bca020b2eadb730adeb890465e8aaf576b756b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:05:31 +0000 Subject: [PATCH 642/758] decomp: clarify names in poison_vessel_update hA6 -> object_class: In assigned poison_vessel_update, 002e800c loads hit_result->owner; 002e8018 and 002e801c read owner+0xA6 and vessel+0xA6, and 002e8020-002e8028 suppress the blast flag for equal classes. Direct explosion helper 0024dcf8 saves owner a0 at sp+0x90 (0024dd34), reloads it at 0024de3c, reads unsigned owner+0xA6 at 0024de4c, and stores the halfword at sp+0x3A (0024de5c), which is descriptor sp+0x20 plus 0x1A. Provided established spawn_explosion C identifies this exact assignment as ev.h1A = (unsigned short)MOBY(owner_moby)->oclass, adjacent to b18=2 and b19=1 stores also present at 0024de54/0024de64. This proves object class, beyond its offset alone. Evidence request 0cb5178165694d9c8cbe5d67db98779c, report SHA-256 08916af7ff484e763d145faf9b0bbd411743bee93e319f0920a299b8d35de1ce. --- src/overlays/l15/mobys/poison_vessel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l15/mobys/poison_vessel.c b/src/overlays/l15/mobys/poison_vessel.c index 8326f68a13..63786d1e8a 100644 --- a/src/overlays/l15/mobys/poison_vessel.c +++ b/src/overlays/l15/mobys/poison_vessel.c @@ -62,7 +62,7 @@ typedef struct Moby_2E9358 { char pad7C[0x28]; unsigned char bA4; char padA5; - short hA6; + short object_class; char padA8[0x14]; unsigned char bBC; } Moby_2E9358; @@ -159,7 +159,7 @@ void poison_vessel_update(Moby_2E9358 *moby) { } } hit_result = find_moby_hit(moby, 0x830000, 0); - if (hit_result != 0 && hit_result->owner != 0 && hit_result->owner->hA6 != moby->hA6) { + if (hit_result != 0 && hit_result->owner != 0 && hit_result->owner->object_class != moby->object_class) { moby->bBC = 1; } moby->bA4 = 0xFF; From 4c0a0d64e042785016f4ee1599c1595b7e9f4e67 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:07:13 +0000 Subject: [PATCH 643/758] decomp: clarify names in select_hero_slot3_animation_pair h0 -> animation_key: In the authoritative C, E_231ff8.h0 is compared with animation_lookup_key to collect matching_animation_entry_indices, and -1 terminates scanning. Original retail Ghidra compares sVar1 with each record's sVar2. Retail 0x00232024 saves the input-animation helper result in s2; lh at 0x00232098 loads the record halfword and bne at 0x002320a0 compares it with s2. Equality gates the entry-index store at 0x002320a8. The chosen matching record supplies primary/secondary animation IDs at 0x002320f8-0x00232104, which supplied callers apply to hero slot 3 moby/moby2. Thus this member is the animation key used to select paired animations, rather than an output animation byte. --- src/overlays/shared/hero/set_hero_animation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index 8a543fa7ff..eaf19c2996 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -164,7 +164,7 @@ void blend_hero_slot3_mapped_animation_pair(int id, int frame_index, float blend } typedef struct { - s16 h0; + s16 animation_key; u8 primary_animation_id; u8 secondary_animation_id; } E_231ff8; @@ -193,8 +193,8 @@ int select_hero_slot3_animation_pair(int input_animation_id, } if (animation_table) { int j = 0; - while (animation_table[j].h0 != -1) { - if (animation_lookup_key == animation_table[j].h0) { + while (animation_table[j].animation_key != -1) { + if (animation_lookup_key == animation_table[j].animation_key) { matching_animation_entry_indices[match_count] = j; match_count++; } From 853001afc4ad1162425531e597b7aa08fe43a4ee Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:09:04 +0000 Subject: [PATCH 644/758] decomp: clarify names in trooper_start_knockback h3E -> motion_phase: Retail sh zero,0x3e(s0) at 0x0025c5f0 initializes this s16, matching original Ghidra *(undefined2 *)((int)param_3+0x3e)=0 and source knockback_state->h3E=0. Supplied step_moby_motion switches on the same state+0x3E with MOTION_RISING=0, MOTION_FALLING=1 and MOTION_GROUNDED=2: negative vertical_motion_step transitions 0 to 1, ground collision with an inward normal dot sets 2, and grounded phase changes horizontal deceleration and animation speed. These consuming operations establish the rising/falling/grounded motion phase, not merely an offset-based state name. w24 -> motion_flags: Incoming knockback_state is a1 saved in s0 at 0x0025c590. Retail lw at 0x0025c624, ori 0x20 at 0x0025c628 and sw at 0x0025c62c modify this u32 bitset when the queried leading float is zero, also clearing moby collision at 0x0025c630. Retail lw/andi 2 at 0x0025c634-0x0025c638 selects basic versus extended animation helpers. Original Ghidra casts param_3[9] to uint for the same bit operations. Supplied step_moby_motion tests state+0x24 bits 0x10, 4 and 0x20 to control motion/collision and turning behavior. These uses prove motion control flags rather than an arbitrary word. --- 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 1b6e9f8848..bcf97d45c8 100644 --- a/src/overlays/shared/mobys/step_moby_motion.c +++ b/src/overlays/shared/mobys/step_moby_motion.c @@ -138,13 +138,13 @@ typedef struct { f32 f18; f32 f1C; u8 p20[4]; - u32 w24; + u32 motion_flags; u8 p28[4]; s16 h2C; u8 p2E[0xE]; u8 b3C; u8 p3D; - s16 h3E; + s16 motion_phase; f32 f40; int w44; } B_25c558; @@ -166,14 +166,14 @@ void trooper_start_knockback(u8 *moby, knockback_state->f40 = fast_add_rotations(knockback_angle, 3.1415927f); knockback_state->w44 = 0; knockback_state->h2C = scale_game_frames(300); - knockback_state->h3E = 0; + knockback_state->motion_phase = 0; knockback_state->b3C = 1; moby_vars_record = get_moby_target_info(moby); if (moby_vars_record && *moby_vars_record == 0.0f) { - knockback_state->w24 |= 0x20; + knockback_state->motion_flags |= 0x20; MOBY(moby)->collision = 0; } - if (knockback_state->w24 & 2) + if (knockback_state->motion_flags & 2) blend_moby_animation_ex( moby, animation_index, animation_frame_index, animation_timing_divisor, 1); else From 231791cde1cab3690183d2d45c75fba606683fb9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:09:08 +0000 Subject: [PATCH 645/758] decomp: clarify names in spawn_moby_point_attached_particle wC -> particle_size_bits: Retail 0x002725f4 saves ABI a3 in s2 and 0x00272640 stores its unchanged word to particle+0xC; original Ghidra likewise assigns param_6 to +0xC. In the SHA-256-bound source, P_2725d8.wC receives initial_size_bits after the unchanged-value increment/decrement pair. The supplied EmberParticle layout names the shared particle header slot size, and spawn_splash writes scale * 210000.0f there. Thus this s32 member holds the raw particle size bits; no numeric conversion or units are inferred. --- 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 2533c2bc18..005dd77f55 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -602,7 +602,7 @@ typedef struct { u8 b8; u8 b9; u8 padA[2]; - s32 wC; + s32 particle_size_bits; u8 v10[16]; u8 v20[12]; f32 unk2C; @@ -631,7 +631,7 @@ P_2725d8 *spawn_moby_point_attached_particle(u8 *owner_moby, if (particle) { S_2725d8 *s; particle->w4 = color; - particle->wC = initial_size_bits; + particle->particle_size_bits = initial_size_bits; particle->b9 = truncate_float_to_s32(0.4f) + 0x20; particle->b3 = 0x48; particle->b1 = 3; From f1d4b8b2cd2f92e03691e90c96e950e78cd66f57 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:10:53 +0000 Subject: [PATCH 646/758] decomp: clarify names in draw_beam_and_arc_effects h3E -> beam_point_count: Retail 0x002ba9b0 loads the Moby pvars pointer into s1; lh a3,0x3e(s1) at 0x002ba9d4 and 0x002baa04 passes this signed halfword to both primary and secondary beam draws at 0x002ba9fc and 0x002baa1c. The authoritative helper receives a3 as point_count and bounds both point-array rendering loops with point_count - 1. The same helper receives literal 5 for each five-Vec4 arc row at 0x002baa4c/70/94/b8. Supplied producer C initializes the corresponding pvars count3e to 20 and shortens it to seg upon collision, corroborating a beam point count used for rendering. --- src/overlays/shared/weapons/tesla_claw_beam.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/tesla_claw_beam.c b/src/overlays/shared/weapons/tesla_claw_beam.c index a59ab2a278..1b7f4e247c 100644 --- a/src/overlays/shared/weapons/tesla_claw_beam.c +++ b/src/overlays/shared/weapons/tesla_claw_beam.c @@ -42,7 +42,7 @@ typedef struct { typedef struct { u8 pad[0x3E]; - s16 h3E; + s16 beam_point_count; } S2ba970; typedef float RW_2baae0[4] __attribute__((aligned(16))); @@ -1396,14 +1396,14 @@ void draw_beam_and_arc_effects(struct Moby *moby) { draw_beam_and_arc_two_pass_quads(D_L00_001DB5C0, primary_beam_first_pass_alpha_gp, primary_beam_second_pass_alpha_gp, - moby_vars->h3E, + moby_vars->beam_point_count, beam_and_arc_first_pass_half_width_gp, primary_beam_second_pass_half_width_gp, primary_beam_second_pass_segment_extension_factor_gp); draw_beam_and_arc_two_pass_quads(D_L00_001DB5C0 + 0x140, secondary_beam_first_pass_alpha_gp, secondary_beam_second_pass_alpha_gp, - moby_vars->h3E, + moby_vars->beam_point_count, D_L00_0016160C, secondary_beam_and_arc_second_pass_half_width_gp, secondary_beam_second_pass_segment_extension_factor_gp); From 5c20cd8eaf0dc02d2b31ab60505fe571a3911276 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:10:56 +0000 Subject: [PATCH 647/758] decomp: clarify names in morphoray_target_effect_update hA6 -> moby_class: SHA-bound source identifies the linked morph-o-ray target as moby class 0xB9. Retail 0x002d8000 loads the linked object from record+0; 0x002d8008 loads 0xB9; 0x002d800c reads its signed halfword +0xA6; 0x002d8010 rejects a different class by branching to follower removal at 0x002d802c. Original Ghidra *(short *)(iVar2+0xa6)!=0xb9 matches o->hA6 != 0xB9. The field is the linked moby's class discriminator, separate from its +0x20 current-state byte. --- src/overlays/shared/weapons/morphoray_target_effect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/morphoray_target_effect.c b/src/overlays/shared/weapons/morphoray_target_effect.c index 1c91f809ff..67cb4497a2 100644 --- a/src/overlays/shared/weapons/morphoray_target_effect.c +++ b/src/overlays/shared/weapons/morphoray_target_effect.c @@ -16,7 +16,7 @@ typedef struct { u8 pad3[0x78 - 0x50]; void *p78; u8 pad4[0xA6 - 0x7C]; - s16 hA6; + s16 moby_class; } O_002d7f88; typedef struct { @@ -72,7 +72,7 @@ void morphoray_target_effect_update(S_002d7f88 *follower_moby) { if (fast_dec_timer(moby_data->removal_timer) != 0 || D_L00_001616DC * 1.1f <= moby_data->f4) goto kill; o = moby_data->o; - if (o == 0 || o->hA6 != 0xB9 || o->moby_state == 0xFE || o->moby_state == 0xFD) { + if (o == 0 || o->moby_class != 0xB9 || o->moby_state == 0xFE || o->moby_state == 0xFD) { kill: mark_moby_for_removal(follower_moby); return; From 6b5620b16bd9f90bd06d33ce89533dab04eb09b1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:13:52 +0000 Subject: [PATCH 648/758] decomp: clarify names in update_three_phase_effect_particle w8 -> initial_phase_packed_color: S_269290 w8 is an int read at data+8 (particle+0x28). Retail 0x0026931c-0x00269334 loads it into a1, masks a copy with 0x00FFFFFF into a0, and blends using 1-life/h10 before storing particle->color. Thus the initial phase fades toward this full packed color. At 0x00269418-0x00269424 the middle phase blends wC and w8 with life/h12, making w8 its starting color endpoint. The original decompilation and authoritative C corroborate both uses. wC -> final_phase_packed_color: S_269290 wC is an int read at data+0xC (particle+0x2C). Retail 0x00269418-0x00269424 passes it as the first color alongside w8 with the decreasing life/h12 fraction, making it the middle phase's ending color endpoint. Retail 0x00269464-0x00269498 masks a copy with 0x00FFFFFF and blends that RGB-only color with the full wC using life/h14, writing particle->color during the final fade. Original decompilation and authoritative C show the same data flow. --- .../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 0eb2caa50d..c63652a6d4 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 @@ -16,8 +16,8 @@ typedef struct { char p0[8]; - int w8; - int wC; + int initial_phase_packed_color; + int final_phase_packed_color; short h10, h12, h14, h16, h18; } S_269290; @@ -44,7 +44,7 @@ void update_three_phase_effect_particle(struct EffectParticle *particle) { phase_remaining_ratio = convert_integer_to_float(particle->life) / convert_integer_to_float(particle_data->h10); particle->color = fast_tween_color( - particle_data->w8 & 0xFFFFFF, particle_data->w8, 1.0f - phase_remaining_ratio); + particle_data->initial_phase_packed_color & 0xFFFFFF, particle_data->initial_phase_packed_color, 1.0f - phase_remaining_ratio); particle->size = (float)(particle_data->h16 * 1000); if (fast_dec_timer_s16(&particle->life)) { particle_data->h10 = 0; @@ -61,7 +61,7 @@ void update_three_phase_effect_particle(struct EffectParticle *particle) { (float)particle_data->h18) * 1000.0f; particle->color = - fast_tween_color(particle_data->wC, particle_data->w8, phase_remaining_ratio); + fast_tween_color(particle_data->final_phase_packed_color, particle_data->initial_phase_packed_color, phase_remaining_ratio); if (fast_dec_timer_s16(&particle->life)) { particle_data->h12 = 0; particle->life = particle_data->h14; @@ -70,9 +70,9 @@ void update_three_phase_effect_particle(struct EffectParticle *particle) { int packed_rgb; load_display_text_resource_entry(position_step, particle->data + 0x4); fast_vec_add(particle->pos.f, particle->pos.f, position_step); - packed_rgb = particle_data->wC & 0xFFFFFF; + packed_rgb = particle_data->final_phase_packed_color & 0xFFFFFF; particle->color = fast_tween_color(packed_rgb, - particle_data->wC, + particle_data->final_phase_packed_color, convert_integer_to_float(particle->life) / convert_integer_to_float(particle_data->h14)); particle->size = (float)(particle_data->h18 * 1000); From cb9f11e46d3cc0d38642de8f487da27a2e49b8b4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:13:55 +0000 Subject: [PATCH 649/758] decomp: clarify names in update_sound_emitter_playback_by_distance w4 -> repeat_delay_lower_bound: In the supplied exact C, playback_state->w4 is added to random_integer_below(w8 - w4) after play_voice. Retail 0x002eda14-0x002eda28 loads state+4, subtracts it from state+8 to form the random range, then adds state+4 to the random result. This proves the lower bound of the repeat-delay sample before helper conversion; 0x002eda44-0x002eda4c scales the converted sample by 60 and stores the playback countdown. w8 -> repeat_delay_upper_bound: Supplied C tests playback_state->w8 > 0 before resetting the repeat countdown and uses random_integer_below(w8 - w4) + w4. Retail 0x002eda08-0x002eda1c loads state+8, checks positivity and subtracts state+4 for the random helper argument. This proves the upper bound of the randomized repeat-delay input, before conversion at 0x002eda24 and multiplication/storage at 0x002eda44-0x002eda4c. wC -> repeat_delay_countdown: Supplied C passes &playback_state->wC to fast_dec_timer and returns when it is not ready, immediately before play_voice. Retail 0x002ed9e8-0x002eda04 passes state+0xc to the timer helper and branches away on zero before starting playback. After playback, 0x002eda14-0x002eda4c derives a randomized delay from state+4/+8, converts it, multiplies by 60 and stores it at state+0xc, proving the repeat-delay countdown role. --- .../shared/audio/emitters/distance_emitter.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/shared/audio/emitters/distance_emitter.c b/src/overlays/shared/audio/emitters/distance_emitter.c index 17e8dc175c..ef602aab33 100644 --- a/src/overlays/shared/audio/emitters/distance_emitter.c +++ b/src/overlays/shared/audio/emitters/distance_emitter.c @@ -11,9 +11,9 @@ typedef struct { s32 id; - s32 w4; - s32 w8; - s32 wC; + s32 repeat_delay_lower_bound; + s32 repeat_delay_upper_bound; + s32 repeat_delay_countdown; s32 snd; } S_2ed950; @@ -69,13 +69,13 @@ void update_sound_emitter_playback_by_distance(u8 *sound_emitter) { fl = four; if (e->o == sound_emitter && e->is_active) return; - if (!fast_dec_timer(&playback_state->wC)) + if (!fast_dec_timer(&playback_state->repeat_delay_countdown)) return; playback_state->snd = play_voice(playback_state->id, fl, sound_emitter, 0x400); - if (playback_state->w8 > 0) { - playback_state->wC = - FUN_001f96f8_2ed950(playback_state->w4 + - random_integer_below(playback_state->w8 - playback_state->w4)) * + if (playback_state->repeat_delay_upper_bound > 0) { + playback_state->repeat_delay_countdown = + FUN_001f96f8_2ed950(playback_state->repeat_delay_lower_bound + + random_integer_below(playback_state->repeat_delay_upper_bound - playback_state->repeat_delay_lower_bound)) * 60.0f; } } else if (playback_radius + 1.0f < reference_distance) { From e691bfd5055d7085f83a55cd6402a1d318a638d1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:15:43 +0000 Subject: [PATCH 650/758] decomp: clarify names in create_spark_particle w4 -> packed_color: Source assigns Spark.w4 = FUN_L00_0025bfe0(r,g,b,size); supplied helper C packs truncated 255-scaled RGB into bits 0-23 and the fourth input into bits 24-31. Original assigned retail 0x0027ea98-0x0027eaac passes f22/f23/f24/f29 (r,g,b,size) to 0x00270ea0, then 0x0027eab0 stores returned v0 at Spark+4. Checked level-01 helper instructions 0x00270ea8-0x00270f00 multiply inputs by 255, call conversion and mask the first three to 0xff; 0x00270f04-0x00270f1c shift components by 8/16/24 and OR them into the returned packed word. This proves packed_color without asserting the size-derived high byte is alpha. --- src/overlays/l01/mobys/create_spark_particle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l01/mobys/create_spark_particle.c b/src/overlays/l01/mobys/create_spark_particle.c index ee81c1085b..21424d330d 100644 --- a/src/overlays/l01/mobys/create_spark_particle.c +++ b/src/overlays/l01/mobys/create_spark_particle.c @@ -27,7 +27,7 @@ typedef struct { u8 b1; u8 texture_id; u8 particle_mode; - s32 w4; + s32 packed_color; u8 b8; u8 b9; s16 hA; @@ -114,5 +114,5 @@ void create_spark_particle(s32 id, spark->b8 = alpha * 255.0f; spark->hA = scale_game_frames(life); spark_body->b1B = 0; - spark->w4 = FUN_L00_0025bfe0(r, g, b, size); + spark->packed_color = FUN_L00_0025bfe0(r, g, b, size); } From 13c0f16f46d667044edc787b44c7eeb5b707895f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:15:46 +0000 Subject: [PATCH 651/758] decomp: clarify names in replenish_hero_drones hC0 -> drone_replenishment_count: In replenish_hero_drones, retail 0x002cdd20-0x002cdd3c requires active_drone_count < 6 and consumes one ammo unit for item 0x18. Instructions 0x002cdd4c-0x002cdd60 then load S_2cdcc0+0xC0, skip increment when above 0xFFFE, otherwise add one and store the halfword. This occurs once before the missing-drone spawn loop at 0x002cde20, proving a saturating count of drone replenishment events, not spawned drones. wC4 -> drone_usage_level_flags: After the item-0x18 ammo consumption in replenish_hero_drones, retail 0x002cddbc-0x002cdde4 loads S_2cdcc0+0xC4, shifts 1 by current_level_index, ORs that level bit and 0x80000000 into the existing word, and stores it. The authoritative C expresses usage_stats->wC4 | (1 << current_level_index) | 0x80000000, proving persistent level flags recording drone use; the high-bit meaning is left unspecified. --- src/overlays/shared/weapons/drone.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/weapons/drone.c b/src/overlays/shared/weapons/drone.c index 967cfb1189..02a4a57822 100644 --- a/src/overlays/shared/weapons/drone.c +++ b/src/overlays/shared/weapons/drone.c @@ -31,9 +31,9 @@ typedef struct { typedef struct { unsigned char pad0[0xC0]; - unsigned short hC0; + unsigned short drone_replenishment_count; unsigned short hC2; - unsigned int wC4; + unsigned int drone_usage_level_flags; } S_2cdcc0; /* Ported from rac1-decomp (nonmatching/shared/func_L00_002CF808.c: func_L00_002CF808). */ @@ -173,13 +173,13 @@ void replenish_hero_drones(void) { if (hero_state->active_drone_count < 6) { FUN_L00_00233db8_2cdcc0(0x18, 1); usage_stats = (S_2cdcc0 *)item_usage; - if (usage_stats->hC0 < 0xFFFF) { - usage_stats->hC0++; + if (usage_stats->drone_replenishment_count < 0xFFFF) { + usage_stats->drone_replenishment_count++; } if (FUN_001f96f8_2cdcc0(D_0015EEA4) / 600 > usage_stats->hC2) { usage_stats->hC2 = FUN_001f96f8_2cdcc0(D_0015EEA4) / 600; } - usage_stats->wC4 = usage_stats->wC4 | (1 << current_level_index) | 0x80000000; + usage_stats->drone_usage_level_flags = usage_stats->drone_usage_level_flags | (1 << current_level_index) | 0x80000000; FUN_001f9a10_2cdcc0(drone_spawn_position, hero_state->hero_position, hero_state->hero_moby + 0xE0); FUN_001f9a10_2cdcc0( From bf634e4bd0ab7a0213f49ca5f57c1b7e44bbdc82 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:17:46 +0000 Subject: [PATCH 652/758] decomp: clarify names in update_moving_hero_relative_alpha_fade_particle w1C -> hero_relative_position_mode: V_273298 is based at particle+0x20 (retail 0x002732b0); 0x002732bc loads its +0x1C field and 0x002732c0 compares it with 1. In that branch, 0x002732cc..0x00273308 reconstruct XYZ from hero position plus saved offsets and add velocity, then 0x0027330c..0x0027333c subtract hero position to save updated offsets. The fallback at 0x00273340..0x00273348 only adds velocity. Original Ghidra explicitly tests particle+0x3C == 1 and shows the same relative-offset data flow. The supplied C initializer spawn_moving_hero_relative_alpha_fade_particle stores its mode at particle_data+7 and initializes offsets only when mode == 1, confirming a positioning mode rather than an offset or timer. --- 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 005dd77f55..ee3b85a6cd 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -1041,7 +1041,7 @@ typedef struct { typedef struct { u8 p0[0x10]; f32 x, y, z; - int w1C; + int hero_relative_position_mode; } V_273298; typedef struct { @@ -1056,7 +1056,7 @@ void update_moving_hero_relative_alpha_fade_particle(Part_273298 *particle) { V_273298 *particle_data = (V_273298 *)((u8 *)particle + 0x20); float remaining_frames_minus_one; u32 color_without_alpha; - if (particle_data->w1C == 1) { + if (particle_data->hero_relative_position_mode == 1) { struct Hero *hero_reference = &hero; particle->x = hero_reference->motion.pos.f[0] + particle_data->x; particle->y = hero_reference->motion.pos.f[1] + particle_data->y; From 3ed472a1684f3a42408a0e4f1c452e2b2946c5b6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:17:49 +0000 Subject: [PATCH 653/758] decomp: clarify names in follow_camera_pull_back fA4 -> pull_back_blend_input: Private C_2e9518 float fA4 corresponds to retail DAT_00166eb4, loaded from 0xa4(s2). At 0x002e9570-0x002e9584 its zero test selects the retained pull-back path, and 0x002e95bc-0x002e95dc tests its absolute magnitude before the alignment gate. At 0x002e9624-0x002e9640 the same field is multiplied by 14.2857 into f20 and capped above at 1.0. That derived weight interpolates the reference distance toward pull_back_target at 0x002e9660-0x002e9670, feeding follow_camera_set_distance at 0x002e9694, and interpolates both orbit-distance stiffness and damping outputs at 0x002e969c-0x002e96cc. The embedded C expresses all three interpolations using k = C->fA4 * 14.2857f, proving this field is the pull-back blend input without asserting its physical origin. --- src/overlays/shared/camera/follow_camera_update.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_update.c b/src/overlays/shared/camera/follow_camera_update.c index 0b8369356b..cc32d11eea 100644 --- a/src/overlays/shared/camera/follow_camera_update.c +++ b/src/overlays/shared/camera/follow_camera_update.c @@ -12,7 +12,7 @@ typedef struct { char p0[0x80]; float pull_back_alignment_vector[4]; char p1[0xA4 - 0x90]; - float fA4; + float pull_back_blend_input; } C_2e9518; typedef struct { @@ -452,14 +452,14 @@ void follow_camera_pull_back(char *camera_object, float *x, float *y) { float k, pull_back_target, interpolated_pull_back_value; if (pull_back_state->h6 == 0) { - if (pull_back_state->h4 != 0 && C->fA4 == 0.0f && + if (pull_back_state->h4 != 0 && C->pull_back_blend_input == 0.0f && fast_vec_dot(D_001413D0_lui + 0xC0, camera_object) <= -0.3f) { goto on; } - if (0.0001f < absolute_float(C->fA4) && fast_vec_dot(C->pull_back_alignment_vector, camera_object) <= -0.3f) { + if (0.0001f < absolute_float(C->pull_back_blend_input) && fast_vec_dot(C->pull_back_alignment_vector, camera_object) <= -0.3f) { on: pull_back_state->h4 = scale_game_frames(0x78); - k = C->fA4 * 14.2857f; + k = C->pull_back_blend_input * 14.2857f; if (1.0f < k) k = 1.0f; pull_back_target = D_001413F4_lui == 1 ? 4.0f : pull_back_state->fC; From c5966a77ed82ca67a432d0fac48915aa258e4e75 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:17:53 +0000 Subject: [PATCH 654/758] decomp: clarify names in select_hero_grapple_swing_target hA6 -> moby_class_id: Retail 0x00221f38 loads signed halfword candidate_moby+0xA6; 0x00221f40 loads class constant 0x323 and 0x00221f44 rejects unequal candidates before private-data enable, flags, range and scoring checks. The loop reloads the same member at 0x002220c0. Original Ghidra shows sVar1 == 0x323; authoritative C maps this to candidate_moby->hA6. Supplied companion select_hero_grapple_target uses MOBY(candidate_moby)->oclass != 0x2F6 for the corresponding list class gate, and the file's Moby_227fa0 declares s16 oclass at the same member location and compares it with 0x1E3. These uses establish an object-class identifier, rather than an offset-only interpretation. --- 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 fbef8abd46..6c429e80cf 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -422,7 +422,7 @@ typedef struct M_221ee0 { u8 p4[0x78 - 0x36]; Q_221ee0 *q; u8 p5[0xA6 - 0x7C]; - s16 hA6; + s16 moby_class_id; } M_221ee0; extern G_221ee0 D_0013F350_lui __asm__("D_0013F350") NOT_SDA; @@ -449,7 +449,7 @@ void select_hero_grapple_swing_target(void) { bestd = 1e8f; for (candidate_moby = D_L00_0015FFE4_221ee0; candidate_moby != 0; candidate_moby = candidate_moby->next) { - if (candidate_moby->hA6 != 0x323) + if (candidate_moby->moby_class_id != 0x323) continue; q = candidate_moby->q; if (q->swing_target_enabled == 0) From 9db7776249c2a28bc1bcac6c578be2e99869ec21 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:19:56 +0000 Subject: [PATCH 655/758] decomp: clarify names in electric_beam_update wC -> initial_timed_wait_frames: Retail 0x00301678 loads the int at pvars+0xC into a0 for scale_game_frames (jal 0x00301674); 0x0030167c stores its scaled result into the phase timer at pvars+0x10 and 0x00301680-0x00301684 enters state 2. Original Ghidra expresses this as func_0x002124c0(piVar2[3]). Authoritative C uses scale_game_frames(beam_vars->wC) in BEAM_STATE_INITIALIZE. State BEAM_STATE_WAIT_FOR_TIMED_PULSE decrements this timer at 0x003016e4-0x003016e8 and starts the next pulse upon expiry at 0x00301704. Later phases reload from +4/+6 instead, proving this member supplies the initial timed wait in input frames. --- src/overlays/shared/props/electric_beam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/props/electric_beam.c b/src/overlays/shared/props/electric_beam.c index b4a94b945d..15f0c59792 100644 --- a/src/overlays/shared/props/electric_beam.c +++ b/src/overlays/shared/props/electric_beam.c @@ -20,7 +20,7 @@ typedef struct { int w0; short s4, s6, s8, sA; - int wC; + int initial_timed_wait_frames; short s10, s12; char pad14[8]; float radius; /* 0x1C: beam half width */ @@ -78,7 +78,7 @@ void electric_beam_update(unsigned char *moby) { switch (beam_state) { case BEAM_STATE_INITIALIZE: start_electric_beam_pulse((char *)moby); - beam_vars->s10 = scale_game_frames(beam_vars->wC); + beam_vars->s10 = scale_game_frames(beam_vars->initial_timed_wait_frames); MOBY(moby)->state = BEAM_STATE_WAIT_FOR_TIMED_PULSE; beam_vars->culling_sphere_radius = fast_vec_length(&l14_cuboids[beam_vars->w0].axes[1]); beam_vars->s8 = 1; From ea5dbc89dff5e3acfdc77af22fee4978ada4b2a8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:21:52 +0000 Subject: [PATCH 656/758] decomp: clarify names in initialize_moby_motion_at_position hA6 -> moby_class: The supplied original retail Ghidra plate identifies 0x002aa138-0x002aa1bc as the state/class/self filter and describes the scan as same-class mobies. Retail 0x002aa178 and 0x002aa17c load signed halfwords from scanned_moby+0xA6 and initialized_moby+0xA6; 0x002aa180 skips unequal classes. Only matching, non-self mobies pass to the private+0x5C minimum selection and count increment (0x002aa188-0x002aa1b0), enforcing the eight-other-moby limit at 0x002aa1c0-0x002aa1d0. Authoritative C binds these two loads to N_2aa008.hA6. This proves the class discriminator role, beyond an offset-only guess. --- 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 b2e819b39f..90452eb4dc 100644 --- a/src/overlays/shared/weapons/mine.c +++ b/src/overlays/shared/weapons/mine.c @@ -391,7 +391,7 @@ typedef struct N_2aa008 { u8 pad3[0x78 - 0x30]; void *moby_private_vars; u8 pad4[0xA6 - 0x7C]; - s16 hA6; + s16 moby_class; } N_2aa008; typedef struct { @@ -491,7 +491,7 @@ void initialize_moby_motion_at_position(V_2aa008 *requested_position, for (scanned_moby = D_L00_0015FFE4_2aa008; scanned_moby; scanned_moby = scanned_moby->p28) { if (scanned_moby->moby_state != 0xFE) if (scanned_moby->moby_state != 0xFD) - if (scanned_moby->hA6 == initialized_moby->hA6) + if (scanned_moby->moby_class == initialized_moby->moby_class) if (scanned_moby != initialized_moby) { if (best == 0 || ((D_2aa008 *)scanned_moby->moby_private_vars)->i5C < bestv) { bestv = ((D_2aa008 *)scanned_moby->moby_private_vars)->i5C; From 1f83e58f51d438587735a684d6e04257eff99d1f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:21:55 +0000 Subject: [PATCH 657/758] decomp: clarify names in update_decoy_proximity_motion h1E2 -> decoy_proximity_response_gate: P_2c40a0 *P is initialized to &hero, and its s16 h1E2 feeds the existing proximity_response_gate local. Retail 0x002c40d8 loads hero+0x1e2 into s3 (original Ghidra sRam0013f532/sVar2); 0x002c40dc returns on zero before the XY <1.0 and Z <1.3 tests can activate decoy vars+0x68. At 0x002c4188-0x002c418c the same zero test clears the capped horizontal separation error before spring smoothing at 0x002c41d4. These two control uses prove a gate for the decoy proximity response rather than an offset-only identity. --- src/overlays/shared/weapons/decoy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/decoy.c b/src/overlays/shared/weapons/decoy.c index d32e23189a..4d7b962998 100644 --- a/src/overlays/shared/weapons/decoy.c +++ b/src/overlays/shared/weapons/decoy.c @@ -77,7 +77,7 @@ typedef struct { u8 hero_position_xy[8]; f32 hero_position_z; u8 pad2[0x1E2 - 0x8C]; - s16 h1E2; + s16 decoy_proximity_response_gate; } P_2c40a0; typedef struct { @@ -478,7 +478,7 @@ void update_decoy_proximity_motion(S_2c40a0 *self) __asm__("FUN_L00_002c40a0"); void update_decoy_proximity_motion(S_2c40a0 *decoy_moby) { O_2c40a0 *moby_vars = decoy_moby->decoy_motion_vars; P_2c40a0 *P = (P_2c40a0 *)&hero; - s16 proximity_response_gate = P->h1E2; + s16 proximity_response_gate = P->decoy_proximity_response_gate; f32 horizontal_displacement[4]; f32 horizontal_separation_error, horizontal_separation_distance, ground_height; if (moby_vars->i68 == 0) { From d50803171d9498ad8a99d22a2b1bdeb85408b185 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:23:50 +0000 Subject: [PATCH 658/758] decomp: clarify names in update_linked_effect_particle_with_collision_and_fade h1C -> sphere_collision_active: Retail 0x0026e924 calls the sphere collision helper with next_position and radius 0.15; 0x0026e92c-0x0026e960 stores 0 on no hit and 1 on hit into payload+0x1c. Its prior value selects collision-hit position versus the current particle position at 0x0026e934-0x0026e958. At 0x0026ea2c-0x0026ea5c the same member selects normal-based velocity reflection and 0.95 damping. Authoritative C h1C accesses and original Ghidra particle+0x3c data flow agree; linked instances also gate attraction and damping at 0x0026e6fc and 0x0026e7e4. h1E -> motion_and_fade_flags: Retail 0x0026e6b8-0x0026e6c4 loads payload+0x1e and tests inverted bit 1 to choose velocity/linked attraction integration; the set-bit path at 0x0026e88c-0x0026e894 instead copies the current position. Retail 0x0026eadc-0x0026eae4 tests mask 2 of the same member to enable packed alpha decrement by two, followed by terminal unlink/free handling at 0x0026eaec-0x0026eb34. These two independent mask tests prove motion and fade control flags, matching C h1E and original Ghidra particle+0x3e accesses. --- .../update_three_phase_effect_particle.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 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 c63652a6d4..f9b6447703 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 @@ -2522,8 +2522,8 @@ typedef struct { O_26e670_26e670 *tgt; O_26e670_26e670 *link; u32 x18; - s16 h1C; - u16 h1E; + s16 sphere_collision_active; + u16 motion_and_fade_flags; } P_26e670_26e670; struct O_26e670_26e670 { @@ -2548,7 +2548,7 @@ void update_linked_effect_particle_with_collision_and_fade(O_26e670_26e670 *part V_26e670_26e670 next_position, position_displacement, acc, projected_next_position; P_26e670_26e670 *P = &particle->p; - if ((P->h1E ^ 1) & 1) { + if ((P->motion_and_fade_flags ^ 1) & 1) { O_26e670_26e670 *linked_particle = P->link; P_26e670_26e670 *linked_particle_data = 0; f32 k = 2.0f, linked_velocity_scale_scratch; @@ -2556,7 +2556,7 @@ void update_linked_effect_particle_with_collision_and_fade(O_26e670_26e670 *part linked_particle_data = &linked_particle->p; clear_u64_value(&acc); linked_velocity_scale_scratch = 0.15f; - if (P->h1C == 0 && linked_particle != 0 && + if (P->sphere_collision_active == 0 && linked_particle != 0 && !(*(long long *)&linked_particle_data->x18 & 0x1FFFF00000000LL)) { f32 kk; f32 linked_displacement_strength = 0.2f, link_rank_step = 1.0f, @@ -2577,7 +2577,7 @@ void update_linked_effect_particle_with_collision_and_fade(O_26e670_26e670 *part } while (!(*(long long *)&linked_particle_data->x18 & 0x1FFFF00000000LL)); } linked_velocity_scale_scratch = (0.15f - linked_velocity_scale_scratch) + 1.07f; - if (linked_particle_data == 0 || linked_particle_data->h1C == 0) + if (linked_particle_data == 0 || linked_particle_data->sphere_collision_active == 0) fast_vec_add(P, P, &acc); else fast_vec_scale(P, P, 0.5f); @@ -2597,13 +2597,13 @@ void update_linked_effect_particle_with_collision_and_fade(O_26e670_26e670 *part fast_vec_add(&next_position, &acc, &P->tgt->pos); } if (FUN_L00_001f0d60_x(&next_position, 0, 0, 0.15f)) { - if (P->h1C == 0) + if (P->sphere_collision_active == 0) qcopy(&next_position, &coll_hit_position); else qcopy(&next_position, &particle->pos); - P->h1C = 1; + P->sphere_collision_active = 1; } else { - P->h1C = 0; + P->sphere_collision_active = 0; } fast_vec_sub(&acc, &P->tgt->pos, &D_L00_00166DC0_26e670); transform_vector(&acc, &acc, (u8 *)&D_L00_00166DC0_26e670 - 0x80); @@ -2618,7 +2618,7 @@ void update_linked_effect_particle_with_collision_and_fade(O_26e670_26e670 *part fast_vec_sub(&acc, &acc, &projected_next_position); particle->b08 = truncate_float_to_s32(fast_arc_tan(acc.f[0], acc.f[1]) * 128.0f / 3.1415927f) - 0x20; - if (P->h1C) { + if (P->sphere_collision_active) { FUN_L00_001ff660_x(P, P, &coll_hit_normal); fast_vec_scale(P, P, 0.95f); } else { @@ -2631,7 +2631,7 @@ void update_linked_effect_particle_with_collision_and_fade(O_26e670_26e670 *part fast_vec_scale(P, P, 0.5f); } qcopy(&particle->pos, &next_position); - if (P->h1E & 2) { + if (P->motion_and_fade_flags & 2) { s32 faded_alpha = (particle->i04 >> 24) - 2; if (faded_alpha > 0) { particle->i04 = (particle->i04 & 0xFFFFFF) | (faded_alpha << 24); From 3e5de3b3fa42fc885b1e4294f4a52257dc8dc5b0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:25:47 +0000 Subject: [PATCH 659/758] decomp: clarify names in draw_hero_glow_quads h1EB0 -> queued_glow_count: Retail 0x00207D80/0x00207DBC and 0x00207EB4/0x00207EEC load signed hero+0x1EB0, skip drawing when nonpositive, and compare it against the incremented zero-based iteration count at 0x00207DC0/0x00207EF0. Each iteration passes hero+0x1DD0 position (16-byte stride), +0x1E50 packed color, +0x1E70 quad scale and +0x1E90 position offset scale (4-byte strides) to draw_offset_textured_effect_quad at 0x00207DB4/0x00207EE4. Authoritative C names these parallel arrays queued_glow_*; supplied enqueue_hero_glow_quad uses the same layout, appends at n and increments n, while coordinate_hero_frame_update resets hero.unk1EB0 each frame. Original Ghidra's sRam00141200 is the corresponding loop bound. Thus this member counts queued glow quads. --- 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 cb64156acc..d69884e70f 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -1625,7 +1625,7 @@ typedef struct { s32 queued_glow_colors[8]; f32 queued_glow_quad_scales[8]; f32 queued_glow_position_offset_scales[8]; - s16 h1EB0; + s16 queued_glow_count; u8 p2[0x20A4 - 0x1EB2]; u8 b20A4; u8 p3[0x22D8 - 0x20A5]; @@ -1652,7 +1652,7 @@ void draw_hero_glow_quads(void) { mode = D_L00_0015F5C4; if (mode == 2 || mode == 6) { - for (i = 0; i < P.h1EB0; i++) + for (i = 0; i < P.queued_glow_count; i++) draw_offset_textured_effect_quad(&P.queued_glow_positions[i], P.queued_glow_colors[i], P.queued_glow_quad_scales[i], P.queued_glow_position_offset_scales[i]); return; } @@ -1673,7 +1673,7 @@ void draw_hero_glow_quads(void) { draw_offset_textured_effect_quad(&P.single_point_glow_position, 0x280000C0, 0.057f, 0.08f); P.single_point_glow_position.f[2] -= 0.015f; } - for (i = 0; i < P.h1EB0; i++) + for (i = 0; i < P.queued_glow_count; i++) draw_offset_textured_effect_quad(&P.queued_glow_positions[i], P.queued_glow_colors[i], P.queued_glow_quad_scales[i], P.queued_glow_position_offset_scales[i]); return; } From 614a42d5308e8cde2c9e35bb5d1d7037e3ee62f8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:25:51 +0000 Subject: [PATCH 660/758] decomp: clarify names in update_randomized_moby_point_attached_particle h6 -> expected_owner_identity: In bound particles.c SHA-256 04edbd9cd013e259a3354837809c92dfdc8b86b7cf20f4bc4aef8fa051b11350, S_274818.h6 is compared with *(s16 *)(o + 0xA6), where o is attachment_data->o and is passed to moby_point_position and build_moby_bone_transform. Retail 0x00274840 loads that owner, 0x00274848 forms particle+0x30, 0x0027484C loads the owner's signed halfword at +0xA6, and 0x00274850 loads h6 at attachment_data+6. The bne at 0x00274854 sends a mismatch to free_effect_particle at 0x00274870-74. Original Ghidra independently shows *(short *)(iVar1+0xa6) != *(short *)(iVar2+0x36) in the invalid-owner guard. Thus the member supplies the expected owner identity for validating the attachment, rather than position, selector, timer, or arithmetic input. --- 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 ee3b85a6cd..d0a5a22e1e 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -1677,7 +1677,7 @@ typedef struct { void *o; u8 b4; u8 offset_length_jitter_percent; - s16 h6; + s16 expected_owner_identity; float unk8; float unkC; } S_274818; @@ -1691,7 +1691,7 @@ void update_randomized_moby_point_attached_particle(struct EffectParticle *parti u128 attachment_offset; float one, randomized_primary_position_w, save, x; char *attachment_position; - if (o == 0 || *(s16 *)(o + 0xA6) != attachment_data->h6 || (u8)o[0x20] == 0xFE || + if (o == 0 || *(s16 *)(o + 0xA6) != attachment_data->expected_owner_identity || (u8)o[0x20] == 0xFE || (u8)o[0x20] == 0xFD) { free_effect_particle(particle); return; From ee0fa58a5a2f038fe4a6119469ae9dccea7eb96c Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:25:53 +0000 Subject: [PATCH 661/758] decomp: clarify names in update_robot_dog_hit_reaction_and_target_detection hA6 -> moby_class_id: Retail 0x002efbc0 loads the hit record's associated moby from +0x20; after the null check, 0x002efbcc reads its signed short at +0xA6 and 0x002efbd0-0x002efbd4 compares it with class 0x63 to gate the planar knockback-heading override at 0x002efbdc-0x002efbf8. Original Ghidra and authoritative C agree (hit_record->moby->hA6 == 0x63). Supplied FUN_L00_0025ff38 context filters candidate mobys using this same short member against class IDs 0xCB and 0x76C, separately testing their state byte at +0x20. These class-discrimination operations establish moby_class_id rather than an offset-only or hit-state name. --- src/overlays/l17/mobys/robot_dog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l17/mobys/robot_dog.c b/src/overlays/l17/mobys/robot_dog.c index 0c181c6e77..b2c0e50383 100644 --- a/src/overlays/l17/mobys/robot_dog.c +++ b/src/overlays/l17/mobys/robot_dog.c @@ -588,7 +588,7 @@ typedef struct { char pad7C[0x28]; unsigned char bA4; char padA5; - short hA6; + short moby_class_id; } Moby_2F1558; typedef struct { @@ -645,7 +645,7 @@ void update_robot_dog_hit_reaction_and_target_detection(void *moby_v, int clip_v *(OvlQuad *)position_buffer = *(OvlQuad *)hit_record->pos; trooper_knockback_arc( position_buffer, &knockback_heading, &moby_vars->f138, &moby_vars->f13C); - if (hit_record != 0 && hit_record->moby != 0 && hit_record->moby->hA6 == 0x63) { + if (hit_record != 0 && hit_record->moby != 0 && hit_record->moby->moby_class_id == 0x63) { knockback_heading = fast_arc_tan(moby_vars->f1F0 - moby->pos[0], moby_vars->f1F4 - moby->pos[1]); } From e2351e56058f9b7fac5e5c300422b691350f35e4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:27:45 +0000 Subject: [PATCH 662/758] decomp: clarify names in beehive_update w78 -> knockback_horizontal_magnitude: Assigned retail 0x0030224c loads clone pvars; 0x00302260 and 0x003022e4 pass pvars+0x60 as trooper_start_knockback's record. w78 is initialized to zero at 0x003022ac. Checked helper 0x00271454-0x00271474 reads this exact record+0x18 twice as float and multiplies it by cosine and sine of knockback_angle, storing the horizontal components at record+0 and +4 (0x00271464/0x00271498), matching the supplied trooper_start_knockback C. This proves the horizontal knockback magnitude; preserve its existing s32 storage. w7C -> knockback_initial_vertical_step: Assigned retail 0x00302260 forms clone pvars+0x60, passed as the knockback record at 0x003022e4/0x003022f8. w7C is zeroed at 0x003022b0 and corresponds to record+0x1c. Checked helper 0x00271470 loads record+0x1c as float and 0x0027148c copies it into record+8, the established vertical_motion_step in supplied trooper_start_knockback C. It is the initial vertical step used when starting knockback; preserve the existing s32 type. w84 -> knockback_motion_flags: Assigned retail 0x00302270 writes 8 to clone pvars+0x84, and 0x00302260/0x003022e4 pass pvars+0x60 as the knockback record. Thus this member is record+0x24. Checked helper 0x002714c8/0x002714e4 reads that word, 0x002714e8/0x002714ec ORs and stores flag 0x20 while disabling collision, and 0x002714f8 tests flag 2 to choose animation blending. These exact accesses match established knockback_state->motion_flags in the supplied helper source. --- src/overlays/l01/mobys/beehive.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l01/mobys/beehive.c b/src/overlays/l01/mobys/beehive.c index 136063e138..78f6ee3ccf 100644 --- a/src/overlays/l01/mobys/beehive.c +++ b/src/overlays/l01/mobys/beehive.c @@ -57,10 +57,10 @@ typedef struct { typedef struct { u8 pad0[0x60]; u8 path[0x18]; - s32 w78; - s32 w7C; + s32 knockback_horizontal_magnitude; + s32 knockback_initial_vertical_step; s32 w80; - s32 w84; + s32 knockback_motion_flags; f32 f88; u8 pad8C[0x24]; f32 fB0; @@ -121,13 +121,13 @@ void beehive_update(SpawnerMoby *beehive_moby) { if (spawned_clone != 0) { nv = spawned_clone->pvars; k = 0.8f; - nv->w84 = 8; + nv->knockback_motion_flags = 8; nv->w80 = truncate_float_to_s32(nv->f250 * k * 1024.0f); nv->f88 = nv->f250 * k; nv->fB0 = 7.0f; nv->fB4 = 13.0f; - nv->w78 = 0; - nv->w7C = 0; + nv->knockback_horizontal_magnitude = 0; + nv->knockback_initial_vertical_step = 0; trooper_start_knockback( spawned_clone, nv->path, From 06363791b6cc20eb2be843dac61edf90b995e2e5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:27:48 +0000 Subject: [PATCH 663/758] decomp: clarify names in update_nanotech_ball_collection_effects pF8 -> collection_particle_byte_source: In update_nanotech_ball_collection_effects, both successful spawn_timed_hero_relative_particle returns receive *D_L00_001B2080_lui.pF8 at effect_record[2]. Retail 0x002d8774-0x002d8780 loads the pointer at table base 0x001b2080+0xf8, reads its first byte with lbu, then stores it to returned particle+2; 0x002d87d4-0x002d87e0 repeats this for the second particle. Original Ghidra expresses both writes as *(undefined1 *)((int)lVar8 + 2) = *puRam001b2178. Thus this private u8* member is the byte source for the paired collection particles, independent of any unproven texture interpretation. --- src/overlays/shared/pickups/nanotech_ball.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/pickups/nanotech_ball.c b/src/overlays/shared/pickups/nanotech_ball.c index 2f122e35cc..1f139a7fea 100644 --- a/src/overlays/shared/pickups/nanotech_ball.c +++ b/src/overlays/shared/pickups/nanotech_ball.c @@ -109,7 +109,7 @@ typedef struct { typedef struct { u8 p0[0xF8]; - u8 *pF8; + u8 *collection_particle_byte_source; } T_2d8510; typedef union { @@ -1188,7 +1188,7 @@ s32 update_nanotech_ball_collection_effects(M_2d8510 *moby) { 1, nanotech_ball_collection_particle_scale_factors[i] * color_progress_or_size_factor); if (effect_record) - effect_record[2] = *D_L00_001B2080_lui.pF8; + effect_record[2] = *D_L00_001B2080_lui.collection_particle_byte_source; effect_record = spawn_timed_hero_relative_particle( &effect_position, al | 0xFFFFFF, @@ -1200,7 +1200,7 @@ s32 update_nanotech_ball_collection_effects(M_2d8510 *moby) { nanotech_ball_collection_particle_scale_factors[i] * (color_progress_or_size_factor * 0.7f)); if (effect_record) - effect_record[2] = *D_L00_001B2080_lui.pF8; + effect_record[2] = *D_L00_001B2080_lui.collection_particle_byte_source; fast_vec_add(&effect_position, &effect_position, &effect_position_step); } return any_effect_timer_above_threshold; From af6fee069dc8a977eebaf67c8363860963441ad6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:29:30 +0000 Subject: [PATCH 664/758] decomp: clarify names in camera_transition_update h20 -> transition_eligible_update_count: Q_2ea488.h20 is the descriptor's signed +0x20 counter: retail 0x002ea578 loads it, 0x002ea588 increments it, and 0x002ea594 stores it after request match/bypass, both +0x86 whitelist gates and the collision-volume gate. At 0x002ea598-0x002ea5a4 the incremented signed count is compared with duration conversion(7); reaching the threshold returns 1 at 0x002ea5b0-0x002ea5c4. Request mismatch clears it at 0x002ea610 and rejected modes clear it at 0x002ea518/0x002ea53c. This proves an eligible transition-update count, without assuming frame or timer units. h22 -> transition_steering_latched: Q_2ea488.h22 at descriptor +0x22 is set to 1 at retail 0x002ea57c/0x002ea58c on the accepted transition-steering path, alongside incrementing +0x20 and clearing the angle-blend timer. On request mismatch, 0x002ea4ec loads this latch and 0x002ea60c tests it: zero skips directly to the timer tail, while nonzero is cleared at 0x002ea618 before camera/hero residual alignment testing and initialization of transition_angle_blend_timer at 0x002ea718-0x002ea720. Rejected modes also clear it at 0x002ea608. These set/test/consume operations prove a steering latch rather than a counter. --- .../shared/camera/hero_aligned_camera.c | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/camera/hero_aligned_camera.c b/src/overlays/shared/camera/hero_aligned_camera.c index 2359aa659c..8bf0216795 100644 --- a/src/overlays/shared/camera/hero_aligned_camera.c +++ b/src/overlays/shared/camera/hero_aligned_camera.c @@ -40,8 +40,8 @@ typedef struct { typedef struct { u8 p0[0x20]; - s16 h20; - s16 h22; + s16 transition_eligible_update_count; + s16 transition_steering_latched; s32 transition_angle_blend_timer; } Q_2ea488; @@ -452,9 +452,9 @@ int camera_transition_update(u8 *transition_camera_record, char *mode_check_obje if (r && (*(s32 *)(r + 0x18) & 1)) return 0; q->transition_angle_blend_timer = 0; - q->h22 = 1; - q->h20++; - if (q->h20 >= FUN_001f96f8_2ea488(7)) { + q->transition_steering_latched = 1; + q->transition_eligible_update_count++; + if (q->transition_eligible_update_count >= FUN_001f96f8_2ea488(7)) { if (*(s16 *)(active_transition_camera_record + 0x86) == 0) transition_camera_record[0x7C] = 5; return 1; @@ -466,14 +466,14 @@ int camera_transition_update(u8 *transition_camera_record, char *mode_check_obje &transition_vector_scratch, 0.06981316953897476f, transition_vector_scratch.f[2]); goto tail; off: - q->h20 = 0; - q->h22 = 0; + q->transition_eligible_update_count = 0; + q->transition_steering_latched = 0; goto tail; } - q->h20 = 0; - if (q->h22 == 0) + q->transition_eligible_update_count = 0; + if (q->transition_steering_latched == 0) goto tail; - q->h22 = 0; + q->transition_steering_latched = 0; b = D_L00_00166E10_2ea488; transition_camera_globals = b - 0x190; alignment_comparison_axis = b + 0x30; From 8f4c6ff438a0629f7abcebc5954ce4c4e9e233c7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:31:43 +0000 Subject: [PATCH 665/758] decomp: clarify names in visibomb_update fD8 -> launch_direction_z: At 0x002b327c retail loads the f32 at visibomb_moby+0xD8 into f13, while 0x002b3284 passes vector_length_xy(moby+0xD0) in f12 to fast_arc_tan at 0x002b3280. The resulting f21 controls vertical spherical launch offset via its negative at 0x002b3298-0x002b32a4 and is the spawn pitch argument at 0x002b3314. Checked spawn helper preserves incoming f13 at 0x002b58f4 and stores it to missile+0x44 at 0x002b5964. Thus this is the Z direction component paired with XY magnitude for launch pitch, not itself a pitch angle. vD0 -> launch_direction_xy: O_b3058 declares this as f32[2]. At 0x002b3274/0x002b3278 retail passes visibomb_moby+0xD0 to vector_length_xy; at 0x002b3280/0x002b3284 that horizontal magnitude is paired with the +0xD8 scalar in fast_arc_tan. The angle becomes f21, its negative feeds build_spherical_offset at 0x002b3298-0x002b32a4, and f21 feeds spawn_visibomb_missile at 0x002b3314-0x002b3320. These are the XY direction components used to derive launch pitch, not a position or angle pair. --- src/overlays/shared/weapons/visibomb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/weapons/visibomb.c b/src/overlays/shared/weapons/visibomb.c index d8428f2dad..c722448301 100644 --- a/src/overlays/shared/weapons/visibomb.c +++ b/src/overlays/shared/weapons/visibomb.c @@ -58,8 +58,8 @@ typedef struct { u8 pad71[0x78 - 0x71]; V_b3058 *v; u8 pad7C[0xD0 - 0x7C]; - f32 vD0[2]; - f32 fD8; + f32 launch_direction_xy[2]; + f32 launch_direction_z; } O_b3058; extern int D_0015EEA4; @@ -119,7 +119,7 @@ void visibomb_update(O_b3058 *visibomb_moby) { fast_vec_add(launch_position, launch_position, u); fast_vec_add(launch_position, launch_position, &camera->pos); } else if (hero.unk22C8 == 1) { - b = fast_arc_tan(vector_length_xy(visibomb_moby->vD0), visibomb_moby->fD8); + b = fast_arc_tan(vector_length_xy(visibomb_moby->launch_direction_xy), visibomb_moby->launch_direction_z); build_spherical_offset(launch_position, 0.6f, launch_yaw, -b); fast_vec_add(launch_position, launch_position, visibomb_moby->v10); } else { From 1f306dec624311c76fa7c67582cd3848f45f1e59 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:33:25 +0000 Subject: [PATCH 666/758] decomp: clarify names in adjust_hero_velocity_from_collision_probes vE0 -> hero_velocity: Authoritative source SHA-256 1f77865ac4d3d732f639ba82a2a8711b00e2dc068ecbddf1b3e1bb37d41e1350 and original retail Ghidra/instructions agree: hero+0xe0 is passed to gravity_length_xy at 0x0022920c-0x00229210 and tested against frame_time*0.1. The same vector is addressed through origin base+0x60 at 0x002292f0 and copied at 0x00229388 to construct the horizontal velocity-directed probe. In established adjust_hero_velocity_from_collision_probes, 0x002294dc-0x002294fc computes the negative horizontal dot of this vector with the flattened normalized collision vector; only a positive component is scaled and added back into hero+0xe0 at 0x00229510-0x00229524. These operations establish the hero velocity being corrected, consistent with supplied caller context applying gravity to hero.motion.velocity immediately afterward. --- .../hero/update_hero_vehicle_attachments_and_effects.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 c854ef0083..d3b0ce5813 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 @@ -419,7 +419,7 @@ typedef struct { u8 p0[0x98]; f32 probe_heading_angle; u8 p1[0xE0 - 0x9C]; - V_2291d0 vE0; + V_2291d0 hero_velocity; u8 p2[0x240 - 0xF0]; s32 velocity_probe_hit_moby; u8 p3[0x308 - 0x244]; @@ -460,7 +460,7 @@ void adjust_hero_velocity_from_collision_probes(int force) { if (P.h308 != 0) return; - if (gravity_length_xy(&P.vE0) < frame_time * 0.1f) + if (gravity_length_xy(&P.hero_velocity) < frame_time * 0.1f) return; primary_origin_z_offset = 0.3700000047683716f; k = 0.5f; @@ -507,10 +507,10 @@ void adjust_hero_velocity_from_collision_probes(int force) { P.velocity_probe_hit_moby = X.probe_collision_hit_moby; *(s32 *)&X.v40.f[2] = 0; sceVu0Normalize(&X.v40, &X.v40); - negative_horizontal_dot = -P.vE0.f[0] * X.v40.f[0] - P.vE0.f[1] * X.v40.f[1]; + negative_horizontal_dot = -P.hero_velocity.f[0] * X.v40.f[0] - P.hero_velocity.f[1] * X.v40.f[1]; if (0.0f < negative_horizontal_dot) { fast_vec_scale(&X.v40, &X.v40, negative_horizontal_dot); - fast_vec_add(&P.vE0, &P.vE0, &X.v40); + fast_vec_add(&P.hero_velocity, &P.hero_velocity, &X.v40); } } } From 5635823d0af97b9bf160e9943575d008746a369b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:33:28 +0000 Subject: [PATCH 667/758] decomp: clarify names in adjust_hero_planar_velocity_from_probes vE0 -> hero_velocity: Retail 0x0020a364-0x0020a368 passes hero+0xE0 to gravity_length_xy for the motion threshold. The same vector is hero_position+0x60 at 0x0020a440-0x0020a448, copied at 0x0020a4d8-0x0020a4dc and scaled to generate the planar probe displacement. At 0x0020a62c-0x0020a64c its X/Y components enter the negative dot product; 0x0020a668-0x0020a674 adds the positive correction back to hero+0xE0. This agrees with the established adjust_hero_planar_velocity_from_probes name, supplied caller motion-velocity flow and original Ghidra fRam0013f430/fRam0013f434 accesses, proving hero velocity rather than merely an offset-based vector name. --- .../shared/hero/update_hero_and_vehicle_mode_effects.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c b/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c index 8f5064668a..3efb5b465d 100644 --- a/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c +++ b/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c @@ -335,7 +335,7 @@ typedef struct { u8 p0[0x98]; f32 probe_heading_angle; u8 p1[0xE0 - 0x9C]; - V_20a328 vE0; + V_20a328 hero_velocity; u8 p2[0x240 - 0xF0]; s32 i240; u8 p3[0x308 - 0x244]; @@ -379,7 +379,7 @@ void adjust_hero_planar_velocity_from_probes(int force) { if (P.h308 != 0) return; - if (gravity_length_xy(&P.vE0) < frame_time * 0.1f) + if (gravity_length_xy(&P.hero_velocity) < frame_time * 0.1f) return; position_z_offset = 0.3700000047683716f; k = 0.5f; @@ -424,10 +424,10 @@ void adjust_hero_planar_velocity_from_probes(int force) { P.i240 = X.i18; *(s32 *)&X.v40.f[2] = 0; sceVu0Normalize(&X.v40, &X.v40); - negative_xy_dot_product = -P.vE0.f[0] * X.v40.f[0] - P.vE0.f[1] * X.v40.f[1]; + negative_xy_dot_product = -P.hero_velocity.f[0] * X.v40.f[0] - P.hero_velocity.f[1] * X.v40.f[1]; if (0.0f < negative_xy_dot_product) { fast_vec_scale(&X.v40, &X.v40, negative_xy_dot_product); - FUN_001f9a10_20a328(&P.vE0, &P.vE0, &X.v40); + FUN_001f9a10_20a328(&P.hero_velocity, &P.hero_velocity, &X.v40); } } } From 41c7a1e7063d119067a86c97b1992bedf916c797 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:35:13 +0000 Subject: [PATCH 668/758] decomp: clarify names in unfolding_column_update fE0 -> piece_offset_direction: In unfolding_column_update state UNFOLDING_COLUMN_SWING_PIVOT, retail 0x00305fe0 loads the pivot into s3 and 0x00306018 forms s5=pivot+0xE0. At 0x00306050-0x00306078 the loop scales this float[4] vector by unfolding_column_piece_spacing*i + unfolding_column_first_piece_offset into position_offset. Retail 0x0030607c-0x00306090 adds that offset to pivot+0x10 and writes each piece position. Original Ghidra shows the same scale(pivot+0xe0) then position-add flow, proving the member supplies the direction of each piece's offset from the pivot rather than merely identifying its storage offset. --- src/overlays/l14/mobys/unfolding_column.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l14/mobys/unfolding_column.c b/src/overlays/l14/mobys/unfolding_column.c index ab8f0ed86e..b6fc381df8 100644 --- a/src/overlays/l14/mobys/unfolding_column.c +++ b/src/overlays/l14/mobys/unfolding_column.c @@ -24,7 +24,7 @@ typedef struct UnfoldingColumnMoby { char pad7C[0x44]; float rot[4]; /* 0xC0 */ char padD0[0x10]; - float fE0[4]; /* 0xE0 */ + float piece_offset_direction[4]; /* 0xE0 */ char padF0[0x10]; } UnfoldingColumnMoby; @@ -155,7 +155,7 @@ void unfolding_column_update(UnfoldingColumnMoby *moby) { remaining_timer_fraction); for (i = 0; i < 6; i++) { fast_vec_scale(position_offset, - pivot->fE0, + pivot->piece_offset_direction, unfolding_column_piece_spacing * (float)i + unfolding_column_first_piece_offset); fast_vec_add(pieces[i]->pos, pivot->pos, position_offset); From 3b1a59d4a172f960ed0e004e0d9a54ff74c39cdd Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:35:16 +0000 Subject: [PATCH 669/758] decomp: clarify names in handle_constructorbot_damage_and_retargeting fA0 -> knockback_collision_restitution: Root 0x002d8714 stores 0.5 into pvars+0xA0 = knockback state+0x30 in surviving-hit reaction. Checked collision response 0x0025f468..0x0025f4b4 computes velocity dot collision normal, tests for incoming negative component, loads state+0x30 at 0x0025f48c and adds one, multiplies dot by its negative, scales the normal and adds to velocity. Thus normal velocity is reversed with this restitution coefficient. Checked 0x00210400 multiplies XYZ components and sums them; 0x00210568 normalizes the vector and scales to f12 using vrsqrt/vmulq. Requests 01b1f7d81aa949ae9d9283326c8144b4, 2591c984b2a74e0c8050eb9a7a738679 and 58e86b3808ef4ef291b77be16d5e302e prove the formula. fBC -> knockback_horizontal_target_speed: Source assigns constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C in both reaction branches; retail 0x002d8724/0x002d87e4 stores to pvars+0xBC = knockback state+0x4C. Checked motion 0x0025ed28..0x0025ed60 obtains XY speed, loads state+0x4C as approach target at 0x0025ed44, uses state+0x14 as approach step, and rescales XY velocity. State+0x3E == 2 substitutes zero. Supported by supplied prior helper findings and evidence request 01b1f7d81aa949ae9d9283326c8144b4. fC0 -> knockback_ascent_animation_target_frame: Root stores 6.5 at pvars+0xC0 = knockback state+0x50 after starting hit/death animation (0x002d8778/0x002d8838). Motion phase zero uses upward Z velocity divided by gravity at 0x0025f024..0x0025f02c, then loads state+0x50, subtracts current animation coordinate returned by 0x002511b0, divides by remaining ascent time and approaches moby+0x58 animation speed (0x0025f050..0x0025f188). Motion changes phase zero to one when Z velocity becomes negative at 0x0025f4bc..0x0025f4e0. Checked 0x002511b0 reads animation sequence pointers +0x68/+0x6C, frame data short+4 and interpolation at moby+0x54. Requests 01b1f7d81aa949ae9d9283326c8144b4 and 0f1c32ac7a674792a3b3e7426c00f3af establish the ascent animation frame goal. fC4 -> knockback_descent_animation_target_frame: Root stores 11.0 for hit reaction at 0x002d877c and 13.0 for death at 0x002d883c to pvars+0xC4 = knockback state+0x54. Descending motion phase one calls animation-coordinate helper 0x002511b0 at 0x0025f080, compares its result against state+0x54 and stops animation speed at goal (0x0025f088..0x0025f0a0). Otherwise it estimates time from gravity, Z velocity and height above ground at 0x0025f0a4..0x0025f100, computes (state+0x54 - current animation coordinate)/time at 0x0025f124..0x0025f13c, clamps to 0..2 and approaches moby+0x58 animation speed. Requests 01b1f7d81aa949ae9d9283326c8144b4 and 0f1c32ac7a674792a3b3e7426c00f3af prove this descent animation frame goal. --- src/overlays/l02/mobys/constructorbot.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/l02/mobys/constructorbot.c b/src/overlays/l02/mobys/constructorbot.c index 9fd5ca24c1..c7bc4e8e00 100644 --- a/src/overlays/l02/mobys/constructorbot.c +++ b/src/overlays/l02/mobys/constructorbot.c @@ -576,13 +576,13 @@ typedef struct { int i94; float knockback_collision_center_z_offset; char pad9C[4]; - float fA0; /* 0xA0 */ + float knockback_collision_restitution; /* 0xA0 */ char padA4[9]; unsigned char bAD; /* 0xAD */ char padAE[0xE]; - float fBC; /* 0xBC */ - float fC0; - float fC4; + float knockback_horizontal_target_speed; /* 0xBC */ + float knockback_ascent_animation_target_frame; + float knockback_descent_animation_target_frame; char padC8[0x158]; char *target; /* 0x220 */ } Vars85b8; @@ -618,8 +618,8 @@ void handle_constructorbot_damage_and_retargeting(void *owner_moby) { constructorbot_hit_knockback_horizontal_speed_approach_rate_gp * frame_time_sq; moby_vars->knockback_initial_horizontal_speed = constructorbot_hit_knockback_horizontal_speed_gp * D_0015ED6C; moby_vars->knockback_initial_vertical_speed = constructorbot_hit_knockback_vertical_speed_gp * D_0015ED6C; - moby_vars->fBC = constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C; - moby_vars->fA0 = 0.5f; + moby_vars->knockback_horizontal_target_speed = constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C; + moby_vars->knockback_collision_restitution = 0.5f; moby_vars->i94 = 25; moby_vars->bAD = 0; trooper_start_knockback(fast_arc_tan(MOBY(moby)->pos.x - hero.motion.pos.f[0], @@ -629,8 +629,8 @@ void handle_constructorbot_damage_and_retargeting(void *owner_moby) { 0xB, 1, 0); - moby_vars->fC0 = 6.5f; - moby_vars->fC4 = 11.0f; + moby_vars->knockback_ascent_animation_target_frame = 6.5f; + moby_vars->knockback_descent_animation_target_frame = 11.0f; moby[0x20] = 0x10; } } else { @@ -640,7 +640,7 @@ void handle_constructorbot_damage_and_retargeting(void *owner_moby) { constructorbot_death_knockback_horizontal_speed_approach_rate_gp * frame_time_sq; moby_vars->knockback_initial_horizontal_speed = constructorbot_death_knockback_horizontal_speed_gp * D_0015ED6C; moby_vars->knockback_initial_vertical_speed = constructorbot_death_knockback_vertical_speed_gp * D_0015ED6C; - moby_vars->fBC = constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C; + moby_vars->knockback_horizontal_target_speed = constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C; moby_vars->i94 = 9; moby_vars->bAD = 0; trooper_start_knockback(fast_arc_tan(MOBY(moby)->pos.x - hero.motion.pos.f[0], @@ -650,8 +650,8 @@ void handle_constructorbot_damage_and_retargeting(void *owner_moby) { 0xE, 1, 0); - moby_vars->fC0 = 6.5f; - moby_vars->fC4 = 13.0f; + moby_vars->knockback_ascent_animation_target_frame = 6.5f; + moby_vars->knockback_descent_animation_target_frame = 13.0f; MOBY(moby)->flags &= 0xEFFF; moby_vars->flash = 0xFA; moby[0x20] = 0x11; From 474f5bf25ef9340e89c3c33aec1ef16383c3f345 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:35:19 +0000 Subject: [PATCH 670/758] decomp: clarify names in rocket_tank_update w120 -> path_target_node_index: D1454.w120 is cleared at retail 0x002f7ce0 during rocket_tank_update initialization. Both active states call checked helper 0x002f8658 with the same moby. The helper loads its private-data pointer from moby+0x78 at 0x002f8688, loads +0x120 at 0x002f8690, shifts that integer by 4 at 0x002f869c and selects the 16-byte position at path+0x10+index*16 at 0x002f86a4..0x002f86b0. That position determines steering and arrival distance. When distance is below 1, 0x002f87f4..0x002f881c adds a nonzero randomized node offset and stores the remainder modulo the path node count back to +0x120. The bound C update_rocket_tank_path_movement agrees, proving this field selects the target path node rather than being an unspecified counter. --- src/overlays/l18/mobys/rocket_tank.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l18/mobys/rocket_tank.c b/src/overlays/l18/mobys/rocket_tank.c index 862675ee5e..486251b2ec 100644 --- a/src/overlays/l18/mobys/rocket_tank.c +++ b/src/overlays/l18/mobys/rocket_tank.c @@ -54,7 +54,7 @@ typedef struct { float pad114; float firing_pitch; char pad11C[4]; - int w120; + int path_target_node_index; int w124; char pad128[8]; float aim_vector_length_limit; @@ -105,7 +105,7 @@ void rocket_tank_update(M1454 *moby) { *(unsigned char *)((char *)tank_data + 0x28) = 3; *(float *)((char *)tank_data + 0x20) = 6.0f; tank_data->w124 = scale_game_frames(240); - tank_data->w120 = 0; + tank_data->path_target_node_index = 0; if (tank_data->c138 == 0) { char *c = create_moby(0x14B); tank_data->c138 = c; From b3d8bd1cdc459d7e3a8b2433468122a25a54f418 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:37:39 +0000 Subject: [PATCH 671/758] decomp: clarify names in draw_hero_glow_quads h22D8 -> on_foot_single_glow_suppressed: In draw_hero_glow_quads, P aliases hero at 0x0013F350. After the vehicle-mode-zero test at 0x00207E30 and slot-three item tests at 0x00207E38-0x00207E50, retail loads the signed halfword hero+0x22D8 at 0x00207E44/0x00207E58. The nonzero branch at 0x00207E5C skips the single-point draw at 0x00207E9C using hero+0x1D80, color 0x280000C0 and scale 0.057, while continuing to the queued-glow loop at 0x00207EB4. Original Ghidra expresses the same gate as sRam00141628 == 0. Thus the member's proven role is suppression of the on-foot single glow only. h22FC -> clank_glow_scale_boost: The HeroVehicleMode Clank branch at 0x00207F58 loads signed halfword hero+0x22FC at 0x00207F60. Retail initializes f12 to 0.07 at 0x00207F64-0x00207F6C, tests the member at 0x00207F70, and replaces f12 with 0.101500005 at 0x00207F78-0x00207F80 when nonzero. That scale target flows through optional 1.7 multiplication to the easing call at 0x00207FF0 and the resulting hero+0x162C scale is passed to draw_offset_textured_effect_quad at 0x00208008-0x00208014. Original Ghidra tracks the member as sRam0014164c. Supplied update_hero_in_vehicle_mode also uses hero.unk22FC to enlarge the associated effect moby by 1.4. This proves a Clank glow scale boost role without asserting the effect identity. --- 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 d69884e70f..f4e45f4158 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -1629,11 +1629,11 @@ typedef struct { u8 p2[0x20A4 - 0x1EB2]; u8 b20A4; u8 p3[0x22D8 - 0x20A5]; - s16 h22D8; + s16 on_foot_single_glow_suppressed; u8 p4[0x22E4 - 0x22DA]; s32 three_point_glow_color; u8 p5[0x22FC - 0x22E8]; - s16 h22FC; + s16 clank_glow_scale_boost; u8 p6[2]; s32 clank_glow_color; } P_207d40; @@ -1668,7 +1668,7 @@ void draw_hero_glow_quads(void) { return; } if (vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) { - if ((hero_slot_item_id(3) == 3 || hero_slot_item_id(3) == 2) && P.h22D8 == 0) { + if ((hero_slot_item_id(3) == 3 || hero_slot_item_id(3) == 2) && P.on_foot_single_glow_suppressed == 0) { P.single_point_glow_position.f[2] += 0.015f; draw_offset_textured_effect_quad(&P.single_point_glow_position, 0x280000C0, 0.057f, 0.08f); P.single_point_glow_position.f[2] -= 0.015f; @@ -1685,7 +1685,7 @@ void draw_hero_glow_quads(void) { } if (vehicle_mode == HERO_VEHICLE_MODE_CLANK) { k = 0.07f; - if (P.h22FC) + if (P.clank_glow_scale_boost) k = 0.101500004529953f; if (*(u8 *)0x15EDB3) { P.single_point_glow_position.f[2] -= 0.01f; From 459d7cca2664da70ad9fe4b7a74db6475ef8705f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:37:42 +0000 Subject: [PATCH 672/758] decomp: clarify names in update_mode_controlled_orbiting_trail_particle h18 -> position_offset_multiplier: In R_274518, retail 0x00274578 loads data+0x18 as signed halfword, 0x00274584 converts it to float, and 0x00274594 scales the XYZ offset loaded from data+0/+4/+8. At 0x002745a8 that scaled offset is added to reference+0x10 to produce particle position. Retail 0x002746a4-0x002746a8 also copies this multiplier into an emitted mode-0 particle at +0x38; the current C mirrors both flows. h1A -> alpha_fade_decrement: Retail 0x0027454c loads R_274518 data+0x1A into a1 and 0x00274550 calls decrement_packed_countdown on particle+4 in mode 0. The supplied helper subtracts this amount from the packed word's top byte and clamps at zero; particle+7 is the established particle_alpha field. The spawning C initializes data+0x1A to truncate(127.0f/lifetime_frames), proving the per-update alpha-fade decrement. h1C -> trail_particle_mode: Retail 0x00274540-0x00274544 tests R_274518 data+0x1C for mode 0, selecting alpha fade and optional referenced-offset following. Comparisons with 1 at 0x00274600-0x00274608 and 0x002746ac-0x002746b4 select trail spawning and the trigonometric orbit update. The supplied constructor stores its mode argument at data+0x1C and selects the texture according to zero versus nonzero, confirming this is the particle family's mode selector. --- .../shared/rendering/effects/particles.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index d0a5a22e1e..5eddf0b111 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -1580,9 +1580,9 @@ typedef struct { u8 *iC; f32 unk10; f32 unk14; - s16 h18; - s16 h1A; - s16 h1C; + s16 position_offset_multiplier; + s16 alpha_fade_decrement; + s16 trail_particle_mode; } R_274518; typedef struct { @@ -1607,8 +1607,8 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { u8 *spawned_particle; f32 k1, k2, z; - if (r->h1C == 0) { - if (decrement_packed_countdown(particle->b4, r->h1A)) + if (r->trail_particle_mode == 0) { + if (decrement_packed_countdown(particle->b4, r->alpha_fade_decrement)) goto kill; if (r->iC == 0) return; @@ -1616,7 +1616,7 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { position_offset_scratch.y = r->unk4; position_offset_scratch.z = r->unk8; fast_vec_scale( - &position_offset_scratch, &position_offset_scratch, convert_integer_to_float(r->h18)); + &position_offset_scratch, &position_offset_scratch, convert_integer_to_float(r->position_offset_multiplier)); fast_vec_add(particle->v10, r->iC + 0x10, &position_offset_scratch); return; } @@ -1629,7 +1629,7 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { return; } } - if (r->h1C == 1) { + if (r->trail_particle_mode == 1) { z = 0.0f; FUN_L00_002743a8_274518(0, particle->v10, scale_game_frames(10), z, z, 0, particle->particle_alpha, 0); } else { @@ -1646,9 +1646,9 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { particle->particle_alpha, &position_offset_scratch); if (spawned_particle) - *(s16 *)(spawned_particle + 0x38) = r->h18; + *(s16 *)(spawned_particle + 0x38) = r->position_offset_multiplier; } - if (r->h1C != 1) + if (r->trail_particle_mode != 1) return; qcopy(particle->v10, r->iC + 0x10); k1 = 2.25f; From f03b4256d334fd9ed0a413b5ddf9d61fde0a00ce Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:37:46 +0000 Subject: [PATCH 673/758] decomp: clarify names in update_alien_snapper_hit_response_and_targeting fC0 -> motion_apex_animation_frame: Assigned source BlargVars float fC0 is written as 5.0 for knockback at retail 0x002f937c and 7.5 for death at 0x002f9410 before setup receives pvars+0x70. Checked setup 0x0026b39c-0x0026b3e8 establishes block+8 as vertical velocity. Checked motion update 0x0026b4e4-0x0026b4f8 subtracts block+0x10 gravity from that velocity; 0x0026bcac-0x0026bcc8 changes flight phase from 0 to 1 when it becomes negative. In phase 0, 0x0026b80c-0x0026b84c computes abs(vertical_velocity/gravity), subtracts the current interpolated animation frame returned by 0x0025da88 from block+0x50 (pvars+0xC0), and divides by the remaining time to apex. 0x0026b860-0x0026b974 approaches this rate in moby+0x58 (animation speed). Checked frame accessor 0x0025daa4-0x0025db60 reads moby sequence records +0x68/+0x6C, blends their signed +4 frame values using moby+0x54, and scales by 1/16. Thus this field is the animation frame targeted at the motion apex. fC4 -> motion_landing_animation_frame: Assigned source BlargVars float fC4 is written as 8.5 for knockback at retail 0x002f9384 and 14.5 for death at 0x002f9414 before setup receives pvars+0x70. Checked motion update 0x0026b868-0x0026b888 in descending phase 1 compares the interpolated animation frame from 0x0025da88 with block+0x54 (pvars+0xC4), stopping animation at the target. 0x0026b88c-0x0026b8b8 supplies -0.5*gravity, vertical_velocity+0.5*gravity and moby_z minus ground height to the flight-time solver; 0x0026b8bc-0x0026b908 chooses a positive bounded remaining time. 0x0026b90c-0x0026b974 divides target frame minus current frame by that time, clamps rate to 0..2 and approaches it in moby+0x58. Ground contact changes phase to 2 at 0x0026bbe4-0x0026bbe8; phase 2 restores speed 1 at 0x0026b980-0x0026b98c. Checked accessor 0x0025daa4-0x0025db60 interpolates sequence-record frame values. Thus this field is the animation frame targeted at landing. --- src/overlays/l06/mobys/alien_snapper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l06/mobys/alien_snapper.c b/src/overlays/l06/mobys/alien_snapper.c index d2c86b8112..1d29ab8bde 100644 --- a/src/overlays/l06/mobys/alien_snapper.c +++ b/src/overlays/l06/mobys/alien_snapper.c @@ -216,8 +216,8 @@ typedef struct BlargVars { float horizontal_motion_speed; /* 0x88 */ float f8C; /* 0x8C */ char pad90[0x30]; - float fC0; /* 0xC0 */ - float fC4; /* 0xC4 */ + float motion_apex_animation_frame; /* 0xC0 */ + float motion_landing_animation_frame; /* 0xC4 */ char padC8[0x58]; char selected_target_xy[0x8]; /* 0x120 */ float selected_target_z; /* 0x128 */ @@ -829,8 +829,8 @@ void update_alien_snapper_hit_response_and_targeting(Moby *moby) { moby->state = ALIEN_SNAPPER_STATE_HIT_KNOCKBACK; snapper_vars->horizontal_motion_speed = frame_time + frame_time; snapper_vars->f8C = frame_time; - snapper_vars->fC0 = 5.0f; - snapper_vars->fC4 = 8.5f; + snapper_vars->motion_apex_animation_frame = 5.0f; + snapper_vars->motion_landing_animation_frame = 8.5f; func_L00_0025D5B0_2FA618( moby, snapper_vars->f70, 9, 1, 0, fast_arc_tan(target->x, target->y)); snapper_vars->f67 = 0xFA; @@ -841,8 +841,8 @@ void update_alien_snapper_hit_response_and_targeting(Moby *moby) { moby->flags &= 0xEFFF; snapper_vars->horizontal_motion_speed = frame_time * 8.0f; snapper_vars->f8C = frame_time * 5.0f; - snapper_vars->fC0 = 7.5f; - snapper_vars->fC4 = 14.5f; + snapper_vars->motion_apex_animation_frame = 7.5f; + snapper_vars->motion_landing_animation_frame = 14.5f; func_L00_0025D5B0_2FA618( moby, snapper_vars->f70, 10, 1, 0, fast_arc_tan(target->x, target->y)); snapper_vars->f67 = 0xFA; From 68c820df35f6991d0fcf19c7b90ea35e6cc7339d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:39:58 +0000 Subject: [PATCH 674/758] decomp: clarify names in draw_wrench_swing_effect h78 -> cached_swing_animation: Retail 0x002a7844-0x002a787c reads hero moby animation byte +0x52 and falls back to signed halfword r+0x78 when that animation is outside 0x17..0x19 and 0x2B. At 0x002a7880-0x002a78c4 the selected animation is stored back to r+0x78 (0x17/0x18/0x19, otherwise 0x2B), while selecting configuration index 0/1/2/3. At 0x002a78f0-0x002a7910 that index selects effects + index*0x60. Original Ghidra uVar9 and *(undefined2 *)(puVar2 + 0x1e), and authoritative C r->h78 reads/writes, agree that this private s16 caches the animation selector across changes in the hero's current animation. --- src/overlays/shared/weapons/wrench.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/weapons/wrench.c b/src/overlays/shared/weapons/wrench.c index 835164c0a9..cbc1c4b272 100644 --- a/src/overlays/shared/weapons/wrench.c +++ b/src/overlays/shared/weapons/wrench.c @@ -47,7 +47,7 @@ typedef struct { u8 pad[0x30]; f32 f70; u8 pad2[4]; - s16 h78; + s16 cached_swing_animation; } R_2a7780; typedef struct { @@ -314,20 +314,20 @@ void draw_wrench_swing_effect(O_2a7780 *effect_owner) { color = 0x808080; alpha = scale; if (!((u32)(P_2a7780_G.p2080[0x52] - 0x17) < 3 || P_2a7780_G.p2080[0x52] == 0x2B)) - k = r->h78; + k = r->cached_swing_animation; else k = P_2a7780_G.p2080[0x52]; if (k == 0x17) { - r->h78 = k; + r->cached_swing_animation = k; idx = 0; } else if (k == 0x18) { - r->h78 = k; + r->cached_swing_animation = k; idx = 1; } else if (k == 0x19) { - r->h78 = k; + r->cached_swing_animation = k; idx = 2; } else { - r->h78 = 0x2B; + r->cached_swing_animation = 0x2B; alpha = 0.7f; idx = 3; scale = 1.25f; From b5c34dcd2c37af896c4c3c9dbeda380f905ea322 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:41:41 +0000 Subject: [PATCH 675/758] decomp: clarify names in thruster_pack_flame_update iC -> has_previous_emission_position: V_4198.iC is cleared at private +0x0c by sw zero,0xc(s0) at 002b4508 upon growth completion, before active calls to emit_beam_trail_particles at 002b45f8. That helper loads the same moby+0x78 private block into s7 at 002b3c8c; +0x0c gates previous-position interpolation at 002b3dbc/002b3dcc and 002b3ff4/002b3ff8. Its saved position is private+0x10 (s5 at 002b3dd0), used in distance/subtract operations to place intermediate trail particles. At 002b40ec-002b40f0 it copies the current emission position from s4 into private+0x10, then stores 1 at +0x0c at 002b40fc. Supplied C names this same binding N.has_previous_position and saves emission_position to N.v10. Thus iC records whether a previous emission position is available, rather than a timer or counter. --- src/overlays/shared/weapons/thruster_pack_flame.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/thruster_pack_flame.c b/src/overlays/shared/weapons/thruster_pack_flame.c index 8d35f2ecc7..b8cc1c0bee 100644 --- a/src/overlays/shared/weapons/thruster_pack_flame.c +++ b/src/overlays/shared/weapons/thruster_pack_flame.c @@ -346,7 +346,7 @@ typedef struct { s32 beam_transition_timer; char pad4[4]; s32 thruster_pack_moby; - s32 iC; + s32 has_previous_emission_position; char pad10[0x10]; f32 f20; f32 f24; @@ -941,7 +941,7 @@ void thruster_pack_flame_update(void *moby) { v->f20 = 0.0125f; v->f24 = 0.2f; v->f28 = 0.05f; - v->iC = 0; + v->has_previous_emission_position = 0; v->f2C = 0.025f; } break; From 3f132d525c0d3119529fdfe0653bad8a1d5b10bc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:41:44 +0000 Subject: [PATCH 676/758] decomp: clarify names in update_screamer_hit_reactions_and_targeting fC0 -> selected_target_vectors: Assigned retail 0x002dff18-0x002dff28 passes pvars+0xC0 as a1 to selector 0x002527c8; path branches at 0x002e0028-0x002e0054 and 0x002e0070-0x002e009c pass the same array, and 0x002e00c8-0x002e00d4 uses its leading vector for XY target-distance checking. Checked helper preserves a1 in s2 at 0x002527e8, selects a candidate moby in s1 at 0x002528d0/0x00252954, and at 0x00252978-0x0025298c copies selected moby position (+0x10) and another vector (+0x40) into output+0/+0x10. It fills output+0x20/+0x30 from default-target vectors at 0x002529a4-0x002529b4 or duplicates and raises selected position Z by 0.6 at 0x002529c0-0x002529e8. With no target, 0x002529f8-0x00252a08 clears all four vectors. Thus the complete char[0x40] is selected-target vector output; target pointer/status at output+0x40/+0x44 belong to separate existing fields. --- src/overlays/l10/mobys/screamer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l10/mobys/screamer.c b/src/overlays/l10/mobys/screamer.c index facf499d84..b63fa68dcc 100644 --- a/src/overlays/l10/mobys/screamer.c +++ b/src/overlays/l10/mobys/screamer.c @@ -344,7 +344,7 @@ typedef struct MobyData_2DFC38 { char pad88[0x15]; unsigned char f9D; char pad9E[0x22]; - char fC0[0x40]; + char selected_target_vectors[0x40]; int f100, f104; char pad108[8]; char color_reaction_state_header[7]; @@ -454,7 +454,7 @@ void update_screamer_hit_reactions_and_targeting(struct Moby *moby) { screamer_vars->current_target_range = screamer_vars->default_target_range; if (screamer_vars->f174 == 2) { - target_selection_status = ahead_f(screamer_vars->current_target_range, moby, screamer_vars->fC0); + target_selection_status = ahead_f(screamer_vars->current_target_range, moby, screamer_vars->selected_target_vectors); if (target_selection_status != TARGET_SELECTION_DEFAULT_TARGET_EXCLUDED) { LevelCuboid *bp = &l10_cuboids[screamer_vars->target_bounds_cuboid_index]; fast_vec_sub(relative_offset, D_0013F3D0, &bp->pos); @@ -468,16 +468,16 @@ void update_screamer_hit_reactions_and_targeting(struct Moby *moby) { } else if (moby->state == SCREAMER_STATE_WAIT_FOR_ACTIVATION && screamer_vars->activation_wait_target_path_index >= 0) { LevelPath *path = l10_paths[screamer_vars->activation_wait_target_path_index]; target_selection_status = activate_effect_l08( - screamer_vars->current_target_range, moby, screamer_vars->fC0, 0, 0, path->points, path->count); + screamer_vars->current_target_range, moby, screamer_vars->selected_target_vectors, 0, 0, path->points, path->count); } else if (moby->state != SCREAMER_STATE_WAIT_FOR_ACTIVATION && screamer_vars->active_target_path_index >= 0) { LevelPath *path = l10_paths[screamer_vars->active_target_path_index]; target_selection_status = activate_effect_l08( - screamer_vars->current_target_range, moby, screamer_vars->fC0, 0, 0, path->points, path->count); + screamer_vars->current_target_range, moby, screamer_vars->selected_target_vectors, 0, 0, path->points, path->count); } else { - target_selection_status = ahead_f(screamer_vars->current_target_range, moby, screamer_vars->fC0); + target_selection_status = ahead_f(screamer_vars->current_target_range, moby, screamer_vars->selected_target_vectors); } if (target_selection_status != TARGET_SELECTION_DEFAULT_TARGET_EXCLUDED) { - if (screamer_vars->current_target_range < vector_distance_xy(screamer_vars->navigation_state, screamer_vars->fC0)) + if (screamer_vars->current_target_range < vector_distance_xy(screamer_vars->navigation_state, screamer_vars->selected_target_vectors)) screamer_vars->f104 = 2; else if (moby->visible == 0) screamer_vars->f104 = 2; From 7ff2d54670cc47d4fa3676f39f170ada3129cbdf Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:43:45 +0000 Subject: [PATCH 677/758] decomp: clarify names in initialize_pause_menu w224 -> transition_target_level: G841F0.w224 -> transition_target_level. Assigned original retail Ghidra shows DAT_00184414 = DAT_001B9DD4 for a pending owner in scene state 11 or 15; retail 00276480/00276498 installs pending_state as current state, and 002764ac..002764b8 loads GameState+0xE4 then stores it at 001841F0+0x224. Authoritative C names that field w224. Checked level-00 caller update_pause_menu, request 26c2d09f5d0a4fc7a09fe01e44999f72, report SHA-256 a62e60ba59632c08149666f75b6bc4d008c71fd82bf253ee312baf873c06ee7b: 00276cfc/00276d08/00276d18 selects action request 2; 00276d20..00276d34 loads the same field for debug output, and 00276d38/00276d3c passes it as a0 to established prepare_target_level_transition (0028ed58). Supplied source and checked caller Ghidra agree. This proves the saved transition target level role, not merely its offset. --- src/overlays/shared/ui/menus/initialize_pause_menu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/shared/ui/menus/initialize_pause_menu.c b/src/overlays/shared/ui/menus/initialize_pause_menu.c index bf8afcb3bf..c40a9e25af 100644 --- a/src/overlays/shared/ui/menus/initialize_pause_menu.c +++ b/src/overlays/shared/ui/menus/initialize_pause_menu.c @@ -116,7 +116,7 @@ struct Ent { typedef struct { u8 pad0[0x224]; - s32 w224; + s32 transition_target_level; u8 pad228[0x18]; s32 unk240; s32 unk244; @@ -269,7 +269,7 @@ void initialize_pause_menu(void) { D_L00_001B9CF0.state = pending_state; if (pending_state == PAUSE_MENU_STATE_CLOSE_ON_ACTION || pending_state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ON_ACTION) { small_buffers = 1; - D_L00_001841F0.w224 = (s32)D_L00_001B9CF0.unkE4; + D_L00_001841F0.transition_target_level = (s32)D_L00_001B9CF0.unkE4; } D_L00_001B9CF0.pending_owner = 0; D_L00_001B9CF0.pending_state = PAUSE_MENU_PENDING_STATE_CLEARED; @@ -558,8 +558,8 @@ void update_pause_menu(void) { D_L00_001B9CF0.unk104 = 0; D_L00_001B9CF0.unk10 = 0; if (D_L00_001B9CF0.unkC == 2) { - debug_print(level_transition_debug_format, D_L00_001841F0.w224); - prepare_target_level_transition(D_L00_001841F0.w224); + debug_print(level_transition_debug_format, D_L00_001841F0.transition_target_level); + prepare_target_level_transition(D_L00_001841F0.transition_target_level); } else if (D_L00_001B9CF0.unkC == 3) { previous_decode_mode = decode_mode; decode_mode = 2; From def38e3483c3559ff1f3247b84eb88db8f8b2f3b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:43:48 +0000 Subject: [PATCH 678/758] decomp: clarify names in vendor_update mC -> auxiliary_moby: Q_2a57a8.mC retains create_moby(0x477): retail 0x002a5890/0x002a58a0 passes the class and 0x002a58a8 stores its returned pointer at vendor private data+0xc. Retail 0x002a58d4-0x002a58f8 copies vendor XY and sets the created object's Z to vendor Z+2.95. Loads from this member feed attach_manipulator for indices 0 and 1 at 0x002a5908-0x002a5924 and update_entity at 0x002a5aac/0x002a5ab0. The same object's auxiliary_scale is multiplied by effect_scale_factor at 0x002a5a84-0x002a5aa8 and 0x002a5bf0-0x002a5c14; 0x002a5d78-0x002a5dac checks this pointer then zeros its scale via the factor. Source q->mC accesses agree, proving this member is the vendor's auxiliary moby rather than the incoming vendor itself. --- src/overlays/shared/vendor/vendor.c | 38 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/overlays/shared/vendor/vendor.c b/src/overlays/shared/vendor/vendor.c index 57c493c347..0b1e125bdb 100644 --- a/src/overlays/shared/vendor/vendor.c +++ b/src/overlays/shared/vendor/vendor.c @@ -57,7 +57,7 @@ typedef struct { typedef struct { s32 i0, i4; u8 p8[4]; - M_2a57a8 *mC; + M_2a57a8 *auxiliary_moby; u8 p10[0x90 - 0x10]; f32 effect_scale_factor; } Q_2a57a8; @@ -317,31 +317,31 @@ void vendor_update(P_2a57a8 *vendor_moby) { vendor_moby->vendor_state = VENDOR_WAIT_FOR_HERO; q->i0 = 0; q->i4 = 0; - q->mC = create_moby(0x477); - q->mC->h34 |= 2; - q->mC->h32 = 0x40; - q->mC->f10 = vendor_moby->f10; - q->mC->f14 = vendor_moby->f14; - q->mC->f18 = vendor_moby->f18 + 2.95f; - q->mC->b73 = 0x20; + q->auxiliary_moby = create_moby(0x477); + q->auxiliary_moby->h34 |= 2; + q->auxiliary_moby->h32 = 0x40; + q->auxiliary_moby->f10 = vendor_moby->f10; + q->auxiliary_moby->f14 = vendor_moby->f14; + q->auxiliary_moby->f18 = vendor_moby->f18 + 2.95f; + q->auxiliary_moby->b73 = 0x20; q->effect_scale_factor = 0.0f; for (i = 0; i < 2; i++) { - attach_manipulator(q->mC, i, (u8 *)q + 0x10 + i * 0x40); + attach_manipulator(q->auxiliary_moby, i, (u8 *)q + 0x10 + i * 0x40); } - update_entity(q->mC); + update_entity(q->auxiliary_moby); break; case VENDOR_WAIT_FOR_HERO: if (q->effect_scale_factor > 0.0f) q->effect_scale_factor -= 0.1f; if (q->effect_scale_factor <= 0.0f) - q->mC->h34 |= 1; + q->auxiliary_moby->h34 |= 1; if (!(D_L00_0015F5CC_2a57a8 & 7) && vector_distance_xy(&vendor_moby->f10, &hero_pos) <= 16.0f && absolute_float(vendor_moby->f18 - hero_pos.f[2]) <= 8.0f) { vendor_moby->vendor_state = VENDOR_HERO_NEARBY; if (vendor_moby->b53 != 1) blend_moby_animation(vendor_moby, 1, 0, 10); - q->mC->h34 &= 0xFFFE; + q->auxiliary_moby->h34 &= 0xFFFE; } add_draw_callback(FUN_L00_002a5040_2a57a8, vendor_moby); build_axis_rotation_quaternion((u8 *)q + 0x20, 2, vendor_manipulator_rotation_phase); @@ -351,8 +351,8 @@ void vendor_update(P_2a57a8 *vendor_moby) { fast_add_rotations(vendor_manipulator_rotation_phase, 0.01f); vendor_manipulator_counter_rotation_phase = fast_add_rotations(vendor_manipulator_counter_rotation_phase, -0.02f); - q->mC->auxiliary_scale = q->effect_scale_factor * q->mC->p24->auxiliary_scale_multiplier * 2.5f; - update_entity(q->mC); + q->auxiliary_moby->auxiliary_scale = q->effect_scale_factor * q->auxiliary_moby->p24->auxiliary_scale_multiplier * 2.5f; + update_entity(q->auxiliary_moby); break; case VENDOR_HERO_NEARBY: if (q->effect_scale_factor < 1.0f) @@ -375,8 +375,8 @@ void vendor_update(P_2a57a8 *vendor_moby) { fast_add_rotations(vendor_manipulator_rotation_phase, 0.01f); vendor_manipulator_counter_rotation_phase = fast_add_rotations(vendor_manipulator_counter_rotation_phase, -0.02f); - q->mC->auxiliary_scale = q->effect_scale_factor * q->mC->p24->auxiliary_scale_multiplier * 2.5f; - update_entity(q->mC); + q->auxiliary_moby->auxiliary_scale = q->effect_scale_factor * q->auxiliary_moby->p24->auxiliary_scale_multiplier * 2.5f; + update_entity(q->auxiliary_moby); if (hero.state.control_mode != 0 && hero.state.current != 3 && hero.state.control_mode != 1) { interaction_allowed = 0; @@ -412,10 +412,10 @@ void vendor_update(P_2a57a8 *vendor_moby) { } break; case VENDOR_ZERO_AUXILIARY_SCALE: - if (q->mC) { + if (q->auxiliary_moby) { q->effect_scale_factor = 0.0f; - q->mC->auxiliary_scale = q->mC->p24->auxiliary_scale_multiplier * q->effect_scale_factor * 2.5f; - update_entity(q->mC); + q->auxiliary_moby->auxiliary_scale = q->auxiliary_moby->p24->auxiliary_scale_multiplier * q->effect_scale_factor * 2.5f; + update_entity(q->auxiliary_moby); } break; } From ca01953521b40ec59eb00eee1ea3c6c67cf21d4b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:45:53 +0000 Subject: [PATCH 679/758] decomp: clarify names in follow_camera_avoid_mobies h1A -> source_moby_type_id: Retail 002e82a4 loads hero_moby from hero+0x2080; 002e82b8 lhu v0,0xa6(v1) reads that source moby's type discriminator and 002e82c4 sh v0,0x6a(sp) writes descriptor+0x1A (descriptor base sp+0x50). This same source moby is supplied to make_hit_descriptor at 002e8284/002e829c. The authoritative C identifies moby+0xA6 as MOBY(...)->oclass in the nearby-moby comparisons corresponding to 002e7e5c. Bounded record_moby_hit 00259b74-00259b78 copies descriptor+0x1A unchanged into hit-record+0x2A. Thus h1A records the source moby's type ID. --- src/overlays/shared/camera/follow_camera_setup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 9b27b01746..1c6186b892 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -1368,7 +1368,7 @@ typedef struct { u8 pad0[0x18]; u8 b18; u8 b19; - u16 h1A; + u16 source_moby_type_id; u8 pad1C[0x14]; } W_2e7d20; @@ -1575,7 +1575,7 @@ void follow_camera_avoid_mobies(u8 *camera_moby) { make_hit_descriptor(&hit_descriptor, D_0013F350_lui.hero_moby, 0x800000, &v20, 20.0f); hit_descriptor.b18 = 3; hit_descriptor.b19 = 3; - hit_descriptor.h1A = *(u16 *)(D_0013F350_lui.hero_moby + 0xA6); + hit_descriptor.source_moby_type_id = *(u16 *)(D_0013F350_lui.hero_moby + 0xA6); record_moby_hit((*(E40_2e7d20_t *)&D_L00_00173E40_lui).collision_hit_moby, &hit_descriptor); } BI_2e7d20(0x4C)++; From 974d8ad6289554cc5e78bbbb7b94075c7bd887ea Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:48:01 +0000 Subject: [PATCH 680/758] decomp: clarify names in update_hero_moby_probed_height_bounds fD20 -> height_probe_downward_angle_radians: G_208b60.fD20 is the stored f32 angle at hero+0xD20. Retail 0x00208c3c-0x00208ca4 subtracts it from the 0.97/1.5 target, clamps the angular step to +/-0.052, then adds and stores the updated angle. At 0x00208ccc-0x00208cfc its cosine scales both planar components and its negative sine becomes vector Z. The resulting direction is copied at 0x00208d00-0x00208d04 and used in collision-probe displacement at 0x00208dec-0x00208e28. The supplied C and original Ghidra uRam00140070 data flow agree, proving the downward direction angle relative to the XY plane, in radians. --- src/overlays/shared/hero/hero_idle_sequence.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index f4e45f4158..3f126db4b0 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -2043,7 +2043,7 @@ typedef struct { u8 p2F8[0x30E - 0x2F8]; s16 h30E; u8 p310[0xD20 - 0x310]; - f32 fD20; + f32 height_probe_downward_angle_radians; u8 pD24[0x2080 - 0xD24]; M_208b60 *height_probe_moby; s32 i2084; @@ -2082,22 +2082,22 @@ void update_hero_moby_probed_height_bounds(void) { k = 0.97f; if (G.h30E != 0 || G.i208C == 4) k = 1.5f; - rotation_step = fast_subtract_rotations(k, G.fD20); + rotation_step = fast_subtract_rotations(k, G.height_probe_downward_angle_radians); if (0.052f < rotation_step) rotation_step = 0.052f; else if (rotation_step < -0.052f) rotation_step = -0.052f; - G.fD20 = fast_add_rotations(G.fD20, rotation_step); + G.height_probe_downward_angle_radians = fast_add_rotations(G.height_probe_downward_angle_radians, rotation_step); get_moby_light_direction(G.height_probe_moby, &v); planar_angle = fast_arc_tan(v.f[0], v.f[1]); planar_cosine = fast_cos(planar_angle); planar_sine = fast_sin(planar_angle); { - f32 direction_xy_scale = fast_cos(G.fD20); + f32 direction_xy_scale = fast_cos(G.height_probe_downward_angle_radians); v.f[0] = planar_cosine * direction_xy_scale; v.f[1] = planar_sine * direction_xy_scale; } - v.f[2] = -fast_sin(G.fD20); + v.f[2] = -fast_sin(G.height_probe_downward_angle_radians); qcopy(&l00_hero_height_probe_direction, &v); probe_reference_z = G.f2D8; if (probe_reference_z < 1.0f) { From 215fc0ee3d06fb5c34f12ff7c82325523cce6f2f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:48:04 +0000 Subject: [PATCH 681/758] decomp: clarify names in update_hero_attachment fFC -> attachment_yaw_delta: Hero_234800.fFC is a float written at retail 0x00234778 (swc1 f0,0xfc(s0)). Entry instruction 0x00233fd8 saves hero+0x98 yaw in f23 (saved_hero_yaw). Attachment probe/anchor selection updates that same yaw at 0x002344b0 and 0x0023454c..0x00234568. Instructions 0x0023476c..0x00234774 pass current hero yaw and saved entry yaw to fast_subtract_rotations; its result is stored to fFC. The authoritative C explicitly assigns fast_subtract_rotations(v90.z, saved_hero_yaw), proving attachment-derived yaw delta rather than an absolute angle. --- 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 eaf19c2996..566575287f 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1396,7 +1396,7 @@ typedef struct Hero_234800 { Vec_234800 pos; Vec_234800 v90; char pA0[0x5C]; - float fFC; + float attachment_yaw_delta; char p100[0x50]; Vec_234800 v150; char p160[0x24]; @@ -1683,7 +1683,7 @@ void update_hero_attachment(void) { qcopy((Vec_234800 *)(hero_233f80 + 0x350), &attachment_motion_scratch); } fast_vec_add(hero_233f80 + 0xF0, hero_233f80 + 0xF0, &attachment_motion_scratch); - ((Hero_234800 *)hero_233f80)->fFC = + ((Hero_234800 *)hero_233f80)->attachment_yaw_delta = fast_subtract_rotations(((Hero_234800 *)hero_233f80)->v90.z, saved_hero_yaw); } From 2766ac73e20479dabad24ff7990af37cd4b4a0c6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:50:44 +0000 Subject: [PATCH 682/758] decomp: clarify names in update_splitting_effect_particle_with_collision_response_and_fade h0A -> split_countdown: Moby_26ff10.h0A is s16. Retail 0026ff48-0026ff5c tests particle +0xA for nonzero and passes its address to fast_dec_timer_s16 (001fef98); only expiry enters the block that perturbs parent position/velocity and calls particle constructor 0026fd28 at 00270090. Retail 002700a4-002700ac sets the child +0xA to scale_game_frames(2), scheduling its next split. Original Ghidra shows the same guarded timer call, child construction and two-frame timer store; authoritative C agrees. 0027019c-002701b0 also uses the remaining countdown in texture-slot arithmetic. --- .../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 f9b6447703..2d1164ea70 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 @@ -3301,7 +3301,7 @@ typedef struct Moby_26ff10 { u32 f04; u8 f08; char pad09; - s16 h0A; + s16 split_countdown; f32 f0C; VV posv; PV pv; @@ -3344,7 +3344,7 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff f32 f, rotation_direction_sign, alpha_factor; pv = &particle->pv; - if (particle->h0A != 0 && fast_dec_timer_s16(&particle->h0A) != 0) { + if (particle->split_countdown != 0 && fast_dec_timer_s16(&particle->split_countdown) != 0) { f32 sp, lo, hi, sc, zero, nsp; pv->f18 |= 0x88; lo = 0.5f; @@ -3364,7 +3364,7 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff v0u.f[2] = v0u.f[2] + random_float_between(-pv->z * sc, zero); spawned_particle = FUN_L00_0026fd28_26ff10(v1u.f, v0u.f, 0x88, pv->f1C); if (spawned_particle != 0) { - spawned_particle->h0A = scale_game_frames(2); + spawned_particle->split_countdown = scale_game_frames(2); spawned_particle->f0C = particle->f0C; } fast_vec_scale(pv, pv, random_float_between(lo, hi)); @@ -3377,7 +3377,7 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff particle->posv.f[2] = particle->posv.f[2] + random_float_between(nsp, sp); } tab = effect_texture_ids; - particle->animated_texture_id = tab[(particle->h0A + pv->f16 + (particle->animated_texture_id - tab[0])) & 7]; + particle->animated_texture_id = tab[(particle->split_countdown + pv->f16 + (particle->animated_texture_id - tab[0])) & 7]; fast_vec_add(v0u.f, particle->posv.f, pv); k = pv->f14; if (scale_game_frames(3) < k) { From 47605c779690f3084a475a8d3ccee2d798c0873f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:50:48 +0000 Subject: [PATCH 683/758] decomp: clarify names in agnogg_ship_front_update fB0 -> persistent_slot_index: Retail 002fae10-002fae28 loads moby+0xB0 and indexes the persistent byte table at 0x14C050 + current_level_index*16. Retail 002fb444-002fb448 passes that byte to established jet_clear_persistent. Checked helper 00265080-002650a0 ignores index 0xFF and otherwise writes 0xFF to exactly that per-level table slot. At 002fb2e8-002fb2f4 and 002fb304-002fb35c the linked moby's same field supplies the slot encoded as slot+2 in collected/cleared state, proving a persistent-slot index rather than an arbitrary byte. fB2 -> collected_state_index: Retail 002fb2e4 loads the linked moby's signed short at +0xB2, then 002fb2ec-002fb2f4 uses it as the index for the byte store into the collected array at 0x1BAA50+0x454. Retail 002fb348-002fb35c repeats the same +0xB2 index for the cleared save-state byte array at 0x1BB6B0+0x454. SHA-bound C expresses these accesses as Lv.collected[ents_macro[data->link].fB2] and l01_save_state.cleared[ents_macro[data->link].fB2]; the stored value is the linked persistent slot plus 2. This proves the member selects the collected-state entry. --- src/overlays/l01/mobys/agnogg_ship_front.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/l01/mobys/agnogg_ship_front.c b/src/overlays/l01/mobys/agnogg_ship_front.c index b93ef31d54..2c87fb5f1e 100644 --- a/src/overlays/l01/mobys/agnogg_ship_front.c +++ b/src/overlays/l01/mobys/agnogg_ship_front.c @@ -104,9 +104,9 @@ typedef struct { /* 0x98 */ char pad98[0xE]; /* 0xA6 */ short oclass; /* 0xA8 */ char padA8[8]; - /* 0xB0 */ unsigned char fB0; + /* 0xB0 */ unsigned char persistent_slot_index; /* 0xB1 */ char padB1; - /* 0xB2 */ short fB2; + /* 0xB2 */ short collected_state_index; /* 0xB4 */ char padB4[8]; /* 0xBC */ unsigned char fBC; /* 0xBD */ char padBD[0x43]; @@ -192,7 +192,7 @@ void agnogg_ship_front_update(Moby_2FC140 *moby) { break; case AGNOGG_SHIP_WAIT_FOR_DESCENT_TRIGGER: level_table_byte = - *(unsigned char *)(moby->fB0 + (current_level_index_macro << 4) + visited52); + *(unsigned char *)(moby->persistent_slot_index + (current_level_index_macro << 4) + visited52); if (level_table_byte == 0xFF) { if (moby->requested_animation_sequence != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(0x14)); @@ -326,13 +326,13 @@ void agnogg_ship_front_update(Moby_2FC140 *moby) { queue_planet_unlock_message(3); moby->flags = moby->flags & 0xFFBE; if (data->link != -1) { - ((Lv *)D_L01_001BAD60_2FC140)->collected[ents_macro[data->link].fB2] = - ents_macro[data->link].fB0 + 2; - if (ents_macro[data->link].fB0 == 0xFF || - (D_L01_0015FC88[ents_macro[data->link].fB0] != 0xFF && - visited52[ents_macro[data->link].fB0 + (current_level_index_macro << 4)] == + ((Lv *)D_L01_001BAD60_2FC140)->collected[ents_macro[data->link].collected_state_index] = + ents_macro[data->link].persistent_slot_index + 2; + if (ents_macro[data->link].persistent_slot_index == 0xFF || + (D_L01_0015FC88[ents_macro[data->link].persistent_slot_index] != 0xFF && + visited52[ents_macro[data->link].persistent_slot_index + (current_level_index_macro << 4)] == 0xFF)) { - l01_save_state.cleared[ents_macro[data->link].fB2] = ents_macro[data->link].fB0 + 2; + l01_save_state.cleared[ents_macro[data->link].collected_state_index] = ents_macro[data->link].persistent_slot_index + 2; } } if (data->f3C != -1) { @@ -348,7 +348,7 @@ void agnogg_ship_front_update(Moby_2FC140 *moby) { &ents_macro[data->f38].fBC, 1, &ents_macro[data->f38], 1, D_L01_001BAAA0); } } - jet_clear_persistent(moby->fB0); + jet_clear_persistent(moby->persistent_slot_index); if (data->rec != -1) { jet_reset_camera(&l01_cuboids_macro[data->rec].pos, &l01_cuboids_macro[data->rec].rot); } From 5c190e9ab3a171c2afc5628bec9a9eee03c5060f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:52:38 +0000 Subject: [PATCH 684/758] decomp: clarify names in the_plumber_update bB0 -> persistent_state_slot: In bound src/overlays/shared/cutscenes/the_plumber.c, bB0 indexes visited52[bB0 + current_level_index * 16] and supplies jet_clear_persistent. Retail 0x002ff28c loads unsigned moby+0xb0; 0x002ff294-0x002ff2a4 forms and reads table 0x0014c050 + level*16 + that byte; 0x002ff2b0-0x002ff2b4 passes the same byte to jet_clear_persistent at 0x00265080. Checked helper 0x00265080-0x002650a0 skips argument 0xff, forms the identical per-level table address from its argument, and stores 0xff there. Thus the member selects a persistent-state slot; the name does not infer narrative meaning. --- src/overlays/shared/cutscenes/the_plumber.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/cutscenes/the_plumber.c b/src/overlays/shared/cutscenes/the_plumber.c index 48ed412803..1d3175b451 100644 --- a/src/overlays/shared/cutscenes/the_plumber.c +++ b/src/overlays/shared/cutscenes/the_plumber.c @@ -53,7 +53,7 @@ typedef struct { char pad7C[3]; unsigned char flag7F; char pad80[0x30]; - unsigned char bB0; + unsigned char persistent_state_slot; char padB1; unsigned short hB2; } L01WatchMoby; @@ -203,8 +203,8 @@ void the_plumber_update(L01WatchMoby *plumber_moby) { case PLUMBER_LEVEL_ONE_POST_DIALOGUE: if (cutscene_mode == CUTSCENE_MODE_ACTIVE) break; - if (visited52[plumber_moby->bB0 + current_level_index * 16] != 0xFF) { - jet_clear_persistent(plumber_moby->bB0); + if (visited52[plumber_moby->persistent_state_slot + current_level_index * 16] != 0xFF) { + jet_clear_persistent(plumber_moby->persistent_state_slot); if (plumber_vars->camera_cuboid_index != -1) { LevelCuboid *camera_record = &l01_cuboids[plumber_vars->camera_cuboid_index]; jet_reset_camera(&camera_record->pos, &camera_record->rot); From 45ebfa9257f12d8ea2570195d059af806e381291 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:54:38 +0000 Subject: [PATCH 685/758] decomp: clarify names in handle_extermibot_hits_and_update_targeting fC0 -> knockback_apex_animation_target: Authoritative Wing float fC0 is pvars+0xC0, assigned 5.0 at retail 0x003035e0 and 5.5 at 0x003036a8 before the pvars+0x70 knockback starter. Checked common-caller motion consumer 0x00286910 retains this state in s2. In rising phase (state+0x3e=0), 0x00286c74-0x00286c80 computes abs(vertical_velocity/gravity), the remaining apex time. At 0x00286ca0-0x00286cb4 it subtracts the interpolated animation scalar returned by 0x00279030 from state+0x50 (this member), divides by apex time, and approaches moby+0x58 at 0x00286dcc-0x00286ddc. Checked 0x00279030 interpolates animation record short+4 through moby+0x68/+0x6c using blend scalar +0x54. Thus this is the animation target synchronized to knockback apex, not merely an unexplained constant. fC4 -> knockback_landing_animation_target: Authoritative Wing float fC4 is pvars+0xC4, assigned 10.0 at retail 0x003035e4 and 11.0 at 0x003036ac before knockback state pvars+0x70 is passed onward. Checked motion consumer 0x00286910 uses state+0x54 for this member. In falling phase (state+0x3e=1), 0x00286cd0-0x00286cf0 compares interpolated animation scalar from 0x00279030 against this target and stops moby+0x58 when reached. 0x00286cf4-0x00286d50 solves the vertical ground-intersection quadratic using gravity, vertical velocity, moby Z and ground height, selecting a positive time. 0x00286d74-0x00286ddc divides target minus interpolated animation scalar by this predicted time, clamps the rate to 0..2 and approaches moby+0x58. Checked scalar producer 0x00279030 interpolates animation record values. This proves a landing-synchronized knockback animation target without claiming frame units. --- src/overlays/l05/mobys/extermibot.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l05/mobys/extermibot.c b/src/overlays/l05/mobys/extermibot.c index dda1b0f434..3a4a610a18 100644 --- a/src/overlays/l05/mobys/extermibot.c +++ b/src/overlays/l05/mobys/extermibot.c @@ -687,8 +687,8 @@ typedef struct Wing { char pad6[0x11]; unsigned char bAD; char pad7[0x12]; - float fC0; - float fC4; + float knockback_apex_animation_target; + float knockback_landing_animation_target; char pad8[0x58]; char selected_target_position_xy[8]; float selected_target_position_z; @@ -831,10 +831,10 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { case EXTERMIBOT_HIT_START_NONLETHAL_KNOCKBACK: case EXTERMIBOT_HIT_START_NONLETHAL_KNOCKBACK_AND_FLASH: case EXTERMIBOT_HIT_START_KNOCKBACK_WITH_FLASH: - moby_data->fC0 = 5.0f; + moby_data->knockback_apex_animation_target = 5.0f; moby_data->knockback_xy_magnitude = extermibot_nonlethal_knockback_xy_scale_gp * D_0015ED6C; moby_data->knockback_z_magnitude = extermibot_nonlethal_knockback_z_scale_gp * D_0015ED6C; - moby_data->fC4 = 10.0f; + moby_data->knockback_landing_animation_target = 10.0f; nonlethal_knockback_heading = fast_arc_tan(moby->pos.x - hit_record->who->pos.x, moby->pos.y - hit_record->who->pos.y); *(u128_3047E8 *)working_vector = hit_record->dir; @@ -850,8 +850,8 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { moby_data->knockback_gravity = extermibot_death_knockback_gravity_gp * D_0015ED70; moby_data->knockback_xy_magnitude = extermibot_death_knockback_xy_scale_gp * D_0015ED6C; moby_data->knockback_z_magnitude = extermibot_death_knockback_z_scale_gp * D_0015ED6C; - moby_data->fC0 = 5.5f; - moby_data->fC4 = 11.0f; + moby_data->knockback_apex_animation_target = 5.5f; + moby_data->knockback_landing_animation_target = 11.0f; death_knockback_heading = fast_arc_tan(moby->pos.x - hit_record->who->pos.x, moby->pos.y - hit_record->who->pos.y); *(u128_3047E8 *)working_vector = hit_record->dir; From 3806b38ffcfc038a174693a4a26b5fdb46ab0ec7 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:54:41 +0000 Subject: [PATCH 686/758] decomp: clarify names in ground_attached_update hA8 -> drop_inheritance_tag: In the authoritative crate.c snapshot (SHA-256 a23b9029c6b206a0246a346a238514e454e7d136c50ed40a72bb4313333fe6d4), M_2cfcb8.hA8 is a u16 copied into Vars.hC4 in both initialization paths. Retail 0x002cfdcc lhu v0,0xA8(a2) and 0x002cfde0 sh v0,0xC4(s0), repeated at 0x002cffdc/0x002cffec, prove the unchanged save. Checked sibling crate_drop_bolts evidence request 2e083555021d437b98d42817090ef89e establishes that after successful spawn_on_path at 0x002d0944..0x002d0950, 0x002d0790 loads crate vars+0xC4, 0x002d0794 loads spawned moby pvars, and 0x002d07a0 stores the same halfword at spawned pvars+4. Thus this is the crate attribute inherited by each spawned drop, supporting the deliberately opaque name drop_inheritance_tag without asserting UID, mission, or consumer semantics. --- src/overlays/shared/pickups/crate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/pickups/crate.c b/src/overlays/shared/pickups/crate.c index e6eebecc94..a80fd4113d 100644 --- a/src/overlays/shared/pickups/crate.c +++ b/src/overlays/shared/pickups/crate.c @@ -116,7 +116,7 @@ typedef struct M_2cfcb8 { struct Vars *vars; u8 p7c[0xA6 - 0x7C]; s16 oclass; - u16 hA8; + u16 drop_inheritance_tag; u8 pAA[0xB0 - 0xAA]; u8 mission; } M_2cfcb8; @@ -685,7 +685,7 @@ void ground_attached_update(M_2cfcb8 *moby) { return; } flags_before = vars->flags; - vars->hC4 = moby->hA8; + vars->hC4 = moby->drop_inheritance_tag; vars->height = 1.0f; vars->flags = flags_before | 1; ungrouped_crate_position = &moby->pos; @@ -734,7 +734,7 @@ void ground_attached_update(M_2cfcb8 *moby) { mark_moby_for_removal(moby); } else { member_flags = vars->flags; - vars->hC4 = moby->hA8; + vars->hC4 = moby->drop_inheritance_tag; vars->height = 1.0f; vars->flags = member_flags | 1; group_crate_probe_position = &moby->pos; From 03fbadfc794f2d653fb10b55a71c74f113ed6bf2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 15:59:10 +0000 Subject: [PATCH 687/758] decomp: clarify names in update_hero_attachment h1F6 -> path_clearance_position_anchor_inhibit: In supplied C, resolve_hero_pending_path_clearance writes hero.unk1F6 = 4 when resolve_point_path_segment_clearance succeeds. In assigned retail 0x00234128..0x00234138, after the ordinary control-mode, zero-vector and h30E checks, lh v0,0x1f6(s0) followed by beq v0,zero,0x00234158 admits position-anchor setup only when zero. Nonzero falls through 0x00234144..0x00234150 to the special 0x18/0x19 state test, otherwise clearing position-anchor bit 1 at 0x00234304..0x00234318. This proves a path-clearance-associated ordinary position-anchor inhibit, without claiming its units or timer lifecycle. --- 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 566575287f..9d3e3ad531 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1402,7 +1402,7 @@ typedef struct Hero_234800 { char p160[0x24]; float f184; char p188[0x6E]; - short h1F6; + short path_clearance_position_anchor_inhibit; char p1F8[0x104]; void *p2FC; char p300[0xE]; @@ -1506,7 +1506,7 @@ void update_hero_attachment(void) { } if (((((Hero_234800 *)hero_233f80)->i208C == 0 || ((Hero_234800 *)hero_233f80)->i208C == 12) && fast_vec_length(&((Hero_234800 *)hero_233f80)->v150) == 0.0f && - ((Hero_234800 *)hero_233f80)->h30E == 0 && ((Hero_234800 *)hero_233f80)->h1F6 == 0) || + ((Hero_234800 *)hero_233f80)->h30E == 0 && ((Hero_234800 *)hero_233f80)->path_clearance_position_anchor_inhibit == 0) || (unsigned int)(((Hero_234800 *)hero_233f80)->i2084 - 0x18) < 2) { if ((((Hero_234800 *)hero_233f80)->attachment_anchor_flags ^ 1) & 1) { if ((unsigned int)(((Hero_234800 *)hero_233f80)->i2084 - 0x18) < 2) { From 18308dcb8bb9db55df3dba4491164115c7107196 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:01:12 +0000 Subject: [PATCH 688/758] decomp: clarify names in handle_pause_input hA6 -> moby_class_id: Retail 0x00298110 obtains hero.ship_moby from hero +0x15f0, checks it for null, then 0x0029811c loads its signed halfword +0xa6 and compares class identifiers 0x45, 0x563 and 0x4da to choose the special vehicle pause path. The bound source independently identifies this member of a Moby-sized record as VendorMoby.oclass, used for hero and class-specific glow dispatch in update_cutscene_playback. Together object provenance, class dispatch uses and the assigned retail access establish moby class ID rather than a vehicle mode or hero state. w14 -> debug_camera_mode: Retail 0x002986f8 loads S_297f78 +0x14 when the normal camera update is disabled. Nonzero reaches update_debug_camera at 0x00298704; the reloaded field equals 2 at 0x0029870c-0x00298714 before update_hero_from_debug_camera at 0x0029871c. Source expresses these same named camera operations, proving a debug-camera mode selector. wA0 -> previous_step_held_buttons: In the single-step gate, retail 0x00297fe4 loads controller held buttons and 0x00297fe8 loads S_297f78 +0xa0. Complement/AND operations at 0x00297fec-0x00298008 compute released = previous & ~held and pressed = held & ~previous, then store held & ~0x200 back to +0xa0. Thus this field retains the previous step's held-button snapshot with the step trigger excluded. wEC -> single_step_mode_countdown: Retail 0x00297fa0-0x00297fb0 loads and decrements S_297f78 +0xec only while nonzero. Reaching zero writes update flags 0x10 at 0x00297fb4-0x00297fb8. Later retail gates (for example 0x0029859c-0x002985c4) use that flag with pressed 0x200 to permit one subsystem update. Source DBG macro confirms the same single-step behavior; +0xec is therefore the countdown into single-step mode. --- .../cutscenes/update_cutscene_playback.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/shared/cutscenes/update_cutscene_playback.c b/src/overlays/shared/cutscenes/update_cutscene_playback.c index e75f8b4664..b27e01ab45 100644 --- a/src/overlays/shared/cutscenes/update_cutscene_playback.c +++ b/src/overlays/shared/cutscenes/update_cutscene_playback.c @@ -107,17 +107,17 @@ typedef struct { u8 pad0[8]; s32 w8; u8 padc[0x14 - 0xC]; - s32 w14; + s32 debug_camera_mode; s32 w18; u8 pad1c[0xA0 - 0x1C]; - s32 wA0; + s32 previous_step_held_buttons; u8 padA4[0xEC - 0xA4]; - s32 wEC; + s32 single_step_mode_countdown; } S_297f78; typedef struct { u8 pad0[0xA6]; - s16 hA6; + s16 moby_class_id; } A_297f78; typedef struct { @@ -194,14 +194,14 @@ void handle_pause_input(void) __asm__("FUN_L00_00297f78"); void handle_pause_input(void) { s32 lvl, area, noctl, special; - if (D_L00_0016C058.wEC) { - if (--D_L00_0016C058.wEC == 0) + if (D_L00_0016C058.single_step_mode_countdown) { + if (--D_L00_0016C058.single_step_mode_countdown == 0) D_L00_0016C058.w8 = 0x10; } if ((D_L00_0016C058.w8 & 0x10) && (controller_state.pressed & 0x200)) { - controller_state.pressed = ~D_L00_0016C058.wA0 & controller_state.held; - controller_state.released = ~controller_state.held & D_L00_0016C058.wA0; - D_L00_0016C058.wA0 = controller_state.held & ~0x200; + controller_state.pressed = ~D_L00_0016C058.previous_step_held_buttons & controller_state.held; + controller_state.released = ~controller_state.held & D_L00_0016C058.previous_step_held_buttons; + D_L00_0016C058.previous_step_held_buttons = controller_state.held & ~0x200; } lvl = D_L00_0015F5C0_macro[1]; if (lvl == 0 && (mode_freeze_flags & 1) && level_timer >= 8) { @@ -223,7 +223,7 @@ void handle_pause_input(void) { } special = 0; if (hero.state.control_mode == 9 && hero.state.current == 0x32 && hero.ship_moby) { - s32 k = ((A_297f78 *)hero.ship_moby)->hA6; + s32 k = ((A_297f78 *)hero.ship_moby)->moby_class_id; if (k == 0x45 || k == 0x563 || k == 0x4DA) special = 1; } @@ -249,7 +249,7 @@ void handle_pause_input(void) { if (!(D_L00_0016C058.w8 & 0x10) && level_timer >= 8 && (controller_state.pressed & 0x500) && hero.state.control_mode != 0x16 && hero.state.current != 0x72 && hero.state.current != 0x32 && hero.state.current != 0x1D && !hero.fall_fade_pending && - hero.health.hp && lvl == 0 && !special && !D_L00_0016C058.wEC) { + hero.health.hp && lvl == 0 && !special && !D_L00_0016C058.single_step_mode_countdown) { pause_all_sounds(10); return; } @@ -311,9 +311,9 @@ void handle_pause_input(void) { noop_main_callback(D_L00_00161018, 5); if (DBG(8)) { update_camera(); - } else if (D_L00_0016C058.w14) { + } else if (D_L00_0016C058.debug_camera_mode) { update_debug_camera(); - if (D_L00_0016C058.w14 == 2) + if (D_L00_0016C058.debug_camera_mode == 2) update_hero_from_debug_camera(); } noop_main_callback(D_L00_00161028, 8); From ad5e0830a2f4f43c023109813b3d90f5f7e132fa Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:01:16 +0000 Subject: [PATCH 689/758] decomp: clarify names in update_splitting_effect_particle_with_collision_response_and_fade f0C -> split_position_spread_scale: Authoritative source SHA-256 20e1163d160a64b4cda3476a0a9209529e59f3649846776eae55338ecf3ccf74 and original retail Ghidra agree: 0026ff90 loads particle +0xC; 0026ffa4 divides it by 900000 into f20; 0026ffc8 negates that bound into f22. Calls at 0026ffe0, 0026fff8 and 00270010 sample those bounds and add the results to parent XYZ at 0026ffe8-00270034, producing child spawn position passed at 00270090. The same bounds perturb parent XYZ at 00270138-00270178. The field is reduced by 0.8 at 0026ffb4/0026ffc4 and inherited by the spawned particle at 002700b0-002700b4. Thus it directly scales split position spread; the name does not claim units or rendering size. --- .../update_three_phase_effect_particle.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 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 2d1164ea70..99f7548548 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 @@ -3302,7 +3302,7 @@ typedef struct Moby_26ff10 { u8 f08; char pad09; s16 split_countdown; - f32 f0C; + f32 split_position_spread_scale; VV posv; PV pv; } Moby_26ff10; @@ -3348,10 +3348,10 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff f32 sp, lo, hi, sc, zero, nsp; pv->f18 |= 0x88; lo = 0.5f; - sp = particle->f0C / 900000.0f; + sp = particle->split_position_spread_scale / 900000.0f; hi = 0.7f; sc = 0.2f; - particle->f0C = particle->f0C * 0.8f; + particle->split_position_spread_scale = particle->split_position_spread_scale * 0.8f; zero = 0.0f; f = random_float_between(lo, hi); nsp = -sp; @@ -3365,7 +3365,7 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff spawned_particle = FUN_L00_0026fd28_26ff10(v1u.f, v0u.f, 0x88, pv->f1C); if (spawned_particle != 0) { spawned_particle->split_countdown = scale_game_frames(2); - spawned_particle->f0C = particle->f0C; + spawned_particle->split_position_spread_scale = particle->split_position_spread_scale; } fast_vec_scale(pv, pv, random_float_between(lo, hi)); particle->pv.x = @@ -3417,8 +3417,8 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff fast_vec_scale(pv, pv, 0.02f); fast_vec_normalize(collision_offset, coll_hit_normal.f, 0.055f); fast_vec_add(particle->posv.f, coll_hit_normal.f - 8, collision_offset); - if (particle->f0C < 200000.0f && (pv->f18 & 8) == 0) { - particle->f0C = particle->f0C + particle->f0C; + if (particle->split_position_spread_scale < 200000.0f && (pv->f18 & 8) == 0) { + particle->split_position_spread_scale = particle->split_position_spread_scale + particle->split_position_spread_scale; } pv->f18 |= 8; } else { @@ -3429,8 +3429,8 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff f32 decayed_particle_scalar; kk2 = 8.0f / (d * 0.443f); pv->f16++; - decayed_particle_scalar = particle->f0C - 260000.0f / (f32)kk2 * d * 1.25f; - particle->f0C = decayed_particle_scalar; + decayed_particle_scalar = particle->split_position_spread_scale - 260000.0f / (f32)kk2 * d * 1.25f; + particle->split_position_spread_scale = decayed_particle_scalar; if (decayed_particle_scalar <= 0.0f) { kill: FUN_L00_00267a08_26ff10(particle); @@ -3439,7 +3439,7 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff } else { f32 d = frame_scale; kk2 = 8.0f / (d * 0.443f); - particle->f0C = particle->f0C + 260000.0f / (f32)kk2 * d; + particle->split_position_spread_scale = particle->split_position_spread_scale + 260000.0f / (f32)kk2 * d; } f = convert_integer_to_float(pv->f14); { From b34b87ee6fe01fbf0975c450b769d336a3e491da Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:03:12 +0000 Subject: [PATCH 690/758] decomp: clarify names in update_toxic_crab_hit_reactions_and_targeting h26 -> hit_reaction_suppression_timer_frames: D_2E52B0.h26 is passed to fast_dec_timer_s16 at retail 0x002e4000-0x002e4004. Its nonzero test at 0x002e409c-0x002e40d4 forces response 11 (SUPPRESSED_HIT_RESPONSE) when hit byte +0x28 is zero; damage is zeroed only below 3. Both knockback branches initialize this short from scale_game_frames(60), stored at 0x002e43c4 and 0x002e4438. Current C and original Ghidra agree, proving a frame timer for conditional hit-reaction suppression. h2A -> hit_source_class: Hit_2E52B0.h2A is loaded as an unsigned short at retail 0x002e412c and compared with receiving moby oclass at 0x002e4130-0x002e4140 to suppress same-class hits. Retail 0x002e4180-0x002e4188 tests the same field against class 0x47 for the hero-origin line filter. Original Ghidra identifies the hit record class at +0x2a. The supplied same-file toxic_crab_update constructs Hit2E30F8 with hit.m=(char *)m and hit.id=m->cls at this record position before sphere/line hit collection, establishing the source-class role rather than merely an offset. --- src/overlays/l10/mobys/toxic_crab.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index 9b39b41b81..430f194620 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -975,7 +975,7 @@ typedef struct D_2E52B0 { char p14[0xC]; float f20; char p24[2]; - short h26; + short hit_reaction_suppression_timer_frames; char p28[0x10]; int target_range_boost_pending; char p3C[0x24]; @@ -1018,7 +1018,7 @@ typedef struct Hit_2E52B0 { char p24[4]; unsigned char b28; char p29; - unsigned short h2A; + unsigned short hit_source_class; } Hit_2E52B0; #include "rnc/overlay/l10/mobys/toxic_crab_globals.h" @@ -1082,7 +1082,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { hit_record = find_moby_hit(moby, 0xB30000, 0); hit_response_code = resolve_moby_hit_response(moby, hit_record, &moby_data->f20, 0, &A, &B, 0, 4); - fast_dec_timer_s16(&moby_data->h26); + fast_dec_timer_s16(&moby_data->hit_reaction_suppression_timer_frames); if ((unsigned int)A >= 2 && moby->state != TOXIC_CRAB_STATE_DEATH_EFFECTS && moby->state != TOXIC_CRAB_STATE_FALL_TO_DEATH) { if (current_level_index == 10 && hit_record != 0 && hit_record->f20 != 0 && @@ -1093,7 +1093,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { queue_dialogue_message(0x53D6, -1); } } - if (moby_data->h26 != 0 && hit_record->b28 == 0) { + if (moby_data->hit_reaction_suppression_timer_frames != 0 && hit_record->b28 == 0) { hit_response_code = 11; if (B < 3.0f) B = 0.0f; @@ -1104,7 +1104,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { if (2.0f < B) B = 2.0f; } - if (hit_record->h2A == moby->oclass) { + if (hit_record->hit_source_class == moby->oclass) { B = 0.0f; hit_response_code = 11; } @@ -1115,7 +1115,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { hit_response_code = 11; } } - if (hit_record->h2A == 0x47) { + if (hit_record->hit_source_class == 0x47) { *(u128_2E52B0 *)&vA = *(u128_2E52B0 *)(((char *)&hero) + 0x80); *(u128_2E52B0 *)&vB = *(u128_2E52B0 *)((AlignedVec4f *)&moby->pos); vA.z += 1.0f; @@ -1158,7 +1158,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { case HIT_DIRECTED_KNOCKBACK_HIT_RESPONSE: case ARC_ADJUSTED_KNOCKBACK_HIT_RESPONSE: moby->state = TOXIC_CRAB_STATE_HIT_KNOCKBACK; - moby_data->h26 = scale_game_frames(60); + moby_data->hit_reaction_suppression_timer_frames = scale_game_frames(60); moby_data->f80 = toxic_crab_hit_knockback_gravity_gp * D_0015ED70; trooper_set_knockback(moby_data->a70, 0.5f, 0.5f); moby_data->fC0 = 8.0f; @@ -1173,7 +1173,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { case VEHICLE_DEPENDENT_KNOCKBACK_HIT_RESPONSE: { float knockback_strength; moby->state = TOXIC_CRAB_STATE_HIT_KNOCKBACK; - moby_data->h26 = scale_game_frames(60); + moby_data->hit_reaction_suppression_timer_frames = scale_game_frames(60); moby_data->f80 = toxic_crab_hit_knockback_gravity_gp * D_0015ED70; knockback_strength = ((Hero *)(((char *)&hero)))->vehicle_mode == 1 ? 1.0f : 3.0f; trooper_set_knockback(moby_data->a70, knockback_strength, 0.5f); From 336e9d5202585ea8c41da2515936d8401b71ad56 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:03:15 +0000 Subject: [PATCH 691/758] decomp: clarify names in process_moby_attachment_damage h2A -> damage_adjustment_selector: Hit_2EAE80 unsigned short h2A is read by lhu at 002e9bbc and 002e9f00. In the first-attachment path, selector 0x3F1 replaces positive hit+0x2C damage with 0.3f (002e9bb4-002e9bd8). In the child loop, 0x127 halves positive damage and 0x3F1 replaces it with 0.1f (002e9ef8-002e9f38). The selected amount is compared/subtracted from health at 002e9f68-002e9fbc. Authoritative C expresses the same switch using CHILD_HIT_HALF_DAMAGE and CHILD_HIT_FIXED_DAMAGE, proving the damage-adjustment selection role without assigning a weapon identity. --- 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 d36fe1e116..c901692468 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -693,7 +693,7 @@ typedef struct { char pad0[0x20]; Moby_2EAE80 *target; char pad24[6]; - unsigned short h2A; + unsigned short damage_adjustment_selector; float damage_amount; } Hit_2EAE80; @@ -771,7 +771,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { r->target->oclass == 0xD4)) { moby_data->first->bA4 = 0xFF; } else if (hit >= 2) { - if (0.0f < r->damage_amount && r->h2A == 0x3F1) { + if (0.0f < r->damage_amount && r->damage_adjustment_selector == 0x3F1) { r->damage_amount = 0.3f; } if (r != 0 && moby->bBC == 7) { @@ -860,7 +860,7 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { continue; } if (0.0f < r->damage_amount) { - switch (r->h2A) { + switch (r->damage_adjustment_selector) { case CHILD_HIT_FIXED_DAMAGE: r->damage_amount = 0.1f; break; From 80068097ca81e56ccdf813509999d1d73836751e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:05:08 +0000 Subject: [PATCH 692/758] decomp: clarify names in dreks_fleet_turret_update fD4 -> current_joint_pitch: Retail 0x002cb700 and 0x002cb9bc load pvars+0xd4 as the first operand of fast_difference_between_rotations against negative atan(horizontal targeting-vector length,Z); the resulting error must be below 0.034906585 before firing. Checked animation helper export 4b92938887d2468ebc5f3def46250161 retains incoming a1=pvars+0x90 in s0 at 0x0025caf4. At 0x0025cc48..0x0025cc64 it passes block+0x64 (pvars+0xf4) as the target scalar, block+0x44 (pvars+0xd4) as the mutable angle, and block+0x54 as associated motion state to 0x00256548; block+0x40 is subsequently used by the rotation-transform call at 0x0025cca8. Together with the source firing-error check, this proves fD4 is the current animated joint pitch. fF4 -> target_joint_pitch: Both aiming branches compute target minus transformed turret vertex (0x002cb61c and 0x002cb8d4), calculate its horizontal length followed by atan(horizontal length,Z), negate that angle, and store it at pvars+0xf4 (0x002cb6d4 and 0x002cb990). Source immediately calls update_joint_animation with pvars+0x90. Checked helper export 4b92938887d2468ebc5f3def46250161 at 0x0025cc48..0x0025cc64 loads block+0x64, precisely pvars+0xf4, as the scalar target for the update of block+0x44, pvars+0xd4. This is the target joint pitch derived from the vertical aiming displacement, not a generic float or offset. --- src/overlays/l17/mobys/dreks_fleet_turret.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l17/mobys/dreks_fleet_turret.c b/src/overlays/l17/mobys/dreks_fleet_turret.c index 4aa1f34884..140b1fd664 100644 --- a/src/overlays/l17/mobys/dreks_fleet_turret.c +++ b/src/overlays/l17/mobys/dreks_fleet_turret.c @@ -52,9 +52,9 @@ typedef struct { int path; char pad88[8]; char a90[0x44]; - float fD4; + float current_joint_pitch; char padD8[0x1C]; - float fF4; + float target_joint_pitch; } Vars347; typedef struct { @@ -169,12 +169,12 @@ void dreks_fleet_turret_update(struct Moby *turret_moby) { ang = fast_arc_tan(targeting_vector_scratch[0], targeting_vector_scratch[1]); turn = frame_time_sq * 0.5235988f; approach_angle(yaw, &turret_vars->yawvel, ang, turn, turn, frame_time * 1.0471976f); - turret_vars->fF4 = -fast_arc_tan(vector_length_xy(targeting_vector_scratch), + turret_vars->target_joint_pitch = -fast_arc_tan(vector_length_xy(targeting_vector_scratch), targeting_vector_scratch[2]); update_joint_animation( turret_moby, turret_vars->a90, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f); off = fast_difference_between_rotations( - turret_vars->fD4, + turret_vars->current_joint_pitch, -fast_arc_tan(vector_length_xy(targeting_vector_scratch), targeting_vector_scratch[2])); if (D_L17_0015F5CC % scale_game_frames(0x5A) == turret_vars->timer && @@ -228,12 +228,12 @@ void dreks_fleet_turret_update(struct Moby *turret_moby) { ang = fast_arc_tan(targeting_vector_scratch[0], targeting_vector_scratch[1]); turn = frame_time_sq * 0.5235988f; approach_angle(yaw, &turret_vars->yawvel, ang, turn, turn, frame_time * 1.0471976f); - turret_vars->fF4 = -fast_arc_tan(vector_length_xy(targeting_vector_scratch), + turret_vars->target_joint_pitch = -fast_arc_tan(vector_length_xy(targeting_vector_scratch), targeting_vector_scratch[2]); update_joint_animation( turret_moby, turret_vars->a90, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f); off = fast_difference_between_rotations( - turret_vars->fD4, + turret_vars->current_joint_pitch, -fast_arc_tan(vector_length_xy(targeting_vector_scratch), targeting_vector_scratch[2])); if (fast_dec_timer(&turret_vars->timer) && off < 0.034906585f) { From 028df5e012da3877ba983c59cde5550396452411 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:07:21 +0000 Subject: [PATCH 693/758] decomp: clarify names in update_hero_easing_targets_and_point_effects h12AC -> point_effect_particles_per_point: P_20b1d8.h12AC is s16. Retail 0020b4b0-0020b4b4 checks it for zero, then 0020b4f0-0020b528 and 0020b548-0020b580 load it as the signed bound of two independently zero-initialized emission loops. Each iteration calls spawn_jittered_effect_particle_with_optional_basis (0020b518/0020b570), after moby_point_position selects point 0x16 or 0x17. Original Ghidra sRam001405fc and authoritative C use the same bound for each point, proving particles per point rather than total particles or remaining updates. h12AE -> point_effect_emission_flags: P_20b1d8.h12AE is u16, matching original Ghidra uRam001405fe. Retail 0020b3f8-0020b404 masks 0x80 and clears point_effect_emission_updates_remaining when set, bypassing emission. Retail 0020b4bc-0020b4d0 masks bit 1 and selects either null or hero moby+0xC0 as optional_moby_basis passed to both particle loops at 0020b514 and 0020b56c. These independent masked controls prove a point-effect emission flag word, without asserting meanings for other bits. --- src/overlays/shared/hero/hero_idle_sequence.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index 3f126db4b0..dbae41dd8d 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -3152,8 +3152,8 @@ typedef struct { u8 p10E4[0x12A0 - 0x10E4]; f32 f12A0, f12A4; s32 point_effect_emission_updates_remaining; - s16 h12AC; - u16 h12AE; + s16 point_effect_particles_per_point; + u16 point_effect_emission_flags; u8 p12B0[0x2080 - 0x12B0]; u8 *p2080; s32 i2084; @@ -3205,27 +3205,27 @@ void update_hero_easing_targets_and_point_effects(void) { hero_eases[4].scale = 0.01f; hero_eases[5].scale = 0.01f; } - if (!(P.h12AE & 0x80)) { + if (!(P.point_effect_emission_flags & 0x80)) { if (P.i2084 == 3) configure_hero_point_effect_emission(1, 2, 1, 0, 0.021f, 0.002f); if (P.i208C == 4 && P.i418 > 0 && P.i418 < scale_game_frames(12)) configure_hero_point_effect_emission(1, 2, 0, 1, 0.016f, 0.002f); if (P.point_effect_emission_updates_remaining <= 0) return; - if (P.h12AC == 0) + if (P.point_effect_particles_per_point == 0) return; optional_moby_basis = 0; - if (P.h12AE & 1) + if (P.point_effect_emission_flags & 1) optional_moby_basis = P.p2080 + 0xC0; P.point_effect_emission_updates_remaining--; moby_point_position(P.p2080, 0x16, emission_point_world_position); - for (i = 0; i < P.h12AC; i++) + for (i = 0; i < P.point_effect_particles_per_point; i++) spawn_jittered_effect_particle_with_optional_basis( emission_point_world_position, optional_moby_basis, P.f12A0 + random_float_between(-P.f12A4, P.f12A4)); moby_point_position(P.p2080, 0x17, emission_point_world_position); - for (i = 0; i < P.h12AC; i++) + for (i = 0; i < P.point_effect_particles_per_point; i++) spawn_jittered_effect_particle_with_optional_basis( emission_point_world_position, optional_moby_basis, From 1b3b7afe486faedaa55a85e8fa1f7bf4fc750219 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:07:25 +0000 Subject: [PATCH 694/758] decomp: clarify names in follow_camera_apply_overrides fF0 -> target_offset_scale: Retail 0x002e60c8-0x002e60ec and 0x002e6178-0x002e6188 load camera data through moby+0x70 and store 0.25f at +0xF0. Retail 0x002e6100-0x002e6134 and 0x002e61c0-0x002e61e4 access the identical scalar as target block +0x40, member +0xB0. Authoritative C SHA-256 0c8499f1510e637a5abcd17fb1a215aee1d4cb478d8aea3f4dc07a95ae89fec0 rebuild_follow_camera_pose scales the followed target's up vector by target+0xB0 and adds it to the target point to construct the look-at eye. reset_follow_camera_state_from_position likewise scales the inverse gravity direction by this scalar. follow_camera_approach interpolates target+0xB0 toward the override at +0xB4, which the supplied follow_camera_set_offset_scale sets. These operations establish target_offset_scale beyond the shared offset alone. --- src/overlays/shared/camera/follow_camera_setup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 1c6186b892..073aed5818 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -197,7 +197,7 @@ typedef struct { s16 h14; s16 h16; u8 pad1[0xF0 - 0x18]; - f32 fF0; + f32 target_offset_scale; } M_2e6000; typedef struct { @@ -278,7 +278,7 @@ void follow_camera_apply_overrides(O_2e6000 *camera_moby) { follow_camera_start_slide(); } if (hero.state.control_mode == 0x11) { - camera_moby->m->fF0 = 0.25f; + camera_moby->m->target_offset_scale = 0.25f; follow_camera_set_height(0.5f, 0.003f); } if (hero.state.control_mode == 5) { @@ -295,7 +295,7 @@ void follow_camera_apply_overrides(O_2e6000 *camera_moby) { } } if (hero.state.control_mode == 0x10) - camera_moby->m->fF0 = 0.25f; + camera_moby->m->target_offset_scale = 0.25f; if (hero.vehicle_mode == HERO_VEHICLE_MODE_CLANK) { if (camera_override_state->i0 == 0) { q = (S40 *)((u8 *)camera_moby->m + 0x40); From e0535f25aee9677243255cbbfb73c406f417c814 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:07:28 +0000 Subject: [PATCH 695/758] decomp: clarify names in helicopter_spark_update h1A -> source_moby_class: In helicopter_spark_update, retail 0x002d47e0 preserves the updating Moby in s4. At 0x002d48dc, lhu v0,0xa6(s4) reads that moby's oclass; 0x002d4900 sh v0,0x7a(sp) stores it at +0x1A of the hit descriptor beginning at sp+0x60. Original Ghidra agrees: uStack_196 = *(undefined2 *)(iVar7 + 0xa6). The authoritative C explicitly assigns hit.h1A = moby->oclass after make_hit_descriptor(&hit, moby, ...). This same descriptor is passed at 0x002d5038, 0x002d50a4 and 0x002d50f4 to the collision-line and sphere queries. Thus the field stores the source spark moby's class, rather than a class inferred only from its offset. --- src/overlays/shared/enemies/blarg_helicopter_spark.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/enemies/blarg_helicopter_spark.c b/src/overlays/shared/enemies/blarg_helicopter_spark.c index 16995b994d..1921816740 100644 --- a/src/overlays/shared/enemies/blarg_helicopter_spark.c +++ b/src/overlays/shared/enemies/blarg_helicopter_spark.c @@ -58,7 +58,7 @@ typedef struct { int flags; unsigned char b18; unsigned char b19; - unsigned short h1A; + unsigned short source_moby_class; float f1C; int i20; } Hit_2D5B88; @@ -139,7 +139,7 @@ void helicopter_spark_update(Moby *moby) { hit.dir.w = 5627.9248f; hit.b18 = state; hit.b19 = state; - hit.h1A = moby->oclass; + hit.source_moby_class = moby->oclass; qcopy(&start_pos, &moby->pos); homing_spark_pvars->vel.z = -(moby->pos.z - homing_spark_pvars->vel.w) / 10.0f; max_climb = frame_time_macro * 8.0f; From bf84ed937a089d00f6e26551e431ed7a70c2c0d0 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:09:39 +0000 Subject: [PATCH 696/758] decomp: clarify names in drain_cover_update fA0 -> tilt_x_phase_increment: Authoritative source src/overlays/l05/mobys/drain_cover.c SHA-256 9e71d519bd8cc2b406598f98ae83656e4ed0fcfbc83c6e27ce35ac90396da302 initializes DrainCoverData.fA0 at retail 0x0030e994-0x0030e9b8 from randf_sym(70,120) times degrees-to-radians times frame_time; landing repeats this at 0x0030f01c-0x0030f038. Checked level-05 tilt helper 0x0030f498-0x0030f4bc loads phase +0x98 and this +0xa0 float into fast_add_rotations and stores the advanced phase at +0x98. Sine at 0x0030f4c0-0x0030f4c4 feeds target f21, applied to moby rot.x (+0x40) at 0x0030f50c-0x0030f548. Supplied update_drain_cover_tilt source agrees: unk98 = fast_add_rotations(unk98, unkA0). Thus this is the frame-scaled X tilt phase increment, distinct from actual tilt angular velocity +0x90. fA4 -> tilt_y_phase_increment: Authoritative DrainCoverData.fA4 is initialized at retail 0x0030e9c0-0x0030e9f0 from randf_sym(70,120) times 0.017453292 and frame_time, repeated at 0x0030f03c-0x0030f04c. Checked level-05 helper 0x0030f4b0-0x0030f4c8 passes +0xa4 with tilt_y_phase at +0x9c to fast_add_rotations and stores the new phase to +0x9c. Sine at 0x0030f4e0-0x0030f4e4 produces the Y tilt target carried in f22, supplied to the approach helper for moby rot.y (+0x44) at 0x0030f550-0x0030f594. This agrees with supplied source unk9C = fast_add_rotations(unk9C, unkA4), proving the Y tilt phase increment rather than actual Y tilt angular velocity +0x94. --- src/overlays/l05/mobys/drain_cover.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l05/mobys/drain_cover.c b/src/overlays/l05/mobys/drain_cover.c index 96f78b6662..02f278bbd0 100644 --- a/src/overlays/l05/mobys/drain_cover.c +++ b/src/overlays/l05/mobys/drain_cover.c @@ -158,8 +158,8 @@ typedef struct { char pad90[8]; float tilt_x_phase; float tilt_y_phase; - float fA0; - float fA4; + float tilt_x_phase_increment; + float tilt_y_phase_increment; int sound; DrainCoverLid *lid; } DrainCoverData; @@ -234,8 +234,8 @@ void drain_cover_update(DrainCoverMoby *moby) { qcopy(drain_cover_data->home, moby->pos); drain_cover_data->tilt_x_phase = random_angle_radians(); drain_cover_data->tilt_y_phase = random_angle_radians(); - drain_cover_data->fA0 = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; - drain_cover_data->fA4 = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; + drain_cover_data->tilt_x_phase_increment = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; + drain_cover_data->tilt_y_phase_increment = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; minimum_rise_height = drain_cover_data->hover_height_above_home + 1.0f; if (drain_cover_data->rise_height <= minimum_rise_height) { drain_cover_data->rise_height = minimum_rise_height; @@ -359,8 +359,8 @@ void drain_cover_update(DrainCoverMoby *moby) { qcopy(moby->pos, drain_cover_data->home); drain_cover_data->tilt_x_phase = random_angle_radians(); drain_cover_data->tilt_y_phase = random_angle_radians(); - drain_cover_data->fA0 = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; - drain_cover_data->fA4 = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; + drain_cover_data->tilt_x_phase_increment = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; + drain_cover_data->tilt_y_phase_increment = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; } break; } From 400c47bced444cedd01bc67066ee1ac82fb32b8f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:09:42 +0000 Subject: [PATCH 697/758] decomp: clarify names in giant_clank_charged_blast_update fA -> particle_frame_count: In EXPANDING_BLAST, retail 0x0029f738-0x0029f74c calls scale_game_frames(2) and stores its result as a short at returned particle+0xA, corresponding to Part29FF90.fA. 0x0029f748-0x0029f758 sign-extends that same short, converts it to float and computes 1.0 divided by it; 0x0029f764 stores the reciprocal in particle_subrecord->f10. Original Ghidra shows the same uVar6 store and reciprocal. Checked spawn helper 0x002643e0 independently initializes particle+0xA from scale_game_frames(random_int_between(10,30)) at 0x00264478-0x0026449c and computes its reciprocal at 0x002644a0-0x002644cc. Thus this is a particle frame count, without asserting total lifetime, countdown behavior or a particular fade phase. --- src/overlays/shared/vehicles/giant_clank_charged_blast.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/shared/vehicles/giant_clank_charged_blast.c b/src/overlays/shared/vehicles/giant_clank_charged_blast.c index 0091488b2d..f0803bf246 100644 --- a/src/overlays/shared/vehicles/giant_clank_charged_blast.c +++ b/src/overlays/shared/vehicles/giant_clank_charged_blast.c @@ -193,7 +193,7 @@ typedef struct { typedef struct { char pad0[0xA]; - short fA; + short particle_frame_count; float fC; char pad10[0x10]; PartSub29FF90 sub; @@ -453,9 +453,9 @@ void giant_clank_charged_blast_update(Moby29FF90 *moby) { blast_center_particle->fC = random_float_between(80000.0f, 120000.0f); } blast_center_particle->fC = blast_center_particle->fC * r; - blast_center_particle->fA = scale_game_frames(2); + blast_center_particle->particle_frame_count = scale_game_frames(2); particle_subrecord->f10 = - 1.0f / convert_integer_to_float(blast_center_particle->fA); + 1.0f / convert_integer_to_float(blast_center_particle->particle_frame_count); particle_subrecord->f18 = 0x7F7F7F; particle_subrecord->f16 = 3; } From 67e395caea5c8264417def74ba9ca0e2fc3830e8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:09:45 +0000 Subject: [PATCH 698/758] decomp: clarify names in update_hero_attachment f184 -> rotation_anchor_inhibit: Retail 0x00234334 loads hero+0x184 as float and 0x00234340..0x00234348 compares it with zero. Nonzero branches to 0x00234398..0x002343a4, clearing attachment_anchor_flags bit 2. When zero and the other eligibility conditions pass, 0x00234378..0x00234384 converts hero rotation into attachment_local_rotation and 0x00234388..0x00234394 sets bit 2. That bit selects reconstructed primary_attachment_rotation.z at 0x00234554..0x00234568. Authoritative C f184 == 0.0f guards the same rotation-anchor initialization; this proves a bounded rotation-anchor inhibit role, without inferring the scalar's physical identity. --- 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 9d3e3ad531..480c5409ed 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1400,7 +1400,7 @@ typedef struct Hero_234800 { char p100[0x50]; Vec_234800 v150; char p160[0x24]; - float f184; + float rotation_anchor_inhibit; char p188[0x6E]; short path_clearance_position_anchor_inhibit; char p1F8[0x104]; @@ -1569,7 +1569,7 @@ void update_hero_attachment(void) { ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; } if ((((Hero_234800 *)hero_233f80)->i208C == 0 || ((Hero_234800 *)hero_233f80)->i208C == 12) && - ((Hero_234800 *)hero_233f80)->f184 == 0.0f && ((Hero_234800 *)hero_233f80)->h30E == 0) { + ((Hero_234800 *)hero_233f80)->rotation_anchor_inhibit == 0.0f && ((Hero_234800 *)hero_233f80)->h30E == 0) { if (!(((Hero_234800 *)hero_233f80)->attachment_anchor_flags & 2)) { convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, ((Hero_234800 *)hero_233f80)->attachment_reference_object, From a26898a088cbe1cff1c2c842a7fbd2487ccb48c9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:09:48 +0000 Subject: [PATCH 699/758] decomp: clarify names in update_player_ship_flight iDC -> collision_damage_cooldown_timer_frames: ShipVars_2838.iDC is the int at private-data+0xdc: retail 0x003130b0/0x003130bc bypasses HP damage when it is nonzero; 0x003130c8..0x003130e8 subtracts jet_fighter_collision_damage_gp from hero.ship_hp when zero, and 0x003131c4..0x003131c8 resets it from l11_jet_fighter_collision_damage_cooldown_frames. Authoritative jet_fighter_update calls fast_dec_timer(&ship_vars->iDC) once per update. These uses establish the remaining collision-damage cooldown timer in frames, rather than an offset-only role. iF8 -> respawn_or_exit_delay_timer_frames: ShipVars_2838.iF8 is an int countdown shared by two ship states. Retail 0x00312ffc sets WAIT_FOR_RESPAWN (7), 0x00313000 calls scale_game_frames(0x5a), and 0x0031300c stores the returned delay into private-data+0xf8 after the world-collision explosion. Authoritative jet_fighter_update decrements this member in WAIT_FOR_RESPAWN and calls hero_respawn when it expires. The same source loads l11_jet_fighter_exit_delay_frames into iF8 on entering DELAYED_EXIT (8), then decrements it before starting the exit fade. Initialization to 1 is preserved. The dual use proves a respawn-or-exit delay countdown, not an exclusively respawn timer. --- src/overlays/l11/mobys/jet_fighter.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/l11/mobys/jet_fighter.c b/src/overlays/l11/mobys/jet_fighter.c index b4d9a5690e..810f929b38 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -729,14 +729,14 @@ typedef struct { float fB0, fB4, fB8, fBC; float fC0, fC4, fC8, fCC; float fD0, fD4, fD8; - int iDC; + int collision_damage_cooldown_timer_frames; char padE0[8]; short sE8; short sEA; char padEC[4]; float shown_hp; int hp_bar_fill; - int iF8; + int respawn_or_exit_delay_timer_frames; int exit_path; int exit_path2; char pad104[8]; @@ -1130,7 +1130,7 @@ void update_player_ship_flight(struct Moby *ship_moby, ShipVars_2838 *ship_vars) ship_moby->visible = 0; ship_moby->state = JET_FIGHTER_STATE_WAIT_FOR_RESPAWN; ship_moby->flags |= 1; - ship_vars->iF8 = scale_game_frames(0x5A); + ship_vars->respawn_or_exit_delay_timer_frames = scale_game_frames(0x5A); } else { hc = *(short *)(*(char **)(collision_result + 0x18) + 0xA6); if (hc != 0 && hc != 0x192 && hc != 0x4C2 && hc != 0x4C3) { @@ -1151,7 +1151,7 @@ void update_player_ship_flight(struct Moby *ship_moby, ShipVars_2838 *ship_vars) k = ship_vars->speed * D_L11_0016204C; ship_vars->f34 = collision_adjusted_pitch; ship_vars->speed = k; - if (ship_vars->iDC == 0) { + if (ship_vars->collision_damage_cooldown_timer_frames == 0) { hero.ship_hp = hero.ship_hp - jet_fighter_collision_damage_gp; if (hero.ship_hp < 0.0f) { fast_vec_sub(side, collision_result + 0x50, collision_result + 0x60); @@ -1183,7 +1183,7 @@ void update_player_ship_flight(struct Moby *ship_moby, ShipVars_2838 *ship_vars) 0); ship_moby->state = JET_FIGHTER_STATE_WAIT_FOR_RESPAWN; } - ship_vars->iDC = l11_jet_fighter_collision_damage_cooldown_frames; + ship_vars->collision_damage_cooldown_timer_frames = l11_jet_fighter_collision_damage_cooldown_frames; } } } @@ -1264,7 +1264,7 @@ void jet_fighter_update(struct Moby *moby) { if (moby != 0) { ship_vars = (ShipVars_2838 *)moby->pvars; - fast_dec_timer(&ship_vars->iDC); + fast_dec_timer(&ship_vars->collision_damage_cooldown_timer_frames); if (moby->state != JET_FIGHTER_STATE_WAIT_FOR_RESPAWN && moby->state != JET_FIGHTER_STATE_WAIT_FOR_BOARDING && moby->state != JET_FIGHTER_STATE_BOARD) { @@ -1355,7 +1355,7 @@ void jet_fighter_update(struct Moby *moby) { *(Block400_3290 *)ship_hp_bar_saved_palette = *(Block400_3290 *)hp_bar_palette.clut; } hp_bar_saved = 1; - ship_vars->iF8 = 1; + ship_vars->respawn_or_exit_delay_timer_frames = 1; ship_vars->sE8 = 1; ship_vars->fade = 0.0f; if (moby->mission != 0xFF && D_0014C050[current_level_index][moby->mission] == 0xFF) { @@ -1462,7 +1462,7 @@ void jet_fighter_update(struct Moby *moby) { } } if (ship_vars->sE8 <= 0) { - ship_vars->iF8 = l11_jet_fighter_exit_delay_frames; + ship_vars->respawn_or_exit_delay_timer_frames = l11_jet_fighter_exit_delay_frames; moby->state = JET_FIGHTER_STATE_DELAYED_EXIT; } if (hero.ship_flags & 1) { @@ -1509,14 +1509,14 @@ void jet_fighter_update(struct Moby *moby) { } case JET_FIGHTER_STATE_WAIT_FOR_RESPAWN: D_L11_0015F608 = 2; - if (fast_dec_timer(&ship_vars->iF8)) { + if (fast_dec_timer(&ship_vars->respawn_or_exit_delay_timer_frames)) { hero_respawn(); } break; case JET_FIGHTER_STATE_DELAYED_EXIT: D_L11_0015F608 = 2; update_player_ship_flight(moby, ship_vars); - if (fast_dec_timer(&ship_vars->iF8)) { + if (fast_dec_timer(&ship_vars->respawn_or_exit_delay_timer_frames)) { approach_value(&ship_vars->fade, 1.0f, frame_time * 4.0f); D_L11_0015F3FC = ship_vars->fade; if (ship_vars->fade >= 1.0f) { From 5acb23b5336306e6822ec6730e7143341b6ccb27 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:09:51 +0000 Subject: [PATCH 700/758] decomp: clarify names in elevator_update fA6 -> class_id: Moby_2FDA70.fA6 -> class_id. Retail 0x002fc850 loads the hero's current moby from hero.pos+0x2000 (hero+0x2080); 0x002fc858 reads its signed short at +0xA6, and 0x002fc854/0x002fc85c compare it with class 0x57. Equality advances WAIT_FOR_INITIAL_HERO_ACTIVATION to state 3 and enables the entry configuration at 0x002fc864-0x002fc874. The supplied prepared retail naming context explicitly identifies this alternative as hero moby class +0xA6 == 0x57, and authoritative C expresses the same check through Hero_2FDA70.moby->fA6. Thus class_id names the object-class discriminator without guessing the identity of class 0x57. --- src/overlays/l06/mobys/elevator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l06/mobys/elevator.c b/src/overlays/l06/mobys/elevator.c index 4e17075858..7d71e59957 100644 --- a/src/overlays/l06/mobys/elevator.c +++ b/src/overlays/l06/mobys/elevator.c @@ -89,7 +89,7 @@ typedef struct Moby_2FDA70 { int f90; int f94; char pad98[0xE]; - short fA6; + short class_id; char padA8[0x58]; } Moby_2FDA70; @@ -229,7 +229,7 @@ void elevator_update(Moby_2FDA70 *moby) { } moby->state = WAIT_FOR_HERO_TRIGGER_AT_NODE_OFFSET_HEIGHT; moby_data->f90 = 0; - } else if (((Hero_2FDA70 *)(D_0013F350))->moby->fA6 == 0x57) { + } else if (((Hero_2FDA70 *)(D_0013F350))->moby->class_id == 0x57) { moby->state = WAIT_FOR_HERO_TRIGGER_AT_NODE_OFFSET_HEIGHT; moby_data->vehicle_entry_configuration_active = 1; } From d7f53b73b344b712c83a8f9bb16ebcd276b7b069 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:14:09 +0000 Subject: [PATCH 701/758] decomp: clarify names in minibomber_update fB2 -> unique_id: Authoritative C declares Moby_2B5938.fB2 as short and passes it to all eight path-validation diagnostics whose supplied string literals end in UID: %d. Retail lh a1,0xb2(s3) at 0x002b4848, 0x002b4874, 0x002b488c, 0x002b48b0, 0x002b48c8, 0x002b48ec, 0x002b4904 and 0x002b4928 supplies that same moby field as the integer argument; each failure routes to the diagnostic print at 0x002b4930. The actual UID format strings and argument flow establish an object unique ID, beyond the field offset alone. --- 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 638daea10c..81e6efc6db 100644 --- a/src/overlays/l14/mobys/minibomber.c +++ b/src/overlays/l14/mobys/minibomber.c @@ -87,7 +87,7 @@ typedef struct Moby_2B5938 { char pad80[0x14]; int active_collision; /* 0x94 */ char pad98[0x1A]; - short fB2; /* 0xB2 */ + short unique_id; /* 0xB2 */ } Moby_2B5938; typedef struct Data { @@ -321,43 +321,43 @@ void minibomber_update(Moby_2B5938 *moby) { case MINIBOMBER_STATE_INITIALIZE: { PathNode *path; if (d->fD0 == -1) { - debug_print(D_L14_001FBDF0, moby->fB2); + debug_print(D_L14_001FBDF0, moby->unique_id); mark_moby_for_removal(moby); return; } path = ((PathNode *)l14_paths[d->fD0]); if (path->n == 0) { - debug_print(D_L14_001FBE18, moby->fB2); + debug_print(D_L14_001FBE18, moby->unique_id); mark_moby_for_removal(moby); return; } if (d->fD4 == -1) { - debug_print(D_L14_001FBE58, moby->fB2); + debug_print(D_L14_001FBE58, moby->unique_id); mark_moby_for_removal(moby); return; } if (((PathNode *)l14_paths[d->fD4])->n == 0) { - debug_print(D_L14_001FBE80, moby->fB2); + debug_print(D_L14_001FBE80, moby->unique_id); mark_moby_for_removal(moby); return; } if (d->fD8 == -1) { - debug_print(D_L14_001FBEC0, moby->fB2); + debug_print(D_L14_001FBEC0, moby->unique_id); mark_moby_for_removal(moby); return; } if (((PathNode *)l14_paths[d->fD8])->n == 0) { - debug_print(D_L14_001FBEE8, moby->fB2); + debug_print(D_L14_001FBEE8, moby->unique_id); mark_moby_for_removal(moby); return; } if (d->f150 == -1) { - debug_print(D_L14_001FBF20, moby->fB2); + debug_print(D_L14_001FBF20, moby->unique_id); mark_moby_for_removal(moby); return; } if (((PathNode *)l14_paths[d->f150])->n == 0) { - debug_print(minibomber_empty_exit_path_diagnostic, moby->fB2); + debug_print(minibomber_empty_exit_path_diagnostic, moby->unique_id); mark_moby_for_removal(moby); return; } From 3b47c365a4deacbf5a28a2a72b59d88685f27c17 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:17:10 +0000 Subject: [PATCH 702/758] decomp: clarify names in bomb_spawner_update fD0 -> spawn_trigger_volume_index: Retail 0x002bf140 loads the int at pvars+0xD0 into a1; 0x002bf144 skips the test for sentinel -1, otherwise 0x002bf14c-0x002bf154 calls the volume predicate with reference position a0 and this index a1. Authoritative C calls is_point_inside_clip_volume(reference, spawner_data->fD0); its boolean feeds the established volume-only or volume-or-distance spawn trigger at 0x002bf158-0x002bf17c and gates spawning at 0x002bf530. fDC -> trajectory_gravity: Retail 0x002bfa28-0x002bfa4c loads float pvars+0xDC, multiplies by frame_time_sq and negates it into solver f13; output is stored into launch_velocity.z at 0x002bfa50. Checked level-03 helper request 023e9ab1801e4b339a4e77664884b47a shows f13 saved as f21 at 0x002496b0; 0x002496e0-0x00249708 returns (target_z-origin_z-0.5*f21*t*t)/t. This is vertical acceleration in the trajectory equation, proving the pre-negation field is the configured gravity term for launch trajectory calculation. fE4 -> launch_speed_distance_factor: Retail 0x002bf9bc obtains launch displacement length; 0x002bf9c8-0x002bf9e0 loads frame_scale and float pvars+0xE4, multiplies them, then multiplies by that length to produce f20. At 0x002bf9e4-0x002bf9e8 the result normalizes launch_velocity to computed speed; 0x002bfa38 also supplies that speed to the vertical trajectory calculation. Authoritative C expresses speed = fast_vec_length(&launch_velocity) * (fE4 * frame_scale_macro), proving a distance-to-launch-speed factor. h8A -> spawn_interval_frames: Retail 0x002bfa7c-0x002bfa88 loads signed short pvars+0x8A, passes it to scale_game_frames and stores the scaled result into pvars+0x88, the timer decremented at 0x002bf11c-0x002bf130. The reload at 0x002bfa94-0x002bfabc selects immediate batch filling when this configured interval is zero, otherwise waits for timer zero. Authoritative C explicitly assigns timer = scale_game_frames(h8A) after each spawn attempt, proving configured spawn interval in game frames. --- src/overlays/shared/enemies/bomb_spawner.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/overlays/shared/enemies/bomb_spawner.c b/src/overlays/shared/enemies/bomb_spawner.c index 7b4550904e..a264667e4d 100644 --- a/src/overlays/shared/enemies/bomb_spawner.c +++ b/src/overlays/shared/enemies/bomb_spawner.c @@ -40,7 +40,7 @@ typedef struct Data_2C0330 { unsigned char count; unsigned char max; short timer; - short h8A; + short spawn_interval_frames; short h8C; char pad8E[2]; float spawn_distance_limit; @@ -48,11 +48,11 @@ typedef struct Data_2C0330 { float activation_distance_threshold; int pts[4]; char padB0[0x20]; - int fD0; + int spawn_trigger_volume_index; char padD4[8]; - float fDC; + float trajectory_gravity; char padE0[4]; - float fE4; + float launch_speed_distance_factor; int ids[18]; } Data_2C0330; @@ -245,8 +245,8 @@ void bomb_spawner_update(struct Moby *moby) { timerDone = fast_dec_timer_s16(&spawner_data->timer) != 0; inVol = 0; room = spawner_data->count < spawner_data->max; - if (spawner_data->fD0 != -1) { - inVol = is_point_inside_clip_volume(D_0013E533_2bef68 + 0xE9D, spawner_data->fD0) != 0; + if (spawner_data->spawn_trigger_volume_index != -1) { + inVol = is_point_inside_clip_volume(D_0013E533_2bef68 + 0xE9D, spawner_data->spawn_trigger_volume_index) != 0; } cond = inVol | near2; switch (spawner_data->spawn_trigger_mode) { @@ -259,7 +259,7 @@ void bomb_spawner_update(struct Moby *moby) { case SPAWNER_TRIGGER_VOLUME_OR_DISTANCE: break; } - if (spawner_data->h8A == 0 && spawner_data->count != 0) { + if (spawner_data->spawn_interval_frames == 0 && spawner_data->count != 0) { room = 0; } r = (Hit_2C0330 *)find_moby_hit(moby, 0xC30000, 0); @@ -384,7 +384,7 @@ void bomb_spawner_update(struct Moby *moby) { if (spawn && cond && timerDone && room) { int *used_point_flags = used; memset(used_point_flags, 0, 0x10); - while (spawner_data->h8A == 0 ? spawner_data->count < spawner_data->max + while (spawner_data->spawn_interval_frames == 0 ? spawner_data->count < spawner_data->max : spawner_data->timer == 0) { moby_point_position(moby, 0, &launch_origin); switch (spawner_data->spawn_target_mode) { @@ -532,7 +532,7 @@ void bomb_spawner_update(struct Moby *moby) { { float speed; char *spawned_moby; - speed = fast_vec_length(&launch_velocity) * (spawner_data->fE4 * frame_scale_macro); + speed = fast_vec_length(&launch_velocity) * (spawner_data->launch_speed_distance_factor * frame_scale_macro); launch_velocity.z = 0.0f; fast_vec_normalize(&launch_velocity, &launch_velocity, speed); fast_vec_normalize(&spawn_position, &launch_velocity, 0.05f); @@ -543,7 +543,7 @@ void bomb_spawner_update(struct Moby *moby) { &target_position, 0, speed, - -(spawner_data->fDC * frame_time_sq_macro)); + -(spawner_data->trajectory_gravity * frame_time_sq_macro)); spawned_moby = spawn_class_221_moby((char *)moby, (float *)&spawn_position, (float *)&launch_velocity, @@ -552,7 +552,7 @@ void bomb_spawner_update(struct Moby *moby) { if (spawned_moby != 0) { MOBY(spawned_moby)->update_dist = 0xFF; } - spawner_data->timer = scale_game_frames(spawner_data->h8A); + spawner_data->timer = scale_game_frames(spawner_data->spawn_interval_frames); spawner_data->count++; } } From 8a9aa2d3be2e7a1f7131d0095723fc65c37ff1c5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:17:13 +0000 Subject: [PATCH 703/758] decomp: clarify names in metropolis_train_locomotive_update fBC -> front_hitch_offset_distance: Retail 0x00292f78-0x00292fc0 obtains locomotive point 0, measures its XY distance from moby+0x10 and stores the float at engine+0xBC. In the supplied C, place_metropolis_train uses this same field as the rearward offset from the engine position to the first-car hitch reference; update_metropolis_train_motion identifies point 0 as front. This proves the engine's front hitch offset distance. fF0 -> path_segment_fraction: Retail 0x00293850-0x00293864 initializes coupling+0xF0 to 1.0 when installing the second path. Checked direct helper 0x00293c78 loads these same pvars in s3 at 0x00293cd4; 0x002944f0-0x00294518 compares +0xF0 with 1.0, subtracts 1.0 and advances the path cursor. 0x002945c8-0x002945f4 passes fraction plus distance/segment-length step to the interpolation helper, and 0x002947fc-0x00294808 accumulates that step. This proves fractional progress within a path segment. fFC -> path_step_distance: Retail 0x002930b4-0x002930bc and 0x00293868-0x00293878 store the frame-scaled train speed in coupling+0xFC immediately before its follower update. Supplied update_metropolis_train_motion writes a nonnegative spacing-distance margin to that same field before gunship_update. Checked follower 0x00294590-0x002945c8 loads +0xFC, adds a motion modulation, and divides the resulting distance by segment length to form the fraction increment, used at 0x002945ec and 0x00294804. Thus it supplies the path step distance. iA4 -> first_path_index: Retail 0x00293078-0x002930bc indexes the l03_paths table at 0x001B05B0 using engine+0xA4, copies its first node for placement, and installs the index in coupling+0x74 before gunship_update. 0x00293134-0x0029314c installs the same path for the first ride; engine+0xAC replaces it before the second-path state. iA8 -> boarding_placement_path_index: Retail 0x002930cc-0x00293124 uses engine+0xA8 to index l03_paths, copies its first node and computes its first-segment heading for place_metropolis_train. The branch clears movement speed and enters TRAIN_WAIT_FOR_BOARDING via command 3 at 0x00293128-0x00293154. It selects the path defining the boarding placement. iAC -> second_path_index: Retail 0x00292fbc-0x00293050 selects the l03_paths entry indexed by engine+0xAC and scans its nodes for the stop marker. Retail 0x00293800-0x00293884 places the train on this path, installs its index in coupling+0x74, and enters TRAIN_FOLLOW_SECOND_PATH_AND_BRAKE. This is the second ride path index. iB0 -> reset_clip_volume_index: Retail 0x00293a68-0x00293a78 passes engine+0xB0 as the clip-volume index with hero.motion to is_point_inside_clip_volume. A successful test resets linked mobys and restores locomotive speed/spacing before command 1 at 0x00293af4-0x00293b10. This is the reset clip-volume selector. iB4 -> boarding_clip_volume_index: Retail 0x00293160-0x00293174 passes engine+0xB4 as the clip-volume index to is_point_inside_clip_volume with hero.motion. Only inside this volume does the boarding-wait branch test the turret/control mode and start command 4 at 0x0029317c-0x002931d0. This selects the boarding trigger volume. iD4 -> second_path_stop_node_index: Retail 0x00292fd4-0x00293050 scans the second path's 0x10-byte nodes, tests the marker at node+0xC for 1.0, and saves the matching node index in engine+0xD4. 0x0029358c-0x002935a4 reports the supplied no STOP NODE warning when -1; 0x00293928-0x0029397c compares coupling path_node_index against it to begin braking. iD8 -> second_path_turret_moby_index: Retail 0x00293598-0x0029366c resolves engine+0xD8 through the 0x100-stride moby pool, enables its command and aims its private yaw/pitch toward the second path's first point. 0x002936a8-0x002937f0 positions its cuboid and sets the turret interval. In the second-path branch 0x00293898-0x002938b4 loads its pvars for hero aiming, and 0x00293994-0x002939b4 disables it on stopping. --- .../l03/mobys/metropolis_train_locomotive.c | 90 +++++++++---------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/src/overlays/l03/mobys/metropolis_train_locomotive.c b/src/overlays/l03/mobys/metropolis_train_locomotive.c index c21ef355d9..0bf7053c7e 100644 --- a/src/overlays/l03/mobys/metropolis_train_locomotive.c +++ b/src/overlays/l03/mobys/metropolis_train_locomotive.c @@ -309,19 +309,19 @@ typedef struct { char p40[0x5C]; int i9C; char pA0[4]; - int iA4; - int iA8; - int iAC; - int iB0; - int iB4; + int first_path_index; + int boarding_placement_path_index; + int second_path_index; + int reset_clip_volume_index; + int boarding_clip_volume_index; int iB8; - float fBC; + float front_hitch_offset_distance; float fC0; int iC4; float fC8; char pCC[8]; - int iD4; - int iD8; + int second_path_stop_node_index; + int second_path_turret_moby_index; float fDC; int ids[8]; int boarding_turret_moby_index; @@ -337,9 +337,9 @@ typedef struct { char *path; int i74; char p78[0x78]; - float fF0; + float path_segment_fraction; char pF4[8]; - float fFC; + float path_step_distance; } Coupling292e98; typedef struct { @@ -445,7 +445,7 @@ void metropolis_train_locomotive_update(char *moby) { train_engine_pvars = ((Engine292e98 *)MOBY(moby)->pvars); ident = *(unsigned short *)(moby + 0xA8); train_engine_pvars->iB8 = ident; - if (train_engine_pvars->iA4 == -1) { + if (train_engine_pvars->first_path_index == -1) { train_engine_pvars->i20 = 0; train_engine_pvars->s24 = 0; train_engine_pvars->b28 = 4; @@ -466,16 +466,16 @@ void metropolis_train_locomotive_update(char *moby) { train_engine_pvars->b28 = 4; train_engine_pvars->s3E = 0xD; moby_point_position(moby, 0, start); - train_engine_pvars->fBC = vector_distance_xy(start, moby + 0x10); + train_engine_pvars->front_hitch_offset_distance = vector_distance_xy(start, moby + 0x10); train_engine_pvars->fDC = 20.0f; train_engine_pvars->fC8 = train_engine_pvars->fC0 = train_engine_pvars->fC0 * frame_time; - if (train_engine_pvars->iAC != -1) { - second_path = ((char *)l03_paths[train_engine_pvars->iAC]); - train_engine_pvars->iD4 = -1; + if (train_engine_pvars->second_path_index != -1) { + second_path = ((char *)l03_paths[train_engine_pvars->second_path_index]); + train_engine_pvars->second_path_stop_node_index = -1; second_path_node_index = 0; if (*(int *)second_path > 0) { if (*(float *)(second_path + second_path_node_index * 0x10 + 0x1C) == 1.0f) { - train_engine_pvars->iD4 = second_path_node_index; + train_engine_pvars->second_path_stop_node_index = second_path_node_index; } else { next: second_path_node_index++; @@ -484,7 +484,7 @@ void metropolis_train_locomotive_update(char *moby) { 1.0f) { goto next; } - train_engine_pvars->iD4 = second_path_node_index; + train_engine_pvars->second_path_stop_node_index = second_path_node_index; } } } @@ -494,26 +494,26 @@ void metropolis_train_locomotive_update(char *moby) { *(unsigned short *)(coupling + 0x34) |= 6; break; case TRAIN_SETUP_COUPLING_PATH: - *(OvlQuad *)start = *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->iA4]) + 0x10); + *(OvlQuad *)start = *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->first_path_index]) + 0x10); place_metropolis_train(moby, start, 0.0f); - cdata->i74 = train_engine_pvars->iA4; - cdata->fFC = train_engine_pvars->fC0; + cdata->i74 = train_engine_pvars->first_path_index; + cdata->path_step_distance = train_engine_pvars->fC0; gunship_update(coupling); MOBY(moby)->command = 2; break; case TRAIN_POSITION_FOR_BOARDING: - *(OvlQuad *)start = *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->iA8]) + 0x10); + *(OvlQuad *)start = *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->boarding_placement_path_index]) + 0x10); place_metropolis_train( - moby, start, PATH_HEADING(((char *)l03_paths[train_engine_pvars->iA8]))); + moby, start, PATH_HEADING(((char *)l03_paths[train_engine_pvars->boarding_placement_path_index]))); MOBY(moby)->command = 3; - cdata->i74 = train_engine_pvars->iA4; + cdata->i74 = train_engine_pvars->first_path_index; cdata->path = ((char *)l03_paths[cdata->i74]); cdata->path_node_index = 1; train_engine_pvars->fC8 = 0.0f; break; case TRAIN_WAIT_FOR_BOARDING: update_metropolis_train_idle_motion(moby); - if (!is_point_inside_clip_volume(&hero.motion, train_engine_pvars->iB4)) { + if (!is_point_inside_clip_volume(&hero.motion, train_engine_pvars->boarding_clip_volume_index)) { break; } if (train_engine_pvars->boarding_turret_moby_index == -1) { @@ -567,10 +567,10 @@ void metropolis_train_locomotive_update(char *moby) { if (!is_hero_on_moby(moby)) { break; } - if (train_engine_pvars->iAC == -1) { + if (train_engine_pvars->second_path_index == -1) { break; } - if (train_engine_pvars->iD8 == -1) { + if (train_engine_pvars->second_path_turret_moby_index == -1) { break; } if (((unsigned char *)(char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index])[0xBC] != 0) { @@ -585,51 +585,51 @@ void metropolis_train_locomotive_update(char *moby) { break; } } - if (train_engine_pvars->iD4 == -1) { + if (train_engine_pvars->second_path_stop_node_index == -1) { debug_printf_292e98(train_end_path_missing_stop_node_warning); break; } - ((char *)&D_L03_0015FFD8_m292[train_engine_pvars->iD8])[0xBC] = 1; - tdb = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->iD8] + 0x78); - path = ((char *)l03_paths[train_engine_pvars->iAC]); + ((char *)&D_L03_0015FFD8_m292[train_engine_pvars->second_path_turret_moby_index])[0xBC] = 1; + tdb = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->second_path_turret_moby_index] + 0x78); + path = ((char *)l03_paths[train_engine_pvars->second_path_index]); tdb->f18 = fast_arc_tan(*(float *)(path + 0x10) - l03_camera.pos.f[0], *(float *)(path + 0x14) - l03_camera.pos.f[1]); tdb->f14 = -fast_arc_tan( vector_distance_xy(l03_camera.pos.f, - ((char *)l03_paths[train_engine_pvars->iAC]) + 0x10), - *(float *)(((char *)l03_paths[train_engine_pvars->iAC]) + 0x18) - l03_camera.pos.f[2]); + ((char *)l03_paths[train_engine_pvars->second_path_index]) + 0x10), + *(float *)(((char *)l03_paths[train_engine_pvars->second_path_index]) + 0x18) - l03_camera.pos.f[2]); l03_cuboids[tdb->cuboid_index].pos.x = - fast_cos(PATH_HEADING(((char *)l03_paths[train_engine_pvars->iAC]))) * + fast_cos(PATH_HEADING(((char *)l03_paths[train_engine_pvars->second_path_index]))) * -(train_engine_pvars->fDC + 4.0f); l03_cuboids[tdb->cuboid_index].pos.y = - fast_sin(PATH_HEADING(((char *)l03_paths[train_engine_pvars->iAC]))) * + fast_sin(PATH_HEADING(((char *)l03_paths[train_engine_pvars->second_path_index]))) * -(train_engine_pvars->fDC + 4.0f); l03_cuboids[tdb->cuboid_index].pos.z = 0.0f; fast_vec_add(&l03_cuboids[tdb->cuboid_index].pos, &l03_cuboids[tdb->cuboid_index].pos, - ((char *)l03_paths[train_engine_pvars->iAC]) + 0x10); + ((char *)l03_paths[train_engine_pvars->second_path_index]) + 0x10); l03_cuboids[tdb->cuboid_index].pos.z += 2.7f; clear_u64_value(&l03_cuboids[tdb->cuboid_index].rot); - l03_cuboids[tdb->cuboid_index].rot.z = PATH_HEADING(((char *)l03_paths[train_engine_pvars->iAC])); + l03_cuboids[tdb->cuboid_index].rot.z = PATH_HEADING(((char *)l03_paths[train_engine_pvars->second_path_index])); tdb->i2C = scale_game_frames(10000); - *(OvlQuad *)start = *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->iAC]) + 0x10); + *(OvlQuad *)start = *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->second_path_index]) + 0x10); place_metropolis_train( - moby, start, PATH_HEADING(((char *)l03_paths[train_engine_pvars->iAC]))); - cdata->i74 = train_engine_pvars->iAC; + moby, start, PATH_HEADING(((char *)l03_paths[train_engine_pvars->second_path_index]))); + cdata->i74 = train_engine_pvars->second_path_index; cdata->path_node_index = 1; - cdata->fF0 = 1.0f; + cdata->path_segment_fraction = 1.0f; train_engine_pvars->fC0 = 2.0f * train_engine_pvars->fC0; - cdata->fFC = train_engine_pvars->fC0; + cdata->path_step_distance = train_engine_pvars->fC0; gunship_update(coupling); MOBY(moby)->command = 5; request_music_track(0, 8); break; case TRAIN_FOLLOW_SECOND_PATH_AND_BRAKE: - td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->iD8] + 0x78); + td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->second_path_turret_moby_index] + 0x78); update_metropolis_train_motion(moby); D_L03_0015FDFC = 1; ENGINE_SOUND(); - if (cdata->path_node_index >= train_engine_pvars->iD4) { + if (cdata->path_node_index >= train_engine_pvars->second_path_stop_node_index) { train_engine_pvars->fDC = 0.0f; braking_speed_floor = train_engine_pvars->fDC; train_engine_pvars->fC8 -= train_engine_pvars->fC0 / 1.9f * frame_time; @@ -637,7 +637,7 @@ void metropolis_train_locomotive_update(char *moby) { train_engine_pvars->fC8 = braking_speed_floor; } if (train_engine_pvars->fC8 == braking_speed_floor) { - ((char *)&D_L03_0015FFD8_m292[train_engine_pvars->iD8])[0xBC] = 0; + ((char *)&D_L03_0015FFD8_m292[train_engine_pvars->second_path_turret_moby_index])[0xBC] = 0; MOBY(moby)->command = 6; train_engine_pvars->fC0 *= 0.5f; RELEASE_VOICE(train_engine_pvars->i108); @@ -647,7 +647,7 @@ void metropolis_train_locomotive_update(char *moby) { AIM_AT_HERO(td); break; case TRAIN_WAIT_FOR_RESET_VOLUME: - if (is_point_inside_clip_volume(&hero.motion, train_engine_pvars->iB0)) { + if (is_point_inside_clip_volume(&hero.motion, train_engine_pvars->reset_clip_volume_index)) { for (i6 = 0; i6 < 8; i6++) { linked_moby = D_L03_0015FFD8_292e98 + (train_engine_pvars->ids[i6] << 8); if (train_engine_pvars->ids[i6] != -1 && linked_moby != 0 && From 3e721dcc67928af4923361ee59151ad9466f11f2 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:17:17 +0000 Subject: [PATCH 704/758] decomp: clarify names in platform_update fD0 -> target_speed: Assigned retail 0x002e42b4-0x002e42c4 copies an arrived waypoint's non--1 w component into pvars +0xD0, matching C's speed override. Checked steering helper 0x002e3cec-0x002e3d3c compares velocity length with +0xD0 times frame scale and increases or decreases speed toward it; supplied steer_platform_toward_target C confirms this target-speed role. fD4 -> acceleration: Assigned initialization supplies +0xD4 defaults 6/2/8/4 and oscillation state 2 zeros it at 0x002e4368. Checked steering helper 0x002e3c98-0x002e3ce0 scales +0xD4 by D_0015ED70, compares against speed squared over twice distance, then subtracts or adds it to speed. 0x002e3d0c-0x002e3d3c likewise uses it for speed change; supplied C confirms acceleration and braking. fD8 -> path_oscillation_phase: Retail 0x002e40f8-0x002e4108 seeds pvars +0xD8 with random_angle_radians. States 2 and 4 advance it with wrapped angle addition by frame-scaled 1.2217305 at 0x002e4360-0x002e437c and 0x002e44fc-0x002e4514. Its sine and quadrant comparisons produce the folded interpolation factor between path nodes 0 and 1 at 0x002e448c/0x002e4620, exactly as authoritative C shows. fDC -> movement_blocking_group_id: Retail 0x002e3f54-0x002e3f80 checks noninitial state, loads pvars +0xDC, skips -1, passes it with -1 to count_active_moby_group_members, and returns after exhaust when the count is nonzero. Authoritative C corroborates the group identifier as a movement-dispatch blocker while any counted group member remains active. fE8 -> tumble_rotation_x_step: In assigned fall-and-tumble state 8, retail 0x002e4890 loads float pvars +0xE8; 0x002e489c-0x002e48a4 wraps its addition to moby rotation X at +0x40 and stores that rotation. Authoritative C uses fast_add_rotations(platform_vars->fE8, moby->rot[0]), proving the per-update X rotation step during tumbling. fEC -> tumble_rotation_y_step: In assigned fall-and-tumble state 8, retail 0x002e48a8-0x002e48b4 loads moby rotation Y at +0x44 and float pvars +0xEC, calls wrapped angle addition and stores the new Y rotation. Authoritative C uses fast_add_rotations(platform_vars->fEC, moby->rot[1]), proving the per-update Y rotation step during tumbling. fF0 -> height_reference_moby_index: Assigned retail state 9 at 0x002e4914-0x002e492c loads pvars +0xF0, shifts by 8 and adds the moby array base. 0x002e4938-0x002e494c reads that moby's position Z into the steering target; target Z gains 0.2 or 0.4 before steering. C resolves this indexed object as height_reference_moby, proving a moby-array index for the height reference. fFC -> movement_blocking_moby_index: Assigned retail 0x002e3f24-0x002e3f50 checks noninitial state, loads pvars +0xFC, skips sentinel -1, shifts the index by 8, adds the moby-array base and tests the referenced moby's signed state at +0x20. A nonnegative state branches to exhaust and immediate return at 0x002e3f7c-0x002e3f84, blocking movement dispatch; authoritative C corroborates this index role. --- src/overlays/l12/mobys/platform.c | 80 +++++++++++++++---------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/overlays/l12/mobys/platform.c b/src/overlays/l12/mobys/platform.c index 436bb60782..648e24a738 100644 --- a/src/overlays/l12/mobys/platform.c +++ b/src/overlays/l12/mobys/platform.c @@ -225,17 +225,17 @@ typedef struct { char f60[0x40]; Walk walk; char padB8[0x18]; - float fD0; - float fD4; - float fD8; - int fDC; + float target_speed; + float acceleration; + float path_oscillation_phase; + int movement_blocking_group_id; int timer; int kind; - float fE8; - float fEC; - int fF0; + float tumble_rotation_x_step; + float tumble_rotation_y_step; + int height_reference_moby_index; char padF4[8]; - int fFC; + int movement_blocking_moby_index; } Data_2E51E8; extern int is_hero_on_moby(void *) __asm__("FUN_L01_00277fb8"); @@ -298,13 +298,13 @@ void platform_update(Moby *moby) { platform_vars = (*(Data_2E51E8 **)&moby->pvars); qcopy(oldPos, (*(float(*)[4]) & moby->pos)); qcopy(oldRot, (*(float(*)[4]) & moby->rot)); - if (moby->state != PLATFORM_INITIALIZE && platform_vars->fFC != -1 && - (signed char)(*(Moby **)&D_L12_0015FFD8_p)[platform_vars->fFC].state >= 0) { + if (moby->state != PLATFORM_INITIALIZE && platform_vars->movement_blocking_moby_index != -1 && + (signed char)(*(Moby **)&D_L12_0015FFD8_p)[platform_vars->movement_blocking_moby_index].state >= 0) { emit_platform_exhaust_effects((char *)moby); return; } - if (moby->state != PLATFORM_INITIALIZE && platform_vars->fDC != -1 && - count_active_moby_group_members(platform_vars->fDC, -1) != 0) { + if (moby->state != PLATFORM_INITIALIZE && platform_vars->movement_blocking_group_id != -1 && + count_active_moby_group_members(platform_vars->movement_blocking_group_id, -1) != 0) { emit_platform_exhaust_effects((char *)moby); return; } @@ -316,10 +316,10 @@ void platform_update(Moby *moby) { platform_vars->walk.path = ((Path *)l12_paths[platform_vars->walk.pathIdx]); platform_vars->walk.idx = 0; platform_vars->walk.dir = 1; - if (platform_vars->fD0 == 0.0f) - platform_vars->fD0 = 6.0f; - if (platform_vars->fD4 == 0.0f) - platform_vars->fD4 = 6.0f; + if (platform_vars->target_speed == 0.0f) + platform_vars->target_speed = 6.0f; + if (platform_vars->acceleration == 0.0f) + platform_vars->acceleration = 6.0f; platform_vars->f3E |= 9; clear_u64_value(platform_vars->vel); moby->state = PLATFORM_FOLLOW_WAYPOINTS; @@ -329,11 +329,11 @@ void platform_update(Moby *moby) { platform_vars->walk.path = ((Path *)l12_paths[platform_vars->walk.pathIdx]); platform_vars->walk.idx = 0; platform_vars->walk.dir = 1; - if (platform_vars->fD4 == 0.0f) - platform_vars->fD4 = 2.0f; - if (platform_vars->fD0 == 0.0f) - platform_vars->fD0 = 4.0f; - platform_vars->fD8 = random_angle_radians(); + if (platform_vars->acceleration == 0.0f) + platform_vars->acceleration = 2.0f; + if (platform_vars->target_speed == 0.0f) + platform_vars->target_speed = 4.0f; + platform_vars->path_oscillation_phase = random_angle_radians(); platform_vars->f3E |= 9; clear_u64_value(platform_vars->vel); moby->state = PLATFORM_OSCILLATE_BETWEEN_PATH_ENDPOINTS; @@ -345,10 +345,10 @@ void platform_update(Moby *moby) { platform_vars->walk.path = ((Path *)l12_paths[platform_vars->walk.pathIdx]); platform_vars->walk.idx = 0; platform_vars->walk.dir = 1; - if (platform_vars->fD4 == 0.0f) - platform_vars->fD4 = 8.0f; - if (platform_vars->fD0 == 0.0f) - platform_vars->fD0 = 8.0f; + if (platform_vars->acceleration == 0.0f) + platform_vars->acceleration = 8.0f; + if (platform_vars->target_speed == 0.0f) + platform_vars->target_speed = 8.0f; clear_u64_value(platform_vars->vel); moby->state = PLATFORM_OSCILLATE_BETWEEN_PATH_ENDPOINTS_FIXED_PITCH; break; @@ -359,8 +359,8 @@ void platform_update(Moby *moby) { break; case PLATFORM_KIND_TRACK_REFERENCED_MOBY_HEIGHT: moby->state = PLATFORM_TRACK_REFERENCED_MOBY_HEIGHT; - platform_vars->fD4 = 4.0f; - platform_vars->fD0 = 4.0f; + platform_vars->acceleration = 4.0f; + platform_vars->target_speed = 4.0f; platform_vars->f3E &= 0xFFFE; break; } @@ -376,7 +376,7 @@ void platform_update(Moby *moby) { if (fast_vec_dist((*(float(*)[4]) & moby->pos), &path->nodes[next_waypoint_index]) < 0.5f) { platform_vars->walk.idx = next_waypoint_index; if (platform_vars->walk.path->nodes[next_waypoint_index].w != -1.0f) { - platform_vars->fD0 = platform_vars->walk.path->nodes[next_waypoint_index].w; + platform_vars->target_speed = platform_vars->walk.path->nodes[next_waypoint_index].w; } } fast_vec_sub(to_goal, goal, (*(float(*)[4]) & moby->pos)); @@ -393,12 +393,12 @@ void platform_update(Moby *moby) { case PLATFORM_OSCILLATE_BETWEEN_PATH_ENDPOINTS: { Path *path = platform_vars->walk.path; float swing; - platform_vars->fD4 = 0.0f; - platform_vars->fD8 = fast_add_rotations(platform_vars->fD8, D_0015ED6C * 1.2217305f); - swing = fast_sin(platform_vars->fD8); - if (platform_vars->fD8 > 1.5707964f && platform_vars->fD8 < 3.1415927f) + platform_vars->acceleration = 0.0f; + platform_vars->path_oscillation_phase = fast_add_rotations(platform_vars->path_oscillation_phase, D_0015ED6C * 1.2217305f); + swing = fast_sin(platform_vars->path_oscillation_phase); + if (platform_vars->path_oscillation_phase > 1.5707964f && platform_vars->path_oscillation_phase < 3.1415927f) swing = 2.0f - swing; - if (platform_vars->fD8 > -3.1415927f && platform_vars->fD8 < -1.5707964f) + if (platform_vars->path_oscillation_phase > -3.1415927f && platform_vars->path_oscillation_phase < -1.5707964f) swing = 2.0f - swing; swing = swing * 0.5f; swing = swing + 0.5f; @@ -421,11 +421,11 @@ void platform_update(Moby *moby) { case PLATFORM_OSCILLATE_BETWEEN_PATH_ENDPOINTS_FIXED_PITCH: { Path *path = platform_vars->walk.path; float swing; - platform_vars->fD8 = fast_add_rotations(platform_vars->fD8, D_0015ED6C * 1.2217305f); - swing = fast_sin(platform_vars->fD8); - if (platform_vars->fD8 > 1.5707964f && platform_vars->fD8 < 3.1415927f) + platform_vars->path_oscillation_phase = fast_add_rotations(platform_vars->path_oscillation_phase, D_0015ED6C * 1.2217305f); + swing = fast_sin(platform_vars->path_oscillation_phase); + if (platform_vars->path_oscillation_phase > 1.5707964f && platform_vars->path_oscillation_phase < 3.1415927f) swing = 2.0f - swing; - if (platform_vars->fD8 > -3.1415927f && platform_vars->fD8 < -1.5707964f) + if (platform_vars->path_oscillation_phase > -3.1415927f && platform_vars->path_oscillation_phase < -1.5707964f) swing = 2.0f - swing; swing = swing * 0.5f; swing = swing + 0.5f; @@ -509,9 +509,9 @@ void platform_update(Moby *moby) { } platform_vars->vel[2] = platform_vars->vel[2] - D_0015ED70 * 7.0f; (*(float(*)[4]) & moby->rot)[0] = - fast_add_rotations(platform_vars->fE8, (*(float(*)[4]) & moby->rot)[0]); + fast_add_rotations(platform_vars->tumble_rotation_x_step, (*(float(*)[4]) & moby->rot)[0]); (*(float(*)[4]) & moby->rot)[1] = - fast_add_rotations(platform_vars->fEC, (*(float(*)[4]) & moby->rot)[1]); + fast_add_rotations(platform_vars->tumble_rotation_y_step, (*(float(*)[4]) & moby->rot)[1]); if (platform_vars->walk.path != 0 && vector_distance_xy((*(float(*)[4]) & moby->pos), &platform_vars->walk.path->nodes[0]) < 0.5f) { @@ -523,7 +523,7 @@ void platform_update(Moby *moby) { break; case PLATFORM_TRACK_REFERENCED_MOBY_HEIGHT: { Moby *height_reference_moby = - (Moby *)((char *)(*(Moby **)&D_L12_0015FFD8_p) + (platform_vars->fF0 << 8)); + (Moby *)((char *)(*(Moby **)&D_L12_0015FFD8_p) + (platform_vars->height_reference_moby_index << 8)); qcopy(angles, (*(float(*)[4]) & moby->pos)); angles[2] = (*(float(*)[4]) & height_reference_moby->pos)[2]; clear_u64_value(goal); From dfd84d6780fb306296af25b21a120277e99e100d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:17:20 +0000 Subject: [PATCH 705/758] decomp: clarify names in blarg_space_fighter_update bD0 -> path_node_step: Data_2C56B0 signed char: retail 0x002c45a0 initializes data+0xD0 to +1. Supplied update_blarg_space_fighter_path_following chooses signed +/-1 steps, compares and stores them at +0xD0, and swaps +0xB4/+0xB6 when reversing; advance_blarg_space_fighter_along_path adds this signed step to the target node index and wraps at the path count. Bounded checked retail helper request be9e32d8067f45f9a39d3192c8ab9a39 confirms +/-1 selection at 0x002c4254-0x002c4284, signed step comparison at 0x002c4298-0x002c429c, and step store plus endpoint swap at 0x002c4358-0x002c436c. fA0 -> flight_path_index: Data_2C56B0 int: retail 0x002c4478-0x002c4498 tests data+0xA0 against -1, scales it by four, and loads a path pointer from 0x001b07b0. Retail 0x002c4514-0x002c4548 uses that selected path for node position and count initialization; supplied C agrees with D_L13_001B07B0 indexing. fA4 -> shot_interval_timer: Data_2C56B0 int: retail 0x002c4980-0x002c4988 decrements data+0xA4 and gates the firing branch on expiry; 0x002c49c0-0x002c49fc reloads it with scale_game_frames(6) plus the suppression adjustment. The same branch builds aim vectors and calls spawn_blarg_ship_shot at 0x002c4b74. fA8 -> fire_exit_frame_counter: Data_2C56B0 int: 0x002c4740-0x002c4754 and 0x002c4910-0x002c4918 increment data+0xA8 under the moby+0x31 gate, with a close-vehicle reset; 0x002c48d4 clears it on firing entry. Retail 0x002c4930-0x002c4958 compares it with scale_game_frames(20) and switches firing to cooldown when the limit is reached. Name records this exit-delay counter role without asserting the general meaning of moby+0x31. fAC -> aim_offset_radius_scale: Data_2C56B0 float: retail 0x002c48c4-0x002c48d0 sets data+0xAC to 1.0 on firing entry. 0x002c4a54-0x002c4a90 multiplies it by 5 and sine/cosine of data+0xB0 to normalize the two perpendicular aim offsets added to vehicle position. 0x002c4b8c-0x002c4be8 decays this scale after each firing opportunity. fB0 -> aim_offset_angle_radians: Data_2C56B0 float: 0x002c4a54-0x002c4a90 passes data+0xB0 to sine/cosine controlling perpendicular aim offsets. Retail 0x002c4bd8-0x002c4c70 compares it with pi/2 and adds or subtracts random_float_between(20,40)*0.017453292*frame_time, proving an angle in radians rather than a count or timer. fB8 -> attack_phase_timer: Data_2C56B0 int: retail 0x002c48bc-0x002c48cc loads data+0xB8 with scaled 600 on firing entry; 0x002c4948-0x002c497c reloads scaled 30 or 120 and enters cooldown. Both firing (0x002c495c) and cooldown (0x002c4c74-0x002c4c80) decrement it, with cooldown expiry returning to wait-to-fire. fBC -> linked_boss_index: Data_2C56B0 int: 0x002c4758-0x002c479c tests data+0xBC against -1, shifts it eight bits, adds the moby table base, checks removal states and loads linked moby data at +0x78. Supplied C names these boss/bossd and uses their firing_fighter_update_count. The same table index resolves the linked object for destruction and reinitialization. fD4 -> fighter_voice_slot: Data_2C56B0 int: retail 0x002c47e4-0x002c4830 uses data+0xD4 to index 0x70-byte voice entries, checks entry owner against this moby, then stores allocate_voice_for_target_entry(1,4,moby)'s return. Destruction at 0x002c4c8c-0x002c4cd0 validates the owner, passes this field to release_voice_slot and resets it to -1. h24 -> reinitialization_health: Data_2C56B0 short: retail 0x002c4eb8-0x002c4ecc converts data+0x24 from signed short to float, stores it in data+0x20 and returns to FIGHTER_INITIALIZE. The destination is the health scalar passed at 0x002c468c-0x002c4690 to process_blarg_space_fighter_damage, whose supplied C subtracts hit damage and zeros it on lethal hits. hB2 -> diagnostic_moby_number: Moby_2C56B0 short: retail 0x002c44e8-0x002c44f4 loads moby+0xB2 as the integer argument to the missing-path diagnostic at 0x001f4700. Prepared checked retail string evidence in the supplied original Ghidra plate is 'no path for moby 111 #%d: killing\n', proving its consumer role as the diagnostic moby number without asserting allocation semantics. hB4 -> target_path_node_index: Data_2C56B0 short: retail 0x002c4534 initializes data+0xB4 to 1 and 0x002c4630 stores the selected join node. Supplied advance_blarg_space_fighter_along_path indexes path+0x10+(data+0xB4)*16 as the steering target, copies it into +0xB6 on reaching a segment end, then advances +0xB4 by the signed path step. Bounded checked retail helper request be9e32d8067f45f9a39d3192c8ab9a39 confirms +/-1 selection at 0x002c4254-0x002c4284, signed step comparison at 0x002c4298-0x002c429c, and step store plus endpoint swap at 0x002c4358-0x002c436c. hB6 -> previous_path_node_index: Data_2C56B0 short: retail 0x002c453c-0x002c4548 initializes data+0xB6 to path count minus one; 0x002c4638 sets it to the selected join node. Supplied advance_blarg_space_fighter_along_path measures distance from the node at +0xB6 and segment length to +0xB4, then copies the reached target index into +0xB6 before advancing the target. Bounded checked retail helper request be9e32d8067f45f9a39d3192c8ab9a39 confirms +/-1 selection at 0x002c4254-0x002c4284, signed step comparison at 0x002c4298-0x002c429c, and step store plus endpoint swap at 0x002c4358-0x002c436c. --- src/overlays/l13/mobys/blarg_space_fighter.c | 120 +++++++++---------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/overlays/l13/mobys/blarg_space_fighter.c b/src/overlays/l13/mobys/blarg_space_fighter.c index 4fd79cb29a..240d5e96dd 100644 --- a/src/overlays/l13/mobys/blarg_space_fighter.c +++ b/src/overlays/l13/mobys/blarg_space_fighter.c @@ -473,7 +473,7 @@ typedef struct Moby_2C56B0 { char pad98[0xE]; short hA6; char padA8[0xA]; - short hB2; + short diagnostic_moby_number; char padB4[8]; unsigned char bBC; } Moby_2C56B0; @@ -481,24 +481,24 @@ typedef struct Moby_2C56B0 { typedef struct Data_2C56B0 { char pad0[0x20]; float f20; - short h24; + short reinitialization_health; char pad26[0x4A]; V4_2C56B0 vel; char pad80[0x10]; V4_2C56B0 path_join_position; - int fA0; - int fA4; - int fA8; - float fAC; - float fB0; - short hB4; - short hB6; - int fB8; - int fBC; + int flight_path_index; + int shot_interval_timer; + int fire_exit_frame_counter; + float aim_offset_radius_scale; + float aim_offset_angle_radians; + short target_path_node_index; + short previous_path_node_index; + int attack_phase_timer; + int linked_boss_index; char padC0[0x10]; - signed char bD0; + signed char path_node_step; char padD1[3]; - int fD4; + int fighter_voice_slot; } Data_2C56B0; typedef struct Hero_2C56B0 { @@ -569,8 +569,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { fighter_data = moby->data; veh = ((Hero_2C56B0 *)(((char *)&D_0013F350)))->veh; path = 0; - if (fighter_data->fA0 != -1) { - path = D_L13_001B07B0[fighter_data->fA0]; + if (fighter_data->flight_path_index != -1) { + path = D_L13_001B07B0[fighter_data->flight_path_index]; } switch (moby->state) { case FIGHTER_INITIALIZE: @@ -579,19 +579,19 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { return; } if (path == 0) { - func_001E9730_d(blarg_space_fighter_missing_path_debug_format, moby->hB2); + func_001E9730_d(blarg_space_fighter_missing_path_debug_format, moby->diagnostic_moby_number); mark_moby_for_removal(moby); return; } { - int path_table_index = fighter_data->fA0; + int path_table_index = fighter_data->flight_path_index; qcopy(&moby->pos, D_L13_001B07B0[path_table_index] + 0x10); - fighter_data->hB4 = 1; - fighter_data->hB6 = *(unsigned short *)D_L13_001B07B0[path_table_index] - 1; + fighter_data->target_path_node_index = 1; + fighter_data->previous_path_node_index = *(unsigned short *)D_L13_001B07B0[path_table_index] - 1; } qcopy(&fighter_data->path_join_position, path + 0x20); qcopy(&moby->pos, &fighter_data->path_join_position); - fighter_data->fA8 = scale_game_frames(0x14) + 5; + fighter_data->fire_exit_frame_counter = scale_game_frames(0x14) + 5; moby->b30 = 0xFF; moby->h32 = 0xFF; moby->state = FIGHTER_WAIT_TO_JOIN_PATH; @@ -599,19 +599,19 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { moby->flags = (moby->flags | 1) & 0xEFFF; moby->f94 = 0; moby->b31 = 0; - fighter_data->bD0 = 1; + fighter_data->path_node_step = 1; break; case FIGHTER_WAIT_TO_JOIN_PATH: { Moby_2C56B0 *p; - if (fighter_data->fBC == -1 || - (p = (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->fBC << 8))) == 0 || + if (fighter_data->linked_boss_index == -1 || + (p = (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->linked_boss_index << 8))) == 0 || p->state == MOBY_STATE_REMOVAL_AT_OR_ABOVE_INSTANCE_END || p->state == MOBY_STATE_REMOVAL_BELOW_INSTANCE_END || p->bBC == 4) { fast_vec_normalize(scratch_vector, D_L13_001670C0 + 0x84, 40.0f); fast_vec_sub(scratch_vector, D_L13_001670C0, scratch_vector); - fighter_data->hB6 = fighter_data->hB4 = + fighter_data->previous_path_node_index = fighter_data->target_path_node_index = select_point_index_by_distance(scratch_vector, path, 0.0f); - qcopy(&fighter_data->path_join_position, path + (fighter_data->hB6 * 16 + 0x10)); + qcopy(&fighter_data->path_join_position, path + (fighter_data->previous_path_node_index * 16 + 0x10)); qcopy(&moby->pos, &fighter_data->path_join_position); moby->f94 = moby->cls->f10; moby->b31 = 1; @@ -643,14 +643,14 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { qcopy(hpos, ((char *)&D_0013F3D0)); } if (moby->b31 == 0) { - fighter_data->fA8++; + fighter_data->fire_exit_frame_counter++; } else if (close != 0) { - fighter_data->fA8 = 0; + fighter_data->fire_exit_frame_counter = 0; } boss = 0; bossd = 0; - if (fighter_data->fBC != -1) { - Moby_2C56B0 *p = (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->fBC << 8)); + if (fighter_data->linked_boss_index != -1) { + Moby_2C56B0 *p = (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->linked_boss_index << 8)); if (p != 0 && p->state != MOBY_STATE_REMOVAL_AT_OR_ABOVE_INSTANCE_END && p->state != MOBY_STATE_REMOVAL_BELOW_INSTANCE_END) { boss = p; @@ -666,11 +666,11 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { } { Snd *e; - if (fighter_data->fD4 == -1 || - (e = (Snd *)(((char *)&D_0013E550) + fighter_data->fD4 * 0x70))->f88 != moby || + if (fighter_data->fighter_voice_slot == -1 || + (e = (Snd *)(((char *)&D_0013E550) + fighter_data->fighter_voice_slot * 0x70))->f88 != moby || e->b74 == 0) { - fighter_data->fD4 = -1; - fighter_data->fD4 = allocate_voice_for_target_entry(1, 4, moby); + fighter_data->fighter_voice_slot = -1; + fighter_data->fighter_voice_slot = allocate_voice_for_target_entry(1, 4, moby); } } func_L13_002C5248_56B0(moby, fighter_data, 1); @@ -678,9 +678,9 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { case FIGHTER_ATTACK_WAIT_TO_FIRE: if (vehd != 0 && veh->state == 4 && moby->b31 != 0 && close != 0 && boss != 0 && bossd->firing_fighter_update_count < 3) { - fighter_data->fB8 = scale_game_frames(0x258); - fighter_data->fAC = 1.0f; - fighter_data->fA8 = 0; + fighter_data->attack_phase_timer = scale_game_frames(0x258); + fighter_data->aim_offset_radius_scale = 1.0f; + fighter_data->fire_exit_frame_counter = 0; moby->bBC = 1; } break; @@ -690,20 +690,20 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { } if (bossd->firing_fighter_update_count < 4) { if (moby->b31 == 0) { - fighter_data->fA8++; + fighter_data->fire_exit_frame_counter++; } - if (moby->b31 == 0 || close == 0 || scale_game_frames(0x14) <= fighter_data->fA8) { - fighter_data->fB8 = scale_game_frames(0x1E); + if (moby->b31 == 0 || close == 0 || scale_game_frames(0x14) <= fighter_data->fire_exit_frame_counter) { + fighter_data->attack_phase_timer = scale_game_frames(0x1E); moby->bBC = 2; } - if (fast_dec_timer(&fighter_data->fB8) != 0) { - fighter_data->fB8 = scale_game_frames(0x78); + if (fast_dec_timer(&fighter_data->attack_phase_timer) != 0) { + fighter_data->attack_phase_timer = scale_game_frames(0x78); moby->bBC = 2; } - if (fast_dec_timer(&fighter_data->fA4) != 0 && + if (fast_dec_timer(&fighter_data->shot_interval_timer) != 0 && optional_glow_suppression_level < 0.9f && blarg_space_fighter_fire_suppression_level < 0.9f) { - fighter_data->fA4 = + fighter_data->shot_interval_timer = scale_game_frames(6) + truncate_float_to_s32((optional_glow_suppression_level + blarg_space_fighter_fire_suppression_level) * @@ -719,10 +719,10 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { fast_vec_cross(lateral_aim_offset, &vehd->vel, up); fast_vec_cross(up, lateral_aim_offset, &vehd->vel); fast_vec_normalize( - up, up, fighter_data->fAC * 5.0f * fast_sin(fighter_data->fB0)); + up, up, fighter_data->aim_offset_radius_scale * 5.0f * fast_sin(fighter_data->aim_offset_angle_radians)); fast_vec_normalize(lateral_aim_offset, lateral_aim_offset, - fighter_data->fAC * 5.0f * fast_cos(fighter_data->fB0)); + fighter_data->aim_offset_radius_scale * 5.0f * fast_cos(fighter_data->aim_offset_angle_radians)); fast_vec_add(scratch_vector, hpos, up); fast_vec_add(scratch_vector, scratch_vector, lateral_aim_offset); add_random_offset_to_vector_xyz(scratch_vector, 0.6f); @@ -742,21 +742,21 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { 5.0f); allocate_voice_for_target_entry(0, 0, moby); } - fighter_data->fAC = - fighter_data->fAC * + fighter_data->aim_offset_radius_scale = + fighter_data->aim_offset_radius_scale * ((random_float_between(0.92f, 0.94f) - 1.0f) * D_0015ED60 + 1.0f); - if (fighter_data->fB0 > 1.5707964f) { - fighter_data->fB0 = fighter_data->fB0 - random_float_between(20.0f, 40.0f) * + if (fighter_data->aim_offset_angle_radians > 1.5707964f) { + fighter_data->aim_offset_angle_radians = fighter_data->aim_offset_angle_radians - random_float_between(20.0f, 40.0f) * 0.017453292f * D_0015ED6C; } else { - fighter_data->fB0 = fighter_data->fB0 + random_float_between(20.0f, 40.0f) * + fighter_data->aim_offset_angle_radians = fighter_data->aim_offset_angle_radians + random_float_between(20.0f, 40.0f) * 0.017453292f * D_0015ED6C; } } } break; case FIGHTER_ATTACK_COOLDOWN: - if (fast_dec_timer(&fighter_data->fB8) != 0) { + if (fast_dec_timer(&fighter_data->attack_phase_timer) != 0) { moby->bBC = 0; } break; @@ -767,12 +767,12 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { Moby_2C56B0 *boss; Boss *bossd; - if (fighter_data->fD4 != -1) { - Snd *e = (Snd *)(((char *)&D_0013E550) + fighter_data->fD4 * 0x70); + if (fighter_data->fighter_voice_slot != -1) { + Snd *e = (Snd *)(((char *)&D_0013E550) + fighter_data->fighter_voice_slot * 0x70); if (e->f88 == moby && e->b74 != 0) { - release_voice_slot(fighter_data->fD4); + release_voice_slot(fighter_data->fighter_voice_slot); } - fighter_data->fD4 = -1; + fighter_data->fighter_voice_slot = -1; } fast_vec_sub(scratch_vector, D_L13_001670C0, &moby->pos); func_L00_0025F4A8_alt(moby, @@ -815,8 +815,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { } boss = 0; bossd = 0; - if (fighter_data->fBC != -1) { - Moby_2C56B0 *p = (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->fBC << 8)); + if (fighter_data->linked_boss_index != -1) { + Moby_2C56B0 *p = (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->linked_boss_index << 8)); if (p != 0 && p->state != MOBY_STATE_REMOVAL_AT_OR_ABOVE_INSTANCE_END && p->state != MOBY_STATE_REMOVAL_BELOW_INSTANCE_END) { boss = p; @@ -835,11 +835,11 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { } case FIGHTER_WAIT_TO_REINITIALIZE: { Moby_2C56B0 *p; - if (fighter_data->fBC != -1 && - (p = (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->fBC << 8))) != 0 && + if (fighter_data->linked_boss_index != -1 && + (p = (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->linked_boss_index << 8))) != 0 && p->state != MOBY_STATE_REMOVAL_AT_OR_ABOVE_INSTANCE_END && p->state != MOBY_STATE_REMOVAL_BELOW_INSTANCE_END && p->bBC != 4) { - fighter_data->f20 = fighter_data->h24; + fighter_data->f20 = fighter_data->reinitialization_health; moby->state = FIGHTER_INITIALIZE; } break; From ca8f04ae58e6bb9d9b3c3cc8afa208c31e1b9268 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:19:25 +0000 Subject: [PATCH 706/758] decomp: clarify names in update_fighter_jet_flight iDC -> collision_damage_cooldown: Retail 0x002ecdbc loads vars+0xDC and 0x002ecdc0 skips HP damage while nonzero; 0x002ecdd8-0x002ecdec subtracts fighter_jet_collision_damage_gp from hero.ship_hp when zero. At 0x002ecec8-0x002eced0 the field receives l17_fighter_jet_collision_damage_cooldown_reload after that damage path. The authoritative C declares this storage as FighterJetVars.iDC and the supplied fighter_jet_update passes the same vars and calls fast_dec_timer(&ship_vars->timerDC), the corresponding int at +0xDC, on each update. This proves a countdown preventing repeated collision damage. --- src/overlays/l17/mobys/fighter_jet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l17/mobys/fighter_jet.c b/src/overlays/l17/mobys/fighter_jet.c index 059436f23c..d1f6e0d868 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -1089,7 +1089,7 @@ typedef struct { float fB0, fB4, fB8, fBC; float fC0, fC4, fC8, fCC; float fD0, fD4, fD8; - int iDC; + int collision_damage_cooldown; char padE0[0x2C]; int boost_voice_slot_index; int flight_target_record_index; @@ -1523,7 +1523,7 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v ship_vars->speed = k; if (*(char **)(collision_result + 0x18) != 0 && *(short *)(*(char **)(collision_result + 0x18) + 0xA6) != 0x15B) { - if (ship_vars->iDC == 0) { + if (ship_vars->collision_damage_cooldown == 0) { hero.ship_hp = hero.ship_hp - fighter_jet_collision_damage_gp; if (hero.ship_hp < 0.0f) { fast_vec_sub(side, collision_result + 0x50, collision_result + 0x60); @@ -1554,7 +1554,7 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v 0); ship_moby->state = FIGHTER_JET_STATE_DEATH_RESPAWN_DELAY; } - ship_vars->iDC = l17_fighter_jet_collision_damage_cooldown_reload; + ship_vars->collision_damage_cooldown = l17_fighter_jet_collision_damage_cooldown_reload; } } else { *(int *)&hero.ship_hp = 0; From 4b92c34650c0eb14991d21d5ed67f6e088c92136 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:19:29 +0000 Subject: [PATCH 707/758] decomp: clarify names in nanotech_ball_update h54 -> collection_frames_remaining: D_2D9EA0 short h54 receives the frame-scaled nanotech_ball_collection_lifetime_frames_gp result at retail 0x002d8f94-0x002d8fd0 on entry to COLLECTING. A full-health invulnerability path raises the remaining timer at 0x002d9404-0x002d9424. Its address data+0x54 is passed to fast_dec_timer_s16 at 0x002d944c-0x002d9450; expiry deletes all slots and retires the instance or retains the basis leader at 0x002d945c-0x002d949c. Thus it is the collection frames remaining, distinct from per-slot timers. h56 -> collection_reward_processed: D_2D9EA0 short h56 is cleared at retail 0x002d8b08. On slot timer expiry, the load/test at 0x002d950c-0x002d9510 gates one-time health increment/clamp (unless health is zero), leader pending_collection_count decrement/clamp, and collection sound at 0x002d9518-0x002d957c. It is set to 1 at 0x002d9580-0x002d9584 so later slot arrivals skip reward processing. Its nonzero test at 0x002d9340-0x002d938c also enables hero-relative position and collection effects. Thus it records that collection reward processing has occurred. --- src/overlays/shared/pickups/nanotech_ball.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/overlays/shared/pickups/nanotech_ball.c b/src/overlays/shared/pickups/nanotech_ball.c index 1f139a7fea..869d60ebd1 100644 --- a/src/overlays/shared/pickups/nanotech_ball.c +++ b/src/overlays/shared/pickups/nanotech_ball.c @@ -173,8 +173,8 @@ typedef struct D_2D9EA0 { V_2D9EA0 v20; Part *slots[8]; int f50; - short h54; - short h56; + short collection_frames_remaining; + short collection_reward_processed; short h58[4]; float f60[4]; char p70[0xC]; @@ -1276,7 +1276,7 @@ void nanotech_ball_update(Moby *moby) { nanotech_ball_state->pos.z += 0.5f; nanotech_ball_state->bob_phase = random_float_between(nanotech_ball_state->bob_offset, 3.1415927f); - nanotech_ball_state->h56 = 0; + nanotech_ball_state->collection_reward_processed = 0; nanotech_ball_state->hA = 0; for (i = 0; i < 4; i++) nanotech_ball_state->f60[i] = (float)random_integer_below(0xFF); @@ -1363,7 +1363,7 @@ void nanotech_ball_update(Moby *moby) { ((D_2D9EA0 *)D_L00_0015F63C->pvars)->pending_collection_count++; if (nanotech_ball_invulnerability_pickup_enabled != 0) player->invulnerable_frames = func_001F9850_2D9EA0(0x258); - nanotech_ball_state->h54 = + nanotech_ball_state->collection_frames_remaining = func_001F9850_2D9EA0(nanotech_ball_collection_lifetime_frames_gp); func_001F9C30_2D9EA0(&collection_target_or_end_tangent, &player->gravity_dir, @@ -1477,7 +1477,7 @@ void nanotech_ball_update(Moby *moby) { case NANOTECH_BALL_STATE_COLLECTING: if (D_L00_0015F63C == moby) update_nanotech_ball_slot_offsets(); - if (nanotech_ball_state->h56 != 0) { + if (nanotech_ball_state->collection_reward_processed != 0) { func_001F9C30_2D9EA0( &moby->pos, D_0013F5E0, -nanotech_ball_collection_target_gravity_offset_gp); func_001F9BD8_2D9EA0(&moby->pos, D_0013F5E0 - 0x210, &moby->pos); @@ -1494,15 +1494,15 @@ void nanotech_ball_update(Moby *moby) { nanotech_ball_invulnerability_pickup_enabled != 0) { int duration = func_001F9850_2D9EA0( nanotech_ball_full_health_invulnerable_collection_min_frames_gp); - if (nanotech_ball_state->h54 < duration) { + if (nanotech_ball_state->collection_frames_remaining < duration) { int i; - nanotech_ball_state->h54 = duration; + nanotech_ball_state->collection_frames_remaining = duration; for (i = 0; i < 4; i++) nanotech_ball_state->h58[i]++; } } } - if (fast_dec_timer_s16(&nanotech_ball_state->h54)) { + if (fast_dec_timer_s16(&nanotech_ball_state->collection_frames_remaining)) { int i; for (i = 0; i < 8; i++) { if (nanotech_ball_state->slots[i] != 0) { @@ -1526,7 +1526,7 @@ void nanotech_ball_update(Moby *moby) { continue; ext = (Ext *)(part + 1); if (fast_dec_timer_s16(&ext->h1E)) { - if (nanotech_ball_state->h56 == 0) { + if (nanotech_ball_state->collection_reward_processed == 0) { Hero *player = &hero; int max_hp = hero_max_health; if (player->vehicle_mode == HERO_VEHICLE_MODE_CLANK) @@ -1542,7 +1542,7 @@ void nanotech_ball_update(Moby *moby) { leader_data->pending_collection_count = 0; } func_L00_0028EF68_2D9EA0(1, 0, moby, 0x1F5); - nanotech_ball_state->h56 = 1; + nanotech_ball_state->collection_reward_processed = 1; } func_L00_002688A8_2D9EA0(part); nanotech_ball_state->slots[i] = 0; From 2cd39078479297a6eb521d732b8aa924117d1763 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:22:32 +0000 Subject: [PATCH 708/758] decomp: clarify names in update_hero_attachment v150 -> position_anchor_inhibit: Retail 0x00234108..0x00234120 computes fast_vec_length of hero+0x150 and compares it to zero. A nonzero length branches to 0x00234144, where only states 0x18/0x19 can reach position-anchor setup at 0x00234158; otherwise 0x00234304..0x00234318 clears attachment_anchor_flags bit 1. With zero length and the remaining gates satisfied, 0x00234254..0x00234258 saves primary_attachment_local_position and 0x002342f4..0x00234300 sets bit 1. Authoritative C expresses the same gate as fast_vec_length(&v150) == 0.0f. This proves a bounded position-anchor inhibit role without asserting velocity or other physical identity. --- 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 480c5409ed..1d7f025909 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1398,7 +1398,7 @@ typedef struct Hero_234800 { char pA0[0x5C]; float attachment_yaw_delta; char p100[0x50]; - Vec_234800 v150; + Vec_234800 position_anchor_inhibit; char p160[0x24]; float rotation_anchor_inhibit; char p188[0x6E]; @@ -1505,7 +1505,7 @@ void update_hero_attachment(void) { return; } if (((((Hero_234800 *)hero_233f80)->i208C == 0 || ((Hero_234800 *)hero_233f80)->i208C == 12) && - fast_vec_length(&((Hero_234800 *)hero_233f80)->v150) == 0.0f && + fast_vec_length(&((Hero_234800 *)hero_233f80)->position_anchor_inhibit) == 0.0f && ((Hero_234800 *)hero_233f80)->h30E == 0 && ((Hero_234800 *)hero_233f80)->path_clearance_position_anchor_inhibit == 0) || (unsigned int)(((Hero_234800 *)hero_233f80)->i2084 - 0x18) < 2) { if ((((Hero_234800 *)hero_233f80)->attachment_anchor_flags ^ 1) & 1) { From 452b97d646d06f35a412e2cab163745c43842f76 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:24:32 +0000 Subject: [PATCH 709/758] decomp: clarify names in jet_fighter_update sE8 -> active_listed_moby_count: Authoritative C select_ship_lock_on_target calls count_active_and_visible_listed_mobys(moby, ship_vars + 0xE8, ship_vars + 0xEA). That supplied same-file implementation zeroes the first unsigned-short output and increments it once per list entry whose moby state byte +0x20 is active, using the list selected by pvars+0x108. Thus ShipVars_2838 short sE8 is the active listed-moby count. Assigned retail initializes +0xE8 at 0031366c, reads it for the 5-count activation threshold at 00313a38-00313a40, and tests it for delayed exit at 00313a78-00313a90; original Ghidra agrees. sEA -> visible_listed_moby_count: Authoritative C select_ship_lock_on_target passes pvars+0xEA as the third output to count_active_and_visible_listed_mobys, alongside +0xE8 as the active count. The supplied same-file counting implementation zeroes this unsigned-short output and increments it only for active listed mobys with byte +0x31 (Moby visible) nonzero. This proves ShipVars_2838 short sEA counts the visible subset of active listed mobys. Assigned retail 00313a2c-00313a30 loads +0xEA and skips the activation attempt when zero; original Ghidra shows the same gate. --- src/overlays/l11/mobys/jet_fighter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l11/mobys/jet_fighter.c b/src/overlays/l11/mobys/jet_fighter.c index 810f929b38..d2f0419d08 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -731,8 +731,8 @@ typedef struct { float fD0, fD4, fD8; int collision_damage_cooldown_timer_frames; char padE0[8]; - short sE8; - short sEA; + short active_listed_moby_count; + short visible_listed_moby_count; char padEC[4]; float shown_hp; int hp_bar_fill; @@ -1356,7 +1356,7 @@ void jet_fighter_update(struct Moby *moby) { } hp_bar_saved = 1; ship_vars->respawn_or_exit_delay_timer_frames = 1; - ship_vars->sE8 = 1; + ship_vars->active_listed_moby_count = 1; ship_vars->fade = 0.0f; if (moby->mission != 0xFF && D_0014C050[current_level_index][moby->mission] == 0xFF) { moby->state = JET_FIGHTER_STATE_INACTIVE; @@ -1455,13 +1455,13 @@ void jet_fighter_update(struct Moby *moby) { update_player_ship_flight(moby, ship_vars); { int alive = count_listed_blarg_ships_in_state_5(ship_vars->blarg_ship_list_index); - if (ship_vars->sEA != 0 && alive < 5 - ship_vars->sE8 && + if (ship_vars->visible_listed_moby_count != 0 && alive < 5 - ship_vars->active_listed_moby_count && fast_dec_timer(&ship_vars->blarg_ship_activation_timer_frames) && activate_listed_blarg_ship(ship_vars->blarg_ship_list_index)) { ship_vars->blarg_ship_activation_timer_frames = scale_game_frames(0xF0); } } - if (ship_vars->sE8 <= 0) { + if (ship_vars->active_listed_moby_count <= 0) { ship_vars->respawn_or_exit_delay_timer_frames = l11_jet_fighter_exit_delay_frames; moby->state = JET_FIGHTER_STATE_DELAYED_EXIT; } From b8a777032dc6a33528171e6bff8b1727edbb79c8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:32:09 +0000 Subject: [PATCH 710/758] decomp: clarify names in apply_hero_selected_flags_and_state_transitions h12E0 -> pending_flag_selector: h12E0 -> pending_flag_selector. The signed short is snapshotted into saved_flag_selector before the 16-byte clear (retail lh s2 at 0x0020b994), reset to the -1 empty sentinel (sh at 0x0020b9a0), and the saved -1 causes return at 0x0020b9ac. Its consumed value selects flag writes: 3 selects jump_or_respawn_wait_transition_selected at 0x0020bab4-0x0020bac4, 11 selects respawn_wait_transition_selected at 0x0020bb30-0x0020bb40, and 4 selects idle_exit_transition_selected at 0x0020bb60-0x0020bb70. Original Ghidra sRam00140630/sVar1 and authoritative C agree. The name describes a pending selector consumed by this function, without asserting a gameplay material domain. --- 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 dbae41dd8d..e15912df9b 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -3401,7 +3401,7 @@ typedef struct { u8 pad420[0xCC0]; u8 *slot_one_item_moby; u8 pad10E4[0x1FC]; - s16 h12E0; + s16 pending_flag_selector; u8 b12E2; u8 idle_exit_transition_selected; u8 height_difference_selected; @@ -3433,12 +3433,12 @@ int FUN_001f0b58_20b960(void) __asm__("FUN_001f0b58"); #define P D_0013F350_20b960 void apply_hero_selected_flags_and_state_transitions(void) { u8 save = P.b12ED; - s16 saved_flag_selector = P.h12E0; + s16 saved_flag_selector = P.pending_flag_selector; f32 height_difference; int target_state; - fast_mem_zero16(&P.h12E0, 0x10); + fast_mem_zero16(&P.pending_flag_selector, 0x10); P.b12ED = save; - P.h12E0 = -1; + P.pending_flag_selector = -1; P.selected_height_difference_in_band = 0; P.h308 = 0; if (saved_flag_selector == -1) From 182cd373903612f7228a0733d832bafc412120a1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:34:08 +0000 Subject: [PATCH 711/758] decomp: clarify names in update_hero_attachment h30E -> attachment_residual_decay_scale: Retail 0x002340a4..0x002340b0 loads signed hero+0x30E and converts it to f22; source assigns that field to amt. At 0x002343d0..0x002343e8 nonzero f22 selects saved_attachment_displacement. At 0x0023441c..0x00234424 and 0x00234438..0x00234440 it multiplies the approach-to-zero steps for saved displacement Z and XY magnitude by f22. The resulting components form attachment_motion_scratch at 0x00234444..0x0023445c and are added to hero motion at 0x00234754..0x00234764. Thus its numerical use is an attachment residual decay scale; no timer identity or units are inferred. --- src/overlays/shared/hero/set_hero_animation.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index 1d7f025909..3bdba83bd4 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1406,7 +1406,7 @@ typedef struct Hero_234800 { char p1F8[0x104]; void *p2FC; char p300[0xE]; - short h30E; + short attachment_residual_decay_scale; Vec_234800 primary_attachment_local_position; Vec_234800 attachment_local_rotation; Vec_234800 secondary_attachment_local_position; @@ -1467,7 +1467,7 @@ void update_hero_attachment(void) { mode = HERO_ATTACHMENT_MODE_INACTIVE; amt = 0.0f; saved_hero_yaw = ((Hero_234800 *)hero_233f80)->v90.z; - if (((Hero_234800 *)hero_233f80)->h30E == 0) { + if (((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale == 0) { if (((Hero_234800 *)hero_233f80)->p2FC != 0) { mode = HERO_ATTACHMENT_MODE_PROBE; if (((Hero_234800 *)hero_233f80)->attachment_reference_object != ((Hero_234800 *)hero_233f80)->p2FC) { @@ -1489,9 +1489,9 @@ void update_hero_attachment(void) { mode = HERO_ATTACHMENT_MODE_PROBE; } else if (((Hero_234800 *)hero_233f80)->attachment_reference_object != 0) { mode = HERO_ATTACHMENT_MODE_PROBE; - convert_integer_to_float(scale_game_frames(120) - ((Hero_234800 *)hero_233f80)->h30E); + convert_integer_to_float(scale_game_frames(120) - ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale); scale_game_frames_v_233f80(120); - amt = ((Hero_234800 *)hero_233f80)->h30E; + amt = ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale; } else { ((Hero_234800 *)hero_233f80)->attachment_reference_object = 0; ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; @@ -1506,7 +1506,7 @@ void update_hero_attachment(void) { } if (((((Hero_234800 *)hero_233f80)->i208C == 0 || ((Hero_234800 *)hero_233f80)->i208C == 12) && fast_vec_length(&((Hero_234800 *)hero_233f80)->position_anchor_inhibit) == 0.0f && - ((Hero_234800 *)hero_233f80)->h30E == 0 && ((Hero_234800 *)hero_233f80)->path_clearance_position_anchor_inhibit == 0) || + ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale == 0 && ((Hero_234800 *)hero_233f80)->path_clearance_position_anchor_inhibit == 0) || (unsigned int)(((Hero_234800 *)hero_233f80)->i2084 - 0x18) < 2) { if ((((Hero_234800 *)hero_233f80)->attachment_anchor_flags ^ 1) & 1) { if ((unsigned int)(((Hero_234800 *)hero_233f80)->i2084 - 0x18) < 2) { @@ -1569,7 +1569,7 @@ void update_hero_attachment(void) { ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; } if ((((Hero_234800 *)hero_233f80)->i208C == 0 || ((Hero_234800 *)hero_233f80)->i208C == 12) && - ((Hero_234800 *)hero_233f80)->rotation_anchor_inhibit == 0.0f && ((Hero_234800 *)hero_233f80)->h30E == 0) { + ((Hero_234800 *)hero_233f80)->rotation_anchor_inhibit == 0.0f && ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale == 0) { if (!(((Hero_234800 *)hero_233f80)->attachment_anchor_flags & 2)) { convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, ((Hero_234800 *)hero_233f80)->attachment_reference_object, From e02f9240386c741e295defe1cbea1ab77584237b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:36:20 +0000 Subject: [PATCH 712/758] decomp: clarify names in blarg_ship_update bB0 -> mission_index: Assigned 002e4bd4 loads ship+0xb0, then 002e4bec-002e4bfc indexes 0014c050 with current_level*16 plus this byte. Checked direct helper 00249ee8 loads the same byte at 00249fd0, adds 2 and records it by save ID at 00249fdc; 00249fe0-0024a014 uses it for 0015fc88 and the same level-indexed 0014c050 table. This is the exact MOBY(moby)->mission + 2 and mission lookup pipeline in the supplied evaluate_moby_animation_pose source context, establishing the mission index rather than an arbitrary visited-table subscript. hA8 -> maya_instance_id: Retail 002e4aec loads unsigned ship+0xa8 into DebugPrint argument a2 before 002e4af0; the supplied error string at 001dd390 labels this second conversion 'maya instance %d'. Authoritative C passes ship->hA8 as that second value, proving the Maya instance identifier. sA6 -> moby_class_id: Retail 002e4ae8 loads signed ship+0xa6 into DebugPrint argument a1; 002e4ae4/002e4af4 selects the supplied string at 001dd390, whose first conversion is 'Moby class %d'. Authoritative C passes ship->sA6 in precisely that first conversion, proving the moby class identifier. vF0 -> target_aim_position: In firing state 4, retail 002e5020-002e503c copies private+0xf0 into stack+0x20 and passes that copy as the collision-line endpoint from ship position. 002e5140-002e515c uses its XY distance and Z minus ship Z to compute aim elevation. 002e52a8-002e52d0 subtracts the muzzle from this same copied position and normalizes rocket velocity passed to spawn_blarg_ship_rocket at 002e5330. Cooldown repeats the copy and aiming chain at 002e5404-002e5420 and 002e5524-002e5574. These consumers prove a stored target aim position; no producer or prediction semantics are assumed. --- src/overlays/l10/mobys/blarg_ship.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l10/mobys/blarg_ship.c b/src/overlays/l10/mobys/blarg_ship.c index 5807ad2180..80fea310f9 100644 --- a/src/overlays/l10/mobys/blarg_ship.c +++ b/src/overlays/l10/mobys/blarg_ship.c @@ -93,10 +93,10 @@ typedef struct Ship_5E48 { char p80[0x14]; int i94; char p98[0xE]; - short sA6; - unsigned short hA8; + short moby_class_id; + unsigned short maya_instance_id; char pAA[6]; - unsigned char bB0; + unsigned char mission_index; char pB1[0xB]; unsigned char bBC; } Ship_5E48; @@ -110,7 +110,7 @@ typedef struct ShipD_5E48 { unsigned char b29; char p2A[0x16]; char a40[0xB0]; - AlignedVec4f vF0; + AlignedVec4f target_aim_position; char p100[0x10]; Ship_5E48 *tgt; int targeting_status; @@ -209,7 +209,7 @@ void blarg_ship_update(Ship_5E48 *ship) { FUN_L00_00263ac8(2.5f, (int)ship, 2, d->a1D0); if (d->entry_path_index == -1) { - DebugPrint(blarg_ship_missing_path_error_format, ship->sA6, ship->hA8); + DebugPrint(blarg_ship_missing_path_error_format, ship->moby_class_id, ship->maya_instance_id); goto del; } FUN_L10_002e5968_c((char *)ship); @@ -230,7 +230,7 @@ void blarg_ship_update(Ship_5E48 *ship) { if (ship->requested_animation_sequence != 0) blend_moby_animation(ship, 0, 0, 0); ship->state = BLARG_SHIP_STATE_WAIT_FOR_TARGET_IN_VOLUME; - if (visited52[ship->bB0 + (D_0015ED84 << 4)] != 0xFF) + if (visited52[ship->mission_index + (D_0015ED84 << 4)] != 0xFF) break; goto del; case BLARG_SHIP_STATE_WAIT_FOR_TARGET_IN_VOLUME: @@ -293,7 +293,7 @@ void blarg_ship_update(Ship_5E48 *ship) { } *(u128_2E52B0 *)&A = *(u128_2E52B0 *)&tgt->pos; if ((&hero)->vehicle_mode != 1) { - *(u128_2E52B0 *)&A = *(u128_2E52B0 *)&d->vF0; + *(u128_2E52B0 *)&A = *(u128_2E52B0 *)&d->target_aim_position; collision_line(&ship->pos, &A, 0, ship, 0); } else { if ((Ship_5E48 *)(&hero)->moby == tgt) { @@ -358,7 +358,7 @@ void blarg_ship_update(Ship_5E48 *ship) { } *(u128_2E52B0 *)&A = *(u128_2E52B0 *)&tgt->pos; if ((&hero)->vehicle_mode != 1) { - *(u128_2E52B0 *)&A = *(u128_2E52B0 *)&d->vF0; + *(u128_2E52B0 *)&A = *(u128_2E52B0 *)&d->target_aim_position; collision_line(&ship->pos, &A, 0, ship, 0); } else { if ((Ship_5E48 *)(&hero)->moby == tgt) { From 42e0283bfd4edb35a87f3def7eedf4c2391261e9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:36:24 +0000 Subject: [PATCH 713/758] decomp: clarify names in update_planetbuster_maximus_guns h90 -> yaw_sweep_active: Gun short h90 is read at retail 00305640..00305644 to select initial direct yaw approach versus the sweep spring branch. When step_angle_toward_target reaches the 0.08726646 threshold, 003056c0 stores 1 and 003056cc..003056dc initializes yaw_sweep_direction. The nonzero branch at 003056e0..00305798 repeatedly targets the signed yaw offset and reverses it at endpoints. Authoritative C and original Ghidra agree; this is the sweep-active state, not a timer. h98 -> firing_inhibit_timer: Gun short h98 is passed to countdown helper 00221e68 at 00305898..0030589c, then read at 003058b0. Any remaining nonzero value branches past the entire firing path at 003058b4; zero permits alignment gating, voice countdowns and projectile spawning. Checked helper evidence 4c747102849642cc9880225d13442f7b proves decrement/clamp-to-zero semantics. C and original Ghidra establish a firing-inhibit countdown, although its initialization or reset is not shown. h9A -> firing_point_selector: Gun short h9A is loaded at 00305960, incremented by 1 in 0030596c, and supplied to moby_point_position with gun_moby and the shot-position buffer at 00305964..00305968. Retail 00305970..00305984 then replaces it with the boolean old value == 0. The resulting position buffer becomes projectile origin at 00305ad8..00305ae0. Source and original Ghidra prove alternating firing-point selection, without establishing left/right point identity. h9C -> shot_cooldown_timer: Gun short h9C is ticked at 003058a8 and again at 00305950; a zero helper return at 00305958 skips shot creation. Checked helper 00221e68 (request 4c747102849642cc9880225d13442f7b) returns 0 while positive remains, 2 on expiration, 1 when already zero. After the projectile attempt, 00305bdc..00305c20 resets h9C to scaled 7 plus a clamped shared-counter contribution. C and original Ghidra prove the repeat-shot cooldown; both conditional ticks must remain. h9E -> aim_alignment_fire_holdoff_timer: Retail 003058cc..003058ec compares selected gun-entry yaw against hero-relative yaw. When the difference is below 0.06981317 radians, 003058f4..003058fc refreshes Gun short h9E to scaled 20. 00305900..00305908 ticks h9E and skips firing while the helper returns nonzero, i.e. until it expires or is already zero. Checked helper 00221e68 request 4c747102849642cc9880225d13442f7b proves those return semantics. C and original Ghidra establish a fire holdoff refreshed by aim alignment. w84 -> damage_cooldown_timer: Gun int w84 is ticked via helper 00221e38 at 00305c48..00305c4c; 00305c50 skips hit queries and damage while the helper returns 0. Checked request 5da73d1c138f4e20b38afc3dfccfcd64 proves return 0 while positive remains, 2 at expiration and 1 already zero. After a qualifying hit with the combat flag enabled, 00305d10..00305d30 resets w84 to scaled 20 immediately before subtracting damage from f80. C and original Ghidra prove a cooldown between accepted damage events. --- .../l12/mobys/planetbuster_maximus_part.c | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/overlays/l12/mobys/planetbuster_maximus_part.c b/src/overlays/l12/mobys/planetbuster_maximus_part.c index fe52c5be2a..6693a52fe7 100644 --- a/src/overlays/l12/mobys/planetbuster_maximus_part.c +++ b/src/overlays/l12/mobys/planetbuster_maximus_part.c @@ -49,17 +49,17 @@ typedef struct { float f60; char pad64[0x1C]; float f80; - int w84; + int damage_cooldown_timer; char pad88[4]; float yaw_sweep_direction; - short h90; + short yaw_sweep_active; char firing_voice_window_timer; char firing_voice_repeat_timer; char pad94[4]; - short h98; - short h9A; - short h9C; - short h9E; + short firing_inhibit_timer; + short firing_point_selector; + short shot_cooldown_timer; + short aim_alignment_fire_holdoff_timer; } Gun; extern char D_L12_00167240[]; @@ -135,14 +135,14 @@ void update_planetbuster_maximus_guns(char *moby) { MOBY(gun_moby)->pos.y), -1.5707964f), MOBY(moby)->rot.z); - if (md->h90 == 0) { + if (md->yaw_sweep_active == 0) { if (step_angle_toward_target((float *)(ent + 0x18), yaw, 0, D_0015ED6C_gp * 0.5235988f + D_0015ED6C_gp * 0.17453292f * (float)i) < 0.08726646f) { - md->h90 = 1; + md->yaw_sweep_active = 1; md->yaw_sweep_direction = 1.0f; if (i & 1) { md->yaw_sweep_direction = -1.0f; @@ -175,27 +175,27 @@ void update_planetbuster_maximus_guns(char *moby) { l12_planetbuster_maximus_proximity_fire_counter = 0; } if ((D_L12_00161F00_gp != 0 || flag) && md->f80 > 0.0f) { - fast_dec_timer_s16(&md->h98); - fast_dec_timer_s16(&md->h9C); - if (md->h98 == 0) { + fast_dec_timer_s16(&md->firing_inhibit_timer); + fast_dec_timer_s16(&md->shot_cooldown_timer); + if (md->firing_inhibit_timer == 0) { if (fast_difference_between_rotations( *(float *)(owner_data + gun_entry_index * 0x30 + 0x18), yaw) < 0.06981317f) { - md->h9E = scale_game_frames(0x14); + md->aim_alignment_fire_holdoff_timer = scale_game_frames(0x14); } - if (fast_dec_timer_s16(&md->h9E) == 0) { + if (fast_dec_timer_s16(&md->aim_alignment_fire_holdoff_timer) == 0) { if (FUN_L00_001fefc8(&md->firing_voice_window_timer) == 0) { if (FUN_L00_001fefc8(&md->firing_voice_repeat_timer) != 0) { allocate_voice_for_target_entry(0, 0, gun_moby); md->firing_voice_repeat_timer = scale_game_frames(9); } } - if (fast_dec_timer_s16(&md->h9C) != 0) { + if (fast_dec_timer_s16(&md->shot_cooldown_timer) != 0) { float rz; float pitch; int n; - moby_point_position(gun_moby, md->h9A + 1, position_buffer); - md->h9A = md->h9A == 0; + moby_point_position(gun_moby, md->firing_point_selector + 1, position_buffer); + md->firing_point_selector = md->firing_point_selector == 0; rz = fast_add_rotations(MOBY(gun_moby)->rot.z, 1.5707964f); if (D_L12_00161F00_gp != 0) { qcopy(aim_target_position, D_L12_00167240); @@ -251,7 +251,7 @@ void update_planetbuster_maximus_guns(char *moby) { 1); } } - md->h9C = scale_game_frames(7); + md->shot_cooldown_timer = scale_game_frames(7); n = D_L12_00161F20; if (scale_game_frames(0xB) < n) { n = scale_game_frames(0xB); @@ -259,13 +259,13 @@ void update_planetbuster_maximus_guns(char *moby) { if (n < 0) { n = 0; } - md->h9C += n; + md->shot_cooldown_timer += n; } } } } if (D_L12_00161F04_gp == 0 && md->f80 > 0.0f) { - if (fast_dec_timer(&md->w84) != 0) { + if (fast_dec_timer(&md->damage_cooldown_timer) != 0) { float dmg = 1.0f; char *r = find_moby_hit(gun_moby, 0x50000, 0); if (r == 0) { @@ -292,7 +292,7 @@ void update_planetbuster_maximus_guns(char *moby) { l12_planetbuster_maximus_proximity_fire_counter = scale_game_frames(0xFA0); goto done; } - md->w84 = scale_game_frames(0x14); + md->damage_cooldown_timer = scale_game_frames(0x14); md->f80 -= dmg; if (md->f80 <= 0.0f) { int j; From d5ff8b2fad77f5f70cb53676d378a4e71a068b9f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:36:27 +0000 Subject: [PATCH 714/758] decomp: clarify names in fighter_jet_update bB0 -> persistent_state_index: ShipMoby byte +0xb0 selects persistent state rather than a state ID: retail 0x002ed470-0x002ed494 rejects sentinel 0xff and indexes 0x0014c050 + current_level_index*16 + this byte. If the selected byte is 0xff, 0x002ed4a0-0x002ed4a4 enters FADE_THEN_REMOVE. On victory completion 0x002edcf4-0x002edd08 passes the same field to 0x0024aa58. Checked helper 0x0024aa58-0x0024aa80 rejects index 0xff and writes 0xff to exactly 0x0014c050 + current_level_index*16 + argument (0x0024aa60/0x0024aa6c-0x0024aa78), establishing the persistent state table index. Supplied original Ghidra initialization/victory branches and authoritative C visited52/jet_clear_persistent uses agree. Evidence request 8a598e5d096e4791b495286c9c1ce062, report SHA-256 498752dec3e1ade6af970813fcc1a79e50cf68af251345e54d3fa127320f3253. --- src/overlays/l17/mobys/fighter_jet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l17/mobys/fighter_jet.c b/src/overlays/l17/mobys/fighter_jet.c index d1f6e0d868..d848764a45 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -1633,7 +1633,7 @@ typedef struct { char padA5; unsigned short oclass; char padA8[8]; - unsigned char bB0; + unsigned char persistent_state_index; } ShipMoby; typedef struct { @@ -1867,7 +1867,7 @@ void fighter_jet_update(ShipMoby *moby) { hp_bar_saved = 1; ship_vars->timerF8 = 1; ship_vars->iE8 = 1; - if (moby->bB0 != 0xFF && visited52[moby->bB0 + current_level_index * 16] == 0xFF) { + if (moby->persistent_state_index != 0xFF && visited52[moby->persistent_state_index + current_level_index * 16] == 0xFF) { moby->state = FIGHTER_JET_STATE_FADE_THEN_REMOVE; } if (ship_vars->i11C > 0) { @@ -2088,8 +2088,8 @@ void fighter_jet_update(ShipMoby *moby) { p = D_L17_001600EC + (ship_vars->exit_path << 7); set_race_camera(p + 0x30, p + 0x70, 0, 1); } - if (moby->bB0 != 0xFF) { - jet_clear_persistent(moby->bB0); + if (moby->persistent_state_index != 0xFF) { + jet_clear_persistent(moby->persistent_state_index); } idx = ship_vars->voice; if (idx != -1) { From 5f8e25f3a8b53d6dbc16a3d677a841ca3489cb9e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:38:49 +0000 Subject: [PATCH 715/758] decomp: clarify names in bomb_update h54 -> fuse_timer: BombData's signed short at +0x54 is the launch countdown: authoritative launch_bomb initializes it to scale_game_frames(300). Retail bomb_update 0x002ae444-0x002ae460 passes s6+0x54 to fast_dec_timer_s16 and sets bomb_moby+0xbc to trigger the explosion when it expires. Reads at 0x002ae108-0x002ae128 and 0x002ae374-0x002ae3a4 compare remaining time with scaled 300 minus 10 to gate early owner collisions. Original Ghidra reads the same +0x54 short and follows the expiry into blast handling. h68 -> splash_frame_counter: Retail 0x002ae1c0-0x002ae220 tests BombData+0x68 zero before a descending collision with collision_hit_material()==0, calls pool_splash, and stores one at +0x68. Source and original Ghidra agree that this enters the post-splash motion branch. On subsequent thrown updates 0x002ae18c-0x002ae19c increments the nonzero short; 0x002ae024-0x002ae07c uses it to select reduced gravity. Comparisons with scaled 20 at 0x002ae4b8-0x002ae4d0 and 0x002aec90-0x002aeca0 choose blast versus splash particle behavior. The name describes a counter starting at one on splash, not an exact elapsed-time measurement. h6a -> color_animation_counter: Retail 0x002add34-0x002add6c decrements BombData+0x6a and divides it by scaled 30; 0x002add70-0x002addd4 uses that fraction to interpolate and pack bomb RGB. In the held/non-blast branch, 0x002af28c-0x002af2f4 increments the same short and feeds counter*0.068 through normalized-angle sine to produce grayscale pulsing. Authoritative spawn_bomb initializes +0x6a to zero and launch_bomb resets it to scaled 30. Original Ghidra corroborates both incrementing pulse and decrementing color-transition uses, so a general color animation counter covers both roles. --- src/overlays/shared/weapons/bomb_glove_bomb.c | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/overlays/shared/weapons/bomb_glove_bomb.c b/src/overlays/shared/weapons/bomb_glove_bomb.c index 02cd26685b..0ab46dc8aa 100644 --- a/src/overlays/shared/weapons/bomb_glove_bomb.c +++ b/src/overlays/shared/weapons/bomb_glove_bomb.c @@ -109,11 +109,11 @@ typedef struct { Vec_2adb30 v; char pad10[0x40]; M910 *owner; - short h54; + short fuse_timer; short h56; char pad58[0x10]; - short h68; - short h6a; + short splash_frame_counter; + short color_animation_counter; } BombData; struct BombMoby { @@ -1153,13 +1153,13 @@ void bomb_update(BombMoby *bomb_moby) { c.f[1] = 128.0f; c.f[2] = 128.0f; c.f[3] = 255.0f; - fast_dec_timer_s16(&d->h6a); - t = convert_integer_to_float(d->h6a) / convert_integer_to_float(FUN_001f96f8_2adb30(0x1E)); + fast_dec_timer_s16(&d->color_animation_counter); + t = convert_integer_to_float(d->color_animation_counter) / convert_integer_to_float(FUN_001f96f8_2adb30(0x1E)); cr = truncate_float_to_s32((c.f[0] - 255.0f) * t + 255.0f); cg = truncate_float_to_s32((c.f[1] - 64.0f) * t + 64.0f); cb = truncate_float_to_s32((c.f[2] - 64.0f) * t + 64.0f); bomb_moby->color = (cb << 16) | (0xFF << 24) | (cg << 8) | cr; - if (d->h68 == 0) { + if (d->splash_frame_counter == 0) { if ((D_L00_0015F5CC_2adb30 & 7) == 0) { int i; for (i = 0; i < *(int *)&bomb_sparks_per_emission; i++) { @@ -1222,7 +1222,7 @@ void bomb_update(BombMoby *bomb_moby) { bomb_moby->ry = fast_add_rotations(bomb_moby->ry, frame_time_macro * 7.8539815f); qcopy_nc(&bomb_pre_motion_position, &bomb_moby->pos); fast_vec_add(&bomb_moby->pos, &bomb_moby->pos, d); - if (d->h68 == 0) { + if (d->splash_frame_counter == 0) { d->v.f[2] -= frame_time_sq_macro * 11.0f; } else { d->v.f[2] -= frame_time_sq_macro * 11.0f / 10.0f; @@ -1235,7 +1235,7 @@ void bomb_update(BombMoby *bomb_moby) { } q.moby = bomb_moby; q.flags = 0x830000; - if (d->h54 < FUN_001f96f8_2adb30(0x12C) - FUN_001f96f8_2adb30(0xA)) { + if (d->fuse_timer < FUN_001f96f8_2adb30(0x12C) - FUN_001f96f8_2adb30(0xA)) { q.flags |= 1; } q.iE0 = 1; @@ -1247,12 +1247,12 @@ void bomb_update(BombMoby *bomb_moby) { q.kind = 2; q.cls = bomb_moby->cls; q.on = 1; - if (d->h68 != 0) { - d->h68++; + if (d->splash_frame_counter != 0) { + d->splash_frame_counter++; } if (collision_line( &bomb_pre_motion_position, &bomb_moby->pos, 0x10, (int)bomb_moby, (int)&q)) { - if (d->h68 == 0 && collision_hit_material() == 0 && d->v.f[2] < 0.0f) { + if (d->splash_frame_counter == 0 && collision_hit_material() == 0 && d->v.f[2] < 0.0f) { Vec_2adb30 p; Vec_2adb30 splash_particle_velocity; char *s; @@ -1264,7 +1264,7 @@ void bomb_update(BombMoby *bomb_moby) { bomb_moby->pos.f[1], 0.5f, -0.35f); - d->h68 = 1; + d->splash_frame_counter = 1; clear_u64_value(d->v.f); d->v.f[2] = frame_time_macro * -1.5f; p.f[0] = bomb_moby->pos.f[0]; @@ -1287,10 +1287,10 @@ void bomb_update(BombMoby *bomb_moby) { spawn_debris_chunk( &p, &splash_particle_velocity, random_integer_below(2), n); } - } else if (d->h68 != 0 || collision_hit_material() != 0) { + } else if (d->splash_frame_counter != 0 || collision_hit_material() != 0) { if (coll_hit.moby != 0) { if ((coll_hit.moby != ((G910 *)&hero)->cam && coll_hit.moby != d->owner) || - d->h54 < FUN_001f96f8_2adb30(0x12C) - FUN_001f96f8_2adb30(0xA)) { + d->fuse_timer < FUN_001f96f8_2adb30(0x12C) - FUN_001f96f8_2adb30(0xA)) { if (((BombMoby *)coll_hit.moby)->f74 != D_L00_00160770 || coll_hit.moby->cls == 0x336) { H910 *h = &coll_hit; @@ -1312,7 +1312,7 @@ void bomb_update(BombMoby *bomb_moby) { FUN_001f9bf8_2adb30(&b, &h->nrm, 1.0f); } } - } else if (fast_dec_timer_s16(&d->h54)) { + } else if (fast_dec_timer_s16(&d->fuse_timer)) { bomb_moby->bBC = 1; fast_vec_add(&blast_velocity, &blast_velocity, d); } @@ -1324,7 +1324,7 @@ void bomb_update(BombMoby *bomb_moby) { FUN_001f9a68_2adb30(&blast_velocity, &blast_velocity, s); FUN_001f9a28_2adb30(&delta, &g_debug_camera, &bomb_moby->pos); camera_distance = FUN_001f9af0_2adb30(&delta); - if (d->h68 < FUN_001f96f8_2adb30(0x14)) { + if (d->splash_frame_counter < FUN_001f96f8_2adb30(0x14)) { int n; n = collect_mobies_in_sphere(&bomb_moby->pos, 0x10, bomb_moby, 0, s * 0.5f); v.q = bomb_moby->pos.q; @@ -1366,7 +1366,7 @@ void bomb_update(BombMoby *bomb_moby) { (unsigned char)item_text_variant[0xA]); } } - if (d->h68 < FUN_001f96f8_2adb30(0x14)) { + if (d->splash_frame_counter < FUN_001f96f8_2adb30(0x14)) { Vec_2adb30 t; float g; int r2; @@ -1514,7 +1514,7 @@ void bomb_update(BombMoby *bomb_moby) { b2, 0x20); } - if (d->h68 >= FUN_001f96f8_2adb30(0x14)) { + if (d->splash_frame_counter >= FUN_001f96f8_2adb30(0x14)) { float h; bomb_moby->pos.f[2] += 1.0f; h = resolve_camera_surface_height((float *)&bomb_moby->pos, &v); @@ -1542,14 +1542,14 @@ void bomb_update(BombMoby *bomb_moby) { } d->v.f[0] = 0.0f; bomb_moby->bBC = 0; - if (d->h68 >= FUN_001f96f8_2adb30(0x14)) { + if (d->splash_frame_counter >= FUN_001f96f8_2adb30(0x14)) { trooper_play_sound(0x16, 0, (int)bomb_moby, 0); } else if ((unsigned char)item_text_variant[0xA] != 0) { allocate_voice_for_target_entry(1, 0, (int)bomb_moby); } else { allocate_voice_for_target_entry(0, 0, (int)bomb_moby); } - if (d->h68 != 0) { + if (d->splash_frame_counter != 0) { float gz; float wz; int cr = 0x60; @@ -1648,8 +1648,8 @@ void bomb_update(BombMoby *bomb_moby) { } } else if (bomb_moby->state != BOMB_STATE_EXPANDING_BLAST) { int v; - d->h6a++; - v = truncate_float_to_s32(FUN_001f9de0_2adb30(normalize_angle((float)d->h6a * 0.068f)) * + d->color_animation_counter++; + v = truncate_float_to_s32(FUN_001f9de0_2adb30(normalize_angle((float)d->color_animation_counter * 0.068f)) * 96.0f) + 0x9F; bomb_moby->color = (v << 16) | (0xFF << 24) | (v << 8) | v; From 79edce3a795d7634e4aad1337442020d197beeef Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:38:53 +0000 Subject: [PATCH 716/758] decomp: clarify names in darter_update vE0 -> dive_attack_aim_position: In DARTER_STATE_DIVE_ATTACK, retail 0x002e0c34-0x002e0c50 computes XY distance from moby+0x10 to pvars+0xe0, subtracts moby Z from pvars+0xe8, then calculates atan(distance_xy, delta_z). Retail 0x002e0c5c-0x002e0c78 negates this angle and passes it to the pitch approach routine with destination moby+0x44 (rot.y). The original Ghidra case 8 and authoritative C both show this AlignedVec4f as the spatial point used to aim the dive attack's pitch; dive_attack_aim_position states that proven consumer role without claiming how the point is generated. --- src/overlays/l10/mobys/darter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/l10/mobys/darter.c b/src/overlays/l10/mobys/darter.c index 6698dee932..bf05b14fc6 100644 --- a/src/overlays/l10/mobys/darter.c +++ b/src/overlays/l10/mobys/darter.c @@ -92,7 +92,7 @@ typedef struct Vars_2e01a8 { unsigned char b5A; char p5B[5]; char a60[0x80]; - AlignedVec4f vE0; + AlignedVec4f dive_attack_aim_position; char pF0[0x10]; Moby *target; int f104; @@ -374,8 +374,8 @@ void darter_update(Moby *moby) { frame_time * 6.2831855f); func_L00_0025CC58_2E0630(&moby->rot.y, 0, - -fast_arc_tan(vector_distance_xy(&moby->pos, &darter_vars->vE0), - darter_vars->vE0.z - moby->pos.z), + -fast_arc_tan(vector_distance_xy(&moby->pos, &darter_vars->dive_attack_aim_position), + darter_vars->dive_attack_aim_position.z - moby->pos.z), frame_time * 12.566371f); if (is_value_within_interpolated_window((char *)moby, 20.0f)) { float one = 1.0f; From d83ac5c56f0a0243737bd85ab900843c1cc0a41b Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:40:45 +0000 Subject: [PATCH 717/758] decomp: clarify names in alien_snapper_update fD8 -> max_ground_drop_distance: Retail initialization 0x002f7eec stores 2.0f at pvars+0xD8 after movement initialization. Calls at 0x002f8588/0x002f88a0 pass pvars+0xD0 as a1 to checked movement helper 0x00267888 (s1=a1 at 0x002678a8). It saves the original Moby.pos at 0x0026790c-0x00267920. At 0x00267c74 it queries ground height; 0x00267c7c-0x00267c94 compares original z minus returned height against relative +8 (pvars+0xD8). Exceeding this limit branches to 0x00267cb4-0x00267cb8, flags failure and restores original position. Thus this member limits permitted ground drop distance. fDC -> max_ground_rise_distance: Retail 0x002f7ef4 initializes pvars+0xDC to 2.0f. The movement calls pass pvars+0xD0 into checked helper 0x00267888, whose s1 holds that record. After the ground-height query at 0x00267c74 and original-z load at 0x00267c7c, instructions 0x00267c9c-0x00267ca4 compute returned ground height minus original z and compare it with relative +0xC (pvars+0xDC). If exceeded, 0x00267cb4-0x00267cb8 sets failure flags and restores original Moby.pos. This establishes the maximum permitted ground rise distance, separately from the drop limit. --- src/overlays/l06/mobys/alien_snapper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l06/mobys/alien_snapper.c b/src/overlays/l06/mobys/alien_snapper.c index 1d29ab8bde..50b72a0413 100644 --- a/src/overlays/l06/mobys/alien_snapper.c +++ b/src/overlays/l06/mobys/alien_snapper.c @@ -105,8 +105,8 @@ typedef struct { u8 padAE[0x22]; s32 movement; /* 0xD0 */ f32 fD4; /* 0xD4 */ - f32 fD8; /* 0xD8 */ - f32 fDC; /* 0xDC */ + f32 max_ground_drop_distance; /* 0xD8 */ + f32 max_ground_rise_distance; /* 0xDC */ u8 padE0[0x14]; f32 speed; /* 0xF4 */ u8 padF8[0x28]; @@ -312,8 +312,8 @@ void alien_snapper_update(Moby *moby) { qcopy(&snapper_behavior->home, &moby->pos); snapper_behavior->reach_distance = random_float_between(0.0f, 1.0f); func_L01_0026E8E0_91A8(&snapper_behavior->movement); - snapper_behavior->fDC = 2.0f; - snapper_behavior->fD8 = 2.0f; + snapper_behavior->max_ground_rise_distance = 2.0f; + snapper_behavior->max_ground_drop_distance = 2.0f; snapper_behavior->movement = truncate_float_to_s32(D_L06_00161EB0 * 1024.0f); snapper_behavior->fD4 = D_L06_00161EB0; snapper_behavior->speed = snapper_behavior->base_speed * frame_time; From 980f6031b7ab0aed85461eb39e1f7ea56cc922c9 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:42:44 +0000 Subject: [PATCH 718/758] decomp: clarify names in load_level_gameplay fA6 -> moby_class_id: Assigned retail 0x002436bc-0x002436d0 compares moby +0xA6 with first_class_ids[content_variant]. Bounded init_moby_instance at 0x0024e944 preserves its class-id argument a1 in s0, uses it to index the class remap at 0x0024e964-0x0024e96c, and stores that same original ID to +0xA6 at 0x0024e9b8. The remapped byte selects the class record at 0x0024ea0c-0x0024ea2c. Thus this short holds the original moby class ID. fB0 -> mission_index: Retail 0x00242898-0x002428a0 reads the file moby mission word into sp+0x24. At 0x00242914-0x00242928 this word indexes mission_state at 0x0015FC88 to select load/bolt policy. Retail 0x00242a94 and 0x00242a9c copy its low byte into moby +0xB0; authoritative C explicitly assigns m->fB0 = mission. This is the moby's stored mission index. fB1 -> bolt_source_slot: Retail 0x002428d0-0x002428e8 calls established find_or_assign_bolt_source_slot with current level and file UID when flags bit 0x10 is set, retaining the returned low byte in a2. Otherwise a2 is 0xFF for nonzero flags or initially 0xFE. The byte is preserved around init_moby_instance at 0x00242a74/0x00242a84 and stored to moby +0xB1 at 0x00242a8c. Source m->fB1 = vis agrees: this field stores the bolt-source slot or sentinel. fB2 -> gameplay_uid: Retail 0x002428ac reads the file moby UID into s3; it indexes l00_moby_load_exclusion_flags_by_uid at 0x002428f8 and supplies UID bitset selection at 0x00242980-0x002429a8. Retail 0x00242a88 stores s3 to moby +0xB2. Later 0x002438e8 reads that signed short to search occlusion mapping UID words at 0x002438f8-0x00243924. Bound C m->fB2 = uid and the mapping loop prove gameplay UID storage. fB4 -> loaded_adjusted_bolt_count: Retail 0x002428b4-0x002428cc reads primary and alternate bolt counts and initializes s5 from the selected primary count. Mission-state branches select alternate s7 via s4 at 0x00242964 and either retain the selection at 0x00242974 or calculate (selected+1)/2 at 0x00242968-0x002429c0. Retail 0x00242a98 stores adjusted s5 at moby +0xB4; bound C assigns adjusted_bolt_count. The field records the adjusted bolt count loaded for this moby; the existing local spelling is preserved. fB6 -> loaded_selected_bolt_count: Retail 0x002428b4-0x002428c0 initializes s4 from primary bolts in s6; the mission branch at 0x00242964 replaces s4 with alternate bolts in s7. This selected count remains separate from adjusted s5, which can be halved at 0x002429b4-0x002429c0. Retail 0x00242aa4 stores s4 to moby +0xB6, agreeing with source m->fB6 = selected_bolt_count. This is the selected bolt count loaded before the separate adjustment; the existing local name is preserved. --- .../shared/world/load_level_gameplay.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/overlays/shared/world/load_level_gameplay.c b/src/overlays/shared/world/load_level_gameplay.c index a49892a9d2..249498624d 100644 --- a/src/overlays/shared/world/load_level_gameplay.c +++ b/src/overlays/shared/world/load_level_gameplay.c @@ -307,13 +307,13 @@ typedef struct MobyInst { char pad7C[4]; int f80; char pad84[0x22]; - short fA6; + short moby_class_id; char padA8[8]; - unsigned char fB0; - unsigned char fB1; - short fB2; - short fB4; - short fB6; + unsigned char mission_index; + unsigned char bolt_source_slot; + short gameplay_uid; + short loaded_adjusted_bolt_count; + short loaded_selected_bolt_count; char padB8[0x48]; } MobyInst; @@ -1023,11 +1023,11 @@ char *load_level_gameplay(int skip_gameplay_read) { m = moby_table + count; init_moby_instance(m, *(int *)p); p += 4; - m->fB1 = vis; - m->fB2 = uid; - m->fB0 = mission; - m->fB4 = adjusted_bolt_count; - m->fB6 = selected_bolt_count; + m->bolt_source_slot = vis; + m->gameplay_uid = uid; + m->mission_index = mission; + m->loaded_adjusted_bolt_count = adjusted_bolt_count; + m->loaded_selected_bolt_count = selected_bolt_count; if (m->f24 != 0) { m->f2C = m->f24->f24 * *(float *)p; } @@ -1465,7 +1465,7 @@ char *load_level_gameplay(int skip_gameplay_read) { if (D_0015ED84 == 13 && level_render_state.content_variant == 2) { if (D_L00_00160540 != 0) { for (m = moby_table; m->f20 != 0xFF; m++) { - if (m->fA6 == first_class_ids[level_render_state.content_variant]) { + if (m->moby_class_id == first_class_ids[level_render_state.content_variant]) { initialize_moby_state_record((char *)m); set_moby_animation(m, 1, 0); break; @@ -1543,7 +1543,7 @@ char *load_level_gameplay(int skip_gameplay_read) { for (m = moby_table; m->f20 != 0xFF; m++) { if (m->f36 != 0x7F80) { - int uid = m->fB2; + int uid = m->gameplay_uid; int j; k++; From 75fbd8bef194455cc68c95f6a40ad43bff372a94 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:44:44 +0000 Subject: [PATCH 719/758] decomp: clarify names in toxic_crab_update bB0 -> mission_index: Retail 0x002e20c4-0x002e20dc loads dependency moby+0xB0 and indexes visited52 with that byte plus current_level_index*16. Supplied established FUN_L00_00257470 context accesses the corresponding Moby mission field when indexing the same per-level 0x0014C050 table and recording mission+2. This proves a mission index, without asserting a particular mission. fD4 -> movement_size_scale: Retail 0x002e203c/0x002e204c copies established l10_toxic_crab_size_scale into crab data+0xD4, adjacent to the same scale multiplied by 1024 at +0xD0. Movement receives &data+0xD0 at 0x002e28f0. Checked helper request 082761f8923446e4929be534a87e88f5 shows record+4 loaded as float f12 at 0x0024b994 and passed at 0x0024b9a8, proving the movement record's size-scale setting without claiming its exact geometry. fD8 -> maximum_ground_drop: Retail 0x002e2028 initializes crab data+0xD8 to 2.0; movement receives control base data+0xD0. Checked helper request 082761f8923446e4929be534a87e88f5 saves pre-movement position at 0x0024b6c4-0x0024b6d8, probes final ground height at 0x0024ba2c, then 0x0024ba34-0x0024ba4c compares old z minus ground height against control+8 (data+0xD8). Exceeding it restores the saved position at 0x0024ba6c-0x0024ba70, proving the maximum permitted ground drop. fDC -> maximum_ground_rise: Retail 0x002e2020 initializes crab data+0xDC to 0.5; control base data+0xD0 is passed at 0x002e28f0. Checked helper request 082761f8923446e4929be534a87e88f5, 0x0024ba54-0x0024ba64, subtracts saved pre-movement z from the probed ground height and compares that rise with control+0xC (data+0xDC). An excessive rise reaches 0x0024ba6c-0x0024ba70 to restore the old position, establishing the maximum permitted ground rise. fF4 -> horizontal_movement_step_limit: Retail 0x002e2030-0x002e2054 initializes data+0xF4 from movement_speed*frame_time; pursuit 0x002e2520-0x002e2598 approaches it toward full or 0.3-scaled speed per frame, and 0x002e26ac caps it while turning. Movement receives control base data+0xD0 at 0x002e28f0. Checked helper request 082761f8923446e4929be534a87e88f5 loads control+0x24 (data+0xF4) at 0x0024b6a4, scales by call factor, clamps control+0x10 to its positive/negative bounds at 0x0024b714-0x0024b73c, and multiplies that clamped step by heading cos/sin at 0x0024b764-0x0024b788. Thus this field limits the horizontal movement step. iD0 -> movement_size_scale_fixed: Retail 0x002e2008-0x002e2024 multiplies established l10_toxic_crab_size_scale by 1024 and truncates it; 0x002e2048 stores that integer at crab data+0xD0. At 0x002e28f0 the address is the movement-control record argument. Checked helper request 082761f8923446e4929be534a87e88f5, 0x0024b99c-0x0024b9a8, forwards record+0 as integer a2 alongside record+4's float size scale. Name describes its fixed-point size-scale representation, not unproved collision geometry. --- src/overlays/l10/mobys/toxic_crab.c | 76 ++++++++++++++--------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index 430f194620..d36abfeef0 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -114,12 +114,12 @@ typedef struct Crab2E30F8 { float fC0; float fC4; char pC8[8]; - int iD0; - float fD4; - float fD8; - float fDC; + int movement_size_scale_fixed; + float movement_size_scale; + float maximum_ground_drop; + float maximum_ground_rise; char pE0[0x14]; - float fF4; + float horizontal_movement_step_limit; char pF8[0x28]; float tracked_position_x; float tracked_position_y; @@ -176,7 +176,7 @@ typedef struct Moby2E30F8 { char p80[0x26]; unsigned short cls; char pA8[8]; - unsigned char bB0; + unsigned char mission_index; char pB1; unsigned short id; } Moby2E30F8; @@ -285,20 +285,20 @@ void toxic_crab_update(Moby2E30F8 *m) { m->moby_flags |= 0x5000; qcopy(crab_data->home_position_and_heading, m->pos); crab_data->home_position_and_heading[3] = m->heading_radians; - FUN_L01_0026d930((char *)&crab_data->iD0); + FUN_L01_0026d930((char *)&crab_data->movement_size_scale_fixed); { float k = l10_toxic_crab_size_scale * 1024.0f; float initial_movement_step; float initial_movement_size_scale; int r; - crab_data->fDC = 0.5f; - crab_data->fD8 = 2.0f; + crab_data->maximum_ground_rise = 0.5f; + crab_data->maximum_ground_drop = 2.0f; r = truncate_float_to_s32(k); initial_movement_step = crab_data->movement_speed * frame_time; initial_movement_size_scale = l10_toxic_crab_size_scale; - crab_data->iD0 = r; - crab_data->fD4 = initial_movement_size_scale; - crab_data->fF4 = initial_movement_step; + crab_data->movement_size_scale_fixed = r; + crab_data->movement_size_scale = initial_movement_size_scale; + crab_data->horizontal_movement_step_limit = initial_movement_step; } { int k = crab_data->activation_dependency_moby_index; @@ -310,7 +310,7 @@ void toxic_crab_update(Moby2E30F8 *m) { (((short)p->id >> 5) * 4 + (current_level_index << 8))) >> (p->id & 0x1F)) & 1) && - visited52[p->bB0 + (current_level_index << 4)] == 0xFF)) { + visited52[p->mission_index + (current_level_index << 4)] == 0xFF)) { crab_data->activation_dependency_moby_index = -1; } } @@ -370,7 +370,7 @@ void toxic_crab_update(Moby2E30F8 *m) { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; crab_data->pursuit_movement_blocked = 0; qcopy(crab_data->pursuit_progress_sample_position, m->pos); - crab_data->fF4 = 0.0f; + crab_data->horizontal_movement_step_limit = 0.0f; x = crab_data->pursuit_entry_angle_bound_degrees * DEG_TO_RAD; crab_data->pursuit_entry_angle_sample_radians = random_float_between(x, -x); if (m->anim != 3) { @@ -400,7 +400,7 @@ void toxic_crab_update(Moby2E30F8 *m) { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; crab_data->pursuit_movement_blocked = 0; qcopy(crab_data->pursuit_progress_sample_position, m->pos); - crab_data->fF4 = 0.0f; + crab_data->horizontal_movement_step_limit = 0.0f; x = crab_data->pursuit_entry_angle_bound_degrees * DEG_TO_RAD; crab_data->pursuit_entry_angle_sample_radians = random_float_between(x, -x); if (m->anim != 3) { @@ -421,26 +421,26 @@ void toxic_crab_update(Moby2E30F8 *m) { target_distance = fast_vec_dist(m->pos, target_moby + 0x10); if (target_distance > (MOBY(target_moby)->oclass == 0x359 ? 2.0f : 3.57f)) { - approach_value(&crab_data->fF4, crab_data->movement_speed * frame_time, frame_time_sq * 8.0f); + approach_value(&crab_data->horizontal_movement_step_limit, crab_data->movement_speed * frame_time, frame_time_sq * 8.0f); } else { approach_value( - &crab_data->fF4, crab_data->movement_speed * frame_time * 0.3f, frame_time_sq * 20.0f); + &crab_data->horizontal_movement_step_limit, crab_data->movement_speed * frame_time * 0.3f, frame_time_sq * 20.0f); } *(OvlQuad *)pre_movement_position = *(OvlQuad *)m->pos; if (see && absolute_float(target_distance - (MOBY(target_moby)->oclass == 0x359 ? 2.0f : 3.57f)) < 0.35f) { - approach_value(&crab_data->fF4, 0.0f, frame_time_sq * 30.0f); + approach_value(&crab_data->horizontal_movement_step_limit, 0.0f, frame_time_sq * 30.0f); } else if (crab_data->pursuit_movement_blocked != 0) { - approach_value(&crab_data->fF4, 0.0f, frame_time_sq * 10.0f); + approach_value(&crab_data->horizontal_movement_step_limit, 0.0f, frame_time_sq * 10.0f); } ang = fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], MOBY(target_moby)->pos.y - m->pos[1]); diff = fast_difference_between_rotations(ang, m->heading_radians); if (0.87266463f < diff) { float lim = crab_data->movement_speed * frame_time * 0.25f; - if (lim < crab_data->fF4) { - crab_data->fF4 = lim; + if (lim < crab_data->horizontal_movement_step_limit) { + crab_data->horizontal_movement_step_limit = lim; } } if (toxic_crab_pursuit_heading_threshold_degrees_gp * DEG_TO_RAD < diff || @@ -482,17 +482,17 @@ void toxic_crab_update(Moby2E30F8 *m) { } } } - r = move_moby_with_ground_and_collision_checks(m, &crab_data->iD0, dir, out, 1.0f); + r = move_moby_with_ground_and_collision_checks(m, &crab_data->movement_size_scale_fixed, dir, out, 1.0f); m->heading_radians = rot; if (r & 3) { if (vector_distance_xy(m->pos, pre_movement_position) < - crab_data->fF4 * 0.25f) { + crab_data->horizontal_movement_step_limit * 0.25f) { crab_data->pursuit_movement_blocked = 1; } else { crab_data->pursuit_movement_blocked = 0; } if (D_L10_0015F5CC % 7 == 0 && crab_data->behavior_timer_frames == 0) { - if (vector_distance_xy(crab_data->pursuit_progress_sample_position, m->pos) < crab_data->fF4 && + if (vector_distance_xy(crab_data->pursuit_progress_sample_position, m->pos) < crab_data->horizontal_movement_step_limit && diff <= toxic_crab_pursuit_heading_threshold_degrees_gp * DEG_TO_RAD) { m->state = TOXIC_CRAB_STATE_PAUSE_PURSUIT; crab_data->behavior_timer_frames = scale_game_frames(0x3C); @@ -508,7 +508,7 @@ void toxic_crab_update(Moby2E30F8 *m) { crab_data->pursuit_movement_blocked = 0; } if (m->state == TOXIC_CRAB_STATE_PURSUE_TARGET && - fast_dec_timer(&crab_data->behavior_timer_frames) && 0.0f < crab_data->fF4 && + fast_dec_timer(&crab_data->behavior_timer_frames) && 0.0f < crab_data->horizontal_movement_step_limit && crab_data->pursuit_movement_blocked == 0 && m->anim == 1) { blend_moby_animation(m, 3, 0, scale_game_frames(7)); } @@ -554,8 +554,8 @@ void toxic_crab_update(Moby2E30F8 *m) { m->heading_radians); if (0.87266463f < diff) { float lim = crab_data->movement_speed * frame_time * 0.25f; - if (lim < crab_data->fF4) { - crab_data->fF4 = lim; + if (lim < crab_data->horizontal_movement_step_limit) { + crab_data->horizontal_movement_step_limit = lim; } } if (fast_dec_timer(&crab_data->behavior_timer_frames) || @@ -579,7 +579,7 @@ void toxic_crab_update(Moby2E30F8 *m) { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; crab_data->pursuit_movement_blocked = 0; qcopy(crab_data->pursuit_progress_sample_position, m->pos); - crab_data->fF4 = 0.0f; + crab_data->horizontal_movement_step_limit = 0.0f; crab_data->behavior_timer_frames = scale_game_frames(0xF); } } @@ -651,7 +651,7 @@ void toxic_crab_update(Moby2E30F8 *m) { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; crab_data->pursuit_movement_blocked = 0; qcopy(crab_data->pursuit_progress_sample_position, m->pos); - crab_data->fF4 = 0.0f; + crab_data->horizontal_movement_step_limit = 0.0f; if (m->anim != 3) { blend_moby_animation(m, 3, 0, scale_game_frames(7)); } @@ -667,7 +667,7 @@ void toxic_crab_update(Moby2E30F8 *m) { float ang; approach_value( - &crab_data->fF4, crab_data->movement_speed * 3.0f * frame_time, frame_time_sq * 20.0f); + &crab_data->horizontal_movement_step_limit, crab_data->movement_speed * 3.0f * frame_time, frame_time_sq * 20.0f); ang = fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], MOBY(target_moby)->pos.y - m->pos[1]); FUN_L00_00258278( @@ -679,7 +679,7 @@ void toxic_crab_update(Moby2E30F8 *m) { dir[0] = fast_cos(m->heading_radians) * 2.0f; dir[1] = fast_sin(m->heading_radians) * 2.0f; dir[2] = 0.0f; - move_moby_with_ground_and_collision_checks(m, &crab_data->iD0, dir, out, 1.0f); + move_moby_with_ground_and_collision_checks(m, &crab_data->movement_size_scale_fixed, dir, out, 1.0f); m->heading_radians = rot; if (see) { if (fast_dec_timer(&crab_data->behavior_timer_frames) || @@ -687,7 +687,7 @@ void toxic_crab_update(Moby2E30F8 *m) { fast_vec_dist(m->pos, target_moby + 0x10)) { int anim; m->state = TOXIC_CRAB_STATE_MELEE_ATTACK; - crab_data->fF4 = frame_time * 5.0f; + crab_data->horizontal_movement_step_limit = frame_time * 5.0f; anim = 7; if (random_integer_below(100) & 1) { anim = 6; @@ -704,20 +704,20 @@ void toxic_crab_update(Moby2E30F8 *m) { float out[4]; float ang; - approach_value(&crab_data->fF4, crab_data->movement_speed * frame_time, frame_time_sq * 5.0f); + approach_value(&crab_data->horizontal_movement_step_limit, crab_data->movement_speed * frame_time, frame_time_sq * 5.0f); ang = fast_arc_tan(crab_data->home_position_and_heading[0] - m->pos[0], crab_data->home_position_and_heading[1] - m->pos[1]); func_L00_002592B0_b( (char *)m, ang, 0.02f, 0.3f, frame_time * 6.2831855f, &crab_data->heading_turn_step); if (0.87266463f < fast_difference_between_rotations(ang, m->heading_radians)) { float lim = crab_data->movement_speed * frame_time * 0.25f; - if (lim < crab_data->fF4) { - crab_data->fF4 = lim; + if (lim < crab_data->horizontal_movement_step_limit) { + crab_data->horizontal_movement_step_limit = lim; } } dir[0] = fast_cos(m->heading_radians) * 2.0f; dir[1] = fast_sin(m->heading_radians) * 2.0f; dir[2] = 0.0f; - move_moby_with_ground_and_collision_checks(m, &crab_data->iD0, dir, out, 1.0f); + move_moby_with_ground_and_collision_checks(m, &crab_data->movement_size_scale_fixed, dir, out, 1.0f); if (fast_vec_dist(m->pos, crab_data->home_position_and_heading) < 1.0f) { m->state = TOXIC_CRAB_STATE_FACE_TRACKED_POSITION; if (m->anim != 1) { @@ -727,7 +727,7 @@ void toxic_crab_update(Moby2E30F8 *m) { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; crab_data->pursuit_movement_blocked = 0; qcopy(crab_data->pursuit_progress_sample_position, m->pos); - crab_data->fF4 = 0.0f; + crab_data->horizontal_movement_step_limit = 0.0f; if (m->anim != 3) { blend_moby_animation(m, 3, 0, scale_game_frames(7)); } @@ -739,7 +739,7 @@ void toxic_crab_update(Moby2E30F8 *m) { if (step_moby_motion(m, crab_data->knockback_motion_xy) & 0x41) { int anim; m->state = TOXIC_CRAB_STATE_MELEE_ATTACK; - crab_data->fF4 = frame_time * 5.0f; + crab_data->horizontal_movement_step_limit = frame_time * 5.0f; anim = 7; if (random_integer_below(100) & 1) { anim = 6; From de6d1f9d1e3546ab72bd8f22a99425f73e38ba23 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:44:47 +0000 Subject: [PATCH 720/758] decomp: clarify names in walker_update_gait bB0 -> idle_animation_id: Retail 0x002a18e0-0x002a18e4 loads byte +0xB0 for the low-speed stop; 0x002a3520-0x002a3540 passes it as the animation id to blend_moby_animation with entry zero, resets helpers and enters IDLE. C RESET_TO_IDLE uses the same field and path. bB3 -> airborne_wait_animation_id: Retail 0x002a35f0-0x002a35f4 and 0x002a3760-0x002a3784 load +0xB3 after either takeoff sequence finishes, blend that id and enter WAIT_FOR_LANDING/16. At 0x002a384c-0x002a3854 the current animation id is compared with this byte before landing synchronization. bB6 -> gait_phase_mask: Retail 0x002a1834-0x002a1844 stores walker_gait_mask's returned interval bits into +0xB6. Its bits gate walk/run transition at 0x002a1954-0x002a195c and select paired animation phase spans at 0x002a31c8-0x002a323c; landing paths explicitly reset that same mask. bB7 -> gait_state: Retail 0x002a16b4-0x002a16d8 reads +0xB7 to dispatch the outer gait state machine; 0x002a1cec-0x002a1d18 dispatches terrain transitions using the same byte. Stores select established IDLE, WALK, RUN, takeoff and landing states, matching both C switches. fB8 -> ground_probe_correction_angle: Retail 0x002a1d20-0x002a1d60 passes float +0xB8 to fast_sin, multiplies by half the active animation's planar probe span and adds it to ground_height minus probe Z. Repeated terrain branches use this angular correction when choosing uphill/downhill gait transitions; no physical orientation axis is asserted. fC0 -> gait_speed_reference: Retail 0x002a1930-0x002a194c compares both incoming speed and +0xC0 against the walk-to-run threshold; 0x002a31d8-0x002a31f4 does the paired run-to-walk test. RUN clamps this field to its speed threshold at 0x002a3504-0x002a3514, and 0x002a3584-0x002a3594 supplies it as planar travel speed to the checked jump solver. fD8 -> jump_vertical_velocity: Retail 0x002a357c-0x002a359c stores the checked ballistic solver's vertical velocity result into +0xD8, using current position, jump target, planar speed and negative +0xDC. At 0x002a3608-0x002a361c its negative sign gates descending landing preparation; 0x002a3c08 zeroes it on resuming RUN. The supplied time-to-landing quadratic uses this velocity. fDC -> downward_vertical_acceleration: Retail 0x002a357c-0x002a3594 and 0x002a36e4-0x002a36fc negate +0xDC and pass it as vertical_acceleration to the checked ballistic solver. The supplied compute_walker_time_to_landing uses +0xDC as the quadratic acceleration magnitude with +0xD8 and the vertical position gap, consistent with downward acceleration. fE0 -> terrain_transition_height_scale: Retail 0x002a1d4c-0x002a1d60 multiplies +0xE0 by 0.75 and compares it to corrected ground-height difference for uphill selection; 0x002a1d94-0x002a1db0 negates the same scaled field for downhill selection. All terrain-state branches reuse this height scale for their positive and negative transition thresholds. fE4 -> gait_ground_height_reference: Retail 0x002a1ce4-0x002a1d00 stores the ground probe result into +0xE4, repeated by RUN at 0x002a34f8-0x002a3500 and landing recovery at 0x002a3c7c-0x002a3c84. Takeoff entry instead stores current moby Z at 0x002a1ad4-0x002a1adc; IDLE clears it. Thus it holds the gait's ground-height reference, including takeoff height. sEC -> walk_start_counter: Retail 0x002a1774-0x002a17e4 increments signed halfword +0xEC only on IDLE's movement-speed or heading-departure branch and requires it to reach four before starting WALK. Both idle-to-WALK and idle-to-RUN entry clear it at 0x002a184c, matching the C walk-start counter. uEE -> gait_status_flags: Retail 0x002a1ab8-0x002a1ad0 tests bit 1 and replaces it with bit 2 on takeoff entry. 0x002a3598-0x002a35a8 sets bit 4 after ballistic velocity setup; landing synchronization clears it at 0x002a3aa4-0x002a3ab4. Terrain transitions set/clear bit 8. These independent persistent gait status bits establish a flags field without assigning every bit a meaning. --- .../shared/enemies/walker_update_gait.c | 334 +++++++++--------- 1 file changed, 167 insertions(+), 167 deletions(-) diff --git a/src/overlays/shared/enemies/walker_update_gait.c b/src/overlays/shared/enemies/walker_update_gait.c index 15d5c40d1f..553d71adfc 100644 --- a/src/overlays/shared/enemies/walker_update_gait.c +++ b/src/overlays/shared/enemies/walker_update_gait.c @@ -139,25 +139,25 @@ typedef struct WalkData { float f6C; WalkAnim *anim[13]; /* 0x70 */ char padA4[0xC]; - unsigned char bB0; + unsigned char idle_animation_id; unsigned char bB1; unsigned char bB2; - unsigned char bB3; + unsigned char airborne_wait_animation_id; unsigned char bB4; unsigned char bB5; - unsigned char bB6; - unsigned char bB7; - float fB8; + unsigned char gait_phase_mask; + unsigned char gait_state; + float ground_probe_correction_angle; float fBC; - float fC0; + float gait_speed_reference; char padC4[0x14]; - float fD8; - float fDC; - float fE0; - float fE4; + float jump_vertical_velocity; + float downward_vertical_acceleration; + float terrain_transition_height_scale; + float gait_ground_height_reference; char padE8[4]; - short sEC; - unsigned short uEE; + short walk_start_counter; + unsigned short gait_status_flags; } WalkData; extern char walker_jump_distance_debug_format[] __asm__("D_L00_001611E0"); @@ -205,9 +205,9 @@ void walker_update_gait(WalkMoby *walker_moby, }; float ground_probe_position[4]; - switch (gait_data->bB7) { + switch (gait_data->gait_state) { case WALKER_GAIT_IDLE: - gait_data->fE4 = 0.0f; + gait_data->gait_ground_height_reference = 0.0f; if (run_start_input > 0.0008f && speed > gait_data->anim[0]->f08 * 1.35f) { { WalkAnim *a = gait_data->anim[7]; @@ -216,14 +216,14 @@ 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->bB7 = 0xD; - gait_data->bB6 = walker_gait_mask(gait_data->anim[7], (float)gait_data->anim[7]->initial_animation_position); - gait_data->sEC = 0; + gait_data->gait_state = 0xD; + 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; } else if (speed > frame_time * 0.21f || fast_difference_between_rotations(walker_moby->f48, movement_heading) > 0.10471976f) { - gait_data->sEC++; - if (gait_data->sEC >= 4) { + gait_data->walk_start_counter++; + if (gait_data->walk_start_counter >= 4) { { WalkAnim *a = gait_data->anim[0]; int f = find_nearest_animation_sequence_entry(walker_moby->pClass->seqs[a->id], @@ -231,10 +231,10 @@ 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->bB7 = 1; - gait_data->bB6 = + gait_data->gait_state = 1; + gait_data->gait_phase_mask = walker_gait_mask(gait_data->anim[0], (float)gait_data->anim[0]->initial_animation_position); - gait_data->sEC = 0; + gait_data->walk_start_counter = 0; } } break; @@ -245,23 +245,23 @@ void walker_update_gait(WalkMoby *walker_moby, case WALKER_GAIT_TRANSITION_FROM_UPHILL_TO_WALK: case WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK: if (flags & 5) { - gait_data->uEE &= 0xFFF7; + gait_data->gait_status_flags &= 0xFFF7; } case WALKER_GAIT_TRANSITION_TO_DOWNHILL: case WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL: case WALKER_GAIT_WALK_DOWNHILL: case WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK: case WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK: { - int gait_animation_index = walker_gait_animation_index_by_state[gait_data->bB7]; + int gait_animation_index = walker_gait_animation_index_by_state[gait_data->gait_state]; if (walker_moby->animation_playback_rate < 0.25f && fast_difference_between_rotations(walker_moby->f48, movement_heading) < 0.09239978f && speed < frame_time * 0.19f) { - blend_moby_animation(walker_moby, gait_data->bB0, 0, 10); + blend_moby_animation(walker_moby, gait_data->idle_animation_id, 0, 10); reset_walker_gait_helpers((char *)gait_data); - gait_data->bB7 = 0; + gait_data->gait_state = 0; } 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->fC0 > t && !(gait_data->bB6 & 0x3A)) { + if (speed > t && gait_data->gait_speed_reference > t && !(gait_data->gait_phase_mask & 0x3A)) { float current_animation_position = compute_interpolated_record_value(walker_moby); int r1 = truncate_float_to_s32(gait_data->anim[gait_animation_index]->f48 - current_animation_position + @@ -289,11 +289,11 @@ 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->bB7 = 0xD; + gait_data->gait_state = 0xD; } else if (flags & 5) { - if (gait_data->uEE & 1) { - gait_data->uEE = (gait_data->uEE & 0xFFFE) | 2; - gait_data->fE4 = walker_moby->pos[2]; + 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) { int bl = truncate_float_to_s32(gait_data->anim[11]->transition_position_span * 0.25f / (speed / gait_data->anim[11]->f08)); @@ -306,7 +306,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->bB7 = 0xF; + gait_data->gait_state = 0xF; } else { int bl = truncate_float_to_s32(gait_data->anim[9]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[9]->f08)); @@ -319,7 +319,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->bB7 = 0xE; + gait_data->gait_state = 0xE; } } else { float ground_height; @@ -334,13 +334,13 @@ void walker_update_gait(WalkMoby *walker_moby, fast_vec_add(ground_probe_position, ground_probe_position, gait_data->alternate_ground_probe_anchor_record); } ground_height = probe_ground_height(ground_probe_position, 0, 0.5f); - gait_data->fE4 = ground_height; - switch (gait_data->bB7) { + gait_data->gait_ground_height_reference = ground_height; + switch (gait_data->gait_state) { case WALKER_GAIT_WALK: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) > + gait_data->terrain_transition_height_scale * 0.75f) { if (flags & 1) { int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); @@ -353,7 +353,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->bB7 = 3; + gait_data->gait_state = 3; } else { int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); @@ -366,13 +366,13 @@ 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->bB7 = 2; + gait_data->gait_state = 2; } } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - -gait_data->fE0 * 0.75f) { - gait_data->uEE |= 8; + 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) { int bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); @@ -385,7 +385,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->bB7 = 8; + gait_data->gait_state = 8; } else { int bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); @@ -398,20 +398,20 @@ 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->bB7 = 7; + gait_data->gait_state = 7; } } break; case WALKER_GAIT_TRANSITION_TO_UPHILL: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - -gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) < + -gait_data->terrain_transition_height_scale * 0.75f) { int bl; int fr; WalkAnim *a; int f; - gait_data->uEE |= 8; + gait_data->gait_status_flags |= 8; bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); fr = truncate_float_to_s32(gait_data->anim[5]->f40 + @@ -423,12 +423,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->bB7 = 8; + gait_data->gait_state = 8; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - gait_data->fE0 * 0.75f) { - gait_data->bB7 = 5; + fast_sin(gait_data->ground_probe_correction_angle) < + gait_data->terrain_transition_height_scale * 0.75f) { + gait_data->gait_state = 5; } else { int bl = truncate_float_to_s32(gait_data->anim[3]->transition_position_span * 0.25f / (speed / gait_data->anim[3]->f08)); @@ -441,19 +441,19 @@ 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->bB7 = 4; + gait_data->gait_state = 4; } break; case WALKER_GAIT_ALTERNATE_TRANSITION_TO_UPHILL: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - -gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) < + -gait_data->terrain_transition_height_scale * 0.75f) { int bl; int fr; WalkAnim *a; int f; - gait_data->uEE |= 8; + gait_data->gait_status_flags |= 8; bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); fr = truncate_float_to_s32(gait_data->anim[4]->alternate_phase_anchor_position + @@ -465,12 +465,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->bB7 = 7; + gait_data->gait_state = 7; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - gait_data->fE0 * 0.75f) { - gait_data->bB7 = 6; + fast_sin(gait_data->ground_probe_correction_angle) < + gait_data->terrain_transition_height_scale * 0.75f) { + gait_data->gait_state = 6; } else { int bl = truncate_float_to_s32(gait_data->anim[3]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[3]->f08)); @@ -483,15 +483,15 @@ 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->bB7 = 4; + gait_data->gait_state = 4; } break; case WALKER_GAIT_WALK_UPHILL: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - -gait_data->fE0 * 0.75f) { - gait_data->uEE |= 8; + 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) { int bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); @@ -504,7 +504,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->bB7 = 8; + gait_data->gait_state = 8; } else { int bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); @@ -517,12 +517,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->bB7 = 7; + gait_data->gait_state = 7; } } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) < + gait_data->terrain_transition_height_scale * 0.75f) { if (flags & 1) { int bl = truncate_float_to_s32(gait_data->anim[1]->transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); @@ -535,7 +535,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->bB7 = 5; + gait_data->gait_state = 5; } else { int bl = truncate_float_to_s32(gait_data->anim[2]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); @@ -548,20 +548,20 @@ 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->bB7 = 6; + gait_data->gait_state = 6; } } break; case WALKER_GAIT_TRANSITION_FROM_UPHILL_TO_WALK: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - -gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) < + -gait_data->terrain_transition_height_scale * 0.75f) { int bl; int fr; WalkAnim *a; int f; - gait_data->uEE |= 8; + gait_data->gait_status_flags |= 8; bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); fr = truncate_float_to_s32(gait_data->anim[4]->alternate_phase_anchor_position + @@ -573,12 +573,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->bB7 = 7; + gait_data->gait_state = 7; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - gait_data->fE0 * 0.75f) { - gait_data->bB7 = 2; + fast_sin(gait_data->ground_probe_correction_angle) > + gait_data->terrain_transition_height_scale * 0.75f) { + gait_data->gait_state = 2; } else { int bl = truncate_float_to_s32(gait_data->anim[0]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[0]->f08)); @@ -591,19 +591,19 @@ 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->bB7 = 1; + gait_data->gait_state = 1; } break; case WALKER_GAIT_ALTERNATE_TRANSITION_FROM_UPHILL_TO_WALK: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - -gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) < + -gait_data->terrain_transition_height_scale * 0.75f) { int bl; int fr; WalkAnim *a; int f; - gait_data->uEE |= 8; + gait_data->gait_status_flags |= 8; bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); fr = truncate_float_to_s32(gait_data->anim[5]->f40 + @@ -615,12 +615,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->bB7 = 8; + gait_data->gait_state = 8; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - gait_data->fE0 * 0.75f) { - gait_data->bB7 = 3; + fast_sin(gait_data->ground_probe_correction_angle) > + gait_data->terrain_transition_height_scale * 0.75f) { + gait_data->gait_state = 3; } else { int bl = truncate_float_to_s32(gait_data->anim[0]->transition_position_span * 0.25f / (speed / gait_data->anim[0]->f08)); @@ -633,14 +633,14 @@ 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->bB7 = 1; + gait_data->gait_state = 1; } break; case WALKER_GAIT_TRANSITION_TO_DOWNHILL: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) > + gait_data->terrain_transition_height_scale * 0.75f) { int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + @@ -652,12 +652,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->bB7 = 3; + gait_data->gait_state = 3; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - -gait_data->fE0 * 0.75f) { - gait_data->bB7 = 10; + fast_sin(gait_data->ground_probe_correction_angle) > + -gait_data->terrain_transition_height_scale * 0.75f) { + gait_data->gait_state = 10; } else { int bl = truncate_float_to_s32(gait_data->anim[6]->transition_position_span * 0.25f / (speed / gait_data->anim[6]->f08)); @@ -670,14 +670,14 @@ 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->bB7 = 9; + gait_data->gait_state = 9; } break; case WALKER_GAIT_ALTERNATE_TRANSITION_TO_DOWNHILL: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) > + gait_data->terrain_transition_height_scale * 0.75f) { int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); int fr = truncate_float_to_s32(gait_data->anim[1]->alternate_phase_anchor_position + @@ -689,12 +689,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->bB7 = 2; + gait_data->gait_state = 2; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - -gait_data->fE0 * 0.75f) { - gait_data->bB7 = 11; + fast_sin(gait_data->ground_probe_correction_angle) > + -gait_data->terrain_transition_height_scale * 0.75f) { + gait_data->gait_state = 11; } else { int bl = truncate_float_to_s32(gait_data->anim[6]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[6]->f08)); @@ -707,14 +707,14 @@ 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->bB7 = 9; + gait_data->gait_state = 9; } break; case WALKER_GAIT_WALK_DOWNHILL: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) > + gait_data->terrain_transition_height_scale * 0.75f) { if (flags & 1) { int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); @@ -727,7 +727,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->bB7 = 3; + gait_data->gait_state = 3; } else { int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); @@ -740,12 +740,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->bB7 = 2; + gait_data->gait_state = 2; } } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - -gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) > + -gait_data->terrain_transition_height_scale * 0.75f) { if (flags & 1) { int bl = truncate_float_to_s32(gait_data->anim[4]->transition_position_span * 0.25f / (speed / gait_data->anim[4]->f08)); @@ -758,7 +758,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->bB7 = 10; + gait_data->gait_state = 10; } else { int bl = truncate_float_to_s32(gait_data->anim[5]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[5]->f08)); @@ -771,15 +771,15 @@ 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->bB7 = 11; + gait_data->gait_state = 11; } } break; case WALKER_GAIT_TRANSITION_FROM_DOWNHILL_TO_WALK: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) > + gait_data->terrain_transition_height_scale * 0.75f) { int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[1]->f08)); int fr = truncate_float_to_s32(gait_data->anim[1]->alternate_phase_anchor_position + @@ -791,12 +791,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->bB7 = 2; + gait_data->gait_state = 2; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - -gait_data->fE0 * 0.75f) { - gait_data->bB7 = 7; + fast_sin(gait_data->ground_probe_correction_angle) < + -gait_data->terrain_transition_height_scale * 0.75f) { + gait_data->gait_state = 7; } else { int bl = truncate_float_to_s32(gait_data->anim[0]->alternate_transition_position_span / (speed / gait_data->anim[0]->f08)); @@ -809,14 +809,14 @@ 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->bB7 = 1; + gait_data->gait_state = 1; } break; case WALKER_GAIT_ALTERNATE_TRANSITION_FROM_DOWNHILL_TO_WALK: if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) > - gait_data->fE0 * 0.75f) { + fast_sin(gait_data->ground_probe_correction_angle) > + gait_data->terrain_transition_height_scale * 0.75f) { int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / (speed / gait_data->anim[2]->f08)); int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + @@ -828,12 +828,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->bB7 = 3; + gait_data->gait_state = 3; } else if ((ground_height - ground_probe_position[2]) + gait_data->anim[gait_animation_index]->f04 * 0.5f * - fast_sin(gait_data->fB8) < - -gait_data->fE0 * 0.75f) { - gait_data->bB7 = 8; + fast_sin(gait_data->ground_probe_correction_angle) < + -gait_data->terrain_transition_height_scale * 0.75f) { + gait_data->gait_state = 8; } else { int bl = truncate_float_to_s32(gait_data->anim[0]->transition_position_span / (speed / gait_data->anim[0]->f08)); @@ -846,7 +846,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->bB7 = 1; + gait_data->gait_state = 1; } break; } @@ -857,10 +857,10 @@ void walker_update_gait(WalkMoby *walker_moby, } case WALKER_GAIT_RUN: { float t = (gait_data->anim[7]->f08 + gait_data->anim[0]->f08) * 0.35f; - if (walker_moby->b52 == gait_data->anim[7]->id && !(gait_data->bB6 & 0x30)) { - if (speed < t && gait_data->fC0 <= t) { + if (walker_moby->b52 == gait_data->anim[7]->id && !(gait_data->gait_phase_mask & 0x30)) { + if (speed < t && gait_data->gait_speed_reference <= t) { int fr; - if (gait_data->bB6 & 3) { + if (gait_data->gait_phase_mask & 3) { fr = truncate_float_to_s32(gait_data->anim[0]->transition_position_span * 2.0f / 3.0f + gait_data->anim[0]->f40 - gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); @@ -877,11 +877,11 @@ 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->bB7 = 1; + gait_data->gait_state = 1; } else if (flags & 5) { - if (gait_data->uEE & 1) { - gait_data->uEE = (gait_data->uEE & 0xFFFE) | 2; - gait_data->fE4 = walker_moby->pos[2]; + 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) { int bl = truncate_float_to_s32(gait_data->anim[11]->transition_position_span * 0.25f / (speed / gait_data->anim[11]->f08)); @@ -894,7 +894,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->bB7 = 0xF; + gait_data->gait_state = 0xF; } else { int bl = truncate_float_to_s32(gait_data->anim[9]->alternate_transition_position_span * 0.25f / (speed / gait_data->anim[9]->f08)); @@ -907,7 +907,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->bB7 = 0xE; + gait_data->gait_state = 0xE; } } else { ground_probe_position[0] = @@ -921,36 +921,36 @@ void walker_update_gait(WalkMoby *walker_moby, fast_vec_add(ground_probe_position, ground_probe_position, gait_data->alternate_ground_probe_anchor_record); } ground_probe_position[2] += 1.0f; - gait_data->fE4 = probe_ground_height(ground_probe_position, 0, 0.5f); + gait_data->gait_ground_height_reference = probe_ground_height(ground_probe_position, 0, 0.5f); } } } - if (gait_data->fC0 < t) { - gait_data->fC0 = t; + if (gait_data->gait_speed_reference < t) { + gait_data->gait_speed_reference = t; } break; } case WALKER_GAIT_RESET_TO_IDLE: - blend_moby_animation(walker_moby, gait_data->bB0, 0, 10); + blend_moby_animation(walker_moby, gait_data->idle_animation_id, 0, 10); reset_walker_gait_helpers((char *)gait_data); - gait_data->bB7 = 0; + gait_data->gait_state = 0; break; case WALKER_GAIT_TAKEOFF_ANIMATION: if (flags & 0x30) { float dist = vector_distance_xy(walker_moby->pos, gait_data->jump_target_position); debug_print(walker_jump_distance_debug_format, dist); - gait_data->fD8 = FUN_L00_0025abf0( - walker_moby->pos, gait_data->jump_target_position, 0, gait_data->fC0, -gait_data->fDC); - gait_data->uEE |= 4; + gait_data->jump_vertical_velocity = FUN_L00_0025abf0( + walker_moby->pos, gait_data->jump_target_position, 0, gait_data->gait_speed_reference, -gait_data->downward_vertical_acceleration); + gait_data->gait_status_flags |= 4; gait_data->f6C = fast_arc_tan(gait_data->jump_target_position[0] - walker_moby->pos[0], gait_data->jump_target_position[1] - walker_moby->pos[1]); } if (compute_interpolated_record_value(walker_moby) >= gait_data->anim[11]->animation_position_origin + gait_data->anim[11]->f10 - walker_moby->animation_playback_rate) { - blend_moby_animation(walker_moby, gait_data->bB3, 0, 10); + blend_moby_animation(walker_moby, gait_data->airborne_wait_animation_id, 0, 10); reset_walker_gait_helpers((char *)gait_data); - gait_data->bB7 = 0x10; - } else if ((gait_data->uEE & 4) && gait_data->fD8 < 0.0f) { + gait_data->gait_state = 0x10; + } 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 - gait_data->anim[12]->animation_position_origin) * 2.0f; if (t < len + 15.0f) { @@ -964,7 +964,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->bB7 = 0x12; + gait_data->gait_state = 0x12; } } break; @@ -972,18 +972,18 @@ void walker_update_gait(WalkMoby *walker_moby, if (flags & 0x30) { float dist = fast_vec_dist(walker_moby->pos, gait_data->jump_target_position); debug_print(walker_jump_distance_debug_format, dist); - gait_data->fD8 = FUN_L00_0025abf0( - walker_moby->pos, gait_data->jump_target_position, 0, gait_data->fC0, -gait_data->fDC); - gait_data->uEE |= 4; + gait_data->jump_vertical_velocity = FUN_L00_0025abf0( + walker_moby->pos, gait_data->jump_target_position, 0, gait_data->gait_speed_reference, -gait_data->downward_vertical_acceleration); + gait_data->gait_status_flags |= 4; gait_data->f6C = fast_arc_tan(gait_data->jump_target_position[0] - walker_moby->pos[0], gait_data->jump_target_position[1] - walker_moby->pos[1]); } if (compute_interpolated_record_value(walker_moby) >= gait_data->anim[9]->animation_position_origin + gait_data->anim[9]->f10 - walker_moby->animation_playback_rate) { - blend_moby_animation(walker_moby, gait_data->bB3, 0, 10); + blend_moby_animation(walker_moby, gait_data->airborne_wait_animation_id, 0, 10); reset_walker_gait_helpers((char *)gait_data); - gait_data->bB7 = 0x10; - } else if ((gait_data->uEE & 4) && gait_data->fD8 < 0.0f) { + gait_data->gait_state = 0x10; + } 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 - gait_data->anim[10]->animation_position_origin) * 2.0f; if (t < len + 15.0f) { @@ -997,12 +997,12 @@ 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->bB7 = 0x11; + gait_data->gait_state = 0x11; } } break; case WALKER_GAIT_WAIT_FOR_LANDING: - if (walker_moby->b52 == gait_data->bB3) { + if (walker_moby->b52 == gait_data->airborne_wait_animation_id) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); float len = (gait_data->anim[12]->alternate_phase_anchor_position - gait_data->anim[12]->animation_position_origin) * 2.0f; if (t < len + 15.0f) { @@ -1012,7 +1012,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->bB7 = 0x12; + gait_data->gait_state = 0x12; } } break; @@ -1036,10 +1036,10 @@ void walker_update_gait(WalkMoby *walker_moby, { int ns = 0x14; int fl = 4; - gait_data->bB6 = fl; - gait_data->bB7 = ns; + gait_data->gait_phase_mask = fl; + gait_data->gait_state = ns; } - gait_data->uEE &= 0xFFFB; + gait_data->gait_status_flags &= 0xFFFB; } } break; @@ -1063,10 +1063,10 @@ void walker_update_gait(WalkMoby *walker_moby, { int ns = 0x13; int fl = 4; - gait_data->bB6 = fl; - gait_data->bB7 = ns; + gait_data->gait_phase_mask = fl; + gait_data->gait_state = ns; } - gait_data->uEE &= 0xFFFB; + gait_data->gait_status_flags &= 0xFFFB; } } break; @@ -1083,16 +1083,16 @@ void walker_update_gait(WalkMoby *walker_moby, find_nearest_animation_sequence_entry(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->fD8 = 0.0f; - gait_data->bB7 = 0xD; - gait_data->bB6 = 1; - gait_data->uEE &= 0xFFFD; + gait_data->jump_vertical_velocity = 0.0f; + gait_data->gait_state = 0xD; + 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; ground_probe_position[1] = fast_sin(movement_heading) * gait_data->anim[7]->f04 * 0.5f; ground_probe_position[2] = 0.0f; fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); ground_probe_position[2] += 1.0f; - gait_data->fE4 = probe_ground_height(ground_probe_position, 0, 0.5f); + gait_data->gait_ground_height_reference = probe_ground_height(ground_probe_position, 0, 0.5f); } break; case WALKER_GAIT_RESUME_RUN_AFTER_ALTERNATE_LANDING: @@ -1108,16 +1108,16 @@ void walker_update_gait(WalkMoby *walker_moby, find_nearest_animation_sequence_entry(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->fD8 = 0.0f; - gait_data->bB7 = 0xD; - gait_data->bB6 = 1; - gait_data->uEE &= 0xFFFD; + gait_data->jump_vertical_velocity = 0.0f; + gait_data->gait_state = 0xD; + 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; ground_probe_position[1] = fast_sin(movement_heading) * gait_data->anim[7]->f04 * 0.5f; ground_probe_position[2] = 0.0f; fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); ground_probe_position[2] += 1.0f; - gait_data->fE4 = probe_ground_height(ground_probe_position, 0, 0.5f); + gait_data->gait_ground_height_reference = probe_ground_height(ground_probe_position, 0, 0.5f); } break; } From ffc73e2dc48f387fc875cf7286db45ee4cbebc9a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:44:51 +0000 Subject: [PATCH 721/758] decomp: clarify names in big_axebot_update fB0 -> hit_transition_state: Assigned retail 002ba8d0/002bab64/002bac20 passes data+0xb0 to trooper_anim_update after hits; 002bbcb4 passes it to trooper_anim_finish each update. Checked helper 00250488 binds this record to s1, starts/restarts its short timer and saves three current byte channels at 00250524..0025054c. Checked 00250568 binds it to s0, decrements the timer at 00250594 and interpolates three saved/target byte channels at 002505e4..002507ac. This is hit-triggered transition state; channel meaning is not assumed. fBC -> behavior_flags: Assigned retail 002bace4 clears moby+0xbc. Bit 1 latches alert/path entry at 002baef4 and 002bb080..002bb0c0; bit 4 requests melee after hit recovery at 002bb940..002bb984; bit 8 requests leg-rig reset at 002bb318..002bb338; bit 0x10 chooses home-facing turn at 002bb6b0 and 002bbae4..002bbb08. Thus this byte holds axebot behavior flags. fD0 -> knockback_gravity_step: Assigned retail 002ba844/002ba858 sets data+0xd0 to frame_time_sq*35. The DYING call at 002bbbb4 passes data+0xc0 to step_moby_motion. Checked helper 0024f6e8 binds that argument to s2; 0024f704..0024f718 subtracts s2+0x10 (data+0xd0) from s2+8, the vertical motion component later added to moby position by 0024fc08..0024fc20. This is the per-update downward acceleration step. fD4 -> knockback_horizontal_deceleration: Assigned retail 002ba838/002ba850 sets data+0xd4 to frame_time_sq*12. Checked step_moby_motion binds data+0xc0 to s2 at 0024f6e8, measures its vector at 0024f734, then 0024f73c..0024f768 selects target speed zero for grounded phase 2, otherwise s2+0x4c, and passes s2+0x14 (data+0xd4) as the scalar approach step before rescaling the motion vector. This field controls the speed reduction toward the selected target. fD8 -> knockback_initial_horizontal_displacement: Assigned retail 002ba84c/002ba85c initializes data+0xd8 to frame_time*7; fatal arc calculation receives its address at 002babc8..002babd4. Checked trooper_start_knockback binds data+0xc0 to s0 at 0024f5c0; 0024f5c4..0024f5e4 multiplies s0+0x18 by cosine and sine of knockback_yaw and stores the initial XY motion components at +0/+4. The motion step subsequently adds those components to owner position. fDC -> knockback_initial_vertical_displacement: Assigned fatal branch passes data+0xdc to trooper_knockback_arc at 002babd4, then passes data+0xc0 to trooper_start_knockback. Checked starter 0024f5e0..0024f5fc copies record+0x1c (data+0xdc) into record+8, the initial vertical motion component. Checked step 0024f704..0024f718 subtracts gravity from that component and 0024fc08..0024fc20 adds the motion vector to owner position; 0024f76c..0024f780 also uses this initial value as its upper cap. fE4 -> knockback_motion_flags: Assigned 002ba848 initializes data+0xe4 to 9 before knockback responses. Checked trooper_start_knockback receives data+0xc0 in s0, reads +0x24 at 0024f638..0024f668, ORs bit 0x20 at 0024f658..0024f65c and tests bit 2 to select the animation setup path at 0024f668..0024f698. Checked step_moby_motion tests bits 0x10 and 0x20 of the same record+0x24 at 0024f840..0024f858 and 0024fca8..0024fcc4. These are knockback motion-control flags, not an integer phase selector. fE8 -> knockback_collision_height_offset: Assigned fatal branch sets data+0xe8 to 1.0 at 002babb0. Checked step_moby_motion receives data+0xc0 as s2: 0024f79c..0024f7b8 adds s2+0x28 (data+0xe8) to the copied owner Z before the ground probe. 0024fc0c..0024fc20 and 0024fc34..0024fc4c apply the same vertical offset to collision endpoints, while 0024fd74..0024fda0 subtracts it from the resolved owner Z. This proves a vertical offset used for knockback collision/probing. --- src/overlays/l04/mobys/big_axebot.c | 74 ++++++++++++++--------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/overlays/l04/mobys/big_axebot.c b/src/overlays/l04/mobys/big_axebot.c index 873b19ed54..2276287deb 100644 --- a/src/overlays/l04/mobys/big_axebot.c +++ b/src/overlays/l04/mobys/big_axebot.c @@ -137,17 +137,17 @@ typedef struct D_B7B0 { char pad59; unsigned char f5A; char pad5B[0x55]; - char fB0[7]; + char hit_transition_state[7]; unsigned char fB7; char padB8[8]; float fC0[4]; - float fD0; - float fD4; - float fD8; - float fDC; + float knockback_gravity_step; + float knockback_horizontal_deceleration; + float knockback_initial_horizontal_displacement; + float knockback_initial_vertical_displacement; int fE0; - int fE4; - float fE8; + int knockback_motion_flags; + float knockback_collision_height_offset; char padEC[0x11]; unsigned char fFD; char padFE[0x12]; @@ -209,7 +209,7 @@ typedef struct M_B7B0 { char padA5; short cls; char padA8[0x14]; - unsigned char fBC; + unsigned char behavior_flags; char padBD[3]; V4_B7B0 fC0; } M_B7B0; @@ -388,10 +388,10 @@ void big_axebot_update(M_B7B0 *moby) { knockback_yaw = fast_arc_tan(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1]); } - data->fD4 = frame_time_sq * 12.0f; - data->fD0 = frame_time_sq * 35.0f; - data->fD8 = frame_time * 7.0f; - data->fE4 = 9; + data->knockback_horizontal_deceleration = frame_time_sq * 12.0f; + data->knockback_gravity_step = frame_time_sq * 35.0f; + data->knockback_initial_horizontal_displacement = frame_time * 7.0f; + data->knockback_motion_flags = 9; data->fFD = 0; data->hp -= dmg; if (data->hp <= 0.0f) { @@ -403,7 +403,7 @@ void big_axebot_update(M_B7B0 *moby) { } data->recoil_pose_cooldown_timer = scale_game_frames(0x1E); data->fB7 = 0x78; - trooper_anim_update(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->hit_transition_state); } else { switch (hit_reaction_result) { case BIG_AXEBOT_HIT_REACTION_NONE: @@ -418,7 +418,7 @@ void big_axebot_update(M_B7B0 *moby) { data->recoil_pose_cooldown_timer = scale_game_frames(0x1E); if ((hit->att->cls == 0 || hit->damage_amount > 1.0f) && (moby->animation_source_sequence != 4 || hd < 17.0f || hd > 20.0f)) { - moby->fBC |= 5; + moby->behavior_flags |= 5; blend_big_axebot_and_axe_animation( (char *)moby, (void *)5, 0, (void *)scale_game_frames(6)); set_big_axebot_and_axe_animation_speed(moby, 2.0f); @@ -426,7 +426,7 @@ void big_axebot_update(M_B7B0 *moby) { } data->recoil_displacement = 3.4f / scale_time(7.0f) * 0.5f; data->fB7 = 0x78; - trooper_anim_update(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->hit_transition_state); data->hit_response_cooldown_timer = scale_game_frames(0x46); data->extended_detection_timer = scale_game_frames(0xF0); break; @@ -436,7 +436,7 @@ void big_axebot_update(M_B7B0 *moby) { data->recoil_pitch_angle = -0.5235988f; } data->recoil_pose_cooldown_timer = scale_game_frames(0x1E); - moby->fBC |= 5; + moby->behavior_flags |= 5; blend_big_axebot_and_axe_animation( (char *)moby, (void *)5, 0, (void *)scale_game_frames(6)); set_big_axebot_and_axe_animation_speed(moby, 2.0f); @@ -446,7 +446,7 @@ void big_axebot_update(M_B7B0 *moby) { data->knockback_descent_target_frame = 10.0f; data->recoil_displacement = 3.4f / scale_time(7.0f); data->fB7 = 0x78; - trooper_anim_update(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->hit_transition_state); data->hit_response_cooldown_timer = scale_game_frames(0x46); data->extended_detection_timer = scale_game_frames(0xF0); break; @@ -459,23 +459,23 @@ void big_axebot_update(M_B7B0 *moby) { moby->state = BIG_AXEBOT_STATE_IDLE; data->recoil_displacement = 3.4f / scale_time(7.0f); data->fB7 = 0x78; - trooper_anim_update(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->hit_transition_state); data->hit_response_cooldown_timer = scale_game_frames(0x46); data->extended_detection_timer = scale_game_frames(0xF0); break; case BIG_AXEBOT_HIT_REACTION_FATAL: - data->fE8 = 1.0f; + data->knockback_collision_height_offset = 1.0f; data->fE0 = 0x400; trooper_set_knockback(data->fC0, 5.7f, 4.0f); *(OvlQuad *)vector_quaternion_scratch = *(OvlQuad *)hit->pos; trooper_knockback_arc( - vector_quaternion_scratch, &knockback_yaw, &data->fD8, &data->fDC); + vector_quaternion_scratch, &knockback_yaw, &data->knockback_initial_horizontal_displacement, &data->knockback_initial_vertical_displacement); trooper_start_knockback(knockback_yaw, moby, data->fC0, 7, 1, 0); data->knockback_ascent_target_frame = 12.0f; data->knockback_descent_target_frame = 25.0f; moby->state = BIG_AXEBOT_STATE_DYING; data->fB7 = 0x78; - trooper_anim_update(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->hit_transition_state); FUN_L00_00257470(moby, 0, -1); break; case BIG_AXEBOT_HIT_REACTION_SKIP_ADDITIONAL_RESPONSE: @@ -509,7 +509,7 @@ void big_axebot_update(M_B7B0 *moby) { data->f2E = 1; data->f29 = 0; data->f30 = 1.5f; - moby->fBC = 0; + moby->behavior_flags = 0; data->fall_displacement = 0.0f; data->attached_axe_moby = 0; data->alert_voice_cooldown_timer = 0; @@ -552,7 +552,7 @@ void big_axebot_update(M_B7B0 *moby) { if (data->path_trigger_volume_index != -1 && data->approach_path_index != -1 && data->path_follow_started == 0 && (flag || is_point_inside_clip_volume(&hero.motion.pos, data->path_trigger_volume_index) != 0)) { moby->state = BIG_AXEBOT_STATE_FOLLOW_PATH; - moby->fBC |= 1; + moby->behavior_flags |= 1; data->path_follow_started = 1; } else { if (moby->animation_source_sequence == 0xD && FUN_L00_001fefc8(&data->alert_voice_cooldown_timer) != 0) { @@ -566,12 +566,12 @@ void big_axebot_update(M_B7B0 *moby) { moby->state = BIG_AXEBOT_STATE_MELEE_ATTACK; } else if (flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) { - int nf = (moby->fBC & 1) == 0; + int nf = (moby->behavior_flags & 1) == 0; if (nf) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)2, 0, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_ALERT; - moby->fBC |= 1; + moby->behavior_flags |= 1; } } } @@ -601,12 +601,12 @@ void big_axebot_update(M_B7B0 *moby) { (char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_MELEE_ATTACK; } else if (flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) { - int nf = (moby->fBC & 1) == 0; + int nf = (moby->behavior_flags & 1) == 0; if (nf) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)2, 0, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_ALERT; - moby->fBC |= 1; + moby->behavior_flags |= 1; } } } @@ -655,8 +655,8 @@ void big_axebot_update(M_B7B0 *moby) { break; } case BIG_AXEBOT_STATE_CHASE_TARGET: - if (moby->fBC & 8) { - moby->fBC &= ~8; + if (moby->behavior_flags & 8) { + moby->behavior_flags &= ~8; reset_leg_rig_from_animation(moby, data->leg_rig_state); } data->movement_yaw = spring_turn(moby->rot[2], @@ -698,8 +698,8 @@ void big_axebot_update(M_B7B0 *moby) { } else { float a; - if (moby->fBC & 8) { - moby->fBC &= ~8; + if (moby->behavior_flags & 8) { + moby->behavior_flags &= ~8; reset_leg_rig_from_animation(moby, data->leg_rig_state); } a = fast_arc_tan(data->home[0] - moby->pos[0], data->home[1] - moby->pos[1]); @@ -726,7 +726,7 @@ void big_axebot_update(M_B7B0 *moby) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)8, 0, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_TURN; - moby->fBC |= 0x10; + moby->behavior_flags |= 0x10; } if (point_in_path_xy(tpos, ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, @@ -776,8 +776,8 @@ void big_axebot_update(M_B7B0 *moby) { break; case BIG_AXEBOT_STATE_HIT_RECOVERY: if (!(moby->animation_target_sequence == 5 && (moby->animation_source_sequence != moby->animation_target_sequence || hd <= 13.0f))) { - if (moby->fBC & 4) { - moby->fBC &= ~4; + if (moby->behavior_flags & 4) { + moby->behavior_flags &= ~4; blend_big_axebot_and_axe_animation( (char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(6)); set_big_axebot_and_axe_animation_speed(moby, 1.5f); @@ -819,10 +819,10 @@ void big_axebot_update(M_B7B0 *moby) { case BIG_AXEBOT_STATE_TURN: if (moby->animation_source_sequence == 8 && (moby->f70 & 2)) { moby->state = BIG_AXEBOT_STATE_CHASE_TARGET; - moby->fBC = (moby->fBC | 8) & ~0x10; + moby->behavior_flags = (moby->behavior_flags | 8) & ~0x10; blend_big_axebot_and_axe_animation( (char *)moby, (void *)9, 0, (void *)scale_game_frames(0xC)); - } else if (moby->fBC & 0x10) { + } else if (moby->behavior_flags & 0x10) { float a = fast_arc_tan(data->home[0] - moby->pos[0], data->home[1] - moby->pos[1]); moby->rot[2] = spring_turn(moby->rot[2], @@ -882,7 +882,7 @@ void big_axebot_update(M_B7B0 *moby) { } break; } - trooper_anim_finish(moby, data->fB0); + trooper_anim_finish(moby, data->hit_transition_state); if (data->recoil_displacement > 0.0f) { struct Hero *h = &hero; From 5916443a0a53e956f756710ca5d93b2d00f6e479 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:44:54 +0000 Subject: [PATCH 722/758] decomp: clarify names in drek_final_boss_robot_update fA6 -> moby_class_id: Retail 0x002f3ca8-0x002f3cb0 and 0x002f3d48-0x002f3d50 load the ground moby's signed short +0xA6 and compare it with class 0x24B; 0x002f59f4-0x002f59fc compares the same member with class 0x247. Bound C uses BossMoby->fA6 for these tests; supplied same-file helpers test MOBY(...)->oclass against these identical class IDs, proving the class discriminator rather than a state or offset-only role. fB0 -> current_aim_target_moby: Retail 0x002f2c38 loads BossData+0xB0 into s2, matching C aim_target_moby = boss_data->fB0. At 0x002f40f4-0x002f4148 its +0x10/+0x14 position determines target-minus-boss yaw; 0x002f4714-0x002f471c copies its position to stored_aim_target_position, and 0x002f4c68-0x002f4c70 measures launch distance to it. Supplied damage-update C defaults +0xB0 to hero.moby when null. These uses prove the current aiming target pointer without asserting its species. fB4 -> ground_target_center_mode: In DREK_BOSS_TARGET_GROUND_POINTS, retail 0x002f47cc-0x002f47f8 loads BossData+0xB4 and compares it with 2: equality selects hero position 0x0013F3D0, otherwise the center is BossData+0x70. Retail 0x002f4804-0x002f4858 adds a random radial offset to the selected center, while 0x002f4864-0x002f486c permits the exact stored center only when mode is not 2. Bound C expresses these same fB4 branches before ground probing and rocket targeting, proving a ground-target center selection mode. fD0 -> lateral_direction_vector: Retail 0x002f4c30-0x002f4c64 copies moby forward vector +0xC0, scales moby+0xD0 by ring_launch_lateral_coefficient and adds the scaled vector to the launch direction. Independently 0x002f5094-0x002f50c8 scales +0xD0 by +4.3 or -4.3 and adds boss position to form opposite side ground targets. Bound C fast_vec_normalize and fast_vec_add uses of float fD0[4] agree, proving the lateral direction vector without asserting handedness or normalization. --- .../l18/mobys/drek_final_boss_robot.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/overlays/l18/mobys/drek_final_boss_robot.c b/src/overlays/l18/mobys/drek_final_boss_robot.c index 316b6ba403..9c41d6049e 100644 --- a/src/overlays/l18/mobys/drek_final_boss_robot.c +++ b/src/overlays/l18/mobys/drek_final_boss_robot.c @@ -187,10 +187,10 @@ typedef struct BossMoby { int animated_tint_color; int collision_data; char p98[0xE]; - short fA6; + short moby_class_id; char pA8[0x18]; float fC0[4]; - float fD0[4]; + float lateral_direction_vector[4]; } BossMoby; typedef struct BossData { @@ -204,8 +204,8 @@ typedef struct BossData { char p34[0x3C]; float f70[4]; char p80[0x30]; - BossMoby *fB0; - int fB4; + BossMoby *current_aim_target_moby; + int ground_target_center_mode; char pB8[8]; char fC0[0x68]; float lateral_launch_aim_angle; @@ -458,7 +458,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { count_drek_boss_platform_event_once((char *)moby); update_drek_boss_damage_and_phase_transitions((char *)moby); - aim_target_moby = boss_data->fB0; + aim_target_moby = boss_data->current_aim_target_moby; /* The file defines this one without parameters; retail passes the moby. */ attach_drek_boss_big_head_manipulator((char *)moby); { @@ -857,7 +857,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { break; } if (vector_distance_xy(moby->f10, hero.motion.pos.f) < 50.0f && hero.air_frames.s == 0 && - (((BossMoby *)hero.ground_moby) == 0 || ((BossMoby *)hero.ground_moby)->fA6 != 0x24B)) { + (((BossMoby *)hero.ground_moby) == 0 || ((BossMoby *)hero.ground_moby)->moby_class_id != 0x24B)) { int *p = boss_data->active_movement_path; boss_data->movement_step_distance = 0.0f; @@ -878,7 +878,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { break; case DREK_BOSS_WAIT_FOR_GROUNDED_HERO_TO_START_SCENE: if (hero.air_frames.s == 0 && - (((BossMoby *)hero.ground_moby) == 0 || ((BossMoby *)hero.ground_moby)->fA6 != 0x24B)) { + (((BossMoby *)hero.ground_moby) == 0 || ((BossMoby *)hero.ground_moby)->moby_class_id != 0x24B)) { int i; *(int *)&l18_drek_boss_scene_2_started_gp = 1; @@ -1160,11 +1160,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->fB4 == 2) { + if (random_integer_below(5) != 0 || boss_data->ground_target_center_mode == 2) { float a; float r; - if (boss_data->fB4 != 2) { + if (boss_data->ground_target_center_mode != 2) { qcopy(position_displacement_direction_and_rotation_scratch, boss_data->f70); } else { qcopy(position_displacement_direction_and_rotation_scratch, hero.motion.pos.f); @@ -1267,7 +1267,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { moby_point_position(moby, 0, position_and_displacement_scratch); qcopy(position_displacement_direction_and_rotation_scratch, moby->fC0); fast_vec_normalize( - position_direction_and_rotation_scratch, moby->fD0, boss_data->ring_launch_lateral_coefficient); + position_direction_and_rotation_scratch, moby->lateral_direction_vector, boss_data->ring_launch_lateral_coefficient); fast_vec_add(position_displacement_direction_and_rotation_scratch, position_displacement_direction_and_rotation_scratch, position_direction_and_rotation_scratch); @@ -1380,7 +1380,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->action_event_timer_frames == scale_game_frames(0x1E)) { float f = boss_data->action_event_timer_frames != 0 ? 4.3f : -4.3f; - fast_vec_normalize(position_and_displacement_scratch, moby->fD0, f); + fast_vec_normalize(position_and_displacement_scratch, moby->lateral_direction_vector, f); fast_vec_add(position_and_displacement_scratch, position_and_displacement_scratch, boss_data->unbobbed_boss_position); @@ -1653,7 +1653,7 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->post_scene_resume_state = DREK_BOSS_RUN_ENDING_SEQUENCE; } else if (boss_data->encounter_phase == DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM) { if (((BossMoby *)hero.ground_moby) != 0 && hero.air_frames.s == 0 && - ((BossMoby *)hero.ground_moby)->fA6 == 0x247 && hero.state.current == 0x22) { + ((BossMoby *)hero.ground_moby)->moby_class_id == 0x247 && hero.state.current == 0x22) { if (boss_data->ending_scene_4_delay_counter == 0) { boss_data->ending_scene_4_delay_counter = 1; } From 8d4a1c53b436a95f4850fb8f4188d7f7cf5c8ec3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:46:48 +0000 Subject: [PATCH 723/758] decomp: clarify names in qwarks_starfighter_update bB0 -> visited_slot_index: Assigned retail 0x002eb1c8-0x002eb1f0 loads Moby+0xB0, treats 0xFF as no slot, otherwise indexes visited52 at that byte plus (D_0015ED84 << 4), removing the Moby when the selected visited byte is 0xFF. Authoritative C and original Ghidra agree; the name identifies the visited-table slot without claiming what each slot denotes. bFC -> rocket_muzzle_toggle: Assigned retail 0x002eb360 and 0x002ec7dc clear private+0xFC. In the authoritative file, fire_starfighter_homing_rocket reads starfighter_data[0xFC]&1 to choose muzzle joint 0x12 versus 0x10 and XORs bit 0 subject to command/random gating before obtaining muzzle_position. This identifies the reset byte as the rocket muzzle toggle without claiming left/right joint identity. bFD -> attack_sequence_counter: Assigned 0x002ec7e0 clears private+0xFD. Checked command helper 0x002eac78-0x002eac94 increments this byte after each rocket and clears it after eleven; 0x002eae48-0x002eae9c and 0x002eaf90-0x002eafd4 pass it to the byte-decrement helper and reload randomized counts when alternating attacks. Supplied command C confirms both uses. Hence attack_sequence_counter covers its count-up volley and count-down alternating sequences. bFE -> mine_attack_selected: Assigned 0x002eb35c and 0x002ec7e4 clear private+0xFE. Checked command helper 0x002eae64-0x002eae70 XORs it with 1; 0x002eaeac-0x002eaeb4 fires fire_level_13_mine when nonzero, while zero branches to the rocket call at 0x002eaf4c. Repeated selection at 0x002eafe8-0x002eb014 agrees with supplied C. This is the mine-versus-rocket selection flag, with one selecting mines. bFF -> tractor_beam_capture_active: Assigned 0x002eb938-0x002eb93c tests private+0xFF: zero moves the tractor endpoint toward hero position; 0x002eba40 sets it to one after distance falls within the pursuit step. The nonzero branch at 0x002ebc6c onward damps flight speed and copies the endpoint into hero ship position at 0x002ebdf0. Checked command helper 0x002eae04 clears it on tractor entry. Thus the flag selects active capture after endpoint pursuit, without asserting collision success. fA4 -> pitch_spring_velocity: Retail 0x002ec28c supplies private+0xA4 by address to spring_turn at 0x002ec2a8, with moby+0x44 current pitch and computed target_pitch; the return updates pitch at 0x002ec2c4. Checked steering helper 0x002e9090-0x002e90b0 repeats this flow. Supplied spring_turn signature calls this pointer vel, proving pitch spring velocity; reset clears it at 0x002ec7c8. fA8 -> yaw_spring_velocity: Assigned 0x002ec278 passes private+0xA8 to yaw steering with target_yaw at 0x002ec27c. Checked steering helper 0x002e9074-0x002e9078 passes the same field, then 0x002e90c0-0x002e90e4 reads its negative value to bank roll. Supplied update_moby_spring_steering_and_banking source uses it for target_yaw with spring coefficients, proving yaw spring velocity; 0x002ec7cc resets it. fAC -> flight_speed: Assigned 0x002eb2dc-0x002eb320 initializes private+0xAC and multiplies it by cos/sin of yaw to produce flight velocity X/Y. Original Ghidra and supplied advance_moby_along_selected_path normalize the motion vector at +0x70 to this magnitude and add it to position. Assigned 0x002eb58c eases it toward frame_time*42; 0x002ebd18 damps it on capture and 0x002ec2e8 during death. This is the flight displacement/speed magnitude; no per-second units claimed. h144 -> long_voice_line_cooldown_frames: Assigned 0x002ecc00-0x002ecc08 reloads signed short +0x144 from scale_game_frames(360) after pending dialogue reaches playback phase 3, and 0x002ecc94-0x002ecc98 decrements it each update. Checked queue helper 0x002e8764-0x002e8788 rejects voice groups below 12 while this field is positive. It is the longer voice-line cooldown, compared with the paired scaled 60-frame +0x146 timer; no spoken content category is inferred. h146 -> short_voice_line_cooldown_frames: Assigned 0x002ecc0c-0x002ecc14 reloads signed short +0x146 from scale_game_frames(60) after pending dialogue reaches playback phase 3, and 0x002ecc9c-0x002ecca0 decrements it each update. Checked queue helper 0x002e8748-0x002e8790 applies this positive-timer gate to groups 12 through 28. It is the shorter voice-line cooldown, paired with scaled 360-frame +0x144; no spoken content category is inferred. iF8 -> attack_and_death_timer_frames: Assigned 0x002eb5d8-0x002eb5e0 initializes +0xF8 from scale_game_frames(20); 0x002eba10 reloads it for capture, 0x002ec084 decrements it during death flight, and 0x002ec59c-0x002ec5a4 waits for expiry before removal. Checked attack helper 0x002eac58-0x002eac7c decrements it to gate rocket firing and reloads scaled 60 frames, with further attack-phase reloads. Original Ghidra agrees. It is the timer shared by attack and death sequences, distinct from +0x100 beam cycle and +0x124 cooldown. pF0 -> command_joint_attachment_moby: Assigned 0x002ec600-0x002ec614 removes the Moby pointer at private+0xF0 and clears it on reset. Checked attachment updater 0x002e8e3c-0x002e8e60 selects an attachment joint from the parent's command; 0x002e8e98-0x002e8ea0 creates class 0x191 through spawn_moby_joint_attachment and stores the returned pointer at +0xF0. 0x002e8ec8 updates its joint position and 0x002e8fa8 removes it when no joint is selected. This proves a command-selected joint attachment Moby. --- src/overlays/l13/mobys/qwarks_starfighter.c | 106 ++++++++++---------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index c901692468..bb8718630d 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -1457,19 +1457,19 @@ typedef struct { short path_target_node_index; short path_previous_node_index; int iA0; - float fA4; - float fA8; - float fAC; + float pitch_spring_velocity; + float yaw_spring_velocity; + float flight_speed; int paths[5]; char *parts[10]; char *owner; - char *pF0; + char *command_joint_attachment_moby; int iF4; - int iF8; - unsigned char bFC; - unsigned char bFD; - unsigned char bFE; - unsigned char bFF; + int attack_and_death_timer_frames; + unsigned char rocket_muzzle_toggle; + unsigned char attack_sequence_counter; + unsigned char mine_attack_selected; + unsigned char tractor_beam_capture_active; int tractor_beam_cycle_timer_frames; int hud104; int health_hud_packed_value; @@ -1492,8 +1492,8 @@ typedef struct { unsigned char selected_path_slot; int voice_line_history_mask; int pad140; - short h144; - short h146; + short long_voice_line_cooldown_frames; + short short_voice_line_cooldown_frames; unsigned char b148; } Ship388; @@ -1518,7 +1518,7 @@ typedef struct { char pad98[0xE]; short cls_id; char padA8[8]; - unsigned char bB0; + unsigned char visited_slot_index; char padB1[0xB]; unsigned char bBC; char padBD[3]; @@ -1653,7 +1653,7 @@ void qwarks_starfighter_update(Moby388 *moby) { switch (moby->state) { case STARFIGHTER_STATE_INITIALIZE: { int j; - if (moby->bB0 != 0xFF && visited52[moby->bB0 + (D_0015ED84 << 4)] == 0xFF) { + if (moby->visited_slot_index != 0xFF && visited52[moby->visited_slot_index + (D_0015ED84 << 4)] == 0xFF) { mark_moby_for_removal(moby); return; } @@ -1669,9 +1669,9 @@ void qwarks_starfighter_update(Moby388 *moby) { *(int *)path -= 1; } } - starfighter_vars->fAC = frame_time * 42.0f * 0.1f; - starfighter_vars->f70 = fast_cos(moby->rot[2]) * starfighter_vars->fAC; - starfighter_vars->flight_velocity_y = fast_sin(moby->rot[2]) * starfighter_vars->fAC; + starfighter_vars->flight_speed = frame_time * 42.0f * 0.1f; + starfighter_vars->f70 = fast_cos(moby->rot[2]) * starfighter_vars->flight_speed; + starfighter_vars->flight_velocity_y = fast_sin(moby->rot[2]) * starfighter_vars->flight_speed; starfighter_vars->i78 = 0; qcopy(moby->pos, walker_paths[starfighter_vars->paths[0]] + 0x10); starfighter_vars->path_previous_node_index = 0; @@ -1679,8 +1679,8 @@ void qwarks_starfighter_update(Moby388 *moby) { moby->update_distance = 0xFF; moby->s32 = 0xFF; starfighter_vars->path_traversal_direction = 1; - starfighter_vars->bFE = 0; - starfighter_vars->bFC = 0; + starfighter_vars->mine_attack_selected = 0; + starfighter_vars->rocket_muzzle_toggle = 0; moby->state = STARFIGHTER_STATE_WAIT_FOR_HERO_SHIP; starfighter_vars->b10E = 8; starfighter_vars->child110 = 0; @@ -1748,7 +1748,7 @@ void qwarks_starfighter_update(Moby388 *moby) { (int)FUN_L06_00249738, (int)&starfighter_vars->health_hud_packed_value, (starfighter_vars->starfighter_max_health << 4) | 0xF); - starfighter_vars->fAC += (frame_time * 42.0f - starfighter_vars->fAC) * 0.1f; + starfighter_vars->flight_speed += (frame_time * 42.0f - starfighter_vars->flight_speed) * 0.1f; if (advance_moby_along_selected_path(moby, starfighter_vars, 0, 1) != 0) { char *hero = ((char *)&D_0013F350); char *ship; @@ -1759,7 +1759,7 @@ void qwarks_starfighter_update(Moby388 *moby) { *(int *)(ship + 0x8C) = 0; *(int *)(ship + 0x118) = 0; starfighter_vars->selected_path_slot = qwarks_starfighter_command_path_slots[moby->bBC]; - starfighter_vars->iF8 = scale_game_frames(0x14); + starfighter_vars->attack_and_death_timer_frames = scale_game_frames(0x14); moby->state = STARFIGHTER_STATE_FOLLOW_COMMAND_PATH; starfighter_vars->path_target_node_index = select_point_index_by_distance( moby->pos, walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]], 0.0f); @@ -1845,7 +1845,7 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->snd11C = -1; starfighter_vars->snd11C = allocate_voice_for_target_entry(4, 4, (int)moby); have11C: - if (starfighter_vars->bFF == 0) { + if (starfighter_vars->tractor_beam_capture_active == 0) { { char *hero = ((char *)&D_0013F350); if (*(Moby388 **)(hero + 0x15F0) != 0 && @@ -1853,20 +1853,20 @@ void qwarks_starfighter_update(Moby388 *moby) { (*(Moby388 **)(hero + 0x15F0))->bBC = 0; } } - starfighter_vars->fAC += (frame_time * 30.0f - starfighter_vars->fAC) * 0.1f; + starfighter_vars->flight_speed += (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); fast_vec_add(starfighter_vars->tractor_beam_endpoint, starfighter_vars->tractor_beam_endpoint, offset); } else { qcopy(offset, ((char *)&D_0013F3D0)); - starfighter_vars->iF8 = scale_game_frames(0x78); + starfighter_vars->attack_and_death_timer_frames = scale_game_frames(0x78); if (!(starfighter_vars->h138 & 4)) { if (queue_starfighter_voice_line(moby, starfighter_vars, 0x17, 4) != 0) { starfighter_vars->h138 |= 4; } } - starfighter_vars->bFF = 1; + starfighter_vars->tractor_beam_capture_active = 1; } if (advance_moby_along_selected_path( moby, starfighter_vars, starfighter_vars->selected_path_slot, 1) & @@ -1925,7 +1925,7 @@ void qwarks_starfighter_update(Moby388 *moby) { (*(Moby388 **)(hero + 0x15F0))->cls_id == 0x45) { (*(Moby388 **)(hero + 0x15F0))->bBC = 1; } - starfighter_vars->fAC *= 0.8f; + starfighter_vars->flight_speed *= 0.8f; fast_vec_dist(moby->pos, ((char *)&D_0013F3D0)); FUN_L00_0024f7c8(moby, 0x13, probe); fast_vec_sub(ray_start, starfighter_vars->tractor_beam_endpoint, probe); @@ -2015,16 +2015,16 @@ void qwarks_starfighter_update(Moby388 *moby) { (*(Moby388 **)(((char *)&D_00140940)))->cls_id == 0x45) { (*(Moby388 **)(((char *)&D_00140940)))->bBC = 0; } - if (starfighter_vars->iF8 == 1) { + if (starfighter_vars->attack_and_death_timer_frames == 1) { detach_moby_joint_attachment(moby, starfighter_vars, 8); allocate_voice_for_target_entry(7, 0, (int)moby); } - fast_dec_timer(&starfighter_vars->iF8); + fast_dec_timer(&starfighter_vars->attack_and_death_timer_frames); if (advance_moby_along_selected_path(moby, starfighter_vars, starfighter_vars->selected_path_slot, 0) != 0 || starfighter_vars->path_target_node_index >= *(int *)walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]] - 1) { - starfighter_vars->iF8 = scale_game_frames(0xB4); + starfighter_vars->attack_and_death_timer_frames = scale_game_frames(0xB4); moby->state = STARFIGHTER_STATE_EXPLODE_AND_REMOVE; } moby->rot[0] = fast_add_rotations(moby->rot[0], frame_time * 4.1887903f); @@ -2053,19 +2053,19 @@ void qwarks_starfighter_update(Moby388 *moby) { path2->pts[i2][2]); } FUN_L00_00258278(moby, - &starfighter_vars->fA8, + &starfighter_vars->yaw_spring_velocity, target_yaw, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); - moby->rot[1] = spring_turn(&starfighter_vars->fA4, + moby->rot[1] = spring_turn(&starfighter_vars->pitch_spring_velocity, moby->rot[1], target_pitch, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); moby->scale *= 0.99925f; - starfighter_vars->fAC *= 0.9992f; + starfighter_vars->flight_speed *= 0.9992f; 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); @@ -2080,12 +2080,12 @@ void qwarks_starfighter_update(Moby388 *moby) { { char *dialog = (char *)&music_stream_state; if (*(int *)(dialog + 0x50) == 0 && *(int *)(dialog + 0x1C) == -1) { - if (starfighter_vars->iF8 < scale_game_frames(0x1A4) && + if (starfighter_vars->attack_and_death_timer_frames < scale_game_frames(0x1A4) && starfighter_vars->voice_line_history_mask < 0) { if (queue_starfighter_voice_line(moby, starfighter_vars, 0x23, 1) != 0) { starfighter_vars->voice_line_history_mask &= 0x7FFFFFFF; } - } else if (starfighter_vars->iF8 < scale_game_frames(0xB4) && + } else if (starfighter_vars->attack_and_death_timer_frames < scale_game_frames(0xB4) && (starfighter_vars->voice_line_history_mask & 0x40000000) && queue_starfighter_voice_line(moby, starfighter_vars, 0x24, 1) != 0) { starfighter_vars->voice_line_history_mask &= 0xBFFFFFFF; @@ -2105,7 +2105,7 @@ void qwarks_starfighter_update(Moby388 *moby) { moby->rot[2] = *(float *)(view + 0x158); moby->rot[1] = *(float *)(view + 0x154); moby->scale *= 0.98f; - if (starfighter_vars->iF8 == scale_game_frames(0x1E)) { + if (starfighter_vars->attack_and_death_timer_frames == scale_game_frames(0x1E)) { spawn_explosion(moby, &starfighter_vars->f70, 0, @@ -2126,7 +2126,7 @@ void qwarks_starfighter_update(Moby388 *moby) { 0); } func_L13_002E9F90_2(moby, starfighter_vars); - if (fast_dec_timer(&starfighter_vars->iF8) != 0) { + if (fast_dec_timer(&starfighter_vars->attack_and_death_timer_frames) != 0) { Moby388 *owner = (Moby388 *)((char *)moby_base + (starfighter_vars->linked_ship_moby_index << 8)); owner->state = 8; owner->flags |= 2; @@ -2142,9 +2142,9 @@ void qwarks_starfighter_update(Moby388 *moby) { case STARFIGHTER_STATE_RESET: { char *path; char **parts; - if (starfighter_vars->pF0 != 0) { - mark_moby_for_removal(starfighter_vars->pF0); - starfighter_vars->pF0 = 0; + if (starfighter_vars->command_joint_attachment_moby != 0) { + mark_moby_for_removal(starfighter_vars->command_joint_attachment_moby); + starfighter_vars->command_joint_attachment_moby = 0; } if (starfighter_vars->child110 != 0) { mark_moby_for_removal(starfighter_vars->child110); @@ -2193,15 +2193,15 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->path_target_node_index = 0; starfighter_vars->path_previous_node_index = 0; starfighter_vars->iA0 = 0; - starfighter_vars->fA4 = 0; - starfighter_vars->fA8 = 0; - starfighter_vars->fAC = 0; + starfighter_vars->pitch_spring_velocity = 0; + starfighter_vars->yaw_spring_velocity = 0; + starfighter_vars->flight_speed = 0; starfighter_vars->iF4 = 0; - starfighter_vars->iF8 = 0; - starfighter_vars->bFC = 0; - starfighter_vars->bFD = 0; - starfighter_vars->bFE = 0; - starfighter_vars->bFF = 0; + starfighter_vars->attack_and_death_timer_frames = 0; + starfighter_vars->rocket_muzzle_toggle = 0; + starfighter_vars->attack_sequence_counter = 0; + starfighter_vars->mine_attack_selected = 0; + starfighter_vars->tractor_beam_capture_active = 0; starfighter_vars->tractor_beam_cycle_timer_frames = 0; starfighter_vars->b10D = 0; starfighter_vars->b10E = 0; @@ -2211,8 +2211,8 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->queued_voice_line_pending = 0; starfighter_vars->selected_path_slot = 0; starfighter_vars->voice_line_history_mask = 0; - starfighter_vars->h144 = 0; - starfighter_vars->h146 = 0; + starfighter_vars->long_voice_line_cooldown_frames = 0; + starfighter_vars->short_voice_line_cooldown_frames = 0; starfighter_vars->b148 = 0; moby->bBC = 0; qzero(&starfighter_vars->f70); @@ -2277,7 +2277,7 @@ void qwarks_starfighter_update(Moby388 *moby) { if (moby->state >= STARFIGHTER_STATE_FOLLOW_INITIAL_PATH) { update_moby_joint_attachments(moby, starfighter_vars); if (moby->state != STARFIGHTER_STATE_EXPLODE_AND_REMOVE || - scale_game_frames(0x78) < starfighter_vars->iF8) { + scale_game_frames(0x78) < starfighter_vars->attack_and_death_timer_frames) { emit_gated_moby_joint_effects(moby, starfighter_vars); } if (starfighter_vars->snd114 != -1) { @@ -2323,8 +2323,8 @@ void qwarks_starfighter_update(Moby388 *moby) { if (starfighter_vars->queued_voice_line_pending != 0) { if (dialogue_playback_phase[0] == 3) { continue_audio_stream_if_ready(); - starfighter_vars->h144 = scale_game_frames(0x168); - starfighter_vars->h146 = scale_game_frames(0x3C); + starfighter_vars->long_voice_line_cooldown_frames = scale_game_frames(0x168); + starfighter_vars->short_voice_line_cooldown_frames = scale_game_frames(0x3C); starfighter_vars->queued_voice_line_pending = 0; } } else { @@ -2341,8 +2341,8 @@ void qwarks_starfighter_update(Moby388 *moby) { } } } - fast_dec_timer_s16(&starfighter_vars->h144); - fast_dec_timer_s16(&starfighter_vars->h146); + fast_dec_timer_s16(&starfighter_vars->long_voice_line_cooldown_frames); + fast_dec_timer_s16(&starfighter_vars->short_voice_line_cooldown_frames); if (moby->state >= STARFIGHTER_STATE_FOLLOW_INITIAL_PATH && moby->state <= STARFIGHTER_STATE_TRACTOR_BEAM && (((unsigned char *)D_0013E533)[0x242C] & 1)) { From c82523abc0e086517152d5da4addf91bc3440996 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:46:51 +0000 Subject: [PATCH 724/758] decomp: clarify names in robosquawker_update h20A -> ground_idle_preference: Retail 002b5570-002b55cc tests vars+0x20A: nonzero initializes GROUND_IDLE, zero raises Z by six and initializes FLIGHT_IDLE. In ground idle 002b64f0-002b650c permits distance-triggered TAKEOFF only when this field is zero. This describes a preference, not an absolute flight prohibition. h214 -> alert_timer_frames: Retail 002b5224-002b523c refreshes vars+0x214 to scaled 240 frames on the refresh flag. 002b5254-002b5268 decrements it and retains initial engagement radius while active; 002b51e0-002b5204 bypasses target clip rejection while active. h216 -> walk_range_radius: Retail 002b7838-002b7858 computes XY distance to walk_range_anchor+0x10 and compares it with vars+0x216 converted from short to float. Exceeding this radius enters RETURN_HOME at 002b7868-002b7878. h26 -> damage_cooldown_frames: Retail 002b52ac-002b5300 decrements vars+0x26, gates damage below scaled 45 frames, and suppresses repeated class B0/B1 damage while nonzero. Surviving damage resets it to scaled 60 at 002b5514-002b5520. w1B8 -> ground_movement_flags: Retail 002b562c-002b564c sets bits 0x30 in vars+0x1B8. The ground movement record is vars+0x180 at 002b6b6c; checked helper 00264918 (request 6479ae938e8645d3a1e3a33484b56250) keeps that pointer in s1. Its record+0x38 reads select alternate yaw using bit 4 at 00264a18-00264a48, suppress gravity using bit 1 at 00264a64-00264a94, and control ground rejection using bit 8 at 00264bd8-00264c38. Thus this word is the ground movement option bitset. w20C -> random_flight_timer_frames: Retail 002b591c-002b594c decrements vars+0x20C and on expiration resets a scaled random 40..120 frame delay before selecting a random flight destination and entering FLY_TO_RANDOM_POINT. Path collision resets the same timer to scaled 120 at 002b5d30-002b5d3c. w210 -> chase_yaw_flip_timer_frames: Retail 002b5830-002b5838 initializes vars+0x210 with scaled random 30..90 frames. CHASE_TARGET at 002b6b80-002b6bc4 decrements it, resets the delay on expiration, and negates chase_yaw_offset_radians. w21C -> ground_navigation_path_index: Retail 002b6a94-002b6acc tests vars+0x21C against -1, scales it by four to index walker_paths at 001b07b0, and passes the selected list with the pursuit target to select_list_point_toward_target. RETURN_HOME uses this same index with home_position at 002b7014-002b7048. w220 -> flight_path_index: Retail 002b5674-002b56a8 indexes walker_paths with vars+0x220 and initializes a waypoint index by distance. Flight idle 002b5884-002b5918 uses that path's waypoint to populate flight_destination and enter FOLLOW_FLIGHT_PATH; 002b5c28-002b5c60 loads the same flight path. w224 -> flight_waypoint_index: Retail 002b56a8 saves select_point_index_by_distance output to vars+0x224. 002b589c-002b590c addresses path+16+index*16, increments the index near a waypoint, wraps it against the path count, and copies the waypoint into flight_destination. FOLLOW_FLIGHT_PATH repeats this at 002b5e50-002b5e88. w22C -> target_clip_volume_index: Retail 002b51ec-002b5204 loads vars+0x22C as a1 for is_point_inside_clip_volume with the selected target record as a0, skipping the check for sentinel -1. A false check clears the selected target at 002b520c-002b5214. w38 -> alert_refresh_requested: Retail 002b5224-002b523c tests vars+0x38, sets the alert timer vars+0x214 to scale_game_frames(240) if nonzero, then unconditionally clears vars+0x38. The following timer-controlled engagement-radius and clip-filter behavior proves the consumed request's role. --- src/overlays/l13/mobys/robosquawker.c | 120 +++++++++++++------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/src/overlays/l13/mobys/robosquawker.c b/src/overlays/l13/mobys/robosquawker.c index 10008f65a8..e62beb3f8d 100644 --- a/src/overlays/l13/mobys/robosquawker.c +++ b/src/overlays/l13/mobys/robosquawker.c @@ -263,11 +263,11 @@ typedef struct { char pad0[0x20]; float f20; short h24; - short h26; + short damage_cooldown_frames; unsigned char b28; unsigned char b29; char pad2A[0xE]; - int w38; + int alert_refresh_requested; char pad3C[4]; RsVec v40; char pad50[8]; @@ -303,7 +303,7 @@ typedef struct { char pad19C[8]; float ground_movement_step_length; char pad1A8[0x10]; - int w1B8; + int ground_movement_flags; char pad1BC[0x14]; RsVec home_position; RsVec flight_destination; @@ -314,17 +314,17 @@ typedef struct { float default_target_engagement_radius; float walking_speed; short h208; - short h20A; - int w20C; - int w210; - short h214; - short h216; + short ground_idle_preference; + int random_flight_timer_frames; + int chase_yaw_flip_timer_frames; + short alert_timer_frames; + short walk_range_radius; char *walk_range_anchor; - int w21C; - int w220; - int w224; + int ground_navigation_path_index; + int flight_path_index; + int flight_waypoint_index; void *p228; - int w22C; + int target_clip_volume_index; unsigned char x230[1]; } RsVars; @@ -502,20 +502,20 @@ void robosquawker_update(RsMoby *robosquawker_moby) { (char *)robosquawker_moby, (char *)&selected_target_record, robosquawker_vars->target_engagement_radius + 4.0f); tm = selected_target_record.moby; if (tm == 0 || - (robosquawker_vars->h214 == 0 && robosquawker_vars->w22C != -1 && - is_point_inside_clip_volume(&selected_target_record, robosquawker_vars->w22C) == 0)) { + (robosquawker_vars->alert_timer_frames == 0 && robosquawker_vars->target_clip_volume_index != -1 && + is_point_inside_clip_volume(&selected_target_record, robosquawker_vars->target_clip_volume_index) == 0)) { selected_target_record.moby = 0; tm = 0; qzero(&selected_target_record); } qcopy(&previous_position, &robosquawker_moby->pos); - if (robosquawker_vars->w38 != 0) { - robosquawker_vars->h214 = scale_game_frames(0xF0); + if (robosquawker_vars->alert_refresh_requested != 0) { + robosquawker_vars->alert_timer_frames = scale_game_frames(0xF0); } - robosquawker_vars->w38 = 0; + robosquawker_vars->alert_refresh_requested = 0; fast_dec_timer_s16(&robosquawker_vars->h208); if (robosquawker_moby->state != ROBOSQUAWKER_STATE_INITIALIZE) { - if (fast_dec_timer_s16(&robosquawker_vars->h214) != 0) { + if (fast_dec_timer_s16(&robosquawker_vars->alert_timer_frames) != 0) { robosquawker_vars->target_engagement_radius = robosquawker_vars->home_position.f[3]; } else { robosquawker_vars->target_engagement_radius = robosquawker_vars->default_target_engagement_radius; @@ -525,10 +525,10 @@ void robosquawker_update(RsMoby *robosquawker_moby) { hit = FUN_L00_0025a420(robosquawker_moby, 0x330000, 0); resolve_moby_hit_response( robosquawker_moby, hit, &robosquawker_vars->f20, 0, &hits, &dmg, 0, 4); - fast_dec_timer_s16(&robosquawker_vars->h26); - if (robosquawker_vars->h26 < scale_game_frames(0x2D) && hit != 0 && + fast_dec_timer_s16(&robosquawker_vars->damage_cooldown_frames); + if (robosquawker_vars->damage_cooldown_frames < scale_game_frames(0x2D) && hit != 0 && robosquawker_moby->state != ROBOSQUAWKER_STATE_DEATH_KNOCKBACK) { - if (hit->src->hA6 >= 0xB0 && hit->src->hA6 <= 0xB1 && robosquawker_vars->h26 != 0) { + if (hit->src->hA6 >= 0xB0 && hit->src->hA6 <= 0xB1 && robosquawker_vars->damage_cooldown_frames != 0) { hit->damage_amount = 0.0f; } if (robosquawker_moby->command_recipient_list_index != 0xFF) { @@ -583,7 +583,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_moby->state = ROBOSQUAWKER_STATE_DAMAGE_KNOCKBACK; release_robosquawker_particle((Level13VendorMoby *)robosquawker_vars); *(unsigned char *)&robosquawker_vars->x110[7] = 0xFA; - robosquawker_vars->h26 = scale_game_frames(0x3C); + robosquawker_vars->damage_cooldown_frames = scale_game_frames(0x3C); trooper_anim_update(robosquawker_moby, (short *)robosquawker_vars->x110); } } @@ -593,7 +593,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { case ROBOSQUAWKER_STATE_INITIALIZE: qcopy(&robosquawker_vars->home_position, &robosquawker_moby->pos); robosquawker_vars->home_position.f[3] = robosquawker_vars->target_engagement_radius; - if (robosquawker_vars->h20A != 0) { + if (robosquawker_vars->ground_idle_preference != 0) { robosquawker_moby->state = ROBOSQUAWKER_STATE_GROUND_IDLE; if (robosquawker_moby->animation_index != 3) { blend_moby_animation(robosquawker_moby, 3, 0, 0); @@ -605,7 +605,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { blend_moby_animation(robosquawker_moby, 0, 0, 0); } } - robosquawker_vars->h214 = 0; + robosquawker_vars->alert_timer_frames = 0; robosquawker_vars->h208 = 0; robosquawker_vars->b29 = 0; robosquawker_vars->f20 = 1.0f; @@ -617,14 +617,14 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->ground_max_rise_height = 2.0f; robosquawker_vars->ground_max_drop_height = 2.0f; robosquawker_vars->ground_movement_step_length = robosquawker_vars->walking_speed * frame_time; - robosquawker_vars->w1B8 |= 0x30; + robosquawker_vars->ground_movement_flags |= 0x30; if (rand() & 1) { robosquawker_moby->h34 |= 0x8000; } robosquawker_vars->pD0 = &D_L13_001613A0; - if (robosquawker_vars->w220 != -1) { - robosquawker_vars->w224 = select_point_index_by_distance( - &robosquawker_moby->pos, walker_paths[robosquawker_vars->w220], 0.0f); + if (robosquawker_vars->flight_path_index != -1) { + robosquawker_vars->flight_waypoint_index = select_point_index_by_distance( + &robosquawker_moby->pos, walker_paths[robosquawker_vars->flight_path_index], 0.0f); } break; case ROBOSQUAWKER_STATE_FLIGHT_IDLE: { @@ -646,7 +646,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } @@ -654,23 +654,23 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_moby->state = ROBOSQUAWKER_STATE_LAND; clear_u64_value(&robosquawker_vars->v40); robosquawker_moby->bBC = 0; - } else if (robosquawker_vars->w220 != -1) { + } else if (robosquawker_vars->flight_path_index != -1) { char *path; - path = walker_paths[robosquawker_vars->w220]; - if (fast_vec_dist(&robosquawker_moby->pos, path + (robosquawker_vars->w224 * 16 + 16)) < + path = walker_paths[robosquawker_vars->flight_path_index]; + if (fast_vec_dist(&robosquawker_moby->pos, path + (robosquawker_vars->flight_waypoint_index * 16 + 16)) < 0.25f) { - robosquawker_vars->w224 += 1; - if (robosquawker_vars->w224 >= *(int *)path) { - robosquawker_vars->w224 = 0; + robosquawker_vars->flight_waypoint_index += 1; + if (robosquawker_vars->flight_waypoint_index >= *(int *)path) { + robosquawker_vars->flight_waypoint_index = 0; } } - qcopy(&robosquawker_vars->flight_destination, path + robosquawker_vars->w224 * 16 + 16); + qcopy(&robosquawker_vars->flight_destination, path + robosquawker_vars->flight_waypoint_index * 16 + 16); robosquawker_moby->state = ROBOSQUAWKER_STATE_FOLLOW_FLIGHT_PATH; - } else if (fast_dec_timer(&robosquawker_vars->w20C) != 0) { + } else if (fast_dec_timer(&robosquawker_vars->random_flight_timer_frames) != 0) { int i; - robosquawker_vars->w20C = scale_game_frames(FUN_L00_00257b90(0x28, 0x78)); + robosquawker_vars->random_flight_timer_frames = scale_game_frames(FUN_L00_00257b90(0x28, 0x78)); for (i = 0; i < 10; i++) { float r; float a; @@ -734,7 +734,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { float a; float d; - path = walker_paths[robosquawker_vars->w220]; + path = walker_paths[robosquawker_vars->flight_path_index]; a = fast_arc_tan(robosquawker_vars->flight_destination.f[0] - robosquawker_moby->pos.f[0], robosquawker_vars->flight_destination.f[1] - robosquawker_moby->pos.f[1]); FUN_L00_00258278( @@ -746,7 +746,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (coll_sphere(1.2f, &va, 0, robosquawker_moby) != 0) { int i; - robosquawker_vars->w20C = scale_game_frames(0x78); + robosquawker_vars->random_flight_timer_frames = scale_game_frames(0x78); for (i = 0; i < 10; i++) { float r; float an; @@ -773,11 +773,11 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (d < fast_vec_length(&robosquawker_vars->v40)) { float g; - robosquawker_vars->w224 += 1; - if (robosquawker_vars->w224 >= *(int *)path) { - robosquawker_vars->w224 = 0; + robosquawker_vars->flight_waypoint_index += 1; + if (robosquawker_vars->flight_waypoint_index >= *(int *)path) { + robosquawker_vars->flight_waypoint_index = 0; } - qcopy(&robosquawker_vars->flight_destination, path + robosquawker_vars->w224 * 16 + 16); + qcopy(&robosquawker_vars->flight_destination, path + robosquawker_vars->flight_waypoint_index * 16 + 16); robosquawker_vars->flight_destination.f[2] = robosquawker_vars->flight_destination.f[2] + random_float_between(-0.2f, 0.2f); g = probe_ground_height(&robosquawker_moby->pos, 0x120, 0.5f); @@ -796,7 +796,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->w210 = + robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); @@ -828,7 +828,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; clear_u64_value(&robosquawker_vars->v40); if (robosquawker_moby->animation_index != 5) { @@ -873,14 +873,14 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } robosquawker_moby->bBC = 0; } else if (fast_vec_length(&va) > robosquawker_vars->target_engagement_radius + 6.0f && - robosquawker_vars->h20A == 0) { + robosquawker_vars->ground_idle_preference == 0) { qzero(&robosquawker_vars->v40); robosquawker_moby->state = ROBOSQUAWKER_STATE_TAKEOFF; if (robosquawker_moby->animation_index != 0) { @@ -952,7 +952,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 8, scale_game_frames(3)); } @@ -980,7 +980,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); @@ -991,7 +991,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; } robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); @@ -1012,9 +1012,9 @@ void robosquawker_update(RsMoby *robosquawker_moby) { r = absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]); r = r / vector_distance_xy(&robosquawker_moby->pos, &selected_target_record); - if (robosquawker_vars->w21C != -1) { + if (robosquawker_vars->ground_navigation_path_index != -1) { select_list_point_toward_target(robosquawker_moby, - walker_paths[robosquawker_vars->w21C], + walker_paths[robosquawker_vars->ground_navigation_path_index], &selected_target_record, &vb); } else { @@ -1029,8 +1029,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { va.f[2] = 0.0f; res = move_moby_with_ground_and_collision_checks( robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); - if (fast_dec_timer(&robosquawker_vars->w210) != 0) { - robosquawker_vars->w210 = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + if (fast_dec_timer(&robosquawker_vars->chase_yaw_flip_timer_frames) != 0) { + robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_vars->chase_yaw_offset_radians = -robosquawker_vars->chase_yaw_offset_radians; } fast_vec_sub(&vc, &selected_target_record, &robosquawker_vars->home_position); @@ -1119,9 +1119,9 @@ void robosquawker_update(RsMoby *robosquawker_moby) { int res; float a; - if (robosquawker_vars->w21C != -1) { + if (robosquawker_vars->ground_navigation_path_index != -1) { select_list_point_toward_target(robosquawker_moby, - walker_paths[robosquawker_vars->w21C], + walker_paths[robosquawker_vars->ground_navigation_path_index], &robosquawker_vars->home_position, &vb); } else { @@ -1216,9 +1216,9 @@ void robosquawker_update(RsMoby *robosquawker_moby) { r = absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]); r = r / vector_distance_xy(&robosquawker_moby->pos, &selected_target_record); - if (robosquawker_vars->w21C != -1) { + if (robosquawker_vars->ground_navigation_path_index != -1) { select_list_point_toward_target(robosquawker_moby, - walker_paths[robosquawker_vars->w21C], + walker_paths[robosquawker_vars->ground_navigation_path_index], &robosquawker_vars->home_position, &vb); } else { @@ -1318,7 +1318,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { } if (robosquawker_vars->walk_range_anchor == 0 || vector_distance_xy(&robosquawker_moby->pos, robosquawker_vars->walk_range_anchor + 0x10) > - convert_integer_to_float(robosquawker_vars->h216)) { + convert_integer_to_float(robosquawker_vars->walk_range_radius)) { robosquawker_moby->state = ROBOSQUAWKER_STATE_RETURN_HOME; if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); From 781c929f6e4840fc5187306598f48bbdbc3ab65f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:46:54 +0000 Subject: [PATCH 725/758] decomp: clarify names in birdbot_update fE8 -> fall_motion_step: Retail 0x002e8a04-0x002e8a5c loads vars+0xE8, adds frame_time_sq*9.8, subtracts that accumulated step from moby Z (the temporary +2/-2 offsets cancel), and clears it on ground contact. Exact C and original Ghidra prove persistent downward fall motion per update. h1A4 -> burst_shots_fired: Retail 0x002e74e0 and 0x002e8024 clear vars+0x1A4 on FIRE_BURST entry. The projectile spawn at 0x002e7c98 is immediately followed by its increment at 0x002e7ca0-0x002e7ca8; comparison against four at 0x002e7cc8-0x002e7cd0 terminates the burst. h1A6 -> steering_path_node_index: Retail 0x002e8148-0x002e8178 derives vars+0x1A6 from the nearest node relative to main.idx, or copies main.idx when there are no marked stops. At 0x002e817c-0x002e8194 it indexes main.path points used for heading and movement; arrival separately tests main.idx at 0x002e8324. h1AC -> ordered_path_traversal: The supplied select_birdbot_path_node C maps the same vars+0x1AC short to PathPickVars.ordered: nonzero advances the selected index in path direction until a marked stop or last node. Assigned retail 0x002e75c0-0x002e75e0 also forbids further repositioning from the final node when this short is nonzero. This proves ordered path traversal mode. h1AE -> path_has_stop_nodes: Retail 0x002e7188-0x002e71fc clears vars+0x1AE and sets it when any main.path point has W==1.0. The supplied path picker maps this same short to stops_only and filters nodes by that marker. Assigned movement 0x002e80d4-0x002e8178 uses it to steer through intervening nearest nodes toward the selected stop. h1EC -> deployment_vertical_steering_timer: During cuboid-directed deployment the root saves motion Z at 0x002e7914, steers the motion vector, then decrements vars+0x1EC at 0x002e79fc-0x002e7a08. When the timer reaches zero, saved Z is restored before movement, so vertical steering is allowed only while this timer remains active. h1EE -> skip_path_braking: Retail 0x002e837c-0x002e83c4 applies gradual path-step reduction only when movement is positive and vars+0x1EE is zero. A nonzero short branches to target facing and immediately clears path_movement_step_length at 0x002e844c-0x002e84a4. Exact C proves this flag skips gradual path braking. h26 -> hit_reaction_cooldown: Retail 0x002e6d14-0x002e6d28 decrements vars+0x26 with the signed-short timer helper and skips hit reaction processing while nonzero. Fatal setup stores scale_game_frames(60) at 0x002e6ee8-0x002e6ef4, proving a hit-reaction cooldown rather than a state ID. w190 -> firing_retry_timer: Retail 0x002e73b0-0x002e73b4 decrements vars+0x190 and 0x002e7448-0x002e744c requires zero before a firing attempt. Obstructed muzzle collision sets it to scale_game_frames(60) at 0x002e7520-0x002e752c; successful burst entry clears it. Recovery also decrements this same firing-retry timer at 0x002e7dcc. w1C0 -> deployment_trigger_volume_index: In WAIT_FOR_TRIGGER, retail 0x002e768c-0x002e769c passes hero position and vars+0x1C0 to is_point_inside_clip_volume. A nonzero containment result joins deployment activation, alongside target-distance and external override conditions. The typed source proves this is the deployment trigger's clip-volume index. w1C4 -> deployment_mount_cuboid_index: Retail 0x002e76b0-0x002e76f0 checks vars+0x1C4 against -1, multiplies it by 0x80 to index l01_cuboids, and supplies that cuboid's position and rotation to jet_mount. At 0x002e7638-0x002e7668 it guards mount release and is invalidated to -1, proving the deployment mount cuboid index. w1C8 -> mount_release_timer: Retail 0x002e76f8-0x002e7704 stores scale_game_frames(360) to vars+0x1C8 after jet_mount. Entry 0x002e6c8c-0x002e6c9c decrements positive values each update. In tracking, zero triggers jet_end_mount, restores hero idle and clears cutscene state at 0x002e762c-0x002e7668; initialization uses -1 as inactive sentinel. w1E4 -> deployment_destination_cuboid_index: Retail 0x002e787c-0x002e78b4 checks vars+0x1E4 against -1 and indexes l01_cuboids with a 0x80 stride to compute a destination heading. 0x002e7918-0x002e793c steers deployment motion toward that cuboid position; 0x002e7a1c-0x002e7a50 tests distance to it for deployment completion. w1E8 -> deployment_trigger_override: Retail 0x002e76a4-0x002e76b0 reads vars+0x1E8 only after both deployment distance and hero clip-volume tests fail. Nonzero still joins the same activation branch that writes DEPLOY at 0x002e7748-0x002e7750. Exact C proves an override for the normal spatial deployment triggers, without identifying its writer. --- src/overlays/l01/mobys/birdbot.c | 110 +++++++++++++++---------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/src/overlays/l01/mobys/birdbot.c b/src/overlays/l01/mobys/birdbot.c index a5fd9cc89c..30276571fa 100644 --- a/src/overlays/l01/mobys/birdbot.c +++ b/src/overlays/l01/mobys/birdbot.c @@ -299,7 +299,7 @@ typedef struct { char pad0[0x20]; float f20; short h24; - short h26; + short hit_reaction_cooldown; unsigned char hit_response_profile_index; unsigned char b29; char pad2A[0xE]; @@ -332,7 +332,7 @@ typedef struct { float fD8; float fDC; char padE0[8]; - float fE8; + float fall_motion_step; float fEC; char padF0[4]; float fF4; @@ -346,31 +346,31 @@ typedef struct { PeCursor main; char pad168[0x18]; Vec4 projectile_aim_point; - int w190; + int firing_retry_timer; float yaw_turn_step; float projectile_aim_distance; char pad19C[4]; float combat_target_radius; - short h1A4; - short h1A6; + short burst_shots_fired; + short steering_path_node_index; float deployment_trigger_radius; - short h1AC; - short h1AE; + short ordered_path_traversal; + short path_has_stop_nodes; char pad1B0[4]; int w1B4; float path_movement_step_length; float pitch_turn_step; - int w1C0; - int w1C4; - int w1C8; + int deployment_trigger_volume_index; + int deployment_mount_cuboid_index; + int mount_release_timer; float previous_animation_frame; Vec4 deployment_motion_delta; unsigned short h1E0; short h1E2; - int w1E4; - int w1E8; - short h1EC; - short h1EE; + int deployment_destination_cuboid_index; + int deployment_trigger_override; + short deployment_vertical_steering_timer; + short skip_path_braking; char pad1F0[0x10]; unsigned char x200[1]; } PeVars; @@ -543,8 +543,8 @@ void birdbot_update(PeMoby *birdbot_moby) { } FUN_L00_00263ac8_u(2.5f, (int)birdbot_moby, 2, birdbot_vars->x200); qcopy(&birdbot_position_before_update, &birdbot_moby->pos); - if (birdbot_vars->w1C8 > 0) { - birdbot_vars->w1C8--; + if (birdbot_vars->mount_release_timer > 0) { + birdbot_vars->mount_release_timer--; } if (birdbot_moby->state != BIRDBOT_STATE_INITIALIZE) { path_reposition_requested = select_birdbot_path_node(birdbot_moby, &idx); @@ -553,8 +553,8 @@ void birdbot_update(PeMoby *birdbot_moby) { select_moby_combat_target(birdbot_moby, &selected_combat_target, target_search_radius); hit = find_moby_hit(birdbot_moby, 0x210000, 0); kind = FUN_L00_0025a478_u(birdbot_moby, hit, &birdbot_vars->f20, 0, &hits, &dmg, 0, 4); - fast_dec_timer_s16(&birdbot_vars->h26); - if (hit != 0 && birdbot_vars->h26 == 0) { + fast_dec_timer_s16(&birdbot_vars->hit_reaction_cooldown); + if (hit != 0 && birdbot_vars->hit_reaction_cooldown == 0) { if (hit->src != 0) { struct Hero *player = &hero; @@ -603,7 +603,7 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_moby->state = BIRDBOT_STATE_FATAL_KNOCKBACK; birdbot_moby->h34 &= 0xEFFF; trooper_anim_update(birdbot_moby, (short *)birdbot_vars->x60); - birdbot_vars->h26 = scale_game_frames(0x3C); + birdbot_vars->hit_reaction_cooldown = scale_game_frames(0x3C); break; case BIRDBOT_HIT_REACTION_NONFATAL_KNOCKBACK: case BIRDBOT_HIT_REACTION_ANIMATED_NONFATAL_KNOCKBACK: @@ -677,10 +677,10 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_moby->pos.f[2] += 20.0f; } } - birdbot_vars->h1AE = 0; + birdbot_vars->path_has_stop_nodes = 0; for (i = 0; i < c->path->count; i++) { if (c->path->points[i].f[3] == 1.0f) { - birdbot_vars->h1AE = 1; + birdbot_vars->path_has_stop_nodes = 1; } } birdbot_moby->h34 |= 0x1000; @@ -703,7 +703,7 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->b29 = 0; birdbot_vars->hit_response_profile_index = 1; clear_u64_value(&birdbot_vars->v40); - birdbot_vars->w1C8 = -1; + birdbot_vars->mount_release_timer = -1; if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); } @@ -724,12 +724,12 @@ void birdbot_update(PeMoby *birdbot_moby) { a = fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1]); FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); - fast_dec_timer(&birdbot_vars->w190); + fast_dec_timer(&birdbot_vars->firing_retry_timer); d = vector_distance_xy(&birdbot_moby->pos, &selected_combat_target); if ((flag ? d < birdbot_vars->combat_target_radius * 2.0f : d < birdbot_vars->combat_target_radius) && absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) < 2.0f && birdbot_moby->b31 != 0 && (!flag || path_reposition_requested == 0) && - birdbot_vars->w190 == 0 && + birdbot_vars->firing_retry_timer == 0 && fast_difference_between_rotations( birdbot_moby->rot.f[2], fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], @@ -739,15 +739,15 @@ void birdbot_update(PeMoby *birdbot_moby) { *(u128 *)&vb = *(u128 *)&birdbot_moby->pos; vb.f[2] = va.f[2]; if (collision_line(&vb, &va, 0, birdbot_moby, 0) == 0) { - birdbot_vars->h1A4 = 0; + birdbot_vars->burst_shots_fired = 0; birdbot_vars->projectile_aim_distance = 4.0f; birdbot_moby->state = BIRDBOT_STATE_FIRE_BURST; if (birdbot_moby->target_animation_sequence != 4) { blend_moby_animation(birdbot_moby, 4, 0, scale_game_frames(6)); } - birdbot_vars->w190 = 0; + birdbot_vars->firing_retry_timer = 0; } else { - birdbot_vars->w190 = scale_game_frames(0x3C); + birdbot_vars->firing_retry_timer = scale_game_frames(0x3C); } } else if (flag || (vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) < 4.0f && @@ -755,7 +755,7 @@ void birdbot_update(PeMoby *birdbot_moby) { 6.0f)) { if (path_reposition_requested != 0 && fast_vec_dist(&birdbot_moby->pos, (Vec4 *)c->path + (idx + 1)) > 0.25f) { - if (birdbot_vars->h1AC == 0 || c->idx < c->path->count - 1) { + if (birdbot_vars->ordered_path_traversal == 0 || c->idx < c->path->count - 1) { int i; float f; @@ -770,26 +770,26 @@ void birdbot_update(PeMoby *birdbot_moby) { } } } - if (birdbot_vars->w1C8 == 0 && birdbot_vars->w1C4 != -1) { + if (birdbot_vars->mount_release_timer == 0 && birdbot_vars->deployment_mount_cuboid_index != -1) { jet_end_mount(0); l01_hero_set_state(HERO_STATE_IDLE, 1); cutscene_active = 0; - birdbot_vars->w1C4 = -1; + birdbot_vars->deployment_mount_cuboid_index = -1; } break; } case BIRDBOT_STATE_WAIT_FOR_TRIGGER: if (vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) < birdbot_vars->deployment_trigger_radius || - is_point_inside_clip_volume(&hero.motion.pos, birdbot_vars->w1C0) != 0 || - birdbot_vars->w1E8 != 0) { - if (birdbot_vars->w1C4 != -1) { + is_point_inside_clip_volume(&hero.motion.pos, birdbot_vars->deployment_trigger_volume_index) != 0 || + birdbot_vars->deployment_trigger_override != 0) { + if (birdbot_vars->deployment_mount_cuboid_index != -1) { LevelCuboid *p; l01_hero_set_state(0x1F, 0); - p = &l01_cuboids[birdbot_vars->w1C4]; + p = &l01_cuboids[birdbot_vars->deployment_mount_cuboid_index]; jet_mount(&p->pos, &p->rot, 0, 0, 0); cutscene_active = 1; - birdbot_vars->w1C8 = scale_game_frames(0x168); + birdbot_vars->mount_release_timer = scale_game_frames(0x168); } birdbot_moby->w94 = *(int *)(birdbot_moby->w24 + 0x10); birdbot_moby->h34 &= 0xFFBE; @@ -830,20 +830,20 @@ void birdbot_update(PeMoby *birdbot_moby) { side_path_cursor->idx = side_path_next_node_index; } } - } else if (birdbot_vars->w1E4 != -1) { + } else if (birdbot_vars->deployment_destination_cuboid_index != -1) { LevelCuboid *p; float a; float deployment_step_length; float z; - p = (LevelCuboid *)((birdbot_vars->w1E4 << 7) + (int)l01_cuboids); + p = (LevelCuboid *)((birdbot_vars->deployment_destination_cuboid_index << 7) + (int)l01_cuboids); a = fast_arc_tan(p->pos.x - birdbot_moby->pos.f[0], p->pos.y - birdbot_moby->pos.f[1]); FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.01f, 0.3f, 0.1f); deployment_step_length = fast_vec_length(&birdbot_vars->deployment_motion_delta); z = birdbot_vars->deployment_motion_delta.f[2]; fast_vec_normalize( &birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, deployment_step_length * 0.95f); - fast_vec_sub(&vb, &l01_cuboids[birdbot_vars->w1E4].pos, &birdbot_moby->pos); + fast_vec_sub(&vb, &l01_cuboids[birdbot_vars->deployment_destination_cuboid_index].pos, &birdbot_moby->pos); fast_vec_normalize(&vb, &vb, deployment_step_length * 0.05f); fast_vec_add(&birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, &vb); if (frame_time * 10.0f < deployment_step_length) { @@ -853,11 +853,11 @@ void birdbot_update(PeMoby *birdbot_moby) { fast_vec_normalize(&vb, &birdbot_vars->deployment_motion_delta, frame_time_sq * 5.0f); fast_vec_add(&birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, &vb); } - if (fast_dec_timer_s16(&birdbot_vars->h1EC) == 0) { + if (fast_dec_timer_s16(&birdbot_vars->deployment_vertical_steering_timer) == 0) { birdbot_vars->deployment_motion_delta.f[2] = z; } fast_vec_add(&birdbot_moby->pos, &birdbot_moby->pos, &birdbot_vars->deployment_motion_delta); - if (fast_vec_dist(&birdbot_moby->pos, &l01_cuboids[birdbot_vars->w1E4].pos) < + if (fast_vec_dist(&birdbot_moby->pos, &l01_cuboids[birdbot_vars->deployment_destination_cuboid_index].pos) < frame_time * 10.0f) { if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); @@ -913,7 +913,7 @@ void birdbot_update(PeMoby *birdbot_moby) { yaw, pitch, truncate_float_to_s32(FUN_L04_001f1978(10.0f))); - birdbot_vars->h1A4++; + birdbot_vars->burst_shots_fired++; } else { if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); @@ -923,7 +923,7 @@ void birdbot_update(PeMoby *birdbot_moby) { } } if (frame < 2.0f) { - if (birdbot_vars->h1A4 >= 4 || + if (birdbot_vars->burst_shots_fired >= 4 || vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) > (flag ? birdbot_vars->combat_target_radius * 2.0f : birdbot_vars->combat_target_radius) || absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) > 6.0f) { @@ -942,7 +942,7 @@ void birdbot_update(PeMoby *birdbot_moby) { selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1]); FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); if (birdbot_moby->target_animation_sequence == 0) { - if (fast_dec_timer(&birdbot_vars->w190) != 0) { + if (fast_dec_timer(&birdbot_vars->firing_retry_timer) != 0) { if (birdbot_moby->target_animation_sequence != 5) { blend_moby_animation(birdbot_moby, 5, 0, scale_game_frames(0xF)); } @@ -969,7 +969,7 @@ void birdbot_update(PeMoby *birdbot_moby) { absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) < 2.0f && birdbot_moby->b31 != 0 && (!flag || path_reposition_requested == 0) && - birdbot_vars->w190 == 0 && + birdbot_vars->firing_retry_timer == 0 && fast_difference_between_rotations( birdbot_moby->rot.f[2], fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], @@ -979,16 +979,16 @@ void birdbot_update(PeMoby *birdbot_moby) { *(u128 *)&vb = *(u128 *)&birdbot_moby->pos; vb.f[2] = va.f[2]; if (collision_line(&vb, &va, 0, birdbot_moby, 0) == 0) { - birdbot_vars->h1A4 = 0; + birdbot_vars->burst_shots_fired = 0; birdbot_vars->projectile_aim_distance = 4.0f; birdbot_moby->state = BIRDBOT_STATE_FIRE_BURST; if (birdbot_moby->target_animation_sequence != 4) { blend_moby_animation(birdbot_moby, 4, 0, scale_game_frames(6)); } - birdbot_vars->w190 = 0; + birdbot_vars->firing_retry_timer = 0; break; } - birdbot_vars->w190 = scale_game_frames(0x3C); + birdbot_vars->firing_retry_timer = scale_game_frames(0x3C); } if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); @@ -1011,7 +1011,7 @@ void birdbot_update(PeMoby *birdbot_moby) { float path_node_height_offset; c = &birdbot_vars->main; - if (birdbot_vars->h1AE != 0) { + if (birdbot_vars->path_has_stop_nodes != 0) { int i; int best; float bd; @@ -1027,11 +1027,11 @@ void birdbot_update(PeMoby *birdbot_moby) { best = i; } } - birdbot_vars->h1A6 = c->idx < best ? best - 1 : best < c->idx ? best + 1 : c->idx; + birdbot_vars->steering_path_node_index = c->idx < best ? best - 1 : best < c->idx ? best + 1 : c->idx; } else { - birdbot_vars->h1A6 = c->idx; + birdbot_vars->steering_path_node_index = c->idx; } - qcopy(&va, &c->path->points[birdbot_vars->h1A6]); + qcopy(&va, &c->path->points[birdbot_vars->steering_path_node_index]); path_node_height_offset = 0.8f; va.f[2] += path_node_height_offset; FUN_L00_00258278_cf( @@ -1074,7 +1074,7 @@ void birdbot_update(PeMoby *birdbot_moby) { break; } case BIRDBOT_STATE_BRAKE_AND_FACE_TARGET: - if (birdbot_vars->path_movement_step_length > 0.0f && birdbot_vars->h1EE == 0) { + if (birdbot_vars->path_movement_step_length > 0.0f && birdbot_vars->skip_path_braking == 0) { birdbot_vars->path_movement_step_length -= *(float *)&birdbot_path_speed_scale_gp * 3.0f * frame_time_sq; va.f[0] = fast_cos(birdbot_moby->rot.f[2]) * birdbot_vars->path_movement_step_length; va.f[1] = fast_sin(birdbot_moby->rot.f[2]) * birdbot_vars->path_movement_step_length; @@ -1247,13 +1247,13 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_moby->state == 5 || birdbot_moby->state == BIRDBOT_STATE_FIRE_BURST || birdbot_moby->state == BIRDBOT_STATE_RECOVER_FROM_BURST || birdbot_moby->state == BIRDBOT_STATE_BRAKE_AND_FACE_TARGET) { - birdbot_vars->fE8 += frame_time_sq * 9.8f; - birdbot_moby->pos.f[2] -= birdbot_vars->fE8 - 2.0f; + birdbot_vars->fall_motion_step += frame_time_sq * 9.8f; + birdbot_moby->pos.f[2] -= birdbot_vars->fall_motion_step - 2.0f; ground = probe_ground_height(&birdbot_moby->pos, 0, 0.5f); birdbot_moby->pos.f[2] -= 2.0f; if (birdbot_moby->pos.f[2] < ground) { birdbot_moby->pos.f[2] = ground; - birdbot_vars->fE8 = 0.0f; + birdbot_vars->fall_motion_step = 0.0f; } } else { ground = probe_ground_height(&birdbot_moby->pos, 0, 0.5f); From 8ae5abd341ce576015b4ee7729bce019196b1673 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:51:12 +0000 Subject: [PATCH 726/758] decomp: clarify names in bomb_update h56 -> landing_prediction_disabled: Authoritative bomb_glove_bomb.c SHA-256 631099a28291412a34d4db1c1cb7881b6b50178d6528ce47d26ba07a6e3642aa tests BombData.h56 == 0 before every predict_throw_landing call. Retail 0x002adc80 loads the signed short at s6+0x56 and 0x002adc84 bypasses all three prediction calls at 0x002adcd0/0x002adce4/0x002adcfc when nonzero. Checked helper evidence 5006057622e949a4af92ea6fbdd57b7a proves the latch writer: 0x002ad598-0x002ad59c follows holder+0x78, 0x002ad5bc reads holder vars+0x50, and 0x002ad5c0 skips the store if zero; otherwise 0x002ad5c8-0x002ad5cc writes one to the same prediction data+0x56. Supplied spawn_bomb initializes +0x56 to zero. Thus it disables subsequent landing-prediction updates once set; the name does not infer the unknown holder condition. --- src/overlays/shared/weapons/bomb_glove_bomb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/weapons/bomb_glove_bomb.c b/src/overlays/shared/weapons/bomb_glove_bomb.c index 0ab46dc8aa..8d129c921b 100644 --- a/src/overlays/shared/weapons/bomb_glove_bomb.c +++ b/src/overlays/shared/weapons/bomb_glove_bomb.c @@ -110,7 +110,7 @@ typedef struct { char pad10[0x40]; M910 *owner; short fuse_timer; - short h56; + short landing_prediction_disabled; char pad58[0x10]; short splash_frame_counter; short color_animation_counter; @@ -1135,7 +1135,7 @@ void bomb_update(BombMoby *bomb_moby) { } else { bomb_moby->flags &= ~0x41; } - if (d->owner->cls == 0xC0 && d->h56 == 0 && FUN_001f9af0_2adb30(d) > 0.0f) { + if (d->owner->cls == 0xC0 && d->landing_prediction_disabled == 0 && FUN_001f9af0_2adb30(d) > 0.0f) { if (((G910 *)&hero)->ground_support_moby == 0 || FUN_L00_002603d0_2adb30(((G910 *)&hero)->ground_support_moby) == 0) { FUN_L00_002ad410_2adb30(d, bomb_moby, 1); } else if (FUN_L00_002ad410_2adb30(d, bomb_moby, 0) == 0) { From c301ec9c17d45bcb320e4d42a62918a5bff3ba67 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 16:51:12 +0000 Subject: [PATCH 727/758] decomp: clarify names in update_moving_hero_relative_alpha_fade_particle domain_0_value_1 -> MOVING_PARTICLE_POSITION_HERO_RELATIVE: The authoritative particles.c snapshot (SHA-256 83b8369370ae9eedaf50f86451d80d1d348de37dfb07252520226a5d1ab1e2ca) tests particle_data->hero_relative_position_mode == 1. Retail 0x002732b0 establishes particle_data=particle+0x20; 0x002732bc loads its +0x1C and 0x0027329c/0x002732c0 compare to 1. The selected path at 0x002732cc..0x00273308 adds hero XYZ at 0x0013F3D0..D8 to saved offsets at particle+0x30..0x38, adds motion, then 0x0027330c..0x0027333c subtracts hero XYZ to retain updated relative offsets. Original Ghidra confirms the same comparison and arithmetic. The supplied spawn_moving_hero_relative_alpha_fade_particle stores mode at particle+0x3C and initializes those offsets as position minus hero position for mode 1. Thus 1 denotes this particle's hero-relative position mode, independently of unrelated hero enums. --- src/overlays/shared/rendering/effects/particles.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index 5eddf0b111..701f162f82 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -1053,10 +1053,13 @@ 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) { + enum { + MOVING_PARTICLE_POSITION_HERO_RELATIVE = 1 + }; V_273298 *particle_data = (V_273298 *)((u8 *)particle + 0x20); float remaining_frames_minus_one; u32 color_without_alpha; - if (particle_data->hero_relative_position_mode == 1) { + if (particle_data->hero_relative_position_mode == MOVING_PARTICLE_POSITION_HERO_RELATIVE) { struct Hero *hero_reference = &hero; particle->x = hero_reference->motion.pos.f[0] + particle_data->x; particle->y = hero_reference->motion.pos.f[1] + particle_data->y; From 58d16ff1ffeb4a518d1638ceb2b2b56d463d0d46 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:02:47 +0000 Subject: [PATCH 728/758] decomp: clarify names in update_mode_controlled_orbiting_trail_particle domain_0_value_0 -> TRAIL_PARTICLE_MODE_ALPHA_FADE: The constructor stores mode at particle data+0x1C (particle+0x3C), matching retail lh at 0x00274540. The zero branch 0x0027454C-0x00274558 decrements packed alpha by data+0x1A and frees when depleted; 0x00274560-0x002745AC optionally adds a scaled stored XYZ offset to reference+0x10, then returns without emitting. The supplied decrement_packed_countdown implementation proves alpha fading; this is a particle-mode domain, unrelated to Hero enums. domain_1_value_1 -> TRAIL_PARTICLE_MODE_ORBITING_EMITTER: Retail 0x00274600-0x00274608 compares the same signed particle data+0x1C mode to 1. Its equal branch at 0x00274610-0x00274640 emits a mode-0 fading particle at the current position with no parent or offset. The same mode gates 0x002746BC-0x002747E8, which combines radius-2.25 and radius-0.28 trigonometric offsets, transforms by reference+0xC0, adds reference position, and advances both angles. This proves an orbiting trail emitter in the constructor's particle-mode domain. domain_2_value_1 -> TRAIL_PARTICLE_MODE_ORBITING_EMITTER: Retail 0x002746AC loads particle data+0x1C and 0x002746B0-0x002746B4 returns unless it equals 1, the identical selector/value used at 0x00274604. Only equality reaches reference-position copy 0x002746BC-0x002746C8, two trigonometric offsets and basis transform 0x002746D4-0x00274790, position addition 0x0027479C, and angle advancement 0x002747BC-0x002747E8. Reuse the same orbiting-emitter member for both comparisons. --- 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 701f162f82..9cd0fdf903 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -1604,13 +1604,17 @@ u8 *FUN_L00_002743a8_274518(s32, void *, s32, f32, f32, s32, s32, void *) __asm_ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) __asm__("FUN_L00_00274518"); void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { + enum { + TRAIL_PARTICLE_MODE_ALPHA_FADE = 0, + TRAIL_PARTICLE_MODE_ORBITING_EMITTER = 1 + }; R_274518 *r = &particle->r; V_274518 position_offset_scratch, secondary_position_offset, rotation_angles; V_274518 secondary_offset_rotation_matrix[4]; u8 *spawned_particle; f32 k1, k2, z; - if (r->trail_particle_mode == 0) { + if (r->trail_particle_mode == TRAIL_PARTICLE_MODE_ALPHA_FADE) { if (decrement_packed_countdown(particle->b4, r->alpha_fade_decrement)) goto kill; if (r->iC == 0) @@ -1632,7 +1636,7 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { return; } } - if (r->trail_particle_mode == 1) { + if (r->trail_particle_mode == TRAIL_PARTICLE_MODE_ORBITING_EMITTER) { z = 0.0f; FUN_L00_002743a8_274518(0, particle->v10, scale_game_frames(10), z, z, 0, particle->particle_alpha, 0); } else { @@ -1651,7 +1655,7 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { if (spawned_particle) *(s16 *)(spawned_particle + 0x38) = r->position_offset_multiplier; } - if (r->trail_particle_mode != 1) + if (r->trail_particle_mode != TRAIL_PARTICLE_MODE_ORBITING_EMITTER) return; qcopy(particle->v10, r->iC + 0x10); k1 = 2.25f; From 266a07aa75541832e4901df0bfeb86e9e6c68bf3 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:04:46 +0000 Subject: [PATCH 729/758] decomp: clarify names in birdbot_update h24 -> initial_health: In INITIALIZE the exact C sets f20=2.0f then assigns h24=truncate_float_to_s32(f20). Retail 0x002e7290 supplies 2.0 in f12, 0x002e72b8 calls integer truncation with delay-slot 0x002e72bc storing that same health to vars+0x20, and 0x002e72c8 stores the truncated return to vars+0x24. Health role of vars+0x20 is independently proved by damage subtraction and lethal test at 0x002e6db4-0x002e6dd4. This short saves initial health; no maximum-health or subsequent consumer behavior is asserted. hA6 -> moby_class_id: Retail 0x002e7128 loads moby+0xA6 as the first integer argument to DebugPrint at 0x002e7130. Checked data at 0x0020AF80 (request 50eadeb72e7f43f49cad3b0b9f0252dd) decodes to 'Moby class %d maya instance %d needs a rocketPath!\nMoby deleted\n'. Exact C passes hA6 first, proving the moby class identifier. Checked hit evaluator also compares source moby+0xA6 against class numbers at 0x0026f3f4-0x0026f404. hB2 -> maya_instance_id: Retail 0x002e712c loads moby+0xB2 as the second integer argument to the missing-path DebugPrint at 0x002e7130. Checked format bytes at 0x0020AF80, request 50eadeb72e7f43f49cad3b0b9f0252dd, label that second argument 'maya instance %d'. Exact C passes hB2 second, proving its diagnostic role as Maya instance identifier. w1B4 -> skip_initial_height_lift: When side.path_id is negative, INITIALIZE copies main.path's first point to moby position. Retail 0x002e7198-0x002e71a0 tests vars+0x1B4; nonzero skips 0x002e71a4-0x002e71b8, which clears side.path and adds 20.0f to moby Z. Exact C has the same if(w1B4==0) branch. Thus this field gates skipping the initial height lift, without identifying its producer or claiming its only effect is the lift. w24 -> moby_class_record: Assigned retail 0x002e7708-0x002e7720 reads moby+0x24 then restores moby+0x94 from that record+0x10 during deployment. Checked blend_moby_animation request 4a1c747e041547fbabe6231be13c5630 shows 0x0026c69c-0x0026c6b0 loading the same moby+0x24 pointer, indexing it by new_seq*4 at +0x48 and reading frame count. This matches supplied blend source moby->pClass->seqs[new_seq]->nframes; 0x0026c75c-0x0026c78c repeats the class sequence access. Thus w24 points to the moby class record. --- src/overlays/l01/mobys/birdbot.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l01/mobys/birdbot.c b/src/overlays/l01/mobys/birdbot.c index 30276571fa..5b986f80ac 100644 --- a/src/overlays/l01/mobys/birdbot.c +++ b/src/overlays/l01/mobys/birdbot.c @@ -298,7 +298,7 @@ typedef struct { typedef struct { char pad0[0x20]; float f20; - short h24; + short initial_health; short hit_reaction_cooldown; unsigned char hit_response_profile_index; unsigned char b29; @@ -357,7 +357,7 @@ typedef struct { short ordered_path_traversal; short path_has_stop_nodes; char pad1B0[4]; - int w1B4; + int skip_initial_height_lift; float path_movement_step_length; float pitch_turn_step; int deployment_trigger_volume_index; @@ -380,7 +380,7 @@ typedef struct PeMoby { Vec4 pos; unsigned char state; char pad21[3]; - char *w24; + char *moby_class_record; char pad28[9]; unsigned char b31; unsigned short h32; @@ -402,9 +402,9 @@ typedef struct PeMoby { char pad98[0xC]; unsigned char bA4; char padA5; - short hA6; + short moby_class_id; char padA8[0xA]; - short hB2; + short maya_instance_id; } PeMoby; typedef struct { @@ -660,7 +660,7 @@ void birdbot_update(PeMoby *birdbot_moby) { c = &birdbot_vars->main; if (birdbot_vars->main.path_id == -1) { - DebugPrint(birdbot_missing_path_format, birdbot_moby->hA6, birdbot_moby->hB2); + DebugPrint(birdbot_missing_path_format, birdbot_moby->moby_class_id, birdbot_moby->maya_instance_id); mark_moby_for_removal(birdbot_moby); return; } @@ -672,7 +672,7 @@ void birdbot_update(PeMoby *birdbot_moby) { qcopy(&birdbot_moby->pos, &birdbot_vars->side.path->points[0]); } else { qcopy(&birdbot_moby->pos, &birdbot_vars->main.path->points[0]); - if (birdbot_vars->w1B4 == 0) { + if (birdbot_vars->skip_initial_height_lift == 0) { birdbot_vars->side.path = 0; birdbot_moby->pos.f[2] += 20.0f; } @@ -699,7 +699,7 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->fDC = 2.0f; birdbot_vars->fD8 = 2.0f; birdbot_vars->f20 = 2.0f; - birdbot_vars->h24 = truncate_float_to_s32(birdbot_vars->f20); + birdbot_vars->initial_health = truncate_float_to_s32(birdbot_vars->f20); birdbot_vars->b29 = 0; birdbot_vars->hit_response_profile_index = 1; clear_u64_value(&birdbot_vars->v40); @@ -791,7 +791,7 @@ void birdbot_update(PeMoby *birdbot_moby) { cutscene_active = 1; birdbot_vars->mount_release_timer = scale_game_frames(0x168); } - birdbot_moby->w94 = *(int *)(birdbot_moby->w24 + 0x10); + birdbot_moby->w94 = *(int *)(birdbot_moby->moby_class_record + 0x10); birdbot_moby->h34 &= 0xFFBE; if (birdbot_moby->target_animation_sequence != 8) { blend_moby_animation(birdbot_moby, 8, 0, scale_game_frames(10)); From 7023bbf1210536beac0c787b3926380db43a062e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:06:56 +0000 Subject: [PATCH 730/758] decomp: clarify names in robosquawker_update w140 -> motion_collision_radius_fixed_point: Authoritative robosquawker.c SHA-256 08045aa2d1f6c8326074e044f510bc4bbd7d4555d5e640bb2151910394d4a6d1 and assigned retail 002b536c store 0x202 at vars+0x140, within the motion record passed as vars+0x120 at 002b67ac-002b67b8 and 002b7244-002b7250. Checked level-13 motion helper 002686e0 (report c9d7d559167615790ad069d16f8e7145daf543131701eb0284f68126f280239e) holds this record in s2. At 00268d18-00268d24 it loads record+0x20, converts the signed integer to float and multiplies by 0.0009765625 (1/1024). At 00268d58-00268d70 the same field and scale supply f12 to collision-sphere helper 001fc748 with proposed position as a0 and owning moby as a2. Thus it is the motion collision radius stored in fixed-point units; 00268c68-00268c90 also uses a slightly inflated scaled value for the nearby-moby query. w144 -> motion_behavior_flags: Assigned retail 002b53c0 sets vars+0x144 to 9 for damage motion and 002b6748-002b6758 sets it to 0xD for home hop. Both paths pass vars+0x120 to step_moby_motion, making this word motion-record+0x24. Checked level-13 consumer 002686e0 (report c9d7d559167615790ad069d16f8e7145daf543131701eb0284f68126f280239e) stores that record pointer in s2 at 00268700. At 00268bd0-00268bdc it reads +0x24 and tests bit 4 to bypass yaw steering; at 00268858-00268880 bit 0x10 enables ground probing at the displaced position, and at 00268cc0-00268cdc bit 0x20 gates a terminal-status option on a moby collision. Independent bit tests prove this is the motion behavior option bitset, rather than a state ID. --- src/overlays/l13/mobys/robosquawker.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l13/mobys/robosquawker.c b/src/overlays/l13/mobys/robosquawker.c index e62beb3f8d..8c28e54397 100644 --- a/src/overlays/l13/mobys/robosquawker.c +++ b/src/overlays/l13/mobys/robosquawker.c @@ -285,8 +285,8 @@ typedef struct { float motion_horizontal_speed_change_limit; float motion_horizontal_launch_step; float motion_vertical_launch_step; - int w140; - int w144; + int motion_collision_radius_fixed_point; + int motion_behavior_flags; float motion_bounce_restitution; char pad14C[0x11]; unsigned char b15D; @@ -539,14 +539,14 @@ void robosquawker_update(RsMoby *robosquawker_moby) { fast_arc_tan(robosquawker_moby->pos.f[0] - selected_target_record.pos.f[0], robosquawker_moby->pos.f[1] - selected_target_record.pos.f[1]); robosquawker_vars->motion_bounce_restitution = 0.5f; - robosquawker_vars->w140 = 0x202; + robosquawker_vars->motion_collision_radius_fixed_point = 0x202; robosquawker_vars->f20 -= hit->damage_amount; robosquawker_vars->motion_gravity_step = 0.0055f; robosquawker_vars->motion_horizontal_speed_change_limit = 0.0011f; robosquawker_vars->motion_horizontal_launch_step = robosquawker_damage_knockback_horizontal_speed_gp * frame_time; robosquawker_vars->motion_vertical_launch_step = robosquawker_damage_knockback_vertical_speed_gp * frame_time; - robosquawker_vars->w144 = 9; + robosquawker_vars->motion_behavior_flags = 9; robosquawker_vars->b15D = 0; if (robosquawker_vars->f20 <= 0.0f) { robosquawker_moby->h34 &= 0xEFFF; @@ -927,7 +927,7 @@ void robosquawker_update(RsMoby *robosquawker_moby) { &home_hop_travel_duration, robosquawker_home_hop_horizontal_speed_gp * frame_time, -robosquawker_home_hop_gravity_gp); - robosquawker_vars->w144 = 0xD; + robosquawker_vars->motion_behavior_flags = 0xD; robosquawker_vars->b15D = 0; trooper_start_knockback(robosquawker_moby, robosquawker_vars->x120, From 5e4832f97e1355d259c6da62c04f041aa50e14ea Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 17:12:30 +0000 Subject: [PATCH 731/758] decomp: clarify names in birdbot_update fC0 -> knockback_animation_target_frame: Bound C sets vars+0xC0 to 5.0 (fatal and ordinary recoverable hits) or 7.0 (low-speed hits), retail 0x002e6e70, 0x002e6f74, 0x002e706c. Root 0x002e8608/0x002e87c8 passes vars+0x70 to step_moby_motion. Checked helper request 9a20cec12027453dbf27d8d387d03874: s2 is this motion record at 0x00271578. In motion phase 0, 0x002718e8-0x00271910 obtains current animation frame, subtracts it from motion+0x50 (vars+0xC0), divides by abs(vertical_step/gravity_step), and uses the positive quotient to adjust moby+0x58 playback speed at 0x00271a10-0x00271a24. This proves an animation target frame used for knockback timing; no particular pose identity is asserted. fC4 -> knockback_animation_stop_frame: Bound C and retail 0x002e6e78/0x002e6f80/0x002e7078 set vars+0xC4 to 10.0 or 13.5 in knockback setup. Root calls step_moby_motion with vars+0x70 at 0x002e8608/0x002e87c8. Checked request 9a20cec12027453dbf27d8d387d03874 proves helper s2 is that record. Motion phase 1 at 0x00271918-0x00271938 compares compute_interpolated_record_value(moby) against motion+0x54 (vars+0xC4); when current frame reaches this threshold it writes zero to moby+0x58, the established animation_playback_speed. Before the threshold, 0x002719bc-0x00271a24 uses threshold minus current frame in playback timing. Thus it is the knockback animation stop frame in that phase. --- src/overlays/l01/mobys/birdbot.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l01/mobys/birdbot.c b/src/overlays/l01/mobys/birdbot.c index 5b986f80ac..eafd43661b 100644 --- a/src/overlays/l01/mobys/birdbot.c +++ b/src/overlays/l01/mobys/birdbot.c @@ -325,8 +325,8 @@ typedef struct { char pad9C[0x11]; unsigned char bAD; char padAE[0x12]; - float fC0; - float fC4; + float knockback_animation_target_frame; + float knockback_animation_stop_frame; char padC8[8]; char xD0[8]; float fD8; @@ -591,8 +591,8 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->knockback_gravity_step = frame_time_sq * 40.0f; birdbot_vars->knockback_horizontal_launch_step = square_root(birdbot_vars->f84 * 2.0f * 10.0f); birdbot_vars->knockback_vertical_launch_step = frame_time * 15.0f; - birdbot_vars->fC0 = 5.0f; - birdbot_vars->fC4 = 10.0f; + birdbot_vars->knockback_animation_target_frame = 5.0f; + birdbot_vars->knockback_animation_stop_frame = 10.0f; birdbot_vars->w94 = 1; birdbot_vars->bAD = 0; *(u128 *)&va = *(u128 *)&hit->pos; @@ -613,9 +613,9 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->knockback_gravity_step = 0.008f; birdbot_vars->knockback_horizontal_launch_step = square_root(birdbot_vars->f84 * 2.0f * 1.5f); birdbot_vars->w94 = 1; - birdbot_vars->fC0 = 5.0f; + birdbot_vars->knockback_animation_target_frame = 5.0f; birdbot_vars->knockback_vertical_launch_step = frame_time * 8.5f; - birdbot_vars->fC4 = 10.0f; + birdbot_vars->knockback_animation_stop_frame = 10.0f; birdbot_vars->bAD = 0; *(u128 *)&va = *(u128 *)&hit->pos; trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->knockback_horizontal_launch_step, &birdbot_vars->knockback_vertical_launch_step); @@ -634,8 +634,8 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->knockback_horizontal_launch_step = square_root(birdbot_vars->f84 * 2.0f * 1.5f); birdbot_vars->w94 = 1; birdbot_vars->knockback_vertical_launch_step = frame_time * 5.0f; - birdbot_vars->fC0 = 7.0f; - birdbot_vars->fC4 = 13.5f; + birdbot_vars->knockback_animation_target_frame = 7.0f; + birdbot_vars->knockback_animation_stop_frame = 13.5f; birdbot_vars->bAD = 0; *(u128 *)&va = *(u128 *)&hit->pos; trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->knockback_horizontal_launch_step, &birdbot_vars->knockback_vertical_launch_step); From bc7bb26cbeea7f7339bbc76cfff88f882f2fa697 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:52:53 +0000 Subject: [PATCH 732/758] decomp: clarify names in is_voice_active unk7E -> resolved_sound_id: In the authoritative src/audio/voices/is_voice_active.c snapshot (SHA-256 7bf84038d4dd90dff5755e3e822b113cb8e59ac52b5a60dc2cf106e57be6528a), voice->unk7E is compared with sound_id + D_0015F5B4. Retail 0x001eb760 loads the base, 0x001eb764 adds the requested sound ID, 0x001eb76c loads this signed halfword from the selected voice at +0x7e, and 0x001eb770 rejects unequal identifiers before the active-state check. The supplied original Ghidra decompilation likewise compares nSound_index with sound_index + g_nSoundIndexBase. These uses establish the stored resolved sound ID rather than merely an offset. --- src/audio/voices/is_voice_active.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio/voices/is_voice_active.c b/src/audio/voices/is_voice_active.c index 372bea7348..86fc88d890 100644 --- a/src/audio/voices/is_voice_active.c +++ b/src/audio/voices/is_voice_active.c @@ -6,7 +6,7 @@ struct VoiceState { u8 pad_0[0x74]; u8 unk74; u8 pad_75[0x9]; - s16 unk7E; + s16 resolved_sound_id; }; s32 is_voice_active(s32 voice_index, s32 sound_id) __asm__("FUN_001eb740"); @@ -16,7 +16,7 @@ s32 is_voice_active(s32 voice_index, s32 sound_id) { if (voice_index >= 0) { voice = (struct VoiceState *)(voice_index * 0x70 + ((u8 *)&voice_pool)); - if (voice->unk7E == sound_id + D_0015F5B4) { + if (voice->resolved_sound_id == sound_id + D_0015F5B4) { if ((u32)(voice->unk74 - 1) < 2) { return 1; } From eac64b634c4209ad217ec8421011b29810408832 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:55:10 +0000 Subject: [PATCH 733/758] decomp: clarify names in _cpr8 unk174 -> transfer_layout_mode: In the authoritative cpr8.c snapshot (SHA-256 41f8be22effa06dd7ca90c649265c654770f4b0c6b6967d8b552c8ad33974d13), this s32 member is tested against 3 to select transfer layout. Retail 0x001298f0 loads decoder+0x174 and 0x001298fc-0x00129900 compares it with 3, branching to the single-pass sizing path at 0x0012991c. That path uses copy_params->unk10 * 0x180 for source stride/count and assigns one pass at 0x00129948-0x00129950. For other mode values with nonzero decoder+0xe0, 0x00129954-0x00129978 halves copy_params->unk10 before sizing, uses (layout_width >> 4) * 0xc0 for destination stride, and assigns two passes. The original retail Ghidra decompilation corroborates both branches. Thus it selects the DMA transfer layout rather than representing an address, count, or width. --- src/sdk/mpeg/macroblock/cpr8.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sdk/mpeg/macroblock/cpr8.c b/src/sdk/mpeg/macroblock/cpr8.c index 94b219def2..e4786f3924 100644 --- a/src/sdk/mpeg/macroblock/cpr8.c +++ b/src/sdk/mpeg/macroblock/cpr8.c @@ -14,7 +14,7 @@ struct MpegDecoderFrame { s32 unkE0; s32 unkE4; u8 pad_E8[0x8C]; - s32 unk174; + s32 transfer_layout_mode; }; extern s32 DIntr(); @@ -38,7 +38,7 @@ void _cpr8(struct MpegDecoder *decoder, struct MpegCopyParams *copy_params) { decoder_transfer_layout = (struct MpegDecoderFrame *)decoder; source_addr = copy_params->unk0 & 0x0FFFFFFF; destination_pass_base = decoder->unkD8 & 0x0FFFFFFF; - if (decoder_transfer_layout->unk174 == 3) { + if (decoder_transfer_layout->transfer_layout_mode == 3) { goto block_3; } layout_width = decoder_transfer_layout->unkE0; From 298f58986285d05ba454d7d6e9dd5a25233387f6 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:55:13 +0000 Subject: [PATCH 734/758] decomp: clarify names in remove_hud_item unk64 -> slot_item_id: In remove_hud_item, HudSlotArray.unk64 is compared directly with hud_item_id. Retail 0x001ff494 loads this s32 at D_00199B60+0x64 and 0x001ff498 compares it with the input preserved in a1 at 0x001ff490. Instructions 0x001ff4a4-0x001ff4c0 search the same item-key position across 13 slots with 0x90 stride. On equality the separate slot index in a0 is supplied to queue_animation_update at 0x001ff4e8 with ID 0xffff, proving this member is the slot's HUD item identifier rather than the slot index. --- src/ui/hud/remove_hud_item.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ui/hud/remove_hud_item.c b/src/ui/hud/remove_hud_item.c index da049ce7ec..1d44749656 100644 --- a/src/ui/hud/remove_hud_item.c +++ b/src/ui/hud/remove_hud_item.c @@ -2,7 +2,7 @@ struct HudSlotArray { u8 pad_0[0x64]; - s32 unk64; + s32 slot_item_id; }; extern struct HudSlotArray hud_chan_slots __asm__("D_00199B60"); @@ -21,7 +21,7 @@ s32 remove_hud_item(s32 hud_item_id) { s32 index; index = 0; - if (hud_chan_slots.unk64 != hud_item_id) { + if (hud_chan_slots.slot_item_id != hud_item_id) { cursor = (s32 *)((u8 *)&hud_chan_slots + 0x64); loop_2: index += 1; From 8ad5e22de1fba430a5117cf81c99a1903f6aed64 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:55:17 +0000 Subject: [PATCH 735/758] decomp: clarify names in detach_point_light unk35 -> refresh_pending: In the SHA-256-bound assigned C, TfragLightLink.unk35 is set to 1 only when tfrag_packed_lights becomes 0xFFFF after removal/compaction of the requested point-light nibble. Retail 0x002020d8-0x002020e4 selects the tfrag record from 0x00160e8c with 64-byte stride and loads its packed indices at +0x36; 0x00202154-0x00202164 compares those indices with 0xFFFF and stores byte 1 at +0x35, followed by the packed-index store at 0x0020216c. The prepared original Ghidra decompilation identifies this exact member as TfragRenderRecord.bRefreshPending, supporting refresh_pending rather than an offset-only name. --- src/rendering/lights/detach_point_light.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rendering/lights/detach_point_light.c b/src/rendering/lights/detach_point_light.c index 2d5b107f36..4a47315e42 100644 --- a/src/rendering/lights/detach_point_light.c +++ b/src/rendering/lights/detach_point_light.c @@ -12,7 +12,7 @@ struct ShrubLightLink { struct TfragLightLink { u8 pad_0[0x35]; - u8 unk35; + u8 refresh_pending; u16 packed_lights; }; @@ -115,7 +115,7 @@ void detach_point_light(s32 light_index) { } tfrag_index_cursor += 1; if (tfrag_packed_lights == 0xFFFF) { - tfrag_link->unk35 = 1; + tfrag_link->refresh_pending = 1; } tfrag_link->packed_lights = tfrag_packed_lights; } while (tfrag_index_cursor != tfrag_indices_end_address); From fd0647d79a398b22b18b5f45a6302d4b0cfb2e3d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:55:21 +0000 Subject: [PATCH 736/758] decomp: clarify names in update_moby_voice unk7D -> current_voice_slot_index: In MobyVoiceFlags, retail 0x0020c958 loads moby+0x7D; 0x0020c95c tests 0xFF for absence. 0x0020c960-0x0020c974 uses that byte as the index into voice_pool with stride 0x70, and 0x0020c998-0x0020c99c passes the same index to release_voice_slot. The allocation return is stored back into moby+0x7D at 0x0020c9c0; invalid ownership or changed entry clears it to 0xFF. This is the moby's current voice-slot index. unk7E -> voice_entry_index: In MobyVoiceEntry, retail 0x0020c980 loads the selected pool record's signed halfword at +0x7E after checking that record's owner against moby at 0x0020c978-0x0020c97c. 0x0020c98c-0x0020c990 compares it to moby+0x7C, the same requested entry byte passed as argument zero to allocate_voice_for_target_entry at 0x0020c9a8-0x0020c9b8. A mismatch releases the slot. Thus this field identifies the slot's voice entry, consistent with the supplied Ghidra nSound_index access and prior entry-index findings. --- src/mobys/update_moby_voice.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mobys/update_moby_voice.c b/src/mobys/update_moby_voice.c index 361fa22425..815793db8e 100644 --- a/src/mobys/update_moby_voice.c +++ b/src/mobys/update_moby_voice.c @@ -5,12 +5,12 @@ struct MobyVoiceFlags { u8 pad_0[0x7C]; u8 unk7C; - u8 unk7D; + u8 current_voice_slot_index; }; struct MobyVoiceEntry { u8 pad_0[0x7E]; - s16 unk7E; + s16 voice_entry_index; u8 pad_80[0x8]; s32 unk88; }; @@ -23,17 +23,17 @@ void update_moby_voice(struct MobyVoiceFlags *moby) { s32 voice_slot_index; struct MobyVoiceEntry *voice_slot; - if (moby->unk7D != 0xFF) { - voice_slot_index = moby->unk7D; + if (moby->current_voice_slot_index != 0xFF) { + voice_slot_index = moby->current_voice_slot_index; voice_slot = (struct MobyVoiceEntry *)(voice_slot_index * 0x70 + ((u8 *)&voice_pool)); if (voice_slot->unk88 != (s32)moby) { - moby->unk7D = 0xFF; - } else if (voice_slot->unk7E != moby->unk7C) { + moby->current_voice_slot_index = 0xFF; + } else if (voice_slot->voice_entry_index != moby->unk7C) { release_voice_slot(voice_slot_index); - moby->unk7D = 0xFF; + moby->current_voice_slot_index = 0xFF; } } else if (moby->unk7C != 0xFF) { - moby->unk7D = allocate_voice_for_target_entry(moby->unk7C, 4, moby); + moby->current_voice_slot_index = allocate_voice_for_target_entry(moby->unk7C, 4, moby); } } From 5cd5e2aa96fc747ada6175011718884d26de6c5d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:55:25 +0000 Subject: [PATCH 737/758] decomp: clarify names in prune_moby_references unk52 -> primary_binding_selector: The supplied original retail Ghidra decompilation names the corresponding ResidentObjectState member bPrimary_binding_selector. Retail 0x0020cc8c loads the byte at moby+0x52, 0x0020cc90 compares it to a2=0xFF, and 0x0020cc94 clears the current reference slot on inequality. The authoritative C expresses the identical data flow as moby->unk52 != mask, with mask=0xFF, in prune_moby_references. Thus primary_binding_selector preserves the supplied semantic identification and the observed selector sentinel test rather than inventing an offset-only name. --- src/mobys/prune_moby_references.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mobys/prune_moby_references.c b/src/mobys/prune_moby_references.c index 72b881baa9..47e32d7224 100644 --- a/src/mobys/prune_moby_references.c +++ b/src/mobys/prune_moby_references.c @@ -5,7 +5,7 @@ struct MobyRecord { u8 pad_0[0x20]; u8 unk20; u8 pad_21[0x31]; - u8 unk52; + u8 primary_binding_selector; }; void prune_moby_references(void) __asm__("FUN_0020cc60"); @@ -21,7 +21,7 @@ void prune_moby_references(void) { do { moby = *slot; remaining -= 1; - if ((moby != NULL) && ((moby->unk20 & 0x80) || (moby->unk52 != mask))) { + if ((moby != NULL) && ((moby->unk20 & 0x80) || (moby->primary_binding_selector != mask))) { *slot = NULL; } slot += 1; From 4dd6684b0fcdde046cbe81debe79293525a440dc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 20:57:38 +0000 Subject: [PATCH 738/758] decomp: clarify names in render_vendor_item_icon_strip_pass unk210 -> selection_entry_count: In source src/ui/vendor/render_vendor_item_icon_strip_pass.c (SHA-256 e63680defc2179068a6c86526e57893f8e09cbfbb444e4277f6cbf11a32d0d3a), this s32 field chooses direct versus wrapped rendering at <8, bounds item_index while walking 0x14-byte selection entries, and is the divisor for wrapped entry indices. Retail 0x0023873c-0x00238744 loads state+0x210 and compares with 8; 0x002387c8-0x002387cc skips an empty list; 0x00238834-0x00238848 increments the entry counter, compares it with state+0x210, and advances the entry pointer by 0x14. At 0x00238918-0x00238940 the same field supplies twice the count and the modulo divisor before multiplying the remainder by 0x14 to address item-index/purchase-kind entries at state+0xD0/+0xD4. Original retail Ghidra names this quantity g_nVendorSelectionEntryCount, corroborating the operational proof. --- src/ui/vendor/render_vendor_item_icon_strip_pass.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ui/vendor/render_vendor_item_icon_strip_pass.c b/src/ui/vendor/render_vendor_item_icon_strip_pass.c index c9bf6fe6ca..376e908d9f 100644 --- a/src/ui/vendor/render_vendor_item_icon_strip_pass.c +++ b/src/ui/vendor/render_vendor_item_icon_strip_pass.c @@ -9,7 +9,7 @@ struct HudMenuState { u8 pad_50[0x8]; s32 unk58; u8 pad_5C[0x1B4]; - s32 unk210; + s32 selection_entry_count; }; struct HudItemEntry { @@ -40,7 +40,7 @@ void render_vendor_item_icon_strip_pass(void) { s32 fill_color; draw_framebuffer_rect(0, 0, 0x200, 0x80, 0x200, 0x80, 0); - if (D_001E63C0.unk210 < 8) { + if (D_001E63C0.selection_entry_count < 8) { sprite_x = 0xC; item_index = 0; slot_x = D_001E63C0.unk58 * 0x38; @@ -49,7 +49,7 @@ void render_vendor_item_icon_strip_pass(void) { 0x80000000; draw_framebuffer_rect(slot_x + 8, 2, slot_x + 0x40, 0x3A, 0x200, 0x80, fill_color); draw_framebuffer_rect(slot_x + 0xA, 4, slot_x + 0x3E, 0x38, 0x200, 0x80, 0x80000000); - if (D_001E63C0.unk210 > 0) { + if (D_001E63C0.selection_entry_count > 0) { do { selection_purchase_kind_ptr = (s32 *)(void *)((u8 *)&D_001E63C0 + 0xD4 + item_index * 0x14); @@ -65,7 +65,7 @@ void render_vendor_item_icon_strip_pass(void) { draw_hud_sprite(frame_index, sprite_x, 6, 0x30, 0x30, 0x80); sprite_x += 0x38; item_index += 1; - } while (item_index < D_001E63C0.unk210); + } while (item_index < D_001E63C0.selection_entry_count); } } else { if (D_001E63C0.unk4C < 0) { @@ -90,7 +90,7 @@ void render_vendor_item_icon_strip_pass(void) { do { first_slot = D_001E63C0.unk58 - 3; entry_offset = - ((s32)((D_001E63C0.unk210 * 2) + slot + first_slot) % (s32)D_001E63C0.unk210) * + ((s32)((D_001E63C0.selection_entry_count * 2) + slot + first_slot) % (s32)D_001E63C0.selection_entry_count) * 0x14; icon = ((struct HudItemEntry *)(void *)((u8 *)((u8 *)menu_item_info) + *(s32 *)(void *)(entry_offset + From fb7681581918fd266474ddd2b6fa0dbf9fddca45 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:01:45 +0000 Subject: [PATCH 739/758] decomp: clarify names in process_ultramech_hits_and_update_target f174 -> activation_target_search_range: Retail 0x002d1368-0x002d138c selects data+0x174 only when the moby is in state 1 (ULTRAMECH_WAIT_FOR_ACTIVATION), then copies it into data+0x1b8 for search and distance testing. Authoritative ultramech_unlimited_update initializes this float to 90.0f; other states select data+0x178. This is the activation-state target-search range. f1B8 -> current_target_search_range: Retail 0x002d138c/0x002d13b8 stores the state-selected range at data+0x1b8; 0x002d1394-0x002d13e0 passes it to simple or path-constrained targeting. 0x002d13e8-0x002d1404 compares it against distance from moby position to the search output. Authoritative ULTRAMECH_APPROACH_TARGET also passes this field as the established target_search_range argument of compute_ultramech_flocking_steering_point. w164 -> target_range_status: Retail 0x002d1364 resets data+0x164 to 0, then 0x002d13e8-0x002d1404 computes distance to the targeting output and stores 2 exactly when that distance exceeds data+0x1b8. Authoritative caller tests this field against 2 to gate entry-path activation, aiming, firing and approach behavior, proving a target-range status with existing 0/2 encoding. w1C8 -> damage_reaction_this_update: Retail 0x002d0fec clears data+0x1c8 on every helper invocation. Following health subtraction, cases 9/10 set it to 1 at 0x002d1170 and knockback cases 3-8 set it at 0x002d11b0; death and no-action branches do not. Authoritative caller invokes this helper first and tests this field in ULTRAMECH_FIRE_BURST to permit a ballistic path move after that update's damage reaction. w1D0 -> target_constraint_path_index: Retail 0x002d1374-0x002d13e0 treats data+0x1d0=-1 as absent; otherwise multiplies it by 4 to index D_L15_001B0AB0 and passes that LevelPath's points and count to the path-constrained targeting call. Authoritative ULTRAMECH_WAIT_FOR_ACTIVATION also indexes the same path with this field and checks hero position with point_in_path_xy before enabling entry movement, proving the targeting constraint path index. --- src/overlays/l15/mobys/ultramech_unlimited.c | 58 ++++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/overlays/l15/mobys/ultramech_unlimited.c b/src/overlays/l15/mobys/ultramech_unlimited.c index 01028d70bf..9c92c0b795 100644 --- a/src/overlays/l15/mobys/ultramech_unlimited.c +++ b/src/overlays/l15/mobys/ultramech_unlimited.c @@ -187,10 +187,10 @@ struct UData { float fE8; char padEC[0x74]; UMoby *target; - int w164; + int target_range_status; char pad168[8]; int path; - float f174; + float activation_target_search_range; char pad178[8]; int paths[2]; float f188; @@ -198,13 +198,13 @@ struct UData { Vec4 v1A0; int side; int point; - float f1B8; + float current_target_search_range; float turnVel; int timer; int shots; - int w1C8; + int damage_reaction_this_update; int w1CC; - int w1D0; + int target_constraint_path_index; int w1D4; int w1D8; int w1DC; @@ -336,7 +336,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { } ultramech_vars->snd = -1; ultramech_vars->turnVel = 0.0f; - ultramech_vars->f174 = 90.0f; + ultramech_vars->activation_target_search_range = 90.0f; if (rand() & 1) ultramech_moby->flags |= 0x8000; ultramech_moby->w94 = 0; @@ -360,14 +360,14 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { ultramech_moby->flags = (ultramech_moby->flags & 0xFFBE) | 0x1000; } } - if (ultramech_vars->w164 != 2 && ultramech_vars->path != -1) { + if (ultramech_vars->target_range_status != 2 && ultramech_vars->path != -1) { struct Hero *pl = &hero; if (pl->vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK && (ultramech_moby->flags & 0x1000)) { - if (ultramech_vars->w1D0 != -1 && + if (ultramech_vars->target_constraint_path_index != -1 && !point_in_path_xy(&pl->motion.pos, - D_L15_001B0AB0[ultramech_vars->w1D0]->points, - D_L15_001B0AB0[ultramech_vars->w1D0]->count)) { + D_L15_001B0AB0[ultramech_vars->target_constraint_path_index]->points, + D_L15_001B0AB0[ultramech_vars->target_constraint_path_index]->count)) { ultramech_moby->w94 = 0; ultramech_moby->flags = (ultramech_moby->flags | 0x41) & 0xEFFF; } else { @@ -487,7 +487,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { case ULTRAMECH_AIM_AND_SELECT_ATTACK: if (ultramech_moby->anim != 0 && (ultramech_moby->animFlags & 2)) blend_moby_animation(ultramech_moby, 0, 0, scale_game_frames(0x14)); - if (ultramech_vars->w164 != 2) { + if (ultramech_vars->target_range_status != 2) { approach_angle(&ultramech_moby->rot.f[2], fast_arc_tan(combat_target->pos.f[0] - ultramech_moby->pos.f[0], combat_target->pos.f[1] - ultramech_moby->pos.f[1]), @@ -522,7 +522,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { blend_moby_animation(ultramech_moby, 7, 0, scale_game_frames(5)); ultramech_moby->animSpeed = *(float *)&ultramech_firing_animation_speed_gp; } - if (ultramech_vars->w164 != 2) { + if (ultramech_vars->target_range_status != 2) { int fire = -1; approach_angle(&ultramech_moby->rot.f[2], fast_arc_tan(combat_target->pos.f[0] - ultramech_moby->pos.f[0], @@ -579,7 +579,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { blend_moby_animation(ultramech_moby, 2, 0, scale_game_frames(0xA)); } else if (ultramech_vars->w1D8 == 0 && vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) > 10.0f && - ultramech_vars->w1C8 != 0 && ultramech_vars->w1D4 == 0) { + ultramech_vars->damage_reaction_this_update != 0 && ultramech_vars->w1D4 == 0) { ultramech_moby->state = ULTRAMECH_BALLISTIC_PATH_MOVE; ultramech_vars->timer = 0; ultramech_vars->side = (ultramech_vars->side + 1) & 1; @@ -609,7 +609,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { } break; case ULTRAMECH_WAIT_BETWEEN_BURSTS: - if (ultramech_vars->w164 != 2) { + if (ultramech_vars->target_range_status != 2) { approach_angle(&ultramech_moby->rot.f[2], fast_arc_tan(combat_target->pos.f[0] - ultramech_moby->pos.f[0], combat_target->pos.f[1] - ultramech_moby->pos.f[1]), @@ -660,9 +660,9 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { case ULTRAMECH_APPROACH_TARGET: { float desired_heading = fast_arc_tan(combat_target->pos.f[0] - ultramech_moby->pos.f[0], combat_target->pos.f[1] - ultramech_moby->pos.f[1]); - if (ultramech_vars->w164 != 2) { + if (ultramech_vars->target_range_status != 2) { desired_heading = compute_ultramech_flocking_steering_point( - ultramech_moby, &position_or_motion_vector, ultramech_vars->f1B8); + ultramech_moby, &position_or_motion_vector, ultramech_vars->current_target_search_range); if (vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) < *(float *)&ultramech_melee_range_gp) { ultramech_moby->state = ULTRAMECH_MELEE_ATTACK; @@ -1009,7 +1009,7 @@ void process_ultramech_hits_and_update_target(void *ultramech_instance) { *(float *)((char *)ultramech_moby + 0x2C) = ultramech_pre_hit_scale_multiplier_gp * *(float *)(ultramech_moby->cls + 0x24); impact = 0.0f; - ultramech_vars->w1C8 = 0; + ultramech_vars->damage_reaction_this_update = 0; for (i = 0; i < 64; i++) { char *candidate_hit_record = D_00178700 + i * 0x40; if (*(UMoby **)(candidate_hit_record + 0x34) == ultramech_moby) { @@ -1055,7 +1055,7 @@ void process_ultramech_hits_and_update_target(void *ultramech_instance) { break; case HIT_REACTION_DAMAGE_WITHOUT_KNOCKBACK: case HIT_REACTION_DAMAGE_WITHOUT_KNOCKBACK_ALTERNATE: - ultramech_vars->w1C8 = 1; + ultramech_vars->damage_reaction_this_update = 1; *(unsigned char *)((char *)ultramech_vars + 0x67) = 0xFA; break; case HIT_REACTION_KNOCKBACK: @@ -1066,7 +1066,7 @@ void process_ultramech_hits_and_update_target(void *ultramech_instance) { case HIT_REACTION_KNOCKBACK_VARIANT_ALTERNATE: angle = ultramech_knockback_horizontal_speed_gp * D_0015ED6C; reaction_product = ultramech_knockback_vertical_speed_gp * D_0015ED6C; - ultramech_vars->w1C8 = 1; + ultramech_vars->damage_reaction_this_update = 1; *(float *)((char *)ultramech_vars + 0x88) = angle; *(float *)((char *)ultramech_vars + 0x8C) = reaction_product; trooper_set_knockback((char *)ultramech_vars + 0x70, 4.0f, 1.0f); @@ -1126,21 +1126,21 @@ void process_ultramech_hits_and_update_target(void *ultramech_instance) { trooper_anim_finish(ultramech_moby, (char *)ultramech_vars + 0x60); *(float *)((char *)ultramech_moby + 0x2C) = *(float *)(ultramech_moby->cls + 0x24) * ultramech_post_hit_scale_multiplier_gp; - ultramech_vars->w164 = 0; + ultramech_vars->target_range_status = 0; if (ultramech_moby->state != ULTRAMECH_WAIT_FOR_ACTIVATION) { - if (ultramech_vars->w1D0 != -1) + if (ultramech_vars->target_constraint_path_index != -1) goto follow_path; - ultramech_vars->f1B8 = *(float *)((char *)ultramech_vars + 0x178); + ultramech_vars->current_target_search_range = *(float *)((char *)ultramech_vars + 0x178); } else { - ultramech_vars->f1B8 = ultramech_vars->f174; + ultramech_vars->current_target_search_range = ultramech_vars->activation_target_search_range; } - FUN_0024f560(ultramech_vars->f1B8, ultramech_moby, (char *)ultramech_vars + 0x120); + FUN_0024f560(ultramech_vars->current_target_search_range, ultramech_moby, (char *)ultramech_vars + 0x120); goto check_path; follow_path: { LevelPath *path; - ultramech_vars->f1B8 = *(float *)((char *)ultramech_vars + 0x178); - path = D_L15_001B0AB0[ultramech_vars->w1D0]; - activate_effect_l08(ultramech_vars->f1B8, + ultramech_vars->current_target_search_range = *(float *)((char *)ultramech_vars + 0x178); + path = D_L15_001B0AB0[ultramech_vars->target_constraint_path_index]; + activate_effect_l08(ultramech_vars->current_target_search_range, ultramech_moby, (char *)ultramech_vars + 0x120, 0, @@ -1149,8 +1149,8 @@ follow_path: { path->count); } check_path: - if (ultramech_vars->f1B8 < fast_vec_dist(&ultramech_moby->pos, (char *)ultramech_vars + 0x120)) - ultramech_vars->w164 = 2; + if (ultramech_vars->current_target_search_range < fast_vec_dist(&ultramech_moby->pos, (char *)ultramech_vars + 0x120)) + ultramech_vars->target_range_status = 2; if (ultramech_vars->target == 0) ultramech_vars->target = (UMoby *)D_001413D0; } From 22b4da8be1cc4ae50ad5ce03034138189abe89b1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:01:50 +0000 Subject: [PATCH 740/758] decomp: clarify names in rail_lift_update unk64 -> target_path_point_index: In assigned rail_lift_update, retail 0x002dcefc, 0x002dcf98 and 0x002dcfc4 initialize pvars+0x64 to 1 when starting initial travel, rider departure or recall. The direct advance_moby_along_rail_path call at 0x002dd01c receives the selected path. Checked level-03 helper 0x002d3918 loads the same Moby pvars at 0x002d3960 and this member at 0x002d3968, shifts it left four bits at 0x002d3970 and loads the target Vec4 from path+0x10+index*16 at 0x002d3974-0x002d3980. It subtracts the lift position from that point at 0x002d3994. On the proximity branch, 0x002d39c8-0x002d39d0 increments and stores the member; 0x002d39d4-0x002d39e0 compares the incremented index with the path point count to produce completion. Thus this is the target path point index, not a ride-start boolean. --- src/overlays/l03/mobys/rail_lift.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l03/mobys/rail_lift.c b/src/overlays/l03/mobys/rail_lift.c index 03308d0553..3d6cabbdc1 100644 --- a/src/overlays/l03/mobys/rail_lift.c +++ b/src/overlays/l03/mobys/rail_lift.c @@ -84,7 +84,7 @@ extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L0 struct RailLiftVars { u8 pad0[0x20]; u8 coll[0x44]; /* 0x20: collision record moved with the lift */ - s32 unk64; /* 0x64: set to 1 when a ride starts */ + s32 target_path_point_index; /* 0x64: set to 1 when a ride starts */ u8 pad68[0x10]; s32 snd; /* 0x78: travel sound voice (FUN_L03_002d3918) */ s32 started; /* 0x7C: set once the first ride starts */ @@ -145,7 +145,7 @@ void rail_lift_update(struct Moby *lift_moby) { *(u128 *)&lift_moby->pos = *(u128 *)&(l03_paths[lift_vars->path[hero_end]])->points[0]; lift_moby->state = LIFT_FOLLOW_PATH; - lift_vars->unk64 = 1; + lift_vars->target_path_point_index = 1; lift_vars->started = 1; lift_vars->ready = 0; break; @@ -160,14 +160,14 @@ void rail_lift_update(struct Moby *lift_moby) { if ((((u32)pad_pressed_lui) & 0x10) && D_L03_0015F594 == 8) { request_hero_target_pose(&lift_moby->pos, lift_moby->rot.z, 0); lift_moby->command ^= 1; - lift_vars->unk64 = 1; + lift_vars->target_path_point_index = 1; lift_vars->ready = 0; lift_moby->state = LIFT_WAIT_FOR_HERO_ANIMATION; } } else if (hero_end != lift_end) { lift_moby->state = LIFT_FOLLOW_PATH; lift_moby->command ^= 1; - lift_vars->unk64 = 1; + lift_vars->target_path_point_index = 1; lift_vars->ready = 0; } break; From 334fe74741c133d9e55a23d9fbe61aefa78bc1e8 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:01:54 +0000 Subject: [PATCH 741/758] decomp: clarify names in draw_missions_menu2 unk02 -> bottom: Retail 0x0021f82c loads menu+0x24 and 0x0021f840 stores its low halfword at sp+0x22, the source text_region_settings.unk02. The 24-byte copy at 0x0021f858-0x0021f884 places this in the TextRegion passed at 0x0021f8a4; original Ghidra explicitly assigns this value to TStack_f0.nSBottom, paired with zero nSTop. unk06 -> right: Retail 0x0021f834 loads menu+0x20 and 0x0021f850 stores it at sp+0x26, matching text_region_settings.unk06. The same menu dimension limits wrapped text at 0x0021f780-0x0021f7a8 after subtracting 0x11 from it. Original Ghidra identifies the copied field as TStack_f0.nSRight, paired with zero nSLeft; the region is passed to rendering at 0x0021f8a4. unk0A -> anchor_y: Retail 0x0021f838 computes a3=s5+8, where s5 is mission_text_y passed as wrapped text Y at 0x0021f7a0 and advanced per mission at 0x0021f808. Store 0x0021f844 writes this trailing text Y to sp+0x2a, matching text_region_settings.unk0A. Original Ghidra copies it to TStack_f0.nSAnchor_y before the renderer call at 0x0021f8a4. unk12 -> flags: Retail 0x0021f830 sets a1=1 and 0x0021f84c writes this halfword to sp+0x32, matching text_region_settings.unk12. The 24-byte copy at 0x0021f858-0x0021f884 preserves it into the render region passed at 0x0021f8a4. Original Ghidra explicitly maps this initialization to TStack_f0.wFlags=1; the name flags does not assert any particular bit meaning. --- src/ui/menus/missions/draw_missions_menu2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ui/menus/missions/draw_missions_menu2.c b/src/ui/menus/missions/draw_missions_menu2.c index 79ff65de26..958fdd9fce 100644 --- a/src/ui/menus/missions/draw_missions_menu2.c +++ b/src/ui/menus/missions/draw_missions_menu2.c @@ -13,15 +13,15 @@ struct MissionsMenu { struct Rect { u16 unk00; - u16 unk02; + u16 bottom; u16 unk04; - u16 unk06; + u16 right; s16 unk08; - s16 unk0A; + s16 anchor_y; s16 unk0C; s16 unk0E; u16 unk10; - u16 unk12; + u16 flags; s16 unk14; s16 unk16; }; @@ -94,12 +94,12 @@ s32 draw_missions_menu2(struct MissionsMenu *menu) { } if (mask < 0) { memset(&text_region_settings, 0, 0x18); - text_region_settings.unk02 = menu->unk24; - text_region_settings.unk06 = menu->unk20; + text_region_settings.bottom = menu->unk24; + text_region_settings.right = menu->unk20; text_region_settings.unk08 = menu->unk24 >> 1; - text_region_settings.unk0A = mission_text_y + 8; + text_region_settings.anchor_y = mission_text_y + 8; text_region_settings.unk10 = 0x10; - text_region_settings.unk12 = 1; + text_region_settings.flags = 1; trailing_text_region = text_region_settings; font_print_window_small( &trailing_text_region, 0x8020FFFF, get_help_message_text(0x523D), -1); From c78818da19b122df4ccb036c9a2e2e876e30dff5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:01:59 +0000 Subject: [PATCH 742/758] decomp: clarify names in update_crate_stack_motion vC0 -> transform_basis_x: Authoritative crate.c declares M2d1428.vC0 as u8[0x10] and passes it to transform_vector_by_basis after subtracting moby position from hero position. Retail 0x002d1530-0x002d1558 binds a2=moby+0xC0 and a0=a1=hero_local_offset. Checked level-00 helper 0x001ff6d0 loads basis vectors at a2+0,+0x10,+0x20; 0x001ff6e0 vmulax weights the first vector by input X, then vmadday/vmaddaz add the Y/Z vectors. Retail 0x002d155c-0x002d15b4 tests the resulting spatial offset for crate overlap. Thus the existing 16-byte member is the X-weighted transform basis vector, not an arbitrary byte buffer. --- src/overlays/shared/pickups/crate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/shared/pickups/crate.c b/src/overlays/shared/pickups/crate.c index a80fd4113d..49dfd3a08a 100644 --- a/src/overlays/shared/pickups/crate.c +++ b/src/overlays/shared/pickups/crate.c @@ -203,7 +203,7 @@ struct M2d1428 { u8 pa8[0x14]; u8 bBC; u8 pbd[3]; - u8 vC0[0x10]; + u8 transform_basis_x[0x10]; }; typedef struct P2d1428 { @@ -1280,7 +1280,7 @@ void update_crate_stack_motion(M2d1428 *moby) { if (moby->state == CRATE_STATE_INITIALIZE) continue; fast_vec_sub(&hero_local_offset, &hero.motion.pos, &moby->pos); - transform_vector_by_basis(&hero_local_offset, &hero_local_offset, moby->vC0); + transform_vector_by_basis(&hero_local_offset, &hero_local_offset, moby->transform_basis_x); if (absolute_float(hero_local_offset.x) < 0.55f && absolute_float(hero_local_offset.y) < 0.55f && hero_local_offset.z < 0.0f && -(hero.capsule_top + hero.capsule_radius) < hero_local_offset.z) { From c19a484588e4d321941115fc6fb95536bebd7c1e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:04:38 +0000 Subject: [PATCH 743/758] decomp: clarify names in blarg_trooper_update f8 -> hit_direction_z: Shot5BD0 begins with the melee hit vector: source sets f0/f4 to cos/sin(moby->rot.z)*0.2, f8 to zero, and passes the struct address as both vector arguments to set_vector_length_xy. Retail 002c5ed0-002c5f20 constructs this vector at sp+0xA0, clearing its Z at sp+0xA8; 002c5f3c then sets that component to 1.0 before record_moby_hit at 002c5f78. Checked consumer 0024caf8-0024cafc and 0024cb70-0024cb74 copies the vector intact into the hit record. Thus f8 is the hit direction vector's Z component, rather than an arbitrary scalar. h1A -> hit_source_class: The melee branch assigns (u16)moby->oclass to Shot5BD0.h1A while p10 is assigned the attacking trooper moby, then passes this struct to record_moby_hit(target,...). Retail 002c5f08 stores s3 as the source pointer at sp+0xB0; 002c5f24 loads the same moby's object class from 0xA6(s3), and 002c5f48 stores it to sp+0xBA, the h1A member. Checked record_moby_hit 0024cba4-0024cba8 copies that halfword into queued hit record+0x2A. The field records the hit source's object class. --- src/overlays/l04/mobys/blarg_trooper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/l04/mobys/blarg_trooper.c b/src/overlays/l04/mobys/blarg_trooper.c index 6dd97726d7..a794183bbc 100644 --- a/src/overlays/l04/mobys/blarg_trooper.c +++ b/src/overlays/l04/mobys/blarg_trooper.c @@ -124,13 +124,13 @@ struct Path5BD0 { struct Shot5BD0 { float f0; float f4; - float f8; + float hit_direction_z; float fC; void *p10; int v14; char c18; char c19; - short h1A; + short hit_source_class; float f1C; int pad[4]; }; @@ -711,15 +711,15 @@ void blarg_trooper_update(struct Moby *moby) { moby->rot.z) < 0.2617994f) { update_scratch.w.p.blk.f0 = fast_cos(moby->rot.z) * 0.2f; update_scratch.w.p.blk.f4 = fast_sin(moby->rot.z) * 0.2f; - update_scratch.w.p.blk.f8 = 0.0f; + 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.f1C = 1.0f; set_vector_length_xy(&update_scratch.w.p.blk, &update_scratch.w.p.blk, 1.0f); - update_scratch.w.p.blk.f8 = 1.0f; + update_scratch.w.p.blk.hit_direction_z = 1.0f; update_scratch.w.p.blk.fC = 5627.925f; update_scratch.w.p.blk.c19 = 1; - update_scratch.w.p.blk.h1A = (u16)moby->oclass; + update_scratch.w.p.blk.hit_source_class = (u16)moby->oclass; update_scratch.w.p.blk.c18 = 0; qcopy(update_scratch.w.p.v70, update_scratch.v50); update_scratch.w.p.v70[2] = update_scratch.w.p.v70[2] + 0.75f; From 6b86680d156a97f115c7490aa1ce181b09b0792a Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:04:41 +0000 Subject: [PATCH 744/758] decomp: clarify names in update_resort_owner_state_transitions unk110 -> second_gate_arrival_cuboid_index: In the authoritative C, this s32 indexes l11_cuboids: initialization lowers its pos.z by 500, while RESORT_OWNER_SECOND_PATH_LEG arrival constructs the second gate jump target and raises that same cuboid by 500. Retail 002d1848-002d187c loads pvars+0x110, multiplies by 0x80 and subtracts 500 at cuboid+0x38; 002d1c60-002d1c90 performs the matching addition in the leg-1 branch. Original retail Ghidra cases 0 and 6 agree. This proves a cuboid index tied to second-gate arrival, without claiming its physical purpose. unk114 -> final_path_arrival_cuboid_index: Authoritative C lowers l11_cuboids[this s32].pos.z by 500 during fresh initialization and resume at leg 1, then raises it by 500 on RESORT_OWNER_FINAL_PATH_LEG arrival immediately before entering completion-dialogue checking. Retail 002d1800-002d182c and 002d1880-002d1894 load pvars+0x114, use 0x80 cuboid stride, and subtract 500 at +0x38; 002d1cb8-002d1ce8 adds 500 on leg 3 arrival. Original retail Ghidra corroborates all three uses, proving this final-path-arrival cuboid index. unk118 -> post_path_dialogue_condition_index: In RESORT_OWNER_CHECK_POST_PATH_DIALOGUE, authoritative C uses this s32 as the index contribution in D_0014C050[field + D_0015ED84 * 16], requiring the selected byte to equal 0xFF before checking camera mode and update_npc_dialogue. Retail 002d1fb0-002d1fd8 loads pvars+0x118, adds the global row offset shifted by 4 and table base 0x0014c050, loads a byte and compares with 0xFF; 002d1fe0-002d201c then gates dialogue and enters state 15. Original retail Ghidra case 0xe agrees. This proves the post-path dialogue condition index without assigning story or persistence semantics. --- src/overlays/l11/mobys/resort_owner.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/overlays/l11/mobys/resort_owner.c b/src/overlays/l11/mobys/resort_owner.c index 0462b60d4e..c11b072006 100644 --- a/src/overlays/l11/mobys/resort_owner.c +++ b/src/overlays/l11/mobys/resort_owner.c @@ -349,9 +349,9 @@ struct PokKeeperVars { s32 unk104; s32 unk108; s32 unk10C; - s32 unk110; - s32 unk114; - s32 unk118; + s32 second_gate_arrival_cuboid_index; + s32 final_path_arrival_cuboid_index; + s32 post_path_dialogue_condition_index; u8 pad11C[4]; Vec4f target; /* 0x120 */ Vec4f unk130; @@ -423,12 +423,12 @@ void update_resort_owner_state_transitions(void *resort_owner_moby) { qcopy_nc(&moby->pos, &l11_cuboids[moby_vars->points[1]].pos); qcopy_nc(&moby->rot, &l11_cuboids[moby_vars->points[1]].rot); FUN_L11_002d2088_c(moby, 6); - l11_cuboids[moby_vars->unk114].pos.z -= 500.0f; + l11_cuboids[moby_vars->final_path_arrival_cuboid_index].pos.z -= 500.0f; FUN_L11_0030a840((unsigned char *)(D_L11_0015FFD8 + (moby_vars->gates[0] << 8))); break; } - l11_cuboids[moby_vars->unk110].pos.z -= 500.0f; - l11_cuboids[moby_vars->unk114].pos.z -= 500.0f; + l11_cuboids[moby_vars->second_gate_arrival_cuboid_index].pos.z -= 500.0f; + l11_cuboids[moby_vars->final_path_arrival_cuboid_index].pos.z -= 500.0f; moby_vars->leg = 0; moby_vars->talk_range = 5.0f; FUN_L11_002d2088_c(moby, 1); @@ -505,7 +505,7 @@ void update_resort_owner_state_transitions(void *resort_owner_moby) { &o->rot_row2, resort_owner_gate_jump_target_local_z_offset_gp); fast_vec_add(&moby_vars->target, &moby_vars->target, position_scratch); - l11_cuboids[moby_vars->unk110].pos.z += 500.0f; + l11_cuboids[moby_vars->second_gate_arrival_cuboid_index].pos.z += 500.0f; moby_vars->next_state = RESORT_OWNER_MOVE_TO_GATE_TARGET; FUN_L11_002d2088_c(moby, 7); break; @@ -514,7 +514,7 @@ void update_resort_owner_state_transitions(void *resort_owner_moby) { FUN_L11_002d2088_c(moby, 0xB); break; case RESORT_OWNER_FINAL_PATH_LEG: - l11_cuboids[moby_vars->unk114].pos.z += 500.0f; + l11_cuboids[moby_vars->final_path_arrival_cuboid_index].pos.z += 500.0f; FUN_L11_002d2088_c(moby, 0xC); break; } @@ -575,7 +575,7 @@ void update_resort_owner_state_transitions(void *resort_owner_moby) { } break; case RESORT_OWNER_CHECK_POST_PATH_DIALOGUE: - if (D_0014C050[moby_vars->unk118 + D_0015ED84 * 16] == 0xFF && + if (D_0014C050[moby_vars->post_path_dialogue_condition_index + D_0015ED84 * 16] == 0xFF && camera_secondary_mode[0] != 0x32 && update_npc_dialogue(moby, moby_vars->talk)) { begin_dialogue_camera_transition(moby, 2.5f); FUN_L11_002d2088_c(moby, 0xF); From 39892182f84ce66cc035341de07d366f6b8cd851 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:04:45 +0000 Subject: [PATCH 745/758] decomp: clarify names in handle_psytcopus_hits unk158 -> knockback_extension_timer: Original retail decompilation and SHA-bound source agree: 003106bc-003106c0 pass this s32 member to fast_dec_timer each handler invocation. On the nonlethal knockback branch only, 003108d8-003108ec add scale_game_frames(60) to its current count after starting state 7. This identifies a countdown extended by knockback; the name does not claim immunity, attack cooldown, or another unobserved expiry effect. unk160 -> held_projectile: Authoritative psytcopus.c stores spawn_class_511_moby_with_sparks into this void * in CREATE_PROJECTILE and releases/clears it in FIRE_PROJECTILE. Retail 003106d8-00310718 positions this pointed-to object at the owner's forward/Z offset; 003108c0-003108d4 and 003109b4-003109c8 cancel and clear it during knockback. unk67 -> hit_reaction_channel_target: Retail 00310818, 003108bc and 003109b0 write 250/120/240 to pvars+67 for hurt/knockback/death. Assigned 003109fc passes pvars+60 to checked 002833d8. Its 00283468-002834b8 reads block+7, interpolates from block+4 toward it, and 00283534-00283580 interpolates back; 00283610-0028361c forwards the interpolated channel to 00276120. Thus the member is the hit-reaction channel interpolation target; no RGB identity is claimed. unk84 -> knockback_speed_approach_step: Retail 003107e4 initializes this f32 to 0.0005 before reaction setup on pvars+70. Checked sibling 002825a0-002825d8 computes that block's vector magnitude into sp+60, passes block+14 (=pvars+84) in f13 to 00281708, then rescales the velocity vector to the updated magnitude. Checked 00281710-0028174c clamps target-minus-current to plus/minus f13 before adding it, proving this is the per-update speed approach step. unk8C -> knockback_vertical_speed: Retail 00310828-00310850 and 00310908-00310944 store the established hurt/death base vertical speed times frame_time here. Hit-vector adjustment receives its address at 00310890/00310984. Checked setup 00282450-0028246c copies block+1c (=pvars+8c) to velocity Z at block+8; sibling 002825dc-002825f0 also caps that vertical velocity with this field. It is the knockback vertical-speed input/limit, not the evolving velocity itself. --- src/overlays/l11/mobys/psytcopus.c | 54 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/overlays/l11/mobys/psytcopus.c b/src/overlays/l11/mobys/psytcopus.c index 928b42357c..b95c9f4ff8 100644 --- a/src/overlays/l11/mobys/psytcopus.c +++ b/src/overlays/l11/mobys/psytcopus.c @@ -41,13 +41,13 @@ struct PokiPathVars { u8 unk5A; /* 0x5A */ u8 pad_5B[5]; u8 unk60[7]; /* 0x60: passed to trooper_anim_update / trooper_anim_finish */ - u8 unk67; /* 0x67 */ + u8 hit_reaction_channel_target; /* 0x67 */ u8 pad_68[8]; u8 unk70[0x10]; /* 0x70: passed to trooper_start_knockback / step_moby_motion */ f32 unk80; /* 0x80 */ - f32 unk84; /* 0x84 */ + f32 knockback_speed_approach_step; /* 0x84 */ f32 unk88; /* 0x88 */ - f32 unk8C; /* 0x8C */ + f32 knockback_vertical_speed; /* 0x8C */ s32 unk90; /* 0x90 */ s32 unk94; /* 0x94 */ f32 unk98; /* 0x98 */ @@ -70,9 +70,9 @@ struct PokiPathVars { u8 pad_144[8]; f32 unk14C; /* 0x14C */ u8 pad_150[8]; - s32 unk158; /* 0x158 */ + s32 knockback_extension_timer; /* 0x158 */ u8 pad_15C[4]; - void *unk160; /* 0x160 */ + void *held_projectile; /* 0x160 */ u8 pad_164[0x7C]; u8 unk1E0[0x10]; /* 0x1E0 */ }; @@ -189,7 +189,7 @@ void psytcopus_update(struct Moby *psytcopus) { psytcopus_projectile_forward_offset_length_gp); fast_vec_add(&projectile_vector_scratch, &projectile_vector_scratch, &psytcopus->pos); projectile_vector_scratch.z += psytcopus_projectile_z_offset_gp; - psytcopus_vars->unk160 = + psytcopus_vars->held_projectile = spawn_class_511_moby_with_sparks(psytcopus, &projectile_vector_scratch, 5); break; } @@ -210,12 +210,12 @@ void psytcopus_update(struct Moby *psytcopus) { frame_time_sq * 6.2831855f, frame_time * 6.2831855f); } - if (psytcopus_vars->unk160 != 0 && + if (psytcopus_vars->held_projectile != 0 && is_value_within_interpolated_window(psytcopus, 33.0f) != 0) { fast_vec_normalize( &projectile_vector_scratch, &psytcopus->rot_row0, frame_time * 30.0f); - set_moby_state_two_data_and_timer(psytcopus_vars->unk160, &projectile_vector_scratch); - psytcopus_vars->unk160 = 0; + set_moby_state_two_data_and_timer(psytcopus_vars->held_projectile, &projectile_vector_scratch); + psytcopus_vars->held_projectile = 0; } if (psytcopus->anim_flags & 2) { psytcopus->state = PSYTCOPUS_STATE_ATTACK_RECOVERY; @@ -288,9 +288,9 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { u32 hit_reaction; float source_to_psytcopus_heading; - fast_dec_timer(&psytcopus_vars->unk158); + fast_dec_timer(&psytcopus_vars->knockback_extension_timer); psytcopus->scale = psytcopus->pclass->scale * D_L11_00161F9C; - if (psytcopus_vars->unk160 != 0) { + if (psytcopus_vars->held_projectile != 0) { fast_vec_normalize(&projectile_and_hit_vector_scratch, &psytcopus->rot_row0, psytcopus_projectile_forward_offset_length_gp); @@ -298,7 +298,7 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { &projectile_and_hit_vector_scratch, &psytcopus->pos); projectile_and_hit_vector_scratch.z += psytcopus_projectile_z_offset_gp; - set_moby_position_and_refresh_removal_timer(psytcopus_vars->unk160, + set_moby_position_and_refresh_removal_timer(psytcopus_vars->held_projectile, &projectile_and_hit_vector_scratch); } damage = 0.0f; @@ -313,7 +313,7 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { psytcopus_vars->unk90 = truncate_float_to_s32(512.0f); psytcopus_vars->unk98 = 0.5f; psytcopus_vars->unk80 = psytcopus_knockback_base_gravity_gp * frame_time_sq; - psytcopus_vars->unk84 = 0.0005f; + psytcopus_vars->knockback_speed_approach_step = 0.0005f; psytcopus_vars->unk94 = 9; psytcopus_vars->unkAD = 0; switch (hit_reaction) { @@ -322,7 +322,7 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { break; case HIT_REACTION_HURT_WITHOUT_KNOCKBACK: case HIT_REACTION_HURT_WITHOUT_STATE_CHANGE: - psytcopus_vars->unk67 = 0xFA; + psytcopus_vars->hit_reaction_channel_target = 0xFA; break; case HIT_REACTION_KNOCKBACK: case HIT_REACTION_KNOCKBACK_AND_CANCEL_PROJECTILE: @@ -331,7 +331,7 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { case HIT_REACTION_KNOCKBACK_WITH_SOURCE_RELATIVE_HEADING: case HIT_REACTION_KNOCKBACK_WITH_SOURCE_RELATIVE_HEADING_AND_TIMER_EXTENSION: psytcopus_vars->unk88 = psytcopus_hurt_knockback_base_horizontal_speed_gp * frame_time; - psytcopus_vars->unk8C = psytcopus_hurt_knockback_base_vertical_speed_gp * frame_time; + psytcopus_vars->knockback_vertical_speed = psytcopus_hurt_knockback_base_vertical_speed_gp * frame_time; psytcopus_vars->unkC0 = 3.0f; psytcopus_vars->unkC4 = 6.0f; source_to_psytcopus_heading = fast_arc_tan( @@ -342,22 +342,22 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { FUN_L00_0025ab48_p(&projectile_and_hit_vector_scratch, &angle1, &psytcopus_vars->unk88, - &psytcopus_vars->unk8C); + &psytcopus_vars->knockback_vertical_speed); FUN_L00_0025c558_p(psytcopus, psytcopus_vars->unk70, 5, 1, 0, angle1); psytcopus->state = PSYTCOPUS_STATE_KNOCKBACK; - psytcopus_vars->unk67 = 0x78; - if (psytcopus_vars->unk160 != 0) { - FUN_L00_002371e0_p(psytcopus_vars->unk160); - psytcopus_vars->unk160 = 0; + psytcopus_vars->hit_reaction_channel_target = 0x78; + if (psytcopus_vars->held_projectile != 0) { + FUN_L00_002371e0_p(psytcopus_vars->held_projectile); + psytcopus_vars->held_projectile = 0; } - psytcopus_vars->unk158 += scale_game_frames(60); + psytcopus_vars->knockback_extension_timer += scale_game_frames(60); break; case HIT_REACTION_DEATH: case HIT_REACTION_DEATH_KNOCKBACK: psytcopus->flags &= 0xEFFF; psytcopus_vars->unk80 = psytcopus_knockback_base_gravity_gp * frame_time_sq; psytcopus_vars->unk88 = psytcopus_death_knockback_base_horizontal_speed_gp * frame_time; - psytcopus_vars->unk8C = psytcopus_death_knockback_base_vertical_speed_gp * frame_time; + psytcopus_vars->knockback_vertical_speed = psytcopus_death_knockback_base_vertical_speed_gp * frame_time; psytcopus_vars->unkC0 = 4.0f; psytcopus_vars->unkC4 = 10.0f; source_to_psytcopus_heading = fast_arc_tan( @@ -368,13 +368,13 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { FUN_L00_0025ab48_p(&projectile_and_hit_vector_scratch, &angle2, &psytcopus_vars->unk88, - &psytcopus_vars->unk8C); + &psytcopus_vars->knockback_vertical_speed); FUN_L00_0025c558_p(psytcopus, psytcopus_vars->unk70, 6, 1, 0, angle2); psytcopus->state = PSYTCOPUS_STATE_DEATH_KNOCKBACK; - psytcopus_vars->unk67 = 0xF0; - if (psytcopus_vars->unk160 != 0) { - FUN_L00_002371e0_p(psytcopus_vars->unk160); - psytcopus_vars->unk160 = 0; + psytcopus_vars->hit_reaction_channel_target = 0xF0; + if (psytcopus_vars->held_projectile != 0) { + FUN_L00_002371e0_p(psytcopus_vars->held_projectile); + psytcopus_vars->held_projectile = 0; } FUN_L00_00257470_p(psytcopus, 0, -1); break; From c8a74401fdd1c59025835fcd7e6ed355c21fd2af Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:06:50 +0000 Subject: [PATCH 746/758] decomp: clarify names in update_linked_effect_particle_with_collision_and_fade b08 -> projected_link_rotation: In authoritative C O_26e670_26e670.b08 receives truncate_float_to_s32(fast_arc_tan(acc.f[0], acc.f[1]) * 128.0f / pi) - 0x20. Retail 0026e964-0026e9f4 subtracts the reference position from the target and candidate, transforms each by 00166D40, divides by its fourth component, and subtracts the projected candidate from projected target. 0026e9f8-0026ea28 applies atan, angle-to-byte scaling and bias, then sb to particle+8. Original Ghidra cVar1 and *(char *)(iVar7+8) agree: this is the projected link-direction rotation encoding. i04 -> packed_rgba_color: Authoritative C reads particle->i04 >> 24 into faded_alpha, subtracts two and reinserts positive alpha while preserving i04 & 0xFFFFFF. Retail 0026eaec loads particle+4, 0026eaf0 extracts its top byte, 0026eaf4 decrements by two, and 0026eb00-0026eb14 shifts the faded alpha back by 24, preserves the low 24 bits and stores the packed word. Original Ghidra *(uint *)(iVar7+4) confirms the same packed color/alpha flow, with terminal unlink/free when alpha is exhausted. --- .../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 99f7548548..0a113b297c 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 @@ -2528,8 +2528,8 @@ typedef struct { struct O_26e670_26e670 { u8 p0[4]; - u32 i04; - u8 b08; + u32 packed_rgba_color; + u8 projected_link_rotation; u8 p9[7]; V_26e670_26e670 pos; P_26e670_26e670 p; @@ -2616,7 +2616,7 @@ void update_linked_effect_particle_with_collision_and_fade(O_26e670_26e670 *part &projected_next_position, 1.0f / projected_next_position.f[3]); fast_vec_sub(&acc, &acc, &projected_next_position); - particle->b08 = + particle->projected_link_rotation = truncate_float_to_s32(fast_arc_tan(acc.f[0], acc.f[1]) * 128.0f / 3.1415927f) - 0x20; if (P->sphere_collision_active) { FUN_L00_001ff660_x(P, P, &coll_hit_normal); @@ -2632,9 +2632,9 @@ void update_linked_effect_particle_with_collision_and_fade(O_26e670_26e670 *part } qcopy(&particle->pos, &next_position); if (P->motion_and_fade_flags & 2) { - s32 faded_alpha = (particle->i04 >> 24) - 2; + s32 faded_alpha = (particle->packed_rgba_color >> 24) - 2; if (faded_alpha > 0) { - particle->i04 = (particle->i04 & 0xFFFFFF) | (faded_alpha << 24); + particle->packed_rgba_color = (particle->packed_rgba_color & 0xFFFFFF) | (faded_alpha << 24); } else if (P->link == 0) { if (P->tgt) P->tgt->p.link = 0; From 2644a7f53691401d9d69d14ebc166136d8c65a7e Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:06:53 +0000 Subject: [PATCH 747/758] decomp: clarify names in fred_pokitaru_update f0C -> dialogue_activation_threshold: Assigned retail 0x002f0f38-0x002f0f4c passes pvars to initialize_npc_dialogue then stores 4.0f at +0x0c, matching moby_vars->f0C in the authoritative C. Checked level-11 helper update_npc_dialogue (request 75fcab1c69174e42bf6e7017de951d59) preserves that pvars argument in s1 at 0x0028b84c. At 0x0028b8a4-0x0028b8bc it computes hero-to-moby distance, loads +0x0c, doubles it, and returns false if distance exceeds it. At 0x0028b8f4-0x0028b914 it computes heading difference, compares it with the same +0x0c float, and returns false if greater. This proves a threshold gating dialogue activation with both proximity and angle uses, rather than a radius alone. h04 -> dialogue_result: The assigned C passes moby_vars to initialize_npc_dialogue and update_npc_dialogue; checked level-11 initializer request f08320df03714c289e9e6bdc03f6f001 preserves pvars in s0 at 0x0028bc80 and writes signed sentinel -1 into short +4 at 0x0028bcd4. Assigned retail 0x002f1130-0x002f1140 waits until dialogue status is no longer 2, returns the moby to dialogue checking, then loads signed pvars+4 and tests it against 2. Only this outcome gates the persistent item/pricing flag changes, queued message, save, and help calls at 0x002f1148-0x002f1188. The source h04 thus records the dialogue result consumed after dialogue ends; the name does not assign semantic labels to individual result codes. --- src/overlays/l11/mobys/fred_pokitaru.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/overlays/l11/mobys/fred_pokitaru.c b/src/overlays/l11/mobys/fred_pokitaru.c index 837730e27d..54b5be0fcf 100644 --- a/src/overlays/l11/mobys/fred_pokitaru.c +++ b/src/overlays/l11/mobys/fred_pokitaru.c @@ -41,9 +41,9 @@ extern unsigned char D_0014C050[]; /* Pokitaru sentry pvars (class of fred_pokitaru_update). */ struct PokSentryVars { char pad00[4]; - short h04; + short dialogue_result; char pad06[6]; - float f0C; + float dialogue_activation_threshold; char pad10[0x38]; int slot; char pad4C[4]; @@ -94,7 +94,7 @@ void fred_pokitaru_update(struct Moby *moby) { return; } initialize_npc_dialogue(moby, moby_vars); - moby_vars->f0C = 4.0f; + moby_vars->dialogue_activation_threshold = 4.0f; break; case FRED_POKITARU_CHECK_DIALOGUE: if (update_npc_dialogue(moby, moby_vars)) { @@ -126,7 +126,7 @@ void fred_pokitaru_update(struct Moby *moby) { case FRED_POKITARU_WAIT_FOR_DIALOGUE_END: if (D_L11_0015F5C4 != 2) { moby->state = FRED_POKITARU_CHECK_DIALOGUE; - if (moby_vars->h04 == 2) { + if (moby_vars->dialogue_result == 2) { alternate_item_available[1] = 0; discount_purchase_pricing[0] = 1; D_0013D50B = 1; From 1c3dd1bd889dc360ab5db54e02deac606ca82121 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:06:56 +0000 Subject: [PATCH 748/758] decomp: clarify names in gemlik_projectile_update f2C -> damage: Retail 0030649C..003064C0 validates the indexed hit row's owner then loads its +0x2C float, adds 1.0 and stores it back; authoritative C expresses target_hit_entry->f2C += 1.0f. The alternate branch calls record_moby_hit with a descriptor damage of 1.0f; supplied record_moby_hit context writes hit_descriptor->f to hit_record->damage at this same row position, proving accumulated hit damage. i24 -> hit_flags: Retail 00306464 passes s3=0x10001 to make_hit_descriptor, and 003064F8..00306508 reselects the owner-matched target's hit row and stores the identical s3 mask at +0x24. Authoritative C writes matched_target_hit_entry->i24 = hit_mask; supplied record_moby_hit context transfers descriptor y into hit_record->flags, proving hit flags rather than a generic integer. p34 -> owner_moby: Retail 00306488..003064A4 indexes a 0x40-byte hit row by ent's Moby hit_slot (+0xA4), loads its +0x34 pointer and compares it with ent. Authoritative C tests target_hit_entry->p34 != ent before calling record_moby_hit. Supplied record_moby_hit context stores owner_moby into hit_record->owner and uses the same owner equality to validate a slot, proving this pointer owns the hit record. s2A -> source_oclass: Retail 003064E4..003064F4 loads the projectile moby's unsigned halfword at +0xA6 and stores it in the matched target hit row at +0x2A; 00306474..00306480 copies the same source into the new hit descriptor. Authoritative C mirrors both transfers. Supplied retail annotation also identifies Moby +0xA6 as oclass in the collision-target zero-class check at 003067D0, establishing the hit's source moby class. --- src/overlays/l13/mobys/gemlik_projectile.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l13/mobys/gemlik_projectile.c b/src/overlays/l13/mobys/gemlik_projectile.c index 0bab8a5d0e..bbb344d6d4 100644 --- a/src/overlays/l13/mobys/gemlik_projectile.c +++ b/src/overlays/l13/mobys/gemlik_projectile.c @@ -75,13 +75,13 @@ typedef struct { struct L13Ent00178480 { char pad0[0x24]; - int i24; + int hit_flags; unsigned char b28; unsigned char b29; - unsigned short s2A; - float f2C; + unsigned short source_oclass; + float damage; int pad30; - char *p34; + char *owner_moby; char pad38[8]; }; @@ -145,19 +145,19 @@ void gemlik_projectile_update(struct Moby *moby) { *(unsigned short *)(work.hit + 0x1A) = *(unsigned short *)((char *)moby + 0xA6); work.hit[0x19] = 1; if ((unsigned char)ent[0xA4] == 0xFF || - (target_hit_entry = &l13_moby_hit_entries[(unsigned char)ent[0xA4]])->p34 != + (target_hit_entry = &l13_moby_hit_entries[(unsigned char)ent[0xA4]])->owner_moby != ent) { record_moby_hit(ent, work.hit); } else { - target_hit_entry->f2C += 1.0f; + target_hit_entry->damage += 1.0f; l13_moby_hit_entries[(unsigned char)ent[0xA4]].b28 = 1; l13_moby_hit_entries[(unsigned char)ent[0xA4]].b29 = 1; - l13_moby_hit_entries[(unsigned char)ent[0xA4]].s2A = + l13_moby_hit_entries[(unsigned char)ent[0xA4]].source_oclass = *(unsigned short *)((char *)moby + 0xA6); { struct L13Ent00178480 *matched_target_hit_entry = &l13_moby_hit_entries[(unsigned char)ent[0xA4]]; - matched_target_hit_entry->i24 = hit_mask; + matched_target_hit_entry->hit_flags = hit_mask; } } break; From 231910d6cfca4f6afcc24562048bf3389dad0e68 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:07:00 +0000 Subject: [PATCH 749/758] decomp: clarify names in update_shuttle_travel_and_camera f88 -> travel_yaw_offset: Retail 0x002f2460-0x002f2484 reads pvars+0x88 as an angle: cosine scales the path-derived moby pitch at +0x44, and fast_add_rotations adds it to path yaw at +0x48. At 0x002f261c-0x002f2658 its address is approached toward pi after travel progress exceeds 0.8. These C uses establish the shuttle travel yaw offset. f8C -> travel_yaw_step: Assigned retail 0x002f262c passes pvars+0x8c as the second mutable scalar to approach_angle at 0x002f2658, alongside the yaw offset address. Checked level-17 helper 0x002566c4 retains this pointer in s0; 0x00256700-0x00256740 uses its signed scalar and squared value for direction/stopping calculations, and 0x00256844-0x00256850 loads it and adds it via fast_add_rotations directly into the first angle. It is the persistent signed yaw increment per update, hence travel_yaw_step. fA4 -> travel_fraction: Retail 0x002f21e4 and 0x002f2234-0x002f2240 approach pvars+0xa4 toward 1 by 1/scale_game_frames(900). Its float value multiplies all three path point counts minus one at 0x002f225c, 0x002f22b8 and 0x002f22f0; it blends endpoint scales at 0x002f25dc-0x002f2604 and equality with 1 determines completion at 0x002f2670. This is the normalized travel fraction, distinct from the existing integer-view travel_progress binding. --- src/overlays/l17/mobys/shuttle.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/overlays/l17/mobys/shuttle.c b/src/overlays/l17/mobys/shuttle.c index fe2bb96f15..a293cfcd5d 100644 --- a/src/overlays/l17/mobys/shuttle.c +++ b/src/overlays/l17/mobys/shuttle.c @@ -329,12 +329,12 @@ struct Dat_3CC0_f2180 { int c[2]; int pad1[3]; int e84; - float f88; - float f8C; + float travel_yaw_offset; + float travel_yaw_step; char pad2[0x0C]; float f9C; float fA0; - float fA4; + float travel_fraction; }; extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); @@ -352,18 +352,18 @@ int update_shuttle_travel_and_camera(char *moby, int route_index) { camera_aim_blend, moby_path_blend, interpolation_start_angle, turn; int i1, i2, i3; - approach_value(&shuttle_vars->fA4, 1.0f, 1.0f / (float)scale_game_frames(0x384)); - scaled_path_position = shuttle_vars->fA4 * (float)(camera_position_path->n - 1); + approach_value(&shuttle_vars->travel_fraction, 1.0f, 1.0f / (float)scale_game_frames(0x384)); + scaled_path_position = shuttle_vars->travel_fraction * (float)(camera_position_path->n - 1); i1 = truncate_float_to_s32(scaled_path_position); camera_position_index_float = (float)i1; camera_position_blend = scaled_path_position - camera_position_index_float; - camera_aim_blend = shuttle_vars->fA4 * 1.02f; + camera_aim_blend = shuttle_vars->travel_fraction * 1.02f; if (camera_aim_blend > 1.0f) camera_aim_blend = 1.0f; scaled_path_position = camera_aim_blend * (float)(camera_aim_path->n - 1); i2 = truncate_float_to_s32(scaled_path_position); camera_aim_blend = scaled_path_position - (float)i2; - scaled_path_position = shuttle_vars->fA4 * (float)(shuttle_movement_path->n - 1); + scaled_path_position = shuttle_vars->travel_fraction * (float)(shuttle_movement_path->n - 1); moby_path_blend = scaled_path_position - camera_position_index_float; i3 = truncate_float_to_s32(scaled_path_position); lerp_vector(camera_position, @@ -401,8 +401,8 @@ int update_shuttle_travel_and_camera(char *moby, int route_index) { interpolation_start_angle) * moby_path_blend, interpolation_start_angle); - MOBY(moby)->rot.y = MOBY(moby)->rot.y * fast_cos(shuttle_vars->f88); - MOBY(moby)->rot.z = fast_add_rotations(MOBY(moby)->rot.z, shuttle_vars->f88); + MOBY(moby)->rot.y = MOBY(moby)->rot.y * fast_cos(shuttle_vars->travel_yaw_offset); + MOBY(moby)->rot.z = fast_add_rotations(MOBY(moby)->rot.z, shuttle_vars->travel_yaw_offset); } else { MOBY(moby)->rot.y = -fast_arc_tan( vector_distance_xy(&shuttle_movement_path->p[0], &shuttle_movement_path->p[1]), @@ -435,15 +435,15 @@ int update_shuttle_travel_and_camera(char *moby, int route_index) { } MOBY(moby)->scale = MOBY(moby)->pclass->scale * - (shuttle_vars->f9C - (shuttle_vars->f9C - shuttle_vars->fA0) * shuttle_vars->fA4); - if (shuttle_vars->fA4 > 0.8f) { + (shuttle_vars->f9C - (shuttle_vars->f9C - shuttle_vars->fA0) * shuttle_vars->travel_fraction); + if (shuttle_vars->travel_fraction > 0.8f) { turn = frame_time_sq * 12.566371f; - approach_angle(&shuttle_vars->f88, - &shuttle_vars->f8C, + approach_angle(&shuttle_vars->travel_yaw_offset, + &shuttle_vars->travel_yaw_step, 3.1415927f, turn, turn, frame_time * 6.2831855f); } - return shuttle_vars->fA4 == 1.0f; + return shuttle_vars->travel_fraction == 1.0f; } From ad8eb96d986dcb78ed4a10df7c669fd9f44b8653 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:07:00 +0000 Subject: [PATCH 750/758] decomp: clarify names in _cpr8 domain_0_value_3 -> MPEG_TRANSFER_LAYOUT_SINGLE_PASS: Retail 0x001298f0 loads decoder +0x174 (source decoder_transfer_layout->transfer_layout_mode); 0x001298fc-0x00129900 compares it with 3 and branches to 0x0012991c. That path uses the full copy_params +0x10 times 0x180 byte count at 0x00129924-0x0012992c, computes destination stride, and unconditionally stores transfer_pass_count=1 at 0x00129948-0x00129950. It bypasses the other-mode nonzero-width path at 0x00129954-0x00129978 that halves source sizing and sets two passes. Stack +4 bounds the outer transfer loop at 0x00129ae8-0x00129b00, proving single-pass transfer-layout behavior independently of any MPEG frame/field interpretation. --- src/sdk/mpeg/macroblock/cpr8.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sdk/mpeg/macroblock/cpr8.c b/src/sdk/mpeg/macroblock/cpr8.c index e4786f3924..59d53f5493 100644 --- a/src/sdk/mpeg/macroblock/cpr8.c +++ b/src/sdk/mpeg/macroblock/cpr8.c @@ -20,6 +20,9 @@ struct MpegDecoderFrame { extern s32 DIntr(); void _cpr8(struct MpegDecoder *decoder, struct MpegCopyParams *copy_params) { + enum { + MPEG_TRANSFER_LAYOUT_SINGLE_PASS = 3 + }; struct MpegDecoderFrame *decoder_transfer_layout; s32 transfer_pass_count; s32 destination_pass_base; @@ -38,7 +41,7 @@ void _cpr8(struct MpegDecoder *decoder, struct MpegCopyParams *copy_params) { decoder_transfer_layout = (struct MpegDecoderFrame *)decoder; source_addr = copy_params->unk0 & 0x0FFFFFFF; destination_pass_base = decoder->unkD8 & 0x0FFFFFFF; - if (decoder_transfer_layout->transfer_layout_mode == 3) { + if (decoder_transfer_layout->transfer_layout_mode == MPEG_TRANSFER_LAYOUT_SINGLE_PASS) { goto block_3; } layout_width = decoder_transfer_layout->unkE0; From 19c8bbde8d668948485e68448117a7559e780495 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:08:59 +0000 Subject: [PATCH 751/758] decomp: clarify names in update_puffoid_damage_and_path_goal unk117 -> hit_flash_red_target: Retail 00315bd4/00315c8c/00315d64 writes 250/120/240 to pvars+117 after hit reactions. Calls 00315d7c/00315d90 pass pvars+110 as the color-animation record. Checked helper fda38dd28203420484e3dd4ba23463ea at 00283394-002833bc maps get_moby_color's first (red) output to record+4, agreeing with supplied trooper_anim_update source r/g/b capture. Checked helper 4f7954ba8e4b42e183fc705aebe2a193 loads record+7 (pvars+117) at 00283468/00283488 and interpolates from record+4 toward it at 00283484-002834b0, then back toward the saved channel at 00283534-00283578. The interpolated first channel is passed as a1 at 00283610, alongside the other two channels. Thus this byte is the hit color flash's red target, not duration. unk1A4 -> horizontal_movement_step_limit: Retail 00315990 loads established l11_puffoid_horizontal_speed_limit, 0031599c loads frame_time, 003159a8 multiplies them, and 003159b4 stores the product to pvars+1A4. Authoritative C assigns exactly l11_puffoid_horizontal_speed_limit * frame_time to this f32 field. Supplied update_moby_target_heading_and_conditional_movement repeats this assignment at moby_vars+1A4 immediately before constructing the yaw-derived planar heading vector and invoking move_moby_with_ground_and_collision_checks on moby_vars+180. This is the horizontal movement speed limit scaled to the update step. --- src/overlays/l11/mobys/puffoid.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l11/mobys/puffoid.c b/src/overlays/l11/mobys/puffoid.c index 557ce514f1..87e3515468 100644 --- a/src/overlays/l11/mobys/puffoid.c +++ b/src/overlays/l11/mobys/puffoid.c @@ -691,7 +691,7 @@ struct L11PatrolVars { s32 retimer; /* 0x38: nonzero restarts the timer at 0x244 */ u8 pad3C[0xD4]; u8 move[7]; /* 0x110: movement state (trooper_anim_update / trooper_anim_finish) */ - u8 unk117; /* 0x117 */ + u8 hit_flash_red_target; /* 0x117 */ u8 pad118[8]; u8 unk120[0x10]; /* 0x120 */ f32 unk130; /* 0x130 */ @@ -707,7 +707,7 @@ struct L11PatrolVars { f32 unk170; /* 0x170 */ f32 unk174; /* 0x174 */ u8 pad178[0x2C]; - f32 unk1A4; /* 0x1A4 */ + f32 horizontal_movement_step_limit; /* 0x1A4 */ u8 pad1A8[0x28]; Vec4f goal; /* 0x1D0 */ u8 pad1E0[0x30]; @@ -772,7 +772,7 @@ void update_puffoid_damage_and_path_goal(struct Moby *moby) { char *path; moby->scale = moby->pclass->scale * D_L11_001622CC; - patrol_vars->unk1A4 = l11_puffoid_horizontal_speed_limit * frame_time; + patrol_vars->horizontal_movement_step_limit = l11_puffoid_horizontal_speed_limit * frame_time; if (patrol_vars->carrier != -1 && moby->state != PUFFOID_STATE_DEATH_KNOCKBACK && moby->state != PUFFOID_STATE_KNOCKBACK && moby->state != PUFFOID_STATE_CARRIER_DEATH_KNOCKBACK && @@ -821,7 +821,7 @@ void update_puffoid_damage_and_path_goal(struct Moby *moby) { break; case HIT_RESPONSE_NON_KNOCKBACK_REACTION: case HIT_RESPONSE_NON_KNOCKBACK_REACTION_ALTERNATE: - patrol_vars->unk117 = 0xFA; + patrol_vars->hit_flash_red_target = 0xFA; break; case HIT_RESPONSE_KNOCKBACK: case HIT_RESPONSE_KNOCKBACK_ALTERNATE: @@ -844,7 +844,7 @@ void update_puffoid_damage_and_path_goal(struct Moby *moby) { } else { moby->state = PUFFOID_STATE_CARRIER_KNOCKBACK; } - patrol_vars->unk117 = 0x78; + patrol_vars->hit_flash_red_target = 0x78; break; } case HIT_RESPONSE_DEATH: @@ -866,7 +866,7 @@ void update_puffoid_damage_and_path_goal(struct Moby *moby) { } else { moby->state = PUFFOID_STATE_CARRIER_DEATH_KNOCKBACK; } - patrol_vars->unk117 = 0xF0; + patrol_vars->hit_flash_red_target = 0xF0; FUN_L00_00257470(moby, 0, -1); break; } From 758d70aa2fe870f2eae6c47a9c92026b0388aea1 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:09:03 +0000 Subject: [PATCH 752/758] decomp: clarify names in veldin_robot_enemy_update unk52 -> blend_source_animation: Assigned retail 0x002e12cc-0x002e12f8 compares moby+0x52 with established current anim at +0x53 before compute_interpolated_record_value and enabling hit flags. Checked helper 0x0024edc8 (request 947c29a08162473a8b1403712b0dcc9e) selects source record +0x68 unless +0x52 is 0xFF, then uses +0x6c (0x0024ede4-0x0024edf0); +0x52 versus +0x53 controls interpolation of the two records (0x0024ee28-0x0024eea0). Checked blend_moby_animation 0x00257880 (request 8087a988108440b997b0e7301af2d4a3) captures a source pose, preserves non-FF +0x52 at +0xa5, sets +0x52=0xFF for that captured source (0x00257910-0x00257950), and writes requested animation to +0x53 at 0x00257964. Thus +0x52 identifies the blend source animation, including captured-pose sentinel, rather than the requested destination animation. --- src/overlays/l00/mobys/veldin_robot_enemy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l00/mobys/veldin_robot_enemy.c b/src/overlays/l00/mobys/veldin_robot_enemy.c index c95ab35ebe..837fb2821d 100644 --- a/src/overlays/l00/mobys/veldin_robot_enemy.c +++ b/src/overlays/l00/mobys/veldin_robot_enemy.c @@ -112,7 +112,7 @@ struct ElectroidMoby { u8 pad36[0x40 - 0x36]; ElectroidVec unk40; u8 pad50[2]; - u8 unk52; + u8 blend_source_animation; u8 anim; u8 pad54[0x70 - 0x54]; u8 unk70; @@ -330,7 +330,7 @@ void veldin_robot_enemy_update(ElectroidMoby *moby) { query.unk8A = moby->unkA6; query.dir[2] = 1.0f; query.unk88 = 0; - if (moby->unk52 == moby->anim && compute_interpolated_record_value(moby) > 1.0f) { + if (moby->blend_source_animation == moby->anim && compute_interpolated_record_value(moby) > 1.0f) { hit = 1; query.flags |= 1; } From 17cfb97f58146e9c8d97c5d9ce8de13c1abcd87f Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:12:00 +0000 Subject: [PATCH 753/758] decomp: clarify names in ultramech_unlimited_update domain_0_value_2 -> ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE: This token compares ultramech_vars->target_range_status at data+0x164, as retail 0x002cf648-0x002cf650 (activation) confirms. Supplied process_ultramech_hits_and_update_target C resets status to 0 and stores 2 only if current_target_search_range is less than distance to the selected target position at data+0x120. Checked helper evidence cb406c75f77a416f9e43b45d58bf7d9f, 0x002d13e4-0x002d1404, confirms distance call, load +0x1b8, c.lt.S and conditional sw 2,+0x164. It is a target-range status domain, separate from moby state and hero enums. domain_1_value_2 -> ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE: This token compares ultramech_vars->target_range_status at data+0x164, as retail 0x002cfc18-0x002cfc20 (attack selection) confirms. Supplied process_ultramech_hits_and_update_target C resets status to 0 and stores 2 only if current_target_search_range is less than distance to the selected target position at data+0x120. Checked helper evidence cb406c75f77a416f9e43b45d58bf7d9f, 0x002d13e4-0x002d1404, confirms distance call, load +0x1b8, c.lt.S and conditional sw 2,+0x164. It is a target-range status domain, separate from moby state and hero enums. domain_2_value_2 -> ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE: This token compares ultramech_vars->target_range_status at data+0x164, as retail 0x002cfd88-0x002cfd90 (firing) confirms. Supplied process_ultramech_hits_and_update_target C resets status to 0 and stores 2 only if current_target_search_range is less than distance to the selected target position at data+0x120. Checked helper evidence cb406c75f77a416f9e43b45d58bf7d9f, 0x002d13e4-0x002d1404, confirms distance call, load +0x1b8, c.lt.S and conditional sw 2,+0x164. It is a target-range status domain, separate from moby state and hero enums. domain_3_value_2 -> ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE: This token compares ultramech_vars->target_range_status at data+0x164, as retail 0x002d0198-0x002d01a0 (burst wait) confirms. Supplied process_ultramech_hits_and_update_target C resets status to 0 and stores 2 only if current_target_search_range is less than distance to the selected target position at data+0x120. Checked helper evidence cb406c75f77a416f9e43b45d58bf7d9f, 0x002d13e4-0x002d1404, confirms distance call, load +0x1b8, c.lt.S and conditional sw 2,+0x164. It is a target-range status domain, separate from moby state and hero enums. domain_4_value_2 -> ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE: This token compares ultramech_vars->target_range_status at data+0x164, as retail 0x002d03e0-0x002d03e4 (approach) confirms. Supplied process_ultramech_hits_and_update_target C resets status to 0 and stores 2 only if current_target_search_range is less than distance to the selected target position at data+0x120. Checked helper evidence cb406c75f77a416f9e43b45d58bf7d9f, 0x002d13e4-0x002d1404, confirms distance call, load +0x1b8, c.lt.S and conditional sw 2,+0x164. It is a target-range status domain, separate from moby state and hero enums. f188 -> burst_pause_duration: Authoritative C uses f188 only when FIRE_BURST enters WAIT_BETWEEN_BURSTS. Retail 0x002cff70-0x002cff90 loads data+0x188, multiplies by 60.0, frame-scales and truncates it into data+0x1c0 timer; 0x002d0378-0x002d0398 resumes firing on timer expiry. This proves the inter-burst pause duration input without asserting units. fE8 -> ground_fall_step: In the nonmoving active-state ground handling, retail 0x002d0ed0-0x002d0ef0 increases data+0xe8 by frame_time_sq*30; 0x002d0ef4-0x002d0f20 subtracts this step from position Z through two probe-offset adjustments. 0x002d0f24-0x002d0f28 clamps to probed ground and resets the field to zero. Source fE8 follows precisely this downward ground-motion accumulator flow. v1A0 -> previous_melee_endpoint: Source MELEE_ATTACK obtains attack_end from moby point 1, passes &v1A0 as the previous endpoint argument of sweep_hit_segment, then copies attack_end into v1A0. Retail 0x002d082c retains data+0x1a0 in s1; 0x002d08b8-0x002d08d4 passes it as a3 with current start/end, and 0x002d08e4-0x002d08e8 saves the current endpoint there for the next sweep. w1CC -> activation_wait_group_id: Source WAIT_FOR_ACTIVATION treats w1CC=-1 as no group gate; otherwise count_active_moby_group_members(w1CC,0x40) must return zero before activation proceeds. Retail 0x002cf5d0-0x002cf610 loads data+0x1cc into a0 for that count with a1=0x40, then branches out of the update when the returned count is nonzero. This identifies the group whose members delay activation. w1D4 -> combat_path_moves_disabled: Retail 0x002cf55c-0x002cf578 sets data+0x1d4=1 if either combat path index at +0x180/+0x184 is -1. The zero tests at 0x002d0084-0x002d0098, 0x002d023c-0x002d0288, 0x002d065c-0x002d06ac and 0x002d094c-0x002d0960 gate ballistic combat-path repositioning from firing, burst wait, melee and knockback recovery. Source w1D4 has this same disabling polarity; it does not disable entry-path traversal. w1D8 -> suppress_close_combat_and_knockback_motion: Source uses nonzero w1D8 to bypass approach/melee selection and firing-state close-combat/path interruptions. Retail 0x002cfc98-0x002cfca0 sends nonzero data+0x1d8 directly to firing; 0x002cff94-0x002cff98 and 0x002d0208-0x002d020c bypass movement decisions. In recovery 0x002d08f4-0x002d0920 nonzero bypasses step_moby_motion and restores animation speed; 0x002d0930-0x002d0944 then waits for animation completion. The name states those proven suppressions, not a universal immobility guarantee. w1DC -> activation_clip_volume: When no activation wait group is selected, source passes w1DC with hero.motion.pos to is_point_inside_clip_volume before enabling the moby. Retail 0x002cf5e0-0x002cf5ec supplies data+0x1dc as a1 and hero position 0x0013f3d0 as a0 to the clip-volume test; 0x002cf5f0 bypasses enabling when the test returns zero. The name describes its activation-volume selector role without asserting its representation. --- src/overlays/l15/mobys/ultramech_unlimited.c | 73 ++++++++++---------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/src/overlays/l15/mobys/ultramech_unlimited.c b/src/overlays/l15/mobys/ultramech_unlimited.c index 9c92c0b795..57dfabcd69 100644 --- a/src/overlays/l15/mobys/ultramech_unlimited.c +++ b/src/overlays/l15/mobys/ultramech_unlimited.c @@ -184,7 +184,7 @@ struct UData { unsigned char b58; char pad59[0x17]; char hit[0x78]; - float fE8; + float ground_fall_step; char padEC[0x74]; UMoby *target; int target_range_status; @@ -193,9 +193,9 @@ struct UData { float activation_target_search_range; char pad178[8]; int paths[2]; - float f188; + float burst_pause_duration; char pad18C[0x14]; - Vec4 v1A0; + Vec4 previous_melee_endpoint; int side; int point; float current_target_search_range; @@ -203,11 +203,11 @@ struct UData { int timer; int shots; int damage_reaction_this_update; - int w1CC; + int activation_wait_group_id; int target_constraint_path_index; - int w1D4; - int w1D8; - int w1DC; + int combat_path_moves_disabled; + int suppress_close_combat_and_knockback_motion; + int activation_clip_volume; int snd; char pad1E4[0x1C]; unsigned char v200[0x10]; @@ -284,6 +284,9 @@ void ultramech_unlimited_update(UMoby *m) __asm__("FUN_L15_002cf3a8"); /* Moby class 491 */ void ultramech_unlimited_update(UMoby *ultramech_moby) { + enum { + ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE = 2 + }; Vec4 vector_or_hit_descriptor; Vec4 position_or_motion_vector; Vec4 vector_arithmetic_result; @@ -342,7 +345,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { ultramech_moby->w94 = 0; ultramech_moby->flags = (ultramech_moby->flags | 0x41) & 0xEFFF; if (ultramech_vars->paths[0] == -1 || ultramech_vars->paths[1] == -1) - ultramech_vars->w1D4 = 1; + ultramech_vars->combat_path_moves_disabled = 1; if (ultramech_vars->path != -1) ultramech_moby->pos.q = D_L15_001B0AB0[ultramech_vars->path]->points[0].q; ultramech_moby->state = ULTRAMECH_WAIT_FOR_ACTIVATION; @@ -350,17 +353,17 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { blend_moby_animation(ultramech_moby, 0, 0, 5); break; case ULTRAMECH_WAIT_FOR_ACTIVATION: - if (ultramech_vars->w1CC != -1 || - is_point_inside_clip_volume(&hero.motion.pos, ultramech_vars->w1DC)) { - if (ultramech_vars->w1CC != -1 && - count_active_moby_group_members(ultramech_vars->w1CC, 0x40)) + if (ultramech_vars->activation_wait_group_id != -1 || + is_point_inside_clip_volume(&hero.motion.pos, ultramech_vars->activation_clip_volume)) { + if (ultramech_vars->activation_wait_group_id != -1 && + count_active_moby_group_members(ultramech_vars->activation_wait_group_id, 0x40)) break; if (hero.vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK) { ultramech_moby->w94 = *(int *)(ultramech_moby->cls + 0x10); ultramech_moby->flags = (ultramech_moby->flags & 0xFFBE) | 0x1000; } } - if (ultramech_vars->target_range_status != 2 && ultramech_vars->path != -1) { + if (ultramech_vars->target_range_status != ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE && ultramech_vars->path != -1) { struct Hero *pl = &hero; if (pl->vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK && (ultramech_moby->flags & 0x1000)) { @@ -487,7 +490,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { case ULTRAMECH_AIM_AND_SELECT_ATTACK: if (ultramech_moby->anim != 0 && (ultramech_moby->animFlags & 2)) blend_moby_animation(ultramech_moby, 0, 0, scale_game_frames(0x14)); - if (ultramech_vars->target_range_status != 2) { + if (ultramech_vars->target_range_status != ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE) { approach_angle(&ultramech_moby->rot.f[2], fast_arc_tan(combat_target->pos.f[0] - ultramech_moby->pos.f[0], combat_target->pos.f[1] - ultramech_moby->pos.f[1]), @@ -496,13 +499,13 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { frame_time_sq * 8.726646f, frame_time * 12.566371f); if (fast_dec_timer(&ultramech_vars->timer)) { - if (ultramech_vars->w1D8 == 0 && + if (ultramech_vars->suppress_close_combat_and_knockback_motion == 0 && vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) < *(float *)&ultramech_approach_target_range_gp) { ultramech_moby->state = ULTRAMECH_APPROACH_TARGET; if (ultramech_moby->anim != 1) blend_moby_animation(ultramech_moby, 1, 0, scale_game_frames(0xA)); - } else if (ultramech_vars->w1D8 == 0 && + } else if (ultramech_vars->suppress_close_combat_and_knockback_motion == 0 && vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) < *(float *)&ultramech_melee_range_gp) { ultramech_moby->state = ULTRAMECH_MELEE_ATTACK; @@ -522,7 +525,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { blend_moby_animation(ultramech_moby, 7, 0, scale_game_frames(5)); ultramech_moby->animSpeed = *(float *)&ultramech_firing_animation_speed_gp; } - if (ultramech_vars->target_range_status != 2) { + if (ultramech_vars->target_range_status != ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE) { int fire = -1; approach_angle(&ultramech_moby->rot.f[2], fast_arc_tan(combat_target->pos.f[0] - ultramech_moby->pos.f[0], @@ -564,22 +567,22 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { if (ultramech_moby->anim != 0) blend_moby_animation(ultramech_moby, 0, 0, scale_game_frames(0xA)); ultramech_vars->timer = - truncate_float_to_s32(FUN_L04_001f1978(ultramech_vars->f188 * 60.0f)); - } else if (ultramech_vars->w1D8 == 0 && + truncate_float_to_s32(FUN_L04_001f1978(ultramech_vars->burst_pause_duration * 60.0f)); + } else if (ultramech_vars->suppress_close_combat_and_knockback_motion == 0 && vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) < *(float *)&ultramech_approach_target_range_gp) { ultramech_moby->state = ULTRAMECH_APPROACH_TARGET; if (ultramech_moby->anim != 1) blend_moby_animation(ultramech_moby, 1, 0, scale_game_frames(0xA)); - } else if (ultramech_vars->w1D8 == 0 && + } else if (ultramech_vars->suppress_close_combat_and_knockback_motion == 0 && vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) < *(float *)&ultramech_melee_range_gp) { ultramech_moby->state = ULTRAMECH_MELEE_ATTACK; if (ultramech_moby->anim != 2) blend_moby_animation(ultramech_moby, 2, 0, scale_game_frames(0xA)); - } else if (ultramech_vars->w1D8 == 0 && + } else if (ultramech_vars->suppress_close_combat_and_knockback_motion == 0 && vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) > 10.0f && - ultramech_vars->damage_reaction_this_update != 0 && ultramech_vars->w1D4 == 0) { + ultramech_vars->damage_reaction_this_update != 0 && ultramech_vars->combat_path_moves_disabled == 0) { ultramech_moby->state = ULTRAMECH_BALLISTIC_PATH_MOVE; ultramech_vars->timer = 0; ultramech_vars->side = (ultramech_vars->side + 1) & 1; @@ -609,7 +612,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { } break; case ULTRAMECH_WAIT_BETWEEN_BURSTS: - if (ultramech_vars->target_range_status != 2) { + if (ultramech_vars->target_range_status != ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE) { approach_angle(&ultramech_moby->rot.f[2], fast_arc_tan(combat_target->pos.f[0] - ultramech_moby->pos.f[0], combat_target->pos.f[1] - ultramech_moby->pos.f[1]), @@ -617,9 +620,9 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { frame_time_sq * 8.726646f, frame_time_sq * 8.726646f, frame_time * 12.566371f); - if (ultramech_vars->w1D8 == 0 && + if (ultramech_vars->suppress_close_combat_and_knockback_motion == 0 && vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) < 8.0f && - ultramech_vars->w1D4 == 0 && + ultramech_vars->combat_path_moves_disabled == 0 && ultramech_vars->point < D_L15_001B0AB0[((UPaths *)((char *)ultramech_vars + 0x180)) ->idx[ultramech_vars->side]] ->count - @@ -660,7 +663,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { case ULTRAMECH_APPROACH_TARGET: { float desired_heading = fast_arc_tan(combat_target->pos.f[0] - ultramech_moby->pos.f[0], combat_target->pos.f[1] - ultramech_moby->pos.f[1]); - if (ultramech_vars->target_range_status != 2) { + if (ultramech_vars->target_range_status != ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE) { desired_heading = compute_ultramech_flocking_steering_point( ultramech_moby, &position_or_motion_vector, ultramech_vars->current_target_search_range); if (vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) < @@ -717,7 +720,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { if (ultramech_moby->animFlags & 2) { if (vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) < *(float *)&ultramech_melee_range_gp && - ultramech_vars->w1D4 == 0 && + ultramech_vars->combat_path_moves_disabled == 0 && ultramech_vars->point < D_L15_001B0AB0[((UPaths *)((char *)ultramech_vars + 0x180)) ->idx[ultramech_vars->side]] ->count - @@ -767,24 +770,24 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { sweep_hit_segment(&attack_start, &attack_end, &attack_start, - &ultramech_vars->v1A0, + &ultramech_vars->previous_melee_endpoint, ultramech_moby, &vector_or_hit_descriptor, 5); noop_main_callback(&attack_start, &attack_end); - qcopy(&ultramech_vars->v1A0, &attack_end); + qcopy(&ultramech_vars->previous_melee_endpoint, &attack_end); } } break; case ULTRAMECH_KNOCKBACK_RECOVERY: { int r = 0; - if (ultramech_vars->w1D8 == 0) { + if (ultramech_vars->suppress_close_combat_and_knockback_motion == 0) { r = step_moby_motion(ultramech_moby, ultramech_vars->hit); } else { ultramech_moby->animSpeed = 1.0f; } - if ((r & 0x40) || (ultramech_vars->w1D8 != 0 && (ultramech_moby->animFlags & 2))) { - if (ultramech_vars->w1D4 == 0) { + if ((r & 0x40) || (ultramech_vars->suppress_close_combat_and_knockback_motion != 0 && (ultramech_moby->animFlags & 2))) { + if (ultramech_vars->combat_path_moves_disabled == 0) { ultramech_moby->state = ULTRAMECH_BALLISTIC_PATH_MOVE; ultramech_vars->timer = 0; ultramech_vars->side = (ultramech_vars->side + 1) & 1; @@ -912,13 +915,13 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { } else if (ultramech_moby->state > ULTRAMECH_WAIT_FOR_ACTIVATION && ultramech_moby->state != ULTRAMECH_DEAD_WAIT_FOR_RESET) { float z; - ultramech_vars->fE8 += frame_time_sq * 30.0f; - ultramech_moby->pos.f[2] -= ultramech_vars->fE8 - 2.0f; + ultramech_vars->ground_fall_step += frame_time_sq * 30.0f; + ultramech_moby->pos.f[2] -= ultramech_vars->ground_fall_step - 2.0f; z = probe_ground_height(&ultramech_moby->pos, 0, 0.5f); ultramech_moby->pos.f[2] -= 2.0f; if (ultramech_moby->pos.f[2] < z) { ultramech_moby->pos.f[2] = z; - ultramech_vars->fE8 = 0.0f; + ultramech_vars->ground_fall_step = 0.0f; } play_entity_sound( (int)ultramech_moby, 2.5f, &ultramech_moby->pos, 0x10000, 40.0f, 1.0f, 0, 1, 0); From a40a70f4aa2256f9aecb5cb91b462907a9dab8dc Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:16:55 +0000 Subject: [PATCH 754/758] decomp: clarify names in handle_psytcopus_hits unk90 -> knockback_collision_radius: unk90 -> knockback_collision_radius. SHA-bound psytcopus.c and original retail Ghidra agree: 0031079c-003107d8 truncate 512.0f and store this s32 at pvars+90 before knockback setup with pvars+70. Checked common-owner motion sibling 00282538 receives that block in s2; 00282bb0-00282bc8 converts block+20 (=pvars+90) to float, scales by 1/1024 and passes f12 with the candidate position to 002225c8. Checked query 002225e4-00222628 loads the position, transfers f12 to vf30, constructs center-minus/plus-radius bounds and scales both center and radius by 1024; 00222660 squares the radius. Triangle distance checks 00222aa0-00222ad8 and 00222b78-00222b98 compare squared separation against this squared radius. This proves a fixed-point collision radius used during knockback, rather than a mask, diameter or speed. --- src/overlays/l11/mobys/psytcopus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/l11/mobys/psytcopus.c b/src/overlays/l11/mobys/psytcopus.c index b95c9f4ff8..2c46c44eab 100644 --- a/src/overlays/l11/mobys/psytcopus.c +++ b/src/overlays/l11/mobys/psytcopus.c @@ -48,7 +48,7 @@ struct PokiPathVars { f32 knockback_speed_approach_step; /* 0x84 */ f32 unk88; /* 0x88 */ f32 knockback_vertical_speed; /* 0x8C */ - s32 unk90; /* 0x90 */ + s32 knockback_collision_radius; /* 0x90 */ s32 unk94; /* 0x94 */ f32 unk98; /* 0x98 */ u8 pad_9C[0x11]; @@ -310,7 +310,7 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { if (psytcopus_vars->health <= 0.0f) { hit_reaction = 1; } - psytcopus_vars->unk90 = truncate_float_to_s32(512.0f); + psytcopus_vars->knockback_collision_radius = truncate_float_to_s32(512.0f); psytcopus_vars->unk98 = 0.5f; psytcopus_vars->unk80 = psytcopus_knockback_base_gravity_gp * frame_time_sq; psytcopus_vars->knockback_speed_approach_step = 0.0005f; From 3ae316c5e7c72749779f9d1fe1854c1da758909d Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:21:28 +0000 Subject: [PATCH 755/758] decomp: clarify names in update_puffoid_damage_and_path_goal unk148 -> knockback_collision_z_offset: Retail 00315b98 initializes pvars+148 to 0.2; 00315c58/00315d30 pass pvars+120 as knockback record. Checked consumer request c6ca66008b6c4dcf8d2d11a72add9514 saves record in s2 at 00282558. At 002825f8-00282628 it copies moby position, adds record+28 to its Z, then probes ground. At 00282a6c-00282abc it adds the same field to pre/post movement collision positions; after collision position replacement 00282be0-00282c10 subtracts that field from moby Z. Thus the field is a knockback collision/probe vertical position offset, not a velocity or duration. unk170 -> knockback_apex_animation_frame: Assigned retail 00315c00/00315cd8 sets pvars+170 to 7.5 in ordinary/death knockback before passing pvars+120 to start. Checked step request c6ca66008b6c4dcf8d2d11a72add9514 maps it to record+50. In rising phase (record+3e=0), 0028289c-002828a8 computes absolute vertical velocity / per-step vertical decrement (the latter subtracted at 00282574-00282588), giving steps to apex. 002828c8-002828dc subtracts current animation frame from record+50 and divides by those steps, then 002829f0-00282a04 approaches that rate in moby+58 animation speed. Helper request ae1114a8bc9d48f9a14ea5053b09a472 shows 00274bf8 returns animation record frame (+4 converted and scaled by 1/16), interpolated using moby animation blend state at +54. This proves an animation frame target synchronized to apex. unk174 -> knockback_landing_animation_frame: Retail 00315c04/00315cdc sets pvars+174 to 11.0 for ordinary/death knockback; it is record+54 relative to pvars+120. Checked step request c6ca66008b6c4dcf8d2d11a72add9514: descending phase record+3e=1 at 00282864-0028286c selects 002828f8; 00282900-00282918 compares current animation frame to record+54 and zeroes moby+58 speed when reached. Otherwise 0028291c-00282978 estimates remaining landing time using vertical decrement, vertical velocity and moby Z minus probed ground height. 0028299c-002829e4 divides record+54 minus current animation frame by that time, clamps speed to 0..2, and approaches it at 002829f0-00282a04. Checked helper ae1114a8bc9d48f9a14ea5053b09a472 establishes the returned interpolated animation frame from record+4 and moby animation blend fields. Thus this is the knockback landing animation frame target. --- src/overlays/l11/mobys/puffoid.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/overlays/l11/mobys/puffoid.c b/src/overlays/l11/mobys/puffoid.c index 87e3515468..b61f910545 100644 --- a/src/overlays/l11/mobys/puffoid.c +++ b/src/overlays/l11/mobys/puffoid.c @@ -700,12 +700,12 @@ struct L11PatrolVars { f32 unk13C; /* 0x13C */ s32 unk140; /* 0x140 */ s32 unk144; /* 0x144 */ - f32 unk148; /* 0x148 */ + f32 knockback_collision_z_offset; /* 0x148 */ u8 pad14C[0x11]; u8 unk15D; /* 0x15D */ u8 pad15E[0x12]; - f32 unk170; /* 0x170 */ - f32 unk174; /* 0x174 */ + f32 knockback_apex_animation_frame; /* 0x170 */ + f32 knockback_landing_animation_frame; /* 0x174 */ u8 pad178[0x2C]; f32 horizontal_movement_step_limit; /* 0x1A4 */ u8 pad1A8[0x28]; @@ -811,7 +811,7 @@ void update_puffoid_damage_and_path_goal(struct Moby *moby) { kind = HIT_RESPONSE_DEATH; } patrol_vars->unk140 = truncate_float_to_s32(512.0f); - patrol_vars->unk148 = 0.2f; + patrol_vars->knockback_collision_z_offset = 0.2f; patrol_vars->unk134 = 0.0f; patrol_vars->unk130 = puffoid_hit_motion_time_squared_scale_gp * frame_time_sq; patrol_vars->unk144 = 9; @@ -832,8 +832,8 @@ void update_puffoid_damage_and_path_goal(struct Moby *moby) { float yaw; patrol_vars->unk138 = puffoid_hit_knockback_horizontal_scale_gp * frame_time; patrol_vars->unk13C = puffoid_hit_knockback_vertical_scale_gp * frame_time; - patrol_vars->unk170 = 7.5f; - patrol_vars->unk174 = 11.0f; + patrol_vars->knockback_apex_animation_frame = 7.5f; + patrol_vars->knockback_landing_animation_frame = 11.0f; yaw = fast_arc_tan(moby->pos.x - hit->moby->pos.x, moby->pos.y - hit->moby->pos.y); position_scratch.q = hit->pos.q; trooper_knockback_arc( @@ -854,8 +854,8 @@ void update_puffoid_damage_and_path_goal(struct Moby *moby) { patrol_vars->unk130 = puffoid_hit_motion_time_squared_scale_gp * frame_time_sq; patrol_vars->unk138 = puffoid_death_knockback_horizontal_scale_gp * frame_time; patrol_vars->unk13C = puffoid_death_knockback_vertical_scale_gp * frame_time; - patrol_vars->unk170 = 7.5f; - patrol_vars->unk174 = 11.0f; + patrol_vars->knockback_apex_animation_frame = 7.5f; + patrol_vars->knockback_landing_animation_frame = 11.0f; yaw = fast_arc_tan(moby->pos.x - hit->moby->pos.x, moby->pos.y - hit->moby->pos.y); position_scratch.q = hit->pos.q; trooper_knockback_arc( From 93353ae27b988382be8da9be7e4b4d7c78addeb4 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:23:10 +0000 Subject: [PATCH 756/758] decomp: clarify names in ultramech_unlimited_update w94 -> collision_geometry: w94 -> collision_geometry (private UMoby int member). Authoritative src/overlays/l15/mobys/ultramech_unlimited.c SHA-256 f3701a08166dbff89429ec60de7c258bb66ff61dc18cc8920007dc49c97c2885 and original retail Ghidra/instructions agree: activation 0x002cf630-0x002cf644 copies class+0x10 to moby+0x94; disabling/reset paths at 0x002cf428, 0x002cf54c, 0x002cf6bc and 0x002d0bc8 clear it. Bounded checked direct collect_mobies_in_sphere evidence e3b845e951034841a74ba1487a282ff4 proves semantics: 0x001ec0e8 loads candidate moby+0x94 into s4, 0x001ec128 skips null, 0x001ec1b8-0x001ec1dc loads moby position, basis and scale, and 0x001ec1d0-0x001ec538 reads geometry-relative offsets, transforms vertices and tests indexed triangles against the query sphere. The alternate 0x001ec538-0x001ec730 walks 0x20-byte primitive records and tests transformed shapes. Thus this is the enabled collision-geometry reference, not merely an offset-derived name; retain the declared int type. --- src/overlays/l15/mobys/ultramech_unlimited.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/l15/mobys/ultramech_unlimited.c b/src/overlays/l15/mobys/ultramech_unlimited.c index 57dfabcd69..2d4a9990af 100644 --- a/src/overlays/l15/mobys/ultramech_unlimited.c +++ b/src/overlays/l15/mobys/ultramech_unlimited.c @@ -161,7 +161,7 @@ struct UMoby { char pad71[7]; UData *data; char pad7C[0x18]; - int w94; + int collision_geometry; char pad98[0x1A]; unsigned short id; char padB4[0xC]; @@ -307,7 +307,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { if (ultramech_moby->state != ULTRAMECH_INITIALIZE && ultramech_moby->state != ULTRAMECH_DEAD_WAIT_FOR_RESET && hero.vehicle_mode != HERO_VEHICLE_MODE_GIANT_CLANK) { - ultramech_moby->w94 = 0; + ultramech_moby->collision_geometry = 0; ultramech_moby->flags |= 0x41; idx = ultramech_vars->snd; if (idx != -1) { @@ -342,7 +342,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { ultramech_vars->activation_target_search_range = 90.0f; if (rand() & 1) ultramech_moby->flags |= 0x8000; - ultramech_moby->w94 = 0; + ultramech_moby->collision_geometry = 0; ultramech_moby->flags = (ultramech_moby->flags | 0x41) & 0xEFFF; if (ultramech_vars->paths[0] == -1 || ultramech_vars->paths[1] == -1) ultramech_vars->combat_path_moves_disabled = 1; @@ -359,7 +359,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { count_active_moby_group_members(ultramech_vars->activation_wait_group_id, 0x40)) break; if (hero.vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK) { - ultramech_moby->w94 = *(int *)(ultramech_moby->cls + 0x10); + ultramech_moby->collision_geometry = *(int *)(ultramech_moby->cls + 0x10); ultramech_moby->flags = (ultramech_moby->flags & 0xFFBE) | 0x1000; } } @@ -371,7 +371,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { !point_in_path_xy(&pl->motion.pos, D_L15_001B0AB0[ultramech_vars->target_constraint_path_index]->points, D_L15_001B0AB0[ultramech_vars->target_constraint_path_index]->count)) { - ultramech_moby->w94 = 0; + ultramech_moby->collision_geometry = 0; ultramech_moby->flags = (ultramech_moby->flags | 0x41) & 0xEFFF; } else { LevelPath *path; @@ -853,7 +853,7 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { ultramech_moby->state = ULTRAMECH_DEAD_WAIT_FOR_RESET; return; case ULTRAMECH_DEAD_WAIT_FOR_RESET: - ultramech_moby->w94 = 0; + ultramech_moby->collision_geometry = 0; ultramech_moby->flags = (ultramech_moby->flags | 0x41) & 0xEFFF; ultramech_vars->b58 = 0; D_L15_001BABD0.cleared[(short)ultramech_moby->id] = 0; From a1e3aeeb80ca2ecdf6ad61e3d4954e6ab8c7ede5 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:27:59 +0000 Subject: [PATCH 757/758] chore: format changed naming sources --- src/camera/apply_camera_shake.c | 3 +- src/camera/camera_activation_check_priority.c | 3 +- src/mobys/init_moby_instance.c | 4 +- src/overlays/l00/mobys/veldin_robot_enemy.c | 6 +- src/overlays/l01/hero/hero_set_state.c | 3 +- src/overlays/l01/mobys/agnogg_ship_front.c | 11 +- src/overlays/l01/mobys/birdbot.c | 141 +++-- src/overlays/l01/mobys/bomber_jet.c | 7 +- src/overlays/l01/mobys/water_lily.c | 20 +- src/overlays/l02/hero/hero_set_state.c | 3 +- src/overlays/l02/hud_counter.c | 3 +- src/overlays/l02/mobys/constructorbot.c | 27 +- src/overlays/l02/mobys/elevator.c | 4 +- src/overlays/l02/mobys/rocket_launcher.c | 4 +- .../l02/mobys/rocket_launcher_projectile.c | 4 +- src/overlays/l02/mobys/sand_shark.c | 83 ++- src/overlays/l02/mobys/sand_shark_nest.c | 10 +- src/overlays/l02/mobys/skids_agent.c | 15 +- src/overlays/l02/mobys/smoke_vent.c | 60 +- src/overlays/l03/hero/hero_set_state.c | 3 +- src/overlays/l03/mobys/kerwan_path_enemy.c | 27 +- .../l03/mobys/metropolis_train_locomotive.c | 59 +- .../l03/mobys/moving_platform_small.c | 3 +- src/overlays/l03/mobys/rail_lift.c | 4 +- src/overlays/l03/mobys/red_ship_1.c | 3 +- src/overlays/l03/mobys/robot_dog.c | 39 +- src/overlays/l04/mobys/big_axebot.c | 136 ++-- src/overlays/l04/mobys/circular_saw_enemy.c | 97 +-- src/overlays/l04/mobys/snow_plow.c | 20 +- src/overlays/l04/mobys/woodcut_bot.c | 49 +- .../hero/apply_hero_ground_material_effects.c | 3 +- src/overlays/l05/hero/hero_set_state.c | 6 +- src/overlays/l05/mobys/drain_cover.c | 18 +- src/overlays/l05/mobys/elevator_with_button.c | 4 +- src/overlays/l05/mobys/extermibot.c | 52 +- src/overlays/l05/mobys/extermitank.c | 12 +- src/overlays/l05/mobys/scenery_ship.c | 67 +- src/overlays/l06/hero/hero_set_state.c | 6 +- src/overlays/l06/mobys/alien_queen.c | 12 +- src/overlays/l06/mobys/alien_snapper.c | 72 +-- src/overlays/l06/mobys/beam_barrier.c | 22 +- src/overlays/l06/mobys/elevator.c | 50 +- src/overlays/l06/mobys/fred.c | 4 +- src/overlays/l06/mobys/toxic_gas_vent.c | 6 +- src/overlays/l07/mobys/bombomatic.c | 3 +- src/overlays/l07/mobys/snagglebeast.c | 28 +- src/overlays/l07/mobys/snagglebeast_effects.c | 3 +- src/overlays/l07/mobys/water.c | 6 +- src/overlays/l08/hero/hero_set_state.c | 3 +- src/overlays/l08/mobys/bolt_pickup.c | 9 +- src/overlays/l09/mobys/barrier.c | 3 +- src/overlays/l09/mobys/platform.c | 13 +- src/overlays/l09/mobys/refueling_station.c | 3 +- src/overlays/l09/mobys/turret.c | 12 +- src/overlays/l10/mobys/blarg_ship.c | 85 ++- src/overlays/l10/mobys/bombthrower_grass.c | 6 +- .../l10/mobys/configurable_particle_emitter.c | 27 +- src/overlays/l10/mobys/darter.c | 11 +- src/overlays/l10/mobys/help_hints.c | 34 +- src/overlays/l10/mobys/linked_moby_hitbox.c | 3 +- src/overlays/l10/mobys/screamer.c | 34 +- src/overlays/l10/mobys/toxic_crab.c | 127 ++-- src/overlays/l11/hero/hero_set_state.c | 6 +- .../l11/mobys/child_sets_controller.c | 34 +- src/overlays/l11/mobys/jet_fighter.c | 36 +- .../l11/mobys/link_triggered_moby_motion.c | 3 +- src/overlays/l11/mobys/psytcopus.c | 23 +- src/overlays/l11/mobys/puffoid.c | 39 +- src/overlays/l11/mobys/resort_owner.c | 14 +- src/overlays/l11/mobys/teleporter.c | 3 +- src/overlays/l12/hero/hero_set_state.c | 6 +- src/overlays/l12/mobys/blarg_helicopter.c | 3 +- src/overlays/l12/mobys/hoven_anklebiter.c | 24 +- src/overlays/l12/mobys/hoven_turret.c | 15 +- .../l12/mobys/planetbuster_maximus_part.c | 51 +- src/overlays/l12/mobys/platform.c | 36 +- src/overlays/l12/mobys/water_reservoir.c | 9 +- src/overlays/l13/mobys/attached_rocket.c | 3 +- src/overlays/l13/mobys/blarg_space_commando.c | 20 +- src/overlays/l13/mobys/blarg_space_fighter.c | 40 +- src/overlays/l13/mobys/fighter_jet.c | 49 +- src/overlays/l13/mobys/gemlik_projectile.c | 4 +- src/overlays/l13/mobys/homing_rocket.c | 6 +- src/overlays/l13/mobys/moby_volume_trigger.c | 36 +- src/overlays/l13/mobys/qwarks_starfighter.c | 178 ++++-- src/overlays/l13/mobys/robosquawker.c | 209 ++++--- src/overlays/l14/hero/hero_set_state.c | 3 +- .../l14/mobys/blarg_heavy_interceptor.c | 53 +- src/overlays/l14/mobys/elevator.c | 24 +- src/overlays/l14/mobys/enemy_fighter.c | 28 +- src/overlays/l14/mobys/flying_car.c | 9 +- src/overlays/l14/mobys/flying_debris.c | 3 +- src/overlays/l14/mobys/minibomber.c | 3 +- .../l14/mobys/racer_path_and_weapon.c | 32 +- src/overlays/l14/mobys/rocket.c | 9 +- .../l14/mobys/rocket_strike_fighter.c | 38 +- src/overlays/l14/mobys/wind_control.c | 6 +- src/overlays/l14/path_camera.c | 33 +- src/overlays/l14/path_key_camera.c | 9 +- src/overlays/l15/hero/hero_set_state.c | 3 +- src/overlays/l15/mobys/poison_vessel.c | 3 +- .../l15/mobys/quartu_cutscene_trigger.c | 9 +- src/overlays/l15/mobys/ultramech_scientist.c | 60 +- src/overlays/l15/mobys/ultramech_unlimited.c | 34 +- src/overlays/l16/hero/hero_set_state.c | 6 +- src/overlays/l16/mobys/elevator.c | 4 +- src/overlays/l16/mobys/grindrail_gate.c | 3 +- .../l16/mobys/local_bounds_command_trigger.c | 3 +- src/overlays/l16/mobys/path_walker.c | 8 +- src/overlays/l16/mobys/test_dummy.c | 3 +- .../l16/mobys/test_dummy_on_hoverboard.c | 15 +- src/overlays/l17/mobys/camera_box_watcher.c | 3 +- src/overlays/l17/mobys/dreks_fleet_turret.c | 8 +- src/overlays/l17/mobys/fighter_jet.c | 12 +- src/overlays/l17/mobys/robot_dog.c | 6 +- src/overlays/l17/mobys/shuttle.c | 4 +- src/overlays/l18/hero/hero_set_state.c | 3 +- src/overlays/l18/mobys/child_carrier.c | 3 +- .../l18/mobys/drek_boss_ring_projectile.c | 3 +- .../l18/mobys/drek_final_boss_robot.c | 206 ++++--- src/overlays/l18/mobys/falling_moby_group.c | 9 +- src/overlays/l18/mobys/gadgebot.c | 11 +- src/overlays/l18/mobys/rocket_tank.c | 14 +- .../l18/mobys/thruster_pack_lock_green.c | 27 +- .../shared/audio/emitters/distance_emitter.c | 6 +- .../shared/camera/clip_volume_camera.c | 9 +- .../camera/follow_camera_set_distance.c | 12 +- .../shared/camera/follow_camera_setup.c | 60 +- .../shared/camera/follow_camera_springs.c | 36 +- .../shared/camera/follow_camera_update.c | 3 +- .../shared/camera/path_flythrough_camera.c | 20 +- .../cutscenes/update_cutscene_playback.c | 20 +- .../shared/cutscenes/update_npc_dialogue.c | 5 +- src/overlays/shared/enemies/armed_transport.c | 17 +- .../shared/enemies/blarg_elite_commando.c | 52 +- .../shared/enemies/blarg_paratrooper.c | 82 ++- src/overlays/shared/enemies/bomb_spawner.c | 26 +- src/overlays/shared/enemies/frog.c | 12 +- src/overlays/shared/enemies/gadgebot.c | 37 +- .../shared/enemies/ground_melee_enemy.c | 3 +- src/overlays/shared/enemies/horny_toad.c | 6 +- src/overlays/shared/enemies/large_amoeboid.c | 3 +- src/overlays/shared/enemies/plasmabot.c | 70 ++- src/overlays/shared/enemies/scoutbot.c | 26 +- src/overlays/shared/enemies/seeker.c | 4 +- src/overlays/shared/enemies/sentrybot.c | 79 ++- src/overlays/shared/enemies/spawner.c | 3 +- .../shared/enemies/walker_update_gait.c | 582 +++++++++++------- .../initialize_level_transition_with_audio.c | 9 +- .../shared/game/run_level_main_loop.c | 3 +- src/overlays/shared/hero/hero_idle_sequence.c | 69 ++- src/overlays/shared/hero/hero_set_state.c | 96 ++- .../hero/process_hero_primary_item_input.c | 15 +- src/overlays/shared/hero/set_hero_animation.c | 116 ++-- .../update_hero_and_vehicle_mode_effects.c | 3 +- ...ate_hero_vehicle_attachments_and_effects.c | 15 +- src/overlays/shared/mobys/find_moby_hit.c | 3 +- src/overlays/shared/pickups/bolt.c | 8 +- src/overlays/shared/pickups/crate.c | 15 +- src/overlays/shared/pickups/infobot.c | 24 +- src/overlays/shared/pickups/nanotech_ball.c | 3 +- .../props/particle_spawner_smoke_fire.c | 3 +- src/overlays/shared/props/pterodactyl.c | 9 +- .../shared/props/thruster_pack_lock.c | 3 +- .../rendering/build_interpolated_dma_packet.c | 21 +- .../shared/rendering/effects/particles.c | 42 +- .../update_three_phase_effect_particle.c | 36 +- .../ui/hud/draw_hud_item_selector_panel.c | 10 +- src/overlays/shared/ui/hud/hud_keep_visible.c | 3 +- .../shared/ui/menus/initialize_pause_menu.c | 6 +- .../shared/vehicles/background_ship_1.c | 19 +- .../shared/vehicles/background_ship_2.c | 19 +- .../vehicles/giant_clank_charged_blast.c | 9 +- .../shared/vehicles/giant_clank_missile.c | 6 +- src/overlays/shared/vendor/vendor.c | 9 +- src/overlays/shared/vendor/vendor_menu.c | 3 +- src/overlays/shared/weapons/bomb_glove_bomb.c | 20 +- .../shared/weapons/doom_bot_movement.c | 3 +- src/overlays/shared/weapons/drone.c | 6 +- src/overlays/shared/weapons/glove_of_doom.c | 6 +- src/overlays/shared/weapons/mine.c | 3 +- src/overlays/shared/weapons/suckcannon.c | 12 +- src/overlays/shared/weapons/taunter.c | 3 +- .../shared/weapons/thruster_pack_flame.c | 8 +- src/overlays/shared/weapons/visibomb.c | 6 +- .../shared/weapons/visibomb_missile.c | 21 +- src/overlays/shared/weapons/walloper.c | 4 +- .../shared/world/load_level_gameplay.c | 13 +- src/ui/menus/pause/build_pause_item_list.c | 3 +- .../render_vendor_item_icon_strip_pass.c | 6 +- 190 files changed, 3202 insertions(+), 1814 deletions(-) diff --git a/src/camera/apply_camera_shake.c b/src/camera/apply_camera_shake.c index 93971aadbf..766de120ee 100644 --- a/src/camera/apply_camera_shake.c +++ b/src/camera/apply_camera_shake.c @@ -44,7 +44,8 @@ void apply_camera_shake(struct CameraShake *shake, s32 axis_index) { remaining_frame_ratio = remaining_frames_float / total_frames_float; oscillation_cosine = fast_cos(fast_normalize_angle(2.0f * convert_integer_to_float(shake->unk8))); - applied_shake_offset = shake->unk0 * oscillation_cosine * remaining_frame_ratio * remaining_frame_ratio; + applied_shake_offset = + shake->unk0 * oscillation_cosine * remaining_frame_ratio * remaining_frame_ratio; shake->unk4 = applied_shake_offset; if (axis_index == 0) { fast_vec_normalize(shake_offset, D_001872B0, applied_shake_offset); diff --git a/src/camera/camera_activation_check_priority.c b/src/camera/camera_activation_check_priority.c index 6cfe86eaa1..ff087d0fee 100644 --- a/src/camera/camera_activation_check_priority.c +++ b/src/camera/camera_activation_check_priority.c @@ -102,7 +102,8 @@ int camera_activation_check_priority(struct UpdateCam *candidate, struct UpdateC } { CamRec20 *candidate_descriptor_entry = &D_0015EF90[candidate->descriptor_index]; - int secondary_descriptor_index = *(int *)((char *)candidate_descriptor_entry->unk1C + 0x24); + int secondary_descriptor_index = + *(int *)((char *)candidate_descriptor_entry->unk1C + 0x24); if (secondary_descriptor_index < 0 || (hero_state->rail_spline == D_0015EF40[secondary_descriptor_index].unk10 && diff --git a/src/mobys/init_moby_instance.c b/src/mobys/init_moby_instance.c index 53ceabfb99..49c3b98ded 100644 --- a/src/mobys/init_moby_instance.c +++ b/src/mobys/init_moby_instance.c @@ -66,8 +66,8 @@ typedef struct { unsigned char unkA4; /* 0xA4 */ char padA5; short original_class_id; /* 0xA6 */ - int unkA8; /* 0xA8 */ - int unkAC; /* 0xAC */ + int unkA8; /* 0xA8 */ + int unkAC; /* 0xAC */ char padB0[0xD]; unsigned char unkBD; /* 0xBD */ char padBE[0x42]; diff --git a/src/overlays/l00/mobys/veldin_robot_enemy.c b/src/overlays/l00/mobys/veldin_robot_enemy.c index 837fb2821d..76a1185cc5 100644 --- a/src/overlays/l00/mobys/veldin_robot_enemy.c +++ b/src/overlays/l00/mobys/veldin_robot_enemy.c @@ -283,7 +283,8 @@ void veldin_robot_enemy_update(ElectroidMoby *moby) { } else if (moby->unk70 & 2) { ELECTROID_ANIM(moby, random_integer_below(2) + 1, scale_game_frames_s32(20)); } - if (vars->target_selection_status != VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE && register_beam_slot(moby, 0, 0) != 0) { + if (vars->target_selection_status != VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE && + register_beam_slot(moby, 0, 0) != 0) { moby->state = VELDIN_ROBOT_STATE_WAIT_TO_START_COLLISION_PROBES; ELECTROID_ANIM(moby, 5, scale_game_frames_s32(10)); } @@ -330,7 +331,8 @@ void veldin_robot_enemy_update(ElectroidMoby *moby) { query.unk8A = moby->unkA6; query.dir[2] = 1.0f; query.unk88 = 0; - if (moby->blend_source_animation == moby->anim && compute_interpolated_record_value(moby) > 1.0f) { + if (moby->blend_source_animation == moby->anim && + compute_interpolated_record_value(moby) > 1.0f) { hit = 1; query.flags |= 1; } diff --git a/src/overlays/l01/hero/hero_set_state.c b/src/overlays/l01/hero/hero_set_state.c index 927fcac2c8..489cab4341 100644 --- a/src/overlays/l01/hero/hero_set_state.c +++ b/src/overlays/l01/hero/hero_set_state.c @@ -82,7 +82,8 @@ int l01_hero_set_state(int requested_state, int animation_setup_mode) { animation_setup_mode != HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS)) return 0; } - if ((cutscene_mode == 2 || cutscene_mode == 6) && animation_setup_mode != HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS) + if ((cutscene_mode == 2 || cutscene_mode == 6) && + animation_setup_mode != HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l01/mobys/agnogg_ship_front.c b/src/overlays/l01/mobys/agnogg_ship_front.c index 2c87fb5f1e..ca0b464141 100644 --- a/src/overlays/l01/mobys/agnogg_ship_front.c +++ b/src/overlays/l01/mobys/agnogg_ship_front.c @@ -191,8 +191,8 @@ void agnogg_ship_front_update(Moby_2FC140 *moby) { moby->pos.z = moby->pos.z + fd; break; case AGNOGG_SHIP_WAIT_FOR_DESCENT_TRIGGER: - level_table_byte = - *(unsigned char *)(moby->persistent_slot_index + (current_level_index_macro << 4) + visited52); + level_table_byte = *(unsigned char *)(moby->persistent_slot_index + + (current_level_index_macro << 4) + visited52); if (level_table_byte == 0xFF) { if (moby->requested_animation_sequence != 2) { blend_moby_animation(moby, 2, 0, scale_game_frames(0x14)); @@ -330,9 +330,10 @@ void agnogg_ship_front_update(Moby_2FC140 *moby) { ents_macro[data->link].persistent_slot_index + 2; if (ents_macro[data->link].persistent_slot_index == 0xFF || (D_L01_0015FC88[ents_macro[data->link].persistent_slot_index] != 0xFF && - visited52[ents_macro[data->link].persistent_slot_index + (current_level_index_macro << 4)] == - 0xFF)) { - l01_save_state.cleared[ents_macro[data->link].collected_state_index] = ents_macro[data->link].persistent_slot_index + 2; + visited52[ents_macro[data->link].persistent_slot_index + + (current_level_index_macro << 4)] == 0xFF)) { + l01_save_state.cleared[ents_macro[data->link].collected_state_index] = + ents_macro[data->link].persistent_slot_index + 2; } } if (data->f3C != -1) { diff --git a/src/overlays/l01/mobys/birdbot.c b/src/overlays/l01/mobys/birdbot.c index eafd43661b..c15b71c270 100644 --- a/src/overlays/l01/mobys/birdbot.c +++ b/src/overlays/l01/mobys/birdbot.c @@ -549,7 +549,8 @@ void birdbot_update(PeMoby *birdbot_moby) { if (birdbot_moby->state != BIRDBOT_STATE_INITIALIZE) { path_reposition_requested = select_birdbot_path_node(birdbot_moby, &idx); } - target_search_radius = flag ? birdbot_vars->combat_target_radius * 2.0f : birdbot_vars->combat_target_radius; + target_search_radius = + flag ? birdbot_vars->combat_target_radius * 2.0f : birdbot_vars->combat_target_radius; select_moby_combat_target(birdbot_moby, &selected_combat_target, target_search_radius); hit = find_moby_hit(birdbot_moby, 0x210000, 0); kind = FUN_L00_0025a478_u(birdbot_moby, hit, &birdbot_vars->f20, 0, &hits, &dmg, 0, 4); @@ -589,14 +590,18 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->knockback_collision_height_offset = 0.3f; birdbot_vars->f84 = frame_time_sq * 10.0f; birdbot_vars->knockback_gravity_step = frame_time_sq * 40.0f; - birdbot_vars->knockback_horizontal_launch_step = square_root(birdbot_vars->f84 * 2.0f * 10.0f); + birdbot_vars->knockback_horizontal_launch_step = + square_root(birdbot_vars->f84 * 2.0f * 10.0f); birdbot_vars->knockback_vertical_launch_step = frame_time * 15.0f; birdbot_vars->knockback_animation_target_frame = 5.0f; birdbot_vars->knockback_animation_stop_frame = 10.0f; birdbot_vars->w94 = 1; birdbot_vars->bAD = 0; *(u128 *)&va = *(u128 *)&hit->pos; - trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->knockback_horizontal_launch_step, &birdbot_vars->knockback_vertical_launch_step); + trooper_knockback_arc(&va, + &knockback_heading, + &birdbot_vars->knockback_horizontal_launch_step, + &birdbot_vars->knockback_vertical_launch_step); FUN_L00_0025c558_u( knockback_heading, birdbot_moby, birdbot_vars->x70, 9, scale_game_frames(2), 0); birdbot_vars->b67 = 0xB4; @@ -611,14 +616,18 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->b67 = 0x78; birdbot_vars->knockback_collision_height_offset = 0.5f; birdbot_vars->knockback_gravity_step = 0.008f; - birdbot_vars->knockback_horizontal_launch_step = square_root(birdbot_vars->f84 * 2.0f * 1.5f); + birdbot_vars->knockback_horizontal_launch_step = + square_root(birdbot_vars->f84 * 2.0f * 1.5f); birdbot_vars->w94 = 1; birdbot_vars->knockback_animation_target_frame = 5.0f; birdbot_vars->knockback_vertical_launch_step = frame_time * 8.5f; birdbot_vars->knockback_animation_stop_frame = 10.0f; birdbot_vars->bAD = 0; *(u128 *)&va = *(u128 *)&hit->pos; - trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->knockback_horizontal_launch_step, &birdbot_vars->knockback_vertical_launch_step); + trooper_knockback_arc(&va, + &knockback_heading, + &birdbot_vars->knockback_horizontal_launch_step, + &birdbot_vars->knockback_vertical_launch_step); FUN_L00_0025c558_u(knockback_heading, birdbot_moby, birdbot_vars->x70, 0xC, 6, 0); if (birdbot_moby->target_animation_sequence != 0xB) { blend_moby_animation(birdbot_moby, 0xB, 0, scale_game_frames(6)); @@ -631,14 +640,18 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_vars->w90 = 0x200; birdbot_vars->b67 = 0xFA; birdbot_vars->knockback_gravity_step = 0.008f; - birdbot_vars->knockback_horizontal_launch_step = square_root(birdbot_vars->f84 * 2.0f * 1.5f); + birdbot_vars->knockback_horizontal_launch_step = + square_root(birdbot_vars->f84 * 2.0f * 1.5f); birdbot_vars->w94 = 1; birdbot_vars->knockback_vertical_launch_step = frame_time * 5.0f; birdbot_vars->knockback_animation_target_frame = 7.0f; birdbot_vars->knockback_animation_stop_frame = 13.5f; birdbot_vars->bAD = 0; *(u128 *)&va = *(u128 *)&hit->pos; - trooper_knockback_arc(&va, &knockback_heading, &birdbot_vars->knockback_horizontal_launch_step, &birdbot_vars->knockback_vertical_launch_step); + trooper_knockback_arc(&va, + &knockback_heading, + &birdbot_vars->knockback_horizontal_launch_step, + &birdbot_vars->knockback_vertical_launch_step); FUN_L00_0025c558_u(knockback_heading, birdbot_moby, birdbot_vars->x70, 0xE, 6, 0); birdbot_moby->state = BIRDBOT_STATE_NONFATAL_KNOCKBACK; trooper_anim_update(birdbot_moby, (short *)birdbot_vars->x60); @@ -660,7 +673,9 @@ void birdbot_update(PeMoby *birdbot_moby) { c = &birdbot_vars->main; if (birdbot_vars->main.path_id == -1) { - DebugPrint(birdbot_missing_path_format, birdbot_moby->moby_class_id, birdbot_moby->maya_instance_id); + DebugPrint(birdbot_missing_path_format, + birdbot_moby->moby_class_id, + birdbot_moby->maya_instance_id); mark_moby_for_removal(birdbot_moby); return; } @@ -723,10 +738,12 @@ void birdbot_update(PeMoby *birdbot_moby) { c = &birdbot_vars->main; a = fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1]); - FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278_cf( + (char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); fast_dec_timer(&birdbot_vars->firing_retry_timer); d = vector_distance_xy(&birdbot_moby->pos, &selected_combat_target); - if ((flag ? d < birdbot_vars->combat_target_radius * 2.0f : d < birdbot_vars->combat_target_radius) && + if ((flag ? d < birdbot_vars->combat_target_radius * 2.0f + : d < birdbot_vars->combat_target_radius) && absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) < 2.0f && birdbot_moby->b31 != 0 && (!flag || path_reposition_requested == 0) && birdbot_vars->firing_retry_timer == 0 && @@ -770,7 +787,8 @@ void birdbot_update(PeMoby *birdbot_moby) { } } } - if (birdbot_vars->mount_release_timer == 0 && birdbot_vars->deployment_mount_cuboid_index != -1) { + if (birdbot_vars->mount_release_timer == 0 && + birdbot_vars->deployment_mount_cuboid_index != -1) { jet_end_mount(0); l01_hero_set_state(HERO_STATE_IDLE, 1); cutscene_active = 0; @@ -779,8 +797,10 @@ void birdbot_update(PeMoby *birdbot_moby) { break; } case BIRDBOT_STATE_WAIT_FOR_TRIGGER: - if (vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) < birdbot_vars->deployment_trigger_radius || - is_point_inside_clip_volume(&hero.motion.pos, birdbot_vars->deployment_trigger_volume_index) != 0 || + if (vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) < + birdbot_vars->deployment_trigger_radius || + is_point_inside_clip_volume(&hero.motion.pos, + birdbot_vars->deployment_trigger_volume_index) != 0 || birdbot_vars->deployment_trigger_override != 0) { if (birdbot_vars->deployment_mount_cuboid_index != -1) { LevelCuboid *p; @@ -814,7 +834,8 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_moby->pos.f[0], side_path_cursor->path->points[side_path_next_node_index].f[1] - birdbot_moby->pos.f[1]); - FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.01f, 0.3f, 0.1f); + FUN_L00_00258278_cf( + (char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.01f, 0.3f, 0.1f); path = side_path_cursor->path; qcopy(&vb, &path->points[side_path_next_node_index]); if (side_path_cursor->idx == path->count - 1) { @@ -836,28 +857,43 @@ void birdbot_update(PeMoby *birdbot_moby) { float deployment_step_length; float z; - p = (LevelCuboid *)((birdbot_vars->deployment_destination_cuboid_index << 7) + (int)l01_cuboids); + p = (LevelCuboid *)((birdbot_vars->deployment_destination_cuboid_index << 7) + + (int)l01_cuboids); a = fast_arc_tan(p->pos.x - birdbot_moby->pos.f[0], p->pos.y - birdbot_moby->pos.f[1]); - FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.01f, 0.3f, 0.1f); + FUN_L00_00258278_cf( + (char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.01f, 0.3f, 0.1f); deployment_step_length = fast_vec_length(&birdbot_vars->deployment_motion_delta); z = birdbot_vars->deployment_motion_delta.f[2]; - fast_vec_normalize( - &birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, deployment_step_length * 0.95f); - fast_vec_sub(&vb, &l01_cuboids[birdbot_vars->deployment_destination_cuboid_index].pos, &birdbot_moby->pos); + fast_vec_normalize(&birdbot_vars->deployment_motion_delta, + &birdbot_vars->deployment_motion_delta, + deployment_step_length * 0.95f); + fast_vec_sub(&vb, + &l01_cuboids[birdbot_vars->deployment_destination_cuboid_index].pos, + &birdbot_moby->pos); fast_vec_normalize(&vb, &vb, deployment_step_length * 0.05f); - fast_vec_add(&birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, &vb); + fast_vec_add(&birdbot_vars->deployment_motion_delta, + &birdbot_vars->deployment_motion_delta, + &vb); if (frame_time * 10.0f < deployment_step_length) { - fast_vec_normalize(&vb, &birdbot_vars->deployment_motion_delta, -(frame_time_sq * 10.0f)); - fast_vec_add(&birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, &vb); + fast_vec_normalize( + &vb, &birdbot_vars->deployment_motion_delta, -(frame_time_sq * 10.0f)); + fast_vec_add(&birdbot_vars->deployment_motion_delta, + &birdbot_vars->deployment_motion_delta, + &vb); } else if (deployment_step_length < frame_time * 5.0f) { - fast_vec_normalize(&vb, &birdbot_vars->deployment_motion_delta, frame_time_sq * 5.0f); - fast_vec_add(&birdbot_vars->deployment_motion_delta, &birdbot_vars->deployment_motion_delta, &vb); + fast_vec_normalize( + &vb, &birdbot_vars->deployment_motion_delta, frame_time_sq * 5.0f); + fast_vec_add(&birdbot_vars->deployment_motion_delta, + &birdbot_vars->deployment_motion_delta, + &vb); } if (fast_dec_timer_s16(&birdbot_vars->deployment_vertical_steering_timer) == 0) { birdbot_vars->deployment_motion_delta.f[2] = z; } - fast_vec_add(&birdbot_moby->pos, &birdbot_moby->pos, &birdbot_vars->deployment_motion_delta); - if (fast_vec_dist(&birdbot_moby->pos, &l01_cuboids[birdbot_vars->deployment_destination_cuboid_index].pos) < + fast_vec_add( + &birdbot_moby->pos, &birdbot_moby->pos, &birdbot_vars->deployment_motion_delta); + if (fast_vec_dist(&birdbot_moby->pos, + &l01_cuboids[birdbot_vars->deployment_destination_cuboid_index].pos) < frame_time * 10.0f) { if (birdbot_moby->target_animation_sequence != 0) { blend_moby_animation(birdbot_moby, 0, 0, scale_game_frames(5)); @@ -897,8 +933,10 @@ void birdbot_update(PeMoby *birdbot_moby) { a = fast_arc_tan(selected_combat_target.pos.f[0] - va.f[0], selected_combat_target.pos.f[1] - va.f[1]); } - birdbot_vars->projectile_aim_point.f[0] += fast_cos(a) * birdbot_vars->projectile_aim_distance; - birdbot_vars->projectile_aim_point.f[1] += fast_sin(a) * birdbot_vars->projectile_aim_distance; + birdbot_vars->projectile_aim_point.f[0] += + fast_cos(a) * birdbot_vars->projectile_aim_distance; + birdbot_vars->projectile_aim_point.f[1] += + fast_sin(a) * birdbot_vars->projectile_aim_distance; fast_vec_sub(&vb, &birdbot_vars->projectile_aim_point, &va); fast_vec_normalize(&vb, &vb, *(float *)&birdbot_projectile_speed_gp * frame_time); vb.f[2] += 0.0f; @@ -925,7 +963,8 @@ void birdbot_update(PeMoby *birdbot_moby) { if (frame < 2.0f) { if (birdbot_vars->burst_shots_fired >= 4 || vector_distance_xy(&birdbot_moby->pos, &selected_combat_target) > - (flag ? birdbot_vars->combat_target_radius * 2.0f : birdbot_vars->combat_target_radius) || + (flag ? birdbot_vars->combat_target_radius * 2.0f + : birdbot_vars->combat_target_radius) || absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) > 6.0f) { if (birdbot_moby->target_animation_sequence != 5) { blend_moby_animation(birdbot_moby, 5, 5, scale_game_frames(10)); @@ -940,7 +979,8 @@ void birdbot_update(PeMoby *birdbot_moby) { a = fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1]); - FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278_cf( + (char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); if (birdbot_moby->target_animation_sequence == 0) { if (fast_dec_timer(&birdbot_vars->firing_retry_timer) != 0) { if (birdbot_moby->target_animation_sequence != 5) { @@ -959,13 +999,15 @@ void birdbot_update(PeMoby *birdbot_moby) { if (birdbot_moby->target_animation_sequence != 8) { blend_moby_animation(birdbot_moby, 8, 0, scale_game_frames(10)); } - birdbot_moby->animation_playback_speed = *(float *)&birdbot_path_entry_animation_speed_gp; + birdbot_moby->animation_playback_speed = + *(float *)&birdbot_path_entry_animation_speed_gp; birdbot_moby->state = BIRDBOT_STATE_BEGIN_PATH_MOVEMENT; } else { float d; d = vector_distance_xy(&birdbot_moby->pos, &selected_combat_target); - if ((flag ? d < birdbot_vars->combat_target_radius * 2.0f : d < birdbot_vars->combat_target_radius) && + if ((flag ? d < birdbot_vars->combat_target_radius * 2.0f + : d < birdbot_vars->combat_target_radius) && absolute_float(birdbot_moby->pos.f[2] - selected_combat_target.pos.f[2]) < 2.0f && birdbot_moby->b31 != 0 && (!flag || path_reposition_requested == 0) && @@ -1027,7 +1069,9 @@ void birdbot_update(PeMoby *birdbot_moby) { best = i; } } - birdbot_vars->steering_path_node_index = c->idx < best ? best - 1 : best < c->idx ? best + 1 : c->idx; + birdbot_vars->steering_path_node_index = c->idx < best ? best - 1 + : best < c->idx ? best + 1 + : c->idx; } else { birdbot_vars->steering_path_node_index = c->idx; } @@ -1045,9 +1089,11 @@ void birdbot_update(PeMoby *birdbot_moby) { birdbot_moby->rot.f[2], fast_arc_tan(va.f[0] - birdbot_moby->pos.f[0], va.f[1] - birdbot_moby->pos.f[1])) < 0.7853982f) { - if (birdbot_vars->path_movement_step_length < *(float *)&birdbot_path_speed_scale_gp * frame_time) { + if (birdbot_vars->path_movement_step_length < + *(float *)&birdbot_path_speed_scale_gp * frame_time) { birdbot_vars->path_movement_step_length = - birdbot_vars->path_movement_step_length + *(float *)&birdbot_path_speed_scale_gp * frame_time_sq; + birdbot_vars->path_movement_step_length + + *(float *)&birdbot_path_speed_scale_gp * frame_time_sq; } build_spherical_offset(&vb, birdbot_vars->path_movement_step_length, @@ -1074,8 +1120,10 @@ void birdbot_update(PeMoby *birdbot_moby) { break; } case BIRDBOT_STATE_BRAKE_AND_FACE_TARGET: - if (birdbot_vars->path_movement_step_length > 0.0f && birdbot_vars->skip_path_braking == 0) { - birdbot_vars->path_movement_step_length -= *(float *)&birdbot_path_speed_scale_gp * 3.0f * frame_time_sq; + if (birdbot_vars->path_movement_step_length > 0.0f && + birdbot_vars->skip_path_braking == 0) { + birdbot_vars->path_movement_step_length -= + *(float *)&birdbot_path_speed_scale_gp * 3.0f * frame_time_sq; va.f[0] = fast_cos(birdbot_moby->rot.f[2]) * birdbot_vars->path_movement_step_length; va.f[1] = fast_sin(birdbot_moby->rot.f[2]) * birdbot_vars->path_movement_step_length; va.f[2] = 0.0f; @@ -1094,17 +1142,20 @@ void birdbot_update(PeMoby *birdbot_moby) { a = fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], selected_combat_target.pos.f[1] - birdbot_moby->pos.f[1]); - FUN_L00_00258278_cf((char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278_cf( + (char *)birdbot_moby, &birdbot_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); k = *(float *)&birdbot_path_speed_scale_gp * frame_time; birdbot_vars->path_movement_step_length = 0.0f; - birdbot_moby->rot.f[1] = spring_turn(&birdbot_vars->pitch_turn_step, - birdbot_moby->rot.f[1], - birdbot_vars->path_movement_step_length / k * 0.5235988f, - frame_time_sq * 6.2831855f, - frame_time_sq * 3.1415927f, - frame_time * 6.2831855f); + birdbot_moby->rot.f[1] = + spring_turn(&birdbot_vars->pitch_turn_step, + birdbot_moby->rot.f[1], + birdbot_vars->path_movement_step_length / k * 0.5235988f, + frame_time_sq * 6.2831855f, + frame_time_sq * 3.1415927f, + frame_time * 6.2831855f); } - if (birdbot_moby->target_animation_sequence != 0xA && birdbot_vars->path_movement_step_length <= 0.0f && + if (birdbot_moby->target_animation_sequence != 0xA && + birdbot_vars->path_movement_step_length <= 0.0f && fast_difference_between_rotations( birdbot_moby->rot.f[2], fast_arc_tan(selected_combat_target.pos.f[0] - birdbot_moby->pos.f[0], diff --git a/src/overlays/l01/mobys/bomber_jet.c b/src/overlays/l01/mobys/bomber_jet.c index 4cd14642ff..c04652263f 100644 --- a/src/overlays/l01/mobys/bomber_jet.c +++ b/src/overlays/l01/mobys/bomber_jet.c @@ -525,9 +525,10 @@ void bomber_jet_update(GunshipMoby *bomber_jet_moby) { GunshipGuardVars *guard_vars = o->vars; if (guard_vars->f4 == 0 && guard_vars->f0 == 0 && random_integer_below(0x64) < 0x64 && - is_point_inside_clip_volume(&hero.motion.pos, - guard_vars->clip_volume_index) && - is_point_inside_clip_volume(camera_pos, guard_vars->clip_volume_index)) { + is_point_inside_clip_volume( + &hero.motion.pos, guard_vars->clip_volume_index) && + is_point_inside_clip_volume( + camera_pos, guard_vars->clip_volume_index)) { beam_guard_moby_indices[k] = gunship_vars->guards[i]; k++; } diff --git a/src/overlays/l01/mobys/water_lily.c b/src/overlays/l01/mobys/water_lily.c index e209e210f8..8269ec709d 100644 --- a/src/overlays/l01/mobys/water_lily.c +++ b/src/overlays/l01/mobys/water_lily.c @@ -19,20 +19,20 @@ void move_moby_xy_with_collision_constraints( extern f32 frame_time_macro __asm__("D_0015ED6C") MACRO_ADDR; f32 advance_spring_axis_toward_target(f32 *spring_axis_position, - f32 *spring_axis_velocity, - f32 target, - f32 velocity_adjustment_scale, - f32 damp, + f32 *spring_axis_velocity, + f32 target, + f32 velocity_adjustment_scale, + f32 damp, - f32 range) __asm__("FUN_L01_002f81c8"); + f32 range) __asm__("FUN_L01_002f81c8"); f32 advance_spring_axis_toward_target(f32 *spring_axis_position, - f32 *spring_axis_velocity, - f32 target, - f32 velocity_adjustment_scale, - f32 damp, + f32 *spring_axis_velocity, + f32 target, + f32 velocity_adjustment_scale, + f32 damp, - f32 range) { + f32 range) { f32 velocity_adjustment; f32 f; diff --git a/src/overlays/l02/hero/hero_set_state.c b/src/overlays/l02/hero/hero_set_state.c index 60c5c4f506..e417fb9402 100644 --- a/src/overlays/l02/hero/hero_set_state.c +++ b/src/overlays/l02/hero/hero_set_state.c @@ -83,7 +83,8 @@ int hero_set_state(int requested_state, int entry_animation_mode) { entry_animation_mode != HERO_ENTRY_ANIMATION_GUARD_OVERRIDE)) return 0; } - if ((level_game_mode == 2 || level_game_mode == 6) && entry_animation_mode != HERO_ENTRY_ANIMATION_GUARD_OVERRIDE) + if ((level_game_mode == 2 || level_game_mode == 6) && + entry_animation_mode != HERO_ENTRY_ANIMATION_GUARD_OVERRIDE) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l02/hud_counter.c b/src/overlays/l02/hud_counter.c index b28ff6d8d6..9f7c961286 100644 --- a/src/overlays/l02/hud_counter.c +++ b/src/overlays/l02/hud_counter.c @@ -134,7 +134,8 @@ s32 draw_hud_counter(HudElem *hud_element) { } else { hud_frame(hud_element, hud_element->icon, x - 0x16, y, 0, 0x80); } - bright = fast_tween_color(l02_hud_counter_text_fade_start_color, l02_hud_counter_text_fade_end_color, shade); + bright = fast_tween_color( + l02_hud_counter_text_fade_start_color, l02_hud_counter_text_fade_end_color, shade); dark = fast_tween_color(0, 0x80000000, shade); if (left) { font_print_right(x + 0x43, y + 9, dark, text, -1); diff --git a/src/overlays/l02/mobys/constructorbot.c b/src/overlays/l02/mobys/constructorbot.c index c7bc4e8e00..ddae7c7b44 100644 --- a/src/overlays/l02/mobys/constructorbot.c +++ b/src/overlays/l02/mobys/constructorbot.c @@ -359,8 +359,9 @@ void constructorbot_update(struct Moby *moby) { direction, D_L02_00161A88, D_L02_00161A88, - random_int_between(scale_game_frames(l02_constructorbot_wake_spray_frame_count_min), - scale_game_frames(l02_constructorbot_wake_spray_frame_count_max)), + random_int_between( + scale_game_frames(l02_constructorbot_wake_spray_frame_count_min), + scale_game_frames(l02_constructorbot_wake_spray_frame_count_max)), 1, 40000.0f); } @@ -567,8 +568,8 @@ typedef struct { unsigned char pad66; unsigned char flash; /* 0x67 */ char pad68[8]; - char knock[0x10]; /* 0x70: passed to trooper_start_knockback */ - float knockback_gravity_step; /* 0x80 */ + char knock[0x10]; /* 0x70: passed to trooper_start_knockback */ + float knockback_gravity_step; /* 0x80 */ float knockback_horizontal_speed_approach_step; float knockback_initial_horizontal_speed; float knockback_initial_vertical_speed; @@ -616,9 +617,12 @@ void handle_constructorbot_damage_and_retargeting(void *owner_moby) { moby_vars->knockback_gravity_step = constructorbot_gravity_gp * frame_time_sq; moby_vars->knockback_horizontal_speed_approach_step = constructorbot_hit_knockback_horizontal_speed_approach_rate_gp * frame_time_sq; - moby_vars->knockback_initial_horizontal_speed = constructorbot_hit_knockback_horizontal_speed_gp * D_0015ED6C; - moby_vars->knockback_initial_vertical_speed = constructorbot_hit_knockback_vertical_speed_gp * D_0015ED6C; - moby_vars->knockback_horizontal_target_speed = constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C; + moby_vars->knockback_initial_horizontal_speed = + constructorbot_hit_knockback_horizontal_speed_gp * D_0015ED6C; + moby_vars->knockback_initial_vertical_speed = + constructorbot_hit_knockback_vertical_speed_gp * D_0015ED6C; + moby_vars->knockback_horizontal_target_speed = + constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C; moby_vars->knockback_collision_restitution = 0.5f; moby_vars->i94 = 25; moby_vars->bAD = 0; @@ -638,9 +642,12 @@ void handle_constructorbot_damage_and_retargeting(void *owner_moby) { moby_vars->knockback_gravity_step = constructorbot_gravity_gp * frame_time_sq; moby_vars->knockback_horizontal_speed_approach_step = constructorbot_death_knockback_horizontal_speed_approach_rate_gp * frame_time_sq; - moby_vars->knockback_initial_horizontal_speed = constructorbot_death_knockback_horizontal_speed_gp * D_0015ED6C; - moby_vars->knockback_initial_vertical_speed = constructorbot_death_knockback_vertical_speed_gp * D_0015ED6C; - moby_vars->knockback_horizontal_target_speed = constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C; + moby_vars->knockback_initial_horizontal_speed = + constructorbot_death_knockback_horizontal_speed_gp * D_0015ED6C; + moby_vars->knockback_initial_vertical_speed = + constructorbot_death_knockback_vertical_speed_gp * D_0015ED6C; + moby_vars->knockback_horizontal_target_speed = + constructorbot_knockback_horizontal_target_speed_gp * D_0015ED6C; moby_vars->i94 = 9; moby_vars->bAD = 0; trooper_start_knockback(fast_arc_tan(MOBY(moby)->pos.x - hero.motion.pos.f[0], diff --git a/src/overlays/l02/mobys/elevator.c b/src/overlays/l02/mobys/elevator.c index 9834a636e1..03870e8907 100644 --- a/src/overlays/l02/mobys/elevator.c +++ b/src/overlays/l02/mobys/elevator.c @@ -296,7 +296,9 @@ void draw_elevator_rotating_rings(struct Moby *moby) { matrix.position[3] = 1.0f; packet.texture = get_effect_texture(14); packet.flags = 0xFF9000000260L; - packet.mode = (long)level02_elevator_ring_blend_color_a_selector | ((long)level02_elevator_ring_blend_color_b_selector << 2) | ((long)level02_elevator_ring_blend_alpha_selector << 4) | + packet.mode = (long)level02_elevator_ring_blend_color_a_selector | + ((long)level02_elevator_ring_blend_color_b_selector << 2) | + ((long)level02_elevator_ring_blend_alpha_selector << 4) | ((long)level02_elevator_ring_blend_color_d_selector << 6) | 0x8000000000L; packet.zero = 0; uv = level02_elevator_ring_segment_uvs; diff --git a/src/overlays/l02/mobys/rocket_launcher.c b/src/overlays/l02/mobys/rocket_launcher.c index ed10203bc4..7f9410c799 100644 --- a/src/overlays/l02/mobys/rocket_launcher.c +++ b/src/overlays/l02/mobys/rocket_launcher.c @@ -165,7 +165,9 @@ void rocket_launcher_update(struct Moby *moby) { glow_blend_fraction = compute_interpolated_record_value(moby) / 10.0f; if (glow_blend_fraction > 1.0f) glow_blend_fraction = 1.0f; - moby->glow_color = turret_lerp_colour(glow_blend_fraction, l02_rocket_launcher_glow_blend_start_color, l02_rocket_launcher_glow_blend_end_color); + moby->glow_color = turret_lerp_colour(glow_blend_fraction, + l02_rocket_launcher_glow_blend_start_color, + l02_rocket_launcher_glow_blend_end_color); if (moby->anim_flags & 2) { if (moby->prev_seq != 0) blend_moby_animation(moby, 0, 0, 1); diff --git a/src/overlays/l02/mobys/rocket_launcher_projectile.c b/src/overlays/l02/mobys/rocket_launcher_projectile.c index 181f30e600..0b81a7996a 100644 --- a/src/overlays/l02/mobys/rocket_launcher_projectile.c +++ b/src/overlays/l02/mobys/rocket_launcher_projectile.c @@ -22,8 +22,8 @@ typedef struct { extern f32 rocket_launcher_projectile_vertical_velocity_approach_scale_gp __asm__("D_L02_00161F58") __attribute__((sda)); -s32 l02_rocket_projectile_particle_color_argb __asm__("D_L02_00161F5C") = 0x30704020; -s32 l02_rocket_projectile_position_particle_alpha_source __asm__("D_L02_00161F60") = 0x50e0e0e0; +s32 l02_rocket_projectile_particle_color_argb __asm__("D_L02_00161F5C") = 0x30704020; +s32 l02_rocket_projectile_position_particle_alpha_source __asm__("D_L02_00161F60") = 0x50e0e0e0; extern LevelFx l02_projectile_trail_particle_tint_source __asm__("D_L02_001B2680"); extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); diff --git a/src/overlays/l02/mobys/sand_shark.c b/src/overlays/l02/mobys/sand_shark.c index 756aa42345..cd4611b0e0 100644 --- a/src/overlays/l02/mobys/sand_shark.c +++ b/src/overlays/l02/mobys/sand_shark.c @@ -425,8 +425,9 @@ void sand_shark_update(struct Moby *moby) { moby->pos.z -= sand_shark_height_offset_gp; if (sand_shark_behavior_vars->target_selection_status != 2) { if (sand_shark_behavior_vars->wander_target_volume_index >= 0) { - if ((!is_point_inside_clip_volume(&sand_shark_behavior_vars->target, - sand_shark_behavior_vars->wander_target_volume_index) || + if ((!is_point_inside_clip_volume( + &sand_shark_behavior_vars->target, + sand_shark_behavior_vars->wander_target_volume_index) || sand_shark_behavior_vars->target_range_extension_timer != 0) && random_integer_below(9) == 0) { sand_shark_behavior_vars->wander_target_volume_index = -1; @@ -435,8 +436,9 @@ void sand_shark_update(struct Moby *moby) { sand_shark_behavior_vars->turn_offset = sand_shark_behavior_vars->turn_range * 0.017453292f; if (sand_shark_behavior_vars->turn_offset_multiplier != 0) { - sand_shark_behavior_vars->turn_offset = sand_shark_behavior_vars->turn_offset * - (float)sand_shark_behavior_vars->turn_offset_multiplier; + sand_shark_behavior_vars->turn_offset = + sand_shark_behavior_vars->turn_offset * + (float)sand_shark_behavior_vars->turn_offset_multiplier; } else if (random_integer_below(0x100) & 1) { sand_shark_behavior_vars->turn_offset = -sand_shark_behavior_vars->turn_offset; } @@ -448,7 +450,8 @@ void sand_shark_update(struct Moby *moby) { blend_moby_animation(moby, 0xC, 0, scale_game_frames(3)); } } - } else if (sand_shark_behavior_vars->target_range_extension_timer != 0 && random_integer_below(0x13) == 0) { + } else if (sand_shark_behavior_vars->target_range_extension_timer != 0 && + random_integer_below(0x13) == 0) { moby->state = SAND_SHARK_ALIGN_TO_GROUND_BEFORE_APPROACH_TARGET_WITH_PATH_PROXIMITY_CHECK; allocate_voice_for_target_entry(4, 0, moby); @@ -637,8 +640,9 @@ void sand_shark_update(struct Moby *moby) { } if (sand_shark_behavior_vars->target_selection_status != 2) { if (sand_shark_behavior_vars->target_activation_volume_index >= 0 && - !is_point_inside_clip_volume(&sand_shark_behavior_vars->target, - sand_shark_behavior_vars->target_activation_volume_index)) { + !is_point_inside_clip_volume( + &sand_shark_behavior_vars->target, + sand_shark_behavior_vars->target_activation_volume_index)) { moby->state = SAND_SHARK_RETURN_HOME; } else { fast_vec_sub(&target_home_delta, @@ -756,13 +760,15 @@ void sand_shark_update(struct Moby *moby) { &sand_shark_behavior_vars->target, &sand_shark_behavior_vars->home); if (sand_shark_behavior_vars->target_activation_volume_index >= 0) { - if (is_point_inside_clip_volume(&sand_shark_behavior_vars->target, - sand_shark_behavior_vars->target_activation_volume_index)) { + if (is_point_inside_clip_volume( + &sand_shark_behavior_vars->target, + sand_shark_behavior_vars->target_activation_volume_index)) { moby->state = SAND_SHARK_APPROACH_TARGET; sand_shark_behavior_vars->walk_step = sand_shark_behavior_vars->unk254 * D_0015ED6C; } - } else if (fast_vec_length(&target_home_delta) < sand_shark_behavior_vars->base_target_selection_range) { + } else if (fast_vec_length(&target_home_delta) < + sand_shark_behavior_vars->base_target_selection_range) { if (moby->state == SAND_SHARK_RETURN_HOME) { moby->state = SAND_SHARK_APPROACH_TARGET; } else { @@ -774,7 +780,8 @@ void sand_shark_update(struct Moby *moby) { blend_moby_animation(moby, 0, 0, scale_game_frames(3)); } } - } else if (sand_shark_behavior_vars->target_range_extension_timer != 0 && random_integer_below(0x13) == 0) { + } else if (sand_shark_behavior_vars->target_range_extension_timer != 0 && + random_integer_below(0x13) == 0) { moby->state = SAND_SHARK_ALIGN_TO_GROUND_BEFORE_APPROACH_TARGET_WITH_PATH_PROXIMITY_CHECK; allocate_voice_for_target_entry(4, 0, moby); @@ -812,16 +819,19 @@ void sand_shark_update(struct Moby *moby) { break; case SAND_SHARK_WAIT_FOR_HERO_LAUNCH_TRIGGER: { int in; - if (is_point_inside_clip_volume(&hero.motion.pos, sand_shark_behavior_vars->primary_hero_launch_trigger_volume_index)) { + if (is_point_inside_clip_volume( + &hero.motion.pos, + sand_shark_behavior_vars->primary_hero_launch_trigger_volume_index)) { in = 1; } else { in = is_point_inside_clip_volume(&hero.motion.pos, sand_shark_behavior_vars->unk270) != 0; } if (in) { - struct Moby *dest = &D_L02_0015FFD8_macro[sand_shark_behavior_vars->launch_origin_moby_index]; - float dz = dest->pos.z - sand_shark_behavior_vars->home.f[2]; - float up = random_float_between(6.0f, 10.0f) * D_0015ED6C; + struct Moby *dest = + &D_L02_0015FFD8_macro[sand_shark_behavior_vars->launch_origin_moby_index]; + float dz = dest->pos.z - sand_shark_behavior_vars->home.f[2]; + float up = random_float_between(6.0f, 10.0f) * D_0015ED6C; float flight_duration = (square_root(2.0f * (frame_time_sq * 10.8f) * dz) + 2.0f * up) / (frame_time_sq * 10.8f); float speed = @@ -883,7 +893,8 @@ void sand_shark_update(struct Moby *moby) { } case SAND_SHARK_DEATH_KNOCKBACK: { int knockback_status_flags = step_moby_motion(moby, sand_shark_behavior_vars->unk120); - if ((knockback_status_flags & 1) && sand_shark_behavior_vars->death_landing_particles_emitted == 0) { + if ((knockback_status_flags & 1) && + sand_shark_behavior_vars->death_landing_particles_emitted == 0) { sand_shark_behavior_vars->death_landing_particles_emitted = 1; position_or_offset_scratch.q = *(OvlQuad *)&moby->pos; emit_sand_shark_radial_particles(&position_or_offset_scratch, 0x1B); @@ -1196,8 +1207,8 @@ typedef struct { char pad116; unsigned char hit_flash_target_red; /* 0x117 */ char pad118[8]; - char knock[0x10]; /* 0x120: passed to trooper_start_knockback */ - float knockback_gravity_per_update; /* 0x130 */ + char knock[0x10]; /* 0x120: passed to trooper_start_knockback */ + float knockback_gravity_per_update; /* 0x130 */ float knockback_horizontal_speed_approach_step; float knockback_horizontal_speed; float knockback_initial_vertical_speed; @@ -1276,7 +1287,8 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { if (moby_vars->relaunch_request_state == SAND_SHARK_RELAUNCH_REQUEST_PENDING) { moby_vars->relaunch_request_state = SAND_SHARK_RELAUNCH_REQUEST_CONSUMED; if (moby_vars->spawning_moby_index >= 0) { - (*(Vars5c88 **)((moby_vars->spawning_moby_index << 8) + D_L02_0015FFD8 + 0x78))->spawner_active_shark_count -= 1; + (*(Vars5c88 **)((moby_vars->spawning_moby_index << 8) + D_L02_0015FFD8 + 0x78)) + ->spawner_active_shark_count -= 1; } if ((moby_vars->selected_relaunch_moby = select_group_class_29c_moby(moby)) == 0) { mark_moby_for_removal(moby); @@ -1287,8 +1299,9 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { MOBY(moby)->collision = 0; MOBY(moby)->pos.z -= 10.0f; } - if (moby_vars->target_range_timer_refresh_request != 0 || (!fast_dec_timer_s16(&moby_vars->t25C) && - vector_distance_xy(moby + 0x10, &hero.motion.pos) < 10.0f)) { + if (moby_vars->target_range_timer_refresh_request != 0 || + (!fast_dec_timer_s16(&moby_vars->t25C) && + vector_distance_xy(moby + 0x10, &hero.motion.pos) < 10.0f)) { moby_vars->t25E = truncate_float_to_s32(scale_time(random_float_between(180.0f, 240.0f))); } moby_vars->target_range_timer_refresh_request = 0; @@ -1307,11 +1320,14 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { if (moby_vars->hp <= 0.0f) { moby_vars->hp -= dmg; moby_vars->knockback_collision_radius = 0x200; - moby_vars->knockback_gravity_per_update = sand_shark_death_knockback_gravity_gp * frame_time_sq; + moby_vars->knockback_gravity_per_update = + sand_shark_death_knockback_gravity_gp * frame_time_sq; moby_vars->knockback_horizontal_speed_approach_step = sand_shark_death_knockback_horizontal_speed_approach_rate_gp * frame_time_sq; - moby_vars->knockback_horizontal_speed = sand_shark_death_knockback_horizontal_speed_gp * D_0015ED6C; - moby_vars->knockback_initial_vertical_speed = sand_shark_death_knockback_vertical_speed_gp * D_0015ED6C; + moby_vars->knockback_horizontal_speed = + sand_shark_death_knockback_horizontal_speed_gp * D_0015ED6C; + moby_vars->knockback_initial_vertical_speed = + sand_shark_death_knockback_vertical_speed_gp * D_0015ED6C; moby_vars->b15D = 0; moby_vars->knockback_flags = 9; moby_vars->knockback_target_horizontal_speed = 2.0f * D_0015ED6C; @@ -1324,7 +1340,8 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { } if (moby_vars->spawning_moby_index >= 0) { extern int D_L02_0015FFD8_s __asm__("D_L02_0015FFD8") __attribute__((sda)); - (*(Vars5c88 **)((moby_vars->spawning_moby_index << 8) + D_L02_0015FFD8_s + 0x78))->spawner_active_shark_count -= 1; + (*(Vars5c88 **)((moby_vars->spawning_moby_index << 8) + D_L02_0015FFD8_s + 0x78)) + ->spawner_active_shark_count -= 1; moby_vars->b15D = 0; } else { ground_probe_position.f[2] += 0.01f; @@ -1332,7 +1349,10 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { moby_vars->knockback_flags |= 0x20; MOBY(moby)->flags &= 0xEFFF; hit_knockback_vector.q = *(OvlQuad *)(hit_record + 0x10); - trooper_knockback_arc(&hit_knockback_vector, &k, &moby_vars->knockback_horizontal_speed, &moby_vars->knockback_initial_vertical_speed); + trooper_knockback_arc(&hit_knockback_vector, + &k, + &moby_vars->knockback_horizontal_speed, + &moby_vars->knockback_initial_vertical_speed); trooper_start_knockback(k, moby, moby_vars->knock, 6, 1, 0); moby_vars->knockback_collision_z_offset = 0.85f; moby_vars->knockback_ascent_animation_target = 7.0f; @@ -1346,8 +1366,15 @@ void handle_sand_shark_damage_and_targeting(unsigned char *moby) { moby[0xA4] = 0xFF; trooper_anim_finish(moby, moby_vars->anim); path = D_L02_001B0AB0_5c88[moby_vars->configured_path_index]; - if (FUN_L00_0025ff38(moby_vars->effective_target_selection_range, moby, moby_vars->tgt, 0, 0, path + 4, *path) != 2 && - (moby_vars->effective_target_selection_range < vector_distance_xy(moby_vars->home, moby_vars->tgt) || + if (FUN_L00_0025ff38(moby_vars->effective_target_selection_range, + moby, + moby_vars->tgt, + 0, + 0, + path + 4, + *path) != 2 && + (moby_vars->effective_target_selection_range < + vector_distance_xy(moby_vars->home, moby_vars->tgt) || absolute_float(MOBY(moby)->pos.z - moby_vars->tgt[2]) > 3.0f)) { moby_vars->target_selection_status = SAND_SHARK_TARGET_SELECTION_EXCLUDED; } diff --git a/src/overlays/l02/mobys/sand_shark_nest.c b/src/overlays/l02/mobys/sand_shark_nest.c index 2f47053418..6cb21f82d4 100644 --- a/src/overlays/l02/mobys/sand_shark_nest.c +++ b/src/overlays/l02/mobys/sand_shark_nest.c @@ -181,7 +181,8 @@ void sand_shark_nest_update(unsigned char *moby) { nest_vars->removal_request_state = SAND_SHARK_NEST_REMOVAL_REQUEST_IDLE; nest_vars->timer = scale_game_frames(nest_vars->delay); if (nest_vars->spawner >= 0) { - (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8 + 0x78))->active_nest_count += 1; + (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8 + 0x78)) + ->active_nest_count += 1; } break; case SAND_SHARK_NEST_WAIT_FOR_SPAWN: @@ -213,8 +214,8 @@ void sand_shark_nest_update(unsigned char *moby) { if (launched_shark) { char *od = *(char **)(launched_shark + 0x78); if (nest_vars->spawner >= 0) { - (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8 + 0x78))->launched_sand_shark_count += - 1; + (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8 + 0x78)) + ->launched_sand_shark_count += 1; } qcopy(&launch_position, moby + 0x10); launch_position.f[2] += 1.5f; @@ -242,7 +243,8 @@ void sand_shark_nest_update(unsigned char *moby) { if (step_moby_motion(moby, nest_vars->anim) & 0x40) { if (nest_vars->spawner >= 0) { extern int D_L02_0015FFD8_s __asm__("D_L02_0015FFD8") __attribute__((sda)); - (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8_s + 0x78))->active_nest_count -= 1; + (*(Spawnercb38 **)((nest_vars->spawner << 8) + D_L02_0015FFD8_s + 0x78)) + ->active_nest_count -= 1; } qcopy(&launch_velocity_or_explosion_position, moby + 0x10); spawn_explosion(moby, diff --git a/src/overlays/l02/mobys/skids_agent.c b/src/overlays/l02/mobys/skids_agent.c index c5da809362..c80be7f89a 100644 --- a/src/overlays/l02/mobys/skids_agent.c +++ b/src/overlays/l02/mobys/skids_agent.c @@ -224,7 +224,9 @@ void skids_agent_update(struct Moby *moby) { (char *)l02_cuboids + (skids_agent_vars->camera_start_cuboid_index << 7) + 0x30, (char *)l02_cuboids + (skids_agent_vars->unk15C << 7) + 0x30, skids_agent_vars->unk180); - qcopy_nc(&from, (char *)((skids_agent_vars->camera_start_cuboid_index << 7) + (s32)l02_cuboids) + 0x70); + qcopy_nc(&from, + (char *)((skids_agent_vars->camera_start_cuboid_index << 7) + (s32)l02_cuboids) + + 0x70); qcopy_nc(&to, (char *)((skids_agent_vars->unk15C << 7) + (s32)l02_cuboids) + 0x70); rot.f[2] = fast_add_rotations( fast_subtract_rotations(to.f[2], from.f[2]) * skids_agent_vars->unk180, from.f[2]); @@ -272,7 +274,9 @@ void skids_agent_update(struct Moby *moby) { 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); - fast_vec_add(&skids_agent_vars->carried_prop->pos, &skids_agent_vars->carried_prop->pos, &offset); + fast_vec_add(&skids_agent_vars->carried_prop->pos, + &skids_agent_vars->carried_prop->pos, + &offset); update_entity(skids_agent_vars->carried_prop); } }); @@ -314,8 +318,11 @@ void skids_agent_update(struct Moby *moby) { heading = fast_add_rotations(moby->rot.z, random_float_between(-90.0f, 90.0f) * 0.017453292f); pitch = random_float_between(0.0f, 30.0f) * 0.017453292f; - build_spherical_offset(&skids_agent_vars->idle_look_target_position, 6.0f, heading, pitch); - fast_vec_add(&skids_agent_vars->idle_look_target_position, &skids_agent_vars->idle_look_target_position, &moby->pos); + build_spherical_offset( + &skids_agent_vars->idle_look_target_position, 6.0f, heading, pitch); + fast_vec_add(&skids_agent_vars->idle_look_target_position, + &skids_agent_vars->idle_look_target_position, + &moby->pos); } if (skids_agent_vars->timer_174 != 0) { qcopy(&target, &hero.motion.body_center); diff --git a/src/overlays/l02/mobys/smoke_vent.c b/src/overlays/l02/mobys/smoke_vent.c index 196f25d416..fa8612d49e 100644 --- a/src/overlays/l02/mobys/smoke_vent.c +++ b/src/overlays/l02/mobys/smoke_vent.c @@ -78,10 +78,10 @@ extern f32 view_gated_smoke_burst_acceleration_w_random_range_start_gp __asm__(" __attribute__((sda)); extern f32 view_gated_smoke_burst_acceleration_w_random_range_end_gp __asm__("D_L02_001620F8") __attribute__((sda)); -s32 l02_view_gated_smoke_burst_first_color_tween_start __asm__("D_L02_001620FC") = 0x804080ff; -s32 l02_view_gated_smoke_burst_first_color_tween_end __asm__("D_L02_00162100") = 0x8040ffff; -s32 l02_view_gated_smoke_burst_second_color_tween_start __asm__("D_L02_00162104") = 0x80204040; -s32 l02_view_gated_smoke_burst_second_color_tween_end __asm__("D_L02_00162108") = 0x80204080; +s32 l02_view_gated_smoke_burst_first_color_tween_start __asm__("D_L02_001620FC") = 0x804080ff; +s32 l02_view_gated_smoke_burst_first_color_tween_end __asm__("D_L02_00162100") = 0x8040ffff; +s32 l02_view_gated_smoke_burst_second_color_tween_start __asm__("D_L02_00162104") = 0x80204040; +s32 l02_view_gated_smoke_burst_second_color_tween_end __asm__("D_L02_00162108") = 0x80204080; extern s32 view_gated_smoke_burst_interval_min_gp __asm__("D_L02_0016210C") __attribute__((sda)); extern s32 view_gated_smoke_burst_interval_max_gp __asm__("D_L02_00162110") __attribute__((sda)); s32 l02_view_gated_smoke_burst_spawn_options __asm__("D_L02_00162114") = 0x10019; @@ -103,10 +103,10 @@ extern f32 alternating_smoke_burst_acceleration_w_random_range_start_gp __asm__( __attribute__((sda)); extern f32 alternating_smoke_burst_acceleration_w_random_range_end_gp __asm__("D_L02_00162148") __attribute__((sda)); -s32 l02_alternating_smoke_burst_first_color_tween_start __asm__("D_L02_0016214C") = 0x804080ff; -s32 l02_alternating_smoke_burst_first_color_tween_end __asm__("D_L02_00162150") = 0x8040ffff; -s32 l02_alternating_smoke_burst_second_color_tween_start __asm__("D_L02_00162154") = 0x80204040; -s32 l02_alternating_smoke_burst_second_color_tween_end __asm__("D_L02_00162158") = 0x80204080; +s32 l02_alternating_smoke_burst_first_color_tween_start __asm__("D_L02_0016214C") = 0x804080ff; +s32 l02_alternating_smoke_burst_first_color_tween_end __asm__("D_L02_00162150") = 0x8040ffff; +s32 l02_alternating_smoke_burst_second_color_tween_start __asm__("D_L02_00162154") = 0x80204040; +s32 l02_alternating_smoke_burst_second_color_tween_end __asm__("D_L02_00162158") = 0x80204080; extern s32 alternating_smoke_burst_interval_min_gp __asm__("D_L02_0016215C") __attribute__((sda)); extern s32 alternating_smoke_burst_interval_max_gp __asm__("D_L02_00162160") __attribute__((sda)); s32 l02_alternating_smoke_burst_spawn_options __asm__("D_L02_00162164") = 0x10019; @@ -206,10 +206,14 @@ void smoke_vent_update(struct Moby *moby) { acc.f[3] = random_float_between( view_gated_smoke_burst_acceleration_w_random_range_start_gp, view_gated_smoke_burst_acceleration_w_random_range_end_gp); - color_a1_burst = fast_tween_color( - l02_view_gated_smoke_burst_first_color_tween_start, l02_view_gated_smoke_burst_first_color_tween_end, random_float_between(0.0f, 1.0f)); - color_b1_burst = fast_tween_color( - l02_view_gated_smoke_burst_second_color_tween_start, l02_view_gated_smoke_burst_second_color_tween_end, random_float_between(0.0f, 1.0f)); + color_a1_burst = + fast_tween_color(l02_view_gated_smoke_burst_first_color_tween_start, + l02_view_gated_smoke_burst_first_color_tween_end, + random_float_between(0.0f, 1.0f)); + color_b1_burst = + fast_tween_color(l02_view_gated_smoke_burst_second_color_tween_start, + l02_view_gated_smoke_burst_second_color_tween_end, + random_float_between(0.0f, 1.0f)); time_a1_burst = truncate_float_to_s32( scale_time((f32)view_gated_smoke_burst_timing_random_span_gp * random_float_between(0.0f, 1.0f) + @@ -265,10 +269,12 @@ void smoke_vent_update(struct Moby *moby) { view_gated_smoke_puff_velocity_w_random_range_end_gp); acc.f[3] = random_float_between(view_gated_smoke_puff_acceleration_w_random_range_start_gp, view_gated_smoke_puff_acceleration_w_random_range_end_gp); - color_a1_puff = - fast_tween_color(l02_view_gated_smoke_puff_first_color_tween_start, l02_view_gated_smoke_puff_first_color_tween_end, random_float_between(0.0f, 1.0f)); - color_b1_puff = - fast_tween_color(l02_view_gated_smoke_puff_second_color_tween_start, l02_view_gated_smoke_puff_second_color_tween_end, random_float_between(0.0f, 1.0f)); + color_a1_puff = fast_tween_color(l02_view_gated_smoke_puff_first_color_tween_start, + l02_view_gated_smoke_puff_first_color_tween_end, + random_float_between(0.0f, 1.0f)); + color_b1_puff = fast_tween_color(l02_view_gated_smoke_puff_second_color_tween_start, + l02_view_gated_smoke_puff_second_color_tween_end, + random_float_between(0.0f, 1.0f)); time_a1_puff = truncate_float_to_s32(scale_time( (f32)view_gated_smoke_puff_timing_random_span_gp * random_float_between(0.0f, 1.0f) + 1.0f)); @@ -343,10 +349,14 @@ void smoke_vent_update(struct Moby *moby) { acc.f[3] = random_float_between( alternating_smoke_burst_acceleration_w_random_range_start_gp, alternating_smoke_burst_acceleration_w_random_range_end_gp); - color_a2_burst = fast_tween_color( - l02_alternating_smoke_burst_first_color_tween_start, l02_alternating_smoke_burst_first_color_tween_end, random_float_between(0.0f, 1.0f)); - color_b2_burst = fast_tween_color( - l02_alternating_smoke_burst_second_color_tween_start, l02_alternating_smoke_burst_second_color_tween_end, random_float_between(0.0f, 1.0f)); + color_a2_burst = + fast_tween_color(l02_alternating_smoke_burst_first_color_tween_start, + l02_alternating_smoke_burst_first_color_tween_end, + random_float_between(0.0f, 1.0f)); + color_b2_burst = + fast_tween_color(l02_alternating_smoke_burst_second_color_tween_start, + l02_alternating_smoke_burst_second_color_tween_end, + random_float_between(0.0f, 1.0f)); time_a2_burst = truncate_float_to_s32( scale_time((f32)alternating_smoke_burst_timing_random_span_gp * random_float_between(0.0f, 1.0f) + @@ -399,10 +409,12 @@ void smoke_vent_update(struct Moby *moby) { alternating_smoke_puff_velocity_w_random_range_end_gp); acc.f[3] = random_float_between(alternating_smoke_puff_acceleration_w_random_range_start_gp, alternating_smoke_puff_acceleration_w_random_range_end_gp); - color_a2_puff = - fast_tween_color(l02_alternating_smoke_puff_first_color_tween_start, l02_alternating_smoke_puff_first_color_tween_end, random_float_between(0.0f, 1.0f)); - color_b2_puff = - fast_tween_color(l02_alternating_smoke_puff_second_color_tween_start, l02_alternating_smoke_puff_second_color_tween_end, random_float_between(0.0f, 1.0f)); + color_a2_puff = fast_tween_color(l02_alternating_smoke_puff_first_color_tween_start, + l02_alternating_smoke_puff_first_color_tween_end, + random_float_between(0.0f, 1.0f)); + color_b2_puff = fast_tween_color(l02_alternating_smoke_puff_second_color_tween_start, + l02_alternating_smoke_puff_second_color_tween_end, + random_float_between(0.0f, 1.0f)); time_a2_puff = truncate_float_to_s32( scale_time((f32) * &smoke_vent_vars->unkC8 * random_float_between(0.0f, 1.0f) + 1.0f)); time_b2_puff = truncate_float_to_s32( diff --git a/src/overlays/l03/hero/hero_set_state.c b/src/overlays/l03/hero/hero_set_state.c index 22d5eeba88..8f9afa1ec4 100644 --- a/src/overlays/l03/hero/hero_set_state.c +++ b/src/overlays/l03/hero/hero_set_state.c @@ -82,7 +82,8 @@ int hero_set_state(int requested_state, int entry_animation_mode) { entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS)) return 0; } - if ((D_L03_0015F5C4 == 2 || D_L03_0015F5C4 == 6) && entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS) + if ((D_L03_0015F5C4 == 2 || D_L03_0015F5C4 == 6) && + entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l03/mobys/kerwan_path_enemy.c b/src/overlays/l03/mobys/kerwan_path_enemy.c index 8250a69c2f..4839b0cd71 100644 --- a/src/overlays/l03/mobys/kerwan_path_enemy.c +++ b/src/overlays/l03/mobys/kerwan_path_enemy.c @@ -75,8 +75,8 @@ int try_start_kerwan_path_enemy_heading_turn(float desired_heading, } } heading_delta = fast_subtract_rotations(desired_heading, moby->rot.z); - if (absolute_float(heading_delta) >= 0.7853982f && enemy_pvars->heading_turn_cooldown_frames == 0 && - moby->prev_seq != 1) { + if (absolute_float(heading_delta) >= 0.7853982f && + enemy_pvars->heading_turn_cooldown_frames == 0 && moby->prev_seq != 1) { goto go; } if (absolute_float(heading_delta) > 1.5707964f) { @@ -424,9 +424,12 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { fast_subtract_rotations_cf(&moby_data->b263); 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; - moby_data->look1.target_yaw_offset = fast_subtract_rotations(moby_data->f28C, m->rot[2]) * 0.75f; - } else if (m->state < ENEMY_MOVE_TO_PATH_NODE && target_distance < moby_data->target_selection_range) { + moby_data->look0.target_yaw_offset = + fast_subtract_rotations(moby_data->f28C, m->rot[2]) * 0.25f; + moby_data->look1.target_yaw_offset = + fast_subtract_rotations(moby_data->f28C, 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 = fast_subtract_rotations(fast_arc_tan(selected_target.pos[0] - m->pos[0], selected_target.pos[1] - m->pos[1]), @@ -460,7 +463,8 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { moby_data->mv.f24 = frame_time * 6.0f; moby_data->mv.f8 = 2.0f; moby_data->mv.f28 = 3.1415927f; - moby_data->mv.path_node_proximity_distance = moby_data->mv.f24 * truncate_float_to_s32_cf(15.0f); + moby_data->mv.path_node_proximity_distance = + moby_data->mv.f24 * truncate_float_to_s32_cf(15.0f); moby_data->mv.i38 = 9; moby_data->f20 = 3.0f; moby_data->s24 = truncate_float_to_s32(3.0f); @@ -525,7 +529,8 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { 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) { + if (target_distance < moby_data->target_selection_range || + target_distance < moby_data->f27C) { 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]), @@ -1060,7 +1065,10 @@ void kerwan_path_enemy_update(Moby2C8398 *m) { collision_line(a, b, 0x24, m, 0); qcopy(b, &D_L03_00173F40.point); } - if (coll_sphere(convert_integer_to_float(q->collision_radius_fixed) * 0.0009765625f, b, 0x24, m)) { + if (coll_sphere(convert_integer_to_float(q->collision_radius_fixed) * 0.0009765625f, + b, + 0x24, + m)) { qcopy(m->pos, sphere_collision_resolved_position); m->pos[2] = a[2] + q->f8 - q->f28; } @@ -1671,7 +1679,8 @@ void select_kerwan_path_enemy_next_node(Moby2C8398 *moby) { best_ang = 0.0f; pf = &moby_data->pf; best_dist = best_ang; - select_moby_target_with_hero_fallback((char *)moby, (char *)&target, moby_data->target_selection_range); + select_moby_target_with_hero_fallback( + (char *)moby, (char *)&target, moby_data->target_selection_range); seg = pf->idx; FUN_L00_0025df68(pf->path, moby->pos, diff --git a/src/overlays/l03/mobys/metropolis_train_locomotive.c b/src/overlays/l03/mobys/metropolis_train_locomotive.c index 0bf7053c7e..d3e0741c7c 100644 --- a/src/overlays/l03/mobys/metropolis_train_locomotive.c +++ b/src/overlays/l03/mobys/metropolis_train_locomotive.c @@ -220,7 +220,8 @@ void update_metropolis_train_motion(char *moby) { fast_vec_sub(car_position_adjustment, hitch, car + 0x10); fast_vec_normalize(car_position_adjustment, car_position_adjustment, - fast_vec_length(car_position_adjustment) - car_data->hitch_offset_distance); + fast_vec_length(car_position_adjustment) - + car_data->hitch_offset_distance); fast_vec_add(car + 0x10, car_position_adjustment, car + 0x10); *(float *)(car + 0x48) = fast_add_rotations( fast_arc_tan(hitch[0] - *(float *)(car + 0x10), hitch[1] - *(float *)(car + 0x14)), @@ -494,7 +495,8 @@ void metropolis_train_locomotive_update(char *moby) { *(unsigned short *)(coupling + 0x34) |= 6; break; case TRAIN_SETUP_COUPLING_PATH: - *(OvlQuad *)start = *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->first_path_index]) + 0x10); + *(OvlQuad *)start = + *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->first_path_index]) + 0x10); place_metropolis_train(moby, start, 0.0f); cdata->i74 = train_engine_pvars->first_path_index; cdata->path_step_distance = train_engine_pvars->fC0; @@ -502,9 +504,13 @@ void metropolis_train_locomotive_update(char *moby) { MOBY(moby)->command = 2; break; case TRAIN_POSITION_FOR_BOARDING: - *(OvlQuad *)start = *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->boarding_placement_path_index]) + 0x10); + *(OvlQuad *)start = + *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->boarding_placement_path_index]) + + 0x10); place_metropolis_train( - moby, start, PATH_HEADING(((char *)l03_paths[train_engine_pvars->boarding_placement_path_index]))); + moby, + start, + PATH_HEADING(((char *)l03_paths[train_engine_pvars->boarding_placement_path_index]))); MOBY(moby)->command = 3; cdata->i74 = train_engine_pvars->first_path_index; cdata->path = ((char *)l03_paths[cdata->i74]); @@ -513,7 +519,8 @@ void metropolis_train_locomotive_update(char *moby) { break; case TRAIN_WAIT_FOR_BOARDING: update_metropolis_train_idle_motion(moby); - if (!is_point_inside_clip_volume(&hero.motion, train_engine_pvars->boarding_clip_volume_index)) { + if (!is_point_inside_clip_volume(&hero.motion, + train_engine_pvars->boarding_clip_volume_index)) { break; } if (train_engine_pvars->boarding_turret_moby_index == -1) { @@ -525,8 +532,11 @@ void metropolis_train_locomotive_update(char *moby) { D_L03_0015FDFC = 1; request_music_track(4, 7); set_moby_dialogue_record_value(moby, 1); - ((char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index])[0xBC] = 1; - td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index] + 0x78); + ((char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index])[0xBC] = + 1; + td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars + ->boarding_turret_moby_index] + + 0x78); AIM_AT_HERO(td); td->i2C = scale_game_frames(860); train_engine_pvars->i104 = scale_game_frames(30); @@ -556,8 +566,11 @@ void metropolis_train_locomotive_update(char *moby) { } else { train_engine_pvars->fall_check_airborne_frames = 0; } - if (((unsigned char *)(char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index])[0xBC] != 0) { - td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index] + 0x78); + if (((unsigned char *)(char *)&D_L03_0015FFD8_m292 + [train_engine_pvars->boarding_turret_moby_index])[0xBC] != 0) { + td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars + ->boarding_turret_moby_index] + + 0x78); AIM_AT_HERO(td); } if (hero.ground_moby != 0 && @@ -573,7 +586,8 @@ void metropolis_train_locomotive_update(char *moby) { if (train_engine_pvars->second_path_turret_moby_index == -1) { break; } - if (((unsigned char *)(char *)&D_L03_0015FFD8_m292[train_engine_pvars->boarding_turret_moby_index])[0xBC] != 0) { + if (((unsigned char *)(char *)&D_L03_0015FFD8_m292 + [train_engine_pvars->boarding_turret_moby_index])[0xBC] != 0) { break; } for (i = 0; i < 8; i++) { @@ -590,14 +604,18 @@ void metropolis_train_locomotive_update(char *moby) { break; } ((char *)&D_L03_0015FFD8_m292[train_engine_pvars->second_path_turret_moby_index])[0xBC] = 1; - tdb = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->second_path_turret_moby_index] + 0x78); + tdb = *( + Turret292e98 * + *)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->second_path_turret_moby_index] + + 0x78); path = ((char *)l03_paths[train_engine_pvars->second_path_index]); tdb->f18 = fast_arc_tan(*(float *)(path + 0x10) - l03_camera.pos.f[0], *(float *)(path + 0x14) - l03_camera.pos.f[1]); tdb->f14 = -fast_arc_tan( vector_distance_xy(l03_camera.pos.f, ((char *)l03_paths[train_engine_pvars->second_path_index]) + 0x10), - *(float *)(((char *)l03_paths[train_engine_pvars->second_path_index]) + 0x18) - l03_camera.pos.f[2]); + *(float *)(((char *)l03_paths[train_engine_pvars->second_path_index]) + 0x18) - + l03_camera.pos.f[2]); l03_cuboids[tdb->cuboid_index].pos.x = fast_cos(PATH_HEADING(((char *)l03_paths[train_engine_pvars->second_path_index]))) * -(train_engine_pvars->fDC + 4.0f); @@ -610,9 +628,11 @@ void metropolis_train_locomotive_update(char *moby) { ((char *)l03_paths[train_engine_pvars->second_path_index]) + 0x10); l03_cuboids[tdb->cuboid_index].pos.z += 2.7f; clear_u64_value(&l03_cuboids[tdb->cuboid_index].rot); - l03_cuboids[tdb->cuboid_index].rot.z = PATH_HEADING(((char *)l03_paths[train_engine_pvars->second_path_index])); + l03_cuboids[tdb->cuboid_index].rot.z = + PATH_HEADING(((char *)l03_paths[train_engine_pvars->second_path_index])); tdb->i2C = scale_game_frames(10000); - *(OvlQuad *)start = *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->second_path_index]) + 0x10); + *(OvlQuad *)start = + *(OvlQuad *)(((char *)l03_paths[train_engine_pvars->second_path_index]) + 0x10); place_metropolis_train( moby, start, PATH_HEADING(((char *)l03_paths[train_engine_pvars->second_path_index]))); cdata->i74 = train_engine_pvars->second_path_index; @@ -625,7 +645,10 @@ void metropolis_train_locomotive_update(char *moby) { request_music_track(0, 8); break; case TRAIN_FOLLOW_SECOND_PATH_AND_BRAKE: - td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->second_path_turret_moby_index] + 0x78); + td = *( + Turret292e98 * + *)((char *)&D_L03_0015FFD8_m292[train_engine_pvars->second_path_turret_moby_index] + + 0x78); update_metropolis_train_motion(moby); D_L03_0015FDFC = 1; ENGINE_SOUND(); @@ -637,7 +660,8 @@ void metropolis_train_locomotive_update(char *moby) { train_engine_pvars->fC8 = braking_speed_floor; } if (train_engine_pvars->fC8 == braking_speed_floor) { - ((char *)&D_L03_0015FFD8_m292[train_engine_pvars->second_path_turret_moby_index])[0xBC] = 0; + ((char *)&D_L03_0015FFD8_m292[train_engine_pvars + ->second_path_turret_moby_index])[0xBC] = 0; MOBY(moby)->command = 6; train_engine_pvars->fC0 *= 0.5f; RELEASE_VOICE(train_engine_pvars->i108); @@ -647,7 +671,8 @@ void metropolis_train_locomotive_update(char *moby) { AIM_AT_HERO(td); break; case TRAIN_WAIT_FOR_RESET_VOLUME: - if (is_point_inside_clip_volume(&hero.motion, train_engine_pvars->reset_clip_volume_index)) { + if (is_point_inside_clip_volume(&hero.motion, + train_engine_pvars->reset_clip_volume_index)) { for (i6 = 0; i6 < 8; i6++) { linked_moby = D_L03_0015FFD8_292e98 + (train_engine_pvars->ids[i6] << 8); if (train_engine_pvars->ids[i6] != -1 && linked_moby != 0 && diff --git a/src/overlays/l03/mobys/moving_platform_small.c b/src/overlays/l03/mobys/moving_platform_small.c index 86d8d7cd76..d645be68b1 100644 --- a/src/overlays/l03/mobys/moving_platform_small.c +++ b/src/overlays/l03/mobys/moving_platform_small.c @@ -130,7 +130,8 @@ void moving_platform_small_update(char *moby) { eased_endpoint_distance += speed * 0.5f * convert_integer_to_float(easing_frame_count * easing_frame_count); if (pb[4] < 0) { - eased_endpoint_distance = platform_pvars->path_endpoint_distance - eased_endpoint_distance; + eased_endpoint_distance = + platform_pvars->path_endpoint_distance - eased_endpoint_distance; } fast_vec_sub(endpoint_delta_or_position, *(char **)(pb + 0x10) + **(int **)(pb + 0x10) * 0x10, diff --git a/src/overlays/l03/mobys/rail_lift.c b/src/overlays/l03/mobys/rail_lift.c index 3d6cabbdc1..543dd820c1 100644 --- a/src/overlays/l03/mobys/rail_lift.c +++ b/src/overlays/l03/mobys/rail_lift.c @@ -83,8 +83,8 @@ extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L0 /* Pvars of a rail lift that carries the hero between the ends of two rail paths. */ struct RailLiftVars { u8 pad0[0x20]; - u8 coll[0x44]; /* 0x20: collision record moved with the lift */ - s32 target_path_point_index; /* 0x64: set to 1 when a ride starts */ + u8 coll[0x44]; /* 0x20: collision record moved with the lift */ + s32 target_path_point_index; /* 0x64: set to 1 when a ride starts */ u8 pad68[0x10]; s32 snd; /* 0x78: travel sound voice (FUN_L03_002d3918) */ s32 started; /* 0x7C: set once the first ride starts */ diff --git a/src/overlays/l03/mobys/red_ship_1.c b/src/overlays/l03/mobys/red_ship_1.c index 43914f75bb..e979fb3248 100644 --- a/src/overlays/l03/mobys/red_ship_1.c +++ b/src/overlays/l03/mobys/red_ship_1.c @@ -731,7 +731,8 @@ void red_ship_1_update(char *moby) { if (spline_moby_pvars->unk100 >= 1.0f) { spline_moby_pvars->unk100 -= 1.0f; advanced_path_node_index = advance_path_node_index(pm); - *(OvlQuad *)&spline_moby_pvars->segment_start_tangent[0] = *(OvlQuad *)&spline_moby_pvars->unkA0; + *(OvlQuad *)&spline_moby_pvars->segment_start_tangent[0] = + *(OvlQuad *)&spline_moby_pvars->unkA0; compute_path_node_tangent(path_tangent_or_moby_position, (int *)pm, 1, diff --git a/src/overlays/l03/mobys/robot_dog.c b/src/overlays/l03/mobys/robot_dog.c index 9fd3f54668..5679415fea 100644 --- a/src/overlays/l03/mobys/robot_dog.c +++ b/src/overlays/l03/mobys/robot_dog.c @@ -169,7 +169,8 @@ void robot_dog_update(char *moby) { float initialization_multiplier_or_desired_heading; robot_dog_state = ((Data2c5bb8 *)MOBY(moby)->pvars); - select_moby_target_with_hero_fallback(moby, (char *)&selected_target, robot_dog_state->target_engagement_radius); + select_moby_target_with_hero_fallback( + moby, (char *)&selected_target, robot_dog_state->target_engagement_radius); FUN_L00_00263ac8_c5bb8(moby, 0, robot_dog_state->m280, 2.1f); update_robot_dog_hit_reaction((struct Moby *)moby); fast_dec_timer(&robot_dog_state->melee_cooldown_timer); @@ -205,7 +206,8 @@ void robot_dog_update(char *moby) { MOBY(moby)->flags |= 0x8000; } robot_dog_state->pD0 = &D_L03_001618D0; - if (robot_dog_state->linked_partner_index != -1 && robot_dog_state->activation_path_index == -1) { + if (robot_dog_state->linked_partner_index != -1 && + robot_dog_state->activation_path_index == -1) { if (((unsigned char *)moby)[0x53] != 0) { blend_moby_animation(moby, 0, 0, 0); } @@ -223,8 +225,10 @@ void robot_dog_update(char *moby) { *(float *)(activation_path + 0x24) - *(float *)(activation_path + 0x14)); if ((random_integer_below(14) == 0 && is_point_inside_clip_volume_cf(((unsigned char *)moby)[0x21])) || - is_point_inside_clip_volume(&selected_target, robot_dog_state->activation_clip_volume_id) || - (fast_vec_dist(&selected_target, moby + 0x10) < robot_dog_state->path_activation_distance && + is_point_inside_clip_volume(&selected_target, + robot_dog_state->activation_clip_volume_id) || + (fast_vec_dist(&selected_target, moby + 0x10) < + robot_dog_state->path_activation_distance && absolute_float(selected_target.pos[2] - MOBY(moby)->pos.z) < 4.0f)) { robot_dog_state->path_target_node_index = 0; MOBY(moby)->state = ROBOT_DOG_FOLLOW_PATH; @@ -233,7 +237,8 @@ void robot_dog_update(char *moby) { } } } else if (random_integer_below(14) == 0 && - fast_vec_dist(&selected_target, robot_dog_state->home) < robot_dog_state->target_engagement_radius && + fast_vec_dist(&selected_target, robot_dog_state->home) < + robot_dog_state->target_engagement_radius && absolute_float(selected_target.pos[2] - MOBY(moby)->pos.z) < 3.0f) { MOBY(moby)->state = ROBOT_DOG_TURN_TO_TARGET; if (((unsigned char *)moby)[0x53] != 2) { @@ -250,7 +255,8 @@ void robot_dog_update(char *moby) { ((unsigned char *)partner_moby)[0x20] == 0xFE || ((unsigned char *)partner_moby)[0x20] == 0xFD || can_release_linked_robot_dog((struct Moby *)partner_moby)) { - robot_dog_state->chase_timer = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robot_dog_state->chase_timer = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); MOBY(moby)->state = ROBOT_DOG_CHASE_TARGET; if (((unsigned char *)moby)[0x53] != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(10)); @@ -268,7 +274,8 @@ void robot_dog_update(char *moby) { 0.3f, 0.1f); if (((unsigned char *)moby)[0x70] & 2) { - robot_dog_state->chase_timer = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robot_dog_state->chase_timer = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); MOBY(moby)->state = ROBOT_DOG_CHASE_TARGET; if (((unsigned char *)moby)[0x53] != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(10)); @@ -290,17 +297,19 @@ void robot_dog_update(char *moby) { move_moby_with_ground_and_collision_checks( moby, &robot_dog_state->i180, forward_vector_or_path_point, push, 1.0f); if (fast_dec_timer(&robot_dog_state->chase_timer)) { - robot_dog_state->chase_timer = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robot_dog_state->chase_timer = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); } target_distance = vector_distance_xy(moby + 0x10, &selected_target); - if (target_distance < robot_dog_state->movement_speed * frame_time * 0.5f * FUN_L04_001f1978(40.0f) + - robot_dog_state->movement_speed * frame_time * FUN_L04_001f1978(10.0f) + - 1.5f) { + if (target_distance < + robot_dog_state->movement_speed * frame_time * 0.5f * FUN_L04_001f1978(40.0f) + + robot_dog_state->movement_speed * frame_time * FUN_L04_001f1978(10.0f) + 1.5f) { MOBY(moby)->state = ROBOT_DOG_MELEE_ATTACK; if (((unsigned char *)moby)[0x53] != 5) { blend_moby_animation(moby, 5, 0, truncate_float_to_s32(FUN_L04_001f1978(10.0f))); } - } else if (robot_dog_state->target_engagement_radius < fast_vec_dist(&selected_target, robot_dog_state->home) || + } else if (robot_dog_state->target_engagement_radius < + fast_vec_dist(&selected_target, robot_dog_state->home) || absolute_float(selected_target.pos[2] - MOBY(moby)->pos.z) > 3.0f) { MOBY(moby)->state = ROBOT_DOG_RETURN_HOME; } @@ -314,7 +323,8 @@ void robot_dog_update(char *moby) { } if (step_mover_2e3f20(moby, (char *)&robot_dog_state->i180, - (char *)path + (robot_dog_state->path_target_node_index * 0x10 + 0x10), + (char *)path + + (robot_dog_state->path_target_node_index * 0x10 + 0x10), (char *)robot_dog_state->v40) & 0x14) { if (robot_dog_state->path_target_node_index < *path - 1) { @@ -341,7 +351,8 @@ void robot_dog_update(char *moby) { ((unsigned char *)partner_moby)[0x20] == 0xFD || can_release_linked_robot_dog((struct Moby *)partner_moby)) { robot_dog_state->activation_path_index = -1; - robot_dog_state->chase_timer = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robot_dog_state->chase_timer = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); MOBY(moby)->state = ROBOT_DOG_CHASE_TARGET; if (((unsigned char *)moby)[0x53] != 3) { blend_moby_animation(moby, 3, 0, scale_game_frames(10)); diff --git a/src/overlays/l04/mobys/big_axebot.c b/src/overlays/l04/mobys/big_axebot.c index 2276287deb..effdf52e8e 100644 --- a/src/overlays/l04/mobys/big_axebot.c +++ b/src/overlays/l04/mobys/big_axebot.c @@ -335,7 +335,8 @@ void big_axebot_update(M_B7B0 *moby) { moby->f7F = 0x15; } } - select_moby_combat_target((char *)moby, (float *)&tg, flag ? data->detection_range * 2.0f : data->detection_range); + select_moby_combat_target( + (char *)moby, (float *)&tg, flag ? data->detection_range * 2.0f : data->detection_range); target_moby = tg.f40; rot = moby->rot[2]; target_distance = vector_distance_xy(moby->pos, (float *)&tg); @@ -468,8 +469,10 @@ void big_axebot_update(M_B7B0 *moby) { data->fE0 = 0x400; trooper_set_knockback(data->fC0, 5.7f, 4.0f); *(OvlQuad *)vector_quaternion_scratch = *(OvlQuad *)hit->pos; - trooper_knockback_arc( - vector_quaternion_scratch, &knockback_yaw, &data->knockback_initial_horizontal_displacement, &data->knockback_initial_vertical_displacement); + trooper_knockback_arc(vector_quaternion_scratch, + &knockback_yaw, + &data->knockback_initial_horizontal_displacement, + &data->knockback_initial_vertical_displacement); trooper_start_knockback(knockback_yaw, moby, data->fC0, 7, 1, 0); data->knockback_ascent_target_frame = 12.0f; data->knockback_descent_target_frame = 25.0f; @@ -530,11 +533,12 @@ void big_axebot_update(M_B7B0 *moby) { } break; case BIG_AXEBOT_STATE_IDLE: { - if (moby->animation_target_sequence == 6 && data->idle_action_delay_timer == scale_game_frames(0x25)) { + if (moby->animation_target_sequence == 6 && + data->idle_action_delay_timer == scale_game_frames(0x25)) { allocate_voice_for_target_entry(2, 0, (char *)moby); } - if ((moby->f70 & 2) && - (flag ? data->detection_range * 2.0f < target_distance : data->detection_range < target_distance)) { + if ((moby->f70 & 2) && (flag ? data->detection_range * 2.0f < target_distance + : data->detection_range < target_distance)) { int arr[6]; random_integer_below_cf(arr, 0, 0x18); @@ -543,19 +547,24 @@ void big_axebot_update(M_B7B0 *moby) { (void *)arr[random_integer_below(6)], 0, (void *)scale_game_frames(0x18)); - } else if (moby->animation_target_sequence != 0xD && (moby->animation_target_sequence != 6 || (moby->f70 & 2))) { - if (flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) { + } else if (moby->animation_target_sequence != 0xD && + (moby->animation_target_sequence != 6 || (moby->f70 & 2))) { + if (flag ? target_distance < data->detection_range * 2.0f + : target_distance < data->detection_range) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)0xD, 0, (void *)scale_game_frames(0x18)); } } - if (data->path_trigger_volume_index != -1 && data->approach_path_index != -1 && data->path_follow_started == 0 && - (flag || is_point_inside_clip_volume(&hero.motion.pos, data->path_trigger_volume_index) != 0)) { + if (data->path_trigger_volume_index != -1 && data->approach_path_index != -1 && + data->path_follow_started == 0 && + (flag || + is_point_inside_clip_volume(&hero.motion.pos, data->path_trigger_volume_index) != 0)) { moby->state = BIG_AXEBOT_STATE_FOLLOW_PATH; moby->behavior_flags |= 1; data->path_follow_started = 1; } else { - if (moby->animation_source_sequence == 0xD && FUN_L00_001fefc8(&data->alert_voice_cooldown_timer) != 0) { + if (moby->animation_source_sequence == 0xD && + FUN_L00_001fefc8(&data->alert_voice_cooldown_timer) != 0) { allocate_voice_for_target_entry(0xA, 0, (char *)moby); data->alert_voice_cooldown_timer = scale_game_frames(0xB4); } @@ -582,7 +591,8 @@ void big_axebot_update(M_B7B0 *moby) { if (moby->animation_source_sequence == 2 && (moby->f70 & 2)) { blend_big_axebot_and_axe_animation( (char *)moby, - (void *)((flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) + (void *)((flag ? target_distance < data->detection_range * 2.0f + : target_distance < data->detection_range) ? 0xD : 0), 0, @@ -600,7 +610,8 @@ void big_axebot_update(M_B7B0 *moby) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_MELEE_ATTACK; - } else if (flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) { + } else if (flag ? target_distance < data->detection_range * 2.0f + : target_distance < data->detection_range) { int nf = (moby->behavior_flags & 1) == 0; if (nf) { blend_big_axebot_and_axe_animation( @@ -627,7 +638,8 @@ void big_axebot_update(M_B7B0 *moby) { if (vector_distance_xy(path->pts[data->path_waypoint_index], moby->pos) < 1.0f) { data->path_waypoint_index++; if (data->path_waypoint_index == path->count) { - if (flag ? data->detection_range * 2.0f < target_distance : data->detection_range < target_distance) { + if (flag ? data->detection_range * 2.0f < target_distance + : data->detection_range < target_distance) { blend_big_axebot_and_axe_animation( (char *)moby, 0, 0, (void *)scale_game_frames(0x18)); } else { @@ -660,12 +672,16 @@ void big_axebot_update(M_B7B0 *moby) { reset_leg_rig_from_animation(moby, data->leg_rig_state); } data->movement_yaw = spring_turn(moby->rot[2], - target_yaw, - &data->yaw_turn_velocity, - frame_time_sq * 6.2831855f, - frame_time_sq * 125.663704f, - frame_time * 12.566371f); - leg_walker_update(moby, data->leg_rig_state, frame_time * 4.0f, data->movement_yaw, frame_time_sq * 20.0f); + target_yaw, + &data->yaw_turn_velocity, + frame_time_sq * 6.2831855f, + frame_time_sq * 125.663704f, + frame_time * 12.566371f); + leg_walker_update(moby, + data->leg_rig_state, + frame_time * 4.0f, + data->movement_yaw, + frame_time_sq * 20.0f); if (target_distance < 4.5f) { blend_big_axebot_and_axe_animation( (char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(0xC)); @@ -675,17 +691,19 @@ void big_axebot_update(M_B7B0 *moby) { vector_quaternion_scratch[1] = fast_sin(moby->rot[2]) * 2.0f; vector_quaternion_scratch[2] = 0.0f; fast_vec_add(vector_quaternion_scratch, vector_quaternion_scratch, moby->pos); - if (point_in_path_xy(vector_quaternion_scratch, - ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { + if (point_in_path_xy( + vector_quaternion_scratch, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { data->yaw_turn_velocity = 0.0f; blend_big_axebot_and_axe_animation( (char *)moby, (void *)8, 0, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_TURN; } - if (point_in_path_xy(tpos, - ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { + if (point_in_path_xy( + tpos, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { moby->state = BIG_AXEBOT_STATE_RETURN_HOME; } } @@ -704,13 +722,16 @@ void big_axebot_update(M_B7B0 *moby) { } a = fast_arc_tan(data->home[0] - moby->pos[0], data->home[1] - moby->pos[1]); data->movement_yaw = spring_turn(moby->rot[2], - a, - &data->yaw_turn_velocity, - frame_time_sq * 6.2831855f, - frame_time_sq * 125.663704f, - frame_time * 12.566371f); - leg_walker_update( - moby, data->leg_rig_state, frame_time * 4.0f, data->movement_yaw, frame_time_sq * 20.0f); + a, + &data->yaw_turn_velocity, + frame_time_sq * 6.2831855f, + frame_time_sq * 125.663704f, + frame_time * 12.566371f); + leg_walker_update(moby, + data->leg_rig_state, + frame_time * 4.0f, + data->movement_yaw, + frame_time_sq * 20.0f); if (vector_distance_xy(moby->pos, data->home) < 2.0f) { moby->state = BIG_AXEBOT_STATE_IDLE; } @@ -719,25 +740,28 @@ void big_axebot_update(M_B7B0 *moby) { vector_quaternion_scratch[1] = fast_sin(moby->rot[2]) * 2.0f; vector_quaternion_scratch[2] = 0.0f; fast_vec_add(vector_quaternion_scratch, vector_quaternion_scratch, moby->pos); - if (point_in_path_xy(vector_quaternion_scratch, - ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { + if (point_in_path_xy( + vector_quaternion_scratch, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { data->yaw_turn_velocity = 0.0f; blend_big_axebot_and_axe_animation( (char *)moby, (void *)8, 0, (void *)scale_game_frames(0xC)); moby->state = BIG_AXEBOT_STATE_TURN; moby->behavior_flags |= 0x10; } - if (point_in_path_xy(tpos, - ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { + if (point_in_path_xy( + tpos, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_B7B0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { moby->state = BIG_AXEBOT_STATE_IDLE; } } } break; case BIG_AXEBOT_STATE_MELEE_ATTACK: - if (moby->animation_source_sequence == moby->animation_target_sequence && compute_interpolated_record_value(moby) >= 17.0f && + if (moby->animation_source_sequence == moby->animation_target_sequence && + compute_interpolated_record_value(moby) >= 17.0f && compute_interpolated_record_value(moby) < 20.0f && absolute_float(moby->pos[2] - tg.pos[2]) < 2.0f && vector_distance_xy(moby->pos, (float *)&tg) < 4.5f) { @@ -766,7 +790,8 @@ void big_axebot_update(M_B7B0 *moby) { data->idle_action_delay_timer = scale_game_frames(0x5A); blend_big_axebot_and_axe_animation( (char *)moby, - (void *)((flag ? target_distance < data->detection_range * 2.0f : target_distance < data->detection_range) + (void *)((flag ? target_distance < data->detection_range * 2.0f + : target_distance < data->detection_range) ? 0xD : 0), 0, @@ -775,14 +800,18 @@ void big_axebot_update(M_B7B0 *moby) { } break; case BIG_AXEBOT_STATE_HIT_RECOVERY: - if (!(moby->animation_target_sequence == 5 && (moby->animation_source_sequence != moby->animation_target_sequence || hd <= 13.0f))) { + if (!(moby->animation_target_sequence == 5 && + (moby->animation_source_sequence != moby->animation_target_sequence || + hd <= 13.0f))) { if (moby->behavior_flags & 4) { moby->behavior_flags &= ~4; blend_big_axebot_and_axe_animation( (char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(6)); set_big_axebot_and_axe_animation_speed(moby, 1.5f); moby->state = BIG_AXEBOT_STATE_MELEE_ATTACK; - } else if (moby->animation_target_sequence == 8 && (hd < 28.0f || moby->animation_source_sequence != moby->animation_target_sequence)) { + } else if (moby->animation_target_sequence == 8 && + (hd < 28.0f || + moby->animation_source_sequence != moby->animation_target_sequence)) { float hit_recovery_displacement_limit = frame_scale * 0.11111111f; if (data->hit_recovery_displacement < hit_recovery_displacement_limit) { @@ -790,8 +819,10 @@ void big_axebot_update(M_B7B0 *moby) { } else { data->hit_recovery_displacement = hit_recovery_displacement_limit; } - build_spherical_offset( - vector_quaternion_scratch, data->hit_recovery_displacement, data->movement_yaw, moby->rot[1]); + build_spherical_offset(vector_quaternion_scratch, + data->hit_recovery_displacement, + data->movement_yaw, + moby->rot[1]); fast_vec_add(moby->pos, moby->pos, vector_quaternion_scratch); moby->rot[2] = spring_turn(moby->rot[2], target_yaw, @@ -801,8 +832,10 @@ void big_axebot_update(M_B7B0 *moby) { frame_time * 4.1887903f); } else if (data->hit_recovery_displacement > 0.0f) { data->hit_recovery_displacement -= frame_time_sq * 200.0f; - build_spherical_offset( - vector_quaternion_scratch, data->hit_recovery_displacement, data->movement_yaw, moby->rot[1]); + build_spherical_offset(vector_quaternion_scratch, + data->hit_recovery_displacement, + data->movement_yaw, + moby->rot[1]); fast_vec_add(moby->pos, moby->pos, vector_quaternion_scratch); moby->rot[2] = spring_turn(moby->rot[2], target_yaw, @@ -904,7 +937,8 @@ void big_axebot_update(M_B7B0 *moby) { fast_dec_timer(&data->recoil_pose_cooldown_timer); build_axis_rotation_quaternion(vector_quaternion_scratch, 1, data->recoil_pitch_angle); build_axis_rotation_quaternion(data->recoil_manipulator.q, 2, 0.0f); - multiply_quaternions(data->recoil_manipulator.q, data->recoil_manipulator.q, vector_quaternion_scratch); + multiply_quaternions( + data->recoil_manipulator.q, data->recoil_manipulator.q, vector_quaternion_scratch); if (moby->state != BIG_AXEBOT_STATE_HIT_RECOVERY) { data->last_non_hit_recovery_state = moby->state; } @@ -932,10 +966,12 @@ void big_axebot_update(M_B7B0 *moby) { float bone_transform[4][4]; float bone_euler_angles[4]; { - data->tracked_aim_yaw = fast_add_rotations(data->tracked_aim_yaw, fast_subtract_rotations(moby->rot[2], rot)); + data->tracked_aim_yaw = fast_add_rotations(data->tracked_aim_yaw, + fast_subtract_rotations(moby->rot[2], rot)); build_moby_bone_transform((char *)moby, 0xC, (char *)bone_transform); matrix_to_euler(bone_transform, bone_euler_angles); - build_axis_rotation_quaternion(q, 2, fast_subtract_rotations(target_yaw, data->tracked_aim_yaw)); + build_axis_rotation_quaternion( + q, 2, fast_subtract_rotations(target_yaw, data->tracked_aim_yaw)); data->tracked_aim_yaw = target_yaw; multiply_quaternions(data->aim_manipulator.q, data->aim_manipulator.q, q); } diff --git a/src/overlays/l04/mobys/circular_saw_enemy.c b/src/overlays/l04/mobys/circular_saw_enemy.c index eb5250b3fe..dae68f7a3c 100644 --- a/src/overlays/l04/mobys/circular_saw_enemy.c +++ b/src/overlays/l04/mobys/circular_saw_enemy.c @@ -534,7 +534,10 @@ void circular_saw_enemy_update(M_35F0 *moby) { moby->f7F = 0x15; } } - select_moby_combat_target((char *)moby, (float *)&tg, flag ? data->target_detection_range * 2.0f : data->target_detection_range); + select_moby_combat_target((char *)moby, + (float *)&tg, + flag ? data->target_detection_range * 2.0f + : data->target_detection_range); target_moby = tg.f40; hd = compute_interpolated_record_value(moby); target_distance = vector_distance_xy(moby->pos, (float *)&tg); @@ -561,7 +564,8 @@ void circular_saw_enemy_update(M_35F0 *moby) { dmg = 0.0f; hit = find_moby_hit(moby, 0x210000, 0); r = hit_reaction(moby, hit, &data->hp, 0, &unused_hit_reaction_output, &dmg, 0, 4); - if (hit != 0 && moby->state != CIRCULAR_SAW_STATE_INITIALIZE && data->hit_reaction_cooldown_timer == 0) { + if (hit != 0 && moby->state != CIRCULAR_SAW_STATE_INITIALIZE && + data->hit_reaction_cooldown_timer == 0) { if (hit->att != 0) { struct Hero *h = &hero; if (hit->att != h->items[0].moby) { @@ -650,8 +654,9 @@ void circular_saw_enemy_update(M_35F0 *moby) { melee_hit_parameters.f20 = 1; collect_mobies_in_sphere(jp, 0x10, moby, &melee_hit_parameters, 0.5f); if (coll_hit.moby == target_moby) { - data->action_timer = - data->action_timer < scale_game_frames(0x3C) ? data->action_timer : scale_game_frames(0x3C); + data->action_timer = data->action_timer < scale_game_frames(0x3C) + ? data->action_timer + : scale_game_frames(0x3C); } } } @@ -712,20 +717,23 @@ void circular_saw_enemy_update(M_35F0 *moby) { qcopy(save, moby->pos); update_object_wander_movement((char *)moby, (char *)data->f240, 0.35f, 0.25f); if (data->movement_boundary_path_index != -1) { - if (point_in_path_xy(moby->pos, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { + if (point_in_path_xy( + moby->pos, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) == 0) { qcopy(moby->pos, save); } } if (moby->f52 != 0 && (moby->f70 & 2)) { blend_moby_animation(moby, 0, 0, (void *)scale_game_frames(5)); } - if (flag ? target_distance < data->target_detection_range * 2.0f : target_distance < data->target_detection_range) { + if (flag ? target_distance < data->target_detection_range * 2.0f + : target_distance < data->target_detection_range) { if (flag || data->movement_boundary_path_index == -1 || - point_in_path_xy(&tg, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { + point_in_path_xy( + &tg, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { int nf = (data->combat_history_flags & 1) == 0; if (nf) { data->combat_history_flags |= 1; @@ -761,13 +769,17 @@ void circular_saw_enemy_update(M_35F0 *moby) { } break; case CIRCULAR_SAW_STATE_CHASE_TARGET: - if ((flag ? target_distance < data->target_detection_range * 2.0f : target_distance < data->target_detection_range) && + if ((flag ? target_distance < data->target_detection_range * 2.0f + : target_distance < data->target_detection_range) && (flag || data->movement_boundary_path_index == -1 || point_in_path_xy(&tg, ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0)) { - rot = compute_circular_saw_flock_steering( - moby, dest, flag ? data->target_detection_range * 2.0f : data->target_detection_range); + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != + 0)) { + rot = compute_circular_saw_flock_steering(moby, + dest, + flag ? data->target_detection_range * 2.0f + : data->target_detection_range); if (target_distance < 2.0f && data->action_timer == 0 && check_circular_saw_melee_attack_spacing((char *)moby) != 0) { blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10)); @@ -793,11 +805,13 @@ void circular_saw_enemy_update(M_35F0 *moby) { int i; float *yaw_velocity; - if (flag ? target_distance < data->target_detection_range * 2.0f : target_distance < data->target_detection_range) { + if (flag ? target_distance < data->target_detection_range * 2.0f + : target_distance < data->target_detection_range) { if (flag || data->movement_boundary_path_index == -1 || - point_in_path_xy(&tg, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { + point_in_path_xy( + &tg, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { int nf = (data->combat_history_flags & 1) == 0; if (nf) { data->combat_history_flags |= 1; @@ -857,11 +871,13 @@ void circular_saw_enemy_update(M_35F0 *moby) { case CIRCULAR_SAW_STATE_POINT_ATTACK: { P_35F0 *path = ((P_35F0 *)l04_paths[data->patrol_path_index]); - if (flag ? target_distance < data->target_detection_range * 2.0f : target_distance < data->target_detection_range) { + if (flag ? target_distance < data->target_detection_range * 2.0f + : target_distance < data->target_detection_range) { if (flag || data->movement_boundary_path_index == -1 || - point_in_path_xy(&tg, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { + point_in_path_xy( + &tg, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { int nf = (data->combat_history_flags & 1) == 0; if (nf) { data->combat_history_flags |= 1; @@ -940,8 +956,8 @@ void circular_saw_enemy_update(M_35F0 *moby) { break; } case CIRCULAR_SAW_STATE_MELEE_ATTACK: - rot = - compute_circular_saw_flock_steering(moby, dest, flag ? data->target_detection_range * 2.0f : data->target_detection_range); + rot = compute_circular_saw_flock_steering( + moby, dest, flag ? data->target_detection_range * 2.0f : data->target_detection_range); if (data->action_timer == 0 && (hd > 44.0f || (moby->f70 & 2))) { blend_moby_animation(moby, 0, 0, (void *)scale_game_frames(5)); data->action_timer = scale_game_frames(0x78); @@ -1006,9 +1022,10 @@ void circular_saw_enemy_update(M_35F0 *moby) { qcopy(np, moby->pos); move_moby_xy_with_collision_constraints(moby, np, v, 0, 0.25f, 0.57f, 0.5f, 0.5235988f); if (data->movement_boundary_path_index == -1 || - point_in_path_xy(np, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { + point_in_path_xy( + np, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { qcopy(moby->pos, np); } } @@ -1031,11 +1048,12 @@ void circular_saw_enemy_update(M_35F0 *moby) { fast_normalize_angle(fast_normalize_angle( convert_integer_to_float(data->movement_direction_index) * 1.5707964f)), rel) > 1.7453293f) { - data->movement_direction_index = truncate_float_to_s32(biased_relative_yaw * 1.999f / 3.1415927f); + data->movement_direction_index = + truncate_float_to_s32(biased_relative_yaw * 1.999f / 3.1415927f); anim = movement_animation_by_direction.v[data->movement_direction_index]; } - movement_relative_yaw = - fast_normalize_angle(convert_integer_to_float(data->movement_direction_index) * 1.5707964f); + movement_relative_yaw = fast_normalize_angle( + convert_integer_to_float(data->movement_direction_index) * 1.5707964f); v[0] = fast_cos(fast_add_rotations(moby->rot, movement_relative_yaw)) * (frame_time * 3.0f); v[1] = fast_sin(fast_add_rotations(moby->rot, movement_relative_yaw)) * @@ -1050,9 +1068,10 @@ void circular_saw_enemy_update(M_35F0 *moby) { moved = move_moby_xy_with_collision_constraints( moby, np, v, 0, 0.25f, 0.57f, 0.5f, 0.5235988f); if (data->movement_boundary_path_index == -1 || - point_in_path_xy(np, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { + point_in_path_xy( + np, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { qcopy(moby->pos, np); if (moved == 0) { anim = 0; @@ -1060,7 +1079,8 @@ void circular_saw_enemy_update(M_35F0 *moby) { } else { anim = 0; } - if (fast_dec_timer_s16(&data->movement_animation_change_timer) != 0 && anim != moby->f53) { + if (fast_dec_timer_s16(&data->movement_animation_change_timer) != 0 && + anim != moby->f53) { blend_moby_animation(moby, (void *)anim, 0, (void *)scale_game_frames(10)); data->movement_animation_change_timer = scale_game_frames(0xF); } @@ -1081,9 +1101,10 @@ void circular_saw_enemy_update(M_35F0 *moby) { move_moby_xy_with_collision_constraints( moby, np, v, 0, 0.25f, 1.25f, 0.5f, 0.5235988f); if (data->movement_boundary_path_index == -1 || - point_in_path_xy(np, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, - ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { + point_in_path_xy( + np, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->pts, + ((P_35F0 *)l04_paths[data->movement_boundary_path_index])->count) != 0) { qcopy(moby->pos, np); } } diff --git a/src/overlays/l04/mobys/snow_plow.c b/src/overlays/l04/mobys/snow_plow.c index 60c95d6754..ab69bf61b7 100644 --- a/src/overlays/l04/mobys/snow_plow.c +++ b/src/overlays/l04/mobys/snow_plow.c @@ -204,13 +204,17 @@ void snow_plow_update(struct Moby *moby) { frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); - if (vector_distance_xy(&moby->pos, &l04_cuboids[snow_plow_vars->selected_clip_volume_index].pos) < 1.0f && + if (vector_distance_xy(&moby->pos, + &l04_cuboids[snow_plow_vars->selected_clip_volume_index].pos) < + 1.0f && fast_difference_between_rotations( - moby->rot.z, l04_cuboids[snow_plow_vars->selected_clip_volume_index].rot.z) < 0.17453292f) { + moby->rot.z, l04_cuboids[snow_plow_vars->selected_clip_volume_index].rot.z) < + 0.17453292f) { snow_plow_vars->clip_volume_movement_state = SNOW_PLOW_WAIT_BEFORE_RETURN; snow_plow_vars->clip_volume_movement_timer = scale_game_frames(300); } - fast_vec_sub(&delta, &l04_cuboids[snow_plow_vars->selected_clip_volume_index].pos, &moby->pos); + fast_vec_sub( + &delta, &l04_cuboids[snow_plow_vars->selected_clip_volume_index].pos, &moby->pos); fast_vec_normalize(&delta, &delta, frame_time * 3.0f); fast_vec_add(&moby->pos, &moby->pos, &delta); break; @@ -228,8 +232,8 @@ void snow_plow_update(struct Moby *moby) { frame_time_sq * 3.1415927f, frame_time * 3.1415927f); if (vector_distance_xy(&moby->pos, snow_plow_vars->saved_return_position) < 1.0f && - fast_difference_between_rotations(moby->rot.z, snow_plow_vars->saved_return_heading) < - 0.034906585f) { + fast_difference_between_rotations( + moby->rot.z, snow_plow_vars->saved_return_heading) < 0.034906585f) { snow_plow_vars->clip_volume_movement_state = SNOW_PLOW_SCAN_CLIP_VOLUMES; snow_plow_vars->clip_volume_movement_timer = scale_game_frames(600); snow_plow_vars->unkFC = amount; @@ -302,7 +306,8 @@ void snow_plow_update(struct Moby *moby) { } } if (snow_plow_vars->linked_moby_index != -1) { - struct Moby *other = (struct Moby *)(D_L04_0015FFD8 + (snow_plow_vars->linked_moby_index << 8)); + struct Moby *other = + (struct Moby *)(D_L04_0015FFD8 + (snow_plow_vars->linked_moby_index << 8)); other->draw_dist = 0x7f; switch (moby->oclass) { case SNOW_PLOW_CLASS_WITH_QUARTER_TURN_LINKED_MOBY: @@ -741,7 +746,8 @@ void snow_plow_update(struct Moby *moby) { moby->collision = 0; moby->flags |= 0x41; if (snow_plow_vars->linked_moby_index != -1) { - struct Moby *other = (struct Moby *)(D_L04_0015FFD8 + (snow_plow_vars->linked_moby_index << 8)); + struct Moby *other = + (struct Moby *)(D_L04_0015FFD8 + (snow_plow_vars->linked_moby_index << 8)); other->flags |= 0x41; } moby->flags &= 0xefff; diff --git a/src/overlays/l04/mobys/woodcut_bot.c b/src/overlays/l04/mobys/woodcut_bot.c index 3a1dc98dc3..113e165225 100644 --- a/src/overlays/l04/mobys/woodcut_bot.c +++ b/src/overlays/l04/mobys/woodcut_bot.c @@ -363,7 +363,10 @@ void woodcut_bot_update(WBMoby *m) { if (d->pending_excitement != 0 || d->t3C6 != 0) excited = 1; - select_moby_combat_target(m, selected_target_position, excited ? d->target_engagement_range * 2.0f : d->target_engagement_range); + select_moby_combat_target(m, + selected_target_position, + excited ? d->target_engagement_range * 2.0f + : d->target_engagement_range); p = &d->manipulator_slot_index; FUN_L00_00263ac8(2.5f, m, 6, p); manipulator = p; @@ -554,7 +557,8 @@ void woodcut_bot_update(WBMoby *m) { break; case WOODCUT_BOT_IDLE: if (m->f70 & 2) { - if (excited ? (d->target_engagement_range * 2.0f < target_distance) : (d->target_engagement_range < target_distance)) { + if (excited ? (d->target_engagement_range * 2.0f < target_distance) + : (d->target_engagement_range < target_distance)) { int anims[6]; memset(anims, 0, 0x18); @@ -568,7 +572,8 @@ void woodcut_bot_update(WBMoby *m) { if (target_distance < 3.0f && adiff < 1.5707964f) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_MELEE_ATTACK; - } else if (excited ? (target_distance < d->target_engagement_range * 2.0f) : (target_distance < d->target_engagement_range)) { + } else if (excited ? (target_distance < d->target_engagement_range * 2.0f) + : (target_distance < d->target_engagement_range)) { if (m->fBC & 1) { if (excited || d->movement_path_index == -1 || point_in_path_xy(selected_target_position, @@ -588,9 +593,10 @@ void woodcut_bot_update(WBMoby *m) { if (!excited) { if (vector_distance_xy(pos, d->initial_position) > 2.0f) { if (d->target_engagement_range < target_distance || - (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)) { + (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_RETURN_TO_SAVED_POSITION; m->fBC |= 8; } @@ -653,7 +659,8 @@ void woodcut_bot_update(WBMoby *m) { if (target_distance < 3.0f && adiff < 1.5707964f) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); m->state = WOODCUT_BOT_MELEE_ATTACK; - } else if (excited ? (target_distance < d->target_engagement_range * 2.0f) : (target_distance < d->target_engagement_range)) { + } else if (excited ? (target_distance < d->target_engagement_range * 2.0f) + : (target_distance < d->target_engagement_range)) { if (m->fBC & 1) { if (excited || d->movement_path_index == -1 || point_in_path_xy(selected_target_position, @@ -679,9 +686,10 @@ void woodcut_bot_update(WBMoby *m) { blend_moby_animation(m, 4, 0, scale_game_frames(10)); reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_MELEE_ATTACK; - } else if (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) { + } else if (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; } else if (adiff > 1.5707964f) { @@ -717,8 +725,9 @@ void woodcut_bot_update(WBMoby *m) { v[2] = 0.0f; p = (unsigned char *)v; fast_vec_add(p, p, pos); - if (point_in_path_xy( - p, ((int *)l04_paths[d->movement_path_index]) + 4, *((int *)l04_paths[d->movement_path_index])) == 0) { + if (point_in_path_xy(p, + ((int *)l04_paths[d->movement_path_index]) + 4, + *((int *)l04_paths[d->movement_path_index])) == 0) { if (excited && point_in_path_xy(selected_target_position, ((int *)l04_paths[d->movement_path_index]) + 4, *((int *)l04_paths[d->movement_path_index])) == 0) { @@ -762,7 +771,8 @@ void woodcut_bot_update(WBMoby *m) { leg_walker_update(m, d->leg_rig_movement_data, frame_time * 4.0f, - fast_arc_tan(d->initial_position[0] - m->pos[0], d->initial_position[1] - m->pos[1]), + fast_arc_tan(d->initial_position[0] - m->pos[0], + d->initial_position[1] - m->pos[1]), frame_time_sq * 20.0f); if (d->movement_path_index != -1) { float v[4]; @@ -794,7 +804,8 @@ void woodcut_bot_update(WBMoby *m) { reset_walker_gait_helpers(d->leg_rig_movement_data); m->state = WOODCUT_BOT_MELEE_ATTACK; } else { - leg_walker_update(m, d->leg_rig_movement_data, frame_time * 0.0f, m->rot[2], frame_time_sq * 20.0f); + 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 (excited) { m->state = WOODCUT_BOT_SELECT_ACTION_WHILE_EXCITED; @@ -909,9 +920,10 @@ void woodcut_bot_update(WBMoby *m) { break; case WOODCUT_BOT_TURN_BEFORE_MOVEMENT: if (m->anim == 0x10 && (m->f70 & 2)) { - if ((m->fBC & 0x10) || point_in_path_xy(selected_target_position, - ((int *)l04_paths[d->movement_path_index]) + 4, - *((int *)l04_paths[d->movement_path_index])) == 0) { + if ((m->fBC & 0x10) || + 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_RETURN_TO_SAVED_POSITION; blend_moby_animation(m, 0, 0, scale_game_frames(10)); } else { @@ -921,7 +933,8 @@ void woodcut_bot_update(WBMoby *m) { m->fBC = (m->fBC | 8) & ~0x10; } else if (m->fBC & 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]), + fast_arc_tan(d->initial_position[0] - m->pos[0], + d->initial_position[1] - m->pos[1]), &d->yaw_turn_spring_state, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, 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 6651ba8495..58564cc06a 100644 --- a/src/overlays/l05/hero/apply_hero_ground_material_effects.c +++ b/src/overlays/l05/hero/apply_hero_ground_material_effects.c @@ -258,7 +258,8 @@ void update_hero_ground_contact(void) { hero.sink_surface_z = D_L05_00174268; goto d1; } - if (hero.ground_type == GROUND_MATERIAL_STATE_DEPENDENT_CONTACT_BYPASS && (u32)(hero.state.current - 0x7C) < 2) { + if (hero.ground_type == GROUND_MATERIAL_STATE_DEPENDENT_CONTACT_BYPASS && + (u32)(hero.state.current - 0x7C) < 2) { goto d1; } if (HH.moby != 0) { diff --git a/src/overlays/l05/hero/hero_set_state.c b/src/overlays/l05/hero/hero_set_state.c index 03f6608ca9..165e95256b 100644 --- a/src/overlays/l05/hero/hero_set_state.c +++ b/src/overlays/l05/hero/hero_set_state.c @@ -91,10 +91,12 @@ int hero_set_state(int requested_state, int animation_request_mode) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_request_mode != HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || + animation_request_mode != HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE)) return 0; } - if ((D_L05_0015F5C4 == 2 || D_L05_0015F5C4 == 6) && animation_request_mode != HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE) + if ((D_L05_0015F5C4 == 2 || D_L05_0015F5C4 == 6) && + animation_request_mode != HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l05/mobys/drain_cover.c b/src/overlays/l05/mobys/drain_cover.c index 02f278bbd0..5a9559ccb4 100644 --- a/src/overlays/l05/mobys/drain_cover.c +++ b/src/overlays/l05/mobys/drain_cover.c @@ -234,8 +234,10 @@ void drain_cover_update(DrainCoverMoby *moby) { qcopy(drain_cover_data->home, moby->pos); drain_cover_data->tilt_x_phase = random_angle_radians(); drain_cover_data->tilt_y_phase = random_angle_radians(); - drain_cover_data->tilt_x_phase_increment = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; - drain_cover_data->tilt_y_phase_increment = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; + drain_cover_data->tilt_x_phase_increment = + randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; + drain_cover_data->tilt_y_phase_increment = + randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; minimum_rise_height = drain_cover_data->hover_height_above_home + 1.0f; if (drain_cover_data->rise_height <= minimum_rise_height) { drain_cover_data->rise_height = minimum_rise_height; @@ -316,7 +318,8 @@ void drain_cover_update(DrainCoverMoby *moby) { if (drain_cover_data->vel[2] <= 0.0f) { moby->state = DRAIN_COVER_HOVER; drain_cover_data->home[3] = drain_cover_data->hover_height_above_home - 0.5f; - drain_cover_data->timer = truncate_float_to_s32(scale_time(drain_cover_data->hover_duration)); + drain_cover_data->timer = + truncate_float_to_s32(scale_time(drain_cover_data->hover_duration)); } break; case DRAIN_COVER_HOVER: @@ -359,8 +362,10 @@ void drain_cover_update(DrainCoverMoby *moby) { qcopy(moby->pos, drain_cover_data->home); drain_cover_data->tilt_x_phase = random_angle_radians(); drain_cover_data->tilt_y_phase = random_angle_radians(); - drain_cover_data->tilt_x_phase_increment = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; - drain_cover_data->tilt_y_phase_increment = randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; + drain_cover_data->tilt_x_phase_increment = + randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; + drain_cover_data->tilt_y_phase_increment = + randf_sym(70.0f, 120.0f) * 0.017453292f * frame_time; } break; } @@ -514,7 +519,8 @@ void update_drain_cover_tilt(char *moby, float turn_scale, float speed_scale) { rate0 = drain_cover_tilt_acceleration_gp * speed_scale * 0.017453292f * frame_time_sq; rate1 = drain_cover_tilt_deceleration_gp * speed_scale * 0.017453292f * frame_time_sq; limit = drain_cover_tilt_max_speed_gp * 0.017453292f * frame_time; - approach_angle(&MOBY(moby)->rot.x, target0, &drain_cover_vars->tilt_x_velocity, rate0, rate1, limit); + approach_angle( + &MOBY(moby)->rot.x, target0, &drain_cover_vars->tilt_x_velocity, rate0, rate1, limit); approach_angle(&MOBY(moby)->rot.y, target1, &drain_cover_vars->unk94, diff --git a/src/overlays/l05/mobys/elevator_with_button.c b/src/overlays/l05/mobys/elevator_with_button.c index bd1f8076d6..7630df9da8 100644 --- a/src/overlays/l05/mobys/elevator_with_button.c +++ b/src/overlays/l05/mobys/elevator_with_button.c @@ -263,7 +263,9 @@ extern short lift_camera_height_offset_gp __asm__("D_L05_00161EC0") __attribute_ extern short lift_camera_pitch_degrees_gp __asm__("D_L05_00161EC4") __attribute__((sda)); extern short lift_camera_distance_along_facing_gp __asm__("D_L05_00161EC8") __attribute__((sda)); -void compute_lift_camera_view(char *lift_moby, char *camera_position, char *camera_rotation) __asm__("FUN_L05_00315ee0"); +void compute_lift_camera_view(char *lift_moby, + char *camera_position, + char *camera_rotation) __asm__("FUN_L05_00315ee0"); void compute_lift_camera_view(char *lift_moby, char *camera_position, char *camera_rotation) { float pitch_degrees; diff --git a/src/overlays/l05/mobys/extermibot.c b/src/overlays/l05/mobys/extermibot.c index 3a4a610a18..077a88fb6f 100644 --- a/src/overlays/l05/mobys/extermibot.c +++ b/src/overlays/l05/mobys/extermibot.c @@ -237,7 +237,8 @@ void extermibot_update(unsigned char *moby) { path_goal_or_facing_vector, (D_L05_00161A98) * 0.4f) != 0) { if (random_integer_below(0x100) & 1) { - moby_data->path_heading_offset_degrees = -moby_data->path_heading_offset_degrees; + moby_data->path_heading_offset_degrees = + -moby_data->path_heading_offset_degrees; } moby_data->unk294 = moby_data->path_heading_offset_degrees * 0.017453292f; moby_data->unk2AC = scale_game_frames((int)random_float_between(30.0f, 90.0f)); @@ -248,7 +249,8 @@ void extermibot_update(unsigned char *moby) { moby_data->mode = EXTERMIBOT_TARGET_PATH_UNAVAILABLE; } } - if (moby_data->mode == EXTERMIBOT_TARGET_PATH_UNAVAILABLE && moby_data->target_pursuit_timer != 0) { + if (moby_data->mode == EXTERMIBOT_TARGET_PATH_UNAVAILABLE && + moby_data->target_pursuit_timer != 0) { MOBY(moby)->state = EXTERMIBOT_APPROACH_TARGET_DIRECTLY; if (MOBY(moby)->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(10)); @@ -368,9 +370,11 @@ void extermibot_update(unsigned char *moby) { break; case EXTERMIBOT_WAIT_FOR_ACTIVATION_TRIGGER: if ((moby_data->activation_moby_index != -1 && - ((unsigned char *)*(int *)&D_L05_0015FFD8)[moby_data->activation_moby_index * 256 + 0xBC] != 0) || + ((unsigned char *)*( + int *)&D_L05_0015FFD8)[moby_data->activation_moby_index * 256 + 0xBC] != 0) || (moby_data->activation_clip_volume_index != -1 && - is_point_inside_clip_volume(((char *)D_0013F3D0), moby_data->activation_clip_volume_index) != 0)) { + is_point_inside_clip_volume(((char *)D_0013F3D0), + moby_data->activation_clip_volume_index) != 0)) { MOBY(moby)->draw_dist = 0x40; MOBY(moby)->flags |= 0x1000; MOBY(moby)->state = EXTERMIBOT_IDLE_AND_CHECK_TARGET_PATH; @@ -832,14 +836,18 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { case EXTERMIBOT_HIT_START_NONLETHAL_KNOCKBACK_AND_FLASH: case EXTERMIBOT_HIT_START_KNOCKBACK_WITH_FLASH: moby_data->knockback_apex_animation_target = 5.0f; - moby_data->knockback_xy_magnitude = extermibot_nonlethal_knockback_xy_scale_gp * D_0015ED6C; - moby_data->knockback_z_magnitude = extermibot_nonlethal_knockback_z_scale_gp * D_0015ED6C; + moby_data->knockback_xy_magnitude = + extermibot_nonlethal_knockback_xy_scale_gp * D_0015ED6C; + moby_data->knockback_z_magnitude = + extermibot_nonlethal_knockback_z_scale_gp * D_0015ED6C; moby_data->knockback_landing_animation_target = 10.0f; nonlethal_knockback_heading = fast_arc_tan(moby->pos.x - hit_record->who->pos.x, moby->pos.y - hit_record->who->pos.y); *(u128_3047E8 *)working_vector = hit_record->dir; - trooper_knockback_arc( - working_vector, &nonlethal_knockback_heading, &moby_data->knockback_xy_magnitude, &moby_data->knockback_z_magnitude); + trooper_knockback_arc(working_vector, + &nonlethal_knockback_heading, + &moby_data->knockback_xy_magnitude, + &moby_data->knockback_z_magnitude); trooper_start_knockback(moby, moby_data->f70, nonlethal_knockback_heading, 5, 1, 0); moby->state = EXTERMIBOT_NONLETHAL_KNOCKBACK; moby_data->hit_flash_target = 0x78; @@ -855,8 +863,10 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { death_knockback_heading = fast_arc_tan(moby->pos.x - hit_record->who->pos.x, moby->pos.y - hit_record->who->pos.y); *(u128_3047E8 *)working_vector = hit_record->dir; - trooper_knockback_arc( - working_vector, &death_knockback_heading, &moby_data->knockback_xy_magnitude, &moby_data->knockback_z_magnitude); + trooper_knockback_arc(working_vector, + &death_knockback_heading, + &moby_data->knockback_xy_magnitude, + &moby_data->knockback_z_magnitude); trooper_start_knockback(moby, moby_data->f70, death_knockback_heading, 6, 1, 0); moby->state = EXTERMIBOT_DEATH_KNOCKBACK; moby_data->hit_flash_target = 0xF0; @@ -873,7 +883,8 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { moby->hit_slot = 0xFF; trooper_anim_finish(moby, moby_data->f60); if (moby_data->targeting_range_boost_pending != 0) { - moby_data->targeting_range_boost_timer = truncate_float_to_s32(scale_time(random_float_between(180.0f, 240.0f))); + moby_data->targeting_range_boost_timer = + truncate_float_to_s32(scale_time(random_float_between(180.0f, 240.0f))); moby_data->targeting_range_boost_pending = 0; } fast_dec_timer(&moby_data->targeting_range_boost_timer); @@ -889,7 +900,9 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { 0, ((Path_3047E8 *)l05_paths[moby_data->targeting_path_index])->pts, ((Path_3047E8 *)l05_paths[moby_data->targeting_path_index])->n) != 2) { - if (moby_data->effective_targeting_range < vector_distance_xy(moby_data->start_position, moby_data->selected_target_position_xy) || + if (moby_data->effective_targeting_range < + vector_distance_xy(moby_data->start_position, + moby_data->selected_target_position_xy) || 3.0f < func_001F9B88_3047E8(moby->pos.z - moby_data->selected_target_position_z)) { moby_data->target_selection_status = EXTERMIBOT_TARGET_PATH_UNAVAILABLE; } @@ -908,9 +921,12 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { if (moby_data->target == 0) { moby_data->target = (*(Moby **)D_001413D0_lui); } - moby_data->glow_pulse_phase = fast_add_rotations(moby_data->glow_pulse_phase, D_0015ED6C * 9.424778f); - moby->glow_color = fast_tween_color( - l05_extermibot_glow_color_start, l05_extermibot_glow_color_end, (func_001F9FA8_3047E8(moby_data->glow_pulse_phase) + 1.0f) * 0.5f); + moby_data->glow_pulse_phase = + fast_add_rotations(moby_data->glow_pulse_phase, D_0015ED6C * 9.424778f); + moby->glow_color = + fast_tween_color(l05_extermibot_glow_color_start, + l05_extermibot_glow_color_end, + (func_001F9FA8_3047E8(moby_data->glow_pulse_phase) + 1.0f) * 0.5f); k = moby->state; if (k < 10) { if (k >= 4 && moby_data->target == (*(Moby **)D_001413D0_lui)) { @@ -938,8 +954,10 @@ void handle_extermibot_hits_and_update_targeting(Moby *moby) { moby_data->second_joint_target_yaw = yaw * 0.3f; } } - update_joint_animation(moby, moby_data->first_joint_animation, 1, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f); - update_joint_animation(moby, moby_data->second_joint_animation, 2, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f); + update_joint_animation( + moby, moby_data->first_joint_animation, 1, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f); + update_joint_animation( + moby, moby_data->second_joint_animation, 2, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f); } extern int frame_number __asm__("D_L05_0015F5CC"); diff --git a/src/overlays/l05/mobys/extermitank.c b/src/overlays/l05/mobys/extermitank.c index cc8e4b2d0a..a66659a6d8 100644 --- a/src/overlays/l05/mobys/extermitank.c +++ b/src/overlays/l05/mobys/extermitank.c @@ -299,7 +299,8 @@ void extermitank_update(unsigned char *moby) { char *g = ((char *)&D_0013F350); float a = fast_arc_tan(*(float *)(g + 0x80) - MOBY(moby)->pos.x, *(float *)(g + 0x84) - MOBY(moby)->pos.y); - step_angle_toward_target(&extermitank_vars->turret_yaw, 0, a, D_0015ED6C_gp * 1.5707964f); + step_angle_toward_target( + &extermitank_vars->turret_yaw, 0, a, D_0015ED6C_gp * 1.5707964f); step_angle_toward_target( &extermitank_vars->turret_pitch, 0, 0.08726646f, D_0015ED6C_gp * 1.5707964f); } else { @@ -478,7 +479,8 @@ void extermitank_update(unsigned char *moby) { char *g = ((char *)&D_0013F350); float a = fast_arc_tan(*(float *)(g + 0x80) - MOBY(moby)->pos.x, *(float *)(g + 0x84) - MOBY(moby)->pos.y); - step_angle_toward_target(&extermitank_vars->turret_yaw, 0, a, D_0015ED6C_gp * 1.5707964f); + step_angle_toward_target( + &extermitank_vars->turret_yaw, 0, a, D_0015ED6C_gp * 1.5707964f); step_angle_toward_target( &extermitank_vars->turret_pitch, 0, 0.08726646f, D_0015ED6C_gp * 1.5707964f); } @@ -650,7 +652,8 @@ void handle_extermitank_hits_and_sync_children(char *moby) { 1, -1, 0); - extermitank_hit_sync_vars->removal_scaled_frames = scale_game_frames(l05_extermitank_removal_base_frames); + extermitank_hit_sync_vars->removal_scaled_frames = + scale_game_frames(l05_extermitank_removal_base_frames); MOBY(moby)->state = EXTERMITANK_REMOVE; clear_u64_value(effect_data); *(float *)(effect_data + 8) = extermitank_hit_sync_vars->turret_yaw; @@ -745,7 +748,8 @@ void handle_extermitank_hits_and_sync_children(char *moby) { ((unsigned char *)extermitank_hit_sync_vars->unk184)[0xa4] = 0xff; if (extermitank_hit_sync_vars->unk188 != 0) ((unsigned char *)extermitank_hit_sync_vars->unk188)[0xa4] = 0xff; - if (extermitank_hit_sync_vars->unk38 != 0 && extermitank_hit_sync_vars->firing_range_timer == 0) { + if (extermitank_hit_sync_vars->unk38 != 0 && + extermitank_hit_sync_vars->firing_range_timer == 0) { extermitank_hit_sync_vars->firing_range_timer = scale_game_frames(0xf0); extermitank_hit_sync_vars->unk38 = 0; hero_turn_reference = &hero; diff --git a/src/overlays/l05/mobys/scenery_ship.c b/src/overlays/l05/mobys/scenery_ship.c index 98bb215e2a..fd855906d8 100644 --- a/src/overlays/l05/mobys/scenery_ship.c +++ b/src/overlays/l05/mobys/scenery_ship.c @@ -244,7 +244,8 @@ void scenery_ship_update(char *moby) { scenery_ship_instance_vars->fC = fast_vec_dist((float *)(path + 0x10), (float *)(path + 0x20)); MOBY(moby)->state = SCENERY_SHIP_FOLLOW_PATH; - scenery_ship_instance_vars->path_sample_position = (float)*(int *)path * scenery_ship_instance_vars->f4; + scenery_ship_instance_vars->path_sample_position = + (float)*(int *)path * scenery_ship_instance_vars->f4; break; } case SCENERY_SHIP_FOLLOW_PATH: { @@ -253,15 +254,19 @@ void scenery_ship_update(char *moby) { float wave; scenery_ship_instance_vars->f1C = phase; wave = func_001F9FA8_2D8388(phase); - MOBY(moby)->glow_color = - func_001FA8A8_2D8388(l05_scenery_ship_glow_pulse_start_color, l05_scenery_ship_glow_pulse_end_color, (wave + 1.0f) * 0.5f); + MOBY(moby)->glow_color = func_001FA8A8_2D8388(l05_scenery_ship_glow_pulse_start_color, + l05_scenery_ship_glow_pulse_end_color, + (wave + 1.0f) * 0.5f); advance_scenery_ship_along_path(moby, (int *)l05_paths[scenery_ship_instance_vars->path]); if (voice_is_playing(moby, scenery_ship_instance_vars->voice_slot_index) == 0) { - scenery_ship_instance_vars->voice_slot_index = allocate_voice_for_target_entry(1, 4, (int)moby); + scenery_ship_instance_vars->voice_slot_index = + allocate_voice_for_target_entry(1, 4, (int)moby); } if ((frame_number & 3) == 0) { - scenery_ship_instance_vars->trail_write_index = (scenery_ship_instance_vars->trail_write_index + 1) & 0xF; - if ((float)scenery_ship_instance_vars->trail_segment_count < l05_scenery_ship_trail_segment_limit) { + scenery_ship_instance_vars->trail_write_index = + (scenery_ship_instance_vars->trail_write_index + 1) & 0xF; + if ((float)scenery_ship_instance_vars->trail_segment_count < + l05_scenery_ship_trail_segment_limit) { scenery_ship_instance_vars->trail_segment_count++; } } @@ -270,30 +275,33 @@ void scenery_ship_update(char *moby) { left_offset.f[1] = 0.4f; left_offset.f[2] = 0.45f; transform_vector_by_basis(&left_offset, &left_offset, moby + 0xC0); - func_001F9BD8_2D8388( - (float *)&scenery_ship_instance_vars->trail[0][(short)scenery_ship_instance_vars->trail_write_index], - left_offset.f, - (float *)&MOBY(moby)->pos); - scenery_ship_instance_vars->trail[0][(short)scenery_ship_instance_vars->trail_write_index].w = 1.0f; + func_001F9BD8_2D8388((float *)&scenery_ship_instance_vars + ->trail[0][(short)scenery_ship_instance_vars->trail_write_index], + left_offset.f, + (float *)&MOBY(moby)->pos); + scenery_ship_instance_vars->trail[0][(short)scenery_ship_instance_vars->trail_write_index] + .w = 1.0f; tail_offset.q = 0; tail_offset.f[0] = -1.5f; tail_offset.f[2] = -0.3f; transform_vector_by_basis(&tail_offset, &tail_offset, moby + 0xC0); - func_001F9BD8_2D8388( - (float *)&scenery_ship_instance_vars->trail[1][(short)scenery_ship_instance_vars->trail_write_index], - tail_offset.f, - (float *)&MOBY(moby)->pos); - scenery_ship_instance_vars->trail[1][(short)scenery_ship_instance_vars->trail_write_index].w = 1.0f; + func_001F9BD8_2D8388((float *)&scenery_ship_instance_vars + ->trail[1][(short)scenery_ship_instance_vars->trail_write_index], + tail_offset.f, + (float *)&MOBY(moby)->pos); + scenery_ship_instance_vars->trail[1][(short)scenery_ship_instance_vars->trail_write_index] + .w = 1.0f; right_offset.q = 0; right_offset.f[0] = -1.2f; right_offset.f[1] = -0.4f; right_offset.f[2] = 0.45f; transform_vector_by_basis(&right_offset, &right_offset, moby + 0xC0); - func_001F9BD8_2D8388( - (float *)&scenery_ship_instance_vars->trail[2][(short)scenery_ship_instance_vars->trail_write_index], - right_offset.f, - (float *)&MOBY(moby)->pos); - scenery_ship_instance_vars->trail[2][(short)scenery_ship_instance_vars->trail_write_index].w = 1.0f; + func_001F9BD8_2D8388((float *)&scenery_ship_instance_vars + ->trail[2][(short)scenery_ship_instance_vars->trail_write_index], + right_offset.f, + (float *)&MOBY(moby)->pos); + scenery_ship_instance_vars->trail[2][(short)scenery_ship_instance_vars->trail_write_index] + .w = 1.0f; if (frame_number != *scenery_ship_instance_vars->trail_last_queued_frame_ptr) { *scenery_ship_instance_vars->trail_last_queued_frame_ptr = frame_number; add_draw_callback(func_L05_002D8B68_2D8388, moby); @@ -438,19 +446,24 @@ void draw_group_scenery_ship_trails(struct Moby *moby) { glow_packet->effect_texture = texture; glow_packet->texture = 0xff9000000260ULL; glow_packet->zero = 0; - glow_packet->flags = (u64)l05_scenery_ship_trail_blend_a_selector | ((u64)l05_scenery_ship_trail_blend_b_selector << 2) | - ((u64)l05_scenery_ship_trail_blend_c_selector << 4) | ((u64)l05_scenery_ship_trail_blend_d_selector << 6) | - 0x8000000000ULL; - phase = convert_integer_to_float((frame_number + 3) & 3) / (l05_scenery_ship_trail_segment_limit * 4.0f); + glow_packet->flags = (u64)l05_scenery_ship_trail_blend_a_selector | + ((u64)l05_scenery_ship_trail_blend_b_selector << 2) | + ((u64)l05_scenery_ship_trail_blend_c_selector << 4) | + ((u64)l05_scenery_ship_trail_blend_d_selector << 6) | 0x8000000000ULL; + phase = convert_integer_to_float((frame_number + 3) & 3) / + (l05_scenery_ship_trail_segment_limit * 4.0f); for (j = 0; j < 4; j++) { packet[i].uv[j][0] = D_L05_001CDD70[j][0]; packet[i].uv[j][1] = D_L05_001CDD70[j][1]; - ratio = convert_integer_to_float(i + 1 - (j >> 1)) / (l05_scenery_ship_trail_segment_limit + phase); + ratio = convert_integer_to_float(i + 1 - (j >> 1)) / + (l05_scenery_ship_trail_segment_limit + phase); if (ratio > 1.0f) ratio = 1.0f; else if (ratio < 0.0f) ratio = 0.0f; - packet[i].color[j] = interpolate_color_7920(ratio, l05_scenery_ship_trail_fade_start_color, l05_scenery_ship_trail_fade_end_color); + packet[i].color[j] = interpolate_color_7920(ratio, + l05_scenery_ship_trail_fade_start_color, + l05_scenery_ship_trail_fade_end_color); } } memset(matrix, 0, 0x20); diff --git a/src/overlays/l06/hero/hero_set_state.c b/src/overlays/l06/hero/hero_set_state.c index e74970ad36..ab2fb137a7 100644 --- a/src/overlays/l06/hero/hero_set_state.c +++ b/src/overlays/l06/hero/hero_set_state.c @@ -83,10 +83,12 @@ int hero_set_state(int requested_state, int entry_animation_mode) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || entry_animation_mode != HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || + entry_animation_mode != HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS)) return 0; } - if ((D_L06_0015F5C4 == 2 || D_L06_0015F5C4 == 6) && entry_animation_mode != HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS) + if ((D_L06_0015F5C4 == 2 || D_L06_0015F5C4 == 6) && + entry_animation_mode != HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l06/mobys/alien_queen.c b/src/overlays/l06/mobys/alien_queen.c index 0269cc28f1..d475c6de74 100644 --- a/src/overlays/l06/mobys/alien_queen.c +++ b/src/overlays/l06/mobys/alien_queen.c @@ -447,7 +447,8 @@ void alien_queen_update(unsigned char *moby) { alien_queen_update_vars->suppress_death_dialogue = 0; qcopy(alien_queen_update_vars->unkC0, moby + 0x10); alien_queen_update_vars->animation_update = -1; - alien_queen_update_vars->saved_path_point_count = *D_L06_001B0C30_q[alien_queen_update_vars->path]; + alien_queen_update_vars->saved_path_point_count = + *D_L06_001B0C30_q[alien_queen_update_vars->path]; path = D_L06_001B0C30_q[alien_queen_update_vars->path]; lerp_vector(alien_queen_update_vars->path_midpoint, path + 4, @@ -911,7 +912,8 @@ void update_alien_queen_hit_response_and_recovery(char *moby) { } MOBY(moby)->hit_slot = 0xFF; trooper_anim_finish(moby, &alien_queen_hit_recovery_vars->anim_state); - if ((alien_queen_hit_recovery_vars->death_control_flags & 2) && (unsigned char)moby[0x20] != 15) { + if ((alien_queen_hit_recovery_vars->death_control_flags & 2) && + (unsigned char)moby[0x20] != 15) { if (alien_queen_hit_recovery_vars->animation_update != -1) { set_animation_parameter(alien_queen_hit_recovery_vars->animation_update, 0); alien_queen_hit_recovery_vars->animation_update = -1; @@ -1041,8 +1043,10 @@ int update_alien_queen_intro_camera(char *moby) { fast_vec_add(hero_offset_position, hero_offset_position, &x->motion.pos); hero_offset_position[2] += 4.0f; pos = moby + 0x10; - lerp_vector( - output_position, moby_offset_position, hero_offset_position, alien_queen_state->camera_blend_fraction); + lerp_vector(output_position, + moby_offset_position, + hero_offset_position, + alien_queen_state->camera_blend_fraction); } output_rotation[2] = fast_arc_tan(MOBY(moby)->pos.x - output_position[0], MOBY(moby)->pos.y - output_position[1]); diff --git a/src/overlays/l06/mobys/alien_snapper.c b/src/overlays/l06/mobys/alien_snapper.c index 50b72a0413..6ba008e36b 100644 --- a/src/overlays/l06/mobys/alien_snapper.c +++ b/src/overlays/l06/mobys/alien_snapper.c @@ -92,21 +92,21 @@ typedef struct { u8 pad59; u8 f5A; /* 0x5A */ u8 pad5B[0x15]; - u8 f70[0x10]; /* 0x70 */ - f32 gravity_step; /* 0x80 */ - f32 motion_speed_adjustment_step; /* 0x84 */ - f32 return_speed; /* 0x88 */ - f32 f8C; /* 0x8C */ - s32 collision_radius_fixed; /* 0x90 */ - s32 motion_flags; /* 0x94 */ - f32 collision_height_offset; /* 0x98 */ + u8 f70[0x10]; /* 0x70 */ + f32 gravity_step; /* 0x80 */ + f32 motion_speed_adjustment_step; /* 0x84 */ + f32 return_speed; /* 0x88 */ + f32 f8C; /* 0x8C */ + s32 collision_radius_fixed; /* 0x90 */ + s32 motion_flags; /* 0x94 */ + f32 collision_height_offset; /* 0x98 */ u8 pad9C[0x11]; u8 fAD; /* 0xAD */ u8 padAE[0x22]; - s32 movement; /* 0xD0 */ - f32 fD4; /* 0xD4 */ - f32 max_ground_drop_distance; /* 0xD8 */ - f32 max_ground_rise_distance; /* 0xDC */ + s32 movement; /* 0xD0 */ + f32 fD4; /* 0xD4 */ + f32 max_ground_drop_distance; /* 0xD8 */ + f32 max_ground_rise_distance; /* 0xDC */ u8 padE0[0x14]; f32 speed; /* 0xF4 */ u8 padF8[0x28]; @@ -122,18 +122,18 @@ typedef struct { f32 angle_jitter; /* 0x194 */ f32 jitter_degrees; /* 0x198 */ u8 pad19C[4]; - f32 f1A0; /* 0x1A0 */ - f32 base_speed; /* 0x1A4 */ - s32 timer; /* 0x1A8 */ - s32 f1AC; /* 0x1AC */ - s32 path; /* 0x1B0 */ - s32 activate_on_initialize; /* 0x1B4 */ - s32 timer_max; /* 0x1B8 */ - s32 node; /* 0x1BC */ - s32 clip_volume; /* 0x1C0 */ - f32 reach_distance; /* 0x1C4 */ - f32 f1C8; /* 0x1C8 */ - s32 f1CC; /* 0x1CC */ + f32 f1A0; /* 0x1A0 */ + f32 base_speed; /* 0x1A4 */ + s32 timer; /* 0x1A8 */ + s32 f1AC; /* 0x1AC */ + s32 path; /* 0x1B0 */ + s32 activate_on_initialize; /* 0x1B4 */ + s32 timer_max; /* 0x1B8 */ + s32 node; /* 0x1BC */ + s32 clip_volume; /* 0x1C0 */ + f32 reach_distance; /* 0x1C4 */ + f32 f1C8; /* 0x1C8 */ + s32 f1CC; /* 0x1CC */ u8 pad1D0[0x10]; u8 f1E0[0x10]; /* 0x1E0 */ } SnapperVars_91A8; @@ -212,23 +212,23 @@ typedef struct BlargVars { char f60[0x7]; /* 0x60 */ unsigned char f67; /* 0x67 */ char pad68[0x8]; - char f70[0x18]; /* 0x70 */ - float horizontal_motion_speed; /* 0x88 */ - float f8C; /* 0x8C */ + char f70[0x18]; /* 0x70 */ + float horizontal_motion_speed; /* 0x88 */ + float f8C; /* 0x8C */ char pad90[0x30]; - float motion_apex_animation_frame; /* 0xC0 */ + float motion_apex_animation_frame; /* 0xC0 */ float motion_landing_animation_frame; /* 0xC4 */ char padC8[0x58]; char selected_target_xy[0x8]; /* 0x120 */ - float selected_target_z; /* 0x128 */ + float selected_target_z; /* 0x128 */ char pad12C[0x34]; int selected_target_moby; /* 0x160 */ - int f164; /* 0x164 */ + int f164; /* 0x164 */ char pad168[0x8]; char home_position[0x30]; /* 0x170 */ - float f1A0; /* 0x1A0 */ + float f1A0; /* 0x1A0 */ char pad1A4[0x8]; - int f1AC; /* 0x1AC */ + int f1AC; /* 0x1AC */ int movement_path_index; /* 0x1B0 */ char pad1B4[0x14]; float f1C8; /* 0x1C8 */ @@ -868,8 +868,9 @@ void update_alien_snapper_hit_response_and_targeting(Moby *moby) { } snapper_vars->f1C8 = fast_add_rotations( snapper_vars->f1C8, alien_snapper_glow_phase_speed_degrees_gp * 0.017453292f * frame_time); - moby->glow_color = func_001FA8A8_2FA618( - l06_alien_snapper_glow_gray_color, l06_alien_snapper_glow_tinted_color, (fast_sin(snapper_vars->f1C8) + 1.0f) * 0.5f); + moby->glow_color = func_001FA8A8_2FA618(l06_alien_snapper_glow_gray_color, + l06_alien_snapper_glow_tinted_color, + (fast_sin(snapper_vars->f1C8) + 1.0f) * 0.5f); if (snapper_vars->f1AC != 0) { snapper_vars->f1A0 = l06_alien_snapper_base_targeting_radius + 6.0f; @@ -890,7 +891,8 @@ void update_alien_snapper_hit_response_and_targeting(Moby *moby) { 0, D_L06_001B0FB0_2FA618[snapper_vars->movement_path_index] + 4, *D_L06_001B0FB0_2FA618[snapper_vars->movement_path_index]) != 2) { - if (snapper_vars->f1A0 < vector_distance_xy(snapper_vars->home_position, snapper_vars->selected_target_xy) || + if (snapper_vars->f1A0 < + vector_distance_xy(snapper_vars->home_position, snapper_vars->selected_target_xy) || 3.0f < absolute_float(moby->pos.z - snapper_vars->selected_target_z)) { snapper_vars->f164 = 2; } diff --git a/src/overlays/l06/mobys/beam_barrier.c b/src/overlays/l06/mobys/beam_barrier.c index aff4e5ff25..37099c7992 100644 --- a/src/overlays/l06/mobys/beam_barrier.c +++ b/src/overlays/l06/mobys/beam_barrier.c @@ -391,9 +391,10 @@ void draw_beam_barrier_segments(char *moby) { vu1_add_g_sregister(0x14, 0xFF9000000260L); vu1_add_g_sregister(8, 0); vu1_add_g_sregister(0x42, - (long)l06_beam_barrier_gs_alpha_a_selector | ((long)l06_beam_barrier_gs_alpha_b_selector << 2) | - ((long)l06_beam_barrier_gs_alpha_c_selector << 4) | ((long)l06_beam_barrier_gs_alpha_d_selector << 6) | - 0x8000000000L); + (long)l06_beam_barrier_gs_alpha_a_selector | + ((long)l06_beam_barrier_gs_alpha_b_selector << 2) | + ((long)l06_beam_barrier_gs_alpha_c_selector << 4) | + ((long)l06_beam_barrier_gs_alpha_d_selector << 6) | 0x8000000000L); font_queue_vu_state(); first_matrix = segment_matrix[0]; segment_params = beam_segment_draw_params; @@ -478,14 +479,21 @@ void animate_beam_barrier_strands(struct Moby *moby) { y += step; } for (k = 1; k < 29; k++) { - fast_vec_add(&l06_beam_barrier_strand_point_drifts[i][k], &jitter[k - 1], &jitter[k]); - fast_vec_add(&l06_beam_barrier_strand_point_drifts[i][k], &l06_beam_barrier_strand_point_drifts[i][k], &jitter[k + 1]); - fast_vec_scale(&l06_beam_barrier_strand_point_drifts[i][k], &l06_beam_barrier_strand_point_drifts[i][k], 0.333f); + fast_vec_add( + &l06_beam_barrier_strand_point_drifts[i][k], &jitter[k - 1], &jitter[k]); + fast_vec_add(&l06_beam_barrier_strand_point_drifts[i][k], + &l06_beam_barrier_strand_point_drifts[i][k], + &jitter[k + 1]); + fast_vec_scale(&l06_beam_barrier_strand_point_drifts[i][k], + &l06_beam_barrier_strand_point_drifts[i][k], + 0.333f); } D_L06_00161E40[i] = D_L06_00161E50; } else { for (j = 1; j < 29; j++) { - fast_vec_add(&l06_beam_barrier_strand_local_points[i][j], &l06_beam_barrier_strand_local_points[i][j], &l06_beam_barrier_strand_point_drifts[i][j]); + fast_vec_add(&l06_beam_barrier_strand_local_points[i][j], + &l06_beam_barrier_strand_local_points[i][j], + &l06_beam_barrier_strand_point_drifts[i][j]); } D_L06_00161E40[i]--; } diff --git a/src/overlays/l06/mobys/elevator.c b/src/overlays/l06/mobys/elevator.c index 7d71e59957..8e2b2e578c 100644 --- a/src/overlays/l06/mobys/elevator.c +++ b/src/overlays/l06/mobys/elevator.c @@ -210,8 +210,8 @@ void elevator_update(Moby_2FDA70 *moby) { } else { moby->state = WAIT_FOR_HERO_TRIGGER_AT_NODE_OFFSET_HEIGHT; } - moby->pos.z = - l06_cuboids_macro[moby_data->height_cuboid_index].pos.z + l06_cuboids_macro[moby_data->height_cuboid_index].axes[2].z; + moby->pos.z = l06_cuboids_macro[moby_data->height_cuboid_index].pos.z + + l06_cuboids_macro[moby_data->height_cuboid_index].axes[2].z; if (((Hero_2FDA70 *)(D_0013F350))->vehicle_mode == 0) { ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f34 |= 1; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f34 |= 2; @@ -220,7 +220,8 @@ void elevator_update(Moby_2FDA70 *moby) { set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); } set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); - set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); + set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + + (moby_data->base_height_linked_moby_index << 8)); break; case WAIT_FOR_INITIAL_HERO_ACTIVATION: if (is_point_inside_clip_volume(&((Hero_2FDA70 *)(D_0013F350))->pos, moby_data->f70) != 0) { @@ -261,15 +262,16 @@ void elevator_update(Moby_2FDA70 *moby) { fade_to_black(scale_game_frames(0x10)); set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); - set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + - (moby_data->base_height_linked_moby_index << 8)); + set_moby_and_links_to_states_2_and_3( + D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); moby_data->vehicle_entry_configuration_active = 0; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f94 = 0; restore_hero_from_vehicle_mode(); { - LevelCuboid *b = &l06_cuboids_macro[moby_data->vehicle_exit_placement_cuboid_index]; + LevelCuboid *b = + &l06_cuboids_macro[moby_data->vehicle_exit_placement_cuboid_index]; set_race_camera(&b->pos, &b->rot, 0, 1); } request_music_track(0, 10); @@ -285,8 +287,8 @@ void elevator_update(Moby_2FDA70 *moby) { fade_to_black(scale_game_frames(0x10)); set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); - set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + - (moby_data->base_height_linked_moby_index << 8)); + set_moby_and_links_to_states_8_and_9( + D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); moby_data->vehicle_entry_configuration_active = 1; @@ -294,7 +296,8 @@ void elevator_update(Moby_2FDA70 *moby) { ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].cls->f10; ((Moby_2FDA70 *)D_L06_0015FFD8_macro)[moby_data->f6C].f34 &= 0xFFFE; { - LevelCuboid *b = &l06_cuboids_macro[moby_data->vehicle_entry_placement_cuboid_index]; + LevelCuboid *b = + &l06_cuboids_macro[moby_data->vehicle_entry_placement_cuboid_index]; set_race_camera(&b->pos, &b->rot, 0, 1); } enter_hero_vehicle_mode_and_set_moby( @@ -304,28 +307,30 @@ void elevator_update(Moby_2FDA70 *moby) { fade_to_black(scale_game_frames(0x10)); set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); - set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + - (moby_data->base_height_linked_moby_index << 8)); + set_moby_and_links_to_states_8_and_9( + D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); moby_data->vehicle_entry_configuration_active = 1; moby_data->f94 = 1; { - LevelCuboid *b = &l06_cuboids_macro[moby_data->vehicle_entry_placement_cuboid_index]; + LevelCuboid *b = + &l06_cuboids_macro[moby_data->vehicle_entry_placement_cuboid_index]; set_race_camera(&b->pos, &b->rot, 0, 1); } } else { fade_to_black(scale_game_frames(0x10)); set_moby_and_links_to_states_2_and_3(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); - set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + - (moby_data->base_height_linked_moby_index << 8)); + set_moby_and_links_to_states_8_and_9( + D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f60 << 8)); moby_data->vehicle_entry_configuration_active = 0; moby_data->f94 = 0; { - LevelCuboid *b = &l06_cuboids_macro[moby_data->vehicle_exit_placement_cuboid_index]; + LevelCuboid *b = + &l06_cuboids_macro[moby_data->vehicle_exit_placement_cuboid_index]; set_race_camera(&b->pos, &b->rot, 0, 1); } } @@ -342,7 +347,8 @@ void elevator_update(Moby_2FDA70 *moby) { moby_data->f90 = scale_game_frames(0x78); } else { moby->state = MOVE_TO_NODE_OFFSET_HEIGHT; - set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); + set_moby_and_links_to_states_8_and_9( + D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); moby_data->f90 = scale_game_frames(0x78); } } else if (vector_distance_xy(&moby->pos, &((Hero_2FDA70 *)(D_0013F350))->pos) < 24.0f && @@ -358,7 +364,8 @@ void elevator_update(Moby_2FDA70 *moby) { moby->state == WAIT_FOR_HERO_TRIGGER_AT_NODE_BASE_HEIGHT && moby->pos.z < ((Hero_2FDA70 *)(D_0013F350))->pos.z - 5.0f) { moby->state = MOVE_TO_NODE_OFFSET_HEIGHT; - set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); + set_moby_and_links_to_states_8_and_9(D_L06_0015FFD8_macro + + (moby_data->base_height_linked_moby_index << 8)); moby_data->f90 = scale_game_frames(0x78); } break; @@ -382,7 +389,8 @@ void elevator_update(Moby_2FDA70 *moby) { moby->state = WAIT_FOR_HERO_CLEARANCE_AT_NODE_OFFSET_HEIGHT; set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->f64 << 8)); } else { - set_moby_and_links_to_states_4_and_5(D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); + set_moby_and_links_to_states_4_and_5( + D_L06_0015FFD8_macro + (moby_data->base_height_linked_moby_index << 8)); moby->state = WAIT_FOR_HERO_CLEARANCE_AT_NODE_BASE_HEIGHT; } } @@ -410,14 +418,16 @@ void elevator_update(Moby_2FDA70 *moby) { moby->f90 = l06_elevator_move_and_clearance_color; } else { float color_blend; - moby_data->color_pulse_phase = fast_add_rotations(moby_data->color_pulse_phase, D_0015ED6C * 5.2359877f); + moby_data->color_pulse_phase = + fast_add_rotations(moby_data->color_pulse_phase, D_0015ED6C * 5.2359877f); color_blend = fast_sin(moby_data->color_pulse_phase) * 4.0f - 3.0f; if (color_blend > 1.0f) { color_blend = 1.0f; } else if (color_blend < 0.0f) { color_blend = 0.0f; } - moby->f90 = fast_tween_color(l06_elevator_pulse_dim_color, l06_elevator_pulse_bright_color, color_blend); + moby->f90 = fast_tween_color( + l06_elevator_pulse_dim_color, l06_elevator_pulse_bright_color, color_blend); } fast_vec_add(&position_delta, &position_delta, &moby->pos); update_entity_matrix(moby_data->f20, &position_delta, &initial_rotation, &moby->rot); diff --git a/src/overlays/l06/mobys/fred.c b/src/overlays/l06/mobys/fred.c index 793f247636..861a46e2f6 100644 --- a/src/overlays/l06/mobys/fred.c +++ b/src/overlays/l06/mobys/fred.c @@ -328,7 +328,9 @@ void fred_update(struct Moby *moby) { 6.0f, heading, random_float_between(0.0f, 30.0f) * 0.017453292f); - fast_vec_add(fred_vars->idle_look_target_position, fred_vars->idle_look_target_position, ((float *)&moby->pos)); + fast_vec_add(fred_vars->idle_look_target_position, + fred_vars->idle_look_target_position, + ((float *)&moby->pos)); } if (fred_vars->f158) { qcopy(target, &hero.motion.body_center); diff --git a/src/overlays/l06/mobys/toxic_gas_vent.c b/src/overlays/l06/mobys/toxic_gas_vent.c index 1640e76b97..99502fc1ce 100644 --- a/src/overlays/l06/mobys/toxic_gas_vent.c +++ b/src/overlays/l06/mobys/toxic_gas_vent.c @@ -143,9 +143,11 @@ void toxic_gas_vent_update(char *vent_moby) { } emit_toxic_gas_vent_sparks(vent_moby); check_oscillating_toxic_gas_vent_collisions(vent_moby); - heading_offset_radians = vent_data->oscillation_amplitude_degrees * DEG_TO_RAD * fast_sin(vent_data->unk7C); + heading_offset_radians = + vent_data->oscillation_amplitude_degrees * DEG_TO_RAD * fast_sin(vent_data->unk7C); vent_data->unk7C = fast_add_rotations(vent_data->unk7C, vent_data->unk80); - MOBY(vent_moby)->rot.z = fast_add_rotations(vent_data->initial_heading_radians, heading_offset_radians); + MOBY(vent_moby)->rot.z = + fast_add_rotations(vent_data->initial_heading_radians, heading_offset_radians); break; case VENT_TIMED_ACTIVE: if (voice_is_playing(vent_moby, vent_data->voice) == 0) { diff --git a/src/overlays/l07/mobys/bombomatic.c b/src/overlays/l07/mobys/bombomatic.c index a6c70240e2..1bbac21c5b 100644 --- a/src/overlays/l07/mobys/bombomatic.c +++ b/src/overlays/l07/mobys/bombomatic.c @@ -407,7 +407,8 @@ void bombomatic_update(char *moby) { debris_velocity[2] = FUN_L00_0025abf0( vA0, launch_work_vector, 0, D_0015ED6C_gp * 7.0f, -(D_0015ED70 * 9.8f)); fast_vec_add(vA0, vA0, debris_velocity); - spawn_bombomatic_projectile(vA0, debris_velocity, (int)moby, moby_data->launch_burst_index); + spawn_bombomatic_projectile( + vA0, debris_velocity, (int)moby, moby_data->launch_burst_index); moby_data->launch_burst_index = moby_data->launch_burst_index + 1; } eeE4: diff --git a/src/overlays/l07/mobys/snagglebeast.c b/src/overlays/l07/mobys/snagglebeast.c index 22283c7c70..4d8f4bc463 100644 --- a/src/overlays/l07/mobys/snagglebeast.c +++ b/src/overlays/l07/mobys/snagglebeast.c @@ -380,19 +380,26 @@ void draw_and_probe_snagglebeast_rope_attack(char *moby) { rope_attack_moby_vars = (SnagglebeastVars *)MOBY(moby)->pvars; qzero(&rope_offset); one = 1.0f; - fast_vec_normalize( - &rope_offset, rope_attack_moby_vars->unk130, rope_attack_moby_vars->rope_extension_length * 0.8f); - fast_vec_add(rope_attack_moby_vars->unk140, &rope_offset, rope_attack_moby_vars->rope_start_position); + fast_vec_normalize(&rope_offset, + rope_attack_moby_vars->unk130, + rope_attack_moby_vars->rope_extension_length * 0.8f); + fast_vec_add( + rope_attack_moby_vars->unk140, &rope_offset, rope_attack_moby_vars->rope_start_position); fast_vec_normalize(&rope_offset, &rope_offset, rope_attack_moby_vars->rope_extension_length); - fast_vec_add(rope_attack_moby_vars->unk120, &rope_offset, rope_attack_moby_vars->rope_start_position); + fast_vec_add( + rope_attack_moby_vars->unk120, &rope_offset, rope_attack_moby_vars->rope_start_position); draw_snagglebeast_rope_attack_layer(moby, one, 0, one, 0x20000080); draw_snagglebeast_rope_attack_layer(moby, 0.7f, 10, 2.0f, 0x28008080); draw_snagglebeast_rope_attack_layer(moby, 0.4f, 20, 3.0f, 0x30B0FFFF); - fast_vec_sub(rope_direction, rope_attack_moby_vars->unk120, rope_attack_moby_vars->rope_start_position); + fast_vec_sub( + rope_direction, rope_attack_moby_vars->unk120, rope_attack_moby_vars->rope_start_position); fast_vec_normalize(rope_direction, rope_direction, one); make_hit_descriptor(blk, moby, 0x30000, 1.00012302f, rope_direction); - if (collision_line( - rope_attack_moby_vars->rope_start_position, rope_attack_moby_vars->unk120, 0, moby, blk) == 0) { + if (collision_line(rope_attack_moby_vars->rope_start_position, + rope_attack_moby_vars->unk120, + 0, + moby, + blk) == 0) { collect_mobies_in_sphere(0.5f, rope_attack_moby_vars->unk120, 0, moby, blk); } } @@ -1146,7 +1153,8 @@ void snagglebeast_update(unsigned char *moby) { } if (MOBY(moby)->command % 3U == 2) snagglebeast_instance_state->health_display += 0xF; - if (MOBY(moby)->state != SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO && MOBY(moby)->state != SNAGGLEBEAST_INITIALIZE) + if (MOBY(moby)->state != SNAGGLEBEAST_CAPTURE_HERO_AND_DRAIN_AMMO && + MOBY(moby)->state != SNAGGLEBEAST_INITIALIZE) suck_beam_queue_draw((int)moby); if ((int)snagglebeast_instance_state->sphere_fade_direction - 1 == 0) { if (snagglebeast_instance_state->voice == -1) @@ -1179,7 +1187,9 @@ void snagglebeast_update(unsigned char *moby) { add_draw_callback(draw_snagglebeast_sphere_effect, moby); update_snagglebeast_target_joint_animation( (char *)moby, snagglebeast_instance_state, hero.motion.pos.f); - if (MOBY(moby)->state != SNAGGLEBEAST_INITIALIZE && MOBY(moby)->state != SNAGGLEBEAST_DEATH_EXPLOSION && MOBY(moby)->state != SNAGGLEBEAST_POST_DEATH_CLEANUP) { + if (MOBY(moby)->state != SNAGGLEBEAST_INITIALIZE && + MOBY(moby)->state != SNAGGLEBEAST_DEATH_EXPLOSION && + MOBY(moby)->state != SNAGGLEBEAST_POST_DEATH_CLEANUP) { snagglebeast_instance_state->unk1B0 = queue_animation_update(0x16, 0xFFFF, diff --git a/src/overlays/l07/mobys/snagglebeast_effects.c b/src/overlays/l07/mobys/snagglebeast_effects.c index 6d421db5fa..05de038257 100644 --- a/src/overlays/l07/mobys/snagglebeast_effects.c +++ b/src/overlays/l07/mobys/snagglebeast_effects.c @@ -266,7 +266,8 @@ void draw_collision_clipped_moby_beam(struct Moby *effect_owner_moby) { 1.0f, 1.0f); if (moby_effect_data->previous_hit_valid != 0.0f) { - fast_vec_sub(effect_sample_step, line_endpoint, moby_effect_data->previous_hit_position); + fast_vec_sub( + effect_sample_step, line_endpoint, moby_effect_data->previous_hit_position); fast_vec_normalize(effect_sample_step, effect_sample_step, 0.2f); qcopy(effect_sample_position, moby_effect_data->previous_hit_position); for (k = 0; k < 4; k++) { diff --git a/src/overlays/l07/mobys/water.c b/src/overlays/l07/mobys/water.c index a2ce4f078e..5143b19956 100644 --- a/src/overlays/l07/mobys/water.c +++ b/src/overlays/l07/mobys/water.c @@ -57,9 +57,9 @@ typedef struct { typedef struct { char pad0[0x10]; - float pos[4]; /* 0x10 */ - unsigned char state; /* 0x20 */ - unsigned char moby_list_id; /* 0x21 */ + float pos[4]; /* 0x10 */ + unsigned char state; /* 0x20 */ + unsigned char moby_list_id; /* 0x21 */ char pad22[0x12]; unsigned short flags; /* 0x34 */ char pad36[0x42]; diff --git a/src/overlays/l08/hero/hero_set_state.c b/src/overlays/l08/hero/hero_set_state.c index 5b950ebfcc..8af53da831 100644 --- a/src/overlays/l08/hero/hero_set_state.c +++ b/src/overlays/l08/hero/hero_set_state.c @@ -83,7 +83,8 @@ int hero_set_state(int requested_state, int animation_request_mode) { animation_request_mode != HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS)) return 0; } - if ((level_game_mode == 2 || level_game_mode == 6) && animation_request_mode != HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS) + if ((level_game_mode == 2 || level_game_mode == 6) && + animation_request_mode != HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l08/mobys/bolt_pickup.c b/src/overlays/l08/mobys/bolt_pickup.c index 239d2b7f9b..6dbe36708a 100644 --- a/src/overlays/l08/mobys/bolt_pickup.c +++ b/src/overlays/l08/mobys/bolt_pickup.c @@ -184,11 +184,14 @@ void bolt_pickup_update(Moby_2B94B0 *moby) { hit = 0; moby->spin_angle = fast_add_rotations(moby->spin_angle, moby_data->fC); if (((Hero_2B94B0 *)((char *)&hero))->f208C == 15) { - if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->bolt_collection_probe_a, moby->pos) < 0.5f) + if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->bolt_collection_probe_a, + moby->pos) < 0.5f) hit = 1; - if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->bolt_collection_probe_b, moby->pos) < 0.5f) + if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->bolt_collection_probe_b, + moby->pos) < 0.5f) hit = 1; - if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->bolt_collection_probe_c, moby->pos) < 0.5f) + if (vector_distance_xy(((Hero_2B94B0 *)((char *)&hero))->bolt_collection_probe_c, + moby->pos) < 0.5f) hit = 1; } else if (vector_distance_xy(moby->pos, ((Hero_2B94B0 *)((char *)&hero))->pos) < ((Hero_2B94B0 *)((char *)&hero))->collection_radius_xy) { diff --git a/src/overlays/l09/mobys/barrier.c b/src/overlays/l09/mobys/barrier.c index 054ce7ae58..6eb5d37bf7 100644 --- a/src/overlays/l09/mobys/barrier.c +++ b/src/overlays/l09/mobys/barrier.c @@ -118,7 +118,8 @@ void barrier_update(Moby *moby) { int row = current_level_index * 16; if (visited52[moby->mission + row] == 0xFF) { if (barrier_vars->idx != -1) - ((Flags_309688 *)(alternate_item_available + barrier_vars->idx))->barrier_cleared = 1; + ((Flags_309688 *)(alternate_item_available + barrier_vars->idx))->barrier_cleared = + 1; mark_moby_for_removal(moby); return; } diff --git a/src/overlays/l09/mobys/platform.c b/src/overlays/l09/mobys/platform.c index 495a094368..e410299c79 100644 --- a/src/overlays/l09/mobys/platform.c +++ b/src/overlays/l09/mobys/platform.c @@ -36,9 +36,9 @@ typedef struct { float baseZ; /* 0x84 */ int timer; /* 0x88 */ int pad8C; - float rotation_amplitude_phase_angle; /* 0x90 */ - float rotation_orientation_phase_angle; /* 0x94 */ - float vertical_oscillation_phase_angle; /* 0x98 */ + float rotation_amplitude_phase_angle; /* 0x90 */ + float rotation_orientation_phase_angle; /* 0x94 */ + float vertical_oscillation_phase_angle; /* 0x98 */ float previous_vertical_oscillation_offset; /* 0x9C */ } PlatVars; @@ -153,8 +153,11 @@ void platform_update(Moby *moby) { allocate_voice_for_target_entry(2, 0, moby); } } - update_moby_vertical_oscillation( - 0.14f, frame_time * 0.5235987901687622f, moby, &platform_vars->vertical_oscillation_phase_angle, &platform_vars->previous_vertical_oscillation_offset); + update_moby_vertical_oscillation(0.14f, + frame_time * 0.5235987901687622f, + moby, + &platform_vars->vertical_oscillation_phase_angle, + &platform_vars->previous_vertical_oscillation_offset); update_moby_rotation_oscillation(moby, &platform_vars->rotation_amplitude_phase_angle, &platform_vars->rotation_orientation_phase_angle, diff --git a/src/overlays/l09/mobys/refueling_station.c b/src/overlays/l09/mobys/refueling_station.c index b0cd80ba79..cae920979e 100644 --- a/src/overlays/l09/mobys/refueling_station.c +++ b/src/overlays/l09/mobys/refueling_station.c @@ -182,7 +182,8 @@ void refueling_station_update(struct Moby *moby) { switch (moby->state) { case REFUELING_STATION_STATE_INITIALIZE: if (station_vars->removal_check_index != -1 && - (removal_check_base = (unsigned char *)D_0013D388 + station_vars->removal_check_index)[0x39] != 0) { + (removal_check_base = + (unsigned char *)D_0013D388 + station_vars->removal_check_index)[0x39] != 0) { mark_moby_for_removal(moby); return; } diff --git a/src/overlays/l09/mobys/turret.c b/src/overlays/l09/mobys/turret.c index 501d53a75e..fa62b9adca 100644 --- a/src/overlays/l09/mobys/turret.c +++ b/src/overlays/l09/mobys/turret.c @@ -263,9 +263,11 @@ void turret_update(struct Moby *moby) { spawn_turret_shot(moby, &muzzle, &shot, scale_game_frames(90)); allocate_voice_for_target_entry(0, 0, moby); l09_turret_shot_response_state.unk160 = 0.03f; - l09_turret_shot_response_state.longer_shot_response_frame_count = scale_game_frames(10); + l09_turret_shot_response_state.longer_shot_response_frame_count = + scale_game_frames(10); l09_turret_shot_response_state.unk170 = 0.03f; - l09_turret_shot_response_state.shorter_shot_response_frame_count = scale_game_frames(7); + l09_turret_shot_response_state.shorter_shot_response_frame_count = + scale_game_frames(7); turret_vars->barrel = 0; for (i = 0; i < 5; i++) { rnd.q = 0; @@ -310,9 +312,11 @@ void turret_update(struct Moby *moby) { spawn_turret_shot(moby, &muzzle, &shot, scale_game_frames(90)); allocate_voice_for_target_entry(0, 0, moby); l09_turret_shot_response_state.unk160 = 0.03f; - l09_turret_shot_response_state.longer_shot_response_frame_count = scale_game_frames(10); + l09_turret_shot_response_state.longer_shot_response_frame_count = + scale_game_frames(10); l09_turret_shot_response_state.unk170 = 0.03f; - l09_turret_shot_response_state.shorter_shot_response_frame_count = scale_game_frames(7); + l09_turret_shot_response_state.shorter_shot_response_frame_count = + scale_game_frames(7); turret_vars->barrel = 1; for (i = 0; i < 5; i++) { rnd.q = 0; diff --git a/src/overlays/l10/mobys/blarg_ship.c b/src/overlays/l10/mobys/blarg_ship.c index 80fea310f9..017fa3f9bd 100644 --- a/src/overlays/l10/mobys/blarg_ship.c +++ b/src/overlays/l10/mobys/blarg_ship.c @@ -209,7 +209,8 @@ void blarg_ship_update(Ship_5E48 *ship) { FUN_L00_00263ac8(2.5f, (int)ship, 2, d->a1D0); if (d->entry_path_index == -1) { - DebugPrint(blarg_ship_missing_path_error_format, ship->moby_class_id, ship->maya_instance_id); + DebugPrint( + blarg_ship_missing_path_error_format, ship->moby_class_id, ship->maya_instance_id); goto del; } FUN_L10_002e5968_c((char *)ship); @@ -248,12 +249,20 @@ void blarg_ship_update(Ship_5E48 *ship) { break; case BLARG_SHIP_STATE_RISE_TO_ENTRY_PATH: desired_heading = fast_arc_tan(tgt->pos.x - ship->pos.x, tgt->pos.y - ship->pos.y); - FUN_L00_00258278( - (char *)ship, &d->heading_turn_velocity, desired_heading, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); + FUN_L00_00258278((char *)ship, + &d->heading_turn_velocity, + desired_heading, + 0.02f, + 0.3f, + D_0015ED6C * 3.1415927f); aim_elevation = fast_arc_tan(vector_distance_xy(&ship->pos, &tgt->pos), tgt->pos.z - ship->pos.z); - ship->pitch = - spring_turn(&d->pitch_turn_velocity, ship->pitch, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); + ship->pitch = spring_turn(&d->pitch_turn_velocity, + ship->pitch, + -aim_elevation, + 0.02f, + 0.3f, + D_0015ED6C * 3.1415927f); if ((ship->b70 & 2) && ship->requested_animation_sequence == 1) blend_moby_animation(ship, 2, 0, scale_game_frames(20)); ship->pos.z += D_0015ED6C * 4.0f; @@ -266,12 +275,20 @@ void blarg_ship_update(Ship_5E48 *ship) { case BLARG_SHIP_STATE_FOLLOW_ENTRY_PATH: qcopy(&A, &l10_paths[d->entry_path_index]->points[d->path_point_index]); desired_heading = fast_arc_tan(A.x - ship->pos.x, A.y - ship->pos.y); - FUN_L00_00258278( - (char *)ship, &d->heading_turn_velocity, desired_heading, 0.02f, 0.3f, D_0015ED6C * 12.566371f); + FUN_L00_00258278((char *)ship, + &d->heading_turn_velocity, + desired_heading, + 0.02f, + 0.3f, + D_0015ED6C * 12.566371f); aim_elevation = fast_arc_tan(vector_distance_xy(&ship->pos, &tgt->pos), tgt->pos.z - ship->pos.z); - ship->pitch = - spring_turn(&d->pitch_turn_velocity, ship->pitch, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); + ship->pitch = spring_turn(&d->pitch_turn_velocity, + ship->pitch, + -aim_elevation, + 0.02f, + 0.3f, + D_0015ED6C * 3.1415927f); fast_vec_sub(&B, &A, &ship->pos); fast_vec_normalize(&d->a120, &B, D_0015ED6C * 8.0f); fast_vec_add(&ship->pos, &ship->pos, &d->a120); @@ -282,7 +299,8 @@ void blarg_ship_update(Ship_5E48 *ship) { } else { d->path_point_index = 0; ship->state = BLARG_SHIP_STATE_FIRE_AT_TARGET; - d->firing_phase_timer = truncate_float_to_s32(FUN_L04_001f1978(d->firing_duration_seconds * 60.0f)); + d->firing_phase_timer = + truncate_float_to_s32(FUN_L04_001f1978(d->firing_duration_seconds * 60.0f)); } } break; @@ -306,11 +324,19 @@ void blarg_ship_update(Ship_5E48 *ship) { D_L10_001742D8 = tgt; } desired_heading = fast_arc_tan(tgt->pos.x - ship->pos.x, tgt->pos.y - ship->pos.y); - FUN_L00_00258278( - (char *)ship, &d->heading_turn_velocity, desired_heading, 0.02f, 0.3f, D_0015ED6C * 12.566371f); + FUN_L00_00258278((char *)ship, + &d->heading_turn_velocity, + desired_heading, + 0.02f, + 0.3f, + D_0015ED6C * 12.566371f); aim_elevation = fast_arc_tan(vector_distance_xy(&ship->pos, &A), A.z - ship->pos.z); - ship->pitch = - spring_turn(&d->pitch_turn_velocity, ship->pitch, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); + ship->pitch = spring_turn(&d->pitch_turn_velocity, + ship->pitch, + -aim_elevation, + 0.02f, + 0.3f, + D_0015ED6C * 3.1415927f); if (fast_difference_between_rotations( ship->heading, fast_arc_tan(tgt->pos.x - ship->pos.x, tgt->pos.y - ship->pos.y)) < 0.17453292f) { @@ -318,7 +344,8 @@ void blarg_ship_update(Ship_5E48 *ship) { blend_moby_animation(ship, 3, 0, scale_game_frames(6)); ship->animation_speed = blarg_ship_firing_animation_speed_gp; } - if (ship->b52 == 3 && d->targeting_status != BLARG_SHIP_TARGETING_FIRE_BLOCKED && D_L10_001742D8 == tgt) { + if (ship->b52 == 3 && d->targeting_status != BLARG_SHIP_TARGETING_FIRE_BLOCKED && + D_L10_001742D8 == tgt) { int near = is_value_within_interpolated_window((char *)ship, 1.0f); int far = is_value_within_interpolated_window((char *)ship, 16.0f); if (near || far) { @@ -339,7 +366,8 @@ void blarg_ship_update(Ship_5E48 *ship) { if (ship->requested_animation_sequence != 2) blend_moby_animation(ship, 2, 0, scale_game_frames(10)); ship->state = BLARG_SHIP_STATE_FIRE_COOLDOWN; - d->firing_phase_timer = truncate_float_to_s32(FUN_L04_001f1978(d->cooldown_duration_seconds * 60.0f)); + d->firing_phase_timer = + truncate_float_to_s32(FUN_L04_001f1978(d->cooldown_duration_seconds * 60.0f)); } qcopy(&B, &l10_paths[d->firing_path_index]->points[d->path_point_index]); fast_vec_sub(&C, &B, &ship->pos); @@ -371,16 +399,25 @@ void blarg_ship_update(Ship_5E48 *ship) { D_L10_001742D8 = tgt; } desired_heading = fast_arc_tan(tgt->pos.x - ship->pos.x, tgt->pos.y - ship->pos.y); - FUN_L00_00258278( - (char *)ship, &d->heading_turn_velocity, desired_heading, 0.02f, 0.3f, D_0015ED6C * 12.566371f); + FUN_L00_00258278((char *)ship, + &d->heading_turn_velocity, + desired_heading, + 0.02f, + 0.3f, + D_0015ED6C * 12.566371f); aim_elevation = fast_arc_tan(vector_distance_xy(&ship->pos, &A), A.z - ship->pos.z); - ship->pitch = - spring_turn(&d->pitch_turn_velocity, ship->pitch, -aim_elevation, 0.02f, 0.3f, D_0015ED6C * 3.1415927f); + ship->pitch = spring_turn(&d->pitch_turn_velocity, + ship->pitch, + -aim_elevation, + 0.02f, + 0.3f, + D_0015ED6C * 3.1415927f); if (fast_dec_timer(&d->firing_phase_timer)) { blend_moby_animation(ship, 3, 0, scale_game_frames(10)); ship->animation_speed = blarg_ship_firing_animation_speed_gp; ship->state = BLARG_SHIP_STATE_FIRE_AT_TARGET; - d->firing_phase_timer = truncate_float_to_s32(FUN_L04_001f1978(d->firing_duration_seconds * 60.0f)); + d->firing_phase_timer = + truncate_float_to_s32(FUN_L04_001f1978(d->firing_duration_seconds * 60.0f)); } qcopy(&B, &l10_paths[d->firing_path_index]->points[d->path_point_index]); fast_vec_sub(&C, &B, &ship->pos); @@ -411,14 +448,16 @@ void blarg_ship_update(Ship_5E48 *ship) { blend_moby_animation(ship, 3, 0, scale_game_frames(10)); ship->animation_speed = blarg_ship_firing_animation_speed_gp; ship->state = pre_hit_state; - d->firing_phase_timer = truncate_float_to_s32(FUN_L04_001f1978(d->firing_duration_seconds * 60.0f)); + d->firing_phase_timer = + truncate_float_to_s32(FUN_L04_001f1978(d->firing_duration_seconds * 60.0f)); } else if (pre_hit_state == BLARG_SHIP_STATE_FLY_AWAY) { blend_moby_animation(ship, 2, 0, scale_game_frames(10)); ship->state = pre_hit_state; } else { blend_moby_animation(ship, 2, 0, scale_game_frames(10)); ship->state = BLARG_SHIP_STATE_FIRE_COOLDOWN; - d->firing_phase_timer = truncate_float_to_s32(FUN_L04_001f1978(d->cooldown_duration_seconds * 60.0f)); + d->firing_phase_timer = + truncate_float_to_s32(FUN_L04_001f1978(d->cooldown_duration_seconds * 60.0f)); } break; } diff --git a/src/overlays/l10/mobys/bombthrower_grass.c b/src/overlays/l10/mobys/bombthrower_grass.c index 1d0d286a8d..0351571cef 100644 --- a/src/overlays/l10/mobys/bombthrower_grass.c +++ b/src/overlays/l10/mobys/bombthrower_grass.c @@ -86,7 +86,8 @@ void bombthrower_grass_update(struct Moby *moby) { float launch_position[4]; if (moby->state == BOMBTHROWER_GRASS_STATE_LAUNCH_TIMER_UNINITIALIZED) { *(int *)launch_timer = - scale_game_frames(random_int_between(l10_bombthrower_grass_launch_delay_min_frames, l10_bombthrower_grass_launch_delay_max_frames)); + scale_game_frames(random_int_between(l10_bombthrower_grass_launch_delay_min_frames, + l10_bombthrower_grass_launch_delay_max_frames)); moby->state = BOMBTHROWER_GRASS_STATE_LAUNCH_TIMER_INITIALIZED; } if (fast_dec_timer((int *)launch_timer)) { @@ -106,6 +107,7 @@ void bombthrower_grass_update(struct Moby *moby) { spawn_bombthrower_grass_projectile(moby, launch_position, launch_offset); allocate_voice_for_target_entry(0, 0, (int)moby); *(int *)launch_timer = - scale_game_frames(random_int_between(l10_bombthrower_grass_launch_delay_min_frames, l10_bombthrower_grass_launch_delay_max_frames)); + scale_game_frames(random_int_between(l10_bombthrower_grass_launch_delay_min_frames, + l10_bombthrower_grass_launch_delay_max_frames)); } } diff --git a/src/overlays/l10/mobys/configurable_particle_emitter.c b/src/overlays/l10/mobys/configurable_particle_emitter.c index a7f5b79f50..c81f8c51a5 100644 --- a/src/overlays/l10/mobys/configurable_particle_emitter.c +++ b/src/overlays/l10/mobys/configurable_particle_emitter.c @@ -211,13 +211,16 @@ void emit_burst_spark_particle(void *emission_position, short *timer, short *bur truncate_float_to_s32((float)burst_spark_base_second_frame_count_gp * frame_count_scale); third_frame_count = truncate_float_to_s32((float)burst_spark_base_third_frame_count_gp * frame_count_scale); - initial_spark_color = - fast_tween_color(l10_burst_spark_initial_color_from, l10_burst_spark_initial_color_to, random_float_between(0.0f, 1.0f)); + initial_spark_color = fast_tween_color(l10_burst_spark_initial_color_from, + l10_burst_spark_initial_color_to, + random_float_between(0.0f, 1.0f)); spawn_spark(emission_position, burst_spark_vertical_vector, acc, initial_spark_color, - fast_tween_color(l10_burst_spark_second_color_from, l10_burst_spark_second_color_to, random_float_between(0.0f, 1.0f)), + fast_tween_color(l10_burst_spark_second_color_from, + l10_burst_spark_second_color_to, + random_float_between(0.0f, 1.0f)), frame_count, second_frame_count, third_frame_count, @@ -285,13 +288,16 @@ void emit_timed_spark_particle(void *emission_position, short *timer) { truncate_float_to_s32((float)timed_spark_base_second_frame_count_gp * frame_count_scale); third_frame_count = truncate_float_to_s32((float)timed_spark_base_third_frame_count_gp * frame_count_scale); - initial_spark_color = - fast_tween_color(l10_timed_spark_initial_color_from, l10_timed_spark_initial_color_to, random_float_between(0.0f, 1.0f)); + initial_spark_color = fast_tween_color(l10_timed_spark_initial_color_from, + l10_timed_spark_initial_color_to, + random_float_between(0.0f, 1.0f)); spawn_spark(emission_position, spark_vertical_vector, acc, initial_spark_color, - fast_tween_color(l10_timed_spark_second_color_from, l10_timed_spark_second_color_to, random_float_between(0.0f, 1.0f)), + fast_tween_color(l10_timed_spark_second_color_from, + l10_timed_spark_second_color_to, + random_float_between(0.0f, 1.0f)), frame_count, second_frame_count, third_frame_count, @@ -399,13 +405,16 @@ void emit_height_adjusted_burst_spark_particle(void *emission_position, acc[3] = random_float_between( *(float *)&height_adjusted_spark_random_vector_fourth_component_min_gp, *(float *)&height_adjusted_spark_random_vector_fourth_component_max_gp); - initial_spark_color = - fast_tween_color(l10_height_adjusted_spark_initial_color_from, l10_height_adjusted_spark_initial_color_to, random_float_between(0.0f, 1.0f)); + initial_spark_color = fast_tween_color(l10_height_adjusted_spark_initial_color_from, + l10_height_adjusted_spark_initial_color_to, + random_float_between(0.0f, 1.0f)); spawn_spark(emission_position, spark_first_vector, acc, initial_spark_color, - fast_tween_color(l10_height_adjusted_spark_second_color_from, l10_height_adjusted_spark_second_color_to, random_float_between(0.0f, 1.0f)), + fast_tween_color(l10_height_adjusted_spark_second_color_from, + l10_height_adjusted_spark_second_color_to, + random_float_between(0.0f, 1.0f)), frame_count, second_frame_count, third_frame_count, diff --git a/src/overlays/l10/mobys/darter.c b/src/overlays/l10/mobys/darter.c index bf05b14fc6..b3e1526487 100644 --- a/src/overlays/l10/mobys/darter.c +++ b/src/overlays/l10/mobys/darter.c @@ -372,11 +372,12 @@ void darter_update(Moby *moby) { 0.02f, 0.3f, frame_time * 6.2831855f); - func_L00_0025CC58_2E0630(&moby->rot.y, - 0, - -fast_arc_tan(vector_distance_xy(&moby->pos, &darter_vars->dive_attack_aim_position), - darter_vars->dive_attack_aim_position.z - moby->pos.z), - frame_time * 12.566371f); + func_L00_0025CC58_2E0630( + &moby->rot.y, + 0, + -fast_arc_tan(vector_distance_xy(&moby->pos, &darter_vars->dive_attack_aim_position), + darter_vars->dive_attack_aim_position.z - moby->pos.z), + frame_time * 12.566371f); if (is_value_within_interpolated_window((char *)moby, 20.0f)) { float one = 1.0f; *(int *)&vector_and_collision_scratch[13] = 1; diff --git a/src/overlays/l10/mobys/help_hints.c b/src/overlays/l10/mobys/help_hints.c index 55af1496bd..6c5a3e0b3a 100644 --- a/src/overlays/l10/mobys/help_hints.c +++ b/src/overlays/l10/mobys/help_hints.c @@ -99,13 +99,15 @@ void help_hints_update(Moby *moby) { case HELP_MESSAGE_STATE_CHECK_CONDITIONS: if (is_point_inside_clip_volume(D_0013F3D0_r, conditional_help_config->f0) != 0 && (((HeroPos *)(D_0013F3D0_r))->f200C < 2 || ((HeroPos *)(D_0013F3D0_r))->f200C == 9) && - ((Msg *)D_L10_00179890)->f0 == 0 && ((Msg *)D_L10_00179890)->requested_help_message_id == -1 && + ((Msg *)D_L10_00179890)->f0 == 0 && + ((Msg *)D_L10_00179890)->requested_help_message_id == -1 && *(unsigned short *)(l10_help_message_2710_gate) == 0) { help_request(0x2710, 0x35); } if (is_point_inside_clip_volume(D_0013F3D0_r, conditional_help_config->f4) != 0 && (((HeroPos *)(D_0013F3D0_r))->f200C < 2 || ((HeroPos *)(D_0013F3D0_r))->f200C == 9) && - ((Msg *)D_L10_00179890)->f0 == 0 && ((Msg *)D_L10_00179890)->requested_help_message_id == -1) { + ((Msg *)D_L10_00179890)->f0 == 0 && + ((Msg *)D_L10_00179890)->requested_help_message_id == -1) { if (((Flags_2E9978 *)(alternate_item_available))->f4 == 0) { if (*(unsigned short *)(D_00141B20_r) == 0) { help_request(0x2712, 0x37); @@ -117,14 +119,17 @@ void help_hints_update(Moby *moby) { } } if (D_L10_0015F5C4_vendor == 0 && D_0013D504_r[0] != 0 && - ((Msg *)D_L10_00179890)->f0 == 0 && ((Msg *)D_L10_00179890)->requested_help_message_id == -1 && + ((Msg *)D_L10_00179890)->f0 == 0 && + ((Msg *)D_L10_00179890)->requested_help_message_id == -1 && *(unsigned short *)(l10_help_message_2711_gate) == 0) { help_request(0x2711, 0x36); } - if (is_point_inside_clip_volume(D_0013F3D0_r, conditional_help_config->help_2715_volume_index) != 0 && + if (is_point_inside_clip_volume(D_0013F3D0_r, + conditional_help_config->help_2715_volume_index) != 0 && (((HeroPos *)(D_0013F3D0_r))->f200C < 2 || ((HeroPos *)(D_0013F3D0_r))->f200C == 9) && D_0013D4CB[0] == 0 && ((Msg *)D_L10_00179890)->f0 == 0 && - ((Msg *)D_L10_00179890)->requested_help_message_id == -1 && *(unsigned short *)(D_00141C48) == 0) { + ((Msg *)D_L10_00179890)->requested_help_message_id == -1 && + *(unsigned short *)(D_00141C48) == 0) { help_request(0x2715, 0x5C); } any_active = 0; @@ -157,24 +162,29 @@ void help_hints_update(Moby *moby) { if (D_L10_0015FFD8_c2[conditional_help_config->f20].state == 4) break; if (((Save_2E9978 *)(D_00141968_r))->help_2718_condition_seen != 0) { - elapsed = - scale_game_frames(D_0015EEA4_gp) - ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket * 600; + elapsed = scale_game_frames(D_0015EEA4_gp) - + ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket * 600; if ((int)((float)scale_game_frames(0x12) * 60.0f) < elapsed || ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket * 600 == 0) { help_request(0x2718, 0x6B); break; } - if (scale_game_frames(D_0015EEA4_gp) / 600 > ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket) { - ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket = scale_game_frames(D_0015EEA4_gp) / 600; + if (scale_game_frames(D_0015EEA4_gp) / 600 > + ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket) { + ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket = + scale_game_frames(D_0015EEA4_gp) / 600; } break; } ((Save_2E9978 *)(D_00141968_r))->help_2718_condition_seen++; - if (scale_game_frames(D_0015EEA4_gp) / 600 > ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket) { - ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket = scale_game_frames(D_0015EEA4_gp) / 600; + if (scale_game_frames(D_0015EEA4_gp) / 600 > + ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket) { + ((Save_2E9978 *)(D_00141968_r))->help_2718_last_frame_bucket = + scale_game_frames(D_0015EEA4_gp) / 600; } ((Save_2E9978 *)(D_00141968_r))->help_2718_level_flags = - ((Save_2E9978 *)(D_00141968_r))->help_2718_level_flags | (1 << current_level_index) | 0x80000000; + ((Save_2E9978 *)(D_00141968_r))->help_2718_level_flags | (1 << current_level_index) | + 0x80000000; break; } } diff --git a/src/overlays/l10/mobys/linked_moby_hitbox.c b/src/overlays/l10/mobys/linked_moby_hitbox.c index ae004dff78..272c52488c 100644 --- a/src/overlays/l10/mobys/linked_moby_hitbox.c +++ b/src/overlays/l10/mobys/linked_moby_hitbox.c @@ -253,7 +253,8 @@ void linked_moby_hitbox_update(struct Moby *moby) { target->alpha = FUN_001fa6d0_2c9c70(linked_hitbox_vars->unk44 * now / initial); } } - if ((linked_hitbox_vars->unk8 & 4) == 0 && target != 0 && linked_hitbox_vars->target_state_for_hitbox_removal != -1 && + if ((linked_hitbox_vars->unk8 & 4) == 0 && target != 0 && + linked_hitbox_vars->target_state_for_hitbox_removal != -1 && target->state == linked_hitbox_vars->target_state_for_hitbox_removal) moby->state = LINKED_HITBOX_STATE_REMOVE; if ((linked_hitbox_vars->unk8 & 8) == 0 && diff --git a/src/overlays/l10/mobys/screamer.c b/src/overlays/l10/mobys/screamer.c index b63fa68dcc..977605655f 100644 --- a/src/overlays/l10/mobys/screamer.c +++ b/src/overlays/l10/mobys/screamer.c @@ -454,7 +454,8 @@ void update_screamer_hit_reactions_and_targeting(struct Moby *moby) { screamer_vars->current_target_range = screamer_vars->default_target_range; if (screamer_vars->f174 == 2) { - target_selection_status = ahead_f(screamer_vars->current_target_range, moby, screamer_vars->selected_target_vectors); + target_selection_status = ahead_f( + screamer_vars->current_target_range, moby, screamer_vars->selected_target_vectors); if (target_selection_status != TARGET_SELECTION_DEFAULT_TARGET_EXCLUDED) { LevelCuboid *bp = &l10_cuboids[screamer_vars->target_bounds_cuboid_index]; fast_vec_sub(relative_offset, D_0013F3D0, &bp->pos); @@ -465,19 +466,34 @@ void update_screamer_hit_reactions_and_targeting(struct Moby *moby) { transformed_offset[2] <= -1.0f || 1.0f <= transformed_offset[2]) screamer_vars->f104 = 2; } - } else if (moby->state == SCREAMER_STATE_WAIT_FOR_ACTIVATION && screamer_vars->activation_wait_target_path_index >= 0) { + } else if (moby->state == SCREAMER_STATE_WAIT_FOR_ACTIVATION && + screamer_vars->activation_wait_target_path_index >= 0) { LevelPath *path = l10_paths[screamer_vars->activation_wait_target_path_index]; - target_selection_status = activate_effect_l08( - screamer_vars->current_target_range, moby, screamer_vars->selected_target_vectors, 0, 0, path->points, path->count); - } else if (moby->state != SCREAMER_STATE_WAIT_FOR_ACTIVATION && screamer_vars->active_target_path_index >= 0) { + target_selection_status = activate_effect_l08(screamer_vars->current_target_range, + moby, + screamer_vars->selected_target_vectors, + 0, + 0, + path->points, + path->count); + } else if (moby->state != SCREAMER_STATE_WAIT_FOR_ACTIVATION && + screamer_vars->active_target_path_index >= 0) { LevelPath *path = l10_paths[screamer_vars->active_target_path_index]; - target_selection_status = activate_effect_l08( - screamer_vars->current_target_range, moby, screamer_vars->selected_target_vectors, 0, 0, path->points, path->count); + target_selection_status = activate_effect_l08(screamer_vars->current_target_range, + moby, + screamer_vars->selected_target_vectors, + 0, + 0, + path->points, + path->count); } else { - target_selection_status = ahead_f(screamer_vars->current_target_range, moby, screamer_vars->selected_target_vectors); + target_selection_status = ahead_f( + screamer_vars->current_target_range, moby, screamer_vars->selected_target_vectors); } if (target_selection_status != TARGET_SELECTION_DEFAULT_TARGET_EXCLUDED) { - if (screamer_vars->current_target_range < vector_distance_xy(screamer_vars->navigation_state, screamer_vars->selected_target_vectors)) + if (screamer_vars->current_target_range < + vector_distance_xy(screamer_vars->navigation_state, + screamer_vars->selected_target_vectors)) screamer_vars->f104 = 2; else if (moby->visible == 0) screamer_vars->f104 = 2; diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index d36abfeef0..9960ca9170 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -271,7 +271,8 @@ void toxic_crab_update(Moby2E30F8 *m) { } switch (m->state) { case TOXIC_CRAB_STATE_INITIALIZE: - if (crab_data->remove_in_clank_mode != FALSE && ((unsigned char *)&D_0013E533)[0x2EC1] == 1) { + if (crab_data->remove_in_clank_mode != FALSE && + ((unsigned char *)&D_0013E533)[0x2EC1] == 1) { mark_moby_for_removal(m); return; } @@ -322,11 +323,16 @@ void toxic_crab_update(Moby2E30F8 *m) { crab_data->f1A0 = *(float *)&D_L10_00161E40_gp; break; case TOXIC_CRAB_STATE_WAIT_FOR_ACTIVATION: - FUN_L00_00258278( - (char *)m, &crab_data->heading_turn_step, crab_data->home_position_and_heading[3], 0.02f, 0.3f, frame_time * 6.2831855f); + FUN_L00_00258278((char *)m, + &crab_data->heading_turn_step, + crab_data->home_position_and_heading[3], + 0.02f, + 0.3f, + frame_time * 6.2831855f); if (crab_data->activation_dependency_moby_index != -1) { char *moby_instance_array_base = D_L10_0015FFD8; - Moby2E30F8 *p = (Moby2E30F8 *)(moby_instance_array_base + (crab_data->activation_dependency_moby_index << 8)); + Moby2E30F8 *p = (Moby2E30F8 *)(moby_instance_array_base + + (crab_data->activation_dependency_moby_index << 8)); if (p == 0 || p->state == MOBY_STATE_MARKED_FOR_REMOVAL || p->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER || ((*(int *)(((char *)&D_0014C190) + @@ -340,7 +346,8 @@ void toxic_crab_update(Moby2E30F8 *m) { } } } - if (crab_data->tracked_target_selection_status != TOXIC_CRAB_POINT_AHEAD_NO_TARGET || crab_data->activation_override_enabled != 0) { + if (crab_data->tracked_target_selection_status != TOXIC_CRAB_POINT_AHEAD_NO_TARGET || + crab_data->activation_override_enabled != 0) { m->state = TOXIC_CRAB_STATE_ACTIVATE; crab_data->behavior_timer_frames = scale_game_frames(1); if (m->group_index != 0xFF) { @@ -385,12 +392,14 @@ void toxic_crab_update(Moby2E30F8 *m) { } break; case TOXIC_CRAB_STATE_FACE_TRACKED_POSITION: { - float ang = fast_arc_tan(crab_data->tracked_position_x - m->pos[0], crab_data->tracked_position_y - m->pos[1]); - FUN_L00_00258278((char *)m, &crab_data->heading_turn_step, ang, 0.02f, 0.3f, frame_time * 6.2831855f); + float ang = fast_arc_tan(crab_data->tracked_position_x - m->pos[0], + crab_data->tracked_position_y - m->pos[1]); + FUN_L00_00258278( + (char *)m, &crab_data->heading_turn_step, ang, 0.02f, 0.3f, frame_time * 6.2831855f); if (crab_data->tracked_target_selection_status != TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { m->state = TOXIC_CRAB_STATE_WAIT_TO_PURSUE; - crab_data->behavior_timer_frames = - truncate_float_to_s32(random_float_between(0.0f, (float)crab_data->pursuit_delay_upper_bound_frames)); + crab_data->behavior_timer_frames = truncate_float_to_s32( + random_float_between(0.0f, (float)crab_data->pursuit_delay_upper_bound_frames)); } break; } @@ -421,18 +430,23 @@ void toxic_crab_update(Moby2E30F8 *m) { target_distance = fast_vec_dist(m->pos, target_moby + 0x10); if (target_distance > (MOBY(target_moby)->oclass == 0x359 ? 2.0f : 3.57f)) { - approach_value(&crab_data->horizontal_movement_step_limit, crab_data->movement_speed * frame_time, frame_time_sq * 8.0f); + approach_value(&crab_data->horizontal_movement_step_limit, + crab_data->movement_speed * frame_time, + frame_time_sq * 8.0f); } else { - approach_value( - &crab_data->horizontal_movement_step_limit, crab_data->movement_speed * frame_time * 0.3f, frame_time_sq * 20.0f); + approach_value(&crab_data->horizontal_movement_step_limit, + crab_data->movement_speed * frame_time * 0.3f, + frame_time_sq * 20.0f); } *(OvlQuad *)pre_movement_position = *(OvlQuad *)m->pos; if (see && absolute_float(target_distance - (MOBY(target_moby)->oclass == 0x359 ? 2.0f : 3.57f)) < 0.35f) { - approach_value(&crab_data->horizontal_movement_step_limit, 0.0f, frame_time_sq * 30.0f); + approach_value( + &crab_data->horizontal_movement_step_limit, 0.0f, frame_time_sq * 30.0f); } else if (crab_data->pursuit_movement_blocked != 0) { - approach_value(&crab_data->horizontal_movement_step_limit, 0.0f, frame_time_sq * 10.0f); + approach_value( + &crab_data->horizontal_movement_step_limit, 0.0f, frame_time_sq * 10.0f); } ang = fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], MOBY(target_moby)->pos.y - m->pos[1]); @@ -445,8 +459,12 @@ void toxic_crab_update(Moby2E30F8 *m) { } if (toxic_crab_pursuit_heading_threshold_degrees_gp * DEG_TO_RAD < diff || crab_data->pursuit_movement_blocked == 0) { - FUN_L00_00258278( - (char *)m, &crab_data->heading_turn_step, ang, 0.02f, 0.3f, frame_time * 6.2831855f); + FUN_L00_00258278((char *)m, + &crab_data->heading_turn_step, + ang, + 0.02f, + 0.3f, + frame_time * 6.2831855f); } aim = compute_toxic_crab_group_approach_angle((struct Moby *)m); v[0] = fast_cos(aim) * (MOBY(target_moby)->oclass == 0x359 ? 2.0f : 3.57f); @@ -482,7 +500,8 @@ void toxic_crab_update(Moby2E30F8 *m) { } } } - r = move_moby_with_ground_and_collision_checks(m, &crab_data->movement_size_scale_fixed, dir, out, 1.0f); + r = move_moby_with_ground_and_collision_checks( + m, &crab_data->movement_size_scale_fixed, dir, out, 1.0f); m->heading_radians = rot; if (r & 3) { if (vector_distance_xy(m->pos, pre_movement_position) < @@ -492,7 +511,9 @@ void toxic_crab_update(Moby2E30F8 *m) { crab_data->pursuit_movement_blocked = 0; } if (D_L10_0015F5CC % 7 == 0 && crab_data->behavior_timer_frames == 0) { - if (vector_distance_xy(crab_data->pursuit_progress_sample_position, m->pos) < crab_data->horizontal_movement_step_limit && + if (vector_distance_xy(crab_data->pursuit_progress_sample_position, + m->pos) < + crab_data->horizontal_movement_step_limit && diff <= toxic_crab_pursuit_heading_threshold_degrees_gp * DEG_TO_RAD) { m->state = TOXIC_CRAB_STATE_PAUSE_PURSUIT; crab_data->behavior_timer_frames = scale_game_frames(0x3C); @@ -508,7 +529,8 @@ void toxic_crab_update(Moby2E30F8 *m) { crab_data->pursuit_movement_blocked = 0; } if (m->state == TOXIC_CRAB_STATE_PURSUE_TARGET && - fast_dec_timer(&crab_data->behavior_timer_frames) && 0.0f < crab_data->horizontal_movement_step_limit && + fast_dec_timer(&crab_data->behavior_timer_frames) && + 0.0f < crab_data->horizontal_movement_step_limit && crab_data->pursuit_movement_blocked == 0 && m->anim == 1) { blend_moby_animation(m, 3, 0, scale_game_frames(7)); } @@ -527,7 +549,8 @@ void toxic_crab_update(Moby2E30F8 *m) { { float home = fast_vec_dist(m->pos, crab_data->home_position_and_heading); if ((hero.vehicle_mode == HERO_VEHICLE_MODE_CLANK ? 1.0f : 30.0f) < home || - crab_data->tracked_target_selection_status == TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { + crab_data->tracked_target_selection_status == + TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { m->state = TOXIC_CRAB_STATE_RETURN_HOME; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); } else if (vector_distance_xy(m->pos, target_moby + 0x10) < @@ -610,7 +633,8 @@ void toxic_crab_update(Moby2E30F8 *m) { fr = compute_interpolated_record_value(m); ang = fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], MOBY(target_moby)->pos.y - m->pos[1]); - FUN_L00_00258278((char *)m, &crab_data->heading_turn_step, ang, 0.03f, 0.3f, frame_time * 6.2831855f); + FUN_L00_00258278( + (char *)m, &crab_data->heading_turn_step, ang, 0.03f, 0.3f, frame_time * 6.2831855f); if (m->anim >= 6 && m->anim <= 7 && 4.0f <= fr && fr <= 7.0f) { Hit2E30F8 hit; float v[4]; @@ -666,20 +690,27 @@ void toxic_crab_update(Moby2E30F8 *m) { float rot; float ang; - approach_value( - &crab_data->horizontal_movement_step_limit, crab_data->movement_speed * 3.0f * frame_time, frame_time_sq * 20.0f); + approach_value(&crab_data->horizontal_movement_step_limit, + crab_data->movement_speed * 3.0f * frame_time, + frame_time_sq * 20.0f); ang = fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], MOBY(target_moby)->pos.y - m->pos[1]); - FUN_L00_00258278( - (char *)m, &crab_data->heading_turn_step, ang, 0.02f, 0.3f, frame_time * 6.2831855f); + FUN_L00_00258278((char *)m, + &crab_data->heading_turn_step, + ang, + 0.02f, + 0.3f, + frame_time * 6.2831855f); rot = m->heading_radians; - m->heading_radians = fast_add_rotations(fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], - MOBY(target_moby)->pos.y - m->pos[1]), - 3.14159f); + m->heading_radians = + fast_add_rotations(fast_arc_tan(MOBY(target_moby)->pos.x - m->pos[0], + MOBY(target_moby)->pos.y - m->pos[1]), + 3.14159f); dir[0] = fast_cos(m->heading_radians) * 2.0f; dir[1] = fast_sin(m->heading_radians) * 2.0f; dir[2] = 0.0f; - move_moby_with_ground_and_collision_checks(m, &crab_data->movement_size_scale_fixed, dir, out, 1.0f); + move_moby_with_ground_and_collision_checks( + m, &crab_data->movement_size_scale_fixed, dir, out, 1.0f); m->heading_radians = rot; if (see) { if (fast_dec_timer(&crab_data->behavior_timer_frames) || @@ -704,10 +735,17 @@ void toxic_crab_update(Moby2E30F8 *m) { float out[4]; float ang; - approach_value(&crab_data->horizontal_movement_step_limit, crab_data->movement_speed * frame_time, frame_time_sq * 5.0f); - ang = fast_arc_tan(crab_data->home_position_and_heading[0] - m->pos[0], crab_data->home_position_and_heading[1] - m->pos[1]); - func_L00_002592B0_b( - (char *)m, ang, 0.02f, 0.3f, frame_time * 6.2831855f, &crab_data->heading_turn_step); + approach_value(&crab_data->horizontal_movement_step_limit, + crab_data->movement_speed * frame_time, + frame_time_sq * 5.0f); + ang = fast_arc_tan(crab_data->home_position_and_heading[0] - m->pos[0], + crab_data->home_position_and_heading[1] - m->pos[1]); + func_L00_002592B0_b((char *)m, + ang, + 0.02f, + 0.3f, + frame_time * 6.2831855f, + &crab_data->heading_turn_step); if (0.87266463f < fast_difference_between_rotations(ang, m->heading_radians)) { float lim = crab_data->movement_speed * frame_time * 0.25f; if (lim < crab_data->horizontal_movement_step_limit) { @@ -717,13 +755,15 @@ void toxic_crab_update(Moby2E30F8 *m) { dir[0] = fast_cos(m->heading_radians) * 2.0f; dir[1] = fast_sin(m->heading_radians) * 2.0f; dir[2] = 0.0f; - move_moby_with_ground_and_collision_checks(m, &crab_data->movement_size_scale_fixed, dir, out, 1.0f); + move_moby_with_ground_and_collision_checks( + m, &crab_data->movement_size_scale_fixed, dir, out, 1.0f); if (fast_vec_dist(m->pos, crab_data->home_position_and_heading) < 1.0f) { m->state = TOXIC_CRAB_STATE_FACE_TRACKED_POSITION; if (m->anim != 1) { blend_moby_animation(m, 1, 0, scale_game_frames(0x14)); } - } else if (crab_data->tracked_target_selection_status != TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { + } else if (crab_data->tracked_target_selection_status != + TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; crab_data->pursuit_movement_blocked = 0; qcopy(crab_data->pursuit_progress_sample_position, m->pos); @@ -781,8 +821,12 @@ void toxic_crab_update(Moby2E30F8 *m) { trooper_set_knockback(crab_data->knockback_motion_xy, 2.0f, 1.5f); crab_data->fC0 = 7.0f; crab_data->fC4 = 13.0f; - func_L00_0025D5B0_b( - m, crab_data->knockback_motion_xy, 0xD, 1, 0, fast_add_rotations(m->heading_radians, 3.1415927f)); + func_L00_0025D5B0_b(m, + crab_data->knockback_motion_xy, + 0xD, + 1, + 0, + fast_add_rotations(m->heading_radians, 3.1415927f)); crab_data->b67 = 0xFA; FUN_L00_0025d458(m, (short *)crab_data->q60); FUN_L00_00257470(m, 0, -1); @@ -1164,7 +1208,8 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { moby_data->fC0 = 8.0f; moby_data->fC4 = 10.0f; *(u128_2E52B0 *)&vA = *(u128_2E52B0 *)&hit_record->pos; - trooper_knockback_arc(&vA, &fx, &moby_data->knockback_xy_scale, &moby_data->knockback_z_scale); + trooper_knockback_arc( + &vA, &fx, &moby_data->knockback_xy_scale, &moby_data->knockback_z_scale); func_L00_0025D5B0_2E52B0(moby, moby_data->a70, 9, 1, 0, fx); moby_data->b67 = 0xFA; trooper_anim_update(moby, moby_data->a60); @@ -1180,7 +1225,8 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { moby_data->fC0 = 3.5f; moby_data->fC4 = 7.0f; *(u128_2E52B0 *)&vA = *(u128_2E52B0 *)&hit_record->pos; - trooper_knockback_arc(&vA, &fx, &moby_data->knockback_xy_scale, &moby_data->knockback_z_scale); + trooper_knockback_arc( + &vA, &fx, &moby_data->knockback_xy_scale, &moby_data->knockback_z_scale); func_L00_0025D5B0_2E52B0( moby, moby_data->a70, 9, 1, 0, fast_arc_tan(hit_record->pos.x, hit_record->pos.y)); moby_data->b67 = 0xFA; @@ -1236,7 +1282,8 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { l10_paths[moby_data->target_path_index]->points, l10_paths[moby_data->target_path_index]->count); } - if (moby->state != TOXIC_CRAB_STATE_WAIT_FOR_ACTIVATION && moby_data->target_selection_status == POINT_AHEAD_NO_TARGET) { + if (moby->state != TOXIC_CRAB_STATE_WAIT_FOR_ACTIVATION && + moby_data->target_selection_status == POINT_AHEAD_NO_TARGET) { moby_data->target_loss_frames++; if (scale_game_frames(300) < moby_data->target_loss_frames) { if (1.0f < fast_vec_dist(&moby->pos, &moby_data->a170)) { diff --git a/src/overlays/l11/hero/hero_set_state.c b/src/overlays/l11/hero/hero_set_state.c index d7c0fd1c8d..aba394e346 100644 --- a/src/overlays/l11/hero/hero_set_state.c +++ b/src/overlays/l11/hero/hero_set_state.c @@ -75,10 +75,12 @@ int hero_set_state(int requested_state, int animation_update_mode) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_update_mode != HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || + animation_update_mode != HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE)) return 0; } - if ((D_L11_0015F5C4 == 2 || D_L11_0015F5C4 == 6) && animation_update_mode != HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE) + if ((D_L11_0015F5C4 == 2 || D_L11_0015F5C4 == 6) && + animation_update_mode != HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l11/mobys/child_sets_controller.c b/src/overlays/l11/mobys/child_sets_controller.c index fac074eeb3..713f738e9d 100644 --- a/src/overlays/l11/mobys/child_sets_controller.c +++ b/src/overlays/l11/mobys/child_sets_controller.c @@ -198,8 +198,12 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { break; case CHILD_SETS_STATE_UNFOLD_AND_BLEND_POSES: if (l11_child_set_fold_rotation_x_progress < 1.0f) { - advance_accelerated_scalar( - &l11_child_set_fold_rotation_x_progress, &l11_child_set_fold_rotation_x_progress_step, 1.0f, frame_time_sq, frame_time_sq, frame_time); + advance_accelerated_scalar(&l11_child_set_fold_rotation_x_progress, + &l11_child_set_fold_rotation_x_progress_step, + 1.0f, + frame_time_sq, + frame_time_sq, + frame_time); } if (0.9f < l11_child_set_fold_rotation_x_progress && D_L11_00161EC8 == 0.0f) { allocate_voice_for_target_entry(1, 0, child_sets_controller); @@ -231,7 +235,8 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { frame_time_sq + frame_time_sq, frame_time + frame_time); } - if (1.0f <= l11_even_source_child_rotation_x_progress && l11_even_attached_child_rotation_y_progress < 1.0f) { + if (1.0f <= l11_even_source_child_rotation_x_progress && + l11_even_attached_child_rotation_y_progress < 1.0f) { advance_accelerated_scalar(&l11_even_attached_child_rotation_y_progress, &l11_even_attached_child_rotation_y_progress_step, 1.0f, @@ -239,7 +244,8 @@ void child_sets_controller_update(struct Moby *child_sets_controller) { frame_time_sq + frame_time_sq, frame_time + frame_time); } - if (0.9f < l11_even_attached_child_rotation_y_progress && l11_final_child_axis0_spacing_progress < 1.0f) { + if (0.9f < l11_even_attached_child_rotation_y_progress && + l11_final_child_axis0_spacing_progress < 1.0f) { advance_accelerated_scalar(&l11_final_child_axis0_spacing_progress, &l11_final_child_axis0_spacing_progress_step, 1.0f, @@ -329,8 +335,10 @@ void update_child_set_poses(struct Moby *parent_moby) { for (i = 0; i < 6; i++) { int s = (i >= 3) ? 1 : -1; float ang = - (float)(i % 3) * 0.5235988f - - (child_set_fold_rotation_x_degrees_gp * (1.0f - l11_child_set_fold_rotation_x_progress) + 30.0f) * 0.017453292f; + (float)(i % 3) * 0.5235988f - (child_set_fold_rotation_x_degrees_gp * + (1.0f - l11_child_set_fold_rotation_x_progress) + + 30.0f) * + 0.017453292f; qcopy_nc(&l11_three_per_side_child_mobys[i]->rot, &parent_moby->rot); l11_three_per_side_child_mobys[i]->rot.z = fast_add_rotations(l11_three_per_side_child_mobys[i]->rot.z, (float)s * 1.5707964f); @@ -358,8 +366,10 @@ void update_child_set_poses(struct Moby *parent_moby) { int s = (j >= 2) ? 1 : -1; int k = (j & 1) ? -1 : 1; float ang = - (float)(j % 2) * 0.5235988f - - (child_set_fold_rotation_x_degrees_gp * (1.0f - l11_child_set_fold_rotation_x_progress) + 15.0f) * 0.017453292f; + (float)(j % 2) * 0.5235988f - (child_set_fold_rotation_x_degrees_gp * + (1.0f - l11_child_set_fold_rotation_x_progress) + + 15.0f) * + 0.017453292f; float r; qcopy_nc(&D_L11_00161F20[j]->rot, &parent_moby->rot); D_L11_00161F20[j]->rot.z = @@ -402,7 +412,9 @@ void update_child_set_poses(struct Moby *parent_moby) { &child_placement_vector_scratch); qcopy(&D_L11_00161F30[attached_child_index]->rot, &D_L11_00161F20[attached_child_index]->rot); - rotation_y_progress = (attached_child_index & 1) ? D_L11_00161ED0 : l11_even_attached_child_rotation_y_progress; + rotation_y_progress = (attached_child_index & 1) + ? D_L11_00161ED0 + : l11_even_attached_child_rotation_y_progress; D_L11_00161F30[attached_child_index]->rot.y = fast_add_rotations( D_L11_00161F30[attached_child_index]->rot.y, -(attached_child_rotation_y_degrees_gp * 0.017453292f) * rotation_y_progress); @@ -415,8 +427,8 @@ void update_child_set_poses(struct Moby *parent_moby) { if (final_child_index >= 2) { sgn = 1.0f; } - signed_axis0_offset = - (float)(final_child_index & 1) * 7.5f + 3.75f + (1.0f - l11_final_child_axis0_spacing_progress) * 13.25f; + signed_axis0_offset = (float)(final_child_index & 1) * 7.5f + 3.75f + + (1.0f - l11_final_child_axis0_spacing_progress) * 13.25f; if (20.0f < signed_axis0_offset) { signed_axis0_offset = 20.0f; } diff --git a/src/overlays/l11/mobys/jet_fighter.c b/src/overlays/l11/mobys/jet_fighter.c index d2f0419d08..18982c3264 100644 --- a/src/overlays/l11/mobys/jet_fighter.c +++ b/src/overlays/l11/mobys/jet_fighter.c @@ -753,9 +753,9 @@ typedef struct { extern unsigned short D_00141C10 NOT_SDA; extern float D_L11_0016D4F0 NOT_SDA; extern char jet_fighter_collision_query_result[] __asm__("D_L11_00174840"); -int l11_jet_fighter_startup_acceleration_frame_threshold __asm__("D_L11_00161FF0") = 120; -int l11_jet_fighter_steering_enable_frame_threshold __asm__("D_L11_00162004") = 5; -int l11_jet_fighter_collision_damage_cooldown_frames __asm__("D_L11_0016214C") = 10; +int l11_jet_fighter_startup_acceleration_frame_threshold __asm__("D_L11_00161FF0") = 120; +int l11_jet_fighter_steering_enable_frame_threshold __asm__("D_L11_00162004") = 5; +int l11_jet_fighter_collision_damage_cooldown_frames __asm__("D_L11_0016214C") = 10; #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_15.h" @@ -797,23 +797,31 @@ extern float l11_jet_fighter_vertical_steering_spring_damping_coefficient __asm_ #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_9.h" -extern float l11_jet_fighter_rotation_x_spring_error_gain __asm__("D_L11_001620BC") __attribute__((sda)); -extern float l11_jet_fighter_rotation_x_spring_damping_coefficient __asm__("D_L11_001620C0") __attribute__((sda)); +extern float l11_jet_fighter_rotation_x_spring_error_gain __asm__("D_L11_001620BC") + __attribute__((sda)); +extern float l11_jet_fighter_rotation_x_spring_damping_coefficient __asm__("D_L11_001620C0") + __attribute__((sda)); #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_8.h" -extern float l11_jet_fighter_camera_rotation_x_spring_error_gain __asm__("D_L11_001620E0") __attribute__((sda)); -extern float l11_jet_fighter_camera_rotation_x_spring_damping_coefficient __asm__("D_L11_001620E4") __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_x_spring_error_gain __asm__("D_L11_001620E0") + __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_x_spring_damping_coefficient __asm__("D_L11_001620E4") + __attribute__((sda)); #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_7.h" -extern float l11_jet_fighter_camera_rotation_y_spring_error_gain __asm__("D_L11_001620EC") __attribute__((sda)); -extern float l11_jet_fighter_camera_rotation_y_spring_damping_coefficient __asm__("D_L11_001620F0") __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_y_spring_error_gain __asm__("D_L11_001620EC") + __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_y_spring_damping_coefficient __asm__("D_L11_001620F0") + __attribute__((sda)); #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_6.h" -extern float l11_jet_fighter_camera_rotation_z_spring_error_gain __asm__("D_L11_001620F8") __attribute__((sda)); -extern float l11_jet_fighter_camera_rotation_z_spring_damping_coefficient __asm__("D_L11_001620FC") __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_z_spring_error_gain __asm__("D_L11_001620F8") + __attribute__((sda)); +extern float l11_jet_fighter_camera_rotation_z_spring_damping_coefficient __asm__("D_L11_001620FC") + __attribute__((sda)); #include "rnc/overlay/l11/mobys/jet_fighter_data/update_player_ship_flight_5.h" @@ -1183,7 +1191,8 @@ void update_player_ship_flight(struct Moby *ship_moby, ShipVars_2838 *ship_vars) 0); ship_moby->state = JET_FIGHTER_STATE_WAIT_FOR_RESPAWN; } - ship_vars->collision_damage_cooldown_timer_frames = l11_jet_fighter_collision_damage_cooldown_frames; + ship_vars->collision_damage_cooldown_timer_frames = + l11_jet_fighter_collision_damage_cooldown_frames; } } } @@ -1455,7 +1464,8 @@ void jet_fighter_update(struct Moby *moby) { update_player_ship_flight(moby, ship_vars); { int alive = count_listed_blarg_ships_in_state_5(ship_vars->blarg_ship_list_index); - if (ship_vars->visible_listed_moby_count != 0 && alive < 5 - ship_vars->active_listed_moby_count && + if (ship_vars->visible_listed_moby_count != 0 && + alive < 5 - ship_vars->active_listed_moby_count && fast_dec_timer(&ship_vars->blarg_ship_activation_timer_frames) && activate_listed_blarg_ship(ship_vars->blarg_ship_list_index)) { ship_vars->blarg_ship_activation_timer_frames = scale_game_frames(0xF0); diff --git a/src/overlays/l11/mobys/link_triggered_moby_motion.c b/src/overlays/l11/mobys/link_triggered_moby_motion.c index 974dfaa0c3..657eec76f9 100644 --- a/src/overlays/l11/mobys/link_triggered_moby_motion.c +++ b/src/overlays/l11/mobys/link_triggered_moby_motion.c @@ -79,7 +79,8 @@ void link_triggered_moby_motion_update(struct Moby *moving_moby) { if (linked_moby->oclass == 0x33E && linked_moby->command != 0) { go: moving_moby->state = LINKED_MOTION_STATE_MOVE_ALONG_LOCAL_AXIS; - ((Rec57 *)(private_data->unk14 + (int)(alternate_item_available)))->motion_triggered = 1; + ((Rec57 *)(private_data->unk14 + (int)(alternate_item_available)))->motion_triggered = + 1; allocate_voice_for_target_entry(0, 0, moving_moby); } break; diff --git a/src/overlays/l11/mobys/psytcopus.c b/src/overlays/l11/mobys/psytcopus.c index 2c46c44eab..8adb389278 100644 --- a/src/overlays/l11/mobys/psytcopus.c +++ b/src/overlays/l11/mobys/psytcopus.c @@ -41,16 +41,16 @@ struct PokiPathVars { u8 unk5A; /* 0x5A */ u8 pad_5B[5]; u8 unk60[7]; /* 0x60: passed to trooper_anim_update / trooper_anim_finish */ - u8 hit_reaction_channel_target; /* 0x67 */ + u8 hit_reaction_channel_target; /* 0x67 */ u8 pad_68[8]; u8 unk70[0x10]; /* 0x70: passed to trooper_start_knockback / step_moby_motion */ f32 unk80; /* 0x80 */ - f32 knockback_speed_approach_step; /* 0x84 */ - f32 unk88; /* 0x88 */ - f32 knockback_vertical_speed; /* 0x8C */ - s32 knockback_collision_radius; /* 0x90 */ - s32 unk94; /* 0x94 */ - f32 unk98; /* 0x98 */ + f32 knockback_speed_approach_step; /* 0x84 */ + f32 unk88; /* 0x88 */ + f32 knockback_vertical_speed; /* 0x8C */ + s32 knockback_collision_radius; /* 0x90 */ + s32 unk94; /* 0x94 */ + f32 unk98; /* 0x98 */ u8 pad_9C[0x11]; u8 unkAD; /* 0xAD */ u8 pad_AE[0x12]; @@ -214,7 +214,8 @@ void psytcopus_update(struct Moby *psytcopus) { is_value_within_interpolated_window(psytcopus, 33.0f) != 0) { fast_vec_normalize( &projectile_vector_scratch, &psytcopus->rot_row0, frame_time * 30.0f); - set_moby_state_two_data_and_timer(psytcopus_vars->held_projectile, &projectile_vector_scratch); + set_moby_state_two_data_and_timer(psytcopus_vars->held_projectile, + &projectile_vector_scratch); psytcopus_vars->held_projectile = 0; } if (psytcopus->anim_flags & 2) { @@ -331,7 +332,8 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { case HIT_REACTION_KNOCKBACK_WITH_SOURCE_RELATIVE_HEADING: case HIT_REACTION_KNOCKBACK_WITH_SOURCE_RELATIVE_HEADING_AND_TIMER_EXTENSION: psytcopus_vars->unk88 = psytcopus_hurt_knockback_base_horizontal_speed_gp * frame_time; - psytcopus_vars->knockback_vertical_speed = psytcopus_hurt_knockback_base_vertical_speed_gp * frame_time; + psytcopus_vars->knockback_vertical_speed = + psytcopus_hurt_knockback_base_vertical_speed_gp * frame_time; psytcopus_vars->unkC0 = 3.0f; psytcopus_vars->unkC4 = 6.0f; source_to_psytcopus_heading = fast_arc_tan( @@ -357,7 +359,8 @@ void handle_psytcopus_hits(struct Moby *psytcopus) { psytcopus->flags &= 0xEFFF; psytcopus_vars->unk80 = psytcopus_knockback_base_gravity_gp * frame_time_sq; psytcopus_vars->unk88 = psytcopus_death_knockback_base_horizontal_speed_gp * frame_time; - psytcopus_vars->knockback_vertical_speed = psytcopus_death_knockback_base_vertical_speed_gp * frame_time; + psytcopus_vars->knockback_vertical_speed = + psytcopus_death_knockback_base_vertical_speed_gp * frame_time; psytcopus_vars->unkC0 = 4.0f; psytcopus_vars->unkC4 = 10.0f; source_to_psytcopus_heading = fast_arc_tan( diff --git a/src/overlays/l11/mobys/puffoid.c b/src/overlays/l11/mobys/puffoid.c index b61f910545..797fea865b 100644 --- a/src/overlays/l11/mobys/puffoid.c +++ b/src/overlays/l11/mobys/puffoid.c @@ -87,12 +87,12 @@ typedef struct { u8 pad23C[8]; s32 unk244; /* 0x244 */ u8 pad248[4]; - f32 chase_heading_offset_radians; /* 0x24C: heading offset for FUN_L11_00315f58 */ - f32 yaw_turn_velocity; /* 0x250: turn speed */ - s32 carrier; /* 0x254: moby index of the carrier, or < 0 */ - f32 carrier_jump_local_x_threshold; /* 0x258 */ - s32 point; /* 0x25C: current path point */ - f32 wander_destination[4]; /* 0x260 */ + f32 chase_heading_offset_radians; /* 0x24C: heading offset for FUN_L11_00315f58 */ + f32 yaw_turn_velocity; /* 0x250: turn speed */ + s32 carrier; /* 0x254: moby index of the carrier, or < 0 */ + f32 carrier_jump_local_x_threshold; /* 0x258 */ + s32 point; /* 0x25C: current path point */ + f32 wander_destination[4]; /* 0x260 */ u8 pad270[0x10]; u8 unk280[0x10]; /* 0x280 */ } CreatureVars_4318; @@ -268,7 +268,9 @@ void puffoid_update(struct Moby *moby) { puffoid_vars->wander_destination[0] = fast_cos(a) * wander_radius; puffoid_vars->wander_destination[1] = fast_sin(a) * wander_radius; puffoid_vars->wander_destination[2] = 0.0f; - fast_vec_add(puffoid_vars->wander_destination, puffoid_vars->wander_destination, puffoid_vars->home); + fast_vec_add(puffoid_vars->wander_destination, + puffoid_vars->wander_destination, + puffoid_vars->home); moby->state = PUFFOID_STATE_WANDER_NEAR_HOME; if (moby->prev_seq != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(10)); @@ -276,7 +278,8 @@ void puffoid_update(struct Moby *moby) { } break; case PUFFOID_STATE_WANDER_NEAR_HOME: - update_moby_target_heading_and_conditional_movement((char *)moby, puffoid_vars->wander_destination); + update_moby_target_heading_and_conditional_movement((char *)moby, + puffoid_vars->wander_destination); if (puffoid_vars->unk214 != 2) { puffoid_vars->chase_heading_offset_radians = random_float_between(-puffoid_chase_heading_offset_limit_degrees_gp, @@ -691,20 +694,20 @@ struct L11PatrolVars { s32 retimer; /* 0x38: nonzero restarts the timer at 0x244 */ u8 pad3C[0xD4]; u8 move[7]; /* 0x110: movement state (trooper_anim_update / trooper_anim_finish) */ - u8 hit_flash_red_target; /* 0x117 */ + u8 hit_flash_red_target; /* 0x117 */ u8 pad118[8]; - u8 unk120[0x10]; /* 0x120 */ - f32 unk130; /* 0x130 */ - f32 unk134; /* 0x134 */ - f32 unk138; /* 0x138 */ - f32 unk13C; /* 0x13C */ - s32 unk140; /* 0x140 */ - s32 unk144; /* 0x144 */ - f32 knockback_collision_z_offset; /* 0x148 */ + u8 unk120[0x10]; /* 0x120 */ + f32 unk130; /* 0x130 */ + f32 unk134; /* 0x134 */ + f32 unk138; /* 0x138 */ + f32 unk13C; /* 0x13C */ + s32 unk140; /* 0x140 */ + s32 unk144; /* 0x144 */ + f32 knockback_collision_z_offset; /* 0x148 */ u8 pad14C[0x11]; u8 unk15D; /* 0x15D */ u8 pad15E[0x12]; - f32 knockback_apex_animation_frame; /* 0x170 */ + f32 knockback_apex_animation_frame; /* 0x170 */ f32 knockback_landing_animation_frame; /* 0x174 */ u8 pad178[0x2C]; f32 horizontal_movement_step_limit; /* 0x1A4 */ diff --git a/src/overlays/l11/mobys/resort_owner.c b/src/overlays/l11/mobys/resort_owner.c index c11b072006..8dd390ef9b 100644 --- a/src/overlays/l11/mobys/resort_owner.c +++ b/src/overlays/l11/mobys/resort_owner.c @@ -627,7 +627,8 @@ void set_resort_owner_state(struct Moby *moby, unsigned char state) { case RESORT_OWNER_MOVE_TO_PATH_POINT: if (moby->prev_seq != 3) FUN_00212f90(moby, 3, 0, scale_game_frames(0x14)); - moby_vars->horizontal_step_distance = resort_owner_distant_follow_and_path_speed_gp * frame_time; + moby_vars->horizontal_step_distance = + resort_owner_distant_follow_and_path_speed_gp * frame_time; break; case RESORT_OWNER_JUMP_TO_TARGET: if (moby->prev_seq != 4) @@ -647,7 +648,8 @@ void set_resort_owner_state(struct Moby *moby, unsigned char state) { o = (char *)D_L11_0015FFD8; o += p << 8; qcopy(moby_vars->unk120, o + 0x10); - transform_vector_by_basis(gate_target_offset, &l11_resort_owner_gate_attachment_local_x_offset, o + 0xC0); + transform_vector_by_basis( + gate_target_offset, &l11_resort_owner_gate_attachment_local_x_offset, o + 0xC0); fast_vec_add(moby_vars->unk120, moby_vars->unk120, gate_target_offset); } break; @@ -670,7 +672,9 @@ void set_resort_owner_state(struct Moby *moby, unsigned char state) { o = (char *)D_L11_0015FFD8; o += p << 8; qcopy(moby_vars->unk120, o + 0x10); - transform_vector_by_basis(gate_target_offset, &l11_resort_owner_gate_departure_target_local_x_offset, o + 0xC0); + transform_vector_by_basis(gate_target_offset, + &l11_resort_owner_gate_departure_target_local_x_offset, + o + 0xC0); fast_vec_add(moby_vars->unk120, moby_vars->unk120, gate_target_offset); } break; @@ -806,8 +810,8 @@ int try_find_resort_owner_jump_target(struct Moby *moby, float *jump_target_posi fast_vec_normalize(candidate_position, candidate_position, 4.0f); fast_vec_add(candidate_position, candidate_position, pos); { - int *path_entry = - (int *)l11_paths[*(int *)((u8 *)pvars - (-(*(int *)&pvars->current_path_leg * 4)) + 0x60)]; + int *path_entry = (int *) + l11_paths[*(int *)((u8 *)pvars - (-(*(int *)&pvars->current_path_leg * 4)) + 0x60)]; if (point_in_path_xy(candidate_position, path_entry + 4, *path_entry)) { candidate_position[2] += 5.0f; landing_ground_height = func_L00_0025A748_f(candidate_position); diff --git a/src/overlays/l11/mobys/teleporter.c b/src/overlays/l11/mobys/teleporter.c index 0a9eb90cef..73988d659b 100644 --- a/src/overlays/l11/mobys/teleporter.c +++ b/src/overlays/l11/mobys/teleporter.c @@ -285,7 +285,8 @@ void draw_teleporter_ring(struct Moby *moby) { copy_matrix_rotation(matrix, &moby->rot_row0); qcopy(matrix + 12, &moby->pos); quad.tag[1] = get_effect_texture(l11_teleporter_ring_effect_texture_index); - quad.tag[3] = (unsigned long long)l11_teleporter_ring_blend_a_selector | (unsigned long long)l11_teleporter_ring_blend_b_selector << 2 | + quad.tag[3] = (unsigned long long)l11_teleporter_ring_blend_a_selector | + (unsigned long long)l11_teleporter_ring_blend_b_selector << 2 | (unsigned long long)l11_teleporter_ring_blend_c_selector << 4 | (unsigned long long)l11_teleporter_ring_blend_d_selector << 6 | 0x8000000000ULL; quad.tag[2] = 0xff9000000260ULL; diff --git a/src/overlays/l12/hero/hero_set_state.c b/src/overlays/l12/hero/hero_set_state.c index aa13828457..7c3eaff8a1 100644 --- a/src/overlays/l12/hero/hero_set_state.c +++ b/src/overlays/l12/hero/hero_set_state.c @@ -76,10 +76,12 @@ int hero_set_state(int requested_state, int entry_animation_mode) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || + entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE)) return 0; } - if ((D_L12_0015F5C4 == 2 || D_L12_0015F5C4 == 6) && entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE) + if ((D_L12_0015F5C4 == 2 || D_L12_0015F5C4 == 6) && + entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l12/mobys/blarg_helicopter.c b/src/overlays/l12/mobys/blarg_helicopter.c index f1cdbd91d5..a2cf97bd11 100644 --- a/src/overlays/l12/mobys/blarg_helicopter.c +++ b/src/overlays/l12/mobys/blarg_helicopter.c @@ -438,7 +438,8 @@ void blarg_helicopter_update(struct Moby *moby) { approach_value(&blarg_helicopter_vars->unk94, 0.0f, frame_time_sq * 9.0f); if (blarg_helicopter_vars->unk94 == 0.0f) { blarg_helicopter_vars->rocket_fire_timer_frames = scale_game_frames(50); - blarg_helicopter_vars->target_first_path_endpoint = blarg_helicopter_vars->target_first_path_endpoint == 0; + blarg_helicopter_vars->target_first_path_endpoint = + blarg_helicopter_vars->target_first_path_endpoint == 0; moby->state = BLARG_HELICOPTER_AIM_AND_FIRE; break; } diff --git a/src/overlays/l12/mobys/hoven_anklebiter.c b/src/overlays/l12/mobys/hoven_anklebiter.c index b33aa83628..777e7e5b1e 100644 --- a/src/overlays/l12/mobys/hoven_anklebiter.c +++ b/src/overlays/l12/mobys/hoven_anklebiter.c @@ -803,8 +803,9 @@ void spawn_hoven_anklebiter_death_sparks(struct Moby *moby) { push[2] = 0.0f; fast_vec_add(spark_launch_velocity, spark_launch_velocity, push); qcopy(gravity_adjusted_spark_velocity, spark_launch_velocity); - gravity_adjusted_spark_velocity[2] -= l12_anklebiter_spark_downward_velocity_scale * - D_0015ED70 * (float)scale_game_frames(l12_anklebiter_spark_fade_frames); + gravity_adjusted_spark_velocity[2] -= + 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; @@ -813,10 +814,12 @@ void spawn_hoven_anklebiter_death_sparks(struct Moby *moby) { add_random_offset_to_vector_xyz(gravity_adjusted_spark_velocity, l12_anklebiter_spark_velocity_jitter_scale * D_0015ED6C); - start_color = - fast_tween_color(l12_anklebiter_spark_start_color_range_start, l12_anklebiter_spark_start_color_range_end, random_float_between(0.0f, 1.0f)); - end_color = - fast_tween_color(l12_anklebiter_spark_end_color_range_start, l12_anklebiter_spark_end_color_range_end, random_float_between(0.0f, 1.0f)); + start_color = fast_tween_color(l12_anklebiter_spark_start_color_range_start, + l12_anklebiter_spark_start_color_range_end, + random_float_between(0.0f, 1.0f)); + end_color = fast_tween_color(l12_anklebiter_spark_end_color_range_start, + l12_anklebiter_spark_end_color_range_end, + random_float_between(0.0f, 1.0f)); life = scale_game_frames(l12_anklebiter_spark_life_frames); fade = scale_game_frames(l12_anklebiter_spark_fade_frames); time_base = (float)l12_anklebiter_spark_random_time_base; @@ -843,8 +846,8 @@ typedef struct { u8 pad28[0x10]; s32 reset_alert; /* 0x38 */ u8 pad3C[0xD4]; - u8 anim[7]; /* 0x110: animation blend state */ - u8 damage_blend_target; /* 0x117 */ + u8 anim[7]; /* 0x110: animation blend state */ + u8 damage_blend_target; /* 0x117 */ u8 pad118[8]; u8 fall[0x10]; /* 0x120 */ f32 unk130; /* 0x130 */ @@ -860,7 +863,7 @@ typedef struct { u8 pad15C; u8 unk15D; /* 0x15D */ u8 pad15E[0x12]; - f32 knockback_ascent_animation_target; /* 0x170 */ + f32 knockback_ascent_animation_target; /* 0x170 */ f32 knockback_descent_animation_target; /* 0x174 */ u8 pad178[0x134]; f32 speed; /* 0x2AC */ @@ -971,7 +974,8 @@ void process_hoven_anklebiter_damage_and_alerts(struct Moby *moby) { &anklebiter_vars->unk138, &anklebiter_vars->unk13C); start_fall_e3528(moby, anklebiter_vars->fall, 0xE, 1, 0, unused); - anklebiter_vars->knockback_descent_animation_target = anklebiter_vars->knockback_ascent_animation_target = -1.0f; + anklebiter_vars->knockback_descent_animation_target = + anklebiter_vars->knockback_ascent_animation_target = -1.0f; moby->state = ANKLEBITER_KNOCKBACK_FALL; anklebiter_vars->damage_blend_target = 0xFA; anklebiter_vars->stun_timer = scale_game_frames(0x3C); diff --git a/src/overlays/l12/mobys/hoven_turret.c b/src/overlays/l12/mobys/hoven_turret.c index e26a99995c..933e883d2e 100644 --- a/src/overlays/l12/mobys/hoven_turret.c +++ b/src/overlays/l12/mobys/hoven_turret.c @@ -372,8 +372,10 @@ void hoven_turret_update(struct Moby *moby) { } joy[1] = y; target_yaw_step = hoven_turret_yaw_input_rate * 0.017453292f * D_0015ED6C_gp * -joy[0]; - if ((hoven_turret_state->yaw_step >= 0.0f && hoven_turret_state->yaw_step < target_yaw_step) || - (hoven_turret_state->yaw_step <= 0.0f && target_yaw_step < hoven_turret_state->yaw_step)) { + if ((hoven_turret_state->yaw_step >= 0.0f && + hoven_turret_state->yaw_step < target_yaw_step) || + (hoven_turret_state->yaw_step <= 0.0f && + target_yaw_step < hoven_turret_state->yaw_step)) { approach_value(&hoven_turret_state->yaw_step, target_yaw_step, hoven_turret_yaw_acceleration_rate * 0.017453292f * @@ -386,8 +388,10 @@ void hoven_turret_update(struct Moby *moby) { moby->rot.z = fast_add_rotations(moby->rot.z, hoven_turret_state->yaw_step); target_pitch_step = -(hoven_turret_pitch_input_rate * 0.017453292f * D_0015ED6C_gp) * -joy[1]; - if ((hoven_turret_state->pitch_step >= 0.0f && hoven_turret_state->pitch_step < target_pitch_step) || - (hoven_turret_state->pitch_step <= 0.0f && target_pitch_step < hoven_turret_state->pitch_step)) { + if ((hoven_turret_state->pitch_step >= 0.0f && + hoven_turret_state->pitch_step < target_pitch_step) || + (hoven_turret_state->pitch_step <= 0.0f && + target_pitch_step < hoven_turret_state->pitch_step)) { approach_value(&hoven_turret_state->pitch_step, target_pitch_step, hoven_turret_pitch_acceleration_rate * 0.017453292f * @@ -417,7 +421,8 @@ void hoven_turret_update(struct Moby *moby) { float yaw; int i; - blend_moby_animation(moby, hoven_turret_state->muzzle_alternation_state == 1 ? 4 : 3, 0, 1); + blend_moby_animation( + moby, hoven_turret_state->muzzle_alternation_state == 1 ? 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, diff --git a/src/overlays/l12/mobys/planetbuster_maximus_part.c b/src/overlays/l12/mobys/planetbuster_maximus_part.c index 6693a52fe7..6f64f0f218 100644 --- a/src/overlays/l12/mobys/planetbuster_maximus_part.c +++ b/src/overlays/l12/mobys/planetbuster_maximus_part.c @@ -149,7 +149,8 @@ void update_planetbuster_maximus_guns(char *moby) { } } } else { - float sweep_target_yaw = fast_add_rotations(yaw, md->yaw_sweep_direction * 0.55850536f); + float sweep_target_yaw = + fast_add_rotations(yaw, md->yaw_sweep_direction * 0.55850536f); if (absolute_float(spring_angle(ent + 0x18, sweep_target_yaw, (char *)md + 0x94, @@ -194,7 +195,8 @@ void update_planetbuster_maximus_guns(char *moby) { float rz; float pitch; int n; - moby_point_position(gun_moby, md->firing_point_selector + 1, position_buffer); + moby_point_position( + gun_moby, md->firing_point_selector + 1, position_buffer); md->firing_point_selector = md->firing_point_selector == 0; rz = fast_add_rotations(MOBY(gun_moby)->rot.z, 1.5707964f); if (D_L12_00161F00_gp != 0) { @@ -744,7 +746,8 @@ void planetbuster_maximus_part_update(char *moby) { case PLANETBUSTER_WAIT_FOR_PATH_TRIGGER: { char *clip_test_position; int r; - if (is_point_inside_clip_volume(D_L12_00167240, moby_data->linked_parts_flags_clip_volume)) { + if (is_point_inside_clip_volume(D_L12_00167240, + moby_data->linked_parts_flags_clip_volume)) { int i; char *base = (char *)D_L12_0015FFD8_gp; MOBY(moby)->flags |= 0x41; @@ -772,7 +775,8 @@ void planetbuster_maximus_part_update(char *moby) { float add = 3.0f; if (r) add = 10.0f; - if (is_point_inside_clip_volume(D_0013F3D0, moby_data->height_timer_refresh_clip_volume)) { + if (is_point_inside_clip_volume(D_0013F3D0, + moby_data->height_timer_refresh_clip_volume)) { moby_data->timer = scale_game_frames(0x5A); } if (!fast_dec_timer(&moby_data->timer)) @@ -784,8 +788,11 @@ void planetbuster_maximus_part_update(char *moby) { frame_scale_sq_macro * 0.3f, D_0015ED6C_gp * 2.7f); } - update_moby_vertical_oscillation( - 0.7f, D_0015ED6C_gp * 1.2217305f, moby, &moby_data->unk5CC, &moby_data->vertical_oscillation_previous_offset); + update_moby_vertical_oscillation(0.7f, + D_0015ED6C_gp * 1.2217305f, + moby, + &moby_data->unk5CC, + &moby_data->vertical_oscillation_previous_offset); update_moby_rotation_oscillation( moby, &moby_data->rotation_common_factor_phase, @@ -796,7 +803,8 @@ void planetbuster_maximus_part_update(char *moby) { planetbuster_maximus_rotation_oscillation_component_mix_phase_rate_degrees * 0.017453292f * D_0015ED6C_gp); apply_linked_moby_relative_transforms(moby, moby_data, 0x11); - if (is_point_inside_clip_volume(D_0013F3D0, moby_data->path_start_clip_volume) || D_L12_00161F00_gp) { + if (is_point_inside_clip_volume(D_0013F3D0, moby_data->path_start_clip_volume) || + D_L12_00161F00_gp) { int i; D_L12_001619B4 = 1; for (i = 0; i < 5; i++) { @@ -812,8 +820,11 @@ void planetbuster_maximus_part_update(char *moby) { P_7DB0 *path; int nx; float target_yaw; - update_moby_vertical_oscillation( - 0.7f, D_0015ED6C_gp * 1.2217305f, moby, &moby_data->unk5CC, &moby_data->vertical_oscillation_previous_offset); + update_moby_vertical_oscillation(0.7f, + D_0015ED6C_gp * 1.2217305f, + moby, + &moby_data->unk5CC, + &moby_data->vertical_oscillation_previous_offset); update_moby_rotation_oscillation( moby, &moby_data->rotation_common_factor_phase, @@ -825,7 +836,8 @@ void planetbuster_maximus_part_update(char *moby) { 0.017453292f * D_0015ED6C_gp); path = ((P_7DB0 **)&(*(int *)l12_paths))[moby_data->path]; if (moby_data->path_node < *(int *)path - 11) { - approach_value(&moby_data->path_movement_step, D_0015ED6C_gp * 8.0f, frame_time_sq_macro * 10.0f); + approach_value( + &moby_data->path_movement_step, D_0015ED6C_gp * 8.0f, frame_time_sq_macro * 10.0f); } else { approach_value(&moby_data->path_movement_step, 0.0f, frame_time_sq_macro * 8.0f); if (moby_data->path_movement_step == 0.0f) { @@ -872,8 +884,11 @@ void planetbuster_maximus_part_update(char *moby) { frame_scale_sq_macro * 0.0015f, frame_scale_sq_macro * 0.3f, D_0015ED6C_gp * 0.17453292f); - update_moby_vertical_oscillation( - 0.7f, D_0015ED6C_gp * 1.2217305f, moby, &moby_data->unk5CC, &moby_data->vertical_oscillation_previous_offset); + update_moby_vertical_oscillation(0.7f, + D_0015ED6C_gp * 1.2217305f, + moby, + &moby_data->unk5CC, + &moby_data->vertical_oscillation_previous_offset); update_moby_rotation_oscillation( moby, &moby_data->rotation_common_factor_phase, @@ -906,12 +921,14 @@ void planetbuster_maximus_part_update(char *moby) { D_0015ED6C_gp * 0.4f); lerp_vector(v, D_L12_001600EC + moby_data->camera_point * 128 + 0x30, - D_L12_001600EC + moby_data->transition_target_camera_point * 128 + 0x30, + D_L12_001600EC + moby_data->transition_target_camera_point * 128 + + 0x30, moby_data->camera_transition_fraction); clear_u64_value(transition_rotation); transition_rotation[0] = fast_subtract_rotations( - *(float *)(D_L12_001600EC + moby_data->transition_target_camera_point * 128 + 0x70), + *(float *)(D_L12_001600EC + + moby_data->transition_target_camera_point * 128 + 0x70), *(float *)(D_L12_001600EC + moby_data->camera_point * 128 + 0x70)) * moby_data->camera_transition_fraction; transition_rotation[0] = fast_add_rotations( @@ -919,7 +936,8 @@ void planetbuster_maximus_part_update(char *moby) { transition_rotation[1]); transition_rotation[1] = fast_subtract_rotations( - *(float *)(D_L12_001600EC + moby_data->transition_target_camera_point * 128 + 0x74), + *(float *)(D_L12_001600EC + + moby_data->transition_target_camera_point * 128 + 0x74), *(float *)(D_L12_001600EC + moby_data->camera_point * 128 + 0x74)) * moby_data->camera_transition_fraction; transition_rotation[1] = fast_add_rotations( @@ -927,7 +945,8 @@ void planetbuster_maximus_part_update(char *moby) { transition_rotation[1]); transition_rotation[2] = fast_subtract_rotations( - *(float *)(D_L12_001600EC + moby_data->transition_target_camera_point * 128 + 0x78), + *(float *)(D_L12_001600EC + + moby_data->transition_target_camera_point * 128 + 0x78), *(float *)(D_L12_001600EC + moby_data->camera_point * 128 + 0x78)) * moby_data->camera_transition_fraction; transition_rotation[2] = fast_add_rotations( diff --git a/src/overlays/l12/mobys/platform.c b/src/overlays/l12/mobys/platform.c index 648e24a738..f457a8dfde 100644 --- a/src/overlays/l12/mobys/platform.c +++ b/src/overlays/l12/mobys/platform.c @@ -299,7 +299,8 @@ void platform_update(Moby *moby) { qcopy(oldPos, (*(float(*)[4]) & moby->pos)); qcopy(oldRot, (*(float(*)[4]) & moby->rot)); if (moby->state != PLATFORM_INITIALIZE && platform_vars->movement_blocking_moby_index != -1 && - (signed char)(*(Moby **)&D_L12_0015FFD8_p)[platform_vars->movement_blocking_moby_index].state >= 0) { + (signed char)(*(Moby **)&D_L12_0015FFD8_p)[platform_vars->movement_blocking_moby_index] + .state >= 0) { emit_platform_exhaust_effects((char *)moby); return; } @@ -376,7 +377,8 @@ void platform_update(Moby *moby) { if (fast_vec_dist((*(float(*)[4]) & moby->pos), &path->nodes[next_waypoint_index]) < 0.5f) { platform_vars->walk.idx = next_waypoint_index; if (platform_vars->walk.path->nodes[next_waypoint_index].w != -1.0f) { - platform_vars->target_speed = platform_vars->walk.path->nodes[next_waypoint_index].w; + platform_vars->target_speed = + platform_vars->walk.path->nodes[next_waypoint_index].w; } } fast_vec_sub(to_goal, goal, (*(float(*)[4]) & moby->pos)); @@ -394,11 +396,14 @@ void platform_update(Moby *moby) { Path *path = platform_vars->walk.path; float swing; platform_vars->acceleration = 0.0f; - platform_vars->path_oscillation_phase = fast_add_rotations(platform_vars->path_oscillation_phase, D_0015ED6C * 1.2217305f); + platform_vars->path_oscillation_phase = + fast_add_rotations(platform_vars->path_oscillation_phase, D_0015ED6C * 1.2217305f); swing = fast_sin(platform_vars->path_oscillation_phase); - if (platform_vars->path_oscillation_phase > 1.5707964f && platform_vars->path_oscillation_phase < 3.1415927f) + if (platform_vars->path_oscillation_phase > 1.5707964f && + platform_vars->path_oscillation_phase < 3.1415927f) swing = 2.0f - swing; - if (platform_vars->path_oscillation_phase > -3.1415927f && platform_vars->path_oscillation_phase < -1.5707964f) + if (platform_vars->path_oscillation_phase > -3.1415927f && + platform_vars->path_oscillation_phase < -1.5707964f) swing = 2.0f - swing; swing = swing * 0.5f; swing = swing + 0.5f; @@ -421,11 +426,14 @@ void platform_update(Moby *moby) { case PLATFORM_OSCILLATE_BETWEEN_PATH_ENDPOINTS_FIXED_PITCH: { Path *path = platform_vars->walk.path; float swing; - platform_vars->path_oscillation_phase = fast_add_rotations(platform_vars->path_oscillation_phase, D_0015ED6C * 1.2217305f); + platform_vars->path_oscillation_phase = + fast_add_rotations(platform_vars->path_oscillation_phase, D_0015ED6C * 1.2217305f); swing = fast_sin(platform_vars->path_oscillation_phase); - if (platform_vars->path_oscillation_phase > 1.5707964f && platform_vars->path_oscillation_phase < 3.1415927f) + if (platform_vars->path_oscillation_phase > 1.5707964f && + platform_vars->path_oscillation_phase < 3.1415927f) swing = 2.0f - swing; - if (platform_vars->path_oscillation_phase > -3.1415927f && platform_vars->path_oscillation_phase < -1.5707964f) + if (platform_vars->path_oscillation_phase > -3.1415927f && + platform_vars->path_oscillation_phase < -1.5707964f) swing = 2.0f - swing; swing = swing * 0.5f; swing = swing + 0.5f; @@ -508,10 +516,10 @@ void platform_update(Moby *moby) { return; } platform_vars->vel[2] = platform_vars->vel[2] - D_0015ED70 * 7.0f; - (*(float(*)[4]) & moby->rot)[0] = - fast_add_rotations(platform_vars->tumble_rotation_x_step, (*(float(*)[4]) & moby->rot)[0]); - (*(float(*)[4]) & moby->rot)[1] = - fast_add_rotations(platform_vars->tumble_rotation_y_step, (*(float(*)[4]) & moby->rot)[1]); + (*(float(*)[4]) & moby->rot)[0] = fast_add_rotations(platform_vars->tumble_rotation_x_step, + (*(float(*)[4]) & moby->rot)[0]); + (*(float(*)[4]) & moby->rot)[1] = fast_add_rotations(platform_vars->tumble_rotation_y_step, + (*(float(*)[4]) & moby->rot)[1]); if (platform_vars->walk.path != 0 && vector_distance_xy((*(float(*)[4]) & moby->pos), &platform_vars->walk.path->nodes[0]) < 0.5f) { @@ -522,8 +530,8 @@ void platform_update(Moby *moby) { } break; case PLATFORM_TRACK_REFERENCED_MOBY_HEIGHT: { - Moby *height_reference_moby = - (Moby *)((char *)(*(Moby **)&D_L12_0015FFD8_p) + (platform_vars->height_reference_moby_index << 8)); + Moby *height_reference_moby = (Moby *)((char *)(*(Moby **)&D_L12_0015FFD8_p) + + (platform_vars->height_reference_moby_index << 8)); qcopy(angles, (*(float(*)[4]) & moby->pos)); angles[2] = (*(float(*)[4]) & height_reference_moby->pos)[2]; clear_u64_value(goal); diff --git a/src/overlays/l12/mobys/water_reservoir.c b/src/overlays/l12/mobys/water_reservoir.c index 9b47c702a2..c2bf049723 100644 --- a/src/overlays/l12/mobys/water_reservoir.c +++ b/src/overlays/l12/mobys/water_reservoir.c @@ -174,10 +174,13 @@ void draw_water_reservoir(struct Moby *moby) { quad.g[1] = get_effect_texture(0x10); quad.g[0] = 0; quad.g[2] = 0xFF9000000260UL; - quad.g[3] = (long)l12_water_reservoir_alpha_a_selector | ((long)l12_water_reservoir_alpha_b_selector << 2) | ((long)l12_water_reservoir_alpha_c_selector << 4) | + quad.g[3] = (long)l12_water_reservoir_alpha_a_selector | + ((long)l12_water_reservoir_alpha_b_selector << 2) | + ((long)l12_water_reservoir_alpha_c_selector << 4) | ((long)l12_water_reservoir_alpha_d_selector << 6) | (0x8000L << 24); - col = fast_tween_color( - l12_water_reservoir_tween_start_color, l12_water_reservoir_tween_end_color, (fast_sin(*(float *)water_reservoir_vars) + 1.0f) * 0.5f); + col = fast_tween_color(l12_water_reservoir_tween_start_color, + l12_water_reservoir_tween_end_color, + (fast_sin(*(float *)water_reservoir_vars) + 1.0f) * 0.5f); for (i = 0; i < 4; i++) { quad.uv[i * 2] = 0.5f; *(&quad.uv[i * 2] + 1) = 0.5f; diff --git a/src/overlays/l13/mobys/attached_rocket.c b/src/overlays/l13/mobys/attached_rocket.c index ae00f50141..b8ce9cbfe1 100644 --- a/src/overlays/l13/mobys/attached_rocket.c +++ b/src/overlays/l13/mobys/attached_rocket.c @@ -150,7 +150,8 @@ void attached_rocket_update(struct Moby *moby) { *(OvlQuad *)&moby->rot_row0 = *(OvlQuad *)&source->rot_row0; *(OvlQuad *)&moby->rot_row1 = *(OvlQuad *)&source->rot_row1; *(OvlQuad *)&moby->rot_row2 = *(OvlQuad *)&source->rot_row2; - moby_point_position(attached_rocket_vars->unk20, attached_rocket_vars->attachment_joint_index, &moby->pos); + moby_point_position( + attached_rocket_vars->unk20, attached_rocket_vars->attachment_joint_index, &moby->pos); qcopy(&attached_rocket_vars->unk10, &moby->pos); { struct Moby *source = attached_rocket_vars->unk20; diff --git a/src/overlays/l13/mobys/blarg_space_commando.c b/src/overlays/l13/mobys/blarg_space_commando.c index e4e1c7957e..99379140f2 100644 --- a/src/overlays/l13/mobys/blarg_space_commando.c +++ b/src/overlays/l13/mobys/blarg_space_commando.c @@ -363,14 +363,15 @@ void blarg_space_commando_update(struct Moby *moby) { } break; case BLARG_SPACE_COMMANDO_APPROACH_TARGET_WITH_TURN_OFFSET: - func_L00_002592B0_309330(moby, - fast_add_rotations(fast_arc_tan(target->pos.x - moby->pos.x, - target->pos.y - moby->pos.y), - blarg_space_commando_vars->approach_heading_offset), - &blarg_space_commando_vars->turn, - 0.05f, - 0.3f, - frame_time * 6.2831855f); + func_L00_002592B0_309330( + moby, + fast_add_rotations( + fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), + blarg_space_commando_vars->approach_heading_offset), + &blarg_space_commando_vars->turn, + 0.05f, + 0.3f, + frame_time * 6.2831855f); point.f[0] = 2.0f * fast_cos(moby->rot.z); point.f[1] = 2.0f * fast_sin(moby->rot.z); point.f[2] = 0.0f; @@ -378,7 +379,8 @@ void blarg_space_commando_update(struct Moby *moby) { moby, &blarg_space_commando_vars->ctl, &point, &origin, 1.0f) & 2) { rand(); - blarg_space_commando_vars->approach_heading_offset = convert_integer_to_float(-1) * 1.0995574f; + blarg_space_commando_vars->approach_heading_offset = + convert_integer_to_float(-1) * 1.0995574f; } else { blarg_space_commando_vars->approach_heading_offset = 0.0f; } diff --git a/src/overlays/l13/mobys/blarg_space_fighter.c b/src/overlays/l13/mobys/blarg_space_fighter.c index 240d5e96dd..eb07fc1d83 100644 --- a/src/overlays/l13/mobys/blarg_space_fighter.c +++ b/src/overlays/l13/mobys/blarg_space_fighter.c @@ -579,7 +579,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { return; } if (path == 0) { - func_001E9730_d(blarg_space_fighter_missing_path_debug_format, moby->diagnostic_moby_number); + func_001E9730_d(blarg_space_fighter_missing_path_debug_format, + moby->diagnostic_moby_number); mark_moby_for_removal(moby); return; } @@ -587,7 +588,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { int path_table_index = fighter_data->flight_path_index; qcopy(&moby->pos, D_L13_001B07B0[path_table_index] + 0x10); fighter_data->target_path_node_index = 1; - fighter_data->previous_path_node_index = *(unsigned short *)D_L13_001B07B0[path_table_index] - 1; + fighter_data->previous_path_node_index = + *(unsigned short *)D_L13_001B07B0[path_table_index] - 1; } qcopy(&fighter_data->path_join_position, path + 0x20); qcopy(&moby->pos, &fighter_data->path_join_position); @@ -611,7 +613,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { fast_vec_sub(scratch_vector, D_L13_001670C0, scratch_vector); fighter_data->previous_path_node_index = fighter_data->target_path_node_index = select_point_index_by_distance(scratch_vector, path, 0.0f); - qcopy(&fighter_data->path_join_position, path + (fighter_data->previous_path_node_index * 16 + 0x10)); + qcopy(&fighter_data->path_join_position, + path + (fighter_data->previous_path_node_index * 16 + 0x10)); qcopy(&moby->pos, &fighter_data->path_join_position); moby->f94 = moby->cls->f10; moby->b31 = 1; @@ -650,7 +653,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { boss = 0; bossd = 0; if (fighter_data->linked_boss_index != -1) { - Moby_2C56B0 *p = (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->linked_boss_index << 8)); + Moby_2C56B0 *p = + (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->linked_boss_index << 8)); if (p != 0 && p->state != MOBY_STATE_REMOVAL_AT_OR_ABOVE_INSTANCE_END && p->state != MOBY_STATE_REMOVAL_BELOW_INSTANCE_END) { boss = p; @@ -667,7 +671,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { { Snd *e; if (fighter_data->fighter_voice_slot == -1 || - (e = (Snd *)(((char *)&D_0013E550) + fighter_data->fighter_voice_slot * 0x70))->f88 != moby || + (e = (Snd *)(((char *)&D_0013E550) + fighter_data->fighter_voice_slot * 0x70)) + ->f88 != moby || e->b74 == 0) { fighter_data->fighter_voice_slot = -1; fighter_data->fighter_voice_slot = allocate_voice_for_target_entry(1, 4, moby); @@ -692,7 +697,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { if (moby->b31 == 0) { fighter_data->fire_exit_frame_counter++; } - if (moby->b31 == 0 || close == 0 || scale_game_frames(0x14) <= fighter_data->fire_exit_frame_counter) { + if (moby->b31 == 0 || close == 0 || + scale_game_frames(0x14) <= fighter_data->fire_exit_frame_counter) { fighter_data->attack_phase_timer = scale_game_frames(0x1E); moby->bBC = 2; } @@ -718,11 +724,14 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { fast_vec_cross(lateral_aim_offset, &vehd->vel, up); fast_vec_cross(up, lateral_aim_offset, &vehd->vel); - fast_vec_normalize( - up, up, fighter_data->aim_offset_radius_scale * 5.0f * fast_sin(fighter_data->aim_offset_angle_radians)); + fast_vec_normalize(up, + up, + fighter_data->aim_offset_radius_scale * 5.0f * + fast_sin(fighter_data->aim_offset_angle_radians)); fast_vec_normalize(lateral_aim_offset, lateral_aim_offset, - fighter_data->aim_offset_radius_scale * 5.0f * fast_cos(fighter_data->aim_offset_angle_radians)); + fighter_data->aim_offset_radius_scale * 5.0f * + fast_cos(fighter_data->aim_offset_angle_radians)); fast_vec_add(scratch_vector, hpos, up); fast_vec_add(scratch_vector, scratch_vector, lateral_aim_offset); add_random_offset_to_vector_xyz(scratch_vector, 0.6f); @@ -746,11 +755,13 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { fighter_data->aim_offset_radius_scale * ((random_float_between(0.92f, 0.94f) - 1.0f) * D_0015ED60 + 1.0f); if (fighter_data->aim_offset_angle_radians > 1.5707964f) { - fighter_data->aim_offset_angle_radians = fighter_data->aim_offset_angle_radians - random_float_between(20.0f, 40.0f) * - 0.017453292f * D_0015ED6C; + fighter_data->aim_offset_angle_radians = + fighter_data->aim_offset_angle_radians - + random_float_between(20.0f, 40.0f) * 0.017453292f * D_0015ED6C; } else { - fighter_data->aim_offset_angle_radians = fighter_data->aim_offset_angle_radians + random_float_between(20.0f, 40.0f) * - 0.017453292f * D_0015ED6C; + fighter_data->aim_offset_angle_radians = + fighter_data->aim_offset_angle_radians + + random_float_between(20.0f, 40.0f) * 0.017453292f * D_0015ED6C; } } } @@ -816,7 +827,8 @@ void blarg_space_fighter_update(Moby_2C56B0 *moby) { boss = 0; bossd = 0; if (fighter_data->linked_boss_index != -1) { - Moby_2C56B0 *p = (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->linked_boss_index << 8)); + Moby_2C56B0 *p = + (Moby_2C56B0 *)(D_L13_0015FFD8 + (fighter_data->linked_boss_index << 8)); if (p != 0 && p->state != MOBY_STATE_REMOVAL_AT_OR_ABOVE_INSTANCE_END && p->state != MOBY_STATE_REMOVAL_BELOW_INSTANCE_END) { boss = p; diff --git a/src/overlays/l13/mobys/fighter_jet.c b/src/overlays/l13/mobys/fighter_jet.c index c9d62a323e..b7b53d983a 100644 --- a/src/overlays/l13/mobys/fighter_jet.c +++ b/src/overlays/l13/mobys/fighter_jet.c @@ -318,20 +318,29 @@ void spawn_fighter_jet_joint_particles(void *moby, char *flight_data) { -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 2.0f) * frame_time) * particle_velocity_scale; - spawn_type_74_particle( - moby, first_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_first_spawn_particle_definition, 1); + spawn_type_74_particle(moby, + first_particle_spawn_position, + initial_particle_velocity, + &l13_fighter_jet_first_spawn_particle_definition, + 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 3.0f) * frame_time) * particle_velocity_scale; - spawn_type_74_particle( - moby, second_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_second_spawn_particle_definition, 1); + spawn_type_74_particle(moby, + second_particle_spawn_position, + initial_particle_velocity, + &l13_fighter_jet_second_spawn_particle_definition, + 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 4.0f) * frame_time) * particle_velocity_scale; - spawn_type_74_particle( - moby, third_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_third_spawn_particle_definition, 1); + spawn_type_74_particle(moby, + third_particle_spawn_position, + initial_particle_velocity, + &l13_fighter_jet_third_spawn_particle_definition, + 1); if (*(float *)(flight_data + 0xC4) > 0.5f) { add_random_offset_to_vector_xyz(first_particle_spawn_position, *(float *)(flight_data + 0xC4) * 0.02f + 0.01f); @@ -343,8 +352,11 @@ void spawn_fighter_jet_joint_particles(void *moby, char *flight_data) { -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 2.0f) * frame_time) * particle_velocity_scale; - spawn_type_74_particle( - moby, first_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_first_spawn_particle_definition, 1); + spawn_type_74_particle(moby, + first_particle_spawn_position, + initial_particle_velocity, + &l13_fighter_jet_first_spawn_particle_definition, + 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 3.0f) * frame_time) * @@ -358,20 +370,29 @@ void spawn_fighter_jet_joint_particles(void *moby, char *flight_data) { -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 4.0f) * frame_time) * particle_velocity_scale; - spawn_type_74_particle( - moby, third_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_third_spawn_particle_definition, 1); + spawn_type_74_particle(moby, + third_particle_spawn_position, + initial_particle_velocity, + &l13_fighter_jet_third_spawn_particle_definition, + 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 2.0f) * frame_time) * particle_velocity_scale; - spawn_type_74_particle( - moby, first_particle_spawn_position, initial_particle_velocity, &l13_fighter_jet_extra_offset_particle_definition, 1); + spawn_type_74_particle(moby, + first_particle_spawn_position, + initial_particle_velocity, + &l13_fighter_jet_extra_offset_particle_definition, + 1); initial_particle_velocity[0] = -((random_float_between(6.0f, 7.0f) + *(float *)(flight_data + 0xC4) * 3.0f) * frame_time) * particle_velocity_scale; - spawn_type_74_particle( - moby, joint_world_position, initial_particle_velocity, &l13_fighter_jet_extra_joint_particle_definition, 1); + spawn_type_74_particle(moby, + joint_world_position, + initial_particle_velocity, + &l13_fighter_jet_extra_joint_particle_definition, + 1); } } } diff --git a/src/overlays/l13/mobys/gemlik_projectile.c b/src/overlays/l13/mobys/gemlik_projectile.c index bbb344d6d4..c6a215aafd 100644 --- a/src/overlays/l13/mobys/gemlik_projectile.c +++ b/src/overlays/l13/mobys/gemlik_projectile.c @@ -145,8 +145,8 @@ void gemlik_projectile_update(struct Moby *moby) { *(unsigned short *)(work.hit + 0x1A) = *(unsigned short *)((char *)moby + 0xA6); work.hit[0x19] = 1; if ((unsigned char)ent[0xA4] == 0xFF || - (target_hit_entry = &l13_moby_hit_entries[(unsigned char)ent[0xA4]])->owner_moby != - ent) { + (target_hit_entry = &l13_moby_hit_entries[(unsigned char)ent[0xA4]]) + ->owner_moby != ent) { record_moby_hit(ent, work.hit); } else { target_hit_entry->damage += 1.0f; diff --git a/src/overlays/l13/mobys/homing_rocket.c b/src/overlays/l13/mobys/homing_rocket.c index 1729b0741b..836505c933 100644 --- a/src/overlays/l13/mobys/homing_rocket.c +++ b/src/overlays/l13/mobys/homing_rocket.c @@ -286,8 +286,10 @@ void level_13_homing_rocket_update(ProjectileMoby *rocket_moby) { if (hero_state->veh != 0 && hero_state->veh->cls_id == 0x45 && rocket_data->owner->state != 5) { Veh_2C27B0 *vd = hero_state->veh->data; - float vehicle_lead_yaw = fast_add_rotations(hero_state->veh->rot.z, vd->lead_yaw_offset); - float vehicle_lead_pitch = fast_add_rotations(hero_state->veh->rot.y, vd->lead_pitch_offset); + float vehicle_lead_yaw = + fast_add_rotations(hero_state->veh->rot.z, vd->lead_yaw_offset); + float vehicle_lead_pitch = + fast_add_rotations(hero_state->veh->rot.y, vd->lead_pitch_offset); build_spherical_offset_c(&scratch_vector, fast_vec_dist(&rocket_moby->pos, &hero_state->veh->pos) / (rocket_data->speed + 24.0f) * vd->f64, diff --git a/src/overlays/l13/mobys/moby_volume_trigger.c b/src/overlays/l13/mobys/moby_volume_trigger.c index 649878a836..24720e0b4a 100644 --- a/src/overlays/l13/mobys/moby_volume_trigger.c +++ b/src/overlays/l13/mobys/moby_volume_trigger.c @@ -96,8 +96,10 @@ void moby_volume_trigger_update(char *moby) { } } } - if (volume_trigger_vars->unk18 != -1 && volume_trigger_vars->second_list_entry_state != -1) - set_moby_list_state(volume_trigger_vars->unk18, volume_trigger_vars->second_list_entry_state); + if (volume_trigger_vars->unk18 != -1 && + volume_trigger_vars->second_list_entry_state != -1) + set_moby_list_state(volume_trigger_vars->unk18, + volume_trigger_vars->second_list_entry_state); { int uid = volume_trigger_vars->unkC; if (uid != -1) { @@ -113,8 +115,10 @@ void moby_volume_trigger_update(char *moby) { } } } - if (volume_trigger_vars->unk1C != -1 && volume_trigger_vars->third_list_entry_state != -1) - set_moby_list_state(volume_trigger_vars->unk1C, volume_trigger_vars->third_list_entry_state); + if (volume_trigger_vars->unk1C != -1 && + volume_trigger_vars->third_list_entry_state != -1) + set_moby_list_state(volume_trigger_vars->unk1C, + volume_trigger_vars->third_list_entry_state); { int uid = volume_trigger_vars->unk10; if (uid != -1) { @@ -130,8 +134,10 @@ void moby_volume_trigger_update(char *moby) { } } } - if (volume_trigger_vars->unk20 != -1 && volume_trigger_vars->fourth_list_entry_state != -1) - set_moby_list_state(volume_trigger_vars->unk20, volume_trigger_vars->fourth_list_entry_state); + if (volume_trigger_vars->unk20 != -1 && + volume_trigger_vars->fourth_list_entry_state != -1) + set_moby_list_state(volume_trigger_vars->unk20, + volume_trigger_vars->fourth_list_entry_state); if (volume_trigger_vars->unk34 != -1) MOBY(moby)->state = volume_trigger_vars->unk34; if (volume_trigger_vars->unk36 != -1) @@ -172,8 +178,10 @@ void moby_volume_trigger_update(char *moby) { } } } - if (volume_trigger_vars->unk18 != -1 && volume_trigger_vars->second_list_exit_state != -1) - set_moby_list_state(volume_trigger_vars->unk18, volume_trigger_vars->second_list_exit_state); + if (volume_trigger_vars->unk18 != -1 && + volume_trigger_vars->second_list_exit_state != -1) + set_moby_list_state(volume_trigger_vars->unk18, + volume_trigger_vars->second_list_exit_state); { int uid = volume_trigger_vars->unkC; if (uid != -1) { @@ -189,8 +197,10 @@ void moby_volume_trigger_update(char *moby) { } } } - if (volume_trigger_vars->unk1C != -1 && volume_trigger_vars->third_list_exit_state != -1) - set_moby_list_state(volume_trigger_vars->unk1C, volume_trigger_vars->third_list_exit_state); + if (volume_trigger_vars->unk1C != -1 && + volume_trigger_vars->third_list_exit_state != -1) + set_moby_list_state(volume_trigger_vars->unk1C, + volume_trigger_vars->third_list_exit_state); { int uid = volume_trigger_vars->unk10; if (uid != -1) { @@ -206,8 +216,10 @@ void moby_volume_trigger_update(char *moby) { } } } - if (volume_trigger_vars->unk20 != -1 && volume_trigger_vars->fourth_list_exit_state != -1) - set_moby_list_state(volume_trigger_vars->unk20, volume_trigger_vars->fourth_list_exit_state); + if (volume_trigger_vars->unk20 != -1 && + volume_trigger_vars->fourth_list_exit_state != -1) + set_moby_list_state(volume_trigger_vars->unk20, + volume_trigger_vars->fourth_list_exit_state); if (volume_trigger_vars->trigger_exit_state != -1) MOBY(moby)->state = volume_trigger_vars->trigger_exit_state; if (volume_trigger_vars->trigger_exit_command != -1) diff --git a/src/overlays/l13/mobys/qwarks_starfighter.c b/src/overlays/l13/mobys/qwarks_starfighter.c index bb8718630d..6191cbeb9d 100644 --- a/src/overlays/l13/mobys/qwarks_starfighter.c +++ b/src/overlays/l13/mobys/qwarks_starfighter.c @@ -812,8 +812,12 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { } moby->bBC++; if (moby_data->tractor_beam_voice_slot_index != -1) { - if (((Voice *)(D_0013E550 + moby_data->tractor_beam_voice_slot_index * 0x70))->f88 == moby && - ((Voice *)(D_0013E550 + moby_data->tractor_beam_voice_slot_index * 0x70))->b74 != 0) { + if (((Voice *)(D_0013E550 + + moby_data->tractor_beam_voice_slot_index * 0x70)) + ->f88 == moby && + ((Voice *)(D_0013E550 + + moby_data->tractor_beam_voice_slot_index * 0x70)) + ->b74 != 0) { release_voice_slot(moby_data->tractor_beam_voice_slot_index); } moby_data->tractor_beam_voice_slot_index = -1; @@ -907,8 +911,10 @@ void process_moby_attachment_damage(Moby_2EAE80 *moby, Data_2EAE80 *moby_data) { } moby->bBC++; if (moby_data->tractor_beam_voice_slot_index != -1) { - if (((Voice *)(D_0013E550 + moby_data->tractor_beam_voice_slot_index * 0x70))->f88 == moby && - ((Voice *)(D_0013E550 + moby_data->tractor_beam_voice_slot_index * 0x70))->b74 != 0) { + if (((Voice *)(D_0013E550 + moby_data->tractor_beam_voice_slot_index * 0x70)) + ->f88 == moby && + ((Voice *)(D_0013E550 + moby_data->tractor_beam_voice_slot_index * 0x70)) + ->b74 != 0) { release_voice_slot(moby_data->tractor_beam_voice_slot_index); } moby_data->tractor_beam_voice_slot_index = -1; @@ -1634,15 +1640,17 @@ void qwarks_starfighter_update(Moby388 *moby) { float probe[4]; int i; - starfighter_vars->health_hud_packed_value = truncate_float_to_s32(starfighter_vars->f20 * 16.0f) & 0xFFF0; + starfighter_vars->health_hud_packed_value = + truncate_float_to_s32(starfighter_vars->f20 * 16.0f) & 0xFFF0; if (starfighter_vars->health_hud_packed_value >= truncate_float_to_s32(((float)starfighter_vars->starfighter_max_health - 0.5f) * 16.0f)) { starfighter_vars->health_hud_packed_value |= 0xF; } if (0.5f < starfighter_vars->f20) { - int segment = - ((truncate_float_to_s32(starfighter_vars->f20) % (starfighter_vars->starfighter_max_health / 6)) * 16) / - (starfighter_vars->starfighter_max_health / 6); + int segment = ((truncate_float_to_s32(starfighter_vars->f20) % + (starfighter_vars->starfighter_max_health / 6)) * + 16) / + (starfighter_vars->starfighter_max_health / 6); if (segment < 0) segment = 0; starfighter_vars->health_hud_packed_value += segment & 0xF; @@ -1653,7 +1661,8 @@ void qwarks_starfighter_update(Moby388 *moby) { switch (moby->state) { case STARFIGHTER_STATE_INITIALIZE: { int j; - if (moby->visited_slot_index != 0xFF && visited52[moby->visited_slot_index + (D_0015ED84 << 4)] == 0xFF) { + if (moby->visited_slot_index != 0xFF && + visited52[moby->visited_slot_index + (D_0015ED84 << 4)] == 0xFF) { mark_moby_for_removal(moby); return; } @@ -1671,7 +1680,8 @@ void qwarks_starfighter_update(Moby388 *moby) { } starfighter_vars->flight_speed = frame_time * 42.0f * 0.1f; starfighter_vars->f70 = fast_cos(moby->rot[2]) * starfighter_vars->flight_speed; - starfighter_vars->flight_velocity_y = fast_sin(moby->rot[2]) * starfighter_vars->flight_speed; + starfighter_vars->flight_velocity_y = + fast_sin(moby->rot[2]) * starfighter_vars->flight_speed; starfighter_vars->i78 = 0; qcopy(moby->pos, walker_paths[starfighter_vars->paths[0]] + 0x10); starfighter_vars->path_previous_node_index = 0; @@ -1741,14 +1751,16 @@ void qwarks_starfighter_update(Moby388 *moby) { (*(Moby388 **)(hero + 0x15F0))->bBC = 0; } } - starfighter_vars->hud104 = queue_animation_update(0x11, - 0xFFFF, - (int)reset_numeric_hud_element, - (int)hud_update_counter, - (int)FUN_L06_00249738, - (int)&starfighter_vars->health_hud_packed_value, - (starfighter_vars->starfighter_max_health << 4) | 0xF); - starfighter_vars->flight_speed += (frame_time * 42.0f - starfighter_vars->flight_speed) * 0.1f; + starfighter_vars->hud104 = + queue_animation_update(0x11, + 0xFFFF, + (int)reset_numeric_hud_element, + (int)hud_update_counter, + (int)FUN_L06_00249738, + (int)&starfighter_vars->health_hud_packed_value, + (starfighter_vars->starfighter_max_health << 4) | 0xF); + starfighter_vars->flight_speed += + (frame_time * 42.0f - starfighter_vars->flight_speed) * 0.1f; if (advance_moby_along_selected_path(moby, starfighter_vars, 0, 1) != 0) { char *hero = ((char *)&D_0013F350); char *ship; @@ -1762,17 +1774,21 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->attack_and_death_timer_frames = scale_game_frames(0x14); moby->state = STARFIGHTER_STATE_FOLLOW_COMMAND_PATH; starfighter_vars->path_target_node_index = select_point_index_by_distance( - moby->pos, walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]], 0.0f); + moby->pos, + walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]], + 0.0f); starfighter_vars->path_target_node_index = *(unsigned short *)((char *)starfighter_vars + 0x9C) + random_int_between(3, 7); starfighter_vars->path_target_node_index = starfighter_vars->path_target_node_index % *(int *)walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; - starfighter_vars->path_previous_node_index = starfighter_vars->path_target_node_index - 1; + starfighter_vars->path_previous_node_index = + starfighter_vars->path_target_node_index - 1; if (starfighter_vars->path_previous_node_index < 0) { starfighter_vars->path_previous_node_index = *(unsigned short *) - walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]] - + walker_paths[starfighter_vars + ->paths[starfighter_vars->selected_path_slot]] - 1; } } @@ -1780,13 +1796,14 @@ void qwarks_starfighter_update(Moby388 *moby) { } case STARFIGHTER_STATE_FOLLOW_COMMAND_PATH: case STARFIGHTER_STATE_FOLLOW_COMMAND_PATH_WITH_TIMED_VOLLEY: - starfighter_vars->hud104 = queue_animation_update(0x11, - 0xFFFF, - (int)reset_numeric_hud_element, - (int)hud_update_counter, - (int)FUN_L06_00249738, - (int)&starfighter_vars->health_hud_packed_value, - (starfighter_vars->starfighter_max_health << 4) | 0xF); + starfighter_vars->hud104 = + queue_animation_update(0x11, + 0xFFFF, + (int)reset_numeric_hud_element, + (int)hud_update_counter, + (int)FUN_L06_00249738, + (int)&starfighter_vars->health_hud_packed_value, + (starfighter_vars->starfighter_max_health << 4) | 0xF); if (*(Moby388 **)(((char *)&D_00140940)) != 0 && (*(Moby388 **)(((char *)&D_00140940)))->cls_id == 0x45) { (*(Moby388 **)(((char *)&D_00140940)))->bBC = 0; @@ -1795,8 +1812,10 @@ void qwarks_starfighter_update(Moby388 *moby) { if (update_moby_path_following_away_from_hero( moby, starfighter_vars, starfighter_vars->selected_path_slot, 1) & 2) { - if (starfighter_vars->selected_path_slot != qwarks_starfighter_command_path_slots[moby->bBC]) { - starfighter_vars->selected_path_slot = qwarks_starfighter_command_path_slots[moby->bBC]; + if (starfighter_vars->selected_path_slot != + qwarks_starfighter_command_path_slots[moby->bBC]) { + starfighter_vars->selected_path_slot = + qwarks_starfighter_command_path_slots[moby->bBC]; starfighter_vars->path_target_node_index = select_point_index_by_distance( moby->pos, walker_paths[starfighter_vars @@ -1809,7 +1828,8 @@ void qwarks_starfighter_update(Moby388 *moby) { *(int *) walker_paths[starfighter_vars ->paths[qwarks_starfighter_command_path_slots[moby->bBC]]]; - starfighter_vars->path_previous_node_index = starfighter_vars->path_target_node_index - 1; + starfighter_vars->path_previous_node_index = + starfighter_vars->path_target_node_index - 1; if (starfighter_vars->path_previous_node_index < 0) { starfighter_vars->path_previous_node_index = *(unsigned short *) @@ -1827,16 +1847,18 @@ void qwarks_starfighter_update(Moby388 *moby) { break; case STARFIGHTER_STATE_TRACTOR_BEAM: { float hero_distance; - starfighter_vars->hud104 = queue_animation_update(0x11, - 0xFFFF, - (int)reset_numeric_hud_element, - (int)hud_update_counter, - (int)FUN_L06_00249738, - (int)&starfighter_vars->health_hud_packed_value, - (starfighter_vars->starfighter_max_health << 4) | 0xF); + starfighter_vars->hud104 = + queue_animation_update(0x11, + 0xFFFF, + (int)reset_numeric_hud_element, + (int)hud_update_counter, + (int)FUN_L06_00249738, + (int)&starfighter_vars->health_hud_packed_value, + (starfighter_vars->starfighter_max_health << 4) | 0xF); update_qwarks_starfighter_attack_commands(moby, starfighter_vars); FUN_L00_0024f7c8(moby, 0x13, joint); - hero_distance = fast_vec_dist(starfighter_vars->tractor_beam_endpoint, ((char *)&D_0013F3D0)); + hero_distance = + fast_vec_dist(starfighter_vars->tractor_beam_endpoint, ((char *)&D_0013F3D0)); if (starfighter_vars->snd11C != -1) { char *voice = D_0013E633_snd + 0x1D + starfighter_vars->snd11C * 0x70; if (*(Moby388 **)(voice + 0x88) == moby && *(unsigned char *)(voice + 0x74) != 0) @@ -1853,11 +1875,15 @@ void qwarks_starfighter_update(Moby388 *moby) { (*(Moby388 **)(hero + 0x15F0))->bBC = 0; } } - starfighter_vars->flight_speed += (frame_time * 30.0f - starfighter_vars->flight_speed) * 0.1f; + starfighter_vars->flight_speed += + (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_sub( + offset, ((char *)&D_0013F3D0), starfighter_vars->tractor_beam_endpoint); fast_vec_normalize(offset, offset, frame_time * 40.0f); - fast_vec_add(starfighter_vars->tractor_beam_endpoint, starfighter_vars->tractor_beam_endpoint, offset); + fast_vec_add(starfighter_vars->tractor_beam_endpoint, + starfighter_vars->tractor_beam_endpoint, + offset); } else { qcopy(offset, ((char *)&D_0013F3D0)); starfighter_vars->attack_and_death_timer_frames = scale_game_frames(0x78); @@ -1871,21 +1897,25 @@ void qwarks_starfighter_update(Moby388 *moby) { if (advance_moby_along_selected_path( moby, starfighter_vars, starfighter_vars->selected_path_slot, 1) & 2) { - if (starfighter_vars->selected_path_slot != qwarks_starfighter_command_path_slots[moby->bBC]) { - starfighter_vars->selected_path_slot = qwarks_starfighter_command_path_slots[moby->bBC]; + if (starfighter_vars->selected_path_slot != + qwarks_starfighter_command_path_slots[moby->bBC]) { + starfighter_vars->selected_path_slot = + qwarks_starfighter_command_path_slots[moby->bBC]; starfighter_vars->path_target_node_index = select_point_index_by_distance( moby->pos, walker_paths[starfighter_vars ->paths[qwarks_starfighter_command_path_slots[moby->bBC]]], 0.0f); - starfighter_vars->path_target_node_index = *(unsigned short *)((char *)starfighter_vars + 0x9C) + - random_int_between(3, 7); + starfighter_vars->path_target_node_index = + *(unsigned short *)((char *)starfighter_vars + 0x9C) + + random_int_between(3, 7); starfighter_vars->path_target_node_index = starfighter_vars->path_target_node_index % *(int *) walker_paths[starfighter_vars->paths [qwarks_starfighter_command_path_slots[moby->bBC]]]; - starfighter_vars->path_previous_node_index = starfighter_vars->path_target_node_index - 1; + starfighter_vars->path_previous_node_index = + starfighter_vars->path_target_node_index - 1; if (starfighter_vars->path_previous_node_index < 0) { starfighter_vars->path_previous_node_index = *(unsigned short *)walker_paths @@ -1898,7 +1928,8 @@ void qwarks_starfighter_update(Moby388 *moby) { fast_vec_sub(ray_start, starfighter_vars->tractor_beam_endpoint, joint); fast_vec_normalize(ray_start, ray_start, 8.0f); fast_vec_add(ray_start, ray_start, joint); - if (collision_line(ray_start, starfighter_vars->tractor_beam_endpoint, 0, moby, 0) != 0) { + if (collision_line(ray_start, starfighter_vars->tractor_beam_endpoint, 0, moby, 0) != + 0) { if (D_L13_00174158[0] == 0 || D_L13_00174158[0]->cls_id == 0xD4) { starfighter_vars->tractor_beam_cycle_timer_frames = 0; } @@ -1937,7 +1968,9 @@ void qwarks_starfighter_update(Moby388 *moby) { fast_vec_normalize(offset, offset, (frame_time * 15.0f < distance) ? frame_time * 15.0f : distance); - fast_vec_add(starfighter_vars->tractor_beam_endpoint, starfighter_vars->tractor_beam_endpoint, offset); + fast_vec_add(starfighter_vars->tractor_beam_endpoint, + starfighter_vars->tractor_beam_endpoint, + offset); } { char *hero = ((char *)&D_0013F350); @@ -1995,14 +2028,19 @@ void qwarks_starfighter_update(Moby388 *moby) { (*(Moby388 **)(((char *)&D_00140940)))->cls_id == 0x45) { (*(Moby388 **)(((char *)&D_00140940)))->bBC = 0; } - advance_moby_along_selected_path(moby, starfighter_vars, starfighter_vars->selected_path_slot, 1); + advance_moby_along_selected_path( + moby, starfighter_vars, starfighter_vars->selected_path_slot, 1); dialog = (char *)&music_stream_state; if (*(int *)(dialog + 0x50) == 0) { int line = *(int *)(dialog + 0x1C); if (line == -1 && (short)starfighter_vars->h138 <= 0) { if (queue_starfighter_voice_line( - moby, starfighter_vars, l13_starfighter_owner_unavailable_voice_line_index + 0x1D, 1) != 0) { - l13_starfighter_owner_unavailable_voice_line_index = (l13_starfighter_owner_unavailable_voice_line_index + 1) % 4; + moby, + starfighter_vars, + l13_starfighter_owner_unavailable_voice_line_index + 0x1D, + 1) != 0) { + l13_starfighter_owner_unavailable_voice_line_index = + (l13_starfighter_owner_unavailable_voice_line_index + 1) % 4; starfighter_vars->h138 += 1; } } @@ -2020,17 +2058,19 @@ void qwarks_starfighter_update(Moby388 *moby) { allocate_voice_for_target_entry(7, 0, (int)moby); } fast_dec_timer(&starfighter_vars->attack_and_death_timer_frames); - if (advance_moby_along_selected_path(moby, starfighter_vars, starfighter_vars->selected_path_slot, 0) != - 0 || + if (advance_moby_along_selected_path( + moby, starfighter_vars, starfighter_vars->selected_path_slot, 0) != 0 || starfighter_vars->path_target_node_index >= - *(int *)walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]] - 1) { + *(int *)walker_paths[starfighter_vars + ->paths[starfighter_vars->selected_path_slot]] - + 1) { starfighter_vars->attack_and_death_timer_frames = scale_game_frames(0xB4); moby->state = STARFIGHTER_STATE_EXPLODE_AND_REMOVE; } moby->rot[0] = fast_add_rotations(moby->rot[0], frame_time * 4.1887903f); { - Path388 *path = - (Path388 *)walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; + Path388 *path = (Path388 *) + walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; int i = starfighter_vars->path_target_node_index; int n = path->n; target_yaw = @@ -2038,13 +2078,14 @@ void qwarks_starfighter_update(Moby388 *moby) { path->pts[(i + 3 < n - 1) ? i + 3 : n - 1][1] - path->pts[i][1]); } { - char *path = walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; + char *path = + walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; int i = starfighter_vars->path_target_node_index; int n = *(int *)path; float flat_distance = vector_distance_xy( path + (i * 16 + 0x10), path + (((i + 3 >= n - 1) ? n - 1 : i + 3) * 16 + 0x10)); - Path388 *path2 = - (Path388 *)walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; + Path388 *path2 = (Path388 *) + walker_paths[starfighter_vars->paths[starfighter_vars->selected_path_slot]]; int i2 = starfighter_vars->path_target_node_index; int path_point_count = path2->n; target_pitch = -fast_arc_tan( @@ -2085,7 +2126,8 @@ void qwarks_starfighter_update(Moby388 *moby) { if (queue_starfighter_voice_line(moby, starfighter_vars, 0x23, 1) != 0) { starfighter_vars->voice_line_history_mask &= 0x7FFFFFFF; } - } else if (starfighter_vars->attack_and_death_timer_frames < scale_game_frames(0xB4) && + } else if (starfighter_vars->attack_and_death_timer_frames < + scale_game_frames(0xB4) && (starfighter_vars->voice_line_history_mask & 0x40000000) && queue_starfighter_voice_line(moby, starfighter_vars, 0x24, 1) != 0) { starfighter_vars->voice_line_history_mask &= 0xBFFFFFFF; @@ -2127,7 +2169,8 @@ void qwarks_starfighter_update(Moby388 *moby) { } func_L13_002E9F90_2(moby, starfighter_vars); if (fast_dec_timer(&starfighter_vars->attack_and_death_timer_frames) != 0) { - Moby388 *owner = (Moby388 *)((char *)moby_base + (starfighter_vars->linked_ship_moby_index << 8)); + Moby388 *owner = + (Moby388 *)((char *)moby_base + (starfighter_vars->linked_ship_moby_index << 8)); owner->state = 8; owner->flags |= 2; if (starfighter_vars->light120 != -1) { @@ -2303,15 +2346,20 @@ void qwarks_starfighter_update(Moby388 *moby) { starfighter_vars->b10F = 0; { - Moby388 *owner = (Moby388 *)((char *)moby_base + (starfighter_vars->linked_ship_moby_index << 8)); + Moby388 *owner = + (Moby388 *)((char *)moby_base + (starfighter_vars->linked_ship_moby_index << 8)); if (moby->state != STARFIGHTER_STATE_OWNER_UNAVAILABLE) { if (owner == 0 || owner->cls_id != 0x45 || owner->state == MOBY_STATE_REMOVAL_AT_OR_ABOVE_INSTANCE_END || owner->state == MOBY_STATE_REMOVAL_BELOW_INSTANCE_END || owner->state == 7) { moby->state = STARFIGHTER_STATE_OWNER_UNAVAILABLE; if (queue_starfighter_voice_line( - moby, starfighter_vars, l13_starfighter_owner_unavailable_voice_line_index + 0x1D, 1) != 0) { - l13_starfighter_owner_unavailable_voice_line_index = (l13_starfighter_owner_unavailable_voice_line_index + 1) % 4; + moby, + starfighter_vars, + l13_starfighter_owner_unavailable_voice_line_index + 0x1D, + 1) != 0) { + l13_starfighter_owner_unavailable_voice_line_index = + (l13_starfighter_owner_unavailable_voice_line_index + 1) % 4; starfighter_vars->h138 = 1; } else { starfighter_vars->h138 = 0; diff --git a/src/overlays/l13/mobys/robosquawker.c b/src/overlays/l13/mobys/robosquawker.c index 8c28e54397..087d00d48e 100644 --- a/src/overlays/l13/mobys/robosquawker.c +++ b/src/overlays/l13/mobys/robosquawker.c @@ -498,12 +498,15 @@ void robosquawker_update(RsMoby *robosquawker_moby) { } robosquawker_moby->w94 = *(int *)(robosquawker_moby->w24 + 0x10); robosquawker_moby->h34 &= 0xFFBE; - select_robosquawker_target( - (char *)robosquawker_moby, (char *)&selected_target_record, robosquawker_vars->target_engagement_radius + 4.0f); + select_robosquawker_target((char *)robosquawker_moby, + (char *)&selected_target_record, + robosquawker_vars->target_engagement_radius + 4.0f); tm = selected_target_record.moby; if (tm == 0 || - (robosquawker_vars->alert_timer_frames == 0 && robosquawker_vars->target_clip_volume_index != -1 && - is_point_inside_clip_volume(&selected_target_record, robosquawker_vars->target_clip_volume_index) == 0)) { + (robosquawker_vars->alert_timer_frames == 0 && + robosquawker_vars->target_clip_volume_index != -1 && + is_point_inside_clip_volume(&selected_target_record, + robosquawker_vars->target_clip_volume_index) == 0)) { selected_target_record.moby = 0; tm = 0; qzero(&selected_target_record); @@ -518,7 +521,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (fast_dec_timer_s16(&robosquawker_vars->alert_timer_frames) != 0) { robosquawker_vars->target_engagement_radius = robosquawker_vars->home_position.f[3]; } else { - robosquawker_vars->target_engagement_radius = robosquawker_vars->default_target_engagement_radius; + robosquawker_vars->target_engagement_radius = + robosquawker_vars->default_target_engagement_radius; } } dmg = 0.0f; @@ -528,7 +532,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { fast_dec_timer_s16(&robosquawker_vars->damage_cooldown_frames); if (robosquawker_vars->damage_cooldown_frames < scale_game_frames(0x2D) && hit != 0 && robosquawker_moby->state != ROBOSQUAWKER_STATE_DEATH_KNOCKBACK) { - if (hit->src->hA6 >= 0xB0 && hit->src->hA6 <= 0xB1 && robosquawker_vars->damage_cooldown_frames != 0) { + if (hit->src->hA6 >= 0xB0 && hit->src->hA6 <= 0xB1 && + robosquawker_vars->damage_cooldown_frames != 0) { hit->damage_amount = 0.0f; } if (robosquawker_moby->command_recipient_list_index != 0xFF) { @@ -545,7 +550,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->motion_horizontal_speed_change_limit = 0.0011f; robosquawker_vars->motion_horizontal_launch_step = robosquawker_damage_knockback_horizontal_speed_gp * frame_time; - robosquawker_vars->motion_vertical_launch_step = robosquawker_damage_knockback_vertical_speed_gp * frame_time; + robosquawker_vars->motion_vertical_launch_step = + robosquawker_damage_knockback_vertical_speed_gp * frame_time; robosquawker_vars->motion_behavior_flags = 9; robosquawker_vars->b15D = 0; if (robosquawker_vars->f20 <= 0.0f) { @@ -553,8 +559,10 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->motion_horizontal_launch_step = frame_time * 10.0f; robosquawker_vars->motion_vertical_launch_step = frame_time * 5.5f; *(u128 *)&va = *(u128 *)&hit->pos; - trooper_knockback_arc( - &va, &knockback_yaw, &robosquawker_vars->motion_horizontal_launch_step, &robosquawker_vars->motion_vertical_launch_step); + trooper_knockback_arc(&va, + &knockback_yaw, + &robosquawker_vars->motion_horizontal_launch_step, + &robosquawker_vars->motion_vertical_launch_step); trooper_start_knockback(robosquawker_moby, robosquawker_vars->x120, knockback_yaw, @@ -570,8 +578,10 @@ void robosquawker_update(RsMoby *robosquawker_moby) { FUN_L00_00257470(robosquawker_moby, 0, -1); } else { *(u128 *)&va = *(u128 *)&hit->pos; - trooper_knockback_arc( - &va, &knockback_yaw, &robosquawker_vars->motion_horizontal_launch_step, &robosquawker_vars->motion_vertical_launch_step); + trooper_knockback_arc(&va, + &knockback_yaw, + &robosquawker_vars->motion_horizontal_launch_step, + &robosquawker_vars->motion_vertical_launch_step); trooper_start_knockback(robosquawker_moby, robosquawker_vars->x120, knockback_yaw, @@ -616,7 +626,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->w180 = 0x38D; robosquawker_vars->ground_max_rise_height = 2.0f; robosquawker_vars->ground_max_drop_height = 2.0f; - robosquawker_vars->ground_movement_step_length = robosquawker_vars->walking_speed * frame_time; + robosquawker_vars->ground_movement_step_length = + robosquawker_vars->walking_speed * frame_time; robosquawker_vars->ground_movement_flags |= 0x30; if (rand() & 1) { robosquawker_moby->h34 |= 0x8000; @@ -633,7 +644,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { update_robosquawker_particle((unsigned char *)robosquawker_moby, (char *)robosquawker_vars); fast_vec_sub(&va, &selected_target_record, &robosquawker_moby->pos); d = probe_ground_height(&robosquawker_moby->pos, 0x120, 0.5f); - if (d > 1.0f && vector_length_xy(&va) < robosquawker_vars->target_engagement_radius + 4.0f && + if (d > 1.0f && + vector_length_xy(&va) < robosquawker_vars->target_engagement_radius + 4.0f && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 10.0f && random_integer_below(0x13) == 0) { if (robosquawker_moby->animation_index != 0) { @@ -643,10 +655,13 @@ void robosquawker_update(RsMoby *robosquawker_moby) { release_robosquawker_particle((Level13VendorMoby *)robosquawker_vars); } else if (d > 1.0f && robosquawker_moby->bBC == 1 && random_integer_below(4) == 0) { if (random_integer_below(0x100) & 1) { - robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; + robosquawker_vars->chase_yaw_offset_degrees = + -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_offset_radians = + robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; + robosquawker_vars->chase_yaw_flip_timer_frames = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); } @@ -658,19 +673,22 @@ void robosquawker_update(RsMoby *robosquawker_moby) { char *path; path = walker_paths[robosquawker_vars->flight_path_index]; - if (fast_vec_dist(&robosquawker_moby->pos, path + (robosquawker_vars->flight_waypoint_index * 16 + 16)) < + if (fast_vec_dist(&robosquawker_moby->pos, + path + (robosquawker_vars->flight_waypoint_index * 16 + 16)) < 0.25f) { robosquawker_vars->flight_waypoint_index += 1; if (robosquawker_vars->flight_waypoint_index >= *(int *)path) { robosquawker_vars->flight_waypoint_index = 0; } } - qcopy(&robosquawker_vars->flight_destination, path + robosquawker_vars->flight_waypoint_index * 16 + 16); + qcopy(&robosquawker_vars->flight_destination, + path + robosquawker_vars->flight_waypoint_index * 16 + 16); robosquawker_moby->state = ROBOSQUAWKER_STATE_FOLLOW_FLIGHT_PATH; } else if (fast_dec_timer(&robosquawker_vars->random_flight_timer_frames) != 0) { int i; - robosquawker_vars->random_flight_timer_frames = scale_game_frames(FUN_L00_00257b90(0x28, 0x78)); + robosquawker_vars->random_flight_timer_frames = + scale_game_frames(FUN_L00_00257b90(0x28, 0x78)); for (i = 0; i < 10; i++) { float r; float a; @@ -681,8 +699,10 @@ void robosquawker_update(RsMoby *robosquawker_moby) { vb.f[1] = fast_sin(a) * r; vb.f[2] = 0.0f; vb.f[2] = random_float_between(5.0f, 7.0f); - fast_vec_add(&robosquawker_vars->flight_destination, &vb, &robosquawker_vars->home_position); - if (probe_ground_height(&robosquawker_vars->flight_destination, 0x120, 0.5f) > 1.0f) { + fast_vec_add( + &robosquawker_vars->flight_destination, &vb, &robosquawker_vars->home_position); + if (probe_ground_height(&robosquawker_vars->flight_destination, 0x120, 0.5f) > + 1.0f) { break; } } @@ -702,7 +722,9 @@ void robosquawker_update(RsMoby *robosquawker_moby) { (char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.03f, 0.6f, 0.09f); flight_step_length = fast_vec_length(&robosquawker_vars->v40); robosquawker_moby->animation_playback_speed = flight_step_length * 20.0f + 1.0f; - fast_vec_sub(&robosquawker_vars->v40, &robosquawker_vars->flight_destination, &robosquawker_moby->pos); + fast_vec_sub(&robosquawker_vars->v40, + &robosquawker_vars->flight_destination, + &robosquawker_moby->pos); if (fast_vec_length(&robosquawker_vars->v40) > 1.0f) { approach_value(&flight_step_length, frame_time * 4.0f, frame_time_sq * 6.0f); } else { @@ -719,7 +741,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { } else { qcopy(&robosquawker_moby->pos, &va); } - if (fast_vec_dist(&robosquawker_moby->pos, &robosquawker_vars->flight_destination) < flight_step_length || + if (fast_vec_dist(&robosquawker_moby->pos, &robosquawker_vars->flight_destination) < + flight_step_length || flight_step_length == 0.0f) { if (robosquawker_moby->animation_index != 0) { blend_moby_animation(robosquawker_moby, 0, 0, scale_game_frames(3)); @@ -739,10 +762,13 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_vars->flight_destination.f[1] - robosquawker_moby->pos.f[1]); FUN_L00_00258278( (char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.018f, 0.8f, 0.09f); - fast_vec_sub(&robosquawker_vars->v40, &robosquawker_vars->flight_destination, &robosquawker_moby->pos); + fast_vec_sub(&robosquawker_vars->v40, + &robosquawker_vars->flight_destination, + &robosquawker_moby->pos); FUN_L00_0025f730(&robosquawker_vars->v40, frame_time * 4.0f); fast_vec_add(&va, &robosquawker_vars->v40, &robosquawker_moby->pos); - robosquawker_moby->animation_playback_speed = fast_vec_length(&robosquawker_vars->v40) * 20.0f + 1.0f; + robosquawker_moby->animation_playback_speed = + fast_vec_length(&robosquawker_vars->v40) * 20.0f + 1.0f; if (coll_sphere(1.2f, &va, 0, robosquawker_moby) != 0) { int i; @@ -757,8 +783,10 @@ void robosquawker_update(RsMoby *robosquawker_moby) { vb.f[1] = fast_sin(an) * r; vb.f[2] = 0.0f; vb.f[2] = random_float_between(5.0f, 7.0f); - fast_vec_add(&robosquawker_vars->flight_destination, &vb, &robosquawker_vars->home_position); - if (probe_ground_height(&robosquawker_vars->flight_destination, 0x120, 0.5f) > 1.0f) { + fast_vec_add( + &robosquawker_vars->flight_destination, &vb, &robosquawker_vars->home_position); + if (probe_ground_height(&robosquawker_vars->flight_destination, 0x120, 0.5f) > + 1.0f) { break; } } @@ -777,11 +805,13 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (robosquawker_vars->flight_waypoint_index >= *(int *)path) { robosquawker_vars->flight_waypoint_index = 0; } - qcopy(&robosquawker_vars->flight_destination, path + robosquawker_vars->flight_waypoint_index * 16 + 16); + qcopy(&robosquawker_vars->flight_destination, + path + robosquawker_vars->flight_waypoint_index * 16 + 16); robosquawker_vars->flight_destination.f[2] = robosquawker_vars->flight_destination.f[2] + random_float_between(-0.2f, 0.2f); g = probe_ground_height(&robosquawker_moby->pos, 0x120, 0.5f); - if (g > 1.0f && vector_length_xy(&vb) < robosquawker_vars->target_engagement_radius + 4.0f && + if (g > 1.0f && + vector_length_xy(&vb) < robosquawker_vars->target_engagement_radius + 4.0f && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 10.0f && random_integer_below(0x13) == 0) { @@ -793,9 +823,11 @@ void robosquawker_update(RsMoby *robosquawker_moby) { release_robosquawker_particle((Level13VendorMoby *)robosquawker_vars); } else if (g > 1.0f && robosquawker_moby->bBC == 1 && random_integer_below(4) == 0) { if (random_integer_below(0x100) & 1) { - robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; + robosquawker_vars->chase_yaw_offset_degrees = + -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; + robosquawker_vars->chase_yaw_offset_radians = + robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); if (robosquawker_moby->animation_index != 0) { @@ -825,10 +857,13 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (robosquawker_moby->pos.f[2] <= g) { robosquawker_moby->pos.f[2] = g; if (random_integer_below(0x100) & 1) { - robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; + robosquawker_vars->chase_yaw_offset_degrees = + -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_offset_radians = + robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; + robosquawker_vars->chase_yaw_flip_timer_frames = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; clear_u64_value(&robosquawker_vars->v40); if (robosquawker_moby->animation_index != 5) { @@ -847,7 +882,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { approach_value(&robosquawker_vars->v40.f[2], frame_time, frame_time_sq * 10.8f); } FUN_L00_00258830(robosquawker_moby, &robosquawker_vars->v40, 0.6f, 0.5f, 0.0f, 0); - robosquawker_moby->animation_playback_speed = 6.0f - (robosquawker_moby->pos.f[2] - g) / 6.0f * 5.0f; + robosquawker_moby->animation_playback_speed = + 6.0f - (robosquawker_moby->pos.f[2] - g) / 6.0f * 5.0f; if (g + 6.0f <= robosquawker_moby->pos.f[2]) { robosquawker_moby->pos.f[2] = g + 6.0f; if (robosquawker_moby->animation_index != 0) { @@ -870,10 +906,13 @@ void robosquawker_update(RsMoby *robosquawker_moby) { } } else if (robosquawker_moby->bBC == 1 && random_integer_below(0x13) == 0) { if (random_integer_below(0x100) & 1) { - robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; + robosquawker_vars->chase_yaw_offset_degrees = + -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_offset_radians = + robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; + robosquawker_vars->chase_yaw_flip_timer_frames = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); @@ -906,11 +945,12 @@ void robosquawker_update(RsMoby *robosquawker_moby) { a = fast_arc_tan(robosquawker_vars->home_position.f[0] - robosquawker_moby->pos.f[0], robosquawker_vars->home_position.f[1] - robosquawker_moby->pos.f[1]); - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); + FUN_L00_00258278( + (char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); fast_vec_sub(&va, &selected_target_record, &robosquawker_vars->home_position); if ((fast_vec_length(&va) < robosquawker_vars->target_engagement_radius && - absolute_float(robosquawker_vars->home_position.f[2] - selected_target_record.pos.f[2]) < - 8.0f) || + absolute_float(robosquawker_vars->home_position.f[2] - + selected_target_record.pos.f[2]) < 8.0f) || robosquawker_moby->bBC == 2) { if (robosquawker_moby->command_recipient_list_index != 0xFF) { FUN_L01_0026e090(robosquawker_moby->command_recipient_list_index, 2); @@ -920,7 +960,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { } robosquawker_vars->motion_horizontal_speed_change_limit = 0.0f; robosquawker_vars->motion_gravity_step = robosquawker_home_hop_gravity_gp; - robosquawker_vars->motion_horizontal_launch_step = robosquawker_home_hop_horizontal_speed_gp * frame_time; + robosquawker_vars->motion_horizontal_launch_step = + robosquawker_home_hop_horizontal_speed_gp * frame_time; robosquawker_vars->motion_vertical_launch_step = FUN_L00_0025abf0(&robosquawker_moby->pos, &robosquawker_vars->home_position, @@ -949,10 +990,13 @@ void robosquawker_update(RsMoby *robosquawker_moby) { qzero(robosquawker_vars->x120); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; if (random_integer_below(0x100) & 1) { - robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; + robosquawker_vars->chase_yaw_offset_degrees = + -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_offset_radians = + robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; + robosquawker_vars->chase_yaw_flip_timer_frames = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 8, scale_game_frames(3)); } @@ -968,7 +1012,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { a = fast_arc_tan(robosquawker_moby->pos.f[0] - selected_target_record.pos.f[0], robosquawker_moby->pos.f[1] - selected_target_record.pos.f[1]); - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278( + (char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); fast_vec_sub(&va, &selected_target_record, &robosquawker_moby->pos); if (fast_vec_length(&va) < robosquawker_vars->target_engagement_radius && absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]) < 8.0f && @@ -977,10 +1022,13 @@ void robosquawker_update(RsMoby *robosquawker_moby) { FUN_L01_0026e090(robosquawker_moby->command_recipient_list_index, 1); } if (random_integer_below(0x100) & 1) { - robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; + robosquawker_vars->chase_yaw_offset_degrees = + -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_offset_radians = + robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; + robosquawker_vars->chase_yaw_flip_timer_frames = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); @@ -988,10 +1036,13 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_moby->bBC = 0; } else if (robosquawker_moby->bBC == 1 && random_integer_below(0x13) == 0) { if (random_integer_below(0x100) & 1) { - robosquawker_vars->chase_yaw_offset_degrees = -robosquawker_vars->chase_yaw_offset_degrees; + robosquawker_vars->chase_yaw_offset_degrees = + -robosquawker_vars->chase_yaw_offset_degrees; } - robosquawker_vars->chase_yaw_offset_radians = robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; - robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_offset_radians = + robosquawker_vars->chase_yaw_offset_degrees * 0.017453292f; + robosquawker_vars->chase_yaw_flip_timer_frames = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); robosquawker_moby->state = ROBOSQUAWKER_STATE_CHASE_TARGET; if (robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); @@ -1013,25 +1064,29 @@ void robosquawker_update(RsMoby *robosquawker_moby) { r = absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]); r = r / vector_distance_xy(&robosquawker_moby->pos, &selected_target_record); if (robosquawker_vars->ground_navigation_path_index != -1) { - select_list_point_toward_target(robosquawker_moby, - walker_paths[robosquawker_vars->ground_navigation_path_index], - &selected_target_record, - &vb); + select_list_point_toward_target( + robosquawker_moby, + walker_paths[robosquawker_vars->ground_navigation_path_index], + &selected_target_record, + &vb); } else { qcopy(&vb, &selected_target_record); } a = fast_arc_tan(vb.f[0] - robosquawker_moby->pos.f[0], vb.f[1] - robosquawker_moby->pos.f[1]) + robosquawker_vars->chase_yaw_offset_radians; - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); + FUN_L00_00258278( + (char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * 2.0f; va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * 2.0f; va.f[2] = 0.0f; res = move_moby_with_ground_and_collision_checks( robosquawker_moby, &robosquawker_vars->w180, &va, &vb, 1.0f); if (fast_dec_timer(&robosquawker_vars->chase_yaw_flip_timer_frames) != 0) { - robosquawker_vars->chase_yaw_flip_timer_frames = scale_game_frames((int)random_float_between(30.0f, 90.0f)); - robosquawker_vars->chase_yaw_offset_radians = -robosquawker_vars->chase_yaw_offset_radians; + robosquawker_vars->chase_yaw_flip_timer_frames = + scale_game_frames((int)random_float_between(30.0f, 90.0f)); + robosquawker_vars->chase_yaw_offset_radians = + -robosquawker_vars->chase_yaw_offset_radians; } fast_vec_sub(&vc, &selected_target_record, &robosquawker_vars->home_position); d = vector_distance_xy(&robosquawker_moby->pos, &selected_target_record); @@ -1074,7 +1129,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { a = fast_arc_tan(selected_target_record.pos.f[0] - robosquawker_moby->pos.f[0], selected_target_record.pos.f[1] - robosquawker_moby->pos.f[1]); - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); + FUN_L00_00258278( + (char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); same = robosquawker_moby->b52 == robosquawker_moby->animation_index; hh = compute_interpolated_record_value(robosquawker_moby); dz = absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]); @@ -1120,16 +1176,18 @@ void robosquawker_update(RsMoby *robosquawker_moby) { float a; if (robosquawker_vars->ground_navigation_path_index != -1) { - select_list_point_toward_target(robosquawker_moby, - walker_paths[robosquawker_vars->ground_navigation_path_index], - &robosquawker_vars->home_position, - &vb); + select_list_point_toward_target( + robosquawker_moby, + walker_paths[robosquawker_vars->ground_navigation_path_index], + &robosquawker_vars->home_position, + &vb); } else { qcopy(&vb, &robosquawker_vars->home_position); } a = fast_arc_tan(vb.f[0] - robosquawker_moby->pos.f[0], vb.f[1] - robosquawker_moby->pos.f[1]); - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278( + (char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.02f, 0.3f, 0.1f); va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * 2.0f; va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * 2.0f; va.f[2] = 0.0f; @@ -1217,16 +1275,18 @@ void robosquawker_update(RsMoby *robosquawker_moby) { r = absolute_float(robosquawker_moby->pos.f[2] - selected_target_record.pos.f[2]); r = r / vector_distance_xy(&robosquawker_moby->pos, &selected_target_record); if (robosquawker_vars->ground_navigation_path_index != -1) { - select_list_point_toward_target(robosquawker_moby, - walker_paths[robosquawker_vars->ground_navigation_path_index], - &robosquawker_vars->home_position, - &vb); + select_list_point_toward_target( + robosquawker_moby, + walker_paths[robosquawker_vars->ground_navigation_path_index], + &robosquawker_vars->home_position, + &vb); } else { qcopy(&vb, &robosquawker_vars->home_position); } a = fast_arc_tan(vb.f[0] - robosquawker_moby->pos.f[0], vb.f[1] - robosquawker_moby->pos.f[1]); - FUN_L00_00258278((char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); + FUN_L00_00258278( + (char *)robosquawker_moby, &robosquawker_vars->yaw_turn_step, a, 0.05f, 0.3f, 0.2f); va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * 2.0f; va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * 2.0f; va.f[2] = 0.0f; @@ -1273,8 +1333,10 @@ void robosquawker_update(RsMoby *robosquawker_moby) { if (robosquawker_moby->b52 != 5 && robosquawker_moby->animation_index != 5) { blend_moby_animation(robosquawker_moby, 5, 0, scale_game_frames(3)); } - va.f[0] = fast_cos(robosquawker_moby->rot.f[2]) * (robosquawker_vars->walking_speed * frame_time); - va.f[1] = fast_sin(robosquawker_moby->rot.f[2]) * (robosquawker_vars->walking_speed * frame_time); + va.f[0] = + fast_cos(robosquawker_moby->rot.f[2]) * (robosquawker_vars->walking_speed * frame_time); + va.f[1] = + fast_sin(robosquawker_moby->rot.f[2]) * (robosquawker_vars->walking_speed * frame_time); va.f[2] = 0.0f; fast_vec_add(&vb, &robosquawker_moby->pos, &va); for (candidate_moby = (RsOther *)level13_moby_list_head; candidate_moby != 0; @@ -1317,7 +1379,8 @@ void robosquawker_update(RsMoby *robosquawker_moby) { robosquawker_moby->pos.f[2] = g; } if (robosquawker_vars->walk_range_anchor == 0 || - vector_distance_xy(&robosquawker_moby->pos, robosquawker_vars->walk_range_anchor + 0x10) > + vector_distance_xy(&robosquawker_moby->pos, + robosquawker_vars->walk_range_anchor + 0x10) > convert_integer_to_float(robosquawker_vars->walk_range_radius)) { robosquawker_moby->state = ROBOSQUAWKER_STATE_RETURN_HOME; if (robosquawker_moby->animation_index != 5) { diff --git a/src/overlays/l14/hero/hero_set_state.c b/src/overlays/l14/hero/hero_set_state.c index 910476ff36..e5228a3748 100644 --- a/src/overlays/l14/hero/hero_set_state.c +++ b/src/overlays/l14/hero/hero_set_state.c @@ -79,7 +79,8 @@ int hero_set_state(int requested_state, int animation_update_mode) { animation_update_mode != HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE)) return 0; } - if ((D_L14_0015F5C4 == 2 || D_L14_0015F5C4 == 6) && animation_update_mode != HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE) + if ((D_L14_0015F5C4 == 2 || D_L14_0015F5C4 == 6) && + animation_update_mode != HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l14/mobys/blarg_heavy_interceptor.c b/src/overlays/l14/mobys/blarg_heavy_interceptor.c index 80499512df..7b63ded96d 100644 --- a/src/overlays/l14/mobys/blarg_heavy_interceptor.c +++ b/src/overlays/l14/mobys/blarg_heavy_interceptor.c @@ -375,13 +375,19 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { update_blarg_heavy_interceptor_patrol_path_position(moby); FUN_L14_002aea08_c618(moby); if (hit) { - lerp_vector(vector_scratch, moby_vars->cached_aim_point_position, moby_vars->unkD0, 0.5f); + lerp_vector( + vector_scratch, moby_vars->cached_aim_point_position, moby_vars->unkD0, 0.5f); qcopy(secondary_vector_scratch, moby_vars->cached_aim_point_position); - noop_main_callback(secondary_vector_scratch, moby_vars->aim_point_glow_quad_scale * 0.8f); + noop_main_callback(secondary_vector_scratch, + moby_vars->aim_point_glow_quad_scale * 0.8f); noop_main_callback(vector_scratch, moby_vars->aim_point_glow_quad_scale * 0.48f); - if (FUN_L00_001f2868_c618(moby_vars->aim_point_glow_quad_scale * 0.48f, vector_scratch, 0, 0, 0) || - FUN_L00_001f2868_c618( - moby_vars->aim_point_glow_quad_scale * 0.9f, secondary_vector_scratch, 0, 0, 0)) { + if (FUN_L00_001f2868_c618( + moby_vars->aim_point_glow_quad_scale * 0.48f, vector_scratch, 0, 0, 0) || + FUN_L00_001f2868_c618(moby_vars->aim_point_glow_quad_scale * 0.9f, + secondary_vector_scratch, + 0, + 0, + 0)) { struct Moby *t = D_L14_00174540.target; if ((char *)t == D_001413D0_lui || @@ -430,7 +436,12 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { } else { vector_scratch[2] -= 0.5f; } - ease_c618(moby_vars->aim_point_position, vector_scratch[0], moby_vars->unk180, 0.003f, 0.2f, 0.0f); + ease_c618(moby_vars->aim_point_position, + vector_scratch[0], + moby_vars->unk180, + 0.003f, + 0.2f, + 0.0f); ease_c618(&moby_vars->aim_point_position[1], vector_scratch[1], &moby_vars->unk180[1], @@ -543,7 +554,8 @@ void blarg_heavy_interceptor_update(struct Moby *moby) { } source_path_distance += moby_vars->unk1C0[3]; tab = ((int *)l14_paths[moby_vars->spawn_path]); - t = source_path_distance / moby_vars->beam_rotation_blink_and_aim_path_state[3] * moby_vars->unk190[0]; + t = source_path_distance / moby_vars->beam_rotation_blink_and_aim_path_state[3] * + moby_vars->unk190[0]; rejoin_path_loop_enabled = moby_vars->rejoin_path_loop; path_seg = 0; path_t = 0.0f; @@ -1242,7 +1254,8 @@ void draw_blarg_heavy_interceptor_spinning_beam(struct Moby *moby) { beam_placement_scratch[0][0] = fast_cos(d->beam_rotation_blink_and_aim_path_state[0]); beam_placement_scratch[0][1] = fast_sin(d->beam_rotation_blink_and_aim_path_state[0]); beam_placement_scratch[0][2] = 0.0f; - d->beam_rotation_blink_and_aim_path_state[0] = fast_add_rotations(d->beam_rotation_blink_and_aim_path_state[0], -0.06981317f); + d->beam_rotation_blink_and_aim_path_state[0] = + fast_add_rotations(d->beam_rotation_blink_and_aim_path_state[0], -0.06981317f); pk.b = tex_b(0xB); pk.c = 0x0000FF9000000260ULL; pk.d = 0x8000000048ULL; @@ -1516,7 +1529,8 @@ void initialize_blarg_heavy_interceptor_paths(struct Moby *moby) { &moby_vars->path_segment, &moby_vars->unk1C0[3], moby_vars->rejoin_path_loop, - moby_vars->initial_path_distance_fraction * moby_vars->beam_rotation_blink_and_aim_path_state[3]); + moby_vars->initial_path_distance_fraction * + moby_vars->beam_rotation_blink_and_aim_path_state[3]); moby_vars->path_point_segment_distance = 0.0f; moby_vars->path_point = 0; FUN_L00_0025d808_2af688(sampling_path, @@ -1542,12 +1556,13 @@ void update_blarg_heavy_interceptor_patrol_aim_point(struct Moby *moby) { float path_target_position[4]; float save = interceptor_instance_vars->unk1C0[3]; int save2 = interceptor_instance_vars->path_segment; - int r = FUN_L00_0025d808_2af918(((int *)l14_paths[interceptor_instance_vars->unk78]), - path_target_position, - &interceptor_instance_vars->path_segment, - &interceptor_instance_vars->unk1C0[3], - interceptor_instance_vars->rejoin_path_loop, - interceptor_instance_vars->beam_rotation_blink_and_aim_path_state[2]); + int r = FUN_L00_0025d808_2af918( + ((int *)l14_paths[interceptor_instance_vars->unk78]), + path_target_position, + &interceptor_instance_vars->path_segment, + &interceptor_instance_vars->unk1C0[3], + interceptor_instance_vars->rejoin_path_loop, + interceptor_instance_vars->beam_rotation_blink_and_aim_path_state[2]); FUN_L00_0025b8c0_c(interceptor_instance_vars->aim_point_position, interceptor_instance_vars->unk180, path_target_position[0], @@ -1570,7 +1585,8 @@ void update_blarg_heavy_interceptor_patrol_aim_point(struct Moby *moby) { if (r != 0) { interceptor_instance_vars->unk1C0[3] = save; interceptor_instance_vars->path_segment = save2; - interceptor_instance_vars->beam_rotation_blink_and_aim_path_state[2] = -interceptor_instance_vars->beam_rotation_blink_and_aim_path_state[2]; + interceptor_instance_vars->beam_rotation_blink_and_aim_path_state[2] = + -interceptor_instance_vars->beam_rotation_blink_and_aim_path_state[2]; } } } @@ -1593,7 +1609,8 @@ void update_blarg_heavy_interceptor_patrol_path_position(struct Moby *moby) { } source_path_distance += heavy_interceptor_vars->unk1C0[3]; tab = ((int *)l14_paths[heavy_interceptor_vars->spawn_path]); - destination_path_distance = source_path_distance / heavy_interceptor_vars->beam_rotation_blink_and_aim_path_state[3] * + destination_path_distance = source_path_distance / + heavy_interceptor_vars->beam_rotation_blink_and_aim_path_state[3] * heavy_interceptor_vars->unk190[0]; destination_path_loop_enabled = heavy_interceptor_vars->rejoin_path_loop; destination_segment_index = 0; @@ -1832,7 +1849,7 @@ void update_blarg_heavy_interceptor_light_ring_alpha(struct Moby *moby) { BlargHeavyInterceptorVars *moby_private_vars = (BlargHeavyInterceptorVars *)moby->pvars; s32 step; s32 i; - f32 advanced_blink_phase = moby_private_vars->beam_rotation_blink_and_aim_path_state[1] + 0.5f; + f32 advanced_blink_phase = moby_private_vars->beam_rotation_blink_and_aim_path_state[1] + 0.5f; moby_private_vars->beam_rotation_blink_and_aim_path_state[1] = advanced_blink_phase; step = truncate_float_to_s32(advanced_blink_phase); if (1.0f <= moby_private_vars->beam_rotation_blink_and_aim_path_state[1]) diff --git a/src/overlays/l14/mobys/elevator.c b/src/overlays/l14/mobys/elevator.c index fd78873605..deb03a86d5 100644 --- a/src/overlays/l14/mobys/elevator.c +++ b/src/overlays/l14/mobys/elevator.c @@ -62,18 +62,18 @@ typedef struct { f32 vel[4]; /* 0xC0 */ f32 rot[4]; /* 0xD0 */ u8 padE0[0x30]; - s32 item; /* 0x110 */ - s32 target; /* 0x114 */ - s32 clip_a; /* 0x118 */ - s32 clip_b; /* 0x11C */ - s32 clip_c; /* 0x120 */ - s16 bought; /* 0x124 */ - s16 level; /* 0x126 */ - f32 level_vel; /* 0x128 */ - s32 motor; /* 0x12C */ - s32 motor_volume; /* 0x130 */ - s32 hum_volume; /* 0x134 */ - s32 idle_glow_phase; /* 0x138 */ + s32 item; /* 0x110 */ + s32 target; /* 0x114 */ + s32 clip_a; /* 0x118 */ + s32 clip_b; /* 0x11C */ + s32 clip_c; /* 0x120 */ + s16 bought; /* 0x124 */ + s16 level; /* 0x126 */ + f32 level_vel; /* 0x128 */ + s32 motor; /* 0x12C */ + s32 motor_volume; /* 0x130 */ + s32 hum_volume; /* 0x134 */ + s32 idle_glow_phase; /* 0x138 */ } L14VendorVars; void elevator_update(struct Moby *m) __asm__("FUN_L14_002ee8d8"); diff --git a/src/overlays/l14/mobys/enemy_fighter.c b/src/overlays/l14/mobys/enemy_fighter.c index cd6f618025..db2f24af00 100644 --- a/src/overlays/l14/mobys/enemy_fighter.c +++ b/src/overlays/l14/mobys/enemy_fighter.c @@ -51,17 +51,17 @@ char D_L14_001FCE48[] = typedef struct { u8 pad0[0x60]; - s32 segment; /* 0x60 */ - s32 along; /* 0x64 */ - s32 path; /* 0x68 */ - s32 sound; /* 0x6C */ - f32 f70; /* 0x70 */ - f32 position_y_spring_state; /* 0x74 */ - f32 position_z_spring_state; /* 0x78 */ - s32 timer; /* 0x7C */ - f32 bank_spring_state; /* 0x80 */ - f32 pitch_spring_state; /* 0x84 */ - f32 yaw_spring_state; /* 0x88 */ + s32 segment; /* 0x60 */ + s32 along; /* 0x64 */ + s32 path; /* 0x68 */ + s32 sound; /* 0x6C */ + f32 f70; /* 0x70 */ + f32 position_y_spring_state; /* 0x74 */ + f32 position_z_spring_state; /* 0x78 */ + s32 timer; /* 0x7C */ + f32 bank_spring_state; /* 0x80 */ + f32 pitch_spring_state; /* 0x84 */ + f32 yaw_spring_state; /* 0x88 */ } EnemyFighterVars; void enemy_fighter_update(struct Moby *moby) __asm__("FUN_L14_002fc0f0"); @@ -131,8 +131,10 @@ void enemy_fighter_update(struct Moby *moby) { qcopy(&moby->pos, path + 0x10); moby->rot.z = fast_arc_tan(*(float *)(path + 0x20) - *(float *)(path + 0x10), *(float *)(path + 0x24) - *(float *)(path + 0x14)); - enemy_fighter_vars->bank_spring_state = enemy_fighter_vars->pitch_spring_state = enemy_fighter_vars->yaw_spring_state = - enemy_fighter_vars->f70 = enemy_fighter_vars->position_y_spring_state = enemy_fighter_vars->position_z_spring_state = 0.0f; + enemy_fighter_vars->bank_spring_state = enemy_fighter_vars->pitch_spring_state = + enemy_fighter_vars->yaw_spring_state = enemy_fighter_vars->f70 = + enemy_fighter_vars->position_y_spring_state = + enemy_fighter_vars->position_z_spring_state = 0.0f; } break; } diff --git a/src/overlays/l14/mobys/flying_car.c b/src/overlays/l14/mobys/flying_car.c index db8b85469c..98432d7eef 100644 --- a/src/overlays/l14/mobys/flying_car.c +++ b/src/overlays/l14/mobys/flying_car.c @@ -140,7 +140,8 @@ void flying_car_update(struct Moby *flying_car_moby) { } if (flying_car_data->sound != -1) { Snd_6ee0 *voice_entry = (Snd_6ee0 *)((u8 *)&voice_pool + flying_car_data->sound * 0x70); - if (voice_entry->f88 == flying_car_moby && voice_entry->voice_state != VOICE_SLOT_FREE) { + if (voice_entry->f88 == flying_car_moby && + voice_entry->voice_state != VOICE_SLOT_FREE) { release_voice_slot(flying_car_data->sound); } } @@ -262,8 +263,10 @@ void flying_car_update(struct Moby *flying_car_moby) { flying_car_data->path_sampling_state = 0; qcopy(&flying_car_moby->pos, &path->a); flying_car_moby->rot.z = fast_arc_tan(path->b.x - path->a.x, path->b.y - path->a.y); - flying_car_data->position_x_spring_state = flying_car_data->position_y_spring_state = flying_car_data->f88 = 0.0f; - flying_car_data->bank_spring_state = flying_car_data->pitch_spring_state = flying_car_data->yaw_spring_state = 0.0f; + flying_car_data->position_x_spring_state = flying_car_data->position_y_spring_state = + flying_car_data->f88 = 0.0f; + flying_car_data->bank_spring_state = flying_car_data->pitch_spring_state = + flying_car_data->yaw_spring_state = 0.0f; if (flying_car_data->part >= 0) { struct Moby *o = (struct Moby *)(D_L14_0015FFD8_macro + (flying_car_data->part << 8)); diff --git a/src/overlays/l14/mobys/flying_debris.c b/src/overlays/l14/mobys/flying_debris.c index 7c301c89f0..227838764a 100644 --- a/src/overlays/l14/mobys/flying_debris.c +++ b/src/overlays/l14/mobys/flying_debris.c @@ -207,7 +207,8 @@ void flying_debris_update(struct Moby *moby) { qcopy(push, (char *)moby + 0xE0); fast_vec_add(at, at, push); if (debris_vars->point_light_slot_index == -1) { - debris_vars->point_light_slot_index = allocate_colored_effect_slot(at, range, 0.0f, bright, green, blue); + debris_vars->point_light_slot_index = + allocate_colored_effect_slot(at, range, 0.0f, bright, green, blue); } else { light_record = (float *)(D_L14_001809C0 + debris_vars->point_light_slot_index * 32); qcopy(light_record + 4, at); diff --git a/src/overlays/l14/mobys/minibomber.c b/src/overlays/l14/mobys/minibomber.c index 81e6efc6db..f3a78739a5 100644 --- a/src/overlays/l14/mobys/minibomber.c +++ b/src/overlays/l14/mobys/minibomber.c @@ -287,7 +287,8 @@ void minibomber_update(Moby_2B5938 *moby) { float spd; if (moby->f70 & 2) { - if (moby->source_animation_id == moby->target_animation_id && moby->source_animation_id != 0) { + if (moby->source_animation_id == moby->target_animation_id && + moby->source_animation_id != 0) { if (moby->source_animation_id == 2) { blend_moby_animation(moby, 0, 0, 10); } else { diff --git a/src/overlays/l14/mobys/racer_path_and_weapon.c b/src/overlays/l14/mobys/racer_path_and_weapon.c index 8d617b6aba..15f2d0b6a6 100644 --- a/src/overlays/l14/mobys/racer_path_and_weapon.c +++ b/src/overlays/l14/mobys/racer_path_and_weapon.c @@ -221,8 +221,9 @@ void reset_racer_group_to_hero_path_position(struct Moby *group_anchor_moby) { char *od = *(char **)(o + 0x78); char *path = (char *)l14_splines[*(int *)(od + 0x60)].path; o[0x20] = 6; - ((M_6570 *)o)->group_anchor_to_hero_heading = fast_arc_tan(hero.motion.pos.f[0] - group_anchor_moby->pos.x, - hero.motion.pos.f[1] - group_anchor_moby->pos.y); + ((M_6570 *)o)->group_anchor_to_hero_heading = + fast_arc_tan(hero.motion.pos.f[0] - group_anchor_moby->pos.x, + hero.motion.pos.f[1] - group_anchor_moby->pos.y); path_step_distance = -racer_path_lead_distance_gp; *(int *)(od + 0x64) = hero.rail_segment; *(float *)(od + 0x68) = hero.rail_seg_frac; @@ -309,7 +310,9 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { if (moby_data->current_path_segment_index >= moby_data->lead_distance_blend_start_segment) { float sum = 0.0f; int k; - for (k = moby_data->lead_distance_blend_start_segment; k < moby_data->current_path_segment_index; k++) { + for (k = moby_data->lead_distance_blend_start_segment; + k < moby_data->current_path_segment_index; + k++) { sum += *(float *)(path + k * 16 + 0x1C); } sum += moby_data->unk68; @@ -323,9 +326,21 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { *(int *)&moby_data->unk68 = 0; moby_data->current_path_segment_index = 0; z = moby_data->unk68; - FUN_L00_0025df68( - path, &D_0013F3D0_67e8, &near.x, &moby_data->current_path_segment_index, &moby_data->unk68, 0, 20.0f, 5.0f, z); - FUN_L00_0025d808(path, &near, &moby_data->current_path_segment_index, &moby_data->unk68, 0, -moby_data->unk70[1]); + FUN_L00_0025df68(path, + &D_0013F3D0_67e8, + &near.x, + &moby_data->current_path_segment_index, + &moby_data->unk68, + 0, + 20.0f, + 5.0f, + z); + FUN_L00_0025d808(path, + &near, + &moby_data->current_path_segment_index, + &moby_data->unk68, + 0, + -moby_data->unk70[1]); vendor_spring(&racer_moby->pos.x, moby_data->position_spring_velocity, near.x, 0.01f, 0.2f, z); vendor_spring( &racer_moby->pos.y, &moby_data->position_spring_velocity[1], near.y, 0.01f, 0.2f, z); @@ -364,8 +379,9 @@ void update_racer_path_and_weapon(struct Moby *racer_moby) { float k; build_moby_bone_transform(racer_moby, 0, moby_data->bone_transform); blend = 1.0f; - aim_timer_fraction = convert_integer_to_float(moby_data->aim_timer) / - convert_integer_to_float(scale_game_frames(l14_racer_weapon_aim_duration_frames)); + aim_timer_fraction = + convert_integer_to_float(moby_data->aim_timer) / + convert_integer_to_float(scale_game_frames(l14_racer_weapon_aim_duration_frames)); k = weapon_aim_final_path_step; ti = ((RacerSeg_67e8 *)moby_data)->seg; tf = ((RacerSeg_67e8 *)moby_data)->frac; diff --git a/src/overlays/l14/mobys/rocket.c b/src/overlays/l14/mobys/rocket.c index e8f318e1e6..a7e2f1e8cd 100644 --- a/src/overlays/l14/mobys/rocket.c +++ b/src/overlays/l14/mobys/rocket.c @@ -184,7 +184,14 @@ void spawn_rocket_exhaust_puffs(struct Moby *source_moby) { for (i = 1; i >= 0; i--) { puff_signed_amount = random_integer_below(0x10); k = random_integer_below(2) == 0 ? puff_signed_amount : -puff_signed_amount; - puff = spawn_puff(B, 0.2f, 1.0f, 0.9f, k, &D_L14_0015F580, 200000.0f, l14_rocket_initial_exhaust_puff_color); + puff = spawn_puff(B, + 0.2f, + 1.0f, + 0.9f, + k, + &D_L14_0015F580, + 200000.0f, + l14_rocket_initial_exhaust_puff_color); if (puff != 0) { L14PuffTail *f = &puff->tail; diff --git a/src/overlays/l14/mobys/rocket_strike_fighter.c b/src/overlays/l14/mobys/rocket_strike_fighter.c index 160fb3a13f..7122e56c2e 100644 --- a/src/overlays/l14/mobys/rocket_strike_fighter.c +++ b/src/overlays/l14/mobys/rocket_strike_fighter.c @@ -69,22 +69,22 @@ int advance_rocket_strike_fighter_along_flight_path(struct Moby *m) __asm__("FUN typedef struct { u8 pad0[0x60]; - s32 segment; /* 0x60 */ - s32 along; /* 0x64 */ - s32 path; /* 0x68 */ - s32 sound; /* 0x6C */ - f32 f70; /* 0x70 */ - f32 position_y_spring_velocity; /* 0x74 */ - f32 position_z_spring_velocity; /* 0x78 */ - s32 timer; /* 0x7C */ - f32 rotation_x_spring_velocity; /* 0x80 */ - f32 rotation_y_spring_velocity; /* 0x84 */ - f32 rotation_z_spring_velocity; /* 0x88 */ - s32 rocket; /* 0x8C: its class 922 rocket */ - s32 flythrough; /* 0x90: the flythrough camera descriptor it starts */ - s32 stage; /* 0x94 */ - s32 mission[3]; /* 0x98: the missions that must be complete */ - s32 clip; /* 0xA4 */ + s32 segment; /* 0x60 */ + s32 along; /* 0x64 */ + s32 path; /* 0x68 */ + s32 sound; /* 0x6C */ + f32 f70; /* 0x70 */ + f32 position_y_spring_velocity; /* 0x74 */ + f32 position_z_spring_velocity; /* 0x78 */ + s32 timer; /* 0x7C */ + f32 rotation_x_spring_velocity; /* 0x80 */ + f32 rotation_y_spring_velocity; /* 0x84 */ + f32 rotation_z_spring_velocity; /* 0x88 */ + s32 rocket; /* 0x8C: its class 922 rocket */ + s32 flythrough; /* 0x90: the flythrough camera descriptor it starts */ + s32 stage; /* 0x94 */ + s32 mission[3]; /* 0x98: the missions that must be complete */ + s32 clip; /* 0xA4 */ } RocketStrikeFighterVars; void rocket_strike_fighter_update(struct Moby *moby) __asm__("FUN_L14_002fcbb0"); @@ -245,8 +245,10 @@ void rocket_strike_fighter_update(struct Moby *moby) { qcopy(&moby->pos, path + 0x10); moby->rot.z = fast_arc_tan(*(float *)(path + 0x20) - *(float *)(path + 0x10), *(float *)(path + 0x24) - *(float *)(path + 0x14)); - moby_vars->rotation_x_spring_velocity = moby_vars->rotation_y_spring_velocity = moby_vars->rotation_z_spring_velocity = moby_vars->f70 = moby_vars->position_y_spring_velocity = - moby_vars->position_z_spring_velocity = 0.0f; + moby_vars->rotation_x_spring_velocity = moby_vars->rotation_y_spring_velocity = + moby_vars->rotation_z_spring_velocity = moby_vars->f70 = + moby_vars->position_y_spring_velocity = moby_vars->position_z_spring_velocity = + 0.0f; } break; } diff --git a/src/overlays/l14/mobys/wind_control.c b/src/overlays/l14/mobys/wind_control.c index c7673a463b..32e77ca9bb 100644 --- a/src/overlays/l14/mobys/wind_control.c +++ b/src/overlays/l14/mobys/wind_control.c @@ -226,7 +226,8 @@ void initialize_wind_spark(struct Moby *wind_control_moby, int i, void *spark_tr spark_vars->spark_step_distance[i] = random_float_between(wind_spark_speed_range_start_gp, wind_spark_speed_range_end_gp) * frame_time; - lifetime_frames = scale_game_frames(ftoi_k(spark_vars->f14 * 2.0f / spark_vars->spark_step_distance[i])); + 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; @@ -289,7 +290,8 @@ void update_wind_sparks(struct Moby *wind_control_moby) { *shade = spark_alpha; } } - fast_vec_scale(spark_position_delta, spark_travel_direction, spark_vars->spark_step_distance[i]); + fast_vec_scale( + spark_position_delta, spark_travel_direction, spark_vars->spark_step_distance[i]); fast_vec_add(pos, pos, spark_position_delta); if (in_clip != 0 && absolute_float(pos[0] - l14_camera.pos.f[0]) < 8.0f && absolute_float(pos[1] - l14_camera.pos.f[1]) < 8.0f && diff --git a/src/overlays/l14/path_camera.c b/src/overlays/l14/path_camera.c index 1d217fd5ee..28b716cd23 100644 --- a/src/overlays/l14/path_camera.c +++ b/src/overlays/l14/path_camera.c @@ -37,8 +37,9 @@ typedef struct { void setup_path_camera(char *camera) __asm__("FUN_L14_00314f00"); void setup_path_camera(char *camera) { - u128 stand; - char *path_camera_setup_preset = *(char **)(l14_camera_preset_rows + *(short *)(camera + 0x84) * 32 + 0x1C); + u128 stand; + char *path_camera_setup_preset = + *(char **)(l14_camera_preset_rows + *(short *)(camera + 0x84) * 32 + 0x1C); char *camera_saved_state; char *fov_stops_state_base; char *path; @@ -62,7 +63,8 @@ void setup_path_camera(char *camera) { camera_run[3] = 0; camera_run[4] = 0; *(short *)(camera_run + 5) = 0; - *((short *)(camera_run + 5) + 1) = scale_game_frames(*(short *)(path_camera_setup_preset + 0x3A)); + *((short *)(camera_run + 5) + 1) = + scale_game_frames(*(short *)(path_camera_setup_preset + 0x3A)); fov_stops_state_base = *(char **)(camera + 0x70); fov_stops = (Stops_4f00 *)(fov_stops_state_base + 0x58); { @@ -93,7 +95,9 @@ void setup_path_camera(char *camera) { if (*(short *)(path_camera_setup_preset + 0x3A) > 0) { *(float *)(path_camera_setup_preset + 0x3C) = *(float *)(camera_run + 2) / - convert_integer_to_float(scale_game_frames(*(short *)(path_camera_setup_preset + 0x3A))) * 60.0f; + convert_integer_to_float( + scale_game_frames(*(short *)(path_camera_setup_preset + 0x3A))) * + 60.0f; } if (*(int *)(path_camera_setup_preset + 0x24) >= 0) { path = ((char *)l14_paths[*(int *)(path_camera_setup_preset + 0x24)]); @@ -167,7 +171,8 @@ void update_path_camera(struct UpdateCam *path_camera) { s32 seg2; f32 tt2; char *camera_saved_state = (char *)path_camera->saved_state; - char *path_camera_preset = *(char **)(l14_camera_preset_rows + path_camera->descriptor_index * 32 + 0x1C); + char *path_camera_preset = + *(char **)(l14_camera_preset_rows + path_camera->descriptor_index * 32 + 0x1C); VendorCamRun_5290 *camera_run = (VendorCamRun_5290 *)(camera_saved_state + 0x40); VendorCamStops_5290 *fov_stops = (VendorCamStops_5290 *)(camera_saved_state + 0x58); char *path; @@ -181,8 +186,9 @@ void update_path_camera(struct UpdateCam *path_camera) { camera_run->started = 1; qcopy(&path_camera->pos, pa + 0x10); if (*(int *)(path_camera_preset + 0x28) >= 0) { - struct Moby *o = (struct Moby *)(D_L14_0015FFD8_5290 + *(int *)(path_camera_preset + 0x28) * 256); - float *ofs = (float *)(path_camera_preset + 0x2C); + struct Moby *o = + (struct Moby *)(D_L14_0015FFD8_5290 + *(int *)(path_camera_preset + 0x28) * 256); + float *ofs = (float *)(path_camera_preset + 0x2C); t[0] = ofs[0]; t[1] = ofs[1]; t[2] = ofs[2]; @@ -222,7 +228,8 @@ void update_path_camera(struct UpdateCam *path_camera) { path_camera->transition_state = PATH_CAMERA_TRANSITION_PATH_FINISHED; path_camera_active = 0; mb = D_L14_0015FFD8_5290; - reset_racer_group_to_hero_path_position((struct Moby *)(mb + *(int *)(path_camera_preset + 0x50) * 256)); + reset_racer_group_to_hero_path_position( + (struct Moby *)(mb + *(int *)(path_camera_preset + 0x50) * 256)); hp = (char *)hero.rail_spline; seg = hero.rail_segment; tt = hero.rail_seg_frac; @@ -265,8 +272,9 @@ void update_path_camera(struct UpdateCam *path_camera) { camera_run->dist += fast_vec_dist(initial_look_direction_or_previous_position, &path_camera->pos); if (*(int *)(path_camera_preset + 0x28) >= 0) { - struct Moby *o = (struct Moby *)(D_L14_0015FFD8_5290 + *(int *)(path_camera_preset + 0x28) * 256); - float *ofs = (float *)(path_camera_preset + 0x2C); + struct Moby *o = + (struct Moby *)(D_L14_0015FFD8_5290 + *(int *)(path_camera_preset + 0x28) * 256); + float *ofs = (float *)(path_camera_preset + 0x2C); u[0] = ofs[0]; u[1] = ofs[1]; u[2] = ofs[2]; @@ -293,8 +301,9 @@ int check_path_camera_priority(char *camera, char *control_mode_gate_object) __asm__("FUN_L14_00315920"); int check_path_camera_priority(char *camera, char *control_mode_gate_object) { - char *path_camera_priority_preset = *(char **)(l14_camera_preset_rows + *(short *)(camera + 0x84) * 32 + 0x1C); - int required_control_mode, required_hero_state; + char *path_camera_priority_preset = + *(char **)(l14_camera_preset_rows + *(short *)(camera + 0x84) * 32 + 0x1C); + int required_control_mode, required_hero_state; if (*(unsigned char *)(path_camera_priority_preset + 0x38) != 0) return -1; if (control_mode_gate_object != 0 && *(short *)(control_mode_gate_object + 0x7E) == 0) { diff --git a/src/overlays/l14/path_key_camera.c b/src/overlays/l14/path_key_camera.c index 5aa61e3034..cdadb2f2a6 100644 --- a/src/overlays/l14/path_key_camera.c +++ b/src/overlays/l14/path_key_camera.c @@ -280,9 +280,12 @@ void update_path_key_camera(char *path_key_camera) { } if (rec->n30 < 3 && path_key_camera_linked_moby_event_progress_thresholds[rec->n30][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 = (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->second_linked_moby_index << 8)); - struct Moby *third_linked_moby = (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->third_linked_moby_index << 8)); + struct Moby *first_linked_moby = + (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->first_linked_moby_index << 8)); + struct Moby *second_linked_moby = + (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->second_linked_moby_index << 8)); + struct Moby *third_linked_moby = + (struct Moby *)(D_L14_0015FFD8_5d48 + (rec->third_linked_moby_index << 8)); if (hero.rail_spline == (s32)l14_splines_macro[MOBYDATA_5d48(first_linked_moby)->zone].path) { diff --git a/src/overlays/l15/hero/hero_set_state.c b/src/overlays/l15/hero/hero_set_state.c index cb2b9c8be9..70748581a7 100644 --- a/src/overlays/l15/hero/hero_set_state.c +++ b/src/overlays/l15/hero/hero_set_state.c @@ -82,7 +82,8 @@ int hero_set_state(int requested_state, int entry_animation_mode) { entry_animation_mode != HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE)) return 0; } - if ((D_L15_0015F5C4 == 2 || D_L15_0015F5C4 == 6) && entry_animation_mode != HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE) + if ((D_L15_0015F5C4 == 2 || D_L15_0015F5C4 == 6) && + entry_animation_mode != HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l15/mobys/poison_vessel.c b/src/overlays/l15/mobys/poison_vessel.c index 63786d1e8a..8a9c18ffd4 100644 --- a/src/overlays/l15/mobys/poison_vessel.c +++ b/src/overlays/l15/mobys/poison_vessel.c @@ -159,7 +159,8 @@ void poison_vessel_update(Moby_2E9358 *moby) { } } hit_result = find_moby_hit(moby, 0x830000, 0); - if (hit_result != 0 && hit_result->owner != 0 && hit_result->owner->object_class != moby->object_class) { + if (hit_result != 0 && hit_result->owner != 0 && + hit_result->owner->object_class != moby->object_class) { moby->bBC = 1; } moby->bA4 = 0xFF; diff --git a/src/overlays/l15/mobys/quartu_cutscene_trigger.c b/src/overlays/l15/mobys/quartu_cutscene_trigger.c index 446cc5947b..20ab0366f2 100644 --- a/src/overlays/l15/mobys/quartu_cutscene_trigger.c +++ b/src/overlays/l15/mobys/quartu_cutscene_trigger.c @@ -141,7 +141,8 @@ void draw_quartu_cutscene_messages(void) { sprintf(formatted_message_text, quartu_cutscene_message_format, get_help_message_text(0x526A)); - message_reveal_count = (*(int *)(message_timing_state + 0x34) - scale_game_frames(0xB5)) >> 2; + message_reveal_count = + (*(int *)(message_timing_state + 0x34) - scale_game_frames(0xB5)) >> 2; } } second_message_timing_state = D_L15_0016CE60; @@ -162,7 +163,8 @@ void draw_quartu_cutscene_messages(void) { sprintf(formatted_message_text, quartu_cutscene_message_format, get_help_message_text(0x526C)); - message_reveal_count = (*(int *)(third_message_timing_state + 0x34) - scale_game_frames(0x2EE)) >> 2; + message_reveal_count = + (*(int *)(third_message_timing_state + 0x34) - scale_game_frames(0x2EE)) >> 2; } } } else if (*(int *)(message_timing_state + 0x30) == 4) { @@ -172,7 +174,8 @@ void draw_quartu_cutscene_messages(void) { sprintf(formatted_message_text, quartu_cutscene_message_format, get_help_message_text(0x526E)); - message_reveal_count = (*(int *)(message_timing_state + 0x34) - scale_game_frames(0x8FC)) >> 2; + message_reveal_count = + (*(int *)(message_timing_state + 0x34) - scale_game_frames(0x8FC)) >> 2; } } } diff --git a/src/overlays/l15/mobys/ultramech_scientist.c b/src/overlays/l15/mobys/ultramech_scientist.c index 4d171e8436..16fb51f4e4 100644 --- a/src/overlays/l15/mobys/ultramech_scientist.c +++ b/src/overlays/l15/mobys/ultramech_scientist.c @@ -136,9 +136,11 @@ void ultramech_scientist_update(struct Moby *moby) { char *player = D_0013E533 + 0xE1D; if (*(unsigned char *)(player + 0x20A4) != 2) { int mobys = (int)l15_moby_array; - *(int *)((ultramech_scientist_private_data->scene_animation_moby_index << 8) + mobys + 0x94) = 0; - *(unsigned short *)((ultramech_scientist_private_data->scene_animation_moby_index << 8) + mobys + 0x34) |= - 0x41; + *(int *)((ultramech_scientist_private_data->scene_animation_moby_index << 8) + mobys + + 0x94) = 0; + *(unsigned short *)((ultramech_scientist_private_data->scene_animation_moby_index + << 8) + + mobys + 0x34) |= 0x41; } } if (moby->state == ULTRAMECH_SCIENTIST_DISABLED) { @@ -162,8 +164,8 @@ void ultramech_scientist_update(struct Moby *moby) { moby->update_dist = 0xFF; ultramech_scientist_private_data->unkC = 20.0f; initialize_npc_dialogue(moby, ultramech_scientist_private_data); - if (visited52[ultramech_scientist_private_data->dialogue_mission_id + (current_level_index_gp << 4)] != - 0xFF) { + if (visited52[ultramech_scientist_private_data->dialogue_mission_id + + (current_level_index_gp << 4)] != 0xFF) { break; } if (level_available[16] != 0) { @@ -179,7 +181,8 @@ void ultramech_scientist_update(struct Moby *moby) { int dead_state = MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY; int gone_state = MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY; for (; moby_list_cursor != 0; moby_list_cursor = moby_list_cursor->next) { - if (moby_list_cursor->mission != ultramech_scientist_private_data->dialogue_mission_id) { + if (moby_list_cursor->mission != + ultramech_scientist_private_data->dialogue_mission_id) { continue; } if (moby_list_cursor == moby) { @@ -222,7 +225,8 @@ void ultramech_scientist_update(struct Moby *moby) { int dead_state = MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY; int gone_state = MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY; for (; moby_list_cursor != 0; moby_list_cursor = moby_list_cursor->next) { - if (moby_list_cursor->mission != ultramech_scientist_private_data->dialogue_mission_id) { + if (moby_list_cursor->mission != + ultramech_scientist_private_data->dialogue_mission_id) { continue; } if (moby_list_cursor == moby) { @@ -264,8 +268,8 @@ void ultramech_scientist_update(struct Moby *moby) { } } if (ultramech_scientist_private_data->moby_to_remove_index != -1) { - char *spawned = - (char *)l15_moby_array + (ultramech_scientist_private_data->moby_to_remove_index << 8); + char *spawned = (char *)l15_moby_array + + (ultramech_scientist_private_data->moby_to_remove_index << 8); if (spawned != 0) { int state = *(unsigned char *)(spawned + 0x20); if (state != MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY) { @@ -279,7 +283,8 @@ void ultramech_scientist_update(struct Moby *moby) { if (count_active_moby_group_members(ultramech_scientist_private_data->unk144, 0x40) != 0) { break; } - if (count_active_moby_group_members(ultramech_scientist_private_data->pre_scene_moby_group_index, 0x40) != 0) { + if (count_active_moby_group_members( + ultramech_scientist_private_data->pre_scene_moby_group_index, 0x40) != 0) { break; } moby->state = ULTRAMECH_SCIENTIST_WAIT_FOR_PRE_SCENE_DELAY; @@ -290,8 +295,10 @@ void ultramech_scientist_update(struct Moby *moby) { break; } restore_saved_hero_moby_and_clear_vehicle_mode(); - set_moby_animation( - (char *)l15_moby_array + (ultramech_scientist_private_data->scene_animation_moby_index << 8), 0, 0); + set_moby_animation((char *)l15_moby_array + + (ultramech_scientist_private_data->scene_animation_moby_index << 8), + 0, + 0); ultramech_scientist_private_data->unk140 = 1; ultramech_scientist_private_data->unk36 = 1; ultramech_scientist_private_data->unk8 = 1; @@ -301,13 +308,21 @@ void ultramech_scientist_update(struct Moby *moby) { if (ultramech_scientist_private_data->pre_scene_camera_transform_index != -1) { char *paths = D_L15_001600EC; char *paths_again; - set_race_camera(paths + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + 0x30, - paths + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + 0x70, - 0, - 1); + set_race_camera( + paths + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + + 0x30, + paths + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + + 0x70, + 0, + 1); paths_again = D_L15_001600EC; - FUN_L00_00284e50(paths_again + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + 0x30, - paths_again + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + 0x70); + FUN_L00_00284e50( + paths_again + + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + + 0x30, + paths_again + + (ultramech_scientist_private_data->pre_scene_camera_transform_index << 7) + + 0x70); } moby->state = ULTRAMECH_SCIENTIST_START_FIRST_SCENE; break; @@ -374,7 +389,8 @@ void ultramech_scientist_update(struct Moby *moby) { } if (ultramech_scientist_private_data->timer_274 != 0) { ultramech_scientist_private_data->timer_274 = 0; - qcopy(&ultramech_scientist_private_data->idle_gaze_target_position, D_0013E533 + 0xE1D + 0xD0); + qcopy(&ultramech_scientist_private_data->idle_gaze_target_position, + D_0013E533 + 0xE1D + 0xD0); } wander: if (fast_dec_timer(&ultramech_scientist_private_data->timer_278) == 0) { @@ -387,8 +403,10 @@ void ultramech_scientist_update(struct Moby *moby) { value = random_float_between(-90.0f, 90.0f); heading = fast_add_rotations(moby->rot.z, value * deg_to_rad); value = random_float_between(0.0f, 30.0f); - build_spherical_offset( - &ultramech_scientist_private_data->idle_gaze_target_position, 6.0f, heading, value * deg_to_rad); + build_spherical_offset(&ultramech_scientist_private_data->idle_gaze_target_position, + 6.0f, + heading, + value * deg_to_rad); fast_vec_add(&ultramech_scientist_private_data->idle_gaze_target_position, &ultramech_scientist_private_data->idle_gaze_target_position, &moby->pos); diff --git a/src/overlays/l15/mobys/ultramech_unlimited.c b/src/overlays/l15/mobys/ultramech_unlimited.c index 2d4a9990af..5d9a54fb29 100644 --- a/src/overlays/l15/mobys/ultramech_unlimited.c +++ b/src/overlays/l15/mobys/ultramech_unlimited.c @@ -363,14 +363,16 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { ultramech_moby->flags = (ultramech_moby->flags & 0xFFBE) | 0x1000; } } - if (ultramech_vars->target_range_status != ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE && ultramech_vars->path != -1) { + if (ultramech_vars->target_range_status != ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE && + ultramech_vars->path != -1) { struct Hero *pl = &hero; if (pl->vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK && (ultramech_moby->flags & 0x1000)) { if (ultramech_vars->target_constraint_path_index != -1 && - !point_in_path_xy(&pl->motion.pos, - D_L15_001B0AB0[ultramech_vars->target_constraint_path_index]->points, - D_L15_001B0AB0[ultramech_vars->target_constraint_path_index]->count)) { + !point_in_path_xy( + &pl->motion.pos, + D_L15_001B0AB0[ultramech_vars->target_constraint_path_index]->points, + D_L15_001B0AB0[ultramech_vars->target_constraint_path_index]->count)) { ultramech_moby->collision_geometry = 0; ultramech_moby->flags = (ultramech_moby->flags | 0x41) & 0xEFFF; } else { @@ -566,8 +568,8 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { ultramech_moby->state = ULTRAMECH_WAIT_BETWEEN_BURSTS; if (ultramech_moby->anim != 0) blend_moby_animation(ultramech_moby, 0, 0, scale_game_frames(0xA)); - ultramech_vars->timer = - truncate_float_to_s32(FUN_L04_001f1978(ultramech_vars->burst_pause_duration * 60.0f)); + ultramech_vars->timer = truncate_float_to_s32( + FUN_L04_001f1978(ultramech_vars->burst_pause_duration * 60.0f)); } else if (ultramech_vars->suppress_close_combat_and_knockback_motion == 0 && vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) < *(float *)&ultramech_approach_target_range_gp) { @@ -582,7 +584,8 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { blend_moby_animation(ultramech_moby, 2, 0, scale_game_frames(0xA)); } else if (ultramech_vars->suppress_close_combat_and_knockback_motion == 0 && vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) > 10.0f && - ultramech_vars->damage_reaction_this_update != 0 && ultramech_vars->combat_path_moves_disabled == 0) { + ultramech_vars->damage_reaction_this_update != 0 && + ultramech_vars->combat_path_moves_disabled == 0) { ultramech_moby->state = ULTRAMECH_BALLISTIC_PATH_MOVE; ultramech_vars->timer = 0; ultramech_vars->side = (ultramech_vars->side + 1) & 1; @@ -665,7 +668,9 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { combat_target->pos.f[1] - ultramech_moby->pos.f[1]); if (ultramech_vars->target_range_status != ULTRAMECH_TARGET_OUTSIDE_SEARCH_RANGE) { desired_heading = compute_ultramech_flocking_steering_point( - ultramech_moby, &position_or_motion_vector, ultramech_vars->current_target_search_range); + ultramech_moby, + &position_or_motion_vector, + ultramech_vars->current_target_search_range); if (vector_distance_xy(&ultramech_moby->pos, &combat_target->pos) < *(float *)&ultramech_melee_range_gp) { ultramech_moby->state = ULTRAMECH_MELEE_ATTACK; @@ -786,7 +791,8 @@ void ultramech_unlimited_update(UMoby *ultramech_moby) { } else { ultramech_moby->animSpeed = 1.0f; } - if ((r & 0x40) || (ultramech_vars->suppress_close_combat_and_knockback_motion != 0 && (ultramech_moby->animFlags & 2))) { + if ((r & 0x40) || (ultramech_vars->suppress_close_combat_and_knockback_motion != 0 && + (ultramech_moby->animFlags & 2))) { if (ultramech_vars->combat_path_moves_disabled == 0) { ultramech_moby->state = ULTRAMECH_BALLISTIC_PATH_MOVE; ultramech_vars->timer = 0; @@ -1135,9 +1141,12 @@ void process_ultramech_hits_and_update_target(void *ultramech_instance) { goto follow_path; ultramech_vars->current_target_search_range = *(float *)((char *)ultramech_vars + 0x178); } else { - ultramech_vars->current_target_search_range = ultramech_vars->activation_target_search_range; + ultramech_vars->current_target_search_range = + ultramech_vars->activation_target_search_range; } - FUN_0024f560(ultramech_vars->current_target_search_range, ultramech_moby, (char *)ultramech_vars + 0x120); + FUN_0024f560(ultramech_vars->current_target_search_range, + ultramech_moby, + (char *)ultramech_vars + 0x120); goto check_path; follow_path: { LevelPath *path; @@ -1152,7 +1161,8 @@ follow_path: { path->count); } check_path: - if (ultramech_vars->current_target_search_range < fast_vec_dist(&ultramech_moby->pos, (char *)ultramech_vars + 0x120)) + if (ultramech_vars->current_target_search_range < + fast_vec_dist(&ultramech_moby->pos, (char *)ultramech_vars + 0x120)) ultramech_vars->target_range_status = 2; if (ultramech_vars->target == 0) ultramech_vars->target = (UMoby *)D_001413D0; diff --git a/src/overlays/l16/hero/hero_set_state.c b/src/overlays/l16/hero/hero_set_state.c index 9ff150cd5f..200b2e4164 100644 --- a/src/overlays/l16/hero/hero_set_state.c +++ b/src/overlays/l16/hero/hero_set_state.c @@ -93,10 +93,12 @@ int hero_set_state(int requested_state, int animation_update_mode) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_update_mode != HERO_ANIMATION_UPDATE_GUARD_OVERRIDE)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || + animation_update_mode != HERO_ANIMATION_UPDATE_GUARD_OVERRIDE)) return 0; } - if ((D_L16_0015F5C4 == 2 || D_L16_0015F5C4 == 6) && animation_update_mode != HERO_ANIMATION_UPDATE_GUARD_OVERRIDE) + if ((D_L16_0015F5C4 == 2 || D_L16_0015F5C4 == 6) && + animation_update_mode != HERO_ANIMATION_UPDATE_GUARD_OVERRIDE) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l16/mobys/elevator.c b/src/overlays/l16/mobys/elevator.c index dcd511c09c..f7c18f8b99 100644 --- a/src/overlays/l16/mobys/elevator.c +++ b/src/overlays/l16/mobys/elevator.c @@ -289,7 +289,9 @@ void draw_elevator_rotating_rings(struct Moby *elevator_moby) { matrix.position[3] = 1.0f; packet.texture = get_effect_texture(14); packet.flags = 0xFF9000000260L; - packet.mode = (long)l16_elevator_ring_blend_color_a_selector | ((long)l16_elevator_ring_blend_color_b_selector << 2) | ((long)l16_elevator_ring_blend_alpha_selector << 4) | + packet.mode = (long)l16_elevator_ring_blend_color_a_selector | + ((long)l16_elevator_ring_blend_color_b_selector << 2) | + ((long)l16_elevator_ring_blend_alpha_selector << 4) | ((long)l16_elevator_ring_blend_color_d_selector << 6) | 0x8000000000L; packet.zero = 0; uv = elevator_ring_quad_uvs; diff --git a/src/overlays/l16/mobys/grindrail_gate.c b/src/overlays/l16/mobys/grindrail_gate.c index c6574a5561..730014a21b 100644 --- a/src/overlays/l16/mobys/grindrail_gate.c +++ b/src/overlays/l16/mobys/grindrail_gate.c @@ -58,7 +58,8 @@ void grindrail_gate_update(struct Moby *gate_moby) { hero_offset_from_gate[2] < grindrail_gate_local_trigger_bounds[5]) { gate_moby->command = 1; gate_moby->state = GRINDRAIL_GATE_WAIT_FOR_COMMAND_TIMEOUT; - *(int *)command_timer = scale_game_frames(l16_grindrail_gate_command_duration_frames); + *(int *)command_timer = + scale_game_frames(l16_grindrail_gate_command_duration_frames); func_0022ED80_6478(1, 0, gate_moby); } } diff --git a/src/overlays/l16/mobys/local_bounds_command_trigger.c b/src/overlays/l16/mobys/local_bounds_command_trigger.c index 7dbeba894c..8d9e5e5953 100644 --- a/src/overlays/l16/mobys/local_bounds_command_trigger.c +++ b/src/overlays/l16/mobys/local_bounds_command_trigger.c @@ -64,7 +64,8 @@ void local_bounds_command_trigger_update(struct Moby *trigger_moby) { allocate_voice_for_target_entry(1, 0, trigger_moby); trigger_moby->command = 1; trigger_moby->state = GRINDRAIL_TRIGGER_WAIT_FOR_COMMAND_TIMEOUT; - *(int *)command_timer = scale_game_frames(l16_local_bounds_trigger_command_timeout_frames); + *(int *)command_timer = + scale_game_frames(l16_local_bounds_trigger_command_timeout_frames); } } break; diff --git a/src/overlays/l16/mobys/path_walker.c b/src/overlays/l16/mobys/path_walker.c index 6000bd4a8a..d4166affa2 100644 --- a/src/overlays/l16/mobys/path_walker.c +++ b/src/overlays/l16/mobys/path_walker.c @@ -237,8 +237,12 @@ void emit_path_walker_particle(unsigned char *source_moby, void *previous_positi 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, velocity, l16_path_walker_particle_initial_color, D_L16_00161E9C, final_size, scale_game_frames(0x23)); + func_L00_0026DD70_emit(offset, + velocity, + l16_path_walker_particle_initial_color, + D_L16_00161E9C, + final_size, + scale_game_frames(0x23)); } /* Start of a walker group: lists the group's mobys and spaces them along the path in random order. */ diff --git a/src/overlays/l16/mobys/test_dummy.c b/src/overlays/l16/mobys/test_dummy.c index 5471837977..57ba7a69d7 100644 --- a/src/overlays/l16/mobys/test_dummy.c +++ b/src/overlays/l16/mobys/test_dummy.c @@ -400,7 +400,8 @@ void test_dummy_update(unsigned char *moby) { break; case TEST_DUMMY_STATE_TURN_AND_RESUME_SAVED_STATE: /* turn back to the node, then resume the saved state and animation */ position_or_delta.quad = *(u128 *)(path + dummy_data->node * 16 + 16); - move_test_dummy_toward_position_and_heading(moby, position_or_delta.f, dummy_data->hit_reaction_heading); + move_test_dummy_toward_position_and_heading( + moby, position_or_delta.f, dummy_data->hit_reaction_heading); if (moby[0x70] & 2) { moby[0x20] = dummy_data->next_state; if (moby[0x53] != dummy_data->next_anim) { diff --git a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c index 7372909d86..865010c886 100644 --- a/src/overlays/l16/mobys/test_dummy_on_hoverboard.c +++ b/src/overlays/l16/mobys/test_dummy_on_hoverboard.c @@ -243,7 +243,9 @@ void collect_hoverboard_dummy_boosts(struct Moby *moby) { while (group_candidate_moby) { if (MOBY(group_candidate_moby)->oclass == 0x474) { float m[16]; - fast_vec_sub(displacement_vector, group_candidate_moby + 0x10, moby_pvars->movement_position); + fast_vec_sub(displacement_vector, + group_candidate_moby + 0x10, + moby_pvars->movement_position); if (!(8.0f < fast_vec_length(displacement_vector))) { set_identity_matrix(m); transpose_rotation_matrix(m, group_candidate_moby + 0xC0); @@ -738,13 +740,16 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { frame_scale_sq * 0.035f, frame_scale_sq * 0.3f, D_0015ED6C * 6.981317f); - if (hoverboard_dummy_data->movement_position[2] < path_node_or_explosion_position[2] - 5.0f) { + if (hoverboard_dummy_data->movement_position[2] < + path_node_or_explosion_position[2] - 5.0f) { hoverboard_dummy_data->movement_position[2] = path_node_or_explosion_position[2]; } delta[0] = fast_cos(MOBY(moby)->rot.z) * hoverboard_dummy_data->forward_speed; delta[1] = fast_sin(MOBY(moby)->rot.z) * hoverboard_dummy_data->forward_speed; delta[2] = 0.0f; - fast_vec_add(hoverboard_dummy_data->movement_position, hoverboard_dummy_data->movement_position, delta); + fast_vec_add(hoverboard_dummy_data->movement_position, + hoverboard_dummy_data->movement_position, + delta); fast_vec_scale(ahead, delta, 3.0f); fast_vec_add(ahead, ahead, hoverboard_dummy_data->movement_position); ahead[2] += 0.7f; @@ -781,8 +786,8 @@ void test_dummy_on_hoverboard_update(unsigned char *moby) { if (*(int *)(hero_base + 0x894) < scale_game_frames(700)) { speed += D_0015ED6C * 3.0f; } - if (*(short *)(hero_base - (-(hoverboard_dummy_data->race_competitor_index * 2)) + 0x7C0) < - *(int *)(hero_base + 0x8C0)) { + if (*(short *)(hero_base - (-(hoverboard_dummy_data->race_competitor_index * 2)) + + 0x7C0) < *(int *)(hero_base + 0x8C0)) { speed -= D_0015ED6C; } else { speed += D_0015ED6C; diff --git a/src/overlays/l17/mobys/camera_box_watcher.c b/src/overlays/l17/mobys/camera_box_watcher.c index 94d4fef110..0a072f6a23 100644 --- a/src/overlays/l17/mobys/camera_box_watcher.c +++ b/src/overlays/l17/mobys/camera_box_watcher.c @@ -118,7 +118,8 @@ void fleet_camera_box_watcher_update(struct Moby *moby) { if (hero_current_state == HERO_STATE_HURT_WITH_DISPLACEMENT_VELOCITY || hero_current_state == HERO_STATE_OPTIONAL_IDLE_ANIMATION) { pvars->unk6C = 0; - } else if (is_point_inside_clip_volume(&h->motion.pos, pvars->first_followup_clip_volume_index) || + } else if (is_point_inside_clip_volume(&h->motion.pos, + pvars->first_followup_clip_volume_index) || is_point_inside_clip_volume(&h->motion.pos, pvars->unk68)) { if (D_0013D408[0x1C] == 0) { D_0013D408[0x1C] = 1; diff --git a/src/overlays/l17/mobys/dreks_fleet_turret.c b/src/overlays/l17/mobys/dreks_fleet_turret.c index 140b1fd664..2f7ef06cad 100644 --- a/src/overlays/l17/mobys/dreks_fleet_turret.c +++ b/src/overlays/l17/mobys/dreks_fleet_turret.c @@ -169,8 +169,8 @@ void dreks_fleet_turret_update(struct Moby *turret_moby) { ang = fast_arc_tan(targeting_vector_scratch[0], targeting_vector_scratch[1]); turn = frame_time_sq * 0.5235988f; approach_angle(yaw, &turret_vars->yawvel, ang, turn, turn, frame_time * 1.0471976f); - turret_vars->target_joint_pitch = -fast_arc_tan(vector_length_xy(targeting_vector_scratch), - targeting_vector_scratch[2]); + turret_vars->target_joint_pitch = -fast_arc_tan( + vector_length_xy(targeting_vector_scratch), targeting_vector_scratch[2]); update_joint_animation( turret_moby, turret_vars->a90, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f); off = fast_difference_between_rotations( @@ -228,8 +228,8 @@ void dreks_fleet_turret_update(struct Moby *turret_moby) { ang = fast_arc_tan(targeting_vector_scratch[0], targeting_vector_scratch[1]); turn = frame_time_sq * 0.5235988f; approach_angle(yaw, &turret_vars->yawvel, ang, turn, turn, frame_time * 1.0471976f); - turret_vars->target_joint_pitch = -fast_arc_tan(vector_length_xy(targeting_vector_scratch), - targeting_vector_scratch[2]); + turret_vars->target_joint_pitch = -fast_arc_tan( + vector_length_xy(targeting_vector_scratch), targeting_vector_scratch[2]); update_joint_animation( turret_moby, turret_vars->a90, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f); off = fast_difference_between_rotations( diff --git a/src/overlays/l17/mobys/fighter_jet.c b/src/overlays/l17/mobys/fighter_jet.c index d848764a45..b8a7b5946b 100644 --- a/src/overlays/l17/mobys/fighter_jet.c +++ b/src/overlays/l17/mobys/fighter_jet.c @@ -1252,7 +1252,8 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v } } ship_vars->boost_voice_slot_index = -1; - ship_vars->boost_voice_slot_index = allocate_voice_for_target_entry(1, 4, (int)ship_moby); + ship_vars->boost_voice_slot_index = + allocate_voice_for_target_entry(1, 4, (int)ship_moby); } else if (pad->raw_released & 0x40) { voice_slot_index = ship_vars->boost_voice_slot_index; if (voice_slot_index != -1) { @@ -1349,7 +1350,8 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v if (ship_vars->flight_target_record_index != -1) { int target_record_byte_offset = ship_vars->flight_target_record_index << 7; char *target_record_array = D_L17_001600EC; - qcopy(target, ((char(*)[128])target_record_array)[ship_vars->flight_target_record_index] + 0x30); + qcopy(target, + ((char(*)[128])target_record_array)[ship_vars->flight_target_record_index] + 0x30); lenA = fast_vec_length(target_record_array + target_record_byte_offset + 0x20); fast_vec_add(target_record_sum_or_camera_local_offset, (ship_vars->flight_target_record_index << 7) + D_L17_001600EC, @@ -1554,7 +1556,8 @@ void update_fighter_jet_flight(FighterJetMoby *ship_moby, FighterJetVars *ship_v 0); ship_moby->state = FIGHTER_JET_STATE_DEATH_RESPAWN_DELAY; } - ship_vars->collision_damage_cooldown = l17_fighter_jet_collision_damage_cooldown_reload; + ship_vars->collision_damage_cooldown = + l17_fighter_jet_collision_damage_cooldown_reload; } } else { *(int *)&hero.ship_hp = 0; @@ -1867,7 +1870,8 @@ void fighter_jet_update(ShipMoby *moby) { hp_bar_saved = 1; ship_vars->timerF8 = 1; ship_vars->iE8 = 1; - if (moby->persistent_state_index != 0xFF && visited52[moby->persistent_state_index + current_level_index * 16] == 0xFF) { + if (moby->persistent_state_index != 0xFF && + visited52[moby->persistent_state_index + current_level_index * 16] == 0xFF) { moby->state = FIGHTER_JET_STATE_FADE_THEN_REMOVE; } if (ship_vars->i11C > 0) { diff --git a/src/overlays/l17/mobys/robot_dog.c b/src/overlays/l17/mobys/robot_dog.c index b2c0e50383..77a33fd14c 100644 --- a/src/overlays/l17/mobys/robot_dog.c +++ b/src/overlays/l17/mobys/robot_dog.c @@ -207,7 +207,8 @@ void robot_dog_update(unsigned char *robot_dog_moby) { robot_dog_vars->s24 = 1; robot_dog_vars->f20 = 1.0f; robot_dog_vars->pD0 = &D_L17_00162200; - robot_dog_vars->approach_movement_speed = random_float_between(frame_time * 7.2f, frame_time * 8.7f); + robot_dog_vars->approach_movement_speed = + random_float_between(frame_time * 7.2f, frame_time * 8.7f); robot_dog_moby[0x20] = 1; blend_moby_animation( robot_dog_moby, @@ -411,7 +412,8 @@ void robot_dog_update(unsigned char *robot_dog_moby) { break; } case ROBOT_DOG_STATE_APPROACH_TARGET: - FUN_L17_002efd48_c((char *)robot_dog_moby, robot_dog_vars->v180, robot_dog_vars->approach_movement_speed); + FUN_L17_002efd48_c( + (char *)robot_dog_moby, robot_dog_vars->v180, robot_dog_vars->approach_movement_speed); MOBY(robot_dog_moby)->anim_speed = 1.8f; if (point_in_path_xy((&hero.motion.pos), ((int **)D_L17_001B0DB0)[robot_dog_vars->path] + 4, diff --git a/src/overlays/l17/mobys/shuttle.c b/src/overlays/l17/mobys/shuttle.c index a293cfcd5d..d80c1088b0 100644 --- a/src/overlays/l17/mobys/shuttle.c +++ b/src/overlays/l17/mobys/shuttle.c @@ -434,8 +434,8 @@ int update_shuttle_travel_and_camera(char *moby, int route_index) { set_camera_rotation(camera_rotation); } MOBY(moby)->scale = - MOBY(moby)->pclass->scale * - (shuttle_vars->f9C - (shuttle_vars->f9C - shuttle_vars->fA0) * shuttle_vars->travel_fraction); + MOBY(moby)->pclass->scale * (shuttle_vars->f9C - (shuttle_vars->f9C - shuttle_vars->fA0) * + shuttle_vars->travel_fraction); if (shuttle_vars->travel_fraction > 0.8f) { turn = frame_time_sq * 12.566371f; approach_angle(&shuttle_vars->travel_yaw_offset, diff --git a/src/overlays/l18/hero/hero_set_state.c b/src/overlays/l18/hero/hero_set_state.c index d7c2e97059..802ad9b73e 100644 --- a/src/overlays/l18/hero/hero_set_state.c +++ b/src/overlays/l18/hero/hero_set_state.c @@ -77,7 +77,8 @@ int hero_set_state(int requested_state, int animation_update_mode) { { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && - (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || animation_update_mode != 2)) + (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || + animation_update_mode != 2)) return 0; } if ((D_L18_0015F5C4 == 2 || D_L18_0015F5C4 == 6) && animation_update_mode != 2) diff --git a/src/overlays/l18/mobys/child_carrier.c b/src/overlays/l18/mobys/child_carrier.c index c61e982f4b..bffc54a83a 100644 --- a/src/overlays/l18/mobys/child_carrier.c +++ b/src/overlays/l18/mobys/child_carrier.c @@ -53,7 +53,8 @@ void child_carrier_update(char *moby) { if (new_child != 0) { *(unsigned short *)(new_child + 0x32) = ((unsigned short)MOBY(moby)->draw_dist); (transform_and_child_vars->carried_child_moby)[0x31] = 1; - *(long *)(transform_and_child_vars->carried_child_moby + 0x38) = ((long)MOBY(moby)->spawn_frame); + *(long *)(transform_and_child_vars->carried_child_moby + 0x38) = + ((long)MOBY(moby)->spawn_frame); *(float *)(transform_and_child_vars->carried_child_moby + 0x2C) *= MOBY(moby)->scale / MOBY(moby)->pclass->scale; } diff --git a/src/overlays/l18/mobys/drek_boss_ring_projectile.c b/src/overlays/l18/mobys/drek_boss_ring_projectile.c index c40e5f3388..641b2330d1 100644 --- a/src/overlays/l18/mobys/drek_boss_ring_projectile.c +++ b/src/overlays/l18/mobys/drek_boss_ring_projectile.c @@ -246,7 +246,8 @@ void spawn_drek_boss_ring_projectile( spawned_moby->projectile_glow_color = initial_glow_color; moby_vars = spawned_moby->child; qcopy(spawned_moby->pos, pos); - spawned_moby->movement_heading = fast_arc_tan(initial_movement_step[0], initial_movement_step[1]); + spawned_moby->movement_heading = + fast_arc_tan(initial_movement_step[0], initial_movement_step[1]); qcopy(moby_vars->v, initial_movement_step); moby_vars->f34 = collision_filter_moby; moby_vars->f28 = fa; diff --git a/src/overlays/l18/mobys/drek_final_boss_robot.c b/src/overlays/l18/mobys/drek_final_boss_robot.c index 9c41d6049e..5b5933cd57 100644 --- a/src/overlays/l18/mobys/drek_final_boss_robot.c +++ b/src/overlays/l18/mobys/drek_final_boss_robot.c @@ -493,7 +493,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->path_point_index = 1; boss_data->health_hud_animation_handle = -1; boss_data->boss_health = 350.0f; - boss_data->paired_transition_moby = D_L18_0015FFD8 + boss_data->paired_transition_moby_index * 0x100; + boss_data->paired_transition_moby = + D_L18_0015FFD8 + boss_data->paired_transition_moby_index * 0x100; boss_data->bob_amplitude = 0.75f; boss_data->movement_step_distance = 0.0f; for (i = 0; i < 3; i++) { @@ -532,7 +533,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { } break; case DREK_BOSS_WAIT_FOR_ENCOUNTER_TRIGGER: - if (is_point_inside_clip_volume(hero.motion.pos.f, boss_data->encounter_trigger_clip_volume_index) != 0 && + if (is_point_inside_clip_volume(hero.motion.pos.f, + boss_data->encounter_trigger_clip_volume_index) != 0 && hero.vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK) { moby->f20 = 7; moby->f34 |= 0x41; @@ -555,8 +557,9 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->active_movement_path = b; qcopy(boss_data->unbobbed_boss_position, b + 4); } - moby->f40[2] = fast_arc_tan(hero.motion.pos.f[0] - boss_data->unbobbed_boss_position[0], - hero.motion.pos.f[1] - boss_data->unbobbed_boss_position[1]); + moby->f40[2] = + fast_arc_tan(hero.motion.pos.f[0] - boss_data->unbobbed_boss_position[0], + hero.motion.pos.f[1] - boss_data->unbobbed_boss_position[1]); show_drek_boss_moby_group((int)moby, boss_data->f204[0]); boss_data->boss_health = boss_data->boss_health * 0.85714287f; } else if (fast_vec_dist(hero.motion.pos.f, @@ -658,15 +661,18 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->active_movement_path = b; qcopy(boss_data->unbobbed_boss_position, b + 4); } - moby->f40[2] = fast_arc_tan(hero.motion.pos.f[0] - boss_data->unbobbed_boss_position[0], - hero.motion.pos.f[1] - boss_data->unbobbed_boss_position[1]); + moby->f40[2] = + fast_arc_tan(hero.motion.pos.f[0] - boss_data->unbobbed_boss_position[0], + hero.motion.pos.f[1] - boss_data->unbobbed_boss_position[1]); boss_data->health_hud_animation_handle = -1; break; } - if (moby->animation_sequence_index == 10 && (is_value_within_interpolated_window((char *)moby, 1.0f) != 0 || - is_value_within_interpolated_window((char *)moby, 16.0f) != 0)) { + if (moby->animation_sequence_index == 10 && + (is_value_within_interpolated_window((char *)moby, 1.0f) != 0 || + is_value_within_interpolated_window((char *)moby, 16.0f) != 0)) { qcopy(position_and_displacement_scratch, hero.motion.near_ground_point.f); - if (absolute_float(position_and_displacement_scratch[2] - boss_data->unbobbed_boss_position[2]) < 5.0f) { + if (absolute_float(position_and_displacement_scratch[2] - + boss_data->unbobbed_boss_position[2]) < 5.0f) { if ((float)moby->f50 < 15.0f) { moby_point_position( moby, 2, position_displacement_direction_and_rotation_scratch); @@ -747,7 +753,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { probe_ground_height(position_direction_and_rotation_scratch, 0, 0.5f); refresh_moby_position_and_activate(boss_data->pending_electric_ball_moby, position_displacement_direction_and_rotation_scratch, - D_L18_001600EC + boss_data->arena_center_node_index * 0x80 + 0x30, + D_L18_001600EC + + boss_data->arena_center_node_index * 0x80 + 0x30, 1, 1.0f); boss_data->pending_electric_ball_moby = 0; @@ -761,7 +768,9 @@ void drek_final_boss_robot_update(BossMoby *moby) { moby->f20 = 10; } for (i = 0; i < 4; i++) { - int k = boss_data->encounter_phase == DREK_BOSS_PHASE_SECOND_ARENA_PATH ? boss_data->f230[i] : boss_data->alternate_platform_activation_moby_indices[i]; + int k = boss_data->encounter_phase == DREK_BOSS_PHASE_SECOND_ARENA_PATH + ? boss_data->f230[i] + : boss_data->alternate_platform_activation_moby_indices[i]; activate_drek_boss_class_0565_moby(D_L18_0015FFD8 + k * 0x100); } @@ -794,19 +803,24 @@ void drek_final_boss_robot_update(BossMoby *moby) { frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); - approach_value(&boss_data->movement_step_distance, frame_time * 12.0f, frame_time_sq * 20.0f); + approach_value( + &boss_data->movement_step_distance, frame_time * 12.0f, frame_time_sq * 20.0f); if (boss_data->movement_step_distance != 0.0f) { fast_vec_sub(position_and_displacement_scratch, - (char *)boss_data->active_movement_path + (boss_data->path_point_index * 0x10 + 0x10), + (char *)boss_data->active_movement_path + + (boss_data->path_point_index * 0x10 + 0x10), boss_data->unbobbed_boss_position); - if (fast_vec_length(position_and_displacement_scratch) <= boss_data->movement_step_distance) { + if (fast_vec_length(position_and_displacement_scratch) <= + boss_data->movement_step_distance) { boss_data->path_point_index = boss_data->path_point_index + 1; } else { fast_vec_normalize(position_and_displacement_scratch, position_and_displacement_scratch, boss_data->movement_step_distance); } - fast_vec_add(boss_data->unbobbed_boss_position, boss_data->unbobbed_boss_position, position_and_displacement_scratch); + fast_vec_add(boss_data->unbobbed_boss_position, + boss_data->unbobbed_boss_position, + position_and_displacement_scratch); } firing_target_moby = select_drek_boss_platform_firing_target((char *)moby); if (firing_target_moby != 0 && @@ -842,22 +856,28 @@ void drek_final_boss_robot_update(BossMoby *moby) { } case DREK_BOSS_FINISH_PATH_AND_WAIT_FOR_HERO: if (boss_data->path_point_index != *boss_data->active_movement_path) { - approach_value(&boss_data->movement_step_distance, frame_time * 10.0f, frame_time_sq * 20.0f); + approach_value( + &boss_data->movement_step_distance, frame_time * 10.0f, frame_time_sq * 20.0f); fast_vec_sub(position_and_displacement_scratch, - (char *)boss_data->active_movement_path + (boss_data->path_point_index * 0x10 + 0x10), + (char *)boss_data->active_movement_path + + (boss_data->path_point_index * 0x10 + 0x10), boss_data->unbobbed_boss_position); - if (fast_vec_length(position_and_displacement_scratch) <= boss_data->movement_step_distance) { + if (fast_vec_length(position_and_displacement_scratch) <= + boss_data->movement_step_distance) { boss_data->path_point_index = boss_data->path_point_index + 1; } else { fast_vec_normalize(position_and_displacement_scratch, position_and_displacement_scratch, boss_data->movement_step_distance); } - fast_vec_add(boss_data->unbobbed_boss_position, boss_data->unbobbed_boss_position, position_and_displacement_scratch); + fast_vec_add(boss_data->unbobbed_boss_position, + boss_data->unbobbed_boss_position, + position_and_displacement_scratch); break; } if (vector_distance_xy(moby->f10, hero.motion.pos.f) < 50.0f && hero.air_frames.s == 0 && - (((BossMoby *)hero.ground_moby) == 0 || ((BossMoby *)hero.ground_moby)->moby_class_id != 0x24B)) { + (((BossMoby *)hero.ground_moby) == 0 || + ((BossMoby *)hero.ground_moby)->moby_class_id != 0x24B)) { int *p = boss_data->active_movement_path; boss_data->movement_step_distance = 0.0f; @@ -868,8 +888,11 @@ void drek_final_boss_robot_update(BossMoby *moby) { moby->f20 = 4; } else { moby->f20 = 0x15; - boss_data->selected_class_247_moby = find_class_247_moby_with_largest_xy_angle_in_list( - boss_data->unbobbed_boss_position, hero.motion.pos.f, boss_data->class_247_group_index); + boss_data->selected_class_247_moby = + find_class_247_moby_with_largest_xy_angle_in_list( + boss_data->unbobbed_boss_position, + hero.motion.pos.f, + boss_data->class_247_group_index); } break; } @@ -877,15 +900,15 @@ void drek_final_boss_robot_update(BossMoby *moby) { } break; case DREK_BOSS_WAIT_FOR_GROUNDED_HERO_TO_START_SCENE: - if (hero.air_frames.s == 0 && - (((BossMoby *)hero.ground_moby) == 0 || ((BossMoby *)hero.ground_moby)->moby_class_id != 0x24B)) { + if (hero.air_frames.s == 0 && (((BossMoby *)hero.ground_moby) == 0 || + ((BossMoby *)hero.ground_moby)->moby_class_id != 0x24B)) { int i; *(int *)&l18_drek_boss_scene_2_started_gp = 1; moby->f20 = 7; boss_data->post_scene_resume_state = DREK_BOSS_INITIALIZE_PAIRED_TRANSFORM_TRANSITION; - boss_data->selected_class_247_moby = - (BossMoby *)find_nearest_class_247_moby_in_list(hero.motion.pos.f, boss_data->class_247_group_index); + boss_data->selected_class_247_moby = (BossMoby *)find_nearest_class_247_moby_in_list( + hero.motion.pos.f, boss_data->class_247_group_index); moby->f34 |= 0x41; start_scene(2); for (i = 0; i < 3; i++) { @@ -936,8 +959,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { 1); hero.pending_item[3] = 3; moby->f20 = 8; - request_thruster_pack_lock_red_wait(D_L18_0015FFD8 + boss_data->thruster_lock_moby_index * 0x100, - scale_game_frames(0x708)); + request_thruster_pack_lock_red_wait( + D_L18_0015FFD8 + boss_data->thruster_lock_moby_index * 0x100, scale_game_frames(0x708)); break; } case DREK_BOSS_WAIT_TO_RESTORE_SAVED_TRANSFORM: @@ -970,8 +993,9 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->action_event_timer_frames = scale_game_frames(0x14); qcopy(position_and_displacement_scratch, boss_data->unbobbed_boss_position); position_and_displacement_scratch[2] = position_and_displacement_scratch[2] + 4.0f; - if (activate_drek_fight_missiles_in_group( - (char *)moby, boss_data->missile_group_index, position_and_displacement_scratch) != 0) { + if (activate_drek_fight_missiles_in_group((char *)moby, + boss_data->missile_group_index, + position_and_displacement_scratch) != 0) { moby->f20 = 0xC; } } @@ -1006,8 +1030,10 @@ void drek_final_boss_robot_update(BossMoby *moby) { blend_moby_animation(moby, 2, 0, scale_game_frames(0x14)); } boss_data->action_event_timer_frames = 0; - boss_data->action_frame_counter = scale_game_frames(random_integer_below(3) * 0x5A + 0x14A); - boss_data->secondary_action_timer_frames = scale_game_frames((6 - boss_data->encounter_phase) * 0x1E); + boss_data->action_frame_counter = + scale_game_frames(random_integer_below(3) * 0x5A + 0x14A); + boss_data->secondary_action_timer_frames = + scale_game_frames((6 - boss_data->encounter_phase) * 0x1E); boss_data->ring_launch_lateral_coefficient = random_float_between(-0.333f, 0.333f); break; case DREK_BOSS_TARGET_SIDE_GROUND_POINTS: @@ -1043,10 +1069,13 @@ void drek_final_boss_robot_update(BossMoby *moby) { w = fast_difference_between_rotations( fast_arc_tan(boss_data->unbobbed_boss_position[0] - hero.motion.pos.f[0], boss_data->unbobbed_boss_position[1] - hero.motion.pos.f[1]), - fast_arc_tan(boss_data->unbobbed_boss_position[0] - position_and_displacement_scratch[0], - boss_data->unbobbed_boss_position[1] - position_and_displacement_scratch[1])); + fast_arc_tan(boss_data->unbobbed_boss_position[0] - + position_and_displacement_scratch[0], + boss_data->unbobbed_boss_position[1] - + position_and_displacement_scratch[1])); if (best < w) { - boss_data->selected_aim_node_index = boss_data->aim_candidate_node_indices[i]; + boss_data->selected_aim_node_index = + boss_data->aim_candidate_node_indices[i]; best = w; } } @@ -1066,14 +1095,15 @@ void drek_final_boss_robot_update(BossMoby *moby) { } boss_data->action_frame_counter = scale_game_frames(600); boss_data->secondary_action_timer_frames = scale_game_frames(600); - boss_data->hero_follow_ring_effect_moby = create_class_274_ring_effect(moby, boss_data->unbobbed_boss_position, 5.8f); + boss_data->hero_follow_ring_effect_moby = + create_class_274_ring_effect(moby, boss_data->unbobbed_boss_position, 5.8f); break; } break; case DREK_BOSS_ACTION_REPOSITION_AND_AIM: aim = &moby->f40[2]; - desired_yaw = - fast_arc_tan(boss_data->stored_aim_target_position[0] - moby->f10[0], boss_data->stored_aim_target_position[1] - moby->f10[1]); + desired_yaw = fast_arc_tan(boss_data->stored_aim_target_position[0] - moby->f10[0], + boss_data->stored_aim_target_position[1] - moby->f10[1]); approach_angle(aim, &boss_data->yaw_approach_state, desired_yaw, @@ -1094,10 +1124,12 @@ void drek_final_boss_robot_update(BossMoby *moby) { if (boss_data->action_event_timer_frames != 0) { if (boss_data->pending_electric_ball_moby == 0) { moby_point_position(moby, 1, position_displacement_direction_and_rotation_scratch); - boss_data->pending_electric_ball_moby = (unsigned char *)spawn_drek_boss_electric_ball( - moby, - position_displacement_direction_and_rotation_scratch, - scale_game_frames(*(int *)&l18_drek_boss_aimed_class_3d7_spawn_frame_count_gp)); + boss_data->pending_electric_ball_moby = + (unsigned char *)spawn_drek_boss_electric_ball( + moby, + position_displacement_direction_and_rotation_scratch, + scale_game_frames( + *(int *)&l18_drek_boss_aimed_class_3d7_spawn_frame_count_gp)); } else if (fast_dec_timer(&boss_data->action_event_timer_frames) != 0) { if (moby->animation_sequence_index != 9) { blend_moby_animation(moby, 9, 0, 0); @@ -1126,7 +1158,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { moby->f20 = 0xC; } } else { - float f = 1.0f - convert_integer_to_float(boss_data->action_event_timer_frames) / scale_time(90.0f); + float f = 1.0f - convert_integer_to_float(boss_data->action_event_timer_frames) / + scale_time(90.0f); if (f > 1.0f) { f = 1.0f; @@ -1197,7 +1230,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { } position_and_displacement_scratch[2] = probe_ground_height(position_and_displacement_scratch, 0, 0.5f); - if (absolute_float(position_and_displacement_scratch[2] - boss_data->unbobbed_boss_position[2]) < 5.0f) { + if (absolute_float(position_and_displacement_scratch[2] - + boss_data->unbobbed_boss_position[2]) < 5.0f) { float a; float c; float e; @@ -1231,7 +1265,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { } } if (fast_dec_timer(&boss_data->action_frame_counter) != 0 || - (boss_data->rail_mode_damage_accumulated > 25.0f && (float)boss_data->encounter_phase < 4.0f)) { + (boss_data->rail_mode_damage_accumulated > 25.0f && + (float)boss_data->encounter_phase < 4.0f)) { boss_data->previous_action_state = DREK_BOSS_TARGET_GROUND_POINTS; moby->f20 = 0xC; } @@ -1247,15 +1282,17 @@ void drek_final_boss_robot_update(BossMoby *moby) { frame_time_sq * 6.2831855f, frame_time * 6.2831855f); update_drek_boss_arena_circling_movement((struct Moby *)moby); - if (boss_data->action_event_timer_frames < boss_data->action_frame_counter + boss_data->secondary_action_timer_frames) { - boss_data->lateral_launch_aim_angle = fast_arc_tan(1.0f, boss_data->ring_launch_lateral_coefficient); + if (boss_data->action_event_timer_frames < + boss_data->action_frame_counter + boss_data->secondary_action_timer_frames) { + boss_data->lateral_launch_aim_angle = + fast_arc_tan(1.0f, boss_data->ring_launch_lateral_coefficient); } if (moby->animation_sequence_index == 2) { if ((moby->f70 & 2) != 0) { blend_moby_animation(moby, 4, 0, scale_game_frames(0x14)); } - } else if (fast_dec_timer(&boss_data->action_event_timer_frames) != 0 && boss_data->action_frame_counter != 0 && - moby->animation_sequence_index != 4) { + } else if (fast_dec_timer(&boss_data->action_event_timer_frames) != 0 && + boss_data->action_frame_counter != 0 && moby->animation_sequence_index != 4) { blend_moby_animation(moby, 4, 0, scale_game_frames(0x14)); } if (moby->animation_sequence_index == 4) { @@ -1266,8 +1303,9 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->ring_launch_cooldown_frames = scale_game_frames(300); moby_point_position(moby, 0, position_and_displacement_scratch); qcopy(position_displacement_direction_and_rotation_scratch, moby->fC0); - fast_vec_normalize( - position_direction_and_rotation_scratch, moby->lateral_direction_vector, boss_data->ring_launch_lateral_coefficient); + fast_vec_normalize(position_direction_and_rotation_scratch, + moby->lateral_direction_vector, + boss_data->ring_launch_lateral_coefficient); fast_vec_add(position_displacement_direction_and_rotation_scratch, position_displacement_direction_and_rotation_scratch, position_direction_and_rotation_scratch); @@ -1293,7 +1331,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { blend_moby_animation(moby, 3, 0, scale_game_frames(0x14)); } } - if (fast_dec_timer(&boss_data->action_frame_counter) != 0 && fast_dec_timer(&boss_data->secondary_action_timer_frames) != 0) { + if (fast_dec_timer(&boss_data->action_frame_counter) != 0 && + fast_dec_timer(&boss_data->secondary_action_timer_frames) != 0) { boss_data->previous_action_state = DREK_BOSS_LAUNCH_FORWARD_WITH_LATERAL_OFFSET; moby->f20 = 0xC; if (moby->animation_sequence_index != 5) { @@ -1337,8 +1376,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { position_direction_and_rotation_scratch[2] + 5.0f; position_direction_and_rotation_scratch[2] = probe_ground_height(position_direction_and_rotation_scratch, 0, 0.5f); - if (absolute_float(position_direction_and_rotation_scratch[2] - boss_data->unbobbed_boss_position[2]) < - 5.0f) { + if (absolute_float(position_direction_and_rotation_scratch[2] - + boss_data->unbobbed_boss_position[2]) < 5.0f) { float speed = vector_distance_xy(position_direction_and_rotation_scratch, position_displacement_direction_and_rotation_scratch) / @@ -1376,17 +1415,20 @@ void drek_final_boss_robot_update(BossMoby *moby) { if ((moby->f70 & 2) != 0 && moby->animation_sequence_index != 12) { blend_moby_animation(moby, 0xC, 0, scale_game_frames(0x14)); } - if ((moby->animation_sequence_index == 12 && fast_dec_timer(&boss_data->action_event_timer_frames) != 0) || + if ((moby->animation_sequence_index == 12 && + fast_dec_timer(&boss_data->action_event_timer_frames) != 0) || boss_data->action_event_timer_frames == scale_game_frames(0x1E)) { float f = boss_data->action_event_timer_frames != 0 ? 4.3f : -4.3f; - fast_vec_normalize(position_and_displacement_scratch, moby->lateral_direction_vector, f); + fast_vec_normalize( + position_and_displacement_scratch, moby->lateral_direction_vector, f); fast_vec_add(position_and_displacement_scratch, position_and_displacement_scratch, boss_data->unbobbed_boss_position); position_and_displacement_scratch[2] = probe_ground_height(position_and_displacement_scratch, 0, 0.5f); - if (absolute_float(position_and_displacement_scratch[2] - boss_data->unbobbed_boss_position[2]) < 1.0f) { + if (absolute_float(position_and_displacement_scratch[2] - + boss_data->unbobbed_boss_position[2]) < 1.0f) { /* v1 is not written in this state; retail passes it all the same. */ float speed = vector_distance_xy(position_and_displacement_scratch, @@ -1432,13 +1474,15 @@ void drek_final_boss_robot_update(BossMoby *moby) { if (fast_dec_timer(&boss_data->action_event_timer_frames) != 0) { update_drek_boss_hero_follow_movement((char *)moby); } - refresh_ring_effect(boss_data->hero_follow_ring_effect_moby, boss_data->unbobbed_boss_position, 5.8f); + refresh_ring_effect( + boss_data->hero_follow_ring_effect_moby, boss_data->unbobbed_boss_position, 5.8f); if (voice_is_playing(moby, boss_data->hero_follow_voice_slot) == 0) { boss_data->hero_follow_voice_slot = allocate_voice_for_target_entry(0xE, 4, (int)moby); } fire = 0; if (fast_dec_timer(&boss_data->action_frame_counter) != 0 && - (hero.state.control_mode != 0xF || fast_dec_timer(&boss_data->secondary_action_timer_frames) != 0)) { + (hero.state.control_mode != 0xF || + fast_dec_timer(&boss_data->secondary_action_timer_frames) != 0)) { fire = 1; } if (hero.state.control_mode == 0xF) { @@ -1537,7 +1581,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { ticks = scale_game_frames(600); break; } - request_thruster_pack_lock_red_wait(D_L18_0015FFD8 + boss_data->thruster_lock_moby_index * 0x100, + request_thruster_pack_lock_red_wait(D_L18_0015FFD8 + + boss_data->thruster_lock_moby_index * 0x100, scale_game_frames(ticks)); boss_data->action_event_timer_frames = 0; if (boss_data->encounter_phase == DREK_BOSS_PHASE_BEFORE_MISSILE_GROUP) { @@ -1629,7 +1674,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { if (moby->f52 == moby->animation_sequence_index && moby->f52 == 14 && is_value_within_interpolated_window((char *)moby, 30.0f) != 0) { moby->f20 = 0x1B; - end_thruster_pack_lock_red_wait(D_L18_0015FFD8 + boss_data->thruster_lock_moby_index * 0x100); + end_thruster_pack_lock_red_wait(D_L18_0015FFD8 + + boss_data->thruster_lock_moby_index * 0x100); } break; } @@ -1653,7 +1699,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->post_scene_resume_state = DREK_BOSS_RUN_ENDING_SEQUENCE; } else if (boss_data->encounter_phase == DREK_BOSS_PHASE_WAIT_FOR_ENDING_PLATFORM) { if (((BossMoby *)hero.ground_moby) != 0 && hero.air_frames.s == 0 && - ((BossMoby *)hero.ground_moby)->moby_class_id == 0x247 && hero.state.current == 0x22) { + ((BossMoby *)hero.ground_moby)->moby_class_id == 0x247 && + hero.state.current == 0x22) { if (boss_data->ending_scene_4_delay_counter == 0) { boss_data->ending_scene_4_delay_counter = 1; } @@ -1685,7 +1732,8 @@ void drek_final_boss_robot_update(BossMoby *moby) { 0); start_scene(5); boss_data->encounter_phase = DREK_BOSS_PHASE_WAIT_TO_START_SLIDESHOW; - } else if (boss_data->encounter_phase == DREK_BOSS_PHASE_WAIT_TO_START_SLIDESHOW && D_L18_0015F5C4 == 0) { + } else if (boss_data->encounter_phase == DREK_BOSS_PHASE_WAIT_TO_START_SLIDESHOW && + D_L18_0015F5C4 == 0) { start_slideshow(); boss_data->encounter_phase = DREK_BOSS_PHASE_WAIT_TO_QUEUE_ENDING_MOVIE; } else { @@ -1729,8 +1777,10 @@ void drek_final_boss_robot_update(BossMoby *moby) { qcopy(moby->f10, boss_data->unbobbed_boss_position); slow = 0.3f; fast = 0.03f; - boss_data->bob_cycle_angle = fast_add_rotations(boss_data->bob_cycle_angle, frame_time * 3.1415927f); - aas_c(boss_data->bob_amplitude * fast_sin(boss_data->bob_cycle_angle) + boss_data->bob_target_height_offset, + boss_data->bob_cycle_angle = + fast_add_rotations(boss_data->bob_cycle_angle, frame_time * 3.1415927f); + aas_c(boss_data->bob_amplitude * fast_sin(boss_data->bob_cycle_angle) + + boss_data->bob_target_height_offset, frame_time_sq * 4.0f, frame_time_sq * 4.0f, frame_time * 4.0f, @@ -1740,11 +1790,16 @@ void drek_final_boss_robot_update(BossMoby *moby) { boss_data->bob_target_height_offset = 0.0f; update_joint_animation( (char *)moby, boss_data->fC0, 7, frame_scale_sq * fast, frame_scale_sq * slow); - update_joint_animation( - (char *)moby, boss_data->joint_19_animation_state, 0x13, frame_scale_sq * fast, frame_scale_sq * slow); - boss_data->tint_cycle_angle = fast_add_rotations(boss_data->tint_cycle_angle, frame_time * 3.4906585f); + update_joint_animation((char *)moby, + boss_data->joint_19_animation_state, + 0x13, + frame_scale_sq * fast, + frame_scale_sq * slow); + boss_data->tint_cycle_angle = + fast_add_rotations(boss_data->tint_cycle_angle, frame_time * 3.4906585f); { - int c = fast_tween_color(0x30C8C8C8, 0x1C393939, fast_sin(boss_data->tint_cycle_angle) * 0.5f + 0.5f); + int c = fast_tween_color( + 0x30C8C8C8, 0x1C393939, fast_sin(boss_data->tint_cycle_angle) * 0.5f + 0.5f); int r = c & 0xFF; int g = (c >> 8) & 0xFF; int b = (c >> 16) & 0xFF; @@ -2038,11 +2093,11 @@ void update_drek_boss_damage_and_phase_transitions(char *moby) { V50[1] += fast_sin(*(float *)(boss_data + 0x318)) * health_floor_or_transition_offset; V50[2] += 3.0f; - qcopy( - V90, - ((VendorNode_5e80 *)D_L18_001600EC)[((VendorStage_5e80 *)boss_data) - ->phase_transition_ground_node_indices[*(int *)(boss_data + 0x34C) - 1]] - .pos); + qcopy(V90, + ((VendorNode_5e80 *)D_L18_001600EC)[((VendorStage_5e80 *)boss_data) + ->phase_transition_ground_node_indices + [*(int *)(boss_data + 0x34C) - 1]] + .pos); V90[2] += health_floor_or_transition_offset; V90[2] = probe_ground_height(V90, 0, 0.5f); qcopy(V60, V90); @@ -2858,7 +2913,8 @@ void render_drek_boss_joint_glows(struct Moby *moby) { } for (i = 0; i < 8; i++) { moby_point_position(moby, 11 + i, joint_world_position); - draw_offset_textured_effect_quad(joint_world_position, boss_vars->joint_glow_color, 0.7f, 0.5f); + draw_offset_textured_effect_quad( + joint_world_position, boss_vars->joint_glow_color, 0.7f, 0.5f); } } diff --git a/src/overlays/l18/mobys/falling_moby_group.c b/src/overlays/l18/mobys/falling_moby_group.c index 9697482a9f..37e0492137 100644 --- a/src/overlays/l18/mobys/falling_moby_group.c +++ b/src/overlays/l18/mobys/falling_moby_group.c @@ -161,9 +161,11 @@ void falling_moby_group_update(struct Moby *moby) { &moby_vars->transform_progress_step); } } - if (moby_vars->transform_progress > group_transform_debris_start_progress_threshold_gp && + if (moby_vars->transform_progress > + group_transform_debris_start_progress_threshold_gp && moby_vars->debris_spawn_random_bound == 0.0f) { - moby_vars->debris_spawn_random_bound = *(int *)&group_transform_debris_initial_random_bound_gp; + moby_vars->debris_spawn_random_bound = + *(int *)&group_transform_debris_initial_random_bound_gp; } if (moby_vars->transform_progress > group_transform_fall_progress_threshold_gp && moby_vars->fall_at_progress_threshold_enabled != 0) { @@ -223,7 +225,8 @@ void falling_moby_group_update(struct Moby *moby) { float s, z, debris_spawn_angle; int debris_spawn_frames; moby_vars->debris_spawn_random_bound = moby_vars->debris_spawn_random_bound + 0.25f; - if (random_integer_below(truncate_float_to_s32(moby_vars->debris_spawn_random_bound)) == 0) { + if (random_integer_below( + truncate_float_to_s32(moby_vars->debris_spawn_random_bound)) == 0) { s = random_float_between(-1.0471976f, 1.0471976f); debris_spawn_angle = fast_add_rotations(s, D_L18_001677D8); z = random_float_between(0.0f, 20.0f); diff --git a/src/overlays/l18/mobys/gadgebot.c b/src/overlays/l18/mobys/gadgebot.c index 391cc0a164..3e1779816e 100644 --- a/src/overlays/l18/mobys/gadgebot.c +++ b/src/overlays/l18/mobys/gadgebot.c @@ -356,20 +356,25 @@ void update_gadgebot_damage_target_and_glow(struct Moby *moby) { moby->state = GADGEBOT_EXPLODE; } else { fall_setup_value_or_path_slot_address = 0x200; - sentry_vars->death_fall_collision_radius_fixed_point = fall_setup_value_or_path_slot_address; + sentry_vars->death_fall_collision_radius_fixed_point = + fall_setup_value_or_path_slot_address; sentry_vars->unk98 = 0.5f; sentry_vars->unk80 = gadgebot_death_fall_gravity_gp * frame_time_sq; sentry_vars->death_fall_horizontal_speed_approach_step = gadgebot_death_fall_horizontal_speed_approach_rate_gp * frame_time_sq; sentry_vars->unk88 = gadgebot_death_fall_base_horizontal_speed_gp * frame_time; - sentry_vars->death_fall_initial_vertical_speed = gadgebot_death_fall_base_vertical_speed_gp * frame_time; + sentry_vars->death_fall_initial_vertical_speed = + gadgebot_death_fall_base_vertical_speed_gp * frame_time; reaction_value_or_path_address = 0x29; sentry_vars->unk94 = reaction_value_or_path_address; sentry_vars->unkAD = 0; sentry_vars->unkBC = frame_time + frame_time; moby->flags &= ~0x1000; v.q = *(u128 *)(coll + 0x10); - trooper_knockback_arc(&v, &angle, &sentry_vars->unk88, &sentry_vars->death_fall_initial_vertical_speed); + trooper_knockback_arc(&v, + &angle, + &sentry_vars->unk88, + &sentry_vars->death_fall_initial_vertical_speed); trooper_start_knockback(moby, sentry_vars->fall, 3, 1, 0, angle); sentry_vars->unkC0 = 7.5f; sentry_vars->unkC4 = 15.0f; diff --git a/src/overlays/l18/mobys/rocket_tank.c b/src/overlays/l18/mobys/rocket_tank.c index 486251b2ec..62c43a54f9 100644 --- a/src/overlays/l18/mobys/rocket_tank.c +++ b/src/overlays/l18/mobys/rocket_tank.c @@ -165,7 +165,8 @@ void rocket_tank_update(M1454 *moby) { case ROCKET_TANK_FIRING: func_L18_002F9AB8_v(moby); approach_value(&tank_data->aim_vector_length_limit, 30.0f, frame_time * 6.0f); - tank_data->aim_yaw_oscillation_phase = fast_add_rotations(tank_data->aim_yaw_oscillation_phase, frame_time * 6.2831855f); + tank_data->aim_yaw_oscillation_phase = + fast_add_rotations(tank_data->aim_yaw_oscillation_phase, frame_time * 6.2831855f); if (is_value_within_interpolated_window((char *)moby, 4.0f) || is_value_within_interpolated_window((char *)moby, 10.0f)) { float firing_vector[4]; @@ -179,10 +180,10 @@ void rocket_tank_update(M1454 *moby) { firing_vector_scale = *(float *)&D_L18_0016247C; } firing_vector_scale *= frame_time; - firing_vector[0] = - fast_cos(tank_data->firing_yaw) * (fast_cos(tank_data->firing_pitch) * firing_vector_scale); - firing_vector[1] = - fast_sin(tank_data->firing_yaw) * (fast_cos(tank_data->firing_pitch) * firing_vector_scale); + firing_vector[0] = fast_cos(tank_data->firing_yaw) * + (fast_cos(tank_data->firing_pitch) * firing_vector_scale); + firing_vector[1] = fast_sin(tank_data->firing_yaw) * + (fast_cos(tank_data->firing_pitch) * firing_vector_scale); firing_vector[2] = 0; firing_vector[2] = -fast_sin(tank_data->firing_pitch) * firing_vector_scale; allocate_voice_for_target_entry(0, 0, (int)moby); @@ -454,7 +455,8 @@ void update_rocket_tank_path_movement(struct Moby *moby) { int k = random_integer_below(*D_L18_001B0EB0[moby_vars->unk100] - 1) + 1; moby_vars->unk120 = (moby_vars->unk120 + k) % *D_L18_001B0EB0[moby_vars->unk100]; } - sc = moby_vars->path_movement_step_length / (*(float *)&rocket_tank_attached_moby_speed_reference_gp * frame_time); + sc = moby_vars->path_movement_step_length / + (*(float *)&rocket_tank_attached_moby_speed_reference_gp * frame_time); if (sc > 2.0f) sc = 2.0f; else if (sc < z) diff --git a/src/overlays/l18/mobys/thruster_pack_lock_green.c b/src/overlays/l18/mobys/thruster_pack_lock_green.c index 0550f86a08..00eb36ac14 100644 --- a/src/overlays/l18/mobys/thruster_pack_lock_green.c +++ b/src/overlays/l18/mobys/thruster_pack_lock_green.c @@ -144,7 +144,8 @@ void thruster_pack_lock_green_update(char *moby) { } } if (moby_vars->f24 != 0.0f) { - if ((moby_vars->target_reset_timer_disabled == 0 && fast_dec_timer((int *)&moby_vars->target_reset_timer) == 2) || + if ((moby_vars->target_reset_timer_disabled == 0 && + fast_dec_timer((int *)&moby_vars->target_reset_timer) == 2) || (D_L18_0015F5C4_d == 2 && D_L18_0016D290_lui >= 4)) { allocate_voice_for_target_entry(0, 0, (int)moby); moby_vars->f24 = 0; @@ -191,17 +192,29 @@ void thruster_pack_lock_green_update(char *moby) { frame_time * 4.0f); } if (moby_vars->aligned_lock_component != 0) { - FUN_001f9bf8_q(moby_vars->aligned_lock_component + 0x10, moby_vars->aligned_lock_component + 0xD0, -moby_vars->f20); + FUN_001f9bf8_q(moby_vars->aligned_lock_component + 0x10, + moby_vars->aligned_lock_component + 0xD0, + -moby_vars->f20); FUN_001f9bf8_q(v, moby_vars->aligned_lock_component + 0xE0, -moby_vars->f20 * 0.2f); - fast_vec_add(moby_vars->aligned_lock_component + 0x10, moby_vars->aligned_lock_component + 0x10, v); - fast_vec_add(moby_vars->aligned_lock_component + 0x10, moby_vars->aligned_lock_component + 0x10, moby_vars); + fast_vec_add(moby_vars->aligned_lock_component + 0x10, + moby_vars->aligned_lock_component + 0x10, + v); + fast_vec_add(moby_vars->aligned_lock_component + 0x10, + moby_vars->aligned_lock_component + 0x10, + moby_vars); update_entity(moby_vars->aligned_lock_component); } if (moby_vars->opposed_lock_component != 0) { - FUN_001f9bf8_q(moby_vars->opposed_lock_component + 0x10, moby_vars->opposed_lock_component + 0xD0, -moby_vars->f20); + FUN_001f9bf8_q(moby_vars->opposed_lock_component + 0x10, + moby_vars->opposed_lock_component + 0xD0, + -moby_vars->f20); FUN_001f9bf8_q(v, moby_vars->opposed_lock_component + 0xE0, -moby_vars->f20 * 0.2f); - fast_vec_add(moby_vars->opposed_lock_component + 0x10, moby_vars->opposed_lock_component + 0x10, v); - fast_vec_add(moby_vars->opposed_lock_component + 0x10, moby_vars->opposed_lock_component + 0x10, moby_vars); + fast_vec_add(moby_vars->opposed_lock_component + 0x10, + moby_vars->opposed_lock_component + 0x10, + v); + fast_vec_add(moby_vars->opposed_lock_component + 0x10, + moby_vars->opposed_lock_component + 0x10, + moby_vars); update_entity(moby_vars->opposed_lock_component); } MOBY(moby)->pos.z = moby_vars->f10 + moby_vars->f34; diff --git a/src/overlays/shared/audio/emitters/distance_emitter.c b/src/overlays/shared/audio/emitters/distance_emitter.c index ef602aab33..fe862ec356 100644 --- a/src/overlays/shared/audio/emitters/distance_emitter.c +++ b/src/overlays/shared/audio/emitters/distance_emitter.c @@ -74,8 +74,10 @@ void update_sound_emitter_playback_by_distance(u8 *sound_emitter) { playback_state->snd = play_voice(playback_state->id, fl, sound_emitter, 0x400); if (playback_state->repeat_delay_upper_bound > 0) { playback_state->repeat_delay_countdown = - FUN_001f96f8_2ed950(playback_state->repeat_delay_lower_bound + - random_integer_below(playback_state->repeat_delay_upper_bound - playback_state->repeat_delay_lower_bound)) * + FUN_001f96f8_2ed950( + playback_state->repeat_delay_lower_bound + + random_integer_below(playback_state->repeat_delay_upper_bound - + playback_state->repeat_delay_lower_bound)) * 60.0f; } } else if (playback_radius + 1.0f < reference_distance) { diff --git a/src/overlays/shared/camera/clip_volume_camera.c b/src/overlays/shared/camera/clip_volume_camera.c index 913f8b6567..999e340d97 100644 --- a/src/overlays/shared/camera/clip_volume_camera.c +++ b/src/overlays/shared/camera/clip_volume_camera.c @@ -116,8 +116,10 @@ int evaluate_clip_volume_candidate(char *candidate_object, char *comparison_obje !(*(unsigned char *)(candidate_object + 0x7C) > *(unsigned char *)(comparison_object + 0x7C))) return 0; - if (is_point_inside_clip_volume(D_0013E533 + 0xE9D, *(int *)(candidate_clip_volume_subrecord + 0xC)) != 0) { - if (is_point_inside_clip_volume(D_L03_00166EC0, *(int *)(candidate_clip_volume_subrecord + 0xC)) != 0) + if (is_point_inside_clip_volume(D_0013E533 + 0xE9D, + *(int *)(candidate_clip_volume_subrecord + 0xC)) != 0) { + if (is_point_inside_clip_volume(D_L03_00166EC0, + *(int *)(candidate_clip_volume_subrecord + 0xC)) != 0) return 1; global_state_base = D_L03_00166EC0 - 0x140; five = *(int *)(global_state_base + 0x180); @@ -137,7 +139,8 @@ void set_transform_state_three_when_outside_clip_volume(char *moby) { char *level_table_entry = (char *)(D_L03_0015EF50 + (*(short *)(moby + 0x84) << 5)); char *clip_volume_subrecord = *(char **)(level_table_entry + 0x1C); if (*(int *)(moby + 0x74) == 4) { - if (is_point_inside_clip_volume(D_0013E533 + 0xE9D, *(int *)(clip_volume_subrecord + 0xC)) == 0) { + if (is_point_inside_clip_volume(D_0013E533 + 0xE9D, + *(int *)(clip_volume_subrecord + 0xC)) == 0) { *(short *)(moby + 0x7E) = 3; } } diff --git a/src/overlays/shared/camera/follow_camera_set_distance.c b/src/overlays/shared/camera/follow_camera_set_distance.c index abc54ee6e7..8da9756ed3 100644 --- a/src/overlays/shared/camera/follow_camera_set_distance.c +++ b/src/overlays/shared/camera/follow_camera_set_distance.c @@ -95,8 +95,16 @@ int try_select_follow_camera_volume(int candidate_object, int unused) { return 1; } tab = (u32)D_L00_0015EF50; - x = *(u8 *)(*(u32 *)(tab + ((O842e83c0 *)(u32)camera_state->selected_volume_object)->camera_descriptor_index * 0x20 + 0x1C) + 0x1C); - y = *(u8 *)(*(u32 *)(tab + ((O842e83c0 *)(u32)candidate_object)->camera_descriptor_index * 0x20 + 0x1C) + 0x1C); + x = *(u8 *)(*(u32 *)(tab + + ((O842e83c0 *)(u32)camera_state->selected_volume_object) + ->camera_descriptor_index * + 0x20 + + 0x1C) + + 0x1C); + y = *(u8 *)(*(u32 *)(tab + + ((O842e83c0 *)(u32)candidate_object)->camera_descriptor_index * 0x20 + + 0x1C) + + 0x1C); if (x < y) { camera_state->selected_volume_object = candidate_object; return 1; diff --git a/src/overlays/shared/camera/follow_camera_setup.c b/src/overlays/shared/camera/follow_camera_setup.c index 073aed5818..a3918d09bb 100644 --- a/src/overlays/shared/camera/follow_camera_setup.c +++ b/src/overlays/shared/camera/follow_camera_setup.c @@ -631,24 +631,24 @@ typedef struct CamA { } 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 h3C; /* 0x3C */ - short h3E; /* 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 h3C; /* 0x3C */ + short h3E; /* 0x3E */ char pad40[4]; int orbit_distance_interpolation_state; /* 0x44 */ - float f48; /* 0x48 */ + float f48; /* 0x48 */ char pad4C[4]; int orbit_height_interpolation_state; /* 0x50 */ - float f54; /* 0x54 */ - float default_orbit_distance; /* 0x58 */ + float f54; /* 0x54 */ + float default_orbit_distance; /* 0x58 */ char pad5C[4]; } CamB; @@ -676,18 +676,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 h38; /* 0x38 */ - short h3A; /* 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 h38; /* 0x38 */ + short h3A; /* 0x3A */ + float f3C; /* 0x3C */ + float f40; /* 0x40 */ + float f44; /* 0x44 */ + int i48; /* 0x48 */ + int consecutive_camera_obstruction_frames; /* 0x4C */ } CamG; typedef struct Cam220 { @@ -1566,9 +1566,11 @@ void follow_camera_avoid_mobies(u8 *camera_moby) { goto clear; } if ((*(E40_2e7d20_t *)&D_L00_00173E40_lui).collision_hit_moby != 0 && - is_moby_in_class_range_500_to_540((*(E40_2e7d20_t *)&D_L00_00173E40_lui).collision_hit_moby)) { - fast_vec_sub( - &v20, (u8 *)(*(E40_2e7d20_t *)&D_L00_00173E40_lui).collision_hit_moby + 0x10, g_debug_camera_lui); + is_moby_in_class_range_500_to_540( + (*(E40_2e7d20_t *)&D_L00_00173E40_lui).collision_hit_moby)) { + fast_vec_sub(&v20, + (u8 *)(*(E40_2e7d20_t *)&D_L00_00173E40_lui).collision_hit_moby + 0x10, + g_debug_camera_lui); v20.i[2] = 0; fast_vec_normalize(&v20, &v20, 1.0f); v20.f[3] = 5627.9248046875f; diff --git a/src/overlays/shared/camera/follow_camera_springs.c b/src/overlays/shared/camera/follow_camera_springs.c index 42b416f293..9aa2d9d5eb 100644 --- a/src/overlays/shared/camera/follow_camera_springs.c +++ b/src/overlays/shared/camera/follow_camera_springs.c @@ -894,7 +894,8 @@ void update_follow_camera_attach_mode(char *camera) { state_transition_player->state.current == 0xE) && D_L00_00166EEC == 0.0f) { attach_state->prev = attach_state->state; - attach_state->state = CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION; + attach_state->state = + CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION; attach_state->moveTimer = scale_game_frames( *(int *)&follow_camera_hold_focus_blend_base_frames_gp); attach_state->invMove = @@ -926,7 +927,8 @@ void update_follow_camera_attach_mode(char *camera) { } return; } - if (attach_state->state != CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY && attach_state->state != CAM_ATTACH_HERO_POSITION_BASE && camera_secondary_mode_lui == 0x14) { + if (attach_state->state != CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY && + attach_state->state != CAM_ATTACH_HERO_POSITION_BASE && camera_secondary_mode_lui == 0x14) { float r; attach_state->prev = attach_state->state; attach_state->state = CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY; @@ -943,8 +945,9 @@ void update_follow_camera_attach_mode(char *camera) { qcopy(attach_state->v20, attach_state->v10); return; } - if ((attach_state->state == CAM_ATTACH_HERO_POSITION_BASE || attach_state->state == CAM_ATTACH_GROUND_AWARE_FOCUS_VELOCITY) && D_001413DC != 4 && - D_001413DC != 2) { + if ((attach_state->state == CAM_ATTACH_HERO_POSITION_BASE || + attach_state->state == CAM_ATTACH_GROUND_AWARE_FOCUS_VELOCITY) && + D_001413DC != 4 && D_001413DC != 2) { attach_state->timer = 0; attach_state->invTimer = 1.0f; attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; @@ -992,7 +995,8 @@ void update_follow_camera_attach_mode(char *camera) { } return; } - if (attach_state->state == CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY && camera_secondary_mode_lui == 0xB) { + if (attach_state->state == CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY && + camera_secondary_mode_lui == 0xB) { attach_state->prev = attach_state->state; attach_state->state = CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY; attach_state->moveTimer = scale_game_frames(*(int *)&D_L00_00161D40_gp); @@ -1007,7 +1011,8 @@ void update_follow_camera_attach_mode(char *camera) { qcopy(attach_state->v20, attach_state->v10); return; } - if (attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION && camera_secondary_mode_lui == 0xC) { + if (attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION && + camera_secondary_mode_lui == 0xC) { attach_state->prev = attach_state->state; attach_state->state = CAM_ATTACH_HOLD_FOCUS_VELOCITY; attach_state->timer = follow_camera_hold_focus_transition_frames_gp; @@ -1022,7 +1027,8 @@ void update_follow_camera_attach_mode(char *camera) { attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } - if (attach_state->state == CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY && camera_secondary_mode_lui != 0xB) { + if (attach_state->state == CAM_ATTACH_BLEND_OUT_FOCUS_VELOCITY && + camera_secondary_mode_lui != 0xB) { attach_state->prev = attach_state->state; attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; attach_state->timer = @@ -1030,7 +1036,9 @@ void update_follow_camera_attach_mode(char *camera) { attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } - if ((attach_state->state == CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY || attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION) && D_001413DC != 4) { + if ((attach_state->state == CAM_ATTACH_BLEND_TO_PROJECT_HERO_FOCUS_VELOCITY || + attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION) && + D_001413DC != 4) { attach_state->prev = attach_state->state; attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; attach_state->timer = @@ -1062,14 +1070,16 @@ void update_follow_camera_attach_mode(char *camera) { return; } } - if (attach_state->state == CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY && camera_secondary_mode_lui != 0x14) { + if (attach_state->state == CAM_ATTACH_BLEND_PROJECTED_HERO_FOCUS_VELOCITY && + camera_secondary_mode_lui != 0x14) { attach_state->prev = attach_state->state; attach_state->state = CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY; attach_state->timer = follow_camera_continue_projected_focus_transition_frames_gp; attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } - if (attach_state->state == CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY && FUN_001f9770_c2(&attach_state->moveTimer)) { + if (attach_state->state == CAM_ATTACH_CONTINUE_BLEND_PROJECTED_HERO_FOCUS_VELOCITY && + FUN_001f9770_c2(&attach_state->moveTimer)) { attach_state->prev = attach_state->state; attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; attach_state->timer = @@ -1077,7 +1087,8 @@ void update_follow_camera_attach_mode(char *camera) { attach_state->invTimer = 1.0f / convert_integer_to_float(attach_state->timer); return; } - if (attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION && camera_secondary_mode_lui == 0x10) { + if (attach_state->state == CAM_ATTACH_BLEND_FOCUS_VELOCITY_WITH_HOLD_TRANSITION && + camera_secondary_mode_lui == 0x10) { attach_state->prev = attach_state->state; attach_state->state = CAM_ATTACH_DEFAULT_PROJECT_HERO_FOCUS_VELOCITY; attach_state->timer = @@ -1088,7 +1099,8 @@ void update_follow_camera_attach_mode(char *camera) { /* per-frame state machine that eases a moby's attach pose toward the camera block's vector */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002E1660.c: func_L00_002E6498), where it is exact; names translated to the US level program. */ -void compute_follow_camera_focus_velocity(char *camera, float *out_focus_velocity) __asm__("FUN_L00_002e4fe8"); +void compute_follow_camera_focus_velocity(char *camera, + float *out_focus_velocity) __asm__("FUN_L00_002e4fe8"); void compute_follow_camera_focus_velocity(char *camera, float *out_focus_velocity) { float hero_position[4]; diff --git a/src/overlays/shared/camera/follow_camera_update.c b/src/overlays/shared/camera/follow_camera_update.c index cc32d11eea..c42bc40a5d 100644 --- a/src/overlays/shared/camera/follow_camera_update.c +++ b/src/overlays/shared/camera/follow_camera_update.c @@ -456,7 +456,8 @@ void follow_camera_pull_back(char *camera_object, float *x, float *y) { fast_vec_dot(D_001413D0_lui + 0xC0, camera_object) <= -0.3f) { goto on; } - if (0.0001f < absolute_float(C->pull_back_blend_input) && fast_vec_dot(C->pull_back_alignment_vector, camera_object) <= -0.3f) { + if (0.0001f < absolute_float(C->pull_back_blend_input) && + fast_vec_dot(C->pull_back_alignment_vector, camera_object) <= -0.3f) { on: pull_back_state->h4 = scale_game_frames(0x78); k = C->pull_back_blend_input * 14.2857f; diff --git a/src/overlays/shared/camera/path_flythrough_camera.c b/src/overlays/shared/camera/path_flythrough_camera.c index a16ce8fb46..1544f3522e 100644 --- a/src/overlays/shared/camera/path_flythrough_camera.c +++ b/src/overlays/shared/camera/path_flythrough_camera.c @@ -93,7 +93,8 @@ extern VendorView_5f18 l10_camera_view __asm__("D_L10_0016CEC0"); void initialize_path_camera(struct UpdateCam *path_camera) __asm__("FUN_L10_002f5b58"); void initialize_path_camera(struct UpdateCam *path_camera) { - char *path_camera_descriptor = *(char **)(l10_descriptor_table + path_camera->descriptor_index * 32 + 0x1C); + char *path_camera_descriptor = + *(char **)(l10_descriptor_table + path_camera->descriptor_index * 32 + 0x1C); VendorCamRun_5f18 *run; VendorCamStops_5f18 *stops; f32 *fov; @@ -218,7 +219,8 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { int i; saved = (char *)cam->saved_state; - flythrough_descriptor_record = *(char **)(l10_descriptor_table + cam->descriptor_index * 32 + 0x1C); + flythrough_descriptor_record = + *(char **)(l10_descriptor_table + cam->descriptor_index * 32 + 0x1C); run = (VendorCamRun_5f18 *)(saved + 0x40); stops = (VendorCamStops_5f18 *)(saved + 0x58); @@ -233,7 +235,8 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { qcopy(&cam->pos, start_path + 0x10); if (*(int *)(flythrough_descriptor_record + 0x28) >= 0) { struct Moby *anchor = - (struct Moby *)(D_L10_0015FFD8_5f18 + *(int *)(flythrough_descriptor_record + 0x28) * 256); + (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]; @@ -280,8 +283,12 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { } path = ((char *)l10_paths[*(int *)(flythrough_descriptor_record + 0x20)]); qcopy(initial_aim_or_previous_position, &cam->pos); - done = FUN_L00_0025d808( - path, &cam->pos.x, &run->seg, &run->t, 0, *(float *)(flythrough_descriptor_record + 0x3C) * frame_time); + done = FUN_L00_0025d808(path, + &cam->pos.x, + &run->seg, + &run->t, + 0, + *(float *)(flythrough_descriptor_record + 0x3C) * frame_time); if (run->timer != 0) { if (fast_dec_timer_s16(&run->timer) != 0) done = 1; @@ -318,7 +325,8 @@ void update_path_flythrough_camera(struct UpdateCam *cam) { } run->dist += fast_vec_dist(initial_aim_or_previous_position, &cam->pos); if (*(int *)(flythrough_descriptor_record + 0x28) >= 0) { - struct Moby *anchor = (struct Moby *)(D_L10_0015FFD8_5f18 + *(int *)(flythrough_descriptor_record + 0x28) * 256); + struct Moby *anchor = (struct Moby *)(D_L10_0015FFD8_5f18 + + *(int *)(flythrough_descriptor_record + 0x28) * 256); float *ofs = (float *)(flythrough_descriptor_record + 0x2C); point[0] = ofs[0]; point[1] = ofs[1]; diff --git a/src/overlays/shared/cutscenes/update_cutscene_playback.c b/src/overlays/shared/cutscenes/update_cutscene_playback.c index b27e01ab45..568642c7c3 100644 --- a/src/overlays/shared/cutscenes/update_cutscene_playback.c +++ b/src/overlays/shared/cutscenes/update_cutscene_playback.c @@ -199,8 +199,10 @@ void handle_pause_input(void) { D_L00_0016C058.w8 = 0x10; } if ((D_L00_0016C058.w8 & 0x10) && (controller_state.pressed & 0x200)) { - controller_state.pressed = ~D_L00_0016C058.previous_step_held_buttons & controller_state.held; - controller_state.released = ~controller_state.held & D_L00_0016C058.previous_step_held_buttons; + controller_state.pressed = + ~D_L00_0016C058.previous_step_held_buttons & controller_state.held; + controller_state.released = + ~controller_state.held & D_L00_0016C058.previous_step_held_buttons; D_L00_0016C058.previous_step_held_buttons = controller_state.held & ~0x200; } lvl = D_L00_0015F5C0_macro[1]; @@ -583,13 +585,13 @@ extern void sceVu0RotMatrixZ(void *, void *, float) __asm__("FUN_001252b8 int apply_cutscene_camera_key(void) __asm__("FUN_L00_00298de8"); int apply_cutscene_camera_key(void) { - float camera_key_rotation_matrix[16] __attribute__((aligned(16))); - OvlQuad camera_offset[1]; - char *camera_key = D_L00_0016C860_298de8.p54 + D_L00_0016C860_298de8.camera_key_index * 32; - float *camera_key_values = (float *)(camera_key + 0x10); - int camera_key_flag = *(unsigned char *)(camera_key + 0xC); - char *x = D_L00_0016CA40_lui; - char *camera_position; + float camera_key_rotation_matrix[16] __attribute__((aligned(16))); + OvlQuad camera_offset[1]; + char *camera_key = D_L00_0016C860_298de8.p54 + D_L00_0016C860_298de8.camera_key_index * 32; + float *camera_key_values = (float *)(camera_key + 0x10); + int camera_key_flag = *(unsigned char *)(camera_key + 0xC); + char *x = D_L00_0016CA40_lui; + char *camera_position; LevelCamera *camera_state; float k; float unscaled_camera_value = camera_key_values[3]; diff --git a/src/overlays/shared/cutscenes/update_npc_dialogue.c b/src/overlays/shared/cutscenes/update_npc_dialogue.c index fe7ff3da06..c3f7a07644 100644 --- a/src/overlays/shared/cutscenes/update_npc_dialogue.c +++ b/src/overlays/shared/cutscenes/update_npc_dialogue.c @@ -253,7 +253,10 @@ s32 initialize_npc_dialogue(void *moby, u8 *out_p) { dialogue_trigger->current_dialogue_entry_index = dialogue_entries->f06; } dialogue_trigger->f08 = - ((u8 *)dialogue_trigger->dialogue_entry_list_address)[dialogue_trigger->current_dialogue_entry_index * 0x1C + (k = 0x10)] & 1; + ((u8 *)dialogue_trigger + ->dialogue_entry_list_address)[dialogue_trigger->current_dialogue_entry_index * 0x1C + + (k = 0x10)] & + 1; return i; } diff --git a/src/overlays/shared/enemies/armed_transport.c b/src/overlays/shared/enemies/armed_transport.c index 9226c6538a..f21b2c7f02 100644 --- a/src/overlays/shared/enemies/armed_transport.c +++ b/src/overlays/shared/enemies/armed_transport.c @@ -245,9 +245,9 @@ void armed_transport_update(char *transport_moby) { loaded = 1; } path = D_L16_001B0930[transport_data->path_index]; - if (loaded && - (float)(*(int *)path - transport_data->path_point) * transport_data->path_and_pose_state[1] < - 16.0f) { + if (loaded && (float)(*(int *)path - transport_data->path_point) * + transport_data->path_and_pose_state[1] < + 16.0f) { advance_accelerated_scalar((float *)(&transport_data->path_and_pose_state[3]), (float *)(&transport_data->unk180), 1.5707964f, @@ -433,9 +433,9 @@ void armed_transport_update(char *transport_moby) { break; } } - transport_data->bob_phase_radians = fast_add_rotations(transport_data->bob_phase_radians, - *(float *)&armed_transport_bob_phase_speed_degrees * - DEG_TO_RAD * frame_time); + transport_data->bob_phase_radians = fast_add_rotations( + transport_data->bob_phase_radians, + *(float *)&armed_transport_bob_phase_speed_degrees * DEG_TO_RAD * frame_time); MOBY(transport_moby)->pos.z = transport_data->base_height + *(float *)&armed_transport_bob_amplitude * fast_sin(transport_data->bob_phase_radians); @@ -524,8 +524,9 @@ void update_armed_transport_damage_and_targeting(struct Moby *transport_moby) { int advance_armed_transport_along_path(char *transport_moby, char *path) { ArmedTransportVars *transport_data = (ArmedTransportVars *)MOBY(transport_moby)->pvars; - float progress = (float)transport_data->path_point + *(float *)&transport_data->path_segment_fraction + - transport_data->path_and_pose_state[0] / transport_data->path_and_pose_state[1]; + float progress = + (float)transport_data->path_point + *(float *)&transport_data->path_segment_fraction + + transport_data->path_and_pose_state[0] / transport_data->path_and_pose_state[1]; int index = truncate_float_to_s32(progress); float speed; float distance, rate; diff --git a/src/overlays/shared/enemies/blarg_elite_commando.c b/src/overlays/shared/enemies/blarg_elite_commando.c index ba2ed966e3..137b9d86e5 100644 --- a/src/overlays/shared/enemies/blarg_elite_commando.c +++ b/src/overlays/shared/enemies/blarg_elite_commando.c @@ -252,9 +252,11 @@ void blarg_elite_commando_update(char *commando_moby) { commando_data->unk2F4 = random_angle_radians(); commando_data->bobbing_y_phase = random_angle_radians(); commando_data->unk2E8 = random_angle_radians(); - commando_data->bobbing_x_phase_step = random_float_between(90.0f, 180.0f) * DEG_TO_RAD * frame_time; + commando_data->bobbing_x_phase_step = + random_float_between(90.0f, 180.0f) * DEG_TO_RAD * frame_time; commando_data->unk2F8 = random_float_between(90.0f, 180.0f) * DEG_TO_RAD * frame_time; - commando_data->bobbing_z_phase_step = random_float_between(90.0f, 180.0f) * DEG_TO_RAD * frame_time; + commando_data->bobbing_z_phase_step = + random_float_between(90.0f, 180.0f) * DEG_TO_RAD * frame_time; commando_data->patrol_countdown_ticks = truncate_float_to_s32(scale_time(random_float_between(180.0f, 360.0f))); if (random_integer_below(2)) @@ -292,13 +294,14 @@ void blarg_elite_commando_update(char *commando_moby) { transform_vector_by_basis( movement, &commando_data->unk2C0, commando_data->unk2D0 + 0xC0); fast_vec_add(&MOBY(commando_moby)->pos, movement, commando_data->unk2D0 + 0x10); - MOBY(commando_moby)->rot.z = - fast_add_rotations(*(float *)(commando_data->unk2D0 + 0x48), commando_data->parent_heading_offset); + MOBY(commando_moby)->rot.z = fast_add_rotations( + *(float *)(commando_data->unk2D0 + 0x48), commando_data->parent_heading_offset); } break; case COMMANDO_STATE_RETURN_TO_INITIAL_POSITION: if (!fast_dec_timer_s16(&commando_data->state_countdown_ticks)) { - fast_vec_normalize(scratch_vector, commando_moby + 0xC0, commando_data->state_countdown_ticks * 0.1f); + fast_vec_normalize( + scratch_vector, commando_moby + 0xC0, commando_data->state_countdown_ticks * 0.1f); fast_vec_add(scratch_vector, scratch_vector, &MOBY(commando_moby)->pos); func_L16_002D5280_update(commando_moby, scratch_vector, 1); } else { @@ -311,7 +314,8 @@ void blarg_elite_commando_update(char *commando_moby) { frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 12.566371f); - distance = func_L16_002D5280_update(commando_moby, &commando_data->initial_position_x, 1); + distance = + func_L16_002D5280_update(commando_moby, &commando_data->initial_position_x, 1); if (((unsigned char *)commando_moby)[0x53] != 0) blend_moby_animation(commando_moby, 0, 0, scale_game_frames(10)); if (distance < 1.0f) @@ -326,7 +330,8 @@ void blarg_elite_commando_update(char *commando_moby) { MOBY(commando_moby)->state = COMMANDO_STATE_MOVE_TO_ATTACK_NODE; commando_data->state_countdown_ticks = truncate_float_to_s32(scale_time(random_float_between(30.0f, 90.0f))); - commando_data->selected_path_node_index = (commando_data->selected_path_node_index + 1) % 2; + commando_data->selected_path_node_index = + (commando_data->selected_path_node_index + 1) % 2; select_blarg_elite_commando_movement_animation(commando_moby); } else if (!random_integer_below(20)) { MOBY(commando_moby)->state = COMMANDO_STATE_PREPARE_ROCKET_FIRE; @@ -337,7 +342,8 @@ void blarg_elite_commando_update(char *commando_moby) { } } else if (fast_dec_timer_s16(&commando_data->patrol_countdown_ticks)) { if (commando_data->unk120 >= 0) { - commando_data->selected_path_node_index = (commando_data->selected_path_node_index + 1) % 2; + commando_data->selected_path_node_index = + (commando_data->selected_path_node_index + 1) % 2; MOBY(commando_moby)->state = COMMANDO_STATE_MOVE_TO_PATROL_NODE; commando_data->patrol_countdown_ticks = scale_game_frames(180); select_blarg_elite_commando_movement_animation(commando_moby); @@ -345,10 +351,11 @@ void blarg_elite_commando_update(char *commando_moby) { } break; case COMMANDO_STATE_MOVE_TO_PATROL_NODE: { - float path_distance = func_L16_002D5280_update(commando_moby, - D_L16_001B0930[commando_data->unk120] + - (commando_data->selected_path_node_index * 16 + 0x10), - 1); + float path_distance = + func_L16_002D5280_update(commando_moby, + D_L16_001B0930[commando_data->unk120] + + (commando_data->selected_path_node_index * 16 + 0x10), + 1); if (path_distance < 0.01f) { MOBY(commando_moby)->state = COMMANDO_STATE_IDLE; if (((unsigned char *)commando_moby)[0x53] != 0) @@ -417,10 +424,11 @@ void blarg_elite_commando_update(char *commando_moby) { } break; case COMMANDO_STATE_MOVE_TO_ATTACK_NODE: - distance = func_L16_002D5280_update(commando_moby, - D_L16_001B0930[commando_data->unk120] + - (commando_data->selected_path_node_index * 16 + 0x10), - 1); + distance = + func_L16_002D5280_update(commando_moby, + D_L16_001B0930[commando_data->unk120] + + (commando_data->selected_path_node_index * 16 + 0x10), + 1); fast_dec_timer_s16(&commando_data->state_countdown_ticks); if (distance < 0.01f || commando_data->state_countdown_ticks == 0) { MOBY(commando_moby)->state = COMMANDO_STATE_PREPARE_ROCKET_FIRE; @@ -477,11 +485,14 @@ void blarg_elite_commando_update(char *commando_moby) { commando_data->unk2E8 = fast_add_rotations(commando_data->unk2E8, commando_data->bobbing_z_phase_step); MOBY(commando_moby)->pos.x = - commando_data->unk2C0 + commando_data->bobbing_amplitude * fast_sin(commando_data->unk2F4); + commando_data->unk2C0 + + commando_data->bobbing_amplitude * fast_sin(commando_data->unk2F4); MOBY(commando_moby)->pos.y = - commando_data->base_position_y + commando_data->bobbing_amplitude * fast_sin(commando_data->bobbing_y_phase); + commando_data->base_position_y + + commando_data->bobbing_amplitude * fast_sin(commando_data->bobbing_y_phase); MOBY(commando_moby)->pos.z = - commando_data->unk2C8 + commando_data->bobbing_amplitude * fast_sin(commando_data->unk2E8); + commando_data->unk2C8 + + commando_data->bobbing_amplitude * fast_sin(commando_data->unk2E8); } if (fast_vec_dist(&MOBY(commando_moby)->pos, D_L16_001671C0) < 32.0f && !voice_is_playing(commando_moby, commando_data->voice_playback_handle)) @@ -760,7 +771,8 @@ void randomize_blarg_elite_commando_group_pursuit_timers(void *group_source_moby /* Ported from rac1-decomp (src/overlays/shared/vendor_002A1B58.c: func_L16_002D5438), where it is exact; names translated to the US level program. */ void select_blarg_elite_commando_movement_animation(char *moby) { L16DamageData *commando_path_state = (L16DamageData *)MOBY(moby)->pvars; - char *target = D_L16_001B0930[commando_path_state->unk120] + (commando_path_state->selected_path_node_index << 4); + char *target = D_L16_001B0930[commando_path_state->unk120] + + (commando_path_state->selected_path_node_index << 4); float angle = fast_arc_tan(*(float *)(target + 0x10) - MOBY(moby)->pos.x, *(float *)(target + 0x14) - MOBY(moby)->pos.y); float delta = fast_subtract_rotations(angle, MOBY(moby)->rot.z); diff --git a/src/overlays/shared/enemies/blarg_paratrooper.c b/src/overlays/shared/enemies/blarg_paratrooper.c index 537c73e0d4..6c045d3823 100644 --- a/src/overlays/shared/enemies/blarg_paratrooper.c +++ b/src/overlays/shared/enemies/blarg_paratrooper.c @@ -224,7 +224,8 @@ void blarg_paratrooper_update(char *moby) { blend_moby_animation(moby, 14, 0, scale_game_frames(11)); (*(unsigned char *)((char *)(moby) + 0x20)) = 8; } - if ((*(unsigned char *)((char *)(moby) + 0x20)) != 0 && paratrooper_private_state->removal_status == 2) { + if ((*(unsigned char *)((char *)(moby) + 0x20)) != 0 && + paratrooper_private_state->removal_status == 2) { mark_moby_for_removal(moby); if (paratrooper_private_state->bone_attachment_moby) mark_moby_for_removal(paratrooper_private_state->bone_attachment_moby); @@ -259,7 +260,8 @@ void blarg_paratrooper_update(char *moby) { paratrooper_private_state->fFC = 0.2f; if (random302618() & 1) (*(unsigned short *)((char *)(moby) + 0x34)) |= 0x8000; - qcopy(&MOBY(moby)->pos, ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10); + qcopy(&MOBY(moby)->pos, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10); if (path) { int index; short direction; @@ -270,7 +272,8 @@ void blarg_paratrooper_update(char *moby) { paratrooper_private_state->destination_waypoint_index = index; if (index >= (*(int *)((char *)(path) + 0)) || index < 0) { paratrooper_private_state->patrol_waypoint_step = -direction; - paratrooper_private_state->destination_waypoint_index = index + 2 * paratrooper_private_state->patrol_waypoint_step; + paratrooper_private_state->destination_waypoint_index = + index + 2 * paratrooper_private_state->patrol_waypoint_step; } if ((*(unsigned char *)((char *)(moby) + 0x53)) != 2) blend_moby_animation(moby, 2, 0, random302618() % 4 + 7); @@ -282,7 +285,8 @@ void blarg_paratrooper_update(char *moby) { } case PARATROOPER_STATE_PATROL_PATH: if (vector_distance_xy(&MOBY(moby)->pos, - path + 0x10 + paratrooper_private_state->destination_waypoint_index * 16) < + path + 0x10 + + paratrooper_private_state->destination_waypoint_index * 16) < paratrooper_private_state->fE0) { short direction = paratrooper_private_state->patrol_waypoint_step; int index = paratrooper_private_state->destination_waypoint_index + direction; @@ -290,35 +294,42 @@ void blarg_paratrooper_update(char *moby) { if (index >= (*(int *)((char *)(path) + 0)) || index < 0) { paratrooper_private_state->fE0 = 0.0f; paratrooper_private_state->patrol_waypoint_step = -direction; - paratrooper_private_state->destination_waypoint_index = index + 2 * paratrooper_private_state->patrol_waypoint_step; + paratrooper_private_state->destination_waypoint_index = + index + 2 * paratrooper_private_state->patrol_waypoint_step; } } step_mover_2e3f20(moby, (char *)paratrooper_private_state + 0xD0, path + 0x10 + paratrooper_private_state->destination_waypoint_index * 16, pos); - if (target && paratrooper_private_state->target_selection_status != PARATROOPER_TARGET_UNAVAILABLE && + if (target && + paratrooper_private_state->target_selection_status != PARATROOPER_TARGET_UNAVAILABLE && fast_dec_timer((char *)paratrooper_private_state + 0x1F0)) { paratrooper_private_state->destination_waypoint_index = select_point_index_by_distance( - &MOBY(moby)->pos, ((char *)l08_paths[paratrooper_private_state->jump_path_index]), 0.0f); + &MOBY(moby)->pos, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]), + 0.0f); (*(unsigned char *)((char *)(moby) + 0x20)) = 2; } break; case PARATROOPER_STATE_APPROACH_WAYPOINT: { float distance; paratrooper_private_state->destination_waypoint_index = select_point_index_by_distance( - &MOBY(moby)->pos, ((char *)l08_paths[paratrooper_private_state->jump_path_index]), 0.0f); - distance = vector_distance_xy(&MOBY(moby)->pos, - ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10 + - paratrooper_private_state->destination_waypoint_index * 16); + &MOBY(moby)->pos, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]), + 0.0f); + distance = vector_distance_xy( + &MOBY(moby)->pos, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10 + + paratrooper_private_state->destination_waypoint_index * 16); if (distance < 1.0f || distance < paratrooper_private_state->fE0) { paratrooper_private_state->fE0 = 0.0f; (*(unsigned char *)((char *)(moby) + 0x20)) = 3; } else { step_mover_2e3f20(moby, (char *)paratrooper_private_state + 0xD0, - ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10 + - paratrooper_private_state->destination_waypoint_index * 16, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + + 0x10 + paratrooper_private_state->destination_waypoint_index * 16, pos); if ((*(unsigned char *)((char *)(moby) + 0x53)) != 2) blend_moby_animation(moby, 2, 0, random302618() % 4 + 7); @@ -355,14 +366,16 @@ void blarg_paratrooper_update(char *moby) { } (*(unsigned char *)((char *)(moby) + 0x20)) = 9; } else if (target) { - if (paratrooper_private_state->target_selection_status != PARATROOPER_TARGET_UNAVAILABLE && + if (paratrooper_private_state->target_selection_status != + PARATROOPER_TARGET_UNAVAILABLE && fast_dec_timer((char *)paratrooper_private_state + 0x1F0)) { qcopy((char *)paratrooper_private_state + 0x1C0, &MOBY(moby)->pos); - paratrooper_private_state->destination_waypoint_index = (paratrooper_private_state->destination_waypoint_index + 1) & 1; + paratrooper_private_state->destination_waypoint_index = + (paratrooper_private_state->destination_waypoint_index + 1) & 1; (*(unsigned char *)((char *)(moby) + 0x20)) = 4; fast_vec_sub(pos, - ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10 + - paratrooper_private_state->destination_waypoint_index * 16, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + + 0x10 + paratrooper_private_state->destination_waypoint_index * 16, &MOBY(moby)->pos); if (fast_vec_dot(moby + 0xD0, pos) < 0.0f) { if ((*(unsigned char *)((char *)(moby) + 0x53)) != 18) @@ -460,13 +473,15 @@ void blarg_paratrooper_update(char *moby) { fast_sin((*(float *)((char *)(moby) + 0x48))) * (speed302618 * D_0015ED6C); attack_vector_or_ray_endpoint[2] = 0.0f; attack_vector_or_ray_endpoint[2] = - (-1.0f / paratrooper_private_state->projectile_pitch_divisor) * (speed302618 * D_0015ED6C); - shot = spawn_paratrooper_projectile(attack_vector_or_ray_endpoint, - pos, - moby, - target, - scale_game_frames(180), - paratrooper_private_state->projectile_pattern_index); + (-1.0f / paratrooper_private_state->projectile_pitch_divisor) * + (speed302618 * D_0015ED6C); + shot = spawn_paratrooper_projectile( + attack_vector_or_ray_endpoint, + pos, + moby, + target, + scale_game_frames(180), + paratrooper_private_state->projectile_pattern_index); if (shot) (*(float *)((char *)(shot) + 0x2C)) *= 1.7f; } @@ -477,11 +492,12 @@ void blarg_paratrooper_update(char *moby) { if (paratrooper_private_state->projectile_pitch_divisor > 20.0f) { qcopy((char *)paratrooper_private_state + 0x1C0, &MOBY(moby)->pos); (*(unsigned short *)¶trooper_private_state->hop_count)++; - paratrooper_private_state->destination_waypoint_index = (paratrooper_private_state->destination_waypoint_index + 1) & 1; + paratrooper_private_state->destination_waypoint_index = + (paratrooper_private_state->destination_waypoint_index + 1) & 1; (*(unsigned char *)((char *)(moby) + 0x20)) = 4; fast_vec_sub(pos, - ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10 + - paratrooper_private_state->destination_waypoint_index * 16, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + + 0x10 + paratrooper_private_state->destination_waypoint_index * 16, &MOBY(moby)->pos); if (fast_vec_dot(moby + 0xD0, pos) < 0.0f) { if ((*(unsigned char *)((char *)(moby) + 0x53)) != 18) @@ -506,8 +522,9 @@ void blarg_paratrooper_update(char *moby) { D_0015ED6C * 12.566371f); frame = compute_interpolated_record_value(moby); if (frame > 12.0f && frame < 23.0f && (*(float *)((char *)(moby) + 0x54)) == 0.0f) { - fast_vec_sub( - pos, ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10, &MOBY(moby)->pos); + fast_vec_sub(pos, + ((char *)l08_paths[paratrooper_private_state->jump_path_index]) + 0x10, + &MOBY(moby)->pos); FUN_L00_0025f730(pos, D_0015ED6C * 24.0f); FUN_L00_00258830_c(moby, pos, shove302618, shove_rate302618, 0.0f, 0); } else if ((*(unsigned char *)((char *)(moby) + 0x70)) & 2) { @@ -666,7 +683,8 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { target = find_moby_hit(moby, 0x330000, 0); reaction = resolve_moby_hit_response( moby, target, ¶trooper_instance_state->health, 0, &hit_state, &damage, 0, 4); - if (hit_state != PARATROOPER_HIT_STATUS_NO_HIT_OR_SUPPRESSED && MOBY(moby)->state != PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE) { + if (hit_state != PARATROOPER_HIT_STATUS_NO_HIT_OR_SUPPRESSED && + MOBY(moby)->state != PARATROOPER_STATE_DEATH_EFFECTS_AND_REMOVE) { { float health = paratrooper_instance_state->health - damage; paratrooper_instance_state->health = health; @@ -815,7 +833,9 @@ void update_blarg_paratrooper_damage_and_state(char *moby) { paratrooper_instance_state->target_moby = (char *)hero.moby; state = MOBY(moby)->state; - if (state == PARATROOPER_STATE_INITIALIZE || state == PARATROOPER_STATE_FIRE_PROJECTILES || state == PARATROOPER_STATE_MELEE_ATTACK || state == PARATROOPER_STATE_HOP_BETWEEN_WAYPOINTS) { + if (state == PARATROOPER_STATE_INITIALIZE || state == PARATROOPER_STATE_FIRE_PROJECTILES || + state == PARATROOPER_STATE_MELEE_ATTACK || + state == PARATROOPER_STATE_HOP_BETWEEN_WAYPOINTS) { height = probe_ground_height(&MOBY(moby)->pos, 0, 0.5f); if (height < MOBY(moby)->pos.z) MOBY(moby)->pos.z = height; diff --git a/src/overlays/shared/enemies/bomb_spawner.c b/src/overlays/shared/enemies/bomb_spawner.c index a264667e4d..e6708a1c94 100644 --- a/src/overlays/shared/enemies/bomb_spawner.c +++ b/src/overlays/shared/enemies/bomb_spawner.c @@ -246,7 +246,8 @@ void bomb_spawner_update(struct Moby *moby) { inVol = 0; room = spawner_data->count < spawner_data->max; if (spawner_data->spawn_trigger_volume_index != -1) { - inVol = is_point_inside_clip_volume(D_0013E533_2bef68 + 0xE9D, spawner_data->spawn_trigger_volume_index) != 0; + inVol = is_point_inside_clip_volume(D_0013E533_2bef68 + 0xE9D, + spawner_data->spawn_trigger_volume_index) != 0; } cond = inVol | near2; switch (spawner_data->spawn_trigger_mode) { @@ -385,7 +386,7 @@ void bomb_spawner_update(struct Moby *moby) { int *used_point_flags = used; memset(used_point_flags, 0, 0x10); while (spawner_data->spawn_interval_frames == 0 ? spawner_data->count < spawner_data->max - : spawner_data->timer == 0) { + : spawner_data->timer == 0) { moby_point_position(moby, 0, &launch_origin); switch (spawner_data->spawn_target_mode) { case SPAWNER_TARGET_COUNT_ANGULAR_SPREAD: { @@ -405,7 +406,8 @@ void bomb_spawner_update(struct Moby *moby) { launch_velocity.x = fast_cos(target_spread_angle) * rad; launch_velocity.y = fast_sin(target_spread_angle) * rad; launch_velocity.z = 0.0f; - clamp_vector_length(&launch_velocity, &launch_velocity, spawner_data->spawn_distance_limit); + clamp_vector_length( + &launch_velocity, &launch_velocity, spawner_data->spawn_distance_limit); fast_vec_add(&target_position, &launch_origin, &launch_velocity); target_ground_height = probe_ground_height(&target_position, 0, 0.5f); if (target_ground_height != 0.0f) { @@ -426,7 +428,8 @@ void bomb_spawner_update(struct Moby *moby) { if (fast_vec_length(&launch_velocity) < 3.0f) { fast_vec_normalize(&launch_velocity, &launch_velocity, 3.0f); } - clamp_vector_length(&launch_velocity, &launch_velocity, spawner_data->spawn_distance_limit); + clamp_vector_length( + &launch_velocity, &launch_velocity, spawner_data->spawn_distance_limit); fast_vec_add(&target_position, &launch_origin, &launch_velocity); target_ground_height = probe_ground_height(&target_position, 0, 0.5f); if (target_ground_height != 0.0f) { @@ -532,18 +535,19 @@ void bomb_spawner_update(struct Moby *moby) { { float speed; char *spawned_moby; - speed = fast_vec_length(&launch_velocity) * (spawner_data->launch_speed_distance_factor * frame_scale_macro); + speed = fast_vec_length(&launch_velocity) * + (spawner_data->launch_speed_distance_factor * frame_scale_macro); launch_velocity.z = 0.0f; fast_vec_normalize(&launch_velocity, &launch_velocity, speed); fast_vec_normalize(&spawn_position, &launch_velocity, 0.05f); add_random_offset_to_vector_xyz((float *)&spawn_position, 0.025f); add_vectors(&sampled_point_scratch, &spawn_position, &launch_origin); - launch_velocity.z = - FUN_L00_0025abf0_2bef68(&spawn_position, - &target_position, - 0, - speed, - -(spawner_data->trajectory_gravity * frame_time_sq_macro)); + launch_velocity.z = FUN_L00_0025abf0_2bef68( + &spawn_position, + &target_position, + 0, + speed, + -(spawner_data->trajectory_gravity * frame_time_sq_macro)); spawned_moby = spawn_class_221_moby((char *)moby, (float *)&spawn_position, (float *)&launch_velocity, diff --git a/src/overlays/shared/enemies/frog.c b/src/overlays/shared/enemies/frog.c index 9b3c8800ee..8ec9a99955 100644 --- a/src/overlays/shared/enemies/frog.c +++ b/src/overlays/shared/enemies/frog.c @@ -410,7 +410,8 @@ void frog_update(unsigned char *moby) { } qcopy(&frog_instance_vars->home_position, (char *)path + point_count * 16); qcopy(&frog_instance_vars->unk230, &frog_instance_vars->home_position); - home_distance_xy = vector_distance_xy(&MOBY(moby)->pos, &frog_instance_vars->home_position); + home_distance_xy = + vector_distance_xy(&MOBY(moby)->pos, &frog_instance_vars->home_position); return_speed = home_distance_xy / (float)scale_game_frames(30); frog_instance_vars->unk138 = return_speed; frog_instance_vars->unk13C = FUN_L00_0025abf0(&MOBY(moby)->pos, @@ -574,10 +575,11 @@ void frog_update(unsigned char *moby) { wait = compute_interpolated_record_value(moby); if (MOBY(moby)->seq == MOBY(moby)->prev_seq && wait >= 10.0f && wait <= 15.0f && *(int *)(((char *)&camera_secondary_mode)) != 0x51) { - fast_vec_normalize(A, - moby + 0xC0, - (frog_instance_vars->movement_speed + frog_instance_vars->movement_speed) * - D_0015ED6C_gp); + fast_vec_normalize( + A, + moby + 0xC0, + (frog_instance_vars->movement_speed + frog_instance_vars->movement_speed) * + D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, A, 1, 0.3f, 0.3f); collect_mobies_in_sphere_at_moby_point(moby, 0, 1, 0.333f, 1.0f, 1.0f, 0, 1, 0); return; diff --git a/src/overlays/shared/enemies/gadgebot.c b/src/overlays/shared/enemies/gadgebot.c index ffbb78e362..1f660633d3 100644 --- a/src/overlays/shared/enemies/gadgebot.c +++ b/src/overlays/shared/enemies/gadgebot.c @@ -417,12 +417,14 @@ void gadgebot_update(GbMoby *moby) { gadgebot_vars->unk308 = 1.0f; moby->pos[2] = probe_ground_height(moby->pos, 0, 0.5f); spawn_gadgebot_pad((char *)moby); - gadgebot_vars->position_history_previous.q = gadgebot_vars->position_history_latest.q = *(OvlQuad *)moby->pos; + gadgebot_vars->position_history_previous.q = gadgebot_vars->position_history_latest.q = + *(OvlQuad *)moby->pos; if (visited52[moby->unkB0 + current_level_index * 16] == 0xFF) { mark_moby_for_removal(moby); return; } - gadgebot_vars->spawn_container_moby = (GbMoby *)spawn_gadgebot_spawn_container((char *)moby); + gadgebot_vars->spawn_container_moby = + (GbMoby *)spawn_gadgebot_spawn_container((char *)moby); moby->pos[2] = probe_ground_height(moby->pos, 0, 0.5f); qcopy(gadgebot_vars->unk0, moby->pos); qcopy(gadgebot_vars->unkE0, moby->pos); @@ -454,8 +456,10 @@ void gadgebot_update(GbMoby *moby) { break; } case GADGEBOT_WAIT_FOR_SPAWN_PAD: - if (gadgebot_vars->spawn_container_moby == 0 || gadgebot_vars->spawn_container_moby->state == 0xFE || - gadgebot_vars->spawn_container_moby->state == 0xFD || gadgebot_vars->spawn_container_moby->state >= 2) { + if (gadgebot_vars->spawn_container_moby == 0 || + gadgebot_vars->spawn_container_moby->state == 0xFE || + gadgebot_vars->spawn_container_moby->state == 0xFD || + gadgebot_vars->spawn_container_moby->state >= 2) { if (gadgebot_vars->configured_path_count > 0) { int i; @@ -495,7 +499,8 @@ void gadgebot_update(GbMoby *moby) { gadgebot_vars->spawn_container_moby->flags &= 0xFFBE; moby->flags |= 0x1000; gadgebot_vars->spawn_container_moby->flags |= 0x1000; - gadgebot_vars->spawn_container_moby->unk94 = gadgebot_vars->spawn_container_moby->cls->unk10; + gadgebot_vars->spawn_container_moby->unk94 = + gadgebot_vars->spawn_container_moby->cls->unk10; } if (moby->unk31 != 0) { update_gadgebot_glow_effects((char *)moby); @@ -923,11 +928,14 @@ void gadgebot_update(GbMoby *moby) { case GADGEBOT_ABSORB_INTO_OWNER: { float rr; - owner_radial_angle = fast_arc_tan(moby->pos[0] - gadgebot_vars->absorption_owner_moby->pos[0], - moby->pos[1] - gadgebot_vars->absorption_owner_moby->pos[1]); + owner_radial_angle = + fast_arc_tan(moby->pos[0] - gadgebot_vars->absorption_owner_moby->pos[0], + moby->pos[1] - gadgebot_vars->absorption_owner_moby->pos[1]); rr = vector_distance_xy(gadgebot_vars->absorption_owner_moby->pos, moby->pos); - step_angle_toward_target( - &owner_radial_angle, 0, gadgebot_vars->absorption_owner_moby->rot, frame_time * 6.2831855f); + step_angle_toward_target(&owner_radial_angle, + 0, + gadgebot_vars->absorption_owner_moby->rot, + frame_time * 6.2831855f); rr -= frame_time * 4.0f; if (rr <= 0.0f) { GbOwnerVars *ov = gadgebot_vars->absorption_owner_moby->vars; @@ -1071,11 +1079,12 @@ void gadgebot_update(GbMoby *moby) { do { qcopy(position_and_displacement_scratch, moby->pos); position_and_displacement_scratch[2] += gadgebot_vars->ctl.unk04; - if (coll_sphere(position_and_displacement_scratch, - convert_integer_to_float(gadgebot_vars->ctl.collision_radius_1024ths) * - 0.0009765625f, - 6, - moby) == 0) { + if (coll_sphere( + position_and_displacement_scratch, + convert_integer_to_float(gadgebot_vars->ctl.collision_radius_1024ths) * + 0.0009765625f, + 6, + moby) == 0) { break; } if (fast_arc_tan(D_L06_001745C0.unk48, vector_length_xy(D_L06_001745C0.unk40)) > diff --git a/src/overlays/shared/enemies/ground_melee_enemy.c b/src/overlays/shared/enemies/ground_melee_enemy.c index 1bcb93fee2..972dfe7d24 100644 --- a/src/overlays/shared/enemies/ground_melee_enemy.c +++ b/src/overlays/shared/enemies/ground_melee_enemy.c @@ -442,7 +442,8 @@ void ground_melee_enemy_update(Moby *moby) { moby->state = GROUND_ENEMY_STATE_MELEE_ATTACK; if (moby->prev_seq != 1) blend_moby_animation(moby, 1, 0, scale_game_frames(random_int_between(10, 13))); - } else if (ground_enemy_vars->horizontal_movement_step < frame_time || 1.0f < steep || (flags & 2)) { + } else if (ground_enemy_vars->horizontal_movement_step < frame_time || 1.0f < steep || + (flags & 2)) { ground_enemy_vars->home_timer = scale_game_frames(50); moby->state = GROUND_ENEMY_STATE_RETURN_HOME; } else if (fast_vec_length(&away) < ground_enemy_vars->range + 4.0f && diff --git a/src/overlays/shared/enemies/horny_toad.c b/src/overlays/shared/enemies/horny_toad.c index 8f786be286..bb86797769 100644 --- a/src/overlays/shared/enemies/horny_toad.c +++ b/src/overlays/shared/enemies/horny_toad.c @@ -327,7 +327,8 @@ void horny_toad_update(Moby *moby) { } update_object_wander_movement((char *)moby, (char *)horny_toad_vars->unk240, 0.5f, 0.5f); if (horny_toad_vars->unk1C4 != 2) { - horny_toad_vars->movement_yaw_offset = random_float_between(-20.0f, 20.0f) * 0.017453292f; + horny_toad_vars->movement_yaw_offset = + random_float_between(-20.0f, 20.0f) * 0.017453292f; moby->state = HORNY_TOAD_APPROACH_AND_FACE_TARGET; if (moby->prev_seq != 4) blend_moby_animation(moby, 4, 0, scale_game_frames(10)); @@ -580,7 +581,8 @@ void process_horny_toad_hit_reaction(unsigned char *toad_moby) { truncate_float_to_s32(scale_time(FUN_L00_00257be8_2d5160(180.0f, 240.0f))); } *(s32 *)(toad_vars + 0x38) = 0; - if ((MOBY(toad_moby)->state == HORNY_TOAD_ROAM || MOBY(toad_moby)->state == HORNY_TOAD_RETURN_HOME) && + if ((MOBY(toad_moby)->state == HORNY_TOAD_ROAM || + MOBY(toad_moby)->state == HORNY_TOAD_RETURN_HOME) && *(s16 *)(toad_vars + 0x276) != 0) { MOBY(toad_moby)->state = HORNY_TOAD_MOVE_TO_POINT_OR_FACE_TARGET; if (MOBY(toad_moby)->prev_seq != 4) diff --git a/src/overlays/shared/enemies/large_amoeboid.c b/src/overlays/shared/enemies/large_amoeboid.c index 197add84a6..cef145f983 100644 --- a/src/overlays/shared/enemies/large_amoeboid.c +++ b/src/overlays/shared/enemies/large_amoeboid.c @@ -587,7 +587,8 @@ void large_amoeboid_update(unsigned char *moby) { move_moby_with_ground_and_collision_checks( moby, &large_amoeboid_vars->unk170, move, &large_amoeboid_vars->unk40, 1.0f); } - if (large_amoeboid_vars->target_selection_status != 2 && (MOBY(moby)->state = 4, MOBY(moby)->prev_seq != 1)) + if (large_amoeboid_vars->target_selection_status != 2 && + (MOBY(moby)->state = 4, MOBY(moby)->prev_seq != 1)) blend_moby_animation(moby, 1, 0, scale_game_frames(3)); spawn_amoeboid_movement_particles(moby); return; diff --git a/src/overlays/shared/enemies/plasmabot.c b/src/overlays/shared/enemies/plasmabot.c index cab09b4379..626614e1e3 100644 --- a/src/overlays/shared/enemies/plasmabot.c +++ b/src/overlays/shared/enemies/plasmabot.c @@ -181,9 +181,12 @@ void initialize_plasmabot_path_state(char *moby) { int i; *(int *)&moby_vars->path_offset_and_spring_velocities = 0; moby_vars->path_segment_index = 0; - moby_vars->path_offset_and_spring_velocities[3] = moby_vars->path_offset_and_spring_velocities[0]; - moby_vars->path_offset_and_spring_velocities[2] = moby_vars->path_offset_and_spring_velocities[0]; - moby_vars->path_offset_and_spring_velocities[1] = moby_vars->path_offset_and_spring_velocities[0]; + moby_vars->path_offset_and_spring_velocities[3] = + moby_vars->path_offset_and_spring_velocities[0]; + moby_vars->path_offset_and_spring_velocities[2] = + moby_vars->path_offset_and_spring_velocities[0]; + moby_vars->path_offset_and_spring_velocities[1] = + moby_vars->path_offset_and_spring_velocities[0]; if (moby_vars->path_index == -1) return; path = (char *)l14_paths[moby_vars->path_index]; @@ -204,8 +207,10 @@ void scale_and_apply_plasmabot_planar_velocity(char *moby) { float planar_velocity_scale = (plasmabot_planar_velocity_base_scale_gp - 1.0f) * frame_scale + 1.0f; PlasmabotVars *moby_vars = (PlasmabotVars *)MOBY(moby)->pvars; - moby_vars->path_offset_and_spring_velocities[1] = moby_vars->path_offset_and_spring_velocities[1] * planar_velocity_scale; - moby_vars->path_offset_and_spring_velocities[2] = moby_vars->path_offset_and_spring_velocities[2] * planar_velocity_scale; + moby_vars->path_offset_and_spring_velocities[1] = + moby_vars->path_offset_and_spring_velocities[1] * planar_velocity_scale; + moby_vars->path_offset_and_spring_velocities[2] = + moby_vars->path_offset_and_spring_velocities[2] * planar_velocity_scale; MOBY(moby)->pos.x = MOBY(moby)->pos.x + moby_vars->path_offset_and_spring_velocities[1]; MOBY(moby)->pos.y = MOBY(moby)->pos.y + moby_vars->path_offset_and_spring_velocities[2]; } @@ -475,7 +480,8 @@ void plasmabot_update(char *moby) { attach_manipulator(moby, 2, &plasmabot_update_private_vars->unk120); } if (((unsigned char *)plasmabot_update_private_vars)[0x161] == 0) { - attach_manipulator(moby, 3, &plasmabot_update_private_vars->manipulator_attachment_header); + attach_manipulator( + moby, 3, &plasmabot_update_private_vars->manipulator_attachment_header); } if (((unsigned char *)plasmabot_update_private_vars)[0x24A] != 0) { deactivate_plasmabot(moby); @@ -514,9 +520,12 @@ void plasmabot_update(char *moby) { plasmabot_update_private_vars->aim_joint_angular_velocity = 0; plasmabot_update_private_vars->path_segment_index = 0; *(int *)&plasmabot_update_private_vars->path_offset_and_spring_velocities = 0; - plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = plasmabot_update_private_vars->aim_yaw_offset; - plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = plasmabot_update_private_vars->aim_yaw_offset; - plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = plasmabot_update_private_vars->aim_yaw_offset; + plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = + plasmabot_update_private_vars->aim_yaw_offset; + plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = + plasmabot_update_private_vars->aim_yaw_offset; + plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = + plasmabot_update_private_vars->aim_yaw_offset; return; } case PLASMABOT_START_PATH_TRAVERSAL: @@ -532,18 +541,20 @@ void plasmabot_update(char *moby) { break; case PLASMABOT_RETURN_TO_PATH_START: { float *path = (float *)l14_paths[plasmabot_update_private_vars->path_index]; - vendor_spring((float *)&MOBY(moby)->pos, - (float *)(&plasmabot_update_private_vars->path_offset_and_spring_velocities[1]), - path[4], - 0.01f, - 0.2f, - 0.0f); - vendor_spring((float *)&MOBY(moby)->pos.y, - (float *)(&plasmabot_update_private_vars->path_offset_and_spring_velocities[2]), - path[5], - 0.01f, - 0.2f, - 0.0f); + vendor_spring( + (float *)&MOBY(moby)->pos, + (float *)(&plasmabot_update_private_vars->path_offset_and_spring_velocities[1]), + path[4], + 0.01f, + 0.2f, + 0.0f); + vendor_spring( + (float *)&MOBY(moby)->pos.y, + (float *)(&plasmabot_update_private_vars->path_offset_and_spring_velocities[2]), + path[5], + 0.01f, + 0.2f, + 0.0f); if ((MOBY(moby)->anim_flags & 2) && ((unsigned char *)moby)[0x52] == ((unsigned char *)moby)[0x53]) { blend_moby_animation(moby, 0, 0, scale_game_frames(10)); @@ -576,9 +587,12 @@ void plasmabot_update(char *moby) { *(int *)&plasmabot_update_private_vars->path_offset_and_spring_velocities = 0; plasmabot_update_private_vars->path_traversal_direction = 1.0f; plasmabot_update_private_vars->path_segment_index = 0; - plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = plasmabot_update_private_vars->path_offset_and_spring_velocities[0]; - plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = plasmabot_update_private_vars->path_offset_and_spring_velocities[0]; - plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = plasmabot_update_private_vars->path_offset_and_spring_velocities[0]; + plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = + plasmabot_update_private_vars->path_offset_and_spring_velocities[0]; + plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = + plasmabot_update_private_vars->path_offset_and_spring_velocities[0]; + plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = + plasmabot_update_private_vars->path_offset_and_spring_velocities[0]; break; } case PLASMABOT_FOLLOW_PATH_FORWARD: @@ -630,11 +644,13 @@ void plasmabot_update(char *moby) { char *path; plasmabot_update_private_vars->path_segment_index = index; path = (char *)l14_paths[plasmabot_update_private_vars->path_index]; - plasmabot_update_private_vars->path_offset_and_spring_velocities[0] = *(float *)(path + (index << 4) + 0x1C); + plasmabot_update_private_vars->path_offset_and_spring_velocities[0] = + *(float *)(path + (index << 4) + 0x1C); } plasmabot_update_private_vars->path_traversal_direction = -1.0f; - plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = - plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = 0.0f; + plasmabot_update_private_vars->path_offset_and_spring_velocities[1] = + plasmabot_update_private_vars->path_offset_and_spring_velocities[2] = + plasmabot_update_private_vars->path_offset_and_spring_velocities[3] = 0.0f; release_beam_slot_by_id(moby); break; } diff --git a/src/overlays/shared/enemies/scoutbot.c b/src/overlays/shared/enemies/scoutbot.c index 253f892e2c..c6767e85e6 100644 --- a/src/overlays/shared/enemies/scoutbot.c +++ b/src/overlays/shared/enemies/scoutbot.c @@ -441,12 +441,18 @@ void update_scoutbot_health_and_target(struct Moby *moby) { ((unsigned char *)moby)[0xA4] = 0xFF; if (((unsigned char *)moby)[0x20] != 0 && ((unsigned char *)moby)[0x20] != 4) { char *path = ((char *)l08_paths[scoutbot_pvars->target_path_index]); - if (func_L00_00260FB0_f( - moby, &scoutbot_pvars->tracked_target_position, 14.0f, 0, 0, path + 0x10, *(int *)path) != 2) { - if (14.0f < vector_distance_xy(&scoutbot_pvars->unk1C0, &scoutbot_pvars->tracked_target_position)) { + if (func_L00_00260FB0_f(moby, + &scoutbot_pvars->tracked_target_position, + 14.0f, + 0, + 0, + path + 0x10, + *(int *)path) != 2) { + if (14.0f < vector_distance_xy(&scoutbot_pvars->unk1C0, + &scoutbot_pvars->tracked_target_position)) { scoutbot_pvars->target_selection_status = SCOUTBOT_TARGET_SELECTION_UNAVAILABLE; - } else if (3.0f < - absolute_float(scoutbot_pvars->unk1C0[2] - scoutbot_pvars->tracked_target_position[2])) { + } else if (3.0f < absolute_float(scoutbot_pvars->unk1C0[2] - + scoutbot_pvars->tracked_target_position[2])) { scoutbot_pvars->target_selection_status = SCOUTBOT_TARGET_SELECTION_UNAVAILABLE; } } @@ -487,8 +493,8 @@ void draw_target_beam(struct Moby *moby) { moby_point_position(moby, 2, &beam_origin_position); fast_vec_sub(&delta, scoutbot_private_vars->beam_target_moby + 0x10, &beam_origin_position); scale_vector_002d3878(3.0f, &delta); - delta.v[2] = - (*(float *)(scoutbot_private_vars->beam_target_moby + 0x18) + 0.25f) - beam_origin_position.v[2]; + delta.v[2] = (*(float *)(scoutbot_private_vars->beam_target_moby + 0x18) + 0.25f) - + beam_origin_position.v[2]; delta.v[3] = 1.0f; length = fast_vec_length(&delta); clear_u64_value(&angles); @@ -610,9 +616,11 @@ void update_scoutbot_movement(struct Moby *moby) { fast_vec_normalize(velocity_ptr, velocity_ptr, movement_length); fast_vec_add((float *)&moby->pos, (float *)&moby->pos, velocity_ptr); scoutbot_instance_state->vertical_bob_phase = - fast_add_rotations(scoutbot_instance_state->vertical_bob_phase, scoutbot_instance_state->vertical_bob_phase_increment); + fast_add_rotations(scoutbot_instance_state->vertical_bob_phase, + scoutbot_instance_state->vertical_bob_phase_increment); target_height = scoutbot_instance_state->unk1C0[2] + - scoutbot_instance_state->vertical_bob_amplitude * fast_sin(scoutbot_instance_state->vertical_bob_phase); + scoutbot_instance_state->vertical_bob_amplitude * + fast_sin(scoutbot_instance_state->vertical_bob_phase); if (scoutbot_instance_state->ground_hover_offset_enabled) target_height += scoutbot_instance_state->unk200; vertical_step = target_height - moby->pos.z; diff --git a/src/overlays/shared/enemies/seeker.c b/src/overlays/shared/enemies/seeker.c index 823701aaeb..32fb5478a1 100644 --- a/src/overlays/shared/enemies/seeker.c +++ b/src/overlays/shared/enemies/seeker.c @@ -576,7 +576,9 @@ void update_seeker_damage_and_target(Moby *moby) { } } else { Moby *target = seeker_vars->f160; - if (target != 0 && target->state != MOBY_STATE_REMOVAL_MARKED_AT_OR_ABOVE_ADDRESS_THRESHOLD && target->state != MOBY_STATE_REMOVAL_MARKED_BELOW_ADDRESS_THRESHOLD) { + if (target != 0 && + target->state != MOBY_STATE_REMOVAL_MARKED_AT_OR_ABOVE_ADDRESS_THRESHOLD && + target->state != MOBY_STATE_REMOVAL_MARKED_BELOW_ADDRESS_THRESHOLD) { qcopy(seeker_vars->target, &target->pos); } else { seeker_vars->f160 = 0; diff --git a/src/overlays/shared/enemies/sentrybot.c b/src/overlays/shared/enemies/sentrybot.c index 71f0c086fe..6f56e61d70 100644 --- a/src/overlays/shared/enemies/sentrybot.c +++ b/src/overlays/shared/enemies/sentrybot.c @@ -105,10 +105,10 @@ typedef struct SentrybotVars { u8 pad118[8]; s32 path_index; /* 0x120: into D_L15_001B0AB0 */ s32 unk124; - s32 alarm_moby_index; /* 0x128: moby the alarm is set on */ - s32 sight_line_ignored_moby_index; /* moby index the sight line ignores */ - f32 target_countdown; /* 0x130 */ - f32 forward_speed; /* 0x134 */ + s32 alarm_moby_index; /* 0x128: moby the alarm is set on */ + s32 sight_line_ignored_moby_index; /* moby index the sight line ignores */ + f32 target_countdown; /* 0x130 */ + f32 forward_speed; /* 0x134 */ f32 unk138[1]; s32 patrol_point; /* 0x13C */ u8 pad140[4]; @@ -391,7 +391,8 @@ void sentrybot_update(unsigned char *moby) { } case SENTRYBOT_PATROL_IDLE: case SENTRYBOT_PATROL_PAUSE: - if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { + if (sentrybot_instance_data->target_mode != + SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { MOBY(moby)->command = 1; if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; @@ -461,10 +462,12 @@ void sentrybot_update(unsigned char *moby) { scale_game_frames(sentrybot_instance_data->patrol_pause_duration_frames); MOBY(moby)->state = SENTRYBOT_PATROL_PAUSE; } - } else if (sentrybot_instance_data->target_detected_without_engagement != 0 && hero.state.current == 0x59) { + } else if (sentrybot_instance_data->target_detected_without_engagement != 0 && + hero.state.current == 0x59) { if (sentrybot_instance_data->unk150 != -1 || sentrybot_instance_data->sight_line_ignored_moby_index != -1 || - (sentrybot_instance_data->linked_moby_deactivation_cooldown == 0 && random_integer_below(0x78) == 0)) { + (sentrybot_instance_data->linked_moby_deactivation_cooldown == 0 && + random_integer_below(0x78) == 0)) { sentrybot_instance_data->pending_animation = 0; sentrybot_instance_data->unk15C = 2; MOBY(moby)->state = SENTRYBOT_DEACTIVATE_LINKED_MOBYS_AFTER_ANIMATION; @@ -494,7 +497,8 @@ void sentrybot_update(unsigned char *moby) { } break; case SENTRYBOT_WAIT_FOR_ANIMATION_THEN_PATROL_IDLE: - if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { + if (sentrybot_instance_data->target_mode != + SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { MOBY(moby)->command = 1; if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; @@ -525,8 +529,9 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk150 = -1; } if (sentrybot_instance_data->sight_line_ignored_moby_index != -1) { - mark_moby_killed_and_release_owned_voice((int)l15_moby_array + - (sentrybot_instance_data->sight_line_ignored_moby_index << 8)); + mark_moby_killed_and_release_owned_voice( + (int)l15_moby_array + + (sentrybot_instance_data->sight_line_ignored_moby_index << 8)); sentrybot_instance_data->sight_line_ignored_moby_index = -1; } MOBY(moby)->state = sentrybot_instance_data->unk15C; @@ -545,7 +550,8 @@ void sentrybot_update(unsigned char *moby) { case SENTRYBOT_TURN_NEGATIVE_HEADING_DELTA: case SENTRYBOT_TURN_POSITIVE_HEADING_DELTA: case SENTRYBOT_TURN_AROUND: - if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && + if (sentrybot_instance_data->target_mode != + SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && fast_difference_between_rotations( MOBY(moby)->rot.z, fast_arc_tan(sentrybot_instance_data->unkD0[0] - MOBY(moby)->pos.x, @@ -612,7 +618,8 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk144 = 1; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); - } else if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { + } else if (sentrybot_instance_data->target_mode != + SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { MOBY(moby)->command = 1; if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; @@ -657,8 +664,10 @@ void sentrybot_update(unsigned char *moby) { (float *)(sentrybot_instance_data->attention_source + 0x10), (void *)0xA, (void *)0xF); - } else if (sentrybot_instance_data->target_detected_without_engagement != 0 && hero.state.current == 0x59) { - if (sentrybot_instance_data->unk150 != -1 || sentrybot_instance_data->sight_line_ignored_moby_index != -1 || + } else if (sentrybot_instance_data->target_detected_without_engagement != 0 && + hero.state.current == 0x59) { + if (sentrybot_instance_data->unk150 != -1 || + sentrybot_instance_data->sight_line_ignored_moby_index != -1 || sentrybot_instance_data->linked_moby_deactivation_cooldown == 0) { sentrybot_instance_data->unk15C = MOBY(moby)->state; sentrybot_instance_data->pending_animation = 0xD; @@ -691,7 +700,9 @@ void sentrybot_update(unsigned char *moby) { sentrybot_instance_data->unk144 = 1; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); - } else if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && sentrybot_instance_data->alert_engagement_suppressed == 0) { + } else if (sentrybot_instance_data->target_mode != + SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION && + sentrybot_instance_data->alert_engagement_suppressed == 0) { MOBY(moby)->command = 1; if (sentrybot_instance_data->command_alert_transition_started != 0) { MOBY(moby)->state = SENTRYBOT_WAIT_FOR_ANIMATION_THEN_EMIT_WITH_NEGATIVE_JOINT_AIM; @@ -811,8 +822,10 @@ void sentrybot_update(unsigned char *moby) { MOBY(moby)->state = sentrybot_instance_data->unk15C; if (sentrybot_instance_data->pending_animation != 0xFF && MOBY(moby)->prev_seq != sentrybot_instance_data->pending_animation) - blend_moby_animation( - moby, sentrybot_instance_data->pending_animation, 0, scale_game_frames(10)); + blend_moby_animation(moby, + sentrybot_instance_data->pending_animation, + 0, + scale_game_frames(10)); } } } @@ -943,7 +956,8 @@ void sentrybot_update(unsigned char *moby) { (float *)(&sentrybot_instance_data->unkD0), (void *)0x10, (void *)3); - } else if (sentrybot_instance_data->target_mode == SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { + } else if (sentrybot_instance_data->target_mode == + SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { MOBY(moby)->state = SENTRYBOT_ALERT_IDLE; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); @@ -1013,7 +1027,8 @@ void sentrybot_update(unsigned char *moby) { (float *)(&sentrybot_instance_data->unkD0), (void *)0x12, (void *)5); - } else if (sentrybot_instance_data->target_mode == SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { + } else if (sentrybot_instance_data->target_mode == + SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { MOBY(moby)->state = SENTRYBOT_ALERT_IDLE; if (MOBY(moby)->prev_seq != 0) blend_moby_animation(moby, 0, 0, scale_game_frames(10)); @@ -1125,8 +1140,9 @@ void sentrybot_update(unsigned char *moby) { return; } if (sentrybot_instance_data->sight_line_ignored_moby_index != -1) { - mark_moby_killed_and_release_owned_voice((int)l15_moby_array + - (sentrybot_instance_data->sight_line_ignored_moby_index << 8)); + mark_moby_killed_and_release_owned_voice( + (int)l15_moby_array + + (sentrybot_instance_data->sight_line_ignored_moby_index << 8)); sentrybot_instance_data->sight_line_ignored_moby_index = -1; } if (sentrybot_instance_data->unk150 != -1) { @@ -1148,8 +1164,9 @@ void sentrybot_update(unsigned char *moby) { case SENTRYBOT_DEATH_KNOCKBACK: if (step_moby_motion(moby, &sentrybot_instance_data->knockback) & 0x160) { if (sentrybot_instance_data->sight_line_ignored_moby_index != -1) { - mark_moby_killed_and_release_owned_voice((int)l15_moby_array + - (sentrybot_instance_data->sight_line_ignored_moby_index << 8)); + mark_moby_killed_and_release_owned_voice( + (int)l15_moby_array + + (sentrybot_instance_data->sight_line_ignored_moby_index << 8)); sentrybot_instance_data->sight_line_ignored_moby_index = -1; } if (sentrybot_instance_data->unk150 != -1) { @@ -1168,7 +1185,8 @@ void sentrybot_update(unsigned char *moby) { update_sentrybot_joint_aim(moby); if (sentrybot_instance_data->alert_timer != 0) { lvl = 2; - } else if (sentrybot_instance_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { + } else if (sentrybot_instance_data->target_mode != + SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { lvl = 2; } else { lvl = sentrybot_instance_data->target_detected_without_engagement != 0; @@ -1743,7 +1761,8 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i seen = sentrybot_data->has_line_of_sight; } if (sentrybot_data->target_mode == SENTRYBOT_TARGET_MODE_SNAPSHOT_ENGAGEMENT_SUPPRESSION) - sentrybot_data->saved_alert_engagement_suppression_plus_one = sentrybot_data->alert_engagement_suppressed + 1; + sentrybot_data->saved_alert_engagement_suppression_plus_one = + sentrybot_data->alert_engagement_suppressed + 1; else if ((unsigned char)D_001413F4[0] != 3) sentrybot_data->saved_alert_engagement_suppression_plus_one = 0; else if (sentrybot_data->saved_alert_engagement_suppression_plus_one >= 2) @@ -1755,12 +1774,16 @@ void update_sentrybot_hit_response_and_target_visibility(void *sentrybot_moby, i sentrybot_data->target_in_view = 0; sentrybot_data->target_mode = SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION; sentrybot_data->target_detected_without_engagement = 0; - } else if (((sentrybot_data->alert_timer == 0 || sentrybot_data->alert_engagement_suppressed != 0) && + } else if (((sentrybot_data->alert_timer == 0 || + sentrybot_data->alert_engagement_suppressed != 0) && (unsigned char)D_001413F4[0] == 3) || - (sentrybot_data->saved_alert_engagement_suppression_plus_one != 0 && sentrybot_data->target_mode != SENTRYBOT_TARGET_MODE_SNAPSHOT_ENGAGEMENT_SUPPRESSION)) { + (sentrybot_data->saved_alert_engagement_suppression_plus_one != 0 && + sentrybot_data->target_mode != + SENTRYBOT_TARGET_MODE_SNAPSHOT_ENGAGEMENT_SUPPRESSION)) { sentrybot_data->target_mode = SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION; sentrybot_data->target_detected_without_engagement = 1; - } else if ((unsigned char)D_001413F4[0] != 3 && sentrybot_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { + } else if ((unsigned char)D_001413F4[0] != 3 && + sentrybot_data->target_mode != SENTRYBOT_TARGET_MODE_SUPPRESS_DIRECT_EMISSION) { sentrybot_data->alert_engagement_suppressed = 0; } if (D_L15_0015F5C4 == 2) diff --git a/src/overlays/shared/enemies/spawner.c b/src/overlays/shared/enemies/spawner.c index 3df15ef117..27e088bd08 100644 --- a/src/overlays/shared/enemies/spawner.c +++ b/src/overlays/shared/enemies/spawner.c @@ -196,7 +196,8 @@ void spawner_update(char *moby) { region_count); } else { char *target_moby = *(char **)((char *)spawner_vars + 0x140); - if (target_moby != 0 && (unsigned char)MOBY(target_moby)->state != MOBY_STATE_MARKED_FOR_REMOVAL && + if (target_moby != 0 && + (unsigned char)MOBY(target_moby)->state != MOBY_STATE_MARKED_FOR_REMOVAL && (unsigned char)MOBY(target_moby)->state != 0xFD) { qcopy((char *)spawner_vars + 0x100, &MOBY(target_moby)->pos); } else { diff --git a/src/overlays/shared/enemies/walker_update_gait.c b/src/overlays/shared/enemies/walker_update_gait.c index 553d71adfc..13a6b6302b 100644 --- a/src/overlays/shared/enemies/walker_update_gait.c +++ b/src/overlays/shared/enemies/walker_update_gait.c @@ -111,7 +111,7 @@ typedef struct WalkMoby { unsigned char b52; /* 0x52 */ unsigned char b53; float animation_interpolation_fraction; /* 0x54 */ - float animation_playback_rate; /* 0x58 */ + float animation_playback_rate; /* 0x58 */ } WalkMoby; typedef struct WalkAnim { @@ -132,7 +132,7 @@ typedef struct WalkAnim { typedef struct WalkData { char pad00[0x10]; - float ground_probe_anchor_record[8]; /* 0x10 */ + float ground_probe_anchor_record[8]; /* 0x10 */ float alternate_ground_probe_anchor_record[8]; /* 0x30 */ char pad50[0x10]; float jump_target_position[3]; /* 0x60 */ @@ -217,7 +217,8 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); } gait_data->gait_state = 0xD; - gait_data->gait_phase_mask = walker_gait_mask(gait_data->anim[7], (float)gait_data->anim[7]->initial_animation_position); + 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; } else if (speed > frame_time * 0.21f || fast_difference_between_rotations(walker_moby->f48, movement_heading) > @@ -226,14 +227,14 @@ void walker_update_gait(WalkMoby *walker_moby, if (gait_data->walk_start_counter >= 4) { { WalkAnim *a = gait_data->anim[0]; - int f = find_nearest_animation_sequence_entry(walker_moby->pClass->seqs[a->id], - (float)a->initial_animation_position); + int f = find_nearest_animation_sequence_entry( + walker_moby->pClass->seqs[a->id], (float)a->initial_animation_position); blend_moby_animation(walker_moby, a->id, f, 10); reset_walker_gait_helpers((char *)gait_data); } gait_data->gait_state = 1; - gait_data->gait_phase_mask = - walker_gait_mask(gait_data->anim[0], (float)gait_data->anim[0]->initial_animation_position); + 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; } } @@ -261,22 +262,27 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->gait_state = 0; } 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 && !(gait_data->gait_phase_mask & 0x3A)) { + if (speed > t && gait_data->gait_speed_reference > t && + !(gait_data->gait_phase_mask & 0x3A)) { float current_animation_position = compute_interpolated_record_value(walker_moby); int r1 = truncate_float_to_s32(gait_data->anim[gait_animation_index]->f48 - current_animation_position + gait_data->anim[gait_animation_index]->f10) % truncate_float_to_s32(gait_data->anim[gait_animation_index]->f10); - int r2 = truncate_float_to_s32(gait_data->anim[gait_animation_index]->alternate_run_transition_position - - current_animation_position + - gait_data->anim[gait_animation_index]->f10) % - truncate_float_to_s32(gait_data->anim[gait_animation_index]->f10); + int r2 = + truncate_float_to_s32( + gait_data->anim[gait_animation_index]->alternate_run_transition_position - + current_animation_position + gait_data->anim[gait_animation_index]->f10) % + truncate_float_to_s32(gait_data->anim[gait_animation_index]->f10); int x; int bl; if (r1 < r2) { - x = truncate_float_to_s32(gait_data->anim[7]->f48 - gait_data->anim[7]->animation_position_origin); + x = truncate_float_to_s32(gait_data->anim[7]->f48 - + gait_data->anim[7]->animation_position_origin); } else { - x = truncate_float_to_s32(gait_data->anim[7]->alternate_run_transition_position - gait_data->anim[7]->animation_position_origin); + x = truncate_float_to_s32( + gait_data->anim[7]->alternate_run_transition_position - + gait_data->anim[7]->animation_position_origin); } x = (x + truncate_float_to_s32(gait_data->anim[7]->f10)) % truncate_float_to_s32(gait_data->anim[7]->f10); @@ -295,11 +301,13 @@ void walker_update_gait(WalkMoby *walker_moby, 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) { - int bl = truncate_float_to_s32(gait_data->anim[11]->transition_position_span * 0.25f / - (speed / gait_data->anim[11]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[11]->f40 + - gait_data->anim[11]->transition_position_span * 0.125f - - gait_data->anim[11]->animation_position_origin) % + int bl = + truncate_float_to_s32(gait_data->anim[11]->transition_position_span * + 0.25f / (speed / gait_data->anim[11]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[11]->f40 + + gait_data->anim[11]->transition_position_span * 0.125f - + gait_data->anim[11]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[11]->f10); WalkAnim *a = gait_data->anim[11]; int f = find_nearest_animation_sequence_entry( @@ -308,12 +316,15 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->gait_state = 0xF; } else { - int bl = truncate_float_to_s32(gait_data->anim[9]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[9]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[9]->alternate_phase_anchor_position + - gait_data->anim[9]->alternate_transition_position_span * 0.125f - - gait_data->anim[9]->animation_position_origin) % - truncate_float_to_s32(gait_data->anim[9]->f10); + int bl = truncate_float_to_s32( + gait_data->anim[9]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[9]->f08)); + int fr = + truncate_float_to_s32( + gait_data->anim[9]->alternate_phase_anchor_position + + gait_data->anim[9]->alternate_transition_position_span * 0.125f - + gait_data->anim[9]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[9]->f10); WalkAnim *a = gait_data->anim[9]; int f = find_nearest_animation_sequence_entry( walker_moby->pClass->seqs[a->id], (float)fr); @@ -329,9 +340,13 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->anim[gait_animation_index]->f04 * 0.5f; ground_probe_position[2] = 0.0f; if (flags & 1) { - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); + fast_vec_add(ground_probe_position, + ground_probe_position, + gait_data->ground_probe_anchor_record); } else { - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->alternate_ground_probe_anchor_record); + fast_vec_add(ground_probe_position, + ground_probe_position, + gait_data->alternate_ground_probe_anchor_record); } ground_height = probe_ground_height(ground_probe_position, 0, 0.5f); gait_data->gait_ground_height_reference = ground_height; @@ -342,11 +357,13 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(gait_data->ground_probe_correction_angle) > gait_data->terrain_transition_height_scale * 0.75f) { if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / - (speed / gait_data->anim[2]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + - gait_data->anim[2]->transition_position_span * 0.125f - - gait_data->anim[2]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[2]->transition_position_span * 0.25f / + (speed / gait_data->anim[2]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[2]->f40 + + gait_data->anim[2]->transition_position_span * 0.125f - + gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; int f = find_nearest_animation_sequence_entry( @@ -355,12 +372,16 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->gait_state = 3; } else { - int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[1]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[1]->alternate_phase_anchor_position + - gait_data->anim[1]->alternate_transition_position_span * 0.125f - - gait_data->anim[1]->animation_position_origin) % - truncate_float_to_s32(gait_data->anim[1]->f10); + int bl = truncate_float_to_s32( + gait_data->anim[1]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[1]->f08)); + int fr = + truncate_float_to_s32( + gait_data->anim[1]->alternate_phase_anchor_position + + gait_data->anim[1]->alternate_transition_position_span * + 0.125f - + gait_data->anim[1]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; int f = find_nearest_animation_sequence_entry( walker_moby->pClass->seqs[a->id], (float)fr); @@ -374,11 +395,13 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_status_flags |= 8; if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / - (speed / gait_data->anim[5]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[5]->f40 + - gait_data->anim[5]->transition_position_span * 0.125f - - gait_data->anim[5]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[5]->transition_position_span * 0.25f / + (speed / gait_data->anim[5]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[5]->f40 + + gait_data->anim[5]->transition_position_span * 0.125f - + gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); WalkAnim *a = gait_data->anim[5]; int f = find_nearest_animation_sequence_entry( @@ -387,12 +410,16 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->gait_state = 8; } else { - int bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[4]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[4]->alternate_phase_anchor_position + - gait_data->anim[4]->alternate_transition_position_span * 0.125f - - gait_data->anim[4]->animation_position_origin) % - truncate_float_to_s32(gait_data->anim[4]->f10); + int bl = truncate_float_to_s32( + gait_data->anim[4]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[4]->f08)); + int fr = + truncate_float_to_s32( + gait_data->anim[4]->alternate_phase_anchor_position + + gait_data->anim[4]->alternate_transition_position_span * + 0.125f - + gait_data->anim[4]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[4]->f10); WalkAnim *a = gait_data->anim[4]; int f = find_nearest_animation_sequence_entry( walker_moby->pClass->seqs[a->id], (float)fr); @@ -412,11 +439,13 @@ void walker_update_gait(WalkMoby *walker_moby, WalkAnim *a; int f; gait_data->gait_status_flags |= 8; - bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / - (speed / gait_data->anim[5]->f08)); - fr = truncate_float_to_s32(gait_data->anim[5]->f40 + - gait_data->anim[5]->transition_position_span * 0.125f - - gait_data->anim[5]->animation_position_origin) % + bl = + truncate_float_to_s32(gait_data->anim[5]->transition_position_span * + 0.25f / (speed / gait_data->anim[5]->f08)); + fr = truncate_float_to_s32( + gait_data->anim[5]->f40 + + gait_data->anim[5]->transition_position_span * 0.125f - + gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); a = gait_data->anim[5]; f = find_nearest_animation_sequence_entry( @@ -430,11 +459,13 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_state = 5; } else { - int bl = truncate_float_to_s32(gait_data->anim[3]->transition_position_span * 0.25f / - (speed / gait_data->anim[3]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[3]->f40 + - gait_data->anim[3]->transition_position_span * 0.125f - - gait_data->anim[3]->animation_position_origin) % + int bl = + truncate_float_to_s32(gait_data->anim[3]->transition_position_span * + 0.25f / (speed / gait_data->anim[3]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[3]->f40 + + gait_data->anim[3]->transition_position_span * 0.125f - + gait_data->anim[3]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[3]->f10); WalkAnim *a = gait_data->anim[3]; int f = find_nearest_animation_sequence_entry( @@ -454,11 +485,14 @@ void walker_update_gait(WalkMoby *walker_moby, WalkAnim *a; int f; gait_data->gait_status_flags |= 8; - bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[4]->f08)); - fr = truncate_float_to_s32(gait_data->anim[4]->alternate_phase_anchor_position + - gait_data->anim[4]->alternate_transition_position_span * 0.125f - - gait_data->anim[4]->animation_position_origin) % + bl = truncate_float_to_s32( + gait_data->anim[4]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[4]->f08)); + fr = truncate_float_to_s32( + gait_data->anim[4]->alternate_phase_anchor_position + + gait_data->anim[4]->alternate_transition_position_span * + 0.125f - + gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); a = gait_data->anim[4]; f = find_nearest_animation_sequence_entry( @@ -472,11 +506,14 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_state = 6; } else { - int bl = truncate_float_to_s32(gait_data->anim[3]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[3]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[3]->alternate_phase_anchor_position + - gait_data->anim[3]->alternate_transition_position_span * 0.125f - - gait_data->anim[3]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[3]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[3]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[3]->alternate_phase_anchor_position + + gait_data->anim[3]->alternate_transition_position_span * + 0.125f - + gait_data->anim[3]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[3]->f10); WalkAnim *a = gait_data->anim[3]; int f = find_nearest_animation_sequence_entry( @@ -493,11 +530,13 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_status_flags |= 8; if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / - (speed / gait_data->anim[5]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[5]->f40 + - gait_data->anim[5]->transition_position_span * 0.125f - - gait_data->anim[5]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[5]->transition_position_span * 0.25f / + (speed / gait_data->anim[5]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[5]->f40 + + gait_data->anim[5]->transition_position_span * 0.125f - + gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); WalkAnim *a = gait_data->anim[5]; int f = find_nearest_animation_sequence_entry( @@ -506,12 +545,16 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->gait_state = 8; } else { - int bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[4]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[4]->alternate_phase_anchor_position + - gait_data->anim[4]->alternate_transition_position_span * 0.125f - - gait_data->anim[4]->animation_position_origin) % - truncate_float_to_s32(gait_data->anim[4]->f10); + int bl = truncate_float_to_s32( + gait_data->anim[4]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[4]->f08)); + int fr = + truncate_float_to_s32( + gait_data->anim[4]->alternate_phase_anchor_position + + gait_data->anim[4]->alternate_transition_position_span * + 0.125f - + gait_data->anim[4]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[4]->f10); WalkAnim *a = gait_data->anim[4]; int f = find_nearest_animation_sequence_entry( walker_moby->pClass->seqs[a->id], (float)fr); @@ -524,11 +567,13 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(gait_data->ground_probe_correction_angle) < gait_data->terrain_transition_height_scale * 0.75f) { if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[1]->transition_position_span * 0.25f / - (speed / gait_data->anim[1]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[1]->f40 + - gait_data->anim[1]->transition_position_span * 0.125f - - gait_data->anim[1]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[1]->transition_position_span * 0.25f / + (speed / gait_data->anim[1]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[1]->f40 + + gait_data->anim[1]->transition_position_span * 0.125f - + gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; int f = find_nearest_animation_sequence_entry( @@ -537,12 +582,16 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->gait_state = 5; } else { - int bl = truncate_float_to_s32(gait_data->anim[2]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[2]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[2]->alternate_phase_anchor_position + - gait_data->anim[2]->alternate_transition_position_span * 0.125f - - gait_data->anim[2]->animation_position_origin) % - truncate_float_to_s32(gait_data->anim[2]->f10); + int bl = truncate_float_to_s32( + gait_data->anim[2]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[2]->f08)); + int fr = + truncate_float_to_s32( + gait_data->anim[2]->alternate_phase_anchor_position + + gait_data->anim[2]->alternate_transition_position_span * + 0.125f - + gait_data->anim[2]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; int f = find_nearest_animation_sequence_entry( walker_moby->pClass->seqs[a->id], (float)fr); @@ -562,11 +611,14 @@ void walker_update_gait(WalkMoby *walker_moby, WalkAnim *a; int f; gait_data->gait_status_flags |= 8; - bl = truncate_float_to_s32(gait_data->anim[4]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[4]->f08)); - fr = truncate_float_to_s32(gait_data->anim[4]->alternate_phase_anchor_position + - gait_data->anim[4]->alternate_transition_position_span * 0.125f - - gait_data->anim[4]->animation_position_origin) % + bl = truncate_float_to_s32( + gait_data->anim[4]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[4]->f08)); + fr = truncate_float_to_s32( + gait_data->anim[4]->alternate_phase_anchor_position + + gait_data->anim[4]->alternate_transition_position_span * + 0.125f - + gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); a = gait_data->anim[4]; f = find_nearest_animation_sequence_entry( @@ -580,11 +632,14 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_state = 2; } else { - int bl = truncate_float_to_s32(gait_data->anim[0]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[0]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[0]->alternate_phase_anchor_position + - gait_data->anim[0]->alternate_transition_position_span * 0.125f - - gait_data->anim[0]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[0]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[0]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[0]->alternate_phase_anchor_position + + gait_data->anim[0]->alternate_transition_position_span * + 0.125f - + gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; int f = find_nearest_animation_sequence_entry( @@ -604,11 +659,13 @@ void walker_update_gait(WalkMoby *walker_moby, WalkAnim *a; int f; gait_data->gait_status_flags |= 8; - bl = truncate_float_to_s32(gait_data->anim[5]->transition_position_span * 0.25f / - (speed / gait_data->anim[5]->f08)); - fr = truncate_float_to_s32(gait_data->anim[5]->f40 + - gait_data->anim[5]->transition_position_span * 0.125f - - gait_data->anim[5]->animation_position_origin) % + bl = + truncate_float_to_s32(gait_data->anim[5]->transition_position_span * + 0.25f / (speed / gait_data->anim[5]->f08)); + fr = truncate_float_to_s32( + gait_data->anim[5]->f40 + + gait_data->anim[5]->transition_position_span * 0.125f - + gait_data->anim[5]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[5]->f10); a = gait_data->anim[5]; f = find_nearest_animation_sequence_entry( @@ -622,11 +679,13 @@ void walker_update_gait(WalkMoby *walker_moby, gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_state = 3; } else { - int bl = truncate_float_to_s32(gait_data->anim[0]->transition_position_span * 0.25f / - (speed / gait_data->anim[0]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[0]->f40 + - gait_data->anim[0]->transition_position_span * 0.125f - - gait_data->anim[0]->animation_position_origin) % + int bl = + truncate_float_to_s32(gait_data->anim[0]->transition_position_span * + 0.25f / (speed / gait_data->anim[0]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[0]->f40 + + gait_data->anim[0]->transition_position_span * 0.125f - + gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; int f = find_nearest_animation_sequence_entry( @@ -641,11 +700,13 @@ 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) { - int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / - (speed / gait_data->anim[2]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + - gait_data->anim[2]->transition_position_span * 0.125f - - gait_data->anim[2]->animation_position_origin) % + int bl = + truncate_float_to_s32(gait_data->anim[2]->transition_position_span * + 0.25f / (speed / gait_data->anim[2]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[2]->f40 + + gait_data->anim[2]->transition_position_span * 0.125f - + gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; int f = find_nearest_animation_sequence_entry( @@ -659,11 +720,13 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_state = 10; } else { - int bl = truncate_float_to_s32(gait_data->anim[6]->transition_position_span * 0.25f / - (speed / gait_data->anim[6]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[6]->f40 + - gait_data->anim[6]->transition_position_span * 0.125f - - gait_data->anim[6]->animation_position_origin) % + int bl = + truncate_float_to_s32(gait_data->anim[6]->transition_position_span * + 0.25f / (speed / gait_data->anim[6]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[6]->f40 + + gait_data->anim[6]->transition_position_span * 0.125f - + gait_data->anim[6]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[6]->f10); WalkAnim *a = gait_data->anim[6]; int f = find_nearest_animation_sequence_entry( @@ -678,11 +741,14 @@ 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) { - int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[1]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[1]->alternate_phase_anchor_position + - gait_data->anim[1]->alternate_transition_position_span * 0.125f - - gait_data->anim[1]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[1]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[1]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[1]->alternate_phase_anchor_position + + gait_data->anim[1]->alternate_transition_position_span * + 0.125f - + gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; int f = find_nearest_animation_sequence_entry( @@ -696,11 +762,14 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_state = 11; } else { - int bl = truncate_float_to_s32(gait_data->anim[6]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[6]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[6]->alternate_phase_anchor_position + - gait_data->anim[6]->alternate_transition_position_span * 0.125f - - gait_data->anim[6]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[6]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[6]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[6]->alternate_phase_anchor_position + + gait_data->anim[6]->alternate_transition_position_span * + 0.125f - + gait_data->anim[6]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[6]->f10); WalkAnim *a = gait_data->anim[6]; int f = find_nearest_animation_sequence_entry( @@ -716,11 +785,13 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(gait_data->ground_probe_correction_angle) > gait_data->terrain_transition_height_scale * 0.75f) { if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / - (speed / gait_data->anim[2]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + - gait_data->anim[2]->transition_position_span * 0.125f - - gait_data->anim[2]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[2]->transition_position_span * 0.25f / + (speed / gait_data->anim[2]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[2]->f40 + + gait_data->anim[2]->transition_position_span * 0.125f - + gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; int f = find_nearest_animation_sequence_entry( @@ -729,12 +800,16 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->gait_state = 3; } else { - int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[1]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[1]->alternate_phase_anchor_position + - gait_data->anim[1]->alternate_transition_position_span * 0.125f - - gait_data->anim[1]->animation_position_origin) % - truncate_float_to_s32(gait_data->anim[1]->f10); + int bl = truncate_float_to_s32( + gait_data->anim[1]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[1]->f08)); + int fr = + truncate_float_to_s32( + gait_data->anim[1]->alternate_phase_anchor_position + + gait_data->anim[1]->alternate_transition_position_span * + 0.125f - + gait_data->anim[1]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; int f = find_nearest_animation_sequence_entry( walker_moby->pClass->seqs[a->id], (float)fr); @@ -747,11 +822,13 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(gait_data->ground_probe_correction_angle) > -gait_data->terrain_transition_height_scale * 0.75f) { if (flags & 1) { - int bl = truncate_float_to_s32(gait_data->anim[4]->transition_position_span * 0.25f / - (speed / gait_data->anim[4]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[4]->f40 + - gait_data->anim[4]->transition_position_span * 0.125f - - gait_data->anim[4]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[4]->transition_position_span * 0.25f / + (speed / gait_data->anim[4]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[4]->f40 + + gait_data->anim[4]->transition_position_span * 0.125f - + gait_data->anim[4]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[4]->f10); WalkAnim *a = gait_data->anim[4]; int f = find_nearest_animation_sequence_entry( @@ -760,12 +837,16 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->gait_state = 10; } else { - int bl = truncate_float_to_s32(gait_data->anim[5]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[5]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[5]->alternate_phase_anchor_position + - gait_data->anim[5]->alternate_transition_position_span * 0.125f - - gait_data->anim[5]->animation_position_origin) % - truncate_float_to_s32(gait_data->anim[5]->f10); + int bl = truncate_float_to_s32( + gait_data->anim[5]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[5]->f08)); + int fr = + truncate_float_to_s32( + gait_data->anim[5]->alternate_phase_anchor_position + + gait_data->anim[5]->alternate_transition_position_span * + 0.125f - + gait_data->anim[5]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[5]->f10); WalkAnim *a = gait_data->anim[5]; int f = find_nearest_animation_sequence_entry( walker_moby->pClass->seqs[a->id], (float)fr); @@ -780,11 +861,14 @@ 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) { - int bl = truncate_float_to_s32(gait_data->anim[1]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[1]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[1]->alternate_phase_anchor_position + - gait_data->anim[1]->alternate_transition_position_span * 0.125f - - gait_data->anim[1]->animation_position_origin) % + int bl = truncate_float_to_s32( + gait_data->anim[1]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[1]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[1]->alternate_phase_anchor_position + + gait_data->anim[1]->alternate_transition_position_span * + 0.125f - + gait_data->anim[1]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[1]->f10); WalkAnim *a = gait_data->anim[1]; int f = find_nearest_animation_sequence_entry( @@ -798,12 +882,15 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_state = 7; } else { - int bl = truncate_float_to_s32(gait_data->anim[0]->alternate_transition_position_span / - (speed / gait_data->anim[0]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[0]->alternate_phase_anchor_position + - gait_data->anim[0]->alternate_transition_position_span * 0.5f - - gait_data->anim[0]->animation_position_origin) % - truncate_float_to_s32(gait_data->anim[0]->f10); + int bl = truncate_float_to_s32( + gait_data->anim[0]->alternate_transition_position_span / + (speed / gait_data->anim[0]->f08)); + int fr = + truncate_float_to_s32( + gait_data->anim[0]->alternate_phase_anchor_position + + gait_data->anim[0]->alternate_transition_position_span * 0.5f - + gait_data->anim[0]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; int f = find_nearest_animation_sequence_entry( walker_moby->pClass->seqs[a->id], (float)fr); @@ -817,11 +904,13 @@ 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) { - int bl = truncate_float_to_s32(gait_data->anim[2]->transition_position_span * 0.25f / - (speed / gait_data->anim[2]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[2]->f40 + - gait_data->anim[2]->transition_position_span * 0.125f - - gait_data->anim[2]->animation_position_origin) % + int bl = + truncate_float_to_s32(gait_data->anim[2]->transition_position_span * + 0.25f / (speed / gait_data->anim[2]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[2]->f40 + + gait_data->anim[2]->transition_position_span * 0.125f - + gait_data->anim[2]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[2]->f10); WalkAnim *a = gait_data->anim[2]; int f = find_nearest_animation_sequence_entry( @@ -835,11 +924,13 @@ void walker_update_gait(WalkMoby *walker_moby, -gait_data->terrain_transition_height_scale * 0.75f) { gait_data->gait_state = 8; } else { - int bl = truncate_float_to_s32(gait_data->anim[0]->transition_position_span / - (speed / gait_data->anim[0]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[0]->f40 + - gait_data->anim[0]->transition_position_span * 0.5f - - gait_data->anim[0]->animation_position_origin) % + int bl = + truncate_float_to_s32(gait_data->anim[0]->transition_position_span / + (speed / gait_data->anim[0]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[0]->f40 + + gait_data->anim[0]->transition_position_span * 0.5f - + gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); WalkAnim *a = gait_data->anim[0]; int f = find_nearest_animation_sequence_entry( @@ -861,12 +952,16 @@ void walker_update_gait(WalkMoby *walker_moby, if (speed < t && gait_data->gait_speed_reference <= t) { int fr; if (gait_data->gait_phase_mask & 3) { - fr = truncate_float_to_s32(gait_data->anim[0]->transition_position_span * 2.0f / 3.0f + - gait_data->anim[0]->f40 - gait_data->anim[0]->animation_position_origin) % + fr = truncate_float_to_s32(gait_data->anim[0]->transition_position_span * 2.0f / + 3.0f + + gait_data->anim[0]->f40 - + gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); } else { - fr = truncate_float_to_s32(gait_data->anim[0]->alternate_transition_position_span * 2.0f / 3.0f + - gait_data->anim[0]->alternate_phase_anchor_position - gait_data->anim[0]->animation_position_origin) % + fr = truncate_float_to_s32( + gait_data->anim[0]->alternate_transition_position_span * 2.0f / 3.0f + + gait_data->anim[0]->alternate_phase_anchor_position - + gait_data->anim[0]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[0]->f10); } { @@ -883,11 +978,13 @@ void walker_update_gait(WalkMoby *walker_moby, 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) { - int bl = truncate_float_to_s32(gait_data->anim[11]->transition_position_span * 0.25f / - (speed / gait_data->anim[11]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[11]->f40 + - gait_data->anim[11]->transition_position_span * 0.125f - - gait_data->anim[11]->animation_position_origin) % + int bl = + truncate_float_to_s32(gait_data->anim[11]->transition_position_span * + 0.25f / (speed / gait_data->anim[11]->f08)); + int fr = truncate_float_to_s32( + gait_data->anim[11]->f40 + + gait_data->anim[11]->transition_position_span * 0.125f - + gait_data->anim[11]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[11]->f10); WalkAnim *a = gait_data->anim[11]; int f = find_nearest_animation_sequence_entry( @@ -896,12 +993,15 @@ void walker_update_gait(WalkMoby *walker_moby, reset_walker_gait_helpers((char *)gait_data); gait_data->gait_state = 0xF; } else { - int bl = truncate_float_to_s32(gait_data->anim[9]->alternate_transition_position_span * 0.25f / - (speed / gait_data->anim[9]->f08)); - int fr = truncate_float_to_s32(gait_data->anim[9]->alternate_phase_anchor_position + - gait_data->anim[9]->alternate_transition_position_span * 0.125f - - gait_data->anim[9]->animation_position_origin) % - truncate_float_to_s32(gait_data->anim[9]->f10); + int bl = truncate_float_to_s32( + gait_data->anim[9]->alternate_transition_position_span * 0.25f / + (speed / gait_data->anim[9]->f08)); + int fr = + truncate_float_to_s32( + gait_data->anim[9]->alternate_phase_anchor_position + + gait_data->anim[9]->alternate_transition_position_span * 0.125f - + gait_data->anim[9]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[9]->f10); WalkAnim *a = gait_data->anim[9]; int f = find_nearest_animation_sequence_entry( walker_moby->pClass->seqs[a->id], (float)fr); @@ -916,12 +1016,17 @@ void walker_update_gait(WalkMoby *walker_moby, fast_sin(movement_heading) * gait_data->anim[0]->f04 * 0.5f; ground_probe_position[2] = 0.0f; if (flags & 1) { - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); + fast_vec_add(ground_probe_position, + ground_probe_position, + gait_data->ground_probe_anchor_record); } else { - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->alternate_ground_probe_anchor_record); + fast_vec_add(ground_probe_position, + ground_probe_position, + gait_data->alternate_ground_probe_anchor_record); } ground_probe_position[2] += 1.0f; - gait_data->gait_ground_height_reference = probe_ground_height(ground_probe_position, 0, 0.5f); + gait_data->gait_ground_height_reference = + probe_ground_height(ground_probe_position, 0, 0.5f); } } } @@ -939,20 +1044,27 @@ void walker_update_gait(WalkMoby *walker_moby, if (flags & 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 = FUN_L00_0025abf0( - walker_moby->pos, gait_data->jump_target_position, 0, gait_data->gait_speed_reference, -gait_data->downward_vertical_acceleration); + gait_data->jump_vertical_velocity = + FUN_L00_0025abf0(walker_moby->pos, + gait_data->jump_target_position, + 0, + gait_data->gait_speed_reference, + -gait_data->downward_vertical_acceleration); gait_data->gait_status_flags |= 4; gait_data->f6C = fast_arc_tan(gait_data->jump_target_position[0] - walker_moby->pos[0], gait_data->jump_target_position[1] - walker_moby->pos[1]); } if (compute_interpolated_record_value(walker_moby) >= - gait_data->anim[11]->animation_position_origin + gait_data->anim[11]->f10 - walker_moby->animation_playback_rate) { + gait_data->anim[11]->animation_position_origin + gait_data->anim[11]->f10 - + 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; } 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 - gait_data->anim[12]->animation_position_origin) * 2.0f; + float len = (gait_data->anim[12]->alternate_phase_anchor_position - + gait_data->anim[12]->animation_position_origin) * + 2.0f; if (t < len + 15.0f) { int bl = truncate_float_to_s32(t - len) >> 1; WalkAnim *a; @@ -972,20 +1084,27 @@ void walker_update_gait(WalkMoby *walker_moby, if (flags & 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 = FUN_L00_0025abf0( - walker_moby->pos, gait_data->jump_target_position, 0, gait_data->gait_speed_reference, -gait_data->downward_vertical_acceleration); + gait_data->jump_vertical_velocity = + FUN_L00_0025abf0(walker_moby->pos, + gait_data->jump_target_position, + 0, + gait_data->gait_speed_reference, + -gait_data->downward_vertical_acceleration); gait_data->gait_status_flags |= 4; gait_data->f6C = fast_arc_tan(gait_data->jump_target_position[0] - walker_moby->pos[0], gait_data->jump_target_position[1] - walker_moby->pos[1]); } if (compute_interpolated_record_value(walker_moby) >= - gait_data->anim[9]->animation_position_origin + gait_data->anim[9]->f10 - walker_moby->animation_playback_rate) { + gait_data->anim[9]->animation_position_origin + gait_data->anim[9]->f10 - + 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; } 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 - gait_data->anim[10]->animation_position_origin) * 2.0f; + float len = (gait_data->anim[10]->alternate_phase_anchor_position - + gait_data->anim[10]->animation_position_origin) * + 2.0f; if (t < len + 15.0f) { int bl = truncate_float_to_s32(t - len) >> 1; WalkAnim *a; @@ -1004,7 +1123,9 @@ void walker_update_gait(WalkMoby *walker_moby, case WALKER_GAIT_WAIT_FOR_LANDING: if (walker_moby->b52 == gait_data->airborne_wait_animation_id) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); - float len = (gait_data->anim[12]->alternate_phase_anchor_position - gait_data->anim[12]->animation_position_origin) * 2.0f; + float len = (gait_data->anim[12]->alternate_phase_anchor_position - + gait_data->anim[12]->animation_position_origin) * + 2.0f; if (t < len + 15.0f) { int bl = truncate_float_to_s32(t - len) >> 1; WalkAnim *a = gait_data->anim[12]; @@ -1020,15 +1141,19 @@ void walker_update_gait(WalkMoby *walker_moby, if (walker_moby->b52 == gait_data->anim[12]->id) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); if (t > 1.0f) { - float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; - t = gait_data->anim[12]->alternate_phase_anchor_position + 2.0f - t * 0.5f - gait_data->anim[12]->animation_position_origin; + float base = convert_integer_to_float(walker_moby->animation_entry_index) + + walker_moby->animation_interpolation_fraction; + t = gait_data->anim[12]->alternate_phase_anchor_position + 2.0f - t * 0.5f - + gait_data->anim[12]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } walker_moby->animation_playback_rate = frame_scale_inv * (t - base); } else { - float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; - t = gait_data->anim[12]->alternate_phase_anchor_position - gait_data->anim[12]->animation_position_origin; + float base = convert_integer_to_float(walker_moby->animation_entry_index) + + walker_moby->animation_interpolation_fraction; + t = gait_data->anim[12]->alternate_phase_anchor_position - + gait_data->anim[12]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } @@ -1047,15 +1172,19 @@ void walker_update_gait(WalkMoby *walker_moby, if (walker_moby->b52 == gait_data->anim[10]->id) { float t = compute_walker_time_to_landing((char *)walker_moby, (char *)gait_data); if (t > 1.0f) { - float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; - t = gait_data->anim[10]->alternate_phase_anchor_position + 2.0f - t * 0.5f - gait_data->anim[10]->animation_position_origin; + float base = convert_integer_to_float(walker_moby->animation_entry_index) + + walker_moby->animation_interpolation_fraction; + t = gait_data->anim[10]->alternate_phase_anchor_position + 2.0f - t * 0.5f - + gait_data->anim[10]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } walker_moby->animation_playback_rate = frame_scale_inv * (t - base); } else { - float base = convert_integer_to_float(walker_moby->animation_entry_index) + walker_moby->animation_interpolation_fraction; - t = gait_data->anim[10]->alternate_phase_anchor_position - gait_data->anim[10]->animation_position_origin; + float base = convert_integer_to_float(walker_moby->animation_entry_index) + + walker_moby->animation_interpolation_fraction; + t = gait_data->anim[10]->alternate_phase_anchor_position - + gait_data->anim[10]->animation_position_origin; if (t < base + 0.1f) { t = base + 0.1f; } @@ -1072,12 +1201,13 @@ void walker_update_gait(WalkMoby *walker_moby, break; case WALKER_GAIT_RESUME_RUN_AFTER_LANDING: if (flags & 1) { - int bl = truncate_float_to_s32((gait_data->anim[7]->transition_position_span * 0.25f + 2.0f) / - (speed / gait_data->anim[7]->f08)); - int fr = - truncate_float_to_s32(gait_data->anim[7]->f40 + 1.0f + - gait_data->anim[7]->transition_position_span * 0.125f - gait_data->anim[7]->animation_position_origin) % - truncate_float_to_s32(gait_data->anim[7]->f10); + int bl = truncate_float_to_s32( + (gait_data->anim[7]->transition_position_span * 0.25f + 2.0f) / + (speed / gait_data->anim[7]->f08)); + int fr = truncate_float_to_s32(gait_data->anim[7]->f40 + 1.0f + + gait_data->anim[7]->transition_position_span * 0.125f - + gait_data->anim[7]->animation_position_origin) % + truncate_float_to_s32(gait_data->anim[7]->f10); WalkAnim *a = gait_data->anim[7]; int f = find_nearest_animation_sequence_entry(walker_moby->pClass->seqs[a->id], (float)fr); @@ -1090,18 +1220,23 @@ void walker_update_gait(WalkMoby *walker_moby, ground_probe_position[0] = fast_cos(movement_heading) * gait_data->anim[7]->f04 * 0.5f; ground_probe_position[1] = fast_sin(movement_heading) * gait_data->anim[7]->f04 * 0.5f; ground_probe_position[2] = 0.0f; - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); + fast_vec_add(ground_probe_position, + ground_probe_position, + gait_data->ground_probe_anchor_record); ground_probe_position[2] += 1.0f; - gait_data->gait_ground_height_reference = probe_ground_height(ground_probe_position, 0, 0.5f); + gait_data->gait_ground_height_reference = + probe_ground_height(ground_probe_position, 0, 0.5f); } break; case WALKER_GAIT_RESUME_RUN_AFTER_ALTERNATE_LANDING: if (flags & 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)); + int bl = truncate_float_to_s32( + (gait_data->anim[7]->alternate_transition_position_span * 0.25f + 2.0f) / + (speed / gait_data->anim[7]->f08)); int fr = truncate_float_to_s32(gait_data->anim[7]->alternate_phase_anchor_position + 1.0f + - gait_data->anim[7]->transition_position_span * 0.125f - gait_data->anim[7]->animation_position_origin) % + gait_data->anim[7]->transition_position_span * 0.125f - + gait_data->anim[7]->animation_position_origin) % truncate_float_to_s32(gait_data->anim[7]->f10); WalkAnim *a = gait_data->anim[7]; int f = @@ -1115,9 +1250,12 @@ void walker_update_gait(WalkMoby *walker_moby, ground_probe_position[0] = fast_cos(movement_heading) * gait_data->anim[7]->f04 * 0.5f; ground_probe_position[1] = fast_sin(movement_heading) * gait_data->anim[7]->f04 * 0.5f; ground_probe_position[2] = 0.0f; - fast_vec_add(ground_probe_position, ground_probe_position, gait_data->ground_probe_anchor_record); + fast_vec_add(ground_probe_position, + ground_probe_position, + gait_data->ground_probe_anchor_record); ground_probe_position[2] += 1.0f; - gait_data->gait_ground_height_reference = probe_ground_height(ground_probe_position, 0, 0.5f); + gait_data->gait_ground_height_reference = + probe_ground_height(ground_probe_position, 0, 0.5f); } break; } 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 b2ac21c4d8..8c49dd75b1 100644 --- a/src/overlays/shared/game/initialize_level_transition_with_audio.c +++ b/src/overlays/shared/game/initialize_level_transition_with_audio.c @@ -269,7 +269,8 @@ void prepare_target_level_transition(s32 target_level_index) { shared_table_offset = D_L00_001611CC - 0x60000; shared_result_record = &D_L00_0016C860_0028ed58; shared_result_record->i58 = D_L00_00173E00_0028ed58.i4 + shared_table_offset; - shared_result_record->i5C = D_L00_00173E00_0028ed58.default_scene_chunk_offset + shared_table_offset; + shared_result_record->i5C = + D_L00_00173E00_0028ed58.default_scene_chunk_offset + shared_table_offset; D_L00_001611CC = shared_table_offset; if (current_level_index == target_level_index) { s32 divisor; @@ -277,9 +278,11 @@ void prepare_target_level_transition(s32 target_level_index) { divisor = pal_mode ? 0x50 : 0x60; shared_result_record->scaled_sequence_position = scale_game_frames(transition_sequence_positions[shared_state_record->h26]); - shared_result_record->sequence_entry_index = shared_result_record->scaled_sequence_position / divisor; + shared_result_record->sequence_entry_index = + shared_result_record->scaled_sequence_position / divisor; parse_space_scene_chunk(shared_result_record->sequence_entry_index); - shared_result_record->sequence_position_remainder = shared_result_record->scaled_sequence_position % divisor; + shared_result_record->sequence_position_remainder = + shared_result_record->scaled_sequence_position % divisor; } else { memcard_save_data(0, target_level_index); D_L00_0015F5C0 = target_level_index; diff --git a/src/overlays/shared/game/run_level_main_loop.c b/src/overlays/shared/game/run_level_main_loop.c index 2b1a7eb07c..0eac06c95f 100644 --- a/src/overlays/shared/game/run_level_main_loop.c +++ b/src/overlays/shared/game/run_level_main_loop.c @@ -411,7 +411,8 @@ void initialize_level_map_archive(void) { for (i = 0; i < 20; i++) { D_L00_001841F0.unk104[i] = map_parameter_pair_defaults[i * 2]; D_L00_001841F0.unkB4[i] = 0.65f; - D_L00_001841F0.map_parameter_pair_second_values[i] = map_parameter_pair_defaults[i * 2 + 1]; + D_L00_001841F0.map_parameter_pair_second_values[i] = + map_parameter_pair_defaults[i * 2 + 1]; } } level = current_level_index; diff --git a/src/overlays/shared/hero/hero_idle_sequence.c b/src/overlays/shared/hero/hero_idle_sequence.c index e15912df9b..e8902e8a03 100644 --- a/src/overlays/shared/hero/hero_idle_sequence.c +++ b/src/overlays/shared/hero/hero_idle_sequence.c @@ -1653,7 +1653,10 @@ void draw_hero_glow_quads(void) { mode = D_L00_0015F5C4; if (mode == 2 || 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], P.queued_glow_quad_scales[i], P.queued_glow_position_offset_scales[i]); + draw_offset_textured_effect_quad(&P.queued_glow_positions[i], + P.queued_glow_colors[i], + P.queued_glow_quad_scales[i], + P.queued_glow_position_offset_scales[i]); return; } vehicle_mode = P.b20A4; @@ -1668,13 +1671,18 @@ void draw_hero_glow_quads(void) { return; } if (vehicle_mode == HERO_VEHICLE_MODE_ON_FOOT) { - if ((hero_slot_item_id(3) == 3 || hero_slot_item_id(3) == 2) && P.on_foot_single_glow_suppressed == 0) { + if ((hero_slot_item_id(3) == 3 || hero_slot_item_id(3) == 2) && + P.on_foot_single_glow_suppressed == 0) { P.single_point_glow_position.f[2] += 0.015f; - draw_offset_textured_effect_quad(&P.single_point_glow_position, 0x280000C0, 0.057f, 0.08f); + draw_offset_textured_effect_quad( + &P.single_point_glow_position, 0x280000C0, 0.057f, 0.08f); P.single_point_glow_position.f[2] -= 0.015f; } for (i = 0; i < P.queued_glow_count; i++) - draw_offset_textured_effect_quad(&P.queued_glow_positions[i], P.queued_glow_colors[i], P.queued_glow_quad_scales[i], P.queued_glow_position_offset_scales[i]); + draw_offset_textured_effect_quad(&P.queued_glow_positions[i], + P.queued_glow_colors[i], + P.queued_glow_quad_scales[i], + P.queued_glow_position_offset_scales[i]); return; } if (vehicle_mode == HERO_VEHICLE_MODE_GIANT_CLANK) { @@ -1694,7 +1702,8 @@ void draw_hero_glow_quads(void) { P.single_point_glow_position.f[2] -= 0.02f; } approach_value(&P.clank_glow_quad_scale, k, frame_scale * 0.003f); - draw_offset_textured_effect_quad(&P.single_point_glow_position, P.clank_glow_color, P.clank_glow_quad_scale, 0.08f); + draw_offset_textured_effect_quad( + &P.single_point_glow_position, P.clank_glow_color, P.clank_glow_quad_scale, 0.08f); } } @@ -2087,7 +2096,8 @@ void update_hero_moby_probed_height_bounds(void) { rotation_step = 0.052f; else if (rotation_step < -0.052f) rotation_step = -0.052f; - G.height_probe_downward_angle_radians = fast_add_rotations(G.height_probe_downward_angle_radians, rotation_step); + G.height_probe_downward_angle_radians = + fast_add_rotations(G.height_probe_downward_angle_radians, rotation_step); get_moby_light_direction(G.height_probe_moby, &v); planar_angle = fast_arc_tan(v.f[0], v.f[1]); planar_cosine = fast_cos(planar_angle); @@ -2764,7 +2774,8 @@ s32 probe_hero_forward_collision(f32 *hit_distance_xy_out, transform_hero_polar_offset_to_world(&probe_end, probe_end_radius, 0.0f, probe_z_offset); if (collision_line(&probe_start, &probe_end, 2, 0, 0)) { if (hit_distance_xy_out != 0) - *hit_distance_xy_out = vector_distance_xy(hero_state->hero_position_storage, D_L00_00173E60); + *hit_distance_xy_out = + vector_distance_xy(hero_state->hero_position_storage, D_L00_00173E60); return 1; } return 0; @@ -2896,13 +2907,16 @@ void update_hero_pitch_and_yaw_easing_targets(void) { } else { approach_value(&D_0015EE14, 0.92f, 0.05f); } - if (G.forward_drop_detected != 0 && 1.4f < G.forward_drop_probe_distance && 1.0f < G.forward_collision_distance_xy) { + if (G.forward_drop_detected != 0 && 1.4f < G.forward_drop_probe_distance && + 1.0f < G.forward_collision_distance_xy) { set_fourth_hero_easing_parameters(frame_scale_sq * 0.015f, frame_scale_sq * 0.3f); pitch_target_radians = G.forward_drop_probe_distance * 1.5f * DEG_TO_RAD + 0.19198622f; if (0.47123888f < pitch_target_radians) pitch_target_radians = 0.47123888f; - if ((1.0f - G.forward_drop_probe_clearance_offset) * 35.0f * DEG_TO_RAD < pitch_target_radians) - pitch_target_radians = (1.0f - G.forward_drop_probe_clearance_offset) * 35.0f * DEG_TO_RAD; + if ((1.0f - G.forward_drop_probe_clearance_offset) * 35.0f * DEG_TO_RAD < + pitch_target_radians) + pitch_target_radians = + (1.0f - G.forward_drop_probe_clearance_offset) * 35.0f * DEG_TO_RAD; hero_eases[3].rot_target.f[1] = pitch_target_radians; set_second_hero_easing_parameters(frame_scale_sq * 0.008f, frame_scale_sq * 0.3f); hero_eases[1].rot_target.f[1] = hero_eases[3].rot_target.f[1] * 0.7f; @@ -2917,17 +2931,22 @@ void update_hero_pitch_and_yaw_easing_targets(void) { return; if ((u32)(hero_animation_sequence_index - 1) < 2) { min_delay_frames = scale_game_frames(40); - G.idle_rotation_target_delay_frames = random_int_between(min_delay_frames, scale_game_frames(70)); + G.idle_rotation_target_delay_frames = + random_int_between(min_delay_frames, scale_game_frames(70)); } if (fast_dec_timer(&G.idle_rotation_target_delay_frames) != 0) { G.idle_pitch_target_radians = -random_float_between(-0.15707964f, 0.43633232f); G.idle_yaw_target_radians = randf_sym(0.34906584f, 0.99483764f); random_blend_factor = random_float_between(0.0f, 1.0f); - G.idle_rotation_easing_acceleration = interpolate_scalar_linear(0.015f, 0.007f, random_blend_factor); - G.idle_rotation_easing_max_speed = interpolate_scalar_linear(0.29f, 0.3f, random_blend_factor); + G.idle_rotation_easing_acceleration = + interpolate_scalar_linear(0.015f, 0.007f, random_blend_factor); + G.idle_rotation_easing_max_speed = + interpolate_scalar_linear(0.29f, 0.3f, random_blend_factor); min_delay_frames = scale_game_frames(90); - G.idle_rotation_target_delay_frames = random_int_between(min_delay_frames, scale_game_frames(200)); - G.idle_rotation_target_delay_frames += truncate_float_to_s32((f32)scale_game_frames(80) * random_blend_factor); + G.idle_rotation_target_delay_frames = + random_int_between(min_delay_frames, scale_game_frames(200)); + G.idle_rotation_target_delay_frames += + truncate_float_to_s32((f32)scale_game_frames(80) * random_blend_factor); } if ((u32) * (u8 *)((char *)G.p2080 + 0x53) - 1 < 2) { if (0.34906584f < G.idle_yaw_target_radians) @@ -2939,7 +2958,8 @@ void update_hero_pitch_and_yaw_easing_targets(void) { if (G.idle_pitch_target_radians < 0.0f) G.idle_pitch_target_radians = 0.0f; } - set_fourth_hero_easing_parameters(G.idle_rotation_easing_acceleration, G.idle_rotation_easing_max_speed); + set_fourth_hero_easing_parameters(G.idle_rotation_easing_acceleration, + G.idle_rotation_easing_max_speed); hero_eases[3].rot_target.f[2] = G.idle_yaw_target_radians; hero_eases[3].rot_target.f[1] = G.idle_pitch_target_radians; set_second_hero_easing_parameters(frame_scale_sq * 0.008f, frame_scale_sq * 0.3f); @@ -3446,7 +3466,8 @@ void apply_hero_selected_flags_and_state_transitions(void) { if (saved_flag_selector == 2) { if (P.h30C == 0 || P.f2DC < 0.3f) { P.b12E7 = 1; - if (P.b20A4 == 0 && P.slot_one_item_moby != 0 && *(s16 *)(P.slot_one_item_moby + 0xA6) == 0xAD) + if (P.b20A4 == 0 && P.slot_one_item_moby != 0 && + *(s16 *)(P.slot_one_item_moby + 0xA6) == 0xAD) P.h308 = 1; } } @@ -3486,7 +3507,8 @@ void apply_hero_selected_flags_and_state_transitions(void) { P.b12EE = 1; if (saved_flag_selector == 12) P.b12EA = 1; - if (P.idle_exit_transition_selected && P.i300 && P.i208C != 0x10 && P.i208C != 0x14 && P.i208C != 7) { + if (P.idle_exit_transition_selected && P.i300 && P.i208C != 0x10 && P.i208C != 0x14 && + P.i208C != 7) { target_state = HERO_STATE_VOICE_SLOT_CLEANUP_IDLE_EXIT; goto call; } @@ -3501,8 +3523,8 @@ void apply_hero_selected_flags_and_state_transitions(void) { target_state = HERO_STATE_DEATH_DESCENT; goto call; } - if (P.sink_transition_selected && P.i2084 != 0x7F && absolute_float(P.f2F0 - (P.f88 + 0.25f)) < 1.0f && - 0.0f < P.f2F0 - P.f88 && P.f108 < 0.0f) { + if (P.sink_transition_selected && P.i2084 != 0x7F && + absolute_float(P.f2F0 - (P.f88 + 0.25f)) < 1.0f && 0.0f < P.f2F0 - P.f88 && P.f108 < 0.0f) { exit_hero_vehicle_mode_if_mode_three(); target_state = HERO_STATE_SINK; goto call; @@ -3524,8 +3546,8 @@ void apply_hero_selected_flags_and_state_transitions(void) { target_state = HERO_STATE_JUMP_WITH_HEALTH_DAMAGE; goto call; } - if (P.respawn_wait_transition_selected && P.i2084 != 0x7B && absolute_float(P.f2F4 - (P.f88 + 0.25f)) < 1.0f && - 0.0f < P.f2F4 - P.f88 && P.f108 < 0.0f) { + if (P.respawn_wait_transition_selected && P.i2084 != 0x7B && + absolute_float(P.f2F4 - (P.f88 + 0.25f)) < 1.0f && 0.0f < P.f2F4 - P.f88 && P.f108 < 0.0f) { exit_hero_vehicle_mode_if_mode_three(); hero_set_state(0x7B, 1); } @@ -3670,7 +3692,8 @@ void check_ledge_grab(void) { if (!grabbable) return; } - ((Hero *)D_0013F450_20C568)->ledge_moby = (s32)(((Hit_20C568 *)((char *)D_L00_00173E40))->hit_moby); + ((Hero *)D_0013F450_20C568)->ledge_moby = + (s32)(((Hit_20C568 *)((char *)D_L00_00173E40))->hit_moby); if (((Hero *)D_0013F450_20C568)->motion.pos.f[2] + up < ((Hit_20C568 *)((char *)D_L00_00173E40))->v20[2]) return; diff --git a/src/overlays/shared/hero/hero_set_state.c b/src/overlays/shared/hero/hero_set_state.c index 6c429e80cf..581b3e1e7b 100644 --- a/src/overlays/shared/hero/hero_set_state.c +++ b/src/overlays/shared/hero/hero_set_state.c @@ -3195,7 +3195,8 @@ 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 || G.i20A0 == 0x11) { + if (G.i198 > 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, @@ -3220,8 +3221,12 @@ void update_hero_water_height_and_bobbing(void) { f32 target_height = G.water_surface_height_target; if (G.water_height_control_mode == WATER_HEIGHT_CONTROL_ALTERNATE_TARGET) target_height = G.alternate_water_height_target; - vendor_spring( - &G.smoothed_water_height, &G.water_height_spring_velocity, target_height, frame_scale_sq * 0.027f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&G.smoothed_water_height, + &G.water_height_spring_velocity, + target_height, + frame_scale_sq * 0.027f, + frame_scale_sq * 0.3f, + 0.0f); } G.water_adjusted_position_z = G.smoothed_water_height + -0.12f + G.water_bob_offset; } @@ -3376,9 +3381,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 == 1 || + D_0013F450_h228770.hero_current_state == 0x1E) && 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 == 1 || + D_0013F450_h228770.hero_current_state == 0x1E) && D_0013F450_h228770.current_state_elapsed_frames > scale_game_frames(0x14)) { launch_hero_wrench(); break; @@ -3393,18 +3400,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 || + 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) { + D_0013F450_h228770.hero_current_state == 0x2D || + D_0013F450_h228770.hero_current_state == 0x11) { 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 == 0xB || + D_0013F450_h228770.hero_current_state == 0xE) { t = scale_game_frames(0x12); } if (!pad_pressed_within(mask, t, 0)) { @@ -3412,7 +3423,8 @@ 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.f2DC > 0.57f)) { + (D_0013F450_h228770.hero_current_state == 8 && + D_0013F450_h228770.f2DC > 0.57f)) { if (D_0013F450_h228770.f5FC != 0) { break; } @@ -3482,9 +3494,12 @@ int process_hero_equipped_item_input(void) { if (D_0013F450_h228770.f30E != 0) { 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) { + 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) { if (pad_pressed_within(mask, t, 0) || ((controller_state.held & mask) && D_0013F450_h228770.f10B0 > scale_game_frames(0xF))) { @@ -3496,13 +3511,15 @@ int process_hero_equipped_item_input(void) { D_0013F450_h228770.swing_target_valid = 0; } } - if (D_0013F450_h228770.swing_target_valid != 0 && D_0013F450_h228770.grapple_entry_lockout == 0 && + if (D_0013F450_h228770.swing_target_valid != 0 && + D_0013F450_h228770.grapple_entry_lockout == 0 && D_0013F450_h228770.hero_current_state != 0x2C) { hero_set_state(0x2C, 1); break; } } - if (D_0013F450_h228770.grapple_target_valid != 0 && D_0013F450_h228770.grapple_entry_lockout == 0) { + if (D_0013F450_h228770.grapple_target_valid != 0 && + D_0013F450_h228770.grapple_entry_lockout == 0) { hero_set_state(0x24, 1); } } @@ -3532,7 +3549,8 @@ int process_hero_equipped_item_input(void) { D_0013F450_h228770.f22DC = 1; break; case ITEM_REMOTE_VENDOR: - if (D_0013F450_h228770.hero_control_mode < 3U || D_0013F450_h228770.hero_control_mode == 4 || + if (D_0013F450_h228770.hero_control_mode < 3U || + D_0013F450_h228770.hero_control_mode == 4 || D_0013F450_h228770.hero_control_mode == 5) { if (pad_pressed_within(mask, scale_game_frames(8), 0)) { open_vendor_menu(0); @@ -3540,9 +3558,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 || + 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) { PVar *equipped_item_vars; @@ -3562,9 +3583,10 @@ int process_hero_equipped_item_input(void) { } if (controller_state.held & mask) { if (!get_ammo(-1)) { - if (!voice_is_playing(D_0013F450_h228770.slot0_item_moby, equipped_item_vars->fC)) { - equipped_item_vars->fC = - allocate_voice_for_target_entry(0, 0, (int)D_0013F450_h228770.slot0_item_moby); + if (!voice_is_playing(D_0013F450_h228770.slot0_item_moby, + equipped_item_vars->fC)) { + equipped_item_vars->fC = allocate_voice_for_target_entry( + 0, 0, (int)D_0013F450_h228770.slot0_item_moby); } } } @@ -3575,9 +3597,12 @@ 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 || + 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)) { int t; @@ -3592,9 +3617,11 @@ 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 || + 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 && D_0013F450_h228770.f229C < 0.7f)) { + (D_0013F450_h228770.hero_control_mode == 1 && + D_0013F450_h228770.f229C < 0.7f)) { hero_set_state(0x23, 1); } else { start_equipped_item_animation(); @@ -3618,7 +3645,8 @@ int process_hero_equipped_item_input(void) { if (D_0013F450_h228770.slot0_item_moby != 0) { hero_set_state(0x20, 1); if (D_0013F450_h228770.slot0_item_moby != 0) { - allocate_voice_for_target_entry(0, 0, (int)D_0013F450_h228770.slot0_item_moby); + allocate_voice_for_target_entry( + 0, 0, (int)D_0013F450_h228770.slot0_item_moby); } } } @@ -3639,8 +3667,10 @@ int process_hero_equipped_item_input(void) { 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) && + 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.f300 != 0)) { if ((controller_state.held & 8) && (controller_state.pressed & 8)) { hero_set_state(0x81, 1); @@ -3650,8 +3680,10 @@ int process_hero_equipped_item_input(void) { if ((controller_state.pressed & 8) && D_0013F450_h228770.hero_current_state != 0x81) { 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 != 0x13 && + D_0013F450_h228770.hero_current_state != 0x81 && + D_0013F450_h228770.hero_current_state != 0x15 && + D_0013F450_h228770.hero_current_state != 0x16) { D_0013F450_h228770.f22CA = 0; } } 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 cc37a8b358..8990ebb7d5 100644 --- a/src/overlays/shared/hero/process_hero_primary_item_input.c +++ b/src/overlays/shared/hero/process_hero_primary_item_input.c @@ -793,15 +793,17 @@ int process_hero_primary_item_input(void) { } } if ((*(Hero *)((char *)&hero)).state.control_mode == 6) { - HeroTableRow2C *wrench_attack_timing_record = &D_L05_0017C088[(*(Hero *)((char *)&hero)).attack_record]; - int window; + HeroTableRow2C *wrench_attack_timing_record = + &D_L05_0017C088[(*(Hero *)((char *)&hero)).attack_record]; + int window; if ((*(Hero *)((char *)&hero)).state.current == 0x15) { if ((*(Hero *)((char *)&hero)).state_timer > scale_game_frames(0x1E)) { if ((*(Hero *)((char *)&hero)).anim_changing != 0) { break; } - if ((*(Hero *)((char *)&hero)).anim_frame >= (float)wrench_attack_timing_record->f10 && + if ((*(Hero *)((char *)&hero)).anim_frame >= + (float)wrench_attack_timing_record->f10 && (controller_state.held & 0xA) && pad_pressed_within(mask, scale_game_frames(0xF), 0)) { hero_set_state(0x15, 1); @@ -812,10 +814,13 @@ int process_hero_primary_item_input(void) { if ((*(Hero *)((char *)&hero)).anim_changing != 0) { break; } - if (!((*(Hero *)((char *)&hero)).anim_frame >= (float)wrench_attack_timing_record->f10)) { + if (!((*(Hero *)((char *)&hero)).anim_frame >= + (float)wrench_attack_timing_record->f10)) { break; } - window = (truncate_float_to_s32((*(Hero *)((char *)&hero)).anim_frame) - wrench_attack_timing_record->fC) * 2; + window = (truncate_float_to_s32((*(Hero *)((char *)&hero)).anim_frame) - + wrench_attack_timing_record->fC) * + 2; if (window <= 0) { window = 1; } diff --git a/src/overlays/shared/hero/set_hero_animation.c b/src/overlays/shared/hero/set_hero_animation.c index 3bdba83bd4..25b7da41c1 100644 --- a/src/overlays/shared/hero/set_hero_animation.c +++ b/src/overlays/shared/hero/set_hero_animation.c @@ -1470,10 +1470,12 @@ void update_hero_attachment(void) { if (((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale == 0) { if (((Hero_234800 *)hero_233f80)->p2FC != 0) { mode = HERO_ATTACHMENT_MODE_PROBE; - if (((Hero_234800 *)hero_233f80)->attachment_reference_object != ((Hero_234800 *)hero_233f80)->p2FC) { + if (((Hero_234800 *)hero_233f80)->attachment_reference_object != + ((Hero_234800 *)hero_233f80)->p2FC) { ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; } - ((Hero_234800 *)hero_233f80)->attachment_reference_object = ((Hero_234800 *)hero_233f80)->p2FC; + ((Hero_234800 *)hero_233f80)->attachment_reference_object = + ((Hero_234800 *)hero_233f80)->p2FC; } else { ((Hero_234800 *)hero_233f80)->attachment_reference_object = 0; ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; @@ -1481,15 +1483,18 @@ void update_hero_attachment(void) { } } else if (((Hero_234800 *)hero_233f80)->i2084 == 0x1C && ((Hero_234800 *)hero_233f80)->p4F8 != 0) { - ((Hero_234800 *)hero_233f80)->attachment_reference_object = ((Hero_234800 *)hero_233f80)->p4F8; + ((Hero_234800 *)hero_233f80)->attachment_reference_object = + ((Hero_234800 *)hero_233f80)->p4F8; mode = HERO_ATTACHMENT_MODE_PROBE; } else if (((Hero_234800 *)hero_233f80)->i208C == 3 && ((Hero_234800 *)hero_233f80)->p4F8 != 0) { - ((Hero_234800 *)hero_233f80)->attachment_reference_object = ((Hero_234800 *)hero_233f80)->p4F8; + ((Hero_234800 *)hero_233f80)->attachment_reference_object = + ((Hero_234800 *)hero_233f80)->p4F8; mode = HERO_ATTACHMENT_MODE_PROBE; } else if (((Hero_234800 *)hero_233f80)->attachment_reference_object != 0) { mode = HERO_ATTACHMENT_MODE_PROBE; - convert_integer_to_float(scale_game_frames(120) - ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale); + convert_integer_to_float(scale_game_frames(120) - + ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale); scale_game_frames_v_233f80(120); amt = ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale; } else { @@ -1506,16 +1511,20 @@ void update_hero_attachment(void) { } if (((((Hero_234800 *)hero_233f80)->i208C == 0 || ((Hero_234800 *)hero_233f80)->i208C == 12) && fast_vec_length(&((Hero_234800 *)hero_233f80)->position_anchor_inhibit) == 0.0f && - ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale == 0 && ((Hero_234800 *)hero_233f80)->path_clearance_position_anchor_inhibit == 0) || + ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale == 0 && + ((Hero_234800 *)hero_233f80)->path_clearance_position_anchor_inhibit == 0) || (unsigned int)(((Hero_234800 *)hero_233f80)->i2084 - 0x18) < 2) { if ((((Hero_234800 *)hero_233f80)->attachment_anchor_flags ^ 1) & 1) { if ((unsigned int)(((Hero_234800 *)hero_233f80)->i2084 - 0x18) < 2) { - qcopy(&attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->ledge_grab_position); + qcopy(&attachment_motion_scratch, + &((Hero_234800 *)hero_233f80)->ledge_grab_position); attachment_motion_scratch.x += - fast_cos(fast_add_rotations(((Hero_234800 *)hero_233f80)->ledge_attachment_heading, 3.1415925f)) * + fast_cos(fast_add_rotations( + ((Hero_234800 *)hero_233f80)->ledge_attachment_heading, 3.1415925f)) * 0.45f; attachment_motion_scratch.y += - fast_sin(fast_add_rotations(((Hero_234800 *)hero_233f80)->ledge_attachment_heading, 3.1415925f)) * + fast_sin(fast_add_rotations( + ((Hero_234800 *)hero_233f80)->ledge_attachment_heading, 3.1415925f)) * 0.45f; attachment_motion_scratch.z -= -1.43f; probe_ground_height_cf(((Hero_234800 *)hero_233f80)->hero_moby, @@ -1530,25 +1539,28 @@ void update_hero_attachment(void) { &((Hero_234800 *)hero_233f80)->v90, &attachment_motion_scratch, &probe_transform_scratch); - convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, - ((Hero_234800 *)hero_233f80)->attachment_reference_object, - &((Hero_234800 *)hero_233f80)->ledge_grab_position, - &((Hero_234800 *)hero_233f80)->v90, - &((Hero_234800 *)hero_233f80)->primary_attachment_local_position, - &probe_transform_scratch); - convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, - ((Hero_234800 *)hero_233f80)->attachment_reference_object, - &attachment_motion_scratch, - &((Hero_234800 *)hero_233f80)->v90, - &((Hero_234800 *)hero_233f80)->secondary_attachment_local_position, - &probe_transform_scratch); + convert_pose_to_reference_local( + ((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, + &((Hero_234800 *)hero_233f80)->ledge_grab_position, + &((Hero_234800 *)hero_233f80)->v90, + &((Hero_234800 *)hero_233f80)->primary_attachment_local_position, + &probe_transform_scratch); + convert_pose_to_reference_local( + ((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, + &attachment_motion_scratch, + &((Hero_234800 *)hero_233f80)->v90, + &((Hero_234800 *)hero_233f80)->secondary_attachment_local_position, + &probe_transform_scratch); } else if (plat->attachment_behavior_flags & 4) { - convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, - ((Hero_234800 *)hero_233f80)->attachment_reference_object, - &((Hero_234800 *)hero_233f80)->pos, - &((Hero_234800 *)hero_233f80)->v90, - &((Hero_234800 *)hero_233f80)->primary_attachment_local_position, - &attachment_motion_scratch); + convert_pose_to_reference_local( + ((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, + &((Hero_234800 *)hero_233f80)->pos, + &((Hero_234800 *)hero_233f80)->v90, + &((Hero_234800 *)hero_233f80)->primary_attachment_local_position, + &attachment_motion_scratch); } else { probe_ground_height_cf(((Hero_234800 *)hero_233f80)->hero_moby, ((Hero_234800 *)hero_233f80)->attachment_reference_object, @@ -1556,12 +1568,13 @@ void update_hero_attachment(void) { &((Hero_234800 *)hero_233f80)->v90, &attachment_position_motion_scratch, &probe_transform_scratch); - convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, - ((Hero_234800 *)hero_233f80)->attachment_reference_object, - &attachment_position_motion_scratch, - &probe_transform_scratch, - &((Hero_234800 *)hero_233f80)->primary_attachment_local_position, - &attachment_motion_scratch); + convert_pose_to_reference_local( + ((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, + &attachment_position_motion_scratch, + &probe_transform_scratch, + &((Hero_234800 *)hero_233f80)->primary_attachment_local_position, + &attachment_motion_scratch); } ((Hero_234800 *)hero_233f80)->attachment_anchor_flags |= 1; } @@ -1569,14 +1582,16 @@ void update_hero_attachment(void) { ((Hero_234800 *)hero_233f80)->attachment_anchor_flags &= ~1; } if ((((Hero_234800 *)hero_233f80)->i208C == 0 || ((Hero_234800 *)hero_233f80)->i208C == 12) && - ((Hero_234800 *)hero_233f80)->rotation_anchor_inhibit == 0.0f && ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale == 0) { + ((Hero_234800 *)hero_233f80)->rotation_anchor_inhibit == 0.0f && + ((Hero_234800 *)hero_233f80)->attachment_residual_decay_scale == 0) { if (!(((Hero_234800 *)hero_233f80)->attachment_anchor_flags & 2)) { - convert_pose_to_reference_local(((Hero_234800 *)hero_233f80)->hero_moby, - ((Hero_234800 *)hero_233f80)->attachment_reference_object, - &((Hero_234800 *)hero_233f80)->pos, - &((Hero_234800 *)hero_233f80)->v90, - &attachment_motion_scratch, - &((Hero_234800 *)hero_233f80)->attachment_local_rotation); + convert_pose_to_reference_local( + ((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, + &((Hero_234800 *)hero_233f80)->pos, + &((Hero_234800 *)hero_233f80)->v90, + &attachment_motion_scratch, + &((Hero_234800 *)hero_233f80)->attachment_local_rotation); ((Hero_234800 *)hero_233f80)->attachment_anchor_flags |= 2; } } else { @@ -1593,11 +1608,13 @@ void update_hero_attachment(void) { if (!(plat->attachment_behavior_flags & 2)) { approach_value(&sB0, 0.0f, frame_time_sq_macro * 25.0f * amt); approach_value(&sB4, 0.0f, (frame_time_sq_macro + frame_time_sq_macro) * amt); - set_vector_length_xy( - &attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->saved_attachment_displacement, sB4); + set_vector_length_xy(&attachment_motion_scratch, + &((Hero_234800 *)hero_233f80)->saved_attachment_displacement, + sB4); attachment_motion_scratch.z = sB0; } else { - qcopy(&attachment_motion_scratch, &((Hero_234800 *)hero_233f80)->saved_attachment_displacement); + qcopy(&attachment_motion_scratch, + &((Hero_234800 *)hero_233f80)->saved_attachment_displacement); } qcopy(&attachment_position_motion_scratch, &attachment_motion_scratch); } else if (mode == HERO_ATTACHMENT_MODE_PROBE) { @@ -1624,12 +1641,13 @@ void update_hero_attachment(void) { &((Hero_234800 *)hero_233f80)->attachment_local_rotation, &primary_attachment_position, &primary_attachment_rotation); - transform_attachment_pose(((Hero_234800 *)hero_233f80)->hero_moby, - ((Hero_234800 *)hero_233f80)->attachment_reference_object, - &((Hero_234800 *)hero_233f80)->secondary_attachment_local_position, - &((Hero_234800 *)hero_233f80)->attachment_local_rotation, - &secondary_attachment_position, - &v90); + transform_attachment_pose( + ((Hero_234800 *)hero_233f80)->hero_moby, + ((Hero_234800 *)hero_233f80)->attachment_reference_object, + &((Hero_234800 *)hero_233f80)->secondary_attachment_local_position, + &((Hero_234800 *)hero_233f80)->attachment_local_rotation, + &secondary_attachment_position, + &v90); if ((((Hero_234800 *)hero_233f80)->i2084 == 1 || ((Hero_234800 *)hero_233f80)->i2084 == 0x1E) && ((Hero_234800 *)hero_233f80)->probe_yaw_override_enabled != 0) { diff --git a/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c b/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c index 3efb5b465d..df07a6f1e8 100644 --- a/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c +++ b/src/overlays/shared/hero/update_hero_and_vehicle_mode_effects.c @@ -424,7 +424,8 @@ void adjust_hero_planar_velocity_from_probes(int force) { P.i240 = X.i18; *(s32 *)&X.v40.f[2] = 0; sceVu0Normalize(&X.v40, &X.v40); - negative_xy_dot_product = -P.hero_velocity.f[0] * X.v40.f[0] - P.hero_velocity.f[1] * X.v40.f[1]; + negative_xy_dot_product = + -P.hero_velocity.f[0] * X.v40.f[0] - P.hero_velocity.f[1] * X.v40.f[1]; if (0.0f < negative_xy_dot_product) { fast_vec_scale(&X.v40, &X.v40, negative_xy_dot_product); FUN_001f9a10_20a328(&P.hero_velocity, &P.hero_velocity, &X.v40); 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 d3b0ce5813..9a35d79658 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 @@ -482,8 +482,10 @@ void adjust_hero_velocity_from_collision_probes(int force) { primary_vector_endpoint.f[0] = fast_cos(g->probe_heading_angle) * k; primary_vector_endpoint.f[1] = fast_sin(g->probe_heading_angle) * k; *(s32 *)&primary_vector_endpoint.f[2] = 0; - secondary_vector_endpoint.f[0] = fast_cos(g->probe_heading_angle) * k * secondary_vector_scale; - secondary_vector_endpoint.f[1] = fast_sin(g->probe_heading_angle) * k * secondary_vector_scale; + secondary_vector_endpoint.f[0] = + fast_cos(g->probe_heading_angle) * k * secondary_vector_scale; + secondary_vector_endpoint.f[1] = + fast_sin(g->probe_heading_angle) * k * secondary_vector_scale; *(s32 *)&secondary_vector_endpoint.f[2] = 0; } else { qcopy(&primary_vector_endpoint, vector_origin_base + 0x60); @@ -497,17 +499,20 @@ void adjust_hero_velocity_from_collision_probes(int force) { fast_vec_add(&primary_vector_endpoint, &primary_vector_endpoint, &primary_vector_origin); fast_vec_add(&secondary_vector_endpoint, &secondary_vector_endpoint, &b); r = -1; - if (collision_line(&b, &secondary_vector_endpoint, 4, P.collision_probe_moby, 0) && D_L06_001745DC > 0) + if (collision_line(&b, &secondary_vector_endpoint, 4, P.collision_probe_moby, 0) && + D_L06_001745DC > 0) r = collision_hit_material(); primary_probe_result_angle = 0.0f; - if (collision_line(&primary_vector_origin, &primary_vector_endpoint, 4, P.collision_probe_moby, 0) && + if (collision_line( + &primary_vector_origin, &primary_vector_endpoint, 4, P.collision_probe_moby, 0) && X.i1C > 0) primary_probe_result_angle = fast_arc_tan(X.v40.f[2], vector_length_xy(&X.v40)); if (0.8726646304130554f <= primary_probe_result_angle || r == 8 || r == 12) { P.velocity_probe_hit_moby = X.probe_collision_hit_moby; *(s32 *)&X.v40.f[2] = 0; sceVu0Normalize(&X.v40, &X.v40); - negative_horizontal_dot = -P.hero_velocity.f[0] * X.v40.f[0] - P.hero_velocity.f[1] * X.v40.f[1]; + negative_horizontal_dot = + -P.hero_velocity.f[0] * X.v40.f[0] - P.hero_velocity.f[1] * X.v40.f[1]; if (0.0f < negative_horizontal_dot) { fast_vec_scale(&X.v40, &X.v40, negative_horizontal_dot); fast_vec_add(&P.hero_velocity, &P.hero_velocity, &X.v40); diff --git a/src/overlays/shared/mobys/find_moby_hit.c b/src/overlays/shared/mobys/find_moby_hit.c index ba778ad781..23967bc20e 100644 --- a/src/overlays/shared/mobys/find_moby_hit.c +++ b/src/overlays/shared/mobys/find_moby_hit.c @@ -846,7 +846,8 @@ int update_arc_motion(O_25b440 *moving_object, S_25b440 *arc_motion_state) { if (moving_object->b52 != arc_motion_state->arc_entry_animation) { break; } - if (compute_interpolated_record_value(moving_object) <= arc_motion_state->arc_entry_record_value_threshold) { + if (compute_interpolated_record_value(moving_object) <= + arc_motion_state->arc_entry_record_value_threshold) { break; } if (moving_object->b70 & 2) { diff --git a/src/overlays/shared/pickups/bolt.c b/src/overlays/shared/pickups/bolt.c index 719d7beca8..1295dab330 100644 --- a/src/overlays/shared/pickups/bolt.c +++ b/src/overlays/shared/pickups/bolt.c @@ -63,11 +63,11 @@ typedef struct Bolt { u8 pad21[3]; BoltClass *pclass; /* 0x24 */ u8 pad28[4]; - f32 scale; /* 0x2C */ - u8 unk30; /* 0x30 */ - u8 is_visible; /* 0x31 */ + f32 scale; /* 0x2C */ + u8 unk30; /* 0x30 */ + u8 is_visible; /* 0x31 */ u16 draw_distance; /* 0x32 */ - u16 flags; /* 0x34 */ + u16 flags; /* 0x34 */ u8 pad36[0x3D]; u8 unk73; /* 0x73 */ u8 pad74[4]; diff --git a/src/overlays/shared/pickups/crate.c b/src/overlays/shared/pickups/crate.c index 49dfd3a08a..be3eb8a194 100644 --- a/src/overlays/shared/pickups/crate.c +++ b/src/overlays/shared/pickups/crate.c @@ -414,7 +414,8 @@ void crate_update(struct Moby *moby) { burst.unk20 = 0; fast_vec_normalize(&at, &moby->rot_row2, 0.5f); add_vector_xyz(&at, &at, &moby->pos); - burst_radius_scale = convert_integer_to_float(crate_vars->burst_frame) / scale_time(20.0f); + burst_radius_scale = + convert_integer_to_float(crate_vars->burst_frame) / scale_time(20.0f); burst.unk14 = 1; collect_mobies_in_sphere( burst_radius_scale + burst_radius_scale, &at, 0x10, moby, &burst); @@ -1299,7 +1300,9 @@ void update_crate_stack_motion(M2d1428 *moby) { if (vars->path) { if (vars->parent == 0) { vars->vel.w -= acceleration_scale_or_speed * 10.0f; - if (approach_value(&vars->attachment_stack_z_offset, 0.0f, absolute_float(vars->vel.w)) == 0.0f) + if (approach_value(&vars->attachment_stack_z_offset, + 0.0f, + absolute_float(vars->vel.w)) == 0.0f) vars->vel.w = 0.0f; } else { vars->vel.w -= acceleration_scale_or_speed * 10.0f; @@ -1314,8 +1317,12 @@ void update_crate_stack_motion(M2d1428 *moby) { moby->h36 = 0x7F80; qcopy(&previous_position, &moby->pos); qcopy(&previous_rotation, &moby->v40); - transform_attachment_pose( - moby, vars->path, &adjusted_link_position, vars->attachment_rotation, &moby->pos, &moby->v40); + transform_attachment_pose(moby, + vars->path, + &adjusted_link_position, + vars->attachment_rotation, + &moby->pos, + &moby->v40); if (FUN_L00_002603d0(vars->path)->flags & 4) { qcopy(&vars->attachment_position, &adjusted_link_position); vars->attachment_position.z -= vars->attachment_stack_z_offset; diff --git a/src/overlays/shared/pickups/infobot.c b/src/overlays/shared/pickups/infobot.c index 5d420da797..908e5417c0 100644 --- a/src/overlays/shared/pickups/infobot.c +++ b/src/overlays/shared/pickups/infobot.c @@ -249,13 +249,21 @@ void update_infobot_slot_path_motion(Obj *moby, Path_2d5988 *path, s32 arrival_s target_yaw_or_movement_yaw_offset = fast_arc_tan(path->a[path_segment_index + 1].f[0] - moby->v[0], path->a[path_segment_index + 1].f[1] - moby->v[1]); - moby->f48 = - turn_f(&st->rotation_z_turn_step, moby->f48, target_yaw_or_movement_yaw_offset, 0.01f, 0.3f, 0.1f); + moby->f48 = turn_f(&st->rotation_z_turn_step, + moby->f48, + target_yaw_or_movement_yaw_offset, + 0.01f, + 0.3f, + 0.1f); } else { target_yaw_or_movement_yaw_offset = fast_arc_tan(hero.motion.pos.f[0] - moby->v[0], hero.motion.pos.f[1] - moby->v[1]); - moby->f48 = - turn_f(&st->rotation_z_turn_step, moby->f48, target_yaw_or_movement_yaw_offset, 0.01f, 0.3f, 0.1f); + moby->f48 = turn_f(&st->rotation_z_turn_step, + moby->f48, + target_yaw_or_movement_yaw_offset, + 0.01f, + 0.3f, + 0.1f); } fast_vec_sub(&v, &path_target_point, &moby->v[0]); endpoint_distance_or_step_length = FUN_001f9af0_2d5988(&v); @@ -267,10 +275,10 @@ void update_infobot_slot_path_motion(Obj *moby, Path_2d5988 *path, s32 arrival_s fast_subtract_rotations(fast_arc_tan(v.f[0], v.f[1]), moby->f48); { f32 xa, xb; - xa = st->slot_path_speed * 0.34906584f * FUN_001f9dc8_2d5988(target_yaw_or_movement_yaw_offset) / - (frame_time * 16.0f); - xb = st->slot_path_speed * -0.34906584f * FUN_001f9de0_2d5988(target_yaw_or_movement_yaw_offset) / - (frame_time * 16.0f); + xa = st->slot_path_speed * 0.34906584f * + FUN_001f9dc8_2d5988(target_yaw_or_movement_yaw_offset) / (frame_time * 16.0f); + xb = st->slot_path_speed * -0.34906584f * + FUN_001f9de0_2d5988(target_yaw_or_movement_yaw_offset) / (frame_time * 16.0f); { f32 updated_rotation_y, k70; updated_rotation_y = turn_f(&st->rotation_y_turn_step, diff --git a/src/overlays/shared/pickups/nanotech_ball.c b/src/overlays/shared/pickups/nanotech_ball.c index 869d60ebd1..2360ffd052 100644 --- a/src/overlays/shared/pickups/nanotech_ball.c +++ b/src/overlays/shared/pickups/nanotech_ball.c @@ -1353,7 +1353,8 @@ void nanotech_ball_update(Moby *moby) { max_hp = 4; if (moby->state != NANOTECH_BALL_STATE_FOLLOW_OWNER && D_L00_0015F63C != 0 && ((D_2D9EA0 *)D_L00_0015F63C->pvars) != 0 && player->health.hp != 0 && - (player->health.hp + ((D_2D9EA0 *)D_L00_0015F63C->pvars)->pending_collection_count < max_hp || + (player->health.hp + ((D_2D9EA0 *)D_L00_0015F63C->pvars)->pending_collection_count < + max_hp || (nanotech_ball_invulnerability_pickup_enabled != 0 && player->invulnerable_frames == 0)) && fast_vec_dist(&moby->pos, &player->motion.pos) < 10.0f && diff --git a/src/overlays/shared/props/particle_spawner_smoke_fire.c b/src/overlays/shared/props/particle_spawner_smoke_fire.c index 7bc601406b..6fae271448 100644 --- a/src/overlays/shared/props/particle_spawner_smoke_fire.c +++ b/src/overlays/shared/props/particle_spawner_smoke_fire.c @@ -325,7 +325,8 @@ void draw_smoke_fire_spawner(P *spawner) { if (l00_smoke_fire_particle_fade_in_timers[i]) { fast_dec_timer_s16(&l00_smoke_fire_particle_fade_in_timers[i]); alpha = truncate_float_to_s32( - (1.0f - convert_integer_to_float(l00_smoke_fire_particle_fade_in_timers[i]) * D_L00_00161384) * + (1.0f - convert_integer_to_float(l00_smoke_fire_particle_fade_in_timers[i]) * + D_L00_00161384) * D_L00_0016199C); } else if (D_L00_001D60A0[i]) { if (fast_dec_timer_s16(&D_L00_001D60A0[i])) { diff --git a/src/overlays/shared/props/pterodactyl.c b/src/overlays/shared/props/pterodactyl.c index 86e42626c0..ae63aba5e6 100644 --- a/src/overlays/shared/props/pterodactyl.c +++ b/src/overlays/shared/props/pterodactyl.c @@ -51,8 +51,10 @@ void pterodactyl_update(unsigned char *moby) { { float first_segment_length = fast_vec_dist(path + 4, path + 8); float first_to_last_distance = fast_vec_dist(path + 4, path + *path * 4); - moby_data->path_progress_increment = pterodactyl_path_speed_gp * frame_time / first_segment_length; - moby_data->path_loop_enabled = absolute_float(first_segment_length - first_to_last_distance) < 0.1f; + moby_data->path_progress_increment = + pterodactyl_path_speed_gp * frame_time / first_segment_length; + moby_data->path_loop_enabled = + absolute_float(first_segment_length - first_to_last_distance) < 0.1f; } moby_data->f6C = moby_data->f68 * (float)*path; MOBY(moby)->state = PTERODACTYL_FOLLOW_PATH; @@ -60,7 +62,8 @@ void pterodactyl_update(unsigned char *moby) { MOBY(moby)->update_dist = 0xFF; case PTERODACTYL_FOLLOW_PATH: y = MOBY(moby)->pos.z; - sample_camera_path(path, moby_data->f6C, moby_data->path_loop_enabled, &MOBY(moby)->pos, moby + 0x40, 0); + sample_camera_path( + path, moby_data->f6C, moby_data->path_loop_enabled, &MOBY(moby)->pos, moby + 0x40, 0); MOBY(moby)->rot.y *= 0.5f; MOBY(moby)->pos.z += moby_data->f64; moby_data->f6C += moby_data->path_progress_increment; diff --git a/src/overlays/shared/props/thruster_pack_lock.c b/src/overlays/shared/props/thruster_pack_lock.c index ee0300fe93..46bdfa1ff6 100644 --- a/src/overlays/shared/props/thruster_pack_lock.c +++ b/src/overlays/shared/props/thruster_pack_lock.c @@ -132,7 +132,8 @@ void thruster_pack_lock_update(Lock *moby) { if (current_level_index == 0xB && moby->activation_group != 0xFF) { int group; int group_index; - l11_thruster_pack_lock_activation_state.collected[(short)moby->uid] = moby->activation_group + 2; + l11_thruster_pack_lock_activation_state.collected[(short)moby->uid] = + moby->activation_group + 2; group = moby->activation_group; group_index = group & 0xFF; if (group == 0xFF || diff --git a/src/overlays/shared/rendering/build_interpolated_dma_packet.c b/src/overlays/shared/rendering/build_interpolated_dma_packet.c index 9defaac1c2..9dc3a0ca2d 100644 --- a/src/overlays/shared/rendering/build_interpolated_dma_packet.c +++ b/src/overlays/shared/rendering/build_interpolated_dma_packet.c @@ -139,10 +139,14 @@ void build_interpolated_dma_packet(QuadDrawArgs *draw_parameters) { long blend_mode; unsigned int alpha_limit; - textured_grid_saved_fog_near_distance = ((QuadCamera *)level02_camera_view_state)->fog_near_distance; - textured_grid_saved_fog_far_distance = ((QuadCamera *)level02_camera_view_state)->fog_far_distance; - textured_grid_saved_fog_near_intensity = ((QuadCamera *)level02_camera_view_state)->fog_near_intensity; - textured_grid_saved_fog_far_intensity = ((QuadCamera *)level02_camera_view_state)->fog_far_intensity; + textured_grid_saved_fog_near_distance = + ((QuadCamera *)level02_camera_view_state)->fog_near_distance; + textured_grid_saved_fog_far_distance = + ((QuadCamera *)level02_camera_view_state)->fog_far_distance; + textured_grid_saved_fog_near_intensity = + ((QuadCamera *)level02_camera_view_state)->fog_near_intensity; + textured_grid_saved_fog_far_intensity = + ((QuadCamera *)level02_camera_view_state)->fog_far_intensity; if (textured_grid_fog_source_mode != TEXTURED_GRID_FOG_SOURCE_CAMERA) { ((QuadCamera *)level02_camera_view_state)->fog_near_distance = draw_parameters->f20; ((QuadCamera *)level02_camera_view_state)->fog_far_distance = draw_parameters->f24; @@ -171,13 +175,16 @@ void build_interpolated_dma_packet(QuadDrawArgs *draw_parameters) { view_setup_dma_packet[0x28] = 0x8000; view_setup_dma_packet[0x29] = 0x303EC000; view_setup_dma_packet[0x2A] = 0x412; - *(float *)(view_setup_dma_packet + 0x2B) = ((QuadCamera *)level02_camera_view_state)->fog_depth_coefficient; + *(float *)(view_setup_dma_packet + 0x2B) = + ((QuadCamera *)level02_camera_view_state)->fog_depth_coefficient; cursor = view_setup_dma_packet + 0x2C; qcopy(cursor, ((QuadCamera *)level02_camera_view_state)->projection_and_fog_scale); cursor = view_setup_dma_packet + 0x30; qcopy(cursor, ((QuadCamera *)level02_camera_view_state)->projection_and_fog_offset); - *(float *)(view_setup_dma_packet + 0x34) = ((QuadCamera *)level02_camera_view_state)->fog_far_intensity; - *(float *)(view_setup_dma_packet + 0x35) = ((QuadCamera *)level02_camera_view_state)->fog_near_intensity; + *(float *)(view_setup_dma_packet + 0x34) = + ((QuadCamera *)level02_camera_view_state)->fog_far_intensity; + *(float *)(view_setup_dma_packet + 0x35) = + ((QuadCamera *)level02_camera_view_state)->fog_near_intensity; view_setup_dma_packet[0x36] = 0; view_setup_dma_packet[0x37] = 0; view_setup_dma_packet[0x38] = 0x03000000; diff --git a/src/overlays/shared/rendering/effects/particles.c b/src/overlays/shared/rendering/effects/particles.c index 9cd0fdf903..3785ce9c42 100644 --- a/src/overlays/shared/rendering/effects/particles.c +++ b/src/overlays/shared/rendering/effects/particles.c @@ -556,8 +556,12 @@ void update_timed_sphere_probed_particle(struct EffectParticle *particle) { int sphere_probe_result; previous_particle_position = *particle_position; particle_data->unk4 += particle_data->unk8; - path_sample_at_distance( - particle_data->particle_path_reference, &x, &y, particle_position, particle_data->unk4, particle_data->fc); + path_sample_at_distance(particle_data->particle_path_reference, + &x, + &y, + particle_position, + particle_data->unk4, + particle_data->fc); if (fast_dec_timer_s16(&particle->life)) { free_effect_particle(particle); return; @@ -570,8 +574,8 @@ void update_timed_sphere_probed_particle(struct EffectParticle *particle) { remaining_lifetime_frames * 0.08f / ((float)scale_game_frames(0x1E) * 0.25f)); } - sphere_probe_result = - collect_mobies_in_sphere(0.15f, particle_position, 0x10, particle_data->blast_source_moby, 0); + sphere_probe_result = collect_mobies_in_sphere( + 0.15f, particle_position, 0x10, particle_data->blast_source_moby, 0); position_copy = *particle_position; send_blast_hits(particle_data->blast_source_moby, (void *)&position_copy, @@ -1622,8 +1626,9 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { position_offset_scratch.x = particle->r.unk0; position_offset_scratch.y = r->unk4; position_offset_scratch.z = r->unk8; - fast_vec_scale( - &position_offset_scratch, &position_offset_scratch, convert_integer_to_float(r->position_offset_multiplier)); + fast_vec_scale(&position_offset_scratch, + &position_offset_scratch, + convert_integer_to_float(r->position_offset_multiplier)); fast_vec_add(particle->v10, r->iC + 0x10, &position_offset_scratch); return; } @@ -1638,7 +1643,8 @@ void update_mode_controlled_orbiting_trail_particle(M_274518 *particle) { } if (r->trail_particle_mode == TRAIL_PARTICLE_MODE_ORBITING_EMITTER) { z = 0.0f; - FUN_L00_002743a8_274518(0, particle->v10, scale_game_frames(10), z, z, 0, particle->particle_alpha, 0); + FUN_L00_002743a8_274518( + 0, particle->v10, scale_game_frames(10), z, z, 0, particle->particle_alpha, 0); } else { position_offset_scratch.x = r->unk0; position_offset_scratch.y = r->unk4; @@ -1698,8 +1704,8 @@ void update_randomized_moby_point_attached_particle(struct EffectParticle *parti u128 attachment_offset; float one, randomized_primary_position_w, save, x; char *attachment_position; - if (o == 0 || *(s16 *)(o + 0xA6) != attachment_data->expected_owner_identity || (u8)o[0x20] == 0xFE || - (u8)o[0x20] == 0xFD) { + if (o == 0 || *(s16 *)(o + 0xA6) != attachment_data->expected_owner_identity || + (u8)o[0x20] == 0xFE || (u8)o[0x20] == 0xFD) { free_effect_particle(particle); return; } @@ -1896,15 +1902,18 @@ void update_three_phase_motion_alpha_fade_particle(M_274e48 *particle) { distance_or_blend_factor = 1.0f; else if (distance_or_blend_factor < 0.0f) distance_or_blend_factor = 0.0f; - particle->packed_particle_color = FUN_001fa6e0_274e48(r->far_distance_color, r->iC, distance_or_blend_factor); + particle->packed_particle_color = + FUN_001fa6e0_274e48(r->far_distance_color, r->iC, distance_or_blend_factor); if (r->h10) { *(volatile s32 *)0x10000000 = 0; load_display_text_resource_entry(&applied_motion_delta, r); fast_vec_add(&particle->v10, &particle->v10, &applied_motion_delta); distance_or_blend_factor = convert_integer_to_float(particle->hA) / convert_integer_to_float(r->h10); - particle->packed_particle_color = FUN_001fa6e0_274e48( - particle->packed_particle_color & 0xFFFFFF, particle->packed_particle_color, 1.0f - distance_or_blend_factor); + particle->packed_particle_color = + FUN_001fa6e0_274e48(particle->packed_particle_color & 0xFFFFFF, + particle->packed_particle_color, + 1.0f - distance_or_blend_factor); if (fast_dec_timer_s16(&particle->hA)) { r->h10 = 0; particle->hA = r->h12; @@ -1925,10 +1934,11 @@ void update_three_phase_motion_alpha_fade_particle(M_274e48 *particle) { load_display_text_resource_entry(&applied_motion_delta, (u8 *)r + 4); fast_vec_add(&particle->v10, &particle->v10, &applied_motion_delta); color_without_alpha = particle->packed_particle_color & 0xFFFFFF; - particle->packed_particle_color = FUN_001fa6e0_274e48(color_without_alpha, - particle->packed_particle_color, - convert_integer_to_float(particle->hA) / - convert_integer_to_float(r->final_phase_duration_frames)); + particle->packed_particle_color = + FUN_001fa6e0_274e48(color_without_alpha, + particle->packed_particle_color, + convert_integer_to_float(particle->hA) / + convert_integer_to_float(r->final_phase_duration_frames)); if (fast_dec_timer_s16(&particle->hA)) free_effect_particle(particle); } 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 0a113b297c..4535951ac5 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 @@ -43,8 +43,9 @@ void update_three_phase_effect_particle(struct EffectParticle *particle) { fast_vec_add(particle->pos.f, particle->pos.f, position_step); phase_remaining_ratio = convert_integer_to_float(particle->life) / convert_integer_to_float(particle_data->h10); - particle->color = fast_tween_color( - particle_data->initial_phase_packed_color & 0xFFFFFF, particle_data->initial_phase_packed_color, 1.0f - phase_remaining_ratio); + particle->color = fast_tween_color(particle_data->initial_phase_packed_color & 0xFFFFFF, + particle_data->initial_phase_packed_color, + 1.0f - phase_remaining_ratio); particle->size = (float)(particle_data->h16 * 1000); if (fast_dec_timer_s16(&particle->life)) { particle_data->h10 = 0; @@ -60,8 +61,9 @@ void update_three_phase_effect_particle(struct EffectParticle *particle) { particle->size = ((float)(particle_data->h16 - particle_data->h18) * phase_remaining_ratio + (float)particle_data->h18) * 1000.0f; - particle->color = - fast_tween_color(particle_data->final_phase_packed_color, particle_data->initial_phase_packed_color, phase_remaining_ratio); + particle->color = fast_tween_color(particle_data->final_phase_packed_color, + particle_data->initial_phase_packed_color, + phase_remaining_ratio); if (fast_dec_timer_s16(&particle->life)) { particle_data->h12 = 0; particle->life = particle_data->h14; @@ -1974,11 +1976,12 @@ void update_source_bound_effect_particle(Part_26d470 *particle) { particle_data->fC = 1.0f; packed_rgb = particle->w4 & 0xFFFFFF; particle->w4 = - packed_rgb | (truncate_float_to_s32((convert_integer_to_float(particle->body.e->source_alpha) * - (particle_data->f10 * 0.00390625f) + - particle_data->fC) * - 256.0f) - << 24); + packed_rgb | + (truncate_float_to_s32((convert_integer_to_float(particle->body.e->source_alpha) * + (particle_data->f10 * 0.00390625f) + + particle_data->fC) * + 256.0f) + << 24); } extern unsigned char *FUN_L00_002678b8_26d598(int) __asm__("FUN_L00_002678b8"); @@ -2634,7 +2637,8 @@ void update_linked_effect_particle_with_collision_and_fade(O_26e670_26e670 *part if (P->motion_and_fade_flags & 2) { s32 faded_alpha = (particle->packed_rgba_color >> 24) - 2; if (faded_alpha > 0) { - particle->packed_rgba_color = (particle->packed_rgba_color & 0xFFFFFF) | (faded_alpha << 24); + particle->packed_rgba_color = + (particle->packed_rgba_color & 0xFFFFFF) | (faded_alpha << 24); } else if (P->link == 0) { if (P->tgt) P->tgt->p.link = 0; @@ -3377,7 +3381,8 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff particle->posv.f[2] = particle->posv.f[2] + random_float_between(nsp, sp); } tab = effect_texture_ids; - particle->animated_texture_id = tab[(particle->split_countdown + pv->f16 + (particle->animated_texture_id - tab[0])) & 7]; + particle->animated_texture_id = + tab[(particle->split_countdown + pv->f16 + (particle->animated_texture_id - tab[0])) & 7]; fast_vec_add(v0u.f, particle->posv.f, pv); k = pv->f14; if (scale_game_frames(3) < k) { @@ -3418,7 +3423,8 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff fast_vec_normalize(collision_offset, coll_hit_normal.f, 0.055f); fast_vec_add(particle->posv.f, coll_hit_normal.f - 8, collision_offset); if (particle->split_position_spread_scale < 200000.0f && (pv->f18 & 8) == 0) { - particle->split_position_spread_scale = particle->split_position_spread_scale + particle->split_position_spread_scale; + particle->split_position_spread_scale = + particle->split_position_spread_scale + particle->split_position_spread_scale; } pv->f18 |= 8; } else { @@ -3429,7 +3435,8 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff f32 decayed_particle_scalar; kk2 = 8.0f / (d * 0.443f); pv->f16++; - decayed_particle_scalar = particle->split_position_spread_scale - 260000.0f / (f32)kk2 * d * 1.25f; + decayed_particle_scalar = + particle->split_position_spread_scale - 260000.0f / (f32)kk2 * d * 1.25f; particle->split_position_spread_scale = decayed_particle_scalar; if (decayed_particle_scalar <= 0.0f) { kill: @@ -3439,7 +3446,8 @@ void update_splitting_effect_particle_with_collision_response_and_fade(Moby_26ff } else { f32 d = frame_scale; kk2 = 8.0f / (d * 0.443f); - particle->split_position_spread_scale = particle->split_position_spread_scale + 260000.0f / (f32)kk2 * d; + particle->split_position_spread_scale = + particle->split_position_spread_scale + 260000.0f / (f32)kk2 * d; } f = convert_integer_to_float(pv->f14); { 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 8004f1c12b..e7066835b8 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 @@ -484,7 +484,8 @@ int draw_hud_item_selector_panel(HudElem *selector_element) { icon_x = x + D_L00_0015F720_gp + (int)(D_L00_0015F78C_gp * fast_cos(angle) * D_L00_0015F7C4_gp); icon_y = y + D_L00_0015F724_gp + (int)(D_L00_0015F78C_gp * fast_sin(angle)); - if (selector_element->unk74 == i && ((E_238C30 **)D_L00_0015FAC0)[D_L00_0015F72C_gp][i].id != 0) + if (selector_element->unk74 == i && + ((E_238C30 **)D_L00_0015FAC0)[D_L00_0015F72C_gp][i].id != 0) draw_hud_sprite( get_icon_frame(0xe99c, 0), icon_x - 0x13, icon_y - 0x13, 0x26, 0x26, marker_alpha); if (((E_238C30 **)D_L00_0015FAC0)[D_L00_0015F72C_gp][i].id != 0) { @@ -1458,8 +1459,11 @@ int draw_hud_cropped_gauge_panel(char *cropped_gauge_element) { *(int *)(cropped_gauge_element + 0x58) = 0x100; *(int *)(cropped_gauge_element + 0x5C) = 0x40; hud_screen_position(cropped_gauge_element, &x, &y); - apply_hud_slide_offset(cropped_gauge_element, &x, &y, *(int *)(cropped_gauge_element + 0x6C), 0); - sprite_width = *(int *)(cropped_gauge_element + 0x74) * 0xDD / *(int *)(cropped_gauge_element + 0x8) + 0x1B; + apply_hud_slide_offset( + cropped_gauge_element, &x, &y, *(int *)(cropped_gauge_element + 0x6C), 0); + sprite_width = + *(int *)(cropped_gauge_element + 0x74) * 0xDD / *(int *)(cropped_gauge_element + 0x8) + + 0x1B; draw_cropped_hud_sprite(get_icon_frame(0x7558, 1), x, y, sprite_width, 0x40, 0x80); draw_hud_sprite(get_icon_frame(0x7558, 0), x, y, 0x100, 0x40, 0x80); draw_hud_sprite(get_icon_frame(0x7558, 2), x, y, 0x20, 0x20, D_00140986 ? 0x80 : 0); diff --git a/src/overlays/shared/ui/hud/hud_keep_visible.c b/src/overlays/shared/ui/hud/hud_keep_visible.c index d8c73a2b44..738f9aa6e5 100644 --- a/src/overlays/shared/ui/hud/hud_keep_visible.c +++ b/src/overlays/shared/ui/hud/hud_keep_visible.c @@ -197,7 +197,8 @@ s32 hud_keep_visible(s32 key, s32 minimum_visible_frames) { } if (i < 13 && hud_elements[i].unk68 == 0) { hud_element = hud_elements + i; - hud_element->unk7C = (minimum_visible_frames < hud_element->unk7C) ? hud_element->unk7C : minimum_visible_frames; + hud_element->unk7C = (minimum_visible_frames < hud_element->unk7C) ? hud_element->unk7C + : minimum_visible_frames; return 0; } return 1; diff --git a/src/overlays/shared/ui/menus/initialize_pause_menu.c b/src/overlays/shared/ui/menus/initialize_pause_menu.c index c40a9e25af..22b8033f9b 100644 --- a/src/overlays/shared/ui/menus/initialize_pause_menu.c +++ b/src/overlays/shared/ui/menus/initialize_pause_menu.c @@ -267,7 +267,8 @@ void initialize_pause_menu(void) { D_L00_001B9CF0.unk8 = D_L00_001B9CF0.pending_owner; pending_state = D_L00_001B9CF0.pending_state; D_L00_001B9CF0.state = pending_state; - if (pending_state == PAUSE_MENU_STATE_CLOSE_ON_ACTION || pending_state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ON_ACTION) { + if (pending_state == PAUSE_MENU_STATE_CLOSE_ON_ACTION || + pending_state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ON_ACTION) { small_buffers = 1; D_L00_001841F0.transition_target_level = (s32)D_L00_001B9CF0.unkE4; } @@ -606,7 +607,8 @@ void update_pause_menu(void) { return; } scene_state = D_L00_001B9CF0.state; - if (scene_state == PAUSE_MENU_STATE_DEFAULT_PAGE_ENTRY || scene_state == PAUSE_MENU_STATE_CLOSE_ON_ACTION_ENTRY || + if (scene_state == PAUSE_MENU_STATE_DEFAULT_PAGE_ENTRY || + scene_state == PAUSE_MENU_STATE_CLOSE_ON_ACTION_ENTRY || scene_state == PAUSE_MENU_STATE_LEVEL_TRANSITION_ENTRY || scene_state == 0x11 || scene_state == PAUSE_MENU_STATE_EXIT_GUARDED_ENTRY || scene_state == 0x2D || scene_state == PAUSE_MENU_STATE_PRESERVE_STATE_ENTRY) { diff --git a/src/overlays/shared/vehicles/background_ship_1.c b/src/overlays/shared/vehicles/background_ship_1.c index 28691217d0..e6478bc74e 100644 --- a/src/overlays/shared/vehicles/background_ship_1.c +++ b/src/overlays/shared/vehicles/background_ship_1.c @@ -238,16 +238,25 @@ void background_ship_1_update(char *moby) { moby_data->unk6C = func_0022ED80_r(1, 4, (int)moby); } path_travel_distance = *(float *)&background_ship_1_path_travel_speed_gp * frame_time; - moby_data->path_progress = moby_data->path_progress + path_travel_distance / moby_data->unk70; + moby_data->path_progress = + moby_data->path_progress + path_travel_distance / moby_data->unk70; if ((float)*(int *)path < moby_data->path_progress) { moby_data->path_progress = moby_data->path_progress - (float)*(int *)path; } if (current_level_index == 9) { - sample_camera_path( - (int *)path, 1, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->path_progress); + sample_camera_path((int *)path, + 1, + &MOBY(moby)->pos, + (float *)&MOBY(moby)->rot, + 0, + moby_data->path_progress); } else { - sample_camera_path( - (int *)path, 0, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->path_progress); + sample_camera_path((int *)path, + 0, + &MOBY(moby)->pos, + (float *)&MOBY(moby)->rot, + 0, + moby_data->path_progress); } if (MOBY(moby)->pos.x < 8.0f) { MOBY(moby)->collision = 0; diff --git a/src/overlays/shared/vehicles/background_ship_2.c b/src/overlays/shared/vehicles/background_ship_2.c index ff1f327cc6..ca28275e95 100644 --- a/src/overlays/shared/vehicles/background_ship_2.c +++ b/src/overlays/shared/vehicles/background_ship_2.c @@ -271,16 +271,25 @@ void background_ship_2_update(char *moby) { if (current_level_index == 10) { path_travel_distance = path_travel_distance * 0.25f; } - moby_data->path_progress = moby_data->path_progress + path_travel_distance / moby_data->unk70; + moby_data->path_progress = + moby_data->path_progress + path_travel_distance / moby_data->unk70; if ((float)*(int *)path < moby_data->path_progress) { moby_data->path_progress = moby_data->path_progress - (float)*(int *)path; } if ((unsigned int)(current_level_index - 9) < 2) { - sample_camera_path( - (int *)path, 1, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->path_progress); + sample_camera_path((int *)path, + 1, + &MOBY(moby)->pos, + (float *)&MOBY(moby)->rot, + 0, + moby_data->path_progress); } else { - sample_camera_path( - (int *)path, 0, &MOBY(moby)->pos, (float *)&MOBY(moby)->rot, 0, moby_data->path_progress); + sample_camera_path((int *)path, + 0, + &MOBY(moby)->pos, + (float *)&MOBY(moby)->rot, + 0, + moby_data->path_progress); } if (MOBY(moby)->pos.x < 8.0f) { MOBY(moby)->collision = 0; diff --git a/src/overlays/shared/vehicles/giant_clank_charged_blast.c b/src/overlays/shared/vehicles/giant_clank_charged_blast.c index f0803bf246..dc0deb8289 100644 --- a/src/overlays/shared/vehicles/giant_clank_charged_blast.c +++ b/src/overlays/shared/vehicles/giant_clank_charged_blast.c @@ -361,8 +361,10 @@ void giant_clank_charged_blast_update(Moby29FF90 *moby) { D_L15_0015F320.on = 0; D_L15_0015F330.on = 0; moby_data->f10 = 0; - moby_data->vel[0] = fast_cos(((Hero29FF90 *)&hero)->blast_heading_angle) * (D_0015ED6C * 40.0f); - moby_data->vel[1] = fast_sin(((Hero29FF90 *)&hero)->blast_heading_angle) * (D_0015ED6C * 40.0f); + moby_data->vel[0] = + fast_cos(((Hero29FF90 *)&hero)->blast_heading_angle) * (D_0015ED6C * 40.0f); + moby_data->vel[1] = + fast_sin(((Hero29FF90 *)&hero)->blast_heading_angle) * (D_0015ED6C * 40.0f); moby_data->vel[2] = 0.0f; moby->state = EXPANDING_BLAST; moby_data->f14 = 0; @@ -455,7 +457,8 @@ void giant_clank_charged_blast_update(Moby29FF90 *moby) { blast_center_particle->fC = blast_center_particle->fC * r; blast_center_particle->particle_frame_count = scale_game_frames(2); particle_subrecord->f10 = - 1.0f / convert_integer_to_float(blast_center_particle->particle_frame_count); + 1.0f / + convert_integer_to_float(blast_center_particle->particle_frame_count); particle_subrecord->f18 = 0x7F7F7F; particle_subrecord->f16 = 3; } diff --git a/src/overlays/shared/vehicles/giant_clank_missile.c b/src/overlays/shared/vehicles/giant_clank_missile.c index bd6cc6cf3f..37ac15645f 100644 --- a/src/overlays/shared/vehicles/giant_clank_missile.c +++ b/src/overlays/shared/vehicles/giant_clank_missile.c @@ -325,8 +325,10 @@ void giant_clank_missile_update(M_29E8A0 *missile_moby) { missile_data->speed + (missile_data->speed_end - missile_data->speed) / 10.0f * D_0015ED64; fast_dec_timer_s16(&missile_data->velocity_inheritance_timer); { - float velocity_inheritance_frames_remaining = convert_integer_to_float(missile_data->velocity_inheritance_timer); - float velocity_inheritance_frames_total = convert_integer_to_float(missile_data->velocity_inheritance_duration_frames); + float velocity_inheritance_frames_remaining = + convert_integer_to_float(missile_data->velocity_inheritance_timer); + float velocity_inheritance_frames_total = + convert_integer_to_float(missile_data->velocity_inheritance_duration_frames); fast_vec_scale(up, ((char *)&D_0013F490), velocity_inheritance_frames_remaining / velocity_inheritance_frames_total); diff --git a/src/overlays/shared/vendor/vendor.c b/src/overlays/shared/vendor/vendor.c index 0b1e125bdb..03cc51e4e9 100644 --- a/src/overlays/shared/vendor/vendor.c +++ b/src/overlays/shared/vendor/vendor.c @@ -351,7 +351,8 @@ void vendor_update(P_2a57a8 *vendor_moby) { fast_add_rotations(vendor_manipulator_rotation_phase, 0.01f); vendor_manipulator_counter_rotation_phase = fast_add_rotations(vendor_manipulator_counter_rotation_phase, -0.02f); - q->auxiliary_moby->auxiliary_scale = q->effect_scale_factor * q->auxiliary_moby->p24->auxiliary_scale_multiplier * 2.5f; + q->auxiliary_moby->auxiliary_scale = + q->effect_scale_factor * q->auxiliary_moby->p24->auxiliary_scale_multiplier * 2.5f; update_entity(q->auxiliary_moby); break; case VENDOR_HERO_NEARBY: @@ -375,7 +376,8 @@ void vendor_update(P_2a57a8 *vendor_moby) { fast_add_rotations(vendor_manipulator_rotation_phase, 0.01f); vendor_manipulator_counter_rotation_phase = fast_add_rotations(vendor_manipulator_counter_rotation_phase, -0.02f); - q->auxiliary_moby->auxiliary_scale = q->effect_scale_factor * q->auxiliary_moby->p24->auxiliary_scale_multiplier * 2.5f; + q->auxiliary_moby->auxiliary_scale = + q->effect_scale_factor * q->auxiliary_moby->p24->auxiliary_scale_multiplier * 2.5f; update_entity(q->auxiliary_moby); if (hero.state.control_mode != 0 && hero.state.current != 3 && hero.state.control_mode != 1) { @@ -414,7 +416,8 @@ void vendor_update(P_2a57a8 *vendor_moby) { case VENDOR_ZERO_AUXILIARY_SCALE: if (q->auxiliary_moby) { q->effect_scale_factor = 0.0f; - q->auxiliary_moby->auxiliary_scale = q->auxiliary_moby->p24->auxiliary_scale_multiplier * q->effect_scale_factor * 2.5f; + q->auxiliary_moby->auxiliary_scale = + q->auxiliary_moby->p24->auxiliary_scale_multiplier * q->effect_scale_factor * 2.5f; update_entity(q->auxiliary_moby); } break; diff --git a/src/overlays/shared/vendor/vendor_menu.c b/src/overlays/shared/vendor/vendor_menu.c index 50adf24bfd..e91e05d1a3 100644 --- a/src/overlays/shared/vendor/vendor_menu.c +++ b/src/overlays/shared/vendor/vendor_menu.c @@ -1353,7 +1353,8 @@ void update_vendor_menu(void) { position_contribution_scratch.f[1] = l00_vendor_item_display_transform_parameters[CUR_ITEM.item].f4; position_contribution_scratch.f[2] = - l00_vendor_item_display_transform_parameters[CUR_ITEM.item].item_local_position_offset_z; + l00_vendor_item_display_transform_parameters[CUR_ITEM.item] + .item_local_position_offset_z; euler_rotation_basis(vendor_menu.menu_mobys[3].mtx, &vendor_menu.menu_mobys[3].rot); transform_vector_by_basis(&position_contribution_scratch, &position_contribution_scratch, diff --git a/src/overlays/shared/weapons/bomb_glove_bomb.c b/src/overlays/shared/weapons/bomb_glove_bomb.c index 8d129c921b..e7712f5e3f 100644 --- a/src/overlays/shared/weapons/bomb_glove_bomb.c +++ b/src/overlays/shared/weapons/bomb_glove_bomb.c @@ -1130,13 +1130,16 @@ void bomb_update(BombMoby *bomb_moby) { mark_moby_for_removal(bomb_moby); return; } - if ((((G910 *)&hero)->b20A5 != 0 || ((G910 *)&hero)->b20AF != 0) && bomb_moby->state == BOMB_STATE_HELD) { + if ((((G910 *)&hero)->b20A5 != 0 || ((G910 *)&hero)->b20AF != 0) && + bomb_moby->state == BOMB_STATE_HELD) { bomb_moby->flags |= 0x41; } else { bomb_moby->flags &= ~0x41; } - if (d->owner->cls == 0xC0 && d->landing_prediction_disabled == 0 && FUN_001f9af0_2adb30(d) > 0.0f) { - if (((G910 *)&hero)->ground_support_moby == 0 || FUN_L00_002603d0_2adb30(((G910 *)&hero)->ground_support_moby) == 0) { + if (d->owner->cls == 0xC0 && d->landing_prediction_disabled == 0 && + FUN_001f9af0_2adb30(d) > 0.0f) { + if (((G910 *)&hero)->ground_support_moby == 0 || + FUN_L00_002603d0_2adb30(((G910 *)&hero)->ground_support_moby) == 0) { FUN_L00_002ad410_2adb30(d, bomb_moby, 1); } else if (FUN_L00_002ad410_2adb30(d, bomb_moby, 0) == 0) { FUN_L00_002ad410_2adb30(d, bomb_moby, 2); @@ -1154,7 +1157,8 @@ void bomb_update(BombMoby *bomb_moby) { c.f[2] = 128.0f; c.f[3] = 255.0f; fast_dec_timer_s16(&d->color_animation_counter); - t = convert_integer_to_float(d->color_animation_counter) / convert_integer_to_float(FUN_001f96f8_2adb30(0x1E)); + t = convert_integer_to_float(d->color_animation_counter) / + convert_integer_to_float(FUN_001f96f8_2adb30(0x1E)); cr = truncate_float_to_s32((c.f[0] - 255.0f) * t + 255.0f); cg = truncate_float_to_s32((c.f[1] - 64.0f) * t + 64.0f); cb = truncate_float_to_s32((c.f[2] - 64.0f) * t + 64.0f); @@ -1252,7 +1256,8 @@ void bomb_update(BombMoby *bomb_moby) { } if (collision_line( &bomb_pre_motion_position, &bomb_moby->pos, 0x10, (int)bomb_moby, (int)&q)) { - if (d->splash_frame_counter == 0 && collision_hit_material() == 0 && d->v.f[2] < 0.0f) { + if (d->splash_frame_counter == 0 && collision_hit_material() == 0 && + d->v.f[2] < 0.0f) { Vec_2adb30 p; Vec_2adb30 splash_particle_velocity; char *s; @@ -1649,8 +1654,9 @@ void bomb_update(BombMoby *bomb_moby) { } else if (bomb_moby->state != BOMB_STATE_EXPANDING_BLAST) { int v; d->color_animation_counter++; - v = truncate_float_to_s32(FUN_001f9de0_2adb30(normalize_angle((float)d->color_animation_counter * 0.068f)) * - 96.0f) + + v = truncate_float_to_s32( + FUN_001f9de0_2adb30(normalize_angle((float)d->color_animation_counter * 0.068f)) * + 96.0f) + 0x9F; bomb_moby->color = (v << 16) | (0xFF << 24) | (v << 8) | v; } diff --git a/src/overlays/shared/weapons/doom_bot_movement.c b/src/overlays/shared/weapons/doom_bot_movement.c index 3d9bf10f0a..2d7af3c635 100644 --- a/src/overlays/shared/weapons/doom_bot_movement.c +++ b/src/overlays/shared/weapons/doom_bot_movement.c @@ -501,7 +501,8 @@ f32 select_moby_heading_by_collision_probes(Mob *moby, } } if (2.5132742f < fast_difference_between_rotations(best, moby->current_heading)) { - best = fast_add_rotations(moby->current_heading, fast_subtract_rotations(best, moby->current_heading) * 0.5f); + best = fast_add_rotations(moby->current_heading, + fast_subtract_rotations(best, moby->current_heading) * 0.5f); } return best; } diff --git a/src/overlays/shared/weapons/drone.c b/src/overlays/shared/weapons/drone.c index 02a4a57822..042fb20e4e 100644 --- a/src/overlays/shared/weapons/drone.c +++ b/src/overlays/shared/weapons/drone.c @@ -179,9 +179,11 @@ void replenish_hero_drones(void) { if (FUN_001f96f8_2cdcc0(D_0015EEA4) / 600 > usage_stats->hC2) { usage_stats->hC2 = FUN_001f96f8_2cdcc0(D_0015EEA4) / 600; } - usage_stats->drone_usage_level_flags = usage_stats->drone_usage_level_flags | (1 << current_level_index) | 0x80000000; + usage_stats->drone_usage_level_flags = + usage_stats->drone_usage_level_flags | (1 << current_level_index) | 0x80000000; - FUN_001f9a10_2cdcc0(drone_spawn_position, hero_state->hero_position, hero_state->hero_moby + 0xE0); + FUN_001f9a10_2cdcc0( + drone_spawn_position, hero_state->hero_position, hero_state->hero_moby + 0xE0); FUN_001f9a10_2cdcc0( drone_spawn_position, drone_spawn_position, hero_state->hero_moby + 0xC0); for (i = hero_state->active_drone_count; i < 6; i++) { diff --git a/src/overlays/shared/weapons/glove_of_doom.c b/src/overlays/shared/weapons/glove_of_doom.c index a67211eefe..3e276ab003 100644 --- a/src/overlays/shared/weapons/glove_of_doom.c +++ b/src/overlays/shared/weapons/glove_of_doom.c @@ -54,9 +54,9 @@ typedef float Mat3_2c7548[3][4] __attribute__((aligned(16))); /* Counters kept at D_00141680 for the carrier's deliveries. */ typedef struct { u8 pad0[0xA0]; - u16 deliveries; /* 0xA0: counts up to 0xFFFF */ - u16 max_delivery_frame_bucket; /* 0xA2: raised to scale_game_frames(D_0015EEA4) / 600 */ - u32 levels; /* 0xA4: bit per level index, plus 0x80000000 */ + u16 deliveries; /* 0xA0: counts up to 0xFFFF */ + u16 max_delivery_frame_bucket; /* 0xA2: raised to scale_game_frames(D_0015EEA4) / 600 */ + u32 levels; /* 0xA4: bit per level index, plus 0x80000000 */ } DeliveryStats; unsigned char *spawn_glove_of_doom_held_moby(int spawning_moby, diff --git a/src/overlays/shared/weapons/mine.c b/src/overlays/shared/weapons/mine.c index 90452eb4dc..b0dcdbf5e8 100644 --- a/src/overlays/shared/weapons/mine.c +++ b/src/overlays/shared/weapons/mine.c @@ -493,7 +493,8 @@ void initialize_moby_motion_at_position(V_2aa008 *requested_position, if (scanned_moby->moby_state != 0xFD) if (scanned_moby->moby_class == initialized_moby->moby_class) if (scanned_moby != initialized_moby) { - if (best == 0 || ((D_2aa008 *)scanned_moby->moby_private_vars)->i5C < bestv) { + if (best == 0 || + ((D_2aa008 *)scanned_moby->moby_private_vars)->i5C < bestv) { bestv = ((D_2aa008 *)scanned_moby->moby_private_vars)->i5C; best = scanned_moby; } diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index c8ef85ec28..3540803ef2 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -1471,7 +1471,8 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { break; } if ((controller_state.held & ((SuckHero *)&hero)->fire_buttons) && cannon->cooldown == 0 && - ((SuckHero *)&hero)->item_select_blocked == 0 && ((SuckHero *)&hero)->suck_cannon_use_blocked == 0 && + ((SuckHero *)&hero)->item_select_blocked == 0 && + ((SuckHero *)&hero)->suck_cannon_use_blocked == 0 && scale_game_frames(15) < ((SuckHero *)&hero)->ready_frames && is_suck_cannon_suction_blocked_by_hero_state() == 0) { start_equipped_item_animation(); @@ -1489,7 +1490,8 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { case SUCKCANNON_STATE_SUCTION_STARTUP: if (suck_cannon_moby->anim_flags & 2) blend_moby_animation(suck_cannon_moby, 3, 0, scale_game_frames(5)); - if (is_suck_cannon_suction_blocked_by_hero_state() != 0 || ((SuckHero *)&hero)->suck_cannon_use_blocked || + if (is_suck_cannon_suction_blocked_by_hero_state() != 0 || + ((SuckHero *)&hero)->suck_cannon_use_blocked || ((SuckHero *)&hero)->item_select_blocked) { sound = cannon->sound; if (sound != -1) { @@ -1525,7 +1527,8 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { (((SuckHero *)&hero)->count < (item_text_variant[9] == 0 ? 5 : 10) && is_suck_cannon_suction_blocked_by_hero_state() == 0 && ((controller_state.held & ((SuckHero *)&hero)->fire_buttons) || cannon->cooldown) && - !((SuckHero *)&hero)->suck_cannon_use_blocked && !((SuckHero *)&hero)->item_select_blocked))) { + !((SuckHero *)&hero)->suck_cannon_use_blocked && + !((SuckHero *)&hero)->item_select_blocked))) { cancel_hero_item_animation(); sound = cannon->sound; if (sound != -1) { @@ -1612,7 +1615,8 @@ void suckcannon_update(SuckMoby *suck_cannon_moby) { (controller_state.held & ((SuckHero *)&hero)->fire_buttons) && ((SuckHero *)&hero)->control_mode != 7 && ((SuckHero *)&hero)->control_mode != 3 && ((SuckHero *)&hero)->control_mode != 18 && ((SuckHero *)&hero)->control_mode != 17 && - !((SuckHero *)&hero)->suck_cannon_use_blocked && !((SuckHero *)&hero)->item_select_blocked && + !((SuckHero *)&hero)->suck_cannon_use_blocked && + !((SuckHero *)&hero)->item_select_blocked && scale_game_frames(22) < ((SuckHero *)&hero)->ready_frames) { start_equipped_item_animation(); blend_moby_animation(suck_cannon_moby, 5, 0, scale_game_frames(2)); diff --git a/src/overlays/shared/weapons/taunter.c b/src/overlays/shared/weapons/taunter.c index 79dd397146..b21081babf 100644 --- a/src/overlays/shared/weapons/taunter.c +++ b/src/overlays/shared/weapons/taunter.c @@ -506,7 +506,8 @@ void taunter_update(Moby *taunter_moby) { } if ((u8)taunter_state != TAUNTER_STATE_ACTIVE) goto end; - if (taunter_moby->type == TAUNTER_TYPE_CONTINUOUS_EFFECT_EMISSION && hero.item_use_locked == 0) { + if (taunter_moby->type == TAUNTER_TYPE_CONTINUOUS_EFFECT_EMISSION && + hero.item_use_locked == 0) { taunter_effect_emission_disabled = 0; taunter_vars->cnt18++; } else { diff --git a/src/overlays/shared/weapons/thruster_pack_flame.c b/src/overlays/shared/weapons/thruster_pack_flame.c index b8cc1c0bee..812b32c459 100644 --- a/src/overlays/shared/weapons/thruster_pack_flame.c +++ b/src/overlays/shared/weapons/thruster_pack_flame.c @@ -720,9 +720,13 @@ void draw_joint_aligned_beam_effect(struct Moby *beam_moby) { D_L00_001DA0B0[i].v += 7.0f; } } - func_L00_001FDE48_2b3628(0x94, l00_beam_ribbon_world_positions, D_L00_001DA6D0, D_L00_001DA0B0, 1); func_L00_001FDE48_2b3628( - 0x32, &l00_beam_ribbon_world_positions[0x92], &D_L00_001DA6D0[0x92], &D_L00_001DA0B0[0x92], 1); + 0x94, l00_beam_ribbon_world_positions, D_L00_001DA6D0, D_L00_001DA0B0, 1); + func_L00_001FDE48_2b3628(0x32, + &l00_beam_ribbon_world_positions[0x92], + &D_L00_001DA6D0[0x92], + &D_L00_001DA0B0[0x92], + 1); } void emit_beam_trail_particles(X *x) __asm__("FUN_L00_002b3c50"); diff --git a/src/overlays/shared/weapons/visibomb.c b/src/overlays/shared/weapons/visibomb.c index c722448301..5b3b848ffc 100644 --- a/src/overlays/shared/weapons/visibomb.c +++ b/src/overlays/shared/weapons/visibomb.c @@ -119,7 +119,8 @@ void visibomb_update(O_b3058 *visibomb_moby) { fast_vec_add(launch_position, launch_position, u); fast_vec_add(launch_position, launch_position, &camera->pos); } else if (hero.unk22C8 == 1) { - b = fast_arc_tan(vector_length_xy(visibomb_moby->launch_direction_xy), visibomb_moby->launch_direction_z); + b = fast_arc_tan(vector_length_xy(visibomb_moby->launch_direction_xy), + visibomb_moby->launch_direction_z); build_spherical_offset(launch_position, 0.6f, launch_yaw, -b); fast_vec_add(launch_position, launch_position, visibomb_moby->v10); } else { @@ -130,7 +131,8 @@ void visibomb_update(O_b3058 *visibomb_moby) { blend_moby_animation(visibomb_moby, 3, 0, 0); } jet_camera_mode(); - v->active_missile_moby = spawn_visibomb_missile(visibomb_moby, launch_position, launch_yaw, b); + v->active_missile_moby = + spawn_visibomb_missile(visibomb_moby, launch_position, launch_yaw, b); r = (R_b3058 *)item_usage; if (r->visibomb_use_count < 0xFFFF) { r->visibomb_use_count++; diff --git a/src/overlays/shared/weapons/visibomb_missile.c b/src/overlays/shared/weapons/visibomb_missile.c index f4241e25dd..98c0564eac 100644 --- a/src/overlays/shared/weapons/visibomb_missile.c +++ b/src/overlays/shared/weapons/visibomb_missile.c @@ -870,20 +870,20 @@ void visibomb_missile_update(struct Moby *missile_moby) { float t = 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) * visibomb_missile_speed_target_blend_factor_gp; - missile_vars->f4 += - (missile_vars->smoothed_speed_target - missile_vars->f4) * visibomb_missile_speed_blend_factor_gp; + missile_vars->smoothed_speed_target += (t - 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) missile_vars->f4 = visibomb_missile_max_speed_gp * frame_time_macro; } engine_voice_set_pitch( missile_vars->engine_voice_slot, - truncate_float_to_s32( - (missile_vars->smoothed_speed_target - visibomb_missile_default_speed_gp * frame_time_macro / - (visibomb_missile_max_speed_gp * frame_time_macro - - visibomb_missile_default_speed_gp * frame_time_macro)) * - visibomb_missile_speed_voice_control_scale_gp)); + truncate_float_to_s32((missile_vars->smoothed_speed_target - + visibomb_missile_default_speed_gp * frame_time_macro / + (visibomb_missile_max_speed_gp * frame_time_macro - + visibomb_missile_default_speed_gp * frame_time_macro)) * + visibomb_missile_speed_voice_control_scale_gp)); if (missile_vars->f10 > 0) { if (missile_vars->f10 < scale_game_frames(0xBB8) - scale_game_frames(5)) { float steered_pitch; @@ -911,7 +911,8 @@ 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) + missile_vars->launch_ground_clearance; + float t = probe_ground_height(&missile_moby->pos, 0, 0.5f) + + missile_vars->launch_ground_clearance; if (missile_moby->pos.z < t) { if (coll_hit_moby == 0 || (coll_hit_moby->pclass != 0 && coll_hit_moby->pclass->type == 5)) { diff --git a/src/overlays/shared/weapons/walloper.c b/src/overlays/shared/weapons/walloper.c index 9412354919..b37ae07f80 100644 --- a/src/overlays/shared/weapons/walloper.c +++ b/src/overlays/shared/weapons/walloper.c @@ -865,8 +865,8 @@ void draw_walloper_arc_and_quad_effects(void *moby) { s32 arc_alpha; for (i = 0; i < 10; i++) { if (l00_walloper_arc_update_countdowns[i] != 0) { - arc_alpha = truncate_float_to_s32(convert_integer_to_float(l00_walloper_arc_base_alphas[i]) * - D_L00_00161660_f[29]); + arc_alpha = truncate_float_to_s32( + convert_integer_to_float(l00_walloper_arc_base_alphas[i]) * D_L00_00161660_f[29]); draw_walloper_arc_two_pass_quads(&l00_walloper_arcs[i], arc_alpha, arc_alpha, diff --git a/src/overlays/shared/world/load_level_gameplay.c b/src/overlays/shared/world/load_level_gameplay.c index 249498624d..42e06c645c 100644 --- a/src/overlays/shared/world/load_level_gameplay.c +++ b/src/overlays/shared/world/load_level_gameplay.c @@ -577,7 +577,9 @@ char *load_level_gameplay(int skip_gameplay_read) { D_L00_001604A4 = 500.0f; D_L00_0015FFF0 = 500; D_L00_0016017C = 0x1F4000; - set_background_color(D_L00_0016CA40.background_red, D_L00_0016CA40.background_green, D_L00_0016CA40.background_blue); + set_background_color(D_L00_0016CA40.background_red, + D_L00_0016CA40.background_green, + D_L00_0016CA40.background_blue); vu0_load_micro_program(D_00100AE0); fast_mem_zero16(point_lights, 0x100); fast_mem_zero16(D_L00_001804C0, 0x180); @@ -788,8 +790,10 @@ char *load_level_gameplay(int skip_gameplay_read) { if (D_L00_001BC030[shrub_class_index]->f1C != 0) { float shrub_class_lower_bound; - inst->class_lower_bound_base = truncate_float_to_s32(*D_L00_001BC030[shrub_class_index]->f1C); - shrub_class_lower_bound = convert_integer_to_float(inst->class_lower_bound_base) + 24.0f; + inst->class_lower_bound_base = + truncate_float_to_s32(*D_L00_001BC030[shrub_class_index]->f1C); + shrub_class_lower_bound = + convert_integer_to_float(inst->class_lower_bound_base) + 24.0f; if (inst->f10 < shrub_class_lower_bound) { inst->f10 = shrub_class_lower_bound; } @@ -1653,7 +1657,8 @@ char *load_level_gameplay(int skip_gameplay_read) { D_L00_0015F5CC = 0; D_L00_0015F63C = 0; if (level_render_state.player != 0) { - *(long *)&((MobyInst *)level_render_state.player)->f38 = *(long *)&D_0013F350.hero_moby->f38; + *(long *)&((MobyInst *)level_render_state.player)->f38 = + *(long *)&D_0013F350.hero_moby->f38; } switch (D_0015ED84) { case 2: diff --git a/src/ui/menus/pause/build_pause_item_list.c b/src/ui/menus/pause/build_pause_item_list.c index 51107d772e..c3a9b28433 100644 --- a/src/ui/menus/pause/build_pause_item_list.c +++ b/src/ui/menus/pause/build_pause_item_list.c @@ -37,7 +37,8 @@ int build_pause_item_list(void) { pause_item_entry->c = 0; pause_item_entry->id = id; pause_item_entry->idx = i; - pause_item_variant_values[item_count] = b ? menu_item_definition->unk42 : menu_item_definition->unk40; + pause_item_variant_values[item_count] = + b ? menu_item_definition->unk42 : menu_item_definition->unk40; item_count++; } } diff --git a/src/ui/vendor/render_vendor_item_icon_strip_pass.c b/src/ui/vendor/render_vendor_item_icon_strip_pass.c index 376e908d9f..c0d76922b4 100644 --- a/src/ui/vendor/render_vendor_item_icon_strip_pass.c +++ b/src/ui/vendor/render_vendor_item_icon_strip_pass.c @@ -89,9 +89,9 @@ void render_vendor_item_icon_strip_pass(void) { slot = -2; do { first_slot = D_001E63C0.unk58 - 3; - entry_offset = - ((s32)((D_001E63C0.selection_entry_count * 2) + slot + first_slot) % (s32)D_001E63C0.selection_entry_count) * - 0x14; + entry_offset = ((s32)((D_001E63C0.selection_entry_count * 2) + slot + first_slot) % + (s32)D_001E63C0.selection_entry_count) * + 0x14; icon = ((struct HudItemEntry *)(void *)((u8 *)((u8 *)menu_item_info) + *(s32 *)(void *)(entry_offset + ((u8 *)&D_001E63C0 + 0xD0)) * From ce4e7506de5bd49684e9ea368f4a66e79042dc40 Mon Sep 17 00:00:00 2001 From: Ben Perry <7693062+ben-perry@users.noreply.github.com> Date: Mon, 2 Nov 2026 21:33:37 +0000 Subject: [PATCH 758/758] decomp: consolidate shared naming domains --- include/rnc/hero/hero_state.h | 4 ++ include/rnc/mobys/moby_state.h | 9 ++++ src/overlays/l00/mobys/veldin_robot_enemy.c | 7 ++-- src/overlays/l01/hero/hero_set_state.c | 7 +--- src/overlays/l02/hero/hero_set_state.c | 7 +--- src/overlays/l03/hero/hero_set_state.c | 7 +--- src/overlays/l03/mobys/robot_dog.c | 6 +-- src/overlays/l05/hero/hero_set_state.c | 7 +--- src/overlays/l06/hero/hero_set_state.c | 7 +--- src/overlays/l08/hero/hero_set_state.c | 7 +--- src/overlays/l10/mobys/toxic_crab.c | 42 +++++++++---------- src/overlays/l11/hero/hero_set_state.c | 7 +--- src/overlays/l12/hero/hero_set_state.c | 7 +--- src/overlays/l14/hero/hero_set_state.c | 7 +--- src/overlays/l15/hero/hero_set_state.c | 7 +--- src/overlays/l15/mobys/ultramech_scientist.c | 18 ++++---- src/overlays/l16/hero/hero_set_state.c | 7 +--- src/overlays/shared/enemies/seeker.c | 11 ++--- src/overlays/shared/enemies/spawner.c | 11 ++--- src/overlays/shared/weapons/suckcannon.c | 12 ++---- .../save_data/save_card_state_formatting.c | 3 +- 21 files changed, 79 insertions(+), 121 deletions(-) create mode 100644 include/rnc/mobys/moby_state.h diff --git a/include/rnc/hero/hero_state.h b/include/rnc/hero/hero_state.h index 7aaf8dac8e..c7cf74327a 100644 --- a/include/rnc/hero/hero_state.h +++ b/include/rnc/hero/hero_state.h @@ -135,6 +135,10 @@ enum HeroStateId { HERO_STATE_DYING_ZERO_HEALTH = 0x82 }; +enum HeroAnimationEntryMode { + HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS = 0x2 +}; + enum HeroVehicleMode { HERO_VEHICLE_MODE_ON_FOOT = 0x0, HERO_VEHICLE_MODE_CLANK = 0x1, diff --git a/include/rnc/mobys/moby_state.h b/include/rnc/mobys/moby_state.h new file mode 100644 index 0000000000..f1d95a268b --- /dev/null +++ b/include/rnc/mobys/moby_state.h @@ -0,0 +1,9 @@ +#ifndef LOMBYTE_RNC_MOBYS_MOBY_STATE_H +#define LOMBYTE_RNC_MOBYS_MOBY_STATE_H + +enum MobyRemovalState { + MOBY_STATE_ALTERNATE_REMOVAL_MARKER = 0xFD, + MOBY_STATE_REMOVAL_MARKER = 0xFE +}; + +#endif /* LOMBYTE_RNC_MOBYS_MOBY_STATE_H */ diff --git a/src/overlays/l00/mobys/veldin_robot_enemy.c b/src/overlays/l00/mobys/veldin_robot_enemy.c index 76a1185cc5..8f74569e06 100644 --- a/src/overlays/l00/mobys/veldin_robot_enemy.c +++ b/src/overlays/l00/mobys/veldin_robot_enemy.c @@ -1,5 +1,6 @@ /* Level 00 moby class veldin_robot_enemy: its update, damage and targeting, and its effect quad. */ #include "types.h" +#include "rnc/mobys/moby_state.h" #include "rnc/overlay/shared/world/level_labels.h" #include "rnc/hero/hero.h" #include "rnc/globals.h" @@ -446,9 +447,7 @@ void update_veldin_robot_damage_and_targeting(ElectroidMoby *moby) { VELDIN_ROBOT_TARGET_SELECTION_ALTERNATE_MOBY = 1, VELDIN_ROBOT_TARGET_SELECTION_UNAVAILABLE = 2 }; - enum { - MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE - }; + ElectroidVars *vars; void *anim; ElectroidHit *coll; @@ -536,7 +535,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_MARKED_FOR_REMOVAL || + if (candidate_target == 0 || candidate_target->state == MOBY_STATE_REMOVAL_MARKER || candidate_target->state == 0xFD) { vars->candidate_target_moby_index = -1; } else { diff --git a/src/overlays/l01/hero/hero_set_state.c b/src/overlays/l01/hero/hero_set_state.c index 489cab4341..26c2191426 100644 --- a/src/overlays/l01/hero/hero_set_state.c +++ b/src/overlays/l01/hero/hero_set_state.c @@ -69,9 +69,6 @@ extern char level_01_transform_trail_jump_velocity_keys[] __asm__("D_L01_0017C3A extern char level_01_water_surface_jump_velocity_keys[] __asm__("D_L01_0017C3E0"); int l01_hero_set_state(int requested_state, int animation_setup_mode) { - enum { - HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS = 2 - }; int saved_state_step; char *moby; int old20A7; @@ -79,11 +76,11 @@ int l01_hero_set_state(int requested_state, int animation_setup_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - animation_setup_mode != HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS)) + animation_setup_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((cutscene_mode == 2 || cutscene_mode == 6) && - animation_setup_mode != HERO_ANIMATION_SETUP_OVERRIDE_TRANSITION_GUARDS) + animation_setup_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l02/hero/hero_set_state.c b/src/overlays/l02/hero/hero_set_state.c index e417fb9402..d38a0568db 100644 --- a/src/overlays/l02/hero/hero_set_state.c +++ b/src/overlays/l02/hero/hero_set_state.c @@ -70,9 +70,6 @@ extern int hero_set_state(int, int) __asm__("FUN_L02_0022b728"); extern char level02_hero_transform_trail_jump_velocity_keys[] __asm__("D_L02_0017C520"); int hero_set_state(int requested_state, int entry_animation_mode) { - enum { - HERO_ENTRY_ANIMATION_GUARD_OVERRIDE = 2 - }; int saved_state_step; char *moby; int old20A7; @@ -80,11 +77,11 @@ int hero_set_state(int requested_state, int entry_animation_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - entry_animation_mode != HERO_ENTRY_ANIMATION_GUARD_OVERRIDE)) + entry_animation_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((level_game_mode == 2 || level_game_mode == 6) && - entry_animation_mode != HERO_ENTRY_ANIMATION_GUARD_OVERRIDE) + entry_animation_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l03/hero/hero_set_state.c b/src/overlays/l03/hero/hero_set_state.c index 8f9afa1ec4..9678fe9c3b 100644 --- a/src/overlays/l03/hero/hero_set_state.c +++ b/src/overlays/l03/hero/hero_set_state.c @@ -69,9 +69,6 @@ extern char level03_hero_trail_jump_velocity_keys[] __asm__("D_L03_0017C020"); extern char level03_hero_water_surface_jump_velocity_keys[] __asm__("D_L03_0017C060"); int hero_set_state(int requested_state, int entry_animation_mode) { - enum { - HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS = 2 - }; int previous_state_step; char *moby; int old20A7; @@ -79,11 +76,11 @@ int hero_set_state(int requested_state, int entry_animation_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS)) + entry_animation_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((D_L03_0015F5C4 == 2 || D_L03_0015F5C4 == 6) && - entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_BYPASS_ENTRY_LOCKS) + entry_animation_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l03/mobys/robot_dog.c b/src/overlays/l03/mobys/robot_dog.c index 5679415fea..370b1277be 100644 --- a/src/overlays/l03/mobys/robot_dog.c +++ b/src/overlays/l03/mobys/robot_dog.c @@ -1,5 +1,6 @@ /* Level 03 moby class robot_dog. */ #include "types.h" +#include "rnc/mobys/moby_state.h" #include "rnc/globals.h" #include "rnc/mobys/moby.h" #include "rnc/math/fast_math.h" @@ -560,9 +561,6 @@ void update_robot_dog_hit_reaction(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l03_kerwan/vendor_00293720.c: func_L03_002C8068), where it is exact; names translated to the US level program. */ int can_release_linked_robot_dog(struct Moby *moby) { - enum { - MOBY_STATE_ALTERNATE_PENDING_REMOVAL = 0xFD - }; unsigned char state; char *partner_pvars; partner_pvars = (char *)moby->pvars; @@ -571,7 +569,7 @@ int can_release_linked_robot_dog(struct Moby *moby) { state = moby->state; if (state == MOBY_STATE_PENDING_REMOVAL) return 0; - if (state == MOBY_STATE_ALTERNATE_PENDING_REMOVAL) + if (state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER) return 0; if (moby->oclass != 0x23E) return 0; diff --git a/src/overlays/l05/hero/hero_set_state.c b/src/overlays/l05/hero/hero_set_state.c index 165e95256b..dc66fb77a5 100644 --- a/src/overlays/l05/hero/hero_set_state.c +++ b/src/overlays/l05/hero/hero_set_state.c @@ -82,9 +82,6 @@ extern int hero_set_state(int, int) __asm__("FUN_L05_0024cee8"); extern char level05_hero_water_surface_jump_velocity_keys[] __asm__("D_L05_0017C3C0"); int hero_set_state(int requested_state, int animation_request_mode) { - enum { - HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE = 2 - }; int saved_state_step; char *moby; int old20A7; @@ -92,11 +89,11 @@ int hero_set_state(int requested_state, int animation_request_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - animation_request_mode != HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE)) + animation_request_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((D_L05_0015F5C4 == 2 || D_L05_0015F5C4 == 6) && - animation_request_mode != HERO_ANIMATION_REQUEST_ADMISSION_OVERRIDE) + animation_request_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l06/hero/hero_set_state.c b/src/overlays/l06/hero/hero_set_state.c index ab2fb137a7..e3b43d2461 100644 --- a/src/overlays/l06/hero/hero_set_state.c +++ b/src/overlays/l06/hero/hero_set_state.c @@ -70,9 +70,6 @@ extern int hero_set_state(int, int) __asm__("FUN_L06_002356a0"); extern char level06_hero_transform_trail_jump_velocity_keys[] __asm__("D_L06_0017C6A0"); int hero_set_state(int requested_state, int entry_animation_mode) { - enum { - HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS = 2 - }; int saved_state_step; char *moby; int old20A7; @@ -84,11 +81,11 @@ int hero_set_state(int requested_state, int entry_animation_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - entry_animation_mode != HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS)) + entry_animation_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((D_L06_0015F5C4 == 2 || D_L06_0015F5C4 == 6) && - entry_animation_mode != HERO_ENTRY_ANIMATION_BYPASS_DYING_AND_GLOBAL_LOCKS) + entry_animation_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l08/hero/hero_set_state.c b/src/overlays/l08/hero/hero_set_state.c index 8af53da831..8f579d8410 100644 --- a/src/overlays/l08/hero/hero_set_state.c +++ b/src/overlays/l08/hero/hero_set_state.c @@ -69,9 +69,6 @@ extern char hero_water_surface_jump_velocity_keys[] __asm__("D_L08_0017C760"); extern char hero_transform_trail_jump_velocity_keys[] __asm__("D_L08_0017C720"); int hero_set_state(int requested_state, int animation_request_mode) { - enum { - HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS = 2 - }; int previous_state_step; char *moby; int old20A7; @@ -80,11 +77,11 @@ int hero_set_state(int requested_state, int animation_request_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - animation_request_mode != HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS)) + animation_request_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((level_game_mode == 2 || level_game_mode == 6) && - animation_request_mode != HERO_ANIMATION_REQUEST_OVERRIDE_MODE_GUARDS) + animation_request_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l10/mobys/toxic_crab.c b/src/overlays/l10/mobys/toxic_crab.c index 9960ca9170..0c8c002e95 100644 --- a/src/overlays/l10/mobys/toxic_crab.c +++ b/src/overlays/l10/mobys/toxic_crab.c @@ -1,5 +1,6 @@ /* Level 10 moby class toxic_crab: sight, targeting, group approach, particles and hit reactions. */ #include "types.h" +#include "rnc/mobys/moby_state.h" #include "rnc/game/item_state.h" #include "rnc/hero/hero.h" #include "rnc/mobys/moby.h" @@ -47,6 +48,10 @@ enum { TOXIC_CRAB_STATE_FALL_TO_DEATH = 12 }; +enum ToxicCrabTargetSelectionStatus { + TOXIC_CRAB_TARGET_SELECTION_UNAVAILABLE = 2 +}; + typedef struct Moby Moby; extern struct Moby *D_L10_0015FFD0_macro[] __asm__("D_L10_0015FFD0") MACRO_ADDR; extern float D_0015ED6C; @@ -235,15 +240,6 @@ extern float fast_vec_dist(void *, void *); /* Moby class 1202 */ void toxic_crab_update(Moby2E30F8 *m) { - enum { - MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE - }; - enum { - MOBY_STATE_ALTERNATE_REMOVAL_MARKER = 0xFD - }; - enum { - TOXIC_CRAB_POINT_AHEAD_NO_TARGET = 2 - }; int see = 0; Crab2E30F8 *crab_data = m->data; char *target_moby; @@ -305,7 +301,7 @@ void toxic_crab_update(Moby2E30F8 *m) { int k = crab_data->activation_dependency_moby_index; if (k != -1) { Moby2E30F8 *p = (Moby2E30F8 *)((char *)D_L10_0015FFD0_macro[2] + (k << 8)); - if (p == 0 || p->state == MOBY_STATE_MARKED_FOR_REMOVAL || + if (p == 0 || p->state == MOBY_STATE_REMOVAL_MARKER || p->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER || (((*(int *)(((char *)&D_0014C190) + (((short)p->id >> 5) * 4 + (current_level_index << 8))) >> @@ -333,7 +329,7 @@ void toxic_crab_update(Moby2E30F8 *m) { char *moby_instance_array_base = D_L10_0015FFD8; Moby2E30F8 *p = (Moby2E30F8 *)(moby_instance_array_base + (crab_data->activation_dependency_moby_index << 8)); - if (p == 0 || p->state == MOBY_STATE_MARKED_FOR_REMOVAL || + if (p == 0 || p->state == MOBY_STATE_REMOVAL_MARKER || p->state == MOBY_STATE_ALTERNATE_REMOVAL_MARKER || ((*(int *)(((char *)&D_0014C190) + (((short)p->id >> 5) * 4 + (current_level_index << 8))) >> @@ -346,7 +342,7 @@ void toxic_crab_update(Moby2E30F8 *m) { } } } - if (crab_data->tracked_target_selection_status != TOXIC_CRAB_POINT_AHEAD_NO_TARGET || + if (crab_data->tracked_target_selection_status != TOXIC_CRAB_TARGET_SELECTION_UNAVAILABLE || crab_data->activation_override_enabled != 0) { m->state = TOXIC_CRAB_STATE_ACTIVATE; crab_data->behavior_timer_frames = scale_game_frames(1); @@ -396,7 +392,7 @@ void toxic_crab_update(Moby2E30F8 *m) { crab_data->tracked_position_y - m->pos[1]); FUN_L00_00258278( (char *)m, &crab_data->heading_turn_step, ang, 0.02f, 0.3f, frame_time * 6.2831855f); - if (crab_data->tracked_target_selection_status != TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { + if (crab_data->tracked_target_selection_status != TOXIC_CRAB_TARGET_SELECTION_UNAVAILABLE) { m->state = TOXIC_CRAB_STATE_WAIT_TO_PURSUE; crab_data->behavior_timer_frames = truncate_float_to_s32( random_float_between(0.0f, (float)crab_data->pursuit_delay_upper_bound_frames)); @@ -550,7 +546,7 @@ void toxic_crab_update(Moby2E30F8 *m) { float home = fast_vec_dist(m->pos, crab_data->home_position_and_heading); if ((hero.vehicle_mode == HERO_VEHICLE_MODE_CLANK ? 1.0f : 30.0f) < home || crab_data->tracked_target_selection_status == - TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { + TOXIC_CRAB_TARGET_SELECTION_UNAVAILABLE) { m->state = TOXIC_CRAB_STATE_RETURN_HOME; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); } else if (vector_distance_xy(m->pos, target_moby + 0x10) < @@ -609,7 +605,8 @@ void toxic_crab_update(Moby2E30F8 *m) { { float home = fast_vec_dist(m->pos, crab_data->home_position_and_heading); if ((hero.vehicle_mode == HERO_VEHICLE_MODE_CLANK ? 1.0f : 30.0f) < home || - crab_data->tracked_target_selection_status == TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { + crab_data->tracked_target_selection_status == + TOXIC_CRAB_TARGET_SELECTION_UNAVAILABLE) { m->state = TOXIC_CRAB_STATE_RETURN_HOME; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); } else if (vector_distance_xy(m->pos, target_moby + 0x10) < @@ -668,7 +665,8 @@ void toxic_crab_update(Moby2E30F8 *m) { } else if (m->anim >= 6 && m->anim <= 7 && (m->b70 & 2)) { float home = fast_vec_dist(m->pos, crab_data->home_position_and_heading); if ((((unsigned char *)&D_0013E533)[0x2EC1] == 1 ? 1.0f : 30.0f) < home || - crab_data->tracked_target_selection_status == TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { + crab_data->tracked_target_selection_status == + TOXIC_CRAB_TARGET_SELECTION_UNAVAILABLE) { m->state = TOXIC_CRAB_STATE_RETURN_HOME; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); } else { @@ -763,7 +761,7 @@ void toxic_crab_update(Moby2E30F8 *m) { blend_moby_animation(m, 1, 0, scale_game_frames(0x14)); } } else if (crab_data->tracked_target_selection_status != - TOXIC_CRAB_POINT_AHEAD_NO_TARGET) { + TOXIC_CRAB_TARGET_SELECTION_UNAVAILABLE) { m->state = TOXIC_CRAB_STATE_PURSUE_TARGET; crab_data->pursuit_movement_blocked = 0; qcopy(crab_data->pursuit_progress_sample_position, m->pos); @@ -1090,9 +1088,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { ARC_ADJUSTED_KNOCKBACK_HIT_RESPONSE = 10, SUPPRESSED_HIT_RESPONSE = 11 }; - enum { - POINT_AHEAD_NO_TARGET = 2 - }; + Moby *moby = mv; AlignedVec4f vA; AlignedVec4f vB; @@ -1267,12 +1263,12 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { func_L00_00260D30_2E52B0(moby, &moby_data->a120, moby_data->f1A0); if (moby_data->f1A0 < vector_distance_xy(&moby_data->a170, &moby_data->a120) || 3.0f < absolute_float(moby->pos.z - moby_data->a120.z)) { - moby_data->target_selection_status = POINT_AHEAD_NO_TARGET; + moby_data->target_selection_status = TOXIC_CRAB_TARGET_SELECTION_UNAVAILABLE; } } else if (moby_data->f1A0 < vector_distance_xy(&moby_data->a170, &moby_data->a120) || 3.0f < absolute_float(moby->pos.z - moby_data->a120.z)) { func_L00_00260D30_2E52B0(moby, &moby_data->a120, moby_data->f1A0); - moby_data->target_selection_status = POINT_AHEAD_NO_TARGET; + moby_data->target_selection_status = TOXIC_CRAB_TARGET_SELECTION_UNAVAILABLE; } else { activate_effect_l08(moby_data->f1A0, moby, @@ -1283,7 +1279,7 @@ void update_toxic_crab_hit_reactions_and_targeting(void *mv) { l10_paths[moby_data->target_path_index]->count); } if (moby->state != TOXIC_CRAB_STATE_WAIT_FOR_ACTIVATION && - moby_data->target_selection_status == POINT_AHEAD_NO_TARGET) { + moby_data->target_selection_status == TOXIC_CRAB_TARGET_SELECTION_UNAVAILABLE) { moby_data->target_loss_frames++; if (scale_game_frames(300) < moby_data->target_loss_frames) { if (1.0f < fast_vec_dist(&moby->pos, &moby_data->a170)) { diff --git a/src/overlays/l11/hero/hero_set_state.c b/src/overlays/l11/hero/hero_set_state.c index aba394e346..847dd324ad 100644 --- a/src/overlays/l11/hero/hero_set_state.c +++ b/src/overlays/l11/hero/hero_set_state.c @@ -66,9 +66,6 @@ extern char level_11_water_surface_jump_velocity_keys[] __asm__("D_L11_0017C960" extern char level_11_trail_jump_velocity_keys[] __asm__("D_L11_0017C920"); int hero_set_state(int requested_state, int animation_update_mode) { - enum { - HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE = 2 - }; int previous_state_step; char *moby; int old20A7; @@ -76,11 +73,11 @@ int hero_set_state(int requested_state, int animation_update_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - animation_update_mode != HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE)) + animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((D_L11_0015F5C4 == 2 || D_L11_0015F5C4 == 6) && - animation_update_mode != HERO_ANIMATION_UPDATE_GUARDED_ENTRY_OVERRIDE) + animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l12/hero/hero_set_state.c b/src/overlays/l12/hero/hero_set_state.c index 7c3eaff8a1..25fd725307 100644 --- a/src/overlays/l12/hero/hero_set_state.c +++ b/src/overlays/l12/hero/hero_set_state.c @@ -67,9 +67,6 @@ extern char level12_transform_trail_jump_velocity_key_profile[] __asm__("D_L12_0 extern char level12_water_surface_jump_velocity_key_profile[] __asm__("D_L12_0017C3E0"); int hero_set_state(int requested_state, int entry_animation_mode) { - enum { - HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE = 2 - }; int previous_state_step; char *moby; int old20A7; @@ -77,11 +74,11 @@ int hero_set_state(int requested_state, int entry_animation_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE)) + entry_animation_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((D_L12_0015F5C4 == 2 || D_L12_0015F5C4 == 6) && - entry_animation_mode != HERO_ENTRY_ANIMATION_MODE_GUARD_OVERRIDE) + entry_animation_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l14/hero/hero_set_state.c b/src/overlays/l14/hero/hero_set_state.c index e5228a3748..c2f8ffea80 100644 --- a/src/overlays/l14/hero/hero_set_state.c +++ b/src/overlays/l14/hero/hero_set_state.c @@ -65,9 +65,6 @@ extern int hero_set_state(int, int) __asm__("FUN_L14_0022ff58"); extern char level14_transform_trail_jump_velocity_keys[] __asm__("D_L14_0017C620"); int hero_set_state(int requested_state, int animation_update_mode) { - enum { - HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE = 2 - }; int saved_state_step; char *moby; int old20A7; @@ -76,11 +73,11 @@ int hero_set_state(int requested_state, int animation_update_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - animation_update_mode != HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE)) + animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((D_L14_0015F5C4 == 2 || D_L14_0015F5C4 == 6) && - animation_update_mode != HERO_ANIMATION_UPDATE_TRANSITION_GUARD_OVERRIDE) + animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l15/hero/hero_set_state.c b/src/overlays/l15/hero/hero_set_state.c index 70748581a7..2d50fb0f00 100644 --- a/src/overlays/l15/hero/hero_set_state.c +++ b/src/overlays/l15/hero/hero_set_state.c @@ -69,9 +69,6 @@ extern char hero_trail_jump_velocity_keys[] __asm__("D_L15_0017C520"); extern char hero_deep_water_jump_velocity_keys[] __asm__("D_L15_0017C560"); int hero_set_state(int requested_state, int entry_animation_mode) { - enum { - HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE = 2 - }; int saved_state_step; char *moby; int old20A7; @@ -79,11 +76,11 @@ int hero_set_state(int requested_state, int entry_animation_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - entry_animation_mode != HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE)) + entry_animation_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((D_L15_0015F5C4 == 2 || D_L15_0015F5C4 == 6) && - entry_animation_mode != HERO_ENTRY_ANIMATION_TRANSITION_OVERRIDE) + entry_animation_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/l15/mobys/ultramech_scientist.c b/src/overlays/l15/mobys/ultramech_scientist.c index 16fb51f4e4..db2ac35709 100644 --- a/src/overlays/l15/mobys/ultramech_scientist.c +++ b/src/overlays/l15/mobys/ultramech_scientist.c @@ -1,5 +1,6 @@ /* Level 15 ultramech scientist moby class. */ #include "types.h" +#include "rnc/mobys/moby_state.h" #include "rnc/mobys/moby.h" #include "rnc/math/fast_math.h" #include "rnc/math/asm_helpers.h" @@ -118,10 +119,7 @@ void ultramech_scientist_update(struct Moby *moby) { enum { ULTRAMECH_SCIENTIST_DISABLED = 9 }; - enum { - MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY = 0xFD, - MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY = 0xFE - }; + UltramechScientistVars *ultramech_scientist_private_data; char *hero_pos; struct Moby *moby_list_cursor; @@ -178,8 +176,8 @@ void ultramech_scientist_update(struct Moby *moby) { break; } { - int dead_state = MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY; - int gone_state = MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY; + int dead_state = MOBY_STATE_REMOVAL_MARKER; + int gone_state = MOBY_STATE_ALTERNATE_REMOVAL_MARKER; for (; moby_list_cursor != 0; moby_list_cursor = moby_list_cursor->next) { if (moby_list_cursor->mission != ultramech_scientist_private_data->dialogue_mission_id) { @@ -222,8 +220,8 @@ void ultramech_scientist_update(struct Moby *moby) { break; } { - int dead_state = MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY; - int gone_state = MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY; + int dead_state = MOBY_STATE_REMOVAL_MARKER; + int gone_state = MOBY_STATE_ALTERNATE_REMOVAL_MARKER; for (; moby_list_cursor != 0; moby_list_cursor = moby_list_cursor->next) { if (moby_list_cursor->mission != ultramech_scientist_private_data->dialogue_mission_id) { @@ -272,8 +270,8 @@ void ultramech_scientist_update(struct Moby *moby) { (ultramech_scientist_private_data->moby_to_remove_index << 8); if (spawned != 0) { int state = *(unsigned char *)(spawned + 0x20); - if (state != MOBY_REMOVAL_AT_OR_ABOVE_ADDRESS_BOUNDARY) { - if (state != MOBY_REMOVAL_BELOW_ADDRESS_BOUNDARY) { + if (state != MOBY_STATE_REMOVAL_MARKER) { + if (state != MOBY_STATE_ALTERNATE_REMOVAL_MARKER) { mark_moby_for_removal(spawned); ultramech_scientist_private_data->moby_to_remove_index = -1; } diff --git a/src/overlays/l16/hero/hero_set_state.c b/src/overlays/l16/hero/hero_set_state.c index 200b2e4164..5156c7d308 100644 --- a/src/overlays/l16/hero/hero_set_state.c +++ b/src/overlays/l16/hero/hero_set_state.c @@ -83,9 +83,6 @@ extern char level16_hero_jump_velocity_keys[] __asm__("D_L16_0017C380"); extern char level16_hero_water_surface_jump_velocity_keys[] __asm__("D_L16_0017C3C0"); int hero_set_state(int requested_state, int animation_update_mode) { - enum { - HERO_ANIMATION_UPDATE_GUARD_OVERRIDE = 2 - }; int saved_state_step; char *moby; int old20A7; @@ -94,11 +91,11 @@ int hero_set_state(int requested_state, int animation_update_mode) { struct Hero *p = &hero; if (p->state.control_mode == 0x14 && (requested_state != HERO_STATE_IDLE_ANIMATION_WITH_DYING_OVERRIDE || - animation_update_mode != HERO_ANIMATION_UPDATE_GUARD_OVERRIDE)) + animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS)) return 0; } if ((D_L16_0015F5C4 == 2 || D_L16_0015F5C4 == 6) && - animation_update_mode != HERO_ANIMATION_UPDATE_GUARD_OVERRIDE) + animation_update_mode != HERO_ANIMATION_ENTRY_OVERRIDE_GUARDS) return 0; { struct Hero *p = &hero; diff --git a/src/overlays/shared/enemies/seeker.c b/src/overlays/shared/enemies/seeker.c index 32fb5478a1..0c87395e99 100644 --- a/src/overlays/shared/enemies/seeker.c +++ b/src/overlays/shared/enemies/seeker.c @@ -1,5 +1,6 @@ /* Shared moby class seeker: its update and its damage and target handling. */ #include "types.h" +#include "rnc/mobys/moby_state.h" #include "rnc/globals.h" #include "qzero.h" #include "rnc/mobys/moby.h" @@ -440,10 +441,7 @@ void update_seeker_damage_and_target(Moby *moby) { enum { SEEKER_TARGET_STATUS_LOST = 2 }; - enum { - MOBY_STATE_REMOVAL_MARKED_BELOW_ADDRESS_THRESHOLD = 0xFD, - MOBY_STATE_REMOVAL_MARKED_AT_OR_ABOVE_ADDRESS_THRESHOLD = 0xFE - }; + char hit_pos[16]; int hit; float damage; @@ -576,9 +574,8 @@ void update_seeker_damage_and_target(Moby *moby) { } } else { Moby *target = seeker_vars->f160; - if (target != 0 && - target->state != MOBY_STATE_REMOVAL_MARKED_AT_OR_ABOVE_ADDRESS_THRESHOLD && - target->state != MOBY_STATE_REMOVAL_MARKED_BELOW_ADDRESS_THRESHOLD) { + if (target != 0 && target->state != MOBY_STATE_REMOVAL_MARKER && + target->state != MOBY_STATE_ALTERNATE_REMOVAL_MARKER) { qcopy(seeker_vars->target, &target->pos); } else { seeker_vars->f160 = 0; diff --git a/src/overlays/shared/enemies/spawner.c b/src/overlays/shared/enemies/spawner.c index 27e088bd08..76cc6b4d74 100644 --- a/src/overlays/shared/enemies/spawner.c +++ b/src/overlays/shared/enemies/spawner.c @@ -1,6 +1,7 @@ /* Shared moby class spawner: lobs spawner_egg bubbles towards target regions. */ #include "types.h" +#include "rnc/mobys/moby_state.h" #include "sda.h" #include "qcopy.h" #include "rnc/mobys/moby.h" @@ -123,9 +124,6 @@ int refresh_spawner_population_and_find_free_slot(int unused, char *spawner_vars) __asm__("FUN_L09_0030aae0"); int refresh_spawner_population_and_find_free_slot(int unused, char *spawner_vars) { - enum { - MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE - }; int last = -1; int i; char **slot; @@ -133,7 +131,7 @@ int refresh_spawner_population_and_find_free_slot(int unused, char *spawner_vars for (i = 0, slot = (char **)(spawner_vars + 0xB0); i < 20; i++, slot++) { char *slot_moby = *slot; if (slot_moby != 0 && MOBY(slot_moby)->oclass == 0x75E && - (unsigned char)MOBY(slot_moby)->state != MOBY_STATE_MARKED_FOR_REMOVAL && + (unsigned char)MOBY(slot_moby)->state != MOBY_STATE_REMOVAL_MARKER && (unsigned char)MOBY(slot_moby)->state != 0xFD) { spawner_vars[0x91]++; } else { @@ -150,9 +148,6 @@ void spawner_update(char *moby) __asm__("FUN_L09_0030ab80"); /* Moby class 1885 */ void spawner_update(char *moby) { - enum { - MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE - }; SpawnerVars *spawner_vars = (SpawnerVars *)MOBY(moby)->pvars; float target[4]; float launch_velocity[4]; @@ -197,7 +192,7 @@ void spawner_update(char *moby) { } else { char *target_moby = *(char **)((char *)spawner_vars + 0x140); if (target_moby != 0 && - (unsigned char)MOBY(target_moby)->state != MOBY_STATE_MARKED_FOR_REMOVAL && + (unsigned char)MOBY(target_moby)->state != MOBY_STATE_REMOVAL_MARKER && (unsigned char)MOBY(target_moby)->state != 0xFD) { qcopy((char *)spawner_vars + 0x100, &MOBY(target_moby)->pos); } else { diff --git a/src/overlays/shared/weapons/suckcannon.c b/src/overlays/shared/weapons/suckcannon.c index 3540803ef2..0431964ff6 100644 --- a/src/overlays/shared/weapons/suckcannon.c +++ b/src/overlays/shared/weapons/suckcannon.c @@ -1,6 +1,7 @@ /* Shared moby class suckcannon: the suck cannon, its suction of mobys, the shots it fires and its beam. */ #include "types.h" +#include "rnc/mobys/moby_state.h" #include "rnc/audio/voice_pool.h" #include "rnc/mobys/moby.h" #include "rnc/overlay/shared/world/level_globals.h" @@ -2329,13 +2330,11 @@ int FUN_L00_002dc9f0(struct Moby *moby, char *yaw_turn_state) { SUCK_RECORD_STATE_STORED = 4, SUCK_RECORD_STATE_ROLLING_PROJECTILE = 6 }; - enum { - MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE - }; + Frame_2DDEA0 suction_and_projectile_scratch; R_2DDEA0 *suction_and_projectile_record; - 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) return 0; suction_and_projectile_record = func_L00_002DCD40_2DDEA0(moby); if (suction_and_projectile_record != 0) { @@ -3255,14 +3254,11 @@ void stop_suck_cannon_suction_effect(int callback_context) { void scatter_moby_from_hazards(O_2df1e0 *p) __asm__("FUN_L00_002df1e0"); void scatter_moby_from_hazards(O_2df1e0 *pickup_moby) { - enum { - MOBY_STATE_MARKED_FOR_REMOVAL = 0xFE - }; s32 i; f32 beam_segment_collection_radius; if (pickup_moby == 0) return; - if (pickup_moby->pickup_moby_state == MOBY_STATE_MARKED_FOR_REMOVAL) + if (pickup_moby->pickup_moby_state == MOBY_STATE_REMOVAL_MARKER) return; if (pickup_moby->pickup_moby_state == 0xFD) return; 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 fb539d8701..2e94b3b4e3 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) { mode_freeze_state = 0x11; mode_freeze_flags |= 0x40;