Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ced7fe0
overlay: decompile five level functions from rac1-decomp ports
mateuszklysz Oct 16, 2026
e55fb30
overlay: decompile three more level functions from rac1-decomp ports
mateuszklysz Oct 16, 2026
f249b42
overlay: decompile five more level functions
mateuszklysz Oct 16, 2026
0e9480d
overlay: decompile the giant clank pad and the movie loader
mateuszklysz Oct 16, 2026
cabf6b2
overlay: decompile the mine glove update
mateuszklysz Oct 16, 2026
969d3d8
decomp: bring the sound update draft within 62 instructions of retail
mateuszklysz Oct 16, 2026
8afd0fd
overlay: decompile the L14 vendor fade update and bring the snagglebe…
mateuszklysz Oct 16, 2026
a1a41f8
overlay: bring the walloper reset draft closer
mateuszklysz Oct 16, 2026
db63b39
chore: name ported aliases by their labels and header names
mateuszklysz Oct 16, 2026
c8f6638
chore: name more ported aliases by their labels
mateuszklysz Oct 16, 2026
228c18a
chore: one name for the boot animation and hit helpers in three units
mateuszklysz Oct 16, 2026
a042cb8
Merge remote-tracking branch 'origin/main' into decomp/exact-data-wav…
mateuszklysz Oct 17, 2026
daacdec
chore: one name and type per global in the ported units
mateuszklysz Oct 17, 2026
e8e7ce9
chore: keep main's names in the sound update draft
mateuszklysz Oct 17, 2026
24b2d0e
chore: header names for two more globals
mateuszklysz Oct 17, 2026
3ea7994
chore: merge more duplicate global names
mateuszklysz Oct 17, 2026
3aecb95
chore: real types for the hud star globals
mateuszklysz Oct 17, 2026
771b50d
chore: header type for the help screen global
mateuszklysz Oct 17, 2026
0cc0b6d
chore: real types for the item menu layout globals
mateuszklysz Oct 17, 2026
5a99741
chore: real types and names for bolt thief globals
mateuszklysz Oct 17, 2026
bc67740
chore: header names and types for more shared globals
mateuszklysz Oct 17, 2026
3efb114
chore: last globals get one name and type each
mateuszklysz Oct 17, 2026
87b139d
chore: keep the explicit sdata section on the gs layout global
mateuszklysz Oct 17, 2026
85c5b21
chore: names by use in the hud, map, movie and bomb functions
mateuszklysz Oct 17, 2026
dfdc1ce
chore: names by use in the taxi platform update
mateuszklysz Oct 17, 2026
7aed17c
chore: names by use in the taxi platform update
mateuszklysz Oct 17, 2026
e6be3cf
chore: names by use in the level 8 bomb update
mateuszklysz Oct 17, 2026
7c13780
chore: names by use in the bolt thief update
mateuszklysz Oct 17, 2026
c0c5258
chore: names by use in the level 10 platform update
mateuszklysz Oct 17, 2026
dd87fe7
chore: names by use in the help screen and vendor updates
mateuszklysz Oct 17, 2026
dc8fa03
chore: names by use in the level 13 rocket update
mateuszklysz Oct 17, 2026
5806127
chore: real int and float types for globals declared as short
mateuszklysz Oct 17, 2026
ab14c77
chore: drop duplicate port types and _p name suffixes
mateuszklysz Oct 17, 2026
6653aad
chore: keep main's names in the new functions
mateuszklysz Oct 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@
"shared/rendering/sky/update_sky_shells_animated.c",
"shared/runtime/dma/002b7a48.c",
"shared/ui/help/001fe778.c",
"shared/ui/help/001ff938.c",
"shared/ui/help/00204c60.c",
"shared/ui/help/00215340.c",
"shared/ui/help/0021d0a0.c",
Expand Down
2 changes: 1 addition & 1 deletion scripts/test_public_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ class DataDeclarationTests(unittest.TestCase):
"""No new data label may get a second type or name (scripts/data-decls.py)."""

# Labels that still disagree; lower it when you fix some, never raise it.
KNOWN_CONFLICTS = 602
KNOWN_CONFLICTS = 600

def test_no_new_conflicting_declarations(self):
decls = load_module("rnc_data_decls", ROOT / "scripts" / "data-decls.py")
Expand Down
79 changes: 40 additions & 39 deletions src/assembly/textbin/audio/voices/sound_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ extern void voice_update_callback() __asm__("FUN_0022ddd8");
s32 sound_update(void) __asm__("FUN_0022ca50");

s32 sound_update(void) {
VoiceSlot *voices;
VoiceVector listener_occlusion_position;
VoiceVector listener_velocity;
VoiceVector relative_velocity;
Expand All @@ -133,6 +134,8 @@ s32 sound_update(void) {
VoiceMoby *moby;
f32 water_height;
s32 history_index;
s32 divisor;
s32 current_index;
s32 previous_history_index;
s32 listener_sample_count;
s32 group_volume;
Expand Down Expand Up @@ -172,26 +175,26 @@ s32 sound_update(void) {
}

qzero(&listener_velocity);
{
s32 *history_position = &D_0013E550.listener_history_position;
history_index = D_0013E550.listener_history_position + 1;
history_index %= 4;
*history_position = history_index;
}
history_index = D_0013E550.listener_history_position + 1;
history_index %= 4;
D_0013E550.listener_history_position = history_index;
qcopy(&D_0013E550.listener_history[history_index], &D_00187080);
previous_history_index = (history_index + 3) % 4;

listener_sample_count = 0;
if (previous_history_index != history_index) {
divisor = 18;
current_index = history_index;
previous_history_index = (current_index + 3) % 4;
if (previous_history_index != current_index) {
do {
subtract_vector_xyz(&relative_velocity, &D_0013E550.listener_history[history_index],
subtract_vector_xyz(&relative_velocity, &D_0013E550.listener_history[current_index],
&D_0013E550.listener_history[previous_history_index]);
if (!(vector_length_xyz(&relative_velocity) < frame_time * 60.0f)) {
break;
}
listener_sample_count++;
add_vector_xyz(&listener_velocity, &listener_velocity, &relative_velocity);
history_index = previous_history_index;
previous_history_index = (history_index + 3) % 4;
current_index = previous_history_index;
previous_history_index = (current_index + 3) % 4;
} while (previous_history_index != D_0013E550.listener_history_position);
}
if (listener_sample_count >= 2) {
Expand Down Expand Up @@ -288,37 +291,34 @@ s32 sound_update(void) {
if (!(D_0013E550.voices[slot_index].flags & 0x10)) {
distance_volume = calculate_voice_volume(&D_0013E550.voices[slot_index],
&D_0013E550.voices[slot_index].position);
volumes[slot_index] = distance_volume * D_0013E550.voices[slot_index].volume / 1024;
voice_volumes[slot_index] = distance_volume * D_0013E550.voices[slot_index].volume / 1024;
if (!(D_0013E550.voices[slot_index].definition->attenuation_flags & 2)) {
voice_flags[slot_index] |= 8;
}
} else {
distance_volume = 0x400;
volumes[slot_index] = D_0013E550.voices[slot_index].volume;
voice_volumes[slot_index] = D_0013E550.voices[slot_index].volume;
}
if (underwater && !(D_0013E550.voices[slot_index].definition->attenuation_flags & 4) &&
water_height < D_0013E550.voices[slot_index].position.f[2]) {
volumes[slot_index] /= 2;
voice_volumes[slot_index] /= 2;
}
voice_flags[slot_index] |= 1;
if (distance_volume < 0x20 && volumes[slot_index] < 0x20 &&
if (distance_volume < 0x20 && voice_volumes[slot_index] < 0x20 &&
(D_0013E550.voices[slot_index].flags & 4)) {
voice_flags[slot_index] = 0x20;
continue;
}
{
u8 slot_flags = D_0013E550.voices[slot_index].flags;
if (((slot_flags ^ 1) & 1) != 0) {
voice_flags[slot_index] |= 2;
if (!(D_0013E550.voices[slot_index].flags & 0x20)) {
voice_flags[slot_index] |= 4;
}
if ((D_0013E550.voices[slot_index].flags & 1) != 1) {
voice_flags[slot_index] |= 2;
if (!(D_0013E550.voices[slot_index].flags & 0x20)) {
voice_flags[slot_index] |= 4;
}
}
}

occlusion_history = D_0013E550.voices[0].occlusion_history;
for (slot_index = 0; slot_index < 30; slot_index++, occlusion_history += sizeof(VoiceSlot)) {
voices = D_0013E550.voices;
for (slot_index = 0; slot_index < 30; slot_index++) {
if (!(voice_flags[slot_index] & 8)) {
continue;
}
Expand All @@ -328,14 +328,13 @@ s32 sound_update(void) {
}
occluded_samples = 0;
if (world_update_time != D_0013E550.occlusion_frame) {
for (sample_index = 5; sample_index >= 0; sample_index--) {
for (sample_index = 0; sample_index < 6; sample_index++) {
clamp_voice_position_to_collision(
&D_0013E550.occlusion_samples[5 - sample_index]);
&D_0013E550.occlusion_samples[sample_index]);
}
D_0013E550.occlusion_frame = world_update_time;
}
sample_index = 0;
for (history_offset = 0; history_offset < 36;
for (history_offset = 0, sample_index = 0; history_offset < 36;
history_offset += 6, sample_index++) {
D_0013E550.voices[slot_index].occlusion_history[history_offset] =
test_voice_occlusion(&D_0013E550.voices[slot_index],
Expand All @@ -349,9 +348,9 @@ s32 sound_update(void) {
}
}
if (occluded_samples >= 36) {
volumes[slot_index] = 0;
voice_volumes[slot_index] = 0;
} else if (occluded_samples >= 19) {
volumes[slot_index] = (36 - occluded_samples) * volumes[slot_index] / 18;
voice_volumes[slot_index] = (36 - occluded_samples) * voice_volumes[slot_index] / divisor;
}
} else {
if ((game_mode == 0 || game_mode == 2) && boot_level_active == 0) {
Expand All @@ -374,12 +373,14 @@ s32 sound_update(void) {
[(D_0013E550.voices[slot_index].occlusion_history_position + 35) % 36];
}
}
occluded_samples =
ComputeByteStringHash(occlusion_history, 36);
if (occluded_samples >= 36) {
volumes[slot_index] = 0;
} else if (occluded_samples >= 19) {
volumes[slot_index] = (36 - occluded_samples) * volumes[slot_index] / 18;
{
s32 occluded =
ComputeByteStringHash(voices[slot_index].occlusion_history, 36);
if (occluded >= 36) {
voice_volumes[slot_index] = 0;
} else if (occluded >= 19) {
voice_volumes[slot_index] = (36 - occluded) * voice_volumes[slot_index] / divisor;
}
}
}
}
Expand All @@ -394,9 +395,9 @@ s32 sound_update(void) {
D_0013E550.voices[slot_index].handle = -1;
if (command_flags & 0x20) {
if (D_0013E550.voices[slot_index].state == 7) {
D_0013E550.voices[slot_index].state = 0;
D_0013E550.voices[slot_index].moby = NULL;
D_0013E550.voices[slot_index].owner_context = 0;
D_0013E550.voices[slot_index].state = 0;
} else {
snd_stop_sound(handle);
D_0013E550.voices[slot_index].state = 6;
Expand Down Expand Up @@ -426,14 +427,14 @@ s32 sound_update(void) {
pitch_modifier -= 0x5F4;
}
if (D_0013E550.voices[slot_index].state != 7) {
snd_set_sound_params_cb(handle, parameter_mask, volumes[slot_index], pan,
snd_set_sound_params_cb(handle, parameter_mask, voice_volumes[slot_index], pan,
pitch_modifier, pitch_bend, voice_update_callback,
&D_0013E550.voices[slot_index]);
} else {
D_0013E550.voices[slot_index].state = 1;
snd_play_sound_vol_pan_pmpb(D_0013E550.voices[slot_index].definition->bank_handle,
D_0013E550.voices[slot_index].definition->sound_index,
volumes[slot_index], pan, pitch_modifier, pitch_bend,
voice_volumes[slot_index], pan, pitch_modifier, pitch_bend,
voice_start_callback, &D_0013E550.voices[slot_index]);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/overlays/l00/gameplay/entities/veldin_robot_enemy.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ extern f32 D_L00_00161BE4 __attribute__((sda));
s32 D_L00_00161BE8 = 3;
extern f32 D_L00_00161BEC __attribute__((sda));
extern VendVec D_L00_00166DC0;
extern s32 D_001413D0 NOT_SDA;
extern s32 D_001413D0_lui[] __asm__("D_001413D0") NOT_SDA;
extern VendHit D_L00_00173E58;
extern VendPath *vend_paths[] __asm__("D_L00_001B04B0");
extern s32 D_L00_0015F580[] MACRO_ADDR;
Expand Down Expand Up @@ -368,14 +368,14 @@ void FUN_L00_002e0b88(VendMoby *moby) {
qcopy(&probe, &moby->pos);
probe.f[2] += 0.5f;
if (FUN_001efa68(&mtx[3], &probe, 0, moby, &query) != 0 && hit != 0 &&
D_L00_00173E58.moby == D_001413D0) {
D_L00_00173E58.moby == (*(s32 *)&D_001413D0_lui)) {
vend_2040(moby);
moby->state = 6;
VEND_ANIM(moby, 7, vend_rand(10));
}
if (FUN_001efa68(&mtx[3], &dir, 0, moby, &query) != 0) {
qcopy(&dir, D_L00_00173E58.pos);
if (hit != 0 && D_L00_00173E58.moby == D_001413D0) {
if (hit != 0 && D_L00_00173E58.moby == (*(s32 *)&D_001413D0_lui)) {
vend_2040(moby);
moby->state = 6;
VEND_ANIM(moby, 7, vend_rand(10));
Expand Down
24 changes: 12 additions & 12 deletions src/overlays/l03/gameplay/entities/taxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ typedef struct {
} G_2da710;

extern int D_L03_0015F5C4;
extern unsigned char D_0015EDB0;
#include "rnc/gameplay/state/options.h"
extern float D_L03_0015F5A0;
extern G_2da710 D_L03_0016C960;
extern char D_L03_0017C540[];
Expand All @@ -1160,7 +1160,7 @@ void FUN_L03_002da710(struct Moby *m) {
char *s;
int i;

if (D_L03_0015F5C4 == 2 && D_0015EDB0 != 0) {
if (D_L03_0015F5C4 == 2 && big_head_cheat_enabled != 0) {
if (D_L03_0016C960.mode == 2 && D_L03_0016C960.t >= 0x1EA && D_L03_0016C960.t < 0x266) {
D_L03_0015F5A0 = -0.2f;
}
Expand Down Expand Up @@ -1222,7 +1222,7 @@ extern struct Moby *D_L03_0015FFD8;
extern s32 D_L03_0015FFD8_i __asm__("D_L03_0015FFD8");
extern s32 D_L03_001BA720[];
extern char D_L03_00161BB8[];
extern u8 D_0014C050[];
#include "rnc/gameplay/state/game_globals.h"
extern u8 D_L03_0015FC88[];
extern L03LevelState D_L03_001BA6D0;
extern char *D_L03_001600EC;
Expand Down Expand Up @@ -1282,7 +1282,7 @@ void FUN_L03_002da870(struct Moby *m) {
taxi_kill(m);
return;
}
if (D_0014C050[m->mission + current_level_index * 16] == 0xFF && v->link != -1) {
if (visited52[m->mission + current_level_index * 16] == 0xFF && v->link != -1) {
t = (struct Moby *)((v->link << 8) + D_L03_0015FFD8_i);
if (t->oclass == 0x3F4) {
flag = (s32 *)(t->pvars + 0x8C);
Expand Down Expand Up @@ -1345,7 +1345,7 @@ void FUN_L03_002da870(struct Moby *m) {
do {
group = o->mission;
} while (0);
if (D_L03_0015FC88[group] != 0xFF && D_0014C050[group + current_level_index * 16] == 0xFF) {
if (D_L03_0015FC88[group] != 0xFF && visited52[group + current_level_index * 16] == 0xFF) {
/* Fakematch: see above. */
do {
record:
Expand Down Expand Up @@ -1429,7 +1429,7 @@ void FUN_L03_002da870(struct Moby *m) {
v->pitch = pitch;
v->yaw = yaw * 0.5f;
}
if (D_0015EDB0)
if (big_head_cheat_enabled)
v->height = 2.75f;
FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, v->body, 0);
FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, v->head, 1);
Expand Down Expand Up @@ -1610,7 +1610,7 @@ extern u8 D_0013D4C2[];
extern char *D_001413D0_db558[] __asm__("D_001413D0");
extern struct Moby *D_L03_0015FFD8;
extern s32 D_L03_0015FFD8_i __asm__("D_L03_0015FFD8");
extern u8 D_0014C050[];
#include "rnc/gameplay/state/game_globals.h"
extern char *D_L03_001600EC;
extern float frame_scale_sq __asm__("D_0015ED64");
extern void FUN_L03_002db480(struct Moby *);
Expand Down Expand Up @@ -1660,7 +1660,7 @@ void FUN_L03_002db558(struct Moby *m) {
} else {
v->turned = 1;
}
if (D_0014C050[m->mission + current_level_index * 16] == 0xFF && v->link != -1) {
if (visited52[m->mission + current_level_index * 16] == 0xFF && v->link != -1) {
t = (struct Moby *)((v->link << 8) + D_L03_0015FFD8_i);
if (t->oclass == 0x3F4) {
*(s32 *)(t->pvars + 0x8C) = 1;
Expand All @@ -1685,13 +1685,13 @@ void FUN_L03_002db558(struct Moby *m) {
{
s32 k = o->mission;
u32 u = k & 0xFF;
if (k == 0xFF || (D_L03_0015FC88[u] != 0xFF && D_0014C050[u + current_level_index * 16] == 0xFF)) {
if (k == 0xFF || (D_L03_0015FC88[u] != 0xFF && visited52[u + current_level_index * 16] == 0xFF)) {
D_L03_001BB330.collected[(s16)o->save_id] = k + 2;
}
}
}
}
if (item_available[2] != 0 && D_0014C050[m->mission + current_level_index * 16] == 0xFF) {
if (item_available[2] != 0 && visited52[m->mission + current_level_index * 16] == 0xFF) {
break;
}
if (FUN_L00_00266448(m, (struct TalkState *)&v->talk)) {
Expand Down Expand Up @@ -1741,7 +1741,7 @@ void FUN_L03_002db558(struct Moby *m) {
do {
group = o->mission;
} while (0);
if (D_L03_0015FC88[group] != 0xFF && D_0014C050[group + current_level_index * 16] == 0xFF) {
if (D_L03_0015FC88[group] != 0xFF && visited52[group + current_level_index * 16] == 0xFF) {
rec2:
D_L03_001BB330.collected[(s16)o->save_id] = o->mission + 2;
}
Expand Down Expand Up @@ -1805,7 +1805,7 @@ void FUN_L03_002db558(struct Moby *m) {
v->head.pitch = pitch;
v->body.yaw = v->head.yaw = yaw * 0.5f;
}
if (D_0015EDB0)
if (big_head_cheat_enabled)
v->head.height = 2.75f;
FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, &v->head, 1);
FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, &v->body, 0);
Expand Down
11 changes: 4 additions & 7 deletions src/overlays/l04/gameplay/entities/big_axebot.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ extern void normalize_vector_triplet(void *) __asm__("FUN_00214128");
extern void refresh_moby_spatial_bounds_from_basis(void *);
extern void tick_countdown_32(int *counter);
void FUN_L04_002ba3e0(char *arg, void *a, void *b, void *c);
extern char D_0013F350[];
extern P_B7B0 *D_L04_001B0930_B7B0[] __asm__("D_L04_001B0630");

void FUN_L04_002ba520(M_B7B0 *moby) {
Expand Down Expand Up @@ -1232,7 +1231,7 @@ extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68");
extern void subtract_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a28");
extern void func_L00_00260D30_k(void *, void *, float) __asm__("FUN_L00_0025fcb8");

extern short D_L04_00161884 __attribute__((sda));
extern float D_L04_00161884 __attribute__((sda));
float FUN_L04_002c1fb8(struct Moby *moby, void *out, float speed) {
float away[4];
float target[4];
Expand All @@ -1259,9 +1258,9 @@ float FUN_L04_002c1fb8(struct Moby *moby, void *out, float speed) {
if (other == moby || *(short *)(other + 0xA6) != moby->oclass) continue;
if (FUN_001f9b80((float *)(other + 0x10), (float *)&moby->pos) < 3.0f) {
subtract_vector_xyz_c(away, &moby->pos, other + 0x10);
scale_vector_xyz(away, away, *(float *)&D_L04_00161884);
scale_vector_xyz(away, away, D_L04_00161884);
add_vector_xyz_c(out, out, away);
weight += *(float *)&D_L04_00161884;
weight += D_L04_00161884;
}
if (FUN_001f9b80((float *)(other + 0x10), target) < target_dist) is_closest = 0;
}
Expand Down Expand Up @@ -1518,7 +1517,6 @@ extern void subtract_vector_xyz(void *dst, void *a, void *b);
extern void transform_vector_by_basis(void *, void *, void *);
int FUN_L04_002c1e98(struct Moby *moby);
void FUN_L04_002c1d70(struct Moby *moby);
extern char D_0013F350[];
extern char D_0013E550[];
extern void *func_L00_0025B478_2C35F0(void *, int, int) __asm__("FUN_L00_0025a420");
extern void func_L00_002592B0_b(char *moby, float target, float *vel, float k, float d,
Expand Down Expand Up @@ -1556,7 +1554,7 @@ void FUN_L04_002c2270(M_35F0 *moby) {
moby->f30 = 0x20;
FUN_L04_002c1b80((struct Moby *)moby);
if (moby->state == 1 || moby->state == 3) {
H_35F0 *h = (H_35F0 *)(((char *)&D_0013F350));
H_35F0 *h = (H_35F0 *)(((char *)((char *)&hero)));
if (h->f240 == moby || FUN_001f9b48(moby->pos, h->pos) < 1.5f) {
blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10));
data->f146 = scale_game_frames(0x3C);
Expand Down Expand Up @@ -2269,7 +2267,6 @@ extern void refresh_moby_spatial_bounds_from_basis(void *);
extern void subtract_vector_xyz(void *dst, void *a, void *b);
extern void tick_countdown_32(int *counter);
void FUN_L04_002c4808_c(char *arg) __asm__("FUN_L04_002c4808");
extern char D_0013F350[];
extern int func_L00_002594C8_o(void *, void *, void *, float, float, float, float,
int) __asm__("FUN_L00_00258490");

Expand Down
Loading
Loading