diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 0a04128..0000000 --- a/LICENSE +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - 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. diff --git a/Projects/Android/AndroidManifest.xml b/Projects/Android/AndroidManifest.xml index 0cfcfcb..2cae0b9 100644 --- a/Projects/Android/AndroidManifest.xml +++ b/Projects/Android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="10" + android:versionName="0.0.10" android:installLocation="auto" > @@ -25,6 +25,7 @@ + . #include "../game/objectives.h" #include "../game/g_vehicles.h" #include +#include "bg_local.h" 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 @@ -3109,7 +3188,7 @@ static void CG_ScanForCrosshairEntity( qboolean scanAll ) } */ //draw crosshair at endpoint - CG_DrawCrosshair( trace.endpos ); + //CG_DrawCrosshair( trace.endpos ); g_crosshairEntNum = trace.entityNum; g_crosshairEntDist = 4096*trace.fraction; @@ -3169,7 +3248,6 @@ static void CG_ScanForCrosshairEntity( qboolean scanAll ) cg.crosshairClientTime = cg.time; } - /* ===================== CG_DrawCrosshairNames @@ -3400,8 +3478,12 @@ static float CG_DrawSnapshot( float y ) { s = va( "time:%i snap:%i cmd:%i", cg.snap->serverTime, cg.latestSnapshotNum, cgs.serverCommandSequence ); - w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); - cgi_R_Font_DrawString(635 - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f); + w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE); + + 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; } @@ -3444,8 +3526,12 @@ static float CG_DrawFPS( float y ) { fps = 1000 * FPS_FRAMES / total; s = va( "%ifps", fps ); - const int w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); - cgi_R_Font_DrawString(635-xOffset - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f); + const int w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE); + + 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; } @@ -3468,8 +3554,12 @@ static float CG_DrawTimer( float y ) { s = va( "%i:%i%i", mins, tens, seconds ); - w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); - cgi_R_Font_DrawString(635 - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f); + w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE); + + 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; } @@ -3504,8 +3594,12 @@ static void CG_DrawAmmoWarning( void ) { //s = "LOW AMMO WARNING"; } - w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.0f); - cgi_R_Font_DrawString(320 - w/2, 64, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 1.0f); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, FONT_SCALE); + + 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 ) { + cg.drawingHUD = true; CG_DrawIntermission(); + cg.drawingHUD = false; return; } @@ -3942,7 +4038,12 @@ static void CG_Draw2D( void ) } } - CGCam_DrawWideScreen(); + if (!vr->immersive_cinematics) { + CGCam_DrawWideScreen(); + } + + //Everything below here needs to be fitted into the visible portion of the display + cg.drawingHUD = true; 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 if ( !in_camera ) { + cg.drawingHUD = false; CG_DrawZoomMask(); + cg.drawingHUD = true; } CG_DrawScrollText(); @@ -3962,10 +4065,12 @@ static void CG_Draw2D( void ) if ( in_camera ) {//still draw the saber clash flare, but nothing else + cg.drawingHUD = false; CG_SaberClashFlare(); return; } + cg.drawingHUD = false; if ( CG_RenderingFromMiscCamera()) { // 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(); return; } + cg.drawingHUD = true; if ( (cg.snap->ps.forcePowersActive&(1<. 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 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 ) { - 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; - float screenYScale = 1.0f / 3.5f; - - float xoffset = -24; - if (cg.refdef.stereoView == 1) { - xoffset *= -1; - } - - *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; + fw = (float)*w; } + float fh = 0; + if (h != NULL) + { + 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; + } + } /* diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_local.h b/Projects/Android/jni/OpenJK/code/cgame/cg_local.h index 1ae69c6..4327cf4 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_local.h +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_local.h @@ -432,6 +432,7 @@ typedef struct { int itemPickupTime; int itemPickupBlendTime; // the pulse around the crosshair is timed seperately + bool drawingHUD; float iconHUDPercent; // How far into opening sequence the icon HUD is int iconSelectTime; // How long the Icon HUD has been active qboolean iconHUDActive; @@ -629,6 +630,7 @@ extern vmCvar_t cg_thirdPersonTargetDamp; extern vmCvar_t cg_saberAutoThird; extern vmCvar_t cg_gunAutoFirst; +extern vmCvar_t cg_zProj; extern vmCvar_t cg_stereoSeparation; extern vmCvar_t cg_worldScale; extern vmCvar_t cg_heightAdjust; @@ -745,6 +747,8 @@ Ghoul2 Insert End #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_FillRect( float x, float y, float width, float height, const float *color ); 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 ); 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 diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_main.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_main.cpp index 5cbd605..35f2834 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_main.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_main.cpp @@ -312,6 +312,7 @@ vmCvar_t cg_thirdPersonAlpha; vmCvar_t cg_thirdPersonAutoAlpha; vmCvar_t cg_thirdPersonHorzOffset; +vmCvar_t cg_zProj; vmCvar_t cg_stereoSeparation; vmCvar_t cg_worldScale; vmCvar_t cg_heightAdjust; @@ -381,6 +382,7 @@ static cvarTable_t cvarTable[] = { { &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE }, { &cg_fov, "cg_fov", "80", 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_worldScale, "cg_worldScale", "33.5", 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_drawSnapshot, "cg_drawSnapshot", "0", 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 }, // NOTE : I also create this in UI_Init() { &cg_crosshairIdentifyTarget, "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE }, diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_text.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_text.cpp index d535bce..c8c34a3 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_text.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_text.cpp @@ -442,18 +442,22 @@ void CG_DrawCaptionText(void) // Set Y of the first line (varies if only printing one line of text) // (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]); 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; 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) { 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; } } @@ -608,7 +612,7 @@ void CG_DrawScrollText(void) { int i; 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 ) { @@ -647,7 +651,11 @@ void CG_DrawScrollText(void) // if (w) { 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; } } @@ -738,7 +746,7 @@ void CG_DrawCenterString( void ) 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; while ( 1 ) { @@ -767,11 +775,14 @@ void CG_DrawCenterString( void ) } 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; - 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; diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp index 23f7adf..477b35b 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp @@ -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 ) { + if (cg.renderingThirdPerson) + { + CG_CalculateWeaponPosition(origin, angles); + return 1.0f; + } + BG_CalculateVRWeaponPosition(origin, angles); vec3_t offset; diff --git a/Projects/Android/jni/OpenJK/code/client/cl_input.cpp b/Projects/Android/jni/OpenJK/code/client/cl_input.cpp index a16dc5e..b5120b0 100644 --- a/Projects/Android/jni/OpenJK/code/client/cl_input.cpp +++ b/Projects/Android/jni/OpenJK/code/client/cl_input.cpp @@ -376,9 +376,6 @@ Moves the local angle positions ================ */ void CL_AdjustAngles( void ) { - //Make sure Pitch is correct - IN_CenterView(); - cl.viewangles[YAW] -= old_move.yaw; cl.viewangles[YAW] += new_move.yaw; @@ -675,8 +672,13 @@ void CL_FinishMove( usercmd_t *cmd ) { // can be determined without allowing cheating 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++) { - cmd->angles[i] = ANGLE2SHORT(cl.viewangles[i]); + cmd->angles[i] = ANGLE2SHORT(angles[i]); } //retain the move from this diff --git a/Projects/Android/jni/OpenJK/code/qcommon/q_shared.h b/Projects/Android/jni/OpenJK/code/qcommon/q_shared.h index 732b902..32bc0ac 100644 --- a/Projects/Android/jni/OpenJK/code/qcommon/q_shared.h +++ b/Projects/Android/jni/OpenJK/code/qcommon/q_shared.h @@ -517,7 +517,7 @@ Ghoul2 Insert Start 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 typedef struct { qboolean allsolid; // if true, plane is not valid diff --git a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_WorldEffects.cpp b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_WorldEffects.cpp index 7243dd5..70eb564 100644 --- a/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_WorldEffects.cpp +++ b/Projects/Android/jni/OpenJK/code/rd-vanilla/tr_WorldEffects.cpp @@ -697,6 +697,14 @@ public: 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, // so we can diskload those. Maybe. fileHandle_t f = ReadCachedWeatherFile(); @@ -720,15 +728,6 @@ public: uint32_t contents; 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(); // Iterate Over All Weather Zones @@ -2143,8 +2142,13 @@ void R_WorldEffectCommand(const char *command) COM_EndParseSession(); return; } + int count = 1000; + const char* tempStr; + COM_ParseString(&command, &tempStr); + COM_ParseInt(&command, &count); + CParticleCloud& nCloud = mParticleClouds.push_back(); - nCloud.Initialize(1000, "gfx/effects/snowflake1.tga"); + nCloud.Initialize(count, "gfx/effects/snowflake1.tga"); nCloud.mBlendMode = 1; nCloud.mRotationChangeNext = 0; nCloud.mColor = 0.75f; diff --git a/Projects/Android/jni/OpenJK/code/ui/ui_atoms.cpp b/Projects/Android/jni/OpenJK/code/ui/ui_atoms.cpp index c789735..37327c6 100644 --- a/Projects/Android/jni/OpenJK/code/ui/ui_atoms.cpp +++ b/Projects/Android/jni/OpenJK/code/ui/ui_atoms.cpp @@ -270,7 +270,7 @@ void UI_Init( int apiVersion, uiimport_t *uiimport, qboolean inGameLoad ) 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 ("s_language", "english", CVAR_ARCHIVE | CVAR_NORESTART); #ifndef JK2_MODE diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp index 60931a4..f78fdcd 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_draw.cpp @@ -28,8 +28,11 @@ along with this program; if not, see . #include "cg_local.h" #include "cg_media.h" #include "../game/objectives.h" +#include "bg_local.h" #include +#include "FxUtil.h" + void CG_DrawIconBackground(void); void CG_DrawMissionInformation( 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 @@ -1853,7 +1934,7 @@ static void CG_ScanForCrosshairEntity( qboolean scanAll ) } */ //draw crosshair at endpoint - CG_DrawCrosshair( trace.endpos ); + //CG_DrawCrosshair( trace.endpos ); g_crosshairEntNum = trace.entityNum; g_crosshairEntDist = 4096*trace.fraction; @@ -2096,11 +2177,15 @@ static float CG_DrawSnapshot( float y ) { char *s; int w; - s = va( "time:%i snap:%i cmd:%i", cg.snap->serverTime, - cg.latestSnapshotNum, cgs.serverCommandSequence ); + s = va( "time:%i snap:%i cmd:%i", cg.snap->serverTime, + cg.latestSnapshotNum, cgs.serverCommandSequence ); - w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); - cgi_R_Font_DrawString(635 - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f); + w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE); + + 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; } @@ -2142,8 +2227,12 @@ static float CG_DrawFPS( float y ) { fps = 1000 * FPS_FRAMES / total; s = va( "%ifps", fps ); - const int w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); - cgi_R_Font_DrawString(635 - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f); + const int w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE); + + 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; } @@ -2166,9 +2255,12 @@ static float CG_DrawTimer( float y ) { s = va( "%i:%i%i", mins, tens, seconds ); - w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontMedium, 1.0f); - cgi_R_Font_DrawString(635 - w, y+2, s, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.0f); + w = cgi_R_Font_StrLenPixels(s, cgs.media.qhFontSmall, FONT_SCALE); + 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; } @@ -2202,8 +2294,10 @@ static void CG_DrawAmmoWarning( void ) { //s = "LOW AMMO WARNING"; } - w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.0f); - 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); } //--------------------------------------- @@ -2273,7 +2367,9 @@ static void CG_Draw2D( void ) if ( cg.snap->ps.pm_type == PM_INTERMISSION ) { + cg.drawingHUD = true; CG_DrawIntermission(); + cg.drawingHUD = false; return; } @@ -2285,14 +2381,20 @@ static void CG_Draw2D( void ) } } - CGCam_DrawWideScreen(); + if (!vr->immersive_cinematics) { + CGCam_DrawWideScreen(); + } + + cg.drawingHUD = true; CG_DrawBatteryCharge(); // Draw this before the text so that any text won't get clipped off if ( !in_camera ) { + cg.drawingHUD = false; CG_DrawZoomMask(); + cg.drawingHUD = true; } CG_DrawScrollText(); @@ -2300,10 +2402,12 @@ static void CG_Draw2D( void ) if ( in_camera ) {//still draw the saber clash flare, but nothing else + cg.drawingHUD = false; CG_SaberClashFlare(); return; } + cg.drawingHUD = false; if ( CG_RenderingFromMiscCamera()) { // 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(); return; } + cg.drawingHUD = true; // don't draw any status if dead if ( cg.snap->ps.stats[STAT_HEALTH] > 0 ) @@ -2402,10 +2507,14 @@ static void CG_Draw2D( void ) y_pos = (SCREEN_HEIGHT/2)+80; 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); } - 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) { @@ -2413,10 +2522,14 @@ static void CG_Draw2D( void ) cgi_SP_GetStringTextString("INGAME_NEW_FORCE_POWER_INFO", text, sizeof(text) ); 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); } - 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) @@ -2425,10 +2538,14 @@ static void CG_Draw2D( void ) cgi_SP_GetStringTextString( "INGAME_NEW_OBJECTIVE_INFO", text, sizeof(text) ); 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); } - 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) @@ -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(); } + CG_DrawCrosshair3D(); + if (!in_camera || vr->immersive_cinematics) { //Vertical Positional Movement cg.refdef.vieworg[2] -= DEFAULT_PLAYER_HEIGHT; diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp index dee4c52..6f4eadd 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_drawtools.cpp @@ -27,13 +27,13 @@ along with this program; if not, see . 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 screenYScale = 1.0f / 2.5f; float xoffset = -24; - if (cg.refdef.stereoView == 1) { + if (cg.refdef.stereoView == STEREO_LEFT) { xoffset *= -1; } @@ -50,29 +50,32 @@ void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) { *y += (480 - (480 * screenYScale)) / 2.0f; } } + 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; - float screenYScale = 1.0f / 3.5f; - - float xoffset = -24; - if (cg.refdef.stereoView == 1) { - xoffset *= -1; - } - - *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; + fw = (float)*w; } + float fh = 0; + if (h != NULL) + { + 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; + } + } /* diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h index 2fd7cf8..5c6573e 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h @@ -429,6 +429,7 @@ typedef struct { int itemPickupTime; int itemPickupBlendTime; // the pulse around the crosshair is timed seperately + bool drawingHUD; float iconHUDPercent; // How far into opening sequence the icon HUD is int iconSelectTime; // How long the Icon HUD has been active qboolean iconHUDActive; @@ -609,6 +610,7 @@ extern vmCvar_t cg_thirdPersonTargetDamp; extern vmCvar_t cg_saberAutoThird; extern vmCvar_t cg_gunAutoFirst; +extern vmCvar_t cg_zProj; extern vmCvar_t cg_stereoSeparation; extern vmCvar_t cg_worldScale; extern vmCvar_t cg_heightAdjust; @@ -728,6 +730,7 @@ Ghoul2 Insert End #define CG_UNDERLINE 0x00008000 #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_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 ); 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 diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp index ec9365c..bb1b084 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp @@ -303,6 +303,7 @@ vmCvar_t cg_thirdPersonAlpha; vmCvar_t cg_thirdPersonAutoAlpha; vmCvar_t cg_thirdPersonHorzOffset; +vmCvar_t cg_zProj; vmCvar_t cg_stereoSeparation; vmCvar_t cg_worldScale; vmCvar_t cg_heightAdjust; @@ -368,6 +369,7 @@ static cvarTable_t cvarTable[] = { { &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE }, { &cg_fov, "cg_fov", "80", 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_worldScale, "cg_worldScale", "33.5", 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_drawSnapshot, "cg_drawSnapshot", "0", 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_crosshairIdentifyTarget, "cg_crosshairIdentifyTarget", "1", CVAR_ARCHIVE }, { &cg_crosshairForceHint, "cg_crosshairForceHint", "1", CVAR_ARCHIVE|CVAR_SAVEGAME|CVAR_NORESTART }, diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_scoreboard.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_scoreboard.cpp index 27fb1ac..ef0fdb8 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_scoreboard.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_scoreboard.cpp @@ -95,10 +95,14 @@ void CG_MissionFailed(void) int w; int y = 230; - 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); - cgi_R_Font_DrawString(320 - w/2, y, text, colorTable[CT_HUD_RED], cgs.media.qhFontMedium, -1, 1.2f); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.2f * FONT_SCALE); + + 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) { @@ -140,12 +144,19 @@ void CG_MissionFailed(void) break; } - w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontMedium, 1.2f); - cgi_R_Font_DrawString(320 - w/2, y+30, text, colorTable[CT_HUD_RED], cgs.media.qhFontMedium, -1, 1.2f); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.2f * FONT_SCALE); + 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) ); - w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.0f); - cgi_R_Font_DrawString(320 - w/2, 450, text, colorTable[CT_CYAN], cgs.media.qhFontSmall, -1, 1.0f); + cgi_SP_GetStringTextString( "INGAME_RELOADMISSION", text, sizeof(text) ); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, FONT_SCALE); + + 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; cgi_SP_GetStringTextString( "INGAME_MISSIONCOMPLETION", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontMedium, 1.2f); - cgi_R_Font_DrawString(320 - w/2, 53, text, colorTable[CT_LTGOLD1], cgs.media.qhFontMedium, -1, 1.2f); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.2f * FONT_SCALE); + + 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; y =86; cgi_SP_GetStringTextString( "INGAME_SECRETAREAS", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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_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, text, 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; cgi_SP_GetStringTextString( "INGAME_ENEMIESKILLED", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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_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, 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; cgi_SP_GetStringTextString( "INGAME_FAVORITEWEAPON", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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 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); 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(x+w, y, text, 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); + 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; y = 86; cgi_SP_GetStringTextString( "INGAME_SHOTSFIRED", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_HITS", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_ACCURACY", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); + w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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; - 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 ) { @@ -247,91 +298,175 @@ w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); //first column, FORCE POWERS y =180; 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; cgi_SP_GetStringTextString( "INGAME_HEAL", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_SPEED", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_PULL", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_PUSH", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString("INGAME_MINDTRICK", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_GRIP", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_LIGHTNING", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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 y = 180; x = 140; 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; cgi_SP_GetStringTextString( "INGAME_THROWN", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_BLOCKS", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_LEGATTACKS", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_ARMATTACKS", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_BODYATTACKS", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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; cgi_SP_GetStringTextString( "INGAME_OTHERATTACKS", text, sizeof(text) ); -w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f); - cgi_R_Font_DrawString(x, y, text, colorTable[CT_LTGOLD1], cgs.media.qhFontSmall, -1, 0.8f); - 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); +w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 0.8f * FONT_SCALE); + 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); + 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); } diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp index c69f3ae..5e763cc 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_text.cpp @@ -188,7 +188,7 @@ void CG_CaptionTextStop(void) // // 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; @@ -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 // level's string package... // -void CG_CaptionText( const char *str, int sound ) +void CG_CaptionText( const char *str, int sound) { const char *s, *holds; int i; @@ -241,9 +241,9 @@ void CG_CaptionText( const char *str, int sound ) { #ifndef FINAL_BUILD // 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 { @@ -259,7 +259,7 @@ void CG_CaptionText( const char *str, int sound ) if (in_camera) { 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 - 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; @@ -429,7 +429,7 @@ void CG_DrawCaptionText(void) // Give a color if one wasn't given if((textcolor_caption[0] == 0) && (textcolor_caption[1] == 0) && - (textcolor_caption[2] == 0) && (textcolor_caption[3] == 0)) + (textcolor_caption[2] == 0) && (textcolor_caption[3] == 0)) { VectorCopy4( colorTable[CT_WHITE], textcolor_caption ); } @@ -438,18 +438,22 @@ void CG_DrawCaptionText(void) // Set Y of the first line (varies if only printing one line of text) // (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]); 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; 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) { 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; } } @@ -557,8 +561,8 @@ void CG_ScrollText( const char *str, int iPixelWidth ) // cg.printText[i][ strlen(cg.printText[i])-1 ] = '\0'; // kill the CR i++; - assert (i < (int)ARRAY_LEN( cg.printText ) ); - if (i >= (int)ARRAY_LEN( cg.printText ) ) + assert (i < (int)(sizeof(cg.printText)/sizeof(cg.printText[0])) ); + if (i >= (int)(sizeof(cg.printText)/sizeof(cg.printText[0])) ) { break; } @@ -585,7 +589,7 @@ void CG_ScrollText( const char *str, int iPixelWidth ) cg.printText[i][ psBestLineBreakSrcPos - holds ] = '\0'; holds = s = psBestLineBreakSrcPos; i++; - assert( i < (int)ARRAY_LEN( cg.printText ) ); + assert (i < (int)(sizeof(cg.printText)/sizeof(cg.printText[0])) ); cg.scrollTextLines++; } } @@ -602,7 +606,7 @@ void CG_DrawScrollText(void) { int i; 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 ) { @@ -631,7 +635,7 @@ void CG_DrawScrollText(void) y += fontHeight; continue; } - // or past bottom of screen? + // or past bottom of screen? else if (y > SCREEN_HEIGHT) { break; @@ -641,7 +645,11 @@ void CG_DrawScrollText(void) // if (w) { 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; } } @@ -719,20 +727,20 @@ void CG_DrawCenterString( void ) return; } - color = CG_FadeColor( cg.centerPrintTime, 1000 * cg_centertime.value ); + color = CG_FadeColor( cg.centerPrintTime, 1000 * 3 ); if ( !color ) { return; } if((textcolor_center[0] == 0) && (textcolor_center[1] == 0) && - (textcolor_center[2] == 0) && (textcolor_center[3] == 0)) + (textcolor_center[2] == 0) && (textcolor_center[3] == 0)) { VectorCopy4( colorTable[CT_WHITE], textcolor_center ); } 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; while ( 1 ) { @@ -759,11 +767,14 @@ void CG_DrawCenterString( void ) } 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; - 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; diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp index f7e704b..871131e 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp @@ -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 ) { + if (cg.renderingThirdPerson) + { + CG_CalculateWeaponPosition(origin, angles); + return 1.0f; + } + BG_CalculateVRWeaponPosition(origin, angles); vec3_t offset; diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/g_navigator.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/g_navigator.cpp index 9272935..644321a 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/g_navigator.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/g_navigator.cpp @@ -358,7 +358,7 @@ int CNode::Save( int numNodes, fileHandle_t file ) int i; //Write out the header - unsigned long header = NODE_HEADER_ID; + uint32_t header = NODE_HEADER_ID; gi.FS_Write( &header, sizeof( header ), file ); //Write out the basic information @@ -397,7 +397,7 @@ Load int CNode::Load( int numNodes, fileHandle_t file ) { - unsigned long header; + uint32_t header; int i; 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 ); @@ -578,7 +578,7 @@ bool CNavigator::Load( const char *filename, int checksum ) return false; //Check the header id - long navID = GetLong( file ); + uint32_t navID = GetLong( file ); if ( navID != NAV_HEADER_ID ) { @@ -640,7 +640,7 @@ bool CNavigator::Save( const char *filename, int checksum ) return false; //Write out the header id - unsigned long id = NAV_HEADER_ID; + uint32_t id = NAV_HEADER_ID; gi.FS_Write( &id, sizeof (id), file ); diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/g_navigator.h b/Projects/Android/jni/OpenJK/codeJK2/game/g_navigator.h index a544fcb..5f7d59f 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/g_navigator.h +++ b/Projects/Android/jni/OpenJK/codeJK2/game/g_navigator.h @@ -246,7 +246,7 @@ protected: char GetChar( fileHandle_t file ); int GetInt( fileHandle_t file ); float GetFloat( fileHandle_t file ); - long GetLong( fileHandle_t file ); + uint32_t GetLong( fileHandle_t file ); //void ConnectNodes( void ); void SetEdgeCost( int ID1, int ID2, int cost ); diff --git a/Projects/Android/jni/OpenJK/shared/qcommon/q_math.c b/Projects/Android/jni/OpenJK/shared/qcommon/q_math.c index 47e4fdf..029802c 100644 --- a/Projects/Android/jni/OpenJK/shared/qcommon/q_math.c +++ b/Projects/Android/jni/OpenJK/shared/qcommon/q_math.c @@ -359,6 +359,8 @@ float Com_AbsClamp( float min, float max, float value ) float Q_rsqrt( float number ) { +// return sqrtf( number ); + byteAlias_t t; float x2, y; 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 ) ); // 2nd iteration, this can be removed - assert( !Q_isnan(y) ); + //assert( !Q_isnan(y) ); return y; + } float Q_fabs( float f ) { + //return fabs(f); + byteAlias_t fi; fi.f = f; fi.i &= 0x7FFFFFFF; @@ -675,18 +680,19 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal ) float inv_denom; inv_denom = DotProduct( normal, normal ); - assert( Q_fabs(inv_denom) != 0.0f ); - inv_denom = 1.0f / inv_denom; + if ( Q_fabs(inv_denom) != 0.0f ) { + 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[1] = normal[1] * inv_denom; - n[2] = normal[2] * inv_denom; + n[0] = normal[0] * inv_denom; + n[1] = normal[1] * inv_denom; + n[2] = normal[2] * inv_denom; - dst[0] = p[0] - d * n[0]; - dst[1] = p[1] - d * n[1]; - dst[2] = p[2] - d * n[2]; + dst[0] = p[0] - d * n[0]; + dst[1] = p[1] - d * n[1]; + 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 ) diff --git a/assets/vr_splash.png b/assets/vr_splash.png new file mode 100644 index 0000000..4dce74a Binary files /dev/null and b/assets/vr_splash.png differ diff --git a/assets/weapons_vr_jo.cfg b/assets/weapons_vr_jo.cfg index c37bd0b..dfe9af3 100644 --- a/assets/weapons_vr_jo.cfg +++ b/assets/weapons_vr_jo.cfg @@ -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_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_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_8 "0.67,-9.31,12.49,-7.42,0.50,0.20,0.70" -seta vr_weapon_adjustment_9 "0.70,-5.01,6.81,13.25,0.00,0.00,0.00" +seta vr_weapon_adjustment_8 "1.000,-4.780,8.240,-10.440,0.000,0.000,0.000" +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_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"