- scriptified several trivial functions from a_action.cpp.

This commit is contained in:
Christoph Oelckers 2016-11-01 16:32:47 +01:00
parent 7137e87b4b
commit 88fd47247d
4 changed files with 25 additions and 241 deletions

View file

@ -109,71 +109,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_NoBlocking)
return 0; return 0;
} }
DEFINE_ACTION_FUNCTION(AActor, A_Fall)
{
PARAM_SELF_PROLOGUE(AActor);
A_Unblock(self, true);
return 0;
}
//==========================================================================
//
// A_SetFloorClip
//
//==========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_SetFloorClip)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags2 |= MF2_FLOORCLIP;
self->AdjustFloorClip ();
return 0;
}
//==========================================================================
//
// A_UnSetFloorClip
//
//==========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_UnSetFloorClip)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags2 &= ~MF2_FLOORCLIP;
self->Floorclip = 0;
return 0;
}
//==========================================================================
//
// A_HideThing
//
//==========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_HideThing)
{
PARAM_SELF_PROLOGUE(AActor);
self->renderflags |= RF_INVISIBLE;
return 0;
}
//==========================================================================
//
// A_UnHideThing
//
//==========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_UnHideThing)
{
PARAM_SELF_PROLOGUE(AActor);
self->renderflags &= ~RF_INVISIBLE;
return 0;
}
//============================================================================ //============================================================================
// //
// A_FreezeDeath // A_FreezeDeath
@ -475,164 +410,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_DeQueueCorpse)
return 0; return 0;
} }
//============================================================================
//
// A_SetInvulnerable
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_SetInvulnerable)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags2 |= MF2_INVULNERABLE;
return 0;
}
//============================================================================
//
// A_UnSetInvulnerable
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_UnSetInvulnerable)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags2 &= ~MF2_INVULNERABLE;
return 0;
}
//============================================================================
//
// A_SetReflective
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_SetReflective)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags2 |= MF2_REFLECTIVE;
return 0;
}
//============================================================================
//
// A_UnSetReflective
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_UnSetReflective)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags2 &= ~MF2_REFLECTIVE;
return 0;
}
//============================================================================
//
// A_SetReflectiveInvulnerable
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_SetReflectiveInvulnerable)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags2 |= MF2_REFLECTIVE|MF2_INVULNERABLE;
return 0;
}
//============================================================================
//
// A_UnSetReflectiveInvulnerable
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_UnSetReflectiveInvulnerable)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags2 &= ~(MF2_REFLECTIVE|MF2_INVULNERABLE);
return 0;
}
//==========================================================================
//
// A_SetShootable
//
//==========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_SetShootable)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags2 &= ~MF2_NONSHOOTABLE;
self->flags |= MF_SHOOTABLE;
return 0;
}
//==========================================================================
//
// A_UnSetShootable
//
//==========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_UnSetShootable)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags2 |= MF2_NONSHOOTABLE;
self->flags &= ~MF_SHOOTABLE;
return 0;
}
//===========================================================================
//
// A_NoGravity
//
//===========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_NoGravity)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags |= MF_NOGRAVITY;
return 0;
}
//===========================================================================
//
// A_Gravity
//
//===========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_Gravity)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags &= ~MF_NOGRAVITY;
self->Gravity = 1;
return 0;
}
//===========================================================================
//
// A_LowGravity
//
//===========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_LowGravity)
{
PARAM_SELF_PROLOGUE(AActor);
self->flags &= ~MF_NOGRAVITY;
self->Gravity = 1. / 8;;
return 0;
}
//=========================================================================== //===========================================================================
// //
// FaceMovementDirection // FaceMovementDirection

View file

@ -4509,6 +4509,13 @@ void AActor::AdjustFloorClip ()
} }
} }
DEFINE_ACTION_FUNCTION(AActor, AdjustFloorClip)
{
PARAM_SELF_PROLOGUE(AActor);
self->AdjustFloorClip();
return 0;
}
// //
// P_SpawnPlayer // P_SpawnPlayer
// Called when a player is spawned on the level. // Called when a player is spawned on the level.

View file

@ -718,6 +718,7 @@ void InitThingdef()
symt.AddSymbol(new PField(NAME_Damage, TypeSInt32, VARF_Native|VARF_ReadOnly, myoffsetof(AActor, DamageVal))); symt.AddSymbol(new PField(NAME_Damage, TypeSInt32, VARF_Native|VARF_ReadOnly, myoffsetof(AActor, DamageVal)));
symt.AddSymbol(new PField("visdir", TypeSInt32, VARF_Native, myoffsetof(AActor, visdir))); symt.AddSymbol(new PField("visdir", TypeSInt32, VARF_Native, myoffsetof(AActor, visdir)));
symt.AddSymbol(new PField("Gravity", TypeFloat64, VARF_Native, myoffsetof(AActor, Gravity))); symt.AddSymbol(new PField("Gravity", TypeFloat64, VARF_Native, myoffsetof(AActor, Gravity)));
symt.AddSymbol(new PField("FloorClip", TypeFloat64, VARF_Native, myoffsetof(AActor, Floorclip)));
symt.AddSymbol(new PField("DamageType", TypeName, VARF_Native, myoffsetof(AActor, DamageType))); symt.AddSymbol(new PField("DamageType", TypeName, VARF_Native, myoffsetof(AActor, DamageType)));
symt.AddSymbol(new PField("FloatBobPhase", TypeUInt8, VARF_Native, myoffsetof(AActor, FloatBobPhase))); symt.AddSymbol(new PField("FloatBobPhase", TypeUInt8, VARF_Native, myoffsetof(AActor, FloatBobPhase)));
symt.AddSymbol(new PField("tics", TypeSInt32, VARF_Native, myoffsetof(AActor, tics))); symt.AddSymbol(new PField("tics", TypeSInt32, VARF_Native, myoffsetof(AActor, tics)));

View file

@ -76,6 +76,7 @@ class Actor : Thinker native
native vector3 Vec2OffsetZ(float x, float y, float atz, bool absolute = false); native vector3 Vec2OffsetZ(float x, float y, float atz, bool absolute = false);
native void VelFromAngle(float speed = 0, float angle = 0); native void VelFromAngle(float speed = 0, float angle = 0);
native bool isFriend(Actor other); native bool isFriend(Actor other);
native void AdjustFloorClip();
// DECORATE compatible functions // DECORATE compatible functions
native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false); native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
@ -98,7 +99,22 @@ class Actor : Thinker native
// DECORATE setters - it probably makes more sense to set these values directly now... // DECORATE setters - it probably makes more sense to set these values directly now...
void A_SetMass(int newmass) { mass = newmass; } void A_SetMass(int newmass) { mass = newmass; }
void A_SetInvulnerable() { bInvulnerable = true; }
void A_UnSetInvulnerable() { bInvulnerable = false; }
void A_SetReflective() { bReflective = true; }
void A_UnSetReflective() { bReflective = false; }
void A_SetReflectiveInvulnerable() { bInvulnerable = true; bReflective = true; }
void A_UnSetReflectiveInvulnerable() { bInvulnerable = true; bReflective = false; }
void A_SetShootable() { bShootable = true; bNonShootable = false; }
void A_UnSetShootable() { bShootable = false; bNonShootable = true; }
void A_NoGravity() { bNoGravity = true; }
void A_Gravity() { bNoGravity = false; Gravity = 1; }
void A_LowGravity() { bNoGravity = false; Gravity = 0.125; }
void A_SetGravity(float newgravity) { gravity = clamp(newgravity, 0., 10.); } void A_SetGravity(float newgravity) { gravity = clamp(newgravity, 0., 10.); }
void A_SetFloorClip() { bFloorClip = true; AdjustFloorClip(); }
void A_UnSetFloorClip() { bFloorClip = false; FloorClip = 0; }
void A_HideThing() { bInvisible = true; }
void A_UnHideThing() { bInvisible = false; }
void A_SetArg(int arg, int val) { if (arg >= 0 && arg < 5) args[arg] = val; } void A_SetArg(int arg, int val) { if (arg >= 0 && arg < 5) args[arg] = val; }
void A_Turn(float turn = 0) { angle += turn; } void A_Turn(float turn = 0) { angle += turn; }
void A_SetDamageType(name newdamagetype) { damagetype = newdamagetype; } void A_SetDamageType(name newdamagetype) { damagetype = newdamagetype; }
@ -208,6 +224,7 @@ class Actor : Thinker native
native void A_BFGSpray(class<Actor> spraytype = "BFGExtra", int numrays = 40, int damagecount = 15, float angle = 90, float distance = 16*64, float vrange = 32, int damage = 0, int flags = 0); native void A_BFGSpray(class<Actor> spraytype = "BFGExtra", int numrays = 40, int damagecount = 15, float angle = 90, float distance = 16*64, float vrange = 32, int damage = 0, int flags = 0);
native void A_Pain(); native void A_Pain();
native void A_NoBlocking(); native void A_NoBlocking();
void A_Fall() { A_NoBlocking(); }
native void A_XScream(); native void A_XScream();
native void A_Look(); native void A_Look();
native void A_Chase(state melee = null, state missile = null, int flags = 0); native void A_Chase(state melee = null, state missile = null, int flags = 0);
@ -224,24 +241,6 @@ class Actor : Thinker native
native void A_Detonate(); native void A_Detonate();
native bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0); native bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0);
native void A_SetFloorClip();
native void A_UnSetFloorClip();
native void A_HideThing();
native void A_UnHideThing();
native void A_SetInvulnerable();
native void A_UnSetInvulnerable();
native void A_SetReflective();
native void A_UnSetReflective();
native void A_SetReflectiveInvulnerable();
native void A_UnSetReflectiveInvulnerable();
native void A_SetShootable();
native void A_UnSetShootable();
native void A_NoGravity();
native void A_Gravity();
native void A_LowGravity();
native void A_Fall();
native void A_M_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class<Actor> pufftype = "BulletPuff"); native void A_M_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class<Actor> pufftype = "BulletPuff");
native void A_ScreamAndUnblock(); native void A_ScreamAndUnblock();