hud alignment cvars!

This commit is contained in:
eukos 2015-08-21 17:40:04 +02:00
parent 11d92b89cf
commit 44fdec28c6
3 changed files with 82 additions and 153 deletions

View file

@ -54,6 +54,12 @@ cvar_t *hud_armor, *hud_armor_posx, *hud_armor_posy, *hud_armor_icon;
cvar_t *hud_ammo, *hud_ammo_posx, *hud_ammo_posy, *hud_ammo_icon;
cvar_t *hud_inv, *hud_inv_posx, *hud_inv_posy, *hud_inv_numbers;
cvar_t *hud_health_align;
cvar_t *hud_armor_align;
cvar_t *hud_ammo_align;
cvar_t *hud_inv_align;
void Sbar_MiniDeathmatchOverlay (void);
void Sbar_DeathmatchOverlay (void);
void M_DrawPic (int x, int y, qpic_t *pic);
@ -284,21 +290,25 @@ void Sbar_Init (void)
hud_health_icon = Cvar_Get ("hud_health_icon", "1", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_health_posx = Cvar_Get ("hud_health_posx", "112", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_health_posy = Cvar_Get ("hud_health_posy", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_health_align = Cvar_Get ("hud_health_align", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_armor = Cvar_Get ("hud_armor", "1", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_armor_icon = Cvar_Get ("hud_armor_icon", "1", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_armor_posx = Cvar_Get ("hud_armor_posx", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_armor_posy = Cvar_Get ("hud_armor_posy", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_armor_align = Cvar_Get ("hud_armor_align", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_ammo = Cvar_Get ("hud_ammo", "1", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_ammo_icon = Cvar_Get ("hud_ammo_icon", "1", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_ammo_posx = Cvar_Get ("hud_ammo_posx", "224", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_ammo_posy = Cvar_Get ("hud_ammo_posy", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_ammo_align = Cvar_Get ("hud_ammo_align", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_inv = Cvar_Get ("hud_inv", "1", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_inv_numbers = Cvar_Get ("hud_inv_numbers", "1", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_inv_posx = Cvar_Get ("hud_inv_posx", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_inv_posy = Cvar_Get ("hud_inv_posy", "-24", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_inv_align = Cvar_Get ("hud_inv_align", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_background = Cvar_Get ("hud_background", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
hud_inv_background = Cvar_Get ("hud_inv_background", "0", CVAR_ARCHIVE | CVAR_ORIGINAL);
@ -314,12 +324,15 @@ void Sbar_Init (void)
Sbar_DrawPic
=============
*/
void Sbar_DrawPic (int x, int y, qpic_t *pic)
void Sbar_DrawPic (int x, int y, qpic_t *pic, int align)
{
if (cl.gametype == GAME_DEATHMATCH)
if (cl.gametype != GAME_DEATHMATCH)
x += ((vid.vconwidth - 320)>>1);
y += (vid.vconheight-SBAR_HEIGHT);
if(align)
y += SBAR_HEIGHT;
else
y += (vid.vconheight-SBAR_HEIGHT);
if (sb_scaled)
Draw_Pic_Scaled (x, y, pic);
@ -328,12 +341,15 @@ void Sbar_DrawPic (int x, int y, qpic_t *pic)
}
void Sbar_DrawPicHalf (int x, int y, qpic_t *pic)
void Sbar_DrawPicHalf (int x, int y, qpic_t *pic, int align)
{
if (cl.gametype == GAME_DEATHMATCH)
if (cl.gametype != GAME_DEATHMATCH)
x += ((vid.vconwidth - 320)>>1);
y += (vid.vconheight-SBAR_HEIGHT);
if(align)
y += SBAR_HEIGHT;
else
y += (vid.vconheight-SBAR_HEIGHT);
if (sb_scaled)
Draw_Pic_Scaled_Two (x, y, pic);
@ -342,28 +358,29 @@ void Sbar_DrawPicHalf (int x, int y, qpic_t *pic)
}
/*
/*x
================
Sbar_DrawCharacter
Draws one solid graphics character
================
*/
void Sbar_DrawCharacter (int x, int y, int num)
void Sbar_DrawCharacter (int x, int y, int num, int align)
{
if (sb_scaled){
if (cl.gametype == GAME_DEATHMATCH)
Draw_Character_Scaled ( x /*+ ((vid.vconwidth - 320)>>1) */ + 4 , y + vid.vconheight-SBAR_HEIGHT, num);
if (cl.gametype != GAME_DEATHMATCH)
x += ((vid.vconwidth - 320)>>1);
if(align)
y += SBAR_HEIGHT;
else
Draw_Character_Scaled ( x + ((vid.vconwidth - 320)>>1) + 4 , y + vid.vconheight-SBAR_HEIGHT, num);
}
y += (vid.vconheight-SBAR_HEIGHT);
if (sb_scaled)
Draw_Character_Scaled ( x /*+ ((vid.vconwidth - 320)>>1) */ + 4 , y, num);
else
{
if (cl.gametype == GAME_DEATHMATCH)
Draw_Character ( x /*+ ((vid.width - 320)>>1) */ + 4 , y + vid.height-SBAR_HEIGHT, num);
else
Draw_Character ( x + ((vid.width - 320)>>1) + 4 , y + vid.height-SBAR_HEIGHT, num);
}
Draw_Character ( x /*+ ((vid.width - 320)>>1) */ + 4 , y, num);
}
/*
@ -431,7 +448,7 @@ Sbar_DrawNum
*/
void Sbar_DrawNum (int x, int y, int num, int digits, int color)
void Sbar_DrawNum (int x, int y, int num, int digits, int color, int align)
{
char str[12];
char *ptr;
@ -452,7 +469,7 @@ void Sbar_DrawNum (int x, int y, int num, int digits, int color)
frame = *ptr -'0';
//Sbar_DrawPic (x,y,sb_nums[color][frame]);
Sbar_DrawPic (x,y,sb_nums[color][frame]);
Sbar_DrawPic (x,y,sb_nums[color][frame], align);
x += 24;
ptr++;
}
@ -605,7 +622,7 @@ void Sbar_DrawInventory (void)
// Background
if(hud_inv_background->value)
Sbar_DrawPic (0, hud_inv_posy->value, sb_ibar);
Sbar_DrawPic (0, hud_inv_posy->value, sb_ibar, (int)hud_inv_align->value);
// weapons
for (i=0 ; i<7 ; i++)
@ -624,7 +641,7 @@ void Sbar_DrawInventory (void)
else
flashon = (flashon%5) + 2;
Sbar_DrawPic (i*24, hud_inv_posy->value+8, sb_weapons[flashon][i]);
Sbar_DrawPic (i*24, hud_inv_posy->value+8, sb_weapons[flashon][i], (int)hud_inv_align->value);
if (flashon > 1)
sb_updates = 0; // force update to remove flash
@ -636,11 +653,11 @@ void Sbar_DrawInventory (void)
{
sprintf (num, "%3i",cl.stats[STAT_SHELLS+i] );
if (num[0] != ' ')
Sbar_DrawCharacter ( (6*i+1)*8 - 2, hud_inv_posy->value, 18 + num[0] - '0');
Sbar_DrawCharacter ( (6*i+1)*8 - 2, hud_inv_posy->value, 18 + num[0] - '0', (int)hud_inv_align->value);
if (num[1] != ' ')
Sbar_DrawCharacter ( (6*i+2)*8 - 2, hud_inv_posy->value, 18 + num[1] - '0');
Sbar_DrawCharacter ( (6*i+2)*8 - 2, hud_inv_posy->value, 18 + num[1] - '0', (int)hud_inv_align->value);
if (num[2] != ' ')
Sbar_DrawCharacter ( (6*i+3)*8 - 2, hud_inv_posy->value, 18 + num[2] - '0');
Sbar_DrawCharacter ( (6*i+3)*8 - 2, hud_inv_posy->value, 18 + num[2] - '0', (int)hud_inv_align->value);
}
@ -659,7 +676,7 @@ void Sbar_DrawInventory (void)
//MED 01/04/97 changed keys
if ((i>1))
{
Sbar_DrawPic (192 + i*16, hud_inv_posy->value + 4, sb_items[i]);
Sbar_DrawPic (192 + i*16, hud_inv_posy->value + 4, sb_items[i], (int)hud_inv_align->value);
}
}
if (time && time > cl.time - 2)
@ -676,7 +693,7 @@ void Sbar_DrawInventory (void)
sb_updates = 0;
}
else
Sbar_DrawPic (320-32 + i*8, hud_inv_posy->value + 4, sb_sigil[i]);
Sbar_DrawPic (320-32 + i*8, hud_inv_posy->value + 4, sb_sigil[i], (int)hud_inv_align->value);
if (time && time > cl.time - 2)
sb_updates = 0;
}
@ -750,14 +767,14 @@ void Sbar_DrawFrags (void)
f = s->frags;
sprintf (num, "%3i",f);
Sbar_DrawCharacter ( (x+1)*8 , -24, num[0]);
Sbar_DrawCharacter ( (x+2)*8 , -24, num[1]);
Sbar_DrawCharacter ( (x+3)*8 , -24, num[2]);
Sbar_DrawCharacter ( (x+1)*8 , -24, num[0], 0);
Sbar_DrawCharacter ( (x+2)*8 , -24, num[1], 0);
Sbar_DrawCharacter ( (x+3)*8 , -24, num[2], 0);
if (k == cl.viewentity - 1)
{
Sbar_DrawCharacter (x*8+2, -24, 16);
Sbar_DrawCharacter ( (x+4)*8-4, -24, 17);
Sbar_DrawCharacter (x*8+2, -24, 16, 0);
Sbar_DrawCharacter ( (x+4)*8-4, -24, 17, 0);
}
x+=4;
}
@ -779,22 +796,22 @@ void Sbar_DrawFace (void)
if ( (cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY) )
== (IT_INVISIBILITY | IT_INVULNERABILITY) )
{
Sbar_DrawPic (hud_health_posx->value, hud_health_posy->value, sb_face_invis_invuln);
Sbar_DrawPic (hud_health_posx->value, hud_health_posy->value, sb_face_invis_invuln, (int)hud_health_align->value);
return;
}
if (cl.items & IT_QUAD)
{
Sbar_DrawPic (hud_health_posx->value, hud_health_posy->value, sb_face_quad );
Sbar_DrawPic (hud_health_posx->value, hud_health_posy->value, sb_face_quad, (int)hud_health_align->value);
return;
}
if (cl.items & IT_INVISIBILITY)
{
Sbar_DrawPic (hud_health_posx->value, hud_health_posy->value, sb_face_invis );
Sbar_DrawPic (hud_health_posx->value, hud_health_posy->value, sb_face_invis, (int)hud_health_align->value);
return;
}
if (cl.items & IT_INVULNERABILITY)
{
Sbar_DrawPic (hud_health_posx->value, hud_health_posy->value, sb_face_invuln);
Sbar_DrawPic (hud_health_posx->value, hud_health_posy->value, sb_face_invuln, (int)hud_health_align->value);
return;
}
@ -810,7 +827,7 @@ void Sbar_DrawFace (void)
}
else
anim = 0;
Sbar_DrawPic (hud_health_posx->value, hud_health_posy->value, sb_faces[f][anim]);
Sbar_DrawPic (hud_health_posx->value, hud_health_posy->value, sb_faces[f][anim], (int)hud_health_align->value);
}
/*
@ -822,29 +839,29 @@ void Sbar_DrawNormal (void)
{
// Background
if(hud_background->value)
Sbar_DrawPic (0, 0, sb_sbar);
Sbar_DrawPic (0, 0, sb_sbar, 0);
// armor
if(hud_armor->value)
if (cl.items & IT_INVULNERABILITY)
{
Sbar_DrawNum (hud_armor_posx->value + 24, hud_armor_posy->value, 666, 3, 1);
Sbar_DrawNum (hud_armor_posx->value + 24, hud_armor_posy->value, 666, 3, 1, (int)hud_armor_align->value);
if(hud_armor_icon->value)
Sbar_DrawPic (hud_armor_posx->value, hud_armor_posy->value, draw_disc);
Sbar_DrawPic (hud_armor_posx->value, hud_armor_posy->value, draw_disc, (int)hud_armor_align->value);
}
else
{
Sbar_DrawNum (hud_armor_posx->value + 24, hud_armor_posy->value, cl.stats[STAT_ARMOR], 3
, cl.stats[STAT_ARMOR] <= 25);
, cl.stats[STAT_ARMOR] <= 25, (int)hud_armor_align->value);
if(hud_armor_icon->value)
if (cl.items & IT_ARMOR3)
Sbar_DrawPic (hud_armor_posx->value, hud_armor_posy->value, sb_armor[2]);
Sbar_DrawPic (hud_armor_posx->value, hud_armor_posy->value, sb_armor[2], (int)hud_armor_align->value);
else if (cl.items & IT_ARMOR2)
Sbar_DrawPic (hud_armor_posx->value, hud_armor_posy->value, sb_armor[1]);
Sbar_DrawPic (hud_armor_posx->value, hud_armor_posy->value, sb_armor[1], (int)hud_armor_align->value);
else if (cl.items & IT_ARMOR1)
Sbar_DrawPic (hud_armor_posx->value, hud_armor_posy->value, sb_armor[0]);
Sbar_DrawPic (hud_armor_posx->value, hud_armor_posy->value, sb_armor[0], (int)hud_armor_align->value);
}
@ -853,7 +870,7 @@ void Sbar_DrawNormal (void)
if(hud_health_icon->value)
Sbar_DrawFace ();
Sbar_DrawNum (hud_health_posx->value + 24, hud_health_posy->value, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25);
Sbar_DrawNum (hud_health_posx->value + 24, hud_health_posy->value, cl.stats[STAT_HEALTH], 3, cl.stats[STAT_HEALTH] <= 25, (int)hud_health_align->value);
}
// ammo icon
@ -861,98 +878,16 @@ void Sbar_DrawNormal (void)
{
if(hud_ammo_icon->value)
if (cl.items & IT_SHELLS)
Sbar_DrawPic (hud_ammo_posx->value, hud_ammo_posy->value, sb_ammo[0]);
Sbar_DrawPic (hud_ammo_posx->value, hud_ammo_posy->value, sb_ammo[0], (int)hud_ammo_align->value);
else if (cl.items & IT_NAILS)
Sbar_DrawPic (hud_ammo_posx->value, hud_ammo_posy->value, sb_ammo[1]);
Sbar_DrawPic (hud_ammo_posx->value, hud_ammo_posy->value, sb_ammo[1], (int)hud_ammo_align->value);
else if (cl.items & IT_ROCKETS)
Sbar_DrawPic (hud_ammo_posx->value, hud_ammo_posy->value, sb_ammo[2]);
Sbar_DrawPic (hud_ammo_posx->value, hud_ammo_posy->value, sb_ammo[2], (int)hud_ammo_align->value);
else if (cl.items & IT_CELLS)
Sbar_DrawPic (hud_ammo_posx->value, hud_ammo_posy->value, sb_ammo[3]);
Sbar_DrawPic (hud_ammo_posx->value, hud_ammo_posy->value, sb_ammo[3], (int)hud_ammo_align->value);
Sbar_DrawNum (hud_ammo_posx->value + 24, hud_ammo_posy->value, cl.stats[STAT_AMMO], 3
, cl.stats[STAT_AMMO] <= 10);
}
}
void Sbar_DrawNodrmal (void)
{
qboolean headsup;
char st[512];
if (scr_con_current == vid.height)
return; // console is full screen
if ((sb_updates >= vid.numpages))
return;
scr_copyeverything = 1;
sb_updates++;
if (vid.width > 320)
Draw_TileClear (0, vid.height - 24, vid.width, 24);
Sbar_DrawInventory ();
if (cl.maxclients != 1)
Sbar_DrawFrags ();
if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
{
Sbar_DrawPic (0, 0, sb_scorebar);
Sbar_DrawScoreboard ();
sb_updates = 0;
}
else
{
Sbar_DrawPic (0, 0, sb_sbar);
// armor
if (cl.items & IT_INVULNERABILITY)
{
Sbar_DrawNum (24, 0, 666, 3, 1);
Sbar_DrawPic (0, 0, draw_disc);
}
else
{
Sbar_DrawNum (24, 0, cl.stats[STAT_ARMOR], 3, cl.stats[STAT_ARMOR] <= 25);
if (cl.items & IT_ARMOR3)
Sbar_DrawPic (0, 0, sb_armor[2]);
else if (cl.items & IT_ARMOR2)
Sbar_DrawPic (0, 0, sb_armor[1]);
else if (cl.items & IT_ARMOR1)
Sbar_DrawPic (0, 0, sb_armor[0]);
}
// face
Sbar_DrawFace ();
// health
Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3
, cl.stats[STAT_HEALTH] <= 25);
// ammo icon
if (cl.items & IT_SHELLS)
Sbar_DrawPic (224, 0, sb_ammo[0]);
else if (cl.items & IT_NAILS)
Sbar_DrawPic (224, 0, sb_ammo[1]);
else if (cl.items & IT_ROCKETS)
Sbar_DrawPic (224, 0, sb_ammo[2]);
else if (cl.items & IT_CELLS)
Sbar_DrawPic (224, 0, sb_ammo[3]);
Sbar_DrawNum (248, 0, cl.stats[STAT_AMMO], 3,
cl.stats[STAT_AMMO] <= 10);
}
if (vid.width > 320) {
if (cl.gametype == GAME_DEATHMATCH)
Sbar_MiniDeathmatchOverlay ();
, cl.stats[STAT_AMMO] <= 10, (int)hud_ammo_align->value);
}
}
@ -991,7 +926,7 @@ void Sbar_Draw (void)
if (sb_showscores || cl.stats[STAT_HEALTH] <= 0)
{
Sbar_DrawPic (0, 0, sb_scorebar);
Sbar_DrawPic (0, 0, sb_scorebar, 0);
Sbar_DrawScoreboard ();
sb_updates = 0;
}

View file

@ -1341,27 +1341,8 @@ extern client_state_t clsplit;
void SCR_ReallyRender (void)
{
#ifdef WATERREFLECTIONS
if(waterinsight && reflectavailable && r_waterquality->value > 1 && !r_dowarp && !r_docrap){
reflectpass = 1;
V_RenderView ();
reflectpass = 0;
V_RenderView ();
}
else
{
reflectpass = 0;
V_RenderView ();
}
#else
reflectpass = 0;
V_RenderView ();
#endif
}
int dontevendraw;

View file

@ -549,6 +549,18 @@ void V_cshift_f (void)
cshift_empty.percent = atoi(Cmd_Argv(4));
}
/*
==================
V_cshift_f
==================
*/
void V_cshift_WaterColor_f (void)
{
cshift_water.destcolor[0] = atoi(Cmd_Argv(1));
cshift_water.destcolor[1] = atoi(Cmd_Argv(2));
cshift_water.destcolor[2] = atoi(Cmd_Argv(3));
cshift_water.percent = atoi(Cmd_Argv(4));
}
/*
==================
@ -2178,6 +2190,7 @@ V_Init
void V_Init (void)
{
Cmd_AddCommand ("v_cshift", V_cshift_f);
Cmd_AddCommand ("v_cshift_watercolor", V_cshift_WaterColor_f);
Cmd_AddCommand ("bf", V_BonusFlash_f);
Cmd_AddCommand ("centerview", V_StartPitchDrift);