summaryrefslogtreecommitdiff
path: root/src/fpsgame
diff options
context:
space:
mode:
authorxolatile2025-08-04 18:17:30 +0200
committerxolatile2025-08-04 18:17:30 +0200
commita89dca11cf475e0bd1399cf5d5c5135d00495ec3 (patch)
tree4d551a7f4193bc89a0b8560e955f4f874101b388 /src/fpsgame
parent9d533fa4d82935a083ff93a09aed95baea9fbfd4 (diff)
downloadxolatile-badassbug-a89dca11cf475e0bd1399cf5d5c5135d00495ec3.tar.xz
xolatile-badassbug-a89dca11cf475e0bd1399cf5d5c5135d00495ec3.tar.zst
Minor changes...
Diffstat (limited to 'src/fpsgame')
-rw-r--r--src/fpsgame/ai.cpp32
-rw-r--r--src/fpsgame/aiman.h3
-rw-r--r--src/fpsgame/client.cpp15
-rw-r--r--src/fpsgame/extinfo.h18
-rw-r--r--src/fpsgame/fps.cpp271
-rw-r--r--src/fpsgame/game.h31
-rw-r--r--src/fpsgame/render.cpp5
-rw-r--r--src/fpsgame/scoreboard.cpp6
-rw-r--r--src/fpsgame/server.cpp111
-rw-r--r--src/fpsgame/weapon.cpp55
10 files changed, 40 insertions, 507 deletions
diff --git a/src/fpsgame/ai.cpp b/src/fpsgame/ai.cpp
index a4d3c33..b8c3daa 100644
--- a/src/fpsgame/ai.cpp
+++ b/src/fpsgame/ai.cpp
@@ -98,7 +98,7 @@ namespace ai
if(weaprange(d, d->gunselect, dist) || (d->skill <= 100 && !rnd(d->skill)))
{
if(d->gunselect == GUN_FIST) return true;
- float skew = clamp(float(lastmillis-d->ai->enemymillis)/float((d->skill*guns[d->gunselect].attackdelay/200.f)), 0.f, guns[d->gunselect].projspeed ? 0.25f : 1e16f),
+ float skew = clamp(float(lastmillis-d->ai->enemymillis)/float((d->skill*guns[d->gunselect].attackdelay/200.f)), 0.f, guns[d->gunselect].projspeed ? 0.25f : 1e16f),
offy = yaw-d->yaw, offp = pitch-d->pitch;
if(offy > 180) offy -= 360;
else if(offy < -180) offy += 360;
@@ -505,7 +505,6 @@ namespace ai
}
}
}
- if(cmode) cmode->aifind(d, b, interests);
if(m_teammode) assist(d, b, interests);
return parseinterests(d, b, interests, override);
}
@@ -637,16 +636,10 @@ namespace ai
}
}
- bool check(fpsent *d, aistate &b)
- {
- if(cmode && cmode->aicheck(d, b)) return true;
- return false;
- }
-
int dowait(fpsent *d, aistate &b)
{
d->ai->clear(true); // ensure they're clean
- if(check(d, b) || find(d, b)) return 1;
+ if(find(d, b)) return 1;
if(target(d, b, 4, false)) return 1;
if(target(d, b, 4, true)) return 1;
if(randomnode(d, b, SIGHTMIN, 1e16f))
@@ -664,19 +657,13 @@ namespace ai
switch(b.targtype)
{
case AI_T_NODE:
- if(check(d, b)) return 1;
if(iswaypoint(b.target)) return defend(d, b, waypoints[b.target].o) ? 1 : 0;
break;
case AI_T_ENTITY:
- if(check(d, b)) return 1;
if(entities::ents.inrange(b.target)) return defend(d, b, entities::ents[b.target]->o) ? 1 : 0;
break;
- case AI_T_AFFINITY:
- if(cmode) return cmode->aidefend(d, b) ? 1 : 0;
- break;
case AI_T_PLAYER:
{
- if(check(d, b)) return 1;
fpsent *e = getclient(b.target);
if(e && e->state == CS_ALIVE) return defend(d, b, e->feetpos()) ? 1 : 0;
break;
@@ -693,7 +680,7 @@ namespace ai
switch(b.targtype)
{
case AI_T_NODE: // this is like a wait state without sitting still..
- if(check(d, b) || find(d, b)) return 1;
+ if(find(d, b)) return 1;
if(target(d, b, 4, true)) return 1;
if(iswaypoint(b.target) && vec(waypoints[b.target].o).sub(d->feetpos()).magnitude() > CLOSEDIST)
return makeroute(d, b, waypoints[b.target].o) ? 1 : 0;
@@ -723,21 +710,13 @@ namespace ai
{
case AI_T_NODE:
{
- if(check(d, b)) return 1;
if(iswaypoint(b.target))
return defend(d, b, waypoints[b.target].o) ? 1 : 0;
break;
}
- case AI_T_AFFINITY:
- {
- if(cmode) return cmode->aipursue(d, b) ? 1 : 0;
- break;
- }
-
case AI_T_PLAYER:
{
- //if(check(d, b)) return 1;
fpsent *e = getclient(b.target);
if(e && e->state == CS_ALIVE)
{
@@ -1249,8 +1228,7 @@ namespace ai
moveplayer(d, 10, true);
if(allowmove && !b.idle) timeouts(d, b);
if(d->quadmillis) entities::checkquad(curtime, d);
- entities::checkitems(d);
- if(cmode) cmode->checkitems(d);
+ entities::checkitems(d);
}
}
else if(d->state == CS_DEAD)
@@ -1297,7 +1275,7 @@ namespace ai
c.override = false;
cleannext = false;
}
- if(d->state == CS_DEAD && d->respawned!=d->lifesequence && (!cmode || cmode->respawnwait(d, 250) <= 0) && lastmillis - d->lastpain >= 500)
+ if(d->state == CS_DEAD && d->respawned!=d->lifesequence && lastmillis - d->lastpain >= 500)
{
addmsg(N_TRYSPAWN, "rc", d);
d->respawned = d->lifesequence;
diff --git a/src/fpsgame/aiman.h b/src/fpsgame/aiman.h
index 120f50b..9c1598c 100644
--- a/src/fpsgame/aiman.h
+++ b/src/fpsgame/aiman.h
@@ -48,7 +48,6 @@ namespace aiman
}
if(bot)
{
- if(smode && bot->state.state==CS_ALIVE) smode->changeteam(bot, bot->team, t.team);
copystring(bot->team, t.team, MAXTEAMLEN+1);
sendf(-1, 1, "riisi", N_SETTEAM, bot->clientnum, bot->team, 0);
}
@@ -130,7 +129,6 @@ namespace aiman
{
int cn = ci->clientnum - MAXCLIENTS;
if(!bots.inrange(cn)) return;
- if(ci->ownernum >= 0 && !ci->aireinit && smode) smode->leavegame(ci, true);
sendf(-1, 1, "ri2", N_CDIS, ci->clientnum);
clientinfo *owner = (clientinfo *)getclientinfo(ci->ownernum);
if(owner) owner->bots.removeobj(ci);
@@ -167,7 +165,6 @@ namespace aiman
void shiftai(clientinfo *ci, clientinfo *owner = NULL)
{
- if(ci->ownernum >= 0 && !ci->aireinit && smode) smode->leavegame(ci, true);
clientinfo *prevowner = (clientinfo *)getclientinfo(ci->ownernum);
if(prevowner) prevowner->bots.removeobj(ci);
if(!owner) { ci->aireinit = 0; ci->ownernum = -1; }
diff --git a/src/fpsgame/client.cpp b/src/fpsgame/client.cpp
index 609ce93..00a0c7e 100644
--- a/src/fpsgame/client.cpp
+++ b/src/fpsgame/client.cpp
@@ -2,13 +2,6 @@
namespace game
{
- clientmode *cmode = NULL;
-
- void setclientmode()
- {
- cmode = NULL;
- }
-
bool senditemstoserver = false, sendcrc = false; // after a map change, since server doesn't have map data
int lastping = 0;
@@ -898,9 +891,8 @@ namespace game
}
if(senditemstoserver)
{
- if(!m_noitems || cmode!=NULL) p.reliable();
+ if(!m_noitems) p.reliable();
if(!m_noitems) entities::putitems(p);
- if(cmode) cmode->senditems(p);
senditemstoserver = false;
}
if(messages.length())
@@ -1340,8 +1332,7 @@ namespace game
showscores(false);
lasthit = 0;
}
- if(cmode) cmode->respawned(s);
- ai::spawned(s);
+ ai::spawned(s);
addmsg(N_SPAWN, "rcii", s, s->lifesequence, s->gunselect);
break;
}
@@ -1408,7 +1399,7 @@ namespace game
actor->frags = frags;
if(m_teammode) setteaminfo(actor->team, tfrags);
extern int hidefrags;
- if(actor!=player1 && (!cmode || !cmode->hidefrags() || !hidefrags))
+ if(actor!=player1 && (!hidefrags))
{
defformatstring(ds, "%d", actor->frags);
particle_textcopy(actor->abovehead(), ds, PART_TEXT, 2000, 0x32FF64, 4.0f, -8);
diff --git a/src/fpsgame/extinfo.h b/src/fpsgame/extinfo.h
index 0e747e7..b1f4119 100644
--- a/src/fpsgame/extinfo.h
+++ b/src/fpsgame/extinfo.h
@@ -16,7 +16,7 @@
B: 0 EXT_PLAYERSTATS cn #a client number or -1 for all players#
C: 0 EXT_TEAMSCORE
- Server:
+ Server:
--------
A: 0 EXT_UPTIME EXT_ACK EXT_VERSION uptime #in seconds#
B: 0 EXT_PLAYERSTATS cn #send by client# EXT_ACK EXT_VERSION 0 or 1 #error, if cn was > -1 and client does not exist# ...
@@ -58,8 +58,7 @@
{
sendstring(team, p);
putint(p, score);
- if(!smode || !smode->extinfoteam(team, p))
- putint(p,-1); //no bases follow
+ putint(p,-1); //no bases follow
}
void extinfoteams(ucharbuf &p)
@@ -70,14 +69,13 @@
if(!m_teammode) return;
vector<teamscore> scores;
- if(smode && smode->hidefrags()) smode->getteamscores(scores);
loopv(clients)
{
clientinfo *ci = clients[i];
if(ci->state.state!=CS_SPECTATOR && ci->team[0] && scores.htfind(ci->team) < 0)
{
- if(smode && smode->hidefrags()) scores.add(teamscore(ci->team, 0));
- else { teaminfo *ti = teaminfos.access(ci->team); scores.add(teamscore(ci->team, ti ? ti->frags : 0)); }
+ teaminfo *ti = teaminfos.access(ci->team);
+ scores.add(teamscore(ci->team, ti ? ti->frags : 0));
}
}
loopv(scores) extinfoteamscore(p, scores[i].team, scores[i].score);
@@ -85,7 +83,7 @@
void extserverinforeply(ucharbuf &req, ucharbuf &p)
{
- int extcmd = getint(req); // extended commands
+ int extcmd = getint(req); // extended commands
//Build a new packet
putint(p, EXT_ACK); //send ack
@@ -102,7 +100,7 @@
case EXT_PLAYERSTATS:
{
int cn = getint(req); //a special player, -1 for all
-
+
clientinfo *ci = NULL;
if(cn >= 0)
{
@@ -116,13 +114,13 @@
}
putint(p, EXT_NO_ERROR); //so far no error can happen anymore
-
+
ucharbuf q = p; //remember buffer position
putint(q, EXT_PLAYERSTATS_RESP_IDS); //send player ids following
if(ci) putint(q, ci->clientnum);
else loopv(clients) putint(q, clients[i]->clientnum);
sendserverinforeply(q);
-
+
if(ci) extinfoplayer(p, ci);
else loopv(clients) extinfoplayer(p, clients[i]);
return;
diff --git a/src/fpsgame/fps.cpp b/src/fpsgame/fps.cpp
index 6a72335..7b066ca 100644
--- a/src/fpsgame/fps.cpp
+++ b/src/fpsgame/fps.cpp
@@ -94,7 +94,6 @@ namespace game
spawnplayer(player1);
showscores(false);
lasthit = 0;
- if(cmode) cmode->respawned(player1);
}
}
@@ -260,7 +259,6 @@ namespace game
moveplayer(player1, 10, true);
swayhudgun(curtime);
entities::checkitems(player1);
- if(cmode) cmode->checkitems(player1);
}
}
if(player1->clientnum>=0) c2sinfo(); // do this last, to reduce the effective frame lag
@@ -281,7 +279,7 @@ namespace game
{
fpsent *p = (fpsent *)d;
vec loc = vec(e.o).addz(p->eyeheight);
- float maxrange = !m_noitems ? 400.0f : (cmode ? 300.0f : 110.0f);
+ float maxrange = !m_noitems ? 400.0f : 110.0f;
float minplayerdist = maxrange;
loopv(players)
{
@@ -302,15 +300,13 @@ namespace game
if(raycube(loc, dir, dist) < dist) dist *= 1.5f;
minplayerdist = min(minplayerdist, dist);
}
- float rating = 1.0f - proximityscore(minplayerdist, 80.0f, maxrange);
- return cmode ? harmonicmean(rating, cmode->ratespawn(p, e)) : rating;
+ return 1.0f - proximityscore(minplayerdist, 80.0f, maxrange);
}
void pickgamespawn(fpsent *d)
{
int ent = d == player1 && respawnent >= 0 ? respawnent : -1;
- int tag = cmode ? cmode->getspawngroup(d) : 0;
- findplayerspawn(d, ent, tag);
+ findplayerspawn(d, ent, 0);
}
void spawnplayer(fpsent *d) // place at random spawn
@@ -332,14 +328,6 @@ namespace game
if(player1->state==CS_DEAD)
{
player1->attacking = false;
- int wait = cmode ? cmode->respawnwait(player1) : 0;
- if(wait>0)
- {
- lastspawnattempt = lastmillis;
- //conoutf(CON_GAMEINFO, "\f2you must wait %d second%s before respawn!", wait, wait!=1 ? "s" : "");
- return;
- }
- if(lastmillis < player1->lastpain + spawnwait) return;
respawnself();
}
}
@@ -406,17 +394,13 @@ namespace game
d->state = CS_DEAD;
d->lastpain = lastmillis;
if(!restore) d->deaths++;
- //~{
- //~gibeffect(max(-d->health, 0), d->vel, d);
- //~d->deaths++;
- //~}
+
if(d==player1)
{
if(deathscore) showscores(true);
disablezoom();
if(!restore) loopi(NUMGUNS) savedammo[i] = player1->ammo[i];
d->attacking = false;
- //d->pitch = 0;
d->roll = 0;
playsound(S_DIE1+rnd(2));
}
@@ -457,8 +441,6 @@ namespace game
}
else if((d->state!=CS_ALIVE && d->state != CS_LAGGED && d->state != CS_SPAWNING) || intermission) return;
- if(cmode) cmode->died(d, actor);
-
fpsent *h = followingplayer(player1);
int contype = d==h || actor==h ? CON_FRAG_SELF : CON_FRAG_OTHER;
const char *dname = "", *aname = "";
@@ -511,7 +493,6 @@ namespace game
{
intermission = true;
player1->attacking = false;
- if(cmode) cmode->gameover();
conoutf(CON_GAMEINFO, "\f2intermission:");
conoutf(CON_GAMEINFO, "\f2game has ended!");
conoutf(CON_GAMEINFO, "\f2player frags: %d, deaths: %d", player1->frags, player1->deaths);
@@ -576,7 +557,6 @@ namespace game
removeweapons(d);
removetrackedparticles(d);
removetrackeddynlights(d);
- if(cmode) cmode->removeplayer(d);
players.removeobj(d);
DELETEP(clients[cn]);
cleardynentcache();
@@ -618,18 +598,10 @@ namespace game
d->respawned = d->suicided = -2;
}
- setclientmode();
-
intermission = false;
maptime = maprealtime = 0;
maplimit = -1;
- if(cmode)
- {
- cmode->preload();
- cmode->setup();
- }
-
conoutf(CON_GAMEINFO, "\f2game mode is %s", server::modename(gamemode));
const char *info = m_valid(gamemode) ? gamemodes[gamemode - STARTGAMEMODE].info : NULL;
@@ -872,43 +844,12 @@ namespace game
pophudmatrix();
}
- //~void drawspeedometer(fpsent *d, int w, int h) {
- //~int speedforreal = (int) (sqrtf(d->vel.squaredlen()) + 1.0f);
- //~speedforreal = (speedforreal == 1) ? 0 : speedforreal;
- //~vec colour = vec(255, 255, 255);
- //~float realw = 0;
- //~float realh = 0;
- //~if (speedometercolor) {
- //~if (speedforreal==0) colour = vec(60, 60, 60);
- //~else if (speedforreal>0 && speedforreal<=60) colour = vec(240, 30, 30);
- //~else if (speedforreal>60 && speedforreal<=120) colour = vec(180, 90, 60);
- //~else if (speedforreal>120 && speedforreal<=180) colour = vec(180, 180, 30);
- //~else if (speedforreal>180 && speedforreal<=240) colour = vec(90, 180, 60);
- //~else colour = vec(30, 240, 30);
- //~}
-
- //~defformatstring(speedstring, "%d", speedforreal);
- //~text_boundsf(speedstring, realw, realh);
- //~vec2 offset = vec2(speedometerx, speedometery).mul(vec2(w, h).div(speedometerscale));
- //~offset.x -= realw/2.0f;
- //~offset.y -= realh/2.0f;
-
- //~pushhudmatrix();
- //~hudmatrix.scale(speedometerscale, speedometerscale, 1);
- //~flushhudmatrix();
-
- //~draw_text(speedstring, int(offset.x), int(offset.y), colour.x, colour.y, colour.z, speedometeralpha);
-
- //~pophudmatrix();
- //~}
-
void hudquad(float x, float y, float w, float h, float r = 1, float g = 1, float b = 1, float tx = 0, float ty = 0, float tw = 1, float th = 1)
{
gle::defvertex(2);
gle::deftexcoord0();
gle::colorf(r, g, b);
gle::begin(GL_TRIANGLE_STRIP);
- //~gle::begin(GL_QUADS);
gle::attribf(x, y); gle::attribf(tx, ty);
gle::attribf(x+w, y); gle::attribf(tx + tw, ty);
gle::attribf(x, y+h); gle::attribf(tx, ty + th);
@@ -1019,29 +960,6 @@ namespace game
void drawhudicons(fpsent *d, int w, int h)
{
- //~defformatstring(health, "%d", d->state==CS_DEAD ? 0 : d->health);
- //~bvec healthcolor = bvec::hexcolor(healthcolors && !m_insta ? (d->state==CS_DEAD ? 0x808080 : (d->health<=25 ? 0xFF0000 : (d->health<=50 ? 0xFF8000 : (d->health<=100 ? 0xFFFFFF : 0x40C0FF)))) : 0xFFFFFF);
- //~draw_text(health, (HICON_X + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, healthcolor.r, healthcolor.g, healthcolor.b);
- //~if(d->state!=CS_DEAD)
- //~{
- //~if(d->armour) draw_textf("%d", (HICON_X + HICON_STEP + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, d->armour);
- //~draw_textf("%d", (HICON_X + 2*HICON_STEP + HICON_SIZE + HICON_SPACE)/2, HICON_TEXTY/2, d->ammo[d->gunselect]);
- //~}
-
- //~if(d->state != CS_DEAD && d->maxhealth > 100)
- //~{
- //~float scale = 0.66f;
- //~pushhudmatrix();
- //~hudmatrix.scale(scale, scale, 1);
- //~flushhudmatrix();
-
- //~float width, height;
- //~text_boundsf(health, width, height);
- //~draw_textf("/%d", (HICON_X + HICON_SIZE + HICON_SPACE + width*2)/scale, (HICON_TEXTY + height)/scale, d->maxhealth);
-
- //~pophudmatrix();
- //~}
-
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
@@ -1126,15 +1044,6 @@ namespace game
float ammoratio = (float)p->ammo[gun] / itemstats[gun-GUN_SG].add;
bvec color = bvec::hexcolor(p->ammo[gun] == 0 || ammoratio >= 1.0f ? 0xFFFFFF : (ammoratio >= 0.5f ? 0xFFC040 : 0xFF0000));
draw_text(label, textdrawpos.x, textdrawpos.y, color.r, color.g, color.b, alpha);
- /// ALIGN STUFF AND ADD COMMAND FOR IT...
- //~text_bounds(label, movew, moveh);
- //~moved = movew + 6;
- //~defformatstring(damagedealt, "| %d ", pwdamagedealt[gun]);
- //~draw_text(damagedealt, textdrawpos.x+moved, textdrawpos.y, color.r, color.g, color.b, alpha);
- //~text_bounds(damagedealt, movew, moveh);
- //~moved += movew;
- //~defformatstring(accuracy, "| %d %%", pwaccuracy[gun]);
- //~draw_text(accuracy, textdrawpos.x+moved, textdrawpos.y, color.r, color.g, color.b, alpha);
pophudmatrix();
}
@@ -1216,175 +1125,8 @@ namespace game
pophudmatrix();
}
- //~void newhud(int w, int h) //new SauerEnhanced HUD
- //~{
- //~if(player1->state==CS_DEAD || player1->state==CS_SPECTATOR) return;
- //~glPushMatrix();
- //~glScalef(1/1.2f, 1/1.2f, 1);
- //~pushhudmatrix();
- //~hudmatrix.scale(w/1800.0f, h/1650.0f, 1);
- //~hudmatrix.scale(1.0f/1.2f, 1.0f/1.2f, 1);
- //~flushhudmatrix();
- //~if(!m_insta) draw_textf("%d", 80, h*1.2f-128, player1->state==CS_DEAD ? 0 : player1->health);
- //~defformatstring(ammo, "%d", player1->ammo[player1->gunselect]);
- //~int wb, hb;
- //~text_bounds(ammo, wb, hb);
- //~draw_textf("%d", w*1.2f-wb-80, h*1.2f-128, player1->ammo[player1->gunselect]);
-
- //~hudmatrix.ortho(0, w, h, 0, -1, 1);
- //~resethudmatrix();
-
- //~hudshader->set();
- //~gle::colorf(1, 1, 1);
-
- //~gle::defvertex(2);
- //~gle::deftexcoord0();
-
- //~if(player1->quadmillis)
- //~{
- //~gle::begin(GL_QUADS);
- //~loopj(numdecals)
- //~{
- //~float hsz = decals[j].size, hx = clamp(decals[j].x, hsz, w-hsz), hy = clamp(decals[j].y, hsz, h-hsz), side = decals[j].side;
- //~gle::attribf(hx-hsz, hy-hsz); gle::attribf(side, 0);
- //~gle::attribf(hx+hsz, hy-hsz); gle::attribf(1-side, 0);
- //~gle::attribf(hx+hsz, hy+hsz); gle::attribf(1-side, 1);
- //~gle::attribf(hx-hsz, hy+hsz); gle::attribf(side, 1);
- //~}
- //~gle::end();
- //~settexture("packages/hud/hud_quaddamage_left.png"); //QuadDamage left glow
- //~gle::begin(GL_QUADS);
- //~gle::attribf(0, h*1.2f-207); gle::attribf(0.0f, 0.0f);
- //~gle::attribf(539, h*1.2f-207); gle::attribf(1.0f, 0.0f);
- //~gle::attribf(539, h*1.2f); gle::attribf(1.0f, 1.0f);
- //~gle::attribf(0, h*1.2f); gle::attribf(0.0f, 1.0f);
- //~gle::end();
-
- //~settexture("packages/hud/hud_quaddamage_right.png"); //QuadDamage right glow
- //~gle::begin(GL_QUADS);
- //~gle::attribf(w*1.2f-135, h*1.2f-207); gle::attribf(0.0f, 0.0f);
- //~gle::attribf(w*1.2f, h*1.2f-207); gle::attribf(1.0f, 0.0f);
- //~gle::attribf(w*1.2f, h*1.2f); gle::attribf(1.0f, 1.0f);
- //~gle::attribf(w*1.2f-135, h*1.2f); gle::attribf(0.0f, 1.0f);
- //~gle::end();
- //~}
-
- //~if(player1->maxhealth > 100)
- //~{
- //~settexture("packages/hud/hud_megahealth.png"); //HealthBoost indicator
- //~gle::begin(GL_QUADS);
- //~gle::attribf(0, h*1.2f-207); gle::attribf(0.0f, 0.0f);
- //~gle::attribf(539, h*1.2f-207); gle::attribf(1.0f, 0.0f);
- //~gle::attribf(539, h*1.2f); gle::attribf(1.0f, 1.0f);
- //~gle::attribf(0, h*1.2f); gle::attribf(0.0f, 1.0f);
- //~gle::end();
- //~}
-
- //~gle::begin(GL_QUADS);
- //~gle::attribf(w/2-speedow/2, h/2-speedoh/2); gle::attribf(0.0f, 1.0f);
- //~gle::attribf(w/2, h/2-speedoh/2); gle::attribf(1.0f, 1.0f);
- //~gle::attribf(w/2, h/2); gle::attribf(1.0f, 1.0f);
- //~gle::attribf(w/2-speedow/2, h/2); gle::attribf(0.0f, 1.0f);
- //~gle::end();
-
- //~int health = (player1->health*100)/player1->maxhealth,
- //~armour = (player1->armour*100)/200,
- //~hh = (health*101)/100;
-
- //~float hs = (health*1.0f)/100;
-
- //~if(player1->health > 0 && !m_insta)
- //~{
- //~settexture("packages/hud/hud_health.png"); //Health bar
- //~hudquad(4000, 600, 97, 56);
- //~gle::begin(GL_QUADS);
- //~gle::attribf(47, h*1.2f-hh-56); gle::attribf(0.0f, 1.0f-hs);
- //~gle::attribf(97, h*1.2f-hh-56); gle::attribf(1.0f, 1.0f-hs);
- //~gle::attribf(97, h*1.2f-57); gle::attribf(1.0f, 1.0f);
- //~gle::attribf(47, h*1.2f-57); gle::attribf(0.0f, 1.0f);
- //~gle::end();
- //~}
-
- //~if(player1->armour > 0)
- //~{
- //~settexture("packages/hud/hud_armour.png"); //Armour bar
- //~gle::begin(GL_QUADS);
- //~gle::attribf(130, h*1.2f-62);gle::attribf(0.0f, 0.0f);
- //~gle::attribf(130+ah, h*1.2f-62);gle::attribf(as, 0.0f);
- //~gle::attribf(130+ah, h*1.2f-44);gle::attribf(as, 1.0f);
- //~gle::attribf(130, h*1.2f-44);gle::attribf(0.0f, 1.0f);
- //~gle::end();
- //~}
-
- //~if(!m_insta)
- //~{
- //~settexture("packages/hud/hud_left.png"); //left HUD
- //~gle::begin(GL_QUADS);
- //~gle::attribf(0, h*1.2f-207);gle::attribf(0.0f, 0.0f);
- //~gle::attribf(539, h*1.2f-207);gle::attribf(1.0f, 0.0f);
- //~gle::attribf(539, h*1.2f );gle::attribf(1.0f, 1.0f);
- //~gle::attribf(0, h*1.2f );gle::attribf(0.0f, 1.0f);
- //~gle::end();
- //~}
-
- //~settexture("packages/hud/hud_right.png"); //right HUD
- //~gle::begin(GL_QUADS);
- //~gle::attribf(w*1.2f-135, h*1.2f-207);gle::attribf(0.0f, 0.0f);
- //~gle::attribf(w*1.2f, h*1.2f-207);gle::attribf(1.0f, 0.0f);
- //~gle::attribf(w*1.2f, h*1.2f );gle::attribf(1.0f, 1.0f);
- //~gle::attribf(w*1.2f-135, h*1.2f );gle::attribf(0.0f, 1.0f);
- //~gle::end();
-
- //~int maxammo = 0;
-
- //~switch(player1->gunselect)
- //~{
- //~case GUN_FIST:
- //~maxammo = 1;
- //~break;
-
- //~case GUN_RL:
- //~case GUN_RIFLE:
- //~maxammo = m_insta ? 100 : 15;
- //~break;
-
- //~case GUN_SG:
- //~case GUN_GL:
- //~maxammo = 30;
- //~break;
-
- //~case GUN_CG:
- //~maxammo = 60;
- //~break;
-
- //~case GUN_PISTOL:
- //~maxammo = 120;
- //~break;
- //~}
-
- //~int curammo = (player1->ammo[player1->gunselect]*100)/maxammo,
- //~amh = (curammo*101)/100;
-
- //~float ams = (curammo*1.0f)/100;
-
- //~if(player1->ammo[player1->gunselect] > 0)
- //~{
- //~settexture("packages/hud/hud_health.png"); //Ammo bar
- //~gle::begin(GL_QUADS);
- //~gle::attribf(w*1.2f-47, h*1.2f-amh-56);gle::attribf(0.0f, 1.0f-ams);
- //~gle::attribf(w*1.2f-97, h*1.2f-amh-56);gle::attribf(1.0f, 1.0f-ams);
- //~gle::attribf(w*1.2f-97, h*1.2f-57 );gle::attribf(1.0f, 1.0f);
- //~gle::attribf(w*1.2f-47, h*1.2f-57 );gle::attribf(0.0f, 1.0f);
- //~gle::end();
- //~}
- //~glPopMatrix();
- //~pophudmatrix();
- //~}
-
void gameplayhud(int w, int h)
{
- //~newhud(w, h);
-
pushhudmatrix();
hudmatrix.scale(h/1800.0f, h/1800.0f, 1);
flushhudmatrix();
@@ -1407,10 +1149,6 @@ namespace game
}
fpsent *d = hudplayer();
- if(d->state!=CS_EDITING)
- {
- if(cmode) cmode->drawhud(d, w, h);
- }
pophudmatrix();
@@ -1448,7 +1186,6 @@ namespace game
int clipconsole(int w, int h)
{
- if(cmode) return cmode->clipconsole(w, h);
return 0;
}
diff --git a/src/fpsgame/game.h b/src/fpsgame/game.h
index 4a09d3f..d99bf70 100644
--- a/src/fpsgame/game.h
+++ b/src/fpsgame/game.h
@@ -569,36 +569,6 @@ namespace entities
namespace game
{
- struct clientmode
- {
- virtual ~clientmode() {}
-
- virtual void preload() {}
- virtual int clipconsole(int w, int h) { return 0; }
- virtual void drawhud(fpsent *d, int w, int h) {}
- virtual void rendergame() {}
- virtual void respawned(fpsent *d) {}
- virtual void setup() {}
- virtual void checkitems(fpsent *d) {}
- virtual int respawnwait(fpsent *d, int delay = 0) { return 0; }
- virtual int getspawngroup(fpsent *d) { return 0; }
- virtual float ratespawn(fpsent *d, const extentity &e) { return 1.0f; }
- virtual void senditems(packetbuf &p) {}
- virtual void removeplayer(fpsent *d) {}
- virtual void died(fpsent *victim, fpsent *actor) {}
- virtual void gameover() {}
- virtual bool hidefrags() { return false; }
- virtual int getteamscore(const char *team) { return 0; }
- virtual void getteamscores(vector<teamscore> &scores) {}
- virtual void aifind(fpsent *d, ai::aistate &b, vector<ai::interest> &interests) {}
- virtual bool aicheck(fpsent *d, ai::aistate &b) { return false; }
- virtual bool aidefend(fpsent *d, ai::aistate &b) { return false; }
- virtual bool aipursue(fpsent *d, ai::aistate &b) { return false; }
- };
-
- extern clientmode *cmode;
- extern void setclientmode();
-
// fps
extern int gamemode, nextmode;
extern string clientmap;
@@ -666,7 +636,6 @@ namespace game
extern void explode(bool local, fpsent *owner, const vec &v, dynent *safe, int dam, int gun);
extern void explodeeffects(int gun, fpsent *d, bool local, int id = 0);
extern void damageeffect(int damage, fpsent *d, bool thirdperson = true);
- //~extern void gibeffect(int damage, const vec &vel, fpsent *d);
extern float intersectdist;
extern bool intersect(dynent *d, const vec &from, const vec &to, float &dist = intersectdist);
extern dynent *intersectclosest(const vec &from, const vec &to, fpsent *at, float &dist = intersectdist);
diff --git a/src/fpsgame/render.cpp b/src/fpsgame/render.cpp
index 51fb0d9..b79d73a 100644
--- a/src/fpsgame/render.cpp
+++ b/src/fpsgame/render.cpp
@@ -293,11 +293,6 @@ namespace game
entities::renderentities();
renderbouncers();
renderprojectiles();
- if(cmode) cmode->rendergame();
-
-#if 0
- if(dbgspawns) renderspawns();
-#endif
endmodelbatches();
}
diff --git a/src/fpsgame/scoreboard.cpp b/src/fpsgame/scoreboard.cpp
index 2bc82d2..5e0ae17 100644
--- a/src/fpsgame/scoreboard.cpp
+++ b/src/fpsgame/scoreboard.cpp
@@ -56,10 +56,9 @@ namespace game
void getbestteams(vector<const char *> &best)
{
- if(cmode && cmode->hidefrags())
+ if(!hidefrags)
{
vector<teamscore> teamscores;
- cmode->getteamscores(teamscores);
teamscores.sort(teamscore::compare);
while(teamscores.length() > 1 && teamscores.last().score < teamscores[0].score) teamscores.drop();
loopv(teamscores) best.add(teamscores[i].team);
@@ -121,7 +120,6 @@ namespace game
scoregroup &g = *groups[numgroups++];
g.team = team;
if(!team) g.score = 0;
- else if(cmode && cmode->hidefrags()) g.score = cmode->getteamscore(o->team);
else { teaminfo *ti = teaminfos.access(team); g.score = ti ? ti->frags : 0; }
g.players.setsize(0);
g.players.add(o);
@@ -236,7 +234,7 @@ namespace game
g.pushlist(); // horizontal
}
- if(!cmode || !cmode->hidefrags() || !hidefrags)
+ if(!hidefrags)
{
g.pushlist();
g.strut(6);
diff --git a/src/fpsgame/server.cpp b/src/fpsgame/server.cpp
index e085484..08316d8 100644
--- a/src/fpsgame/server.cpp
+++ b/src/fpsgame/server.cpp
@@ -813,39 +813,6 @@ namespace server
return cname[cidx];
}
- struct servmode
- {
- virtual ~servmode() {}
-
- virtual void entergame(clientinfo *ci) {}
- virtual void leavegame(clientinfo *ci, bool disconnecting = false) {}
-
- virtual void moved(clientinfo *ci, const vec &oldpos, bool oldclip, const vec &newpos, bool newclip) {}
- virtual bool canspawn(clientinfo *ci, bool connecting = false) { return true; }
- virtual void spawned(clientinfo *ci) {}
- virtual int fragvalue(clientinfo *victim, clientinfo *actor)
- {
- if(victim==actor || isteam(victim->team, actor->team)) return -1;
- return 1;
- }
- virtual void died(clientinfo *victim, clientinfo *actor) {}
- virtual bool canchangeteam(clientinfo *ci, const char *oldteam, const char *newteam) { return true; }
- virtual void changeteam(clientinfo *ci, const char *oldteam, const char *newteam) {}
- virtual void initclient(clientinfo *ci, packetbuf &p, bool connecting) {}
- virtual void update() {}
- virtual void cleanup() {}
- virtual void setup() {}
- virtual void newmap() {}
- virtual void intermission() {}
- virtual bool hidefrags() { return false; }
- virtual int getteamscore(const char *team) { return 0; }
- virtual void getteamscores(vector<teamscore> &scores) {}
- virtual bool extinfoteam(const char *team, ucharbuf &p) { return false; }
- };
-
- #define SERVMODE 1
- 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)
@@ -963,8 +930,7 @@ namespace server
float rank;
clientinfo *ci = choosebestclient(rank);
if(!ci) break;
- if(smode && smode->hidefrags()) rank = 1;
- else if(selected && rank<=0) break;
+ if(selected && rank<=0) break;
ci->state.timeplayed = -1;
team[first].add(ci);
if(rank>0) teamrank[first] += rank;
@@ -981,7 +947,7 @@ namespace server
{
clientinfo *ci = team[i][j];
if(!strcmp(ci->team, teamnames[i])) continue;
- if(persistteams && ci->team[0] && (!smode || smode->canchangeteam(ci, teamnames[i], ci->team)))
+ if(persistteams && ci->team[0])
{
addteaminfo(ci->team);
continue;
@@ -1024,11 +990,7 @@ namespace server
loopi(numteams-1)
{
teamrank &ts = teamranks[i];
- if(smode && smode->hidefrags())
- {
- if(ts.clients < worst->clients || (ts.clients == worst->clients && ts.rank < worst->rank)) worst = &ts;
- }
- else if(ts.rank < worst->rank || (ts.rank == worst->rank && ts.clients < worst->clients)) worst = &ts;
+ if(ts.rank < worst->rank || (ts.rank == worst->rank && ts.clients < worst->clients)) worst = &ts;
}
return worst->name;
}
@@ -1939,22 +1901,12 @@ namespace server
}
if(ci && (m_demo || m_mp(gamemode)) && ci->state.state!=CS_SPECTATOR)
{
- if(smode && !smode->canspawn(ci, true))
- {
- ci->state.state = CS_DEAD;
- putint(p, N_FORCEDEATH);
- putint(p, ci->clientnum);
- sendf(-1, 1, "ri2x", N_FORCEDEATH, ci->clientnum, ci->clientnum);
- }
- else
- {
- gamestate &gs = ci->state;
- spawnstate(ci);
- putint(p, N_SPAWNSTATE);
- putint(p, ci->clientnum);
- sendstate(gs, p);
- gs.lastspawn = gamemillis;
- }
+ gamestate &gs = ci->state;
+ spawnstate(ci);
+ putint(p, N_SPAWNSTATE);
+ putint(p, ci->clientnum);
+ sendstate(gs, p);
+ gs.lastspawn = gamemillis;
}
if(ci && ci->state.state==CS_SPECTATOR)
{
@@ -1981,7 +1933,6 @@ namespace server
putint(p, -1);
welcomeinitclient(p, ci ? ci->clientnum : -1);
}
- if(smode) smode->initclient(ci, p, true);
return 1;
}
@@ -2037,7 +1988,6 @@ namespace server
stopdemo();
pausegame(false);
changegamespeed(100);
- if(smode) smode->cleanup();
aiman::clearai();
gamemode = mode;
@@ -2060,8 +2010,6 @@ namespace server
sendf(-1, 1, "risii", N_MAPCHANGE, smapname, gamemode, 1);
- smode = NULL;
-
clearteaminfo();
if(m_teammode) autoteam();
@@ -2085,8 +2033,6 @@ namespace server
if(demonextmatch) setupdemorecord();
demonextmatch = autorecorddemo!=0;
}
-
- if(smode) smode->setup();
}
void rotatemap(bool next)
@@ -2208,18 +2154,12 @@ namespace server
if(m_teammode)
{
vector<teamscore> scores;
- if(smode && smode->hidefrags()) smode->getteamscores(scores);
loopv(clients)
{
clientinfo *ci = clients[i];
if(ci->state.state==CS_SPECTATOR || !ci->team[0]) continue;
int score = 0;
- if(smode && smode->hidefrags())
- {
- int idx = scores.htfind(ci->team);
- if(idx >= 0) score = scores[idx].score;
- }
- else if(teaminfo *ti = teaminfos.access(ci->team)) score = ti->frags;
+ if(teaminfo *ti = teaminfos.access(ci->team)) score = ti->frags;
if(!topteam || score > topscore) { topteam = ci->team; topscore = score; tied = false; }
else if(score == topscore && strcmp(ci->team, topteam)) tied = true;
}
@@ -2247,7 +2187,6 @@ namespace server
if(gamemillis >= gamelimit && !interm && (force || !checkovertime()))
{
sendf(-1, 1, "ri2", N_TIMEUP, 0);
- if(smode) smode->intermission();
changegamespeed(100);
interm = gamemillis + 10000;
}
@@ -2271,7 +2210,7 @@ namespace server
if(ts.health<=0)
{
target->state.deaths++;
- int fragvalue = smode ? smode->fragvalue(target, actor) : (target==actor || isteam(target->team, actor->team) ? -1 : 1);
+ int fragvalue = (target==actor || isteam(target->team, actor->team) ? -1 : 1);
actor->state.frags += fragvalue;
if(fragvalue>0)
{
@@ -2284,7 +2223,6 @@ namespace server
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))
@@ -2302,14 +2240,13 @@ namespace server
{
gamestate &gs = ci->state;
if(gs.state!=CS_ALIVE) return;
- int fragvalue = smode ? smode->fragvalue(ci, ci) : -1;
+ int fragvalue = -1;
ci->state.frags += fragvalue;
ci->state.deaths++;
teaminfo *t = m_teammode ? teaminfos.access(ci->team) : NULL;
if(t) t->frags += fragvalue;
sendf(-1, 1, "ri5", N_DIED, ci->clientnum, ci->clientnum, gs.frags, t ? t->frags : 0);
ci->position.setsize(0);
- if(smode) smode->died(ci, NULL);
gs.state = CS_DEAD;
gs.lastdeath = gamemillis;
gs.respawn();
@@ -2495,7 +2432,6 @@ namespace server
}
}
aiman::checkai();
- if(smode) smode->update();
}
}
@@ -2533,7 +2469,6 @@ namespace server
void forcespectator(clientinfo *ci)
{
if(ci->state.state==CS_ALIVE) suicide(ci);
- if(smode) smode->leavegame(ci);
ci->state.state = CS_SPECTATOR;
ci->state.timeplayed += lastmillis - ci->state.lasttimeplayed;
if(!ci->local && (!ci->privilege || ci->warned)) aiman::removeai(ci);
@@ -2652,7 +2587,7 @@ namespace server
clientdisconnect(n);
}
- int clientconnect(int n, uint ip)
+ int clientconnect(int n)
{
clientinfo *ci = getinfo(n);
ci->clientnum = ci->ownernum = n;
@@ -2672,7 +2607,6 @@ namespace server
if(ci->connected)
{
if(ci->privilege) setmaster(ci, false);
- if(smode) smode->leavegame(ci, true);
ci->state.timeplayed += lastmillis - ci->state.lasttimeplayed;
savescore(ci);
sendf(-1, 1, "ri2", N_CDIS, n);
@@ -3063,7 +2997,6 @@ namespace server
cp->position.setsize(0);
while(curmsg<p.length()) cp->position.add(p.buf[curmsg++]);
}
- if(smode && cp->state.state==CS_ALIVE) smode->moved(cp, cp->state.o, cp->gameclip, pos, (flags&0x80)!=0);
cp->state.o = pos;
cp->gameclip = (flags&0x80)!=0;
}
@@ -3114,11 +3047,6 @@ namespace server
int val = getint(p);
if(!ci->local && !m_edit) break;
if(val ? ci->state.state!=CS_ALIVE && ci->state.state!=CS_DEAD : ci->state.state!=CS_EDITING) break;
- if(smode)
- {
- if(val) smode->leavegame(ci);
- else smode->entergame(ci);
- }
if(val)
{
ci->state.editstate = ci->state.state;
@@ -3159,7 +3087,7 @@ namespace server
break;
case N_TRYSPAWN:
- if(!ci || !cq || cq->state.state!=CS_DEAD || cq->state.lastspawn>=0 || (smode && !smode->canspawn(cq))) break;
+ if(!ci || !cq || cq->state.state!=CS_DEAD || cq->state.lastspawn>=0) break;
if(!ci->clientmap[0] && !ci->mapcrc)
{
ci->mapcrc = -1;
@@ -3194,7 +3122,6 @@ namespace server
cq->state.state = CS_ALIVE;
cq->state.gunselect = gunselect >= GUN_FIST && gunselect <= GUN_PISTOL ? gunselect : GUN_FIST;
cq->exceeded = 0;
- if(smode) smode->spawned(cq);
QUEUE_AI;
QUEUE_BUF({
putint(cm->messages, N_SPAWN);
@@ -3317,7 +3244,7 @@ namespace server
{
getstring(text, p);
filtertext(text, text, false, false, MAXTEAMLEN);
- if(m_teammode && text[0] && strcmp(ci->team, text) && (!smode || smode->canchangeteam(ci, ci->team, text)) && addteaminfo(text))
+ if(m_teammode && text[0] && strcmp(ci->team, text) && addteaminfo(text))
{
if(ci->state.state==CS_ALIVE) suicide(ci);
copystring(ci->team, text);
@@ -3475,7 +3402,7 @@ namespace server
if(!ci->privilege && !ci->local) break;
clientinfo *wi = getinfo(who);
if(!m_teammode || !text[0] || !wi || !wi->connected || !strcmp(wi->team, text)) break;
- if((!smode || smode->canchangeteam(wi, wi->team, text)) && addteaminfo(text))
+ if(addteaminfo(text))
{
if(wi->state.state==CS_ALIVE) suicide(wi);
copystring(wi->team, text, MAXTEAMLEN+1);
@@ -3552,7 +3479,6 @@ namespace server
smapname[0] = '\0';
resetitems();
notgotitems = false;
- if(smode) smode->newmap();
}
QUEUE_MSG;
break;
@@ -3789,11 +3715,6 @@ namespace server
sendserverinforeply(p);
}
- bool servercompatible(char *name, char *sdec, char *map, int ping, const vector<int> &attr, int np)
- {
- return attr.length() && attr[0]==PROTOCOL_VERSION;
- }
-
#include "aiman.h"
}
diff --git a/src/fpsgame/weapon.cpp b/src/fpsgame/weapon.cpp
index 6ade009..d911aba 100644
--- a/src/fpsgame/weapon.cpp
+++ b/src/fpsgame/weapon.cpp
@@ -13,8 +13,6 @@ namespace game
};
vector<hitmsg> hits;
- //~VARP(maxdebris, 10, 25, 1000);
-
ICOMMAND(getweapon, "", (), intret(player1->gunselect));
void gunselect(int gun, fpsent *d)
@@ -133,7 +131,6 @@ namespace game
loopi(guns[gun].rays) offsetray(from, to, guns[gun].spread, guns[gun].range, rays[i]);
}
- //~enum { BNC_GRENADE, BNC_GIBS, BNC_DEBRIS };
enum { BNC_GRENADE };
struct bouncer : physent
@@ -181,7 +178,6 @@ namespace game
{
bouncer &bnc = *bouncers.add(new bouncer);
bnc.o = from;
- //~bnc.radius = bnc.xradius = bnc.yradius = type==BNC_DEBRIS ? 0.5f : 1.5f;
bnc.radius = bnc.xradius = bnc.yradius = 1.5f;
bnc.eyeheight = bnc.radius;
bnc.aboveeye = bnc.radius;
@@ -194,13 +190,6 @@ namespace game
bnc.collidetype = COLLIDE_ELLIPSE_PRECISE;
- //~switch(type)
- //~{
- //~case BNC_GRENADE: bnc.collidetype = COLLIDE_ELLIPSE_PRECISE; break;
- //~case BNC_DEBRIS: bnc.variant = rnd(4); break;
- //~case BNC_GIBS: bnc.variant = rnd(3); break;
- //~}
-
vec dir(to);
dir.sub(from).safenormalize();
bnc.vel = dir;
@@ -225,7 +214,6 @@ namespace game
{
if(d->type != ENT_BOUNCE) return;
bouncer *b = (bouncer *)d;
- //~if(b->bouncetype != BNC_GIBS || b->bounces >= 2) return;
if(b->bounces >= 2) return;
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));
@@ -244,16 +232,7 @@ namespace game
vec old(bnc.o);
bool stopped = false;
if(bnc.bouncetype==BNC_GRENADE) stopped = bounce(&bnc, 0.6f, 0.5f, 0.8f) || (bnc.lifetime -= time)<0;
- //~else
- //~{
- //~// cheaper variable rate physics for debris, gibs, etc.
- //~for(int rtime = time; rtime > 0;)
- //~{
- //~int qtime = min(30, rtime);
- //~rtime -= qtime;
- //~if((bnc.lifetime -= qtime)<0 || bounce(&bnc, qtime/1000.0f, 0.6f, 0.5f, 1)) { stopped = true; break; }
- //~}
- //~}
+
if(stopped)
{
if(bnc.bouncetype==BNC_GRENADE)
@@ -345,13 +324,6 @@ namespace game
newbouncer(p, to, true, 0, d, type, rnd(1000)+1000, rnd(100)+20, light);
}
- //~void gibeffect(int damage, const vec &vel, fpsent *d)
- //~{
- //~if(!blood || damage <= 0) return;
- //~vec from = d->abovehead();
- //~loopi(min(damage/25, 40)+1) spawnbouncer(from, vel, d, BNC_GIBS);
- //~}
-
void hit(int damage, dynent *d, fpsent *at, const vec &vel, int gun, float info1, int info2 = 1)
{
if(at==player1 && d!=at)
@@ -433,16 +405,6 @@ 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 = 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)
- //~{
- //~entitylight light;
- //~lightreaching(debrisorigin, light.color, light.dir);
- //~loopi(numdebris)
- //~spawnbouncer(debrisorigin, debrisvel, owner, BNC_DEBRIS, &light);
- //~}
if(!local) return;
int numdyn = numdynents();
loopi(numdyn)
@@ -583,8 +545,6 @@ namespace game
{
case GUN_FIST:
if(d->type==ENT_PLAYER && chainsawhudgun) sound = S_CHAINSAW_ATTACK;
- //~if(d->quadmillis)
- //~particle_splash(PART_FLAME, 60, 300, vec(0).sub(from), 0x802010, 0.24f);
break;
case GUN_SG:
@@ -841,14 +801,9 @@ 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" };
- void preloadbouncers()
- {
+ 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]);
}
void renderbouncers()
@@ -875,12 +830,6 @@ namespace game
int cull = MDL_CULL_VFC|MDL_CULL_DIST|MDL_CULL_OCCLUDED;
float fade = 1;
if(bnc.lifetime < 250) fade = bnc.lifetime/250.0f;
- //~switch(bnc.bouncetype)
- //~{
- //~case BNC_GIBS: mdl = gibnames[bnc.variant]; cull |= MDL_LIGHT|MDL_LIGHT_FAST|MDL_DYNSHADOW; break;
- //~case BNC_DEBRIS: mdl = debrisnames[bnc.variant]; break;
- //~default: continue;
- //~}
rendermodel(&bnc.light, mdl, ANIM_MAPMODEL|ANIM_LOOP, pos, yaw, pitch, cull, NULL, NULL, 0, 0, fade);
}
}