Skip to content

Commit 7f7693e

Browse files
committed
zNPCGoalRobo work
1 parent a380dd6 commit 7f7693e

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

src/SB/Game/zNPCGoalRobo.cpp

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3840,6 +3840,28 @@ S32 zNPCGoalDamage::InputInfo(NPCDamageInfo* info)
38403840
return flg_info;
38413841
}
38423842

3843+
S32 zNPCGoalBashed::Enter(F32 dt, void* updCtxt)
3844+
{
3845+
F32 rand;
3846+
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
3847+
npc->VelStop();
3848+
static F32 grav = globals.player.g.Gravity;
3849+
static F32 tym_bashrise = globals.player.g.BBashTime - globals.player.g.BBashCVTime;
3850+
static F32 player_bash_fromgrav = grav * 0.5f * tym_bashrise;
3851+
static F32 player_bash_speed =
3852+
(globals.player.g.BBashHeight + player_bash_fromgrav) / globals.player.g.BBashTime;
3853+
npc->frame->vel.y = 10.0f;
3854+
npc->frame->vel.x =
3855+
(globals.camera.mat.right.x * (xurand() - 0.5f) * 2.0f + globals.camera.mat.at.x) * 5.0f;
3856+
npc->frame->vel.z =
3857+
(globals.camera.mat.right.z * (xurand() - 0.5f) * 2.0f + globals.camera.mat.at.z) * 5.0f;
3858+
npc->frame->mode |= 4;
3859+
zNPCGoalLoopAnim::LoopCountSet(1);
3860+
npc->InflictPain(1, 0);
3861+
npc->SndPlayRandom(NPC_STYP_OUCH);
3862+
return zNPCGoalLoopAnim::Enter(dt, updCtxt);
3863+
}
3864+
38433865
S32 zNPCGoalBashed::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* scene)
38443866
{
38453867
xEnt* ent = ((xEnt*)(psyche->clt_owner));
@@ -3899,6 +3921,49 @@ S32 zNPCGoalKnock::InputInfo(NPCDamageInfo* info)
38993921
return flg_info;
39003922
}
39013923

3924+
S32 zNPCGoalWound::Enter(F32 dt, void* updCtxt)
3925+
{
3926+
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
3927+
this->flg_knock = 0;
3928+
F32 dst = npc->XZDstSqToPlayer(&this->dir_fling, NULL);
3929+
if (dst < 0.001f)
3930+
{
3931+
xVec3Copy(&this->dir_fling, NPCC_faceDir(&globals.player.ent));
3932+
}
3933+
else
3934+
{
3935+
xVec3SMulBy(&this->dir_fling, (-1.0f / xsqrt(dst)));
3936+
}
3937+
S32 iVar2 = npc->SelfType();
3938+
if (iVar2 == NPC_TYPE_TARTAR)
3939+
{
3940+
npc->spd_throttle = 18.0f;
3941+
}
3942+
else if (iVar2 == NPC_TYPE_SLEEPY)
3943+
{
3944+
npc->spd_throttle = 8.0f;
3945+
}
3946+
else
3947+
{
3948+
npc->spd_throttle = 7.0f;
3949+
}
3950+
if (npc->flg_move & 2)
3951+
{
3952+
npc->frame->vel.y = 5.0;
3953+
}
3954+
npc->InflictPain(1, 0);
3955+
npc->SndPlayRandom(NPC_STYP_DIZZY);
3956+
if (psyche->GIDInStack(NPC_GOAL_ALERT) == NULL)
3957+
{
3958+
this->flg_pushanim |= 0x10000;
3959+
}
3960+
else
3961+
{
3962+
this->flg_pushanim &= 0xfffeffff;
3963+
}
3964+
return zNPCGoalPushAnim::Enter(dt, updCtxt);
3965+
}
3966+
39023967
S32 zNPCGoalWound::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScene* xscn)
39033968
{
39043969
S32 nextgoal = 0;
@@ -4148,6 +4213,51 @@ S32 zNPCGoalRespawn::Process(en_trantype* trantype, F32 dt, void* updCtxt, xScen
41484213
return xGoal::Process(trantype, dt, updCtxt, xscn);
41494214
}
41504215

4216+
void zNPCGoalRespawn::KickFromTheNest()
4217+
{
4218+
zNPCGoalAfterlife* wanna;
4219+
zNPCRobot* npc = (zNPCRobot*)(psyche->clt_owner);
4220+
zMovePoint* nav_preserveCurr = npc->nav_curr;
4221+
zMovePoint* nav_preserveDest = npc->nav_dest;
4222+
4223+
npc->Reset();
4224+
npc->ModelScaleSet(0.0f);
4225+
wanna = (zNPCGoalAfterlife*)(psyche->FindGoal(NPC_GOAL_AFTERLIFE));
4226+
if (wanna != NULL)
4227+
{
4228+
wanna->DieWithABang();
4229+
}
4230+
4231+
xVec3Copy(npc->Pos(), &pos_poofHere);
4232+
xVec3Copy(&npc->frame->mat.pos, &pos_poofHere);
4233+
4234+
npc->frame->mode = 1;
4235+
4236+
npc->frame->dvel.x = 0.0f;
4237+
npc->frame->dvel.y = 0.0f;
4238+
npc->frame->dvel.z = 0.0f;
4239+
4240+
npc->frame->vel.x = 0.0f;
4241+
npc->frame->vel.y = 0.0f;
4242+
npc->frame->vel.z = 0.0f;
4243+
4244+
npc->frame->mode |= 0xc;
4245+
4246+
npc->frame->dpos.x = 0.0f;
4247+
npc->frame->dpos.y = 0.0f;
4248+
npc->frame->dpos.z = 0.0f;
4249+
4250+
npc->frame->mode |= 2;
4251+
4252+
npc->nav_past = nav_preserveCurr;
4253+
npc->nav_curr = nav_preserveCurr;
4254+
npc->nav_dest = nav_preserveDest;
4255+
npc->nav_lead = nav_preserveDest;
4256+
4257+
npc->arena.SetHome(npc, nav_preserveCurr);
4258+
npc->psy_instinct->GoalSet(NPC_GOAL_IDLE, 1);
4259+
}
4260+
41514261
S32 zNPCGoalRespawn::InputInfo(NPCSpawnInfo* info)
41524262
{
41534263
zNPCRobot* npc = ((zNPCRobot*)(psyche->clt_owner));

0 commit comments

Comments
 (0)