r_drawflat, r_wallcolour, r_floorcolour to callbacks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2243 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
f8a044b783
commit
551f37340b
3 changed files with 60 additions and 53 deletions
|
@ -219,9 +219,9 @@ cvar_t r_lightstylespeed = SCVAR("r_lightstylespeed", "10");
|
||||||
extern cvar_t r_novis;
|
extern cvar_t r_novis;
|
||||||
extern cvar_t r_netgraph;
|
extern cvar_t r_netgraph;
|
||||||
|
|
||||||
cvar_t r_drawflat = SCVARF("r_drawflat","0", CVAR_SEMICHEAT);
|
cvar_t r_drawflat = SCVARF("r_drawflat","0", CVAR_SEMICHEAT|CVAR_RENDERERCALLBACK);
|
||||||
cvar_t r_wallcolour = SCVAR("r_wallcolour","0 0 1");
|
cvar_t r_wallcolour = SCVAR("r_wallcolour","1 1 1");
|
||||||
cvar_t r_floorcolour = SCVAR("r_floorcolour","0.5 0.5 1");
|
cvar_t r_floorcolour = SCVAR("r_floorcolour","1 1 1");
|
||||||
|
|
||||||
cvar_t d_palconvwrite = SCVAR("d_palconvwrite", "1");
|
cvar_t d_palconvwrite = SCVAR("d_palconvwrite", "1");
|
||||||
cvar_t d_palremapsize = SCVARF("d_palremapsize", "64", CVAR_RENDERERLATCH);
|
cvar_t d_palremapsize = SCVARF("d_palremapsize", "64", CVAR_RENDERERLATCH);
|
||||||
|
|
|
@ -1161,11 +1161,22 @@ static void PPL_BaseChain_Specular_FP(msurface_t *s, texture_t *tex)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//single textured.
|
|
||||||
static void PPL_BaseChain_Flat(msurface_t *first)
|
|
||||||
{
|
|
||||||
static vec_t wallcolour[4] = {0,0,0,1};
|
static vec_t wallcolour[4] = {0,0,0,1};
|
||||||
static vec_t floorcolour[4] = {0,0,0,1};
|
static vec_t floorcolour[4] = {0,0,0,1};
|
||||||
|
|
||||||
|
//single textured.
|
||||||
|
void GLR_Wallcolour_Callback(struct cvar_s *var, char *oldvalue)
|
||||||
|
{
|
||||||
|
SCR_StringToRGB(var->string, wallcolour, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GLR_Floorcolour_Callback(struct cvar_s *var, char *oldvalue)
|
||||||
|
{
|
||||||
|
SCR_StringToRGB(var->string, floorcolour, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PPL_BaseChain_Flat(msurface_t *first)
|
||||||
|
{
|
||||||
msurface_t *s;
|
msurface_t *s;
|
||||||
int iswall = -1;
|
int iswall = -1;
|
||||||
int vi=-10;
|
int vi=-10;
|
||||||
|
@ -1183,21 +1194,6 @@ static void PPL_BaseChain_Flat(msurface_t *first)
|
||||||
qglEnable(GL_TEXTURE_2D);
|
qglEnable(GL_TEXTURE_2D);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (r_wallcolour.modified)
|
|
||||||
{
|
|
||||||
r_wallcolour.modified = false;
|
|
||||||
|
|
||||||
SCR_StringToRGB(r_wallcolour.string, wallcolour, 1);
|
|
||||||
}
|
|
||||||
if (r_floorcolour.modified)
|
|
||||||
{
|
|
||||||
r_floorcolour.modified = false;
|
|
||||||
|
|
||||||
SCR_StringToRGB(r_floorcolour.string, floorcolour, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PPL_EnableVertexArrays();
|
PPL_EnableVertexArrays();
|
||||||
GL_TexEnv(GL_MODULATE);
|
GL_TexEnv(GL_MODULATE);
|
||||||
|
@ -1260,30 +1256,23 @@ static void PPL_BaseChain_Flat(msurface_t *first)
|
||||||
qglColor3f(1,1,1);
|
qglColor3f(1,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PPL_BaseChain_NPR_Sketch(msurface_t *first)
|
static int nprtextures[10];
|
||||||
|
|
||||||
|
void GLR_Drawflat_Callback(struct cvar_s *var, char *oldvalue)
|
||||||
{
|
{
|
||||||
msurface_t *s;
|
|
||||||
int vi=-10;
|
|
||||||
int i;
|
int i;
|
||||||
glRect_t *theRect;
|
|
||||||
|
|
||||||
static int textures[10];
|
for (i = 0; i < sizeof(nprtextures)/sizeof(nprtextures[0]); i++)
|
||||||
|
|
||||||
GL_SelectTexture(GL_TEXTURE0_ARB);
|
|
||||||
if (r_drawflat.modified) //reload textures
|
|
||||||
{
|
{
|
||||||
r_drawflat.modified = false;
|
nprtextures[i] = Mod_LoadHiResTexture(va("sketch%i", i+1), "sketch", true, false, false);
|
||||||
for (i = 0; i < sizeof(textures)/sizeof(textures[0]); i++)
|
if (!nprtextures[i])
|
||||||
{
|
|
||||||
textures[i] = Mod_LoadHiResTexture(va("sketch%i", i+1), "sketch", true, false, false);
|
|
||||||
if (!textures[i])
|
|
||||||
{
|
{
|
||||||
int data[128*128];
|
int data[128*128];
|
||||||
FILE *file;
|
FILE *file;
|
||||||
unsigned char *f;
|
unsigned char *f;
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
file = fopen(va("textures/tex%i_3_128_128.raw", i+1), "rb");
|
file = fopen(va("nprtextures/tex%i_3_128_128.raw", i+1), "rb");
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
|
@ -1292,7 +1281,7 @@ static void PPL_BaseChain_NPR_Sketch(msurface_t *first)
|
||||||
{
|
{
|
||||||
for (p = 0; p < 128*128; p++)
|
for (p = 0; p < 128*128; p++)
|
||||||
data[p] = LittleLong(f[p*3] + (f[p*3+1]<<8) + (f[p*3+2]<<16) + (255<<24));
|
data[p] = LittleLong(f[p*3] + (f[p*3+1]<<8) + (f[p*3+2]<<16) + (255<<24));
|
||||||
textures[i] = GL_LoadTexture32 (va("textures/tex%i_3_128_128.raw", i+1), 128, 128, data, true, false);
|
nprtextures[i] = GL_LoadTexture32 (va("textures/tex%i_3_128_128.raw", i+1), 128, 128, data, true, false);
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
@ -1300,6 +1289,14 @@ static void PPL_BaseChain_NPR_Sketch(msurface_t *first)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PPL_BaseChain_NPR_Sketch(msurface_t *first)
|
||||||
|
{
|
||||||
|
msurface_t *s;
|
||||||
|
int vi=-10;
|
||||||
|
int i;
|
||||||
|
glRect_t *theRect;
|
||||||
|
|
||||||
|
GL_SelectTexture(GL_TEXTURE0_ARB);
|
||||||
PPL_EnableVertexArrays();
|
PPL_EnableVertexArrays();
|
||||||
|
|
||||||
//draw the surface properly
|
//draw the surface properly
|
||||||
|
@ -1323,7 +1320,7 @@ static void PPL_BaseChain_NPR_Sketch(msurface_t *first)
|
||||||
PPL_FlushArrays();
|
PPL_FlushArrays();
|
||||||
vi = s->lightmaptexturenum;
|
vi = s->lightmaptexturenum;
|
||||||
|
|
||||||
GL_MBind(GL_TEXTURE0_ARB, textures[rand()%10]);
|
GL_MBind(GL_TEXTURE0_ARB, nprtextures[rand()%10]);
|
||||||
|
|
||||||
if (vi < 0)
|
if (vi < 0)
|
||||||
GL_MBind(GL_TEXTURE1_ARB, 0 );
|
GL_MBind(GL_TEXTURE1_ARB, 0 );
|
||||||
|
|
|
@ -661,6 +661,7 @@ extern cvar_t r_stains, r_stainfadetime, r_stainfadeammount;
|
||||||
extern cvar_t gl_conback, gl_font, gl_smoothfont, gl_fontedgeclamp, r_menutint;
|
extern cvar_t gl_conback, gl_font, gl_smoothfont, gl_fontedgeclamp, r_menutint;
|
||||||
extern cvar_t vid_conautoscale, vid_conheight, vid_conwidth;
|
extern cvar_t vid_conautoscale, vid_conheight, vid_conwidth;
|
||||||
extern cvar_t crosshair, crosshairimage, crosshaircolor, r_skyboxname;
|
extern cvar_t crosshair, crosshairimage, crosshaircolor, r_skyboxname;
|
||||||
|
extern cvar_t r_floorcolour, r_wallcolour;
|
||||||
void GLCrosshairimage_Callback(struct cvar_s *var, char *oldvalue);
|
void GLCrosshairimage_Callback(struct cvar_s *var, char *oldvalue);
|
||||||
void GLCrosshair_Callback(struct cvar_s *var, char *oldvalue);
|
void GLCrosshair_Callback(struct cvar_s *var, char *oldvalue);
|
||||||
void GLCrosshaircolor_Callback(struct cvar_s *var, char *oldvalue);
|
void GLCrosshaircolor_Callback(struct cvar_s *var, char *oldvalue);
|
||||||
|
@ -673,6 +674,9 @@ void GL_Fontedgeclamp_Callback (struct cvar_s *var, char *oldvalue);
|
||||||
void GLVID_Conwidth_Callback(struct cvar_s *var, char *oldvalue);
|
void GLVID_Conwidth_Callback(struct cvar_s *var, char *oldvalue);
|
||||||
void GLVID_Conautoscale_Callback(struct cvar_s *var, char *oldvalue);
|
void GLVID_Conautoscale_Callback(struct cvar_s *var, char *oldvalue);
|
||||||
void GLVID_Conheight_Callback(struct cvar_s *var, char *oldvalue);
|
void GLVID_Conheight_Callback(struct cvar_s *var, char *oldvalue);
|
||||||
|
void GLR_Wallcolour_Callback(struct cvar_s *var, char *oldvalue);
|
||||||
|
void GLR_Floorcolour_Callback(struct cvar_s *var, char *oldvalue);
|
||||||
|
void GLR_Drawflat_Callback(struct cvar_s *var, char *oldvalue);
|
||||||
|
|
||||||
void GLR_DeInit (void)
|
void GLR_DeInit (void)
|
||||||
{
|
{
|
||||||
|
@ -694,6 +698,9 @@ void GLR_DeInit (void)
|
||||||
Cvar_Unhook(&vid_conautoscale);
|
Cvar_Unhook(&vid_conautoscale);
|
||||||
Cvar_Unhook(&vid_conheight);
|
Cvar_Unhook(&vid_conheight);
|
||||||
Cvar_Unhook(&vid_conwidth);
|
Cvar_Unhook(&vid_conwidth);
|
||||||
|
Cvar_Unhook(&r_wallcolour);
|
||||||
|
Cvar_Unhook(&r_floorcolour);
|
||||||
|
Cvar_Unhook(&r_drawflat);
|
||||||
|
|
||||||
GLDraw_DeInit();
|
GLDraw_DeInit();
|
||||||
|
|
||||||
|
@ -719,6 +726,9 @@ void GLR_Init (void)
|
||||||
Cvar_Hook(&vid_conautoscale, GLVID_Conautoscale_Callback);
|
Cvar_Hook(&vid_conautoscale, GLVID_Conautoscale_Callback);
|
||||||
Cvar_Hook(&vid_conheight, GLVID_Conheight_Callback);
|
Cvar_Hook(&vid_conheight, GLVID_Conheight_Callback);
|
||||||
Cvar_Hook(&vid_conwidth, GLVID_Conwidth_Callback);
|
Cvar_Hook(&vid_conwidth, GLVID_Conwidth_Callback);
|
||||||
|
Cvar_Hook(&r_floorcolour, GLR_Floorcolour_Callback);
|
||||||
|
Cvar_Hook(&r_wallcolour, GLR_Wallcolour_Callback);
|
||||||
|
Cvar_Hook(&r_drawflat, GLR_Drawflat_Callback);
|
||||||
|
|
||||||
R_InitBubble();
|
R_InitBubble();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue