attempted v_cshift fix for bad gamecode, move gl crosshair code to r2d, default crosshaircolor to 255 255 255 since now crosshaircolor/crosshairalpha work on crosshair 1
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3765 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
795406b8e4
commit
0a1b14b202
8 changed files with 396 additions and 398 deletions
|
@ -1125,19 +1125,6 @@ void CG_Start (void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!R2D_SafeCachePic) //no renderer loaded
|
||||
{
|
||||
CG_Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if (qrenderer != QR_OPENGL && qrenderer != QR_DIRECT3D)
|
||||
{ //sorry.
|
||||
CG_Stop();
|
||||
Host_EndGame("Unable to connect to q3 servers without opengl or d3d.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Z_FreeTags(CGTAGNUM);
|
||||
SCR_BeginLoadingPlaque();
|
||||
|
||||
|
|
|
@ -2203,7 +2203,7 @@ void SCR_DrawTwoDimensional(int uimenu, qboolean nohud)
|
|||
{
|
||||
if (!nohud)
|
||||
{
|
||||
Draw_Crosshair();
|
||||
R2D_DrawCrosshair();
|
||||
|
||||
SCR_DrawNet ();
|
||||
SCR_DrawFPS ();
|
||||
|
|
|
@ -1,355 +0,0 @@
|
|||
//Config for Crosshairs
|
||||
//crosshairs can be altered or added by editing only this file
|
||||
|
||||
//winquake calls this every frame.
|
||||
//gl calls when changed or animating (that's the diference in animated and non animated)
|
||||
|
||||
//don't use a point more than 8 units away from the centre.
|
||||
//default must be non animated
|
||||
|
||||
#ifdef NUMCROSSHAIRS
|
||||
|
||||
//case 0 is no cursor
|
||||
//case 1 is the console text '+'
|
||||
//neither use this file.
|
||||
|
||||
case 2:
|
||||
Pix(0 - 1, 0, c);
|
||||
Pix(0 - 3, 0, c2);
|
||||
Pix(0 + 1, 0, c);
|
||||
Pix(0 + 3, 0, c2);
|
||||
Pix(0, 0 - 1, c);
|
||||
Pix(0, 0 - 3, c2);
|
||||
Pix(0, 0 + 1, c);
|
||||
Pix(0, 0 + 3, c2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Pix(0 - 1, 0, c);
|
||||
Pix(0 - 2, 0, c2);
|
||||
Pix(0 + 1, 0, c);
|
||||
Pix(0 + 2, 0, c2);
|
||||
Pix(0, 0 - 1, c);
|
||||
Pix(0, 0 - 2, c2);
|
||||
Pix(0, 0 + 1, c);
|
||||
Pix(0, 0 + 2, c2);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Pix(0-1, 0-1, c);
|
||||
Pix(0-2, 0-2, c2);
|
||||
Pix(0+1, 0+1, c);
|
||||
Pix(0+2, 0+2, c2);
|
||||
Pix(0-1, 0+1, c);
|
||||
Pix(0-2, 0+2, c2);
|
||||
Pix(0+1, 0-1, c);
|
||||
Pix(0+2, 0-2, c2);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
Pix(0-1, 0-1, c);
|
||||
Pix(0-3, 0-3, c2);
|
||||
Pix(0+1, 0+1, c);
|
||||
Pix(0+3, 0+3, c2);
|
||||
Pix(0-1, 0+1, c);
|
||||
Pix(0-3, 0+3, c2);
|
||||
Pix(0+1, 0-1, c);
|
||||
Pix(0+3, 0-3, c2);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
Pix(0-1, 0-2, c2);
|
||||
Pix(0+1, 0-2, c2);
|
||||
Pix(0-1, 0+2, c2);
|
||||
Pix(0+1, 0+2, c2);
|
||||
Pix(0-2, 0+1, c);
|
||||
Pix(0-2, 0-1, c);
|
||||
Pix(0+2, 0+1, c);
|
||||
Pix(0+2, 0-1, c);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
Pix(0 , 0+2, c);
|
||||
Pix(0+1, 0+1, c2);
|
||||
Pix(0+2, 0 , c);
|
||||
Pix(0+1, 0-1, c2);
|
||||
Pix(0 , 0-2, c);
|
||||
Pix(0-1, 0-1, c2);
|
||||
Pix(0-2, 0 , c);
|
||||
Pix(0-1, 0+1, c2);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
Pix(0 , 0+2, c);
|
||||
Pix(0 , 0-2, c);
|
||||
Pix(0+2, 0 , c2);
|
||||
Pix(0-2, 0 , c2);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
Pix(0 , 0-1, c);
|
||||
Pix(0-2, 0+1, c2);
|
||||
Pix(0+2, 0+1, c2);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
Pix(0 , 0-3, c);
|
||||
Pix(0-2, 0-2, c2);
|
||||
Pix(0 , 0-2, c);
|
||||
Pix(0+2, 0-2, c2);
|
||||
Pix(0-3, 0 , c);
|
||||
Pix(0-2, 0 , c);
|
||||
Pix(0+2, 0 , c);
|
||||
Pix(0+3, 0 , c);
|
||||
Pix(0 , 0+3, c);
|
||||
Pix(0-2, 0+2, c2);
|
||||
Pix(0 , 0+2, c);
|
||||
Pix(0+2, 0+2, c2);
|
||||
break;
|
||||
|
||||
case 11:
|
||||
Pix(0-3, 0-3, c2);
|
||||
Pix(0 , 0-3, c);
|
||||
Pix(0+3, 0-3, c2);
|
||||
Pix(0-2, 0-2, c2);
|
||||
Pix(0 , 0-2, c);
|
||||
Pix(0+2, 0-2, c2);
|
||||
Pix(0-3, 0 , c);
|
||||
Pix(0-2, 0 , c);
|
||||
Pix(0+2, 0 , c);
|
||||
Pix(0+3, 0 , c);
|
||||
Pix(0 , 0+3, c);
|
||||
Pix(0-2, 0+2, c2);
|
||||
Pix(0 , 0+2, c);
|
||||
Pix(0-3, 0+3, c2);
|
||||
Pix(0+2, 0+2, c2);
|
||||
Pix(0+3, 0+3, c2);
|
||||
break;
|
||||
|
||||
case 12:
|
||||
Pix(0-4, 0 , c2);
|
||||
Pix(0-3, 0 , c2);
|
||||
Pix(0-2, 0 , c);
|
||||
Pix(0-1, 0 , c);
|
||||
Pix(0+1, 0 , c);
|
||||
Pix(0+2, 0 , c);
|
||||
Pix(0+3, 0 , c2);
|
||||
Pix(0+4, 0 , c2);
|
||||
break;
|
||||
|
||||
case 13:
|
||||
Pix(0 , 0-4, c2);
|
||||
Pix(0 , 0-3, c2);
|
||||
Pix(0 , 0-2, c);
|
||||
Pix(0 , 0-1, c);
|
||||
Pix(0 , 0+1, c);
|
||||
Pix(0 , 0+2, c);
|
||||
Pix(0 , 0+3, c2);
|
||||
Pix(0 , 0+4, c2);
|
||||
break;
|
||||
|
||||
case 14:
|
||||
Pix(0-4, 0 , c2);
|
||||
Pix(0-3, 0 , c2);
|
||||
Pix(0-2, 0 , c);
|
||||
Pix(0-1, 0 , c);
|
||||
Pix(0+1, 0 , c);
|
||||
Pix(0+2, 0 , c);
|
||||
Pix(0+3, 0 , c2);
|
||||
Pix(0+4, 0 , c2);
|
||||
|
||||
Pix(0 , 0-4, c2);
|
||||
Pix(0 , 0-3, c2);
|
||||
Pix(0 , 0-2, c);
|
||||
Pix(0 , 0-1, c);
|
||||
Pix(0 , 0+1, c);
|
||||
Pix(0 , 0+2, c);
|
||||
Pix(0 , 0+3, c2);
|
||||
Pix(0 , 0+4, c2);
|
||||
break;
|
||||
|
||||
case 15:
|
||||
Pix(0 , 0-4, c);
|
||||
Pix(0-3, 0-3, c2);
|
||||
Pix(0 , 0-3, c);
|
||||
Pix(0+3, 0-3, c2);
|
||||
Pix(0-2, 0-2, c2);
|
||||
Pix(0 , 0-2, c);
|
||||
Pix(0+2, 0-2, c2);
|
||||
Pix(0-4, 0 , c);
|
||||
Pix(0-3, 0 , c);
|
||||
Pix(0-2, 0 , c);
|
||||
Pix(0+2, 0 , c);
|
||||
Pix(0+3, 0 , c);
|
||||
Pix(0+4, 0 , c);
|
||||
Pix(0 , 0+3, c);
|
||||
Pix(0-2, 0+2, c2);
|
||||
Pix(0 , 0+2, c);
|
||||
Pix(0-3, 0+3, c2);
|
||||
Pix(0+2, 0+2, c2);
|
||||
Pix(0+3, 0+3, c2);
|
||||
Pix(0 , 0+4, c);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
Pix(0 , 0 , c);
|
||||
break;
|
||||
|
||||
case 17:
|
||||
Pix(0 , 0 , c);
|
||||
Pix(0 , 1, c2);
|
||||
Pix(0 , 2, c2);
|
||||
Pix( 1, 3, c);
|
||||
Pix( 1, 0 , c2);
|
||||
Pix( 2, 0 , c2);
|
||||
Pix( 3, 1, c);
|
||||
break;
|
||||
|
||||
case 18:
|
||||
Pix(0 , 0 , c);
|
||||
Pix(-2, 0 , c2);
|
||||
Pix(-3, 0 , c2);
|
||||
Pix( 2, 0 , c2);
|
||||
Pix( 3, 0 , c2);
|
||||
Pix(-3, 1 , c2);
|
||||
Pix( 3, 1 , c2);
|
||||
Pix(-3, 2 , c2);
|
||||
Pix( 3, 2 , c2);
|
||||
Pix(-2, 2 , c2);
|
||||
Pix( 2, 2 , c2);
|
||||
Pix(-2, 3 , c2);
|
||||
Pix( 2, 3 , c2);
|
||||
Pix(-1, 3 , c2);
|
||||
Pix( 1, 3 , c2);
|
||||
Pix( 0, 3 , c2);
|
||||
Pix( 0, 4 , c2);
|
||||
break;
|
||||
|
||||
case 19: //tripointer
|
||||
Pix(0 , -1, c); //north
|
||||
Pix(0 , -2, c);
|
||||
Pix(0 , -3, c);
|
||||
|
||||
Pix(1 , 1 , c);
|
||||
Pix(2 , 2 , c);//east
|
||||
Pix(3 , 3 , c);
|
||||
|
||||
Pix(-1, 1 , c);//west
|
||||
Pix(-2, 2 , c);
|
||||
Pix(-3, 3 , c);
|
||||
|
||||
break;
|
||||
|
||||
case 20: //twin circles
|
||||
{
|
||||
#define DEG(a) (a * (3.14 / 180))
|
||||
#define SCLE 8 //don't let it get bigger than 16 wide (+-8)
|
||||
#define SCLE2 4
|
||||
|
||||
int a;
|
||||
#ifndef GLQUAKE
|
||||
for (a = 0; a < 360; a+=5) //softquake doesn't draw as many pixels.
|
||||
#else
|
||||
for (a = 0; a < 360; a+=1) //glquake gets high precision - done less, ya see
|
||||
#endif
|
||||
{
|
||||
Pix((int)(sin(DEG(a)) * SCLE ), (int)(cos(DEG(a)) * SCLE ) , c );
|
||||
Pix((int)(cos(DEG(a)) * SCLE2), (int)(sin(DEG(a)) * SCLE2) , c2);
|
||||
}
|
||||
|
||||
#undef SCLE
|
||||
}
|
||||
break;
|
||||
|
||||
#else
|
||||
//what's the next?
|
||||
#define FIRSTANIMATEDCROSHAIR 21
|
||||
#endif
|
||||
#ifdef NUMCROSSHAIRS
|
||||
|
||||
case FIRSTANIMATEDCROSHAIR: //spinners
|
||||
{
|
||||
#define DEG(a) (a * (3.14 / 180))
|
||||
#define SPEED 6
|
||||
#define SCLE 8 //don't let it get bigger than 16 wide (+-8)
|
||||
#define SCLE2 4
|
||||
#define TIMER realtime
|
||||
Pix((int)(sin(TIMER*SPEED ) * SCLE ), (int)(cos(TIMER*SPEED ) * SCLE ) , c );
|
||||
Pix((int)(sin(TIMER*SPEED+DEG(90 )) * SCLE ), (int)(cos(TIMER*SPEED+DEG(90 )) * SCLE ) , c );
|
||||
Pix((int)(sin(TIMER*SPEED+DEG(180)) * SCLE ), (int)(cos(TIMER*SPEED+DEG(180)) * SCLE ) , c );
|
||||
Pix((int)(sin(TIMER*SPEED+DEG(270)) * SCLE ), (int)(cos(TIMER*SPEED+DEG(270)) * SCLE ) , c );
|
||||
|
||||
Pix((int)(cos(TIMER*SPEED ) * SCLE2), (int)(sin(TIMER*SPEED ) * SCLE2) , c2);
|
||||
Pix((int)(cos(TIMER*SPEED+DEG(90 )) * SCLE2), (int)(sin(TIMER*SPEED+DEG(90 )) * SCLE2) , c2);
|
||||
Pix((int)(cos(TIMER*SPEED+DEG(180)) * SCLE2), (int)(sin(TIMER*SPEED+DEG(180)) * SCLE2) , c2);
|
||||
Pix((int)(cos(TIMER*SPEED+DEG(270)) * SCLE2), (int)(sin(TIMER*SPEED+DEG(270)) * SCLE2) , c2);
|
||||
|
||||
#undef SCLE
|
||||
}
|
||||
break;
|
||||
|
||||
case (FIRSTANIMATEDCROSHAIR+1):
|
||||
{
|
||||
#define DEG(a) (a * (3.14 / 180))
|
||||
#define SPEED 6
|
||||
#define SCLE 4 //don't let it get bigger than 16 wide (+-8)
|
||||
#define TIMER realtime
|
||||
|
||||
Pix((int)(sin(TIMER*SPEED ) * SCLE), (int)(sin(TIMER*SPEED ) * -SCLE) , c );
|
||||
Pix((int)(sin(TIMER*SPEED+DEG(180)) * SCLE), (int)(sin(TIMER*SPEED+DEG(180)) * -SCLE) , c2);
|
||||
|
||||
Pix((int)(cos(TIMER*SPEED ) * SCLE), (int)(cos(TIMER*SPEED ) * SCLE ) , c );
|
||||
Pix((int)(cos(TIMER*SPEED+DEG(180)) * SCLE), (int)(cos(TIMER*SPEED+DEG(180)) * SCLE ) , c2);
|
||||
|
||||
#undef SCLE
|
||||
#undef SPEED
|
||||
}
|
||||
break;
|
||||
|
||||
case (FIRSTANIMATEDCROSHAIR+2):
|
||||
{
|
||||
#define DEG(a) (a * (3.14 / 180))
|
||||
#define SPEED 6
|
||||
#define SCLE 4 //don't let it get bigger than 16 wide (+-8)
|
||||
#define TIMER realtime
|
||||
|
||||
Pix((int)(sin(TIMER*SPEED ) * SCLE), (int)(sin(TIMER*SPEED ) * -SCLE) , c );
|
||||
Pix((int)(sin(TIMER*SPEED+DEG(90)) * SCLE), (int)(sin(TIMER*SPEED+DEG(90)) * -SCLE) , c2);
|
||||
Pix((int)(sin(TIMER*SPEED+DEG(180)) * SCLE), (int)(sin(TIMER*SPEED+DEG(180)) * -SCLE) , c);
|
||||
Pix((int)(sin(TIMER*SPEED+DEG(270)) * SCLE), (int)(sin(TIMER*SPEED+DEG(270)) * -SCLE) , c2);
|
||||
|
||||
Pix((int)(cos(TIMER*SPEED ) * SCLE), (int)(cos(TIMER*SPEED ) * SCLE ) , c );
|
||||
Pix((int)(sin(TIMER*SPEED+DEG(90)) * SCLE), (int)(sin(TIMER*SPEED+DEG(90)) * SCLE) , c2);
|
||||
Pix((int)(cos(TIMER*SPEED+DEG(180)) * SCLE), (int)(cos(TIMER*SPEED+DEG(180)) * SCLE ) , c);
|
||||
Pix((int)(sin(TIMER*SPEED+DEG(270)) * SCLE), (int)(sin(TIMER*SPEED+DEG(270)) * SCLE) , c2);
|
||||
|
||||
#undef SCLE
|
||||
#undef SPEED
|
||||
}
|
||||
break;
|
||||
|
||||
case (FIRSTANIMATEDCROSHAIR+3):
|
||||
{
|
||||
int a;
|
||||
#define DEG(a) (a * (3.14 / 180))
|
||||
#define SPEED 9
|
||||
#define SPEED2 4
|
||||
#define SIZE 8 //don't let it get bigger than 16 wide (+-8)
|
||||
#define SCLE 8
|
||||
#define TIMER realtime
|
||||
|
||||
for (a = -SIZE; a < SIZE; a+=2)
|
||||
{
|
||||
Pix(a, (int)(sin(TIMER*SPEED2) * SCLE), c);
|
||||
Pix((int)(sin(TIMER*SPEED) * SCLE), a, c2);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
#else
|
||||
|
||||
//what did we reach
|
||||
#define NUMCROSSHAIRS FIRSTANIMATEDCROSHAIR+3
|
||||
#define CROSSHAIR_H
|
||||
|
||||
#endif
|
|
@ -58,6 +58,7 @@ extern char *q_renderername;
|
|||
|
||||
mpic_t *R2D_SafeCachePic (char *path);
|
||||
mpic_t *R2D_SafePicFromWad (char *name);
|
||||
void R2D_DrawCrosshair (void);
|
||||
void R2D_ScalePic (int x, int y, int width, int height, mpic_t *pic);
|
||||
void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight);
|
||||
void R2D_TransPicTranslate (int x, int y, int width, int height, qbyte *pic, qbyte *translation);
|
||||
|
@ -75,7 +76,6 @@ void R2D_FillBlock(int x, int y, int w, int h);
|
|||
|
||||
extern void (*Draw_Init) (void);
|
||||
extern void (*Draw_TinyCharacter) (int x, int y, unsigned int num);
|
||||
extern void (*Draw_Crosshair) (void);
|
||||
extern qboolean (*Draw_IsCached) (char *picname); //can be null
|
||||
|
||||
extern void (*R_Init) (void);
|
||||
|
@ -180,7 +180,6 @@ typedef struct rendererinfo_s {
|
|||
|
||||
void (*Draw_Init) (void);
|
||||
void (*Draw_Shutdown) (void);
|
||||
void (*Draw_Crosshair) (void); //TODO: MARKED FOR DEMOLITION
|
||||
|
||||
texid_t (*IMG_LoadTexture) (char *identifier, int width, int height, uploadfmt_t fmt, void *data, unsigned int flags);
|
||||
texid_t (*IMG_LoadTexture8Pal24) (char *identifier, int width, int height, qbyte *data, qbyte *palette24, unsigned int flags);
|
||||
|
|
|
@ -1340,7 +1340,7 @@ static void QCBUILTIN PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s
|
|||
}
|
||||
|
||||
if (csqc_addcrosshair)
|
||||
Draw_Crosshair();
|
||||
R2D_DrawCrosshair();
|
||||
}
|
||||
|
||||
static void QCBUILTIN PF_cs_getstatf(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
|
|
|
@ -8,6 +8,10 @@ texid_t missing_texture;
|
|||
texid_t translate_texture;
|
||||
shader_t *translate_shader;
|
||||
|
||||
texid_t ch_int_texture;
|
||||
vec3_t ch_color;
|
||||
shader_t *shader_crosshair;
|
||||
|
||||
static mpic_t *conback;
|
||||
static mpic_t *draw_backtile;
|
||||
static shader_t *shader_draw_fill, *shader_draw_fill_trans;
|
||||
|
@ -37,6 +41,16 @@ void R2D_ScreenAngle_Callback(struct cvar_s *var, char *oldvalue);
|
|||
void R2D_Conheight_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void R2D_Conwidth_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
extern cvar_t crosshair;
|
||||
extern cvar_t crosshaircolor;
|
||||
extern cvar_t crosshairsize;
|
||||
extern cvar_t crosshairimage;
|
||||
extern cvar_t crosshairalpha;
|
||||
void R2D_Crosshair_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void R2D_CrosshairImage_Callback(struct cvar_s *var, char *oldvalue);
|
||||
void R2D_CrosshairColor_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
|
||||
//We need this for minor things though, so we'll just use the slow accurate method.
|
||||
//this is unlikly to be called too often.
|
||||
qbyte GetPaletteIndex(int red, int green, int blue)
|
||||
|
@ -92,6 +106,7 @@ void R2D_Init(void)
|
|||
|
||||
missing_texture = R_LoadTexture8("no_texture", 16, 16, (unsigned char*)r_notexture_mip + r_notexture_mip->offsets[0], IF_NOALPHA|IF_NOGAMMA, 0);
|
||||
translate_texture = r_nulltex;
|
||||
ch_int_texture = r_nulltex;
|
||||
|
||||
draw_backtile = R_RegisterShader("gfx/backtile.lmp",
|
||||
"{\n"
|
||||
|
@ -201,6 +216,21 @@ void R2D_Init(void)
|
|||
"]\n"
|
||||
"}\n"
|
||||
);
|
||||
shader_crosshair = R_RegisterShader("crosshairshader",
|
||||
"{\n"
|
||||
#ifdef USE_EGL
|
||||
"program default2d\n"
|
||||
#endif
|
||||
"nomipmaps\n"
|
||||
"{\n"
|
||||
"map $diffuse\n"
|
||||
"blendfunc blend\n"
|
||||
"rgbgen vertex\n"
|
||||
"alphagen vertex\n"
|
||||
"}\n"
|
||||
"}\n"
|
||||
);
|
||||
|
||||
|
||||
Cvar_Hook(&gl_font, R2D_Font_Callback);
|
||||
Cvar_Hook(&vid_conautoscale, R2D_Conautoscale_Callback);
|
||||
|
@ -208,9 +238,16 @@ void R2D_Init(void)
|
|||
Cvar_Hook(&vid_conheight, R2D_Conheight_Callback);
|
||||
Cvar_Hook(&vid_conwidth, R2D_Conwidth_Callback);
|
||||
|
||||
Cvar_Hook(&crosshair, R2D_Crosshair_Callback);
|
||||
Cvar_Hook(&crosshairimage, R2D_CrosshairImage_Callback);
|
||||
Cvar_Hook(&crosshaircolor, R2D_CrosshairColor_Callback);
|
||||
|
||||
Cvar_ForceCallback(&gl_conback);
|
||||
Cvar_ForceCallback(&vid_conautoscale);
|
||||
Cvar_ForceCallback(&gl_font);
|
||||
|
||||
Cvar_ForceCallback(&crosshair);
|
||||
Cvar_ForceCallback(&crosshaircolor);
|
||||
}
|
||||
|
||||
mpic_t *R2D_SafeCachePic (char *path)
|
||||
|
@ -694,4 +731,304 @@ void R2D_FadeScreen (void)
|
|||
Sbar_Changed();
|
||||
}
|
||||
|
||||
//crosshairs
|
||||
#define CS_HEIGHT 8
|
||||
#define CS_WIDTH 8
|
||||
unsigned char crosshair_pixels[] =
|
||||
{
|
||||
// 2 + (spaced)
|
||||
0x08,
|
||||
0x00,
|
||||
0x08,
|
||||
0x55,
|
||||
0x08,
|
||||
0x00,
|
||||
0x08,
|
||||
0x00,
|
||||
// 3 +
|
||||
0x00,
|
||||
0x08,
|
||||
0x08,
|
||||
0x36,
|
||||
0x08,
|
||||
0x08,
|
||||
0x00,
|
||||
0x00,
|
||||
// 4 X
|
||||
0x00,
|
||||
0x22,
|
||||
0x14,
|
||||
0x00,
|
||||
0x14,
|
||||
0x22,
|
||||
0x00,
|
||||
0x00,
|
||||
// 5 X (spaced)
|
||||
0x41,
|
||||
0x00,
|
||||
0x14,
|
||||
0x00,
|
||||
0x14,
|
||||
0x00,
|
||||
0x41,
|
||||
0x00,
|
||||
// 6 diamond (unconnected)
|
||||
0x00,
|
||||
0x14,
|
||||
0x22,
|
||||
0x00,
|
||||
0x22,
|
||||
0x14,
|
||||
0x00,
|
||||
0x00,
|
||||
// 7 diamond
|
||||
0x00,
|
||||
0x08,
|
||||
0x14,
|
||||
0x22,
|
||||
0x14,
|
||||
0x08,
|
||||
0x00,
|
||||
0x00,
|
||||
// 8 four points
|
||||
0x00,
|
||||
0x08,
|
||||
0x00,
|
||||
0x22,
|
||||
0x00,
|
||||
0x08,
|
||||
0x00,
|
||||
0x00,
|
||||
// 9 three points
|
||||
0x00,
|
||||
0x00,
|
||||
0x08,
|
||||
0x00,
|
||||
0x22,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
// 10
|
||||
0x08,
|
||||
0x2a,
|
||||
0x00,
|
||||
0x63,
|
||||
0x00,
|
||||
0x2a,
|
||||
0x08,
|
||||
0x00,
|
||||
// 11
|
||||
0x49,
|
||||
0x2a,
|
||||
0x00,
|
||||
0x63,
|
||||
0x00,
|
||||
0x2a,
|
||||
0x49,
|
||||
0x00,
|
||||
// 12 horizontal line
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x77,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
// 13 vertical line
|
||||
0x08,
|
||||
0x08,
|
||||
0x08,
|
||||
0x00,
|
||||
0x08,
|
||||
0x08,
|
||||
0x08,
|
||||
0x00,
|
||||
// 14 larger +
|
||||
0x08,
|
||||
0x08,
|
||||
0x08,
|
||||
0x77,
|
||||
0x08,
|
||||
0x08,
|
||||
0x08,
|
||||
0x00,
|
||||
// 15 angle
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x70,
|
||||
0x08,
|
||||
0x08,
|
||||
0x08,
|
||||
0x00,
|
||||
// 16 dot
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x08,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
// 17 weird angle thing
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x38,
|
||||
0x48,
|
||||
0x08,
|
||||
0x10,
|
||||
0x00,
|
||||
// 18 circle w/ dot
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x6b,
|
||||
0x41,
|
||||
0x63,
|
||||
0x3e,
|
||||
0x08,
|
||||
// 19 tripoint
|
||||
0x08,
|
||||
0x08,
|
||||
0x08,
|
||||
0x00,
|
||||
0x14,
|
||||
0x22,
|
||||
0x41,
|
||||
0x00,
|
||||
};
|
||||
|
||||
void R2D_Crosshair_Update(void)
|
||||
{
|
||||
int crossdata[CS_WIDTH*CS_HEIGHT];
|
||||
int c;
|
||||
int w, h;
|
||||
unsigned char *x;
|
||||
|
||||
c = crosshair.ival;
|
||||
|
||||
if (crosshairimage.string[0] && c == 1)
|
||||
{
|
||||
shader_crosshair->defaulttextures.base = R_LoadHiResTexture (crosshairimage.string, "crosshairs", IF_NOMIPMAP|IF_NOGAMMA);
|
||||
if (TEXVALID(shader_crosshair->defaulttextures.base))
|
||||
return;
|
||||
}
|
||||
else if (c <= 1)
|
||||
return;
|
||||
|
||||
c -= 2;
|
||||
c = c % (sizeof(crosshair_pixels) / (CS_HEIGHT*sizeof(*crosshair_pixels)));
|
||||
|
||||
if (!TEXVALID(ch_int_texture))
|
||||
ch_int_texture = R_AllocNewTexture(CS_WIDTH, CS_HEIGHT);
|
||||
shader_crosshair->defaulttextures.base = ch_int_texture;
|
||||
|
||||
Q_memset(crossdata, 0, sizeof(crossdata));
|
||||
|
||||
x = crosshair_pixels + (CS_HEIGHT * c);
|
||||
for (h = 0; h < CS_HEIGHT; h++)
|
||||
{
|
||||
int pix = x[h];
|
||||
for (w = 0; w < CS_WIDTH; w++)
|
||||
{
|
||||
if (pix & 0x1)
|
||||
crossdata[CS_WIDTH * h + w] = 0xffffffff;
|
||||
pix >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
R_Upload(ch_int_texture, NULL, TF_RGBA32, crossdata, NULL, CS_WIDTH, CS_HEIGHT, IF_NOMIPMAP|IF_NOGAMMA);
|
||||
|
||||
}
|
||||
|
||||
void R2D_CrosshairImage_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
R2D_Crosshair_Update();
|
||||
}
|
||||
|
||||
void R2D_Crosshair_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
R2D_Crosshair_Update();
|
||||
}
|
||||
|
||||
void R2D_CrosshairColor_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
SCR_StringToRGB(var->string, ch_color, 255);
|
||||
|
||||
ch_color[0] = bound(0, ch_color[0], 1);
|
||||
ch_color[1] = bound(0, ch_color[1], 1);
|
||||
ch_color[2] = bound(0, ch_color[2], 1);
|
||||
}
|
||||
|
||||
void R2D_DrawCrosshair(void)
|
||||
{
|
||||
int x, y;
|
||||
int sc;
|
||||
float sx, sy, sizex, sizey;
|
||||
|
||||
float size, chc;
|
||||
|
||||
if (crosshair.ival < 1)
|
||||
return;
|
||||
|
||||
// old style
|
||||
if (crosshair.ival == 1 && !crosshairimage.string[0])
|
||||
{
|
||||
for (sc = 0; sc < cl.splitclients; sc++)
|
||||
{
|
||||
SCR_CrosshairPosition(sc, &x, &y);
|
||||
Font_BeginString(font_conchar, x, y, &x, &y);
|
||||
x -= Font_CharWidth('+' | 0xe000 | CON_WHITEMASK)/2;
|
||||
y -= Font_CharHeight()/2;
|
||||
Font_ForceColour(ch_color[0], ch_color[1], ch_color[2], crosshairalpha.value);
|
||||
Font_DrawChar(x, y, '+' | 0xe000 | CON_WHITEMASK);
|
||||
Font_InvalidateColour();
|
||||
Font_EndString(font_conchar);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
size = crosshairsize.value;
|
||||
|
||||
if (size < 0)
|
||||
{
|
||||
size = -size;
|
||||
sizex = size;
|
||||
sizey = size;
|
||||
chc = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sizex = (size*vid.rotpixelwidth) / (float)vid.width;
|
||||
sizey = (size*vid.rotpixelheight) / (float)vid.height;
|
||||
chc = size * chc;
|
||||
}
|
||||
|
||||
sizex = (int)sizex;
|
||||
sizex = ((sizex)*(int)vid.width) / (float)vid.rotpixelwidth;
|
||||
|
||||
sizey = (int)sizey;
|
||||
sizey = ((sizey)*(int)vid.height) / (float)vid.rotpixelheight;
|
||||
|
||||
R2D_ImageColours(ch_color[0], ch_color[1], ch_color[2], crosshairalpha.value);
|
||||
for (sc = 0; sc < cl.splitclients; sc++)
|
||||
{
|
||||
SCR_CrosshairPosition(sc, &x, &y);
|
||||
|
||||
//translate to pixel coord, for rounding
|
||||
x = ((x-sizex-chc)*vid.rotpixelwidth) / (float)vid.width;
|
||||
y = ((y-sizey-chc)*vid.rotpixelheight) / (float)vid.height;
|
||||
|
||||
//translate to screen coords
|
||||
sx = ((x)*(int)vid.width) / (float)vid.rotpixelwidth;
|
||||
sy = ((y)*(int)vid.height) / (float)vid.rotpixelheight;
|
||||
|
||||
R2D_Image(sx, sy, sizex*2, sizey*2, 0, 0, 1, 1, shader_crosshair);
|
||||
}
|
||||
R2D_ImageColours(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -645,9 +645,6 @@ void (*Draw_Shutdown) (void);
|
|||
|
||||
//void (*Draw_TinyCharacter) (int x, int y, unsigned int num);
|
||||
|
||||
void (*Draw_Crosshair) (void);
|
||||
void (*Draw_SubPic) (int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight);
|
||||
|
||||
void (*R_Init) (void);
|
||||
void (*R_DeInit) (void);
|
||||
void (*R_RenderView) (void); // must set r_refdef first
|
||||
|
@ -702,7 +699,6 @@ rendererinfo_t dedicatedrendererinfo = {
|
|||
|
||||
NULL, //Draw_Init;
|
||||
NULL, //Draw_Shutdown;
|
||||
NULL, //Draw_Crosshair;
|
||||
|
||||
NULL, //R_LoadTexture
|
||||
NULL, //R_LoadTexture8Pal24
|
||||
|
@ -1247,7 +1243,6 @@ void R_SetRenderer(rendererinfo_t *ri)
|
|||
|
||||
Draw_Init = ri->Draw_Init;
|
||||
Draw_Shutdown = ri->Draw_Shutdown;
|
||||
Draw_Crosshair = ri->Draw_Crosshair;
|
||||
|
||||
R_Init = ri->R_Init;
|
||||
R_DeInit = ri->R_DeInit;
|
||||
|
|
|
@ -70,13 +70,13 @@ cvar_t v_ipitch_level = SCVAR("v_ipitch_level", "0.3");
|
|||
cvar_t v_idlescale = SCVAR("v_idlescale", "0");
|
||||
|
||||
cvar_t crosshair = SCVARF("crosshair", "0", CVAR_ARCHIVE);
|
||||
cvar_t crosshaircolor = SCVARF("crosshaircolor", "79", CVAR_ARCHIVE | CVAR_RENDERERCALLBACK);
|
||||
cvar_t crosshaircolor = SCVARF("crosshaircolor", "255 255 255", CVAR_ARCHIVE);
|
||||
cvar_t crosshairsize = SCVARF("crosshairsize", "8", CVAR_ARCHIVE);
|
||||
|
||||
cvar_t cl_crossx = SCVARF("cl_crossx", "0", CVAR_ARCHIVE);
|
||||
cvar_t cl_crossy = SCVARF("cl_crossy", "0", CVAR_ARCHIVE);
|
||||
cvar_t crosshaircorrect = SCVARF("crosshaircorrect", "0", CVAR_SEMICHEAT);
|
||||
cvar_t crosshairimage = SCVARF("crosshairimage", "", CVAR_RENDERERCALLBACK);
|
||||
cvar_t crosshairimage = SCVAR("crosshairimage", "");
|
||||
cvar_t crosshairalpha = SCVAR("crosshairalpha", "1");
|
||||
|
||||
cvar_t gl_cshiftpercent = SCVAR("gl_cshiftpercent", "100");
|
||||
|
@ -448,30 +448,65 @@ V_cshift_f
|
|||
*/
|
||||
void V_cshift_f (void)
|
||||
{
|
||||
if (Cmd_Argc() != 5 && Cmd_Argc() != 1) //this is actually to warn of a malice bug (and prevent a totally black screen) more than it is to help the user. :/
|
||||
{ //The 1 is so teamfortress can use it to clear.
|
||||
if (Cmd_FromGamecode()) //nehahra does nasty things and becomes unplayable.
|
||||
int r, g, b, p;
|
||||
|
||||
r = g = b = p = 0;
|
||||
|
||||
if (Cmd_Argc() >= 5)
|
||||
{
|
||||
r = atoi(Cmd_Argv(1));
|
||||
g = atoi(Cmd_Argv(2));
|
||||
b = atoi(Cmd_Argv(3));
|
||||
p = atoi(Cmd_Argv(4));
|
||||
}
|
||||
|
||||
if (Cmd_FromGamecode())
|
||||
{
|
||||
if (Cmd_Argc() >= 5)
|
||||
{
|
||||
cl.cshifts[CSHIFT_SERVER].destcolor[0] = 0;
|
||||
cl.cshifts[CSHIFT_SERVER].destcolor[1] = 0;
|
||||
cl.cshifts[CSHIFT_SERVER].destcolor[2] = 0;
|
||||
cl.cshifts[CSHIFT_SERVER].percent = 0;
|
||||
qboolean term = false;
|
||||
int i;
|
||||
char *c = Cmd_Argv(4);
|
||||
|
||||
// malice jumbles commands into a v_cshift so this attempts to fix
|
||||
while (isdigit(*c))
|
||||
c++;
|
||||
|
||||
if (*c)
|
||||
{
|
||||
Cbuf_AddText(c, RESTRICT_SERVER);
|
||||
term = true;
|
||||
}
|
||||
for (i = 5; i < Cmd_Argc(); i++)
|
||||
{
|
||||
Cbuf_AddText(" ", RESTRICT_SERVER);
|
||||
Cbuf_AddText(Cmd_Argv(i), RESTRICT_SERVER);
|
||||
term = true;
|
||||
}
|
||||
if (term)
|
||||
Cbuf_AddText("\n", RESTRICT_SERVER);
|
||||
}
|
||||
else if (Cmd_Argc() > 1)
|
||||
Con_DPrintf("broken v_cshift from gamecode\n");
|
||||
|
||||
// ensure we always clear out or set for nehahra
|
||||
cl.cshifts[CSHIFT_SERVER].destcolor[0] = r;
|
||||
cl.cshifts[CSHIFT_SERVER].destcolor[1] = g;
|
||||
cl.cshifts[CSHIFT_SERVER].destcolor[2] = b;
|
||||
cl.cshifts[CSHIFT_SERVER].percent = p;
|
||||
return;
|
||||
}
|
||||
|
||||
if (Cmd_Argc() != 5 && Cmd_Argc() != 1)
|
||||
{
|
||||
Con_Printf("v_cshift: v_cshift <r> <g> <b> <alpha>\n");
|
||||
return;
|
||||
}
|
||||
if (Cmd_FromGamecode())
|
||||
{
|
||||
cl.cshifts[CSHIFT_SERVER].destcolor[0] = atoi(Cmd_Argv(1));
|
||||
cl.cshifts[CSHIFT_SERVER].destcolor[1] = atoi(Cmd_Argv(2));
|
||||
cl.cshifts[CSHIFT_SERVER].destcolor[2] = atoi(Cmd_Argv(3));
|
||||
cl.cshifts[CSHIFT_SERVER].percent = atoi(Cmd_Argv(4));
|
||||
return;
|
||||
}
|
||||
cshift_empty.destcolor[0] = atoi(Cmd_Argv(1));
|
||||
cshift_empty.destcolor[1] = atoi(Cmd_Argv(2));
|
||||
cshift_empty.destcolor[2] = atoi(Cmd_Argv(3));
|
||||
cshift_empty.percent = atoi(Cmd_Argv(4));
|
||||
|
||||
cshift_empty.destcolor[0] = r;
|
||||
cshift_empty.destcolor[1] = g;
|
||||
cshift_empty.destcolor[2] = b;
|
||||
cshift_empty.percent = p;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue