So many changes..

- Fix issue where scripts stop running if you die (change to Android.mk)
- Added weapon based crosshair
- Lots of HUD fixes
- Fixed snowing indoors issue
This commit is contained in:
Simon 2022-10-08 10:43:18 +01:00
parent e569bfcd38
commit f5bafb0a21
26 changed files with 658 additions and 386 deletions

165
LICENSE
View file

@ -1,165 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View file

@ -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="8" android:versionCode="10"
android:versionName="0.0.8" android:installLocation="auto" > android:versionName="0.0.10" 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"/>
@ -25,6 +25,7 @@
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/> <meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2"/> <meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2"/>
<meta-data android:name="com.oculus.ossplash" android:value="true"/>
<activity <activity
android:name="com.drbeef.jkquest.GLES3JNIActivity" android:name="com.drbeef.jkquest.GLES3JNIActivity"

View file

@ -1,8 +1,8 @@
LOCAL_PATH := $(call my-dir) LOCAL_PATH := $(call my-dir)
JK3_BASE_CFLAGS = -O1 -DHAVE_GLES -DFINAL_BUILD -fexceptions -Wall -Wno-write-strings -Wno-comment -fno-caller-saves -fno-tree-vectorize -Wno-unused-but-set-variable JK3_BASE_CFLAGS = -O1 -DHAVE_GLES -DFINAL_BUILD -fexceptions -Wall -Wno-write-strings -Wno-comment -fno-caller-saves -fno-tree-vectorize -Wno-unused-but-set-variable -fvisibility=hidden
JK3_BASE_CPPFLAGS = -fvisibility-inlines-hidden -Wno-invalid-offsetof JK3_BASE_CPPFLAGS = -fvisibility-inlines-hidden -Wno-invalid-offsetof -fvisibility=hidden
JK3_BASE_LDLIBS = JK3_BASE_LDLIBS =

View file

@ -215,7 +215,7 @@ void Sys_UnloadDll( void *dllHandle )
return; return;
} }
//Sys_UnloadLibrary(dllHandle); Sys_UnloadLibrary(dllHandle);
} }
enum SearchPathFlag enum SearchPathFlag

View file

@ -30,6 +30,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "../game/objectives.h" #include "../game/objectives.h"
#include "../game/g_vehicles.h" #include "../game/g_vehicles.h"
#include <JKVR/VrClientInfo.h> #include <JKVR/VrClientInfo.h>
#include "bg_local.h"
extern vmCvar_t cg_debugHealthBars; extern vmCvar_t cg_debugHealthBars;
@ -2915,6 +2916,84 @@ static void CG_ScanForRocketLock( void )
} }
} }
/*
=================
CG_DrawCrosshair3D
=================
*/
static void CG_DrawCrosshair3D(void)
{
float w;
qhandle_t hShader;
float f;
int ca;
trace_t trace;
vec3_t endpos;
refEntity_t ent;
if ( !cg_drawCrosshair.integer ) {
return;
}
if (cg.snap->ps.pm_type == PM_INTERMISSION)
{
return;
}
if ( cg.renderingThirdPerson || in_camera) {
return;
}
if ( cg.zoomMode > 0 && cg.zoomMode < 3 )
{
//not while scoped
return;
}
if ( cg.snap->ps.weapon == WP_NONE ||
cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_STUN_BATON )
{
return;
}
w = cg_crosshairSize.value;
// pulse the size of the crosshair when picking up items
f = cg.time - cg.itemPickupBlendTime;
if ( f > 0 && f < ITEM_BLOB_TIME ) {
f /= ITEM_BLOB_TIME;
w *= ( 1 + f );
}
ca = cg_drawCrosshair.integer;
if (ca < 0) {
ca = 0;
}
hShader = cgs.media.crosshairShader[ ca % NUM_CROSSHAIRS ];
vec3_t forward, weaponangles, origin;
BG_CalculateVRWeaponPosition(origin, weaponangles);
AngleVectors(weaponangles, forward, NULL, NULL);
VectorMA(origin, 1024, forward, endpos);
CG_Trace(&trace, origin, NULL, NULL, endpos, 0, MASK_SHOT);
memset(&ent, 0, sizeof(ent));
ent.reType = RT_SPRITE;
ent.renderfx = RF_FIRST_PERSON;
VectorCopy(trace.endpos, ent.origin);
ent.radius = 2.0f;
ent.customShader = hShader;
ent.shaderRGBA[0] = 255;
ent.shaderRGBA[1] = 255;
ent.shaderRGBA[2] = 255;
ent.shaderRGBA[3] = 255;
cgi_R_AddRefEntityToScene(&ent);
}
/* /*
================= =================
CG_ScanForCrosshairEntity CG_ScanForCrosshairEntity
@ -3109,7 +3188,7 @@ static void CG_ScanForCrosshairEntity( qboolean scanAll )
} }
*/ */
//draw crosshair at endpoint //draw crosshair at endpoint
CG_DrawCrosshair( trace.endpos ); //CG_DrawCrosshair( trace.endpos );
g_crosshairEntNum = trace.entityNum; g_crosshairEntNum = trace.entityNum;
g_crosshairEntDist = 4096*trace.fraction; g_crosshairEntDist = 4096*trace.fraction;
@ -3169,7 +3248,6 @@ static void CG_ScanForCrosshairEntity( qboolean scanAll )
cg.crosshairClientTime = cg.time; cg.crosshairClientTime = cg.time;
} }
/* /*
===================== =====================
CG_DrawCrosshairNames CG_DrawCrosshairNames
@ -3400,8 +3478,12 @@ static float CG_DrawSnapshot( float y ) {
s = va( "time:%i snap:%i cmd:%i", cg.snap->serverTime, s = va( "time:%i snap:%i cmd:%i", cg.snap->serverTime,
cg.latestSnapshotNum, cgs.serverCommandSequence ); cg.latestSnapshotNum, cgs.serverCommandSequence );
w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE);
cgi_R_Font_DrawString(635 - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f);
int tempX = 635 - w;
int tempY = y+2;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, s, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, FONT_SCALE);
return y + BIGCHAR_HEIGHT + 10; return y + BIGCHAR_HEIGHT + 10;
} }
@ -3444,8 +3526,12 @@ static float CG_DrawFPS( float y ) {
fps = 1000 * FPS_FRAMES / total; fps = 1000 * FPS_FRAMES / total;
s = va( "%ifps", fps ); s = va( "%ifps", fps );
const int w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); const int w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE);
cgi_R_Font_DrawString(635-xOffset - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f);
int tempX = 635-xOffset - w;
int tempY = y+2;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, s, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, FONT_SCALE);
return y + BIGCHAR_HEIGHT + 10; return y + BIGCHAR_HEIGHT + 10;
} }
@ -3468,8 +3554,12 @@ static float CG_DrawTimer( float y ) {
s = va( "%i:%i%i", mins, tens, seconds ); s = va( "%i:%i%i", mins, tens, seconds );
w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE);
cgi_R_Font_DrawString(635 - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f);
int tempX = 635 - w;
int tempY = y+2;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, s, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, FONT_SCALE);
return y + BIGCHAR_HEIGHT + 10; return y + BIGCHAR_HEIGHT + 10;
} }
@ -3504,8 +3594,12 @@ static void CG_DrawAmmoWarning( void ) {
//s = "LOW AMMO WARNING"; //s = "LOW AMMO WARNING";
} }
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.0f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, FONT_SCALE);
cgi_R_Font_DrawString(320 - w/2, 64, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 1.0f);
int tempX = 320 - w/2;
int tempY = 64;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, FONT_SCALE);
} }
//--------------------------------------- //---------------------------------------
@ -3927,7 +4021,9 @@ static void CG_Draw2D( void )
if ( cg.snap->ps.pm_type == PM_INTERMISSION ) if ( cg.snap->ps.pm_type == PM_INTERMISSION )
{ {
cg.drawingHUD = true;
CG_DrawIntermission(); CG_DrawIntermission();
cg.drawingHUD = false;
return; return;
} }
@ -3942,7 +4038,12 @@ static void CG_Draw2D( void )
} }
} }
if (!vr->immersive_cinematics) {
CGCam_DrawWideScreen(); CGCam_DrawWideScreen();
}
//Everything below here needs to be fitted into the visible portion of the display
cg.drawingHUD = true;
CG_DrawBatteryCharge(); CG_DrawBatteryCharge();
@ -3954,7 +4055,9 @@ static void CG_Draw2D( void )
// Draw this before the text so that any text won't get clipped off // Draw this before the text so that any text won't get clipped off
if ( !in_camera ) if ( !in_camera )
{ {
cg.drawingHUD = false;
CG_DrawZoomMask(); CG_DrawZoomMask();
cg.drawingHUD = true;
} }
CG_DrawScrollText(); CG_DrawScrollText();
@ -3962,10 +4065,12 @@ static void CG_Draw2D( void )
if ( in_camera ) if ( in_camera )
{//still draw the saber clash flare, but nothing else {//still draw the saber clash flare, but nothing else
cg.drawingHUD = false;
CG_SaberClashFlare(); CG_SaberClashFlare();
return; return;
} }
cg.drawingHUD = false;
if ( CG_RenderingFromMiscCamera()) if ( CG_RenderingFromMiscCamera())
{ {
// purposely doing an early out when in a misc_camera, change it if needed. // purposely doing an early out when in a misc_camera, change it if needed.
@ -3974,6 +4079,7 @@ static void CG_Draw2D( void )
CG_DrawCenterString(); CG_DrawCenterString();
return; return;
} }
cg.drawingHUD = true;
if ( (cg.snap->ps.forcePowersActive&(1<<FP_SEE)) ) if ( (cg.snap->ps.forcePowersActive&(1<<FP_SEE)) )
{//force sight is on {//force sight is on
@ -4082,9 +4188,13 @@ static void CG_Draw2D( void )
int x_pos = 0; int x_pos = 0;
y_pos = 20; y_pos = 20;
w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontMedium, 1.0f); w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, FONT_SCALE);
x_pos = (SCREEN_WIDTH/2)-(w/2); x_pos = (SCREEN_WIDTH/2)-(w/2);
cgi_R_Font_DrawString(x_pos, y_pos, text, colorTable[CT_LTRED1], cgs.media.qhFontMedium, -1, 1.0f);
int tempX = x_pos;
int tempY = y_pos;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTRED1], cgs.media.qhFontSmall, -1, FONT_SCALE);
} }
} }
@ -4094,10 +4204,13 @@ static void CG_Draw2D( void )
y_pos = 5; y_pos = 5;
gi.Cvar_VariableStringBuffer( "cg_WeaponPickupText", text, sizeof(text) ); gi.Cvar_VariableStringBuffer( "cg_WeaponPickupText", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontMedium, 0.8f); w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, FONT_SCALE);
x_pos = (SCREEN_WIDTH/2)-(w/2); x_pos = (SCREEN_WIDTH/2)-(w/2);
cgi_R_Font_DrawString(x_pos, y_pos, text, colorTable[CT_WHITE], cgs.media.qhFontMedium, -1, 0.8f); int tempX = x_pos;
int tempY = y_pos;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, FONT_SCALE);
} }
} }
@ -4299,6 +4412,8 @@ 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 );

View file

@ -28,7 +28,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) { void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
if (!vr->in_camera && !vr->using_screen_layer && !vr->scopeengaged) if (cg.drawingHUD && !vr->in_camera && !vr->using_screen_layer && !vr->scopeengaged)
{ {
float screenXScale = 1.0f / 2.5f; float screenXScale = 1.0f / 2.5f;
float screenYScale = 1.0f / 2.5f; float screenYScale = 1.0f / 2.5f;
@ -52,28 +52,30 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
} }
} }
void CG_AdjustFrom640Int( int *x, int *y, int *w, int *h ) { void CG_AdjustFrom640Int( int *x, int *y, int *w, int *h ) {
if (!vr->in_camera && !vr->using_screen_layer && !vr->scopeengaged) float fx = (float)*x;
float fy = (float)*y;
float fw = 0;
if (w != NULL)
{ {
float screenXScale = 1.0f / 3.5f; fw = (float)*w;
float screenYScale = 1.0f / 3.5f; }
float fh = 0;
float xoffset = -24; if (h != NULL)
if (cg.refdef.stereoView == 1) { {
xoffset *= -1; fh = (float)*h;
}
CG_AdjustFrom640(&fx, &fy, (w != NULL) ? &fw : NULL, (h != NULL) ? &fh : NULL);
*x = (int)fx;
*y = (int)fy;
if (w != NULL)
{
*w = (int)fw;
}
if (h != NULL)
{
*h = (int)fh;
} }
*x *= screenXScale;
*y *= screenYScale;
if (w != NULL) {
*w *= screenXScale;
}
if (h != NULL) {
*h *= screenYScale;
}
*x += (640 - (640 * screenXScale)) / 2.0f + xoffset;
*y += (480 - (480 * screenYScale)) / 2.0f;
}
} }
/* /*

View file

@ -432,6 +432,7 @@ typedef struct {
int itemPickupTime; int itemPickupTime;
int itemPickupBlendTime; // the pulse around the crosshair is timed seperately int itemPickupBlendTime; // the pulse around the crosshair is timed seperately
bool drawingHUD;
float iconHUDPercent; // How far into opening sequence the icon HUD is float iconHUDPercent; // How far into opening sequence the icon HUD is
int iconSelectTime; // How long the Icon HUD has been active int iconSelectTime; // How long the Icon HUD has been active
qboolean iconHUDActive; qboolean iconHUDActive;
@ -629,6 +630,7 @@ extern vmCvar_t cg_thirdPersonTargetDamp;
extern vmCvar_t cg_saberAutoThird; extern vmCvar_t cg_saberAutoThird;
extern vmCvar_t cg_gunAutoFirst; extern vmCvar_t cg_gunAutoFirst;
extern vmCvar_t cg_zProj;
extern vmCvar_t cg_stereoSeparation; extern vmCvar_t cg_stereoSeparation;
extern vmCvar_t cg_worldScale; extern vmCvar_t cg_worldScale;
extern vmCvar_t cg_heightAdjust; extern vmCvar_t cg_heightAdjust;
@ -745,6 +747,8 @@ Ghoul2 Insert End
#define CG_PULSE 0x00004000 #define CG_PULSE 0x00004000
#define FONT_SCALE 0.5f
void CG_DrawRect( float x, float y, float width, float height, float size, const float *color ); void CG_DrawRect( float x, float y, float width, float height, float size, const float *color );
void CG_FillRect( float x, float y, float width, float height, const float *color ); void CG_FillRect( float x, float y, float width, float height, const float *color );
void CG_Scissor( float x, float y, float width, float height); void CG_Scissor( float x, float y, float width, float height);
@ -767,7 +771,8 @@ int CG_DrawStrlen( const char *str );
float *CG_FadeColor( int startMsec, int totalMsec ); float *CG_FadeColor( int startMsec, int totalMsec );
void CG_TileClear( void ); void CG_TileClear( void );
void CG_AdjustFrom640( float *x, float *y, float *w, float *h );
void CG_AdjustFrom640Int( int *x, int *y, int *w, int *h );
// //
// cg_draw.c // cg_draw.c

View file

@ -312,6 +312,7 @@ vmCvar_t cg_thirdPersonAlpha;
vmCvar_t cg_thirdPersonAutoAlpha; vmCvar_t cg_thirdPersonAutoAlpha;
vmCvar_t cg_thirdPersonHorzOffset; vmCvar_t cg_thirdPersonHorzOffset;
vmCvar_t cg_zProj;
vmCvar_t cg_stereoSeparation; vmCvar_t cg_stereoSeparation;
vmCvar_t cg_worldScale; vmCvar_t cg_worldScale;
vmCvar_t cg_heightAdjust; vmCvar_t cg_heightAdjust;
@ -381,6 +382,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE }, { &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE },
{ &cg_fov, "cg_fov", "80", CVAR_ARCHIVE }, { &cg_fov, "cg_fov", "80", CVAR_ARCHIVE },
{ &cg_fovAspectAdjust, "cg_fovAspectAdjust", "0", CVAR_ARCHIVE }, { &cg_fovAspectAdjust, "cg_fovAspectAdjust", "0", CVAR_ARCHIVE },
{ &cg_zProj, "cg_zProj", "64", CVAR_ARCHIVE },
{ &cg_stereoSeparation, "cg_stereoSeparation", "0.065", CVAR_ARCHIVE }, { &cg_stereoSeparation, "cg_stereoSeparation", "0.065", CVAR_ARCHIVE },
{ &cg_worldScale, "cg_worldScale", "33.5", CVAR_ARCHIVE }, { &cg_worldScale, "cg_worldScale", "33.5", CVAR_ARCHIVE },
{ &cg_heightAdjust, "cg_heightAdjust", "0.0", CVAR_ARCHIVE }, { &cg_heightAdjust, "cg_heightAdjust", "0.0", CVAR_ARCHIVE },
@ -397,7 +399,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_drawFPS, "cg_drawFPS", "0", CVAR_ARCHIVE }, { &cg_drawFPS, "cg_drawFPS", "0", CVAR_ARCHIVE },
{ &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE }, { &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE },
{ &cg_drawAmmoWarning, "cg_drawAmmoWarning", "1", CVAR_ARCHIVE }, { &cg_drawAmmoWarning, "cg_drawAmmoWarning", "1", CVAR_ARCHIVE },
{ &cg_drawCrosshair, "cg_drawCrosshair", "0", CVAR_ARCHIVE }, { &cg_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE },
{ &cg_dynamicCrosshair, "cg_dynamicCrosshair", "1", CVAR_ARCHIVE }, { &cg_dynamicCrosshair, "cg_dynamicCrosshair", "1", CVAR_ARCHIVE },
// NOTE : I also create this in UI_Init() // NOTE : I also create this in UI_Init()
{ &cg_crosshairIdentifyTarget, "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE }, { &cg_crosshairIdentifyTarget, "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE },

View file

@ -442,18 +442,22 @@ void CG_DrawCaptionText(void)
// Set Y of the first line (varies if only printing one line of text) // Set Y of the first line (varies if only printing one line of text)
// (this all works, please don't mess with it) // (this all works, please don't mess with it)
const int fontHeight = (int) ((cgi_Language_IsAsian() ? 1.4f : 1.0f) * (float) cgi_R_Font_HeightPixels(cgs.media.qhFontMedium, fFontScale)); const int fontHeight = (int) ((cgi_Language_IsAsian() ? 1.4f : 1.0f) * (float) cgi_R_Font_HeightPixels(cgs.media.qhFontSmall, fFontScale * FONT_SCALE));
const bool bPrinting2Lines = !!(cg.captionText[ cg.captionTextCurrentLine+1 ][0]); const bool bPrinting2Lines = !!(cg.captionText[ cg.captionTextCurrentLine+1 ][0]);
y = cg.captionTextY - ( (float)fontHeight * (bPrinting2Lines ? 1 : 0.5f)); // captionTextY was a centered Y pos, not a top one y = cg.captionTextY - ( (float)fontHeight * (bPrinting2Lines ? 1 : 0.5f)); // captionTextY was a centered Y pos, not a top one
y -= cgi_Language_IsAsian() ? 0 : 4; y -= cgi_Language_IsAsian() ? 0 : 4;
for (i= cg.captionTextCurrentLine;i< cg.captionTextCurrentLine + 2;++i) for (i= cg.captionTextCurrentLine;i< cg.captionTextCurrentLine + 2;++i)
{ {
w = cgi_R_Font_StrLenPixels(cg.captionText[i], cgs.media.qhFontMedium, fFontScale); w = cgi_R_Font_StrLenPixels(cg.captionText[i], cgs.media.qhFontSmall, fFontScale * FONT_SCALE);
if (w) if (w)
{ {
x = (SCREEN_WIDTH-w) / 2; x = (SCREEN_WIDTH-w) / 2;
cgi_R_Font_DrawString(x, y, cg.captionText[i], textcolor_caption, cgs.media.qhFontMedium, -1, fFontScale);
int tempX = x;
int tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, cg.captionText[i], textcolor_caption, cgs.media.qhFontSmall, -1, fFontScale * FONT_SCALE);
y += fontHeight; y += fontHeight;
} }
} }
@ -608,7 +612,7 @@ void CG_DrawScrollText(void)
{ {
int i; int i;
int x,y; int x,y;
const int fontHeight = (int) (1.5f * (float) cgi_R_Font_HeightPixels(cgs.media.qhFontMedium, 1.0f)); // taiwanese & japanese need 1.5 fontheight spacing const int fontHeight = (int) (1.5f * (float) cgi_R_Font_HeightPixels(cgs.media.qhFontSmall, FONT_SCALE)); // taiwanese & japanese need 1.5 fontheight spacing
if ( !cg.scrollTextTime ) if ( !cg.scrollTextTime )
{ {
@ -647,7 +651,11 @@ void CG_DrawScrollText(void)
// if (w) // if (w)
{ {
x = (SCREEN_WIDTH - giScrollTextPixelWidth) / 2; x = (SCREEN_WIDTH - giScrollTextPixelWidth) / 2;
cgi_R_Font_DrawString(x,y, cg.printText[i], textcolor_scroll, cgs.media.qhFontMedium, -1, 1.0f);
int tempX = x;
int tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, cg.printText[i], textcolor_scroll, cgs.media.qhFontSmall, -1, FONT_SCALE);
y += fontHeight; y += fontHeight;
} }
} }
@ -738,7 +746,7 @@ void CG_DrawCenterString( void )
start = cg.centerPrint; start = cg.centerPrint;
const int fontHeight = cgi_R_Font_HeightPixels(cgs.media.qhFontMedium, 1.0f); const int fontHeight = cgi_R_Font_HeightPixels(cgs.media.qhFontSmall, FONT_SCALE);
y = cg.centerPrintY - (cg.centerPrintLines * fontHeight) / 2; y = cg.centerPrintY - (cg.centerPrintLines * fontHeight) / 2;
while ( 1 ) { while ( 1 ) {
@ -767,11 +775,14 @@ void CG_DrawCenterString( void )
} }
linebuffer[iOutIndex++] = '\0'; linebuffer[iOutIndex++] = '\0';
w = cgi_R_Font_StrLenPixels(linebuffer, cgs.media.qhFontMedium, 1.0f); w = cgi_R_Font_StrLenPixels(linebuffer, cgs.media.qhFontSmall, FONT_SCALE);
x = ( SCREEN_WIDTH - w ) / 2; x = ( SCREEN_WIDTH - w ) / 2;
cgi_R_Font_DrawString(x,y,linebuffer, textcolor_center, cgs.media.qhFontMedium, -1, 1.0f); int tempX = x;
int tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY,linebuffer, textcolor_center, cgs.media.qhFontSmall, -1, FONT_SCALE);
y += fontHeight; y += fontHeight;

View file

@ -866,6 +866,12 @@ void CG_CalculateWeaponPosition( vec3_t origin, vec3_t angles )
static float CG_CalculateWeaponPositionAndScale( playerState_t *ps, vec3_t origin, vec3_t angles ) { static float CG_CalculateWeaponPositionAndScale( playerState_t *ps, vec3_t origin, vec3_t angles ) {
if (cg.renderingThirdPerson)
{
CG_CalculateWeaponPosition(origin, angles);
return 1.0f;
}
BG_CalculateVRWeaponPosition(origin, angles); BG_CalculateVRWeaponPosition(origin, angles);
vec3_t offset; vec3_t offset;

View file

@ -376,9 +376,6 @@ Moves the local angle positions
================ ================
*/ */
void CL_AdjustAngles( void ) { void CL_AdjustAngles( void ) {
//Make sure Pitch is correct
IN_CenterView();
cl.viewangles[YAW] -= old_move.yaw; cl.viewangles[YAW] -= old_move.yaw;
cl.viewangles[YAW] += new_move.yaw; cl.viewangles[YAW] += new_move.yaw;
@ -675,8 +672,13 @@ void CL_FinishMove( usercmd_t *cmd ) {
// can be determined without allowing cheating // can be determined without allowing cheating
cmd->serverTime = cl.serverTime; cmd->serverTime = cl.serverTime;
//Adjust for difference in server angles
vec3_t angles;
VectorCopy(cl.viewangles, angles);
angles[PITCH] -= SHORT2ANGLE(cl.frame.ps.delta_angles[PITCH]);
for (i=0 ; i<3 ; i++) { for (i=0 ; i<3 ; i++) {
cmd->angles[i] = ANGLE2SHORT(cl.viewangles[i]); cmd->angles[i] = ANGLE2SHORT(angles[i]);
} }
//retain the move from this //retain the move from this

View file

@ -517,7 +517,7 @@ Ghoul2 Insert Start
Ghoul2 Insert End Ghoul2 Insert End
*/ */
#define MAX_G2_COLLISIONS 16 #define MAX_G2_COLLISIONS 64
// a trace is returned when a box is swept through the world // a trace is returned when a box is swept through the world
typedef struct { typedef struct {
qboolean allsolid; // if true, plane is not valid qboolean allsolid; // if true, plane is not valid

View file

@ -697,6 +697,14 @@ public:
return; return;
} }
// Record The Extents Of The World Incase No Other Weather Zones Exist
//---------------------------------------------------------------------
if (!mWeatherZones.size())
{
Com_Printf("WARNING: No Weather Zones Encountered\n");
AddWeatherZone(tr.world->bmodels[0].bounds[0], tr.world->bmodels[0].bounds[1]);
}
// all this piece of code does really is fill in the bool "SWeatherZone::mMarkedOutside", plus the mPointCache[] for each zone, // all this piece of code does really is fill in the bool "SWeatherZone::mMarkedOutside", plus the mPointCache[] for each zone,
// so we can diskload those. Maybe. // so we can diskload those. Maybe.
fileHandle_t f = ReadCachedWeatherFile(); fileHandle_t f = ReadCachedWeatherFile();
@ -720,15 +728,6 @@ public:
uint32_t contents; uint32_t contents;
uint32_t bit; uint32_t bit;
// Record The Extents Of The World Incase No Other Weather Zones Exist
//---------------------------------------------------------------------
if (!mWeatherZones.size())
{
Com_Printf("WARNING: No Weather Zones Encountered\n");
AddWeatherZone(tr.world->bmodels[0].bounds[0], tr.world->bmodels[0].bounds[1]);
}
f = WriteCachedWeatherFile(); f = WriteCachedWeatherFile();
// Iterate Over All Weather Zones // Iterate Over All Weather Zones
@ -2143,8 +2142,13 @@ void R_WorldEffectCommand(const char *command)
COM_EndParseSession(); COM_EndParseSession();
return; return;
} }
int count = 1000;
const char* tempStr;
COM_ParseString(&command, &tempStr);
COM_ParseInt(&command, &count);
CParticleCloud& nCloud = mParticleClouds.push_back(); CParticleCloud& nCloud = mParticleClouds.push_back();
nCloud.Initialize(1000, "gfx/effects/snowflake1.tga"); nCloud.Initialize(count, "gfx/effects/snowflake1.tga");
nCloud.mBlendMode = 1; nCloud.mBlendMode = 1;
nCloud.mRotationChangeNext = 0; nCloud.mRotationChangeNext = 0;
nCloud.mColor = 0.75f; nCloud.mColor = 0.75f;

View file

@ -270,7 +270,7 @@ void UI_Init( int apiVersion, uiimport_t *uiimport, qboolean inGameLoad )
Menu_Cache( ); Menu_Cache( );
ui.Cvar_Create( "cg_drawCrosshair", "0", CVAR_ARCHIVE ); ui.Cvar_Create( "cg_drawCrosshair", "1", CVAR_ARCHIVE );
ui.Cvar_Create( "cg_marks", "1", CVAR_ARCHIVE ); ui.Cvar_Create( "cg_marks", "1", CVAR_ARCHIVE );
ui.Cvar_Create ("s_language", "english", CVAR_ARCHIVE | CVAR_NORESTART); ui.Cvar_Create ("s_language", "english", CVAR_ARCHIVE | CVAR_NORESTART);
#ifndef JK2_MODE #ifndef JK2_MODE

View file

@ -28,8 +28,11 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "cg_local.h" #include "cg_local.h"
#include "cg_media.h" #include "cg_media.h"
#include "../game/objectives.h" #include "../game/objectives.h"
#include "bg_local.h"
#include <JKVR/VrClientInfo.h> #include <JKVR/VrClientInfo.h>
#include "FxUtil.h"
void CG_DrawIconBackground(void); void CG_DrawIconBackground(void);
void CG_DrawMissionInformation( void ); void CG_DrawMissionInformation( void );
void CG_DrawInventorySelect( void ); void CG_DrawInventorySelect( void );
@ -1676,6 +1679,84 @@ static void CG_ScanForRocketLock( void )
} }
} }
/*
=================
CG_DrawCrosshair3D
=================
*/
static void CG_DrawCrosshair3D(void)
{
float w;
qhandle_t hShader;
float f;
int ca;
trace_t trace;
vec3_t endpos;
refEntity_t ent;
if ( !cg_drawCrosshair.integer ) {
return;
}
if (cg.snap->ps.pm_type == PM_INTERMISSION)
{
return;
}
if ( cg.renderingThirdPerson || in_camera) {
return;
}
if ( cg.zoomMode > 0 && cg.zoomMode < 3 )
{
//not while scoped
return;
}
if ( cg.snap->ps.weapon == WP_NONE ||
cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_STUN_BATON )
{
return;
}
w = cg_crosshairSize.value;
// pulse the size of the crosshair when picking up items
f = cg.time - cg.itemPickupBlendTime;
if ( f > 0 && f < ITEM_BLOB_TIME ) {
f /= ITEM_BLOB_TIME;
w *= ( 1 + f );
}
ca = cg_drawCrosshair.integer;
if (ca < 0) {
ca = 0;
}
hShader = cgs.media.crosshairShader[ ca % NUM_CROSSHAIRS ];
vec3_t forward, weaponangles, origin;
BG_CalculateVRWeaponPosition(origin, weaponangles);
AngleVectors(weaponangles, forward, NULL, NULL);
VectorMA(origin, 1024, forward, endpos);
CG_Trace(&trace, origin, NULL, NULL, endpos, 0, MASK_SHOT);
memset(&ent, 0, sizeof(ent));
ent.reType = RT_SPRITE;
ent.renderfx = RF_FIRST_PERSON;
VectorCopy(trace.endpos, ent.origin);
ent.radius = 2.0f;
ent.customShader = hShader;
ent.shaderRGBA[0] = 255;
ent.shaderRGBA[1] = 255;
ent.shaderRGBA[2] = 255;
ent.shaderRGBA[3] = 255;
cgi_R_AddRefEntityToScene(&ent);
}
/* /*
================= =================
CG_ScanForCrosshairEntity CG_ScanForCrosshairEntity
@ -1853,7 +1934,7 @@ static void CG_ScanForCrosshairEntity( qboolean scanAll )
} }
*/ */
//draw crosshair at endpoint //draw crosshair at endpoint
CG_DrawCrosshair( trace.endpos ); //CG_DrawCrosshair( trace.endpos );
g_crosshairEntNum = trace.entityNum; g_crosshairEntNum = trace.entityNum;
g_crosshairEntDist = 4096*trace.fraction; g_crosshairEntDist = 4096*trace.fraction;
@ -2099,8 +2180,12 @@ static float CG_DrawSnapshot( float y ) {
s = va( "time:%i snap:%i cmd:%i", cg.snap->serverTime, s = va( "time:%i snap:%i cmd:%i", cg.snap->serverTime,
cg.latestSnapshotNum, cgs.serverCommandSequence ); cg.latestSnapshotNum, cgs.serverCommandSequence );
w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE);
cgi_R_Font_DrawString(635 - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f);
int tempX = 635 - w;
int tempY = y+2;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, s, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, FONT_SCALE);
return y + BIGCHAR_HEIGHT + 10; return y + BIGCHAR_HEIGHT + 10;
} }
@ -2142,8 +2227,12 @@ static float CG_DrawFPS( float y ) {
fps = 1000 * FPS_FRAMES / total; fps = 1000 * FPS_FRAMES / total;
s = va( "%ifps", fps ); s = va( "%ifps", fps );
const int w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); const int w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE);
cgi_R_Font_DrawString(635 - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f);
int tempX = 635 - w;
int tempY = y+2;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, s, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, FONT_SCALE);
return y + BIGCHAR_HEIGHT + 10; return y + BIGCHAR_HEIGHT + 10;
} }
@ -2166,9 +2255,12 @@ static float CG_DrawTimer( float y ) {
s = va( "%i:%i%i", mins, tens, seconds ); s = va( "%i:%i%i", mins, tens, seconds );
w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE);
cgi_R_Font_DrawString(635 - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f);
int tempX = 635 - w;
int tempY = y+2;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, s, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, FONT_SCALE);
return y + BIGCHAR_HEIGHT + 10; return y + BIGCHAR_HEIGHT + 10;
} }
@ -2202,8 +2294,10 @@ static void CG_DrawAmmoWarning( void ) {
//s = "LOW AMMO WARNING"; //s = "LOW AMMO WARNING";
} }
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.0f); int tempX = 320 - w/2;
cgi_R_Font_DrawString(320 - w/2, 64, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 1.0f); int tempY = 64;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, FONT_SCALE);
} }
//--------------------------------------- //---------------------------------------
@ -2273,7 +2367,9 @@ static void CG_Draw2D( void )
if ( cg.snap->ps.pm_type == PM_INTERMISSION ) if ( cg.snap->ps.pm_type == PM_INTERMISSION )
{ {
cg.drawingHUD = true;
CG_DrawIntermission(); CG_DrawIntermission();
cg.drawingHUD = false;
return; return;
} }
@ -2285,14 +2381,20 @@ static void CG_Draw2D( void )
} }
} }
if (!vr->immersive_cinematics) {
CGCam_DrawWideScreen(); CGCam_DrawWideScreen();
}
cg.drawingHUD = true;
CG_DrawBatteryCharge(); CG_DrawBatteryCharge();
// Draw this before the text so that any text won't get clipped off // Draw this before the text so that any text won't get clipped off
if ( !in_camera ) if ( !in_camera )
{ {
cg.drawingHUD = false;
CG_DrawZoomMask(); CG_DrawZoomMask();
cg.drawingHUD = true;
} }
CG_DrawScrollText(); CG_DrawScrollText();
@ -2300,10 +2402,12 @@ static void CG_Draw2D( void )
if ( in_camera ) if ( in_camera )
{//still draw the saber clash flare, but nothing else {//still draw the saber clash flare, but nothing else
cg.drawingHUD = false;
CG_SaberClashFlare(); CG_SaberClashFlare();
return; return;
} }
cg.drawingHUD = false;
if ( CG_RenderingFromMiscCamera()) if ( CG_RenderingFromMiscCamera())
{ {
// purposely doing an early out when in a misc_camera, change it if needed. // purposely doing an early out when in a misc_camera, change it if needed.
@ -2312,6 +2416,7 @@ static void CG_Draw2D( void )
CG_DrawCenterString(); CG_DrawCenterString();
return; return;
} }
cg.drawingHUD = true;
// don't draw any status if dead // don't draw any status if dead
if ( cg.snap->ps.stats[STAT_HEALTH] > 0 ) if ( cg.snap->ps.stats[STAT_HEALTH] > 0 )
@ -2402,10 +2507,14 @@ static void CG_Draw2D( void )
y_pos = (SCREEN_HEIGHT/2)+80; y_pos = (SCREEN_HEIGHT/2)+80;
if ( cg_missionInfoCentered.integer ) if ( cg_missionInfoCentered.integer )
{ {
w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, 1.0f); w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, FONT_SCALE);
x_pos = (SCREEN_WIDTH/2)-(w/2); x_pos = (SCREEN_WIDTH/2)-(w/2);
} }
cgi_R_Font_DrawString(x_pos, y_pos, text, colorTable[CT_LTRED1], cgs.media.qhFontMedium, -1, 1.0f);
int tempX = x_pos;
int tempY = y_pos;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTRED1], cgs.media.qhFontSmall, -1, FONT_SCALE);
if (cg_updatedDataPadForcePower1.integer) if (cg_updatedDataPadForcePower1.integer)
{ {
@ -2413,10 +2522,14 @@ static void CG_Draw2D( void )
cgi_SP_GetStringTextString("INGAME_NEW_FORCE_POWER_INFO", text, sizeof(text) ); cgi_SP_GetStringTextString("INGAME_NEW_FORCE_POWER_INFO", text, sizeof(text) );
if ( cg_missionInfoCentered.integer ) if ( cg_missionInfoCentered.integer )
{ {
w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, 1.0f); w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, FONT_SCALE);
x_pos = (SCREEN_WIDTH/2)-(w/2); x_pos = (SCREEN_WIDTH/2)-(w/2);
} }
cgi_R_Font_DrawString(x_pos, y_pos, text, colorTable[CT_LTRED1], cgs.media.qhFontMedium, -1, 1.0f);
tempX = x_pos;
tempY = y_pos;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTRED1], cgs.media.qhFontSmall, -1, FONT_SCALE);
} }
if (cg_updatedDataPadObjective.integer) if (cg_updatedDataPadObjective.integer)
@ -2425,10 +2538,14 @@ static void CG_Draw2D( void )
cgi_SP_GetStringTextString( "INGAME_NEW_OBJECTIVE_INFO", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_NEW_OBJECTIVE_INFO", text, sizeof(text) );
if ( cg_missionInfoCentered.integer ) if ( cg_missionInfoCentered.integer )
{ {
w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, 1.0f); w = cgi_R_Font_StrLenPixels(text,cgs.media.qhFontSmall, FONT_SCALE);
x_pos = (SCREEN_WIDTH/2)-(w/2); x_pos = (SCREEN_WIDTH/2)-(w/2);
} }
cgi_R_Font_DrawString(x_pos, y_pos, text, colorTable[CT_LTRED1], cgs.media.qhFontMedium, -1, 1.0f);
tempX = x_pos;
tempY = y_pos;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTRED1], cgs.media.qhFontSmall, -1, FONT_SCALE);
} }
// if (cent->gent->client->sess.missionObjectivesShown<3) // if (cent->gent->client->sess.missionObjectivesShown<3)
@ -2438,6 +2555,9 @@ static void CG_Draw2D( void )
// } // }
} }
} }
cg.drawingHUD = false;
} }
@ -2505,6 +2625,8 @@ 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;

View file

@ -27,13 +27,13 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) { void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
if (!vr->in_camera && !vr->using_screen_layer && !vr->scopeengaged) if (cg.drawingHUD && !vr->in_camera && !vr->using_screen_layer && !vr->scopeengaged)
{ {
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 = -24;
if (cg.refdef.stereoView == 1) { if (cg.refdef.stereoView == STEREO_LEFT) {
xoffset *= -1; xoffset *= -1;
} }
@ -50,29 +50,32 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
*y += (480 - (480 * screenYScale)) / 2.0f; *y += (480 - (480 * screenYScale)) / 2.0f;
} }
} }
void CG_AdjustFrom640Int( int *x, int *y, int *w, int *h ) { void CG_AdjustFrom640Int( int *x, int *y, int *w, int *h ) {
if (!vr->in_camera && !vr->using_screen_layer && !vr->scopeengaged) float fx = (float)*x;
float fy = (float)*y;
float fw = 0;
if (w != NULL)
{ {
float screenXScale = 1.0f / 3.5f; fw = (float)*w;
float screenYScale = 1.0f / 3.5f; }
float fh = 0;
float xoffset = -24; if (h != NULL)
if (cg.refdef.stereoView == 1) { {
xoffset *= -1; fh = (float)*h;
}
CG_AdjustFrom640(&fx, &fy, (w != NULL) ? &fw : NULL, (h != NULL) ? &fh : NULL);
*x = (int)fx;
*y = (int)fy;
if (w != NULL)
{
*w = (int)fw;
}
if (h != NULL)
{
*h = (int)fh;
} }
*x *= screenXScale;
*y *= screenYScale;
if (w != NULL) {
*w *= screenXScale;
}
if (h != NULL) {
*h *= screenYScale;
}
*x += (640 - (640 * screenXScale)) / 2.0f + xoffset;
*y += (480 - (480 * screenYScale)) / 2.0f;
}
} }
/* /*

View file

@ -429,6 +429,7 @@ typedef struct {
int itemPickupTime; int itemPickupTime;
int itemPickupBlendTime; // the pulse around the crosshair is timed seperately int itemPickupBlendTime; // the pulse around the crosshair is timed seperately
bool drawingHUD;
float iconHUDPercent; // How far into opening sequence the icon HUD is float iconHUDPercent; // How far into opening sequence the icon HUD is
int iconSelectTime; // How long the Icon HUD has been active int iconSelectTime; // How long the Icon HUD has been active
qboolean iconHUDActive; qboolean iconHUDActive;
@ -609,6 +610,7 @@ extern vmCvar_t cg_thirdPersonTargetDamp;
extern vmCvar_t cg_saberAutoThird; extern vmCvar_t cg_saberAutoThird;
extern vmCvar_t cg_gunAutoFirst; extern vmCvar_t cg_gunAutoFirst;
extern vmCvar_t cg_zProj;
extern vmCvar_t cg_stereoSeparation; extern vmCvar_t cg_stereoSeparation;
extern vmCvar_t cg_worldScale; extern vmCvar_t cg_worldScale;
extern vmCvar_t cg_heightAdjust; extern vmCvar_t cg_heightAdjust;
@ -728,6 +730,7 @@ Ghoul2 Insert End
#define CG_UNDERLINE 0x00008000 #define CG_UNDERLINE 0x00008000
#define CG_TINYFONT 0x00010000 #define CG_TINYFONT 0x00010000
#define FONT_SCALE 0.5f
void CG_FillRect( float x, float y, float width, float height, const float *color ); void CG_FillRect( float x, float y, float width, float height, const float *color );
void CG_Scissor( float x, float y, float width, float height); void CG_Scissor( float x, float y, float width, float height);
@ -750,7 +753,8 @@ int CG_DrawStrlen( const char *str );
float *CG_FadeColor( int startMsec, int totalMsec ); float *CG_FadeColor( int startMsec, int totalMsec );
void CG_TileClear( void ); void CG_TileClear( void );
void CG_AdjustFrom640( float *x, float *y, float *w, float *h );
void CG_AdjustFrom640Int( int *x, int *y, int *w, int *h );
// //
// cg_draw.c // cg_draw.c

View file

@ -303,6 +303,7 @@ vmCvar_t cg_thirdPersonAlpha;
vmCvar_t cg_thirdPersonAutoAlpha; vmCvar_t cg_thirdPersonAutoAlpha;
vmCvar_t cg_thirdPersonHorzOffset; vmCvar_t cg_thirdPersonHorzOffset;
vmCvar_t cg_zProj;
vmCvar_t cg_stereoSeparation; vmCvar_t cg_stereoSeparation;
vmCvar_t cg_worldScale; vmCvar_t cg_worldScale;
vmCvar_t cg_heightAdjust; vmCvar_t cg_heightAdjust;
@ -368,6 +369,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE }, { &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE },
{ &cg_fov, "cg_fov", "80", CVAR_ARCHIVE }, { &cg_fov, "cg_fov", "80", CVAR_ARCHIVE },
{ &cg_fovAspectAdjust, "cg_fovAspectAdjust", "0", CVAR_ARCHIVE }, { &cg_fovAspectAdjust, "cg_fovAspectAdjust", "0", CVAR_ARCHIVE },
{ &cg_zProj, "cg_zProj", "64", CVAR_ARCHIVE },
{ &cg_stereoSeparation, "cg_stereoSeparation", "0.065", CVAR_ARCHIVE }, { &cg_stereoSeparation, "cg_stereoSeparation", "0.065", CVAR_ARCHIVE },
{ &cg_worldScale, "cg_worldScale", "33.5", CVAR_ARCHIVE }, { &cg_worldScale, "cg_worldScale", "33.5", CVAR_ARCHIVE },
{ &cg_heightAdjust, "cg_heightAdjust", "0.0", CVAR_ARCHIVE }, { &cg_heightAdjust, "cg_heightAdjust", "0.0", CVAR_ARCHIVE },
@ -380,7 +382,7 @@ static cvarTable_t cvarTable[] = {
{ &cg_drawFPS, "cg_drawFPS", "0", CVAR_ARCHIVE }, { &cg_drawFPS, "cg_drawFPS", "0", CVAR_ARCHIVE },
{ &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE }, { &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE },
{ &cg_drawAmmoWarning, "cg_drawAmmoWarning", "1", CVAR_ARCHIVE }, { &cg_drawAmmoWarning, "cg_drawAmmoWarning", "1", CVAR_ARCHIVE },
{ &cg_drawCrosshair, "cg_drawCrosshair", "0", CVAR_ARCHIVE }, { &cg_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE },
{ &cg_dynamicCrosshair, "cg_dynamicCrosshair", "1", CVAR_ARCHIVE }, { &cg_dynamicCrosshair, "cg_dynamicCrosshair", "1", CVAR_ARCHIVE },
{ &cg_crosshairIdentifyTarget, "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE }, { &cg_crosshairIdentifyTarget, "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE },
{ &cg_crosshairForceHint, "cg_crosshairForceHint", "1", CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART }, { &cg_crosshairForceHint, "cg_crosshairForceHint", "1", CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART },

View file

@ -97,8 +97,12 @@ void CG_MissionFailed(void)
cgi_SP_GetStringTextString( "INGAME_MISSIONFAILED", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_MISSIONFAILED", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontMedium, 1.2f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.2f * FONT_SCALE);
cgi_R_Font_DrawString(320 - w/2, y, text, colorTable[CT_HUD_RED], cgs.media.qhFontMedium, -1, 1.2f);
int tempX = 320 - w/2;
int tempY = y;
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);
switch (statusTextIndex) switch (statusTextIndex)
{ {
@ -140,12 +144,19 @@ void CG_MissionFailed(void)
break; break;
} }
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontMedium, 1.2f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.2f * FONT_SCALE);
cgi_R_Font_DrawString(320 - w/2, y+30, text, colorTable[CT_HUD_RED], cgs.media.qhFontMedium, -1, 1.2f); tempX = 320 - w/2;
tempY = y+30;
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_SP_GetStringTextString( "INGAME_RELOADMISSION", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_RELOADMISSION", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.0f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, FONT_SCALE);
cgi_R_Font_DrawString(320 - w/2, 450, text, colorTable[CT_CYAN], cgs.media.qhFontSmall, -1, 1.0f);
tempX = 320 - w/2;
tempY = 450;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_CYAN], cgs.media.qhFontSmall, -1, FONT_SCALE);
} }
@ -162,27 +173,43 @@ void CG_MissionCompletion(void)
const int pad = 18; const int pad = 18;
cgi_SP_GetStringTextString( "INGAME_MISSIONCOMPLETION", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_MISSIONCOMPLETION", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontMedium, 1.2f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.2f * FONT_SCALE);
cgi_R_Font_DrawString(320 - w/2, 53, text, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.2f);
int tempX = 320 - w/2;
int tempY = 53;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 1.2f * FONT_SCALE);
x = 75; x = 75;
y =86; y =86;
cgi_SP_GetStringTextString( "INGAME_SECRETAREAS", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_SECRETAREAS", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
cgi_SP_GetStringTextString( "INGAME_SECRETAREAS_OF", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_SECRETAREAS_OF", text, sizeof(text) );
cgi_R_Font_DrawString(x+w, y, va("%d %s %d", tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d %s %d",
cg_entities[0].gent->client->sess.missionStats.secretsFound, cg_entities[0].gent->client->sess.missionStats.secretsFound,
text, text,
cg_entities[0].gent->client->sess.missionStats.totalSecrets cg_entities[0].gent->client->sess.missionStats.totalSecrets
), ),
colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_ENEMIESKILLED", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_ENEMIESKILLED", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w,y, va("%d",cg_entities[0].gent->client->sess.missionStats.enemiesKilled), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.enemiesKilled), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
/* /*
cgi_SP_GetStringTextString( "INGAME_SECRETAREAS_OF", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_SECRETAREAS_OF", text, sizeof(text) );
cgi_R_Font_DrawString(x+w,y, va("%d %s %d", cgi_R_Font_DrawString(x+w,y, va("%d %s %d",
@ -190,14 +217,17 @@ w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f);
text, text,
cg_entities[0].gent->client->sess.missionStats.enemiesSpawned cg_entities[0].gent->client->sess.missionStats.enemiesSpawned
), ),
colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
*/ */
y +=pad; y +=pad;
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_FAVORITEWEAPON", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_FAVORITEWEAPON", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
int wpn=0,i; int wpn=0,i;
int max_wpn = cg_entities[0].gent->client->sess.missionStats.weaponUsed[0]; int max_wpn = cg_entities[0].gent->client->sess.missionStats.weaponUsed[0];
@ -214,31 +244,52 @@ w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f);
{ {
gitem_t *wItem= FindItemForWeapon( (weapon_t)wpn); gitem_t *wItem= FindItemForWeapon( (weapon_t)wpn);
cgi_SP_GetStringTextString( va("INGAME_%s",wItem->classname ), text, sizeof( text )); cgi_SP_GetStringTextString( va("INGAME_%s",wItem->classname ), text, sizeof( text ));
// cgi_R_Font_DrawString(x+w, y, va("%d",wpn), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); // cgi_R_Font_DrawString(tempX, tempY, va("%d",wpn), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x+w, y, text, colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
} }
x = 334+70; x = 334+70;
y = 86; y = 86;
cgi_SP_GetStringTextString( "INGAME_SHOTSFIRED", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_SHOTSFIRED", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.shotsFired), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.shotsFired), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_HITS", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_HITS", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.hits), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.hits), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_ACCURACY", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_ACCURACY", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
const float percent = cg_entities[0].gent->client->sess.missionStats.shotsFired? 100.0f * (float)cg_entities[0].gent->client->sess.missionStats.hits / cg_entities[0].gent->client->sess.missionStats.shotsFired : 0; const float percent = cg_entities[0].gent->client->sess.missionStats.shotsFired? 100.0f * (float)cg_entities[0].gent->client->sess.missionStats.hits / cg_entities[0].gent->client->sess.missionStats.shotsFired : 0;
cgi_R_Font_DrawString(x+w, y, va("%.2f%%",percent), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%.2f%%",percent), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
if ( cg_entities[0].gent->client->sess.missionStats.weaponUsed[WP_SABER] <= 0 ) if ( cg_entities[0].gent->client->sess.missionStats.weaponUsed[WP_SABER] <= 0 )
{ {
@ -247,91 +298,175 @@ w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f);
//first column, FORCE POWERS //first column, FORCE POWERS
y =180; y =180;
cgi_SP_GetStringTextString( "INGAME_FORCEUSE", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_FORCEUSE", text, sizeof(text) );
cgi_R_Font_DrawString(x, y, text, colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_HEAL", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_HEAL", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_HEAL]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_HEAL]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_SPEED", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_SPEED", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_SPEED]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_SPEED]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_PULL", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_PULL", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_PULL]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_PULL]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_PUSH", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_PUSH", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_PUSH]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_PUSH]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString("INGAME_MINDTRICK", text, sizeof(text) ); cgi_SP_GetStringTextString("INGAME_MINDTRICK", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_TELEPATHY]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_TELEPATHY]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_GRIP", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_GRIP", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_GRIP]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_GRIP]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_LIGHTNING", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_LIGHTNING", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_LIGHTNING]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.forceUsed[FP_LIGHTNING]), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
//second column, LIGHT SABER //second column, LIGHT SABER
y = 180; y = 180;
x = 140; x = 140;
cgi_SP_GetStringTextString( "INGAME_LIGHTSABERUSE", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_LIGHTSABERUSE", text, sizeof(text) );
cgi_R_Font_DrawString(x, y, text, colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_THROWN", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_THROWN", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.saberThrownCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.saberThrownCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_BLOCKS", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_BLOCKS", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.saberBlocksCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.saberBlocksCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_LEGATTACKS", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_LEGATTACKS", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.legAttacksCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.legAttacksCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_ARMATTACKS", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_ARMATTACKS", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.armAttacksCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.armAttacksCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_BODYATTACKS", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_BODYATTACKS", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.torsoAttacksCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.torsoAttacksCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
y +=pad; y +=pad;
cgi_SP_GetStringTextString( "INGAME_OTHERATTACKS", text, sizeof(text) ); cgi_SP_GetStringTextString( "INGAME_OTHERATTACKS", text, sizeof(text) );
w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE);
cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); tempX = x;
cgi_R_Font_DrawString(x+w, y, va("%d",cg_entities[0].gent->client->sess.missionStats.otherAttacksCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f); tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
tempX = x+w;
tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, va("%d",cg_entities[0].gent->client->sess.missionStats.otherAttacksCnt), colorTable[CT_WHITE], cgs.media.qhFontSmall, -1, 0.8f * FONT_SCALE);
} }

View file

@ -188,7 +188,7 @@ void CG_CaptionTextStop(void)
// //
// returns 0 if failed, else strlen... // returns 0 if failed, else strlen...
// //
static int cg_SP_GetStringTextStringWithRetry( const char *psReference, char *psDest, int iSizeofDest ) static int cg_SP_GetStringTextStringWithRetry( const char *psReference, char *psDest, int iSizeofDest)
{ {
int iReturn; int iReturn;
@ -218,7 +218,7 @@ static int cg_SP_GetStringTextStringWithRetry( const char *psReference, char *ps
// the "filename" part of which should be the same as the StripEd reference we're looking for in the current // the "filename" part of which should be the same as the StripEd reference we're looking for in the current
// level's string package... // level's string package...
// //
void CG_CaptionText( const char *str, int sound ) void CG_CaptionText( const char *str, int sound)
{ {
const char *s, *holds; const char *s, *holds;
int i; int i;
@ -241,9 +241,9 @@ void CG_CaptionText( const char *str, int sound )
{ {
#ifndef FINAL_BUILD #ifndef FINAL_BUILD
// we only care about some sound dirs... // we only care about some sound dirs...
if (!Q_strncmp(str,"sound/chars/",12)) // whichever language it is, it'll be pathed as english at this point if (!Q_stricmpn(str,"sound/chars/",12)) // whichever language it is, it'll be pathed as english at this point
{ {
Com_Printf("WARNING: CG_CaptionText given invalid text key :'%s'\n",str); Com_Printf("WARNING: CG_CaptionText given invalid text key: '%s'\n", str);
} }
else else
{ {
@ -259,7 +259,7 @@ void CG_CaptionText( const char *str, int sound )
if (in_camera) { if (in_camera) {
cg.captionTextY = SCREEN_HEIGHT - (client_camera.bar_height_dest/2); // ths is now a centre'd Y, not a start Y cg.captionTextY = SCREEN_HEIGHT - (client_camera.bar_height_dest/2); // ths is now a centre'd Y, not a start Y
} else { //get above the hud } else { //get above the hud
cg.captionTextY = (int) (0.88f * ((float)SCREEN_HEIGHT - (float)fontHeight * 1.5f)); // do NOT move this, it has to fit in between the weapon HUD and the datapad update. cg.captionTextY = (int) (0.88f*((float)SCREEN_HEIGHT - (float)fontHeight * 1.5f)); // do NOT move this, it has to fit in between the weapon HUD and the datapad update.
} }
cg.captionTextCurrentLine = 0; cg.captionTextCurrentLine = 0;
@ -438,18 +438,22 @@ void CG_DrawCaptionText(void)
// Set Y of the first line (varies if only printing one line of text) // Set Y of the first line (varies if only printing one line of text)
// (this all works, please don't mess with it) // (this all works, please don't mess with it)
const int fontHeight = (int) ((cgi_Language_IsAsian() ? 1.4f : 1.0f) * (float) cgi_R_Font_HeightPixels(cgs.media.qhFontMedium, fFontScale)); const int fontHeight = (int) ((cgi_Language_IsAsian() ? 1.4f : 1.0f) * (float) cgi_R_Font_HeightPixels(cgs.media.qhFontSmall, fFontScale * FONT_SCALE));
const bool bPrinting2Lines = !!(cg.captionText[ cg.captionTextCurrentLine+1 ][0]); const bool bPrinting2Lines = !!(cg.captionText[ cg.captionTextCurrentLine+1 ][0]);
y = cg.captionTextY - ( (float)fontHeight * (bPrinting2Lines ? 1 : 0.5f)); // captionTextY was a centered Y pos, not a top one y = cg.captionTextY - ( (float)fontHeight * (bPrinting2Lines ? 1 : 0.5f)); // captionTextY was a centered Y pos, not a top one
y -= cgi_Language_IsAsian() ? 0 : 4; y -= cgi_Language_IsAsian() ? 0 : 4;
for (i= cg.captionTextCurrentLine;i< cg.captionTextCurrentLine + 2;++i) for (i= cg.captionTextCurrentLine;i< cg.captionTextCurrentLine + 2;++i)
{ {
w = cgi_R_Font_StrLenPixels(cg.captionText[i], cgs.media.qhFontMedium, fFontScale); w = cgi_R_Font_StrLenPixels(cg.captionText[i], cgs.media.qhFontSmall, fFontScale * FONT_SCALE);
if (w) if (w)
{ {
x = (SCREEN_WIDTH-w) / 2; x = (SCREEN_WIDTH-w) / 2;
cgi_R_Font_DrawString(x, y, cg.captionText[i], textcolor_caption, cgs.media.qhFontMedium, -1, fFontScale);
int tempX = x;
int tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, cg.captionText[i], textcolor_caption, cgs.media.qhFontSmall, -1, fFontScale * FONT_SCALE);
y += fontHeight; y += fontHeight;
} }
} }
@ -557,8 +561,8 @@ void CG_ScrollText( const char *str, int iPixelWidth )
// //
cg.printText[i][ strlen(cg.printText[i])-1 ] = '\0'; // kill the CR cg.printText[i][ strlen(cg.printText[i])-1 ] = '\0'; // kill the CR
i++; i++;
assert (i < (int)ARRAY_LEN( cg.printText ) ); assert (i < (int)(sizeof(cg.printText)/sizeof(cg.printText[0])) );
if (i >= (int)ARRAY_LEN( cg.printText ) ) if (i >= (int)(sizeof(cg.printText)/sizeof(cg.printText[0])) )
{ {
break; break;
} }
@ -585,7 +589,7 @@ void CG_ScrollText( const char *str, int iPixelWidth )
cg.printText[i][ psBestLineBreakSrcPos - holds ] = '\0'; cg.printText[i][ psBestLineBreakSrcPos - holds ] = '\0';
holds = s = psBestLineBreakSrcPos; holds = s = psBestLineBreakSrcPos;
i++; i++;
assert( i < (int)ARRAY_LEN( cg.printText ) ); assert (i < (int)(sizeof(cg.printText)/sizeof(cg.printText[0])) );
cg.scrollTextLines++; cg.scrollTextLines++;
} }
} }
@ -602,7 +606,7 @@ void CG_DrawScrollText(void)
{ {
int i; int i;
int x,y; int x,y;
const int fontHeight = (int) (1.5f * (float) cgi_R_Font_HeightPixels(cgs.media.qhFontMedium, 1.0f)); // taiwanese & japanese need 1.5 fontheight spacing const int fontHeight = (int) (1.5f * (float) cgi_R_Font_HeightPixels(cgs.media.qhFontSmall, FONT_SCALE)); // taiwanese & japanese need 1.5 fontheight spacing
if ( !cg.scrollTextTime ) if ( !cg.scrollTextTime )
{ {
@ -641,7 +645,11 @@ void CG_DrawScrollText(void)
// if (w) // if (w)
{ {
x = (SCREEN_WIDTH - giScrollTextPixelWidth) / 2; x = (SCREEN_WIDTH - giScrollTextPixelWidth) / 2;
cgi_R_Font_DrawString(x,y, cg.printText[i], textcolor_scroll, cgs.media.qhFontMedium, -1, 1.0f);
int tempX = x;
int tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY, cg.printText[i], textcolor_scroll, cgs.media.qhFontSmall, -1, FONT_SCALE);
y += fontHeight; y += fontHeight;
} }
} }
@ -719,7 +727,7 @@ void CG_DrawCenterString( void )
return; return;
} }
color = CG_FadeColor( cg.centerPrintTime, 1000 * cg_centertime.value ); color = CG_FadeColor( cg.centerPrintTime, 1000 * 3 );
if ( !color ) { if ( !color ) {
return; return;
} }
@ -732,7 +740,7 @@ void CG_DrawCenterString( void )
start = cg.centerPrint; start = cg.centerPrint;
const int fontHeight = cgi_R_Font_HeightPixels(cgs.media.qhFontMedium, 1.0f); const int fontHeight = cgi_R_Font_HeightPixels(cgs.media.qhFontSmall, FONT_SCALE);
y = cg.centerPrintY - (cg.centerPrintLines * fontHeight) / 2; y = cg.centerPrintY - (cg.centerPrintLines * fontHeight) / 2;
while ( 1 ) { while ( 1 ) {
@ -759,11 +767,14 @@ void CG_DrawCenterString( void )
} }
linebuffer[iOutIndex++] = '\0'; linebuffer[iOutIndex++] = '\0';
w = cgi_R_Font_StrLenPixels(linebuffer, cgs.media.qhFontMedium, 1.0f); w = cgi_R_Font_StrLenPixels(linebuffer, cgs.media.qhFontSmall, FONT_SCALE);
x = ( SCREEN_WIDTH - w ) / 2; x = ( SCREEN_WIDTH - w ) / 2;
cgi_R_Font_DrawString(x,y,linebuffer, textcolor_center, cgs.media.qhFontMedium, -1, 1.0f); int tempX = x;
int tempY = y;
CG_AdjustFrom640Int( &tempX, &tempY, NULL, NULL );
cgi_R_Font_DrawString(tempX, tempY,linebuffer, textcolor_center, cgs.media.qhFontSmall, -1, FONT_SCALE);
y += fontHeight; y += fontHeight;

View file

@ -783,6 +783,12 @@ void CG_CalculateWeaponPosition( vec3_t origin, vec3_t angles )
static float CG_CalculateWeaponPositionAndScale( playerState_t *ps, vec3_t origin, vec3_t angles ) { static float CG_CalculateWeaponPositionAndScale( playerState_t *ps, vec3_t origin, vec3_t angles ) {
if (cg.renderingThirdPerson)
{
CG_CalculateWeaponPosition(origin, angles);
return 1.0f;
}
BG_CalculateVRWeaponPosition(origin, angles); BG_CalculateVRWeaponPosition(origin, angles);
vec3_t offset; vec3_t offset;

View file

@ -358,7 +358,7 @@ int CNode::Save( int numNodes, fileHandle_t file )
int i; int i;
//Write out the header //Write out the header
unsigned long header = NODE_HEADER_ID; uint32_t header = NODE_HEADER_ID;
gi.FS_Write( &header, sizeof( header ), file ); gi.FS_Write( &header, sizeof( header ), file );
//Write out the basic information //Write out the basic information
@ -397,7 +397,7 @@ Load
int CNode::Load( int numNodes, fileHandle_t file ) int CNode::Load( int numNodes, fileHandle_t file )
{ {
unsigned long header; uint32_t header;
int i; int i;
gi.FS_Read( &header, sizeof(header), file ); gi.FS_Read( &header, sizeof(header), file );
@ -522,9 +522,9 @@ GetLong
------------------------- -------------------------
*/ */
long CNavigator::GetLong( fileHandle_t file ) uint32_t CNavigator::GetLong( fileHandle_t file )
{ {
long value; uint32_t value;
gi.FS_Read( &value, sizeof( value ), file ); gi.FS_Read( &value, sizeof( value ), file );
@ -578,7 +578,7 @@ bool CNavigator::Load( const char *filename, int checksum )
return false; return false;
//Check the header id //Check the header id
long navID = GetLong( file ); uint32_t navID = GetLong( file );
if ( navID != NAV_HEADER_ID ) if ( navID != NAV_HEADER_ID )
{ {
@ -640,7 +640,7 @@ bool CNavigator::Save( const char *filename, int checksum )
return false; return false;
//Write out the header id //Write out the header id
unsigned long id = NAV_HEADER_ID; uint32_t id = NAV_HEADER_ID;
gi.FS_Write( &id, sizeof (id), file ); gi.FS_Write( &id, sizeof (id), file );

View file

@ -246,7 +246,7 @@ protected:
char GetChar( fileHandle_t file ); char GetChar( fileHandle_t file );
int GetInt( fileHandle_t file ); int GetInt( fileHandle_t file );
float GetFloat( fileHandle_t file ); float GetFloat( fileHandle_t file );
long GetLong( fileHandle_t file ); uint32_t GetLong( fileHandle_t file );
//void ConnectNodes( void ); //void ConnectNodes( void );
void SetEdgeCost( int ID1, int ID2, int cost ); void SetEdgeCost( int ID1, int ID2, int cost );

View file

@ -359,6 +359,8 @@ float Com_AbsClamp( float min, float max, float value )
float Q_rsqrt( float number ) float Q_rsqrt( float number )
{ {
// return sqrtf( number );
byteAlias_t t; byteAlias_t t;
float x2, y; float x2, y;
const float threehalfs = 1.5F; const float threehalfs = 1.5F;
@ -371,12 +373,15 @@ float Q_rsqrt( float number )
y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration
// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed // y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed
assert( !Q_isnan(y) ); //assert( !Q_isnan(y) );
return y; return y;
} }
float Q_fabs( float f ) float Q_fabs( float f )
{ {
//return fabs(f);
byteAlias_t fi; byteAlias_t fi;
fi.f = f; fi.f = f;
fi.i &= 0x7FFFFFFF; fi.i &= 0x7FFFFFFF;
@ -675,10 +680,10 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
float inv_denom; float inv_denom;
inv_denom = DotProduct( normal, normal ); inv_denom = DotProduct( normal, normal );
assert( Q_fabs(inv_denom) != 0.0f ); if ( Q_fabs(inv_denom) != 0.0f ) {
inv_denom = 1.0f / inv_denom; inv_denom = 1.0f / inv_denom;
d = DotProduct( normal, p ) * inv_denom; d = DotProduct(normal, p) * inv_denom;
n[0] = normal[0] * inv_denom; n[0] = normal[0] * inv_denom;
n[1] = normal[1] * inv_denom; n[1] = normal[1] * inv_denom;
@ -687,6 +692,7 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )
dst[0] = p[0] - d * n[0]; dst[0] = p[0] - d * n[0];
dst[1] = p[1] - d * n[1]; dst[1] = p[1] - d * n[1];
dst[2] = p[2] - d * n[2]; dst[2] = p[2] - d * n[2];
}
} }
qboolean G_FindClosestPointOnLineSegment( const vec3_t start, const vec3_t end, const vec3_t from, vec3_t result ) qboolean G_FindClosestPointOnLineSegment( const vec3_t start, const vec3_t end, const vec3_t from, vec3_t result )

BIN
assets/vr_splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

View file

@ -8,10 +8,10 @@ seta vr_weapon_adjustment_2 "1.308,-3.976,5.245,-6.544,0.000,0.000,0.000"
seta vr_weapon_adjustment_3 "1.308,-3.976,6.177,-9.694,0.000,0.000,0.000" seta vr_weapon_adjustment_3 "1.308,-3.976,6.177,-9.694,0.000,0.000,0.000"
seta vr_weapon_adjustment_4 "0.44,-8.75,12.50,-2.31,-0.00,-1.80,5.00" seta vr_weapon_adjustment_4 "0.44,-8.75,12.50,-2.31,-0.00,-1.80,5.00"
seta vr_weapon_adjustment_5 "1.500,-2.747,5.707,-7.827,1.800,0.000,0.000" seta vr_weapon_adjustment_5 "1.500,-2.747,5.707,-7.827,1.800,0.000,0.000"
seta vr_weapon_adjustment_6 "0.57,-10.07,14.09,-21.36,28.00,30.50,-0.60" seta vr_weapon_adjustment_6 "0.700,-4.029,10.714,-6.771,0.000,0.000,0.000"
seta vr_weapon_adjustment_7 "1.22,-5.65,6.81,-3.40,0.00,0.20,0.70" seta vr_weapon_adjustment_7 "1.22,-5.65,6.81,-3.40,0.00,0.20,0.70"
seta vr_weapon_adjustment_8 "0.67,-9.31,12.49,-7.42,0.50,0.20,0.70" seta vr_weapon_adjustment_8 "1.000,-4.780,8.240,-10.440,0.000,0.000,0.000"
seta vr_weapon_adjustment_9 "0.70,-5.01,6.81,13.25,0.00,0.00,0.00" seta vr_weapon_adjustment_9 "1.000,-4.780,8.240,-10.440,0.000,0.000,0.000"
seta vr_weapon_adjustment_10 "1.500,-3.600,5.973,-8.640,0.000,0.000,0.000" seta vr_weapon_adjustment_10 "1.500,-3.600,5.973,-8.640,0.000,0.000,0.000"
seta vr_weapon_adjustment_11 "0.44,-9.55,12.79,-23.06,0.30,-1.40,-0.40" seta vr_weapon_adjustment_11 "0.44,-9.55,12.79,-23.06,0.30,-1.40,-0.40"
seta vr_weapon_adjustment_20 "0.44,-13.55,12.79,-26.06,0.30,-1.40,-0.40" seta vr_weapon_adjustment_20 "0.44,-13.55,12.79,-26.06,0.30,-1.40,-0.40"