DEFINE_ACTION_FUNCTION(AActor, A_MinotaurRoam) { PARAM_ACTION_PROLOGUE; // In case pain caused him to skip his fade in. self->RenderStyle = STYLE_Normal; if (self->IsKindOf(RUNTIME_CLASS(AMinotaurFriend))) { AMinotaurFriend *self1 = static_cast<AMinotaurFriend *> (self); if (self1->StartTime >= 0 && (level.maptime - self1->StartTime) >= MAULATORTICS) { P_DamageMobj (self1, NULL, NULL, TELEFRAG_DAMAGE, NAME_None); return 0; } } if (pr_minotaurroam() < 30) CALL_ACTION(A_MinotaurLook, self); // adjust to closest target if (pr_minotaurroam() < 6) { //Choose new direction self->movedir = pr_minotaurroam() % 8; FaceMovementDirection (self); } if (!P_Move(self)) { // Turn if (pr_minotaurroam() & 1) self->movedir = (self->movedir + 1) % 8; else self->movedir = (self->movedir + 7) % 8; FaceMovementDirection (self); } return 0; }
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurChase) { PARAM_ACTION_PROLOGUE; if (!self->IsKindOf(RUNTIME_CLASS(AMinotaurFriend))) { A_Chase (stack, self); return 0; } AMinotaurFriend *self1 = static_cast<AMinotaurFriend *> (self); // In case pain caused him to skip his fade in. self1->RenderStyle = STYLE_Normal; if (self1->StartTime >= 0 && (level.maptime - self1->StartTime) >= MAULATORTICS) { P_DamageMobj (self1, NULL, NULL, TELEFRAG_DAMAGE, NAME_None); return 0; } if (pr_minotaurchase() < 30) CALL_ACTION(A_MinotaurLook, self1); // adjust to closest target if (!self1->target || (self1->target->health <= 0) || !(self1->target->flags&MF_SHOOTABLE)) { // look for a new target self1->SetIdle(); return 0; } FaceMovementDirection (self1); self1->reactiontime = 0; // Melee attack if (self1->MeleeState && self1->CheckMeleeRange ()) { if (self1->AttackSound) { S_Sound (self1, CHAN_WEAPON, self1->AttackSound, 1, ATTN_NORM); } self1->SetState (self1->MeleeState); return 0; } // Missile attack if (self1->MissileState && P_CheckMissileRange(self1)) { self1->SetState (self1->MissileState); return 0; } // chase towards target if (!P_Move (self1)) { P_NewChaseDir (self1); FaceMovementDirection (self1); } // Active sound if (pr_minotaurchase() < 6) { self1->PlayActiveSound (); } return 0; }
DEFINE_ACTION_FUNCTION(AActor, A_FiredChase) { int weaveindex = self->special1; AActor *target = self->target; angle_t ang; fixed_t dist; // [BC] Let the server do this. if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) || ( CLIENTDEMO_IsPlaying( ))) { // make active sound if (pr_firedemonchase() < 3) { self->PlayActiveSound (); } // Normal movement if ( self->special2 == 0 ) P_Move( self ); return; } if (self->reactiontime) self->reactiontime--; if (self->threshold) self->threshold--; // Float up and down self->z += FloatBobOffsets[weaveindex]; self->special1 = (weaveindex+2)&63; // Ensure it stays above certain height if (self->z < self->floorz + (64*FRACUNIT)) { self->z += 2*FRACUNIT; } // [BC] If we're the server, update the thing's z position. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) SERVERCOMMANDS_MoveThing( self, CM_Z ); if(!self->target || !(self->target->flags&MF_SHOOTABLE)) { // Invalid target P_LookForPlayers (self,true, NULL); return; } // Strafe if (self->special2 > 0) { self->special2--; } else { self->special2 = 0; self->velx = self->vely = 0; dist = P_AproxDistance (self->x - target->x, self->y - target->y); if (dist < FIREDEMON_ATTACK_RANGE) { if (pr_firedemonchase() < 30) { ang = R_PointToAngle2 (self->x, self->y, target->x, target->y); if (pr_firedemonchase() < 128) ang += ANGLE_90; else ang -= ANGLE_90; ang >>= ANGLETOFINESHIFT; self->velx = finecosine[ang] << 3; //FixedMul (8*FRACUNIT, finecosine[ang]); self->vely = finesine[ang] << 3; //FixedMul (8*FRACUNIT, finesine[ang]); self->special2 = 3; // strafe time } } // [BC] If we're the server, update the thing's z position. if ( NETWORK_GetState( ) == NETSTATE_SERVER ) { SERVERCOMMANDS_MoveThingExact( self, CM_MOMX|CM_MOMY ); SERVERCOMMANDS_SetThingSpecial2( self ); } }