Skip to content

Commit 9c85597

Browse files
committed
MOAR
1 parent 25d5448 commit 9c85597

File tree

1 file changed

+215
-0
lines changed

1 file changed

+215
-0
lines changed

src/SB/Game/zNPCGoalRobo.cpp

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,109 @@ S32 zNPCGoalAlertChomper::Enter(F32 dt, void* updCtxt)
12401240
return zNPCGoalCommon::Enter(dt, updCtxt);
12411241
}
12421242

1243+
S32 zNPCGoalAlertChomper::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn)
1244+
{
1245+
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
1246+
S32 nextgoal = 0;
1247+
S32 subenter;
1248+
en_alertchomp old_alertchomp;
1249+
F32 pct;
1250+
if (globals.player.Health < 1)
1251+
{
1252+
zNPCGoalLoopAnim* taunt = (zNPCGoalLoopAnim*)psyche->FindGoal(NPC_GOAL_TAUNT);
1253+
taunt->LoopCountSet(1000);
1254+
*trantype = GOAL_TRAN_PUSH;
1255+
nextgoal = NPC_GOAL_TAUNT;
1256+
}
1257+
else if (globals.player.DamageTimer > 0.5f)
1258+
{
1259+
*trantype = GOAL_TRAN_PUSH;
1260+
nextgoal = NPC_GOAL_TAUNT;
1261+
}
1262+
else if (npc->SomethingWonderful() != 0)
1263+
{
1264+
*trantype = GOAL_TRAN_SET;
1265+
nextgoal = NPC_GOAL_IDLE;
1266+
}
1267+
else if (!npc->arena.IncludesPlayer(0, 0))
1268+
{
1269+
*trantype = GOAL_TRAN_SET;
1270+
nextgoal = NPC_GOAL_IDLE;
1271+
}
1272+
if (*trantype != GOAL_TRAN_NONE)
1273+
{
1274+
return nextgoal;
1275+
}
1276+
old_alertchomp = alertchomp;
1277+
subenter = flg_info & 2;
1278+
flg_info &= 0xFFFFFFF9;
1279+
pct = npc->arena.PctFromHome(npc->Pos());
1280+
if (pct > 1.0f)
1281+
{
1282+
alertchomp = CHOMPER_ALERT_ARENA;
1283+
DoAutoAnim(NPC_GSPOT_STARTALT, 0);
1284+
}
1285+
else if ((alertchomp == 1) && (pct < 0.5f))
1286+
{
1287+
alertchomp = CHOMPER_ALERT_CHASE;
1288+
}
1289+
switch (alertchomp)
1290+
{
1291+
case CHOMPER_ALERT_NOTICE:
1292+
alertchomp = CHOMPER_ALERT_CHASE;
1293+
nextgoal = NPC_GOAL_NOTICE;
1294+
*trantype = GOAL_TRAN_PUSH;
1295+
break;
1296+
case CHOMPER_ALERT_ARENA:
1297+
GetInArena(dt);
1298+
break;
1299+
case CHOMPER_ALERT_CHASE:
1300+
if (subenter != 0)
1301+
{
1302+
DoAutoAnim(NPC_GSPOT_STARTALT, 0);
1303+
}
1304+
CirclePlayer(dt);
1305+
if ((CheckSpot(dt) != 0) && !(globals.player.DamageTimer > 0.0f))
1306+
{
1307+
alertchomp = CHOMPER_ALERT_EVADE;
1308+
nextgoal = NPC_GOAL_ATTACKCHOMPER;
1309+
*trantype = GOAL_TRAN_PUSH;
1310+
}
1311+
break;
1312+
case CHOMPER_ALERT_EVADE:
1313+
if (subenter != 0)
1314+
{
1315+
if (CalcEvadePos(&pos_evade) == 0)
1316+
{
1317+
alertchomp = CHOMPER_ALERT_CHASE;
1318+
break;
1319+
}
1320+
F32 fVar3 = xsqrt(npc->XZDstSqToPos(&pos_evade, NULL, NULL)) / 2.5f;
1321+
tmr_evade = CLAMP(fVar3, 1.0f, 2.0f);
1322+
DoAutoAnim(NPC_GSPOT_STARTALT, 0);
1323+
}
1324+
if (tmr_evade < 0.0f)
1325+
{
1326+
alertchomp = CHOMPER_ALERT_CHASE;
1327+
}
1328+
tmr_evade = MAX(-1.0f, (tmr_evade - dt));
1329+
if (MoveEvadePos(&pos_evade, dt))
1330+
{
1331+
alertchomp = CHOMPER_ALERT_CHASE;
1332+
}
1333+
break;
1334+
}
1335+
if (alertchomp != old_alertchomp)
1336+
{
1337+
flg_info |= 2;
1338+
}
1339+
if (*trantype != GOAL_TRAN_NONE)
1340+
{
1341+
return nextgoal;
1342+
}
1343+
return nextgoal = xGoal::Process(trantype, dt, updCtxt, NULL);
1344+
}
1345+
12431346
void zNPCGoalAlertChomper::CirclePlayer(F32 dt)
12441347
{
12451348
zNPCRobot* npc = (zNPCRobot*)this->psyche->clt_owner;
@@ -1571,6 +1674,118 @@ S32 zNPCGoalAlertTarTar::Resume(F32 dt, void* updCtxt)
15711674
return zNPCGoalCommon::Resume(dt, updCtxt);
15721675
}
15731676

1677+
S32 zNPCGoalAlertTarTar::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn)
1678+
{
1679+
S32 nextgoal;
1680+
zNPCRobot* npc;
1681+
en_alerttart old_alerttart;
1682+
F32 tym_reload;
1683+
xVec3 dir_HtoP;
1684+
F32 dsq;
1685+
S32 subenter;
1686+
zNPCGoalTaunt* taunt;
1687+
F32 rad;
1688+
1689+
npc = (zNPCSlick*)(psyche->clt_owner);
1690+
subenter = flg_info & 2;
1691+
old_alerttart = alerttart;
1692+
flg_info &= ~6;
1693+
nextgoal = 0;
1694+
tym_reload = 5.0f;
1695+
dsq = npc->arena.DstSqFromHome(xEntGetPos(&globals.player.ent), &dir_HtoP);
1696+
if ((npc->arena.Radius(1.0f) * 1.5f) > npc->cfg_npc->rad_attack)
1697+
{
1698+
rad = npc->arena.Radius(1.0f) * 1.5f;
1699+
}
1700+
else
1701+
{
1702+
rad = npc->cfg_npc->rad_attack;
1703+
}
1704+
if (globals.player.Health < 1)
1705+
{
1706+
taunt = (zNPCGoalTaunt*)(psyche->FindGoal(NPC_GOAL_TAUNT));
1707+
taunt->LoopCountSet(1000);
1708+
*trantype = GOAL_TRAN_PUSH;
1709+
nextgoal = NPC_GOAL_TAUNT;
1710+
}
1711+
else if (globals.player.DamageTimer > 0.5f)
1712+
{
1713+
*trantype = GOAL_TRAN_PUSH;
1714+
nextgoal = NPC_GOAL_TAUNT;
1715+
}
1716+
else if (npc->SomethingWonderful() != 0)
1717+
{
1718+
*trantype = GOAL_TRAN_SET;
1719+
nextgoal = NPC_GOAL_IDLE;
1720+
}
1721+
else if (!*(U8 *)(&npc->npcset.allowDetect))
1722+
{
1723+
*trantype = GOAL_TRAN_SET;
1724+
nextgoal = NPC_GOAL_IDLE;
1725+
}
1726+
else if (dsq > SQ(rad))
1727+
{
1728+
*trantype = GOAL_TRAN_SET;
1729+
nextgoal = NPC_GOAL_IDLE;
1730+
}
1731+
if (*trantype != GOAL_TRAN_NONE)
1732+
{
1733+
return nextgoal;
1734+
}
1735+
if (alerttart != TARTAR_ALERT_ARENA && (npc->arena.PctFromHome(npc->Pos()) > 1.0f))
1736+
{
1737+
alerttart = TARTAR_ALERT_ARENA;
1738+
DoAutoAnim(NPC_GSPOT_STARTALT, 0);
1739+
}
1740+
if (npc->DBG_IsNormLog(eNPCDCAT_Thirteen, -1))
1741+
{
1742+
xDrawSetColor(g_YELLOW);
1743+
NPCC_DrawPlayerPredict(5, 1.0f, 4.0f);
1744+
}
1745+
switch (alerttart)
1746+
{
1747+
case TARTAR_ALERT_NOTICE:
1748+
npc->VelStop();
1749+
alerttart = TARTAR_ALERT_BEGIN;
1750+
nextgoal = NPC_GOAL_NOTICE;
1751+
*trantype = GOAL_TRAN_PUSH;
1752+
break;
1753+
case TARTAR_ALERT_ARENA:
1754+
GetInArena(dt);
1755+
if (npc->arena.PctFromHome(npc->Pos()) < 0.5f)
1756+
{
1757+
alerttart = TARTAR_ALERT_BEGIN;
1758+
}
1759+
break;
1760+
case TARTAR_ALERT_BEGIN:
1761+
npc->VelStop();
1762+
alerttart = (en_alerttart)3;
1763+
hoppy = (en_hoppy)0;
1764+
break;
1765+
case TARTAR_ALERT_READY:
1766+
npc->VelStop();
1767+
if (subenter)
1768+
{
1769+
DoAutoAnim(NPC_GSPOT_RESUME, 0);
1770+
}
1771+
nextgoal = HoppyUpdate(trantype, dt);
1772+
if (*trantype != GOAL_TRAN_NONE)
1773+
{
1774+
return nextgoal;
1775+
}
1776+
break;
1777+
}
1778+
if (alerttart != old_alerttart)
1779+
{
1780+
flg_info |= 2;
1781+
}
1782+
if (*trantype != GOAL_TRAN_NONE)
1783+
{
1784+
return nextgoal;
1785+
}
1786+
return xGoal::Process(trantype, dt, updCtxt, NULL);
1787+
}
1788+
15741789
S32 zNPCGoalAlertTarTar::NPCMessage(NPCMsg* mail)
15751790
{
15761791
S32 snarfed = 1;

0 commit comments

Comments
 (0)