summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gfx/2d/numbers/period_32b.tgabin0 -> 412 bytes
-rw-r--r--scripts/core.shader199
-rw-r--r--src/cgame/cg_draw.c60
-rw-r--r--src/cgame/cg_local.h4
-rw-r--r--src/cgame/cg_main.c7
5 files changed, 264 insertions, 6 deletions
diff --git a/gfx/2d/numbers/period_32b.tga b/gfx/2d/numbers/period_32b.tga
new file mode 100644
index 0000000..e49247f
--- /dev/null
+++ b/gfx/2d/numbers/period_32b.tga
Binary files differ
diff --git a/scripts/core.shader b/scripts/core.shader
new file mode 100644
index 0000000..c93d05a
--- /dev/null
+++ b/scripts/core.shader
@@ -0,0 +1,199 @@
+// the REGION shader is generated by the map editor on temporary
+// brushes around a selected area for testing parts of maps
+textures/REGION
+{
+ surfaceparm nolightmap
+}
+
+white
+{
+ {
+ map *white
+ blendfunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+
+outline
+{
+ cull none
+ nopicmip
+ nomipmaps
+ {
+ map gfx/2d/outline.tga
+ blendfunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+
+console
+{
+ nopicmip
+ nomipmaps
+ {
+ map gfx/colors/black.tga
+ }
+}
+
+gfx/misc/detail
+{
+ nopicmip
+ {
+ map gfx/misc/detail.jpg
+ blendFunc GL_DST_COLOR GL_SRC_COLOR
+ rgbgen identity
+ }
+}
+
+// The console font
+gfx/2d/bigchars
+{
+ nopicmip
+ nomipmaps
+ {
+ map gfx/2d/bigchars.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+
+gfx/2d/cursor
+{
+ nopicmip
+ nomipmaps
+ {
+ map gfx/2d/cursor.tga
+ }
+}
+
+// projectionShadow is used for cheap squashed model shadows
+projectionShadow
+{
+ polygonOffset
+ deformVertexes projectionShadow
+ {
+ map *white
+ blendFunc GL_ONE GL_ZERO
+ rgbGen wave square 0 0 0 0
+ }
+}
+
+// blinked on top of lagometer when connection is interrupted
+gfx/2d/net
+{
+ nopicmip
+ {
+ map gfx/2d/net.jpg
+ }
+}
+
+//===============================================================
+
+gfx/2d/numbers/zero_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/zero_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/one_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/one_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/two_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/two_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/three_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/three_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/four_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/four_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/five_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/five_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/six_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/six_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/seven_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/seven_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/eight_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/eight_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/nine_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/nine_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/minus_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/minus_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
+gfx/2d/numbers/period_32b
+{
+ nopicmip
+ {
+ map gfx/2d/numbers/period_32b.tga
+ blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
+ rgbgen vertex
+ }
+}
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index cea2527..d9545b7 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -520,6 +520,59 @@ static void CG_DrawProgressBar( rectDef_t *rect, vec4_t color, float scale,
//=============== TA: was cg_newdraw.c
+static void CG_DrawPlayerEvos( rectDef_t *rect, int value )
+{
+ int fprec, len;
+ char buffer[ 30 ], *p;
+ float evos, x, y, w, h;
+
+ if( cg_drawFractionalEvos.integer < 1 )
+ {
+ fprec = 0;
+ }
+ else if( cg_drawFractionalEvos.integer > 4 )
+ {
+ fprec = 4;
+ }
+ else
+ {
+ fprec = cg_drawFractionalEvos.integer;
+ }
+
+ evos = value / EVO_TO_CREDS_RATE;
+
+ Com_sprintf( buffer, sizeof( buffer ), va( "%%.%df", fprec ), evos );
+ len = strlen( buffer );
+
+ w = rect->w / ( len - 0.5f ); // the dot is half-width
+ h = w * rect->h / rect->w * 1.6f;
+ x = rect->x + 2.0f; // same random offset as in CG_DrawField
+ y = rect->y + (rect->h - h) / 2.0f;
+
+ for( p = buffer; *p; p++ )
+ {
+ int digit;
+ float w2 = w;
+
+ if( *p >= '0' && *p <= '9' )
+ {
+ digit = *p - '0';
+ }
+ else if( *p == '.' )
+ {
+ digit = STAT_PERIOD;
+ w2 /= 2;
+ }
+ else
+ {
+ digit = STAT_MINUS;
+ }
+
+ CG_DrawPic( x, y, w2, h, cgs.media.numberShaders[ digit ] );
+ x += w2;
+ }
+}
+
#define NO_CREDITS_TIME 2000
static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color, qboolean padding )
@@ -541,8 +594,6 @@ static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color, qboolean p
{
if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS )
{
- value = floor( value / EVO_TO_CREDS_RATE );
-
if( !CG_AtHighestClass( ) && cg.time - cg.lastEvolveAttempt <= NO_CREDITS_TIME )
{
if( ( ( cg.time - cg.lastEvolveAttempt ) / 300 ) % 2 )
@@ -552,7 +603,10 @@ static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color, qboolean p
trap_R_SetColor( color );
- if( padding )
+ if( cg_drawFractionalEvos.integer
+ && cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS )
+ CG_DrawPlayerEvos( rect, value );
+ else if( padding )
CG_DrawFieldPadded( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
else
CG_DrawField( rect->x, rect->y, 1, rect->w, rect->h, value );
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index e68e94b..a1ff0a6 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -64,6 +64,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define MAX_MARK_POLYS 256
#define STAT_MINUS 10 // num frame for '-' stats digit
+#define STAT_PERIOD 11
#define ICON_SIZE 48
#define CHAR_WIDTH 32
@@ -1174,7 +1175,7 @@ typedef struct
qhandle_t scannerLineShader;
- qhandle_t numberShaders[ 11 ];
+ qhandle_t numberShaders[ 12 ];
qhandle_t shadowMarkShader;
qhandle_t wakeMarkShader;
@@ -1434,6 +1435,7 @@ extern vmCvar_t cg_teamOverlayUserinfo;
extern vmCvar_t cg_crosshairX;
extern vmCvar_t cg_crosshairY;
extern vmCvar_t cg_drawSpeed;
+extern vmCvar_t cg_drawFractionalEvos;
extern vmCvar_t cg_drawStatus;
extern vmCvar_t cg_draw2D;
extern vmCvar_t cg_animSpeed;
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 36a9577..ce32b0e 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -139,6 +139,7 @@ vmCvar_t cg_drawRewards;
vmCvar_t cg_crosshairX;
vmCvar_t cg_crosshairY;
vmCvar_t cg_drawSpeed;
+vmCvar_t cg_drawFractionalEvos;
vmCvar_t cg_draw2D;
vmCvar_t cg_drawStatus;
vmCvar_t cg_animSpeed;
@@ -285,6 +286,7 @@ static cvarTable_t cvarTable[ ] =
{ &cg_crosshairX, "cg_crosshairX", "0", CVAR_ARCHIVE },
{ &cg_crosshairY, "cg_crosshairY", "0", CVAR_ARCHIVE },
{ &cg_drawSpeed, "cg_drawSpeed", "0", CVAR_ARCHIVE },
+ { &cg_drawFractionalEvos, "cg_drawFractionalEvos", "0", CVAR_ARCHIVE },
{ &cg_brassTime, "cg_brassTime", "2500", CVAR_ARCHIVE },
{ &cg_simpleItems, "cg_simpleItems", "0", CVAR_ARCHIVE },
{ &cg_addMarks, "cg_marks", "1", CVAR_ARCHIVE },
@@ -972,7 +974,7 @@ This function may execute for a couple of minutes with a slow disk.
static void CG_RegisterGraphics( void )
{
int i;
- static char *sb_nums[ 11 ] =
+ static char *sb_nums[ 12 ] =
{
"gfx/2d/numbers/zero_32b",
"gfx/2d/numbers/one_32b",
@@ -985,6 +987,7 @@ static void CG_RegisterGraphics( void )
"gfx/2d/numbers/eight_32b",
"gfx/2d/numbers/nine_32b",
"gfx/2d/numbers/minus_32b",
+ "gfx/2d/numbers/period_32b",
};
static char *buildWeaponTimerPieShaders[ 8 ] =
{
@@ -1005,7 +1008,7 @@ static void CG_RegisterGraphics( void )
trap_R_LoadWorldMap( cgs.mapname );
CG_UpdateMediaFraction( 0.66f );
- for( i = 0; i < 11; i++ )
+ for( i = 0; i < 12; i++ )
cgs.media.numberShaders[ i ] = trap_R_RegisterShader( sb_nums[ i ] );
cgs.media.viewBloodShader = trap_R_RegisterShader( "gfx/damage/fullscreen_painblend" );