mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-02-28 14:21:16 +00:00
So many improvements!!
- Scoped Weapons/Binoculars now working perfectly - Haptic Feedback implemented -
This commit is contained in:
parent
7902c68107
commit
ff2c351549
16 changed files with 170 additions and 90 deletions
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.rtcwquest"
|
||||
android:versionCode="4"
|
||||
android:versionName="0.4.0" android:installLocation="auto" >
|
||||
android:versionCode="5"
|
||||
android:versionName="0.5.0" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
||||
|
|
|
@ -1294,7 +1294,6 @@ void RTCWVR_Init()
|
|||
positional_movementSideways = 0.0f;
|
||||
positional_movementForward = 0.0f;
|
||||
snapTurn = 0.0f;
|
||||
scopeEngaged = qfalse;
|
||||
ducked = DUCK_NOTDUCKED;
|
||||
RTCWVR_ResyncClientYawWithGameYaw();
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
typedef struct {
|
||||
float fov;
|
||||
qboolean weapon_stabilised;
|
||||
qboolean right_handed;
|
||||
|
||||
vec3_t hmdposition;
|
||||
vec3_t hmdposition_last; // Don't use this, it is just for calculating delta!
|
||||
|
@ -20,8 +21,12 @@ typedef struct {
|
|||
|
||||
vec3_t weaponoffset;
|
||||
|
||||
vec3_t flashlightangles;
|
||||
vec3_t flashlightoffset;
|
||||
qboolean scopeengaged; // Scope has been engaged on a scoped weapon
|
||||
qboolean scopeready; // Scope can be engaged
|
||||
qboolean scopedweapon; // Weapon supports scope
|
||||
|
||||
vec3_t offhandangles;
|
||||
vec3_t offhandoffset;
|
||||
} vr_client_info_t;
|
||||
|
||||
#endif //vr_client_info_h
|
|
@ -25,7 +25,6 @@ float remote_movementUp;
|
|||
float positional_movementSideways;
|
||||
float positional_movementForward;
|
||||
float snapTurn;
|
||||
qboolean scopeEngaged;
|
||||
|
||||
void sendButtonAction(const char* action, long buttonDown);
|
||||
void sendButtonActionSimple(const char* action);
|
||||
|
@ -36,6 +35,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
ovrInputStateTrackedRemote *pOffTrackedRemoteNew, ovrInputStateTrackedRemote *pOffTrackedRemoteOld, ovrTracking* pOffTracking,
|
||||
int domButton1, int domButton2, int offButton1, int offButton2 );
|
||||
|
||||
void updateScopeAngles(float forwardYaw);
|
||||
void updateScopeAngles();
|
||||
|
||||
#endif //vrinput_h
|
|
@ -124,12 +124,12 @@ void acquireTrackedRemotesData(const ovrMobile *Ovr, double displayTime) {//The
|
|||
|
||||
|
||||
//YAW: Left increase, Right decrease
|
||||
void updateScopeAngles(float forwardYaw)
|
||||
void updateScopeAngles()
|
||||
{
|
||||
//Bit of a hack, but use weapon orientation / position for view when scope is engaged
|
||||
static vec3_t currentScopeAngles;
|
||||
static vec3_t lastScopeAngles;
|
||||
if (scopeEngaged)
|
||||
if (vr.scopeengaged)
|
||||
{
|
||||
//Set Position
|
||||
VectorSet(vr.hmdposition, vr.hmdposition[0] + vr.weaponoffset[0], vr.hmdposition[1] + vr.weaponoffset[1], vr.hmdposition[2] + vr.weaponoffset[2]);
|
||||
|
@ -137,7 +137,7 @@ void updateScopeAngles(float forwardYaw)
|
|||
|
||||
//Lerp the weapon angles to smooth out shaky hands a bit
|
||||
vec3_t angles;
|
||||
VectorSet(angles, vr.weaponangles[PITCH], vr.weaponangles[YAW] - forwardYaw, vr.hmdorientation[ROLL]);
|
||||
VectorSet(angles, vr.weaponangles[PITCH], vr.weaponangles[YAW], vr.hmdorientation[ROLL]);
|
||||
|
||||
VectorLerp(currentScopeAngles, 0.125, angles, currentScopeAngles);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
|
||||
{
|
||||
//Ensure handedness is set correctly
|
||||
Cvar_Set("hand", vr_control_scheme->value < 10 ? "0" : "1");
|
||||
vr.right_handed = vr_control_scheme->value < 10;
|
||||
|
||||
//Get the cvar
|
||||
sv_cheats = Cvar_Get("cheats", "1", CVAR_ARCHIVE);
|
||||
|
@ -61,12 +61,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
|
||||
}
|
||||
|
||||
static float forwardYaw = 0;
|
||||
if (scopeEngaged)
|
||||
{
|
||||
//forwardYaw = (cl.viewangles[YAW] - vr.hmdorientation[YAW]);
|
||||
}
|
||||
|
||||
//Menu button
|
||||
handleTrackedControllerButton(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, ovrButton_Enter, K_ESCAPE);
|
||||
|
||||
|
@ -137,14 +131,15 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
|
||||
//Engage scope if conditions are right
|
||||
if (vr.weapon_stabilised && !scopeEngaged && distanceToHMD < SCOPE_ENGAGE_DISTANCE)
|
||||
vr.scopeready = vr.weapon_stabilised && (distanceToHMD < SCOPE_ENGAGE_DISTANCE) && vr.scopedweapon;
|
||||
if (!vr.scopeengaged && vr.scopeready)
|
||||
{
|
||||
scopeEngaged = qtrue;
|
||||
sendButtonActionSimple("weapalt");
|
||||
}
|
||||
else if (scopeEngaged && (distanceToHMD > SCOPE_ENGAGE_DISTANCE || !vr.weapon_stabilised))
|
||||
else if (vr.scopeengaged && !vr.scopeready)
|
||||
{
|
||||
scopeEngaged = qfalse;
|
||||
//Set this here so we don't retrigger scope by accident too soon
|
||||
vr.scopeengaged = qfalse;
|
||||
sendButtonActionSimple("weapalt");
|
||||
RTCWVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
|
@ -206,7 +201,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
} else{
|
||||
if (dominantGripPushed) {
|
||||
//Initiate crowbar from backpack mode
|
||||
//Initiate knife from backpack mode
|
||||
sendButtonActionSimple("weapon 0");
|
||||
int channel = (vr_control_scheme->integer >= 10) ? 0 : 1;
|
||||
RTCWVR_Vibrate(80, channel, 0.8); // vibrate to let user know they switched
|
||||
|
@ -215,7 +210,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
} else if (grabMeleeWeapon == 1 && !dominantGripPushed) {
|
||||
//Restores last used weapon
|
||||
sendButtonActionSimple("lastinv");
|
||||
sendButtonActionSimple("weaplastused");
|
||||
grabMeleeWeapon = 0;
|
||||
}
|
||||
}
|
||||
|
@ -224,17 +219,15 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
float controllerYawHeading = 0.0f;
|
||||
//off-hand stuff
|
||||
{
|
||||
vr.flashlightoffset[0] = pOffTracking->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.flashlightoffset[1] = pOffTracking->HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
vr.flashlightoffset[2] = pOffTracking->HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
vr.offhandoffset[0] = pOffTracking->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.offhandoffset[1] = pOffTracking->HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
vr.offhandoffset[2] = pOffTracking->HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
|
||||
vec3_t rotation = {0};
|
||||
QuatToYawPitchRoll(pOffTracking->HeadPose.Pose.Orientation, rotation, vr.flashlightangles);
|
||||
|
||||
vr.flashlightangles[YAW] += (cl.viewangles[YAW] - vr.hmdorientation[YAW]);
|
||||
QuatToYawPitchRoll(pOffTracking->HeadPose.Pose.Orientation, rotation, vr.offhandangles);
|
||||
|
||||
if (vr_walkdirection->value == 0) {
|
||||
controllerYawHeading = -cl.viewangles[YAW] + vr.flashlightangles[YAW];
|
||||
controllerYawHeading = vr.offhandangles[YAW] - vr.hmdorientation[YAW];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -270,14 +263,14 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
//in meantime, then it wouldn't stop the gun firing and it would get stuck
|
||||
static bool firingPrimary = false;
|
||||
|
||||
if (!firingPrimary && dominantGripPushed && (GetTimeInMilliSeconds() - dominantGripPushTime) > vr_reloadtimeoutms->integer)
|
||||
if (!firingPrimary && dominantGripPushed && (GetTimeInMilliSeconds() - dominantGripPushTime) > vr_reloadtimeoutms->integer && !vr.scopedweapon)
|
||||
{
|
||||
//Fire Secondary
|
||||
if (((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger))
|
||||
&& (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger))
|
||||
{
|
||||
//sendButtonActionSimple("weapalt");
|
||||
sendButtonActionSimple("weapalt");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -289,13 +282,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
firingPrimary = (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger);
|
||||
sendButtonAction("+attack", firingPrimary);
|
||||
}
|
||||
// we need to release secondary fire if dominantGripPushed has been released before releasing trigger -> should fix the gun jamming and non stop firing secondary attack bug
|
||||
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger) &&
|
||||
(pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) == false)
|
||||
{
|
||||
//sendButtonActionSimple("weapalt");
|
||||
}
|
||||
}
|
||||
|
||||
//Duck with A
|
||||
|
@ -459,7 +445,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
}
|
||||
|
||||
updateScopeAngles(forwardYaw);
|
||||
updateScopeAngles();
|
||||
}
|
||||
|
||||
//Save state
|
||||
|
|
|
@ -2051,8 +2051,13 @@ static void CG_DrawWeapReticle( void ) {
|
|||
//vec4_t snoopercolor = {0.7, .8, 0.7, 0}; // greenish
|
||||
vec4_t snoopercolor = {0.7, .8, 0.7, 1}; // greenish
|
||||
|
||||
float indent = 0.265;
|
||||
float X_WIDTH=640;
|
||||
float Y_HEIGHT=480;
|
||||
|
||||
|
||||
float snooperBrightness;
|
||||
float x = 80, y, w = 240, h = 240;
|
||||
float x = (X_WIDTH * indent), y = (Y_HEIGHT * indent), w = (X_WIDTH * (1-(2*indent))) / 2.0f, h = (Y_HEIGHT * (1-(2*indent))) / 2;
|
||||
|
||||
CG_AdjustFrom640( &x, &y, &w, &h );
|
||||
|
||||
|
@ -2064,19 +2069,20 @@ static void CG_DrawWeapReticle( void ) {
|
|||
}
|
||||
|
||||
|
||||
if ( weap == WP_SNIPERRIFLE ) {
|
||||
|
||||
|
||||
// sides
|
||||
CG_FillRect( 0, 0, 80, 480, color );
|
||||
CG_FillRect( 560, 0, 80, 480, color );
|
||||
// sides
|
||||
CG_FillRect( 0, 0, (X_WIDTH * indent), Y_HEIGHT, color );
|
||||
CG_FillRect( X_WIDTH * (1 - indent), 0, (X_WIDTH * indent), Y_HEIGHT, color );
|
||||
// top/bottom
|
||||
CG_FillRect( X_WIDTH * indent, 0, X_WIDTH * (1-indent), Y_HEIGHT * indent, color );
|
||||
CG_FillRect( X_WIDTH * indent, Y_HEIGHT * (1-indent), X_WIDTH * (1-indent), Y_HEIGHT * indent, color );
|
||||
|
||||
if ( weap == WP_SNIPERRIFLE ) {
|
||||
// center
|
||||
if ( cgs.media.reticleShaderSimpleQ ) {
|
||||
trap_R_DrawStretchPic( x, 0, w, h, 0, 0, 1, 1, cgs.media.reticleShaderSimpleQ ); // tl
|
||||
trap_R_DrawStretchPic( x + w, 0, w, h, 1, 0, 0, 1, cgs.media.reticleShaderSimpleQ ); // tr
|
||||
trap_R_DrawStretchPic( x, h, w, h, 0, 1, 1, 0, cgs.media.reticleShaderSimpleQ ); // bl
|
||||
trap_R_DrawStretchPic( x + w, h, w, h, 1, 1, 0, 0, cgs.media.reticleShaderSimpleQ ); // br
|
||||
trap_R_DrawStretchPic( x, y, w, h, 0, 0, 1, 1, cgs.media.reticleShaderSimpleQ ); // tl
|
||||
trap_R_DrawStretchPic( x + w, y, w, h, 1, 0, 0, 1, cgs.media.reticleShaderSimpleQ ); // tr
|
||||
trap_R_DrawStretchPic( x, y + h, w, h, 0, 1, 1, 0, cgs.media.reticleShaderSimpleQ ); // bl
|
||||
trap_R_DrawStretchPic( x + w, y + h, w, h, 1, 1, 0, 0, cgs.media.reticleShaderSimpleQ ); // br
|
||||
}
|
||||
|
||||
// hairs
|
||||
|
@ -2085,9 +2091,6 @@ static void CG_DrawWeapReticle( void ) {
|
|||
CG_FillRect( 319, 300, 2, 178, color ); // center bot
|
||||
CG_FillRect( 380, 239, 177, 2, color ); // right
|
||||
} else if ( weap == WP_SNOOPERSCOPE ) {
|
||||
// sides
|
||||
CG_FillRect( 0, 0, 80, 480, color );
|
||||
CG_FillRect( 560, 0, 80, 480, color );
|
||||
|
||||
// center
|
||||
|
||||
|
@ -2101,7 +2104,7 @@ static void CG_DrawWeapReticle( void ) {
|
|||
//----(SA) end
|
||||
|
||||
if ( cgs.media.snooperShaderSimple ) {
|
||||
CG_DrawPic( 80, 0, 480, 480, cgs.media.snooperShaderSimple );
|
||||
CG_DrawPic((X_WIDTH * indent), (Y_HEIGHT * indent), (X_WIDTH * (1-(2*indent))), (Y_HEIGHT * (1-(2*indent))), cgs.media.snooperShaderSimple );
|
||||
}
|
||||
|
||||
// hairs
|
||||
|
@ -2124,16 +2127,13 @@ static void CG_DrawWeapReticle( void ) {
|
|||
|
||||
CG_FillRect( 240, 220, 1, 40, color ); // r
|
||||
} else if ( weap == WP_FG42SCOPE ) {
|
||||
// sides
|
||||
CG_FillRect( 0, 0, 80, 480, color );
|
||||
CG_FillRect( 560, 0, 80, 480, color );
|
||||
|
||||
// center
|
||||
if ( cgs.media.reticleShaderSimpleQ ) {
|
||||
trap_R_DrawStretchPic( x, 0, w, h, 0, 0, 1, 1, cgs.media.reticleShaderSimpleQ ); // tl
|
||||
trap_R_DrawStretchPic( x + w, 0, w, h, 1, 0, 0, 1, cgs.media.reticleShaderSimpleQ ); // tr
|
||||
trap_R_DrawStretchPic( x, h, w, h, 0, 1, 1, 0, cgs.media.reticleShaderSimpleQ ); // bl
|
||||
trap_R_DrawStretchPic( x + w, h, w, h, 1, 1, 0, 0, cgs.media.reticleShaderSimpleQ ); // br
|
||||
trap_R_DrawStretchPic( x, y, w, h, 0, 0, 1, 1, cgs.media.reticleShaderSimpleQ ); // tl
|
||||
trap_R_DrawStretchPic( x + w, y, w, h, 1, 0, 0, 1, cgs.media.reticleShaderSimpleQ ); // tr
|
||||
trap_R_DrawStretchPic( x, y + h, w, h, 0, 1, 1, 0, cgs.media.reticleShaderSimpleQ ); // bl
|
||||
trap_R_DrawStretchPic( x + w, y + h, w, h, 1, 1, 0, 0, cgs.media.reticleShaderSimpleQ ); // br
|
||||
}
|
||||
|
||||
// hairs
|
||||
|
@ -2161,14 +2161,27 @@ CG_DrawBinocReticle
|
|||
static void CG_DrawBinocReticle( void ) {
|
||||
// an alternative. This gives nice sharp lines at the expense of a few extra polys
|
||||
vec4_t color = {0, 0, 0, 1};
|
||||
float x, y, w = 320, h = 240;
|
||||
float indent = 0.265;
|
||||
float X_WIDTH=640;
|
||||
float Y_HEIGHT=480;
|
||||
|
||||
float x = (X_WIDTH * indent), y = (Y_HEIGHT * indent), w = (X_WIDTH * (1-(2*indent))) / 2.0f, h = (Y_HEIGHT * (1-(2*indent))) / 2;
|
||||
|
||||
// sides
|
||||
CG_FillRect( 0, 0, (X_WIDTH * indent), Y_HEIGHT, color );
|
||||
CG_FillRect( X_WIDTH * (1 - indent), 0, (X_WIDTH * indent), Y_HEIGHT, color );
|
||||
// top/bottom
|
||||
CG_FillRect( X_WIDTH * indent, 0, X_WIDTH * (1-indent), Y_HEIGHT * indent, color );
|
||||
CG_FillRect( X_WIDTH * indent, Y_HEIGHT * (1-indent), X_WIDTH * (1-indent), Y_HEIGHT * indent, color );
|
||||
|
||||
|
||||
CG_AdjustFrom640( &x, &y, &w, &h );
|
||||
|
||||
if ( cgs.media.binocShaderSimpleQ ) {
|
||||
CG_AdjustFrom640( &x, &y, &w, &h );
|
||||
trap_R_DrawStretchPic( 0, 0, w, h, 0, 0, 1, 1, cgs.media.binocShaderSimpleQ ); // tl
|
||||
trap_R_DrawStretchPic( w, 0, w, h, 1, 0, 0, 1, cgs.media.binocShaderSimpleQ ); // tr
|
||||
trap_R_DrawStretchPic( 0, h, w, h, 0, 1, 1, 0, cgs.media.binocShaderSimpleQ ); // bl
|
||||
trap_R_DrawStretchPic( w, h, w, h, 1, 1, 0, 0, cgs.media.binocShaderSimpleQ ); // br
|
||||
trap_R_DrawStretchPic( x, y, w, h, 0, 0, 1, 1, cgs.media.binocShaderSimpleQ ); // tl
|
||||
trap_R_DrawStretchPic( x + w, y, w, h, 1, 0, 0, 1, cgs.media.binocShaderSimpleQ ); // tr
|
||||
trap_R_DrawStretchPic( x, y + h, w, h, 0, 1, 1, 0, cgs.media.binocShaderSimpleQ ); // bl
|
||||
trap_R_DrawStretchPic( x + w, y + h, w, h, 1, 1, 0, 0, cgs.media.binocShaderSimpleQ ); // br
|
||||
}
|
||||
|
||||
CG_FillRect( 146, 239, 348, 1, color );
|
||||
|
@ -3390,7 +3403,7 @@ static void CG_Draw2D( void ) {
|
|||
// don't draw any status if dead
|
||||
if ( cg.snap->ps.stats[STAT_HEALTH] > 0 ) {
|
||||
|
||||
if (cg.zoomedScope) {
|
||||
if (cg.zoomedScope || cg.zoomedBinoc) {
|
||||
CG_DrawCrosshair();
|
||||
}
|
||||
|
||||
|
@ -3572,7 +3585,6 @@ void CG_DrawActive( int stereoView ) {
|
|||
cg_worldScale.value * (-cg_stereoSeparation.value / 2) : //left
|
||||
cg_worldScale.value * (cg_stereoSeparation.value / 2); // right
|
||||
|
||||
|
||||
cg.refdef.worldscale = cg_worldScale.value;
|
||||
VectorCopy(cg.refdefViewAngles, cg.refdef.viewangles);
|
||||
|
||||
|
@ -3581,7 +3593,8 @@ void CG_DrawActive( int stereoView ) {
|
|||
|
||||
// offset vieworg appropriately if we're doing stereo separation
|
||||
VectorCopy( cg.refdef.vieworg, baseOrg );
|
||||
if ( separation != 0 ) {
|
||||
|
||||
if ( !cgVR->scopeengaged ) {
|
||||
VectorMA( cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg );
|
||||
}
|
||||
|
||||
|
|
|
@ -35,12 +35,33 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
|
||||
#include "cg_local.h"
|
||||
#include "../../../RTCWVR/VrClientInfo.h"
|
||||
|
||||
///////////////////////
|
||||
extern int propellerModel;
|
||||
///////////////////////
|
||||
|
||||
|
||||
extern vr_client_info_t *cgVR;
|
||||
|
||||
void rotateAboutOrigin(float x, float y, float rotation, vec2_t out);
|
||||
void convertFromVR(vec3_t in, vec3_t offset, vec3_t out);
|
||||
|
||||
static void CG_CalculateVRPropPosition( vec3_t origin, vec3_t angles ) {
|
||||
|
||||
convertFromVR(cgVR->offhandoffset, cg.refdef.vieworg, origin);
|
||||
origin[2] -= 64;
|
||||
origin[2] += (cgVR->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
|
||||
|
||||
VectorCopy(cgVR->offhandangles, angles);
|
||||
angles[YAW] = cg.refdefViewAngles[YAW] + (cgVR->offhandangles[YAW] - cgVR->hmdorientation[YAW]);
|
||||
|
||||
vec3_t forward, right, up;
|
||||
AngleVectors( angles, forward, right, up );
|
||||
VectorMA( origin, -20, forward, origin );
|
||||
VectorMA( origin, 18, right, origin );
|
||||
VectorMA( origin, 6, up, origin );
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
|
@ -2126,8 +2147,9 @@ static void CG_Prop( centity_t *cent ) {
|
|||
ent.backlerp = 0;
|
||||
} else
|
||||
{
|
||||
VectorCopy( cg.refdef.vieworg, ent.origin );
|
||||
VectorCopy( cg.refdefViewAngles, angles );
|
||||
CG_CalculateVRPropPosition(ent.origin, angles);
|
||||
// VectorCopy( cg.refdef.vieworg, ent.origin );
|
||||
// VectorCopy( cg.refdefViewAngles, angles );
|
||||
|
||||
if ( cg.bobcycle & 1 ) {
|
||||
scale = -cg.xyspeed;
|
||||
|
@ -2136,10 +2158,10 @@ static void CG_Prop( centity_t *cent ) {
|
|||
}
|
||||
|
||||
// modify angles from bobbing
|
||||
angles[ROLL] += scale * cg.bobfracsin * 0.005;
|
||||
/* angles[ROLL] += scale * cg.bobfracsin * 0.005;
|
||||
angles[YAW] += scale * cg.bobfracsin * 0.01;
|
||||
angles[PITCH] += cg.xyspeed * cg.bobfracsin * 0.005;
|
||||
|
||||
*/
|
||||
VectorCopy( angles, cent->lerpAngles );
|
||||
|
||||
ent.frame = s1->frame;
|
||||
|
|
|
@ -2576,6 +2576,11 @@ void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent
|
|||
}
|
||||
}
|
||||
|
||||
if (cgVR->scopeengaged)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// don't draw weapon stuff when looking through a scope
|
||||
if ( weaponNum == WP_SNOOPERSCOPE || weaponNum == WP_SNIPERRIFLE || weaponNum == WP_FG42SCOPE ||
|
||||
weapSelect == WP_SNOOPERSCOPE || weapSelect == WP_SNIPERRIFLE || weapSelect == WP_FG42SCOPE ) {
|
||||
|
@ -3830,6 +3835,7 @@ void CG_SetSniperZoom( int lastweap, int newweap ) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
switch ( newweap ) {
|
||||
|
||||
default:
|
||||
|
@ -3856,6 +3862,8 @@ void CG_SetSniperZoom( int lastweap, int newweap ) {
|
|||
break;
|
||||
}
|
||||
|
||||
cgVR->scopeengaged = cg.zoomedScope != 0;
|
||||
|
||||
// if(shake) {
|
||||
// (SA) all shake disabled 11/12
|
||||
// CG_StartShakeCamera( shake, 1000, cg.snap->ps.origin, 100 );
|
||||
|
@ -3946,6 +3954,20 @@ void CG_FinishWeaponChange( int lastweap, int newweap ) {
|
|||
}
|
||||
}
|
||||
|
||||
switch ( newweap ) {
|
||||
case WP_GARAND:
|
||||
case WP_SNIPERRIFLE:
|
||||
case WP_MAUSER:
|
||||
case WP_SNOOPERSCOPE:
|
||||
case WP_FG42:
|
||||
case WP_FG42SCOPE:
|
||||
cgVR->scopedweapon = qtrue;
|
||||
break;
|
||||
default:
|
||||
cgVR->scopedweapon = qfalse;
|
||||
break;
|
||||
}
|
||||
|
||||
cg.weaponSelect = newweap;
|
||||
}
|
||||
|
||||
|
|
|
@ -1218,6 +1218,8 @@ void trap_GetUsercmd( int clientNum, usercmd_t *cmd );
|
|||
qboolean trap_GetEntityToken( char *buffer, int bufferSize );
|
||||
qboolean trap_GetTag( int clientNum, char *tagName, orientation_t * or );
|
||||
|
||||
int trap_Vibrate(float duration, int channel, float intensity );
|
||||
|
||||
int trap_DebugPolygonCreate( int color, int numPoints, vec3_t *points );
|
||||
void trap_DebugPolygonDelete( int id );
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ typedef enum {
|
|||
|
||||
G_GETTAG,
|
||||
|
||||
G_SET_VR_CLIENT_INFO,
|
||||
G_HAPTIC,
|
||||
|
||||
BOTLIB_SETUP = 200, // ( void );
|
||||
BOTLIB_SHUTDOWN, // ( void );
|
||||
|
|
|
@ -255,6 +255,10 @@ qboolean trap_GetTag( int clientNum, char *tagName, orientation_t *or ) {
|
|||
return syscall( G_GETTAG, clientNum, tagName, or );
|
||||
}
|
||||
|
||||
int trap_Vibrate(float duration, int channel, float intensity ) {
|
||||
return syscall( G_HAPTIC, PASSFLOAT(duration), channel, PASSFLOAT(intensity) );
|
||||
}
|
||||
|
||||
// BotLib traps start here
|
||||
int trap_BotLibSetup( void ) {
|
||||
return syscall( BOTLIB_SETUP );
|
||||
|
|
|
@ -183,7 +183,9 @@ void Weapon_Knife( gentity_t *ent ) {
|
|||
}
|
||||
}
|
||||
|
||||
G_Damage( traceEnt, ent, ent, vec3_origin, tr.endpos, ( damage + rand() % 5 ) * s_quadFactor, 0, mod );
|
||||
trap_Vibrate(50, gVR->right_handed ? 1 : 0, 0.6);
|
||||
|
||||
G_Damage( traceEnt, ent, ent, vec3_origin, tr.endpos, ( damage + rand() % 5 ) * s_quadFactor, 0, mod );
|
||||
}
|
||||
|
||||
// JPW NERVE
|
||||
|
@ -692,20 +694,20 @@ float G_GetWeaponSpread( int weapon ) {
|
|||
if ( g_userAim.integer ) {
|
||||
// these should be higher since they become erratic if aiming is out
|
||||
switch ( weapon ) {
|
||||
case WP_LUGER: return 600;
|
||||
case WP_LUGER: return 400;
|
||||
case WP_SILENCER: return 900;
|
||||
case WP_COLT: return 700;
|
||||
case WP_COLT: return 600;
|
||||
case WP_AKIMBO: return 700; //----(SA) added
|
||||
case WP_VENOM: return 1000;
|
||||
case WP_MP40: return 1000;
|
||||
case WP_FG42SCOPE: return 300;
|
||||
case WP_FG42SCOPE: return 100;
|
||||
case WP_FG42: return 800;
|
||||
case WP_THOMPSON: return 1200;
|
||||
case WP_STEN: return 1200;
|
||||
case WP_MAUSER: return 400;
|
||||
case WP_GARAND: return 500;
|
||||
case WP_SNIPERRIFLE: return 300;
|
||||
case WP_SNOOPERSCOPE: return 300;
|
||||
case WP_SNIPERRIFLE: return 100;
|
||||
case WP_SNOOPERSCOPE: return 100;
|
||||
}
|
||||
} else { // old values
|
||||
switch ( weapon ) {
|
||||
|
@ -957,7 +959,11 @@ void Bullet_Fire( gentity_t *ent, float spread, int damage ) {
|
|||
|
||||
LOGI("Bullet_Fire %i %i %i",(int)end[0],(int)end[1],(int)end[2]);
|
||||
|
||||
|
||||
trap_Vibrate(100, gVR->right_handed ? 1 : 0, 1.0);
|
||||
if (gVR->weapon_stabilised)
|
||||
{
|
||||
trap_Vibrate(100, gVR->right_handed ? 0 : 1, 0.7);
|
||||
}
|
||||
|
||||
//If we have an autoaim target and player shooting..
|
||||
if (g_autoAimEntity && !(ent->r.svFlags& SVF_CASTAI))
|
||||
|
@ -1862,6 +1868,16 @@ void FireWeapon( gentity_t *ent ) {
|
|||
aimSpreadScale = 1.0;
|
||||
}
|
||||
|
||||
//Let VR user be the bad shot
|
||||
aimSpreadScale /= 1.2;
|
||||
|
||||
if (gVR->weapon_stabilised)
|
||||
{
|
||||
//Stabilised weapon is even more accurate
|
||||
aimSpreadScale /= 2.0;
|
||||
}
|
||||
|
||||
|
||||
// fire the specific weapon
|
||||
switch ( ent->s.weapon ) {
|
||||
case WP_KNIFE:
|
||||
|
@ -1946,7 +1962,12 @@ void FireWeapon( gentity_t *ent ) {
|
|||
case WP_PANZERFAUST:
|
||||
ent->client->ps.classWeaponTime = level.time; // JPW NERVE
|
||||
Weapon_RocketLauncher_Fire( ent, aimSpreadScale );
|
||||
break;
|
||||
trap_Vibrate(200, gVR->right_handed ? 1 : 0, 1.0);
|
||||
if (gVR->weapon_stabilised)
|
||||
{
|
||||
trap_Vibrate(200, gVR->right_handed ? 0 : 1, 0.7);
|
||||
}
|
||||
break;
|
||||
case WP_GRENADE_LAUNCHER:
|
||||
case WP_GRENADE_PINEAPPLE:
|
||||
case WP_DYNAMITE:
|
||||
|
|
|
@ -417,7 +417,7 @@ void RB_BeginDrawingView( void ) {
|
|||
|
||||
// sync with gl if needed
|
||||
if ( r_finish->integer == 1 && !glState.finishCalled ) {
|
||||
qglFinish();
|
||||
//qglFinish();
|
||||
glState.finishCalled = qtrue;
|
||||
}
|
||||
if ( r_finish->integer == 0 ) {
|
||||
|
@ -1151,7 +1151,7 @@ void RE_StretchRaw( int x, int y, int w, int h, int cols, int rows, const byte *
|
|||
R_SyncRenderThread();
|
||||
|
||||
// we definately want to sync every frame for the cinematics
|
||||
qglFinish();
|
||||
//qglFinish();
|
||||
|
||||
start = end = 0;
|
||||
if ( r_speeds->integer ) {
|
||||
|
@ -1518,7 +1518,7 @@ void RB_ShowImages( void ) {
|
|||
|
||||
qglClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
qglFinish();
|
||||
//qglFinish();
|
||||
|
||||
|
||||
start = ri.Milliseconds();
|
||||
|
@ -1583,7 +1583,7 @@ void RB_ShowImages( void ) {
|
|||
if (!text)
|
||||
qglDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||
#endif
|
||||
qglFinish();
|
||||
//qglFinish();
|
||||
|
||||
end = ri.Milliseconds();
|
||||
ri.Printf( PRINT_ALL, "%i msec to draw all images\n", end - start );
|
||||
|
@ -1625,6 +1625,7 @@ RB_SwapBuffers
|
|||
|
||||
=============
|
||||
*/
|
||||
void GPUWaitSync();
|
||||
const void *RB_SwapBuffers( const void *data ) {
|
||||
const swapBuffersCommand_t *cmd;
|
||||
|
||||
|
@ -1663,7 +1664,8 @@ const void *RB_SwapBuffers( const void *data ) {
|
|||
if ( !glState.finishCalled )
|
||||
{
|
||||
//LOGI("GLFINISH");
|
||||
qglFinish();
|
||||
GPUWaitSync();
|
||||
//qglFinish();
|
||||
}
|
||||
|
||||
GLimp_LogComment( "***************** RB_SwapBuffers *****************\n\n\n" );
|
||||
|
|
|
@ -537,7 +537,7 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
static float yaw = 0;
|
||||
static long long lastFrameIndex = 0;
|
||||
long long frameIndex = RTCWVR_getFrameIndex();
|
||||
if ((RTCWVR_useScreenLayer() || resyncClientYawWithGameYaw > 0 || scopeEngaged))
|
||||
if ((RTCWVR_useScreenLayer() || resyncClientYawWithGameYaw > 0 || vr.scopeengaged))
|
||||
{
|
||||
//Resyncing with known game yaw
|
||||
yaw = fd->viewangles[YAW];
|
||||
|
|
|
@ -303,6 +303,8 @@ static int FloatAsInt( float f ) {
|
|||
return temp;
|
||||
}
|
||||
|
||||
void RTCWVR_Vibrate(float duration, int channel, float intensity );
|
||||
|
||||
/*
|
||||
====================
|
||||
SV_GameSystemCalls
|
||||
|
@ -469,6 +471,9 @@ int SV_GameSystemCalls( int *args ) {
|
|||
return 0;
|
||||
case G_GETTAG:
|
||||
return SV_GetTag( args[1], VMA( 2 ), VMA( 3 ) );
|
||||
case G_HAPTIC:
|
||||
RTCWVR_Vibrate( VMF(1), args[2], VMF( 3 ) );
|
||||
return 0;
|
||||
|
||||
//====================================
|
||||
|
||||
|
|
Loading…
Reference in a new issue