From c46daa31f8e0339aed12736699d0003d27f1fc7e Mon Sep 17 00:00:00 2001 From: xolatile Date: Sun, 20 Jul 2025 12:18:48 +0200 Subject: Most warnings fixed, ignoring one warning for now... --- src/fpsgame/ai.cpp | 15 ++++++++++++--- src/fpsgame/client.cpp | 10 +--------- src/fpsgame/entities.cpp | 27 +++++++++++++++++++++++++-- src/fpsgame/fps.cpp | 1 + src/fpsgame/game.h | 44 +++++++++++++++++++++++++++++++------------- src/fpsgame/game.h.gch | Bin 76110237 -> 0 bytes src/fpsgame/render.cpp | 4 ++-- src/fpsgame/server.cpp | 6 ++++-- 8 files changed, 76 insertions(+), 31 deletions(-) delete mode 100644 src/fpsgame/game.h.gch (limited to 'src/fpsgame') 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=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=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 || armourabovehead().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); } -- cgit v1.2.3