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

@ -123,7 +123,7 @@ double plTimerShare::IncSysSeconds()
else if( fSmoothingClampSecs >= 0 )
{
double t = GetSeconds();
hsScalar delSys = hsScalar(t - fRealSeconds);
float delSys = float(t - fRealSeconds);
fClamping = ( (fTimeClampSecs > 0) && (delSys > fTimeClampSecs) );
if (fClamping)
{
@ -132,8 +132,8 @@ double plTimerShare::IncSysSeconds()
delSys *= fSysTimeScale;
if( fDelSysSeconds > 0 && fDelSysSeconds < fSmoothingClampSecs )
{
const hsScalar kFrac = 0.1f;
const hsScalar kOneMinusFrac = 1.f-kFrac;
const float kFrac = 0.1f;
const float kOneMinusFrac = 1.f-kFrac;
delSys *= kFrac;
delSys += fDelSysSeconds * kOneMinusFrac;
}
@ -146,7 +146,7 @@ double plTimerShare::IncSysSeconds()
{
fRealSeconds = t;
t = GetSeconds();
delSys = hsScalar(t - fRealSeconds);
delSys = float(t - fRealSeconds);
count--;
}
#endif
@ -182,12 +182,12 @@ double plTimerShare::IncSysSeconds()
}
avg /= double(kSmoothBuffUsed);
plCONST(hsScalar) kMaxSmoothable(0.15f);
fDelSysSeconds = hsScalar(avg - fRealSeconds) * fSysTimeScale;
plCONST(float) kMaxSmoothable(0.15f);
fDelSysSeconds = float(avg - fRealSeconds) * fSysTimeScale;
if( fDelSysSeconds > kMaxSmoothable * fSysTimeScale )
{
avg = t;
fDelSysSeconds = hsScalar(avg - fRealSeconds) * fSysTimeScale;
fDelSysSeconds = float(avg - fRealSeconds) * fSysTimeScale;
fResetSmooth = true;
}
fSysSeconds += fDelSysSeconds;
@ -312,7 +312,7 @@ uint32_t hsTimer::GetPrecTickCount()
return 1;
#endif
}
uint32_t hsTimer::PrecSecsToTicks(hsScalar secs)
uint32_t hsTimer::PrecSecsToTicks(float secs)
{
return (uint32_t)(((double)secs) * fPrecTicksPerSec);
}

View File

@ -57,7 +57,7 @@ protected:
T fGoal;
T fInit;
double fStart;
hsScalar fInvSecs;
float fInvSecs;
public:
plTimedValue() {}
@ -67,7 +67,7 @@ public:
plTimedValue<T>& operator=(const plTimedValue<T>& o) { return Set(o, 0.f); }
plTimedValue<T>& operator=(const T& v) { return Set(v, 0.f); }
plTimedValue<T>& Set(const T& v, hsScalar secs=0);
plTimedValue<T>& Set(const T& v, float secs=0);
operator T () const { return Value(); }
@ -83,7 +83,7 @@ public:
plTimedSimple<T>& operator=(const plTimedValue<T>& o) { return Set(o, 0.f); }
plTimedSimple<T>& operator=(const T& v) { return Set(v, 0.f); }
plTimedSimple<T>& Set(const T& v, hsScalar secs=0) { plTimedValue<T>::Set(v, secs); return *this; }
plTimedSimple<T>& Set(const T& v, float secs=0) { plTimedValue<T>::Set(v, secs); return *this; }
void Read(hsStream* s);
void Write(hsStream* s) const;
@ -97,14 +97,14 @@ public:
plTimedCompound<T>& operator=(const plTimedValue<T>& o) { return Set(o, 0.f); }
plTimedCompound<T>& operator=(const T& v) { return Set(v, 0.f); }
plTimedCompound<T>& Set(const T& v, hsScalar secs=0) { plTimedValue<T>::Set(v, secs); return *this; }
plTimedCompound<T>& Set(const T& v, float secs=0) { plTimedValue<T>::Set(v, secs); return *this; }
void Read(hsStream* s);
void Write(hsStream* s) const;
};
template <class T>
plTimedValue<T>& plTimedValue<T>::Set(const T& v, hsScalar secs)
plTimedValue<T>& plTimedValue<T>::Set(const T& v, float secs)
{
if( secs <= 0 )
{
@ -126,7 +126,7 @@ T plTimedValue<T>::Value() const
{
if( fInvSecs > 0 )
{
hsScalar t = (hsScalar)((hsTimer::GetSysSeconds() - fStart) * fInvSecs);
float t = (float)((hsTimer::GetSysSeconds() - fStart) * fInvSecs);
hsAssert(t >= 0, "Moving back in time");
if( t < 1.f )

View File

@ -82,7 +82,7 @@ hsBool plTimerCallbackManager::MsgReceive(plMessage* msg)
return hsKeyedObject::MsgReceive(msg);
}
plTimerCallback* plTimerCallbackManager::NewTimer(hsScalar time, plMessage* pMsg)
plTimerCallback* plTimerCallbackManager::NewTimer(float time, plMessage* pMsg)
{
plTimerCallback* t = TRACKED_NEW plTimerCallback( hsTimer::GetSysSeconds() + time, pMsg );
fCallbacks.Append(t);
@ -92,8 +92,8 @@ plTimerCallback* plTimerCallbackManager::NewTimer(hsScalar time, plMessage* pMsg
for (int j = i + 1; j < fCallbacks.Count(); j++)
{
#if 0
hsScalar a = fCallbacks[i]->fTime;
hsScalar b = fCallbacks[j]->fTime;
float a = fCallbacks[i]->fTime;
float b = fCallbacks[j]->fTime;
#endif
if (fCallbacks[i]->fTime < fCallbacks[j]->fTime)
{

View File

@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef plTimerCallbackManager_Defined
#define plTimerCallbackManager_Defined
#include "hsScalar.h"
#include "pnKeyedObject/hsKeyedObject.h"
#include "hsTemplates.h"
@ -72,7 +72,7 @@ public:
CLASSNAME_REGISTER( plTimerCallbackManager );
GETINTERFACE_ANY( plTimerCallbackManager, hsKeyedObject );
virtual plTimerCallback* NewTimer(hsScalar time, plMessage* pMsg);
virtual plTimerCallback* NewTimer(float time, plMessage* pMsg);
hsBool CancelCallback(plTimerCallback* pTimer);
hsBool CancelCallbacksToKey(const plKey& key);
@ -100,7 +100,7 @@ public:
// External modifier use only
static void SetTheTimerCallbackMgr(plTimerCallbackManager *mgr) { fMgr = mgr; }
static plTimerCallback* NewTimer(hsScalar time, plMessage* pMsg) { return (fMgr->NewTimer(time, pMsg)); }
static plTimerCallback* NewTimer(float time, plMessage* pMsg) { return (fMgr->NewTimer(time, pMsg)); }
static hsBool CancelCallback(plTimerCallback* pTimer);
static hsBool CancelCallbacksToKey(const plKey& key);
};