From affde05dc07a94643f1fd2751b2b441f57f73d7d Mon Sep 17 00:00:00 2001 From: xolatile Date: Tue, 5 Aug 2025 17:04:48 +0200 Subject: Minor cleanups, just compiles... --- src/engine/lightmap.cpp | 7 ------ src/engine/main.cpp | 3 +++ src/engine/material.cpp | 4 ---- src/engine/octaedit.cpp | 4 +--- src/engine/octarender.cpp | 3 +-- src/engine/ragdoll.h | 1 - src/engine/rendergl.cpp | 18 -------------- src/engine/renderva.cpp | 14 ----------- src/engine/shader.cpp | 25 -------------------- src/engine/texture.cpp | 1 - src/engine/worldio.cpp | 60 +++++++++++------------------------------------ 11 files changed, 19 insertions(+), 121 deletions(-) (limited to 'src/engine') diff --git a/src/engine/lightmap.cpp b/src/engine/lightmap.cpp index e705e4b..a317dd5 100644 --- a/src/engine/lightmap.cpp +++ b/src/engine/lightmap.cpp @@ -349,13 +349,6 @@ static void insertlightmap(lightmapinfo &li, layoutinfo &si) } } -static void copylightmap(lightmapinfo &li, layoutinfo &si) -{ - lightmaps[si.lmid-LMID_RESERVED].copy(si.x, si.y, li.colorbuf, si.w, si.h); - if((li.type&LM_TYPE)==LM_BUMPMAP0 && lightmaps.inrange(si.lmid+1-LMID_RESERVED)) - lightmaps[si.lmid+1-LMID_RESERVED].copy(si.x, si.y, (uchar *)li.raybuf, si.w, si.h); -} - static inline bool htcmp(const lightmapinfo &k, const layoutinfo &v) { int kw = k.w, kh = k.h; diff --git a/src/engine/main.cpp b/src/engine/main.cpp index d00e0e4..5d264ed 100644 --- a/src/engine/main.cpp +++ b/src/engine/main.cpp @@ -1270,6 +1270,9 @@ int main(int argc, char **argv) if(minimized) continue; inbetweenframes = false; + + glClearColor(0,0,0,1);///TODO + if(mainmenu) gl_drawmainmenu(); else gl_drawframe(); swapbuffers(); diff --git a/src/engine/material.cpp b/src/engine/material.cpp index b8a3f7f..e29ccf5 100644 --- a/src/engine/material.cpp +++ b/src/engine/material.cpp @@ -59,8 +59,6 @@ struct QuadNode { } }; -static float wfwave; - static const bvec4 matnormals[6] = { bvec4(0x80, 0, 0), bvec4(0x7F, 0, 0), @@ -366,7 +364,6 @@ void sortmaterials(vector &vismats) materialsurface &m = va->matbuf[i]; if(!editmode || !showmat || drawtex) { - int matvol = 0; if(m.visible == MATSURF_EDIT_ONLY) { i += m.skip; continue; } } vismats.add(&m); @@ -413,7 +410,6 @@ void rendermaterials() glDisable(GL_CULL_FACE); - MSlot *mslot = NULL; int lastorient = -1, lastmat = -1; bool depth = true, blended = false; diff --git a/src/engine/octaedit.cpp b/src/engine/octaedit.cpp index af8e9ec..fb37088 100644 --- a/src/engine/octaedit.cpp +++ b/src/engine/octaedit.cpp @@ -2522,14 +2522,12 @@ void rendertexturepanel(int w, int h) { VSlot &vslot = lookupvslot(texmru[ti]), *layer = NULL; Slot &slot = *vslot.slot; - Texture *tex = slot.sts.empty() ? notexture : slot.sts[0].t, *layertex = NULL; + Texture *tex = slot.sts.empty() ? notexture : slot.sts[0].t; if(vslot.layer) { layer = &lookupvslot(vslot.layer); - layertex = layer->slot->sts.empty() ? notexture : layer->slot->sts[0].t; } float sx = min(1.0f, tex->xs/(float)tex->ys), sy = min(1.0f, tex->ys/(float)tex->xs); - int x = w*1800/h-s-50, r = s; vec2 tc[4] = { vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1) }; float xoff = vslot.offset.x, yoff = vslot.offset.y; if(vslot.rotation) diff --git a/src/engine/octarender.cpp b/src/engine/octarender.cpp index 9253379..6b8a5b5 100644 --- a/src/engine/octarender.cpp +++ b/src/engine/octarender.cpp @@ -1106,8 +1106,7 @@ int genmergedfaces(cube &c, const ivec &co, int size, int minlevel = -1) while(tj >= 0 && tjoints[tj].edge < i*(MAXFACEVERTS+1)) tj = tjoints[tj].next; if(tj >= 0 && tjoints[tj].edge < (i+1)*(MAXFACEVERTS+1)) mf.tjoints = tj; - VSlot &vslot = lookupvslot(mf.tex, true), - *layer = vslot.layer && !(c.material&MAT_ALPHA) ? &lookupvslot(vslot.layer, true) : NULL; + VSlot &vslot = lookupvslot(mf.tex, true); if(surf.numverts&LAYER_TOP) vamerges[level].add(mf); if(surf.numverts&LAYER_BOTTOM) diff --git a/src/engine/ragdoll.h b/src/engine/ragdoll.h index 1e51c81..4dac48c 100644 --- a/src/engine/ragdoll.h +++ b/src/engine/ragdoll.h @@ -446,7 +446,6 @@ void ragdolldata::move(dynent *pl, float ts) extern const float GRAVITY; if(collidemillis && lastmillis > collidemillis) return; - int material = lookupmaterial(vec(center.x, center.y, center.z + radius/2)); pl->inwater = MAT_AIR; calcrotfriction(); diff --git a/src/engine/rendergl.cpp b/src/engine/rendergl.cpp index 08766a6..7489ff5 100644 --- a/src/engine/rendergl.cpp +++ b/src/engine/rendergl.cpp @@ -579,8 +579,6 @@ void setcamprojmatrix(bool init = true, bool flush = false) GLOBALPARAM(camprojmatrix, camprojmatrix); - vec2 lineardepthscale = projmatrix.lineardepthscale(); - if(flush && Shader::lastshader) Shader::lastshader->flushparams(); } @@ -1026,22 +1024,6 @@ void hudquad(float x, float y, float w, float h, float tx, float ty, float tw, f HUDQUAD(x, y, x+w, y+h, tx, ty, tx+tw, ty+th); } -static float findsurface(const vec &v, int &abovemat) -{ - ivec o(v), co; - int csize; - do - { - cube &c = lookupcube(o, 0, co, csize); - abovemat = (int) MAT_AIR; - return o.z; - o.z = co.z + csize; - } - while(o.z < worldsize); - abovemat = MAT_AIR; - return worldsize; -} - bool renderedgame = false; void rendergame(bool mainpass) diff --git a/src/engine/renderva.cpp b/src/engine/renderva.cpp index 854f569..1e33702 100644 --- a/src/engine/renderva.cpp +++ b/src/engine/renderva.cpp @@ -1176,20 +1176,6 @@ void cleanupgeom(renderstate &cur) if(cur.vbuf) disablevbuf(cur); } -static void rendergeommultipass(renderstate &cur, int pass) -{ - if(cur.vbuf) disablevbuf(cur); - if(!cur.vattribs) enablevattribs(cur, false); - cur.texgendim = -1; - for(vtxarray *va = visibleva; va; va = va->next) - { - if(!va->texs) continue; - if(va->occluded >= OCCLUDE_GEOM) continue; - renderva(cur, va, pass); - } - if(geombatches.length()) renderbatches(cur, pass); -} - VAR(oqgeom, 0, 1, 1); void rendergeom(void) diff --git a/src/engine/shader.cpp b/src/engine/shader.cpp index 5e56e81..67b9e42 100644 --- a/src/engine/shader.cpp +++ b/src/engine/shader.cpp @@ -399,31 +399,6 @@ void GlobalShaderParamState::resetversions() }); } -static float *findslotparam(Slot &s, const char *name, float *noval = NULL) -{ - loopv(s.params) - { - SlotShaderParam ¶m = s.params[i]; - if(name == param.name) return param.val; - } - loopv(s.shader->defaultparams) - { - SlotShaderParamState ¶m = s.shader->defaultparams[i]; - if(name == param.name) return param.val; - } - return noval; -} - -static float *findslotparam(VSlot &s, const char *name, float *noval = NULL) -{ - loopv(s.params) - { - SlotShaderParam ¶m = s.params[i]; - if(name == param.name) return param.val; - } - return findslotparam(*s.slot, name, noval); -} - static inline void setslotparam(SlotShaderParamState &l, const float *val) { switch(l.format) diff --git a/src/engine/texture.cpp b/src/engine/texture.cpp index 77eac65..7f391a9 100644 --- a/src/engine/texture.cpp +++ b/src/engine/texture.cpp @@ -2040,7 +2040,6 @@ int findslottex(const char *name) void texture(char *type, char *name, int *rot, int *xoffset, int *yoffset, float *scale) { if(slots.length()>=0x10000) return; - static int lastmatslot = -1; int tnum = findslottex(type); if(tnum<0) tnum = atoi(type); Slot &s = *(tnum!=TEX_DIFFUSE ? slots.last() : slots.add(new Slot(slots.length()))); diff --git a/src/engine/worldio.cpp b/src/engine/worldio.cpp index 4d5e178..4e309a8 100644 --- a/src/engine/worldio.cpp +++ b/src/engine/worldio.cpp @@ -70,22 +70,12 @@ bool loadents(const char *fname, vector &ents, uint *crc) string gametype; copystring(gametype, "fps"); - bool samegame = true; int eif = 0; - { - int len = f->getchar(); - f->read(gametype, len+1); - } - if(strcmp(gametype, game::gameident())) - { - samegame = false; - conoutf(CON_WARN, "WARNING: loading map from %s game, ignoring entities except for lights/mapmodels", gametype); - } - { - eif = f->getlil(); - int extrasize = f->getlil(); - f->seek(extrasize, SEEK_CUR); - } + int len = f->getchar(); + f->read(gametype, len+1); + eif = f->getlil(); + int extrasize = f->getlil(); + f->seek(extrasize, SEEK_CUR); ushort nummru = f->getlil(); f->seek(nummru*sizeof(ushort), SEEK_CUR); @@ -803,24 +793,14 @@ bool load_world(const char *mname, const char *cname) // still supports all map string gametype; copystring(gametype, "fps"); - bool samegame = true; int eif = 0; - { - int len = f->getchar(); - f->read(gametype, len+1); - } - if(strcmp(gametype, game::gameident())!=0) - { - samegame = false; - conoutf(CON_WARN, "WARNING: loading map from %s game, ignoring entities except for lights/mapmodels", gametype); - } - { - eif = f->getlil(); - int extrasize = f->getlil(); - vector extras; - f->read(extras.pad(extrasize), extrasize); - if(samegame) game::readgamedata(extras); - } + int len = f->getchar(); + f->read(gametype, len+1); + eif = f->getlil(); + int extrasize = f->getlil(); + vector extras; + f->read(extras.pad(extrasize), extrasize); + game::readgamedata(extras); texmru.shrink(0); ushort nummru = f->getlil(); @@ -838,19 +818,7 @@ bool load_world(const char *mname, const char *cname) // still supports all map f->read(&e, sizeof(entity)); lilswap(&e.o.x, 3); lilswap(&e.attr1, 5); - if(samegame) - { - if(einfosize > 0) f->read(ebuf, einfosize); - } - else - { - if(eif > 0) f->seek(eif, SEEK_CUR); - if(e.type>=ET_GAMESPECIFIC) - { - entities::deleteentity(ents.pop()); - continue; - } - } + if(einfosize > 0) f->read(ebuf, einfosize); if(!insideworld(e.o)) { if(e.type != ET_LIGHT && e.type != ET_SPOTLIGHT) @@ -864,7 +832,7 @@ bool load_world(const char *mname, const char *cname) // still supports all map if(hdr.numents > MAXENTS) { conoutf(CON_WARN, "warning: map has %d entities", hdr.numents); - f->seek((hdr.numents-MAXENTS)*(samegame ? sizeof(entity) + einfosize : eif), SEEK_CUR); + f->seek((hdr.numents-MAXENTS)*(sizeof(entity) + einfosize), SEEK_CUR); } renderprogress(0, "loading slots..."); -- cgit v1.2.3