diff --git a/code/cgame/cg_draw.c b/code/cgame/cg_draw.c index e2bda62e1e..3221de1ff8 100644 --- a/code/cgame/cg_draw.c +++ b/code/cgame/cg_draw.c @@ -538,7 +538,6 @@ CG_DrawStatusBar ================ */ #ifndef MISSIONPACK -#define STATUSBAR_HEIGHT 60 static void CG_DrawStatusBar( void ) { int color; centity_t *cent; diff --git a/code/cgame/cg_local.h b/code/cgame/cg_local.h index 5c5813c28b..0c6a5715eb 100644 --- a/code/cgame/cg_local.h +++ b/code/cgame/cg_local.h @@ -91,6 +91,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define DEFAULT_REDTEAM_NAME "Stroggs" #define DEFAULT_BLUETEAM_NAME "Pagans" +#define STATUSBAR_HEIGHT 60 + #define NUM_REWARD_VARIATIONS 3 #define ICON_SCALE_DISTANCE 200.0 @@ -736,6 +738,7 @@ typedef struct { qhandle_t connectionShader; qhandle_t selectShader; + qhandle_t weaplit; qhandle_t viewBloodShader; qhandle_t tracerShader; qhandle_t crosshairShader[NUM_CROSSHAIRS]; @@ -1344,7 +1347,7 @@ extern vmCvar_t cg_drawPowerupAvailableAlpha; extern vmCvar_t cg_drawPowerupAvailableFadeStart; extern vmCvar_t cg_drawPowerupAvailableFadeEnd; // - +extern vmCvar_t cg_drawWeaponBar; // // cg_main.c // diff --git a/code/cgame/cg_main.c b/code/cgame/cg_main.c index 9ce84f9930..f21ec182e3 100644 --- a/code/cgame/cg_main.c +++ b/code/cgame/cg_main.c @@ -268,6 +268,8 @@ vmCvar_t cg_drawPowerupAvailableOffset; vmCvar_t cg_drawPowerupAvailableAlpha; vmCvar_t cg_drawPowerupAvailableFadeStart; vmCvar_t cg_drawPowerupAvailableFadeEnd; +// +vmCvar_t cg_drawWeaponBar; typedef struct { vmCvar_t *vmCvar; @@ -454,6 +456,8 @@ static cvarTable_t cvarTable[] = { { &cg_drawPowerupAvailableAlpha,"cg_drawPowerupAvailableAlpha", "1.0", CVAR_ARCHIVE }, { &cg_drawPowerupAvailableFadeStart,"cg_drawPowerupAvailableFadeStart", "705.0", CVAR_ARCHIVE }, { &cg_drawPowerupAvailableFadeEnd, "cg_drawPowerupAvailableFadeEnd", "520.0", CVAR_ARCHIVE }, + // + { &cg_drawWeaponBar, "cg_weaponBar", "1", CVAR_ARCHIVE }, // { &cg_pmove_fixed, "cg_pmove_fixed", "0", CVAR_USERINFO | CVAR_ARCHIVE } }; @@ -1053,6 +1057,7 @@ static void CG_RegisterGraphics( void ) { cgs.media.tracerShader = trap_R_RegisterShader( "gfx/misc/tracer" ); cgs.media.selectShader = trap_R_RegisterShader( "gfx/2d/select" ); + cgs.media.weaplit = trap_R_RegisterShader("ui/assets/hud/weaplit2"); for ( i = 0 ; i < NUM_CROSSHAIRS ; i++ ) cgs.media.crosshairShader[i] = trap_R_RegisterShaderNoMip( va("gfx/2d/crosshair%d", i) ); diff --git a/code/cgame/cg_weapons.c b/code/cgame/cg_weapons.c index 153f773e56..2118e9ac3b 100644 --- a/code/cgame/cg_weapons.c +++ b/code/cgame/cg_weapons.c @@ -1458,77 +1458,77 @@ WEAPON SELECTION CG_DrawWeaponSelect =================== */ +#define AMMO_ICON_SIZE 16 void CG_DrawWeaponSelect( void ) { int i; int bits; int count; - int x, y, w; - char *name; - float *color; + int x, y; + int dx, dy; + int weaponSelect; + char buf[4]; // don't display if dead - if ( cg.predictedPlayerState.stats[STAT_HEALTH] <= 0 ) { + if ( cg.predictedPlayerState.stats[STAT_HEALTH] <= 0 || !cg_drawWeaponBar.integer ) { return; } - color = CG_FadeColor( cg.weaponSelectTime, WEAPON_SELECT_TIME ); - if ( !color ) { - return; - } - trap_R_SetColor( color ); - - // showing weapon select clears pickup item display, but not the blend blob - cg.itemPickupTime = 0; + weaponSelect = cg_drawWeaponBar.integer ; // count the number of weapons owned bits = cg.snap->ps.stats[ STAT_WEAPONS ]; count = 0; - for ( i = 1 ; i < MAX_WEAPONS ; i++ ) { + for ( i = WP_MACHINEGUN ; i < MAX_WEAPONS ; i++ ) { if ( bits & ( 1 << i ) ) { count++; } } - x = 320 - count * 20; - y = cgs.screenYmax + 1 - 100; // - STATUSBAR_HEIGHT - 40 + switch(weaponSelect) + { + case 2: // horizontal + x = 320 - count * 28; + y = cgs.screenYmax - STATUSBAR_HEIGHT - 40; + dx = 56; + dy = 0; + break; + default: // vertical left + x = cgs.screenXmin + 6; + y = 100; //240 - count * 10; // centered + dx = 0; + dy = 20; + break; + } - for ( i = 1 ; i < MAX_WEAPONS ; i++ ) { + for ( i = WP_MACHINEGUN ; i < MAX_WEAPONS ; i++ ) { if ( !( bits & ( 1 << i ) ) ) { continue; } CG_RegisterWeapon( i ); - // draw weapon icon - CG_DrawPic( x, y, 32, 32, cg_weapons[i].weaponIcon ); - // draw selection marker if ( i == cg.weaponSelect ) { - CG_DrawPic( x-4, y-4, 40, 40, cgs.media.selectShader ); + CG_DrawPic( x - 2, y - 2, (AMMO_ICON_SIZE*3) + 8, AMMO_ICON_SIZE+4, cgs.media.weaplit); } + // draw weapon icon + CG_DrawPic( x, y, AMMO_ICON_SIZE, AMMO_ICON_SIZE, cg_weapons[i].weaponIcon ); + // no ammo cross on top - if ( !cg.snap->ps.ammo[ i ] ) { - CG_DrawPic( x, y, 32, 32, cgs.media.noammoShader ); - } + if ( weaponSelect > 0 && cg.snap->ps.ammo[ i ] > -1 ) { - x += 40; - } + if ( !cg.snap->ps.ammo[ i ] ) + CG_DrawPic( x, y, AMMO_ICON_SIZE, AMMO_ICON_SIZE, cgs.media.noammoShader ); - // draw the selected name - if ( cg_weapons[ cg.weaponSelect ].item ) { - name = cg_weapons[ cg.weaponSelect ].item->pickup_name; - if ( name ) { - w = CG_DrawStrlen( name, UI_BIGFONT);// * BIGCHAR_WIDTH; - x = ( SCREEN_WIDTH - w ) / 2; - CG_DrawBigStringColor(x, y - 22, name, color); + // ammo counter + Com_sprintf( buf, sizeof(buf),"%i", cg.snap->ps.ammo[ i ] ); + CG_DrawString( x + AMMO_ICON_SIZE + 2, y-1, buf, UI_BIGFONT, NULL); } + x += dx; + y += dy; } - - trap_R_SetColor( NULL ); } - - /* =============== CG_WeaponSelectable