diff options
Diffstat (limited to 'src/cgame')
-rw-r--r-- | src/cgame/cg_draw.c | 16 | ||||
-rw-r--r-- | src/cgame/cg_servercmds.c | 27 |
2 files changed, 20 insertions, 23 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 0617580b..0774476a 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -541,12 +541,12 @@ static void CG_DrawStatusBar( void ) { #define PWR_Y 20 if( ps->stats[ STAT_PTEAM ] == PTE_HUMANS ) { - int total = cgs.hBuildPointsTotal; - int allocated = total - cgs.hBuildPoints; - int powered = total - cgs.hBuildPointsPowered; + float total = cgs.hBuildPointsTotal; + float allocated = total - cgs.hBuildPoints; + float powered = total - cgs.hBuildPointsPowered; - int awidth = (int)( (float)allocated / ( total / PWR_WIDTH ) ); - int pwidth = (int)( (float)powered / ( total / PWR_WIDTH ) ); + 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; @@ -579,10 +579,10 @@ static void CG_DrawStatusBar( void ) { #define HV_Y 20 if( ps->stats[ STAT_PTEAM ] == PTE_DROIDS ) { - int total = cgs.dBuildPointsTotal; - int allocated = total - cgs.dBuildPoints; + float total = cgs.dBuildPointsTotal; + float allocated = total - cgs.dBuildPoints; - int awidth = (int)( (float)allocated / ( total / HV_WIDTH ) ); + int awidth = (int)( ( allocated / total ) * HV_WIDTH ); vec4_t bcolor = { 0.5, 0.5, 0.5, 0.5 }; trap_R_SetColor( bcolor ); // white diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c index 65e09cd5..4236cafd 100644 --- a/src/cgame/cg_servercmds.c +++ b/src/cgame/cg_servercmds.c @@ -189,11 +189,12 @@ void CG_SetConfigValues( void ) { cgs.scores1 = atoi( CG_ConfigString( CS_SCORES1 ) ); cgs.scores2 = atoi( CG_ConfigString( CS_SCORES2 ) ); - cgs.dBuildPoints = atoi( CG_ConfigString( CS_DBPOINTS ) ); - cgs.dBuildPointsTotal = atoi( CG_ConfigString( CS_DTBPOINTS ) ); - cgs.hBuildPoints = atoi( CG_ConfigString( CS_HBPOINTS ) ); - cgs.hBuildPointsTotal = atoi( CG_ConfigString( CS_HTBPOINTS ) ); - cgs.hBuildPointsPowered = atoi( CG_ConfigString( CS_HPBPOINTS ) ); + sscanf( CG_ConfigString( CS_BUILDPOINTS ), + "%d %d %d %d %d", &cgs.dBuildPoints, + &cgs.dBuildPointsTotal, + &cgs.hBuildPoints, + &cgs.hBuildPointsTotal, + &cgs.hBuildPointsPowered ); cgs.levelStartTime = atoi( CG_ConfigString( CS_LEVEL_START_TIME ) ); if( cgs.gametype == GT_CTF ) { @@ -276,16 +277,12 @@ static void CG_ConfigStringModified( void ) { cgs.scores1 = atoi( str ); } else if ( num == CS_SCORES2 ) { cgs.scores2 = atoi( str ); - } else if ( num == CS_DBPOINTS ) { - cgs.dBuildPoints = atoi( str ); - } else if ( num == CS_DTBPOINTS ) { - cgs.dBuildPointsTotal = atoi( str ); - } else if ( num == CS_HBPOINTS ) { - cgs.hBuildPoints = atoi( str ); - } else if ( num == CS_HTBPOINTS ) { - cgs.hBuildPointsTotal = atoi( str ); - } else if ( num == CS_HPBPOINTS ) { - cgs.hBuildPointsPowered = atoi( str ); + } else if( num == CS_BUILDPOINTS ) { + sscanf( str, "%d %d %d %d %d", &cgs.dBuildPoints, + &cgs.dBuildPointsTotal, + &cgs.hBuildPoints, + &cgs.hBuildPointsTotal, + &cgs.hBuildPointsPowered ); } else if ( num == CS_LEVEL_START_TIME ) { cgs.levelStartTime = atoi( str ); } else if ( num == CS_VOTE_TIME ) { |