From a89dca11cf475e0bd1399cf5d5c5135d00495ec3 Mon Sep 17 00:00:00 2001 From: xolatile Date: Mon, 4 Aug 2025 18:17:30 +0200 Subject: Minor changes... --- src/fpsgame/ai.cpp | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) (limited to 'src/fpsgame/ai.cpp') 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; -- cgit v1.2.3