@@ -1908,6 +1908,132 @@ S32 zNPCGoalAlertMonsoon::Resume(F32 dt, void* updCtxt)
19081908 return zNPCGoalCommon::Resume (dt, updCtxt);
19091909}
19101910
1911+ S32 zNPCGoalAlertMonsoon::Process (en_trantype* trantype, F32 dt, void * updCtxt, xScene* xscn)
1912+ {
1913+ S32 nextgoal;
1914+ zNPCRobot* npc;
1915+ en_alertmony old_alertmony;
1916+ F32 tym_reload;
1917+ xVec3 dir_HtoP;
1918+ F32 dsq;
1919+ S32 subenter;
1920+ zNPCGoalTaunt* taunt;
1921+ F32 rad;
1922+ npc = (zNPCRobot*)(psyche->clt_owner );
1923+ nextgoal = 0 ;
1924+ tym_reload = 2 .5f ;
1925+ dsq = npc->arena .DstSqFromHome (xEntGetPos (&globals.player .ent ), &dir_HtoP);
1926+ if ((npc->arena .Radius (1 .0f ) * 1 .5f ) > npc->cfg_npc ->rad_attack )
1927+ {
1928+ rad = npc->arena .Radius (1 .0f ) * 1 .5f ;
1929+ }
1930+ else
1931+ {
1932+ rad = npc->cfg_npc ->rad_attack ;
1933+ }
1934+ if (globals.player .Health < 1 )
1935+ {
1936+ taunt = (zNPCGoalTaunt*)(psyche->FindGoal (NPC_GOAL_TAUNT));
1937+ taunt->LoopCountSet (1000 );
1938+ *trantype = GOAL_TRAN_PUSH;
1939+ nextgoal = NPC_GOAL_TAUNT;
1940+ }
1941+ else if (globals.player .DamageTimer > 0 .5f )
1942+ {
1943+ *trantype = GOAL_TRAN_PUSH;
1944+ nextgoal = NPC_GOAL_TAUNT;
1945+ }
1946+ else if (npc->SomethingWonderful () != 0 )
1947+ {
1948+ *trantype = GOAL_TRAN_SET;
1949+ nextgoal = NPC_GOAL_IDLE;
1950+ }
1951+ else if (!*(U8*)(&npc->npcset .allowDetect ))
1952+ {
1953+ *trantype = GOAL_TRAN_SET;
1954+ nextgoal = NPC_GOAL_IDLE;
1955+ }
1956+ else if (!npc->arena .IsReady () || dsq > SQ (rad))
1957+ {
1958+ *trantype = GOAL_TRAN_SET;
1959+ nextgoal = NPC_GOAL_IDLE;
1960+ }
1961+ if (*trantype != GOAL_TRAN_NONE)
1962+ {
1963+ return nextgoal;
1964+ }
1965+ subenter = flg_info & 2 ;
1966+ old_alertmony = alertmony;
1967+ flg_info &= ~6 ;
1968+ if (alertmony != (en_alertmony)SLICK_ALERT_ARENA && (npc->arena .PctFromHome (npc->Pos ()) > 1 .1f ))
1969+ {
1970+ alertmony = (en_alertmony)SLICK_ALERT_ARENA;
1971+ subenter = 1 ;
1972+ }
1973+ switch (alertmony)
1974+ {
1975+ case MONSOON_ALERT_NOTICE:
1976+ alertmony = MONSOON_ALERT_BEGIN;
1977+ npc->FacePlayer (dt, 3 * PI);
1978+ *trantype = GOAL_TRAN_PUSH;
1979+ nextgoal = NPC_GOAL_NOTICE;
1980+ break ;
1981+ case MONSOON_ALERT_ARENA:
1982+ npc->FacePlayer (dt, 3 * PI);
1983+ npc->MoveTowardsArena (dt, 4 .0f );
1984+ if (npc->arena .PctFromHome (npc->Pos ()) < 0 .5f )
1985+ {
1986+ alertmony = MONSOON_ALERT_READY;
1987+ }
1988+ if (subenter)
1989+ {
1990+ DoAutoAnim (NPC_GSPOT_STARTALT, 0 );
1991+ }
1992+ break ;
1993+ case MONSOON_ALERT_BEGIN:
1994+ alertmony = MONSOON_ALERT_READY;
1995+ break ;
1996+ case MONSOON_ALERT_READY:
1997+ if (((tmr_reload < 0 .0f ) ? 1 : 0 ) && !(globals.player .DamageTimer > 0 .0f ))
1998+ {
1999+ alertmony = MONSOON_ALERT_SPITCLOUD;
2000+ break ;
2001+ }
2002+ else
2003+ {
2004+ tmr_reload = MAX (-1 .0f , (tmr_reload - dt));
2005+ if (subenter != 0 )
2006+ {
2007+ DoAutoAnim (NPC_GSPOT_RESUME, 0 );
2008+ npc->VelStop ();
2009+ if (!npc->arena .IncludesPos (&pos_corner, NULL , NULL ))
2010+ {
2011+ xVec3Copy (&pos_corner, npc->Pos ());
2012+ }
2013+ }
2014+ npc->FacePlayer (dt, 3 * PI);
2015+ MoveCorner (dt);
2016+ }
2017+ break ;
2018+ case MONSOON_ALERT_SPITCLOUD:
2019+ F32 rand = xurand ();
2020+ nextgoal = NPC_GOAL_ATTACKMONSOON;
2021+ tmr_reload = tym_reload + (tym_reload * (0 .25f * (rand - 0 .5f )));
2022+ alertmony = MONSOON_ALERT_READY;
2023+ *trantype = GOAL_TRAN_PUSH;
2024+ break ;
2025+ }
2026+ if (alertmony != old_alertmony)
2027+ {
2028+ flg_info |= 2 ;
2029+ }
2030+ if (*trantype != GOAL_TRAN_NONE)
2031+ {
2032+ return nextgoal;
2033+ }
2034+ return xGoal::Process (trantype, dt, updCtxt, NULL );
2035+ }
2036+
19112037void zNPCGoalAlertMonsoon::MoveCorner (F32 dt)
19122038{
19132039 zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner );
0 commit comments