From a7c2346b32374270e8fe08e4c54dd1d7292aadc7 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 30 May 2013 08:52:29 +0000 Subject: [PATCH] - added a FloatBobPhase property for DECORATE. Now, if FloatBobPhase is anything but -1 it will be used directly as the initial phase, allowing to define actors that bob in sync. The allowed range of phases is 0 - 63. The main reason for this is that each actor spawn called the pr_spawnmobj RNG just to randomize this value which causes problems with non-interactive actors, in particular GZDoom's dynamic lights. SVN r4296 (trunk) --- src/p_mobj.cpp | 2 +- src/thingdef/thingdef_properties.cpp | 10 ++++++++++ wadsrc/static/actors/actor.txt | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index e70f3cc0a..955672c67 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -3879,7 +3879,7 @@ AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t actor->SpawnPoint[2] = (actor->z - actor->floorz); } - actor->FloatBobPhase = rng(); // Don't make everything bob in sync + if (actor->FloatBobPhase < 0) actor->FloatBobPhase = rng(); // Don't make everything bob in sync (unless deliberately told to do) if (actor->flags2 & MF2_FLOORCLIP) { actor->AdjustFloorClip (); diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index e3461792b..662c868ee 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -624,6 +624,16 @@ DEFINE_PROPERTY(scale, F, Actor) defaults->scaleX = defaults->scaleY = id; } +//========================================================================== +// +//========================================================================== +DEFINE_PROPERTY(floatbobphase, F, Actor) +{ + PROP_FIXED_PARM(id, 0); + if (id < -1 || id >= 64) I_Error ("FloatBobPhase must be in range [-1,63]"); + defaults->FloatBobPhase = id; +} + //========================================================================== // //========================================================================== diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 8e76ca374..950521361 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -16,6 +16,7 @@ ACTOR Actor native //: Thinker WallBounceFactor 0.75 BounceCount -1 FloatSpeed 4 + FloatBobPhase -1 // randomly initialize by default Gravity 1 DamageFactor 1.0 PushFactor 0.25