- got rid of all default parameter redundancies.

- scriptified a few more functions.
This commit is contained in:
Christoph Oelckers 2016-10-28 00:32:52 +02:00
parent 03efb63e93
commit 286f9510d4
26 changed files with 183 additions and 251 deletions

View File

@ -50,7 +50,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireCrackle)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Fire)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT_OPT(height) { height = 0; }
PARAM_FLOAT_DEF(height);
A_Fire(self, height);
return 0;
@ -81,7 +81,7 @@ void A_Fire(AActor *self, double height)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileTarget)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT(fire, AActor) { fire = PClass::FindActor("ArchvileFire"); }
PARAM_CLASS_DEF(fire, AActor);
AActor *fog;
@ -112,13 +112,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileTarget)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_SOUND_OPT (snd) { snd = "vile/stop"; }
PARAM_INT_OPT (dmg) { dmg = 20; }
PARAM_INT_OPT (blastdmg) { blastdmg = 70; }
PARAM_INT_OPT (blastrad) { blastrad = 70; }
PARAM_FLOAT_OPT (thrust) { thrust = 1; }
PARAM_NAME_OPT (dmgtype) { dmgtype = NAME_Fire; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_SOUND_DEF (snd)
PARAM_INT_DEF (dmg)
PARAM_INT_DEF (blastdmg)
PARAM_INT_DEF (blastrad)
PARAM_FLOAT_DEF (thrust)
PARAM_NAME_DEF (dmgtype)
PARAM_INT_DEF (flags)
AActor *fire, *target;

View File

@ -112,7 +112,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BrainDie)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BrainSpit)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; }
PARAM_CLASS_DEF(spawntype, AActor);
DSpotState *state = DSpotState::GetSpotState();
AActor *targ;
@ -298,7 +298,7 @@ static void SpawnFly(AActor *self, PClassActor *spawntype, FSoundID sound)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnFly)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT (spawntype, AActor) { spawntype = NULL; }
PARAM_CLASS_DEF(spawntype, AActor);
FSoundID sound;

View File

@ -116,17 +116,17 @@ enum SAW_Flags
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
{
PARAM_ACTION_PROLOGUE(AActor);
PARAM_SOUND_OPT (fullsound) { fullsound = "weapons/sawfull"; }
PARAM_SOUND_OPT (hitsound) { hitsound = "weapons/sawhit"; }
PARAM_INT_OPT (damage) { damage = 2; }
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = NULL; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_FLOAT_OPT (range) { range = 0; }
PARAM_ANGLE_OPT (spread_xy) { spread_xy = 2.8125; }
PARAM_ANGLE_OPT (spread_z) { spread_z = 0.; }
PARAM_FLOAT_OPT (lifesteal) { lifesteal = 0; }
PARAM_INT_OPT (lifestealmax) { lifestealmax = 0; }
PARAM_CLASS_OPT (armorbonustype, ABasicArmorBonus) { armorbonustype = NULL; }
PARAM_SOUND_DEF (fullsound)
PARAM_SOUND_DEF (hitsound)
PARAM_INT_DEF (damage)
PARAM_CLASS_DEF (pufftype, AActor)
PARAM_INT_DEF (flags)
PARAM_FLOAT_DEF (range)
PARAM_ANGLE_DEF (spread_xy)
PARAM_ANGLE_DEF (spread_z)
PARAM_FLOAT_DEF (lifesteal)
PARAM_INT_DEF (lifestealmax)
PARAM_CLASS_DEF (armorbonustype, ABasicArmorBonus)
DAngle angle;
DAngle slope;
@ -480,7 +480,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMissile)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireSTGrenade)
{
PARAM_ACTION_PROLOGUE(AActor);
PARAM_CLASS_OPT(grenade, AActor) { grenade = PClass::FindActor("Grenade"); }
PARAM_CLASS_DEF(grenade, AActor);
player_t *player;
@ -639,14 +639,14 @@ enum BFG_Flags
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT (spraytype, AActor) { spraytype = NULL; }
PARAM_INT_OPT (numrays) { numrays = 0; }
PARAM_INT_OPT (damagecnt) { damagecnt = 0; }
PARAM_ANGLE_OPT (angle) { angle = 0.; }
PARAM_FLOAT_OPT (distance) { distance = 0; }
PARAM_ANGLE_OPT (vrange) { vrange = 0.; }
PARAM_INT_OPT (defdamage) { defdamage = 0; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_CLASS_DEF (spraytype, AActor)
PARAM_INT_DEF (numrays)
PARAM_INT_DEF (damagecnt)
PARAM_ANGLE_DEF (angle)
PARAM_FLOAT_DEF (distance)
PARAM_ANGLE_DEF (vrange)
PARAM_INT_DEF (defdamage)
PARAM_INT_DEF (flags)
int i;
int j;

View File

@ -30,11 +30,11 @@ enum
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT (spawntype, AActor) { spawntype = NULL; }
PARAM_INT_OPT (n) { n = 0; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_FLOAT_OPT (vrange) { vrange = 4; }
PARAM_FLOAT_OPT (hrange) { hrange = 0.5; }
PARAM_CLASS_DEF (spawntype, AActor)
PARAM_INT_DEF (n)
PARAM_INT_DEF (flags)
PARAM_FLOAT_DEF (vrange)
PARAM_FLOAT_DEF (hrange)
int i, j;

View File

@ -17,7 +17,7 @@
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KeenDie)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT_OPT(doortag) { doortag = 666; }
PARAM_INT_DEF(doortag);
A_Unblock(self, false);

View File

@ -37,7 +37,7 @@ void A_SkullAttack(AActor *self, double speed)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullAttack)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT_OPT(speed) { speed = SKULLSPEED; }
PARAM_FLOAT_DEF(speed);
if (speed <= 0)
speed = SKULLSPEED;

View File

@ -141,54 +141,14 @@ void A_PainShootSkull (AActor *self, DAngle Angle, PClassActor *spawntype, int f
}
//
// A_PainAttack
// Spawn a lost soul and launch it at the target
//
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PainAttack)
DEFINE_ACTION_FUNCTION(AActor, A_PainShootSkull)
{
PARAM_SELF_PROLOGUE(AActor);
if (!self->target)
return 0;
PARAM_CLASS_OPT (spawntype, AActor) { spawntype = NULL; }
PARAM_ANGLE_OPT (angle) { angle = 0.; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_INT_OPT (limit) { limit = -1; }
if (!(flags & PAF_AIMFACING))
A_FaceTarget (self);
A_PainShootSkull (self, self->Angles.Yaw + angle, spawntype, flags, limit);
PARAM_CLASS(spawntype, AActor);
PARAM_FLOAT(angle);
PARAM_INT_DEF(flags);
PARAM_INT_DEF(limit);
A_PainShootSkull(self, angle, spawntype, flags, limit);
return 0;
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DualPainAttack)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; }
if (!self->target)
return 0;
A_FaceTarget (self);
A_PainShootSkull (self, self->Angles.Yaw + 45., spawntype);
A_PainShootSkull (self, self->Angles.Yaw - 45., spawntype);
return 0;
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PainDie)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT(spawntype, AActor) { spawntype = NULL; }
if (self->target != NULL && self->IsFriend(self->target))
{ // And I thought you were my friend!
self->flags &= ~MF_FRIENDLY;
}
A_Unblock(self, true);
A_PainShootSkull (self, self->Angles.Yaw + 90, spawntype);
A_PainShootSkull (self, self->Angles.Yaw + 180, spawntype);
A_PainShootSkull (self, self->Angles.Yaw + 270, spawntype);
return 0;
}

View File

@ -151,7 +151,7 @@ void AScriptedMarine::Tick ()
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Refire)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_BOOL_OPT(ignoremissile) { ignoremissile = false; }
PARAM_BOOL_DEF(ignoremissile);
if (self->target == NULL || self->target->health <= 0)
{
@ -250,10 +250,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_MarineLook)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_SOUND_OPT (fullsound) { fullsound = "weapons/sawfull"; }
PARAM_SOUND_OPT (hitsound) { hitsound = "weapons/sawhit"; }
PARAM_INT_OPT (damage) { damage = 2; }
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = NULL; }
PARAM_SOUND_DEF (fullsound)
PARAM_SOUND_DEF (hitsound)
PARAM_INT_DEF (damage)
PARAM_CLASS_DEF (pufftype, AActor)
if (self->target == NULL)
return 0;

View File

@ -48,7 +48,7 @@ static FRandom pr_volcimpact ("VolcBallImpact");
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PodPain)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT (gootype, AActor) { gootype = PClass::FindActor("PodGoo"); }
PARAM_CLASS_DEF (gootype, AActor)
int count;
int chance;
@ -103,7 +103,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RemovePod)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MakePod)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT(podtype, AActor) { podtype = PClass::FindActor("Pod"); }
PARAM_CLASS_DEF(podtype, AActor)
AActor *mo;

View File

@ -96,12 +96,12 @@ enum
DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast)
{
PARAM_ACTION_PROLOGUE(AActor);
PARAM_INT_OPT (blastflags) { blastflags = 0; }
PARAM_FLOAT_OPT (strength) { strength = 255; }
PARAM_FLOAT_OPT (radius) { radius = 255; }
PARAM_FLOAT_OPT (speed) { speed = 20; }
PARAM_CLASS_OPT (blasteffect, AActor) { blasteffect = PClass::FindActor("BlastEffect"); }
PARAM_SOUND_OPT (blastsound) { blastsound = "BlastRadius"; }
PARAM_INT_DEF (blastflags)
PARAM_FLOAT_DEF (strength)
PARAM_FLOAT_DEF (radius)
PARAM_FLOAT_DEF (speed)
PARAM_CLASS_DEF (blasteffect, AActor)
PARAM_SOUND_DEF (blastsound)
AActor *mo;
TThinkerIterator<AActor> iterator;

View File

@ -258,8 +258,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MLightningAttack)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT(floor, AActor) { floor = PClass::FindActor("LightningFloor"); }
PARAM_CLASS_OPT(ceiling, AActor) { ceiling = PClass::FindActor("LightningCeiling"); }
PARAM_CLASS_DEF(floor, AActor);
PARAM_CLASS_DEF(ceiling, AActor);
AActor *fmo, *cmo;

View File

@ -122,7 +122,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT(balltype, AActor) { balltype = NULL; }
PARAM_CLASS_DEF(balltype, AActor);
AActor *ball;

View File

@ -382,9 +382,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnSingleItem)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS (cls, AActor);
PARAM_INT_OPT (fail_sp) { fail_sp = 0; }
PARAM_INT_OPT (fail_co) { fail_co = 0; }
PARAM_INT_OPT (fail_dm) { fail_dm = 0; }
PARAM_INT_DEF (fail_sp)
PARAM_INT_DEF (fail_co)
PARAM_INT_DEF (fail_dm)
AActor *spot = NULL;
DSpotState *state = DSpotState::GetSpotState();

View File

@ -1923,8 +1923,8 @@ PClassWeapon *Net_ReadWeapon(BYTE **stream)
DEFINE_ACTION_FUNCTION_PARAMS(AWeapon, A_ZoomFactor)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT_OPT (zoom) { zoom = 1; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_FLOAT_DEF(zoom);
PARAM_INT_DEF(flags);
if (self->player != NULL && self->player->ReadyWeapon != NULL)
{

View File

@ -147,8 +147,8 @@ enum
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_AlertMonsters)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT_OPT(maxdist) { maxdist = 0; }
PARAM_INT_OPT(Flags) { Flags = 0; }
PARAM_FLOAT_DEF(maxdist);
PARAM_INT_DEF(Flags);
AActor * target = NULL;
AActor * emitter = self;

View File

@ -1148,7 +1148,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BulletAttack)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Jump)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT_OPT(maxchance) { maxchance = 256; }
PARAM_INT_DEF(maxchance);
paramnum++; // Increment paramnum to point at the first jump target
int count = numparam - paramnum;
@ -2685,7 +2685,7 @@ bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS)
}
if (!orresult)
{
PARAM_INT_OPT(setreceiver) { setreceiver = AAPTR_DEFAULT; }
PARAM_INT_DEF(setreceiver);
receiver = COPY_AAPTR(receiver, setreceiver);
}
if (receiver == NULL)
@ -7015,52 +7015,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CopySpriteFrame)
ACTION_RETURN_BOOL(true);
}
//==========================================================================
//
// A_SetSpriteAngle(angle, ptr)
//
// Specifies which angle the actor must always draw its sprite from.
//==========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpriteAngle)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT_DEF(angle);
PARAM_INT_DEF(ptr);
AActor *mobj = COPY_AAPTR(self, ptr);
if (mobj == nullptr)
{
ACTION_RETURN_BOOL(false);
}
mobj->SpriteAngle = angle;
ACTION_RETURN_BOOL(true);
}
//==========================================================================
//
// A_SetSpriteRotation(angle, ptr)
//
// Specifies how much to fake a sprite rotation.
//==========================================================================
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpriteRotation)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_ANGLE_OPT(angle) { angle = 0.; }
PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; }
AActor *mobj = COPY_AAPTR(self, ptr);
if (mobj == nullptr)
{
ACTION_RETURN_BOOL(false);
}
mobj->SpriteRotation = angle;
ACTION_RETURN_BOOL(true);
}
//==========================================================================
//
// A_SetMaskRotation(anglestart, angleend, pitchstart, pitchend, flags, ptr)

View File

@ -1922,12 +1922,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LookEx)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_FLOAT_OPT (minseedist) { minseedist = 0; }
PARAM_FLOAT_OPT (maxseedist) { maxseedist = 0; }
PARAM_FLOAT_OPT (maxheardist) { maxheardist = 0; }
PARAM_ANGLE_OPT (fov) { fov = 0.; }
PARAM_STATE_OPT (seestate) { seestate = NULL; }
PARAM_INT_DEF (flags)
PARAM_FLOAT_DEF (minseedist)
PARAM_FLOAT_DEF (maxseedist)
PARAM_FLOAT_DEF (maxheardist)
PARAM_ANGLE_DEF (fov)
PARAM_STATE_DEF (seestate)
AActor *targ = NULL; // Shuts up gcc
double dist;
@ -2139,7 +2139,7 @@ enum ChaseFlags
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Wander)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_INT_DEF(flags);
A_Wander(self, flags);
return 0;
}
@ -2781,9 +2781,9 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Chase)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_STATE_OPT (melee) { melee = NULL; }
PARAM_STATE_OPT (missile) { missile = NULL; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_STATE_DEF (melee)
PARAM_STATE_DEF (missile)
PARAM_INT_DEF (flags)
if (numparam > 1)
{
@ -2822,8 +2822,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ExtChase)
PARAM_SELF_PROLOGUE(AActor);
PARAM_BOOL (domelee);
PARAM_BOOL (domissile);
PARAM_BOOL_OPT (playactive) { playactive = true; }
PARAM_BOOL_OPT (nightmarefast) { nightmarefast = false; }
PARAM_BOOL_DEF (playactive);
PARAM_BOOL_DEF (nightmarefast);
// Now that A_Chase can handle state label parameters, this function has become rather useless...
A_DoChase(stack, self, false,
@ -2957,45 +2957,18 @@ void A_FaceTarget(AActor *self)
A_Face(self, self->target);
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTarget)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Face)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_ANGLE_OPT(max_turn) { max_turn = 0.; }
PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270.; }
PARAM_ANGLE_OPT(ang_offset) { ang_offset = 0.; }
PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0.; }
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_FLOAT_OPT(z_add) { z_add = 0; }
PARAM_OBJECT(faceto, AActor)
PARAM_ANGLE_DEF(max_turn)
PARAM_ANGLE_DEF(max_pitch)
PARAM_ANGLE_DEF(ang_offset)
PARAM_ANGLE_DEF(pitch_offset)
PARAM_INT_DEF(flags)
PARAM_FLOAT_DEF(z_add)
A_Face(self, self->target, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_add);
return 0;
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMaster)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_ANGLE_OPT(max_turn) { max_turn = 0.; }
PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270.; }
PARAM_ANGLE_OPT(ang_offset) { ang_offset = 0.; }
PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0.; }
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_FLOAT_OPT(z_add) { z_add = 0; }
A_Face(self, self->master, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_add);
return 0;
}
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTracer)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_ANGLE_OPT(max_turn) { max_turn = 0.; }
PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270.; }
PARAM_ANGLE_OPT(ang_offset) { ang_offset = 0.; }
PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0.; }
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_FLOAT_OPT(z_add) { z_add = 0; }
A_Face(self, self->tracer, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_add);
A_Face(self, faceto, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_add);
return 0;
}

View File

@ -514,7 +514,7 @@ DEFINE_ACTION_FUNCTION(AActor, SetState)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_STATE(state);
PARAM_BOOL_OPT(nofunction) { nofunction = false; }
PARAM_BOOL_DEF(nofunction);
ACTION_RETURN_BOOL(self->SetState(state, nofunction));
};
@ -6257,6 +6257,13 @@ bool AActor::IsFriend (AActor *other)
return false;
}
DEFINE_ACTION_FUNCTION(AActor, isFriend)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(other, AActor);
ACTION_RETURN_BOOL(self->IsFriend(other));
}
//==========================================================================
//
// AActor :: IsHostile

View File

@ -744,7 +744,7 @@ void DoReadyWeapon(AActor *self)
DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_WeaponReady)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_INT_DEF(flags);
DoReadyWeaponToSwitch(self, !(flags & WRF_NoSwitch));
if ((flags & WRF_NoFire) != WRF_NoFire) DoReadyWeaponToFire(self, !(flags & WRF_NoPrimary), !(flags & WRF_NoSecondary));
@ -876,7 +876,7 @@ static void P_CheckWeaponButtons (player_t *player)
DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_ReFire)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_STATE_OPT(state) { state = NULL; }
PARAM_STATE_DEF(state);
A_ReFire(self, state);
return 0;
}
@ -1003,10 +1003,10 @@ void A_OverlayOffset(AActor *self, int layer, double wx, double wy, int flags)
DEFINE_ACTION_FUNCTION(AActor, A_OverlayOffset)
{
PARAM_ACTION_PROLOGUE(AActor);
PARAM_INT_OPT(layer) { layer = PSP_WEAPON; }
PARAM_FLOAT_OPT(wx) { wx = 0.; }
PARAM_FLOAT_OPT(wy) { wy = 32.; }
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_INT_DEF(layer)
PARAM_FLOAT_DEF(wx)
PARAM_FLOAT_DEF(wy)
PARAM_INT_DEF(flags)
A_OverlayOffset(self, ((layer != 0) ? layer : stateinfo->mPSPIndex), wx, wy, flags);
return 0;
}
@ -1014,9 +1014,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_OverlayOffset)
DEFINE_ACTION_FUNCTION(AActor, A_WeaponOffset)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_FLOAT_OPT(wx) { wx = 0.; }
PARAM_FLOAT_OPT(wy) { wy = 32.; }
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_FLOAT_DEF(wx)
PARAM_FLOAT_DEF(wy)
PARAM_INT_DEF(flags)
A_OverlayOffset(self, PSP_WEAPON, wx, wy, flags);
return 0;
}
@ -1073,7 +1073,7 @@ static double GetOverlayPosition(AActor *self, int layer, bool gety)
DEFINE_ACTION_FUNCTION(AActor, OverlayX)
{
PARAM_ACTION_PROLOGUE(AActor);
PARAM_INT_OPT(layer) { layer = 0; }
PARAM_INT_DEF(layer);
if (ACTION_CALL_FROM_PSPRITE())
{
@ -1086,7 +1086,7 @@ DEFINE_ACTION_FUNCTION(AActor, OverlayX)
DEFINE_ACTION_FUNCTION(AActor, OverlayY)
{
PARAM_ACTION_PROLOGUE(AActor);
PARAM_INT_OPT(layer) { layer = 0; }
PARAM_INT_DEF(layer);
if (ACTION_CALL_FROM_PSPRITE())
{
@ -1214,8 +1214,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Overlay)
{
PARAM_ACTION_PROLOGUE(AActor);
PARAM_INT (layer);
PARAM_STATE_OPT (state) { state = nullptr; }
PARAM_BOOL_OPT (dontoverride) { dontoverride = false; }
PARAM_STATE_DEF(state);
PARAM_BOOL_DEF(dontoverride);
player_t *player = self->player;
@ -1233,9 +1233,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Overlay)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ClearOverlays)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_INT_OPT(start) { start = 0; }
PARAM_INT_OPT(stop) { stop = 0; }
PARAM_BOOL_OPT(safety) { safety = true; }
PARAM_INT_DEF(start);
PARAM_INT_DEF(stop);
PARAM_BOOL_DEF(safety)
if (self->player == nullptr)
ACTION_RETURN_INT(0);
@ -1284,8 +1284,8 @@ enum GF_Flags
DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_GunFlash)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_STATE_OPT(flash) { flash = nullptr; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_STATE_DEF(flash);
PARAM_INT_DEF(flags);
player_t *player = self->player;

View File

@ -909,7 +909,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckSight)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(target, AActor);
PARAM_INT_OPT(flags) { flags = 0; }
PARAM_INT_DEF(flags);
ACTION_RETURN_BOOL(P_CheckSight(self, target, flags));
}

View File

@ -1626,7 +1626,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullPop)
{
PARAM_SELF_PROLOGUE(AActor);
PARAM_CLASS_OPT(spawntype, APlayerChunk) { spawntype = NULL; }
PARAM_CLASS_DEF(spawntype, APlayerChunk);
APlayerPawn *mo;
player_t *player;

View File

@ -447,12 +447,11 @@ static FFlagDef *FindFlag (FFlagDef *flags, int numflags, const char *flag)
FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2, bool strict)
{
FFlagDef *def;
size_t i;
if (part2 == NULL)
{ // Search all lists
int max = strict ? 2 : NUM_FLAG_LISTS;
for (i = 0; i < max; ++i)
for (int i = 0; i < max; ++i)
{
if (type->IsDescendantOf (*FlagLists[i].Type))
{
@ -466,7 +465,7 @@ FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2, bo
}
else
{ // Search just the named list
for (i = 0; i < NUM_FLAG_LISTS; ++i)
for (size_t i = 0; i < NUM_FLAG_LISTS; ++i)
{
if (stricmp ((*FlagLists[i].Type)->TypeName.GetChars(), part1) == 0)
{

View File

@ -945,15 +945,6 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction
#define PARAM_OBJECT_DEF_AT(p,x,t) t *x; if (PARAM_EXISTS(p)) { ASSERTOBJECT(param[p]); x = (t*)param[p].a; } else { ASSERTOBJECT(defaultparam[p]); x = (t*)defaultparam[p].a; }
#define PARAM_CLASS_DEF_AT(p,x,t) t::MetaClass *x; if (PARAM_EXISTS(p)) { ASSERTOBJECT(param[p]); x = (t::MetaClass*)param[p].a; } else { ASSERTOBJECT(defaultparam[p]); x = (t::MetaClass*)defaultparam[p].a; }
#define PARAM_INT_OPT_AT(p,x) int x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_INT); x = param[p].i; } else
#define PARAM_BOOL_OPT_AT(p,x) bool x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_INT); x = !!param[p].i; } else
#define PARAM_NAME_OPT_AT(p,x) FName x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_INT); x = ENamedName(param[p].i); } else
#define PARAM_SOUND_OPT_AT(p,x) FSoundID x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_INT); x = FSoundID(param[p].i); } else
#define PARAM_FLOAT_OPT_AT(p,x) double x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_FLOAT); x = param[p].f; } else
#define PARAM_ANGLE_OPT_AT(p,x) DAngle x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_FLOAT); x = param[p].f; } else
#define PARAM_STATE_OPT_AT(p,x) FState *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_STATE || param[p].atag == ATAG_GENERIC || param[p].a == NULL)); x = (FState *)param[p].a; } else
#define PARAM_CLASS_OPT_AT(p,x,base) base::MetaClass *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); x = (base::MetaClass *)param[p].a; assert(x == NULL || x->IsDescendantOf(RUNTIME_CLASS(base))); } else
// The above, but with an automatically increasing position index.
#define PARAM_PROLOGUE int paramnum = -1;
@ -983,15 +974,6 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction
#define PARAM_OBJECT_DEF(x,type) ++paramnum; PARAM_OBJECT_DEF_AT(paramnum,x,type)
#define PARAM_CLASS_DEF(x,base) ++paramnum; PARAM_CLASS_DEF_AT(paramnum,x,base)
#define PARAM_INT_OPT(x) ++paramnum; PARAM_INT_OPT_AT(paramnum,x)
#define PARAM_BOOL_OPT(x) ++paramnum; PARAM_BOOL_OPT_AT(paramnum,x)
#define PARAM_NAME_OPT(x) ++paramnum; PARAM_NAME_OPT_AT(paramnum,x)
#define PARAM_SOUND_OPT(x) ++paramnum; PARAM_SOUND_OPT_AT(paramnum,x)
#define PARAM_FLOAT_OPT(x) ++paramnum; PARAM_FLOAT_OPT_AT(paramnum,x)
#define PARAM_ANGLE_OPT(x) ++paramnum; PARAM_ANGLE_OPT_AT(paramnum,x)
#define PARAM_STATE_OPT(x) ++paramnum; PARAM_STATE_OPT_AT(paramnum,x)
#define PARAM_CLASS_OPT(x,base) ++paramnum; PARAM_CLASS_OPT_AT(paramnum,x,base)
typedef int(*actionf_p)(VMFrameStack *stack, VMValue *param, TArray<VMValue> &defaultparam, int numparam, VMReturn *ret, int numret);/*(VM_ARGS)*/
struct AFuncDesc

View File

@ -728,6 +728,10 @@ void FFunctionBuildList::Build()
sfunc->PrintableName = item.PrintableName;
}
delete item.Code;
if (dump != nullptr)
{
fflush(dump);
}
}
if (dump != nullptr)
{

View File

@ -66,6 +66,7 @@ class Actor : Thinker native
native void LinkToWorld();
native void UnlinkFromWorld();
native void VelFromAngle(float speed = 0, float angle = 0);
native bool isFriend(Actor other);
// DECORATE compatible functions
native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
@ -173,6 +174,22 @@ class Actor : Thinker native
DamageMobj(null, null, health, damagetype, DMG_FORCED);
}
native void A_Face(Actor faceto, float max_turn = 0, float max_pitch = 270, float ang_offset = 0, float pitch_offset = 0, int flags = 0, float z_ofs = 0);
void A_FaceTarget(float max_turn = 0, float max_pitch = 270, float ang_offset = 0, float pitch_offset = 0, int flags = 0, float z_ofs = 0)
{
A_Face(target, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_ofs);
}
void A_FaceTracer(float max_turn = 0, float max_pitch = 270, float ang_offset = 0, float pitch_offset = 0, int flags = 0, float z_ofs = 0)
{
A_Face(tracer, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_ofs);
}
void A_FaceMaster(float max_turn = 0, float max_pitch = 270, float ang_offset = 0, float pitch_offset = 0, int flags = 0, float z_ofs = 0)
{
A_Face(master, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_ofs);
}
// Action functions
// Meh, MBF redundant functions. Only for DeHackEd support.
native bool A_LineEffect(int boomspecial = 0, int tag = 0);
@ -185,9 +202,6 @@ class Actor : Thinker native
native void A_XScream();
native void A_Look();
native void A_Chase(state melee = null, state missile = null, int flags = 0);
native void A_FaceTarget(float max_turn = 0, float max_pitch = 270, float ang_offset = 0, float pitch_offset = 0, int flags = 0, float z_ofs = 0);
native void A_FaceTracer(float max_turn = 0, float max_pitch = 270, float ang_offset = 0, float pitch_offset = 0, int flags = 0, float z_ofs = 0);
native void A_FaceMaster(float max_turn = 0, float max_pitch = 270, float ang_offset = 0, float pitch_offset = 0, int flags = 0, float z_ofs = 0);
native void A_Scream();
native void A_VileChase();
native void A_VileStart();
@ -203,9 +217,6 @@ class Actor : Thinker native
native void A_BossDeath();
native void A_SkullAttack(float speed = 20);
native void A_BetaSkullAttack();
native void A_PainAttack(class<Actor> spawntype = "LostSoul", float angle = 0, int flags = 0, int limit = -1);
native void A_DualPainAttack(class<Actor> spawntype = "LostSoul");
native void A_PainDie(class<Actor> spawntype = "LostSoul");
native void A_KeenDie(int doortag = 666);
native void A_BrainPain();
native void A_BrainScream();

View File

@ -51,3 +51,45 @@ class PainElemental : Actor
Goto See;
}
}
//===========================================================================
//
// Code (must be attached to Actor)
//
//===========================================================================
extend class Actor
{
native void A_PainShootSkull(Class<Actor> spawntype, float angle, int flags = 0, int limit = -1);
void A_PainAttack(class<Actor> spawntype = "LostSoul", float addangle = 0, int flags = 0, int limit = -1)
{
if (target)
{
A_FaceTarget();
A_PainShootSkull(spawntype, angle + addangle, flags, limit);
}
}
void A_DualPainAttack(class<Actor> spawntype = "LostSoul")
{
if (target)
{
A_FaceTarget();
A_PainShootSkull(spawntype, angle + 45);
A_PainShootSkull(spawntype, angle - 45);
}
}
void A_PainDie(class<Actor> spawntype = "LostSoul")
{
if (target && IsFriend(target))
{ // And I thought you were my friend!
bFriendly = false;
}
A_NoBlocking();
A_PainShootSkull(spawntype, angle + 90);
A_PainShootSkull(spawntype, angle + 180);
A_PainShootSkull(spawntype, angle + 270);
}
}