mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2024-11-14 08:30:53 +00:00
Fix exiting of scoped view; Fix left hand with binoculars when using akimbo
This commit is contained in:
parent
7f3682a492
commit
1ce9744162
4 changed files with 38 additions and 47 deletions
|
@ -52,7 +52,9 @@ typedef struct {
|
||||||
|
|
||||||
qboolean hasbinoculars;
|
qboolean hasbinoculars;
|
||||||
|
|
||||||
qboolean velocitytriggered; // Weapon attack triggered by velocity (knife)
|
qboolean velocitytriggered; // Weapon attack triggered by velocity (knife)
|
||||||
|
qboolean weaponstabilizable; // Flag if currently held weapon can be stabilized
|
||||||
|
qboolean dualwielding; // Flag if dual wielding is active
|
||||||
|
|
||||||
vec3_t offhandweaponangles;
|
vec3_t offhandweaponangles;
|
||||||
vec3_t offhandangles;
|
vec3_t offhandangles;
|
||||||
|
|
|
@ -20,17 +20,6 @@ Authors : Simon Brown
|
||||||
#include <src/qcommon/qcommon.h>
|
#include <src/qcommon/qcommon.h>
|
||||||
#include <src/client/client.h>
|
#include <src/client/client.h>
|
||||||
|
|
||||||
#define WP_KNIFE 1
|
|
||||||
#define WP_LUGER 2
|
|
||||||
#define WP_GRENADE_LAUNCHER 6
|
|
||||||
#define WP_COLT 11
|
|
||||||
#define WP_GRENADE_PINEAPPLE 14
|
|
||||||
#define WP_SILENCER 19
|
|
||||||
#define WP_AKIMBO 20
|
|
||||||
#define WP_DYNAMITE 22
|
|
||||||
#define WP_AKIMBO_MP40 23
|
|
||||||
#define WP_AKIMBO_THOMPSON 24
|
|
||||||
|
|
||||||
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 );
|
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 );
|
||||||
|
|
||||||
void RTCWVR_HapticEvent(const char* event, int position, int flags, int intensity, float angle, float yHeight );
|
void RTCWVR_HapticEvent(const char* event, int position, int flags, int intensity, float angle, float yHeight );
|
||||||
|
@ -114,7 +103,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
||||||
QuatToYawPitchRoll(pDominantTracking->HeadPose.Pose.Orientation, rotation, vr.dominanthandangles);
|
QuatToYawPitchRoll(pDominantTracking->HeadPose.Pose.Orientation, rotation, vr.dominanthandangles);
|
||||||
rotation[PITCH] = 30;
|
rotation[PITCH] = 30;
|
||||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles_knife);
|
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles_knife);
|
||||||
qboolean addRecoil = vr.pistol && (vr.weaponid != WP_AKIMBO || vr.akimboFire);
|
qboolean addRecoil = vr.pistol && (!vr.dualwielding || vr.akimboFire);
|
||||||
rotation[PITCH] = vr_weapon_pitchadjust->value + (addRecoil ? vr.weapon_recoil : 0.0f); // Our hacked recoil effect
|
rotation[PITCH] = vr_weapon_pitchadjust->value + (addRecoil ? vr.weapon_recoil : 0.0f); // Our hacked recoil effect
|
||||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles);
|
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles);
|
||||||
|
|
||||||
|
@ -127,7 +116,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
||||||
vec3_t rotation_off = {0};
|
vec3_t rotation_off = {0};
|
||||||
rotation_off[PITCH] = -25;
|
rotation_off[PITCH] = -25;
|
||||||
QuatToYawPitchRoll(pOff->HeadPose.Pose.Orientation, rotation_off, vr.offhandangles);
|
QuatToYawPitchRoll(pOff->HeadPose.Pose.Orientation, rotation_off, vr.offhandangles);
|
||||||
qboolean addRecoil_off = vr.pistol && (vr.weaponid != WP_AKIMBO || !vr.akimboFire);
|
qboolean addRecoil_off = vr.pistol && (!vr.dualwielding || !vr.akimboFire);
|
||||||
rotation_off[PITCH] = vr_weapon_pitchadjust->value + (addRecoil_off ? vr.weapon_recoil : 0.0f); // Our hacked recoil effect
|
rotation_off[PITCH] = vr_weapon_pitchadjust->value + (addRecoil_off ? vr.weapon_recoil : 0.0f); // Our hacked recoil effect
|
||||||
QuatToYawPitchRoll(pOff->HeadPose.Pose.Orientation, rotation_off, vr.offhandweaponangles);
|
QuatToYawPitchRoll(pOff->HeadPose.Pose.Orientation, rotation_off, vr.offhandweaponangles);
|
||||||
|
|
||||||
|
@ -191,12 +180,8 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
||||||
float controllerYawHeading = 0.0f;
|
float controllerYawHeading = 0.0f;
|
||||||
//Turn on weapon stabilisation?
|
//Turn on weapon stabilisation?
|
||||||
qboolean stabilised = qfalse;
|
qboolean stabilised = qfalse;
|
||||||
qboolean usingAkimbo = vr.weaponid == WP_AKIMBO || vr.weaponid == WP_AKIMBO_MP40 || vr.weaponid == WP_AKIMBO_THOMPSON;
|
|
||||||
qboolean usingSingleHandWeapon = vr.weaponid == WP_KNIFE || vr.weaponid == WP_LUGER || vr.weaponid == WP_GRENADE_LAUNCHER ||
|
|
||||||
vr.weaponid == WP_COLT || vr.weaponid == WP_GRENADE_PINEAPPLE || vr.weaponid == WP_SILENCER ||
|
|
||||||
vr.weaponid == WP_DYNAMITE;
|
|
||||||
qboolean usingBinoculars = vr.backpackitemactive == 3 || vr.binocularsActive;
|
qboolean usingBinoculars = vr.backpackitemactive == 3 || vr.binocularsActive;
|
||||||
if (!usingAkimbo && !usingSingleHandWeapon && !usingBinoculars && // Don't stabilise dual guns, single hand weapons and binoculars
|
if (vr.weaponstabilizable && !usingBinoculars && // Don't stabilise dual guns, single hand weapons and binoculars
|
||||||
(pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) && (distance < STABILISATION_DISTANCE))
|
(pOffTrackedRemoteNew->Buttons & ovrButton_GripTrigger) && (distance < STABILISATION_DISTANCE))
|
||||||
{
|
{
|
||||||
stabilised = qtrue;
|
stabilised = qtrue;
|
||||||
|
@ -208,7 +193,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
||||||
qboolean scopeready = vr.weapon_stabilised && (distanceToHMD < SCOPE_ENGAGE_DISTANCE);
|
qboolean scopeready = vr.weapon_stabilised && (distanceToHMD < SCOPE_ENGAGE_DISTANCE);
|
||||||
static qboolean lastScopeReady = qfalse;
|
static qboolean lastScopeReady = qfalse;
|
||||||
if (scopeready != lastScopeReady) {
|
if (scopeready != lastScopeReady) {
|
||||||
if (vr.scopedweapon && !vr.scopedetached) {
|
if (vr.scopedweapon && (!vr.detachablescope || !vr.scopedetached)) {
|
||||||
if (!vr.scopeengaged && scopeready) {
|
if (!vr.scopeengaged && scopeready) {
|
||||||
ALOGV("**WEAPON EVENT** trigger scope mode");
|
ALOGV("**WEAPON EVENT** trigger scope mode");
|
||||||
sendButtonActionSimple("weapalt");
|
sendButtonActionSimple("weapalt");
|
||||||
|
@ -591,7 +576,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
||||||
|
|
||||||
ALOGV("**WEAPON EVENT** Not Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
|
ALOGV("**WEAPON EVENT** Not Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
|
||||||
qboolean firing = (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger);
|
qboolean firing = (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger);
|
||||||
if (usingAkimbo) {
|
if (vr.dualwielding) {
|
||||||
if (firing) {
|
if (firing) {
|
||||||
vr.akimboTriggerState |= ACTIVE_WEAPON_HAND;
|
vr.akimboTriggerState |= ACTIVE_WEAPON_HAND;
|
||||||
sendButtonAction("+attack", firing);
|
sendButtonAction("+attack", firing);
|
||||||
|
@ -733,9 +718,9 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
||||||
|
|
||||||
//We need to record if we have started firing primary so that releasing trigger will stop definitely firing, if user has pushed grip
|
//We need to record if we have started firing primary so that releasing trigger will stop definitely firing, if user has pushed grip
|
||||||
//in meantime, then it wouldn't stop the gun firing and it would get stuck
|
//in meantime, then it wouldn't stop the gun firing and it would get stuck
|
||||||
if (!vr.teleportenabled || usingAkimbo)
|
if (!vr.teleportenabled || vr.dualwielding)
|
||||||
{
|
{
|
||||||
if ((usingAkimbo) && vr.backpackitemactive != 3 && !vr.binocularsActive) {
|
if ((vr.dualwielding) && vr.backpackitemactive != 3 && !vr.binocularsActive) {
|
||||||
// Fire off-hand weapon
|
// Fire off-hand weapon
|
||||||
if ((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) != (pOffTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
if ((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) != (pOffTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
||||||
ALOGV("**WEAPON EVENT** Off-hand trigger %sattack", (pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
|
ALOGV("**WEAPON EVENT** Off-hand trigger %sattack", (pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
|
||||||
|
|
|
@ -1611,9 +1611,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo
|
||||||
CG_DrawWheelSelector();
|
CG_DrawWheelSelector();
|
||||||
} else if (!cgVR->screen){
|
} else if (!cgVR->screen){
|
||||||
CG_AddViewWeapon( &cg.predictedPlayerState );
|
CG_AddViewWeapon( &cg.predictedPlayerState );
|
||||||
int weapon = cg.predictedPlayerState.weapon;
|
if (!cg.renderingThirdPerson && (cgVR->backpackitemactive == 3 || cgVR->binocularsActive || (!cgVR->dualwielding && !cgVR->weapon_stabilised))) {
|
||||||
qboolean usingAkimbo = weapon == WP_AKIMBO || weapon == WP_AKIMBO_MP40 || weapon == WP_AKIMBO_THOMPSON;
|
|
||||||
if (!usingAkimbo && !cgVR->weapon_stabilised && !cg.renderingThirdPerson) {
|
|
||||||
CG_AddViewHand( &cg.predictedPlayerState);
|
CG_AddViewHand( &cg.predictedPlayerState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3783,40 +3783,46 @@ void CG_AddViewWeapon( playerState_t *ps ) {
|
||||||
|
|
||||||
|
|
||||||
//Set some important flags based on the current weapon
|
//Set some important flags based on the current weapon
|
||||||
cgVR->mountedgun = qfalse;
|
cgVR->mountedgun = qfalse;
|
||||||
cgVR->pistol = qfalse;
|
cgVR->pistol = qfalse;
|
||||||
cgVR->weaponid = ps->weapon;
|
cgVR->velocitytriggered = qfalse;
|
||||||
|
cgVR->scopedweapon = qfalse;
|
||||||
|
cgVR->detachablescope = qfalse;
|
||||||
|
cgVR->weaponstabilizable = qfalse;
|
||||||
|
cgVR->dualwielding = qfalse;
|
||||||
switch ( ps->weapon ) {
|
switch ( ps->weapon ) {
|
||||||
case WP_KNIFE:
|
case WP_KNIFE:
|
||||||
cgVR->velocitytriggered = qtrue;
|
cgVR->velocitytriggered = qtrue;
|
||||||
cgVR->scopedweapon = qfalse;
|
|
||||||
break;
|
break;
|
||||||
|
case WP_AKIMBO:
|
||||||
|
cgVR->dualwielding = qtrue;
|
||||||
case WP_LUGER:
|
case WP_LUGER:
|
||||||
case WP_SILENCER:
|
case WP_SILENCER:
|
||||||
case WP_COLT:
|
case WP_COLT:
|
||||||
case WP_AKIMBO:
|
cgVR->pistol = qtrue;
|
||||||
cgVR->velocitytriggered = qfalse;
|
|
||||||
cgVR->scopedweapon = qfalse;
|
|
||||||
cgVR->pistol = qtrue;
|
|
||||||
break;
|
break;
|
||||||
case WP_FG42:
|
case WP_AKIMBO_MP40:
|
||||||
|
case WP_AKIMBO_THOMPSON:
|
||||||
|
cgVR->dualwielding = qtrue;
|
||||||
|
break;
|
||||||
|
case WP_MP40:
|
||||||
|
case WP_STEN:
|
||||||
|
case WP_THOMPSON:
|
||||||
|
case WP_PANZERFAUST:
|
||||||
|
case WP_VENOM:
|
||||||
|
case WP_FLAMETHROWER:
|
||||||
|
case WP_TESLA:
|
||||||
|
cgVR->weaponstabilizable = qtrue;
|
||||||
|
break;
|
||||||
|
case WP_FG42:
|
||||||
case WP_MAUSER:
|
case WP_MAUSER:
|
||||||
cgVR->velocitytriggered = qfalse;
|
cgVR->detachablescope = qtrue;
|
||||||
cgVR->scopedweapon = qtrue;
|
|
||||||
cgVR->detachablescope = qtrue;
|
|
||||||
break;
|
|
||||||
case WP_GARAND:
|
case WP_GARAND:
|
||||||
case WP_SNOOPERSCOPE:
|
case WP_SNOOPERSCOPE:
|
||||||
case WP_SNIPERRIFLE:
|
case WP_SNIPERRIFLE:
|
||||||
case WP_FG42SCOPE:
|
case WP_FG42SCOPE:
|
||||||
cgVR->velocitytriggered = qfalse;
|
|
||||||
cgVR->scopedweapon = qtrue;
|
cgVR->scopedweapon = qtrue;
|
||||||
cgVR->scopedetached = qfalse;
|
cgVR->weaponstabilizable = qtrue;
|
||||||
cgVR->detachablescope = qfalse;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
cgVR->velocitytriggered = qfalse;
|
|
||||||
cgVR->scopedweapon = qfalse;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue