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 4351612445..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; -UNK_T 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/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 67541bf01a..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 = M2C_FIELD(Fighter_804D6500, s32*, 0x20); + s->x10 = gCrowdConfig->cheer_limit; s->x14 = 0x83D60; - s->x18 = M2C_FIELD(Fighter_804D6500, s32*, 0x28); + s->x18 = gCrowdConfig->max_gasp_count; s->x1C = 0; s->x20 = 0; s->x24 = 0; @@ -104,10 +104,10 @@ void un_80321A00(HSD_GObj* gobj) { s32 zero; vi1202_UnkStruct* data = un_804D7050; - void* fighter = Fighter_804D6500; + CrowdConfig* vdata = gCrowdConfig; - if (data->x18 >= M2C_FIELD(fighter, s32*, 0x28)) { - if (data->x10 < M2C_FIELD(fighter, s32*, 0x20)) { + 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 < M2C_FIELD(Fighter_804D6500, s32*, 0x28)) { + if (data->x18 < gCrowdConfig->max_gasp_count) { if (data->x1C != 0) { zero = 0; data->x1C = zero; data->x10 = zero; - data->x18 = M2C_FIELD(Fighter_804D6500, s32*, 0x28); + data->x18 = gCrowdConfig->max_gasp_count; 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 < M2C_FIELD(Fighter_804D6500, f32*, 0x40) + + if (pos.y < gCrowdConfig->blastzone_y_offset + M2C_FIELD(mpLib, f32*, 0x14)) { data->x24 = data->x24 + 1; @@ -171,8 +171,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 < gCrowdConfig->fighters_near_blastzone) { + if (data->x24 >= gCrowdConfig->fighters_near_blastzone) { if (flag != 0) { un_8032201C(data->xC, 3); } else { @@ -202,12 +202,12 @@ void un_80321C28(void) void un_80321C70(void) { vi1202_UnkStruct* data = un_804D7050; - void* fighter = Fighter_804D6500; + CrowdConfig* vdata = gCrowdConfig; s32 x18 = data->x18; - if (x18 >= M2C_FIELD(fighter, s32*, 0x28)) { + if (x18 >= vdata->max_gasp_count) { return; } - if (x18 >= M2C_FIELD(fighter, s32*, 0x24)) { + if (x18 >= vdata->x24) { data->x1C = 1; } } @@ -261,10 +261,10 @@ void un_8032201C(int arg0, s32 cat) if ((u32) arg0 != 0) { if ((u32) data->xC == (u32) arg0) { - void* fighter = Fighter_804D6500; + CrowdConfig* vdata = gCrowdConfig; vi1202_UnkStruct* data2 = un_804D7050; - if (data2->x18 < M2C_FIELD(fighter, s32*, 0x28)) { - if (data2->x18 >= M2C_FIELD(fighter, s32*, 0x24)) { + if (data2->x18 < vdata->max_gasp_count) { + if (data2->x18 >= vdata->x24) { data2->x1C = 1; } } @@ -315,7 +315,7 @@ void un_80322178(int arg) bool un_80322258(float arg) { - f32 val2c = M2C_FIELD(Fighter_804D6500, f32*, 0x2c); + f32 val2c = gCrowdConfig->horiz_margin; f32 val18 = M2C_FIELD(mpLib_80458868, f32*, 0x18); f32 val1c; if (arg >= val2c + val18) { @@ -330,14 +330,14 @@ bool un_80322258(float arg) s32 un_80322298(float arg) { - void* fighter = Fighter_804D6500; - if (arg >= M2C_FIELD(fighter, f32*, 0x8)) { + CrowdConfig* vdata = gCrowdConfig; + if (arg >= vdata->kb_threshold_high) { return 3; } - if (arg >= M2C_FIELD(fighter, f32*, 0x4)) { + if (arg >= vdata->kb_threshold_mid) { return 2; } - if (arg >= M2C_FIELD(fighter, f32*, 0x0)) { + if (arg >= vdata->kb_threshold_low) { return 1; } return 0; @@ -345,21 +345,21 @@ s32 un_80322298(float arg) f32 un_803222EC(f32 arg1, f32 arg2) { - void* fighter = Fighter_804D6500; - if (!(arg2 > M2C_FIELD(fighter, f32*, 0xc))) { + CrowdConfig* vdata = gCrowdConfig; + if (!(arg2 > vdata->angle_min)) { return arg1; } - if (!(arg2 < M2C_FIELD(fighter, f32*, 0x10))) { + if (!(arg2 < vdata->angle_max)) { return arg1; } - return arg1 * M2C_FIELD(fighter, f32*, 0x14); + return arg1 * vdata->angle_mult; } void un_80322314(void) { vi1202_UnkStruct* data = un_804D7050; - void* fighter = Fighter_804D6500; - if (data->x18 >= M2C_FIELD(fighter, s32*, 0x28)) { + CrowdConfig* vdata = gCrowdConfig; + if (data->x18 >= vdata->max_gasp_count) { return; } data->x1C = 1; @@ -368,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 { @@ -410,18 +410,18 @@ int un_80322598(int arg0, float arg1) { f32 val14 = M2C_FIELD(mpLib_80458868, f32*, 0x14); s32 cat; - void* fighter; + CrowdConfig* vdata; if (arg1 >= val14) { goto ret_zero; } - fighter = Fighter_804D6500; - if (arg1 < M2C_FIELD(fighter, f32*, 0x38) + val14) { + vdata = gCrowdConfig; + if (arg1 < vdata->recovery_y_low + val14) { ret_zero: return 0; } - if (arg1 > M2C_FIELD(fighter, f32*, 0x30) + val14) { + if (arg1 > vdata->recovery_y_high + val14) { cat = 3; - } else if (arg1 > M2C_FIELD(fighter, f32*, 0x34) + 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 579d4b55db..b909955cce 100644 --- a/src/melee/vi/vi1202.h +++ b/src/melee/vi/vi1202.h @@ -7,6 +7,41 @@ typedef struct vi1202_UnkStruct vi1202_UnkStruct; +/// 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 +typedef struct CrowdConfig { + /// 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]; + /// Cheer/gasp timing limits + /* 0x20 */ s32 cheer_limit; + /* 0x24 */ s32 x24; + /* 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; + /* 32110C */ void un_8032110C(HSD_GObj*); /* 321130 */ void un_80321130(HSD_GObj*); /* 321154 */ void un_80321154(HSD_GObj*);