mirror of
https://github.com/nzp-team/quakespasm.git
synced 2025-02-16 16:41:39 +00:00
Add Draw_AlphaStretchPic to gl_draw to fix blood and sniper stretching
This commit is contained in:
parent
3cc61d792b
commit
4c4598091c
4 changed files with 42 additions and 14 deletions
|
@ -35,6 +35,7 @@ void Draw_StretchPic (int x, int y, qpic_t *pic, int x_value, int y_value);
|
|||
void Draw_Pic (int x, int y, qpic_t *pic);
|
||||
void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha);
|
||||
void Draw_ColorPic (int x, int y, qpic_t *pic, float r, float g, float b, float alpha);
|
||||
void Draw_AlphaStretchPic (int x, int y, int width, int height, float alpha, qpic_t *pic);
|
||||
void Draw_TransPicTranslate (int x, int y, qpic_t *pic, int top, int bottom); //johnfitz -- more parameters
|
||||
void Draw_ConsoleBackground (void); //johnfitz -- removed parameter int lines
|
||||
void Draw_LoadingFill(void);
|
||||
|
|
|
@ -758,6 +758,45 @@ void Draw_Pic (int x, int y, qpic_t *pic)
|
|||
Draw_Pic -- johnfitz -- modified
|
||||
=============
|
||||
*/
|
||||
|
||||
// motolegacy -- ultimate draw function!! probably annihilates gl calls so use wisely lol
|
||||
// TODO: color shifting?
|
||||
void Draw_AlphaStretchPic (int x, int y, int width, int height, float alpha, qpic_t *pic)
|
||||
{
|
||||
glpic_t *gl;
|
||||
|
||||
if (alpha <= 1.0) {
|
||||
glEnable (GL_BLEND);
|
||||
glColor4f (1,1,1,alpha);
|
||||
glDisable (GL_ALPHA_TEST);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
}
|
||||
|
||||
if (scrap_dirty)
|
||||
Scrap_Upload ();
|
||||
|
||||
gl = (glpic_t *)pic->data;
|
||||
GL_Bind (gl->gltexture);
|
||||
glBegin (GL_QUADS);
|
||||
glTexCoord2f (gl->sl, gl->tl);
|
||||
glVertex2f (x, y);
|
||||
glTexCoord2f (gl->sh, gl->tl);
|
||||
glVertex2f (x+width, y);
|
||||
glTexCoord2f (gl->sh, gl->th);
|
||||
glVertex2f (x+width, yheight);
|
||||
glTexCoord2f (gl->sl, gl->th);
|
||||
glVertex2f (x, yheight);
|
||||
glEnd ();
|
||||
|
||||
if (alpha <= 1.0)
|
||||
{
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glDisable (GL_BLEND);
|
||||
glColor4f (1,1,1,1);
|
||||
}
|
||||
}
|
||||
|
||||
void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha)
|
||||
{
|
||||
glpic_t *gl;
|
||||
|
@ -774,14 +813,6 @@ void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha)
|
|||
gl = (glpic_t *)pic->data;
|
||||
GL_Bind (gl->gltexture);
|
||||
glBegin (GL_QUADS);
|
||||
#ifdef VITA // Somehow on Vita it renders just 2/3 of the texture...
|
||||
if (pic == sniper_scope) {
|
||||
gl->sl = 0;
|
||||
gl->tl = 0;
|
||||
gl->sh = 1;
|
||||
gl->th = 1;
|
||||
}
|
||||
#endif
|
||||
glTexCoord2f (gl->sl, gl->tl);
|
||||
glVertex2f (x, y);
|
||||
glTexCoord2f (gl->sh, gl->tl);
|
||||
|
|
|
@ -492,7 +492,7 @@ void HUD_Blood (void)
|
|||
if(alpha < 0.0)
|
||||
return;
|
||||
|
||||
Draw_AlphaPic (0, vid.height/2, fx_blood_lu, alpha);
|
||||
Draw_AlphaStretchPic (0, 0, vid.width, vid.height, alpha, fx_blood_lu);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
@ -1502,11 +1502,7 @@ void SCR_DrawCrosshair (void)
|
|||
else if (crosshair.value && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2)
|
||||
Draw_Character ((vid.width - 8)/4/* + crosshair_x*/, (vid.height - 8)*3/4/* + crosshair_y*/, '.');
|
||||
if (cl.stats[STAT_ZOOM] == 2) {
|
||||
#ifdef VITA
|
||||
Draw_AlphaPic (-vid.width/12 + 2, vid.height/2 - 46, sniper_scope, 1);
|
||||
#else
|
||||
Draw_AlphaPic (0, vid.height/2, sniper_scope, 1);
|
||||
#endif
|
||||
Draw_AlphaStretchPic (0, 0, vid.width, vid.height, alpha, sniper_scope);
|
||||
}
|
||||
if (Hitmark_Time > sv.time) {
|
||||
Draw_Pic ((vid.width/2 - hitmark->width)/2,vid.height/2 + (vid.height/2 - hitmark->height)/2, hitmark);
|
||||
|
|
Loading…
Reference in a new issue