diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index 2d5838b06..2000075c9 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -2141,10 +2141,14 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool // [ZZ] supporting const self for actors is quite a cumbersome task because there's no concept of a const pointer (?) // either way, it doesn't make sense, because you can call any method on a readonly class instance. + + // The above is nonsense. This needs to work and needs to be implemented properly. + /* if ((f->Flags & ZCC_FuncConst) && (c->Type()->IsKindOf(RUNTIME_CLASS(PClass)))) { Error(f, "'Const' on a method can only be used in structs"); } + */ if ((f->Flags & ZCC_VarArg) && !(f->Flags & ZCC_Native)) { diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 56d9072fa..233f75d40 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -425,7 +425,7 @@ class Actor : Thinker native } } - clearscope virtual String GetObituary(Actor victim, Actor inflictor, Name mod, bool playerattack) + virtual String GetObituary(Actor victim, Actor inflictor, Name mod, bool playerattack) const { if (mod == 'Telefrag') { @@ -450,13 +450,13 @@ class Actor : Thinker native native static int FindUniqueTid(int start = 0, int limit = 0); native void SetShade(color col); - clearscope native string GetTag(string defstr = ""); + native string GetTag(string defstr = "") const; native void SetTag(string defstr = ""); native double GetBobOffset(double frac = 0); native void ClearCounters(); native bool GiveBody (int num, int max=0); native bool HitFloor(); - clearscope native bool isTeammate(Actor other); + native bool isTeammate(Actor other) const; native int PlayerNumber(); native void SetFriendPlayer(PlayerInfo player); native void SoundAlert(Actor target, bool splash = false, double maxdist = 0); @@ -597,7 +597,7 @@ class Actor : Thinker native native void ClearInventory(); native bool GiveInventory(class type, int amount, bool givecheat = false); native bool TakeInventory(class itemclass, int amount, bool fromdecorate = false, bool notakeinfinite = false); - clearscope native Inventory FindInventory(class itemtype, bool subclass = false); + native Inventory FindInventory(class itemtype, bool subclass = false) const; native Inventory GiveInventoryType(class itemtype); native Inventory DropInventory (Inventory item, int amt = -1); native bool UseInventory(Inventory item); diff --git a/wadsrc/static/zscript/inventory/powerups.txt b/wadsrc/static/zscript/inventory/powerups.txt index d4d78d119..f6b14a051 100644 --- a/wadsrc/static/zscript/inventory/powerups.txt +++ b/wadsrc/static/zscript/inventory/powerups.txt @@ -285,7 +285,7 @@ class Powerup : Inventory // //=========================================================================== - virtual clearscope bool isBlinking() + virtual bool isBlinking() const { return (EffectTics <= BLINKTHRESHOLD && (EffectTics & 8) && !bNoScreenBlink); } diff --git a/wadsrc/static/zscript/inventory/weapons.txt b/wadsrc/static/zscript/inventory/weapons.txt index 860d387e2..0eba93bf8 100644 --- a/wadsrc/static/zscript/inventory/weapons.txt +++ b/wadsrc/static/zscript/inventory/weapons.txt @@ -89,7 +89,7 @@ class Weapon : StateProvider native return s; } - override String GetObituary(Actor victim, Actor inflictor, Name mod, bool playerattack) + override String GetObituary(Actor victim, Actor inflictor, Name mod, bool playerattack) const { // Weapons may never return HitObituary by default. Override this if it is needed. return Obituary; diff --git a/wadsrc/static/zscript/shared/player.txt b/wadsrc/static/zscript/shared/player.txt index d6ea5b843..cbb361687 100644 --- a/wadsrc/static/zscript/shared/player.txt +++ b/wadsrc/static/zscript/shared/player.txt @@ -119,7 +119,7 @@ class PlayerPawn : Actor native } } - override String GetObituary(Actor victim, Actor inflictor, Name mod, bool playerattack) + override String GetObituary(Actor victim, Actor inflictor, Name mod, bool playerattack) const { if (victim.player != player && victim.IsTeammate(self)) { @@ -150,7 +150,7 @@ class PlayerPawn : Actor native } // This is for SBARINFO. - clearscope int, int GetEffectTicsForItem(class item) + int, int GetEffectTicsForItem(class item) const { let pg = (class)(item); if (pg != null) @@ -167,10 +167,10 @@ class PlayerPawn : Actor native return -1, -1; } - clearscope native int GetMaxHealth(bool withupgrades = false); + native int GetMaxHealth(bool withupgrades = false) const; native bool ResetAirSupply (bool playgasp = false); native void CheckWeaponSwitch(class item); - clearscope native static String GetPrintableDisplayName(Class cls); + native clearscope static String GetPrintableDisplayName(Class cls); }