More fixes

- Some stereo depth to the binocular sights (looks better)
- make scopes work better when reloading
- Fix issue with altfire not switching scope on mauser correctly
- fix issue some weapons continuously firing
- Increase scope and binocular activation range
This commit is contained in:
Simon 2020-07-16 22:57:01 +01:00
parent 2469bd8cc8
commit c8bc1f14a5
13 changed files with 93 additions and 47 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.rtcwquest"
android:versionCode="12"
android:versionName="0.12.0" android:installLocation="auto" >
android:versionCode="13"
android:versionName="0.13.0" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -7,8 +7,8 @@
//New control scheme definitions to be defined L1VR_SurfaceView.c enumeration
enum control_scheme;
#define SCOPE_ENGAGE_DISTANCE 0.22
#define BINOCULAR_ENGAGE_DISTANCE 0.2
#define SCOPE_ENGAGE_DISTANCE 0.25
#define BINOCULAR_ENGAGE_DISTANCE 0.25
#define VELOCITY_TRIGGER 1.8
ovrInputStateTrackedRemote leftTrackedRemoteState_old;

View file

@ -31,9 +31,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//Ensure handedness is set correctly
vr.right_handed = vr_control_scheme->value < 10;
//Get the cvar
sv_cheats = Cvar_Get("cheats", "1", CVAR_ARCHIVE);
static qboolean dominantGripPushed = false;
static float dominantGripPushTime = 0.0f;
static bool canUseBackpack = false;
@ -131,16 +128,22 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
}
if (vr.scopedweapon && !vr.scopedetached) {
//Engage scope if conditions are right
qboolean scopeready = vr.weapon_stabilised && (distanceToHMD < SCOPE_ENGAGE_DISTANCE);
if (!vr.scopeengaged && scopeready) {
sendButtonActionSimple("weapalt");
} else if (vr.scopeengaged && !scopeready) {
//Set this here so we don't retrigger scope by accident too soon
vr.scopeengaged = qfalse;
sendButtonActionSimple("weapalt");
RTCWVR_ResyncClientYawWithGameYaw();
//Engage scope if conditions are right
qboolean scopeready = vr.weapon_stabilised && (distanceToHMD < SCOPE_ENGAGE_DISTANCE);
static qboolean lastScopeready = qfalse;
if (scopeready != lastScopeready) {
if (vr.scopedweapon && !vr.scopedetached) {
if (!vr.scopeengaged && scopeready) {
ALOGV("**WEAPON EVENT** trigger scope mode");
sendButtonActionSimple("weapalt");
} else if (vr.scopeengaged && !scopeready) {
//Set this here so we don't retrigger scope by accident too soon
vr.scopeengaged = qfalse;
ALOGV("**WEAPON EVENT** disable scope mode");
sendButtonActionSimple("weapalt");
RTCWVR_ResyncClientYawWithGameYaw();
}
lastScopeready = scopeready;
}
}
@ -203,6 +206,7 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
static bool finishReloadNextFrame = false;
if (finishReloadNextFrame)
{
ALOGV("**WEAPON EVENT** -reload");
sendButtonActionSimple("-reload");
finishReloadNextFrame = false;
}
@ -336,27 +340,39 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
//We need to record if we have started firing primary so that releasing trigger will stop firing, if user has pushed grip
//in meantime, then it wouldn't stop the gun firing and it would get stuck
if (dominantGripPushed && (GetTimeInMilliSeconds() - dominantGripPushTime) > vr_reloadtimeoutms->integer && vr.backpackitemactive == 0)
static qboolean firing = false;
if (dominantGripPushed && vr.backpackitemactive == 0)
{
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger))
{
if (!vr.scopedweapon) {
if (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) {
ALOGV("**WEAPON EVENT** weapalt");
sendButtonActionSimple("weapalt");
}
else if (firing)
{
//no longer firing
firing = qfalse;
ALOGV("**WEAPON EVENT** Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
sendButtonAction("+attack", firing);
}
}
else if (vr.detachablescope)
{
if (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) {
//See if we are able to detach the scope
ALOGV("**WEAPON EVENT** weapdetachscope");
sendButtonActionSimple("weapdetachscope");
}
}
else
{
//Just ignore grip and fire
sendButtonAction("+attack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger));
firing = (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger);
ALOGV("**WEAPON EVENT** Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
sendButtonAction("+attack", firing);
}
}
}
@ -368,7 +384,9 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
(pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
sendButtonAction("+attack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger));
ALOGV("**WEAPON EVENT** Not Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
firing = (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger);
sendButtonAction("+attack", firing);
}
}

View file

@ -29,10 +29,6 @@ void HandleInput_WeaponAlign( ovrInputStateTrackedRemote *pDominantTrackedRemote
{
//always right handed for this
vr.right_handed = qtrue;
//Get the cvar
sv_cheats = Cvar_Get("cheats", "1", CVAR_ARCHIVE);
static qboolean dominantGripPushed = false;
static float dominantGripPushTime = 0.0f;

View file

@ -37,7 +37,7 @@ If you have questions concerning this license or the applicable additional terms
#define STATUSBARHEIGHT 452
//----(SA) end
extern qboolean fullscreen_override;
extern qboolean hudflags;
extern displayContextDef_t cgDC;
extern vr_client_info_t* cgVR;
menuDef_t *menuScoreboard = NULL;
@ -2052,7 +2052,7 @@ 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.26;
float indent = 0.255;
float X_WIDTH=640;
float Y_HEIGHT=480;
@ -2162,7 +2162,7 @@ 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 indent = 0.265;
float indent = 0.255;
float X_WIDTH=640;
float Y_HEIGHT=480;
@ -2185,6 +2185,7 @@ static void CG_DrawBinocReticle( void ) {
trap_R_DrawStretchPic( x + w, y + h, w, h, 1, 1, 0, 0, cgs.media.binocShaderSimpleQ ); // br
}
hudflags |= HUD_FLAGS_STEREO;
CG_FillRect( 146, 239, 348, 1, color );
CG_FillRect( 188, 234, 1, 13, color ); // ll
@ -2194,6 +2195,7 @@ static void CG_DrawBinocReticle( void ) {
CG_FillRect( 360, 234, 1, 13, color ); // rl
CG_FillRect( 406, 226, 1, 29, color ); // r
CG_FillRect( 452, 234, 1, 13, color ); // rr
hudflags &= ~HUD_FLAGS_STEREO;
}
void CG_FinishWeaponChange( int lastweap, int newweap ); // JPW NERVE
@ -2897,9 +2899,9 @@ static void CG_DrawFlashFade( void ) {
VectorClear( col );
col[3] = cgs.scrFadeAlphaCurrent;
// CG_FillRect( -10, -10, 650, 490, col );
fullscreen_override = qtrue;
hudflags |= HUD_FLAGS_FULLSCREEN;
CG_FillRect( 0, 0, 640, 480, col ); // why do a bunch of these extend outside 640x480?
fullscreen_override = qfalse;
hudflags &= ~HUD_FLAGS_FULLSCREEN;
}
}
@ -2953,9 +2955,9 @@ static void CG_DrawFlashZoomTransition( void ) {
Vector4Set( color, 0, 0, 0, 1.0f - frac );
}
fullscreen_override = qtrue;
hudflags |= HUD_FLAGS_FULLSCREEN;
CG_FillRect( -10, -10, 650, 490, color );
fullscreen_override = qfalse;
hudflags &= ~HUD_FLAGS_FULLSCREEN;
}
}
@ -2985,9 +2987,9 @@ static void CG_DrawFlashDamage( void ) {
VectorSet( col, 0.2, 0, 0 );
col[3] = 0.7 * ( redFlash / 5.0 );
fullscreen_override = qtrue;
hudflags |= HUD_FLAGS_FULLSCREEN;
CG_FillRect( -10, -10, 650, 490, col );
fullscreen_override = qfalse;
hudflags &= ~HUD_FLAGS_FULLSCREEN;
}
}
@ -3039,9 +3041,9 @@ static void CG_DrawFlashFire( void ) {
col[2] = alpha;
col[3] = alpha;
trap_R_SetColor( col );
fullscreen_override = qtrue;
hudflags |= HUD_FLAGS_FULLSCREEN;
CG_DrawPic( -10, -10, 650, 490, cgs.media.viewFlashFire[( cg.time / 50 ) % 16] );
fullscreen_override = qfalse;
hudflags &= ~HUD_FLAGS_FULLSCREEN;
trap_R_SetColor( NULL );
trap_S_AddLoopingSound( cg.snap->ps.clientNum, cg.snap->ps.origin, vec3_origin, cgs.media.flameSound, (int)( 255.0 * alpha ) );
@ -3088,9 +3090,9 @@ static void CG_DrawFlashLightning( void ) {
shader = cgs.media.viewTeslaDamageEffectShader;
}
fullscreen_override = qtrue;
hudflags |= HUD_FLAGS_FULLSCREEN;
CG_DrawPic( -10, -10, 650, 490, shader );
fullscreen_override = qfalse;
hudflags &= ~HUD_FLAGS_FULLSCREEN;
}
}

View file

@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
#include "../../../RTCWVR/VrClientInfo.h"
extern vr_client_info_t* cgVR;
qboolean fullscreen_override = qfalse;
int hudflags = 0;
/*
================
CG_AdjustFrom640
@ -59,13 +59,22 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
}
// -NERVE - SMF
if (fullscreen_override
if ((hudflags & HUD_FLAGS_FULLSCREEN)
|| cg.zoomedScope || cg.zoomedBinoc || cg.zoomval > 0
|| cg.viewFade > 0 || ( cgs.scrFadeAlphaCurrent > 0.0 )
|| !cgVR->visible_hud)
{
int xoffset = 0;
if (hudflags & HUD_FLAGS_STEREO) {
xoffset = -40;
if (cg.refdef.stereoView == 1) {
xoffset *= -1;
}
}
// scale for screen sizes
*x *= cgs.screenXScale;
*x += xoffset;
*y *= cgs.screenYScale;
*w *= cgs.screenXScale;
*h *= cgs.screenYScale;

View file

@ -108,6 +108,10 @@ If you have questions concerning this license or the applicable additional terms
#define LIMBO_3D_H 330
// -NERVE - SMF
//VR HUD
#define HUD_FLAGS_FULLSCREEN 1
#define HUD_FLAGS_STEREO 2
//=================================================
// player entities need to track more information

View file

@ -342,7 +342,7 @@ cvarTable_t cvarTable[] = {
{ &cg_drawFrags, "cg_drawFrags", "1", CVAR_ARCHIVE },
{ &cg_drawStatus, "cg_drawStatus", "1", CVAR_ARCHIVE },
{ &cg_drawTimer, "cg_drawTimer", "0", CVAR_ARCHIVE },
{ &cg_drawFPS, "cg_drawFPS", "1", CVAR_ARCHIVE },
{ &cg_drawFPS, "cg_drawFPS", "0", CVAR_ARCHIVE },
{ &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE },
{ &cg_draw3dIcons, "cg_draw3dIcons", "1", CVAR_ARCHIVE },
{ &cg_drawIcons, "cg_drawIcons", "1", CVAR_ARCHIVE },

View file

@ -4370,8 +4370,10 @@ void CG_AltWeapon_f( void ) {
return; // force pause so holding it down won't go too fast
}
// Don't try to switch when in the middle of reloading.
if ( cg.snap->ps.weaponstate == WEAPON_RELOADING ) {
// Don't try to switch when in the middle of reloading (or starting to reload).
if ( cg.snap->ps.weaponstate == WEAPON_RELOADING ||
cg.snap->ps.weaponstate == WEAPON_RAISING_TORELOAD ||
cg.snap->ps.weaponstate == WEAPON_DROPPING_TORELOAD ) {
return;
}

View file

@ -762,10 +762,7 @@ void CL_Disconnect( qboolean showMainMenu ) {
cls.state = CA_DISCONNECTED;
// allow cheats locally
#ifndef WOLF_SP_DEMO
// except for demo
Cvar_Set( "sv_cheats", "1" );
#endif
// not connected to a pure server anymore
cl_connectedToPureServer = qfalse;

View file

@ -34,6 +34,7 @@ If you have questions concerning this license or the applicable additional terms
#include "q_shared.h"
#include "bg_public.h"
#include "bg_local.h"
#include "../../../RTCWVR/VrClientInfo.h"
// Rafael gameskill
int bg_pmove_gameskill_integer;
@ -42,11 +43,14 @@ int bg_pmove_gameskill_integer;
// JPW NERVE -- added because I need to check single/multiplayer instances and branch accordingly
#ifdef CGAMEDLL
extern vmCvar_t cg_gameType;
extern vr_client_info_t* cgVR;
#endif
#ifdef GAMEDLL
extern vmCvar_t g_gametype;
extern vr_client_info_t* gVR;
#endif
// JPW NERVE -- stuck this here so it can be seen client & server side
float Com_GetFlamethrowerRange( void ) {
#ifdef CGAMEDLL
@ -2336,6 +2340,12 @@ void PM_CheckForReload( int weapon ) {
doReload = qfalse;
}
PM_BeginWeaponChange( weapon, weapAlts[weapon], doReload );
#ifdef CGAMEDLL
cgVR->scopeengaged = qfalse;
#endif
#ifdef GAMEDLL
gVR->scopeengaged = qfalse;
#endif
}
return;
default:
@ -2386,6 +2396,14 @@ void PM_CheckForReload( int weapon ) {
if ( doReload ) {
PM_BeginWeaponReload( weapon );
//Reloading will always disengage the scope
#ifdef CGAMEDLL
cgVR->scopeengaged = qfalse;
#endif
#ifdef GAMEDLL
gVR->scopeengaged = qfalse;
#endif
}

View file

@ -42,7 +42,7 @@ If you have questions concerning this license or the applicable additional terms
// q_shared.h -- included first by ALL program modules.
// A user mod should never modify this file
#define Q3_VERSION "RTCWQuest 0.12.0 (Wolf 1.41)"
#define Q3_VERSION "RTCWQuest 0.13.0 (Wolf 1.41)"
// ver 1.0.0 - release
// ver 1.0.1 - post-release work
// ver 1.1.0 - patch 1 (12/12/01)

View file

@ -897,7 +897,7 @@ Reads in all archived cvars
void Cvar_Init( void ) {
#ifdef PANDORA
// allow easy cheating by aving sv_cheats R/W
cvar_cheats = Cvar_Get( "sv_cheats", "0", CVAR_SYSTEMINFO );
cvar_cheats = Cvar_Get( "sv_cheats", "1", CVAR_SYSTEMINFO );
#else
cvar_cheats = Cvar_Get( "sv_cheats", "0", CVAR_ROM | CVAR_SYSTEMINFO );
#endif