mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-25 13:21:04 +00:00
QW's crosshair 2 and crosshaircolor now work in UQ. Also because I felt
like adding a gratuitious feature, GL target users can crosshair 3 for a completely new crosshair and higher resolution crosshair (oooh!) Software renderer doesn't have it because...well look at Draw_Crosshair() in draw.c, it's truly a nightmare! You have to plot each pixel individually, makes you feel like you're coding in Applesoft BASIC. If you want it, figure out how to do it sanely.
This commit is contained in:
parent
cfa702ec38
commit
d5217418ec
3 changed files with 66 additions and 14 deletions
|
@ -278,6 +278,7 @@ void Draw_Crosshair(void)
|
||||||
if (crosshair.value == 2) {
|
if (crosshair.value == 2) {
|
||||||
x = scr_vrect.x + scr_vrect.width/2 + cl_crossx.value;
|
x = scr_vrect.x + scr_vrect.width/2 + cl_crossx.value;
|
||||||
y = scr_vrect.y + scr_vrect.height/2 + cl_crossy.value;
|
y = scr_vrect.y + scr_vrect.height/2 + cl_crossy.value;
|
||||||
|
// FIXME: Find a better way to do this...
|
||||||
Draw_Pixel(x - 1, y, c);
|
Draw_Pixel(x - 1, y, c);
|
||||||
Draw_Pixel(x - 3, y, c);
|
Draw_Pixel(x - 3, y, c);
|
||||||
Draw_Pixel(x + 1, y, c);
|
Draw_Pixel(x + 1, y, c);
|
||||||
|
|
|
@ -36,7 +36,8 @@ qpic_t *draw_backtile;
|
||||||
|
|
||||||
int translate_texture;
|
int translate_texture;
|
||||||
int char_texture;
|
int char_texture;
|
||||||
int cs_texture; // crosshair texture
|
int cs_texture; // crosshair 2 texture
|
||||||
|
int cs_texture3; // crosshair 3 texture
|
||||||
|
|
||||||
static byte cs_data[64] = {
|
static byte cs_data[64] = {
|
||||||
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff,
|
||||||
|
@ -49,6 +50,30 @@ static byte cs_data[64] = {
|
||||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static byte cs_data3[256] = {
|
||||||
|
0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,
|
||||||
|
0xfe,0xfe,0xfe,0xff,0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,
|
||||||
|
0xff,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xff,0xfe,0xfe,0xff,0xff,
|
||||||
|
0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xff,
|
||||||
|
0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,
|
||||||
|
0xff,0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,
|
||||||
|
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||||
|
0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||||
|
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||||
|
0xff,0xff,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xff,0xfe,
|
||||||
|
0xff,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,
|
||||||
|
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||||
|
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,
|
||||||
|
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,
|
||||||
|
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xff,0xff,
|
||||||
|
0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,0xff,0xfe,0xfe,0xff,
|
||||||
|
0xfe,0xfe,0xff,0xff,0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xff,
|
||||||
|
0xff,0xfe,0xfe,0xff,0xfe,0xfe,0xfe,0xfe,0xff,0xff,0xff,0xfe,
|
||||||
|
0xff,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xff,0xfe,0xfe,0xfe,0xfe,
|
||||||
|
0xff,0xff,0xff,0xfe,0xff,0xff,0xff,0xfe,0xfe,0xfe,0xfe,0xff,
|
||||||
|
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||||
|
0xff,0xff,0xff,0xff};
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -351,9 +376,9 @@ void Draw_Init (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
qpic_t *cb;
|
qpic_t *cb;
|
||||||
byte *dest;
|
// byte *dest;
|
||||||
int x;
|
// int x;
|
||||||
char ver[40];
|
// char ver[40];
|
||||||
glpic_t *gl;
|
glpic_t *gl;
|
||||||
int start;
|
int start;
|
||||||
byte *ncdata;
|
byte *ncdata;
|
||||||
|
@ -380,8 +405,14 @@ void Draw_Init (void)
|
||||||
|
|
||||||
// now turn them into textures
|
// now turn them into textures
|
||||||
char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false, true);
|
char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false, true);
|
||||||
// Draw_CrosshairAdjust();
|
cs_texture3 = GL_LoadTexture ("crosshair3", 16, 16, cs_data3,
|
||||||
|
false, true);
|
||||||
cs_texture = GL_LoadTexture ("crosshair", 8, 8, cs_data, false, true);
|
cs_texture = GL_LoadTexture ("crosshair", 8, 8, cs_data, false, true);
|
||||||
|
// For some reason which I cannot claim to fathom, it seems to be
|
||||||
|
// necessary to call GL_LoadTexture() here in descending (in terms
|
||||||
|
// of size) order else things don't work right. No idea why this
|
||||||
|
// is so.
|
||||||
|
// - knghtbrd (2 Jan 2000)
|
||||||
|
|
||||||
start = Hunk_LowMark ();
|
start = Hunk_LowMark ();
|
||||||
|
|
||||||
|
@ -535,7 +566,30 @@ void Draw_Crosshair(void)
|
||||||
extern vrect_t scr_vrect;
|
extern vrect_t scr_vrect;
|
||||||
unsigned char *pColor;
|
unsigned char *pColor;
|
||||||
|
|
||||||
if (crosshair.value == 2) {
|
if (crosshair.value == 3) {
|
||||||
|
x = scr_vrect.x + scr_vrect.width/2 - 3 + cl_crossx.value;
|
||||||
|
y = scr_vrect.y + scr_vrect.height/2 - 3 + cl_crossy.value;
|
||||||
|
|
||||||
|
glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
|
||||||
|
pColor = (unsigned char *) &d_8to24table[(byte) crosshaircolor.value];
|
||||||
|
glColor4ubv ( pColor );
|
||||||
|
GL_Bind (cs_texture3);
|
||||||
|
|
||||||
|
glBegin (GL_QUADS);
|
||||||
|
|
||||||
|
glTexCoord2f (0, 0);
|
||||||
|
glVertex2f (x - 7, y - 7);
|
||||||
|
glTexCoord2f (1, 0);
|
||||||
|
glVertex2f (x + 9, y - 7);
|
||||||
|
glTexCoord2f (1, 1);
|
||||||
|
glVertex2f (x + 9, y + 9);
|
||||||
|
glTexCoord2f (0, 1);
|
||||||
|
glVertex2f (x - 7, y + 9);
|
||||||
|
|
||||||
|
glEnd ();
|
||||||
|
|
||||||
|
glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||||
|
} else if (crosshair.value == 2) {
|
||||||
x = scr_vrect.x + scr_vrect.width/2 - 3 + cl_crossx.value;
|
x = scr_vrect.x + scr_vrect.width/2 - 3 + cl_crossx.value;
|
||||||
y = scr_vrect.y + scr_vrect.height/2 - 3 + cl_crossy.value;
|
y = scr_vrect.y + scr_vrect.height/2 - 3 + cl_crossy.value;
|
||||||
|
|
||||||
|
@ -545,14 +599,16 @@ void Draw_Crosshair(void)
|
||||||
GL_Bind (cs_texture);
|
GL_Bind (cs_texture);
|
||||||
|
|
||||||
glBegin (GL_QUADS);
|
glBegin (GL_QUADS);
|
||||||
|
|
||||||
glTexCoord2f (0, 0);
|
glTexCoord2f (0, 0);
|
||||||
glVertex2f (x - 4, y - 4);
|
glVertex2f (x - 4, y - 4);
|
||||||
glTexCoord2f (1, 0);
|
glTexCoord2f (1, 0);
|
||||||
glVertex2f (x+12, y-4);
|
glVertex2f (x + 12, y - 4);
|
||||||
glTexCoord2f (1, 1);
|
glTexCoord2f (1, 1);
|
||||||
glVertex2f (x+12, y+12);
|
glVertex2f (x + 12, y + 12);
|
||||||
glTexCoord2f (0, 1);
|
glTexCoord2f (0, 1);
|
||||||
glVertex2f (x - 4, y+12);
|
glVertex2f (x - 4, y + 12);
|
||||||
|
|
||||||
glEnd ();
|
glEnd ();
|
||||||
|
|
||||||
glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
|
||||||
|
|
|
@ -1058,13 +1058,8 @@ void V_RenderView (void)
|
||||||
|
|
||||||
#ifndef GLQUAKE
|
#ifndef GLQUAKE
|
||||||
if (crosshair.value)
|
if (crosshair.value)
|
||||||
#ifdef OLD_CROSSHAIR
|
|
||||||
Draw_Character (scr_vrect.x + scr_vrect.width/2 + cl_crossx.value,
|
|
||||||
scr_vrect.y + scr_vrect.height/2 + cl_crossy.value, '+');
|
|
||||||
#else
|
|
||||||
Draw_Crosshair();
|
Draw_Crosshair();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue