@@ -1343,6 +1343,104 @@ S32 zNPCGoalAlertChomper::CheckSpot(F32 dt)
13431343 return plyrInSpot;
13441344}
13451345
1346+ S32 zNPCGoalAlertHammer::Process (en_trantype* trantype, F32 dt, void * updCtxt, xScene* xscn)
1347+ {
1348+ zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner );
1349+ S32 nextgoal = 0 ;
1350+ S32 subenter;
1351+ en_alertham old_alertham;
1352+ if (globals.player .Health < 1 )
1353+ {
1354+ zNPCGoalLoopAnim* taunt = (zNPCGoalLoopAnim*)psyche->FindGoal (NPC_GOAL_TAUNT);
1355+ taunt->LoopCountSet (1000 );
1356+ *trantype = GOAL_TRAN_PUSH;
1357+ nextgoal = NPC_GOAL_TAUNT;
1358+ }
1359+ else if (globals.player .DamageTimer > 0 .0f )
1360+ {
1361+ *trantype = GOAL_TRAN_PUSH;
1362+ nextgoal = NPC_GOAL_TAUNT;
1363+ }
1364+ else if (npc->SomethingWonderful () != 0 )
1365+ {
1366+ *trantype = GOAL_TRAN_SET;
1367+ nextgoal = NPC_GOAL_IDLE;
1368+ }
1369+ else if (!npc->arena .IncludesPlayer (0 , 0 ))
1370+ {
1371+ *trantype = GOAL_TRAN_SET;
1372+ nextgoal = NPC_GOAL_IDLE;
1373+ }
1374+ if (*trantype != GOAL_TRAN_NONE)
1375+ {
1376+ return nextgoal;
1377+ }
1378+ old_alertham = alertham;
1379+ subenter = flg_info & 2 ;
1380+ flg_info &= 0xFFFFFFF9 ;
1381+ switch (alertham)
1382+ {
1383+ case HAMMER_ALERT_NOTICE:
1384+ if (subenter)
1385+ {
1386+ DoAutoAnim (NPC_GSPOT_RESUME, 0 );
1387+ }
1388+ alertham = HAMMER_ALERT_CHASE;
1389+ break ;
1390+ case HAMMER_ALERT_BEGIN:
1391+ alertham = HAMMER_ALERT_CHASE;
1392+ break ;
1393+ case HAMMER_ALERT_CHASE:
1394+ if ((PlayerInSpot (dt) != 0 ) && !(globals.player .DamageTimer > 0 .0f ))
1395+ {
1396+ alertham = HAMMER_ALERT_WHAM;
1397+ break ;
1398+ }
1399+ if (subenter)
1400+ {
1401+ DoAutoAnim (NPC_GSPOT_STARTALT, 0 );
1402+ tmr_alertham = 0 .0f ;
1403+ }
1404+ MoveChase (dt);
1405+ NPCC_TmrCycle (&tmr_alertham, dt, 1.0 );
1406+ break ;
1407+ case HAMMER_ALERT_WHAM:
1408+ alertham = HAMMER_ALERT_EVADE;
1409+ nextgoal = NPC_GOAL_ATTACKHAMMER;
1410+ *trantype = GOAL_TRAN_PUSH;
1411+ break ;
1412+ case HAMMER_ALERT_EVADE:
1413+ if (subenter)
1414+ {
1415+ tmr_alertham = 0 .25f ;
1416+ }
1417+ if (tmr_alertham < 0 .0f )
1418+ {
1419+ alertham = HAMMER_ALERT_CHASE;
1420+ }
1421+ else
1422+ {
1423+ MoveEvade (dt);
1424+ npc->FacePlayer (dt, 3 * PI);
1425+ tmr_alertham = MAX (-1 .0f , (tmr_alertham - dt));
1426+ if (subenter)
1427+ {
1428+ DoAutoAnim (NPC_GSPOT_STARTALT, 0 );
1429+ }
1430+ }
1431+ break ;
1432+ }
1433+ if (alertham != old_alertham)
1434+ {
1435+ flg_info |= 2 ;
1436+ }
1437+ if (*trantype != GOAL_TRAN_NONE)
1438+ {
1439+ return nextgoal;
1440+ }
1441+ return nextgoal = xGoal::Process (trantype, dt, updCtxt, NULL );
1442+ }
1443+
13461444S32 zNPCGoalAlertHammer::Enter (F32 dt, void * updCtxt)
13471445{
13481446 flg_attack = 0 ;
@@ -2043,6 +2141,128 @@ S32 zNPCGoalAlertSlick::Resume(F32 dt, void* updCtxt)
20432141 return zNPCGoalCommon::Resume (dt, updCtxt);
20442142}
20452143
2144+ S32 zNPCGoalAlertSlick::Process (en_trantype* trantype, F32 dt, void * updCtxt, xScene* xscn)
2145+ {
2146+ S32 nextgoal;
2147+ zNPCSlick* npc;
2148+ en_alertslik old_alertslik;
2149+ F32 tym_reload;
2150+ xVec3 dir_HtoP;
2151+ F32 dsq;
2152+ S32 subenter;
2153+ zNPCGoalTaunt* taunt;
2154+ F32 rad;
2155+ npc = (zNPCSlick*)(psyche->clt_owner );
2156+ subenter = flg_info & 2 ;
2157+ old_alertslik = alertslik;
2158+ flg_info &= ~6 ;
2159+ nextgoal = 0 ;
2160+ tym_reload = 5 .0f ;
2161+ if (zGameExtras_CheatFlags () & 0x800 )
2162+ {
2163+ tym_reload = 3 .0f ;
2164+ }
2165+ dsq = npc->arena .DstSqFromHome (xEntGetPos (&globals.player .ent ), &dir_HtoP);
2166+ if ((npc->arena .Radius (1 .0f ) * 1 .5f ) > npc->cfg_npc ->rad_attack )
2167+ {
2168+ rad = npc->arena .Radius (1 .0f ) * 1 .5f ;
2169+ }
2170+ else
2171+ {
2172+ rad = npc->cfg_npc ->rad_attack ;
2173+ }
2174+ if (globals.player .Health < 1 )
2175+ {
2176+ taunt = (zNPCGoalTaunt*)(psyche->FindGoal (NPC_GOAL_TAUNT));
2177+ taunt->LoopCountSet (1000 );
2178+ *trantype = GOAL_TRAN_PUSH;
2179+ nextgoal = NPC_GOAL_TAUNT;
2180+ }
2181+ else if (globals.player .DamageTimer > 0 .5f )
2182+ {
2183+ *trantype = GOAL_TRAN_PUSH;
2184+ nextgoal = NPC_GOAL_TAUNT;
2185+ }
2186+ else if (npc->SomethingWonderful () != 0 )
2187+ {
2188+ *trantype = GOAL_TRAN_SET;
2189+ nextgoal = NPC_GOAL_IDLE;
2190+ }
2191+ else if (!*(U8 *)(&npc->npcset .allowDetect ))
2192+ {
2193+ *trantype = GOAL_TRAN_SET;
2194+ nextgoal = NPC_GOAL_IDLE;
2195+ }
2196+ else if (dsq > SQ (rad))
2197+ {
2198+ *trantype = GOAL_TRAN_SET;
2199+ nextgoal = NPC_GOAL_IDLE;
2200+ }
2201+ if (*trantype != GOAL_TRAN_NONE)
2202+ {
2203+ return nextgoal;
2204+ }
2205+ if (alertslik != SLICK_ALERT_ARENA && (npc->arena .PctFromHome (npc->Pos ()) > 1 .0f ))
2206+ {
2207+ alertslik = SLICK_ALERT_ARENA;
2208+ DoAutoAnim (NPC_GSPOT_STARTALT, 0 );
2209+ }
2210+ switch (alertslik)
2211+ {
2212+ case SLICK_ALERT_NOTICE:
2213+ alertslik = SLICK_ALERT_BEGIN;
2214+ nextgoal = NPC_GOAL_NOTICE;
2215+ *trantype = GOAL_TRAN_PUSH;
2216+ break ;
2217+ case SLICK_ALERT_ARENA:
2218+ GetInArena (dt);
2219+ if (npc->arena .PctFromHome (npc->Pos ()) < 0 .5f )
2220+ {
2221+ alertslik = SLICK_ALERT_BEGIN;
2222+ }
2223+ break ;
2224+ case SLICK_ALERT_BEGIN:
2225+ alertslik = SLICK_ALERT_READY;
2226+ DoAutoAnim (NPC_GSPOT_RESUME, 0 );
2227+ npc->FacePlayer (dt, 3 * PI);
2228+ npc->VelStop ();
2229+ break ;
2230+ case SLICK_ALERT_READY:
2231+ if (((tmr_reload < 0 .0f ) ? 1 : 0 ) && !(globals.player .DamageTimer > 0 .0f ))
2232+ {
2233+ F32 rand = xurand ();
2234+ nextgoal = NPC_GOAL_ATTACKSLICK;
2235+ tmr_reload = tym_reload + (tym_reload * (0 .25f * (rand - 0 .5f ))); // Regalloc
2236+ *trantype = GOAL_TRAN_PUSH;
2237+ }
2238+ else
2239+ {
2240+ tmr_reload = MAX (-1 .0f , (tmr_reload - dt));
2241+ if (subenter)
2242+ {
2243+ DoAutoAnim (NPC_GSPOT_RESUME, 0 );
2244+ npc->VelStop ();
2245+ if (!npc->arena .IncludesPos (&pos_corner, 0 , 0 ))
2246+ {
2247+ xVec3Copy (&pos_corner, npc->Pos ());
2248+ }
2249+ }
2250+ npc->FacePlayer (dt, 3 * PI);
2251+ MoveCorner (dt);
2252+ }
2253+ break ;
2254+ }
2255+ if (alertslik != old_alertslik)
2256+ {
2257+ flg_info |= 2 ;
2258+ }
2259+ if (*trantype != GOAL_TRAN_NONE)
2260+ {
2261+ return nextgoal;
2262+ }
2263+ return xGoal::Process (trantype, dt, updCtxt, NULL );
2264+ }
2265+
20462266S32 zNPCGoalAlertSlick::NPCMessage (NPCMsg* mail)
20472267{
20482268 zNPCGoalRespawn* respgoal;
0 commit comments