mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-08 14:00:43 +00:00
85c683e0c7
player does not immediately activate switches. oldbuttons was not usable for this. This also required that CopyPlayer preserves this info. - Fixed: When restarting the music there was a NULL pointer check missing so it crashed when the game was started wi - Fixed: If the Use key is used to respawn the player it must be cleared so that it doesn't trigger any subsequent actions after respawning. - Fixed: Resurrecting a monster did not restore flags5 and flags6. - Fixed: Projectiles which killed a non-monster were unable to determine what precisely they hit because MF_CORPSE is only valid for monsters. A new flag, MF6_KILLED that gets set for all objects that die, was added for this case. - Added a generic A_Weave function that exposes all possible options of A_BishopMissileWeave and A_CStaffMissileSlither. These 2 functions are no longer needed from DECORATE and therefore deprecated. SVN r2045 (trunk)
203 lines
4.8 KiB
C++
203 lines
4.8 KiB
C++
/*
|
|
#include "actor.h"
|
|
#include "info.h"
|
|
#include "p_local.h"
|
|
#include "s_sound.h"
|
|
#include "a_action.h"
|
|
#include "m_random.h"
|
|
#include "a_hexenglobal.h"
|
|
#include "thingdef/thingdef.h"
|
|
*/
|
|
|
|
static FRandom pr_boom ("BishopBoom");
|
|
static FRandom pr_atk ("BishopAttack");
|
|
static FRandom pr_decide ("BishopDecide");
|
|
static FRandom pr_doblur ("BishopDoBlur");
|
|
static FRandom pr_sblur ("BishopSpawnBlur");
|
|
static FRandom pr_pain ("BishopPainBlur");
|
|
|
|
//============================================================================
|
|
//
|
|
// A_BishopAttack
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BishopAttack)
|
|
{
|
|
if (!self->target)
|
|
{
|
|
return;
|
|
}
|
|
S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM);
|
|
if (self->CheckMeleeRange())
|
|
{
|
|
int damage = pr_atk.HitDice (4);
|
|
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
|
|
P_TraceBleed (damage, self->target, self);
|
|
return;
|
|
}
|
|
self->special1 = (pr_atk() & 3) + 5;
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_BishopAttack2
|
|
//
|
|
// Spawns one of a string of bishop missiles
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BishopAttack2)
|
|
{
|
|
AActor *mo;
|
|
|
|
if (!self->target || !self->special1)
|
|
{
|
|
self->special1 = 0;
|
|
self->SetState (self->SeeState);
|
|
return;
|
|
}
|
|
mo = P_SpawnMissile (self, self->target, PClass::FindClass("BishopFX"));
|
|
if (mo != NULL)
|
|
{
|
|
mo->tracer = self->target;
|
|
}
|
|
self->special1--;
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_BishopMissileWeave
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BishopMissileWeave)
|
|
{
|
|
A_Weave(self, 2, 2, 2*FRACUNIT, FRACUNIT);
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_BishopDecide
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BishopDecide)
|
|
{
|
|
if (pr_decide() < 220)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
self->SetState (self->FindState ("Blur"));
|
|
}
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_BishopDoBlur
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BishopDoBlur)
|
|
{
|
|
self->special1 = (pr_doblur() & 3) + 3; // Random number of blurs
|
|
if (pr_doblur() < 120)
|
|
{
|
|
P_ThrustMobj (self, self->angle + ANG90, 11*FRACUNIT);
|
|
}
|
|
else if (pr_doblur() > 125)
|
|
{
|
|
P_ThrustMobj (self, self->angle - ANG90, 11*FRACUNIT);
|
|
}
|
|
else
|
|
{ // Thrust forward
|
|
P_ThrustMobj (self, self->angle, 11*FRACUNIT);
|
|
}
|
|
S_Sound (self, CHAN_BODY, "BishopBlur", 1, ATTN_NORM);
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_BishopSpawnBlur
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BishopSpawnBlur)
|
|
{
|
|
AActor *mo;
|
|
|
|
if (!--self->special1)
|
|
{
|
|
self->velx = 0;
|
|
self->vely = 0;
|
|
if (pr_sblur() > 96)
|
|
{
|
|
self->SetState (self->SeeState);
|
|
}
|
|
else
|
|
{
|
|
self->SetState (self->MissileState);
|
|
}
|
|
}
|
|
mo = Spawn ("BishopBlur", self->x, self->y, self->z, ALLOW_REPLACE);
|
|
if (mo)
|
|
{
|
|
mo->angle = self->angle;
|
|
}
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_BishopChase
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BishopChase)
|
|
{
|
|
self->z -= FloatBobOffsets[self->special2] >> 1;
|
|
self->special2 = (self->special2 + 4) & 63;
|
|
self->z += FloatBobOffsets[self->special2] >> 1;
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_BishopPuff
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BishopPuff)
|
|
{
|
|
AActor *mo;
|
|
|
|
mo = Spawn ("BishopPuff", self->x, self->y, self->z + 40*FRACUNIT, ALLOW_REPLACE);
|
|
if (mo)
|
|
{
|
|
mo->velz = FRACUNIT/2;
|
|
}
|
|
}
|
|
|
|
//============================================================================
|
|
//
|
|
// A_BishopPainBlur
|
|
//
|
|
//============================================================================
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_BishopPainBlur)
|
|
{
|
|
AActor *mo;
|
|
|
|
if (pr_pain() < 64)
|
|
{
|
|
self->SetState (self->FindState ("Blur"));
|
|
return;
|
|
}
|
|
fixed_t x = self->x + (pr_pain.Random2()<<12);
|
|
fixed_t y = self->y + (pr_pain.Random2()<<12);
|
|
fixed_t z = self->z + (pr_pain.Random2()<<11);
|
|
mo = Spawn ("BishopPainBlur", x, y, z, ALLOW_REPLACE);
|
|
if (mo)
|
|
{
|
|
mo->angle = self->angle;
|
|
}
|
|
}
|