off hand dual saber now activated by swing

This commit is contained in:
Simon 2023-03-08 21:05:28 +00:00
parent e4da52c377
commit 8c38301bf0
2 changed files with 13 additions and 7 deletions

View File

@ -34,7 +34,7 @@ typedef struct {
bool player_moving;
int move_speed; // 0 (default) = Comfortable (75%) , 1 = Full (100%), 2 = Walk (50%)
bool crouched;
bool dual_wield; // JKA only - is player dual sabers active
bool dualsabers; // JKA only - is player dual sabers active
int cgzoommode;
int cgzoomdir;
int saberBlockDebounce; // Amount of time after player is blocked that the saber position is fixed
@ -103,7 +103,7 @@ typedef struct {
} vr_client_info_t;
#ifndef JKVR_CLIENT
#ifndef JKXR_CLIENT
extern vr_client_info_t *vr;
#endif

View File

@ -371,17 +371,23 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
static bool fired = false;
vr.primaryVelocityTriggeredAttack = (vr.primaryswingvelocity >
vr_weapon_velocity_trigger->value);
//player has to be dual wielding for this to be true
vr.secondaryVelocityTriggeredAttack = vr.dualsabers && (vr.secondaryswingvelocity >
vr_weapon_velocity_trigger->value);
if (fired != vr.primaryVelocityTriggeredAttack) {
bool triggered = (vr.primaryVelocityTriggeredAttack || vr.secondaryVelocityTriggeredAttack);
if (fired != triggered)
{
ALOGV("**WEAPON EVENT** veocity triggered %s",
vr.primaryVelocityTriggeredAttack ? "+attack" : "-attack");
triggered ? "+attack" : "-attack");
//normal attack is a punch with the left hand
sendButtonAction("+attack", vr.primaryVelocityTriggeredAttack);
fired = vr.primaryVelocityTriggeredAttack;
sendButtonAction("+attack", triggered);
fired = triggered;
}
} else if (vr.primaryVelocityTriggeredAttack) {
} else if (vr.primaryVelocityTriggeredAttack || vr.secondaryVelocityTriggeredAttack) {
//send a stop attack as we have an unfinished velocity attack
vr.primaryVelocityTriggeredAttack = false;
vr.secondaryVelocityTriggeredAttack = false;
ALOGV("**WEAPON EVENT** veocity triggered -attack");
sendButtonAction("+attack", vr.primaryVelocityTriggeredAttack);
}