From 3866a4c292a3559e4e3cbbbf23eed8bf366cb3d6 Mon Sep 17 00:00:00 2001 From: TimeServ Date: Sun, 4 Jun 2006 16:02:03 +0000 Subject: [PATCH] add r_drawflat_nonworldmodel, defaults to 0 git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2315 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_parse.c | 1 + engine/client/clq2_cin.c | 2 +- engine/client/clq3_parse.c | 1 + engine/client/renderer.c | 3 ++- engine/client/snd_dma.c | 2 +- engine/gl/gl_model.h | 21 +++++++++++---------- engine/gl/gl_ppl.c | 9 ++++++++- engine/gl/gl_rmisc.c | 1 - engine/sw/r_bsp.c | 8 +++++++- engine/sw/r_surf.c | 2 +- 10 files changed, 33 insertions(+), 17 deletions(-) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index a96ead7d8..1dbf53b37 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -542,6 +542,7 @@ qboolean CL_CheckMD2Skins (char *name) return false; } + /* ================= Model_NextDownload diff --git a/engine/client/clq2_cin.c b/engine/client/clq2_cin.c index 7b726e5e4..354dda94c 100644 --- a/engine/client/clq2_cin.c +++ b/engine/client/clq2_cin.c @@ -364,7 +364,7 @@ qbyte *CIN_ReadNextFrame (void) if (cin.s_width == 1) COM_CharBias(samples, count*cin.s_channels); else if (cin.s_width == 2) - COM_SwapLittleShortBlock(samples, count*cin.s_channels); + COM_SwapLittleShortBlock((short *)samples, count*cin.s_channels); S_RawAudio (0, samples, cin.s_rate, count, cin.s_channels, cin.s_width); diff --git a/engine/client/clq3_parse.c b/engine/client/clq3_parse.c index 87293764a..7b9f687b9 100644 --- a/engine/client/clq3_parse.c +++ b/engine/client/clq3_parse.c @@ -589,6 +589,7 @@ void CLQ3_ParseGameState(void) if (!cl.worldmodel) Host_EndGame("CGame didn't set a map.\n"); + R_NewMap (); SCR_EndLoadingPlaque(); diff --git a/engine/client/renderer.c b/engine/client/renderer.c index 449fee202..ecf15c814 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -221,6 +221,7 @@ extern cvar_t r_novis; extern cvar_t r_netgraph; cvar_t r_drawflat = SCVARF("r_drawflat","0", CVAR_SEMICHEAT|CVAR_RENDERERCALLBACK); +cvar_t r_drawflat_nonworldmodel = SCVAR("r_drawflat_nonworldmodel", "0"); cvar_t r_wallcolour = SCVARF("r_wallcolour","255 255 255", CVAR_RENDERERCALLBACK); cvar_t r_floorcolour = SCVARF("r_floorcolour","255 255 255", CVAR_RENDERERCALLBACK); cvar_t r_walltexture = SCVARF("r_walltexture","", CVAR_RENDERERCALLBACK); @@ -433,7 +434,6 @@ void SWRenderer_Init(void) } #endif - void R_InitTextures (void) { int x,y, m; @@ -567,6 +567,7 @@ void Renderer_Init(void) Cvar_Register (&r_wateralpha, GRAPHICALNICETIES); Cvar_Register (&r_drawflat, GRAPHICALNICETIES); + Cvar_Register (&r_drawflat_nonworldmodel, GRAPHICALNICETIES); Cvar_Register (&r_menutint, GRAPHICALNICETIES); Cvar_Register (&r_fb_models, GRAPHICALNICETIES); diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index fa9e3b1d9..4e8db4d37 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -1622,7 +1622,7 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels, // Con_Printf("Restarting raw stream\n"); } - speedfactor = (float)speed/snd_speed; + speedfactor = (double)speed/snd_speed; outsamples = samples/speedfactor; oldlength = s->sfxcache->length; diff --git a/engine/gl/gl_model.h b/engine/gl/gl_model.h index f3e84cfff..dcfd5c0c6 100644 --- a/engine/gl/gl_model.h +++ b/engine/gl/gl_model.h @@ -173,16 +173,17 @@ typedef struct texture_s unsigned offsets[MIPLEVELS]; // four mip maps stored } texture_t; -#define SURF_DRAWSKYBOX 1 -#define SURF_PLANEBACK 2 -#define SURF_DRAWSKY 4 -#define SURF_DRAWSPRITE 8 -#define SURF_DRAWTURB 0x10 -#define SURF_DRAWTILED 0x20 -#define SURF_DRAWBACKGROUND 0x40 -#define SURF_UNDERWATER 0x80 -#define SURF_DONTWARP 0x100 -#define SURF_BULLETEN 0x200 +#define SURF_DRAWSKYBOX 0x00001 +#define SURF_PLANEBACK 0x00002 +#define SURF_DRAWSKY 0x00004 +#define SURF_DRAWSPRITE 0x00008 +#define SURF_DRAWTURB 0x00010 +#define SURF_DRAWTILED 0x00020 +#define SURF_DRAWBACKGROUND 0x00040 +#define SURF_UNDERWATER 0x00080 +#define SURF_DONTWARP 0x00100 +#define SURF_BULLETEN 0x00200 +#define SURF_NOFLAT 0x08000 #define SURF_DRAWALPHA 0x10000 // !!! if this is changed, it must be changed in asm_draw.h too !!! diff --git a/engine/gl/gl_ppl.c b/engine/gl/gl_ppl.c index bf08a87e0..1df695fb1 100644 --- a/engine/gl/gl_ppl.c +++ b/engine/gl/gl_ppl.c @@ -1515,7 +1515,7 @@ static void PPL_BaseTextureChain(msurface_t *first) return; } } - else + else if (!(first->flags & SURF_NOFLAT)) { if (gl_mtexarbable >= 2 && simpletextures) PPL_BaseChain_SimpleTexture(first); @@ -1830,9 +1830,11 @@ void PPL_BaseTextures(model_t *model) void PPL_BaseBModelTextures(entity_t *e) { + extern cvar_t r_drawflat_nonworldmodel; extern msurface_t *r_alpha_surfaces; int i, k; int shift; + int sflags; model_t *model; msurface_t *s; msurface_t *chain = NULL; @@ -1891,6 +1893,10 @@ void PPL_BaseBModelTextures(entity_t *e) R_RenderDynamicLightmaps (s, shift); } + if (!r_drawflat_nonworldmodel.value && (!cl.worldmodel->submodels || model->submodels != cl.worldmodel->submodels)) + sflags = SURF_NOFLAT; + else + sflags = 0; for (s = model->surfaces+model->firstmodelsurface,i = 0; i < model->nummodelsurfaces; i++, s++) { @@ -1907,6 +1913,7 @@ void PPL_BaseBModelTextures(entity_t *e) chain = NULL; } + s->flags |= sflags; s->texturechain = chain; chain = s; } diff --git a/engine/gl/gl_rmisc.c b/engine/gl/gl_rmisc.c index c938909f4..e7a5e4ccf 100644 --- a/engine/gl/gl_rmisc.c +++ b/engine/gl/gl_rmisc.c @@ -1099,7 +1099,6 @@ TRACE(("dbg: GLR_NewMap: ui\n")); TRACE(("dbg: GLR_NewMap: tp\n")); TP_NewMap(); - if (r_shadows.value) { R_LoadRTLights(); diff --git a/engine/sw/r_bsp.c b/engine/sw/r_bsp.c index da49df147..38b9cbb6d 100644 --- a/engine/sw/r_bsp.c +++ b/engine/sw/r_bsp.c @@ -433,7 +433,7 @@ void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags) int i; vec_t dot; msurface_t *psurf; - int numsurfaces; + int numsurfaces, sflags; mplane_t *pplane; // FIXME: use bounding-box-based frustum clipping info? @@ -441,6 +441,11 @@ void R_DrawSubmodelPolygons (model_t *pmodel, int clipflags) psurf = &pmodel->surfaces[pmodel->firstmodelsurface]; numsurfaces = pmodel->nummodelsurfaces; + if (!cl.worldmodel->submodels || pmodel->submodels != cl.worldmodel->submodels) + sflags = SURF_NOFLAT; + else + sflags = 0; + for (i=0 ; itopnode)->key; + psurf->flags |= sflags; // FIXME: use bounding-box-based frustum clipping info? R_RenderFace (psurf, clipflags); } diff --git a/engine/sw/r_surf.c b/engine/sw/r_surf.c index 42878891d..b019eb2ee 100644 --- a/engine/sw/r_surf.c +++ b/engine/sw/r_surf.c @@ -1103,7 +1103,7 @@ void R_DrawSurface (void) if (r_pixbytes == 1 || r_pixbytes == 4) //if we are using 4, textures are stored as 1 and expanded acording to palette { - if (r_drawflat.value) + if (r_drawflat.value && !(r_drawsurf.surf->flags & SURF_NOFLAT)) { if (r_drawsurf.surf->plane->normal[2] <= 0.5) ptexcolor = r_wallindex;