summaryrefslogtreecommitdiff
path: root/src/fpsgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/fpsgame')
-rw-r--r--src/fpsgame/ai.cpp15
-rw-r--r--src/fpsgame/client.cpp10
-rw-r--r--src/fpsgame/entities.cpp27
-rw-r--r--src/fpsgame/fps.cpp1
-rw-r--r--src/fpsgame/game.h44
-rw-r--r--src/fpsgame/game.h.gchbin76110237 -> 0 bytes
-rw-r--r--src/fpsgame/render.cpp4
-rw-r--r--src/fpsgame/server.cpp6
8 files changed, 76 insertions, 31 deletions
diff --git a/src/fpsgame/ai.cpp b/src/fpsgame/ai.cpp
index d5045fd..50f0549 100644
--- a/src/fpsgame/ai.cpp
+++ b/src/fpsgame/ai.cpp
@@ -603,8 +603,14 @@ namespace ai
bool wantsitem = false;
switch(entities::ents[ent]->type)
{
- case I_BOOST: case I_HEALTH: wantsitem = badhealth(d); break;
- case I_GREENARMOUR: case I_YELLOWARMOUR: case I_QUAD: break;
+ case I_BOOST:
+
+ case I_HEALTH: wantsitem = badhealth(d); break;
+ case I_GREENARMOUR:
+
+ case I_YELLOWARMOUR:
+
+ case I_QUAD: break;
default:
{
itemstat &is = itemstats[entities::ents[ent]->type-I_SHELLS];
@@ -871,8 +877,11 @@ namespace ai
switch(wpspot(d, d->ai->route[n], true))
{
case 2: d->ai->clear(false);
+
case 1: return true; // not close enough to pop it yet
- case 0: default: break;
+ case 0:
+
+ default: break;
}
}
else
diff --git a/src/fpsgame/client.cpp b/src/fpsgame/client.cpp
index 35aabd4..609ce93 100644
--- a/src/fpsgame/client.cpp
+++ b/src/fpsgame/client.cpp
@@ -1100,6 +1100,7 @@ namespace game
d->health = getint(p);
d->maxhealth = getint(p);
d->armour = getint(p);
+ d->maxarmour = getint(p);
d->armourtype = getint(p);
if(resume && d==player1)
{
@@ -1171,7 +1172,6 @@ namespace game
int val = clamp(getint(p), 10, 1000), cn = getint(p);
fpsent *a = cn >= 0 ? getclient(cn) : NULL;
if(!demopacket) gamespeed = val;
- extern int slowmosp;
if(a) conoutf("%s set gamespeed to %d", colorname(a), val);
else conoutf("gamespeed is %d", val);
break;
@@ -1299,15 +1299,7 @@ namespace game
break;
case N_SWITCHMODEL:
- {
- int model = getint(p);
- if(d)
- {
- d->playermodel = 0;
- if(d->ragdoll) cleanragdoll(d);
- }
break;
- }
case N_CDIS:
clientdisconnected(getint(p));
diff --git a/src/fpsgame/entities.cpp b/src/fpsgame/entities.cpp
index 1410679..3403c2e 100644
--- a/src/fpsgame/entities.cpp
+++ b/src/fpsgame/entities.cpp
@@ -76,10 +76,32 @@ namespace entities
{
switch(i)
{
- case I_SHELLS: case I_BULLETS: case I_ROCKETS: case I_ROUNDS: case I_GRENADES: case I_CARTRIDGES:
+ case I_SHELLS:
+
+ case I_BULLETS:
+
+ case I_ROCKETS:
+
+ case I_ROUNDS:
+
+ case I_GRENADES:
+
+ case I_CARTRIDGES:
if(m_noammo) continue;
break;
- case I_HEALTH: case I_BOOST: case I_TINYHEALTH: case I_TINYARMOUR: case I_GREENARMOUR: case I_YELLOWARMOUR: case I_QUAD:
+ case I_HEALTH:
+
+ case I_BOOST:
+
+ case I_TINYHEALTH:
+
+ case I_TINYARMOUR:
+
+ case I_GREENARMOUR:
+
+ case I_YELLOWARMOUR:
+
+ case I_QUAD:
if(m_noitems) continue;
break;
}
@@ -94,6 +116,7 @@ namespace entities
{
case TELEPORT:
if(e.attr2 > 0) preloadmodel(mapmodelname(e.attr2));
+
case JUMPPAD:
if(e.attr4 > 0) preloadmapsound(e.attr4);
break;
diff --git a/src/fpsgame/fps.cpp b/src/fpsgame/fps.cpp
index f5ce95c..35a5d65 100644
--- a/src/fpsgame/fps.cpp
+++ b/src/fpsgame/fps.cpp
@@ -590,6 +590,7 @@ namespace game
d->totaldamage = 0;
d->totalshots = 0;
d->maxhealth = 100;
+ d->maxarmour = 50;
d->lifesequence = -1;
d->respawned = d->suicided = -2;
}
diff --git a/src/fpsgame/game.h b/src/fpsgame/game.h
index 185fd60..df0eeb5 100644
--- a/src/fpsgame/game.h
+++ b/src/fpsgame/game.h
@@ -246,8 +246,8 @@ static struct itemstat {
{100, 200, S_ITEMHEALTH, "MH", HICON_HEALTH, 50},
{5, 100, S_ITEMHEALTH, "TH", HICON_HEALTH, -1},
{5, 50, S_ITEMARMOUR, "TA", HICON_BLUE_ARMOUR, A_BLUE},
- {100, 100, S_ITEMARMOUR, "GA", HICON_GREEN_ARMOUR, A_GREEN},
- {200, 200, S_ITEMARMOUR, "YA", HICON_YELLOW_ARMOUR, A_YELLOW},
+ {50, 100, S_ITEMARMOUR, "GA", HICON_GREEN_ARMOUR, A_GREEN},
+ {100, 200, S_ITEMARMOUR, "YA", HICON_YELLOW_ARMOUR, A_YELLOW},
{20000, 30000, S_ITEMPUP, "Q", HICON_QUAD, -1},
};
@@ -277,13 +277,13 @@ static const struct guninfo {
struct fpsstate
{
int health, maxhealth;
- int armour, armourtype;
+ int armour, maxarmour, armourtype;
int quadmillis;
int gunselect, gunwait;
int ammo[NUMGUNS];
int aitype, skill;
- fpsstate() : maxhealth(100), aitype(AI_NONE), skill(0) {}
+ fpsstate() : maxhealth(100), maxarmour(50), aitype(AI_NONE), skill(0) {}
void baseammo(int gun, int k = 2, int scale = 1)
{
@@ -311,12 +311,19 @@ struct fpsstate
case I_BOOST: return maxhealth<is.max || health<maxhealth;
case I_TINYHEALTH: return health<maxhealth;
case I_HEALTH: return health<maxhealth;
+
case I_TINYARMOUR:
- if(armourtype==A_GREEN || armourtype==A_YELLOW || armour>=50)return false;
+
case I_GREENARMOUR:
- // (100h/100g only absorbs 200 damage)
- if(armourtype==A_YELLOW && armour>=100)return false;
- case I_YELLOWARMOUR: return !armourtype || armour<is.max;
+
+ case I_YELLOWARMOUR: return maxarmour<is.max || armour<maxarmour;
+
+ //~case I_TINYARMOUR:
+ //~if(armourtype==A_GREEN || armourtype==A_YELLOW || armour>=50)return false;
+ //~case I_GREENARMOUR:
+ //~// (100h/100g only absorbs 200 damage)
+ //~if(armourtype==A_YELLOW && armour>=100)return false;
+ //~case I_YELLOWARMOUR: return !armourtype || armour<is.max;
case I_QUAD: return quadmillis<is.max;
default: return ammo[is.info]<is.max;
}
@@ -331,20 +338,30 @@ struct fpsstate
case I_TINYHEALTH:
health = min(health+is.add, maxhealth);
break;
- case I_TINYARMOUR:
- armour = min(armour+is.add, is.max);
- armourtype = A_BLUE;
- break;
+ //~case I_TINYARMOUR:
+ //~armour = min(armour+is.add, is.max);
+ //~armourtype = A_BLUE;
+ //~break;
case I_BOOST:
maxhealth = min(maxhealth+is.info, is.max);
+
case I_HEALTH: // boost also adds to health
health = min(health+is.add, maxhealth);
break;
+ case I_TINYARMOUR:
+
case I_GREENARMOUR:
+
case I_YELLOWARMOUR:
- armour = min(armour+is.add, is.max);
+ maxarmour = max(maxarmour, is.max);
+ armour = min(armour+is.add, maxarmour);
armourtype = is.info;
break;
+ //~case I_GREENARMOUR:
+ //~case I_YELLOWARMOUR:
+ //~armour = min(armour+is.add, is.max);
+ //~armourtype = is.info;
+ //~break;
case I_QUAD:
quadmillis = min(quadmillis+is.add, is.max);
break;
@@ -358,6 +375,7 @@ struct fpsstate
{
maxhealth = 100;
health = maxhealth;
+ maxarmour = 50;
armour = 0;
armourtype = A_BLUE;
quadmillis = 0;
diff --git a/src/fpsgame/game.h.gch b/src/fpsgame/game.h.gch
deleted file mode 100644
index 2b92d8d..0000000
--- a/src/fpsgame/game.h.gch
+++ /dev/null
Binary files differ
diff --git a/src/fpsgame/render.cpp b/src/fpsgame/render.cpp
index 4c06e07..51fb0d9 100644
--- a/src/fpsgame/render.cpp
+++ b/src/fpsgame/render.cpp
@@ -176,7 +176,7 @@ namespace game
VARP(statusicons, 0, 1, 1);
- void renderstatusicons(fpsent *d, int team, float yoffset)
+ void renderstatusicons(fpsent *d, int team, float yoffset)///TODO
{
vec p = d->abovehead().madd(camup, yoffset);
int icons = 0;
@@ -217,7 +217,7 @@ namespace game
VARP(statusbars, 0, 1, 2);
FVARP(statusbarscale, 0, 1, 2);
- float renderstatusbars(fpsent *d, int team)
+ float renderstatusbars(fpsent *d, int team)///TODO
{
if(!statusbars || m_insta || (player1->state==CS_SPECTATOR ? statusbars <= 1 : team != 1) || (d->state!=CS_ALIVE && d->state!=CS_LAGGED)) return 0;
vec p = d->abovehead().msub(camdir, 50/80.0f).msub(camup, 2.0f);
diff --git a/src/fpsgame/server.cpp b/src/fpsgame/server.cpp
index 7ea00a1..2df61f1 100644
--- a/src/fpsgame/server.cpp
+++ b/src/fpsgame/server.cpp
@@ -143,6 +143,7 @@ namespace server
{
if(state!=CS_SPECTATOR) state = editstate = CS_DEAD;
maxhealth = 100;
+ maxarmour = 50;
rockets.reset();
grenades.reset();
@@ -1796,6 +1797,7 @@ namespace server
putint(p, gs.health);
putint(p, gs.maxhealth);
putint(p, gs.armour);
+ putint(p, gs.maxarmour);
putint(p, gs.armourtype);
putint(p, gs.gunselect);
loopi(GUN_PISTOL-GUN_SG+1) putint(p, gs.ammo[GUN_SG+i]);
@@ -1814,7 +1816,7 @@ namespace server
spawnstate(ci);
sendf(ci->ownernum, 1, "rii7v", N_SPAWNSTATE, ci->clientnum, gs.lifesequence,
gs.health, gs.maxhealth,
- gs.armour, gs.armourtype,
+ gs.armour, gs.maxarmour, gs.armourtype,
gs.gunselect, GUN_PISTOL-GUN_SG+1, &gs.ammo[GUN_SG]);
gs.lastspawn = gamemillis;
}
@@ -2001,7 +2003,7 @@ namespace server
gs.frags, gs.flags, gs.deaths, gs.quadmillis,
gs.lifesequence,
gs.health, gs.maxhealth,
- gs.armour, gs.armourtype,
+ gs.armour, gs.maxarmour, gs.armourtype,
gs.gunselect, GUN_PISTOL-GUN_SG+1, &gs.ammo[GUN_SG], -1);
}