Many fixes / improvements

- When you die you now won't lose head tracking (I won't spoil what does happen now...)
- Lightning Gun Beam is now correct w.r.t cross hair
- Enemy Lightning Gun Beams fire in the direction they are aiming (not in the direction you are aiming!!)
- Sped up crosshair in the menu, as it was too sluggish still
- Restored OG rail gun
- Removed Vertex Lighting cvar
- After match, the Win screen should be shown in the front of player
This commit is contained in:
Simon 2022-02-02 23:31:59 +00:00
parent b7d89ff02b
commit 6f3875e9a2
15 changed files with 76 additions and 83 deletions

View file

@ -5,8 +5,6 @@
android:versionCode="1"
android:versionName="1.0">
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
<uses-permission android:name="oculus.permission.handtracking" />
<uses-feature android:name="oculus.software.handtracking" android:required="false" />
<uses-feature android:glEsVersion="0x00030001" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

View file

@ -1933,7 +1933,6 @@ static void CG_DrawCrosshair(void)
CG_DrawCrosshair3D
=================
*/
void CG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles );
static void CG_DrawCrosshair3D(void)
{
float w;
@ -2673,6 +2672,11 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
float worldscale = trap_Cvar_VariableValue("vr_worldscale");
if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 )
{
worldscale *= 50;
}
float ipd = 0.065f;
float separation = stereoView == STEREO_LEFT ?
worldscale * (-ipd / 2) : //left
@ -2680,10 +2684,7 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
cg.refdef.vieworg[2] -= PLAYER_HEIGHT;
cg.refdef.vieworg[2] += cgVR->hmdposition[1] * worldscale;
if (!cgVR->virtual_screen) {
VectorMA(cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg);
}
VectorMA(cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg);
// draw 3D view
trap_R_RenderScene( &cg.refdef );

View file

@ -61,7 +61,7 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
float screenXScale = cgs.screenXScale / 2.75f;
float screenYScale = cgs.screenYScale / 2.25f;
int xoffset = (hudflags & HUD_FLAGS_SCOREBOARD) ? -24 : -60;
int xoffset = -60;
if (hudStereoView == STEREO_LEFT) {
xoffset *= -1;
}

View file

@ -93,7 +93,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//VR HUD
#define HUD_FLAGS_FULLSCREEN 1
#define HUD_FLAGS_DRAWMODEL 2
#define HUD_FLAGS_SCOREBOARD 4
typedef enum {
FOOTSTEP_NORMAL,

View file

@ -238,7 +238,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_drawCrosshair, "cg_drawCrosshair", "4", CVAR_ARCHIVE },
{ &cg_drawCrosshairNames, "cg_drawCrosshairNames", "0", CVAR_ARCHIVE },
{ &cg_drawRewards, "cg_drawRewards", "0", CVAR_ARCHIVE },
{ &cg_crosshairSize, "cg_crosshairSize", "24", CVAR_ARCHIVE },
{ &cg_crosshairSize, "cg_crosshairSize", "16", CVAR_ARCHIVE },
{ &cg_crosshairHealth, "cg_crosshairHealth", "1", CVAR_ARCHIVE },
{ &cg_crosshairX, "cg_crosshairX", "0", CVAR_ARCHIVE },
{ &cg_crosshairY, "cg_crosshairY", "0", CVAR_ARCHIVE },
@ -251,8 +251,8 @@ static cvarTable_t cvarTable[] = {
{ &cg_gun_y, "cg_gunY", "0", CVAR_CHEAT },
{ &cg_gun_z, "cg_gunZ", "0", CVAR_CHEAT },
{ &cg_centertime, "cg_centertime", "3", CVAR_CHEAT },
{ &cg_runpitch, "cg_runpitch", "0.002", CVAR_ARCHIVE},
{ &cg_runroll, "cg_runroll", "0.005", CVAR_ARCHIVE },
{ &cg_runpitch, "cg_runpitch", "0.0", CVAR_ARCHIVE},
{ &cg_runroll, "cg_runroll", "0.0", CVAR_ARCHIVE },
{ &cg_bobup , "cg_bobup", "0.0", CVAR_CHEAT },
{ &cg_bobpitch, "cg_bobpitch", "0.0", CVAR_ARCHIVE },
{ &cg_bobroll, "cg_bobroll", "0.0", CVAR_ARCHIVE },
@ -328,7 +328,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_noTaunt, "cg_noTaunt", "0", CVAR_ARCHIVE},
#endif
{ &cg_noProjectileTrail, "cg_noProjectileTrail", "0", CVAR_ARCHIVE},
{ &cg_oldRail, "cg_oldRail", "0", CVAR_ARCHIVE},
{ &cg_oldRail, "cg_oldRail", "1", CVAR_ARCHIVE},
{ &cg_oldRocket, "cg_oldRocket", "0", CVAR_ARCHIVE},
{ &cg_oldPlasma, "cg_oldPlasma", "1", CVAR_ARCHIVE},
{ &cg_trueLightning, "cg_trueLightning", "0.2", CVAR_ARCHIVE}

View file

@ -239,8 +239,6 @@ static int CG_TeamScoreboard( int y, team_t team, float fade, int maxClients, in
color[0] = color[1] = color[2] = 1.0;
color[3] = fade;
CG_SetHUDFlags(HUD_FLAGS_SCOREBOARD);
count = 0;
for ( i = 0 ; i < cg.numScores && count < maxClients ; i++ ) {
score = &cg.scores[i];
@ -255,8 +253,6 @@ static int CG_TeamScoreboard( int y, team_t team, float fade, int maxClients, in
count++;
}
CG_RemoveHUDFlags(HUD_FLAGS_SCOREBOARD);
return count;
}
@ -308,8 +304,6 @@ qboolean CG_DrawOldScoreboard( void ) {
fade = *fadeColor;
}
CG_SetHUDFlags(HUD_FLAGS_SCOREBOARD);
// fragged by ... line
if ( cg.killerName[0] ) {
s = va("Fragged by %s", cg.killerName );
@ -423,8 +417,6 @@ qboolean CG_DrawOldScoreboard( void ) {
CG_LoadDeferredPlayers();
}
CG_RemoveHUDFlags(HUD_FLAGS_SCOREBOARD);
return qtrue;
}
@ -464,8 +456,6 @@ void CG_DrawTourneyScoreboard( void ) {
int y;
int i;
CG_SetHUDFlags(HUD_FLAGS_SCOREBOARD);
// request more scores regularly
if ( cg.scoresRequestTime + 2000 < cg.time ) {
cg.scoresRequestTime = cg.time;
@ -537,7 +527,5 @@ void CG_DrawTourneyScoreboard( void ) {
y += 64;
}
}
CG_RemoveHUDFlags(HUD_FLAGS_SCOREBOARD);
}

View file

@ -238,11 +238,11 @@ static void CG_OffsetThirdPersonView( void ) {
VectorCopy( cg.refdefViewAngles, focusAngles );
// if dead, look at killer
if ( cg.predictedPlayerState.stats[STAT_HEALTH] <= 0 ) {
focusAngles[YAW] = cg.predictedPlayerState.stats[STAT_DEAD_YAW];
cg.refdefViewAngles[YAW] = cg.predictedPlayerState.stats[STAT_DEAD_YAW];
}
if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 ) {
//Be 50 times taller
cg.refdef.vieworg[2] += 50 * cg.predictedPlayerState.viewheight;
return;
}
if ( focusAngles[PITCH] > 45 ) {
focusAngles[PITCH] = 45; // don't go too far overhead
@ -323,7 +323,7 @@ static void CG_OffsetFirstPersonView( void ) {
float f;
vec3_t predictedVelocity;
int timeDelta;
if ( cg.snap->ps.pm_type == PM_INTERMISSION ) {
return;
}
@ -331,12 +331,9 @@ static void CG_OffsetFirstPersonView( void ) {
origin = cg.refdef.vieworg;
angles = cg.refdefViewAngles;
// if dead, fix the angle and don't add any kick
if ( cg.snap->ps.stats[STAT_HEALTH] <= 0 ) {
//angles[ROLL] = 40;
//angles[PITCH] = -15;
angles[YAW] = cg.snap->ps.stats[STAT_DEAD_YAW];
origin[2] += cg.predictedPlayerState.viewheight;
//Be 50 times taller
origin[2] += 50 * cg.predictedPlayerState.viewheight;
return;
}

View file

@ -1261,41 +1261,11 @@ static void CG_LightningBolt( centity_t *cent, vec3_t origin ) {
// CPMA "true" lightning
if ((cent->currentState.number == cg.predictedPlayerState.clientNum) && (cg_trueLightning.value != 0)) {
vec3_t angle;
vec3_t dummy;
CG_CalculateVRWeaponPosition(dummy, angle);
/* int i;
for (i = 0; i < 3; i++) {
float a = cent->lerpAngles[i] - angle[i];
if (a > 180) {
a -= 360;
}
if (a < -180) {
a += 360;
}
angle[i] = angle[i] + a * (1.0 - cg_trueLightning.value);
if (angle[i] < 0) {
angle[i] += 360;
}
if (angle[i] > 360) {
angle[i] -= 360;
}
}
*/
CG_CalculateVRWeaponPosition(muzzlePoint, angle);
AngleVectors(angle, forward, NULL, NULL );
VectorCopy(cent->lerpOrigin, muzzlePoint );
// VectorCopy(cg.refdef.vieworg, muzzlePoint );
} else {
vec3_t angle;
vec3_t dummy;
CG_CalculateVRWeaponPosition(dummy, angle);
// !CPMA
AngleVectors( angle, forward, NULL, NULL );
AngleVectors( cent->lerpAngles, forward, NULL, NULL );
VectorCopy(cent->lerpOrigin, muzzlePoint );
}

View file

@ -1801,9 +1801,11 @@ void PM_UpdateViewAngles( playerState_t *ps, const usercmd_t *cmd ) {
return; // no view changes at all
}
/* We want to allow user to look around if they are dead
if ( ps->pm_type != PM_SPECTATOR && ps->stats[STAT_HEALTH] <= 0 ) {
return; // no view changes at all
}
*/
// circularly clamp the angles with deltas
for (i=0 ; i<3 ; i++) {

View file

@ -106,7 +106,10 @@ qboolean CheckGauntletAttack( gentity_t *ent ) {
int damage;
// set aiming directions
AngleVectors (ent->client->ps.viewangles, forward, right, up);
vec3_t angles;
VectorCopy(gVR->weaponangles, angles);
angles[YAW] += (ent->client->ps.viewangles[YAW] - gVR->hmdorientation[YAW]);
AngleVectors (angles, forward, right, up);
CalcMuzzlePoint ( ent, forward, right, up, muzzle );

View file

@ -1216,7 +1216,7 @@ void R_Register( void )
r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH );
r_customPixelAspect = ri.Cvar_Get( "r_customPixelAspect", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_simpleMipMaps = ri.Cvar_Get( "r_simpleMipMaps", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_vertexLight = ri.Cvar_Get( "r_vertexLight", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_vertexLight = ri.Cvar_Get( "r_vertexLight", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_uiFullScreen = ri.Cvar_Get( "r_uifullscreen", "0", 0);
r_subdivisions = ri.Cvar_Get ("r_subdivisions", "4", CVAR_ARCHIVE | CVAR_LATCH);
r_stereoEnabled = ri.Cvar_Get( "r_stereoEnabled", "0", CVAR_ARCHIVE | CVAR_LATCH);

View file

@ -1,4 +1,6 @@
#include "vr_base.h"
#include "../VrApi/Include/VrApi.h"
#include "../VrApi/Include/VrApi_Helpers.h"
#include "../VrApi/Include/VrApi_Types.h"
#include "../qcommon/q_shared.h"
#include "../qcommon/qcommon.h"
@ -8,9 +10,6 @@
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#include "../VrApi/Include/VrApi_Helpers.h"
#include "../VrApi/Include/VrApi.h"
#pragma clang diagnostic pop
#include <EGL/egl.h>
@ -90,7 +89,8 @@ engine_t* VR_GetEngine( void ) {
bool VR_useScreenLayer( void )
{
int keyCatcher = Key_GetCatcher( );
return (bool)(clc.state != CA_ACTIVE ||
return (bool)( clc.state != CA_ACTIVE ||
//( cl.snap.ps.stats[STAT_HEALTH] <= 0 ) ||
( keyCatcher & (KEYCATCH_UI | KEYCATCH_CONSOLE) ));
}
//#endif

View file

@ -16,6 +16,8 @@ void VR_LeaveVR( engine_t* engine );
engine_t* VR_GetEngine( void );
bool VR_useScreenLayer( void );
float radians(float deg);
#endif
#endif

View file

@ -242,8 +242,8 @@ static void IN_VRJoystick( qboolean isRightController, float joystickX, float jo
if (vr.virtual_screen)
{
const float x = joystickX * 4.0;
const float y = joystickY * -4.0;
const float x = joystickX * 5.0;
const float y = joystickY * -5.0;
Com_QueueEvent(in_vrEventTime, SE_MOUSE, x, y, 0, NULL);
} else

View file

@ -6,6 +6,9 @@
#include "../client/client.h"
#include "../VrApi/Include/VrApi_Types.h"
#include "vr_clientinfo.h"
//#include "../SDL2/include/SDL_opengles2_gl2.h"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wstrict-prototypes"
#include <VrApi.h>
@ -24,6 +27,8 @@
#define SUPER_SAMPLE 1.2f
extern vr_clientinfo_t vr;
void APIENTRY VR_GLDebugLog(GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei length, const GLchar* message, const void* userParam)
{
@ -156,8 +161,8 @@ ovrLayerCylinder2 BuildCylinderLayer(engine_t* engine, const int textureWidth, c
const float density = 4500.0f;
const float rotateYaw = 0.0f;
const float radius = 4.0f;
const float distance = -6.0f;
const float radius = 12.0f;
const float distance = -16.0f;
const ovrVector3f translation = { 0.0f, 1.0f, distance };
@ -195,6 +200,23 @@ ovrLayerCylinder2 BuildCylinderLayer(engine_t* engine, const int textureWidth, c
return layer;
}
void VR_ClearFrameBuffer( GLuint frameBuffer, int width, int height)
{
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer );
glEnable( GL_SCISSOR_TEST );
glViewport( 0, 0, width, height );
glClearColor( 0.0f, 0.0f, 0.0f, 1.0f );
glScissor( 0, 0, width, height );
glClear( GL_COLOR_BUFFER_BIT );
glScissor( 0, 0, 0, 0 );
glDisable( GL_SCISSOR_TEST );
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 );
}
void VR_DrawFrame( engine_t* engine ) {
if (!engine->ovr)
@ -213,17 +235,19 @@ void VR_DrawFrame( engine_t* engine ) {
const ovrMatrix4f projectionMatrix = ovrMatrix4f_CreateProjectionFov(
fov, fov, 0.0f, 0.0f, 1.0f, 0.0f );
if (VR_useScreenLayer())
static int playerYaw = 0;
int eyeW, eyeH;
VR_GetResolution(engine, &eyeW, &eyeH);
if (VR_useScreenLayer())
{
static ovrLayer_Union2 cylinderLayer;
memset( &cylinderLayer, 0, sizeof( ovrLayer_Union2 ) );
int eyeW, eyeH;
VR_GetResolution(engine, &eyeW, &eyeH);
// Add a simple cylindrical layer
cylinderLayer.Cylinder =
BuildCylinderLayer(engine, eyeW, eyeW, &engine->tracking, 0 );
BuildCylinderLayer(engine, eyeW, eyeW, &engine->tracking, radians(playerYaw) );
const ovrLayerHeader2* layers[] = {
&cylinderLayer.Header
@ -239,9 +263,11 @@ void VR_DrawFrame( engine_t* engine ) {
frameDesc.Layers = layers;
const framebuffer_t* framebuffers = engine->framebuffers;
re.SetVRHeadsetParms(&projectionMatrix,
framebuffers[0].framebuffers[framebuffers[0].swapchainIndex],
framebuffers[1].framebuffers[framebuffers[1].swapchainIndex]);
Com_Frame();
for (int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; ++eye) {
@ -254,6 +280,8 @@ void VR_DrawFrame( engine_t* engine ) {
}
else
{
playerYaw = vr.hmdorientation[YAW];
ovrLayerProjection2 layer = vrapi_DefaultLayerProjection2();
layer.HeadPose = engine->tracking.HeadPose;
@ -265,9 +293,14 @@ void VR_DrawFrame( engine_t* engine ) {
const framebuffer_t* framebuffers = engine->framebuffers;
VR_ClearFrameBuffer(framebuffers[0].framebuffers[framebuffers[0].swapchainIndex], eyeW, eyeH);
VR_ClearFrameBuffer(framebuffers[1].framebuffers[framebuffers[1].swapchainIndex], eyeW, eyeH);
re.SetVRHeadsetParms(&projectionMatrix,
framebuffers[0].framebuffers[framebuffers[0].swapchainIndex],
framebuffers[1].framebuffers[framebuffers[1].swapchainIndex]);
Com_Frame();
for (int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; ++eye) {