add FloatBobStrength Actor property, a multiplier on Z offset created by FloatBob behavior. default of 1.0 is current behavior, set higher/lower for more/less extreme bobbing.

This commit is contained in:
jplebreton 2017-06-03 08:42:57 -07:00 committed by Christoph Oelckers
parent f593e2aa3c
commit 2c7a0c87c8
5 changed files with 16 additions and 1 deletions

View File

@ -1169,6 +1169,7 @@ public:
uint8_t smokecounter;
uint8_t FloatBobPhase;
double FloatBobStrength;
uint8_t FriendPlayer; // [RH] Player # + 1 this friendly monster works for (so 0 is no player, 1 is player 0, etc)
PalEntry BloodColor;
uint32_t BloodTranslation;

View File

@ -503,6 +503,7 @@ xx(Scale)
xx(ScaleX)
xx(ScaleY)
xx(Floatbobphase)
xx(Floatbobstrength)
xx(Target)
xx(Master)
xx(Tracer)

View File

@ -282,6 +282,7 @@ DEFINE_FIELD(AActor, Floorclip)
DEFINE_FIELD(AActor, DamageType)
DEFINE_FIELD(AActor, DamageTypeReceived)
DEFINE_FIELD(AActor, FloatBobPhase)
DEFINE_FIELD(AActor, FloatBobStrength)
DEFINE_FIELD(AActor, RipperLevel)
DEFINE_FIELD(AActor, RipLevelMin)
DEFINE_FIELD(AActor, RipLevelMax)
@ -443,6 +444,7 @@ void AActor::Serialize(FSerializer &arc)
("inventory", Inventory)
A("inventoryid", InventoryID)
A("floatbobphase", FloatBobPhase)
A("floatbobstrength", FloatBobStrength)
A("translation", Translation)
A("bloodcolor", BloodColor)
A("bloodtranslation", BloodTranslation)
@ -7988,7 +7990,7 @@ double AActor::GetBobOffset(double ticfrac) const
{
return 0;
}
return BobSin(FloatBobPhase + level.maptime + ticfrac);
return BobSin(FloatBobPhase + level.maptime + ticfrac) * FloatBobStrength;
}
DEFINE_ACTION_FUNCTION(AActor, GetBobOffset)

View File

@ -653,6 +653,15 @@ DEFINE_PROPERTY(floatbobphase, I, Actor)
defaults->FloatBobPhase = id;
}
//==========================================================================
//
//==========================================================================
DEFINE_PROPERTY(floatbobstrength, F, Actor)
{
PROP_DOUBLE_PARM(id, 0);
defaults->FloatBobStrength = id;
}
//==========================================================================
//
//==========================================================================

View File

@ -131,6 +131,7 @@ class Actor : Thinker native
native name DamageType;
native name DamageTypeReceived;
native uint8 FloatBobPhase;
native double FloatBobStrength;
native int RipperLevel;
native int RipLevelMin;
native int RipLevelMax;
@ -325,6 +326,7 @@ class Actor : Thinker native
BounceCount -1;
FloatSpeed 4;
FloatBobPhase -1; // randomly initialize by default
FloatBobStrength 1.0;
Gravity 1;
Friction 1;
DamageFactor 1.0; // damage multiplier as target of damage.