diff options
author | Tim Angus <tim@ngus.net> | 2002-09-23 01:24:25 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2002-09-23 01:24:25 +0000 |
commit | a3f567734f3df2346ba042860fa2a7988963e51c (patch) | |
tree | 4d02104d522c57cb9c87a25b749d18872082e6d1 /src | |
parent | 83117d8363aa5d69b30c068517d193bd7bb64947 (diff) |
* Various changes for Jex's new hud
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_draw.c | 79 | ||||
-rw-r--r-- | src/game/g_active.c | 5 | ||||
-rw-r--r-- | src/game/tremulous.h | 6 |
3 files changed, 58 insertions, 32 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 2c9b12b9..a479f3b4 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -352,14 +352,20 @@ static void CG_DrawField( int x, int y, int width, int cw, int ch, int value ) } } -static void CG_DrawProgressBar( rectDef_t *rect, vec4_t color, - float scale, int align, int textStyle, float progress ) +static void CG_DrawProgressBar( rectDef_t *rect, vec4_t color, float scale, + int align, int textStyle, int special, float progress ) { - float rimWidth = rect->h / 10.0f; + float rimWidth = rect->h / 20.0f; float doneWidth, leftWidth; float tx, ty, tw, th; char textBuffer[ 8 ]; + if( rimWidth < 0.6f ) + rimWidth = 0.6f; + + if( special >= 0.0f ) + rimWidth = special; + if( progress < 0.0f ) progress = 0.0f; else if( progress > 1.0f ) @@ -371,12 +377,25 @@ static void CG_DrawProgressBar( rectDef_t *rect, vec4_t color, 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 ); + if( align == ITEM_ALIGN_RIGHT ) + { + CG_DrawPic( rect->x, rect->y, rimWidth, rect->h, cgs.media.whiteShader ); + CG_DrawPic( rect->x + rimWidth, rect->y, + leftWidth, rimWidth, cgs.media.whiteShader ); + CG_DrawPic( rect->x + rimWidth, rect->y + rect->h - rimWidth, + leftWidth, rimWidth, cgs.media.whiteShader ); + CG_DrawPic( rect->x + rimWidth + leftWidth, rect->y, + rimWidth + doneWidth, rect->h, cgs.media.whiteShader ); + } + else + { + 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 ); @@ -466,13 +485,14 @@ static void CG_DrawPlayerBankValue( rectDef_t *rect, vec4_t color ) } } -static void CG_DrawPlayerStamina( rectDef_t *rect, vec4_t color, float scale, int align, int textStyle ) +static void CG_DrawPlayerStamina( rectDef_t *rect, vec4_t color, float scale, + int align, int textStyle, int special ) { playerState_t *ps = &cg.snap->ps; int stamina = ps->stats[ STAT_STAMINA ]; float progress = ( (float)stamina + (float)MAX_STAMINA ) / ( (float)MAX_STAMINA * 2.0f ); - CG_DrawProgressBar( rect, color, scale, align, textStyle, progress ); + CG_DrawProgressBar( rect, color, scale, align, textStyle, special, progress ); } static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color ) @@ -571,7 +591,8 @@ static void CG_DrawPlayerHealthValue( rectDef_t *rect, vec4_t color ) trap_R_SetColor( NULL ); } -static void CG_DrawPlayerHealthBar( rectDef_t *rect, vec4_t color, float scale, int align, int textStyle ) +static void CG_DrawPlayerHealthBar( rectDef_t *rect, vec4_t color, float scale, + int align, int textStyle, int special ) { playerState_t *ps; float total; @@ -579,7 +600,7 @@ static void CG_DrawPlayerHealthBar( rectDef_t *rect, vec4_t color, float scale, ps = &cg.snap->ps; total = ( (float)ps->stats[ STAT_HEALTH ] / (float)ps->stats[ STAT_MAX_HEALTH ] ); - CG_DrawProgressBar( rect, color, scale, align, textStyle, total ); + CG_DrawProgressBar( rect, color, scale, align, textStyle, special, total ); } static void CG_DrawProgressLabel( rectDef_t *rect, float text_x, float text_y, vec4_t color, @@ -614,9 +635,10 @@ static void CG_DrawProgressLabel( rectDef_t *rect, float text_x, float text_y, v s, 0, 0, ITEM_TEXTSTYLE_NEON ); } -static void CG_DrawMediaProgress( rectDef_t *rect, vec4_t color, float scale, int align, int textStyle ) +static void CG_DrawMediaProgress( rectDef_t *rect, vec4_t color, float scale, + int align, int textStyle, int special ) { - CG_DrawProgressBar( rect, color, scale, align, textStyle, cg.mediaFraction ); + CG_DrawProgressBar( rect, color, scale, align, textStyle, special, cg.mediaFraction ); } static void CG_DrawMediaProgressLabel( rectDef_t *rect, float text_x, float text_y, @@ -625,9 +647,10 @@ static void CG_DrawMediaProgressLabel( rectDef_t *rect, float text_x, float text 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 ) +static void CG_DrawBuildablesProgress( rectDef_t *rect, vec4_t color, float scale, + int align, int textStyle, int special ) { - CG_DrawProgressBar( rect, color, scale, align, textStyle, cg.buildablesFraction ); + CG_DrawProgressBar( rect, color, scale, align, textStyle, special, cg.buildablesFraction ); } static void CG_DrawBuildablesProgressLabel( rectDef_t *rect, float text_x, float text_y, @@ -636,9 +659,10 @@ static void CG_DrawBuildablesProgressLabel( rectDef_t *rect, float text_x, float 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 ) +static void CG_DrawCharModelProgress( rectDef_t *rect, vec4_t color, float scale, + int align, int textStyle, int special ) { - CG_DrawProgressBar( rect, color, scale, align, textStyle, cg.charModelFraction ); + CG_DrawProgressBar( rect, color, scale, align, textStyle, special, cg.charModelFraction ); } static void CG_DrawCharModelProgressLabel( rectDef_t *rect, float text_x, float text_y, @@ -647,12 +671,13 @@ static void CG_DrawCharModelProgressLabel( rectDef_t *rect, float text_x, float 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 ) +static void CG_DrawOverallProgress( rectDef_t *rect, vec4_t color, float scale, + int align, int textStyle, int special ) { float total; total = ( cg.charModelFraction + cg.buildablesFraction + cg.mediaFraction ) / 3.0f; - CG_DrawProgressBar( rect, color, scale, align, textStyle, total ); + CG_DrawProgressBar( rect, color, scale, align, textStyle, special, total ); } static void CG_DrawLevelShot( rectDef_t *rect ) @@ -1530,7 +1555,7 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, CG_DrawPlayerBankValue( &rect, color ); break; case CG_PLAYER_STAMINA: - CG_DrawPlayerStamina( &rect, color, scale, align, textStyle ); + CG_DrawPlayerStamina( &rect, color, scale, align, textStyle, special ); break; case CG_PLAYER_AMMO_VALUE: CG_DrawPlayerAmmoValue( &rect, color ); @@ -1542,7 +1567,7 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, CG_DrawPlayerHealthValue( &rect, color ); break; case CG_PLAYER_HEALTH_BAR: - CG_DrawPlayerHealthBar( &rect, color, scale, align, textStyle ); + CG_DrawPlayerHealthBar( &rect, color, scale, align, textStyle, special ); break; case CG_AREA_SYSTEMCHAT: CG_DrawAreaSystemChat( &rect, scale, color, shader ); @@ -1571,25 +1596,25 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, CG_DrawLevelShot( &rect ); break; case CG_LOAD_MEDIA: - CG_DrawMediaProgress( &rect, color, scale, align, textStyle ); + CG_DrawMediaProgress( &rect, color, scale, align, textStyle, special ); 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 ); + CG_DrawBuildablesProgress( &rect, color, scale, align, textStyle, special ); 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 ); + CG_DrawCharModelProgress( &rect, color, scale, align, textStyle, special ); 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 ); + CG_DrawOverallProgress( &rect, color, scale, align, textStyle, special ); break; case CG_LOAD_LEVELNAME: CG_DrawLevelName( &rect, text_x, text_y, color, scale, align, textStyle ); diff --git a/src/game/g_active.c b/src/game/g_active.c index ed4034d9..463868db 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -399,11 +399,6 @@ qboolean ClientInactivityTimer( gclient_t *client ) return qtrue; } -#define STAMINA_STOP_RESTORE 10 -#define STAMINA_WALK_RESTORE 5 -#define STAMINA_SPRINT_TAKE 10 -#define STAMINA_LARMOUR_TAKE 5 - /* ================== ClientTimerActions diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 29c5b8e2..6d25456e 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -464,3 +464,9 @@ #define HUMAN_JOG_MODIFIER 0.8f #define HUMAN_BACK_MODIFIER 0.5f #define HUMAN_SIDE_MODIFIER 0.75f + +#define STAMINA_STOP_RESTORE 10 +#define STAMINA_WALK_RESTORE 5 +#define STAMINA_SPRINT_TAKE 10 +#define STAMINA_LARMOUR_TAKE 5 + |