From deaec2d91d18ce8a77c844ad57bd41df9d54b019 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 8 Jan 2023 16:38:30 +0100 Subject: [PATCH] - disabled property-type definition of spritetype members. As it turned out this is simply too dangerous - these should be left to be loaded from the map data or set manually. All remaining setups using this feature have either been moved to Initialize or other meta properties that are not affected by map loading. --- source/core/actorinfo.h | 18 -- source/core/actorlist.cpp | 44 ++--- source/core/thingdef_properties.cpp | 170 ------------------ .../zscript/games/duke/actors/bowling.zs | 13 +- .../zscript/games/duke/actors/greenslime.zs | 8 +- .../zscript/games/duke/actors/heavyhbomb.zs | 4 +- .../static/zscript/games/duke/actors/jibs.zs | 13 +- .../zscript/games/duke/actors/mortar.zs | 13 +- .../static/zscript/games/duke/actors/recon.zs | 6 +- .../games/duke/actors/respawnmarker.zs | 7 +- 10 files changed, 60 insertions(+), 236 deletions(-) diff --git a/source/core/actorinfo.h b/source/core/actorinfo.h index 98568bb92..6eef912b0 100644 --- a/source/core/actorinfo.h +++ b/source/core/actorinfo.h @@ -15,24 +15,6 @@ enum EDefaultFlags { DEFF_PICNUM = 1, DEFF_STATNUM = 2, - DEFF_ANG = 4, - DEFF_XVEL = 8, - DEFF_YVEL = 16, - DEFF_ZVEL = 32, - DEFF_HITAG = 64, - DEFF_LOTAG = 128, - DEFF_EXTRA = 256, - DEFF_DETAIL = 512, - DEFF_SHADE = 1024, - DEFF_PAL = 2048, - DEFF_CLIPDIST = 8192, - DEFF_BLEND = 16384, - DEFF_XREPEAT = 32768, - DEFF_YREPEAT = 65536, - DEFF_XOFFSET = 0x20000, - DEFF_YOFFSET = 0x40000, - DEFF_OWNER = 0x80000, - DEFF_INTANG = 0x100000 }; struct FActorInfo diff --git a/source/core/actorlist.cpp b/source/core/actorlist.cpp index fa36da6ef..54e108678 100644 --- a/source/core/actorlist.cpp +++ b/source/core/actorlist.cpp @@ -375,33 +375,33 @@ void DCoreActor::initFromSprite(spritetype* mspr) spr.cstat = (mspr->cstat & ~ESpriteFlags::FromInt(actorinfo->DefaultCstat)) | (spr.cstat & ESpriteFlags::FromInt(actorinfo->DefaultCstat)); spr.pos = mspr->pos; spr.sectp = mspr->sectp; - spr.clipdist = mspr->clipdist; // this has no associated property because it is needed for initialization of the real clipdist. + spr.clipdist = mspr->clipdist; - // only copy those values which have not been defaulted by the class definition. -#define setter(flag, var) if (!(actorinfo->DefaultFlags & flag)) spr.var = mspr->var; + // picnum may only be used if the class allows it. + if (!(actorinfo->DefaultFlags & DEFF_PICNUM)) spr.picnum = mspr->picnum; - setter(DEFF_PICNUM, picnum); - setter(DEFF_ANG, Angles.Yaw); - setter(DEFF_INTANG, intangle); - setter(DEFF_XVEL, xint); - setter(DEFF_YVEL, yint); - setter(DEFF_ZVEL, inittype); - setter(DEFF_HITAG, hitag); - setter(DEFF_LOTAG, lotag); - setter(DEFF_EXTRA, extra); - setter(DEFF_DETAIL, detail); - setter(DEFF_SHADE, shade); - setter(DEFF_PAL, pal); - setter(DEFF_BLEND, blend); - setter(DEFF_XREPEAT, scale.X); - setter(DEFF_YREPEAT, scale.Y); - setter(DEFF_XOFFSET, xoffset); - setter(DEFF_YOFFSET, yoffset); - setter(DEFF_OWNER, intowner); +#define setter(var) spr.var = mspr->var; + + setter(Angles.Yaw); + setter(intangle); + setter(xint); + setter(yint); + setter(inittype); + setter(hitag); + setter(lotag); + setter(extra); + setter(detail); + setter(shade); + setter(pal); + setter(blend); + setter(scale); + setter(xoffset); + setter(yoffset); + setter(intowner); #undef setter - if (!(actorinfo->DefaultFlags & DEFF_CLIPDIST)) clipdist = spr.clipdist * 0.25; + clipdist = spr.clipdist * 0.25; if (mspr->statnum != 0 && !(actorinfo->DefaultFlags & DEFF_STATNUM)) ChangeActorStat(this, mspr->statnum); } diff --git a/source/core/thingdef_properties.cpp b/source/core/thingdef_properties.cpp index df1f36c75..776c8f02f 100644 --- a/source/core/thingdef_properties.cpp +++ b/source/core/thingdef_properties.cpp @@ -329,176 +329,6 @@ DEFINE_PROPERTY(statnum, I, CoreActor) bag.Info->ActorInfo()->DefaultFlags |= DEFF_STATNUM; } -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(angle, F, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.Angles.Yaw = DAngle::fromDeg(i); - bag.Info->ActorInfo()->DefaultFlags |= DEFF_ANG; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(intangle, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.intangle = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_INTANG; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(xint, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.xint = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_XVEL; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(yint, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.yint = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_YVEL; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(inittype, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.inittype = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_ZVEL; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(lotag, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.lotag = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_LOTAG; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(hitag, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.lotag = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_HITAG; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(extra, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.lotag = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_EXTRA; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(detail, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.detail = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_DETAIL; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(shade, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.shade = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_SHADE; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(pal, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.pal = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_PAL; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(clipdist, F, CoreActor) -{ - PROP_FLOAT_PARM(i, 0); - defaults->clipdist = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_CLIPDIST; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(scalex, F, CoreActor) -{ - PROP_FLOAT_PARM(i, 0); - defaults->spr.scale.X = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_XREPEAT; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(scaley, F, CoreActor) -{ - PROP_FLOAT_PARM(i, 0); - defaults->spr.scale.Y = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_YREPEAT; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(xoffset, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.xoffset = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_XOFFSET; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(yoffset, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.yoffset = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_YOFFSET; -} - -//========================================================================== -// -//========================================================================== -DEFINE_PROPERTY(owner, I, CoreActor) -{ - PROP_INT_PARM(i, 0); - defaults->spr.intowner = i; - bag.Info->ActorInfo()->DefaultFlags |= DEFF_OWNER; -} - //========================================================================== // //========================================================================== diff --git a/wadsrc/static/zscript/games/duke/actors/bowling.zs b/wadsrc/static/zscript/games/duke/actors/bowling.zs index 929ff9e4d..1b0a82b21 100644 --- a/wadsrc/static/zscript/games/duke/actors/bowling.zs +++ b/wadsrc/static/zscript/games/duke/actors/bowling.zs @@ -2,9 +2,12 @@ class RedneckBowlingPin : DukeActor { default { - detail 0; + RedneckBowlingPin.Behavior 0; spriteset "BOWLINGPIN", "BOWLINGPIN1"; } + + meta int behavior; + property behavior: behavior; override void Initialize() { @@ -83,14 +86,14 @@ class RedneckBowlingPin : DukeActor let targ = RedneckBowlingPin(targa); if (!targ) return; - if (targ.detail == 0) + if (targ.behavior == 0) { self.vel.X *= 0.75; self.angle -= targ.angle * 2 + frandom(0, 11.25); targ.angle += frandom(0, 22.5 / 8); targ.PlayActorSound("BOWLPIN"); } - else if (targ.detail == 1) + else if (targ.behavior == 1) { self.vel.X *= 0.75; self.angle -= targ.angle * 2 + frandom(0, 22.5 / 8); @@ -115,7 +118,7 @@ class RedneckHenstand : RedneckBowlingPin default { spriteset "HENSTAND", "HENSTAND1"; - detail 1; + RedneckBowlingPin.Behavior 1; } override void Initialize() @@ -144,7 +147,7 @@ class RedneckBowlingBall : RedneckBowlingPin default { pic "BOWLINGBALL"; - detail 2; + RedneckBowlingPin.Behavior 2; } override void Initialize() diff --git a/wadsrc/static/zscript/games/duke/actors/greenslime.zs b/wadsrc/static/zscript/games/duke/actors/greenslime.zs index 8c83a2405..e95d0fdf4 100644 --- a/wadsrc/static/zscript/games/duke/actors/greenslime.zs +++ b/wadsrc/static/zscript/games/duke/actors/greenslime.zs @@ -3,15 +3,15 @@ class DukeGreenSlime : DukeActor default { spriteset "GREENSLIME", "GREENSLIME1", "GREENSLIME2", "GREENSLIME3", "GREENSLIME4", "GREENSLIME5", "GREENSLIME6", "GREENSLIME7"; - scaleX 0.625; - scaleY 0.625; - clipdist 20; - extra 1; } override void Initialize() { commonEnemySetup(); + self.scale = (0.625, 0.625); + self.clipdist = 20; + self.extra = 1; + } override void PlayFTASound() diff --git a/wadsrc/static/zscript/games/duke/actors/heavyhbomb.zs b/wadsrc/static/zscript/games/duke/actors/heavyhbomb.zs index 64b2d8d41..2e82a8445 100644 --- a/wadsrc/static/zscript/games/duke/actors/heavyhbomb.zs +++ b/wadsrc/static/zscript/games/duke/actors/heavyhbomb.zs @@ -4,10 +4,9 @@ class DukePipeBomb : DukeActor default { pic "HEAVYHBOMB"; - detail 3; // ceiling distance // do not add anything here! } - + override void Initialize() { // This is only for placed items, not for armed weapons! @@ -226,7 +225,6 @@ class RedneckDynamite : DukePipeBomb default { pic "DYNAMITE"; - detail 16; } override void pickupCheck(DukePlayer p) diff --git a/wadsrc/static/zscript/games/duke/actors/jibs.zs b/wadsrc/static/zscript/games/duke/actors/jibs.zs index f6f54a579..27e37d81a 100644 --- a/wadsrc/static/zscript/games/duke/actors/jibs.zs +++ b/wadsrc/static/zscript/games/duke/actors/jibs.zs @@ -49,10 +49,15 @@ class DukeJibs1 : DukeActor { default { + DukeJibs1.Behavior 0; statnum STAT_MISC; spriteset "JIBS1", "JIBS6", "JIBS6A", "JIBS6B", "JIBS6C", "JIBS6D", "JIBS6E", "JIBS6F", "JIBS6G"; } + meta int behavior; + property behavior: behavior; + + override void Tick() { if(self.vel.X > 0) self.vel.X -= 1/16.; @@ -94,7 +99,7 @@ class DukeJibs1 : DukeActor else if (sectp.lotag != 2) { self.temp_data[1] = 0; - if (detail == 1) + if (self.behavior == 1) { if (self.temp_data[0] > 6) self.temp_data[0] = 0; else self.temp_data[0]++; @@ -129,7 +134,7 @@ class DukeJibs1 : DukeActor } else { - if (self.detail == 2) // cactus debris only + if (self.behavior == 2) // cactus debris only { self.Destroy(); return; @@ -317,7 +322,7 @@ class DukePlayerTorso : DukeJibs1 default { pic "DUKETORSO"; - detail 1; + DukeJibs1.Behavior 1; } } @@ -596,7 +601,7 @@ class RedneckCactusDebris1 : DukeJibs1 default { pic "CACTUSDEBRIS1"; - detail 2; + DukeJibs1.Behavior 2; } } diff --git a/wadsrc/static/zscript/games/duke/actors/mortar.zs b/wadsrc/static/zscript/games/duke/actors/mortar.zs index 9d6d87c96..2ce5eb64c 100644 --- a/wadsrc/static/zscript/games/duke/actors/mortar.zs +++ b/wadsrc/static/zscript/games/duke/actors/mortar.zs @@ -3,8 +3,11 @@ class DukeMortar : DukeActor default { pic "MORTAR"; - detail 3; + DukeMortar.ceilingdist 3; } + + meta int ceilingdist; + property ceilingdist: ceilingdist; override void Tick() { @@ -61,9 +64,9 @@ class DukeMortar : DukeActor self.vel.Z *= 0.25; self.yint++; } - if (itemmode != 2 && self.pos.Z < self.ceilingz + self.detail && (!Raze.isRR() || sectp.lotag != ST_2_UNDERWATER)) // underwater check only for RR + if (itemmode != 2 && self.pos.Z < self.ceilingz + self.ceilingdist && (!Raze.isRR() || sectp.lotag != ST_2_UNDERWATER)) // underwater check only for RR { - self.pos.Z = self.ceilingz + self.detail; + self.pos.Z = self.ceilingz + self.ceilingdist; self.vel.Z = 0; } } @@ -184,7 +187,7 @@ class RedneckMortar : DukeMortar default { pic "MORTAR"; - detail 16; + DukeMortar.ceilingdist 16; } override void Tick() @@ -199,7 +202,7 @@ class RedneckCheerBomb : DukeMortar default { spriteset "CHEERBOMB", "CHEERBOMB1", "CHEERBOMB2", "CHEERBOMB3"; - detail 16; + DukeMortar.ceilingdist 16; } override bool Animate(tspritetype t) diff --git a/wadsrc/static/zscript/games/duke/actors/recon.zs b/wadsrc/static/zscript/games/duke/actors/recon.zs index 495ce0716..645c1a164 100644 --- a/wadsrc/static/zscript/games/duke/actors/recon.zs +++ b/wadsrc/static/zscript/games/duke/actors/recon.zs @@ -247,9 +247,6 @@ class RedneckUFO1 : DukeRecon default { Pic "UFO1_RR"; - ScaleX 0.5; - ScaleY 0.5; - Extra 50; } override void Initialize() @@ -259,6 +256,9 @@ class RedneckUFO1 : DukeRecon RoamSnd = "UFOLET"; shift = 1; SpawnType = "RedneckHen"; + self.Scale = (0.5, 0.5); + self.Extra = 50; + self.setClipDistFromTile(); } diff --git a/wadsrc/static/zscript/games/duke/actors/respawnmarker.zs b/wadsrc/static/zscript/games/duke/actors/respawnmarker.zs index f0ab5aa08..1504a969e 100644 --- a/wadsrc/static/zscript/games/duke/actors/respawnmarker.zs +++ b/wadsrc/static/zscript/games/duke/actors/respawnmarker.zs @@ -42,8 +42,11 @@ class RedneckRespawnMarker : DukeRespawnMarker { spriteset "RESPAWNMARKER1", "RESPAWNMARKER2", "RESPAWNMARKER3", "RESPAWNMARKER4", "RESPAWNMARKER5", "RESPAWNMARKERRED", "RESPAWNMARKER7", "RESPAWNMARKER8", "RESPAWNMARKER9", "RESPAWNMARKER10", "RESPAWNMARKER11", "RESPAWNMARKER12", "RESPAWNMARKER13", "RESPAWNMARKER14"; - scalex 0.125; - scaley 0.125; + } + + override void Initialize() + { + self.scale = (0.125, 0.125); } override bool Animate(tspritetype t)