Bring back the classic Q3A weapon bar

This commit is contained in:
Izuru Yakumo
2025-07-26 22:58:27 -03:00
parent be628b1bc1
commit ef570c312a
2 changed files with 84 additions and 2 deletions

View File

@@ -1732,6 +1732,9 @@ void CG_DrawWeaponSelect( void ) {
case 7:
CG_DrawWeaponBar7(count,bits, color);
break;
case 8:
CG_DrawWeaponBar8(count,bits);
break;
}
trap_R_SetColor(NULL);
return;
@@ -2101,7 +2104,7 @@ void CG_DrawWeaponBar4(int count, int bits, float *color){
float yellow[4];
boxColor[1]=0;
boxColor[3]=0.4f;
boxColor[3]=0.0f;
yellow[0] = 1.0f;
yellow[1] = 1.0f;
@@ -2387,7 +2390,7 @@ void CG_DrawWeaponBar7(int count, int bits, float *color){
float boxColor[4];
boxColor[1]=0;
boxColor[3]=0.4f;
boxColor[3]=0.0f;
yellow[0] = 1.0f;
yellow[1] = 1.0f;
@@ -2454,6 +2457,84 @@ void CG_DrawWeaponBar7(int count, int bits, float *color){
}
}
/*
===============
CG_DrawWeaponBar8
===============
*/
/*
* Y.A.K.U.M.O.
* This brings back the classic weapon bar from
* Quake III Arena fame
*/
void CG_DrawWeaponBar8( int count, int bits ) {
int i;
int x, y, w;
char *name;
float *color;
// Don't display if dead
if ( cg.predictedPlayerState.stats[STAT_HEALTH] <= 0 ) {
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;
// Count the number of weapons owned
bits = cg.snap->ps.stats[ STAT_WEAPONS ];
count = 0;
for ( i = 1 ; i < MAX_WEAPONS ; i++ ) {
if ( bits & ( 1 << i ) ) {
count++;
}
}
x = 320 - count * 20;
y = 380;
for ( i = 1 ; 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 );
}
// No more cross on top
if ( !cg.snap->ps.ammo[ i ] ) {
CG_DrawPic( x, y, 32, 32, cgs.media.noammoShader );
}
x += 40;
}
// Draw the selected name
if ( cg_weapons[ cg.weaponSelect ].item ) {
name = cg_weapons[ cg.weaponSelect ].item->pickup_name;
if ( name ) {
w = CG_DrawStrlen( name ) * BIGCHAR_WIDTH;
x = ( SCREEN_WIDTH -w ) / 2;
CG_DrawBigStringColor(x, y - 22, name, color);
}
}
trap_R_SetColor( NULL );
}
/*
===============