mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-24 21:11:52 +00:00
Added FloatBobFactor
This adds a new actor property: `FloatBobFactor` (default 1.0). This will be a multiplier for level.time in `AActor::GetBobOffset`, which finally allows to control not only the range of float bobbing (which is FloatBobStrength) but also the frequency of bobbing.
This commit is contained in:
parent
89ce70fd0b
commit
994078feae
7 changed files with 17 additions and 1 deletions
|
@ -625,6 +625,7 @@ xx(ScaleY)
|
|||
xx(FriendlySeeBlocks)
|
||||
xx(Floatbobphase)
|
||||
xx(Floatbobstrength)
|
||||
xx(FloatBobFactor)
|
||||
xx(Target)
|
||||
xx(Master)
|
||||
xx(Tracer)
|
||||
|
|
|
@ -1304,6 +1304,7 @@ public:
|
|||
uint8_t FloatBobPhase;
|
||||
uint8_t FriendPlayer; // [RH] Player # + 1 this friendly monster works for (so 0 is no player, 1 is player 0, etc)
|
||||
double FloatBobStrength;
|
||||
double FloatBobFactor;
|
||||
PalEntry BloodColor;
|
||||
FTranslationID BloodTranslation;
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ inline double AActor::GetBobOffset(double ticfrac) const
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
return BobSin(FloatBobPhase + Level->maptime + ticfrac) * FloatBobStrength;
|
||||
return BobSin(FloatBobPhase + Level->maptime * FloatBobFactor + ticfrac) * FloatBobStrength;
|
||||
}
|
||||
|
||||
inline double AActor::GetCameraHeight() const
|
||||
|
|
|
@ -289,6 +289,7 @@ void AActor::Serialize(FSerializer &arc)
|
|||
A("inventoryid", InventoryID)
|
||||
A("floatbobphase", FloatBobPhase)
|
||||
A("floatbobstrength", FloatBobStrength)
|
||||
A("floatbobfactor", FloatBobFactor)
|
||||
A("translation", Translation)
|
||||
A("bloodcolor", BloodColor)
|
||||
A("bloodtranslation", BloodTranslation)
|
||||
|
|
|
@ -642,6 +642,16 @@ DEFINE_PROPERTY(floatbobstrength, F, Actor)
|
|||
defaults->FloatBobStrength = id;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
DEFINE_PROPERTY(floatbobfactor, F, Actor)
|
||||
{
|
||||
PROP_DOUBLE_PARM(id, 0);
|
||||
if (id <= 0) I_Error ("FloatBobFactor must be above 0.0");
|
||||
defaults->FloatBobFactor = id;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//==========================================================================
|
||||
|
|
|
@ -2035,6 +2035,7 @@ DEFINE_FIELD(AActor, DamageType)
|
|||
DEFINE_FIELD(AActor, DamageTypeReceived)
|
||||
DEFINE_FIELD(AActor, FloatBobPhase)
|
||||
DEFINE_FIELD(AActor, FloatBobStrength)
|
||||
DEFINE_FIELD(AActor, FloatBobFactor)
|
||||
DEFINE_FIELD(AActor, RipperLevel)
|
||||
DEFINE_FIELD(AActor, RipLevelMin)
|
||||
DEFINE_FIELD(AActor, RipLevelMax)
|
||||
|
|
|
@ -178,6 +178,7 @@ class Actor : Thinker native
|
|||
native name DamageTypeReceived;
|
||||
native uint8 FloatBobPhase;
|
||||
native double FloatBobStrength;
|
||||
native double FloatBobFactor;
|
||||
native int RipperLevel;
|
||||
native int RipLevelMin;
|
||||
native int RipLevelMax;
|
||||
|
@ -413,6 +414,7 @@ class Actor : Thinker native
|
|||
FloatSpeed 4;
|
||||
FloatBobPhase -1; // randomly initialize by default
|
||||
FloatBobStrength 1.0;
|
||||
FloatBobFactor 1.0;
|
||||
Gravity 1;
|
||||
Friction 1;
|
||||
DamageFactor 1.0; // damage multiplier as target of damage.
|
||||
|
|
Loading…
Reference in a new issue