add r_floortexture/r_walltexture, tweak to Doom speaker sounds

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2252 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-08 04:30:04 +00:00
parent 9d9b74c274
commit 6197004228
4 changed files with 136 additions and 6 deletions

View file

@ -222,6 +222,8 @@ extern cvar_t r_netgraph;
cvar_t r_drawflat = SCVARF("r_drawflat","0", CVAR_SEMICHEAT|CVAR_RENDERERCALLBACK);
cvar_t r_wallcolour = SCVARF("r_wallcolour","1 1 1", CVAR_RENDERERCALLBACK);
cvar_t r_floorcolour = SCVARF("r_floorcolour","1 1 1", CVAR_RENDERERCALLBACK);
cvar_t r_walltexture = SCVARF("r_walltexture","", CVAR_RENDERERCALLBACK);
cvar_t r_floortexture = SCVARF("r_floortexture","", CVAR_RENDERERCALLBACK);
cvar_t d_palconvwrite = SCVAR("d_palconvwrite", "1");
cvar_t d_palremapsize = SCVARF("d_palremapsize", "64", CVAR_RENDERERLATCH);
@ -364,6 +366,9 @@ void GLRenderer_Init(void)
Cvar_Register (&r_wallcolour, GLRENDEREROPTIONS);
Cvar_Register (&r_floorcolour, GLRENDEREROPTIONS);
Cvar_Register (&r_walltexture, GLRENDEREROPTIONS);
Cvar_Register (&r_floortexture, GLRENDEREROPTIONS);
Cvar_Register (&r_vertexdlights, GLRENDEREROPTIONS);
Cvar_Register (&gl_schematics, GLRENDEREROPTIONS);

View file

@ -148,8 +148,9 @@ void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, qbyte *data)
//=============================================================================
#ifdef DOOMWADS
#define DSPK_RATE 140
#define DSPK_FREQ 30
// needs fine tuning.. educated guesses
#define DSPK_RATE 128
#define DSPK_FREQ 31
sfxcache_t *S_LoadDoomSpeakerSound (sfx_t *s, qbyte *data, int datalen, int sndspeed)
{
@ -308,7 +309,7 @@ S_LoadSound_t AudioInputPlugins[10] =
S_LoadWavSound,
#ifdef DOOMWADS
S_LoadDoomSound,
S_LoadDoomSpeakerSound
S_LoadDoomSpeakerSound,
#endif
};

View file

@ -1163,6 +1163,9 @@ static void PPL_BaseChain_Specular_FP(msurface_t *s, texture_t *tex)
static vec_t wallcolour[4] = {0,0,0,1};
static vec_t floorcolour[4] = {0,0,0,1};
static int walltexture = 0;
static int floortexture = 0;
static qboolean simpletextures = false;
//single textured.
void GLR_Wallcolour_Callback(struct cvar_s *var, char *oldvalue)
@ -1175,6 +1178,36 @@ void GLR_Floorcolour_Callback(struct cvar_s *var, char *oldvalue)
SCR_StringToRGB(var->string, floorcolour, 1);
}
void GLR_Walltexture_Callback(struct cvar_s *var, char *oldvalue)
{
if (!var->string[0])
{
walltexture = 0;
if (!floortexture)
simpletextures = false;
return;
}
walltexture = Mod_LoadHiResTexture(var->string, NULL, true, false, true);
if (walltexture)
simpletextures = true;
}
void GLR_Floortexture_Callback(struct cvar_s *var, char *oldvalue)
{
if (!var->string[0])
{
floortexture = 0;
if (!walltexture)
simpletextures = false;
return;
}
floortexture = Mod_LoadHiResTexture(var->string, NULL, true, false, true);
if (floortexture)
simpletextures = true;
}
static void PPL_BaseChain_Flat(msurface_t *first)
{
msurface_t *s;
@ -1233,7 +1266,7 @@ static void PPL_BaseChain_Flat(msurface_t *first)
}
}
if ((s->plane->normal[2]*s->plane->normal[2]) <= 0.5*0.5)
if (s->plane->normal[2] <= 0.5)
{
if (iswall != 0)
{
@ -1292,6 +1325,88 @@ void GLR_Drawflat_Callback(struct cvar_s *var, char *oldvalue)
}
}
static void PPL_BaseChain_SimpleTexture(msurface_t *first)
{
msurface_t *s;
int vi=-10;
int iswall;
int oldwall=-1;
glRect_t *theRect;
GL_SelectTexture(GL_TEXTURE0_ARB);
PPL_EnableVertexArrays();
//draw the surface properly
qglEnable(GL_TEXTURE_2D);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stw);
GL_TexEnv(GL_MODULATE);
GL_SelectTexture(GL_TEXTURE1_ARB);
GL_TexEnv(GL_MODULATE);
qglEnable(GL_TEXTURE_2D);
qglEnableClientState(GL_TEXTURE_COORD_ARRAY);
qglTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stl);
for (s = first; s ; s=s->texturechain)
{
if (s->plane->normal[2] <= 0.5)
iswall = 1;
else
iswall = 0;
if (vi != s->lightmaptexturenum || iswall != oldwall)
{
PPL_FlushArrays();
vi = s->lightmaptexturenum;
oldwall = iswall;
if (iswall)
{
GL_MBind(GL_TEXTURE0_ARB, walltexture);
qglColor4fv(wallcolour);
}
else
{
GL_MBind(GL_TEXTURE0_ARB, floortexture);
qglColor4fv(floorcolour);
}
if (vi < 0)
GL_MBind(GL_TEXTURE1_ARB, 0 );
else
{
GL_MBind(GL_TEXTURE1_ARB, lightmap_textures[vi] );
if (lightmap[vi]->modified)
{
lightmap[vi]->modified = false;
theRect = &lightmap[vi]->rectchange;
qglTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t,
LMBLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE,
lightmap[vi]->lightmaps+(theRect->t) *LMBLOCK_WIDTH*lightmap_bytes);
theRect->l = LMBLOCK_WIDTH;
theRect->t = LMBLOCK_HEIGHT;
theRect->h = 0;
theRect->w = 0;
}
}
}
PPL_GenerateArrays(s);
}
PPL_FlushArrays();
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
qglDisableClientState(GL_VERTEX_ARRAY);
qglDisable(GL_TEXTURE_2D);
qglColor3f(1,1,1);
GL_SelectTexture(GL_TEXTURE0_ARB);
qglDisableClientState(GL_TEXTURE_COORD_ARRAY);
qglDisableClientState(GL_VERTEX_ARRAY);
qglEnable(GL_TEXTURE_2D);
qglColor3f(1,1,1);
}
static void PPL_BaseChain_NPR_Sketch(msurface_t *first)
{
msurface_t *s;
@ -1402,6 +1517,9 @@ static void PPL_BaseTextureChain(msurface_t *first)
}
else
{
if (gl_mtexarbable >= 2 && simpletextures)
PPL_BaseChain_SimpleTexture(first);
else
PPL_BaseChain_Flat(first); //who cares about texture? :/
return;
}

View file

@ -661,7 +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 vid_conautoscale, vid_conheight, vid_conwidth;
extern cvar_t crosshair, crosshairimage, crosshaircolor, r_skyboxname;
extern cvar_t r_floorcolour, r_wallcolour;
extern cvar_t r_floorcolour, r_wallcolour, r_floortexture, r_walltexture;
void GLCrosshairimage_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);
@ -676,6 +676,8 @@ void GLVID_Conautoscale_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_Walltexture_Callback(struct cvar_s *var, char *oldvalue);
void GLR_Floortexture_Callback(struct cvar_s *var, char *oldvalue);
void GLR_Drawflat_Callback(struct cvar_s *var, char *oldvalue);
void GLV_Gamma_Callback(struct cvar_s *var, char *oldvalue);
@ -701,6 +703,8 @@ void GLR_DeInit (void)
Cvar_Unhook(&vid_conwidth);
Cvar_Unhook(&r_wallcolour);
Cvar_Unhook(&r_floorcolour);
Cvar_Unhook(&r_walltexture);
Cvar_Unhook(&r_floortexture);
Cvar_Unhook(&r_drawflat);
Cvar_Unhook(&v_gamma);
Cvar_Unhook(&v_contrast);
@ -731,6 +735,8 @@ void GLR_Init (void)
Cvar_Hook(&vid_conwidth, GLVID_Conwidth_Callback);
Cvar_Hook(&r_floorcolour, GLR_Floorcolour_Callback);
Cvar_Hook(&r_wallcolour, GLR_Wallcolour_Callback);
Cvar_Hook(&r_floortexture, GLR_Floortexture_Callback);
Cvar_Hook(&r_walltexture, GLR_Walltexture_Callback);
Cvar_Hook(&r_drawflat, GLR_Drawflat_Callback);
Cvar_Hook(&v_gamma, GLV_Gamma_Callback);
Cvar_Hook(&v_contrast, GLV_Gamma_Callback);