From 307276a2769a81841548b2ee223e6c20cb61c40b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 8 Apr 2023 09:38:46 +0200 Subject: [PATCH] - WIP for a default scale property. For now a NOP, we need to get a little further with the scriptification work before this can be made operational. --- source/core/actorinfo.h | 3 +++ source/core/thingdef_properties.cpp | 15 +++++++++++++++ wadsrc/static/zscript/games/duke/actors/recon.zs | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/source/core/actorinfo.h b/source/core/actorinfo.h index 37e9dd80e..5705b5393 100644 --- a/source/core/actorinfo.h +++ b/source/core/actorinfo.h @@ -15,6 +15,7 @@ enum EDefaultFlags { DEFF_PICNUM = 1, DEFF_STATNUM = 2, + DEFF_SCALE = 4, }; struct FActorInfo @@ -23,6 +24,7 @@ struct FActorInfo TArray SpriteSet; PClassActor *Replacement = nullptr; PClassActor *Replacee = nullptr; + DVector2 DefaultScale = { 0, 0 }; int TypeNum = -1; int DefaultFlags = 0; int DefaultCstat = 0; @@ -40,6 +42,7 @@ struct FActorInfo DefaultFlags = other.DefaultFlags; DefaultCstat = other.DefaultCstat; SpriteSetNames = other.SpriteSetNames; + DefaultScale = other.DefaultScale; } void ResolveTextures(const char* clsname, DCoreActor *defaults); diff --git a/source/core/thingdef_properties.cpp b/source/core/thingdef_properties.cpp index 776c8f02f..4fa002498 100644 --- a/source/core/thingdef_properties.cpp +++ b/source/core/thingdef_properties.cpp @@ -329,6 +329,21 @@ DEFINE_PROPERTY(statnum, I, CoreActor) bag.Info->ActorInfo()->DefaultFlags |= DEFF_STATNUM; } +//========================================================================== +// +//========================================================================== +DEFINE_PROPERTY(scale, Ff, CoreActor) +{ + PROP_FLOAT_PARM(x, 0); + bag.Info->ActorInfo()->DefaultScale = { x,x }; + if (PROP_PARM_COUNT > 1) + { + PROP_FLOAT_PARM(y, 0); + bag.Info->ActorInfo()->DefaultScale.Y = y; + } + bag.Info->ActorInfo()->DefaultFlags |= DEFF_SCALE; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/zscript/games/duke/actors/recon.zs b/wadsrc/static/zscript/games/duke/actors/recon.zs index 938ccaa2c..a57615747 100644 --- a/wadsrc/static/zscript/games/duke/actors/recon.zs +++ b/wadsrc/static/zscript/games/duke/actors/recon.zs @@ -9,7 +9,7 @@ class DukeRecon : DukeActor Sound PainSnd; Sound RoamSnd; int shift; - class spawntype; // should be 'class' but the spawned types have not all been converted yet. + class spawntype; override void initialize() {