Small change to lightsaber swing sound triggers

This commit is contained in:
Simon 2022-10-10 22:56:22 +01:00
parent fb15cd462d
commit 3c7074f5d3
4 changed files with 7 additions and 11 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.jk2quest"
android:versionCode="13"
android:versionName="0.1.0" android:installLocation="auto" >
android:versionCode="14"
android:versionName="0.1.1" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -1736,12 +1736,11 @@ static void CG_DrawCrosshair3D(void)
hShader = cgs.media.crosshairShader[ ca % NUM_CROSSHAIRS ];
float xmax = 64.0f * tan(cg.refdef.fov_x * M_PI / 360.0f);
float maxdist = (cgs.glconfig.vidWidth * 64.0f / (2 * xmax)) * 1.5f;
vec3_t forward, weaponangles, origin;
BG_CalculateVRWeaponPosition(origin, weaponangles);
AngleVectors(weaponangles, forward, NULL, NULL);
VectorMA(origin, maxdist, forward, endpos);
VectorMA(origin, 2048, forward, endpos);
CG_Trace(&trace, origin, NULL, NULL, endpos, 0, MASK_SHOT);
if (trace.fraction != 1.0f) {
@ -1751,7 +1750,7 @@ static void CG_DrawCrosshair3D(void)
VectorCopy(trace.endpos, ent.origin);
ent.radius = w / 640 * xmax * trace.fraction * maxdist / 64.0f;
ent.radius = w / 640 * xmax * trace.fraction * 2048 / 64.0f;
ent.customShader = hShader;
ent.shaderRGBA[0] = 255;
ent.shaderRGBA[1] = 255;

View file

@ -3445,7 +3445,6 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
if (player1stPersonSaber && !cent->currentState.saberInFlight)
{
//#ifdef JK2_MODE
memset( &hiltEnt, 0, sizeof(refEntity_t) );
hiltEnt.renderfx = RF_DEPTHHACK;
hiltEnt.hModel = cgi_R_RegisterModel( "models/weapons2/saber/saber_w.md3" );
@ -3460,16 +3459,14 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
cgi_R_AddRefEntityToScene(&hiltEnt);
static int playingSaberSwingSound = 0;
if (vr->primaryswingvelocity > WEAPON_VELOCITY_TRIGGER && (cg.time - playingSaberSwingSound) > 750)
if (vr->primaryswingvelocity > WEAPON_VELOCITY_TRIGGER && ((cg.time - playingSaberSwingSound) > 800))
{
cgi_S_StartSound ( hiltEnt.origin, cent->gent->s.number, CHAN_AUTO, cgi_S_RegisterSound( va( "sound/weapons/saber/saberhup%d.wav", Q_irand( 0, 2 ) * 3 + 1 ) ) );
cgi_S_StartSound ( hiltEnt.origin, cent->gent->s.number, CHAN_AUTO, cgi_S_RegisterSound( va( "sound/weapons/saber/saberhup%d.wav", Q_irand( 1, 9 ) ) ) );
playingSaberSwingSound = cg.time;
}
//Try setting ent to be the hilt entity, then any subsequent effects below are applied to that instead
ent = &hiltEnt;
//#else
//#endif
}
// Disruptor Gun Alt-fire

View file

@ -32,7 +32,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "../../code/qcommon/q_shared.h"
//How fast the saber/melee needs to be physically swung in order to trigger sounds and trails
#define WEAPON_VELOCITY_TRIGGER 0.6f
#define WEAPON_VELOCITY_TRIGGER 1.0f
typedef enum //# weapon_e
{