1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-20 04:09:16 +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

@ -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;
}