Made stun baton a velocity triggered weapon

This commit is contained in:
Simon 2023-03-22 20:34:12 +00:00
parent d00d0a6a26
commit 858c5b7f31
5 changed files with 14 additions and 8 deletions

View file

@ -18,7 +18,11 @@ Authors : Simon Brown
#include <statindex.h>
#include "android/sys_local.h"
#include "weapons.h"
#ifdef JK2_MODE
#include "../OpenJK/codeJK2//game/weapons.h"
#else
#include "../OpenJK/code/game/weapons.h"
#endif
void SV_Trace( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask, int capsule );
@ -397,7 +401,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
ALOGV("**WEAPON EVENT** veocity triggered -attack");
sendButtonAction("+attack", vr.secondaryVelocityTriggeredAttack);
}
} else if (cl.frame.ps.weapon == WP_SABER) {
} else if (cl.frame.ps.weapon == WP_SABER ||
cl.frame.ps.weapon == WP_STUN_BATON) {
//Does weapon velocity trigger attack
if (vr.velocitytriggered) {
static bool fired = false;
@ -410,7 +415,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
vr_weapon_velocity_trigger->value);
}
bool triggered = (vr.primaryVelocityTriggeredAttack || vr.secondaryVelocityTriggeredAttack);
bool triggered = vr.primaryVelocityTriggeredAttack || (vr.dualsabers && vr.secondaryVelocityTriggeredAttack);
if (fired != triggered)
{
ALOGV("**WEAPON EVENT** veocity triggered %s",
@ -486,7 +491,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
delta[2] = pOff->Pose.position.z - pWeapon->Pose.position.z;
int anglesToSet = ANGLES_ADJUSTED;
if (cl.frame.ps.weapon == WP_SABER)
if (cl.frame.ps.weapon == WP_SABER ||
cl.frame.ps.weapon == WP_STUN_BATON)
{
anglesToSet = ANGLES_SABER;
VectorNegate(delta, delta);

View file

@ -6972,7 +6972,7 @@ void CG_Player( centity_t *cent ) {
if (cent->gent->client->ps.clientNum == 0) {
vr->velocitytriggered = (!cg.renderingThirdPerson &&
(cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE));
(cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE || cg.snap->ps.weapon == WP_STUN_BATON));
}

View file

@ -39,7 +39,7 @@ void WP_FireStunBaton( gentity_t *ent, qboolean alt_fire )
vec3_t angs, forward;
if ( BG_UseVRPosition(ent))
{
BG_CalculateVRWeaponPosition(muzzle, angs);
BG_CalculateVRSaberPosition(0, muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {

View file

@ -4890,7 +4890,7 @@ void CG_Player(centity_t *cent ) {
if (cent->gent->client->ps.clientNum == 0) {
vr->velocitytriggered = (!cg.renderingThirdPerson &&
(cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE));
(cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE || cg.snap->ps.weapon == WP_STUN_BATON));
}
//Get the player's light level for stealth calculations

View file

@ -41,7 +41,7 @@ void WP_FireStunBaton( gentity_t *ent, qboolean alt_fire )
vec3_t angs, forward;
if ( BG_UseVRPosition(ent))
{
BG_CalculateVRWeaponPosition(wpMuzzle, angs);
BG_CalculateVRSaberPosition(wpMuzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {