summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
authorMichael Levin <risujin@fastmail.fm>2009-10-03 11:26:03 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:14:59 +0000
commit617fac98d0df82c4beda446547ca021b7a12d9dd (patch)
treeddea2c0785b61aec075c9fcb3d20a29045fb4af5 /src/cgame
parentc2772cce6c591f4b043da4526764298d88cce9a9 (diff)
* Build delay pie slices are now 5 sec each for both teams
* Removed individual weapon build delay * Removed Advanced Construction Kit, everything is built by the normal kit * S2+ buildables cannot be built by regular grangers * Clicking to pick team during spectator mode fixed * New cvar: cg_printDuplicate, when set to 0 (default) prevents duplicate messages from being printed to screen (they still show up in console) * Pressing ESC while editing a UI item (esp. new Say menu) will not cause your cursor to disappear next time you open a menu
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_buildable.c1
-rw-r--r--src/cgame/cg_draw.c92
-rw-r--r--src/cgame/cg_main.c13
-rw-r--r--src/cgame/cg_tutorial.c1
4 files changed, 39 insertions, 68 deletions
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
index 0a1f3877..054068f4 100644
--- a/src/cgame/cg_buildable.c
+++ b/src/cgame/cg_buildable.c
@@ -1184,7 +1184,6 @@ static qboolean CG_PlayerIsBuilder( buildable_t buildable )
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
- case WP_HBUILD2:
return BG_FindTeamForBuildable( buildable ) ==
BG_FindTeamForWeapon( cg.predictedPlayerState.weapon );
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
index 4720fd0f..08433c44 100644
--- a/src/cgame/cg_draw.c
+++ b/src/cgame/cg_draw.c
@@ -515,13 +515,9 @@ static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t color, qhandle_t sha
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
- case WP_HBUILD2:
- maxDelay = (float)BG_FindBuildDelayForWeapon( cent->currentState.weapon );
-
- if( buildTime > maxDelay )
- buildTime = maxDelay;
-
- progress = ( maxDelay - buildTime ) / maxDelay;
+ if( buildTime > MAXIMUM_BUILD_TIME )
+ buildTime = MAXIMUM_BUILD_TIME;
+ progress = ( MAXIMUM_BUILD_TIME - buildTime ) / MAXIMUM_BUILD_TIME;
color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF );
break;
@@ -553,16 +549,13 @@ static void CG_DrawPlayerBuildTimerRing( rectDef_t *rect, vec4_t color, qhandle_
centity_t *cent;
float buildTime = ps->stats[ STAT_MISC ];
float progress;
- float maxDelay;
cent = &cg_entities[ cg.snap->ps.clientNum ];
- maxDelay = (float)BG_FindBuildDelayForWeapon( cent->currentState.weapon );
+ if( buildTime > MAXIMUM_BUILD_TIME )
+ buildTime = MAXIMUM_BUILD_TIME;
- if( buildTime > maxDelay )
- buildTime = maxDelay;
-
- progress = ( maxDelay - buildTime ) / maxDelay;
+ progress = ( MAXIMUM_BUILD_TIME - buildTime ) / MAXIMUM_BUILD_TIME;
color[ 3 ] = AH_MIN_ALPHA + ( progress * AH_ALPHA_DIFF );
@@ -700,7 +693,6 @@ static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color )
break;
case WP_HBUILD:
- case WP_HBUILD2:
//percentage of BP remaining
value = cgs.humanBuildPoints;
break;
@@ -785,7 +777,6 @@ static void CG_DrawUsableBuildable( rectDef_t *rect, qhandle_t shader, vec4_t co
static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color )
{
- float progress;
int index;
centity_t *cent;
playerState_t *ps;
@@ -793,56 +784,30 @@ static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color )
cent = &cg_entities[ cg.snap->ps.clientNum ];
ps = &cg.snap->ps;
- if( cent->currentState.weapon )
- {
- switch( cent->currentState.weapon )
- {
- case WP_ABUILD:
- progress = (float)ps->stats[ STAT_MISC ] / (float)ABUILDER_BASE_DELAY;
- break;
-
- case WP_ABUILD2:
- progress = (float)ps->stats[ STAT_MISC ] / (float)ABUILDER_ADV_DELAY;
- break;
-
- case WP_HBUILD:
- progress = (float)ps->stats[ STAT_MISC ] / (float)HBUILD_DELAY;
- break;
-
- case WP_HBUILD2:
- progress = (float)ps->stats[ STAT_MISC ] / (float)HBUILD2_DELAY;
- break;
-
- default:
- return;
- break;
- }
-
- if( !ps->stats[ STAT_MISC ] )
- return;
-
- index = (int)( progress * 8.0f );
-
- if( index > 7 )
- index = 7;
- else if( index < 0 )
- index = 0;
+ if( ( cent->currentState.weapon != WP_ABUILD &&
+ cent->currentState.weapon != WP_ABUILD2 &&
+ cent->currentState.weapon != WP_HBUILD ) ||
+ ps->stats[ STAT_MISC ] <= 0 )
+ return;
- if( cg.time - cg.lastBuildAttempt <= BUILD_DELAY_TIME )
- {
- if( ( ( cg.time - cg.lastBuildAttempt ) / 300 ) % 2 )
- {
- color[ 0 ] = 1.0f;
- color[ 1 ] = color[ 2 ] = 0.0f;
- color[ 3 ] = 1.0f;
- }
- }
+ index = 8 * ( ps->stats[ STAT_MISC ] - 1 ) / MAXIMUM_BUILD_TIME;
+ if( index > 7 )
+ index = 7;
+ else if( index < 0 )
+ index = 0;
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h,
- cgs.media.buildWeaponTimerPie[ index ] );
- trap_R_SetColor( NULL );
+ if( cg.time - cg.lastBuildAttempt <= BUILD_DELAY_TIME &&
+ ( ( cg.time - cg.lastBuildAttempt ) / 300 ) % 2 )
+ {
+ color[ 0 ] = 1.0f;
+ color[ 1 ] = color[ 2 ] = 0.0f;
+ color[ 3 ] = 1.0f;
}
+
+ trap_R_SetColor( color );
+ CG_DrawPic( rect->x, rect->y, rect->w, rect->h,
+ cgs.media.buildWeaponTimerPie[ index ] );
+ trap_R_SetColor( NULL );
}
static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
@@ -861,7 +826,6 @@ static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
case WP_ABUILD:
case WP_ABUILD2:
case WP_HBUILD:
- case WP_HBUILD2:
break;
default:
@@ -2005,9 +1969,7 @@ static void CG_DrawCrosshair( void )
if( cg_drawCrosshair.integer == CROSSHAIR_RANGEDONLY &&
!BG_FindLongRangedForWeapon( cg.snap->ps.weapon ) )
- {
return;
- }
if( ( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) ||
( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) ||
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 8c472321..ac0715fe 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -176,6 +176,7 @@ vmCvar_t cg_drawTeamOverlay;
vmCvar_t cg_teamOverlayUserinfo;
vmCvar_t cg_drawFriend;
vmCvar_t cg_teamChatsOnly;
+vmCvar_t cg_printDuplicate;
vmCvar_t cg_noVoiceChats;
vmCvar_t cg_noVoiceText;
vmCvar_t cg_hudFiles;
@@ -313,6 +314,7 @@ static cvarTable_t cvarTable[ ] =
{ &cg_stats, "cg_stats", "0", 0 },
{ &cg_drawFriend, "cg_drawFriend", "1", CVAR_ARCHIVE },
{ &cg_teamChatsOnly, "cg_teamChatsOnly", "0", CVAR_ARCHIVE },
+ { &cg_printDuplicate, "cg_printDuplicate", "0", CVAR_ARCHIVE },
{ &cg_noVoiceChats, "cg_noVoiceChats", "0", CVAR_ARCHIVE },
{ &cg_noVoiceText, "cg_noVoiceText", "0", CVAR_ARCHIVE },
{ &cg_drawSurfNormal, "cg_drawSurfNormal", "0", CVAR_CHEAT },
@@ -547,6 +549,7 @@ CG_AddNotifyText
void CG_AddNotifyText( void )
{
char buffer[ BIG_INFO_STRING ];
+ int bufferLen, textLen;
trap_LiteralArgs( buffer, BIG_INFO_STRING );
@@ -557,12 +560,20 @@ void CG_AddNotifyText( void )
return;
}
+ bufferLen = strlen( buffer );
+ textLen = strlen( cg.consoleText );
+
+ // Ignore console messages that were just printed
+ if( !cg_printDuplicate.integer && textLen >= bufferLen &&
+ !strcmp( cg.consoleText + textLen - bufferLen, buffer ) )
+ return;
+
if( cg.numConsoleLines == MAX_CONSOLE_LINES )
CG_RemoveNotifyLine( );
Q_strcat( cg.consoleText, MAX_CONSOLE_TEXT, buffer );
cg.consoleLines[ cg.numConsoleLines ].time = cg.time;
- cg.consoleLines[ cg.numConsoleLines ].length = strlen( buffer );
+ cg.consoleLines[ cg.numConsoleLines ].length = bufferLen;
cg.numConsoleLines++;
}
diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c
index 04d0ec28..9bd258fb 100644
--- a/src/cgame/cg_tutorial.c
+++ b/src/cgame/cg_tutorial.c
@@ -502,7 +502,6 @@ static void CG_HumanText( char *text, playerState_t *ps )
break;
case WP_HBUILD:
- case WP_HBUILD2:
CG_HumanCkitText( text, ps );
break;