Minor cleanups, mostly just formatting. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4752 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2014-11-22 12:34:29 +00:00
parent 1bbb077fca
commit d73f7f113d
3 changed files with 88 additions and 95 deletions

View file

@ -1292,8 +1292,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
pth->skyface = facen;
pth->hicr = hicr;
if (glinfo.texcompr && glusetexcompr && glusetexcache && !(hicr->flags & HICR_NOSAVE))
if (!gotcache)
if (!gotcache && glinfo.texcompr && glusetexcompr && glusetexcache && !(hicr->flags & HICR_NOSAVE))
{
const int32_t nonpow2 = check_nonpow2(siz.x) || check_nonpow2(siz.y);
@ -1303,8 +1302,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
cachead.ydim = tsiz.y >> cachead.quality;
// handle nocompress:
cachead.flags = nonpow2*CACHEAD_NONPOW2 |
(hasalpha != 255 ? CACHEAD_HASALPHA : 0) |
cachead.flags = nonpow2 * CACHEAD_NONPOW2 | (hasalpha != 255 ? CACHEAD_HASALPHA : 0) |
(hicr->flags & HICR_NOCOMPRESS ? CACHEAD_NOCOMPRESS : 0);
/// OSD_Printf("Caching \"%s\"\n", fn);

View file

@ -1143,8 +1143,6 @@ static void destroy_window_resources()
#ifdef USE_OPENGL
void sdlayer_setvideomode_opengl(void)
{
char *p;
polymost_glreset();
bglEnable(GL_TEXTURE_2D);
@ -1192,31 +1190,32 @@ void sdlayer_setvideomode_opengl(void)
glinfo.texcompr = 0;
// process the extensions string and flag stuff we recognize
p = Bstrdup(glinfo.extensions);
glinfo.clamptoedge = !!Bstrstr(glinfo.extensions, "GL_EXT_texture_edge_clamp") ||
!!Bstrstr(glinfo.extensions, "GL_SGIS_texture_edge_clamp");
glinfo.bgra = !!Bstrstr(glinfo.extensions, "GL_EXT_bgra");
glinfo.texcompr =
!!Bstrstr(glinfo.extensions, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor, "ATI Technologies Inc.");
glinfo.texnpot = !!Bstrstr(glinfo.extensions, "GL_ARB_texture_non_power_of_two");
glinfo.multisample = !!Bstrstr(glinfo.extensions, "GL_ARB_multisample");
glinfo.nvmultisamplehint = !!Bstrstr(glinfo.extensions, "GL_NV_multisample_filter_hint");
glinfo.arbfp = !!Bstrstr(glinfo.extensions, "GL_ARB_fragment_program");
glinfo.depthtex = !!Bstrstr(glinfo.extensions, "GL_ARB_depth_texture");
glinfo.shadow = !!Bstrstr(glinfo.extensions, "GL_ARB_shadow");
glinfo.fbos = !!Bstrstr(glinfo.extensions, "GL_EXT_framebuffer_object");
glinfo.rect =
!!Bstrstr(glinfo.extensions, "GL_NV_texture_rectangle") || !!Bstrstr(glinfo.extensions, "GL_EXT_texture_rectangle");
glinfo.multitex = !!Bstrstr(glinfo.extensions, "GL_ARB_multitexture");
glinfo.envcombine = !!Bstrstr(glinfo.extensions, "GL_ARB_texture_env_combine");
glinfo.vbos = !!Bstrstr(glinfo.extensions, "GL_ARB_vertex_buffer_object");
glinfo.sm4 = !!Bstrstr(glinfo.extensions, "GL_EXT_gpu_shader4");
glinfo.occlusionqueries = !!Bstrstr(glinfo.extensions, "GL_ARB_occlusion_query");
glinfo.glsl = !!Bstrstr(glinfo.extensions, "GL_ARB_shader_objects");
glinfo.debugoutput = !!Bstrstr(glinfo.extensions, "GL_ARB_debug_output");
glinfo.clamptoedge = !!Bstrstr(p, "GL_EXT_texture_edge_clamp") || !!Bstrstr(p, "GL_SGIS_texture_edge_clamp");
glinfo.bgra = !!Bstrstr(p, "GL_EXT_bgra");
glinfo.texcompr = !!Bstrstr(p, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor, "ATI Technologies Inc.");
glinfo.texnpot = !!Bstrstr(p, "GL_ARB_texture_non_power_of_two");
glinfo.multisample = !!Bstrstr(p, "GL_ARB_multisample");
glinfo.nvmultisamplehint = !!Bstrstr(p, "GL_NV_multisample_filter_hint");
glinfo.arbfp = !!Bstrstr(p, "GL_ARB_fragment_program");
glinfo.depthtex = !!Bstrstr(p, "GL_ARB_depth_texture");
glinfo.shadow = !!Bstrstr(p, "GL_ARB_shadow");
glinfo.fbos = !!Bstrstr(p, "GL_EXT_framebuffer_object");
glinfo.rect = !!Bstrstr(p, "GL_NV_texture_rectangle") || !!Bstrstr(p, "GL_EXT_texture_rectangle");
glinfo.multitex = !!Bstrstr(p, "GL_ARB_multitexture");
glinfo.envcombine = !!Bstrstr(p, "GL_ARB_texture_env_combine");
glinfo.vbos = !!Bstrstr(p, "GL_ARB_vertex_buffer_object");
glinfo.sm4 = !!Bstrstr(p, "GL_EXT_gpu_shader4");
glinfo.occlusionqueries = !!Bstrstr(p, "GL_ARB_occlusion_query");
glinfo.glsl = !!Bstrstr(p, "GL_ARB_shader_objects");
glinfo.debugoutput = !!Bstrstr(p, "GL_ARB_debug_output");
if (Bstrstr(p, "GL_EXT_texture_filter_anisotropic"))
if (Bstrstr(glinfo.extensions, "GL_EXT_texture_filter_anisotropic"))
bglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
if (Bstrstr(p, "WGL_3DFX_gamma_control"))
if (Bstrstr(glinfo.extensions, "WGL_3DFX_gamma_control"))
{
static int32_t warnonce;
// 3dfx cards have issues with fog
@ -1650,13 +1649,10 @@ int32_t setgamma(void)
#if !defined(__APPLE__) && !defined(__ANDROID__)
extern struct sdlappicon sdlappicon;
static SDL_Surface *loadappicon(void)
static inline SDL_Surface *loadappicon(void)
{
SDL_Surface *surf;
surf = SDL_CreateRGBSurfaceFrom((void *)sdlappicon.pixels, sdlappicon.width, sdlappicon.height, 32,
SDL_Surface *surf = SDL_CreateRGBSurfaceFrom((void *)sdlappicon.pixels, sdlappicon.width, sdlappicon.height, 32,
sdlappicon.width * 4, 0xffl, 0xff00l, 0xff0000l, 0xff000000l);
return surf;
}
#endif

View file

@ -107,8 +107,8 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3
if (!si)
{
if (dapalnum >= (MAXPALOOKUPS - RESERVEDPALS)) return NULL;
return hicprecaching ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
return (dapalnum >= (MAXPALOOKUPS - RESERVEDPALS) || hicprecaching) ?
NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
}
/* if palette > 0 && replacement found
@ -122,10 +122,9 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3
{
if (pth->picnum == dapicnum && pth->palnum == si->palnum &&
(si->palnum > 0 ? 1 : (pth->effects == hictinting[dapalnum].f)) &&
(pth->flags & (PTH_CLAMPED + PTH_HIGHTILE + PTH_SKYBOX))
== (TO_PTH_CLAMPED(dameth) + PTH_HIGHTILE + (drawingskybox>0)*PTH_SKYBOX) &&
(drawingskybox>0 ? (pth->skyface == drawingskybox) : 1)
)
(pth->flags & (PTH_CLAMPED + PTH_HIGHTILE + PTH_SKYBOX)) ==
(TO_PTH_CLAMPED(dameth) + PTH_HIGHTILE + (drawingskybox > 0) * PTH_SKYBOX) &&
(drawingskybox > 0 ? (pth->skyface == drawingskybox) : 1))
{
if (pth->flags & PTH_INVALIDATED)
{
@ -134,13 +133,12 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3
tilestat = gloadtile_hi(dapicnum, dapalnum, drawingskybox, si, dameth, pth, 0,
(si->palnum > 0) ? 0 : hictinting[dapalnum].f); // reload tile
if (tilestat)
{
if (!tilestat)
continue;
if (tilestat == -2) // bad filename
hicclearsubst(dapicnum, dapalnum);
if (drawingskybox) return NULL;
return hicprecaching ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
}
return (drawingskybox || hicprecaching) ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
}
return (pth);
@ -153,22 +151,23 @@ pthtyp *texcache_fetch(int32_t dapicnum, int32_t dapalnum, int32_t dashade, int3
if (dapalnum >= (MAXPALOOKUPS - RESERVEDPALS) && texcache_fetchmulti(pth, si, dapicnum, dameth))
return pth;
tilestat = gloadtile_hi(dapicnum, dapalnum, drawingskybox, si, dameth, pth, 1, (si->palnum>0) ? 0 : hictinting[dapalnum].f);
tilestat =
gloadtile_hi(dapicnum, dapalnum, drawingskybox, si, dameth, pth, 1, (si->palnum > 0) ? 0 : hictinting[dapalnum].f);
if (tilestat)
if (!tilestat)
{
if (tilestat == -2) // bad filename
hicclearsubst(dapicnum, dapalnum);
Bfree(pth);
if (drawingskybox) return NULL;
return hicprecaching ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
pth->next = texcache.list[j];
pth->palnum = si->palnum;
texcache.list[j] = pth;
return pth;
}
pth->palnum = si->palnum;
pth->next = texcache.list[j];
texcache.list[j] = pth;
if (tilestat == -2) // bad filename
hicclearsubst(dapicnum, dapalnum);
return(pth);
Bfree(pth);
return (drawingskybox || hicprecaching) ? NULL : texcache_tryart(dapicnum, dapalnum, dashade, dameth);
}
static void texcache_closefiles(void)
@ -183,14 +182,15 @@ static void texcache_closefiles(void)
void texcache_freeptrs(void)
{
int32_t i;
texcache.iptrcnt = 0;
if (texcache.iptrs)
for (i = 0; i < texcache.numentries; i++)
if (!texcache.iptrs)
return;
for (int i = 0; i < texcache.numentries; i++)
if (texcache.iptrs[i])
{
int32_t ii;
for (ii = texcache.numentries-1; ii >= 0; ii--)
for (int ii = texcache.numentries - 1; ii >= 0; ii--)
if (i != ii && texcache.iptrs[ii] == texcache.iptrs[i])
{
/*OSD_Printf("removing duplicate cacheptr %d\n",ii);*/
@ -201,7 +201,6 @@ void texcache_freeptrs(void)
texcache.iptrs[i] = NULL;
}
texcache.iptrcnt = 0;
DO_FREE_AND_NULL(texcache.iptrs);
}