From ddff4f888c2320fc17ad3e8dfca7401d296f63d3 Mon Sep 17 00:00:00 2001 From: itsgrimetime <990274+itsgrimetime@users.noreply.github.com> Date: Wed, 31 Dec 2025 17:17:31 -0800 Subject: [PATCH 1/4] vi1202: Add vi1202_ViData struct for Fighter_804D6500 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fighter_804D6500 is not a Fighter - it's vi/cutscene related global data. Add proper struct type and replace M2C_FIELD macro calls with struct field access for better readability. - Add vi1202_ViData struct documenting fields at offsets 0x0-0x40 - Replace M2C_FIELD(Fighter_804D6500, ...) with struct access - Rename local 'fighter' variables to 'vdata' to reflect actual type - All function matches maintained at original levels Addresses PR review feedback about using proper struct types. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/melee/vi/vi1202.c | 88 ++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 34 deletions(-) diff --git a/src/melee/vi/vi1202.c b/src/melee/vi/vi1202.c index 67541bf01a..78590799c6 100644 --- a/src/melee/vi/vi1202.c +++ b/src/melee/vi/vi1202.c @@ -29,6 +29,26 @@ struct vi1202_UnkStruct { /* 0x2C */ s32 x2C; }; +/// Fighter_804D6500 is not a Fighter - it's vi/cutscene related global data +typedef struct vi1202_ViData { + /* 0x00 */ f32 x0; + /* 0x04 */ f32 x4; + /* 0x08 */ f32 x8; + /* 0x0C */ f32 xC; + /* 0x10 */ f32 x10; + /* 0x14 */ f32 x14; + /* 0x18 */ u8 pad18[0x20 - 0x18]; + /* 0x20 */ s32 x20; + /* 0x24 */ s32 x24; + /* 0x28 */ s32 x28; + /* 0x2C */ f32 x2C; + /* 0x30 */ f32 x30; + /* 0x34 */ f32 x34; + /* 0x38 */ f32 x38; + /* 0x3C */ s32 x3C; + /* 0x40 */ f32 x40; +} vi1202_ViData; + void un_8032110C(HSD_GObj* gobj) { HSD_JObjAnimAll(GET_JOBJ(gobj)); @@ -80,9 +100,9 @@ void un_80321950(vi1202_UnkStruct* s) s->x4 = 0x10000; s->x8 = 1.0F; s->xC = 0; - s->x10 = M2C_FIELD(Fighter_804D6500, s32*, 0x20); + s->x10 = ((vi1202_ViData*)Fighter_804D6500)->x20; s->x14 = 0x83D60; - s->x18 = M2C_FIELD(Fighter_804D6500, s32*, 0x28); + s->x18 = ((vi1202_ViData*)Fighter_804D6500)->x28; s->x1C = 0; s->x20 = 0; s->x24 = 0; @@ -104,10 +124,10 @@ void un_80321A00(HSD_GObj* gobj) { s32 zero; vi1202_UnkStruct* data = un_804D7050; - void* fighter = Fighter_804D6500; + void* vdata = Fighter_804D6500; - if (data->x18 >= M2C_FIELD(fighter, s32*, 0x28)) { - if (data->x10 < M2C_FIELD(fighter, s32*, 0x20)) { + if (data->x18 >= ((vi1202_ViData*)vdata)->x28) { + if (data->x10 < ((vi1202_ViData*)vdata)->x20) { data->x10 = data->x10 + 1; } return; @@ -118,12 +138,12 @@ void un_80321A00(HSD_GObj* gobj) } data->x18 = data->x18 + 1; - if (data->x18 < M2C_FIELD(Fighter_804D6500, s32*, 0x28)) { + if (data->x18 < ((vi1202_ViData*)Fighter_804D6500)->x28) { if (data->x1C != 0) { zero = 0; data->x1C = zero; data->x10 = zero; - data->x18 = M2C_FIELD(Fighter_804D6500, s32*, 0x28); + data->x18 = ((vi1202_ViData*)Fighter_804D6500)->x28; un_80321C28(); if (data->x20 != 0) { un_80321CA4(0x144); @@ -171,8 +191,8 @@ void un_80321AF4(HSD_GObj* gobj) cur = cur->next; } - if (old_x24 < M2C_FIELD(Fighter_804D6500, s32*, 0x3C)) { - if (data->x24 >= M2C_FIELD(Fighter_804D6500, s32*, 0x3C)) { + if (old_x24 < ((vi1202_ViData*)Fighter_804D6500)->x3C) { + if (data->x24 >= ((vi1202_ViData*)Fighter_804D6500)->x3C) { if (flag != 0) { un_8032201C(data->xC, 3); } else { @@ -202,12 +222,12 @@ void un_80321C28(void) void un_80321C70(void) { vi1202_UnkStruct* data = un_804D7050; - void* fighter = Fighter_804D6500; + void* vdata = Fighter_804D6500; s32 x18 = data->x18; - if (x18 >= M2C_FIELD(fighter, s32*, 0x28)) { + if (x18 >= ((vi1202_ViData*)vdata)->x28) { return; } - if (x18 >= M2C_FIELD(fighter, s32*, 0x24)) { + if (x18 >= ((vi1202_ViData*)vdata)->x24) { data->x1C = 1; } } @@ -259,12 +279,12 @@ void un_8032201C(int arg0, s32 cat) break; } - if ((u32) arg0 != 0) { - if ((u32) data->xC == (u32) arg0) { - void* fighter = Fighter_804D6500; + if ((u32)arg0 != 0) { + if ((u32) data->xC == (u32)arg0) { + void* vdata = Fighter_804D6500; vi1202_UnkStruct* data2 = un_804D7050; - if (data2->x18 < M2C_FIELD(fighter, s32*, 0x28)) { - if (data2->x18 >= M2C_FIELD(fighter, s32*, 0x24)) { + if (data2->x18 < ((vi1202_ViData*)vdata)->x28) { + if (data2->x18 >= ((vi1202_ViData*)vdata)->x24) { data2->x1C = 1; } } @@ -315,7 +335,7 @@ void un_80322178(int arg) bool un_80322258(float arg) { - f32 val2c = M2C_FIELD(Fighter_804D6500, f32*, 0x2c); + f32 val2c = ((vi1202_ViData*)Fighter_804D6500)->x2C; f32 val18 = M2C_FIELD(mpLib_80458868, f32*, 0x18); f32 val1c; if (arg >= val2c + val18) { @@ -330,14 +350,14 @@ bool un_80322258(float arg) s32 un_80322298(float arg) { - void* fighter = Fighter_804D6500; - if (arg >= M2C_FIELD(fighter, f32*, 0x8)) { + void* vdata = Fighter_804D6500; + if (arg >= ((vi1202_ViData*)vdata)->x8) { return 3; } - if (arg >= M2C_FIELD(fighter, f32*, 0x4)) { + if (arg >= ((vi1202_ViData*)vdata)->x4) { return 2; } - if (arg >= M2C_FIELD(fighter, f32*, 0x0)) { + if (arg >= ((vi1202_ViData*)vdata)->x0) { return 1; } return 0; @@ -345,21 +365,21 @@ s32 un_80322298(float arg) f32 un_803222EC(f32 arg1, f32 arg2) { - void* fighter = Fighter_804D6500; - if (!(arg2 > M2C_FIELD(fighter, f32*, 0xc))) { + void* vdata = Fighter_804D6500; + if (!(arg2 > ((vi1202_ViData*)vdata)->xC)) { return arg1; } - if (!(arg2 < M2C_FIELD(fighter, f32*, 0x10))) { + if (!(arg2 < ((vi1202_ViData*)vdata)->x10)) { return arg1; } - return arg1 * M2C_FIELD(fighter, f32*, 0x14); + return arg1 * ((vi1202_ViData*)vdata)->x14; } void un_80322314(void) { vi1202_UnkStruct* data = un_804D7050; - void* fighter = Fighter_804D6500; - if (data->x18 >= M2C_FIELD(fighter, s32*, 0x28)) { + void* vdata = Fighter_804D6500; + if (data->x18 >= ((vi1202_ViData*)vdata)->x28) { return; } data->x1C = 1; @@ -410,18 +430,18 @@ int un_80322598(int arg0, float arg1) { f32 val14 = M2C_FIELD(mpLib_80458868, f32*, 0x14); s32 cat; - void* fighter; + void* vdata; if (arg1 >= val14) { goto ret_zero; } - fighter = Fighter_804D6500; - if (arg1 < M2C_FIELD(fighter, f32*, 0x38) + val14) { - ret_zero: + vdata = Fighter_804D6500; + if (arg1 < ((vi1202_ViData*)vdata)->x38 + val14) { +ret_zero: return 0; } - if (arg1 > M2C_FIELD(fighter, f32*, 0x30) + val14) { + if (arg1 > ((vi1202_ViData*)vdata)->x30 + val14) { cat = 3; - } else if (arg1 > M2C_FIELD(fighter, f32*, 0x34) + val14) { + } else if (arg1 > ((vi1202_ViData*)vdata)->x34 + val14) { cat = 2; } else { cat = 1; From 73cb743d71b3fe43298018a5b1d0501b464457c1 Mon Sep 17 00:00:00 2001 From: itsgrimetime <990274+itsgrimetime@users.noreply.github.com> Date: Wed, 31 Dec 2025 17:25:54 -0800 Subject: [PATCH 2/4] vi1202: Move Fighter_804D6500 declaration to vi1202.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move vi1202_ViData struct and Fighter_804D6500 extern to vi1202.h - Remove declaration from fighter.h and update definition in fighter.c - Replace all casts with direct struct field access 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/melee/ft/fighter.c | 2 +- src/melee/ft/fighter.h | 1 - src/melee/vi/vi1202.c | 86 ++++++++++++++++-------------------------- src/melee/vi/vi1202.h | 21 +++++++++++ 4 files changed, 54 insertions(+), 56 deletions(-) diff --git a/src/melee/ft/fighter.c b/src/melee/ft/fighter.c index 4351612445..a444d4bc75 100644 --- a/src/melee/ft/fighter.c +++ b/src/melee/ft/fighter.c @@ -127,7 +127,7 @@ u32 Fighter_804D64F8 = 0; // the following seems to be an array, initialized in reverse in struct Fighter_804D64FC_t* Fighter_804D64FC = NULL; -UNK_T Fighter_804D6500 = NULL; +vi1202_ViData* Fighter_804D6500 = NULL; HSD_Joint* Fighter_804D6504 = NULL; u8* Fighter_804D6508 = NULL; u8* Fighter_804D650C = NULL; diff --git a/src/melee/ft/fighter.h b/src/melee/ft/fighter.h index 5ee7162829..b5324aa598 100644 --- a/src/melee/ft/fighter.h +++ b/src/melee/ft/fighter.h @@ -75,7 +75,6 @@ struct plAllocInfo; /* 459080 */ extern HSD_ObjAllocData fighter_x2040_alloc_data; /* 4590AC */ extern HSD_ObjAllocData fighter_x59C_alloc_data; /* 4598B8 */ extern ftData* gFtDataList[FTKIND_MAX]; -/* 4D6500 */ extern UNK_T Fighter_804D6500; /* 4D6504 */ extern HSD_Joint* Fighter_804D6504; /* 4D6508 */ extern u8* Fighter_804D6508; /* 4D650C */ extern u8* Fighter_804D650C; diff --git a/src/melee/vi/vi1202.c b/src/melee/vi/vi1202.c index 78590799c6..cc2e7898a4 100644 --- a/src/melee/vi/vi1202.c +++ b/src/melee/vi/vi1202.c @@ -29,26 +29,6 @@ struct vi1202_UnkStruct { /* 0x2C */ s32 x2C; }; -/// Fighter_804D6500 is not a Fighter - it's vi/cutscene related global data -typedef struct vi1202_ViData { - /* 0x00 */ f32 x0; - /* 0x04 */ f32 x4; - /* 0x08 */ f32 x8; - /* 0x0C */ f32 xC; - /* 0x10 */ f32 x10; - /* 0x14 */ f32 x14; - /* 0x18 */ u8 pad18[0x20 - 0x18]; - /* 0x20 */ s32 x20; - /* 0x24 */ s32 x24; - /* 0x28 */ s32 x28; - /* 0x2C */ f32 x2C; - /* 0x30 */ f32 x30; - /* 0x34 */ f32 x34; - /* 0x38 */ f32 x38; - /* 0x3C */ s32 x3C; - /* 0x40 */ f32 x40; -} vi1202_ViData; - void un_8032110C(HSD_GObj* gobj) { HSD_JObjAnimAll(GET_JOBJ(gobj)); @@ -100,9 +80,9 @@ void un_80321950(vi1202_UnkStruct* s) s->x4 = 0x10000; s->x8 = 1.0F; s->xC = 0; - s->x10 = ((vi1202_ViData*)Fighter_804D6500)->x20; + s->x10 = Fighter_804D6500->x20; s->x14 = 0x83D60; - s->x18 = ((vi1202_ViData*)Fighter_804D6500)->x28; + s->x18 = Fighter_804D6500->x28; s->x1C = 0; s->x20 = 0; s->x24 = 0; @@ -124,10 +104,10 @@ void un_80321A00(HSD_GObj* gobj) { s32 zero; vi1202_UnkStruct* data = un_804D7050; - void* vdata = Fighter_804D6500; + vi1202_ViData* vdata = Fighter_804D6500; - if (data->x18 >= ((vi1202_ViData*)vdata)->x28) { - if (data->x10 < ((vi1202_ViData*)vdata)->x20) { + if (data->x18 >= vdata->x28) { + if (data->x10 < vdata->x20) { data->x10 = data->x10 + 1; } return; @@ -138,12 +118,12 @@ void un_80321A00(HSD_GObj* gobj) } data->x18 = data->x18 + 1; - if (data->x18 < ((vi1202_ViData*)Fighter_804D6500)->x28) { + if (data->x18 < Fighter_804D6500->x28) { if (data->x1C != 0) { zero = 0; data->x1C = zero; data->x10 = zero; - data->x18 = ((vi1202_ViData*)Fighter_804D6500)->x28; + data->x18 = Fighter_804D6500->x28; un_80321C28(); if (data->x20 != 0) { un_80321CA4(0x144); @@ -177,9 +157,7 @@ void un_80321AF4(HSD_GObj* gobj) if (ftLib_8008731C(cur) == 0) { ftLib_80086644(cur, &pos); - if (pos.y < M2C_FIELD(Fighter_804D6500, f32*, 0x40) + - M2C_FIELD(mpLib, f32*, 0x14)) - { + if (pos.y < Fighter_804D6500->x40 + M2C_FIELD(mpLib, f32*, 0x14)) { data->x24 = data->x24 + 1; } else { if ((u32) data->xC == ftLib_80087460(cur)) { @@ -191,8 +169,8 @@ void un_80321AF4(HSD_GObj* gobj) cur = cur->next; } - if (old_x24 < ((vi1202_ViData*)Fighter_804D6500)->x3C) { - if (data->x24 >= ((vi1202_ViData*)Fighter_804D6500)->x3C) { + if (old_x24 < Fighter_804D6500->x3C) { + if (data->x24 >= Fighter_804D6500->x3C) { if (flag != 0) { un_8032201C(data->xC, 3); } else { @@ -222,12 +200,12 @@ void un_80321C28(void) void un_80321C70(void) { vi1202_UnkStruct* data = un_804D7050; - void* vdata = Fighter_804D6500; + vi1202_ViData* vdata = Fighter_804D6500; s32 x18 = data->x18; - if (x18 >= ((vi1202_ViData*)vdata)->x28) { + if (x18 >= vdata->x28) { return; } - if (x18 >= ((vi1202_ViData*)vdata)->x24) { + if (x18 >= vdata->x24) { data->x1C = 1; } } @@ -280,11 +258,11 @@ void un_8032201C(int arg0, s32 cat) } if ((u32)arg0 != 0) { - if ((u32) data->xC == (u32)arg0) { - void* vdata = Fighter_804D6500; + if ((u32)data->xC == (u32)arg0) { + vi1202_ViData* vdata = Fighter_804D6500; vi1202_UnkStruct* data2 = un_804D7050; - if (data2->x18 < ((vi1202_ViData*)vdata)->x28) { - if (data2->x18 >= ((vi1202_ViData*)vdata)->x24) { + if (data2->x18 < vdata->x28) { + if (data2->x18 >= vdata->x24) { data2->x1C = 1; } } @@ -335,7 +313,7 @@ void un_80322178(int arg) bool un_80322258(float arg) { - f32 val2c = ((vi1202_ViData*)Fighter_804D6500)->x2C; + f32 val2c = Fighter_804D6500->x2C; f32 val18 = M2C_FIELD(mpLib_80458868, f32*, 0x18); f32 val1c; if (arg >= val2c + val18) { @@ -350,14 +328,14 @@ bool un_80322258(float arg) s32 un_80322298(float arg) { - void* vdata = Fighter_804D6500; - if (arg >= ((vi1202_ViData*)vdata)->x8) { + vi1202_ViData* vdata = Fighter_804D6500; + if (arg >= vdata->x8) { return 3; } - if (arg >= ((vi1202_ViData*)vdata)->x4) { + if (arg >= vdata->x4) { return 2; } - if (arg >= ((vi1202_ViData*)vdata)->x0) { + if (arg >= vdata->x0) { return 1; } return 0; @@ -365,21 +343,21 @@ s32 un_80322298(float arg) f32 un_803222EC(f32 arg1, f32 arg2) { - void* vdata = Fighter_804D6500; - if (!(arg2 > ((vi1202_ViData*)vdata)->xC)) { + vi1202_ViData* vdata = Fighter_804D6500; + if (!(arg2 > vdata->xC)) { return arg1; } - if (!(arg2 < ((vi1202_ViData*)vdata)->x10)) { + if (!(arg2 < vdata->x10)) { return arg1; } - return arg1 * ((vi1202_ViData*)vdata)->x14; + return arg1 * vdata->x14; } void un_80322314(void) { vi1202_UnkStruct* data = un_804D7050; - void* vdata = Fighter_804D6500; - if (data->x18 >= ((vi1202_ViData*)vdata)->x28) { + vi1202_ViData* vdata = Fighter_804D6500; + if (data->x18 >= vdata->x28) { return; } data->x1C = 1; @@ -430,18 +408,18 @@ int un_80322598(int arg0, float arg1) { f32 val14 = M2C_FIELD(mpLib_80458868, f32*, 0x14); s32 cat; - void* vdata; + vi1202_ViData* vdata; if (arg1 >= val14) { goto ret_zero; } vdata = Fighter_804D6500; - if (arg1 < ((vi1202_ViData*)vdata)->x38 + val14) { + if (arg1 < vdata->x38 + val14) { ret_zero: return 0; } - if (arg1 > ((vi1202_ViData*)vdata)->x30 + val14) { + if (arg1 > vdata->x30 + val14) { cat = 3; - } else if (arg1 > ((vi1202_ViData*)vdata)->x34 + val14) { + } else if (arg1 > vdata->x34 + val14) { cat = 2; } else { cat = 1; diff --git a/src/melee/vi/vi1202.h b/src/melee/vi/vi1202.h index 579d4b55db..82828dc76e 100644 --- a/src/melee/vi/vi1202.h +++ b/src/melee/vi/vi1202.h @@ -7,6 +7,27 @@ typedef struct vi1202_UnkStruct vi1202_UnkStruct; +typedef struct vi1202_ViData { + /* 0x00 */ f32 x0; + /* 0x04 */ f32 x4; + /* 0x08 */ f32 x8; + /* 0x0C */ f32 xC; + /* 0x10 */ f32 x10; + /* 0x14 */ f32 x14; + /* 0x18 */ u8 pad18[0x20 - 0x18]; + /* 0x20 */ s32 x20; + /* 0x24 */ s32 x24; + /* 0x28 */ s32 x28; + /* 0x2C */ f32 x2C; + /* 0x30 */ f32 x30; + /* 0x34 */ f32 x34; + /* 0x38 */ f32 x38; + /* 0x3C */ s32 x3C; + /* 0x40 */ f32 x40; +} vi1202_ViData; + +/* 4D6500 */ extern vi1202_ViData* Fighter_804D6500; + /* 32110C */ void un_8032110C(HSD_GObj*); /* 321130 */ void un_80321130(HSD_GObj*); /* 321154 */ void un_80321154(HSD_GObj*); From 9070df6d40dc72948e8bcf587c5d9c968936eb3d Mon Sep 17 00:00:00 2001 From: itsgrimetime <990274+itsgrimetime@users.noreply.github.com> Date: Wed, 31 Dec 2025 22:15:10 -0800 Subject: [PATCH 3/4] vi1202: Rename Fighter_804D6500 to gCrowdConfig MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename the global config pointer and struct to reflect its actual purpose - configuring crowd/announcer reactions during matches. Evidence for "Crowd" naming: - Symbol names from UnclePunch's Training Mode map (Feb 2019) - Functions at 0x80321900+ named CrowdSFXManager_* in that map - Audio function 0x8002411C named lbAudio_PlayCrowdSFX - Code behavior matches wiki descriptions of crowd gasps/cheers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- config/GALE01/symbols.txt | 2 +- src/melee/ft/fighter.c | 4 ++-- src/melee/vi/vi1202.c | 32 ++++++++++++++++---------------- src/melee/vi/vi1202.h | 15 ++++++++++++--- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/config/GALE01/symbols.txt b/config/GALE01/symbols.txt index 1799681f89..73451a0967 100644 --- a/config/GALE01/symbols.txt +++ b/config/GALE01/symbols.txt @@ -27656,7 +27656,7 @@ efLib_804D64EC = .sbss:0x804D64EC; // type:object size:0x4 scope:global data:4by efLib_804D64F0 = .sbss:0x804D64F0; // type:object size:0x8 scope:global data:4byte Fighter_804D64F8 = .sbss:0x804D64F8; // type:object size:0x4 scope:global data:4byte Fighter_804D64FC = .sbss:0x804D64FC; // type:object size:0x4 scope:global data:4byte -Fighter_804D6500 = .sbss:0x804D6500; // type:object size:0x4 scope:global data:4byte +gCrowdConfig = .sbss:0x804D6500; // type:object size:0x4 scope:global data:4byte Fighter_804D6504 = .sbss:0x804D6504; // type:object size:0x4 scope:global data:4byte Fighter_804D6508 = .sbss:0x804D6508; // type:object size:0x4 scope:global data:4byte Fighter_804D650C = .sbss:0x804D650C; // type:object size:0x4 scope:global data:4byte diff --git a/src/melee/ft/fighter.c b/src/melee/ft/fighter.c index a444d4bc75..6c3cb9d8ab 100644 --- a/src/melee/ft/fighter.c +++ b/src/melee/ft/fighter.c @@ -127,7 +127,7 @@ u32 Fighter_804D64F8 = 0; // the following seems to be an array, initialized in reverse in struct Fighter_804D64FC_t* Fighter_804D64FC = NULL; -vi1202_ViData* Fighter_804D6500 = NULL; +CrowdConfig* gCrowdConfig = NULL; HSD_Joint* Fighter_804D6504 = NULL; u8* Fighter_804D6508 = NULL; u8* Fighter_804D650C = NULL; @@ -216,7 +216,7 @@ void Fighter_LoadCommonData(void) Fighter_804D650C = pData[18]; Fighter_804D6508 = pData[19]; Fighter_804D6504 = pData[20]; - Fighter_804D6500 = pData[21]; + gCrowdConfig = pData[21]; Fighter_804D64FC = pData[22]; } diff --git a/src/melee/vi/vi1202.c b/src/melee/vi/vi1202.c index cc2e7898a4..be85b53671 100644 --- a/src/melee/vi/vi1202.c +++ b/src/melee/vi/vi1202.c @@ -80,9 +80,9 @@ void un_80321950(vi1202_UnkStruct* s) s->x4 = 0x10000; s->x8 = 1.0F; s->xC = 0; - s->x10 = Fighter_804D6500->x20; + s->x10 = gCrowdConfig->x20; s->x14 = 0x83D60; - s->x18 = Fighter_804D6500->x28; + s->x18 = gCrowdConfig->x28; s->x1C = 0; s->x20 = 0; s->x24 = 0; @@ -104,7 +104,7 @@ void un_80321A00(HSD_GObj* gobj) { s32 zero; vi1202_UnkStruct* data = un_804D7050; - vi1202_ViData* vdata = Fighter_804D6500; + CrowdConfig* vdata = gCrowdConfig; if (data->x18 >= vdata->x28) { if (data->x10 < vdata->x20) { @@ -118,12 +118,12 @@ void un_80321A00(HSD_GObj* gobj) } data->x18 = data->x18 + 1; - if (data->x18 < Fighter_804D6500->x28) { + if (data->x18 < gCrowdConfig->x28) { if (data->x1C != 0) { zero = 0; data->x1C = zero; data->x10 = zero; - data->x18 = Fighter_804D6500->x28; + data->x18 = gCrowdConfig->x28; un_80321C28(); if (data->x20 != 0) { un_80321CA4(0x144); @@ -157,7 +157,7 @@ void un_80321AF4(HSD_GObj* gobj) if (ftLib_8008731C(cur) == 0) { ftLib_80086644(cur, &pos); - if (pos.y < Fighter_804D6500->x40 + M2C_FIELD(mpLib, f32*, 0x14)) { + if (pos.y < gCrowdConfig->x40 + M2C_FIELD(mpLib, f32*, 0x14)) { data->x24 = data->x24 + 1; } else { if ((u32) data->xC == ftLib_80087460(cur)) { @@ -169,8 +169,8 @@ void un_80321AF4(HSD_GObj* gobj) cur = cur->next; } - if (old_x24 < Fighter_804D6500->x3C) { - if (data->x24 >= Fighter_804D6500->x3C) { + if (old_x24 < gCrowdConfig->x3C) { + if (data->x24 >= gCrowdConfig->x3C) { if (flag != 0) { un_8032201C(data->xC, 3); } else { @@ -200,7 +200,7 @@ void un_80321C28(void) void un_80321C70(void) { vi1202_UnkStruct* data = un_804D7050; - vi1202_ViData* vdata = Fighter_804D6500; + CrowdConfig* vdata = gCrowdConfig; s32 x18 = data->x18; if (x18 >= vdata->x28) { return; @@ -259,7 +259,7 @@ void un_8032201C(int arg0, s32 cat) if ((u32)arg0 != 0) { if ((u32)data->xC == (u32)arg0) { - vi1202_ViData* vdata = Fighter_804D6500; + CrowdConfig* vdata = gCrowdConfig; vi1202_UnkStruct* data2 = un_804D7050; if (data2->x18 < vdata->x28) { if (data2->x18 >= vdata->x24) { @@ -313,7 +313,7 @@ void un_80322178(int arg) bool un_80322258(float arg) { - f32 val2c = Fighter_804D6500->x2C; + f32 val2c = gCrowdConfig->x2C; f32 val18 = M2C_FIELD(mpLib_80458868, f32*, 0x18); f32 val1c; if (arg >= val2c + val18) { @@ -328,7 +328,7 @@ bool un_80322258(float arg) s32 un_80322298(float arg) { - vi1202_ViData* vdata = Fighter_804D6500; + CrowdConfig* vdata = gCrowdConfig; if (arg >= vdata->x8) { return 3; } @@ -343,7 +343,7 @@ s32 un_80322298(float arg) f32 un_803222EC(f32 arg1, f32 arg2) { - vi1202_ViData* vdata = Fighter_804D6500; + CrowdConfig* vdata = gCrowdConfig; if (!(arg2 > vdata->xC)) { return arg1; } @@ -356,7 +356,7 @@ f32 un_803222EC(f32 arg1, f32 arg2) void un_80322314(void) { vi1202_UnkStruct* data = un_804D7050; - vi1202_ViData* vdata = Fighter_804D6500; + CrowdConfig* vdata = gCrowdConfig; if (data->x18 >= vdata->x28) { return; } @@ -408,11 +408,11 @@ int un_80322598(int arg0, float arg1) { f32 val14 = M2C_FIELD(mpLib_80458868, f32*, 0x14); s32 cat; - vi1202_ViData* vdata; + CrowdConfig* vdata; if (arg1 >= val14) { goto ret_zero; } - vdata = Fighter_804D6500; + vdata = gCrowdConfig; if (arg1 < vdata->x38 + val14) { ret_zero: return 0; diff --git a/src/melee/vi/vi1202.h b/src/melee/vi/vi1202.h index 82828dc76e..854758bd43 100644 --- a/src/melee/vi/vi1202.h +++ b/src/melee/vi/vi1202.h @@ -7,7 +7,16 @@ typedef struct vi1202_UnkStruct vi1202_UnkStruct; -typedef struct vi1202_ViData { +/// Configuration for crowd/announcer reactions during matches. +/// +/// Evidence for "Crowd" naming: +/// - Symbol names from UnclePunch's Training Mode map (Feb 2019) +/// - Functions at 0x80321900+ named CrowdSFXManager_* in that map +/// - Audio function 0x8002411C named lbAudio_PlayCrowdSFX +/// - Code triggers match wiki descriptions of crowd gasps/cheers +/// +/// @todo Field names are speculative based on observed usage +typedef struct CrowdConfig { /* 0x00 */ f32 x0; /* 0x04 */ f32 x4; /* 0x08 */ f32 x8; @@ -24,9 +33,9 @@ typedef struct vi1202_ViData { /* 0x38 */ f32 x38; /* 0x3C */ s32 x3C; /* 0x40 */ f32 x40; -} vi1202_ViData; +} CrowdConfig; -/* 4D6500 */ extern vi1202_ViData* Fighter_804D6500; +/* 4D6500 */ extern CrowdConfig* gCrowdConfig; /* 32110C */ void un_8032110C(HSD_GObj*); /* 321130 */ void un_80321130(HSD_GObj*); From fcf9a55f6693001bb436ce9b06bb23e8d57f2fe5 Mon Sep 17 00:00:00 2001 From: itsgrimetime <990274+itsgrimetime@users.noreply.github.com> Date: Sat, 3 Jan 2026 01:22:12 -0800 Subject: [PATCH 4/4] vi: document CrowdConfig struct and fix missing functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add descriptive field names to CrowdConfig based on code analysis and runtime validation via Dolphin debugger: - kb_threshold_low/mid/high (100/130/160): knockback thresholds - recovery_y_high/mid/low (-10/-30/-80): recovery gasp Y thresholds - horiz_margin, blastzone_y_offset, fighters_near_blastzone, etc. - Restore missing functions un_80321294 and un_803224DC - Add required includes (baselib/aobj.h, baselib/cobj.h) - Fix un_80321294 declaration in header Field naming verified by setting breakpoints on: - 0x803224DC (Crowd_CheckForCrowdGaspUponHittingGround) - 0x80322598 (Crowd_CheckForCrowdGaspOnRecovery) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/melee/vi/vi1202.c | 66 ++++++++++++++++++++++--------------------- src/melee/vi/vi1202.h | 37 +++++++++++++----------- 2 files changed, 55 insertions(+), 48 deletions(-) diff --git a/src/melee/vi/vi1202.c b/src/melee/vi/vi1202.c index be85b53671..1e290c9f0d 100644 --- a/src/melee/vi/vi1202.c +++ b/src/melee/vi/vi1202.c @@ -49,7 +49,7 @@ void un_80321294(HSD_GObj* gobj) HSD_CObj* cobj = GET_COBJ(gobj); HSD_CObjAnim(cobj); if (cobj->aobj->curr_frame == 1.0F) { - vi_8031C9B4(0xe, 0); + vi_8031C9B4(0xE, 0); } if (cobj->aobj->curr_frame == cobj->aobj->end_frame) { lb_800145F4(); @@ -80,9 +80,9 @@ void un_80321950(vi1202_UnkStruct* s) s->x4 = 0x10000; s->x8 = 1.0F; s->xC = 0; - s->x10 = gCrowdConfig->x20; + s->x10 = gCrowdConfig->cheer_limit; s->x14 = 0x83D60; - s->x18 = gCrowdConfig->x28; + s->x18 = gCrowdConfig->max_gasp_count; s->x1C = 0; s->x20 = 0; s->x24 = 0; @@ -106,8 +106,8 @@ void un_80321A00(HSD_GObj* gobj) vi1202_UnkStruct* data = un_804D7050; CrowdConfig* vdata = gCrowdConfig; - if (data->x18 >= vdata->x28) { - if (data->x10 < vdata->x20) { + if (data->x18 >= vdata->max_gasp_count) { + if (data->x10 < vdata->cheer_limit) { data->x10 = data->x10 + 1; } return; @@ -118,12 +118,12 @@ void un_80321A00(HSD_GObj* gobj) } data->x18 = data->x18 + 1; - if (data->x18 < gCrowdConfig->x28) { + if (data->x18 < gCrowdConfig->max_gasp_count) { if (data->x1C != 0) { zero = 0; data->x1C = zero; data->x10 = zero; - data->x18 = gCrowdConfig->x28; + data->x18 = gCrowdConfig->max_gasp_count; un_80321C28(); if (data->x20 != 0) { un_80321CA4(0x144); @@ -157,7 +157,9 @@ void un_80321AF4(HSD_GObj* gobj) if (ftLib_8008731C(cur) == 0) { ftLib_80086644(cur, &pos); - if (pos.y < gCrowdConfig->x40 + M2C_FIELD(mpLib, f32*, 0x14)) { + if (pos.y < gCrowdConfig->blastzone_y_offset + + M2C_FIELD(mpLib, f32*, 0x14)) + { data->x24 = data->x24 + 1; } else { if ((u32) data->xC == ftLib_80087460(cur)) { @@ -169,8 +171,8 @@ void un_80321AF4(HSD_GObj* gobj) cur = cur->next; } - if (old_x24 < gCrowdConfig->x3C) { - if (data->x24 >= gCrowdConfig->x3C) { + if (old_x24 < gCrowdConfig->fighters_near_blastzone) { + if (data->x24 >= gCrowdConfig->fighters_near_blastzone) { if (flag != 0) { un_8032201C(data->xC, 3); } else { @@ -202,7 +204,7 @@ void un_80321C70(void) vi1202_UnkStruct* data = un_804D7050; CrowdConfig* vdata = gCrowdConfig; s32 x18 = data->x18; - if (x18 >= vdata->x28) { + if (x18 >= vdata->max_gasp_count) { return; } if (x18 >= vdata->x24) { @@ -257,11 +259,11 @@ void un_8032201C(int arg0, s32 cat) break; } - if ((u32)arg0 != 0) { - if ((u32)data->xC == (u32)arg0) { + if ((u32) arg0 != 0) { + if ((u32) data->xC == (u32) arg0) { CrowdConfig* vdata = gCrowdConfig; vi1202_UnkStruct* data2 = un_804D7050; - if (data2->x18 < vdata->x28) { + if (data2->x18 < vdata->max_gasp_count) { if (data2->x18 >= vdata->x24) { data2->x1C = 1; } @@ -313,7 +315,7 @@ void un_80322178(int arg) bool un_80322258(float arg) { - f32 val2c = gCrowdConfig->x2C; + f32 val2c = gCrowdConfig->horiz_margin; f32 val18 = M2C_FIELD(mpLib_80458868, f32*, 0x18); f32 val1c; if (arg >= val2c + val18) { @@ -329,13 +331,13 @@ bool un_80322258(float arg) s32 un_80322298(float arg) { CrowdConfig* vdata = gCrowdConfig; - if (arg >= vdata->x8) { + if (arg >= vdata->kb_threshold_high) { return 3; } - if (arg >= vdata->x4) { + if (arg >= vdata->kb_threshold_mid) { return 2; } - if (arg >= vdata->x0) { + if (arg >= vdata->kb_threshold_low) { return 1; } return 0; @@ -344,20 +346,20 @@ s32 un_80322298(float arg) f32 un_803222EC(f32 arg1, f32 arg2) { CrowdConfig* vdata = gCrowdConfig; - if (!(arg2 > vdata->xC)) { + if (!(arg2 > vdata->angle_min)) { return arg1; } - if (!(arg2 < vdata->x10)) { + if (!(arg2 < vdata->angle_max)) { return arg1; } - return arg1 * vdata->x14; + return arg1 * vdata->angle_mult; } void un_80322314(void) { vi1202_UnkStruct* data = un_804D7050; CrowdConfig* vdata = gCrowdConfig; - if (data->x18 >= vdata->x28) { + if (data->x18 >= vdata->max_gasp_count) { return; } data->x1C = 1; @@ -366,29 +368,29 @@ void un_80322314(void) bool un_803224DC(s32 spawn_id, f32 pos_x, f32 kb_mag) { - void* fighter = Fighter_804D6500; + CrowdConfig* vdata = gCrowdConfig; s32 cat; s32 out_of_bounds; - if (kb_mag >= M2C_FIELD(fighter, f32*, 0x8)) { + if (kb_mag >= vdata->kb_threshold_high) { cat = 3; - } else if (kb_mag >= M2C_FIELD(fighter, f32*, 0x4)) { + } else if (kb_mag >= vdata->kb_threshold_mid) { cat = 2; - } else if (kb_mag >= M2C_FIELD(fighter, f32*, 0x0)) { + } else if (kb_mag >= vdata->kb_threshold_low) { cat = 1; } else { cat = 0; } { - f32 val2c = M2C_FIELD(fighter, f32*, 0x2c); + f32 val2c = vdata->horiz_margin; f32 val18 = M2C_FIELD(mpLib_80458868, f32*, 0x18); f32 val1c; if (pos_x < val2c + val18) { out_of_bounds = 1; } else { - val1c = M2C_FIELD(mpLib_80458868, f32*, 0x1c); + val1c = M2C_FIELD(mpLib_80458868, f32*, 0x1C); if (pos_x > val1c - val2c) { out_of_bounds = 1; } else { @@ -413,13 +415,13 @@ int un_80322598(int arg0, float arg1) goto ret_zero; } vdata = gCrowdConfig; - if (arg1 < vdata->x38 + val14) { -ret_zero: + if (arg1 < vdata->recovery_y_low + val14) { + ret_zero: return 0; } - if (arg1 > vdata->x30 + val14) { + if (arg1 > vdata->recovery_y_high + val14) { cat = 3; - } else if (arg1 > vdata->x34 + val14) { + } else if (arg1 > vdata->recovery_y_mid + val14) { cat = 2; } else { cat = 1; diff --git a/src/melee/vi/vi1202.h b/src/melee/vi/vi1202.h index 854758bd43..b909955cce 100644 --- a/src/melee/vi/vi1202.h +++ b/src/melee/vi/vi1202.h @@ -14,25 +14,30 @@ typedef struct vi1202_UnkStruct vi1202_UnkStruct; /// - Functions at 0x80321900+ named CrowdSFXManager_* in that map /// - Audio function 0x8002411C named lbAudio_PlayCrowdSFX /// - Code triggers match wiki descriptions of crowd gasps/cheers -/// -/// @todo Field names are speculative based on observed usage typedef struct CrowdConfig { - /* 0x00 */ f32 x0; - /* 0x04 */ f32 x4; - /* 0x08 */ f32 x8; - /* 0x0C */ f32 xC; - /* 0x10 */ f32 x10; - /* 0x14 */ f32 x14; + /// Knockback thresholds for crowd gasp intensity (cat 1/2/3) + /* 0x00 */ f32 kb_threshold_low; + /* 0x04 */ f32 kb_threshold_mid; + /* 0x08 */ f32 kb_threshold_high; + /// Angle range and multiplier for crowd reaction modifier + /* 0x0C */ f32 angle_min; + /* 0x10 */ f32 angle_max; + /* 0x14 */ f32 angle_mult; /* 0x18 */ u8 pad18[0x20 - 0x18]; - /* 0x20 */ s32 x20; + /// Cheer/gasp timing limits + /* 0x20 */ s32 cheer_limit; /* 0x24 */ s32 x24; - /* 0x28 */ s32 x28; - /* 0x2C */ f32 x2C; - /* 0x30 */ f32 x30; - /* 0x34 */ f32 x34; - /* 0x38 */ f32 x38; - /* 0x3C */ s32 x3C; - /* 0x40 */ f32 x40; + /* 0x28 */ s32 max_gasp_count; + /// Horizontal margin from blast zone for out-of-bounds check + /* 0x2C */ f32 horiz_margin; + /// Y-position thresholds for recovery gasp intensity (cat 3/2/1) + /* 0x30 */ f32 recovery_y_high; + /* 0x34 */ f32 recovery_y_mid; + /* 0x38 */ f32 recovery_y_low; + /// Fighter count threshold to trigger blast zone proximity gasp + /* 0x3C */ s32 fighters_near_blastzone; + /// Y-offset added to blast zone bottom for proximity check + /* 0x40 */ f32 blastzone_y_offset; } CrowdConfig; /* 4D6500 */ extern CrowdConfig* gCrowdConfig;