summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cgame/cg_buildable.c5
-rw-r--r--src/cgame/cg_draw.c785
-rw-r--r--src/cgame/cg_event.c9
-rw-r--r--src/cgame/cg_local.h26
-rw-r--r--src/cgame/cg_main.c1195
-rw-r--r--src/cgame/cg_servercmds.c21
-rw-r--r--src/cgame/cg_view.c4
-rw-r--r--src/game/bg_lib.c16
-rw-r--r--src/game/bg_lib.h1
-rw-r--r--src/game/bg_pmove.c15
-rw-r--r--src/game/bg_public.h4
-rw-r--r--src/game/g_active.c13
-rw-r--r--src/game/g_client.c4
-rw-r--r--src/game/g_cmds.c10
-rw-r--r--src/game/g_local.h1
-rw-r--r--src/game/g_missile.c38
-rw-r--r--src/game/g_weapon.c57
-rw-r--r--src/ui/ui_main.c139
-rw-r--r--src/ui/ui_shared.c36
-rw-r--r--src/ui/ui_shared.h1
20 files changed, 1375 insertions, 1005 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index 2414ca12..bd337dcc 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -220,6 +220,8 @@ void CG_InitBuildables( )
defaultHumanSounds[ j ] = trap_S_RegisterSound( filename, qfalse );
}
+ cg.buildablesFraction = 0.0f;
+
for( i = BA_NONE + 1; i < BA_NUM_BUILDABLES; i++ )
{
buildableName = BG_FindNameForBuildable( i );
@@ -266,6 +268,9 @@ void CG_InitBuildables( )
}
}
}
+
+ cg.buildablesFraction = (float)i / (float)( BA_NUM_BUILDABLES - 1 );
+ trap_UpdateScreen( );
}
}
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 5b512a0e..1aca9df4 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -205,6 +205,63 @@ void CG_Text_Paint( float x, float y, float scale, vec4_t color, const char *tex
colorBlack[ 3 ] = 1.0;
trap_R_SetColor( newColor );
}
+ else if( style == ITEM_TEXTSTYLE_NEON )
+ {
+ vec4_t glow, outer, inner, white;
+
+ glow[ 0 ] = newColor[ 0 ] * 0.5;
+ glow[ 1 ] = newColor[ 1 ] * 0.5;
+ glow[ 2 ] = newColor[ 2 ] * 0.5;
+ glow[ 3 ] = newColor[ 3 ] * 0.2;
+
+ outer[ 0 ] = newColor[ 0 ];
+ outer[ 1 ] = newColor[ 1 ];
+ outer[ 2 ] = newColor[ 2 ];
+ outer[ 3 ] = newColor[ 3 ];
+
+ inner[ 0 ] = newColor[ 0 ] * 1.5 > 1.0f ? 1.0f : newColor[ 0 ] * 1.5;
+ inner[ 1 ] = newColor[ 1 ] * 1.5 > 1.0f ? 1.0f : newColor[ 1 ] * 1.5;
+ inner[ 2 ] = newColor[ 2 ] * 1.5 > 1.0f ? 1.0f : newColor[ 2 ] * 1.5;
+ inner[ 3 ] = newColor[ 3 ];
+
+ white[ 0 ] = white[ 1 ] = white[ 2 ] = white[ 3 ] = 1.0f;
+
+ trap_R_SetColor( glow );
+ CG_Text_PaintChar( x - 3, y - yadj - 3,
+ glyph->imageWidth + 6,
+ glyph->imageHeight + 6,
+ useScale,
+ glyph->s,
+ glyph->t,
+ glyph->s2,
+ glyph->t2,
+ glyph->glyph );
+
+ trap_R_SetColor( outer );
+ CG_Text_PaintChar( x - 1, y - yadj - 1,
+ glyph->imageWidth + 2,
+ glyph->imageHeight + 2,
+ useScale,
+ glyph->s,
+ glyph->t,
+ glyph->s2,
+ glyph->t2,
+ glyph->glyph );
+
+ trap_R_SetColor( inner );
+ CG_Text_PaintChar( x - 0.5, y - yadj - 0.5,
+ glyph->imageWidth + 1,
+ glyph->imageHeight + 1,
+ useScale,
+ glyph->s,
+ glyph->t,
+ glyph->s2,
+ glyph->t2,
+ glyph->glyph );
+
+ trap_R_SetColor( white );
+ }
+
CG_Text_PaintChar( x, y - yadj,
glyph->imageWidth,
@@ -389,7 +446,21 @@ static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color )
if( cent->currentState.weapon )
{
- BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL, NULL );
+ switch( cent->currentState.weapon )
+ {
+ case WP_ABUILD:
+ case WP_ABUILD2:
+ case WP_HBUILD:
+ case WP_HBUILD2:
+ //percentage of power remaining
+ value = (int)( ( (float)cgs.humanBuildPoints / (float)cgs.humanBuildPointsTotal ) * 100.0f );
+ break;
+
+ default:
+ BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL, NULL );
+ break;
+ }
+
if( value > -1 )
{
trap_R_SetColor( color );
@@ -399,6 +470,8 @@ static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color )
}
}
+#define BUILD_DELAY_TIME 2000
+
static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
{
int value;
@@ -410,7 +483,31 @@ static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
if( cent->currentState.weapon )
{
- BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value, NULL );
+ switch( cent->currentState.weapon )
+ {
+ case WP_ABUILD:
+ case WP_ABUILD2:
+ case WP_HBUILD:
+ case WP_HBUILD2:
+ //remaining build delay
+ value = (int)( ceil( (float)ps->stats[ STAT_MISC ] / 1000.0f ) );
+
+ if( cg.time - cg.lastBuildAttempt <= BUILD_DELAY_TIME )
+ {
+ if( ( cg.time / 300 ) % 2 )
+ {
+ color[ 0 ] = 1.0f;
+ color[ 1 ] = color[ 2 ] = 0.0f;
+ color[ 3 ] = 1.0f;
+ }
+ }
+ break;
+
+ default:
+ BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value, NULL );
+ break;
+ }
+
if( value > -1 )
{
trap_R_SetColor( color );
@@ -434,6 +531,274 @@ static void CG_DrawPlayerHealth( rectDef_t *rect, vec4_t color )
trap_R_SetColor( NULL );
}
+static void CG_DrawProgressBar( rectDef_t *rect, vec4_t color,
+ float scale, int align, int textStyle, float progress )
+{
+ int rimWidth = (int)( rect->h / 20.0f );
+ float doneWidth = ( rect->w - 2 * rimWidth ) * progress;
+ float leftWidth = ( rect->w - 2 * rimWidth ) - doneWidth;
+ float tx, ty, tw, th;
+ char textBuffer[ 8 ];
+
+ if( progress < 0.0f )
+ progress = 0.0f;
+ else if( progress > 1.0f )
+ progress = 1.0f;
+
+ trap_R_SetColor( color );
+
+ //draw rim and bar
+ CG_DrawPic( rect->x, rect->y, rimWidth + doneWidth, rect->h, cgs.media.whiteShader );
+ CG_DrawPic( rimWidth + rect->x + doneWidth, rect->y,
+ leftWidth, rimWidth, cgs.media.whiteShader );
+ CG_DrawPic( rimWidth + rect->x + doneWidth, rect->y + rect->h - rimWidth,
+ leftWidth, rimWidth, cgs.media.whiteShader );
+ CG_DrawPic( rect->x + rect->w - rimWidth, rect->y, rimWidth, rect->h, cgs.media.whiteShader );
+
+ trap_R_SetColor( NULL );
+
+ //draw text
+ Com_sprintf( textBuffer, sizeof( textBuffer ), "%d%%", (int)( progress * 100 ) );
+ tw = CG_Text_Width( textBuffer, scale, 0 );
+ th = scale * 40.0f;
+
+ switch( align )
+ {
+ case ITEM_ALIGN_LEFT:
+ tx = rect->x + ( rect->w / 10.0f );
+ ty = rect->y + ( rect->h / 2.0f ) + ( th / 2.0f );
+ break;
+
+ case ITEM_ALIGN_RIGHT:
+ tx = rect->x + rect->w - ( rect->w / 10.0f ) - tw;
+ ty = rect->y + ( rect->h / 2.0f ) + ( th / 2.0f );
+ break;
+
+ case ITEM_ALIGN_CENTER:
+ tx = rect->x + ( rect->w / 2.0f ) - ( tw / 2.0f );
+ ty = rect->y + ( rect->h / 2.0f ) + ( th / 2.0f );
+ break;
+
+ default:
+ tx = ty = 0.0f;
+ }
+
+ CG_Text_Paint( tx, ty, scale, color, textBuffer, 0, 0, textStyle );
+}
+
+static void CG_DrawProgressLabel( rectDef_t *rect, float text_x, float text_y, vec4_t color,
+ float scale, int align, const char *s, float fraction )
+{
+ vec4_t white = { 1.0f, 1.0f, 1.0f, 1.0f };
+ float tx, tw = CG_Text_Width( s, scale, 0 );
+
+ switch( align )
+ {
+ case ITEM_ALIGN_LEFT:
+ tx = 0.0f;
+ break;
+
+ case ITEM_ALIGN_RIGHT:
+ tx = rect->w - tw;
+ break;
+
+ case ITEM_ALIGN_CENTER:
+ tx = ( rect->w / 2.0f ) - ( tw / 2.0f );
+ break;
+
+ default:
+ tx = 0.0f;
+ }
+
+ if( fraction < 1.0f )
+ CG_Text_Paint( rect->x + text_x + tx, rect->y + text_y, scale, white,
+ s, 0, 0, ITEM_TEXTSTYLE_NORMAL );
+ else
+ CG_Text_Paint( rect->x + text_x + tx, rect->y + text_y, scale, color,
+ s, 0, 0, ITEM_TEXTSTYLE_NEON );
+}
+
+static void CG_DrawMediaProgress( rectDef_t *rect, vec4_t color, float scale, int align, int textStyle )
+{
+ CG_DrawProgressBar( rect, color, scale, align, textStyle, cg.mediaFraction );
+}
+
+static void CG_DrawMediaProgressLabel( rectDef_t *rect, float text_x, float text_y,
+ vec4_t color, float scale, int align )
+{
+ CG_DrawProgressLabel( rect, text_x, text_y, color, scale, align, "Map and Textures", cg.mediaFraction );
+}
+
+static void CG_DrawBuildablesProgress( rectDef_t *rect, vec4_t color, float scale, int align, int textStyle )
+{
+ CG_DrawProgressBar( rect, color, scale, align, textStyle, cg.buildablesFraction );
+}
+
+static void CG_DrawBuildablesProgressLabel( rectDef_t *rect, float text_x, float text_y,
+ vec4_t color, float scale, int align )
+{
+ CG_DrawProgressLabel( rect, text_x, text_y, color, scale, align, "Buildable Models", cg.buildablesFraction );
+}
+
+static void CG_DrawCharModelProgress( rectDef_t *rect, vec4_t color, float scale, int align, int textStyle )
+{
+ CG_DrawProgressBar( rect, color, scale, align, textStyle, cg.charModelFraction );
+}
+
+static void CG_DrawCharModelProgressLabel( rectDef_t *rect, float text_x, float text_y,
+ vec4_t color, float scale, int align )
+{
+ CG_DrawProgressLabel( rect, text_x, text_y, color, scale, align, "Character Models", cg.charModelFraction );
+}
+
+static void CG_DrawOverallProgress( rectDef_t *rect, vec4_t color, float scale, int align, int textStyle )
+{
+ float total;
+
+ total = ( cg.charModelFraction + cg.buildablesFraction + cg.mediaFraction ) / 3.0f;
+ CG_DrawProgressBar( rect, color, scale, align, textStyle, total );
+}
+
+static void CG_DrawLevelShot( rectDef_t *rect )
+{
+ const char *s;
+ const char *info;
+ qhandle_t levelshot;
+ qhandle_t detail;
+
+ info = CG_ConfigString( CS_SERVERINFO );
+ s = Info_ValueForKey( info, "mapname" );
+ levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s.tga", s ) );
+
+ if( !levelshot )
+ levelshot = trap_R_RegisterShaderNoMip( "gfx/2d/load_screen" );
+
+ trap_R_SetColor( NULL );
+ CG_DrawPic( rect->x, rect->y, rect->w, rect->h, levelshot );
+
+ // blend a detail texture over it
+ detail = trap_R_RegisterShader( "levelShotDetail" );
+ CG_DrawPic( rect->x, rect->y, rect->w, rect->h, detail );
+}
+
+static void CG_DrawLoadingString( rectDef_t *rect, float text_x, float text_y, vec4_t color,
+ float scale, int align, int textStyle, const char *s )
+{
+ float tw, th, tx;
+ int pos, i;
+ char buffer[ 1024 ];
+ char *end;
+
+ if( !s[ 0 ] )
+ return;
+
+ strcpy( buffer, s );
+ tw = CG_Text_Width( s, scale, 0 );
+ th = scale * 40.0f;
+
+ pos = i = 0;
+
+ while( pos < strlen( s ) )
+ {
+ strcpy( buffer, &s[ pos ] );
+ tw = CG_Text_Width( buffer, scale, 0 );
+
+ while( tw > rect->w )
+ {
+ end = strrchr( buffer, ' ' );
+
+ if( end == NULL )
+ break;
+
+ *end = '\0';
+ tw = CG_Text_Width( buffer, scale, 0 );
+ }
+
+ switch( align )
+ {
+ case ITEM_ALIGN_LEFT:
+ tx = rect->x;
+ break;
+
+ case ITEM_ALIGN_RIGHT:
+ tx = rect->x + rect->w - tw;
+ break;
+
+ case ITEM_ALIGN_CENTER:
+ tx = rect->x + ( rect->w / 2.0f ) - ( tw / 2.0f );
+ break;
+
+ default:
+ tx = 0.0f;
+ }
+
+ CG_Text_Paint( tx + text_x, rect->y + text_y + i * ( th + 3 ), scale, color,
+ buffer, 0, 0, textStyle );
+
+ pos += strlen( buffer ) + 1;
+ i++;
+ }
+}
+
+static void CG_DrawLevelName( rectDef_t *rect, float text_x, float text_y,
+ vec4_t color, float scale, int align, int textStyle )
+{
+ const char *s;
+
+ s = CG_ConfigString( CS_MESSAGE );
+
+ CG_DrawLoadingString( rect, text_x, text_y, color, scale, align, textStyle, s );
+}
+
+static void CG_DrawMOTD( rectDef_t *rect, float text_x, float text_y,
+ vec4_t color, float scale, int align, int textStyle )
+{
+ const char *s;
+
+ s = CG_ConfigString( CS_MOTD );
+
+ CG_DrawLoadingString( rect, text_x, text_y, color, scale, align, textStyle, s );
+}
+
+static void CG_DrawHostname( rectDef_t *rect, float text_x, float text_y,
+ vec4_t color, float scale, int align, int textStyle )
+{
+ char buffer[ 1024 ];
+ const char *info;
+
+ info = CG_ConfigString( CS_SERVERINFO );
+
+ Q_strncpyz( buffer, Info_ValueForKey( info, "sv_hostname" ), 1024 );
+ Q_CleanStr( buffer );
+
+ CG_DrawLoadingString( rect, text_x, text_y, color, scale, align, textStyle, buffer );
+}
+
+/*
+======================
+CG_UpdateMediaFraction
+
+======================
+*/
+void CG_UpdateMediaFraction( float newFract )
+{
+ cg.mediaFraction = newFract;
+
+ trap_UpdateScreen( );
+}
+
+/*
+====================
+CG_DrawLoadingScreen
+
+Draw all the status / pacifier stuff during level loading
+====================
+*/
+void CG_DrawLoadingScreen( void )
+{
+ Menu_Paint( Menus_FindByName( "Loading" ), qtrue );
+}
+
float CG_GetValue( int ownerDraw )
{
centity_t *cent;
@@ -589,6 +954,80 @@ static void CG_Text_Paint_Limit( float *maxX, float x, float y, float scale,
}
}
+static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, vec4_t color, qhandle_t shader )
+{
+ if( cg.spectatorLen )
+ {
+ float maxX;
+
+ if( cg.spectatorWidth == -1 )
+ {
+ cg.spectatorWidth = 0;
+ cg.spectatorPaintX = rect->x + 1;
+ cg.spectatorPaintX2 = -1;
+ }
+
+ if( cg.spectatorOffset > cg.spectatorLen )
+ {
+ cg.spectatorOffset = 0;
+ cg.spectatorPaintX = rect->x + 1;
+ cg.spectatorPaintX2 = -1;
+ }
+
+ if( cg.time > cg.spectatorTime )
+ {
+ cg.spectatorTime = cg.time + 10;
+
+ if( cg.spectatorPaintX <= rect->x + 2 )
+ {
+ if( cg.spectatorOffset < cg.spectatorLen )
+ {
+ cg.spectatorPaintX += CG_Text_Width( &cg.spectatorList[ cg.spectatorOffset ], scale, 1 ) - 1;
+ cg.spectatorOffset++;
+ }
+ else
+ {
+ cg.spectatorOffset = 0;
+
+ if( cg.spectatorPaintX2 >= 0 )
+ cg.spectatorPaintX = cg.spectatorPaintX2;
+ else
+ cg.spectatorPaintX = rect->x + rect->w - 2;
+
+ cg.spectatorPaintX2 = -1;
+ }
+ }
+ else
+ {
+ cg.spectatorPaintX--;
+
+ if( cg.spectatorPaintX2 >= 0 )
+ cg.spectatorPaintX2--;
+ }
+ }
+
+ maxX = rect->x + rect->w - 2;
+
+ CG_Text_Paint_Limit( &maxX, cg.spectatorPaintX, rect->y + rect->h - 3, scale, color,
+ &cg.spectatorList[ cg.spectatorOffset ], 0, 0 );
+
+ if( cg.spectatorPaintX2 >= 0 )
+ {
+ float maxX2 = rect->x + rect->w - 2;
+ CG_Text_Paint_Limit( &maxX2, cg.spectatorPaintX2, rect->y + rect->h - 3, scale,
+ color, cg.spectatorList, 0, cg.spectatorOffset );
+ }
+
+ if( cg.spectatorOffset && maxX > 0 )
+ {
+ // if we have an offset ( we are skipping the first part of the string ) and we fit the string
+ if( cg.spectatorPaintX2 == -1 )
+ cg.spectatorPaintX2 = rect->x + rect->w - 2;
+ }
+ else
+ cg.spectatorPaintX2 = -1;
+ }
+}
void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
float text_y, int ownerDraw, int ownerDrawFlags,
int align, float special, float scale, vec4_t color,
@@ -642,6 +1081,44 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
case CG_PLAYER_SELECTTEXT:
CG_DrawWeaponSelectText( &rect, scale, textStyle );
break;
+ case CG_SPECTATORS:
+ CG_DrawTeamSpectators( &rect, scale, color, shader );
+ break;
+
+ //loading screen
+ case CG_LOAD_LEVELSHOT:
+ CG_DrawLevelShot( &rect );
+ break;
+ case CG_LOAD_MEDIA:
+ CG_DrawMediaProgress( &rect, color, scale, align, textStyle );
+ break;
+ case CG_LOAD_MEDIA_LABEL:
+ CG_DrawMediaProgressLabel( &rect, text_x, text_y, color, scale, align );
+ break;
+ case CG_LOAD_BUILDABLES:
+ CG_DrawBuildablesProgress( &rect, color, scale, align, textStyle );
+ break;
+ case CG_LOAD_BUILDABLES_LABEL:
+ CG_DrawBuildablesProgressLabel( &rect, text_x, text_y, color, scale, align );
+ break;
+ case CG_LOAD_CHARMODEL:
+ CG_DrawCharModelProgress( &rect, color, scale, align, textStyle );
+ break;
+ case CG_LOAD_CHARMODEL_LABEL:
+ CG_DrawCharModelProgressLabel( &rect, text_x, text_y, color, scale, align );
+ break;
+ case CG_LOAD_OVERALL:
+ CG_DrawOverallProgress( &rect, color, scale, align, textStyle );
+ break;
+ case CG_LOAD_LEVELNAME:
+ CG_DrawLevelName( &rect, text_x, text_y, color, scale, align, textStyle );
+ break;
+ case CG_LOAD_MOTD:
+ CG_DrawMOTD( &rect, text_x, text_y, color, scale, align, textStyle );
+ break;
+ case CG_LOAD_HOSTNAME:
+ CG_DrawHostname( &rect, text_x, text_y, color, scale, align, textStyle );
+ break;
default:
break;
}
@@ -829,253 +1306,6 @@ static void CG_DrawLighting( void )
}
/*
-================
-CG_DrawStatusBar
-
-================
-*/
-/*static void CG_DrawStatusBar( void ) {
- int color;
- centity_t *cent;
- playerState_t *ps;
- int value;
- int ammo, clips, maxclips;
- vec4_t hcolor;
- vec3_t angles;
- vec3_t origin;
- static float colors[4][4] = {
-// { 0.2, 1.0, 0.2, 1.0 } , { 1.0, 0.2, 0.2, 1.0 }, {0.5, 0.5, 0.5, 1} };
- { 0.3f, 0.4f, 0.3f, 1.0f } , // normal
- { 1.0f, 0.2f, 0.2f, 1.0f }, // low health
- {0.2f, 0.3f, 0.2f, 1.0f}, // weapon firing
- { 1.0f, 1.0f, 1.0f, 1.0f } }; // health > 100
-
-
- if ( cg_drawStatus.integer == 0 ) {
- return;
- }
-
- // draw the team background
- CG_DrawTeamBackground( 0, 420, 640, 60, 0.33f, cg.snap->ps.persistant[PERS_TEAM] );
-
- cent = &cg_entities[cg.snap->ps.clientNum];
- ps = &cg.snap->ps;
-
- VectorClear( angles );*/
-
- //TA: stop drawing all these silly 3d models on the hud. Saves space and is more realistic.
-
- // draw any 3D icons first, so the changes back to 2D are minimized
- /*if ( cent->currentState.weapon && cg_weapons[ cent->currentState.weapon ].ammoModel ) {
- origin[0] = 70;
- origin[1] = 0;
- origin[2] = 0;
- angles[YAW] = 90 + 20 * sin( cg.time / 1000.0 );
- CG_Draw3DModel( CHAR_WIDTH*3 + TEXT_ICON_SPACE, 432, ICON_SIZE, ICON_SIZE,
- cg_weapons[ cent->currentState.weapon ].ammoModel, 0, origin, angles );
- }*/
-
- //CG_DrawStatusBarHead( 185 + CHAR_WIDTH*3 + TEXT_ICON_SPACE );
-
- /*if (cg.predictedPlayerState.powerups[PW_REDFLAG])
- CG_DrawStatusBarFlag( 185 + CHAR_WIDTH*3 + TEXT_ICON_SPACE + ICON_SIZE, TEAM_HUMANS);
- else if (cg.predictedPlayerState.powerups[PW_BLUEFLAG])
- CG_DrawStatusBarFlag( 185 + CHAR_WIDTH*3 + TEXT_ICON_SPACE + ICON_SIZE, TEAM_ALIENS);*/
-
- /*if ( ps->stats[ STAT_ARMOR ] ) {
- origin[0] = 90;
- origin[1] = 0;
- origin[2] = -10;
- angles[YAW] = ( cg.time & 2047 ) * 360 / 2048.0;
- CG_Draw3DModel( 370 + CHAR_WIDTH*3 + TEXT_ICON_SPACE, 432, ICON_SIZE, ICON_SIZE,
- cgs.media.armorModel, 0, origin, angles );
- }*/
-
- //
- // ammo
- //
-/* if ( cent->currentState.weapon ) {
- //TA: must mask off clips and maxClips
- if( !BG_FindInfinteAmmoForWeapon( cent->currentState.weapon ) )
- BG_unpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &ammo, &clips, &maxclips );
- else
- ammo = -1;
-
- if ( ammo > -1 ) {
- if ( cg.predictedPlayerState.weaponstate == WEAPON_FIRING
- && cg.predictedPlayerState.weaponTime > 100 ) {
- // draw as dark grey when reloading
- color = 2; // dark grey
- } else {
- if ( ammo >= 0 ) {
- color = 0; // green
- } else {
- color = 1; // red
- }
- }
- trap_R_SetColor( colors[color] );
-
- CG_DrawField( 85, 432, 3, ammo);
-
- if( maxclips )
- CG_DrawField( 20, 432, 1, clips );
-
- trap_R_SetColor( NULL );*/
-
- // if we didn't draw a 3D icon, draw a 2D icon for ammo
- /*if ( !cg_draw3dIcons.integer && cg_drawIcons.integer ) {
- qhandle_t icon;
-
- icon = cg_weapons[ cg.predictedPlayerState.weapon ].ammoIcon;
- if ( icon ) {
- CG_DrawPic( CHAR_WIDTH*3 + TEXT_ICON_SPACE, 432, ICON_SIZE, ICON_SIZE, icon );
- }
- }*/
-/* }
- }
-
- //
- // stamina
- //
- #define STAM_HEIGHT 20
- #define STAM_WIDTH 10
- #define STAM_X 5
- #define STAM_Y 435
- if( ps->stats[ STAT_PTEAM ] == PTE_HUMANS )
- {
- int stamina = ps->stats[ STAT_STAMINA ];
- int height = (int)( (float)stamina / ( 1000 / STAM_HEIGHT ) );
- vec4_t bcolor = { 0.5, 0.5, 0.5, 0.5 };
-
- trap_R_SetColor( bcolor ); // white
- CG_DrawPic( STAM_X, STAM_Y, STAM_WIDTH, STAM_HEIGHT * 2, cgs.media.whiteShader );
-
- if( stamina > 0 )
- {
- trap_R_SetColor( colors[0] ); // green
- CG_DrawPic( STAM_X, STAM_Y + ( STAM_HEIGHT - height ),
- STAM_WIDTH, height, cgs.media.whiteShader );
- }
-
- if( stamina < 0 )
- {
- trap_R_SetColor( colors[1] ); // red
- CG_DrawPic( STAM_X, STAM_Y + STAM_HEIGHT , STAM_WIDTH, -height, cgs.media.whiteShader );
- }
- }
-
- //
- // power
- //
- #define PWR_HEIGHT 10
- #define PWR_WIDTH 80
- #define PWR_X 555
- #define PWR_Y 20
- if( ps->stats[ STAT_PTEAM ] == PTE_HUMANS )
- {
- float total = cgs.humanBuildPointsTotal;
- float allocated = total - cgs.humanBuildPoints;
- float powered = total - cgs.humanBuildPointsPowered;
-
- int awidth = (int)( ( allocated / total ) * PWR_WIDTH );
- int pwidth = (int)( ( powered / total ) * PWR_WIDTH );
- vec4_t bcolor = { 0.5, 0.5, 0.5, 0.5 };
-
- char *s;
- int w;
-
- trap_R_SetColor( bcolor ); // white
- CG_DrawPic( PWR_X, PWR_Y, PWR_WIDTH, PWR_HEIGHT, cgs.media.whiteShader );
-
- trap_R_SetColor( colors[0] ); // green
- CG_DrawPic( PWR_X, PWR_Y, awidth, PWR_HEIGHT, cgs.media.whiteShader );
-
- if( allocated > powered )
- {
- trap_R_SetColor( colors[1] ); // red
- CG_DrawPic( PWR_X + pwidth, PWR_Y, awidth - pwidth, PWR_HEIGHT, cgs.media.whiteShader );
- }
-
- //display amount of credit
- s = va( "%dg", ps->stats[ PERS_CREDIT ] );
- w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
- CG_DrawBigString( 635 - w, 35, s, 1.0F);
- }
-
- //
- // hive
- //
- #define HV_HEIGHT 10
- #define HV_WIDTH 80
- #define HV_X 555
- #define HV_Y 20
- if( ps->stats[ STAT_PTEAM ] == PTE_ALIENS )
- {
- float total = cgs.alienBuildPointsTotal;
- float allocated = total - cgs.alienBuildPoints;
-
- int awidth = (int)( ( allocated / total ) * HV_WIDTH );
- vec4_t bcolor = { 0.5, 0.5, 0.5, 0.5 };
-
- trap_R_SetColor( bcolor ); // white
- CG_DrawPic( HV_X, HV_Y, HV_WIDTH, HV_HEIGHT, cgs.media.whiteShader );
-
- trap_R_SetColor( colors[0] ); // green
- CG_DrawPic( HV_X, HV_Y, awidth, HV_HEIGHT, cgs.media.whiteShader );
- }
-
- //
- // health+armor
- //
- if( ps->stats[ STAT_PTEAM ] == PTE_ALIENS )
- {
- vec4_t fcolor = { 1, 0, 0, 0.5 }; //red half alpha
- vec4_t tcolor = { 0.3, 0.8, 1, 1 }; //cyan no alpha
-
- value = (int)( (float)( (float)ps->stats[STAT_HEALTH] / ps->stats[STAT_MAX_HEALTH] ) * 100 );
-
- CG_DrawFadePic( 20, 0, 30, 440, fcolor, tcolor, value, cgs.media.alienHealth );*/
-
-/* value = (int)( (float)( (float)ps->stats[STAT_ARMOR] / ps->stats[STAT_MAX_HEALTH] ) * 100 );
-
- if( value > 0 )
- CG_DrawFadePic( 580, 0, 30, 440, fcolor, tcolor, value, cgs.media.alienHealth );*/
-/* }
- else
- {
- value = ps->stats[STAT_HEALTH];
- if ( value > 100 ) {
- trap_R_SetColor( colors[0] ); // white
- } else if (value > 25) {
- trap_R_SetColor( colors[0] ); // green
- } else if (value > 0) {
- color = (cg.time >> 8) & 1; // flash
- trap_R_SetColor( colors[color] );
- } else {
- trap_R_SetColor( colors[1] ); // red
- }
-
- // stretch the health up when taking damage
- CG_DrawField ( 300, 432, 3, value);
- CG_ColorForHealth( hcolor );
- trap_R_SetColor( hcolor );
-*/
-/* value = ps->stats[STAT_ARMOR];
- if (value > 0 )
- {
- trap_R_SetColor( colors[0] );
- CG_DrawField (541, 432, 3, value);
- trap_R_SetColor( NULL );
- // if we didn't draw a 3D icon, draw a 2D icon for armor
- if ( !cg_draw3dIcons.integer && cg_drawIcons.integer ) {
- CG_DrawPic( 370 + CHAR_WIDTH*3 + TEXT_ICON_SPACE, 432, ICON_SIZE, ICON_SIZE, cgs.media.armorIcon );
- }
- }*/
-/* }
-
-}*/
-
-/*
===========================================================================================
UPPER RIGHT CORNER
@@ -1828,7 +2058,49 @@ static void CG_DrawTeamVote( void )
static qboolean CG_DrawScoreboard( )
{
- return CG_DrawOldScoreboard( );
+ static qboolean firstTime = qtrue;
+ float fade, *fadeColor;
+
+ if( menuScoreboard )
+ menuScoreboard->window.flags &= ~WINDOW_FORCED;
+
+ if( cg_paused.integer )
+ {
+ cg.deferredPlayerLoading = 0;
+ firstTime = qtrue;
+ return qfalse;
+ }
+
+ if( cg.showScores || cg.predictedPlayerState.pm_type == PM_DEAD ||
+ cg.predictedPlayerState.pm_type == PM_INTERMISSION )
+ {
+ fade = 1.0;
+ fadeColor = colorWhite;
+ }
+ else
+ {
+ cg.deferredPlayerLoading = 0;
+ cg.killerName[ 0 ] = 0;
+ firstTime = qtrue;
+ return qfalse;
+ }
+
+
+ if( menuScoreboard == NULL )
+ menuScoreboard = Menus_FindByName( "teamscore_menu" );
+
+ if( menuScoreboard )
+ {
+ if( firstTime )
+ {
+ CG_SetScoreSelection( menuScoreboard );
+ firstTime = qfalse;
+ }
+
+ Menu_Paint( menuScoreboard, qtrue );
+ }
+
+ return qtrue;
}
/*
@@ -2045,6 +2317,7 @@ static void CG_DrawWarmup( void )
//==================================================================================
+#define SPECTATOR_STRING "SPECTATOR"
/*
=================
CG_Draw2D
@@ -2052,7 +2325,11 @@ CG_Draw2D
*/
static void CG_Draw2D( void )
{
+ vec4_t color;
+ float w;
+ color[ 0 ] = color[ 1 ] = color[ 2 ] = color[ 3 ] = 1.0f;
+
// if we are taking a levelshot for the menu, don't draw anything
if( cg.levelShot )
return;
@@ -2070,7 +2347,10 @@ static void CG_Draw2D( void )
CG_DrawLighting( );
if( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR )
- CG_DrawBigString(320 - 9 * 8, 440, "SPECTATOR", 1.0F);
+ {
+ w = CG_Text_Width( SPECTATOR_STRING, 0.7f, 0 );
+ CG_Text_Paint( 320 - w / 2, 440, 0.7f, color, SPECTATOR_STRING, 0, 0, ITEM_TEXTSTYLE_SHADOWED );
+ }
else if( !( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) &&
!( cg.snap->ps.stats[ STAT_STATE ] & SS_HOVELING ) )
{
@@ -2133,10 +2413,7 @@ void CG_DrawActive( stereoFrame_t stereoView )
// optionally draw the info screen instead
if( !cg.snap )
- {
- CG_DrawInformation( );
return;
- }
// optionally draw the tournement scoreboard instead
if( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR &&
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 8ae10e0c..c6e0417a 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -671,7 +671,7 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
case EV_STEPDN_4:
case EV_STEPDN_8:
case EV_STEPDN_12:
- case EV_STEPDN_16: // smooth out step up transitions
+ case EV_STEPDN_16: // smooth out step down transitions
DEBUGNAME("EV_STEP");
{
float oldStep;
@@ -1124,6 +1124,13 @@ void CG_EntityEvent( centity_t *cent, vec3_t position )
CG_Menu( es->eventParm );
break;
+ case EV_BUILD_DELAY:
+ DEBUGNAME("EV_BUILD_DELAY");
+ //FIXME: change to "negative" sound
+ trap_S_StartLocalSound( cgs.media.hitSound, CHAN_LOCAL_SOUND );
+ cg.lastBuildAttempt = cg.time;
+ break;
+
case EV_PLAYER_RESPAWN:
DEBUGNAME("EV_PLAYER_RESPAWN");
if( es->number == cg.clientNum )
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 77606128..371ea341 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -306,16 +306,6 @@ typedef struct {
int score;
int ping;
int time;
- int scoreFlags;
- int powerUps;
- int accuracy;
- int impressiveCount;
- int excellentCount;
- int guantletCount;
- int defendCount;
- int assistCount;
- int captures;
- qboolean perfect;
int team;
} score_t;
@@ -722,7 +712,13 @@ typedef struct {
int rightMoveTime;
int upMoveTime;
+ float charModelFraction; //TA: loading percentages
+ float mediaFraction;
+ float buildablesFraction;
+
entityPos_t ep;
+
+ int lastBuildAttempt;
} cg_t;
@@ -1384,6 +1380,8 @@ const char *CG_GameTypeString();
qboolean CG_YourTeamHasFlag();
qboolean CG_OtherTeamHasFlag();
qhandle_t CG_StatusHandle(int task);
+void CG_DrawLoadingScreen( void );
+void CG_UpdateMediaFraction( float newFract );
//
// cg_player.c
@@ -1572,14 +1570,6 @@ void CG_ClearTrails( void );
void CG_ProcessSnapshots( void );
//
-// cg_info.c
-//
-void CG_LoadingString( const char *s );
-void CG_LoadingItem( int itemNum );
-void CG_LoadingClient( int clientNum );
-void CG_DrawInformation( void );
-
-//
// cg_scoreboard.c
//
qboolean CG_DrawOldScoreboard( void );
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 4e771b77..8f0d1b04 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -55,8 +55,8 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a
CG_KeyEvent(arg0, arg1);
return 0;
case CG_MOUSE_EVENT:
- cgDC.cursorx = cgs.cursorX;
- cgDC.cursory = cgs.cursorY;
+ cgDC.cursorx = cgs.cursorX;
+ cgDC.cursory = cgs.cursorY;
CG_MouseEvent(arg0, arg1);
return 0;
case CG_EVENT_HANDLING:
@@ -184,7 +184,7 @@ vmCvar_t cg_wwSmoothTime;
vmCvar_t cg_wwFollow;
vmCvar_t cg_zsortLEs;
-//TA: hack to get class an carriage through to UI module
+//TA: hack to get class and carriage through to UI module
vmCvar_t ui_currentClass;
vmCvar_t ui_carriage;
vmCvar_t ui_stages;
@@ -682,13 +682,9 @@ static void CG_RegisterGraphics( void ) {
memset( &cg.refdef, 0, sizeof( cg.refdef ) );
trap_R_ClearScene();
- CG_LoadingString( cgs.mapname );
-
trap_R_LoadWorldMap( cgs.mapname );
-
- // precache status bar pics
- CG_LoadingString( "game media" );
-
+ CG_UpdateMediaFraction( 0.66f );
+
for ( i=0 ; i<11 ; i++) {
cgs.media.numberShaders[i] = trap_R_RegisterShader( sb_nums[i] );
}
@@ -716,7 +712,6 @@ static void CG_RegisterGraphics( void ) {
cgs.media.lagometerShader = trap_R_RegisterShader("lagometer" );
cgs.media.connectionShader = trap_R_RegisterShader( "disconnected" );
-
//TA: extra stuff
cgs.media.explosionShader = trap_R_RegisterShader( "grenadeExplosion" );
cgs.media.greenBloodTrailShader = trap_R_RegisterShader( "greenBloodTrail" );
@@ -726,7 +721,7 @@ static void CG_RegisterGraphics( void ) {
for( i = 0; i < 32; i++ )
cgs.media.flameShader[ i ] = trap_R_RegisterShader( va( "fireball%d", i + 1 ) );
-
+
/*cgs.media.creepShader = trap_R_RegisterShader( "creep" );*/
cgs.media.scannerBlipShader = trap_R_RegisterShader( "gfx/2d/droidhealth" );
@@ -758,30 +753,6 @@ static void CG_RegisterGraphics( void ) {
cgs.media.regenShader = trap_R_RegisterShader("powerups/regen" );
cgs.media.hastePuffShader = trap_R_RegisterShader("hasteSmokePuff" );
- if ( cgs.gametype == GT_CTF || cg_buildScript.integer ) {
- cgs.media.redCubeModel = trap_R_RegisterModel( "models/powerups/orb/r_orb.md3" );
- cgs.media.blueCubeModel = trap_R_RegisterModel( "models/powerups/orb/b_orb.md3" );
- cgs.media.redCubeIcon = trap_R_RegisterShader( "icons/skull_red" );
- cgs.media.blueCubeIcon = trap_R_RegisterShader( "icons/skull_blue" );
- }
-
- if ( cgs.gametype == GT_CTF || cg_buildScript.integer ) {
- cgs.media.redFlagModel = trap_R_RegisterModel( "models/flags/r_flag.md3" );
- cgs.media.blueFlagModel = trap_R_RegisterModel( "models/flags/b_flag.md3" );
- cgs.media.redFlagShader[0] = trap_R_RegisterShaderNoMip( "icons/iconf_red1" );
- cgs.media.redFlagShader[1] = trap_R_RegisterShaderNoMip( "icons/iconf_red2" );
- cgs.media.redFlagShader[2] = trap_R_RegisterShaderNoMip( "icons/iconf_red3" );
- cgs.media.blueFlagShader[0] = trap_R_RegisterShaderNoMip( "icons/iconf_blu1" );
- cgs.media.blueFlagShader[1] = trap_R_RegisterShaderNoMip( "icons/iconf_blu2" );
- cgs.media.blueFlagShader[2] = trap_R_RegisterShaderNoMip( "icons/iconf_blu3" );
- }
-
- if ( cgs.gametype >= GT_TEAM || cg_buildScript.integer ) {
- cgs.media.friendShader = trap_R_RegisterShader( "sprites/foe" );
- cgs.media.redQuadShader = trap_R_RegisterShader("powerups/blueflag" );
- cgs.media.teamStatusBar = trap_R_RegisterShader( "gfx/2d/colorbar.tga" );
- }
-
//TA: screenfades
cgs.media.humanNV = trap_R_RegisterShader( "humanNV" );
cgs.media.humanTorch8 = trap_R_RegisterShader( "humanTorch8" );
@@ -842,6 +813,7 @@ static void CG_RegisterGraphics( void ) {
cgs.media.medalAssist = trap_R_RegisterShaderNoMip( "medal_assist" );
cgs.media.medalCapture = trap_R_RegisterShaderNoMip( "medal_capture" );
+ CG_UpdateMediaFraction( 0.7f );
memset( cg_items, 0, sizeof( cg_items ) );
memset( cg_weapons, 0, sizeof( cg_weapons ) );
@@ -885,6 +857,8 @@ static void CG_RegisterGraphics( void ) {
cgs.gameModels[i] = trap_R_RegisterModel( modelName );
}
+ CG_UpdateMediaFraction( 0.8f );
+
// register all the server specified shaders
for (i=1 ; i<MAX_SHADERS ; i++) {
const char *shaderName;
@@ -908,7 +882,7 @@ void CG_BuildSpectatorString() {
int i;
cg.spectatorList[0] = 0;
for (i = 0; i < MAX_CLIENTS; i++) {
- if (cgs.clientinfo[i].infoValid && cgs.clientinfo[i].team == TEAM_SPECTATOR ) {
+ if (cgs.clientinfo[i].infoValid && cgs.clientinfo[i].team == PTE_NONE ) {
Q_strcat(cg.spectatorList, sizeof(cg.spectatorList), va("%s ", cgs.clientinfo[i].name));
}
}
@@ -927,19 +901,25 @@ CG_RegisterClients
===================
*/
-static void CG_RegisterClients( void ) {
+static void CG_RegisterClients( void )
+{
int i;
+ cg.charModelFraction = 0.0f;
+
//precache all the models/sounds/etc
- for ( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ ) {
+ for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
+ {
const char *clientInfo;
clientInfo = CG_ConfigString( CS_PRECACHES + i );
if ( !clientInfo[0] )
continue;
- CG_LoadingClient( i );
CG_PrecacheClientInfo( i );
+
+ cg.charModelFraction = (float)i / (float)( PCL_NUM_CLASSES - 1 );
+ trap_UpdateScreen( );
}
//load all the clientinfos of clients already connected to the server
@@ -998,535 +978,511 @@ void CG_StartMusic( void ) {
// ==============================
//
char *CG_GetMenuBuffer(const char *filename) {
- int len;
- fileHandle_t f;
- static char buf[MAX_MENUFILE];
-
- len = trap_FS_FOpenFile( filename, &f, FS_READ );
- if ( !f ) {
- trap_Print( va( S_COLOR_RED "menu file not found: %s, using default\n", filename ) );
- return NULL;
- }
- if ( len >= MAX_MENUFILE ) {
- trap_Print( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i", filename, len, MAX_MENUFILE ) );
- trap_FS_FCloseFile( f );
- return NULL;
- }
-
- trap_FS_Read( buf, len, f );
- buf[len] = 0;
- trap_FS_FCloseFile( f );
-
- return buf;
+ int len;
+ fileHandle_t f;
+ static char buf[MAX_MENUFILE];
+
+ len = trap_FS_FOpenFile( filename, &f, FS_READ );
+ if ( !f ) {
+ trap_Print( va( S_COLOR_RED "menu file not found: %s, using default\n", filename ) );
+ return NULL;
+ }
+ if ( len >= MAX_MENUFILE ) {
+ trap_Print( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i", filename, len, MAX_MENUFILE ) );
+ trap_FS_FCloseFile( f );
+ return NULL;
+ }
+
+ trap_FS_Read( buf, len, f );
+ buf[len] = 0;
+ trap_FS_FCloseFile( f );
+
+ return buf;
}
qboolean CG_Asset_Parse(int handle) {
- pc_token_t token;
- const char *tempStr;
-
- if (!trap_PC_ReadToken(handle, &token))
- return qfalse;
- if (Q_stricmp(token.string, "{") != 0) {
- return qfalse;
- }
+ pc_token_t token;
+ const char *tempStr;
+
+ if (!trap_PC_ReadToken(handle, &token))
+ return qfalse;
+ if (Q_stricmp(token.string, "{") != 0) {
+ return qfalse;
+ }
- while ( 1 ) {
- if (!trap_PC_ReadToken(handle, &token))
- return qfalse;
-
- if (Q_stricmp(token.string, "}") == 0) {
- return qtrue;
- }
-
- // font
- if (Q_stricmp(token.string, "font") == 0) {
- int pointSize;
- if (!PC_String_Parse(handle, &tempStr) || !PC_Int_Parse(handle, &pointSize)) {
- return qfalse;
- }
- cgDC.registerFont(tempStr, pointSize, &cgDC.Assets.textFont);
- continue;
- }
-
- // smallFont
- if (Q_stricmp(token.string, "smallFont") == 0) {
- int pointSize;
- if (!PC_String_Parse(handle, &tempStr) || !PC_Int_Parse(handle, &pointSize)) {
- return qfalse;
- }
- cgDC.registerFont(tempStr, pointSize, &cgDC.Assets.smallFont);
- continue;
- }
-
- // font
- if (Q_stricmp(token.string, "bigfont") == 0) {
- int pointSize;
- if (!PC_String_Parse(handle, &tempStr) || !PC_Int_Parse(handle, &pointSize)) {
- return qfalse;
- }
- cgDC.registerFont(tempStr, pointSize, &cgDC.Assets.bigFont);
- continue;
- }
-
- // gradientbar
- if (Q_stricmp(token.string, "gradientbar") == 0) {
- if (!PC_String_Parse(handle, &tempStr)) {
- return qfalse;
- }
- cgDC.Assets.gradientBar = trap_R_RegisterShaderNoMip(tempStr);
- continue;
- }
-
- // enterMenuSound
- if (Q_stricmp(token.string, "menuEnterSound") == 0) {
- if (!PC_String_Parse(handle, &tempStr)) {
- return qfalse;
- }
- cgDC.Assets.menuEnterSound = trap_S_RegisterSound( tempStr, qfalse );
- continue;
- }
-
- // exitMenuSound
- if (Q_stricmp(token.string, "menuExitSound") == 0) {
- if (!PC_String_Parse(handle, &tempStr)) {
- return qfalse;
- }
- cgDC.Assets.menuExitSound = trap_S_RegisterSound( tempStr, qfalse );
- continue;
- }
-
- // itemFocusSound
- if (Q_stricmp(token.string, "itemFocusSound") == 0) {
- if (!PC_String_Parse(handle, &tempStr)) {
- return qfalse;
- }
- cgDC.Assets.itemFocusSound = trap_S_RegisterSound( tempStr, qfalse );
- continue;
- }
-
- // menuBuzzSound
- if (Q_stricmp(token.string, "menuBuzzSound") == 0) {
- if (!PC_String_Parse(handle, &tempStr)) {
- return qfalse;
- }
- cgDC.Assets.menuBuzzSound = trap_S_RegisterSound( tempStr, qfalse );
- continue;
- }
-
- if (Q_stricmp(token.string, "cursor") == 0) {
- if (!PC_String_Parse(handle, &cgDC.Assets.cursorStr)) {
- return qfalse;
- }
- cgDC.Assets.cursor = trap_R_RegisterShaderNoMip( cgDC.Assets.cursorStr);
- continue;
- }
-
- if (Q_stricmp(token.string, "fadeClamp") == 0) {
- if (!PC_Float_Parse(handle, &cgDC.Assets.fadeClamp)) {
- return qfalse;
- }
- continue;
- }
-
- if (Q_stricmp(token.string, "fadeCycle") == 0) {
- if (!PC_Int_Parse(handle, &cgDC.Assets.fadeCycle)) {
- return qfalse;
- }
- continue;
- }
-
- if (Q_stricmp(token.string, "fadeAmount") == 0) {
- if (!PC_Float_Parse(handle, &cgDC.Assets.fadeAmount)) {
- return qfalse;
- }
- continue;
- }
-
- if (Q_stricmp(token.string, "shadowX") == 0) {
- if (!PC_Float_Parse(handle, &cgDC.Assets.shadowX)) {
- return qfalse;
- }
- continue;
- }
-
- if (Q_stricmp(token.string, "shadowY") == 0) {
- if (!PC_Float_Parse(handle, &cgDC.Assets.shadowY)) {
- return qfalse;
- }
- continue;
- }
-
- if (Q_stricmp(token.string, "shadowColor") == 0) {
- if (!PC_Color_Parse(handle, &cgDC.Assets.shadowColor)) {
- return qfalse;
- }
- cgDC.Assets.shadowFadeClamp = cgDC.Assets.shadowColor[3];
- continue;
- }
- }
- return qfalse; // bk001204 - why not?
+ while ( 1 ) {
+ if (!trap_PC_ReadToken(handle, &token))
+ return qfalse;
+
+ if (Q_stricmp(token.string, "}") == 0) {
+ return qtrue;
+ }
+
+ // font
+ if (Q_stricmp(token.string, "font") == 0) {
+ int pointSize;
+ if (!PC_String_Parse(handle, &tempStr) || !PC_Int_Parse(handle, &pointSize)) {
+ return qfalse;
+ }
+ cgDC.registerFont(tempStr, pointSize, &cgDC.Assets.textFont);
+ continue;
+ }
+
+ // smallFont
+ if (Q_stricmp(token.string, "smallFont") == 0) {
+ int pointSize;
+ if (!PC_String_Parse(handle, &tempStr) || !PC_Int_Parse(handle, &pointSize)) {
+ return qfalse;
+ }
+ cgDC.registerFont(tempStr, pointSize, &cgDC.Assets.smallFont);
+ continue;
+ }
+
+ // font
+ if (Q_stricmp(token.string, "bigfont") == 0) {
+ int pointSize;
+ if (!PC_String_Parse(handle, &tempStr) || !PC_Int_Parse(handle, &pointSize)) {
+ return qfalse;
+ }
+ cgDC.registerFont(tempStr, pointSize, &cgDC.Assets.bigFont);
+ continue;
+ }
+
+ // gradientbar
+ if (Q_stricmp(token.string, "gradientbar") == 0) {
+ if (!PC_String_Parse(handle, &tempStr)) {
+ return qfalse;
+ }
+ cgDC.Assets.gradientBar = trap_R_RegisterShaderNoMip(tempStr);
+ continue;
+ }
+
+ // enterMenuSound
+ if (Q_stricmp(token.string, "menuEnterSound") == 0) {
+ if (!PC_String_Parse(handle, &tempStr)) {
+ return qfalse;
+ }
+ cgDC.Assets.menuEnterSound = trap_S_RegisterSound( tempStr, qfalse );
+ continue;
+ }
+
+ // exitMenuSound
+ if (Q_stricmp(token.string, "menuExitSound") == 0) {
+ if (!PC_String_Parse(handle, &tempStr)) {
+ return qfalse;
+ }
+ cgDC.Assets.menuExitSound = trap_S_RegisterSound( tempStr, qfalse );
+ continue;
+ }
+
+ // itemFocusSound
+ if (Q_stricmp(token.string, "itemFocusSound") == 0) {
+ if (!PC_String_Parse(handle, &tempStr)) {
+ return qfalse;
+ }
+ cgDC.Assets.itemFocusSound = trap_S_RegisterSound( tempStr, qfalse );
+ continue;
+ }
+
+ // menuBuzzSound
+ if (Q_stricmp(token.string, "menuBuzzSound") == 0) {
+ if (!PC_String_Parse(handle, &tempStr)) {
+ return qfalse;
+ }
+ cgDC.Assets.menuBuzzSound = trap_S_RegisterSound( tempStr, qfalse );
+ continue;
+ }
+
+ if (Q_stricmp(token.string, "cursor") == 0) {
+ if (!PC_String_Parse(handle, &cgDC.Assets.cursorStr)) {
+ return qfalse;
+ }
+ cgDC.Assets.cursor = trap_R_RegisterShaderNoMip( cgDC.Assets.cursorStr);
+ continue;
+ }
+
+ if (Q_stricmp(token.string, "fadeClamp") == 0) {
+ if (!PC_Float_Parse(handle, &cgDC.Assets.fadeClamp)) {
+ return qfalse;
+ }
+ continue;
+ }
+
+ if (Q_stricmp(token.string, "fadeCycle") == 0) {
+ if (!PC_Int_Parse(handle, &cgDC.Assets.fadeCycle)) {
+ return qfalse;
+ }
+ continue;
+ }
+
+ if (Q_stricmp(token.string, "fadeAmount") == 0) {
+ if (!PC_Float_Parse(handle, &cgDC.Assets.fadeAmount)) {
+ return qfalse;
+ }
+ continue;
+ }
+
+ if (Q_stricmp(token.string, "shadowX") == 0) {
+ if (!PC_Float_Parse(handle, &cgDC.Assets.shadowX)) {
+ return qfalse;
+ }
+ continue;
+ }
+
+ if (Q_stricmp(token.string, "shadowY") == 0) {
+ if (!PC_Float_Parse(handle, &cgDC.Assets.shadowY)) {
+ return qfalse;
+ }
+ continue;
+ }
+
+ if (Q_stricmp(token.string, "shadowColor") == 0) {
+ if (!PC_Color_Parse(handle, &cgDC.Assets.shadowColor)) {
+ return qfalse;
+ }
+ cgDC.Assets.shadowFadeClamp = cgDC.Assets.shadowColor[3];
+ continue;
+ }
+ }
+ return qfalse; // bk001204 - why not?
}
void CG_ParseMenu(const char *menuFile) {
- pc_token_t token;
- int handle;
-
- handle = trap_PC_LoadSource(menuFile);
- if (!handle)
- handle = trap_PC_LoadSource("ui/testhud.menu");
- if (!handle)
- return;
-
- while ( 1 ) {
- if (!trap_PC_ReadToken( handle, &token )) {
- break;
- }
-
- //if ( Q_stricmp( token, "{" ) ) {
- // Com_Printf( "Missing { in menu file\n" );
- // break;
- //}
-
- //if ( menuCount == MAX_MENUS ) {
- // Com_Printf( "Too many menus!\n" );
- // break;
- //}
-
- if ( token.string[0] == '}' ) {
- break;
- }
-
- if (Q_stricmp(token.string, "assetGlobalDef") == 0) {
- if (CG_Asset_Parse(handle)) {
- continue;
- } else {
- break;
- }
- }
-
-
- if (Q_stricmp(token.string, "menudef") == 0) {
- // start a new menu
- Menu_New(handle);
- }
- }
- trap_PC_FreeSource(handle);
+ pc_token_t token;
+ int handle;
+
+ handle = trap_PC_LoadSource(menuFile);
+ if (!handle)
+ handle = trap_PC_LoadSource("ui/testhud.menu");
+ if (!handle)
+ return;
+
+ while ( 1 ) {
+ if (!trap_PC_ReadToken( handle, &token )) {
+ break;
+ }
+
+ //if ( Q_stricmp( token, "{" ) ) {
+ // Com_Printf( "Missing { in menu file\n" );
+ // break;
+ //}
+
+ //if ( menuCount == MAX_MENUS ) {
+ // Com_Printf( "Too many menus!\n" );
+ // break;
+ //}
+
+ if ( token.string[0] == '}' ) {
+ break;
+ }
+
+ if (Q_stricmp(token.string, "assetGlobalDef") == 0) {
+ if (CG_Asset_Parse(handle)) {
+ continue;
+ } else {
+ break;
+ }
+ }
+
+
+ if (Q_stricmp(token.string, "menudef") == 0) {
+ // start a new menu
+ Menu_New(handle);
+ }
+ }
+ trap_PC_FreeSource(handle);
}
qboolean CG_Load_Menu(char **p) {
- char *token;
+ char *token;
- token = COM_ParseExt(p, qtrue);
+ token = COM_ParseExt(p, qtrue);
- if (token[0] != '{') {
- return qfalse;
- }
+ if (token[0] != '{') {
+ return qfalse;
+ }
- while ( 1 ) {
+ while ( 1 ) {
- token = COM_ParseExt(p, qtrue);
+ token = COM_ParseExt(p, qtrue);
- if (Q_stricmp(token, "}") == 0) {
- return qtrue;
- }
+ if (Q_stricmp(token, "}") == 0) {
+ return qtrue;
+ }
- if ( !token || token[0] == 0 ) {
- return qfalse;
- }
+ if ( !token || token[0] == 0 ) {
+ return qfalse;
+ }
- CG_ParseMenu(token);
- }
- return qfalse;
+ CG_ParseMenu(token);
+ }
+ return qfalse;
}
void CG_LoadMenus(const char *menuFile) {
- char *token;
- char *p;
- int len, start;
- fileHandle_t f;
- static char buf[MAX_MENUDEFFILE];
-
- start = trap_Milliseconds();
-
- len = trap_FS_FOpenFile( menuFile, &f, FS_READ );
- if ( !f ) {
- trap_Error( va( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ) );
- len = trap_FS_FOpenFile( "ui/hud.txt", &f, FS_READ );
- if (!f) {
- trap_Error( va( S_COLOR_RED "default menu file not found: ui/hud.txt, unable to continue!\n", menuFile ) );
- }
- }
-
- if ( len >= MAX_MENUDEFFILE ) {
- trap_Error( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i", menuFile, len, MAX_MENUDEFFILE ) );
- trap_FS_FCloseFile( f );
- return;
- }
-
- trap_FS_Read( buf, len, f );
- buf[len] = 0;
- trap_FS_FCloseFile( f );
-
- COM_Compress(buf);
-
- Menu_Reset();
-
- p = buf;
-
- while ( 1 ) {
- token = COM_ParseExt( &p, qtrue );
- if( !token || token[0] == 0 || token[0] == '}') {
- break;
- }
-
- //if ( Q_stricmp( token, "{" ) ) {
- // Com_Printf( "Missing { in menu file\n" );
- // break;
- //}
-
- //if ( menuCount == MAX_MENUS ) {
- // Com_Printf( "Too many menus!\n" );
- // break;
- //}
-
- if ( Q_stricmp( token, "}" ) == 0 ) {
- break;
- }
-
- if (Q_stricmp(token, "loadmenu") == 0) {
- if (CG_Load_Menu(&p)) {
- continue;
- } else {
- break;
- }
- }
- }
-
- Com_Printf("UI menu load time = %d milli seconds\n", trap_Milliseconds() - start);
+ char *token;
+ char *p;
+ int len, start;
+ fileHandle_t f;
+ static char buf[MAX_MENUDEFFILE];
+
+ start = trap_Milliseconds();
+
+ len = trap_FS_FOpenFile( menuFile, &f, FS_READ );
+ if ( !f ) {
+ trap_Error( va( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ) );
+ len = trap_FS_FOpenFile( "ui/hud.txt", &f, FS_READ );
+ if (!f) {
+ trap_Error( va( S_COLOR_RED "default menu file not found: ui/hud.txt, unable to continue!\n", menuFile ) );
+ }
+ }
+
+ if ( len >= MAX_MENUDEFFILE ) {
+ trap_Error( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i", menuFile, len, MAX_MENUDEFFILE ) );
+ trap_FS_FCloseFile( f );
+ return;
+ }
+
+ trap_FS_Read( buf, len, f );
+ buf[len] = 0;
+ trap_FS_FCloseFile( f );
+
+ COM_Compress(buf);
+
+ Menu_Reset();
+
+ p = buf;
+
+ while ( 1 ) {
+ token = COM_ParseExt( &p, qtrue );
+ if( !token || token[0] == 0 || token[0] == '}') {
+ break;
+ }
+
+ //if ( Q_stricmp( token, "{" ) ) {
+ // Com_Printf( "Missing { in menu file\n" );
+ // break;
+ //}
+
+ //if ( menuCount == MAX_MENUS ) {
+ // Com_Printf( "Too many menus!\n" );
+ // break;
+ //}
+
+ if ( Q_stricmp( token, "}" ) == 0 ) {
+ break;
+ }
+
+ if (Q_stricmp(token, "loadmenu") == 0) {
+ if (CG_Load_Menu(&p)) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ }
+
+ Com_Printf("UI menu load time = %d milli seconds\n", trap_Milliseconds() - start);
}
static qboolean CG_OwnerDrawHandleKey(int ownerDraw, int flags, float *special, int key) {
- return qfalse;
+ return qfalse;
}
-static int CG_FeederCount(float feederID) {
- int i, count;
- count = 0;
-/* if (feederID == FEEDER_REDTEAM_LIST) {
- for (i = 0; i < cg.numScores; i++) {
- if (cg.scores[i].team == TEAM_RED) {
- count++;
- }
- }
- } else if (feederID == FEEDER_BLUETEAM_LIST) {
- for (i = 0; i < cg.numScores; i++) {
- if (cg.scores[i].team == TEAM_BLUE) {
- count++;
- }
- }
- } else if (feederID == FEEDER_SCOREBOARD) {
- return cg.numScores;
- }*/
- return count;
+static int CG_FeederCount( float feederID )
+{
+ int i, count = 0;
+
+ if( feederID == FEEDER_ALIENTEAM_LIST )
+ {
+ for( i = 0; i < cg.numScores; i++ )
+ {
+ if( cg.scores[ i ].team == PTE_ALIENS )
+ count++;
+ }
+ }
+ else if( feederID == FEEDER_HUMANTEAM_LIST )
+ {
+ for( i = 0; i < cg.numScores; i++ )
+ {
+ if( cg.scores[ i ].team == PTE_HUMANS )
+ count++;
+ }
+ }
+
+ return count;
}
-void CG_SetScoreSelection(void *p) {
- menuDef_t *menu = (menuDef_t*)p;
- playerState_t *ps = &cg.snap->ps;
- int i, red, blue;
- red = blue = 0;
-/* for (i = 0; i < cg.numScores; i++) {
- if (cg.scores[i].team == TEAM_RED) {
- red++;
- } else if (cg.scores[i].team == TEAM_BLUE) {
- blue++;
- }
- if (ps->clientNum == cg.scores[i].client) {
- cg.selectedScore = i;
- }
- }*/
-
- if (menu == NULL) {
- // just interested in setting the selected score
- return;
- }
-
- if ( cgs.gametype >= GT_TEAM ) {
- int feeder = FEEDER_REDTEAM_LIST;
- i = red;
-/* if (cg.scores[cg.selectedScore].team == TEAM_BLUE) {
- feeder = FEEDER_BLUETEAM_LIST;
- i = blue;
- }*/
- Menu_SetFeederSelection(menu, feeder, i, NULL);
- } else {
- Menu_SetFeederSelection(menu, FEEDER_SCOREBOARD, cg.selectedScore, NULL);
- }
+void CG_SetScoreSelection( void *p )
+{
+ menuDef_t *menu = (menuDef_t*)p;
+ playerState_t *ps = &cg.snap->ps;
+ int i, alien, human;
+ int feeder;
+
+ alien = human = 0;
+
+ for( i = 0; i < cg.numScores; i++ )
+ {
+ if( cg.scores[ i ].team == PTE_ALIENS )
+ alien++;
+ else if( cg.scores[ i ].team == PTE_HUMANS )
+ human++;
+
+ if( ps->clientNum == cg.scores[ i ].client )
+ cg.selectedScore = i;
+ }
+
+ if( menu == NULL )
+ // just interested in setting the selected score
+ return;
+
+ feeder = FEEDER_ALIENTEAM_LIST;
+ i = alien;
+
+ if( cg.scores[ cg.selectedScore ].team == PTE_HUMANS )
+ {
+ feeder = FEEDER_HUMANTEAM_LIST;
+ i = human;
+ }
+
+ Menu_SetFeederSelection(menu, feeder, i, NULL);
}
// FIXME: might need to cache this info
-static clientInfo_t * CG_InfoFromScoreIndex(int index, int team, int *scoreIndex) {
- int i, count;
- if ( cgs.gametype >= GT_TEAM ) {
- count = 0;
- for (i = 0; i < cg.numScores; i++) {
- if (cg.scores[i].team == team) {
- if (count == index) {
- *scoreIndex = i;
- return &cgs.clientinfo[cg.scores[i].client];
- }
- count++;
- }
- }
- }
- *scoreIndex = index;
- return &cgs.clientinfo[ cg.scores[index].client ];
+static clientInfo_t * CG_InfoFromScoreIndex( int index, int team, int *scoreIndex )
+{
+ int i, count;
+ count = 0;
+
+ for( i = 0; i < cg.numScores; i++ )
+ {
+ if( cg.scores[ i ].team == team )
+ {
+ if( count == index )
+ {
+ *scoreIndex = i;
+ return &cgs.clientinfo[ cg.scores[ i ].client ];
+ }
+ count++;
+ }
+ }
+
+ *scoreIndex = index;
+ return &cgs.clientinfo[ cg.scores[ index ].client ];
}
-static const char *CG_FeederItemText(float feederID, int index, int column, qhandle_t *handle) {
- gitem_t *item;
- int scoreIndex = 0;
- clientInfo_t *info = NULL;
- int team = -1;
- score_t *sp = NULL;
-
- *handle = -1;
-
- if (feederID == FEEDER_REDTEAM_LIST) {
- /*team = TEAM_RED;*/
- } else if (feederID == FEEDER_BLUETEAM_LIST) {
- /*team = TEAM_BLUE;*/
- }
-
- info = CG_InfoFromScoreIndex(index, team, &scoreIndex);
- sp = &cg.scores[scoreIndex];
-
- if (info && info->infoValid) {
- switch (column) {
- case 0:
-/* if ( info->powerups & ( 1 << PW_NEUTRALFLAG ) ) {
- item = BG_FindItemForPowerup( PW_NEUTRALFLAG );
- *handle = cg_items[ ITEM_INDEX(item) ].icon;
- } else if ( info->powerups & ( 1 << PW_REDFLAG ) ) {
- item = BG_FindItemForPowerup( PW_REDFLAG );
- *handle = cg_items[ ITEM_INDEX(item) ].icon;
- } else if ( info->powerups & ( 1 << PW_BLUEFLAG ) ) {
- item = BG_FindItemForPowerup( PW_BLUEFLAG );
- *handle = cg_items[ ITEM_INDEX(item) ].icon;
- } else {
- if ( info->botSkill > 0 && info->botSkill <= 5 ) {
- *handle = cgs.media.botSkillShaders[ info->botSkill - 1 ];
- } else if ( info->handicap < 100 ) {
- return va("%i", info->handicap );
- }
- }*/
- break;
- case 1:
- if (team == -1) {
- return "";
- } else {
- /**handle = CG_StatusHandle(info->teamTask);*/
- }
- break;
- case 2:
-/* if ( cg.snap->ps.stats[ STAT_CLIENTS_READY ] & ( 1 << sp->client ) ) {
- return "Ready";
- }
- if (team == -1) {
- if (cgs.gametype == GT_TOURNAMENT) {
- return va("%i/%i", info->wins, info->losses);
- } else if (info->infoValid && info->team == TEAM_SPECTATOR ) {
- return "Spectator";
- } else {
- return "";
- }
- } else {
- if (info->teamLeader) {
- return "Leader";
- }
- }*/
- break;
- case 3:
- return info->name;
- break;
- case 4:
- return va("%i", info->score);
- break;
- case 5:
- return va("%4i", sp->time);
- break;
- case 6:
- if ( sp->ping == -1 ) {
- return "connecting";
- }
- return va("%4i", sp->ping);
- break;
- }
- }
-
- return "";
+static const char *CG_FeederItemText( float feederID, int index, int column, qhandle_t *handle )
+{
+ gitem_t *item;
+ int scoreIndex = 0;
+ clientInfo_t *info = NULL;
+ int team = -1;
+ score_t *sp = NULL;
+
+ *handle = -1;
+
+ if( feederID == FEEDER_ALIENTEAM_LIST )
+ team = PTE_ALIENS;
+ else if( feederID == FEEDER_HUMANTEAM_LIST )
+ team = PTE_HUMANS;
+
+ info = CG_InfoFromScoreIndex( index, team, &scoreIndex );
+ sp = &cg.scores[ scoreIndex ];
+
+ if( info && info->infoValid )
+ {
+ switch( column )
+ {
+ case 0:
+ if( atoi( CG_ConfigString( CS_CLIENTS_READY ) ) & ( 1 << sp->client ) )
+ return "Ready";
+ break;
+
+ case 1:
+ return info->name;
+ break;
+
+ case 2:
+ return va( "%d", info->score );
+ break;
+
+ case 3:
+ return va( "%4d", sp->time );
+ break;
+
+ case 4:
+ if( sp->ping == -1 )
+ return "connecting";
+
+ return va( "%4d", sp->ping );
+ break;
+ }
+ }
+
+ return "";
}
static qhandle_t CG_FeederItemImage(float feederID, int index) {
- return 0;
+ return 0;
}
-static void CG_FeederSelection(float feederID, int index) {
-/* if ( cgs.gametype >= GT_TEAM ) {
- int i, count;
- int team = (feederID == FEEDER_REDTEAM_LIST) ? TEAM_RED : TEAM_BLUE;
- count = 0;
- for (i = 0; i < cg.numScores; i++) {
- if (cg.scores[i].team == team) {
- if (index == count) {
- cg.selectedScore = i;
- }
- count++;
- }
- }
- } else {
- cg.selectedScore = index;
- }*/
+static void CG_FeederSelection( float feederID, int index )
+{
+ int i, count;
+ int team = ( feederID == FEEDER_ALIENTEAM_LIST ) ? PTE_ALIENS : PTE_HUMANS;
+ count = 0;
+
+ for( i = 0; i < cg.numScores; i++ )
+ {
+ if( cg.scores[ i ].team == team )
+ {
+ if( index == count )
+ cg.selectedScore = i;
+
+ count++;
+ }
+ }
}
static float CG_Cvar_Get(const char *cvar) {
- char buff[128];
- memset(buff, 0, sizeof(buff));
- trap_Cvar_VariableStringBuffer(cvar, buff, sizeof(buff));
- return atof(buff);
+ char buff[128];
+ memset(buff, 0, sizeof(buff));
+ trap_Cvar_VariableStringBuffer(cvar, buff, sizeof(buff));
+ return atof(buff);
}
void CG_Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const char *text, int cursorPos, char cursor, int limit, int style) {
- CG_Text_Paint(x, y, scale, color, text, 0, limit, style);
+ CG_Text_Paint(x, y, scale, color, text, 0, limit, style);
}
static int CG_OwnerDrawWidth(int ownerDraw, float scale) {
- switch (ownerDraw) {
-/* case CG_GAME_TYPE:
- return CG_Text_Width(CG_GameTypeString(), scale, 0);*/
-/* case CG_GAME_STATUS:
- return CG_Text_Width(CG_GetGameStatusText(), scale, 0);
- break;*/
- case CG_KILLER:
- return CG_Text_Width(CG_GetKillerText(), scale, 0);
- break;
-/* case CG_RED_NAME:
- return CG_Text_Width(cg_redTeamName.string, scale, 0);
- break;
- case CG_BLUE_NAME:
- return CG_Text_Width(cg_blueTeamName.string, scale, 0);
- break;*/
-
-
- }
- return 0;
+ switch (ownerDraw) {
+/* case CG_GAME_TYPE:
+ return CG_Text_Width(CG_GameTypeString(), scale, 0);*/
+/* case CG_GAME_STATUS:
+ return CG_Text_Width(CG_GetGameStatusText(), scale, 0);
+ break;*/
+ case CG_KILLER:
+ return CG_Text_Width(CG_GetKillerText(), scale, 0);
+ break;
+/* case CG_RED_NAME:
+ return CG_Text_Width(cg_redTeamName.string, scale, 0);
+ break;
+ case CG_BLUE_NAME:
+ return CG_Text_Width(cg_blueTeamName.string, scale, 0);
+ break;*/
+
+
+ }
+ return 0;
}
static int CG_PlayCinematic(const char *name, float x, float y, float w, float h) {
@@ -1553,95 +1509,95 @@ CG_LoadHudMenu();
=================
*/
void CG_LoadHudMenu() {
- char buff[1024];
- const char *hudSet;
-
- cgDC.registerShaderNoMip = &trap_R_RegisterShaderNoMip;
- cgDC.setColor = &trap_R_SetColor;
- cgDC.drawHandlePic = &CG_DrawPic;
- cgDC.drawStretchPic = &trap_R_DrawStretchPic;
- cgDC.drawText = &CG_Text_Paint;
- cgDC.textWidth = &CG_Text_Width;
- cgDC.textHeight = &CG_Text_Height;
- cgDC.registerModel = &trap_R_RegisterModel;
- cgDC.modelBounds = &trap_R_ModelBounds;
- cgDC.fillRect = &CG_FillRect;
- cgDC.drawRect = &CG_DrawRect;
- cgDC.drawSides = &CG_DrawSides;
- cgDC.drawTopBottom = &CG_DrawTopBottom;
- cgDC.clearScene = &trap_R_ClearScene;
- cgDC.addRefEntityToScene = &trap_R_AddRefEntityToScene;
- cgDC.renderScene = &trap_R_RenderScene;
- cgDC.registerFont = &trap_R_RegisterFont;
- cgDC.ownerDrawItem = &CG_OwnerDraw;
- cgDC.getValue = &CG_GetValue;
- cgDC.ownerDrawVisible = NULL; //&CG_OwnerDrawVisible;
- cgDC.runScript = &CG_RunMenuScript;
- cgDC.getTeamColor = &CG_GetTeamColor;
- cgDC.setCVar = trap_Cvar_Set;
- cgDC.getCVarString = trap_Cvar_VariableStringBuffer;
- cgDC.getCVarValue = CG_Cvar_Get;
- cgDC.drawTextWithCursor = &CG_Text_PaintWithCursor;
- //cgDC.setOverstrikeMode = &trap_Key_SetOverstrikeMode;
- //cgDC.getOverstrikeMode = &trap_Key_GetOverstrikeMode;
- cgDC.startLocalSound = &trap_S_StartLocalSound;
- cgDC.ownerDrawHandleKey = &CG_OwnerDrawHandleKey;
- cgDC.feederCount = &CG_FeederCount;
- cgDC.feederItemImage = &CG_FeederItemImage;
- cgDC.feederItemText = &CG_FeederItemText;
- cgDC.feederSelection = &CG_FeederSelection;
- //cgDC.setBinding = &trap_Key_SetBinding;
- //cgDC.getBindingBuf = &trap_Key_GetBindingBuf;
- //cgDC.keynumToStringBuf = &trap_Key_KeynumToStringBuf;
- //cgDC.executeText = &trap_Cmd_ExecuteText;
- cgDC.Error = &Com_Error;
- cgDC.Print = &Com_Printf;
- cgDC.ownerDrawWidth = &CG_OwnerDrawWidth;
- //cgDC.Pause = &CG_Pause;
- cgDC.registerSound = &trap_S_RegisterSound;
- cgDC.startBackgroundTrack = &trap_S_StartBackgroundTrack;
- cgDC.stopBackgroundTrack = &trap_S_StopBackgroundTrack;
- cgDC.playCinematic = &CG_PlayCinematic;
- cgDC.stopCinematic = &CG_StopCinematic;
- cgDC.drawCinematic = &CG_DrawCinematic;
- cgDC.runCinematicFrame = &CG_RunCinematicFrame;
-
- Init_Display(&cgDC);
-
- Menu_Reset();
-
- trap_Cvar_VariableStringBuffer("cg_hudFiles", buff, sizeof(buff));
- hudSet = buff;
- if (hudSet[0] == '\0') {
- hudSet = "ui/hud.txt";
- }
-
- CG_LoadMenus(hudSet);
+ char buff[1024];
+ const char *hudSet;
+
+ cgDC.registerShaderNoMip = &trap_R_RegisterShaderNoMip;
+ cgDC.setColor = &trap_R_SetColor;
+ cgDC.drawHandlePic = &CG_DrawPic;
+ cgDC.drawStretchPic = &trap_R_DrawStretchPic;
+ cgDC.drawText = &CG_Text_Paint;
+ cgDC.textWidth = &CG_Text_Width;
+ cgDC.textHeight = &CG_Text_Height;
+ cgDC.registerModel = &trap_R_RegisterModel;
+ cgDC.modelBounds = &trap_R_ModelBounds;
+ cgDC.fillRect = &CG_FillRect;
+ cgDC.drawRect = &CG_DrawRect;
+ cgDC.drawSides = &CG_DrawSides;
+ cgDC.drawTopBottom = &CG_DrawTopBottom;
+ cgDC.clearScene = &trap_R_ClearScene;
+ cgDC.addRefEntityToScene = &trap_R_AddRefEntityToScene;
+ cgDC.renderScene = &trap_R_RenderScene;
+ cgDC.registerFont = &trap_R_RegisterFont;
+ cgDC.ownerDrawItem = &CG_OwnerDraw;
+ cgDC.getValue = &CG_GetValue;
+ cgDC.ownerDrawVisible = NULL; //&CG_OwnerDrawVisible;
+ cgDC.runScript = &CG_RunMenuScript;
+ cgDC.getTeamColor = &CG_GetTeamColor;
+ cgDC.setCVar = trap_Cvar_Set;
+ cgDC.getCVarString = trap_Cvar_VariableStringBuffer;
+ cgDC.getCVarValue = CG_Cvar_Get;
+ cgDC.drawTextWithCursor = &CG_Text_PaintWithCursor;
+ //cgDC.setOverstrikeMode = &trap_Key_SetOverstrikeMode;
+ //cgDC.getOverstrikeMode = &trap_Key_GetOverstrikeMode;
+ cgDC.startLocalSound = &trap_S_StartLocalSound;
+ cgDC.ownerDrawHandleKey = &CG_OwnerDrawHandleKey;
+ cgDC.feederCount = &CG_FeederCount;
+ cgDC.feederItemImage = &CG_FeederItemImage;
+ cgDC.feederItemText = &CG_FeederItemText;
+ cgDC.feederSelection = &CG_FeederSelection;
+ //cgDC.setBinding = &trap_Key_SetBinding;
+ //cgDC.getBindingBuf = &trap_Key_GetBindingBuf;
+ //cgDC.keynumToStringBuf = &trap_Key_KeynumToStringBuf;
+ //cgDC.executeText = &trap_Cmd_ExecuteText;
+ cgDC.Error = &Com_Error;
+ cgDC.Print = &Com_Printf;
+ cgDC.ownerDrawWidth = &CG_OwnerDrawWidth;
+ //cgDC.Pause = &CG_Pause;
+ cgDC.registerSound = &trap_S_RegisterSound;
+ cgDC.startBackgroundTrack = &trap_S_StartBackgroundTrack;
+ cgDC.stopBackgroundTrack = &trap_S_StopBackgroundTrack;
+ cgDC.playCinematic = &CG_PlayCinematic;
+ cgDC.stopCinematic = &CG_StopCinematic;
+ cgDC.drawCinematic = &CG_DrawCinematic;
+ cgDC.runCinematicFrame = &CG_RunCinematicFrame;
+
+ Init_Display(&cgDC);
+
+ Menu_Reset();
+
+ trap_Cvar_VariableStringBuffer("cg_hudFiles", buff, sizeof(buff));
+ hudSet = buff;
+ if (hudSet[0] == '\0') {
+ hudSet = "ui/hud.txt";
+ }
+
+ CG_LoadMenus(hudSet);
}
void CG_AssetCache() {
- //if (Assets.textFont == NULL) {
- // trap_R_RegisterFont("fonts/arial.ttf", 72, &Assets.textFont);
- //}
- //Assets.background = trap_R_RegisterShaderNoMip( ASSET_BACKGROUND );
- //Com_Printf("Menu Size: %i bytes\n", sizeof(Menus));
- cgDC.Assets.gradientBar = trap_R_RegisterShaderNoMip( ASSET_GRADIENTBAR );
- cgDC.Assets.fxBasePic = trap_R_RegisterShaderNoMip( ART_FX_BASE );
- cgDC.Assets.fxPic[0] = trap_R_RegisterShaderNoMip( ART_FX_RED );
- cgDC.Assets.fxPic[1] = trap_R_RegisterShaderNoMip( ART_FX_YELLOW );
- cgDC.Assets.fxPic[2] = trap_R_RegisterShaderNoMip( ART_FX_GREEN );
- cgDC.Assets.fxPic[3] = trap_R_RegisterShaderNoMip( ART_FX_TEAL );
- cgDC.Assets.fxPic[4] = trap_R_RegisterShaderNoMip( ART_FX_BLUE );
- cgDC.Assets.fxPic[5] = trap_R_RegisterShaderNoMip( ART_FX_CYAN );
- cgDC.Assets.fxPic[6] = trap_R_RegisterShaderNoMip( ART_FX_WHITE );
- cgDC.Assets.scrollBar = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR );
- cgDC.Assets.scrollBarArrowDown = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWDOWN );
- cgDC.Assets.scrollBarArrowUp = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWUP );
- cgDC.Assets.scrollBarArrowLeft = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWLEFT );
- cgDC.Assets.scrollBarArrowRight = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWRIGHT );
- cgDC.Assets.scrollBarThumb = trap_R_RegisterShaderNoMip( ASSET_SCROLL_THUMB );
- cgDC.Assets.sliderBar = trap_R_RegisterShaderNoMip( ASSET_SLIDER_BAR );
- cgDC.Assets.sliderThumb = trap_R_RegisterShaderNoMip( ASSET_SLIDER_THUMB );
+ //if (Assets.textFont == NULL) {
+ // trap_R_RegisterFont("fonts/arial.ttf", 72, &Assets.textFont);
+ //}
+ //Assets.background = trap_R_RegisterShaderNoMip( ASSET_BACKGROUND );
+ //Com_Printf("Menu Size: %i bytes\n", sizeof(Menus));
+ cgDC.Assets.gradientBar = trap_R_RegisterShaderNoMip( ASSET_GRADIENTBAR );
+ cgDC.Assets.fxBasePic = trap_R_RegisterShaderNoMip( ART_FX_BASE );
+ cgDC.Assets.fxPic[0] = trap_R_RegisterShaderNoMip( ART_FX_RED );
+ cgDC.Assets.fxPic[1] = trap_R_RegisterShaderNoMip( ART_FX_YELLOW );
+ cgDC.Assets.fxPic[2] = trap_R_RegisterShaderNoMip( ART_FX_GREEN );
+ cgDC.Assets.fxPic[3] = trap_R_RegisterShaderNoMip( ART_FX_TEAL );
+ cgDC.Assets.fxPic[4] = trap_R_RegisterShaderNoMip( ART_FX_BLUE );
+ cgDC.Assets.fxPic[5] = trap_R_RegisterShaderNoMip( ART_FX_CYAN );
+ cgDC.Assets.fxPic[6] = trap_R_RegisterShaderNoMip( ART_FX_WHITE );
+ cgDC.Assets.scrollBar = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR );
+ cgDC.Assets.scrollBarArrowDown = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWDOWN );
+ cgDC.Assets.scrollBarArrowUp = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWUP );
+ cgDC.Assets.scrollBarArrowLeft = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWLEFT );
+ cgDC.Assets.scrollBarArrowRight = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWRIGHT );
+ cgDC.Assets.scrollBarThumb = trap_R_RegisterShaderNoMip( ASSET_SCROLL_THUMB );
+ cgDC.Assets.sliderBar = trap_R_RegisterShaderNoMip( ASSET_SLIDER_BAR );
+ cgDC.Assets.sliderThumb = trap_R_RegisterShaderNoMip( ASSET_SLIDER_THUMB );
}
//TA: FIXME: preliminary integration of CG TA UI stuff
@@ -1680,6 +1636,13 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) {
CG_RegisterCvars();
CG_InitConsoleCommands();
+
+ //TA: moved up for LoadHudMenu
+ String_Init();
+
+ //TA: FIXME: TA UI
+ CG_AssetCache();
+ CG_LoadHudMenu(); // load new hud stuff
//cg.weaponSelect = WP_MACHINEGUN;
//TA: if it does weird things, this is why:
@@ -1709,35 +1672,25 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) {
CG_ParseServerinfo();
// load the new map
- CG_LoadingString( "collision map" );
-
trap_CM_LoadMap( cgs.mapname );
- String_Init();
-
cg.loading = qtrue; // force players to load instead of defer
- CG_LoadingString( "sounds" );
-
- CG_RegisterSounds();
-
- CG_LoadingString( "graphics" );
+ CG_RegisterSounds( );
+ CG_UpdateMediaFraction( 0.33f );
- CG_RegisterGraphics();
-
- //TA:
- CG_InitBuildables( );
+ CG_RegisterGraphics( );
+ CG_UpdateMediaFraction( 0.90f );
CG_InitWeapons( );
+ CG_UpdateMediaFraction( 0.95f );
CG_InitUpgrades( );
-
- CG_LoadingString( "clients" );
+ CG_UpdateMediaFraction( 1.0f );
+
+ //TA:
+ CG_InitBuildables( );
CG_RegisterClients(); // if low on memory, some clients will be deferred
- //TA: FIXME: TA UI
- CG_AssetCache();
- CG_LoadHudMenu(); // load new hud stuff
-
cg.loading = qfalse; // future players will be deferred
CG_InitLocalEntities();
@@ -1752,8 +1705,6 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum ) {
CG_StartMusic();
- CG_LoadingString( "" );
-
CG_ShaderStateChanged();
trap_S_ClearLoopingSounds( qtrue );
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index 6843c217..b676c536 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -61,20 +61,10 @@ static void CG_ParseScores( void ) {
memset( cg.scores, 0, sizeof( cg.scores ) );
for ( i = 0 ; i < cg.numScores ; i++ ) {
//
- cg.scores[i].client = atoi( CG_Argv( i * 14 + 4 ) );
- cg.scores[i].score = atoi( CG_Argv( i * 14 + 5 ) );
- cg.scores[i].ping = atoi( CG_Argv( i * 14 + 6 ) );
- cg.scores[i].time = atoi( CG_Argv( i * 14 + 7 ) );
- cg.scores[i].scoreFlags = atoi( CG_Argv( i * 14 + 8 ) );
- powerups = atoi( CG_Argv( i * 14 + 9 ) );
- cg.scores[i].accuracy = atoi(CG_Argv(i * 14 + 10));
- cg.scores[i].impressiveCount = atoi(CG_Argv(i * 14 + 11));
- cg.scores[i].excellentCount = atoi(CG_Argv(i * 14 + 12));
- cg.scores[i].guantletCount = atoi(CG_Argv(i * 14 + 13));
- cg.scores[i].defendCount = atoi(CG_Argv(i * 14 + 14));
- cg.scores[i].assistCount = atoi(CG_Argv(i * 14 + 15));
- cg.scores[i].perfect = atoi(CG_Argv(i * 14 + 16));
- cg.scores[i].captures = atoi(CG_Argv(i * 14 + 17));
+ cg.scores[i].client = atoi( CG_Argv( i * 4 + 4 ) );
+ cg.scores[i].score = atoi( CG_Argv( i * 4 + 5 ) );
+ cg.scores[i].ping = atoi( CG_Argv( i * 4 + 6 ) );
+ cg.scores[i].time = atoi( CG_Argv( i * 4 + 7 ) );
if ( cg.scores[i].client < 0 || cg.scores[i].client >= MAX_CLIENTS ) {
cg.scores[i].client = 0;
@@ -83,8 +73,7 @@ static void CG_ParseScores( void ) {
cgs.clientinfo[ cg.scores[i].client ].powerups = powerups;
cg.scores[i].team = cgs.clientinfo[cg.scores[i].client].team;
- }
-
+ }
}
/*
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
index 4d63074f..6d434eab 100644
--- a/src/cgame/cg_view.c
+++ b/src/cgame/cg_view.c
@@ -1107,7 +1107,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo
// if we are only updating the screen as a loading
// pacifier, don't even try to read snapshots
if ( cg.infoScreenText[0] != 0 ) {
- CG_DrawInformation();
+ CG_DrawLoadingScreen( );
return;
}
@@ -1124,7 +1124,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo
// if we haven't received any snapshots yet, all
// we can draw is the information screen
if ( !cg.snap || ( cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE ) ) {
- CG_DrawInformation();
+ CG_DrawLoadingScreen( );
return;
}
diff --git a/src/game/bg_lib.c b/src/game/bg_lib.c
index 7041aa39..cd241f77 100644
--- a/src/game/bg_lib.c
+++ b/src/game/bg_lib.c
@@ -256,6 +256,22 @@ int strcmp( const char *string1, const char *string2 ) {
return *string1 - *string2;
}
+//TA:
+char *strrchr( const char *string, int c )
+{
+ int i, length = strlen( string );
+ char *p;
+
+ for( i = length - 1; i >= 0; i-- )
+ {
+ p = (char *)&string[ i ];
+
+ if( *p == c )
+ return (char *)p;
+ }
+
+ return (char *)0;
+}
char *strchr( const char *string, int c ) {
while ( *string ) {
diff --git a/src/game/bg_lib.h b/src/game/bg_lib.h
index 55fc25a0..b651c9a6 100644
--- a/src/game/bg_lib.h
+++ b/src/game/bg_lib.h
@@ -51,6 +51,7 @@ char *strcat( char *strDestination, const char *strSource );
char *strcpy( char *strDestination, const char *strSource );
int strcmp( const char *string1, const char *string2 );
char *strchr( const char *string, int c );
+char *strrchr( const char *string, int c );
char *strstr( const char *string, const char *strCharSet );
char *strncpy( char *strDest, const char *strSource, size_t count );
int tolower( int c );
diff --git a/src/game/bg_pmove.c b/src/game/bg_pmove.c
index 18fa084c..40399dd7 100644
--- a/src/game/bg_pmove.c
+++ b/src/game/bg_pmove.c
@@ -2286,21 +2286,6 @@ static void PM_Weapon( void )
}
break;
- case WP_GRAB_CLAW:
- attack1 = pm->cmd.buttons & BUTTON_ATTACK;
-
- //secondary attack is only permitted if target is in range
- if( pm->autoWeaponHit[ pm->ps->weapon ] )
- attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
-
- if( !attack1 && !attack2 )
- {
- pm->ps->weaponTime = 0;
- pm->ps->weaponstate = WEAPON_READY;
- return;
- }
- break;
-
case WP_LUCIFER_CANON:
attack1 = pm->cmd.buttons & BUTTON_ATTACK;
attack2 = pm->cmd.buttons & BUTTON_ATTACK2;
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index c474357e..3d9be4b9 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -576,8 +576,8 @@ typedef enum {
EV_TAUNT_GUARDBASE,
EV_TAUNT_PATROL,
- EV_MENU //TA: menu event
-
+ EV_MENU, //TA: menu event
+ EV_BUILD_DELAY //TA: can't build yet
} entity_event_t;
typedef enum
diff --git a/src/game/g_active.c b/src/game/g_active.c
index 89c45cf7..d423ca74 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -509,8 +509,6 @@ void ClientTimerActions( gentity_t *ent, int msec )
client->ps.stats[ STAT_MISC ] = ammo * LC_TOTAL_CHARGE / 10;
}
-#define LAUNCH_TIME 2000
-
switch( client->ps.weapon )
{
case WP_ABUILD:
@@ -529,6 +527,13 @@ void ClientTimerActions( gentity_t *ent, int msec )
else
client->ps.stats[ STAT_BUILDABLE ] &= ~SB_VALID_TOGGLEBIT;
}
+
+ //update build timer
+ if( client->ps.stats[ STAT_MISC ] > 0 )
+ client->ps.stats[ STAT_MISC ] -= 100;
+
+ if( client->ps.stats[ STAT_MISC ] < 0 )
+ client->ps.stats[ STAT_MISC ] = 0;
break;
default:
@@ -971,10 +976,6 @@ void ClientThink_real( gentity_t *ent ) {
pm.autoWeaponHit[ WP_VENOM ] = CheckVenomAttack( ent );
break;
- case WP_GRAB_CLAW:
- pm.autoWeaponHit[ WP_GRAB_CLAW ] = CheckGrabAttack( ent );
- break;
-
case WP_POUNCE:
if( client->ps.weaponTime <= 0 )
pm.autoWeaponHit[ WP_POUNCE ] = CheckPounceAttack( ent );
diff --git a/src/game/g_client.c b/src/game/g_client.c
index 46850044..942aba66 100644
--- a/src/game/g_client.c
+++ b/src/game/g_client.c
@@ -1100,12 +1100,12 @@ void ClientUserinfoChanged( int clientNum ) {
// print scoreboards, display models, and play custom sounds
if ( ent->r.svFlags & SVF_BOT ) {
s = va("n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\skill\\%s\\tt\\%d\\tl\\%d",
- client->pers.netname, client->sess.sessionTeam, model, model, c1, c2,
+ client->pers.netname, client->ps.stats[ STAT_PTEAM ], model, model, c1, c2,
client->pers.maxHealth, client->sess.wins, client->sess.losses,
Info_ValueForKey( userinfo, "skill" ), teamTask, teamLeader );
} else {
s = va("n\\%s\\t\\%i\\model\\%s\\hmodel\\%s\\g_redteam\\%s\\g_blueteam\\%s\\c1\\%s\\c2\\%s\\hc\\%i\\w\\%i\\l\\%i\\tt\\%d\\tl\\%d",
- client->pers.netname, client->sess.sessionTeam, model, model, redTeam, blueTeam, c1, c2,
+ client->pers.netname, client->ps.stats[ STAT_PTEAM ], model, model, redTeam, blueTeam, c1, c2,
client->pers.maxHealth, client->sess.wins, client->sess.losses, teamTask, teamLeader);
}
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 9cadf288..c4c63f2d 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -31,12 +31,10 @@ void DeathmatchScoreboardMessage( gentity_t *ent ) {
int i, j;
gclient_t *cl;
int numSorted;
- int scoreFlags;
// send the latest information on all clients
string[0] = 0;
stringlength = 0;
- scoreFlags = 0;
numSorted = level.numConnectedClients;
@@ -51,9 +49,8 @@ void DeathmatchScoreboardMessage( gentity_t *ent ) {
ping = cl->ps.ping < 999 ? cl->ps.ping : 999;
}
Com_sprintf (entry, sizeof(entry),
- " %i %i %i %i %i %i", level.sortedClients[i],
- cl->ps.persistant[PERS_SCORE], ping, (level.time - cl->pers.enterTime)/60000,
- scoreFlags, g_entities[level.sortedClients[i]].s.powerups);
+ " %i %i %i %i", level.sortedClients[i],
+ cl->ps.persistant[PERS_SCORE], ping, (level.time - cl->pers.enterTime)/60000 );
j = strlen(entry);
if (stringlength + j > 1024)
break;
@@ -634,6 +631,9 @@ void Cmd_Team_f( gentity_t *ent )
ClientSpawn( ent, NULL );
}
+ //update ClientInfo
+ ClientUserinfoChanged( ent->client->ps.clientNum );
+
//FIXME: put some team change broadcast code here.
}
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 2125291c..c163b20f 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -629,6 +629,7 @@ gentity_t *fire_luciferCanon( gentity_t *self, vec3_t start, vec3_t dir, int dam
gentity_t *fire_grenade( gentity_t *self, vec3_t start, vec3_t aimdir );
gentity_t *fire_rocket( gentity_t *self, vec3_t start, vec3_t dir );
gentity_t *fire_lockblob( gentity_t *self, vec3_t start, vec3_t dir );
+gentity_t *fire_paraLockBlob( gentity_t *self, vec3_t start, vec3_t dir );
gentity_t *fire_bfg( gentity_t *self, vec3_t start, vec3_t dir );
gentity_t *fire_grapple( gentity_t *self, vec3_t start, vec3_t dir );
diff --git a/src/game/g_missile.c b/src/game/g_missile.c
index bbbf07cd..b885a628 100644
--- a/src/game/g_missile.c
+++ b/src/game/g_missile.c
@@ -404,6 +404,7 @@ gentity_t *fire_luciferCanon( gentity_t *self, vec3_t start, vec3_t dir, int dam
}
//=============================================================================
+
/*
=================
fire_lockblob
@@ -442,3 +443,40 @@ gentity_t *fire_lockblob( gentity_t *self, vec3_t start, vec3_t dir )
return bolt;
}
+/*
+=================
+fire_paraLockBlob
+=================
+*/
+gentity_t *fire_paraLockBlob( gentity_t *self, vec3_t start, vec3_t dir )
+{
+ gentity_t *bolt;
+
+ VectorNormalize ( dir );
+
+ bolt = G_Spawn( );
+ bolt->classname = "lockblob";
+ bolt->nextthink = level.time + 15000;
+ bolt->think = G_ExplodeMissile;
+ bolt->s.eType = ET_MISSILE;
+ bolt->r.svFlags = SVF_USE_CURRENT_ORIGIN;
+ bolt->s.weapon = WP_LOCKBLOB_LAUNCHER;
+ bolt->r.ownerNum = self->s.number;
+ bolt->parent = self;
+ bolt->damage = 0;
+ bolt->splashDamage = 0;
+ bolt->splashRadius = 0;
+ bolt->methodOfDeath = MOD_ROCKET;
+ bolt->splashMethodOfDeath = MOD_ROCKET_SPLASH;
+ bolt->clipmask = MASK_SHOT;
+ bolt->target_ent = NULL;
+
+ bolt->s.pos.trType = TR_GRAVITY;
+ bolt->s.pos.trTime = level.time - MISSILE_PRESTEP_TIME; // move a bit on the very first frame
+ VectorCopy( start, bolt->s.pos.trBase );
+ VectorScale( dir, 800, bolt->s.pos.trDelta );
+ SnapVector( bolt->s.pos.trDelta ); // save net bandwidth
+ VectorCopy (start, bolt->r.currentOrigin);
+
+ return bolt;
+}
diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c
index f75a33d6..3b65ddb6 100644
--- a/src/game/g_weapon.c
+++ b/src/game/g_weapon.c
@@ -411,12 +411,19 @@ void cancelBuildFire( gentity_t *ent )
ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
}
-void buildFire( gentity_t *ent, dynMenu_t menu )
+void buildFire( gentity_t *ent, dynMenu_t menu, int delay )
{
if( ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE )
{
+ if( ent->client->ps.stats[ STAT_MISC ] > 0 )
+ {
+ G_AddPredictableEvent( ent, EV_BUILD_DELAY, 0 );
+ return;
+ }
+
G_ValidateBuild( ent, ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT );
ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE;
+ ent->client->ps.stats[ STAT_MISC ] += delay;
return;
}
@@ -528,43 +535,13 @@ void gClawFire( gentity_t *ent )
G_Damage( traceEnt, ent, ent, forward, tr.endpos, 5, DAMAGE_NO_KNOCKBACK, MOD_VENOM );
}
-void grabFire( gentity_t *ent )
+void lockBlobFire( gentity_t *ent )
{
- trace_t tr;
- vec3_t end;
- gentity_t *tent;
- gentity_t *traceEnt;
- int damage;
-
- // set aiming directions
- AngleVectors (ent->client->ps.viewangles, forward, right, up);
-
- CalcMuzzlePoint( ent, forward, right, up, muzzle );
-
- VectorMA( muzzle, 32, forward, end );
-
- trap_Trace( &tr, muzzle, NULL, NULL, end, ent->s.number, MASK_SHOT );
- if ( tr.surfaceFlags & SURF_NOIMPACT )
- return;
+ gentity_t *m;
- traceEnt = &g_entities[ tr.entityNum ];
+ m = fire_paraLockBlob( ent, muzzle, forward );
- if( !traceEnt->takedamage )
- return;
- if( !traceEnt->client )
- return;
- if( traceEnt->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- return;
-
- if( traceEnt->client )
- {
- //lock client
- traceEnt->client->ps.stats[ STAT_STATE ] |= SS_GRABBED;
- traceEnt->client->lastGrabTime = level.time;
-
- if( !( traceEnt->client->ps.stats[ STAT_STATE ] & SS_GRABBED ) )
- VectorCopy( traceEnt->client->ps.viewangles, traceEnt->client->ps.grapplePoint );
- }
+// VectorAdd( m->s.pos.trDelta, ent->client->ps.velocity, m->s.pos.trDelta ); // "real" physics
}
/*
@@ -918,7 +895,7 @@ void FireWeapon2( gentity_t *ent )
case WP_LOCKBLOB_LAUNCHER:
break;
case WP_GRAB_CLAW:
- grabFire( ent );
+ lockBlobFire( ent );
break;
case WP_AREA_ZAP:
case WP_DIRECT_ZAP:
@@ -1016,16 +993,16 @@ void FireWeapon( gentity_t *ent )
painSawFire( ent );
break;
case WP_ABUILD:
- buildFire( ent, MN_A_BUILD );
+ buildFire( ent, MN_A_BUILD, 10000 );
break;
case WP_ABUILD2:
- buildFire( ent, MN_A_BUILD );
+ buildFire( ent, MN_A_BUILD, 5000 );
break;
case WP_HBUILD:
- buildFire( ent, MN_H_BUILD );
+ buildFire( ent, MN_H_BUILD, 10000 );
break;
case WP_HBUILD2:
- buildFire( ent, MN_H_BUILD );
+ buildFire( ent, MN_H_BUILD, 5000 );
break;
default:
// FIXME G_Error( "Bad ent->s.weapon" );
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index 20e3a25d..d26835d8 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -406,6 +406,63 @@ void Text_Paint(float x, float y, float scale, vec4_t color, const char *text, f
trap_R_SetColor( newColor );
colorBlack[3] = 1.0;
}
+ else if( style == ITEM_TEXTSTYLE_NEON )
+ {
+ vec4_t glow, outer, inner, white;
+
+ glow[ 0 ] = newColor[ 0 ] * 0.5;
+ glow[ 1 ] = newColor[ 1 ] * 0.5;
+ glow[ 2 ] = newColor[ 2 ] * 0.5;
+ glow[ 3 ] = newColor[ 3 ] * 0.2;
+
+ outer[ 0 ] = newColor[ 0 ];
+ outer[ 1 ] = newColor[ 1 ];
+ outer[ 2 ] = newColor[ 2 ];
+ outer[ 3 ] = newColor[ 3 ];
+
+ inner[ 0 ] = newColor[ 0 ] * 1.5 > 1.0f ? 1.0f : newColor[ 0 ] * 1.5;
+ inner[ 1 ] = newColor[ 1 ] * 1.5 > 1.0f ? 1.0f : newColor[ 1 ] * 1.5;
+ inner[ 2 ] = newColor[ 2 ] * 1.5 > 1.0f ? 1.0f : newColor[ 2 ] * 1.5;
+ inner[ 3 ] = newColor[ 3 ];
+
+ white[ 0 ] = white[ 1 ] = white[ 2 ] = white[ 3 ] = 1.0f;
+
+ trap_R_SetColor( glow );
+ Text_PaintChar( x - 1.5, y - yadj - 1.5,
+ glyph->imageWidth + 3,
+ glyph->imageHeight + 3,
+ useScale,
+ glyph->s,
+ glyph->t,
+ glyph->s2,
+ glyph->t2,
+ glyph->glyph );
+
+ trap_R_SetColor( outer );
+ Text_PaintChar( x - 1, y - yadj - 1,
+ glyph->imageWidth + 2,
+ glyph->imageHeight + 2,
+ useScale,
+ glyph->s,
+ glyph->t,
+ glyph->s2,
+ glyph->t2,
+ glyph->glyph );
+
+ trap_R_SetColor( inner );
+ Text_PaintChar( x - 0.5, y - yadj - 0.5,
+ glyph->imageWidth + 1,
+ glyph->imageHeight + 1,
+ useScale,
+ glyph->s,
+ glyph->t,
+ glyph->s2,
+ glyph->t2,
+ glyph->glyph );
+
+ trap_R_SetColor( white );
+ }
+
Text_PaintChar(x, y - yadj,
glyph->imageWidth,
glyph->imageHeight,
@@ -478,6 +535,63 @@ void Text_PaintWithCursor(float x, float y, float scale, vec4_t color, const cha
colorBlack[3] = 1.0;
trap_R_SetColor( newColor );
}
+ else if( style == ITEM_TEXTSTYLE_NEON )
+ {
+ vec4_t glow, outer, inner, white;
+
+ glow[ 0 ] = newColor[ 0 ] * 0.5;
+ glow[ 1 ] = newColor[ 1 ] * 0.5;
+ glow[ 2 ] = newColor[ 2 ] * 0.5;
+ glow[ 3 ] = newColor[ 3 ] * 0.2;
+
+ outer[ 0 ] = newColor[ 0 ];
+ outer[ 1 ] = newColor[ 1 ];
+ outer[ 2 ] = newColor[ 2 ];
+ outer[ 3 ] = newColor[ 3 ];
+
+ inner[ 0 ] = newColor[ 0 ] * 1.5 > 1.0f ? 1.0f : newColor[ 0 ] * 1.5;
+ inner[ 1 ] = newColor[ 1 ] * 1.5 > 1.0f ? 1.0f : newColor[ 1 ] * 1.5;
+ inner[ 2 ] = newColor[ 2 ] * 1.5 > 1.0f ? 1.0f : newColor[ 2 ] * 1.5;
+ inner[ 3 ] = newColor[ 3 ];
+
+ white[ 0 ] = white[ 1 ] = white[ 2 ] = white[ 3 ] = 1.0f;
+
+ trap_R_SetColor( glow );
+ Text_PaintChar( x - 1.5, y - yadj - 1.5,
+ glyph->imageWidth + 3,
+ glyph->imageHeight + 3,
+ useScale,
+ glyph->s,
+ glyph->t,
+ glyph->s2,
+ glyph->t2,
+ glyph->glyph );
+
+ trap_R_SetColor( outer );
+ Text_PaintChar( x - 1, y - yadj - 1,
+ glyph->imageWidth + 2,
+ glyph->imageHeight + 2,
+ useScale,
+ glyph->s,
+ glyph->t,
+ glyph->s2,
+ glyph->t2,
+ glyph->glyph );
+
+ trap_R_SetColor( inner );
+ Text_PaintChar( x - 0.5, y - yadj - 0.5,
+ glyph->imageWidth + 1,
+ glyph->imageHeight + 1,
+ useScale,
+ glyph->s,
+ glyph->t,
+ glyph->s2,
+ glyph->t2,
+ glyph->glyph );
+
+ trap_R_SetColor( white );
+ }
+
Text_PaintChar(x, y - yadj,
glyph->imageWidth,
glyph->imageHeight,
@@ -1200,12 +1314,8 @@ void UI_Load() {
String_Init();
-#ifdef PRE_RELEASE_TADEMO
- UI_ParseGameInfo("demogameinfo.txt");
-#else
- UI_ParseGameInfo("gameinfo.txt");
- UI_LoadArenas();
-#endif
+/* UI_ParseGameInfo("gameinfo.txt");
+ UI_LoadArenas();*/
UI_LoadMenus(menuSet, qtrue);
Menus_CloseAll();
@@ -3974,12 +4084,8 @@ static void UI_RunMenuScript(char **args) {
} else if (Q_stricmp(name, "clearError") == 0) {
trap_Cvar_Set("com_errorMessage", "");
} else if (Q_stricmp(name, "loadGameInfo") == 0) {
-#ifdef PRE_RELEASE_TADEMO
- UI_ParseGameInfo("demogameinfo.txt");
-#else
- UI_ParseGameInfo("gameinfo.txt");
-#endif
- UI_LoadBestScores(uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum);
+/* UI_ParseGameInfo("gameinfo.txt");
+ UI_LoadBestScores(uiInfo.mapList[ui_currentMap.integer].mapLoadName, uiInfo.gameTypes[ui_gameType.integer].gtEnum);*/
} else if (Q_stricmp(name, "resetScores") == 0) {
UI_ClearScores();
} else if (Q_stricmp(name, "RefreshServers") == 0) {
@@ -5958,14 +6064,9 @@ void _UI_Init( qboolean inGameLoad ) {
uiInfo.characterCount = 0;
uiInfo.aliasCount = 0;
-#ifdef PRE_RELEASE_TADEMO
- UI_ParseTeamInfo("demoteaminfo.txt");
- UI_ParseGameInfo("demogameinfo.txt");
-#else
- UI_ParseTeamInfo("teaminfo.txt");
+/* UI_ParseTeamInfo("teaminfo.txt");
UI_LoadTeams();
- UI_ParseGameInfo("gameinfo.txt");
-#endif
+ UI_ParseGameInfo("gameinfo.txt");*/
menuSet = UI_Cvar_VariableString("ui_menuFiles");
if (menuSet == NULL || menuSet[0] == '\0') {
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 8f0a60f0..c6a8253a 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -3754,7 +3754,32 @@ void Item_ListBox_Paint(itemDef_t *item) {
if (optionalImage >= 0) {
DC->drawHandlePic(x + 4 + listPtr->columnInfo[j].pos, y - 1 + listPtr->elementHeight / 2, listPtr->columnInfo[j].width, listPtr->columnInfo[j].width, optionalImage);
} else if (text) {
- DC->drawText(x + 4 + listPtr->columnInfo[j].pos, y + listPtr->elementHeight, item->textscale, item->window.foreColor, text, 0, listPtr->columnInfo[j].maxChars, item->textStyle);
+ //TA:
+ int alignOffset, tw;
+
+ tw = DC->textWidth( text, item->textscale, 0 );
+
+ switch( listPtr->columnInfo[ j ].align )
+ {
+ case ITEM_ALIGN_LEFT:
+ alignOffset = 0.0f;
+ break;
+
+ case ITEM_ALIGN_RIGHT:
+ alignOffset = listPtr->columnInfo[ j ].width - tw;
+ break;
+
+ case ITEM_ALIGN_CENTER:
+ alignOffset = ( listPtr->columnInfo[ j ].width / 2.0f ) - ( tw / 2.0f );
+ break;
+
+ default:
+ alignOffset = 0.0f;
+ }
+
+ DC->drawText( x + 4 + listPtr->columnInfo[j].pos + alignOffset, y + listPtr->elementHeight,
+ item->textscale, item->window.foreColor, text, 0,
+ listPtr->columnInfo[j].maxChars, item->textStyle );
}
}
} else {
@@ -4600,12 +4625,17 @@ qboolean ItemParse_columns( itemDef_t *item, int handle ) {
}
listPtr->numColumns = num;
for (i = 0; i < num; i++) {
- int pos, width, maxChars;
+ int pos, width, maxChars, align;
- if (PC_Int_Parse(handle, &pos) && PC_Int_Parse(handle, &width) && PC_Int_Parse(handle, &maxChars)) {
+ if( PC_Int_Parse( handle, &pos ) &&
+ PC_Int_Parse( handle, &width ) &&
+ PC_Int_Parse( handle, &maxChars ) &&
+ PC_Int_Parse( handle, &align ) )
+ {
listPtr->columnInfo[i].pos = pos;
listPtr->columnInfo[i].width = width;
listPtr->columnInfo[i].maxChars = maxChars;
+ listPtr->columnInfo[i].align = align;
} else {
return qfalse;
}
diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h
index 8d67fce1..f20af2b4 100644
--- a/src/ui/ui_shared.h
+++ b/src/ui/ui_shared.h
@@ -161,6 +161,7 @@ typedef struct columnInfo_s {
int pos;
int width;
int maxChars;
+ int align;
} columnInfo_t;
typedef struct listBoxDef_s {