Hopefully final fix to prevent Kata attack being triggered in 1st person when throwing saber

This commit is contained in:
Simon 2023-04-26 21:18:33 +01:00
parent 0e3c88fb1c
commit 86b974ea2e
2 changed files with 11 additions and 6 deletions

View file

@ -550,16 +550,15 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
bool triggered = vr.primaryVelocityTriggeredAttack || (vr.dualsabers && vr.secondaryVelocityTriggeredAttack);
if (fired != triggered &&
//Don't trigger regular attack if the trigger is held down as this can cause a special attack to occur in JKA
!(pDominantTrackedRemoteNew->Buttons & xrButton_Trigger))
if (fired != triggered)
{
ALOGV("**WEAPON EVENT** veocity triggered %s",
triggered ? "+attack" : "-attack");
//normal attack is a punch with the left hand
sendButtonAction("+attack", triggered);
fired = triggered;
}
fired = triggered;
} else if (vr.primaryVelocityTriggeredAttack || vr.secondaryVelocityTriggeredAttack) {
//send a stop attack as we have an unfinished velocity attack
vr.primaryVelocityTriggeredAttack = false;

View file

@ -4124,6 +4124,10 @@ qboolean G_TryingKataAttack( gentity_t *self, usercmd_t *cmd )
{//haven't been holding alt-attack
if ( (cmd->buttons&BUTTON_ATTACK) )
{//pressing attack
//If player is not in 3rd person then we don't perform the kata attack
if ( self && self->client && self->client->ps.clientNum == 0 && !cg.renderingThirdPerson)
return qfalse;
return qtrue;
}
}
@ -7017,9 +7021,11 @@ void WP_SaberThrow( gentity_t *self, usercmd_t *ucmd )
}
if ( (ucmd->buttons&BUTTON_ATTACK)
&& (ucmd->buttons&BUTTON_ALT_ATTACK)
&& !self->client->ps.saberInFlight )
&& !self->client->ps.saberInFlight
&& self->client->ps.clientNum == 0
&& cg.renderingThirdPerson)
{//trying to do special attack, don't throw it
return;
return;
}
else if ( self->client->ps.torsoAnim == BOTH_A1_SPECIAL
|| self->client->ps.torsoAnim == BOTH_A2_SPECIAL