From 62aa19392254572c247207a1dd785d7109aa10af Mon Sep 17 00:00:00 2001 From: Tyler McGavran Date: Tue, 16 Nov 2021 14:26:40 -0500 Subject: [PATCH] [kart] Variety of changes related to kart hop physics (#56) Gave some Player struct members proper names, mostly related to kart hop physics. Renamed a couple of tables in kart_attributes to make their purpose and nature more obvious Matched func_8002AAC0 with its assembly representation Matched func_800225CC with its assembly representation Signed-off-by: Taggerung --- .../code_8001F980/func_800225CC.s | 28 ----- .../code_80027D00/func_8002AA50.s | 8 +- .../code_80027D00/func_8002AAC0.s | 49 -------- include/common_structs.h | 8 +- src/code_8001F980.c | 39 ++++--- src/code_80027040.c | 18 +-- src/code_80027D00.c | 109 ++++++++++++------ src/code_800393C0.c | 38 +++--- src/code_800431B0.c | 12 +- src/code_80057C60.c | 12 +- src/code_8008C1D0.c | 10 +- src/code_80281FA0.c | 2 +- src/kart_attributes.inc.c | 6 +- src/staff_ghosts.c | 10 +- 14 files changed, 162 insertions(+), 187 deletions(-) delete mode 100644 asm/non_matchings/code_8001F980/func_800225CC.s delete mode 100644 asm/non_matchings/code_80027D00/func_8002AAC0.s diff --git a/asm/non_matchings/code_8001F980/func_800225CC.s b/asm/non_matchings/code_8001F980/func_800225CC.s deleted file mode 100644 index a95a3ccd7..000000000 --- a/asm/non_matchings/code_8001F980/func_800225CC.s +++ /dev/null @@ -1,28 +0,0 @@ -glabel func_800225CC -/* 0231CC 800225CC 44856000 */ mtc1 $a1, $f12 -/* 0231D0 800225D0 C4800000 */ lwc1 $f0, ($a0) -/* 0231D4 800225D4 44867000 */ mtc1 $a2, $f14 -/* 0231D8 800225D8 3C01800F */ lui $at, %hi(D_800ED680) -/* 0231DC 800225DC 460C0101 */ sub.s $f4, $f0, $f12 -/* 0231E0 800225E0 460E2182 */ mul.s $f6, $f4, $f14 -/* 0231E4 800225E4 46060201 */ sub.s $f8, $f0, $f6 -/* 0231E8 800225E8 E4880000 */ swc1 $f8, ($a0) -/* 0231EC 800225EC C48A0000 */ lwc1 $f10, ($a0) -/* 0231F0 800225F0 D430D680 */ ldc1 $f16, %lo(D_800ED680)($at) -/* 0231F4 800225F4 3C01800F */ lui $at, %hi(D_800ED688) -/* 0231F8 800225F8 460050A1 */ cvt.d.s $f2, $f10 -/* 0231FC 800225FC 4630103C */ c.lt.d $f2, $f16 -/* 023200 80022600 00000000 */ nop -/* 023204 80022604 45000009 */ bc1f .L8002262C -/* 023208 80022608 00000000 */ nop -/* 02320C 8002260C D432D688 */ ldc1 $f18, %lo(D_800ED688)($at) -/* 023210 80022610 4622903C */ c.lt.d $f18, $f2 -/* 023214 80022614 00000000 */ nop -/* 023218 80022618 45000004 */ bc1f .L8002262C -/* 02321C 8002261C 00000000 */ nop -/* 023220 80022620 44802000 */ mtc1 $zero, $f4 -/* 023224 80022624 00000000 */ nop -/* 023228 80022628 E4840000 */ swc1 $f4, ($a0) -.L8002262C: -/* 02322C 8002262C 03E00008 */ jr $ra -/* 023230 80022630 00000000 */ nop diff --git a/asm/non_matchings/code_80027D00/func_8002AA50.s b/asm/non_matchings/code_80027D00/func_8002AA50.s index fe8f5a225..1ec543a38 100644 --- a/asm/non_matchings/code_80027D00/func_8002AA50.s +++ b/asm/non_matchings/code_80027D00/func_8002AA50.s @@ -2,16 +2,16 @@ glabel func_8002AA50 /* 02B650 8002AA50 27BDFFE8 */ addiu $sp, $sp, -0x18 /* 02B654 8002AA54 AFBF0014 */ sw $ra, 0x14($sp) /* 02B658 8002AA58 94820254 */ lhu $v0, 0x254($a0) -/* 02B65C 8002AA5C 3C01800E */ lui $at, %hi(gKartHopFallSpeedTable) +/* 02B65C 8002AA5C 3C01800E */ lui $at, %hi(gKartHopJerkTable) /* 02B660 8002AA60 44803000 */ mtc1 $zero, $f6 /* 02B664 8002AA64 00027080 */ sll $t6, $v0, 2 /* 02B668 8002AA68 002E0821 */ addu $at, $at, $t6 -/* 02B66C 8002AA6C C42436F0 */ lwc1 $f4, %lo(gKartHopFallSpeedTable)($at) -/* 02B670 8002AA70 3C01800E */ lui $at, %hi(gKartHopHeightTable) +/* 02B66C 8002AA6C C42436F0 */ lwc1 $f4, %lo(gKartHopJerkTable)($at) +/* 02B670 8002AA70 3C01800E */ lui $at, %hi(gKartHopInitialVelocityTable) /* 02B674 8002AA74 002E0821 */ addu $at, $at, $t6 /* 02B678 8002AA78 E48600F4 */ swc1 $f6, 0xf4($a0) /* 02B67C 8002AA7C E48400F0 */ swc1 $f4, 0xf0($a0) -/* 02B680 8002AA80 C42836D0 */ lwc1 $f8, %lo(gKartHopHeightTable)($at) +/* 02B680 8002AA80 C42836D0 */ lwc1 $f8, %lo(gKartHopInitialVelocityTable)($at) /* 02B684 8002AA84 3C014040 */ li $at, 0x40400000 # 3.000000 /* 02B688 8002AA88 8C8F00BC */ lw $t7, 0xbc($a0) /* 02B68C 8002AA8C 44815000 */ mtc1 $at, $f10 diff --git a/asm/non_matchings/code_80027D00/func_8002AAC0.s b/asm/non_matchings/code_80027D00/func_8002AAC0.s deleted file mode 100644 index f9e52a567..000000000 --- a/asm/non_matchings/code_80027D00/func_8002AAC0.s +++ /dev/null @@ -1,49 +0,0 @@ -glabel func_8002AAC0 -/* 02B6C0 8002AAC0 C48400F4 */ lwc1 $f4, 0xf4($a0) -/* 02B6C4 8002AAC4 C48600F0 */ lwc1 $f6, 0xf0($a0) -/* 02B6C8 8002AAC8 3C014110 */ li $at, 0x41100000 # 9.000000 -/* 02B6CC 8002AACC 44811000 */ mtc1 $at, $f2 -/* 02B6D0 8002AAD0 46062201 */ sub.s $f8, $f4, $f6 -/* 02B6D4 8002AAD4 3C01C110 */ li $at, 0xC1100000 # -9.000000 -/* 02B6D8 8002AAD8 E48800F4 */ swc1 $f8, 0xf4($a0) -/* 02B6DC 8002AADC C48000F4 */ lwc1 $f0, 0xf4($a0) -/* 02B6E0 8002AAE0 4600103E */ c.le.s $f2, $f0 -/* 02B6E4 8002AAE4 00000000 */ nop -/* 02B6E8 8002AAE8 45020004 */ bc1fl .L8002AAFC -/* 02B6EC 8002AAEC 44811000 */ mtc1 $at, $f2 -/* 02B6F0 8002AAF0 E48200F4 */ swc1 $f2, 0xf4($a0) -/* 02B6F4 8002AAF4 C48000F4 */ lwc1 $f0, 0xf4($a0) -/* 02B6F8 8002AAF8 44811000 */ mtc1 $at, $f2 -.L8002AAFC: -/* 02B6FC 8002AAFC 00000000 */ nop -/* 02B700 8002AB00 4602003E */ c.le.s $f0, $f2 -/* 02B704 8002AB04 00000000 */ nop -/* 02B708 8002AB08 45020004 */ bc1fl .L8002AB1C -/* 02B70C 8002AB0C C48A00EC */ lwc1 $f10, 0xec($a0) -/* 02B710 8002AB10 E48200F4 */ swc1 $f2, 0xf4($a0) -/* 02B714 8002AB14 C48000F4 */ lwc1 $f0, 0xf4($a0) -/* 02B718 8002AB18 C48A00EC */ lwc1 $f10, 0xec($a0) -.L8002AB1C: -/* 02B71C 8002AB1C 3C014170 */ li $at, 0x41700000 # 15.000000 -/* 02B720 8002AB20 44816000 */ mtc1 $at, $f12 -/* 02B724 8002AB24 46005400 */ add.s $f16, $f10, $f0 -/* 02B728 8002AB28 44800000 */ mtc1 $zero, $f0 -/* 02B72C 8002AB2C E49000EC */ swc1 $f16, 0xec($a0) -/* 02B730 8002AB30 C48200EC */ lwc1 $f2, 0xec($a0) -/* 02B734 8002AB34 4602603E */ c.le.s $f12, $f2 -/* 02B738 8002AB38 00000000 */ nop -/* 02B73C 8002AB3C 45020004 */ bc1fl .L8002AB50 -/* 02B740 8002AB40 4600103E */ c.le.s $f2, $f0 -/* 02B744 8002AB44 E48C00EC */ swc1 $f12, 0xec($a0) -/* 02B748 8002AB48 C48200EC */ lwc1 $f2, 0xec($a0) -/* 02B74C 8002AB4C 4600103E */ c.le.s $f2, $f0 -.L8002AB50: -/* 02B750 8002AB50 00000000 */ nop -/* 02B754 8002AB54 45000004 */ bc1f .L8002AB68 -/* 02B758 8002AB58 00000000 */ nop -/* 02B75C 8002AB5C E48000F0 */ swc1 $f0, 0xf0($a0) -/* 02B760 8002AB60 E48000F4 */ swc1 $f0, 0xf4($a0) -/* 02B764 8002AB64 E48000EC */ swc1 $f0, 0xec($a0) -.L8002AB68: -/* 02B768 8002AB68 03E00008 */ jr $ra -/* 02B76C 8002AB6C 00000000 */ nop diff --git a/include/common_structs.h b/include/common_structs.h index 06e89fd07..ae9dc549e 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -182,9 +182,9 @@ typedef struct { /* 0x00E2 */ s16 unk_0E2; /* 0x00E4 */ f32 unk_0E4; /* 0x00E8 */ f32 unk_0E8; - /* 0x00EC */ f32 unk_0EC; - /* 0x00F0 */ f32 unk_0F0; - /* 0x00F4 */ f32 unk_0F4; + /* 0x00EC */ f32 kartHopVelocity; + /* 0x00F0 */ f32 kartHopJerk; + /* 0x00F4 */ f32 kartHopAcceleration; /* 0x00F8 */ char unk_0F8[0x2]; /* 0x00FA */ s16 unk_0FA; /* 0x00FC */ f32 unk_0FC; @@ -271,7 +271,7 @@ typedef struct { /* 0x0240 */ s32 unk_240; /* 0x0244 */ u16 unk_244[4]; /* 0x0244 */ u16 unk_24C[4]; - /* 0x0254 */ u16 unk_254; + /* 0x0254 */ u16 characterId; /* 0x0256 */ s16 unk_256; /* 0x0258 */ char unk_258[0xB40]; /* 0x0D98 */ s16 unk_D98; diff --git a/src/code_8001F980.c b/src/code_8001F980.c index e7ec3a14d..dad1d6017 100644 --- a/src/code_8001F980.c +++ b/src/code_8001F980.c @@ -1045,25 +1045,38 @@ void func_80022598(s32 *arg0, s32 arg1, f32 arg2) { GLOBAL_ASM("asm/non_matchings/code_8001F980/func_80022598.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 extern f64 D_800ED680; extern f64 D_800ED688; -void func_800225CC(f32 *arg0, f32 arg1, f32 arg2) { - f32 temp_f0; - f64 temp_f2; +/** + * Function: func_800225CC - temp_f0 = *arg0; - *arg0 = temp_f0 - ((temp_f0 - arg1) * arg2); - temp_f2 = *arg0; - if ((temp_f2 < D_800ED680) && (D_800ED688 < temp_f2)) { - *arg0 = 0.0f; + * Parameters: + * f32 *startingValue - Pointer to the float that will be modified + * f32 targetValue - Float value to move startingValue towards + * f32 somePercent - The percent of the difference between startingValue + and targetValue to actually move + + * Moves a given startingValue the given somePercent towards the targetValue + + * f32 *thing = 2500; + * func_800225CC(thing, 500, 0.75f); + * thing now has a value of 1000 + + * If after the move startingValue is inside of the range [D_800ED688, D_800ED680], + * force it to exactly 0.0f + * [D_800ED688, D_800ED680] = [-0.001, 0.001], based on data_0DD0A0_3.s + + * This is probably a precision thing. The scaling with somePercent likely + * can't hit exactly 0 with any reliability, so they force it to 0 if you're + * in a small range around it. Why they only do this for 0 is anyone's guess though +**/ +void func_800225CC(f32 *startingValue, f32 targetValue, f32 somePercent) { + *startingValue -= ((*startingValue - targetValue) * somePercent); + if ((*startingValue < D_800ED680) && (D_800ED688 < *startingValue)) { + *startingValue = 0.0f; } } -#else -GLOBAL_ASM("asm/non_matchings/code_8001F980/func_800225CC.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 diff --git a/src/code_80027040.c b/src/code_80027040.c index fea840d2b..f72a2d232 100644 --- a/src/code_80027040.c +++ b/src/code_80027040.c @@ -36,13 +36,13 @@ void func_80027040(Player *player, s8 arg1, s8 arg2, s8 arg3, s32 arg4) { // temp_v1 = player + (arg2 * 2); if (player->unk_244[arg2] == 0) { temp_s0 = (arg4 * 0x9200) + (arg3 * 0x4900) + (arg1 * 0x920) + D_802DFB80; - osInvalDCache(temp_s0, D_800DDEB0[player->unk_254]); - osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureTable0[player->unk_254][player->unk_24C[arg2]][player->unk_244[arg2]] & 0xFFFFFF], temp_s0, D_800DDEB0[temp_v0], &gDmaMesgQueue); + osInvalDCache(temp_s0, D_800DDEB0[player->characterId]); + osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]] & 0xFFFFFF], temp_s0, D_800DDEB0[temp_v0], &gDmaMesgQueue); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); } else { temp_s0 = (arg4 * 0x9200) + (arg3 * 0x4900) + (arg1 * 0x920) + D_802DFB80; - osInvalDCache(temp_s0, D_800DDEB0[player->unk_254]); - osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureTable1[player->unk_254][player->unk_24C[arg2]][player->unk_244[arg2]] & 0xFFFFFF], temp_s0, D_800DDEB0[temp_v0], &gDmaMesgQueue); + osInvalDCache(temp_s0, D_800DDEB0[player->characterId]); + osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureTable1[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]] & 0xFFFFFF], temp_s0, D_800DDEB0[temp_v0], &gDmaMesgQueue); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); } } @@ -53,12 +53,12 @@ void func_80027040(Player *player, s8 arg1, s8 arg2, s8 arg3, s32 arg4) { ) { temp_s0 = (arg4 * 0x9200) + (arg3 * 0x4900) + (arg1 * 0x920) + D_802DFB80; osInvalDCache(temp_s0, 0x780); - osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureGroup18s[player->unk_254][player->unk_0A8 >> 8] & 0xFFFFFF], temp_s0, 0x900, &gDmaMesgQueue); + osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureGroup18s[player->characterId][player->unk_0A8 >> 8] & 0xFFFFFF], temp_s0, 0x900, &gDmaMesgQueue); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); } else { temp_s0 = (arg4 * 0x9200) + (arg3 * 0x4900) + (arg1 * 0x920) + D_802DFB80; - osInvalDCache(temp_s0, D_800DDEB0[player->unk_254]); - osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureTable0[player->unk_254][player->unk_24C[arg2]][player->unk_244[arg2]] & 0xFFFFFF], temp_s0, D_800DDEB0[temp_v0], &gDmaMesgQueue); + osInvalDCache(temp_s0, D_800DDEB0[player->characterId]); + osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartTextureTable0[player->characterId][player->unk_24C[arg2]][player->unk_244[arg2]] & 0xFFFFFF], temp_s0, D_800DDEB0[temp_v0], &gDmaMesgQueue); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); } } @@ -151,12 +151,12 @@ void func_80027A20(Player *player, s8 arg1, s8 arg2, s8 arg3) { switch(D_800DC52C) { case 0: case 1: case 2: osInvalDCache(temp_s0, 0x200); - osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartPalettes[player->unk_254] & 0x00FFFFFF], temp_s0, 0x200, &gDmaMesgQueue); + osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartPalettes[player->characterId] & 0x00FFFFFF], temp_s0, 0x200, &gDmaMesgQueue); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); break; case 3: osInvalDCache(temp_s0, 0x200); - osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartPalettes[player->unk_254] & 0x00FFFFFF], temp_s0, 0x200, &gDmaMesgQueue); + osPiStartDma(&gDmaIoMesg, 0, 0, &_kart_texturesSegmentRomStart[gKartPalettes[player->characterId] & 0x00FFFFFF], temp_s0, 0x200, &gDmaMesgQueue); osRecvMesg(&gDmaMesgQueue, &gMainReceivedMesg, 1); break; default: break; diff --git a/src/code_80027D00.c b/src/code_80027D00.c index b5d5b90dd..1497a9e16 100644 --- a/src/code_80027D00.c +++ b/src/code_80027D00.c @@ -447,7 +447,7 @@ void func_8002934C(Player *player, s32 arg1, s8 arg2, s8 arg3) { player->unk_244[arg2] = ((player->unk_02E + temp_a3->unk48 + player->unk_0C0) & 0xFFFF) / 0x80; temp_f6 = player->unk_224; temp_v1 = player->unk_0BC; - temp_f4 = *(&D_800DDBD4 + (player->unk_254 * 4)) * 18.0f; + temp_f4 = D_800DDBD4[player->characterId] * 18.0f; temp_f0 = player->unk_230 - player->unk_23C; temp_f2 = temp_f4 * temp_f6; phi_a3 = temp_a3; @@ -1071,52 +1071,91 @@ GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002A8A4.s") #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 ? func_80036C5C(); // extern -extern ? gKartHopFallSpeedTable; -extern ? gKartHopHeightTable; +extern ? gkartHopJerkTable; +extern ? gKartHopInitialVelocityTable; -void func_8002AA50(void *arg0) { - s32 temp_t6; +/** + * Function: func_8002AA50 - temp_t6 = arg0->unk254 * 4; - arg0->unkF4 = 0.0f; - arg0->unkF0 = *(&gKartHopFallSpeedTable + temp_t6); - arg0->unkBC = arg0->unkBC | 2; - arg0->unkEC = *(&gKartHopHeightTable + temp_t6); - arg0->unkDAC = 3.0f; - arg0->unk100 = 500.0f; - func_80036C5C(); + * Parameters: + * Player *player - A pointer to a Player + + * Some sort of hop initalization function, only runs when the hop button is + * first pressed. + + * Initializes several Player struct members, most importantly kartHopVelocity. + * This marks the beginning of a hop. + + * Refer to gKartHopInitialVelocityTable in kart_attributes.inc.c for possible + * starting values of kartHopVelocity (by default, 0.93f for all characterIds) + + * Sets kartHopAcceleration (kartHopAccleration) to 0.0f + + * Refer to gKartHopJerkTable in kart_attributes.inc.c for possible starting + * values of kartHopJerk (by default, 0.03f for all characterIds) + + * Sets unk_100 to 500.0f + + * Sets unk_DAC to 3.0f + + * Sets the second bit of unk_0BC. + * This is probably some sort of flag, something like "is hopping" or "is in the air" + + * Calls func_80036C5C + * No idea what that function does +**/ + +void func_8002AA50(Player *player) { + player->kartHopAcceleration = 0.0f; + player->kartHopJerk = gkartHopJerkTable[player->characterId]; + player->unk_0BC |= 2; + player->kartHopVelocity = gKartHopInitialVelocityTable[player->characterId]; + player->unk_DAC = 3.0f; + player->unk_100 = 500.0f; + func_80036C5C(player); } #else GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002AA50.s") #endif -#ifdef MIPS_TO_C -//generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 -void func_8002AAC0(void *arg0) { - f32 phi_f0; +/** + * Function: func_8002AAC0 - arg0->unkF4 = arg0->unkF4 - arg0->unkF0; - if (arg0->unkF4 >= 9.0f) { - arg0->unkF4 = 9.0f; + * Parameters: + * Player *player - A pointer to a Player + + * First kartHopJerk is subtracted from kartHopAcceleration + * Then kartHopAcceleration is added to kartHopVelocity. + + * If kartHopVelocity is less than or equal to zero, all three + * values (kartHop{Jerk,Acceleration,Velocity}) are set to 0.0f, + * thereby ending the rising portion of the hop. + + * kartHopVelocity is restricted to values in [-INF, 15.0f] + + * kartHopAcceleration is restricted to values in [-9.0f, 9.0f] +**/ +void func_8002AAC0(Player *player) { + player->kartHopAcceleration -= player->kartHopJerk; + if (player->kartHopAcceleration >= 9.0f) { + player->kartHopAcceleration = 9.0f; } - phi_f0 = arg0->unkF4; - if (arg0->unkF4 <= -9.0f) { - arg0->unkF4 = -9.0f; - phi_f0 = arg0->unkF4; + + if (player->kartHopAcceleration <= -9.0f) { + player->kartHopAcceleration = -9.0f; } - arg0->unkEC = arg0->unkEC + phi_f0; - if (arg0->unkEC >= 15.0f) { - arg0->unkEC = 15.0f; + + player->kartHopVelocity += player->kartHopAcceleration; + if (player->kartHopVelocity >= 15.0f) { + player->kartHopVelocity = 15.0f; } - if (arg0->unkEC <= 0.0f) { - arg0->unkF0 = 0.0f; - arg0->unkF4 = 0.0f; - arg0->unkEC = 0.0f; + + if (player->kartHopVelocity <= 0.0f) { + player->kartHopJerk = 0.0f; + player->kartHopAcceleration = 0.0f; + player->kartHopVelocity = 0.0f; } } -#else -GLOBAL_ASM("asm/non_matchings/code_80027D00/func_8002AAC0.s") -#endif #ifdef MIPS_TO_C //generated by mips_to_c commit 3c3b0cede1a99430bfd3edf8d385802b94f91307 @@ -2892,7 +2931,7 @@ void func_8002D268(Player *player, s32 arg1, s8 arg2, s8 arg3) { temp_v0_18->unk8 = spA0; if ((player->unk_000 & 0x4000) == 0x4000) { temp_f2_8 = player->unk_094; - temp_v0_19 = (player->unk_254 * 4) + &gKartTopSpeedTable; + temp_v0_19 = (player->characterId * 4) + &gKartTopSpeedTable; temp_f12_7 = *temp_v0_19; if (temp_f12_7 < temp_f2_8) { temp_f0_8 = temp_f12_7 / temp_f2_8; diff --git a/src/code_800393C0.c b/src/code_800393C0.c index 2bef19567..73656590b 100644 --- a/src/code_800393C0.c +++ b/src/code_800393C0.c @@ -22,33 +22,33 @@ void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg player->unk_000 = 0; player->unk_08C = 0; - player->unk_254 = arg6; + player->characterId = arg6; player->unk_0B6 = 0; - player->unk_0FC = gKartFrictionTable[player->unk_254]; - player->unk_070 = gKartBoundingBoxTable[player->unk_254]; - player->unk_100 = gKartGravityTable[player->unk_254]; + player->unk_0FC = gKartFrictionTable[player->characterId]; + player->unk_070 = gKartBoundingBoxTable[player->characterId]; + player->unk_100 = gKartGravityTable[player->characterId]; switch (gModeSelection) { case 0: case 2: - player->unk_084 = D_800E2400.unk_00[D_800DC548][player->unk_254]; - player->unk_088 = D_800E24B4.unk_00[D_800DC548][player->unk_254]; - player->unk_210 = D_800E2568.unk_00[D_800DC548][player->unk_254]; - player->unk_214 = D_800E261C.unk_00[D_800DC548][player->unk_254]; + player->unk_084 = D_800E2400.unk_00[D_800DC548][player->characterId]; + player->unk_088 = D_800E24B4.unk_00[D_800DC548][player->characterId]; + player->unk_210 = D_800E2568.unk_00[D_800DC548][player->characterId]; + player->unk_214 = D_800E261C.unk_00[D_800DC548][player->characterId]; break; case 1: - player->unk_084 = D_800E2400.unk_00[1][player->unk_254]; - player->unk_088 = D_800E24B4.unk_00[1][player->unk_254]; - player->unk_210 = D_800E2568.unk_00[1][player->unk_254]; - player->unk_214 = D_800E261C.unk_00[1][player->unk_254]; + player->unk_084 = D_800E2400.unk_00[1][player->characterId]; + player->unk_088 = D_800E24B4.unk_00[1][player->characterId]; + player->unk_210 = D_800E2568.unk_00[1][player->characterId]; + player->unk_214 = D_800E261C.unk_00[1][player->characterId]; break; case 3: - player->unk_084 = D_800E2400.unk_00[4][player->unk_254]; - player->unk_088 = D_800E24B4.unk_00[4][player->unk_254]; - player->unk_210 = D_800E2568.unk_00[4][player->unk_254]; - player->unk_214 = D_800E261C.unk_00[4][player->unk_254]; + player->unk_084 = D_800E2400.unk_00[4][player->characterId]; + player->unk_088 = D_800E24B4.unk_00[4][player->characterId]; + player->unk_210 = D_800E2568.unk_00[4][player->characterId]; + player->unk_214 = D_800E261C.unk_00[4][player->characterId]; break; } @@ -175,9 +175,9 @@ void spawn_player(Player *player, s8 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg player->unk_0B8 = 0.0f; player->unk_0E4 = 0.0f; player->unk_0E8 = 0.0f; - player->unk_0EC = 0.0f; - player->unk_0F0 = 0.0f; - player->unk_0F4 = 0.0f; + player->kartHopVelocity = 0.0f; + player->kartHopJerk = 0.0f; + player->kartHopAcceleration = 0.0f; player->unk_104 = 0.0f; player->unk_108 = 0.0f; player->unk_1F8 = 0.0f; diff --git a/src/code_800431B0.c b/src/code_800431B0.c index 9f2332c76..147451d40 100644 --- a/src/code_800431B0.c +++ b/src/code_800431B0.c @@ -5418,7 +5418,7 @@ void func_8004F3E4(s32 arg0) { phi_s0_2 = (temp_s1_2 * 2) + &D_80164360; do { temp_a1 = *phi_s0_2; - func_8004F168(arg0, temp_a1, D_800DC4DC[temp_a1].unk_254); + func_8004F168(arg0, temp_a1, D_800DC4DC[temp_a1].characterId); temp_s0 = phi_s0_2 - 2; phi_s0_2 = temp_s0; } while (temp_s0 >= &D_80164360); @@ -5440,7 +5440,7 @@ void func_8004F3E4(s32 arg0) { phi_v0 = phi_v0_2; phi_s1_2 = temp_s1_3; } while (temp_s1_3 != 8); - func_8004F168(arg0, 0, phi_v0_2->unk_254); + func_8004F168(arg0, 0, phi_v0_2->characterId); return; } temp_s1_4 = D_8018D158 - 1; @@ -5463,7 +5463,7 @@ void func_8004F3E4(s32 arg0) { temp_a1_3 = *phi_s0_5; temp_v0_3 = &D_800DC4DC[temp_a1_3]; if ((temp_v0_3->unk_000 & 0x1000) != 0x1000) { - func_8004F168(arg0, temp_a1_3, temp_v0_3->unk_254); + func_8004F168(arg0, temp_a1_3, temp_v0_3->characterId); } temp_s0_3 = phi_s0_5 - 2; phi_s0_5 = temp_s0_3; @@ -6040,7 +6040,7 @@ void func_80050320(void) { } temp_v1 = *(temp_v0 + &D_8018CF80); temp_a1 = *(&lapCount + (*(temp_v0 + &D_80164360) * 4)); - if (temp_v1 == D_800DC4DC->unk_254) { + if (temp_v1 == D_800DC4DC->characterId) { func_8004FDB4(*temp_t0, temp_f14, phi_a0, temp_a1, phi_s0, temp_a1, temp_v1, 0xFF, 1, phi_a0, 0); } else { func_8004FDB4(*temp_t0, temp_f14, phi_a0, temp_a1, phi_s0, temp_a1, temp_v1, D_8018D3E0, 0, phi_a0, 0); @@ -6065,7 +6065,7 @@ void func_80050320(void) { } temp_v0_2 = *((phi_s0_2 * 2) + &D_80164360); temp_a1_2 = *(&lapCount + (temp_v0_2 * 4)); - temp_v1_2 = D_800DC4DC[temp_v0_2].unk_254; + temp_v1_2 = D_800DC4DC[temp_v0_2].characterId; if (temp_v0_2 == 0) { func_8004FDB4(*temp_t0_2, temp_f14_2, phi_a0_2, temp_a1_2, phi_s0_2, temp_a1_2, temp_v1_2, 0xFF, 1, phi_a0_2, 1); } else { @@ -6283,7 +6283,7 @@ void func_80050E34(s32 arg0, s32 arg1) { temp_v0 = &D_800DC4DC[arg0]; spAC = temp_v0; temp_s0 = *(&lapCount + (arg0 * 4)); - temp_s1 = temp_v0->unk_254; + temp_s1 = temp_v0->characterId; temp_t5 = *(&D_8018CE24 + (arg0 << 5)); if (gPlayerCountSelection1 == 1) { spC4 = 0x12; diff --git a/src/code_80057C60.c b/src/code_80057C60.c index 0fb32bd9f..42bdf2789 100644 --- a/src/code_80057C60.c +++ b/src/code_80057C60.c @@ -976,7 +976,7 @@ void func_80059C50(void) { phi_v0 = &D_8018CF80; do { temp_v0 = phi_v0 + 2; - temp_v0->unk-2 = D_800DC4DC[*phi_a0].unk_254; + temp_v0->unk-2 = D_800DC4DC[*phi_a0].characterId; phi_a0 += 2; phi_v0 = temp_v0; } while (temp_v0 < &D_8018CF90); @@ -1894,23 +1894,23 @@ void func_8005C980(void) { temp_v0_2 = phi_a0_2->unk0; phi_t0->unk0 = temp_v0_2; if (temp_a1 == 0) { - *(&D_8018CF80 + phi_v1) = temp_a3[temp_v0_2].unk_254; + *(&D_8018CF80 + phi_v1) = temp_a3[temp_v0_2].characterId; } temp_a2 = phi_a0_2->unk2; phi_t0->unk2 = temp_a2; if (temp_a1 == 0) { - (&D_8018CF80 + phi_v1)->unk2 = temp_a3[temp_a2].unk_254; + (&D_8018CF80 + phi_v1)->unk2 = temp_a3[temp_a2].characterId; } temp_a2_2 = phi_a0_2->unk4; phi_t0->unk4 = temp_a2_2; if (temp_a1 == 0) { - (&D_8018CF80 + phi_v1)->unk4 = temp_a3[temp_a2_2].unk_254; + (&D_8018CF80 + phi_v1)->unk4 = temp_a3[temp_a2_2].characterId; } temp_a2_3 = phi_a0_2->unk6; phi_t0->unk6 = temp_a2_3; phi_a0_2 += 8; if (temp_a1 == 0) { - (&D_8018CF80 + phi_v1)->unk6 = temp_a3[temp_a2_3].unk_254; + (&D_8018CF80 + phi_v1)->unk6 = temp_a3[temp_a2_3].characterId; } temp_t0 = phi_t0 + 8; phi_t0 = temp_t0; @@ -2024,7 +2024,7 @@ void func_8005CB60(s32 arg0, s32 arg1) { D_80165658.unk4 = 0; D_80165658.unk0 = 0; } - temp_a1 = D_800DC4DC[arg0].unk_254; + temp_a1 = D_800DC4DC[arg0].characterId; arg0 = temp_a3; sp20 = temp_v1; func_800C90F4(0, (temp_a1 * 0x10) + 0x2900800D, 1, temp_a3); diff --git a/src/code_8008C1D0.c b/src/code_8008C1D0.c index 85698391f..b6ec8749a 100644 --- a/src/code_8008C1D0.c +++ b/src/code_8008C1D0.c @@ -257,12 +257,12 @@ void func_8008C528(Player *player, s8 arg1) { s32 temp_v1; func_8008C354(player, arg1); func_8008C310(player); - temp_v1 = player->unk_254; + temp_v1 = player->characterId; player->unk_0C2 = 0; - player->unk_0F0 = D_800E37B0[temp_v1]; - player->unk_0F4 = 0.0f; + player->kartHopJerk = D_800E37B0[temp_v1]; + player->kartHopAcceleration = 0.0f; - player->unk_0EC = D_800E3790[temp_v1]; + player->kartHopVelocity = D_800E3790[temp_v1]; player->unk_0A8 = 0; player->unk_0BC = player->unk_0BC | 0x400; player->unk_0BC = player->unk_0BC & ~0x10; @@ -343,7 +343,7 @@ void func_8008C73C(Player *player, s8 arg1, s8 unk3, s8 unk4) { D_80165420[arg1++] = 0.0f; D_8018D920[D_80165190[0][0]] = 0; if (((player->unk_000 & 0x4000) == 0x4000) && ((player->unk_000 & 0x100) != 0x100)) { - func_800C90F4(arg1 & 0xFF, (player->unk_254 * 0x10) + 0x29008003, player, player->unk_000); + func_800C90F4(arg1 & 0xFF, (player->characterId * 0x10) + 0x29008003, player, player->unk_000); return; } func_800098FC(arg1, player, player, player->unk_000); diff --git a/src/code_80281FA0.c b/src/code_80281FA0.c index c92f7811e..a7fca4aa2 100644 --- a/src/code_80281FA0.c +++ b/src/code_80281FA0.c @@ -1172,7 +1172,7 @@ GLOBAL_ASM("asm/non_matchings/code_80281FA0/func_80283B6C.s") void func_80283BA4(s32 arg0) { func_800CA0B8(); - func_800C90F4(0, (D_800DC4E8->unk_254 * 0x10) + 0x29008004); + func_800C90F4(0, (D_800DC4E8->characterId * 0x10) + 0x29008004); func_800CA0A0(); } #else diff --git a/src/kart_attributes.inc.c b/src/kart_attributes.inc.c index 483a75ee8..8900393ec 100644 --- a/src/kart_attributes.inc.c +++ b/src/kart_attributes.inc.c @@ -92,7 +92,7 @@ float D_800E25DC[] = { // Extra 310.0, 310.0, 314.0, 314.0, 310.0, 310.0, 314.0, 310.0, }; float D_800E25FC[] = { // Battle mode - 245.0, 245.0, 245.0, 245.0, 245.0, 245.0, 245.0, 245.0, + 245.0, 245.0, 245.0, 245.0, 245.0, 245.0, 245.0, 245.0, }; struct D_800E261C D_800E261C = { @@ -421,10 +421,10 @@ float gKartTurnSpeedReductionTable1[] = { float gKartTable800E36B0[] = { 2.0, 2.0, 3.0, 3.0, 1.5, 1.5, 3.0, 3.0, }; -float gKartHopHeightTable[] = { +float gKartHopInitialVelocityTable[] = { 0.93, 0.93, 0.93, 0.93, 0.93, 0.93, 0.93, 0.93, }; -float gKartHopFallSpeedTable[] = { +float gKartHopJerkTable[] = { 0.03, 0.03, 0.03, 0.03, 0.03, 0.03, 0.03, 0.03, }; float D_800E3710[] = { diff --git a/src/staff_ghosts.c b/src/staff_ghosts.c index bd416fc24..3f438b058 100644 --- a/src/staff_ghosts.c +++ b/src/staff_ghosts.c @@ -498,8 +498,8 @@ void func_80005B18(void) { func_800052A4(); //gModeSelection, &D_80162DDC, 3, &D_80162DD4); D_80162DD4 = 0; D_80162DDC = 1; - D_80162DE0 = D_800DC4DC->unk_254; - D_80162DE8 = D_800DC4DC->unk_254; + D_80162DE0 = D_800DC4DC->characterId; + D_80162DE8 = D_800DC4DC->characterId; D_80162E00 = 0; D_80162DFC = D_8018CA78; func_80005AE8(D_800DC4E0); // (u16) &D_80162DDC); @@ -510,10 +510,10 @@ void func_80005B18(void) { D_80162DD0 = D_80162DCC; func_800052A4(); // gModeSelection, &D_80162DDC, 3, &D_80162DD4); D_80162DDC = 1; - D_80162DE0 = D_800DC4DC->unk_254; + D_80162DE0 = D_800DC4DC->characterId; D_80162DFC = D_8018CA78; D_80162E00 = 0; - D_80162DE8 = D_800DC4DC->unk_254; + D_80162DE8 = D_800DC4DC->characterId; func_80005AE8(D_800DC4E0); // (u16) &D_80162DDC); func_80005AE8(D_800DC4E4); return; @@ -523,7 +523,7 @@ void func_80005B18(void) { D_80162D80 = (void *) ((D_80162DC8 << 0xF) + 0x3000 + &D_802BFB80); D_80162D84 = D_80162D86; D_80162DD0 = D_80162DCC; - D_80162DE8 = D_800DC4DC->unk_254; + D_80162DE8 = D_800DC4DC->characterId; D_80162DD8 = 0; D_80162DD4 = 0; D_80162DDC = 1;