From 6a09e2d41177f88aebccd505d072887df552062e Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 29 Jul 2023 19:14:24 +0100 Subject: [PATCH] A few PCVR specific fixes - Restored missing item selector beam - Allow much wider angle pitch adjust, hopefully enough for Index users --- Projects/Android/AndroidManifest.xml | 4 +- .../jni/OpenJK/JKXR/windows/TBXR_Common.cpp | 15 ++-- .../jni/OpenJK/code/cgame/cg_weapons.cpp | 80 +++++++++---------- .../jni/OpenJK/code/qcommon/stv_version.h | 2 +- .../jni/OpenJK/codeJK2/cgame/cg_weapons.cpp | 46 +++++------ z_vr_assets_jka/ui/controls.menu | 2 +- z_vr_assets_jka/ui/ingamecontrols.menu | 2 +- z_vr_assets_jko/ui/controls.menu | 2 +- z_vr_assets_jko/ui/ingamecontrols.menu | 2 +- 9 files changed, 74 insertions(+), 81 deletions(-) diff --git a/Projects/Android/AndroidManifest.xml b/Projects/Android/AndroidManifest.xml index 0679295..a15b71e 100644 --- a/Projects/Android/AndroidManifest.xml +++ b/Projects/Android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="63" + android:versionName="1.1.14" android:installLocation="auto" > diff --git a/Projects/Android/jni/OpenJK/JKXR/windows/TBXR_Common.cpp b/Projects/Android/jni/OpenJK/JKXR/windows/TBXR_Common.cpp index bb861c1..9571f23 100644 --- a/Projects/Android/jni/OpenJK/JKXR/windows/TBXR_Common.cpp +++ b/Projects/Android/jni/OpenJK/JKXR/windows/TBXR_Common.cpp @@ -19,6 +19,8 @@ int NUM_MULTI_SAMPLES = 2; float SS_MULTIPLIER = 0.0f; +const float ZOOM_FOV_ADJUST = 1.1f; + GLboolean stageSupported = GL_FALSE; @@ -1161,11 +1163,6 @@ void TBXR_finishEyeBuffer(int eye ) ovrFramebuffer_Resolve(frameBuffer); WIN_SwapWindow(); - - //Clear the back buffer so we don't randomly have a little screen copy showing up - glViewport(0, 0, gAppState.Width, gAppState.Height); - glClearColor(0.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); } ovrFramebuffer_Release(frameBuffer); @@ -1234,10 +1231,10 @@ void TBXR_submitFrame() XrFovf fov = gAppState.Views[eye].fov; if (vr.cgzoommode) { - fov.angleLeft *= 1.2f; - fov.angleRight *= 1.2f; - fov.angleUp *= 1.2f; - fov.angleDown *= 1.2f; + fov.angleLeft /= ZOOM_FOV_ADJUST; + fov.angleRight /= ZOOM_FOV_ADJUST; + fov.angleUp /= ZOOM_FOV_ADJUST; + fov.angleDown /= ZOOM_FOV_ADJUST; } memset(&projection_layer_elements[eye], 0, sizeof(XrCompositionLayerProjectionView)); diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp index 72defd5..49a3b68 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp @@ -3090,53 +3090,51 @@ void CG_DrawItemSelector( void ) centity_t *cent = &cg_entities[cg.snap->ps.clientNum]; - refEntity_t beam; - beam.shaderRGBA[3] = 0xff; + vec3_t sRGB; int count; switch (cg.itemSelectorType) { - case ST_WEAPON: //weapons - if (vr->in_vehicle) - count = vr->vehicle_type == VH_WALKER ? 2 : 1; - else - count = WP_MELEE; - beam.shaderRGBA[0] = 0xff; - beam.shaderRGBA[1] = 0xae; - beam.shaderRGBA[2] = 0x40; - break; - case ST_GADGET: //gadgets - count = INV_GOODIE_KEY; - beam.shaderRGBA[0] = 0x00; - beam.shaderRGBA[1] = 0xff; - beam.shaderRGBA[2] = 0x00; - break; - case ST_FIGHTING_STYLE: //fighting style - count = 3; - beam.shaderRGBA[0] = 0xff; - beam.shaderRGBA[1] = 0xff; - beam.shaderRGBA[2] = 0xff; - break; - case ST_FORCE_POWER: // force powers - count = MAX_SHOWPOWERS; - beam.shaderRGBA[0] = 0x00; - beam.shaderRGBA[1] = 0x00; - beam.shaderRGBA[2] = 0xff; - break; - case ST_QUICK_SAVE: + case ST_WEAPON: //weapons + if (vr->in_vehicle) count = 2; - beam.shaderRGBA[0] = 0xff; - beam.shaderRGBA[1] = 0xff; - beam.shaderRGBA[2] = 0xff; - break; + else + count = WP_MELEE; + sRGB[0] = 1.0f; + sRGB[1] = 0.8f; + sRGB[2] = 0.2f; + break; + case ST_GADGET: //gadgets + count = INV_GOODIE_KEY; + sRGB[0] = 0.0f; + sRGB[1] = 1.0f; + sRGB[2] = 0.0f; + break; + case ST_FIGHTING_STYLE: //fighting style + count = 3; + sRGB[0] = 0.0f; + sRGB[1] = 1.0f; + sRGB[2] = 1.0f; + break; + case ST_FORCE_POWER: // force powers + count = MAX_SHOWPOWERS; + sRGB[0] = 0.0f; + sRGB[1] = 0.0f; + sRGB[2] = 1.0f; + break; + case ST_QUICK_SAVE: + count = 2; + sRGB[0] = 1.0f; + sRGB[1] = 1.0f; + sRGB[2] = 1.0f; + break; } - VectorCopy(beamOrigin, beam.oldorigin); - VectorCopy(selectorOrigin, beam.origin ); - beam.customShader = cgi_R_RegisterShader( "gfx/misc/whiteline2" ); - beam.reType = RT_LINE; - beam.radius = 0.3f; - - cgi_R_AddRefEntityToScene( &beam ); + //cgi_R_AddRefEntityToScene( &beam ); + FX_AddLine(beamOrigin, selectorOrigin, 1.0f, 0.1f, 0.0f, + 0.5f, 0.5f, + sRGB, sRGB, + 10, cgi_R_RegisterShader("gfx/misc/whiteline2"), + FX_SIZE_LINEAR | FX_ALPHA_LINEAR); if (cg.itemSelectorType == ST_WEAPON) // weapons diff --git a/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h b/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h index e84cad2..118e473 100644 --- a/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h +++ b/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h @@ -23,7 +23,7 @@ along with this program; if not, see . // Current version of the single player game #include "../win32/AutoVersion.h" -#define JKXR_VERSION "1.1.13-ea" +#define JKXR_VERSION "1.1.14-ea" #ifdef _DEBUG #define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp index 62c7011..05b5cb4 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp @@ -2908,8 +2908,7 @@ void CG_DrawItemSelector( void ) centity_t *cent = &cg_entities[cg.snap->ps.clientNum]; - refEntity_t beam; - beam.shaderRGBA[3] = 0xff; + vec3_t sRGB; int count; switch (cg.itemSelectorType) { @@ -2918,43 +2917,42 @@ void CG_DrawItemSelector( void ) count = 2; else count = WP_MELEE; - beam.shaderRGBA[0] = 0xff; - beam.shaderRGBA[1] = 0xae; - beam.shaderRGBA[2] = 0x40; + sRGB[0] = 1.0f; + sRGB[1] = 0.8f; + sRGB[2] = 0.2f; break; case ST_GADGET: //gadgets count = INV_GOODIE_KEY; - beam.shaderRGBA[0] = 0x00; - beam.shaderRGBA[1] = 0xff; - beam.shaderRGBA[2] = 0x00; + sRGB[0] = 0.0f; + sRGB[1] = 1.0f; + sRGB[2] = 0.0f; break; case ST_FIGHTING_STYLE: //fighting style count = 3; - beam.shaderRGBA[0] = 0xff; - beam.shaderRGBA[1] = 0xff; - beam.shaderRGBA[2] = 0xff; + sRGB[0] = 0.0f; + sRGB[1] = 1.0f; + sRGB[2] = 1.0f; break; case ST_FORCE_POWER: // force powers count = MAX_SHOWPOWERS; - beam.shaderRGBA[0] = 0x00; - beam.shaderRGBA[1] = 0x00; - beam.shaderRGBA[2] = 0xff; + sRGB[0] = 0.0f; + sRGB[1] = 0.0f; + sRGB[2] = 1.0f; break; case ST_QUICK_SAVE: count = 2; - beam.shaderRGBA[0] = 0xff; - beam.shaderRGBA[1] = 0xff; - beam.shaderRGBA[2] = 0xff; + sRGB[0] = 1.0f; + sRGB[1] = 1.0f; + sRGB[2] = 1.0f; break; } - VectorCopy(beamOrigin, beam.oldorigin); - VectorCopy(selectorOrigin, beam.origin ); - beam.customShader = cgi_R_RegisterShader( "gfx/misc/whiteline2" ); - beam.reType = RT_LINE; - beam.radius = 0.3f; - - cgi_R_AddRefEntityToScene( &beam ); + //cgi_R_AddRefEntityToScene( &beam ); + FX_AddLine(beamOrigin, selectorOrigin, 0.1f, 0.1f, 0.0f, + 1.0f, 0.0f, 0.0f, + sRGB, sRGB, 1.0f, + 10, cgi_R_RegisterShader("gfx/misc/whiteline2"), + FX_SIZE_LINEAR | FX_ALPHA_LINEAR); if (cg.itemSelectorType == ST_WEAPON) // weapons diff --git a/z_vr_assets_jka/ui/controls.menu b/z_vr_assets_jka/ui/controls.menu index d2fddba..2f513a0 100644 --- a/z_vr_assets_jka/ui/controls.menu +++ b/z_vr_assets_jka/ui/controls.menu @@ -1074,7 +1074,7 @@ group weaponcontrols type ITEM_TYPE_SLIDER text @MENUS_VR_WEAPON_PITCH_ITEM - cvarfloat "vr_weapon_pitchadjust" 0 -25 5 + cvarfloat "vr_weapon_pitchadjust" 20 -45 5 rect 260 220 340 14 textalign ITEM_ALIGN_RIGHT textalignx 174 diff --git a/z_vr_assets_jka/ui/ingamecontrols.menu b/z_vr_assets_jka/ui/ingamecontrols.menu index af65a9e..ed83c1c 100644 --- a/z_vr_assets_jka/ui/ingamecontrols.menu +++ b/z_vr_assets_jka/ui/ingamecontrols.menu @@ -1256,7 +1256,7 @@ group weaponcontrols type ITEM_TYPE_SLIDER text @MENUS_VR_WEAPON_PITCH_ITEM - cvarfloat "vr_weapon_pitchadjust" 0 -25 5 + cvarfloat "vr_weapon_pitchadjust" 20 -45 5 rect 260 220 340 14 textalign ITEM_ALIGN_RIGHT textalignx 174 diff --git a/z_vr_assets_jko/ui/controls.menu b/z_vr_assets_jko/ui/controls.menu index 0405695..67ddcbe 100644 --- a/z_vr_assets_jko/ui/controls.menu +++ b/z_vr_assets_jko/ui/controls.menu @@ -1568,7 +1568,7 @@ group weaponcontrols type ITEM_TYPE_SLIDER text @MENUS_VR_WEAPON_PITCH_ITEM - cvarfloat "vr_weapon_pitchadjust" 0 -25 5 + cvarfloat "vr_weapon_pitchadjust" 20 -45 5 rect 305 211 300 20 textalign ITEM_ALIGN_RIGHT textalignx 151 diff --git a/z_vr_assets_jko/ui/ingamecontrols.menu b/z_vr_assets_jko/ui/ingamecontrols.menu index 6fb08a7..981426c 100644 --- a/z_vr_assets_jko/ui/ingamecontrols.menu +++ b/z_vr_assets_jko/ui/ingamecontrols.menu @@ -1567,7 +1567,7 @@ group weaponcontrols type ITEM_TYPE_SLIDER text @MENUS_VR_WEAPON_PITCH_ITEM - cvarfloat "vr_weapon_pitchadjust" 0 -25 5 + cvarfloat "vr_weapon_pitchadjust" 20 -45 5 rect 305 211 300 20 textalign ITEM_ALIGN_RIGHT textalignx 151