diff --git a/src/info.h b/src/info.h index 5e1d045f23..2155734ad4 100644 --- a/src/info.h +++ b/src/info.h @@ -356,21 +356,4 @@ int GetSpriteIndex(const char * spritename, bool add = true); TArray &MakeStateNameList(const char * fname); void AddStateLight(FState *state, const char *lname); -// Standard parameters for all action functons -// self - Actor this action is to operate on (player if a weapon) -// stateowner - Actor this action really belongs to (may be an item) -// callingstate - State this action was called from -#define PARAM_ACTION_PROLOGUE(type) \ - PARAM_PROLOGUE; \ - PARAM_OBJECT (self, type); \ - PARAM_OBJECT_OPT (stateowner, AActor) { stateowner = self; } \ - PARAM_STATEINFO_OPT (stateinfo) { stateinfo = nullptr; } \ - -// Number of action paramaters -#define NAP 3 - -#define PARAM_SELF_PROLOGUE(type) \ - PARAM_PROLOGUE; \ - PARAM_OBJECT(self, type); - #endif // __INFO_H__ diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 57c6768018..a4f49607fc 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -197,6 +197,22 @@ bool ACustomInventory::CallStateChain (AActor *actor, FState *state) return !!result; } + +//========================================================================== +// +// GetPointer +// +// resolve AAPTR_* +// +//========================================================================== + +DEFINE_ACTION_FUNCTION(AActor, GetPointer) +{ + PARAM_SELF_PROLOGUE(AActor); + PARAM_INT(ptr); + ACTION_RETURN_OBJECT(COPY_AAPTR(self, ptr)); +} + //========================================================================== // // CheckClass @@ -212,8 +228,8 @@ DEFINE_ACTION_FUNCTION(AActor, CheckClass) assert(ret != NULL); PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (checktype, AActor); - PARAM_INT_OPT (pick_pointer) { pick_pointer = AAPTR_DEFAULT; } - PARAM_BOOL_OPT (match_superclass) { match_superclass = false; } + PARAM_INT_DEF (pick_pointer); + PARAM_BOOL_DEF (match_superclass); self = COPY_AAPTR(self, pick_pointer); if (self == NULL) @@ -248,8 +264,8 @@ DEFINE_ACTION_FUNCTION(AActor, GetMissileDamage) assert(ret != NULL); PARAM_SELF_PROLOGUE(AActor); PARAM_INT(mask); - PARAM_INT(add) - PARAM_INT_OPT(pick_pointer) { pick_pointer = AAPTR_DEFAULT; } + PARAM_INT(add); + PARAM_INT_DEF(pick_pointer); self = COPY_AAPTR(self, pick_pointer); if (self == NULL) @@ -265,29 +281,6 @@ DEFINE_ACTION_FUNCTION(AActor, GetMissileDamage) return 0; } -//========================================================================== -// -// IsPointerEqual -// -// NON-ACTION function to check if two pointers are equal. -// -//========================================================================== - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, IsPointerEqual) -{ - if (numret > 0) - { - assert(ret != NULL); - PARAM_SELF_PROLOGUE(AActor); - PARAM_INT (ptr_select1); - PARAM_INT (ptr_select2); - - ret->SetInt(COPY_AAPTR(self, ptr_select1) == COPY_AAPTR(self, ptr_select2)); - return 1; - } - return 0; -} - //========================================================================== // // CountInv @@ -303,7 +296,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, CountInv) assert(ret != NULL); PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(itemtype, AInventory); - PARAM_INT_OPT(pick_pointer) { pick_pointer = AAPTR_DEFAULT; } + PARAM_INT_DEF(pick_pointer); self = COPY_AAPTR(self, pick_pointer); if (self == NULL || itemtype == NULL) @@ -334,7 +327,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetDistance) assert(ret != NULL); PARAM_SELF_PROLOGUE(AActor); PARAM_BOOL(checkz); - PARAM_INT_OPT(ptr) { ptr = AAPTR_TARGET; } + PARAM_INT_DEF(ptr); AActor *target = COPY_AAPTR(self, ptr); @@ -377,7 +370,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetAngle) assert(ret != NULL); PARAM_SELF_PROLOGUE(AActor); PARAM_INT(flags); - PARAM_INT_OPT(ptr) { ptr = AAPTR_TARGET; } + PARAM_INT_DEF(ptr) AActor *target = COPY_AAPTR(self, ptr); @@ -442,7 +435,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetSpriteAngle) { assert(ret != NULL); PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF(ptr); AActor *target = COPY_AAPTR(self, ptr); if (target == nullptr) @@ -471,7 +464,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetSpriteRotation) { assert(ret != NULL); PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF(ptr); AActor *target = COPY_AAPTR(self, ptr); if (target == nullptr) @@ -511,11 +504,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetZAt) { assert(ret != NULL); PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT_OPT(px) { px = 0.; } - PARAM_FLOAT_OPT(py) { py = 0.; } - PARAM_ANGLE_OPT(angle) { angle = 0.; } - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_INT_OPT(pick_pointer) { pick_pointer = AAPTR_DEFAULT; } + PARAM_FLOAT_DEF(px); + PARAM_FLOAT_DEF(py); + PARAM_ANGLE_DEF(angle); + PARAM_INT_DEF(flags); + PARAM_INT_DEF(pick_pointer); AActor *mobj = COPY_AAPTR(self, pick_pointer); if (mobj == nullptr) @@ -599,7 +592,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetCrouchFactor) { assert(ret != NULL); PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(ptr) { ptr = AAPTR_PLAYER1; } + PARAM_INT_DEF(ptr); AActor *mobj = COPY_AAPTR(self, ptr); if (!mobj || !mobj->player) @@ -660,7 +653,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, GetPlayerInput) assert(ret != nullptr); PARAM_SELF_PROLOGUE(AActor); PARAM_INT (inputnum); - PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF(ptr); AActor *mobj = COPY_AAPTR(self, ptr); @@ -693,8 +686,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, CountProximity) PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(classname, AActor); PARAM_FLOAT(distance); - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF(flags); + PARAM_INT_DEF(ptr); AActor *mobj = COPY_AAPTR(self, ptr); if (mobj == nullptr) @@ -770,9 +763,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RearrangePointers) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT (ptr_target); - PARAM_INT_OPT (ptr_master) { ptr_master = AAPTR_DEFAULT; } - PARAM_INT_OPT (ptr_tracer) { ptr_tracer = AAPTR_TRACER; } - PARAM_INT_OPT (flags) { flags = 0; } + PARAM_INT_DEF (ptr_master); + PARAM_INT_DEF (ptr_tracer); + PARAM_INT_DEF (flags); // Rearrange pointers internally @@ -852,8 +845,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TransferPointer) PARAM_INT (ptr_source); PARAM_INT (ptr_recipient); PARAM_INT (ptr_sourcefield); - PARAM_INT_OPT (ptr_recipientfield) { ptr_recipientfield = AAPTR_DEFAULT; } - PARAM_INT_OPT (flags) { flags = 0; } + PARAM_INT_DEF (ptr_recipientfield); + PARAM_INT_DEF (flags); AActor *source, *recipient; @@ -892,7 +885,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TransferPointer) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CopyFriendliness) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT (ptr_source) { ptr_source = AAPTR_MASTER; } + PARAM_INT_DEF (ptr_source); if (self->player != NULL) { @@ -907,39 +900,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CopyFriendliness) return 0; } -//========================================================================== -// -// Simple flag changers -// -//========================================================================== -DEFINE_ACTION_FUNCTION(AActor, A_SetSolid) -{ - PARAM_SELF_PROLOGUE(AActor); - self->flags |= MF_SOLID; - return 0; -} - -DEFINE_ACTION_FUNCTION(AActor, A_UnsetSolid) -{ - PARAM_SELF_PROLOGUE(AActor); - self->flags &= ~MF_SOLID; - return 0; -} - -DEFINE_ACTION_FUNCTION(AActor, A_SetFloat) -{ - PARAM_SELF_PROLOGUE(AActor); - self->flags |= MF_FLOAT; - return 0; -} - -DEFINE_ACTION_FUNCTION(AActor, A_UnsetFloat) -{ - PARAM_SELF_PROLOGUE(AActor); - self->flags &= ~(MF_FLOAT|MF_INFLOAT); - return 0; -} - //========================================================================== // // Customizable attack functions which use actor parameters. @@ -1029,11 +989,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BasicAttack) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySound) { PARAM_SELF_PROLOGUE(AActor); - PARAM_SOUND_OPT (soundid) { soundid = "weapons/pistol"; } - PARAM_INT_OPT (channel) { channel = CHAN_BODY; } - PARAM_FLOAT_OPT (volume) { volume = 1; } - PARAM_BOOL_OPT (looping) { looping = false; } - PARAM_FLOAT_OPT (attenuation) { attenuation = ATTN_NORM; } + PARAM_SOUND_DEF (soundid); + PARAM_INT_DEF (channel); + PARAM_FLOAT_DEF (volume); + PARAM_BOOL_DEF (looping); + PARAM_FLOAT_DEF (attenuation); if (!looping) { @@ -1052,7 +1012,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySound) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StopSound) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(slot) { slot = CHAN_VOICE; } + PARAM_INT_DEF(slot); S_StopSound(self, slot); return 0; @@ -1067,22 +1027,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StopSound) // //========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayWeaponSound) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_SOUND(soundid); - - S_Sound(self, CHAN_WEAPON, soundid, 1, ATTN_NORM); - return 0; -} - DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlaySoundEx) { PARAM_SELF_PROLOGUE(AActor); PARAM_SOUND (soundid); PARAM_NAME (channel); - PARAM_BOOL_OPT (looping) { looping = false; } - PARAM_INT_OPT (attenuation_raw) { attenuation_raw = 0; } + PARAM_BOOL_DEF (looping); + PARAM_INT_DEF (attenuation_raw); float attenuation; switch (attenuation_raw) @@ -1142,9 +1093,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SeekerMissile) PARAM_SELF_PROLOGUE(AActor); PARAM_INT(ang1); PARAM_INT(ang2); - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_INT_OPT(chance) { chance = 50; } - PARAM_INT_OPT(distance) { distance = 10; } + PARAM_INT_DEF(flags); + PARAM_INT_DEF(chance); + PARAM_INT_DEF(distance); if ((flags & SMF_LOOK) && (self->tracer == 0) && (pr_seekermissile()target, self, param, numparam, ret, numret); + return DoJumpIfInventory(self->target, VM_ARGS_NAMES); } //========================================================================== @@ -1389,7 +1340,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfArmorType) PARAM_SELF_PROLOGUE(AActor); PARAM_NAME (type); PARAM_STATE (label); - PARAM_INT_OPT(amount) { amount = 1; } + PARAM_INT_DEF(amount); ABasicArmor *armor = (ABasicArmor *)self->FindInventory(NAME_BasicArmor); @@ -1416,15 +1367,15 @@ enum DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Explode) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT (damage) { damage = -1; } - PARAM_INT_OPT (distance) { distance = -1; } - PARAM_INT_OPT (flags) { flags = XF_HURTSOURCE; } - PARAM_BOOL_OPT (alert) { alert = false; } - PARAM_INT_OPT (fulldmgdistance) { fulldmgdistance = 0; } - PARAM_INT_OPT (nails) { nails = 0; } - PARAM_INT_OPT (naildamage) { naildamage = 10; } - PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindActor(NAME_BulletPuff); } - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } + PARAM_INT_DEF (damage); + PARAM_INT_DEF (distance); + PARAM_INT_DEF (flags); + PARAM_BOOL_DEF (alert); + PARAM_INT_DEF (fulldmgdistance); + PARAM_INT_DEF (nails); + PARAM_INT_DEF (naildamage); + PARAM_CLASS_DEF (pufftype, AActor); + PARAM_NAME_DEF (damagetype); if (damage < 0) // get parameters from metadata { @@ -1485,10 +1436,10 @@ enum DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusThrust) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT (force) { force = 128; } - PARAM_INT_OPT (distance) { distance = -1; } - PARAM_INT_OPT (flags) { flags = RTF_AFFECTSOURCE; } - PARAM_INT_OPT (fullthrustdistance) { fullthrustdistance = 0; } + PARAM_INT_DEF (force); + PARAM_INT_DEF (distance); + PARAM_INT_DEF (flags); + PARAM_INT_DEF (fullthrustdistance); bool sourcenothrust = false; @@ -1525,10 +1476,10 @@ enum DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusDamageSelf) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(damage) { damage = 128; } - PARAM_FLOAT_OPT(distance) { distance = 128; } - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_CLASS_OPT(flashtype, AActor) { flashtype = NULL; } + PARAM_INT_DEF(damage); + PARAM_FLOAT_DEF(distance); + PARAM_INT_DEF(flags); + PARAM_CLASS_DEF(flashtype, AActor); int i; int damageSteps; @@ -1587,11 +1538,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CallSpecial) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT (special); - PARAM_INT_OPT (arg1) { arg1 = 0; } - PARAM_INT_OPT (arg2) { arg2 = 0; } - PARAM_INT_OPT (arg3) { arg3 = 0; } - PARAM_INT_OPT (arg4) { arg4 = 0; } - PARAM_INT_OPT (arg5) { arg5 = 0; } + PARAM_INT_DEF (arg1); + PARAM_INT_DEF (arg2); + PARAM_INT_DEF (arg3); + PARAM_INT_DEF (arg4); + PARAM_INT_DEF (arg5); bool res = !!P_ExecuteSpecial(special, NULL, self, false, arg1, arg2, arg3, arg4, arg5); @@ -1620,12 +1571,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMissile) { PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (ti, AActor); - PARAM_FLOAT_OPT (Spawnheight) { Spawnheight = 32; } - PARAM_FLOAT_OPT (Spawnofs_xy) { Spawnofs_xy = 0; } - PARAM_ANGLE_OPT (Angle) { Angle = 0.; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_ANGLE_OPT (Pitch) { Pitch = 0.; } - PARAM_INT_OPT (ptr) { ptr = AAPTR_TARGET; } + PARAM_FLOAT_DEF (Spawnheight); + PARAM_FLOAT_DEF (Spawnofs_xy); + PARAM_ANGLE_DEF (Angle); + PARAM_INT_DEF (flags); + PARAM_ANGLE_DEF (Pitch); + PARAM_INT_DEF (ptr); AActor *ref = COPY_AAPTR(self, ptr); @@ -1772,13 +1723,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack) PARAM_ANGLE (spread_z); PARAM_INT (numbullets); PARAM_INT (damageperbullet); - PARAM_CLASS_OPT (pufftype, AActor) { pufftype = nullptr; } - PARAM_FLOAT_OPT (range) { range = 0; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_INT_OPT (ptr) { ptr = AAPTR_TARGET; } - PARAM_CLASS_OPT (missile, AActor) { missile = nullptr; } - PARAM_FLOAT_OPT (Spawnheight) { Spawnheight = 32; } - PARAM_FLOAT_OPT (Spawnofs_xy) { Spawnofs_xy = 0; } + PARAM_CLASS_DEF (pufftype, AActor); + PARAM_FLOAT_DEF (range); + PARAM_INT_DEF (flags); + PARAM_INT_DEF (ptr); + PARAM_CLASS_DEF (missile, AActor); + PARAM_FLOAT_DEF (Spawnheight); + PARAM_FLOAT_DEF (Spawnofs_xy); AActor *ref = COPY_AAPTR(self, ptr); @@ -1860,11 +1811,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomMeleeAttack) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT (damage) { damage = 0; } - PARAM_SOUND_OPT (meleesound) { meleesound = 0; } - PARAM_SOUND_OPT (misssound) { misssound = 0; } - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_BOOL_OPT (bleed) { bleed = true; } + PARAM_INT_DEF (damage); + PARAM_SOUND_DEF (meleesound); + PARAM_SOUND_DEF (misssound); + PARAM_NAME_DEF (damagetype); + PARAM_BOOL_DEF (bleed); if (damagetype == NAME_None) damagetype = NAME_Melee; // Melee is the default type @@ -1900,9 +1851,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomComboAttack) PARAM_CLASS (ti, AActor); PARAM_FLOAT (spawnheight); PARAM_INT (damage); - PARAM_SOUND_OPT (meleesound) { meleesound = 0; } - PARAM_NAME_OPT (damagetype) { damagetype = NAME_Melee; } - PARAM_BOOL_OPT (bleed) { bleed = true; } + PARAM_SOUND_DEF (meleesound); + PARAM_NAME_DEF (damagetype); + PARAM_BOOL_DEF (bleed); if (!self->target) return 0; @@ -2022,12 +1973,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets) PARAM_ANGLE (spread_z); PARAM_INT (numbullets); PARAM_INT (damageperbullet); - PARAM_CLASS_OPT (pufftype, AActor) { pufftype = nullptr; } - PARAM_INT_OPT (flags) { flags = FBF_USEAMMO; } - PARAM_FLOAT_OPT (range) { range = 0; } - PARAM_CLASS_OPT (missile, AActor) { missile = nullptr; } - PARAM_FLOAT_OPT (Spawnheight) { Spawnheight = 0; } - PARAM_FLOAT_OPT (Spawnofs_xy) { Spawnofs_xy = 0; } + PARAM_CLASS_DEF (pufftype, AActor); + PARAM_INT_DEF (flags); + PARAM_FLOAT_DEF (range); + PARAM_CLASS_DEF (missile, AActor); + PARAM_FLOAT_DEF (Spawnheight); + PARAM_FLOAT_DEF (Spawnofs_xy); if (!self->player) return 0; @@ -2149,12 +2100,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireCustomMissile) { PARAM_ACTION_PROLOGUE(AActor); PARAM_CLASS (ti, AActor); - PARAM_ANGLE_OPT (angle) { angle = 0.; } - PARAM_BOOL_OPT (useammo) { useammo = true; } - PARAM_FLOAT_OPT (spawnofs_xy) { spawnofs_xy = 0; } - PARAM_FLOAT_OPT (spawnheight) { spawnheight = 0; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_ANGLE_OPT (pitch) { pitch = 0.; } + PARAM_ANGLE_DEF (angle); + PARAM_BOOL_DEF (useammo); + PARAM_FLOAT_DEF (spawnofs_xy); + PARAM_FLOAT_DEF (spawnheight); + PARAM_INT_DEF (flags); + PARAM_ANGLE_DEF (pitch); if (!self->player) return 0; @@ -2226,15 +2177,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch) { PARAM_ACTION_PROLOGUE(AActor); PARAM_INT (damage); - PARAM_BOOL_OPT (norandom) { norandom = false; } - PARAM_INT_OPT (flags) { flags = CPF_USEAMMO; } - PARAM_CLASS_OPT (pufftype, AActor) { pufftype = NULL; } - PARAM_FLOAT_OPT (range) { range = 0; } - PARAM_FLOAT_OPT (lifesteal) { lifesteal = 0; } - PARAM_INT_OPT (lifestealmax) { lifestealmax = 0; } - PARAM_CLASS_OPT (armorbonustype, ABasicArmorBonus) { armorbonustype = NULL; } - PARAM_SOUND_OPT (MeleeSound) { MeleeSound = ""; } - PARAM_SOUND_OPT (MissSound) { MissSound = ""; } + PARAM_BOOL_DEF (norandom); + PARAM_INT_DEF (flags); + PARAM_CLASS_DEF (pufftype, AActor); + PARAM_FLOAT_DEF (range); + PARAM_FLOAT_DEF (lifesteal); + PARAM_INT_DEF (lifestealmax); + PARAM_CLASS_DEF (armorbonustype, ABasicArmorBonus); + PARAM_SOUND_DEF (MeleeSound); + PARAM_SOUND_DEF (MissSound); if (!self->player) return 0; @@ -2330,23 +2281,23 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack) { PARAM_ACTION_PROLOGUE(AActor); PARAM_INT (damage); - PARAM_INT_OPT (spawnofs_xy) { spawnofs_xy = 0; } - PARAM_BOOL_OPT (useammo) { useammo = true; } - PARAM_COLOR_OPT (color1) { color1 = 0; } - PARAM_COLOR_OPT (color2) { color2 = 0; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_FLOAT_OPT (maxdiff) { maxdiff = 0; } - PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindActor(NAME_BulletPuff); } - PARAM_ANGLE_OPT (spread_xy) { spread_xy = 0.; } - PARAM_ANGLE_OPT (spread_z) { spread_z = 0.; } - PARAM_FLOAT_OPT (range) { range = 0; } - PARAM_INT_OPT (duration) { duration = 0; } - PARAM_FLOAT_OPT (sparsity) { sparsity = 1; } - PARAM_FLOAT_OPT (driftspeed) { driftspeed = 1; } - PARAM_CLASS_OPT (spawnclass, AActor){ spawnclass = NULL; } - PARAM_FLOAT_OPT (spawnofs_z) { spawnofs_z = 0; } - PARAM_INT_OPT (SpiralOffset) { SpiralOffset = 270; } - PARAM_INT_OPT (limit) { limit = 0; } + PARAM_INT_DEF (spawnofs_xy); + PARAM_BOOL_DEF (useammo); + PARAM_COLOR_DEF (color1); + PARAM_COLOR_DEF (color2); + PARAM_INT_DEF (flags); + PARAM_FLOAT_DEF (maxdiff); + PARAM_CLASS_DEF (pufftype, AActor); + PARAM_ANGLE_DEF (spread_xy); + PARAM_ANGLE_DEF (spread_z); + PARAM_FLOAT_DEF (range) ; + PARAM_INT_DEF (duration); + PARAM_FLOAT_DEF (sparsity); + PARAM_FLOAT_DEF (driftspeed); + PARAM_CLASS_DEF (spawnclass, AActor); + PARAM_FLOAT_DEF (spawnofs_z); + PARAM_INT_DEF (SpiralOffset); + PARAM_INT_DEF (limit); if (range == 0) range = 8192; if (sparsity == 0) sparsity=1.0; @@ -2409,23 +2360,23 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT (damage); - PARAM_INT_OPT (spawnofs_xy) { spawnofs_xy = 0; } - PARAM_COLOR_OPT (color1) { color1 = 0; } - PARAM_COLOR_OPT (color2) { color2 = 0; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_INT_OPT (aim) { aim = CRF_DONTAIM; } - PARAM_FLOAT_OPT (maxdiff) { maxdiff = 0; } - PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindActor(NAME_BulletPuff); } - PARAM_ANGLE_OPT (spread_xy) { spread_xy = 0.; } - PARAM_ANGLE_OPT (spread_z) { spread_z = 0.; } - PARAM_FLOAT_OPT (range) { range = 0; } - PARAM_INT_OPT (duration) { duration = 0; } - PARAM_FLOAT_OPT (sparsity) { sparsity = 1; } - PARAM_FLOAT_OPT (driftspeed) { driftspeed = 1; } - PARAM_CLASS_OPT (spawnclass, AActor){ spawnclass = NULL; } - PARAM_FLOAT_OPT (spawnofs_z) { spawnofs_z = 0; } - PARAM_INT_OPT (SpiralOffset) { SpiralOffset = 270; } - PARAM_INT_OPT (limit) { limit = 0; } + PARAM_INT_DEF (spawnofs_xy) + PARAM_COLOR_DEF (color1) + PARAM_COLOR_DEF (color2) + PARAM_INT_DEF (flags) + PARAM_INT_DEF (aim) + PARAM_FLOAT_DEF (maxdiff) + PARAM_CLASS_DEF (pufftype, AActor) + PARAM_ANGLE_DEF (spread_xy) + PARAM_ANGLE_DEF (spread_z) + PARAM_FLOAT_DEF (range) + PARAM_INT_DEF (duration) + PARAM_FLOAT_DEF (sparsity) + PARAM_FLOAT_DEF (driftspeed) + PARAM_CLASS_DEF (spawnclass, AActor) + PARAM_FLOAT_DEF (spawnofs_z) + PARAM_INT_DEF (SpiralOffset) + PARAM_INT_DEF (limit) if (range == 0) range = 8192.; if (sparsity == 0) sparsity = 1; @@ -2527,11 +2478,11 @@ static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS) { int paramnum = 0; PARAM_CLASS (mi, AInventory); - PARAM_INT_OPT (amount) { amount = 1; } + PARAM_INT_DEF (amount) if (!orresult) { - PARAM_INT_OPT(setreceiver) { setreceiver = AAPTR_DEFAULT; } + PARAM_INT_DEF(setreceiver) receiver = COPY_AAPTR(receiver, setreceiver); } if (receiver == NULL) @@ -2635,8 +2586,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetInventory) PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(itemtype, AInventory); PARAM_INT(amount); - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } - PARAM_BOOL_OPT(beyondMax) { beyondMax = false; } + PARAM_INT_DEF(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_BOOL_DEF(beyondMax) { beyondMax = false; } bool res = false; @@ -2725,8 +2676,8 @@ bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS) { int paramnum = 0; PARAM_CLASS (itemtype, AInventory); - PARAM_INT_OPT (amount) { amount = 0; } - PARAM_INT_OPT (flags) { flags = 0; } + PARAM_INT_DEF (amount); + PARAM_INT_DEF (flags); if (itemtype == NULL) { @@ -3013,11 +2964,11 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem) { PARAM_ACTION_PROLOGUE(AActor); - PARAM_CLASS_OPT (missile, AActor) { missile = PClass::FindActor("Unknown"); } - PARAM_FLOAT_OPT (distance) { distance = 0; } - PARAM_FLOAT_OPT (zheight) { zheight = 0; } - PARAM_BOOL_OPT (useammo) { useammo = true; } - PARAM_BOOL_OPT (transfer_translation) { transfer_translation = false; } + PARAM_CLASS_DEF (missile, AActor) + PARAM_FLOAT_DEF (distance) + PARAM_FLOAT_DEF (zheight) + PARAM_BOOL_DEF (useammo) + PARAM_BOOL_DEF (transfer_translation) if (missile == NULL) { @@ -3062,16 +3013,16 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx) { PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (missile, AActor); - PARAM_FLOAT_OPT (xofs) { xofs = 0; } - PARAM_FLOAT_OPT (yofs) { yofs = 0; } - PARAM_FLOAT_OPT (zofs) { zofs = 0; } - PARAM_FLOAT_OPT (xvel) { xvel = 0; } - PARAM_FLOAT_OPT (yvel) { yvel = 0; } - PARAM_FLOAT_OPT (zvel) { zvel = 0; } - PARAM_ANGLE_OPT (angle) { angle = 0.; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_INT_OPT (chance) { chance = 0; } - PARAM_INT_OPT (tid) { tid = 0; } + PARAM_FLOAT_DEF (xofs) + PARAM_FLOAT_DEF (yofs) + PARAM_FLOAT_DEF (zofs) + PARAM_FLOAT_DEF (xvel) + PARAM_FLOAT_DEF (yvel) + PARAM_FLOAT_DEF (zvel) + PARAM_ANGLE_DEF (angle) + PARAM_INT_DEF (flags) + PARAM_INT_DEF (chance) + PARAM_INT_DEF (tid) if (missile == NULL) { @@ -3144,15 +3095,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItemEx) //=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ThrowGrenade) { - PARAM_ACTION_PROLOGUE(AActor); - PARAM_CLASS (missile, AActor); - PARAM_FLOAT_OPT (zheight) { zheight = 0; } - PARAM_FLOAT_OPT (xyvel) { xyvel = 0; } - PARAM_FLOAT_OPT (zvel) { zvel = 0; } - PARAM_BOOL_OPT (useammo) { useammo = true; } + PARAM_ACTION_PROLOGUE(AActor); + PARAM_CLASS (missile, AActor); + PARAM_FLOAT_DEF (zheight) + PARAM_FLOAT_DEF (xyvel) + PARAM_FLOAT_DEF (zvel) + PARAM_BOOL_DEF (useammo) - if (missile == NULL) - { + if (missile == NULL) + { ACTION_RETURN_BOOL(true); } if (ACTION_CALL_FROM_PSPRITE()) @@ -3243,7 +3194,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SelectWeapon) { PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS(cls, AWeapon); - PARAM_INT_OPT(flags) { flags = 0; } + PARAM_INT_DEF(flags); bool selectPriority = !!(flags & SWF_SELECTPRIORITY); @@ -3288,8 +3239,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Print) { PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (text); - PARAM_FLOAT_OPT (time) { time = 0; } - PARAM_NAME_OPT (fontname) { fontname = NAME_None; } + PARAM_FLOAT_DEF (time); + PARAM_NAME_DEF (fontname); if (text[0] == '$') text = GStrings(&text[1]); if (self->CheckLocalView (consoleplayer) || @@ -3323,8 +3274,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PrintBold) { PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (text); - PARAM_FLOAT_OPT (time) { time = 0; } - PARAM_NAME_OPT (fontname) { fontname = NAME_None; } + PARAM_FLOAT_DEF (time); + PARAM_NAME_DEF (fontname); float saved = con_midtime; FFont *font = NULL; @@ -3400,7 +3351,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTranslucent) { PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (alpha); - PARAM_INT_OPT (mode) { mode = 0; } + PARAM_INT_DEF (mode); mode = mode == 0 ? STYLE_Translucent : mode == 2 ? STYLE_Fuzzy : STYLE_Add; @@ -3419,7 +3370,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRenderStyle) { PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(alpha); - PARAM_INT_OPT(mode) { mode = 0; } + PARAM_INT_DEF(mode); self->Alpha = clamp(alpha, 0., 1.); self->RenderStyle = ERenderStyle(mode); @@ -3443,8 +3394,10 @@ enum FadeFlags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeIn) { PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT_OPT(reduce) { reduce = 0.1; } - PARAM_INT_OPT(flags) { flags = 0; } + PARAM_FLOAT_DEF(reduce); + PARAM_INT_DEF(flags); + PARAM_NAME_DEF(fontname); + if (reduce == 0) { @@ -3477,8 +3430,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeIn) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeOut) { PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT_OPT(reduce) { reduce = 0.1; } - PARAM_INT_OPT(flags) { flags = FTF_REMOVE; } + PARAM_FLOAT_DEF(reduce); + PARAM_INT_DEF(flags); if (reduce == 0) { @@ -3512,8 +3465,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo) { PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (target); - PARAM_FLOAT_OPT (amount) { amount = 0.1; } - PARAM_INT_OPT (flags) { flags = 0; } + PARAM_FLOAT_DEF (amount); + PARAM_INT_DEF (flags); self->RenderStyle.Flags &= ~STYLEF_Alpha1; @@ -3546,50 +3499,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FadeTo) return 0; } -//=========================================================================== -// -// A_Scale(float scalex, optional float scaley) -// -// Scales the actor's graphics. If scaley is 0, use scalex. -// -//=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetScale) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT (scalex); - PARAM_FLOAT_OPT (scaley) { scaley = scalex; } - PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } - PARAM_BOOL_OPT (usezero) { usezero = false; } - - AActor *ref = COPY_AAPTR(self, ptr); - - if (ref != NULL) - { - if (scaley == 0 && !usezero) - { - scaley = scalex; - } - ref->Scale = { scalex, scaley }; - } - return 0; -} - -//=========================================================================== -// -// A_SetMass(int mass) -// -// Sets the actor's mass. -// -//=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetMass) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_INT (mass); - - self->Mass = mass; - return 0; -} - //=========================================================================== // // A_SpawnDebris @@ -3599,9 +3508,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris) { PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (debris, AActor); - PARAM_BOOL_OPT (transfer_translation) { transfer_translation = false; } - PARAM_FLOAT_OPT (mult_h) { mult_h = 1; } - PARAM_FLOAT_OPT (mult_v) { mult_v = 1; } + PARAM_BOOL_DEF (transfer_translation) + PARAM_FLOAT_DEF (mult_h) + PARAM_FLOAT_DEF (mult_v) int i; AActor *mo; @@ -3655,22 +3564,22 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnParticle) { PARAM_SELF_PROLOGUE(AActor); PARAM_COLOR (color); - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_INT_OPT (lifetime) { lifetime = 35; } - PARAM_FLOAT_OPT (size) { size = 1.; } - PARAM_ANGLE_OPT (angle) { angle = 0.; } - PARAM_FLOAT_OPT (xoff) { xoff = 0; } - PARAM_FLOAT_OPT (yoff) { yoff = 0; } - PARAM_FLOAT_OPT (zoff) { zoff = 0; } - PARAM_FLOAT_OPT (xvel) { xvel = 0; } - PARAM_FLOAT_OPT (yvel) { yvel = 0; } - PARAM_FLOAT_OPT (zvel) { zvel = 0; } - PARAM_FLOAT_OPT (accelx) { accelx = 0; } - PARAM_FLOAT_OPT (accely) { accely = 0; } - PARAM_FLOAT_OPT (accelz) { accelz = 0; } - PARAM_FLOAT_OPT (startalpha) { startalpha = 1.; } - PARAM_FLOAT_OPT (fadestep) { fadestep = -1.; } - PARAM_FLOAT_OPT (sizestep) { sizestep = 0.; } + PARAM_INT_DEF (flags) + PARAM_INT_DEF (lifetime) + PARAM_FLOAT_DEF (size) + PARAM_ANGLE_DEF (angle) + PARAM_FLOAT_DEF (xoff) + PARAM_FLOAT_DEF (yoff) + PARAM_FLOAT_DEF (zoff) + PARAM_FLOAT_DEF (xvel) + PARAM_FLOAT_DEF (yvel) + PARAM_FLOAT_DEF (zvel) + PARAM_FLOAT_DEF (accelx) + PARAM_FLOAT_DEF (accely) + PARAM_FLOAT_DEF (accelz) + PARAM_FLOAT_DEF (startalpha) + PARAM_FLOAT_DEF (fadestep) + PARAM_FLOAT_DEF (sizestep) startalpha = clamp(startalpha, 0., 1.); if (fadestep > 0) fadestep = clamp(fadestep, 0., 1.); @@ -3786,7 +3695,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSightOrRange) PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(range); PARAM_STATE(jump); - PARAM_BOOL_OPT(twodi) { twodi = false; } + PARAM_BOOL_DEF(twodi); range *= range; for (int i = 0; i < MAXPLAYERS; ++i) @@ -3815,7 +3724,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckRange) PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(range); PARAM_STATE(jump); - PARAM_BOOL_OPT(twodi) { twodi = false; } + PARAM_BOOL_DEF(twodi); range *= range; for (int i = 0; i < MAXPLAYERS; ++i) @@ -3872,7 +3781,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetBlend) PARAM_COLOR (color); PARAM_FLOAT (alpha); PARAM_INT (tics); - PARAM_COLOR_OPT (color2) { color2 = 0; } + PARAM_COLOR_DEF (color2); if (color == MAKEARGB(255,255,255,255)) color = 0; @@ -3912,7 +3821,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT(cnt); - PARAM_STATE_OPT(state) { state = self->FindState(NAME_Death); } + PARAM_STATE_DEF(state) if (cnt<0 || cnt >= 5) return 0; if (!self->args[cnt]--) @@ -3927,6 +3836,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CountdownArg) } else { + if (state == nullptr) state = self->FindState(NAME_Death); self->SetState(state); } } @@ -4075,7 +3985,7 @@ enum RS_Flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Respawn) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(flags) { flags = RSF_FOG; } + PARAM_INT_DEF(flags); bool oktorespawn = false; DVector3 pos = self->Pos(); @@ -4164,38 +4074,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PlayerSkinCheck) ACTION_RETURN_STATE(NULL); } -//=========================================================================== -// -// A_SetGravity -// -//=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetGravity) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT(gravity); - - self->Gravity = clamp(gravity, 0., 10.); - return 0; -} - - // [KS] *** Start of my modifications *** -//=========================================================================== -// -// A_ClearTarget -// -//=========================================================================== - -DEFINE_ACTION_FUNCTION(AActor, A_ClearTarget) -{ - PARAM_SELF_PROLOGUE(AActor); - self->target = NULL; - self->LastHeard = NULL; - self->lastenemy = NULL; - return 0; -} - //========================================================================== // // A_CheckLOF (state jump, int flags = CRF_AIM_VERT|CRF_AIM_HOR, @@ -4530,10 +4410,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) { PARAM_SELF_PROLOGUE(AActor); PARAM_STATE (jump); - PARAM_ANGLE_OPT (fov) { fov = 0.; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_FLOAT_OPT (dist_max) { dist_max = 0; } - PARAM_FLOAT_OPT (dist_close) { dist_close = 0; } + PARAM_ANGLE_DEF (fov) + PARAM_INT_DEF (flags) + PARAM_FLOAT_DEF (dist_max) + PARAM_FLOAT_DEF (dist_close) AActor *target, *viewport; FTranslatedLineTarget t; @@ -4668,10 +4548,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetLOS) { PARAM_SELF_PROLOGUE(AActor); PARAM_STATE (jump); - PARAM_ANGLE_OPT (fov) { fov = 0.; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_FLOAT_OPT (dist_max) { dist_max = 0; } - PARAM_FLOAT_OPT (dist_close) { dist_close = 0; } + PARAM_ANGLE_DEF (fov) + PARAM_INT_DEF (flags) + PARAM_FLOAT_DEF (dist_max) + PARAM_FLOAT_DEF (dist_close) AActor *target; @@ -4755,7 +4635,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckForReload) } PARAM_INT (count); PARAM_STATE (jump); - PARAM_BOOL_OPT (dontincrement) { dontincrement = false; } + PARAM_BOOL_DEF (dontincrement); if (numret > 0) { @@ -4836,7 +4716,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFlag) PARAM_SELF_PROLOGUE(AActor); PARAM_STRING (flagname); PARAM_STATE (jumpto); - PARAM_INT_OPT (checkpointer) { checkpointer = AAPTR_DEFAULT; } + PARAM_INT_DEF (checkpointer); AActor *owner = COPY_AAPTR(self, checkpointer); if (owner == NULL) @@ -4852,46 +4732,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckFlag) } -//=========================================================================== -// -// A_ChangeCountFlags (needed, because these flags affect global counters) -// -//=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeLinkFlags) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(blockmap) { blockmap = -1; } - PARAM_INT_OPT(sector) { sector = -1; } - - self->UnlinkFromWorld(); - - if (blockmap != -1) - { - if (blockmap == 0) self->flags &= ~MF_NOBLOCKMAP; - else self->flags |= MF_NOBLOCKMAP; - } - - if (sector != -1) - { - if (sector == 0) self->flags &= ~MF_NOSECTOR; - else self->flags |= MF_NOSECTOR; - } - - self->LinkToWorld(); - return 0; -} - -//=========================================================================== -// -// A_ChangeCountFlags (needed, because these flags affect global counters) -// -//=========================================================================== DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeCountFlags) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(kill) { kill = -1; } - PARAM_INT_OPT(item) { item = -1; } - PARAM_INT_OPT(secret) { secret = -1; } + PARAM_INT_DEF(kill); + PARAM_INT_DEF(item); + PARAM_INT_DEF(secret); if (self->CountsAsKill() && self->health > 0) --level.total_monsters; if (self->flags & MF_COUNTITEM) --level.total_items; @@ -4928,7 +4774,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeCountFlags) DEFINE_ACTION_FUNCTION(AActor, A_RaiseMaster) { PARAM_SELF_PROLOGUE(AActor); - PARAM_BOOL_OPT(copy) { copy = false; } + PARAM_BOOL_DEF(copy); if (self->master != NULL) { @@ -4945,7 +4791,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseMaster) DEFINE_ACTION_FUNCTION(AActor, A_RaiseChildren) { PARAM_SELF_PROLOGUE(AActor); - PARAM_BOOL_OPT(copy) { copy = false; } + PARAM_BOOL_DEF(copy); TThinkerIterator it; AActor *mo; @@ -4968,7 +4814,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseChildren) DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings) { PARAM_SELF_PROLOGUE(AActor); - PARAM_BOOL_OPT(copy) { copy = false; } + PARAM_BOOL_DEF(copy); TThinkerIterator it; AActor *mo; @@ -4986,18 +4832,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings) return 0; } - //=========================================================================== - // -// [TP] A_FaceConsolePlayer -// -//=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_FaceConsolePlayer) -{ - // NOTE: It does nothing for ZDoom, since in a multiplayer game, each - // node has its own console player. - return 0; -} - //=========================================================================== // // A_MonsterRefire @@ -5044,9 +4878,9 @@ enum DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle) { PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT_OPT(angle) { angle = 0; } - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_FLOAT_DEF(angle); + PARAM_INT_DEF(flags); + PARAM_INT_DEF(ptr); AActor *ref = COPY_AAPTR(self, ptr); if (ref != NULL) @@ -5068,8 +4902,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) { PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(pitch); - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF(flags); + PARAM_INT_DEF(ptr); AActor *ref = COPY_AAPTR(self, ptr); @@ -5092,8 +4926,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRoll) { PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT (roll); - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF (flags); + PARAM_INT_DEF (ptr) ; AActor *ref = COPY_AAPTR(self, ptr); if (ref != NULL) @@ -5115,7 +4949,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ScaleVelocity) { PARAM_SELF_PROLOGUE(AActor); PARAM_FLOAT(scale); - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF(ptr); AActor *ref = COPY_AAPTR(self, ptr); @@ -5146,11 +4980,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ScaleVelocity) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity) { PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT_OPT (x) { x = 0; } - PARAM_FLOAT_OPT (y) { y = 0; } - PARAM_FLOAT_OPT (z) { z = 0; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } + PARAM_FLOAT_DEF (x) + PARAM_FLOAT_DEF (y) + PARAM_FLOAT_DEF (z) + PARAM_INT_DEF (flags) + PARAM_INT_DEF (ptr) AActor *ref = COPY_AAPTR(self, ptr); @@ -5186,51 +5020,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeVelocity) return 0; } -//=========================================================================== -// -// A_SetArg -// -//=========================================================================== - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetArg) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_INT(pos); - PARAM_INT(value); - - // Set the value of the specified arg - if ((size_t)pos < countof(self->args)) - { - self->args[pos] = value; - } - return 0; -} - -//=========================================================================== -// -// A_SetSpecial -// -//=========================================================================== - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecial) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_INT (spec); - PARAM_INT_OPT (arg0) { arg0 = 0; } - PARAM_INT_OPT (arg1) { arg1 = 0; } - PARAM_INT_OPT (arg2) { arg2 = 0; } - PARAM_INT_OPT (arg3) { arg3 = 0; } - PARAM_INT_OPT (arg4) { arg4 = 0; } - - self->special = spec; - self->args[0] = arg0; - self->args[1] = arg1; - self->args[2] = arg2; - self->args[3] = arg3; - self->args[4] = arg4; - return 0; -} - //=========================================================================== // // A_SetUserVar @@ -5371,13 +5160,13 @@ enum T_Flags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport) { PARAM_SELF_PROLOGUE(AActor); - PARAM_STATE_OPT (teleport_state) { teleport_state = NULL; } - PARAM_CLASS_OPT (target_type, ASpecialSpot) { target_type = PClass::FindActor("BossSpot"); } - PARAM_CLASS_OPT (fog_type, AActor) { fog_type = PClass::FindActor("TeleportFog"); } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_FLOAT_OPT (mindist) { mindist = 128; } - PARAM_FLOAT_OPT (maxdist) { maxdist = 0; } - PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } + PARAM_STATE_DEF (teleport_state) + PARAM_CLASS_DEF (target_type, ASpecialSpot) + PARAM_CLASS_DEF (fog_type, AActor) + PARAM_INT_DEF (flags) + PARAM_FLOAT_DEF (mindist) + PARAM_FLOAT_DEF (maxdist) + PARAM_INT_DEF (ptr) AActor *ref = COPY_AAPTR(self, ptr); @@ -5538,20 +5327,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Teleport) return numret; } -//=========================================================================== -// -// A_Turn -// -//=========================================================================== - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Turn) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT_OPT(angle) { angle = 0; } - self->Angles.Yaw += angle; - return 0; -} - //=========================================================================== // // A_Quake @@ -5565,7 +5340,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Quake) PARAM_INT (duration); PARAM_INT (damrad); PARAM_INT (tremrad); - PARAM_SOUND_OPT (sound) { sound = "world/quake"; } + PARAM_SOUND_DEF (sound); P_StartQuake(self, 0, intensity, duration, damrad, tremrad, sound); return 0; @@ -5588,15 +5363,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_QuakeEx) PARAM_INT(duration); PARAM_INT(damrad); PARAM_INT(tremrad); - PARAM_SOUND_OPT (sound) { sound = "world/quake"; } - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_FLOAT_OPT(mulWaveX) { mulWaveX = 1.; } - PARAM_FLOAT_OPT(mulWaveY) { mulWaveY = 1.; } - PARAM_FLOAT_OPT(mulWaveZ) { mulWaveZ = 1.; } - PARAM_INT_OPT(falloff) { falloff = 0; } - PARAM_INT_OPT(highpoint) { highpoint = 0; } - PARAM_FLOAT_OPT(rollIntensity) { rollIntensity = 0.; } - PARAM_FLOAT_OPT(rollWave) { rollWave = 0.; } + PARAM_SOUND_DEF(sound); + PARAM_INT_DEF(flags); + PARAM_FLOAT_DEF(mulWaveX); + PARAM_FLOAT_DEF(mulWaveY); + PARAM_FLOAT_DEF(mulWaveZ); + PARAM_INT_DEF(falloff); + PARAM_INT_DEF(highpoint); + PARAM_FLOAT_DEF(rollIntensity); + PARAM_FLOAT_DEF(rollWave); P_StartQuakeXYZ(self, 0, intensityX, intensityY, intensityZ, duration, damrad, tremrad, sound, flags, mulWaveX, mulWaveY, mulWaveZ, falloff, highpoint, rollIntensity, rollWave); return 0; @@ -5675,8 +5450,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Weave) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_LineEffect) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(special) { special = 0; } - PARAM_INT_OPT(tag) { tag = 0; } + PARAM_INT_DEF(special); + PARAM_INT_DEF(tag); line_t junk; maplinedef_t oldjunk; @@ -5710,15 +5485,15 @@ enum WolfAttackFlags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_WolfAttack) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_SOUND_OPT (sound) { sound = "weapons/pistol"; } - PARAM_FLOAT_OPT (snipe) { snipe = 1.; } - PARAM_INT_OPT (maxdamage) { maxdamage = 64; } - PARAM_INT_OPT (blocksize) { blocksize = 128; } - PARAM_INT_OPT (pointblank) { pointblank = 2; } - PARAM_INT_OPT (longrange) { longrange = 4; } - PARAM_FLOAT_OPT (runspeed) { runspeed = 160; } - PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindActor(NAME_BulletPuff); } + PARAM_INT_DEF (flags) + PARAM_SOUND_DEF (sound) + PARAM_FLOAT_DEF (snipe) + PARAM_INT_DEF (maxdamage) + PARAM_INT_DEF (blocksize) + PARAM_INT_DEF (pointblank) + PARAM_INT_DEF (longrange) + PARAM_FLOAT_DEF (runspeed) + PARAM_CLASS_DEF (pufftype, AActor) if (!self->target) return 0; @@ -5816,15 +5591,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT(destination_selector); - PARAM_FLOAT_OPT(xofs) { xofs = 0; } - PARAM_FLOAT_OPT(yofs) { yofs = 0; } - PARAM_FLOAT_OPT(zofs) { zofs = 0; } - PARAM_ANGLE_OPT(angle) { angle = 0.; } - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_STATE_OPT(success_state) { success_state = NULL; } - PARAM_FLOAT_OPT(heightoffset) { heightoffset = 0; } - PARAM_FLOAT_OPT(radiusoffset) { radiusoffset = 0; } - PARAM_ANGLE_OPT(pitch) { pitch = 0.; } + PARAM_FLOAT_DEF(xofs) + PARAM_FLOAT_DEF(yofs) + PARAM_FLOAT_DEF(zofs) + PARAM_ANGLE_DEF(angle) + PARAM_INT_DEF(flags) + PARAM_STATE_DEF(success_state) + PARAM_FLOAT_DEF(heightoffset) + PARAM_FLOAT_DEF(radiusoffset) + PARAM_ANGLE_DEF(pitch) AActor *reference; @@ -5874,104 +5649,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Warp) return numret; } -//========================================================================== -// -// ACS_Named* stuff - -// -// These are exactly like their un-named line special equivalents, except -// they take strings instead of integers to indicate which script to run. -// Some of these probably aren't very useful, but they are included for -// the sake of completeness. -// -//========================================================================== - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteWithResult) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME (scriptname); - PARAM_INT_OPT (arg1) { arg1 = 0; } - PARAM_INT_OPT (arg2) { arg2 = 0; } - PARAM_INT_OPT (arg3) { arg3 = 0; } - PARAM_INT_OPT (arg4) { arg4 = 0; } - - int res = P_ExecuteSpecial(ACS_ExecuteWithResult, NULL, self, false, -scriptname, arg1, arg2, arg3, arg4); - ACTION_RETURN_INT(res); -} - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecute) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME (scriptname); - PARAM_INT_OPT (mapnum) { mapnum = 0; } - PARAM_INT_OPT (arg1) { arg1 = 0; } - PARAM_INT_OPT (arg2) { arg2 = 0; } - PARAM_INT_OPT (arg3) { arg3 = 0; } - - int res = P_ExecuteSpecial(ACS_Execute, NULL, self, false, -scriptname, mapnum, arg1, arg2, arg3); - ACTION_RETURN_INT(res); -} - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedExecuteAlways) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME (scriptname); - PARAM_INT_OPT (mapnum) { mapnum = 0; } - PARAM_INT_OPT (arg1) { arg1 = 0; } - PARAM_INT_OPT (arg2) { arg2 = 0; } - PARAM_INT_OPT (arg3) { arg3 = 0; } - - int res = P_ExecuteSpecial(ACS_ExecuteAlways, NULL, self, false, -scriptname, mapnum, arg1, arg2, arg3); - ACTION_RETURN_INT(res); -} - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecute) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME (scriptname); - PARAM_INT_OPT (mapnum) { mapnum = 0; } - PARAM_INT_OPT (arg1) { arg1 = 0; } - PARAM_INT_OPT (arg2) { arg2 = 0; } - PARAM_INT_OPT (lock) { lock = 0; } - - int res = P_ExecuteSpecial(ACS_LockedExecute, NULL, self, false, -scriptname, mapnum, arg1, arg2, lock); - ACTION_RETURN_INT(res); -} - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedLockedExecuteDoor) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME (scriptname); - PARAM_INT_OPT (mapnum) { mapnum = 0; } - PARAM_INT_OPT (arg1) { arg1 = 0; } - PARAM_INT_OPT (arg2) { arg2 = 0; } - PARAM_INT_OPT (lock) { lock = 0; } - - int res = P_ExecuteSpecial(ACS_LockedExecuteDoor, NULL, self, false, -scriptname, mapnum, arg1, arg2, lock); - ACTION_RETURN_INT(res); -} - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedSuspend) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME (scriptname); - PARAM_INT_OPT (mapnum) { mapnum = 0; } - - int res = P_ExecuteSpecial(ACS_Suspend, NULL, self, false, -scriptname, mapnum, 0, 0, 0); - ACTION_RETURN_INT(res); -} - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, ACS_NamedTerminate) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME (scriptname); - PARAM_INT_OPT (mapnum) { mapnum = 0; } - - int res = P_ExecuteSpecial(ACS_Terminate, NULL, self, false, -scriptname, mapnum, 0, 0, 0); - ACTION_RETURN_INT(res); -} - - static bool DoCheckSpecies(AActor *mo, FName filterSpecies, bool exclude) { FName actorSpecies = mo->GetSpecies(); @@ -6168,11 +5845,11 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RadiusGive) PARAM_CLASS (item, AInventory); PARAM_FLOAT (distance); PARAM_INT (flags); - PARAM_INT_OPT (amount) { amount = 0; } - PARAM_CLASS_OPT (filter, AActor) { filter = nullptr; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_FLOAT_OPT (mindist) { mindist = 0; } - PARAM_INT_OPT (limit) { limit = 0; } + PARAM_INT_DEF (amount); + PARAM_CLASS_DEF (filter, AActor); + PARAM_NAME_DEF (species); + PARAM_FLOAT_DEF (mindist); + PARAM_INT_DEF (limit); // We need a valid item, valid targets, and a valid range if (item == nullptr || (flags & RGF_MASK) == 0 || !flags || distance <= 0 || mindist >= distance) @@ -6218,8 +5895,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckSpecies) { PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(jump); - PARAM_NAME_OPT(species) { species = NAME_None; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_NAME_DEF(species); + PARAM_INT_DEF(ptr); AActor *mobj = COPY_AAPTR(self, ptr); @@ -6259,21 +5936,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetTics) return 0; } -//========================================================================== -// -// A_SetDamageType -// -//========================================================================== - -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetDamageType) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME(damagetype); - - self->DamageType = damagetype; - return 0; -} - //========================================================================== // // A_DropItem @@ -6284,77 +5946,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropItem) { PARAM_SELF_PROLOGUE(AActor); PARAM_CLASS (spawntype, AActor); - PARAM_INT_OPT (amount) { amount = -1; } - PARAM_INT_OPT (chance) { chance = 256; } + PARAM_INT_DEF(amount); + PARAM_INT_DEF(chance); P_DropItem(self, spawntype, amount, chance); return 0; } -//========================================================================== -// -// A_SetSpeed -// -//========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT(speed); - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } - - AActor *ref = COPY_AAPTR(self, ptr); - - if (ref != NULL) - { - ref->Speed = speed; - } - return 0; -} - -//========================================================================== -// -// A_SetFloatSpeed -// -//========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatSpeed) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT(speed); - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } - - AActor *ref = COPY_AAPTR(self, ptr); - - if (!ref) - { - return 0; - } - - ref->FloatSpeed = speed; - return 0; -} - -//========================================================================== -// -// A_SetPainThreshold -// -//========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPainThreshold) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_INT(threshold); - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } - - AActor *ref = COPY_AAPTR(self, ptr); - - if (!ref) - { - return 0; - } - - ref->PainThreshold = threshold; - return 0; -} - //=========================================================================== // // Common A_Damage handler @@ -6429,12 +6027,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSelf) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); @@ -6452,12 +6050,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTarget) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); @@ -6476,12 +6074,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageTracer) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); @@ -6500,12 +6098,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageMaster) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); @@ -6524,12 +6122,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageChildren) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); @@ -6554,12 +6152,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DamageSiblings) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT (amount); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); @@ -6636,12 +6234,12 @@ static void DoKill(AActor *killtarget, AActor *inflictor, AActor *source, FName DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillTarget) { PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); @@ -6659,12 +6257,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillTarget) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillTracer) { PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); @@ -6682,14 +6280,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillTracer) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillMaster) { PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) - AActor *source = COPY_AAPTR(self, src); + AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); if (self->master != NULL) @@ -6705,12 +6303,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillMaster) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillChildren) { PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); @@ -6736,12 +6334,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_KillSiblings) { PARAM_SELF_PROLOGUE(AActor); - PARAM_NAME_OPT (damagetype) { damagetype = NAME_None; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } - PARAM_INT_OPT (src) { src = AAPTR_DEFAULT; } - PARAM_INT_OPT (inflict) { inflict = AAPTR_DEFAULT; } + PARAM_NAME_DEF (damagetype) + PARAM_INT_DEF (flags) + PARAM_CLASS_DEF (filter, AActor) + PARAM_NAME_DEF (species) + PARAM_INT_DEF (src) + PARAM_INT_DEF (inflict) AActor *source = COPY_AAPTR(self, src); AActor *inflictor = COPY_AAPTR(self, inflict); @@ -6812,9 +6410,9 @@ static void DoRemove(AActor *removetarget, int flags, PClassActor *filter, FName DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveTarget) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } + PARAM_INT_DEF(flags); + PARAM_CLASS_DEF(filter, AActor); + PARAM_NAME_DEF(species); if (self->target != NULL) { @@ -6831,9 +6429,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveTarget) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveTracer) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } + PARAM_INT_DEF(flags); + PARAM_CLASS_DEF(filter, AActor); + PARAM_NAME_DEF(species); if (self->tracer != NULL) { @@ -6850,9 +6448,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveTracer) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveMaster) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } + PARAM_INT_DEF(flags); + PARAM_CLASS_DEF(filter, AActor); + PARAM_NAME_DEF(species); if (self->master != NULL) { @@ -6869,10 +6467,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveMaster) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveChildren) { PARAM_SELF_PROLOGUE(AActor); - PARAM_BOOL_OPT (removeall) { removeall = false; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } + PARAM_BOOL_DEF(removeall); + PARAM_INT_DEF(flags); + PARAM_CLASS_DEF(filter, AActor); + PARAM_NAME_DEF(species); TThinkerIterator it; AActor *mo; @@ -6895,10 +6493,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveSiblings) { PARAM_SELF_PROLOGUE(AActor); - PARAM_BOOL_OPT (removeall) { removeall = false; } - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } + PARAM_BOOL_DEF(removeall); + PARAM_INT_DEF(flags); + PARAM_CLASS_DEF(filter, AActor); + PARAM_NAME_DEF(species); TThinkerIterator it; AActor *mo; @@ -6924,10 +6522,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveSiblings) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Remove) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT (removee); - PARAM_INT_OPT (flags) { flags = 0; } - PARAM_CLASS_OPT (filter, AActor){ filter = NULL; } - PARAM_NAME_OPT (species) { species = NAME_None; } + PARAM_INT(removee); + PARAM_INT_DEF(flags); + PARAM_CLASS_DEF(filter, AActor); + PARAM_NAME_DEF(species); AActor *reference = COPY_AAPTR(self, removee); if (reference != NULL) @@ -6982,18 +6580,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_SwapTeleFog) // Changes the FloatBobPhase of the actor. //=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatBobPhase) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_INT(bob); - - //Respect float bob phase limits. - if (self && (bob >= 0 && bob <= 63)) - { - self->FloatBobPhase = bob; - } - return 0; -} //=========================================================================== // A_SetHealth @@ -7006,7 +6592,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetHealth) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT (health); - PARAM_INT_OPT (ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF (ptr); AActor *mobj = COPY_AAPTR(self, ptr); @@ -7043,7 +6629,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetHealth) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ResetHealth) { PARAM_SELF_PROLOGUE(AActor); - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF(ptr); AActor *mobj = COPY_AAPTR(self, ptr); @@ -7080,10 +6666,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfHigherOrLower) PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(high); PARAM_STATE(low); - PARAM_FLOAT_OPT(offsethigh) { offsethigh = 0; } - PARAM_FLOAT_OPT(offsetlow) { offsetlow = 0; } - PARAM_BOOL_OPT(includeHeight) { includeHeight = true; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_TARGET; } + PARAM_FLOAT_DEF(offsethigh); + PARAM_FLOAT_DEF(offsetlow); + PARAM_BOOL_DEF(includeHeight); + PARAM_INT_DEF(ptr); AActor *mobj = COPY_AAPTR(self, ptr); @@ -7111,7 +6697,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) { PARAM_SELF_PROLOGUE(AActor); PARAM_NAME(species); - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF(ptr); AActor *mobj = COPY_AAPTR(self, ptr); if (!mobj) @@ -7123,48 +6709,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpecies) return 0; } -//=========================================================================== -// -// A_SetRipperLevel(int level) -// -// Sets the ripper level of the calling actor. -//=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipperLevel) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_INT(level); - self->RipperLevel = level; - return 0; -} - -//=========================================================================== -// -// A_SetRipMin(int min) -// -// Sets the minimum level a ripper must be in order to rip through this actor. -//=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMin) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_INT(min); - self->RipLevelMin = min; - return 0; -} - -//=========================================================================== -// -// A_SetRipMax(int max) -// -// Sets the minimum level a ripper must be in order to rip through this actor. -//=========================================================================== -DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetRipMax) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_INT(max); - self->RipLevelMax = max; - return 0; -} - //=========================================================================== // // A_SetChaseThreshold(int threshold, bool def, int ptr) @@ -7177,8 +6721,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetChaseThreshold) { PARAM_SELF_PROLOGUE(AActor); PARAM_INT(threshold); - PARAM_BOOL_OPT(def) { def = false; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_BOOL_DEF(def); + PARAM_INT_DEF(ptr); AActor *mobj = COPY_AAPTR(self, ptr); @@ -7206,9 +6750,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckProximity) PARAM_STATE(jump); PARAM_CLASS(classname, AActor); PARAM_FLOAT(distance); - PARAM_INT_OPT(count) { count = 1; } - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_INT_DEF(count); + PARAM_INT_DEF(flags); + PARAM_INT_DEF(ptr); if (!jump) { @@ -7250,12 +6794,12 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckBlock) { PARAM_SELF_PROLOGUE(AActor); PARAM_STATE(block) - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } - PARAM_FLOAT_OPT(xofs) { xofs = 0; } - PARAM_FLOAT_OPT(yofs) { yofs = 0; } - PARAM_FLOAT_OPT(zofs) { zofs = 0; } - PARAM_ANGLE_OPT(angle) { angle = 0.; } + PARAM_INT_DEF(flags) + PARAM_INT_DEF(ptr) + PARAM_FLOAT_DEF(xofs) + PARAM_FLOAT_DEF(yofs) + PARAM_FLOAT_DEF(zofs) + PARAM_ANGLE_DEF(angle) AActor *mobj = COPY_AAPTR(self, ptr); @@ -7360,11 +6904,11 @@ enum FMDFlags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMovementDirection) { PARAM_SELF_PROLOGUE(AActor); - PARAM_ANGLE_OPT(offset) { offset = 0.; } - PARAM_ANGLE_OPT(anglelimit) { anglelimit = 0.; } - PARAM_ANGLE_OPT(pitchlimit) { pitchlimit = 0.; } - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_ANGLE_DEF(offset) + PARAM_ANGLE_DEF(anglelimit) + PARAM_ANGLE_DEF(pitchlimit) + PARAM_INT_DEF(flags) + PARAM_INT_DEF(ptr) AActor *mobj = COPY_AAPTR(self, ptr); @@ -7456,7 +7000,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CopySpriteFrame) PARAM_SELF_PROLOGUE(AActor); PARAM_INT(from); PARAM_INT(to); - PARAM_INT_OPT(flags) { flags = 0; } + PARAM_INT_DEF(flags); AActor *copyfrom = COPY_AAPTR(self, from); AActor *copyto = COPY_AAPTR(self, to); @@ -7481,8 +7025,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CopySpriteFrame) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpriteAngle) { PARAM_SELF_PROLOGUE(AActor); - PARAM_FLOAT_OPT(angle) { angle = 0.; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_FLOAT_DEF(angle); + PARAM_INT_DEF(ptr); AActor *mobj = COPY_AAPTR(self, ptr); @@ -7535,12 +7079,12 @@ enum VRFFlags DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetVisibleRotation) { PARAM_SELF_PROLOGUE(AActor); - PARAM_ANGLE_OPT(anglestart) { anglestart = 0.; } - PARAM_ANGLE_OPT(angleend) { angleend = 0.; } - PARAM_ANGLE_OPT(pitchstart) { pitchstart = 0.; } - PARAM_ANGLE_OPT(pitchend) { pitchend = 0.; } - PARAM_INT_OPT(flags) { flags = 0; } - PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } + PARAM_ANGLE_DEF(anglestart) + PARAM_ANGLE_DEF(angleend) + PARAM_ANGLE_DEF(pitchstart) + PARAM_ANGLE_DEF(pitchend) + PARAM_INT_DEF(flags) + PARAM_INT_DEF(ptr) AActor *mobj = COPY_AAPTR(self, ptr); diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index a3d4d0e9eb..04372f0eda 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -386,6 +386,14 @@ bool AActor::FixMapthingPos() return success; } +DEFINE_ACTION_FUNCTION(AActor, UnlinkFromWorld) +{ + PARAM_SELF_PROLOGUE(AActor); + self->UnlinkFromWorld(); + return 0; +} + + //========================================================================== // // P_SetThingPosition @@ -508,6 +516,13 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector) if (!spawningmapthing) UpdateRenderSectorList(); } +DEFINE_ACTION_FUNCTION(AActor, LinkToWorld) +{ + PARAM_SELF_PROLOGUE(AActor); + self->LinkToWorld(); + return 0; +} + void AActor::SetOrigin(double x, double y, double z, bool moving) { UnlinkFromWorld (); diff --git a/src/scripting/codegeneration/codegen.cpp b/src/scripting/codegeneration/codegen.cpp index d4ee113836..5148952a74 100644 --- a/src/scripting/codegeneration/codegen.cpp +++ b/src/scripting/codegeneration/codegen.cpp @@ -539,12 +539,13 @@ ExpEmit FxBoolCast::Emit(VMFunctionBuilder *build) // //========================================================================== -FxIntCast::FxIntCast(FxExpression *x, bool nowarn) +FxIntCast::FxIntCast(FxExpression *x, bool nowarn, bool explicitly) : FxExpression(EFX_IntCast, x->ScriptPosition) { basex=x; ValueType = TypeSInt32; NoWarn = nowarn; + Explicit = explicitly; } //========================================================================== @@ -571,9 +572,10 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx) if (basex->ValueType->GetRegType() == REGT_INT) { - if (basex->ValueType != TypeName) + if (basex->ValueType != TypeName || Explicit) // names can be converted to int, but only with an explicit type cast. { FxExpression *x = basex; + x->ValueType = ValueType; basex = NULL; delete this; return x; @@ -582,7 +584,8 @@ FxExpression *FxIntCast::Resolve(FCompileContext &ctx) { // Ugh. This should abort, but too many mods fell into this logic hole somewhere, so this seroious error needs to be reduced to a warning. :( // At least in ZScript, MSG_OPTERROR always means to report an error, not a warning so the problem only exists in DECORATE. - if (!basex->isConstant()) ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got a name"); + if (!basex->isConstant()) + ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got a name"); else ScriptPosition.Message(MSG_OPTERROR, "Numeric type expected, got \"%s\"", static_cast(basex)->GetValue().GetName().GetChars()); FxExpression * x = new FxConstant(0, ScriptPosition); delete this; @@ -1062,11 +1065,13 @@ ExpEmit FxSoundCast::Emit(VMFunctionBuilder *build) // //========================================================================== -FxTypeCast::FxTypeCast(FxExpression *x, PType *type, bool nowarn) +FxTypeCast::FxTypeCast(FxExpression *x, PType *type, bool nowarn, bool explicitly) : FxExpression(EFX_TypeCast, x->ScriptPosition) { basex = x; ValueType = type; + NoWarn = nowarn; + Explicit = explicitly; assert(ValueType != nullptr); } @@ -1126,7 +1131,7 @@ FxExpression *FxTypeCast::Resolve(FCompileContext &ctx) else if (ValueType->IsA(RUNTIME_CLASS(PInt))) { // This is only for casting to actual ints. Subtypes representing an int will be handled elsewhere. - FxExpression *x = new FxIntCast(basex, NoWarn); + FxExpression *x = new FxIntCast(basex, NoWarn, Explicit); x = x->Resolve(ctx); basex = nullptr; delete this; @@ -4964,12 +4969,31 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx) return x->Resolve(ctx); } - // Last but not least: Check builtins. The random functions can take a named RNG if specified. + // Last but not least: Check builtins and type casts. The random functions can take a named RNG if specified. // Note that for all builtins the used arguments have to be nulled in the ArgList so that they won't get deleted before they get used. FxExpression *func = nullptr; switch (MethodName) { + case NAME_Int: + case NAME_uInt: + case NAME_Double: + case NAME_Name: + case NAME_Color: + case NAME_Sound: + if (CheckArgSize(MethodName, ArgList, 1, 1, ScriptPosition)) + { + PType *type = MethodName == NAME_Int ? TypeSInt32 : + MethodName == NAME_uInt ? TypeUInt32 : + MethodName == NAME_Double ? TypeFloat64 : + MethodName == NAME_Name ? TypeName : + MethodName == NAME_Color ? TypeColor : (PType*)TypeSound; + + func = new FxTypeCast((*ArgList)[0], type, true, true); + (*ArgList)[0] = nullptr; + } + break; + case NAME_Random: if (CheckArgSize(NAME_Random, ArgList, 2, 2, ScriptPosition)) { @@ -5044,6 +5068,7 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx) break; default: + // todo: Check for class type casts break; } if (func != nullptr) @@ -5216,8 +5241,11 @@ FxExpression *FxActionSpecialCall::Resolve(FCompileContext& ctx) for (unsigned i = 0; i < ArgList->Size(); i++) { (*ArgList)[i] = (*ArgList)[i]->Resolve(ctx); - if ((*ArgList)[i] == NULL) failed = true; - if (Special < 0 && i == 0) + if ((*ArgList)[i] == NULL) + { + failed = true; + } + else if (Special < 0 && i == 0) { if ((*ArgList)[i]->ValueType != TypeName) { @@ -5409,10 +5437,16 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) return nullptr; } - if (ArgList != NULL) + if (ArgList != nullptr) { bool foundvarargs = false; PType * type = nullptr; + if (ArgList->Size() + implicit > proto->ArgumentTypes.Size()) + { + ScriptPosition.Message(MSG_ERROR, "Too many arguments in call to %s", Function->SymbolName.GetChars()); + delete this; + return nullptr; + } for (unsigned i = 0; i < ArgList->Size(); i++) { // Varargs must all have the same type as the last typed argument. A_Jump is the only function using it. @@ -5476,24 +5510,23 @@ ExpEmit FxVMFunctionCall::Emit(VMFunctionBuilder *build) assert(selfemit.RegType == REGT_POINTER); build->Emit(OP_PARAM, 0, selfemit.RegType, selfemit.RegNum); count += 1; - } - if (Function->Variants[0].Flags & VARF_Action) - { - static_assert(NAP == 3, "This code needs to be updated if NAP changes"); - if (build->IsActionFunc) + if (Function->Variants[0].Flags & VARF_Action) { - build->Emit(OP_PARAM, 0, REGT_POINTER, 1); - build->Emit(OP_PARAM, 0, REGT_POINTER, 2); + static_assert(NAP == 3, "This code needs to be updated if NAP changes"); + if (build->IsActionFunc && selfemit.RegNum == 0) // only pass this function's stateowner and stateinfo if the subfunction is run in self's context. + { + build->Emit(OP_PARAM, 0, REGT_POINTER, 1); + build->Emit(OP_PARAM, 0, REGT_POINTER, 2); + } + else + { + // pass self as stateowner, otherwise all attempts of the subfunction to retrieve a state from a name would fail. + build->Emit(OP_PARAM, 0, selfemit.RegType, selfemit.RegNum); + build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, build->GetConstantAddress(nullptr, ATAG_GENERIC)); + } + count += 2; } - else - { - int null = build->GetConstantAddress(nullptr, ATAG_GENERIC); - build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, null); - build->Emit(OP_PARAM, 0, REGT_POINTER | REGT_KONST, null); - } - count += 2; } - // Emit code to pass explicit parameters if (ArgList != NULL) { diff --git a/src/scripting/codegeneration/codegen.h b/src/scripting/codegeneration/codegen.h index a55491a0b8..cd93b8894b 100644 --- a/src/scripting/codegeneration/codegen.h +++ b/src/scripting/codegeneration/codegen.h @@ -474,10 +474,11 @@ class FxIntCast : public FxExpression { FxExpression *basex; bool NoWarn; + bool Explicit; public: - FxIntCast(FxExpression *x, bool nowarn); + FxIntCast(FxExpression *x, bool nowarn, bool explicitly = false); ~FxIntCast(); FxExpression *Resolve(FCompileContext&); @@ -559,10 +560,11 @@ class FxTypeCast : public FxExpression { FxExpression *basex; bool NoWarn; + bool Explicit; public: - FxTypeCast(FxExpression *x, PType *type, bool nowarn); + FxTypeCast(FxExpression *x, PType *type, bool nowarn, bool explicitly = false); ~FxTypeCast(); FxExpression *Resolve(FCompileContext&); diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index e04935f586..55cc03c0c8 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -67,8 +67,8 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF, SPECIAL, APlayerPawn, flags), DEFINE_FLAG(MF, SOLID, AActor, flags), DEFINE_FLAG(MF, SHOOTABLE, AActor, flags), - DEFINE_READONLY_FLAG(MF, NOSECTOR, AActor, flags), - DEFINE_READONLY_FLAG(MF, NOBLOCKMAP, AActor, flags), + DEFINE_FLAG(MF, NOSECTOR, AActor, flags), + DEFINE_FLAG(MF, NOBLOCKMAP, AActor, flags), DEFINE_FLAG(MF, AMBUSH, AActor, flags), DEFINE_FLAG(MF, JUSTHIT, AActor, flags), DEFINE_FLAG(MF, JUSTATTACKED, AActor, flags), @@ -84,8 +84,8 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF, NOBLOOD, AActor, flags), DEFINE_FLAG(MF, CORPSE, AActor, flags), DEFINE_FLAG(MF, INFLOAT, AActor, flags), - DEFINE_READONLY_FLAG(MF, COUNTKILL, AActor, flags), - DEFINE_READONLY_FLAG(MF, COUNTITEM, AActor, flags), + DEFINE_FLAG(MF, COUNTKILL, AActor, flags), + DEFINE_FLAG(MF, COUNTITEM, AActor, flags), DEFINE_FLAG(MF, SKULLFLY, AActor, flags), DEFINE_FLAG(MF, NOTDMATCH, AActor, flags), DEFINE_FLAG(MF, SPAWNSOUNDSOURCE, AActor, flags), @@ -186,7 +186,7 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF5, GETOWNER, AActor, flags5), DEFINE_FLAG(MF5, NODROPOFF, AActor, flags5), DEFINE_FLAG(MF5, NOFORWARDFALL, AActor, flags5), - DEFINE_READONLY_FLAG(MF5, COUNTSECRET, AActor, flags5), + DEFINE_FLAG(MF5, COUNTSECRET, AActor, flags5), DEFINE_FLAG(MF5, NODAMAGE, AActor, flags5), DEFINE_FLAG(MF5, BLOODSPLATTER, AActor, flags5), DEFINE_FLAG(MF5, OLDRADIUSDMG, AActor, flags5), @@ -677,10 +677,20 @@ void InitThingdef() symt.AddSymbol(new PField(NAME_ReactionTime, TypeSInt32, VARF_Native, myoffsetof(AActor, reactiontime))); symt.AddSymbol(new PField(NAME_MeleeRange, TypeFloat64, VARF_Native, myoffsetof(AActor, meleerange))); symt.AddSymbol(new PField(NAME_Speed, TypeFloat64, VARF_Native, myoffsetof(AActor, Speed))); - symt.AddSymbol(new PField(NAME_Threshold, TypeSInt32, VARF_Native|VARF_ReadOnly, myoffsetof(AActor, threshold))); + symt.AddSymbol(new PField("FloatSpeed", TypeFloat64, VARF_Native, myoffsetof(AActor, FloatSpeed))); + symt.AddSymbol(new PField("PainThreshold", TypeSInt32, VARF_Native, myoffsetof(AActor, PainThreshold))); + symt.AddSymbol(new PField("spriteAngle", TypeFloat64, VARF_Native, myoffsetof(AActor, SpriteAngle))); + symt.AddSymbol(new PField("spriteRotation", TypeFloat64, VARF_Native, myoffsetof(AActor, SpriteRotation))); + symt.AddSymbol(new PField(NAME_Threshold, TypeSInt32, VARF_Native, myoffsetof(AActor, threshold))); symt.AddSymbol(new PField(NAME_DefThreshold, TypeSInt32, VARF_Native|VARF_ReadOnly, myoffsetof(AActor, DefThreshold))); 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("Gravity", TypeFloat64, VARF_Native, myoffsetof(AActor, Gravity))); + 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("RipperLevel", TypeSInt32, VARF_Native, myoffsetof(AActor, RipperLevel))); + symt.AddSymbol(new PField("RipLevelMin", TypeSInt32, VARF_Native, myoffsetof(AActor, RipLevelMin))); + symt.AddSymbol(new PField("RipLevelMax", TypeSInt32, VARF_Native, myoffsetof(AActor, RipLevelMax))); symt.AddSymbol(new PField(NAME_VisibleStartAngle, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleStartAngle))); symt.AddSymbol(new PField(NAME_VisibleStartPitch, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleStartPitch))); symt.AddSymbol(new PField(NAME_VisibleEndAngle, TypeFloat64, VARF_Native, myoffsetof(AActor, VisibleEndAngle))); @@ -693,6 +703,8 @@ void InitThingdef() symt.AddSymbol(new PField(NAME_Target, TypeActor, VARF_Native, myoffsetof(AActor, target))); symt.AddSymbol(new PField(NAME_Master, TypeActor, VARF_Native, myoffsetof(AActor, master))); symt.AddSymbol(new PField(NAME_Tracer, TypeActor, VARF_Native, myoffsetof(AActor, tracer))); + symt.AddSymbol(new PField("LastHeard", TypeActor, VARF_Native, myoffsetof(AActor, LastHeard))); + symt.AddSymbol(new PField("LastEnemy", TypeActor, VARF_Native, myoffsetof(AActor, lastenemy))); // synthesize a symbol for each flag. The bounce flags are excluded on purpose. for (size_t i = 0; i < countof(ActorFlagDefs); i++) diff --git a/src/scripting/vm/vm.h b/src/scripting/vm/vm.h index c6ff99d480..ae936b844e 100644 --- a/src/scripting/vm/vm.h +++ b/src/scripting/vm/vm.h @@ -925,7 +925,7 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction // PARAM_INT_OPT(0,myint) { myint = 55; } // Just make sure to fill it in when using these macros, because the compiler isn't likely // to give useful error messages if you don't. -#define PARAM_EXISTS ((p) < numparam && param[p].Type != REGT_NIL) +#define PARAM_EXISTS(p) ((p) < numparam && param[p].Type != REGT_NIL) #define ASSERTINT(p) assert((p).Type == REGT_INT) #define ASSERTFLOAT(p) assert((p).Type == REGT_FLOAT) #define ASSERTSTRING(p) assert((p).Type == REGT_STRING) @@ -933,7 +933,18 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction #define ASSERTPOINTER(p) assert((p).Type == REGT_POINTER && (p).atag == ATAG_GENERIC) #define ASSERTSTATE(p) assert((p).Type == REGT_POINTER && ((p).atag == ATAG_GENERIC || (p).atag == ATAG_STATE)) -#define PARAM_INT_DEF_AT(p,x) int x; if (PARAM_EXISTS) { ASSERTINT(param[p]); x = param[p].i; } else { ASSERTINT(defaultparam[p]); x = defaultparam[p].i; } +#define PARAM_INT_DEF_AT(p,x) int x; if (PARAM_EXISTS(p)) { ASSERTINT(param[p]); x = param[p].i; } else { ASSERTINT(defaultparam[p]); x = defaultparam[p].i; } +#define PARAM_BOOL_DEF_AT(p,x) bool x; if (PARAM_EXISTS(p)) { ASSERTINT(param[p]); x = !!param[p].i; } else { ASSERTINT(defaultparam[p]); x = !!defaultparam[p].i; } +#define PARAM_NAME_DEF_AT(p,x) FName x; if (PARAM_EXISTS(p)) { ASSERTINT(param[p]); x = ENamedName(param[p].i); } else { ASSERTINT(defaultparam[p]); x = ENamedName(defaultparam[p].i); } +#define PARAM_SOUND_DEF_AT(p,x) FSoundID x; if (PARAM_EXISTS(p)) { ASSERTINT(param[p]); x = FSoundID(param[p].i); } else { ASSERTINT(defaultparam[p]); x = FSoundID(defaultparam[p].i); } +#define PARAM_COLOR_DEF_AT(p,x) PalEntry x; if (PARAM_EXISTS(p)) { ASSERTINT(param[p]); x = param[p].i; } else { ASSERTINT(defaultparam[p]); x = defaultparam[p].i; } +#define PARAM_FLOAT_DEF_AT(p,x) double x; if (PARAM_EXISTS(p)) { ASSERTFLOAT(param[p]); x = param[p].f; } else { ASSERTFLOAT(defaultparam[p]); x = defaultparam[p].f; } +#define PARAM_ANGLE_DEF_AT(p,x) DAngle x; if (PARAM_EXISTS(p)) { ASSERTFLOAT(param[p]); x = param[p].f; } else { ASSERTFLOAT(defaultparam[p]); x = defaultparam[p].f; } +#define PARAM_STRING_DEF_AT(p,x) FString x; if (PARAM_EXISTS(p)) { ASSERTSTRING(param[p]); x = param[p].s; } else { ASSERTSTRING(defaultparam[p]); x = defaultparam[p].s; } +#define PARAM_STATE_DEF_AT(p,x) FState *x; if (PARAM_EXISTS(p)) { ASSERTSTATE(param[p]); x = (FState*)param[p].a; } else { ASSERTSTATE(defaultparam[p]); x = (FState*)defaultparam[p].a; } +#define PARAM_POINTER_DEF_AT(p,x,t) t *x; if (PARAM_EXISTS(p)) { ASSERTPOINTER(param[p]); x = (t*)param[p].a; } else { ASSERTPOINTER(defaultparam[p]); x = (t*)defaultparam[p].a; } +#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 @@ -1048,6 +1059,24 @@ struct AFuncDesc #define ACTION_CALL_FROM_PSPRITE() (self->player && stateinfo != nullptr && stateinfo->mStateType == STATE_Psprite) #define ACTION_CALL_FROM_INVENTORY() (stateinfo != nullptr && stateinfo->mStateType == STATE_StateChain) +// Standard parameters for all action functons +// self - Actor this action is to operate on (player if a weapon) +// stateowner - Actor this action really belongs to (may be an item) +// callingstate - State this action was called from +#define PARAM_ACTION_PROLOGUE(type) \ + PARAM_PROLOGUE; \ + PARAM_OBJECT (self, type); \ + PARAM_OBJECT_OPT (stateowner, AActor) { stateowner = self; } \ + PARAM_STATEINFO_OPT (stateinfo) { stateinfo = nullptr; } \ + +// Number of action paramaters +#define NAP 3 + +#define PARAM_SELF_PROLOGUE(type) \ + PARAM_PROLOGUE; \ + PARAM_OBJECT(self, type); + + class PFunction; PFunction *FindGlobalActionFunction(const char *name); diff --git a/src/scripting/vm/vmexec.h b/src/scripting/vm/vmexec.h index a5ad3ac007..4fbe29257d 100644 --- a/src/scripting/vm/vmexec.h +++ b/src/scripting/vm/vmexec.h @@ -175,13 +175,13 @@ begin: OP(LO): ASSERTA(a); ASSERTA(B); ASSERTKD(C); GETADDR(PB,KC,X_READ_NIL); - reg.a[a] = *(void **)ptr; + reg.a[a] = GC::ReadBarrier(*(DObject **)ptr); reg.atag[a] = ATAG_OBJECT; NEXTOP; OP(LO_R): ASSERTA(a); ASSERTA(B); ASSERTD(C); GETADDR(PB,RC,X_READ_NIL); - reg.a[a] = *(void **)ptr; + reg.a[a] = GC::ReadBarrier(*(DObject **)ptr); reg.atag[a] = ATAG_OBJECT; NEXTOP; OP(LP): diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 3a1e734a4f..370e659193 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -2102,12 +2102,14 @@ void ZCCCompiler::InitFunctions() // TBD: disallow certain types? For now, let everything pass that isn't an array. args.Push(type); argflags.Push(flags); + argnames.Push(p->Name); } else { args.Push(nullptr); argflags.Push(0); + argnames.Push(NAME_None); } argdefaults.Push(vmval); p = static_cast(p->SiblingNext); @@ -2120,7 +2122,7 @@ void ZCCCompiler::InitFunctions() if (!(f->Flags & ZCC_Native)) { - auto code = ConvertAST(f->Body); + auto code = ConvertAST(c->Type(), f->Body); if (code != nullptr) { sym->Variants[0].Implementation = FunctionBuildList.AddFunction(sym, code, FStringf("%s.%s", c->Type()->TypeName.GetChars(), FName(f->Name).GetChars()), false); @@ -2157,7 +2159,7 @@ static bool CheckRandom(ZCC_Expression *duration) // Sets up the action function call // //========================================================================== -FxExpression *ZCCCompiler::SetupActionFunction(PClassActor *cls, ZCC_TreeNode *af) +FxExpression *ZCCCompiler::SetupActionFunction(PClass *cls, ZCC_TreeNode *af) { // We have 3 cases to consider here: // 1. An action function without parameters. This can be called directly @@ -2197,8 +2199,7 @@ FxExpression *ZCCCompiler::SetupActionFunction(PClassActor *cls, ZCC_TreeNode *a } } } - ConvertClass = cls; - return ConvertAST(af); + return ConvertAST(cls, af); } //========================================================================== @@ -2419,8 +2420,9 @@ void ZCCCompiler::CompileStates() // //========================================================================== -FxExpression *ZCCCompiler::ConvertAST(ZCC_TreeNode *ast) +FxExpression *ZCCCompiler::ConvertAST(PClass *cls, ZCC_TreeNode *ast) { + ConvertClass = cls; // there are two possibilities here: either a single function call or a compound statement. For a compound statement we also need to check if the last thing added was a return. if (ast->NodeType == AST_ExprFuncCall) { @@ -2680,6 +2682,9 @@ FxExpression *ZCCCompiler::ConvertNode(ZCC_TreeNode *ast) case PEX_LTGTEQ: return new FxLtGtEq(left, right); + case PEX_ArrayAccess: + return new FxArrayElement(left, right); + // todo: These do not have representations in DECORATE and no implementation exists yet. case PEX_Concat: case PEX_Is: diff --git a/src/scripting/zscript/zcc_compile.h b/src/scripting/zscript/zcc_compile.h index cf27758349..4ad72769a4 100644 --- a/src/scripting/zscript/zcc_compile.h +++ b/src/scripting/zscript/zcc_compile.h @@ -109,7 +109,7 @@ private: void InitFunctions(); void CompileStates(); - FxExpression *SetupActionFunction(PClassActor *cls, ZCC_TreeNode *sl); + FxExpression *SetupActionFunction(PClass *cls, ZCC_TreeNode *sl); bool SimplifyingConstant; TArray Constants; @@ -140,7 +140,7 @@ private: void Error(ZCC_TreeNode *node, const char *msg, ...); void MessageV(ZCC_TreeNode *node, const char *txtcolor, const char *msg, va_list argptr); - FxExpression *ConvertAST(ZCC_TreeNode *ast); + FxExpression *ConvertAST(PClass *cclass, ZCC_TreeNode *ast); FxExpression *ConvertNode(ZCC_TreeNode *node); FArgumentList *ConvertNodeList(ZCC_TreeNode *head); diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 706acaee78..4f859d3b0f 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -47,6 +47,13 @@ class Actor : Thinker native } // Functions + + bool IsPointerEqual(int ptr_select1, int ptr_select2) + { + return GetPointer(ptr_select1) == GetPointer(ptr_select2); + } + + native Actor GetPointer(int aaptr); native Actor SpawnMissile(Actor dest, class type, Actor owner = null); native void TraceBleed(int damage, Actor missile); native bool CheckMeleeRange(); @@ -56,11 +63,11 @@ class Actor : Thinker native native bool CheckSight(Actor target, int flags = 0); native bool HitFriend(); native bool SetState(state st, bool nofunction = false); + native void LinkToWorld(); + native void UnlinkFromWorld(); - // DECORATE compatible functions native bool CheckClass(class checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false); - native bool IsPointerEqual(int ptr_select1, int ptr_select2); native int CountInv(class itemtype, int ptr_select = AAPTR_DEFAULT); native float GetDistance(bool checkz, int ptr = AAPTR_DEFAULT); native float GetAngle(int flags, int ptr = AAPTR_DEFAULT); @@ -78,9 +85,89 @@ class Actor : Thinker native action native float OverlayX(int layer = 0); action native float OverlayY(int layer = 0); + // DECORATE setters - it probably makes more sense to set these values directly now... + void A_SetMass(int newmass) { mass = newmass; } + void A_SetGravity(float newgravity) { gravity = clamp(newgravity, 0., 10.); } + 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_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; } + + void A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false) + { + 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. + } + } + void A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT) + { + Actor aptr = GetPointer(ptr); + if (aptr) aptr.Speed = speed; + } + void A_SetFloatSpeed(float speed, int ptr = AAPTR_DEFAULT) + { + 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; + } + bool A_SetSpriteAngle(float angle = 0, int ptr = AAPTR_DEFAULT) + { + Actor aptr = GetPointer(ptr); + if (!aptr) return false; + aptr.SpriteAngle = angle; + return true; + } + bool A_SetSpriteRotation(float angle = 0, int ptr = AAPTR_DEFAULT) + { + Actor aptr = GetPointer(ptr); + if (!aptr) return false; + aptr.SpriteRotation = angle; + return true; + } + + deprecated void A_FaceConsolePlayer(float MaxTurnAngle = 0) {} + + 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(); + } + // Action functions // Meh, MBF redundant functions. Only for DeHackEd support. - native void A_Turn(float angle = 0); native bool A_LineEffect(int boomspecial = 0, int tag = 0); // End of MBF redundant functions. @@ -121,9 +208,9 @@ class Actor : Thinker native native void A_BrainScream(); native void A_BrainDie(); native void A_BrainAwake(); - native void A_BrainSpit(class spawntype = "none"); // needs special treatment for default + native void A_BrainSpit(class spawntype = null); // needs special treatment for default native void A_SpawnSound(); - native void A_SpawnFly(class spawntype = "none"); // needs special treatment for default + native void A_SpawnFly(class spawntype = null); // needs special treatment for default native void A_BrainExplode(); native void A_Die(name damagetype = "none"); native void A_Detonate(); @@ -145,12 +232,8 @@ class Actor : Thinker native native void A_NoGravity(); native void A_Gravity(); native void A_LowGravity(); - native void A_SetGravity(float gravity); + native void A_Fall(); - native void A_SetSolid(); - native void A_UnsetSolid(); - native void A_SetFloat(); - native void A_UnsetFloat(); native void A_M_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class pufftype = "BulletPuff"); @@ -186,7 +269,6 @@ class Actor : Thinker native native void A_ClearSoundTarget(); native void A_FireAssaultGun(); native void A_CheckTerrain(); - native void A_FaceConsolePlayer(float MaxTurnAngle = 0); // [TP] no-op deprecated native void A_MissileAttack(); deprecated native void A_MeleeAttack(); @@ -194,7 +276,7 @@ class Actor : Thinker native deprecated native void A_BulletAttack(); native void A_WolfAttack(int flags = 0, sound whattoplay = "weapons/pistol", float snipe = 1.0, int maxdamage = 64, int blocksize = 128, int pointblank = 2, int longrange = 4, float runspeed = 160.0, class pufftype = "BulletPuff"); native void A_PlaySound(sound whattoplay = "weapons/pistol", int slot = CHAN_BODY, float volume = 1.0, bool looping = false, float attenuation = ATTN_NORM); - native void A_PlayWeaponSound(sound whattoplay); + deprecated void A_PlayWeaponSound(sound whattoplay) { A_PlaySound(whattoplay, CHAN_WEAPON); } native void A_FLoopActiveSound(); native void A_LoopActiveSound(); native void A_StopSound(int slot = CHAN_VOICE); // Bad default but that's what is originally was... @@ -204,7 +286,7 @@ class Actor : Thinker native native state A_Jump(int chance = 256, state label, ...); native void A_CustomMissile(class missiletype, float spawnheight = 32, float spawnofs_xy = 0, float angle = 0, int flags = 0, float pitch = 0, int ptr = AAPTR_TARGET); native void A_CustomBulletAttack(float spread_xy, float spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", float range = 0, int flags = 0, int ptr = AAPTR_TARGET, class missile = null, float Spawnheight = 32, float Spawnofs_xy = 0); - native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = 0, color color2 = 0, int flags = 0, int aim = 0, float maxdiff = 0, class pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = "none", float spawnofs_z = 0, int spiraloffset = 270, int limit = 0); + native void A_CustomRailgun(int damage, int spawnofs_xy = 0, color color1 = 0, color color2 = 0, int flags = 0, int aim = 0, float maxdiff = 0, class pufftype = "BulletPuff", float spread_xy = 0, float spread_z = 0, float range = 0, int duration = 0, float sparsity = 1.0, float driftspeed = 1.0, class spawnclass = null, float spawnofs_z = 0, int spiraloffset = 270, int limit = 0); native state A_JumpIfHealthLower(int health, state label, int ptr_selector = AAPTR_DEFAULT); native state A_JumpIfCloser(float distance, state label, bool noz = false); native state A_JumpIfTracerCloser(float distance, state label, bool noz = false); @@ -213,6 +295,7 @@ class Actor : Thinker native native state A_JumpIfTargetInsideMeleeRange(state label); native state A_JumpIfInventory(class itemtype, int itemamount, state label, int owner = AAPTR_DEFAULT); native state A_JumpIfArmorType(name Type, state label, int amount = 1); + native bool A_SetInventory(class itemtype, int amount, int ptr = AAPTR_DEFAULT, bool beyondMax = false); native bool A_GiveInventory(class itemtype, int amount = 0, int giveto = AAPTR_DEFAULT); native bool A_TakeInventory(class itemtype, int amount = 0, int flags = 0, int giveto = AAPTR_DEFAULT); action native bool A_SpawnItem(class itemtype = "Unknown", float distance = 0, float zheight = 0, bool useammo = true, bool transfer_translation = false); @@ -227,8 +310,6 @@ class Actor : Thinker native native void A_FadeIn(float reduce = 0.1, int flags = 0); native void A_FadeOut(float reduce = 0.1, int flags = 1); //bool remove == true native void A_FadeTo(float target, float amount = 0.1, int flags = 0); - native void A_SetScale(float scalex, float scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false); - native void A_SetMass(int mass); native void A_SpawnDebris(class spawntype, bool transfer_translation = false, float mult_h = 1, float mult_v = 1); native void A_SpawnParticle(color color1, int flags = 0, int lifetime = 35, float size = 1, float angle = 0, float xoff = 0, float yoff = 0, float zoff = 0, float velx = 0, float vely = 0, float velz = 0, float accelx = 0, float accely = 0, float accelz = 0, float startalphaf = 1, float fadestepf = -1, float sizestep = 0); native state A_CheckSight(state label); @@ -238,7 +319,6 @@ class Actor : Thinker native deprecated native void A_ChangeFlag(string flagname, bool value); deprecated native state A_CheckFlag(string flagname, state label, int check_pointer = AAPTR_DEFAULT); native void A_ChangeCountFlags(int kill = FLAG_NO_CHANGE, int item = FLAG_NO_CHANGE, int secret = FLAG_NO_CHANGE); - native void A_ChangeLinkFlags(int blockmap = FLAG_NO_CHANGE, int sector = FLAG_NO_CHANGE); native state A_JumpIf(bool expression, state label); native void A_RaiseMaster(bool copy = 0); native void A_RaiseChildren(bool copy = 0); @@ -247,7 +327,7 @@ class Actor : Thinker native native state A_CheckCeiling(state label); native state A_PlayerSkinCheck(state label); deprecated native void A_BasicAttack(int meleedamage, sound meleesound, class missiletype, float missileheight); - native state, bool A_Teleport(state teleportstate = null, class targettype = "BossSpot", class fogtype = "TeleportFog", int flags = 0, float mindist = 0, float maxdist = 0, int ptr = AAPTR_DEFAULT); + native state, bool A_Teleport(state teleportstate = null, class targettype = "BossSpot", class fogtype = "TeleportFog", int flags = 0, float mindist = 0, float maxdist = 128, int ptr = AAPTR_DEFAULT); native state, bool A_Warp(int ptr_destination, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0, int flags = 0, state success_state = null, float heightoffset = 0, float radiusoffset = 0, float pitch = 0); action native bool A_ThrowGrenade(class itemtype, float zheight = 0, float xyvel = 0, float zvel = 0, bool useammo = true); native void A_Weave(int xspeed, int yspeed, float xdist, float ydist); @@ -256,7 +336,7 @@ class Actor : Thinker native native state A_JumpIfInTargetInventory(class itemtype, int amount, state label, int forward_ptr = AAPTR_DEFAULT); native bool A_GiveToTarget(class itemtype, int amount = 0, int forward_ptr = AAPTR_DEFAULT); native bool A_TakeFromTarget(class itemtype, int amount = 0, int flags = 0, int forward_ptr = AAPTR_DEFAULT); - native int A_RadiusGive(class itemtype, float distance, int flags, int amount = 0, class filter = "None", name species = "None", float mindist = 0, int limit = 0); + native int A_RadiusGive(class itemtype, float distance, int flags, int amount = 0, class filter = null, name species = "None", float mindist = 0, int limit = 0); native state A_CheckSpecies(state jump, name species = 'none', int ptr = AAPTR_DEFAULT); native void A_CountdownArg(int argnum, state targstate = null); native void A_CustomMeleeAttack(int damage = 0, sound meleesound = "", sound misssound = "", name damagetype = "none", bool bleed = true); @@ -264,7 +344,7 @@ class Actor : Thinker native native void A_Burst(class chunktype); action native void A_Blast(int flags = 0, float strength = 255, float radius = 255, float speed = 20, class blasteffect = "BlastEffect", sound blastsound = "BlastRadius"); native void A_RadiusThrust(int force = 128, int distance = -1, int flags = RTF_AFFECTSOURCE, int fullthrustdistance = 0); - native void A_RadiusDamageSelf(int damage = 128, float distance = 128, int flags = 0, class flashtype = "None"); + native void A_RadiusDamageSelf(int damage = 128, float distance = 128, int flags = 0, class flashtype = null); native int A_Explode(int damage = -1, int distance = -1, int flags = XF_HURTSOURCE, bool alert = false, int fulldamagedistance = 0, int nails = 0, int naildamage = 10, class pufftype = "BulletPuff", name damagetype = "none"); native void A_Stop(); native void A_Respawn(int flags = 1); @@ -273,7 +353,6 @@ class Actor : Thinker native native void A_DeQueueCorpse(); native void A_LookEx(int flags = 0, float minseedist = 0, float maxseedist = 0, float maxheardist = 0, float fov = 0, state label = null); native void A_ClearLastHeard(); - native void A_ClearTarget(); native state A_CheckLOF(state jump, int flags = 0, float range = 0, float minrange = 0, float angle = 0, float pitch = 0, float offsetheight = 0, float offsetwidth = 0, int ptr_target = AAPTR_DEFAULT, float offsetforward = 0); native state A_JumpIfTargetInLOS (state label, float fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); native state A_JumpIfInTargetLOS (state label, float fov = 0, int flags = 0, float dist_max = 0, float dist_close = 0); @@ -295,51 +374,41 @@ class Actor : Thinker native native void A_SetRoll(float roll, int flags = 0, int ptr = AAPTR_DEFAULT); native void A_ScaleVelocity(float scale, int ptr = AAPTR_DEFAULT); native void A_ChangeVelocity(float x = 0, float y = 0, float z = 0, int flags = 0, int ptr = AAPTR_DEFAULT); - native void A_SetArg(int pos, int value); deprecated native void A_SetUserVar(name varname, int value); deprecated native void A_SetUserArray(name varname, int index, int value); deprecated native void A_SetUserVarFloat(name varname, float value); deprecated native void A_SetUserArrayFloat(name varname, int index, float value); - native void A_SetSpecial(int spec, int arg0 = 0, int arg1 = 0, int arg2 = 0, int arg3 = 0, int arg4 = 0); native void A_Quake(int intensity, int duration, int damrad, int tremrad, sound sfx = "world/quake"); native void A_QuakeEx(int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, sound sfx = "world/quake", int flags = 0, float mulWaveX = 1, float mulWaveY = 1, float mulWaveZ = 1, int falloff = 0, int highpoint = 0, float rollIntensity = 0, float rollWave = 0); action native void A_SetTics(int tics); - native void A_SetDamageType(name damagetype); native void A_DropItem(class item, int dropamount = -1, int chance = 256); - native void A_SetSpeed(float speed, int ptr = AAPTR_DEFAULT); - native void A_SetFloatSpeed(float speed, int ptr = AAPTR_DEFAULT); - native void A_SetPainThreshold(int threshold, int ptr = AAPTR_DEFAULT); - native void A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_DamageTarget(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_DamageMaster(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_DamageTracer(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_DamageChildren(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_DamageSiblings(int amount, name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_KillTarget(name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_KillMaster(name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_KillTracer(name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_KillChildren(name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_KillSiblings(name damagetype = "none", int flags = 0, class filter = "None", name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); - native void A_RemoveTarget(int flags = 0, class filter = "None", name species = "None"); - native void A_RemoveMaster(int flags = 0, class filter = "None", name species = "None"); - native void A_RemoveTracer(int flags = 0, class filter = "None", name species = "None"); - native void A_RemoveChildren(bool removeall = false, int flags = 0, class filter = "None", name species = "None"); - native void A_RemoveSiblings(bool removeall = false, int flags = 0, class filter = "None", name species = "None"); - native void A_Remove(int removee, int flags = 0, class filter = "None", name species = "None"); + native void A_DamageSelf(int amount, name damagetype = "none", int flags = 0, class 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 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 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 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 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 filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); + native void A_KillTarget(name damagetype = "none", int flags = 0, class filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); + native void A_KillMaster(name damagetype = "none", int flags = 0, class filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); + native void A_KillTracer(name damagetype = "none", int flags = 0, class filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); + native void A_KillChildren(name damagetype = "none", int flags = 0, class filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); + native void A_KillSiblings(name damagetype = "none", int flags = 0, class filter = null, name species = "None", int src = AAPTR_DEFAULT, int inflict = AAPTR_DEFAULT); + native void A_RemoveTarget(int flags = 0, class filter = null, name species = "None"); + native void A_RemoveMaster(int flags = 0, class filter = null, name species = "None"); + native void A_RemoveTracer(int flags = 0, class filter = null, name species = "None"); + native void A_RemoveChildren(bool removeall = false, int flags = 0, class filter = null, name species = "None"); + native void A_RemoveSiblings(bool removeall = false, int flags = 0, class filter = null, name species = "None"); + native void A_Remove(int removee, int flags = 0, class filter = null, name species = "None"); native int A_GiveToChildren(class itemtype, int amount = 0); native int A_GiveToSiblings(class itemtype, int amount = 0); native int A_TakeFromChildren(class itemtype, int amount = 0); native int A_TakeFromSiblings(class itemtype, int amount = 0); native void A_SetTeleFog(class oldpos, class newpos); native void A_SwapTeleFog(); - native void A_SetFloatBobPhase(int bob); native void A_SetHealth(int health, int ptr = AAPTR_DEFAULT); native void A_ResetHealth(int ptr = AAPTR_DEFAULT); native state A_JumpIfHigherOrLower(state high, state low, float offsethigh = 0, float offsetlow = 0, bool includeHeight = true, int ptr = AAPTR_TARGET); native void A_SetSpecies(name species, int ptr = AAPTR_DEFAULT); - native void A_SetRipperLevel(int level); - native void A_SetRipMin(int mininum); - native void A_SetRipMax(int maximum); native void A_SetChaseThreshold(int threshold, bool def = false, int ptr = AAPTR_DEFAULT); native state A_CheckProximity(state jump, class classname, float distance, int count = 1, int flags = 0, int ptr = AAPTR_DEFAULT); native state A_CheckBlock(state block, int flags = 0, int ptr = AAPTR_DEFAULT, float xofs = 0, float yofs = 0, float zofs = 0, float angle = 0); @@ -348,8 +417,6 @@ class Actor : Thinker native native bool A_FaceMovementDirection(float offset = 0, float anglelimit = 0, float pitchlimit = 0, int flags = 0, int ptr = AAPTR_DEFAULT); native int A_ClearOverlays(int sstart = 0, int sstop = 0, bool safety = true); native bool A_CopySpriteFrame(int from, int to, int flags = 0); - native bool A_SetSpriteAngle(float angle = 0, int ptr = AAPTR_DEFAULT); - native bool A_SetSpriteRotation(float angle = 0, int ptr = AAPTR_DEFAULT); native bool A_SetVisibleRotation(float anglestart = 0, float angleend = 0, float pitchstart = 0, float pitchend = 0, int flags = 0, int ptr = AAPTR_DEFAULT); native void A_SetTranslation(string transname); @@ -362,13 +429,34 @@ class Actor : Thinker native action native void A_OverlayOffset(int layer = PSP_WEAPON, float wx = 0, float wy = 32, int flags = 0); action native void A_OverlayFlags(int layer, int flags, bool set); - native int ACS_NamedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); - native int ACS_NamedSuspend(name script, int mapnum=0); - native int ACS_NamedTerminate(name script, int mapnum=0); - native int ACS_NamedLockedExecute(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); - native int ACS_NamedLockedExecuteDoor(name script, int mapnum=0, int arg1=0, int arg2=0, int lock=0); - native int ACS_NamedExecuteWithResult(name script, int arg1=0, int arg2=0, int arg3=0, int arg4=0); - native void ACS_NamedExecuteAlways(name script, int mapnum=0, int arg1=0, int arg2=0, int arg3=0); + 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); + } + int ACS_NamedExecuteWithResult(name script, int arg1=0, int arg2=0, int arg3=0, int arg4=0) + { + 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); + } States { diff --git a/wadsrc/static/zscript/heretic/hereticweaps.txt b/wadsrc/static/zscript/heretic/hereticweaps.txt index 0c3123c7c6..ae5e971797 100644 --- a/wadsrc/static/zscript/heretic/hereticweaps.txt +++ b/wadsrc/static/zscript/heretic/hereticweaps.txt @@ -479,7 +479,7 @@ class Gauntlets : Weapon GAUN A 1 A_Raise; Loop; Fire: - GAUN B 4 A_PlayWeaponSound("weapons/gauntletsuse"); + GAUN B 4 A_PlaySound("weapons/gauntletsuse", CHAN_WEAPON); GAUN C 4; Hold: GAUN DEF 4 BRIGHT A_GauntletAttack(0); @@ -512,7 +512,7 @@ class GauntletsPowered : Gauntlets GAUN G 1 A_Raise; Loop; Fire: - GAUN J 4 A_PlayWeaponSound("weapons/gauntletsuse"); + GAUN J 4 A_PlaySound("weapons/gauntletsuse", CHAN_WEAPON); GAUN K 4; Hold: GAUN LMN 4 BRIGHT A_GauntletAttack(1); diff --git a/wadsrc/static/zscript/hexen/wraith.txt b/wadsrc/static/zscript/hexen/wraith.txt index 9d811ec5c7..86df72d94e 100644 --- a/wadsrc/static/zscript/hexen/wraith.txt +++ b/wadsrc/static/zscript/hexen/wraith.txt @@ -52,7 +52,7 @@ class Wraith : Actor Missile: WRTH E 6 A_FaceTarget; WRTH F 6; - WRTH G 6 A_CustomMissile("WraithFX1", 32, 0); + WRTH G 6 A_CustomMissile("WraithFX1"); Goto See; Death: WRTH I 4;