From a2f4cd7cdad9d850e02cdea65648d32440a562d4 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 13 Nov 2016 14:20:30 +0100 Subject: [PATCH] - fixed: All functions that are callable from weapon states and not members of Actor need to be declared 'action'. With the stricter type checks of the self pointer that were now implemented these all produced errors. --- src/g_doom/a_doomweaps.cpp | 39 --------------- src/g_heretic/a_chicken.cpp | 6 +-- src/g_heretic/a_hereticweaps.cpp | 30 ++++++------ src/g_hexen/a_clericflame.cpp | 2 +- src/g_hexen/a_clericholy.cpp | 4 +- src/g_hexen/a_clericmace.cpp | 2 +- src/g_hexen/a_clericstaff.cpp | 8 +-- src/g_hexen/a_fighteraxe.cpp | 19 +++---- src/g_hexen/a_fighterhammer.cpp | 4 +- src/g_hexen/a_fighterplayer.cpp | 2 +- src/g_hexen/a_fighterquietus.cpp | 2 +- src/g_hexen/a_magecone.cpp | 2 +- src/g_hexen/a_magelightning.cpp | 4 +- src/g_hexen/a_magestaff.cpp | 4 +- src/g_hexen/a_pig.cpp | 2 +- src/g_strife/a_strifeweapons.cpp | 44 ++++++++--------- src/p_actionfunctions.cpp | 4 +- src/p_pspr.cpp | 49 +++---------------- src/scripting/codegeneration/codegen.cpp | 20 +++++++- src/scripting/zscript/zcc_compile.cpp | 9 +++- wadsrc/static/zscript/actor.txt | 1 - wadsrc/static/zscript/heretic/chicken.txt | 6 +-- .../static/zscript/heretic/hereticweaps.txt | 30 ++++++------ wadsrc/static/zscript/hexen/clericflame.txt | 2 +- wadsrc/static/zscript/hexen/clericholy.txt | 4 +- wadsrc/static/zscript/hexen/clericmace.txt | 2 +- wadsrc/static/zscript/hexen/clericstaff.txt | 8 +-- wadsrc/static/zscript/hexen/fighteraxe.txt | 12 ++--- wadsrc/static/zscript/hexen/fighterfist.txt | 2 +- wadsrc/static/zscript/hexen/fighterhammer.txt | 4 +- .../static/zscript/hexen/fighterquietus.txt | 2 +- wadsrc/static/zscript/hexen/magecone.txt | 2 +- wadsrc/static/zscript/hexen/magelightning.txt | 4 +- wadsrc/static/zscript/hexen/magestaff.txt | 4 +- wadsrc/static/zscript/hexen/pig.txt | 2 +- wadsrc/static/zscript/shared/inventory.txt | 41 +++++++++------- wadsrc/static/zscript/strife/sigil.txt | 20 ++++---- .../static/zscript/strife/strifeweapons.txt | 20 ++++---- 38 files changed, 185 insertions(+), 237 deletions(-) diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 37ff05c70..bc962800f 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -336,29 +336,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun2) return 0; } -DEFINE_ACTION_FUNCTION(AActor, A_OpenShotgun2) -{ - PARAM_SELF_PROLOGUE(AActor); - S_Sound (self, CHAN_WEAPON, "weapons/sshoto", 1, ATTN_NORM); - return 0; -} - -DEFINE_ACTION_FUNCTION(AActor, A_LoadShotgun2) -{ - PARAM_SELF_PROLOGUE(AActor); - S_Sound (self, CHAN_WEAPON, "weapons/sshotl", 1, ATTN_NORM); - return 0; -} - -DEFINE_ACTION_FUNCTION(AActor, A_CloseShotgun2) -{ - PARAM_SELF_PROLOGUE(AActor); - S_Sound (self, CHAN_WEAPON, "weapons/sshotc", 1, ATTN_NORM); - A_ReFire (self); - return 0; -} - - //------------------------------------------------------------------------------------ // // Setting a random flash like some of Doom's weapons can easily crash when the @@ -593,12 +570,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireRailgunLeft) return 0; } -DEFINE_ACTION_FUNCTION(AActor, A_RailWait) -{ - // Okay, this was stupid. Just use a NULL function instead of this. - return 0; -} - // // A_FireBFG // @@ -717,16 +688,6 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray) return 0; } -// -// A_BFGsound -// -DEFINE_ACTION_FUNCTION(AActor, A_BFGsound) -{ - PARAM_SELF_PROLOGUE(AActor); - S_Sound (self, CHAN_WEAPON, "weapons/bfgf", 1, ATTN_NORM); - return 0; -} - // // A_FireOldBFG // diff --git a/src/g_heretic/a_chicken.cpp b/src/g_heretic/a_chicken.cpp index fa26f7315..8a109d46d 100644 --- a/src/g_heretic/a_chicken.cpp +++ b/src/g_heretic/a_chicken.cpp @@ -138,7 +138,7 @@ void P_UpdateBeak (AActor *self) DEFINE_ACTION_FUNCTION(AActor, A_BeakRaise) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; @@ -170,7 +170,7 @@ void P_PlayPeck (AActor *chicken) DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL1) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; int damage; @@ -205,7 +205,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL1) DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL2) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; int damage; diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 38991b87d..a888be884 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -61,7 +61,7 @@ extern bool P_AutoUseChaosDevice (player_t *player); DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StaffAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; DAngle slope; @@ -107,7 +107,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StaffAttack) DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL1) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; int damage; @@ -144,7 +144,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL1) DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL2) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); int i; DAngle angle; @@ -187,7 +187,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL2) DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL1) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; @@ -216,7 +216,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL1) DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL2) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; @@ -247,7 +247,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL2) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle Angle; int damage; @@ -421,7 +421,7 @@ void FireMacePL1B (AActor *actor) DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL1) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); AActor *ball; player_t *player; @@ -579,7 +579,7 @@ boom: DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL2) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); AActor *mo; player_t *player; @@ -761,7 +761,7 @@ int ARipper::DoSpecialDamage (AActor *target, int damage, FName damagetype) DEFINE_ACTION_FUNCTION(AActor, A_FireBlasterPL1) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; int damage; @@ -888,7 +888,7 @@ void ARainTracker::Serialize(FSerializer &arc) DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL1) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); AActor *mo; player_t *player; @@ -924,7 +924,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL1) DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL2) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; AActor *MissileActor; @@ -1217,7 +1217,7 @@ int APhoenixFX2::DoSpecialDamage (AActor *target, int damage, FName damagetype) DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL1) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; @@ -1270,7 +1270,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PhoenixPuff) DEFINE_ACTION_FUNCTION(AActor, A_InitPhoenixPL2) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self->player != NULL) { @@ -1293,7 +1293,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_InitPhoenixPL2) DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); AActor *mo; @@ -1346,7 +1346,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2) DEFINE_ACTION_FUNCTION(AActor, A_ShutdownPhoenixPL2) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; diff --git a/src/g_hexen/a_clericflame.cpp b/src/g_hexen/a_clericflame.cpp index f0e9c16b2..2c66cb42d 100644 --- a/src/g_hexen/a_clericflame.cpp +++ b/src/g_hexen/a_clericflame.cpp @@ -66,7 +66,7 @@ void ACFlameMissile::Effect () DEFINE_ACTION_FUNCTION(AActor, A_CFlameAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; diff --git a/src/g_hexen/a_clericholy.cpp b/src/g_hexen/a_clericholy.cpp index d09c3f6aa..362434b02 100644 --- a/src/g_hexen/a_clericholy.cpp +++ b/src/g_hexen/a_clericholy.cpp @@ -211,7 +211,7 @@ void SpawnSpiritTail (AActor *spirit) DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; FTranslatedLineTarget t; @@ -245,7 +245,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack) DEFINE_ACTION_FUNCTION(AActor, A_CHolyPalette) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self->player != NULL) { diff --git a/src/g_hexen/a_clericmace.cpp b/src/g_hexen/a_clericmace.cpp index 9b8148930..a15196cf8 100644 --- a/src/g_hexen/a_clericmace.cpp +++ b/src/g_hexen/a_clericmace.cpp @@ -15,7 +15,7 @@ static FRandom pr_maceatk ("CMaceAttack"); DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; int damage; diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index a4050a1ef..a838357d6 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -46,7 +46,7 @@ int ACStaffMissile::DoSpecialDamage (AActor *target, int damage, FName damagetyp DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); APlayerPawn *pmo; int damage; @@ -115,7 +115,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck) DEFINE_ACTION_FUNCTION(AActor, A_CStaffAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); AActor *mo; player_t *player; @@ -167,7 +167,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffMissileSlither) DEFINE_ACTION_FUNCTION(AActor, A_CStaffInitBlink) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); self->weaponspecial = (pr_blink()>>1)+20; return 0; @@ -181,7 +181,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffInitBlink) DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheckBlink) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self->player && self->player->ReadyWeapon) { diff --git a/src/g_hexen/a_fighteraxe.cpp b/src/g_hexen/a_fighteraxe.cpp index 4260f4eb4..1dc02d599 100644 --- a/src/g_hexen/a_fighteraxe.cpp +++ b/src/g_hexen/a_fighteraxe.cpp @@ -19,13 +19,6 @@ DECLARE_ACTION(A_Raise) static FRandom pr_axeatk ("FAxeAtk"); -void A_FAxeCheckReady (AActor *actor); -void A_FAxeCheckUp (AActor *actor); -void A_FAxeCheckAtk (AActor *actor); -void A_FAxeCheckReadyG (AActor *actor); -void A_FAxeCheckUpG (AActor *actor); -void A_FAxeAttack (AActor *actor); - // The Fighter's Axe -------------------------------------------------------- class AFWeapAxe : public AFighterWeapon @@ -68,7 +61,7 @@ FState *AFWeapAxe::GetAtkState (bool hold) DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReady) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; @@ -95,7 +88,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReady) DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReadyG) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; @@ -122,7 +115,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReadyG) DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUp) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; @@ -149,7 +142,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUp) DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUpG) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; @@ -176,7 +169,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUpG) DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckAtk) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; @@ -199,7 +192,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckAtk) DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; int power; diff --git a/src/g_hexen/a_fighterhammer.cpp b/src/g_hexen/a_fighterhammer.cpp index faa15d8af..84eca78b7 100644 --- a/src/g_hexen/a_fighterhammer.cpp +++ b/src/g_hexen/a_fighterhammer.cpp @@ -25,7 +25,7 @@ static FRandom pr_hammeratk ("FHammerAtk"); DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; int damage; @@ -95,7 +95,7 @@ hammerdone: DEFINE_ACTION_FUNCTION(AActor, A_FHammerThrow) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); AActor *mo; player_t *player; diff --git a/src/g_hexen/a_fighterplayer.cpp b/src/g_hexen/a_fighterplayer.cpp index ff4348520..7e1502a1c 100644 --- a/src/g_hexen/a_fighterplayer.cpp +++ b/src/g_hexen/a_fighterplayer.cpp @@ -99,7 +99,7 @@ static bool TryPunch(APlayerPawn *pmo, DAngle angle, int damage, int power) DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); int damage; int i; diff --git a/src/g_hexen/a_fighterquietus.cpp b/src/g_hexen/a_fighterquietus.cpp index c900794ed..8f73ef48e 100644 --- a/src/g_hexen/a_fighterquietus.cpp +++ b/src/g_hexen/a_fighterquietus.cpp @@ -78,7 +78,7 @@ int AFSwordMissile::DoSpecialDamage(AActor *victim, int damage, FName damagetype DEFINE_ACTION_FUNCTION(AActor, A_FSwordAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player; diff --git a/src/g_hexen/a_magecone.cpp b/src/g_hexen/a_magecone.cpp index f2b97fcd9..da53a829c 100644 --- a/src/g_hexen/a_magecone.cpp +++ b/src/g_hexen/a_magecone.cpp @@ -51,7 +51,7 @@ int AFrostMissile::DoSpecialDamage (AActor *victim, int damage, FName damagetype DEFINE_ACTION_FUNCTION(AActor, A_FireConePL1) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; int damage; diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index 7e11b64ed..b06d22ce5 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -126,7 +126,7 @@ int ALightningZap::SpecialMissileHit (AActor *thing) DEFINE_ACTION_FUNCTION(AActor, A_LightningReady) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DoReadyWeapon(self); if (pr_lightningready() < 160) @@ -257,7 +257,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MLightningAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); PARAM_CLASS_DEF(floor, AActor); PARAM_CLASS_DEF(ceiling, AActor); diff --git a/src/g_hexen/a_magestaff.cpp b/src/g_hexen/a_magestaff.cpp index acef2e5cd..0b78bd279 100644 --- a/src/g_hexen/a_magestaff.cpp +++ b/src/g_hexen/a_magestaff.cpp @@ -122,7 +122,7 @@ void MStaffSpawn (AActor *pmo, DAngle angle, AActor *alttarget) DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; player_t *player; @@ -167,7 +167,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack) DEFINE_ACTION_FUNCTION(AActor, A_MStaffPalette) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self->player != NULL) { diff --git a/src/g_hexen/a_pig.cpp b/src/g_hexen/a_pig.cpp index a0a0cc844..41054da00 100644 --- a/src/g_hexen/a_pig.cpp +++ b/src/g_hexen/a_pig.cpp @@ -58,7 +58,7 @@ void APigPlayer::MorphPlayerThink () DEFINE_ACTION_FUNCTION(AActor, A_SnoutAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; int damage; diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 3e9eb69b6..be8452046 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -94,7 +94,7 @@ void P_DaggerAlert (AActor *target, AActor *emitter) DEFINE_ACTION_FUNCTION(AActor, A_JabDagger) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DAngle angle; int damage; @@ -212,7 +212,7 @@ int APoisonBolt::DoSpecialDamage (AActor *target, int damage, FName damagetype) DEFINE_ACTION_FUNCTION(AActor, A_ClearFlash) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player = self->player; @@ -231,7 +231,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ClearFlash) DEFINE_ACTION_FUNCTION(AActor, A_ShowElectricFlash) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self->player != nullptr) { @@ -248,7 +248,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_ShowElectricFlash) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireArrow) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); PARAM_CLASS(ti, AActor); DAngle savedangle; @@ -307,7 +307,7 @@ void P_StrifeGunShot (AActor *mo, bool accurate, DAngle pitch) DEFINE_ACTION_FUNCTION(AActor, A_FireAssaultGun) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); bool accurate; @@ -343,7 +343,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireAssaultGun) DEFINE_ACTION_FUNCTION(AActor, A_FireMiniMissile) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player = self->player; DAngle savedangle; @@ -413,7 +413,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FlameDie) DEFINE_ACTION_FUNCTION(AActor, A_FireFlamer) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player = self->player; @@ -450,7 +450,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireFlamer) DEFINE_ACTION_FUNCTION(AActor, A_FireMauler1) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self->player != NULL) { @@ -494,7 +494,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMauler1) DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2Pre) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); S_Sound (self, CHAN_WEAPON, "weapons/mauler2charge", 1, ATTN_NORM); @@ -516,7 +516,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2Pre) DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self->player != NULL) { @@ -688,7 +688,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burnination) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireGrenade) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); PARAM_CLASS(grenadetype, AActor); PARAM_ANGLE(angleofs); PARAM_STATE(flash) @@ -821,7 +821,7 @@ AInventory *ASigil::CreateCopy (AActor *other) DEFINE_ACTION_FUNCTION(AActor, A_SelectPiece) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); int pieces = MIN (static_cast(self)->NumPieces, 5); @@ -847,7 +847,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SelectPiece) DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilView) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DPSprite *pspr; int pieces; @@ -874,7 +874,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilView) DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilDown) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DPSprite *pspr; int pieces; @@ -904,7 +904,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilDown) DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilAttack) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); DPSprite *pspr; int pieces; @@ -927,7 +927,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilAttack) DEFINE_ACTION_FUNCTION(AActor, A_SigilCharge) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM); if (self->player != NULL) @@ -945,7 +945,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SigilCharge) DEFINE_ACTION_FUNCTION(AActor, A_LightInverse) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self->player != NULL) { @@ -962,7 +962,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightInverse) DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); AActor *spot; player_t *player = self->player; @@ -1007,7 +1007,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1) DEFINE_ACTION_FUNCTION(AActor, A_FireSigil2) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player = self->player; @@ -1029,7 +1029,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil2) DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); AActor *spot; player_t *player = self->player; @@ -1063,7 +1063,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3) DEFINE_ACTION_FUNCTION(AActor, A_FireSigil4) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); AActor *spot; player_t *player = self->player; @@ -1103,7 +1103,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireSigil4) DEFINE_ACTION_FUNCTION(AActor, A_FireSigil5) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player = self->player; diff --git a/src/p_actionfunctions.cpp b/src/p_actionfunctions.cpp index 74d828d55..b6ecb5cf8 100644 --- a/src/p_actionfunctions.cpp +++ b/src/p_actionfunctions.cpp @@ -4643,7 +4643,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfInTargetLOS) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckForReload) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if ( self->player == NULL || self->player->ReadyWeapon == NULL ) { @@ -4696,7 +4696,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CheckForReload) DEFINE_ACTION_FUNCTION(AActor, A_ResetReloadCounter) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self->player == NULL || self->player->ReadyWeapon == NULL) return 0; diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 56562ab21..4938063ec 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -753,7 +753,7 @@ void DoReadyWeapon(AActor *self) DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_WeaponReady) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); PARAM_INT_DEF(flags); DoReadyWeaponToSwitch(self, !(flags & WRF_NoSwitch)); @@ -885,7 +885,7 @@ static void P_CheckWeaponButtons (player_t *player) DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_ReFire) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); PARAM_STATE_DEF(state); A_ReFire(self, state); return 0; @@ -923,7 +923,7 @@ void A_ReFire(AActor *self, FState *state) DEFINE_ACTION_FUNCTION(AInventory, A_ClearReFire) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player = self->player; if (NULL != player) @@ -945,7 +945,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_ClearReFire) DEFINE_ACTION_FUNCTION(AInventory, A_CheckReload) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self->player != NULL) { @@ -1133,7 +1133,7 @@ DEFINE_ACTION_FUNCTION(AActor, OverlayID) DEFINE_ACTION_FUNCTION(AInventory, A_Lower) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); player_t *player = self->player; DPSprite *psp; @@ -1181,7 +1181,7 @@ DEFINE_ACTION_FUNCTION(AInventory, A_Lower) DEFINE_ACTION_FUNCTION(AInventory, A_Raise) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); if (self == nullptr) { @@ -1293,7 +1293,7 @@ enum GF_Flags DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_GunFlash) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); PARAM_STATE_DEF(flash); PARAM_INT_DEF(flags); @@ -1381,42 +1381,9 @@ void P_GunShot (AActor *mo, bool accurate, PClassActor *pufftype, DAngle pitch) P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_Hitscan, pufftype); } -DEFINE_ACTION_FUNCTION(AInventory, A_Light0) -{ - PARAM_SELF_PROLOGUE(AActor); - - if (self->player != NULL) - { - self->player->extralight = 0; - } - return 0; -} - -DEFINE_ACTION_FUNCTION(AInventory, A_Light1) -{ - PARAM_SELF_PROLOGUE(AActor); - - if (self->player != NULL) - { - self->player->extralight = 1; - } - return 0; -} - -DEFINE_ACTION_FUNCTION(AInventory, A_Light2) -{ - PARAM_SELF_PROLOGUE(AActor); - - if (self->player != NULL) - { - self->player->extralight = 2; - } - return 0; -} - DEFINE_ACTION_FUNCTION_PARAMS(AInventory, A_Light) { - PARAM_SELF_PROLOGUE(AActor); + PARAM_ACTION_PROLOGUE(AActor); PARAM_INT(light); if (self->player != NULL) diff --git a/src/scripting/codegeneration/codegen.cpp b/src/scripting/codegeneration/codegen.cpp index 8543326cf..cbe9183e2 100644 --- a/src/scripting/codegeneration/codegen.cpp +++ b/src/scripting/codegeneration/codegen.cpp @@ -6007,6 +6007,24 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx) PFunction *afd = FindClassMemberFunction(ctx.Class, ctx.Class, MethodName, ScriptPosition, &error); + // Action functions in state providers need special treatment because self is of type Actor here. + if (afd != nullptr && ctx.Class->IsDescendantOf(RUNTIME_CLASS(AStateProvider)) && (ctx.Function->Variants[0].Flags & VARF_Action)) + { + // Only accept static and action functions from the current class. Calling a member function will require explicit use of 'invoker'. + if ((afd->Variants[0].Flags & (VARF_Method|VARF_Action)) == VARF_Method) + { + // Everything else that may be used here must pass the selfclass check, i.e. it must be reachable from Actor. + // Note that FuncClass is still the current item because for symbol privacy checks this is relevant. + afd = FindClassMemberFunction(ctx.Function->Variants[0].SelfClass, ctx.Class, MethodName, ScriptPosition, &error); + if (afd == nullptr) + { + ScriptPosition.Message(MSG_ERROR, "Unable to call non-action function %s from here. Please use 'invoker.%s' to call it.", MethodName.GetChars(), MethodName.GetChars()); + delete this; + return nullptr; + } + } + } + if (error) { delete this; @@ -6306,7 +6324,7 @@ FxExpression *FxMemberFunctionCall::Resolve(FCompileContext& ctx) isresolved: bool error = false; - PFunction *afd = FindClassMemberFunction(cls, cls, MethodName, ScriptPosition, &error); + PFunction *afd = FindClassMemberFunction(cls, ctx.Class, MethodName, ScriptPosition, &error); if (error) { delete this; diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index c5ac21783..7e0af9ee4 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -2317,7 +2317,14 @@ FxExpression *ZCCCompiler::SetupActionFunction(PClass *cls, ZCC_TreeNode *af) { FArgumentList argumentlist; // We can use this function directly without wrapping it in a caller. - return new FxVMFunctionCall(new FxSelf(*af), afd, argumentlist, *af, false); + if ((afd->Variants[0].Flags & VARF_Action) || !cls->IsDescendantOf(RUNTIME_CLASS(AStateProvider)) || !afd->Variants[0].SelfClass->IsDescendantOf(RUNTIME_CLASS(AStateProvider))) + { + return new FxVMFunctionCall(new FxSelf(*af), afd, argumentlist, *af, false); + } + else + { + Error(af, "Cannot use non-action function %s here.", FName(id->Identifier).GetChars()); + } } } else diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 48b5f7ded..7634ccaea 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -317,7 +317,6 @@ class Actor : Thinker native native void A_Countdown(); native void A_AlertMonsters(float maxdist = 0, int flags = 0); native void A_ClearSoundTarget(); - native void A_FireAssaultGun(); native void A_CheckTerrain(); deprecated native void A_MissileAttack(); diff --git a/wadsrc/static/zscript/heretic/chicken.txt b/wadsrc/static/zscript/heretic/chicken.txt index 77e2b0a92..2e5ada81c 100644 --- a/wadsrc/static/zscript/heretic/chicken.txt +++ b/wadsrc/static/zscript/heretic/chicken.txt @@ -26,8 +26,8 @@ class Beak : Weapon Weapon.SisterWeapon "BeakPowered"; } - native void A_BeakRaise (); - native void A_BeakAttackPL1(); + action native void A_BeakRaise (); + action native void A_BeakAttackPL1(); States { @@ -55,7 +55,7 @@ class BeakPowered : Beak Weapon.SisterWeapon "Beak"; } - native void A_BeakAttackPL2(); + action native void A_BeakAttackPL2(); States { diff --git a/wadsrc/static/zscript/heretic/hereticweaps.txt b/wadsrc/static/zscript/heretic/hereticweaps.txt index ae5e97179..4c254500b 100644 --- a/wadsrc/static/zscript/heretic/hereticweaps.txt +++ b/wadsrc/static/zscript/heretic/hereticweaps.txt @@ -23,7 +23,7 @@ class Staff : HereticWeapon Tag "$TAG_STAFF"; } - native void A_StaffAttack (int damage, class puff); + action native void A_StaffAttack (int damage, class puff); States { @@ -142,7 +142,7 @@ class GoldWand : HereticWeapon Tag "$TAG_GOLDWAND"; } - native void A_FireGoldWandPL1 (); + action native void A_FireGoldWandPL1 (); States { @@ -178,7 +178,7 @@ class GoldWandPowered : GoldWand Tag "$TAG_GOLDWANDP"; } - native void A_FireGoldWandPL2 (); + action native void A_FireGoldWandPL2 (); States { @@ -294,7 +294,7 @@ class Crossbow : HereticWeapon Tag "$TAG_CROSSBOW"; } - native void A_FireCrossbowPL1 (); + action native void A_FireCrossbowPL1 (); States { @@ -330,7 +330,7 @@ class CrossbowPowered : Crossbow Tag "$TAG_CROSSBOWP"; } - native void A_FireCrossbowPL2(); + action native void A_FireCrossbowPL2(); States { @@ -462,7 +462,7 @@ class Gauntlets : Weapon Obituary "$OB_MPGAUNTLETS"; } - native void A_GauntletAttack (int power); + action native void A_GauntletAttack (int power); States { @@ -574,7 +574,7 @@ class Mace : HereticWeapon Tag "$TAG_MACE"; } - native void A_FireMacePL1(); + action native void A_FireMacePL1(); States { @@ -611,7 +611,7 @@ class MacePowered : Mace Tag "$TAG_MACEP"; } - native void A_FireMacePL2(); + action native void A_FireMacePL2(); States { @@ -778,7 +778,7 @@ class Blaster : HereticWeapon Obituary "$OB_MPBLASTER"; } - native void A_FireBlasterPL1(); + action native void A_FireBlasterPL1(); States { @@ -950,7 +950,7 @@ class SkullRod : HereticWeapon Tag "$TAG_SKULLROD"; } - native void A_FireSkullRodPL1(); + action native void A_FireSkullRodPL1(); States { @@ -984,7 +984,7 @@ class SkullRodPowered : SkullRod Tag "$TAG_SKULLRODP"; } - native void A_FireSkullRodPL2(); + action native void A_FireSkullRodPL2(); States { @@ -1140,7 +1140,7 @@ class PhoenixRod : Weapon native Tag "$TAG_PHOENIXROD"; } - native void A_FirePhoenixPL1(); + action native void A_FirePhoenixPL1(); States { @@ -1176,9 +1176,9 @@ class PhoenixRodPowered : PhoenixRod native Tag "$TAG_PHOENIXRODP"; } - native void A_InitPhoenixPL2(); - native void A_FirePhoenixPL2(); - native void A_ShutdownPhoenixPL2(); + action native void A_InitPhoenixPL2(); + action native void A_FirePhoenixPL2(); + action native void A_ShutdownPhoenixPL2(); States { diff --git a/wadsrc/static/zscript/hexen/clericflame.txt b/wadsrc/static/zscript/hexen/clericflame.txt index e72496530..13fca8ad1 100644 --- a/wadsrc/static/zscript/hexen/clericflame.txt +++ b/wadsrc/static/zscript/hexen/clericflame.txt @@ -16,7 +16,7 @@ class CWeapFlame : ClericWeapon Tag "$TAG_CWEAPFLAME"; } - native void A_CFlameAttack(); + action native void A_CFlameAttack(); States { diff --git a/wadsrc/static/zscript/hexen/clericholy.txt b/wadsrc/static/zscript/hexen/clericholy.txt index 6fc9cf43d..1a4372f4d 100644 --- a/wadsrc/static/zscript/hexen/clericholy.txt +++ b/wadsrc/static/zscript/hexen/clericholy.txt @@ -96,8 +96,8 @@ class CWeapWraithverge : ClericWeapon native Inventory.PickupSound "WeaponBuild"; } - native void A_CHolyAttack(); - native void A_CHolyPalette(); + action native void A_CHolyAttack(); + action native void A_CHolyPalette(); States { diff --git a/wadsrc/static/zscript/hexen/clericmace.txt b/wadsrc/static/zscript/hexen/clericmace.txt index b47974d4b..5e00b9c3b 100644 --- a/wadsrc/static/zscript/hexen/clericmace.txt +++ b/wadsrc/static/zscript/hexen/clericmace.txt @@ -13,7 +13,7 @@ class CWeapMace : ClericWeapon Tag "$TAG_CWEAPMACE"; } - native void A_CMaceAttack(); + action native void A_CMaceAttack(); States { diff --git a/wadsrc/static/zscript/hexen/clericstaff.txt b/wadsrc/static/zscript/hexen/clericstaff.txt index c33f14a80..7ae0e9da3 100644 --- a/wadsrc/static/zscript/hexen/clericstaff.txt +++ b/wadsrc/static/zscript/hexen/clericstaff.txt @@ -16,10 +16,10 @@ class CWeapStaff : ClericWeapon Tag "$TAG_CWEAPSTAFF"; } - native void A_CStaffInitBlink(); - native void A_CStaffCheckBlink(); - native void A_CStaffCheck(); - native void A_CStaffAttack(); + action native void A_CStaffInitBlink(); + action native void A_CStaffCheckBlink(); + action native void A_CStaffCheck(); + action native void A_CStaffAttack(); States { diff --git a/wadsrc/static/zscript/hexen/fighteraxe.txt b/wadsrc/static/zscript/hexen/fighteraxe.txt index 436172bef..30b235192 100644 --- a/wadsrc/static/zscript/hexen/fighteraxe.txt +++ b/wadsrc/static/zscript/hexen/fighteraxe.txt @@ -17,12 +17,12 @@ class FWeapAxe : FighterWeapon native Tag "$TAG_FWEAPAXE"; } - native void A_FAxeCheckUp(); - native void A_FAxeCheckReady(); - native void A_FAxeCheckAtk(); - native void A_FAxeAttack(); - native void A_FAxeCheckUpG(); - native void A_FAxeCheckReadyG(); + action native void A_FAxeCheckUp(); + action native void A_FAxeCheckReady(); + action native void A_FAxeCheckAtk(); + action native void A_FAxeAttack(); + action native void A_FAxeCheckUpG(); + action native void A_FAxeCheckReadyG(); States { diff --git a/wadsrc/static/zscript/hexen/fighterfist.txt b/wadsrc/static/zscript/hexen/fighterfist.txt index e556ebd87..8428ebe7d 100644 --- a/wadsrc/static/zscript/hexen/fighterfist.txt +++ b/wadsrc/static/zscript/hexen/fighterfist.txt @@ -13,7 +13,7 @@ class FWeapFist : FighterWeapon Tag "$TAG_FWEAPFIST"; } - native void A_FPunchAttack(); + action native void A_FPunchAttack(); States { diff --git a/wadsrc/static/zscript/hexen/fighterhammer.txt b/wadsrc/static/zscript/hexen/fighterhammer.txt index 0104c7670..f415cbb72 100644 --- a/wadsrc/static/zscript/hexen/fighterhammer.txt +++ b/wadsrc/static/zscript/hexen/fighterhammer.txt @@ -18,8 +18,8 @@ class FWeapHammer : FighterWeapon Tag "$TAG_FWEAPHAMMER"; } - native void A_FHammerAttack(); - native void A_FHammerThrow(); + action native void A_FHammerAttack(); + action native void A_FHammerThrow(); States { diff --git a/wadsrc/static/zscript/hexen/fighterquietus.txt b/wadsrc/static/zscript/hexen/fighterquietus.txt index 2430cd70c..7c94f7901 100644 --- a/wadsrc/static/zscript/hexen/fighterquietus.txt +++ b/wadsrc/static/zscript/hexen/fighterquietus.txt @@ -97,7 +97,7 @@ class FWeapQuietus : FighterWeapon Tag "$TAG_FWEAPQUIETUS"; } - native void A_FSwordAttack(); + action native void A_FSwordAttack(); States { diff --git a/wadsrc/static/zscript/hexen/magecone.txt b/wadsrc/static/zscript/hexen/magecone.txt index 471b5b0b7..a9f2d29dc 100644 --- a/wadsrc/static/zscript/hexen/magecone.txt +++ b/wadsrc/static/zscript/hexen/magecone.txt @@ -17,7 +17,7 @@ class MWeapFrost : MageWeapon Tag "$TAG_MWEAPFROST"; } - native void A_FireConePL1(); + action native void A_FireConePL1(); States { diff --git a/wadsrc/static/zscript/hexen/magelightning.txt b/wadsrc/static/zscript/hexen/magelightning.txt index 46687e813..154776d15 100644 --- a/wadsrc/static/zscript/hexen/magelightning.txt +++ b/wadsrc/static/zscript/hexen/magelightning.txt @@ -16,8 +16,8 @@ class MWeapLightning : MageWeapon Tag "$TAG_MWEAPLIGHTNING"; } - native void A_LightningReady(); - native void A_MLightningAttack(class floor = "LightningFloor", class ceiling = "LightningCeiling"); + action native void A_LightningReady(); + action native void A_MLightningAttack(class floor = "LightningFloor", class ceiling = "LightningCeiling"); States { diff --git a/wadsrc/static/zscript/hexen/magestaff.txt b/wadsrc/static/zscript/hexen/magestaff.txt index 9338febe6..c11542834 100644 --- a/wadsrc/static/zscript/hexen/magestaff.txt +++ b/wadsrc/static/zscript/hexen/magestaff.txt @@ -97,8 +97,8 @@ class MWeapBloodscourge : MageWeapon native Tag "$TAG_MWEAPBLOODSCOURGE"; } - native void A_MStaffAttack(); - native void A_MStaffPalette(); + action native void A_MStaffAttack(); + action native void A_MStaffPalette(); States { diff --git a/wadsrc/static/zscript/hexen/pig.txt b/wadsrc/static/zscript/hexen/pig.txt index 6362ff36e..8fa446882 100644 --- a/wadsrc/static/zscript/hexen/pig.txt +++ b/wadsrc/static/zscript/hexen/pig.txt @@ -34,7 +34,7 @@ class Snout : Weapon Weapon.YAdjust 10; } - native void A_SnoutAttack (); + action native void A_SnoutAttack (); States { diff --git a/wadsrc/static/zscript/shared/inventory.txt b/wadsrc/static/zscript/shared/inventory.txt index 4a9cde740..fc037d13f 100644 --- a/wadsrc/static/zscript/shared/inventory.txt +++ b/wadsrc/static/zscript/shared/inventory.txt @@ -46,20 +46,22 @@ class StateProvider : Inventory native action native void A_FireBullets(float spread_xy, float spread_z, int numbullets, int damageperbullet, class pufftype = "BulletPuff", int flags = 1, float range = 0, class missile = null, float Spawnheight = 32, float Spawnofs_xy = 0); action native void A_FireCustomMissile(class missiletype, float angle = 0, bool useammo = true, float spawnofs_xy = 0, float spawnheight = 0, int flags = 0, float pitch = 0); action native void A_RailAttack(int damage, int spawnofs_xy = 0, bool useammo = true, color color1 = 0, color color2 = 0, int flags = 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_Light(int extralight); - native void A_Light0(); - native void A_Light1(); - native void A_Light2(); - native void A_LightInverse(); - native void A_WeaponReady(int flags = 0); - native void A_Lower(); - native void A_Raise(); + native action void A_Light(int extralight); + action void A_Light0() { A_Light(0); } + action void A_Light1() { A_Light(1); } + action void A_Light2() { A_Light(2); } + action native void A_LightInverse(); + action native void A_WeaponReady(int flags = 0); + action native void A_Lower(); + action native void A_Raise(); action native void A_FirePistol(); action native void A_FireShotgun(); action native void A_FireShotgun2(); - native void A_OpenShotgun2(); - native void A_LoadShotgun2(); - native void A_CloseShotgun2(); + + action void A_OpenShotgun2() { A_PlaySound("weapons/sshoto", CHAN_WEAPON); } + action void A_LoadShotgun2() { A_PlaySound("weapons/sshotl", CHAN_WEAPON); } + action void A_CloseShotgun2() { A_PlaySound("weapons/sshotc", CHAN_WEAPON); } + action native void A_FireCGun(); action native void A_FireSTGrenade(class grenadetype = "Grenade"); action native void A_FireMissile(); @@ -67,17 +69,18 @@ class StateProvider : Inventory native action native void A_FireRailgun(); action native void A_FireRailgunLeft(); action native void A_FireRailgunRight(); - native void A_RailWait(); - native void A_BFGsound(); + action void A_RailWait() {} + action void A_BFGsound() { A_PlaySound("weapons/bfgf", CHAN_WEAPON); } action native void A_FireBFG(); action native void A_FireOldBFG(); - native void A_ReFire(state flash = null); - native void A_ClearReFire(); - native void A_CheckReload(); - native void A_GunFlash(state flash = null, int flags = 0); + action native void A_ReFire(state flash = null); + action native void A_ClearReFire(); + action native void A_CheckReload(); + action native void A_GunFlash(state flash = null, int flags = 0); + action native void A_FireAssaultGun(); action native void A_Saw(sound fullsound = "weapons/sawfull", sound hitsound = "weapons/sawhit", int damage = 2, class pufftype = "BulletPuff", int flags = 0, float range = 0, float spread_xy = 2.8125, float spread_z = 0, float lifesteal = 0, int lifestealmax = 0, class armorbonustype = "ArmorBonus"); - native state A_CheckForReload(int counter, state label, bool dontincrement = false); - native void A_ResetReloadCounter(); + action native state A_CheckForReload(int counter, state label, bool dontincrement = false); + action native void A_ResetReloadCounter(); } class ScoreItem : Inventory native diff --git a/wadsrc/static/zscript/strife/sigil.txt b/wadsrc/static/zscript/strife/sigil.txt index dab1db2f5..d8b1f80f8 100644 --- a/wadsrc/static/zscript/strife/sigil.txt +++ b/wadsrc/static/zscript/strife/sigil.txt @@ -16,16 +16,16 @@ class Sigil : Weapon native Inventory.PickupMessage "$TXT_SIGIL"; } - native void A_SelectPiece (); - native void A_SelectSigilView (); - native void A_SelectSigilDown (); - native void A_SelectSigilAttack (); - native void A_SigilCharge (); - native void A_FireSigil1 (); - native void A_FireSigil2 (); - native void A_FireSigil3 (); - native void A_FireSigil4 (); - native void A_FireSigil5 (); + action native void A_SelectPiece (); + action native void A_SelectSigilView (); + action native void A_SelectSigilDown (); + action native void A_SelectSigilAttack (); + action native void A_SigilCharge (); + action native void A_FireSigil1 (); + action native void A_FireSigil2 (); + action native void A_FireSigil3 (); + action native void A_FireSigil4 (); + action native void A_FireSigil5 (); States { diff --git a/wadsrc/static/zscript/strife/strifeweapons.txt b/wadsrc/static/zscript/strife/strifeweapons.txt index bf94706c9..178b2b27a 100644 --- a/wadsrc/static/zscript/strife/strifeweapons.txt +++ b/wadsrc/static/zscript/strife/strifeweapons.txt @@ -62,7 +62,7 @@ class PunchDagger : StrifeWeapon Tag "$TAG_PUNCHDAGGER"; } - native void A_JabDagger (); + action native void A_JabDagger (); States { @@ -184,9 +184,9 @@ class StrifeCrossbow : StrifeWeapon Inventory.Icon "CBOWA0"; } - native void A_ClearFlash (); - native void A_ShowElectricFlash (); - native void A_FireArrow (class proj); + action native void A_ClearFlash (); + action native void A_ShowElectricFlash (); + action native void A_FireArrow (class proj); States { @@ -331,7 +331,7 @@ class MiniMissileLauncher : StrifeWeapon Inventory.PickupMessage "$TXT_MMLAUNCHER"; } - native void A_FireMiniMissile (); + action native void A_FireMiniMissile (); States { @@ -446,7 +446,7 @@ class FlameThrower : StrifeWeapon Inventory.PickupMessage "$TXT_FLAMER"; } - native void A_FireFlamer (); + action native void A_FireFlamer (); States { @@ -528,7 +528,7 @@ class Mauler : StrifeWeapon Obituary "$OB_MPMAULER1"; } - native void A_FireMauler1 (); + action native void A_FireMauler1 (); States { @@ -571,8 +571,8 @@ class Mauler2 : Mauler Tag "$TAG_MAULER2"; } - native void A_FireMauler2Pre (); - native void A_FireMauler2 (); + action native void A_FireMauler2Pre (); + action native void A_FireMauler2 (); States { @@ -816,7 +816,7 @@ class StrifeGrenadeLauncher : StrifeWeapon Inventory.PickupMessage "$TXT_GLAUNCHER"; } - native void A_FireGrenade (class grenadetype, float angleofs, state flash); + action native void A_FireGrenade (class grenadetype, float angleofs, state flash); States {