Rapid fire mode on arwing

This commit is contained in:
Kiloku 2025-01-04 21:08:04 -03:00 committed by Alejandro Asenjo Nitti
parent 0c6b548e3c
commit 0b5dfd900e
4 changed files with 18 additions and 5 deletions

View File

@ -1770,8 +1770,9 @@ void PlayerShot_SearchLockOnTarget(PlayerShot* shot) {
Object_Kill(&shot->obj, shot->sfxSource);
}
} else {
bool rapidFire = CVarGetInteger("gRapidFire", 0) == 1;
if ((shot->obj.pos.y < gGroundHeight) || PlayerShot_FindLockTarget(shot) ||
!(gControllerHold[gMainController].button & A_BUTTON) || (shot->timer == 0)) {
(!(gControllerHold[gMainController].button & A_BUTTON)^rapidFire) || (shot->timer == 0)) {
Object_Kill(&shot->obj, shot->sfxSource);
}
}

View File

@ -2813,7 +2813,8 @@ void Actor_Update(Actor* this) {
}
}
} else if (this->lockOnTimers[TEAM_ID_FOX] != 0) {
if (!(gControllerHold[gMainController].button & A_BUTTON)) {
bool rapidFire = CVarGetInteger("gRapidFire", 0) == 1;
if (!(gControllerHold[gMainController].button & A_BUTTON) || (rapidFire && (gControllerHold[gMainController].button & A_BUTTON))) {
this->lockOnTimers[TEAM_ID_FOX]--;
}
gChargeTimers[0] = 0;

View File

@ -3324,7 +3324,8 @@ bool Player_UpdateLockOn(Player* player) {
bool hasBombTarget;
s32 i;
if (gInputHold->button & A_BUTTON) {
bool rapidFire = CVarGetInteger("gRapidFire", 0) == 1;
if (rapidFire ? !(gInputHold->button & A_BUTTON) : (gInputHold->button & A_BUTTON)) {
gChargeTimers[player->num]++;
if (gChargeTimers[player->num] > 21) {
gChargeTimers[player->num] = 21;
@ -3440,6 +3441,8 @@ bool Player_UpdateLockOn(Player* player) {
}
void Player_Shoot(Player* player) {
bool rapidFire = CVarGetInteger("gRapidFire", 0) == 1;
switch (player->form) {
case FORM_ARWING:
if ((player->arwing.rightWingState <= WINGSTATE_BROKEN) ||
@ -3452,6 +3455,11 @@ void Player_Shoot(Player* player) {
} else {
Math_SmoothStepToF(&player->arwing.laserGunsYpos, 0.0f, 1.0f, 0.5f, 0.0f);
}
if (rapidFire && (gShootButton[player->num] & gInputHold->button)){
if (player->shotTimer <= 0){
player->shotTimer = 3;
}
}
if (gShootButton[player->num] & gInputPress->button) {
Player_ArwingLaser(player);
player->shotTimer = 8;

View File

@ -498,6 +498,9 @@ void DrawCheatsMenu() {
UIWidgets::CVarCheckbox("Hyper Laser", "gHyperLaser");
UIWidgets::CVarSliderInt("Laser Range Multiplier: %d%%", "gLaserRangeMult", 15, 800, 100,
{ .tooltip = "Changes how far your lasers fly." });
UIWidgets::CVarCheckbox("Rapid-fire mode", "gRapidFire", {
.tooltip = "Hold A to keep firing. Release A to start charging a shot."
});
UIWidgets::CVarCheckbox("Self destruct button", "gHit64SelfDestruct", {
.tooltip = "Press Down on the D-PAD to instantly self destruct."
});