mirror of
https://github.com/DrBeef/JKXR.git
synced 2025-02-16 08:51:50 +00:00
Force Crosshair
and a number of other changes: - fix for enemy saber throw - reseed RNG with same number for both eyes - vr_two_handed_weapons toggle cvar
This commit is contained in:
parent
ace44a04a9
commit
3bef513990
16 changed files with 300 additions and 76 deletions
|
@ -5,7 +5,7 @@
|
|||
android:versionName="0.3.0" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
||||
<uses-feature android:glEsVersion="0x00030002" android:required="true"/>
|
||||
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1"
|
||||
android:required="true" />
|
||||
|
|
|
@ -31,6 +31,7 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved.
|
|||
#include <EGL/eglext.h>
|
||||
#include <GLES3/gl3.h>
|
||||
#include <GLES3/gl3ext.h>
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include <GLES/gl2ext.h>
|
||||
|
||||
#include "VrApi.h"
|
||||
|
@ -63,6 +64,12 @@ extern "C" {
|
|||
#define GL_TEXTURE_BORDER_COLOR 0x1004
|
||||
#endif
|
||||
|
||||
#ifndef GLAPI
|
||||
#define GLAPI extern
|
||||
#endif
|
||||
//#define ENABLE_GL_DEBUG
|
||||
#define ENABLE_GL_DEBUG_VERBOSE 1
|
||||
|
||||
|
||||
// Must use EGLSyncKHR because the VrApi still supports OpenGL ES 2.0
|
||||
#define EGL_SYNC
|
||||
|
@ -484,8 +491,7 @@ static void ovrFramebuffer_Clear( ovrFramebuffer * frameBuffer )
|
|||
frameBuffer->Height = 0;
|
||||
frameBuffer->Multisamples = 0;
|
||||
frameBuffer->TextureSwapChainLength = 0;
|
||||
frameBuffer->ProcessingTextureSwapChainIndex = 0;
|
||||
frameBuffer->ReadyTextureSwapChainIndex = 0;
|
||||
frameBuffer->TextureSwapChainIndex = 0;
|
||||
frameBuffer->ColorTextureSwapChain = NULL;
|
||||
frameBuffer->DepthBuffers = NULL;
|
||||
frameBuffer->FrameBuffers = NULL;
|
||||
|
@ -565,7 +571,7 @@ void GPUWaitSync()
|
|||
void ovrFramebuffer_SetCurrent( ovrFramebuffer * frameBuffer )
|
||||
{
|
||||
//LOAD_GLES2(glBindFramebuffer);
|
||||
GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[frameBuffer->ProcessingTextureSwapChainIndex] ) );
|
||||
GL( glBindFramebuffer( GL_DRAW_FRAMEBUFFER, frameBuffer->FrameBuffers[frameBuffer->TextureSwapChainIndex] ) );
|
||||
}
|
||||
|
||||
void ovrFramebuffer_SetNone()
|
||||
|
@ -587,8 +593,7 @@ void ovrFramebuffer_Resolve( ovrFramebuffer * frameBuffer )
|
|||
void ovrFramebuffer_Advance( ovrFramebuffer * frameBuffer )
|
||||
{
|
||||
// Advance to the next texture from the set.
|
||||
frameBuffer->ReadyTextureSwapChainIndex = frameBuffer->ProcessingTextureSwapChainIndex;
|
||||
frameBuffer->ProcessingTextureSwapChainIndex = ( frameBuffer->ProcessingTextureSwapChainIndex + 1 ) % frameBuffer->TextureSwapChainLength;
|
||||
frameBuffer->TextureSwapChainIndex = ( frameBuffer->TextureSwapChainIndex + 1 ) % frameBuffer->TextureSwapChainLength;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1280,6 +1285,7 @@ void JKVR_Init()
|
|||
vr_immersive_cinematics = Cvar_Get("vr_immersive_cinematics", "0", CVAR_ARCHIVE);
|
||||
vr_screen_dist = Cvar_Get( "vr_screen_dist", "2.5", CVAR_ARCHIVE);
|
||||
vr_weapon_velocity_trigger = Cvar_Get( "vr_weapon_velocity_trigger", "2.3", CVAR_ARCHIVE);
|
||||
vr_two_handed_weapons = Cvar_Get ("vr_two_handed_weapons", "1", CVAR_ARCHIVE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1318,9 +1324,6 @@ void JKVR_finishEyeBuffer(int eye )
|
|||
//Clear edge to prevent smearing
|
||||
ovrFramebuffer_ClearEdgeTexels(frameBuffer);
|
||||
ovrFramebuffer_Resolve(frameBuffer);
|
||||
ovrFramebuffer_Advance(frameBuffer);
|
||||
|
||||
ovrFramebuffer_SetNone();
|
||||
}
|
||||
|
||||
void JKVR_processMessageQueue() {
|
||||
|
@ -1385,6 +1388,35 @@ int GetRefresh()
|
|||
return vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_DISPLAY_REFRESH_RATE);
|
||||
}
|
||||
|
||||
void GL_APIENTRYP VR_GLDebugLog(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam)
|
||||
{
|
||||
if (type == GL_DEBUG_TYPE_ERROR || type == GL_DEBUG_TYPE_PERFORMANCE || ENABLE_GL_DEBUG_VERBOSE)
|
||||
{
|
||||
char typeStr[128];
|
||||
switch (type) {
|
||||
case GL_DEBUG_TYPE_ERROR: sprintf(typeStr, "ERROR"); break;
|
||||
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: sprintf(typeStr, "DEPRECATED_BEHAVIOR"); break;
|
||||
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: sprintf(typeStr, "UNDEFINED_BEHAVIOR"); break;
|
||||
case GL_DEBUG_TYPE_PORTABILITY: sprintf(typeStr, "PORTABILITY"); break;
|
||||
case GL_DEBUG_TYPE_PERFORMANCE: sprintf(typeStr, "PERFORMANCE"); break;
|
||||
case GL_DEBUG_TYPE_MARKER: sprintf(typeStr, "MARKER"); break;
|
||||
case GL_DEBUG_TYPE_PUSH_GROUP: sprintf(typeStr, "PUSH_GROUP"); break;
|
||||
case GL_DEBUG_TYPE_POP_GROUP: sprintf(typeStr, "POP_GROUP"); break;
|
||||
default: sprintf(typeStr, "OTHER"); break;
|
||||
}
|
||||
|
||||
char severinityStr[128];
|
||||
switch (severity) {
|
||||
case GL_DEBUG_SEVERITY_HIGH: sprintf(severinityStr, "HIGH"); break;
|
||||
case GL_DEBUG_SEVERITY_MEDIUM: sprintf(severinityStr, "MEDIUM"); break;
|
||||
case GL_DEBUG_SEVERITY_LOW: sprintf(severinityStr, "LOW"); break;
|
||||
default: sprintf(severinityStr, "VERBOSE"); break;
|
||||
}
|
||||
|
||||
ALOGE("[%s] GL issue - %s: %s\n", severinityStr, typeStr, message);
|
||||
}
|
||||
}
|
||||
|
||||
void * AppThreadFunction(void * parm ) {
|
||||
gAppThread = (ovrAppThread *) parm;
|
||||
|
||||
|
@ -1453,6 +1485,11 @@ void * AppThreadFunction(void * parm ) {
|
|||
JKVR_processMessageQueue();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_GL_DEBUG
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glDebugMessageCallback(reinterpret_cast<GLDEBUGPROC>(VR_GLDebugLog), 0);
|
||||
#endif
|
||||
|
||||
ovrRenderer_Create(m_width, m_height, &gAppState.Renderer, &java);
|
||||
|
||||
if ( gAppState.Ovr == NULL )
|
||||
|
@ -1667,7 +1704,7 @@ void JKVR_submitFrame()
|
|||
{
|
||||
ovrFramebuffer * frameBuffer = &gAppState.Renderer.FrameBuffer[gAppState.Renderer.NumBuffers == 1 ? 0 : eye];
|
||||
layer.Textures[eye].ColorSwapChain = frameBuffer->ColorTextureSwapChain;
|
||||
layer.Textures[eye].SwapChainIndex = frameBuffer->ReadyTextureSwapChainIndex;
|
||||
layer.Textures[eye].SwapChainIndex = frameBuffer->TextureSwapChainIndex;
|
||||
|
||||
ovrMatrix4f projectionMatrix;
|
||||
projectionMatrix = ovrMatrix4f_CreateProjectionFov(vr.fov, vr.fov,
|
||||
|
@ -1679,7 +1716,12 @@ void JKVR_submitFrame()
|
|||
layer.Textures[eye].TextureRect.y = 0;
|
||||
layer.Textures[eye].TextureRect.width = 1.0f;
|
||||
layer.Textures[eye].TextureRect.height = 1.0f;
|
||||
|
||||
ovrFramebuffer_Advance(frameBuffer);
|
||||
}
|
||||
|
||||
ovrFramebuffer_SetNone();
|
||||
|
||||
layer.Header.Flags |= VRAPI_FRAME_LAYER_FLAG_CHROMATIC_ABERRATION_CORRECTION;
|
||||
|
||||
// Set up the description for this frame.
|
||||
|
@ -1710,6 +1752,14 @@ void JKVR_submitFrame()
|
|||
BuildCylinderLayer(&gAppState.Scene.CylinderRenderer,
|
||||
gAppState.Scene.CylinderWidth, gAppState.Scene.CylinderHeight, &tracking, radians(playerYaw) );
|
||||
|
||||
for ( int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; eye++ )
|
||||
{
|
||||
ovrFramebuffer * frameBuffer = &gAppState.Scene.CylinderRenderer.FrameBuffer[gAppState.Renderer.NumBuffers == 1 ? 0 : eye];
|
||||
ovrFramebuffer_Advance(frameBuffer);
|
||||
}
|
||||
|
||||
ovrFramebuffer_SetNone();
|
||||
|
||||
// Compose the layers for this frame.
|
||||
const ovrLayerHeader2 * layerHeaders[ovrMaxLayerCount] = { 0 };
|
||||
for ( int i = 0; i < gAppState.LayerCount; i++ )
|
||||
|
|
|
@ -11,11 +11,12 @@ typedef struct {
|
|||
bool weapon_stabilised;
|
||||
bool right_handed;
|
||||
bool player_moving;
|
||||
int weaponid;
|
||||
int lastweaponid;
|
||||
bool mountedgun;
|
||||
int cgzoommode;
|
||||
|
||||
int weaponid;
|
||||
int forceid;
|
||||
|
||||
vec3_t hmdposition;
|
||||
vec3_t hmdposition_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t hmdposition_delta;
|
||||
|
|
|
@ -169,7 +169,7 @@ ovrLayerCylinder2 BuildCylinderLayer( ovrRenderer * cylinderRenderer,
|
|||
ovrMatrix4f modelViewMatrix = ovrMatrix4f_Multiply( &tracking->Eye[eye].ViewMatrix, &cylinderTransform );
|
||||
layer.Textures[eye].TexCoordsFromTanAngles = ovrMatrix4f_Inverse( &modelViewMatrix );
|
||||
layer.Textures[eye].ColorSwapChain = cylinderFrameBuffer->ColorTextureSwapChain;
|
||||
layer.Textures[eye].SwapChainIndex = cylinderFrameBuffer->ReadyTextureSwapChainIndex;
|
||||
layer.Textures[eye].SwapChainIndex = cylinderFrameBuffer->TextureSwapChainIndex;
|
||||
|
||||
// Texcoord scale and bias is just a representation of the aspect ratio. The positioning
|
||||
// of the cylinder is handled entirely by the TexCoordsFromTanAngles matrix.
|
||||
|
|
|
@ -59,8 +59,7 @@ typedef struct
|
|||
int Height;
|
||||
int Multisamples;
|
||||
int TextureSwapChainLength;
|
||||
int ProcessingTextureSwapChainIndex;
|
||||
int ReadyTextureSwapChainIndex;
|
||||
int TextureSwapChainIndex;
|
||||
ovrTextureSwapChain * ColorTextureSwapChain;
|
||||
GLuint * DepthBuffers;
|
||||
GLuint * FrameBuffers;
|
||||
|
|
|
@ -10,4 +10,5 @@ extern cvar_t *vr_switch_sticks;
|
|||
extern cvar_t *vr_immersive_cinematics;
|
||||
extern cvar_t *vr_screen_dist;
|
||||
extern cvar_t *vr_weapon_velocity_trigger;
|
||||
extern cvar_t *vr_two_handed_weapons;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ cvar_t *vr_switch_sticks;
|
|||
cvar_t *vr_immersive_cinematics;
|
||||
cvar_t *vr_screen_dist;
|
||||
cvar_t *vr_weapon_velocity_trigger;
|
||||
cvar_t *vr_two_handed_weapons;
|
||||
|
||||
ovrInputStateTrackedRemote leftTrackedRemoteState_old;
|
||||
ovrInputStateTrackedRemote leftTrackedRemoteState_new;
|
||||
|
|
|
@ -162,7 +162,8 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
{
|
||||
if (!vr.weapon_stabilised && vr.item_selector == 0)
|
||||
{
|
||||
if (distance < STABILISATION_DISTANCE) {
|
||||
if (distance < STABILISATION_DISTANCE &&
|
||||
vr_two_handed_weapons->integer) {
|
||||
vr.weapon_stabilised = true;
|
||||
} else {
|
||||
vr.item_selector = 2;
|
||||
|
@ -671,7 +672,8 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
//Use Force - off hand trigger
|
||||
{
|
||||
if ((pOffTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
(pOffTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
||||
(pOffTrackedRemoteOld->Buttons & ovrButton_Trigger))
|
||||
{
|
||||
sendButtonAction("+useforce", (pOffTrackedRemoteNew->Buttons & ovrButton_Trigger));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -399,7 +399,7 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &cg_drawFPS, "cg_drawFPS", "0", CVAR_ARCHIVE },
|
||||
{ &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE },
|
||||
{ &cg_drawAmmoWarning, "cg_drawAmmoWarning", "1", CVAR_ARCHIVE },
|
||||
{ &cg_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE },
|
||||
{ &cg_drawCrosshair, "cg_drawCrosshair", "4", CVAR_ARCHIVE },
|
||||
{ &cg_dynamicCrosshair, "cg_dynamicCrosshair", "1", CVAR_ARCHIVE },
|
||||
// NOTE : I also create this in UI_Init()
|
||||
{ &cg_crosshairIdentifyTarget, "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE },
|
||||
|
@ -410,7 +410,7 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &cg_updatedDataPadForcePower3, "cg_updatedDataPadForcePower3", "0", 0},
|
||||
{ &cg_updatedDataPadObjective, "cg_updatedDataPadObjective", "0", 0},
|
||||
|
||||
{ &cg_crosshairSize, "cg_crosshairSize", "24", CVAR_ARCHIVE },
|
||||
{ &cg_crosshairSize, "cg_crosshairSize", "18", CVAR_ARCHIVE },
|
||||
{ &cg_crosshairX, "cg_crosshairX", "0", CVAR_ARCHIVE },
|
||||
{ &cg_crosshairY, "cg_crosshairY", "0", CVAR_ARCHIVE },
|
||||
{ &cg_simpleItems, "cg_simpleItems", "0", CVAR_ARCHIVE },
|
||||
|
|
|
@ -270,7 +270,7 @@ void UI_Init( int apiVersion, uiimport_t *uiimport, qboolean inGameLoad )
|
|||
|
||||
Menu_Cache( );
|
||||
|
||||
ui.Cvar_Create( "cg_drawCrosshair", "1", CVAR_ARCHIVE );
|
||||
ui.Cvar_Create( "cg_drawCrosshair", "4", CVAR_ARCHIVE );
|
||||
ui.Cvar_Create( "cg_marks", "1", CVAR_ARCHIVE );
|
||||
ui.Cvar_Create ("s_language", "english", CVAR_ARCHIVE | CVAR_NORESTART);
|
||||
#ifndef JK2_MODE
|
||||
|
|
|
@ -1679,12 +1679,141 @@ static void CG_ScanForRocketLock( void )
|
|||
}
|
||||
}
|
||||
|
||||
extern float forcePushPullRadius[];
|
||||
|
||||
void CG_ScanForForceCrosshairEntity( )
|
||||
{
|
||||
trace_t trace;
|
||||
gentity_t *traceEnt = NULL;
|
||||
vec3_t start, end;
|
||||
int content;
|
||||
int ignoreEnt = cg.snap->ps.clientNum;
|
||||
|
||||
//FIXME: debounce this to about 10fps?
|
||||
|
||||
cg_forceCrosshair = qfalse;
|
||||
if ( cg_entities[0].gent && cg_entities[0].gent->client ) // <-Mike said it should always do this //if (cg_crosshairForceHint.integer &&
|
||||
{//try to check for force-affectable stuff first
|
||||
vec3_t angles, d_f, d_rt, d_up;
|
||||
|
||||
//VectorCopy( g_entities[0].client->renderInfo.eyePoint, start );
|
||||
//AngleVectors( cg_entities[0].lerpAngles, d_f, d_rt, d_up );
|
||||
BG_CalculateVROffHandPosition(start, angles);
|
||||
AngleVectors( angles, d_f, d_rt, d_up );
|
||||
|
||||
|
||||
VectorMA( start, 2048, d_f, end );//4028 is max for mind trick
|
||||
|
||||
//YES! This is very very bad... but it works! James made me do it. Really, he did. Blame James.
|
||||
gi.trace( &trace, start, vec3_origin, vec3_origin, end,
|
||||
ignoreEnt, MASK_OPAQUE|CONTENTS_SHOTCLIP|CONTENTS_BODY|CONTENTS_ITEM, G2_NOCOLLIDE, 10 );// ); took out CONTENTS_SOLID| so you can target people through glass.... took out CONTENTS_CORPSE so disintegrated guys aren't shown, could just remove their body earlier too...
|
||||
|
||||
if ( trace.entityNum < ENTITYNUM_WORLD )
|
||||
{//hit something
|
||||
traceEnt = &g_entities[trace.entityNum];
|
||||
if ( traceEnt )
|
||||
{
|
||||
if ( traceEnt->client)
|
||||
{//is a client
|
||||
cg_forceCrosshair = qtrue;
|
||||
}
|
||||
// No? Check for force-push/pullable doors and func_statics
|
||||
else if ( traceEnt->s.eType == ET_MOVER )
|
||||
{//hit a mover
|
||||
if ( !Q_stricmp( "func_door", traceEnt->classname ) )
|
||||
{//it's a func_door
|
||||
if ( traceEnt->spawnflags & 2/*MOVER_FORCE_ACTIVATE*/ )
|
||||
{//it's force-usable
|
||||
if ( cg_entities[0].gent->client->ps.forcePowerLevel[FP_PULL] || cg_entities[0].gent->client->ps.forcePowerLevel[FP_PUSH] )
|
||||
{//player has push or pull
|
||||
float maxRange;
|
||||
if ( cg_entities[0].gent->client->ps.forcePowerLevel[FP_PULL] > cg_entities[0].gent->client->ps.forcePowerLevel[FP_PUSH] )
|
||||
{//use the better range
|
||||
maxRange = forcePushPullRadius[cg_entities[0].gent->client->ps.forcePowerLevel[FP_PULL]];
|
||||
}
|
||||
else
|
||||
{//use the better range
|
||||
maxRange = forcePushPullRadius[cg_entities[0].gent->client->ps.forcePowerLevel[FP_PUSH]];
|
||||
}
|
||||
if ( maxRange >= trace.fraction * 2048 )
|
||||
{//actually close enough to use one of our force powers on it
|
||||
cg_forceCrosshair = qtrue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( !Q_stricmp( "func_static", traceEnt->classname ) )
|
||||
{//it's a func_static
|
||||
if ( (traceEnt->spawnflags & 1/*F_PUSH*/) && (traceEnt->spawnflags & 2/*F_PULL*/) )
|
||||
{//push or pullable
|
||||
float maxRange;
|
||||
if ( cg_entities[0].gent->client->ps.forcePowerLevel[FP_PULL] > cg_entities[0].gent->client->ps.forcePowerLevel[FP_PUSH] )
|
||||
{//use the better range
|
||||
maxRange = forcePushPullRadius[cg_entities[0].gent->client->ps.forcePowerLevel[FP_PULL]];
|
||||
}
|
||||
else
|
||||
{//use the better range
|
||||
maxRange = forcePushPullRadius[cg_entities[0].gent->client->ps.forcePowerLevel[FP_PUSH]];
|
||||
}
|
||||
if ( maxRange >= trace.fraction * 2048 )
|
||||
{//actually close enough to use one of our force powers on it
|
||||
cg_forceCrosshair = qtrue;
|
||||
}
|
||||
}
|
||||
else if ( (traceEnt->spawnflags & 1/*F_PUSH*/) )
|
||||
{//pushable only
|
||||
if ( forcePushPullRadius[cg_entities[0].gent->client->ps.forcePowerLevel[FP_PUSH]] >= trace.fraction * 2048 )
|
||||
{//actually close enough to use force push on it
|
||||
cg_forceCrosshair = qtrue;
|
||||
}
|
||||
}
|
||||
else if ( (traceEnt->spawnflags & 2/*F_PULL*/) )
|
||||
{//pullable only
|
||||
if ( forcePushPullRadius[cg_entities[0].gent->client->ps.forcePowerLevel[FP_PULL]] >= trace.fraction * 2048 )
|
||||
{//actually close enough to use force pull on it
|
||||
cg_forceCrosshair = qtrue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !traceEnt || (traceEnt->s.eFlags & EF_NO_TED) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// if the player is in fog, don't show it
|
||||
content = cgi_CM_PointContents( trace.endpos, 0 );
|
||||
if ( content & CONTENTS_FOG )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// if the player is cloaked, don't show it
|
||||
if ( cg_entities[ trace.entityNum ].currentState.powerups & ( 1 << PW_CLOAKED ))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// update the fade timer
|
||||
if ( cg.crosshairClientNum != trace.entityNum )
|
||||
{
|
||||
infoStringCount = 0;
|
||||
}
|
||||
|
||||
cg.crosshairClientNum = trace.entityNum;
|
||||
cg.crosshairClientTime = cg.time;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CG_DrawCrosshair3D
|
||||
=================
|
||||
*/
|
||||
static void CG_DrawCrosshair3D(void)
|
||||
static void CG_DrawCrosshair3D(int type) // 0 - force, 1 - weapons
|
||||
{
|
||||
float w;
|
||||
qhandle_t hShader;
|
||||
|
@ -1714,12 +1843,22 @@ static void CG_DrawCrosshair3D(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if ( cg.snap->ps.weapon == WP_NONE ||
|
||||
cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_STUN_BATON )
|
||||
if ( type == 1 && (cg.snap->ps.weapon == WP_NONE ||
|
||||
cg.snap->ps.weapon == WP_SABER ||
|
||||
cg.snap->ps.weapon == WP_STUN_BATON ))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == 0)
|
||||
{
|
||||
CG_ScanForForceCrosshairEntity();
|
||||
if (!cg_forceCrosshair)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
w = cg_crosshairSize.value;
|
||||
|
||||
// pulse the size of the crosshair when picking up items
|
||||
|
@ -1738,7 +1877,14 @@ static void CG_DrawCrosshair3D(void)
|
|||
float xmax = 64.0f * tan(cg.refdef.fov_x * M_PI / 360.0f);
|
||||
|
||||
vec3_t forward, weaponangles, origin;
|
||||
BG_CalculateVRWeaponPosition(origin, weaponangles);
|
||||
if (type == 0)
|
||||
{
|
||||
BG_CalculateVROffHandPosition(origin, weaponangles);
|
||||
}
|
||||
else
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(origin, weaponangles);
|
||||
}
|
||||
AngleVectors(weaponangles, forward, NULL, NULL);
|
||||
VectorMA(origin, 2048, forward, endpos);
|
||||
CG_Trace(&trace, origin, NULL, NULL, endpos, 0, MASK_SHOT);
|
||||
|
@ -1752,8 +1898,8 @@ static void CG_DrawCrosshair3D(void)
|
|||
|
||||
ent.radius = w / 640 * xmax * trace.fraction * 2048 / 64.0f;
|
||||
ent.customShader = hShader;
|
||||
ent.shaderRGBA[0] = 255;
|
||||
ent.shaderRGBA[1] = 255;
|
||||
ent.shaderRGBA[0] = (type == 0) ? 0 : 255;
|
||||
ent.shaderRGBA[1] = (type == 0) ? 0 : 255;
|
||||
ent.shaderRGBA[2] = 255;
|
||||
ent.shaderRGBA[3] = 255;
|
||||
|
||||
|
@ -1766,8 +1912,7 @@ static void CG_DrawCrosshair3D(void)
|
|||
CG_ScanForCrosshairEntity
|
||||
=================
|
||||
*/
|
||||
extern float forcePushPullRadius[];
|
||||
static void CG_ScanForCrosshairEntity( qboolean scanAll )
|
||||
static void CG_ScanForCrosshairEntity( qboolean scanAll )
|
||||
{
|
||||
trace_t trace;
|
||||
gentity_t *traceEnt = NULL;
|
||||
|
@ -1782,8 +1927,10 @@ static void CG_ScanForCrosshairEntity( qboolean scanAll )
|
|||
{//try to check for force-affectable stuff first
|
||||
vec3_t d_f, d_rt, d_up;
|
||||
|
||||
VectorCopy( g_entities[0].client->renderInfo.eyePoint, start );
|
||||
AngleVectors( cg_entities[0].lerpAngles, d_f, d_rt, d_up );
|
||||
//VectorCopy( g_entities[0].client->renderInfo.eyePoint, start );
|
||||
//AngleVectors( cg_entities[0].lerpAngles, d_f, d_rt, d_up );
|
||||
|
||||
|
||||
VectorMA( start, 2048, d_f, end );//4028 is max for mind trick
|
||||
|
||||
//YES! This is very very bad... but it works! James made me do it. Really, he did. Blame James.
|
||||
|
@ -1871,7 +2018,7 @@ static void CG_ScanForCrosshairEntity( qboolean scanAll )
|
|||
if ( cg_dynamicCrosshair.integer )
|
||||
{//100% accurate
|
||||
vec3_t d_f, d_rt, d_up;
|
||||
if ( cg.snap->ps.weapon == WP_NONE ||
|
||||
if ( cg.snap->ps.weapon == WP_NONE ||
|
||||
cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_STUN_BATON )
|
||||
{
|
||||
if ( cg.snap->ps.viewEntity > 0 && cg.snap->ps.viewEntity < ENTITYNUM_WORLD )
|
||||
|
@ -1910,17 +2057,17 @@ static void CG_ScanForCrosshairEntity( qboolean scanAll )
|
|||
VectorMA( start, 4096, cg.refdef.viewaxis[0], end );//was 8192
|
||||
}
|
||||
//YES! This is very very bad... but it works! James made me do it. Really, he did. Blame James.
|
||||
gi.trace( &trace, start, vec3_origin, vec3_origin, end,
|
||||
gi.trace( &trace, start, vec3_origin, vec3_origin, end,
|
||||
ignoreEnt, MASK_OPAQUE|CONTENTS_SHOTCLIP|CONTENTS_BODY|CONTENTS_ITEM, G2_NOCOLLIDE, 10 );// ); took out CONTENTS_SOLID| so you can target people through glass.... took out CONTENTS_CORPSE so disintegrated guys aren't shown, could just remove their body earlier too...
|
||||
|
||||
/*
|
||||
CG_Trace( &trace, start, vec3_origin, vec3_origin, end,
|
||||
CG_Trace( &trace, start, vec3_origin, vec3_origin, end,
|
||||
cg.snap->ps.clientNum, MASK_PLAYERSOLID|CONTENTS_CORPSE|CONTENTS_ITEM );
|
||||
*/
|
||||
//FIXME: pick up corpses
|
||||
if ( trace.startsolid || trace.allsolid )
|
||||
{
|
||||
// trace should not be allowed to pick up anything if it started solid. I tried actually moving the trace start back, which also worked,
|
||||
// trace should not be allowed to pick up anything if it started solid. I tried actually moving the trace start back, which also worked,
|
||||
// but the dynamic cursor drawing caused it to render around the clip of the gun when I pushed the blaster all the way into a wall.
|
||||
// It looked quite horrible...but, if this is bad for some reason that I don't know
|
||||
trace.entityNum = ENTITYNUM_NONE;
|
||||
|
@ -1928,7 +2075,7 @@ static void CG_ScanForCrosshairEntity( qboolean scanAll )
|
|||
|
||||
traceEnt = &g_entities[trace.entityNum];
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if the object is "dead", don't show it
|
||||
/* if ( cg.crosshairClientNum && g_entities[cg.crosshairClientNum].health <= 0 )
|
||||
|
@ -2583,7 +2730,8 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
}
|
||||
|
||||
if (!vr->item_selector) {
|
||||
CG_DrawCrosshair3D();
|
||||
CG_DrawCrosshair3D(0);
|
||||
CG_DrawCrosshair3D(1);
|
||||
}
|
||||
|
||||
//FIXME: these globals done once at start of frame for various funcs
|
||||
|
|
|
@ -385,7 +385,7 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &cg_drawFPS, "cg_drawFPS", "0", CVAR_ARCHIVE },
|
||||
{ &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE },
|
||||
{ &cg_drawAmmoWarning, "cg_drawAmmoWarning", "1", CVAR_ARCHIVE },
|
||||
{ &cg_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE },
|
||||
{ &cg_drawCrosshair, "cg_drawCrosshair", "4", CVAR_ARCHIVE },
|
||||
{ &cg_dynamicCrosshair, "cg_dynamicCrosshair", "1", CVAR_ARCHIVE },
|
||||
{ &cg_crosshairIdentifyTarget, "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE },
|
||||
{ &cg_crosshairForceHint, "cg_crosshairForceHint", "1", CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART },
|
||||
|
@ -396,7 +396,7 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &cg_updatedDataPadForcePower3, "cg_updatedDataPadForcePower3", "0", 0},
|
||||
{ &cg_updatedDataPadObjective, "cg_updatedDataPadObjective", "0", 0},
|
||||
|
||||
{ &cg_crosshairSize, "cg_crosshairSize", "24", CVAR_ARCHIVE },
|
||||
{ &cg_crosshairSize, "cg_crosshairSize", "18", CVAR_ARCHIVE },
|
||||
{ &cg_crosshairX, "cg_crosshairX", "0", CVAR_ARCHIVE },
|
||||
{ &cg_crosshairY, "cg_crosshairY", "0", CVAR_ARCHIVE },
|
||||
{ &cg_simpleItems, "cg_simpleItems", "0", CVAR_ARCHIVE },
|
||||
|
|
|
@ -3446,17 +3446,18 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
|
|||
if (player1stPersonSaber && !cent->currentState.saberInFlight && !vr->item_selector)
|
||||
{
|
||||
memset( &hiltEnt, 0, sizeof(refEntity_t) );
|
||||
hiltEnt.renderfx = RF_DEPTHHACK;
|
||||
//hiltEnt.renderfx = RF_DEPTHHACK;
|
||||
hiltEnt.hModel = cgi_R_RegisterModel( "models/weapons2/saber/saber_w.md3" );
|
||||
vec3_t angles;
|
||||
BG_CalculateVRSaberPosition(hiltEnt.origin, hiltEnt.angles);
|
||||
//hiltEnt.angles[ROLL] += 180;
|
||||
VectorCopy(hiltEnt.origin, hiltEnt.oldorigin);
|
||||
vec3_t axis[3];
|
||||
AnglesToAxis(hiltEnt.angles, axis);
|
||||
VectorSubtract(vec3_origin, axis[2], hiltEnt.axis[0]);
|
||||
VectorCopy(axis[1], hiltEnt.axis[1]);
|
||||
VectorCopy(axis[0], hiltEnt.axis[2]);
|
||||
VectorMA(hiltEnt.origin, 1.0f, hiltEnt.axis[2], hiltEnt.origin);
|
||||
VectorCopy(hiltEnt.origin, hiltEnt.oldorigin);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
VectorScale(hiltEnt.axis[i], 0.85f, hiltEnt.axis[i]);
|
||||
|
||||
|
@ -5212,7 +5213,7 @@ extern vmCvar_t cg_thirdPersonAlpha;
|
|||
VectorCopy( ent.origin, cent->gent->client->renderInfo.muzzlePoint );
|
||||
VectorCopy( ent.axis[0], cent->gent->client->renderInfo.muzzleDir );
|
||||
|
||||
if ( !cg.renderingThirdPerson && (cg.snap->ps.weapon == WP_SABER||cg.snap->ps.weapon == WP_MELEE))
|
||||
if ( !cg.renderingThirdPerson && cent->gent->client->ps.clientNum == 0 && (cg.snap->ps.weapon == WP_SABER||cg.snap->ps.weapon == WP_MELEE))
|
||||
{
|
||||
vec3_t angles;
|
||||
BG_CalculateVRSaberPosition(cent->gent->client->renderInfo.muzzlePoint, angles);
|
||||
|
@ -5233,7 +5234,7 @@ extern vmCvar_t cg_thirdPersonAlpha;
|
|||
&boltMatrix, G2Angles, ent.origin, cg.time,
|
||||
cgs.model_draw, cent->currentState.modelScale );
|
||||
gi.G2API_GiveMeVectorFromMatrix( boltMatrix, ORIGIN, cent->gent->client->renderInfo.handRPoint );
|
||||
if (!cg.renderingThirdPerson && !cent->gent->client->ps.saberInFlight)
|
||||
if (!cg.renderingThirdPerson && !cent->gent->client->ps.saberInFlight && cent->gent->client->ps.clientNum == 0)
|
||||
{
|
||||
vec3_t angles;
|
||||
BG_CalculateVRSaberPosition(cent->gent->client->renderInfo.handRPoint, angles);
|
||||
|
@ -5246,7 +5247,7 @@ extern vmCvar_t cg_thirdPersonAlpha;
|
|||
&boltMatrix, G2Angles, ent.origin, cg.time,
|
||||
cgs.model_draw, cent->currentState.modelScale );
|
||||
gi.G2API_GiveMeVectorFromMatrix( boltMatrix, ORIGIN, cent->gent->client->renderInfo.handLPoint );
|
||||
if (!cg.renderingThirdPerson && !cent->gent->client->ps.saberInFlight)
|
||||
if (!cg.renderingThirdPerson && !cent->gent->client->ps.saberInFlight && cent->gent->client->ps.clientNum == 0)
|
||||
{
|
||||
vec3_t angles;
|
||||
BG_CalculateVROffHandPosition(cent->gent->client->renderInfo.handLPoint, angles);
|
||||
|
@ -5880,14 +5881,18 @@ Ghoul2 Insert End
|
|||
//FIXME: allow it to be put anywhere and move this out of if(torso.hModel)
|
||||
//Will have to call CG_PositionRotatedEntityOnTag
|
||||
|
||||
//CG_PositionEntityOnTag( &gun, &torso, torso.hModel, "tag_weapon");
|
||||
|
||||
vec3_t angs;
|
||||
BG_CalculateVRWeaponPosition(gun.origin, angs);
|
||||
AnglesToAxis(angs, gun.axis);
|
||||
//Gotta move this forward but test for now
|
||||
VectorCopy( gun.origin, gun.lightingOrigin );
|
||||
|
||||
if (cent->gent->client->ps.clientNum == 0)
|
||||
{
|
||||
vec3_t angs;
|
||||
BG_CalculateVRWeaponPosition(gun.origin, angs);
|
||||
AnglesToAxis(angs, gun.axis);
|
||||
//Gotta move this forward but test for now
|
||||
VectorCopy( gun.origin, gun.lightingOrigin );
|
||||
}
|
||||
else
|
||||
{
|
||||
CG_PositionEntityOnTag( &gun, &torso, torso.hModel, "tag_weapon");
|
||||
}
|
||||
|
||||
//--------------------- start saber hacks
|
||||
|
||||
|
|
|
@ -1322,11 +1322,11 @@ float CG_ForceSpeedFOV( float infov )
|
|||
float timeLeft = player->client->ps.forcePowerDuration[FP_SPEED] - cg.time;
|
||||
float length = FORCE_SPEED_DURATION*forceSpeedValue[player->client->ps.forcePowerLevel[FP_SPEED]];
|
||||
float amt = forceSpeedFOVMod[player->client->ps.forcePowerLevel[FP_SPEED]];
|
||||
if ( timeLeft < 400 )
|
||||
if ( timeLeft < 200 )
|
||||
{//start going back
|
||||
fov = infov + sinf(DEG2RAD((timeLeft/400)*180))*amt;
|
||||
}
|
||||
else if ( length - timeLeft < 600 )
|
||||
else if ( length - timeLeft < 300 )
|
||||
{//start zooming in
|
||||
fov = infov + sinf(DEG2RAD(((length - timeLeft)/600)*180))*amt;
|
||||
}
|
||||
|
@ -1834,7 +1834,9 @@ extern vec3_t serverViewOrg;
|
|||
void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|
||||
qboolean inwater = qfalse;
|
||||
|
||||
cg.time = serverTime;
|
||||
if ( stereoView == STEREO_LEFT ) {
|
||||
cg.time = serverTime;
|
||||
}
|
||||
|
||||
// update cvars
|
||||
CG_UpdateCvars();
|
||||
|
@ -1914,6 +1916,9 @@ wasForceSpeed=isForceSpeed;
|
|||
CG_PredictPlayerState();
|
||||
}
|
||||
|
||||
//Reset seed so random numbers are the same for each eye
|
||||
Rand_Init(cg.time);
|
||||
|
||||
// decide on third person view
|
||||
cg.renderingThirdPerson = (qboolean)(
|
||||
cg_thirdPerson.integer ||
|
||||
|
|
|
@ -2816,38 +2816,48 @@ void CG_DrawItemSelector( void )
|
|||
VectorMA(selectorOrigin, radius * pos[0], wheelRight, selectorOrigin);
|
||||
VectorMA(selectorOrigin, radius * pos[1], wheelUp, selectorOrigin);
|
||||
|
||||
{
|
||||
vec3_t color = { 0, 0, 255 };
|
||||
refEntity_t beam;
|
||||
VectorCopy(beamOrigin, beam.oldorigin);
|
||||
VectorCopy(selectorOrigin, beam.origin );
|
||||
beam.shaderRGBA[0] = beam.shaderRGBA[1] = beam.shaderRGBA[2] = beam.shaderRGBA[3] = 0xff;
|
||||
beam.customShader = cgs.media.blueSaberCoreShader;
|
||||
beam.reType = RT_LINE;
|
||||
beam.radius = 0.4f;
|
||||
|
||||
cgi_R_AddRefEntityToScene( &beam );
|
||||
}
|
||||
|
||||
centity_t *cent = &cg_entities[cg.snap->ps.clientNum];
|
||||
|
||||
refEntity_t beam;
|
||||
beam.shaderRGBA[3] = 0xff;
|
||||
int count;
|
||||
switch (cg.itemSelectorType)
|
||||
{
|
||||
case 0: //weapons
|
||||
count = WP_MELEE;
|
||||
beam.shaderRGBA[0] = 0xff;
|
||||
beam.shaderRGBA[1] = 0xae;
|
||||
beam.shaderRGBA[2] = 0x40;
|
||||
break;
|
||||
case 1: //gadgets
|
||||
count = INV_GOODIE_KEY;
|
||||
beam.shaderRGBA[0] = 0x00;
|
||||
beam.shaderRGBA[1] = 0xff;
|
||||
beam.shaderRGBA[2] = 0x00;
|
||||
break;
|
||||
case 2: //fighting style
|
||||
count = 3;
|
||||
beam.shaderRGBA[0] = 0xff;
|
||||
beam.shaderRGBA[1] = 0x00;
|
||||
beam.shaderRGBA[2] = 0x00;
|
||||
break;
|
||||
case 3: // force powers
|
||||
count = MAX_SHOWPOWERS;
|
||||
beam.shaderRGBA[0] = 0x00;
|
||||
beam.shaderRGBA[1] = 0x00;
|
||||
beam.shaderRGBA[2] = 0xff;
|
||||
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 );
|
||||
|
||||
|
||||
if (cg.itemSelectorType == 0) // weapons
|
||||
{
|
||||
refEntity_t sprite;
|
||||
|
@ -2888,14 +2898,16 @@ void CG_DrawItemSelector( void )
|
|||
}
|
||||
else if (cg.itemSelectorType == 3) // force powers
|
||||
{
|
||||
refEntity_t sprite;
|
||||
memset(&sprite, 0, sizeof(sprite));
|
||||
VectorCopy(wheelOrigin, sprite.origin);
|
||||
sprite.reType = RT_SPRITE;
|
||||
sprite.customShader = force_icons[showPowers[cg.forcepowerSelect]];
|
||||
sprite.radius = 1.8f;
|
||||
memset(sprite.shaderRGBA, 0xff, 4);
|
||||
cgi_R_AddRefEntityToScene(&sprite);
|
||||
if (cent->gent->client->ps.forcePowersKnown != 0) {
|
||||
refEntity_t sprite;
|
||||
memset(&sprite, 0, sizeof(sprite));
|
||||
VectorCopy(wheelOrigin, sprite.origin);
|
||||
sprite.reType = RT_SPRITE;
|
||||
sprite.customShader = force_icons[showPowers[cg.forcepowerSelect]];
|
||||
sprite.radius = 1.8f;
|
||||
memset(sprite.shaderRGBA, 0xff, 4);
|
||||
cgi_R_AddRefEntityToScene(&sprite);
|
||||
}
|
||||
}
|
||||
|
||||
if (cg.itemSelectorType != 1) {
|
||||
|
|
|
@ -197,7 +197,7 @@ import static android.system.Os.setenv;
|
|||
copy_asset("/sdcard/JKQuest/JK3/base", "weapons_vr_ja.cfg", true);
|
||||
|
||||
//Our assets
|
||||
copy_asset("/sdcard/JKQuest/JK2/base", "z_vr_assets.pk3", true);
|
||||
copy_asset("/sdcard/JKQuest/JK2/base", "z_vr_assets.pk3", false);
|
||||
|
||||
//Read these from a file and pass through
|
||||
commandLineParams = new String("jo");
|
||||
|
|
Loading…
Reference in a new issue