From 45c6813ce6fc2f2411d4d936ec9936e1531550c8 Mon Sep 17 00:00:00 2001 From: Kiloku Date: Sat, 28 Dec 2024 14:27:37 -0300 Subject: [PATCH 1/3] Name a few Boost related variables --- src/engine/fox_play.c | 32 ++++++++++++++++---------------- src/engine/fox_tank.c | 16 ++++++++-------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/engine/fox_play.c b/src/engine/fox_play.c index 95900a19..ec3f2d9b 100644 --- a/src/engine/fox_play.c +++ b/src/engine/fox_play.c @@ -4949,8 +4949,8 @@ void Player_UpdateTankRoll(Player* player) { } void Player_ArwingBoost(Player* player) { - f32 sp2C; - f32 sp28; + f32 boostRecoverRate; + f32 boostDepleteRate; s32 stickY; if ((player->boostMeter != 0.0f) && (gInputHold->button & gBrakeButton[player->num]) && @@ -4959,12 +4959,12 @@ void Player_ArwingBoost(Player* player) { } if (gLevelMode == LEVELMODE_ON_RAILS) { - sp28 = 3.0f; - sp2C = 0.5f; + boostDepleteRate = 3.0f; + boostRecoverRate = 0.5f; } else { - sp28 = 1.5f; - sp2C = 0.35f; + boostDepleteRate = 1.5f; + boostRecoverRate = 0.35f; } player->sfx.boost = 0; @@ -5044,7 +5044,7 @@ void Player_ArwingBoost(Player* player) { Math_SmoothStepToF(&player->arwing.upperLeftFlapYrot, 0.0f, 0.5f, 100.0f, 0.0f); Math_SmoothStepToF(&player->arwing.bottomLeftFlapYrot, 0.0f, 0.5f, 100.0f, 0.0f); } - player->boostMeter += sp28; + player->boostMeter += boostDepleteRate; if (player->boostMeter > 90.0f) { player->boostMeter = 90.0f; player->boostCooldown = true; @@ -5063,7 +5063,7 @@ void Player_ArwingBoost(Player* player) { Math_SmoothStepToF(&D_ctx_801779A8[player->num], 50.0f, 1.0f, 10.0f, 0.0f); } else { if (player->boostMeter > 0.0f) { - player->boostMeter -= sp2C; + player->boostMeter -= boostRecoverRate; if (player->boostMeter <= 0.0f) { player->boostMeter = 0.0f; player->boostCooldown = false; @@ -5085,16 +5085,16 @@ void Player_ArwingBoost2(Player* player) { } void Player_ArwingBrake(Player* player) { - f32 sp34; - f32 sp30; + f32 brakeRecoverRate; + f32 brakeDepleteRate; s32 stickY; if (gLevelMode == LEVELMODE_ON_RAILS) { - sp30 = 3.0f; - sp34 = 0.5f; + brakeDepleteRate = 3.0f; + brakeRecoverRate = 0.5f; } else { - sp30 = 1.5f; - sp34 = 0.35f; + brakeDepleteRate = 1.5f; + brakeRecoverRate = 0.35f; } player->sfx.brake = false; @@ -5143,7 +5143,7 @@ void Player_ArwingBrake(Player* player) { Math_SmoothStepToF(&player->arwing.bottomLeftFlapYrot, -90.0f, 0.2f, 100.0f, 0.0f); } - player->boostMeter += sp30; + player->boostMeter += brakeDepleteRate; if (player->boostMeter > 90.0f) { player->boostCooldown = true; player->boostMeter = 90.0f; @@ -5159,7 +5159,7 @@ void Player_ArwingBrake(Player* player) { player->sfx.brake = true; Math_SmoothStepToF(&D_ctx_801779A8[player->num], 25.0f, 1.0f, 5.0f, 0.0f); } else if (player->boostMeter > 0.0f) { - player->boostMeter -= sp34; + player->boostMeter -= brakeRecoverRate; if (player->boostMeter <= 0.0f) { player->boostMeter = 0.0f; player->boostCooldown = false; diff --git a/src/engine/fox_tank.c b/src/engine/fox_tank.c index 86150893..81c21a16 100644 --- a/src/engine/fox_tank.c +++ b/src/engine/fox_tank.c @@ -15,7 +15,7 @@ u8 D_800C9F04 = 0; u8 D_800C9F08 = 0; s32 D_800C9F0C = 0; // unused. f32 D_800C9F10 = 0.0f; -s32 D_800C9F14 = 0; +s32 activeBurnerCount = 0; s32 D_800C9F18[2] = { 0, 0 }; // unused. f32 D_800C9F20 = 0.0f; f32 D_800C9F24 = 0.0f; @@ -549,7 +549,7 @@ void func_tank_80045348(Player* player) { if (player->unk_19C >= 0) { if ((gBoostButton[player->num] & gInputHold->button) && !player->boostCooldown) { - D_800C9F14++; + activeBurnerCount++; sp2E = true; if (D_800C9F24 == 0.0f) { player->unk_190 = player->unk_194 = 4.0f; @@ -572,7 +572,7 @@ void func_tank_80045348(Player* player) { D_800C9F24 = 0.0f; } if ((gBrakeButton[player->num] & gInputHold->button) && !player->boostCooldown && !sp2E) { - D_800C9F14++; + activeBurnerCount++; baseSpeedTarget = 5.0f; sp40 = 100.0f; sp3C = 0.2f; @@ -599,7 +599,7 @@ void func_tank_80045678(Player* player) { Audio_KillSfxBySourceAndId(player->sfxSource, NA_SE_TANK_SLIDE); } if ((gInputHold->button & Z_TRIG) && !player->boostCooldown) { - D_800C9F14++; + activeBurnerCount++; if (D_800C9F20 == 0.0f) { AUDIO_PLAY_SFX(NA_SE_TANK_BURNER_HALF, player->sfxSource, 0); } @@ -629,7 +629,7 @@ void func_tank_80045678(Player* player) { Audio_KillSfxBySourceAndId(player->sfxSource, NA_SE_TANK_SLIDE); } if ((gInputHold->button & R_TRIG) && !player->boostCooldown) { - D_800C9F14++; + activeBurnerCount++; if (player->unk_2C0 == 0.0f) { AUDIO_PLAY_SFX(NA_SE_TANK_BURNER_HALF, player->sfxSource, 0); } @@ -1115,12 +1115,12 @@ void Tank_UpdateOnRails(Player* player) { player->wingPosition = 1; func_tank_80045130(player); - D_800C9F14 = 0; + activeBurnerCount = 0; func_tank_80045678(player); func_tank_80045348(player); if (!player->boostCooldown) { - if (D_800C9F14 != 0) { - if (D_800C9F14 >= 2) { + if (activeBurnerCount != 0) { + if (activeBurnerCount >= 2) { player->boostMeter += 2.0f; } else { player->boostMeter += 1.0f; From ac3be4275081b132555c8304c64ded7512d05e17 Mon Sep 17 00:00:00 2001 From: Kiloku Date: Sat, 28 Dec 2024 14:49:17 -0300 Subject: [PATCH 2/3] follow code style --- src/engine/fox_tank.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/engine/fox_tank.c b/src/engine/fox_tank.c index 81c21a16..3f6cdcd8 100644 --- a/src/engine/fox_tank.c +++ b/src/engine/fox_tank.c @@ -15,7 +15,7 @@ u8 D_800C9F04 = 0; u8 D_800C9F08 = 0; s32 D_800C9F0C = 0; // unused. f32 D_800C9F10 = 0.0f; -s32 activeBurnerCount = 0; +s32 gTankActiveBurnerCount = 0; s32 D_800C9F18[2] = { 0, 0 }; // unused. f32 D_800C9F20 = 0.0f; f32 D_800C9F24 = 0.0f; @@ -549,7 +549,7 @@ void func_tank_80045348(Player* player) { if (player->unk_19C >= 0) { if ((gBoostButton[player->num] & gInputHold->button) && !player->boostCooldown) { - activeBurnerCount++; + gTankActiveBurnerCount++; sp2E = true; if (D_800C9F24 == 0.0f) { player->unk_190 = player->unk_194 = 4.0f; @@ -572,7 +572,7 @@ void func_tank_80045348(Player* player) { D_800C9F24 = 0.0f; } if ((gBrakeButton[player->num] & gInputHold->button) && !player->boostCooldown && !sp2E) { - activeBurnerCount++; + gTankActiveBurnerCount++; baseSpeedTarget = 5.0f; sp40 = 100.0f; sp3C = 0.2f; @@ -599,7 +599,7 @@ void func_tank_80045678(Player* player) { Audio_KillSfxBySourceAndId(player->sfxSource, NA_SE_TANK_SLIDE); } if ((gInputHold->button & Z_TRIG) && !player->boostCooldown) { - activeBurnerCount++; + gTankActiveBurnerCount++; if (D_800C9F20 == 0.0f) { AUDIO_PLAY_SFX(NA_SE_TANK_BURNER_HALF, player->sfxSource, 0); } @@ -629,7 +629,7 @@ void func_tank_80045678(Player* player) { Audio_KillSfxBySourceAndId(player->sfxSource, NA_SE_TANK_SLIDE); } if ((gInputHold->button & R_TRIG) && !player->boostCooldown) { - activeBurnerCount++; + gTankActiveBurnerCount++; if (player->unk_2C0 == 0.0f) { AUDIO_PLAY_SFX(NA_SE_TANK_BURNER_HALF, player->sfxSource, 0); } @@ -1115,12 +1115,12 @@ void Tank_UpdateOnRails(Player* player) { player->wingPosition = 1; func_tank_80045130(player); - activeBurnerCount = 0; + gTankActiveBurnerCount = 0; func_tank_80045678(player); func_tank_80045348(player); if (!player->boostCooldown) { - if (activeBurnerCount != 0) { - if (activeBurnerCount >= 2) { + if (gTankActiveBurnerCount != 0) { + if (gTankActiveBurnerCount >= 2) { player->boostMeter += 2.0f; } else { player->boostMeter += 1.0f; From 7781cc04c2af1bc30ea8947b3fb14efb99d4bbd3 Mon Sep 17 00:00:00 2001 From: Kiloku Date: Sun, 29 Dec 2024 21:05:28 -0300 Subject: [PATCH 3/3] Variable is Static, not Global --- src/engine/fox_tank.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/engine/fox_tank.c b/src/engine/fox_tank.c index 3f6cdcd8..0573ce30 100644 --- a/src/engine/fox_tank.c +++ b/src/engine/fox_tank.c @@ -15,7 +15,7 @@ u8 D_800C9F04 = 0; u8 D_800C9F08 = 0; s32 D_800C9F0C = 0; // unused. f32 D_800C9F10 = 0.0f; -s32 gTankActiveBurnerCount = 0; +s32 sTankActiveBurnerCount = 0; s32 D_800C9F18[2] = { 0, 0 }; // unused. f32 D_800C9F20 = 0.0f; f32 D_800C9F24 = 0.0f; @@ -549,7 +549,7 @@ void func_tank_80045348(Player* player) { if (player->unk_19C >= 0) { if ((gBoostButton[player->num] & gInputHold->button) && !player->boostCooldown) { - gTankActiveBurnerCount++; + sTankActiveBurnerCount++; sp2E = true; if (D_800C9F24 == 0.0f) { player->unk_190 = player->unk_194 = 4.0f; @@ -572,7 +572,7 @@ void func_tank_80045348(Player* player) { D_800C9F24 = 0.0f; } if ((gBrakeButton[player->num] & gInputHold->button) && !player->boostCooldown && !sp2E) { - gTankActiveBurnerCount++; + sTankActiveBurnerCount++; baseSpeedTarget = 5.0f; sp40 = 100.0f; sp3C = 0.2f; @@ -599,7 +599,7 @@ void func_tank_80045678(Player* player) { Audio_KillSfxBySourceAndId(player->sfxSource, NA_SE_TANK_SLIDE); } if ((gInputHold->button & Z_TRIG) && !player->boostCooldown) { - gTankActiveBurnerCount++; + sTankActiveBurnerCount++; if (D_800C9F20 == 0.0f) { AUDIO_PLAY_SFX(NA_SE_TANK_BURNER_HALF, player->sfxSource, 0); } @@ -629,7 +629,7 @@ void func_tank_80045678(Player* player) { Audio_KillSfxBySourceAndId(player->sfxSource, NA_SE_TANK_SLIDE); } if ((gInputHold->button & R_TRIG) && !player->boostCooldown) { - gTankActiveBurnerCount++; + sTankActiveBurnerCount++; if (player->unk_2C0 == 0.0f) { AUDIO_PLAY_SFX(NA_SE_TANK_BURNER_HALF, player->sfxSource, 0); } @@ -1115,12 +1115,12 @@ void Tank_UpdateOnRails(Player* player) { player->wingPosition = 1; func_tank_80045130(player); - gTankActiveBurnerCount = 0; + sTankActiveBurnerCount = 0; func_tank_80045678(player); func_tank_80045348(player); if (!player->boostCooldown) { - if (gTankActiveBurnerCount != 0) { - if (gTankActiveBurnerCount >= 2) { + if (sTankActiveBurnerCount != 0) { + if (sTankActiveBurnerCount >= 2) { player->boostMeter += 2.0f; } else { player->boostMeter += 1.0f;