mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-04-23 15:33:23 +00:00
Recoil for silencer and haptics to replace screen shake
This commit is contained in:
parent
8d9f218c97
commit
0644bd7cf1
5 changed files with 16 additions and 6 deletions
|
@ -1340,7 +1340,7 @@ void RTCWVR_Init()
|
|||
vr.backpackitemactive = 0;
|
||||
vr.visible_hud = qtrue;
|
||||
vr.dualwield = qfalse;
|
||||
vr.pistol_recoil = 0.0f;
|
||||
vr.weapon_recoil = 0.0f;
|
||||
|
||||
//Clear teleport stuff
|
||||
vr.teleportexecute = qfalse;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define vr_client_info_h
|
||||
|
||||
#define NUM_WEAPON_SAMPLES 10
|
||||
#define WEAPON_RECOIL 15.0f;
|
||||
|
||||
typedef struct {
|
||||
qboolean screen;
|
||||
|
@ -29,6 +30,8 @@ typedef struct {
|
|||
vec3_t weaponangles_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t weaponangles_delta;
|
||||
|
||||
float weapon_recoil; // recoil effect to improve the default
|
||||
|
||||
vec3_t current_weaponoffset;
|
||||
vec3_t calculated_weaponoffset;
|
||||
float current_weaponoffset_timestamp;
|
||||
|
@ -36,7 +39,6 @@ typedef struct {
|
|||
float weaponoffset_history_timestamp[NUM_WEAPON_SAMPLES];
|
||||
|
||||
qboolean pistol; // True if the weapon is a pistol
|
||||
float pistol_recoil; // hacky recoil effect to improve the default
|
||||
|
||||
//Lots of scope weapon stuff
|
||||
qboolean scopeengaged; // Scope has been engaged on a scoped weapon
|
||||
|
|
|
@ -102,8 +102,8 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
rotation[PITCH] = 30;
|
||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles_knife);
|
||||
rotation[PITCH] = vr_weapon_pitchadjust->value +
|
||||
(vr.pistol ? vr.pistol_recoil : 0.0f); // Our hacked recoil effect
|
||||
vr.pistol_recoil *= 0.8f; // quick reduction on synthetic recoil
|
||||
(vr.pistol ? vr.weapon_recoil : 0.0f); // Our hacked recoil effect
|
||||
vr.weapon_recoil *= 0.8f; // quick reduction on synthetic recoil
|
||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles);
|
||||
|
||||
VectorSubtract(vr.weaponangles_last, vr.weaponangles, vr.weaponangles_delta);
|
||||
|
|
|
@ -3572,6 +3572,12 @@ CG_ApplyShakeCamera
|
|||
void CG_ApplyShakeCamera() {
|
||||
VectorAdd( cg.refdefViewAngles, cg.cameraShakeAngles, cg.refdefViewAngles );
|
||||
AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
|
||||
|
||||
if (VectorLength(cg.cameraShakeAngles) > 0.01f)
|
||||
{
|
||||
trap_Vibrate(10, 0, Com_Clamp(0.0f, 1.0f, fabs(cg.cameraShakeAngles[0])));
|
||||
trap_Vibrate(10, 1, Com_Clamp(0.0f, 1.0f, fabs(cg.cameraShakeAngles[1])));
|
||||
}
|
||||
}
|
||||
|
||||
void convertFromVR(vec3_t in, vec3_t offset, vec3_t out);
|
||||
|
|
|
@ -1956,16 +1956,18 @@ void FireWeapon( gentity_t *ent ) {
|
|||
case WP_LUGER:
|
||||
Bullet_Fire( ent, LUGER_SPREAD * aimSpreadScale, LUGER_DAMAGE );
|
||||
if (gVR)
|
||||
gVR->pistol_recoil = 15.0f;
|
||||
gVR->weapon_recoil = WEAPON_RECOIL;
|
||||
break;
|
||||
case WP_SILENCER:
|
||||
Bullet_Fire( ent, SILENCER_SPREAD * aimSpreadScale, LUGER_DAMAGE );
|
||||
if (gVR)
|
||||
gVR->weapon_recoil = WEAPON_RECOIL;
|
||||
break;
|
||||
case WP_AKIMBO: //----(SA) added
|
||||
case WP_COLT:
|
||||
Bullet_Fire( ent, COLT_SPREAD * aimSpreadScale, COLT_DAMAGE );
|
||||
if (gVR)
|
||||
gVR->pistol_recoil = 15.0f;
|
||||
gVR->weapon_recoil = WEAPON_RECOIL;
|
||||
break;
|
||||
case WP_VENOM:
|
||||
weapon_venom_fire( ent, qfalse, aimSpreadScale );
|
||||
|
|
Loading…
Reference in a new issue