1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Eliminate hsScalar and hsFixed

Modern CPUs support floats just fine... hsFixed was crazy.
This commit is contained in:
2012-01-21 02:03:37 -05:00
parent 5027b5a4ac
commit e020651e4b
584 changed files with 5401 additions and 6399 deletions

View File

@ -82,8 +82,8 @@ plAGAnim::plAGAnim()
// ctor ------------------------------------------------------
// -----
plAGAnim::plAGAnim(const char *name, double start, double end)
: fStart((hsScalar)start),
fEnd((hsScalar)end)
: fStart((float)start),
fEnd((float)end)
{
if (name == nil)
name = "";
@ -197,7 +197,7 @@ hsBool plAGAnim::RemoveApplicator(int index)
// ExtendToLength ----------------------------
// ---------------
void plAGAnim::ExtendToLength(hsScalar length)
void plAGAnim::ExtendToLength(float length)
{
if (length > GetEnd())
SetEnd(length);
@ -371,8 +371,8 @@ plATCAnim::plATCAnim(const char *name, double start, double end)
: plAGAnim(name, start, end),
fInitial(-1),
fAutoStart(true),
fLoopStart((hsScalar)start),
fLoopEnd((hsScalar)end),
fLoopStart((float)start),
fLoopEnd((float)end),
fLoop(false),
fEaseInType(plAnimEaseTypes::kNoEase),
fEaseOutType(plAnimEaseTypes::kNoEase),
@ -578,7 +578,7 @@ void plATCAnim::CopyMarkerNames(std::vector<char*> &out)
// AddStopPoint ---------------------------
// -------------
void plATCAnim::AddStopPoint(hsScalar time)
void plATCAnim::AddStopPoint(float time)
{
fStopPoints.push_back(time);
}
@ -592,7 +592,7 @@ uint32_t plATCAnim::NumStopPoints()
// GetStopPoint --------------------------
// -------------
hsScalar plATCAnim::GetStopPoint(uint32_t i)
float plATCAnim::GetStopPoint(uint32_t i)
{
hsAssert(i < fStopPoints.size(), "Invalid index for GetStopPoint");
return fStopPoints[i];

View File

@ -144,22 +144,22 @@ public:
virtual const char * GetName() const { return fName; }
/** Return the length of the animation; end - start. */
virtual hsScalar GetLength() const { return fEnd - fStart; }
virtual float GetLength() const { return fEnd - fStart; }
/** Hacky function to extend the length of the animation to some minimum
length. Does nothing if the animation is already longer than this. */
void ExtendToLength(hsScalar length);
void ExtendToLength(float length);
/** Return the start time for the beginning of the animation. The animation
contains no data prior to this time.
In practice, this always returns 0.0f and this function may be deprecated. */
virtual hsScalar GetStart() const { return fStart; }
void SetStart(hsScalar start) { fStart = start; }
virtual float GetStart() const { return fStart; }
void SetStart(float start) { fStart = start; }
/** Return the end time of the animation. Since start is typically 0, this usually
serves as the length of the animation as well. */
virtual hsScalar GetEnd() const { return fEnd; }
void SetEnd(hsScalar end) { fEnd = end; }
virtual float GetEnd() const { return fEnd; }
void SetEnd(float end) { fEnd = end; }
/** Returns true if any applicator on the arg anim tries to use the
@ -199,8 +199,8 @@ protected:
ApplicatorVec fApps; /// our animation channels
float fBlend; /// requested blend factor
hsScalar fStart; /// the start time of the beginning of the animation (usually 0)
hsScalar fEnd; /// the end time of the animation
float fStart; /// the start time of the beginning of the animation (usually 0)
float fEnd; /// the end time of the animation
char *fName; /// the name of our animation
@ -238,8 +238,8 @@ public:
Animations are not required to start at their actual beginning but can,
for instance, start in the middle, play to the end, and then loop to the
beginning or to their loop start point. */
virtual hsScalar GetInitial() const { return fInitial; }
void SetInitial(hsScalar initial) { fInitial = initial; }
virtual float GetInitial() const { return fInitial; }
void SetInitial(float initial) { fInitial = initial; }
/** Does this animation start automatically when it's applied? */
virtual bool GetAutoStart() const { return fAutoStart; }
@ -247,13 +247,13 @@ public:
/** If the animation loops, this is where it will restart the loop. Note that
loops do not have to start at the beginning of the animation. */
virtual hsScalar GetLoopStart() const { return fLoopStart; }
void SetLoopStart(hsScalar start) { fLoopStart = start; }
virtual float GetLoopStart() const { return fLoopStart; }
void SetLoopStart(float start) { fLoopStart = start; }
/** If the animation loops, this is the end point of the loop. After passing
this point, the animation will cycle around to GetLoopStart */
virtual hsScalar GetLoopEnd() const { return fLoopEnd; }
void SetLoopEnd(hsScalar end) { fLoopEnd = end; }
virtual float GetLoopEnd() const { return fLoopEnd; }
void SetLoopEnd(float end) { fLoopEnd = end; }
/** Does this animation loop?. Note that there may be multiple loop segments defined
within a given animation. */
@ -268,19 +268,19 @@ public:
void SetEaseInType(uint8_t type) { fEaseInType = type; }
/** Set the length of time the ease-in should take. */
virtual hsScalar GetEaseInLength() const { return fEaseInLength; }
virtual float GetEaseInLength() const { return fEaseInLength; }
/** Set the length of time the ease-in should take. */
void SetEaseInLength(hsScalar length) { fEaseInLength = length; }
void SetEaseInLength(float length) { fEaseInLength = length; }
/** The minimum value used at the start of the ease in. */
virtual hsScalar GetEaseInMin() const { return fEaseInMin; }
virtual float GetEaseInMin() const { return fEaseInMin; }
/** The minimum value used at the start of the ease in. */
void SetEaseInMin(hsScalar length) { fEaseInMin = length; }
void SetEaseInMin(float length) { fEaseInMin = length; }
/** The maximum value reached at the end of the ease in. */
virtual hsScalar GetEaseInMax() const { return fEaseInMax; }
virtual float GetEaseInMax() const { return fEaseInMax; }
/** The maximum value reached at the end of the ease in. */
void SetEaseInMax(hsScalar length) { fEaseInMax = length; }
void SetEaseInMax(float length) { fEaseInMax = length; }
/** The curve type for the ease out. */
virtual uint8_t GetEaseOutType() const { return fEaseOutType; }
@ -288,19 +288,19 @@ public:
void SetEaseOutType(uint8_t type) { fEaseOutType = type; }
/** The length of time for the ease out. */
virtual hsScalar GetEaseOutLength() const { return fEaseOutLength; }
virtual float GetEaseOutLength() const { return fEaseOutLength; }
/** The length of time for the ease out. */
void SetEaseOutLength(hsScalar length) { fEaseOutLength = length; }
void SetEaseOutLength(float length) { fEaseOutLength = length; }
/** Minimum value reached in ease-out */
virtual hsScalar GetEaseOutMin() const { return fEaseOutMin; }
virtual float GetEaseOutMin() const { return fEaseOutMin; }
/** Minimum value reached in ease-out */
void SetEaseOutMin(hsScalar length) { fEaseOutMin = length; }
void SetEaseOutMin(float length) { fEaseOutMin = length; }
/** Maximum value reached in ease-in */
virtual hsScalar GetEaseOutMax() const { return fEaseOutMax; }
virtual float GetEaseOutMax() const { return fEaseOutMax; }
/** Maximum value reached in ease-in */
void SetEaseOutMax(hsScalar length) { fEaseOutMax = length; }
void SetEaseOutMax(float length) { fEaseOutMax = length; }
/** Animations can have multiple defined loop segments; these
are selected using animation control messages.
@ -327,12 +327,12 @@ public:
near a stop point and fading out, the stop point will
override the fade, so that the animation stops precisely
at the defined time. */
void AddStopPoint(hsScalar time);
void AddStopPoint(float time);
/** Return the number of stop points defined for this animation. */
uint32_t NumStopPoints();
/** Get the time corresponding to the given stop point. Stop points
are numbered in the order they were added. */
hsScalar GetStopPoint(uint32_t i);
float GetStopPoint(uint32_t i);
/** Function to check for a zero-length loop, and set it to
the anim's start/end instead */
void CheckLoop();
@ -347,20 +347,20 @@ public:
virtual void Write(hsStream* stream, hsResMgr* mgr);
protected:
hsScalar fInitial; /// the position of the playback head
float fInitial; /// the position of the playback head
bool fAutoStart; /// does the animation start automatically?
hsScalar fLoopStart; /// when wrapping a loop, start here
hsScalar fLoopEnd; /// when you reach this point, loop back
float fLoopStart; /// when wrapping a loop, start here
float fLoopEnd; /// when you reach this point, loop back
bool fLoop; /// do we loop?
uint8_t fEaseInType; /// the type (none/linear/spline) of our ease-in curve, if any
uint8_t fEaseOutType; /// the type (none/linear/spline) of our ease-out curve, if any
hsScalar fEaseInLength; /// the length of time our ease-in curve takes
hsScalar fEaseInMin; /// minimum (initial) value of our ease-in
hsScalar fEaseInMax; /// maximum (final) value of our ease-in
hsScalar fEaseOutLength; /// the length of time our ease-out curve takes
hsScalar fEaseOutMin; /// minimum (final) value of our ease-out
hsScalar fEaseOutMax; /// maximum (initial) value of our ease-out
float fEaseInLength; /// the length of time our ease-in curve takes
float fEaseInMin; /// minimum (initial) value of our ease-in
float fEaseInMax; /// maximum (final) value of our ease-in
float fEaseOutLength; /// the length of time our ease-out curve takes
float fEaseOutMin; /// minimum (final) value of our ease-out
float fEaseOutMax; /// maximum (initial) value of our ease-out
// a map from segment names to times
typedef std::map<const char *, float, stringSorter> MarkerMap;
@ -369,7 +369,7 @@ protected:
typedef std::map<const char *, std::pair<float,float>, stringSorter> LoopMap;
LoopMap fLoops;
typedef std::vector<hsScalar> ScalarMap;
typedef std::vector<float> ScalarMap;
ScalarMap fStopPoints; /// vector of stop points
};
@ -387,8 +387,8 @@ public:
plEmoteAnim(const char *animName, double begin, double end, float fadeIn, float fadeOut, BodyUsage bodyUsage);
BodyUsage GetBodyUsage() const;
hsScalar GetFadeIn() const;
hsScalar GetFadeOut() const;
float GetFadeIn() const;
float GetFadeOut() const;
CLASSNAME_REGISTER( plEmoteAnim );
GETINTERFACE_ANY( plEmoteAnim, plATCAnim );
@ -398,8 +398,8 @@ public:
protected:
BodyUsage fBodyUsage; // how much of the body is used by this emote?
hsScalar fFadeIn; // how fast to fade in the emote
hsScalar fFadeOut; // how fast to fade out the emote
float fFadeIn; // how fast to fade in the emote
float fFadeOut; // how fast to fade out the emote
};
//////////////////

View File

@ -91,7 +91,7 @@ extern const char *gGlobalChannelName = nil;
// ctor -------------------------------------------------------------------
// -----
plAGAnimInstance::plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master,
hsScalar blend, uint16_t blendPriority, hsBool cache,
float blend, uint16_t blendPriority, hsBool cache,
bool useAmplitude)
: fAnimation(anim),
fMaster(master),
@ -214,7 +214,7 @@ void plAGAnimInstance::IRegisterDetach(const char *channelName, plAGChannel *cha
// SetCurrentTime ---------------------------------------------------------------
// ---------------
void plAGAnimInstance::SetCurrentTime(hsScalar localT, hsBool jump /* = false */)
void plAGAnimInstance::SetCurrentTime(float localT, hsBool jump /* = false */)
{
if (fTimeConvert)
fTimeConvert->SetCurrentAnimTime(localT, jump);
@ -222,11 +222,11 @@ void plAGAnimInstance::SetCurrentTime(hsScalar localT, hsBool jump /* = false */
// SeekRelative ------------------------------------
// -------------
void plAGAnimInstance::SeekRelative (hsScalar delta, hsBool jump)
void plAGAnimInstance::SeekRelative (float delta, hsBool jump)
{
if(fTimeConvert)
{
hsScalar now = fTimeConvert->CurrentAnimTime();
float now = fTimeConvert->CurrentAnimTime();
fTimeConvert->SetCurrentAnimTime (now + delta, jump);
}
}
@ -281,7 +281,7 @@ void plAGAnimInstance::DetachChannels()
// SetBlend ---------------------------------------
// ---------
hsScalar plAGAnimInstance::SetBlend(hsScalar blend)
float plAGAnimInstance::SetBlend(float blend)
{
float oldBlend = fBlend.Value(0.0, true);
if(oldBlend != blend &&
@ -298,14 +298,14 @@ hsScalar plAGAnimInstance::SetBlend(hsScalar blend)
// GetBlend -------------------------
// ---------
hsScalar plAGAnimInstance::GetBlend()
float plAGAnimInstance::GetBlend()
{
return fBlend.Value(0);
}
// SetAmplitude -------------------------------------
// -------------
hsScalar plAGAnimInstance::SetAmplitude(hsScalar amp)
float plAGAnimInstance::SetAmplitude(float amp)
{
if(fAmplitude.Get() != -1.0f)
{
@ -316,7 +316,7 @@ hsScalar plAGAnimInstance::SetAmplitude(hsScalar amp)
// GetAmplitude -------------------------
// -------------
hsScalar plAGAnimInstance::GetAmplitude()
float plAGAnimInstance::GetAmplitude()
{
return fAmplitude.Value(0);
}
@ -431,10 +431,10 @@ void plAGAnimInstance::AttachCallbacks(plOneShotCallbacks *callbacks)
// ProcessFade -------------------------------------
// ------------
void plAGAnimInstance::ProcessFade(hsScalar elapsed)
void plAGAnimInstance::ProcessFade(float elapsed)
{
if (fFadeBlend) {
hsScalar newBlend = ICalcFade(fFadeBlend, GetBlend(), fFadeBlendGoal, fFadeBlendRate, elapsed);
float newBlend = ICalcFade(fFadeBlend, GetBlend(), fFadeBlendGoal, fFadeBlendRate, elapsed);
SetBlend(newBlend);
if(fFadeDetach && (newBlend == fFadeBlendGoal) && (fFadeBlendGoal == 0.0f) )
{
@ -444,19 +444,19 @@ void plAGAnimInstance::ProcessFade(hsScalar elapsed)
}
if (fFadeAmp && fAmplitude.Get() != -1.0f) {
hsScalar curAmp = GetAmplitude();
hsScalar newAmp = ICalcFade(fFadeAmp, curAmp, fFadeAmpGoal, fFadeAmpRate, elapsed);
float curAmp = GetAmplitude();
float newAmp = ICalcFade(fFadeAmp, curAmp, fFadeAmpGoal, fFadeAmpRate, elapsed);
SetAmplitude(newAmp);
}
}
// ICalcFade ---------------------------------------------------------------------
// ----------
hsScalar plAGAnimInstance::ICalcFade(hsBool &fade, hsScalar curVal, hsScalar goal,
hsScalar rate, hsScalar elapsed)
float plAGAnimInstance::ICalcFade(hsBool &fade, float curVal, float goal,
float rate, float elapsed)
{
hsScalar newVal;
hsScalar curStep = rate * elapsed;
float newVal;
float curStep = rate * elapsed;
if(rate > 0) {
newVal = std::min(goal, curVal + curStep);
} else {
@ -473,21 +473,21 @@ hsScalar plAGAnimInstance::ICalcFade(hsBool &fade, hsScalar curVal, hsScalar goa
// FadeAndDetach -------------------------------------------------
// --------------
void plAGAnimInstance::FadeAndDetach(hsScalar goal, hsScalar rate)
void plAGAnimInstance::FadeAndDetach(float goal, float rate)
{
ISetupFade(goal, rate, true, kFadeBlend);
}
// Fade --------------------------------------------------------------------------------
// -----
void plAGAnimInstance::Fade(hsScalar goal, hsScalar rate, uint8_t type /* = kFadeBlend */)
void plAGAnimInstance::Fade(float goal, float rate, uint8_t type /* = kFadeBlend */)
{
ISetupFade(goal, rate, false, type);
}
// ISetupFade --------------------------------------------------------------------------
// -----------
void plAGAnimInstance::ISetupFade(hsScalar goal, hsScalar rate, bool detach, uint8_t type)
void plAGAnimInstance::ISetupFade(float goal, float rate, bool detach, uint8_t type)
{
if (rate == 0)
{
@ -509,7 +509,7 @@ void plAGAnimInstance::ISetupFade(hsScalar goal, hsScalar rate, bool detach, uin
rate = (rate > 0 ? rate : -rate); // For old code that sends negative values
hsScalar curVal = 0;
float curVal = 0;
switch (type)
{
case kFadeBlend:

View File

@ -98,7 +98,7 @@ public:
This attaches the animation channels to the channels of
the master modifier and creates all the bookkeeping structures
necessary to undo it later. */
plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master, hsScalar blend, uint16_t blendPriority, hsBool cache, bool useAmplitude);
plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master, float blend, uint16_t blendPriority, hsBool cache, bool useAmplitude);
/** Destructor. Removes the animation from the scene objects it's attached to. */
virtual ~plAGAnimInstance();
@ -112,7 +112,7 @@ public:
/** Set the speed of the animation. This is expressed as a fraction of
the speed with which the animation was defined. */
void SetSpeed(hsScalar speed) { if (fTimeConvert) fTimeConvert->SetSpeed(speed); };
void SetSpeed(float speed) { if (fTimeConvert) fTimeConvert->SetSpeed(speed); };
// \{
/**
@ -126,8 +126,8 @@ public:
yet been seen to have any practical utility whatsoever. Note that
even if an animation has a blend strength of 1.0, it may have another
animation on top/downstream from it that is masking it completely. */
hsScalar SetBlend(hsScalar blend);
hsScalar GetBlend();
float SetBlend(float blend);
float GetBlend();
// \}
/** Set the strength of the animation with respect to its 0th frame.
@ -135,9 +135,9 @@ public:
Animations must be designed to use this: frame 0 of the animation
must be a reasonable "default pose" as it will be blended with the
current frame of the animation to produce the result. */
hsScalar SetAmplitude(hsScalar amp);
float SetAmplitude(float amp);
/** Get the current strength of the animation. */
hsScalar GetAmplitude();
float GetAmplitude();
/** Make this animation loop (or not.) Note that the instance can loop
or not without regard to whether the plAGAnim it is based on loops. */
@ -159,20 +159,20 @@ public:
Note that this time is in animation local time, not global time.
The "jump" parameter specifies whether or not to fire callbacks
that occur between the current time and the target time. */
void SetCurrentTime(hsScalar newLocalTime, hsBool jump = false);
void SetCurrentTime(float newLocalTime, hsBool jump = false);
/** Move the playback head by the specified relative amount within
the animation. This may cause looping. If the beginning or end
of the animation is reached an looping is not on, the movement
will pin.
\param jump if true, don't look for callbacks between old time and TRACKED_NEW */
void SeekRelative(hsScalar delta, hsBool jump);
void SeekRelative(float delta, hsBool jump);
/** Gradually fade the blend strength or amplitude of the animation.
\param goal is the desired blend strength
\param rate is in blend units per second
\type is either kFadeBlend or kFadeAmp */
void Fade(hsScalar goal, hsScalar rate, uint8_t type = kFadeBlend);
void Fade(float goal, float rate, uint8_t type = kFadeBlend);
/** Fade the animation and detach it after the fade is complete.
Extremely useful for situations where the controlling logic
@ -180,7 +180,7 @@ public:
out gradually.
\deprecated
*/
void FadeAndDetach(hsScalar goal, hsScalar rate);
void FadeAndDetach(float goal, float rate);
/** Has the animation terminated of natural causes?
Primarily used to see if an animation has played all the
@ -218,11 +218,11 @@ public:
in the animation and will be sent when playback passes that time. */
void AttachCallbacks(plOneShotCallbacks *callbacks);
void ProcessFade(hsScalar elapsed); // process any outstanding fades
void ProcessFade(float elapsed); // process any outstanding fades
void SearchForGlobals(); // Util function to setup SDL channels
protected:
/** Set up bookkeeping for a fade. */
void ISetupFade(hsScalar goal, hsScalar rate, bool detach, uint8_t type);
void ISetupFade(float goal, float rate, bool detach, uint8_t type);
void IRegisterDetach(const char *channelName, plAGChannel *channel);
@ -244,15 +244,15 @@ protected:
plAnimTimeConvert *fTimeConvert;
hsBool fFadeBlend; /// we are fading the blend
hsScalar fFadeBlendGoal; /// what blend level we're trying to reach
hsScalar fFadeBlendRate; /// how fast are we fading in blend units per second (1 blend unit = full)
float fFadeBlendGoal; /// what blend level we're trying to reach
float fFadeBlendRate; /// how fast are we fading in blend units per second (1 blend unit = full)
hsBool fFadeDetach; /// detach after fade is finished? (only used for blend fades)
hsBool fFadeAmp; /// we are fading the amplitude
hsScalar fFadeAmpGoal; /// amplitude we're trying to reach
hsScalar fFadeAmpRate; /// how faster we're fading in blend units per second
float fFadeAmpGoal; /// amplitude we're trying to reach
float fFadeAmpRate; /// how faster we're fading in blend units per second
hsScalar ICalcFade(hsBool &fade, hsScalar curVal, hsScalar goal, hsScalar rate, hsScalar elapsed);
float ICalcFade(hsBool &fade, float curVal, float goal, float rate, float elapsed);
};

View File

@ -218,7 +218,7 @@ plProfile_CreateTimer("AnimatingPhysicals", "Animation", AnimatingPhysicals);
plProfile_CreateTimer("StoppedAnimPhysicals", "Animation", StoppedAnimPhysicals);
// IEVAL
hsBool plAGMasterMod::IEval(double secs, hsScalar del, uint32_t dirty)
hsBool plAGMasterMod::IEval(double secs, float del, uint32_t dirty)
{
if (fFirstEval)
{
@ -239,7 +239,7 @@ hsBool plAGMasterMod::IEval(double secs, hsScalar del, uint32_t dirty)
}
// APPLYANIMATIONS
void plAGMasterMod::ApplyAnimations(double time, hsScalar elapsed)
void plAGMasterMod::ApplyAnimations(double time, float elapsed)
{
plProfile_BeginLap(ApplyAnimation, this->GetKey()->GetUoid().GetObjectName());
@ -387,7 +387,7 @@ plAGModifier * plAGMasterMod::IFindChannelMod(const plSceneObject *SO, const cha
// ATTACHANIMATIONBLENDED(anim, blend)
plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(plAGAnim *anim,
hsScalar blendFactor /* = 0 */,
float blendFactor /* = 0 */,
uint16_t blendPriority /* plAGMedBlendPriority */,
hsBool cache /* = false */)
{
@ -421,7 +421,7 @@ plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(plAGAnim *anim,
}
// ATTACHANIMATIONBLENDED(name, blend)
plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(const char *name, hsScalar blendFactor /* = 0 */, uint16_t blendPriority, hsBool cache /* = false */)
plAGAnimInstance * plAGMasterMod::AttachAnimationBlended(const char *name, float blendFactor /* = 0 */, uint16_t blendPriority, hsBool cache /* = false */)
{
plAGAnimInstance *instance = nil;
plAGAnim *anim = plAGAnim::FindAnim(name);
@ -482,7 +482,7 @@ plAGAnimInstance * plAGMasterMod::FindAnimInstance(const char *name)
}
// FINDORATTACHINSTANCE
plAGAnimInstance * plAGMasterMod::FindOrAttachInstance(const char *name, hsScalar blendFactor)
plAGAnimInstance * plAGMasterMod::FindOrAttachInstance(const char *name, float blendFactor)
{
plAGAnimInstance *result = FindAnimInstance(name);
if(result)

View File

@ -106,13 +106,13 @@ public:
/** Attach the given animation object with the given blend factor.
If there's no animation already attached to blend with, the
animation will be attached at full strength. */
plAGAnimInstance *AttachAnimationBlended(plAGAnim *anim, hsScalar blendFactor = 0,
plAGAnimInstance *AttachAnimationBlended(plAGAnim *anim, float blendFactor = 0,
uint16_t blendPriority = kAGMedBlendPriority,
hsBool cache = false);
/** Look up the given animation by name and attach it
with the given blend factor. */
plAGAnimInstance *AttachAnimationBlended(const char *name, hsScalar blendFactor = 0,
plAGAnimInstance *AttachAnimationBlended(const char *name, float blendFactor = 0,
uint16_t blendPriority = kAGMedBlendPriority,
hsBool cache = false);
@ -152,7 +152,7 @@ public:
attached, it could be anywhere, including buried under
a bunch of other animations. If it's important that it be
on top of the stack, you may need to detach it first. */
plAGAnimInstance *FindOrAttachInstance(const char *name, hsScalar blendFactor);
plAGAnimInstance *FindOrAttachInstance(const char *name, float blendFactor);
/** Return the number of animations available. */
int GetNumAnimations();
@ -168,7 +168,7 @@ public:
/** Apply all our animations to all our parts.
\param timeNow is the current world time
\param elapsed is the time since the previous frame */
void ApplyAnimations(double timeNow, hsScalar elapsed);
void ApplyAnimations(double timeNow, float elapsed);
/** Runs through our anims and applies them, without
processing fades. This is used when we load in anim
@ -220,7 +220,7 @@ protected:
plAGModifier * ICacheChannelMod(plAGModifier *mod) const;
plAGModifier * IFindChannelMod(const plSceneObject *obj, const char *name) const;
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
virtual hsBool IEval(double secs, float del, uint32_t dirty);
virtual void IApplyDynamic() {}; // dummy function required by base class

View File

@ -191,7 +191,7 @@ void plAGMasterSDLModifier::ISetCurrentStateFrom(const plStateDataRecord* srcSta
if (objAGMaster->fIsGrouped && objAGMaster->fMsgForwarder)
{
hsScalar animTimeFromWorldTime = (objAGMaster->GetNumATCAnimations() > 0) ? objAGMaster->GetATCAnimInstance(0)->GetTimeConvert()->WorldToAnimTimeNoUpdate(time) : 0.0f;
float animTimeFromWorldTime = (objAGMaster->GetNumATCAnimations() > 0) ? objAGMaster->GetATCAnimInstance(0)->GetTimeConvert()->WorldToAnimTimeNoUpdate(time) : 0.0f;
plAGCmdMsg *msg = TRACKED_NEW plAGCmdMsg();
msg->SetCmd(plAGCmdMsg::kSetAnimTime);

View File

@ -133,7 +133,7 @@ void plAGModifier::Apply(double time) const
// IEVAL
// Apply our channels to our scene object
hsBool plAGModifier::IEval(double time, hsScalar delta, uint32_t dirty)
hsBool plAGModifier::IEval(double time, float delta, uint32_t dirty)
{
if(fAutoApply) {
// Apply(time, delta);

View File

@ -144,7 +144,7 @@ protected:
hsBool fEnabled; // if not enabled, we don't eval any of our anims
// APPLYING THE ANIMATION
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
virtual hsBool IEval(double secs, float del, uint32_t dirty);
virtual hsBool IHandleCmd(plAnimCmdMsg* modMsg) { return false; } // only plAGMasterMod should handle these
virtual void IApplyDynamic() {}; // dummy function required by base class

View File

@ -84,9 +84,9 @@ void plAntiGravAction::apply(Havok::Subspace &space, Havok::hkTime time)
fAnimPosVel.fZ = vel.fZ;
hsVector3 linCurrent(0.f, 0.f, 0.f);
hsScalar angCurrent = 0.f;
float angCurrent = 0.f;
if (fCurrentRegion != nil)
fCurrentRegion->GetCurrent(fPhysical, linCurrent, angCurrent, (hsScalar)elapsed);
fCurrentRegion->GetCurrent(fPhysical, linCurrent, angCurrent, (float)elapsed);
int numContacts = fPhysical->GetNumContacts();
fHadContacts = (numContacts > 0);
@ -97,7 +97,7 @@ void plAntiGravAction::apply(Havok::Subspace &space, Havok::hkTime time)
for (i = 0; i < numContacts; i++)
{
const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i);
hsScalar dotUp = straightUp.dot(contact->m_normal);
float dotUp = straightUp.dot(contact->m_normal);
if (dotUp > .5)
{
fOnGround = true;
@ -109,7 +109,7 @@ void plAntiGravAction::apply(Havok::Subspace &space, Havok::hkTime time)
fPhysical->SetAngularVelocitySim(hsVector3(0.f, 0.f, fAnimAngVel + fTurnStr + angCurrent));
}
void plAntiGravAction::SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight)
void plAntiGravAction::SetSurface(plSwimRegionInterface *region, float surfaceHeight)
{
fCurrentRegion = region;
if (region != nil)

View File

@ -59,8 +59,8 @@ public:
/** Called by Havok at substep frequency. */
void apply(Havok::Subspace &s, Havok::hkTime time);
void SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight);
hsScalar GetBuoyancy() { return fBuoyancy; }
void SetSurface(plSwimRegionInterface *region, float surfaceHeight);
float GetBuoyancy() { return fBuoyancy; }
hsBool IsOnGround() { return fOnGround; }
hsBool HadContacts() { return fHadContacts; }
@ -69,8 +69,8 @@ protected:
hsBool fOnGround;
hsBool fHadContacts;
hsScalar fBuoyancy;
hsScalar fSurfaceHeight;
float fBuoyancy;
float fSurfaceHeight;
plSwimRegionInterface *fCurrentRegion;
};

View File

@ -184,7 +184,7 @@ void plArmatureModBase::RemoveTarget(plSceneObject* so)
plAGMasterMod::RemoveTarget(so);
}
hsBool plArmatureModBase::IEval(double time, hsScalar elapsed, uint32_t dirty)
hsBool plArmatureModBase::IEval(double time, float elapsed, uint32_t dirty)
{
if (IsFinal())
{
@ -436,7 +436,7 @@ void plArmatureModBase::AdjustLOD()
hsMatrix44 l2w = SO->GetLocalToWorld();
hsPoint3 ourPos = l2w.GetTranslate();
hsPoint3 delta = ourPos - camPos;
hsScalar distanceSquared = delta.MagnitudeSquared();
float distanceSquared = delta.MagnitudeSquared();
if (distanceSquared < fLODDistance * fLODDistance)
SetLOD(__max(0, fMinLOD));
else if (distanceSquared < fLODDistance * fLODDistance * 4.0)
@ -628,8 +628,8 @@ void plArmatureModBase::IEnableBones(int lod, hsBool enable)
const char *plArmatureMod::BoneStrings[] = {"Male", "Female", "Critter", "Actor"};
const hsScalar plArmatureMod::kAvatarInputSynchThreshold = 10.f;
hsScalar plArmatureMod::fMouseTurnSensitivity = 1.f;
const float plArmatureMod::kAvatarInputSynchThreshold = 10.f;
float plArmatureMod::fMouseTurnSensitivity = 1.f;
hsBool plArmatureMod::fClickToTurn = true;
void plArmatureMod::IInitDefaults()
@ -1548,7 +1548,7 @@ void plArmatureMod::ILinkToPersonalAge()
pMsg->Send();
}
hsBool plArmatureMod::IEval(double time, hsScalar elapsed, uint32_t dirty)
hsBool plArmatureMod::IEval(double time, float elapsed, uint32_t dirty)
{
if (IsFinal())
{
@ -2285,12 +2285,12 @@ void plArmatureMod::SetJumpKeyDown()
SetInputFlag(B_CONTROL_JUMP, true);
}
hsScalar plArmatureMod::GetTurnStrength() const
float plArmatureMod::GetTurnStrength() const
{
return GetKeyTurnStrength() + GetAnalogTurnStrength();
}
hsScalar plArmatureMod::GetKeyTurnStrength() const
float plArmatureMod::GetKeyTurnStrength() const
{
if (StrafeKeyDown())
return 0.f;
@ -2298,12 +2298,12 @@ hsScalar plArmatureMod::GetKeyTurnStrength() const
return (TurnLeftKeyDown() ? 1.f : 0.f) + (TurnRightKeyDown() ? -1.f: 0.f);
}
hsScalar plArmatureMod::GetAnalogTurnStrength() const
float plArmatureMod::GetAnalogTurnStrength() const
{
if (StrafeKeyDown())
return 0.f;
hsScalar elapsed = hsTimer::GetDelSysSeconds();
float elapsed = hsTimer::GetDelSysSeconds();
if (elapsed > 0)
return fMouseFrameTurnStrength / elapsed;
else
@ -2425,7 +2425,7 @@ void plArmatureMod::ISetupMarkerCallbacks(plATCAnim *anim, plAnimTimeConvert *at
for (i = 0; i < markers.size(); i++)
{
hsScalar time = -1;
float time = -1;
hsBool isLeft = false;
if (strstr(markers[i], "SndLeftFootDown") == markers[i])
{

View File

@ -112,7 +112,7 @@ public:
virtual hsBool MsgReceive(plMessage* msg);
virtual void AddTarget(plSceneObject* so);
virtual void RemoveTarget(plSceneObject* so);
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
virtual hsBool IEval(double secs, float del, uint32_t dirty);
virtual void Read(hsStream *stream, hsResMgr *mgr);
virtual void Write(hsStream *stream, hsResMgr *mgr);
@ -207,7 +207,7 @@ public:
virtual hsBool MsgReceive(plMessage* msg);
virtual void AddTarget(plSceneObject* so);
virtual void RemoveTarget(plSceneObject* so);
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
virtual hsBool IEval(double secs, float del, uint32_t dirty);
virtual void Read(hsStream *stream, hsResMgr *mgr);
virtual void Write(hsStream *stream, hsResMgr *mgr);
@ -253,9 +253,9 @@ public:
void SetInputFlag(int which, hsBool status);
void ClearInputFlags(bool saveAlwaysRun, bool clearBackup);
hsBool HasMovementFlag() const; // Is any *movement* input flag on?
hsScalar GetTurnStrength() const;
hsScalar GetKeyTurnStrength() const;
hsScalar GetAnalogTurnStrength() const;
float GetTurnStrength() const;
float GetKeyTurnStrength() const;
float GetAnalogTurnStrength() const;
void SetReverseFBOnIdle(bool val);
hsBool IsFBReversed();
@ -324,8 +324,8 @@ public:
void SendBehaviorNotify(uint32_t type, hsBool start = true) { IFireBehaviorNotify(type,start); }
// Discovered a bug which makes these values horribly out of scale. So we do the rescale
// in the Get/Set functions for backwards compatability.
static void SetMouseTurnSensitivity(hsScalar val) { fMouseTurnSensitivity = val / 150.f; }
static hsScalar GetMouseTurnSensitivity() { return fMouseTurnSensitivity * 150.f; }
static void SetMouseTurnSensitivity(float val) { fMouseTurnSensitivity = val / 150.f; }
static float GetMouseTurnSensitivity() { return fMouseTurnSensitivity * 150.f; }
static void SetSpawnPointOverride( const char *overrideObjName );
static void WindowActivate(bool active);
@ -361,11 +361,11 @@ public:
};
plMatrixDelayedCorrectionApplicator *fBoneRootAnimator;
static const hsScalar kAvatarInputSynchThreshold;
static const float kAvatarInputSynchThreshold;
static hsBool fClickToTurn;
static const char *BoneStrings[];
void SetPhysicalDims(hsScalar height, hsScalar width) { fPhysHeight = height; fPhysWidth = width; }
void SetPhysicalDims(float height, float width) { fPhysHeight = height; fPhysWidth = width; }
void SetBodyAgeName(const char* ageName) {if (ageName) fBodyAgeName = ageName; else fBodyAgeName = "";}
void SetBodyFootstepSoundPage(const char* pageName) {if (pageName) fBodyFootstepSoundPage = pageName; else fBodyFootstepSoundPage = "";}
@ -393,11 +393,11 @@ protected:
hsBitVector fMoveFlagsBackup; // a copy of fMoveFlags
typedef std::vector<plControlEventMsg*> CtrlMessageVec;
CtrlMessageVec fQueuedCtrlMessages; // input messages we haven't processed
hsScalar fMouseFrameTurnStrength; // Sum turnage from mouse delta messages since last eval.
float fMouseFrameTurnStrength; // Sum turnage from mouse delta messages since last eval.
plKey fFootSoundSOKey; // The Scene Object we attach to targets for footstep sounds
plKey fLinkSoundSOKey; // Same thing for linking... wwwwawAWAWAwawa...
plKey fLinkInAnimKey; // Set when we link out, this is the anim to play (backwards) when we link in.
static hsScalar fMouseTurnSensitivity;
static float fMouseTurnSensitivity;
plArmatureUpdateMsg *fUpdateMsg;
// Trying to be a good lad here and align all our bools and bytes...
@ -481,6 +481,6 @@ protected:
BoneMapImp *fImp; // the thing that actually holds our map
};
#define TWO_PI (hsScalarPI * 2)
#define TWO_PI (M_PI * 2)
#endif //plArmatureMod_inc

View File

@ -72,9 +72,9 @@ void plArmatureBehavior::Process(double time, float elapsed)
{
}
void plArmatureBehavior::SetStrength(hsScalar val, hsScalar rate /* = 0.f */)
void plArmatureBehavior::SetStrength(float val, float rate /* = 0.f */)
{
hsScalar oldStrength = GetStrength();
float oldStrength = GetStrength();
if (rate == 0)
fStrength.Set(val);
else
@ -88,7 +88,7 @@ void plArmatureBehavior::SetStrength(hsScalar val, hsScalar rate /* = 0.f */)
IStop();
}
hsScalar plArmatureBehavior::GetStrength()
float plArmatureBehavior::GetStrength()
{
return fStrength.Value();
}
@ -101,7 +101,7 @@ void plArmatureBehavior::Rewind()
void plArmatureBehavior::DumpDebug(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt)
{
hsScalar strength = GetStrength();
float strength = GetStrength();
const char *onOff = strength > 0 ? "on" : "off";
char blendBar[11] = "||||||||||";
int bars = (int)__min(10 * strength, 10);

View File

@ -62,8 +62,8 @@ public:
void Init(plAGAnim *anim, hsBool loop, plArmatureBrain *brain, plArmatureModBase *armature, uint8_t index);
virtual void Process(double time, float elapsed);
virtual void SetStrength(hsScalar val, hsScalar rate = 0.f); // default instant change
virtual hsScalar GetStrength();
virtual void SetStrength(float val, float rate = 0.f); // default instant change
virtual float GetStrength();
virtual void Rewind();
void DumpDebug(int &x, int &y, int lineHeight, char *strBuf, plDebugText &debugTxt);
@ -77,7 +77,7 @@ protected:
plAGAnimInstance *fAnim;
plArmatureModBase *fArmature;
plArmatureBrain *fBrain;
plTimedValue<hsScalar> fStrength;
plTimedValue<float> fStrength;
uint8_t fIndex;
virtual void IStart();

View File

@ -79,7 +79,7 @@ plArmatureBrain::~plArmatureBrain()
delete fCurTask;
}
hsBool plArmatureBrain::Apply(double timeNow, hsScalar elapsed)
hsBool plArmatureBrain::Apply(double timeNow, float elapsed)
{
IProcessTasks(timeNow, elapsed);
fArmature->ApplyAnimations(timeNow, elapsed);
@ -167,7 +167,7 @@ hsBool plArmatureBrain::MsgReceive(plMessage * msg)
return false;
}
void plArmatureBrain::IProcessTasks(double time, hsScalar elapsed)
void plArmatureBrain::IProcessTasks(double time, float elapsed)
{
if (!fCurTask || !fCurTask->Process(plArmatureMod::ConvertNoRef(fArmature), this, time, elapsed))
{

View File

@ -71,7 +71,7 @@ public:
CLASSNAME_REGISTER( plArmatureBrain );
GETINTERFACE_ANY( plArmatureBrain, plCreatable );
virtual hsBool Apply(double timeNow, hsScalar elapsed);
virtual hsBool Apply(double timeNow, float elapsed);
virtual void Activate(plArmatureModBase *armature);
virtual void Deactivate() {}
virtual void Suspend() {}
@ -88,7 +88,7 @@ public:
virtual hsBool MsgReceive(plMessage *msg);
protected:
virtual void IProcessTasks(double time, hsScalar elapsed);
virtual void IProcessTasks(double time, float elapsed);
virtual hsBool IHandleTaskMsg(plAvTaskMsg *msg);
typedef std::deque<plAvTask *> plAvTaskQueue;

View File

@ -210,7 +210,7 @@ void plAvBrainClimb::Deactivate()
}
// APPLY
hsBool plAvBrainClimb::Apply(double time, hsScalar elapsed)
hsBool plAvBrainClimb::Apply(double time, float elapsed)
{
hsBool result = true;

View File

@ -98,7 +98,7 @@ public:
virtual void Activate(plArmatureModBase *avMod);
virtual void Deactivate();
virtual hsBool Apply(double timeNow, hsScalar elapsed);
virtual hsBool Apply(double timeNow, float elapsed);
virtual void SaveToSDL(plStateDataRecord *sdl);
virtual void LoadFromSDL(const plStateDataRecord *sdl);

View File

@ -93,8 +93,8 @@ public:
virtual hsBool PreCondition(double time, float elapsed) {return true;}
hsScalar GetAnimLength() {return (fAnim->GetAnimation()->GetLength());}
void SetAnimTime(hsScalar time) {fAnim->SetCurrentTime(time, true);}
float GetAnimLength() {return (fAnim->GetAnimation()->GetLength());}
void SetAnimTime(float time) {fAnim->SetCurrentTime(time, true);}
std::string Name() const {return fName;}
std::string AnimName() const {return fAnimName;}
@ -131,7 +131,7 @@ plAvBrainCritter::plAvBrainCritter(): fCallbackAction(nil), fCurMode(kIdle), fNe
fLocallyControlled(false), fAvoidingAvatars(false), fFinalGoalPos(0, 0, 0), fImmediateGoalPos(0, 0, 0), fDotGoal(0),
fAngRight(0)
{
SightCone(hsScalarPI/2); // 90deg
SightCone(M_PI/2); // 90deg
StopDistance(1);
SightDistance(10);
HearingDistance(10);
@ -154,7 +154,7 @@ plAvBrainCritter::~plAvBrainCritter()
///////////////////////////////////////////////////////////////////////////////
hsBool plAvBrainCritter::Apply(double time, hsScalar elapsed)
hsBool plAvBrainCritter::Apply(double time, float elapsed)
{
// update internal pathfinding variables
IEvalGoal();
@ -327,7 +327,7 @@ bool plAvBrainCritter::AtGoal() const
return (finalGoalVec.MagnitudeSquared() <= fStopDistanceSquared);
}
void plAvBrainCritter::SightCone(hsScalar coneRad)
void plAvBrainCritter::SightCone(float coneRad)
{
fSightConeAngle = coneRad;
@ -339,7 +339,7 @@ void plAvBrainCritter::SightCone(hsScalar coneRad)
fSightConeDotMin = straightVector * viewVector;
}
void plAvBrainCritter::HearingDistance(hsScalar hearDis)
void plAvBrainCritter::HearingDistance(float hearDis)
{
fHearingDistance = hearDis;
fHearingDistanceSquared = fHearingDistance * fHearingDistance;
@ -533,7 +533,7 @@ void plAvBrainCritter::IStartBehavior()
// if we start at a random point, do so
if (behavior->RandomStartPoint())
{
hsScalar newStart = sRandom.RandZeroToOne() * behavior->GetAnimLength();
float newStart = sRandom.RandZeroToOne() * behavior->GetAnimLength();
behavior->SetAnimTime(newStart);
}
@ -584,7 +584,7 @@ void plAvBrainCritter::IEvalGoal()
hsVector3 avVec(creaturePos - avPos);
avVec.Normalize();
hsScalar dotAv = avVec * goalVec;
float dotAv = avVec * goalVec;
if (dotAv > 0.5f) // within a 45deg angle in front of us
{
// a player is in the way, so we will change our "goal" to a 90deg angle from the player
@ -616,7 +616,7 @@ void plAvBrainCritter::IEvalGoal()
}
}
hsScalar plAvBrainCritter::IGetTurnStrength(double time) const
float plAvBrainCritter::IGetTurnStrength(double time) const
{
if (!RunningBehavior(kDefaultRunBehName))
return 0.0f;
@ -673,7 +673,7 @@ bool plAvBrainCritter::ICanSeeAvatar(plArmatureMod* avatar) const
const plSceneObject* creatureObj = fArmature->GetTarget(0);
hsVector3 view(creatureObj->GetCoordinateInterface()->GetLocalToWorld().GetAxis(hsMatrix44::kView));
hsScalar avDot = view * avVec;
float avDot = view * avVec;
if (avDot < fSightConeDotMin)
return false; // out of our cone of view
return true;
@ -701,7 +701,7 @@ bool plAvBrainCritter::ICanHearAvatar(plArmatureMod* avatar) const
fAvMod->GetPositionAndRotationSim(&creaturePos, &creatureRot);
hsVector3 avVec(creaturePos - avPos);
hsScalar distSq = avVec.MagnitudeSquared();
float distSq = avVec.MagnitudeSquared();
if (distSq <= fHearingDistanceSquared)
return true; // within our normal hearing distance
else if (isLoud && (distSq <= fLoudHearingDistanceSquared))

View File

@ -75,7 +75,7 @@ public:
CLASSNAME_REGISTER(plAvBrainCritter);
GETINTERFACE_ANY(plAvBrainCritter, plArmatureBrain);
hsBool Apply(double time, hsScalar elapsed);
hsBool Apply(double time, float elapsed);
hsBool MsgReceive(plMessage* msg);
virtual void Activate(plArmatureModBase* avMod);
@ -104,15 +104,15 @@ public:
bool AvoidingAvatars() const {return fAvoidingAvatars;}
bool AtGoal() const;
void StopDistance(hsScalar stopDistance) {fStopDistance = stopDistance; fStopDistanceSquared = fStopDistance * fStopDistance;}
hsScalar StopDistance() const {return fStopDistance;}
void StopDistance(float stopDistance) {fStopDistance = stopDistance; fStopDistanceSquared = fStopDistance * fStopDistance;}
float StopDistance() const {return fStopDistance;}
void SightCone(hsScalar coneRad);
hsScalar SightCone() const {return fSightConeAngle;}
void SightDistance(hsScalar sightDis) {fSightDistance = sightDis; fSightDistanceSquared = fSightDistance * fSightDistance;}
hsScalar SightDistance() const {return fSightDistance;}
void HearingDistance(hsScalar hearDis);
hsScalar HearingDistance() const {return fHearingDistance;}
void SightCone(float coneRad);
float SightCone() const {return fSightConeAngle;}
void SightDistance(float sightDis) {fSightDistance = sightDis; fSightDistanceSquared = fSightDistance * fSightDistance;}
float SightDistance() const {return fSightDistance;}
void HearingDistance(float hearDis);
float HearingDistance() const {return fHearingDistance;}
bool CanSeeAvatar(unsigned long id) const;
bool CanHearAvatar(unsigned long id) const;
@ -142,7 +142,7 @@ protected:
void IStartBehavior(); // fades in and initializes fNextMode, then sets fCurMode
void IProcessBehavior(double time, float elapsed); // processes fCurMode
void IEvalGoal();
hsScalar IGetTurnStrength(double time) const;
float IGetTurnStrength(double time) const;
std::vector<unsigned long> IGetAgePlayerIDList() const;
@ -162,19 +162,19 @@ protected:
bool fAvoidingAvatars; // are we avoiding avatars to the best of our ability when pathfinding?
hsPoint3 fFinalGoalPos; // the location we are pathfinding to
hsPoint3 fImmediateGoalPos; // the location of the point we are immediately going towards (not necessarily our final goal)
hsScalar fDotGoal; // dot product to our goal
hsScalar fAngRight; // dot product of our local right-hand vector to our goal
float fDotGoal; // dot product to our goal
float fAngRight; // dot product of our local right-hand vector to our goal
hsScalar fStopDistance; // how close we need to get to our goal before stopping
hsScalar fStopDistanceSquared; // the above, squared, for faster calculation
float fStopDistance; // how close we need to get to our goal before stopping
float fStopDistanceSquared; // the above, squared, for faster calculation
hsScalar fSightConeAngle; // in radians, the width of the cone we can see (/2 on each side of where we face, so 90deg cone is 45deg on each side)
hsScalar fSightConeDotMin; // the minimum dot-product of the cone we can see (1 - straight ahead only, 0 - 90deg either side, -1 - 180 behind, or full 360)
hsScalar fSightDistance; // how far away we can see (cone in front of us)
hsScalar fSightDistanceSquared; // the above, squared, for faster calculation
hsScalar fHearingDistance; // how far away we can hear (360 degrees)
hsScalar fHearingDistanceSquared; // the above, squared, for faster calculation
hsScalar fLoudHearingDistanceSquared; // how far away we can hear loud noises, squared, for faster calculation
float fSightConeAngle; // in radians, the width of the cone we can see (/2 on each side of where we face, so 90deg cone is 45deg on each side)
float fSightConeDotMin; // the minimum dot-product of the cone we can see (1 - straight ahead only, 0 - 90deg either side, -1 - 180 behind, or full 360)
float fSightDistance; // how far away we can see (cone in front of us)
float fSightDistanceSquared; // the above, squared, for faster calculation
float fHearingDistance; // how far away we can hear (360 degrees)
float fHearingDistanceSquared; // the above, squared, for faster calculation
float fLoudHearingDistanceSquared; // how far away we can hear loud noises, squared, for faster calculation
std::map<std::string, std::vector<int> > fUserBehaviors; // string is behavior name, internal vector is the list of behaviors that are randomly picked from

View File

@ -64,7 +64,7 @@ plAvBrainDrive::plAvBrainDrive()
}
// CTOR max velocity, turn rate
plAvBrainDrive::plAvBrainDrive(hsScalar maxVelocity, hsScalar turnRate)
plAvBrainDrive::plAvBrainDrive(float maxVelocity, float turnRate)
: fMaxVelocity(maxVelocity), fTurnRate(turnRate)
{
}
@ -100,17 +100,17 @@ void plAvBrainDrive::IEnablePhysics(bool enable, plKey avKey)
}
// APPLY
hsBool plAvBrainDrive::Apply(double timeNow, hsScalar elapsed)
hsBool plAvBrainDrive::Apply(double timeNow, float elapsed)
{
plSceneObject * avSO = fAvMod->GetTarget(0);
hsScalar eTime = hsTimer::GetDelSysSeconds();
float eTime = hsTimer::GetDelSysSeconds();
hsMatrix44 targetMatrix = avSO->GetLocalToWorld();
hsPoint3 playerPos = targetMatrix.GetTranslate();
hsVector3 view, up, right;
targetMatrix.GetAxis(&view, &up, &right);
hsScalar speed = fMaxVelocity;
hsScalar turn = fTurnRate;
float speed = fMaxVelocity;
float turn = fTurnRate;
if (fAvMod->FastKeyDown())
{
@ -148,7 +148,7 @@ hsBool plAvBrainDrive::Apply(double timeNow, hsScalar elapsed)
hsVector3 rotUp(0,0,1);
hsVector3 rotRight(1,0,0);
hsMatrix44 rot;
hsScalar angle = 0;
float angle = 0;
if ( fAvMod->GetInputFlag( B_CONTROL_ROTATE_RIGHT ) || fAvMod->GetInputFlag( B_CONTROL_ROTATE_LEFT ) || fAvMod->GetInputFlag( A_CONTROL_TURN ) )
{

View File

@ -70,7 +70,7 @@ public:
\param maxVelocity The highest speed this avatar can fly at.
\param turnRate The speed at which we will turn, in radians per second.
*/
plAvBrainDrive(hsScalar maxVelocity, hsScalar turnRate);
plAvBrainDrive(float maxVelocity, float turnRate);
// BRAIN PROTOCOL
@ -81,7 +81,7 @@ public:
virtual void Deactivate();
/** Look at the key states and figure out if and how we should move */
virtual hsBool Apply(double timeNow, hsScalar elapsed); // main control loop. called by avatar eval()
virtual hsBool Apply(double timeNow, float elapsed); // main control loop. called by avatar eval()
// the user brain base handles most of the details of control messages,
// so this function just looks for the special command which gets us out
@ -94,8 +94,8 @@ public:
protected:
void IEnablePhysics(bool enable, plKey avKey);
hsScalar fMaxVelocity;
hsScalar fTurnRate;
float fMaxVelocity;
float fTurnRate;
};
#endif // AVBRAINDRIVE_INC

View File

@ -76,8 +76,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#endif
hsBool plAvBrainGeneric::fForce3rdPerson = true;
const hsScalar plAvBrainGeneric::kDefaultFadeIn = 6.f; // 1/6th of a second to fade in
const hsScalar plAvBrainGeneric::kDefaultFadeOut = 0.f; // instant fade out.
const float plAvBrainGeneric::kDefaultFadeIn = 6.f; // 1/6th of a second to fade in
const float plAvBrainGeneric::kDefaultFadeOut = 0.f; // instant fade out.
// plAvBrainGeneric ----------------
// -----------------
@ -248,7 +248,7 @@ bool plAvBrainGeneric::MatchAnimNames(const char *names[], int count)
// Apply ----------------------------------------------------
// ------
hsBool plAvBrainGeneric::Apply(double time, hsScalar elapsed)
hsBool plAvBrainGeneric::Apply(double time, float elapsed)
{
hsBool result = false;
@ -491,7 +491,7 @@ hsBool plAvBrainGeneric::IProcessFadeOut(double time, float elapsed)
// ISwitchStages ---------------------------------------------------------------------------------------------------
// --------------
hsBool plAvBrainGeneric::ISwitchStages(int oldStageNum, int newStageNum, float delta, hsBool setTime, float newTime,
float fadeNew, hsScalar fadeOld, double worldTime)
float fadeNew, float fadeOld, double worldTime)
{
#ifdef DEBUG_MULTISTAGE
char sbuf[256];

View File

@ -118,8 +118,8 @@ public:
kModeSize = 0xff
} fMode;
static const hsScalar kDefaultFadeIn;
static const hsScalar kDefaultFadeOut;
static const float kDefaultFadeIn;
static const float kDefaultFadeOut;
/** Default constructor for the class factory and descendants. */
plAvBrainGeneric();
@ -154,7 +154,7 @@ public:
virtual void Activate(plArmatureModBase *avMod);
/** Advance the current stage and swap in a new stage if necessary. */
virtual hsBool Apply(double timeNow, hsScalar elapsed);
virtual hsBool Apply(double timeNow, float elapsed);
/** Remove all our stages and release control of the armature. */
virtual void Deactivate();
@ -283,8 +283,8 @@ protected:
hsBool IProcessFadeIn(double time, float elapsed);
hsBool IProcessFadeOut(double time, float elapsed);
hsBool ISwitchStages(int oldStage, int newStage, float delta, hsBool setTime, hsScalar newTime,
float fadeNew, hsScalar fadeOld, double worldTime);
hsBool ISwitchStages(int oldStage, int newStage, float delta, hsBool setTime, float newTime,
float fadeNew, float fadeOld, double worldTime);
void IEnterMoveMode(double time); // we've just entered and we're about to begin animating.
void IExitMoveMode(); // we're done animating; clean up

View File

@ -64,7 +64,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsTimer.h"
#include "hsGeometry3.h"
#include "float.h"
#include "plPipeline.h"
#include "plgDispatch.h"
#include "hsQuat.h"
@ -98,7 +98,7 @@ float plAvBrainHuman::fRunMaxTurnSpeed = 1.7;
plAvBrainHuman::TurnCurve plAvBrainHuman::fWalkTurnCurve = plAvBrainHuman::kTurnExponential;
plAvBrainHuman::TurnCurve plAvBrainHuman::fRunTurnCurve = plAvBrainHuman::kTurnExponential;
const hsScalar plAvBrainHuman::kAirTimePanicThreshold = 10; // seconds
const float plAvBrainHuman::kAirTimePanicThreshold = 10; // seconds
void plAvBrainHuman::SetTimeToMaxTurn(float time, hsBool walk)
{
@ -148,7 +148,7 @@ plAvBrainHuman::plAvBrainHuman(bool isActor /* = false */) :
{
}
hsBool plAvBrainHuman::Apply(double timeNow, hsScalar elapsed)
hsBool plAvBrainHuman::Apply(double timeNow, float elapsed)
{
#ifndef _DEBUG
try
@ -532,7 +532,7 @@ hsBool plAvBrainHuman::IHandleClimbMsg(plClimbMsg *msg)
return true;
}
hsScalar plAvBrainHuman::IGetTurnStrength(double timeNow)
float plAvBrainHuman::IGetTurnStrength(double timeNow)
{
float result = 0.f;
float timeToMaxTurn, maxTurnSpeed;
@ -553,8 +553,8 @@ hsScalar plAvBrainHuman::IGetTurnStrength(double timeNow)
plArmatureBehavior * turnLeft = fBehaviors.Count() >= kMovingTurnLeft ? fBehaviors[kMovingTurnLeft] : nil;
plArmatureBehavior * turnRight = fBehaviors.Count() >= kMovingTurnRight ? fBehaviors[kMovingTurnRight] : nil;
hsScalar turnLeftStrength = turnLeft ? turnLeft->GetStrength() : 0.f;
hsScalar turnRightStrength = turnRight ? turnRight->GetStrength() : 0.f;
float turnLeftStrength = turnLeft ? turnLeft->GetStrength() : 0.f;
float turnRightStrength = turnRight ? turnRight->GetStrength() : 0.f;
// Turning based on keypress
@ -653,7 +653,7 @@ void plAvBrainHuman::IdleOnly(bool instantOff)
if (!fCallbackAction)
return;
hsScalar rate = instantOff ? 0.f : 1.f;
float rate = instantOff ? 0.f : 1.f;
int i;
for (i = kWalk; i < fBehaviors.GetCount(); i++)
@ -1009,7 +1009,7 @@ void Idle::IStart()
plHBehavior::IStart();
if (fAnim)
{
hsScalar newStart = sRandom.RandZeroToOne() * fAnim->GetAnimation()->GetLength();
float newStart = sRandom.RandZeroToOne() * fAnim->GetAnimation()->GetLength();
fAnim->SetCurrentTime(newStart, true);
}
}
@ -1329,12 +1329,12 @@ void Push::Process(double time, float elapsed)
hsPoint3 lookAt;
fHuBrain->fCallbackAction->GetPushingPhysical()->GetPositionSim(lookAt);
hsVector3 up(0.f, 0.f, 1.f);
hsScalar angle = hsATan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + hsScalarPI / 2;
float angle = atan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + M_PI / 2;
hsQuat targRot(angle, &up);
const hsScalar kTurnSpeed = 3.f;
hsScalar angDiff = QuatAngleDiff(rot, targRot);
hsScalar turnSpeed = (angDiff > elapsed * kTurnSpeed ? kTurnSpeed : angDiff / elapsed);
const float kTurnSpeed = 3.f;
float angDiff = QuatAngleDiff(rot, targRot);
float turnSpeed = (angDiff > elapsed * kTurnSpeed ? kTurnSpeed : angDiff / elapsed);
hsQuat invRot = targRot.Conjugate();
hsPoint3 globFwd = invRot.Rotate(&kAvatarForward);

View File

@ -72,7 +72,7 @@ public:
CLASSNAME_REGISTER( plAvBrainHuman );
GETINTERFACE_ANY( plAvBrainHuman, plArmatureBrain );
virtual hsBool Apply(double timeNow, hsScalar elapsed);
virtual hsBool Apply(double timeNow, float elapsed);
virtual void Activate(plArmatureModBase *avMod);
virtual void Deactivate();
virtual void Suspend();
@ -161,9 +161,9 @@ public:
static void SetTurnCurve(TurnCurve curve, hsBool walk);
static TurnCurve GetTurnCurve(hsBool walk);
static const hsScalar kControlledFlightThreshold;
static const hsScalar kAirTimeThreshold;
static const hsScalar kAirTimePanicThreshold;
static const float kControlledFlightThreshold;
static const float kAirTimeThreshold;
static const float kAirTimePanicThreshold;
plWalkingController* fCallbackAction;
protected:
@ -173,7 +173,7 @@ protected:
virtual hsBool IHandleTaskMsg(plAvTaskMsg *msg);
virtual hsBool IInitAnimations();
virtual void IInitBoneMap();
hsScalar IGetTurnStrength(double timeNow);
float IGetTurnStrength(double timeNow);
void IChatOn();
void IChatOff();
hsBool IValidateAnimations();

View File

@ -184,7 +184,7 @@ hsBool plAvBrainRideAnimatedPhysical::LeaveAge()
{
return plArmatureBrain::LeaveAge();
}
hsBool plAvBrainRideAnimatedPhysical::Apply(double timeNow, hsScalar elapsed)
hsBool plAvBrainRideAnimatedPhysical::Apply(double timeNow, float elapsed)
{
if(this->fMode==kAbort) return false;
else return plAvBrainHuman::Apply(timeNow, elapsed);

View File

@ -58,7 +58,7 @@ public:
virtual void Deactivate();
virtual hsBool MsgReceive(plMessage *msg);
virtual hsBool LeaveAge();
virtual hsBool Apply(double timeNow, hsScalar elapsed);
virtual hsBool Apply(double timeNow, float elapsed);
protected:
hsBool IInitAnimations();
mode fMode;

View File

@ -234,7 +234,7 @@ public:
///////////////////////////////////////////////////////////////////////////////////////////
const hsScalar plAvBrainSwim::kMinSwimDepth = 4.0f;
const float plAvBrainSwim::kMinSwimDepth = 4.0f;
plAvBrainSwim::plAvBrainSwim() :
fCallbackAction(nil),
@ -263,7 +263,7 @@ plAvBrainSwim::~plAvBrainSwim()
delete fBehaviors[i];
}
hsBool plAvBrainSwim::Apply(double time, hsScalar elapsed)
hsBool plAvBrainSwim::Apply(double time, float elapsed)
{
IProbeSurface();
if (fMode == kWalking)
@ -278,12 +278,12 @@ hsBool plAvBrainSwim::Apply(double time, hsScalar elapsed)
{
// We're jumping in! Trigger splash effect (sound)
plArmatureEffectMsg *msg = TRACKED_NEW plArmatureEffectMsg(fAvMod->GetArmatureEffects()->GetKey(), kTime);
msg->fEventTime = (hsScalar)time;
msg->fEventTime = (float)time;
msg->fTriggerIdx = plArmatureMod::kImpact;
plEventCallbackInterceptMsg *iMsg = TRACKED_NEW plEventCallbackInterceptMsg;
iMsg->AddReceiver(fAvMod->GetArmatureEffects()->GetKey());
iMsg->fEventTime = (hsScalar)time;
iMsg->fEventTime = (float)time;
iMsg->fEvent = kTime;
iMsg->SetMessage(msg);
iMsg->Send();
@ -687,7 +687,7 @@ void plAvBrainSwim::DumpToDebugDisplay(int &x, int &y, int lineHeight, char *str
// fAvMod->GetPhysical()->GetLinearVelocitySim(linV);
// hsVector3 angV;
// fAvMod->GetPhysical()->GetAngularVelocitySim(angV);
// hsScalar angle = angV.fZ > 0 ? angV.Magnitude() : -angV.Magnitude();
// float angle = angV.fZ > 0 ? angV.Magnitude() : -angV.Magnitude();
// sprintf(strBuf, "Velocity: Linear (%5.2f, %5.2f, %5.2f), Angular %5.2f", linV.fX, linV.fY, linV.fZ, angle);
// debugTxt.DrawString(x, y, strBuf);
// y += lineHeight;

View File

@ -62,7 +62,7 @@ public:
GETINTERFACE_ANY( plAvBrainSwim, plArmatureBrain );
virtual void Activate(plArmatureModBase *avMod);
hsBool Apply(double time, hsScalar elapsed);
hsBool Apply(double time, float elapsed);
virtual void Deactivate();
virtual void Suspend();
virtual void Resume();
@ -71,10 +71,10 @@ public:
bool IsWalking();
bool IsWading();
bool IsSwimming();
hsScalar GetSurfaceDistance() { return fSurfaceDistance; }
float GetSurfaceDistance() { return fSurfaceDistance; }
plSwimmingController *fCallbackAction;
static const hsScalar kMinSwimDepth;
static const float kMinSwimDepth;
protected:
void IStartWading();

View File

@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// Generic geom utils.
hsBool LinearVelocity(hsVector3 &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat);
void AngularVelocity(hsScalar &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat);
void AngularVelocity(float &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat);
float AngleRad2d (float x1, float y1, float x3, float y3);
inline hsVector3 GetYAxis(hsMatrix44 &mat)
{
@ -98,7 +98,7 @@ void plAnimatedController::RecalcVelocity(double timeNow, double timePrev, hsBoo
///////////////////////////////////////////////////////////////////////////
const hsScalar plWalkingController::kControlledFlightThreshold = 1.f; // seconds
const float plWalkingController::kControlledFlightThreshold = 1.f; // seconds
plWalkingController::plWalkingController(plSceneObject* rootObject, plAGApplicator* rootApp, plPhysicalControllerCore* controller)
: plAnimatedController(rootObject, rootApp, controller)
@ -227,7 +227,7 @@ void plWalkingController::Update()
continue; // Physical no longer exists. Skip it.
const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i);
hsScalar dotUp = straightUp.dot(contact->m_normal);
float dotUp = straightUp.dot(contact->m_normal);
if (dotUp > .5)
ground = true;
else if (contactPhys->GetProperty(plSimulationInterface::kAvAnimPushable))
@ -258,7 +258,7 @@ void plWalkingController::Update()
// has to overcome friction). I deal with that by making the threshold (360 - (180 - 60) = 240). I've
// seen up to 220 reached in actual gameplay in a situation where we'd want this to take effect.
// This is the same running into 2 walls where the angle between them is 60.
const hsScalar threshold = hsScalarDegToRad(240);
const float threshold = hsDegreesToRadians(240);
if (!ground && numContacts >= 2)
{
// Can probably do a special case for exactly 2 contacts. Not sure if it's worth it...
@ -267,7 +267,7 @@ void plWalkingController::Update()
for (i = 0; i < numContacts; i++)
{
const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i);
fCollisionAngles[i] = hsATan2(contact->m_normal.y, contact->m_normal.x);
fCollisionAngles[i] = atan2(contact->m_normal.y, contact->m_normal.x);
}
// numContacts is rarely larger than 6, so let's do a simple bubble sort.
@ -277,7 +277,7 @@ void plWalkingController::Update()
{
if (fCollisionAngles[i] > fCollisionAngles[j])
{
hsScalar tempAngle = fCollisionAngles[i];
float tempAngle = fCollisionAngles[i];
fCollisionAngles[i] = fCollisionAngles[j];
fCollisionAngles[j] = tempAngle;
}
@ -294,7 +294,7 @@ void plWalkingController::Update()
if (i == numContacts)
{
// We got to the end. Check the last with the first and make your decision.
if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * hsScalarPI)))
if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * M_PI)))
ground = true;
}
}
@ -307,7 +307,7 @@ void plWalkingController::Update()
fHitGroundInThisAge = true; // if we're not pinned and we're not in an age yet, we are now.
if (IsControlledFlight())
fControlledFlightTime += (hsScalar)elapsed;
fControlledFlightTime += (float)elapsed;
if (fControlledFlightTime > kControlledFlightThreshold && numContacts > 0)
EnableControlledFlight(false);
@ -321,7 +321,7 @@ void plWalkingController::Update()
// hsVector3 vel;
// fPhysical->GetLinearVelocitySim(vel);
// fImpactVel = vel.fZ;
// fTimeInAirPeak = (hsScalar)(fTimeInAir + elapsed);
// fTimeInAirPeak = (float)(fTimeInAir + elapsed);
// }
fWaitingForGround = false;
@ -334,7 +334,7 @@ void plWalkingController::Update()
// collisions, which could trick us into thinking we've just gone a long
// time without hitting ground. So we only count the time if this wasn't
// the case.
fTimeInAir += (hsScalar)elapsed;
fTimeInAir += (float)elapsed;
}
@ -385,7 +385,7 @@ void plHorizontalFreezeAction::apply(Havok::Subspace &s, Havok::hkTime time)
for(i = 0; i < numContacts; i++)
{
const Havok::ContactPoint *contact = fPhysical->GetContactPoint(i);
hsScalar dotUp = straightUp.dot(contact->m_normal);
float dotUp = straightUp.dot(contact->m_normal);
if (dotUp > .5)
ground = true;
}
@ -540,22 +540,22 @@ static hsBool LinearVelocity(hsVector3 &outputV, float elapsed, hsMatrix44 &prev
return result;
}
static void AngularVelocity(hsScalar &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat)
static void AngularVelocity(float &outputV, float elapsed, hsMatrix44 &prevMat, hsMatrix44 &curMat)
{
outputV = 0.f;
hsScalar appliedVelocity = 0.0f;
float appliedVelocity = 0.0f;
hsVector3 prevForward = GetYAxis(prevMat);
hsVector3 curForward = GetYAxis(curMat);
hsScalar angleSincePrev = AngleRad2d(curForward.fX, curForward.fY, prevForward.fX, prevForward.fY);
float angleSincePrev = AngleRad2d(curForward.fX, curForward.fY, prevForward.fX, prevForward.fY);
hsBool sincePrevSign = angleSincePrev > 0.0f;
if (angleSincePrev > hsScalarPI)
if (angleSincePrev > M_PI)
angleSincePrev = angleSincePrev - TWO_PI;
const hsVector3 startForward = hsVector3(0, -1.0, 0); // the Y orientation of a "resting" armature....
hsScalar angleSinceStart = AngleRad2d(curForward.fX, curForward.fY, startForward.fX, startForward.fY);
float angleSinceStart = AngleRad2d(curForward.fX, curForward.fY, startForward.fX, startForward.fY);
hsBool sinceStartSign = angleSinceStart > 0.0f;
if (angleSinceStart > hsScalarPI)
if (angleSinceStart > M_PI)
angleSinceStart = angleSinceStart - TWO_PI;
// HANDLING ANIMATION WRAPPING:

View File

@ -65,7 +65,7 @@ public:
// some reason, just stub this function out.
//
// Pass in the key to the root sceneobject for the avatar
static plPhysicalController* Create(plKey ownerSO, hsScalar height, hsScalar width);
static plPhysicalController* Create(plKey ownerSO, float height, float width);
virtual ~plPhysicalController() {}
@ -77,7 +77,7 @@ public:
virtual void SetLOSDB(plSimDefs::plLOSDB losDB) = 0;
// Call this once per frame with the velocities of the avatar in avatar space.
virtual void SetVelocities(const hsVector3& linearVel, hsScalar angVel) = 0;
virtual void SetVelocities(const hsVector3& linearVel, float angVel) = 0;
// Gets the actual velocity we achieved in the last step (relative to our subworld)
virtual const hsVector3& GetLinearVelocity() const = 0;
@ -92,7 +92,7 @@ public:
// cases like when the avatar spawns into a new age.
virtual bool IsOnGround() const = 0;
virtual bool IsOnFalseGround() const = 0;
virtual hsScalar GetAirTime() const = 0;
virtual float GetAirTime() const = 0;
virtual void ResetAirTime() = 0;
virtual plPhysical* GetPushingPhysical() const = 0;
@ -133,16 +133,16 @@ public:
plAnimatedController(plSceneObject* rootObject, plAGApplicator* rootApp, plPhysicalControllerCore* controller);
virtual void RecalcVelocity(double timeNow, double timePrev, hsBool useAnim = true);
void SetTurnStrength(hsScalar val) { fTurnStr = val; }
hsScalar GetTurnStrength() { return fTurnStr; }
void SetTurnStrength(float val) { fTurnStr = val; }
float GetTurnStrength() { return fTurnStr; }
virtual void ActivateController()=0;
protected:
plSceneObject* fRootObject;
plPhysicalControllerCore* fController;
plAGApplicator* fRootApp;
hsScalar fAnimAngVel;
float fAnimAngVel;
hsVector3 fAnimPosVel;
hsScalar fTurnStr; // Explicit turning, separate from animations
float fTurnStr; // Explicit turning, separate from animations
};
class plWalkingController : public plAnimatedController
@ -158,13 +158,13 @@ public:
bool IsOnFalseGround() const { return fWalkingStrategy ? fWalkingStrategy->IsOnFalseGround() : true; }
bool HitGroundInThisAge() const { return fHitGroundInThisAge; }
bool EnableControlledFlight(bool status);
hsScalar GetAirTime() const { return fWalkingStrategy ? fWalkingStrategy->GetAirTime() : 0.f; }
float GetAirTime() const { return fWalkingStrategy ? fWalkingStrategy->GetAirTime() : 0.f; }
void ResetAirTime() { if (fWalkingStrategy) fWalkingStrategy->ResetAirTime(); }
hsScalar GetForwardVelocity() const;
float GetForwardVelocity() const;
void ActivateController();
// Check these after the avatar the avatar hits the ground for his total
// hangtime and impact velocity.
hsScalar GetImpactTime() const { return fImpactTime; }
float GetImpactTime() const { return fImpactTime; }
const hsVector3& GetImpactVelocity() const { return fImpactVelocity; }
plPhysical* GetPushingPhysical() const
@ -181,24 +181,24 @@ public:
protected:
bool fHitGroundInThisAge;
bool fWaitingForGround; // We've gone airborne. IsOnGround() returns false until we hit ground again.
hsScalar fControlledFlightTime;
float fControlledFlightTime;
int fControlledFlight; // Count of how many are currently forcing flight
plWalkingStrategy* fWalkingStrategy;
hsScalar fImpactTime;
float fImpactTime;
hsVector3 fImpactVelocity;
bool fClearImpact;
bool fGroundLastFrame;//used for a test to pass the event of first getting air during a jump
static const hsScalar kControlledFlightThreshold;
static const float kControlledFlightThreshold;
};
class plSwimmingController: public plAnimatedController
{
public :
plSwimmingController(plSceneObject* rootObject, plAGApplicator* rootApp, plPhysicalControllerCore* controller);
virtual ~plSwimmingController();
void SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight){
void SetSurface(plSwimRegionInterface *region, float surfaceHeight){
fSwimmingStrategy->SetSurface(region,surfaceHeight);
}
hsScalar GetBuoyancy() { return fSwimmingStrategy->GetBuoyancy(); }
float GetBuoyancy() { return fSwimmingStrategy->GetBuoyancy(); }
hsBool IsOnGround() { return fSwimmingStrategy->IsOnGround(); }
hsBool HadContacts() { return fSwimmingStrategy->HadContacts();}
void Enable(bool en){if (fController) fController->Enable(en);}

View File

@ -105,7 +105,7 @@ plAvLadderMod::plAvLadderMod(bool goingUp, int type, int loops, bool enabled, hs
}
// Must be facing within 45 degrees of the ladder
static const hsScalar kTolerance = hsCosine(hsScalarDegToRad(45));
static const float kTolerance = cos(hsDegreesToRadians(45));
bool plAvLadderMod::IIsReadyToClimb()
{
@ -120,7 +120,7 @@ bool plAvLadderMod::IIsReadyToClimb()
playerView.fZ = 0;
// Are we facing towards the ladder?
hsScalar dot = playerView * fLadderView;
float dot = playerView * fLadderView;
bool movingForward = false;
@ -135,12 +135,12 @@ bool plAvLadderMod::IIsReadyToClimb()
if (dot >= kTolerance && movingForward)
{
DetectorLogSpecial("%s: Ladder starting climb (%f)", GetKeyName(), hsScalarRadToDeg(hsACosine(dot)));
DetectorLogSpecial("%s: Ladder starting climb (%f)", GetKeyName(), hsRadiansToDegrees(acos(dot)));
return true;
}
else if (movingForward)
{
// DetectorLog("%s: Ladder rejecting climb (%f)", GetKeyName(), hsScalarRadToDeg(hsACosine(dot)));
// DetectorLog("%s: Ladder rejecting climb (%f)", GetKeyName(), hsRadiansToDegrees(acos(dot)));
return false;
}
}

View File

@ -78,7 +78,7 @@ public:
void SetEnabled(bool enabled) { fEnabled = enabled; }
protected:
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) {return true;}
virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;}
bool IIsReadyToClimb();
void ITriggerSelf(plKey avKey);

View File

@ -82,14 +82,14 @@ public:
/** Start the task: set up initial conditions or wait for resources to become available.
Start will be called repeatedly until it returns true, indicating the task has begun. */
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
/** Run the task. Start is guaranteed to have returned true before Process() is called even once.
Returns false when the task has finished and epilogue code has been executed. */
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
/** Clean up the task. This is guaranteed to be called when Process returns false. */
virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
virtual void LeaveAge(plArmatureMod *avatar) {}

View File

@ -75,7 +75,7 @@ plAvTaskBrain::~plAvTaskBrain()
// Start ------------------------------------------------------------------------------------------
// ------
hsBool plAvTaskBrain::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvTaskBrain::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
if(fBrain)
avatar->PushBrain(fBrain);
@ -87,7 +87,7 @@ hsBool plAvTaskBrain::Start(plArmatureMod *avatar, plArmatureBrain *brain, doubl
return true;
}
void plAvTaskBrain::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
void plAvTaskBrain::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
}

View File

@ -71,8 +71,8 @@ public:
virtual ~plAvTaskBrain();
// task protocol
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
/** dump descriptive stuff to the given debug text */
virtual void DumpDebug(const char *name, int &x, int&y, int lineHeight, char *strBuf, plDebugText &debugTxt);

View File

@ -197,13 +197,13 @@ void plAvTaskSeek::SetTarget(hsPoint3 &pos, hsPoint3 &lookAt)
{
fSeekPos = pos;
hsVector3 up(0.f, 0.f, 1.f);
hsScalar angle = hsATan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + hsScalarPI / 2;
float angle = atan2(lookAt.fY - pos.fY, lookAt.fX - pos.fX) + M_PI / 2;
fSeekRot.SetAngleAxis(angle, up);
}
// Start -----------------------------------------------------------------------------------------
// ------
hsBool plAvTaskSeek::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvTaskSeek::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(brain);
hsAssert(huBrain, "Seek task only works on human brains");
@ -243,7 +243,7 @@ hsBool plAvTaskSeek::Start(plArmatureMod *avatar, plArmatureBrain *brain, double
// Process -------------------------------------------------------------------------------------------
// --------
hsBool plAvTaskSeek::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvTaskSeek::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
if (fState == kSeekAbort)
return false;
@ -268,7 +268,7 @@ hsBool plAvTaskSeek::Process(plArmatureMod *avatar, plArmatureBrain *brain, doub
// Finish ---------------------------------------------------------------------------------------
// -------
void plAvTaskSeek::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
void plAvTaskSeek::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
plAvBrainHuman *huBrain = plAvBrainHuman::ConvertNoRef(brain);
@ -318,7 +318,7 @@ hsBool plAvTaskSeek::IAnalyze(plArmatureMod *avatar)
hsVector3 normalizedGoalVec(fGoalVec);
normalizedGoalVec.Normalize();
fDistance = hsSquareRoot(fGoalVec.fX * fGoalVec.fX + fGoalVec.fY * fGoalVec.fY);
fDistance = sqrt(fGoalVec.fX * fGoalVec.fX + fGoalVec.fY * fGoalVec.fY);
if(fDistance < 3.0f)
{
@ -350,7 +350,7 @@ hsBool plAvTaskSeek::IAnalyze(plArmatureMod *avatar)
// IMoveTowardsGoal --------------------------------------------------------------
// -----------------
hsBool plAvTaskSeek::IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *brain,
double time, hsScalar elapsed)
double time, float elapsed)
{
bool stillRunning = true;
avatar->ClearInputFlags(false, false);
@ -435,7 +435,7 @@ hsBool plAvTaskSeek::IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *bra
// ITRYFINISH
bool plAvTaskSeek::ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, hsScalar elapsed)
bool plAvTaskSeek::ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, float elapsed)
{
hsBool animsDone = brain->IsMovementZeroBlend();
@ -458,7 +458,7 @@ bool plAvTaskSeek::ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, doub
hsBool plAvTaskSeek::IFinishPosition(hsPoint3 &newPosition,
plArmatureMod *avatar, plAvBrainHuman *brain,
double time, hsScalar elapsed)
double time, float elapsed)
{
// While warping, we might be hovering just above the ground. Don't want that to
// trigger any falling behavior.
@ -494,7 +494,7 @@ hsBool plAvTaskSeek::IFinishPosition(hsPoint3 &newPosition,
// ----------------
hsBool plAvTaskSeek::IFinishRotation(hsQuat &newRotation,
plArmatureMod *avatar, plAvBrainHuman *brain,
double time, hsScalar elapsed)
double time, float elapsed)
{
// we're pretty much done; just hop the rest of the way
newRotation = fSeekRot;
@ -603,8 +603,8 @@ void plAvTaskSeek::DumpToAvatarLog(plArmatureMod *avatar)
// --------------
float QuatAngleDiff(const hsQuat &a, const hsQuat &b)
{
hsScalar theta; /* angle between A and B */
hsScalar cos_t; /* sine, cosine of theta */
float theta; /* angle between A and B */
float cos_t; /* sine, cosine of theta */
/* cosine theta = dot product of A and B */
cos_t = a.Dot(b);
@ -616,11 +616,11 @@ float QuatAngleDiff(const hsQuat &a, const hsQuat &b)
}
// Calling acos on 1.0 is returning an undefined value. Need to check for it.
hsScalar epsilon = 0.00001;
float epsilon = 0.00001;
if (hsABS(cos_t - 1.f) < epsilon)
return 0;
theta = hsACosine(cos_t);
theta = acos(cos_t);
return theta;
}

View File

@ -82,15 +82,15 @@ public:
/** Initiate the task; make sure we're running on the right type of brain, save off
user input state, and turn off any other running behaviors.*/
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
/** Progress towards the goal using a combination of walking and cheating-via-sliding.
Returns true if we're still working on it; false if we're done. */
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
/** Restore user input state, etc. */
virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual void Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
/** clear our target, and when we try to eval, we'll just finish */
virtual void LeaveAge(plArmatureMod *avatar);
@ -121,19 +121,19 @@ protected:
/** Progress towards the goal. We get as close as we can by just pushing the same
buttons as the user (forward, turn, etc.) when we're really close we slide
around a bit so we can wind up on the *exact* initial orientation. */
hsBool IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *brain, double time, hsScalar elapsed);
hsBool IMoveTowardsGoal(plArmatureMod *avatar, plAvBrainHuman *brain, double time, float elapsed);
/** Okay, we're in the pure cheating mode now. Try to wrap it up;
returns true when it's finally there. */
bool ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, hsScalar elapsed);
bool ITryFinish(plArmatureMod *avatar, plAvBrainHuman *brain, double time, float elapsed);
/** Final cheating for position */
hsBool IFinishPosition(hsPoint3 &newPosition, plArmatureMod *avatar, plAvBrainHuman *brain,
double time, hsScalar elapsed);
double time, float elapsed);
/** Final cheating for rotation */
hsBool IFinishRotation(hsQuat &newRotation, plArmatureMod *avatar, plAvBrainHuman *brain,
double time, hsScalar elapsed);
double time, float elapsed);
/** If our target's moving, cache its new position and orientation for later math */
hsBool IUpdateObjective(plArmatureMod *avatar);
@ -170,17 +170,17 @@ protected:
hsBool fStillRotating; // haven't yet reached the final orientation
hsVector3 fGoalVec; // vec from us to the goal
hsScalar fDistance; // how far to the goal?
hsScalar fAngForward; // 1.0 = goal is forward; -1.0 = goal is backward
hsScalar fAngRight; // 1.0 = goal is directly right; -1.0 = goal is directly left
hsScalar fDistForward; // distance straight forward to goal plane
hsScalar fDistRight; // distance straight right to goal plane
float fDistance; // how far to the goal?
float fAngForward; // 1.0 = goal is forward; -1.0 = goal is backward
float fAngRight; // 1.0 = goal is directly right; -1.0 = goal is directly left
float fDistForward; // distance straight forward to goal plane
float fDistRight; // distance straight right to goal plane
hsScalar fShuffleRange;
hsScalar fMaxSidleAngle; // in right . goal
hsScalar fMaxSidleRange; // in feet
hsScalar fMinFwdAngle; // in fwd . goal
hsScalar fMaxBackAngle; // in fwd . goal
float fShuffleRange;
float fMaxSidleAngle; // in right . goal
float fMaxSidleRange; // in feet
float fMinFwdAngle; // in fwd . goal
float fMaxBackAngle; // in fwd . goal
double fStartTime;
uint8_t fFlags;

View File

@ -502,7 +502,7 @@ void plClothingOutfit::RemoveItem(plClothingItem *item, hsBool update /* = true
plgDispatch::MsgSend(msg);
}
void plClothingOutfit::TintItem(plClothingItem *item, hsScalar red, hsScalar green, hsScalar blue,
void plClothingOutfit::TintItem(plClothingItem *item, float red, float green, float blue,
hsBool update /* = true */, hsBool broadcast /* = true */, hsBool netForce /* = false */,
hsBool retry /* = true */, uint8_t layer /* = kLayerTint1 */)
{
@ -526,7 +526,7 @@ void plClothingOutfit::TintItem(plClothingItem *item, hsScalar red, hsScalar gre
plgDispatch::MsgSend(msg);
}
void plClothingOutfit::TintSkin(hsScalar red, hsScalar green, hsScalar blue,
void plClothingOutfit::TintSkin(float red, float green, float blue,
hsBool update /* = true */, hsBool broadcast /* = true */)
{
plClothingMsg *msg = TRACKED_NEW plClothingMsg();
@ -541,7 +541,7 @@ void plClothingOutfit::TintSkin(hsScalar red, hsScalar green, hsScalar blue,
plgDispatch::MsgSend(msg);
}
void plClothingOutfit::MorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, hsScalar weight,
void plClothingOutfit::MorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight,
hsBool retry /* = true */)
{
plClothingMsg *msg = TRACKED_NEW plClothingMsg();
@ -556,12 +556,12 @@ void plClothingOutfit::MorphItem(plClothingItem *item, uint8_t layer, uint8_t de
plgDispatch::MsgSend(msg);
}
void plClothingOutfit::SetAge(hsScalar age, hsBool update /* = true */, hsBool broadcast /* = true */)
void plClothingOutfit::SetAge(float age, hsBool update /* = true */, hsBool broadcast /* = true */)
{
SetSkinBlend(age, plClothingElement::kLayerSkinBlend1, update, broadcast);
}
void plClothingOutfit::SetSkinBlend(hsScalar blend, uint8_t layer, hsBool update /* = true */, hsBool broadcast /* = true */)
void plClothingOutfit::SetSkinBlend(float blend, uint8_t layer, hsBool update /* = true */, hsBool broadcast /* = true */)
{
plClothingMsg *msg = TRACKED_NEW plClothingMsg();
msg->AddReceiver(GetKey());
@ -576,7 +576,7 @@ void plClothingOutfit::SetSkinBlend(hsScalar blend, uint8_t layer, hsBool update
plgDispatch::MsgSend(msg);
}
hsScalar plClothingOutfit::GetSkinBlend(uint8_t layer)
float plClothingOutfit::GetSkinBlend(uint8_t layer)
{
if (layer >= plClothingElement::kLayerSkinBlend1 && layer <= plClothingElement::kLayerSkinLast)
return fSkinBlends[layer - plClothingElement::kLayerSkinBlend1];
@ -712,7 +712,7 @@ hsColorRGBA plClothingOutfit::GetItemTint(plClothingItem *item, uint8_t layer /*
return color;
}
hsBool plClothingOutfit::IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, hsScalar weight)
hsBool plClothingOutfit::IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight)
{
uint32_t index = fItems.Find(item);
if (index != fItems.kMissingIndex)
@ -1159,12 +1159,12 @@ void plClothingOutfit::WearRandomOutfit()
cMgr->GetItemsByGroupAndType(fGroup, (uint8_t)i, items);
j = (uint32_t)(sRandom.RandZeroToOne() * items.GetCount());
hsScalar r1 = sRandom.RandZeroToOne();
hsScalar g1 = sRandom.RandZeroToOne();
hsScalar b1 = sRandom.RandZeroToOne();
hsScalar r2 = sRandom.RandZeroToOne();
hsScalar g2 = sRandom.RandZeroToOne();
hsScalar b2 = sRandom.RandZeroToOne();
float r1 = sRandom.RandZeroToOne();
float g1 = sRandom.RandZeroToOne();
float b1 = sRandom.RandZeroToOne();
float r2 = sRandom.RandZeroToOne();
float g2 = sRandom.RandZeroToOne();
float b2 = sRandom.RandZeroToOne();
AddItem(items[j], false, false);
TintItem(items[j], r1, g1, b1, false, false, false, true, 1);
@ -1360,7 +1360,7 @@ hsBool plClothingOutfit::MsgReceive(plMessage* msg)
if (cMsg->GetCommand(plClothingMsg::kBlendSkin))
{
hsScalar blend = cMsg->fColor.a;
float blend = cMsg->fColor.a;
if (blend > 1.f)
blend = 1.f;
if (blend < 0.f)

View File

@ -170,7 +170,7 @@ public:
uint8_t fGroup;
bool fSynchClients; // set true if the next synch should be bcast
hsColorRGBA fSkinTint;
hsScalar fSkinBlends[plClothingElement::kLayerSkinLast - plClothingElement::kLayerSkinFirst]; // Controls the opacity between skin textures.
float fSkinBlends[plClothingElement::kLayerSkinLast - plClothingElement::kLayerSkinFirst]; // Controls the opacity between skin textures.
plClothingOutfit();
~plClothingOutfit();
@ -181,16 +181,16 @@ public:
void SaveCustomizations(hsBool retry = true);
void AddItem(plClothingItem *item, hsBool update = true, hsBool broadcast = true, hsBool netForce=false);
void RemoveItem(plClothingItem *item, hsBool update = true, hsBool netForce=false);
void TintItem(plClothingItem *item, hsScalar red, hsScalar green, hsScalar blue, hsBool update = true, hsBool broadcast = true,
void TintItem(plClothingItem *item, float red, float green, float blue, hsBool update = true, hsBool broadcast = true,
hsBool netForce = false, hsBool retry = true, uint8_t fLayer = plClothingElement::kLayerTint1);
void TintSkin(hsScalar red, hsScalar green, hsScalar blue,
void TintSkin(float red, float green, float blue,
hsBool update = true, hsBool broadcast = true);
void MorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, hsScalar weight, hsBool retry = true);
void SetAge(hsScalar age, hsBool update = true, hsBool broadcast = true);
void SetSkinBlend(hsScalar blend, uint8_t layer, hsBool update = true, hsBool broadcast = true);
hsScalar GetSkinBlend(uint8_t layer);
void MorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight, hsBool retry = true);
void SetAge(float age, hsBool update = true, hsBool broadcast = true);
void SetSkinBlend(float blend, uint8_t layer, hsBool update = true, hsBool broadcast = true);
float GetSkinBlend(uint8_t layer);
hsColorRGBA GetItemTint(plClothingItem *item, uint8_t layer = 2) const;
hsScalar GetAge() const { return fSkinBlends[0]; }
float GetAge() const { return fSkinBlends[0]; }
hsTArray<plClothingItem*> &GetItemList() { return fItems; }
hsTArray<plClothingItemOptions*> &GetOptionList() { return fOptions; }
@ -232,7 +232,7 @@ protected:
void IAddItem(plClothingItem *item);
void IRemoveItem(plClothingItem *item);
hsBool ITintItem(plClothingItem *item, hsColorRGBA color, uint8_t layer);
hsBool IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, hsScalar weight);
hsBool IMorphItem(plClothingItem *item, uint8_t layer, uint8_t delta, float weight);
void IHandleMorphSDR(plStateDataRecord *sdr);
void IUpdate();

View File

@ -843,7 +843,7 @@ int plAvatarMgr::WarpPlayerToAnother(hsBool iMove, uint32_t remoteID)
return hsOK;
}
int plAvatarMgr::WarpPlayerToXYZ(hsScalar x, hsScalar y, hsScalar z)
int plAvatarMgr::WarpPlayerToXYZ(float x, float y, float z)
{
plSceneObject *localSO = plSceneObject::ConvertNoRef(plNetClientMgr::GetInstance()->GetLocalPlayer());
if (!localSO)
@ -860,7 +860,7 @@ int plAvatarMgr::WarpPlayerToXYZ(hsScalar x, hsScalar y, hsScalar z)
return hsOK;
}
int plAvatarMgr::WarpPlayerToXYZ(int pid, hsScalar x, hsScalar y, hsScalar z)
int plAvatarMgr::WarpPlayerToXYZ(int pid, float x, float y, float z)
{
plNetClientMgr* nc=plNetClientMgr::GetInstance();
plNetTransportMember* mbr=nc->TransportMgr().GetMember(nc->TransportMgr().FindMember(pid));
@ -962,10 +962,10 @@ void plAvatarMgr::PointToDniCoordinate(hsPoint3 pt, plDniCoordinateInfo* ret)
hsVector3 retVec(pt - retPoint);
retVec.Normalize();
hsScalar dotView = retVec * zeroVec;
hsScalar dotRight = retVec * zeroRight;
float dotView = retVec * zeroVec;
float dotRight = retVec * zeroRight;
hsScalar deg = acosf(dotView);
float deg = acosf(dotView);
deg*=(180/3.141592);
// account for being > 180
if (dotRight < 0.0f)

View File

@ -150,8 +150,8 @@ public:
int FindSpawnPoint( const char *name ) const;
// \}
static int WarpPlayerToAnother(hsBool iMove, uint32_t remoteID);
static int WarpPlayerToXYZ(hsScalar x, hsScalar y, hsScalar z);
static int WarpPlayerToXYZ(int pid, hsScalar x, hsScalar y, hsScalar z);
static int WarpPlayerToXYZ(float x, float y, float z);
static int WarpPlayerToXYZ(int pid, float x, float y, float z);
static plAvatarMgr *GetInstance();
static void ShutDown();

View File

@ -135,7 +135,7 @@ void plAvatarPhysicalSDLModifier::ISetCurrentStateFrom(const plStateDataRecord*
if ((rotVar->IsDirty() || posVar->IsDirty()) && avMod->GetController())
{
hsPoint3 pos;
hsScalar zRot;
float zRot;
posVar->Get(&pos.fX);
rotVar->Get(&zRot);
avMod->GetController()->SetState(pos, zRot);
@ -155,7 +155,7 @@ void plAvatarPhysicalSDLModifier::IPutCurrentStateIn(plStateDataRecord* dstState
if(avMod && avMod->GetController())
{
hsPoint3 pos;
hsScalar zRot;
float zRot;
avMod->GetController()->GetState(pos, zRot);
dstState->FindVar(kStrRotation)->Set(zRot);
dstState->FindVar(kStrPosition)->Set(&pos.fX);

View File

@ -89,20 +89,20 @@ plAvTask::plAvTask()
}
// START
hsBool plAvTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
return true; // true indicates the task has started succesfully
}
// PROCESS
hsBool plAvTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
return false;
}
// Finish -----------------------------------------------------------------------------------
// -------
void plAvTask::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
void plAvTask::Finish(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
}
@ -214,7 +214,7 @@ void GetPositionAndRotation(hsMatrix44 transform, hsScalarTriple *position, hsQu
// START
// Adjust our goal time based on our duration and the current time
hsBool plAvSeekTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvSeekTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
fTargetTime = time + fDuration; // clock starts now....
fPhysicalAtStart = avatar->IsPhysicsEnabled();
@ -281,7 +281,7 @@ void CalcHandleTargetPosition(hsMatrix44 &result, plSceneObject *insert, plScene
// PROCESS
// Move closer to the goal position and orientation
hsBool plAvSeekTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvSeekTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
hsQuat rotation;
hsPoint3 position;
@ -349,10 +349,10 @@ plAvAnimTask::plAvAnimTask()
// CTOR animName, initialBlend, targetBlend, fadeSpeed, start, loop, attach
plAvAnimTask::plAvAnimTask(const char *animName,
hsScalar initialBlend,
hsScalar targetBlend,
hsScalar fadeSpeed,
hsScalar setTime,
float initialBlend,
float targetBlend,
float fadeSpeed,
float setTime,
hsBool start,
hsBool loop,
hsBool attach)
@ -370,7 +370,7 @@ plAvAnimTask::plAvAnimTask(const char *animName,
}
// CTOR animName, fadeSpeed, attach
plAvAnimTask::plAvAnimTask(const char *animName, hsScalar fadeSpeed, hsBool attach)
plAvAnimTask::plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach)
: fInitialBlend(0.0f),
fTargetBlend(0.0f),
fFadeSpeed(fadeSpeed),
@ -398,7 +398,7 @@ plAvAnimTask::~plAvAnimTask()
}
// START
hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
hsBool result = false;
if(fAttach)
@ -440,7 +440,7 @@ hsBool plAvAnimTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double
}
// PROCESS
hsBool plAvAnimTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvAnimTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
// the only reason we need this function is to watch the animation until it fades out
hsBool result = false;
@ -579,7 +579,7 @@ plAvOneShotTask::~plAvOneShotTask()
// START
hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
hsBool result = false;
@ -664,7 +664,7 @@ hsBool plAvOneShotTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, dou
}
// PROCESS
hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
// *** if we are under mouse control, adjust it here
@ -675,7 +675,7 @@ hsBool plAvOneShotTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, d
{
const plAGAnim * animation = fAnimInstance->GetAnimation();
double endTime = (fBackwards ? animation->GetStart() : animation->GetEnd());
fAnimInstance->SetCurrentTime((hsScalar)endTime);
fAnimInstance->SetCurrentTime((float)endTime);
avatar->ApplyAnimations(time, elapsed);
if(--fWaitFrames == 0)
@ -778,7 +778,7 @@ plAvOneShotLinkTask::~plAvOneShotLinkTask()
}
// task protocol
hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
hsBool result = plAvOneShotTask::Start(avatar, brain, time, elapsed);
fStartTime = time;
@ -795,7 +795,7 @@ hsBool plAvOneShotLinkTask::Start(plArmatureMod *avatar, plArmatureBrain *brain,
return result;
}
hsBool plAvOneShotLinkTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed)
hsBool plAvOneShotLinkTask::Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed)
{
hsBool result = plAvOneShotTask::Process(avatar, brain, time, elapsed);
if (fIgnore)

View File

@ -84,19 +84,19 @@ public:
\param loop Make the animation loop?
\param attach Are we attaching or detaching the animation?
*/
plAvAnimTask(const char *animName, hsScalar initialBlend, hsScalar targetBlend, hsScalar fadeSpeed,
hsScalar setTime, hsBool start, hsBool loop, hsBool attach);
plAvAnimTask(const char *animName, float initialBlend, float targetBlend, float fadeSpeed,
float setTime, hsBool start, hsBool loop, hsBool attach);
/** Canonical constructor form form for detaching
\param animName The name of the animation we're detaching
\param fadeSpeed How fast to fade it out. */
plAvAnimTask(const char *animName, hsScalar fadeSpeed, hsBool attach = false);
plAvAnimTask(const char *animName, float fadeSpeed, hsBool attach = false);
virtual ~plAvAnimTask();
// task protocol
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
virtual void LeaveAge(plArmatureMod *avatar);
// plasma protocol
@ -109,10 +109,10 @@ public:
protected:
// public members
char* fAnimName; // the animation we're operating on
hsScalar fInitialBlend; // the blend to establish (attaching only)
hsScalar fTargetBlend; // the blend to achieve eventually (attaching only)
hsScalar fFadeSpeed; // how fast to achieve the blend
hsScalar fSetTime; // set the animation to this time
float fInitialBlend; // the blend to establish (attaching only)
float fTargetBlend; // the blend to achieve eventually (attaching only)
float fFadeSpeed; // how fast to achieve the blend
float fSetTime; // set the animation to this time
hsBool fStart; // start the animation playing? (attaching only)
hsBool fLoop; // turn on looping? (attaching only)
hsBool fAttach; // attach? (otherwise detach)
@ -137,8 +137,8 @@ public:
plAvSeekTask(plKey target, plAvAlignment alignType, const char *animName);
// task protocol
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
virtual void LeaveAge(plArmatureMod *avatar);
// plasma protocol
@ -193,8 +193,8 @@ public:
virtual ~plAvOneShotTask();
// task protocol
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
virtual void LeaveAge(plArmatureMod *avatar);
void SetAnimName(char *name);
@ -246,8 +246,8 @@ public:
virtual ~plAvOneShotLinkTask();
// task protocol
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, hsScalar elapsed);
virtual hsBool Start(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
virtual hsBool Process(plArmatureMod *avatar, plArmatureBrain *brain, double time, float elapsed);
CLASSNAME_REGISTER( plAvOneShotLinkTask );
GETINTERFACE_ANY( plAvOneShotLinkTask, plAvOneShotTask );
@ -262,7 +262,7 @@ public:
protected:
char *fMarkerName;
double fStartTime;
hsScalar fMarkerTime;
float fMarkerTime;
hsBool fLinkFired;
};

View File

@ -230,7 +230,7 @@ void plClothingSDLModifier::HandleSingleSDR(const plStateDataRecord *sdr, plClot
int i;
uint8_t tint[3];
hsScalar tintScalar[3];
float tintScalar[3];
if (!strcmp(sdr->GetDescriptor()->GetName(), kStrClothingDescName))
{
// get item from clothesItem
@ -302,7 +302,7 @@ void plClothingSDLModifier::HandleSingleSDR(const plStateDataRecord *sdr, plClot
{
uint8_t blend;
faceBlends->Get(&blend, i);
clothing->fSkinBlends[i] = (hsScalar)blend / 255;
clothing->fSkinBlends[i] = (float)blend / 255;
}
}
}

View File

@ -376,7 +376,7 @@ uint16_t plMatrixBlend::GetPriority() {
hsBool plMatrixBlend::IsStoppedAt(double time)
{
hsScalar blend = fChannelBias->Value(time);
float blend = fChannelBias->Value(time);
if (blend == 0)
return fChannelA->IsStoppedAt(time);
if (blend == 1)
@ -401,7 +401,7 @@ const hsMatrix44 & plMatrixBlend::Value(double time, bool peek)
// ------------
const hsAffineParts & plMatrixBlend::AffineValue(double time, bool peek)
{
const hsScalar &blend = fChannelBias->Value(time);
const float &blend = fChannelBias->Value(time);
if(blend == 0) {
return fOptimizedA->AffineValue(time, peek);
} else {
@ -452,7 +452,7 @@ plAGChannel *plMatrixBlend::Optimize(double time)
{
fOptimizedA = (plMatrixChannel *)fChannelA->Optimize(time);
fOptimizedB = (plMatrixChannel *)fChannelB->Optimize(time);
hsScalar blend = fChannelBias->Value(time);
float blend = fChannelBias->Value(time);
if(blend == 0.0f)
return fOptimizedA;
if(blend == 1.0f)
@ -526,7 +526,7 @@ const hsMatrix44 & plMatrixControllerChannel::Value(double time, bool peek,
plControllerCacheInfo *cache)
{
plProfile_BeginTiming(AffineInterp);
fController->Interp((hsScalar)time, &fAP, cache);
fController->Interp((float)time, &fAP, cache);
plProfile_EndTiming(AffineInterp);
plProfile_BeginTiming(AffineCompose);
@ -548,7 +548,7 @@ const hsAffineParts & plMatrixControllerChannel::AffineValue(double time, bool p
plControllerCacheInfo *cache)
{
plProfile_BeginTiming(AffineInterp);
fController->Interp((hsScalar)time, &fAP, cache);
fController->Interp((float)time, &fAP, cache);
plProfile_EndTiming(AffineInterp);
return fAP;
}
@ -764,7 +764,7 @@ void plMatrixChannelApplicator::IApply(const plAGModifier *mod, double time)
//
///////////////////////////////////////////////////////////////////////////////////////////
const hsScalar plMatrixDelayedCorrectionApplicator::fDelayLength = 1.f; // seconds
const float plMatrixDelayedCorrectionApplicator::fDelayLength = 1.f; // seconds
void plMatrixDelayedCorrectionApplicator::SetCorrection(hsMatrix44 &cor)
{
@ -822,7 +822,7 @@ void plMatrixDelayedCorrectionApplicator::IApply(const plAGModifier *mod, double
hsAffineParts interpAP;
hsMatrix44 interpResult;
hsScalar blend = (hsScalar)((time - fDelayStart) / fDelayLength);
float blend = (float)((time - fDelayStart) / fDelayLength);
hsInterp::LinInterp(&fCorAP, &identAP, blend, &interpAP);
interpAP.ComposeMatrix(&interpResult);

View File

@ -348,7 +348,7 @@ public:
virtual hsBool CanBlend(plAGApplicator *app);
hsBool fIgnoreNextCorrection;
static const hsScalar fDelayLength; // static var for now.
static const float fDelayLength; // static var for now.
};
// PLMATRIXDIFFERENCEAPP

View File

@ -61,7 +61,7 @@ protected:
std::vector<plKey> fReceivers;
void IDeleteStageVec();
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; }
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; }
public:
plMultistageBehMod();

View File

@ -175,7 +175,7 @@ void plNPCSpawnMod::Write(hsStream *stream, hsResMgr *mgr)
// IEVAL
// attack of the bogons
hsBool plNPCSpawnMod::IEval(double secs, hsScalar del, uint32_t dirty)
hsBool plNPCSpawnMod::IEval(double secs, float del, uint32_t dirty)
{
return true;
}

View File

@ -65,7 +65,7 @@ public:
virtual void Write(hsStream *stream, hsResMgr *mgr);
protected:
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty);
virtual hsBool IEval(double secs, float del, uint32_t dirty);
void ISendNotify(plKey &avatarKey); // send our notification message
private:

View File

@ -55,7 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plOneShotMod : public plMultiModifier
{
protected:
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) {return true;}
virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;}
char * fAnimName; // the name of the animation associated with this one-shot
hsBool fDrivable; // whether the user can control the position of the animation
hsBool fReversable; // whether the user can back up the animation (fDrivable must be true as well)

View File

@ -56,8 +56,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define kGENERICCONTROLLERRADIUS 1.1f
#define kGENERICCONTROLLERHEIGHT 2.8f
//#define kSWIMMINGCONTACTSLOPELIMIT (cosf(hsScalarDegToRad(80.f)))
const hsScalar plMovementStrategy::kAirTimeThreshold = .1f; // seconds
//#define kSWIMMINGCONTACTSLOPELIMIT (cosf(hsDegreesToRadians(80.f)))
const float plMovementStrategy::kAirTimeThreshold = .1f; // seconds
bool CompareMatrices(const hsMatrix44 &matA, const hsMatrix44 &matB, float tolerance);
bool operator<(const plControllerSweepRecord left, const plControllerSweepRecord right)
{
@ -91,18 +91,18 @@ void plMovementStrategy::IApplyKinematic()
plPhysicalControllerCore::~plPhysicalControllerCore()
{
}
void plPhysicalControllerCore::Apply(hsScalar delSecs)
void plPhysicalControllerCore::Apply(float delSecs)
{
fSimLength=delSecs;
hsAssert(fMovementInterface, "plPhysicalControllerCore::Apply() missing a movement interface");
if(fMovementInterface)fMovementInterface->Apply(delSecs);
}
void plPhysicalControllerCore::PostStep(hsScalar delSecs)
void plPhysicalControllerCore::PostStep(float delSecs)
{
hsAssert(fMovementInterface, "plPhysicalControllerCore::PostStep() missing a movement interface");
if(fMovementInterface)fMovementInterface->PostStep(delSecs);
}
void plPhysicalControllerCore::Update(hsScalar delSecs)
void plPhysicalControllerCore::Update(float delSecs)
{
hsAssert(fMovementInterface, "plPhysicalControllerCore::Update() missing a movement interface");
if(fMovementInterface)fMovementInterface->Update(delSecs);
@ -122,7 +122,7 @@ void plPhysicalControllerCore::SendCorrectionMessages()
corrMsg->AddReceiver(fOwner);
corrMsg->Send();
}
plPhysicalControllerCore::plPhysicalControllerCore(plKey OwnerSceneObject, hsScalar height, hsScalar radius)
plPhysicalControllerCore::plPhysicalControllerCore(plKey OwnerSceneObject, float height, float radius)
:fMovementInterface(nil)
,fOwner(OwnerSceneObject)
,fHeight(height)
@ -188,21 +188,21 @@ void plPhysicalControllerCore::MoveActorToSim()
fAchievedLinearVelocity=fDisplacementThisStep/fSimLength;
else fAchievedLinearVelocity.Set(0.0f,0.0f,0.0f);
}
void plPhysicalControllerCore::IncrementAngle(hsScalar deltaAngle)
void plPhysicalControllerCore::IncrementAngle(float deltaAngle)
{
hsScalar angle;
float angle;
hsVector3 axis;
fLocalRotation.NormalizeIfNeeded();
fLocalRotation.GetAngleAxis(&angle, &axis);
// adjust it (quaternions are weird...)
if (axis.fZ < 0)
angle = (2*hsScalarPI) - angle; // axis is backwards, so reverse the angle too
angle = (2*M_PI) - angle; // axis is backwards, so reverse the angle too
angle += deltaAngle;
// make sure we wrap around
if (angle < 0)
angle = (2*hsScalarPI) + angle; // angle is -, so this works like a subtract
if (angle >= (2*hsScalarPI))
angle = angle - (2*hsScalarPI);
angle = (2*M_PI) + angle; // angle is -, so this works like a subtract
if (angle >= (2*M_PI))
angle = angle - (2*M_PI);
// and set the new angle
fLocalRotation.SetAngleAxis(angle, hsVector3(0,0,1));
}
@ -235,7 +235,7 @@ bool plPhysicalControllerCore::GetFacingPushingPhysical()
}
///////////////////////////
//Walking Strategy
void plWalkingStrategy::Apply(hsScalar delSecs)
void plWalkingStrategy::Apply(float delSecs)
{
//Apply Should Only be Called from a PhysicalControllerCore
hsAssert(fCore,"No Core shouldn't be Applying");
@ -304,13 +304,13 @@ void plWalkingStrategy::Apply(hsScalar delSecs)
{
// Get our previous z velocity. If we're on the ground, clamp it to zero at
// the largest, so we won't launch into the air if we're running uphill.
hsScalar prevZVel = AchievedLinearVelocity.fZ;
float prevZVel = AchievedLinearVelocity.fZ;
if (IsOnGround())
prevZVel = hsMinimum(prevZVel, 0.f);
hsScalar grav = kGravity * delSecs;
float grav = kGravity * delSecs;
// If our gravity contribution isn't high enough this frame, we won't
// report a collision even when standing on solid ground.
hsScalar maxGrav = -.001f / delSecs;
float maxGrav = -.001f / delSecs;
if (grav > maxGrav)
grav = maxGrav;
LinearVelocity.fZ = prevZVel + grav;
@ -447,23 +447,23 @@ void plWalkingStrategy::ICheckForFalseGround()
// seen up to 220 reached in actual gameplay in a situation where we'd want this to take effect.
// This is the same running into 2 walls where the angle between them is 60.
int i, j;
const hsScalar threshold = hsScalarDegToRad(240.f);
const float threshold = hsDegreesToRadians(240.f);
int numContacts = fContactNormals.GetCount() + fPrevSlidingNormals.GetCount();
if (numContacts >= 2)
{
// For extra fun... PhysX will actually report some collisions every other frame, as though
// we're bouncing back and forth between the two (or more) objects blocking us. So it's not
// enough to look at this frame's collisions, we have to check previous frames too.
hsTArray<hsScalar> fCollisionAngles;
hsTArray<float> fCollisionAngles;
fCollisionAngles.SetCount(numContacts);
int angleIdx = 0;
for (i = 0; i < fContactNormals.GetCount(); i++, angleIdx++)
{
fCollisionAngles[angleIdx] = hsATan2(fContactNormals[i].fY, fContactNormals[i].fX);
fCollisionAngles[angleIdx] = atan2(fContactNormals[i].fY, fContactNormals[i].fX);
}
for (i = 0; i < fPrevSlidingNormals.GetCount(); i++, angleIdx++)
{
fCollisionAngles[angleIdx] = hsATan2(fPrevSlidingNormals[i].fY, fPrevSlidingNormals[i].fX);
fCollisionAngles[angleIdx] = atan2(fPrevSlidingNormals[i].fY, fPrevSlidingNormals[i].fX);
}
// numContacts is rarely larger than 6, so let's do a simple bubble sort.
for (i = 0; i < numContacts; i++)
@ -472,7 +472,7 @@ void plWalkingStrategy::ICheckForFalseGround()
{
if (fCollisionAngles[i] > fCollisionAngles[j])
{
hsScalar tempAngle = fCollisionAngles[i];
float tempAngle = fCollisionAngles[i];
fCollisionAngles[i] = fCollisionAngles[j];
fCollisionAngles[j] = tempAngle;
}
@ -487,16 +487,16 @@ void plWalkingStrategy::ICheckForFalseGround()
if (i == numContacts)
{
// We got to the end. Check the last with the first and make your decision.
if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * hsScalarPI)))
if (!(fCollisionAngles[0] - fCollisionAngles[numContacts - 1] >= (threshold - 2 * M_PI)))
fFalseGround = true;
}
}
}
void plWalkingStrategy::Update(hsScalar delSecs)
void plWalkingStrategy::Update(float delSecs)
{
//Update Should Only be Called from a PhysicalControllerCore
hsAssert(fCore,"Running Update: but have no Core");
hsScalar AngularVelocity=fCore->GetAngularVelocity();
float AngularVelocity=fCore->GetAngularVelocity();
hsVector3 LinearVelocity=fCore->GetLinearVelocity();
if (!fCore->IsEnabled() || fCore->IsKinematic())
@ -515,7 +515,7 @@ void plWalkingStrategy::Update(hsScalar delSecs)
fCore->MoveActorToSim();
if (AngularVelocity != 0.f)
{
hsScalar deltaAngle=AngularVelocity*delSecs;
float deltaAngle=AngularVelocity*delSecs;
fCore->IncrementAngle( deltaAngle);
}
// We can't only send updates when the physical position changes because the
@ -539,7 +539,7 @@ void plWalkingStrategy::Update(hsScalar delSecs)
{
//we have hit our head and we don't have anything beneath our feet
//not really friction just a way to make it seem more realistic keep between 0 and 1
hsScalar headFriction=0.0f;
float headFriction=0.0f;
AchievedLinearVelocity.fX=(1.0f-headFriction)*LinearVelocity.fX;
AchievedLinearVelocity.fY=(1.0f-headFriction)*LinearVelocity.fY;
//only clamping when hitting head and going upwards, if going down leave it be
@ -565,7 +565,7 @@ void plWalkingStrategy::Update(hsScalar delSecs)
void plWalkingStrategy::IAddContactNormals(hsVector3& vec)
{
//TODO: ADD in functionality to Adjust walkable slope for controller, also apply that in here
hsScalar dot = vec * kAvatarUp;
float dot = vec * kAvatarUp;
if ( dot >= kSLOPELIMIT ) fGroundHit=true;
else plMovementStrategySimulationInterface::IAddContactNormals(vec);
}
@ -610,7 +610,7 @@ void plSwimStrategy::IAdjustBuoyancy()
else fBuoyancy =(depth/surfaceDepth );
}
void plSwimStrategy::Apply(hsScalar delSecs)
void plSwimStrategy::Apply(float delSecs)
{
hsAssert(fCore,"PlSwimStrategy::Apply No Core shouldn't be Applying");
uint32_t collideFlags =
@ -666,16 +666,16 @@ void plSwimStrategy::Apply(hsScalar delSecs)
LinearVelocity = subworldCI->GetWorldToLocal() * LinearVelocity;
}
IAdjustBuoyancy();
hsScalar zacc;
hsScalar retardent=0.0f;
static hsScalar FinalBobSpeed=0.5f;
float zacc;
float retardent=0.0f;
static float FinalBobSpeed=0.5f;
//trying to dampen the oscillations
if((AchievedLinearVelocity.fZ>FinalBobSpeed)||(AchievedLinearVelocity.fZ<-FinalBobSpeed))
retardent=AchievedLinearVelocity.fZ *-.90f;
zacc=(1-fBuoyancy)*-32.f + retardent;
hsVector3 linCurrent(0.0f,0.0f,0.0f);
hsScalar angCurrent = 0.f;
float angCurrent = 0.f;
if (fCurrentRegion != nil)
{
@ -702,14 +702,14 @@ void plSwimStrategy::Apply(hsScalar delSecs)
fContactNormals.SetCount(0);
fCore->Move(displacement,collideFlags,colFlags);
if((colFlags&kBottom)||(colFlags&kSides))fHadContacts=true;
hsScalar angvel=fCore->GetAngularVelocity();
float angvel=fCore->GetAngularVelocity();
fCore->SetAngularVelocity(angvel +angCurrent);
}
}
void plSwimStrategy::Update(hsScalar delSecs)
void plSwimStrategy::Update(float delSecs)
{
hsAssert(fCore,"Running Update: but have no Core");
hsScalar AngularVelocity=fCore->GetAngularVelocity();
float AngularVelocity=fCore->GetAngularVelocity();
hsVector3 LinearVelocity=fCore->GetLinearVelocity();
if (!fCore->IsEnabled() || fCore->IsKinematic())
{
@ -724,7 +724,7 @@ void plSwimStrategy::Update(hsScalar delSecs)
if (AngularVelocity != 0.f)
{
hsScalar deltaAngle=AngularVelocity*delSecs;
float deltaAngle=AngularVelocity*delSecs;
fCore->IncrementAngle( deltaAngle);
}
fCore->UpdateWorldRelativePos();
@ -737,7 +737,7 @@ void plSwimStrategy::Update(hsScalar delSecs)
void plSwimStrategy::IAddContactNormals(hsVector3& vec)
{
//TODO: ADD in functionality to Adjust walkable slope for controller, also apply that in here
hsScalar dot = vec * kAvatarUp;
float dot = vec * kAvatarUp;
if ( dot >= kSLOPELIMIT )
{
fOnGround=true;
@ -745,12 +745,12 @@ void plSwimStrategy::IAddContactNormals(hsVector3& vec)
}
else plMovementStrategySimulationInterface::IAddContactNormals(vec);
}
void plSwimStrategy::SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight)
void plSwimStrategy::SetSurface(plSwimRegionInterface *region, float surfaceHeight)
{
fCurrentRegion=region;
fSurfaceHeight=surfaceHeight;
}
void plRidingAnimatedPhysicalStrategy::Apply(hsScalar delSecs)
void plRidingAnimatedPhysicalStrategy::Apply(float delSecs)
{
hsVector3 LinearVelocity=fCore->GetLinearVelocity();
hsVector3 AchievedLinearVelocity=fCore->GetAchievedLinearVelocity();
@ -940,7 +940,7 @@ bool plRidingAnimatedPhysicalStrategy::ICheckMove(const hsPoint3& startPos, cons
}
}
void plRidingAnimatedPhysicalStrategy::Update(hsScalar delSecs)
void plRidingAnimatedPhysicalStrategy::Update(float delSecs)
{
if (!fCore->IsEnabled() || fCore->IsKinematic())
{
@ -949,7 +949,7 @@ void plRidingAnimatedPhysicalStrategy::Update(hsScalar delSecs)
}
fCore->CheckAndHandleAnyStateChanges();
}
void plRidingAnimatedPhysicalStrategy::PostStep(hsScalar delSecs)
void plRidingAnimatedPhysicalStrategy::PostStep(float delSecs)
{
if(!(!fCore->IsEnabled() || fCore->IsKinematic()))
{
@ -959,7 +959,7 @@ void plRidingAnimatedPhysicalStrategy::PostStep(hsScalar delSecs)
fTimeInAir = 0.f;
hsVector3 AchievedLinearVelocity, LinearVelocity;
AchievedLinearVelocity = fCore->GetLinearVelocity();
hsScalar AngularVelocity=fCore->GetAngularVelocity();
float AngularVelocity=fCore->GetAngularVelocity();
fCore->OverrideAchievedVelocity(AchievedLinearVelocity);
plSceneObject* so = plSceneObject::ConvertNoRef(fOwner->ObjectIsLoaded());
if (so)
@ -967,7 +967,7 @@ void plRidingAnimatedPhysicalStrategy::PostStep(hsScalar delSecs)
fCore->UpdateControllerAndPhysicalRep();
if (AngularVelocity != 0.f)
{
hsScalar deltaAngle=AngularVelocity*delSecs;
float deltaAngle=AngularVelocity*delSecs;
fCore->IncrementAngle( deltaAngle);
}
fCore->UpdateWorldRelativePos();

View File

@ -50,7 +50,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsQuat.h"
#define PHYSX_ONLY_TRIGGER_FROM_KINEMATIC 1
#define kSLOPELIMIT (cosf(hsScalarDegToRad(55.f)))
#define kSLOPELIMIT (cosf(hsDegreesToRadians(55.f)))
class plCoordinateInterface;
class plPhysical;
@ -72,12 +72,12 @@ class plMovementStrategySimulationInterface
{
public:
virtual void Apply(hsScalar delSecs)=0;
virtual void Update(hsScalar delSecs)=0;
virtual void Apply(float delSecs)=0;
virtual void Update(float delSecs)=0;
//most strategies don't require this. Only the ones that require behavior like a physical or need
//something after the sim step. this used to be taken care of by Update, but this was moved to take care of
//some of the frame lag
virtual void PostStep(hsScalar delSecs){};
virtual void PostStep(float delSecs){};
virtual void IAddContactNormals(hsVector3& vec){fContactNormals.Append(vec);}
virtual void AddOnTopOfObject(plPhysical* phys){ fOnTopOf.Append(phys);}
virtual void LeaveAge()
@ -95,7 +95,7 @@ class plControllerSweepRecord
public:
plPhysical *ObjHit;
hsPoint3 locHit;//World space
hsScalar TimeHit;//Normalized between 0 and 1
float TimeHit;//Normalized between 0 and 1
hsVector3 Norm;
};
bool operator<(const plControllerSweepRecord left, const plControllerSweepRecord right);
@ -105,9 +105,9 @@ public:
virtual ~plPhysicalControllerCore();
virtual void Move(hsVector3 displacement, unsigned int collideWith, unsigned int &collisionResults)=0;
virtual void SetMovementSimulationInterface(plMovementStrategySimulationInterface* strat){fMovementInterface=strat;}
virtual void Apply(hsScalar delSecs);
virtual void Update(hsScalar delSecs);
virtual void PostStep(hsScalar delSecs);
virtual void Apply(float delSecs);
virtual void Update(float delSecs);
virtual void PostStep(float delSecs);
// A disabled avatar doesn't move or accumulate air time if he's off the ground.
virtual void Enable(bool enable) = 0;
virtual bool IsEnabled() {return fEnabled;}
@ -125,9 +125,9 @@ public:
//when seeking no longer want to interact with exclusion regions
virtual void SetSeek(bool seek){fSeeking=seek;}
virtual bool IsSeeking(){return fSeeking;}
static plPhysicalControllerCore* Create(plKey ownerSO, hsScalar height, hsScalar radius);
static plPhysicalControllerCore* Create(plKey ownerSO, float height, float radius);
virtual plMovementStrategySimulationInterface* GetMovementInterface(){return fMovementInterface;}
plPhysicalControllerCore(plKey ownerSceneObject, hsScalar height, hsScalar radius);
plPhysicalControllerCore(plKey ownerSceneObject, float height, float radius);
virtual plKey GetOwner(){return fOwner;};
// Set the LOS DB this avatar will be in (only one)
virtual void SetLOSDB(plSimDefs::plLOSDB losDB) { fLOSDB = losDB; } ;
@ -162,36 +162,36 @@ public:
return vel/fSimLength;
}
void SendCorrectionMessages();
void IncrementAngle(hsScalar deltaAngle);
void IncrementAngle(float deltaAngle);
void UpdateWorldRelativePos();
virtual void SetLinearVelocity(const hsVector3& linearVel){fLinearVelocity=linearVel;}
//should actually be a 3 vector but everywhere else it is assumed to be just around Z
virtual void SetAngularVelocity(const hsScalar angvel){ fAngularVelocity=angvel;}
virtual void SetVelocities(const hsVector3& linearVel, hsScalar angVel)
virtual void SetAngularVelocity(const float angvel){ fAngularVelocity=angvel;}
virtual void SetVelocities(const hsVector3& linearVel, float angVel)
{
fLinearVelocity=linearVel;
fAngularVelocity=angVel;
}
virtual const hsVector3& GetLinearVelocity() ;
virtual hsScalar GetAngularVelocity(){return fAngularVelocity;}
virtual float GetAngularVelocity(){return fAngularVelocity;}
virtual const hsVector3& GetAchievedLinearVelocity()const {return fAchievedLinearVelocity;}
plPhysical* GetPushingPhysical();
bool GetFacingPushingPhysical();
virtual void SetPushingPhysical(plPhysical* pl){fPushingPhysical=pl;}
virtual void SetFacingPushingPhysical(bool ans){fFacingPushingPhysical=ans;}
//To be Used during runtime conversions, say to switch a tall controller to a ball for swimming
virtual void SetControllerDimensions(hsScalar radius, hsScalar height)=0;
virtual hsScalar GetControllerWidth(){return fRadius;}
virtual hsScalar GetControllerHeight(){return fHeight;}
virtual void SetControllerDimensions(float radius, float height)=0;
virtual float GetControllerWidth(){return fRadius;}
virtual float GetControllerHeight(){return fHeight;}
virtual void ResetAchievedLinearVelocity()
{
fAchievedLinearVelocity.Set(0.f,0.f,0.f);
}
virtual int SweepControllerPath(const hsPoint3& startPos,const hsPoint3& endPos, hsBool vsDynamics, hsBool vsStatics, uint32_t& vsSimGroups, std::multiset< plControllerSweepRecord >& WhatWasHitOut)=0;
//this should only be used to force a move it could place your head into a wall and that would be good
virtual hsScalar GetHeight() {return fHeight;}
virtual hsScalar GetRadius() {return fRadius;}
virtual float GetHeight() {return fHeight;}
virtual float GetRadius() {return fRadius;}
//Wether the avatar thing has mass and forces things down or not, and changes the way things move
//This is an attempt fix things like riding on an animated physical
virtual void BehaveLikeAnimatedPhysical(hsBool actLikeAnAnimatedPhys)=0;
@ -199,8 +199,8 @@ public:
protected:
plKey fOwner;
hsScalar fHeight;
hsScalar fRadius;
float fHeight;
float fRadius;
plKey fWorldKey;
plSimDefs::plLOSDB fLOSDB;
bool fSeeking;
@ -215,11 +215,11 @@ protected:
hsQuat fLocalRotation;
hsMatrix44 fPrevSubworldW2L;
hsVector3 fDisplacementThisStep;
hsScalar fSimLength;
float fSimLength;
//physical properties
hsVector3 fLinearVelocity;
hsScalar fAngularVelocity;
float fAngularVelocity;
hsVector3 fAchievedLinearVelocity;
plPhysical* fPushingPhysical;
bool fFacingPushingPhysical;
@ -251,7 +251,7 @@ public:
if(fCore)fCore->OverrideAchievedVelocity(AchievedLinearVelocity);
}
//proxy functions for Controller Core
virtual hsScalar GetAirTime() const { return fTimeInAir; }
virtual float GetAirTime() const { return fTimeInAir; }
virtual void ResetAirTime() { fTimeInAir = 0.f; }
protected:
@ -259,12 +259,12 @@ protected:
virtual void IApplyKinematic();
plPhysicalControllerCore* fCore;
hsVector3 fLinearAcceleration;
hsScalar fAngularAcceleration;
float fAngularAcceleration;
plKey fOwner;
static const hsScalar kAirTimeThreshold;
hsScalar fTimeInAir;
hsScalar fPreferedControllerWidth;
hsScalar fPreferedControllerHeight;
static const float kAirTimeThreshold;
float fTimeInAir;
float fPreferedControllerWidth;
float fPreferedControllerHeight;
};
@ -283,8 +283,8 @@ public:
fOnTopOfAnimatedPhysLastFrame=false;
}
virtual ~plWalkingStrategy(){};
virtual void Apply(hsScalar delSecs);
virtual void Update(hsScalar delSecs);
virtual void Apply(float delSecs);
virtual void Update(float delSecs);
bool IsOnGround() const { return fTimeInAir < kAirTimeThreshold || fFalseGround; }
bool IsOnFalseGround() const { return fFalseGround && !fGroundHit; }
@ -309,10 +309,10 @@ class plSwimStrategy: public plMovementStrategy
public:
plSwimStrategy(plPhysicalControllerCore *core);
virtual ~plSwimStrategy(){};
void SetSurface(plSwimRegionInterface *region, hsScalar surfaceHeight);
virtual void Apply(hsScalar delSecs);
virtual void Update(hsScalar delSecs);
hsScalar GetBuoyancy() { return fBuoyancy; }
void SetSurface(plSwimRegionInterface *region, float surfaceHeight);
virtual void Apply(float delSecs);
virtual void Update(float delSecs);
float GetBuoyancy() { return fBuoyancy; }
hsBool IsOnGround() { return fOnGround; }
hsBool HadContacts() { return fHadContacts; }
virtual void IAddContactNormals(hsVector3& vec);
@ -320,10 +320,10 @@ protected:
virtual hsBool IRequireBehaviourLikeAnAnimatedPhysical(){return true;}
private:
void IAdjustBuoyancy();
hsScalar fBuoyancy;
float fBuoyancy;
hsBool fOnGround;
hsBool fHadContacts;
hsScalar fSurfaceHeight;
float fSurfaceHeight;
plSwimRegionInterface *fCurrentRegion;
};
class plRidingAnimatedPhysicalStrategy : public plWalkingStrategy
@ -332,9 +332,9 @@ public:
plRidingAnimatedPhysicalStrategy(plPhysicalControllerCore *core ) :
fNeedVelocityOverride(false),fStartJump(false),plWalkingStrategy(core){};
virtual ~plRidingAnimatedPhysicalStrategy(){};
virtual void Apply(hsScalar delSecs);
virtual void Update(hsScalar delSecs);
virtual void PostStep(hsScalar delSecs);
virtual void Apply(float delSecs);
virtual void Update(float delSecs);
virtual void PostStep(float delSecs);
bool IsOnGround() const { return fTimeInAir < kAirTimeThreshold || fFalseGround; }
bool IsOnFalseGround() const { return fFalseGround && !fGroundHit; }
void GroundHit() { fGroundHit = true; }

View File

@ -242,7 +242,7 @@ plPointBlend::~plPointBlend()
// ------------
hsBool plPointBlend::IsStoppedAt(double time)
{
hsScalar blend = fChannelBias->Value(time);
float blend = fChannelBias->Value(time);
if (blend == 0)
return fPointA->IsStoppedAt(time);
if (blend == 1)
@ -257,7 +257,7 @@ const hsPoint3 &plPointBlend::Value(double time)
{
if (fPointA && fPointB)
{
hsScalar curBlend = fChannelBias->Value(time);
float curBlend = fChannelBias->Value(time);
if(curBlend == 0) {
fPointA->Value(fResult, time);
} else {
@ -360,7 +360,7 @@ const hsPoint3 & plPointControllerChannel::Value(double time)
// VALUE(time)
const hsPoint3 & plPointControllerChannel::Value(double time, plControllerCacheInfo *cache)
{
fController->Interp((hsScalar)time, &fResult, cache);
fController->Interp((float)time, &fResult, cache);
return fResult;
}

View File

@ -246,7 +246,7 @@ plQuatBlend::~plQuatBlend()
hsBool plQuatBlend::IsStoppedAt(double time)
{
hsScalar blend = fChannelBias->Value(time);
float blend = fChannelBias->Value(time);
if (blend == 0)
return fQuatA->IsStoppedAt(time);
if (blend == 1)

View File

@ -80,14 +80,14 @@ plScalarChannel::~plScalarChannel()
// value --------------------------------------------------------
// ------
const hsScalar & plScalarChannel::Value(double time, hsBool peek)
const float & plScalarChannel::Value(double time, hsBool peek)
{
return fResult;
}
// value --------------------------------------------------------------
// ------
void plScalarChannel::Value(hsScalar &scalar, double time, hsBool peek)
void plScalarChannel::Value(float &scalar, double time, hsBool peek)
{
scalar = Value(time, peek);
}
@ -146,7 +146,7 @@ plScalarConstant::plScalarConstant()
// ctor ------------------------------------------
// -----
plScalarConstant::plScalarConstant(hsScalar value)
plScalarConstant::plScalarConstant(float value)
{
fResult = value;
}
@ -202,7 +202,7 @@ hsBool plScalarTimeScale::IsStoppedAt(double time)
}
// VALUE
const hsScalar & plScalarTimeScale::Value(double time, hsBool peek)
const float & plScalarTimeScale::Value(double time, hsBool peek)
{
fResult = fChannelIn->Value(fTimeSource->Value(time, peek));
@ -265,7 +265,7 @@ plScalarBlend::~plScalarBlend()
// ------------
hsBool plScalarBlend::IsStoppedAt(double time)
{
hsScalar blend = fChannelBias->Value(time);
float blend = fChannelBias->Value(time);
if (blend == 0)
return fChannelA->IsStoppedAt(time);
if (blend == 1)
@ -276,17 +276,17 @@ hsBool plScalarBlend::IsStoppedAt(double time)
// Value ------------------------------------------------------
// ------
const hsScalar & plScalarBlend::Value(double time, hsBool peek)
const float & plScalarBlend::Value(double time, hsBool peek)
{
hsScalar curBlend = fChannelBias->Value(time, peek);
float curBlend = fChannelBias->Value(time, peek);
if(curBlend == 0) {
fChannelA->Value(fResult, time, peek);
} else {
if(curBlend == 1) {
fChannelB->Value(fResult, time, peek);
} else {
const hsScalar &scalarA = fChannelA->Value(time, peek);
const hsScalar &scalarB = fChannelB->Value(time, peek);
const float &scalarA = fChannelA->Value(time, peek);
const float &scalarB = fChannelB->Value(time, peek);
fResult = scalarA + curBlend * (scalarB - scalarA);
}
}
@ -353,17 +353,17 @@ plScalarControllerChannel::~plScalarControllerChannel()
// Value ------------------------------------------------------------------
// ------
const hsScalar & plScalarControllerChannel::Value(double time, hsBool peek)
const float & plScalarControllerChannel::Value(double time, hsBool peek)
{
return Value(time, peek, nil);
}
// Value ------------------------------------------------------------------
// ------
const hsScalar & plScalarControllerChannel::Value(double time, hsBool peek,
const float & plScalarControllerChannel::Value(double time, hsBool peek,
plControllerCacheInfo *cache)
{
fController->Interp((hsScalar)time, &fResult, cache);
fController->Interp((float)time, &fResult, cache);
return fResult;
}
@ -428,7 +428,7 @@ plScalarControllerCacheChannel::~plScalarControllerCacheChannel()
// Value ---------------------------------------------------------------------
// ------
const hsScalar & plScalarControllerCacheChannel::Value(double time, bool peek)
const float & plScalarControllerCacheChannel::Value(double time, bool peek)
{
return fControllerChannel->Value(time, peek, fCache);
}
@ -486,7 +486,7 @@ hsBool plATCChannel::IsStoppedAt(double time)
// Value -----------------------------------------------------
// ------
const hsScalar & plATCChannel::Value(double time, hsBool peek)
const float & plATCChannel::Value(double time, hsBool peek)
{
fResult = (peek ? fConvert->WorldToAnimTimeNoUpdate(time) : fConvert->WorldToAnimTime(time));
return fResult;
@ -506,7 +506,7 @@ plScalarSDLChannel::plScalarSDLChannel()
fResult = 0;
}
plScalarSDLChannel::plScalarSDLChannel(hsScalar length)
plScalarSDLChannel::plScalarSDLChannel(float length)
: fLength(length), fVar(nil)
{
fResult = 0;
@ -526,7 +526,7 @@ hsBool plScalarSDLChannel::IsStoppedAt(double time)
// Value -----------------------------------------------------------
// ------
const hsScalar & plScalarSDLChannel::Value(double time, hsBool peek)
const float & plScalarSDLChannel::Value(double time, hsBool peek)
{
if (fVar)
fVar->Get(&fResult);
@ -557,8 +557,8 @@ void plSpotInnerApplicator::IApply(const plAGModifier *mod, double time)
plSpotLightInfo *sli = plSpotLightInfo::ConvertNoRef(IGetGI(mod, plSpotLightInfo::Index()));
const hsScalar &scalar = scalarChan->Value(time);
sli->SetSpotInner(hsScalarDegToRad(scalar)*0.5f);
const float &scalar = scalarChan->Value(time);
sli->SetSpotInner(hsDegreesToRadians(scalar)*0.5f);
}
// IApply --------------------------------------------------------------
@ -570,8 +570,8 @@ void plSpotOuterApplicator::IApply(const plAGModifier *mod, double time)
plSpotLightInfo *sli = plSpotLightInfo::ConvertNoRef(IGetGI(mod, plSpotLightInfo::Index()));
const hsScalar &scalar = scalarChan->Value(time);
sli->SetSpotOuter(hsScalarDegToRad(scalar)*0.5f);
const float &scalar = scalarChan->Value(time);
sli->SetSpotOuter(hsDegreesToRadians(scalar)*0.5f);
}

View File

@ -74,15 +74,15 @@ class plControllerCacheInfo;
class plScalarChannel : public plAGChannel
{
protected:
hsScalar fResult;
float fResult;
public:
plScalarChannel();
virtual ~plScalarChannel();
// AG PROTOCOL
virtual const hsScalar & Value(double time, hsBool peek = false);
virtual void Value(hsScalar &result, double time, hsBool peek = false);
virtual const float & Value(double time, hsBool peek = false);
virtual void Value(float &result, double time, hsBool peek = false);
// combine it (allocates combine object)
virtual plAGChannel * MakeCombine(plAGChannel * channelB);
@ -109,11 +109,11 @@ class plScalarConstant : public plScalarChannel
{
public:
plScalarConstant();
plScalarConstant(hsScalar value);
plScalarConstant(float value);
virtual ~plScalarConstant();
void Set(hsScalar value) { fResult = value; }
hsScalar Get() { return fResult; }
void Set(float value) { fResult = value; }
float Get() { return fResult; }
// PLASMA PROTOCOL
CLASSNAME_REGISTER( plScalarConstant );
@ -141,7 +141,7 @@ public:
virtual ~plScalarTimeScale();
virtual hsBool IsStoppedAt(double time);
virtual const hsScalar & Value(double time, hsBool peek = false);
virtual const float & Value(double time, hsBool peek = false);
virtual plAGChannel * Detach(plAGChannel * channel);
// PLASMA PROTOCOL
@ -179,7 +179,7 @@ public:
virtual hsBool IsStoppedAt(double time);
// AG PROTOCOL
virtual const hsScalar & Value(double time, hsBool peek = false);
virtual const float & Value(double time, hsBool peek = false);
// remove the specified channel from our graph
virtual plAGChannel * Detach(plAGChannel * channel);
@ -205,8 +205,8 @@ public:
virtual ~plScalarControllerChannel();
// AG PROTOCOL
virtual const hsScalar & Value(double time, hsBool peek = false);
virtual const hsScalar & Value(double time, hsBool peek, plControllerCacheInfo *cache);
virtual const float & Value(double time, hsBool peek = false);
virtual const float & Value(double time, hsBool peek, plControllerCacheInfo *cache);
virtual plAGChannel *MakeCacheChannel(plAnimTimeConvert *atc);
@ -235,7 +235,7 @@ public:
plScalarControllerCacheChannel(plScalarControllerChannel *channel, plControllerCacheInfo *cache);
virtual ~plScalarControllerCacheChannel();
virtual const hsScalar & Value(double time, bool peek = false);
virtual const float & Value(double time, bool peek = false);
virtual plAGChannel * Detach(plAGChannel * channel);
@ -261,7 +261,7 @@ public:
virtual ~plATCChannel();
virtual hsBool IsStoppedAt(double time);
virtual const hsScalar & Value(double time, hsBool peek = false);
virtual const float & Value(double time, hsBool peek = false);
// PLASMA PROTOCOL
CLASSNAME_REGISTER( plATCChannel );
@ -276,15 +276,15 @@ class plScalarSDLChannel : public plScalarChannel
{
protected:
plSimpleStateVariable *fVar;
hsScalar fLength;
float fLength;
public:
plScalarSDLChannel();
plScalarSDLChannel(hsScalar length);
plScalarSDLChannel(float length);
virtual ~plScalarSDLChannel();
virtual hsBool IsStoppedAt(double time);
virtual const hsScalar & Value(double time, hsBool peek = false);
virtual const float & Value(double time, hsBool peek = false);
void SetVar(plSimpleStateVariable *var) { fVar = var; }

View File

@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plSeekPointMod : public plMultiModifier
{
protected:
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) {return true;}
virtual hsBool IEval(double secs, float del, uint32_t dirty) {return true;}
char * fName; // public because you can't change it
public:

View File

@ -264,7 +264,7 @@ void plSittingModifier::Trigger(const plArmatureMod *avMod, plNotifyMsg *enterNo
// IIsClosestAnim -------------------------------------------------------------------
// ---------------
bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, hsScalar &closestDist,
bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, float &closestDist,
hsPoint3 curPosition, const plArmatureMod *avatar)
{
plAGAnim *anim = avatar->FindCustomAnim(animName);
@ -283,7 +283,7 @@ bool IIsClosestAnim(const char *animName, hsMatrix44 &sitGoal, hsScalar &closest
hsMatrix44 candidateGoal = sitGoal * animEndToStart;
hsPoint3 distP = candidateGoal.GetTranslate() - curPosition;
hsVector3 distV(distP.fX, distP.fY, distP.fZ);
hsScalar dist = distP.Magnitude();
float dist = distP.Magnitude();
if(closestDist == 0.0 || dist < closestDist)
{
closestDist = dist;
@ -307,7 +307,7 @@ plAvBrainGeneric *plSittingModifier::IBuildSitBrain(plKey avModKey, plKey seekKe
hsMatrix44 animEndToStart;
hsMatrix44 sitGoal = seekObj->GetLocalToWorld();
hsMatrix44 candidateGoal;
hsScalar closestDist = 0.0f;
float closestDist = 0.0f;
uint8_t closestApproach = 0;
hsPoint3 curPosition = avatar->GetTarget(0)->GetLocalToWorld().GetTranslate();
char * sitAnimName = nil;

View File

@ -113,7 +113,7 @@ protected:
plAvBrainGeneric * IBuildSitBrain(plKey avModKey, plKey seekKey,char **pAnimName, plNotifyMsg *enterNotify, plNotifyMsg *exitNotify);
/** Unused. */
virtual hsBool IEval(double secs, hsScalar del, uint32_t dirty) { return true; }
virtual hsBool IEval(double secs, float del, uint32_t dirty) { return true; }
/** An array of keys to objects that are interested in receiving our sit messages. */
hsTArray<plKey> fNotifyKeys;

View File

@ -64,7 +64,7 @@ void plSwimRegionInterface::Write(hsStream* s, hsResMgr* mgr)
s->WriteLEScalar(fMaxUpwardVel);
}
void plSwimRegionInterface::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed)
void plSwimRegionInterface::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed)
{
linearResult.Set(0.f, 0.f, 0.f);
angularResult = 0.f;
@ -126,7 +126,7 @@ hsBool plSwimCircularCurrentRegion::MsgReceive(plMessage* msg)
return plSwimRegionInterface::MsgReceive(msg);
}
void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed)
void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed)
{
if (elapsed <= 0.f || fCurrentSO == nil || GetProperty(kDisable))
{
@ -151,8 +151,8 @@ void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical,
hsBool applyPull = true;
hsVector3 pos2Center(center.fX - pos.fX, center.fY - pos.fY, 0.f);
hsScalar pullVel;
hsScalar distSq = pos2Center.MagnitudeSquared();
float pullVel;
float distSq = pos2Center.MagnitudeSquared();
if (distSq < .5)
{
// Don't want to pull us too close to the center, or we
@ -176,12 +176,12 @@ void plSwimCircularCurrentRegion::GetCurrent(plPhysicalControllerCore *physical,
hsVector3 v1 = linearResult * elapsed - pos2Center;
hsVector3 v2 = -pos2Center;
hsScalar invCos = v1.InnerProduct(v2) / v1.Magnitude() / v2.Magnitude();
float invCos = v1.InnerProduct(v2) / v1.Magnitude() / v2.Magnitude();
if (invCos > 1)
invCos = 1;
if (invCos < -1)
invCos = -1;
angularResult = hsACosine(invCos) / elapsed;
angularResult = acos(invCos) / elapsed;
// hsAssert(real_finite(linearResult.fX) &&
// real_finite(linearResult.fY) &&
@ -242,7 +242,7 @@ hsBool plSwimStraightCurrentRegion::MsgReceive(plMessage* msg)
return plSwimRegionInterface::MsgReceive(msg);
}
void plSwimStraightCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed)
void plSwimStraightCurrentRegion::GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed)
{
angularResult = 0.f;
@ -267,8 +267,8 @@ void plSwimStraightCurrentRegion::GetCurrent(plPhysicalControllerCore *physical,
}
hsVector3 pos2Center(center.fX - pos.fX, center.fY - pos.fY, 0.f);
hsScalar dist = current.InnerProduct(pos - center);
hsScalar pullVel;
float dist = current.InnerProduct(pos - center);
float pullVel;
if (dist <= fNearDist)
pullVel = fNearVel;

View File

@ -67,11 +67,11 @@ public:
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed);
virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed);
hsScalar fDownBuoyancy;
hsScalar fUpBuoyancy;
hsScalar fMaxUpwardVel;
float fDownBuoyancy;
float fUpBuoyancy;
float fMaxUpwardVel;
};
class plSwimCircularCurrentRegion : public plSwimRegionInterface
@ -86,14 +86,14 @@ public:
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed);
virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed);
virtual hsBool MsgReceive(plMessage* msg);
hsScalar fRotation;
hsScalar fPullNearDistSq;
hsScalar fPullNearVel;
hsScalar fPullFarDistSq;
hsScalar fPullFarVel;
float fRotation;
float fPullNearDistSq;
float fPullNearVel;
float fPullFarDistSq;
float fPullFarVel;
protected:
plSceneObject *fCurrentSO;
@ -111,13 +111,13 @@ public:
virtual void Read(hsStream* stream, hsResMgr* mgr);
virtual void Write(hsStream* stream, hsResMgr* mgr);
virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, hsScalar &angularResult, hsScalar elapsed);
virtual void GetCurrent(plPhysicalControllerCore *physical, hsVector3 &linearResult, float &angularResult, float elapsed);
virtual hsBool MsgReceive(plMessage* msg);
hsScalar fNearDist;
hsScalar fNearVel;
hsScalar fFarDist;
hsScalar fFarVel;
float fNearDist;
float fNearVel;
float fFarDist;
float fFarVel;
protected:
plSceneObject *fCurrentSO;