mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-22 04:01:33 +00:00
Improvements to the crosshair
This commit is contained in:
parent
ab03fc7c6d
commit
7328046b32
6 changed files with 45 additions and 35 deletions
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.drbeef.jk2quest"
|
package="com.drbeef.jk2quest"
|
||||||
android:versionCode="10"
|
android:versionCode="11"
|
||||||
android:versionName="0.0.10" android:installLocation="auto" >
|
android:versionName="0.0.11" android:installLocation="auto" >
|
||||||
|
|
||||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||||
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
||||||
|
|
|
@ -2972,19 +2972,23 @@ static void CG_DrawCrosshair3D(void)
|
||||||
}
|
}
|
||||||
hShader = cgs.media.crosshairShader[ ca % NUM_CROSSHAIRS ];
|
hShader = cgs.media.crosshairShader[ ca % NUM_CROSSHAIRS ];
|
||||||
|
|
||||||
|
float xmax = 64.0f * tan(cg.refdef.fov_x * M_PI / 360.0f);
|
||||||
|
float maxdist = (cgs.glconfig.vidWidth * 64.0f / (2 * xmax)) * 1.5f;
|
||||||
|
|
||||||
vec3_t forward, weaponangles, origin;
|
vec3_t forward, weaponangles, origin;
|
||||||
BG_CalculateVRWeaponPosition(origin, weaponangles);
|
BG_CalculateVRWeaponPosition(origin, weaponangles);
|
||||||
AngleVectors(weaponangles, forward, NULL, NULL);
|
AngleVectors(weaponangles, forward, NULL, NULL);
|
||||||
VectorMA(origin, 1024, forward, endpos);
|
VectorMA(origin, maxdist, forward, endpos);
|
||||||
CG_Trace(&trace, origin, NULL, NULL, endpos, 0, MASK_SHOT);
|
CG_Trace(&trace, origin, NULL, NULL, endpos, 0, MASK_SHOT);
|
||||||
|
|
||||||
|
if (trace.fraction != 1.0f) {
|
||||||
memset(&ent, 0, sizeof(ent));
|
memset(&ent, 0, sizeof(ent));
|
||||||
ent.reType = RT_SPRITE;
|
ent.reType = RT_SPRITE;
|
||||||
ent.renderfx = RF_FIRST_PERSON;
|
ent.renderfx = RF_FIRST_PERSON;
|
||||||
|
|
||||||
VectorCopy(trace.endpos, ent.origin);
|
VectorCopy(trace.endpos, ent.origin);
|
||||||
|
|
||||||
ent.radius = 2.0f;
|
ent.radius = w / 640 * xmax * trace.fraction * maxdist / 64.0f;
|
||||||
ent.customShader = hShader;
|
ent.customShader = hShader;
|
||||||
ent.shaderRGBA[0] = 255;
|
ent.shaderRGBA[0] = 255;
|
||||||
ent.shaderRGBA[1] = 255;
|
ent.shaderRGBA[1] = 255;
|
||||||
|
@ -2993,6 +2997,7 @@ static void CG_DrawCrosshair3D(void)
|
||||||
|
|
||||||
cgi_R_AddRefEntityToScene(&ent);
|
cgi_R_AddRefEntityToScene(&ent);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
|
@ -4352,6 +4357,8 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CG_DrawCrosshair3D();
|
||||||
|
|
||||||
//FIXME: these globals done once at start of frame for various funcs
|
//FIXME: these globals done once at start of frame for various funcs
|
||||||
AngleVectors (cg.refdefViewAngles, vfwd, vright, vup);
|
AngleVectors (cg.refdefViewAngles, vfwd, vright, vup);
|
||||||
VectorCopy( vfwd, vfwd_n );
|
VectorCopy( vfwd, vfwd_n );
|
||||||
|
@ -4412,8 +4419,6 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
||||||
|
|
||||||
cg.refdef.rdflags |= RDF_DRAWSKYBOX;
|
cg.refdef.rdflags |= RDF_DRAWSKYBOX;
|
||||||
|
|
||||||
CG_DrawCrosshair3D();
|
|
||||||
|
|
||||||
// draw 3D view
|
// draw 3D view
|
||||||
cgi_R_RenderScene( &cg.refdef );
|
cgi_R_RenderScene( &cg.refdef );
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||||
float screenXScale = 1.0f / 2.5f;
|
float screenXScale = 1.0f / 2.5f;
|
||||||
float screenYScale = 1.0f / 2.5f;
|
float screenYScale = 1.0f / 2.5f;
|
||||||
|
|
||||||
float xoffset = -24;
|
float xoffset = -20;
|
||||||
if (cg.refdef.stereoView == 1) {
|
if (cg.refdef.stereoView == STEREO_LEFT) {
|
||||||
xoffset *= -1;
|
xoffset *= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1735,19 +1735,23 @@ static void CG_DrawCrosshair3D(void)
|
||||||
}
|
}
|
||||||
hShader = cgs.media.crosshairShader[ ca % NUM_CROSSHAIRS ];
|
hShader = cgs.media.crosshairShader[ ca % NUM_CROSSHAIRS ];
|
||||||
|
|
||||||
|
float xmax = 64.0f * tan(cg.refdef.fov_x * M_PI / 360.0f);
|
||||||
|
float maxdist = (cgs.glconfig.vidWidth * 64.0f / (2 * xmax)) * 1.5f;
|
||||||
|
|
||||||
vec3_t forward, weaponangles, origin;
|
vec3_t forward, weaponangles, origin;
|
||||||
BG_CalculateVRWeaponPosition(origin, weaponangles);
|
BG_CalculateVRWeaponPosition(origin, weaponangles);
|
||||||
AngleVectors(weaponangles, forward, NULL, NULL);
|
AngleVectors(weaponangles, forward, NULL, NULL);
|
||||||
VectorMA(origin, 1024, forward, endpos);
|
VectorMA(origin, maxdist, forward, endpos);
|
||||||
CG_Trace(&trace, origin, NULL, NULL, endpos, 0, MASK_SHOT);
|
CG_Trace(&trace, origin, NULL, NULL, endpos, 0, MASK_SHOT);
|
||||||
|
|
||||||
|
if (trace.fraction != 1.0f) {
|
||||||
memset(&ent, 0, sizeof(ent));
|
memset(&ent, 0, sizeof(ent));
|
||||||
ent.reType = RT_SPRITE;
|
ent.reType = RT_SPRITE;
|
||||||
ent.renderfx = RF_FIRST_PERSON;
|
ent.renderfx = RF_FIRST_PERSON;
|
||||||
|
|
||||||
VectorCopy(trace.endpos, ent.origin);
|
VectorCopy(trace.endpos, ent.origin);
|
||||||
|
|
||||||
ent.radius = 2.0f;
|
ent.radius = w / 640 * xmax * trace.fraction * maxdist / 64.0f;
|
||||||
ent.customShader = hShader;
|
ent.customShader = hShader;
|
||||||
ent.shaderRGBA[0] = 255;
|
ent.shaderRGBA[0] = 255;
|
||||||
ent.shaderRGBA[1] = 255;
|
ent.shaderRGBA[1] = 255;
|
||||||
|
@ -1756,6 +1760,7 @@ static void CG_DrawCrosshair3D(void)
|
||||||
|
|
||||||
cgi_R_AddRefEntityToScene(&ent);
|
cgi_R_AddRefEntityToScene(&ent);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
|
@ -2578,6 +2583,8 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CG_DrawCrosshair3D();
|
||||||
|
|
||||||
//FIXME: these globals done once at start of frame for various funcs
|
//FIXME: these globals done once at start of frame for various funcs
|
||||||
AngleVectors (cg.refdefViewAngles, vfwd, vright, vup);
|
AngleVectors (cg.refdefViewAngles, vfwd, vright, vup);
|
||||||
VectorCopy( vfwd, vfwd_n );
|
VectorCopy( vfwd, vfwd_n );
|
||||||
|
@ -2625,8 +2632,6 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
||||||
cgi_R_LAGoggles();
|
cgi_R_LAGoggles();
|
||||||
}
|
}
|
||||||
|
|
||||||
CG_DrawCrosshair3D();
|
|
||||||
|
|
||||||
if (!in_camera || vr->immersive_cinematics) {
|
if (!in_camera || vr->immersive_cinematics) {
|
||||||
//Vertical Positional Movement
|
//Vertical Positional Movement
|
||||||
cg.refdef.vieworg[2] -= DEFAULT_PLAYER_HEIGHT;
|
cg.refdef.vieworg[2] -= DEFAULT_PLAYER_HEIGHT;
|
||||||
|
|
|
@ -32,7 +32,7 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||||
float screenXScale = 1.0f / 2.5f;
|
float screenXScale = 1.0f / 2.5f;
|
||||||
float screenYScale = 1.0f / 2.5f;
|
float screenYScale = 1.0f / 2.5f;
|
||||||
|
|
||||||
float xoffset = -24;
|
float xoffset = -20;
|
||||||
if (cg.refdef.stereoView == STEREO_LEFT) {
|
if (cg.refdef.stereoView == STEREO_LEFT) {
|
||||||
xoffset *= -1;
|
xoffset *= -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ void CG_MissionFailed(void)
|
||||||
tempY = y+30;
|
tempY = y+30;
|
||||||
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
|
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
|
||||||
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_HUD_RED], cgs.media.qhFontSmall, -1, 1.2f * FONT_SCALE);
|
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_HUD_RED], cgs.media.qhFontSmall, -1, 1.2f * FONT_SCALE);
|
||||||
|
/*
|
||||||
cgi_SP_GetStringTextString( "INGAME_RELOADMISSION", text, sizeof(text) );
|
cgi_SP_GetStringTextString( "INGAME_RELOADMISSION", text, sizeof(text) );
|
||||||
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, FONT_SCALE);
|
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, FONT_SCALE);
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ void CG_MissionFailed(void)
|
||||||
tempY = 450;
|
tempY = 450;
|
||||||
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
|
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
|
||||||
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_CYAN], cgs.media.qhFontSmall, -1, FONT_SCALE);
|
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_CYAN], cgs.media.qhFontSmall, -1, FONT_SCALE);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue