Merge pull request #16 from ScatterBox/main

This commit is contained in:
Ian 2023-01-22 17:51:57 -05:00 committed by GitHub
commit 6fa47ed68d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 71 additions and 6 deletions

View file

@ -30,6 +30,7 @@ extern qpic_t *draw_disc; // also used on sbar
void Draw_Init (void); void Draw_Init (void);
void Draw_Character (int x, int y, int num); void Draw_Character (int x, int y, int num);
void Draw_CharacterRGBA(int x, int y, int num, float r, float g, float b, float a); //sB
void Draw_DebugChar (char num); void Draw_DebugChar (char num);
void Draw_StretchPic (int x, int y, qpic_t *pic, int x_value, int y_value); 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_Pic (int x, int y, qpic_t *pic);

View file

@ -553,6 +553,60 @@ 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 and ported to Quakespasm by sB :)
================
*/
void Draw_CharacterRGBA(int x, int y, int num, float r, float g, float b, float a)
{
int row, col;
float frow, fcol, size;
if (y <= -8)
return; // totally off screen
num &= 255;
if (num == 32)
return; //don't waste verts on spaces
glEnable (GL_BLEND);
glColor4f(r, g, b, a);
glDisable (GL_ALPHA_TEST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
GL_Bind (char_texture);
glBegin (GL_QUADS);
row = num>>4;
col = num&15;
frow = row*0.0625;
fcol = col*0.0625;
size = 0.0625;
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 ();
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable(GL_ALPHA_TEST);
glDisable (GL_BLEND);
glColor4f (1,1,1,1);
}
/* /*
================ ================
Draw_String -- johnfitz -- modified to call Draw_CharacterQuad Draw_String -- johnfitz -- modified to call Draw_CharacterQuad

View file

@ -1449,6 +1449,15 @@ void SCR_DrawCrosshair (void)
if (cl.stats[STAT_HEALTH] < 20 || paused_hack == true || m_state == m_exit) { if (cl.stats[STAT_HEALTH] < 20 || paused_hack == true || m_state == m_exit) {
return; return;
} }
float col;
if (sv_player->v.facingenemy == 1) {
col = 0;
} else {
col = 255;
}
#ifdef VITA #ifdef VITA
GL_SetCanvas(CANVAS_HUD); GL_SetCanvas(CANVAS_HUD);
#else #else
@ -1472,7 +1481,7 @@ void SCR_DrawCrosshair (void)
if (cl.stats[STAT_ACTIVEWEAPON] == W_M2) if (cl.stats[STAT_ACTIVEWEAPON] == W_M2)
{ {
Draw_Character ((vid.width)/4-4, (vid.height)*3/4, 'O'); Draw_CharacterRGBA ((vid.width)/4-4, (vid.height)*3/4, 'O', 255, col, col, 0.7);
} }
else if (crosshair.value == 1 && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2 && cl.stats[STAT_ACTIVEWEAPON] != W_PANZER) else if (crosshair.value == 1 && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2 && cl.stats[STAT_ACTIVEWEAPON] != W_PANZER)
{ {
@ -1485,22 +1494,22 @@ void SCR_DrawCrosshair (void)
x_value = ((vid.width - 8)/4) - crosshair_offset_step; x_value = ((vid.width - 8)/4) - crosshair_offset_step;
y_value = (vid.height - 8)*3/4; y_value = (vid.height - 8)*3/4;
Draw_Character (x_value, y_value, 158); Draw_CharacterRGBA (x_value, y_value, 158, 255, col, col, 0.7);
x_value = ((vid.width - 8)/4) + crosshair_offset_step; x_value = ((vid.width - 8)/4) + crosshair_offset_step;
y_value = (vid.height - 8)*3/4; y_value = (vid.height - 8)*3/4;
Draw_Character (x_value, y_value, 158); Draw_CharacterRGBA (x_value, y_value, 158, 255, col, col, 0.7);
x_value = ((vid.width - 8)/4); x_value = ((vid.width - 8)/4);
y_value = (vid.height - 8)*3/4 - crosshair_offset_step; y_value = (vid.height - 8)*3/4 - crosshair_offset_step;
Draw_Character (x_value, y_value, 157); Draw_CharacterRGBA (x_value, y_value, 157, 255, col, col, 0.7);
x_value = ((vid.width - 8)/4); x_value = ((vid.width - 8)/4);
y_value = (vid.height - 8)*3/4 + crosshair_offset_step; y_value = (vid.height - 8)*3/4 + crosshair_offset_step;
Draw_Character (x_value, y_value, 157); Draw_CharacterRGBA (x_value, y_value, 157, 255, col, col, 0.7);
} }
else if (crosshair.value && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2) 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*/, '.'); Draw_CharacterRGBA ((vid.width - 8)/4/* + crosshair_x*/, (vid.height - 8)*3/4/* + crosshair_y*/, '.', 255, col, col, 0.7);
if (cl.stats[STAT_ZOOM] == 2) { if (cl.stats[STAT_ZOOM] == 2) {
Draw_AlphaStretchPic (0, 0, vid.width, vid.height, 1, sniper_scope); Draw_AlphaStretchPic (0, 0, vid.width, vid.height, 1, sniper_scope);
} }

View file

@ -161,6 +161,7 @@ typedef struct
float Flash_Size; float Flash_Size;
float currentmag2; float currentmag2;
float maxspeed; float maxspeed;
float facingenemy;
float renderGrayscale; float renderGrayscale;
vec3_t colormod; vec3_t colormod;
vec3_t glowmod; vec3_t glowmod;