Partial hud implementation

This commit is contained in:
Ryan Baldwin 2022-07-02 16:15:25 -07:00
parent e49548ff5a
commit d97e3fcea2
10 changed files with 156 additions and 128 deletions

Binary file not shown.

Binary file not shown.

View file

@ -1152,8 +1152,8 @@ void HUD_ProgressBar (void)
progressbar = 100 - ((cl.progress_bar-sv.time)*10); progressbar = 100 - ((cl.progress_bar-sv.time)*10);
if (progressbar >= 100) if (progressbar >= 100)
progressbar = 100; progressbar = 100;
Draw_FillByColor ((vid.width)/2 - 51, vid.height*0.75 - 1, 102, 5, GU_RGBA(0, 0, 0,100)); Draw_FillByColor ((vid.width)/2 - 51, vid.height*0.75 - 1, 102, 5, 0, 0, 0,100);
Draw_FillByColor ((vid.width)/2 - 50, vid.height*0.75, progressbar, 3, GU_RGBA(255, 255, 255,100)); Draw_FillByColor ((vid.width)/2 - 50, vid.height*0.75, progressbar, 3, 255, 255, 255,100);
Draw_String ((vid.width - (88))/2, vid.height*0.75 + 10, "Reviving..."); Draw_String ((vid.width - (88))/2, vid.height*0.75 + 10, "Reviving...");
} }
@ -1391,27 +1391,27 @@ void HUD_Draw (void)
return; return;
} }
// HUD_Blood(); HUD_Blood();
// HUD_Rounds(); HUD_Rounds();
// HUD_Perks(); HUD_Perks();
// HUD_Powerups(); HUD_Powerups();
// HUD_ProgressBar(); HUD_ProgressBar();
// if ((HUD_Change_time > Sys_FloatTime() || GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 1) >= cl.stats[STAT_CURRENTMAG] || GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 0) >= cl.stats[STAT_AMMO]) && cl.stats[STAT_HEALTH] >= 20) if ((HUD_Change_time > Sys_FloatTime() || GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 1) >= cl.stats[STAT_CURRENTMAG] || GetLowAmmo(cl.stats[STAT_ACTIVEWEAPON], 0) >= cl.stats[STAT_AMMO]) && cl.stats[STAT_HEALTH] >= 20)
// { //these elements are only drawn when relevant for few seconds { //these elements are only drawn when relevant for few seconds
// HUD_Ammo(); HUD_Ammo();
// HUD_Grenades(); HUD_Grenades();
// HUD_Weapon(); HUD_Weapon();
// HUD_AmmoString(); HUD_AmmoString();
// } }
// HUD_Points(); HUD_Points();
// HUD_Point_Change(); HUD_Point_Change();
// HUD_Achievement(); HUD_Achievement();
//
// if (domaxammo == true) { if (domaxammo == true) {
// if (maxammoopac <= 0) { if (maxammoopac <= 0) {
// maxammoopac = 255; maxammoopac = 255;
// maxammoy = 250; maxammoy = 250;
// } }
// HUD_MaxAmmo(); HUD_MaxAmmo();
// } }
} }

View file

@ -35,7 +35,7 @@ void Draw_ConsoleBackground (int lines);
void Draw_BeginDisc (void); void Draw_BeginDisc (void);
void Draw_EndDisc (void); void Draw_EndDisc (void);
void Draw_TileClear (int x, int y, int w, int h); void Draw_TileClear (int x, int y, int w, int h);
void Draw_Fill (int x, int y, int w, int h, int c); void Draw_Fill (int x, int y, int w, int h, int r, int g, int b);
void Draw_FadeScreen (void); void Draw_FadeScreen (void);
void Draw_String (int x, int y, char *str); void Draw_String (int x, int y, char *str);
void Draw_ColoredString(int x, int y, char *text, float r, float g, float b, float a, int scale); void Draw_ColoredString(int x, int y, char *text, float r, float g, float b, float a, int scale);

View file

@ -610,6 +610,56 @@ void Draw_Character (int x, int y, int num)
glEnd (); glEnd ();
} }
/*
================
Draw_CharacterRGBA
This is the same as Draw_Character, but with RGBA color codes.
- MotoLegacy
================
*/
extern cvar_t scr_coloredtext;
void Draw_CharacterRGBA(int x, int y, int num, float r, float g, float b, float a)
{
byte *dest;
byte *source;
unsigned short *pusdest;
int drawline;
int row, col;
float frow, fcol, size;
if (num == 32)
return; // space
num &= 255;
if (y <= -8)
return; // totally off screen
row = num>>4;
col = num&15;
frow = row*0.0625;
fcol = col*0.0625;
size = 0.0625;
Con_Printf("");
//glColor4f(r/255, g/255, b/255, a/255);
GL_Bind (char_texture);
glBegin (GL_QUADS);
glTexCoord2f (fcol, frow);
glVertex2f (x, y);
glTexCoord2f (fcol + size, frow);
glVertex2f (x+8, y);
glTexCoord2f (fcol + size, frow + size);
glVertex2f (x+8, y+8);
glTexCoord2f (fcol, frow + size);
glVertex2f (x, y+8);
glEnd ();
}
/* /*
================ ================
Draw_String Draw_String
@ -688,7 +738,60 @@ Draw_Pic
*/ */
void Draw_Pic (int x, int y, qpic_t *pic) void Draw_Pic (int x, int y, qpic_t *pic)
{ {
Draw_ColorPic (x, y, pic, 255, 255, 255, 255); //Draw_ColorPic (x, y, pic, 255, 255, 255, 255);
byte *dest, *source;
unsigned short *pusdest;
int v, u;
glpic_t *gl;
if (scrap_dirty)
Scrap_Upload ();
gl = (glpic_t *)pic->data;
glColor4f (1,1,1,1);
GL_Bind (gl->texnum);
glBegin (GL_QUADS);
glTexCoord2f (gl->sl, gl->tl);
glVertex2f (x, y);
glTexCoord2f (gl->sh, gl->tl);
glVertex2f (x+pic->width, y);
glTexCoord2f (gl->sh, gl->th);
glVertex2f (x+pic->width, y+pic->height);
glTexCoord2f (gl->sl, gl->th);
glVertex2f (x, y+pic->height);
glEnd ();
}
/*
=============
Draw_StretchPic
=============
*/
void Draw_StretchPic (int x, int y, qpic_t *pic, int x_value, int y_value)
{
// naievil -- fixme This does not stretch
byte *dest, *source;
unsigned short *pusdest;
int v, u;
glpic_t *gl;
if (scrap_dirty)
Scrap_Upload ();
gl = (glpic_t *)pic->data;
glColor4f (1,1,1,1);
GL_Bind (gl->texnum);
glBegin (GL_QUADS);
glTexCoord2f (gl->sl, gl->tl);
glVertex2f (x, y);
glTexCoord2f (gl->sh, gl->tl);
glVertex2f (x+pic->width, y);
glTexCoord2f (gl->sh, gl->th);
glVertex2f (x+pic->width, y+pic->height);
glTexCoord2f (gl->sl, gl->th);
glVertex2f (x, y+pic->height);
glEnd ();
} }
/* /*
@ -833,6 +936,18 @@ void Draw_TileClear (int x, int y, int w, int h)
glEnd (); glEnd ();
} }
/*
=============
Draw_FillByColor
Fills a box of pixels with a single color
=============
*/
void Draw_FillByColor (int x, int y, int w, int h, int r, int g, int b)
{
// naievil -- fixme does not do any color mod
Draw_Fill(x, y, w, h, r, g, b);
}
/* /*
============= =============
@ -841,12 +956,10 @@ Draw_Fill
Fills a box of pixels with a single color Fills a box of pixels with a single color
============= =============
*/ */
void Draw_Fill (int x, int y, int w, int h, int c) void Draw_Fill (int x, int y, int w, int h, int r, int g, int b)
{ {
glDisable (GL_TEXTURE_2D); glDisable (GL_TEXTURE_2D);
glColor3f (host_basepal[c*3]/255.0, glColor3f (r/255, g/255, b/255);
host_basepal[c*3+1]/255.0,
host_basepal[c*3+2]/255.0);
glBegin (GL_QUADS); glBegin (GL_QUADS);
@ -1120,8 +1233,8 @@ Draw_Crosshair
extern float crosshair_opacity; extern float crosshair_opacity;
void Draw_Crosshair (void) void Draw_Crosshair (void)
{ {
if (cl.stats[STAT_HEALTH] < 20) if (cl.stats[STAT_HEALTH] < 20)
return; return;
if (!crosshair_opacity) if (!crosshair_opacity)

View file

@ -700,96 +700,6 @@ void DrawGLPolyLightmap (glpoly_t *p)
glEnd (); glEnd ();
} }
/*
================
R_BlendLightmaps
================
*/
/*
void R_BlendLightmaps (void)
{
int i, j;
glpoly_t *p;
float *v;
glRect_t *theRect;
if (r_fullbright.value)
return;
if (!gl_texsort.value)
return;
glDepthMask (0); // don't bother writing Z
if (gl_lightmap_format == GL_LUMINANCE)
glBlendFunc (GL_ZERO, GL_ONE_MINUS_SRC_COLOR);
else if (gl_lightmap_format == GL_INTENSITY)
{
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f (0,0,0,1);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
if (!r_lightmap.value)
{
glEnable (GL_BLEND);
}
for (i=0 ; i<MAX_LIGHTMAPS ; i++)
{
p = lightmap_polys[i];
if (!p)
continue;
GL_Bind(lightmap_textures+i);
if (lightmap_modified[i])
{
lightmap_modified[i] = false;
theRect = &lightmap_rectchange[i];
// glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes
// , BLOCK_WIDTH, BLOCK_HEIGHT, 0,
// gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps+i*BLOCK_WIDTH*BLOCK_HEIGHT*lightmap_bytes);
// glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes
// , BLOCK_WIDTH, theRect->h, 0,
// gl_lightmap_format, GL_UNSIGNED_BYTE, lightmaps+(i*BLOCK_HEIGHT+theRect->t)*BLOCK_WIDTH*lightmap_bytes);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t,
BLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE,
lightmaps+(i* BLOCK_HEIGHT + theRect->t) *BLOCK_WIDTH*lightmap_bytes);
theRect->l = BLOCK_WIDTH;
theRect->t = BLOCK_HEIGHT;
theRect->h = 0;
theRect->w = 0;
}
for ( ; p ; p=p->chain)
{
if (p->flags & SURF_UNDERWATER)
DrawGLWaterPolyLightmap (p);
else
{
glBegin (GL_POLYGON);
v = p->verts[0];
for (j=0 ; j<p->numverts ; j++, v+= VERTEXSIZE)
{
glTexCoord2f (v[5], v[6]);
glVertex3fv (v);
}
glEnd ();
}
}
}
glDisable (GL_BLEND);
if (gl_lightmap_format == GL_LUMINANCE)
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
else if (gl_lightmap_format == GL_INTENSITY)
{
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glColor4f (1,1,1,1);
}
glDepthMask (1); // back to normal Z buffering
}
*/
/* /*
================ ================
R_BlendLightmaps R_BlendLightmaps

View file

@ -97,6 +97,7 @@ extern cvar_t crosshair;
qboolean scr_initialized; // ready to draw qboolean scr_initialized; // ready to draw
qpic_t *hitmark;
qpic_t *scr_ram; qpic_t *scr_ram;
qpic_t *scr_net; qpic_t *scr_net;
qpic_t *scr_turtle; qpic_t *scr_turtle;
@ -463,7 +464,7 @@ void SCR_DrawUseString (void)
l = strlen (scr_usestring); l = strlen (scr_usestring);
x = (vid.width - l*8)/2; x = (vid.width - l*8)/2;
// naievil -- fixme // naievil -- fixme the picture does not show...
Draw_String (x, y, scr_usestring); Draw_String (x, y, scr_usestring);
Draw_Pic (x + button_pic_x*8, y, GetButtonIcon("+use")); Draw_Pic (x + button_pic_x*8, y, GetButtonIcon("+use"));
} }
@ -653,10 +654,14 @@ void SCR_Init (void)
Cmd_AddCommand ("sizeup",SCR_SizeUp_f); Cmd_AddCommand ("sizeup",SCR_SizeUp_f);
Cmd_AddCommand ("sizedown",SCR_SizeDown_f); Cmd_AddCommand ("sizedown",SCR_SizeDown_f);
// naievil -- fixme remove this
scr_ram = Draw_PicFromWad ("ram"); scr_ram = Draw_PicFromWad ("ram");
scr_net = Draw_PicFromWad ("net"); scr_net = Draw_PicFromWad ("net");
scr_turtle = Draw_PicFromWad ("turtle"); scr_turtle = Draw_PicFromWad ("turtle");
hitmark = Draw_CachePic("gfx/hud/hit_marker");
scr_initialized = true; scr_initialized = true;
} }
@ -1288,7 +1293,7 @@ void SCR_UpdateScreen (void)
GL_Set2D (); GL_Set2D ();
// naievil -- fixme // naievil -- fixme
//Draw_Crosshair (); Draw_Crosshair ();
//muff - to show FPS on screen //muff - to show FPS on screen
SCR_DrawFPS (); SCR_DrawFPS ();

View file

@ -171,8 +171,6 @@ static void Check_Gamma (unsigned char *pal)
else else
vid_gamma = Q_atof(com_argv[i+1]); vid_gamma = Q_atof(com_argv[i+1]);
Con_Printf("in check_gamma: %f\n", vid_gamma);
for (i=0 ; i<768 ; i++) for (i=0 ; i<768 ; i++)
{ {
f = pow ( (pal[i]+1)/256.0 , vid_gamma ); f = pow ( (pal[i]+1)/256.0 , vid_gamma );

View file

@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "winquake.h" #include "winquake.h"
#endif #endif
achievement_list_t achievement_list[MAX_ACHIEVEMENTS];
void (*vid_menudrawfn)(void); void (*vid_menudrawfn)(void);
void (*vid_menukeyfn)(int key); void (*vid_menukeyfn)(int key);

View file

@ -65,7 +65,7 @@ cvar_t v_ipitch_level = {"v_ipitch_level", "0.3", false};
cvar_t v_idlescale = {"v_idlescale", "0", false}; cvar_t v_idlescale = {"v_idlescale", "0", false};
cvar_t crosshair = {"crosshair", "0", true}; cvar_t crosshair = {"crosshair", "1", true};
cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", false}; //naievil -- wtf is this? cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", false}; //naievil -- wtf is this?