summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxolatile2025-07-17 23:28:55 +0200
committerxolatile2025-07-17 23:28:55 +0200
commitc79dda69d6e603500a5681430172b5152041af0a (patch)
treec1669442318e77a9ae76009edd5eefcaa69064ce /src
parent5b88d873f42b1cad5c5fd03888cfe45b82da06d6 (diff)
downloadxolatile-badassbug-c79dda69d6e603500a5681430172b5152041af0a.tar.xz
xolatile-badassbug-c79dda69d6e603500a5681430172b5152041af0a.tar.zst
Big changed mentioned in IRC channel...
Diffstat (limited to 'src')
-rw-r--r--src/Makefile39
-rw-r--r--src/engine/engine.h1
-rw-r--r--src/engine/engine.h.gchbin0 -> 78745159 bytes
-rw-r--r--src/engine/main.cpp5
-rw-r--r--src/engine/model.h2
-rw-r--r--src/engine/physics.cpp24
-rw-r--r--src/engine/rendergl.cpp211
-rw-r--r--src/engine/rendermodel.cpp80
-rw-r--r--src/engine/renderva.cpp83
-rw-r--r--src/fpsgame/ai.cpp6
-rw-r--r--src/fpsgame/aiman.h2
-rw-r--r--src/fpsgame/client.cpp168
-rw-r--r--src/fpsgame/entities.cpp307
-rw-r--r--src/fpsgame/fps.cpp71
-rw-r--r--src/fpsgame/game.h180
-rw-r--r--src/fpsgame/game.h.gchbin0 -> 76106492 bytes
-rw-r--r--src/fpsgame/render.cpp99
-rw-r--r--src/fpsgame/scoreboard.cpp5
-rw-r--r--src/fpsgame/server.cpp142
-rw-r--r--src/fpsgame/waypoint.cpp2
-rw-r--r--src/fpsgame/weapon.cpp52
-rw-r--r--src/shared/ents.h20
-rw-r--r--src/shared/iengine.h9
-rw-r--r--src/shared/igame.h7
24 files changed, 302 insertions, 1213 deletions
diff --git a/src/Makefile b/src/Makefile
index bb15b25..910be60 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,10 +1,10 @@
-CXXFLAGS= -O3 -fomit-frame-pointer -ffast-math
+CXXFLAGS= -O3 -g -fomit-frame-pointer -ffast-math
override CXXFLAGS+= -Wall -fsigned-char -fno-exceptions -fno-rtti
PLATFORM= $(shell uname -s | tr '[:lower:]' '[:upper:]')
PLATFORM_PREFIX= native
-INCLUDES= -Ishared -Iengine -Ifpsgame -Ienet/include
+INCLUDES= -Ishared -Iengine -Ifpsgame
STRIP=
ifeq (,$(findstring -g,$(CXXFLAGS)))
@@ -90,7 +90,6 @@ CLIENT_OBJS= \
engine/client.o \
engine/command.o \
engine/console.o \
- engine/cubeloader.o \
engine/decal.o \
engine/dynlight.o \
engine/glare.o \
@@ -125,8 +124,6 @@ CLIENT_OBJS= \
fpsgame/client.o \
fpsgame/entities.o \
fpsgame/fps.o \
- fpsgame/monster.o \
- fpsgame/movable.o \
fpsgame/render.o \
fpsgame/scoreboard.o \
fpsgame/server.o \
@@ -200,16 +197,16 @@ master: $(MASTER_OBJS)
install: all
else
-client: libenet $(CLIENT_OBJS)
+client: $(CLIENT_OBJS)
$(CXX) $(CXXFLAGS) -o sauer_client $(CLIENT_OBJS) $(CLIENT_LIBS)
ifneq (,$(findstring DARWIN,$(PLATFORM)))
install_name_tool -add_rpath @executable_path/../Frameworks sauer_client
endif
-server: libenet $(SERVER_OBJS)
+server: $(SERVER_OBJS)
$(CXX) $(CXXFLAGS) -o sauer_server $(SERVER_OBJS) $(SERVER_LIBS)
-master: libenet $(MASTER_OBJS)
+master: $(MASTER_OBJS)
$(CXX) $(CXXFLAGS) -o sauer_master $(MASTER_OBJS) $(MASTER_LIBS)
shared/cube2font.o: shared/cube2font.c
@@ -232,10 +229,6 @@ endif
endif
endif
-enet/libenet.a:
- $(MAKE) -C enet CC='$(CC)' AR='$(AR)'
-libenet: enet/libenet.a
-
depend:
makedepend -Y -Ishared -Iengine -Ifpsgame $(CLIENT_OBJS:.o=.cpp)
makedepend -a -o.h.gch -Y -Ishared -Iengine -Ifpsgame $(CLIENT_PCH:.h.gch=.h)
@@ -294,12 +287,6 @@ engine/console.o: shared/ents.h shared/command.h shared/glexts.h
engine/console.o: shared/glemu.h shared/iengine.h shared/igame.h
engine/console.o: engine/world.h engine/octa.h engine/lightmap.h engine/bih.h
engine/console.o: engine/texture.h engine/model.h
-engine/cubeloader.o: engine/engine.h shared/cube.h shared/tools.h
-engine/cubeloader.o: shared/geom.h shared/ents.h shared/command.h
-engine/cubeloader.o: shared/glexts.h shared/glemu.h shared/iengine.h
-engine/cubeloader.o: shared/igame.h engine/world.h engine/octa.h
-engine/cubeloader.o: engine/lightmap.h engine/bih.h engine/texture.h
-engine/cubeloader.o: engine/model.h
engine/decal.o: engine/engine.h shared/cube.h shared/tools.h shared/geom.h
engine/decal.o: shared/ents.h shared/command.h shared/glexts.h shared/glemu.h
engine/decal.o: shared/iengine.h shared/igame.h engine/world.h engine/octa.h
@@ -384,9 +371,8 @@ engine/rendermodel.o: shared/glexts.h shared/glemu.h shared/iengine.h
engine/rendermodel.o: shared/igame.h engine/world.h engine/octa.h
engine/rendermodel.o: engine/lightmap.h engine/bih.h engine/texture.h
engine/rendermodel.o: engine/model.h engine/ragdoll.h engine/animmodel.h
-engine/rendermodel.o: engine/vertmodel.h engine/skelmodel.h engine/md2.h
+engine/rendermodel.o: engine/vertmodel.h engine/skelmodel.h
engine/rendermodel.o: engine/md3.h engine/md5.h engine/obj.h engine/smd.h
-engine/rendermodel.o: engine/iqm.h
engine/renderparticles.o: engine/engine.h shared/cube.h shared/tools.h
engine/renderparticles.o: shared/geom.h shared/ents.h shared/command.h
engine/renderparticles.o: shared/glexts.h shared/glemu.h shared/iengine.h
@@ -465,7 +451,6 @@ fpsgame/ai.o: shared/iengine.h shared/igame.h fpsgame/ai.h
fpsgame/client.o: fpsgame/game.h shared/cube.h shared/tools.h shared/geom.h
fpsgame/client.o: shared/ents.h shared/command.h shared/glexts.h
fpsgame/client.o: shared/glemu.h shared/iengine.h shared/igame.h fpsgame/ai.h
-fpsgame/client.o: fpsgame/capture.h fpsgame/ctf.h fpsgame/collect.h
fpsgame/entities.o: fpsgame/game.h shared/cube.h shared/tools.h shared/geom.h
fpsgame/entities.o: shared/ents.h shared/command.h shared/glexts.h
fpsgame/entities.o: shared/glemu.h shared/iengine.h shared/igame.h
@@ -473,14 +458,6 @@ fpsgame/entities.o: fpsgame/ai.h
fpsgame/fps.o: fpsgame/game.h shared/cube.h shared/tools.h shared/geom.h
fpsgame/fps.o: shared/ents.h shared/command.h shared/glexts.h shared/glemu.h
fpsgame/fps.o: shared/iengine.h shared/igame.h fpsgame/ai.h
-fpsgame/monster.o: fpsgame/game.h shared/cube.h shared/tools.h shared/geom.h
-fpsgame/monster.o: shared/ents.h shared/command.h shared/glexts.h
-fpsgame/monster.o: shared/glemu.h shared/iengine.h shared/igame.h
-fpsgame/monster.o: fpsgame/ai.h
-fpsgame/movable.o: fpsgame/game.h shared/cube.h shared/tools.h shared/geom.h
-fpsgame/movable.o: shared/ents.h shared/command.h shared/glexts.h
-fpsgame/movable.o: shared/glemu.h shared/iengine.h shared/igame.h
-fpsgame/movable.o: fpsgame/ai.h
fpsgame/render.o: fpsgame/game.h shared/cube.h shared/tools.h shared/geom.h
fpsgame/render.o: shared/ents.h shared/command.h shared/glexts.h
fpsgame/render.o: shared/glemu.h shared/iengine.h shared/igame.h fpsgame/ai.h
@@ -491,7 +468,6 @@ fpsgame/scoreboard.o: shared/igame.h fpsgame/ai.h
fpsgame/server.o: fpsgame/game.h shared/cube.h shared/tools.h shared/geom.h
fpsgame/server.o: shared/ents.h shared/command.h shared/glexts.h
fpsgame/server.o: shared/glemu.h shared/iengine.h shared/igame.h fpsgame/ai.h
-fpsgame/server.o: fpsgame/capture.h fpsgame/ctf.h fpsgame/collect.h
fpsgame/server.o: fpsgame/extinfo.h fpsgame/aiman.h
fpsgame/waypoint.o: fpsgame/game.h shared/cube.h shared/tools.h shared/geom.h
fpsgame/waypoint.o: shared/ents.h shared/command.h shared/glexts.h
@@ -537,8 +513,7 @@ fpsgame/entities-standalone.o: shared/iengine.h shared/igame.h fpsgame/ai.h
fpsgame/server-standalone.o: fpsgame/game.h shared/cube.h shared/tools.h
fpsgame/server-standalone.o: shared/geom.h shared/ents.h shared/command.h
fpsgame/server-standalone.o: shared/iengine.h shared/igame.h fpsgame/ai.h
-fpsgame/server-standalone.o: fpsgame/capture.h fpsgame/ctf.h
-fpsgame/server-standalone.o: fpsgame/collect.h fpsgame/extinfo.h
+fpsgame/server-standalone.o: fpsgame/extinfo.h
fpsgame/server-standalone.o: fpsgame/aiman.h
engine/master-standalone.o: shared/cube.h shared/tools.h shared/geom.h
engine/master-standalone.o: shared/ents.h shared/command.h shared/iengine.h
diff --git a/src/engine/engine.h b/src/engine/engine.h
index 9f41f45..efee4cd 100644
--- a/src/engine/engine.h
+++ b/src/engine/engine.h
@@ -150,7 +150,6 @@ extern void invalidatepostfx();
extern void gl_drawhud();
extern void gl_drawframe();
extern void gl_drawmainmenu();
-extern void drawminimap();
extern void drawtextures();
extern void enablepolygonoffset(GLenum type);
extern void disablepolygonoffset(GLenum type);
diff --git a/src/engine/engine.h.gch b/src/engine/engine.h.gch
new file mode 100644
index 0000000..372a18b
--- /dev/null
+++ b/src/engine/engine.h.gch
Binary files differ
diff --git a/src/engine/main.cpp b/src/engine/main.cpp
index f522479..968c8e6 100644
--- a/src/engine/main.cpp
+++ b/src/engine/main.cpp
@@ -1301,7 +1301,7 @@ int main(int argc, char **argv)
logoutf("init: console");
if(!execfile("data/stdlib.cfg", false)) fatal("cannot find data files (you are running from the wrong folder, try .bat file in the main folder)"); // this is the first file we load.
- if(!execfile("data/font.cfg", false)) fatal("cannot find font definitions");
+ if(!execfile("packages/fonts/default.cfg", false)) fatal("cannot find font definitions");
if(!setfont("default")) fatal("no default font specified");
inbetweenframes = true;
@@ -1322,8 +1322,7 @@ int main(int argc, char **argv)
execfile("data/menus.cfg");
execfile("data/heightmap.cfg");
execfile("data/blendbrush.cfg");
- defformatstring(gamecfgname, "data/game_%s.cfg", game::gameident());
- execfile(gamecfgname);
+ execfile("data/game_fps.cfg");
if(game::savedservers()) execfile(game::savedservers(), false);
identflags |= IDF_PERSIST;
diff --git a/src/engine/model.h b/src/engine/model.h
index 97264bd..cd75c9d 100644
--- a/src/engine/model.h
+++ b/src/engine/model.h
@@ -1,4 +1,4 @@
-enum { MDL_MD2 = 0, MDL_MD3, MDL_MD5, MDL_OBJ, MDL_SMD, MDL_IQM, NUMMODELTYPES };
+enum { MDL_MD3, MDL_MD5, MDL_OBJ, MDL_SMD, NUMMODELTYPES };
struct model
{
diff --git a/src/engine/physics.cpp b/src/engine/physics.cpp
index 6e78863..e1cd04d 100644
--- a/src/engine/physics.cpp
+++ b/src/engine/physics.cpp
@@ -13,7 +13,7 @@ static int clipcacheversion = -2;
static inline clipplanes &getclipplanes(const cube &c, const ivec &o, int size, bool collide = true, int offset = 0)
{
clipplanes &p = clipcache[int(&c - worldroot)&(MAXCLIPPLANES-1)];
- if(p.owner != &c || p.version != clipcacheversion+offset)
+ if(p.owner != &c || p.version != clipcacheversion+offset)
{
p.owner = &c;
p.version = clipcacheversion+offset;
@@ -359,8 +359,8 @@ ShadowRayCache *newshadowraycache() { return new ShadowRayCache; }
void freeshadowraycache(ShadowRayCache *&cache) { delete cache; cache = NULL; }
-void resetshadowraycache(ShadowRayCache *cache)
-{
+void resetshadowraycache(ShadowRayCache *cache)
+{
cache->version++;
if(!cache->version)
{
@@ -839,7 +839,7 @@ static inline bool clampcollide(const clipplanes &p, const E &entvol, const plan
}
return false;
}
-
+
template<class E>
static bool fuzzycollideplanes(physent *d, const vec &dir, float cutoff, const cube &c, const ivec &co, int size) // collide with deformed cube geometry
{
@@ -1213,7 +1213,7 @@ bool trystepdown(physent *d, vec &dir, float step, float xy, float z, bool init
stepfloor.normalize();
if(d->physstate >= PHYS_SLOPE && d->floor != stepfloor)
{
- // prevent alternating step-down/step-up states if player would keep bumping into the same floor
+ // prevent alternating step-down/step-up states if player would keep bumping into the same floor
vec stepped(d->o);
d->o.z -= 0.5f;
d->zmargin = -0.5f;
@@ -1493,14 +1493,14 @@ bool droptofloor(vec &o, float radius, float height)
{
static struct dropent : physent
{
- dropent()
- {
- type = ENT_BOUNCE;
+ dropent()
+ {
+ type = ENT_BOUNCE;
vel = vec(0, 0, -1);
}
} d;
d.o = o;
- if(!insideworld(d.o))
+ if(!insideworld(d.o))
{
if(d.o.z < worldsize) return false;
d.o.z = worldsize - 1e-3f;
@@ -1525,16 +1525,16 @@ float dropheight(entity &e)
switch(e.type)
{
case ET_PARTICLES:
- case ET_MAPMODEL: return 0.0f;
+ case ET_MAPMODEL:
+ return 0.0f;
default:
- if(e.type >= ET_GAMESPECIFIC) return entities::dropheight(e);
return 4.0f;
}
}
void dropenttofloor(entity *e)
{
- droptofloor(e->o, 1.0f, dropheight(*e));
+ droptofloor(e->o, 1.0f, 4.0f);
}
void phystest()
diff --git a/src/engine/rendergl.cpp b/src/engine/rendergl.cpp
index 6049951..5ada421 100644
--- a/src/engine/rendergl.cpp
+++ b/src/engine/rendergl.cpp
@@ -599,7 +599,7 @@ void gl_init()
glClearDepth(1);
glDepthFunc(GL_LESS);
glDisable(GL_DEPTH_TEST);
-
+
glEnable(GL_LINE_SMOOTH);
//glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
@@ -621,7 +621,7 @@ VAR(wireframe, 0, 0, 1);
ICOMMAND(getcamyaw, "", (), floatret(camera1->yaw));
ICOMMAND(getcampitch, "", (), floatret(camera1->pitch));
ICOMMAND(getcamroll, "", (), floatret(camera1->roll));
-ICOMMAND(getcampos, "", (),
+ICOMMAND(getcampos, "", (),
{
defformatstring(pos, "%s %s %s", floatstr(camera1->o.x), floatstr(camera1->o.y), floatstr(camera1->o.z));
result(pos);
@@ -652,7 +652,7 @@ void setcammatrix()
void setcamprojmatrix(bool init = true, bool flush = false)
{
if(init)
- {
+ {
setcammatrix();
}
@@ -672,7 +672,7 @@ void setcamprojmatrix(bool init = true, bool flush = false)
fogplane.x /= projmatrix.a.x;
fogplane.y /= projmatrix.b.y;
fogplane.z /= projmatrix.c.w;
- GLOBALPARAMF(fogplane, fogplane.x, fogplane.y, 0, fogplane.z);
+ GLOBALPARAMF(fogplane, fogplane.x, fogplane.y, 0, fogplane.z);
}
else
{
@@ -771,7 +771,7 @@ FVARP(sensitivity, 1e-3f, 3, 1000);
FVARP(sensitivityscale, 1e-3f, 1, 1000);
VARP(invmouse, 0, 0, 1);
FVARP(mouseaccel, 0, 0, 1000);
-
+
VAR(thirdperson, 0, 0, 2);
FVAR(thirdpersondistance, 0, 20, 50);
FVAR(thirdpersonup, -25, 0, 25);
@@ -795,12 +795,12 @@ void mousemove(int dx, int dy)
float cursens = sensitivity, curaccel = mouseaccel;
if(zoom)
{
- if(zoomautosens)
+ if(zoomautosens)
{
cursens = float(sensitivity*zoomfov)/fov;
curaccel = float(mouseaccel*zoomfov)/fov;
}
- else
+ else
{
cursens = zoomsens;
curaccel = zoomaccel;
@@ -844,7 +844,7 @@ void recomputecamera()
camera1->type = ENT_CAMERA;
camera1->move = -1;
camera1->eyeheight = camera1->aboveeye = camera1->radius = camera1->xradius = camera1->yradius = 2;
-
+
matrix3 orient;
orient.identity();
orient.rotate_around_z(camera1->yaw*RAD);
@@ -852,7 +852,7 @@ void recomputecamera()
orient.rotate_around_y(camera1->roll*-RAD);
vec dir = vec(orient.b).neg(), side = vec(orient.a).neg(), up = orient.c;
- if(game::collidecamera())
+ if(game::collidecamera())
{
movecamera(camera1, dir, thirdpersondistance, 1);
movecamera(camera1, dir, clamp(thirdpersondistance - camera1->o.dist(player->o), 0.0f, 1.0f), 0.1f);
@@ -873,7 +873,7 @@ void recomputecamera()
movecamera(camera1, side, clamp(dist - camera1->o.dist(pos), 0.0f, 1.0f), 0.1f);
}
}
- else
+ else
{
camera1->o.add(vec(dir).mul(thirdpersondistance));
if(thirdpersonup) camera1->o.add(vec(up).mul(thirdpersonup));
@@ -939,7 +939,7 @@ void enablepolygonoffset(GLenum type)
glEnable(type);
return;
}
-
+
bool clipped = reflectz < 1e15f && reflectclip;
nooffsetmatrix = projmatrix;
@@ -954,7 +954,7 @@ void disablepolygonoffset(GLenum type)
glDisable(type);
return;
}
-
+
projmatrix = nooffsetmatrix;
setcamprojmatrix(false, true);
}
@@ -962,8 +962,8 @@ void disablepolygonoffset(GLenum type)
void calcspherescissor(const vec &center, float size, float &sx1, float &sy1, float &sx2, float &sy2)
{
vec worldpos(center), e;
- if(reflecting) worldpos.z = 2*reflectz - worldpos.z;
- cammatrix.transform(worldpos, e);
+ if(reflecting) worldpos.z = 2*reflectz - worldpos.z;
+ cammatrix.transform(worldpos, e);
if(e.z > 2*size) { sx1 = sy1 = 1; sx2 = sy2 = -1; return; }
float zzrr = e.z*e.z - size*size,
dx = e.x*e.x + zzrr, dy = e.y*e.y + zzrr,
@@ -1034,7 +1034,7 @@ int pushscissor(float sx1, float sy1, float sx2, float sy2)
glScissor(sx, sy, sw, sh);
if(scissoring<=1) glEnable(GL_SCISSOR_TEST);
-
+
return scissoring;
}
@@ -1452,7 +1452,7 @@ void drawreflection(float z, bool refract, int fogdepth, const bvec &col)
rendergame();
if(refracting && z>=0 && !isthirdperson() && fabs(camera1->o.z-z) <= 0.5f*(player->eyeheight + player->aboveeye))
- {
+ {
matrix4 oldprojmatrix = projmatrix, avatarproj;
avatarproj.perspective(curavatarfov, aspect, nearplane, farplane);
if(reflectclip)
@@ -1477,7 +1477,7 @@ void drawreflection(float z, bool refract, int fogdepth, const bvec &col)
if(fading) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- if(reflectclip && z>=0) projmatrix = noclipmatrix;
+ if(reflectclip && z>=0) projmatrix = noclipmatrix;
if(reflecting)
{
@@ -1488,7 +1488,7 @@ void drawreflection(float z, bool refract, int fogdepth, const bvec &col)
popfogdist();
popfogcolor();
-
+
reflectz = 1e16f;
refracting = 0;
reflecting = fading = fogging = false;
@@ -1513,7 +1513,7 @@ void drawcubemap(int size, const vec &o, float yaw, float pitch, const cubemapsi
cmcamera.roll = 0;
camera1 = &cmcamera;
setviewcell(camera1->o);
-
+
int fogmat = lookupmaterial(o)&(MATF_VOLUME|MATF_INDEX);
setfog(fogmat);
@@ -1653,146 +1653,6 @@ vec calcmodelpreviewpos(const vec &radius, float &yaw)
return vec(0, dist, 0).rotate_around_x(camera1->pitch*RAD);
}
-GLuint minimaptex = 0;
-vec minimapcenter(0, 0, 0), minimapradius(0, 0, 0), minimapscale(0, 0, 0);
-
-void clearminimap()
-{
- if(minimaptex) { glDeleteTextures(1, &minimaptex); minimaptex = 0; }
-}
-
-VARR(minimapheight, 0, 0, 2<<16);
-bvec minimapcolor(0, 0, 0);
-HVARFR(minimapcolour, 0, 0, 0xFFFFFF,
-{
- minimapcolor = bvec((minimapcolour>>16)&0xFF, (minimapcolour>>8)&0xFF, minimapcolour&0xFF);
-});
-VARR(minimapclip, 0, 0, 1);
-VARFP(minimapsize, 7, 8, 10, { if(minimaptex) drawminimap(); });
-
-void bindminimap()
-{
- glBindTexture(GL_TEXTURE_2D, minimaptex);
-}
-
-void clipminimap(ivec &bbmin, ivec &bbmax, cube *c = worldroot, const ivec &co = ivec(0, 0, 0), int size = worldsize>>1)
-{
- loopi(8)
- {
- ivec o(i, co, size);
- if(c[i].children) clipminimap(bbmin, bbmax, c[i].children, o, size>>1);
- else if(!isentirelysolid(c[i]) && (c[i].material&MATF_CLIP)!=MAT_CLIP)
- {
- loopk(3) bbmin[k] = min(bbmin[k], o[k]);
- loopk(3) bbmax[k] = max(bbmax[k], o[k] + size);
- }
- }
-}
-
-void drawminimap()
-{
- if(!game::needminimap()) { clearminimap(); return; }
-
- renderprogress(0, "generating mini-map...", 0, !renderedframe);
-
- int size = 1<<minimapsize, sizelimit = min(hwtexsize, min(screenw, screenh));
- while(size > sizelimit) size /= 2;
- if(!minimaptex) glGenTextures(1, &minimaptex);
-
- ivec bbmin(worldsize, worldsize, worldsize), bbmax(0, 0, 0);
- loopv(valist)
- {
- vtxarray *va = valist[i];
- loopk(3)
- {
- if(va->geommin[k]>va->geommax[k]) continue;
- bbmin[k] = min(bbmin[k], va->geommin[k]);
- bbmax[k] = max(bbmax[k], va->geommax[k]);
- }
- }
- if(minimapclip)
- {
- ivec clipmin(worldsize, worldsize, worldsize), clipmax(0, 0, 0);
- clipminimap(clipmin, clipmax);
- loopk(2) bbmin[k] = max(bbmin[k], clipmin[k]);
- loopk(2) bbmax[k] = min(bbmax[k], clipmax[k]);
- }
-
- minimapradius = vec(bbmax).sub(vec(bbmin)).mul(0.5f);
- minimapcenter = vec(bbmin).add(minimapradius);
- minimapradius.x = minimapradius.y = max(minimapradius.x, minimapradius.y);
- minimapscale = vec((0.5f - 1.0f/size)/minimapradius.x, (0.5f - 1.0f/size)/minimapradius.y, 1.0f);
-
- drawtex = DRAWTEX_MINIMAP;
-
- physent *oldcamera = camera1;
- static physent cmcamera;
- cmcamera = *player;
- cmcamera.reset();
- cmcamera.type = ENT_CAMERA;
- cmcamera.o = vec(minimapcenter.x, minimapcenter.y, max(minimapcenter.z + minimapradius.z + 1, float(minimapheight)));
- cmcamera.yaw = 0;
- cmcamera.pitch = -90;
- cmcamera.roll = 0;
- camera1 = &cmcamera;
- setviewcell(vec(-1, -1, -1));
-
- projmatrix.ortho(-minimapradius.x, minimapradius.x, -minimapradius.y, minimapradius.y, 0, camera1->o.z + 1);
- projmatrix.a.mul(-1);
- setcamprojmatrix();
-
- setnofog(minimapcolor.tocolor());
-
- glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
-
- glViewport(0, 0, size, size);
-
- glEnable(GL_CULL_FACE);
- glEnable(GL_DEPTH_TEST);
-
- glFrontFace(GL_CCW);
-
- xtravertsva = xtraverts = glde = gbatches = 0;
-
- visiblecubes(false);
- queryreflections();
- drawreflections();
-
- loopi(minimapheight > 0 && minimapheight < minimapcenter.z + minimapradius.z ? 2 : 1)
- {
- if(i)
- {
- glClear(GL_DEPTH_BUFFER_BIT);
- camera1->o.z = minimapheight;
- setcamprojmatrix();
- }
- rendergeom();
- rendermapmodels();
- renderwater();
- rendermaterials();
- renderalphageom();
- }
-
- glFrontFace(GL_CW);
-
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_CULL_FACE);
-
- glViewport(0, 0, screenw, screenh);
-
- camera1 = oldcamera;
- drawtex = 0;
-
- glBindTexture(GL_TEXTURE_2D, minimaptex);
- glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB5, 0, 0, size, size, 0);
- setuptexparameters(minimaptex, NULL, 3, 1, GL_RGB5, GL_TEXTURE_2D);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
- GLfloat border[4] = { minimapcolor.x/255.0f, minimapcolor.y/255.0f, minimapcolor.z/255.0f, 1.0f };
- glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, border);
- glBindTexture(GL_TEXTURE_2D, 0);
-}
-
bool deferdrawtextures = false;
void drawtextures()
@@ -1800,7 +1660,6 @@ void drawtextures()
if(minimized) { deferdrawtextures = true; return; }
deferdrawtextures = false;
genenvmaps();
- drawminimap();
}
GLuint motiontex = 0;
@@ -1870,7 +1729,7 @@ void gl_drawframe()
int w = screenw, h = screenh;
aspect = forceaspect ? forceaspect : w/float(h);
fovy = 2*atan2(tan(curfov/2*RAD), aspect)/RAD;
-
+
int fogmat = lookupmaterial(camera1->o)&(MATF_VOLUME|MATF_INDEX), abovemat = MAT_AIR;
float fogblend = 1.0f, causticspass = 0.0f;
if(isliquid(fogmat&MATF_VOLUME))
@@ -1881,7 +1740,7 @@ void gl_drawframe()
if(caustics && (fogmat&MATF_VOLUME)==MAT_WATER && camera1->o.z < z)
causticspass = min(z - camera1->o.z, 1.0f);
}
- else fogmat = MAT_AIR;
+ else fogmat = MAT_AIR;
setfog(fogmat, fogblend, abovemat);
if(fogmat!=MAT_AIR)
{
@@ -1901,10 +1760,10 @@ void gl_drawframe()
xtravertsva = xtraverts = glde = gbatches = 0;
visiblecubes();
-
+
glClear(GL_DEPTH_BUFFER_BIT|(wireframe && editmode ? GL_COLOR_BUFFER_BIT : 0));
- if(wireframe && editmode) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ if(wireframe && editmode) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
if(limitsky()) drawskybox(farplane, true);
@@ -1979,7 +1838,7 @@ void damagecompass(int n, const vec &loc)
{
if(!usedamagecompass || minimized) return;
vec delta(loc);
- delta.sub(camera1->o);
+ delta.sub(camera1->o);
float yaw = 0, pitch;
if(delta.magnitude() > 4)
{
@@ -2087,7 +1946,7 @@ void loadcrosshair(const char *name, int i)
{
if(i < 0 || i >= MAXCROSSHAIRS) return;
crosshairs[i] = name ? textureload(name, 3, true) : notexture;
- if(crosshairs[i] == notexture)
+ if(crosshairs[i] == notexture)
{
name = game::defaultcrosshair(i);
if(!name) name = "data/crosshair.png";
@@ -2102,7 +1961,7 @@ void loadcrosshair_(const char *name, int *i)
COMMANDN(loadcrosshair, loadcrosshair_, "si");
-ICOMMAND(getcrosshair, "i", (int *i),
+ICOMMAND(getcrosshair, "i", (int *i),
{
const char *name = "";
if(*i >= 0 && *i < MAXCROSSHAIRS)
@@ -2112,7 +1971,7 @@ ICOMMAND(getcrosshair, "i", (int *i),
}
result(name);
});
-
+
void writecrosshairs(stream *f)
{
loopi(MAXCROSSHAIRS) if(crosshairs[i] && crosshairs[i]!=notexture)
@@ -2137,13 +1996,13 @@ void drawcrosshair(int w, int h)
g3d_cursorpos(cx, cy);
}
else
- {
+ {
int index = game::selectcrosshair(color);
if(index < 0) return;
if(!crosshairfx) index = 0;
if(!crosshairfx || !crosshaircolors) color = vec(1, 1, 1);
crosshair = crosshairs[index];
- if(!crosshair)
+ if(!crosshair)
{
loadcrosshair(NULL, index);
crosshair = crosshairs[index];
@@ -2198,7 +2057,7 @@ void gl_drawhud()
hudmatrix.ortho(0, w, h, 0, -1, 1);
resethudmatrix();
-
+
gle::colorf(1, 1, 1);
extern int debugsm;
@@ -2223,10 +2082,10 @@ void gl_drawhud()
}
glEnable(GL_BLEND);
-
+
extern void debugparticles();
debugparticles();
-
+
if(!mainmenu)
{
drawdamagescreen(w, h);
@@ -2274,12 +2133,12 @@ void gl_drawhud()
char *dst = buf;
const char *src = &buf[!wallclock24 && buf[0]=='0' ? 1 : 0];
while(*src) *dst++ = tolower(*src++);
- *dst++ = '\0';
+ *dst++ = '\0';
draw_text(buf, conw-5*FONTH, conh-FONTH*3/2-roffset);
roffset += FONTH;
}
}
-
+
if(editmode || showeditstats)
{
static int laststats = 0, prevstats[8] = { 0, 0, 0, 0, 0, 0, 0 }, curstats[8] = { 0, 0, 0, 0, 0, 0, 0 };
@@ -2378,8 +2237,6 @@ void cleanupgl()
{
cleanupmotionblur();
- clearminimap();
-
cleanupscreenquad();
gle::cleanup();
diff --git a/src/engine/rendermodel.cpp b/src/engine/rendermodel.cpp
index dc05e69..d79a422 100644
--- a/src/engine/rendermodel.cpp
+++ b/src/engine/rendermodel.cpp
@@ -24,20 +24,16 @@ static model *__loadmodel__##modelclass(const char *filename) \
return new modelclass(filename); \
} \
UNUSED static int __dummy__##modelclass = addmodeltype((modeltype), __loadmodel__##modelclass);
-
-#include "md2.h"
+
#include "md3.h"
#include "md5.h"
#include "obj.h"
#include "smd.h"
-#include "iqm.h"
-MODELTYPE(MDL_MD2, md2);
MODELTYPE(MDL_MD3, md3);
MODELTYPE(MDL_MD5, md5);
MODELTYPE(MDL_OBJ, obj);
MODELTYPE(MDL_SMD, smd);
-MODELTYPE(MDL_IQM, iqm);
#define checkmdl if(!loadingmodel) { conoutf(CON_ERROR, "not loading a model"); return; }
@@ -61,14 +57,14 @@ void mdlellipsecollide(int *collide)
{
checkmdl;
loadingmodel->ellipsecollide = *collide!=0;
-}
-
+}
+
COMMAND(mdlellipsecollide, "i");
void mdlspec(int *percent)
{
checkmdl;
- float spec = 1.0f;
+ float spec = 1.0f;
if(*percent>0) spec = *percent/100.0f;
else if(*percent<0) spec = 0.0f;
loadingmodel->setspec(spec);
@@ -88,7 +84,7 @@ void mdlambient(int *percent)
COMMAND(mdlambient, "i");
void mdlalphatest(float *cutoff)
-{
+{
checkmdl;
loadingmodel->setalphatest(max(0.0f, min(1.0f, *cutoff)));
}
@@ -96,7 +92,7 @@ void mdlalphatest(float *cutoff)
COMMAND(mdlalphatest, "f");
void mdlalphablend(int *blend)
-{
+{
checkmdl;
loadingmodel->setalphablend(*blend!=0);
}
@@ -178,7 +174,7 @@ void mdlscale(int *percent)
float scale = 1.0f;
if(*percent>0) scale = *percent/100.0f;
loadingmodel->scale = scale;
-}
+}
COMMAND(mdlscale, "i");
@@ -186,7 +182,7 @@ void mdltrans(float *x, float *y, float *z)
{
checkmdl;
loadingmodel->translate = vec(*x, *y, *z);
-}
+}
COMMAND(mdltrans, "fff");
@@ -219,7 +215,7 @@ void mdlbb(float *rad, float *h, float *eyeheight)
checkmdl;
loadingmodel->collidexyradius = *rad;
loadingmodel->collideheight = *h;
- loadingmodel->eyeheight = *eyeheight;
+ loadingmodel->eyeheight = *eyeheight;
}
COMMAND(mdlbb, "fff");
@@ -251,7 +247,7 @@ COMMAND(mdlname, "");
if(!skel->ragdoll) skel->ragdoll = new ragdollskel; \
ragdollskel *ragdoll = skel->ragdoll; \
if(ragdoll->loaded) return;
-
+
void rdvert(float *x, float *y, float *z, float *radius)
{
@@ -291,7 +287,7 @@ void rdjoint(int *n, int *t, int *v1, int *v2, int *v3)
j.vert[2] = *v3;
}
COMMAND(rdjoint, "iibbb");
-
+
void rdlimitdist(int *v1, int *v2, float *mindist, float *maxdist)
{
checkragdoll;
@@ -337,10 +333,10 @@ void mapmodelcompat(int *rad, int *h, int *tex, char *name, char *shadow)
mmodel(name);
}
-void mapmodelreset(int *n)
-{
+void mapmodelreset(int *n)
+{
if(!(identflags&IDF_OVERRIDDEN) && !game::allowedittoggle()) return;
- mapmodels.shrink(clamp(*n, 0, mapmodels.length()));
+ mapmodels.shrink(clamp(*n, 0, mapmodels.length()));
}
mapmodelinfo *getmminfo(int i) { return mapmodels.inrange(i) ? &mapmodels[i] : 0; }
@@ -425,7 +421,7 @@ model *loadmodel(const char *name, int i, bool msg)
model *m;
if(mm) m = *mm;
else
- {
+ {
if(!name[0] || loadingmodel || lightmapping > 1) return NULL;
if(msg)
{
@@ -534,13 +530,13 @@ struct batchedmodel
dynent *d;
int attached;
occludequery *query;
-};
+};
struct modelbatch
{
model *m;
int flags;
vector<batchedmodel> batched;
-};
+};
static vector<modelbatch *> batches;
static vector<modelattach> modelattached;
static int numbatches = -1;
@@ -579,10 +575,10 @@ void renderbatchedmodel(model *m, batchedmodel &b)
int anim = b.anim;
if(shadowmapping)
{
- anim |= ANIM_NOSKIN;
+ anim |= ANIM_NOSKIN;
GLOBALPARAMF(shadowintensity, b.transparent);
}
- else
+ else
{
if(b.flags&MDL_FULLBRIGHT) anim |= ANIM_FULLBRIGHT;
if(b.flags&MDL_GHOST) anim |= ANIM_GHOST;
@@ -633,13 +629,13 @@ void endmodelbatches()
if(!rendered) { b.m->startrender(); rendered = true; }
renderbatchedmodel(b.m, bm);
}
- if(rendered)
+ if(rendered)
{
b.m->endrender();
rendered = false;
}
}
- loopvj(b.batched)
+ loopvj(b.batched)
{
batchedmodel &bm = b.batched[j];
if(bm.flags&(MDL_CULL_VFC|MDL_GHOST)) continue;
@@ -806,7 +802,7 @@ static inline int cullmodel(model *m, const vec &center, float radius, int flags
void rendermodel(entitylight *light, const char *mdl, int anim, const vec &o, float yaw, float pitch, int flags, dynent *d, modelattach *a, int basetime, int basetime2, float trans)
{
if(shadowmapping && !(flags&(MDL_SHADOW|MDL_DYNSHADOW))) return;
- model *m = loadmodel(mdl);
+ model *m = loadmodel(mdl);
if(!m) return;
vec center(0, 0, 0), bbradius(0, 0, 0);
float radius = 0;
@@ -851,7 +847,7 @@ void rendermodel(entitylight *light, const char *mdl, int anim, const vec &o, fl
else if(showboundingbox && !shadowmapping && !reflecting && !refracting && editmode)
{
notextureshader->set();
- if(d && showboundingbox==1)
+ if(d && showboundingbox==1)
{
render3dbox(d->o, d->eyeheight, d->aboveeye, d->radius);
renderellipse(d->o, d->xradius, d->yradius, d->yaw);
@@ -871,7 +867,7 @@ void rendermodel(entitylight *light, const char *mdl, int anim, const vec &o, fl
if(!shadowmapping)
{
vec pos = o;
- if(d)
+ if(d)
{
if(!reflecting && !refracting) d->occluded = OCCLUDE_NOTHING;
if(!light) light = &d->light;
@@ -891,7 +887,7 @@ void rendermodel(entitylight *light, const char *mdl, int anim, const vec &o, fl
}
else if(flags&MDL_LIGHT)
{
- if(!light)
+ if(!light)
{
lightreaching(pos, lightcolor, lightdir, (flags&MDL_LIGHT_FAST)!=0);
dynlightreaching(pos, lightcolor, lightdir, (flags&MDL_HUD)!=0);
@@ -928,7 +924,7 @@ void rendermodel(entitylight *light, const char *mdl, int anim, const vec &o, fl
b.basetime2 = basetime2;
b.transparent = trans;
b.flags = flags & ~(MDL_CULL_VFC | MDL_CULL_DIST | MDL_CULL_OCCLUDED);
- if(!shadow || reflecting || refracting>0)
+ if(!shadow || reflecting || refracting>0)
{
b.flags &= ~(MDL_SHADOW|MDL_DYNSHADOW);
if((flags&MDL_CULL_VFC) && refracting<0 && center.z-radius>=reflectz) b.flags |= MDL_CULL_VFC;
@@ -955,7 +951,7 @@ void rendermodel(entitylight *light, const char *mdl, int anim, const vec &o, fl
anim |= ANIM_NOSKIN;
GLOBALPARAMF(shadowintensity, trans);
}
- else
+ else
{
if(flags&MDL_FULLBRIGHT) anim |= ANIM_FULLBRIGHT;
if(flags&MDL_GHOST) anim |= ANIM_GHOST;
@@ -991,7 +987,7 @@ bool matchanim(const char *name, const char *pattern)
{
c = *pattern;
if(!c || c=='|') break;
- else if(c=='*')
+ else if(c=='*')
{
if(!*s || iscubespace(*s)) break;
do s++; while(*s && !iscubespace(*s));
@@ -1041,7 +1037,7 @@ void loadskin(const char *dir, const char *altdir, Texture *&skin, Texture *&mas
} \
} \
}
-
+
defformatstring(mdir, "packages/models/%s", dir);
defformatstring(maltdir, "packages/models/%s", altdir);
masks = notexture;
@@ -1069,7 +1065,7 @@ void renderclient(dynent *d, const char *mdlname, modelattach *attachments, int
basetime = lastpain;
if(ragdoll)
{
- if(!d->ragdoll || d->ragdoll->millis < basetime)
+ if(!d->ragdoll || d->ragdoll->millis < basetime)
{
DELETEP(d->ragdoll);
anim |= ANIM_RAGDOLL;
@@ -1081,20 +1077,20 @@ void renderclient(dynent *d, const char *mdlname, modelattach *attachments, int
else if(d->state==CS_LAGGED) anim = ANIM_LAG|ANIM_LOOP;
else
{
- if(lastmillis-lastpain < 300)
- {
+ if(lastmillis-lastpain < 300)
+ {
anim = ANIM_PAIN;
basetime = lastpain;
}
else if(lastpain < lastaction && (attack < 0 || (d->type != ENT_AI && lastmillis-lastaction < attackdelay)))
- {
- anim = attack < 0 ? -attack : attack;
- basetime = lastaction;
+ {
+ anim = attack < 0 ? -attack : attack;
+ basetime = lastaction;
}
if(d->inwater && d->physstate<=PHYS_FALL) anim |= (((game::allowmove(d) && (d->move || d->strafe)) || d->vel.z+d->falling.z>0 ? ANIM_SWIM : ANIM_SINK)|ANIM_LOOP)<<ANIM_SECONDARY;
else if(d->timeinair>100) anim |= (ANIM_JUMP|ANIM_END)<<ANIM_SECONDARY;
- else if(game::allowmove(d) && (d->move || d->strafe))
+ else if(game::allowmove(d) && (d->move || d->strafe))
{
if(d->move>0) anim |= (ANIM_FORWARD|ANIM_LOOP)<<ANIM_SECONDARY;
else if(d->strafe)
@@ -1104,7 +1100,7 @@ void renderclient(dynent *d, const char *mdlname, modelattach *attachments, int
}
else if(d->move<0) anim |= (ANIM_BACKWARD|ANIM_LOOP)<<ANIM_SECONDARY;
}
-
+
if((anim&ANIM_INDEX)==ANIM_IDLE && (anim>>ANIM_SECONDARY)&ANIM_INDEX) anim >>= ANIM_SECONDARY;
}
if(d->ragdoll && (!ragdoll || (anim&ANIM_INDEX)!=ANIM_DYING)) DELETEP(d->ragdoll);
@@ -1121,7 +1117,7 @@ void renderclient(dynent *d, const char *mdlname, modelattach *attachments, int
void setbbfrommodel(dynent *d, const char *mdl)
{
- model *m = loadmodel(mdl);
+ model *m = loadmodel(mdl);
if(!m) return;
vec center, radius;
m->collisionbox(center, radius);
diff --git a/src/engine/renderva.cpp b/src/engine/renderva.cpp
index cf9d376..6194659 100644
--- a/src/engine/renderva.cpp
+++ b/src/engine/renderva.cpp
@@ -108,7 +108,7 @@ void addvisibleva(vtxarray *va)
void sortvisiblevas()
{
- visibleva = NULL;
+ visibleva = NULL;
vtxarray **last = &visibleva;
loopi(VASORTSIZE) if(vasort[i])
{
@@ -126,7 +126,7 @@ void findvisiblevas(vector<vtxarray *> &vas, bool resetocclude = false)
vtxarray &v = *vas[i];
int prevvfc = resetocclude ? VFC_NOT_VISIBLE : v.curvfc;
v.curvfc = isvisiblecube(v.o, v.size);
- if(v.curvfc!=VFC_NOT_VISIBLE)
+ if(v.curvfc!=VFC_NOT_VISIBLE)
{
if(pvsoccluded(v.o, v.size))
{
@@ -153,7 +153,7 @@ void calcvfcD()
loopk(3) if(p[k] > 0) vfcDfar[i] += p[k];
else vfcDnear[i] += p[k];
}
-}
+}
void setvfcP(float z, const vec &bbmin, const vec &bbmax)
{
@@ -215,7 +215,7 @@ void visiblecubes(bool cull)
static inline bool insideva(const vtxarray *va, const vec &v, int margin = 2)
{
int size = va->size + margin;
- return v.x>=va->o.x-margin && v.y>=va->o.y-margin && v.z>=va->o.z-margin &&
+ return v.x>=va->o.x-margin && v.y>=va->o.y-margin && v.z>=va->o.z-margin &&
v.x<=va->o.x+size && v.y<=va->o.y+size && v.z<=va->o.z+size;
}
@@ -461,7 +461,6 @@ VAR(oqmm, 0, 4, 8);
void rendermapmodel(extentity &e)
{
int anim = ANIM_MAPMODEL|ANIM_LOOP, basetime = 0;
- if(e.flags&EF_ANIM) entities::animatemapmodel(e, anim, basetime);
mapmodelinfo *mmi = getmminfo(e.attr2);
if(mmi) rendermodel(&e.light, mmi->name, anim, e.o, e.attr1, 0, MDL_CULL_VFC | MDL_CULL_DIST | MDL_DYNLIGHT, NULL, NULL, basetime);
}
@@ -479,7 +478,7 @@ void renderreflectedmapmodels()
for(vtxarray *va = reflectedva; va; va = va->rnext)
{
if(va->mapmodels.empty() || va->distance > reflectdist) continue;
- loopv(va->mapmodels)
+ loopv(va->mapmodels)
{
octaentities *oe = va->mapmodels[i];
*lastmms = oe;
@@ -536,7 +535,7 @@ void rendermapmodels()
rendered = true;
oe->query = doquery && oe->distance>0 && !(++skipoq%oqmm) ? newquery(oe) : NULL;
if(oe->query) startmodelquery(oe->query);
- }
+ }
rendermapmodel(e);
e.flags &= ~EF_RENDER;
}
@@ -567,7 +566,7 @@ void rendermapmodels()
static inline bool bbinsideva(const ivec &bo, const ivec &br, vtxarray *va)
{
return bo.x >= va->bbmin.x && bo.y >= va->bbmin.y && bo.z >= va->bbmin.z &&
- br.x <= va->bbmax.x && br.y <= va->bbmax.y && br.z <= va->bbmax.z;
+ br.x <= va->bbmax.x && br.y <= va->bbmax.y && br.z <= va->bbmax.z;
}
static inline bool bboccluded(const ivec &bo, const ivec &br, cube *c, const ivec &o, int size)
@@ -654,7 +653,7 @@ void renderoutline()
drawvatris(va, 3*va->alphatris, &va->edata[3*(va->tris + va->blendtris)]);
xtravertsva += 3*va->alphatris;
}
-
+
prev = va;
}
@@ -716,7 +715,7 @@ void renderblendbrush(GLuint tex, float x, float y, float w, float h)
gle::clearebo();
gle::disablevertex();
}
-
+
void rendershadowmapreceivers()
{
SETSHADER(shadowmapreceiver);
@@ -733,7 +732,7 @@ void rendershadowmapreceivers()
glEnable(GL_BLEND);
glBlendEquation_(GL_MAX);
glBlendFunc(GL_ONE, GL_ONE);
-
+
vtxarray *prev = NULL;
for(vtxarray *va = visibleva; va; va = va->next)
{
@@ -759,7 +758,7 @@ void rendershadowmapreceivers()
glCullFace(GL_BACK);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LESS);
-
+
if(!ati_minmax_bug) glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
gle::clearvbo();
@@ -785,7 +784,7 @@ void renderdepthobstacles(const vec &bbmin, const vec &bbmax, float scale, float
SETSHADER(depthfxworld);
if(!numranges) loopi(4) scales[i] = 1.0f/scale;
- else loopi(numranges)
+ else loopi(numranges)
{
scales[i] = 1.0f/scale;
offsets[i] = -ranges[i]/scale;
@@ -799,7 +798,7 @@ void renderdepthobstacles(const vec &bbmin, const vec &bbmax, float scale, float
vtxarray *prev = NULL;
for(vtxarray *va = visibleva; va; va = va->next)
{
- if(!va->texs || va->occluded >= OCCLUDE_GEOM ||
+ if(!va->texs || va->occluded >= OCCLUDE_GEOM ||
va->o.x > bbmax.x || va->o.y > bbmax.y || va->o.z > bbmax.z ||
va->o.x + va->size < bbmin.x || va->o.y + va->size < bbmin.y || va->o.z + va->size < bbmin.z)
continue;
@@ -936,10 +935,10 @@ static int firstbatch = -1, numbatches = 0;
static void mergetexs(renderstate &cur, vtxarray *va, elementset *texs = NULL, int numtexs = 0, ushort *edata = NULL)
{
- if(!texs)
- {
- texs = va->eslist;
- numtexs = va->texs;
+ if(!texs)
+ {
+ texs = va->eslist;
+ numtexs = va->texs;
edata = va->edata;
if(cur.alphaing)
{
@@ -954,7 +953,7 @@ static void mergetexs(renderstate &cur, vtxarray *va, elementset *texs = NULL, i
{
firstbatch = geombatches.length();
numbatches = numtexs;
- loopi(numtexs-1)
+ loopi(numtexs-1)
{
geombatches.add(geombatch(texs[i], edata, va)).next = i+1;
edata += texs[i].length[1];
@@ -962,7 +961,7 @@ static void mergetexs(renderstate &cur, vtxarray *va, elementset *texs = NULL, i
geombatches.add(geombatch(texs[numtexs-1], edata, va));
return;
}
-
+
int prevbatch = -1, curbatch = firstbatch, curtex = 0;
do
{
@@ -997,9 +996,9 @@ static void mergetexs(renderstate &cur, vtxarray *va, elementset *texs = NULL, i
{
b.batch = next;
geombatches[last].batch = geombatches.length()-1;
- }
+ }
}
- else
+ else
{
numbatches++;
b.next = curbatch;
@@ -1060,7 +1059,7 @@ static void changebatchtmus(renderstate &cur, int pass, geombatch &b)
bool changed = false;
extern bool brightengeom;
extern int fullbright;
- int lmid = brightengeom && (b.es.lmid < LMID_RESERVED || (fullbright && editmode)) ? LMID_BRIGHT : b.es.lmid;
+ int lmid = brightengeom && (b.es.lmid < LMID_RESERVED || (fullbright && editmode)) ? LMID_BRIGHT : b.es.lmid;
if(cur.textures[1]!=lightmaptexs[lmid].id)
{
glActiveTexture_(GL_TEXTURE1);
@@ -1109,7 +1108,7 @@ static void changeslottmus(renderstate &cur, int pass, Slot &slot, VSlot &vslot)
if(cur.alphaing)
{
float alpha = cur.alphaing > 1 ? vslot.alphafront : vslot.alphaback;
- if(cur.colorscale != vslot.colorscale || cur.alphascale != alpha)
+ if(cur.colorscale != vslot.colorscale || cur.alphascale != alpha)
{
cur.colorscale = vslot.colorscale;
cur.alphascale = alpha;
@@ -1137,7 +1136,7 @@ static void changeslottmus(renderstate &cur, int pass, Slot &slot, VSlot &vslot)
glBindTexture(GL_TEXTURE_CUBE_MAP, cur.textures[envmaptmu] = t.t->id);
}
}
- else
+ else
{
if(cur.textures[tmu]!=t.t->id)
{
@@ -1215,7 +1214,7 @@ static void renderbatch(renderstate &cur, int pass, geombatch &b)
for(geombatch *curbatch = &b;; curbatch = &geombatches[curbatch->batch])
{
ushort len = curbatch->es.length[curbatch->va->shadowed ? 0 : 1];
- if(len)
+ if(len)
{
if(rendered < 0)
{
@@ -1224,8 +1223,8 @@ static void renderbatch(renderstate &cur, int pass, geombatch &b)
gbatches++;
}
ushort minvert = curbatch->es.minvert[0], maxvert = curbatch->es.maxvert[0];
- if(!curbatch->va->shadowed) { minvert = min(minvert, curbatch->es.minvert[1]); maxvert = max(maxvert, curbatch->es.maxvert[1]); }
- drawtris(len, curbatch->edata, minvert, maxvert);
+ if(!curbatch->va->shadowed) { minvert = min(minvert, curbatch->es.minvert[1]); maxvert = max(maxvert, curbatch->es.maxvert[1]); }
+ drawtris(len, curbatch->edata, minvert, maxvert);
vtris += len/3;
}
if(curbatch->es.length[1] > len && !shadowed) shadowed = curbatch;
@@ -1274,14 +1273,14 @@ static void renderbatches(renderstate &cur, int pass)
if(cur.vquery) disablevquery(cur);
enablevattribs(cur);
}
- }
+ }
while(curbatch >= 0)
{
geombatch &b = geombatches[curbatch];
curbatch = b.next;
if(cur.vbuf != b.va->vbuf) changevbuf(cur, pass, b.va);
- if(cur.vslot != &b.vslot)
+ if(cur.vslot != &b.vslot)
{
changeslottmus(cur, pass, *b.vslot.slot, b.vslot);
if(cur.texgendim != b.es.dim || (cur.texgendim <= 2 && cur.texgenvslot != &b.vslot)) changetexgen(cur, b.es.dim, *b.vslot.slot, b.vslot);
@@ -1298,7 +1297,7 @@ static void renderbatches(renderstate &cur, int pass)
void renderzpass(renderstate &cur, vtxarray *va)
{
if(!cur.vattribs)
- {
+ {
if(cur.vquery) disablevquery(cur);
enablevattribs(cur, false);
}
@@ -1409,7 +1408,7 @@ void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bo
drawvatris(va, 3*va->tris, va->edata);
xtravertsva += va->verts;
break;
-
+
case RENDERPASS_Z:
if(doquery) startvaquery(va, );
renderzpass(cur, va);
@@ -1498,7 +1497,7 @@ static void rendergeommultipass(renderstate &cur, int pass, bool fogpass)
{
if(!va->texs) continue;
if(refracting)
- {
+ {
if((refracting < 0 ? va->geommin.z > reflectz : va->geommax.z <= reflectz) || va->occluded >= OCCLUDE_GEOM) continue;
if(ishiddencube(va->o, va->size)) continue;
}
@@ -1529,7 +1528,7 @@ void rendergeom(float causticspass, bool fogpass)
flipqueries();
vtris = vverts = 0;
}
- if(!doZP)
+ if(!doZP)
{
if(shadowmap && mainpass) rendershadowmap();
setupgeom(cur);
@@ -1567,7 +1566,7 @@ void rendergeom(float causticspass, bool fogpass)
va->occluded = pvsoccluded(va->geommin, va->geommax) ? OCCLUDE_GEOM : OCCLUDE_NOTHING;
if(va->occluded >= OCCLUDE_GEOM)
{
- if(va->query)
+ if(va->query)
{
if(!zpass && geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
if(cur.vattribs) disablevattribs(cur, !doZP);
@@ -1596,7 +1595,7 @@ void rendergeom(float causticspass, bool fogpass)
if(!cur.colormask) { cur.colormask = true; glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); }
if(!cur.depthmask) { cur.depthmask = true; glDepthMask(GL_TRUE); }
-
+
bool multipassing = false;
if(doZP)
@@ -1720,7 +1719,7 @@ void renderalphageom(bool fogpass)
{
if(va->geommax.z <= reflectz) continue;
}
- else
+ else
{
if(va->occluded >= OCCLUDE_BB) continue;
if(va->occluded >= OCCLUDE_GEOM && pvsoccluded(va->geommin, va->geommax)) continue;
@@ -1746,7 +1745,7 @@ void renderalphageom(bool fogpass)
if(cur.depthmask) { cur.depthmask = false; glDepthMask(GL_FALSE); }
cur.colormask = true;
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
-
+
if(cur.vattribs) disablevattribs(cur, false);
if(cur.vbuf) disablevbuf(cur);
@@ -1773,7 +1772,7 @@ void renderalphageom(bool fogpass)
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, fading ? GL_FALSE : GL_TRUE);
}
-
+
void findreflectedvas(vector<vtxarray *> &vas, int prevvfc = VFC_PART_VISIBLE)
{
loopv(vas)
@@ -1813,7 +1812,7 @@ void renderreflectedgeom(bool causticspass, bool fogpass)
rendergeom(causticspass ? 1 : 0, fogpass);
}
else rendergeom(causticspass ? 1 : 0, fogpass);
-}
+}
static vtxarray *prevskyva = NULL;
@@ -1855,7 +1854,7 @@ void renderreflectedskyvas(vector<vtxarray *> &vas, int prevvfc = VFC_PART_VISIB
if(prevvfc >= VFC_NOT_VISIBLE) va->curvfc = prevvfc;
if((va->curvfc == VFC_FULL_VISIBLE && va->occluded >= OCCLUDE_BB) || va->curvfc==PVS_FULL_VISIBLE) continue;
if(va->o.z+va->size <= reflectz || ishiddencube(va->o, va->size)) continue;
- if(va->sky+va->explicitsky)
+ if(va->sky+va->explicitsky)
{
updateskystats(va);
renderskyva(va);
@@ -1886,7 +1885,7 @@ bool rendersky(bool explicitonly)
if(prevskyva)
{
- gle::disablevertex();
+ gle::disablevertex();
gle::clearvbo();
gle::clearebo();
}
diff --git a/src/fpsgame/ai.cpp b/src/fpsgame/ai.cpp
index cfe3502..d5045fd 100644
--- a/src/fpsgame/ai.cpp
+++ b/src/fpsgame/ai.cpp
@@ -116,7 +116,7 @@ namespace ai
{
if(lastmillis >= d->ai->lastaimrnd)
{
- const int aiskew[NUMGUNS] = { 1, 10, 50, 5, 20, 1, 100, 10, 10, 10, 1, 1 };
+ const int aiskew[NUMGUNS] = { 1, 10, 50, 5, 20, 1, 100 };
#define rndaioffset(r) ((rnd(int(r*aiskew[d->gunselect]*2)+1)-(r*aiskew[d->gunselect]))*(1.f/float(max(d->skill, 1))))
loopk(3) d->ai->aimrnd[k] = rndaioffset(e->radius);
int dur = (d->skill+10)*10;
@@ -167,7 +167,7 @@ namespace ai
d->ownernum = ocn;
d->plag = 0;
d->skill = sk;
- d->playermodel = chooserandomplayermodel(pm);
+ d->playermodel = 0;
if(resetthisguy) removeweapons(d);
if(d->ownernum >= 0 && player1->clientnum == d->ownernum)
@@ -903,7 +903,7 @@ namespace ai
float radius = 18*18;
loopv(entities::ents) if(entities::ents[i]->type == JUMPPAD)
{
- fpsentity &e = *(fpsentity *)entities::ents[i];
+ extentity &e = *(extentity *)entities::ents[i];
if(e.o.squaredist(pos) <= radius) { jump = false; break; }
}
}
diff --git a/src/fpsgame/aiman.h b/src/fpsgame/aiman.h
index a36118c..120f50b 100644
--- a/src/fpsgame/aiman.h
+++ b/src/fpsgame/aiman.h
@@ -119,7 +119,7 @@ namespace aiman
copystring(ci->name, "bot", MAXNAMELEN+1);
ci->state.state = CS_DEAD;
copystring(ci->team, team, MAXTEAMLEN+1);
- ci->playermodel = rnd(128);
+ ci->playermodel = 0;
ci->aireinit = 2;
ci->connected = true;
dorefresh = true;
diff --git a/src/fpsgame/client.cpp b/src/fpsgame/client.cpp
index 3717a58..55da8d0 100644
--- a/src/fpsgame/client.cpp
+++ b/src/fpsgame/client.cpp
@@ -2,118 +2,11 @@
namespace game
{
- VARP(minradarscale, 0, 384, 10000);
- VARP(maxradarscale, 1, 1024, 10000);
- VARP(radarteammates, 0, 1, 1);
- FVARP(minimapalpha, 0, 1, 1);
-
- float calcradarscale()
- {
- return clamp(max(minimapradius.x, minimapradius.y)/3, float(minradarscale), float(maxradarscale));
- }
-
- void drawminimap(fpsent *d, float x, float y, float s)
- {
- vec pos = vec(d->o).sub(minimapcenter).mul(minimapscale).add(0.5f), dir;
- vecfromyawpitch(camera1->yaw, 0, 1, 0, dir);
- float scale = calcradarscale();
- gle::defvertex(2);
- gle::deftexcoord0();
- gle::begin(GL_TRIANGLE_FAN);
- loopi(16)
- {
- vec v = vec(0, -1, 0).rotate_around_z(i/16.0f*2*M_PI);
- gle::attribf(x + 0.5f*s*(1.0f + v.x), y + 0.5f*s*(1.0f + v.y));
- vec tc = vec(dir).rotate_around_z(i/16.0f*2*M_PI);
- gle::attribf(pos.x + tc.x*scale*minimapscale.x, pos.y + tc.y*scale*minimapscale.y);
- }
- gle::end();
- }
-
- void drawradar(float x, float y, float s)
- {
- gle::defvertex(2);
- gle::deftexcoord0();
- gle::begin(GL_TRIANGLE_STRIP);
- gle::attribf(x, y); gle::attribf(0, 0);
- gle::attribf(x+s, y); gle::attribf(1, 0);
- gle::attribf(x, y+s); gle::attribf(0, 1);
- gle::attribf(x+s, y+s); gle::attribf(1, 1);
- gle::end();
- }
-
- void drawteammate(fpsent *d, float x, float y, float s, fpsent *o, float scale)
- {
- vec dir = d->o;
- dir.sub(o->o).div(scale);
- float dist = dir.magnitude2(), maxdist = 1 - 0.05f - 0.05f;
- if(dist >= maxdist) dir.mul(maxdist/dist);
- dir.rotate_around_z(-camera1->yaw*RAD);
- float bs = 0.06f*s,
- bx = x + s*0.5f*(1.0f + dir.x),
- by = y + s*0.5f*(1.0f + dir.y);
- vec v(-0.5f, -0.5f, 0);
- v.rotate_around_z((90+o->yaw-camera1->yaw)*RAD);
- gle::attribf(bx + bs*v.x, by + bs*v.y); gle::attribf(0, 0);
- gle::attribf(bx + bs*v.y, by - bs*v.x); gle::attribf(1, 0);
- gle::attribf(bx - bs*v.x, by - bs*v.y); gle::attribf(1, 1);
- gle::attribf(bx - bs*v.y, by + bs*v.x); gle::attribf(0, 1);
- }
-
- void drawteammates(fpsent *d, float x, float y, float s)
- {
- if(!radarteammates) return;
- float scale = calcradarscale();
- int alive = 0, dead = 0;
- loopv(players)
- {
- fpsent *o = players[i];
- if(o != d && o->state == CS_ALIVE && isteam(o->team, d->team))
- {
- if(!alive++)
- {
- settexture(isteam(d->team, player1->team) ? "packages/hud/blip_blue_alive.png" : "packages/hud/blip_red_alive.png");
- gle::defvertex(2);
- gle::deftexcoord0();
- gle::begin(GL_QUADS);
- }
- drawteammate(d, x, y, s, o, scale);
- }
- }
- if(alive) gle::end();
- loopv(players)
- {
- fpsent *o = players[i];
- if(o != d && o->state == CS_DEAD && isteam(o->team, d->team))
- {
- if(!dead++)
- {
- settexture(isteam(d->team, player1->team) ? "packages/hud/blip_blue_dead.png" : "packages/hud/blip_red_dead.png");
- gle::defvertex(2);
- gle::deftexcoord0();
- gle::begin(GL_QUADS);
- }
- drawteammate(d, x, y, s, o, scale);
- }
- }
- if(dead) gle::end();
- }
-
- #include "capture.h"
- #include "ctf.h"
- #include "collect.h"
-
clientmode *cmode = NULL;
- captureclientmode capturemode;
- ctfclientmode ctfmode;
- collectclientmode collectmode;
void setclientmode()
{
- if(m_capture) cmode = &capturemode;
- else if(m_ctf) cmode = &ctfmode;
- else if(m_collect) cmode = &collectmode;
- else cmode = NULL;
+ cmode = NULL;
}
bool senditemstoserver = false, sendcrc = false; // after a map change, since server doesn't have map data
@@ -128,7 +21,7 @@ namespace game
void switchname(const char *name)
{
filtertext(player1->name, name, false, false, MAXNAMELEN);
- if(!player1->name[0]) copystring(player1->name, "unnamed");
+ if(!player1->name[0]) copystring(player1->name, "Anonymous");
addmsg(N_SWITCHNAME, "rs", player1->name);
}
void printname()
@@ -160,12 +53,6 @@ namespace game
});
ICOMMAND(getteam, "", (), result(player1->team));
- void switchplayermodel(int playermodel)
- {
- player1->playermodel = playermodel;
- addmsg(N_SWITCHMODEL, "ri", player1->playermodel);
- }
-
struct authkey
{
char *name, *key, *desc;
@@ -292,13 +179,6 @@ namespace game
}
ICOMMAND(getclientteam, "i", (int *cn), result(getclientteam(*cn)));
- int getclientmodel(int cn)
- {
- fpsent *d = getclient(cn);
- return d ? d->playermodel : -1;
- }
- ICOMMAND(getclientmodel, "i", (int *cn), intret(getclientmodel(*cn)));
-
const char *getclienticon(int cn)
{
fpsent *d = getclient(cn);
@@ -411,7 +291,7 @@ namespace game
{
authkey *a = findauthkey(desc);
int vn = parseplayer(victim);
- if(a && vn>=0 && vn!=player1->clientnum)
+ if(a && vn>=0 && vn!=player1->clientnum)
{
a->lastauth = lastmillis;
addmsg(N_AUTHKICK, "rssis", a->desc, a->name, vn, reason);
@@ -442,7 +322,7 @@ namespace game
bool isignored(int cn) { return ignores.find(cn) >= 0; }
ICOMMAND(ignore, "s", (char *arg), ignore(parseplayer(arg)));
- ICOMMAND(unignore, "s", (char *arg), unignore(parseplayer(arg)));
+ ICOMMAND(unignore, "s", (char *arg), unignore(parseplayer(arg)));
ICOMMAND(isignored, "s", (char *arg), intret(isignored(parseplayer(arg)) ? 1 : 0));
void setteam(const char *arg1, const char *arg2)
@@ -472,7 +352,7 @@ namespace game
}
string hash = "";
if(!arg[1] && isdigit(arg[0])) val = parseint(arg);
- else
+ else
{
if(cn != player1->clientnum) return;
server::hashpassword(player1->clientnum, sessionid, arg, hash);
@@ -541,7 +421,7 @@ namespace game
}
ICOMMAND(mode, "i", (int *val), setmode(*val));
ICOMMAND(getmode, "", (), intret(gamemode));
- ICOMMAND(timeremaining, "i", (int *formatted),
+ ICOMMAND(timeremaining, "i", (int *formatted),
{
int val = max(maplimit - lastmillis + 999, 0)/1000;
if(*formatted)
@@ -554,21 +434,11 @@ namespace game
ICOMMANDS("m_noitems", "i", (int *mode), { int gamemode = *mode; intret(m_noitems); });
ICOMMANDS("m_noammo", "i", (int *mode), { int gamemode = *mode; intret(m_noammo); });
ICOMMANDS("m_insta", "i", (int *mode), { int gamemode = *mode; intret(m_insta); });
- ICOMMANDS("m_tactics", "i", (int *mode), { int gamemode = *mode; intret(m_tactics); });
ICOMMANDS("m_efficiency", "i", (int *mode), { int gamemode = *mode; intret(m_efficiency); });
- ICOMMANDS("m_capture", "i", (int *mode), { int gamemode = *mode; intret(m_capture); });
- ICOMMANDS("m_regencapture", "i", (int *mode), { int gamemode = *mode; intret(m_regencapture); });
- ICOMMANDS("m_ctf", "i", (int *mode), { int gamemode = *mode; intret(m_ctf); });
- ICOMMANDS("m_protect", "i", (int *mode), { int gamemode = *mode; intret(m_protect); });
- ICOMMANDS("m_hold", "i", (int *mode), { int gamemode = *mode; intret(m_hold); });
- ICOMMANDS("m_collect", "i", (int *mode), { int gamemode = *mode; intret(m_collect); });
ICOMMANDS("m_teammode", "i", (int *mode), { int gamemode = *mode; intret(m_teammode); });
ICOMMANDS("m_demo", "i", (int *mode), { int gamemode = *mode; intret(m_demo); });
ICOMMANDS("m_edit", "i", (int *mode), { int gamemode = *mode; intret(m_edit); });
ICOMMANDS("m_lobby", "i", (int *mode), { int gamemode = *mode; intret(m_lobby); });
- ICOMMANDS("m_sp", "i", (int *mode), { int gamemode = *mode; intret(m_sp); });
- ICOMMANDS("m_dmsp", "i", (int *mode), { int gamemode = *mode; intret(m_dmsp); });
- ICOMMANDS("m_classicsp", "i", (int *mode), { int gamemode = *mode; intret(m_classicsp); });
void changemap(const char *name, int mode) // request map change, server may ignore
{
@@ -737,7 +607,7 @@ namespace game
int val = *id->storage.i;
string str;
if(val < 0)
- formatstring(str, "%d", val);
+ formatstring(str, "%d", val);
else if(id->flags&IDF_HEX && id->maxval==0xFFFFFF)
formatstring(str, "0x%.6X (%d, %d, %d)", val, (val>>16)&0xFF, (val>>8)&0xFF, val&0xFF);
else
@@ -783,10 +653,10 @@ namespace game
}
ICOMMAND(pausegame, "i", (int *val), pausegame(*val > 0));
ICOMMAND(paused, "iN$", (int *val, int *numargs, ident *id),
- {
- if(*numargs > 0) pausegame(clampvar(id, *val, 0, 1) > 0);
+ {
+ if(*numargs > 0) pausegame(clampvar(id, *val, 0, 1) > 0);
else if(*numargs < 0) intret(gamepaused ? 1 : 0);
- else printvar(id, gamepaused ? 1 : 0);
+ else printvar(id, gamepaused ? 1 : 0);
});
bool ispaused() { return gamepaused; }
@@ -1291,7 +1161,7 @@ namespace game
gamepaused = val;
player1->attacking = false;
}
- if(a) conoutf("%s %s the game", colorname(a), val ? "paused" : "resumed");
+ if(a) conoutf("%s %s the game", colorname(a), val ? "paused" : "resumed");
else conoutf("game is %s", val ? "paused" : "resumed");
break;
}
@@ -1302,12 +1172,11 @@ namespace game
fpsent *a = cn >= 0 ? getclient(cn) : NULL;
if(!demopacket) gamespeed = val;
extern int slowmosp;
- if(m_sp && slowmosp) break;
if(a) conoutf("%s set gamespeed to %d", colorname(a), val);
else conoutf("gamespeed is %d", val);
break;
}
-
+
case N_CLIENT:
{
int cn = getint(p), len = getuint(p);
@@ -1396,7 +1265,7 @@ namespace game
}
getstring(text, p);
filtertext(text, text, false, false, MAXNAMELEN);
- if(!text[0]) copystring(text, "unnamed");
+ if(!text[0]) copystring(text, "Anonymous");
if(d->name[0]) // already connected
{
if(strcmp(d->name, text) && !isignored(d->clientnum))
@@ -1411,6 +1280,7 @@ namespace game
getstring(text, p);
filtertext(d->team, text, false, false, MAXTEAMLEN);
d->playermodel = getint(p);
+ d->playermodel = 0;
break;
}
@@ -1419,7 +1289,7 @@ namespace game
if(d)
{
filtertext(text, text, false, false, MAXNAMELEN);
- if(!text[0]) copystring(text, "unnamed");
+ if(!text[0]) copystring(text, "Anonymous");
if(strcmp(text, d->name))
{
if(!isignored(d->clientnum)) conoutf("%s is now known as %s", colorname(d), colorname(d, text));
@@ -1433,7 +1303,7 @@ namespace game
int model = getint(p);
if(d)
{
- d->playermodel = model;
+ d->playermodel = 0;
if(d->ragdoll) cleanragdoll(d);
}
break;
@@ -1884,12 +1754,6 @@ namespace game
break;
}
- #define PARSEMESSAGES 1
- #include "capture.h"
- #include "ctf.h"
- #include "collect.h"
- #undef PARSEMESSAGES
-
case N_ANNOUNCE:
{
int t = getint(p);
diff --git a/src/fpsgame/entities.cpp b/src/fpsgame/entities.cpp
index c35a0d1..f199c11 100644
--- a/src/fpsgame/entities.cpp
+++ b/src/fpsgame/entities.cpp
@@ -14,27 +14,10 @@ namespace entities
{
if(ver <= 30) switch(e.type)
{
- case FLAG:
- case MONSTER:
case TELEDEST:
- case RESPAWNPOINT:
- case BOX:
- case BARREL:
- case PLATFORM:
- case ELEVATOR:
e.attr1 = (int(e.attr1)+180)%360;
break;
}
- if(ver <= 31) switch(e.type)
- {
- case BOX:
- case BARREL:
- case PLATFORM:
- case ELEVATOR:
- int yaw = (int(e.attr1)%360 + 360)%360 + 7;
- e.attr1 = yaw - yaw%15;
- break;
- }
}
#ifndef STANDALONE
@@ -99,9 +82,6 @@ namespace entities
case I_HEALTH: case I_BOOST: case I_GREENARMOUR: case I_YELLOWARMOUR: case I_QUAD:
if(m_noitems) continue;
break;
- case CARROT: case RESPAWNPOINT:
- if(!m_classicsp) continue;
- break;
}
const char *mdl = entmdlname(i);
if(!mdl) continue;
@@ -129,10 +109,6 @@ namespace entities
int revs = 10;
switch(e.type)
{
- case CARROT:
- case RESPAWNPOINT:
- if(e.attr2) revs = 1;
- break;
case TELEPORT:
if(e.attr2 < 0) continue;
break;
@@ -204,7 +180,7 @@ namespace entities
if(ents.inrange(tp) && ents[tp]->type == TELEPORT)
{
extentity &e = *ents[tp];
- if(e.attr4 >= 0)
+ if(e.attr4 >= 0)
{
int snd = S_TELEPORT, flags = 0;
if(e.attr4 > 0) { snd = e.attr4; flags = SND_MAP; }
@@ -307,13 +283,6 @@ namespace entities
break;
}
- case RESPAWNPOINT:
- if(!m_classicsp || d!=player1 || n==respawnent) break;
- respawnent = n;
- conoutf(CON_GAMEINFO, "\f2respawn point set!");
- playsound(S_V_RESPAWNPOINT);
- break;
-
case JUMPPAD:
{
if(d->lastpickup==e->type && lastmillis-d->lastpickupmillis<300) break;
@@ -339,7 +308,7 @@ namespace entities
{
extentity &e = *ents[i];
if(e.type==NOTUSED) continue;
- if((!e.spawned() || e.nopickup()) && e.type!=TELEPORT && e.type!=JUMPPAD && e.type!=RESPAWNPOINT) continue;
+ if((!e.spawned() || e.nopickup()) && e.type!=TELEPORT && e.type!=JUMPPAD) continue;
float dist = e.o.dist(o);
if(dist<(e.type==TELEPORT ? 16 : 12)) trypickup(i, d);
}
@@ -377,7 +346,7 @@ namespace entities
extentity *e = ents[i];
if(e->type>=I_SHELLS && e->type<=I_QUAD && (!m_noammo || e->type<I_SHELLS || e->type>I_CARTRIDGES))
{
- e->setspawned(force || m_sp || !server::delayspawn(e->type));
+ e->setspawned(force || !server::delayspawn(e->type));
e->clearnopickup();
}
}
@@ -385,244 +354,17 @@ namespace entities
void setspawn(int i, bool on) { if(ents.inrange(i)) { extentity *e = ents[i]; e->setspawned(on); e->clearnopickup(); } }
- extentity *newentity() { return new fpsentity(); }
- void deleteentity(extentity *e) { delete (fpsentity *)e; }
+ extentity *newentity() { return new extentity(); }
+ void deleteentity(extentity *e) { delete e; }
void clearents()
{
while(ents.length()) deleteentity(ents.pop());
}
- enum
- {
- TRIG_COLLIDE = 1<<0,
- TRIG_TOGGLE = 1<<1,
- TRIG_ONCE = 0<<2,
- TRIG_MANY = 1<<2,
- TRIG_DISAPPEAR = 1<<3,
- TRIG_AUTO_RESET = 1<<4,
- TRIG_RUMBLE = 1<<5,
- TRIG_LOCKED = 1<<6,
- TRIG_ENDSP = 1<<7
- };
-
- static const int NUMTRIGGERTYPES = 32;
-
- static const int triggertypes[NUMTRIGGERTYPES] =
- {
- -1,
- TRIG_ONCE, // 1
- TRIG_RUMBLE, // 2
- TRIG_TOGGLE, // 3
- TRIG_TOGGLE | TRIG_RUMBLE, // 4
- TRIG_MANY, // 5
- TRIG_MANY | TRIG_RUMBLE, // 6
- TRIG_MANY | TRIG_TOGGLE, // 7
- TRIG_MANY | TRIG_TOGGLE | TRIG_RUMBLE, // 8
- TRIG_COLLIDE | TRIG_TOGGLE | TRIG_RUMBLE, // 9
- TRIG_COLLIDE | TRIG_TOGGLE | TRIG_AUTO_RESET | TRIG_RUMBLE, // 10
- TRIG_COLLIDE | TRIG_TOGGLE | TRIG_LOCKED | TRIG_RUMBLE, // 11
- TRIG_DISAPPEAR, // 12
- TRIG_DISAPPEAR | TRIG_RUMBLE, // 13
- TRIG_DISAPPEAR | TRIG_COLLIDE | TRIG_LOCKED, // 14
- -1 /* reserved 15 */,
- -1 /* reserved 16 */,
- -1 /* reserved 17 */,
- -1 /* reserved 18 */,
- -1 /* reserved 19 */,
- -1 /* reserved 20 */,
- -1 /* reserved 21 */,
- -1 /* reserved 22 */,
- -1 /* reserved 23 */,
- -1 /* reserved 24 */,
- -1 /* reserved 25 */,
- -1 /* reserved 26 */,
- -1 /* reserved 27 */,
- -1 /* reserved 28 */,
- TRIG_DISAPPEAR | TRIG_RUMBLE | TRIG_ENDSP, // 29
- -1 /* reserved 30 */,
- -1 /* reserved 31 */,
- };
-
- #define validtrigger(type) (triggertypes[(type) & (NUMTRIGGERTYPES-1)]>=0)
- #define checktriggertype(type, flag) (triggertypes[(type) & (NUMTRIGGERTYPES-1)] & (flag))
-
- static inline void cleartriggerflags(extentity &e)
- {
- e.flags &= ~(EF_ANIM | EF_NOVIS | EF_NOSHADOW | EF_NOCOLLIDE);
- }
-
- static inline void setuptriggerflags(fpsentity &e)
- {
- cleartriggerflags(e);
- e.flags |= EF_ANIM;
- if(checktriggertype(e.attr3, TRIG_COLLIDE|TRIG_DISAPPEAR)) e.flags |= EF_NOSHADOW;
- if(!checktriggertype(e.attr3, TRIG_COLLIDE)) e.flags |= EF_NOCOLLIDE;
- switch(e.triggerstate)
- {
- case TRIGGERING:
- if(checktriggertype(e.attr3, TRIG_COLLIDE) && lastmillis-e.lasttrigger >= 500) e.flags |= EF_NOCOLLIDE;
- break;
- case TRIGGERED:
- if(checktriggertype(e.attr3, TRIG_COLLIDE)) e.flags |= EF_NOCOLLIDE;
- break;
- case TRIGGER_DISAPPEARED:
- e.flags |= EF_NOVIS | EF_NOCOLLIDE;
- break;
- }
- }
-
- void resettriggers()
- {
- loopv(ents)
- {
- fpsentity &e = *(fpsentity *)ents[i];
- if(e.type != ET_MAPMODEL || !validtrigger(e.attr3)) continue;
- e.triggerstate = TRIGGER_RESET;
- e.lasttrigger = 0;
- setuptriggerflags(e);
- }
- }
-
- void unlocktriggers(int tag, int oldstate = TRIGGER_RESET, int newstate = TRIGGERING)
- {
- loopv(ents)
- {
- fpsentity &e = *(fpsentity *)ents[i];
- if(e.type != ET_MAPMODEL || !validtrigger(e.attr3)) continue;
- if(e.attr4 == tag && e.triggerstate == oldstate && checktriggertype(e.attr3, TRIG_LOCKED))
- {
- if(newstate == TRIGGER_RESETTING && checktriggertype(e.attr3, TRIG_COLLIDE) && overlapsdynent(e.o, 20)) continue;
- e.triggerstate = newstate;
- e.lasttrigger = lastmillis;
- if(checktriggertype(e.attr3, TRIG_RUMBLE)) playsound(S_RUMBLE, &e.o);
- }
- }
- }
-
- ICOMMAND(trigger, "ii", (int *tag, int *state),
- {
- if(*state) unlocktriggers(*tag);
- else unlocktriggers(*tag, TRIGGERED, TRIGGER_RESETTING);
- });
-
- VAR(triggerstate, -1, 0, 1);
-
- void doleveltrigger(int trigger, int state)
- {
- defformatstring(aliasname, "level_trigger_%d", trigger);
- if(identexists(aliasname))
- {
- triggerstate = state;
- execident(aliasname);
- }
- }
-
- void checktriggers()
- {
- if(player1->state != CS_ALIVE) return;
- vec o = player1->feetpos();
- loopv(ents)
- {
- fpsentity &e = *(fpsentity *)ents[i];
- if(e.type != ET_MAPMODEL || !validtrigger(e.attr3)) continue;
- switch(e.triggerstate)
- {
- case TRIGGERING:
- case TRIGGER_RESETTING:
- if(lastmillis-e.lasttrigger>=1000)
- {
- if(e.attr4)
- {
- if(e.triggerstate == TRIGGERING) unlocktriggers(e.attr4);
- else unlocktriggers(e.attr4, TRIGGERED, TRIGGER_RESETTING);
- }
- if(checktriggertype(e.attr3, TRIG_DISAPPEAR)) e.triggerstate = TRIGGER_DISAPPEARED;
- else if(e.triggerstate==TRIGGERING && checktriggertype(e.attr3, TRIG_TOGGLE)) e.triggerstate = TRIGGERED;
- else e.triggerstate = TRIGGER_RESET;
- }
- setuptriggerflags(e);
- break;
- case TRIGGER_RESET:
- if(e.lasttrigger)
- {
- if(checktriggertype(e.attr3, TRIG_AUTO_RESET|TRIG_MANY|TRIG_LOCKED) && e.o.dist(o)-player1->radius>=(checktriggertype(e.attr3, TRIG_COLLIDE) ? 20 : 12))
- e.lasttrigger = 0;
- break;
- }
- else if(e.o.dist(o)-player1->radius>=(checktriggertype(e.attr3, TRIG_COLLIDE) ? 20 : 12)) break;
- else if(checktriggertype(e.attr3, TRIG_LOCKED))
- {
- if(!e.attr4) break;
- doleveltrigger(e.attr4, -1);
- e.lasttrigger = lastmillis;
- break;
- }
- e.triggerstate = TRIGGERING;
- e.lasttrigger = lastmillis;
- setuptriggerflags(e);
- if(checktriggertype(e.attr3, TRIG_RUMBLE)) playsound(S_RUMBLE, &e.o);
- if(checktriggertype(e.attr3, TRIG_ENDSP)) endsp(false);
- if(e.attr4) doleveltrigger(e.attr4, 1);
- break;
- case TRIGGERED:
- if(e.o.dist(o)-player1->radius<(checktriggertype(e.attr3, TRIG_COLLIDE) ? 20 : 12))
- {
- if(e.lasttrigger) break;
- }
- else if(checktriggertype(e.attr3, TRIG_AUTO_RESET))
- {
- if(lastmillis-e.lasttrigger<6000) break;
- }
- else if(checktriggertype(e.attr3, TRIG_MANY))
- {
- e.lasttrigger = 0;
- break;
- }
- else break;
- if(checktriggertype(e.attr3, TRIG_COLLIDE) && overlapsdynent(e.o, 20)) break;
- e.triggerstate = TRIGGER_RESETTING;
- e.lasttrigger = lastmillis;
- setuptriggerflags(e);
- if(checktriggertype(e.attr3, TRIG_RUMBLE)) playsound(S_RUMBLE, &e.o);
- if(checktriggertype(e.attr3, TRIG_ENDSP)) endsp(false);
- if(e.attr4) doleveltrigger(e.attr4, 0);
- break;
- }
- }
- }
-
- void animatemapmodel(const extentity &e, int &anim, int &basetime)
- {
- const fpsentity &f = (const fpsentity &)e;
- if(validtrigger(f.attr3)) switch(f.triggerstate)
- {
- case TRIGGER_RESET: anim = ANIM_TRIGGER|ANIM_START; break;
- case TRIGGERING: anim = ANIM_TRIGGER; basetime = f.lasttrigger; break;
- case TRIGGERED: anim = ANIM_TRIGGER|ANIM_END; break;
- case TRIGGER_RESETTING: anim = ANIM_TRIGGER|ANIM_REVERSE; basetime = f.lasttrigger; break;
- }
- }
-
void fixentity(extentity &e)
{
- switch(e.type)
- {
- case FLAG:
- case BOX:
- case BARREL:
- case PLATFORM:
- case ELEVATOR:
- e.attr5 = e.attr4;
- e.attr4 = e.attr3;
- case TELEDEST:
- e.attr3 = e.attr2;
- case MONSTER:
- e.attr2 = e.attr1;
- case RESPAWNPOINT:
- e.attr1 = (int)player1->yaw;
- break;
- }
+ if(e.type == TELEDEST) e.attr3 = e.attr2;
}
void entradius(extentity &e, bool color)
@@ -641,23 +383,7 @@ namespace entities
renderentarrow(e, vec((int)(char)e.attr3*10.0f, (int)(char)e.attr2*10.0f, e.attr1*12.5f).normalize(), 4);
break;
- case FLAG:
- case MONSTER:
- case TELEDEST:
- case RESPAWNPOINT:
- case BOX:
- case BARREL:
- case PLATFORM:
- case ELEVATOR:
- {
- vec dir;
- vecfromyawpitch(e.attr1, 0, 1, 0, dir);
- renderentarrow(e, dir, 4);
- break;
- }
- case MAPMODEL:
- if(validtrigger(e.attr3)) renderentring(e, checktriggertype(e.attr3, TRIG_COLLIDE) ? 20 : 12);
- break;
+ default: break;
}
}
@@ -675,11 +401,7 @@ namespace entities
"shells", "bullets", "rockets", "riflerounds", "grenades", "cartridges",
"health", "healthboost", "greenarmour", "yellowarmour", "quaddamage",
"teleport", "teledest",
- "monster", "carrot", "jumppad",
- "base", "respawnpoint",
- "box", "barrel",
- "platform", "elevator",
- "flag",
+ "jumppad",
"", "", "", "",
};
return i>=0 && size_t(i)<sizeof(entnames)/sizeof(entnames[0]) ? entnames[i] : "";
@@ -688,22 +410,9 @@ namespace entities
void editent(int i, bool local)
{
extentity &e = *ents[i];
- if(e.type == ET_MAPMODEL && validtrigger(e.attr3))
- {
- fpsentity &f = (fpsentity &)e;
- f.triggerstate = TRIGGER_RESET;
- f.lasttrigger = 0;
- setuptriggerflags(f);
- }
- else cleartriggerflags(e);
if(local) addmsg(N_EDITENT, "rii3ii5", i, (int)(e.o.x*DMF), (int)(e.o.y*DMF), (int)(e.o.z*DMF), e.type, e.attr1, e.attr2, e.attr3, e.attr4, e.attr5);
}
- float dropheight(entity &e)
- {
- if(e.type==BASE || e.type==FLAG) return 0.0f;
- return 4.0f;
- }
#endif
}
diff --git a/src/fpsgame/fps.cpp b/src/fpsgame/fps.cpp
index 04b036f..f5ce95c 100644
--- a/src/fpsgame/fps.cpp
+++ b/src/fpsgame/fps.cpp
@@ -70,12 +70,6 @@ namespace game
void resetgamestate()
{
- if(m_classicsp)
- {
- clearmovables();
- clearmonsters(); // all monsters back at their spawns for editing
- entities::resettriggers();
- }
clearprojectiles();
clearbouncers();
}
@@ -222,8 +216,6 @@ namespace game
}
}
- VARFP(slowmosp, 0, 0, 1, { if(m_sp && !slowmosp) server::forcegamespeed(100); });
-
void checkslowmo()
{
static int lastslowmohealth = 0;
@@ -251,8 +243,6 @@ namespace game
ai::update();
moveragdolls();
gets2c();
- updatemovables(curtime);
- updatemonsters(curtime);
if(connected)
{
if(player1->state == CS_DEAD)
@@ -270,12 +260,7 @@ namespace game
moveplayer(player1, 10, true);
swayhudgun(curtime);
entities::checkitems(player1);
- if(m_sp)
- {
- if(slowmosp) checkslowmo();
- if(m_classicsp) entities::checktriggers();
- }
- else if(cmode) cmode->checkitems(player1);
+ if(cmode) cmode->checkitems(player1);
}
}
if(player1->clientnum>=0) c2sinfo(); // do this last, to reduce the effective frame lag
@@ -323,7 +308,7 @@ namespace game
void pickgamespawn(fpsent *d)
{
- int ent = m_classicsp && d == player1 && respawnent >= 0 ? respawnent : -1;
+ int ent = d == player1 && respawnent >= 0 ? respawnent : -1;
int tag = cmode ? cmode->getspawngroup(d) : 0;
findplayerspawn(d, ent, tag);
}
@@ -355,13 +340,7 @@ namespace game
return;
}
if(lastmillis < player1->lastpain + spawnwait) return;
- if(m_dmsp) { changemap(clientmap, gamemode); return; } // if we die in SP we try the same map again
respawnself();
- if(m_classicsp)
- {
- conoutf(CON_GAMEINFO, "\f2You wasted another life! The monsters stole your armour and some ammo...");
- loopi(NUMGUNS) if(i!=GUN_PISTOL && (player1->ammo[i] = savedammo[i]) > 5) player1->ammo[i] = max(player1->ammo[i]/3, 5);
- }
}
}
COMMAND(respawn, "");
@@ -413,9 +392,7 @@ namespace game
}
damageeffect(damage, d, d!=h);
- ai::damaged(d, actor);
-
- if(m_sp && slowmosp && d==player1 && d->health < 1) d->health = 1;
+ ai::damaged(d, actor);
if(d->health<=0) { if(local) killed(d, actor); }
else if(d==h) playsound(S_PAIN6);
@@ -514,12 +491,9 @@ namespace game
if(cmode) cmode->gameover();
conoutf(CON_GAMEINFO, "\f2intermission:");
conoutf(CON_GAMEINFO, "\f2game has ended!");
- if(m_ctf) conoutf(CON_GAMEINFO, "\f2player frags: %d, flags: %d, deaths: %d", player1->frags, player1->flags, player1->deaths);
- else if(m_collect) conoutf(CON_GAMEINFO, "\f2player frags: %d, skulls: %d, deaths: %d", player1->frags, player1->flags, player1->deaths);
- else conoutf(CON_GAMEINFO, "\f2player frags: %d, deaths: %d", player1->frags, player1->deaths);
+ conoutf(CON_GAMEINFO, "\f2player frags: %d, deaths: %d", player1->frags, player1->deaths);
int accuracy = (player1->totaldamage*100)/max(player1->totalshots, 1);
conoutf(CON_GAMEINFO, "\f2player total damage dealt: %d, damage wasted: %d, accuracy(%%): %d", player1->totaldamage, player1->totalshots-player1->totaldamage, accuracy);
- if(m_sp) spsummary(accuracy);
showscores(true);
disablezoom();
@@ -593,7 +567,7 @@ namespace game
void initclient()
{
player1 = spawnstate(new fpsent);
- filtertext(player1->name, "unnamed", false, false, MAXNAMELEN);
+ filtertext(player1->name, "Anonymous", false, false, MAXNAMELEN);
players.add(player1);
}
@@ -601,9 +575,6 @@ namespace game
void startgame()
{
- clearmovables();
- clearmonsters();
-
clearprojectiles();
clearbouncers();
clearragdolls();
@@ -637,19 +608,8 @@ namespace game
conoutf(CON_GAMEINFO, "\f2game mode is %s", server::modename(gamemode));
- if(m_sp)
- {
- defformatstring(scorename, "bestscore_%s", getclientmap());
- const char *best = getalias(scorename);
- if(*best) conoutf(CON_GAMEINFO, "\f2try to beat your best score so far: %s", best);
- }
- else
- {
- const char *info = m_valid(gamemode) ? gamemodes[gamemode - STARTGAMEMODE].info : NULL;
- if(showmodeinfo && info) conoutf(CON_GAMEINFO, "\f0%s", info);
- }
-
- if(player1->playermodel != playermodel) switchplayermodel(playermodel);
+ const char *info = m_valid(gamemode) ? gamemodes[gamemode - STARTGAMEMODE].info : NULL;
+ if(showmodeinfo && info) conoutf(CON_GAMEINFO, "\f0%s", info);
showscores(false);
disablezoom();
@@ -698,11 +658,7 @@ namespace game
void dynentcollide(physent *d, physent *o, const vec &dir)
{
- switch(d->type)
- {
- case ENT_AI: if(dir.z > 0) stackmonster((monster *)d, o); break;
- case ENT_INANIMATE: if(dir.z > 0) stackmovable((movable *)d, o); break;
- }
+ return;
}
void msgsound(int n, physent *d)
@@ -720,15 +676,12 @@ namespace game
}
}
- int numdynents() { return players.length()+monsters.length()+movables.length(); }
+ int numdynents() { return players.length(); }
dynent *iterdynents(int i)
{
if(i<players.length()) return players[i];
i -= players.length();
- if(i<monsters.length()) return (dynent *)monsters[i];
- i -= monsters.length();
- if(i<movables.length()) return (dynent *)movables[i];
return NULL;
}
@@ -803,13 +756,9 @@ namespace game
if(pl->suicided!=seq) { addmsg(N_SUICIDE, "rc", pl); pl->suicided = seq; }
}
}
- else if(d->type==ENT_AI) suicidemonster((monster *)d);
- else if(d->type==ENT_INANIMATE) suicidemovable((movable *)d);
}
ICOMMAND(suicide, "", (), suicide(player1));
- bool needminimap() { return m_ctf || m_protect || m_hold || m_capture || m_collect; }
-
void drawicon(int icon, float x, float y, float sz)
{
settexture("packages/hud/items.png");
@@ -1087,7 +1036,7 @@ namespace game
if(ammobar) drawammobar(w, h, d);
}
- if(!m_edit && !m_sp)
+ if(!m_edit)
{
if(gameclock) drawgameclock(w, h);
if(hudscore) drawhudscore(w, h);
diff --git a/src/fpsgame/game.h b/src/fpsgame/game.h
index 9c4cb16..db1d394 100644
--- a/src/fpsgame/game.h
+++ b/src/fpsgame/game.h
@@ -36,38 +36,12 @@ enum // static entity types
I_QUAD,
TELEPORT, // attr1 = idx, attr2 = model, attr3 = tag
TELEDEST, // attr1 = angle, attr2 = idx
- MONSTER, // attr1 = angle, attr2 = monstertype
- CARROT, // attr1 = tag, attr2 = type
JUMPPAD, // attr1 = zpush, attr2 = ypush, attr3 = xpush
- BASE,
- RESPAWNPOINT,
- BOX, // attr1 = angle, attr2 = idx, attr3 = weight
- BARREL, // attr1 = angle, attr2 = idx, attr3 = weight, attr4 = health
- PLATFORM, // attr1 = angle, attr2 = idx, attr3 = tag, attr4 = speed
- ELEVATOR, // attr1 = angle, attr2 = idx, attr3 = tag, attr4 = speed
- FLAG, // attr1 = angle, attr2 = team
MAXENTTYPES
};
-enum
-{
- TRIGGER_RESET = 0,
- TRIGGERING,
- TRIGGERED,
- TRIGGER_RESETTING,
- TRIGGER_DISAPPEARED
-};
-
-struct fpsentity : extentity
-{
- int triggerstate, lasttrigger;
-
- fpsentity() : triggerstate(TRIGGER_RESET), lasttrigger(0) {}
-};
-
-enum { GUN_FIST = 0, GUN_SG, GUN_CG, GUN_RL, GUN_RIFLE, GUN_GL, GUN_PISTOL, GUN_FIREBALL, GUN_ICEBALL, GUN_SLIMEBALL, GUN_BITE, GUN_BARREL, NUMGUNS };
+enum { GUN_FIST = 0, GUN_SG, GUN_CG, GUN_RL, GUN_RIFLE, GUN_GL, GUN_PISTOL, NUMGUNS };
enum { A_BLUE, A_GREEN, A_YELLOW }; // armour types... take 20/40/60 % off
-enum { M_NONE = 0, M_SEARCH, M_HOME, M_ATTACKING, M_PAIN, M_SLEEP, M_AIMING }; // monster states
enum
{
@@ -76,20 +50,10 @@ enum
M_NOAMMO = 1<<2,
M_INSTA = 1<<3,
M_EFFICIENCY = 1<<4,
- M_TACTICS = 1<<5,
- M_CAPTURE = 1<<6,
- M_REGEN = 1<<7,
- M_CTF = 1<<8,
- M_PROTECT = 1<<9,
- M_HOLD = 1<<10,
M_EDIT = 1<<12,
M_DEMO = 1<<13,
M_LOCAL = 1<<14,
- M_LOBBY = 1<<15,
- M_DMSP = 1<<16,
- M_CLASSICSP = 1<<17,
- M_SLOWMO = 1<<18,
- M_COLLECT = 1<<19
+ M_LOBBY = 1<<15
};
static struct gamemodeinfo
@@ -99,8 +63,6 @@ static struct gamemodeinfo
const char *info;
} gamemodes[] =
{
- { "SP", M_LOCAL | M_CLASSICSP, NULL },
- { "DMSP", M_LOCAL | M_DMSP, NULL },
{ "demo", M_DEMO | M_LOCAL, NULL},
{ "ffa", M_LOBBY, "Free For All: Collect items for ammo. Frag everyone to score points." },
{ "coop edit", M_EDIT, "Cooperative Editing: Edit maps with multiple players simultaneously." },
@@ -109,25 +71,9 @@ static struct gamemodeinfo
{ "insta team", M_NOITEMS | M_INSTA | M_TEAM, "Instagib Team: You spawn with full rifle ammo and die instantly from one shot. There are no items. Frag \fs\f3the enemy team\fr to score points for \fs\f1your team\fr." },
{ "efficiency", M_NOITEMS | M_EFFICIENCY, "Efficiency: You spawn with all weapons and armour. There are no items. Frag everyone to score points." },
{ "effic team", M_NOITEMS | M_EFFICIENCY | M_TEAM, "Efficiency Team: You spawn with all weapons and armour. There are no items. Frag \fs\f3the enemy team\fr to score points for \fs\f1your team\fr." },
- { "tactics", M_NOITEMS | M_TACTICS, "Tactics: You spawn with two random weapons and armour. There are no items. Frag everyone to score points." },
- { "tac team", M_NOITEMS | M_TACTICS | M_TEAM, "Tactics Team: You spawn with two random weapons and armour. There are no items. Frag \fs\f3the enemy team\fr to score points for \fs\f1your team\fr." },
- { "capture", M_NOAMMO | M_TACTICS | M_CAPTURE | M_TEAM, "Capture: Capture neutral bases or steal \fs\f3enemy bases\fr by standing next to them. \fs\f1Your team\fr scores points for every 10 seconds it holds a base. You spawn with two random weapons and armour. Collect extra ammo that spawns at \fs\f1your bases\fr. There are no ammo items." },
- { "regen capture", M_NOITEMS | M_CAPTURE | M_REGEN | M_TEAM, "Regen Capture: Capture neutral bases or steal \fs\f3enemy bases\fr by standing next to them. \fs\f1Your team\fr scores points for every 10 seconds it holds a base. Regenerate health and ammo by standing next to \fs\f1your bases\fr. There are no items." },
- { "ctf", M_CTF | M_TEAM, "Capture The Flag: Capture \fs\f3the enemy flag\fr and bring it back to \fs\f1your flag\fr to score points for \fs\f1your team\fr. Collect items for ammo." },
- { "insta ctf", M_NOITEMS | M_INSTA | M_CTF | M_TEAM, "Instagib Capture The Flag: Capture \fs\f3the enemy flag\fr and bring it back to \fs\f1your flag\fr to score points for \fs\f1your team\fr. You spawn with full rifle ammo and die instantly from one shot. There are no items." },
- { "protect", M_CTF | M_PROTECT | M_TEAM, "Protect The Flag: Touch \fs\f3the enemy flag\fr to score points for \fs\f1your team\fr. Pick up \fs\f1your flag\fr to protect it. \fs\f1Your team\fr loses points if a dropped flag resets. Collect items for ammo." },
- { "insta protect", M_NOITEMS | M_INSTA | M_CTF | M_PROTECT | M_TEAM, "Instagib Protect The Flag: Touch \fs\f3the enemy flag\fr to score points for \fs\f1your team\fr. Pick up \fs\f1your flag\fr to protect it. \fs\f1Your team\fr loses points if a dropped flag resets. You spawn with full rifle ammo and die instantly from one shot. There are no items." },
- { "hold", M_CTF | M_HOLD | M_TEAM, "Hold The Flag: Hold \fs\f7the flag\fr for 20 seconds to score points for \fs\f1your team\fr. Collect items for ammo." },
- { "insta hold", M_NOITEMS | M_INSTA | M_CTF | M_HOLD | M_TEAM, "Instagib Hold The Flag: Hold \fs\f7the flag\fr for 20 seconds to score points for \fs\f1your team\fr. You spawn with full rifle ammo and die instantly from one shot. There are no items." },
- { "effic ctf", M_NOITEMS | M_EFFICIENCY | M_CTF | M_TEAM, "Efficiency Capture The Flag: Capture \fs\f3the enemy flag\fr and bring it back to \fs\f1your flag\fr to score points for \fs\f1your team\fr. You spawn with all weapons and armour. There are no items." },
- { "effic protect", M_NOITEMS | M_EFFICIENCY | M_CTF | M_PROTECT | M_TEAM, "Efficiency Protect The Flag: Touch \fs\f3the enemy flag\fr to score points for \fs\f1your team\fr. Pick up \fs\f1your flag\fr to protect it. \fs\f1Your team\fr loses points if a dropped flag resets. You spawn with all weapons and armour. There are no items." },
- { "effic hold", M_NOITEMS | M_EFFICIENCY | M_CTF | M_HOLD | M_TEAM, "Efficiency Hold The Flag: Hold \fs\f7the flag\fr for 20 seconds to score points for \fs\f1your team\fr. You spawn with all weapons and armour. There are no items." },
- { "collect", M_COLLECT | M_TEAM, "Skull Collector: Frag \fs\f3the enemy team\fr to drop \fs\f3skulls\fr. Collect them and bring them to \fs\f3the enemy base\fr to score points for \fs\f1your team\fr or steal back \fs\f1your skulls\fr. Collect items for ammo." },
- { "insta collect", M_NOITEMS | M_INSTA | M_COLLECT | M_TEAM, "Instagib Skull Collector: Frag \fs\f3the enemy team\fr to drop \fs\f3skulls\fr. Collect them and bring them to \fs\f3the enemy base\fr to score points for \fs\f1your team\fr or steal back \fs\f1your skulls\fr. You spawn with full rifle ammo and die instantly from one shot. There are no items." },
- { "effic collect", M_NOITEMS | M_EFFICIENCY | M_COLLECT | M_TEAM, "Efficiency Skull Collector: Frag \fs\f3the enemy team\fr to drop \fs\f3skulls\fr. Collect them and bring them to \fs\f3the enemy base\fr to score points for \fs\f1your team\fr or steal back \fs\f1your skulls\fr. You spawn with all weapons and armour. There are no items." }
};
-#define STARTGAMEMODE (-3)
+#define STARTGAMEMODE (-1)
#define NUMGAMEMODES ((int)(sizeof(gamemodes)/sizeof(gamemodes[0])))
#define m_valid(mode) ((mode) >= STARTGAMEMODE && (mode) < STARTGAMEMODE + NUMGAMEMODES)
@@ -139,16 +85,7 @@ static struct gamemodeinfo
#define m_noitems (m_check(gamemode, M_NOITEMS))
#define m_noammo (m_check(gamemode, M_NOAMMO|M_NOITEMS))
#define m_insta (m_check(gamemode, M_INSTA))
-#define m_tactics (m_check(gamemode, M_TACTICS))
#define m_efficiency (m_check(gamemode, M_EFFICIENCY))
-#define m_capture (m_check(gamemode, M_CAPTURE))
-#define m_capture_only (m_checkonly(gamemode, M_CAPTURE, M_REGEN))
-#define m_regencapture (m_checkall(gamemode, M_CAPTURE | M_REGEN))
-#define m_ctf (m_check(gamemode, M_CTF))
-#define m_ctf_only (m_checkonly(gamemode, M_CTF, M_PROTECT | M_HOLD))
-#define m_protect (m_checkall(gamemode, M_CTF | M_PROTECT))
-#define m_hold (m_checkall(gamemode, M_CTF | M_HOLD))
-#define m_collect (m_check(gamemode, M_COLLECT))
#define m_teammode (m_check(gamemode, M_TEAM))
#define isteam(a,b) (m_teammode && strcmp(a, b)==0)
@@ -159,10 +96,6 @@ static struct gamemodeinfo
#define m_botmode (m_checknot(gamemode, M_DEMO|M_LOCAL))
#define m_mp(mode) (m_checknot(mode, M_LOCAL))
-#define m_sp (m_check(gamemode, M_DMSP | M_CLASSICSP))
-#define m_dmsp (m_check(gamemode, M_DMSP))
-#define m_classicsp (m_check(gamemode, M_CLASSICSP))
-
enum { MM_AUTH = -1, MM_OPEN = 0, MM_VETO, MM_LOCKED, MM_PRIVATE, MM_PASSWORD, MM_START = MM_AUTH };
static const char * const mastermodenames[] = { "auth", "open", "veto", "locked", "private", "password" };
@@ -178,6 +111,7 @@ enum
S_PAIN1, S_PAIN2, S_PAIN3, S_PAIN4, S_PAIN5, S_PAIN6,
S_DIE1, S_DIE2,
S_FLAUNCH, S_FEXPLODE,
+ S_SPLASH1, S_SPLASH2,
S_JUMPPAD, S_PISTOL,
S_V_FIGHT,
@@ -207,11 +141,9 @@ enum
N_TIMEUP, N_FORCEINTERMISSION,
N_SERVMSG, N_ITEMLIST, N_RESUME,
N_EDITMODE, N_EDITENT, N_EDITF, N_EDITT, N_EDITM, N_FLIP, N_COPY, N_PASTE, N_ROTATE, N_REPLACE, N_DELCUBE, N_REMIP, N_EDITVSLOT, N_UNDO, N_REDO, N_NEWMAP, N_GETMAP, N_SENDMAP, N_CLIPBOARD, N_EDITVAR,
- N_MASTERMODE, N_KICK, N_CLEARBANS, N_CURRENTMASTER, N_SPECTATOR, N_SETMASTER, N_SETTEAM,
- N_BASES, N_BASEINFO, N_BASESCORE, N_REPAMMO, N_BASEREGEN, N_ANNOUNCE,
+ N_MASTERMODE, N_KICK, N_CLEARBANS, N_CURRENTMASTER, N_SPECTATOR, N_SETMASTER, N_SETTEAM, N_ANNOUNCE,
N_LISTDEMOS, N_SENDDEMOLIST, N_GETDEMO, N_SENDDEMO,
N_DEMOPLAYBACK, N_RECORDDEMO, N_STOPDEMO, N_CLEARDEMOS,
- N_TAKEFLAG, N_RETURNFLAG, N_RESETFLAG, N_INVISFLAG, N_TRYDROPFLAG, N_DROPFLAG, N_SCOREFLAG, N_INITFLAGS,
N_SAYTEAM,
N_CLIENT,
N_AUTHTRY, N_AUTHKICK, N_AUTHCHAL, N_AUTHANS, N_REQAUTH,
@@ -237,11 +169,9 @@ static const int msgsizes[] = // size inclusive message token, 0 f
N_TIMEUP, 2, N_FORCEINTERMISSION, 1,
N_SERVMSG, 0, N_ITEMLIST, 0, N_RESUME, 0,
N_EDITMODE, 2, N_EDITENT, 11, N_EDITF, 16, N_EDITT, 16, N_EDITM, 16, N_FLIP, 14, N_COPY, 14, N_PASTE, 14, N_ROTATE, 15, N_REPLACE, 17, N_DELCUBE, 14, N_REMIP, 1, N_EDITVSLOT, 16, N_UNDO, 0, N_REDO, 0, N_NEWMAP, 2, N_GETMAP, 1, N_SENDMAP, 0, N_EDITVAR, 0,
- N_MASTERMODE, 2, N_KICK, 0, N_CLEARBANS, 1, N_CURRENTMASTER, 0, N_SPECTATOR, 3, N_SETMASTER, 0, N_SETTEAM, 0,
- N_BASES, 0, N_BASEINFO, 0, N_BASESCORE, 0, N_REPAMMO, 1, N_BASEREGEN, 6, N_ANNOUNCE, 2,
+ N_MASTERMODE, 2, N_KICK, 0, N_CLEARBANS, 1, N_CURRENTMASTER, 0, N_SPECTATOR, 3, N_SETMASTER, 0, N_SETTEAM, 0, N_ANNOUNCE, 2,
N_LISTDEMOS, 1, N_SENDDEMOLIST, 0, N_GETDEMO, 3, N_SENDDEMO, 0,
N_DEMOPLAYBACK, 3, N_RECORDDEMO, 2, N_STOPDEMO, 1, N_CLEARDEMOS, 2,
- N_TAKEFLAG, 3, N_RETURNFLAG, 4, N_RESETFLAG, 6, N_INVISFLAG, 3, N_TRYDROPFLAG, 1, N_DROPFLAG, 7, N_SCOREFLAG, 10, N_INITFLAGS, 0,
N_SAYTEAM, 0,
N_CLIENT, 0,
N_AUTHTRY, 0, N_AUTHKICK, 0, N_AUTHCHAL, 0, N_AUTHANS, 0, N_REQAUTH, 0,
@@ -290,10 +220,6 @@ enum
HICON_QUAD,
- HICON_RED_FLAG,
- HICON_BLUE_FLAG,
- HICON_NEUTRAL_FLAG,
-
HICON_TOKEN,
HICON_X = 20,
@@ -319,25 +245,21 @@ static struct itemstat { int add, max, sound; const char *name; int icon, info;
{20000, 30000, S_ITEMPUP, "Q", HICON_QUAD, -1},
};
-#define MAXRAYS 20
+#define MAXRAYS 12
#define EXP_SELFDAMDIV 2
#define EXP_SELFPUSH 2.5f
#define EXP_DISTSCALE 1.5f
static const struct guninfo { int sound, attackdelay, damage, spread, projspeed, kickamount, range, rays, hitpush, exprad, ttl; const char *name, *file; short part; } guns[NUMGUNS] =
{
- { S_PUNCH1, 250, 50, 0, 0, 0, 14, 1, 80, 0, 0, "fist", "fist", 0 },
- { S_SG, 1400, 10, 400, 0, 20, 1024, 20, 80, 0, 0, "shotgun", "shotg", 0 },
- { S_CG, 100, 30, 100, 0, 7, 1024, 1, 80, 0, 0, "chaingun", "chaing", 0 },
- { S_RLFIRE, 800, 120, 0, 320, 10, 1024, 1, 160, 40, 0, "rocketlauncher", "rocket", 0 },
- { S_RIFLE, 1500, 100, 0, 0, 30, 2048, 1, 80, 0, 0, "rifle", "rifle", 0 },
- { S_FLAUNCH, 600, 90, 0, 200, 10, 1024, 1, 250, 45, 1500, "grenadelauncher", "gl", 0 },
- { S_PISTOL, 500, 35, 50, 0, 7, 1024, 1, 80, 0, 0, "pistol", "pistol", 0 },
- { S_FLAUNCH, 200, 20, 0, 200, 1, 1024, 1, 80, 40, 0, "fireball", NULL, PART_FIREBALL1 },
- { S_ICEBALL, 200, 40, 0, 120, 1, 1024, 1, 80, 40, 0, "iceball", NULL, PART_FIREBALL2 },
- { S_SLIMEBALL, 200, 30, 0, 640, 1, 1024, 1, 80, 40, 0, "slimeball", NULL, PART_FIREBALL3 },
- { S_PIGR1, 250, 50, 0, 0, 1, 12, 1, 80, 0, 0, "bite", NULL, 0 },
- { -1, 0, 120, 0, 0, 0, 0, 1, 80, 40, 0, "barrel", NULL, 0 }
+ // delay| dmg| spr| spd| kck| rng| ray| pus| exp|
+ { S_PUNCH1, 100, 30, 0, 0, 0, 30, 1, 80, 0, 0, "fist", "fist", 0 },
+ { S_SG, 1000, 20, 280, 0, 20, 1024, MAXRAYS, 80, 0, 0, "shotgun", "shotg", 0 },
+ { S_CG, 100, 20, 70, 0, 10, 1024, 1, 80, 0, 0, "chaingun", "chaing", 0 },
+ { S_RLFIRE, 800, 120, 0, 270, 10, 1024, 1, 160, 40, 0, "rocketlauncher", "rocket", 0 },
+ { S_RIFLE, 1200, 120, 0, 0, 30, 2048, 1, 80, 0, 0, "rifle", "rifle", 0 },
+ { S_FLAUNCH, 600, 90, 0, 300, 20, 1024, 1, 250, 45, 1500, "grenadelauncher", "gl", 0 },
+ { S_PISTOL, 400, 60, 160, 0, 10, 1024, 1, 80, 0, 0, "pistol", "pistol", 0 },
};
#include "ai.h"
@@ -439,30 +361,6 @@ struct fpsstate
gunselect = GUN_RIFLE;
ammo[GUN_RIFLE] = 100;
}
- else if(m_regencapture)
- {
- extern int regenbluearmour;
- if(regenbluearmour)
- {
- armourtype = A_BLUE;
- armour = 25;
- }
- gunselect = GUN_PISTOL;
- ammo[GUN_PISTOL] = 40;
- ammo[GUN_GL] = 1;
- }
- else if(m_tactics)
- {
- armourtype = A_GREEN;
- armour = 100;
- ammo[GUN_PISTOL] = 40;
- int spawngun1 = rnd(5)+1, spawngun2;
- gunselect = spawngun1;
- baseammo(spawngun1, m_noitems ? 2 : 1);
- do spawngun2 = rnd(5)+1; while(spawngun1==spawngun2);
- baseammo(spawngun2, m_noitems ? 2 : 1);
- if(m_noitems) ammo[GUN_GL] += 1;
- }
else if(m_efficiency)
{
armourtype = A_GREEN;
@@ -471,23 +369,6 @@ struct fpsstate
gunselect = GUN_CG;
ammo[GUN_CG] /= 2;
}
- else if(m_ctf || m_collect)
- {
- armourtype = A_BLUE;
- armour = 50;
- ammo[GUN_PISTOL] = 40;
- ammo[GUN_GL] = 1;
- }
- else if(m_sp)
- {
- if(m_dmsp)
- {
- armourtype = A_BLUE;
- armour = 25;
- }
- ammo[GUN_PISTOL] = 80;
- ammo[GUN_GL] = 1;
- }
else
{
armourtype = A_BLUE;
@@ -635,8 +516,6 @@ namespace entities
extern void preloadentities();
extern void renderentities();
- extern void resettriggers();
- extern void checktriggers();
extern void checkitems(fpsent *d);
extern void checkquad(int time, fpsent *d);
extern void resetspawns();
@@ -736,7 +615,6 @@ namespace game
extern bool addmsg(int type, const char *fmt = NULL, ...);
extern void switchname(const char *name);
extern void switchteam(const char *name);
- extern void switchplayermodel(int playermodel);
extern void sendmapinfo();
extern void stopdemo();
extern void changemap(const char *name, int mode);
@@ -744,32 +622,6 @@ namespace game
extern void c2sinfo(bool force = false);
extern void sendposition(fpsent *d, bool reliable = false);
- // monster
- struct monster;
- extern vector<monster *> monsters;
-
- extern void clearmonsters();
- extern void preloadmonsters();
- extern void stackmonster(monster *d, physent *o);
- extern void updatemonsters(int curtime);
- extern void rendermonsters();
- extern void suicidemonster(monster *m);
- extern void hitmonster(int damage, monster *m, fpsent *at, const vec &vel, int gun);
- extern void monsterkilled();
- extern void endsp(bool allkilled);
- extern void spsummary(int accuracy);
-
- // movable
- struct movable;
- extern vector<movable *> movables;
-
- extern void clearmovables();
- extern void stackmovable(movable *d, physent *o);
- extern void updatemovables(int curtime);
- extern void rendermovables();
- extern void suicidemovable(movable *m);
- extern void hitmovable(int damage, movable *m, fpsent *at, const vec &vel, int gun);
-
// weapon
extern int getweapon(const char *name);
extern void shoot(fpsent *d, const vec &targ);
@@ -818,9 +670,7 @@ namespace game
extern void saveragdoll(fpsent *d);
extern void clearragdolls();
extern void moveragdolls();
- extern void changedplayermodel();
extern const playermodelinfo &getplayermodelinfo(fpsent *d);
- extern int chooserandomplayermodel(int seed);
extern void swayhudgun(int curtime);
extern vec hudgunorigin(int gun, const vec &from, const vec &to, fpsent *d);
}
diff --git a/src/fpsgame/game.h.gch b/src/fpsgame/game.h.gch
new file mode 100644
index 0000000..b1bc4a9
--- /dev/null
+++ b/src/fpsgame/game.h.gch
Binary files differ
diff --git a/src/fpsgame/render.cpp b/src/fpsgame/render.cpp
index d6c8b91..4c06e07 100644
--- a/src/fpsgame/render.cpp
+++ b/src/fpsgame/render.cpp
@@ -4,15 +4,14 @@ struct spawninfo { const extentity *e; float weight; };
extern float gatherspawninfos(dynent *d, int tag, vector<spawninfo> &spawninfos);
namespace game
-{
+{
vector<fpsent *> bestplayers;
vector<const char *> bestteams;
VARP(ragdoll, 0, 1, 1);
VARP(ragdollmillis, 0, 10000, 300000);
VARP(ragdollfade, 0, 1000, 300000);
- VARFP(playermodel, 0, 0, 4, changedplayermodel());
- VARP(forceplayermodels, 0, 0, 1);
+ VARP(playermodel, 0, 0, 0);
VARP(hidedead, 0, 0, 2);
vector<fpsent *> ragdolls;
@@ -27,7 +26,7 @@ namespace game
r->attackchan = r->idlechan = -1;
if(d==player1) r->playermodel = playermodel;
ragdolls.add(r);
- d->ragdoll = NULL;
+ d->ragdoll = NULL;
}
void clearragdolls()
@@ -49,81 +48,38 @@ namespace game
}
}
- static const playermodelinfo playermodels[5] =
+ static const playermodelinfo playermodels[1] =
{
{ "mrfixit", "mrfixit/blue", "mrfixit/red", "mrfixit/hudguns", NULL, "mrfixit/horns", { "mrfixit/armor/blue", "mrfixit/armor/green", "mrfixit/armor/yellow" }, "mrfixit", "mrfixit_blue", "mrfixit_red", true },
- { "snoutx10k", "snoutx10k/blue", "snoutx10k/red", "snoutx10k/hudguns", NULL, "snoutx10k/wings", { "snoutx10k/armor/blue", "snoutx10k/armor/green", "snoutx10k/armor/yellow" }, "snoutx10k", "snoutx10k_blue", "snoutx10k_red", true },
- //{ "ogro/green", "ogro/blue", "ogro/red", "mrfixit/hudguns", "ogro/vwep", NULL, { NULL, NULL, NULL }, "ogro", "ogro_blue", "ogro_red", false },
- { "ogro2", "ogro2/blue", "ogro2/red", "mrfixit/hudguns", NULL, "ogro2/quad", { "ogro2/armor/blue", "ogro2/armor/green", "ogro2/armor/yellow" }, "ogro", "ogro_blue", "ogro_red", true },
- { "inky", "inky/blue", "inky/red", "inky/hudguns", NULL, "inky/quad", { "inky/armor/blue", "inky/armor/green", "inky/armor/yellow" }, "inky", "inky_blue", "inky_red", true },
- { "captaincannon", "captaincannon/blue", "captaincannon/red", "captaincannon/hudguns", NULL, "captaincannon/quad", { "captaincannon/armor/blue", "captaincannon/armor/green", "captaincannon/armor/yellow" }, "captaincannon", "captaincannon_blue", "captaincannon_red", true }
};
- int chooserandomplayermodel(int seed)
- {
- return (seed&0xFFFF)%(sizeof(playermodels)/sizeof(playermodels[0]));
- }
-
const playermodelinfo *getplayermodelinfo(int n)
{
- if(size_t(n) >= sizeof(playermodels)/sizeof(playermodels[0])) return NULL;
- return &playermodels[n];
+ (void) n;
+ return &playermodels[0];
}
const playermodelinfo &getplayermodelinfo(fpsent *d)
{
- const playermodelinfo *mdl = getplayermodelinfo(d==player1 || forceplayermodels ? playermodel : d->playermodel);
+ const playermodelinfo *mdl = getplayermodelinfo(0);
if(!mdl) mdl = getplayermodelinfo(playermodel);
return *mdl;
}
- void changedplayermodel()
- {
- if(player1->clientnum < 0) player1->playermodel = playermodel;
- if(player1->ragdoll) cleanragdoll(player1);
- loopv(ragdolls)
- {
- fpsent *d = ragdolls[i];
- if(!d->ragdoll) continue;
- if(!forceplayermodels)
- {
- const playermodelinfo *mdl = getplayermodelinfo(d->playermodel);
- if(mdl) continue;
- }
- cleanragdoll(d);
- }
- loopv(players)
- {
- fpsent *d = players[i];
- if(d == player1 || !d->ragdoll) continue;
- if(!forceplayermodels)
- {
- const playermodelinfo *mdl = getplayermodelinfo(d->playermodel);
- if(mdl) continue;
- }
- cleanragdoll(d);
- }
- }
-
void preloadplayermodel()
{
- loopi(sizeof(playermodels)/sizeof(playermodels[0]))
+ const playermodelinfo *mdl = getplayermodelinfo(0);
+ if(m_teammode)
{
- const playermodelinfo *mdl = getplayermodelinfo(i);
- if(!mdl) break;
- if(i != playermodel && (!multiplayer(false) || forceplayermodels)) continue;
- if(m_teammode)
- {
- preloadmodel(mdl->blueteam);
- preloadmodel(mdl->redteam);
- }
- else preloadmodel(mdl->ffa);
- if(mdl->vwep) preloadmodel(mdl->vwep);
- if(mdl->quad) preloadmodel(mdl->quad);
- loopj(3) if(mdl->armour[j]) preloadmodel(mdl->armour[j]);
+ preloadmodel(mdl->blueteam);
+ preloadmodel(mdl->redteam);
}
+ else preloadmodel(mdl->ffa);
+ if(mdl->vwep) preloadmodel(mdl->vwep);
+ if(mdl->quad) preloadmodel(mdl->quad);
+ loopj(3) if(mdl->armour[j]) preloadmodel(mdl->armour[j]);
}
-
+
VAR(testquad, 0, 0, 1);
VAR(testarmour, 0, 0, 1);
VAR(testteam, 0, 0, 3);
@@ -180,13 +136,6 @@ namespace game
case 2: mdlname = mdl.redteam; break;
}
renderclient(d, mdlname, a[0].tag ? a : NULL, hold, attack, delay, lastaction, intermission && d->state!=CS_DEAD ? 0 : d->lastpain, fade, ragdoll && mdl.ragdoll);
-#if 0
- if(d->state!=CS_DEAD && d->quadmillis)
- {
- entitylight light;
- rendermodel(&light, "quadrings", ANIM_MAPMODEL|ANIM_LOOP, vec(d->o).sub(vec(0, 0, d->eyeheight/2)), 360*lastmillis/1000.0f, 0, MDL_DYNSHADOW | MDL_CULL_VFC | MDL_CULL_DIST);
- }
-#endif
}
VARP(teamskins, 0, 0, 1);
@@ -336,13 +285,11 @@ namespace game
int team = 0;
if(teamskins || m_teammode) team = isteam(player1->team, d->team) ? 1 : 2;
float fade = 1.0f;
- if(ragdollmillis && ragdollfade)
+ if(ragdollmillis && ragdollfade)
fade -= clamp(float(lastmillis - (d->lastupdate + max(ragdollmillis - ragdollfade, 0)))/min(ragdollmillis, ragdollfade), 0.0f, 1.0f);
renderplayer(d, getplayermodelinfo(d), team, fade, mainpass);
- }
+ }
if(isthirdperson() && !followingplayer() && (player1->state!=CS_DEAD || hidedead != 1)) renderplayer(player1, getplayermodelinfo(player1), teamskins || m_teammode ? 1 : 0, 1, mainpass);
- rendermonsters();
- rendermovables();
entities::renderentities();
renderbouncers();
renderprojectiles();
@@ -444,8 +391,8 @@ namespace game
void drawhudgun()
{
fpsent *d = hudplayer();
- if(d->state==CS_SPECTATOR || d->state==CS_EDITING || !hudgun || editmode)
- {
+ if(d->state==CS_SPECTATOR || d->state==CS_EDITING || !hudgun || editmode)
+ {
d->muzzle = player1->muzzle = vec(-1, -1, -1);
return;
}
@@ -540,10 +487,7 @@ namespace game
void preloadsounds()
{
- for(int i = S_JUMP; i <= S_SPLASH2; i++) preloadsound(i);
- for(int i = S_JUMPPAD; i <= S_PISTOL; i++) preloadsound(i);
- for(int i = S_V_BOOST; i <= S_V_QUAD10; i++) preloadsound(i);
- for(int i = S_BURN; i <= S_HIT; i++) preloadsound(i);
+ for(int i = S_JUMP; i <= S_HIT; i++) preloadsound(i);
}
void preload()
@@ -553,7 +497,6 @@ namespace game
preloadplayermodel();
preloadsounds();
entities::preloadentities();
- if(m_sp) preloadmonsters();
}
}
diff --git a/src/fpsgame/scoreboard.cpp b/src/fpsgame/scoreboard.cpp
index ec99dda..40a1246 100644
--- a/src/fpsgame/scoreboard.cpp
+++ b/src/fpsgame/scoreboard.cpp
@@ -37,11 +37,6 @@ namespace game
else return false;
}
else if(b->state==CS_SPECTATOR) return true;
- if(m_ctf || m_collect)
- {
- if(a->flags > b->flags) return true;
- if(a->flags < b->flags) return false;
- }
if(a->frags > b->frags) return true;
if(a->frags < b->frags) return false;
return strcmp(a->name, b->name) < 0;
diff --git a/src/fpsgame/server.cpp b/src/fpsgame/server.cpp
index fb02c5e..158772f 100644
--- a/src/fpsgame/server.cpp
+++ b/src/fpsgame/server.cpp
@@ -271,15 +271,15 @@ namespace server
void setexceeded()
{
if(state.state==CS_ALIVE && !exceeded && !checkpushed(gamemillis, calcpushrange())) exceeded = gamemillis;
- scheduleexceeded();
+ scheduleexceeded();
}
-
+
void setpushed()
{
pushed = max(pushed, gamemillis);
if(exceeded && checkpushed(exceeded, calcpushrange())) exceeded = 0;
}
-
+
bool checkexceeded()
{
return state.state==CS_ALIVE && exceeded && gamemillis > exceeded + calcpushrange();
@@ -421,13 +421,13 @@ namespace server
if(getclientip(c.clientnum) == ip) disconnect_client(c.clientnum, DISC_KICK);
}
}
-
+
struct maprotation
{
static int exclude;
int modes;
string map;
-
+
int calcmodemask() const { return modes&(1<<NUMGAMEMODES) ? modes & ~exclude : modes; }
bool hasmode(int mode, int offset = STARTGAMEMODE) const { return (calcmodemask() & (1 << (mode-offset))) != 0; }
@@ -510,7 +510,7 @@ namespace server
for(; *h && *n; h++)
{
if(*h == *n) n++;
- else if(*h != ' ') break;
+ else if(*h != ' ') break;
}
if(!*n) return true;
if(*n == '.') return !*h;
@@ -555,7 +555,7 @@ namespace server
}
return modemask;
}
-
+
bool addmaprotation(int modemask, const char *map)
{
if(!map[0]) loopk(NUMGAMEMODES) if(modemask&(1<<k) && !m_check(k+STARTGAMEMODE, M_EDIT)) modemask &= ~(1<<k);
@@ -566,7 +566,7 @@ namespace server
copystring(rot.map, map);
return true;
}
-
+
void addmaprotations(tagval *args, int numargs)
{
vector<char *> modes, maps;
@@ -587,7 +587,7 @@ namespace server
rot.map[0] = '\0';
}
}
-
+
COMMAND(maprotationreset, "");
COMMANDN(maprotation, addmaprotations, "ss2V");
@@ -653,7 +653,7 @@ namespace server
teamkillkick &kick = teamkillkicks.add();
kick.modes = genmodemask(modes);
kick.limit = *limit;
- kick.ban = *ban > 0 ? *ban*60000 : (*ban < 0 ? 0 : 30*60000);
+ kick.ban = *ban > 0 ? *ban*60000 : (*ban < 0 ? 0 : 30*60000);
modes.deletearrays();
}
@@ -673,8 +673,8 @@ namespace server
if(!m_timed || actor->state.aitype != AI_NONE || actor->local || actor->privilege || (victim && victim->state.aitype != AI_NONE)) return;
shouldcheckteamkills = true;
uint ip = getclientip(actor->clientnum);
- loopv(teamkills) if(teamkills[i].ip == ip)
- {
+ loopv(teamkills) if(teamkills[i].ip == ip)
+ {
teamkills[i].teamkills += n;
return;
}
@@ -785,7 +785,7 @@ namespace server
int numclients(int exclude = -1, bool nospec = true, bool noai = true, bool priv = false)
{
int n = 0;
- loopv(clients)
+ loopv(clients)
{
clientinfo *ci = clients[i];
if(ci->clientnum!=exclude && (!nospec || ci->state.state!=CS_SPECTATOR || (priv && (ci->privilege || ci->local))) && (!noai || ci->state.aitype == AI_NONE)) n++;
@@ -842,20 +842,12 @@ namespace server
};
#define SERVMODE 1
- #include "capture.h"
- #include "ctf.h"
- #include "collect.h"
-
- captureservmode capturemode;
- ctfservmode ctfmode;
- collectservmode collectmode;
servmode *smode = NULL;
bool canspawnitem(int type) { return !m_noitems && (type>=I_SHELLS && type<=I_QUAD && (!m_noammo || type<I_SHELLS || type>I_CARTRIDGES)); }
int spawntime(int type)
{
- if(m_classicsp) return INT_MAX;
int np = numclients(-1, true, false);
np = np<3 ? 4 : (np>4 ? 2 : 3); // spawn times are dependent on number of players
int sec = 0;
@@ -882,7 +874,6 @@ namespace server
{
case I_GREENARMOUR:
case I_YELLOWARMOUR:
- return !m_classicsp;
case I_BOOST:
case I_QUAD:
return true;
@@ -890,7 +881,7 @@ namespace server
return false;
}
}
-
+
bool pickup(int i, int sender) // server side item pickup, acknowledge first client that gets it
{
if((m_timed && gamemillis>=gamelimit) || !sents.inrange(i) || !sents[i].spawned) return false;
@@ -1045,7 +1036,7 @@ namespace server
loopi(n) delete[] demos[i].data;
demos.remove(0, n);
}
-
+
void adddemo()
{
if(!demotmp) return;
@@ -1062,7 +1053,7 @@ namespace server
demotmp->read(d.data, len);
DELETEP(demotmp);
}
-
+
void enddemorecord()
{
if(!demorecord) return;
@@ -1374,7 +1365,7 @@ namespace server
{
char *name;
char *desc;
-
+
userkey() : name(NULL), desc(NULL) {}
userkey(char *name, char *desc) : name(name), desc(desc) {}
};
@@ -1449,7 +1440,7 @@ namespace server
if(wantpriv <= ci->privilege) return true;
else if(wantpriv <= PRIV_MASTER && !force)
{
- if(ci->state.state==CS_SPECTATOR)
+ if(ci->state.state==CS_SPECTATOR)
{
sendf(ci->clientnum, 1, "ris", N_SERVMSG, "Spectators may not claim master.");
return false;
@@ -1484,11 +1475,11 @@ namespace server
allowedips.shrink(0);
}
string msg;
- if(val && authname)
+ if(val && authname)
{
if(authdesc && authdesc[0]) formatstring(msg, "%s claimed %s as '\fs\f5%s\fr' [\fs\f0%s\fr]", colorname(ci), name, authname, authdesc);
else formatstring(msg, "%s claimed %s as '\fs\f5%s\fr'", colorname(ci), name, authname);
- }
+ }
else formatstring(msg, "%s %s %s", colorname(ci), val ? "claimed" : "relinquished", name);
packetbuf p(MAXTRANS, ENET_PACKET_FLAG_RELIABLE);
putint(p, N_SERVMSG);
@@ -1592,7 +1583,12 @@ namespace server
}
uchar operator[](int msg) const { return msg >= 0 && msg < NUMMSG ? msgmask[msg] : 0; }
- } msgfilter(-1, N_CONNECT, N_SERVINFO, N_INITCLIENT, N_WELCOME, N_MAPCHANGE, N_SERVMSG, N_DAMAGE, N_HITPUSH, N_SHOTFX, N_EXPLODEFX, N_DIED, N_SPAWNSTATE, N_FORCEDEATH, N_TEAMINFO, N_ITEMACC, N_ITEMSPAWN, N_TIMEUP, N_CDIS, N_CURRENTMASTER, N_PONG, N_RESUME, N_BASESCORE, N_BASEINFO, N_BASEREGEN, N_ANNOUNCE, N_SENDDEMOLIST, N_SENDDEMO, N_DEMOPLAYBACK, N_SENDMAP, N_DROPFLAG, N_SCOREFLAG, N_RETURNFLAG, N_RESETFLAG, N_INVISFLAG, N_CLIENT, N_AUTHCHAL, N_INITAI, N_EXPIRETOKENS, N_DROPTOKENS, N_STEALTOKENS, N_DEMOPACKET, -2, N_REMIP, N_NEWMAP, N_GETMAP, N_SENDMAP, N_CLIPBOARD, -3, N_EDITENT, N_EDITF, N_EDITT, N_EDITM, N_FLIP, N_COPY, N_PASTE, N_ROTATE, N_REPLACE, N_DELCUBE, N_EDITVAR, N_EDITVSLOT, N_UNDO, N_REDO, -4, N_POS, NUMMSG),
+ } msgfilter(-1, N_CONNECT, N_SERVINFO, N_INITCLIENT, N_WELCOME, N_MAPCHANGE, N_SERVMSG, N_DAMAGE, N_HITPUSH, N_SHOTFX, N_EXPLODEFX, N_DIED,
+ N_SPAWNSTATE, N_FORCEDEATH, N_TEAMINFO, N_ITEMACC, N_ITEMSPAWN, N_TIMEUP, N_CDIS, N_CURRENTMASTER, N_PONG, N_RESUME,
+ N_ANNOUNCE, N_SENDDEMOLIST, N_SENDDEMO, N_DEMOPLAYBACK, N_SENDMAP,
+ N_CLIENT, N_AUTHCHAL, N_INITAI, N_EXPIRETOKENS, N_DROPTOKENS, N_STEALTOKENS, N_DEMOPACKET, -2, N_REMIP,
+ N_NEWMAP, N_GETMAP, N_SENDMAP, N_CLIPBOARD, -3, N_EDITENT, N_EDITF, N_EDITT, N_EDITM, N_FLIP, N_COPY, N_PASTE, N_ROTATE, N_REPLACE,
+ N_DELCUBE, N_EDITVAR, N_EDITVSLOT, N_UNDO, N_REDO, -4, N_POS, NUMMSG),
connectfilter(-1, N_CONNECT, -2, N_AUTHANS, -3, N_PING, NUMMSG);
int checktype(int type, clientinfo *ci)
@@ -1928,7 +1924,7 @@ namespace server
if(t.frags) { sendstring(t.team, p); putint(p, t.frags); }
);
sendstring("", p);
- }
+ }
if(ci)
{
putint(p, N_SETTEAM);
@@ -2030,7 +2026,7 @@ namespace server
}
notgotitems = false;
}
-
+
void changemap(const char *s, int mode)
{
stopdemo();
@@ -2059,10 +2055,7 @@ namespace server
sendf(-1, 1, "risii", N_MAPCHANGE, smapname, gamemode, 1);
- if(m_capture) smode = &capturemode;
- else if(m_ctf) smode = &ctfmode;
- else if(m_collect) smode = &collectmode;
- else smode = NULL;
+ smode = NULL;
clearteaminfo();
if(m_teammode) autoteam();
@@ -2098,7 +2091,7 @@ namespace server
changemap("", 1);
return;
}
- if(next)
+ if(next)
{
curmaprotation = findmaprotation(gamemode, smapname);
if(curmaprotation >= 0) nextmaprotation();
@@ -2107,7 +2100,7 @@ namespace server
maprotation &rot = maprotations[curmaprotation];
changemap(rot.map, rot.findmode(gamemode));
}
-
+
struct votecount
{
char *map;
@@ -2154,7 +2147,7 @@ namespace server
void forcemap(const char *map, int mode)
{
stopdemo();
- if(!map[0] && !m_check(mode, M_EDIT))
+ if(!map[0] && !m_check(mode, M_EDIT))
{
int idx = findmaprotation(mode, smapname);
if(idx < 0 && smapname[0]) idx = findmaprotation(mode, "");
@@ -2170,14 +2163,14 @@ namespace server
clientinfo *ci = getinfo(sender);
if(!ci || (ci->state.state==CS_SPECTATOR && !ci->privilege && !ci->local) || (!ci->local && !m_mp(reqmode))) return;
if(!m_valid(reqmode)) return;
- if(!map[0] && !m_check(reqmode, M_EDIT))
+ if(!map[0] && !m_check(reqmode, M_EDIT))
{
int idx = findmaprotation(reqmode, smapname);
if(idx < 0 && smapname[0]) idx = findmaprotation(reqmode, "");
if(idx < 0) return;
map = maprotations[idx].map;
}
- if(lockmaprotation && !ci->local && ci->privilege < (lockmaprotation > 1 ? PRIV_ADMIN : PRIV_MASTER) && findmaprotation(reqmode, map) < 0)
+ if(lockmaprotation && !ci->local && ci->privilege < (lockmaprotation > 1 ? PRIV_ADMIN : PRIV_MASTER) && findmaprotation(reqmode, map) < 0)
{
sendf(sender, 1, "ris", N_SERVMSG, "This server has locked the map rotation.");
return;
@@ -2283,13 +2276,13 @@ namespace server
actor->state.effectiveness += fragvalue*friends/float(max(enemies, 1));
}
teaminfo *t = m_teammode ? teaminfos.access(actor->team) : NULL;
- if(t) t->frags += fragvalue;
+ if(t) t->frags += fragvalue;
sendf(-1, 1, "ri5", N_DIED, target->clientnum, actor->clientnum, actor->state.frags, t ? t->frags : 0);
target->position.setsize(0);
if(smode) smode->died(target, actor);
ts.state = CS_DEAD;
ts.lastdeath = gamemillis;
- if(actor!=target && isteam(actor->team, target->team))
+ if(actor!=target && isteam(actor->team, target->team))
{
actor->state.teamkills++;
addteamkill(actor, target, 1);
@@ -2507,7 +2500,7 @@ namespace server
if(nextexceeded && gamemillis > nextexceeded && (!m_timed || gamemillis < gamelimit))
{
nextexceeded = 0;
- loopvrev(clients)
+ loopvrev(clients)
{
clientinfo &c = *clients[i];
if(c.state.aitype != AI_NONE) continue;
@@ -2670,7 +2663,7 @@ namespace server
void clientdisconnect(int n)
{
clientinfo *ci = getinfo(n);
- loopv(clients) if(clients[i]->authkickvictim == ci->clientnum) clients[i]->cleanauth();
+ loopv(clients) if(clients[i]->authkickvictim == ci->clientnum) clients[i]->cleanauth();
if(ci->connected)
{
if(ci->privilege) setmaster(ci, false);
@@ -2710,7 +2703,7 @@ namespace server
verifybans();
}
- } ipbans, gbans;
+ } ipbans, gbans;
bool checkbans(uint ip)
{
@@ -2730,7 +2723,7 @@ namespace server
ICOMMAND(clearipbans, "", (), ipbans.clear());
ICOMMAND(ipban, "s", (const char *ipname), ipbans.add(ipname));
-
+
int allowconnect(clientinfo *ci, const char *pwd = "")
{
if(ci->local) return DISC_NONE;
@@ -2782,7 +2775,7 @@ namespace server
if(ci->authkickvictim >= 0)
{
if(setmaster(ci, true, "", ci->authname, NULL, PRIV_AUTH, false, true))
- trykick(ci, ci->authkickvictim, ci->authkickreason, ci->authname, NULL, PRIV_AUTH);
+ trykick(ci, ci->authkickvictim, ci->authkickreason, ci->authname, NULL, PRIV_AUTH);
ci->cleanauthkick();
}
else setmaster(ci, true, "", ci->authname, NULL, PRIV_AUTH);
@@ -2807,7 +2800,7 @@ namespace server
if(ci->authdesc[0])
{
userinfo *u = users.access(userkey(ci->authname, ci->authdesc));
- if(u)
+ if(u)
{
uint seed[3] = { ::hthash(serverauth) + detrnd(size_t(ci) + size_t(user) + size_t(desc), 0x10000), uint(totalmillis), randomMT() };
vector<char> buf;
@@ -2828,7 +2821,7 @@ namespace server
bool answerchallenge(clientinfo *ci, uint id, char *val, const char *desc)
{
- if(ci->authreq != id || strcmp(ci->authdesc, desc))
+ if(ci->authreq != id || strcmp(ci->authdesc, desc))
{
ci->cleanauth();
return !ci->connectauth;
@@ -2842,7 +2835,7 @@ namespace server
if(ci->authchallenge && checkchallenge(val, ci->authchallenge))
{
userinfo *u = users.access(userkey(ci->authname, ci->authdesc));
- if(u)
+ if(u)
{
if(ci->connectauth) connected(ci);
if(ci->authkickvictim >= 0)
@@ -2853,8 +2846,8 @@ namespace server
else setmaster(ci, true, "", ci->authname, ci->authdesc, u->privilege);
}
}
- ci->cleanauth();
- }
+ ci->cleanauth();
+ }
else if(!requestmasterf("confauth %u %s\n", id, val))
{
ci->cleanauth();
@@ -2872,7 +2865,7 @@ namespace server
loopvrev(clients)
{
clientinfo *ci = clients[i];
- if(ci->authreq) authfailed(ci);
+ if(ci->authreq) authfailed(ci);
}
}
@@ -2966,9 +2959,9 @@ namespace server
{
getstring(text, p);
filtertext(text, text, false, false, MAXNAMELEN);
- if(!text[0]) copystring(text, "unnamed");
+ if(!text[0]) copystring(text, "Anonymous");
copystring(ci->name, text, MAXNAMELEN+1);
- ci->playermodel = getint(p);
+ ci->playermodel = 0;
string password, authdesc, authname;
getstring(password, p, sizeof(password));
@@ -2994,7 +2987,7 @@ namespace server
getstring(desc, p, sizeof(desc));
uint id = (uint)getint(p);
getstring(ans, p, sizeof(ans));
- if(!answerchallenge(ci, id, ans, desc))
+ if(!answerchallenge(ci, id, ans, desc))
{
disconnect_client(sender, ci->connectauth);
return;
@@ -3036,8 +3029,8 @@ namespace server
{
case N_POS:
{
- int pcn = getuint(p);
- p.get();
+ int pcn = getuint(p);
+ p.get();
uint flags = getuint(p);
clientinfo *cp = getinfo(pcn);
if(cp && pcn != sender && cp->ownernum != sender) cp = NULL;
@@ -3080,7 +3073,7 @@ namespace server
if(cp && (!ci->local || demorecord || hasnonlocalclients()) && (cp->state.state==CS_ALIVE || cp->state.state==CS_EDITING))
{
flushclientposition(*cp);
- sendf(-1, 0, "ri4x", N_TELEPORT, pcn, teleport, teledest, cp->ownernum);
+ sendf(-1, 0, "ri4x", N_TELEPORT, pcn, teleport, teledest, cp->ownernum);
}
break;
}
@@ -3098,7 +3091,7 @@ namespace server
}
break;
}
-
+
case N_FROMAI:
{
int qcn = getint(p);
@@ -3230,7 +3223,7 @@ namespace server
hit.rays = getint(p);
loopk(3) hit.dir[k] = getint(p)/DNF;
}
- if(cq)
+ if(cq)
{
cq->addevent(shot);
cq->setpushed();
@@ -3303,14 +3296,14 @@ namespace server
QUEUE_MSG;
getstring(text, p);
filtertext(ci->name, text, false, false, MAXNAMELEN);
- if(!ci->name[0]) copystring(ci->name, "unnamed");
+ if(!ci->name[0]) copystring(ci->name, "Anonymous");
QUEUE_STR(ci->name);
break;
}
case N_SWITCHMODEL:
{
- ci->playermodel = getint(p);
+ ci->playermodel = 0;
QUEUE_MSG;
break;
}
@@ -3495,7 +3488,7 @@ namespace server
{
int val = getint(p);
if(ci->privilege < (restrictdemos ? PRIV_ADMIN : PRIV_MASTER) && !ci->local) break;
- if(!maxdemos || !maxdemosize)
+ if(!maxdemos || !maxdemosize)
{
sendf(ci->clientnum, 1, "ris", N_SERVMSG, "the server has disabled demo recording");
break;
@@ -3630,7 +3623,7 @@ namespace server
{
ci->authkickvictim = victim;
ci->authkickreason = newstring(text);
- }
+ }
break;
}
@@ -3668,17 +3661,17 @@ namespace server
case N_PASTE:
if(ci->state.state!=CS_SPECTATOR) sendclipboard(ci);
goto genericmsg;
-
+
case N_CLIPBOARD:
{
- int unpacklen = getint(p), packlen = getint(p);
+ int unpacklen = getint(p), packlen = getint(p);
ci->cleanclipboard(false);
if(ci->state.state==CS_SPECTATOR)
{
if(packlen > 0) p.subbuf(packlen);
break;
}
- if(packlen <= 0 || packlen > (1<<16) || unpacklen <= 0)
+ if(packlen <= 0 || packlen > (1<<16) || unpacklen <= 0)
{
if(packlen > 0) p.subbuf(packlen);
packlen = unpacklen = 0;
@@ -3687,12 +3680,12 @@ namespace server
putint(q, N_CLIPBOARD);
putint(q, ci->clientnum);
putint(q, unpacklen);
- putint(q, packlen);
+ putint(q, packlen);
if(packlen > 0) p.get(q.subbuf(packlen).buf, packlen);
ci->clipboard = q.finalize();
ci->clipboard->referenceCount++;
break;
- }
+ }
case N_EDITT:
case N_REPLACE:
@@ -3732,12 +3725,7 @@ namespace server
case N_SERVCMD:
getstring(text, p);
break;
-
- #define PARSEMESSAGES 1
- #include "capture.h"
- #include "ctf.h"
- #include "collect.h"
- #undef PARSEMESSAGES
+
case -1:
disconnect_client(sender, DISC_MSGERR);
diff --git a/src/fpsgame/waypoint.cpp b/src/fpsgame/waypoint.cpp
index ed504e9..b59b388 100644
--- a/src/fpsgame/waypoint.cpp
+++ b/src/fpsgame/waypoint.cpp
@@ -616,7 +616,7 @@ namespace ai
extentity &e = *entities::ents[i];
switch(e.type)
{
- case PLAYERSTART: case TELEPORT: case JUMPPAD: case FLAG: case BASE:
+ case PLAYERSTART: case TELEPORT: case JUMPPAD:
addwaypoint(e.o);
break;
default:
diff --git a/src/fpsgame/weapon.cpp b/src/fpsgame/weapon.cpp
index 3c7f575..b062609 100644
--- a/src/fpsgame/weapon.cpp
+++ b/src/fpsgame/weapon.cpp
@@ -3,7 +3,6 @@
namespace game
{
- static const int MONSTERDAMAGEFACTOR = 4;
static const int OFFSETMILLIS = 500;
vec rays[MAXRAYS];
@@ -15,7 +14,6 @@ namespace game
vector<hitmsg> hits;
VARP(maxdebris, 10, 25, 1000);
- VARP(maxbarreldebris, 5, 10, 1000);
ICOMMAND(getweapon, "", (), intret(player1->gunselect));
@@ -135,7 +133,7 @@ namespace game
loopi(guns[gun].rays) offsetray(from, to, guns[gun].spread, guns[gun].range, rays[i]);
}
- enum { BNC_GRENADE, BNC_GIBS, BNC_DEBRIS, BNC_BARRELDEBRIS };
+ enum { BNC_GRENADE, BNC_GIBS, BNC_DEBRIS };
struct bouncer : physent
{
@@ -171,7 +169,7 @@ namespace game
if(bouncetype == BNC_GRENADE && offsetmillis > 0 && offset.z < 0)
offsetheight = raycube(vec(o.x + offset.x, o.y + offset.y, o.z), vec(0, 0, -1), -offset.z);
else offsetheight = -1;
- }
+ }
};
vector<bouncer *> bouncers;
@@ -195,7 +193,7 @@ namespace game
switch(type)
{
case BNC_GRENADE: bnc.collidetype = COLLIDE_ELLIPSE_PRECISE; break;
- case BNC_DEBRIS: case BNC_BARRELDEBRIS: bnc.variant = rnd(4); break;
+ case BNC_DEBRIS: bnc.variant = rnd(4); break;
case BNC_GIBS: bnc.variant = rnd(3); break;
}
@@ -227,7 +225,7 @@ namespace game
b->bounces++;
adddecal(DECAL_BLOOD, vec(b->o).sub(vec(surface).mul(b->radius)), surface, 2.96f/b->bounces, bvec(0x60, 0xFF, 0xFF), rnd(4));
}
-
+
void updatebouncers(int time)
{
loopv(bouncers)
@@ -358,12 +356,6 @@ namespace game
lasthit = lastmillis;
}
- if(d->type==ENT_INANIMATE)
- {
- hitmovable(damage, (movable *)d, at, vel, gun);
- return;
- }
-
fpsent *f = (fpsent *)d;
f->lastpain = lastmillis;
@@ -371,8 +363,7 @@ namespace game
if(f->type==ENT_AI || !m_mp(gamemode) || f==at) f->hitpush(damage, vel, at, gun);
- if(f->type==ENT_AI) hitmonster(damage, (monster *)f, at, vel, gun);
- else if(!m_mp(gamemode)) damaged(damage, f, at);
+ if(!m_mp(gamemode)) damaged(damage, f, at);
else
{
hitmsg &h = hits.add();
@@ -435,7 +426,7 @@ namespace game
if(gun==GUN_RL) adddynlight(v, 1.15f*guns[gun].exprad, vec(2, 1.5f, 1), 700, 100, 0, guns[gun].exprad/2, vec(1, 0.75f, 0.5f));
else if(gun==GUN_GL) adddynlight(v, 1.15f*guns[gun].exprad, vec(0.5f, 1.5f, 2), 600, 100, 0, 8, vec(0.25f, 1, 1));
else adddynlight(v, 1.15f*guns[gun].exprad, vec(2, 1.5f, 1), 700, 100);
- int numdebris = gun==GUN_BARREL ? rnd(max(maxbarreldebris-5, 1))+5 : rnd(maxdebris-5)+5;
+ int numdebris = rnd(maxdebris-5)+5;
vec debrisvel = vec(owner->o).sub(v).safenormalize(), debrisorigin(v);
if(gun==GUN_RL) debrisorigin.add(vec(debrisvel).mul(8));
if(numdebris)
@@ -443,7 +434,7 @@ namespace game
entitylight light;
lightreaching(debrisorigin, light.color, light.dir);
loopi(numdebris)
- spawnbouncer(debrisorigin, debrisvel, owner, gun==GUN_BARREL ? BNC_BARRELDEBRIS : BNC_DEBRIS, &light);
+ spawnbouncer(debrisorigin, debrisvel, owner, BNC_DEBRIS, &light);
}
if(!local) return;
int numdyn = numdynents();
@@ -527,9 +518,8 @@ namespace game
projectile &p = projs[i];
p.offsetmillis = max(p.offsetmillis-time, 0);
int qdam = guns[p.gun].damage*(p.owner->quadmillis ? 4 : 1);
- if(p.owner->type==ENT_AI) qdam /= MONSTERDAMAGEFACTOR;
vec dv;
- float dist = p.to.dist(p.o, dv);
+ float dist = p.to.dist(p.o, dv);
dv.mul(time/max(dist*1000/p.speed, float(time)));
vec v = vec(p.o).add(dv);
bool exploded = false;
@@ -560,17 +550,7 @@ namespace game
{
vec pos(v);
pos.add(vec(p.offset).mul(p.offsetmillis/float(OFFSETMILLIS)));
- if(guns[p.gun].part)
- {
- regular_particle_splash(PART_SMOKE, 2, 300, pos, 0x404040, 0.6f, 150, -20);
- int color = 0xFFFFFF;
- switch(guns[p.gun].part)
- {
- case PART_FIREBALL1: color = 0xFFC8C8; break;
- }
- particle_splash(guns[p.gun].part, 1, 1, pos, color, 4.8f, 150, 20);
- }
- else regular_particle_splash(PART_SMOKE, 2, 300, pos, 0x404040, 2.4f, 50, -20);
+ regular_particle_splash(PART_SMOKE, 2, 300, pos, 0x404040, 2.4f, 50, -20);
}
}
if(exploded)
@@ -628,11 +608,7 @@ namespace game
case GUN_RL:
if(muzzleflash && d->muzzle.x >= 0)
particle_flare(d->muzzle, d->muzzle, 250, PART_MUZZLE_FLASH2, 0xFFFFFF, 3.0f, d);
- case GUN_FIREBALL:
- case GUN_ICEBALL:
- case GUN_SLIMEBALL:
pspeed = guns[gun].projspeed;
- if(d->type==ENT_AI) pspeed /= 2;
newprojectile(from, to, (float)pspeed, local, id, d, gun);
break;
@@ -739,14 +715,13 @@ namespace game
{
int qdam = guns[d->gunselect].damage;
if(d->quadmillis) qdam *= 4;
- if(d->type==ENT_AI) qdam /= MONSTERDAMAGEFACTOR;
dynent *o;
float dist;
if(guns[d->gunselect].rays > 1)
{
dynent *hits[MAXRAYS];
int maxrays = guns[d->gunselect].rays;
- loopi(maxrays)
+ loopi(maxrays)
{
if((hits[i] = intersectclosest(from, rays[i], d, dist))) shorten(from, rays[i], dist);
else adddecal(DECAL_BULLET, rays[i], vec(from).sub(rays[i]).safenormalize(), 2.0f);
@@ -769,7 +744,7 @@ namespace game
shorten(from, to, dist);
hitpush(qdam, o, d, from, to, d->gunselect, 1);
}
- else if(d->gunselect!=GUN_FIST && d->gunselect!=GUN_BITE) adddecal(DECAL_BULLET, to, vec(from).sub(to).safenormalize(), d->gunselect==GUN_RIFLE ? 3.0f : 2.0f);
+ else if(d->gunselect!=GUN_FIST) adddecal(DECAL_BULLET, to, vec(from).sub(to).safenormalize(), d->gunselect==GUN_RIFLE ? 3.0f : 2.0f);
}
void shoot(fpsent *d, const vec &targ)
@@ -849,14 +824,12 @@ namespace game
static const char * const projnames[2] = { "projectiles/grenade", "projectiles/rocket" };
static const char * const gibnames[3] = { "gibs/gib01", "gibs/gib02", "gibs/gib03" };
static const char * const debrisnames[4] = { "debris/debris01", "debris/debris02", "debris/debris03", "debris/debris04" };
- static const char * const barreldebrisnames[4] = { "barreldebris/debris01", "barreldebris/debris02", "barreldebris/debris03", "barreldebris/debris04" };
-
+
void preloadbouncers()
{
loopi(sizeof(projnames)/sizeof(projnames[0])) preloadmodel(projnames[i]);
loopi(sizeof(gibnames)/sizeof(gibnames[0])) preloadmodel(gibnames[i]);
loopi(sizeof(debrisnames)/sizeof(debrisnames[0])) preloadmodel(debrisnames[i]);
- loopi(sizeof(barreldebrisnames)/sizeof(barreldebrisnames[0])) preloadmodel(barreldebrisnames[i]);
}
void renderbouncers()
@@ -887,7 +860,6 @@ namespace game
{
case BNC_GIBS: mdl = gibnames[bnc.variant]; cull |= MDL_LIGHT|MDL_LIGHT_FAST|MDL_DYNSHADOW; break;
case BNC_DEBRIS: mdl = debrisnames[bnc.variant]; break;
- case BNC_BARRELDEBRIS: mdl = barreldebrisnames[bnc.variant]; break;
default: continue;
}
rendermodel(&bnc.light, mdl, ANIM_MAPMODEL|ANIM_LOOP, pos, yaw, pitch, cull, NULL, NULL, 0, 0, fade);
diff --git a/src/shared/ents.h b/src/shared/ents.h
index f4da8f5..91ccd8f 100644
--- a/src/shared/ents.h
+++ b/src/shared/ents.h
@@ -83,17 +83,17 @@ struct physent // base entity type, can be affe
uchar physstate; // one of PHYS_* above
uchar state, editstate; // one of CS_* above
uchar type; // one of ENT_* above
- uchar collidetype; // one of COLLIDE_* above
+ uchar collidetype; // one of COLLIDE_* above
bool blocked; // used by physics to signal ai
- physent() : o(0, 0, 0), deltapos(0, 0, 0), newpos(0, 0, 0), yaw(0), pitch(0), roll(0), maxspeed(100),
+ physent() : o(0, 0, 0), deltapos(0, 0, 0), newpos(0, 0, 0), yaw(0), pitch(0), roll(0), maxspeed(100),
radius(4.1f), eyeheight(14), aboveeye(1), xradius(4.1f), yradius(4.1f), zmargin(0),
state(CS_ALIVE), editstate(CS_ALIVE), type(ENT_PLAYER),
collidetype(COLLIDE_ELLIPSE),
blocked(false)
{ reset(); }
-
+
void resetinterp()
{
newpos = o;
@@ -114,7 +114,7 @@ struct physent // base entity type, can be affe
vec feetpos(float offset = 0) const { return vec(o).add(vec(0, 0, offset - eyeheight)); }
vec headpos(float offset = 0) const { return vec(o).add(vec(0, 0, offset)); }
- bool maymove() const { return timeinair || physstate < PHYS_FLOOR || vel.squaredlen() > 1e-4f || deltapos.squaredlen() > 1e-4f; }
+ bool maymove() const { return timeinair || physstate < PHYS_FLOOR || vel.squaredlen() > 1e-4f || deltapos.squaredlen() > 1e-4f; }
};
enum
@@ -128,7 +128,7 @@ enum
ANIM_EDIT, ANIM_LAG, ANIM_TAUNT, ANIM_WIN, ANIM_LOSE,
ANIM_GUN_IDLE, ANIM_GUN_SHOOT,
ANIM_VWEP_IDLE, ANIM_VWEP_SHOOT, ANIM_SHIELD, ANIM_POWERUP,
- ANIM_MAPMODEL, ANIM_TRIGGER,
+ ANIM_MAPMODEL,
NUMANIMS
};
@@ -143,7 +143,7 @@ static const char * const animnames[] =
"edit", "lag", "taunt", "win", "lose",
"gun idle", "gun shoot",
"vwep idle", "vwep shoot", "shield", "powerup",
- "mapmodel", "trigger"
+ "mapmodel"
};
#define ANIM_ALL 0x7F
@@ -206,8 +206,8 @@ struct dynent : physent // animated characters, or chara
uchar occluded;
dynent() : ragdoll(NULL), query(NULL), lastrendered(0), occluded(0)
- {
- reset();
+ {
+ reset();
}
~dynent()
@@ -217,13 +217,13 @@ struct dynent : physent // animated characters, or chara
if(ragdoll) cleanragdoll(this);
#endif
}
-
+
void stopmoving()
{
k_left = k_right = k_up = k_down = jumping = false;
move = strafe = 0;
}
-
+
void reset()
{
physent::reset();
diff --git a/src/shared/iengine.h b/src/shared/iengine.h
index 32b1957..80f876d 100644
--- a/src/shared/iengine.h
+++ b/src/shared/iengine.h
@@ -74,9 +74,9 @@ struct selinfo
extern int worldsize;
if(grid <= 0 || grid >= worldsize) return false;
if(o.x >= worldsize || o.y >= worldsize || o.z >= worldsize) return false;
- if(o.x < 0) { s.x -= (grid - 1 - o.x)/grid; o.x = 0; }
- if(o.y < 0) { s.y -= (grid - 1 - o.y)/grid; o.y = 0; }
- if(o.z < 0) { s.z -= (grid - 1 - o.z)/grid; o.z = 0; }
+ if(o.x < 0) { s.x -= (grid - 1 - o.x)/grid; o.x = 0; }
+ if(o.y < 0) { s.y -= (grid - 1 - o.y)/grid; o.y = 0; }
+ if(o.z < 0) { s.z -= (grid - 1 - o.z)/grid; o.z = 0; }
s.x = clamp(s.x, 0, (worldsize - o.x)/grid);
s.y = clamp(s.y, 0, (worldsize - o.y)/grid);
s.z = clamp(s.z, 0, (worldsize - o.z)/grid);
@@ -307,9 +307,6 @@ extern void damageblend(int n);
extern void damagecompass(int n, const vec &loc);
extern void cleardamagescreen();
-extern vec minimapcenter, minimapradius, minimapscale;
-extern void bindminimap();
-
extern matrix4 hudmatrix;
extern void resethudmatrix();
extern void pushhudmatrix();
diff --git a/src/shared/igame.h b/src/shared/igame.h
index 113ca17..6c8c486 100644
--- a/src/shared/igame.h
+++ b/src/shared/igame.h
@@ -8,7 +8,6 @@ namespace entities
extern int extraentinfosize();
extern void writeent(entity &e, char *buf);
extern void readent(entity &e, char *buf, int ver);
- extern float dropheight(entity &e);
extern void fixentity(extentity &e);
extern void entradius(extentity &e, bool color);
extern bool mayattach(extentity &e);
@@ -19,7 +18,6 @@ namespace entities
extern void clearents();
extern vector<extentity *> &getents();
extern const char *entmodel(const entity &e);
- extern void animatemapmodel(const extentity &e, int &anim, int &basetime);
}
namespace game
@@ -94,9 +92,8 @@ namespace game
extern bool serverinfostartcolumn(g3d_gui *g, int i);
extern void serverinfoendcolumn(g3d_gui *g, int i);
extern bool serverinfoentry(g3d_gui *g, int i, const char *name, int port, const char *desc, const char *map, int ping, const vector<int> &attr, int np);
- extern bool needminimap();
-}
-
+}
+
namespace server
{
extern void *newclientinfo();