summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxolatile2025-08-05 10:40:01 +0200
committerxolatile2025-08-05 10:40:01 +0200
commita2a16b85572b1d28b0cd4901ea7348750732a740 (patch)
tree6287cdf8331e821f9fe1e0adadc664a59634a812 /src
parent6762e292d02e37a69a807e01493d4e14319cca33 (diff)
downloadxolatile-badassbug-a2a16b85572b1d28b0cd4901ea7348750732a740.tar.xz
xolatile-badassbug-a2a16b85572b1d28b0cd4901ea7348750732a740.tar.zst
Few more changes, please do not compile...
Diffstat (limited to 'src')
-rw-r--r--src/engine/decal.cpp1
-rw-r--r--src/engine/engine.h6
-rw-r--r--src/engine/lightmap.cpp8
-rw-r--r--src/engine/main.cpp4
-rw-r--r--src/engine/material.cpp90
-rw-r--r--src/engine/normal.cpp1
-rw-r--r--src/engine/octa.cpp5
-rw-r--r--src/engine/octa.h12
-rw-r--r--src/engine/octaedit.cpp402
-rw-r--r--src/engine/octarender.cpp200
-rw-r--r--src/engine/physics.cpp83
-rw-r--r--src/engine/rendergl.cpp66
-rw-r--r--src/engine/renderva.cpp99
-rw-r--r--src/engine/world.h5
-rw-r--r--src/fpsgame/ai.cpp2
-rw-r--r--src/fpsgame/fps.cpp2
-rw-r--r--src/fpsgame/waypoint.cpp6
-rw-r--r--src/shared/iengine.h6
-rw-r--r--src/shared/igame.h2
19 files changed, 88 insertions, 912 deletions
diff --git a/src/engine/decal.cpp b/src/engine/decal.cpp
index 27020d7..43ef667 100644
--- a/src/engine/decal.cpp
+++ b/src/engine/decal.cpp
@@ -399,7 +399,6 @@ struct decalrenderer
#undef GENFACEVERT
}
}
- else if(cu.texture[orient] == DEFAULT_SKY) return;
else if(cu.ext && (numverts = cu.ext->surfaces[orient].numverts&MAXFACEVERTS))
{
vertinfo *verts = cu.ext->verts() + cu.ext->surfaces[orient].verts;
diff --git a/src/engine/engine.h b/src/engine/engine.h
index 7d364b8..9f47209 100644
--- a/src/engine/engine.h
+++ b/src/engine/engine.h
@@ -69,7 +69,6 @@ extern void cleanuptexture(Texture *t);
extern uchar *loadalphamask(Texture *t);
extern void loadlayermasks();
extern Texture *cubemapload(const char *name, bool mipit = true, bool msg = true, bool transient = false);
-extern void drawcubemap(int size, const vec &o, float yaw, float pitch, const cubemapside &side, bool onlysky = false);
extern void loadshaders();
extern void setuptexparameters(int tnum, void *pixels, int clamp, int filter, GLenum format = GL_RGB, GLenum target = GL_TEXTURE_2D, bool swizzle = false);
extern void createtexture(int tnum, int w, int h, void *pixels, int clamp, int filter, GLenum component = GL_RGB, GLenum target = GL_TEXTURE_2D, int pw = 0, int ph = 0, int pitch = 0, bool resize = true, GLenum format = GL_FALSE, bool swizzle = false);
@@ -245,11 +244,10 @@ extern void visiblecubes(bool cull = true);
extern void setvfcP(float z = -1, const vec &bbmin = vec(-1, -1, -1), const vec &bbmax = vec(1, 1, 1));
extern void savevfcP();
extern void restorevfcP();
-extern void rendergeom(bool fogpass = false);
-extern void renderalphageom(bool fogpass = false);
+extern void rendergeom(void);
+extern void renderalphageom(void);
extern void rendermapmodels();
extern void renderoutline();
-extern bool rendersky(bool explicitonly = false);
extern int isvisiblesphere(float rad, const vec &cv);
extern bool bboccluded(const ivec &bo, const ivec &br);
diff --git a/src/engine/lightmap.cpp b/src/engine/lightmap.cpp
index b8759c9..da1a5df 100644
--- a/src/engine/lightmap.cpp
+++ b/src/engine/lightmap.cpp
@@ -634,7 +634,7 @@ static bool generatelightmap(lightmapworker *w, float lpu, const lerpvert *lv, i
int aasample = min(1 << lmaa, 4);
int stride = aasample*(w->w+1);
vec *sample = w->colordata;
- uchar *skylight = w->ambient;
+ uchar *amb = w->ambient;
lerpbounds start, end;
initlerpbounds(-blurlms, -blurlms, lv, numv, start, end);
float sidex = side0 + blurlms*sidestep;
@@ -643,7 +643,7 @@ static bool generatelightmap(lightmapworker *w, float lpu, const lerpvert *lv, i
vec normal, nstep;
lerpnormal(-blurlms, y - blurlms, lv, numv, start, end, normal, nstep);
- for(int x = 0; x < w->w; ++x, normal.add(nstep), skylight += w->bpp)
+ for(int x = 0; x < w->w; ++x, normal.add(nstep), amb += w->bpp)
{
#define EDGE_TOLERANCE(x, y) \
(x < blurlms \
@@ -1625,7 +1625,7 @@ static void generatelightmaps(cube *c, const ivec &co, int size)
}
}
int usefacemask = 0;
- loopj(6) if(c[i].texture[j] != DEFAULT_SKY && (!(c[i].merged&(1<<j)) || (c[i].ext && c[i].ext->surfaces[j].numverts&MAXFACEVERTS)))
+ loopj(6) if(!(c[i].merged&(1<<j)) || (c[i].ext && c[i].ext->surfaces[j].numverts&MAXFACEVERTS))
{
usefacemask |= visibletris(c[i], j, o, size)<<(4*j);
}
@@ -1651,7 +1651,7 @@ static bool previewblends(lightmapworker *w, cube &c, const ivec &co, int size)
if(isempty(c) || c.material&MAT_ALPHA) return false;
int usefacemask = 0;
- loopi(6) if(c.texture[i] != DEFAULT_SKY && lookupvslot(c.texture[i], false).layer)
+ loopi(6) if(lookupvslot(c.texture[i], false).layer)
usefacemask |= visibletris(c, i, co, size)<<(4*i);
if(!usefacemask) return false;
diff --git a/src/engine/main.cpp b/src/engine/main.cpp
index 17d88fe..96383c6 100644
--- a/src/engine/main.cpp
+++ b/src/engine/main.cpp
@@ -705,7 +705,6 @@ void resetgl()
extern void cleanupva();
extern void cleanupparticles();
extern void cleanupdecals();
- extern void cleanupsky();
extern void cleanupmodels();
extern void cleanupprefabs();
extern void cleanuplightmaps();
@@ -715,7 +714,6 @@ void resetgl()
cleanupva();
cleanupparticles();
cleanupdecals();
- cleanupsky();
cleanupmodels();
cleanupprefabs();
cleanuptextures();
@@ -1192,8 +1190,6 @@ int main(int argc, char **argv)
execfile("data/stdedit.cfg");
execfile("data/sounds.cfg");
execfile("data/menus.cfg");
- execfile("data/heightmap.cfg");
- execfile("data/brushes.cfg");
execfile("data/game.cfg");
execfile("data/custom_maps_menu.cfg");
if(game::savedservers()) execfile(game::savedservers(), false);
diff --git a/src/engine/material.cpp b/src/engine/material.cpp
index 2cc8177..6fee9d3 100644
--- a/src/engine/material.cpp
+++ b/src/engine/material.cpp
@@ -101,9 +101,6 @@ const struct material
} materials[] =
{
{"air", MAT_AIR},
- {"water", MAT_WATER}, {"water1", MAT_WATER}, {"water2", MAT_WATER+1}, {"water3", MAT_WATER+2}, {"water4", MAT_WATER+3},
- {"glass", MAT_GLASS}, {"glass1", MAT_GLASS}, {"glass2", MAT_GLASS+1}, {"glass3", MAT_GLASS+2}, {"glass4", MAT_GLASS+3},
- {"lava", MAT_LAVA}, {"lava1", MAT_LAVA}, {"lava2", MAT_LAVA+1}, {"lava3", MAT_LAVA+2}, {"lava4", MAT_LAVA+3},
{"clip", MAT_CLIP},
{"noclip", MAT_NOCLIP},
{"gameclip", MAT_GAMECLIP},
@@ -151,17 +148,6 @@ int visiblematerial(const cube &c, int orient, const ivec &co, int size, ushort
case MAT_AIR:
break;
- case MAT_LAVA:
- case MAT_WATER:
- if(visibleface(c, orient, co, size, mat, MAT_AIR, matmask))
- return (orient != O_BOTTOM ? MATSURF_VISIBLE : MATSURF_EDIT_ONLY);
- break;
-
- case MAT_GLASS:
- if(visibleface(c, orient, co, size, MAT_GLASS, MAT_AIR, matmask))
- return MATSURF_VISIBLE;
- break;
-
default:
if(visibleface(c, orient, co, size, mat, MAT_AIR, matmask))
return MATSURF_EDIT_ONLY;
@@ -284,7 +270,7 @@ int optimizematsurfs(materialsurface *matbuf, int matsurfs)
cur->visible == start->visible &&
cur->o[dim] == start->o[dim])
++cur;
- if(start->orient != O_TOP || !vertwater)
+ if(start->orient != O_TOP)
{
if(start!=matbuf) memmove(matbuf, start, (cur-start)*sizeof(materialsurface));
matbuf += mergemats(matbuf, cur-start);
@@ -336,11 +322,6 @@ static bool sortedit;
static inline bool vismatcmp(const materialsurface *xm, const materialsurface *ym)
{
const materialsurface &x = *xm, &y = *ym;
- if(!sortedit)
- {
- if((x.material&MATF_VOLUME) == MAT_LAVA) { if((y.material&MATF_VOLUME) != MAT_LAVA) return true; }
- else if((y.material&MATF_VOLUME) == MAT_LAVA) return false;
- }
int xdim = dimension(x.orient), ydim = dimension(y.orient);
loopi(3)
{
@@ -387,7 +368,6 @@ void sortmaterials(vector<materialsurface *> &vismats)
{
int matvol = m.material&MATF_VOLUME;
if(m.visible == MATSURF_EDIT_ONLY) { i += m.skip; continue; }
- if(glaring && matvol!=MAT_LAVA) { i += m.skip; continue; }
}
else if(glaring) continue;
vismats.add(&m);
@@ -410,11 +390,8 @@ void rendermatgrid(vector<materialsurface *> &vismats)
{
switch(m.material&~MATF_INDEX)
{
- case MAT_WATER: color = bvec4( 0, 0, 85, 255); break; // blue
case MAT_CLIP: color = bvec4(85, 0, 0, 255); break; // red
- case MAT_GLASS: color = bvec4( 0, 85, 85, 255); break; // cyan
case MAT_NOCLIP: color = bvec4( 0, 85, 0, 255); break; // green
- case MAT_LAVA: color = bvec4(85, 40, 0, 255); break; // orange
case MAT_GAMECLIP: color = bvec4(85, 85, 0, 255); break; // yellow
case MAT_DEATH: color = bvec4(40, 40, 40, 255); break; // black
case MAT_ALPHA: color = bvec4(85, 0, 85, 255); break; // pink
@@ -429,62 +406,6 @@ void rendermatgrid(vector<materialsurface *> &vismats)
disablepolygonoffset(GL_POLYGON_OFFSET_LINE);
}
-#define GLASSVARS(name) \
- bvec name##color(0x20, 0x80, 0xC0); \
- HVARFR(name##colour, 0, 0x2080C0, 0xFFFFFF, \
- { \
- if(!name##colour) name##colour = 0x2080C0; \
- name##color = bvec((name##colour>>16)&0xFF, (name##colour>>8)&0xFF, name##colour&0xFF); \
- });
-
-GLASSVARS(glass)
-GLASSVARS(glass2)
-GLASSVARS(glass3)
-GLASSVARS(glass4)
-
-GETMATIDXVAR(glass, colour, int)
-GETMATIDXVAR(glass, color, const bvec &)
-
-VARP(glassenv, 0, 1, 1);
-
-static void drawglass(const materialsurface &m, float offset)
-{
- if(gle::attribbuf.empty())
- {
- gle::defvertex();
- gle::defnormal(4, GL_BYTE);
- gle::begin(GL_QUADS);
- }
- float x = m.o.x, y = m.o.y, z = m.o.z, csize = m.csize, rsize = m.rsize;
- switch(m.orient)
- {
- #define GENFACEORIENT(orient, v0, v1, v2, v3) \
- case orient: v0 v1 v2 v3 break;
- #define GENFACEVERT(orient, vert, mx,my,mz, sx,sy,sz) \
- { \
- gle::attribf(mx sx, my sy, mz sz); \
- gle::attrib(matnormals[orient]); \
- }
- GENFACEVERTS(x, x, y, y, z, z, /**/, + csize, /**/, + rsize, + offset, - offset)
- #undef GENFACEORIENT
- #undef GENFACEVERT
- }
-}
-
-static inline void changematerial(int mat, int orient)
-{
- switch(mat&~MATF_INDEX)
- {
- case MAT_LAVA:
- if(orient==O_TOP) flushlava();
- else xtraverts += gle::end();
- break;
- default:
- xtraverts += gle::end();
- break;
- }
-}
-
void rendermaterials()
{
vector<materialsurface *> vismats;
@@ -512,11 +433,8 @@ void rendermaterials()
{
switch(m.material&~MATF_INDEX)
{
- case MAT_WATER: color = bvec4(255, 128, 0, 255); break; // blue
case MAT_CLIP: color = bvec4( 0, 255, 255, 255); break; // red
- case MAT_GLASS: color = bvec4(255, 0, 0, 255); break; // cyan
case MAT_NOCLIP: color = bvec4(255, 0, 255, 255); break; // green
- case MAT_LAVA: color = bvec4( 0, 128, 255, 255); break; // orange
case MAT_GAMECLIP: color = bvec4( 0, 0, 255, 255); break; // yellow
case MAT_DEATH: color = bvec4(192, 192, 192, 255); break; // black
case MAT_ALPHA: color = bvec4( 0, 255, 0, 255); break; // pink
@@ -529,15 +447,15 @@ void rendermaterials()
xtraverts += gle::end();
}
- if(lastorient >= 0) changematerial(lastmat, lastorient);
+ if(lastorient >= 0)
+ if(lastmat&~MATF_INDEX)
+ xtraverts += gle::end();
if(!depth) glDepthMask(GL_TRUE);
if(blended) glDisable(GL_BLEND);
extern int wireframe;
if(editmode && showmat && !drawtex && !wireframe)
- {
rendermatgrid(vismats);
- }
glEnable(GL_CULL_FACE);
}
diff --git a/src/engine/normal.cpp b/src/engine/normal.cpp
index dad00b0..cba6777 100644
--- a/src/engine/normal.cpp
+++ b/src/engine/normal.cpp
@@ -153,7 +153,6 @@ void addnormals(cube &c, const ivec &o, int size)
loopi(6) if((vis = visibletris(c, i, o, size)))
{
CHECK_CALCLIGHT_PROGRESS(return, show_addnormals_progress);
- if(c.texture[i] == DEFAULT_SKY) continue;
vec planes[2];
int numverts = c.ext ? c.ext->surfaces[i].numverts&MAXFACEVERTS : 0, convex = 0, numplanes = 0;
diff --git a/src/engine/octa.cpp b/src/engine/octa.cpp
index 7886d59..3d47cd3 100644
--- a/src/engine/octa.cpp
+++ b/src/engine/octa.cpp
@@ -305,10 +305,10 @@ int getmippedtexture(const cube &p, int orient)
continue;
}
int tex = c[n].texture[orient];
- if(tex > DEFAULT_SKY) loopi(numtexs) if(texs[i] == tex) return tex;
+ loopi(numtexs) if(texs[i] == tex) return tex;
texs[numtexs++] = tex;
}
- loopirev(numtexs) if(!i || texs[i] > DEFAULT_SKY) return texs[i];
+ loopirev(numtexs) if(!i) return texs[i];
return DEFAULT_GEOM;
}
@@ -1032,7 +1032,6 @@ bool visibleface(const cube &c, int orient, const ivec &co, int size, ushort mat
{
if(nmat != MAT_AIR && (o.material&matmask) == nmat) return true;
if(isentirelysolid(o)) return false;
- if(mat != MAT_AIR && ((o.material&matmask) == mat || ((o.material&MATF_VOLUME) == MAT_GLASS))) return false;
if(isempty(o) || notouchingface(o, opp)) return true;
if(touchingface(o, opp) && faceedges(o, opp) == F_SOLID) return false;
diff --git a/src/engine/octa.h b/src/engine/octa.h
index 7312b7a..41e315e 100644
--- a/src/engine/octa.h
+++ b/src/engine/octa.h
@@ -11,7 +11,6 @@ enum
{
EMID_NONE = 0,
EMID_CUSTOM,
- EMID_SKY,
EMID_RESERVED
};
@@ -121,13 +120,12 @@ struct vtxarray
vtxarray *next, *rnext; // linked list of visible VOBs
vertex *vdata; // vertex data
ushort voffset; // offset into vertex data
- ushort *edata, *skydata; // vertex indices
- GLuint vbuf, ebuf, skybuf; // VBOs
+ ushort *edata; // vertex indices
+ GLuint vbuf, ebuf; // VBOs
ushort minvert, maxvert; // DRE info
elementset *eslist; // List of element indices sets (range) per texture
materialsurface *matbuf; // buffer of material surfaces
- int verts, tris, texs, blendtris, blends, alphabacktris, alphaback, alphafronttris, alphafront, alphatris, texmask, sky, explicitsky, skyfaces, skyclip, matsurfs, distance;
- double skyarea;
+ int verts, tris, texs, blendtris, blends, alphabacktris, alphaback, alphafronttris, alphafront, alphatris, texmask, matsurfs, distance;
ivec o;
int size; // location and size of cube.
ivec geommin, geommax; // BB of geom
@@ -289,11 +287,9 @@ enum
{
VFC_FULL_VISIBLE = 0,
VFC_PART_VISIBLE,
- VFC_FOGGED,
VFC_NOT_VISIBLE,
PVS_FULL_VISIBLE,
- PVS_PART_VISIBLE,
- PVS_FOGGED
+ PVS_PART_VISIBLE
};
#define GENCUBEVERTS(x0,x1, y0,y1, z0,z1) \
diff --git a/src/engine/octaedit.cpp b/src/engine/octaedit.cpp
index 0b2cbe1..239c6a4 100644
--- a/src/engine/octaedit.cpp
+++ b/src/engine/octaedit.cpp
@@ -100,8 +100,6 @@ ivec cur, lastcur;
extern int entediting;
bool editmode = false;
bool havesel = false;
-bool hmapsel = false;
-int horient = 0;
extern int entmoving;
@@ -135,18 +133,14 @@ VARF(gridpower, 0, 3, 12,
VAR(passthroughsel, 0, 0, 1);
VAR(editing, 1, 0, 0);
VAR(selectcorners, 0, 0, 1);
-VARF(hmapedit, 0, 0, 1, horient = sel.orient);
void forcenextundo() { lastsel.orient = -1; }
-extern void hmapcancel();
-
void cubecancel()
{
havesel = false;
- moving = dragging = hmapedit = passthroughsel = 0;
+ moving = dragging = passthroughsel = 0;
forcenextundo();
- hmapcancel();
}
void cancelsel()
@@ -343,7 +337,6 @@ bool editmoveplane(const vec &o, const vec &ray, int d, float off, vec &handle,
return true;
}
-inline bool isheightmap(int orient, int d, bool empty, cube *c);
extern void entdrag(const vec &ray);
extern bool hoveringonent(int ent, int orient);
extern void renderentselection(const vec &o, const vec &ray, bool entmoving);
@@ -361,7 +354,6 @@ void rendereditcursor()
odc = dimcoord(orient);
bool hidecursor = g3d_windowhit(true, false) || blendpaintmode, hovering = false;
- hmapsel = false;
if(moving)
{
@@ -397,7 +389,7 @@ void rendereditcursor()
| RAY_SKIPFIRST
| (passthroughcube || passthrough ? RAY_PASS : 0), gridsize, entorient, ent);
- if((havesel || dragging) && !passthroughsel && !hmapedit) // now try selecting the selection
+ if((havesel || dragging) && !passthroughsel) // now try selecting the selection
if(rayboxintersect(vec(sel.o), vec(sel.s).mul(sel.grid), player->o, camdir, sdist, orient))
{ // and choose the nearest of the two
if(sdist < wdist)
@@ -430,7 +422,7 @@ void rendereditcursor()
}
}
cube *c = &lookupcube(ivec(w));
- if(gridlookup && !dragging && !moving && !havesel && hmapedit!=1) gridsize = lusize;
+ if(gridlookup && !dragging && !moving && !havesel) gridsize = lusize;
int mag = lusize / gridsize;
normalizelookupcube(ivec(w));
if(sdist == 0 || sdist > wdist) rayboxintersect(vec(lu), vec(gridsize), player->o, camdir, t=0, orient); // just getting orient
@@ -439,13 +431,6 @@ void rendereditcursor()
od = dimension(orient);
d = dimension(sel.orient);
- if(hmapedit==1 && dimcoord(horient) == (camdir[dimension(horient)]<0))
- {
- hmapsel = isheightmap(horient, dimension(horient), false, c);
- if(hmapsel)
- od = dimension(orient = horient);
- }
-
if(dragging)
{
updateselection();
@@ -511,10 +496,7 @@ void rendereditcursor()
if(!moving && !hovering && !hidecursor)
{
- if(hmapedit==1)
- gle::colorub(0, hmapsel ? 255 : 40, 0);
- else
- gle::colorub(120,120,120);
+ gle::colorub(120,120,120);
boxs(orient, vec(lu), vec(lusize));
}
@@ -534,10 +516,7 @@ void rendereditcursor()
cs[C[d]] = 0.5f*(sel.cys*gridsize);
cs[D[d]] *= gridsize;
boxs(sel.orient, co, cs);
- if(hmapedit==1) // 3D selection box
- gle::colorub(0,120,0);
- else
- gle::colorub(0,0,120);
+ gle::colorub(0,0,120);
boxs3D(vec(sel.o), vec(sel.s), sel.grid);
}
@@ -853,11 +832,8 @@ void swapundo(undolist &a, undolist &b, int op)
freeundo(u);
}
commitchanges();
- if(!hmapsel)
- {
- sel = l;
- reorient();
- }
+ sel = l;
+ reorient();
forcenextundo();
}
@@ -1011,7 +987,7 @@ static void unpackvslots(block3 &b, ucharbuf &buf)
VSlot &vs = *lookupslot(hdr.slot, false).variants;
VSlot ds;
if(!unpackvslot(buf, ds, false)) break;
- if(vs.index < 0 || vs.index == DEFAULT_SKY) continue;
+ if(vs.index < 0) continue;
VSlot *edit = editvslot(vs, ds);
unpackingvslots.add(vslotmap(hdr.index, edit ? edit : &vs));
}
@@ -1563,359 +1539,6 @@ void compacteditvslots()
compactvslots(u->block()->c(), u->block()->size());
}
-///////////// height maps ////////////////
-
-#define MAXBRUSH 64
-#define MAXBRUSHC 63
-#define MAXBRUSH2 32
-int brush[MAXBRUSH][MAXBRUSH];
-VAR(brushx, 0, MAXBRUSH2, MAXBRUSH);
-VAR(brushy, 0, MAXBRUSH2, MAXBRUSH);
-bool paintbrush = 0;
-int brushmaxx = 0, brushminx = MAXBRUSH;
-int brushmaxy = 0, brushminy = MAXBRUSH;
-
-void clearbrush()
-{
- memset(brush, 0, sizeof brush);
- brushmaxx = brushmaxy = 0;
- brushminx = brushminy = MAXBRUSH;
- paintbrush = false;
-}
-
-void brushvert(int *x, int *y, int *v)
-{
- *x += MAXBRUSH2 - brushx + 1; // +1 for automatic padding
- *y += MAXBRUSH2 - brushy + 1;
- if(*x<0 || *y<0 || *x>=MAXBRUSH || *y>=MAXBRUSH) return;
- brush[*x][*y] = clamp(*v, 0, 8);
- paintbrush = paintbrush || (brush[*x][*y] > 0);
- brushmaxx = min(MAXBRUSH-1, max(brushmaxx, *x+1));
- brushmaxy = min(MAXBRUSH-1, max(brushmaxy, *y+1));
- brushminx = max(0, min(brushminx, *x-1));
- brushminy = max(0, min(brushminy, *y-1));
-}
-
-vector<int> htextures;
-
-COMMAND(clearbrush, "");
-COMMAND(brushvert, "iii");
-void hmapcancel() { htextures.setsize(0); }
-COMMAND(hmapcancel, "");
-ICOMMAND(hmapselect, "", (),
- int t = lookupcube(cur).texture[orient];
- int i = htextures.find(t);
- if(i<0)
- htextures.add(t);
- else
- htextures.remove(i);
-);
-
-inline bool isheightmap(int o, int d, bool empty, cube *c)
-{
- return havesel ||
- (empty && isempty(*c)) ||
- htextures.empty() ||
- htextures.find(c->texture[o]) >= 0;
-}
-
-namespace hmap
-{
-# define PAINTED 1
-# define NOTHMAP 2
-# define MAPPED 16
- uchar flags[MAXBRUSH][MAXBRUSH];
- cube *cmap[MAXBRUSHC][MAXBRUSHC][4];
- int mapz[MAXBRUSHC][MAXBRUSHC];
- int map [MAXBRUSH][MAXBRUSH];
-
- selinfo changes;
- bool selecting;
- int d, dc, dr, dcr, biasup, br, hws, fg;
- int gx, gy, gz, mx, my, mz, nx, ny, nz, bmx, bmy, bnx, bny;
- uint fs;
- selinfo hundo;
-
- cube *getcube(ivec t, int f)
- {
- t[d] += dcr*f*gridsize;
- if(t[d] > nz || t[d] < mz) return NULL;
- cube *c = &lookupcube(t, gridsize);
- if(c->children) forcemip(*c, false);
- discardchildren(*c, true);
- if(!isheightmap(sel.orient, d, true, c)) return NULL;
- if (t.x < changes.o.x) changes.o.x = t.x;
- else if(t.x > changes.s.x) changes.s.x = t.x;
- if (t.y < changes.o.y) changes.o.y = t.y;
- else if(t.y > changes.s.y) changes.s.y = t.y;
- if (t.z < changes.o.z) changes.o.z = t.z;
- else if(t.z > changes.s.z) changes.s.z = t.z;
- return c;
- }
-
- uint getface(cube *c, int d)
- {
- return 0x0f0f0f0f & ((dc ? c->faces[d] : 0x88888888 - c->faces[d]) >> fs);
- }
-
- void pushside(cube &c, int d, int x, int y, int z)
- {
- ivec a;
- getcubevector(c, d, x, y, z, a);
- a[R[d]] = 8 - a[R[d]];
- setcubevector(c, d, x, y, z, a);
- }
-
- void addpoint(int x, int y, int z, int v)
- {
- if(!(flags[x][y] & MAPPED))
- map[x][y] = v + (z*8);
- flags[x][y] |= MAPPED;
- }
-
- void select(int x, int y, int z)
- {
- if((NOTHMAP & flags[x][y]) || (PAINTED & flags[x][y])) return;
- ivec t(d, x+gx, y+gy, dc ? z : hws-z);
- t.shl(gridpower);
-
- // selections may damage; must makeundo before
- hundo.o = t;
- hundo.o[D[d]] -= dcr*gridsize*2;
- makeundo(hundo);
-
- cube **c = cmap[x][y];
- loopk(4) c[k] = NULL;
- c[1] = getcube(t, 0);
- if(!c[1] || !isempty(*c[1]))
- { // try up
- c[2] = c[1];
- c[1] = getcube(t, 1);
- if(!c[1] || isempty(*c[1])) { c[0] = c[1]; c[1] = c[2]; c[2] = NULL; }
- else { z++; t[d]+=fg; }
- }
- else // drop down
- {
- z--;
- t[d]-= fg;
- c[0] = c[1];
- c[1] = getcube(t, 0);
- }
-
- if(!c[1] || isempty(*c[1])) { flags[x][y] |= NOTHMAP; return; }
-
- flags[x][y] |= PAINTED;
- mapz [x][y] = z;
-
- if(!c[0]) c[0] = getcube(t, 1);
- if(!c[2]) c[2] = getcube(t, -1);
- c[3] = getcube(t, -2);
- c[2] = !c[2] || isempty(*c[2]) ? NULL : c[2];
- c[3] = !c[3] || isempty(*c[3]) ? NULL : c[3];
-
- uint face = getface(c[1], d);
- if(face == 0x08080808 && (!c[0] || !isempty(*c[0]))) { flags[x][y] |= NOTHMAP; return; }
- if(c[1]->faces[R[d]] == F_SOLID) // was single
- face += 0x08080808;
- else // was pair
- face += c[2] ? getface(c[2], d) : 0x08080808;
- face += 0x08080808; // c[3]
- uchar *f = (uchar*)&face;
- addpoint(x, y, z, f[0]);
- addpoint(x+1, y, z, f[1]);
- addpoint(x, y+1, z, f[2]);
- addpoint(x+1, y+1, z, f[3]);
-
- if(selecting) // continue to adjacent cubes
- {
- if(x>bmx) select(x-1, y, z);
- if(x<bnx) select(x+1, y, z);
- if(y>bmy) select(x, y-1, z);
- if(y<bny) select(x, y+1, z);
- }
- }
-
- void ripple(int x, int y, int z, bool force)
- {
- if(force) select(x, y, z);
- if((NOTHMAP & flags[x][y]) || !(PAINTED & flags[x][y])) return;
-
- bool changed = false;
- int *o[4], best, par, q = 0;
- loopi(2) loopj(2) o[i+j*2] = &map[x+i][y+j];
- #define pullhmap(I, LT, GT, M, N, A) do { \
- best = I; \
- loopi(4) if(*o[i] LT best) best = *o[q = i] - M; \
- par = (best&(~7)) + N; \
- /* dual layer for extra smoothness */ \
- if(*o[q^3] GT par && !(*o[q^1] LT par || *o[q^2] LT par)) { \
- if(*o[q^3] GT par A 8 || *o[q^1] != par || *o[q^2] != par) { \
- *o[q^3] = (*o[q^3] GT par A 8 ? par A 8 : *o[q^3]); \
- *o[q^1] = *o[q^2] = par; \
- changed = true; \
- } \
- /* single layer */ \
- } else { \
- loopj(4) if(*o[j] GT par) { \
- *o[j] = par; \
- changed = true; \
- } \
- } \
- } while(0)
-
- if(biasup)
- pullhmap(0, >, <, 1, 0, -);
- else
- pullhmap(worldsize*8, <, >, 0, 8, +);
-
- cube **c = cmap[x][y];
- int e[2][2];
- int notempty = 0;
-
- loopk(4) if(c[k]) {
- loopi(2) loopj(2) {
- e[i][j] = min(8, map[x+i][y+j] - (mapz[x][y]+3-k)*8);
- notempty |= e[i][j] > 0;
- }
- if(notempty)
- {
- c[k]->texture[sel.orient] = c[1]->texture[sel.orient];
- solidfaces(*c[k]);
- loopi(2) loopj(2)
- {
- int f = e[i][j];
- if(f<0 || (f==0 && e[1-i][j]==0 && e[i][1-j]==0))
- {
- f=0;
- pushside(*c[k], d, i, j, 0);
- pushside(*c[k], d, i, j, 1);
- }
- edgeset(cubeedge(*c[k], d, i, j), dc, dc ? f : 8-f);
- }
- }
- else
- emptyfaces(*c[k]);
- }
-
- if(!changed) return;
- if(x>mx) ripple(x-1, y, mapz[x][y], true);
- if(x<nx) ripple(x+1, y, mapz[x][y], true);
- if(y>my) ripple(x, y-1, mapz[x][y], true);
- if(y<ny) ripple(x, y+1, mapz[x][y], true);
-
-#define DIAGONAL_RIPPLE(a,b,exp) if(exp) { \
- if(flags[x a][ y] & PAINTED) \
- ripple(x a, y b, mapz[x a][y], true); \
- else if(flags[x][y b] & PAINTED) \
- ripple(x a, y b, mapz[x][y b], true); \
- }
-
- DIAGONAL_RIPPLE(-1, -1, (x>mx && y>my)); // do diagonals because adjacents
- DIAGONAL_RIPPLE(-1, +1, (x>mx && y<ny)); // won't unless changed
- DIAGONAL_RIPPLE(+1, +1, (x<nx && y<ny));
- DIAGONAL_RIPPLE(+1, -1, (x<nx && y>my));
- }
-
-#define loopbrush(i) for(int x=bmx; x<=bnx+i; x++) for(int y=bmy; y<=bny+i; y++)
-
- void paint()
- {
- loopbrush(1)
- map[x][y] -= dr * brush[x][y];
- }
-
- void smooth()
- {
- int sum, div;
- loopbrush(-2)
- {
- sum = 0;
- div = 9;
- loopi(3) loopj(3)
- if(flags[x+i][y+j] & MAPPED)
- sum += map[x+i][y+j];
- else div--;
- if(div)
- map[x+1][y+1] = sum / div;
- }
- }
-
- void rippleandset()
- {
- loopbrush(0)
- ripple(x, y, gz, false);
- }
-
- void run(int dir, int mode)
- {
- d = dimension(sel.orient);
- dc = dimcoord(sel.orient);
- dcr= dc ? 1 : -1;
- dr = dir>0 ? 1 : -1;
- br = dir>0 ? 0x08080808 : 0;
- // biasup = mode == dir<0;
- biasup = dir<0;
- bool paintme = paintbrush;
- int cx = (sel.corner&1 ? 0 : -1);
- int cy = (sel.corner&2 ? 0 : -1);
- hws= (worldsize>>gridpower);
- gx = (cur[R[d]] >> gridpower) + cx - MAXBRUSH2;
- gy = (cur[C[d]] >> gridpower) + cy - MAXBRUSH2;
- gz = (cur[D[d]] >> gridpower);
- fs = dc ? 4 : 0;
- fg = dc ? gridsize : -gridsize;
- mx = max(0, -gx); // ripple range
- my = max(0, -gy);
- nx = min(MAXBRUSH-1, hws-gx) - 1;
- ny = min(MAXBRUSH-1, hws-gy) - 1;
- if(havesel)
- { // selection range
- bmx = mx = max(mx, (sel.o[R[d]]>>gridpower)-gx);
- bmy = my = max(my, (sel.o[C[d]]>>gridpower)-gy);
- bnx = nx = min(nx, (sel.s[R[d]]+(sel.o[R[d]]>>gridpower))-gx-1);
- bny = ny = min(ny, (sel.s[C[d]]+(sel.o[C[d]]>>gridpower))-gy-1);
- }
- if(havesel && mode<0) // -ve means smooth selection
- paintme = false;
- else
- { // brush range
- bmx = max(mx, brushminx);
- bmy = max(my, brushminy);
- bnx = min(nx, brushmaxx-1);
- bny = min(ny, brushmaxy-1);
- }
- nz = worldsize-gridsize;
- mz = 0;
- hundo.s = ivec(d,1,1,5);
- hundo.orient = sel.orient;
- hundo.grid = gridsize;
- forcenextundo();
-
- changes.grid = gridsize;
- changes.s = changes.o = cur;
- memset(map, 0, sizeof map);
- memset(flags, 0, sizeof flags);
-
- selecting = true;
- select(clamp(MAXBRUSH2-cx, bmx, bnx),
- clamp(MAXBRUSH2-cy, bmy, bny),
- dc ? gz : hws - gz);
- selecting = false;
- if(paintme)
- paint();
- else
- smooth();
- rippleandset(); // pull up points to cubify, and set
- changes.s.sub(changes.o).shr(gridpower).add(1);
- changed(changes);
- }
-}
-
-void edithmap(int dir, int mode) {
- if((nompedit && multiplayer()) || !hmapsel) return;
- hmap::run(dir, mode);
-}
-
///////////// main cube edit ////////////////
int bounded(int n) { return n<0 ? 0 : (n>8 ? 8 : n); }
@@ -2036,10 +1659,7 @@ void mpeditface(int dir, int mode, selinfo &sel, bool local)
void editface(int *dir, int *mode)
{
if(noedit(moving!=0)) return;
- if(hmapedit!=1)
- mpeditface(*dir, *mode, sel, true);
- else
- edithmap(*dir, *mode);
+ mpeditface(*dir, *mode, sel, true);
}
VAR(selectionsurf, 0, 0, 1);
@@ -2100,7 +1720,7 @@ static VSlot *remapvslot(int index, bool delta, const VSlot &ds)
{
loopv(remappedvslots) if(remappedvslots[i].index == index) return remappedvslots[i].vslot;
VSlot &vs = lookupvslot(index, false);
- if(vs.index < 0 || vs.index == DEFAULT_SKY) return NULL;
+ if(vs.index < 0) return NULL;
VSlot *edit = NULL;
if(delta)
{
@@ -2380,7 +2000,7 @@ static int unpacktex(int &tex, ucharbuf &buf, bool insert = true)
VSlot ds;
if(!unpackvslot(buf, ds, false)) return false;
VSlot &vs = *lookupslot(tex & 0xFFFF, false).variants;
- if(vs.index < 0 || vs.index == DEFAULT_SKY) return false;
+ if(vs.index < 0) return false;
VSlot *edit = insert ? editvslot(vs, ds) : findvslot(*vs.slot, vs, ds);
if(!edit) return false;
tex = edit->index;
diff --git a/src/engine/octarender.cpp b/src/engine/octarender.cpp
index daa82ea..d577193 100644
--- a/src/engine/octarender.cpp
+++ b/src/engine/octarender.cpp
@@ -16,7 +16,6 @@ enum
{
VBO_VBUF = 0,
VBO_EBUF,
- VBO_SKYBUF,
NUMVBO
};
@@ -65,9 +64,6 @@ void genvbo(int type, void *buf, int len, vtxarray **vas, int numva)
case VBO_EBUF:
va->ebuf = vbo;
break;
- case VBO_SKYBUF:
- va->skybuf = vbo;
- break;
}
}
}
@@ -210,24 +206,16 @@ struct vacollect : verthash
vector<sortkey> texs;
vector<materialsurface> matsurfs;
vector<octaentities *> mapmodels;
- vector<ushort> skyindices, explicitskyindices;
- vector<facebounds> skyfaces[6];
- int worldtris, skytris, skymask, skyclip, skyarea;
+ int worldtris;
void clear()
{
clearverts();
- worldtris = skytris = 0;
- skymask = 0;
- skyclip = INT_MAX;
- skyarea = 0;
+ worldtris = 0;
indices.clear();
- skyindices.setsize(0);
- explicitskyindices.setsize(0);
matsurfs.setsize(0);
mapmodels.setsize(0);
texs.setsize(0);
- loopi(6) skyfaces[i].setsize(0);
}
void remapunlit(vector<sortkey> &remap)
@@ -404,8 +392,7 @@ struct vacollect : verthash
if(va->verts)
{
if(vbosize[VBO_VBUF] + verts.length() > maxvbosize ||
- vbosize[VBO_EBUF] + worldtris > USHRT_MAX ||
- vbosize[VBO_SKYBUF] + skytris > USHRT_MAX)
+ vbosize[VBO_EBUF] + worldtris > USHRT_MAX)
flushvbo();
va->voffset = vbosize[VBO_VBUF];
@@ -423,19 +410,6 @@ struct vacollect : verthash
memcpy(va->matbuf, matsurfs.getbuf(), matsurfs.length()*sizeof(materialsurface));
}
- va->skybuf = 0;
- va->skydata = 0;
- va->sky = skyindices.length();
- va->explicitsky = explicitskyindices.length();
- if(va->sky + va->explicitsky)
- {
- va->skydata += vbosize[VBO_SKYBUF];
- ushort *skydata = (ushort *)addvbo(va, VBO_SKYBUF, va->sky+va->explicitsky, sizeof(ushort));
- memcpy(skydata, skyindices.getbuf(), va->sky*sizeof(ushort));
- memcpy(skydata+va->sky, explicitskyindices.getbuf(), va->explicitsky*sizeof(ushort));
- if(va->voffset) loopi(va->sky+va->explicitsky) skydata[i] += va->voffset;
- }
-
va->eslist = NULL;
va->texs = texs.length();
va->blendtris = 0;
@@ -500,7 +474,7 @@ struct vacollect : verthash
bool emptyva()
{
- return verts.empty() && matsurfs.empty() && skyindices.empty() && explicitskyindices.empty() && mapmodels.empty();
+ return verts.empty() && matsurfs.empty() && mapmodels.empty();
}
} vc;
@@ -580,11 +554,11 @@ extern const vec orientation_bitangent[8][3] =
void addtris(const sortkey &key, int orient, vertex *verts, int *index, int numverts, int convex, int shadowmask, int tj)
{
- int &total = key.tex==DEFAULT_SKY ? vc.skytris : vc.worldtris;
+ int &total = vc.worldtris;
int edge = orient*(MAXFACEVERTS+1);
loopi(numverts-2) if(index[0]!=index[i+1] && index[i+1]!=index[i+2] && index[i+2]!=index[0])
{
- vector<ushort> &idxs = key.tex==DEFAULT_SKY ? vc.explicitskyindices : vc.indices[key].tris[(shadowmask>>i)&1];
+ vector<ushort> &idxs = vc.indices[key].tris[(shadowmask>>i)&1];
int left = index[0], mid = index[i+1], right = index[i+2], start = left, i0 = left, i1 = -1;
loopk(4)
{
@@ -742,7 +716,7 @@ void addcubeverts(VSlot &vslot, int orient, int size, vec *pos, int convex, usho
{
(void) grassy;
int dim = dimension(orient);
- int shadowmask = texture==DEFAULT_SKY || alpha ? 0 : calcshadowmask(pos, numverts);
+ int shadowmask = alpha ? 0 : calcshadowmask(pos, numverts);
LightMap *lm = NULL;
LightMapTexture *lmtex = NULL;
@@ -788,12 +762,6 @@ void addcubeverts(VSlot &vslot, int orient, int size, vec *pos, int convex, usho
if(index[k] < 0) return;
}
- if(texture == DEFAULT_SKY)
- {
- loopk(numverts) vc.skyclip = min(vc.skyclip, int(pos[k].z*8)>>3);
- vc.skymask |= 0x3F&~(1<<orient);
- }
-
if(lmid >= LMID_RESERVED) lmid = lm ? lm->tex : LMID_AMBIENT;
sortkey key(texture, lmid, !vslot.scroll.iszero() ? dim : 3, layer == LAYER_BLEND ? LAYER_BLEND : LAYER_TOP, envmap, alpha ? (vslot.alphaback ? ALPHA_BACK : (vslot.alphafront ? ALPHA_FRONT : NO_ALPHA)) : NO_ALPHA);
@@ -1003,109 +971,6 @@ void gencubeverts(cube &c, const ivec &co, int size, int csi)
}
}
-static inline bool skyoccluded(cube &c, int orient)
-{
- return touchingface(c, orient) && faceedges(c, orient) == F_SOLID;
-}
-
-static int dummyskyfaces[6];
-static inline int hasskyfaces(cube &c, const ivec &co, int size, int faces[6] = dummyskyfaces)
-{
- int numfaces = 0;
- if(isempty(c) || c.material&MAT_ALPHA)
- {
- if(co.x == 0) faces[numfaces++] = O_LEFT;
- if(co.x + size == worldsize) faces[numfaces++] = O_RIGHT;
- if(co.y == 0) faces[numfaces++] = O_BACK;
- if(co.y + size == worldsize) faces[numfaces++] = O_FRONT;
- if(co.z == 0) faces[numfaces++] = O_BOTTOM;
- if(co.z + size == worldsize) faces[numfaces++] = O_TOP;
- }
- else if(!isentirelysolid(c))
- {
- if(co.x == 0 && !skyoccluded(c, O_LEFT)) faces[numfaces++] = O_LEFT;
- if(co.x + size == worldsize && !skyoccluded(c, O_RIGHT)) faces[numfaces++] = O_RIGHT;
- if(co.y == 0 && !skyoccluded(c, O_BACK)) faces[numfaces++] = O_BACK;
- if(co.y + size == worldsize && !skyoccluded(c, O_FRONT)) faces[numfaces++] = O_FRONT;
- if(co.z == 0 && !skyoccluded(c, O_BOTTOM)) faces[numfaces++] = O_BOTTOM;
- if(co.z + size == worldsize && !skyoccluded(c, O_TOP)) faces[numfaces++] = O_TOP;
- }
- return numfaces;
-}
-
-void minskyface(cube &cu, int orient, const ivec &co, int size, facebounds &orig)
-{
- facebounds mincf;
- mincf.u1 = orig.u2;
- mincf.u2 = orig.u1;
- mincf.v1 = orig.v2;
- mincf.v2 = orig.v1;
- mincubeface(cu, orient, co, size, orig, mincf, MAT_ALPHA, MAT_ALPHA);
- orig.u1 = max(mincf.u1, orig.u1);
- orig.u2 = min(mincf.u2, orig.u2);
- orig.v1 = max(mincf.v1, orig.v1);
- orig.v2 = min(mincf.v2, orig.v2);
-}
-
-void genskyfaces(cube &c, const ivec &o, int size)
-{
- int faces[6], numfaces = hasskyfaces(c, o, size, faces);
- if(!numfaces) return;
-
- loopi(numfaces)
- {
- int orient = faces[i], dim = dimension(orient);
- facebounds m;
- m.u1 = (o[C[dim]]&0xFFF)<<3;
- m.u2 = m.u1 + (size<<3);
- m.v1 = (o[R[dim]]&0xFFF)<<3;
- m.v2 = m.v1 + (size<<3);
- minskyface(c, orient, o, size, m);
- if(m.u1 >= m.u2 || m.v1 >= m.v2) continue;
- vc.skyarea += (int(m.u2-m.u1)*int(m.v2-m.v1) + (1<<(2*3))-1)>>(2*3);
- vc.skyfaces[orient].add(m);
- }
-}
-
-void addskyverts(const ivec &o, int size)
-{
- loopi(6)
- {
- int dim = dimension(i), c = C[dim], r = R[dim];
- vector<facebounds> &sf = vc.skyfaces[i];
- if(sf.empty()) continue;
- vc.skymask |= 0x3F&~(1<<opposite(i));
- sf.setsize(mergefaces(i, sf.getbuf(), sf.length()));
- loopvj(sf)
- {
- facebounds &m = sf[j];
- int index[4];
- loopk(4)
- {
- const ivec &coords = facecoords[opposite(i)][k];
- vec v;
- v[dim] = o[dim];
- if(coords[dim]) v[dim] += size;
- v[c] = (o[c]&~0xFFF) + (coords[c] ? m.u2 : m.u1)/8.0f;
- v[r] = (o[r]&~0xFFF) + (coords[r] ? m.v2 : m.v1)/8.0f;
- index[k] = vc.addvert(v);
- if(index[k] < 0) goto nextskyface;
- vc.skyclip = min(vc.skyclip, int(v.z*8)>>3);
- }
- if(vc.skytris + 6 > USHRT_MAX) break;
- vc.skytris += 6;
- vc.skyindices.add(index[0]);
- vc.skyindices.add(index[1]);
- vc.skyindices.add(index[2]);
-
- vc.skyindices.add(index[0]);
- vc.skyindices.add(index[2]);
- vc.skyindices.add(index[3]);
- nextskyface:;
- }
- }
-}
-
////////// Vertex Arrays //////////////
int allocva = 0;
@@ -1120,9 +985,6 @@ vtxarray *newva(const ivec &co, int size)
va->parent = NULL;
va->o = co;
va->size = size;
- va->skyarea = vc.skyarea;
- va->skyfaces = vc.skymask;
- va->skyclip = vc.skyclip < INT_MAX ? vc.skyclip : INT_MAX;
va->curvfc = VFC_NOT_VISIBLE;
va->occluded = OCCLUDE_NOTHING;
va->query = NULL;
@@ -1160,7 +1022,6 @@ void destroyva(vtxarray *va, bool reparent)
}
if(va->vbuf) destroyvbo(va->vbuf);
if(va->ebuf) destroyvbo(va->ebuf);
- if(va->skybuf) destroyvbo(va->skybuf);
if(va->eslist) delete[] va->eslist;
if(va->matbuf) delete[] va->matbuf;
delete va;
@@ -1203,23 +1064,6 @@ void updatevabb(vtxarray *va, bool force)
}
va->bbmin.max(va->o);
va->bbmax.min(ivec(va->o).add(va->size));
-
- if(va->skyfaces)
- {
- va->skyfaces |= 0x80;
- if(va->sky) loop(dim, 3) if(va->skyfaces&(3<<(2*dim)))
- {
- int r = R[dim], c = C[dim];
- if((va->skyfaces&(1<<(2*dim)) && va->o[dim] < va->bbmin[dim]) ||
- (va->skyfaces&(2<<(2*dim)) && va->o[dim]+va->size > va->bbmax[dim]) ||
- va->o[r] < va->bbmin[r] || va->o[r]+va->size > va->bbmax[r] ||
- va->o[c] < va->bbmin[c] || va->o[c]+va->size > va->bbmax[c])
- {
- va->skyfaces &= ~0x80;
- break;
- }
- }
- }
}
void updatevabbs(bool force)
@@ -1368,8 +1212,6 @@ void rendercube(cube &c, const ivec &co, int size, int csi, int &maxlevel) // c
return;
}
- genskyfaces(c, co, size);
-
if(!isempty(c))
{
gencubeverts(c, co, size, csi);
@@ -1408,16 +1250,6 @@ void calcmatbb(const ivec &co, int size, ivec &bbmin, ivec &bbmax)
loopv(vc.matsurfs)
{
materialsurface &m = vc.matsurfs[i];
- switch(m.material&MATF_VOLUME)
- {
- case MAT_WATER:
- case MAT_GLASS:
- case MAT_LAVA:
- break;
-
- default:
- continue;
- }
int dim = dimension(m.orient),
r = R[dim],
@@ -1453,8 +1285,6 @@ void setva(cube &c, const ivec &co, int size, int csi)
calcgeombb(co, size, bbmin, bbmax);
- addskyverts(co, size);
-
if(size == min(0x1000, worldsize/2) || !vc.emptyva())
{
vtxarray *va = newva(co, size);
@@ -1491,7 +1321,7 @@ static inline int setcubevisibility(cube &c, const ivec &co, int size)
else
{
numvis++;
- if(c.texture[i] != DEFAULT_SKY && !(c.ext && c.ext->surfaces[i].numverts&MAXFACEVERTS)) checkmask |= 1<<i;
+ if(!(c.ext && c.ext->surfaces[i].numverts&MAXFACEVERTS)) checkmask |= 1<<i;
}
}
if(facemask&2 && collideface(c, i)) collidemask |= 1<<i;
@@ -1526,7 +1356,6 @@ int updateva(cube *c, const ivec &co, int size, int csi)
else
{
if(!isempty(c[i])) count += setcubevisibility(c[i], o, size);
- count += hasskyfaces(c[i], o, size);
}
int tcount = count + (csi <= MAXMERGELEVEL ? vamerges[csi].length() : 0);
if(tcount > vafacemax || (tcount >= vafacemin && size >= vacubesize) || size == min(0x1000, worldsize/2))
@@ -1648,15 +1477,6 @@ void octarender() // creates va s for all leaf cubes that don't already
loadprogress = 0;
flushvbo();
- explicitsky = 0;
- skyarea = 0;
- loopv(valist)
- {
- vtxarray *va = valist[i];
- explicitsky += va->explicitsky;
- skyarea += va->skyarea;
- }
-
visibleva = NULL;
}
@@ -1682,10 +1502,6 @@ void allchanged(bool load)
clearvas(worldroot);
resetqueries();
resetclipplanes();
- if(load)
- {
- setupsky();
- }
guessshadowdir();
entitiesinoctanodes();
tjoints.setsize(0);
diff --git a/src/engine/physics.cpp b/src/engine/physics.cpp
index db30a43..b1b800a 100644
--- a/src/engine/physics.cpp
+++ b/src/engine/physics.cpp
@@ -313,11 +313,7 @@ float shadowray(const vec &o, const vec &ray, float radius, int mode, extentity
{
if(isentirelysolid(c))
{
- if(c.texture[side]==DEFAULT_SKY && mode&RAY_SKIPSKY)
- {
- if(mode&RAY_SKYTEX) return radius;
- }
- else return dist;
+ return dist;
}
else
{
@@ -326,11 +322,7 @@ float shadowray(const vec &o, const vec &ray, float radius, int mode, extentity
INTERSECTBOX(side = (i<<1) + 1 - lsizemask[i], goto nextcube);
if(exitdist >= 0)
{
- if(c.texture[side]==DEFAULT_SKY && mode&RAY_SKIPSKY)
- {
- if(mode&RAY_SKYTEX) return radius;
- }
- else return dist+max(enterdist+0.1f, 0.0f);
+ return dist+max(enterdist+0.1f, 0.0f);
}
}
}
@@ -385,11 +377,7 @@ float shadowray(ShadowRayCache *cache, const vec &o, const vec &ray, float radiu
{
if(isentirelysolid(c))
{
- if(c.texture[side]==DEFAULT_SKY && mode&RAY_SKIPSKY)
- {
- if(mode&RAY_SKYTEX) return radius;
- }
- else return dist;
+ return dist;
}
else
{
@@ -399,11 +387,7 @@ float shadowray(ShadowRayCache *cache, const vec &o, const vec &ray, float radiu
INTERSECTBOX(side = (i<<1) + 1 - lsizemask[i], goto nextcube);
if(exitdist >= 0)
{
- if(c.texture[side]==DEFAULT_SKY && mode&RAY_SKIPSKY)
- {
- if(mode&RAY_SKYTEX) return radius;
- }
- else return dist+max(enterdist+0.1f, 0.0f);
+ return dist+max(enterdist+0.1f, 0.0f);
}
}
}
@@ -1399,7 +1383,7 @@ bool move(physent *d, vec &dir)
return !collided;
}
-bool bounce(physent *d, float secs, float elasticity, float waterfric, float grav)
+bool bounce(physent *d, float secs, float elasticity, float grav)
{
// make sure bouncers don't start inside geometry
if(d->physstate!=PHYS_BOUNCE && collide(d, vec(0, 0, 0), 0, false)) return true;
@@ -1552,7 +1536,7 @@ FVAR(straferoll, 0, 0.033f, 90);
FVAR(faderoll, 0, 0.95f, 1);
VAR(floatspeed, 1, 100, 10000);
-void modifyvelocity(physent *pl, bool local, bool water, bool floating, int curtime)
+void modifyvelocity(physent *pl, bool local, bool floating, int curtime)
{
bool allowmove = game::allowmove(pl);
if(floating)
@@ -1563,17 +1547,16 @@ void modifyvelocity(physent *pl, bool local, bool water, bool floating, int curt
pl->vel.z = max(pl->vel.z, JUMPVEL);
}
}
- else if(pl->physstate >= PHYS_SLOPE || water)
+ else if(pl->physstate >= PHYS_SLOPE)
{
- if(water && !pl->inwater) pl->vel.div(8);
+ if(!pl->inwater) pl->vel.div(8);
if(pl->jumping && allowmove)
{
pl->jumping = false;
pl->vel.z = max(pl->vel.z, JUMPVEL); // physics impulse upwards
- if(water) { pl->vel.x /= 8.0f; pl->vel.y /= 8.0f; } // dampen velocity change even harder, gives correct water feel
- game::physicstrigger(pl, local, 1, 0);
+ game::physicstrigger(pl, local, 1);
}
}
if(!floating && pl->physstate == PHYS_FALL) pl->timeinair = min(pl->timeinair + curtime, 1000);
@@ -1581,16 +1564,10 @@ void modifyvelocity(physent *pl, bool local, bool water, bool floating, int curt
vec m(0.0f, 0.0f, 0.0f);
if((pl->move || pl->strafe) && allowmove)
{
- vecfromyawpitch(pl->yaw, floating || water || pl->type==ENT_CAMERA ? pl->pitch : 0, pl->move, pl->strafe, m);
+ vecfromyawpitch(pl->yaw, floating || pl->type==ENT_CAMERA ? pl->pitch : 0, pl->move, pl->strafe, m);
if(!floating && pl->physstate >= PHYS_SLOPE)
- {
- /* move up or down slopes in air
- * but only move up slopes in water
- */
- float dz = -(m.x*pl->floor.x + m.y*pl->floor.y)/pl->floor.z;
- m.z = water ? max(m.z, dz) : dz;
- }
+ m.z = -(m.x*pl->floor.x + m.y*pl->floor.y)/pl->floor.z; // move up or down slopes in air
m.normalize();
}
@@ -1606,17 +1583,13 @@ void modifyvelocity(physent *pl, bool local, bool water, bool floating, int curt
{
if(pl==player) d.mul(floatspeed/100.0f);
}
- else if(!water && allowmove) d.mul((pl->move && !pl->strafe ? 1.3f : 1.0f) * (pl->physstate < PHYS_SLOPE ? 1.3f : 1.0f));
+ else if(allowmove) d.mul((pl->move && !pl->strafe ? 1.3f : 1.0f) * (pl->physstate < PHYS_SLOPE ? 1.3f : 1.0f));
}
- float fric = water && !floating ? 20.0f : (pl->physstate >= PHYS_SLOPE || floating ? 6.0f : 30.0f);
+ float fric = !floating ? 20.0f : (pl->physstate >= PHYS_SLOPE || floating ? 6.0f : 30.0f);
pl->vel.lerp(d, pl->vel, pow(1 - 1/fric, curtime/20.0f));
-// old fps friction
-// float friction = water && !floating ? 20.0f : (pl->physstate >= PHYS_SLOPE || floating ? 6.0f : 30.0f);
-// float fpsfric = min(curtime/(20.0f*friction), 1.0f);
-// pl->vel.lerp(pl->vel, d, fpsfric);
}
-void modifygravity(physent *pl, bool water, int curtime)
+void modifygravity(physent *pl, int curtime)
{
float secs = curtime/1000.0f;
vec g(0, 0, 0);
@@ -1628,12 +1601,12 @@ void modifygravity(physent *pl, bool water, int curtime)
g.normalize();
g.mul(GRAVITY*secs);
}
- if(!water || !game::allowmove(pl) || (!pl->move && !pl->strafe)) pl->falling.add(g);
+ if(!game::allowmove(pl) || (!pl->move && !pl->strafe)) pl->falling.add(g);
- if(water || pl->physstate >= PHYS_SLOPE)
+ if(pl->physstate >= PHYS_SLOPE)
{
- float fric = water ? 2.0f : 6.0f,
- c = water ? 1.0f : clamp((pl->floor.z - SLOPEZ)/(FLOORZ-SLOPEZ), 0.0f, 1.0f);
+ float fric = 6.0f,
+ c = clamp((pl->floor.z - SLOPEZ)/(FLOORZ-SLOPEZ), 0.0f, 1.0f);
pl->falling.mul(pow(1 - c/fric, curtime/20.0f));
}
}
@@ -1649,12 +1622,12 @@ bool moveplayer(physent *pl, int moveres, bool local, int curtime)
float secs = curtime/1000.f;
// apply gravity
- if(!floating) modifygravity(pl, water, curtime);
+ if(!floating) modifygravity(pl, curtime);
// apply any player generated changes in velocity
- modifyvelocity(pl, local, water, floating, curtime);
+ modifyvelocity(pl, local, floating, curtime);
vec d(pl->vel);
- if(!floating && water) d.mul(0.5f);
+ if(!floating) d.mul(0.5f);
d.add(pl->falling);
d.mul(secs);
@@ -1678,9 +1651,9 @@ bool moveplayer(physent *pl, int moveres, bool local, int curtime)
d.mul(f);
loopi(moveres) if(!move(pl, d) && ++collisions<5) i--; // discrete steps collision detection & sliding
- if(timeinair > 800 && !pl->timeinair && !water) // if we land after long time must have been a high jump, make thud sound
+ if(timeinair > 800 && !pl->timeinair) // if we land after long time must have been a high jump, make thud sound
{
- game::physicstrigger(pl, local, -1, 0);
+ game::physicstrigger(pl, local, -1);
}
}
@@ -1691,8 +1664,8 @@ bool moveplayer(physent *pl, int moveres, bool local, int curtime)
if(pl->strafe && maxroll) pl->roll = clamp(pl->roll - pow(clamp(1.0f + pl->strafe*pl->roll/maxroll, 0.0f, 1.0f), 0.33f)*pl->strafe*curtime*straferoll, -maxroll, maxroll);
else pl->roll *= curtime == PHYSFRAMETIME ? faderoll : pow(faderoll, curtime/float(PHYSFRAMETIME));
- if(pl->inwater) game::physicstrigger(pl, local, 0, 1, pl->inwater);
- pl->inwater = water ? material&MATF_VOLUME : MAT_AIR;
+ if(pl->inwater) game::physicstrigger(pl, local, 0, pl->inwater);
+ pl->inwater = MAT_AIR;
if(pl->state==CS_ALIVE && (pl->o.z < 0 || material&MAT_DEATH)) game::suicide(pl);
@@ -1748,7 +1721,7 @@ void moveplayer(physent *pl, int moveres, bool local)
}
}
-bool bounce(physent *d, float elasticity, float waterfric, float grav)
+bool bounce(physent *d, float elasticity, float grav)
{
if(physsteps <= 0)
{
@@ -1760,10 +1733,10 @@ bool bounce(physent *d, float elasticity, float waterfric, float grav)
bool hitplayer = false;
loopi(physsteps-1)
{
- if(bounce(d, physframetime/1000.0f, elasticity, waterfric, grav)) hitplayer = true;
+ if(bounce(d, physframetime/1000.0f, elasticity, grav)) hitplayer = true;
}
d->deltapos = d->o;
- if(bounce(d, physframetime/1000.0f, elasticity, waterfric, grav)) hitplayer = true;
+ if(bounce(d, physframetime/1000.0f, elasticity, grav)) hitplayer = true;
d->newpos = d->o;
d->deltapos.sub(d->newpos);
interppos(d);
diff --git a/src/engine/rendergl.cpp b/src/engine/rendergl.cpp
index 6d3e705..ac05313 100644
--- a/src/engine/rendergl.cpp
+++ b/src/engine/rendergl.cpp
@@ -148,7 +148,6 @@ void *getprocaddress(const char *name)
return SDL_GL_GetProcAddress(name);
}
-VARP(ati_skybox_bug, 0, 0, 1);
VAR(ati_minmax_bug, 0, 0, 1);
VAR(ati_cubemap_bug, 0, 0, 1);
VAR(intel_vertexarray_bug, 0, 0, 1);
@@ -396,8 +395,6 @@ void gl_checkextensions()
extern int fpdepthfx;
if(ati)
{
- //conoutf(CON_WARN, "WARNING: ATI cards may show garbage in skybox. (use \"/ati_skybox_bug 1\" to fix)");
-
minimizetcusage = 1;
if(hasTF && hasTRG) fpdepthfx = 1;
// On Catalyst 10.2, issuing an occlusion query on the first draw using a given cubemap texture causes a nasty crash
@@ -1035,7 +1032,7 @@ 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(int fogmat, const vec &v, int &abovemat)
+static float findsurface(const vec &v, int &abovemat)
{
ivec o(v), co;
int csize;
@@ -1062,63 +1059,6 @@ void rendergame(bool mainpass)
int drawtex = 0;
-void drawcubemap(int size, const vec &o, float yaw, float pitch, const cubemapside &side, bool onlysky)
-{
- drawtex = DRAWTEX_ENVMAP;
-
- physent *oldcamera = camera1;
- static physent cmcamera;
- cmcamera = *player;
- cmcamera.reset();
- cmcamera.type = ENT_CAMERA;
- cmcamera.o = o;
- cmcamera.yaw = yaw;
- cmcamera.pitch = pitch;
- cmcamera.roll = 0;
- camera1 = &cmcamera;
-
- int farplane = worldsize*2;
-
- projmatrix.perspective(90.0f, 1.0f, nearplane, farplane);
- if(!side.flipx || !side.flipy) projmatrix.scalexy(!side.flipx ? -1 : 1, !side.flipy ? -1 : 1);
- if(side.swapxy)
- {
- swap(projmatrix.a.x, projmatrix.a.y);
- swap(projmatrix.b.x, projmatrix.b.y);
- swap(projmatrix.c.x, projmatrix.c.y);
- swap(projmatrix.d.x, projmatrix.d.y);
- }
- setcamprojmatrix();
-
- xtravertsva = xtraverts = glde = gbatches = 0;
-
- visiblecubes();
-
- if(onlysky) drawskybox(farplane, false, true);
- else
- {
- glClear(GL_DEPTH_BUFFER_BIT);
-
- glEnable(GL_CULL_FACE);
- glEnable(GL_DEPTH_TEST);
-
- if(limitsky()) drawskybox(farplane, true);
-
- rendergeom();
-
- if(!limitsky()) drawskybox(farplane, false);
-
- rendermapmodels();
- renderalphageom();
-
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_CULL_FACE);
- }
-
- camera1 = oldcamera;
- drawtex = 0;
-}
-
VAR(modelpreviewfov, 10, 20, 100);
VAR(modelpreviewpitch, -90, -15, 90);
@@ -1236,15 +1176,11 @@ void gl_drawframe()
if(wireframe && editmode) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- if(limitsky()) drawskybox(farplane, true);
-
rendergeom();
extern int outline;
if(!wireframe && editmode && outline) renderoutline();
- if(!limitsky()) drawskybox(farplane, false);
-
renderdecals(true);
rendermapmodels();
diff --git a/src/engine/renderva.cpp b/src/engine/renderva.cpp
index e0b74e2..4f6e7a5 100644
--- a/src/engine/renderva.cpp
+++ b/src/engine/renderva.cpp
@@ -32,7 +32,6 @@ int isvisiblesphere(float rad, const vec &cv)
if(dist < rad) v = VFC_PART_VISIBLE;
}
- if(dist > rad) return VFC_FOGGED; //VFC_NOT_VISIBLE; // culling when fog is closer than size of world results in HOM
if(dist > -rad) v = VFC_PART_VISIBLE;
return v;
@@ -56,7 +55,6 @@ int isvisiblecube(const ivec &o, int size)
if(dist < -vfcDnear[i]*size) v = VFC_PART_VISIBLE;
}
- if(dist > -vfcDnear[4]*size) return VFC_FOGGED;
if(dist > -vfcDfar[4]*size) v = VFC_PART_VISIBLE;
return v;
@@ -388,7 +386,7 @@ void findvisiblemms(const vector<extentity *> &ents, bool doquery)
lastvisiblemms = &visiblemms;
for(vtxarray *va = visibleva; va; va = va->next)
{
- if(va->mapmodels.empty() || va->curvfc >= VFC_FOGGED || va->occluded >= OCCLUDE_BB) continue;
+ if(va->mapmodels.empty() || va->occluded >= OCCLUDE_BB) continue;
loopv(va->mapmodels)
{
octaentities *oe = va->mapmodels[i];
@@ -502,7 +500,7 @@ static inline bool bboccluded(const ivec &bo, const ivec &br, cube *c, const ive
if(c[i].ext && c[i].ext->va)
{
vtxarray *va = c[i].ext->va;
- if(va->curvfc >= VFC_FOGGED || (va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va))) continue;
+ if(va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va)) continue;
}
if(c[i].children && bboccluded(bo, br, c[i].children, co, size>>1)) continue;
return false;
@@ -520,7 +518,7 @@ bool bboccluded(const ivec &bo, const ivec &br)
if(c->ext && c->ext->va)
{
vtxarray *va = c->ext->va;
- if(va->curvfc >= VFC_FOGGED || (va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va))) return true;
+ if(va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va)) return true;
}
scale--;
while(c->children && !(diff&(1<<scale)))
@@ -529,7 +527,7 @@ bool bboccluded(const ivec &bo, const ivec &br)
if(c->ext && c->ext->va)
{
vtxarray *va = c->ext->va;
- if(va->curvfc >= VFC_FOGGED || (va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va))) return true;
+ if(va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va)) return true;
}
scale--;
}
@@ -661,7 +659,7 @@ void rendershadowmapreceivers()
vtxarray *prev = NULL;
for(vtxarray *va = visibleva; va; va = va->next)
{
- if(!va->texs || va->curvfc >= VFC_FOGGED || !isshadowmapreceiver(va)) continue;
+ if(!va->texs || !isshadowmapreceiver(va)) continue;
if(!prev || va->vbuf != prev->vbuf)
{
@@ -815,8 +813,6 @@ enum
{
RENDERPASS_LIGHTMAP = 0,
RENDERPASS_Z,
- RENDERPASS_CAUSTICS,
- RENDERPASS_FOG,
RENDERPASS_LIGHTMAP_BLEND
};
@@ -1253,7 +1249,7 @@ void renderzpass(renderstate &cur, vtxarray *va)
VAR(batchgeom, 0, 1, 1);
-void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bool fogpass = false, bool doquery = false)
+void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bool doquery = false)
{
switch(pass)
{
@@ -1281,12 +1277,6 @@ void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bo
break;
}
- case RENDERPASS_FOG:
- if(cur.vbuf!=va->vbuf) changevbuf(cur, pass, va);
- drawvatris(va, 3*va->tris, va->edata);
- xtravertsva += va->verts;
- break;
-
case RENDERPASS_Z:
if(doquery) startvaquery(va, );
renderzpass(cur, va);
@@ -1318,7 +1308,7 @@ void cleanupgeom(renderstate &cur)
if(cur.vbuf) disablevbuf(cur);
}
-static void rendergeommultipass(renderstate &cur, int pass, bool fogpass)
+static void rendergeommultipass(renderstate &cur, int pass)
{
if(cur.vbuf) disablevbuf(cur);
if(!cur.vattribs) enablevattribs(cur, false);
@@ -1327,14 +1317,14 @@ static void rendergeommultipass(renderstate &cur, int pass, bool fogpass)
{
if(!va->texs) continue;
if(va->occluded >= OCCLUDE_GEOM) continue;
- renderva(cur, va, pass, fogpass);
+ renderva(cur, va, pass);
}
if(geombatches.length()) renderbatches(cur, pass);
}
VAR(oqgeom, 0, 1, 1);
-void rendergeom(bool fogpass)
+void rendergeom(void)
{
bool mainpass = !drawtex && !glaring,
doOQ = oqfrags && oqgeom && mainpass,
@@ -1392,7 +1382,7 @@ void rendergeom(bool fogpass)
}
if(!doZP) blends += va->blends;
- renderva(cur, va, doZP ? RENDERPASS_Z : RENDERPASS_LIGHTMAP, fogpass, doOQ);
+ renderva(cur, va, doZP ? RENDERPASS_Z : RENDERPASS_LIGHTMAP, doOQ);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
@@ -1421,7 +1411,7 @@ void rendergeom(bool fogpass)
{
if(!va->texs || va->occluded >= OCCLUDE_GEOM) continue;
blends += va->blends;
- renderva(cur, va, RENDERPASS_LIGHTMAP, fogpass);
+ renderva(cur, va, RENDERPASS_LIGHTMAP);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
for(vtxarray *va = visibleva; va; va = va->next)
@@ -1435,7 +1425,7 @@ void rendergeom(bool fogpass)
}
blends += va->blends;
- renderva(cur, va, RENDERPASS_LIGHTMAP, fogpass);
+ renderva(cur, va, RENDERPASS_LIGHTMAP);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
}
@@ -1456,7 +1446,7 @@ void rendergeom(bool fogpass)
{
if(!va->blends) continue;
if(va->occluded >= OCCLUDE_GEOM) continue;
- renderva(cur, va, RENDERPASS_LIGHTMAP_BLEND, fogpass);
+ renderva(cur, va, RENDERPASS_LIGHTMAP_BLEND);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
cur.blending = false;
@@ -1475,7 +1465,7 @@ void rendergeom(bool fogpass)
cleanupgeom(cur);
}
-void renderalphageom(bool fogpass)
+void renderalphageom(void)
{
static vector<vtxarray *> alphavas;
alphavas.setsize(0);
@@ -1517,7 +1507,7 @@ void renderalphageom(bool fogpass)
cur.texgendim = -1;
cur.colorscale = vec(1, 1, 1);
cur.alphascale = -1;
- loopv(alphavas) if(front || alphavas[i]->alphabacktris) renderva(cur, alphavas[i], RENDERPASS_LIGHTMAP, fogpass);
+ loopv(alphavas) if(front || alphavas[i]->alphabacktris) renderva(cur, alphavas[i], RENDERPASS_LIGHTMAP);
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
cleanupgeom(cur);
@@ -1530,62 +1520,3 @@ void renderalphageom(bool fogpass)
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, fading ? GL_FALSE : GL_TRUE);
}
-
-static vtxarray *prevskyva = NULL;
-
-void renderskyva(vtxarray *va, bool explicitonly = false)
-{
- if(!prevskyva || va->vbuf != prevskyva->vbuf)
- {
- gle::bindvbo(va->vbuf);
- gle::bindebo(va->skybuf);
- const vertex *ptr = 0;
- gle::vertexpointer(sizeof(vertex), ptr->pos.v);
- if(!prevskyva) gle::enablevertex();
- }
-
- drawvatris(va, explicitonly ? va->explicitsky : va->sky+va->explicitsky, explicitonly ? va->skydata+va->sky : va->skydata);
-
- if(!explicitonly) xtraverts += va->sky/3;
- xtraverts += va->explicitsky/3;
-
- prevskyva = va;
-}
-
-int renderedsky = 0, renderedexplicitsky = 0, renderedskyfaces = 0, renderedskyclip = INT_MAX;
-
-static inline void updateskystats(vtxarray *va)
-{
- renderedsky += va->sky;
- renderedexplicitsky += va->explicitsky;
- renderedskyfaces |= va->skyfaces&0x3F;
- if(!(va->skyfaces&0x1F) || camera1->o.z < va->skyclip) renderedskyclip = min(renderedskyclip, va->skyclip);
- else renderedskyclip = 0;
-}
-
-bool rendersky(bool explicitonly)
-{
- prevskyva = NULL;
- renderedsky = renderedexplicitsky = renderedskyfaces = 0;
- renderedskyclip = INT_MAX;
-
- for(vtxarray *va = visibleva; va; va = va->next)
- {
- if((va->occluded >= OCCLUDE_BB && va->skyfaces&0x80) || !(va->sky+va->explicitsky)) continue;
-
- // count possibly visible sky even if not actually rendered
- updateskystats(va);
- if(explicitonly && !va->explicitsky) continue;
- renderskyva(va, explicitonly);
- }
-
- if(prevskyva)
- {
- gle::disablevertex();
- gle::clearvbo();
- gle::clearebo();
- }
-
- return renderedsky+renderedexplicitsky > 0;
-}
-
diff --git a/src/engine/world.h b/src/engine/world.h
index 6b53eca..6cf24bc 100644
--- a/src/engine/world.h
+++ b/src/engine/world.h
@@ -1,7 +1,5 @@
-
enum // hardcoded texture numbers
{
- DEFAULT_SKY = 0,
DEFAULT_GEOM
};
@@ -39,9 +37,6 @@ struct compatheader // map file format header
char maptitle[128];
};
-#define WATER_AMPLITUDE 0.4f
-#define WATER_OFFSET 1.1f
-
enum
{
MATSURF_NOT_VISIBLE = 0,
diff --git a/src/fpsgame/ai.cpp b/src/fpsgame/ai.cpp
index c57b575..0886245 100644
--- a/src/fpsgame/ai.cpp
+++ b/src/fpsgame/ai.cpp
@@ -18,7 +18,7 @@ namespace ai
float viewdist(int x)
{
- return x <= 100 ? clamp((SIGHTMIN+(SIGHTMAX-SIGHTMIN))/100.f*float(x), float(SIGHTMIN), float(fog)) : 10000.0f;
+ return x <= 100 ? clamp((SIGHTMIN+(SIGHTMAX-SIGHTMIN))/100.f*float(x), float(SIGHTMIN), 10000.0f) : 10000.0f;
}
float viewfieldx(int x)
diff --git a/src/fpsgame/fps.cpp b/src/fpsgame/fps.cpp
index bcbad2b..da678f6 100644
--- a/src/fpsgame/fps.cpp
+++ b/src/fpsgame/fps.cpp
@@ -643,7 +643,7 @@ namespace game
return server::modename(gamemode, NULL);
}
- void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material)
+ void physicstrigger(physent *d, bool local, int floorlevel, int material)
{
if(d->type==ENT_INANIMATE) return;
if (floorlevel>0) { if(d==player1 || d->type!=ENT_PLAYER || ((fpsent *)d)->ai) msgsound(S_JUMP, d); }
diff --git a/src/fpsgame/waypoint.cpp b/src/fpsgame/waypoint.cpp
index 8d97782..22e48d0 100644
--- a/src/fpsgame/waypoint.cpp
+++ b/src/fpsgame/waypoint.cpp
@@ -11,7 +11,7 @@ namespace ai
bool clipped(const vec &o)
{
int material = lookupmaterial(o), clipmat = material&MATF_CLIP;
- return clipmat == MAT_CLIP || material&MAT_DEATH || (material&MATF_VOLUME) == MAT_LAVA;
+ return clipmat == MAT_CLIP || material&MAT_DEATH;
}
int getweight(const vec &o)
@@ -25,7 +25,7 @@ namespace ai
weight = int(dist/ai::JUMPMIN);
pos.z -= clamp(dist-8.0f, 0.0f, pos.z);
int trgmat = lookupmaterial(pos);
- if(trgmat&MAT_DEATH || (trgmat&MATF_VOLUME) == MAT_LAVA) weight *= 10;
+ if(trgmat&MAT_DEATH) weight *= 10;
}
return weight;
}
@@ -566,7 +566,7 @@ namespace ai
if(d->state != CS_ALIVE) { d->lastnode = -1; return; }
bool dropping = shoulddrop(d);
int mat = lookupmaterial(v);
- if((mat&MATF_CLIP) == MAT_CLIP || (mat&MATF_VOLUME) == MAT_LAVA || mat&MAT_DEATH) dropping = false;
+ if((mat&MATF_CLIP) == MAT_CLIP || mat&MAT_DEATH) dropping = false;
float dist = dropping ? WAYPOINTRADIUS : (d->ai ? WAYPOINTRADIUS : SIGHTMIN);
int curnode = closestwaypoint(v, dist, false, d), prevnode = d->lastnode;
if(!iswaypoint(curnode) && dropping)
diff --git a/src/shared/iengine.h b/src/shared/iengine.h
index 9f5dbb5..8bc7521 100644
--- a/src/shared/iengine.h
+++ b/src/shared/iengine.h
@@ -34,7 +34,7 @@ extern void lightent(extentity &e, float height = 8.0f);
extern void lightreaching(const vec &target, vec &color, vec &dir, bool fast = false, extentity *e = 0, float ambient = 0.4f);
extern entity *brightestlight(const vec &target, const vec &dir);
-enum { RAY_BB = 1, RAY_POLY = 3, RAY_ALPHAPOLY = 7, RAY_ENTS = 9, RAY_CLIPMAT = 16, RAY_SKIPFIRST = 32, RAY_EDITMAT = 64, RAY_SHADOW = 128, RAY_PASS = 256, RAY_SKIPSKY = 512, RAY_SKYTEX = 1024 };
+enum { RAY_BB = 1, RAY_POLY = 3, RAY_ALPHAPOLY = 7, RAY_ENTS = 9, RAY_CLIPMAT = 16, RAY_SKIPFIRST = 32, RAY_EDITMAT = 64, RAY_SHADOW = 128, RAY_PASS = 256 };
extern float raycube (const vec &o, const vec &ray, float radius = 0, int mode = RAY_CLIPMAT, int size = 0, extentity *t = 0);
extern float raycubepos(const vec &o, const vec &ray, vec &hit, float radius = 0, int mode = RAY_CLIPMAT, int size = 0);
@@ -367,8 +367,8 @@ extern physent *collideplayer;
extern void moveplayer(physent *pl, int moveres, bool local);
extern bool moveplayer(physent *pl, int moveres, bool local, int curtime);
extern bool collide(physent *d, const vec &dir = vec(0, 0, 0), float cutoff = 0.0f, bool playercol = true, bool insideplayercol = false);
-extern bool bounce(physent *d, float secs, float elasticity, float waterfric, float grav);
-extern bool bounce(physent *d, float elasticity, float waterfric, float grav);
+extern bool bounce(physent *d, float secs, float elasticity, float grav);
+extern bool bounce(physent *d, float elasticity, float float grav);
extern void avoidcollision(physent *d, const vec &dir, physent *obstacle, float space);
extern bool overlapsdynent(const vec &o, float radius);
extern bool movecamera(physent *pl, const vec &dir, float dist, float stepdist);
diff --git a/src/shared/igame.h b/src/shared/igame.h
index 0bb91c7..32ccb3b 100644
--- a/src/shared/igame.h
+++ b/src/shared/igame.h
@@ -47,7 +47,7 @@ namespace game
extern void updateworld();
extern void initclient();
- extern void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material = 0);
+ extern void physicstrigger(physent *d, bool local, int floorlevel, int material = 0);
extern void bounced(physent *d, const vec &surface);
extern void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0, const VSlot *vs = NULL);
extern void vartrigger(ident *id);