2017-01-11 22:46:03 +00:00
struct FCheckPosition
{
// in
native Actor thing;
native Vector3 pos;
// out
2017-01-11 23:26:16 +00:00
native Sector cursector;
2017-01-11 22:46:03 +00:00
native double floorz;
native double ceilingz;
native double dropoffz;
2017-01-11 23:26:16 +00:00
native TextureID floorpic;
2017-01-11 22:46:03 +00:00
native int floorterrain;
2017-01-11 23:26:16 +00:00
native Sector floorsector;
2017-01-11 22:46:03 +00:00
native TextureID ceilingpic;
2017-01-11 23:26:16 +00:00
native Sector ceilingsector;
2017-01-11 22:46:03 +00:00
native bool touchmidtex;
native bool abovemidtex;
native bool floatok;
native bool FromPMove;
native line ceilingline;
2017-01-11 23:26:16 +00:00
native Actor stepthing;
2017-01-11 22:46:03 +00:00
native bool DoRipping;
native bool portalstep;
2017-08-27 08:36:34 +00:00
native int portalgroup;
2017-01-11 22:46:03 +00:00
native int PushTime;
2018-11-28 16:33:37 +00:00
// These are internal helpers to properly initialize an object of this type.
private native void _Constructor();
private native void _Destructor();
2017-01-11 22:46:03 +00:00
native void ClearLastRipped();
}
2018-01-18 23:29:49 +00:00
struct FLineTraceData
{
enum ETraceResult
{
TRACE_HitNone,
TRACE_HitFloor,
TRACE_HitCeiling,
TRACE_HitWall,
TRACE_HitActor,
2018-11-02 05:14:02 +00:00
TRACE_CrossingPortal,
TRACE_HasHitSky
2018-01-18 23:29:49 +00:00
};
2020-03-14 10:47:03 +00:00
native Actor HitActor;
native Line HitLine;
native Sector HitSector;
native F3DFloor Hit3DFloor;
native TextureID HitTexture;
native Vector3 HitLocation;
native Vector3 HitDir;
native double Distance;
native int NumPortals;
native int LineSide;
native int LinePart;
native int SectorPlane;
native int HitType;
2018-01-18 23:29:49 +00:00
}
2017-01-13 21:13:03 +00:00
struct LinkContext
{
voidptr sector_list; // really msecnode but that's not exported yet.
voidptr render_list;
}
2017-01-11 22:46:03 +00:00
2016-10-11 16:53:10 +00:00
class Actor : Thinker native
{
const DEFAULT_HEALTH = 1000;
2016-11-18 20:34:06 +00:00
const ONFLOORZ = -2147483648.0;
const ONCEILINGZ = 2147483647.0;
const FLOATRANDZ = ONCEILINGZ-1;
2016-11-23 18:47:09 +00:00
const TELEFRAG_DAMAGE = 1000000;
2016-11-25 15:05:03 +00:00
const MinVel = 1./65536;
2016-11-27 20:41:04 +00:00
const LARGE_MASS = 10000000; // not INT_MAX on purpose
2017-04-30 22:25:21 +00:00
const ORIG_FRICTION = (0xE800/65536.); // original value
const ORIG_FRICTION_FACTOR = (2048/65536.); // original value
2018-11-24 08:33:03 +00:00
const DEFMORPHTICS = 40 * TICRATE;
2016-11-23 18:47:09 +00:00
2016-11-18 20:34:06 +00:00
2016-11-22 18:20:31 +00:00
// flags are not defined here, the native fields for those get synthesized from the internal tables.
// for some comments on these fields, see their native representations in actor.h.
2016-11-27 17:52:24 +00:00
native readonly Actor snext; // next in sector list.
2016-11-22 18:20:31 +00:00
native PlayerInfo Player;
native readonly vector3 Pos;
native vector3 Prev;
native double spriteAngle;
native double spriteRotation;
native double VisibleStartAngle;
native double VisibleStartPitch;
native double VisibleEndAngle;
native double VisibleEndPitch;
native double Angle;
native double Pitch;
native double Roll;
native vector3 Vel;
native double Speed;
native double FloatSpeed;
native SpriteID sprite;
native uint8 frame;
native vector2 Scale;
native TextureID picnum;
native double Alpha;
2016-11-30 00:25:51 +00:00
native readonly color fillcolor; // must be set with SetShade to initialize correctly.
2016-11-22 18:20:31 +00:00
native Sector CurSector;
native double CeilingZ;
native double FloorZ;
native double DropoffZ;
native Sector floorsector;
native TextureID floorpic;
native int floorterrain;
native Sector ceilingsector;
native TextureID ceilingpic;
native double Height;
native readonly double Radius;
2017-01-10 23:57:31 +00:00
native readonly double RenderRadius;
2016-11-22 18:20:31 +00:00
native double projectilepassheight;
native int tics;
native readonly State CurState;
native readonly int Damage;
native int projectilekickback;
native int special1;
native int special2;
native double specialf1;
native double specialf2;
native int weaponspecial;
native int Health;
native uint8 movedir;
native int8 visdir;
native int16 movecount;
native int16 strafecount;
native Actor Target;
native Actor Master;
native Actor Tracer;
native Actor LastHeard;
native Actor LastEnemy;
native Actor LastLookActor;
native int ReactionTime;
native int Threshold;
native readonly int DefThreshold;
2017-01-14 01:05:52 +00:00
native vector3 SpawnPoint;
native uint16 SpawnAngle;
2016-11-22 18:20:31 +00:00
native int StartHealth;
native uint8 WeaveIndexXY;
native uint8 WeaveIndexZ;
native int skillrespawncount;
native int Args[5];
native int Mass;
native int Special;
native readonly int TID;
native readonly int TIDtoHate;
native readonly int WaterLevel;
native int Score;
native int Accuracy;
native int Stamina;
native double MeleeRange;
native int PainThreshold;
native double Gravity;
native double FloorClip;
native name DamageType;
native name DamageTypeReceived;
native uint8 FloatBobPhase;
2017-06-03 15:42:57 +00:00
native double FloatBobStrength;
2016-11-22 18:20:31 +00:00
native int RipperLevel;
native int RipLevelMin;
native int RipLevelMax;
native name Species;
native Actor Alternative;
native Actor goal;
native uint8 MinMissileChance;
native int8 LastLookPlayerNumber;
native uint SpawnFlags;
native double meleethreshold;
native double maxtargetrange;
native double bouncefactor;
native double wallbouncefactor;
native int bouncecount;
native double friction;
native int FastChaseStrafeCount;
native double pushfactor;
native int lastpush;
native int activationtype;
native int lastbump;
native int DesignatedTeam;
native Actor BlockingMobj;
2017-01-12 23:35:56 +00:00
native Line BlockingLine;
2018-11-04 04:53:37 +00:00
native Sector Blocking3DFloor;
2018-10-31 19:56:01 +00:00
native Sector BlockingCeiling;
native Sector BlockingFloor;
2016-11-22 18:20:31 +00:00
native int PoisonDamage;
native name PoisonDamageType;
native int PoisonDuration;
native int PoisonPeriod;
native int PoisonDamageReceived;
native name PoisonDamageTypeReceived;
native int PoisonDurationReceived;
native int PoisonPeriodReceived;
native Actor Poisoner;
native Inventory Inv;
native uint8 smokecounter;
native uint8 FriendPlayer;
native uint Translation;
native sound AttackSound;
native sound DeathSound;
native sound SeeSound;
native sound PainSound;
native sound ActiveSound;
native sound UseSound;
native sound BounceSound;
native sound WallBounceSound;
native sound CrushPainSound;
native double MaxDropoffHeight;
native double MaxStepHeight;
native int16 PainChance;
native name PainType;
native name DeathType;
native double DamageFactor;
native double DamageMultiply;
native Class<Actor> TelefogSourceType;
native Class<Actor> TelefogDestType;
native readonly State SpawnState;
native readonly State SeeState;
native State MeleeState;
native State MissileState;
2017-01-10 23:57:31 +00:00
native voidptr /*DecalBase*/ DecalGenerator;
2017-01-13 18:29:54 +00:00
native uint8 fountaincolor;
2017-02-28 11:11:25 +00:00
native double CameraHeight; // Height of camera when used as such
2017-08-28 02:07:32 +00:00
native double CameraFOV;
2017-02-28 11:47:44 +00:00
native double RadiusDamageFactor; // Radius damage factor
native double SelfDamageFactor;
native double StealthAlpha;
2017-02-28 12:40:46 +00:00
native int WoundHealth; // Health needed to enter wound state
2017-03-02 09:26:23 +00:00
native readonly color BloodColor;
native readonly int BloodTranslation;
2017-07-29 17:59:36 +00:00
native int RenderHidden;
native int RenderRequired;
2018-01-09 17:34:01 +00:00
native readonly int FriendlySeeBlocks;
2018-11-04 17:30:40 +00:00
native readonly int SpawnTime;
2018-12-01 16:03:58 +00:00
private native int InventoryID; // internal counter.
2017-02-28 09:51:32 +00:00
2017-02-28 13:30:14 +00:00
meta String Obituary; // Player was killed by this actor
meta String HitObituary; // Player was killed by this actor in melee
2017-02-28 12:40:46 +00:00
meta double DeathHeight; // Height on normal death
meta double BurnHeight; // Height on burning death
meta int GibHealth; // Negative health below which this monster dies an extreme death
meta Sound HowlSound; // Sound being played when electrocuted or poisoned
2017-02-28 11:11:25 +00:00
meta Name BloodType; // Blood replacement type
meta Name BloodType2; // Bloopsplatter replacement type
meta Name BloodType3; // AxeBlood replacement type
2017-02-28 09:51:32 +00:00
meta bool DontHurtShooter;
meta int ExplosionRadius;
meta int ExplosionDamage;
meta int MeleeDamage;
meta Sound MeleeSound;
meta double MissileHeight;
meta Name MissileName;
2017-02-28 11:47:44 +00:00
meta double FastSpeed; // speed in fast mode
2017-02-28 09:51:32 +00:00
Property prefix: none;
2017-02-28 13:30:14 +00:00
Property Obituary: Obituary;
Property HitObituary: HitObituary;
2017-02-28 09:51:32 +00:00
Property MeleeDamage: MeleeDamage;
Property MeleeSound: MeleeSound;
Property MissileHeight: MissileHeight;
Property MissileType: MissileName;
Property DontHurtShooter: DontHurtShooter;
Property ExplosionRadius: ExplosionRadius;
Property ExplosionDamage: ExplosionDamage;
2017-03-01 19:20:46 +00:00
//Property BloodType: BloodType, BloodType2, BloodType3;
2017-02-28 11:47:44 +00:00
Property FastSpeed: FastSpeed;
2017-02-28 12:40:46 +00:00
Property HowlSound: HowlSound;
Property GibHealth: GibHealth;
Property DeathHeight: DeathHeight;
Property BurnHeight: BurnHeight;
2017-03-19 10:30:28 +00:00
property Health: health;
property WoundHealth: WoundHealth;
property ReactionTime: reactiontime;
property PainThreshold: PainThreshold;
property DamageMultiply: DamageMultiply;
property ProjectileKickback: ProjectileKickback;
property Speed: speed;
property FloatSpeed: FloatSpeed;
property Radius: radius;
property RenderRadius: RenderRadius;
property Height: height;
property ProjectilePassHeight: ProjectilePassHeight;
property Mass: mass;
property XScale: ScaleX;
property YScale: ScaleY;
property SeeSound: SeeSound;
property AttackSound: AttackSound;
property BounceSound: BounceSound;
property WallBounceSound: WallBounceSound;
property PainSound: PainSound;
property DeathSound: DeathSound;
property ActiveSound: ActiveSound;
property CrushPainSound: CrushPainSound;
property Alpha: Alpha;
property MaxTargetRange: MaxTargetRange;
property MeleeThreshold: MeleeThreshold;
property MeleeRange: MeleeRange;
property PushFactor: PushFactor;
property BounceCount: BounceCount;
property WeaveIndexXY: WeaveIndexXY;
property WeaveIndexZ: WeaveIndexZ;
property MinMissileChance: MinMissileChance;
property MaxStepHeight: MaxStepHeight;
property MaxDropoffHeight: MaxDropoffHeight;
property PoisonDamageType: PoisonDamageType;
property RadiusDamageFactor: RadiusDamageFactor;
property SelfDamageFactor: SelfDamageFactor;
property StealthAlpha: StealthAlpha;
property CameraHeight: CameraHeight;
2017-08-28 02:07:32 +00:00
property CameraFOV: CameraFOV;
2017-03-19 10:30:28 +00:00
property VSpeed: velz;
property SpriteRotation: SpriteRotation;
property VisibleAngles: VisibleStartAngle, VisibleEndAngle;
property VisiblePitch: VisibleStartPitch, VisibleEndPitch;
property Species: Species;
property Accuracy: accuracy;
property Stamina: stamina;
property TelefogSourceType: TelefogSourceType;
property TelefogDestType: TelefogDestType;
property Ripperlevel: RipperLevel;
property RipLevelMin: RipLevelMin;
property RipLevelMax: RipLevelMax;
2017-07-29 17:59:36 +00:00
property RenderHidden: RenderHidden;
property RenderRequired: RenderRequired;
2018-01-09 17:34:01 +00:00
property FriendlySeeBlocks: FriendlySeeBlocks;
2016-11-24 19:02:44 +00:00
2016-11-22 18:20:31 +00:00
// need some definition work first
//FRenderStyle RenderStyle;
2018-11-24 08:33:03 +00:00
native private int RenderStyle; // This is kept private until its real type has been implemented into the VM. But some code needs to copy this.
2016-11-22 18:20:31 +00:00
//int ConversationRoot; // THe root of the current dialogue
// deprecated things.
2020-03-10 08:31:21 +00:00
native readonly deprecated("2.3", "Use Pos.X instead") double X;
native readonly deprecated("2.3", "Use Pos.Y instead") double Y;
native readonly deprecated("2.3", "Use Pos.Z instead") double Z;
native readonly deprecated("2.3", "Use Vel.X instead") double VelX;
native readonly deprecated("2.3", "Use Vel.Y instead") double VelY;
native readonly deprecated("2.3", "Use Vel.Z instead") double VelZ;
native readonly deprecated("2.3", "Use Vel.X instead") double MomX;
native readonly deprecated("2.3", "Use Vel.Y instead") double MomY;
native readonly deprecated("2.3", "Use Vel.Z instead") double MomZ;
native deprecated("2.3", "Use Scale.X instead") double ScaleX;
native deprecated("2.3", "Use Scale.Y instead") double ScaleY;
2016-11-22 18:20:31 +00:00
//FStrifeDialogueNode *Conversation; // [RH] The dialogue to show when this actor is used.;
2016-10-11 16:53:10 +00:00
Default
{
Scale 1;
Health DEFAULT_HEALTH;
Reactiontime 8;
Radius 20;
2017-02-28 11:11:25 +00:00
RenderRadius 0;
2016-10-11 16:53:10 +00:00
Height 16;
Mass 100;
RenderStyle 'Normal';
Alpha 1;
MinMissileChance 200;
MeleeRange 64 - 20;
MaxDropoffHeight 24;
MaxStepHeight 24;
BounceFactor 0.7;
WallBounceFactor 0.75;
BounceCount -1;
FloatSpeed 4;
FloatBobPhase -1; // randomly initialize by default
2017-06-03 15:42:57 +00:00
FloatBobStrength 1.0;
2016-10-11 16:53:10 +00:00
Gravity 1;
Friction 1;
2016-11-11 13:40:32 +00:00
DamageFactor 1.0; // damage multiplier as target of damage.
DamageMultiply 1.0; // damage multiplier as source of damage.
2016-10-11 16:53:10 +00:00
PushFactor 0.25;
WeaveIndexXY 0;
WeaveIndexZ 16;
DesignatedTeam 255;
PainType "Normal";
DeathType "Normal";
TeleFogSourceType "TeleportFog";
TeleFogDestType 'TeleportFog';
RipperLevel 0;
RipLevelMin 0;
RipLevelMax 0;
DefThreshold 100;
BloodType "Blood", "BloodSplatter", "AxeBlood";
ExplosionDamage 128;
2017-02-28 09:51:32 +00:00
ExplosionRadius -1; // i.e. use ExplosionDamage value
2016-10-11 16:53:10 +00:00
MissileHeight 32;
SpriteAngle 0;
SpriteRotation 0;
StencilColor "00 00 00";
VisibleAngles 0, 0;
VisiblePitch 0, 0;
2016-11-14 17:31:12 +00:00
DefaultStateUsage SUF_ACTOR|SUF_OVERLAY;
2017-02-28 11:11:25 +00:00
CameraHeight int.min;
2017-08-28 02:07:32 +00:00
CameraFOV 90.f;
2017-02-28 11:47:44 +00:00
FastSpeed -1;
RadiusDamageFactor 1;
SelfDamageFactor 1;
StealthAlpha 0;
2017-02-28 11:56:35 +00:00
WoundHealth 6;
2017-02-28 12:40:46 +00:00
GibHealth int.min;
DeathHeight -1;
BurnHeight -1;
2017-07-29 17:59:36 +00:00
RenderHidden 0;
RenderRequired 0;
2018-01-09 17:34:01 +00:00
FriendlySeeBlocks 10; // 10 (blocks) * 128 (one map unit block)
2016-10-11 16:53:10 +00:00
}
2016-11-27 14:50:58 +00:00
2016-10-11 16:53:10 +00:00
// Functions
2016-10-27 13:53:53 +00:00
2016-11-23 18:47:09 +00:00
// 'parked' global functions.
2018-08-14 08:14:35 +00:00
native clearscope static double deltaangle(double ang1, double ang2);
native clearscope static double absangle(double ang1, double ang2);
native clearscope static Vector2 AngleToVector(double angle, double length = 1);
native clearscope static Vector2 RotateVector(Vector2 vec, double angle);
native clearscope static double Normalize180(double ang);
2016-11-23 18:47:09 +00:00
2018-11-25 06:43:05 +00:00
virtual void MarkPrecacheSounds()
{
MarkSound(SeeSound);
MarkSound(AttackSound);
MarkSound(PainSound);
MarkSound(DeathSound);
MarkSound(ActiveSound);
MarkSound(UseSound);
MarkSound(BounceSound);
MarkSound(WallBounceSound);
MarkSound(CrushPainSound);
2019-12-08 20:22:53 +00:00
MarkSound(HowlSound);
MarkSound(MeleeSound);
2018-11-25 06:43:05 +00:00
}
2016-11-23 18:47:09 +00:00
2016-10-27 13:53:53 +00:00
bool IsPointerEqual(int ptr_select1, int ptr_select2)
{
return GetPointer(ptr_select1) == GetPointer(ptr_select2);
}
2016-11-12 08:33:43 +00:00
2018-08-14 08:14:35 +00:00
clearscope static double BobSin(double fb)
2016-11-12 08:33:43 +00:00
{
return sin(fb * (180./32)) * 8;
}
2016-11-21 13:59:17 +00:00
2019-01-28 19:15:48 +00:00
native bool isFrozen();
2016-11-21 13:59:17 +00:00
virtual native void BeginPlay();
virtual native void Activate(Actor activator);
virtual native void Deactivate(Actor activator);
2016-11-23 20:26:59 +00:00
virtual native int DoSpecialDamage (Actor target, int damage, Name damagetype);
2016-11-28 23:16:30 +00:00
virtual native int TakeSpecialDamage (Actor inflictor, Actor source, int damage, Name damagetype);
2018-04-23 19:26:05 +00:00
virtual native void Die(Actor source, Actor inflictor, int dmgflags = 0, Name MeansOfDeath = 'none');
2016-11-26 00:14:47 +00:00
virtual native bool Slam(Actor victim);
2016-11-28 11:55:33 +00:00
virtual native void Touch(Actor toucher);
2018-11-24 08:33:03 +00:00
native void Substitute(Actor replacement);
2018-12-01 21:37:12 +00:00
native ui void DisplayNameTag();
2017-01-01 22:11:48 +00:00
2019-03-03 19:26:00 +00:00
// Called by inventory items to see if this actor is capable of touching them.
// If true, the item will attempt to be picked up. Useful for things like
// allowing morphs to pick up limited items such as keys while preventing
// them from picking other items up.
virtual bool CanTouchItem(Inventory item)
{
return true;
}
2017-02-28 11:11:25 +00:00
// Called by PIT_CheckThing to check if two actors actually can collide.
2017-01-01 22:11:48 +00:00
virtual bool CanCollideWith(Actor other, bool passive)
{
return true;
}
2016-10-27 13:53:53 +00:00
2018-11-06 02:22:37 +00:00
// Called by revival/resurrection to check if one can resurrect the other.
// "other" can be null when not passive.
virtual bool CanResurrect(Actor other, bool passive)
{
return true;
}
2016-11-30 00:39:06 +00:00
// Called when an actor is to be reflected by a disc of repulsion.
// Returns true to continue normal blast processing.
2017-01-01 22:11:48 +00:00
virtual bool SpecialBlastHandling (Actor source, double strength)
2016-11-30 00:39:06 +00:00
{
return true;
}
2017-01-01 22:11:48 +00:00
// This is called before a missile gets exploded.
virtual int SpecialMissileHit (Actor victim)
2016-11-27 20:41:04 +00:00
{
return -1;
}
2017-02-14 23:43:30 +00:00
2018-04-23 03:14:07 +00:00
// Called when the player presses 'use' and an actor is found, except if the
// UseSpecial flag is set. Use level.ExecuteSpecial to call action specials
// instead.
2017-02-14 23:43:30 +00:00
virtual bool Used(Actor user)
{
return false;
}
2017-02-28 11:11:25 +00:00
virtual class<Actor> GetBloodType(int type)
{
Class<Actor> bloodcls;
if (type == 0)
{
bloodcls = BloodType;
}
else if (type == 1)
{
bloodcls = BloodType2;
}
else if (type == 2)
{
bloodcls = BloodType3;
}
else
{
return NULL;
}
if (bloodcls != NULL)
{
bloodcls = GetReplacement(bloodcls);
}
return bloodcls;
}
2017-02-28 12:40:46 +00:00
virtual int GetGibHealth()
{
if (GibHealth != int.min)
{
return -abs(GibHealth);
}
else
{
return -int(GetSpawnHealth() * gameinfo.gibfactor);
}
}
virtual double GetDeathHeight()
{
// [RH] Allow the death height to be overridden using metadata.
double metaheight = -1;
if (DamageType == 'Fire')
{
metaheight = BurnHeight;
}
if (metaheight < 0)
{
metaheight = DeathHeight;
}
if (metaheight < 0)
{
return Height * 0.25;
}
else
{
return MAX(metaheight, 0);
}
}
2017-02-28 13:30:14 +00:00
virtual String GetObituary(Actor victim, Actor inflictor, Name mod, bool playerattack)
{
if (mod == 'Telefrag')
{
return "$OB_MONTELEFRAG";
}
else if (mod == 'Melee' && HitObituary.Length() > 0)
{
return HitObituary;
}
return Obituary;
}
2017-03-29 18:25:54 +00:00
virtual int OnDrain(Actor victim, int damage, Name dmgtype)
{
return damage;
}
2018-04-11 14:49:42 +00:00
// called on getting a secret, return false to disable default "secret found" message/sound
2018-06-05 14:20:02 +00:00
virtual bool OnGiveSecret(bool printmsg, bool playsound) { return true; }
2017-03-29 18:25:54 +00:00
2017-03-15 00:39:59 +00:00
native virtual bool OkayToSwitchTarget(Actor other);
2017-01-14 01:05:52 +00:00
native static class<Actor> GetReplacement(class<Actor> cls);
native static class<Actor> GetReplacee(class<Actor> cls);
2016-11-30 00:25:51 +00:00
native static int GetSpriteIndex(name sprt);
2018-08-14 08:14:35 +00:00
native clearscope static double GetDefaultSpeed(class<Actor> type);
2016-11-27 19:14:43 +00:00
native static class<Actor> GetSpawnableType(int spawnnum);
2017-01-01 22:11:48 +00:00
native static int ApplyDamageFactors(class<Inventory> itemcls, Name damagetype, int damage, int defdamage);
2016-11-16 00:36:21 +00:00
native void RemoveFromHash();
2016-11-30 00:25:51 +00:00
native void ChangeTid(int newtid);
2020-03-10 08:31:21 +00:00
deprecated("3.8", "Use Level.FindUniqueTid() instead") static int FindUniqueTid(int start = 0, int limit = 0)
2019-01-24 18:28:40 +00:00
{
return level.FindUniqueTid(start, limit);
}
2016-11-30 00:25:51 +00:00
native void SetShade(color col);
2017-03-15 09:36:41 +00:00
native clearscope int GetRenderStyle() const;
2017-03-26 20:04:58 +00:00
native clearscope bool CheckKeys(int locknum, bool remote, bool quiet = false);
2017-08-12 11:55:33 +00:00
protected native void CheckPortalTransition(bool linked = true);
2016-11-30 00:25:51 +00:00
2017-03-07 17:58:18 +00:00
native clearscope string GetTag(string defstr = "") const;
2016-11-30 00:25:51 +00:00
native void SetTag(string defstr = "");
2016-11-21 12:04:27 +00:00
native double GetBobOffset(double frac = 0);
2016-11-19 23:25:38 +00:00
native void ClearCounters();
native bool GiveBody (int num, int max=0);
2016-11-24 12:45:43 +00:00
native bool HitFloor();
2018-11-29 20:49:13 +00:00
native virtual bool Grind(bool items);
2017-03-07 17:58:18 +00:00
native clearscope bool isTeammate(Actor other) const;
2017-03-23 14:18:09 +00:00
native clearscope int PlayerNumber() const;
2016-11-26 00:14:47 +00:00
native void SetFriendPlayer(PlayerInfo player);
2016-12-11 11:10:05 +00:00
native void SoundAlert(Actor target, bool splash = false, double maxdist = 0);
2016-11-27 09:40:43 +00:00
native void ClearBounce();
2016-11-27 23:49:10 +00:00
native TerrainDef GetFloorTerrain();
2019-01-31 02:29:45 +00:00
native bool CheckLocalView(int consoleplayer = -1 /* parameter is not used anymore but needed for backward compatibilityö. */);
2017-01-12 23:35:56 +00:00
native bool CheckNoDelay();
native bool UpdateWaterLevel (bool splash = true);
native bool IsZeroDamage();
native void ClearInterpolation();
2017-03-07 17:58:18 +00:00
native clearscope Vector3 PosRelative(sector sec) const;
2018-11-24 14:12:30 +00:00
native void RailAttack(FRailParams p);
2017-01-14 01:05:52 +00:00
native void HandleSpawnFlags();
2017-02-25 19:45:28 +00:00
native void ExplodeMissile(line lin = null, Actor target = null, bool onsky = false);
2016-11-23 20:26:59 +00:00
native void RestoreDamage();
2017-03-07 17:58:18 +00:00
native clearscope int SpawnHealth() const;
2019-01-03 12:58:53 +00:00
virtual clearscope int GetMaxHealth(bool withupgrades = false) const // this only exists to make checks for player health easier so they can avoid the type check and just call this method.
{
return SpawnHealth();
}
2016-10-31 16:02:47 +00:00
native void SetDamage(int dmg);
2017-03-07 17:58:18 +00:00
native clearscope double Distance2D(Actor other) const;
native clearscope double Distance3D(Actor other) const;
2018-02-24 20:36:17 +00:00
native clearscope double Distance2DSquared(Actor other) const;
native clearscope double Distance3DSquared(Actor other) const;
2016-10-29 14:49:21 +00:00
native void SetOrigin(vector3 newpos, bool moving);
2016-10-30 13:00:11 +00:00
native void SetXYZ(vector3 newpos);
2018-12-02 23:43:01 +00:00
native clearscope Actor GetPointer(int aaptr);
2016-11-19 12:56:29 +00:00
native double BulletSlope(out FTranslatedLineTarget pLineTarget = null, int aimflags = 0);
2017-04-30 20:16:32 +00:00
native void CheckFakeFloorTriggers (double oldz, bool oldz_has_viewheight = false);
2018-12-08 17:56:06 +00:00
native bool CheckFor3DFloorHit(double z, bool trigger);
native bool CheckFor3DCeilingHit(double z, bool trigger);
2018-12-08 18:09:09 +00:00
native int CheckMonsterUseSpecials();
2017-01-19 12:25:56 +00:00
2016-11-18 20:34:06 +00:00
native bool CheckMissileSpawn(double maxdist);
2017-01-11 23:26:16 +00:00
native bool CheckPosition(Vector2 pos, bool actorsonly = false, FCheckPosition tm = null);
2016-11-24 00:23:35 +00:00
native bool TestMobjLocation();
2016-10-30 13:00:11 +00:00
native static Actor Spawn(class<Actor> type, vector3 pos = (0,0,0), int replace = NO_REPLACE);
2016-10-23 15:15:24 +00:00
native Actor SpawnMissile(Actor dest, class<Actor> type, Actor owner = null);
2016-11-26 23:41:06 +00:00
native Actor SpawnMissileXYZ(Vector3 pos, Actor dest, Class<Actor> type, bool checkspawn = true, Actor owner = null);
2016-11-11 21:14:29 +00:00
native Actor SpawnMissileZ (double z, Actor dest, class<Actor> type);
2016-11-21 12:04:27 +00:00
native Actor SpawnMissileAngleZSpeed (double z, class<Actor> type, double angle, double vz, double speed, Actor owner = null, bool checkspawn = true);
2016-11-28 17:36:13 +00:00
native Actor SpawnMissileZAimed (double z, Actor dest, Class<Actor> type);
2016-11-28 10:52:03 +00:00
native Actor SpawnSubMissile(Class<Actor> type, Actor target);
2018-11-16 14:25:37 +00:00
native Actor, Actor SpawnPlayerMissile(class<Actor> type, double angle = 1e37, double x = 0, double y = 0, double z = 0, out FTranslatedLineTarget pLineTarget = null, bool nofreeaim = false, bool noautoaim = false, int aimflags = 0);
2016-11-24 00:23:35 +00:00
native void SpawnTeleportFog(Vector3 pos, bool beforeTele, bool setTarget);
2016-11-27 23:49:10 +00:00
native Actor RoughMonsterSearch(int distance, bool onlyseekable = false, bool frontonly = false);
2016-11-27 11:52:54 +00:00
native int ApplyDamageFactor(Name damagetype, int damage);
2019-02-06 19:06:28 +00:00
native int GetModifiedDamage(Name damagetype, int damage, bool passive, Actor inflictor = null, Actor source = null, int flags = 0);
2016-11-28 10:52:03 +00:00
native bool CheckBossDeath();
2016-11-15 12:39:41 +00:00
2016-11-24 00:23:35 +00:00
void A_Light(int extralight) { if (player) player.extralight = clamp(extralight, -20, 20); }
void A_Light0() { if (player) player.extralight = 0; }
void A_Light1() { if (player) player.extralight = 1; }
void A_Light2() { if (player) player.extralight = 2; }
void A_LightInverse() { if (player) player.extralight = 0x80000000; }
2016-11-11 22:32:13 +00:00
2016-10-30 13:00:11 +00:00
native Actor OldSpawnMissile(Actor dest, class<Actor> type, Actor owner = null);
2016-11-30 00:25:51 +00:00
native Actor SpawnPuff(class<Actor> pufftype, vector3 pos, double hitdir, double particledir, int updown, int flags = 0, Actor victim = null);
native void SpawnBlood (Vector3 pos1, double dir, int damage);
native void BloodSplatter (Vector3 pos, double hitangle, bool axe = false);
native bool HitWater (sector sec, Vector3 pos, bool checkabove = false, bool alert = true, bool force = false);
native void PlaySpawnSound(Actor missile);
2017-03-07 17:58:18 +00:00
native clearscope bool CountsAsKill() const;
2016-11-07 22:16:25 +00:00
2016-11-25 18:52:35 +00:00
native bool Teleport(Vector3 pos, double angle, int flags);
2016-10-23 15:15:24 +00:00
native void TraceBleed(int damage, Actor missile);
2016-11-26 00:14:47 +00:00
native void TraceBleedAngle(int damage, double angle, double pitch);
native void SetIdle(bool nofunction = false);
2016-10-23 15:15:24 +00:00
native bool CheckMeleeRange();
2018-12-13 03:36:20 +00:00
native bool TriggerPainChance(Name mod, bool forcedPain = false);
2017-01-10 20:31:52 +00:00
native virtual int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags = 0, double angle = 0);
2016-11-30 00:25:51 +00:00
native void PoisonMobj (Actor inflictor, Actor source, int damage, int duration, int period, Name type);
2016-10-26 09:30:30 +00:00
native double AimLineAttack(double angle, double distance, out FTranslatedLineTarget pLineTarget = null, double vrange = 0., int flags = 0, Actor target = null, Actor friender = null);
2017-11-03 18:57:44 +00:00
native Actor, int LineAttack(double angle, double distance, double pitch, int damage, Name damageType, class<Actor> pufftype, int flags = 0, out FTranslatedLineTarget victim = null, double offsetz = 0., double offsetforward = 0., double offsetside = 0.);
2018-01-18 23:29:49 +00:00
native bool LineTrace(double angle, double distance, double pitch, int flags = 0, double offsetz = 0., double offsetforward = 0., double offsetside = 0., out FLineTraceData data = null);
2016-10-26 09:30:30 +00:00
native bool CheckSight(Actor target, int flags = 0);
2016-11-30 00:25:51 +00:00
native bool IsVisible(Actor other, bool allaround, LookExParams params = null);
2016-10-26 09:30:30 +00:00
native bool HitFriend();
2016-11-12 18:16:47 +00:00
native bool MonsterMove();
2016-11-30 00:25:51 +00:00
2017-01-14 12:02:08 +00:00
native SeqNode StartSoundSequenceID (int sequence, int type, int modenum, bool nostop = false);
native SeqNode StartSoundSequence (Name seqname, int modenum);
native void StopSoundSequence();
2016-11-30 00:25:51 +00:00
native void FindFloorCeiling(int flags = 0);
native double, double GetFriction();
native bool, Actor TestMobjZ(bool quick = false);
2018-12-18 19:38:25 +00:00
native static bool InStateSequence(State newstate, State basestate);
2016-11-30 00:25:51 +00:00
bool TryWalk ()
{
if (!MonsterMove ())
{
return false;
}
2018-12-21 11:32:36 +00:00
movecount = random[TryWalk](0, 15);
2016-11-30 00:25:51 +00:00
return true;
}
2017-01-11 23:26:16 +00:00
native bool TryMove(vector2 newpos, int dropoff, bool missilecheck = false, FCheckPosition tm = null);
2018-01-03 08:48:10 +00:00
native bool CheckMove(vector2 newpos, int flags = 0, FCheckPosition tm = null);
2016-11-12 18:16:47 +00:00
native void NewChaseDir();
2016-11-30 00:25:51 +00:00
native void RandomChaseDir();
2016-11-12 18:16:47 +00:00
native bool CheckMissileRange();
2016-10-26 09:30:30 +00:00
native bool SetState(state st, bool nofunction = false);
2018-08-14 08:14:35 +00:00
clearscope native state FindState(statelabel st, bool exact = false) const;
2016-11-14 13:12:27 +00:00
bool SetStateLabel(statelabel st, bool nofunction = false) { return SetState(FindState(st), nofunction); }
native action state ResolveState(statelabel st); // this one, unlike FindState, is context aware.
2017-01-13 21:13:03 +00:00
native void LinkToWorld(LinkContext ctx = null);
native void UnlinkFromWorld(out LinkContext ctx = null);
2016-11-07 22:16:25 +00:00
native bool CanSeek(Actor target);
2017-03-07 17:58:18 +00:00
native clearscope double AngleTo(Actor target, bool absolute = false) const;
2016-11-21 12:04:27 +00:00
native void AddZ(double zadd, bool moving = true);
native void SetZ(double z);
2017-03-07 17:58:18 +00:00
native clearscope vector2 Vec2To(Actor other) const;
native clearscope vector3 Vec3To(Actor other) const;
native clearscope vector3 Vec3Offset(double x, double y, double z, bool absolute = false) const;
native clearscope vector3 Vec3Angle(double length, double angle, double z = 0, bool absolute = false) const;
native clearscope vector2 Vec2Angle(double length, double angle, bool absolute = false) const;
native clearscope vector2 Vec2Offset(double x, double y, bool absolute = false) const;
native clearscope vector3 Vec2OffsetZ(double x, double y, double atz, bool absolute = false) const;
2018-09-24 15:59:37 +00:00
native void VelIntercept(Actor targ, double speed = -1, bool aimpitch = true, bool oldvel = false);
2018-11-16 14:25:37 +00:00
native void VelFromAngle(double speed = 1e37, double angle = 1e37);
2017-03-07 17:58:18 +00:00
native void Vel3DFromAngle(double speed, double angle, double pitch);
2018-11-16 14:25:37 +00:00
native void Thrust(double speed = 1e37, double angle = 1e37);
2017-03-07 17:58:18 +00:00
native clearscope bool isFriend(Actor other) const;
native clearscope bool isHostile(Actor other) const;
2016-11-01 15:32:47 +00:00
native void AdjustFloorClip();
2018-08-14 08:14:35 +00:00
native clearscope DropItem GetDropItems() const;
2016-11-03 12:38:40 +00:00
native void CopyFriendliness (Actor other, bool changeTarget, bool resetHealth = true);
2016-11-30 00:25:51 +00:00
native bool LookForMonsters();
native bool LookForTid(bool allaround, LookExParams params = null);
native bool LookForEnemies(bool allaround, LookExParams params = null);
native bool LookForPlayers(bool allaround, LookExParams params = null);
2016-11-03 12:38:40 +00:00
native bool TeleportMove(Vector3 pos, bool telefrag, bool modifyactor = true);
2016-11-06 10:36:12 +00:00
native double DistanceBySpeed(Actor other, double speed);
native name GetSpecies();
2016-11-12 18:16:47 +00:00
native void PlayActiveSound();
2016-11-26 12:18:48 +00:00
native void Howl();
2016-11-29 18:50:34 +00:00
native void DrawSplash (int count, double angle, int kind);
native void GiveSecret(bool printmsg = true, bool playsound = true);
2017-03-07 17:58:18 +00:00
native clearscope double GetCameraHeight() const;
native clearscope double GetGravity() const;
2016-10-26 09:30:30 +00:00
2018-12-04 23:21:16 +00:00
//==========================================================================
//
// AActor :: GetLevelSpawnTime
//
// Returns the time when this actor was spawned,
// relative to the current level.
//
//==========================================================================
clearscope int GetLevelSpawnTime() const
{
return SpawnTime - level.totaltime + level.time;
}
//==========================================================================
//
// AActor :: GetAge
//
// Returns the number of ticks passed since this actor was spawned.
//
//==========================================================================
clearscope int GetAge() const
{
return level.totaltime - SpawnTime;
}
2018-12-05 16:34:11 +00:00
double AccuracyFactor()
{
return 1. / (1 << (accuracy * 5 / 100));
}
2018-12-04 23:21:16 +00:00
2018-11-24 19:58:33 +00:00
protected native void DestroyAllInventory(); // This is not supposed to be called by user code!
2017-03-07 17:58:18 +00:00
native clearscope Inventory FindInventory(class<Inventory> itemtype, bool subclass = false) const;
2016-11-25 15:05:03 +00:00
native Inventory GiveInventoryType(class<Inventory> itemtype);
2017-01-15 09:37:54 +00:00
native bool UsePuzzleItem(int PuzzleItemType);
2018-12-05 16:34:11 +00:00
2017-02-08 14:30:00 +00:00
action native void SetCamera(Actor cam, bool revert = false);
2017-11-14 23:42:36 +00:00
native bool Warp(Actor dest, double xofs = 0, double yofs = 0, double zofs = 0, double angle = 0, int flags = 0, double heightoffset = 0, double radiusoffset = 0, double pitch = 0);
2016-11-26 23:18:07 +00:00
2016-11-28 18:42:26 +00:00
// DECORATE compatible functions
2016-11-21 12:04:27 +00:00
native double GetZAt(double px = 0, double py = 0, double angle = 0, int flags = 0, int pick_pointer = AAPTR_DEFAULT);
2017-03-07 17:58:18 +00:00
native clearscope int GetSpawnHealth() const;
2016-11-21 12:04:27 +00:00
native double GetCrouchFactor(int ptr = AAPTR_PLAYER1);
native double GetCVar(string cvar);
2017-03-28 19:36:57 +00:00
native double GetCVarString(string cvar);
2016-10-11 16:53:10 +00:00
native int GetPlayerInput(int inputnum, int ptr = AAPTR_DEFAULT);
2016-11-21 12:04:27 +00:00
native int CountProximity(class<Actor> classname, double distance, int flags = 0, int ptr = AAPTR_DEFAULT);
2016-10-11 16:53:10 +00:00
native int GetMissileDamage(int mask, int add, int ptr = AAPTR_DEFAULT);
action native int OverlayID();
2016-11-21 12:04:27 +00:00
action native double OverlayX(int layer = 0);
action native double OverlayY(int layer = 0);
2016-12-26 20:37:22 +00:00
action native double OverlayAlpha(int layer = 0);
2016-10-11 16:53:10 +00:00
2016-10-27 13:53:53 +00:00
// DECORATE setters - it probably makes more sense to set these values directly now...
void A_SetMass(int newmass) { mass = newmass; }
2016-11-01 15:32:47 +00:00
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; }
2016-11-12 12:11:32 +00:00
void A_UnSetReflectiveInvulnerable() { bInvulnerable = false; bReflective = false; }
2016-11-01 15:32:47 +00:00
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; }
2016-11-21 12:04:27 +00:00
void A_SetGravity(double newgravity) { gravity = clamp(newgravity, 0., 10.); }
2016-11-01 15:32:47 +00:00
void A_SetFloorClip() { bFloorClip = true; AdjustFloorClip(); }
void A_UnSetFloorClip() { bFloorClip = false; FloorClip = 0; }
void A_HideThing() { bInvisible = true; }
void A_UnHideThing() { bInvisible = false; }
2016-10-27 13:53:53 +00:00
void A_SetArg(int arg, int val) { if (arg >= 0 && arg < 5) args[arg] = val; }
2016-11-21 12:04:27 +00:00
void A_Turn(double turn = 0) { angle += turn; }
2016-10-27 13:53:53 +00:00
void A_SetDamageType(name newdamagetype) { damagetype = newdamagetype; }
void A_SetSolid() { bSolid = true; }
void A_UnsetSolid() { bSolid = false; }
void A_SetFloat() { bFloat = true; }
void A_UnsetFloat() { bFloat = false; }
void A_SetFloatBobPhase(int bob) { if (bob >= 0 && bob <= 63) FloatBobPhase = bob; }
void A_SetRipperLevel(int level) { RipperLevel = level; }
void A_SetRipMin(int minimum) { RipLevelMin = minimum; }
void A_SetRipMax(int maximum) { RipLevelMax = maximum; }
2016-11-06 08:22:03 +00:00
void A_ScreamAndUnblock() { A_Scream(); A_NoBlocking(); }
void A_ActiveAndUnblock() { A_ActiveSound(); A_NoBlocking(); }
2016-11-11 22:32:13 +00:00
//---------------------------------------------------------------------------
//
// FUNC P_SpawnMissileAngle
//
// Returns NULL if the missile exploded immediately, otherwise returns
// a mobj_t pointer to the missile.
//
//---------------------------------------------------------------------------
2016-11-21 12:04:27 +00:00
Actor SpawnMissileAngle (class<Actor> type, double angle, double vz)
2016-11-11 22:32:13 +00:00
{
return SpawnMissileAngleZSpeed (pos.z + 32 + GetBobOffset(), type, angle, vz, GetDefaultSpeed (type));
}
Actor SpawnMissileAngleZ (double z, class<Actor> type, double angle, double vz)
{
return SpawnMissileAngleZSpeed (z, type, angle, vz, GetDefaultSpeed (type));
}
2016-10-27 13:53:53 +00:00
2016-11-21 12:04:27 +00:00
void A_SetScale(double scalex, double scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false)
2016-10-27 13:53:53 +00:00
{
Actor aptr = GetPointer(ptr);
if (aptr)
{
aptr.Scale.X = scalex;
aptr.Scale.Y = scaley != 0 || usezero? scaley : scalex; // use scalex here, too, if only one parameter.
}
}
2016-11-21 12:04:27 +00:00
void A_SetSpeed(double speed, int ptr = AAPTR_DEFAULT)
2016-10-27 13:53:53 +00:00
{
Actor aptr = GetPointer(ptr);
if (aptr) aptr.Speed = speed;
}
2016-11-21 12:04:27 +00:00
void A_SetFloatSpeed(double speed, int ptr = AAPTR_DEFAULT)
2016-10-27 13:53:53 +00:00
{
Actor aptr = GetPointer(ptr);
if (aptr) aptr.FloatSpeed = speed;
}
void A_SetPainThreshold(int threshold, int ptr = AAPTR_DEFAULT)
{
Actor aptr = GetPointer(ptr);
if (aptr) aptr.PainThreshold = threshold;
}
2016-11-21 12:04:27 +00:00
bool A_SetSpriteAngle(double angle = 0, int ptr = AAPTR_DEFAULT)
2016-10-27 13:53:53 +00:00
{
Actor aptr = GetPointer(ptr);
if (!aptr) return false;
aptr.SpriteAngle = angle;
return true;
}
2016-11-21 12:04:27 +00:00
bool A_SetSpriteRotation(double angle = 0, int ptr = AAPTR_DEFAULT)
2016-10-27 13:53:53 +00:00
{
Actor aptr = GetPointer(ptr);
if (!aptr) return false;
aptr.SpriteRotation = angle;
return true;
}
2020-03-10 08:31:21 +00:00
deprecated("2.3", "This function does nothing and is only for Zandronum compatibility") void A_FaceConsolePlayer(double MaxTurnAngle = 0) {}
2016-10-27 13:53:53 +00:00
void A_SetSpecial(int spec, int arg0 = 0, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0)
{
special = spec;
args[0] = arg0;
args[1] = arg1;
args[2] = arg2;
args[3] = arg3;
args[4] = arg4;
}
void A_ClearTarget()
{
target = null;
lastheard = null;
lastenemy = null;
}
void A_ChangeLinkFlags(int blockmap = FLAG_NO_CHANGE, int sector = FLAG_NO_CHANGE)
{
UnlinkFromWorld();
if (blockmap != FLAG_NO_CHANGE) bNoBlockmap = blockmap;
if (sector != FLAG_NO_CHANGE) bNoSector = sector;
LinkToWorld();
}
2016-10-27 15:47:46 +00:00
// killough 11/98: kill an object
void A_Die(name damagetype = "none")
{
DamageMobj(null, null, health, damagetype, DMG_FORCED);
}
2016-11-16 23:44:43 +00:00
void SpawnDirt (double radius)
{
2016-11-20 17:34:27 +00:00
static const class<Actor> chunks[] = { "Dirt1", "Dirt2", "Dirt3", "Dirt4", "Dirt5", "Dirt6" };
2016-11-16 23:44:43 +00:00
double zo = random[Dirt]() / 128. + 1;
Vector3 pos = Vec3Angle(radius, random[Dirt]() * (360./256), zo);
2016-11-20 17:34:27 +00:00
Actor mo = Spawn (chunks[random[Dirt](0, 5)], pos, ALLOW_REPLACE);
2016-11-16 23:44:43 +00:00
if (mo)
{
mo.Vel.Z = random[Dirt]() / 64.;
}
}
//
// A_SinkMobj
// Sink a mobj incrementally into the floor
//
bool SinkMobj (double speed)
{
if (Floorclip < Height)
{
Floorclip += speed;
return false;
}
return true;
}
//
// A_RaiseMobj
// Raise a mobj incrementally from the floor to
//
bool RaiseMobj (double speed)
{
// Raise a mobj from the ground
if (Floorclip > 0)
{
Floorclip -= speed;
if (Floorclip <= 0)
{
Floorclip = 0;
return true;
}
else
{
return false;
}
}
return true;
}
2017-01-19 12:25:56 +00:00
Actor AimTarget()
{
FTranslatedLineTarget t;
BulletSlope(t, ALF_PORTALRESTRICT);
return t.linetarget;
}
2018-12-02 15:26:02 +00:00
void RestoreRenderStyle()
{
bShadow = default.bShadow;
bGhost = default.bGhost;
RenderStyle = default.RenderStyle;
Alpha = default.Alpha;
}
2018-12-02 17:04:44 +00:00
virtual bool ShouldSpawn()
{
return true;
}
2016-10-27 22:32:52 +00:00
2016-11-21 12:04:27 +00:00
native void A_Face(Actor faceto, double max_turn = 0, double max_pitch = 270, double ang_offset = 0, double pitch_offset = 0, int flags = 0, double z_ofs = 0);
2016-10-27 22:32:52 +00:00
2016-11-21 12:04:27 +00:00
void A_FaceTarget(double max_turn = 0, double max_pitch = 270, double ang_offset = 0, double pitch_offset = 0, int flags = 0, double z_ofs = 0)
2016-10-27 22:32:52 +00:00
{
A_Face(target, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_ofs);
}
2016-11-21 12:04:27 +00:00
void A_FaceTracer(double max_turn = 0, double max_pitch = 270, double ang_offset = 0, double pitch_offset = 0, int flags = 0, double z_ofs = 0)
2016-10-27 22:32:52 +00:00
{
A_Face(tracer, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_ofs);
}
2016-11-21 12:04:27 +00:00
void A_FaceMaster(double max_turn = 0, double max_pitch = 270, double ang_offset = 0, double pitch_offset = 0, int flags = 0, double z_ofs = 0)
2016-10-27 22:32:52 +00:00
{
A_Face(master, max_turn, max_pitch, ang_offset, pitch_offset, flags, z_ofs);
}
2016-10-11 16:53:10 +00:00
// Action functions
// Meh, MBF redundant functions. Only for DeHackEd support.
2016-10-22 15:49:08 +00:00
native bool A_LineEffect(int boomspecial = 0, int tag = 0);
2016-10-11 16:53:10 +00:00
// End of MBF redundant functions.
2017-02-28 09:51:32 +00:00
2016-10-22 15:49:08 +00:00
native void A_MonsterRail();
native void A_Pain();
2016-11-05 00:19:41 +00:00
native void A_NoBlocking(bool drop = true);
2016-11-01 15:32:47 +00:00
void A_Fall() { A_NoBlocking(); }
2016-10-22 15:49:08 +00:00
native void A_Look();
2019-01-03 22:43:15 +00:00
native void A_Chase(statelabel melee = '_a_chase_default', statelabel missile = '_a_chase_default', int flags = 0);
2016-10-22 15:49:08 +00:00
native void A_VileChase();
2018-09-17 23:14:39 +00:00
native bool A_CheckForResurrection();
2016-10-22 15:49:08 +00:00
native void A_BossDeath();
2017-02-15 21:49:13 +00:00
bool A_CallSpecial(int special, int arg1=0, int arg2=0, int arg3=0, int arg4=0, int arg5=0)
{
return Level.ExecuteSpecial(special, self, null, false, arg1, arg2, arg3, arg4, arg5);
}
2016-10-22 15:49:08 +00:00
native void A_FastChase();
native void A_PlayerScream();
2016-11-28 22:30:14 +00:00
native void A_CheckTerrain();
2016-10-11 16:53:10 +00:00
2016-10-22 15:49:08 +00:00
native void A_Wander(int flags = 0);
native void A_Look2();
2016-10-11 16:53:10 +00:00
2020-03-10 08:31:21 +00:00
deprecated("2.3", "Use A_CustomBulletAttack() instead") native void A_BulletAttack();
2016-11-21 12:04:27 +00:00
native void A_WolfAttack(int flags = 0, sound whattoplay = "weapons/pistol", double snipe = 1.0, int maxdamage = 64, int blocksize = 128, int pointblank = 2, int longrange = 4, double runspeed = 160.0, class<Actor> pufftype = "BulletPuff");
2020-03-10 08:31:21 +00:00
deprecated("4.3", "Use A_StartSound() instead") native clearscope void A_PlaySound(sound whattoplay = "weapons/pistol", int slot = CHAN_BODY, double volume = 1.0, bool looping = false, double attenuation = ATTN_NORM, bool local = false, double pitch = 0.0);
2020-03-02 04:45:11 +00:00
native clearscope void A_StartSound(sound whattoplay, int slot = CHAN_BODY, int flags = 0, double volume = 1.0, double attenuation = ATTN_NORM, double pitch = 0.0, double startTime = 0.0);
2017-08-31 06:45:09 +00:00
native void A_SoundVolume(int slot, double volume);
2019-07-24 00:40:19 +00:00
native void A_SoundPitch(int slot, double pitch);
2020-03-10 08:31:21 +00:00
deprecated("2.3", "Use A_StartSound(<sound>, CHAN_WEAPON) instead") void A_PlayWeaponSound(sound whattoplay) { A_StartSound(whattoplay, CHAN_WEAPON); }
2016-10-22 15:49:08 +00:00
native void A_StopSound(int slot = CHAN_VOICE); // Bad default but that's what is originally was...
2020-03-01 18:35:19 +00:00
void A_StopAllSounds() { A_StopSounds(0,0); }
native void A_StopSounds(int chanmin, int chanmax);
2020-03-10 08:31:21 +00:00
deprecated("2.3", "Use A_StartSound() instead") native void A_PlaySoundEx(sound whattoplay, name slot, bool looping = false, int attenuation = 0);
deprecated("2.3", "Use A_StopSound() instead") native void A_StopSoundEx(name slot);
2019-12-17 08:58:50 +00:00
native clearscope bool IsActorPlayingSound(int channel, Sound snd = 0);
2016-10-11 16:53:10 +00:00
native void A_SeekerMissile(int threshold, int turnmax, int flags = 0, int chance = 50, int distance = 10);
2018-11-17 20:22:18 +00:00
native action state A_Jump(int chance, statelabel label, ...);
2017-01-20 11:39:51 +00:00
native Actor A_SpawnProjectile(class<Actor> missiletype, double spawnheight = 32, double spawnofs_xy = 0, double angle = 0, int flags = 0, double pitch = 0, int ptr = AAPTR_TARGET);
2017-01-10 19:08:23 +00:00
native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = 0, color color2 = 0, int flags = 0, int aim = 0, double maxdiff = 0, class<Actor> pufftype = "BulletPuff", double spread_xy = 0, double spread_z = 0, double range = 0, int duration = 0, double sparsity = 1.0, double driftspeed = 1.0, class<Actor> spawnclass = null, double spawnofs_z = 0, int spiraloffset = 270, int limit = 0, double veleffect = 3);
2016-11-21 12:04:27 +00:00
native void A_Print(string whattoprint, double time = 0, name fontname = "none");
native void A_PrintBold(string whattoprint, double time = 0, name fontname = "none");
2017-01-13 10:48:05 +00:00
native void A_Log(string whattoprint, bool local = false);
native void A_LogInt(int whattoprint, bool local = false);
native void A_LogFloat(double whattoprint, bool local = false);
2016-11-21 12:04:27 +00:00
native void A_SetTranslucent(double alpha, int style = 0);
native void A_SetRenderStyle(double alpha, int style);
native void A_FadeIn(double reduce = 0.1, int flags = 0);
native void A_FadeOut(double reduce = 0.1, int flags = 1); //bool remove == true
native void A_FadeTo(double target, double amount = 0.1, int flags = 0);
native void A_SpawnDebris(class<Actor> spawntype, bool transfer_translation = false, double mult_h = 1, double mult_v = 1);
2020-04-12 20:10:41 +00:00
native void A_SpawnParticle(color color1, int flags = 0, int lifetime = TICRATE, double size = 1, double angle = 0, double xoff = 0, double yoff = 0, double zoff = 0, double velx = 0, double vely = 0, double velz = 0, double accelx = 0, double accely = 0, double accelz = 0, double startalphaf = 1, double fadestepf = -1, double sizestep = 0);
2016-10-11 16:53:10 +00:00
native void A_ExtChase(bool usemelee, bool usemissile, bool playactive = true, bool nightmarefast = false);
2017-02-24 08:15:32 +00:00
native void A_DropInventory(class<Inventory> itemtype, int amount = -1);
2017-12-28 01:21:11 +00:00
native void A_SetBlend(color color1, double alpha, int tics, color color2 = 0, double alpha2 = 0.);
2020-03-10 08:31:21 +00:00
deprecated("2.3", "Use 'b<FlagName> = [true/false]' instead") native void A_ChangeFlag(string flagname, bool value);
2016-10-25 08:15:24 +00:00
native void A_ChangeCountFlags(int kill = FLAG_NO_CHANGE, int item = FLAG_NO_CHANGE, int secret = FLAG_NO_CHANGE);
2017-02-26 16:50:48 +00:00
native void A_RaiseMaster(int flags = 0);
native void A_RaiseChildren(int flags = 0);
native void A_RaiseSiblings(int flags = 0);
2018-09-17 23:14:39 +00:00
native bool A_RaiseSelf(int flags = 0);
2018-11-07 00:31:43 +00:00
native bool RaiseActor(Actor other, int flags = 0);
2018-09-17 23:14:39 +00:00
native bool CanRaise();
native void Revive();
2016-11-21 12:04:27 +00:00
native void A_Weave(int xspeed, int yspeed, double xdist, double ydist);
2016-11-14 13:12:27 +00:00
2017-01-04 22:55:24 +00:00
action native state, bool A_Teleport(statelabel teleportstate = null, class<SpecialSpot> targettype = "BossSpot", class<Actor> fogtype = "TeleportFog", int flags = 0, double mindist = 128, double maxdist = 0, int ptr = AAPTR_DEFAULT);
2016-11-21 12:04:27 +00:00
action native state, bool A_Warp(int ptr_destination, double xofs = 0, double yofs = 0, double zofs = 0, double angle = 0, int flags = 0, statelabel success_state = null, double heightoffset = 0, double radiusoffset = 0, double pitch = 0);
2016-11-14 13:12:27 +00:00
native void A_CountdownArg(int argnum, statelabel targstate = null);
native state A_MonsterRefire(int chance, statelabel label);
2016-11-21 12:04:27 +00:00
native void A_LookEx(int flags = 0, double minseedist = 0, double maxseedist = 0, double maxheardist = 0, double fov = 0, statelabel label = null);
2016-11-14 13:12:27 +00:00
2016-11-21 12:04:27 +00:00
native void A_Recoil(double xyvel);
native int A_RadiusGive(class<Inventory> itemtype, double distance, int flags, int amount = 0, class<Actor> filter = null, name species = "None", double mindist = 0, int limit = 0);
2016-10-22 15:49:08 +00:00
native void A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true);
2016-11-21 12:04:27 +00:00
native void A_CustomComboAttack(class<Actor> missiletype, double spawnheight, int damage, sound meleesound = "", name damagetype = "none", bool bleed = true);
2016-10-11 16:53:10 +00:00
native void A_Burst(class<Actor> chunktype);
2016-11-21 12:04:27 +00:00
native void A_RadiusDamageSelf(int damage = 128, double distance = 128, int flags = 0, class<Actor> flashtype = null);
2018-01-09 15:12:17 +00:00
native int GetRadiusDamage(Actor thing, int damage, int distance, int fulldmgdistance = 0, bool oldradiusdmg = false);
2018-11-24 18:29:52 +00:00
native int RadiusAttack(Actor bombsource, int bombdamage, int bombdistance, Name bombmod = 'none', int flags = RADF_HURTSOURCE, int fulldamagedistance = 0);
2016-10-22 15:49:08 +00:00
native void A_Respawn(int flags = 1);
2016-11-19 23:25:38 +00:00
native void A_RestoreSpecialPosition();
2016-10-22 15:49:08 +00:00
native void A_QueueCorpse();
native void A_DeQueueCorpse();
native void A_ClearLastHeard();
2018-12-04 16:31:25 +00:00
2016-10-22 15:49:08 +00:00
native void A_ClassBossHealth();
2016-11-21 12:04:27 +00:00
native void A_SetAngle(double angle = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
native void A_SetPitch(double pitch, int flags = 0, int ptr = AAPTR_DEFAULT);
native void A_SetRoll(double roll, int flags = 0, int ptr = AAPTR_DEFAULT);
2020-03-10 08:31:21 +00:00
deprecated("2.3", "User variables are deprecated in ZScript. Actor variables are directly accessible") native void A_SetUserVar(name varname, int value);
deprecated("2.3", "User variables are deprecated in ZScript. Actor variables are directly accessible") native void A_SetUserArray(name varname, int index, int value);
deprecated("2.3", "User variables are deprecated in ZScript. Actor variables are directly accessible") native void A_SetUserVarFloat(name varname, double value);
deprecated("2.3", "User variables are deprecated in ZScript. Actor variables are directly accessible") native void A_SetUserArrayFloat(name varname, int index, double value);
2016-10-11 16:53:10 +00:00
native void A_Quake(int intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake");
2016-11-21 12:04:27 +00:00
native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, double mulWaveX = 1, double mulWaveY = 1, double mulWaveZ = 1, int falloff = 0, int highpoint = 0, double rollIntensity = 0, double rollWave = 0);
2016-10-11 16:53:10 +00:00
action native void A_SetTics(int tics);
2016-10-27 13:53:53 +00:00
native void A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_DamageTracer(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_DamageChildren(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_DamageSiblings(int amount, name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_KillTarget(name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_KillMaster(name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_KillTracer(name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_KillChildren(name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_KillSiblings(name damagetype = "none", int flags = 0, class<Actor> filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT);
native void A_RemoveTarget(int flags = 0, class<Actor> filter = null, name species = "None");
native void A_RemoveMaster(int flags = 0, class<Actor> filter = null, name species = "None");
native void A_RemoveTracer(int flags = 0, class<Actor> filter = null, name species = "None");
native void A_RemoveChildren(bool removeall = false, int flags = 0, class<Actor> filter = null, name species = "None");
native void A_RemoveSiblings(bool removeall = false, int flags = 0, class<Actor> filter = null, name species = "None");
native void A_Remove(int removee, int flags = 0, class<Actor> filter = null, name species = "None");
2016-10-11 16:53:10 +00:00
native void A_SetTeleFog(class<Actor> oldpos, class<Actor> newpos);
2016-10-22 15:49:08 +00:00
native void A_SwapTeleFog();
2016-10-11 16:53:10 +00:00
native void A_SetHealth(int health, int ptr = AAPTR_DEFAULT);
2016-10-22 15:49:08 +00:00
native void A_ResetHealth(int ptr = AAPTR_DEFAULT);
2016-10-11 16:53:10 +00:00
native void A_SetSpecies(name species, int ptr = AAPTR_DEFAULT);
native void A_SetChaseThreshold(int threshold, bool def = false, int ptr = AAPTR_DEFAULT);
2016-11-21 12:04:27 +00:00
native bool A_FaceMovementDirection(double offset = 0, double anglelimit = 0, double pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
2016-10-22 15:49:08 +00:00
native int A_ClearOverlays(int sstart = 0, int sstop = 0, bool safety = true);
native bool A_CopySpriteFrame(int from, int to, int flags = 0);
2016-11-21 12:04:27 +00:00
native bool A_SetVisibleRotation(double anglestart = 0, double angleend = 0, double pitchstart = 0, double pitchend = 0, int flags = 0, int ptr = AAPTR_DEFAULT);
2016-11-25 15:05:03 +00:00
native void A_SetTranslation(name transname);
2018-03-30 23:06:46 +00:00
native bool A_SetSize(double newradius = -1, double newheight = -1, bool testpos = false);
2017-04-14 14:28:54 +00:00
native void A_SprayDecal(String name, double dist = 172);
2017-02-26 17:46:06 +00:00
native void A_SetMugshotState(String name);
2020-03-23 17:21:39 +00:00
native void CopyBloodColor(Actor other);
2016-10-11 16:53:10 +00:00
native void A_RearrangePointers(int newtarget, int newmaster = AAPTR_DEFAULT, int newtracer = AAPTR_DEFAULT, int flags=0);
2018-11-26 16:15:40 +00:00
native void A_TransferPointer(int ptr_source, int ptr_recipient, int sourcefield, int recipientfield=AAPTR_DEFAULT, int flags=0);
2016-10-22 15:49:08 +00:00
native void A_CopyFriendliness(int ptr_source = AAPTR_MASTER);
2016-10-11 16:53:10 +00:00
2016-11-14 13:12:27 +00:00
action native bool A_Overlay(int layer, statelabel start = null, bool nooverride = false);
2016-11-21 12:04:27 +00:00
native void A_WeaponOffset(double wx = 0, double wy = 32, int flags = 0);
action native void A_OverlayOffset(int layer = PSP_WEAPON, double wx = 0, double wy = 32, int flags = 0);
2016-10-11 16:53:10 +00:00
action native void A_OverlayFlags(int layer, int flags, bool set);
2016-12-26 20:37:22 +00:00
action native void A_OverlayAlpha(int layer, double alph);
action native void A_OverlayRenderStyle(int layer, int style);
2019-06-28 10:35:42 +00:00
2019-07-07 07:50:02 +00:00
native bool A_AttachLightDef(Name lightid, Name lightdef);
native bool A_AttachLight(Name lightid, int type, Color lightcolor, int radius1, int radius2, int flags = 0, Vector3 ofs = (0,0,0), double param = 0, double spoti = 10, double spoto = 25, double spotp = 0);
native bool A_RemoveLight(Name lightid);
2016-10-11 16:53:10 +00:00
2016-10-27 13:53:53 +00:00
int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0)
{
return ACS_Execute(-int(script), mapnum, arg1, arg2, arg3);
}
int ACS_NamedSuspend(name script, int mapnum=0)
{
return ACS_Suspend(-int(script), mapnum);
}
int ACS_NamedTerminate(name script, int mapnum=0)
{
return ACS_Terminate(-int(script), mapnum);
}
int ACS_NamedLockedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0)
{
return ACS_LockedExecute(-int(script), mapnum, arg1, arg2, lock);
}
int ACS_NamedLockedExecuteDoor(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0)
{
return ACS_LockedExecuteDoor(-int(script), mapnum, arg1, arg2, lock);
}
2018-02-24 20:03:23 +00:00
int ACS_NamedExecuteWithResult(name script, int arg1=0, int arg2=0, int arg3=0, int arg4=0)
2016-10-27 13:53:53 +00:00
{
return ACS_ExecuteWithResult(-int(script), arg1, arg2, arg3, arg4);
}
int ACS_NamedExecuteAlways(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0)
{
return ACS_ExecuteAlways(-int(script), mapnum, arg1, arg2, arg3);
}
2018-02-24 20:03:23 +00:00
int ACS_ScriptCall(name script, int arg1=0, int arg2=0, int arg3=0, int arg4=0)
{
return ACS_ExecuteWithResult(-int(script), arg1, arg2, arg3, arg4);
}
2016-10-11 16:53:10 +00:00
2018-11-24 19:33:00 +00:00
//===========================================================================
//
// Sounds
//
//===========================================================================
void A_Scream()
{
if (DeathSound)
{
2020-01-04 13:15:32 +00:00
A_StartSound(DeathSound, CHAN_VOICE, CHANF_DEFAULT, 1, bBoss? ATTN_NONE : ATTN_NORM);
2018-11-24 19:33:00 +00:00
}
}
void A_XScream()
{
2020-01-04 13:15:32 +00:00
A_StartSound(player? Sound("*gibbed") : Sound("misc/gibbed"), CHAN_VOICE);
2018-11-24 19:33:00 +00:00
}
void A_ActiveSound()
{
if (ActiveSound)
{
2020-01-04 13:15:32 +00:00
A_StartSound(ActiveSound, CHAN_VOICE);
2018-11-24 19:33:00 +00:00
}
}
2018-11-24 08:33:03 +00:00
2018-12-05 19:10:44 +00:00
//----------------------------------------------------------------------------
//
// PROC A_CheckSkullDone
//
//----------------------------------------------------------------------------
void A_CheckPlayerDone()
{
if (player == NULL) Destroy();
}
2016-11-14 22:24:10 +00:00
States(Actor, Overlay, Weapon, Item)
2016-10-11 16:53:10 +00:00
{
Spawn:
2016-10-12 18:42:41 +00:00
TNT1 A -1;
Stop;
2016-10-11 16:53:10 +00:00
Null:
2016-10-12 18:42:41 +00:00
TNT1 A 1;
Stop;
2016-10-11 16:53:10 +00:00
GenericFreezeDeath:
// Generic freeze death frames. Woo!
2016-10-12 18:42:41 +00:00
#### # 5 A_GenericFreezeDeath;
---- A 1 A_FreezeDeathChunks;
Wait;
2016-10-11 16:53:10 +00:00
GenericCrush:
2016-10-12 18:42:41 +00:00
POL5 A -1;
Stop;
2016-10-11 16:53:10 +00:00
}
// Internal functions
2017-03-05 13:03:27 +00:00
deprecated("2.3") private native int __decorate_internal_int__(int i);
deprecated("2.3") private native bool __decorate_internal_bool__(bool b);
deprecated("2.3") private native double __decorate_internal_float__(double f);
2016-10-11 16:53:10 +00:00
}